vendor: 20,782 bytes, line 1
1function GT(Uo,L_){for(var Ws=0;Ws<L_.length;Ws++){const Vo=L_[Ws];if(typeof Vo!="string"&&!Array.isArray(Vo)){for(const Xs in Vo)if(Xs!=="default"&&!(Xs in Uo)){const Gl=Object.getOwnPropertyDescriptor(Vo,Xs);Gl&&Object.defineProperty(Uo,Xs,Gl.get?Gl:{enumerable:!0,get:()=>Vo[Xs]})}}}return Object.freeze(Object.defineProperty(Uo,Symbol.toStringTag,{value:"Module"}))}function $T(Uo){return Uo&&Uo.__esModule&&Object.prototype.hasOwnProperty.call(Uo,"default")?Uo.default:Uo}var z_={exports:{}},HT=z_.exports,Tb;function qT(){return Tb||(Tb=1,(function(Uo,L_){(function(Ws,Vo){Uo.exports=Vo()})(HT,(function(){let Ws,Vo,Xs;function Gl(h,U){if(!Ws)Ws=U;else if(!Vo)Vo=U;else{const sn={};Ws(void 0,sn),Xs=U(sn);const ji="self.onerror = function() { console.error('An error occurred while parsing the WebWorker bundle. This is most likely due to improper transpilation by Babel; please see https://docs.mapbox.com/mapbox-gl-js/guides/install/#transpiling'); }; var sharedChunk = {}; ("+Ws+")(undefined, sharedChunk); ("+Vo+")(undefined, sharedChunk); self.onerror = null;";typeof window<"u"&&window&&window.URL&&window.URL.createObjectURL&&(Xs.workerUrl=window.URL.createObjectURL(new Blob([ji],{type:"text/javascript"})))}}Gl(["require","exports"],function(h,U){var sn=1e-6,ji=typeof Float32Array<"u"?Float32Array:Array;function eu(r,e){var i=e[0],n=e[1],s=e[2],l=e[3],u=i*l-s*n;return u?(r[0]=l*(u=1/u),r[1]=-n*u,r[2]=-s*u,r[3]=i*u,r):null}function $l(){var r=new ji(9);return ji!=Float32Array&&(r[1]=0,r[2]=0,r[3]=0,r[5]=0,r[6]=0,r[7]=0),r[0]=1,r[4]=1,r[8]=1,r}function ps(r,e){var i=e[0],n=e[1],s=e[2],l=e[3],u=e[4],f=e[5],p=e[6],g=e[7],x=e[8];return r[0]=u*x-f*g,r[1]=s*g-n*x,r[2]=n*f-s*u,r[3]=f*p-l*x,r[4]=i*x-s*p,r[5]=s*l-i*f,r[6]=l*g-u*p,r[7]=n*p-i*g,r[8]=i*u-n*l,r}function ms(r,e,i){var n=e[0],s=e[1],l=e[2],u=e[3],f=e[4],p=e[5],g=e[6],x=e[7],b=e[8],w=i[0],S=i[1],E=i[2],M=i[3],C=i[4],R=i[5],F=i[6],z=i[7],j=i[8];return r[0]=w*n+S*u+E*g,r[1]=w*s+S*f+E*x,r[2]=w*l+S*p+E*b,r[3]=M*n+C*u+R*g,r[4]=M*s+C*f+R*x,r[5]=M*l+C*p+R*b,r[6]=F*n+z*u+j*g,r[7]=F*s+z*f+j*x,r[8]=F*l+z*p+j*b,r}function Na(){var r=new ji(16);return ji!=Float32Array&&(r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=0,r[12]=0,r[13]=0,r[14]=0),r[0]=1,r[5]=1,r[10]=1,r[15]=1,r}function Hl(r){var e=new ji(16);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e[4]=r[4],e[5]=r[5],e[6]=r[6],e[7]=r[7],e[8]=r[8],e[9]=r[9],e[10]=r[10],e[11]=r[11],e[12]=r[12],e[13]=r[13],e[14]=r[14],e[15]=r[15],e}function Ot(r){return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=1,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function an(r,e){var i=e[0],n=e[1],s=e[2],l=e[3],u=e[4],f=e[5],p=e[6],g=e[7],x=e[8],b=e[9],w=e[10],S=e[11],E=e[12],M=e[13],C=e[14],R=e[15],F=i*f-n*u,z=i*p-s*u,j=i*g-l*u,$=n*p-s*f,q=n*g-l*f,ie=s*g-l*p,W=x*M-b*E,Q=x*C-w*E,Y=x*R-S*E,ee=b*C-w*M,me=b*R-S*M,ge=w*R-S*C,Te=F*ge-z*me+j*ee+$*Y-q*Q+ie*W;return Te?(r[0]=(f*ge-p*me+g*ee)*(Te=1/Te),r[1]=(s*me-n*ge-l*ee)*Te,r[2]=(M*ie-C*q+R*$)*Te,r[3]=(w*q-b*ie-S*$)*Te,r[4]=(p*Y-u*ge-g*Q)*Te,r[5]=(i*ge-s*Y+l*Q)*Te,r[6]=(C*j-E*ie-R*z)*Te,r[7]=(x*ie-w*j+S*z)*Te,r[8]=(u*me-f*Y+g*W)*Te,r[9]=(n*Y-i*me-l*W)*Te,r[10]=(E*q-M*j+R*F)*Te,r[11]=(b*j-x*q-S*F)*Te,r[12]=(f*Q-u*ee-p*W)*Te,r[13]=(i*ee-n*Q+s*W)*Te,r[14]=(M*z-E*$-C*F)*Te,r[15]=(x*$-b*z+w*F)*Te,r):null}function gi(r,e,i){var n=e[0],s=e[1],l=e[2],u=e[3],f=e[4],p=e[5],g=e[6],x=e[7],b=e[8],w=e[9],S=e[10],E=e[11],M=e[12],C=e[13],R=e[14],F=e[15],z=i[0],j=i[1],$=i[2],q=i[3];return r[0]=z*n+j*f+$*b+q*M,r[1]=z*s+j*p+$*w+q*C,r[2]=z*l+j*g+$*S+q*R,r[3]=z*u+j*x+$*E+q*F,r[4]=(z=i[4])*n+(j=i[5])*f+($=i[6])*b+(q=i[7])*M,r[5]=z*s+j*p+$*w+q*C,r[6]=z*l+j*g+$*S+q*R,r[7]=z*u+j*x+$*E+q*F,r[8]=(z=i[8])*n+(j=i[9])*f+($=i[10])*b+(q=i[11])*M,r[9]=z*s+j*p+$*w+q*C,r[10]=z*l+j*g+$*S+q*R,r[11]=z*u+j*x+$*E+q*F,r[12]=(z=i[12])*n+(j=i[13])*f+($=i[14])*b+(q=i[15])*M,r[13]=z*s+j*p+$*w+q*C,r[14]=z*l+j*g+$*S+q*R,r[15]=z*u+j*x+$*E+q*F,r}function Cr(r,e,i){var n,s,l,u,f,p,g,x,b,w,S,E,M=i[0],C=i[1],R=i[2];return e===r?(r[12]=e[0]*M+e[4]*C+e[8]*R+e[12],r[13]=e[1]*M+e[5]*C+e[9]*R+e[13],r[14]=e[2]*M+e[6]*C+e[10]*R+e[14],r[15]=e[3]*M+e[7]*C+e[11]*R+e[15]):(s=e[1],l=e[2],u=e[3],f=e[4],p=e[5],g=e[6],x=e[7],b=e[8],w=e[9],S=e[10],E=e[11],r[0]=n=e[0],r[1]=s,r[2]=l,r[3]=u,r[4]=f,r[5]=p,r[6]=g,r[7]=x,r[8]=b,r[9]=w,r[10]=S,r[11]=E,r[12]=n*M+f*C+b*R+e[12],r[13]=s*M+p*C+w*R+e[13],r[14]=l*M+g*C+S*R+e[14],r[15]=u*M+x*C+E*R+e[15]),r}function Br(r,e,i){var n=i[0],s=i[1],l=i[2];return r[0]=e[0]*n,r[1]=e[1]*n,r[2]=e[2]*n,r[3]=e[3]*n,r[4]=e[4]*s,r[5]=e[5]*s,r[6]=e[6]*s,r[7]=e[7]*s,r[8]=e[8]*l,r[9]=e[9]*l,r[10]=e[10]*l,r[11]=e[11]*l,r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15],r}function jo(r,e,i){var n=Math.sin(i),s=Math.cos(i),l=e[4],u=e[5],f=e[6],p=e[7],g=e[8],x=e[9],b=e[10],w=e[11];return e!==r&&(r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r[4]=l*s+g*n,r[5]=u*s+x*n,r[6]=f*s+b*n,r[7]=p*s+w*n,r[8]=g*s-l*n,r[9]=x*s-u*n,r[10]=b*s-f*n,r[11]=w*s-p*n,r}function Go(r,e,i){var n=Math.sin(i),s=Math.cos(i),l=e[0],u=e[1],f=e[2],p=e[3],g=e[8],x=e[9],b=e[10],w=e[11];return e!==r&&(r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r[0]=l*s-g*n,r[1]=u*s-x*n,r[2]=f*s-b*n,r[3]=p*s-w*n,r[8]=l*n+g*s,r[9]=u*n+x*s,r[10]=f*n+b*s,r[11]=p*n+w*s,r}function Yn(r,e,i){var n=Math.sin(i),s=Math.cos(i),l=e[0],u=e[1],f=e[2],p=e[3],g=e[4],x=e[5],b=e[6],w=e[7];return e!==r&&(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[0]=l*s+g*n,r[1]=u*s+x*n,r[2]=f*s+b*n,r[3]=p*s+w*n,r[4]=g*s-l*n,r[5]=x*s-u*n,r[6]=b*s-f*n,r[7]=w*s-p*n,r}function _s(r,e){return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=1,r[11]=0,r[12]=e[0],r[13]=e[1],r[14]=e[2],r[15]=1,r}function $o(r,e){return r[0]=e[0],r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=e[1],r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=e[2],r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function Ys(r,e,i){var n,s,l,u=i[0],f=i[1],p=i[2],g=Math.sqrt(u*u+f*f+p*p);return g<sn?null:(u*=g=1/g,f*=g,p*=g,n=Math.sin(e),s=Math.cos(e),r[0]=u*u*(l=1-s)+s,r[1]=f*u*l+p*n,r[2]=p*u*l-f*n,r[3]=0,r[4]=u*f*l-p*n,r[5]=f*f*l+s,r[6]=p*f*l+u*n,r[7]=0,r[8]=u*p*l+f*n,r[9]=f*p*l-u*n,r[10]=p*p*l+s,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r)}function ql(r,e){var i=e[0],n=e[1],s=e[2],l=e[4],u=e[5],f=e[6],p=e[8],g=e[9],x=e[10];return r[0]=Math.sqrt(i*i+n*n+s*s),r[1]=Math.sqrt(l*l+u*u+f*f),r[2]=Math.sqrt(p*p+g*g+x*x),r}function Zl(r,e){var i=e[0],n=e[1],s=e[2],l=e[3],u=i+i,f=n+n,p=s+s,g=i*u,x=n*u,b=n*f,w=s*u,S=s*f,E=s*p,M=l*u,C=l*f,R=l*p;return r[0]=1-b-E,r[1]=x+R,r[2]=w-C,r[3]=0,r[4]=x-R,r[5]=1-g-E,r[6]=S+M,r[7]=0,r[8]=w+C,r[9]=S-M,r[10]=1-g-b,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}var Wl=gi;function ni(){var r=new ji(3);return ji!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r}function Xl(r){var e=new ji(3);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e}function xr(r){var e=r[0],i=r[1],n=r[2];return Math.sqrt(e*e+i*i+n*n)}function wr(r,e,i){var n=new ji(3);return n[0]=r,n[1]=e,n[2]=i,n}function Ti(r,e,i,n){return r[0]=e,r[1]=i,r[2]=n,r}function er(r,e,i){return r[0]=e[0]+i[0],r[1]=e[1]+i[1],r[2]=e[2]+i[2],r}function Jn(r,e,i){return r[0]=e[0]-i[0],r[1]=e[1]-i[1],r[2]=e[2]-i[2],r}function Yl(r,e,i){return r[0]=e[0]*i[0],r[1]=e[1]*i[1],r[2]=e[2]*i[2],r}function vr(r,e,i){return r[0]=Math.min(e[0],i[0]),r[1]=Math.min(e[1],i[1]),r[2]=Math.min(e[2],i[2]),r}function bn(r,e,i){return r[0]=Math.max(e[0],i[0]),r[1]=Math.max(e[1],i[1]),r[2]=Math.max(e[2],i[2]),r}function Ci(r,e,i){return r[0]=e[0]*i,r[1]=e[1]*i,r[2]=e[2]*i,r}function wn(r,e,i,n){return r[0]=e[0]+i[0]*n,r[1]=e[1]+i[1]*n,r[2]=e[2]+i[2]*n,r}function Js(r,e){var i=e[0]-r[0],n=e[1]-r[1],s=e[2]-r[2];return Math.sqrt(i*i+n*n+s*s)}function Ho(r,e){var i=e[0]-r[0],n=e[1]-r[1],s=e[2]-r[2];return i*i+n*n+s*s}function Jl(r){var e=r[0],i=r[1],n=r[2];return e*e+i*i+n*n}function Kn(r,e){return r[0]=-e[0],r[1]=-e[1],r[2]=-e[2],r}function ui(r,e){var i=e[0],n=e[1],s=e[2],l=i*i+n*n+s*s;return l>0&&(l=1/Math.sqrt(l)),r[0]=e[0]*l,r[1]=e[1]*l,r[2]=e[2]*l,r}function Xi(r,e){return r[0]*e[0]+r[1]*e[1]+r[2]*e[2]}function kr(r,e,i){var n=e[0],s=e[1],l=e[2],u=i[0],f=i[1],p=i[2];return r[0]=s*p-l*f,r[1]=l*u-n*p,r[2]=n*f-s*u,r}function Ks(r,e,i,n){var s=e[0],l=e[1],u=e[2];return r[0]=s+n*(i[0]-s),r[1]=l+n*(i[1]-l),r[2]=u+n*(i[2]-u),r}function Pi(r,e,i){var n=e[0],s=e[1],l=e[2],u=i[3]*n+i[7]*s+i[11]*l+i[15];return r[0]=(i[0]*n+i[4]*s+i[8]*l+i[12])/(u=u||1),r[1]=(i[1]*n+i[5]*s+i[9]*l+i[13])/u,r[2]=(i[2]*n+i[6]*s+i[10]*l+i[14])/u,r}function gs(r,e,i){var n=e[0],s=e[1],l=e[2];return r[0]=n*i[0]+s*i[3]+l*i[6],r[1]=n*i[1]+s*i[4]+l*i[7],r[2]=n*i[2]+s*i[5]+l*i[8],r}function Ua(r,e,i){var n=i[0],s=i[1],l=i[2],u=i[3],f=e[0],p=e[1],g=e[2],x=s*g-l*p,b=l*f-n*g,w=n*p-s*f;return r[0]=f+u*(x+=x)+s*(w+=w)-l*(b+=b),r[1]=p+u*b+l*x-n*w,r[2]=g+u*w+n*b-s*x,r}function Va(r){return r[0]=0,r[1]=0,r[2]=0,r}function go(r,e){return r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]}var ki=Jn,ja=Yl,Qs=xr;function Ga(){var r=new ji(4);return ji!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0,r[3]=0),r}function ea(r,e,i){return r[0]=e[0]*i,r[1]=e[1]*i,r[2]=e[2]*i,r[3]=e[3]*i,r}function qo(r,e){var i=e[0],n=e[1],s=e[2],l=e[3],u=i*i+n*n+s*s+l*l;return u>0&&(u=1/Math.sqrt(u)),r[0]=i*u,r[1]=n*u,r[2]=s*u,r[3]=l*u,r}function ln(r,e,i){var n=e[0],s=e[1],l=e[2],u=e[3];return r[0]=i[0]*n+i[4]*s+i[8]*l+i[12]*u,r[1]=i[1]*n+i[5]*s+i[9]*l+i[13]*u,r[2]=i[2]*n+i[6]*s+i[10]*l+i[14]*u,r[3]=i[3]*n+i[7]*s+i[11]*l+i[15]*u,r}function ys(){var r=new ji(4);return ji!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r[3]=1,r}function xs(r){return r[0]=0,r[1]=0,r[2]=0,r[3]=1,r}function $a(r,e,i){i*=.5;var n=e[0],s=e[1],l=e[2],u=e[3],f=Math.sin(i),p=Math.cos(i);return r[0]=n*p+u*f,r[1]=s*p+l*f,r[2]=l*p-s*f,r[3]=u*p-n*f,r}function ta(r,e,i){i*=.5;var n=e[0],s=e[1],l=e[2],u=e[3],f=Math.sin(i),p=Math.cos(i);return r[0]=n*p-l*f,r[1]=s*p+u*f,r[2]=l*p+n*f,r[3]=u*p-s*f,r}ni(),Ga();var cn,Kl,Tn,tu=qo,Ql=(cn=ni(),Kl=wr(1,0,0),Tn=wr(0,1,0),function(r,e,i){var n=Xi(e,i);return n<-.999999?(kr(cn,Kl,e),Qs(cn)<1e-6&&kr(cn,Tn,e),ui(cn,cn),(function(s,l,u){u*=.5;var f=Math.sin(u);s[0]=f*l[0],s[1]=f*l[1],s[2]=f*l[2],s[3]=Math.cos(u)})(r,cn,Math.PI),r):n>.999999?(r[0]=0,r[1]=0,r[2]=0,r[3]=1,r):(kr(cn,e,i),r[0]=cn[0],r[1]=cn[1],r[2]=cn[2],r[3]=1+n,tu(r,r))});function Nr(){var r=new ji(2);return ji!=Float32Array&&(r[0]=0,r[1]=0),r}function Qn(r,e){var i=new ji(2);return i[0]=r,i[1]=e,i}function Zo(r,e,i){return r[0]=e,r[1]=i,r}function ia(r,e,i){return r[0]=e[0]+i[0],r[1]=e[1]+i[1],r}function eo(r,e,i){return r[0]=e[0]-i[0],r[1]=e[1]-i[1],r}function ra(r,e,i){return r[0]=e[0]*i,r[1]=e[1]*i,r}function na(r){var e=r[0],i=r[1];return Math.sqrt(e*e+i*i)}function ec(r,e){var i=e[0],n=e[1],s=i*i+n*n;return s>0&&(s=1/Math.sqrt(s)),r[0]=e[0]*s,r[1]=e[1]*s,r}function yo(r,e){return r[0]*e[0]+r[1]*e[1]}ys(),ys(),$l();var tc,iu,Ha=eo;function ru(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}Nr();var Ch=(function(){if(iu)return tc;function r(e,i,n,s){this.cx=3*e,this.bx=3*(n-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*i,this.by=3*(s-i)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=i,this.p2x=n,this.p2y=s}return iu=1,tc=r,r.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,i){if(i===void 0&&(i=1e-6),e<0)return 0;if(e>1)return 1;for(var n=e,s=0;s<8;s++){var l=this.sampleCurveX(n)-e;if(Math.abs(l)<i)return n;var u=this.sampleCurveDerivativeX(n);if(Math.abs(u)<1e-6)break;n-=l/u}var f=0,p=1;for(n=e,s=0;s<20&&(l=this.sampleCurveX(n),!(Math.abs(l-e)<i));s++)e>l?f=n:p=n,n=.5*(p-f)+f;return n},solve:function(e,i){return this.sampleCurveY(this.solveCurveX(e,i))}},tc})(),qa=ru(Ch);function Ue(r,e){this.x=r,this.y=e}function Wo(r,e){if(Array.isArray(r)){if(!Array.isArray(e)||r.length!==e.length)return!1;for(let i=0;i<r.length;i++)if(!Wo(r[i],e[i]))return!1;return!0}if(typeof r=="object"&&r!==null&&e!==null){if(typeof e!="object"||Object.keys(r).length!==Object.keys(e).length)return!1;for(const i in r)if(!Wo(r[i],e[i]))return!1;return!0}return r===e}Ue.prototype={clone(){return new Ue(this.x,this.y)},add(r){return this.clone()._add(r)},sub(r){return this.clone()._sub(r)},multByPoint(r){return this.clone()._multByPoint(r)},divByPoint(r){return this.clone()._divByPoint(r)},mult(r){return this.clone()._mult(r)},div(r){return this.clone()._div(r)},rotate(r){return this.clone()._rotate(r)},rotateAround(r,e){return this.clone()._rotateAround(r,e)},matMult(r){return this.clone()._matMult(r)},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(r){return this.x===r.x&&this.y===r.y},dist(r){return Math.sqrt(this.distSqr(r))},distSqr(r){const e=r.x-this.x,i=r.y-this.y;return e*e+i*i},angle(){return Math.atan2(this.y,this.x)},angleTo(r){return Math.atan2(this.y-r.y,this.x-r.x)},angleWith(r){return this.angleWithSep(r.x,r.y)},angleWithSep(r,e){return Math.atan2(this.x*e-this.y*r,this.x*r+this.y*e)},_matMult(r){const e=r[2]*this.x+r[3]*this.y;return this.x=r[0]*this.x+r[1]*this.y,this.y=e,this},_add(r){return this.x+=r.x,this.y+=r.y,this},_sub(r){return this.x-=r.x,this.y-=r.y,this},_mult(r){return this.x*=r,this.y*=r,this},_div(r){return this.x/=r,this.y/=r,this},_multByPoint(r){return this.x*=r.x,this.y*=r.y,this},_divByPoint(r){return this.x/=r.x,this.y/=r.y,this},_unit(){return this._div(this.mag()),this},_perp(){const r=this.y;return this.y=this.x,this.x=-r,this},_rotate(r){const e=Math.cos(r),i=Math.sin(r),n=i*this.x+e*this.y;return this.x=e*this.x-i*this.y,this.y=n,this},_rotateAround(r,e){const i=Math.cos(r),n=Math.sin(r),s=e.y+n*(this.x-e.x)+i*(this.y-e.y);return this.x=e.x+i*(this.x-e.x)-n*(this.y-e.y),this.y=s,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:Ue},Ue.convert=function(r){if(r instanceof Ue)return r;if(Array.isArray(r))return new Ue(+r[0],+r[1]);if(r.x!==void 0&&r.y!==void 0)return new Ue(+r.x,+r.y);throw new Error("Expected [x, y] or {x, y} point format")};const vs=Math.PI/180,oa=180/Math.PI,Za=/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,_e=/\b(iPad|iPhone|iPod)\b/,B=/CPU (OS|iPhone OS) (15_4|15_5) like Mac OS X/;function V(r){return r*vs}function X(r){return r*oa}const ae=[[0,0],[1,0],[1,1],[0,1]];function le(r){if(r<=0)return 0;if(r>=1)return 1;const e=r*r,i=e*r;return 4*(r<.5?i:3*(r-e)+i-.75)}function ce(r,e,i,n){const s=new qa(r,e,i,n);return function(l){return s.solve(l)}}const we=ce(.25,.1,.25,1);function re(r,e,i){return Math.min(i,Math.max(e,r))}function ye(r,e,i){return(i=re((i-r)/(e-r),0,1))*i*(3-2*i)}function Ve(r,e,i){const n=i-e,s=((r-e)%n+n)%n+e;return s===e?i:s}function Oe(r,e,i){if(!r.length)return i(null,[]);let n=r.length;const s=new Array(r.length);let l=null;r.forEach((u,f)=>{e(u,(p,g)=>{p&&(l=p),s[f]=g,--n===0&&i(l,s)})})}function Ke(r,e){const i={};for(let n=0;n<e.length;n++){const s=e[n];s in r&&(i[s]=r[s])}return i}let ut=1;function dt(){return ut++}function Dt(r){return r<=1?1:Math.pow(2,Math.ceil(Math.log2(r)))}function Et(r,e){r.forEach(i=>{e[i]&&(e[i]=e[i].bind(e))})}function Ne(r,e,i){const n={};for(const s in r)n[s]=e.call(this,r[s],s,r);return n}function Ct(r,e,i){const n={};for(const s in r)e.call(this,r[s],s,r)&&(n[s]=r[s]);return n}function Jt(r){return Array.isArray(r)?r.map(Jt):typeof r=="object"&&r?Ne(r,Jt):r}function Gi(r,e){for(let i=0;i<r.length;i++)if(e.includes(r[i]))return!0;return!1}const Ni={};function Pt(r){Ni[r]||(typeof console<"u"&&console.warn(r),Ni[r]=!0)}function hi(r,e,i){return(i.y-r.y)*(e.x-r.x)>(e.y-r.y)*(i.x-r.x)}function Ii(r){let e=0;for(let i,n,s=0,l=r.length,u=l-1;s<l;u=s++)i=r[s],n=r[u],e+=(n.x-i.x)*(i.y+n.y);return e}function $i([r,e,i]){const n=V(e+90),s=V(i);return{x:r*Math.cos(n)*Math.sin(s),y:r*Math.sin(n)*Math.sin(s),z:r*Math.cos(s),azimuthal:e,polar:i}}function ti(r){return(typeof self<"u"||r!==void 0)&&typeof WorkerGlobalScope<"u"&&(r!==void 0?r:self)instanceof WorkerGlobalScope}function Ei(r){const e={};if(r.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(i,n,s,l)=>{const u=s||l;return e[n]=!u||u.toLowerCase(),""}),e["max-age"]){const i=parseInt(e["max-age"],10);isNaN(i)?delete e["max-age"]:e["max-age"]=i}return e}let Ui,_i=null;function Yi(r,e){return[r[4*e],r[4*e+1],r[4*e+2],r[4*e+3]]}function Tr(r,e,i,n){for(;e<i;){const s=e+i>>1;r[s]<n?e=s+1:i=s}return e}function ur(r,e,i,n){for(;e<i;){const s=e+i>>1;r[s]<=n?e=s+1:i=s}return e}function or(r){return r>0?1/(1.001-r):1+r}function xo(r){return r>0?1-1/(1.001-r):-r}function to(r,e,i){return(r-e.min)*(i.max-i.min)/(e.max-e.min)+i.min}const fi={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(!fi.API_URL)return null;try{const r=new URL(fi.API_URL);return r.hostname==="api.mapbox.cn"?"https://events.mapbox.cn/events/v2":r.hostname==="api.mapbox.com"?"https://events.mapbox.com/events/v2":null}catch{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:!0,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(Object.create(null),{pmtiles:"/mapbox-gl-js/plugins/mapbox-gl-pmtiles-provider/v0.0.2/mapbox-gl-pmtiles-provider.js"})};function bs(){return new URL(fi.DRACO_URL,fi.API_URL).href}function sa(){if(typeof WebAssembly!="object")throw new Error("WebAssembly not supported, cannot instantiate meshoptimizer");return new URL((function(){if(Ui===void 0){if(typeof WebAssembly!="object")return!1;const r=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]);Ui=WebAssembly.validate(r)}return Ui})()?fi.MESHOPT_SIMD_URL:fi.MESHOPT_URL,fi.API_URL).href}function aa(){return new URL(fi.BUILDING_GEN_URL,fi.API_URL).href}function ws(r){return fi.API_URL_REGEX.test(r)}function Wa(r){return fi.API_SPRITE_REGEX.test(r)}let nu,ic,Di,Pr,la,Xa;function vo(){return nu==null&&(nu=self.OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&typeof self.createImageBitmap=="function"),nu}const un={requestIdleCallback:r=>{if(typeof requestIdleCallback<"u")return requestIdleCallback(r);setTimeout(()=>r({didTimeout:!1,timeRemaining:()=>50}),0)},now:()=>Pr!==void 0?Pr:performance.now(),setNow(r){Pr=r},restoreNow(){Pr=void 0},frame(r){const e=requestAnimationFrame(r);return{cancel:()=>cancelAnimationFrame(e)}},getImageData(r,e=0){const{width:i,height:n}=r;la||(la=document.createElement("canvas"));const s=la.getContext("2d",{willReadFrequently:!0});if(!s)throw new Error("failed to create canvas 2d context");return(i>la.width||n>la.height)&&(la.width=i,la.height=n),s.clearRect(-e,-e,i+2*e,n+2*e),s.drawImage(r,0,0,i,n),s.getImageData(-e,-e,i+2*e,n+2*e)},resolveURL:r=>(ic||(ic=document.createElement("a")),ic.href=r,ic.href),get devicePixelRatio(){return window.devicePixelRatio},get prefersReducedMotion(){return!!window.matchMedia&&(Di==null&&(Di=window.matchMedia("(prefers-reduced-motion: reduce)")),Di.matches)},hasCanvasFingerprintNoise(){if(Xa!==void 0)return Xa;if(!vo())return Xa=!1,!1;const r=new OffscreenCanvas(85,1),e=r.getContext("2d",{willReadFrequently:!0});let i=0;for(let s=0;s<r.width;++s)e.fillStyle=`rgba(${i++},${i++},${i++}, 255)`,e.fillRect(s,0,1,1);const n=e.getImageData(0,0,r.width,r.height);i=0;for(let s=0;s<n.data.length;++s)if(s%4!=3&&i++!==n.data[s])return Xa=!0,!0;return Xa=!1,!1}};function Zf(r,e){const i=r.indexOf("?");if(i<0)return`${r}?${new URLSearchParams(e).toString()}`;
1const n=new URLSearchParams(r.slice(i));for(const s in e)n.set(s,e[s]);return`${r.slice(0,i)}?${n.toString()}`}function Ph(r,e={persistentParams:[]}){const i=r.indexOf("?");if(i<0)return r;const n=new URLSearchParams,s=new URLSearchParams(r.slice(i));for(const u of e.persistentParams){const f=s.get(u);f&&n.set(u,f)}const l=n.toString();return`${r.slice(0,i)}${l.length>0?`?${l}`:""}`}const Wf="mapbox-tiles";let Xf=500,Yf=50;const Jf=["language","worldview","jobid"];let Xo;function rc(){try{return caches}catch{}}function ou(){const r=rc();r&&Xo==null&&(Xo=r.open(Wf))}let Dh=1/0;const Rh={supported:!1,testSupport:function(r){!Ya&&bo&&(zh?Oh(r):Ur=r)}};let Ur,bo,Ya=!1,zh=!1;const Lh=typeof self<"u"?self:{};function Oh(r){const e=r.createTexture();r.bindTexture(r.TEXTURE_2D,e);try{if(r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,bo),r.isContextLost())return;Rh.supported=!0}catch{}r.deleteTexture(e),Ya=!0}Lh.document&&(bo=Lh.document.createElement("img"),bo.onload=function(){Ur&&Oh(Ur),Ur=null,zh=!0},bo.onerror=function(){Ya=!0,Ur=null},bo.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const ca={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Iconset:"Iconset",Image:"Image",Model:"Model"};Object.freeze(ca);class Yo extends Error{constructor(e,i,n){i===401&&ws(n)&&(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=i,this.url=n}toString(){return`${this.name}: ${this.message} (${this.status}): ${this.url}`}}function nc(r){return typeof r=="object"&&r!==null&&"status"in r&&r.status===404}const su=ti()?()=>self.worker.referrer:()=>(location.protocol==="blob:"?parent:self).location.href,Kf=/^\w+:/,Jo=/[\r\n]+/,oc=function(r,e){return(i=r.url).startsWith("file:")||su().startsWith("file:")&&!Kf.test(i)?(function(n,s){const l=new XMLHttpRequest;l.open(n.method||"GET",n.url,!0),n.type==="arrayBuffer"&&(l.responseType="arraybuffer");for(const u in n.headers)l.setRequestHeader(u,n.headers[u]);return n.type==="json"&&(l.responseType="text",l.setRequestHeader("Accept","application/json")),l.withCredentials=n.credentials==="include",l.onerror=()=>{s(new Error(l.statusText))},l.onload=()=>{if((l.status>=200&&l.status<300||l.status===0)&&l.response!==null){let u=l.response;if(n.type==="json")try{u=JSON.parse(l.response)}catch(p){return s(p)}const f=new Headers;l.getAllResponseHeaders().trim().split(Jo).forEach(p=>{const g=p.split(": "),x=g.shift(),b=g.join(": ");f.append(x,b)}),s(null,u,f)}else s(new Yo(l.statusText,l.status,n.url))},l.send(n.body),{cancel:()=>l.abort()}})(r,e):(function(n,s){const l=new AbortController,u=new Request(n.url,{method:n.method||"GET",body:n.body,credentials:n.credentials,headers:n.headers,referrer:su(),referrerPolicy:n.referrerPolicy,signal:l.signal});let f=!1,p=!1;const g=(x=u.url).indexOf("sku=")>0&&ws(x);var x;n.type==="json"&&u.headers.set("Accept","application/json");const b=(S,E,M)=>{if(p)return;if(S&&S.message!=="SecurityError"&&Pt(S.toString()),E&&M)return w(E);const C=Date.now();fetch(u).then(R=>{if(R.ok){const F=g?R.clone():null;return w(R,F,C)}return s(new Yo(R.statusText,R.status,n.url))}).catch(R=>{R.name!=="AbortError"&&s(new Error(`${R.message} ${n.url}`))})},w=(S,E,M)=>{(n.type==="arrayBuffer"?S.arrayBuffer():n.type==="json"?S.json():S.text()).then(C=>{p||(E&&M&&(function(R,F,z){if(ou(),Xo==null)return;const j=Ei(F.headers.get("cache-control")||"");if(j["no-store"])return;const $={status:F.status,statusText:F.statusText,headers:new Headers};F.headers.forEach((Y,ee)=>$.headers.set(ee,Y)),j["max-age"]&&$.headers.set("Expires",new Date(z+1e3*j["max-age"]).toUTCString());const q=$.headers.get("expires");if(!q||new Date(q).getTime()-z<42e4)return;
1let ie=Ph(R.url,{persistentParams:Jf});if(F.status===206){const Y=R.headers.get("Range");if(!Y)return;$.status=200,ie=Zf(ie,{range:Y})}const W=new Response((Q=F.status)!==200&&Q!==404&&[101,103,204,205,304].includes(Q)?null:F.body,$);var Q;ou(),Xo?.then(Y=>Y.put(ie,W)).catch(Y=>Pt(Y.message))})(u,E,M),f=!0,s(null,C,S.headers))}).catch(C=>{p||s(new Error(C.message))})};return g?(function(S,E){if(ou(),Xo==null)return E(null);Xo.then(M=>{let C=Ph(S.url,{persistentParams:Jf});const R=S.headers.get("Range");R&&(C=Zf(C,{range:R})),M.match(C).then(F=>{const z=(function(j){if(!j)return!1;const $=new Date(j.headers.get("expires")||0),q=Ei(j.headers.get("cache-control")||"");return Number($)>Date.now()&&!q["no-cache"]})(F);M.delete(C).catch(E),z&&M.put(C,F.clone()).catch(E),E(null,F,z)}).catch(E)}).catch(E)})(u,b):b(null,null),{cancel:()=>{p=!0,f||l.abort()}}})(r,e);var i},Fh=function(r,e){return oc(Object.assign(r,{type:"json"}),e)},Ja=function(r,e){return oc(Object.assign(r,{type:"arrayBuffer"}),e)};function O_(r){const e=document.createElement("a");return e.href=r,e.protocol===location.protocol&&e.host===location.host}let au,hn;au=[],hn=0;const Bh=function(r,e){if(Rh.supported&&(r.headers||(r.headers={}),r.headers.accept="image/webp,*/*"),hn>=fi.MAX_PARALLEL_IMAGE_REQUESTS){const l={requestParameters:r,callback:e,cancelled:!1,cancel(){this.cancelled=!0}};return au.push(l),l}hn++;let i=!1;const n=()=>
1{if(!i)for(i=!0,hn--;au.length&&hn<fi.MAX_PARALLEL_IMAGE_REQUESTS;){const l=au.shift(),{requestParameters:u,callback:f,cancelled:p}=l;p||(l.cancel=Bh(u,f).cancel)}},s=Ja(r,(l,u,f)=>{n(),l?e(l):u&&(function(p,g){const x=new Blob([new Uint8Array(p)],{type:"image/png"});createImageBitmap(x).then(b=>{g(null,b)}).catch(b=>{g(new Error(`Could not load image because of ${b.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})})(u,(p,g)=>e(p,g,f))});return{cancel:()=>{s.cancel(),n()}}};var lu,Ts,sc,Ka={exports:{}},kh={exports:{}},Qf={exports:{}},ep=(function(){if(sc)return Ka.exports;sc=1;var r=(lu||(lu=1,kh.exports=function(i,n){var s,l,u,f,p,g,x,b;for(l=i.length-(s=3&i.length),u=n,p=3432918353,g=461845907,b=0;b<l;)x=255&i.charCodeAt(b)|(255&i.charCodeAt(++b))<<8|(255&i.charCodeAt(++b))<<16|(255&i.charCodeAt(++b))<<24,++b,u=27492+(65535&(f=5*(65535&(u=(u^=x=(65535&(x=(x=(65535&x)*p+(((x>>>16)*p&65535)<<16)&4294967295)<<15|x>>>17))*g+(((x>>>16)*g&65535)<<16)&4294967295)<<13|u>>>19))+((5*(u>>>16)&65535)<<16)&4294967295))+(((f>>>16)+58964&65535)<<16);switch(x=0,s){case 3:x^=(255&i.charCodeAt(b+2))<<16;case 2:x^=(255&i.charCodeAt(b+1))<<8;case 1:u^=x=(65535&(x=(x=(65535&(x^=255&i.charCodeAt(b)))*p+(((x>>>16)*p&65535)<<16)&4294967295)<<15|x>>>17))*g+(((x>>>16)*g&65535)<<16)&4294967295}return u^=i.length,u=2246822507*(65535&(u^=u>>>16))+((2246822507*(u>>>16)&65535)<<16)&4294967295,u=3266489909*(65535&(u^=u>>>13))+((3266489909*(u>>>16)&65535)<<16)&4294967295,(u^=u>>>16)>>>0}),kh.exports),e=(Ts||(Ts=1,Qf.exports=function(i,n){for(var s,l=i.length,u=n^l,f=0;l>=4;)s=1540483477*(65535&(s=255&i.charCodeAt(f)|(255&i.charCodeAt(++f))<<8|(255&i.charCodeAt(++f))<<16|(255&i.charCodeAt(++f))<<24))+((1540483477*(s>>>16)&65535)<<16),u=1540483477*(65535&u)+((1540483477*(u>>>16)&65535)<<16)^(s=1540483477*(65535&(s^=s>>>24))+((1540483477*(s>>>16)&65535)<<16)),l-=4,++f;switch(l){case 3:u^=(255&i.charCodeAt(f+2))<<16;case 2:u^=(255&i.charCodeAt(f+1))<<8;case 1:u=1540483477*(65535&(u^=255&i.charCodeAt(f)))+((1540483477*(u>>>16)&65535)<<16)}return u=1540483477*(65535&(u^=u>>>13))+((1540483477*(u>>>16)&65535)<<16),(u^=u>>>15)>>>0}),Qf.exports);return Ka.exports=r,Ka.exports.murmur3=r,Ka.exports.murmur2=e,Ka.exports})(),cu=ru(ep);class io{constructor(e,...i){Object.assign(this,i[0]||{}),this.type=e}}class Qa extends io{constructor(e,i={}){super("error",Object.assign({error:e},i))}}function el(r,e,i){i[r]&&i[r].includes(e)||(i[r]=i[r]||[],i[r].push(e))}function uu(r,e,i){if(i&&i[r]){const n=i[r].indexOf(e);n!==-1&&i[r].splice(n,1)}}class tl{on(e,i){return this._listeners=this._listeners||{},el(e,i,this._listeners),this}off(e,i){return uu(e,i,this._listeners),uu(e,i,this._oneTimeListeners),this}once(e,i){return i?(this._oneTimeListeners=this._oneTimeListeners||{},el(e,i,this._oneTimeListeners),this):new Promise(n=>{this.once(e,n)})}fire(e,i){const n=typeof e=="string"?new io(e,i):e,s=n.type;if(this.listens(s)){n.target=this;const l=this._listeners&&this._listeners[s]?this._listeners[s].slice():[];for(const p of l)p.call(this,n);const u=this._oneTimeListeners&&this._oneTimeListeners[s]?this._oneTimeListeners[s].slice():[];for(const p of u)uu(s,p,this._oneTimeListeners),p.call(this,n);const f=this._eventedParent;if(f){const p=typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData;Object.assign(n,p),f.fire(n)}}else n instanceof Qa&&console.error(n.error);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,i){return this._eventedParent=e,this._eventedParentData=i,this}}class Dr{constructor(e){typeof e=="string"?this.name=e:(this.name=e.name,this.iconsetId=e.iconsetId)}static from(e){return new Dr(e)}static toString(e){return e.iconsetId?`${e.name}�${e.iconsetId}`:e.name}static parse(e){const[i,n]=e.split("�");return new Dr({name:i,iconsetId:n})}
vendor: 29,970 bytes, line 1
1static isEqual(e,i){return e.name===i.name&&e.iconsetId===i.iconsetId}toString(){return Dr.toString(this)}serialize(){return{name:this.name,iconsetId:this.iconsetId}}}var Nh,il={},tp=(function(){if(Nh)return il;Nh=1;var r={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 e(l){return(l=Math.round(l))<0?0:l>255?255:l}function i(l){return e(l[l.length-1]==="%"?parseFloat(l)/100*255:parseInt(l))}function n(l){return(u=l[l.length-1]==="%"?parseFloat(l)/100:parseFloat(l))<0?0:u>1?1:u;var u}function s(l,u,f){return f<0?f+=1:f>1&&(f-=1),6*f<1?l+(u-l)*f*6:2*f<1?u:3*f<2?l+(u-l)*(2/3-f)*6:l}try{il.parseCSSColor=function(l){var u,f=l.replace(/ /g,"").toLowerCase();if(f in r)return r[f].slice();if(f[0]==="#")return f.length===4?(u=parseInt(f.substr(1),16))>=0&&u<=4095?[(3840&u)>>4|(3840&u)>>8,240&u|(240&u)>>4,15&u|(15&u)<<4,1]:null:f.length===7&&(u=parseInt(f.substr(1),16))>=0&&u<=16777215?[(16711680&u)>>16,(65280&u)>>8,255&u,1]:null;var p=f.indexOf("("),g=f.indexOf(")");if(p!==-1&&g+1===f.length){var x=f.substr(0,p),b=f.substr(p+1,g-(p+1)).split(","),w=1;switch(x){case"rgba":if(b.length!==4)return null;w=n(b.pop());case"rgb":return b.length!==3?null:[i(b[0]),i(b[1]),i(b[2]),w];case"hsla":if(b.length!==4)return null;w=n(b.pop());case"hsl":if(b.length!==3)return null;var S=(parseFloat(b[0])%360+360)%360/360,E=n(b[1]),M=n(b[2]),C=M<=.5?M*(E+1):M+E-M*E,R=2*M-C;return[e(255*s(R,C,S+1/3)),e(255*s(R,C,S)),e(255*s(R,C,S-1/3)),w];default:return null}}return null}}catch{}return il})();function ft(r,e,i){return r*(1-i)+e*i}class qt{constructor(e,i,n,s=1){this.r=e,this.g=i,this.b=n,this.a=s}static parse(e){if(!e)return;if(e instanceof qt)return e;if(typeof e!="string")return;const i=tp.parseCSSColor(e);return i?new qt(i[0]/255,i[1]/255,i[2]/255,i[3]):void 0}toString(){const{r:e,g:i,b:n,a:s}=this;return`rgba(${Math.round(255*e)},${Math.round(255*i)},${Math.round(255*n)},${s})`}toNonPremultipliedRenderColor(e){const{r:i,g:n,b:s,a:l}=this;return new ip(e,i,n,s,l)}toPremultipliedRenderColor(e){const{r:i,g:n,b:s,a:l}=this;return new rp(e,i*l,n*l,s*l,l)}clone(){return new qt(this.r,this.g,this.b,this.a)}}class hu{constructor(e,i,n,s,l,u=!1){if(this.premultiplied=!1,this.premultiplied=u,e){const f=e.image.height,p=f*f;this.premultiplied?(i=l===0?0:i/l*(f-1),n=l===0?0:n/l*(f-1),s=l===0?0:s/l*(f-1)):(i*=f-1,n*=f-1,s*=f-1),i=Math.max(0,Math.min(f-1,i)),n=Math.max(0,Math.min(f-1,n)),s=Math.max(0,Math.min(f-1,s));const g=Math.floor(i),x=Math.floor(n),b=Math.floor(s),w=Math.ceil(i),S=Math.ceil(n),E=Math.ceil(s),M=i-g,C=n-x,R=s-b,F=e.image.data,z=4*(g+x*p+b*f),j=4*(g+x*p+E*f),$=4*(g+S*p+b*f),q=4*(g+S*p+E*f),ie=4*(w+x*p+b*f),W=4*(w+x*p+E*f),Q=4*(w+S*p+b*f),Y=4*(w+S*p+E*f);this.r=ft(ft(ft(F[z],F[j],R),ft(F[$],F[q],R),C),ft(ft(F[ie],F[W],R),ft(F[Q],F[Y],R),C),M)/255*(this.premultiplied?l:1),this.g=ft(ft(ft(F[z+1],F[j+1],R),ft(F[$+1],F[q+1],R),C),ft(ft(F[ie+1],F[W+1],R),ft(F[Q+1],F[Y+1],R),C),M)/255*(this.premultiplied?l:1),this.b=ft(ft(ft(F[z+2],F[j+2],R),ft(F[$+2],F[q+2],R),C),ft(ft(F[ie+2],F[W+2],R),ft(F[Q+2],F[Y+2],R),C),M)/255*(this.premultiplied?l:1),this.a=l}else this.r=i,this.g=n,this.b=s,this.a=l}toArray(){const{r:e,g:i,b:n,a:s}=this;return[255*e,255*i,255*n,s]}toHslaArray(){let{r:e,g:i,b:n,a:s}=this;if(this.premultiplied){if(s===0)return[0,0,0,0];const E=1/s;e*=E,i*=E,n*=E}const l=Math.min(Math.max(e,0),1),u=Math.min(Math.max(i,0),1),f=Math.min(Math.max(n,0),1),p=Math.min(l,u,f),g=Math.max(l,u,f),x=g-p,b=.5*(p+g);if(x===0)return[0,0,100*b,s];const w=b>.5?x/(2-g-p):x/(g+p);let S;switch(g){case l:S=60*((u-f)/x+(u<f?6:0));break;case u:S=60*((f-l)/x+2);break;default:S=60*((l-u)/x+4)}return[S,100*w,100*b,s]}toArray01(){const{r:e,g:i,b:n,a:s}=this;return[e,i,n,s]}toArray01Scaled(e){const{r:i,g:n,b:s}=this;return[i*e,n*e,s*e]}toArray01Linear(){const{r:e,g:i,b:n,a:s}=this;return[Math.pow(e,2.2),Math.pow(i,2.2),Math.pow(n,2.2),s]}}class ip extends hu{constructor(e,i,n,s,l){super(e,i,n,s,l,!1)}}class rp extends hu{constructor(e,i,n,s,l){super(e,i,n,s,l,!0)}}function np(r,e,i){return r.map((n,s)=>ft(n,e[s],i))}qt.black=new qt(0,0,0,1),qt.white=new qt(1,1,1,1),qt.transparent=new qt(0,0,0,0),qt.red=new qt(1,0,0,1),qt.blue=new qt(0,0,1,1);var du=Object.freeze({__proto__:null,array:np,color:function(r,e,i){return new qt(ft(r.r,e.r,i),ft(r.g,e.g,i),ft(r.b,e.b,i),ft(r.a,e.a,i))},number:ft});class ro extends Error{constructor(e,i){super(i),this.message=i,this.key=e}}class fu{constructor(e,i=[]){this.parent=e,this.bindings={};for(const[n,s]of i)this.bindings[n]=s}concat(e){return new fu(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 Ss={kind:"null"},st={kind:"number"},Kt={kind:"string"},Ut={kind:"boolean"},qr={kind:"color"},wo={kind:"object"},ei={kind:"value"},Is={kind:"collator"},rl={kind:"formatted"},ac={kind:"resolvedImage"};function Rr(r,e){return{kind:"array",itemType:r,N:e}}function Tt(r){if(r.kind==="array"){const e=Tt(r.itemType);return typeof r.N=="number"?`array<${e}, ${r.N}>`:r.itemType.kind==="value"?"array":`array<${e}>`}return r.kind}const op=[Ss,st,Kt,Ut,qr,rl,wo,Rr(ei),ac];function nl(r,e){if(e.kind==="error")return null;if(r.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!nl(r.itemType,e.itemType))&&(typeof r.N!="number"||r.N===e.N))return null}else{if(r.kind===e.kind)return null;if(r.kind==="value"){for(const i of op)if(!nl(i,e))return null}}return`Expected ${Tt(r)} but found ${Tt(e)} instead.`}function Uh(r,e){return e.some(i=>i.kind===r.kind)}function lc(r,e){return e.some(i=>i==="null"?r===null:i==="array"?Array.isArray(r):i==="object"?r&&!Array.isArray(r)&&typeof r=="object":i===typeof r)}function ua(r,e){return r.kind==="array"&&e.kind==="array"?r.N===e.N&&ua(r.itemType,e.itemType):r.kind===e.kind}class ol{constructor(e,i,n){this.sensitivity=e?i?"variant":"case":i?"accent":"base",this.locale=n,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,i){return this.collator.compare(e,i)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class ha{constructor(e,i,n,s,l){this.text=e.normalize?e.normalize():e,this.image=i,this.scale=n,this.fontStack=s,this.textColor=l}}class zr{constructor(e){this.sections=e}static fromString(e){return new zr([new ha(e,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(e=>e.text.length!==0||!!e.image&&e.image.hasPrimary())}static factory(e){return e instanceof zr?e:zr.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}serialize(){const e=["format"];for(const i of this.sections){if(i.image){const s=i.image.getPrimary().id.toString();e.push(["image",s]);continue}e.push(i.text);const n={};i.fontStack&&(n["text-font"]=["literal",i.fontStack.split(",")]),i.scale&&(n["font-scale"]=i.scale),i.textColor&&(n["text-color"]=["rgba"].concat(i.textColor.toNonPremultipliedRenderColor(null).toArray())),e.push(n)}return e}}class Fn{constructor(e,i={}){this.id=Dr.from(e),this.params=i.params,this.sx=i.sx||1,this.sy=i.sy||1}toString(){return JSON.stringify(this)}static parse(e){let i,n,s,l;try{({id:i,params:n,sx:s,sy:l}=JSON.parse(e)||{})}catch{return null}return i?new Fn(i,{params:n,sx:s,sy:l}):null}scaleSelf(e,i=e){return this.sx*=e,this.sy*=i,this}}class Vr{constructor(e,i,n,s,l=!1){this.primaryId=Dr.from(e),this.primaryOptions=i,n&&(this.secondaryId=Dr.from(n)),this.secondaryOptions=s,this.available=l}toString(){return this.primaryId&&this.secondaryId?`[${this.primaryId.name},${this.secondaryId.name}]`:this.primaryId.name}hasPrimary(){return!!this.primaryId}getPrimary(){return new Fn(this.primaryId,this.primaryOptions)}hasSecondary(){return!!this.secondaryId}getSecondary(){return this.secondaryId?new Fn(this.secondaryId,this.secondaryOptions):null}static from(e){return typeof e=="string"?Vr.build({name:e}):e}static build(e,i,n,s){return!e||typeof e=="object"&&!("name"in e)?null:new Vr(e,n,i,s)}}function sp(r,e,i,n){return typeof r=="number"&&r>=0&&r<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof i=="number"&&i>=0&&i<=255?n===void 0||typeof n=="number"&&n>=0&&n<=1?null:`Invalid rgba value [${[r,e,i,n].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof n=="number"?[r,e,i,n]:[r,e,i]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function sl(r){if(r===null||typeof r=="string"||typeof r=="boolean"||typeof r=="number"||r instanceof qt||r instanceof ol||r instanceof zr||r instanceof Vr)return!0;if(Array.isArray(r)){for(const e of r)if(!sl(e))return!1;return!0}if(typeof r=="object"){for(const e in r)if(!sl(r[e]))return!1;return!0}return!1}function Ji(r){if(r===null)return Ss;if(typeof r=="string")return Kt;if(typeof r=="boolean")return Ut;if(typeof r=="number")return st;if(r instanceof qt)return qr;if(r instanceof ol)return Is;if(r instanceof zr)return rl;if(r instanceof Vr)return ac;if(Array.isArray(r)){const e=r.length;let i;for(const n of r){const s=Ji(n);if(i){if(i===s)continue;i=ei;break}i=s}return Rr(i||ei,e)}return wo}function Bn(r){const e=typeof r;return r===null?"":e==="string"||e==="number"||e==="boolean"?String(r):r instanceof zr||r instanceof Vr||r instanceof qt?r.toString():JSON.stringify(r)}class no{constructor(e,i){this.type=e,this.value=i}static parse(e,i){if(e.length!==2)return i.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!sl(e[1]))return i.error("invalid value");const n=e[1];let s=Ji(n);const l=i.expectedType;return s.kind!=="array"||s.N!==0||!l||l.kind!=="array"||typeof l.N=="number"&&l.N!==0||(s=l),new no(s,n)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}serialize(){return this.type.kind==="array"||this.type.kind==="object"?["literal",this.value]:this.value instanceof qt?["rgba"].concat(this.value.toNonPremultipliedRenderColor(null).toArray()):this.value instanceof zr?this.value.serialize():this.value}}class vi{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}}const pu={string:Kt,number:st,boolean:Ut,object:wo};class oo{constructor(e,i){this.type=e,this.args=i}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");let n,s=1;const l=e[0];if(l==="array"){let f,p;if(e.length>2){const g=e[1];if(typeof g!="string"||!(g in pu)||g==="object")return i.error('The item type argument of "array" must be one of string, number, boolean',1);f=pu[g],s++}else f=ei;if(e.length>3){if(e[2]!==null&&(typeof e[2]!="number"||e[2]<0||e[2]!==Math.floor(e[2])))return i.error('The length argument to "array" must be a positive integer literal',2);p=e[2],s++}n=Rr(f,p)}else n=pu[l];const u=[];for(;s<e.length;s++){const f=i.parse(e[s],s,ei);if(!f)return null;u.push(f)}return new oo(n,u)}evaluate(e){for(let i=0;i<this.args.length;i++){const n=this.args[i].evaluate(e);if(!nl(this.type,Ji(n)))return n;if(i===this.args.length-1)throw new vi(`The expression ${JSON.stringify(this.args[i].serialize())} evaluated to ${Tt(Ji(n))} but was expected to be of type ${Tt(this.type)}.`)}return null}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}serialize(){const e=this.type,i=[e.kind];if(e.kind==="array"){const n=e.itemType;if(n.kind==="string"||n.kind==="number"||n.kind==="boolean"){i.push(n.kind);const s=e.N;(typeof s=="number"||this.args.length>1)&&i.push(s)}}return i.concat(this.args.map(n=>n.serialize()))}}class al{constructor(e){this.type=rl,this.sections=e}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");const n=e[1];if(!Array.isArray(n)&&typeof n=="object")return i.error("First argument must be an image or text section.");const s=[];let l=!1;for(let u=1;u<=e.length-1;++u){const f=e[u];if(l&&typeof f=="object"&&!Array.isArray(f)){l=!1;let p=null;if(f["font-scale"]&&(p=i.parseObjectValue(f["font-scale"],u,"font-scale",st),!p))return null;let g=null;if(f["text-font"]&&(g=i.parseObjectValue(f["text-font"],u,"text-font",Rr(Kt)),!g))return null;let x=null;if(f["text-color"]&&(x=i.parseObjectValue(f["text-color"],u,"text-color",qr),!x))return null;const b=s.at(-1);b.scale=p,b.font=g,b.textColor=x}else{const p=i.parse(e[u],u,ei);if(!p)return null;const g=p.type.kind;if(g!=="string"&&g!=="value"&&g!=="null"&&g!=="resolvedImage")return i.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");l=!0,s.push({content:p,scale:null,font:null,textColor:null})}}return new al(s)}evaluate(e){return new zr(this.sections.map(i=>{const n=i.content.evaluate(e);return ua(Ji(n),ac)?new ha("",n,null,null,null):new ha(Bn(n),null,i.scale?i.scale.evaluate(e):null,i.font?i.font.evaluate(e).join(","):null,i.textColor?i.textColor.evaluate(e):null)}))}eachChild(e){for(const i of this.sections)e(i.content),i.scale&&e(i.scale),i.font&&e(i.font),i.textColor&&e(i.textColor)}outputDefined(){return!1}serialize(){const e=["format"];for(const i of this.sections){e.push(i.content.serialize());const n={};i.scale&&(n["font-scale"]=i.scale.serialize()),i.font&&(n["text-font"]=i.font.serialize()),i.textColor&&(n["text-color"]=i.textColor.serialize()),e.push(n)}return e}}class cc{constructor(e,i,n,s){this._imageWarnHistory={},this.type=ac,this.namePrimary=e,this.nameSecondary=i,n&&(this.paramsPrimary=n.params,this.iconsetIdPrimary=n.iconset?n.iconset.id:void 0),s&&(this.paramsSecondary=s.params,this.iconsetIdSecondary=s.iconset?s.iconset.id:void 0)}static parse(e,i){if(e.length<2)return i.error("Expected two or more arguments.");let n=1;const s=[];function l(){if(n<e.length){const f=i.parse(e[n],n++,Kt);return f?(s.push({image:f,options:{}}),!0):(i.error(s.length?"Secondary image variant is not a string.":"No image name provided."),!1)}return!0}function u(){if(n<e.length){const p=e[n];if((f=p)===null||typeof f!="object"||Array.isArray(f))return!0;const g=p.params,x=p.iconset,b=i.concat(n);if(!g&&!x)return n++,!0;if(g){if(typeof g!="object"||g.constructor!==Object)return b.error('Image options "params" should be an object'),!1;const w={},S=b.concat(void 0,"params");for(const E in g){if(!E)return S.error("Image parameter name should be non-empty"),!1;const M=S.concat(void 0,E).parse(g[E],void 0,qr,void 0,{typeAnnotation:"coerce"});if(!M)return!1;w[E]=M}s.at(-1).options.params=w}if(x){if(typeof x!="object"||x.constructor!==Object)return b.error('Image options "iconset" should be an object'),!1;if(!x.id)return b.error('Image options "iconset" should have an "id" property'),!1;s.at(-1).options.iconset=x}return n++,!0}var f;return!0}for(let f=0;f<2;f++)if(!l()||!u())return;return new cc(s[0].image,s[1]?s[1].image:void 0,s[0].options,s[1]?s[1].options:void 0)}evaluateParams(e,i){const n={};if(i){for(const s in i)if(i[s])try{n[s]=i[s].evaluate(e)}catch{continue}if(Object.keys(n).length!==0)return{params:n}}}evaluate(e){const i={name:this.namePrimary.evaluate(e),iconsetId:this.iconsetIdPrimary},n=this.nameSecondary?{name:this.nameSecondary.evaluate(e),iconsetId:this.iconsetIdSecondary}:void 0,s=Vr.build(i,n,this.paramsPrimary?this.evaluateParams(e,this.paramsPrimary):void 0,this.paramsSecondary?this.evaluateParams(e,this.paramsSecondary):void 0);if(s&&e.availableImages){const l=s.getPrimary().id;if(s.available=e.availableImages.some(u=>Dr.isEqual(u,l)),s.available){const u=s.getSecondary()?s.getSecondary().id:null;u&&(s.available=e.availableImages.some(f=>Dr.isEqual(f,u)))}}return s}eachChild(e){if(e(this.namePrimary),this.paramsPrimary)for(const i in this.paramsPrimary)this.paramsPrimary[i]&&e(this.paramsPrimary[i]);if(this.nameSecondary&&(e(this.nameSecondary),this.paramsSecondary))for(const i in this.paramsSecondary)this.paramsSecondary[i]&&e(this.paramsSecondary[i])}outputDefined(){return!1}serializeOptions(e,i){const n={};if(i&&(n.iconset={id:i}),e){n.params={};for(const s in e)e[s]&&(n.params[s]=e[s].serialize())}return Object.keys(n).length>0?n:void 0}serialize(){const e=["image",this.namePrimary.serialize()];if(this.paramsPrimary||this.iconsetIdPrimary){const i=this.serializeOptions(this.paramsPrimary,this.iconsetIdPrimary);i&&e.push(i)}if(this.nameSecondary&&(e.push(this.nameSecondary.serialize()),this.paramsSecondary||this.iconsetIdSecondary)){const i=this.serializeOptions(this.paramsSecondary,this.iconsetIdSecondary);i&&e.push(i)}return e}}function mu(r){return jh(r)?"string":uc(r)?"number":hc(r)?"boolean":Array.isArray(r)?"array":r===null?"null":Vh(r)?"object":typeof r}function Vh(r){return r!=null&&!Array.isArray(r)&&typeof r!="function"&&!(r instanceof String||r instanceof Number||r instanceof Boolean)&&typeof r=="object"}function jh(r){return typeof r=="string"||r instanceof String}function uc(r){return typeof r=="number"||r instanceof Number}function hc(r){return typeof r=="boolean"||r instanceof Boolean}const ll={"to-boolean":Ut,"to-color":qr,"to-number":st,"to-string":Kt};class To{constructor(e,i){this.type=e,this.args=i}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");const n=e[0],s=[];let l=Ss;if(n==="to-array"){if(!Array.isArray(e[1]))return null;const u=e[1].length;if(i.expectedType){if(i.expectedType.kind!=="array")return i.error(`Expected ${i.expectedType.kind} but found array.`);l=Rr(i.expectedType.itemType,u)}else{if(!(u>0&&sl(e[1][0])))return null;l=Rr(Ji(e[1][0]),u)}for(let f=0;f<u;f++){const p=e[1][f];let g;if(Array.isArray(p))g=i.parse(p,void 0,l.itemType);else{const x=mu(p);if(x!==l.itemType.kind)return i.error(`Expected ${l.itemType.kind} but found ${x}.`);g=i.registry.literal.parse(["literal",p===void 0?null:p],i)}if(!g)return null;s.push(g)}}else{if((n==="to-boolean"||n==="to-string")&&e.length!==2)return i.error("Expected one argument.");l=ll[n];for(let u=1;u<e.length;u++){const f=i.parse(e[u],u,ei);if(!f)return null;s.push(f)}}return new To(l,s)}evaluate(e){if(this.type.kind==="boolean")return!!this.args[0].evaluate(e);if(this.type.kind==="color"){let i,n;for(const s of this.args){if(i=s.evaluate(e),n=null,i instanceof qt)return i;if(typeof i=="string"){const l=e.parseColor(i);if(l)return l}else if(Array.isArray(i)&&(n=i.length<3||i.length>4?`Invalid rbga value ${JSON.stringify(i)}: expected an array containing either three or four numeric values.`:sp(i[0],i[1],i[2],i[3]),!n))return new qt(i[0]/255,i[1]/255,i[2]/255,i[3])}throw new vi(n||`Could not parse color from value '${typeof i=="string"?i:String(JSON.stringify(i))}'`)}if(this.type.kind==="number"){let i=null;for(const n of this.args){if(i=n.evaluate(e),i===null)return 0;const s=Number(i);if(!isNaN(s))return s}throw new vi(`Could not convert ${JSON.stringify(i)} to number.`)}return this.type.kind==="formatted"?zr.fromString(Bn(this.args[0].evaluate(e))):this.type.kind==="resolvedImage"?Vr.build(Bn(this.args[0].evaluate(e))):this.type.kind==="array"?this.args.map(i=>i.evaluate(e)):Bn(this.args[0].evaluate(e))}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}serialize(){if(this.type.kind==="formatted")return new al([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if(this.type.kind==="resolvedImage")return new cc(this.args[0]).serialize();const e=this.type.kind==="array"?[]:[`to-${this.type.kind}`];return this.eachChild(i=>{e.push(i.serialize())}),e}}const So=["Unknown","Point","LineString","Polygon"];class Gh{constructor(e,i,n){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=i,this.iconImageUseTheme=n}id(){return this.feature&&this.feature.id!==void 0?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?So[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,i=this.featureDistanceData.scale,{x:n,y:s}=this.featureTileCoord;return this.featureDistanceData.bearing[0]*(n*i-e[0])+this.featureDistanceData.bearing[1]*(s*i-e[1])}return 0}parseColor(e){let i=this._parseColorCache[e];return i||(i=this._parseColorCache[e]=qt.parse(e)),i}getConfig(e){return this.options?this.options.get(e):null}}class Zr{constructor(e,i,n,s,l){this.name=e,this.type=i,this._evaluate=n,this.args=s,this._overloadIndex=l}evaluate(e){if(!this._evaluate){const i=Zr.definitions[this.name];this._evaluate=Array.isArray(i)?i[2]:i.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,i){const n=e[0],s=Zr.definitions[n];if(!s)return i.error(`Unknown expression "${n}". If you wanted a literal array, use ["literal", [...]].`,0);const l=Array.isArray(s)?s[0]:s.type,u=Array.isArray(s)?[[s[1],s[2]]]:s.overloads,f=[];let p=null,g=-1;for(const[x,b]of u){if(Array.isArray(x)&&x.length!==e.length-1)continue;f.push(x),g++,p===null?p=new dn(i.registry,i.path,null,i.scope,[],i._scope,i.options,i.iconImageUseTheme):p.errors.length=0;const w=[];let S=!1;for(let E=1;E<e.length;E++){const M=e[E],C=Array.isArray(x)?x[E-1]:x.type,R=p.parse(M,1+w.length,C);if(!R){S=!0;break}w.push(R)}if(!S)if(Array.isArray(x)&&x.length!==w.length)p.error(`Expected ${x.length} arguments, but found ${w.length} instead.`);else{for(let E=0;E<w.length;E++){const M=Array.isArray(x)?x[E]:x.type;p.checkSubtype(M,w[E].type,E+1)}if(p.errors.length===0)return new Zr(n,l,b,w,g)}}if(f.length===1)i.errors.push(...p.errors);else{const x=(f.length?f:u.map(([w])=>w)).map(dc).join(" | "),b=[];for(let w=1;w<e.length;w++){const S=i.parse(e[w],1+b.length);if(!S)return null;b.push(Tt(S.type))}i.error(`Expected arguments of type ${x}, but found (${b.join(", ")}) instead.`)}return null}static register(e,i){Zr.definitions=i;for(const n in i)e[n]=Zr}}function dc(r){return Array.isArray(r)?`(${r.map(Tt).join(", ")})`:`(${Tt(r.type)}...)`}class da{constructor(e,i,n){this.type=Is,this.locale=n,this.caseSensitive=e,this.diacriticSensitive=i}static parse(e,i){if(e.length!==2)return i.error("Expected one argument."),null;const n=e[1];if(typeof n!="object"||Array.isArray(n))return i.error("Collator options argument must be an object."),null;const s=n["case-sensitive"]===void 0?i.parse(!1,1,Ut):i.parseObjectValue(n["case-sensitive"],1,"case-sensitive",Ut);if(!s)return null;const l=n["diacritic-sensitive"]===void 0?i.parse(!1,1,Ut):i.parseObjectValue(n["diacritic-sensitive"],1,"diacritic-sensitive",Ut);if(!l)return null;let u=null;return n.locale&&(u=i.parseObjectValue(n.locale,1,"locale",Kt),!u)?null:new da(s,l,u)}evaluate(e){return new ol(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 ap(r,e,i=0,n=r.length-1,s=F_){for(;n>i;){if(n-i>600){const p=n-i+1,g=e-i+1,x=Math.log(p),b=.5*Math.exp(2*x/3),w=.5*Math.sqrt(x*b*(p-b)/p)*(g-p/2<0?-1:1);ap(r,e,Math.max(i,Math.floor(e-g*b/p+w)),Math.min(n,Math.floor(e+(p-g)*b/p+w)),s)}const l=r[e];let u=i,f=n;for(fc(r,i,e),s(r[n],l)>0&&fc(r,i,n);u<f;){for(fc(r,u,f),u++,f--;s(r[u],l)<0;)u++;for(;s(r[f],l)>0;)f--}s(r[i],l)===0?fc(r,i,f):(f++,fc(r,f,n)),f<=e&&(i=f+1),e<=f&&(n=f-1)}}function fc(r,e,i){const n=r[e];r[e]=r[i],r[i]=n}function F_(r,e){return r<e?-1:r>e?1:0}function lp(r){let e=0;for(let i,n,s=0,l=r.length,u=l-1;s<l;u=s++)i=r[s],n=r[u],e+=(n.x-i.x)*(i.y+n.y);return e}function fa(r,e){r[0]=Math.min(r[0],e[0]),r[1]=Math.min(r[1],e[1]),r[2]=Math.max(r[2],e[0]),r[3]=Math.max(r[3],e[1])}function pc(r,e){return!(r[0]<=e[0]||r[2]>=e[2]||r[1]<=e[1]||r[3]>=e[3])}function _u(r,e,i){const n=r[0]-e[0],s=r[1]-e[1],l=r[0]-i[0],u=r[1]-i[1];return n*u-l*s===0&&n*l<=0&&s*u<=0}function B_(r,e,i){return e[1]>r[1]!=i[1]>r[1]&&r[0]<(i[0]-e[0])*(r[1]-e[1])/(i[1]-e[1])+e[0]}function cl(r,e,i=!1){let n=!1;for(let s=0,l=e.length;s<l;s++){const u=e[s];for(let f=0,p=u.length,g=p-1;f<p;g=f++){const x=u[g],b=u[f];if(_u(r,x,b))return i;B_(r,x,b)&&(n=!n)}}return n}function cp(r,e,i,n){const s=n[0]-i[0],l=n[1]-i[1],u=(r[0]-i[0])*l-s*(r[1]-i[1]),f=(e[0]-i[0])*l-s*(e[1]-i[1]);return u>0&&f<0||u<0&&f>0}function gu(r,e,i,n){return(s=[n[0]-i[0],n[1]-i[1]])[0]*(l=[e[0]-r[0],e[1]-r[1]])[1]-s[1]*l[0]!==0&&!(!cp(r,e,i,n)||!cp(i,n,r,e));var s,l}function $h(r){const e=new Ue(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),i=new Ue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);for(const n of r[0])e.x>n.x&&(e.x=n.x),e.y>n.y&&(e.y=n.y),i.x<n.x&&(i.x=n.x),i.y<n.y&&(i.y=n.y);return{min:e,max:i}}const Es=8192;function k_(r,e){const i=(180+r[0])/360,n=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r[1]*Math.PI/360)))/360,s=Math.pow(2,e.z);return[Math.round(i*s*Es),Math.round(n*s*Es)]}function up(r,e){for(let i=0;i<e.length;i++)if(cl(r,e[i]))return!0;return!1}function ul(r,e,i){for(const n of i)for(let s=0,l=n.length,u=l-1;s<l;u=s++)if(gu(r,e,n[u],n[s]))return!0;return!1}function hp(r,e){for(let i=0;i<r.length;++i)if(!cl(r[i],e))return!1;for(let i=0;i<r.length-1;++i)if(ul(r[i],r[i+1],e))return!1;return!0}function dp(r,e){for(let i=0;i<e.length;i++)if(hp(r,e[i]))return!0;return!1}function mc(r,e,i){const n=[];for(let s=0;s<r.length;s++){const l=[];for(let u=0;u<r[s].length;u++){const f=k_(r[s][u],i);fa(e,f),l.push(f)}n.push(l)}return n}function fp(r,e,i){const n=[];for(let s=0;s<r.length;s++){const l=mc(r[s],e,i);n.push(l)}return n}function pp(r,e,i,n){if(r[0]<i[0]||r[0]>i[2]){const s=.5*n;let l=r[0]-i[0]>s?-n:i[0]-r[0]>s?n:0;l===0&&(l=r[0]-i[2]>s?-n:i[2]-r[0]>s?n:0),r[0]+=l}fa(e,r)}function mp(r,e,i,n){const s=Math.pow(2,n.z)*Es,l=[n.x*Es,n.y*Es],u=[];
1if(!r)return u;for(const f of r)for(const p of f){const g=[p.x+l[0],p.y+l[1]];pp(g,e,i,s),u.push(g)}return u}function _p(r,e,i,n){const s=Math.pow(2,n.z)*Es,l=[n.x*Es,n.y*Es],u=[];if(!r)return u;for(const p of r){const g=[];for(const x of p){const b=[x.x+l[0],x.y+l[1]];fa(e,b),g.push(b)}u.push(g)}if(e[2]-e[0]<=s/2){(f=e)[0]=f[1]=1/0,f[2]=f[3]=-1/0;for(const p of u)for(const g of p)pp(g,e,i,s)}var f;return u}class Io{constructor(e,i){this.type=Ut,this.geojson=e,this.geometries=i}static parse(e,i){if(e.length!==2)return i.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(sl(e[1])){const n=e[1];if(n.type==="FeatureCollection")for(let s=0;s<n.features.length;++s){const l=n.features[s].geometry.type;if(l==="Polygon"||l==="MultiPolygon")return new Io(n,n.features[s].geometry)}else if(n.type==="Feature"){const s=n.geometry.type;if(s==="Polygon"||s==="MultiPolygon")return new Io(n,n.geometry)}else if(n.type==="Polygon"||n.type==="MultiPolygon")return new Io(n,n)}return i.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return(function(i,n){const s=[1/0,1/0,-1/0,-1/0],l=[1/0,1/0,-1/0,-1/0],u=i.canonicalID();if(!u)return!1;if(n.type==="Polygon"){const f=mc(n.coordinates,l,u),p=mp(i.geometry(),s,l,u);if(!pc(s,l))return!1;for(const g of p)if(!cl(g,f))return!1}if(n.type==="MultiPolygon"){const f=fp(n.coordinates,l,u),p=mp(i.geometry(),s,l,u);if(!pc(s,l))return!1;for(const g of p)if(!up(g,f))return!1}return!0})(e,this.geometries);if(e.geometryType()==="LineString")return(function(i,n){const s=[1/0,1/0,-1/0,-1/0],l=[1/0,1/0,-1/0,-1/0],u=i.canonicalID();if(!u)return!1;if(n.type==="Polygon"){const f=mc(n.coordinates,l,u),p=_p(i.geometry(),s,l,u);if(!pc(s,l))return!1;for(const g of p)if(!hp(g,f))return!1}if(n.type==="MultiPolygon"){const f=fp(n.coordinates,l,u),p=_p(i.geometry(),s,l,u);if(!pc(s,l))return!1;for(const g of p)if(!dp(g,f))return!1}return!0})(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}serialize(){return["within",this.geojson]}}const Eo={kilometers:1,miles:1e3/1609.344,nauticalmiles:1e3/1852,meters:1e3,metres:1e3,yards:1e3/.9144,feet:1e3/.3048,inches:1e3/.0254},gt=1/298.257223563,rt=gt*(2-gt),pa=Math.PI/180;class pt{static fromTile(e,i,n){const s=Math.PI*(1-2*(e+.5)/Math.pow(2,i)),l=Math.atan(.5*(Math.exp(s)-Math.exp(-s)))/pa;return new pt(l,n)}static get units(){return Eo}constructor(e,i){if(e===void 0)throw new Error("No latitude given.");if(i&&!Eo[i])throw new Error(`Unknown unit ${i}. Use one of: ${Object.keys(Eo).join(", ")}`);const n=6378.137*pa*(i?Eo[i]:1),s=Math.cos(e*pa),l=1/(1-rt*(1-s*s)),u=Math.sqrt(l);this.kx=n*u*s,this.ky=n*u*l*(1-rt)}distance(e,i){const n=lt(e[0]-i[0])*this.kx,s=(e[1]-i[1])*this.ky;return Math.sqrt(n*n+s*s)}bearing(e,i){const n=lt(i[0]-e[0])*this.kx;return Math.atan2(n,(i[1]-e[1])*this.ky)/pa}destination(e,i,n){const s=n*pa;return this.offset(e,Math.sin(s)*i,Math.cos(s)*i)}offset(e,i,n){return[e[0]+i/this.kx,e[1]+n/this.ky]}lineDistance(e){let i=0;for(let n=0;n<e.length-1;n++)i+=this.distance(e[n],e[n+1]);return i}area(e){let i=0;for(let n=0;n<e.length;n++){const s=e[n];for(let l=0,u=s.length,f=u-1;l<u;f=l++)i+=lt(s[l][0]-s[f][0])*(s[l][1]+s[f][1])*(n?-1:1)}return Math.abs(i)/2*this.kx*this.ky}along(e,i){let n=0;if(i<=0)return e[0];for(let s=0;s<e.length-1;s++){const l=e[s],u=e[s+1],f=this.distance(l,u);if(n+=f,n>i)return _c(l,u,(i-(n-f))/f)}return e[e.length-1]}pointToSegmentDistance(e,i,n){let[s,l]=i,u=lt(n[0]-s)*this.kx,f=(n[1]-l)*this.ky;if(u!==0||f!==0){const p=(lt(e[0]-s)*this.kx*u+(e[1]-l)*this.ky*f)/(u*u+f*f);p>1?(s=n[0],l=n[1]):p>0&&(s+=u/this.kx*p,l+=f/this.ky*p)}return u=lt(e[0]-s)*this.kx,f=(e[1]-l)*this.ky,Math.sqrt(u*u+f*f)}pointOnLine(e,i){let n=1/0,s=e[0][0],l=e[0][1],u=0,f=0;for(let p=0;p<e.length-1;p++){let g=e[p][0],x=e[p][1],b=lt(e[p+1][0]-g)*this.kx,w=(e[p+1][1]-x)*this.ky,S=0;b===0&&w===0||(S=(lt(i[0]-g)*this.kx*b+(i[1]-x)*this.ky*w)/(b*b+w*w),S>1?(g=e[p+1][0],x=e[p+1][1]):S>0&&(g+=b/this.kx*S,x+=w/this.ky*S)),b=lt(i[0]-g)*this.kx,w=(i[1]-x)*this.ky;const E=b*b+w*w;E<n&&(n=E,s=g,l=x,u=p,f=S)}return{point:[s,l],index:u,t:Math.max(0,Math.min(1,f))}}lineSlice(e,i,n){let s=this.pointOnLine(n,e),l=this.pointOnLine(n,i);if(s.index>l.index||s.index===l.index&&s.t>l.t){const g=s;s=l,l=g}const u=[s.point],f=s.index+1,p=l.index;!yu(n[f],u[0])&&f<=p&&u.push(n[f]);for(let g=f+1;g<=p;g++)u.push(n[g]);return yu(n[p],l.point)||u.push(l.point),u}lineSliceAlong(e,i,n){let s=0;const l=[];for(let u=0;u<n.length-1;u++){const f=n[u],p=n[u+1],g=this.distance(f,p);if(s+=g,s>e&&l.length===0&&l.push(_c(f,p,(e-(s-g))/g)),s>=i)return l.push(_c(f,p,(i-(s-g))/g)),l;s>e&&l.push(p)}return l}bufferPoint(e,i){const n=i/this.ky,s=i/this.kx;return[e[0]-s,e[1]-n,e[0]+s,e[1]+n]}bufferBBox(e,i){const n=i/this.ky,s=i/this.kx;return[e[0]-s,e[1]-n,e[2]+s,e[3]+n]}insideBBox(e,i){return lt(e[0]-i[0])>=0&<(e[0]-i[2])<=0&&e[1]>=i[1]&&e[1]<=i[3]}}function yu(r,e){return r[0]===e[0]&&r[1]===e[1]}function _c(r,e,i){const n=lt(e[0]-r[0]);return[r[0]+n*i,r[1]+(e[1]-r[1])*i]}function lt(r){for(;r<-180;)r+=360;for(;r>180;)r-=360;return r}class gc{constructor(e=[],i=(n,s)=>n<s?-1:n>s?1:0){if(this.data=e,this.length=this.data.length,this.compare=i,this.length>0)for(let n=(this.length>>1)-1;n>=0;n--)this._down(n)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(this.length===0)return;const e=this.data[0],i=this.data.pop();return--this.length>0&&(this.data[0]=i,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:i,compare:n}=this,s=i[e];for(;e>0;){const l=e-1>>1,u=i[l];if(n(s,u)>=0)break;i[e]=u,e=l}i[e]=s}_down(e){const{data:i,compare:n}=this,s=this.length>>1,l=i[e];for(;e<s;){let u=1+(e<<1);const f=u+1;if(f<this.length&&n(i[f],i[u])<0&&(u=f),n(i[u],l)>=0)break;i[e]=i[u],e=u}i[e]=l}}var Xe=8192;function Hh(r,e){return e.dist-r.dist}function qh(r){const e=[1/0,1/0,-1/0,-1/0];if(e.length!==r.length)return!1;for(let i=0;i<e.length;i++)if(e[i]!==r[i])return!1;return!0}function ma(r){return r[1]-r[0]+1}function Ko(r,e){const i=r[1]>=r[0]&&r[1]<e;return i||console.warn("Distance Expression: Index is out of range"),i}function yc(r,e){if(r[0]>
vendor: 30,356 bytes, line 1
1r[1])return[null,null];const i=ma(r);if(e){if(i===2)return[r,null];const n=Math.floor(i/2);return[[r[0],r[0]+n],[r[0]+n,r[1]]]}{if(i===1)return[r,null];const n=Math.floor(i/2)-1;return[[r[0],r[0]+n],[r[0]+n+1,r[1]]]}}function Sn(r,e){const i=[1/0,1/0,-1/0,-1/0];if(!Ko(e,r.length))return i;for(let n=e[0];n<=e[1];++n)fa(i,r[n]);return i}function hl(r){const e=[1/0,1/0,-1/0,-1/0];for(let i=0;i<r.length;++i)for(let n=0;n<r[i].length;++n)fa(e,r[i][n]);return e}function In(r,e,i){if(qh(r)||qh(e))return NaN;let n=0,s=0;return r[2]<e[0]&&(n=e[0]-r[2]),r[0]>e[2]&&(n=r[0]-e[2]),r[1]>e[3]&&(s=r[1]-e[3]),r[3]<e[1]&&(s=e[1]-r[3]),i.distance([0,0],[n,s])}function gp(r){return 360*r-180}function yp(r){return 360/Math.PI*Math.atan(Math.exp((180-360*r)*Math.PI/180))-90}function xu(r,e,i=8192){const n=Math.pow(2,e.z),s=(r.y/i+e.y)/n;return[gp((r.x/i+e.x)/n),yp(s)]}function N_(r,e){const i=[];for(let n=0;n<r.length;++n)i.push(xu(r[n],e));return i}function xp(r,e,i){const n=i.pointOnLine(e,r).point;return i.distance(r,n)}function xc(r,e,i,n,s){const l=i.slice(n[0],n[1]+1);let u=1/0;for(let f=e[0];f<=e[1];++f)if((u=Math.min(u,xp(r[f],l,s)))===0)return 0;return u}function vu(r,e,i,n,s){const l=Math.min(s.pointToSegmentDistance(r,i,n),s.pointToSegmentDistance(e,i,n)),u=Math.min(s.pointToSegmentDistance(i,r,e),s.pointToSegmentDistance(n,r,e));return Math.min(l,u)}function _a(r,e,i,n,s){if(!Ko(e,r.length)||!Ko(n,i.length))return NaN;let l=1/0;for(let u=e[0];u<e[1];++u)for(let f=n[0];f<n[1];++f){if(gu(r[u],r[u+1],i[f],i[f+1]))return 0;l=Math.min(l,vu(r[u],r[u+1],i[f],i[f+1],s))}return l}function U_(r,e,i,n,s){if(!Ko(e,r.length)||!Ko(n,i.length))return NaN;let l=1/0;for(let u=e[0];u<=e[1];++u)for(let f=n[0];f<=n[1];++f)if((l=Math.min(l,s.distance(r[u],i[f])))===0)return l;return l}function V_(r,e,i){if(cl(r,e,!0))return 0;let n=1/0;for(const s of e){const l=s.length;if(l<2)return console.warn("Distance Expression: Invalid polygon!"),NaN;if(s[0]!==s[l-1]&&(n=Math.min(n,i.pointToSegmentDistance(r,s[l-1],s[0])))===0||(n=Math.min(n,xp(r,s,i)))===0)return n}return n}function j_(r,e,i,n){if(!Ko(e,r.length))return NaN;for(let l=e[0];l<=e[1];++l)if(cl(r[l],i,!0))return 0;let s=1/0;for(let l=e[0];l<e[1];++l)for(const u of i)for(let f=0,p=u.length,g=p-1;f<p;g=f++){if(gu(r[l],r[l+1],u[g],u[f]))return 0;s=Math.min(s,vu(r[l],r[l+1],u[g],u[f],n))}return s}function vp(r,e){for(const i of r)for(let n=0;n<=i.length-1;++n)if(cl(i[n],e,!0))return!0;return!1}function Zh(r,e,i,n=1/0){const s=hl(r),l=hl(e);if(n!==1/0&&In(s,l,i)>=n)return n;if(pc(s,l)){if(vp(r,e))return 0}else if(vp(e,r))return 0;let u=n;for(const f of r)for(let p=0,g=f.length,x=g-1;p<g;x=p++)for(const b of e)for(let w=0,S=b.length,E=S-1;w<S;E=w++){if(gu(f[x],f[p],b[E],b[w]))return 0;u=Math.min(u,vu(f[x],f[p],b[E],b[w],i))}return u}function bu(r,e,i,n,s,l,u){if(l===null||u===null)return;const f=In(Sn(n,l),Sn(s,u),i);f<e&&r.push({dist:f,range1:l,range2:u})}function Wh(r,e,i,n,s=1/0){let l=Math.min(n.distance(r[0],i[0][0]),s);if(l===0)return l;const u=new gc([{dist:0,range1:[0,r.length-1],range2:[0,0]}],Hh),f=e?50:100,p=hl(i);for(;u.length;){const g=u.pop();if(g.dist>=l)continue;const x=g.range1;if(ma(x)<=f){if(!Ko(x,r.length))return NaN;if(e){const b=j_(r,x,i,n);if((l=Math.min(l,b))===0)return l}else for(let b=x[0];b<=x[1];++b){const w=V_(r[b],i,n);if((l=Math.min(l,w))===0)return l}}else{const b=yc(x,e);if(b[0]!==null){const w=In(Sn(r,b[0]),p,n);w<l&&u.push({dist:w,range1:b[0],range2:[0,0]})}if(b[1]!==null){const w=In(Sn(r,b[1]),p,n);w<l&&u.push({dist:w,range1:b[1],range2:[0,0]})}}}return l}function bp(r,e,i,n,s,l=1/0){let u=Math.min(l,s.distance(r[0],i[0]));if(u===0)return u;const f=new gc([{dist:0,range1:[0,r.length-1],range2:[0,i.length-1]}],Hh),p=e?50:100,g=n?50:100;for(;f.length;){const x=f.pop();if(x.dist>=u)continue;const b=x.range1,w=x.range2;if(ma(b)<=p&&ma(w)<=g){if(!Ko(b,r.length)||!Ko(w,i.length))return NaN;if(e&&n?u=Math.min(u,_a(r,b,i,w,s)):e||n?e&&!n?u=Math.min(u,xc(i,w,r,b,s)):!e&&n&&(u=Math.min(u,xc(r,b,i,w,s))):u=Math.min(u,U_(r,b,i,w,s)),u===0)return u}else{const S=yc(b,e),E=yc(w,n);bu(f,u,s,r,i,S[0],E[0]),bu(f,u,s,r,i,S[0],E[1]),bu(f,u,s,r,i,S[1],E[0]),bu(f,u,s,r,i,S[1],E[1])}}return u}function Xh(r,e,i,n,s=1/0){let l=s;const u=Sn(r,[0,r.length-1]);for(const f of i)if(!(l!==1/0&&In(u,Sn(f,[0,f.length-1]),n)>=l)&&(l=Math.min(l,bp(r,e,f,!0,n,l)),l===0))return l;return l}function vc(r,e,i,n,s=1/0){let l=s;const u=Sn(r,[0,r.length-1]);for(const f of i){if(l!==1/0&&In(u,hl(f),n)>=l)continue;const p=Wh(r,e,f,n,l);if(isNaN(p))return p;if((l=Math.min(l,p))===0)return l}return l}function Yh(r){return r==="Point"||r==="MultiPoint"||r==="LineString"||r==="MultiLineString"||r==="Polygon"||r==="MultiPolygon"}class ga{constructor(e,i){this.type=st,this.geojson=e,this.geometries=i}static parse(e,i){if(e.length!==2)return i.error(`'distance' expression requires either one argument, but found ' ${e.length-1} instead.`);if(sl(e[1])){const n=e[1];if(n.type==="FeatureCollection"){for(let s=0;s<n.features.length;++s)if(Yh(n.features[s].geometry.type))return new ga(n,n.features[s].geometry)}else if(n.type==="Feature"){if(Yh(n.geometry.type))return new ga(n,n.geometry)}else if(Yh(n.type))return new ga(n,n)}return i.error("'distance' expression needs to be an array with format ['Distance', GeoJSONObj].")}evaluate(e){const i=e.geometry(),n=e.canonicalID();if(i!=null&&n!=null){if(e.geometryType()==="Point")return(function(s,l,u){const f=[];for(const g of s)for(const x of g)f.push(xu(x,l));const p=new pt(f[0][1],"meters");return u.type==="Point"||u.type==="MultiPoint"||u.type==="LineString"?bp(f,!1,u.type==="Point"?[u.coordinates]:u.coordinates,u.type==="LineString",p):u.type==="MultiLineString"?Xh(f,!1,u.coordinates,p):u.type==="Polygon"||u.type==="MultiPolygon"?vc(f,!1,u.type==="Polygon"?[u.coordinates]:u.coordinates,p):null})(i,n,this.geometries);if(e.geometryType()==="LineString")return(function(s,l,u){const f=[];for(const g of s){const x=[];for(const b of g)x.push(xu(b,l));f.push(x)}const p=new pt(f[0][0][1],"meters");if(u.type==="Point"||u.type==="MultiPoint"||u.type==="LineString")return Xh(u.type==="Point"?[u.coordinates]:u.coordinates,u.type==="LineString",f,p);if(u.type==="MultiLineString"){let g=1/0;for(let x=0;x<u.coordinates.length;x++){const b=Xh(u.coordinates[x],!0,f,p,g);if(isNaN(b))return b;if((g=Math.min(g,b))===0)return g}return g}if(u.type==="Polygon"||u.type==="MultiPolygon"){let g=1/0;for(let x=0;x<f.length;x++){const b=vc(f[x],!0,u.type==="Polygon"?[u.coordinates]:u.coordinates,p,g);if(isNaN(b))return b;if((g=Math.min(g,b))===0)return g}return g}return null})(i,n,this.geometries);if(e.geometryType()==="Polygon")return(function(s,l,u){const f=[];for(const g of(function(x){const b=x.length;if(b<=1)return[x];const w=[];let S,E;for(let M=0;M<b;M++){const C=lp(x[M]);C!==0&&(x[M].area=Math.abs(C),E===void 0&&(E=C<0),E===C<0?(S&&w.push(S),S=[x[M]]):S.push(x[M]))}return S&&w.push(S),w})(s)){const x=[];for(let b=0;b<g.length;++b)x.push(N_(g[b],l));f.push(x)}const p=new pt(f[0][0][0][1],"meters");if(u.type==="Point"||u.type==="MultiPoint"||u.type==="LineString")return vc(u.type==="Point"?[u.coordinates]:u.coordinates,u.type==="LineString",f,p);if(u.type==="MultiLineString"){let g=1/0;for(let x=0;x<u.coordinates.length;x++){const b=vc(u.coordinates[x],!0,f,p,g);if(isNaN(b))return b;if((g=Math.min(g,b))===0)return g}return g}return u.type==="Polygon"||u.type==="MultiPolygon"?(function(g,x,b){let w=1/0;for(const S of g)for(const E of x){const M=Zh(S,E,b,w);if(isNaN(M))return M;if((w=Math.min(w,M))===0)return w}return w})(u.type==="Polygon"?[u.coordinates]:u.coordinates,f,p):null})(i,n,this.geometries);console.warn("Distance Expression: currently only evaluates valid Point/LineString/Polygon geometries.")}else console.warn("Distance Expression: requires valid feature and canonical information.");return null}eachChild(){}outputDefined(){return!0}serialize(){return["distance",this.geojson]}}function ya(r){if(r instanceof Zr&&(r.name==="get"&&r.args.length===1||r.name==="feature-state"||r.name==="has"&&r.args.length===1||r.name==="properties"||r.name==="geometry-type"||r.name==="id"||r.name.startsWith("filter-"))||r instanceof Io||r instanceof ga)return!1;if(r instanceof xa)return r.featureConstant;let e=!0;return r.eachChild(i=>{e&&!ya(i)&&(e=!1)}),e}function kn(r){if(r instanceof Zr&&r.name==="feature-state")return!1;let e=!0;return r.eachChild(i=>{e&&!kn(i)&&(e=!1)}),e}function Ao(r,e){if(r instanceof Zr&&e.includes(r.name))return!1;let i=!0;return r.eachChild(n=>{i&&!Ao(n,e)&&(i=!1)}),i}function wp(r,e,i){return[r,e,i].filter(Boolean).join("�")}function bc(r,e){switch(r){case"string":return Bn(e);case"number":return+e;case"boolean":return!!e;case"color":return qt.parse(e);case"formatted":return zr.fromString(Bn(e));case"resolvedImage":return Vr.build(Bn(e))}return e}function Tp(r,e,i,n){return n!==void 0&&(r=n*Math.round(r/n)),e!==void 0&&r<e&&(r=e),i!==void 0&&r>i&&(r=i),r}class xa{constructor(e,i,n,s=!1){this.type=e,this.key=i,this.scope=n,this.featureConstant=s}static parse(e,i){let n=i.expectedType;if(n==null&&(n=ei),e.length<2||e.length>3)return i.error("Invalid number of arguments for 'config' expression.");const s=i.parse(e[1],1);if(!(s instanceof no))return i.error("Key name of 'config' expression must be a string literal.");let l,u=!0;const f=Bn(s.value);if(e.length>=3){const p=i.parse(e[2],2);if(!(p instanceof no))return i.error("Scope of 'config' expression must be a string literal.");l=Bn(p.value)}if(i.options){const p=wp(f,l,i._scope),g=i.options.get(p);g&&(u=ya(g.value||g.default))}return new xa(n,f,l,u)}evaluate(e){const i=wp(this.key,this.scope,e.scope),n=e.getConfig(i);if(!n)return null;const{type:s,value:l,values:u,minValue:f,maxValue:p,stepValue:g}=n,x=n.default.evaluate(e);let b=x;if(l){const w=e.scope;e.scope=(w||"").split("�").slice(1).join("�"),b=l.evaluate(e),e.scope=w}return s&&(b=bc(s,b)),b===void 0||f===void 0&&p===void 0&&g===void 0||(typeof b=="number"?b=Tp(b,f,p,g):Array.isArray(b)&&(b=b.map(w=>typeof w=="number"?Tp(w,f,p,g):w))),l!==void 0&&b!==void 0&&u&&!u.includes(b)&&(b=x,s&&(b=bc(s,b))),(s&&s!==this.type||b!==void 0&&!ua(Ji(b),this.type))&&(b=bc(this.type.kind,b)),b}eachChild(){}outputDefined(){return!1}serialize(){const e=["config",this.key];return this.scope&&e.concat(this.scope),e}}class wc{constructor(e,i){this.type=i.type,this.name=e,this.boundExpression=i}static parse(e,i){if(e.length!==2||typeof e[1]!="string")return i.error("'var' expression requires exactly one string literal argument.");const n=e[1];return i.scope.has(n)?new wc(n,i.scope.get(n)):i.error(`Unknown variable "${n}". Make sure "${n}" 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 dn{constructor(e,i=[],n,s=new fu,l=[],u,f,p){this.registry=e,this.path=i,this.scope=s,this.errors=l,this.expectedType=n,this._scope=u,this.options=f,this.iconImageUseTheme=p}get key(){if(this._key===void 0){const e=this.path;let i="";for(let n=0;n<e.length;n++){const s=e[n];i+=typeof s=="string"?`['${s}']`:`[${s}]`}this._key=i}return this._key}parse(e,i,n,s,l={}){return i||n?this.concat(i,null,n,s)._parse(e,l):this._parse(e,l)}parseObjectValue(e,i,n,s,l,u={}){return this.concat(i,n,s,l)._parse(e,u)}_parse(e,i){function n(s,l,u){return u==="assert"?new oo(l,[s]):u==="coerce"?new To(l,[s]):s}if(e!==null&&typeof e!="string"&&typeof e!="boolean"&&typeof e!="number"||(e=["literal",e]),Array.isArray(e)){if(e.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const s=typeof e[0]=="string"?this.registry[e[0]]:void 0;if(s){let l=s.parse(e,this);if(!l)return null;if(this.expectedType){const u=this.expectedType,f=l.type;if(u.kind!=="string"&&u.kind!=="number"&&u.kind!=="boolean"&&u.kind!=="object"&&u.kind!=="array"||f.kind!=="value")if(u.kind!=="color"&&u.kind!=="formatted"&&u.kind!=="resolvedImage"||f.kind!=="value"&&f.kind!=="string"){if(this.checkSubtype(u,f))return null}else l=n(l,u,i.typeAnnotation||"coerce");else l=n(l,u,i.typeAnnotation||"assert")}if(!(l instanceof no)&&l.type.kind!=="resolvedImage"&&Tc(l)){const u=new Gh(this._scope,this.options,this.iconImageUseTheme);try{l=new no(l.type,l.evaluate(u))}catch(f){return this.error(f.message),null}}return l}return To.parse(["to-array",e],this)}return this.error(e===void 0?"'undefined' value invalid. Use null instead.":typeof e=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof e} instead.`)}concat(e,i,n,s){let l=typeof e=="number"?this.path.concat(e):this.path;l=typeof i=="string"?l.concat(i):l;const u=s?this.scope.concat(s):this.scope;return new dn(this.registry,l,n||null,u,this.errors,this._scope,this.options,this.iconImageUseTheme)}error(e,...i){const n=`${this.key}${i.map(s=>`[${s}]`).join("")}`;this.errors.push(new ro(n,e))}checkSubtype(e,i,n){const s=nl(e,i);return s&&this.error(s,...typeof n=="number"?[n]:[]),s}}function Tc(r){if(r instanceof wc)return Tc(r.boundExpression);if(r instanceof Zr&&r.name==="error"||r instanceof da||r instanceof Io||r instanceof ga||r instanceof xa)return!1;const e=r instanceof To||r instanceof oo;let i=!0;return r.eachChild(n=>{i=e?i&&Tc(n):i&&n instanceof no}),!!i&&ya(r)&&Ao(r,["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 Sc(r,e){const i=r.length-1;let n,s,l=0,u=i,f=0;for(;l<=u;)if(f=Math.floor((l+u)/2),n=r[f],s=r[f+1],n<=e){if(f===i||e<s)return f;l=f+1}else{if(!(n>e))throw new vi("Input is not a number.");u=f-1}return 0}class dl{constructor(e,i,n){this.type=e,this.input=i,this.labels=[],this.outputs=[];for(const[s,l]of n)this.labels.push(s),this.outputs.push(l)}static parse(e,i){if(e.length-1<4)return i.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return i.error("Expected an even number of arguments.");const n=i.parse(e[1],1,st);if(!n)return null;const s=[];let l=null;i.expectedType&&i.expectedType.kind!=="value"&&(l=i.expectedType);for(let u=1;u<e.length;u+=2){const f=u===1?-1/0:e[u],p=e[u+1],g=u,x=u+1;if(typeof f!="number")return i.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',g);if(s.length&&s.at(-1)[0]>=f)return i.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',g);const b=i.parse(p,x,l);if(!b)return null;l=l||b.type,s.push([f,b])}return new dl(l,n,s)}evaluate(e){const i=this.labels,n=this.outputs;if(i.length===1)return n[0].evaluate(e);const s=this.input.evaluate(e);if(s<=i[0])return n[0].evaluate(e);const l=i.length;return s>=i[l-1]?n[l-1].evaluate(e):n[Sc(i,s)].evaluate(e)}eachChild(e){e(this.input);for(const i of this.outputs)e(i)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}serialize(){const e=["step",this.input.serialize()];for(let i=0;i<this.labels.length;i++)i>0&&e.push(this.labels[i]),e.push(this.outputs[i].serialize());return e}}const Jh=.95047,Kh=1.08883,Qh=4/29,va=6/29,wu=3*va*va,Sp=va*va*va,Ip=Math.PI/180,Ep=180/Math.PI;function Tu(r){return r>Sp?Math.pow(r,1/3):r/wu+Qh}function Su(r){return r>va?r*r*r:wu*(r-Qh)}function ed(r){return 255*(r<=.0031308?12.92*r:1.055*Math.pow(r,1/2.4)-.055)}function td(r){return(r/=255)<=.04045?r/12.92:Math.pow((r+.055)/1.055,2.4)}function Ic(r){const e=td(r.r),i=td(r.g),n=td(r.b),s=Tu((.4124564*e+.3575761*i+.1804375*n)/Jh),l=Tu((.2126729*e+.7151522*i+.072175*n)/1);return{l:116*l-16,a:500*(s-l),b:200*(l-Tu((.0193339*e+.119192*i+.9503041*n)/Kh)),alpha:r.a}}function fl(r){let e=(r.l+16)/116,i=isNaN(r.a)?e:e+r.a/500,n=isNaN(r.b)?e:e-r.b/200;return e=1*Su(e),i=Jh*Su(i),n=Kh*Su(n),new qt(ed(3.2404542*i-1.5371385*e-.4985314*n),ed(-.969266*i+1.8760108*e+.041556*n),ed(.0556434*i-.2040259*e+1.0572252*n),r.alpha)}function Iu(r,e,i){const n=e-r;return r+i*(n>180||n<-180?n-360*Math.round(n/360):n)}const pl={forward:Ic,reverse:fl,interpolate:function(r,e,i){return{l:ft(r.l,e.l,i),a:ft(r.a,e.a,i),b:ft(r.b,e.b,i),alpha:ft(r.alpha,e.alpha,i)}}},ml={forward:function(r){const{l:e,a:i,b:n}=Ic(r),s=Math.atan2(n,i)*Ep;return{h:s<0?s+360:s,c:Math.sqrt(i*i+n*n),l:e,alpha:r.a}},reverse:function(r){const e=r.h*Ip,i=r.c;return fl({l:r.l,a:Math.cos(e)*i,b:Math.sin(e)*i,alpha:r.alpha})},interpolate:function(r,e,i){return{h:Iu(r.h,e.h,i),c:ft(r.c,e.c,i),l:ft(r.l,e.l,i),alpha:ft(r.alpha,e.alpha,i)}}};var id=Object.freeze({__proto__:null,hcl:ml,lab:pl});class fn{constructor(e,i,n,s,l){this.type=e,this.operator=i,this.interpolation=n,this.input=s,this.labels=[],this.outputs=[];for(const[u,f]of l)this.labels.push(u),this.outputs.push(f)}static interpolationFactor(e,i,n,s){let l=0;if(e.name==="exponential")l=rd(i,e.base,n,s);else if(e.name==="linear")l=rd(i,1,n,s);else if(e.name==="cubic-bezier"){const u=e.controlPoints;l=new qa(u[0],u[1],u[2],u[3]).solve(rd(i,1,n,s))}return l}static parse(e,i){let[n,s,l,...u]=e;if(!Array.isArray(s)||s.length===0)return i.error("Expected an interpolation type expression.",1);if(s[0]==="linear")s={name:"linear"};else if(s[0]==="exponential"){const g=s[1];if(typeof g!="number")return i.error("Exponential interpolation requires a numeric base.",1,1);s={name:"exponential",base:g}}else{if(s[0]!=="cubic-bezier")return i.error(`Unknown interpolation type ${String(s[0])}`,1,0);{const g=s.slice(1);if(g.length!==4||g.some(x=>typeof x!="number"||x<0||x>1))return i.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);s={name:"cubic-bezier",controlPoints:g}}}if(e.length-1<4)return i.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length-1>3&&(e.length-1)%2!=0)return i.error("Expected an even number of arguments.");if(l=i.parse(l,2,st),!l)return null;const f=[];let p=null;n==="interpolate-hcl"||n==="interpolate-lab"?p=qr:i.expectedType&&i.expectedType.kind!=="value"&&(p=i.expectedType);for(let g=0;g<u.length;g+=2){const x=u[g],b=u[g+1],w=g+3,S=g+4;if(typeof x!="number")return i.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',w);if(f.length&&f.at(-1)[0]>=x)return i.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',w);const E=i.parse(b,S,p);if(!E)return null;p=p||E.type,f.push([x,E])}return p.kind==="number"||p.kind==="color"||p.kind==="array"&&p.itemType.kind==="number"&&typeof p.N=="number"?new fn(p,n,s,l,f):i.error(`Type ${Tt(p)} is not interpolatable.`)}evaluate(e){const i=this.labels,n=this.outputs;if(i.length===1)return n[0].evaluate(e);const s=this.input.evaluate(e);if(s<=i[0])return n[0].evaluate(e);const l=i.length;if(s>=i[l-1])return n[l-1].evaluate(e);const u=Sc(i,s),f=fn.interpolationFactor(this.interpolation,s,i[u],i[u+1]),p=n[u].evaluate(e),g=n[u+1].evaluate(e);return this.operator==="interpolate"?du[this.type.kind.toLowerCase()](p,g,f):this.operator==="interpolate-hcl"?ml.reverse(ml.interpolate(ml.forward(p),ml.forward(g),f)):pl.reverse(pl.interpolate(pl.forward(p),pl.forward(g),f))}eachChild(e){e(this.input);for(const i of this.outputs)e(i)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}serialize(){let e;e=this.interpolation.name==="linear"?["linear"]:this.interpolation.name==="exponential"?this.interpolation.base===1?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier",...this.interpolation.controlPoints];const i=[this.operator,e,this.input.serialize()];for(let n=0;n<this.labels.length;n++)i.push(this.labels[n],this.outputs[n].serialize());return i}}function rd(r,e,i,n){const s=n-i,l=r-i;return s===0?0:e===1?l/s:(Math.pow(e,l)-1)/(Math.pow(e,s)-1)}class Eu{constructor(e,i){this.type=e,this.args=i}static parse(e,i){if(e.length<2)return i.error("Expectected at least one argument."),null;let n=null;const s=i.expectedType;s&&s.kind!=="value"&&(n=s);const l=[];for(const f of e.slice(1)){const p=i.parse(f,1+l.length,n,void 0,{typeAnnotation:"omit"});if(!p)return null;n=n||p.type,l.push(p)}const u=s&&l.some(f=>nl(s,f.type));return new Eu(u?ei:n,l)}evaluate(e){let i,n=null,s=0;for(const l of this.args){if(s++,n=l.evaluate(e),n&&n instanceof Vr&&!n.available&&(i||(i=n),n=null,s===this.args.length))return i;if(n!==null)break}return n}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}serialize(){const e=["coalesce"];return this.eachChild(i=>{e.push(i.serialize())}),e}}const G_=/[^a-zA-Z0-9_]/;class Qo{constructor(e,i){this.type=i.type,this.bindings=[].concat(e),this.result=i}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const i of this.bindings)e(i[1]);e(this.result)}static parse(e,i){if(e.length<4)return i.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const n=[];for(let l=1;l<e.length-1;l+=2){const u=e[l];if(typeof u!="string")return i.error(`Expected string, but found ${typeof u} instead.`,l);if(G_.test(u))return i.error("Variable names must contain only alphanumeric characters or '_'.",l);const f=i.parse(e[l+1],l+1);if(!f)return null;n.push([u,f])}const s=i.parse(e.at(-1),e.length-1,i.expectedType,n);return s?new Qo(n,s):null}outputDefined(){return this.result.outputDefined()}serialize(){const e=["let"];for(const[i,n]of this.bindings)e.push(i,n.serialize());return e.push(this.result.serialize()),e}}class Au{constructor(e,i,n){this.type=e,this.index=i,this.input=n}static parse(e,i){if(e.length!==3)return i.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const n=i.parse(e[1],1,st),s=i.parse(e[2],2,Rr(i.expectedType||ei));return n&&s?new Au(s.type.itemType,n,s):null}evaluate(e){const i=this.index.evaluate(e),n=this.input.evaluate(e);if(i<0)throw new vi("Array index out of bounds: negative index");if(i>=n.length)throw new vi("Array index out of bounds: index exceeds array size");if(i!==Math.floor(i))throw new vi("Array index must be an integer. Use at-interpolated for fractional indices");return n[i]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}class Ft{constructor(e,i,n){this.type=e,this.index=i,this.input=n}static parse(e,i){if(e.length!==3)return i.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const n=i.parse(e[1],1,st),s=i.parse(e[2],2,Rr(i.expectedType||ei));return n&&s?new Ft(s.type.itemType,n,s):null}evaluate(e){const i=this.index.evaluate(e),n=this.input.evaluate(e);if(i<0)throw new vi(`Array index out of bounds: ${i} < 0.`);if(i>n.length-1)throw new vi(`Array index out of bounds: ${i} > ${n.length-1}.`);if(i===Math.floor(i))return n[i];const s=Math.floor(i),l=Math.ceil(i),u=n[s],f=n[l];if(typeof u!="number"||typeof f!="number")throw new vi(`Cannot interpolate between non-number values at index ${i}.`);const p=i-s;return u*(1-p)+f*p}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}serialize(){return["at-interpolated",this.index.serialize(),this.input.serialize()]}}class nd{constructor(e,i){this.type=Ut,this.needle=e,this.haystack=i}static parse(e,i){if(e.length!==3)return i.error(`Expected 2 arguments, but found ${e.length-1} instead.`),null;const n=i.parse(e[1],1,ei),s=i.parse(e[2],2,ei);return n&&s?Uh(n.type,[Ut,Kt,st,Ss,ei])?new nd(n,s):(i.error(`Expected first argument to be of type boolean, string, number or null, but found ${Tt(n.type)} instead`),null):null}evaluate(e){const i=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(n==null)return!1;if(!lc(i,["boolean","string","number","null"]))throw new vi(`Expected first argument to be of type boolean, string, number or null, but found ${Tt(Ji(i))} instead.`);if(!lc(n,["string","array"]))throw new vi(`Expected second argument to be of type array or string, but found ${Tt(Ji(n))} instead.`);return n.includes(i)}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}}class Mu{constructor(e,i,n){this.type=st,this.needle=e,this.haystack=i,this.fromIndex=n}static parse(e,i){if(e.length<=2||e.length>=5)return i.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`),null;const n=i.parse(e[1],1,ei),s=i.parse(e[2],2,ei);if(!n||!s)return null;if(!Uh(n.type,[Ut,Kt,st,Ss,ei]))return i.error(`Expected first argument to be of type boolean, string, number or null, but found ${Tt(n.type)} instead`),null;if(e.length===4){const l=i.parse(e[3],3,st);return l?new Mu(n,s,l):null}return new Mu(n,s)}evaluate(e){const i=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(!lc(i,["boolean","string","number","null"]))throw new vi(`Expected first argument to be of type boolean, string, number or null, but found ${Tt(Ji(i))} instead.`);if(!lc(n,["string","array"]))throw new vi(`Expected second argument to be of type array or string, but found ${Tt(Ji(n))} instead.`);if(this.fromIndex){const s=this.fromIndex.evaluate(e);return n.indexOf(i,s)}return n.indexOf(i)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}serialize(){if(this.fromIndex!=null&&this.fromIndex!==void 0){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 od{constructor(e,i,n,s,l,u){this.inputType=e,this.type=i,this.input=n,this.cases=s,this.outputs=l,this.otherwise=u}static parse(e,i){if(e.length<5)return i.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return i.error("Expected an even number of arguments.");let n,s;i.expectedType&&i.expectedType.kind!=="value"&&(s=i.expectedType);const l={},u=[];for(let g=2;g<e.length-1;g+=2){let x=e[g];const b=e[g+1];Array.isArray(x)||(x=[x]);const w=i.concat(g);if(x.length===0)return w.error("Expected at least one branch label.");for(const E of x){if(typeof E!="number"&&typeof E!="string")return w.error("Branch labels must be numbers or strings.");if(typeof E=="number"&&Math.abs(E)>Number.MAX_SAFE_INTEGER)return w.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof E=="number"&&Math.floor(E)!==E)return w.error("Numeric branch labels must be integer values.");if(n){if(w.checkSubtype(n,Ji(E)))return null}else n=Ji(E);if(l[String(E)]!==void 0)return w.error("Branch labels must be unique.");l[String(E)]=u.length}const S=i.parse(b,g,s);if(!S)return null;s=s||S.type,u.push(S)}const f=i.parse(e[1],1,ei);if(!f)return null;const p=i.parse(e.at(-1),e.length-1,s);return p?f.type.kind!=="value"&&i.concat(1).checkSubtype(n,f.type)?null:new od(n,s,f,l,u,p):null}evaluate(e){const i=this.input.evaluate(e);return(ua(Ji(i),this.inputType)&&this.outputs[this.cases[i]]||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()],i=Object.keys(this.cases).sort(),n=[],s={};for(const u of i){const f=s[this.cases[u]];f===void 0?(s[this.cases[u]]=n.length,n.push([this.cases[u],[u]])):n[f][1].push(u)}const l=u=>this.inputType.kind==="number"?Number(u):u;for(const[u,f]of n)e.push(f.length===1?l(f[0]):f.map(l)),e.push(this.outputs[u].serialize());return e.push(this.otherwise.serialize()),e}}class Cu{constructor(e,i,n){this.type=e,this.branches=i,this.otherwise=n}static parse(e,i){if(e.length<4)return i.error(`Expected at least 3 arguments, but found only ${e.length-1}.`),null;if(e.length%2!=0)return i.error("Expected an odd number of arguments."),null;let n;i.expectedType&&i.expectedType.kind!=="value"&&(n=i.expectedType);const s=[];for(let u=1;u<e.length-1;u+=2){const f=i.parse(e[u],u,Ut);if(!f)return null;const p=i.parse(e[u+1],u+1,n);if(!p)return null;s.push([f,p]),n=n||p.type}const l=i.parse(e.at(-1),e.length-1,n);return l?new Cu(n,s,l):null}evaluate(e){for(const[i,n]of this.branches)if(i.evaluate(e))return n.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(const[i,n]of this.branches)e(i),e(n);e(this.otherwise)}outputDefined(){return this.branches.every(([e,i])=>i.outputDefined())&&this.otherwise.outputDefined()}serialize(){const e=["case"];return this.eachChild(i=>{e.push(i.serialize())}),e}}class Pu{constructor(e,i,n,s){this.type=e,this.input=i,this.beginIndex=n,this.endIndex=s}static parse(e,i){if(e.length<=2||e.length>=5)return i.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`),null;const n=i.parse(e[1],1,ei),s=i.parse(e[2],2,st);if(!n||!s)return null;if(!Uh(n.type,[Rr(ei),Kt,ei]))return i.error(`Expected first argument to be of type array or string, but found ${Tt(n.type)} instead`),null;if(e.length===4){const l=i.parse(e[3],3,st);return l?new Pu(n.type,n,s,l):null}return new Pu(n.type,n,s)}evaluate(e){const i=this.input.evaluate(e),n=this.beginIndex.evaluate(e);if(!lc(i,["string","array"]))throw new vi(`Expected first argument to be of type array or string, but found ${Tt(Ji(i))} instead.`);if(this.endIndex){const s=this.endIndex.evaluate(e);return i.slice(n,s)}return i.slice(n)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}serialize(){if(this.endIndex!=null&&this.endIndex!==void 0){const e=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),e]}return["slice",this.input.serialize(),this.beginIndex.serialize()]}}class xi{constructor(e,i){this.type=Rr(Kt),this.str=e,this.delimiter=i}static parse(e,i){if(e.length!==3)return i.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const n=i.parse(e[1],1,Kt),s=i.parse(e[2],2,Kt);return n&&s?new xi(n,s):void 0}evaluate(e){const i=this.str.evaluate(e),n=this.delimiter.evaluate(e);return i.split(n)}eachChild(e){e(this.str),e(this.delimiter)}outputDefined(){return!1}serialize(){return["split",this.str.serialize(),this.delimiter.serialize()]}}function Ap(r,e){return r==="=="||r==="!="?e.kind==="boolean"||e.kind==="str
1ing"||e.kind==="number"||e.kind==="null"||e.kind==="value":e.kind==="string"||e.kind==="number"||e.kind==="value"}function Mp(r,e,i,n){return n.compare(e,i)===0}function _l(r,e,i){const n=r!=="=="&&r!=="!=";return class Sb{constructor(l,u,f){this.type=Ut,this.lhs=l,this.rhs=u,this.collator=f,this.hasUntypedArgument=l.type.kind==="value"||u.type.kind==="value"}static parse(l,u){if(l.length!==3&&l.length!==4)return u.error("Expected two or three arguments.");const f=l[0];let p=u.parse(l[1],1,ei);if(!p)return null;if(!Ap(f,p.type))return u.concat(1).error(`"${f}" comparisons are not supported for type '${Tt(p.type)}'.`);let g=u.parse(l[2],2,ei);if(!g)return null;if(!Ap(f,g.type))return u.concat(2).error(`"${f}" comparisons are not supported for type '${Tt(g.type)}'.`);if(p.type.kind!==g.type.kind&&p.type.kind!=="value"&&g.type.kind!=="value")return u.error(`Cannot compare types '${Tt(p.type)}' and '${Tt(g.type)}'.`);n&&(p.type.kind==="value"&&g.type.kind!=="value"?p=new oo(g.type,[p]):p.type.kind!=="value"&&g.type.kind==="value"&&(g=ne
vendor: 20,586 bytes, line 1
1w oo(p.type,[g])));let x=null;if(l.length===4){if(p.type.kind!=="string"&&g.type.kind!=="string"&&p.type.kind!=="value"&&g.type.kind!=="value")return u.error("Cannot use collator to compare non-string types.");if(x=u.parse(l[3],3,Is),!x)return null}return new Sb(p,g,x)}evaluate(l){const u=this.lhs.evaluate(l),f=this.rhs.evaluate(l);if(n&&this.hasUntypedArgument){const p=Ji(u),g=Ji(f);if(p.kind!==g.kind||p.kind!=="string"&&p.kind!=="number")throw new vi(`Expected arguments for "${r}" to be (string, string) or (number, number), but found (${p.kind}, ${g.kind}) instead.`)}if(this.collator&&!n&&this.hasUntypedArgument){const p=Ji(u),g=Ji(f);if(p.kind!=="string"||g.kind!=="string")return e(l,u,f)}return this.collator?i(l,u,f,this.collator.evaluate(l)):e(l,u,f)}eachChild(l){l(this.lhs),l(this.rhs),this.collator&&l(this.collator)}outputDefined(){return!0}serialize(){const l=[r];return this.eachChild(u=>{l.push(u.serialize())}),l}}}const $_=_l("==",function(r,e,i){return e===i},Mp),H_=_l("!=",function(r,e,i){return e!==i},function(r,e,i,n){return!Mp(0,e,i,n)}),q_=_l("<",function(r,e,i){return e<i},function(r,e,i,n){return n.compare(e,i)<0}),Z_=_l(">",function(r,e,i){return e>i},function(r,e,i,n){return n.compare(e,i)>0}),W_=_l("<=",function(r,e,i){return e<=i},function(r,e,i,n){return n.compare(e,i)<=0}),X_=_l(">=",function(r,e,i){return e>=i},function(r,e,i,n){return n.compare(e,i)>=0});class sd{constructor(e,i,n,s,l,u){this.type=Kt,this.number=e,this.locale=i,this.currency=n,this.unit=s,this.minFractionDigits=l,this.maxFractionDigits=u}static parse(e,i){if(e.length!==3)return i.error("Expected two arguments.");const n=i.parse(e[1],1,st);if(!n)return null;const s=e[2];if(typeof s!="object"||Array.isArray(s))return i.error("NumberFormat options argument must be an object.");let l=null;if(s.locale&&(l=i.parseObjectValue(s.locale,2,"locale",Kt),!l))return null;let u=null;if(s.currency&&(u=i.parseObjectValue(s.currency,2,"currency",Kt),!u))return null;let f=null;if(s.unit&&(f=i.parseObjectValue(s.unit,2,"unit",Kt),!f))return null;let p=null;if(s["min-fraction-digits"]&&(p=i.parseObjectValue(s["min-fraction-digits"],2,"min-fraction-digits",st),!p))return null;let g=null;return s["max-fraction-digits"]&&(g=i.parseObjectValue(s["max-fraction-digits"],2,"max-fraction-digits",st),!g)?null:new sd(n,l,u,f,p,g)}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 ad{constructor(e){this.type=st,this.input=e}static parse(e,i){if(e.length!==2)return i.error(`Expected 1 argument, but found ${e.length-1} instead.`),null;const n=i.parse(e[1],1);return n?n.type.kind!=="array"&&n.type.kind!=="string"&&n.type.kind!=="value"?(i.error(`Expected argument of type string or array, but found ${Tt(n.type)} instead.`),null):new ad(n):null}evaluate(e){const i=this.input.evaluate(e);if(typeof i=="string"||Array.isArray(i))return i.length;throw new vi(`Expected value to be of type string or array, but found ${Tt(Ji(i))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}serialize(){const e=["length"];return this.eachChild(i=>{e.push(i.serialize())}),e}}function ld(r){return function(){r=1831565813+(r|=0)|0;let e=Math.imul(r^r>>>15,1|r);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296}}const gl={"==":$_,"!=":H_,">":Z_,"<":q_,">=":X_,"<=":W_,array:oo,at:Au,"at-interpolated":Ft,boolean:oo,case:Cu,coalesce:Eu,collator:da,format:al,image:cc,in:nd,"index-of":Mu,interpolate:fn,"interpolate-hcl":fn,"interpolate-lab":fn,length:ad,let:Qo,literal:no,match:od,number:oo,"number-format":sd,object:oo,slice:Pu,step:dl,string:oo,"to-boolean":To,"to-color":To,"to-number":To,"to-string":To,var:wc,within:Io,distance:ga,config:xa,split:xi};function Cp(r,[e,i,n,s]){e=e.evaluate(r),i=i.evaluate(r),n=n.evaluate(r);const l=s?s.evaluate(r):1,u=sp(e,i,n,l);if(u)throw new vi(u);return new qt(e/255,i/255,n/255,l)}function Pp(r,[e,i,n,s]){e=e.evaluate(r),i=i.evaluate(r),n=n.evaluate(r);const l=s?s.evaluate(r):1,u=(function(g,x,b,w){return typeof g=="number"&&g>=0&&g<=360?typeof x=="number"&&x>=0&&x<=100&&typeof b=="number"&&b>=0&&b<=100?w===void 0||typeof w=="number"&&w>=0&&w<=1?null:`Invalid hsla value [${[g,x,b,w].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid hsla value [${(typeof w=="number"?[g,x,b,w]:[g,x,b]).join(", ")}]: 's', and 'l' must be between 0 and 100.`:`Invalid hsla value [${(typeof w=="number"?[g,x,b,w]:[g,x,b]).join(", ")}]: 'h' must be between 0 and 360.`})(e,i,n,l);if(u)throw new vi(u);const f=`hsla(${e}, ${i}%, ${n}%, ${l})`,p=qt.parse(f);if(!p)throw new vi(`Failed to parse HSLA color: ${f}`);return p}function Dp(r,e){return r in e}function cd(r,e){const i=e[r];return i===void 0?null:i}function As(r){return{type:r}}function Du(r){if(r instanceof xa)return new Set([r.key]);let e=new Set;return r.eachChild(i=>{e=new Set([...e,...Du(i)])}),e}function Ru(r){if(r instanceof Zr&&r.name==="is-active-floor")return!0;let e=!1;return r.eachChild(i=>{!e&&Ru(i)&&(e=!0)}),e}function Rp(r){return{result:"success",value:r}}function Ms(r){return{result:"error",value:r}}function ud(r,e){return!!r&&!!r.parameters&&r.parameters.includes(e)}function zu(r){return r["property-type"]==="data-driven"}function zp(r){return ud(r.expression,"measure-light")}function Lp(r){return ud(r.expression,"zoom")}function hd(r){return!!r.expression&&r.expression.interpolated}function dd(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)}function Y_(r){return r}function Op(r,e){const i=e.type==="color",n=r.stops&&typeof r.stops[0][0]=="object",s=n||!(n||r.property!==void 0),l=r.type||(hd(e)?"exponential":"interval");if(i&&((r=Object.assign({},r)).stops&&(r.stops=r.stops.map(g=>[g[0],qt.parse(g[1])])),r.default=qt.parse(r.default?r.default:e.default)),r.colorSpace&&r.colorSpace!=="rgb"&&!id[r.colorSpace])throw new Error(`Unknown color space: ${r.colorSpace}`);let u,f,p;if(l==="exponential")u=pd;else if(l==="interval")u=Lu;else if(l==="categorical"){u=fd,f=Object.create(null);for(const g of r.stops)f[g[0]]=g[1];p=typeof r.stops[0][0]}else{if(l!=="identity")throw new Error(`Unknown function type "${l}"`);u=J_}if(n){const g={},x=[];for(let S=0;S<r.stops.length;S++){const E=r.stops[S],M=E[0].zoom;g[M]===void 0&&(g[M]={zoom:M,type:r.type,property:r.property,default:r.default,stops:[]},x.push(M)),g[M].stops.push([E[0].value,E[1]])}const b=[];for(const S of x)b.push([g[S].zoom,Op(g[S],e)]);const w={name:"linear"};return{kind:"composite",interpolationType:w,interpolationFactor:fn.interpolationFactor.bind(void 0,w),zoomStops:b.map(S=>S[0]),evaluate:({zoom:S},E)=>pd({stops:b,base:r.base},e,S).evaluate(S,E)}}if(s){const g=l==="exponential"?{name:"exponential",base:r.base!==void 0?r.base:1}:null;return{kind:"camera",interpolationType:g,interpolationFactor:fn.interpolationFactor.bind(void 0,g),zoomStops:r.stops.map(x=>x[0]),evaluate:({zoom:x})=>u(r,e,x,f,p)}}return{kind:"source",evaluate(g,x){const b=x&&x.properties?x.properties[r.property]:void 0;return b===void 0?Ec(r.default,e.default):u(r,e,b,f,p)}}}function Ec(r,e,i){return r!==void 0?r:e!==void 0?e:i!==void 0?i:void 0}function fd(r,e,i,n,s){return Ec(typeof i===s?n[i]:void 0,r.default,e.default)}function Lu(r,e,i){if(!uc(i))return Ec(r.default,e.default);const n=r.stops.length;if(n===1||i<=r.stops[0][0])return r.stops[0][1];if(i>=r.stops[n-1][0])return r.stops[n-1][1];const s=Sc(r.stops.map(l=>l[0]),i);return r.stops[s][1]}function pd(r,e,i){const n=r.base!==void 0?r.base:1;if(!uc(i))return Ec(r.default,e.default);const s=r.stops.length;if(s===1||i<=r.stops[0][0])return r.stops[0][1];if(i>=r.stops[s-1][0])return r.stops[s-1][1];const l=Sc(r.stops.map(x=>x[0]),i),u=(function(x,b,w,S){const E=S-w,M=x-w;return E===0?0:b===1?M/E:(Math.pow(b,M)-1)/(Math.pow(b,E)-1)})(i,n,r.stops[l][0],r.stops[l+1][0]),f=r.stops[l][1],p=r.stops[l+1][1];let g=du[e.type]||Y_;if(r.colorSpace&&r.colorSpace!=="rgb"){const x=id[r.colorSpace];g=(b,w)=>x.reverse(x.interpolate(x.forward(b),x.forward(w),u))}return typeof f.evaluate=="function"?{evaluate(...x){const b=f.evaluate.apply(void 0,x),w=p.evaluate.apply(void 0,x);if(b!==void 0&&w!==void 0)return g(b,w,u)}}:g(f,p,u)}function J_(r,e,i){return e.type==="color"?i=qt.parse(i):e.type==="formatted"?i=zr.fromString(i.toString()):e.type==="resolvedImage"?i=Vr.build(i.toString()):mu(i)===e.type||e.type==="enum"&&e.values[i]||(i=void 0),Ec(i,r.default,e.default)}Zr.register(gl,{error:[{kind:"error"},[Kt],(r,[e])=>{throw new vi(e.evaluate(r))}],typeof:[Kt,[ei],(r,[e])=>Tt(Ji(e.evaluate(r)))],"to-rgba":[Rr(st,4),[qr],(r,[e])=>e.evaluate(r).toNonPremultipliedRenderColor(null).toArray()],"to-hsla":[Rr(st,4),[qr],(r,[e])=>e.evaluate(r).toNonPremultipliedRenderColor(null).toHslaArray()],rgb:[qr,[st,st,st],Cp],rgba:[qr,[st,st,st,st],Cp],hsl:[qr,[st,st,st],Pp],hsla:[qr,[st,st,st,st],Pp],has:{type:Ut,overloads:[[[Kt],(r,[e])=>Dp(e.evaluate(r),r.properties())],[[Kt,wo],(r,[e,i])=>Dp(e.evaluate(r),i.evaluate(r))]]},get:{type:ei,overloads:[[[Kt],(r,[e])=>cd(e.evaluate(r),r.properties())],[[Kt,wo],(r,[e,i])=>cd(e.evaluate(r),i.evaluate(r))]]},"feature-state":[ei,[Kt],(r,[e])=>cd(e.evaluate(r),r.featureState||{})],properties:[wo,[],r=>r.properties()],"geometry-type":[Kt,[],r=>r.geometryType()],worldview:[Kt,[],r=>r.globals.worldview||""],"is-active-floor":[Ut,As(Kt),(r,e)=>{if(!(r.globals&&r.globals.activeFloors&&r.globals.activeFloors.size>0))return!1;if(e.length===0)return!0;const i=r.globals.activeFloors;return e.some(n=>{const s=n.evaluate(r);return i.has(s)})}],id:[ei,[],r=>r.id()],zoom:[st,[],r=>r.globals.zoom],pitch:[st,[],r=>r.globals.pitch||0],"distance-from-center":[st,[],r=>r.distanceFromCenter()],"measure-light":[st,[Kt],(r,[e])=>r.measureLight(e.evaluate(r))],"heatmap-density":[st,[],r=>r.globals.heatmapDensity||0],"line-progress":[st,[],r=>r.globals.lineProgress||0],"raster-value":[st,[],r=>r.globals.rasterValue||0],"raster-particle-speed":[st,[],r=>r.globals.rasterParticleSpeed||0],"sky-radial-progress":[st,[],r=>r.globals.skyRadialProgress||0],accumulated:[ei,[],r=>r.globals.accumulated===void 0?null:r.globals.accumulated],"+":[st,As(st),(r,e)=>{let i=0;for(const n of e)i+=n.evaluate(r);return i}],"*":[st,As(st),(r,e)=>{let i=1;for(const n of e)i*=n.evaluate(r);return i}],"-":{type:st,overloads:[[[st,st],(r,[e,i])=>e.evaluate(r)-i.evaluate(r)],[[st],(r,[e])=>-e.evaluate(r)]]},"/":[st,[st,st],(r,[e,i])=>e.evaluate(r)/i.evaluate(r)],"%":[st,[st,st],(r,[e,i])=>e.evaluate(r)%i.evaluate(r)],ln2:[st,[],()=>Math.LN2],pi:[st,[],()=>Math.PI],e:[st,[],()=>Math.E],"^":[st,[st,st],(r,[e,i])=>Math.pow(e.evaluate(r),i.evaluate(r))],sqrt:[st,[st],(r,[e])=>Math.sqrt(e.evaluate(r))],log10:[st,[st],(r,[e])=>Math.log(e.evaluate(r))/Math.LN10],ln:[st,[st],(r,[e])=>Math.log(e.evaluate(r))],log2:[st,[st],(r,[e])=>Math.log2(e.evaluate(r))],sin:[st,[st],(r,[e])=>Math.sin(e.evaluate(r))],cos:[st,[st],(r,[e])=>Math.cos(e.evaluate(r))],tan:[st,[st],(r,[e])=>Math.tan(e.evaluate(r))],asin:[st,[st],(r,[e])=>Math.asin(e.evaluate(r))],acos:[st,[st],(r,[e])=>Math.acos(e.evaluate(r))],atan:[st,[st],(r,[e])=>Math.atan(e.evaluate(r))],min:[st,As(st),(r,e)=>Math.min(...e.map(i=>i.evaluate(r)))],max:[st,As(st),(r,e)=>Math.max(...e.map(i=>i.evaluate(r)))],abs:[st,[st],(r,[e])=>Math.abs(e.evaluate(r))],round:[st,[st],(r,[e])=>{const i=e.evaluate(r);return i<0?-Math.round(-i):Math.round(i)}],floor:[st,[st],(r,[e])=>Math.floor(e.evaluate(r))],ceil:[st,[st],(r,[e])=>Math.ceil(e.evaluate(r))],"filter-==":[Ut,[Kt,ei],(r,[e,i])=>r.properties()[e.value]===i.value],"filter-id-==":[Ut,[ei],(r,[e])=>r.id()===e.value],"filter-type-==":[Ut,[Kt],(r,[e])=>r.geometryType()===e.value],"filter-<":[Ut,[Kt,ei],(r,[e,i])=>{const n=r.properties()[e.value],s=i.value;return typeof n==typeof s&&n<s}],"filter-id-<":[Ut,[ei],(r,[e])=>{const i=r.id(),n=e.value;return typeof i==typeof n&&i<n}],"filter->":[Ut,[Kt,ei],(r,[e,i])=>{const n=r.properties()[e.value],s=i.value;return typeof n==typeof s&&n>s}],"filter-id->":[Ut,[ei],(r,[e])=>{const i=r.id(),n=e.value;return typeof i==typeof n&&i>n}],"filter-<=":[Ut,[Kt,ei],(r,[e,i])=>{const n=r.properties()[e.value],s=i.value;return typeof n==typeof s&&n<=s}],"filter-id-<=":[Ut,[ei],(r,[e])=>{const i=r.id(),n=e.value;return typeof i==typeof n&&i<=n}],"filter->=":[Ut,[Kt,ei],(r,[e,i])=>{const n=r.properties()[e.value],s=i.value;return typeof n==typeof s&&n>=s}],"filter-id->=":[Ut,[ei],(r,[e])=>{const i=r.id(),n=e.value;return typeof i==typeof n&&i>=n}],"filter-has":[Ut,[ei],(r,[e])=>e.value in r.properties()],"filter-has-id":[Ut,[],r=>r.id()!==null&&r.id()!==void 0],"filter-type-in":[Ut,[Rr(Kt)],(r,[e])=>e.value.includes(r.geometryType())],"filter-id-in":[Ut,[Rr(ei)],(r,[e])=>e.value.includes(r.id())],"filter-in-small":[Ut,[Kt,Rr(ei)],(r,[e,i])=>i.value.includes(r.properties()[e.value])],"filter-in-large":[Ut,[Kt,Rr(ei)],(r,[e,i])=>(function(n,s,l,u){for(;l<=u;){const f=l+u>>1;if(s[f]===n)return!0;s[f]>n?u=f-1:l=f+1}return!1})(r.properties()[e.value],i.value,0,i.value.length-1)],all:{type:Ut,overloads:[[[Ut,Ut],(r,[e,i])=>e.evaluate(r)&&i.evaluate(r)],[As(Ut),(r,e)=>{for(const i of e)if(!i.evaluate(r))return!1;return!0}]]},any:{type:Ut,overloads:[[[Ut,Ut],(r,[e,i])=>e.evaluate(r)||i.evaluate(r)],[As(Ut),(r,e)=>{for(const i of e)if(i.evaluate(r))return!0;return!1}]]},"!":[Ut,[Ut],(r,[e])=>!e.evaluate(r)],"is-supported-script":[Ut,[Kt],(r,[e])=>{const i=r.globals&&r.globals.isSupportedScript;return!i||i(e.evaluate(r))}],upcase:[Kt,[Kt],(r,[e])=>e.evaluate(r).toUpperCase()],downcase:[Kt,[Kt],(r,[e])=>e.evaluate(r).toLowerCase()],concat:[Kt,As(ei),(r,e)=>e.map(i=>Bn(i.evaluate(r))).join("")],"resolved-locale":[Kt,[Is],(r,[e])=>e.evaluate(r).resolvedLocale()],random:[st,[st,st,ei],(r,e)=>{const[i,n,s]=e.map(u=>u.evaluate(r));if(i>n||i===n)return i;let l;if(typeof s=="string")l=(function(u){let f=0;if(u.length===0)return f;for(let p=0;p<u.length;p++)f=(f<<5)-f+u.charCodeAt(p),f&=f;return f})(s);else{if(typeof s!="number")throw new vi(`Invalid seed input: ${s}`);l=s}return i+ld(l)()*(n-i)}]});class md{constructor(e,i,n,s,l){this.expression=e,this._warningHistory={},this._scope=n,this._options=s,this._iconImageUseTheme=l,this._evaluator=new Gh(n,s,l),this._defaultValue=i?(function(u){return u.type==="color"&&(dd(u.default)||Array.isArray(u.default))?new qt(0,0,0,0):u.type==="color"?qt.parse(u.default)||null:u.default===void 0?null:u.default})(i):null,this._enumValues=i&&i.type==="enum"?i.values:null,this.configDependencies=Du(e),this.isIndoorDependent=Ru(e)}evaluateWithoutErrorHandling(e,i,n,s,l,u,f,p){return this._evaluator.globals=e,this._evaluator.feature=i,this._evaluator.featureState=n,this._evaluator.canonical=s||null,this._evaluator.availableImages=l||null,this._evaluator.formattedSection=u,this._evaluator.featureTileCoord=f||null,this._evaluator.featureDistanceData=p||null,this.expression.evaluate(this._evaluator)}evaluate(e,i,n,s,l,u,f,p,g){this._evaluator||(this._evaluator=new Gh(this._scope,this._options,this._iconImageUseTheme)),this._evaluator.globals=e,this._evaluator.feature=i||null,this._evaluator.featureState=n||null,this._evaluator.canonical=s||null,this._evaluator.availableImages=l||null,this._evaluator.formattedSection=u||null,this._evaluator.featureTileCoord=f||null,this._evaluator.featureDistanceData=p||null,this._evaluator.iconImageUseTheme=g||null;try{const x=this.expression.evaluate(this._evaluator);if(x==null||typeof x=="number"&&x!=x)return this._defaultValue;if(this._enumValues&&!(x in this._enumValues))throw new vi(`Expected value to be one of ${Object.keys(this._enumValues).map(b=>JSON.stringify(b)).join(", ")}, but found ${JSON.stringify(x)} instead.`);return x}catch(x){const b=x;return this._warningHistory[b.message]||(this._warningHistory[b.message]=!0,typeof console<"u"&&console.warn(`Failed to evaluate expression "${JSON.stringify(this.expression.serialize())}". ${b.message}`)),this._defaultValue}}}function Ou(r){return Array.isArray(r)&&r.length>0&&typeof r[0]=="string"&&r[0]in gl}function Cs(r,e,i,n,s){const l=new dn(gl,[],e?(function(f){const p={color:qr,string:Kt,number:st,enum:Kt,boolean:Ut,formatted:rl,resolvedImage:ac};return f.type==="array"?Rr(p[f.value]||ei,f.length):p[f.type]})(e):void 0,void 0,void 0,i,n,s),u=l.parse(r,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return u?Rp(new md(u,e,i,n,s)):Ms(l.errors)}class Ac{constructor(e,i,n,s){this.kind=e,this._styleExpression=i,this.isLightConstant=n,this.isLineProgressConstant=s,this.isStateDependent=e!=="constant"&&!kn(i.expression),this.configDependencies=Du(i.expression),this.isIndoorDependent=Ru(i.expression)}evaluateWithoutErrorHandling(e,i,n,s,l,u){return this._styleExpression.evaluateWithoutErrorHandling(e,i,n,s,l,u)}evaluate(e,i,n,s,l,u,f){return this._styleExpression.evaluate(e,i,n,s,l,u,void 0,void 0,f)}}class Mo{constructor(e,i,n,s,l,u){this.kind=e,this.zoomStops=n,this._styleExpression=i,this.isStateDependent=e!=="camera"&&!kn(i.expression),this.isIndoorDependent=Ru(i.expression),this.isLightConstant=l,this.isLineProgressConstant=u,this.configDependencies=Du(i.expression),this.interpolationType=s}evaluateWithoutErrorHandling(e,i,n,s,l,u){return this._styleExpression.evaluateWithoutErrorHandling(e,i,n,s,l,u)}evaluate(e,i,n,s,l,u){return this._styleExpression.evaluate(e,i,n,s,l,u)}interpolationFactor(e,i,n){return this.interpolationType?fn.interpolationFactor(this.interpolationType,e,i,n):0}}function _d(r,e,i,n,s){if((r=Cs(r,e,i,n,s)).result==="error")return r;const l=r.value.expression,u=ya(l);if(!u&&!zu(e))return Ms([new ro("","data expressions not supported")]);const f=Ao(l,["zoom","pitch","distance-from-center"]);if(!f&&!Lp(e))return Ms([new ro("","zoom expressions not supported")]);const p=Ao(l,["measure-light"]);if(!p&&!zp(e))return Ms([new ro("","measure-light expression not supported")]);const g=Ao(l,["line-progress"]);if(!g&&!(function(w){return ud(w.expression,"line-progress")})(e))return Ms([new ro("","line-progress expression not supported")]);const x=e.expression&&e.expression.relaxZoomRestriction,b=yl(l);return b||f||x?b instanceof ro?Ms([b]):b instanceof fn&&!hd(e)?Ms([new ro("",'"interpolate" expressions cannot be used with this property')]):Rp(b?new Mo(u&&g?"camera":"composite",r.value,b.labels,b instanceof fn?b.interpolation:void 0,p,g):new Ac(u&&g?"constant":"source",r.value,p,g)):Ms([new ro("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression, or in the properties of atmosphere.')])}class Fu{constructor(e,i){this._parameters=e,this._specification=i,Object.assign(this,Op(this._parameters,this._specification))}static deserialize(e){return new Fu(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function yl(r){let e=null;if(r instanceof Qo)e=yl(r.result);else if(r instanceof Eu){for(const i of r.args)if(e=yl(i),e)break}else(r instanceof dl||r instanceof fn)&&r.input instanceof Zr&&r.input.name==="zoom"&&(e=r);return e instanceof ro||r.eachChild(i=>{const n=yl(i);n instanceof ro?e=n:e&&n&&e!==n&&(e=new ro("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}class ba{constructor(e,i,n){if(this.boxSeen=new Uint32Array(0),this.circleSeen=new Uint32Array(0),this.generation=0,e instanceof ArrayBuffer){const s=new Int32Array(e);this.width=s[0],this.height=s[1],this.xCellCount=s[2],this.yCellCount=s[3],this.boxUid=s[4],this.circleUid=s[5];const l=this.xCellCount*this.yCellCount,u=[];for(let x=0;x<l;x++){const b=s[6+x],w=s[6+x+1];u.push(b===w?null:s.subarray(b,w))}const f=s[6+l],p=[];for(let x=0;x<l;
vendor: 1,040 bytes, line 1
1x++){const b=s[f+x],w=s[f+x+1];p.push(b===w?null:s.subarray(b,w))}let g=s[f+l];this.boxCells=u,this.circleCells=p,this.boxKeys=s.subarray(g,g+this.boxUid),g+=this.boxUid,this.circleKeys=s.subarray(g,g+this.circleUid),g+=this.circleUid,this.bboxes=s.subarray(g,g+4*this.boxUid),g+=4*this.boxUid,this.circles=s.subarray(g,g+3*this.circleUid)}else{this.width=e,this.height=i,this.xCellCount=Math.ceil(e/n),this.yCellCount=Math.ceil(i/n);const s=this.xCellCount*this.yCellCount,l=[],u=[];for(let f=0;f<s;f++)l.push([]),u.push([]);this.boxCells=l,this.circleCells=u,this.boxKeys=[],this.circleKeys=[],this.bboxes=[],this.circles=[],this.boxUid=0,this.circleUid=0}this.xScale=this.xCellCount/this.width,this.yScale=this.yCellCount/this.height}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(e,i,n,s,l){const u=this.boxUid++,f=this._xCell(i),p=this._yCell(n),g=this._xCell(s),x=this._yCell(l);for(let b=f;b<=g;b++)for(let w=p;w<=x;w++)this.boxCells[this.xCellCount*w+b].push(u);this.boxKeys.push(e),this.bboxes.push(i,n,s,l)}
vendor: 19,742 bytes, line 1
1insertCircle(e,i,n,s){const l=this.circleUid++,u=this._xCell(i-s),f=this._yCell(n-s),p=this._xCell(i+s),g=this._yCell(n+s);for(let x=u;x<=p;x++)for(let b=f;b<=g;b++)this.circleCells[this.xCellCount*b+x].push(l);this.circleKeys.push(e),this.circles.push(i,n,s)}query(e,i,n,s,l){const u=[];if(n<0||e>this.width||s<0||i>this.height)return u;const f=this._nextGen(),{boxCells:p,circleCells:g,boxKeys:x,circleKeys:b,bboxes:w,circles:S,boxSeen:E,circleSeen:M,xCellCount:C}=this,R=this._xCell(e),F=this._yCell(i),z=this._xCell(n),j=this._yCell(s);for(let $=R;$<=z;$++)for(let q=F;q<=j;q++){const ie=C*q+$,W=p[ie];if(W)for(let Y=0;Y<W.length;Y++){const ee=W[Y];if(E[ee]===f)continue;E[ee]=f;const me=4*ee,ge=w[me],Te=w[me+1],Ae=w[me+2],Ie=w[me+3];e<=Ae&&i<=Ie&&n>=ge&&s>=Te&&(!l||l(x[ee]))&&u.push({key:x[ee],x1:ge,y1:Te,x2:Ae,y2:Ie})}const Q=g[ie];if(Q)for(let Y=0;Y<Q.length;Y++){const ee=Q[Y];if(M[ee]===f)continue;M[ee]=f;const me=3*ee,ge=S[me],Te=S[me+1],Ae=S[me+2];!this._circleAndRectCollide(ge,Te,Ae,e,i,n,s)||l&&!l(b[ee])||u.push({key:b[ee],x1:ge-Ae,y1:Te-Ae,x2:ge+Ae,y2:Te+Ae})}}return u}queryKeys(e,i,n,s,l){const u=[];if(n<0||e>this.width||s<0||i>this.height)return u;const f=this._nextGen(),{boxCells:p,boxKeys:g,bboxes:x,boxSeen:b,xCellCount:w,xScale:S,yScale:E}=this,M=this._xCell(e),C=this._yCell(i),R=this._xCell(n),F=this._yCell(s);for(let z=M;z<=R;z++)for(let j=C;j<=F;j++){if(l&&!l(z/S,j/E,(z+1)/S,(j+1)/E))continue;const $=p[w*j+z];if($)for(let q=0;q<$.length;q++){const ie=$[q];if(b[ie]===f)continue;b[ie]=f;const W=4*ie,Q=x[W],Y=x[W+1],ee=x[W+2],me=x[W+3];(l?l(Q,Y,ee,me):e<=ee&&i<=me&&n>=Q&&s>=Y)&&u.push(g[ie])}}return u}hitTest(e,i,n,s,l){if(n<0||e>this.width||s<0||i>this.height)return!1;const u=this._nextGen(),{boxCells:f,circleCells:p,boxKeys:g,circleKeys:x,bboxes:b,circles:w,boxSeen:S,circleSeen:E,xCellCount:M}=this,C=this._xCell(e),R=this._yCell(i),F=this._xCell(n),z=this._yCell(s);for(let j=C;j<=F;j++)for(let $=R;$<=z;$++){const q=M*$+j,ie=f[q];if(ie)for(let Q=0;Q<ie.length;Q++){const Y=ie[Q];if(S[Y]===u)continue;S[Y]=u;const ee=4*Y;if(e<=b[ee+2]&&i<=b[ee+3]&&n>=b[ee]&&s>=b[ee+1]&&(!l||l(g[Y])))return!0}const W=p[q];if(W)for(let Q=0;Q<W.length;Q++){const Y=W[Q];if(E[Y]===u)continue;E[Y]=u;const ee=3*Y;if(this._circleAndRectCollide(w[ee],w[ee+1],w[ee+2],e,i,n,s)&&(!l||l(x[Y])))return!0}}return!1}hitTestCircle(e,i,n,s){const l=e-n,u=i-n,f=e+n,p=i+n;if(f<0||l>this.width||p<0||u>this.height)return!1;const g=this._nextGen(),{boxCells:x,circleCells:b,boxKeys:w,circleKeys:S,bboxes:E,circles:M,boxSeen:C,circleSeen:R,xCellCount:F}=this,z=this._xCell(l),j=this._yCell(u),$=this._xCell(f),q=this._yCell(p);for(let ie=z;ie<=$;ie++)for(let W=j;W<=q;W++){const Q=F*W+ie,Y=x[Q];if(Y)for(let me=0;me<Y.length;me++){const ge=Y[me];if(C[ge]===g)continue;C[ge]=g;const Te=4*ge;if(this._circleAndRectCollide(e,i,n,E[Te],E[Te+1],E[Te+2],E[Te+3])&&(!s||s(w[ge])))return!0}const ee=b[Q];if(ee)for(let me=0;me<ee.length;me++){const ge=ee[me];if(R[ge]===g)continue;R[ge]=g;const Te=3*ge;if(this._circlesCollide(M[Te],M[Te+1],M[Te+2],e,i,n)&&(!s||s(S[ge])))return!0}}return!1}static serialize(e,i){const n=e.toArrayBuffer();return i&&i.add(n),{buffer:n}}static deserialize(e){return new ba(e.buffer)}toArrayBuffer(){const e=this.xCellCount*this.yCellCount;let i=0,n=0;for(let f=0;f<e;f++)i+=this.boxCells[f].length,n+=this.circleCells[f].length;const s=new Int32Array(6+(e+1)+i+(e+1)+n+this.boxUid+this.circleUid+4*this.boxUid+3*this.circleUid);s[0]=this.width,s[1]=this.height,s[2]=this.xCellCount,s[3]=this.yCellCount,s[4]=this.boxUid,s[5]=this.circleUid;let l=6+(e+1);for(let f=0;f<e;f++){s[6+f]=l;const p=this.boxCells[f];s.set(p,l),l+=p.length}s[6+e]=l;const u=l;l+=e+1;for(let f=0;f<e;f++){s[u+f]=l;const p=this.circleCells[f];s.set(p,l),l+=p.length}return s[u+e]=l,s.set(this.boxKeys,l),l+=this.boxUid,s.set(this.circleKeys,l),l+=this.circleUid,s.set(this.bboxes,l),l+=4*this.boxUid,s.set(this.circles,l),s.buffer}_xCell(e){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(e*this.xScale)))}_yCell(e){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(e*this.yScale)))}_nextGen(){return this.boxSeen.length<this.boxUid&&(this.boxSeen=new Uint32Array(this.boxUid)),this.circleSeen.length<this.circleUid&&(this.circleSeen=new Uint32Array(this.circleUid)),this.generation=this.generation+1>>>0,this.generation===0&&(this.boxSeen.fill(0),this.circleSeen.fill(0),this.generation=1),this.generation}_circlesCollide(e,i,n,s,l,u){const f=s-e,p=l-i,g=n+u;return g*g>f*f+p*p}_circleAndRectCollide(e,i,n,s,l,u,f){const p=(u-s)/2,g=Math.abs(e-(s+p));if(g>p+n)return!1;const x=(f-l)/2,b=Math.abs(i-(l+x));if(b>x+n)return!1;if(g<=p||b<=x)return!0;const w=g-p,S=b-x;return w*w+S*S<=n*n}}const xl={};function et(r,e,i={}){Object.defineProperty(r,"_classRegistryKey",{value:e,writable:!1}),xl[e]={klass:r,omit:i.omit||[]}}et(Object,"Object"),et(ba,"Grid"),delete Ue.prototype.constructor,et(qt,"Color"),et(Error,"Error"),et(zr,"Formatted"),et(ha,"FormattedSection"),et(Yo,"AJAXError"),et(Vr,"ResolvedImage"),et(Fu,"StylePropertyFunction"),et(md,"StyleExpression",{omit:["_evaluator"]}),et(Dr,"ImageId"),et(Fn,"ImageVariant"),et(Mo,"ZoomDependentExpression"),et(Ac,"ZoomConstantExpression"),et(Zr,"CompoundExpression",{omit:["_evaluate"]});for(const r in gl)xl[gl[r]._classRegistryKey]||et(gl[r],`Expression${r}`);function Fp(r){return r&&(r instanceof ArrayBuffer||r.constructor&&r.constructor.name==="ArrayBuffer")}function es(r,e){if(r===null)return null;const i=typeof r;if(i!=="object")return i==="bigint"?{$name:"BigInt",value:r.toString()}:r;if(Array.isArray(r)){const u=r.length,f=[];f.length=u;for(let p=0;p<u;p++)f[p]=es(r[p],e);return f}if(ArrayBuffer.isView(r))return e&&e.add(r.buffer),r;if(Fp(r)||r instanceof ImageBitmap)return e&&e.add(r),r;if(r instanceof ImageData)return e&&e.add(r.data.buffer),r;if(r instanceof Map){const u={$name:"Map",entries:[]};for(const[f,p]of r.entries())u.entries.push(es(f),es(p,e));return u}if(r instanceof Set){const u={$name:"Set"};let f=0;for(const p of r.values())u[++f]=es(p);return u}if(r instanceof Date||r instanceof RegExp||r instanceof Boolean||r instanceof Number||r instanceof String)return r;const n=r.constructor,s=n._classRegistryKey;if(!s)throw new Error(`Can't serialize object of unregistered class "${n.name}".`);const l=n.serialize?n.serialize(r,e):{};if(!n.serialize){const u=xl[s].omit,f=r;for(const p in f)Object.hasOwn(f,p)&&(u.includes(p)||(l[p]=es(f[p],e)));r instanceof Error&&(l.message=r.message)}if(l.$name)throw new Error("$name property is reserved for worker serialization logic.");return s!=="Object"&&(l.$name=s),l}function ts(r){if(r===null||typeof r!="object")return r;if(Array.isArray(r)){for(let s=0;s<r.length;s++)r[s]=ts(r[s]);return r}if(ArrayBuffer.isView(r)||Fp(r)||r instanceof ImageBitmap||r instanceof ImageData||r instanceof Date||r instanceof RegExp||r instanceof Boolean||r instanceof Number||r instanceof String)return r;const e=r.$name||"Object";if(e==="Map"){const s=r.entries||[],l=new Map;for(let u=0;u<s.length;u+=2)l.set(ts(s[u]),ts(s[u+1]));return l}if(e==="Set"){const s=new Set;for(const l in r)l!=="$name"&&s.add(ts(r[l]));return s}if(e==="BigInt")return BigInt(r.value);const{klass:i}=xl[e];if(!i)throw new Error(`Can't deserialize unregistered class "${e}".`);if(i.deserialize)return i.deserialize(r);const n=Object.create(i.prototype);for(const s in r)s!=="$name"&&(n[s]=ts(r[s]));return n}const Bp=r=>r>=1536&&r<=1791,kp=r=>r>=1872&&r<=1919,Np=r=>r>=2208&&r<=2303,gd=r=>r>=11904&&r<=12031,yd=r=>r>=12032&&r<=12255,Mc=r=>r>=12272&&r<=12287,Bu=r=>r>=12288&&r<=12351,ku=r=>r>=12352&&r<=12447,Nu=r=>r>=12448&&r<=12543,Up=r=>r>=12544&&r<=12591,xd=r=>r>=12704&&r<=12735,vd=r=>r>=12736&&r<=12783,Vp=r=>r>=12784&&r<=12799,jp=r=>r>=12800&&r<=13055,Gp=r=>r>=13056&&r<=13311,bd=r=>r>=13312&&r<=19903,vl=r=>r>=19968&&r<=40959,$p=r=>r>=40960&&r<=42127,Hp=r=>r>=42128&&r<=42191,qp=r=>r>=44032&&r<=55215,Uu=r=>r>=63744&&r<=64255,wd=r=>r>=64336&&r<=65023,Zp=r=>r>=65040&&r<=65055,Vu=r=>r>=65072&&r<=65103,Td=r=>r>=65104&&r<=65135,Sd=r=>r>=65136&&r<=65279,ju=r=>r>=65280&&r<=65519;function Id(r){for(const e of r)if(Gu(e.charCodeAt(0)))return!0;return!1}function Wp(r){for(const e of r)if(!Xp(e.charCodeAt(0)))return!1;return!0}function Xp(r){return!(Bp(r)||kp(r)||Np(r)||wd(r)||Sd(r))}function Yp(r){return!(r<11904||!(xd(r)||Up(r)||Vu(r)||Uu(r)||Gp(r)||gd(r)||vd(r)||Bu(r)||bd(r)||vl(r)||jp(r)||ju(r)||ku(r)||Mc(r)||yd(r)||Vp(r)||Nu(r)||Zp(r)||Hp(r)||$p(r)))}function Gu(r){return!(r!==746&&r!==747&&(r<4352||!(xd(r)||Up(r)||Vu(r)&&!(r>=65097&&r<=65103)||Uu(r)||Gp(r)||gd(r)||vd(r)||!(!Bu(r)||r>=12296&&r<=12305||r>=12308&&r<=12319||r===12336)||bd(r)||vl(r)||jp(r)||(e=>e>=12592&&e<=12687)(r)||(e=>e>=43360&&e<=43391)(r)||(e=>e>=55216&&e<=55295)(r)||(e=>e>=4352&&e<=4607)(r)||qp(r)||ku(r)||Mc(r)||(e=>e>=12688&&e<=12703)(r)||yd(r)||Vp(r)||Nu(r)&&r!==12540||!(!ju(r)||r===65288||r===65289||r===65293||r>=65306&&r<=65310||r===65339||r===65341||r===65343||r>=65371&&r<=65503||r===65507||r>=65512&&r<=65519)||!(!Td(r)||r>=65112&&r<=65118||r>=65123&&r<=65126)||(e=>e>=5120&&e<=5759)(r)||(e=>e>=6320&&e<=6399)(r)||Zp(r)||(e=>e>=19904&&e<=19967)(r)||$p(r)||Hp(r))))}function Ed(r){return r===12312||r===12313||r===12316||r===12540||r===12448}function $u(r){return!(Gu(r)||(function(e){return!!((i=>i>=128&&i<=255)(e)&&(e===167||e===169||e===174||e===177||e===188||e===189||e===190||e===215||e===247)||(i=>i>=8192&&i<=8303)(e)&&(e===8214||e===8224||e===8225||e===8240||e===8241||e===8251||e===8252||e===8258||e===8263||e===8264||e===8265||e===8273)||(i=>i>=8448&&i<=8527)(e)||(i=>i>=8528&&i<=8591)(e)||(i=>i>=8960&&i<=9215)(e)&&(e>=8960&&e<=8967||e>=8972&&e<=8991||e>=8996&&e<=9e3||e===9003||e>=9085&&e<=9114||e>=9150&&e<=9165||e===9167||e>=9169&&e<=9179||e>=9186&&e<=9215)||(i=>i>=9216&&i<=9279)(e)&&e!==9251||(i=>i>=9280&&i<=9311)(e)||(i=>i>=9312&&i<=9471)(e)||(i=>i>=9632&&i<=9727)(e)||(i=>i>=9728&&i<=9983)(e)&&!(e>=9754&&e<=9759)||(i=>i>=11008&&i<=11263)(e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||Bu(e)||Nu(e)||(i=>i>=57344&&i<=63743)(e)||Vu(e)||Td(e)||ju(e)||e===8734||e===8756||e===8757||e>=9984&&e<=10087||e>=10102&&e<=10131||e===65532||e===65533)})(r))}function Jp(r){return Bp(r)||kp(r)||Np(r)||wd(r)||Sd(r)}function Kp(r){return r>=1424&&r<=2303||wd(r)||Sd(r)}function Ps(r,e){return!(!e&&Kp(r)||r>=2304&&r<=3583||r>=3840&&r<=4255||(i=>i>=6016&&i<=6143)(r))}function K_(r){for(const e of r)if(Kp(e.charCodeAt(0)))return!0;return!1}const pn={unavailable:"unavailable",deferred:"deferred",loading:"loading",parsing:"parsing",parsed:"parsed",loaded:"loaded",error:"error"};let Ds=null,Wr=pn.unavailable,so=null;const Ad=function(r){r&&(Wr=pn.error),Ds&&Ds(r)};function bl(){Hu.fire(new io("pluginStateChange",{pluginStatus:Wr,pluginURL:so}))}const Hu=new tl,Md=function(){return Wr},Qp=function(){if(Wr!==pn.deferred||!so)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");Wr=pn.loading,bl(),so&&Ja({url:so},r=>{r?Ad(r):(Wr=pn.loaded,bl())})},ao={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>Wr===pn.loaded||ao.applyArabicShaping!=null,isLoading:()=>Wr===pn.loading,setState(r){Wr=r.pluginStatus,so=r.pluginURL},isParsing:()=>Wr===pn.parsing,isParsed:()=>Wr===pn.parsed,getPluginURL:()=>so},Cd=function(){ao.isLoading()||ao.isLoaded()||Md()!=="deferred"||Qp()};class Wt{constructor(e,i){this.zoom=e,i?(this.now=i.now,this.fadeDuration=i.fadeDuration,this.transition=i.transition,this.pitch=i.pitch,this.brightness=i.brightness,this.worldview=i.worldview,this.activeFloors=i.activeFloors):(this.now=0,this.fadeDuration=0,this.transition={},this.pitch=0,this.brightness=0)}isSupportedScript(e){return(function(i,n){for(const s of i)if(!Ps(s.charCodeAt(0),n))return!1;return!0})(e,ao.isLoaded())}}class Cc{constructor(e,i,n,s,l){this.property=e,this.value=i,this.expression=(function(u,f,p,g,x){if(dd(u))return new Fu(u,f);if(Ou(u)||Array.isArray(u)&&u.length>0){const b=_d(u,f,p,g,x);if(b.result==="error")throw new Error(b.value.map(w=>`${w.key}: ${w.message}`).join(", "));return b.value}{let b=u;return typeof u=="string"&&f.type==="color"&&(b=qt.parse(u)),{kind:"constant",configDependencies:new Set,isIndoorDependent:!1,evaluate:()=>b}}})(i===void 0?e.specification.default:i,e.specification,n,s,l)}isIndoorDependent(){return this.expression.isIndoorDependent}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(e,i,n,s){return this.property.possiblyEvaluate(this,e,i,n,s)}}class Pd{constructor(e,i,n,s){this.property=e,this.value=new Cc(e,void 0,i,n,s)}transitioned(e,i){return new Dc(this.property,this.value,i,Object.assign({},e.transition,this.transition),e.now)}untransitioned(){return new Dc(this.property,this.value,null,{},0)}}class Pc{constructor(e,i,n,s){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues),this._scope=i,this._options=n,this._iconImageUseTheme=s,this._isIndoorDependent=!1,this.configDependencies=new Set}getValue(e){return Jt(this._values[e].value.value)}setValue(e,i){Object.hasOwn(this._values,e)||(this._values[e]=new Pd(this._values[e].property,this._scope,this._options,this._iconImageUseTheme)),this._values[e].value=new Cc(this._values[e].property,i===null?void 0:Jt(i),this._scope,this._options,this._iconImageUseTheme),this._values[e].value.expression.configDependencies&&(this.configDependencies=new Set([...this.configDependencies,...this._values[e].value.expression.configDependencies]),this._isIndoorDependent=this._isIndoorDependent||this._values[e].value.isIndoorDependent())}setTransitionOrValue(e,i){i&&(this._options=i);const n=this._properties.properties;if(e)for(const s in e){const l=e[s];if(s.endsWith("-transition")){const u=s.slice(0,-11);n[u]&&this.setTransition(u,l)}else Object.hasOwn(n,s)&&this.setValue(s,l)}}getTransition(e){return Jt(this._values[e].transition)}setTransition(e,i){Object.hasOwn(this._values,e)||(this._values[e]=new Pd(this._values[e].property)),this._values[e].transition=Jt(i)||void 0}serialize(){const e={};for(const i of Object.keys(this._values)){const n=this.getValue(i);n!==void 0&&(e[i]=n);const s=this.getTransition(i);s!==void 0&&(e[`${i}-transition`]=s)}return e}transitioned(e,i){const n=new qu(this._properties);for(const s of Object.keys(this._values))n._values[s]=this._values[s].transitioned(e,i._values[s]);return n}untransitioned(){const e=new qu(this._properties);for(const i of Object.keys(this._values))e._values[i]=this._values[i].untransitioned();return e}isIndoorDependent(){return this._isIndoorDependent}}class Dc{constructor(e,i,n,s,l){const u=s.delay||0,f=s.duration||0;l=l||0,this.property=e,this.value=i,this.begin=l+u,this.end=this.begin+f,e.specification.transition&&(s.delay||s.duration)&&(this.prior=n)}possiblyEvaluate(e,i,n){const s=e.now||0,l=this.value.possiblyEvaluate(e,i,n),u=this.prior;if(u){if(s>this.end)return this.prior=null,l;if(this.value.isDataDriven())return this.prior=null,l;if(s<this.begin)return u.possiblyEvaluate(e,i,n);{const f=(s-this.begin)/(this.end-this.begin);return this.property.interpolate(u.possiblyEvaluate(e,i,n),l,le(f))}}return l}}class qu{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,i,n){const s=new is(this._properties);for(const l of Object.keys(this._values))s._values[l]=this._values[l].possiblyEvaluate(e,i,n);return s}hasTransition(){for(const e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class Zu{constructor(e,i,n,s){this._properties=e,this._values=Object.create(e.defaultPropertyValues),this._scope=i,this._options=n,this._iconImageUseTheme=s,this._isIndoorDependent=!1,this.configDependencies=new Set}getValue(e){return Jt(this._values[e].value)}setValue(e,i){this._values[e]=new Cc(this._values[e].property,i===null?void 0:Jt(i),this._scope,this._options,this._iconImageUseTheme),this._values[e].expression.configDependencies&&(this.configDependencies=new Set([...this.configDependencies,...this._values[e].expression.configDependencies]),this._isIndoorDependent=this._isIndoorDependent||this._values[e].isIndoorDependent())}serialize(){const e={};for(const i of Object.keys(this._values)){const n=this.getValue(i);n!==void 0&&(e[i]=n)}return e}possiblyEvaluate(e,i,n,s){const l=new is(this._properties);for(const u of Object.keys(this._values))l._values[u]=this._values[u].possiblyEvaluate(e,i,n,s);return l}isIndoorDependent(){return this._isIndoorDependent}}class Rs{constructor(e,i,n,s){this.property=e,this.value=i,this.parameters=n,this.iconImageUseTheme=s}isConstant(){return this.value.kind==="constant"}constantOr(e){return this.value.kind==="constant"?this.value.value:e}evaluate(e,i,n,s,l){return this.property.evaluate(this.value,this.parameters,e,i,n,s,this.iconImageUseTheme,l)}}class is{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class He{constructor(e){this.specification=e}possiblyEvaluate(e,i){return e.expression.evaluate(i)}interpolate(e,i,n){const s=du[this.specification.type];return s?s(e,i,n):e}}class Ze{constructor(e,i){this.specification=e,this.overrides=i}possiblyEvaluate(e,i,n,s,l){return e.expression.kind==="constant"||e.expression.kind==="camera"?new Rs(this,{kind:"constant",value:e.expression.evaluate(i,null,{},n,s,void 0,l)},i):new Rs(this,e.expression,i,l)}interpolate(e,i,n){if(e.value.kind!=="constant"||i.value.kind!=="constant")return e;if(e.value.value===void 0||i.value.value===void 0)return new Rs(this,{kind:"constant",value:void 0},e.parameters);const s=du[this.specification.type];return s?new Rs(this,{kind:"constant",value:s(e.value.value,i.value.value,n)},e.parameters):e}evaluate(e,i,n,s,l,u,f,p){return e.kind==="constant"?e.value:e.evaluate(i,n,s,l,u,p,f)}}class zs{constructor(e){this.specification=e}possiblyEvaluate(e,i,n,s){return!!e.expression.evaluate(i,null,{},n,s)}interpolate(){return!1}}class bi{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];const i=new Wt(0,{});for(const n in e){const s=e[n],l=s.specification;l&&l.overridable&&this.overridableProperties.push(n);const u=this.defaultPropertyValues[n]=new Cc(s,void 0),f=this.defaultTransitionablePropertyValues[n]=new Pd(s);this.defaultTransitioningPropertyValues[n]=f.untransitioned(),this.defaultPossiblyEvaluatedValues[n]=u.possiblyEvaluate(i)}}}et(Ze,"DataDrivenProperty"),et(He,"DataConstantProperty"),et(zs,"ColorRampProperty");var he=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"}}
1,"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}
1,"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"}
1,"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","meas
1ure-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"}
1,"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"]}},"line-blend-additive-clamp":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":true,"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":"n
1umber","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 Dd(r){return r instanceof Number||r instanceof String||r instanceof Boolean?r.valueOf():r}function wl(r){if(Array.isArray(r))return r.map(wl);if(r instanceof Object&&!(r instanceof Number||r instanceof String||r instanceof Boolean)){const e={};for(const i in r)e[i]=wl(r[i]);return e}return Dd(r)}function lo(r){if(r===!0||r===!1)return!0;if(!Array.isArray(r)||r.length===0)return!1;switch(r[0]){case"has":return r.length>=2&&r[1]!=="$id"&&r[1]!=="$type";case"in":return r.length>=3&&(typeof r[1]!="string"||Array.isArray(r[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return r.length!==3||Array.isArray(r[1])||Array.isArray(r[2]);case"any":case"all":for(const e of r.slice(1))if(!lo(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}function Wu(r,e="",i=null,n="fill"){if(r==null)return{filter:()=>!0,needGeometry:!1,needFeature:!1};lo(r)||(r=Xu(r));const s=r;let l=!0;try{l=(function(x){if(!Tl(x))return x;let b=wl(x);return tm(b),b=em(b),b})(s)}catch{console.warn(`Failed to extract static filter. Filter will continue working, but at higher memory usage and slower framerate. 2This is most likely a bug, please report this via https://github.com/mapbox/mapbox-gl-js/issues/new?assignees=&labels=&template=Bug_report.md 3and paste the contents of this message in the report. 4Thank you! 5Filter Expression: 6${JSON.stringify(s,null,2)} 7 `)}let u=null,f=null;if(n!=="background"&&n!=="sky"&&n!=="slot"){f=he[`filter_${n}`];const x=Cs(l,f,e,i);if(x.result==="error")throw new Error(x.value.map(b=>`${b.key}: ${b.message}`).join(", "));u=(b,w,S)=>x.value.evaluate(b,w,{},S)}let p=null,g=null;if(l!==s){const x=Cs(s,f,e,i);if(x.result==="error")throw new Error(x.value.map(b=>`${b.key}: ${b.message}`).join(", "));p=(b,w,S,E,M)=>x.value.evaluate(b,w,{},S,void 0,void 0,E,M),g=!ya(x.value.expression)}return{filter:u,dynamicFilter:p||void 0,needGeometry:rm(l),needFeature:!!g}}function em(r){if(!Array.isArray(r))return r;const e=(function(i){if(im.has(i[0])){for(let n=1;n<i.length;n++)if(Tl(i[n]))return!0}return i})(r);return e===!0?e:e.map(i=>em(i))}function tm(r){let e=!1;const i=[];if(r[0]==="case"){for(let n=1;n<r.length-1;n+=2)e=e||Tl(r[n]),i.push(r[n+1]);i.push(r.at(-1))}else if(r[0]==="match"){e=e||Tl(r[1]);for(let n=2;n<r.length-1;n+=2)i.push(r[n+1]);i.push(r.at(-1))}else if(r[0]==="step"){e=e||Tl(r[1]);for(let n=1;n<r.length-1;n+=2)i.push(r[n+1])}e&&(r.length=0,r.push("any",...i));for(let n=1;n<r.length;n++)tm(r[n])}function Tl(r){if(!Array.isArray(r))return!1;if((e=r[0])==="pitch"||e==="distance-from-center")return!0;var e;
vendor: 4,106 bytes, line 7
7for(let i=1;i<r.length;i++)if(Tl(r[i]))return!0;return!1}const im=new Set(["in","==","!=",">",">=","<","<=","to-boolean"]);function Q_(r,e){return r<e?-1:r>e?1:0}function rm(r){if(!Array.isArray(r))return!1;if(r[0]==="within"||r[0]==="distance")return!0;for(let e=1;e<r.length;e++)if(rm(r[e]))return!0;return!1}function Xu(r){if(!r)return!0;const e=r[0];return r.length<=1?e!=="any":e==="=="?Yu(r[1],r[2],"=="):e==="!="?zc(Yu(r[1],r[2],"==")):e==="<"||e===">"||e==="<="||e===">="?Yu(r[1],r[2],e):e==="any"?(i=r.slice(1),["any"].concat(i.map(Xu))):e==="all"?["all"].concat(r.slice(1).map(Xu)):e==="none"?["all"].concat(r.slice(1).map(Xu).map(zc)):e==="in"?wa(r[1],r.slice(2)):e==="!in"?zc(wa(r[1],r.slice(2))):e==="has"?Rc(r[1]):e!=="!has"||zc(Rc(r[1]));var i}function Yu(r,e,i){switch(r){case"$type":return[`filter-type-${i}`,e];case"$id":return[`filter-id-${i}`,e];default:return[`filter-${i}`,r,e]}}function wa(r,e){if(e.length===0)return!1;switch(r){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(i=>typeof i!=typeof e[0])?["filter-in-large",r,["literal",e.sort(Q_)]]:["filter-in-small",r,["literal",e]]}}function Rc(r){switch(r){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",r]}}function zc(r){return["!",r]}const Co="�";function Rd(r,e){return e?`${r}${Co}${e}`:r}function nm(r){const e=r.indexOf(Co);return e>=0?r.slice(e+1):""}let om;const sm=()=>om||(om=new bi({"icon-size":new Ze(he.layout_symbol["icon-size"]),"icon-image":new Ze(he.layout_symbol["icon-image"]),"icon-rotate":new Ze(he.layout_symbol["icon-rotate"]),"icon-offset":new Ze(he.layout_symbol["icon-offset"]),"text-size":new Ze(he.layout_symbol["text-size"]),"text-rotate":new Ze(he.layout_symbol["text-rotate"]),"text-offset":new Ze(he.layout_symbol["text-offset"])}));let am;const lm=()=>am||(am=new bi({"icon-opacity":new Ze(he.paint_symbol["icon-opacity"]),"icon-occlusion-opacity":new Ze(he.paint_symbol["icon-occlusion-opacity"]),"icon-emissive-strength":new Ze(he.paint_symbol["icon-emissive-strength"]),"text-emissive-strength":new Ze(he.paint_symbol["text-emissive-strength"]),"icon-color":new Ze(he.paint_symbol["icon-color"]),"icon-halo-color":new Ze(he.paint_symbol["icon-halo-color"]),"icon-halo-width":new Ze(he.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Ze(he.paint_symbol["icon-halo-blur"]),"icon-translate":new Ze(he.paint_symbol["icon-translate"]),"text-opacity":new Ze(he.paint_symbol["text-opacity"]),"text-occlusion-opacity":new Ze(he.paint_symbol["text-occlusion-opacity"]),"text-color":new Ze(he.paint_symbol["text-color"],{runtimeType:qr,getOverride:r=>r.textColor,hasOverride:r=>!!r.textColor}),"text-halo-color":new Ze(he.paint_symbol["text-halo-color"]),"text-halo-width":new Ze(he.paint_symbol["text-halo-width"]),"text-halo-blur":new Ze(he.paint_symbol["text-halo-blur"]),"text-translate":new Ze(he.paint_symbol["text-translate"]),"symbol-z-offset":new Ze(he.paint_symbol["symbol-z-offset"]),"icon-color-use-theme":new Ze({type:"string",default:"default","property-type":"data-driven"}),"icon-halo-color-use-theme":new Ze({type:"string",default:"default","property-type":"data-driven"}),"text-color-use-theme":new Ze({type:"string",default:"default","property-type":"data-driven"}),"text-halo-color-use-theme":new Ze({type:"string",default:"default","property-type":"data-driven"})}));class eg{constructor(e,i,n,s,l,u){this._conditionSpec=e,this._propertiesSpec=n;const f=Cs(e,he.appearance.condition);if(f.result==="success"&&(this.condition=f.value),this.name=i,n){this.layoutProperties=new is(sm()),this.unevaluatedLayout=new Zu(sm(),s,l,u),this.paintProperties=new is(lm()),this.unevaluatedPaint=new Zu(lm(),s,l,"");for(const p in n)p in this.unevaluatedLayout._values?this.unevaluatedLayout.setValue(p,n[p]):p in this.unevaluatedPaint._values&&this.unevaluatedPaint.setValue(p,n[p])}}isActive(e){return!(this.condition||!e.isHidden||this.name!=="hidden")||this.condition.evaluate(e.globals,e.feature,e.featureState,e.canonical)}getCondition(){return this.condition}
7getName(){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,i,n){this.unevaluatedLayout&&(this.layoutProperties=this.unevaluatedLayout.possiblyEvaluate(e,void 0,i,n)),this.unevaluatedPaint&&(this.paintProperties=this.unevaluatedPaint.possiblyEvaluate(e,void 0,i,""))}serialize(){const e={};e.condition=this.condition.expression.serialize(),this.name&&(e.name=this.name);const i=this.unevaluatedLayout?this.unevaluatedLayout.serialize():{},n=this.unevaluatedPaint?this.unevaluatedPaint.serialize():{},s=Object.assign({},i,n);return Object.keys(s).length>0&&(e.properties=s),e}hasIconLayoutProperties(){const e=this.hasLayoutProperty("icon-image"),i=this.hasLayoutProperty("icon-size"),n=this.hasLayoutProperty("icon-offset"),s=this.hasLayoutProperty("icon-rotate");return e||i||n||s}hasTextLayoutProperties(){const e=this.hasLayoutProperty("text-size"),i=this.hasLayoutProperty("text-offset"),n=this.hasLayoutProperty("text-rotate");return e||i||n}hasIconPaintProperties(){return!!this.unevaluatedPaint&&Object.keys(this.unevaluatedPaint._values).filter(e=>!e.endsWith("-use-theme")).some(e=>(e.startsWith("icon-")||e==="symbol-z-offset")&&this.hasPaintProperty(e))}hasTextPaintProperties(){return!!this.unevaluatedPaint&&Object.keys(this.unevaluatedPaint._values).filter(e=>!e.endsWith("-use-theme")).some(e=>(e.startsWith("text-")||e==="symbol-z-offset")&&this.hasPaintProperty(e))}hasLayoutProperty(e){return this.unevaluatedLayout&&this.unevaluatedLayout._values[e].value!==void 0}hasPaintProperty(e){return this.unevaluatedPaint&&this.unevaluatedPaint._values[e].value!==void 0}}const zd="-transition",tg=new Set(["fill","line","background","hillshade","raster"]);class Xr extends tl{constructor(e,i,n,s,l,u){if(super(),this.id=e.id,this.fqid=Rd(this.id,n),this.type=e.type,this.scope=n,this.lut=s,this.options=l,this.iconImageUseTheme=u,this.appearances=new Array,this.appearancesVersion=0,this._featureFilter={filter:()=>!0,needGeometry:!1,needFeature:!1},this._filterCompiled=!1,this.expressionDependencies={isIndoorDependent:!1,configDependencies:new Set},e.type!=="custom"){if(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,e.type&&e.type!=="background"&&e.type!=="sky"&&e.type!=="slot"){this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter;const f=Cs(this.filter,he[`filter_${e.type}`]);f.result!=="error"&&(this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...f.value.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||f.value.isIndoorDependent)}if(e.slot&&(this.slot=e.slot),e.appearances&&this.setAppearances(e.appearances),i.layout&&(this._unevaluatedLayout=new Zu(i.layout,this.scope,l,this.iconImageUseTheme),this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...this._unevaluatedLayout.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||this._unevaluatedLayout.isIndoorDependent()),i.paint){this._transitionablePaint=new Pc(i.paint,this.scope,l);for(const f in e.paint)this.setPaintProperty(f,e.paint[f]);for(const f in e.layout)this.setLayoutProperty(f,e.layout[f]);this.expressionDependencies.configDependencies=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 is(i.paint)}}}onAdd(e){}onRemove(e){}isDraped(e){return!this.is3D(!0)&&tg.has(this.type)}getLayoutProperty(e){return e==="visibility"?this.visibility:this._unevaluatedLayout.getValue(e)}
vendor: 18,780 bytes, line 7
7setLayoutProperty(e,i){if(this.type==="custom"&&e==="visibility")return void(this.visibility=i);const n=this._unevaluatedLayout;n._properties.properties[e]&&(n.setValue(e,i),this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...n.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||n.isIndoorDependent(),e==="visibility"&&this.possiblyEvaluateVisibility())}setAppearances(e){this.appearances=[],e.forEach(i=>{this.appearances.push(new eg(i.condition,i.name,i.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(zd)?this._transitionablePaint.getTransition(e.slice(0,-11)):this._transitionablePaint.getValue(e)}isPaintProperty(e){return!!this._transitionablePaint._properties.properties[e]}setPaintProperty(e,i){const n=this._transitionablePaint,s=n._properties.properties;if(e.endsWith(zd)){const b=e.slice(0,-11);return s[b]&&n.setTransition(b,i||void 0),!1}if(!s[e])return!1;const l=n._values[e],u=l.value.isDataDriven(),f=l.value;n.setValue(e,i),this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...n.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||n.isIndoorDependent(),this._handleSpecialPaintPropertyUpdate(e);const p=n._values[e].value,g=p.isDataDriven(),x=e.endsWith("pattern")||e==="line-dasharray";return g||u||x||this._handleOverridablePaintPropertyUpdate(e,f,p)}_handleSpecialPaintPropertyUpdate(e){}getProgramIds(){return null}getDefaultProgramParams(e,i,n){return null}_handleOverridablePaintPropertyUpdate(e,i,n){return!1}isHidden(e){return!!(this.minzoom&&e<this.minzoom)||!!(this.maxzoom&&e>=this.maxzoom)||this.visibility==="none"}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,i){this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,i,this.iconImageUseTheme)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,i)}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 this.appearances.length!==0&&(e.appearances=this.appearances.map(i=>i.serialize())),Ct(e,(i,n)=>!(i===void 0||n==="layout"&&!Object.keys(i).length||n==="paint"&&!Object.keys(i).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 i=this.paint.get(e);if(i instanceof Rs&&zu(i.property.specification)&&(i.value.kind==="source"||i.value.kind==="composite")&&i.value.isStateDependent)return!0}for(const e of this.appearances)if(!kn(e.condition.expression))return!0;return!1}compileFilter(e){this._filterCompiled||(this._featureFilter=Wu(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&&(e.renderPass==="shadow"?this._stats.numRenderedVerticesInShadowPass=0:this._stats.numRenderedVerticesInTransparentPass=0)}getAppearances(){return this.appearances}queryRenderedFeatures(e,i,n){return{}}queryRadius(e){}queryIntersectsFeature(e,i,n,s,l,u,f,p,g,x){}}const ig={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Lc{constructor(e,i){this._structArray=e,this._pos1=i*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}const rg=new ArrayBuffer(0);class pi{constructor(){this._reallocCount=0,this.capacity=0,this.length=0}static serialize(e,i){return e._trim(),i&&e.arrayBuffer&&i.add(e.arrayBuffer),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){const i=Object.create(this.prototype);return i.arrayBuffer=e.arrayBuffer,i.length=e.length,e.arrayBuffer?i.capacity=e.arrayBuffer.byteLength/i.bytesPerElement:(i.capacity=0,i.arrayBuffer=rg),i._refreshViews(),i}_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 i=this.uint8;this._refreshViews(),i&&this.uint8.set(i)}}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 Rt(r,e=1){let i=0,n=0;return{members:r.map(s=>{const l=ig[s.type].BYTES_PER_ELEMENT,u=i=rs(i,Math.max(e,l)),f=s.components||1;return n=Math.max(n,l),i+=l*f,{name:s.name,type:s.type,components:f,offset:u}}),size:rs(i,Math.max(n,e)),alignment:e}}function rs(r,e){return Math.ceil(r/e)*e}class Nn extends pi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i){const n=this.length;return this.resize(n+1),this.emplace(n,e,i)}emplace(e,i,n){const s=2*e;return this.int16[s+0]=i,this.int16[s+1]=n,e}}Nn.prototype.bytesPerElement=4,et(Nn,"StructArrayLayout2i4");class Ta extends pi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,n){const s=this.length;return this.resize(s+1),this.emplace(s,e,i,n)}emplace(e,i,n,s){const l=3*e;return this.int16[l+0]=i,this.int16[l+1]=n,this.int16[l+2]=s,e}}Ta.prototype.bytesPerElement=6,et(Ta,"StructArrayLayout3i6");class Sa extends pi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,n,s){const l=this.length;return this.resize(l+1),this.emplace(l,e,i,n,s)}emplace(e,i,n,s,l){const u=4*e;return this.int16[u+0]=i,this.int16[u+1]=n,this.uint16[u+2]=s,this.uint16[u+3]=l,e}}Sa.prototype.bytesPerElement=8,et(Sa,"StructArrayLayout2i2ui8");class Sr extends pi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.float32[1*e+0]=i,e}}Sr.prototype.bytesPerElement=4,et(Sr,"StructArrayLayout1f4");class Ju extends pi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n){const s=this.length;return this.resize(s+1),this.emplace(s,e,i,n)}emplace(e,i,n,s){const l=4*e,u=2*e;return this.int16[l+0]=i,this.int16[l+1]=n,this.float32[u+1]=s,e}}Ju.prototype.bytesPerElement=8,et(Ju,"StructArrayLayout2i1f8");class Oc extends pi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,n){const s=this.length;return this.resize(s+1),this.emplace(s,e,i,n)}emplace(e,i,n,s){const l=4*e;return this.int16[l+0]=i,this.int16[l+1]=n,this.int16[l+2]=s,e}}Oc.prototype.bytesPerElement=8,et(Oc,"StructArrayLayout3i8");class Ld extends pi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,n,s){const l=this.length;return this.resize(l+1),this.emplace(l,e,i,n,s)}emplace(e,i,n,s,l){const u=4*e;return this.int16[u+0]=i,this.int16[u+1]=n,this.int16[u+2]=s,this.int16[u+3]=l,e}}Ld.prototype.bytesPerElement=8,et(Ld,"StructArrayLayout4i8");class Od extends pi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,n,s,l){const u=this.length;return this.resize(u+1),this.emplace(u,e,i,n,s,l)}emplace(e,i,n,s,l,u){const f=5*e;return this.int16[f+0]=i,this.int16[f+1]=n,this.int16[f+2]=s,this.int16[f+3]=l,this.int16[f+4]=u,e}}Od.prototype.bytesPerElement=10,et(Od,"StructArrayLayout5i10");class Fd extends pi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n,s,l,u,f){const p=this.length;return this.resize(p+1),this.emplace(p,e,i,n,s,l,u,f)}emplace(e,i,n,s,l,u,f,p){const g=6*e,x=12*e,b=3*e;return this.int16[g+0]=i,this.int16[g+1]=n,this.uint8[x+4]=s,this.uint8[x+5]=l,this.uint8[x+6]=u,this.uint8[x+7]=f,this.float32[b+2]=p,e}}Fd.prototype.bytesPerElement=12,et(Fd,"StructArrayLayout2i4ub1f12");class En extends pi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n){const s=this.length;return this.resize(s+1),this.emplace(s,e,i,n)}emplace(e,i,n,s){const l=3*e;return this.float32[l+0]=i,this.float32[l+1]=n,this.float32[l+2]=s,e}}En.prototype.bytesPerElement=12,et(En,"StructArrayLayout3f12");class Ls extends pi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n,s,l){const u=this.length;return this.resize(u+1),this.emplace(u,e,i,n,s,l)}emplace(e,i,n,s,l,u){const f=6*e,p=3*e;return this.uint16[f+0]=i,this.uint16[f+1]=n,this.uint16[f+2]=s,this.uint16[f+3]=l,this.float32[p+2]=u,e}}Ls.prototype.bytesPerElement=12,et(Ls,"StructArrayLayout4ui1f12");class Sl extends pi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,n,s){const l=this.length;return this.resize(l+1),this.emplace(l,e,i,n,s)}emplace(e,i,n,s,l){const u=4*e;return this.uint16[u+0]=i,this.uint16[u+1]=n,this.uint16[u+2]=s,this.uint16[u+3]=l,e}}Sl.prototype.bytesPerElement=8,et(Sl,"StructArrayLayout4ui8");class Ku extends pi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,n,s,l,u){const f=this.length;return this.resize(f+1),this.emplace(f,e,i,n,s,l,u)}emplace(e,i,n,s,l,u,f){const p=6*e;return this.int16[p+0]=i,this.int16[p+1]=n,this.int16[p+2]=s,this.int16[p+3]=l,this.int16[p+4]=u,this.int16[p+5]=f,e}}Ku.prototype.bytesPerElement=12,et(Ku,"StructArrayLayout6i12");class Bd extends pi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,n,s,l,u,f,p,g,x,b,w){const S=this.length;return this.resize(S+1),this.emplace(S,e,i,n,s,l,u,f,p,g,x,b,w)}emplace(e,i,n,s,l,u,f,p,g,x,b,w,S){const E=12*e;return this.int16[E+0]=i,this.int16[E+1]=n,this.int16[E+2]=s,this.int16[E+3]=l,this.uint16[E+4]=u,this.uint16[E+5]=f,this.uint16[E+6]=p,this.uint16[E+7]=g,this.int16[E+8]=x,this.int16[E+9]=b,this.int16[E+10]=w,this.int16[E+11]=S,e}}Bd.prototype.bytesPerElement=24,et(Bd,"StructArrayLayout4i4ui4i24");class kd extends pi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n,s,l,u){const f=this.length;return this.resize(f+1),this.emplace(f,e,i,n,s,l,u)}emplace(e,i,n,s,l,u,f){const p=10*e,g=5*e;return this.int16[p+0]=i,this.int16[p+1]=n,this.int16[p+2]=s,this.float32[g+2]=l,this.float32[g+3]=u,this.float32[g+4]=f,e}}kd.prototype.bytesPerElement=20,et(kd,"StructArrayLayout3i3f20");class ns extends pi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n,s){const l=this.length;return this.resize(l+1),this.emplace(l,e,i,n,s)}emplace(e,i,n,s,l){const u=4*e;return this.float32[u+0]=i,this.float32[u+1]=n,this.float32[u+2]=s,this.float32[u+3]=l,e}}ns.prototype.bytesPerElement=16,et(ns,"StructArrayLayout4f16");class Qu extends pi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.uint32[1*e+0]=i,e}}Qu.prototype.bytesPerElement=4,et(Qu,"StructArrayLayout1ul4");class en extends pi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i){const n=this.length;return this.resize(n+1),this.emplace(n,e,i)}emplace(e,i,n){const s=2*e;return this.uint16[s+0]=i,this.uint16[s+1]=n,e}}en.prototype.bytesPerElement=4,et(en,"StructArrayLayout2ui4");class Nd extends pi{_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,i,n,s,l,u,f,p,g,x,b,w,S){const E=this.length;return this.resize(E+1),this.emplace(E,e,i,n,s,l,u,f,p,g,x,b,w,S)}emplace(e,i,n,s,l,u,f,p,g,x,b,w,S,E){const M=20*e,C=10*e;return this.int16[M+0]=i,this.int16[M+1]=n,this.int16[M+2]=s,this.int16[M+3]=l,this.int16[M+4]=u,this.float32[C+3]=f,this.float32[C+4]=p,this.float32[C+5]=g,this.float32[C+6]=x,this.int16[M+14]=b,this.uint32[C+8]=w,this.uint16[M+18]=S,this.uint16[M+19]=E,e}}Nd.prototype.bytesPerElement=40,et(Nd,"StructArrayLayout5i4f1i1ul2ui40");class eh extends pi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,n,s,l,u,f){const p=this.length;return this.resize(p+1),this.emplace(p,e,i,n,s,l,u,f)}emplace(e,i,n,s,l,u,f,p){const g=8*e;return this.int16[g+0]=i,this.int16[g+1]=n,this.int16[g+2]=s,this.int16[g+4]=l,this.int16[g+5]=u,this.int16[g+6]=f,this.int16[g+7]=p,e}}eh.prototype.bytesPerElement=16,et(eh,"StructArrayLayout3i2i2i16");class Po extends pi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,n,s,l){const u=this.length;return this.resize(u+1),this.emplace(u,e,i,n,s,l)}emplace(e,i,n,s,l,u){const f=4*e,p=8*e;return this.float32[f+0]=i,this.float32[f+1]=n,this.float32[f+2]=s,this.int16[p+6]=l,this.int16[p+7]=u,e}}Po.prototype.bytesPerElement=16,et(Po,"StructArrayLayout2f1f2i16");class th extends pi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n,s,l,u){const f=this.length;return this.resize(f+1),this.emplace(f,e,i,n,s,l,u)}emplace(e,i,n,s,l,u,f){const p=20*e,g=5*e;return this.uint8[p+0]=i,this.uint8[p+1]=n,this.float32[g+1]=s,this.float32[g+2]=l,this.float32[g+3]=u,this.float32[g+4]=f,e}}th.prototype.bytesPerElement=20,et(th,"StructArrayLayout2ub4f20");class Ai extends pi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,n){const s=this.length;return this.resize(s+1),this.emplace(s,e,i,n)}emplace(e,i,n,s){const l=3*e;return this.uint16[l+0]=i,this.uint16[l+1]=n,this.uint16[l+2]=s,e}}Ai.prototype.bytesPerElement=6,et(Ai,"StructArrayLayout3ui6");class Ud extends pi{_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,i,n,s,l,u,f,p,g,x,b,w,S,E,M,C,R,F,z,j,$){const q=this.length;return this.resize(q+1),this.emplace(q,e,i,n,s,l,u,f,p,g,x,b,w,S,E,M,C,R,F,z,j,$)}emplace(e,i,n,s,l,u,f,p,g,x,b,w,S,E,M,C,R,F,z,j,$,q){const ie=30*e,W=15*e,Q=60*e;return this.int16[ie+0]=i,this.int16[ie+1]=n,this.int16[ie+2]=s,this.float32[W+2]=l,this.float32[W+3]=u,this.uint16[ie+8]=f,this.uint16[ie+9]=p,this.uint32[W+5]=g,this.uint32[W+6]=x,this.uint32[W+7]=b,this.uint16[ie+16]=w,this.uint16[ie+17]=S,this.uint16[ie+18]=E,this.float32[W+10]=M,this.float32[W+11]=C,this.uint8[Q+48]=R,this.uint8[Q+49]=F,this.uint8[Q+50]=z,this.uint32[W+13]=j,this.int16[ie+28]=$,this.uint8[Q+58]=q,e}}Ud.prototype.bytesPerElement=60,et(Ud,"StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60");class Vd extends pi{_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,i,n,s,l,u,f,p,g,x,b,w,S,E,M,C,R,F,z,j,$,q,ie,W,Q,Y,ee,me,ge,Te,Ae,Ie,Fe){const xe=this.length;return this.resize(xe+1),this.emplace(xe,e,i,n,s,l,u,f,p,g,x,b,w,S,E,M,C,R,F,z,j,$,q,ie,W,Q,Y,ee,me,ge,Te,Ae,Ie,Fe)}emplace(e,i,n,s,l,u,f,p,g,x,b,w,S,E,M,C,R,F,z,j,$,q,ie,W,Q,Y,ee,me,ge,Te,Ae,Ie,Fe,xe){const Se=20*e,Me=40*e,ze=80*e;return this.float32[Se+0]=i,this.float32[Se+1]=n,this.int16[Me+4]=s,this.int16[Me+5]=l,this.int16[Me+6]=u,this.int16[Me+7]=f,this.int16[Me+8]=p,this.int16[Me+9]=g,this.int16[Me+10]=x,this.int16[Me+11]=b,this.int16[Me+12]=w,this.uint16[Me+13]=S,this.uint16[Me+14]=E,this.uint16[Me+15]=M,this.uint16[Me+16]=C,this.uint16[Me+17]=R,this.uint16[Me+18]=F,this.uint16[Me+19]=z,this.uint16[Me+20]=j,this.uint16[Me+21]=$,this.uint16[Me+22]=q,this.uint16[Me+23]=ie,this.uint16[Me+24]=W,this.uint16[Me+25]=Q,this.uint16[Me+26]=Y,this.uint16[Me+27]=ee,this.uint32[Se+14]=me,this.float32[Se+15]=ge,this.float32[Se+16]=Te,this.float32[Se+17]=Ae,this.float32[Se+18]=Ie,this.uint8[ze+76]=Fe,this.uint16[Me+39]=xe,e}}Vd.prototype.bytesPerElement=80,et(Vd,"StructArrayLayout2f9i15ui1ul4f1ub1ui80");class jd extends pi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n,s,l,u){const f=this.length;return this.resiz
vendor: 6,625 bytes, line 7
7e(f+1),this.emplace(f,e,i,n,s,l,u)}emplace(e,i,n,s,l,u,f){const p=6*e;return this.float32[p+0]=i,this.float32[p+1]=n,this.float32[p+2]=s,this.float32[p+3]=l,this.float32[p+4]=u,this.float32[p+5]=f,e}}jd.prototype.bytesPerElement=24,et(jd,"StructArrayLayout6f24");class Ia extends pi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n,s,l){const u=this.length;return this.resize(u+1),this.emplace(u,e,i,n,s,l)}emplace(e,i,n,s,l,u){const f=5*e;return this.float32[f+0]=i,this.float32[f+1]=n,this.float32[f+2]=s,this.float32[f+3]=l,this.float32[f+4]=u,e}}Ia.prototype.bytesPerElement=20,et(Ia,"StructArrayLayout5f20");class Gd extends pi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n,s,l,u,f){const p=this.length;return this.resize(p+1),this.emplace(p,e,i,n,s,l,u,f)}emplace(e,i,n,s,l,u,f,p){const g=7*e;return this.float32[g+0]=i,this.float32[g+1]=n,this.float32[g+2]=s,this.float32[g+3]=l,this.float32[g+4]=u,this.float32[g+5]=f,this.float32[g+6]=p,e}}Gd.prototype.bytesPerElement=28,et(Gd,"StructArrayLayout7f28");class tn extends pi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n,s,l,u,f,p,g,x,b){const w=this.length;return this.resize(w+1),this.emplace(w,e,i,n,s,l,u,f,p,g,x,b)}emplace(e,i,n,s,l,u,f,p,g,x,b,w){const S=11*e;return this.float32[S+0]=i,this.float32[S+1]=n,this.float32[S+2]=s,this.float32[S+3]=l,this.float32[S+4]=u,this.float32[S+5]=f,this.float32[S+6]=p,this.float32[S+7]=g,this.float32[S+8]=x,this.float32[S+9]=b,this.float32[S+10]=w,e}}tn.prototype.bytesPerElement=44,et(tn,"StructArrayLayout11f44");class Un extends pi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n,s,l,u,f,p,g){const x=this.length;return this.resize(x+1),this.emplace(x,e,i,n,s,l,u,f,p,g)}emplace(e,i,n,s,l,u,f,p,g,x){const b=9*e;return this.float32[b+0]=i,this.float32[b+1]=n,this.float32[b+2]=s,this.float32[b+3]=l,this.float32[b+4]=u,this.float32[b+5]=f,this.float32[b+6]=p,this.float32[b+7]=g,this.float32[b+8]=x,e}}Un.prototype.bytesPerElement=36,et(Un,"StructArrayLayout9f36");class Os extends pi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i){const n=this.length;return this.resize(n+1),this.emplace(n,e,i)}emplace(e,i,n){const s=2*e;return this.float32[s+0]=i,this.float32[s+1]=n,e}}Os.prototype.bytesPerElement=8,et(Os,"StructArrayLayout2f8");class $d extends pi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,n,s){const l=this.length;return this.resize(l+1),this.emplace(l,e,i,n,s)}emplace(e,i,n,s,l){const u=6*e;return this.uint32[3*e+0]=i,this.uint16[u+2]=n,this.uint16[u+3]=s,this.uint16[u+4]=l,e}}$d.prototype.bytesPerElement=12,et($d,"StructArrayLayout1ul3ui12");class os extends pi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.uint16[1*e+0]=i,e}}os.prototype.bytesPerElement=2,et(os,"StructArrayLayout1ui2");class ih extends pi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n,s,l,u,f,p,g,x,b,w,S,E,M,C){const R=this.length;return this.resize(R+1),this.emplace(R,e,i,n,s,l,u,f,p,g,x,b,w,S,E,M,C)}emplace(e,i,n,s,l,u,f,p,g,x,b,w,S,E,M,C,R){const F=16*e;return this.float32[F+0]=i,this.float32[F+1]=n,this.float32[F+2]=s,this.float32[F+3]=l,this.float32[F+4]=u,this.float32[F+5]=f,this.float32[F+6]=p,this.float32[F+7]=g,this.float32[F+8]=x,this.float32[F+9]=b,this.float32[F+10]=w,this.float32[F+11]=S,this.float32[F+12]=E,this.float32[F+13]=M,this.float32[F+14]=C,this.float32[F+15]=R,e}}ih.prototype.bytesPerElement=64,et(ih,"StructArrayLayout16f64");class Ea extends pi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n,s,l,u,f){const p=this.length;return this.resize(p+1),this.emplace(p,e,i,n,s,l,u,f)}emplace(e,i,n,s,l,u,f,p){const g=10*e,x=5*e;return this.uint16[g+0]=i,this.uint16[g+1]=n,this.uint16[g+2]=s,this.uint16[g+3]=l,this.float32[x+2]=u,this.float32[x+3]=f,this.float32[x+4]=p,e}}Ea.prototype.bytesPerElement=20,et(Ea,"StructArrayLayout4ui3f20");class Il extends pi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.int16[1*e+0]=i,e}}Il.prototype.bytesPerElement=2,et(Il,"StructArrayLayout1i2");class Fc extends pi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.uint8[1*e+0]=i,e}}Fc.prototype.bytesPerElement=1,et(Fc,"StructArrayLayout1ub1");class rh extends Lc{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]}}rh.prototype.size=40;class Aa extends Nd{get(e){return new rh(this,e)}}et(Aa,"CollisionBoxArray");class Hd extends Lc{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]}
vendor: 66,169 bytes, line 7
7get 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}}Hd.prototype.size=60;class cm extends Ud{get(e){return new Hd(this,e)}}et(cm,"PlacedSymbolArray");class um extends Lc{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]}}um.prototype.size=80;class qd extends Vd{get(e){return new um(this,e)}}et(qd,"SymbolInstanceArray");class hm extends Sr{getoffsetX(e){return this.float32[1*e+0]}}et(hm,"GlyphOffsetArray");class co extends Nn{getx(e){return this.int16[2*e+0]}gety(e){return this.int16[2*e+1]}}et(co,"SymbolLineVertexArray");class dm extends Lc{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]}}dm.prototype.size=12;class Zd extends $d{get(e){return new dm(this,e)}}et(Zd,"FeatureIndexArray");class fm extends en{geta_centroid_pos0(e){return this.uint16[2*e+0]}geta_centroid_pos1(e){return this.uint16[2*e+1]}}et(fm,"FillExtrusionCentroidArray");class pm extends Lc{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]}}pm.prototype.size=6;class mm extends Ta{get(e){return new pm(this,e)}}et(mm,"FillExtrusionWallArray");const ng=Rt([{name:"a_pos",components:2,type:"Int16"}],4),og=Rt([{name:"a_circle_z_offset",components:1,type:"Float32"}],4),sg=Rt([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]);class di{constructor(e=[]){this.segments=e}_prepareSegment(e,i,n,s,l){let u=this.segments.at(-1);return e>di.MAX_VERTEX_ARRAY_LENGTH&&Pt(`Max vertices per segment is ${di.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!u||u.vertexLength+e>di.MAX_VERTEX_ARRAY_LENGTH||u.sortKey!==s||l!==void 0&&u&&u.batchIndex!==void 0&&u.batchIndex!==l)&&(u={vertexOffset:i,primitiveOffset:n,vertexLength:0,primitiveLength:0},s!==void 0&&(u.sortKey=s),l!==void 0&&(u.batchIndex=l),this.segments.push(u)),u}prepareSegment(e,i,n,s,l){return this._prepareSegment(e,i.length,n.length,s,l)}get(){return this.segments}destroy(){for(const e of this.segments)for(const i in e.vaos)e.vaos[i].destroy()}static simpleSegment(e,i,n,s){return new di([{vertexOffset:e,primitiveOffset:i,vertexLength:n,primitiveLength:s,vaos:{},sortKey:0}])}}function El(r,e){return 256*(r=re(Math.floor(r),0,255))+re(Math.floor(e),0,255)}di.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,et(di,"SegmentVector");const nh=Rt([{name:"a_pattern",components:4,type:"Uint16"},{name:"a_pixel_ratio",components:1,type:"Float32"}]),Wd=Rt([{name:"a_pattern_b",components:4,type:"Uint16"}]),_m=Rt([{name:"a_dash",components:4,type:"Uint16"}]);class Al{constructor(){this.ids=[],this.uniqueIds=[],this.positions=[],this.indexed=!1}add(e,i,n,s){this.ids.push(gm(e)),this.positions.push(i,n,s)}eachPosition(e,i){const n=gm(e);let s=0,l=this.ids.length-1;for(;s<l;){const u=s+l>>1;this.ids[u]>=n?l=u:s=u+1}for(;this.ids[s]===n;)i(this.positions[3*s],this.positions[3*s+1],this.positions[3*s+2]),s++}static serialize(e,i){const n=new Float64Array(e.ids),s=new Uint32Array(e.positions);return oh(n,s,0,n.length-1),i&&(i.add(n.buffer),i.add(s.buffer)),{ids:n,positions:s}}static deserialize(e){const i=new Al;let n;i.ids=e.ids,i.positions=e.positions;for(const s of i.ids)s!==n&&i.uniqueIds.push(s),n=s;return i.indexed=!0,i}}function gm(r){const e=+r;return Number.isSafeInteger(e)?e:cu(String(r))}function oh(r,e,i,n){for(;i<n;){const s=r[i+n>>1];let l=i-1,u=n+1;for(;;){do l++;while(r[l]<s);do u--;while(r[u]>s);if(l>=u)break;sh(r,l,u),sh(e,3*l,3*u),sh(e,3*l+1,3*u+1),sh(e,3*l+2,3*u+2)}u-i<n-u?(oh(r,e,i,u),i=u+1):(oh(r,e,u+1,n),n=u)}}function sh(r,e,i){const n=r[e];r[e]=r[i],r[i]=n}et(Al,"FeaturePositionMap");class Do{constructor(e){this.gl=e.gl,this.initialized=!1}fetchUniformLocation(e,i){return this.location||this.initialized||(this.location=this.gl.getUniformLocation(e,i),this.initialized=!0),!!this.location}set(e,i,n){throw new Error("Uniform#set() must be implemented by each concrete Uniform")}}class Bc extends Do{constructor(e){super(e),this.current=0}set(e,i,n){this.fetchUniformLocation(e,i)&&this.current!==n&&(this.current=n,this.gl.uniform1i(this.location,n))}}class Hi extends Do{constructor(e){super(e),this.current=0}set(e,i,n){this.fetchUniformLocation(e,i)&&this.current!==n&&(this.current=n,this.gl.uniform1f(this.location,n))}}class Vn extends Do{constructor(e){super(e),this.current=[0,0]}set(e,i,n){this.fetchUniformLocation(e,i)&&(n[0]===this.current[0]&&n[1]===this.current[1]||(this.current=n,this.gl.uniform2f(this.location,n[0],n[1])))}}class kc extends Do{constructor(e){super(e),this.current=[0,0,0]}set(e,i,n){this.fetchUniformLocation(e,i)&&(n[0]===this.current[0]&&n[1]===this.current[1]&&n[2]===this.current[2]||(this.current=n,this.gl.uniform3f(this.location,n[0],n[1],n[2])))}}class ag extends Do{constructor(e){super(e),this.current=[0,0,0,0]}set(e,i,n){this.fetchUniformLocation(e,i)&&(n[0]===this.current[0]&&n[1]===this.current[1]&&n[2]===this.current[2]&&n[3]===this.current[3]||(this.current=n,this.gl.uniform4ui(this.location,n[0],n[1],n[2],n[3])))}}class Xd extends Do{constructor(e){super(e),this.current=[0,0,0,0]}set(e,i,n){this.fetchUniformLocation(e,i)&&(n[0]===this.current[0]&&n[1]===this.current[1]&&n[2]===this.current[2]&&n[3]===this.current[3]||(this.current=n,this.gl.uniform4f(this.location,n[0],n[1],n[2],n[3])))}}class ym extends Do{constructor(e){super(e),this.current=qt.transparent.toPremultipliedRenderColor(null)}set(e,i,n){this.fetchUniformLocation(e,i)&&(n.r===this.current.r&&n.g===this.current.g&&n.b===this.current.b&&n.a===this.current.a||(this.current=n,this.gl.uniform4f(this.location,n.r,n.g,n.b,n.a)))}}class Fs extends Do{constructor(e){super(e),this.current=new Float32Array(16)}set(e,i,n){if(!this.fetchUniformLocation(e,i))return;const s=this.current;if(n[12]!==s[12]||n[0]!==s[0])return s.set(n),void this.gl.uniformMatrix4fv(this.location,!1,s);for(let l=1;l<16;l++)if(n[l]!==s[l]){s.set(n),this.gl.uniformMatrix4fv(this.location,!1,s);break}}}class Ml extends Do{constructor(e){super(e),this.current=new Float32Array(4)}set(e,i,n){if(!this.fetchUniformLocation(e,i))return;const s=this.current;for(let l=0;l<4;l++)if(n[l]!==s[l]){s.set(n),this.gl.uniformMatrix2fv(this.location,!1,s);break}}}function rn(r){return[El(255*r.r,255*r.g),El(255*r.b,255*r.a)]}function Ma(r,e,i,n,s,l,u,f){return!!r&&(r.kind==="composite"||r.kind==="source"?r.evaluate(new Wt(0,{brightness:l,worldview:f}),e,i,s,n,u)==="none":r.value==="none")}class ah{constructor(e,i,n,s){this.value=e,this.uniformNames=i.map(l=>`u_${l}`),this.type=n,this.context=s}setUniform(e,i,n,s,l){const u=s.constantOr(this.value);i.set(e,l,u instanceof qt?u.toPremultipliedRenderColor(this.lutExpression&&this.lutExpression.kind==="constant"&&this.lutExpression.value==="none"?null:this.context.lut):u)}getBinding(e,i){return this.type==="color"?new ym(e):new Hi(e)}}class Nc{constructor(e,i){this.uniformNames=i.map(n=>`u_${n}`),this.pattern=null,this.patternTransition=null,this.pixelRatio=1}setConstantPatternPositions(e,i){this.pixelRatio=e.pixelRatio||1,this.pattern=e.tl.concat(e.br),this.patternTransition=i?i.tl.concat(i.br):this.pattern}setUniform(e,i,n,s,l){let u=null;l!=="u_pattern"&&l!=="u_dash"||(u=this.pattern),l==="u_pattern_b"&&(u=this.patternTransition),l==="u_pixel_ratio"&&(u=this.pixelRatio),u&&i.set(e,l,u)}getBinding(e,i){return i==="u_pattern"||i==="u_pattern_b"||i==="u_dash"?new ag(e):new Hi(e)}}class ss{constructor(e,i,n,s){this.expression=e,this.type=n,this.maxValue=0,this.paintVertexAttributes=i.map(l=>({name:`a_${l}`,type:"Float32",components:n==="color"?2:1,offset:0})),this.paintVertexArray=new s}populatePaintArray(e,i,n,s,l,u,f,p){const g=this.paintVertexArray.length,x=this.expression.kind==="composite"||this.expression.kind==="source"?this.expression.evaluate(new Wt(0,{brightness:u,worldview:p}),i,{},l,s,f):this.expression.kind==="constant"&&this.expression.value,b=Ma(this.lutExpression,i,{},s,l,u,f,p);this.paintVertexArray.resize(e),this._setPaintValue(g,e,x,b?null:this.context.lut)}updatePaintArray(e,i,n,s,l,u,f,p){const g=this.expression.kind==="composite"||this.expression.kind==="source"?this.expression.evaluate({zoom:0,brightness:f,worldview:p},n,s,void 0,l):this.expression.kind==="constant"&&this.expression.value,x=Ma(this.lutExpression,n,s,l,void 0,f,void 0,p);this._setPaintValue(e,i,g,x?null:this.context.lut)}_setPaintValue(e,i,n,s){if(this.type==="color"){const l=rn(n.toPremultipliedRenderColor(s));for(let u=e;u<i;u++)this.paintVertexArray.emplace(u,l[0],l[1])}else{for(let l=e;l<i;l++)this.paintVertexArray.emplace(l,n);this.maxValue=Math.max(this.maxValue,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.lutExpression&&this.lutExpression.kind!=="constant"&&(this.lutExpression.isStateDependent||!this.lutExpression.isLightConstant)||this.expression.kind!=="constant"&&(this.expression.isStateDependent||!this.expression.isLightConstant)))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class Ro{constructor(e,i,n,s,l,u){this.expression=e,this.uniformNames=i.map(f=>`u_${f}_t`),this.type=n,this.useIntegerZoom=s,this.context=l,this.maxValue=0,this.paintVertexAttributes=i.map(f=>({name:`a_${f}`,type:"Float32",components:n==="color"?4:2,offset:0})),this.paintVertexArray=new u}populatePaintArray(e,i,n,s,l,u,f,p){const g=this.expression.evaluate(new Wt(this.context.zoom,{brightness:u,worldview:p}),i,{},l,s,f),x=this.expression.evaluate(new Wt(this.context.zoom+1,{brightness:u,worldview:p}),i,{},l,s,f),b=Ma(this.lutExpression,i,{},s,l,u,f,p),w=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(w,e,g,x,b?null:this.context.lut)}updatePaintArray(e,i,n,s,l,u,f,p){const g=this.expression.evaluate({zoom:this.context.zoom,brightness:f,worldview:p},n,s,void 0,l),x=this.expression.evaluate({zoom:this.context.zoom+1,brightness:f,worldview:p},n,s,void 0,l),b=Ma(this.lutExpression,n,s,l,void 0,f,void 0,p);this._setPaintValue(e,i,g,x,b?null:this.context.lut)}_setPaintValue(e,i,n,s,l){if(this.type==="color"){const u=rn(n.toPremultipliedRenderColor(l)),f=rn(s.toPremultipliedRenderColor(l));for(let p=e;p<i;p++)this.paintVertexArray.emplace(p,u[0],u[1],f[0],f[1])}else{for(let u=e;u<i;u++)this.paintVertexArray.emplace(u,n,s);this.maxValue=Math.max(this.maxValue,Math.abs(n),Math.abs(s))}}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,i,n,s,l){const u=this.useIntegerZoom?Math.floor(n.zoom):n.zoom,f=re(this.expression.interpolationFactor(u,this.context.zoom,this.context.zoom+1),0,1);i.set(e,l,f)}getBinding(e,i){return new Hi(e)}}class jn{constructor(e,i,n,s,l){this.expression=e,this.layerId=l,this.paintVertexAttributes=(n==="array"?_m:nh).members;for(let u=0;u<i.length;++u);this.paintVertexArray=new s,this.paintTransitionVertexArray=new Sl}populatePaintArray(e,i,n,s){const l=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValues(l,e,i.patterns&&i.patterns[this.layerId],n)}updatePaintArray(e,i,n,s,l,u,f){this._setPaintValues(e,i,n.patterns&&n.patterns[this.layerId],u)}_setPaintValues(e,i,n,s){if(!s||!n)return;const l=s[n[0]],u=s[n[1]];if(l){if(l){const{tl:f,br:p,pixelRatio:g}=l;for(let x=e;x<i;x++)this.paintVertexArray.emplace(x,f[0],f[1],p[0],p[1],g)}if(u){this.paintTransitionVertexArray.resize(this.paintVertexArray.length);const{tl:f,br:p}=u;for(let g=e;g<i;g++)this.paintTransitionVertexArray.emplace(g,f[0],f[1],p[0],p[1])}}}upload(e){const i=this.expression.isStateDependent||!this.expression.isLightConstant;this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,i)),this.paintTransitionVertexArray&&this.paintTransitionVertexArray.length&&(this.paintTransitionVertexBuffer=e.createVertexBuffer(this.paintTransitionVertexArray,Wd.members,i))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy(),this.paintTransitionVertexBuffer&&this.paintTransitionVertexBuffer.destroy()}}class Ca{constructor(e,i,n=()=>!0){this.binders={},this._buffers=[],this.context=i;const s=[],l=e;for(const u in e.paint._values){const f=l.paint.get(u);if(u.endsWith("-use-theme")||!n(u)||!(f instanceof Rs&&zu(f.property.specification)))continue;const p=cg(u,e.type),g=f.value,x=f.property.specification.type,b=!!f.property.useIntegerZoom,w=u==="line-dasharray"||u.endsWith("pattern"),S=l.paint.get(`${u}-use-theme`),E=u==="line-dasharray"&&l.layout.get("line-cap").value.kind!=="constant"||S&&S.value.kind!=="constant";if(g.kind!=="constant"||E)if(g.kind==="source"||E||w){const M=Yd(u,x,"source");this.binders[u]=w?new jn(g,p,x,M,e.id):new ss(g,p,x,M),s.push(`/a_${u}`)}else{const M=Yd(u,x,"composite");this.binders[u]=new Ro(g,p,x,b,i,M),s.push(`/z_${u}`)}else this.binders[u]=w?new Nc(g.value,p):new ah(g.value,p,x,i),s.push(`/u_${u}`);S&&(this.binders[u].lutExpression=S.value)}this.cacheKey=s.sort().join("")}updateExpressions(e){const i=e;for(const n in this.binders){const s=this.binders[n];if(s instanceof ss||s instanceof Ro||s instanceof jn){const l=i.paint.get(n);s.expression=l.value}}}getMaxValue(e){const i=this.binders[e];return i instanceof ss||i instanceof Ro?i.maxValue:0}populatePaintArrays(e,i,n,s,l,u,f,p){for(const g in this.binders){const x=this.binders[g];x.context=this.context,(x instanceof ss||x instanceof Ro||x instanceof jn)&&x.populatePaintArray(e,i,n,s,l,u,f,p)}}setConstantPatternPositions(e,i){for(const n in this.binders){const s=this.binders[n];s instanceof Nc&&s.setConstantPatternPositions(e,i)}}getPatternTransitionVertexBuffer(e){const i=this.binders[e];return i instanceof jn?i.paintTransitionVertexBuffer:null}updatePaintArrays(e,i,n,s,l,u,f,p,g,x){let b=!1;const w=Object.keys(e),S=w.length!==0&&!p,E=S?w:i.uniqueIds;this.context.lut=l.lut;for(const M in this.binders){const C=this.binders[M];if(C.context=this.context,(C instanceof ss||C instanceof Ro||C instanceof jn)&&C.expression&&C.expression.kind&&C.expression.kind!=="constant"&&(C.expression.isStateDependent===!0||C.expression.isLightConstant===!1)){const R=l.paint.get(M);C.expression=R.value;for(const F of E){const z=e[F.toString()];i.eachPosition(F,(j,$,q)=>{const ie=s.feature(j);C.updatePaintArray($,q,ie,z,u,f,g,x)})}if(!S)for(const F of n.uniqueIds){const z=e[F.toString()];n.eachPosition(F,(j,$,q)=>{const ie=s.feature(j);C.updatePaintArray($,q,ie,z,u,f,g,x)})}b=!0}}return b}defines(){const e=[];for(const i in this.binders){const n=this.binders[i];(n instanceof ah||n instanceof Nc)&&e.push(...n.uniformNames.map(s=>`#define HAS_UNIFORM_${s}`))}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e){const i=[];for(const n in this.binders){const s=this.binders[n];if(s instanceof ah||s instanceof Nc||s instanceof Ro)for(const l of s.uniformNames)i.push({name:l,property:n,binding:s.getBinding(e,l)})}return i}setUniforms(e,i,n,s,l){for(const{name:u,property:f,binding:p}of n)this.binders[f].setUniform(e,p,l,s.get(f),u)}updatePaintBuffers(){this._buffers=[];for(const e in this.binders){const i=this.binders[e];(i instanceof ss||i instanceof Ro||i instanceof jn)&&i.paintVertexBuffer&&this._buffers.push(i.paintVertexBuffer),i instanceof jn&&i.paintTransitionVertexBuffer&&this._buffers.push(i.paintTransitionVertexBuffer)}}upload(e){for(const i in this.binders){const n=this.binders[i];(n instanceof ss||n instanceof Ro||n instanceof jn)&&n.upload(e)}this.updatePaintBuffers()}destroy(){for(const e in this.binders){const i=this.binders[e];(i instanceof ss||i instanceof Ro||i instanceof jn)&&i.destroy()}}}class An{constructor(e,i,n=()=>!0){this.programConfigurations={};for(const s of e)this.programConfigurations[s.id]=new Ca(s,i,n);this.needsUpload=!1,this._featureMap=new Al,this._featureMapWithoutIds=new Al,this._bufferOffset=0,this._idlessCounter=0}populatePaintArrays(e,i,n,s,l,u,f,p,g){for(const x in this.programConfigurations)this.programConfigurations[x].populatePaintArrays(e,i,s,l,u,f,p,g);i.id!==void 0?this._featureMap.add(i.id,n,this._bufferOffset,e):(this._featureMapWithoutIds.add(this._idlessCounter,n,this._bufferOffset,e),this._idlessCounter+=1),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,i,n,s,l,u,f,p){for(const g of n)this.needsUpload=this.programConfigurations[g.id].updatePaintArrays(e,this._featureMap,this._featureMapWithoutIds,i,g,s,l,u,f||0,p)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(const i in this.programConfigurations)this.programConfigurations[i].upload(e);this.needsUpload=!1}}destroy(){for(const e in this.programConfigurations)this.programConfigurations[e].destroy()}updateExpressions(e){const i=new Set;for(const n of e){const s=this.programConfigurations[n.id];s&&(s.updateExpressions(n),i.add(n.id))}for(const n in this.programConfigurations)i.has(n)||delete this.programConfigurations[n]}}const lg={"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 cg(r,e){return lg[r]||[r.replace(`${e}-`,"").replace(/-/g,"_")]}const ug={"line-pattern":{source:Ls,composite:Ls},"fill-pattern":{source:Ls,composite:Ls},"fill-extrusion-pattern":{source:Ls,composite:Ls},"line-dasharray":{source:Sl,composite:Sl}},hg={color:{source:Os,composite:ns},number:{source:Sr,composite:Os}};function Yd(r,e,i){const n=ug[r];return n&&n[i]||hg[e][i]}et(ah,"ConstantBinder"),et(Nc,"PatternConstantBinder"),et(ss,"SourceExpressionBinder",{omit:["expression"]}),et(jn,"PatternCompositeBinder",{omit:["expression"]}),et(Ro,"CompositeExpressionBinder",{omit:["expression"]}),et(Ca,"ProgramConfiguration",{omit:["_buffers"]}),et(An,"ProgramConfigurationSet");const Lr=Xe/Math.PI/2,Cl=64,lh=[Cl,32,16],Mn=-Lr,Gn=Lr;function Bs(r,e,i,n=Lr){return i=V(i),[r*Math.sin(i)*n,-e*n,r*Math.cos(i)*n]}function zo(r,e,i){return Bs(Math.cos(V(r)),Math.sin(V(r)),e,i)}const Pa=63710088e-1,Jd=2*Math.PI*Pa;class Zt{constructor(e,i){if(isNaN(e)||isNaN(i))throw new Error(`Invalid LngLat object: (${e}, ${i})`);if(this.lng=+e,this.lat=+i,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Zt(Ve(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){const i=Math.PI/180,n=this.lat*i,s=e.lat*i,l=Math.sin(n)*Math.sin(s)+Math.cos(n)*Math.cos(s)*Math.cos((e.lng-this.lng)*i);return Pa*Math.acos(Math.min(l,1))}toBounds(e=0){const i=360*e/40075017,n=i/Math.cos(Math.PI/180*this.lat);return new ks({lng:this.lng-n,lat:this.lat-i},{lng:this.lng+n,lat:this.lat+i})}toEcef(e){return zo(this.lat,this.lng,Lr+e*Lr/Pa)}static convert(e){if(e instanceof Zt)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new Zt(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null)return new Zt(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 ks{constructor(e,i){e&&(i?this.setSouthWest(e).setNorthEast(i):Array.isArray(e)&&e.length===4?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 Zt?new Zt(e.lng,e.lat):Zt.convert(e),this}setSouthWest(e){return this._sw=e instanceof Zt?new Zt(e.lng,e.lat):Zt.convert(e),this}extend(e){const i=this._sw,n=this._ne;let s,l;if(e instanceof Zt)s=e,l=e;else{if(!(e instanceof ks))return Array.isArray(e)?e.length===4||e.every(Array.isArray)?this.extend(ks.convert(e)):this.extend(Zt.convert(e)):typeof e=="object"&&e!==null&&Object.hasOwn(e,"lat")&&(Object.hasOwn(e,"lon")||Object.hasOwn(e,"lng"))?this.extend(Zt.convert(e)):this;if(s=e._sw,l=e._ne,!s||!l)return this}return i||n?(i.lng=Math.min(s.lng,i.lng),i.lat=Math.min(s.lat,i.lat),n.lng=Math.max(l.lng,n.lng),n.lat=Math.max(l.lat,n.lat)):(this._sw=new Zt(s.lng,s.lat),this._ne=new Zt(l.lng,l.lat)),this}getCenter(){return new Zt((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 Zt(this.getWest(),this.getNorth())}getSouthEast(){return new Zt(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:i,lat:n}=Zt.convert(e);let s=this._sw.lng<=i&&i<=this._ne.lng;return this._sw.lng>this._ne.lng&&(s=this._sw.lng>=i&&i>=this._ne.lng),this._sw.lat<=n&&n<=this._ne.lat&&s}static convert(e){if(e)return e instanceof ks?e:new ks(e)}}function Uc(r){return Jd*Math.cos(r*Math.PI/180)}function as(r){return(180+r)/360}function Lo(r){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r*Math.PI/360)))/360}function Yr(r,e){return r/Uc(e)}function mn(r){return 360*r-180}function pr(r){return 360/Math.PI*Math.atan(Math.exp((180-360*r)*Math.PI/180))-90}function Kd(r,e){return r*Uc(pr(e))}const _n=85.051129;function xm(r){return Math.cos(V(re(r,-85.051129,_n)))}function Da(r,e){const i=re(e,0,25.5),n=Math.pow(2,i);return xm(r)*Jd/(512*n)}function vm(r){return 1/Math.cos(r*Math.PI/180)}function Cn(r,e=0){const i=Math.exp(Math.PI*(1-(r.y+e/Xe)/(1<<r.z)*2));return 80150034*i/(i*i+1)/Xe/(1<<r.z)}class Or{constructor(e,i,n=0){this.x=+e,this.y=+i,this.z=+n}static fromLngLat(e,i=0){const n=Zt.convert(e);return new Or(as(n.lng),Lo(n.lat),Yr(i,n.lat))}toLngLat(){return new Zt(mn(this.x),pr(this.y))}toAltitude(){return Kd(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/Jd*vm(pr(this.y))}}function Qd(r,e,i,n,s,l,u,f,p){const g=(e+n)/2,x=(i+s)/2,b=new Ue(g,x);f(b),(function(w,S,E,M,C,R){const F=E-C,z=M-R;return Math.abs((M-S)*F-(E-w)*z)/Math.hypot(F,z)})(b.x,b.y,l.x,l.y,u.x,u.y)>=p?(Qd(r,e,i,g,x,l,b,f,p),Qd(r,g,x,n,s,b,u,f,p)):r.push(u)}function bm(r,e,i){let n=r[0],s=n.x,l=n.y;e(n);const u=[n];for(let f=1;f<r.length;f++){const p=r[f],{x:g,y:x}=p;e(p),Qd(u,s,l,g,x,n,p,e,i),s=g,l=x,n=p}return u}function Pl(r,e,i,n){if(n(e,i)){const s=e.add(i)._mult(.5);Pl(r,e,s,n),Pl(r,s,i,n)}else r.push(i)}function dg(r,e){let i=r[0];const n=[i];for(let s=1;s<r.length;s++){const l=r[s];Pl(n,i,l,e),i=l}return n}const ef=Math.pow(2,14)-1,Vc=-ef-1;function fg(r,e){const i=Math.round(r.x*e),n=Math.round(r.y*e);return r.x=re(i,Vc,ef),r.y=re(n,Vc,ef),(i<r.x||i>r.x+1||n<r.y||n>r.y+1)&&Pt("Geometry exceeds allowed extent, reduce your vector tile buffer size"),r}function gn(r,e,i){const n=r.loadGeometry(),s=r.extent,l=Xe/s;if(e&&i&&i.projection.isReprojectedInTileSpace){const u=1<<e.z,{scale:f,x:p,y:g,projection:x}=i,b=w=>{const S=mn((e.x+w.x/s)/u),E=pr((e.y+w.y/s)/u),M=x.project(S,E);w.x=(M.x*f-p)*s,w.y=(M.y*f-g)*s};for(let w=0;w<n.length;w++)if(r.type!==1)n[w]=bm(n[w],b,1);else{const S=[];for(const E of n[w])E.x<0||E.x>=s||E.y<0||E.y>=s||(b(E),S.push(E));n[w]=S}}for(const u of n)for(const f of u)fg(f,l);return n}function $n(r,e){return{type:r.type,id:r.id,properties:r.properties,geometry:e?gn(r):[]}}class Ns{constructor(e,i,n,s,l){this.properties={},this.extent=n,this.type=0,this.id=void 0,this._pbf=e,this._geometry=-1,this._keys=s,this._values=l,e.readFields(wm,this,i)}loadGeometry(){const e=this._pbf;e.pos=this._geometry;const i=e.readVarint()+e.pos,n=[];let s,l=1,u=0,f=0,p=0;for(;e.pos<i;){if(u<=0){const g=e.readVarint();l=7&g,u=g>>3}if(u--,l===1||l===2)f+=e.readSVarint(),p+=e.readSVarint(),l===1&&(s&&n.push(s),s=[]),s&&s.push(new Ue(f,p));else{if(l!==7)throw new Error(`unknown command ${l}`);s&&s.push(s[0].clone())}}return s&&n.push(s),n}bbox(){const e=this._pbf;e.pos=this._geometry;const i=e.readVarint()+e.pos;let n=1,s=0,l=0,u=0,f=1/0,p=-1/0,g=1/0,x=-1/0;for(;e.pos<i;){if(s<=0){const b=e.readVarint();n=7&b,s=b>>3}if(s--,n===1||n===2)l+=e.readSVarint(),u+=e.readSVarint(),l<f&&(f=l),l>p&&(p=l),u<g&&(g=u),u>x&&(x=u);else if(n!==7)throw new Error(`unknown command ${n}`)}return[f,g,p,x]}toGeoJSON(e,i,n){const s=this.extent*Math.pow(2,n),l=this.extent*e,u=this.extent*i,f=this.loadGeometry();function p(w){return[360*(w.x+l)/s-180,360/Math.PI*Math.atan(Math.exp((1-2*(w.y+u)/s)*Math.PI))-90]}function g(w){return w.map(p)}let x;if(this.type===1){const w=[];for(const E of f)w.push(E[0]);const S=g(w);x=w.length===1?{type:"Point",coordinates:S[0]}:{type:"MultiPoint",coordinates:S}}else if(this.type===2){const w=f.map(g);x=w.length===1?{type:"LineString",coordinates:w[0]}:{type:"MultiLineString",coordinates:w}}else{if(this.type!==3)throw new Error("unknown feature type");{const w=(function(E){const M=E.length;if(M<=1)return[E];const C=[];let R,F;for(let z=0;z<M;z++){const j=Tm(E[z]);j!==0&&(F===void 0&&(F=j<0),F===j<0?(R&&C.push(R),R=[E[z]]):R&&R.push(E[z]))}return R&&C.push(R),C})(f),S=[];for(const E of w)S.push(E.map(g));x=S.length===1?{type:"Polygon",coordinates:S[0]}:{type:"MultiPolygon",coordinates:S}}}const b={type:"Feature",geometry:x,properties:this.properties};return this.id!=null&&(b.id=this.id),b}}function wm(r,e,i){r===1?e.id=i.readVarint():r===2?(function(n,s){const l=n.readVarint()+n.pos;for(;n.pos<l;){const u=s._keys[n.readVarint()],f=s._values[n.readVarint()];s.properties[u]=f}})(i,e):r===3?e.type=i.readVarint():r===4&&(e._geometry=i.pos)}function Tm(r){let e=0;for(let i,n,s=0,l=r.length,u=l-1;s<l;u=s++)i=r[s],n=r[u],e+=(n.x-i.x)*(i.y+n.y);return e}Ns.types=["Unknown","Point","LineString","Polygon"];class Sm{constructor(e,i){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],e.readFields(pg,this,i),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 i=this._pbf.readVarint()+this._pbf.pos;return new Ns(this._pbf,i,this.extent,this._keys,this._values)}}function pg(r,e,i){r===15?e.version=i.readVarint():r===1?e.name=i.readString():r===5?e.extent=i.readVarint():r===2?e._features.push(i.pos):r===3?e._keys.push(i.readString()):r===4&&e._values.push((function(n){let s=null;const l=n.readVarint()+n.pos;for(;n.pos<l;){const u=n.readVarint()>>3;s=u===1?n.readString():u===2?n.readFloat():u===3?n.readDouble():u===4?n.readVarint64():u===5?n.readVarint():u===6?n.readSVarint():u===7?n.readBoolean():null}if(s==null)throw new Error("unknown feature value");return s})(i))}class tf{constructor(e,i){this.layers=e.readFields(Im,{},i)}}function Im(r,e,i){if(r===3){const n=new Sm(i,i.readVarint()+i.pos);n.length&&(e[n.name]=n)}}const Ra="3d_elevation_id",Em="level";class mg{constructor(){this._valid=!1}reset(e){return this.feature=e,this._valid=!0,this._geometry=e.loadGeometry(),this._geometry.length!==0&&this._geometry[0].length!==0||(this._valid=!1),this}geometry(e,i){return this._valid&&e(i(this._geometry)),this}require(e,i,n){return this.get(e,!0,i,n)}optional(e,i,n){return this.get(e,!1,i,n)}success(){return this._valid}get(e,i,n,s){const l=Object.hasOwn(this.feature.properties,e)?+this.feature.properties[e]:void 0;return this._valid&&l!==void 0&&!Number.isNaN(l)?n(s?s(l):l):i&&(this._valid=!1),this}}class Am{constructor(e,i){this.featureFunc=e,this.vertexFunc=i}parseFeature(e,i,n){return this.featureFunc(e,i,n)}parseVertex(e,i,n){return this.vertexFunc(e,i,n)}}const _g=new Am((r,e,i)=>r.reset(e).require(Ra,n=>{i.id=n}).optional("fixed_height_relative",n=>{i.constantHeight=n},Oo.decodeRelativeHeight).geometry(n=>{i.bounds=n},$h).success(),(r,e,i)=>r.reset(e).require(Ra,n=>{i.id=n}).require("elevation_idx",n=>{i.idx=n}).require("extent",n=>{i.extent=n}).require("height_relative",n=>{i.height=n},Oo.decodeRelativeHeight).geometry(n=>{i.position=n},Oo.getPoint).success()),gg=new Am((r,e,i)=>r.reset(e).require(Ra,n=>{i.id=n}).optional("fixed_height",n=>{i.constantHeight=n},Oo.decodeMetricHeight).geometry(n=>{i.bounds=n},$h).success(),(r,e,i)=>r.reset(e).require(Ra,n=>{i.id=n}).require("elevation_idx",n=>{i.idx=n}).require("extent",n=>{i.extent=n}).require("height",n=>{i.height=n},Oo.decodeMetricHeight).geometry(n=>{i.position=n},Oo.getPoint).success());class Oo{static getPoint(e){return Qn(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?e==="1.0.1"?gg:void 0:_g}static parse(e){const i=[],n=[],s=e.length,l=new mg;for(let u=0;u<s;u++){const f=e.feature(u),p=f.properties.version,g=Oo.getVersionSchema(p);if(g===void 0){Pt(`Unknown elevation feature version number ${p||"(unknown)"}`);continue}const x=f.properties.type;if(!x)continue;const b=Ns.types[f.type];if(b==="Point"&&x==="curve_point"){const w={};g.parseVertex(l,f,w)&&i.push(w)}else if(b==="Polygon"&&x==="curve_meta"){const w={};g.parseFeature(l,f,w)&&n.push(w)}}return{vertices:i,features:n}}}class rf{constructor(e,i){this.pos=e,this.dir=i}intersectsPlane(e,i,n){const s=yo(i,this.dir);if(Math.abs(s)<1e-6)return!1;const l=((e[0]-this.pos[0])*i[0]+(e[1]-this.pos[1])*i[1])/s;return n[0]=this.pos[0]+this.dir[0]*l,n[1]=this.pos[1]+this.dir[1]*l,!0}}class nf{constructor(e,i){this.pos=e,this.dir=i}intersectsPlane(e,i,n){const s=Xi(i,this.dir);if(Math.abs(s)<1e-6)return!1;const l=((e[0]-this.pos[0])*i[0]+(e[1]-this.pos[1])*i[1]+(e[2]-this.pos[2])*i[2])/s;return n[0]=this.pos[0]+this.dir[0]*l,n[1]=this.pos[1]+this.dir[1]*l,n[2]=this.pos[2]+this.dir[2]*l,!0}closestPointOnSphere(e,i,n){if((function(S,E){var M=S[0],C=S[1],R=S[2],F=E[0],z=E[1],j=E[2];return Math.abs(M-F)<=sn*Math.max(1,Math.abs(M),Math.abs(F))&&Math.abs(C-z)<=sn*Math.max(1,Math.abs(C),Math.abs(z))&&Math.abs(R-j)<=sn*Math.max(1,Math.abs(R),Math.abs(j))})(this.pos,e)||i===0)return n[0]=n[1]=n[2]=0,!1;const[s,l,u]=this.dir,f=this.pos[0]-e[0],p=this.pos[1]-e[1],g=this.pos[2]-e[2],x=s*s+l*l+u*u,b=2*(f*s+p*l+g*u),w=b*b-4*x*(f*f+p*p+g*g-i*i);if(w<0){const S=Math.max(-b/2,0),E=f+s*S,M=p+l*S,C=g+u*S,R=Math.hypot(E,M,C);return n[0]=E*i/R,n[1]=M*i/R,n[2]=C*i/R,!1}{const S=(-b-Math.sqrt(w))/(2*x);if(S<0){const E=Math.hypot(f,p,g);return n[0]=f*i/E,n[1]=p*i/E,n[2]=g*i/E,!1}return n[0]=f+s*S,n[1]=p+l*S,n[2]=g+u*S,!0}}}class Hn{constructor(e,i,n,s,l){this.TL=e,this.TR=i,this.BR=n,this.BL=s,this.horizon=l}static fromInvProjectionMatrix(e,i,n){const s=[-1,1,1],l=[1,1,1],u=[1,-1,1],f=[-1,-1,1],p=Pi(s,s,e),g=Pi(l,l,e),x=Pi(u,u,e),b=Pi(f,f,e);return new Hn(p,g,x,b,i/n)}}function jc(r,e,i,n){const s=e[0],l=e[1],u=e[2],f=i[0],p=i[1],g=i[2];let x=1/0,b=-1/0;for(let w=0;w<r.length;w++){const S=r[w],E=(S[0]-s)*f+(S[1]-l)*p+(S[2]-u)*g;E<x&&(x=E),E>b&&(b=E)}return n[0]=x,n[1]=b,n}function of(r,e){let i=!0;for(let n=0;n<r.planes.length;n++){const s=r.planes[n];let l=0;for(let u=0;u<e.length;u++)l+=+(Xi(s,e[u])+s[3]>=0);if(l===0)return 0;l!==e.length&&(i=!1)}return i?2:1}const yg=[0,0];function Mm(r,e){for(const i of r.projections){const n=jc(e,r.points[0],i.axis,yg);if(i.projection[1]<n[0]||i.projection[0]>n[1])return 0}return 1}function Cm(r,e){const i=e[0],n=e[1],s=e[2],l=e[3];for(let u=0;u<r.length;u++){const f=r[u];if(i*f[0]+n*f[1]+s*f[2]+l>=0)return!0}return!1}class sf{constructor(e,i){this.points=e||new Array(8).fill([0,0,0]),this.planes=i||new Array(6).fill([0,0,0,0]),this.bounds=wi.fromPoints(this.points),this.projections=[],this.frustumEdges=[ki([],this.points[2],this.points[3]),ki([],this.points[0],this.points[3]),ki([],this.points[4],this.points[0]),ki([],this.points[5],this.points[1]),ki([],this.points[6],this.points[2]),ki([],this.points[7],this.points[3])];for(const n of this.frustumEdges){const s=[0,-n[2],n[1]],l=[n[2],0,-n[0]];this.projections.push({axis:s,projection:jc(this.points,this.points[0],s,[0,0])}),this.projections.push({axis:l,projection:jc(this.points,this.points[0],l,[0,0])})}}static fromInvProjectionMatrix(e,i,n,s){const l=Math.pow(2,n),u=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map(g=>{const x=ln([],g,e),b=1/x[3]/i*l;return(w=x)[0]=(S=x)[0]*(E=[b,b,s?1/x[3]:b,b])[0],w[1]=S[1]*E[1],w[2]=S[2]*E[2],w[3]=S[3]*E[3],w;var w,S,E}),f=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(g=>{const x=ui([],kr([],ki([],u[g[0]],u[g[1]]),ki([],u[g[2]],u[g[1]]))),b=-Xi(x,u[g[1]]);return x.concat(b)}),p=[];for(let g=0;g<u.length;g++)p.push([u[g][0],u[g][1],u[g][2]]);return new sf(p,f)}intersectsPrecise(e,i,n){for(let p=0;p<i.length;p++)if(!Cm(e,i[p]))return 0;for(let p=0;p<this.planes.length;p++)if(!Cm(e,this.planes[p]))return 0;const s=this.points,l=s[0][0],u=s[0][1],f=s[0][2];for(const p of n)for(const g of this.frustumEdges){const x=p[1]*g[2]-p[2]*g[1],b=p[2]*g[0]-p[0]*g[2],w=p[0]*g[1]-p[1]*g[0];if(x===0&&b===0&&w===0)continue;let S=1/0,E=-1/0;for(let R=0;R<s.length;R++){const F=s[R],z=(F[0]-l)*x+(F[1]-u)*b+(F[2]-f)*w;z<S&&(S=z),z>E&&(E=z)}let M=1/0,C=-1/0;for(let R=0;R<e.length;R++){const F=e[R],z=(F[0]-l)*x+(F[1]-u)*b+(F[2]-f)*w;z<M&&(M=z),z>C&&(C=z)}if(S>C||M>E)return 0}return 1}containsPoint(e){for(const i of this.planes){const n=i[3];if(Xi([i[0],i[1],i[2]],e)+n<0)return!1}return!0}}class wi{static fromPoints(e){const i=[1/0,1/0,1/0],n=[-1/0,-1/0,-1/0];for(const s of e)vr(i,i,s),bn(n,n,s);return new wi(i,n)}static fromTileIdAndHeight(e,i,n){const s=1<<e.canonical.z,l=e.canonical.x,u=e.canonical.y;return new wi([l/s,u/s,i],[(l+1)/s,(u+1)/s,n])}static applyTransform(e,i){const n=e.getCorners();for(let s=0;s<n.length;++s)Pi(n[s],n[s],i);return wi.fromPoints(n)}static applyTransformFast(e,i){const n=[i[12],i[13],i[14]],s=[...n];for(let l=0;l<3;l++)for(let u=0;u<3;u++){const f=i[4*u+l],p=f*e.min[u],g=f*e.max[u];n[l]+=Math.min(p,g),s[l]+=Math.max(p,g)}return new wi(n,s)}static projectAabbCorners(e,i){const n=e.getCorners();for(let s=0;s<n.length;++s)Pi(n[s],n[s],i);return n}constructor(e,i){this.min=e,this.max=i,this.center=Ci([],er([],this.min,this.max),.5)}quadrant(e){const i=[e%2==0,e<2],n=Xl(this.min),s=Xl(this.max);for(let l=0;l<i.length;l++)n[l]=i[l]?this.min[l]:this.center[l],s[l]=i[l]?this.center[l]:this.max[l];return s[2]=this.max[2],new wi(n,s)}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,i=this.max;return[[e[0],e[1],e[2]],[i[0],e[1],e[2]],[i[0],i[1],e[2]],[e[0],i[1],e[2]],[e[0],e[1],i[2]],[i[0],e[1],i[2]],[i[0],i[1],i[2]],[e[0],i[1],i[2]]]}intersects(e){return this.intersectsAabb(e.bounds)?of(e,this.getCorners()):0}intersectsFlat(e){return this.intersectsAabb(e.bounds)?of(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,i){return i||this.intersects(e)?Mm(e,this.getCorners()):0}intersectsPreciseFlat(e,i){return i||this.intersectsFlat(e)?Mm(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 i=0;i<3;++i)if(this.min[i]>e.max[i]||e.min[i]>this.max[i])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 i=0;i<3;i++)this.min[i]=Math.min(this.min[i],e.min[i]),this.max[i]=Math.max(this.max[i],e.max[i])}encapsulatePoint(e){for(let i=0;i<3;i++)this.min[i]=Math.min(this.min[i],e[i]),this.max[i]=Math.max(this.max[i],e[i])}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])]}}et(wi,"Aabb");class af{constructor(e,i){this.feature=e,this.metersToTile=i,this.index=0}get(){const e=this.feature.vertices[this.index],i=this.feature.vertexProps[this.index].dir,n=i[1],s=-i[0],l=(e.extent+1)*this.metersToTile;return[new Ue(Math.trunc(e.position[0]+n*l),Math.trunc(e.position[1]+s*l)),new Ue(Math.trunc(e.position[0]-n*l),Math.trunc(e.position[1]-s*l))]}next(){this.index++}valid(){return this.index<this.feature.vertices.length}}class Pm{constructor(e,i,n,s,l,u){if(this.vertices=new Array,this.vertexProps=new Array,this.edges=new Array,this.edgeProps=new Array,this._tmpVec2=[Nr(),Nr(),Nr(),Nr(),Nr(),Nr(),Nr()],this.id=e,this.heightRange={min:n,max:n},this.safeArea=i,this.constantHeight=n,this.constantHeight==null&&(this.constantHeight!=null||s.length!==0)){this.vertices=s,this.edges=l,this.edges=this.edges.filter(f=>{return f.a<this.vertices.length&&f.b<this.vertices.length&&!((p=this.vertices[f.a].position)[0]===(g=this.vertices[f.b].position)[0]&&p[1]===g[1]);var p,g}),this.heightRange={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};for(const f of this.vertices)this.vertexProps.push({dir:Qn(0,0)}),this.heightRange.min=Math.min(this.heightRange.min,f.height),this.heightRange.max=Math.max(this.heightRange.max,f.height);for(const f of this.edges){const p=this.vertices[f.a].position,g=this.vertices[f.b].position,x=eo(Nr(),g,p),b=na(x),w=ra(Nr(),x,1/b);this.edgeProps.push({vec:x,dir:w,len:b});const S=this.vertexProps[f.a].dir,E=this.vertexProps[f.b].dir;ia(S,S,w),ia(E,E,w)}for(const f of this.vertexProps)f.dir[0]===0&&f.dir[1]===0||ec(f.dir,f.dir);this.tessellate(u)}}pointElevation(e){if(this.constantHeight!=null)return this.constantHeight;const i=this.getClosestEdge(e);if(i==null)return 0;const[n,s]=i;return ft(this.vertices[this.edges[n].a].height,this.vertices[this.edges[n].b].height,s)}computeSlopeNormal(e,i){const n=this.getClosestEdge(e);if(!n)return wr(0,0,1);const s=n[0],l=this.edges[s],u=this.edgeProps[s].vec,f=wr(u[0],u[1],(this.vertices[l.b].height-this.vertices[l.a].height)*i),p=wr(f[1],-f[0],0);kr(p,p,f);const g=xr(p);return g>0?Ci(p,p,1/g):Ti(p,0,0,1)}getSafeArea(){return this.safeArea}isTunnel(){return this.heightRange.max<=-5}getClosestEdge(e){if(this.edges.length===0)return;let i=0,n=Number.POSITIVE_INFINITY,s=0;const[l,u,f,p,g,x,b]=this._tmpVec2;Zo(b,e.x,e.y);const w=new rf(b,null);for(let S=0;S<this.edges.length;S++){const E=this.edges[S],M=this.edgeProps[S].dir;w.dir=M;const C=this.vertices[E.a].position,R=this.vertices[E.b].position,F=w.intersectsPlane(C,this.vertexProps[E.a].dir,l),z=w.intersectsPlane(R,this.vertexProps[E.b].dir,u);if(!F||!z)continue;eo(f,u,l),eo(p,b,l);const j=yo(f,f),$=j>0?yo(p,f)/j:0,q=re($,0,1),ie=Math.abs(($-q)*this.edgeProps[S].len);eo(g,b,C),Zo(x,M[1],-M[0]);const W=ie+Math.abs(yo(g,x));W<n&&(i=S,n=W,s=q)}return[i,s]}tessellate(e){const i=ni(),n=ni(),s=ni(),l=ni();for(let u=this.edges.length-1;u>=0;--u){const f=this.edges[u].a,p=this.edges[u].b,{position:g,height:x,extent:b}=this.vertices[f],{position:w,height:S,extent:E}=this.vertices[p],M=this.vertexProps[f].dir,C=this.vertexProps[p].dir;if(Ti(i,g[0]/e,g[1]/e,x),Ti(n,w[0]/e,w[1]/e,S),Ti(s,M[1],-M[0],0),Ci(s,s,b),Ti(l,C[1],-C[0],0),Ci(l,l,E),this.distSqLines(wr(i[0]+.5*s[0],i[1]+.5*s[1],i[2]+.5*s[2]),wr(n[0]-.5*l[0],n[1]-.5*l[1],n[2]-.5*l[2]),wr(i[0]-.5*s[0],i[1]-.5*s[1],i[2]-.5*s[2]),wr(n[0]+.5*l[0],n[1]+.5*l[1],n[2]+.5*l[2]))<=.0025000000000000005)continue;const R=this.vertices.length,F=ia(Nr(),g,w);this.vertices.push({position:ra(F,F,.5),height:.5*(x+S),extent:.5*(b+E)});const z=ia(Nr(),M,C);this.vertexProps.push({dir:ec(z,z)}),this.edges.splice(u,1),this.edgeProps.splice(u,1),this.edges.push({a:f,b:R}),this.edges.push({a:R,b:p});const j=eo(Nr(),this.vertices[R].position,g),$=na(j),q={vec:j,dir:ra(Nr(),j,1/$),len:$};this.edgeProps.push(q),this.edgeProps.push(q)}}distSqLines(e,i,n,s){const l=Jn(ni(),i,e),u=Jn(ni(),s,n),f=Jn(ni(),e,n),p=Xi(l,l),g=Xi(l,u),x=Xi(l,f),b=Xi(u,u),w=Xi(u,f),S=p*b-g*g;if(S===0)return Ho(Ks(l,n,s,Xi(f,u)/Xi(u,u)),e);const E=(p*w-g*x)/S;return Ho(Ks(l,e,i,(g*w-x*b)/S),Ks(u,n,s,E))}}class a{static parseFrom(e,i){const n=Oo.parse(e);if(!n)return[];let{vertices:s,features:l}=n;const u=1/Cn(i);l.sort((x,b)=>x.id-b.id),s.sort((x,b)=>x.id-b.id||x.idx-b.idx),s=s.filter((x,b,w)=>b===w.findIndex(S=>S.id===x.id&&S.idx===x.idx));const f=new Array;let p=0;const g=s.length;for(const x of l){if(x.constantHeight){f.push(new Pm(x.id,x.bounds,x.constantHeight));continue}for(;p!==g&&s[p].id<x.id;)p++;if(p===g||s[p].id!==x.id)continue;const b=new Array,w=new Array,S=p;for(;p!==g&&s[p].id===x.id;){const E=s[p];if(b.push({position:E.position,height:E.height,extent:E.extent}),p!==S&&s[p-1].idx===E.idx-1){const M=p-S;w.push({a:M-1,b:M})}p++}f.push(new Pm(x.id,x.bounds,void 0,b,w,u))}return f}static getElevationFeature(e,i){if(!i)return;const n=+e.properties[Ra];return Number.isNaN(n)?void 0:i.find(s=>s.id===n)}}class t{constructor(e,i){this.zScale=1,this.xOffset=0,this.yOffset=0,e.equals(i)||(this.zScale=Math.pow(2,i.z-e.z),this.xOffset=(e.x*this.zScale-i.x)*Xe,this.yOffset=(e.y*this.zScale-i.y)*Xe)}constantElevation(e,i){if(e.constantHeight!=null)return this.computeBiasedHeight(e.constantHeight,i)}pointElevation(e,i,n){const s=this.constantElevation(i,n);return s??(e.x=e.x*this.zScale+this.xOffset,e.y=e.y*this.zScale+this.yOffset,this.computeBiasedHeight(i.pointElevation(e),n))}computeBiasedHeight(e,i){return i<=0?e:e+i*ye(0,i,e>=0?e:Math.abs(.5*e))}}function o(r){if(r===0)return[0,0,0];const e=ld(r);return[e(),e(),e()]}et(Pm,"ElevationFeature");class c{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(i=>i.fqid),this.index=e.index,this.hasPattern=!1,this.projection=e.projection,this.layoutVertexArray=new Nn,this.indexArray=new Ai,this.segments=new di,this.programConfigurations=new An(e.layers,{zoom:e.zoom,lut:e.lut}),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.elevationMode=this.layers[0].layout.get("circle-elevation-reference"),this.hasElevation=!1,this.elevationMode!=="none"&&(this.elevatedLayoutVertexArray=new Sr),this.worldview=e.worldview,this.hasAppearances=null}updateFootprints(e,i){}updateAppearances(e,i,n,s){return{hasLayoutChanges:!1,hasUboChanges:!1}}populate(e,i,n,s){const l=this.layers[0],u=[];let f=null;l.type==="circle"&&(f=l.layout.get("circle-sort-key"));for(const{feature:g,id:x,index:b,sourceLayerIndex:w}of e){const S=this.layers[0]._featureFilter.needGeometry,E=$n(g,S);if(!this.layers[0]._featureFilter.filter(new Wt(this.zoom,{worldview:this.worldview,activeFloors:i.activeFloors}),E,n))continue;const M=f?f.evaluate(E,{},n):void 0,C={id:x,properties:g.properties,type:g.type,sourceLayerIndex:w,index:b,geometry:S?E.geometry:gn(g,n,s),patterns:{},sortKey:M};u.push(C)}f&&u.sort((g,x)=>g.sortKey-x.sortKey);let p=null;s.projection.name==="globe"&&(this.globeExtVertexArray=new Ku,p=s.projection);for(const g of u){const{geometry:x,index:b,sourceLayerIndex:w}=g,S=e[b].feature;this.addFeature(g,x,b,i.availableImages,n,p,i.brightness,i.elevationFeatures),i.featureIndex.insert(S,x,b,w,this.index)}this.hasElevation||(this.elevatedLayoutVertexArray=void 0)}update(e,i,n,s,l,u,f){this.programConfigurations.updatePaintArrays(e,i,l,n,s,u,f,this.worldview)}updateExpressions(e){this.programConfigurations.updateExpressions(e)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,ng.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.globeExtVertexArray&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,sg.members)),this.elevatedLayoutVertexArray&&(this.elevatedLayoutVertexBuffer=e.createVertexBuffer(this.elevatedLayoutVertexArray,og.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,i,n,s,l,u,f,p){let g;this.elevationMode!=="none"&&(g=a.getElevationFeature(e,p));for(const x of i)for(const b of x){const w=b.x,S=b.y;if(w<0||w>=Xe||S<0||S>=Xe)continue;if(u){const C=u.projectTilePoint(w,S,l),R=u.upVector(l,w,S);this.addGlobeExtVertex(C,R),this.addGlobeExtVertex(C,R),this.addGlobeExtVertex(C,R),this.addGlobeExtVertex(C,R)}const E=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),M=E.vertexLength;if(this.addCircleVertex(w,S,-1,-1),this.addCircleVertex(w,S,1,-1),this.addCircleVertex(w,S,1,1),this.addCircleVertex(w,S,-1,1),this.elevationMode!=="none"){const C=g?g.pointElevation(new Ue(w,S)):0;this.hasElevation=this.hasElevation||C!==0;for(let R=0;R<4;R++)this.elevatedLayoutVertexArray.emplaceBack(C)}this.indexArray.emplaceBack(M,M+1,M+2),this.indexArray.emplaceBack(M,M+2,M+3),E.vertexLength+=4,E.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,{},s,l,f,void 0,this.worldview)}addCircleVertex(e,i,n,s){this.layoutVertexArray.emplaceBack(2*e+(n+1)/2,2*i+(s+1)/2)}addGlobeExtVertex(e,i){this.globeExtVertexArray.emplaceBack(e.x,e.y,e.z,i[0]*16384,i[1]*16384,i[2]*16384)}}function d(r,e){for(let i=0;i<r.length;i++)if(L(e,r[i]))return!0;for(let i=0;i<e.length;i++)if(L(r,e[i]))return!0;return!!v(r,e)}function m(r,e,i){return!!L(r,e)||!!A(e,r,i)}function _(r,e){if(r.length===1)return O(e,r[0]);for(let i=0;i<e.length;i++){const n=e[i];for(let s=0;s<n.length;s++)if(L(r,n[s]))return!0}for(let i=0;i<r.length;i++)if(O(e,r[i]))return!0;for(let i=0;i<e.length;i++)if(v(r,e[i]))return!0;return!1}function y(r,e,i){if(r.length>1){if(v(r,e))return!0;for(let n=0;n<e.length;n++)if(A(e[n],r,i))return!0}for(let n=0;n<r.length;n++)if(A(r[n],e,i))return!0;return!1}function v(r,e){if(r.length===0||e.length===0)return!1;for(let i=0;i<r.length-1;i++){const n=r[i],s=r[i+1];for(let l=0;l<e.length-1;l++)if(T(n,s,e[l],e[l+1]))return!0}return!1}function T(r,e,i,n){return hi(r,i,n)!==hi(e,i,n)&&hi(r,e,i)!==hi(r,e,n)}function I(r,e,i){return(r.x-i.x)*(e.y-i.y)-(r.y-i.y)*(e.x-i.x)}function P(r,e,i,n){const s=I(r,e,n),l=I(r,e,i);if(Math.sign(s)===Math.sign(l))return;const u=I(i,n,r),f=u+l-s;return Math.sign(u)!==Math.sign(f)?[u/(u-f),l/(l-s)]:void 0}function A(r,e,i){const n=i*i;if(e.length===1)return r.distSqr(e[0])<n;for(let s=1;s<e.length;s++)if(D(r,e[s-1],e[s])<n)return!0;return!1}function D(r,e,i){const n=e.distSqr(i);if(n===0)return r.distSqr(e);const s=((r.x-e.x)*(i.x-e.x)+(r.y-e.y)*(i.y-e.y))/n;return r.distSqr(s<0?e:s>1?i:i.sub(e)._mult(s)._add(e))}function O(r,e){let i,n,s,l=!1;for(let u=0;u<r.length;u++){i=r[u];for(let f=0,p=i.length-1;f<i.length;p=f++)n=i[f],s=i[p],n.y>e.y!=s.y>e.y&&e.x<(s.x-n.x)*(e.y-n.y)/(s.y-n.y)+n.x&&(l=!l)}return l}function L(r,e){let i=!1;for(let n=0,s=r.length-1;n<r.length;s=n++){const l=r[n],u=r[s];l.y>e.y!=u.y>e.y&&e.x<(u.x-l.x)*(e.y-l.y)/(u.y-l.y)+l.x&&(i=!i)}return i}function k(r,e,i,n,s){for(const u of r)if(e<=u.x&&i<=u.y&&n>=u.x&&s>=u.y)return!0;const l=[new Ue(e,i),new Ue(e,s),new Ue(n,s),new Ue(n,i)];if(r.length>2){for(const u of l)if(L(r,u))return!0}for(let u=0;u<r.length-1;u++)if(N(r[u],r[u+1],l))return!0;return!1}function N(r,e,i){const n=i[0],s=i[2];if(r.x<n.x&&e.x<n.x||r.x>s.x&&e.x>s.x||r.y<n.y&&e.y<n.y||r.y>s.y&&e.y>s.y)return!1;const l=hi(r,e,i[0]);return l!==hi(r,e,i[1])||l!==hi(r,e,i[2])||l!==hi(r,e,i[3])}function H(r,e,i,n,s,l){let u=e.y-r.y,f=r.x-e.x;if(l=l||0){const p=u*u+f*f;if(p===0)return!0;const g=Math.sqrt(p);u/=g,f/=g}return!((i.x-r.x)*u+(i.y-r.y)*f-l<0||(n.x-r.x)*u+(n.y-r.y)*f-l<0||(s.x-r.x)*u+(s.y-r.y)*f-l<0)}function Z(r,e,i,n,s,l,u){return!(H(r,e,n,s,l,u)||H(e,i,n,s,l,u)||H(i,r,n,s,l,u)||H(n,s,r,e,i,u)||H(s,l,r,e,i,u)||H(l,n,r,e,i,u))}function G(r,e,i){const n=e.paint.get(r).value;return n.kind==="constant"?n.value:i.programConfigurations.get(e.id).getMaxValue(r)}function ne(r){return Math.sqrt(r[0]*r[0]+r[1]*r[1])}function te(r,e,i,n,s){if(!e[0]&&!e[1])return r;const l=Ue.convert(e)._mult(s);i==="viewport"&&l._rotate(-n);const u=[];for(let f=0;f<r.length;f++)u.push(r[f].sub(l));return u}function se(r,e,i,n){const s=Ue.convert(r)._mult(n);return e==="viewport"&&s._rotate(-i),s}let J,K;et(c,"CircleBucket",{omit:["layers"]});class oe{constructor(e,i,n){this.z=e,this.x=i,this.y=n,this.key=ve(0,e,e,i,n)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}isChildOf(e){const i=this.z-e.z;return e.z===0||e.z<this.z&&e.x===this.x>>i&&e.y===this.y>>i}url(e,i){const n=(function(l,u,f){const p=2**f,g=2*Math.PI*6378137,x=g*(l/p-.5),b=g*(.5-(u+1)/p);return`${x},${b},${x+g/p},${b+g/p}`})(this.x,this.y,this.z),s=(function(l,u,f){let p,g="";for(let x=l;x>0;x--)p=1<<x-1,g+=(u&p?1:0)+(f&p?2:0);return g})(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(i==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace("{quadkey}",s).replace("{bbox-epsg-3857}",n)}toString(){return`${this.z}/${this.x}/${this.y}`}}class de{constructor(e,i){this.wrap=e,this.canonical=i,this.key=ve(e,i.z,i.z,i.x,i.y)}}class ue{constructor(e,i,n,s,l){this.overscaledZ=e,this.wrap=i,this.canonical=new oe(n,+s,+l),this.key=i===0&&e===n?this.canonical.key:ve(i,e,n,s,l)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){const i=this.canonical.z-e;return e>this.canonical.z?new ue(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new ue(e,this.wrap,e,this.canonical.x>>i,this.canonical.y>>i)}calculateScaledKey(e,i=!0){if(this.overscaledZ===e&&i)return this.key;if(e>this.canonical.z)return ve(this.wrap*+i,e,this.canonical.z,this.canonical.x,this.canonical.y);{const n=this.canonical.z-e;return ve(this.wrap*+i,e,e,this.canonical.x>>n,this.canonical.y>>n)}}isChildOf(e){if(e.wrap!==this.wrap)return!1;const i=this.canonical.z-e.canonical.z;return e.overscaledZ===0||e.overscaledZ<this.overscaledZ&&e.canonical.z<this.canonical.z&&e.canonical.x===this.canonical.x>>i&&e.canonical.y===this.canonical.y>>i}children(e){if(this.overscaledZ>=e)return[new ue(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const i=this.canonical.z+1,n=2*this.canonical.x,s=2*this.canonical.y;return[new ue(i,this.wrap,i,n,s),new ue(i,this.wrap,i,n+1,s),new ue(i,this.wrap,i,n,s+1),new ue(i,this.wrap,i,n+1,s+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 ue(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new ue(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 de(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}}function ve(r,e,i,n,s){const l=1<<Math.min(i,22);let u=l*(s%l)+n%l;return r&&i<22&&(u+=l*l*((r<0?-2*r-1:2*r)%(1<<2*(22-i)))),16*(32*u+i)+(e-i)}const be=[r=>{let e=r.canonical.x-1,i=r.wrap;return e<0&&(e=(1<<r.canonical.z)-1,i--),new ue(r.overscaledZ,i,r.canonical.z,e,r.canonical.y)},r=>{let e=r.canonical.x+1,i=r.wrap;return e===1<<r.canonical.z&&(e=0,i++),new ue(r.overscaledZ,i,r.canonical.z,e,r.canonical.y)},r=>new ue(r.overscaledZ,r.wrap,r.canonical.z,r.canonical.x,(r.canonical.y===0?1<<r.canonical.z:r.canonical.y)-1),r=>new ue(r.overscaledZ,r.wrap,r.canonical.z,r.canonical.x,r.canonical.y===(1<<r.canonical.z)-1?0:r.canonical.y+1)];et(oe,"CanonicalTileID"),et(ue,"OverscaledTileID",{omit:["projMatrix","expandedProjMatrix"]});const ke=Rt([{type:"Float32",name:"a_globe_pos",components:3},{type:"Float32",name:"a_uv",components:2}]),{members:fe}=ke,Ee=Rt([{name:"a_pos_3",components:3,type:"Int16"}]);var pe=Rt([{name:"a_pos",type:"Int16",components:2}]);function Pe(r){return r*Lr/Pa}const Ce=[new wi([Mn,Mn,Mn],[Gn,Gn,Gn]),new wi([Mn,Mn,Mn],[0,0,Gn]),new wi([0,Mn,Mn],[Gn,0,Gn]),new wi([Mn,0,Mn],[0,Gn,Gn]),new wi([0,0,Mn],[Gn,Gn,Gn])];function Re(r,e,i,n=!0){const s=Ci([],r._camera.position,r.worldSize),l=[e,i,1,1];ln(l,l,r.pixelMatrixInverse),ea(l,l,1/l[3]);const u=ui([],ki([],l,s)),f=r.globeMatrix,p=[f[12],f[13],f[14]],g=ki([],p,s),x=xr(g),b=ui([],g),w=r.worldSize/(2*Math.PI),S=Xi(b,u),E=Math.asin(w/x);if(E<Math.acos(S)){if(!n)return null;const Y=[],ee=[];Ci(Y,u,x/S),ui(ee,ki(ee,Y,g)),ui(u,er(u,g,Ci(u,ee,Math.tan(E)*x)))}const M=[];new nf(s,u).closestPointOnSphere(p,w,M);const C=ui([],Yi(f,0)),R=ui([],Yi(f,1)),F=ui([],Yi(f,2)),z=Xi(C,M),j=Xi(R,M),$=Xi(F,M),q=X(Math.asin(-j/w));let ie=X(Math.atan2(z,$));ie=r.center.lng+(function(Y,ee){const me=(ee-Y+180)%360-180;return me<-180?me+360:me})(r.center.lng,ie);const W=as(ie),Q=re(Lo(q),0,1);return new Or(W,Q)}class Ye{constructor(e,i,n){this.a=ki([],e,n),this.b=ki([],i,n),this.center=n;const s=ui([],this.a),l=ui([],this.b);this.angle=Math.acos(Xi(s,l))}}function qe(r,e){if(r.angle===0)return null;let i;return i=r.a[e]===0?1/r.angle*.5*Math.PI:1/r.angle*Math.atan(r.b[e]/r.a[e]/Math.sin(r.angle)-1/Math.tan(r.angle)),i<0||i>1?null:(function(n,s,l,u){const f=Math.sin(l);return n*(Math.sin((1-u)*l)/f)+s*(Math.sin(u*l)/f)})(r.a[e],r.b[e],r.angle,re(i,0,1))+r.center[e]}function je(r){if(r.z<=1)return Ce[r.z+2*r.y+r.x];const e=ht(it(r));return wi.fromPoints(e)}function Be(r,e,i){return Ci(r,r,1-i),wn(r,r,e,i)}function at(r,e){const i=oi(e.zoom);if(i===0)return je(r);const n=it(r),s=ht(n),l=as(n.getWest())*e.worldSize,u=as(n.getEast())*e.worldSize,f=Lo(n.getNorth())*e.worldSize,p=Lo(n.getSouth())*e.worldSize,g=[l,f,0],x=[u,f,0],b=[l,p,0],w=[u,p,0],S=an([],e.globeMatrix);return Pi(g,g,S),Pi(x,x,S),Pi(b,b,S),Pi(w,w,S),s[0]=Be(s[0],b,i),s[1]=Be(s[1],w,i),s[2]=Be(s[2],x,i),s[3]=Be(s[3],g,i),wi.fromPoints(s)}function ot(r,e,i){for(const n of r)Pi(n,n,e),Ci(n,n,i)}function tt(r,e,i,n){const s=e/r.worldSize,l=r.globeMatrix;if(i.z<=1){const Q=je(i).getCorners();return ot(Q,l,s),wi.fromPoints(Q)}const u=it(i,n),f=ht(u,Lr+Pe(r._tileCoverLift));ot(f,l,s);const p=Number.MAX_VALUE,g=[-p,-p,-p],x=[p,p,p];if(u.contains(r.center)){for(const ee of f)vr(x,x,ee),bn(g,g,ee);g[2]=0;const Q=r.point,Y=[Q.x*s,Q.y*s,0];return vr(x,x,Y),bn(g,g,Y),new wi(x,g)}if(r._tileCoverLift>0){for(const Q of f)vr(x,x,Q),bn(g,g,Q);return new wi(x,g)}const b=[l[12]*s,l[13]*s,l[14]*s],w=u.getCenter(),S=re(r.center.lat,-85.051129,_n),E=re(w.lat,-85.051129,_n),M=as(r.center.lng),C=Lo(S);let R=M-as(w.lng);const F=C-Lo(E);R>.5?R-=1:R<-.5&&(R+=1);let z=0;Math.abs(R)>Math.abs(F)?z=R>=0?1:3:(z=F>=0?0:2,wn(b,b,[l[4]*s,l[5]*s,l[6]*s],-Math.sin(V(F>=0?u.getSouth():u.getNorth()))*Lr));const j=f[z],$=f[(z+1)%4],q=new Ye(j,$,b),ie=[qe(q,0)||j[0],qe(q,1)||j[1],qe(q,2)||j[2]],W=oi(r.zoom);if(W>0){const Q=(function({x:ee,y:me,z:ge},Te,Ae,Ie,Fe){const xe=1/(1<<ge);let Se=ee*xe,Me=Se+xe,ze=me*xe,Le=ze+xe,We=0;const De=(Se+Me)/2-Ie;return De>.5?We=-1:De<-.5&&(We=1),Se=((Se+We)*Te-(Ie*=Te))*Ae+Ie,Me=((Me+We)*Te-Ie)*Ae+Ie,ze=(ze*Te-(Fe*=Te))*Ae+Fe,Le=(Le*Te-Fe)*Ae+Fe,[[Se,Le,0],[Me,Le,0],[Me,ze,0],[Se,ze,0]]})(i,e,r._pixelsPerMercatorPixel,M,C);for(let ee=0;ee<f.length;ee++)Be(f[ee],Q[ee],W);const Y=er([],Q[z],Q[(z+1)%4]);Ci(Y,Y,.5),Be(ie,Y,W)}for(const Q of f)vr(x,x,Q),bn(g,g,Q);return x[2]=Math.min(j[2],$[2]),vr(x,x,ie),bn(g,g,ie),new wi(x,g)}function it({x:r,y:e,z:i},n=!1){const s=1/(1<<i),l=new Zt(mn(r*s),e===(1<<i)-1&&n?-90:pr((e+1)*s)),u=new Zt(mn((r+1)*s),e===0&&n?90:pr(e*s));return new ks(l,u)}function ht(r,e=Lr){const i=V(r.getNorth()),n=V(r.getSouth()),s=Math.cos(i),l=Math.cos(n),u=Math.sin(i),f=Math.sin(n),p=r.getWest(),g=r.getEast();return[Bs(l,f,p,e),Bs(l,f,g,e),Bs(s,u,g,e),Bs(s,u,p,e)]}function xt(r,e,i,n){const s=1<<i.z,l=(r/Xe+i.x)/s;return zo(pr((e/Xe+i.y)/s),mn(l),n)}function yt({min:r,max:e}){return 16383/Math.max(e[0]-r[0],e[1]-r[1],e[2]-r[2])}const St=new Float64Array(16);function _t(r){const e=yt(r),i=$o(St,[e,e,e]);return Cr(i,i,Kn([],r.min))}function Bt(r){const e=1/yt(r);return _s(St,r.min),Br(St,St,[e,e,e])}function bt(r){const e=Xe/(2*Math.PI);return r/(2*Math.PI)/e}function Vt(r,e){return Xe/(512*Math.pow(2,r))*yt(je(e))}function ii(r,e,i,n,s){const l=bt(i),u=[r,e,-i/(2*Math.PI)],f=Ot(new Float64Array(16));return Cr(f,f,u),Br(f,f,[l,l,l]),jo(f,f,V(-s)),Go(f,f,V(-n)),f}function oi(r){return ye(5,6,r)}function si(r,e){const i=zo(e.lat,e.lng),n=(function(E){const M=zo(E._center.lat,E._center.lng);let C=kr([],wr(0,1,0),M);const R=Ys([],-E.angle,M);C=Pi(C,C,R),Ys(R,-E._pitch,C);const F=ui([],M);return Ci(F,F,Pe(E.cameraToCenterDistance/E.pixelsPerMeter)),Pi(F,F,R),er([],M,F)})(r);return u=(s=Jn([],n,i))[0],f=s[1],p=s[2],g=(l=i)[0],x=l[1],b=l[2],S=(w=Math.sqrt((u*u+f*f+p*p)*(g*g+x*x+b*b)))&&Xi(s,l)/w,Math.acos(Math.min(Math.max(S,-1),1));var s,l,u,f,p,g,x,b,w,S}function $t(r,e){return si(r,e)>Math.PI/2*1.01}const It=V(85),At=Math.cos(It),ai=Math.sin(It),Ri=Na(),Qt=r=>{const e=[];return r.paint.get("circle-pitch-alignment")==="map"&&e.push("PITCH_WITH_MAP"),r.paint.get("circle-pitch-scale")==="map"&&e.push("SCALE_WITH_MAP"),e};function vt(r,e,i,n,s,l,u,f,p){if(l&&r.queryGeometry.isAboveHorizon)return!1;l&&(p*=r.pixelToTileUnitsFactor);const g=r.tileID.canonical,x=i.projection.upVectorScale(g,i.center.lat,i.worldSize).metersToTile;for(const b of e)for(const w of b){const S=w.add(f),E=s&&i.elevation?i.elevation.exaggeration()*s.getElevationAt(S.x,S.y,!0):0,M=i.projection.projectTilePoint(S.x,S.y,g);if(E>0){const z=i.projection.upVector(g,S.x,S.y);M.x+=z[0]*x*E,M.y+=z[1]*x*E,M.z+=z[2]*x*E}const C=l?S:yi(M.x,M.y,M.z,n),R=l?r.tilespaceRays.map(z=>Nt(z,E)):r.queryGeometry.screenGeometry,F=ln([],[M.x,M.y,M.z,1],n);if(!u&&l?p*=F[3]/i.cameraToCenterDistance:u&&!l&&(p*=i.cameraToCenterDistance/F[3]),l){const z=pr((w.y/Xe+g.y)/(1<<g.z));p/=i.projection.pixelsPerMeter(z,1)/Yr(1,z)}if(m(R,C,p))return!0}return!1}function yi(r,e,i,n){const s=ln([],[r,e,i,1],n);return new Ue(s[0]/s[3],s[1]/s[3])}const li=wr(0,0,0),Li=wr(0,0,1);function Nt(r,e){const i=ni();return li[2]=e,r.intersectsPlane(li,Li,i),new Ue(i[0],i[1])}class qi extends c{}let Ir,sr,mr,tr;function Jr(r,{width:e,height:i},n,s){if(s){if(s instanceof Uint8ClampedArray)s=new Uint8Array(s.buffer);else if(s.length!==e*i*n)throw new RangeError("mismatched image size")}else s=new Uint8Array(e*i*n);return r.width=e,r.height=i,r.data=s,r}function Kr(r,e,i){const{width:n,height:s}=e;n===r.width&&s===r.height||(Ki(r,e,{x:0,y:0},{x:0,y:0},{width:Math.min(r.width,n),height:Math.min(r.height,s)},i,null),r.width=n,r.height=s,r.data=e.data)}function Ki(r,e,i,n,s,l,u,f){if(s.width===0||s.height===0)return e;if(s.width>r.width||s.height>r.height||i.x>r.width-s.width||i.y>r.height-s.height)throw new RangeError("out of range source coordinates for image copy");if(s.width>e.width||s.height>e.height||n.x>e.width-s.width||n.y>e.height-s.height)throw new RangeError("out of range destination coordinates for image copy");const p=r.data,g=e.data,x=l===4&&f;for(let b=0;b<s.height;b++){const w=((i.y+b)*r.width+i.x)*l,S=((n.y+b)*e.width+n.x)*l;if(x)for(let E=0;E<s.width;E++){const M=w+E*l+3,C=S+E*l;g[C+0]=255,g[C+1]=255,g[C+2]=255,g[C+3]=p[M]}else if(u)for(let E=0;E<s.width;E++){const M=w+E*l,C=S+E*l,R=new qt(p[M+0]/255,p[M+1]/255,p[M+2]/255,p[M+3]).toNonPremultipliedRenderColor(u).toArray();g[C+0]=R[0],g[C+1]=R[1],g[C+2]=R[2],g[C+3]=R[3]}else for(let E=0;E<s.width*l;E++)g[S+E]=p[w+E]}return e}et(qi,"HeatmapBucket",{omit:["layers"]});class Fr{constructor(e,i){Jr(this,e,1,i)}resize(e){Kr(this,new Fr(e),1)}clone(){return new Fr({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,i,n,s,l){Ki(e,i,n,s,l,1,null)}}class Ht{constructor(e,i){Jr(this,e,4,i)}resize(e){Kr(this,new Ht(e),4)}replace(e,i){i?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new Ht({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,i,n,s,l,u,f){Ki(e,i,n,s,l,4,u,f)}}class ri{constructor(e,i){this.width=e.width,this.height=e.height,this.data=i instanceof Uint8Array?new Float32Array(i.buffer):i}}function Xt(r){const e={},i=r.resolution||256,n=r.clips?r.clips.length:1,s=r.image||new Ht({width:i,height:n}),l=(u,f,p)=>{e[r.evaluationKey]=p;const g=r.expression.evaluate(e),x=g?g.toNonPremultipliedRenderColor(null):null;x&&(s.data[u+f+0]=Math.floor(255*x.r),s.data[u+f+1]=Math.floor(255*x.g),s.data[u+f+2]=Math.floor(255*x.b),s.data[u+f+3]=Math.floor(255*x.a))};if(r.clips)for(let u=0,f=0;u<n;++u,f+=4*i)for(let p=0,g=0;p<i;p++,g+=4){const x=p/(i-1),{start:b,end:w}=r.clips[u];l(f,g,b*(1-x)+w*x)}else for(let u=0,f=0;u<i;u++,f+=4)l(0,f,u/(i-1));return s}et(Fr,"AlphaImage"),et(Ht,"RGBAImage");const Zi=Rt([{name:"a_pos",components:2,type:"Int16"}],4),hr=Rt([{name:"a_road_z_offset",components:1,type:"Float32"}],4),zi=Rt([{name:"a_pos",components:2,type:"Int16"},{name:"a_height",components:1,type:"Float32"}],4),jr=Rt([{name:"a_pos_normal_3",components:3,type:"Int16"}],4);function Gr(r,e,i=2){const n=e&&e.length,s=n?e[0]*i:r.length;let l=uo(r,0,s,i,!0);const u=[];
vendor: 3,197 bytes, line 7
7if(!l||l.next===l.prev)return u;let f,p,g;if(n&&(l=(function(x,b,w,S){const E=[];for(let M=0,C=b.length;M<C;M++){const R=uo(x,b[M]*S,M<C-1?b[M+1]*S:x.length,S,!1);R===R.next&&(R.steiner=!0),E.push(xg(R))}E.sort(za);for(let M=0;M<E.length;M++)w=lf(E[M],w);return w})(r,e,l,i)),r.length>80*i){f=r[0],p=r[1];let x=f,b=p;for(let w=i;w<s;w+=i){const S=r[w],E=r[w+1];S<f&&(f=S),E<p&&(p=E),S>x&&(x=S),E>b&&(b=E)}g=Math.max(x-f,b-p),g=g!==0?32767/g:0}return Pn(l,u,i,f,p,g,0),u}function uo(r,e,i,n,s){let l;if(s===(function(u,f,p,g){let x=0;for(let b=f,w=p-g;b<p;b+=g)x+=(u[w]-u[b])*(u[b+1]+u[w+1]),w=b;return x})(r,e,i,n)>0)for(let u=e;u<i;u+=n)l=qy(u/n|0,r[u],r[u+1],l);else for(let u=i-n;u>=e;u-=n)l=qy(u/n|0,r[u],r[u+1],l);return l&&uh(l,l.next)&&(df(l),l=l.next),l}function yn(r,e){if(!r)return r;e||(e=r);let i,n=r;do if(i=!1,n.steiner||!uh(n,n.next)&&_r(n.prev,n,n.next)!==0)n=n.next;else{if(df(n),n=e=n.prev,n===n.next)break;i=!0}while(i||n!==e);return e}function Pn(r,e,i,n,s,l,u){if(!r)return;!u&&l&&(function(p,g,x,b){let w=p;do w.z===0&&(w.z=ch(w.x,w.y,g,x,b)),w.prevZ=w.prev,w.nextZ=w.next,w=w.next;while(w!==p);w.prevZ.nextZ=null,w.prevZ=null,(function(S){let E,M=1;do{let C,R=S;S=null;let F=null;for(E=0;R;){E++;let z=R,j=0;for(let q=0;q<M&&(j++,z=z.nextZ,z);q++);let $=M;for(;j>0||$>0&&z;)j!==0&&($===0||!z||R.z<=z.z)?(C=R,R=R.nextZ,j--):(C=z,z=z.nextZ,$--),F?F.nextZ=C:S=C,C.prevZ=F,F=C;R=z}F.nextZ=null,M*=2}while(E>1)})(w)})(r,n,s,l);let f=r;for(;r.prev!==r.next;){const p=r.prev,g=r.next;if(l?ho(r,n,s,l):ls(r))e.push(p.i,r.i,g.i),df(r),r=g.next,f=g.next;else if((r=g)===f){u?u===1?Pn(r=Gc(yn(r),e),e,i,n,s,l,2):u===2&&Us(r,e,i,n,s,l):Pn(yn(r),e,i,n,s,l,1);break}}}function ls(r){const e=r.prev,i=r,n=r.next;if(_r(e,i,n)>=0)return!1;const s=e.x,l=i.x,u=n.x,f=e.y,p=i.y,g=n.y,x=Math.min(s,l,u),b=Math.min(f,p,g),w=Math.max(s,l,u),S=Math.max(f,p,g);let E=n.next;for(;E!==e;){if(E.x>=x&&E.x<=w&&E.y>=b&&E.y<=S&&uf(s,f,l,p,u,g,E.x,E.y)&&_r(E.prev,E,E.next)>=0)return!1;E=E.next}return!0}function ho(r,e,i,n){const s=r.prev,l=r,u=r.next;if(_r(s,l,u)>=0)return!1;const f=s.x,p=l.x,g=u.x,x=s.y,b=l.y,w=u.y,S=Math.min(f,p,g),E=Math.min(x,b,w),M=Math.max(f,p,g),C=Math.max(x,b,w),R=ch(S,E,e,i,n),F=ch(M,C,e,i,n);let z=r.prevZ,j=r.nextZ;for(;z&&z.z>=R&&j&&j.z<=F;){if(z.x>=S&&z.x<=M&&z.y>=E&&z.y<=C&&z!==s&&z!==u&&uf(f,x,p,b,g,w,z.x,z.y)&&_r(z.prev,z,z.next)>=0||(z=z.prevZ,j.x>=S&&j.x<=M&&j.y>=E&&j.y<=C&&j!==s&&j!==u&&uf(f,x,p,b,g,w,j.x,j.y)&&_r(j.prev,j,j.next)>=0))return!1;j=j.nextZ}for(;z&&z.z>=R;){if(z.x>=S&&z.x<=M&&z.y>=E&&z.y<=C&&z!==s&&z!==u&&uf(f,x,p,b,g,w,z.x,z.y)&&_r(z.prev,z,z.next)>=0)return!1;z=z.prevZ}for(;j&&j.z<=F;){if(j.x>=S&&j.x<=M&&j.y>=E&&j.y<=C&&j!==s&&j!==u&&uf(f,x,p,b,g,w,j.x,j.y)&&_r(j.prev,j,j.next)>=0)return!1;j=j.nextZ}return!0}function Gc(r,e){let i=r;do{const n=i.prev,s=i.next.next;!uh(n,s)&&$y(n,i,i.next,s)&&hf(n,s)&&hf(s,n)&&(e.push(n.i,i.i,s.i),df(i),df(i.next),i=r=s),i=i.next}while(i!==r);return yn(i)}function Us(r,e,i,n,s,l){let u=r;do{let f=u.next.next;for(;f!==u.prev;){if(u.i!==f.i&&Ab(u,f)){let p=Hy(u,f);return u=yn(u,u.next),p=yn(p,p.next),Pn(u,e,i,n,s,l,0),void Pn(p,e,i,n,s,l,0)}f=f.next}u=u.next}while(u!==r)}function za(r,e){let i=r.x-e.x;
vendor: 26,683 bytes, line 7
7return i===0&&(i=r.y-e.y,i===0)&&(i=(r.next.y-r.y)/(r.next.x-r.x)-(e.next.y-e.y)/(e.next.x-e.x)),i}function lf(r,e){const i=(function(s,l){let u=l;const f=s.x,p=s.y;let g,x=-1/0;if(uh(s,u))return u;do{if(uh(s,u.next))return u.next;if(p<=u.y&&p>=u.next.y&&u.next.y!==u.y){const M=u.x+(p-u.y)*(u.next.x-u.x)/(u.next.y-u.y);if(M<=f&&M>x&&(x=M,g=u.x<u.next.x?u:u.next,M===f))return g}u=u.next}while(u!==l);if(!g)return null;const b=g,w=g.x,S=g.y;let E=1/0;u=g;do{if(f>=u.x&&u.x>=w&&f!==u.x&&Gy(p<S?f:x,p,w,S,p<S?x:f,p,u.x,u.y)){const M=Math.abs(p-u.y)/(f-u.x);hf(u,s)&&(M<E||M===E&&(u.x>g.x||u.x===g.x&&cf(g,u)))&&(g=u,E=M)}u=u.next}while(u!==b);return g})(r,e);if(!i)return e;const n=Hy(i,r);return yn(n,n.next),yn(i,i.next)}function cf(r,e){return _r(r.prev,r,e.prev)<0&&_r(e.next,r,r.next)<0}function ch(r,e,i,n,s){return(r=1431655765&((r=858993459&((r=252645135&((r=16711935&((r=(r-i)*s|0)|r<<8))|r<<4))|r<<2))|r<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*s|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function xg(r){let e=r,i=r;do(e.x<i.x||e.x===i.x&&e.y<i.y)&&(i=e),e=e.next;while(e!==r);return i}function Gy(r,e,i,n,s,l,u,f){return(s-u)*(e-f)>=(r-u)*(l-f)&&(r-u)*(n-f)>=(i-u)*(e-f)&&(i-u)*(l-f)>=(s-u)*(n-f)}function uf(r,e,i,n,s,l,u,f){return!(r===u&&e===f)&&Gy(r,e,i,n,s,l,u,f)}function Ab(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!(function(i,n){let s=i;do{if(s.i!==i.i&&s.next.i!==i.i&&s.i!==n.i&&s.next.i!==n.i&&$y(s,s.next,i,n))return!0;s=s.next}while(s!==i);return!1})(r,e)&&(hf(r,e)&&hf(e,r)&&(function(i,n){let s=i,l=!1;const u=(i.x+n.x)/2,f=(i.y+n.y)/2;do s.y>f!=s.next.y>f&&s.next.y!==s.y&&u<(s.next.x-s.x)*(f-s.y)/(s.next.y-s.y)+s.x&&(l=!l),s=s.next;while(s!==i);return l})(r,e)&&(_r(r.prev,r,e.prev)||_r(r,e.prev,e))||uh(r,e)&&_r(r.prev,r,r.next)>0&&_r(e.prev,e,e.next)>0)}function _r(r,e,i){return(e.y-r.y)*(i.x-e.x)-(e.x-r.x)*(i.y-e.y)}function uh(r,e){return r.x===e.x&&r.y===e.y}function $y(r,e,i,n){const s=Rm(_r(r,e,i)),l=Rm(_r(r,e,n)),u=Rm(_r(i,n,r)),f=Rm(_r(i,n,e));return s!==l&&u!==f||!(s!==0||!Dm(r,i,e))||!(l!==0||!Dm(r,n,e))||!(u!==0||!Dm(i,r,n))||!(f!==0||!Dm(i,e,n))}function Dm(r,e,i){return e.x<=Math.max(r.x,i.x)&&e.x>=Math.min(r.x,i.x)&&e.y<=Math.max(r.y,i.y)&&e.y>=Math.min(r.y,i.y)}function Rm(r){return r>0?1:r<0?-1:0}function hf(r,e){return _r(r.prev,r,r.next)<0?_r(r,e,r.next)>=0&&_r(r,r.prev,e)>=0:_r(r,e,r.prev)<0||_r(r,r.next,e)<0}function Hy(r,e){const i=vg(r.i,r.x,r.y),n=vg(e.i,e.x,e.y),s=r.next,l=e.prev;return r.next=e,e.prev=r,i.next=s,s.prev=i,n.next=i,i.prev=n,l.next=n,n.prev=l,n}function qy(r,e,i,n){const s=vg(r,e,i);return n?(s.next=n.next,s.prev=n,n.next.prev=s,n.next=s):(s.prev=s,s.next=s),s}function df(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function vg(r,e,i){return{i:r,x:e,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function ff(r,e){const i=r.length;if(i<=1)return[r];const n=[];let s,l;for(let u=0;u<i;u++){const f=Ii(r[u]);f!==0&&(r[u].area=Math.abs(f),l===void 0&&(l=f<0),l===f<0?(s&&n.push(s),s=[r[u]]):s.push(r[u]))}if(s&&n.push(s),e>1)for(let u=0;u<n.length;u++)n[u].length<=e||(ap(n[u],e,1,n[u].length-1,Mb),n[u]=n[u].slice(0,e));return n}function Mb(r,e){return e.area-r.area}function Zy(r,e,i=1){if(!r)return null;const n=typeof r=="string"?Vr.from(r).getPrimary():r.getPrimary(),s=typeof r=="string"?null:r.getSecondary();for(const l of[n,s]){if(!l)continue;const u=l.id.toString();e.has(u)||e.set(u,[]),l.scaleSelf(i),e.get(u).push(l)}return{primary:n.toString(),secondary:s?s.toString():null}}function bg(r,e,i,n){const s=n.patternDependencies;let l=!1;for(const u of e){const f=u.paint.get(`${r}-pattern`);f.isConstant()||(l=!0),Zy(f.constantOr(null),s,i)&&(l=!0)}return l}function wg(r,e,i,n,s,l){const u=l.patternDependencies;for(const f of e){const p=f.paint.get(`${r}-pattern`).value;if(p.kind!=="constant"){const g=Zy(p.evaluate({zoom:n},i,{},void 0,l.availableImages),u,s);if(!g)continue;const{primary:x,secondary:b}=g;x&&(i.patterns[f.id]=[x,b].filter(Boolean))}}return i}class La{constructor(){this.portals=[]}static isOnBorder(e,i){return e<=0&&i<=0||e>=Xe&&i>=Xe}static evaluate(e){if(e.length===0)return new La;let i=[];for(const p of e)i.push(...p.portals);if(i.length===0)return new La;for(const p of i){const g=p.va,x=p.vb;(La.isOnBorder(g.x,x.x)||La.isOnBorder(g.y,x.y))&&(p.type="border")}const n=i.filter(p=>p.type!=="unevaluated"),s=i.filter(p=>p.type==="unevaluated");if(s.length===0)return new La;s.sort((p,g)=>p.hash===g.hash?p.isTunnel===g.isTunnel?0:p.isTunnel?-1:1:p.hash<g.hash?1:-1),i=n.concat(s);let l=n.length,u=l,f=l;do if(u++,u===i.length||i[l].hash!==i[u].hash){if(u-l===2){f<l&&(i[f]=i[l],i[l]=null);const p=i[f],g=i[u-1];p.type=p.isTunnel!==g.isTunnel?"tunnel":"polygon",p.connection={a:p.connection.a,b:g.connection.a},f++}l=u}while(l!==i.length);return i.splice(f),i.sort((p,g)=>p.hash<g.hash?1:-1),{portals:i}}}et(La,"ElevationPortalGraph");class Cb{constructor(e,i,n){this.outPositions=e,this.outNormals=i,this.outIndices=n,this.vertexLookup=new Map}addVertex(e,i,n){let s=e[2];n!=null&&(s*=n);const l=`${e[0]},${e[1]},${e[2]},${i[0]},${i[1]},${i[2]}`,u=this.vertexLookup.get(l);if(u!=null)return u;const f=this.outPositions.length;this.vertexLookup.set(l,f);const p=Math.trunc(16384*i[0]),g=Math.trunc(16384*i[1]),x=Math.trunc(16384*i[2]);return this.outPositions.emplaceBack(e[0],e[1],s),this.outNormals.emplaceBack(p,g,x),f}addTriangle(e,i,n){this.outIndices.emplaceBack(e,i,n)}addTriangles(e,i,n){if(e.length===0)return;const s=n.length===1,l=ni(),u=ni();for(let f=0;f<e.length;f+=3){const p=i[e[f+0]],g=i[e[f+1]],x=i[e[f+2]],b=s?n[0]:n[e[f+1]],w=s?n[0]:n[e[f+2]];Ti(l,p.x,p.y,s?n[0]:n[e[f+0]]);const S=this.addVertex(l,u);Ti(l,g.x,g.y,b);const E=this.addVertex(l,u);Ti(l,x.x,x.y,w);const M=this.addVertex(l,u);this.outIndices.emplaceBack(S,E,M)}}addQuad(e,i,n,s,l,u){const f=this.addVertex(e,l,u),p=this.addVertex(i,l,u),g=this.addVertex(n,l,u),x=this.addVertex(s,l,u);this.addTriangle(f,p,g),this.addTriangle(g,x,f)}getVertexCount(){return this.outPositions.length}clearVertexLookup(){this.vertexLookup.clear()}}class Dn{constructor(e,i,n,s){this.unevaluatedPortals=new La,this.bridgeFeatureSections=[],this.tunnelFeatureSections=[],this.vertexHashLookup=new Map,this.unevalVertices=[],this.unevalHeights=[],this.unevalTriangles=[],this.unevalTunnelTriangles=[],this.unevalEdges=[],this.vertexPositions=new Ju,this.vertexNormals=new Oc,this.indexArray=new Ai,this.tileToMeters=Cn(e),this.bridgeProgramConfigurations=new An(i,{zoom:n,lut:s},l=>l!=="fill-tunnel-structure-color"),this.tunnelProgramConfigurations=new An(i,{zoom:n,lut:s},l=>l!=="fill-bridge-guard-rail-color")}addVertices(e,i){const n=this.unevalVertices.length;for(let s=0;s<e.length;s++)this.unevalVertices.push(e[s]),this.unevalHeights.push(i[s]);return n}addTriangles(e,i,n){const s=n?this.unevalTunnelTriangles:this.unevalTriangles;for(const l of e)s.push(l+i)}addRenderableRing(e,i,n,s,l,u){const f=[new Ue(l.min.x,l.min.y),new Ue(l.max.x,l.min.y),new Ue(l.max.x,l.max.y),new Ue(l.min.x,l.max.y)];for(let p=0;p<n-1;p++){const g=i+p,x=g+1,b=this.unevalVertices[g],w=this.unevalVertices[x];if(!(b.x>=l.min.x&&b.x<=l.max.x&&b.y>=l.min.y&&b.y<=l.max.y||w.x>=l.min.x&&w.x<=l.max.x&&w.y>=l.min.y&&w.y<=l.max.y||N(b,w,f))||this.isOnBorder(b.x,w.x)||this.isOnBorder(b.y,w.y))continue;const S=Dn.computeEdgeHash(this.unevalVertices[g],this.unevalVertices[x]);let E,M=this.vertexHashLookup.get(Dn.computePosHash(b));M!=null?E=M.next:(M=this.vertexHashLookup.get(Dn.computePosHash(w)),E=M!=null?M.prev:S),this.unevalEdges.push({polygonIdx:e,a:g,b:x,hash:S,portalHash:E,isTunnel:s,type:"unevaluated",featureInfo:u})}}addPortalCandidates(e,i,n,s,l){if(i.length!==0){this.vertexHashLookup.clear();for(const u of i){if(u.length===0)continue;const f=u[0];let p=Dn.computeEdgeHash(f[f.length-2],f.at(-1));for(let g=0;g<f.length-1;g++){const x=f[g+0],b=f[g+1],w=Qn(b.x-x.x,b.y-x.y),S=na(w);if(S===0)continue;let E="unevaluated";const M=s.pointElevation(x),C=s.pointElevation(b);Math.abs(M)<.01&&Math.abs(C)<.01?E="entrance":(this.isOnBorder(x.x,b.x)||this.isOnBorder(x.y,b.y))&&(E="border");const R=Dn.computeEdgeHash(x,b);this.unevaluatedPortals.portals.push({connection:{a:e,b:void 0},va:x,vb:b,vab:w,length:S,hash:R,isTunnel:n,type:E});const F=Dn.computePosHash(x);this.vertexHashLookup.set(F,{prev:p,next:R}),p=R}}}}construct(e){if(this.unevalVertices.length===0)return;const i=()=>({vertexOffset:0,primitiveOffset:this.indexArray.length}),n=w=>{w.primitiveLength=this.indexArray.length-w.primitiveOffset},s=new Cb(this.vertexPositions,this.vertexNormals,this.indexArray);this.prepareEdges(e.portals,this.unevalEdges);const l=i(),u=i(),f=i(),p=(w,S)=>{w.sort((M,C)=>M.type===S&&C.type!==S?-1:M.type!==S&&C.type===S?1:0);const E=w.findIndex(M=>M.type!==S);return E>=0?E:w.length};let g=0;this.unevalEdges.length>0&&(g=p(this.unevalEdges,"none"),this.constructBridgeStructures(s,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:g},this.tileToMeters)),n(f);const x=i(),b=i();if(this.unevalEdges.length>0){const w=this.unevalEdges.splice(g),S=p(w,"tunnel")+g;this.unevalEdges.push(...w),this.constructTunnelStructures(s,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:g},{min:g,max:S})}n(x),s.addTriangles(this.unevalTriangles,this.unevalVertices,this.unevalHeights),n(b),s.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,this.unevalHeights),n(u),s.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,[-.1]),n(l),this.maskSegments=di.simpleSegment(0,b.primitiveOffset,0,b.primitiveLength),this.depthSegments=di.simpleSegment(0,u.primitiveOffset,0,u.primitiveLength),this.renderableBridgeSegments=di.simpleSegment(0,f.primitiveOffset,0,f.primitiveLength),this.renderableTunnelSegments=di.simpleSegment(0,x.primitiveOffset,0,x.primitiveLength),this.shadowCasterSegments=di.simpleSegment(0,l.primitiveOffset,0,l.primitiveLength)}update(e,i,n,s,l,u,f,p){this.bridgeProgramConfigurations.updatePaintArrays(e,i,l,n,s,u,f,p),this.tunnelProgramConfigurations.updatePaintArrays(e,i,l,n,s,u,f,p)}upload(e){this.vertexBuffer||this.vertexPositions.length===0||this.vertexNormals.length===0||this.indexArray.length===0||(this.vertexBuffer=e.createVertexBuffer(this.vertexPositions,zi.members),this.vertexBufferNormal=e.createVertexBuffer(this.vertexNormals,jr.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,i,n,s,l){const u=(f,p)=>{for(let g=0;g<p.length-1;g++){const x=p[g].featureIndex,b=p[g+1].vertexStart,w=e.feature(x);f.populatePaintArrays(b,w,x,{},n,i,s,void 0,l)}};u(this.bridgeProgramConfigurations,this.bridgeFeatureSections),u(this.tunnelProgramConfigurations,this.tunnelFeatureSections)}computeVertexConnections(e,i,n,s,l){const u=new Map;for(let f=s;f<l;f++){const p=n[f],g=p.a,x=p.b,b=Dn.computePosHash(e[g]),w=Dn.computePosHash(e[x]);let S=u.get(b);S||(S={},u.set(b,S));let E=u.get(w);E||(E={},u.set(w,E)),i[g]<=0&&i[x]<=0||(S.to=x,E.from=g)}return u}isTerminalVertex(e,i){const n=Dn.computePosHash(this.unevalVertices[e]),s=i.get(n);return!s||!s.from||!s.to}constructBridgeStructures(e,i,n,s,l,u){e.clearVertexLookup();const f=this.computeVertexConnections(i,n,s,l.min,l.max),p=1/u,g=.5*p,x=(Ae,Ie)=>Ti(Ae,i[Ie].x,i[Ie].y,n[Ie]*p),b=ni(),w=ni(),S=ni(),E=ni(),M=ni(),C=(Ae,Ie)=>{const Fe=f.get(Dn.computePosHash(i[Ie])),xe=Fe.from,Se=Fe.to;if(!xe||!Se)return;x(b,xe),x(w,Ie),x(S,Se),Va(E),go(b,w)||(ki(M,w,b),ui(E,M)),go(S,w)||(ki(M,S,w),er(E,E,ui(M,M)));const Me=Qs(E);return Me>0?Ci(Ae,E,1/Me):void 0};let R=Number.POSITIVE_INFINITY;this.sortSubarray(s,l.min,l.max,(Ae,Ie)=>Ae.featureInfo.featureIndex-Ie.featureInfo.featureIndex);const F=ni(),z=ni(),j=ni(),$=ni(),q=ni(),ie=ni(),W=ni(),Q=ni(),Y=ni(),ee=[ni(),ni(),ni(),ni()],me=[ni(),ni(),ni(),ni()],ge=[{coord:new Ue(0,0),height:0},{coord:new Ue(0,0),height:0}],Te=(Ae,Ie)=>Ae>Ie;for(let Ae=l.min;Ae<l.max;Ae++){const Ie=s[Ae];if(!Ie.featureInfo.guardRailEnabled||!this.prepareEdgePoints(ge,i,n,Ie,Te))continue;const[Fe,xe]=ge;if(Ti(F,Fe.coord.x,Fe.coord.y,p*Fe.height),Ti(z,xe.coord.x,xe.coord.y,p*xe.height),go(F,z))continue;ki(j,z,F),ui(j,j);const Se=C(Q,Ie.a)||j,Me=C(Y,Ie.b)||j;Ti($,Se[1],-Se[0],0),ui($,$),Ti(q,Me[1],-Me[0],0),ui(q,q),kr(Q,$,Se),ui(ie,Q),kr(Q,q,Me),ui(W,Q),er(ee[0],F,Ci(Q,ki(Q,$,ie),g)),er(ee[1],F,Ci(Q,er(Q,$,ie),g)),er(ee[2],F,Ci(Q,ie,g)),ee[3]=F,er(me[0],z,Ci(Q,ki(Q,q,W),g)),er(me[1],z,Ci(Q,er(Q,q,W),g)),er(me[2],z,Ci(Q,W,g)),me[3]=z,R=this.addFeatureSection(Ie.featureInfo.featureIndex,R,this.bridgeFeatureSections,e);const ze=e.addVertex(ee[0],$,u),Le=e.addVertex(ee[1],$,u),We=e.addVertex(me[0],q,u),De=e.addVertex(me[1],q,u);e.addTriangle(ze,Le,We),e.addTriangle(Le,De,We);const Ge=e.addVertex(ee[1],ie,u),$e=e.addVertex(ee[2],ie,u),Je=e.addVertex(me[1],W,u),Qe=e.addVertex(me[2],W,u);e.addTriangle(Ge,$e,Je),e.addTriangle($e,Qe,Je),Kn($,$),Kn(q,q);const ct=e.addVertex(ee[2],$,u),nt=e.addVertex(ee[3],$,u),mt=e.addVertex(me[2],q,u),Gt=e.addVertex(me[3],q,u);e.addTriangle(ct,nt,mt),e.addTriangle(nt,Gt,mt);const wt=this.isTerminalVertex(Ie.a,f),kt=this.isTerminalVertex(Ie.b,f);Fe.height<.01&&wt&&e.addQuad(ee[3],ee[2],ee[1],ee[0],Kn(Se,Se),u),xe.height<.01&&kt&&e.addQuad(me[0],me[1],me[2],me[3],Me,u)}this.bridgeFeatureSections.push({featureIndex:Number.POSITIVE_INFINITY,vertexStart:e.getVertexCount()})}constructTunnelStructures(e,i,n,s,l,u){e.clearVertexLookup();let f=Number.POSITIVE_INFINITY;const p=(R,F)=>R.featureInfo.featureIndex-F.featureInfo.featureIndex;this.sortSubarray(s,l.min,l.max,p),this.sortSubarray(s,u.min,u.max,p);const g=R=>ui(R,R),x=[{coord:new Ue(0,0),height:0},{coord:new Ue(0,0),height:0}],b=(R,F)=>R<F,w=ni(),S=ni(),E=ni(),M=ni(),C=ni();for(let R=l.min;R<l.max;R++){if(!this.prepareEdgePoints(x,i,n,s[R],b))continue;const[F,z]=x,j=g(Ti(C,-(z.coord.y-F.coord.y),z.coord.x-F.coord.x,0));f=this.addFeatureSection(s[R].featureInfo.featureIndex,f,this.tunnelFeatureSections,e),e.addQuad(Ti(w,F.coord.x,F.coord.y,F.height),Ti(S,z.coord.x,z.coord.y,z.height),Ti(E,z.coord.x,z.coord.y,s[R].isTunnel?-.1:0),Ti(M,F.coord.x,F.coord.y,s[R].isTunnel?-.1:0),j)}for(let R=u.min;R<u.max;R++){const F=s[R];F.isTunnel&&([F.a,F.b]=[F.b,F.a]);const z=i[F.a],j=i[F.b],$=g(Ti(C,-(j.y-z.y),j.x-z.x,0));f=this.addFeatureSection(F.featureInfo.featureIndex,f,this.tunnelFeatureSections,e),e.addQuad(Ti(w,j.x,j.y,0),Ti(S,z.x,z.y,0),Ti(E,z.x,z.y,n[F.a]+4),Ti(M,j.x,j.y,n[F.b]+4),$),e.addQuad(Ti(w,z.x,z.y,0),Ti(S,j.x,j.y,0),Ti(E,j.x,j.y,n[F.b]+4),Ti(M,z.x,z.y,n[F.a]+4),$)}this.tunnelFeatureSections.push({featureIndex:Number.POSITIVE_INFINITY,vertexStart:e.getVertexCount()})}setElevatedPoint(e,i,n,s){e.coord.x=i,e.coord.y=n,e.height=s}prepareEdgePoints(e,i,n,s,l){let u=i[s.a].x,f=i[s.a].y,p=i[s.b].x,g=i[s.b].y,x=n[s.a],b=n[s.b];const w=l(x,0),S=l(b,0);if(w&&S)return this.setElevatedPoint(e[0],u,f,x),this.setElevatedPoint(e[1],p,g,b),!0;if(!w&&!S)return!1;if(w){if(!S){const E=b/(b-x);p=ft(p,u,E),g=ft(g,f,E),b=ft(b,x,E)}}else{const E=x/(x-b);u=ft(u,p,E),f=ft(f,g,E),x=ft(x,b,E)}return this.setElevatedPoint(e[0],u,f,x),this.setElevatedPoint(e[1],p,g,b),!0}prepareEdges(e,i){if(i.length===0)return;i.sort((f,p)=>f.hash===p.hash?p.polygonIdx-f.polygonIdx:p.hash>f.hash?1:-1);let n=0,s=0,l=0,u=i[n].polygonIdx;do s++,(s===i.length||i[n].hash!==i[s].hash)&&((s-n===1||i[s-1].polygonIdx!==u)&&(l<n&&(i[l]=i[n],i[n]=null),i[l].type="none",l++),n=s,n!==i.length&&(u=i[n].polygonIdx));while(n!==i.length);if(i.splice(l),i.length!==0&&e.length!==0){i.sort((g,x)=>g.portalHash<x.portalHash?1:-1);let f=0,p=0;for(;f!==i.length&&p!==e.length;){const g=i[f],x=e[p];g.portalHash>x.hash?f++:x.hash>g.portalHash?p++:(g.type=x.type,f++)}}}isOnBorder(e,i){return e<=0&&i<=0||e>=Xe&&i>=Xe}addFeatureSection(e,i,n,s){return e!==i&&(i=e,n.push({featureIndex:e,vertexStart:s.getVertexCount()}),s.clearVertexLookup()),i}sortSubarray(e,i,n,s){const l=e.slice(i,n);l.sort(s),e.splice(i,l.length,...l)}static computeEdgeHash(e,i){return(e.y===i.y&&e.x>i.x||e.y>i.y)&&([e,i]=[i,e]),BigInt(Dn.computePosHash(e))<<32n|BigInt(Dn.computePosHash(i))}static computePosHash(e){return((65535&e.x)<<16|65535&e.y)>>>0}}function Pb(r,e){return r>e?1:r<e?-1:0}class Tg{constructor(e=Pb,i=!1){this._compare=e,this._root=null,this._size=0,this._noDuplicates=!!i}rotateLeft(e){var i=e.right;i&&(e.right=i.left,i.left&&(i.left.parent=e),i.parent=e.parent),e.parent?e===e.parent.left?e.parent.left=i:e.parent.right=i:this._root=i,i&&(i.left=e),e.parent=i}rotateRight(e){var i=e.left;i&&(e.left=i.right,i.right&&(i.right.parent=e),i.parent=e.parent),e.parent?e===e.parent.left?e.parent.left=i:e.parent.right=i:this._root=i,i&&(i.right=e),e.parent=i}_splay(e){for(;e.parent;){var i=e.parent;i.parent?i.left===e&&i.parent.left===i?(this.rotateRight(i.parent),this.rotateRight(i)):i.right===e&&i.parent.right===i?(this.rotateLeft(i.parent),this.rotateLeft(i)):i.left===e&&i.parent.right===i?(this.rotateRight(i),this.rotateLeft(i)):(this.rotateLeft(i),this.rotateRight(i)):i.left===e?this.rotateRight(i):this.rotateLeft(i)}}splay(e){for(var i,n,s,l,u;e.parent;)(n=(i=e.parent).parent)&&n.parent?((s=n.parent).left===n?s.left=e:s.right=e,e.parent=s):(e.parent=null,this._root=e),l=e.left,u=e.right,e===i.left?(n&&(n.left===i?(i.right?(n.left=i.right,n.left.parent=n):n.left=null,i.right=n,n.parent=i):(l?(n.right=l,l.parent=n):n.right=null,e.left=n,n.parent=e)),u?(i.left=u,u.parent=i):i.left=null,e.right=i,i.parent=e):(n&&(n.right===i?(i.left?(n.right=i.left,n.right.parent=n):n.right=null,i.left=n,n.parent=i):(u?(n.left=u,u.parent=n):n.left=null,e.right=n,n.parent=e)),l?(i.right=l,l.parent=i):i.right=null,e.left=i,i.parent=e)}replace(e,i){e.parent?e===e.parent.left?e.parent.left=i:e.parent.right=i:this._root=i,i&&(i.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,i){var n=this._root,s=null,l=this._compare;if(this._noDuplicates)for(;n;){if(s=n,l(n.key,e)===0)return;n=l(n.key,e)<0?n.right:n.left}else for(;n;)s=n,n=l(n.key,e)<0?n.right:n.left;return n={key:e,data:i,left:null,right:null,parent:s},s?l(s.key,n.key)<0?s.right=n:s.left=n:this._root=n,this.splay(n),this._size++,n}find(e){for(var i=this._root,n=this._compare;i;){var s=n(i.key,e);if(s<0)i=i.right;else{if(!(s>0))return i;i=i.left}}return null}contains(e){for(var i=this._root,n=this._compare;i;){var s=n(e,i.key);if(s===0)return!0;i=s<0?i.left:i.right}return!1}remove(e){var i=this.find(e);if(!i)return!1;if(this.splay(i),i.left)if(i.right){var n=this.minNode(i.right);n.parent!==i&&(this.replace(n,n.right),n.right=i.right,n.right.parent=n),this.replace(i,n),n.left=i.left,n.left.parent=n}else this.replace(i,i.left);else this.replace(i,i.right);return this._size--,!0}removeNode(e){if(!e)return!1;if(this.splay(e),e.left)if(e.right){var i=this.minNode(e.right);i.parent!==e&&(this.replace(i,i.right),i.right=e.right,i.right.parent=i),this.replace(e,i),i.left=e.left,i.left.parent=i}else this.replace(e,e.left);else this.replace(e,e.right);return this._size--,!0}erase(e){var i=this.find(e);if(i){this.splay(i);var n=i.left,s=i.right,l=null;n&&(n.parent=null,l=this.maxNode(n),this.splay(l),this._root=l),s&&(n?l.right=s:this._root=s,s.parent=l),this._size--}}pop(){var e=this._root,i=null;if(e){for(;e.left;)e=e.left;i={key:e.key,data:e.data},this.remove(e.key)}return i}next(e){var i=e;if(i)if(i.right)for(i=i.right;i&&i.left;)i=i.left;else for(i=e.parent;i&&i.right===e;)e=i,i=i.parent;return i}prev(e){var i=e;if(i)if(i.left)for(i=i.left;i&&i.right;)i=i.right;else for(i=e.parent;i&&i.left===e;)e=i,i=i.parent;return i}forEach(e){for(var i=this._root,n=[],s=!1,l=0;!s;)i?(n.push(i),i=i.left):n.length>0?(e(i=n.pop(),l++),i=i.right):s=!0;return this}range(e,i,n,s){const l=[],u=this._compare;let f,p=this._root;for(;l.length!==0||p;)if(p)l.push(p),p=p.left;else{if(p=l.pop(),f=u(p.key,i),f>0)break;if(u(p.key,e)>=0&&n.call(s,p))return this;p=p.right}return this}keys(){for(var e=this._root,i=[],n=[],s=!1;!s;)e?(i.push(e),e=e.left):i.length>0?(e=i.pop(),n.push(e.key),e=e.right):s=!0;return n}values(){for(var e=this._root,i=[],n=[],s=!1;!s;)e?(i.push(e),e=e.left):i.length>0?(e=i.pop(),n.push(e.data),e=e.right):s=!0;return n}at(e){for(var i=this._root,n=[],s=!1,l=0;!s;)if(i)n.push(i),i=i.left;else if(n.length>0){if(i=n.pop(),l===e)return i;l++,i=i.right}else s=!0;return null}load(e=[],i=[],n=!1){if(this._size!==0)throw new Error("bulk-load: tree is not empty");const s=e.length;return n&&Ig(e,i,0,s-1,this._compare),this._root=Sg(null,e,i,0,s),this._size=s,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 this._root===null}get size(){return this._size}static createTree(e,i,n,s,l){return new Tg(n,l).load(e,i,s)}}function Sg(r,e,i,n,s){const l=s-n;if(l>0){const u=n+Math.floor(l/2),f={key:e[u],data:i[u],parent:r};return f.left=Sg(f,e,i,n,u),f.right=Sg(f,e,i,u+1,s),f}return null}function Ig(r,e,i,n,s){if(i>=n)return;const l=r[i+n>>1];let u=i-1,f=n+1;for(;;){do u++;while(s(r[u],l)<0);do f--;while(s(r[f],l)>0);if(u>=f)break;let p=r[u];r[u]=r[f],r[f]=p,p=e[u],e[u]=e[f],e[f]=p}Ig(r,e,i,f,s),Ig(r,e,f+1,n,s)}const Wy=11102230246251565e-32,xn=134217729,Db=(3+8*Wy)*Wy;function Eg(r,e,i,n,s){let l,u,f,p,g=e[0],x=n[0],b=0,w=0;x>g==x>-g?(l=g,g=e[++b]):(l=x,x=n[++w]);let S=0;if(b<r&&w<i)for(x>g==x>-g?(u=g+l,f=l-(u-g),g=e[++b]):(u=x+l,f=l-(u-x),x=n[++w]),l=u,f!==0&&(s[S++]=f);b<r&&w<i;)x>g==x>-g?(u=l+g,p=u-l,f=l-(u-p)+(g-p),g=e[++b]):(u=l+x,p=u-l,f=l-(u-p)+(x-p),x=n[++w]),l=u,f!==0&&(s[S++]=f);for(;b<r;)u=l+g,p=u-l,f=l-(u-p)+(g-p),g=e[++b],l=u,f!==0&&(s[S++]=f);for(;w<i;)u=l+x,p=u-l,f=l-(u-p)+(x-p),x=n[++w],l=u,f!==0&&(s[S++]=f);return l===0&&S!==0||(s[S++]=l),S}function pf(r){return new Float64Array(r)}const hh=pf(4),Xy=pf(8),Yy=pf(12),Jy=pf(16),Rn=pf(4);function mf(r,e,i){e===null?(r.inOut=!1,r.otherInOut=!0):(r.isSubject===e.isSubject?(r.inOut=!e.inOut,r.otherInOut=e.otherInOut):(r.inOut=!e.otherInOut,r.otherInOut=e.isVertical()?!e.inOut:e.inOut),e&&(r.prevInResult=!Ky(e,i)||e.isVertical()?e.prevInResult:e)),r.resultTransition=Ky(r,i)?(function(n,s){let l,u=!n.inOut,f=!n.otherInOut;switch(s){case 0:l=u&&f;break;case 1:l=u||f;break;case 3:l=u!==f;break;case 2:l=n.isSubject?u&&!f:f&&!u}return l?1:-1})(r,i):0}function Ky(r,e){switch(r.type){case 0:switch(e){case 0:return!r.otherInOut;case 1:return r.otherInOut;case 2:return r.isSubject&&r.otherInOut||!r.isSubject&&!r.otherInOut;case 3:return!0}break;case 2:return e===0||e===1;case 3:return e===2;case 1:return!1}return!1}class dh{constructor(e,i,n,s,l){this.left=i,this.point=e,this.otherEvent=n,this.isSubject=s??!1,this.type=l||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 i=this.point,n=this.otherEvent.point;return this.left?(i[0]-e[0])*(n[1]-e[1])-(n[0]-e[0])*(i[1]-e[1])>0:(n[0]-e[0])*(i[1]-e[1])-(i[0]-e[0])*(n[1]-e[1])>0}isAbove(e){return!this.isBelow(e)}isVertical(){return this.point[0]===this.otherEvent.point[0]}get inResult(){return this.resultTransition!==0}clone(){const e=new dh(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 Vs(r,e){return r[0]===e[0]&&r[1]===e[1]}function Ag(r,e,i){const n=(function(s,l,u,f,p,g){const x=(l-g)*(u-p),b=(s-p)*(f-g),w=x-b;if(x===0||b===0||x>0!=b>0)return w;const S=Math.abs(x+b);return Math.abs(w)>=33306690738754716e-32*S?w:-(function(E,M,C,R,F,z,j){let $,q,ie,W,Q,Y,ee,me,ge,Te,Ae,Ie,Fe,xe,Se,Me,ze,Le;const We=E-F,De=C-F,Ge=M-z,$e=R-z;xe=We*$e,Y=xn*We,ee=Y-(Y-We),me=We-ee,Y=xn*$e,ge=Y-(Y-$e),Te=$e-ge,Se=me*Te-(xe-ee*ge-me*ge-ee*Te),Me=Ge*De,Y=xn*Ge,ee=Y-(Y-Ge),me=Ge-ee,Y=xn*De,ge=Y-(Y-De),Te=De-ge,ze=me*Te-(Me-ee*ge-me*ge-ee*Te),Ae=Se-ze,Q=Se-Ae,hh[0]=Se-(Ae+Q)+(Q-ze),Ie=xe+Ae,Q=Ie-xe,Fe=xe-(Ie-Q)+(Ae-Q),Ae=Fe-Me,Q=Fe-Ae,hh[1]=Fe-(Ae+Q)+(Q-Me),Le=Ie+Ae,Q=Le-Ie,hh[2]=Ie-(Le-Q)+(Ae-Q),hh[3]=Le;let Je=(function(Gt,wt){let kt=wt[0];for(let Mt=1;Mt<4;Mt++)kt+=wt[Mt];return kt})(0,hh),Qe=22204460492503146e-32*j;if(Je>=Qe||-Je>=Qe||(Q=E-We,$=E-(We+Q)+(Q-F),Q=C-De,ie=C-(De+Q)+(Q-F),Q=M-Ge,q=M-(Ge+Q)+(Q-z),Q=R-$e,W=R-($e+Q)+(Q-z),$===0&&q===0&&ie===0&&W===0)||(Qe=11093356479670487e-47*j+Db*Math.abs(Je),Je+=We*W+$e*$-(Ge*ie+De*q),Je>=Qe||-Je>=Qe))return Je;xe=$*$e,Y=xn*$,ee=Y-(Y-$),me=$-ee,Y=xn*$e,ge=Y-(Y-$e),Te=$e-ge,Se=me*Te-(xe-ee*ge-me*ge-ee*Te),Me=q*De,Y=xn*q,ee=Y-(Y-q),me=q-ee,Y=xn*De,ge=Y-(Y-De),Te=De-ge,ze=me*Te-(Me-ee*ge-me*ge-ee*Te),Ae=Se-ze,Q=Se-Ae,Rn[0]=Se-(Ae+Q)+(Q-ze),Ie=xe+Ae,Q=Ie-xe,Fe=xe-(Ie-Q)+(Ae-Q),Ae=Fe-Me,Q=Fe-Ae,Rn[1]=Fe-(Ae+Q)+(Q-Me),Le=Ie+Ae,Q=Le-Ie,Rn[2]=Ie-(Le-Q)+(Ae-Q),Rn[3]=Le;const ct=Eg(4,hh,4,Rn,Xy);xe=We*W,Y=xn*We,ee=Y-(Y-We),me=We-ee,Y=xn*W,ge=Y-(Y-W),Te=W-ge,Se=me*Te-(xe-ee*ge-me*ge-ee*Te),Me=Ge*ie,Y=xn*Ge,ee=Y-(Y-Ge),me=Ge-ee,Y=xn*ie,ge=Y-(Y-ie),Te=ie-ge,ze=me*Te-(Me-ee*ge-me*ge-ee*Te),Ae=Se-ze,Q=Se-Ae,Rn[0]=Se-(Ae+Q)+(Q-ze),Ie=xe+Ae,Q=Ie-xe,Fe=xe-(Ie-Q)+(Ae-Q),Ae=Fe-Me,Q=Fe-Ae,Rn[1]=Fe-(Ae+Q)+(Q-Me),Le=Ie+Ae,Q=Le-Ie,Rn[2]=Ie-(Le-Q)+(Ae-Q),Rn[3]=Le;const nt=Eg(ct,Xy,4,Rn,Yy);xe=$*W,Y=xn*$,ee=Y-(Y-$),me=$-ee,Y=xn*W,ge=Y-(Y-W),Te=W-ge,Se=me*Te-(xe-ee*ge-me*ge-ee*Te),Me=q*ie,Y=xn*q,ee=Y-(Y-q),me=q-ee,Y=xn*ie,ge=Y-(Y-ie),Te=ie-ge,ze=me*Te-(Me-ee*ge-me*ge-ee*Te),Ae=Se-ze,Q=Se-Ae,Rn[0]=Se-(Ae+Q)+(Q-ze),Ie=xe+Ae,Q=Ie-xe,Fe=xe-(Ie-Q)+(Ae-Q),Ae=Fe-Me,Q=Fe-Ae,Rn[1]=Fe-(Ae+Q)+(Q-Me),Le=Ie+Ae,Q=Le-Ie,Rn[2]=Ie-(Le-Q)+(Ae-Q),Rn[3]=Le;const mt=Eg(nt,Yy,4,Rn,Jy);return Jy[mt-1]})(s,l,u,f,p,g,S)})(r[0],r[1],e[0],e[1],i[0],i[1]);return n>0?-1:n<0?1:0}function Dl(r,e){const i=r.point,n=e.point;return i[0]>n[0]?1:i[0]<n[0]?-1:i[1]!==n[1]?i[1]>n[1]?1:-1:(function(s,l,u){return s.left!==l.left?s.left?1:-1:Ag(u,s.otherEvent.point,l.otherEvent.point)!==0?s.isBelow(l.otherEvent.point)?-1:1:!s.isSubject&&l.isSubject?1:-1})(r,e,i)}function Rl(r,e,i){const n=new dh(e,!1,r,r.isSubject),s=new dh(e,!0,r.otherEvent,r.isSubject);return Vs(r.point,r.otherEvent.point)&&console.warn("what is that, a collapsed
7segment?",r),n.contourId=s.contourId=r.contourId,Dl(s,r.otherEvent)>0&&(r.otherEvent.left=!0,s.left=!1),r.otherEvent.otherEvent=s,r.otherEvent=n,i.push(s),i.push(n),i}function zm(r,e){return r[0]*e[1]-r[1]*e[0]}function Mg(r,e){return r[0]*e[0]+r[1]*e[1]}function Cg(r,e,i){const n=(function(p,g,x,b){const w=[g[0]-p[0],g[1]-p[1]],S=[b[0]-x[0],b[1]-x[1]];function E(ie,W,Q){return[ie[0]+W*Q[0],ie[1]+W*Q[1]]}const M=[x[0]-p[0],x[1]-p[1]];let C=zm(w,S),R=C*C;const F=Mg(w,w);if(R>0){const ie=zm(M,S)/C;if(ie<0||ie>1)return null;const W=zm(M,w)/C;return W<0||W>1?null:ie===0||ie===1?[E(p,ie,w)]:W===0||W===1?[E(x,W,S)]:[E(p,ie,w)]}if(C=zm(M,w),R=C*C,R>0)return null;const z=Mg(w,M)/F,j=z+Mg(w,S)/F,$=Math.min(z,j),q=Math.max(z,j);return $<=1&&q>=0?$===1?[E(p,$>0?$:0,w)]:q===0?[E(p,q<1?q:1,w)]:[E(p,$>0?$:0,w),E(p,q<1?q:1,w)]:null})(r.point,r.otherEvent.point,e.point,e.otherEvent.point),s=n?n.length:0;if(s===0||s===1&&(Vs(r.point,e.point)||Vs(r.otherEvent.point,e.otherEvent.point))||s===2&&r.isSubject===e.isSubject)return 0;if(s===1)return!Vs(r.point,n[0])&&!Vs(r.otherEvent.point,n[0])&&Rl(r,n[0],i),!Vs(e.point,n[0])&&!Vs(e.otherEvent.point,n[0])&&Rl(e,n[0],i),1;const l=[];let u=!1,f=!1;return Vs(r.point,e.point)?u=!0:Dl(r,e)===1?l.push(e,r):l.push(r,e),Vs(r.otherEvent.point,e.otherEvent.point)?f=!0:Dl(r.otherEvent,e.otherEvent)===1?l.push(e.otherEvent,r.otherEvent):l.push(r.otherEvent,e.otherEvent),u&&f||u?(e.type=1,r.type=e.inOut===r.inOut?2:3,u&&!f&&Rl(l[1].otherEvent,l[0].point,i),2):f?(Rl(l[0],l[1].point,i),3):l[0]!==l[3].otherEvent?(Rl(l[0],l[1].point,i),Rl(l[1],l[2].point,i),3):(Rl(l[0],l[1].point,i),Rl(l[3].otherEvent,l[2].point,i),3)}function Rb(r,e){if(r===e)return 0;if(Ag(r.point,r.otherEvent.point,e.point)!==0||Ag(r.point,r.otherEvent.point,e.otherEvent.point)!==0)return Vs(r.point,e.point)?r.isBelow(e.otherEvent.point)?-1:1:r.point[0]===e.point[0]?r.point[1]<e.point[1]?-1:1:Dl(r,e)===1?e.isAbove(r.point)?-1:1:r.isBelow(e.point)?-1:1;if(r.isSubject!==e.isSubject)return r.isSubject?-1:1;{let i=r.point,n=e.point;if(i[0]===n[0]&&i[1]===n[1])return i=r.otherEvent.point,n=e.otherEvent.point,i[0]===n[0]&&i[1]===n[1]?0:(r.contourId??0)>(e.contourId??0)?1:-1}return Dl(r,e)===1?1:-1}class zb{constructor(){this.points=[],this.holeIds=[],this.holeOf=null,this.depth=null}isExterior(){return this.holeOf==null}}function Lb(r,e,i,n){let s,l=r+1,u=e[r].point;const f=e.length;for(l<f&&(s=e[l].point);l<f&&s[0]===u[0]&&s[1]===u[1];){if(!i[l])return l;l++,l<f&&(s=e[l].point)}for(l=r-1;i[l]&&l>n;)l--;return l}function Ob(r,e,i){const n=new zb;if(r.prevInResult!=null){const s=r.prevInResult,l=s.outputContourId;if(s.resultTransition>0){const u=e[l];if(u.holeOf!=null){const f=u.holeOf;e[f].holeIds.push(i),n.holeOf=f,n.depth=e[l].depth}else e[l].holeIds.push(i),n.holeOf=l,n.depth=e[l].depth+1}else n.holeOf=null,n.depth=e[l].depth}else n.holeOf=null,n.depth=0;return n}const Qy=Math.max,ex=Math.min;let Lm=0;function tx(r,e,i,n,s,l){let u,f,p,g,x,b;for(u=0,f=r.length-1;u<f;u++){if(p=r[u],g=r[u+1],x=new dh(p,!1,void 0,e),b=new dh(g,!1,x,e),x.otherEvent=b,p[0]===g[0]&&p[1]===g[1])continue;x.contourId=b.contourId=i,l||(x.isExteriorRing=!1,b.isExteriorRing=!1),Dl(x,b)>0?b.left=!0:x.left=!0;const w=p[0],S=p[1];s[0]=ex(s[0],w),s[1]=ex(s[1],S),s[2]=Qy(s[2],w),s[3]=Qy(s[3],S),n.push(x),n.push(b)}}const Om=[];function ix(r,e,i){let n=r,s=e;typeof r[0][0][0]=="number"&&(n=[r]),typeof e[0][0][0]=="number"&&(s=[e]);let l=(function(w,S,E){let M=null;return w.length*S.length===0&&(E===0?M=Om:E===2?M=w:(E===1||E===3)&&(M=w.length===0?S:w)),M})(n,s,i);if(l)return l===Om?null:l;const u=[1/0,1/0,-1/0,-1/0],f=[1/0,1/0,-1/0,-1/0],p=(function(w,S,E,M,C){const R=new gc(void 0,Dl);let F,z,j,$,q,ie;for(j=0,$=w.length;j<$;j++)for(F=w[j],q=0,ie=F.length;q<ie;q++)z=q===0,z&&Lm++,tx(F[q],!0,Lm,R,E,z);for(j=0,$=S.length;j<$;j++)for(F=S[j],q=0,ie=F.length;q<ie;q++)z=q===0,C===2&&(z=!1),z&&Lm++,tx(F[q],!1,Lm,R,M,z);return R})(n,s,u,f,i);if(l=(function(w,S,E,M,C){let R=null;return(E[0]>M[2]||M[0]>E[2]||E[1]>M[3]||M[1]>E[3])&&(C===0?R=Om:C===2?R=w:(C===1||C===3)&&(R=w.concat(S))),R})(n,s,u,f,i),l)return l===Om?null:l;const g=(function(w,S,E,M,C,R){const F=new Tg(Rb),z=[],j=Math.min(M[2],C[2]);let $,q,ie;for(;w.length!==0;){let W=w.pop();if(z.push(W),R===0&&W.point[0]>j||R===2&&W.point[0]>M[2])break;if(W.left){q=$=F.insert(W),ie=F.minNode(),$=$!==ie?F.prev($):null,q=F.next(q);const Q=$?$.key:null;let Y;if(mf(W,Q,R),q&&Cg(W,q.key,w)===2&&(mf(W,Q,R),mf(q.key,W,R)),$&&Cg($.key,W,w)===2){let ee=$;ee=ee!==ie?F.prev(ee):null,Y=ee?ee.key:null,mf(Q,Y,R),mf(W,Q,R)}}else W=W.otherEvent,q=$=F.find(W),$&&q&&($=$!==ie?F.prev($):null,q=F.next(q),F.remove(W),q&&$&&Cg($.key,q.key,w))}return z})(p,0,0,u,f,i),x=(function(w){let S,E;const M=(function(F){let z,j,$,q,ie;const W=[];for(j=0,$=F.length;j<$;j++)z=F[j],(z.left&&z.inResult||!z.left&&z.otherEvent.inResult)&&W.push(z);let Q=!1;for(;!Q;)for(Q=!0,j=0,$=W.length;j<$;j++)j+1<$&&Dl(W[j],W[j+1])===1&&(q=W[j],W[j]=W[j+1],W[j+1]=q,Q=!1);for(j=0,$=W.length;j<$;j++)z=W[j],z.otherPos=j;for(j=0,$=W.length;j<$;j++)z=W[j],z.left||(ie=z.otherPos,z.otherPos=z.otherEvent.otherPos,z.otherEvent.otherPos=ie);return W})(w),C={},R=[];for(S=0,E=M.length;S<E;S++){if(C[S])continue;const F=R.length,z=Ob(M[S],R,F),j=ie=>{C[ie]=!0,ie<M.length&&M[ie]&&(M[ie].outputContourId=F)};let $=S,q=S;for(z.points.push(M[S].point);j($),$=M[$].otherPos,j($),z.points.push(M[$].point),$=Lb($,M,C,q),!($==q||$>=M.length)&&M[$];);R.push(z)}return R})(g),b=[];for(let w=0;w<x.length;w++){let S=x[w];if(S.isExterior()){let E=[S.points];for(let M=0;M<S.holeIds.length;M++)E.push(x[S.holeIds[M]].points);b.push(E)}}return b}function Fm(r,e,i,n){const s=[],l=n===0?(u,f,p,g,x,b)=>{u.push(new Ue(b,p+(b-f)/(g-f)*(x-p)))}:(u,f,p,g,x,b)=>{u.push(new Ue(f+(b-p)/(x-p)*(g-f),b))};for(const u of r){const f=[];for(const p of u){if(p.length<=2)continue;const g=[];for(let w=0;w<p.length-1;w++){const S=p[w].x,E=p[w].y,M=p[w+1].x,C=p[w+1].y,R=n===0?S:E,F=n===0?M:C;R<e?F>e&&l(g,S,E,M,C,e):R>i?F<i&&l(g,S,E,M,C,i):g.push(p[w]),F<e&&R>=e&&l(g,S,E,M,C,e),F>i&&R<=i&&l(g,S,E,M,C,i)}let x=p.at(-1);const b=n===0?x.x:x.y;b>=e&&b<=i&&g.push(x),g.length&&(x=g.at(-1),g[0].x===x.x&&g[0].y===x.y||g.push(g[0]),f.push(g))}f.length&&s.push(f)}return s}function Fb(r,e){const i=ix(Pg(r),Pg([e]),0);return i==null?[]:rx(i)}function Bb(r,e,i=0){let s=Pg(r,65536);const l=[];for(;e.valid();e.next()){const[u,f]=e.get();let p=u.x*65536,g=u.y*65536,x=f.x*65536,b=f.y*65536;
7const w=x-p,S=b-g,E=Math.hypot(w,S);if(E===0)continue;p-=w*i,g-=S*i,x+=w*i,b+=S*i;const M=Math.trunc(S/E*3),C=-Math.trunc(w/E*3);l.push([[[p,g],[x,b],[x+M,b+C],[p+M,g+C],[p,g]]])}return l.length>0&&(s=ix(s,l,2)),rx(s,1/65536,128)}function Pg(r,e=1){return[r.map(i=>i.map(n=>[n.x*e,n.y*e]))]}function rx(r,e=1,i){return r.map(n=>n.map((s,l)=>{const u=s.map(f=>{let p=f[0],g=f[1];return i&&(p=Math.round(p/i)*i,g=Math.round(g/i)*i),new Ue(p*e,g*e)._round()});return l>0&&u.reverse(),u}))}class Dg{constructor(e,i){this.layoutVertexArray=new Nn,this.indexArray=new Ai,this.lineIndexArray=new en,this.triangleSegments=new di,this.lineSegments=new di,this.programConfigurations=new An(e.layers,{zoom:e.zoom,lut:e.lut}),this.uploaded=!1,i&&(this.elevatedLayoutVertexArray=new Sr)}update(e,i,n,s,l,u,f,p){this.programConfigurations.updatePaintArrays(e,i,l,n,s,u,f,p)}isEmpty(){return this.layoutVertexArray.length===0}needsUpload(){return this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Zi.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,hr.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,i,n,s,l,u,f){this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,n,s,l,u,void 0,f)}}class Bm{constructor(e){this.zoom=e.zoom,this.pixelRatio=e.pixelRatio,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(i=>i.fqid),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.lut=e.lut,this.bufferData=new Dg(e,!1),this.elevationBufferData=new Dg(e,!0),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.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,i){}updateAppearances(e,i,n,s){return{hasLayoutChanges:!1,hasUboChanges:!1}}populate(e,i,n,s){this.hasPattern=bg("fill",this.layers,this.pixelRatio,i);const l=this.layers[0].layout.get("fill-sort-key"),u=[];for(const{feature:f,id:p,index:g,sourceLayerIndex:x}of e){const b=this.layers[0]._featureFilter.needGeometry,w=$n(f,b);if(!this.layers[0]._featureFilter.filter(new Wt(this.zoom,{worldview:this.worldview,activeFloors:i.activeFloors}),w,n))continue;const S=l?l.evaluate(w,{},n,i.availableImages):void 0,E={id:p,properties:f.properties,type:f.type,sourceLayerIndex:x,index:g,geometry:b?w.geometry:gn(f,n,s),patterns:{},sortKey:S};u.push(E)}l&&u.sort((f,p)=>f.sortKey-p.sortKey);for(const f of u){const{geometry:p,index:g,sourceLayerIndex:x}=f;if(this.hasPattern){const b=wg("fill",this.layers,f,this.zoom,this.pixelRatio,i);this.patternFeatures.push(b)}else this.addFeature(f,p,g,n,{},i.availableImages,i.brightness,i.elevationFeatures);i.featureIndex.insert(e[g].feature,p,g,x,this.index)}}update(e,i,n,s,l,u,f){this.bufferData.update(e,i,n,s,l,u,f,this.worldview),this.elevationBufferData.update(e,i,n,s,l,u,f,this.worldview),this.elevatedStructures&&this.elevatedStructures.update(e,i,n,s,l,u,f,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,i,n,s,l,u){for(const f of this.patternFeatures)this.addFeature(f,f.geometry,f.index,i,n,s,u,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()}
vendor: 138,376 bytes, line 7
7addFeature(e,i,n,s,l,u=[],f,p){const g=ff(i,500);this.elevationMode!=="none"?this.addElevatedRoadFeature(e,g,s,n,p):this.addGeometry(g,this.bufferData),this.bufferData.populatePaintArrays(e,n,l,u,s,f,this.worldview),this.elevationBufferData.populatePaintArrays(e,n,l,u,s,f,this.worldview)}getUnevaluatedPortalGraph(){return this.elevatedStructures?this.elevatedStructures.unevaluatedPortals:void 0}setEvaluatedPortalGraph(e,i,n,s,l){this.elevatedStructures&&(this.elevatedStructures.construct(e),this.elevatedStructures.populatePaintArrays(i,n,s,l,this.worldview))}addElevatedRoadFeature(e,i,n,s,l){const u=new Array,f=a.getElevationFeature(e,l);if(!f)return void this.addGeometry(i,this.bufferData);{const g=this.clipPolygonsToTile(i,1);g.length>0&&u.push({polygons:g,elevationFeature:f,elevationTileID:n})}const p={guardRailEnabled:this.layers[0].layout.get("fill-construct-bridge-guard-rail").evaluate(e,{},n),featureIndex:s};for(const g of u)if(g.elevationFeature){if(this.elevationMode==="hd-road-base"){this.elevatedStructures||(this.elevatedStructures=new Dn(g.elevationTileID,this.layers,this.zoom,this.lut));const b=g.elevationFeature.isTunnel();let w=0;Object.hasOwn(e.properties,Em)&&(w=+e.properties[Em]),this.elevatedStructures.addPortalCandidates(g.elevationFeature.id,g.polygons,b,g.elevationFeature,w)}g.elevationFeature.constantHeight==null&&(g.polygons=this.prepareElevatedPolygons(g.polygons,g.elevationFeature,g.elevationTileID));const x=new t(n,g.elevationTileID);this.addElevatedGeometry(g.polygons,x,g.elevationFeature,this.elevationMode==="hd-road-base"?0:.05,s,p)}}addElevatedGeometry(e,i,n,s,l,u){const f={elevation:n,elevationSampler:i,bias:s,index:l,featureInfo:u},[p,g]=this.addGeometry(e,this.elevationBufferData,f);this.elevationBufferData.heightRange==null?this.elevationBufferData.heightRange={min:p,max:g}:(this.elevationBufferData.heightRange.min=Math.min(this.elevationBufferData.heightRange.min,p),this.elevationBufferData.heightRange.max=Math.max(this.elevationBufferData.heightRange.max,g))}addGeometry(e,i,n){let s=Number.POSITIVE_INFINITY,l=Number.NEGATIVE_INFINITY,u=null;n&&(u=n.elevationSampler.constantElevation(n.elevation,n.bias),u!=null&&(s=u,l=u));const f=(p,g,x)=>{if(n!=null)if(g.push(p),u!=null)i.elevatedLayoutVertexArray.emplaceBack(u),x.push(u);else{const b=n.elevationSampler.pointElevation(p,n.elevation,n.bias);i.elevatedLayoutVertexArray.emplaceBack(b),x.push(b),s=Math.min(s,b),l=Math.max(l,b)}};for(const p of e){let g=0;for(const z of p)g+=z.length;const x=i.triangleSegments.prepareSegment(g,i.layoutVertexArray,i.indexArray),b=x.vertexLength,w=[],S=[],E=[],M=[],C=[],R=i.layoutVertexArray.length;for(const z of p){if(z.length===0)continue;z!==p[0]&&S.push(w.length/2);const j=i.lineSegments.prepareSegment(z.length,i.layoutVertexArray,i.lineIndexArray),$=j.vertexLength;n&&C.push(i.layoutVertexArray.length-R),f(z[0],E,M),i.layoutVertexArray.emplaceBack(z[0].x,z[0].y),i.lineIndexArray.emplaceBack($+z.length-1,$),w.push(z[0].x),w.push(z[0].y);for(let q=1;q<z.length;q++)f(z[q],E,M),i.layoutVertexArray.emplaceBack(z[q].x,z[q].y),i.lineIndexArray.emplaceBack($+q-1,$+q),w.push(z[q].x),w.push(z[q].y);j.vertexLength+=z.length,j.primitiveLength+=z.length}const F=Gr(w,S);for(let z=0;z<F.length;z+=3)i.indexArray.emplaceBack(b+F[z],b+F[z+1],b+F[z+2]);if(F.length>0&&n&&this.elevationMode==="hd-road-base"){const z=n.elevation.isTunnel(),j=n.elevation.safeArea,$=this.elevatedStructures.addVertices(E,M);this.elevatedStructures.addTriangles(F,$,z);const q=C.length;if(q>0){for(let ie=0;ie<q-1;ie++)this.elevatedStructures.addRenderableRing(n.index,C[ie]+$,C[ie+1]-C[ie],z,j,n.featureInfo);this.elevatedStructures.addRenderableRing(n.index,C[q-1]+$,E.length-C[q-1],z,j,n.featureInfo)}}x.vertexLength+=g,x.primitiveLength+=F.length/3}return[s,l]}prepareElevatedPolygons(e,i,n){const s=1/Cn(n),l=[];for(const u of e){const f=Bb(u,new af(i,s),.1);l.push(...f)}return l}clipPolygonsToTile(e,i){const n=-i,s=-i,l=Xe+i,u=Xe+i;let f=0;const p=[],g=[];for(;f<e.length;f++){const w=e[f],S=$h(w);(S.min.x>=n&&S.max.x<=l&&S.min.y>=s&&S.max.y<=u?p:g).push(w)}if(p.length===e.length)return e;const x=[new Ue(n,s),new Ue(l,s),new Ue(l,u),new Ue(n,u),new Ue(n,s)],b=p;for(const w of g)b.push(...Fb(w,x));return b}}let nx,ox,sx,ax;et(Bm,"FillBucket",{omit:["layers","patternFeatures"]}),et(Dg,"FillBufferData"),et(Dn,"ElevatedStructures");class km{constructor(e,i,n,s){if(this.triangleCount=i.length/3,this.min=new Ue(0,0),this.max=new Ue(0,0),this.xScale=0,this.yScale=0,this.cellsX=0,this.cellsY=0,this.cells=[],this.payload=[],this.triangleCount===0||e.length===0)return;const[l,u]=[e[0].clone(),e[0].clone()];for(let b=1;b<e.length;++b){const w=e[b];l.x=Math.min(l.x,w.x),l.y=Math.min(l.y,w.y),u.x=Math.max(u.x,w.x),u.y=Math.max(u.y,w.y)}if(s){const b=Math.ceil(Math.max(u.x-l.x,u.y-l.y)/s);n=Math.max(n,b)}if(n===0)return;this.min=l,this.max=u;const f=this.max.sub(this.min);f.x=Math.max(f.x,1),f.y=Math.max(f.y,1);const p=Math.max(f.x,f.y)/n;this.cellsX=Math.max(1,Math.ceil(f.x/p)),this.cellsY=Math.max(1,Math.ceil(f.y/p)),this.xScale=1/p,this.yScale=1/p;const g=[];for(let b=0;b<this.triangleCount;b++){const w=e[i[3*b+0]].sub(this.min),S=e[i[3*b+1]].sub(this.min),E=e[i[3*b+2]].sub(this.min),M=js(Math.floor(Math.min(w.x,S.x,E.x)),this.xScale,this.cellsX),C=js(Math.floor(Math.max(w.x,S.x,E.x)),this.xScale,this.cellsX),R=js(Math.floor(Math.min(w.y,S.y,E.y)),this.yScale,this.cellsY),F=js(Math.floor(Math.max(w.y,S.y,E.y)),this.yScale,this.cellsY),z=new Ue(0,0),j=new Ue(0,0),$=new Ue(0,0),q=new Ue(0,0);for(let ie=R;ie<=F;++ie){z.y=j.y=ie*p,$.y=q.y=(ie+1)*p;for(let W=M;W<=C;++W)z.x=$.x=W*p,j.x=q.x=(W+1)*p,(Z(w,S,E,z,j,q)||Z(w,S,E,z,q,$))&&g.push({cellIdx:ie*this.cellsX+W,triIdx:b})}}if(g.length===0)return;g.sort((b,w)=>b.cellIdx-w.cellIdx||b.triIdx-w.triIdx);let x=0;for(;x<g.length;){const b=g[x].cellIdx,w={start:this.payload.length,len:0};for(;x<g.length&&g[x].cellIdx===b;)++w.len,this.payload.push(g[x++].triIdx);this.cells[b]=w}}_lazyInitLookup(){this.lookup||(this.lookup=new Uint8Array(Math.ceil(this.triangleCount/8))),this.lookup.fill(0)}queryPoint(e,i){if(this.triangleCount===0||this.cells.length===0||e.x>this.max.x||this.min.x>e.x||e.y>this.max.y||this.min.y>e.y)return;const n=js(e.x-this.min.x,this.xScale,this.cellsX),s=js(e.y-this.min.y,this.yScale,this.cellsY),l=this.cells[s*this.cellsX+n];if(l){this._lazyInitLookup();for(let u=0;u<l.len;u++){const f=this.payload[l.start+u],p=Math.floor(f/8),g=1<<f%8;if(!(this.lookup[p]&g)&&(this.lookup[p]|=g,i.push(f),i.length===this.triangleCount))return}}}query(e,i,n){if(this.triangleCount===0||this.cells.length===0||e.x>this.max.x||this.min.x>i.x||e.y>this.max.y||this.min.y>i.y)return;this._lazyInitLookup();const s=js(e.x-this.min.x,this.xScale,this.cellsX),l=js(i.x-this.min.x,this.xScale,this.cellsX),u=js(e.y-this.min.y,this.yScale,this.cellsY),f=js(i.y-this.min.y,this.yScale,this.cellsY);for(let p=u;p<=f;p++)for(let g=s;g<=l;g++){const x=this.cells[p*this.cellsX+g];if(x)for(let b=0;b<x.len;b++){const w=this.payload[x.start+b],S=Math.floor(w/8),E=1<<w%8;if(!(this.lookup[S]&E)&&(this.lookup[S]|=E,n.push(w),n.length===this.triangleCount))return}}}}function js(r,e,i){return Math.max(0,Math.min(i-1,Math.floor(r*e)))}et(km,"TriangleGridIndex");class lx{constructor(e){this.zoom=e.zoom,this.layers=e.layers,this.layerIds=this.layers.map(i=>i.fqid),this.index=e.index,this.hasPattern=!1,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.footprints=[],this.worldview=e.worldview,this.hasAppearances=null}updateFootprints(e,i){for(const n of this.footprints)i.push({footprint:n,id:e})}updateAppearances(e,i,n,s){return{hasLayoutChanges:!1,hasUboChanges:!1}}populate(e,i,n,s){const l=[];for(const{feature:u,id:f,index:p,sourceLayerIndex:g}of e){const x=this.layers[0]._featureFilter.needGeometry,b=$n(u,x);if(!this.layers[0]._featureFilter.filter(new Wt(this.zoom,{worldview:this.worldview,activeFloors:i.activeFloors}),b,n))continue;const w={id:f,properties:u.properties,type:u.type,sourceLayerIndex:g,index:p,geometry:x?b.geometry:gn(u,n,s),patterns:{}};l.push(w)}for(const u of l){const{geometry:f,index:p,sourceLayerIndex:g}=u;this.addFeature(u,f,p,n,{},i.availableImages,i.brightness),i.featureIndex.insert(e[p].feature,f,p,g,this.index)}}isEmpty(){return this.footprints.length===0}uploadPending(){return!1}upload(e){}update(e,i,n,s,l,u,f){}destroy(){}addFeature(e,i,n,s,l,u=[],f){for(const p of ff(i,2)){const g=[],x=[],b=[],w=new Ue(1/0,1/0),S=new Ue(-1/0,-1/0);for(const C of p)if(C.length!==0){C!==p[0]&&b.push(x.length/2);for(let R=0;R<C.length;R++)x.push(C[R].x),x.push(C[R].y),g.push(C[R]),w.x=Math.min(w.x,C[R].x),w.y=Math.min(w.y,C[R].y),S.x=Math.max(S.x,C[R].x),S.y=Math.max(S.y,C[R].y)}const E=Gr(x,b),M=new km(g,E,8,256);this.footprints.push({vertices:g,indices:E,grid:M,min:w,max:S})}}}et(lx,"ClipBucket",{omit:["layers"]});const kb=Rt([{name:"a_pos_normal_ed",components:4,type:"Int16"}]),Nb=Rt([{name:"a_pos_end",components:4,type:"Int16"},{name:"a_angular_offset_factor",components:1,type:"Int16"}]),Ub=Rt([{name:"a_flood_light_ground_radius",components:1,type:"Float32"}]),Vb=Rt([{name:"a_centroid_pos",components:2,type:"Uint16"}]),jb=Rt([{name:"a_join_normal_inside",components:3,type:"Int16"}]),Gb=Rt([{name:"a_hidden_by_landmark",components:1,type:"Uint8"}]),$b=Rt([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]),{members:Hb}=kb,_f=Number.MAX_SAFE_INTEGER,qb=_f-1;function cx(r,e,i,n){return r.order<e||r.order===_f||!(r.clipMask&i)||(function(s,l){if(l.length===0)return!1;let u=s;for(;u!=="";){if(l.includes(u))return!1;u=nm(u)}return!0})(n,r.clipScope)}function Nm(r,e){return r.x-e.x||r.y-e.y}function ux(r,e){return Nm(r.min,e.min)===0&&Nm(r.max,e.max)===0}function Rg(r,e){return!(r.min.x>e.max.x||r.max.x<e.min.x||r.min.y>e.max.y||r.max.y<e.min.y)}function Um(r,e){if(r.length!==e.length)return!1;for(let i=0;i<r.length;i++)if(r[i].sourceId!==e[i].sourceId||!ux(r[i],e[i])||r[i].order!==e[i].order||r[i].clipMask!==e[i].clipMask||!Wo(r[i].clipScope,e[i].clipScope))return!1;return!0}function hx(r,e,i){const n=1/Xe,s=1/(1<<i.canonical.z),l=(e.x*n+i.canonical.x)*s+i.wrap,u=(e.y*n+i.canonical.y)*s;return{min:new Ue((r.x*n+i.canonical.x)*s+i.wrap,(r.y*n+i.canonical.y)*s),max:new Ue(l,u)}}function Zb(r,e,i){const n=1<<i.canonical.z,s=((e.x-i.wrap)*n-i.canonical.x)*Xe,l=(e.y*n-i.canonical.y)*Xe;return{min:new Ue(((r.x-i.wrap)*n-i.canonical.x)*Xe,(r.y*n-i.canonical.y)*Xe),max:new Ue(s,l)}}function zg(r,e,i,n,s,l,u){const f=r.indices,p=r.vertices,g=[];for(let x=n;x<n+s;x+=3){const b=e[i[x+0]+l],w=e[i[x+1]+l],S=e[i[x+2]+l],E=Math.min(b.x,w.x,S.x),M=Math.max(b.x,w.x,S.x),C=Math.min(b.y,w.y,S.y),R=Math.max(b.y,w.y,S.y);g.length=0,r.grid.query(new Ue(E,C),new Ue(M,R),g);for(let F=0;F<g.length;F++){const z=g[F];if(Z(p[f[3*z+0]],p[f[3*z+1]],p[f[3*z+2]],b,w,S,u))return!0}}return!1}function dx(r,e,i,n){if(!r||!i)return!1;let s=r.vertices;if(!e.canonical.equals(n.canonical)||e.wrap!==n.wrap){if(i.vertices.length<r.vertices.length)return dx(i,n,r,e);const l=e.canonical,u=n.canonical,f=Math.pow(2,u.z-l.z);s=r.vertices.map(p=>new Ue((p.x+l.x*Xe)*f-u.x*Xe,(p.y+l.y*Xe)*f-u.y*Xe))}return zg(i,s,r.indices,0,r.indices.length,0,0)}function fx(r,e,i,n){const s=Math.pow(2,n.z-i.z);return new Ue((r+i.x*Xe)*s-n.x*Xe,(e+i.y*Xe)*s-n.y*Xe)}function px(r,e){const i=[];e.grid.queryPoint(r,i);const n=e.indices,s=e.vertices;for(let l=0;l<i.length;l++){const u=i[l];if(L([s[n[3*u+0]],s[n[3*u+1]],s[n[3*u+2]]],r))return!0}return!1}const Vm={None:0,Model:1,Symbol:2,FillExtrusion:4},Lg=[new Ue(0,0),new Ue(Xe,0),new Ue(Xe,Xe),new Ue(0,Xe)];function mx(r,e){const i=[];let n=[];if(!e||r.length<2)return[r];if(r.length===2)return N(r[0],r[1],Lg)?[r]:[];for(let s=0;s<r.length+2;s++){const l=s===0?r.at(-1):r[(s-1)%r.length],u=r[s%r.length],f=r[(s+1)%r.length],p=N(l,u,Lg),g=N(u,f,Lg),x=p||g;x&&n.push(u),x&&g||n.length>0&&(n.length>1&&i.push(n),n=[])}return n.length>1&&i.push(n),i}const Og=Ns.types,Wb=["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"],Xb=["fill-extrusion-flood-light-ground-radius"],Yb=Math.pow(2,13),Jb=Math.pow(2,15)-1,jm=new Ue(0,1),Oa=2147483648,Gm=1073741824;function gf(r,e,i,n,s,l,u,f){r.emplaceBack((e<<1)+u,(i<<1)+l,(Math.floor(n*Yb)<<1)+s,Math.round(f))}function yf(r,e,i){r.emplaceBack(e.x*Xe,e.y*Xe,i?1:0)}function $m(r,e,i,n,s,l){r.emplaceBack(e.x,e.y,(i.x<<1)+n,(i.y<<1)+s,l)}function xf(r,e,i){r.emplaceBack(e.x,e.y,e.z,i[0]*16384,i[1]*16384,i[2]*16384)}class _x{constructor(){this.vertexOffset=0,this.vertexCount=0,this.indexOffset=0,this.indexCount=0}}class Hm{constructor(){this.data=[]}get length(){return this.data.length}push(e){this.data.push(e)}get(e){return this.data[e]}static serialize(e,i){const n=e.data.length,s=new Uint32Array(4*n),l=[];l.length=n;for(let u=0;u<n;u++){const f=e.data[u],p=4*u;s[p]=f.vertexOffset,s[p+1]=f.vertexCount,s[p+2]=f.indexOffset,s[p+3]=f.indexCount,l[u]=f.ringIndices}return i&&i.add(s.buffer),{scalars:s,rings:l}}static deserialize(e){const{scalars:i,rings:n}=e,s=i.length/4,l=new Hm,u=[];u.length=s,l.data=u;for(let f=0;f<s;f++){const p=4*f,g=new _x;g.vertexOffset=i[p],g.vertexCount=i[p+1],g.indexOffset=i[p+2],g.indexCount=i[p+3],g.ringIndices=n[f],l.data[f]=g}return l}}class qm{constructor(){this.centroidXY=new Ue(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 Ue(Number.MAX_VALUE,Number.MAX_VALUE),this.max=new Ue(-Number.MAX_VALUE,-Number.MAX_VALUE),this.height=0,this.buildingId=0,this.groupCentroidPos=new Ue(0,0)}span(){return new Ue(this.max.x-this.min.x,this.max.y-this.min.y)}}class Zm{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,i){const n=e.data.length,s=new Float64Array(15*n);for(let l=0;l<n;l++){const u=e.data[l],f=15*l;s[f]=u.centroidXY.x,s[f+1]=u.centroidXY.y,s[f+2]=u.min.x,s[f+3]=u.min.y,s[f+4]=u.max.x,s[f+5]=u.max.y,s[f+6]=u.groupCentroidPos.x,s[f+7]=u.groupCentroidPos.y,s[f+8]=u.vertexArrayOffset,s[f+9]=u.vertexCount,s[f+10]=u.groundVertexArrayOffset,s[f+11]=u.groundVertexCount,s[f+12]=u.footprintSegLen,s[f+13]=u.height,s[f+14]=u.buildingId}return i&&i.add(s.buffer),{buffer:s}}static deserialize(e){const i=e.buffer,n=i.length/15,s=new Zm;s.buffer=i;const l=[];l.length=n,s.data=l;let u=0;for(let f=0;f<n;f++){const p=15*f,g=new qm;g.centroidXY=new Ue(i[p],i[p+1]),g.min=new Ue(i[p+2],i[p+3]),g.max=new Ue(i[p+4],i[p+5]),g.groupCentroidPos=new Ue(i[p+6],i[p+7]),g.vertexArrayOffset=i[p+8],g.vertexCount=i[p+9],g.groundVertexArrayOffset=i[p+10],g.groundVertexCount=i[p+11],g.footprintSegLen=i[p+12],g.height=i[p+13],g.buildingId=i[p+14],g.footprintSegIdx=u,u+=g.footprintSegLen,s.data[f]=g}return s}}class Fg{constructor(){this.acc=new Ue(0,0),this.accCount=0,this.centroidDataIndex=0}startRing(e,i){e.min.x===Number.MAX_VALUE&&(e.min.x=e.max.x=i.x,e.min.y=e.max.y=i.y)}appendEdge(e,i,n){this.accCount++,this.acc._add(i);let s=!!this.borders;i.x<e.min.x?(e.min.x=i.x,s=!0):i.x>e.max.x&&(e.max.x=i.x,s=!0),i.y<e.min.y?(e.min.y=i.y,s=!0):i.y>e.max.y&&(e.max.y=i.y,s=!0),((i.x===0||i.x===Xe)&&i.x===n.x)!=((i.y===0||i.y===Xe)&&i.y===n.y)&&this.processBorderOverlap(i,n),s&&this.checkBorderIntersection(i,n)}checkBorderIntersection(e,i){i.x<0!=e.x<0&&this.addBorderIntersection(0,ft(i.y,e.y,(0-i.x)/(e.x-i.x))),i.x>Xe!=e.x>Xe&&this.addBorderIntersection(1,ft(i.y,e.y,(Xe-i.x)/(e.x-i.x))),i.y<0!=e.y<0&&this.addBorderIntersection(2,ft(i.x,e.x,(0-i.y)/(e.y-i.y))),i.y>Xe!=e.y>Xe&&this.addBorderIntersection(3,ft(i.x,e.x,(Xe-i.y)/(e.y-i.y)))}addBorderIntersection(e,i){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 n=this.borders[e];i<n[0]&&(n[0]=i),i>n[1]&&(n[1]=i)}processBorderOverlap(e,i){if(e.x===i.x){if(e.y===i.y)return;const n=e.x===0?0:1;this.addBorderIntersection(n,i.y),this.addBorderIntersection(n,e.y)}else{const n=e.y===0?2:3;this.addBorderIntersection(n,i.x),this.addBorderIntersection(n,e.x)}}centroid(){return this.accCount===0?new Ue(0,0):new Ue(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,i)=>e+ +(i[0]!==Number.MAX_VALUE),0):0}}function gx(r,e){const i=r.add(e)._unit(),n=re(r.x*i.x+r.y*i.y,-1,1);var s,l,u;return u=Math.acos(n),Math.min(4,Math.max(-4,Math.tan(u)))/4*Jb*((s=r).x*(l=e).y-s.y*l.x<0?-1:1)}const Kb=[r=>r.x<0,r=>r.x>Xe,r=>r.y<0,r=>r.y>Xe];function Qb(r,e,i,n){const s=[4];if(n===0)return s;i._mult(n);const l=r.sub(i),u=e.sub(i),f=[r,e,l,u];for(let p=0;p<4;p++)for(const g of f)if(Kb[p](g)){s.push(p);break}return s}class Bg{constructor(e){this.groundRadiusArray=null,this.groundRadiusBuffer=null,this.vertexArray=new Od,this.indexArray=new Ai,this.programConfigurations=new An(e.layers,{zoom:e.zoom,lut:e.lut},i=>Xb.includes(i)),this._segments=new di,this.hiddenByLandmarkVertexArray=new Fc,this._segmentToGroundQuads={},this._segmentToGroundQuads[0]=[],this._segmentToRegionTriCounts={},this._segmentToRegionTriCounts[0]=[0,0,0,0,0],this.regionSegments={},this.regionSegments[4]=new di}getDefaultSegment(){return this.regionSegments[4]}hasData(){return this.vertexArray.length!==0}addData(e,i,n,s=!1){const l=e.length;if(l>2){let u=Math.max(0,this._segments.get().length-1);const f=this._segments._prepareSegment(4*l,this.vertexArray.length,2*this._segmentToGroundQuads[u].length);let p;u!==this._segments.get().length-1&&(u++,this._segmentToGroundQuads[u]=[],this._segmentToRegionTriCounts[u]=[0,0,0,0,0]);{const g=e[0],x=e[1];p=gx(g.sub(e[l-1])._perp()._unit(),x.sub(g)._perp()._unit())}for(let g=0;g<l;g++){const x=g===l-1?0:g+1,b=e[g],w=e[x],S=e[x===l-1?0:x+1],E=w.sub(b)._perp()._unit(),M=gx(E,S.sub(w)._perp()._unit()),C=p,R=M;if(kg(b,w,i)||s&&vx(b,i)&&vx(w,i)){p=M;continue}const F=f.vertexLength;$m(this.vertexArray,b,w,1,1,C),$m(this.vertexArray,b,w,1,0,C),$m(this.vertexArray,b,w,0,1,R),$m(this.vertexArray,b,w,0,0,R),f.vertexLength+=4;const z=Qb(b,w,E,n);for(const j of z)this._segmentToGroundQuads[u].push({id:F,region:j}),this._segmentToRegionTriCounts[u][j]+=2,f.primitiveLength+=2;p=M}}}prepareBorderSegments(){if(!this.hasData())return;const e=this._segments.get(),i=e.length;for(let n=0;n<i;n++)this._segmentToGroundQuads[n].sort((s,l)=>s.region-l.region);for(let n=0;n<i;n++){const s=this._segmentToGroundQuads[n],l=e[n],u=this._segmentToRegionTriCounts[n];u.reduce((p,g)=>p+g,0);let f=0;for(let p=0;p<=4;p++){const g=u[p];if(g!==0){let x=this.regionSegments[p];x||(x=this.regionSegments[p]=new di);const b={vertexOffset:l.vertexOffset,primitiveOffset:l.primitiveOffset+f,vertexLength:l.vertexLength,primitiveLength:g};x.get().push(b)}f+=g}for(let p=0;p<s.length;p++){const g=s[p].id;this.indexArray.emplaceBack(g,g+1,g+3),this.indexArray.emplaceBack(g,g+3,g+2)}}this._segmentToGroundQuads=null,this._segmentToRegionTriCounts=null,this._segments.destroy(),this._segments=null}addPaintPropertiesData(e,i,n,s,l,u,f){this.hasData()&&this.programConfigurations.populatePaintArrays(this.vertexArray.length,e,i,n,s,l,u,void 0,f)}upload(e){this.hasData()&&(this.vertexBuffer=e.createVertexBuffer(this.vertexArray,Nb.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.groundRadiusArray!=null&&(this.groundRadiusBuffer=e.createVertexBuffer(this.groundRadiusArray,Ub.members)))}uploadPaintProperties(e){this.hasData()&&this.programConfigurations.upload(e)}update(e,i,n,s,l,u,f,p){this.hasData()&&this.programConfigurations.updatePaintArrays(e,i,n,s,l,u,f,p)}updateHiddenByLandmark(e){this.updateHiddenByLandmarkRange(e.groundVertexArrayOffset,e.groundVertexCount,!!(e.flags&Oa||e.flags&Gm))}updateHiddenByLandmarkRange(e,i,n){if(!this.hasData())return;const s=i+e;if(i!==0){for(let l=e;l<s;++l)this.hiddenByLandmarkVertexArray.emplace(l,n?1:0);this._needsHiddenByLandmarkUpdate=!0}}uploadHiddenByLandmark(e){this.hasData()&&this._needsHiddenByLandmarkUpdate&&(!this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexArray.length>0?this.hiddenByLandmarkVertexBuffer=e.createVertexBuffer(this.hiddenByLandmarkVertexArray,Gb.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 i=this.regionSegments[e];i&&i.destroy()}}}}class Wm{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(i=>i.fqid),this.index=e.index,this.hasPattern=!1,this.edgeRadius=0,this.projection=e.projection,this.activeReplacements=[],this.replacementUpdateTime=0,this.centroidData=new Zm,this.footprintIndices=new Ai,this.footprintVertices=new Nn,this.footprintSegments=new Hm,this.layoutVertexArray=new Ld,this.centroidVertexArray=new fm,this.wallVertexArray=new mm,this.indexArray=new Ai,this.programConfigurations=new An(e.layers,{zoom:e.zoom,lut:e.lut},i=>Wb.includes(i)),this.segments=new di,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.groundEffect=new Bg(e),this.maxHeight=0,this.partLookup={},this.triangleSubSegments=[],this.polygonSegments=[],this.buildingGroups=new Map,this.worldview=e.worldview,this.hasAppearances=null}updateFootprints(e,i){}updateAppearances(e,i,n,s){return{hasLayoutChanges:!1,hasUboChanges:!1}}populate(e,i,n,s){this.features=[],this.hasPattern=bg("fill-extrusion",this.layers,this.pixelRatio,i),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=Cn(n),this.edgeRadius=this.layers[0].layout.get("fill-extrusion-edge-radius")/this.tileToMeter,this.wallMode=this.layers[0].paint.get("fill-extrusion-line-width").constantOr(1)!==0;for(const{feature:l,id:u,index:f,sourceLayerIndex:p}of e){const g=this.layers[0]._featureFilter.needGeometry,x=$n(l,g);if(!this.layers[0]._featureFilter.filter(new Wt(this.zoom,{worldview:this.worldview,activeFloors:i.activeFloors}),x,n))continue;const b={id:u,sourceLayerIndex:p,index:f,geometry:g?x.geometry:gn(l,n,s),properties:l.properties,type:l.type,patterns:{}},w=this.layoutVertexArray.length,S=Og[b.type]==="Polygon";if(this.hasPattern)this.features.push({featureId:l.id,feature:wg("fill-extrusion",this.layers,b,this.zoom,this.pixelRatio,i)});else if(this.wallMode)for(const E of b.geometry)for(const M of mx(E,S))this.addFeature(l.id,b,[M],f,n,{},i.availableImages,s,i.brightness);else this.addFeature(l.id,b,b.geometry,f,n,{},i.availableImages,s,i.brightness);i.featureIndex.insert(l,b.geometry,f,p,this.index,w)}this._finalizeBuildingGroups(),this.sortBorders(),this.projection.name==="mercator"&&this.splitToSubtiles(),this.groundEffect.prepareBorderSegments(),this.polygonSegments.length=0}addFeatures(e,i,n,s,l,u){for(const{featureId:f,feature:p}of this.features){const g=Og[p.type]==="Polygon",{geometry:x}=p;if(this.wallMode)for(const b of x)for(const w of mx(b,g))this.addFeature(f,p,[w],p.index,i,n,s,l,u);else this.addFeature(f,p,x,p.index,i,n,s,l,u)}this._finalizeBuildingGroups(),this.sortBorders(),this.projection.name==="mercator"&&this.splitToSubtiles()}update(e,i,n,s,l,u,f){this.programConfigurations.updatePaintArrays(e,i,l,n,s,u,f,this.worldview),this.groundEffect.update(e,i,l,n,s,u,f,this.worldview)}updateExpressions(e){this.programConfigurations.updateExpressions(e),this.groundEffect.programConfigurations.updateExpressions(e)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload||this.groundEffect.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Hb),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.wallVertexBuffer=e.createVertexBuffer(this.wallVertexArray,jb.members),this.layoutVertexExtArray&&(this.layoutVertexExtBuffer=e.createVertexBuffer(this.layoutVertexExtArray,$b.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,Vb.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,i,n,s,l,u,f,p,g){const x=this.layers[0].paint.get("fill-extrusion-flood-light-ground-radius").evaluate(i,{})/this.tileToMeter,b=[new Ue(0,0),new Ue(Xe,Xe)],w=p.projection,S=w.name==="globe",E=this.wallMode||Og[i.type]==="Polygon",M=new Fg;M.centroidDataIndex=this.centroidData.length;const C=new qm;C.buildingId=e,i.properties&&Object.hasOwn(i.properties,"building_id")&&(C.buildingId=Number(i.properties.building_id)),M.buildingId=C.buildingId;const R=this.layers[0].paint.get("fill-extrusion-base").evaluate(i,{},l)<=0,F=this.layers[0].paint.get("fill-extrusion-height").evaluate(i,{},l);let z;if(C.height=F,C.vertexArrayOffset=this.layoutVertexArray.length,C.groundVertexArrayOffset=this.groundEffect.vertexArray.length,S&&!this.layoutVertexExtArray&&(this.layoutVertexExtArray=new Ku),this.wallMode){if(S)return void Pt("Non zero fill-extrusion-line-width is not yet supported on globe.");if(n.length!==1)return;z=(function(Y){const ee=Y[0].x===Y.at(-1).x&&Y[0].y===Y.at(-1).y;(function(Ge){let $e=0;const Je=Ge.length;for(let Qe=0;Qe<Je;Qe++)$e+=(Ge[(Qe+1)%Je].x-Ge[Qe].x)*(Ge[(Qe+1)%Je].y+Ge[Qe].y);return $e>=0})(Y)||(Y=Y.reverse());const ge={geometry:[],joinNormals:[],indices:[]},Te=[],Ae=[],Ie=[];let Fe=Y.length;for(;Fe>=2&&Y[Fe-1].equals(Y[Fe-2]);)Fe--;if(Fe<(ee?3:2))return ge;let xe,Se,Me,ze,Le,We=0;for(;We<Fe-1&&Y[We].equals(Y[We+1]);)We++;ee&&(xe=Y[Fe-2],Le=Y[We].sub(xe)._unit()._perp());for(let Ge=We;Ge<Fe;Ge++){if(Me=Ge===Fe-1?ee?Y[We+1]:void 0:Y[Ge+1],Me&&Y[Ge].equals(Me))continue;Le&&(ze=Le),xe&&(Se=xe),xe=Y[Ge],Le=Me?Me.sub(xe)._unit()._perp():ze,ze=ze||Le;let $e=ze.add(Le);$e.x===0&&$e.y===0||$e._unit();const Je=$e.x*Le.x+$e.y*Le.y,Qe=Je!==0?1/Je:1/0,ct=ze.x*Le.y-ze.y*Le.x>0;let nt="miter";const mt=2;nt==="miter"&&Qe>mt&&(nt="bevel"),nt==="bevel"&&(Qe>100&&(nt="flipbevel"),Qe<mt&&(nt="miter"));const Gt=(wt,kt,Mt,Oi)=>{const Yt=new Ue(wt.x,wt.y),jt=new Ue(wt.x,wt.y);Yt.x+=kt.x*Oi,Yt.y+=kt.y*Oi,jt.x-=kt.x*Math.max(Mt,1),jt.y-=kt.y*Math.max(Mt,1),Ie.push(kt),Te.push(Yt),Ae.push(jt)};if(nt==="miter")$e._mult(Qe),Gt(xe,$e,0,0);else if(nt==="flipbevel")$e=Le.mult(-1),Gt(xe,$e,0,0),Gt(xe,$e.mult(-1),0,0);else{const wt=-Math.sqrt(Qe*Qe-1),kt=ct?wt:0,Mt=ct?0:wt;Se&&Gt(xe,ze,kt,Mt),Me&&Gt(xe,Le,kt,Mt)}}ge.geometry=[...Te,...Ae.reverse(),Te[0]],ge.joinNormals=[...Ie,...Ie.reverse(),Ie.at(-1)];const De=ge.geometry.length-1;for(let Ge=0;Ge<De/2;Ge++)if(Ge+1<De/2){let $e=Ge,Je=Ge+1,Qe=De-1-Ge,ct=De-2-Ge;$e=$e===0?De-1:$e-1,Je=Je===0?De-1:Je-1,Qe=Qe===0?De-1:Qe-1,ct=ct===0?De-1:ct-1,ge.indices.push(Qe),ge.indices.push(Je),ge.indices.push($e),ge.indices.push(Qe),ge.indices.push(ct),ge.indices.push(Je)}return ge})(n[0]),n=[z.geometry]}const j=(Y,ee)=>Y<(ee.length-1)/2||Y===ee.length-1,$=this.wallMode?[n]:ff(n,500);for(let Y=$.length-1;Y>=0;Y--){const ee=$[Y];(ee.length===0||t1(ee[0]))&&$.splice(Y,1)}let q;if(S)q=Sx($,b,l);else{q=[];for(const Y of $)q.push({polygon:Y,bounds:b})}const ie=E?this.edgeRadius:0,W=ie>0&&this.zoom<17,Q=(Y,ee)=>{if(Y.length===0)return!1;const me=Y.at(-1);return ee.x===me.x&&ee.y===me.y};for(const{polygon:Y,bounds:ee}of q){let me=0,ge=0;for(const Fe of Y)E&&!Fe[0].equals(Fe.at(-1))&&Fe.push(Fe[0]),ge+=E?Fe.length-1:Fe.length;const Te=this.segments.prepareSegment((E?5:4)*ge,this.layoutVertexArray,this.indexArray);C.footprintSegIdx<0&&(C.footprintSegIdx=this.footprintSegments.length),C.polygonSegIdx<0&&(C.polygonSegIdx=this.polygonSegments.length);const Ae={triangleArrayOffset:this.indexArray.length,triangleCount:0,triangleSegIdx:this.segments.segments.length-1},Ie=new _x;if(Ie.vertexOffset=this.footprintVertices.length,Ie.indexOffset=3*this.footprintIndices.length,Ie.ringIndices=[],E){const Fe=[],xe=[];me=Te.vertexLength;for(let Me=0;Me<Y.length;Me++){const ze=Y[Me];ze.length&&Me!==0&&xe.push(Fe.length/2);const Le=[];let We,De;We=ze[1].sub(ze[0])._perp()._unit(),Ie.ringIndices.push(ze.length-1);for(let Ge=1;Ge<ze.length;Ge++){const $e=ze[Ge],Je=ze[Ge===ze.length-1?1:Ge+1],Qe=$e.clone();if(ie){De=Je.sub($e)._perp()._unit();const ct=We.add(De)._unit(),nt=ie*Math.min(4,1/(We.x*ct.x+We.y*ct.y));Qe.x+=nt*ct.x,Qe.y+=nt*ct.y,Qe.x=Math.round(Qe.x),Qe.y=Math.round(Qe.y),We=De}if(!R||ie!==0&&!W||Q(Le,Qe)||Le.push(Qe),gf(this.layoutVertexArray,Qe.x,Qe.y,0,0,1,1,0),this.wallMode){const ct=j(Ge,ze);yf(this.wallVertexArray,z.joinNormals[Ge],!ct)}Te.vertexLength++,this.footprintVertices.emplaceBack($e.x,$e.y),Fe.push($e.x,$e.y),S&&xf(this.layoutVertexExtArray,w.projectTilePoint(Qe.x,Qe.y,l),w.upVector(l,Qe.x,Qe.y))}R&&(ie===0||W)&&(Le.length!==0&&Q(Le,Le[0])&&Le.pop(),this.groundEffect.addData(Le,ee,x))}const Se=this.wallMode?z.indices:Gr(Fe,xe);for(let Me=0;Me<Se.length;Me+=3)this.footprintIndices.emplaceBack(Ie.vertexOffset+Se[Me+0],Ie.vertexOffset+Se[Me+1],Ie.vertexOffset+Se[Me+2]),this.indexArray.emplaceBack(me+Se[Me],me+Se[Me+2],me+Se[Me+1]),Te.primitiveLength++;Ie.indexCount+=Se.length,Ie.vertexCount+=this.footprintVertices.length-Ie.vertexOffset}for(let Fe=0;Fe<Y.length;Fe++){const xe=Y[Fe];M.startRing(C,xe[0]);let Se=xe.length>4&&bx(xe[xe.length-2],xe[0],xe[1]),Me=ie?e1(xe[xe.length-2],xe[0],xe[1],ie):0;const ze=[];let Le,We,De;We=xe[1].sub(xe[0])._perp()._unit();let Ge=!0;for(let $e=1,Je=0;$e<xe.length;$e++){let Qe=xe[$e-1],ct=xe[$e];const nt=xe[$e===xe.length-1?1:$e+1];if(M.appendEdge(C,ct,Qe),kg(ct,Qe,ee)){ie&&(We=nt.sub(ct)._perp()._unit(),Ge=!Ge);continue}const mt=ct.sub(Qe)._perp(),Gt=mt.x/(Math.abs(mt.x)+Math.abs(mt.y)),wt=mt.y>0?1:0,kt=Qe.dist(ct);if(Je+kt>32768&&(Je=0),ie){De=nt.sub(ct)._perp()._unit();let jt=xx(Qe,ct,nt,yx(We,De),ie);isNaN(jt)&&(jt=0);const ci=ct.sub(Qe)._unit();Qe=Qe.add(ci.mult(Me))._round(),ct=ct.add(ci.mult(-jt))._round(),Me=jt,We=De,R&&this.zoom>=17&&(Q(ze,Qe)||ze.push(Qe),Q(ze,ct)||ze.push(ct))}const Mt=Te.vertexLength,Oi=xe.length>4&&bx(Qe,ct,nt);let Yt=wx(Je,Se,Ge);if(gf(this.layoutVertexArray,Qe.x,Qe.y,Gt,wt,0,0,Yt),gf(this.layoutVertexArray,Qe.x,Qe.y,Gt,wt,0,1,Yt),this.wallMode){const jt=j($e-1,xe),ci=z.joinNormals[$e-1];yf(this.wallVertexArray,ci,jt),yf(this.wallVertexArray,ci,jt)}if(Je+=kt,Yt=wx(Je,Oi,!Ge),Se=Oi,gf(this.layoutVertexArray,ct.x,ct.y,Gt,wt,0,0,Yt),gf(this.layoutVertexArray,ct.x,ct.y,Gt,wt,0,1,Yt),this.wallMode){const jt=j($e,xe),ci=z.joinNormals[$e];yf(this.wallVertexArray,ci,jt),yf(this.wallVertexArray,ci,jt)}if(Te.vertexLength+=4,this.indexArray.emplaceBack(Mt+0,Mt+1,Mt+2),this.indexArray.emplaceBack(Mt+1,Mt+3,Mt+2),Te.primitiveLength+=2,ie){const jt=me+($e===1?xe.length-2:$e-2),ci=$e===1?me:jt+1;if(this.indexArray.emplaceBack(Mt+1,jt,Mt+3),this.indexArray.emplaceBack(jt,ci,Mt+3),Te.primitiveLength+=2,Le===void 0&&(Le=Mt),!kg(nt,xe[$e],ee)){const Si=$e===xe.length-1?Le:Te.vertexLength;this.indexArray.emplaceBack(Mt+2,Mt+3,Si),this.indexArray.emplaceBack(Mt+3,Si+1,Si),this.indexArray.emplaceBack(Mt+3,ci,Si+1),Te.primitiveLength+=3}Ge=!Ge}if(S){const jt=this.layoutVertexExtArray,ci=w.projectTilePoint(Qe.x,Qe.y,l),Si=w.projectTilePoint(ct.x,ct.y,l),fr=w.upVector(l,Qe.x,Qe.y),mi=w.upVector(l,ct.x,ct.y);xf(jt,ci,fr),xf(jt,ci,fr),xf(jt,Si,mi),xf(jt,Si,mi)}}E&&(me+=xe.length-1),R&&ie&&this.zoom>=17&&(ze.length!==0&&Q(ze,ze[0])&&ze.pop(),this.groundEffect.addData(ze,ee,x,ie>0))}this.footprintSegments.push(Ie),Ae.triangleCount=this.indexArray.length-Ae.triangleArrayOffset,this.polygonSegments.push(Ae),++C.footprintSegLen,++C.polygonSegLen}if(C.vertexCount=this.layoutVertexArray.length-C.vertexArrayOffset,C.groundVertexCount=this.groundEffect.vertexArray.length-C.groundVertexArrayOffset,C.vertexCount!==0){if(C.centroidXY=M.borders?jm:this.encodeCentroid(M,C),i.properties&&Object.hasOwn(i.properties,"building_id")){const Y=C.buildingId;let ee=this.buildingGroups.get(Y);ee||(ee={accX:0,accY:0,accCount:0,mergedMin:new Ue(Number.MAX_VALUE,Number.MAX_VALUE),mergedMax:new Ue(-Number.MAX_VALUE,-Number.MAX_VALUE),partIndices:[]},this.buildingGroups.set(Y,ee)),ee.accX+=M.acc.x,ee.accY+=M.acc.y,ee.accCount+=M.accCount,ee.mergedMin.x=Math.min(ee.mergedMin.x,C.min.x),ee.mergedMin.y=Math.min(ee.mergedMin.y,C.min.y),ee.mergedMax.x=Math.max(ee.mergedMax.x,C.max.x),ee.mergedMax.y=Math.max(ee.mergedMax.y,C.max.y),ee.partIndices.push(this.centroidData.length)}if(this.centroidData.push(C),M.borders){this.featuresOnBorder.push(M);const Y=this.featuresOnBorder.length-1;for(let ee=0;ee<M.borders.length;ee++)M.borders[ee][0]!==Number.MAX_VALUE&&this.borderFeatureIndices[ee].push(Y)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,i,s,u,f,l,g,void 0,this.worldview),this.groundEffect.addPaintPropertiesData(i,s,u,f,l,g,this.worldview),this.maxHeight=Math.max(this.maxHeight,F)}}_finalizeBuildingGroups(){for(const[,e]of this.buildingGroups){if(e.partIndices.length===0)continue;const i=new Fg;i.acc=new Ue(e.accX,e.accY),i.accCount=e.accCount;const n=new qm;n.min=e.mergedMin,n.max=e.mergedMax;const s=this.encodeCentroid(i,n),l=i.centroid();for(const u of e.partIndices){const f=this.centroidData.get(u);f.centroidXY.x===jm.x&&f.centroidXY.y===jm.y||(f.centroidXY=s),f.min=e.mergedMin,f.max=e.mergedMax,f.groupCentroidPos=l}}this.buildingGroups.clear()}sortBorders(){for(let e=0;e<this.borderFeatureIndices.length;e++)this.borderFeatureIndices[e].sort((i,n)=>this.featuresOnBorder[i].borders[e][0]-this.featuresOnBorder[n].borders[e][0])}splitToSubtiles(){const e=[];for(let f=0;f<this.centroidData.length;f++){const p=this.centroidData.get(f),g=+(p.min.y+p.max.y>Xe),x=2*g+(+(p.min.x+p.max.x>Xe)^g);for(let b=0;b<p.polygonSegLen;b++){const w=p.polygonSegIdx+b;e.push({centroidIdx:f,subtile:x,polygonSegmentIdx:w,triangleSegmentIdx:this.polygonSegments[w].triangleSegIdx})}}const i=new Ai;e.sort((f,p)=>f.triangleSegmentIdx===p.triangleSegmentIdx?f.subtile-p.subtile:f.triangleSegmentIdx-p.triangleSegmentIdx);let n=0,s=0,l=0;for(const f of e){if(f.triangleSegmentIdx!==n)break;l++}const u=e.length;for(;s!==e.length;){n=e[s].triangleSegmentIdx;let f=0,p=s,g=s;for(let x=p;x<l&&e[x].subtile===f;x++)g++;for(;p!==l;){const x=e[p];f=x.subtile;const b=this.centroidData.get(x.centroidIdx).min.clone(),w=this.centroidData.get(x.centroidIdx).max.clone(),S={vertexOffset:this.segments.segments[n].vertexOffset,primitiveOffset:i.length,vertexLength:this.segments.segments[n].vertexLength,primitiveLength:0,sortKey:void 0,vaos:{}};for(let E=p;E<g;E++){const M=e[E],C=this.polygonSegments[M.polygonSegmentIdx],R=this.centroidData.get(M.centroidIdx).min,F=this.centroidData.get(M.centroidIdx).max,z=this.indexArray.uint16;for(let j=C.triangleArrayOffset;j<C.triangleArrayOffset+C.triangleCount;j++)i.emplaceBack(z[3*j],z[3*j+1],z[3*j+2]);S.primitiveLength+=C.triangleCount,b.x=Math.min(b.x,R.x),b.y=Math.min(b.y,R.y),w.x=Math.max(w.x,F.x),w.y=Math.max(w.y,F.y)}S.primitiveLength>0&&this.triangleSubSegments.push({segment:S,min:b,max:w}),p=g;for(let E=p;E<l&&e[E].subtile===e[p].subtile;E++)g++}s=l;for(let x=s;x<u&&e[x].triangleSegmentIdx===e[s].triangleSegmentIdx;x++)l++}i._trim(),this.indexArray=i}getVisibleSegments(e,i,n){const s=new di;if(this.wallMode){for(const M of this.triangleSubSegments)s.segments.push(M.segment);return s}let l=0,u=0;const f=1<<e.canonical.z;if(i){const M=i.getMinMaxForTile(e);M&&(l=M.min,u=M.max)}u+=this.maxHeight;const p=e.toUnwrapped();let g;const x=[p.canonical.x/f+p.wrap,p.canonical.y/f],b=[(p.canonical.x+1)/f+p.wrap,(p.canonical.y+1)/f],w=(M,C,R)=>[M[0]*(1-R[0])+C[0]*R[0],M[1]*(1-R[1])+C[1]*R[1]],S=[],E=[];for(const M of this.triangleSubSegments){S[0]=M.min.x/Xe,S[1]=M.min.y/Xe,E[0]=M.max.x/Xe,E[1]=M.max.y/Xe;const C=w(x,b,S),R=w(x,b,E);if(new wi([C[0],C[1],l],[R[0],R[1],u]).intersectsPrecise(n)===0){g&&(s.segments.push(g),g=void 0);continue}const F=M.segment;g&&g.vertexOffset!==F.vertexOffset&&(s.segments.push(g),g=void 0),g?(g.vertexLength+=F.vertexLength,g.primitiveLength+=F.primitiveLength):g={vertexOffset:F.vertexOffset,primitiveLength:F.primitiveLength,vertexLength:F.vertexLength,primitiveOffset:F.primitiveOffset,sortKey:void 0,vaos:{}}}return g&&s.segments.push(g),s}encodeCentroid(e,i){const n=e.centroid(),s=i.span(),l=Math.min(7,Math.round(s.x*this.tileToMeter/10)),u=Math.min(6,Math.round(s.y*this.tileToMeter/10));return new Ue(re(n.x,1,8191)<<3|l,re(n.y,1,8191)<<3|u)}encodeBorderCentroid(e){if(!e.borders)return new Ue(0,0);const i=e.borders,n=Number.MAX_VALUE;if(i[0][0]!==n||i[1][0]!==n){const s=i[0][0]!==n?0:1;return new Ue(6|(i[0][0]!==n?0:65528),(i[s][0]+i[s][1])/2<<3|6)}{const s=i[2][0]!==n?2:3;return new Ue((i[s][0]+i[s][1])/2<<3|6,6|(i[2][0]!==n?0:65528))}}showCentroid(e){const i=this.centroidData.get(e.centroidDataIndex);if(i.flags&=Oa,i.groupCentroidPos.x!==0||i.groupCentroidPos.y!==0){const n=i.span(),s=Math.min(7,Math.round(n.x*this.tileToMeter/10)),l=Math.min(6,Math.round(n.y*this.tileToMeter/10));i.centroidXY=new Ue(re(i.groupCentroidPos.x,1,8191)<<3|s,re(i.groupCentroidPos.y,1,8191)<<3|l)}else i.centroidXY=new Ue(0,0);this.writeCentroidToBuffer(i)}writeCentroidToBuffer(e){this.groundEffect.updateHiddenByLandmark(e);const i=e.vertexArrayOffset,n=e.vertexCount+e.vertexArrayOffset,s=-1073741824&e.flags?jm:e.centroidXY,l=this.centroidVertexArray.geta_centroid_pos0(i);if(this.centroidVertexArray.geta_centroid_pos1(i)!==s.y||l!==s.x){for(let u=i;u<n;++u)this.centroidVertexArray.emplace(u,s.x,s.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,i,n){if(i.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=i.updateTime;const s=i.getReplacementRegionsForTile(e.toUnwrapped());if(Um(this.activeReplacements,s))return;if(this.activeReplacements=s,this.centroidVertexArray.length===0)this.createCentroidsBuffer();else for(const u of this.centroidData)u.flags&=1073741823;const l=[];for(const u of this.activeReplacements){if(u.order<n)continue;const f=Math.max(1,Math.pow(2,u.footprintTileId.canonical.z-e.canonical.z));if(u.footprint.buildingIds)for(const p of this.centroidData)p.flags&Oa||p.flags&Gm||u.min.x>p.max.x||p.min.x>u.max.x||u.min.y>p.max.y||p.min.y>u.max.y||u.footprint.buildingIds.has(p.buildingId)&&(p.flags|=u.clipMask!==Vm.None?-1073741824:Oa);else for(const p of this.centroidData)if(!(p.flags&Oa||p.flags&Gm||u.min.x>p.max.x||p.min.x>u.max.x||u.min.y>p.max.y||p.min.y>u.max.y))for(let g=0;g<p.footprintSegLen;g++){const x=this.footprintSegments.get(p.footprintSegIdx+g);if(l.length=0,i1(this.footprintVertices,x.vertexOffset,x.vertexCount,u.footprintTileId.canonical,e.canonical,l),zg(u.footprint,l,this.footprintIndices.uint16,x.indexOffset,x.indexCount,-x.vertexOffset,-f)){p.flags|=u.clipMask!==Vm.None?-1073741824:Oa;break}}}for(const u of this.centroidData)this.writeCentroidToBuffer(u);this.borderDoneWithNeighborZ=[-1,-1,-1,-1]}footprintContainsPoint(e,i,n){let s=!1;for(let l=0;l<n.footprintSegLen;l++){const u=this.footprintSegments.get(n.footprintSegIdx+l);let f=0;for(const p of u.ringIndices){for(let g=f,x=p+f-1;g<p+f;x=g++){const b=this.footprintVertices.int16[2*(g+u.vertexOffset)+0],w=this.footprintVertices.int16[2*(g+u.vertexOffset)+1],S=this.footprintVertices.int16[2*(x+u.vertexOffset)+1];w>i!=S>i&&e<(this.footprintVertices.int16[2*(x+u.vertexOffset)+0]-b)*(i-w)/(S-w)+b&&(s=!s)}f=p}}return s}getHeightAtTileCoord(e,i){let n=Number.NEGATIVE_INFINITY,s=!0;const l=4*(e+Xe)*Xe+(i+Xe);if(Object.hasOwn(this.partLookup,l)){const p=this.partLookup[l];return p?{height:p.height,hidden:!!(p.flags&Oa)}:void 0}const u=this.centroidData.buffer,f=this.centroidData.length;for(let p=0;p<f;p++){const g=15*p;if(e>u[g+4]||u[g+2]>e||i>u[g+5]||u[g+3]>i)continue;const x=u[g+13];if(x<=n)continue;const b=this.centroidData.get(p);this.footprintContainsPoint(e,i,b)&&(n=x,this.partLookup[l]=b,s=!!(b.flags&Oa))}if(n!==Number.NEGATIVE_INFINITY)return{height:n,hidden:s};this.partLookup[l]=void 0}}function yx(r,e){const i=r.add(e)._unit();return r.x*i.x+r.y*i.y}function e1(r,e,i,n){const s=e.sub(r)._perp()._unit(),l=i.sub(e)._perp()._unit();return xx(r,e,i,yx(s,l),n)}function xx(r,e,i,n,s){const l=Math.sqrt(1-n*n);return Math.min(r.dist(e)/3,e.dist(i)/3,s*l/n)}function kg(r,e,i){return r.x<i[0].x&&e.x<i[0].x||r.x>i[1].x&&e.x>i[1].x||r.y<i[0].y&&e.y<i[0].y||r.y>i[1].y&&e.y>i[1].y}function vx(r,e){return r.x<e[0].x||r.x>e[1].x||r.y<e[0].y||r.y>e[1].y}function t1(r){return r.every(e=>e.x<=0)||r.every(e=>e.x>=Xe)||r.every(e=>e.y<=0)||r.every(e=>e.y>=Xe)}function bx(r,e,i){if(r.x<0||r.x>=Xe||e.x<0||e.x>=Xe||i.x<0||i.x>=Xe)return!1;const n=i.sub(e),s=n.perp(),l=r.sub(e);return(n.x*l.x+n.y*l.y)/Math.sqrt((n.x*n.x+n.y*n.y)*(l.x*l.x+l.y*l.y))>-.866&&s.x*l.x+s.y*l.y<0}function wx(r,e,i){const n=e?2|r:-3&r;return i?1|n:-2&n}function Tx(){const r=Math.PI/32,e=Math.tan(r),i=Pa;return i*Math.sqrt(1+2*e*e)-i}function Sx(r,e,i){const n=1<<i.z,s=mn(i.x/n),l=mn((i.x+1)/n),u=pr(i.y/n),f=pr((i.y+1)/n);return(function(p,g,x,b,w=0,S){const E=[];if(!p.length||!x||!b)return E;const M=(q,ie)=>{for(const W of q)E.push({polygon:W,bounds:ie})},C=Math.ceil(Math.log2(x)),R=Math.ceil(Math.log2(b)),F=C-R,z=[];for(let q=0;q<Math.abs(F);q++)z.push(F>0?0:1);for(let q=0;q<Math.min(C,R);q++)z.push(0),z.push(1);let j=p;if(j=Fm(j,g[0].y-w,g[1].y+w,1),j=Fm(j,g[0].x-w,g[1].x+w,0),!j.length)return E;const $=[];for(z.length?$.push({polygons:j,bounds:g,depth:0}):M(j,g);$.length;){const q=$.pop(),ie=q.depth,W=z[ie],Q=q.bounds[0],Y=q.bounds[1],ee=W===0?Q.x:Q.y,me=W===0?Y.x:Y.y,ge=S?S(W,ee,me):.5*(ee+me),Te=Fm(q.polygons,ee-w,ge+w,W),Ae=Fm(q.polygons,ge-w,me+w,W);if(Te.length){const Ie=[Q,new Ue(W===0?ge:Y.x,W===1?ge:Y.y)];z.length>ie+1?$.push({polygons:Te,bounds:Ie,depth:ie+1}):M(Te,Ie)}if(Ae.length){const Ie=[new Ue(W===0?ge:Q.x,W===1?ge:Q.y),Y];z.length>ie+1?$.push({polygons:Ae,bounds:Ie,depth:ie+1}):M(Ae,Ie)}}return E})(r,e,Math.ceil((l-s)/11.25),Math.ceil((u-f)/11.25),1,(p,g,x)=>{if(p===0)return .5*(g+x);{const b=pr((i.y+g/Xe)/n);return(Lo(.5*(pr((i.y+x/Xe)/n)+b))*n-i.y)*Xe}})}function i1(r,e,i,n,s,l){const u=Math.pow(2,n.z-s.z);for(let f=0;f<i;f++){let p=r.int16[2*(f+e)+0],g=r.int16[2*(f+e)+1];p=(p+s.x*Xe)*u-n.x*Xe,g=(g+s.y*Xe)*u-n.y*Xe,l.push(new Ue(p,g))}}let Ix,Ex,Ax,Mx;et(Wm,"FillExtrusionBucket",{omit:["layers","features"]}),et(qm,"PartData"),et(Zm,"PartDataArray"),et(Hm,"FootprintSegmentArray"),et(Fg,"BorderCentroidData"),et(Bg,"GroundEffect");class $c extends Ue{constructor(e,i,n){super(e,i),this.z=n}}class Cx extends $c{constructor(e,i,n,s){super(e,i,n),this.w=s}}function Px(r,e,i,n){const s=i==="x"?"y":"x",l=(n-r[i])/(e[i]-r[i]);r[s]=Math.round(r[s]+(e[s]-r[s])*l),r[i]=n,Object.hasOwn(r,"z")&&(r.z=ft(r.z,e.z,l)),Object.hasOwn(r,"w")&&(r.w=ft(r.w,e.w,l))}function Dx(r,e,i,n){const s=i,l=n;for(const u of["x","y"]){let f=r,p=e;f[u]>=p[u]&&(f=e,p=r),f[u]<s&&p[u]>s&&Px(f,p,u,s),f[u]<l&&p[u]>l&&Px(p,f,u,l)}}function Xm(r,e,i,n,s,l){const u=[];for(let f=0;f<r.length;f++){const p=r[f];let g;const x=u.length;let b=0;for(let w=0;w<p.length-1;w++){let S=p[w],E=p[w+1],M=0;const C=b;let R,F;l&&(M=Math.hypot(E.x-S.x,E.y-S.y),b+=M,R=S,F=E),S.x<e&&E.x<e||(S.x<e?S=new Ue(e,S.y+(e-S.x)/(E.x-S.x)*(E.y-S.y))._round():E.x<e&&(E=new Ue(e,S.y+(e-S.x)/(E.x-S.x)*(E.y-S.y))._round()),S.y<i&&E.y<i||(S.y<i?S=new Ue(S.x+(i-S.y)/(E.y-S.y)*(E.x-S.x),i)._round():E.y<i&&(E=new Ue(S.x+(i-S.y)/(E.y-S.y)*(E.x-S.x),i)._round()),S.x>=n&&E.x>=n||(S.x>=n?S=new Ue(n,S.y+(n-S.x)/(E.x-S.x)*(E.y-S.y))._round():E.x>=n&&(E=new Ue(n,S.y+(n-S.x)/(E.x-S.x)*(E.y-S.y))._round()),S.y>=s&&E.y>=s||(S.y>=s?S=new Ue(S.x+(s-S.y)/(E.y-S.y)*(E.x-S.x),s)._round():E.y>=s&&(E=new Ue(S.x+(s-S.y)/(E.y-S.y)*(E.x-S.x),s)._round()),g&&S.equals(g.at(-1))||(g=[S],u.push(g),l&&l.push({progress:{min:C+Rx(R,F,S)*M,max:1},parentIndex:f,prevPoint:R,nextPoint:F})),g.push(E),l&&(l.at(-1).progress.max=C+Rx(R,F,E)*M,l.at(-1).nextPoint=F)))))}if(l&&b>0)for(let w=x;w<u.length;w++)l[w].progress.min/=b,l[w].progress.max/=b}return u}function r1(r,e,i,n,s){if(r.length<2)return void n.push(r);const l=[];for(;e.valid();){const[g,x]=e.get();for(let b=0;b<r.length-1;b++){const w=r[b],S=r[b+1],E=P(w,S,g,x);if(E){const[M]=E,C=new Ue(ft(w.x,S.x,M),ft(w.y,S.y,M));l.push({t:b+M,distance:0,point:C})}}e.next()}if(l.length===0)return void n.push(r);l.sort((g,x)=>g.t-x.t);let u=0,f=0,p=[];for(n.push(p);u!==r.length;){if(f===l.length){for(;u!==r.length;)p.length!==0&&p.at(-1).equals(r[u])||p.push(r[u]),u++;break}l[f].t<=u?(p.length!==0&&p.at(-1).equals(l[f].point)||p.push(l[f].point),Math.trunc(l[f].t),f++):(p.length!==0&&p.at(-1).equals(r[u])||p.push(r[u]),u++)}}function Rx(r,e,i){return r.x!==e.x?(i.x-r.x)/(e.x-r.x):r.y!==e.y?(i.y-r.y)/(e.y-r.y):0}function vf(r,e){return r.x*e.x+r.y*e.y}function zx(r,e){if(r.length===1){let i=0;const n=e[i++];let s;for(;!s||n.equals(s);)if(s=e[i++],!s)return 1/0;for(;i<e.length;i++){const l=e[i],u=r[0],f=s.sub(n),p=l.sub(n),g=u.sub(n),x=vf(f,f),b=vf(f,p),w=vf(p,p),S=vf(g,f),E=vf(g,p),M=x*w-b*b,C=(w*S-b*E)/M,R=(x*E-b*S)/M,F=n.z*(1-C-R)+s.z*C+l.z*R;if(isFinite(F))return F}return 1/0}{let i=1/0;for(const n of e)i=Math.min(i,n.z);return i}}function Lx(r,e,i){let n=1/0;_(i,e)&&(n=zx(i,e[0]));for(let s=0;s<e.length;s++){const l=e[s],u=r[s];for(let f=0;f<l.length-1;f++){const p=l[f],g=[p,l[f+1],u[f+1],u[f],p];d(i,g)&&(n=Math.min(n,zx(i,g)))}}return n!==1/0&&n}function Ox(r,e,i,n,s,l,u,f,p,g,x){return r.projection.name==="globe"?(function(b,w,S,E,M,C,R,F,z,j,$){const q=[],ie=[],W=b.projection.upVectorScale($,b.center.lat,b.worldSize).metersToTile,Q=[0,0,0,1],Y=[0,0,0,1],ee=(ge,Te,Ae,Ie)=>{ge[0]=Te,ge[1]=Ae,ge[2]=Ie,ge[3]=1},me=Tx();S>0&&(S+=me),E+=me;for(const ge of w){const Te=[],Ae=[];for(const Ie of ge){const Fe=Ie.x+M.x,xe=Ie.y+M.y,Se=b.projection.projectTilePoint(Fe,xe,$),Me=b.projection.upVector($,Ie.x,Ie.y);let ze=S,Le=E;if(R){const We=Fx(Fe,xe,S,E,R,F,z,j);ze+=We.base,Le+=We.top}S!==0?ee(Q,Se.x+Me[0]*W*ze,Se.y+Me[1]*W*ze,Se.z+Me[2]*W*ze):ee(Q,Se.x,Se.y,Se.z),ee(Y,Se.x+Me[0]*W*Le,Se.y+Me[1]*W*Le,Se.z+Me[2]*W*Le),Pi(Q,Q,C),Pi(Y,Y,C),Te.push(new $c(Q[0],Q[1],Q[2])),Ae.push(new $c(Y[0],Y[1],Y[2]))}q.push(Te),ie.push(Ae)}return[q,ie]})(r,e,i,n,s,l,u,f,p,g,x):u?(function(b,w,S,E,M,C,R,F,z){const j=[],$=[],q=[0,0,0,1];for(const ie of b){const W=[],Q=[];for(const Y of ie){const ee=Y.x+E.x,me=Y.y+E.y,ge=Fx(ee,me,w,S,C,R,F,z);q[0]=ee,q[1]=me,q[2]=ge.base,q[3]=1,ln(q,q,M),q[3]=Math.max(q[3],1e-5);const Te=new $c(q[0]/q[3],q[1]/q[3],q[2]/q[3]);q[0]=ee,q[1]=me,q[2]=ge.top,q[3]=1,ln(q,q,M),q[3]=Math.max(q[3],1e-5);const Ae=new $c(q[0]/q[3],q[1]/q[3],q[2]/q[3]);W.push(Te),Q.push(Ae)}j.push(W),$.push(Q)}return[j,$]})(e,i,n,s,l,u,f,p,g):(function(b,w,S,E,M){const C=[],R=[],F=M[8]*w,z=M[9]*w,j=M[10]*w,$=M[11]*w,q=M[8]*S,ie=M[9]*S,W=M[10]*S,Q=M[11]*S;for(const Y of b){const ee=[],me=[];for(const ge of Y){const Te=ge.x+E.x,Ae=ge.y+E.y,Ie=M[0]*Te+M[4]*Ae+M[12],Fe=M[1]*Te+M[5]*Ae+M[13],xe=M[2]*Te+M[6]*Ae+M[14],Se=M[3]*Te+M[7]*Ae+M[15],Me=Ie+F,ze=Fe+z,Le=xe+j,We=Math.max(Se+$,1e-5),De=Ie+q,Ge=Fe+ie,$e=xe+W,Je=Math.max(Se+Q,1e-5);ee.push(new $c(Me/We,ze/We,Le/We)),me.push(new $c(De/Je,Ge/Je,$e/Je))}C.push(ee),R.push(me)}return[C,R]})(e,i,n,s,l)}function Fx(r,e,i,n,s,l,u,f){const p=u*s.getElevationAt(r,e,!0,!0),g=l[0]!==0,x=g?l[1]===0?u*(l[0]/7-450):u*(function(b,w,S){const E=Math.floor(w[0]/8),M=Math.floor(w[1]/8),C=10*(w[0]-8*E),R=10*(w[1]-8*M),F=b.getElevationAt(E,M,!0,!0),z=b.getMeterToDEM(S),j=Math.floor(.5*(C*z-1)),$=Math.floor(.5*(R*z-1)),q=b.tileCoordToPixel(E,M),ie=2*j+1,W=2*$+1,Q=(function(Ae,Ie,Fe,xe,Se){return[Ae.getElevationAtPixel(Ie,Fe,!0),Ae.getElevationAtPixel(Ie+Se,Fe,!0),Ae.getElevationAtPixel(Ie,Fe+Se,!0),Ae.getElevationAtPixel(Ie+xe,Fe+Se,!0)]})(b,q.x-j,q.y-$,ie,W),Y=Math.abs(Q[0]-Q[1]),ee=Math.abs(Q[2]-Q[3]),me=Math.abs(Q[0]-Q[2])+Math.abs(Q[1]-Q[3]),ge=Math.min(.25,.5*z*(Y+ee)/ie),Te=Math.min(.25,.5*z*me/W);return F+Math.max(ge*C,Te*R)})(s,l,f):p;return{base:p+(i===0?-1:i),top:g?Math.max(x+n,p+i+2):p+n}}let cs=null,Ym=null,Ng=null,Jm=null;const Bx=5120,kx=5121,Nx=5122,Ux=5123,Vx=5125,jx=5126,Km={[Bx]:Int8Array,[kx]:Uint8Array,[Nx]:Int16Array,[Ux]:Uint16Array,[Vx]:Uint32Array,[jx]:Float32Array},n1={[Bx]:"DT_INT8",[kx]:"DT_UINT8",[Nx]:"DT_INT16",[Ux]:"DT_UINT16",[Vx]:"DT_UINT32",[jx]:"DT_FLOAT32"},bf={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16};function Gx(r,e,i){const n=i.json.bufferViews.length,s=i.buffers.length;e.bufferView=n,i.json.bufferViews[n]={buffer:s,byteLength:r.byteLength},i.buffers[s]=r}const Ug="KHR_draco_mesh_compression";function o1(r,e){const i=r.extensions&&r.extensions[Ug];if(!i)return;const n=new cs.Decoder,s=Zx(e,i.bufferView),l=new cs.Mesh;if(!n.DecodeArrayToMesh(s,s.byteLength,l))throw new Error("Failed to decode Draco mesh");const u=e.json.accessors[r.indices],f=Km[u.componentType],p=u.count*f.BYTES_PER_ELEMENT,g=cs._malloc(p);f===Uint16Array?n.GetTrianglesUInt16Array(l,p,g):n.GetTrianglesUInt32Array(l,p,g),Gx(cs.memory.buffer.slice(g,g+p),u,e),cs._free(g);for(const x of Object.keys(i.attributes)){const b=n.GetAttributeByUniqueId(l,i.attributes[x]),w=e.json.accessors[r.attributes[x]],S=n1[w.componentType],E=w.count*bf[w.type]*Km[w.componentType].BYTES_PER_ELEMENT,M=cs._malloc(E);n.GetAttributeDataArrayForAllPoints(l,b,cs[S],E,M),Gx(cs.memory.buffer.slice(M,M+E),w,e),cs._free(M)}n.destroy(),l.destroy(),delete r.extensions[Ug]}const Qm="EXT_meshopt_compression";function s1(r,e){if(!r.extensions||!r.extensions[Qm])return;const i=r.extensions[Qm],n=new Uint8Array(e.buffers[i.buffer],i.byteOffset||0,i.byteLength||0),s=new Uint8Array(i.count*i.byteStride);Ng.decodeGltfBuffer(s,i.count,i.byteStride,n,i.mode,i.filter),r.buffer=e.buffers.length,r.byteOffset=0,e.buffers[r.buffer]=s.buffer,delete r.extensions[Qm]}const $x=1179937895,Hx=new TextDecoder("utf8");function qx(r,e){return new URL(r,e).href}async function a1(r,e,i,n,s){const l=await fetch(qx(r.uri,n),{signal:s}),u=await l.arrayBuffer();e.buffers[i]=u}function Zx(r,e){const i=r.json.bufferViews[e];return new Uint8Array(r.buffers[i.buffer],i.byteOffset||0,i.byteLength)}async function l1(r,e,i,n,s){if(r.uri){const l=qx(r.uri,n),u=await fetch(l,{signal:s}),f=await u.blob(),p=await createImageBitmap(f);e.images[i]=p}else if(r.bufferView!==void 0){const l=Zx(e,r.bufferView),u=new Blob([l],{type:r.mimeType}),f=await createImageBitmap(u);e.images[i]=f}}async function Wx(r,e=0,i,n){const s={json:null,images:[],buffers:[]};if(new Uint32Array(r,e,1)[0]===$x){const S=new Uint32Array(r,e);let E=2;const M=(S[E++]>>2)-3,C=S[E++]>>2;if(E++,s.json=JSON.parse(Hx.decode(S.subarray(E,E+C))),E+=C,E<M){const R=S[E++];E++;const F=e+(E<<2);s.buffers[0]=r.slice(F,F+R)}}else s.json=JSON.parse(Hx.decode(new Uint8Array(r,e)));const{buffers:l,images:u,meshes:f,extensionsUsed:p,bufferViews:g}=s.json;if(l){const S=[];for(let E=0;E<l.length;E++){const M=l[E];M.uri?S.push(a1(M,s,E,i,n)):s.buffers[E]||(s.buffers[E]=null)}await Promise.all(S)}if(n&&n.aborted)throw new DOMException("Aborted","AbortError");const x=[],b=p&&p.includes(Ug),w=p&&p.includes(Qm);if(b&&x.push((function(){if(!cs)return Ym!=null||(Ym=(function(S){let E,M=null;function C(){E=new Uint8Array(M.buffer)}function R(){throw new Error("Unexpected Draco error.")}return WebAssembly.instantiateStreaming(S,{a:{a:R,d:function(F,z,j){return E.copyWithin(F,z,z+j)},c:function(F){const z=E.length,j=Math.max(F>>>0,Math.ceil(1.2*z)),$=Math.ceil((j-z)/65536);try{return M.grow($),C(),!0}catch{return!1}},b:R}}).then(F=>{const{Rb:z,Qb:j,P:$,T:q,X:ie,Ja:W,La:Q,Qa:Y,Va:ee,Wa:me,eb:ge,jb:Te,f:Ae,e:Ie,yb:Fe,zb:xe,Ab:Se,Bb:Me,Db:ze,Gb:Le}=F.instance.exports;M=Ie;const We=(()=>{let De=0,Ge=0,$e=0,Je=0;return Qe=>{$e&&(z(Je),z(De),Ge+=$e,$e=De=0),De||(Ge+=128,De=j(Ge));const ct=Qe.length+7&-8;let nt=De;ct>=Ge&&($e=ct,nt=Je=j(ct));for(let mt=0;mt<Qe.length;mt++)E[nt+mt]=Qe[mt];return nt}})();return C(),Ae(),{memory:Ie,_free:z,_malloc:j,Mesh:class{constructor(){this.ptr=$()}destroy(){q(this.ptr)}},Decoder:class{constructor(){this.ptr=W()}destroy(){Te(this.ptr)}DecodeArrayToMesh(De,Ge,$e){const Je=We(De),Qe=Q(this.ptr,Je,Ge,$e.ptr);return!!ie(Qe)}GetAttributeByUniqueId(De,Ge){return{ptr:Y(this.ptr,De.ptr,Ge)}}GetTrianglesUInt16Array(De,Ge,$e){ee(this.ptr,De.ptr,Ge,$e)}GetTrianglesUInt32Array(De,Ge,$e){me(this.ptr,De.ptr,Ge,$e)}GetAttributeDataArrayForAllPoints(De,Ge,$e,Je,Qe){ge(this.ptr,De.ptr,Ge.ptr,$e,Je,Qe)}},DT_INT8:Fe(),DT_UINT8:xe(),DT_INT16:Se(),DT_UINT16:Me(),DT_UINT32:ze(),DT_FLOAT32:Le()}})})(fetch(bs())).then(S=>{cs=S,Ym=null})),Ym})()),w&&x.push((function(){var S;if(!Ng)return Jm!=null||(Jm=(S=fetch(sa()),WebAssembly.instantiateStreaming(S,{}).then(E=>{const{sbrk:M,memory:C,meshopt_decodeVertexBuffer:R,meshopt_decodeIndexBuffer:F,meshopt_decodeIndexSequence:z,meshopt_decodeFilterOct:j,meshopt_decodeFilterQuat:$,meshopt_decodeFilterExp:q}=E.instance.exports,ie={ATTRIBUTES:R,TRIANGLES:F,INDICES:z},W={OCTAHEDRAL:j,QUATERNION:$,EXPONENTIAL:q};return E.instance.exports.__wasm_call_ctors(),{decodeGltfBuffer(Q,Y,ee,me,ge,Te){const Ae=Y+3&-4,Ie=M(Ae*ee),Fe=M(me.length),xe=new Uint8Array(C.buffer);xe.set(me,Fe);const Se=ie[ge](Ie,Y,ee,Fe,me.length);if(Se===0&&W[Te]&&W[Te](Ie,Ae,ee),Q.set(xe.subarray(Ie,Ie+Y*ee)),M(Ie-M(0)),Se!==0)throw new Error(`Malformed buffer data: ${Se}`)}}})).then(E=>{Ng=E,Jm=null})),Jm})()),u)for(let S=0;S<u.length;S++)x.push(l1(u[S],s,S,i,n));if(x.length&&await Promise.all(x),n&&n.aborted)throw new DOMException("Aborted","AbortError");if(b&&f)for(const{primitives:S}of f)for(const E of S)o1(E,s);if(w&&f&&g)for(const S of g)s1(S,s);return s}async function Xx(r,e){const i=await(async function(n,s){if(s&&s.aborted)throw new DOMException("Aborted","AbortError");return new Promise((l,u)=>{const f=oc(n,(p,g)=>{p?u(p):l(g)});s&&s.addEventListener("abort",()=>{f.cancel(),u(new DOMException("Aborted","AbortError"))},{once:!0})})})({url:r,type:"arrayBuffer"},e);return Wx(i,0,r,e)}function Vg(r){switch(r){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 jg(r){switch(r){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}}class Gs{constructor(e,i,n,s){this.context=e,this.format=n,this.useMipmap=s&&s.useMipmap,this.texture=e.gl.createTexture(),this.update(i,{premultiply:s&&s.premultiply})}update(e,i){const n=e&&e instanceof HTMLVideoElement&&e.width===0?e.videoWidth:e.width,s=e&&e instanceof HTMLVideoElement&&e.height===0?e.videoHeight:e.height,{context:l}=this,{gl:u}=l,{x:f,y:p}=i&&i.position?i.position:{x:0,y:0},g=f+n,x=p+s;this.size&&(this.size[0]!==g||this.size[1]!==x)&&(!i||i.recreateWhenResize===void 0||i.recreateWhenResize)&&(u.bindTexture(u.TEXTURE_2D,null),u.deleteTexture(this.texture),this.texture=u.createTexture(),this.size=null),u.bindTexture(u.TEXTURE_2D,this.texture),l.pixelStoreUnpackFlipY.set(!1),l.pixelStoreUnpack.set(1),l.pixelStoreUnpackPremultiplyAlpha.set(this.format===u.RGBA8&&(!i||i.premultiply!==!1));const b=e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||ImageBitmap&&e instanceof ImageBitmap;if(!this.size&&g>0&&x>0){const w=this.useMipmap?Math.floor(Math.log2(Math.max(g,x)))+1:1;u.texStorage2D(u.TEXTURE_2D,w,this.format,g,x),this.size=[g,x]}this.size&&(b?u.texSubImage2D(u.TEXTURE_2D,0,f,p,Vg(this.format),jg(this.format),e):"data"in e&&e.data&&u.texSubImage2D(u.TEXTURE_2D,0,f,p,n,s,Vg(this.format),jg(this.format),e.data)),this.useMipmap&&u.generateMipmap(u.TEXTURE_2D)}bind(e,i,n=!1){const{context:s}=this,{gl:l}=s;l.bindTexture(l.TEXTURE_2D,this.texture),e!==this.minFilter&&(l.texParameteri(l.TEXTURE_2D,l.TEXTURE_MAG_FILTER,e),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_MIN_FILTER,this.useMipmap&&!n?e===l.NEAREST?l.NEAREST_MIPMAP_NEAREST:l.LINEAR_MIPMAP_LINEAR:e),this.minFilter=e),i!==this.wrapS&&(l.texParameteri(l.TEXTURE_2D,l.TEXTURE_WRAP_S,i),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_WRAP_T,i),this.wrapS=i)}bindExtraParam(e,i,n,s,l){const{context:u}=this,{gl:f}=u;f.bindTexture(f.TEXTURE_2D,this.texture),i!==this.magFilter&&(f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MAG_FILTER,i),this.magFilter=i),e!==this.minFilter&&(f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MIN_FILTER,this.useMipmap?e===f.NEAREST?f.NEAREST_MIPMAP_NEAREST:f.LINEAR_MIPMAP_LINEAR:e),this.minFilter=e),n!==this.wrapS&&(f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_S,n),this.wrapS=n),s!==this.wrapT&&(f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_T,s),this.wrapT=s),l!==this.compareMode&&(l?(f.texParameteri(f.TEXTURE_2D,f.TEXTURE_COMPARE_MODE,f.COMPARE_REF_TO_TEXTURE),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_COMPARE_FUNC,l)):f.texParameteri(f.TEXTURE_2D,f.TEXTURE_COMPARE_MODE,f.NONE),this.compareMode=l)}destroy(){const{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}}class wf{constructor(e,i){this.context=e,this.texture=i}bind(e,i){const{context:n}=this,{gl:s}=n;s.bindTexture(s.TEXTURE_2D,this.texture),e!==this.minFilter&&(s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,e),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,e),this.minFilter=e),i!==this.wrapS&&(s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,i),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,i),this.wrapS=i)}}const c1=Rt([{name:"a_pos_3f",components:3,type:"Float32"}]),u1=Rt([{name:"a_color_3f",components:3,type:"Float32"}]),h1=Rt([{name:"a_color_4f",components:4,type:"Float32"}]),d1=Rt([{name:"a_uv_2f",components:2,type:"Float32"}]),f1=Rt([{name:"a_normal_3f",components:3,type:"Float32"}]),p1=Rt([{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"}]),m1=Rt([{name:"a_pbr",components:4,type:"Uint16"},{name:"a_heightBasedEmissiveStrength",components:3,type:"Float32"}]);function Yx(r,e){const i=e_(r.projection,r.zoom,r.width,r.height),n=(function(l,u,f,p,g){const x=new Zt(f.lng-180*zl,f.lat),b=new Zt(f.lng+180*zl,f.lat),w=l.project(x.lng,x.lat),S=l.project(b.lng,b.lat),E=-Math.atan2(S.y-w.y,S.x-w.x),M=Or.fromLngLat(f);M.y=re(M.y,-1+zl,1-zl);const C=M.toLngLat(),R=l.project(C.lng,C.lat),F=Or.fromLngLat(C);F.x+=zl;const z=F.toLngLat(),j=l.project(z.lng,z.lat),$=Kx(j.x-R.x,j.y-R.y,E),q=Or.fromLngLat(C);q.y+=zl;const ie=q.toLngLat(),W=l.project(ie.lng,ie.lat),Q=Kx(W.x-R.x,W.y-R.y,E),Y=Math.abs($.x)/Math.abs(Q.y),ee=Ot([]);Yn(ee,ee,-E*(1-(g?0:p)));const me=Ot([]);return Br(me,me,[1,1-(1-Y)*p,1]),me[4]=-Q.x/Q.y*p,Yn(me,me,E),gi(me,ee,me),me})(r.projection,0,r.center,i,e),s=Jx(r);return Br(n,n,[s,s,1]),n}function Jx(r){const e=r.projection,i=e_(r.projection,r.zoom,r.width,r.height),n=Gg(e,r.center),s=Gg(e,Zt.convert(e.center));return Math.pow(2,n*i+(1-i)*s)}function e_(r,e,i,n,s=1/0){const l=r.range;if(!l)return 0;const u=Math.min(s,Math.max(i,n)),f=Math.log2(u/1024);return ye(l[0]+f,l[1]+f,e)}const zl=1/4e4;function Gg(r,e){const i=re(e.lat,-85.051129,_n),n=new Zt(e.lng-180*zl,i),s=new Zt(e.lng+180*zl,i),l=r.project(n.lng,i),u=r.project(s.lng,i),f=Or.fromLngLat(n),p=Or.fromLngLat(s),g=u.x-l.x,x=u.y-l.y,b=p.x-f.x,w=p.y-f.y,S=Math.sqrt((b*b+w*w)/(g*g+x*x));return Math.log2(S)}function Kx(r,e,i){const n=Math.cos(i),s=Math.sin(i);return{x:r*n-e*s,y:r*s+e*n}}const _1=new Float64Array([1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,1]);function Qx(r,e,i){Ot(r),Yn(r,r,V(e[2])),jo(r,r,V(e[0])),Go(r,r,V(e[1])),Br(r,r,i),gi(r,r,_1)}function t_(r,e,i,n,s,l,u,f){const p=[i[0]-e[0],i[1]-e[1],0],g=[n[0]-e[0],n[1]-e[1],0];if(xr(p)<1e-12||xr(g)<1e-12)return xs(r);const x=kr([],p,g);ui(x,x),Jn(g,n,e),p[2]=(l-s)*f,g[2]=(u-s)*f;const b=p;return kr(b,p,g),ui(b,b),Ql(r,x,b)}function i_(r,e,i=!1){const n=oi(e.zoom),s=(function(l,u,f){const p=u.worldSize,g=[l[12],l[13],l[14]],x=pr(g[1]/p),b=mn(g[0]/p),w=Ot([]),S=Yr(1,x)*p,E=Yr(1,0)*p*Da(x,u.zoom),M=1/bt(p);let C=E*M;if(f){const j=e_(u.projection,u.zoom,u.width,u.height,1024);C=M*u.projection.pixelSpaceConversion(u.center.lat,p,j)}const R=zo(x,b);er(R,R,Ci([],ui([],R),S*C*g[2]));const F=(function(j){const $=[j[0],j[1],j[2]];let q=[0,1,0];const ie=kr([],q,$);return kr(q,$,ie),Jl(q)===0&&(q=[0,1,0],kr(ie,$,q)),ui(ie,ie),ui(q,q),ui($,$),[ie[0],ie[1],ie[2],0,q[0],q[1],q[2],0,$[0],$[1],$[2],0,j[0],j[1],j[2],1]})(R);Br(w,w,[C,C,C*S]),Cr(w,w,[-g[0],-g[1],-g[2]]);const z=gi([],u.globeMatrix,F);return gi(z,z,w),gi(z,z,l),z})(r,e,i);if(n>0){const l=(function(u,f){const p=f.worldSize,g=Yr(1,0)*p*Da(f.center.lat,f.zoom)/bt(p),x=Yr(1,f.center.lat)*p,b=Ot([]);Go(b,b,V(f.center.lng)),jo(b,b,V(f.center.lat)),Cr(b,b,[0,0,Lr]),Br(b,b,[g,g,g*x]);const w=f.point;return Cr(b,b,[-w.x,-w.y,0]),gi(b,b,u),gi(b,f.globeMatrix,b)})(r,e);return(function(u,f,p){const g=(E,M,C)=>{const R=xr(E),F=xr(M),z=Be(E,M,C);return Ci(z,z,1/xr(z)*ft(R,F,C))},x=g([u[0],u[1],u[2]],[f[0],f[1],f[2]],p),b=g([u[4],u[5],u[6]],[f[4],f[5],f[6]],p),w=g([u[8],u[9],u[10]],[f[8],f[9],f[10]],p),S=Be([u[12],u[13],u[14]],[f[12],f[13],f[14]],p);return[x[0],x[1],x[2],0,b[0],b[1],b[2],0,w[0],w[1],w[2],0,S[0],S[1],S[2],1]})(s,l,n)}return s}function $g(r,e,i,n){const s=wi.projectAabbCorners(n,i);let l=Number.MAX_VALUE;for(let f=0;f<s.length;++f){const p=s[f];p[0]=(.5*p[0]+.5)*e.width,p[1]=(.5-.5*p[1])*e.height,p[2]<l&&(l=p[2])}const u=(function(f){const p=[];let g=0;for(let S=1;S<f.length;S++)(f[S][0]<f[g][0]||f[S][0]===f[g][0]&&f[S][1]<f[g][1])&&(g=S);let x,b=g;const w=new Uint8Array(f.length);do{if(w[b])break;p.push(new Ue(f[b][0],f[b][1])),w[b]=1,x=(b+1)%f.length;for(let S=0;S<f.length;S++){if(f[S][0]===f[x][0]&&f[S][1]===f[x][1]||f[S][0]===f[b][0]&&f[S][1]===f[b][1])continue;const E=[f[S][0]-f[b][0],f[S][1]-f[b][1]],M=[f[x][0]-f[b][0],f[x][1]-f[b][1]],C=E[0]*M[1]-E[1]*M[0];(C>0||C===0&&E[0]*M[0]+E[1]*M[1]>=0&&E[0]*E[0]+E[1]*E[1]>M[0]*M[0]+M[1]*M[1])&&(x=S)}b=x}while(b!==g);return p.length>0&&p.push(p[0]),p})(s);if(d(r,u))return l}const Hc=64,fh={CoordinateSpaceTile:1,HasMapboxMeshFeatures:4,HasMeshoptCompression:8};function r_(r,e,i,n,s,l,u,f,p,g=!1){const x=i.zoom,b=i.project(n),w=Da(n.lat,x),S=1/w;Ot(r),Cr(r,r,[b.x+u[0]*S,b.y+u[1]*S,u[2]]);let E=1,M=1;const C=i.worldSize;if(g){if(i.projection.name==="mercator"){let j=0;i.elevation&&(j=i.elevation.getAtPointOrZero(new Or(b.x/C,b.y/C),0));const $=ln([],[b.x,b.y,j,1],i.projMatrix)[3]/i.cameraToCenterDistance;E=$,M=$*Da(i.center.lat,x)}else if(i.projection.name==="globe"){const j=i_(r,i),$=[0,0,0,1];ln($,$,gi([],i.projMatrix,j));const q=$[3]/i.cameraToCenterDistance,ie=oi(x),W=i.projection.pixelsPerMeter(n.lat,C)*Da(n.lat,x),Q=i.projection.pixelsPerMeter(i.center.lat,C)*Da(i.center.lat,x);E=q/ft(W,xm(i.center.lat),ie),M=q*w/W,E*=Q,M*=Q}}else E=S;Br(r,r,[E,E,M]);const R=[...r],F=e.orientation,z=[];if(Qx(z,[F[0]+(s?s[0]:0),F[1]+(s?s[1]:0),F[2]+(s?s[2]:0)],l),gi(r,R,z),f&&i.elevation){let j=0;const $=[];if(p&&i.elevation){j=(function(ie,W,Q,Y,ee){const me=W.elevation;if(!me)return 0;const ge=wi.projectAabbCorners(Q,Y),Te=Yr(1,ee.lat)*W.worldSize,Ae=(function($e,Je){const Qe=[0,0,1],ct=[{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 nt of ct){const mt=$e[nt.corners[0]],Gt=$e[nt.corners[1]],wt=$e[nt.corners[2]],kt=[Gt[0]-mt[0],Gt[1]-mt[1],Je*(Gt[2]-mt[2])],Mt=kr(kt,kt,[wt[0]-mt[0],wt[1]-mt[1],Je*(wt[2]-mt[2])]);ui(Mt,Mt),nt.dotProductWithUp=Xi(Mt,Qe)}return ct.sort((nt,mt)=>nt.dotProductWithUp-mt.dotProductWithUp),ct[0].corners})(ge,Te),Ie=ge[Ae[0]],Fe=ge[Ae[1]],xe=ge[Ae[2]],Se=ge[Ae[3]],Me=me.getAtPointOrZero(new Or(Ie[0]/W.worldSize,Ie[1]/W.worldSize),0),ze=me.getAtPointOrZero(new Or(Fe[0]/W.worldSize,Fe[1]/W.worldSize),0),Le=me.getAtPointOrZero(new Or(xe[0]/W.worldSize,xe[1]/W.worldSize),0),We=me.getAtPointOrZero(new Or(Se[0]/W.worldSize,Se[1]/W.worldSize),0),De=(Me+We)/2,Ge=(ze+Le)/2;return De>Ge?ze<Le?t_(ie,Fe,Se,Ie,ze,We,Me,Te):t_(ie,xe,Ie,Se,Le,Me,We,Te):Me<We?t_(ie,Ie,Fe,xe,Me,ze,Le,Te):t_(ie,Se,xe,Fe,We,Le,ze,Te),Math.max(De,Ge)})($,i,e.aabb,r,n);const q=gi([],Zl([],$),z);gi(r,R,q)}else j=i.elevation.getAtPointOrZero(new Or(b.x/C,b.y/C),0);j!==0&&(r[14]+=j)}}class ev{constructor(e,i,n,s,l){this.materialOverrides=new Map,this.nodeOverrides=new Map,this.materialOverrideNames=[],this.nodeOverrideNames=[],this.featureProperties={},this.id=e,this.uri=i,this.position=n!=null?new Zt(n[0],n[1]):new Zt(0,0),this.orientation=s??[0,0,0],this.nodes=l,this.uploaded=!1,this.aabb=new wi([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),this.matrix=[]}_applyTransformations(e,i){gi(e.globalMatrix,i,e.localMatrix);const n=this.nodeOverrides.get(e.name);if(n!==void 0){const u=[];l=n.orientation,Ot(s=u),Go(s,s,V(l[1])),Yn(s,s,V(l[2])),jo(s,s,V(l[0])),gi(e.globalMatrix,e.globalMatrix,u)}var s,l;if(e.meshes)for(const u of e.meshes){const f=wi.applyTransformFast(u.aabb,e.globalMatrix);this.aabb.encapsulate(f)}if(e.children)for(const u of e.children)this._applyTransformations(u,e.globalMatrix)}computeBoundsAndApplyParent(){const e=Ot([]);this.aabb=new wi([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);for(const i of this.nodes)this._applyTransformations(i,e)}computeModelMatrix(e,i,n,s,l,u,f=!1){r_(this.matrix,this,e.transform,this.position,i,n,s,l,u,f)}upload(e){if(!this.uploaded){for(const i of this.nodes)Hg(i,e);for(const i of this.nodes)n_(i);this.uploaded=!0}}destroy(){for(const e of this.nodes)qg(e)}}function Tf(r,e,i=!1){r.uploaded||(r.gfxTexture=new Gs(e,r.image,i?e.gl.R8:e.gl.RGBA8,{useMipmap:r.sampler.minFilter>=e.gl.NEAREST_MIPMAP_NEAREST}),r.uploaded=!0,r.image=null)}function tv(r,e,i){r.indexBuffer=e.createIndexBuffer(r.indexArray,!1,!0),r.vertexBuffer=e.createVertexBuffer(r.vertexArray,c1.members,!1,!0),r.normalArray&&(r.normalBuffer=e.createVertexBuffer(r.normalArray,f1.members,!1,!0)),r.texcoordArray&&(r.texcoordBuffer=e.createVertexBuffer(r.texcoordArray,d1.members,!1,!0)),r.colorArray&&(r.colorBuffer=e.createVertexBuffer(r.colorArray,(r.colorArray.bytesPerElement===12?u1:h1).members,!1,!0)),r.featureArray&&(r.pbrBuffer=e.createVertexBuffer(r.featureArray,m1.members,!0)),r.segments=di.simpleSegment(0,0,r.vertexArray.length,r.indexArray.length);const n=r.material;n.pbrMetallicRoughness.baseColorTexture&&Tf(n.pbrMetallicRoughness.baseColorTexture,e),n.pbrMetallicRoughness.metallicRoughnessTexture&&Tf(n.pbrMetallicRoughness.metallicRoughnessTexture,e),n.normalTexture&&Tf(n.normalTexture,e),n.occlusionTexture&&Tf(n.occlusionTexture,e,i),n.emissionTexture&&Tf(n.emissionTexture,e)}function Hg(r,e,i){if(r.meshes)for(const n of r.meshes)tv(n,e,i);if(r.lodMeshes)for(const n of r.lodMeshes)tv(n,e,i);if(r.children)for(const n of r.children)Hg(n,e,i)}function iv(r){r.indexArray.destroy(),r.vertexArray.destroy(),r.colorArray&&r.colorArray.destroy(),r.normalArray&&r.normalArray.destroy(),r.texcoordArray&&r.texcoordArray.destroy(),r.featureArray&&r.featureArray.destroy()}function n_(r){if(r.meshes)for(const e of r.meshes)iv(e);if(r.lodMeshes)for(const e of r.lodMeshes)iv(e);if(r.children)for(const e of r.children)n_(e)}function rv(r){var e;r.vertexBuffer&&(r.vertexBuffer.destroy(),r.indexBuffer.destroy(),r.normalBuffer&&r.normalBuffer.destroy(),r.texcoordBuffer&&r.texcoordBuffer.destroy(),r.colorBuffer&&r.colorBuffer.destroy(),r.pbrBuffer&&r.pbrBuffer.destroy(),r.segments.destroy(),r.material&&((e=r.material).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 qg(r){if(r.meshes)for(const e of r.meshes)rv(e);if(r.lodMeshes)for(const e of r.lodMeshes)rv(e);if(r.footprintDebugMesh&&(r.footprintDebugMesh.vertexBuffer.destroy(),r.footprintDebugMesh.indexBuffer.destroy(),r.footprintDebugMesh.segments.destroy()),r.children)for(const e of r.children)qg(e)}function Zg(r,e,i,n){return r[0]<=n[0]&&e[0]>=i[0]&&r[1]<=n[1]&&e[1]>=i[1]&&r[2]<=n[2]&&e[2]>=i[2]}function g1(r,e,i,n,s,l,u,f,p,g,x){const b=.5*(g[0]+x[0]),w=.5*(g[1]+x[1]),S=.5*(g[2]+x[2]),E=.5*(x[0]-g[0]),M=.5*(x[1]-g[1]),C=.5*(x[2]-g[2]),R=r-b,F=e-w,z=i-S,j=n-b,$=s-w,q=l-S,ie=u-b,W=f-w,Q=p-S,Y=j-R,ee=$-F,me=q-z,ge=ie-j,Te=W-$,Ae=Q-q,Ie=R-ie,Fe=F-W,xe=z-Q;let Se,Me,ze,Le,We,De;if(Se=z*ee-F*me,Me=q*ee-$*me,ze=Q*ee-W*me,Le=Math.min(Se,Me,ze),We=Math.max(Se,Me,ze),De=Math.abs(me)*M+Math.abs(ee)*C,Le>De||We<-De||(Se=z*Te-F*Ae,Me=q*Te-$*Ae,ze=Q*Te-W*Ae,Le=Math.min(Se,Me,ze),We=Math.max(Se,Me,ze),De=Math.abs(Ae)*M+Math.abs(Te)*C,Le>De||We<-De)||(Se=z*Fe-F*xe,Me=q*Fe-$*xe,ze=Q*Fe-W*xe,Le=Math.min(Se,Me,ze),We=Math.max(Se,Me,ze),De=Math.abs(xe)*M+Math.abs(Fe)*C,Le>De||We<-De)||(Se=R*me-z*Y,Me=j*me-q*Y,ze=ie*me-Q*Y,Le=Math.min(Se,Me,ze),We=Math.max(Se,Me,ze),De=Math.abs(me)*E+Math.abs(Y)*C,Le>De||We<-De)||(Se=R*Ae-z*ge,Me=j*Ae-q*ge,ze=ie*Ae-Q*ge,Le=Math.min(Se,Me,ze),We=Math.max(Se,Me,ze),De=Math.abs(Ae)*E+Math.abs(ge)*C,Le>De||We<-De)||(Se=R*xe-z*Ie,Me=j*xe-q*Ie,ze=ie*xe-Q*Ie,Le=Math.min(Se,Me,ze),We=Math.max(Se,Me,ze),De=Math.abs(xe)*E+Math.abs(Ie)*C,Le>De||We<-De)||(Se=F*Y-R*ee,Me=$*Y-j*ee,ze=W*Y-ie*ee,Le=Math.min(Se,Me,ze),We=Math.max(Se,Me,ze),De=Math.abs(ee)*E+Math.abs(Y)*M,Le>De||We<-De)||(Se=F*ge-R*Te,Me=$*ge-j*Te,ze=W*ge-ie*Te,Le=Math.min(Se,Me,ze),We=Math.max(Se,Me,ze),De=Math.abs(Te)*E+Math.abs(ge)*M,Le>De||We<-De)||(Se=F*Ie-R*Fe,Me=$*Ie-j*Fe,ze=W*Ie-ie*Fe,Le=Math.min(Se,Me,ze),We=Math.max(Se,Me,ze),De=Math.abs(Fe)*E+Math.abs(Ie)*M,Le>De||We<-De)||(Le=Math.min(R,j,ie),We=Math.max(R,j,ie),Le>E||We<-E)||(Le=Math.min(F,$,W),We=Math.max(F,$,W),Le>M||We<-M)||(Le=Math.min(z,q,Q),We=Math.max(z,q,Q),Le>C||We<-C))return!1;const Ge=ee*Ae-me*Te,$e=me*ge-Y*Ae,Je=Y*Te-ee*ge,Qe=-(Ge*R+$e*F+Je*z);return De=E*Math.abs(Ge)+M*Math.abs($e)+C*Math.abs(Je),!(Math.abs(Qe)>De)}const y1=[];class nv{serializeFromGltf(e,i,n,s){if(e.length<7)return;let l=0;if(e[l++]!==109||e[l++]!==98||e[l++]!==120||e[l++]!==98||e[l++]!==118||e[l++]!==104||e[l++]!==43)return;const u=new DataView(e.buffer,e.byteOffset),f=u.getUint16(l,!0);if(l+=2,f===0)return;this._nodes=[];let p=0;for(let x=0;x<f;x++){const b=[i[3*p],i[3*p+1],i[3*p+2]],w=[n[3*p],n[3*p+1],n[3*p+2]];p++;const S=u.getUint16(l,!0);l+=2;let E=0,M=0;S===65535&&(E=u.getUint16(l,!0),l+=2,M=u.getUint32(l,!0),l+=4),this._nodes.push({aabbMin:b,aabbMax:w,backChild:S,indexCount:E,indexOffset:M})}const g=u.getUint32(l,!0);this._indices=s.slice(0,g)}setVertices(e){this._vertices=e}findHighestPoint(e,i){if(!this._nodes||this._nodes.length===0||!Zg(this._nodes[0].aabbMin,this._nodes[0].aabbMax,e,i))return null;const n=y1;n.length=0,n.push(0);let s=-1/0;for(;n.length>0;){const l=n.pop(),u=this._nodes[l];if(u.aabbMax[2]<=s)continue;if(u.backChild===65535){for(let S=0;S<u.indexCount;S+=3){const E=3*this._indices[u.indexOffset+S],M=3*this._indices[u.indexOffset+S+1],C=3*this._indices[u.indexOffset+S+2];g1(this._vertices[E],this._vertices[E+1],this._vertices[E+2],this._vertices[M],this._vertices[M+1],this._vertices[M+2],this._vertices[C],this._vertices[C+1],this._vertices[C+2],e,i)&&(s=Math.max(s,this._vertices[E+2],this._vertices[M+2],this._vertices[C+2]))}continue}const f=l+1,p=u.backChild,g=this._nodes[f],x=this._nodes[p],b=Zg(g.aabbMin,g.aabbMax,e,i),w=Zg(x.aabbMin,x.aabbMax,e,i);b&&w?g.aabbMax[2]<x.aabbMax[2]?(n.push(f),n.push(p)):(n.push(p),n.push(f)):b?n.push(f):w&&n.push(p)}return s>=0?s:null}}function qc(r,e){const i=r.json.bufferViews[e.bufferView],n=Km[e.componentType];return new n(r.buffers[i.buffer],(e.byteOffset||0)+(i.byteOffset||0),e.count*(i.byteStride&&i.byteStride!==bf[e.type]*n.BYTES_PER_ELEMENT?i.byteStride/n.BYTES_PER_ELEMENT:bf[e.type]))}function Wg(r,e,i,n){const s=Km[e.componentType],l=(function(x){switch(x){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:return 1}})(s),u=r.json.bufferViews[e.bufferView],f=u.byteStride?u.byteStride/s.BYTES_PER_ELEMENT:bf[e.type],p=i.float32,g=p.length/i.capacity;for(let x=0,b=0;x<e.count*f;x+=f,b+=g)for(let w=0;w<g;w++)p[b+w]=n[x+w]*l;i._trim()}function x1(r,e,i){const n=r.indices,s=r.attributes,l={};l.indexArray=new Ai;const u=e.json.accessors[n],f=u.count/3;l.indexArray.reserve(f);const p=qc(e,u);for(let w=0;w<f;w++)l.indexArray.emplaceBack(p[3*w],p[3*w+1],p[3*w+2]);l.indexArray._trim(),l.vertexArray=new En;const g=e.json.accessors[s.POSITION];l.vertexArray.reserve(g.count);const x=qc(e,g);for(let w=0;w<g.count;w++)l.vertexArray.emplaceBack(x[3*w],x[3*w+1],x[3*w+2]);if(l.vertexArray._trim(),l.aabb=new wi(g.min,g.max),l.centroid=(function(w,S){const E=[0,0,0],M=w.length;if(M>0){for(let C=0;C<M;C++){const R=3*w[C];E[0]+=S[R],E[1]+=S[R+1],E[2]+=S[R+2]}E[0]/=M,E[1]/=M,E[2]/=M}return E})(p,x),s.COLOR_0!==void 0){const w=e.json.accessors[s.COLOR_0],S=bf[w.type],E=qc(e,w);l.colorArray=S===3?new En:new ns,l.colorArray.resize(w.count),Wg(e,w,l.colorArray,E)}if(s.NORMAL!==void 0){l.normalArray=new En;const w=e.json.accessors[s.NORMAL];l.normalArray.resize(w.count);const S=qc(e,w);Wg(e,w,l.normalArray,S)}if(s.TEXCOORD_0!==void 0&&i.length>0){l.texcoordArray=new Os;const w=e.json.accessors[s.TEXCOORD_0];l.texcoordArray.resize(w.count);const S=qc(e,w);Wg(e,w,l.texcoordArray,S)}if(s._FEATURE_ID_RGBA4444!==void 0){const w=e.json.accessors[s._FEATURE_ID_RGBA4444];e.json.extensionsUsed&&e.json.extensionsUsed.includes("EXT_meshopt_compression")&&(l.featureData=qc(e,w))}s._FEATURE_RGBA4444!==void 0&&(l.featureData=new Uint32Array(qc(e,e.json.accessors[s._FEATURE_RGBA4444]).buffer));const b=r.material;return l.material=(function(w,S){const{emissiveFactor:E=[0,0,0],alphaMode:M="OPAQUE",alphaCutoff:C=.5,normalTexture:R,occlusionTexture:F,emissiveTexture:z,doubleSided:j,name:$}=w,{baseColorFactor:q=[1,1,1,1],metallicFactor:ie=1,roughnessFactor:W=1,baseColorTexture:Q,metallicRoughnessTexture:Y}=w.pbrMetallicRoughness||{},ee=F?S[F.index]:void 0;if(F&&F.extensions&&F.extensions.KHR_texture_transform&&ee){const me=F.extensions.KHR_texture_transform;ee.offsetScale=[me.offset[0],me.offset[1],me.scale[0],me.scale[1]]}return{name:$,pbrMetallicRoughness:{baseColorFactor:new qt(...q),metallicFactor:ie,roughnessFactor:W,baseColorTexture:Q?S[Q.index]:void 0,metallicRoughnessTexture:Y?S[Y.index]:void 0},doubleSided:j,emissiveFactor:new qt(...E),alphaMode:M,alphaCutoff:C,normalTexture:R?S[R.index]:void 0,occlusionTexture:ee,emissionTexture:z?S[z.index]:void 0,defined:w.defined===void 0}})(b!==void 0?e.json.materials[b]:{defined:!1},i),l}function Xg(r,e,i){const{matrix:n,rotation:s,translation:l,scale:u,mesh:f,extras:p,children:g,name:x}=r,b={};if(b.name=x,b.localMatrix=n||(function(w,S,E,M){var C=S[0],R=S[1],F=S[2],z=S[3],j=C+C,$=R+R,q=F+F,ie=C*j,W=C*$,Q=C*q,Y=R*$,ee=R*q,me=F*q,ge=z*j,Te=z*$,Ae=z*q,Ie=M[0],Fe=M[1],xe=M[2];return w[0]=(1-(Y+me))*Ie,w[1]=(W+Ae)*Ie,w[2]=(Q-Te)*Ie,w[3]=0,w[4]=(W-Ae)*Fe,w[5]=(1-(ie+me))*Fe,w[6]=(ee+ge)*Fe,w[7]=0,w[8]=(Q+Te)*xe,w[9]=(ee-ge)*xe,w[10]=(1-(ie+Y))*xe,w[11]=0,w[12]=E[0],w[13]=E[1],w[14]=E[2],w[15]=1,w})([],s||[0,0,0,1],l||[0,0,0],u||[1,1,1]),b.globalMatrix=Hl(b.localMatrix),f!==void 0){b.meshes=i[f];const w=b.anchor=[0,0];for(const S of b.meshes){const{min:E,max:M}=S.aabb;w[0]+=E[0]+M[0],w[1]+=E[1]+M[1]}w[0]=Math.floor(w[0]/b.meshes.length/2),w[1]=Math.floor(w[1]/b.meshes.length/2)}if(p&&(p.id&&(b.id=p.id),p.lights&&(b.lights=(function(w){if(!w.length)return[];const S=(function(F){const z=atob(F),j=new Uint8Array(z.length);for(let $=0;$<z.length;$++)j[$]=z.codePointAt($);return j})(w),E=[],M=S.length/24,C=new Uint16Array(S.buffer),R=new Float32Array(S.buffer);for(let F=0;F<M;F++){const z=C[2*F*6]/30,j=C[2*F*6+1]/30,$=C[2*F*6+10]/100,q=R[6*F+1],ie=R[6*F+2],W=R[6*F+3],Q=R[6*F+4],Y=W-q,ee=Q-ie,me=Math.hypot(Y,ee);E.push({pos:[q+.5*Y,ie+.5*ee,j],normal:[ee/me,-Y/me,0],width:me,height:z,depth:$,points:[q,ie,W,Q]})}return E})(p.lights)),p.MAPBOX_geometry_bloom&&(b.isGeometryBloom=p.MAPBOX_geometry_bloom)),g){const w=[];for(const S of g)w.push(Xg(e.json.nodes[S],e,i));b.children=w}if(r.extensions&&r.extensions.mbx_bvh&&(b.meshBVH=(function(w,S,E){const M=S.binaryAccessor,C=S.positionMinAccessor,R=S.positionMaxAccessor,F=S.indexAccessor;if(!(Number.isInteger(M)&&Number.isInteger(C)&&Number.isInteger(R)&&Number.isInteger(F)))return null;const z=w.json.accessors;if(M>=z.length||C>=z.length||R>=z.length||F>=z.length)return null;const j=z[M],$=z[C],q=z[R],ie=z[F];if(j.bufferView===void 0||$.bufferView===void 0||q.bufferView===void 0||ie.bufferView===void 0)return null;const W=w.json.bufferViews;if(j.bufferView>=W.length||$.bufferView>=W.length||q.bufferView>=W.length||ie.bufferView>=W.length)return null;const Q=W[j.bufferView],Y=W[$.bufferView],ee=W[q.bufferView],me=W[ie.bufferView];if(Q.buffer>=w.buffers.length||Y.buffer>=w.buffers.length||ee.buffer>=w.buffers.length||me.buffer>=w.buffers.length)return null;const ge=(We,De,Ge)=>We>=0&&We<=Ge&&De<=Ge-We,Te=j.byteOffset||0,Ae=$.byteOffset||0,Ie=q.byteOffset||0,Fe=ie.byteOffset||0;if(!(ge(Te,0,Q.byteLength)&&ge(Ae,3*$.count*4,Y.byteLength)&&ge(Ie,3*q.count*4,ee.byteLength)&&ge(Fe,4*ie.count,me.byteLength)))return null;const xe=new Uint8Array(w.buffers[Q.buffer],(Q.byteOffset||0)+Te,Q.byteLength-Te),Se=new Float32Array(w.buffers[Y.buffer],(Y.byteOffset||0)+Ae,3*$.count),Me=new Float32Array(w.buffers[ee.buffer],(ee.byteOffset||0)+Ie,3*q.count),ze=new Uint32Array(w.buffers[me.buffer],(me.byteOffset||0)+Fe,ie.count),Le=new nv;if(Le.serializeFromGltf(xe,Se,Me,ze),E!==void 0&&w.json.meshes&&w.json.meshes[E]){const We=w.json.meshes[E].primitives[0];if(We&&We.attributes.POSITION!==void 0&&We.attributes.POSITION<z.length){const De=z[We.attributes.POSITION];if(De.bufferView!==void 0&&De.bufferView<W.length){const Ge=W[De.bufferView];if(Ge.buffer<w.buffers.length){const $e=De.byteOffset||0,Je=Ge.byteStride?Ge.byteStride/4:3;if(ge($e,De.count*Je*4,Ge.byteLength)){const Qe=(Ge.byteOffset||0)+$e;if(Je===3)Le.setVertices(new Float32Array(w.buffers[Ge.buffer],Qe,3*De.count));else{const ct=new Float32Array(w.buffers[Ge.buffer],Qe,De.count*Je),nt=new Float32Array(3*De.count);for(let mt=0;mt<De.count;mt++)nt[3*mt]=ct[mt*Je],nt[3*mt+1]=ct[mt*Je+1],nt[3*mt+2]=ct[mt*Je+2];Le.setVertices(nt)}}}}}}return Le})(e,r.extensions.mbx_bvh,f)),!b.meshBVH&&b.children){for(const w of b.children)if(w.meshBVH){b.meshBVH=w.meshBVH;break}}return b}function v1(r){if(r.vertices.length===0||r.indices.length===0)return null;const e=new km(r.vertices,r.indices,8,256),[i,n]=[e.min.clone(),e.max.clone()];return{vertices:r.vertices,indices:r.indices,grid:e,min:i,max:n}}function b1(r){if(!r.extras||!r.extras.ground)return null;const e=r.extras.ground;if(!e||!Array.isArray(e)||e.length===0)return null;const i=e[0];if(!i||!Array.isArray(i)||i.length===0)return null;const n=[];for(const u of i){if(!Array.isArray(u)||u.length!==2)continue;const f=u[0],p=u[1];typeof f=="number"&&typeof p=="number"&&n.push(new Ue(f,p))}if(n.length<3)return null;n.length>1&&n.at(-1).equals(n[0])&&n.pop();let s=0;for(let u=0;u<n.length;u++){const f=n[u],p=n[(u+1)%n.length],g=n[(u+2)%n.length];s+=(f.x-p.x)*(g.y-p.y)-(g.x-p.x)*(f.y-p.y)}s>0&&n.reverse();const l=Gr(n.flatMap(u=>[u.x,u.y]),[]);return l.length===0?null:{vertices:n,indices:l}}function w1(r,e){const i=[],n=[];let s=0;const l=[];for(const u of r){s=i.length;const f=u.vertexArray.float32,p=u.indexArray.uint16;for(let g=0;g<u.vertexArray.length;g++)l[0]=f[3*g+0],l[1]=f[3*g+1],l[2]=f[3*g+2],Pi(l,l,e),i.push(new Ue(l[0],l[1]));for(let g=0;g<3*u.indexArray.length;g++)n.push(p[g]+s)}if(n.length%3!=0)return null;for(let u=0;u<n.length;u+=3){const f=i[n[u+0]],p=i[n[u+1]],g=i[n[u+2]];(f.x-p.x)*(g.y-p.y)-(g.x-p.x)*(f.y-p.y)>0&&([n[u+1],n[u+2]]=[n[u+2],n[u+1]])}return{vertices:i,indices:n}}function ov(r,e){for(let i=0;i<r.length;i++)if(r[i].name===e)return i;return-1}function Yg(r){const e=(function(x,b){const w=[],S=WebGL2RenderingContext;if(x.json.textures)for(const E of x.json.textures){const M={magFilter:S.LINEAR,minFilter:S.NEAREST,wrapS:S.REPEAT,wrapT:S.REPEAT};E.sampler!==void 0&&Object.assign(M,x.json.samplers[E.sampler]),w.push({image:b[E.source],sampler:M,uploaded:!1})}return w})(r,r.images),i=(function(x,b){const w=[];for(const S of x.json.meshes){const E=[];for(const M of S.primitives)E.push(x1(M,x,b));w.push(E)}return w})(r,e),{scenes:n,scene:s,nodes:l}=r.json;let u=n?ov(n,"Default Scene"):-1;u<0&&(u=s||0);const f=n?n[u].nodes:[...l.keys()],p=[];for(const x of f)p.push(Xg(l[x],r,i));(function(x,b,w){const S={},E=new Set;for(let M=0;M<x.length;M++){const C=w[b[M]];if(!C.extras)continue;const R=C.extras["mapbox:footprint:version"],F=C.extras["mapbox:footprint:id"];(R||F)&&E.add(M),R==="1.0.0"&&F&&(S[F]=M)}for(let M=0;M<x.length;M++){if(E.has(M))continue;const C=x[M],R=w[b[M]];if(!R.extras)continue;let F=null;C.id in S&&(F=w1(x[S[C.id]].meshes,C.localMatrix)),F||(F=b1(R)),F&&(C.footprint=v1(F))}if(E.size>0){const M=Array.from(E.values()).sort((C,R)=>C-R);for(let C=M.length-1;C>=0;C--)x.splice(M[C],1)}})(p,f,r.json.nodes);const g=n?ov(n,"LOD"):-1;if(g>=0){const x=n[g].nodes,b=new Map;for(const w of x){const S=Xg(l[w],r,i);S.id&&b.set(S.id,S)}for(const w of p)if(w.id){const S=b.get(w.id);S&&S.meshes&&(w.lodMeshes=S.meshes,S.meshBVH&&(w.meshBVH=S.meshBVH))}}return p}function T1(r){r.heightmap=new Float32Array(4096),r.heightmap.fill(-1);const e=r.vertexArray.float32,i=r.aabb.min[0]-1,n=r.aabb.min[1]-1,s=Hc/(r.aabb.max[0]-i+2),l=Hc/(r.aabb.max[1]-n+2);for(let u=0;u<e.length;u+=3){const f=e[u+2],p=(e[u+0]-i)*s|0,g=(e[u+1]-n)*l|0;f>r.heightmap[g*Hc+p]&&(r.heightmap[g*Hc+p]=f)}}function sv(r,e,i,n,s){i.reserve(i.length+4*r.length),n.reserve(n.length+10*r.length),s.reserve(s.length+10*r.length);let l=n.length;for(const u of r){const f=Math.min(10,Math.max(4,1.3*u.height))*e,p=[-u.normal[1],u.normal[0],0],g=Math.min(.29,.1*u.width/u.depth),x=u.width-2*u.depth*e*(g+.01),b=wn([],u.pos,p,x/2),w=wn([],u.pos,p,-x/2),S=[b[0],b[1],b[2]+u.height],E=[w[0],w[1],w[2]+u.height],M=wn([],u.normal,p,g);Ci(M,M,f);const C=wn([],u.normal,p,-g);Ci(C,C,f),er(M,b,M),er(C,w,C),b[2]+=.1,w[2]+=.1,n.emplaceBack(M[0],M[1],M[2]),n.emplaceBack(C[0],C[1],C[2]),n.emplaceBack(b[0],b[1],b[2]),n.emplaceBack(w[0],w[1],w[2]),n.emplaceBack(S[0],S[1],S[2]),n.emplaceBack(E[0],E[1],E[2]),n.emplaceBack(b[0],b[1],b[2]),n.emplaceBack(w[0],w[1],w[2]),n.emplaceBack(M[0],M[1],M[2]),n.emplaceBack(C[0],C[1],C[2]);const R=x/f/2;s.emplaceBack(-R-g,-1,R,.8),s.emplaceBack(R+g,-1,R,.8),s.emplaceBack(-R,0,R,1.3),s.emplaceBack(R,0,R,1.3),s.emplaceBack(R+g,-.8,R,.7),s.emplaceBack(R+g,-.8,R,.7),s.emplaceBack(0,0,R,1.3),s.emplaceBack(0,0,R,1.3),s.emplaceBack(R+g,-1.2,R,.8),s.emplaceBack(R+g,-1.2,R,.8),i.emplaceBack(6+l,4+l,8+l),i.emplaceBack(7+l,9+l,5+l),i.emplaceBack(0+l,1+l,2+l),i.emplaceBack(1+l,3+l,2+l),l+=10}}function S1(r,e){const i={};i.indexArray=new Ai,i.vertexArray=new En,i.colorArray=new ns,sv(r,e,i.indexArray,i.vertexArray,i.colorArray);const n={defined:!0};n.emissiveFactor=qt.black;const s={};return s.baseColorFactor=qt.white,n.pbrMetallicRoughness=s,i.material=n,i.aabb=new wi([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),i}et(nv,"ModelBVH");const av=Rt([{name:"a_pos_3f",components:3,type:"Float32"}]),I1=Rt([{name:"a_normal_3",components:3,type:"Int16"}]),E1=Rt([{name:"a_centroid_3",components:3,type:"Int16"}]),lv=Rt([{name:"a_part_color_emissive",components:2,type:"Uint16"}]),A1=Rt([{name:"a_faux_facade_color_emissive",components:2,type:"Uint16"}]),M1=Rt([{name:"a_faux_facade_data",components:4,type:"Uint16"}]),C1=Rt([{name:"a_faux_facade_vertical_range",components:2,type:"Uint16"}]),P1=Rt([{name:"a_bloom_attenuation",components:4,type:"Float32"}]),D1=Rt([{name:"a_flood_light_wall_radius_1i16",components:1,type:"Int16"}]),Jg=4096;class R1{constructor(e){this.module=e,this.memoryStack=this.module.malloc(Jg),this.memoryStackNextFree=this.memoryStack}createIntArray(e){const i=this.memoryStackNextFree;return this.memoryStackNextFree+=e.length*Int32Array.BYTES_PER_ELEMENT,this.memoryStackNextFree-this.memoryStack>Jg?-1:(new Int32Array(this.module.heap32.buffer,i,e.length).set(e),i)}createFloatArray(e){const i=this.memoryStackNextFree;return this.memoryStackNextFree+=e.length*Float32Array.BYTES_PER_ELEMENT,this.memoryStackNextFree-this.memoryStack>Jg?-1:(new Float32Array(this.module.heapF32.buffer,i,e.length).set(e),i)}readStringBuffer(e){let i="";for(;this.module.heapU8[e]!==0;)i+=String.fromCharCode(this.module.heapU8[e]),++e;return i}setStyle(e){const i=e.normalScale;this.module.setStyle(i[0],i[1],i[2],e.tileToMeters)}setAOOptions(e,i){this.module.setAOOptions(e?1:0,i)}setMetricOptions(e,i){this.module.setMetricOptions(e?1:0,i)}setStructuralOptions(e){this.module.setStructuralOptions(e?1:0)}setFacadeOptions(e,i){this.module.setFacadeOptions(e,i?1:0)}setFauxFacadeOptions(e,i,n){this.module.setFauxFacadeOptions(e?1:0,i?1:0,n)}setFacadeClassifierOptions(e){this.module.setFacadeClassifierOptions(e)}generateMesh(e,i){this.memoryStackNextFree=this.memoryStack;for(const f of e){const p=this.createIntArray(f.ringIndices),g=this.createFloatArray(f.coordinates);if(p===-1||g===-1)return`building_gen: Out of stack memory: ${this.memoryStackNextFree-this.memoryStack}/4096`;this.module.addFeature(f.id,f.sourceId,f.minHeight,f.height,f.roofType,g,p,f.ringIndices.length-1)}for(const f of i){let p;p=f.entrances?JSON.parse(f.entrances):[];const g=this.createFloatArray(p),x=this.createFloatArray(f.coordinates);if(g===-1||x===-1)return`building_gen: Out of stack memory: ${this.memoryStackNextFree-this.memoryStack}/4096`;this.module.addFacade(f.sourceId,f.crossPerc,f.distanceToRoad,g,p.length,x,f.coordinates.length)}if(!this.module.generateMesh()){const f=this.module.getLastError();return this.readStringBuffer(f)}const n=this.module.getMeshCount(),s=new Array(n);for(let f=0;f<n;f++){const p=this.module.getPositionsPtr(f),g=this.module.getPositionsLength(f),x=new Float32Array(this.module.heapF32.buffer,p,g),b=this.module.getNormalsPtr(f),w=this.module.getNormalsLength(f),S=new Float32Array(this.module.heapF32.buffer,b,w),E=this.module.getAOPtr(f),M=this.module.getAOLength(f),C=new Float32Array(this.module.heapF32.buffer,E,M),R=this.module.getUVPtr(f),F=this.module.getUVLength(f),z=new Float32Array(this.module.heapF32.buffer,R,F),j=this.module.getFauxFacadePtr(f),$=this.module.getFauxFacadeLength(f),q=new Uint8Array(this.module.heapU8.buffer,j,$),ie=this.module.getIndicesPtr(f),W=this.module.getIndicesLength(f),Q=new Int16Array(this.module.heap16.buffer,ie,W),Y=this.module.getBuildingPart(f);s[f]={positions:x,normals:S,ao:C,uv:z,isFauxFacade:q,indices:Q,buildingPart:Y}}const l=this.module.getRingCount(),u=[];for(let f=0;f<l;f++){const p=this.module.getRingPtr(f),g=this.module.getRingLength(f),x=new Float32Array(this.module.heapF32.buffer,p,g);u.push(x)}return{meshes:s,outerRingLength:this.module.getOuterRingLength(),modifiedPolygonRings:u}}}const cv=Ns.types,o_=32767;function z1(r,e){const i=Xe+e;for(const n of r)for(const s of n)if(s.x<-e||s.x>i||s.y<-e||s.y>i)return!1;return!0}function L1(r){switch(r){case"flat":return 3;case"hipped":return 1;case"gabled":return 2;case"parapet":return 0;case"mansard":return 4;case"skillion":return 5;case"pyramidal":return 6;default:throw new Error(`Unknown roof shape: ${r}`)}}let ph=null,uv=null,fo=null;class Kg{constructor(){this.layoutVertexArray=new En,this.layoutAttenuationArray=new ns,this.layoutColorArray=new en,this.indexArray=new Ai,this.indexArrayForConflation=new Ai,this.segmentsBucket=new di}}class Qg{constructor(e){this.layoutFacadePaintArray=null,this.layoutFacadeDataArray=null,this.layoutFacadeVerticalRangeArray=null,this.segmentsBucket=new di,this.entranceBloom=new Kg;const i=66560;this.layoutVertexArray=new En,this.layoutVertexArray.reserve(i),this.layoutNormalArray=new Ta,this.layoutNormalArray.reserve(i),this.layoutCentroidArray=new Ta,this.layoutCentroidArray.reserve(i),this.layoutColorArray=new en,this.layoutColorArray.reserve(i),this.layoutFloodLightDataArray=new Il,this.layoutFloodLightDataArray.reserve(i),this.layoutAOArray=new Fc,this.layoutAOArray.reserve(i),this.indexArray=new Ai,this.indexArray.reserve(66560),this.indexArrayForConflation=new Ai,this.segmentsBucket=new di,this.entranceBloom=new Kg,e&&(this.layoutFacadePaintArray=new en,this.layoutFacadeDataArray=new Sl,this.layoutFacadeVerticalRangeArray=new en)}reserve(e,i,n){this.layoutVertexArray.reserveForAdditional(e),this.layoutCentroidArray.reserveForAdditional(e),this.layoutFloodLightDataArray.reserveForAdditional(e),this.layoutNormalArray.reserveForAdditional(e),this.layoutAOArray.reserveForAdditional(e),this.layoutColorArray.reserveForAdditional(e),this.indexArray.reserveForAdditional(i),n&&(this.layoutFacadePaintArray.reserveForAdditional(e),this.layoutFacadeDataArray.reserveForAdditional(e),this.layoutFacadeVerticalRangeArray.reserveForAdditional(e))}}class hv{constructor(e){this.colorBufferUploaded=!1,this.maxHeight=0,this.replacementUpdateTime=0,this.activeReplacements=[],this.footprints=[],this.footprintsVertices=new Os,this.footprintsIndices=new os,this.footprintsMin=new Ue(1/0,1/0),this.footprintsMax=new Ue(-1/0,-1/0),this.featuresOnBorder=[],this.buildingWithoutFacade=new Qg(!1),this.buildingWithFacade=new Qg(!0),this.indexArrayForConflationUploaded=!1,this.featureFootprintLookup=new Map,this.buildingIds=new Set,this.footprintLookup={},this.zoom=e.zoom,this.canonical=e.canonical,this.layers=e.layers,this.layerIds=this.layers.map(i=>i.fqid),this.index=e.index,this.hasPattern=!1,this.worldview=e.worldview,this.lut=e.lut,this.programConfigurations=new An(e.layers,{zoom:e.zoom,lut:e.lut}),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.projection=e.projection,this.groundEffect=new Bg(e),this.groundEffect.groundRadiusArray=new Sr,this.hasAppearances=null}updateFootprints(e,i){const n=new km([],[],1),s={vertices:[],indices:new Uint32Array(0),grid:n,min:this.footprintsMin,max:this.footprintsMax,buildingIds:this.buildingIds};i.push({footprint:s,id:e})}updateAppearances(e,i,n,s){return{hasLayoutChanges:!1,hasUboChanges:!1}}populate(e,i,n,s){if(!fo)return;const l=Cn(n);this.tileToMeter=l,this.brightness=i.brightness,fo.setStyle({normalScale:[1,-1,l],tileToMeters:l}),fo.setAOOptions(!1,.3),fo.setMetricOptions(!1,16),fo.setStructuralOptions(!0),fo.setFacadeClassifierOptions(3);const u=new Map,f=new Map;let p=0;for(const{feature:C}of e){if(cv[C.type]!=="LineString"){u.set(C.id,C.properties.source_id);continue}const R=this.layers[0]._featureFilter.needGeometry;if(R&&!this.layers[0]._featureFilter.filter(new Wt(this.zoom),C,n))continue;const F=$n(C,R);if(!R&&!this.layers[0]._featureFilter.filter(new Wt(this.zoom),F,n))continue;const z=R?F.geometry:gn(C,n,s),j=[];for(const W of z)for(const Q of W)j.push(Q.x),j.push(Q.y);const $={coordinates:j,crossPerc:C.properties.cross_perc,distanceToRoad:C.properties.distance_to_road,entrances:C.properties.entrances,sourceId:0},q=C.properties.source_id;let ie=f.get(q);ie||(ie=[],f.set(q,ie)),ie.push($),++p}this.maxHeight=0;const g=new Array,x=new Set,b=C=>{C!=null&&x.add(C)},w=(C,R)=>{C!=null&&g.push({buildingId:C,footprintIndex:R})},S=64*(e.length-p),E=S/2;this.buildingWithFacade.reserve(S,E,!0),this.buildingWithoutFacade.reserve(2*S,2*E,!1),this.footprintsIndices.reserve(16*(e.length-p)),this.footprintsVertices.reserve(8*(e.length-p));for(const{feature:C,id:R,index:F,sourceLayerIndex:z}of e){if(cv[C.type]==="LineString")continue;const j=this.layers[0]._featureFilter.needGeometry;if(j&&!this.layers[0]._featureFilter.filter(new Wt(this.zoom),C,n))continue;let $=null;if(C.properties&&Object.hasOwn(C.properties,"building_id")&&($=Number(C.properties.building_id),x.has($)))continue;const q=$n(C,j);if(!j&&!this.layers[0]._featureFilter.filter(new Wt(this.zoom),q,n))continue;const ie=j?q.geometry:gn(C,n,s),W=ff(ie,500);let Q=!1;for(const Lt of W)if(Lt.length!==1){Q=!0;break}if(Q){b($);continue}if(!z1(ie,163)){b($);continue}const Y=this.layers[0],ee=L1(Y.layout.get("building-roof-shape").evaluate(C,{},n)),me=Y.layout.get("building-base").evaluate(C,{},n),ge=Y.layout.get("building-height").evaluate(C,{},n),Te=Y.layout.get("building-flood-light-ground-radius").evaluate(C,{},n),Ae=Y.paint.get("building-ambient-occlusion-intensity"),Ie=Te/this.tileToMeter;C.properties["building-part"]="roof";const Fe=Y.paint.get("building-color").evaluate(C,{},this.canonical).toPremultipliedRenderColor(this.lut),xe=Y.paint.get("building-emissive-strength").evaluate(C,{},this.canonical);C.properties["building-part"]="wall";const Se=Y.paint.get("building-color").evaluate(C,{},this.canonical).toPremultipliedRenderColor(this.lut),Me=Y.paint.get("building-emissive-strength").evaluate(C,{},this.canonical);C.properties["building-part"]="window";const ze=Y.paint.get("building-color").evaluate(C,{},this.canonical).toPremultipliedRenderColor(this.lut),Le=Y.paint.get("building-emissive-strength").evaluate(C,{},this.canonical);C.properties["building-part"]="door";const We=Y.paint.get("building-color").evaluate(C,{},this.canonical).toPremultipliedRenderColor(this.lut),De=Y.paint.get("building-emissive-strength").evaluate(C,{},this.canonical);let Ge=Y.layout.get("building-flood-light-wall-radius").evaluate(C,{},n);Ge=re(Ge,0,2048);const $e=Ge/2048*o_,Je=u.get(R),Qe=f.get(Je)||[],ct=Qe.length!==0&&Y.layout.get("building-facade").evaluate(C,{},n);fo.setFacadeOptions(4,!0),fo.setFauxFacadeOptions(ct,!1,1);let nt=0,mt=0,Gt=0,wt=0,kt=0,Mt=0,Oi=0,Yt=0,jt=0,ci=0,Si=0;if(ct){let Lt=Math.round(Y.layout.get("building-facade-floors").evaluate(C,{},n));if(me===0){Lt=Math.max(1,Lt-(Qe.length>0?1:0));let Bi=4;if(ge>100){const cr=[10,13,15];Bi=cr[C.id?C.id%cr.length:0]}else ge<=10&&(Bi=3);fo.setFacadeOptions(Bi,!0),kt=(ge<15?1.3:1.61803)*Bi/l}else kt=me/l;Mt=ge/l,kt=Math.min(kt,Mt),Gt=Y.layout.get("building-facade-unit-width").evaluate(C,{},n)/l,wt=(Mt-kt)/Lt,fo.setFauxFacadeOptions(!0,!0,Gt);const yr=Y.layout.get("building-facade-window").evaluate(C,{},n);nt=yr[0],mt=yr[1],Oi=Math.floor(65535*Math.min(1,kt/Xe)),Yt=Math.floor(65535*Math.min(1,Mt/Xe)),jt=Math.floor(255*nt)<<8|Math.floor(255*mt),ci=Math.floor(65535*Math.min(1,Gt/Xe)),Si=Math.floor(65535*Math.min(1,wt/Xe))}const fr=Array(W.length),mi={x:1/0,y:1/0},Fi={x:-1/0,y:-1/0},ir={x:0,y:0};let Qi=0;for(let Lt=0;Lt<W.length;Lt++){const yr=W[Lt];if(yr.length>0){const Bi=[],cr=Array(yr.length+1);cr[0]=0;for(let _o=0;_o<yr.length;_o++){const Ln=yr[_o];for(let Zn=0;Zn<Ln.length;Zn++){const On=Ln[Ln.length-Zn-1];mi.x=Math.min(mi.x,On.x),mi.y=Math.min(mi.y,On.y),Fi.x=Math.max(Fi.x,On.x),Fi.y=Math.max(Fi.y,On.y),ir.x+=On.x,ir.y+=On.y,Qi++,Bi.push(On.x),Bi.push(On.y)}cr[_o+1]=Bi.length}fr[Lt]={id:C.id?C.id:0,height:ge,minHeight:me,sourceId:0,roofType:ee,coordinates:Bi,ringIndices:cr}}}ir.x/=Qi||1,ir.y/=Qi||1;const rr=fo.generateMesh(fr,Qe);if(typeof rr=="string"){Pt(`Unable to generate building ${C.id}: ${rr}`),b($);continue}if(rr.meshes.length===0||rr.modifiedPolygonRings.length===0){b($);continue}const zt=ct?this.buildingWithFacade:this.buildingWithoutFacade;let Er=0;for(const Lt of rr.meshes)Er+=Lt.positions.length/3;const Qr=zt.segmentsBucket.prepareSegment(Er,zt.layoutVertexArray,zt.indexArray),Wi=[];let gr=null,$r=0,Ar=-1;const Mi=zt.layoutVertexArray.length,lr=Mi+Er;zt.layoutVertexArray.resize(lr),zt.layoutCentroidArray.resize(lr),zt.layoutNormalArray.resize(lr),zt.layoutAOArray.resize(lr),zt.layoutColorArray.resize(lr),zt.layoutFloodLightDataArray.resize(lr),ct&&(zt.layoutFacadePaintArray.resize(lr),zt.layoutFacadeDataArray.resize(lr),zt.layoutFacadeVerticalRangeArray.resize(lr));const vn=zt.indexArray.length;let Sh=0,nn=Mi;for(const Lt of rr.meshes){let yr,Bi;if(Lt.buildingPart===1)yr=Fe,Bi=xe;else if(Lt.buildingPart===0)yr=Se,Bi=Me;else if(Lt.buildingPart===2)yr=ze,Bi=Le;else{if(Lt.buildingPart!==3)continue;yr=We,Bi=De}if(Bi=re(Bi,0,1),Lt.buildingPart===3){const nr=new Array;for(let on=0;on<Lt.positions.length;on+=12){const Mr=Lt.positions[on+0],Hr=Lt.positions[on+1],Xn=Lt.positions[on+3],Zs=Lt.positions[on+4],D_=Lt.positions[on+2],Ny=Lt.positions[on+8]-D_,Uy=1,Ah=Xn-Mr,fs=Zs-Hr,qf=Math.hypot(Ah,fs);nr.push({pos:[Mr+.5*Ah,Hr+.5*fs,D_],normal:[fs/qf,-Ah/qf,0],width:qf,height:Ny,depth:Uy,points:[Mr,Hr,Xn,Zs]})}const br=zt.entranceBloom.segmentsBucket.prepareSegment(10*nr.length,zt.entranceBloom.layoutVertexArray,zt.entranceBloom.indexArray),Vi=zt.entranceBloom.layoutVertexArray.length;$r=zt.entranceBloom.indexArray.length,sv(nr,.5/this.tileToMeter,zt.entranceBloom.indexArray,zt.entranceBloom.layoutVertexArray,zt.entranceBloom.layoutAttenuationArray);const Wn=zt.entranceBloom.layoutVertexArray.length-Vi;Ar=zt.entranceBloom.indexArray.length-$r;for(let on=0;on<Wn;on++)zt.entranceBloom.layoutColorArray.emplaceBack(255*We.r<<8|255*We.g,255*We.b<<8|51*De);br.vertexLength+=Wn,br.primitiveLength+=Ar,gr={part:Lt.buildingPart,vertexOffset:Vi,vertexLength:Wn}}zt.layoutVertexArray.float32.set(Lt.positions,3*nn);const cr=Lt.positions.length/3;for(let nr=0;nr<cr;++nr){const br=3*nr;Sh=Math.max(Sh,Lt.positions[br+2]);const Vi=Lt.normals[br+1]*o_,Wn=Lt.normals[br+2]*o_,on=3*(nn+nr);zt.layoutNormalArray.int16[on]=Lt.normals[br]*o_,zt.layoutNormalArray.int16[on+1]=Vi,zt.layoutNormalArray.int16[on+2]=Wn;const Mr=Lt.ao[nr];zt.layoutAOArray.uint8[nn+nr]=255*Mr;const Hr=1+(Mr-1)*Ae,Xn=255*yr.b*Hr<<8|255*Bi;zt.layoutColorArray.uint16[2*(nn+nr)]=255*yr.r*Hr<<8|255*yr.g*Hr,zt.layoutColorArray.uint16[2*(nn+nr)+1]=Xn}const _o=Math.min(8191,Math.max(0,Math.floor(ir.x))),Ln=Math.min(8191,Math.max(0,Math.floor(ir.y))),Zn=Math.floor(ge),On=20,Hf=4*_o+Math.min(3,Math.round((Fi.x-mi.x)*this.tileToMeter/On)),No=4*Ln+Math.min(3,Math.round((Fi.y-mi.y)*this.tileToMeter/On));for(let nr=0;nr<cr;++nr){const br=3*(nn+nr);zt.layoutCentroidArray.int16[br]=Hf,zt.layoutCentroidArray.int16[br+1]=No,zt.layoutCentroidArray.int16[br+2]=Zn}if(zt.layoutFloodLightDataArray.int16.fill(Lt.buildingPart===0?$e:0,nn,nn+cr),ct){const nr=255*ze.r<<8|255*ze.g,br=255*ze.b<<8|255*Le;for(let Vi=0;Vi<cr;++Vi){const Wn=2*(nn+Vi);zt.layoutFacadePaintArray.uint16[Wn]=nr,zt.layoutFacadePaintArray.uint16[Wn+1]=br}for(let Vi=0;Vi<cr;++Vi)if(Lt.isFauxFacade[Vi]){const Wn=Math.min(65535,Math.floor(Lt.uv[2*Vi]*rr.outerRingLength));zt.layoutFacadeDataArray.emplace(nn+Vi,1|Wn,jt,ci,Si),zt.layoutFacadeVerticalRangeArray.emplace(nn+Vi,Oi,Yt)}else zt.layoutFacadeDataArray.emplace(nn+Vi,0,0,0,0),zt.layoutFacadeVerticalRangeArray.emplace(nn+Vi,0,0)}const Ih=Qr.vertexLength,qs=Lt.indices.length/3,Eh=zt.indexArray.length;zt.indexArray.resize(Eh+qs);for(let nr=0;nr<qs;++nr){const br=3*nr,Vi=3*Eh+br;zt.indexArray.uint16[Vi]=Ih+Lt.indices[br],zt.indexArray.uint16[Vi+1]=Ih+Lt.indices[br+1],zt.indexArray.uint16[Vi+2]=Ih+Lt.indices[br+2]}Lt.buildingPart!==1&&Lt.buildingPart!==0&&Lt.buildingPart!==2&&Lt.buildingPart!==3||Wi.push({part:Lt.buildingPart,vertexOffset:nn,vertexLength:Lt.positions.length/3}),nn+=cr,Qr.vertexLength+=cr,Qr.primitiveLength+=Lt.indices.length/3}this.maxHeight=Math.max(this.maxHeight,Sh);const ky=zt.indexArray.length-vn,Gf=this.footprintsIndices.length,$f=this.footprintsVertices.length,ka=[],qn=new Ue(1/0,1/0),mo=new Ue(-1/0,-1/0),Ul=this.groundEffect.vertexArray.length;for(const Lt of rr.modifiedPolygonRings){const yr=[],Bi=new Ue(1/0,1/0),cr=new Ue(-1/0,-1/0);for(let _o=0;_o<Lt.length;_o+=2){const Ln=Lt.length-_o-2;Bi.x=Math.min(Bi.x,Lt[Ln]),Bi.y=Math.min(Bi.y,Lt[Ln+1]),cr.x=Math.max(cr.x,Lt[Ln]),cr.y=Math.max(cr.y,Lt[Ln+1]);const Zn=new Ue(Lt[Ln],Lt[Ln+1]);yr.push(Zn),ka.push(Zn.x,Zn.y),this.footprintsVertices.emplaceBack(Zn.x,Zn.y)}qn.x=Math.min(qn.x,Bi.x),qn.y=Math.min(qn.y,Bi.y),mo.x=Math.max(mo.x,cr.x),mo.y=Math.max(mo.y,cr.y),this.groundEffect.addData(yr,[Bi,cr],Ie)}const Vl=this.groundEffect.vertexArray.length-Ul;this.groundEffect.groundRadiusArray.reserveForAdditional(Vl);for(let Lt=0;Lt<Vl;Lt++)this.groundEffect.groundRadiusArray.emplaceBack(Te);(mi.x<0||Fi.x>Xe||mi.y<0||Fi.y>Xe)&&this.featuresOnBorder.push({featureId:C.id,footprintIndex:this.footprints.length});{const Lt=Gr(ka,null,2);this.footprintsIndices.resize(this.footprintsIndices.length+Lt.length),this.footprintsIndices.uint16.set(Lt,Gf),this.buildingIds.add($??C.id),this.footprintsMin.x=Math.min(this.footprintsMin.x,qn.x),this.footprintsMin.y=Math.min(this.footprintsMin.y,qn.y),this.footprintsMax.x=Math.max(this.footprintsMax.x,mo.x),this.footprintsMax.y=Math.max(this.footprintsMax.y,mo.y);const yr={footprintVertexOffset:$f,footprintVertexLength:this.footprintsVertices.length-$f,footprintIndexOffset:Gf,footprintIndexLength:this.footprintsIndices.length-Gf,min:qn,max:mo,hiddenFlags:0,indicesOffset:vn,indicesLength:ky,bloomIndicesOffset:$r,bloomIndicesLength:Ar,groundEffectVertexOffset:Ul,groundEffectVertexLength:Vl,hasFauxFacade:ct,height:Sh,promoteId:R,feature:q,parts:Wi,buildingBloom:gr},Bi=this.footprints.length;C.id!==void 0&&this.featureFootprintLookup.set(C.id,Bi),w($,Bi),this.footprints.push(yr)}this.programConfigurations.populatePaintArrays(zt.layoutVertexArray.length,C,F,{},i.availableImages,n,i.brightness),this.groundEffect.addPaintPropertiesData(C,F,{},i.availableImages,n,i.brightness),i.featureIndex.insert(C,ie,F,z,this.index,Mi)}g.forEach(({buildingId:C,footprintIndex:R})=>{x.has(C)&&(this.footprints[R].hiddenFlags|=4)});const M=new Set;this.buildingIds.forEach((C,R,F)=>{x.has(C)||M.add(C)}),this.buildingIds=M,this.groundEffect.prepareBorderSegments()}update(e,i,n,s,l,u,f){this.programConfigurations.updatePaintArrays(e,i,l,n,s,u,f),this.groundEffect.update(e,i,l,n,s,u,f),this.evaluate(this.layers[0],e),this.colorBufferUploaded=!1}updateExpressions(e){this.programConfigurations.updateExpressions(e),this.groundEffect.programConfigurations.updateExpressions(e)}isEmpty(){return this.buildingWithoutFacade.layoutVertexArray.length===0&&this.buildingWithFacade.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload||this.groundEffect.programConfigurations.needsUpload}upload(e){const i=n=>{n.layoutVertexBuffer=e.createVertexBuffer(n.layoutVertexArray,av.members),n.layoutNormalBuffer=e.createVertexBuffer(n.layoutNormalArray,I1.members),n.layoutCentroidBuffer=e.createVertexBuffer(n.layoutCentroidArray,E1.members),n.layoutFloodLightDataBuffer=e.createVertexBuffer(n.layoutFloodLightDataArray,D1.members),n.layoutFacadeDataArray&&n.layoutFacadeDataArray.length&&(n.layoutFacadeDataBuffer=e.createVertexBuffer(n.layoutFacadeDataArray,M1.members)),n.layoutFacadeVerticalRangeArray&&n.layoutFacadeVerticalRangeArray.length&&(n.layoutFacadeVerticalRangeBuffer=e.createVertexBuffer(n.layoutFacadeVerticalRangeArray,C1.members)),n.entranceBloom.layoutVertexArray.length&&(n.entranceBloom.layoutVertexBuffer=e.createVertexBuffer(n.entranceBloom.layoutVertexArray,av.members),n.entranceBloom.layoutAttenuationBuffer=e.createVertexBuffer(n.entranceBloom.layoutAttenuationArray,P1.members)),this.uploadUpdatedColorBuffer(e),this.uploadUpdatedIndexBuffer(e)};this.uploaded||(i(this.buildingWithoutFacade),i(this.buildingWithFacade),this.groundEffect.upload(e)),this.groundEffect.uploadPaintProperties(e),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){const e=i=>{i.layoutVertexBuffer&&(i.layoutVertexBuffer.destroy(),i.layoutNormalBuffer.destroy(),i.layoutColorBuffer.destroy(),i.segmentsBucket.destroy(),i.indexBuffer&&i.indexBuffer.destroy(),i.entranceBloom.layoutVertexBuffer&&(i.entranceBloom.layoutVertexBuffer.destroy(),i.entranceBloom.layoutColorBuffer.destroy(),i.entranceBloom.layoutAttenuationBuffer.destroy(),i.entranceBloom.indexBuffer.destroy(),i.entranceBloom.segmentsBucket.destroy()))};e(this.buildingWithoutFacade),e(this.buildingWithFacade),this.groundEffect.destroy(),this.programConfigurations.destroy()}updateFootprintHiddenFlags(e,i,n=!0){let s=!1;const l=n?i:0,u=0|(n?-1:~i);this.groundEffect.hiddenByLandmarkVertexArray.length===0&&this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length);for(const f of e){const p=this.footprints[f],g=p.hiddenFlags&u|l;p.hiddenFlags!==g&&(p.hiddenFlags=g,s=!0,this.groundEffect.updateHiddenByLandmarkRange(p.groundEffectVertexOffset,p.groundEffectVertexLength,p.hiddenFlags!==0))}return s&&(this.indexArrayForConflationUploaded=!1),s}uploadUpdatedIndexBuffer(e){if(this.groundEffect.uploadHiddenByLandmark(e),this.indexArrayForConflationUploaded)return;const i=s=>{s.indexArray.length!==0&&(s.indexArrayForConflation.resize(s.indexArray.length),s.indexArrayForConflation.uint16.set(s.indexArray.uint16),s.entranceBloom.indexArrayForConflation.resize(s.entranceBloom.indexArray.length),s.entranceBloom.indexArrayForConflation.uint16.set(s.entranceBloom.indexArray.uint16))};i(this.buildingWithoutFacade),i(this.buildingWithFacade);for(const s of this.footprints){const l=s.hasFauxFacade?this.buildingWithFacade:this.buildingWithoutFacade,u=s.indicesOffset+s.indicesLength;if(s.hiddenFlags!==0){for(let p=s.indicesOffset;p<u;p++)l.indexArrayForConflation.uint16[3*p+0]=0,l.indexArrayForConflation.uint16[3*p+1]=0,l.indexArrayForConflation.uint16[3*p+2]=0;const f=s.bloomIndicesOffset+s.bloomIndicesLength;for(let p=s.bloomIndicesOffset;p<f;p++)l.entranceBloom.indexArrayForConflation.uint16[3*p+0]=0,l.entranceBloom.indexArrayForConflation.uint16[3*p+1]=0,l.entranceBloom.indexArrayForConflation.uint16[3*p+2]=0}}const n=s=>{s.indexArray.length!==0&&(s.indexBuffer?s.indexBuffer.updateData(s.indexArrayForConflation):s.indexBuffer=e.createIndexBuffer(s.indexArrayForConflation,!0),s.entranceBloom.indexBuffer?s.entranceBloom.indexBuffer.updateData(s.entranceBloom.indexArrayForConflation):s.entranceBloom.indexBuffer=e.createIndexBuffer(s.entranceBloom.indexArrayForConflation,!0))};n(this.buildingWithoutFacade),n(this.buildingWithFacade),this.indexArrayForConflationUploaded=!0}uploadUpdatedColorBuffer(e){const i=n=>{n.layoutColorBuffer?n.layoutColorBuffer.updateData(n.layoutColorArray):n.layoutColorBuffer=e.createVertexBuffer(n.layoutColorArray,lv.members,!0),n.layoutFacadePaintArray&&(n.layoutFacadePaintBuffer?n.layoutFacadePaintBuffer.updateData(n.layoutFacadePaintArray):n.layoutFacadePaintBuffer=e.createVertexBuffer(n.layoutFacadePaintArray,A1.members,!0)),n.entranceBloom.layoutColorBuffer?n.entranceBloom.layoutColorBuffer.updateData(n.entranceBloom.layoutColorArray):n.entranceBloom.layoutColorBuffer=e.createVertexBuffer(n.entranceBloom.layoutColorArray,lv.members,!0)};i(this.buildingWithoutFacade),i(this.buildingWithFacade),this.colorBufferUploaded=!0}evaluate(e,i){const n=e.paint.get("building-ambient-occlusion-intensity");for(const s of this.footprints){if(4&s.hiddenFlags)continue;const l=i[s.promoteId],u=s.feature;u.properties["building-part"]="roof";const f=e.paint.get("building-color").evaluate(u,l,this.canonical).toPremultipliedRenderColor(this.lut),p=e.paint.get("building-emissive-strength").evaluate(u,l,this.canonical);u.properties["building-part"]="wall";const g=e.paint.get("building-color").evaluate(u,l,this.canonical).toPremultipliedRenderColor(this.lut),x=e.paint.get("building-emissive-strength").evaluate(u,l,this.canonical);u.properties["building-part"]="window";const b=e.paint.get("building-color").evaluate(u,l,this.canonical).toPremultipliedRenderColor(this.lut),w=e.paint.get("building-emissive-strength").evaluate(u,l,this.canonical);u.properties["building-part"]="door";const S=e.paint.get("building-color").evaluate(u,l,this.canonical).toPremultipliedRenderColor(this.lut),E=e.paint.get("building-emissive-strength").evaluate(u,l,this.canonical),M=s.hasFauxFacade?this.buildingWithFacade:this.buildingWithoutFacade;for(const R of s.parts){let F,z=f;R.part===1?(z=f,F=p):R.part===0?(z=g,F=x):R.part===2?(z=b,F=w):R.part===3&&(z=S,F=E),F=re(F,0,1);for(let j=0;j<R.vertexLength;j++){const $=R.vertexOffset+j,q=1+(M.layoutAOArray.uint8[$]/255-1)*n;M.layoutColorArray.emplace($,z.r*q*255<<8|z.g*q*255,z.b*q*255<<8|255*F),s.hasFauxFacade&&M.layoutFacadePaintArray.emplace($,255*b.r<<8|255*b.g,255*b.b<<8|255*w)}}const C=s.buildingBloom;if(C)for(let R=0;R<C.vertexLength;R++)M.entranceBloom.layoutColorArray.emplace(C.vertexOffset+R,255*S.r<<8|255*S.g,255*S.b<<8|51*E)}}needsEvaluation(){return!this.colorBufferUploaded}updateReplacement(e,i,n){if(i.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=i.updateTime;const s=i.getReplacementRegionsForTile(e.toUnwrapped());if(Um(this.activeReplacements,s))return;this.activeReplacements=s;for(const u of this.footprints)u.hiddenFlags&=-2;const l=[];for(const u of this.activeReplacements){if(u.order<n)continue;const f=Math.max(1,Math.pow(2,u.footprintTileId.canonical.z-e.canonical.z));for(const p of this.footprints)p.min.x>u.max.x||p.max.x<u.min.x||p.min.y>u.max.y||p.max.y<u.min.y||(l.length=0,F1(this.footprintsVertices,p.footprintVertexOffset,p.footprintVertexLength,u.footprintTileId.canonical,e.canonical,l),zg(u.footprint,l,this.footprintsIndices.uint16,p.footprintIndexOffset,p.footprintIndexLength,0,-f)&&(p.hiddenFlags|=1))}this.groundEffect.hiddenByLandmarkVertexArray.length===0&&this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length);for(const u of this.footprints)this.groundEffect.updateHiddenByLandmarkRange(u.groundEffectVertexOffset,u.groundEffectVertexLength,u.hiddenFlags!==0);this.indexArrayForConflationUploaded=!1}getFootprint(e){if(e.id!==void 0){const i=this.featureFootprintLookup.get(e.id);return this.footprints[i]}return null}getHeightAtTileCoord(e,i){let n=Number.NEGATIVE_INFINITY,s=!0;const l=4*(e+Xe)*Xe+(i+Xe);if(Object.hasOwn(this.footprintLookup,l)){const f=this.footprintLookup[l];return f?{height:f.height,hidden:f.hiddenFlags!==0}:void 0}const u=new Ue(e,i);for(const f of this.footprints)e>f.max.x||f.min.x>e||i>f.max.y||f.min.y>i||f.height<=n||O1(u,this.footprintsVertices.float32.subarray(2*f.footprintVertexOffset,2*(f.footprintVertexOffset+f.footprintVertexLength)),this.footprintsIndices.uint16.subarray(f.footprintIndexOffset,f.footprintIndexOffset+f.footprintIndexLength))&&(n=f.height,this.footprintLookup[l]=f,s=f.hiddenFlags!==0);if(n!==Number.NEGATIVE_INFINITY)return{height:n,hidden:s};this.footprintLookup[l]=void 0}}function O1(r,e,i){for(let n=0;n<i.length;n+=3){const s=i[n],l=i[n+1],u=i[n+2],f=e[2*s+0],p=e[2*s+1],g=e[2*l+0],x=e[2*l+1],b=e[2*u+0],w=e[2*u+1],S=(f-b)*(r.y-w)-(p-w)*(r.x-b),E=(g-f)*(r.y-p)-(x-p)*(r.x-f);if(S<0!=E<0&&S!==0&&E!==0)continue;const M=(b-g)*(r.y-x)-(w-x)*(r.x-g);if(M===0||M<0==S+E<=0)return!0}return!1}function F1(r,e,i,n,s,l){const u=Math.pow(2,n.z-s.z);for(let f=0;f<i;f++){let p=r.float32[2*(f+e)+0],g=r.float32[2*(f+e)+1];p=(p+s.x*Xe)*u-n.x*Xe,g=(g+s.y*Xe)*u-n.y*Xe,l.push(new Ue(p,g))}}async function dv(){return(function(){if(!ti(self)||fo!=null||uv!=null)return null;if(ph!=null)return ph;const r=fetch(aa());return ph=(function(e){let i,n,s,l,u;function f(){i=new Uint8Array(u.buffer),n=new Int16Array(u.buffer),s=new Int32Array(u.buffer),l=new Float32Array(u.buffer)}function p(){throw new Error("Unexpected BuildingGen error.")}const g=()=>{},x={a:{a:p,f:function(b){const w=i.length,S=Math.max(b>>>0,Math.ceil(1.2*w)),E=Math.ceil((S-w)/65536);try{return u.grow(E),f(),!0}catch{return!1}},g:p,b:g,c:g,d:g,e:g}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(e,x):e.then(b=>b.arrayBuffer()).then(b=>WebAssembly.instantiate(b,x))).then(b=>{const w=b.instance.exports;return(0,w.g)(),u=w.f,f(),new R1({setStyle:w.h,setAOOptions:w.i,setMetricOptions:w.j,setStructuralOptions:w.k,setFacadeOptions:w.l,setFauxFacadeOptions:w.m,setFacadeClassifierOptions:w.n,addFeature:w.o,addFacade:w.p,generateMesh:w.q,getLastError:w.r,getOuterRingLength:w.s,getMeshCount:w.t,getPositionsPtr:w.u,getPositionsLength:w.v,getNormalsPtr:w.w,getNormalsLength:w.x,getAOPtr:w.y,getAOLength:w.z,getUVPtr:w.A,getUVLength:w.B,getFauxFacadePtr:w.C,getFauxFacadeLength:w.D,getIndicesPtr:w.E,getIndicesLength:w.F,getBuildingPart:w.G,getRingCount:w.H,getRingPtr:w.I,getRingLength:w.J,malloc:w.K,free:w.L,heapU8:i,heap16:n,heap32:s,heapF32:l})})})(r).then(e=>{ph=null,fo=e}).catch(e=>{Pt("Could not load building-gen"),ph=null,uv=e}),ph})()}et(hv,"BuildingBucket",{omit:["layers"]}),et(Qg,"BuildingGeometry"),et(Kg,"BuildingBloomGeometry");const B1=Rt([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"},{name:"a_linesofar",components:1,type:"Float32"}],4),k1=Rt([{name:"a_z_offset_width",components:3,type:"Float32"}],4),N1=Rt([{name:"a_elevation_id_col",components:3,type:"Float32"}],4),U1=Rt([{name:"a_elevation_ground_scale",components:1,type:"Float32"}],4),{members:V1}=B1,j1=Rt([{name:"a_packed",components:3,type:"Float32"}]),{members:G1}=j1,$1=Rt([{name:"a_pattern_data",components:3,type:"Float32"}]),{members:H1}=$1;class fv{constructor(e,i){this.width=e,this.height=i,this.nextRow=0,this.image=new Fr({width:e,height:i}),this.positions={},this.uploaded=!1}getDash(e,i){const n=this.getKey(e,i);return this.positions[n]}trim(){const e=this.width,i=this.height=Dt(this.nextRow);this.image.resize({width:e,height:i})}getKey(e,i){return e.join(",")+i}getDashRanges(e,i,n){const s=[];let l=e.length%2==1?-e.at(-1)*n:0,u=e[0]*n,f=!0;s.push({left:l,right:u,isDash:f,zeroLength:e[0]===0});let p=e[0];for(let g=1;g<e.length;g++){f=!f;const x=e[g];l=p*n,p+=x,u=p*n,s.push({left:l,right:u,isDash:f,zeroLength:x===0})}return s}addRoundDash(e,i,n){const s=i/2;for(let l=-n;l<=n;l++){const u=this.width*(this.nextRow+n+l);let f=0,p=e[f];for(let g=0;g<this.width;g++){g/p.right>1&&(p=e[++f]);const x=Math.abs(g-p.left),b=Math.abs(g-p.right),w=Math.min(x,b);let S;const E=l/n*(s+1);if(p.isDash){const M=s-Math.abs(E);S=Math.sqrt(w*w+M*M)}else S=s-Math.sqrt(w*w+E*E);this.image.data[u+g]=Math.max(0,Math.min(255,S+128))}}}addRegularDash(e,i){for(let p=e.length-1;p>=0;--p){const g=e[p],x=e[p+1];g.zeroLength?e.splice(p,1):x&&x.isDash===g.isDash&&(x.left=g.left,e.splice(p,1))}const n=e[0],s=e.at(-1);n.isDash===s.isDash&&(n.left=s.left-this.width,s.right=n.right+this.width);const l=this.width*this.nextRow;let u=0,f=e[u];for(let p=0;p<this.width;p++){p/f.right>1&&(f=e[++u]);const g=Math.abs(p-f.left),x=Math.abs(p-f.right),b=Math.min(g,x);this.image.data[l+p]=Math.max(0,Math.min(255,(f.isDash?b:-b)+i+128))}}addDash(e,i){const n=this.getKey(e,i);if(this.positions[n])return this.positions[n];const s=i==="round",l=s?7:0,u=2*l+1;if(this.nextRow+u>this.height)return Pt("LineAtlas out of space"),null;e.length===0&&e.push(1);let f=0;for(let b=0;b<e.length;b++)e[b]<0&&(Pt("Negative value is found in line dasharray, replacing values with 0"),e[b]=0),f+=e[b];if(f!==0){const b=this.width/f,w=this.getDashRanges(e,this.width,b);s?this.addRoundDash(w,b,l):this.addRegularDash(w,i==="square"?.5*b:0)}const p=this.nextRow+l;this.nextRow+=u;const g=Math.floor(f),x={tl:[p,l],br:[g,Math.round(65535*(f-g))]};return this.positions[n]=x,x}}et(fv,"LineAtlas");const q1=Ns.types,Z1=Math.cos(Math.PI/180*37.5),W1=Math.cos(Math.PI/180*5);class s_{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(i=>i.fqid),this.index=e.index,this.projection=e.projection,this.hasPattern=!1,this.hasCrossSlope=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(i=>{this.gradients[i.id]={}}),this.layoutVertexArray=new Fd,this.layoutVertexArray2=new En,this.patternVertexArray=new En,this.indexArray=new Ai,this.programConfigurations=new An(e.layers,{zoom:e.zoom,lut:e.lut}),this.segments=new di,this.maxLineLength=0,this.zOffsetVertexArray=new En,this.elevationIdColVertexArray=new En,this.elevationGroundScaleVertexArray=new Sr,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.tessellationStep=e.tessellationStep?e.tessellationStep:128,this.worldview=e.worldview,this.hasAppearances=null}updateFootprints(e,i){}updateAppearances(e,i,n,s){return{hasLayoutChanges:!1,hasUboChanges:!1}}populate(e,i,n,s){this.showElevationIdDebug=i.showElevationIdDebug,this.hasPattern=bg("line",this.layers,this.pixelRatio,i);const l=this.layers[0].layout.get("line-sort-key");this.tileToMeter=Cn(n);const u=this.layers[0].layout.get("line-elevation-reference");if(u==="hd-road-markup")this.elevationType="road";else{const w=this.layers[0].layout.get("line-z-offset"),S=w.isConstant()&&!w.constantOr(0);this.elevationType=u!=="sea"&&u!=="ground"&&S?"none":"offset",this.elevationType==="offset"&&u==="none"&&Pt(`line-elevation-reference: ground is used for the layer ${this.layerIds[0]} because non-zero line-z-offset value was found.`),this.isSeaLevelReference=u==="sea"}const f=this.layers[0].layout.get("line-cross-slope");this.hasCrossSlope=this.elevationType==="offset"&&f!==void 0;const p=[];for(const{feature:w,id:S,index:E,sourceLayerIndex:M}of e){const C=this.layers[0]._featureFilter.needGeometry,R=$n(w,C);if(!this.layers[0]._featureFilter.filter(new Wt(this.zoom,{worldview:this.worldview,activeFloors:i.activeFloors}),R,n))continue;const F=l?l.evaluate(R,{},n):void 0,z={id:S,properties:w.properties,type:w.type,sourceLayerIndex:M,index:E,geometry:C?R.geometry:gn(w,n,s),patterns:{},sortKey:F};p.push(z)}l&&p.sort((w,S)=>w.sortKey-S.sortKey);const{lineAtlas:g,featureIndex:x}=i,b=this.addConstantDashes(g);for(const w of p){const{geometry:S,index:E,sourceLayerIndex:M}=w;if(b&&this.addFeatureDashes(w,g),this.hasPattern){const C=wg("line",this.layers,w,this.zoom,this.pixelRatio,i);this.patternFeatures.push(C)}else this.addFeature(w,S,E,n,g.positions,i.availableImages,i.brightness,i.elevationFeatures);x.insert(e[E].feature,S,E,M,this.index)}}addConstantDashes(e){let i=!1;for(const n of this.layers){const s=n.paint.get("line-dasharray").value,l=n.layout.get("line-cap").value;if(s.kind!=="constant"||l.kind!=="constant")i=!0;else{const u=l.value,f=s.value;if(!f)continue;e.addDash(f,u)}}return i}addFeatureDashes(e,i){const n=this.zoom;for(const s of this.layers){const l=s.paint.get("line-dasharray").value,u=s.layout.get("line-cap").value;if(l.kind==="constant"&&u.kind==="constant")continue;let f,p;if(l.kind==="constant"){if(f=l.value,!f)continue}else f=l.evaluate({zoom:n},e);p=u.kind==="constant"?u.value:u.evaluate({zoom:n},e),i.addDash(f,p),e.patterns[s.id]=[i.getKey(f,p)]}}update(e,i,n,s,l,u,f,p,g){this.programConfigurations.updatePaintArrays(e,i,l,n,s,u,f,g)}updateExpressions(e){this.programConfigurations.updateExpressions(e)}addFeatures(e,i,n,s,l,u){for(const f of this.patternFeatures)this.addFeature(f,f.geometry,f.index,i,n,s,u,e.elevationFeatures)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,G1)),this.patternVertexArray.length!==0&&(this.patternVertexBuffer=e.createVertexBuffer(this.patternVertexArray,H1)),!this.zOffsetVertexBuffer&&this.zOffsetVertexArray.length>0&&(this.zOffsetVertexBuffer=e.createVertexBuffer(this.zOffsetVertexArray,k1.members,!0)),!this.elevationIdColVertexBuffer&&this.elevationIdColVertexArray.length>0&&(this.elevationIdColVertexBuffer=e.createVertexBuffer(this.elevationIdColVertexArray,N1.members,!0)),!this.elevationGroundScaleVertexBuffer&&this.elevationGroundScaleVertexArray.length>0&&(this.elevationGroundScaleVertexBuffer=e.createVertexBuffer(this.elevationGroundScaleVertexArray,U1.members,!0)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,V1),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,i){let n,s;if(i&&i>0?(n=`mapbox_clip_start_${i}`,s=`mapbox_clip_end_${i}`):(n="mapbox_clip_start",s="mapbox_clip_end"),e.properties&&Object.hasOwn(e.properties,n)&&Object.hasOwn(e.properties,s))return{start:+e.properties[n],end:+e.properties[s]}}addFeature(e,i,n,s,l,u,f,p){const g=this.layers[0].layout,x=g.get("line-join").evaluate(e,{}),b=g.get("line-cap").evaluate(e,{}),w=g.get("line-miter-limit"),S=g.get("line-round-limit");this.lineClips=this.lineFeatureClips(e),this.lineFeature=e;const E=!(!e.properties||!Object.hasOwn(e.properties,"mapbox_line_metrics"))&&e.properties.mapbox_line_metrics;this.zOffsetValue=g.get("line-z-offset").value;const M=this.layers[0].paint.get("line-width").value;if(M.kind!=="constant"&&M.isLineProgressConstant===!1&&(this.variableWidthValue=M),this.isSeaLevelReference){const C=g.get("line-elevation-ground-scale").value;C.kind==="constant"&&C.value===0||(this.elevationGroundScaleValue=C)}if(this.elevationType==="road"){const C=this.layoutVertexArray.length;if(!this.addElevatedRoadFeature(e,i,s,p,x,b,w,S)){const[R,F]=this.clipRuntimeLinesToTile(i,1);for(let z=0;z<R.length;z++){const j=R[z],$=F[z],q={progress:{min:$.progress.min,max:$.progress.max},nextDir:this.computeSegNextDir($,j),prevDir:this.computeSegPrevDir($,j)};this.addLine(j,e,s,x,b,w,S,q,E&&$.parentIndex>0?$.parentIndex:null)}this.fillNonElevatedRoadSegment(C)}}else for(let C=0;C<i.length;C++)this.addLine(i[C],e,s,x,b,w,S,void 0,E&&C>0?C:null);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,l,u,s,f,void 0,this.worldview)}computeSegNextDir(e,i){return e.nextPoint.sub(i.at(-2)).unit()}computeSegPrevDir(e,i){return i[1].sub(e.prevPoint).unit()}clipLinesToTile(e,i){return Xm(e,-i,-i,Xe+i,Xe+i)}clipRuntimeLinesToTile(e,i){const n=[];return[Xm(e,-i,-i,Xe+i,Xe+i,n),n]}addElevatedRoadFeature(e,i,n,s,l,u,f,p){const g=[],x=a.getElevationFeature(e,s);if(x){const b=this.clipLinesToTile(i,1),w=this.prepareElevatedLines(b,x,n);for(const S of w)g.push({geometry:S,elevation:x,elevationTileID:n,segment:{progress:{min:0,max:1},nextDir:void 0,prevDir:void 0}})}if(g.length===0)return!1;for(const b of g){const w=this.layoutVertexArray.length;this.addLine(b.geometry,e,n,l,u,f,p);const S=new t(n,b.elevationTileID);if(b.elevation){const E=this.showElevationIdDebug?o(b.elevation.id):null;for(let M=w;M<this.layoutVertexArray.length;M++){const C=new Ue(this.layoutVertexArray.int16[6*M]>>1,this.layoutVertexArray.int16[6*M+1]>>1),R=S.pointElevation(C,b.elevation,.05);this.updateHeightRange(R),this.zOffsetVertexArray.emplaceBack(R,0,0),E?this.elevationIdColVertexArray.emplaceBack(E[0],E[1],E[2]):this.showElevationIdDebug&&this.elevationIdColVertexArray.emplaceBack(0,0,0)}}else this.fillNonElevatedRoadSegment(w)}return!0}prepareElevatedLines(e,i,n){if(i.constantHeight!=null)return e;const s=[],l=1/Cn(n);for(const u of e)r1(u,new af(i,l),0,s);return s}fillNonElevatedRoadSegment(e){for(let i=e;i<this.layoutVertexArray.length;i++)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,i,n,s,l,u,f,p,g){this.distance=0,this.prevDistance=0,this.scaledDistance=0,this.totalDistance=0,this.totalFeatureLength=0,this.lineSoFar=0,this.currentVertex=void 0,this.lineClips=g?this.lineFeatureClips(i,g):this.lineClips;const x=s==="none";this.patternJoinNone=this.hasPattern&&x,this.currentLineJoinType=s,this.segmentStart=0,this.segmentStartf32=0,this.segmentPoints=[];const b=p&&p.progress.min>0,w=p&&p.progress.max<1;if(this.lineClips){let Q={min:this.lineClips.start,max:this.lineClips.end},Y=1;if(p){const ge=this.lineClips.end-this.lineClips.start;Q=(function(Te,Ae,Ie){return{min:to(Te.min,Ae,Ie),max:to(Te.max,Ae,Ie)}})(p.progress,{min:0,max:1},Q),ge>0&&(Y=(Q.max-Q.min)/ge)}const ee=+i.properties.mapbox_clip_feature_len,me=+i.properties.mapbox_clip_seg_len;if(Number.isNaN(ee)||Number.isNaN(me)){for(let Te=0;Te<e.length-1;Te++)this.totalDistance+=e[Te].dist(e[Te+1]);const ge=this.totalDistance/(Q.max-Q.min);this.totalFeatureLength=Number.isFinite(ge)?ge:0,this.lineClips.start=Q.min,this.lineClips.end=Q.max,this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}else this.totalFeatureLength=ee,this.distance=me*Y,this.lineClips.start=Q.min,this.lineClips.end=Q.max,this.maxLineLength=Math.max(this.maxLineLength,this.distance);this.lineClipsArray.push(this.lineClips),this.updateScaledDistance()}const S=q1[i.type]==="Polygon";let E=e.length;for(;E>=2&&e[E-1].equals(e[E-2]);)E--;let M=0;for(;M<E-1&&e[M].equals(e[M+1]);)M++;if(E<(S?3:2))return;s==="bevel"&&(u=1.05);const C=this.segments.prepareSegment(10*E,this.layoutVertexArray,this.indexArray);let R,F,z,j,$,q,ie,W;p&&p.prevDir&&(q=p.prevDir.perp()),p&&p.nextDir&&(ie=p.nextDir.perp()),this.e1=this.e2=-1,S&&(R=e[E-2],$=e[M].sub(R)._unit()._perp());for(let Q=M;Q<E;Q++){if(z=Q===E-1?S?e[M+1]:void 0:e[Q+1],z&&e[Q].equals(z))continue;$&&(j=$),R&&(F=R),R=e[Q],W=this.evaluateLineProgressFeatures(F?F.dist(R):0),$=z?z.sub(R)._unit()._perp():j,j=j||$;const Y=F&&z;let ee=Y?s:S||x?"butt":l;const me=j.x*$.x+j.y*$.y;if(x){const Me=function(ze){if(ze.patternJoinNone){const Le=ze.segmentPoints.length/2,We=ze.lineSoFar-ze.segmentStart;for(let De=0;De<Le;++De){const Ge=ze.segmentPoints[2*De+1],$e=Math.round(ze.segmentPoints[2*De])+.5+.25*Ge;ze.patternVertexArray.emplaceBack($e,We,ze.segmentStart),ze.patternVertexArray.emplaceBack($e,We,ze.segmentStart)}ze.segmentPoints.length=0}ze.e1=ze.e2=-1};if(Y&&me<W1){this.updateDistance(F,R),this.addCurrentVertex(R,j,1,1,C,W),Me(this),this.addCurrentVertex(R,$,-1,-1,C,W);continue}if(F){if(!z){this.updateDistance(F,R),this.addCurrentVertex(R,j,1,1,C,W),Me(this);continue}ee="miter"}}let ge=j.add($);ge.x===0&&ge.y===0||ge._unit();const Te=ge.x*$.x+ge.y*$.y,Ae=Te!==0?1/Te:1/0,Ie=2*Math.sqrt(2-2*Te),Fe=Te<Z1&&F&&z,xe=j.x*$.y-j.y*$.x>0,Se=this.overscaling<=16?122880/(512*this.overscaling):0;if(Y&&ee==="round"){if(Ae<f)ee="miter";else if(Ae<=2){const Me=ey(R,-10,8202);ee=this.elevationType==="offset"&&(Me||this.hasCrossSlope)?"miter":"fakeround"}}if(ee==="miter"&&Ae>u&&(ee="bevel"),ee==="bevel"&&(Ae>2&&(ee="flipbevel"),Ae<u&&(ee="miter")),F&&!(ee==="miter"&&Fe)&&this.updateDistance(F,R),ee==="miter")if(Fe){const Me=R.dist(F);if(Me>2*Se){const Le=R.sub(R.sub(F)._mult(Se/Me)._round());this.updateDistance(F,Le),this.addCurrentVertex(Le,j,0,0,C,W),F=Le}this.updateDistance(F,R),ge._mult(Ae),this.addCurrentVertex(R,ge,0,0,C,W);const ze=R.dist(z);if(ze>2*Se){const Le=R.add(z.sub(R)._mult(Se/ze)._round());this.updateDistance(R,Le),this.addCurrentVertex(Le,$,0,0,C,W),R=Le}}else ge._mult(Ae),this.addCurrentVertex(R,ge,0,0,C,W);else if(ee==="flipbevel"){if(Ae>100)ge=$.mult(-1);else{const Me=Ae*j.add($).mag()/j.sub($).mag();ge._perp()._mult(Me*(xe?-1:1))}this.addCurrentVertex(R,ge,0,0,C,W),this.addCurrentVertex(R,ge.mult(-1),0,0,C,W)}else if(ee==="bevel"||ee==="fakeround"){const Me=R.dist(F);let ze=1;if(this.elevationType==="offset"&&ee==="bevel"&&this.currentLineJoinType!=="round"&&!this.patternJoinNone&&W!=null&&F&&z){const Je=4*Se;Me<Je&&(ze=Math.max(0,Me/Je))}W!=null&&F&&this.addCurrentVertex(R,ie||j,-ze,-ze,C,W);const Le=Me<=2*Se&&ee!=="bevel",We=ge.mult(xe?1:-1);We._mult(Ae);const De=$.mult(xe?-1:1),Ge=j.mult(xe?-1:1),$e=this.evaluateLineProgressFeatures(this.distance);if(W==null&&(this.addHalfVertex(R,We.x,We.y,!1,!xe,0,C,$e),Le||this.addHalfVertex(R,We.x+2*Ge.x,We.y+2*Ge.y,!1,xe,0,C,$e)),ee==="fakeround"){const Je=Math.round(180*Ie/Math.PI/20);this.addHalfVertex(R,Ge.x,Ge.y,!1,xe,0,C,$e);for(let Qe=0;Qe<Je;Qe++){let ct=Qe/Je;if(ct!==.5){const mt=ct-.5;ct+=ct*mt*(ct-1)*((1.0904+me*(me*(3.55645-1.43519*me)-3.2452))*mt*mt+(.848013+me*(.215638*me-1.06021)))}const nt=De.sub(Ge)._mult(ct)._add(Ge)._unit();this.addHalfVertex(R,nt.x,nt.y,!1,xe,0,C,$e)}this.addHalfVertex(R,De.x,De.y,!1,xe,0,C,$e)}Le||W!=null||this.addHalfVertex(R,We.x+2*De.x,We.y+2*De.y,!1,xe,0,C,$e),W!=null&&z&&this.addCurrentVertex(R,q||$,ze,ze,C,W)}else if(ee==="butt")this.addCurrentVertex(R,ge,0,0,C,W);else if(ee==="square"){if(!F){const Me=b?0:-1;this.addCurrentVertex(R,ge,Me,Me,C,W)}if(this.addCurrentVertex(R,ge,0,0,C,W),F){const Me=w?0:1;this.addCurrentVertex(R,ge,Me,Me,C,W)}}else if(ee==="round"){if(F){const Me=!Y&&ie?ie:j;this.addCurrentVertex(R,Me,0,0,C,W),!Y&&w||this.addCurrentVertex(R,Me,1,1,C,W,!0)}if(z){const Me=!Y&&q?q:$;!Y&&b||this.addCurrentVertex(R,Me,-1,-1,C,W,!0),this.addCurrentVertex(R,Me,0,0,C,W)}}}}addVerticesTo(e,i,n,s,l,u,f,p,g,x){const b=(i.w-e.w)/this.tessellationStep|0;let w=0;const S=this.scaledDistance;if(b>1){this.lineSoFar=e.w;const M=(i.x-e.x)/b,C=(i.y-e.y)/b,R=(i.z-e.z)/b,F=(i.w-e.w)/b,z=i.x-e.x,j=i.y-e.y,$=Math.sqrt(z*z+j*j);if($===0)return;const q=-j/$,ie=z/$,W=q,Q=ie,Y=-q,ee=-ie;for(let me=1;me<b;++me){e.x+=M,e.y+=C,e.z+=R,this.lineSoFar+=F,w+=F;const ge=this.evaluateLineProgressFeatures(this.prevDistance+w);this.scaledDistance=(this.prevDistance+w)/this.totalDistance,this.addHalfVertex(e,W,Q,x,!1,0,g,ge),this.addHalfVertex(e,Y,ee,x,!0,0,g,ge)}}this.lineSoFar=i.w,this.scaledDistance=S;const E=this.evaluateLineProgressFeatures(this.distance);this.addHalfVertex(i,n,s,x,!1,f,g,E),this.addHalfVertex(i,l,u,x,!0,-p,g,E)}evaluateLineProgressFeatures(e){if(!this.variableWidthValue&&this.elevationType!=="offset")return null;this.evaluationGlobals.lineProgress=0,this.lineClips?this.evaluationGlobals.lineProgress=Math.min(1,(this.totalFeatureLength*this.lineClips.start+e)/this.totalFeatureLength):Pt(`line-progress evaluation for ${this.layerIds[0]} requires enabling 'lineMetrics' for the source.`);let i=0;this.variableWidthValue&&this.variableWidthValue.kind!=="constant"&&(i=this.variableWidthValue.evaluate(this.evaluationGlobals,this.lineFeature)||0);const n=this.evaluateElevationGroundScale();return this.elevationType!=="offset"?{zOffset:0,variableWidth:i,elevationGroundScale:n}:this.zOffsetValue.kind==="constant"?{zOffset:this.zOffsetValue.value,variableWidth:i,elevationGroundScale:n}:{zOffset:this.zOffsetValue.evaluate(this.evaluationGlobals,this.lineFeature)||0,variableWidth:i,elevationGroundScale:n}}evaluateElevationGroundScale(){return this.elevationGroundScaleValue?this.elevationGroundScaleValue.kind==="constant"?this.elevationGroundScaleValue.value:this.elevationGroundScaleValue.evaluate(this.evaluationGlobals,this.lineFeature)||0:0}addCurrentVertex(e,i,n,s,l,u,f=!1){const p=i.x+i.y*n,g=i.y-i.x*n,x=i.y*s-i.x,b=-i.y-i.x*s;if(u!=null){const w=this.elevationType==="offset",S=this.elevationType==="offset"?2:10,E=-S,M=Xe+S,C=u.zOffset,R=new Cx(e.x,e.y,C,this.lineSoFar),F=!!w&&ey(e,E,M),z=this.lineSoFar,j=this.distance;if(this.currentVertex)if(F){const $=this.currentVertexIsOutside,q=this.currentVertex,ie=new Cx(e.x,e.y,C,this.lineSoFar);if(Dx(q,ie,E,M),!ey(ie,E,M)){if($){this.e1=this.e2=-1,this.distance-=q.dist(R),this.lineSoFar=q.w;const W=this.evaluateLineProgressFeatures(q.w-this.totalFeatureLength*(this.lineClips?this.lineClips.start:0));this.addHalfVertex(q,p,g,f,!1,n,l,W),this.addHalfVertex(q,x,b,f,!0,-s,l,W),this.prevDistance=this.distance}this.distance=this.prevDistance+q.dist(ie),this.scaledDistance=this.distance/this.totalDistance,this.addVerticesTo(q,ie,p,g,x,b,n,s,l,f),this.distance=j,this.scaledDistance=this.distance/this.totalDistance}}else{const $=this.currentVertex;if(this.currentVertexIsOutside){Dx($,R,E,M),this.e1=this.e2=-1,this.distance-=$.dist(R),this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=$.w;const q=this.evaluateLineProgressFeatures($.w-this.totalFeatureLength*(this.lineClips?this.lineClips.start:0));this.addHalfVertex($,p,g,f,!1,n,l,q),this.addHalfVertex($,x,b,f,!0,-s,l,q),this.prevDistance=this.distance,this.distance=j,this.scaledDistance=this.distance/this.totalDistance}this.addVerticesTo($,R,p,g,x,b,n,s,l,f)}else F||(this.addHalfVertex(e,p,g,f,!1,n,l,u),this.addHalfVertex(e,x,b,f,!0,-s,l,u));this.currentVertex=R,this.currentVertexIsOutside=F,this.lineSoFar=z}else this.addHalfVertex(e,p,g,f,!1,n,l,u),this.addHalfVertex(e,x,b,f,!0,-s,l,u)}addHalfVertex({x:e,y:i},n,s,l,u,f,p,g){if(this.patternJoinNone&&(this.segmentPoints.length===0&&(this.segmentStart=this.lineSoFar,this.segmentStartf32=Math.fround(this.lineSoFar)),u||this.segmentPoints.push(this.lineSoFar-this.segmentStart,f)),this.layoutVertexArray.emplaceBack((e<<1)+(l?1:0),(i<<1)+(u?1:0),Math.round(63*n)+128,Math.round(63*s)+128,1+(f===0?0:f<0?-1:1),0,this.lineSoFar-this.segmentStartf32),this.lineClips){const b=ft(this.lineClips.start,this.lineClips.end,this.scaledDistance);this.layoutVertexArray2.emplaceBack(this.scaledDistance,this.lineClipsArray.length,b)}const x=p.vertexLength++;if(this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,x),p.primitiveLength++),u?this.e2=x:this.e1=x,g!=null&&(this.zOffsetVertexArray.emplaceBack(g.zOffset,g.variableWidth,g.variableWidth),this.showElevationIdDebug&&this.elevationIdColVertexArray.emplaceBack(0,0,0)),this.elevationGroundScaleValue){const b=g?g.elevationGroundScale:this.evaluateElevationGroundScale();this.elevationGroundScaleVertexArray.emplaceBack(b)}}updateScaledDistance(){this.lineClips?(this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=this.totalFeatureLength*this.lineClips.start+this.distance):this.lineSoFar=this.distance}updateDistance(e,i){this.prevDistance=this.distance,this.distance+=e.dist(i),this.updateScaledDistance()}}function ey(r,e,i){return r.x<e||r.x>i||r.y<e||r.y>i}let pv,mv;function _v(r,e,i){return e*(Xe/(r.tileSize*Math.pow(2,i-r.tileID.overscaledZ)))}et(s_,"LineBucket",{omit:["layers","patternFeatures","currentVertex","currentVertexIsOutside"]});const gv=(r,e,i)=>(1-i)*r+i*e;function yv(r,e){return 1/_v(r,1,e.tileZoom)}function xv(r,e,i,n){return r.translatePosMatrix(n||e.tileID.projMatrix,e,i.paint.get("line-translate"),i.paint.get("line-translate-anchor"))}const vv=r=>{const e=[];bv(r)&&e.push("RENDER_LINE_DASH"),r.paint.get("line-gradient")&&e.push("RENDER_LINE_GRADIENT"),r.paint.get("line-blend-mode")==="multiply"&&e.push("LINE_BLEND_MULTIPLY"),r.paint.get("line-blend-mode")==="additive"&&e.push("LINE_BLEND_ADDITIVE");const i=r.paint.get("line-trim-offset");i[0]===0&&i[1]===0||e.push("RENDER_LINE_TRIM_OFFSET"),r.paint.get("line-border-width").constantOr(1)!==0&&e.push("RENDER_LINE_BORDER");const n=r.layout.get("line-join").constantOr("miter")==="none",s=!!r.paint.get("line-pattern").constantOr(1);return n&&s&&e.push("LINE_JOIN_NONE"),e};function bv(r){const e=r.paint.get("line-dasharray").value;return e.kind!=="constant"||e.value}let ty;const wv=()=>ty||(ty={layout:pv||(pv=new bi({"line-cap":new Ze(he.layout_line["line-cap"]),"line-join":new Ze(he.layout_line["line-join"]),"line-miter-limit":new He(he.layout_line["line-miter-limit"]),"line-round-limit":new He(he.layout_line["line-round-limit"]),"line-sort-key":new Ze(he.layout_line["line-sort-key"]),"line-z-offset":new Ze(he.layout_line["line-z-offset"]),"line-elevation-reference":new He(he.layout_line["line-elevation-reference"]),"line-cross-slope":new He(he.layout_line["line-cross-slope"]),visibility:new He(he.layout_line.visibility),"line-width-unit":new He(he.layout_line["line-width-unit"]),"line-elevation-ground-scale":new Ze(he.layout_line["line-elevation-ground-scale"])})),paint:mv||(mv=new bi({"line-opacity":new Ze(he.paint_line["line-opacity"]),"line-color":new Ze(he.paint_line["line-color"]),"line-translate":new He(he.paint_line["line-translate"]),"line-translate-anchor":new He(he.paint_line["line-translate-anchor"]),"line-width":new Ze(he.paint_line["line-width"]),"line-gap-width":new Ze(he.paint_line["line-gap-width"]),"line-offset":new Ze(he.paint_line["line-offset"]),"line-blur"
vendor: 5,548 bytes, line 7
7:new Ze(he.paint_line["line-blur"]),"line-dasharray":new Ze(he.paint_line["line-dasharray"]),"line-pattern":new Ze(he.paint_line["line-pattern"]),"line-pattern-cross-fade":new He(he.paint_line["line-pattern-cross-fade"]),"line-gradient":new zs(he.paint_line["line-gradient"]),"line-trim-offset":new He(he.paint_line["line-trim-offset"]),"line-trim-fade-range":new He(he.paint_line["line-trim-fade-range"]),"line-trim-color":new He(he.paint_line["line-trim-color"]),"line-emissive-strength":new Ze(he.paint_line["line-emissive-strength"]),"line-border-width":new Ze(he.paint_line["line-border-width"]),"line-border-color":new Ze(he.paint_line["line-border-color"]),"line-occlusion-opacity":new He(he.paint_line["line-occlusion-opacity"]),"line-blend-mode":new He(he.paint_line["line-blend-mode"]),"line-blend-additive-clamp":new He(he.paint_line["line-blend-additive-clamp"]),"line-color-use-theme":new Ze({type:"string",default:"default","property-type":"data-driven"}),"line-gradient-use-theme":new Ze({type:"string",default:"default","property-type":"data-driven"}),"line-trim-color-use-theme":new Ze({type:"string",default:"default","property-type":"data-driven"}),"line-border-color-use-theme":new Ze({type:"string",default:"default","property-type":"data-driven"})}))},ty);class X1 extends Ze{possiblyEvaluate(e,i){return i=new Wt(Math.floor(i.zoom),{now:i.now,fadeDuration:i.fadeDuration,transition:i.transition,worldview:i.worldview}),super.possiblyEvaluate(e,i)}evaluate(e,i,n,s){return i=Object.assign({},i,{zoom:Math.floor(i.zoom)}),super.evaluate(e,i,n,s)}}let Sf;function Tv(r,e){return e>0?e+2*r:r}const Y1=Rt([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_tex_size",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),J1=Rt([{name:"a_globe_anchor",components:3,type:"Int16"},{name:"a_globe_normal",components:3,type:"Float32"}],4),K1=Rt([{name:"a_projected_pos",components:4,type:"Float32"}],4);Rt([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const Q1=Rt([{name:"a_auto_z_offset",components:1,type:"Float32"}],4),ew=Rt([{name:"a_feature_index",components:1,type:"Float32"}],4),tw=Rt([{name:"a_x_axis",components:3,type:"Float32"},{name:"a_y_axis",components:3,type:"Float32"}]),iw=Rt([{name:"a_texb",components:2,type:"Uint16"}]),rw=Rt([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_elevation_from_sea",components:2,type:"Float32"}]),nw=Rt([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"},{name:"a_auto_z_offset",components:1,type:"Float32"}]);Rt([{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 Sv=Rt([{name:"a_pos",components:3,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),ow=Rt([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);Rt([{name:"triangle",components:3,type:"Uint16"}]),Rt([{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"}]),Rt([{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"}
7]),Rt([{type:"Float32",name:"offsetX"}]),Rt([{type:"Int16",name:"x"},{type:"Int16",name:"y"}]);const Zc=class jl{constructor(e=null,i=0,n=4096){if(this.batchIndex=i,this.headerBuffer=null,this.propertiesBuffer=null,this.blockIndicesBuffer=null,this.context=e||null,this.propsDwords=n,this.totalBytes=4*this.propsDwords,this.headerData=new Uint32Array(jl.HEADER_DWORDS),this.propertiesData=new Float32Array(this.propsDwords),!jl._blockIndicesTemplate){jl._blockIndicesTemplate=new Uint32Array(this.propsDwords);for(let s=0;s<this.propsDwords;s++)jl._blockIndicesTemplate[s]=s}this.blockIndicesData=new Uint32Array(jl._blockIndicesTemplate),e&&this._initBuffers(e)}_initBuffers(e){const i=e.gl;if(this.totalBytes>e.maxUniformBlockSize)throw new Error(`UBO size ${this.totalBytes} exceeds device limit ${e.maxUniformBlockSize}`);if(this.headerBuffer=i.createBuffer(),!this.headerBuffer)throw new Error("Failed to create header UBO buffer");if(i.bindBuffer(i.UNIFORM_BUFFER,this.headerBuffer),i.bufferData(i.UNIFORM_BUFFER,jl.HEADER_BYTES,i.DYNAMIC_DRAW),this.propertiesBuffer=i.createBuffer(),!this.propertiesBuffer)throw new Error("Failed to create properties UBO buffer");if(i.bindBuffer(i.UNIFORM_BUFFER,this.propertiesBuffer),i.bufferData(i.UNIFORM_BUFFER,this.totalBytes,i.DYNAMIC_DRAW),this.blockIndicesBuffer=i.createBuffer(),!this.blockIndicesBuffer)throw new Error("Failed to create block-indices UBO buffer");i.bindBuffer(i.UNIFORM_BUFFER,this.blockIndicesBuffer),i.bufferData(i.UNIFORM_BUFFER,this.totalBytes,i.DYNAMIC_DRAW),i.bindBuffer(i.UNIFORM_BUFFER,null)}writeHeader(e){const i=this.headerData;i[0]=e.dataDrivenMask,i[1]=e.zoomDependentMask,i[2]=e.dataDrivenBlockSizeVec4,i[3]=e.offsets[0],i[4]=e.offsets[1],i[5]=e.offsets[2],i[6]=e.offsets[3],i[7]=e.offsets[4],i[8]=e.offsets[5],i[9]=e.offsets[6],i[10]=e.offsets[7],i[11]=e.offsets[8]}writeDataDrivenBlock(e,i,n){const s=4*n.dataDrivenBlockSizeVec4;if(s===0)return;const l=i*s;if(l+s>this.propertiesData.length)throw new Error(`UBO write out of bounds: feature index ${i} exceeds propertiesData capacity`);for(let u=0;u<9;u++)n.dataDrivenMask&1<<u&&this._copyFromFlat(l+n.offsets[u],u,e,jl.EVAL_FLAT_OFFSETS[u],n.zoomDependentMask)}static getMaxFeatureCount(e,i=4096){const n=4*e.dataDrivenBlockSizeVec4;return n===0?1/0:Math.floor(i/n)}_copyFromFlat(e,i,n,s,l){const u=this.propertiesData,f=i===8,p=!!(l&1<<i);i<2||f&&p?(u[e]=n[s],u[e+1]=n[s+1],u[e+2]=n[s+2],u[e+3]=n[s+3]):f||p?(u[e]=n[s],u[e+1]=n[s+1]):u[e]=n[s]}upload(e){this.context||(this.context=e);const i=e.gl;this.headerBuffer&&this.propertiesBuffer&&this.blockIndicesBuffer||this._initBuffers(e),i.bindBuffer(i.UNIFORM_BUFFER,this.headerBuffer),i.bufferSubData(i.UNIFORM_BUFFER,0,this.headerData),i.bindBuffer(i.UNIFORM_BUFFER,this.propertiesBuffer),i.bufferSubData(i.UNIFORM_BUFFER,0,this.propertiesData),i.bindBuffer(i.UNIFORM_BUFFER,this.blockIndicesBuffer),i.bufferSubData(i.UNIFORM_BUFFER,0,this.blockIndicesData),i.bindBuffer(i.UNIFORM_BUFFER,null)}bind(e,i){const n=e.gl,s=(u,f,p)=>{if(!f)return;const g=n.getUniformBlockIndex(i,u);g!==n.INVALID_INDEX&&(n.uniformBlockBinding(i,g,p),n.bindBufferBase(n.UNIFORM_BUFFER,p,f))},l=3*this.batchIndex;s("SymbolPaintPropertiesHeaderUniform",this.headerBuffer,l),s("SymbolPaintPropertiesUniform",this.propertiesBuffer,l+1),s("SymbolPaintPropertiesIndexUniform",this.blockIndicesBuffer,l+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)}}};Zc.HEADER_DWORDS=12,Zc.HEADER_BYTES=48,Zc.EVAL_FLAT_OFFSETS=[0,4,8,10,12,14,16,18,20],Zc.EVAL_FLAT_SIZES=[4,4,2,2,2,2,2,2,4],Zc.EVAL_FLAT_TOTAL=24,Zc._blockIndicesTemplate=null;let Ll=Zc;function Iv(r,e,i,n,s,l,u,f){return!!r&&(r.kind==="constant"?r.value==="none":r.kind==="composite"||r.kind==="source"?r.evaluate({zoom:0,brightness:l,worldview:f},e,i,s,n,u)==="none":typeof r=="string"&&r==="none")}et(Ll,"SymbolPropertiesUBO",{omit:["headerBuffer","propertiesBuffer","blockIndicesBuffer"]});class iy{constructor(e,i,n,s,l="",u,f){this.layer=e,this.zoom=i,this.lut=n,this.isText=s,this.propDefs=this._getPropDefs(),this.worldview=l,this.maxUniformBufferBindings=u||24,this.uboSizeDwords=f||4096,this.featureVertexRangesFromId=new Map,this.allFeatures=[],this.ubos=[],this.featureCount=0,this.cachedHeader=null,this.maxFeaturesPerBatch=0,this.propertyHashToUBOIndex=new Map,this.canDeduplicate=this._checkIfAllPropertiesAreConstant(e,s),this.cachedParams=null,this.cachedParamsNext=null,this.cachedBrightness=void 0,this.cachedConstantUniforms=null,this.cachedConstantRenderZoom=null,this.cachedConstantBrightness=void 0,this.activeAppearanceByVtIndex=new Map,this.isLightConstant=!0,this._evalFlat=new Float32Array(Ll.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,i=this.propDefs;let n=0,s=0,l=0,u=0,f=!0;const p=[0,0,0,0,0,0,0,0,0];for(let x=0;x<9;x++){const{name:b,isColor:w,isVec2:S}=i[x],E=e.get(b),M=!(!E||typeof E.isConstant!="function"||E.isConstant()),C=this._appearancesHavePaintProperties(b),R=M||C,F=!(!E||!E.value||E.value.kind!=="composite"),z=this.layer._transitionablePaint._values[b],j=!R&&(z&&z.value&&z.value.expression&&z.value.expression.kind)==="camera";if(R){n|=1<<x,F&&(s|=1<<x);const $=E&&E.value;$&&$.isLightConstant===!1&&(f=!1),w?(u%4!=0&&(u=u+3&-4),p[x]=u,u+=4):S?F?(u%4!=0&&(u=u+3&-4),p[x]=u,u+=4):(u%4==3&&u++,p[x]=u,u+=2):(p[x]=u,u+=F?2:1)}else j&&(l|=1<<x)}const g=(u===0?0:u+3&-4)/4;return this.isLightConstant=f,{dataDrivenMask:n,zoomDependentMask:s,cameraMask:l,dataDrivenBlockSizeVec4:g,offsets:p}}get hasCameraExpression(){return!(!this.cachedHeader||!this.cachedHeader.cameraMask)}evaluateAllProperties(e,i,n,s,l,u,f){const{params:p,paramsNext:g}=this._getCachedParams(l),x={feature:e,featureState:i,canonical:n,availableImages:s,params:p,paramsNext:g,formattedSection:u},b=this.cachedHeader,w=this.propDefs;this._evalFlat||(this._evalFlat=new Float32Array(Ll.EVAL_FLAT_TOTAL));const S=this._evalFlat;for(let E=0;E<9;E++){const{name:M,useThemeName:C,isColor:R,isVec2:F}=w[E],z=!!(b&&b.zoomDependentMask&1<<E),j=Ll.EVAL_FLAT_OFFSETS[E];R?this._evaluateColorValue(M,C,x,l,z,f,S,j):F?this._evaluateTranslateValue(M,z,x,f,S,j):this._evaluateFloatValue(M,z,x,f,S,j)}return S}_evaluateColorValue(e,i,n,s,l,u,f,p){const g=this.layer.paint,x=e,b=u&&u.hasPaintProperty(x)?u.paintProperties.get(x):g.get(e),w=i,S=i&&u&&u.hasPaintProperty(w)?u.paintProperties.get(w):i?g.get(i):void 0;if(!b)return f[p]=0,f[p+1]=0,f[p+2]=0,void(f[p+3]=1);
7const E=Iv(S&&typeof S!="string"?S.value:void 0,n.feature,n.featureState,n.availableImages,n.canonical,s,n.formattedSection,this.worldview)?null:this.lut;let M,C;b.isConstant()?M=C=b.constantOr(qt.transparent):(M=b.property.evaluate(b.value,n.params,n.feature,n.featureState,n.canonical,n.availableImages,b.iconImageUseTheme,n.formattedSection),C=l?b.property.evaluate(b.value,n.paramsNext,n.feature,n.featureState,n.canonical,n.availableImages,b.iconImageUseTheme,n.formattedSection):M);const R=(M||qt.transparent).toNonPremultipliedRenderColor(E);if(f[p]=El(255*R.r,255*R.g),f[p+1]=El(255*R.b,255*R.a),l){const F=(C||qt.transparent).toNonPremultipliedRenderColor(E);f[p+2]=El(255*F.r,255*F.g),f[p+3]=El(255*F.b,255*F.a)}else f[p+2]=0,f[p+3]=0}_evaluateFloatValue(e,i,n,s,l,u){const f=this.layer.paint,p=e.endsWith("opacity")?1:0,g=e,x=s&&s.hasPaintProperty(g)?s.paintProperties.get(g):f.get(e);if(!x)return l[u]=p,void(l[u+1]=0);if(x.isConstant())return l[u]=x.constantOr(p),void(l[u+1]=0);const b=x.property.evaluate(x.value,n.params,n.feature,n.featureState,n.canonical,n.availableImages,x.iconImageUseTheme,n.formattedSection);if(l[u]=b??p,i){const w=x.property.evaluate(x.value,n.paramsNext,n.feature,n.featureState,n.canonical,n.availableImages,x.iconImageUseTheme,n.formattedSection);l[u+1]=w??p}else l[u+1]=0}_evaluateTranslateValue(e,i,n,s,l,u){const f=this.layer.paint,p=e,g=s&&s.hasPaintProperty(p)?s.paintProperties.get(p):f.get(e);if(!g)return l[u]=0,l[u+1]=0,l[u+2]=0,void(l[u+3]=0);if(typeof g.isConstant!="function"){const b=g||[0,0];return l[u]=b[0],l[u+1]=b[1],l[u+2]=0,void(l[u+3]=0)}if(g.isConstant()){const b=g.constantOr([0,0]);return l[u]=b[0],l[u+1]=b[1],l[u+2]=0,void(l[u+3]=0)}const x=g.property.evaluate(g.value,n.params,n.feature,n.featureState,n.canonical,n.availableImages,g.iconImageUseTheme,n.formattedSection)||[0,0];if(l[u]=x[0],l[u+1]=x[1],i){const b=g.property.evaluate(g.value,n.paramsNext,n.feature,n.featureState,n.canonical,n.availableImages,g.iconImageUseTheme,n.formattedSection)||[0,0];l[u+2]=b[0],l[u+3]=b[1]}else l[u+2]=0,l[u+3]=0}_getCachedParams(e){return this.cachedParams&&this.cachedParamsNext&&this.cachedBrightness===e||(this.cachedParams=new Wt(this.zoom,{brightness:e,worldview:this.worldview}),this.cachedParamsNext=new Wt(this.zoom+1,{brightness:e,worldview:this.worldview}),this.cachedBrightness=e),{params:this.cachedParams,paramsNext:this.cachedParamsNext}}_appearancesHavePaintProperties(e){return this.layer.getAppearances().some(e!==void 0?i=>i.hasPaintProperty(e):this.isText?i=>i.hasTextPaintProperties():i=>i.hasIconPaintProperties())}_checkIfAllPropertiesAreConstant(e,i){const n=e.paint,s=i?"text":"icon",l=[`${s}-color`,`${s}-halo-color`,`${s}-opacity`,`${s}-halo-width`,`${s}-halo-blur`,`${s}-emissive-strength`,`${s}-occlusion-opacity`,"symbol-z-offset",`${s}-translate`];for(const u of l){const f=n.get(u);if(f&&typeof f=="object"&&"isConstant"in f&&!f.isConstant())return!1}return!this._appearancesHavePaintProperties()}_hashDataDrivenValues(e,i){if(i.dataDrivenMask===0)return"";const n=[];for(let s=0;s<this.propDefs.length;s++){if(!(i.dataDrivenMask&1<<s))continue;const l=Ll.EVAL_FLAT_OFFSETS[s],u=Ll.EVAL_FLAT_SIZES[s];let f=String(e[l]);for(let p=1;p<u;p++)f+=`,${String(e[l+p])}`;n.push(f)}return n.join("|")}getCurrentBatchIndex(){return this.cachedHeader&&this.maxFeaturesPerBatch!==0?Math.floor(this.featureCount/this.maxFeaturesPerBatch):0}populateUBO(e,i,n,s,l,u,f){const p=e.id;if(!this.cachedHeader){this.cachedHeader=this.buildHeader();const C=Ll.getMaxFeatureCount(this.cachedHeader,this.uboSizeDwords);this.maxFeaturesPerBatch=isFinite(C)?C:Number.MAX_SAFE_INTEGER}const g=this.cachedHeader,x=this.evaluateAllProperties(e,{},n,s,l,u);if(this.canDeduplicate){const C=this._hashDataDrivenValues(x,g),R=this.propertyHashToUBOIndex.get(C);if(R!==void 0){const F=isFinite(this.maxFeaturesPerBatch)?Math.floor(R/this.maxFeaturesPerBatch):0,z=isFinite(this.maxFeaturesPerBatch)?R%this.maxFeaturesPerBatch:R,j={batchIndex:F,localFeatureIndex:z,vtFeatureIndex:i,featureId:p};return this.allFeatures.push(j),p!=null&&(this.featureVertexRangesFromId.has(p
7)||this.featureVertexRangesFromId.set(p,[]),this.featureVertexRangesFromId.get(p).push(j)),z}this.propertyHashToUBOIndex.set(C,this.featureCount)}const b=this.featureCount++,w=isFinite(this.maxFeaturesPerBatch)?Math.floor(b/this.maxFeaturesPerBatch):0,S=isFinite(this.maxFeaturesPerBatch)?b%this.maxFeaturesPerBatch:b,E=f?f.maxUniformBufferBindings:this.maxUniformBufferBindings;if(3*w+2>=E){Pt(`Too many symbol features: batch ${w} requires binding points up to ${3*w+2}, device limit ${E}. Some features will render incorrectly.`);const C={batchIndex:0,localFeatureIndex:0,vtFeatureIndex:i,featureId:p};return this.allFeatures.push(C),p!=null&&(this.featureVertexRangesFromId.has(p)||this.featureVertexRangesFromId.set(p,[]),this.featureVertexRangesFromId.get(p).push(C)),0}this.ubos[w]||(this.ubos[w]=new Ll(f,w,this.uboSizeDwords),this.ubos[w].writeHeader(g)),this.ubos[w].writeDataDrivenBlock(x,S,g);const M={batchIndex:w,localFeatureIndex:S,vtFeatureIndex:i,featureId:p};return this.allFeatures.push(M),p!=null&&(this.featureVertexRangesFromId.has(p)||this.featureVertexRangesFromId.set(p,[]),this.featureVertexRangesFromId.get(p).push(M)),S}updateFeatures(e,i,n,s,l,u,f){if(this.layer=i,this.cachedConstantUniforms=null,!this.cachedHeader)return;const p=this.cachedHeader;for(const g of e){const x=this.featureVertexRangesFromId.get(g);if(!x)continue;const b=u[g]||{};for(const w of x){if(!n)continue;const S=n.feature(w.vtFeatureIndex);if(!S)continue;const E={type:S.type,id:g,properties:S.properties||{},geometry:[]},M=this.activeAppearanceByVtIndex?this.activeAppearanceByVtIndex.get(w.vtFeatureIndex):void 0,C=this.evaluateAllProperties(E,b,s,l,f,void 0,M);this.ubos[w.batchIndex]&&this.ubos[w.batchIndex].writeDataDrivenBlock(C,w.localFeatureIndex,p)}}}updateDynamicExpressions(e,i,n,s,l,u){if(this.layer=e,this.cachedConstantUniforms=null,!this.cachedHeader||this.cachedHeader.dataDrivenMask===0)return;const f=this.cachedHeader;for(const p of this.allFeatures){if(!i)continue;const g=i.feature(p.vtFeatureIndex);if(!g)continue;const x=p.featureId!=null&&l[p.featureId]||{},b={type:g.type,id:p.featureId,properties:g.properties||{},geometry:[]},w=this.activeAppearanceByVtIndex?this.activeAppearanceByVtIndex.get(p.vtFeatureIndex):void 0,S=this.evaluateAllProperties(b,x,n,s,u,void 0,w);this.ubos[p.batchIndex]&&this.ubos[p.batchIndex].writeDataDrivenBlock(S,p.localFeatureIndex,f)}}updateFeaturePaintForAppearance(e,i,n,s,l,u,f){if(!this.layer||(this.activeAppearanceByVtIndex||(this.activeAppearanceByVtIndex=new Map),this.activeAppearanceByVtIndex.set(e,f||null),!this.cachedHeader))return!1;const p=this.cachedHeader;if(p.dataDrivenMask===0)return!1;let g=!1;for(const x of this.allFeatures){if(x.vtFeatureIndex!==e)continue;const b=this.evaluateAllProperties(i,n,s,l,u,void 0,f);this.ubos[x.batchIndex]&&(this.ubos[x.batchIndex].writeDataDrivenBlock(b,x.localFeatureIndex,p),g=!0)}return g}getConstantUniformValues(e,i){const n=this.cachedHeader,s=!(!n||!n.cameraMask);if(this.cachedConstantUniforms&&this.cachedConstantBrightness===i&&(!s||this.cachedConstantRenderZoom===e))return this.cachedConstantUniforms;const l=this.layer.paint,u=this.propDefs,f=s?new Wt(e,{brightness:i,worldview:this.worldview}):null,p={type:1,id:void 0,properties:{},geometry:[]},g=w=>{const S=u[w],E=l.get(S.name);if(!E)return[0,0,0,1];const M=S.useThemeName?l.get(S.useThemeName):void 0,C=Iv(M&&typeof M!="string"?M.value:void 0,p,{},[],void 0,i,void 0,this.worldview)?null:this.lut;let R;R=n&&n.cameraMask&1<<w&&f?E.property.evaluate(E.value,f,p,{},void 0,[]):E.constantOr(qt.transparent);const F=(R||qt.transparent).toNonPremultipliedRenderColor(C);return[F.r,F.g,F.b,F.a]},x=(w,S)=>{const E=l.get(u[w].name);if(!E)return S;if(n&&n.cameraMask&1<<w&&f){const M=E.property.evaluate(E.value,f,p,{},void 0,[]);return M??S}return E.constantOr(S)},b={fill_np_color:g(0),halo_np_color:g(1),opacity:x(2,1),halo_width:x(3,0),halo_blur:x(4,0),emissive_strength:x(5,0),occlusion_opacity:x(6,1),z_offset:x(7,0)};return this.cachedConstantUniforms=b,this.cachedConstantRenderZoom=e,this.cachedConstantBrightness=i,b}upload(e){for(const i of this.ubos)i.upload(e)}bind(e,i,n=0){this.ubos[n]&&this.ubos[n].bind(e,i)}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()}}et(iy,"SymbolPropertyBinderUBO",{omit:["layer","cachedParams","cachedParamsNext","cachedBrightness","propertyHashToUBOIndex","cachedConstantUniforms","cachedConstantRenderZoom","cachedConstantBrightness","activeAppearanceByVtIndex","_evalFlat"]});var dr=24;function sw(r,e,i){return r.sections.forEach(n=>
vendor: 10,312 bytes, line 7
7{n.text=(function(s,l,u){const f=l.layout.get("text-transform").evaluate(u,{});return f==="uppercase"?s=s.toLocaleUpperCase():f==="lowercase"&&(s=s.toLocaleLowerCase()),ao.applyArabicShaping&&(s=ao.applyArabicShaping(s)),s})(n.text,e,i)}),r}const If={"!":"ï¸","#":"ï¼",$:"ï¼","%":"ï¼
","&":"ï¼","(":"︵",")":"︶","*":"ï¼","+":"ï¼",",":"ï¸","-":"︲",".":"ã»","/":"ï¼",":":"ï¸",";":"ï¸","<":"︿","=":"ï¼",">":"ï¹","?":"ï¸","@":"ï¼ ","[":"ï¹","\\":"ï¼¼","]":"ï¹","^":"ï¼¾",_:"︳","`":"ï½","{":"︷","|":"â","}":"︸","~":"ï½","¢":"ï¿ ","£":"ï¿¡","Â¥":"ï¿¥","¦":"¦","¬":"ï¿¢","¯":"ï¿£","â":"︲","â":"︱","â":"ï¹","â":"ï¹","â":"ï¹","â":"ï¹","â¦":"ï¸","â§":"ã»","â©":"₩","ã":"ï¸","ã":"ï¸","ã":"︿","ã":"ï¹","ã":"︽","ã":"︾","ã":"ï¹","ã":"ï¹","ã":"ï¹","ã":"ï¹","ã":"︻","ã":"︼","ã":"︹","ã":"︺","ã":"ï¸","ã":"ï¸","ï¼":"ï¸","ï¼":"︵","ï¼":"︶","ï¼":"ï¸","ï¼":"︲","ï¼":"ã»","ï¼":"ï¸","ï¼":"ï¸","ï¼":"︿","ï¼":"ï¹","ï¼":"ï¸","ï¼»":"ï¹","ï¼½":"ï¹","_":"︳","ï½":"︷","ï½":"â","ï½":"︸","ï½":"︵","ï½ ":"︶","。":"ï¸","ï½¢":"ï¹","ï½£":"ï¹","â":"â","â":"â"};function aw(r){return r==="︶"||r==="ï¹"||r==="︸"||r==="ï¹"||r==="ï¹"||r==="︾"||r==="︼"||r==="︺"||r==="ï¸"||r==="ï¹"||r==="ï¸"||r==="ï¸"||r==="ï¸"||r==="ï½"||r==="ï¿£"||r==="ï¸"||r==="ï¸"}function lw(r){return r==="︵"||r==="ï¹"||r==="︷"||r==="ï¹"||r==="ï¹"||r==="︽"||r==="︻"||r==="︹"||r==="ï¸"||r==="︿"}const ry=4294967296,Ev=1/ry,Av=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");let a_=class{constructor(r=new Uint8Array(16)){this.buf=ArrayBuffer.isView(r)?r:new Uint8Array(r),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(r,e,i=this.length){for(;this.pos<i;){const n=this.readVarint(),s=n>>3,l=this.pos;this.type=7&n,r(s,e,this),this.pos===l&&this.skip(n)}return e}readMessage(r,e){return this.readFields(r,e,this.readVarint()+this.pos)}readFixed32(){const r=this.dataView.getUint32(this.pos,!0);return this.pos+=4,r}readSFixed32(){const r=this.dataView.getInt32(this.pos,!0);return this.pos+=4,r}readFixed64(){const r=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*ry;return this.pos+=8,r}readSFixed64(){const r=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*ry;return this.pos+=8,r}readFloat(){const r=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,r}readDouble(){const r=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,r}readVarint(r){const e=this.buf;let i,n;return n=e[this.pos++],i=127&n,n<128?i:(n=e[this.pos++],i|=(127&n)<<7,n<128?i:(n=e[this.pos++],i|=(127&n)<<14,n<128?i:(n=e[this.pos++],i|=(127&n)<<21,n<128?i:(n=e[this.pos],i|=(15&n)<<28,(function(s,l,u){const f=u.buf;let p,g;if(g=f[u.pos++],p=(112&g)>>4,g<128||(g=f[u.pos++],p|=(127&g)<<3,g<128)||(g=f[u.pos++],p|=(127&g)<<10,g<128)||(g=f[u.pos++],p|=(127&g)<<17,g<128)||(g=f[u.pos++],p|=(127&g)<<24,g<128)||(g=f[u.pos++],p|=(1&g)<<31,g<128))return mh(s,p,l);throw new Error("Expected varint not more than 10 bytes")})(i,r,this)))))}readVarint64(){return this.readVarint(!0)}readSVarint(){const r=this.readVarint();return r%2==1?(r+1)/-2:r/2}readBoolean(){return!!this.readVarint()}readString(){const r=this.readVarint()+this.pos,e=this.pos;return this.pos=r,r-e>=12&&Av?Av.decode(this.buf.subarray(e,r)):(function(i,n,s){let l="",u=n;for(;u<s;){const f=i[u];let p,g,x,b=null,w=f>239?4:f>223?3:f>191?2:1;if(u+w>s)break;w===1?f<128&&(b=f):w===2?(p=i[u+1],(192&p)==128&&(b=(31&f)<<6|63&p,b<=127&&(b=null))):w===3?(p=i[u+1],g=i[u+2],(192&p)==128&&(192&g)==128&&(b=(15&f)<<12|(63&p)<<6|63&g,(b<=2047||b>=55296&&b<=57343)&&(b=null))):w===4&&(p=i[u+1],g=i[u+2],x=i[u+3],(192&p)==128&&(192&g)==128&&(192&x)==128&&(b=(15&f)<<18|(63&p)<<12|(63&g)<<6|63&x,(b<=65535||b>=1114112)&&(b=null))),b===null?(b=65533,w=1):b>65535&&(b-=65536,l+=String.fromCharCode(b>>>10&1023|55296),b=56320|1023&b),l+=String.fromCharCode(b),u+=w}return l})(this.buf,e,r)}readBytes(){const r=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,r);return this.pos=r,e}readPackedVarint(r=[],e){const i=this.readPackedEnd();for(;this.pos<i;)r.push(this.readVarint(e));return r}readPackedSVarint(r=[]){const e=this.readPackedEnd();for(;this.pos<e;)r.push(this.readSVarint());return r}readPackedBoolean(r=[]){const e=this.readPackedEnd();for(;this.pos<e;)r.push(this.readBoolean());return r}readPackedFloat(r=[]){const e=this.readPackedEnd();for(;this.pos<e;)r.push(this.readFloat());return r}readPackedDouble(r=[]){const e=this.readPackedEnd();for(;this.pos<e;)r.push(this.readDouble());return r}readPackedFixed32(r=[]){const e=this.readPackedEnd();for(;this.pos<e;)r.push(this.readFixed32());return r}readPackedSFixed32(r=[]){const e=this.readPackedEnd();for(;this.pos<e;)r.push(this.readSFixed32());return r}readPackedFixed64(r=[]){const e=this.readPackedEnd();for(;this.pos<e;)r.push(this.readFixed64());return r}readPackedSFixed64(r=[]){const e=this.readPackedEnd();for(;this.pos<e;)r.push(this.readSFixed64());return r}readPackedEnd(){return this.type===2?this.readVarint()+this.pos:this.pos+1}skip(r){const e=7&r;if(e===0)for(;this.buf[this.pos++]>127;);else if(e===2)this.pos=this.readVarint()+this.pos;else if(e===5)this.pos+=4;else{if(e!==1)throw new Error(`Unimplemented type: ${e}`);this.pos+=8}}writeTag(r,e){this.writeVarint(r<<3|e)}realloc(r){let e=this.length||16;for(;e<this.pos+r;)e*=2;if(e!==this.length){const i=new Uint8Array(e);i.set(this.buf),this.buf=i,this.dataView=new DataView(i.buffer),this.length=e}}finish(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)}writeFixed32(r){this.realloc(4),this.dataView.setInt32(this.pos,r,!0),this.pos+=4}writeSFixed32(r){this.realloc(4),this.dataView.setInt32(this.pos,r,!0),this.pos+=4}writeFixed64(r){this.realloc(8),this.dataView.setInt32(this.pos,-1&r,!0),this.dataView.setInt32(this.pos+4,Math.floor(r*Ev),!0),this.pos+=8}writeSFixed64(r){this.realloc(8),this.dataView.setInt32(this.pos,-1&r,!0),this.dataView.setInt32(this.pos+4,Math.floor(r*Ev),!0),this.pos+=8}writeVarint(r){(r=+r||0)>268435455||r<0?(function(e,i){let n,s;if(e>=0?(n=e%4294967296|0,s=e/4294967296|0):(n=~(-e%4294967296),s=~(-e/4294967296),4294967295^n?n=n+1|0:(n=0,s=s+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");i.realloc(10),(function(l,u,f){f.buf[f.pos++]=127&l|128,l>>>=7,f.buf[f.pos++]=127&l|128,l>>>=7,f.buf[f.pos++]=127&l|128,l>>>=7,f.buf[f.pos++]=127&l|128,f.buf[f.pos]=127&(l>>>=7)})(n,0,i),(function(l,u){const f=(7&l)<<4;u.buf[u.pos++]|=f|((l>>>=3)?128:0),l&&(u.buf[u.pos++]=127&l|((l>>>=7)?128:0),l&&(u.buf[u.pos++]=127&l|((l>>>=7)?128:0),l&&(u.buf[u.pos++]=127&l|((l>>>=7)?128:0),l&&(u.buf[u.pos++]=127&l|((l>>>=7)?128:0),l&&(u.buf[u.pos++]=127&l)))))})(s,i)})(r,this):(this.realloc(4),this.buf[this.pos++]=127&r|(r>127?128:0),r<=127||(this.buf[this.pos++]=127&(r>>>=7)|(r>127?128:0),r<=127||(this.buf[this.pos++]=127&(r>>>=7)|(r>127?128:0),r<=127||(this.buf[this.pos++]=r>>>7&127))))}writeSVarint(r){this.writeVarint(r<0?2*-r-1:2*r)}writeBoolean(r){this.writeVarint(+r)}writeString(r){r=String(r),this.realloc(4*r.length),this.pos++;const e=this.pos;this.pos=(function(n,s,l){for(let u,f,p=0;p<s.length;p++){if(u=s.charCodeAt(p),u>55295&&u<57344){if(!f){u>56319||p+1===s.length?(n[l++]=239,n[l++]=191,n[l++]=189):f=u;continue}if(u<56320){n[l++]=239,n[l++]=191,n[l++]=189,f=u;continue}u=f-55296<<10|u-56320|65536,f=null}else f&&(n[l++]=239,n[l++]=191,n[l++]=189,f=null);u<128?n[l++]=u:(u<2048?n[l++]=u>>6|192:(u<65536?n[l++]=u>>12|224:(n[l++]=u>>18|240,n[l++]=u>>12&63|128),n[l++]=u>>6&63|128),n[l++]=63&u|128)}return l})(this.buf,r,this.pos);const i=this.pos-e;i>=128&&Mv(e,i,this),this.pos=e-1,this.writeVarint(i),this.pos+=i}writeFloat(r){this.realloc(4),this.dataView.setFloat32(this.pos,r,!0),this.pos+=4}writeDouble(r){this.realloc(8),this.dataView.setFloat64(this.pos,r,!0),this.pos+=8}writeBytes(r){const e=r.length;this.writeVarint(e),this.realloc(e);for(let i=0;i<e;i++)this.buf[this.pos++]=r[i]}writeRawMessage(r,e){this.pos++;const i=this.pos;r(e,this);const n=this.pos-i;n>=128&&Mv(i,n,this),this.pos=i-1,this.writeVarint(n),this.pos+=n}writeMessage(r,e,i){this.writeTag(r,2),this.writeRawMessage(e,i)}writePackedVarint(r,e){e.length&&this.writeMessage(r,cw,e)}writePackedSVarint(r,e){e.length&&this.writeMessage(r,uw,e)}writePackedBoolean(r,e){e.length&&this.writeMessage(r,fw,e)}writePackedFloat(r,e){e.length&&this.writeMessage(r,hw,e)}writePackedDouble(r,e){e.length&&this.writeMessage(r,dw,e)}writePackedFixed32(r,e){e.length&&this.writeMessage(r,pw,e)}writePackedSFixed32(r,e){e.length&&this.writeMessage(r,mw,e)}writePackedFixed64(r,e){e.length&&this.writeMessage(r,_w,e)}writePackedSFixed64(r,e){e.length&&this.writeMessage(r,gw,e)}writeBytesField(r,e){this.writeTag(r,2),this.writeBytes(e)}writeFixed32Field(r,e){this.writeTag(r,5),this.writeFixed32(e)}writeSFixed32Field(r,e){this.writeTag(r,5),this.writeSFixed32(e)}writeFixed64Field(r,e){this.writeTag(r,1),this.writeFixed64(e)}writeSFixed64Field(r,e){this.writeTag(r,1),this.writeSFixed64(e)}writeVarintField(r,e){this.writeTag(r,0),this.writeVarint(e)}writeSVarintField(r,e){this.writeTag(r,0),this.writeSVarint(e)}writeStringField(r,e){this.writeTag(r,2),this.writeString(e)}writeFloatField(r,e){this.writeTag(r,5),this.writeFloat(e)}writeDoubleField(r,e){this.writeTag(r,1),this.writeDouble(e)}writeBooleanField(r,e){this.writeVarintField(r,+e)}};function mh(r,e,i){return i?4294967296*e+(r>>>0):4294967296*(e>>>0)+(r>>>0)}function Mv(r,e,i){const n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));i.realloc(n);for(let s=i.pos-1;s>=r;s--)i.buf[s+n]=i.buf[s]}function cw(r,e){for(let i=0;i<r.length;i++)e.writeVarint(r[i])}function uw(r,e){for(let i=0;i<r.length;i++)e.writeSVarint(r[i])}function hw(r,e){for(let i=0;i<r.length;i++)e.writeFloat(r[i])}function dw(r,e){for(let i=0;i<r.length;i++)e.writeDouble(r[i])}function fw(r,e){for(let i=0;i<r.length;i++)e.writeBoolean(r[i])}function pw(r,e){for(let i=0;i<r.length;i++)e.writeFixed32(r[i])}function mw(r,e){for(let i=0;i<r.length;i++)e.writeSFixed32(r[i])}function _w(r,e){for(let i=0;i<r.length;
vendor: 39,236 bytes, line 7
7i++)e.writeFixed64(r[i])}function gw(r,e){for(let i=0;i<r.length;i++)e.writeSFixed64(r[i])}function yw(r,e,i){e.glyphs=[],r===1&&i.readMessage(xw,e)}function xw(r,e,i){if(r===3){const{id:n,bitmap:s,width:l,height:u,left:f,top:p,advance:g}=i.readMessage(vw,{});e.glyphs.push({id:n,bitmap:new Fr({width:l+6,height:u+6},s),metrics:{width:l,height:u,left:f,top:p,advance:g}})}else r===4?e.ascender=i.readSVarint():r===5&&(e.descender=i.readSVarint())}function vw(r,e,i){r===1?e.id=i.readVarint():r===2?e.bitmap=i.readBytes():r===3?e.width=i.readVarint():r===4?e.height=i.readVarint():r===5?e.left=i.readSVarint():r===6?e.top=i.readSVarint():r===7&&(e.advance=i.readVarint())}const zn={horizontal:1,vertical:2,horizontalOnly:3};class Ef{constructor(){this.scale=1,this.fontStack="",this.image=null}static forText(e,i){const n=new Ef;return n.scale=e||1,n.fontStack=i,n}static forImage(e){const i=new Ef;return i.image=e,i}}class _h{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(e,i,n,s=1){const l=new _h;for(let u=0;u<e.sections.length;u++){const f=e.sections[u];f.image?l.addImageSection(f,n,s):l.addTextSection(f,i)}return l}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(i,n){let s="";for(let l=0;l<i.length;l++){const u=i.charCodeAt(l+1)||null,f=i.charCodeAt(l-1)||null;s+=!n&&(u&&$u(u)&&!If[i[l+1]]||f&&$u(f)&&!If[i[l-1]])||!If[i[l]]?i[l]:If[i[l]]}return s})(this.text,e)}trim(){let e=0;for(let n=0;n<this.text.length&&l_[this.text.charCodeAt(n)];n++)e++;let i=this.text.length;for(let n=this.text.length-1;n>=0&&n>=e&&l_[this.text.charCodeAt(n)];n--)i--;this.text=this.text.substring(e,i),this.sectionIndex=this.sectionIndex.slice(e,i)}substring(e,i){const n=new _h;return n.text=this.text.substring(e,i),n.sectionIndex=this.sectionIndex.slice(e,i),n.sections=this.sections,n}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((e,i)=>Math.max(e,this.sections[i].scale),0)}addTextSection(e,i){this.text+=e.text,this.sections.push(Ef.forText(e.scale,e.fontStack||i));const n=this.sections.length-1;for(let s=0;s<e.text.length;++s)this.sectionIndex.push(n)}addImageSection(e,i,n=1){const s=e.image?e.image.getPrimary():null;if(!s)return void Pt("Can't add FormattedSection with an empty image.");s.scaleSelf(i*n);const l=this.getNextImageSectionCharCode();l?(this.text+=String.fromCodePoint(l),this.sections.push(Ef.forImage(s)),this.sectionIndex.push(this.sections.length-1)):Pt("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function ny(r,e,i,n,s,l,u,f,p,g,x,b,w,S,E,M=1,C=1){const R=_h.fromFeature(r,s,M,C);b===zn.vertical&&R.verticalizePunctuation(w);let F=[];const z=(function(W,Q,Y,ee,me,ge,Te=1){if(!W)return[];const Ae=[],Ie=(function(Se,Me,ze,Le,We,De,Ge=1){let $e=0;for(let Je=0;Je<Se.length();Je++){const Qe=Se.getSection(Je);$e+=Cv(Se.getCodePoint(Je),Qe,Le,We,Me,De,Ge)}return $e/Math.max(1,Math.ceil($e/ze))})(W,Q,Y,ee,me,ge,Te),Fe=W.text.includes("â");let xe=0;for(let Se=0;Se<W.length();Se++){const Me=W.getSection(Se),ze=W.getCodePoint(Se);if(l_[ze]||(xe+=Cv(ze,Me,ee,me,Q,ge,Te)),Se<W.length()-1){const Le=Yp(ze);(bw[ze]||Le||Me.image)&&Ae.push(Dv(Se+1,xe,Ie,Ae,ww(ze,W.getCodePoint(Se+1),Le&&Fe),!1))}}return Rv(Dv(W.length(),xe,Ie,Ae,0,!0))})(R,g,l,e,n,S,C),{processBidirectionalText:j,processStyledBidirectionalText:$}=ao;if(j&&R.sections.length===1){const W=j(R.toString(),z);for(const Q of W){const Y=new _h;Y.text=Q,Y.sections=R.sections;for(let ee=0;ee<Q.length;ee++)Y.sectionIndex.push(0);F.push(Y)}}else if($){const W=$(R.text,R.sectionIndex,z);for(const Q of W){const Y=new _h;Y.text=Q[0],Y.sectionIndex=Q[1],Y.sections=R.sections,F.push(Y)}}else F=(function(W,Q){const Y=[],ee=W.text;let me=0;for(const ge of Q)Y.push(W.substring(me,ge)),me=ge;return me<ee.length&&Y.push(W.substring(me,ee.length)),Y})(R,z);const q=[],ie={positionedLines:q,text:R.toString(),top:x[1],bottom:x[1],left:x[0],right:x[0],writingMode:b,iconsInText:!1,verticalizable:!1,hasBaseline:!1};if((function(W,Q,Y,ee,me,ge,Te,Ae,Ie,Fe,xe,Se,Me=1){let ze=0,Le=0,We=0;const De=Ae==="right"?1:Ae==="left"?0:.5;let Ge=!1;for(const nt of me){const mt=nt.getSections();for(const Gt of mt){if(Gt.image)continue;const wt=Q[Gt.fontStack];if(wt&&(Ge=wt.ascender!==void 0&&wt.descender!==void 0,!Ge))break}if(!Ge)break}let $e=0;for(const nt of me){nt.trim();const mt=nt.getMaxScale(),Gt=(mt-1)*dr,wt={positionedGlyphs:[],lineOffset:0};W.positionedLines[$e]=wt;const kt=wt.positionedGlyphs;let Mt=0;if(!nt.length()){Le+=ge,++$e;continue}let Oi=0,Yt=0;for(let ci=0;ci<nt.length();ci++){const Si=nt.getSection(ci),fr=nt.getSectionIndex(ci),mi=nt.getCodePoint(ci);let Fi=Si.scale,ir=null,Qi=null,rr=null,zt=dr,Er=0,Qr=Ie;Qr===zn.vertical&&Ed(mi)&&(Qr=zn.horizontal);const Wi=!(Qr===zn.horizontal||!xe&&!Gu(mi)||xe&&(l_[mi]||Jp(mi)));if(Si.image){const gr=ee.get(Si.image.toString());if(!gr)continue;rr=Si.image,W.iconsInText=W.iconsInText||!0,Qi=gr.paddedRect;const $r=gr.displaySize,Ar=$r[0]*Me,Mi=$r[1]*Me;Fi=Fi*dr/Se,ir={width:Ar,height:Mi,left:0,top:-3,advance:Wi?Mi:Ar,localGlyph:!1},Er=Ge?-ir.height*Fi:mt*dr-17-Mi*Fi,zt=ir.advance;const lr=(Wi?Ar:Mi)*Fi-dr*mt;lr>0&&lr>Mt&&(Mt=lr)}else{const gr=Y[Si.fontStack];if(!gr)continue;gr[mi]&&(Qi=gr[mi]);const $r=Q[Si.fontStack];if(!$r)continue;const Ar=$r.glyphs[mi];if(!Ar)continue;if(ir=Ar.metrics,zt=mi!==8203?dr:0,Ge){const Mi=$r.ascender!==void 0?Math.abs($r.ascender):0,lr=$r.descender!==void 0?Math.abs($r.descender):0,vn=(Mi+lr)*Fi;Oi<vn&&(Oi=vn,Yt=(Mi-lr)/2*Fi),Er=-Mi*Fi}else Er=(mt-Fi)*dr-17}Wi?(W.verticalizable=!0,kt.push({glyph:mi,image:rr,x:ze,y:Le+Er,vertical:Wi,scale:Fi,localGlyph:ir.localGlyph,fontStack:Si.fontStack,sectionIndex:fr,metrics:ir,rect:Qi}),ze+=zt*Fi+Fe):(kt.push({glyph:mi,image:rr,x:ze,y:Le+Er,vertical:Wi,scale:Fi,localGlyph:ir.localGlyph,fontStack:Si.fontStack,sectionIndex:fr,metrics:ir,rect:Qi}),ze+=ir.advance*Fi+Fe)}kt.length!==0&&(We=Math.max(ze-Fe,We),Ge?zv(kt,De,Mt,Yt,ge*mt/2):zv(kt,De,Mt,0,ge/2)),ze=0;const jt=ge*mt+Mt;wt.lineOffset=Math.max(Mt,Gt),Le+=jt,++$e}const Je=Le,{horizontalAlign:Qe,verticalAlign:ct}=oy(Te);(function(nt,mt,Gt,wt,kt,Mt){const Oi=(mt-Gt)*kt,Yt=-Mt*wt;for(const jt of nt)for(const ci of jt.positionedGlyphs)ci.x+=Oi,ci.y+=Yt})(W.positionedLines,De,Qe,ct,We,Je),W.top+=-ct*Je,W.bottom=W.top+Je,W.left+=-Qe*We,W.right=W.left+We,W.hasBaseline=Ge})(ie,e,i,n,F,u,f,p,b,g,w,E,C),!(function(W){for(const Q of W)if(Q.positionedGlyphs.length!==0)return!1;return!0})(q))return ie}const l_={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},bw={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 Cv(r,e,i,n,s,l,u=1){if(e.image){const f=n.get(e.image.toString());return f?f.displaySize[0]*u*e.scale*dr/l+s:0}{const f=i[e.fontStack],p=f&&f.glyphs[r];return p?p.metrics.advance*e.scale+s:0}}function Pv(r,e,i,n){const s=Math.pow(r-e,2);return n?r<e?s/2:2*s:s+Math.abs(i)*i}function ww(r,e,i){let n=0;return r===10&&(n-=1e4),i&&(n+=150),r!==40&&r!==65288||(n+=50),e!==41&&e!==65289||(n+=50),n}function Dv(r,e,i,n,s,l){let u=null,f=Pv(e,i,s,l);for(const p of n){const g=Pv(e-p.x,i,s,l)+p.badness;g<=f&&(u=p,f=g)}return{index:r,x:e,priorBreak:u,badness:f}}function Rv(r){return r?Rv(r.priorBreak).concat(r.index):[]}function oy(r){let e=.5,i=.5;switch(r){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0}switch(r){case"bottom":case"bottom-right":case"bottom-left":i=1;break;case"top":case"top-right":case"top-left":i=0}return{horizontalAlign:e,verticalAlign:i}}function zv(r,e,i,n,s){if(!(e||i||n||s))return;const l=r.length-1,u=r[l],f=(u.x+u.metrics.advance*u.scale)*e;for(let p=0;p<=l;p++)r[p].x-=f,r[p].y+=i+n+s}function sy(r){return r.imagePrimary!==void 0&&r.top!==void 0&&r.bottom!==void 0&&r.left!==void 0&&r.right!==void 0}function c_(r,e,i,n){const{horizontalAlign:s,verticalAlign:l}=oy(n),u=i[0]-r.displaySize[0]*s,f=i[1]-r.displaySize[1]*l;return{imagePrimary:r,imageSecondary:e,top:f,bottom:f+r.displaySize[1],left:u,right:u+r.displaySize[0]}}function ay(r,e,i,n,s,l){const u=r.imagePrimary;let f;if(u.content){const C=u.content,R=u.pixelRatio||1;f=[C[0]/R,C[1]/R,u.displaySize[0]-C[2]/R,u.displaySize[1]-C[3]/R]}const p=e.left*l,g=e.right*l;let x,b,w,S;i==="width"||i==="both"?(S=s[0]+p-n[3],b=s[0]+g+n[1]):(S=s[0]+(p+g-u.displaySize[0])/2,b=S+u.displaySize[0]);const E=e.top*l,M=e.bottom*l;return i==="height"||i==="both"?(x=s[1]+E-n[0],w=s[1]+M+n[2]):(x=s[1]+(E+M-u.displaySize[1])/2,w=x+u.displaySize[1]),{imagePrimary:u,imageSecondary:void 0,top:x,right:b,bottom:w,left:S,collisionPadding:f}}function Lv(r){return!r.imagePrimary.stretchX}function Ov(r){return!r.imagePrimary.stretchY}function Fv(r){return{width:r.right-r.left,height:r.bottom-r.top}}const Fa=128;function Wc(r,e,i,n){const{expression:s}=e;if(s.kind==="constant")return{kind:"constant",layoutSize:s.evaluate(new Wt(r+1,{worldview:i}),void 0,void 0,void 0,n)};if(s.kind==="source")return{kind:"source"};{const{zoomStops:l,interpolationType:u}=s;let f=0;for(;f<l.length&&l[f]<=r;)f++;f=Math.max(0,f-1);let p=f;for(;p<l.length&&l[p]<r+1;)p++;p=Math.min(l.length-1,p);const g=l[f],x=l[p];return s.kind==="composite"?{kind:"composite",minZoom:g,maxZoom:x,interpolationType:u}:{kind:"camera",minZoom:g,maxZoom:x,minSize:s.evaluate(new Wt(g,{worldview:i}),void 0,void 0,void 0,n),maxSize:s.evaluate(new Wt(x,{worldview:i}),void 0,void 0,void 0,n),interpolationType:u}}}function ly(r,{uSize:e,uSizeT:i},{lowerSize:n,upperSize:s}){return r.kind==="source"?n/Fa:r.kind==="composite"?ft(n/Fa,s/Fa,i):e}function gh(r,e,i=1){let n=0,s=0;if(r.kind==="constant")s=r.layoutSize*i;else if(r.kind!=="source"){const{interpolationType:l,minZoom:u,maxZoom:f}=r,p=l?re(fn.interpolationFactor(l,e,u,f),0,1):0;r.kind==="camera"?s=ft(r.minSize,r.maxSize,p)*i:n=p*i}return{uSizeT:n,uSize:s}}class Ba extends Ue{constructor(e,i,n,s,l){super(e,i),this.angle=s,this.z=n,l!==void 0&&(this.segment=l)}clone(){return new Ba(this.x,this.y,this.z,this.angle,this.segment)}}function Bv(r,e,i,n,s){if(e.segment===void 0)return!0;let l=e,u=e.segment+1,f=0;for(;f>-i/2;){if(u--,u<0)return!1;f-=r[u].dist(l),l=r[u]}f+=r[u].dist(r[u+1]),u++;const p=[];let g=0;for(;f<i/2;){const x=r[u],b=r[u+1];if(!b)return!1;let w=r[u-1].angleTo(x)-x.angleTo(b);for(w=Math.abs((w+3*Math.PI)%(2*Math.PI)-Math.PI),p.push({distance:f,angleDelta:w}),g+=w;f-p[0].distance>n;)g-=p.shift().angleDelta;if(g>s)return!1;u++,f+=x.dist(b)}return!0}function kv(r){let e=0;for(let i=0;i<r.length-1;i++)e+=r[i].dist(r[i+1]);return e}function Nv(r,e,i){return r?.6*e*i:0}function Uv(r,e){return Math.max(r?r.right-r.left:0,e?e.right-e.left:0)}function Tw(r,e,i,n,s,l){const u=Nv(i,s,l),f=Uv(i,n)*l;let p=0;const g=kv(r)/2;for(let x=0;x<r.length-1;x++){const b=r[x],w=r[x+1],S=b.dist(w);if(p+S>g){const E=(g-p)/S,M=ft(b.x,w.x,E),C=ft(b.y,w.y,E),R=new Ba(M,C,0,w.angleTo(b),x);return!u||Bv(r,R,f,u,e)?R:void 0}p+=S}}function Sw(r,e,i,n,s,l,u,f,p){const g=Nv(n,l,u),x=Uv(n,s),b=x*u,w=r[0].x===0||r[0].x===p||r[0].y===0||r[0].y===p;return e-b<e/4&&(e=b+e/4),Vv(r,w?e/2*f%e:(x/2+2*l)*u*f%e,e,g,i,b,w,!1,p)}function Vv(r,e,i,n,s,l,u,f,p){const g=l/2,x=kv(r);let b=0,w=e-i,S=[];for(let E=0;E<r.length-1;E++){const M=r[E],C=r[E+1],R=M.dist(C),F=C.angleTo(M);for(;w+i<b+R;){w+=i;const z=(w-b)/R,j=ft(M.x,C.x,z),$=ft(M.y,C.y,z);if(j>=0&&j<p&&$>=0&&$<p&&w-g>=0&&w+g<=x){const q=new Ba(j,$,0,F,E);n&&!Bv(r,q,l,n,s)||S.push(q)}}b+=R}return f||S.length||u||(S=Vv(r,b/2,i,n,s,l,u,!0,p)),S}function jv(r){let e=0,i=0;for(const u of r)e+=u.w*u.h,i=Math.max(i,u.w);r.sort((u,f)=>f.h-u.h);const n=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),i),h:1/0}];let s=0,l=0;for(const u of r)for(let f=n.length-1;f>=0;f--){const p=n[f];if(!(u.w>p.w||u.h>p.h)){if(u.x=p.x,u.y=p.y,l=Math.max(l,u.y+u.h),s=Math.max(s,u.x+u.w),u.w===p.w&&u.h===p.h){const g=n.pop();g&&f<n.length&&(n[f]=g)}else u.h===p.h?(p.x+=u.w,p.w-=u.w):u.w===p.w?(p.y+=u.h,p.h-=u.h):(n.push({x:p.x+u.w,y:p.y,w:p.w-u.w,h:u.h}),p.y+=u.h,p.h-=u.h);break}}return{w:s,h:l,fill:e/(s*l)||0}}function u_(r,e){return r.id<e.id?-1:r.id>e.id?1:r.version<e.version?-1:r.version>e.version?1:r.sx<e.sx?-1:r.sx>e.sx?1:r.sy<e.sy?-1:r.sy>e.sy?1:0}function cy(r){let e=0;for(let i=0;i<r.length;i++)e=(e<<5)-e+r.charCodeAt(i),e&=e;return e}function us(r,e){return(r<<5)-r+e}function Gv(r,e,i,n){for(const[s]of r.entries()){const l=n&&n.get(s)||Fn.parse(s),u=l.id.toString(),f=e.get(u)||0;i.push({id:s,version:f,sx:l.sx,sy:l.sy})}}et(Ba,"Anchor");class uy{constructor(e,i,n,s,l){this.iconDescriptors=[],this.patternDescriptors=[],this.requiresMipMaps=i.size>0,Gv(e,n,this.iconDescriptors,l),Gv(i,n,this.patternDescriptors,l),this.iconDescriptors.sort(u_),this.patternDescriptors.sort(u_);let u=0;const f=s?s.data:"";f&&(u=us(u,cy(f))),u=us(u,1);for(const p of this.iconDescriptors)u=us(u,cy(p.id)),u=us(u,p.version),u=us(u,p.sx),u=us(u,p.sy);u=us(u,1);for(const p of this.patternDescriptors)u=us(u,cy(p.id)),u=us(u,p.version),u=us(u,p.sx),u=us(u,p.sy);this.hash=u}subsetOf(e){return this.isSubsetArray(this.iconDescriptors,e.iconDescriptors,u_)&&this.isSubsetArray(this.patternDescriptors,e.patternDescriptors,u_)}isSubsetArray(e,i,n){let s=0,l=0;if(e.length>i.length)return!1;for(;s<e.length&&l<i.length;){const u=n(e[s],i[l]);if(u===0)s++,l++;else{if(u<0)return!1;l++}}return s===e.length}}et(uy,"AtlasContentDescriptor");class Af{static getImagePositionScale(e,i,n){if(i&&e){const{sx:s,sy:l}=e;return{x:s,y:l}}return{x:n,y:n}}constructor(e,i,n,s){this.paddedRect=e;const{pixelRatio:l,version:u,stretchX:f,stretchY:p,content:g,sdf:x,usvg:b}=i;this.pixelRatio=l,this.stretchX=f,this.stretchY=p,this.content=g,this.version=u,this.padding=n,this.sdf=x,this.usvg=b,this.scale=Af.getImagePositionScale(s,b,l)}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 hy(r,e,i){const n=Fn.parse(r),s=(function(l,u,f=[1,1]){return{x:0,y:0,w:(l.data?l.data.width:l.width*f[0])+2*u,h:(l.data?l.data.height:l.height*f[1])+2*u}})(e,i,[n.sx,n.sy]);return{bin:s,imagePosition:new Af(s,e,i,n),imageVariant:n}}function dy(r,e){const i=[];for(const[s,l]of r.entries()){const u=Fn.parse(s);u&&(i.push({key:s,value:l,variant:u}),e&&e.set(s,u))}i.sort((s,l)=>{const u=s.variant.id.toString().localeCompare(l.variant.id.toString());return u!==0?u:s.variant.sx!==l.variant.sx?s.variant.sx-l.variant.sx:s.variant.sy!==l.variant.sy?s.variant.sy-l.variant.sy:0});const n=new Map;for(const s of i)n.set(s.key,s.value);return n}class $v{constructor(e){this.sourceAtlasHash=e}}class Hv{constructor(e,i,n,s){const l=new Map,u=new Map;this.haveRenderCallbacks=[];const f=[],p=s!==void 0,g=p?new Map:void 0,x=p?dy(e,g):e,b=p?dy(i,g):i;this.addImages(x,l,1,f),this.addImages(b,u,2,f);const{w,h:S}=jv(f),E=new Ht({width:w||1,height:S||1});for(const[M,C]of x.entries()){const R=l.get(M).paddedRect;Ht.copy(C.data,E,{x:0,y:0},{x:R.x+1,y:R.y+1},C.data,null,C.sdf)}for(const[M,C]of b.entries()){const R=u.get(M),F=R.paddedRect;let z=R.padding;const j=F.x+z,$=F.y+z,q=C.data.width,ie=C.data.height;z=z>1?z-1:z,Ht.copy(C.data,E,{x:0,y:0},{x:j,y:$},C.data,n),Ht.copy(C.data,E,{x:0,y:ie-z},{x:j,y:$-z},{width:q,height:z},n),Ht.copy(C.data,E,{x:0,y:0},{x:j,y:$+ie},{width:q,height:z},n),Ht.copy(C.data,E,{x:q-z,y:0},{x:j-z,y:$},{width:z,height:ie},n),Ht.copy(C.data,E,{x:0,y:0},{x:j+q,y:$},{width:z,height:ie},n),Ht.copy(C.data,E,{x:q-z,y:ie-z},{x:j-z,y:$-z},{width:z,height:z},n),Ht.copy(C.data,E,{x:0,y:ie-z},{x:j+q,y:$-z},{width:z,height:z},n),Ht.copy(C.data,E,{x:0,y:0},{x:j+q,y:$+ie},{width:z,height:z},n),Ht.copy(C.data,E,{x:q-z,y:0},{x:j-z,y:$+ie},{width:z,height:z},n)}this.lut=n,this.image=E,this.iconPositions=l,this.patternPositions=u,p&&(this.contentDescriptor=new uy(x,b,s,n,g))}addImages(e,i,n,s){for(const[l,u]of e.entries()){const{bin:f,imagePosition:p,imageVariant:g}=hy(l,u,n);i.set(l,p),s.push(f),u.hasRenderCallback&&this.haveRenderCallbacks.push(g.id)}}patchUpdatedImages(e,i,n,s){this.haveRenderCallbacks=this.haveRenderCallbacks.filter(l=>e.hasImage(l,n)),e.dispatchRenderCallbacks(this.haveRenderCallbacks,n);for(const l of e.getUpdatedImages(n)){for(const u of this.iconPositions.keys()){const f=Fn.parse(u);if(Dr.isEqual(f.id,l)){const p=e.getImage(l,n);this.patchUpdatedImage(this.iconPositions.get(u),p,i,null)}}for(const u of this.patternPositions.keys()){const f=Fn.parse(u);if(Dr.isEqual(f.id,l)){const p=e.getImage(l,n);this.patchUpdatedImage(this.patternPositions.get(u),p,i,s||this.lut)}}}}patchUpdatedImage(e,i,n,s=null){if(!e||!i||e.version===i.version)return;e.version=i.version;const[l,u]=e.tl,f=e.sdf;if(this.lut||f){const p={width:i.data.width,height:i.data.height},g=new Ht(p);Ht.copy(i.data,g,{x:0,y:0},{x:0,y:0},p,s,f),n.update(g,{position:{x:l,y:u},recreateWhenResize:!1})}else n.update(i.data,{position:{x:l,y:u},recreateWhenResize:!1})}}et(Af,"ImagePosition"),et(Hv,"ImageAtlas",{omit:["lut"]}),et($v,"ImageAtlasReference");class Mf{constructor(e){this.pendingRequests=new Map,this.cachedRanges=new Map,this.fontstackCompositing=e&&e.fontstackCompositing||"client"}loadGlyphRange(e,i,n,s,l){if(this.fontstackCompositing==="server")return void Mf.loadGlyphRange(e,i,n,s,l);const u=e.split(",").map(f=>f.trim()).filter(f=>f.length>0);u.length!==0?u.length!==1?this._loadMultipleFonts(u,i,n,s,l):this._loadFont(u[0],i,n,s,l):l(new Error("Empty fontstack"))}_loadMultipleFonts(e,i,n,s,l){const u=e.map(()=>null),f={completed:0,firstError:null,callbackCalled:!1},p=(g,x,b)=>{if(!f.callbackCalled&&(x&&!f.firstError&&(f.firstError=x),b&&(u[g]=b),f.completed++,f.completed===e.length)){f.callbackCalled=!0;const w=u.filter(E=>E!==null);if(w.length===0)return void l(f.firstError||new Error("All fonts failed to load"));const S=this._composeGlyphs(w);l(null,S)}};for(let g=0;g<e.length;g++)this._loadFont(e[g],i,n,s,(x,b)=>{p(g,x,b)})}_loadFont(e,i,n,s,l){const u=`${e}:${i}`;if(this.cachedRanges.has(u)){const p=this.cachedRanges.get(u);return void un.frame(()=>l(null,p))}const f=this.pendingRequests.get(u);f?f.push(l):(this.pendingRequests.set(u,[l]),Mf.loadGlyphRange(e,i,n,s,(p,g)=>{p||this.cachedRanges.set(u,g||null);const x=this.pendingRequests.get(u);if(this.pendingRequests.delete(u),x)for(const b of x)b(p,g)}))}_composeGlyphs(e){const i={};let n,s;for(const l of e)if(n===void 0&&l.ascender!==void 0&&(n=l.ascender),s===void 0&&l.descender!==void 0&&(s=l.descender),l.glyphs)for(const u in l.glyphs)i[u]===void 0&&(i[u]=l.glyphs[u]);return{glyphs:i,ascender:n,descender:s}}}Mf.loadGlyphRange=function(r,e,i,n,s){const l=256*e,u=l+255,f=n.transformRequest(n.normalizeGlyphsURL(i).replace("{fontstack}",r).replace("{range}",`${l}-${u}`),ca.Glyphs);Ja(f,(p,g)=>{if(p)s(p);else if(g){const x={},b=(function(w){return new a_(w).readFields(yw,{})})(g);for(const w of b.glyphs)x[w.id]=w;s(null,{glyphs:x,ascender:b.ascender,descender:b.descender})}})};const Cf=1e20,fy=new Float64Array(256);for(let r=0;r<256;r++){const e=.5-Math.pow(r/255,.45454545454545453);fy[r]=e*Math.abs(e)}function qv(r,e,i,n,s,l,u,f,p){for(let g=e;g<e+n;g++)Zv(r,i*l+g,l,s,u,f,p);for(let g=i;g<i+s;g++)Zv(r,g*l+e,1,n,u,f,p)}function Zv(r,e,i,n,s,l,u){l[0]=0,u[0]=-Cf,u[1]=Cf,s[0]=r[e];for(let f=1,p=0,g=0;f<n;f++){s[f]=r[e+f*i];const x=f*f;do{const b=l[p];g=(s[f]-s[b]+x-b*b)/(f-b)/2}while(g<=u[p]&&--p>-1);p++,l[p]=f,u[p]=g,u[p+1]=Cf}for(let f=0,p=0;f<n;f++){for(;u[p+1]<f;)p++;const g=l[p],x=f-g;r[e+f*i]=s[g]+x*x}}fy[255]=-Cf;const Iw=/bold/i,Ew=/medium/i,Aw=/light/i,py={none:0,ideographs:1,all:2};class h_{constructor(e,i,n,s){this.requestManager=e,this.localGlyphMode=i,this.localFontFamily=n,this.url="",this.entries={},this.localGlyphs={200:{},400:{},500:{},900:{}},this.glyphLoader=new Mf({fontstackCompositing:s})}setURL(e){this.url=e}prefetchRange(e,i){const n=this.url||fi.GLYPHS_URL;if(!n)return;let s=this.entries[e];s||(s=this.entries[e]={glyphs:{},requests:{},ranges:{}}),s.ranges[i]||s.requests[i]||(s.requests[i]=[],this.glyphLoader.loadGlyphRange(e,i,n,this.requestManager,(l,u)=>{if(u){s.ascender=u.ascender,s.descender=u.descender;for(const f in u.glyphs)this._doesCharSupportLocalGlyph(+f)||(s.glyphs[+f]=u.glyphs[+f]);s.ranges[i]=!0}for(const f of s.requests[i]||[])f(l,u);delete s.requests[i]}))}getGlyphs(e,i){const n=[],s=this.url||fi.GLYPHS_URL;for(const l in e)for(const u of e[l])n.push({stack:l,id:u});Oe(n,({stack:l,id:u},f)=>{let p=this.entries[l];p||(p=this.entries[l]={glyphs:{},requests:{},ranges:{},ascender:void 0,descender:void 0});let g=p.glyphs[u];if(g!==void 0)return void f(null,{stack:l,id:u,glyph:g});if(g=this._tinySDF(p,l,u),g)return p.glyphs[u]=g,void f(null,{stack:l,id:u,glyph:g});const x=Math.floor(u/256);if(256*x>65535)return Pt("glyphs > 65535 not supported"),void f(null,{stack:l,id:u,glyph:g});if(p.ranges[x])return void f(null,{stack:l,id:u,glyph:g});let b=p.requests[x];b||(b=p.requests[x]=[],this.glyphLoader.loadGlyphRange(l,x,s,this.requestManager,(w,S)=>{if(S){p.ascender=S.ascender,p.descender=S.descender;for(const E in S.glyphs)this._doesCharSupportLocalGlyph(+E)||(p.glyphs[+E]=S.glyphs[+E]);p.ranges[x]=!0}for(const E of b)E(w,S);delete p.requests[x]})),b.push((w,S)=>{w?f(w):S&&f(null,{stack:l,id:u,glyph:S.glyphs[u]||null})})},(l,u)=>{if(l)i(l);else if(u){const f={};for(const{stack:p,id:g,glyph:x}of u)f[p]===void 0&&(f[p]={}),f[p].glyphs===void 0&&(f[p].glyphs={}),f[p].glyphs[g]=x&&{id:x.id,bitmap:x.bitmap.clone(),metrics:x.metrics},f[p].ascender=this.entries[p].ascender,f[p].descender=this.entries[p].descender;i(null,f)}})}_doesCharSupportLocalGlyph(e){return this.localGlyphMode!==py.none&&(this.localGlyphMode===py.all?!!this.localFontFamily:!!this.localFontFamily&&(vl(e)||qp(e)||ku(e)||Nu(e)||Bu(e)||bd(e)||(i=e)>=131072&&i<=173791||(n=>n>=66736&&n<=66815)(e)));var i}_tinySDF(e,i,n){const s=this.localFontFamily;if(!s||!this._doesCharSupportLocalGlyph(n))return;let l=e.tinySDF;if(!l){let C="400";Iw.test(i)?C="900":Ew.test(i)?C="500":Aw.test(i)&&(C="200"),l=e.tinySDF=new h_.TinySDF({fontFamily:s,fontWeight:C,fontSize:48,buffer:6,radius:16}),l.fontWeight=C}const u=l.fontWeight;if(this.localGlyphs[u][n])return this.localGlyphs[u][n];const f=String.fromCodePoint(n),{data:p,width:g,height:x,glyphWidth:b,glyphHeight:w,glyphLeft:S,glyphTop:E,glyphAdvance:M}=l.draw(f);return this.localGlyphs[u][n]={id:n,bitmap:new Fr({width:g,height:x},p),metrics:{width:b/2,height:w/2,left:S/2,top:E/2-27,advance:M/2,localGlyph:!0}}}}function Wv(r,e){return r+e[1]-e[0]}function my(r,e,i,n,s=1){const l=[],u=r.imagePrimary,f=u.pixelRatio,p=u.paddedRect.w-2,g=u.paddedRect.h-2,x=(r.right-r.left)*s,b=(r.bottom-r.top)*s,w=u.stretchX||[[0,p]],S=u.stretchY||[[0,g]],E=w.reduce(Wv,0),M=S.reduce(Wv,0),C=p-E,R=g-M;let F=0,z=E,j=0,$=M,q=0,ie=C,W=0,Q=R;if(u.content&&n){const ee=u.content;F=d_(w,0,ee[0]),j=d_(S,0,ee[1]),z=d_(w,ee[0],ee[2]),$=d_(S,ee[1],ee[3]),q=ee[0]-F,W=ee[1]-j,ie=ee[2]-ee[0]-z,Q=ee[3]-ee[1]-$}const Y=(ee,me,ge,Te)=>{const Ae=f_(ee.stretch-F,z,x,r.left*s),Ie=p_(ee.fixed-q,ie,ee.stretch,E),Fe=f_(me.stretch-j,$,b,r.top*s),xe=p_(me.fixed-W,Q,me.stretch,M),Se=f_(ge.stretch-F,z,x,r.left*s),Me=p_(ge.fixed-q,ie,ge.stretch,E),ze=f_(Te.stretch-j,$,b,r.top*s),Le=p_(Te.fixed-W,Q,Te.stretch,M),We=new Ue(Ae,Fe),De=new Ue(Se,Fe),Ge=new Ue(Se,ze),$e=new Ue(Ae,ze),Je=new Ue(Ie/f,xe/f),Qe=new Ue(Me/f,Le/f),ct=e*Math.PI/180;if(ct){const Mt=Math.sin(ct),Oi=Math.cos(ct),Yt=[Oi,-Mt,Mt,Oi];We._matMult(Yt),De._matMult(Yt),$e._matMult(Yt),Ge._matMult(Yt)}const nt=ee.stretch+ee.fixed,mt=ge.stretch+ge.fixed,Gt=me.stretch+me.fixed,wt=Te.stretch+Te.fixed,kt=r.imageSecondary;return{tl:We,tr:De,bl:$e,br:Ge,texPrimary:{x:u.paddedRect.x+1+nt,y:u.paddedRect.y+1+Gt,w:mt-nt,h:wt-Gt},texSecondary:kt?{x:kt.paddedRect.x+1+nt,y:kt.paddedRect.y+1+Gt,w:mt-nt,h:wt-Gt}:void 0,writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Je,pixelOffsetBR:Qe,minFontScaleX:ie/f/x,minFontScaleY:Q/f/b,isSDF:i}};if(u.stretchX||u.stretchY){const ee=Xv(w,C,E),me=Xv(S,R,M);for(let ge=0;ge<ee.length-1;ge++){const Te=ee[ge],Ae=ee[ge+1];for(let Ie=0;Ie<me.length-1;Ie++)l.push(Y(Te,me[Ie],Ae,me[Ie+1]))}}else l.push(Y({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:p+1},{fixed:0,stretch:g+1}));return l}function Mw(r,e){const i=r.stretchY||[[0,r.paddedRect.h-2]];return r.stretchX||r.stretchY?Yv(r.stretchX||[[0,r.paddedRect.w-2]])*Yv(i):1}function d_(r,e,i){let n=0;for(const s of r)n+=Math.max(e,Math.min(i,s[1]))-Math.max(e,Math.min(i,s[0]));return n}function Xv(r,e,i){const n=[{fixed:-1,stretch:0}];for(const[s,l]of r){const u=n.at(-1);n.push({fixed:s-u.stretch,stretch:u.stretch}),n.push({fixed:s-u.stretch,stretch:u.stretch+(l-s)})}return n.push({fixed:e+1,stretch:i}),n}function Yv(r){return 2*r.length+1}function f_(r,e,i,n){return r/e*i+n}function p_(r,e,i,n){return r-e*i/n}function Cw(r,e,i,n){const s=e+r.positionedLines[n].lineOffset;return n===0?i+s/2:i+(s+(e+r.positionedLines[n-1].lineOffset))/2}function Jv(r,e,i,n,s,l,u,f,p,g=1){const x=[];if(e.positionedLines.length===0)return x;const b=(p!==void 0?p:n.layout.get("text-rotate").evaluate(l,{}))*Math.PI/180,w=(function(R){const F=R[0],z=R[1],j=F*z;return j>0?[F,-z]:j<0?[-F,z]:F===0?[z,F]:[z,-F]})(i);let S=Math.abs(e.top-e.bottom);for(const R of e.positionedLines)S-=R.lineOffset;const E=e.positionedLines.length,M=S/E;let C=e.top-i[1];for(let R=0;R<E;++R){const F=e.positionedLines[R];C=Cw(e,M,C,R);for(const z of F.positionedGlyphs){if(!z.rect)continue;const j=z.rect||{};let $=4,q=!0,ie=1,W=0;if(z.image){const Ge=u.get(z.image.toString());if(!Ge)continue;if(Ge.sdf){Pt("SDF images are not supported in formatted text and will be ignored.");continue}q=!1,ie=Ge.pixelRatio,$=1/ie,Ge.usvg||(ie/=g)}const Q=(s||f)&&z.vertical,Y=z.metrics.advance*z.scale/2,ee=z.metrics,me=z.rect;if(me===null)continue;f&&e.verticalizable&&(W=z.image?Y-z.metrics.width*z.scale/2:0);const ge=s?[z.x+Y,z.y]:[0,0];let Te=[0,0],Ae=[0,0],Ie=!1;s||(Q?(Ae=[z.x+Y+w[0],z.y+w[1]-W],Ie=!0):Te=[z.x+Y+i[0],z.y+i[1]-W]);const Fe=me.w*z.scale/(ie*(z.localGlyph?2:1)),xe=me.h*z.scale/(ie*(z.localGlyph?2:1));let Se,Me,ze,Le;if(Q){const Ge=z.y-C,$e=new Ue(-Y,Y-Ge),Je=-Math.PI/2,Qe=new Ue(...Ae);Se=new Ue(-Y+Te[0],Te[1]),Se._rotateAround(Je,$e)._add(Qe),Se.x+=-Ge+Y,Se.y-=(ee.left-$)*z.scale;const ct=z.image?ee.advance*z.scale:dr*z.scale,nt=String.fromCodePoint(z.glyph);aw(nt)?Se.x+=(1-$)*z.scale:lw(nt)?Se.x+=ct-ee.height*z.scale+(-$-1)*z.scale:Se.x+=z.image||ee.width+2*$===me.w&&ee.height+2*$===me.h?(ct-xe)/2:(ct-(ee.height+2*$)*z.scale)/2,Me=new Ue(Se.x,Se.y-Fe),ze=new Ue(Se.x+xe,Se.y),Le=new Ue(Se.x+xe,Se.y-Fe)}else{const Ge=(ee.left-$)*z.scale-Y+Te[0],$e=(-ee.top-$)*z.scale+Te[1],Je=Ge+Fe,Qe=$e+xe;Se=new Ue(Ge,$e),Me=new Ue(Je,$e),ze=new Ue(Ge,Qe),Le=new Ue(Je,Qe)}if(b){let Ge;Ge=s?new Ue(0,0):Ie?new Ue(w[0],w[1]):new Ue(i[0],i[1]),Se._rotateAround(b,Ge),Me._rotateAround(b,Ge),ze._rotateAround(b,Ge),Le._rotateAround(b,Ge)}const We=new Ue(0,0),De=new Ue(0,0);x.push({tl:Se,tr:Me,bl:ze,br:Le,texPrimary:j,texSecondary:void 0,writingMode:e.writingMode,glyphOffset:ge,sectionIndex:z.sectionIndex,isSDF:q,pixelOffsetTL:We,pixelOffsetBR:De,minFontScaleX:0,minFontScaleY:0})}}return x}function Pw(r,e=1,i=!1){let n=1/0,s=1/0,l=-1/0,u=-1/0;const f=r[0];for(let S=0;S<f.length;S++){const E=f[S];(!S||E.x<n)&&(n=E.x),(!S||E.y<s)&&(s=E.y),(!S||E.x>l)&&(l=E.x),(!S||E.y>u)&&(u=E.y)}const p=Math.min(l-n,u-s);let g=p/2;const x=new gc([],Dw);if(p===0)return new Ue(n,s);for(let S=n;S<l;S+=p)for(let E=s;E<u;E+=p)x.push(new yh(S+g,E+g,g,r));let b=(function(S){let E=0,M=0,C=0;const R=S[0];for(let F=0,z=R.length,j=z-1;F<z;j=F++){const $=R[F],q=R[j],ie=$.x*q.y-q.x*$.y;M+=($.x+q.x)*ie,C+=($.y+q.y)*ie,E+=3*ie}return new yh(M/E,C/E,0,S)})(r),w=x.length;for(;x.length;){const S=x.pop();(S.d>b.d||!b.d)&&(b=S,i&&console.log("found best %d after %d probes",Math.round(1e4*S.d)/1e4,w)),S.max-b.d<=e||(g=S.h/2,x.push(new yh(S.p.x-g,S.p.y-g,g,r)),x.push(new yh(S.p.x+g,S.p.y-g,g,r)),x.push(new yh(S.p.x-g,S.p.y+g,g,r)),x.push(new yh(S.p.x+g,S.p.y+g,g,r)),w+=4)}return i&&(console.log(`num probes: ${w}`),console.log(`best distance: ${b.d}`)),b.p}function Dw(r,e){return e.max-r.max}h_.TinySDF=class{constructor({fontSize:r=24,buffer:e=3,radius:i=8,cutoff:n=.25,fontFamily:s="sans-serif",fontWeight:l="normal",fontStyle:u="normal",lang:f=null}={}){this.buffer=e,this.radius=i,this.cutoff=n,this.lang=f;const p=this.size=r+4*e,g=this._createCanvas(p),x=this.ctx=g.getContext("2d",{willReadFrequently:!0});x.font=`${u} ${l} ${r}px ${s}`,x.textBaseline="alphabetic",x.textAlign="left",x.fillStyle="black",this.gridOuter=new Float64Array(p*p),this.gridInner=new Float64Array(p*p),this.f=new Float64Array(p),this.z=new Float64Array(p+1),this.v=new Uint16Array(p)}_createCanvas(r){if(typeof OffscreenCanvas<"u")return new OffscreenCanvas(r,r);const e=document.createElement("canvas");return e.width=e.height=r,e}draw(r){const{width:e,actualBoundingBoxAscent:i,actualBoundingBoxDescent:n,actualBoundingBoxLeft:s,actualBoundingBoxRight:l}=this.ctx.measureText(r),u=Math.ceil(i),f=Math.floor(s),p=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(l)-f)),g=Math.max(0,Math.min(this.size-this.buffer,u+Math.ceil(n))),x=p+2*this.buffer,b=g+2*this.buffer,w=Math.max(x*b,0),S=new Uint8ClampedArray(w),E={data:S,width:x,height:b,glyphWidth:p,glyphHeight:g,glyphTop:u,glyphLeft:f,glyphAdvance:e};if(p===0||g===0)return E;const{ctx:M,buffer:C,gridInner:R,gridOuter:F}=this;this.lang&&(M.lang=this.lang),M.clearRect(C,C,p,g),M.fillText(r,C-f,C+u);const z=M.getImageData(C,C,p,g);F.fill(Cf,0,w),R.fill(0,0,w);let j=3;for(let ie=0;ie<g;ie++){let W=(ie+C)*x+C;for(let Q=0;Q<p;Q++,j+=4,W++){const Y=z.data[j];if(Y===0)continue;const ee=fy[Y];F[W]=Math.max(0,ee),R[W]=Math.max(0,-ee)}}qv(F,0,0,x,b,x,this.f,this.v,this.z),qv(R,C,C,p,g,x,this.f,this.v,this.z);const $=255/this.radius,q=255*(1-this.cutoff);for(let ie=0;ie<w;ie++){const W=Math.sqrt(F[ie])-Math.sqrt(R[ie]);S[ie]=Math.round(q-$*W)}return E}};class yh{constructor(e,i,n,s){this.p=new Ue(e,i),this.h=n,this.d=(function(l,u){let f=!1,p=1/0;for(let g=0;g<u.length;g++){const x=u[g];for(let b=0,w=x.length,S=w-1;b<w;S=b++){const E=x[b],M=x[S];E.y>l.y!=M.y>l.y&&l.x<(M.x-E.x)*(l.y-E.y)/(M.y-E.y)+E.x&&(f=!f),p=Math.min(p,D(l,E,M))}}return(f?1:-1)*Math.sqrt(p)})(this.p,s),this.max=this.d+this.h*Math.SQRT2}}const Rw=Object.keys,_y=Number.POSITIVE_INFINITY,zw=Math.sqrt(2);function Ol(r,e,i,n,s,l){const u=sy(r)&&r.collisionPadding?r.collisionPadding:[0,0,0,0],f={top:r.top-u[1],bottom:r.bottom+u[3],left:r.left-u[0],right:r.right+u[2],scaled:!1};return n!==void 0&&(function(p,g){p.top*=g,p.bottom*=g,p.left*=g,p.right*=g,p.scaled=!0})(f,n),l&&(f.left+=l[0],f.right+=l[0],f.top+=l[1],f.bottom+=l[1]),i&&(function(p,g,x){if(!g)return;const b=V(g),w=new Ue(x?x[0]:0,x?x[1]:0),S=new Ue(p.left,p.top),E=new Ue(p.right,p.top),M=new Ue(p.left,p.bottom),C=new Ue(p.right,p.bottom);S._rotateAround(b,w),E._rotateAround(b,w),M._rotateAround(b,w),C._rotateAround(b,w),p.left=Math.min(S.x,E.x,M.x,C.x),p.right=Math.max(S.x,E.x,M.x,C.x),p.top=Math.min(S.y,E.y,M.y,C.y),p.bottom=Math.max(S.y,E.y,M.y,C.y)})(f,i,s),e?{top:Math.min(e.top,f.top),bottom:Math.max(e.bottom,f.bottom),left:Math.min(e.left,f.left),right:Math.max(e.right,f.right),scaled:e.scaled||f.scaled}:f}function Kv(r,[e,i]){let n=0,s=0;if(i===_y){e<0&&(e=0);const l=e/zw;switch(r){case"top-right":case"top-left":s=l-7;break;case"bottom-right":case"bottom-left":s=7-l;break;case"bottom":s=7-e;break;case"top":s=e-7}switch(r){case"top-right":case"bottom-right":n=-l;break;case"top-left":case"bottom-left":n=l;break;case"left":n=e;break;case"right":n=-e}}else{switch(e=Math.abs(e),i=Math.abs(i),r){case"top-right":case"top-left":case"top":s=i-7;break;case"bottom-right":case"bottom-left":case"bottom":s=7-i}switch(r){case"top-right":case"bottom-right":case"right":n=-e;break;case"top-left":case"bottom-left":case"left":n=e}}return[n,s]}function Lw(r,e,i,n,s,l,u,f,p,g,x,b,w,S,E){const M=r.layers[0],C=M.appearances;if(C.length===0)return{iconBBox:null,iconVerticalBBox:null,textBBox:null,textVerticalBBox:null};const R={iconBBox:null,iconVerticalBBox:null},F={textBBox:null,textVerticalBBox:null},{baseIconRotate:z,baseTextRotate:j,iconScaleFactor:$}=(function(ie,W,Q){const Y=ie.get("icon-rotate").evaluate(W,{},Q),ee=ie.get("text-rotate").evaluate(W,{},Q),[me,ge]=ie.get("icon-size-scale-range");return{baseIconRotate:Y,baseTextRotate:ee,iconScaleFactor:re(1,me,ge)}})(n,s,l);e&&(R.iconBBox=Ol(e,R.iconBBox,z),i)&&(R.iconVerticalBBox=Ol(i,R.iconVerticalBBox,z+90));const q=__(b.horizontal);q&&(F.textBBox=Ol(q,F.textBBox,j,1,S)),b.vertical&&(F.textVerticalBBox=Ol(b.vertical,F.textVerticalBBox,j+90,1,S));for(const ie of C)ie.hasIconLayoutProperties()&&Ow(R,r,M,ie,s,l,f,z,u,p,e,g,$,x,E),ie.hasTextLayoutProperties()&&Fw(F,M,ie,s,l,S,j,w,q,b.vertical);return{iconBBox:R.iconBBox,iconVerticalBBox:R.iconVerticalBBox,textBBox:F.textBBox,textVerticalBBox:F.textVerticalBBox}}function Ow(r,e,i,n,s,l,u,f,p,g,x,b,w,S,E){const{appearanceIconOffset:M,appearanceIconRotate:C,appearanceIconSize:R}=Qv(n,i,s,l,u,f,p,g.iconScaleFactor);let F=null,z=null,j=null;n.hasLayoutProperty("icon-image")?j=(function(q,ie,W,Q,Y,ee,me,ge){let Te=null;const Ae=ie.getAppearanceValueAndResolveTokens(W,"icon-image",Q,Y,ge);if(Ae){const Ie=q.getResolvedImageFromTokens(Ae),Fe=W.hasLayoutProperty("icon-size")?W.getUnevaluatedLayoutProperty("icon-size"):ie._unevaluatedLayout._values["icon-size"],xe=Pf(Ie,Wc(q.zoom,Fe,q.worldview,ge),Fe,Y,q.zoom,Q,q.pixelRatio,me,q.worldview,ge);Te=ee.get(xe.iconPrimary.toString())}return Te})(e,i,n,s,l,b,w,E):x&&(j=x.imagePrimary),j&&(F=c_(j,null,M,S),e.allowVerticalPlacement&&(z=c_(j,null,M,S)));const $=p>0?R/p:1;F&&(r.iconBBox=Ol(F,r.iconBBox,C,$!==1?$:void 0)),z&&(r.iconVerticalBBox=Ol(z,r.iconVerticalBBox,C+90,$!==1?$:void 0))}function Qv(r,e,i,n,s,l,u,f){const p=r.hasLayoutProperty("icon-offset")?e.getAppearanceValueAndResolveTokens(r,"icon-offset",i,n,[]):null,g=p&&Array.isArray(p)?p:s,x=r.hasLayoutProperty("icon-rotate")?e.getAppearanceValueAndResolveTokens(r,"icon-rotate",i,n,[]):null,b=typeof x=="number"?x:l,w=r.hasLayoutProperty("icon-size")?e.getAppearanceValueAndResolveTokens(r,"icon-size",i,n,[]):null;return{appearanceIconOffset:g,appearanceIconRotate:b,appearanceIconSize:typeof w=="number"?w*f:u}}function Fw(r,e,i,n,s,l,u,f,p,g){const{appearanceTextOffset:x,appearanceTextRotate:b,appearanceTextSize:w}=e0(i,e,n,s,l,u,f),S=w/f,E=[(x[0]-l[0])*S,(x[1]-l[1])*S],M=E[0]!==0||E[1]!==0;p&&(r.textBBox=Ol(p,r.textBBox,b,S,x,M?E:void 0)),g&&(r.textVerticalBBox=Ol(g,r.textVerticalBBox,b+90,S,x,M?E:void 0))}function e0(r,e,i,n,s,l,u){const f=r.hasLayoutProperty("text-offset")?e.getAppearanceValueAndResolveTokens(r,"text-offset",i,n,[]):null,p=f&&Array.isArray(f)?[f[0]*dr,f[1]*dr]:s,g=r.hasLayoutProperty("text-rotate")?e.getAppearanceValueAndResolveTokens(r,"text-rotate",i,n,[]):null,x=typeof g=="number"?g:l,b=r.hasLayoutProperty("text-size")?e.getAppearanceValueAndResolveTokens(r,"text-size",i,n,[]):null;return{appearanceTextOffset:p,appearanceTextRotate:x,appearanceTextSize:typeof b=="number"?b:u}}function m_(r,e,i,n,s,l,u,f,p){if(!e||!e.usvg)return;const g=Fv(n),x=Fv(s),b=l!=="both"&&l!=="width"||!Lv(n)?1:x.width/g.width,w=l!=="both"&&l!=="height"||!Ov(n)?1:x.height/g.height;i.scaleSelf(b,w);const S=i.toString();u.set(S,i),f.set(S,e);const{imagePosition:E}=hy(S,e,1);p.set(S,E)}function t0(r,e,i,n,s,l,u,f,p,g){if(!r)return;const x=(function(b,w,S,E,M,C,R){if(b.kind==="camera")return b.maxSize;if(b.kind==="composite"){const F=w.possiblyEvaluate(new Wt(b.maxZoom,{worldview:C}),S,R).evaluate(M,{},S,R),z=w.possiblyEvaluate(new Wt(b.minZoom,{worldview:C}),S,R).evaluate(M,{},S,R);return Math.max(F,z)}return w.possiblyEvaluate(new Wt(E,{worldview:C}),S,R).evaluate(M,{},S,R)})(e,i,n,s,l,p,g);return r.scaleSelf(x*f*u)}function Pf(r,e,i,n,s,l,u,f,p,g){return{iconPrimary:t0(r.getPrimary(),e,i,n,s,l,u,f,p,g),iconSecondary:t0(r.getSecondary(),e,i,n,s,l,u,f,p,g)}}function Bw(r,e,i){if(!e)return;const n=i.get(r.toString()),s=i.get(e.toString());n&&s&&(n.paddedRect.w===s.paddedRect.w&&n.paddedRect.h===s.paddedRect.h||Pt(`Mismatch in icon variant sizes: ${r.toString()} and ${e.toString()}`),n.usvg!==s.usvg&&Pt(`Mismatch in icon variant image types: ${r.id} and ${e.id}`))}function i0(r,e,i,n){if(!r)return;const s=e.get(i.toString());if(s&&(r.imagePrimary=s),n){const l=e.get(n.toString());r.imageSecondary=l}}function kw(r,e){for(const i in r.horizontal)r0(r.horizontal[i],e);r0(r.vertical,e)}function r0(r,e){if(r){for(const i of r.positionedLines)for(const n of i.positionedGlyphs)if(n.image!==null){const s=n.image.toString();n.rect=e.get(s).paddedRect}}}function gy(r){switch(r){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function Nw(r,e,i,n,s,l,u,f,p){const g=__(l.horizontal)||l.vertical,x=i.get("icon-text-fit-padding").evaluate(n,{},s);let b,w=e;return e&&p!=="none"&&(r.allowVerticalPlacement&&l.vertical&&(b=ay(e,l.vertical,p,x,f,u)),g&&(w=ay(e,g,p,x,f,u))),{defaultShapedIcon:w,verticallyShapedIcon:b}}function n0(r,e){return r*e/24}function Uw(r,e,i,n,s,l,u,f,p,g,x,b,w,S,E,M,C,R,F,z,j,$,q,ie){let W=u.textMaxSize.evaluate(e,{},w);W===void 0?W=f*u.textScaleFactor:W*=u.textScaleFactor;const Q=r.layers[0].layout,Y=n0(f,u.textScaleFactor),ee=__(i.horizontal)||i.vertical,me=r.hasAnyAppearanceLayoutProperty(["text-size","text-offset","text-rotate"]),ge=r.getAppearanceFeatureData(e.index);(C!=="none"||me)&&ge&&(ge.textShaping=ee,ge.iconTextFitPadding=Q.get("icon-text-fit-padding").evaluate(e,{},w),ge.fontScale=Y,ge.textScaleFactor=u.textScaleFactor);const Te=S.name==="globe",Ae=r.tilePixelRatio*W/24,Ie=(Le=r.overscaling,r.zoom>18&&Le>2&&(Le>>=1),Math.max(Xe/(512*Le),1)*Q.get("symbol-spacing")),Fe=Q.get("text-padding")*r.tilePixelRatio,xe=Q.get("icon-padding")*r.tilePixelRatio,Se=V(Q.get("text-max-angle")),Me=Q.get("icon-rotation-alignment")==="map"&&z!=="point",ze=Ie/2;var Le;r.hasAnyIconTextFit===!1&&C!=="none"&&(r.hasAnyIconTextFit=!0);const We=e.properties?+e.properties[Ra]:null,De=We&&r.elevationFeatureIdToIndex?r.elevationFeatureIdToIndex.get(We):65535,Ge=($e,Je,Qe)=>{if(Je.x<0||Je.x>=Xe||Je.y<0||Je.y>=Xe)return;let ct=null;if(Te){const{x:nt,y:mt,z:Gt}=S.projectTilePoint(Je.x,Je.y,Qe);ct={anchor:new Ba(nt,mt,Gt,0,void 0),up:S.upVector(Qe,Je.x,Je.y)}}(function(nt,mt,Gt,wt,kt,Mt,Oi,Yt,jt,ci,Si,fr,mi,Fi,ir,Qi,rr,zt,Er,Qr,Wi,gr,$r,Ar,Mi,lr,vn,Sh,nn,ky,Gf,$f){const ka=nt.addToLineVertexArray(mt,wt);let qn,mo,Ul,Vl,Lt,yr,Bi,cr=0,_o=0,Ln=0,Zn=0,On=-1,Hf=-1;const No={};let Ih=cu("");const qs=Gt?Gt.anchor:mt,Eh=Sh!=="none";let nr=0,br=0;if(jt._unevaluatedLayout.getValue("text-radial-offset")===void 0){const Mr=jt.layout.get("text-offset").evaluate(Wi,{},Mi);
7nr=Mr[0]*dr,br=Mr[1]*dr}else nr=jt.layout.get("text-radial-offset").evaluate(Wi,{},Mi)*dr,br=_y;if(nt.allowVerticalPlacement&&kt.vertical){const Mr=kt.vertical;if(ir)yr=vy(Mr),Yt&&(Bi=vy(Yt));else{const Hr=jt.layout.get("text-rotate").evaluate(Wi,{},Mi)+90;Ul=g_(ci,qs,mt,Si,fr,mi,Mr,Fi,Hr,Qi,$f),Yt&&(Vl=g_(ci,qs,mt,Si,fr,mi,Yt,zt,Hr,null,Gf))}}if(Mt){const Mr=jt.layout.get("icon-rotate").evaluate(Wi,{},Mi),Hr=my(Mt,Mr,$r,Eh,gr.iconScaleFactor),Xn=Yt?my(Yt,Mr,$r,Eh,gr.iconScaleFactor):void 0;mo=g_(ci,qs,mt,Si,fr,mi,Mt,zt,Mr,null,ky);const Zs=(function(fs,qf,pb,FT,BT,mb,_b,kT,WT,Vy){const gb=fs.layers[0],yb=gb.appearances;let Mh=qf.length;if(pb&&(Mh=Math.max(Mh,pb.length)),yb.length===0)return Mh;const[NT,UT]=FT.get("icon-size-scale-range"),VT=re(1,NT,UT);for(const R_ of yb)if(R_.hasLayoutProperty("icon-image")){const xb=gb.getAppearanceValueAndResolveTokens(R_,"icon-image",mb,_b,Vy);if(xb){const vb=fs.getResolvedImageFromTokens(xb);if(vb){const bb=R_.hasLayoutProperty("icon-size")?R_.getUnevaluatedLayoutProperty("icon-size"):BT._values["icon-size"],jT=Pf(vb,Wc(fs.zoom,bb,fs.worldview,Vy),bb,_b,fs.zoom,mb,fs.pixelRatio,VT,fs.worldview,Vy),wb=kT.get(jT.iconPrimary.toString());wb&&(Mh=Math.max(Mh,Mw(wb)))}}}return Mh})(nt,Hr,Xn,jt.layout,jt._unevaluatedLayout,Wi,Mi,nt.iconAtlasPositions,0,Ar);cr=4*Zs;const D_=jt.layout.get("icon-size").evaluate(Wi,{},Mi,Ar),Ny=gr.compositeIconSizes?gr.compositeIconSizes[0].evaluate(Wi,{},Mi,Ar):0,Uy=gr.compositeIconSizes?gr.compositeIconSizes[1].evaluate(Wi,{},Mi,Ar):0,Ah=xy(nt.layerIds[0],nt.iconSizeData,D_,Mt.imagePrimary.usvg?1:gr.iconScaleFactor,Ny,Uy);nt.addSymbols(nt.icon,Hr,Ah,Qr,Er,Wi,void 0,Gt,mt,ka.lineStartIndex,ka.lineLength,-1,Ar,Mi,lr,vn,nt.symbolInstances.length,Zs),On=nt.icon.placedSymbolArray.length-1,Xn&&(_o=4*Zs,nt.addSymbols(nt.icon,Xn,Ah,Qr,Er,Wi,zn.vertical,Gt,mt,ka.lineStartIndex,ka.lineLength,-1,Ar,Mi,lr,vn,nt.symbolInstances.length,Zs),Hf=nt.icon.placedSymbolArray.length-1)}for(const Mr in kt.horizontal){const Hr=Mr,Xn=kt.horizontal[Hr];qn||(Ih=cu(Xn.text),ir?Lt=vy(Xn):qn=g_(ci,qs,mt,Si,fr,mi,Xn,Fi,jt.layout.get("text-rotate").evaluate(Wi,{},Mi),Qi,$f));const Zs=Xn.positionedLines.length===1;if(Ln+=o0(nt,Gt,mt,Xn,Oi,jt,ir,Wi,Qi,ka,kt.vertical?zn.horizontal:zn.horizontalOnly,Zs?Rw(kt.horizontal):[Hr],No,On,gr,Ar,Mi,nt.symbolInstances.length,lr),Zs)break}kt.vertical&&(Zn+=o0(nt,Gt,mt,kt.vertical,Oi,jt,ir,Wi,Qi,ka,zn.vertical,["vertical"],No,Hf,gr,Ar,Mi,nt.symbolInstances.length,lr));let Vi=-1;const Wn=(Mr,Hr)=>Mr?Math.max(Mr,Hr):Hr;Vi=Wn(Lt,Vi),Vi=Wn(yr,Vi),Vi=Wn(Bi,Vi);const on=Vi>-1?1:0;nt.glyphOffsetArray.length>=65535&&Pt("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),Wi.sortKey!==void 0&&nt.addToSortKeyRanges(nt.symbolInstances.length,Wi.sortKey),nt.symbolInstances.emplaceBack(mt.x,mt.y,qs.x,qs.y,qs.z,No.right>=0?No.right:-1,No.center>=0?No.center:-1,No.left>=0?No.left:-1,No.vertical>=0?No.vertical:-1,On,Hf,Ih,qn!==void 0?qn:nt.collisionBoxArray.length,qn!==void 0?qn+1:nt.collisionBoxArray.length,Ul!==void 0?Ul:nt.collisionBoxArray.length,Ul!==void 0?Ul+1:nt.collisionBoxArray.length,mo!==void 0?mo:nt.collisionBoxArray.length,mo!==void 0?mo+1:nt.collisionBoxArray.length,Vl||nt.collisionBoxArray.length,Vl?Vl+1:nt.collisionBoxArray.length,Si,Ln,Zn,cr,_o,on,0,nr,br,Vi,0,Eh?1:0,nn)})(r,Je,ct,$e,i,n,l,s,r.layers[0],r.collisionBoxArray,e.index,e.sourceLayerIndex,r.index,Fe,F,g,0,xe,Me,R,e,u,x,b,w,E,M,C,De,j,$,q)};if(z==="line")for(const $e of Xm(e.geometry,0,0,Xe,Xe)){const Je=Sw($e,Ie,Se,i.vertical||ee,n,24,Ae,r.overscaling,Xe);for(const Qe of Je)ee&&Vw(r,ee.text,ze,Qe)||Ge($e,Qe,w)}else if(z==="line-center"){for(const $e of e.geometry)if($e.length>1){const Je=Tw($e,Se,i.vertical||ee,n,24,Ae);Je&&Ge($e,Je,w)}}else if(e.type==="Polygon")for(const $e of ff(e.geometry,0)){const Je=Pw($e,16);Ge($e[0],new Ba(Je.x,Je.y,0,0,void 0),w)}else if(e.type==="LineString")for(const $e of e.geometry)Ge($e,new Ba($e[0].x,$e[0].y,0,0,void 0),w);else if(e.type==="Point")for(const $e of e.geometry)for(const Je of $e)Ge([Je],new Ba(Je.x,Je.y,0,0,void 0),w)}const yy=255,Xc=yy*Fa;function o0(r,e,i,n,s,l,u,f,p,g,x,b,w,S,E,M,C,R,F){const z=Jv(0,n,p,l,u,f,s,r.allowVerticalPlacement,void 0,E.textScaleFactor),j=l.layout.get("text-size").evaluate(f,{},C),$=E.compositeTextSizes?E.compositeTextSizes[0].evaluate(f,{},C):0,q=E.compositeTextSizes?E.compositeTextSizes[1].evaluate(f,{},C):0,ie=xy(r.layerIds[0],r.textSizeData,j,E.textScaleFactor,$,q);r.addSymbols(r.text,z,ie,p,u,f,x,e,i,g.lineStartIndex,g.lineLength,S,M,C,F,!1,R,z.length);for(const W of b)w[W]=r.text.placedSymbolArray.length-1;return 4*z.length}function xy(r,e,i,n,s,l){const u=e;let f=null;return u.kind==="source"?(f=[Fa*i*n],f[0]>Xc&&Pt(`${r}: Value for "text-size" or "icon-size" is >= ${yy}. Reduce your "text-size" or "icon-size".`)):u.kind==="composite"&&(f=[Fa*s*n,Fa*l*n],(f[0]>Xc||f[1]>Xc)&&Pt(`${r}: Value for "text-size" or "icon-size" is >= ${yy}. Reduce your "text-size" or "icon-size".`)),f}function __(r){for(const e in r)return r[e];return null}function g_(r,e,i,n,s,l,u,f,p,g,x){let b,w,S,E;if(b=x?x.top:u.top,w=x?x.bottom:u.bottom,S=x?x.left:u.left,E=x?x.right:u.right,sy(u)&&u.collisionPadding){const M=u.collisionPadding;S-=M[0],b-=M[1],E+=M[2],w+=M[3]}if(p){const M=new Ue(S,b),C=new Ue(E,b),R=new Ue(S,w),F=new Ue(E,w),z=V(p);let j=new Ue(0,0);
vendor: 4,268 bytes, line 7
7g&&(j=new Ue(g[0],g[1])),M._rotateAround(z,j),C._rotateAround(z,j),R._rotateAround(z,j),F._rotateAround(z,j),S=Math.min(M.x,C.x,R.x,F.x),E=Math.max(M.x,C.x,R.x,F.x),b=Math.min(M.y,C.y,R.y,F.y),w=Math.max(M.y,C.y,R.y,F.y)}return r.emplaceBack(e.x,e.y,e.z,i.x,i.y,S,b,E,w,f,n,s,l),r.length-1}function vy(r){sy(r)&&r.collisionPadding&&(r.top-=r.collisionPadding[1],r.bottom+=r.collisionPadding[3]);const e=r.bottom-r.top;return e>0?Math.max(10,e):null}function Vw(r,e,i,n){const s=r.compareText;if(e in s){const l=s[e];for(let u=l.length-1;u>=0;u--)if(n.dist(l[u])<i)return!0}else s[e]=[];return s[e].push(n),!1}function s0(r,e){const i=r.fovAboveCenter,n=r.elevation?r.elevation.getMinElevationBelowMSL()*e:0,s=Math.min(n,r.isOrthographic?-10*e:0),l=(r._camera.position[2]*r.worldSize-s)/Math.cos(r._pitch),u=Math.sin(i)*l/Math.sin(Math.max(Math.PI/2-r._pitch-i,.01));let f=Math.sin(r._pitch)*u+l;const p=l*(1/r._horizonShift);if(!r.elevation||r.elevation.exaggeration()===0){let g=Math.max(r.zoom-17,0);r.isOrthographic&&(g/=10),f*=1+g}return Math.min(1.01*f,p)}function Yc(r,e){if(!e.isReprojectedInTileSpace)return{scale:1<<r.z,x:r.x,y:r.y,x2:r.x+1,y2:r.y+1,projection:e};const i=Math.pow(2,-r.z),n=r.x*i,s=(r.x+1)*i,l=r.y*i,u=(r.y+1)*i,f=mn(n),p=mn(s),g=pr(l),x=pr(u),b=e.project(f,g),w=e.project(p,g),S=e.project(p,x),E=e.project(f,x);let M=Math.min(b.x,w.x,S.x,E.x),C=Math.min(b.y,w.y,S.y,E.y),R=Math.max(b.x,w.x,S.x,E.x),F=Math.max(b.y,w.y,S.y,E.y);const z=i/16;function j(q,ie,W,Q,Y,ee){const me=(W+Y)/2,ge=(Q+ee)/2,Te=e.project(mn(me),pr(ge)),Ae=Math.max(0,M-Te.x,C-Te.y,Te.x-R,Te.y-F);M=Math.min(M,Te.x),R=Math.max(R,Te.x),C=Math.min(C,Te.y),F=Math.max(F,Te.y),Ae>z&&(j(q,Te,W,Q,me,ge),j(Te,ie,me,ge,Y,ee))}j(b,w,n,l,s,l),j(w,S,s,l,s,u),j(S,E,s,u,n,u),j(E,b,n,u,n,l),M-=z,C-=z,R+=z,F+=z;const $=1/Math.max(R-M,F-C);return{scale:$,x:M*$,y:C*$,x2:R*$,y2:F*$,projection:e}}function a0(r,{x:e,y:i},n=0){return new Ue(((e-n)*r.scale-r.x)*Xe,(i*r.scale-r.y)*Xe)}const jw=Ot(new Float32Array(16));class Fl{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,i){return{x:0,y:0,z:0}}unproject(e,i){return new Zt(0,0)}projectTilePoint(e,i,n){return{x:e,y:i,z:0}}locationPoint(e,i,n,s=!0){return e._coordinatePoint(e.locationCoordinate(i,n),s)}pixelsPerMeter(e,i){return Yr(1,e)*i}pixelSpaceConversion(e,i,n){return 1}farthestPixelDistance(e){return s0(e,e.pixelsPerMeter)}pointCoordinate(e,i,n,s){const l=e.horizonLineFromTop(!1),u=new Ue(i,Math.max(l,n));return e.rayIntersectionCoordinate(e.pointRayIntersection(u,s))}pointCoordinate3D(e,i,n){const s=new Ue(i,n);if(e.elevation)return e.elevation.pointCoordinate(s);{const l=this.pointCoordinate(e,s.x,s.y,0);return[l.x,l.y,l.z]}}isPointAboveHorizon(e,i){if(e.elevation&&e.elevation.visibleDemTiles.length)return!this.pointCoordinate3D(e,i.x,i.y);const n=e.horizonLineFromTop();return i.y<n}createInversionMatrix(e,i){return jw}createTileMatrix(e,i,n){let s,l,u;const f=n.canonical,p=Ot(new Float64Array(16));if(this.isReprojectedInTileSpace){const g=Yc(f,this);s=1,l=g.x+n.wrap*g.scale,u=g.y,Br(p,p,[s/g.scale,s/g.scale,e.pixelsPerMeter/i])}else s=i/e.zoomScale(f.z),l=(f.x+Math.pow(2,f.z)*n.wrap)*s,u=f.y*s;return Cr(p,p,[l,u,0]),Br(p,p,[s/Xe,s/Xe,1]),p}upVector(e,i,n){return[0,0,1]}upVectorScale(e,i,n){return{metersToTile:1}}}class Gw extends Fl{constructor(e){super(e),this.range=[4,7],this.center=e.center||[-96,37.5];const[i,n]=this.parallels=e.parallels||[29.5,45.5],s=Math.sin(V(i));this.n=(s+Math.sin(V(n)))/2,this.c=1+s*(2*this.n-s),this.r0=Math.sqrt(this.c)/this.n}project(e,i){const{n,c:s,r0:l}=this,u=V(e-this.center[0]),f=V(i),p=Math.sqrt(s-2*n*Math.sin(f))/n;return{x:p*Math.sin(u*n),y:p*Math.cos(u*n)-l,z:0}}unproject(e,i){const{n,c:s,r0:l}=this,u=l+i;let f=Math.atan2(e,Math.abs(u))*Math.sign(u);u*n<0&&(f-=Math.PI*Math.sign(e)*Math.sign(u));const p=V(this.center[0])*n;f=Ve(f,-Math.PI-p,Math.PI-p);const g=re(X(f/n)+this.center[0],-180,180),x=Math.asin(re((s-(e*e+u*u)*n*n)/(2*n),-1,1)),b=re(X(x),-85.051129,_n);return new Zt(g,b)}}
vendor: 4,729 bytes, line 7
7const Df=1.340264,Rf=-.081106,zf=893e-6,Lf=.003796,y_=Math.sqrt(3)/2;class $w extends Fl{project(e,i){i=i/180*Math.PI,e=e/180*Math.PI;const n=Math.asin(y_*Math.sin(i)),s=n*n,l=s*s*s;return{x:.5*(e*Math.cos(n)/(y_*(Df+3*Rf*s+l*(7*zf+9*Lf*s)))/Math.PI+.5),y:1-.5*(n*(Df+Rf*s+l*(zf+Lf*s))/Math.PI+1),z:0}}unproject(e,i){e=(2*e-.5)*Math.PI;let n=i=(2*(1-i)-1)*Math.PI,s=n*n,l=s*s*s;for(let x,b,w,S=0;S<12&&(b=n*(Df+Rf*s+l*(zf+Lf*s))-i,w=Df+3*Rf*s+l*(7*zf+9*Lf*s),x=b/w,n=re(n-x,-Math.PI/3,Math.PI/3),s=n*n,l=s*s*s,!(Math.abs(x)<1e-12));++S);const u=y_*e*(Df+3*Rf*s+l*(7*zf+9*Lf*s))/Math.cos(n),f=Math.asin(Math.sin(n)/y_),p=re(180*u/Math.PI,-180,180),g=re(180*f/Math.PI,-85.051129,_n);return new Zt(p,g)}}class Hw extends Fl{constructor(e){super(e),this.wrap=!0,this.supportsWorldCopies=!0}project(e,i){return{x:.5+e/360,y:.5-i/360,z:0}}unproject(e,i){const n=360*(e-.5),s=re(360*(.5-i),-85.051129,_n);return new Zt(n,s)}}const xh=Math.PI/2;function x_(r){return Math.tan((xh+r)/2)}class qw extends Fl{constructor(e){super(e),this.center=e.center||[0,30];const[i,n]=this.parallels=e.parallels||[30,30];let s=V(i),l=V(n);this.southernCenter=s+l<0,this.southernCenter&&(s=-s,l=-l);const u=Math.cos(s),f=x_(s);this.n=s===l?Math.sin(s):Math.log(u/Math.cos(l))/Math.log(x_(l)/f),this.f=u*Math.pow(x_(s),this.n)/this.n}project(e,i){i=V(i),this.southernCenter&&(i=-i),e=V(e-this.center[0]);const n=1e-6,{n:s,f:l}=this;l>0?i<-xh+n&&(i=-xh+n):i>xh-n&&(i=xh-n);const u=l/Math.pow(x_(i),s);let f=u*Math.sin(s*e),p=l-u*Math.cos(s*e);return f=.5*(f/Math.PI+.5),p=.5*(p/Math.PI+.5),{x:f,y:this.southernCenter?p:1-p,z:0}}unproject(e,i){e=(2*e-.5)*Math.PI,this.southernCenter&&(i=1-i),i=(2*(1-i)-.5)*Math.PI;const{n,f:s}=this,l=s-i,u=Math.sign(l),f=Math.sign(n)*Math.sqrt(e*e+l*l);let p=Math.atan2(e,Math.abs(l))*u;l*n<0&&(p-=Math.PI*Math.sign(e)*u);const g=re(X(p/n)+this.center[0],-180,180),x=re(X(2*Math.atan(Math.pow(s/f,1/n))-xh),-85.051129,_n);return new Zt(g,this.southernCenter?-x:x)}}class l0 extends Fl{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,i){return{x:as(e),y:Lo(i),z:0}}unproject(e,i){const n=mn(e),s=pr(i);return new Zt(n,s)}}const c0=V(_n);class Zw extends Fl{project(e,i){const n=(i=V(i))*i,s=n*n;return{x:.5*((e=V(e))*(.8707-.131979*n+s*(s*(.003971*n-.001529*s)-.013791))/Math.PI+.5),y:1-.5*(i*(1.007226+n*(.015085+s*(.028874*n-.044475-.005916*s)))/Math.PI+1),z:0}}unproject(e,i){e=(2*e-.5)*Math.PI;let n=i=(2*(1-i)-1)*Math.PI,s=25,l=0,u=n*n;do{u=n*n;const g=u*u;l=(n*(1.007226+u*(.015085+g*(.028874*u-.044475-.005916*g)))-i)/(1.007226+u*(.045255+g*(.259866*u-.311325-.005916*11*g))),n=re(n-l,-c0,c0)}while(Math.abs(l)>1e-6&&--s>0);u=n*n;const f=re(X(e/(.8707+u*(u*(u*u*u*(.003971-.001529*u)-.013791)-.131979))),-180,180),p=X(n);return new Zt(f,p)}}const u0=V(_n);class Ww extends Fl{project(e,i){i=V(i),e=V(e);const n=Math.cos(i),s=2/Math.PI,l=Math.acos(n*Math.cos(e/2)),u=Math.sin(l)/l,f=.5*(e*s+2*n*Math.sin(e/2)/u)||0,p=.5*(i+Math.sin(i)/u)||0;return{x:.5*(f/Math.PI+.5),y:1-.5*(p/Math.PI+1),z:0}}unproject(e,i){let n=e=(2*e-.5)*Math.PI,s=i=(2*(1-i)-1)*Math.PI,l=25;const u=1e-6;let f=0,p=0;do{const g=Math.cos(s),x=Math.sin(s),b=2*x*g,w=x*x,S=g*g,E=Math.cos(n/2),M=Math.sin(n/2),C=2*E*M,R=M*M,F=1-S*E*E,z=F?1/F:0,j=F?Math.acos(g*E)*Math.sqrt(1/F):0,$=.5*(2*j*g*M+2*n/Math.PI)-e,q=.5*(j*x+s)-i,ie=.5*z*(S*R+j*g*E*w)+1/Math.PI,W=z*(C*b/4-j*x*M),Q=.125*z*(b*M-j*x*S*C),Y=.5*z*(w*E+j*R*g)+.5,ee=W*Q-Y*ie;f=(q*W-$*Y)/ee,p=($*Q-q*ie)/ee,n=re(n-f,-Math.PI,Math.PI),s=re(s-p,-u0,u0)}while((Math.abs(f)>u||Math.abs(p)>u)&&--l>0);return new Zt(X(n),X(s))}}class h0 extends Fl{constructor(e){super(e),this.center=e.center||[0,0],this.parallels=e.parallels||[0,0],this.cosPhi=Math.max(.01,Math.cos(V(this.parallels[0]))),this.scale=1/(2*Math.max(Math.PI*this.cosPhi,1/this.cosPhi)),this.wrap=!0,this.supportsWorldCopies=!0}project(e,i){const{scale:n,cosPhi:s}=this;return{x:V(e)*s*n+.5,y:-Math.sin(V(i))/s*n+.5,z:0}}unproject(e,i){const{scale:n,cosPhi:s}=this,l=-(i-.5)/n,u=re(X((e-.5)/n)/s,-180,180),f=Math.asin(re(l*s,-1,1)),p=re(X(f),-85.051129,_n);return new Zt(u,p)}}class Xw extends l0{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,i,n){const s=xt(e,i,n);return Pi(s,s,_t(je(n))),{x:s[0],y:s[1],z:s[2]}}locationPoint(e,i,n){const s=zo(i.lat,i.lng),l=ui([],s),u=n?e._centerAltitude+n:e.elevation?e.elevation.getAtPointOrZero(e.locationCoordinate(i),e._centerAltitude):e._centerAltitude;wn(s,s,l,Yr(1,0)*Xe*u);
vendor: 40,844 bytes, line 7
7const f=Ot(new Float64Array(16));return gi(f,e.pixelMatrix,e.globeMatrix),Pi(s,s,f),new Ue(s[0],s[1])}pixelsPerMeter(e,i){return Yr(1,0)*i}pixelSpaceConversion(e,i,n){const s=Yr(1,e)*i,l=ft(Yr(1,45)*i,s,n);return this.pixelsPerMeter(e,i)/l}createTileMatrix(e,i,n){const s=Bt(je(n.canonical));return gi(new Float64Array(16),e.globeMatrix,s)}createInversionMatrix(e,i){const{center:n}=e,s=_t(je(i));return Go(s,s,V(n.lng)),jo(s,s,V(n.lat)),Br(s,s,[e._pixelsPerMercatorPixel,e._pixelsPerMercatorPixel,1]),Float32Array.from(s)}pointCoordinate(e,i,n,s){return Re(e,i,n,!0)||new Or(0,0)}pointCoordinate3D(e,i,n){const s=this.pointCoordinate(e,i,n,0);return[s.x,s.y,s.z]}isPointAboveHorizon(e,i){return!Re(e,i.x,i.y,!1)}farthestPixelDistance(e){const i=(function(s,l){const u=s.cameraToCenterDistance,f=s._centerAltitude*l,p=s._camera,g=s._camera.forward(),x=er([],Ci([],g,-u),[0,0,f]),b=s.worldSize/(2*Math.PI),w=[0,0,-b],S=s.width/s.height,E=Math.tan(s.fovAboveCenter),M=Ci([],p.up(),E),C=Ci([],p.right(),E*S),R=ui([],er([],er([],g,M),C)),F=[];let z;if(new nf(x,R).closestPointOnSphere(w,b,F)){const j=er([],F,w),$=ki([],j,x);z=Math.cos(s.fovAboveCenter)*xr($)}else{const j=ki([],x,w),$=ki([],w,x);ui($,$);const q=xr(j)-b;z=Math.sqrt(q*(q+2*b));const ie=Math.acos(z/(b+q))-Math.acos(Xi(g,$));z*=Math.cos(ie)}return 1.01*z})(e,this.pixelsPerMeter(e.center.lat,e.worldSize)),n=oi(e.zoom);if(n>0){const s=s0(e,Yr(1,e.center.lat)*e.worldSize),l=e.worldSize/(2*Math.PI),u=Math.max(e.width,e.height)/e.worldSize*Math.PI;return ft(i,s+l*(1-Math.cos(u)),Math.pow(n,10))}return i}upVector(e,i,n){return xt(i,n,e,1)}upVectorScale(e){return{metersToTile:Pe(yt(je(e)))}}}function d0(r){const e=r.parallels,i=!!e&&Math.abs(e[0]+e[1])<.01;switch(r.name){case"mercator":return new l0(r);case"equirectangular":return new Hw(r);case"naturalEarth":return new Zw(r);case"equalEarth":return new $w(r);case"winkelTripel":return new Ww(r);case"albers":return i?new h0(r):new Gw(r);case"lambertConformalConic":return i?new h0(r):new qw(r);case"globe":return new Xw(r)}throw new Error(`Invalid projection name: ${r.name}`)}class Yw{constructor(e,i){this.lastParams=null,this.lastAllFeaturesIndex=-2,this.appearancesVersion=i,this.appearances=e;const n=e.map(s=>(function(l){if(!l.condition)return{featureDependent:!1,stateDependent:!1,zoomDependent:!1,pitchDependent:!1,brightnessDependent:!1,worldviewDependent:!1};const u=l.condition.expression;return{featureDependent:!ya(u),stateDependent:!kn(u),zoomDependent:!Ao(u,["zoom"]),pitchDependent:!Ao(u,["pitch"]),brightnessDependent:!Ao(u,["brightness","measure-light"]),worldviewDependent:!Ao(u,["worldview"])}})(s));this.anyFeatureDependent=n.some(s=>s.featureDependent),this.anyStateDependent=n.some(s=>s.stateDependent)}update(e,i){const n=this.lastParams,s=!n||n.zoom!==e.zoom||n.pitch!==(e.pitch||0)||n.brightness!==(e.brightness||0)||n.worldview!==e.worldview;this.lastParams={zoom:e.zoom,pitch:e.pitch||0,brightness:e.brightness||0,worldview:e.worldview};const l=i&&this.anyStateDependent;if(!s&&!l&&this.lastAllFeaturesIndex!==-2)return{kind:"no-changes"};if(!this.anyFeatureDependent&&!l){const u=this.evaluateAllFeatures(e);return u===this.lastAllFeaturesIndex?{kind:"no-changes"}:(this.lastAllFeaturesIndex=u,{kind:"all-features",appearanceIndex:u})}return{kind:"per-feature"}}evaluateAllFeatures(e){for(let i=0;i<this.appearances.length;i++){const n=this.appearances[i];if(n.condition&&n.condition.evaluate(e,void 0,void 0,void 0))return i}return-1}}const Jw=Ns.types,Kw=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Of(r,e,i,n,s,l,u,f,p,g,x,b,w){const S=f?Math.min(Xc,Math.round(f[0])):0,E=f?Math.min(Xc,Math.round(f[1])):0;r.emplaceBack(e,i,Math.round(32*n),Math.round(32*s),l,u,(S<<1)+(p?1:0),0+(E<<1),16*g,16*x,256*b,256*w)}function Ff(r,e,i){r.emplaceBack(e,i)}function Bf(r,e,i,n,s,l,u){r.emplaceBack(e,i,n,s,l,u)}const v_=(r,e,i,n)=>{for(let s=0;s<e;s++)r.emplaceBack(i[0],i[1],i[2],n[0],n[1],n[2])};function vh(r,e,i,n,s){r.emplaceBack(e,i,n,s),r.emplaceBack(e,i,n,s),r.emplaceBack(e,i,n,s),r.emplaceBack(e,i,n,s)}function Qw(r){for(const e of r.sections)if(K_(e.text))return!0;return!1}const bh=12;class by{constructor(e){this.layoutVertexArray=new Bd,this.indexArray=new Ai,this.programConfigurations=e,this.segments=new di,this.dynamicLayoutVertexArray=new ns,this.opacityVertexArray=new Qu,this.placedSymbolArray=new cm,this.iconTransitioningVertexArray=new en,this.globeExtVertexArray=new kd,this.zOffsetVertexArray=new Sr,this.orientationVertexArray=new jd,this.symbolInstanceIndices=[],this.uboBinder=null,this.featureIdArray=new Sr,this.featureIdBuffer=null,this.cachedBatchIndices=null,this.cachedBatchSegments=null}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0&&this.iconTransitioningVertexArray.length===0}getBatchGrouping(e){const i=e.get().length===this.segments.get().length;if(i&&this.cachedBatchIndices&&this.cachedBatchSegments)return{batchIndices:this.cachedBatchIndices,batchSegments:this.cachedBatchSegments};const n=new Map;for(const u of e.get()){const f=u.batchIndex!==void 0?u.batchIndex:0;n.has(f)||n.set(f,[]),n.get(f).push(u)}const s=Array.from(n.keys()).sort((u,f)=>u-f),l=new Map;for(const u of s){const f=n.get(u);l.set(u,new di(f))}return i&&(this.cachedBatchIndices=s,this.cachedBatchSegments=l),{batchIndices:s,batchSegments:l}}snapshotSymbolVertexData(e,i){const n=e*bh;return this.layoutVertexArray.uint16.slice(n,n+i*bh)}restoreSymbolVertexData(e,i){this.layoutVertexArray.uint16.set(i,e*bh)}updateSymbolVertexData(e,i,n,s,l,u,f,p,g,x,b,w,S){const E=this.layoutVertexArray.uint16,M=e*bh;E[M]=i,E[M+1]=n,E[M+2]=s,E[M+3]=l,E[M+4]=u,E[M+5]=f,E[M+6]=p,E[M+7]=g,E[M+8]=x,E[M+9]=b,E[M+10]=w,E[M+11]=S}upload(e,i,n,s,l,u){this.isEmpty()||(n&&(this.cachedBatchIndices=null,this.cachedBatchSegments=null,this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Y1.members,!!u),this.indexBuffer=e.createIndexBuffer(this.indexArray,i),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,K1.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,Kw,!0),this.iconTransitioningVertexArray.length>0&&(this.iconTransitioningVertexBuffer=e.createVertexBuffer(this.iconTransitioningVertexArray,iw.members,!0)),this.globeExtVertexArray.length>0&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,J1.members,!0)),!this.zOffsetVertexBuffer&&(this.zOffsetVertexArray.length>0||l)&&(this.zOffsetVertexBuffer=e.createVertexBuffer(this.zOffsetVertexArray,Q1.members,!0)),!this.orientationVertexBuffer&&this.orientationVertexArray&&this.orientationVertexArray.length>0&&(this.orientationVertexBuffer=e.createVertexBuffer(this.orientationVertexArray,tw.members,!0)),this.opacityVertexBuffer.itemSize=1,this.featureIdArray&&this.featureIdArray.length>0&&(this.featureIdBuffer=e.createVertexBuffer(this.featureIdArray,ew.members,!1))),(n||s)&&(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())}}et(by,"SymbolBuffers",{omit:["cachedBatchIndices","cachedBatchSegments"]});class wy{constructor(e,i,n){this.layoutVertexArray=new e,this.layoutAttributes=i,this.indexArray=new n,this.segments=new di,this.collisionVertexArray=new th,this.collisionVertexArrayExt=new ns}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,rw.members,!0),this.collisionVertexBufferExt=e.createVertexBuffer(this.collisionVertexArrayExt,nw.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy(),this.collisionVertexBufferExt.destroy())}}et(wy,"CollisionBuffers");class Fo{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(u=>u.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=Ot([]),this.placementViewportMatrix=Ot([]);const i=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=Wc(this.zoom,i["text-size"],this.worldview,e.availableImages),this.iconSizeData=Wc(this.zoom,i["icon-size"],this.worldview,e.availableImages);const n=this.layers[0].layout,s=n.get("symbol-sort-key"),l=n.get("symbol-z-order");this.lut=e.lut,this.canOverlap=n.get("text-allow-overlap")||n.get("icon-allow-overlap")||n.get("text-ignore-placement")||n.get("icon-ignore-placement"),this.sortFeaturesByKey=l!=="viewport-y"&&s.constantOr(1)!==void 0,this.sortFeaturesByY=(l==="viewport-y"||l==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,this.writingModes=n.get("text-writing-mode").map(u=>zn[u]),this.stateDependentLayerIds=this.layers.filter(u=>u.isStateDependent()).map(u=>u.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=new Map}hasAnyAppearanceLayoutProperty(e){const i=this.layers[0].getAppearances();if(!i||i.length===0)return!1;const n=Array.isArray(e)?e:[e];return i.some(s=>n.some(l=>s.hasLayoutProperty(l)))}getAppearanceFeatureData(e){return this.featureAppearanceData.get(e)}createArrays(){this.text=new by(new An(this.layers,{zoom:this.zoom,lut:this.lut},e=>e.startsWith("text")||e.startsWith("symbol"))),this.icon=new by(new An(this.layers,{zoom:this.zoom,lut:this.lut},e=>e.startsWith("icon")||e.startsWith("symbol"))),this.disableSymbolUBO||(this.text.uboBinder=new iy(this.layers[0],this.zoom,this.lut,!0,"",this.maxUniformBufferBindings,this.maxUniformBlockSizeDwords),this.icon.uboBinder=new iy(this.layers[0],this.zoom,this.lut,!1,"",this.maxUniformBufferBindings,this.maxUniformBlockSizeDwords)),this.glyphOffsetArray=new hm,this.lineVertexArray=new co,this.symbolInstances=new qd}calculateGlyphDependencies(e,i,n,s,l){for(const u of e){const f=u.codePointAt(0);if(f===void 0)break;if(i[f]=!0,s&&l&&f<=65535){const p=If[u];p&&(i[p.charCodeAt(0)]=!0)}}}calculateEffectiveAppearanceIconSize(e,i,n,s,l,u,f){if(!e.hasLayoutProperty("icon-size"))return f*u;let p=1;const g=e.getUnevaluatedLayoutProperty("icon-size"),x=Wc(this.zoom,g,this.worldview,l),b=gh(x,i);if(x.kind!=="constant"&&x.kind!=="camera"||(p=b.uSize),x.kind==="composite"){const{minZoom:w,maxZoom:S}=x,E=g.possiblyEvaluate(new Wt(w,{worldview:this.worldview}),s),M=g.possiblyEvaluate(new Wt(S,{worldview:this.worldview}),s),C=E.evaluate(n,{},s,l);p=C+(M.evaluate(n,{},s,l)-C)*b.uSizeT}return x.kind==="source"&&(p=g.possiblyEvaluate(new Wt(this.zoom,{worldview:this.worldview}),s).evaluate(n,{},s,l)),p*u}updateFootprints(e,i){}updateReplacement(e,i){if(i.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=i.updateTime;const n=i.getReplacementRegionsForTile(e.toUnwrapped(),!0);return!Um(this.activeReplacements,n)&&(this.activeReplacements=n,!0)}getResolvedImageFromTokens(e){return typeof e=="string"?Vr.build(e):e}populate(e,i,n,s){const l=this.layers[0],u=l.layout,f=this.projection.name==="globe",p=u.get("text-font"),g=u.get("text-field"),x=u.get("icon-image"),[b,w]=u.get("icon-size-scale-range"),S=re(i.scaleFactor||1,b,w),[E,M]=u.get("text-size-scale-range"),C=re(i.scaleFactor||1,E,M),R=(g.value.kind!=="constant"||g.value.value instanceof zr&&!g.value.value.isEmpty()||g.value.value.toString().length>0)&&(p.value.kind!=="constant"||p.value.value.length>0),F=x.value.kind!=="constant"||!!x.value.value||Object.keys(x.parameters).length>0,z=this.hasAnyAppearanceLayoutProperty("icon-image"),j=u.get("symbol-sort-key");if(this.features=[],this.featureAppearanceData=new Map,!R&&!F&&!z)return;const $=i.iconDependencies,q=i.glyphDependencies,ie=i.availableImages,W=new Wt(this.zoom,{worldview:this.worldview,activeFloors:i.activeFloors}),Q=Y=>{const ee=Y.id.toString();$.has(ee)?$.get(ee).push(Y):$.set(ee,[Y])};for(const Y of e){const{feature:ee,id:me,index:ge,sourceLayerIndex:Te}=Y,Ae=l._featureFilter.needGeometry,Ie=$n(ee,Ae);if(!l._featureFilter.filter(W,Ie,n))continue;if(Ae||(Ie.geometry=gn(ee,n,s)),f&&ee.type!==1&&n.z<=5){const De=Ie.geometry,Ge=.98078528056,$e=(Je,Qe)=>Xi(xt(Je.x,Je.y,n,1),xt(Qe.x,Qe.y,n,1))<Ge;for(let Je=0;Je<De.length;Je++)De[Je]=dg(De[Je],$e)}let Fe,xe;if(R){const De=l.getValueAndResolveTokens("text-field",Ie,n,ie),Ge=zr.factory(De);Qw(Ge)&&(this.hasRTLText=!0),(!this.hasRTLText||Md()==="unavailable"||this.hasRTLText&&ao.isParsed())&&(Fe=sw(Ge,l,Ie))}if(F){const De=l.getValueAndResolveTokens("icon-image",Ie,n,ie);xe=this.getResolvedImageFromTokens(De)}const Se=this.layers[0];let Me=!1;if(!xe&&z){const De=Se.getAppearances();for(const Ge of De)if(Ge.getLayoutProperty("icon-image")){const $e=Se.getAppearanceValueAndResolveTokens(Ge,"icon-image",Ie,n,ie);if($e){xe=this.getResolvedImageFromTokens($e),Me=!0;break}}}if(!Fe&&!xe)continue;const ze=this.sortFeaturesByKey?j.evaluate(Ie,{},n):void 0,Le={id:me,text:Fe,icon:xe,index:ge,sourceLayerIndex:Te,geometry:Ie.geometry,properties:ee.properties,type:Jw[ee.type],sortKey:ze};if(this.features.push(Le),this.featureAppearanceData.set(ge,{id:me,properties:ee.properties,usesAppearanceIconAsPlaceholder:Me}),xe){const De=Se._unevaluatedLayout._values,{iconPrimary:Ge,iconSecondary:$e}=Pf(xe,this.iconSizeData,De["icon-size"],n,this.zoom,Le,this.pixelRatio,S,this.worldview,ie);Q(Ge),$e&&(this.hasAnySecondaryIcon=!0,Q($e))}const We=Se.getAppearances();if(We.length!==0&&We.forEach(De=>{if(!De.getLayoutProperty("icon-image"))return;const Ge=this.getCombinedIconPrimary(De,Se,Ie,n,ie,Le,S);Ge&&Q(Ge)}),Fe){const De=p.evaluate(Ie,{},n).join(","),Ge=u.get("text-rotation-alignment")==="map"&&u.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.includes(zn.vertical);for(const $e of Fe.sections)if($e.image){const Je=$e.image.getPrimary().scaleSelf(this.pixelRatio*C),Qe=Je.id.toString(),ct=$.get(Qe)||[];ct.push(Je),$.set(Qe,ct)}else{const Je=Id(Fe.toString()),Qe=$e.fontStack||De,ct=q[Qe]=q[Qe]||{};this.calculateGlyphDependencies($e.text,ct,Ge,this.allowVerticalPlacement,Je)}}}if(u.get("symbol-placement")==="line"&&(this.features=(function(Y){const ee={},me={},ge=[];let Te=0;function Ae(Se){ge.push(Y[Se]),Te++}function Ie(Se,Me,ze){const Le=me[Se];return delete me[Se],me[Me]=Le,ge[Le].geometry[0].pop(),ge[Le].geometry[0]=ge[Le].geometry[0].concat(ze[0]),Le}function Fe(Se,Me,ze){const Le=ee[Me];return delete ee[Me],ee[Se]=Le,ge[Le].geometry[0].shift(),ge[Le].geometry[0]=ze[0].concat(ge[Le].geometry[0]),Le}function xe(Se,Me,ze){const Le=ze?Me[0].at(-1):Me[0][0];return`${Se}:${Le.x}:${Le.y}`}for(let Se=0;Se<Y.length;Se++){const Me=Y[Se],ze=Me.geometry,Le=Me.text?Me.text.toString():null;if(!Le){Ae(Se);continue}const We=xe(Le,ze),De=xe(Le,ze,!0);if(We in me&&De in ee&&me[We]!==ee[De]){const Ge=Fe(We,De,ze),$e=Ie(We,De,ge[Ge].geometry);delete ee[We],delete me[De],me[xe(Le,ge[$e].geometry,!0)]=$e,ge[Ge].geometry=null}else We in me?Ie(We,De,ze):De in ee?Fe(We,De,ze):(Ae(Se),ee[We]=Te-1,me[De]=Te-1)}return ge.filter(Se=>Se.geometry)})(this.features)),u.get("symbol-elevation-reference")==="hd-road-markup"){if(this.elevationType="road",i.elevationFeatures){!this.elevationFeatures&&i.elevationFeatures.length>0&&(this.elevationFeatures=[],this.elevationFeatureIdToIndex=new Map);for(const Y of i.elevationFeatures)this.elevationFeatureIdToIndex.set(Y.id,this.elevationFeatures.length),this.elevationFeatures.push(Y)}}else u.get("symbol-z-elevate")&&(this.elevationType="offset");this.elevationType!=="none"&&(this.zOffsetBuffersNeedUpload=!0),this.sortFeaturesByKey&&this.features.sort((Y,ee)=>Y.sortKey-ee.sortKey)}getCombinedIconPrimary(e,i,n,s,l,u,f){let p,g;if(e.hasLayoutProperty("icon-image")){const x=i.getAppearanceValueAndResolveTokens(e,"icon-image",n,s,l);p=this.getResolvedImageFromTokens(x)}else{const x=i.getValueAndResolveTokens("icon-image",n,s,l);p=this.getResolvedImageFromTokens(x)}if(p){const x=e.hasLayoutProperty("icon-size")?e.getUnevaluatedLayoutProperty("icon-size"):i._unevaluatedLayout._values["icon-size"];g=Pf(p,Wc(this.zoom,x,this.worldview,l),x,s,this.zoom,u,this.pixelRatio,f,this.worldview,l).iconPrimary}return g}updateSymbolInstanceIconVertices(e,i,n,s,l,u){const{canonical:f,availableImages:p,globalProperties:g,layer:x,iconScaleFactor:b,featureState:w,layoutIconOffset:S,layoutIconSize:E,layoutIconRotate:M}=u;if(e.placedIconSymbolIndex<0)return{vertexOffsetDelta:0,hasChanges:!1};if(i.activeAppearanceIndex===n)return{vertexOffsetDelta:e.numIconVertices,hasChanges:!1};const C=n>=0?x.appearances[n]:null;if(C){const R=this.getCombinedIconPrimary(C,x,s,f,p,{sortKey:void 0,text:void 0,icon:null,index:e.featureIndex,sourceLayerIndex:e.featureIndex,geometry:[],properties:i.properties,type:"Point",id:i.id},b);if(!R)return{vertexOffsetDelta:0,hasChanges:!1};const F=R.toString(),z=this.iconAtlasPositions&&this.iconAtlasPositions.get(F);if(z){const{appearanceIconOffset:j,appearanceIconRotate:$}=Qv(C,x,s,f,S,M,E,b);let q=c_(z,void 0,j,x.layout.get("icon-anchor").evaluate(s,w,f));const ie=z.sdf,W=x.layout.get("icon-text-fit").constantOr("none");W!=="none"&&i.textShaping&&i.iconTextFitPadding&&i.fontScale&&(q=ay(q,i.textShaping,W,i.iconTextFitPadding,j,i.fontScale));const Q=this.calculateEffectiveAppearanceIconSize(C,g.zoom,s,f,p,b,E),Y=0,ee=1+(Math.min(Xc,Math.round(Q*Fa))<<1),me=my(q,$,ie,W!=="none",b);i.isUsingAppearanceIconVertexData||(i.isUsingAppearanceIconVertexData=!0,i.layoutBasedIconVertexData=this.icon.snapshotSymbolVertexData(l,e.numIconVertices));const ge=Math.floor(e.numIconVertices/4),Te=Math.min(me.length,ge);let Ae=l;for(let Fe=0;Fe<Te;++Fe){const xe=me[Fe],Se=i.layoutBasedIconVertexData[0]||e.tileAnchorX,Me=i.layoutBasedIconVertexData[1]||e.tileAnchorY,ze=16*xe.pixelOffsetTL.x,Le=16*xe.pixelOffsetTL.y,We=16*xe.pixelOffsetBR.x,De=16*xe.pixelOffsetBR.y,Ge=16*xe.minFontScaleX,$e=16*xe.minFontScaleY;this.icon.updateSymbolVertexData(Ae,Se,Me,Math.round(32*xe.tl.x),Math.round(32*xe.tl.y),xe.texPrimary.x,xe.texPrimary.y,Y,ee,ze,Le,Ge,$e),this.icon.updateSymbolVertexData(Ae+1,Se,Me,Math.round(32*xe.tr.x),Math.round(32*xe.tr.y),xe.texPrimary.x+xe.texPrimary.w,xe.texPrimary.y,Y,ee,We,Le,Ge,$e),this.icon.updateSymbolVertexData(Ae+2,Se,Me,Math.round(32*xe.bl.x),Math.round(32*xe.bl.y),xe.texPrimary.x,xe.texPrimary.y+xe.texPrimary.h,Y,ee,ze,De,Ge,$e),this.icon.updateSymbolVertexData(Ae+3,Se,Me,Math.round(32*xe.br.x),Math.round(32*xe.br.y),xe.texPrimary.x+xe.texPrimary.w,xe.texPrimary.y+xe.texPrimary.h,Y,ee,We,De,Ge,$e),Ae+=4}const Ie=e.numIconVertices-4*Te;for(let Fe=0;Fe<Ie;++Fe)this.icon.updateSymbolVertexData(Ae+Fe,0,0,0,0,0,0,0,0,0,0,0,0);return{vertexOffsetDelta:e.numIconVertices,hasChanges:!0}}}else{if(i.usesAppearanceIconAsPlaceholder)return this.icon.updateSymbolVertexData(l,0,0,0,0,0,0,0,0,0,0,0,0),this.icon.updateSymbolVertexData(l+1,0,0,0,0,0,0,0,0,0,0,0,0),this.icon.updateSymbolVertexData(l+2,0,0,0,0,0,0,0,0,0,0,0,0),this.icon.updateSymbolVertexData(l+3,0,0,0,0,0,0,0,0,0,0,0,0),{vertexOffsetDelta:e.numIconVertices,hasChanges:!0};if(i.isUsingAppearanceIconVertexData)return this.icon.restoreSymbolVertexData(l,i.layoutBasedIconVertexData),i.isUsingAppearanceIconVertexData=!1,{vertexOffsetDelta:i.layoutBasedIconVertexData.length/bh,hasChanges:!0}}return{vertexOffsetDelta:e.numIconVertices,hasChanges:!1}}updateSymbolInstanceTextVertices(e,i,n,s,l,u){const{canonical:f,layer:p,textScaleFactor:g,imageMap:x,featureState:b,layoutTextOffset:w,layoutTextSize:S,layoutTextRotate:E,layoutMinZoomSize:M,layoutMaxZoomSize:C,layoutTextSizeMinZoom:R,layoutTextSizeMaxZoom:F,availableImages:z}=u,j=e.numHorizontalGlyphVertices>0||e.numVerticalGlyphVertices>0;if(!j)return{vertexOffsetDelta:j?e.numHorizontalGlyphVertices+e.numVerticalGlyphVertices:0,hasChanges:!1};if(i.activeAppearanceIndex===n)return{vertexOffsetDelta:e.numHorizontalGlyphVertices+e.numVerticalGlyphVertices,hasChanges:!1};const $=n>=0?p.appearances[n]:null;if($&&i.textShaping){const{appearanceTextOffset:q,appearanceTextRotate:ie,appearanceTextSize:W}=e0($,p,s,f,w,E,S);i.fontScale=n0(W,i.textScaleFactor);const Q=$.getUnevaluatedLayoutProperty("text-size");let Y=this.textSizeData,ee=R,me=F;$.hasLayoutProperty("text-size")&&(Y=Wc(this.zoom,Q,this.worldview,z),ee=this.textSizeData.kind==="composite"?this.textSizeData.minZoom:0,me=this.textSizeData.kind==="composite"?this.textSizeData.maxZoom:0);const ge=i.textShaping.bottom-w[1],Te=i.textShaping.left-w[0],Ae=i.textShaping.right-w[0];i.textShaping.top=q[1]+(i.textShaping.top-w[1]),i.textShaping.bottom=q[1]+ge,i.textShaping.left=q[0]+Te,i.textShaping.right=q[0]+Ae;const Ie=Jv(0,i.textShaping,q,p,!1,s,x,this.allowVerticalPlacement,ie),Fe=W&&Y.kind==="composite"?Q.possiblyEvaluate(new Wt(ee,{}),f).evaluate(s,b,f):M,xe=W&&Y.kind==="composite"?Q.possiblyEvaluate(new Wt(me,{}),f).evaluate(s,b,f):C,Se=xy($.name,Y,W,g,Fe,xe),Me=Array.isArray(Se)?Se[1]:W,ze=0,Le=1+(Math.min(Xc,Math.round(Me*Fa))<<1);i.isUsingAppearanceTextVertexData||(i.isUsingAppearanceTextVertexData=!0,i.layoutBasedTextVertexData=this.text.snapshotSymbolVertexData(l,e.numHorizontalGlyphVertices+e.numVerticalGlyphVertices));for(let We=0;We<Ie.length&&We<(e.numHorizontalGlyphVertices+e.numVerticalGlyphVertices)/4;++We){const De=Ie[We],Ge=De.glyphOffset[1],$e=e.tileAnchorX,Je=e.tileAnchorY,Qe=l+4*We;this.text.updateSymbolVertexData(Qe,$e,Je,Math.round(32*De.tl.x),Math.round(32*(Ge+De.tl.y)),De.texPrimary.x,De.texPrimary.y,ze,Le,De.pixelOffsetTL.x,De.pixelOffsetTL.y,De.minFontScaleX,De.minFontScaleY),this.text.updateSymbolVertexData(Qe+1,$e,Je,Math.round(32*De.tr.x),Math.round(32*(Ge+De.tr.y)),De.texPrimary.x+De.texPrimary.w,De.texPrimary.y,ze,Le,De.pixelOffsetBR.x,De.pixelOffsetTL.y,De.minFontScaleX,De.minFontScaleY),this.text.updateSymbolVertexData(Qe+2,$e,Je,Math.round(32*De.bl.x),Math.round(32*(Ge+De.bl.y)),De.texPrimary.x,De.texPrimary.y+De.texPrimary.h,ze,Le,De.pixelOffsetTL.x,De.pixelOffsetBR.y,De.minFontScaleX,De.minFontScaleY),this.text.updateSymbolVertexData(Qe+3,$e,Je,Math.round(32*De.br.x),Math.round(32*(Ge+De.br.y)),De.texPrimary.x+De.texPrimary.w,De.texPrimary.y+De.texPrimary.h,ze,Le,De.pixelOffsetBR.x,De.pixelOffsetBR.y,De.minFontScaleX,De.minFontScaleY)}return{vertexOffsetDelta:e.numHorizontalGlyphVertices+e.numVerticalGlyphVertices,hasChanges:!0}}return i.isUsingAppearanceTextVertexData?(this.text.restoreSymbolVertexData(l,i.layoutBasedTextVertexData),i.isUsingAppearanceTextVertexData=!1,{vertexOffsetDelta:i.layoutBasedTextVertexData.length/bh,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,i,n,s,l,u,f,p){if(this.text.uboBinder||this.text.programConfigurations.updatePaintArrays(e,i,l,n,s,u,f,this.worldview),this.icon.uboBinder||this.icon.programConfigurations.updatePaintArrays(e,i,l,n,s,u,f,this.worldview),p){if(u)this.text.uboBinder&&!this.text.uboBinder.isLightConstant&&this.text.uboBinder.updateDynamicExpressions(l[0],i,p,n,e,f),this.icon.uboBinder&&!this.icon.uboBinder.isLightConstant&&this.icon.uboBinder.updateDynamicExpressions(l[0],i,p,n,e,f);else if(Object.keys(e).length>0){const g=new Set(Object.keys(e).map(x=>{const b=Number(x);return!isNaN(b)&&Number.isSafeInteger(b)&&String(b)===x?b:x}));this.text.uboBinder&&this.text.uboBinder.updateFeatures(g,l[0],i,p,n,e,f),this.icon.uboBinder&&this.icon.uboBinder.updateFeatures(g,l[0],i,p,n,e,f)}}}updateRoadElevation(e){if(this.elevationType!=="road"||!this.elevationFeatures||this.elevationStateComplete)return;this.elevationStateComplete=!0,this.hasAnyZOffset=!1;let i=!1;const n=Cn(e),s=1/n;let l=!1,u=!1;for(let f=0;f<this.symbolInstances.length;f++){const p=this.symbolInstances.get(f),g=wr(1,0,0),x=wr(0,1,0),{numHorizontalGlyphVertices:b,numVerticalGlyphVertices:w,numIconVertices:S,numVerticalIconVertices:E}=p,M=b>0||w>0,C=S>0,R=this.elevationFeatures[p.elevationFeatureIndex];if(R){const F=new Ue(p.tileAnchorX,p.tileAnchorY),z=.075+R.pointElevation(F);p.zOffset!==z&&(i=!0,p.zOffset=z),z!==0&&(this.hasAnyZOffset=!0);const j=R.computeSlopeNormal(F,s),$=Ql(ys(),wr(0,0,1),j);Ua(g,g,$),Ua(x,x,$),g[2]*=n,x[2]*=n,g[0]===1&&g[1]===0&&g[2]===0&&x[0]===0&&x[1]===1&&x[2]===0||(l=l||M,u=u||C)}if(M&&(v_(this.text.orientationVertexArray,b,g,x),v_(this.text.orientationVertexArray,w,g,x)),C){const{placedIconSymbolIndex:F,verticalPlacedIconSymbolIndex:z}=p;F>=0&&v_(this.icon.orientationVertexArray,S,g,x),z>=0&&v_(this.icon.orientationVertexArray,E,g,x)}}l||(this.text.orientationVertexArray=void 0),u||(this.icon.orientationVertexArray=void 0),i&&(this.zOffsetBuffersNeedUpload=!0,this.zOffsetSortDirty=!0)}updateZOffset(){const e=(l,u,f)=>{n+=u,n>l.length&&l.resize(n);for(let p=-u;p<0;p++)l.emplace(p+n,f)},i=(l,u,f)=>{s+=u,s>l.length&&l.resize(s);for(let p=-u;p<0;p++)l.emplace(p+s,f)};if(!this.zOffsetBuffersNeedUpload)return;this.zOffsetBuffersNeedUpload=!1;let n=0,s=0;for(let l=0;l<this.symbolInstances.length;l++){const u=this.symbolInstances.get(l),{numHorizontalGlyphVertices:f,numVerticalGlyphVertices:p,numIconVertices:g}=u,x=u.zOffset,b=g>0;if((f>0||p>0)&&(e(this.text.zOffsetVertexArray,f,x),e(this.text.zOffsetVertexArray,p,x)),b){const{placedIconSymbolIndex:w,verticalPlacedIconSymbolIndex:S}=u;w>=0&&i(this.icon.zOffsetVertexArray,g,x),S>=0&&i(this.icon.zOffsetVertexArray,u.numVerticalIconVertices,x)}}this.text.zOffsetVertexBuffer&&this.text.zOffsetVertexBuffer.updateData(this.text.zOffsetVertexArray),this.icon.zOffsetVertexBuffer&&this.icon.zOffsetVertexBuffer.updateData(this.icon.zOffsetVertexArray)}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e,i,n,s,l){!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),this.hasAppearances===null&&(this.hasAppearances=this.layers.some(u=>u.appearances&&u.appearances.length>0)),this.icon.upload(e,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload,this.hasAppearances),this.uploaded=!0}updateAppearances(e,i,n,s,l,u=!1){const f={hasLayoutChanges:!1,hasUboChanges:!1};if(!e||!n||!this.featureAppearanceData)return f;const p=i||{},g=this.icon.layoutVertexArray&&this.icon.layoutVertexArray.length>0&&this.icon.layoutVertexArray.arrayBuffer,x=this.text.layoutVertexArray&&this.text.layoutVertexArray.length>0&&this.text.layoutVertexArray.arrayBuffer;if(!g&&!x)return f;const b=this.layers[0],w=b.layout;this.featureAppearances&&this.featureAppearances.appearancesVersion===b.appearancesVersion||(this.featureAppearances=new Yw(b.appearances,b.appearancesVersion));const S=this.featureAppearances.update(s,u);if(S.kind==="no-changes")return f;let E=1,M=0,C=!1,R=!1;if(g){const[q,ie]=w.get("icon-size-scale-range");E=re(1,q,ie)}let F=1,z=0,j=!1;if(x){const[q,ie]=w.get("text-size-scale-range");F=re(1,q,ie)}const $=new Map;if(l&&n)for(const q of n){const ie=l.getImage(q,b.scope);if(ie){const W=new Fn(q.toString());$.set(W.toString(),ie)}}for(let q=0;q<this.symbolInstances.length;q++){const ie=this.symbolInstances.get(q),W=this.getAppearanceFeatureData(ie.featureIndex);if(!W)continue;const Q=W.id,Y=Q!==void 0?p[String(Q)]:void 0,ee={type:"Point",id:W.id,properties:W.properties,geometry:[]};let me;if(S.kind==="all-features")me=S.appearanceIndex;else{const Te=b.appearances?b.appearances.findIndex(Ae=>Ae.isActive({globals:s,feature:ee,canonical:e,featureState:Y})):-1;me=Te>=0?Te:-1}const ge=W.activeAppearanceIndex!==me;if(x){const Te=w.get("text-size"),Ae=this.textSizeData.kind==="composite"?this.textSizeData.minZoom:0,Ie=this.textSizeData.kind==="composite"?this.textSizeData.maxZoom:0,Fe={canonical:e,layer:b,featureState:Y,availableImages:n,textScaleFactor:F,imageMap:$,layoutTextOffset:w.get("text-offset").evaluate(ee,Y,e).map(Se=>Se*dr),layoutTextSize:Te.evaluate(ee,Y,e),layoutTextRotate:w.get("text-rotate").evaluate(ee,Y,e),layoutMinZoomSize:Te.evaluate(ee,{zoom:Ae},e),layoutMaxZoomSize:Te.evaluate(ee,{zoom:Ie},e),layoutTextSizeMinZoom:Ae,layoutTextSizeMaxZoom:Ie},xe=this.updateSymbolInstanceTextVertices(ie,W,me,ee,z,Fe);z+=xe.vertexOffsetDelta,j=j||xe.hasChanges}if(g){const Te={canonical:e,layer:b,featureState:Y,availableImages:n,globalProperties:s,iconScaleFactor:E,layoutIconOffset:w.get("icon-offset").evaluate(ee,Y,e),layoutIconSize:w.get("icon-size").evaluate(ee,Y,e,n),layoutIconRotate:w.get("icon-rotate").evaluate(ee,Y,e)},Ae=this.updateSymbolInstanceIconVertices(ie,W,me,ee,M,Te);M+=Ae.vertexOffsetDelta,C=C||Ae.hasChanges}if(ge){const Te=ie.featureIndex,Ae=s?s.brightness:null,Ie=Y||{},Fe=me>=0?b.appearances[me]:null;this.text.uboBinder&&(this.text.uboBinder.layer=b,R=this.text.uboBinder.updateFeaturePaintForAppearance(Te,ee,Ie,e,n,Ae,Fe)||R),this.icon.uboBinder&&(this.icon.uboBinder.layer=b,R=this.icon.uboBinder.updateFeaturePaintForAppearance(Te,ee,Ie,e,n,Ae,Fe)||R)}W.activeAppearanceIndex=me}return C&&this.icon.layoutVertexBuffer&&this.icon.layoutVertexArray.arrayBuffer!==null&&this.icon.layoutVertexArray.length===this.icon.layoutVertexBuffer.length&&this.icon.layoutVertexBuffer.updateData(this.icon.layoutVertexArray),j&&this.text.layoutVertexBuffer&&this.text.layoutVertexArray.arrayBuffer!==null&&this.text.layoutVertexArray.length===this.text.layoutVertexBuffer.length&&this.text.layoutVertexBuffer.updateData(this.text.layoutVertexArray),{hasLayoutChanges:C||j,hasUboChanges:R}}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}getProjection(){return this.projectionInstance||(this.projectionInstance=d0(this.projection)),this.projectionInstance}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(e,i){const n=this.lineVertexArray.length;if(e.segment!==void 0)for(const{x:s,y:l}of i)this.lineVertexArray.emplaceBack(s,l);return{lineStartIndex:n,lineLength:this.lineVertexArray.length-n}}addSymbols(e,i,n,s,l,u,f,p,g,x,b,w,S,E,M,C,R,F){const z=e.indexArray,j=e.layoutVertexArray,$=e.globeExtVertexArray,q=F,ie=e.uboBinder?e.uboBinder.getCurrentBatchIndex():void 0,W=e.segments.prepareSegment(4*q,j,z,this.canOverlap?u.sortKey:void 0,ie),Q=this.glyphOffsetArray.length,Y=W.vertexLength,ee=this.allowVerticalPlacement&&f===zn.vertical?Math.PI/2:0,me=u.text&&u.text.sections;let ge=j.length,Te=-1;for(let Fe=0;Fe<i.length;Fe++){const{tl:xe,tr:Se,bl:Me,br:ze,texPrimary:Le,texSecondary:We,pixelOffsetTL:De,pixelOffsetBR:Ge,minFontScaleX:$e,minFontScaleY:Je,glyphOffset:Qe,isSDF:ct,sectionIndex:nt}=i[Fe],mt=W.vertexLength,Gt=Qe[1];if(Of(j,g.x,g.y,xe.x,Gt+xe.y,Le.x,Le.y,n,ct,De.x,De.y,$e,Je),Of(j,g.x,g.y,Se.x,Gt+Se.y,Le.x+Le.w,Le.y,n,ct,Ge.x,De.y,$e,Je),Of(j,g.x,g.y,Me.x,Gt+Me.y,Le.x,Le.y+Le.h,n,ct,De.x,Ge.y,$e,Je),Of(j,g.x,g.y,ze.x,Gt+ze.y,Le.x+Le.w,Le.y+Le.h,n,ct,Ge.x,Ge.y,$e,Je),p){const{x:wt,y:kt,z:Mt}=p.anchor,[Oi,Yt,jt]=p.up;Bf($,wt,kt,Mt,Oi,Yt,jt),Bf($,wt,kt,Mt,Oi,Yt,jt),Bf($,wt,kt,Mt,Oi,Yt,jt),Bf($,wt,kt,Mt,Oi,Yt,jt),vh(e.dynamicLayoutVertexArray,wt,kt,Mt,ee)}else vh(e.dynamicLayoutVertexArray,g.x,g.y,g.z,ee);if(C){const wt=We||Le;Ff(e.iconTransitioningVertexArray,wt.x,wt.y),Ff(e.iconTransitioningVertexArray,wt.x+wt.w,wt.y),Ff(e.iconTransitioningVertexArray,wt.x,wt.y+wt.h),Ff(e.iconTransitioningVertexArray,wt.x+wt.w,wt.y+wt.h)}if(z.emplaceBack(mt,mt+1,mt+2),z.emplaceBack(mt+1,mt+2,mt+3),W.vertexLength+=4,W.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(Qe[0]),(Fe===i.length-1||nt!==i[Fe+1].sectionIndex)&&(e.uboBinder||e.programConfigurations.populatePaintArrays(j.length,u,u.index,{},S,E,M,me&&me[nt],this.worldview),e.uboBinder&&e.featureIdArray)){const wt=e.uboBinder.populateUBO(u,u.index,E,S,M,me&&me[nt],void 0);Te=wt;const kt=j.length-ge;for(let Mt=0;Mt<kt;Mt++)e.featureIdArray.emplaceBack(wt);ge=j.length}}const Ae=F-i.length;if(Ae!==0&&(this._addNullVertices(Ae,j,n,p,$,e,C,W,z),e.uboBinder&&e.featureIdArray&&Te>=0)){const Fe=4*Ae;for(let xe=0;xe<Fe;xe++)e.featureIdArray.emplaceBack(Te)}const Ie=p?p.anchor:g;e.placedSymbolArray.emplaceBack(Ie.x,Ie.y,Ie.z,g.x,g.y,Q,this.glyphOffsetArray.length-Q,Y,x,b,g.segment,n?n[0]:0,n?n[1]:0,s[0],s[1],f,0,0,0,w,0),e.symbolInstanceIndices.push(R)}_addNullVertices(e,i,n,s,l,u,f,p,g){for(let x=0;x<e;x++){for(let w=0;w<4;w++)Of(i,0,0,0,0,0,0,n,!1,0,0,0,0),s&&Bf(l,0,0,0,0,0,0),vh(u.dynamicLayoutVertexArray,0,0,0,0),f&&Ff(u.iconTransitioningVertexArray,0,0);const b=p.vertexLength;g.emplaceBack(b,b+1,b+2),g.emplaceBack(b+1,b+2,b+3),p.vertexLength+=4,p.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(0)}}_commitLayoutVertex(e,i,n,s,l,u,f){e.emplaceBack(i,n,s,l,u,Math.round(f.x),Math.round(f.y))}_addCollisionDebugVertices(e,i,n,s,l,u,f){const p=n.segments.prepareSegment(4,n.layoutVertexArray,n.indexArray),g=p.vertexLength,x=f.tileAnchorX,b=f.tileAnchorY;for(let S=0;S<4;S++)n.collisionVertexArray.emplaceBack(0,0,0,0,0,0);this._commitDebugCollisionVertexUpdate(n.collisionVertexArrayExt,i,e.padding,f.zOffset),this._commitLayoutVertex(n.layoutVertexArray,s,l,u,x,b,new Ue(e.x1,e.y1)),this._commitLayoutVertex(n.layoutVertexArray,s,l,u,x,b,new Ue(e.x2,e.y1)),this._commitLayoutVertex(n.layoutVertexArray,s,l,u,x,b,new Ue(e.x2,e.y2)),this._commitLayoutVertex(n.layoutVertexArray,s,l,u,x,b,new Ue(e.x1,e.y2)),p.vertexLength+=4;const w=n.indexArray;w.emplaceBack(g,g+1),w.emplaceBack(g+1,g+2),w.emplaceBack(g+2,g+3),w.emplaceBack(g+3,g),p.primitiveLength+=4}_addTextDebugCollisionBoxes(e,i,n,s,l,u){for(let f=s;f<l;f++){const p=n.get(f),g=this.getSymbolInstanceTextSize(e,u,i,f);this._addCollisionDebugVertices(p,g,this.textCollisionBox,p.projectedAnchorX,p.projectedAnchorY,p.projectedAnchorZ,u)}}_addIconDebugCollisionBoxes(e,i,n,s,l,u){for(let f=s;f<l;f++){const p=n.get(f),g=this.getSymbolInstanceIconSize(e,i,u.placedIconSymbolIndex);this._addCollisionDebugVertices(p,g,this.iconCollisionBox,p.projectedAnchorX,p.projectedAnchorY,p.projectedAnchorZ,u)}}generateCollisionDebugBuffers(e,i,n){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new wy(eh,Sv.members,en),this.iconCollisionBox=new wy(eh,Sv.members,en);const s=gh(this.iconSizeData,e),l=gh(this.textSizeData,e,n);for(let u=0;u<this.symbolInstances.length;u++){const f=this.symbolInstances.get(u);this._addTextDebugCollisionBoxes(l,e,i,f.textBoxStartIndex,f.textBoxEndIndex,f),this._addTextDebugCollisionBoxes(l,e,i,f.verticalTextBoxStartIndex,f.verticalTextBoxEndIndex,f),this._addIconDebugCollisionBoxes(s,e,i,f.iconBoxStartIndex,f.iconBoxEndIndex,f),this._addIconDebugCollisionBoxes(s,e,i,f.verticalIconBoxStartIndex,f.verticalIconBoxEndIndex,f)}}getSymbolInstanceTextSize(e,i,n,s){const l=this.text.placedSymbolArray.get(i.rightJustifiedTextSymbolIndex>=0?i.rightJustifiedTextSymbolIndex:i.centerJustifiedTextSymbolIndex>=0?i.centerJustifiedTextSymbolIndex:i.leftJustifiedTextSymbolIndex>=0?i.leftJustifiedTextSymbolIndex:i.verticalPlacedTextSymbolIndex>=0?i.verticalPlacedTextSymbolIndex:s),u=ly(this.textSizeData,e,l)/dr;return this.tilePixelRatio*u}getSymbolInstanceIconSize(e,i,n){const s=this.icon.placedSymbolArray.get(n),l=ly(this.iconSizeData,e,s);return this.tilePixelRatio*l}_commitDebugCollisionVertexUpdate(e,i,n,s){e.emplaceBack(i,-n,-n,s),e.emplaceBack(i,n,-n,s),e.emplaceBack(i,n,n,s),e.emplaceBack(i,-n,n,s)}_updateTextDebugCollisionBoxes(e,i,n,s,l,u,f){for(let p=s;p<l;p++){const g=n.get(p),x=this.getSymbolInstanceTextSize(e,u,i,p);this._commitDebugCollisionVertexUpdate(this.textCollisionBox.collisionVertexArrayExt,x,g.padding,u.zOffset)}}_updateIconDebugCollisionBoxes(e,i,n,s,l,u,f){for(let p=s;p<l;p++){const g=n.get(p),x=this.getSymbolInstanceIconSize(e,i,u.placedIconSymbolIndex);this._commitDebugCollisionVertexUpdate(this.iconCollisionBox.collisionVertexArrayExt,x,g.padding,u.zOffset)}}updateCollisionDebugBuffers(e,i,n,s){if(!this.hasDebugData())return;this.hasTextCollisionBoxData()&&this.textCollisionBox.collisionVertexArrayExt.clear(),this.hasIconCollisionBoxData()&&this.iconCollisionBox.collisionVertexArrayExt.clear();const l=gh(this.iconSizeData,e,s),u=gh(this.textSizeData,e,n);for(let f=0;f<this.symbolInstances.length;f++){const p=this.symbolInstances.get(f);this._updateTextDebugCollisionBoxes(u,e,i,p.textBoxStartIndex,p.textBoxEndIndex,p,n),this._updateTextDebugCollisionBoxes(u,e,i,p.verticalTextBoxStartIndex,p.verticalTextBoxEndIndex,p,n),this._updateIconDebugCollisionBoxes(l,e,i,p.iconBoxStartIndex,p.iconBoxEndIndex,p,s),this._updateIconDebugCollisionBoxes(l,e,i,p.verticalIconBoxStartIndex,p.verticalIconBoxEndIndex,p,s)}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,i,n,s,l,u,f,p,g){const x={};if(i<n){const{x1:b,y1:w,x2:S,y2:E,padding:M,projectedAnchorX:C,projectedAnchorY:R,projectedAnchorZ:F,tileAnchorX:z,tileAnchorY:j,featureIndex:$}=e.get(i);x.textBox={x1:b,y1:w,x2:S,y2:E,padding:M,projectedAnchorX:C,projectedAnchorY:R,projectedAnchorZ:F,tileAnchorX:z,tileAnchorY:j},x.textFeatureIndex=$}if(s<l){const{x1:b,y1:w,x2:S,y2:E,padding:M,projectedAnchorX:C,projectedAnchorY:R,projectedAnchorZ:F,tileAnchorX:z,tileAnchorY:j,featureIndex:$}=e.get(s);x.verticalTextBox={x1:b,y1:w,x2:S,y2:E,padding:M,projectedAnchorX:C,projectedAnchorY:R,projectedAnchorZ:F,tileAnchorX:z,tileAnchorY:j},x.verticalTextFeatureIndex=$}if(u<f){const{x1:b,y1:w,x2:S,y2:E,padding:M,projectedAnchorX:C,projectedAnchorY:R,projectedAnchorZ:F,tileAnchorX:z,tileAnchorY:j,featureIndex:$}=e.get(u);x.iconBox={x1:b,y1:w,x2:S,y2:E,padding:M,projectedAnchorX:C,projectedAnchorY:R,projectedAnchorZ:F,tileAnchorX:z,tileAnchorY:j},x.iconFeatureIndex=$}if(p<g){const{x1:b,y1:w,x2:S,y2:E,padding:M,projectedAnchorX:C,projectedAnchorY:R,projectedAnchorZ:F,tileAnchorX:z,tileAnchorY:j,featureIndex:$}=e.get(p);x.verticalIconBox={x1:b,y1:w,x2:S,y2:E,padding:M,projectedAnchorX:C,projectedAnchorY:R,projectedAnchorZ:F,tileAnchorX:z,tileAnchorY:j},x.verticalIconFeatureIndex=$}return x}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let i=0;i<this.symbolInstances.length;i++){const n=this.symbolInstances.get(i);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,n.textBoxStartIndex,n.textBoxEndIndex,n.verticalTextBoxStartIndex,n.verticalTextBoxEndIndex,n.iconBoxStartIndex,n.iconBoxEndIndex,n.verticalIconBoxStartIndex,n.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,i){const n=e.placedSymbolArray.get(i),s=n.vertexStartIndex+4*n.numGlyphs;for(let l=n.vertexStartIndex;l<s;l+=4)e.indexArray.emplaceBack(l,l+1,l+2),e.indexArray.emplaceBack(l+1,l+2,l+3)}
7getSortedSymbolIndexes(e){if(this.sortedAngle===e&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const i=Math.sin(e),n=Math.cos(e),s=[],l=[],u=[];for(let f=0;f<this.symbolInstances.length;++f){u.push(f);const p=this.symbolInstances.get(f);s.push(0|Math.round(i*p.tileAnchorX+n*p.tileAnchorY)),l.push(p.featureIndex)}return u.sort((f,p)=>s[f]-s[p]||l[p]-l[f]),u}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,i)=>this.symbolInstances.get(i).zOffset-this.symbolInstances.get(e).zOffset)}addToSortKeyRanges(e,i){const n=this.sortKeyRanges.at(-1);n&&n.sortKey===i?n.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:i,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 i of this.symbolInstanceIndexes){const n=this.symbolInstances.get(i);this.featureSortOrder.push(n.featureIndex);const{rightJustifiedTextSymbolIndex:s,centerJustifiedTextSymbolIndex:l,leftJustifiedTextSymbolIndex:u,verticalPlacedTextSymbolIndex:f,placedIconSymbolIndex:p,verticalPlacedIconSymbolIndex:g}=n;s>=0&&this.addIndicesForPlacedSymbol(this.text,s),l>=0&&l!==s&&this.addIndicesForPlacedSymbol(this.text,l),u>=0&&u!==l&&u!==s&&this.addIndicesForPlacedSymbol(this.text,u),f>=0&&this.addIndicesForPlacedSymbol(this.text,f),p>=0&&this.addIndicesForPlacedSymbol(this.icon,p),g>=0&&this.addIndicesForPlacedSymbol(this.icon,g)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}getOrCreateSortedSymbolsByBatch(e,i){const n=(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 s of this.symbolsByBatch.values())for(const l of s){const u=this.symbolInstances.get(l.index);l.rotatedY=0|Math.round(e*u.tileAnchorX+i*u.tileAnchorY)}else{this.symbolsByBatch=new Map;for(let s=0;s<this.symbolInstances.length;s++){const l=this.symbolInstances.get(s),u=Math.floor(s/n),f=0|Math.round(e*l.tileAnchorX+i*l.tileAnchorY);this.symbolsByBatch.has(u)||this.symbolsByBatch.set(u,[]),this.symbolsByBatch.get(u).push({index:s,rotatedY:f,featureIndex:l.featureIndex})}}for(const s of this.symbolsByBatch.values())s.sort((l,u)=>l.rotatedY-u.rotatedY||u.featureIndex-l.featureIndex);return this.symbolsByBatch}rebuildTextSegmentIndices(e,i){for(const n of e){const s=n.batchIndex;if(s===void 0)continue;const l=i.get(s);if(!l){n.primitiveOffset=this.text.indexArray.length,n.primitiveLength=0;continue}n.primitiveOffset=this.text.indexArray.length;const u=this.text.indexArray.length;for(const{index:f}of l){const p=this.symbolInstances.get(f),{rightJustifiedTextSymbolIndex:g,centerJustifiedTextSymbolIndex:x,leftJustifiedTextSymbolIndex:b,verticalPlacedTextSymbolIndex:w}=p;g>=0&&this.addIndicesForPlacedSymbol(this.text,g),x>=0&&x!==g&&this.addIndicesForPlacedSymbol(this.text,x),b>=0&&b!==x&&b!==g&&this.addIndicesForPlacedSymbol(this.text,b),w>=0&&this.addIndicesForPlacedSymbol(this.text,w)}n.primitiveLength=this.text.indexArray.length-u}}rebuildIconSegmentIndices(e,i){for(const n of e){const s=n.batchIndex;if(s===void 0)continue;const l=i.get(s);if(!l){n.primitiveOffset=this.icon.indexArray.length,n.primitiveLength=0;continue}n.primitiveOffset=this.icon.indexArray.length;const u=this.icon.indexArray.length;for(const{index:f}of l){const p=this.symbolInstances.get(f),{placedIconSymbolIndex:g,verticalPlacedIconSymbolIndex:x}=p;g>=0&&this.addIndicesForPlacedSymbol(this.icon,g),x>=0&&this.addIndicesForPlacedSymbol(this.icon,x)}n.primitiveLength=this.icon.indexArray.length-u}}sortFeaturesWithinSegments(){this.featureSortOrder=[];const e=Math.sin(this.sortedAngle),i=Math.cos(this.sortedAngle),n=this.getOrCreateSortedSymbolsByBatch(e,i),s=Array.from(n.keys()).sort((l,u)=>l-u);for(const l of s){const u=n.get(l);for(const{index:f}of u){const p=this.symbolInstances.get(f);this.featureSortOrder.push(p.featureIndex)}}this.text.indexArray.clear(),this.icon.indexArray.clear(),this.rebuildTextSegmentIndices(this.text.segments.get(),n),this.rebuildIconSegmentIndices(this.icon.segments.get(),n),this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}getElevationFeatureForText(e){const i=this.symbolInstances.get(this.text.symbolInstanceIndices[e]).elevationFeatureIndex;let n;return this.elevationFeatures&&i<this.elevationFeatures.length&&(n=this.elevationFeatures[i]),n}}function f0(r,e){return e.replace(/{([^{}]+)}/g,(i,n)=>n in r?String(r[n]):"")}let p0,m0,Ty;et(Fo,"SymbolBucket",{omit:["layers","collisionBoxArray","compareText","features"]}),Fo.addDynamicAttributes=vh;class _0{constructor(e){this.type=e.property.overrides?e.property.overrides.runtimeType:Ss,this.defaultValue=e}evaluate(e){if(e.formattedSection){const i=this.defaultValue.property.overrides;if(i&&i.hasOverride(e.formattedSection))return i.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}}et(_0,"FormatSectionOverride",{omit:["defaultValue"]});const Sy=()=>Ty||(Ty={layout:p0||(p0=new bi({"symbol-placement":new He(he.layout_symbol["symbol-placement"]),"symbol-spacing":new He(he.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new He(he.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Ze(he.layout_symbol["symbol-sort-key"]),"symbol-z-order":new He(he.layout_symbol["symbol-z-order"]),"symbol-z-elevate":new He(he.layout_symbol["symbol-z-elevate"]),"symbol-elevation-reference":new He(he.layout_symbol["symbol-elevation-reference"]),"icon-allow-overlap":new He(he.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new He(he.layout_symbol["icon-ignore-placement"]),"icon-optional":new He(he.layout_symbol["icon-optional"]),"icon-rotation-alignment":new He(he.layout_symbol["icon-rotation-alignment"]),"icon-size":new Ze(he.layout_symbol["icon-size"]),"icon-size-scale-range":new He(he.layout_symbol["icon-size-scale-range"]),"icon-text-fit":new Ze(he.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Ze(he.layout_symbol["icon-text-fit-padding"]),"icon-image":new Ze(he.layout_symbol["icon-image"]),"icon-image-use-theme":new He({type:"string",default:"default","property-type":"data-constant"}),"icon-rotate":new Ze(he.layout_symbol["icon-rotate"]),"icon-padding":new He(he.layout_symbol["icon-padding"]),"icon-keep-upright":new He(he.layout_symbol["icon-keep-upright"]),"icon-offset":new Ze(he.layout_symbol["icon-offset"]),"icon-anchor":new Ze(he.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new He(he.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new He(he.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new He(he.layout_symbol["text-rotation-alignment"]),"text-field":new Ze(he.layout_symbol["text-field"]),"text-font":new Ze(he.layout_symbol["text-font"]),"text-size":new Ze(he.layout_symbol["text-size"]),"text-size-scale-range":new He(he.layout_symbol["text-size-scale-range"]),"text-max-width":new Ze(he.layout_symbol["text-max-width"]),"text-line-height":new Ze(he.layout_symbol["text-line-height"]),"text-letter-spacing":new Ze(he.layout_symbol["text-letter-spacing"]),"text-justify":new Ze(he.layout_symbol["text-justify"]),"text-radial-offset":new Ze(he.layout_symbol["text-radial-offset"]),"text-variable-anchor":new He(he.layout_symbol["text-variable-anchor"]),"text-anchor":new Ze(he.layout_symbol["text-anchor"]),"text-max-angle":new He(he.layout_symbol["text-max-angle"]),"text-writing-mode":new He(he.layout_symbol["text-writing-mode"]),"text-rotate":new Ze(he.layout_symbol["text-rotate"]),"text-padding":new He(he.layout_symbol["text-padding"]),"text-keep-upright":new He(he.layout_symbol["text-keep-upright"]),"text-transform":new Ze(he.layout_symbol["text-transform"]),"text-offset":new Ze(he.layout_symbol["text-offset"]),"text-allow-overlap":new He(he.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new He(he.layout_symbol["text-ignore-placement"]),"text-optional":new He(he.layout_symbol["text-optional"]),visibility:new He(he.layout_symbol.visibility)}
vendor: 10,250 bytes, line 7
7)),paint:m0||(m0=new bi({"icon-opacity":new Ze(he.paint_symbol["icon-opacity"]),"icon-occlusion-opacity":new Ze(he.paint_symbol["icon-occlusion-opacity"]),"icon-emissive-strength":new Ze(he.paint_symbol["icon-emissive-strength"]),"text-emissive-strength":new Ze(he.paint_symbol["text-emissive-strength"]),"icon-color":new Ze(he.paint_symbol["icon-color"]),"icon-halo-color":new Ze(he.paint_symbol["icon-halo-color"]),"icon-halo-width":new Ze(he.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Ze(he.paint_symbol["icon-halo-blur"]),"icon-translate":new He(he.paint_symbol["icon-translate"]),"icon-translate-anchor":new He(he.paint_symbol["icon-translate-anchor"]),"icon-image-cross-fade":new He(he.paint_symbol["icon-image-cross-fade"]),"text-opacity":new Ze(he.paint_symbol["text-opacity"]),"text-occlusion-opacity":new Ze(he.paint_symbol["text-occlusion-opacity"]),"text-color":new Ze(he.paint_symbol["text-color"],{runtimeType:qr,getOverride:r=>r.textColor,hasOverride:r=>!!r.textColor}),"text-halo-color":new Ze(he.paint_symbol["text-halo-color"]),"text-halo-width":new Ze(he.paint_symbol["text-halo-width"]),"text-halo-blur":new Ze(he.paint_symbol["text-halo-blur"]),"text-translate":new He(he.paint_symbol["text-translate"]),"text-translate-anchor":new He(he.paint_symbol["text-translate-anchor"]),"icon-color-saturation":new He(he.paint_symbol["icon-color-saturation"]),"icon-color-contrast":new He(he.paint_symbol["icon-color-contrast"]),"icon-color-brightness-min":new He(he.paint_symbol["icon-color-brightness-min"]),"icon-color-brightness-max":new He(he.paint_symbol["icon-color-brightness-max"]),"symbol-z-offset":new Ze(he.paint_symbol["symbol-z-offset"]),"icon-color-use-theme":new Ze({type:"string",default:"default","property-type":"data-driven"}),"icon-halo-color-use-theme":new Ze({type:"string",default:"default","property-type":"data-driven"}),"text-color-use-theme":new Ze({type:"string",default:"default","property-type":"data-driven"}),"text-halo-color-use-theme":new Ze({type:"string",default:"default","property-type":"data-driven"})}))},Ty);class b_ extends Xr{constructor(e,i,n,s){super(e,Sy(),i,n,s,e.layout?e.layout["icon-image-use-theme"]:null),this._colorAdjustmentMatrix=Ot([]),this.hasOcclusionOpacityProperties=e.paint!==void 0&&("icon-occlusion-opacity"in e.paint||"text-occlusion-opacity"in e.paint)}_handleSpecialPaintPropertyUpdate(e){e!=="icon-occlusion-opacity"&&e!=="text-occlusion-opacity"||(this.hasOcclusionOpacityProperties=!0)}recalculate(e,i){super.recalculate(e,i),this.appearances&&this.appearances.forEach(s=>{s.recalculate(e,i,this.iconImageUseTheme)}),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout._values["icon-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout._values["text-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment"));const n=this.layout.get("text-writing-mode");if(n){const s=[];for(const l of n)s.includes(l)||s.push(l);this.layout._values["text-writing-mode"]=s}else this.layout._values["text-writing-mode"]=this.layout.get("symbol-placement")==="point"?["horizontal"]:["horizontal","vertical"];this._setPaintOverrides()}getColorAdjustmentMatrix(e,i,n,s){return this._saturation===e&&this._contrast===i&&this._brightnessMin===n&&this._brightnessMax===s||(this._colorAdjustmentMatrix=(function(l,u,f,p){l=xo(l),u=or(u);const g=Na(),x=l/3,b=1-2*x,w=[b,x,x,0,x,b,x,0,x,x,b,0,0,0,0,1],S=.5-.5*u,E=p-f;return gi(g,[E,0,0,0,0,E,0,0,0,0,E,0,f,f,f,1],[u,0,0,0,0,u,0,0,0,0,u,0,S,S,S,1]),gi(g,g,w),g})(e,i,n,s),this._saturation=e,this._contrast=i,this._brightnessMin=n,this._brightnessMax=s),this._colorAdjustmentMatrix}getValueAndResolveTokens(e,i,n,s){const l=this.layout.get(e).evaluate(i,{},n,s),u=this._unevaluatedLayout._values[e];return u.isDataDriven()||Ou(u.value)||!l?l:f0(i.properties,l)}getAppearanceValueAndResolveTokens(e,i,n,s,l){const u=e.getLayoutProperty(i);if(!u)return;const f=u.evaluate(n,{},s,l),p=e.getUnevaluatedLayoutProperties()._values[i];return p.isDataDriven()||Ou(p.value)||!f||typeof f!="string"?f:f0(n.properties,f)}createBucket(e){return new Fo(e)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(const e of Sy().paint.overridableProperties){if(!b_.hasPaintOverride(this.layout,e))continue;const i=this.paint.get(e),n=new _0(i),s=new md(n,i.property.specification,this.scope,this.options,this.layout.get("icon-image-use-theme"));let l=null;l=i.value.kind==="constant"||i.value.kind==="source"?new Ac("source",s):new Mo("composite",s,i.value.zoomStops,i.value.interpolationType),this.paint._values[e]=new Rs(i.property,l,i.parameters)}}_handleOverridablePaintPropertyUpdate(e,i,n){return!(!this.layout||i.isDataDriven()||n.isDataDriven())&&b_.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,i){const n=e.get("text-field"),s=Sy().paint.properties[i];let l=!1;const u=f=>{for(const p of f)if(s.overrides&&s.overrides.hasOverride(p))return void(l=!0)};if(n.value.kind==="constant"&&n.value.value instanceof zr)u(n.value.value.sections);else if(n.value.kind==="source"){const f=g=>{l||(g instanceof no&&Ji(g.value)===rl?u(g.value.sections):g instanceof al?u(g.sections):g.eachChild(f))},p=n.value;p._styleExpression&&f(p._styleExpression.expression)}return l}getProgramIds(){return["symbol"]}getDefaultProgramParams(e,i,n){return{config:new Ca(this,{zoom:i,lut:n}),overrideFog:!1}}hasElevation(){return this.layout&&this.layout.get("symbol-elevation-reference")==="hd-road-markup"}}let g0,y0,x0,v0;var w_=Rt([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Uint16",components:2}]);function T_(r,e,i,n,s,l,u,f){const p=[r,e,1,i,n,1,s,l,1],g=[u,f,1],x=ps([],p),[b,w,S]=gs(g,g,x);return ms(p,p,[b,0,0,0,w,0,0,0,S])}function b0(r,e,i,n,s,l,u,f){const p=(function(g,x,b,w,S,E,M,C){const R=T_(0,0,1,0,1,1,0,1),F=T_(g,x,b,w,S,E,M,C);return ms(F,F,ps([],R))})(r,e,i,n,s,l,u,f);return[p[2]/p[8]/Xe,p[5]/p[8]/Xe]}function S_(r){return[r[0],Math.min(Math.max(r[1],-85.051129),_n)]}class w0 extends tl{constructor(e,i,n,s){super(),this.id=e,this.dispatcher=n,this.coordinates=i.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(s),this.options=i,this._dirty=!1}load(e,i){if(this._loaded=i||!1,this.fire(new io("dataloading",{dataType:"source"})),this.url=this.options.url,!this.url)return e&&(this.coordinates=e),this._loaded=!0,void this._finishLoading();this._imageRequest=Bh(this.map._requestManager.transformRequest(this.url,ca.Image),(n,s)=>{this._imageRequest=null,this._loaded=!0,n?this.fire(new Qa(n)):s&&(this.image=s,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 wf(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 io("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 wf||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 i=e[0][1],n=e[0][1];for(const l of e)l[1]>n&&(n=l[1]),l[1]<i&&(i=l[1]);const s=(n+i)/2;if(s>_n?this.onNorthPole=!0:s<-85.051129&&(this.onSouthPole=!0),!this.onNorthPole&&!this.onSouthPole){const l=e.map(Or.fromLngLat);this.tileID=(function(u){let f=1/0,p=1/0,g=-1/0,x=-1/0;for(const M of u)f=Math.min(f,M.x),p=Math.min(p,M.y),g=Math.max(g,M.x),x=Math.max(x,M.y);const b=Math.max(g-f,x-p),w=Math.max(0,Math.floor(-Math.log2(b))),S=Math.pow(2,w);let E=Math.floor((f+g)/2*S);return E>1&&(E-=1),new oe(w,E,Math.floor((p+x)/2*S))})(l),this.minzoom=this.maxzoom=this.tileID.z}return this.fire(new io("data",{dataType:"source",sourceDataType:"content"})),this}_clear(){!this.texture||this.texture instanceof wf||(this.texture.destroy(),this._dirty=!0),this.texture=null,this._boundsArray=void 0,this._unsupportedCoords=!1}_prepareData(e){for(const C in this.tiles){const R=this.tiles[C];R.state!=="loaded"&&(R.state="loaded",R.texture=this.texture)}if(this._boundsArray||this.onNorthPole||this.onSouthPole||this._unsupportedCoords)return;const i=Yc(new oe(0,0,0),this.map.transform.projection),n=[i.projection.project(this.coordinates[0][0],this.coordinates[0][1]),i.projection.project(this.coordinates[1][0],this.coordinates[1][1]),i.projection.project(this.coordinates[2][0],this.coordinates[2][1]),i.projection.project(this.coordinates[3][0],this.coordinates[3][1])];if(!(function(C){const R=C[1].x-C[0].x,F=C[1].y-C[0].y,z=C[2].x-C[1].x,j=C[2].y-C[1].y,$=C[3].x-C[2].x,q=C[3].y-C[2].y,ie=C[0].x-C[3].x,W=C[0].y-C[3].y,Q=R*j-z*F,Y=z*q-$*j,ee=$*W-ie*q,me=ie*F-R*W;return Q>0&&Y>0&&ee>0&&me>0||Q<0&&Y<0&&ee<0&&me<0})(n))return console.warn("Image source coordinates are defining non-convex area in the Mercator projection"),void(this._unsupportedCoords=!0);const s=Yc(this.tileID,this.map.transform.projection),[l,u,f,p]=this.coordinates.map(C=>{const R=s.projection.project(C[0],C[1]);return a0(s,R)._round()});
vendor: 4,404 bytes, line 7
7this.perspectiveTransform=b0(l.x,l.y,u.x,u.y,f.x,f.y,p.x,p.y);const g=this._boundsArray=new Sa;g.emplaceBack(l.x,l.y,0,0),g.emplaceBack(u.x,u.y,Xe,0),g.emplaceBack(p.x,p.y,0,Xe),g.emplaceBack(f.x,f.y,Xe,Xe),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy()),this.boundsBuffer=e.createVertexBuffer(g,w_.members),this.boundsSegments=di.simpleSegment(0,0,4,2);const x=[],b=(function(C){return[S_(C[0]),S_(C[1]),S_(C[2]),S_(C[3])]})(this.coordinates),[w,S,E,M]=(function(C){let R=C[0][0],F=R,z=C[0][1],j=z;for(let $=1;$<C.length;$++)C[$][0]<R?R=C[$][0]:C[$][0]>F&&(F=C[$][0]),C[$][1]<z?z=C[$][1]:C[$][1]>j&&(j=C[$][1]);return[R,z,F-R,j-z]})(b);{const C=new Sa,[R,F,z,j]=(function(Ie){let Fe=Ie[0].x,xe=Fe,Se=Ie[0].y,Me=Se;for(let ze=1;ze<Ie.length;ze++)Ie[ze].x<Fe?Fe=Ie[ze].x:Ie[ze].x>xe&&(xe=Ie[ze].x),Ie[ze].y<Se?Se=Ie[ze].y:Ie[ze].y>Me&&(Me=Ie[ze].y);return[Fe,Se,xe-Fe,Me-Se]})(n),$=Ie=>[(Ie.x-R)/z,(Ie.y-F)/j],[q,ie,W,Q]=n.map($),Y=(function(Ie,Fe,xe,Se,Me,ze,Le,We){const De=T_(0,0,1,0,1,1,0,1);return ms(De,De,ps([],T_(Ie,Fe,xe,Se,Me,ze,Le,We)))})(q[0],q[1],ie[0],ie[1],W[0],W[1],Q[0],Q[1]);this.elevatedGlobePerspectiveTransform=b0(q[0],q[1],ie[0],ie[1],W[0],W[1],Q[0],Q[1]);const ee=(Ie,Fe)=>{x.push(Ie.lng);const xe=Math.round((Ie.lng-w)/E*Xe),Se=Math.round((Ie.lat-S)/M*Xe),Me=$(Fe),ze=gs([],[Me[0],Me[1],1],Y),Le=Math.round(ze[0]/ze[2]*Xe),We=Math.round(ze[1]/ze[2]*Xe);C.emplaceBack(xe,Se,Le,We)},me=n[3].x-n[0].x,ge=n[3].y-n[0].y,Te=n[2].x-n[1].x,Ae=n[2].y-n[1].y;for(let Ie=0;Ie<65;Ie++){const Fe=Ie/64,xe=[n[0].x+Fe*me,n[0].y+Fe*ge],Se=[n[1].x+Fe*Te,n[1].y+Fe*Ae],Me=Se[0]-xe[0],ze=Se[1]-xe[1];for(let Le=0;Le<65;Le++){const We=Le/64,De={x:xe[0]+Me*We,y:xe[1]+ze*We};ee(i.projection.unproject(De.x,De.y),De)}}this.elevatedGlobeVertexBuffer=e.createVertexBuffer(C,w_.members)}{this.maxLongitudeTriangleSize=0;let C=[],R=new Ai;const F=(z,j,$)=>{R.emplaceBack(z,j,$);const q=x[z],ie=x[j],W=x[$],Q=Math.min(Math.min(q,ie),W),Y=Math.max(Math.max(q,ie),W)-Q;Y>this.maxLongitudeTriangleSize&&(this.maxLongitudeTriangleSize=Y),C.push(Q+Y/2)};for(let z=0;z<64;z++)for(let j=0;j<64;j++){const $=65*z+j,q=$+1,ie=$+65,W=ie+1;F($,ie,q),F(q,ie,W)}[C,R]=(function(z,j){const $=Array.from({length:z.length},(W,Q)=>Q);$.sort((W,Q)=>z[W]-z[Q]);const q=[],ie=new Ai;for(let W=0;W<$.length;W++){const Q=$[W];q.push(z[Q]);const Y=3*Q,ee=Y+1;ie.emplaceBack(j.uint16[Y],j.uint16[ee],j.uint16[ee+1])}return[q,ie]})(C,R),this.elevatedGlobeTrianglesCenterLongitudes=C,this.elevatedGlobeIndexBuffer=e.createIndexBuffer(R)}this.elevatedGlobeSegments=di.simpleSegment(0,0,4225,8192),this.elevatedGlobeGridMatrix=new Float32Array([0,E/Xe,0,M/Xe,0,0,S,w,0])}prepare(){const e=Object.keys(this.tiles).length!==0;if(this.tileID&&!e)return;const i=this.map.painter.context,n=i.gl;!this._dirty||this.texture instanceof wf||(this.texture?this.texture.update(this.image):(this.texture=new Gs(i,this.image,n.RGBA8),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE)),this._dirty=!1),e&&this._prepareData(i)}loadTile(e,i){this.tileID&&this.tileID.equals(e.tileID.canonical)?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={},i(null)):(e.state="errored",i(null))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}getSegmentsForLongitude(e){const i=this.elevatedGlobeSegments;if(!this.elevatedGlobeTrianglesCenterLongitudes||!i)return null;const n=this.elevatedGlobeTrianglesCenterLongitudes;let s=(l=e+180)+360*Math.round((n[0]-l)/360);var l;const u=new di,f=(b,w)=>{u.segments.push({vertexOffset:0,primitiveOffset:b,vertexLength:i.segments[0].vertexLength,primitiveLength:w,sortKey:void 0,vaos:{}})},p=.51*this.maxLongitudeTriangleSize;if(Math.abs(n[0]-s)<=p){const b=ur(n,0,n.length,s+p);return b===n.length||f(b,Tr(n,b+1,n.length,s+360-p)-b),u}s<n[0]&&(s+=360);const g=Tr(n,0,n.length,s-p);if(g===n.length)return f(0,n.length),u;f(0,g-0);const x=ur(n,g+1,n.length,s+p);return x!==n.length&&f(x,n.length-x),u}}const Iy=1024,eT=(Math.pow(Iy,2)-1)/268170240;class T0 extends Xr{constructor(e,i,n,s){super(e,{layout:x0||(x0=new bi({visibility:new He(he.layout_raster.visibility)})),paint:v0||(v0=new bi({"raster-opacity":new He(he.paint_raster["raster-opacity"]),"raster-color":new zs(he.paint_raster["raster-color"]),"raster-color-mix":ne
vendor: 20,008 bytes, line 7
7w He(he.paint_raster["raster-color-mix"]),"raster-color-range":new He(he.paint_raster["raster-color-range"]),"raster-hue-rotate":new He(he.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new He(he.paint_raster["raster-brightness-min"]),"raster-brightness-max":new He(he.paint_raster["raster-brightness-max"]),"raster-saturation":new He(he.paint_raster["raster-saturation"]),"raster-contrast":new He(he.paint_raster["raster-contrast"]),"raster-resampling":new He(he.paint_raster["raster-resampling"]),"raster-fade-duration":new He(he.paint_raster["raster-fade-duration"]),"raster-emissive-strength":new He(he.paint_raster["raster-emissive-strength"]),"raster-array-band":new He(he.paint_raster["raster-array-band"]),"raster-elevation":new He(he.paint_raster["raster-elevation"]),"raster-elevation-reference":new He(he.paint_raster["raster-elevation-reference"]),"raster-color-use-theme":new Ze({type:"string",default:"default","property-type":"data-driven"})}))},i,n,s),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 w0&&(e._source.onNorthPole||e._source.onSouthPole))&&this.paint.get("raster-elevation")===0}_handleSpecialPaintPropertyUpdate(e){e!=="raster-color"&&e!=="raster-color-range"||(this._curRampRange=[NaN,NaN],this.updateColorRamp())}_clear(){this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null)}updateColorRamp(e){if(!this.hasColorMap()||!this._curRampRange)return;const i=this._transitionablePaint._values["raster-color"].value.expression,[n,s]=e||this._transitionablePaint._values["raster-color-range"].value.expression.evaluate({zoom:0})||[NaN,NaN];isNaN(n)&&isNaN(s)||n===this._curRampRange[0]&&s===this._curRampRange[1]||(this.colorRamp=Xt({expression:i,evaluationKey:"rasterValue",image:this.colorRamp,clips:[{start:n,end:s}],resolution:Iy}),this.colorRampTexture=null,this._curRampRange=[n,s])}is3D(e){return this.paint.get("raster-elevation")>0}}let S0,I0,E0,A0,M0,C0,P0;class D0 extends Xr{constructor(e,i,n,s){super(e,{layout:S0||(S0=new bi({visibility:new He(he["layout_raster-particle"].visibility)})),paint:I0||(I0=new bi({"raster-particle-array-band":new He(he["paint_raster-particle"]["raster-particle-array-band"]),"raster-particle-count":new He(he["paint_raster-particle"]["raster-particle-count"]),"raster-particle-color":new zs(he["paint_raster-particle"]["raster-particle-color"]),"raster-particle-max-speed":new He(he["paint_raster-particle"]["raster-particle-max-speed"]),"raster-particle-speed-factor":new He(he["paint_raster-particle"]["raster-particle-speed-factor"]),"raster-particle-fade-opacity-factor":new He(he["paint_raster-particle"]["raster-particle-fade-opacity-factor"]),"raster-particle-reset-rate-factor":new He(he["paint_raster-particle"]["raster-particle-reset-rate-factor"]),"raster-particle-elevation":new He(he["paint_raster-particle"]["raster-particle-elevation"]),"raster-particle-color-use-theme":new Ze({type:"string",default:"default","property-type":"data-driven"})}))},i,n,s),this._updateColorRamp(),this.lastInvalidatedAt=un.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 this.visibility!=="none"}isDraped(e){return!1}_handleSpecialPaintPropertyUpdate(e){e!=="raster-particle-color"&&e!=="raster-particle-max-speed"||(this._updateColorRamp(),this._invalidateAnimationState()),e==="raster-particle-count"&&this._invalidateAnimationState()}_updateColorRamp(){if(!this.hasColorMap())return;const e=this._transitionablePaint._values["raster-particle-color"].value.expression,i=this._transitionablePaint._values["raster-particle-max-speed"].value.expression.evaluate({zoom:0});this.colorRamp=Xt({expression:e,evaluationKey:"rasterParticleSpeed",image:this.colorRamp,clips:[{start:0,end:i}],resolution:256}),this.colorRampTexture=null}_invalidateAnimationState(){this.lastInvalidatedAt=un.now()}tileCoverLift(){return this.paint.get("raster-particle-elevation")}}class tT extends Xr{constructor(e,i){super(e,{},i,null),this.implementation=e,e.slot&&(this.slot=e.slot)}is3D(e){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}isDraped(e){return this.implementation.renderToTile!==void 0}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 Ey(r,e,i){const n=[0,0,1],s=xs([]);return ta(s,s,i?-V(r)+Math.PI:V(r)),$a(s,s,-V(e)),Ua(n,n,s),ui(n,n)}class R0{constructor(e,i){this.feature=e,this.instancedDataOffset=i,this.instancedDataCount=0,this.rotation=[0,0,0],this.scale=[1,1,1],this.translation=[0,0,0]}}class z0{constructor(){this.maxScale=1,this.maxXYTranslationDistance=0,this.instancedDataArray=new ih,this.instancesEvaluatedElevation=[],this.features=[],this.idToFeaturesIndex={}}colorForInstance(e){const i=16*e,n=this.instancedDataArray.float32;let s=Math.floor(n[i+2]);const l=1.05*(n[i+2]-s);return s/=100,[n[i]%1*1.05,n[i+1]%1*1.05,l,s]}tileCoordinatesForInstance(e){const i=16*e,n=this.instancedDataArray.float32;let s=n[i+0];return s=s>Xe?s-Xe:s,new Ue(Math.trunc(s),Math.trunc(n[i+1]))}translationForInstance(e){const i=16*e,n=this.instancedDataArray.float32;return[n[i+4],n[i+5],n[i+6]]}rotationScaleForInstance(e){const i=16*e,n=this.instancedDataArray.float32;return[n[i+7],n[i+8],n[i+9],n[i+10],n[i+11],n[i+12],n[i+13],n[i+14],n[i+15]]}transformForInstance(e){const i=16*e,n=this.instancedDataArray.float32;return[n[i+7],n[i+8],n[i+9],n[i+4],n[i+10],n[i+11],n[i+12],n[i+5],n[i+13],n[i+14],n[i+15],n[i+6],0,0,0,1]}}class Ay{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(i=>i.fqid),this.projection=e.projection,this.index=e.index,this.worldview=e.worldview,this.hasZoomDependentProperties=this.layers[0].isZoomDependent(),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.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,i){}updateAppearances(e,i,n,s){return{hasLayoutChanges:!1,hasUboChanges:!1}}populate(e,i,n,s){this.tileToMeter=Cn(n);const l=this.layers[0]._featureFilter.needGeometry;this.lookup=new Uint8Array(this.lookupDim*this.lookupDim);const u=this.layers[0].paint.get("model-elevation-reference")==="hd-road-markup"?i.elevationFeatures:void 0;for(const{feature:f,id:p,index:g,sourceLayerIndex:x}of e){const b=p??(f.properties&&Object.hasOwn(f.properties,"id")?f.properties.id:void 0),w=$n(f,l);if(!this.layers[0]._featureFilter.filter(new Wt(this.zoom,{worldview:this.worldview,activeFloors:i.activeFloors}),w,n))continue;const S={id:b,sourceLayerIndex:x,index:g,geometry:l?w.geometry:gn(f,n,s),properties:f.properties,type:f.type,patterns:{}},E=this.addFeature(S,S.geometry,w,u,n);E&&i.featureIndex.insert(f,S.geometry,g,x,this.index,this.instancesPerModel[E].instancedDataArray.length,256)}this.lookup=null}evaluateQueryRenderedFeaturePadding(){const e=this.layers[0].modelManager,i=this.layers[0].scope;let n=0;for(const s of this.modelUris){const l=e.getModel(s,i);if(!l)continue;const u=this.instancesPerModel[s];if(u){const f=.5*Js(l.aabb.max,l.aabb.min)*u.maxScale+u.maxXYTranslationDistance,p=Math.min(Xe,Math.max(f/this.tileToMeter,256));n=Math.max(p,n)}}return n}update(e,i,n,s){for(const l in this.instancesPerModel){const u=this.instancesPerModel[l];for(const f in e)Object.hasOwn(u.idToFeaturesIndex,f)&&(this.evaluate(u.features[u.idToFeaturesIndex[f]],e[f],u,!0),this.uploaded=!1)}this.maxHeight=0}updateZoomBasedPaintProperties(){if(!this.hasZoomDependentProperties)return!1;let e=!1;for(const i in this.instancesPerModel){const n=this.instancesPerModel[i];for(const s of n.features){const l=this.layers[0],u=s.feature,f=this.canonical,p=l.paint.get("model-rotation").evaluate(u,{},f),g=l.paint.get("model-scale").evaluate(u,{},f),x=l.paint.get("model-translation").evaluate(u,{},f);go(s.rotation,p)&&go(s.scale,g)&&go(s.translation,x)||(this.evaluate(s,s.featureStates,n,!0),e=!0)}}return e}updateReplacement(e,i,n,s){if(i.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=i.updateTime;const l=i.getReplacementRegionsForTile(e.toUnwrapped(),!0);if(Um(this.activeReplacements,l))return!1;this.activeReplacements=l;let u=!1;for(const f in this.instancesPerModel){const p=this.instancesPerModel[f],g=p.instancedDataArray;for(const x of p.features){const b=x.instancedDataOffset,w=x.instancedDataCount;for(let S=0;S<w;S++){const E=16*(S+b);let M=g.float32[E+0];const C=M>Xe;M=C?M-Xe:M;const R=Math.floor(M),F=Math.floor(g.float32[E+1]);let z=!1;for(const j of this.activeReplacements)if(!cx(j,n,Vm.Model,s)&&!(j.min.x>R||R>j.max.x||j.min.y>F||F>j.max.y)&&(z=px(fx(R,F,e.canonical,j.footprintTileId.canonical),j.footprint),z))break;g.float32[E]=z?M+Xe:M,u=u||z!==C}}}return u}isEmpty(){for(const e in this.instancesPerModel)if(this.instancesPerModel[e].instancedDataArray.length!==0)return!1;return!0}uploadPending(){return!this.uploaded}upload(e){if(!this.uploaded)for(const i in this.instancesPerModel){const n=this.instancesPerModel[i];n.instancedDataArray.length<0||n.instancedDataArray.length===0||(n.instancedDataBuffer?n.instancedDataBuffer.updateData(n.instancedDataArray):n.instancedDataBuffer=e.createVertexBuffer(n.instancedDataArray,p1.members,!0,void 0,this.instanceCount))}this.uploaded=!0}destroy(e){for(const n in this.instancesPerModel){const s=this.instancesPerModel[n];s.instancedDataArray.length!==0&&s.instancedDataBuffer&&s.instancedDataBuffer.destroy()}const i=this.layers[0].modelManager;if(e&&i&&this.modelUris&&this.modelsRequested)for(const n of this.modelUris)i.removeModel(n,"",!0)}addFeature(e,i,n,s,l){const u=this.layers[0],f=u.layout.get("model-id"),p=u.layout.get("model-allow-density-reduction"),g=f.evaluate(n,{},this.canonical);if(!g)return Pt(`modelId is not evaluated for layer ${u.id} and it is not going to get rendered.`),g;!g.includes("://")&&!this.styleDefinedModelURLs[g]||this.modelUris.includes(g)||this.modelUris.push(g),this.instancesPerModel[g]||(this.instancesPerModel[g]=new z0);const x=this.instancesPerModel[g],b=x.instancedDataArray,w=new R0(n,b.length);let S;s&&(S=a.getElevationFeature(e,s));for(const E of i)for(const M of E){if(M.x<0||M.x>=Xe||M.y<0||M.y>=Xe)continue;if(this.lookupDim!==0&&p){const R=(this.lookupDim-1)/Xe,F=this.lookupDim*(M.y*R|0)+M.x*R|0;if(this.lookup){if(this.lookup[F]!==0)continue;this.lookup[F]=1}}this.instanceCount++;const C=b.length;if(b.resize(C+1),s){x.instancesRoadElevation||(x.instancesRoadElevation=[]);const R=S?S.pointElevation(new Ue(M.x,M.y)):0;x.instancesRoadElevation.push(R)}x.instancesEvaluatedElevation.push(0),b.float32[16*C]=M.x,b.float32[16*C+1]=M.y}return w.instancedDataCount=x.instancedDataArray.length-w.instancedDataOffset,w.instancedDataCount>0&&(e.id&&(x.idToFeaturesIndex[e.id]=x.features.length),x.features.push(w),this.evaluate(w,{},x,!1)),g}getModelUris(){return this.modelUris}evaluate(e,i,n,s){const l=this.layers[0],u=e.feature,f=this.canonical,p=e.rotation=l.paint.get("model-rotation").evaluate(u,i,f),g=e.scale=l.paint.get("model-scale").evaluate(u,i,f),x=e.translation=l.paint.get("model-translation").evaluate(u,i,f),b=Object.assign({},l.paint.get("model-color").evaluate(u,i,f));b.a=l.paint.get("model-color-mix-intensity").evaluate(u,i,f);const w=[];this.maxVerticalOffset<x[2]&&(this.maxVerticalOffset=x[2]);const S=x[0]*x[0]+x[1]*x[1],E=S>0?Math.sqrt(S):0;n.maxScale=Math.max(Math.max(n.maxScale,g[0]),Math.max(g[1],g[2])),n.maxXYTranslationDistance=Math.max(n.maxXYTranslationDistance,E),this.maxScale=Math.max(Math.max(this.maxScale,g[0]),Math.max(g[1],g[2])),Qx(w,p,g);const M=Math.round(100*b.a)+b.b/1.05;for(let C=0;C<e.instancedDataCount;++C){const R=e.instancedDataOffset+C,F=16*R,z=n.instancedDataArray.float32;let j=0;s&&(j=z[F+6]-n.instancesEvaluatedElevation[R]);const $=0|z[F+1];z[F]=(0|z[F])+b.r/1.05,z[F+1]=$+b.g/1.05,z[F+2]=M,z[F+3]=1/(f.z>10?this.tileToMeter:Cn(f,$)),z[F+4]=x[0],z[F+5]=x[1],z[F+6]=x[2]+(n.instancesRoadElevation?n.instancesRoadElevation[R]:0)+j,z[F+7]=w[0],z[F+8]=w[1],z[F+9]=w[2],z[F+10]=w[4],z[F+11]=w[5],z[F+12]=w[6],z[F+13]=w[8],z[F+14]=w[9],z[F+15]=w[10],n.instancesEvaluatedElevation[R]=x[2]}}}et(Ay,"ModelBucket",{omit:["layers"]}),et(z0,"PerModelAttributes"),et(R0,"ModelFeature");class wh{constructor(e,i,n){this._demTile=e,this._dem=this._demTile.dem,this._scale=i,this._offset=n}static create(e,i,n){const s=n||e.findDEMTileFor(i);if(!s||!s.dem)return;const l=s.dem,u=s.tileID,f=1<<i.canonical.z-u.canonical.z;return new wh(s,l.dim/Xe/f,[(i.canonical.x/f-u.canonical.x)*l.dim,(i.canonical.y/f-u.canonical.y)*l.dim])}tileCoordToPixel(e,i){const n=i*this._scale+this._offset[1];return new Ue(Math.floor(e*this._scale+this._offset[0]),Math.floor(n))}getElevationAt(e,i,n,s){const l=e*this._scale+this._offset[0],u=i*this._scale+this._offset[1],f=Math.floor(l),p=Math.floor(u),g=this._dem;return s=!!s,n?ft(ft(g.get(f,p,s),g.get(f,p+1,s),u-p),ft(g.get(f+1,p,s),g.get(f+1,p+1,s),u-p),l-f):g.get(f,p,s)}getElevationAtPixel(e,i,n){return this._dem.get(e,i,!!n)}getMeterToDEM(e){return(1<<this._demTile.tileID.canonical.z)*Yr(1,e)*this._dem.stride}}const My=new Float32Array(262144),Jc=new Uint8Array(262144),I_=[0,0,0],E_=[0,0,0];function L0(r){let e=0;if(r.meshes)for(const i of r.meshes)e=Math.max(e,i.aabb.max[2]);if(r.children)for(const i of r.children)e=Math.max(e,L0(i));return e}function O0(r,e,i){if(r.meshes)for(const n of r.meshes){if(n.aabb.min[0]===1/0)continue;const s=wi.applyTransform(n.aabb,r.globalMatrix);i.insert(e,s.min[0],s.min[1],s.max[0],s.max[1])}if(r.children)for(const n of r.children)O0(n,e,i)}const F0=["","wall","door","roof","window","lamp","logo"];class B0{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.targetLod=-1,this.feature={type:"Point",id:e.id,geometry:[],properties:{height:L0(e)}},this.aabb=this._getLocalBounds(),this.state=null}_getLocalBounds(){if(!this.node.meshes)return new wi([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);if(!this.aabb){let e=0;const i=new wi([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);for(const n of this.node.meshes)this.node.lightMeshIndex!==e&&(n.transformedAabb=wi.applyTransformFast(n.aabb,this.node.globalMatrix),i.encapsulate(n.transformedAabb)),e++;this.aabb=i}return this.aabb}}class A_{constructor(e,i,n,s,l,u,f,p){this.id=n,this.layers=e,this.layerIds=this.layers.map(g=>g.fqid),this.stateDependentLayerIds=this.layers.filter(g=>g.isStateDependent()).map(g=>g.id),this.modelTraits|=fh.CoordinateSpaceTile,this.uploaded=!1,this.hasPattern=!1,s&&(this.modelTraits|=fh.HasMapboxMeshFeatures),l&&(this.modelTraits|=fh.HasMeshoptCompression),this.zoom=-1,this.terrainExaggeration=1,this.projection={name:"mercator"},this.replacementUpdateTime=0,this.elevationReadFromZ=255,this.brightness=u,this.worldview=p,this.dirty=!0,this.needsUpload=!1,this.filter=null,this.nodesInfo=[];for(const g of i)this.nodesInfo.push(new B0(g)),O0(g,f.featureIndexArray.length,f.grid),f.featureIndexArray.emplaceBack(this.nodesInfo.length-1,0,f.bucketLayerIDs.length-1,0);this.states={},this.hasAppearances=null}updateFootprints(e,i){for(const n of this.getNodesInfo()){const s=n.node;s.footprint&&i.push({footprint:s.footprint,id:e})}}updateAppearances(e,i,n,s){return{hasLayoutChanges:!1,hasUboChanges:!1}}update(e){const i=Object.keys(e).length!==0;if(i&&!this.stateDependentLayers.length)return;const n=i?this.stateDependentLayers:this.layers;if(!Wo(e,this.states))for(const s of n)this.evaluate(s,e);this.states=structuredClone(e)}populate(){console.log("populate 3D model bucket")}uploadPending(){return!this.uploaded||this.needsUpload}upload(e){if(!this.needsUpload)return;const i=this.getNodesInfo();for(const n of i){const s=n.node;this.uploaded?this.updatePbrBuffer(s):Hg(s,e,!0)}for(const n of i)n_(n.node);this.uploaded=!0,this.needsUpload=!1}updatePbrBuffer(e){let i=!1;if(!e.meshes)return i;for(const n of e.meshes)n.pbrBuffer&&(n.pbrBuffer.updateData(n.featureArray),i=!0);if(e.lodMeshes)for(const n of e.lodMeshes)n.pbrBuffer&&(n.pbrBuffer.updateData(n.featureArray),i=!0);return i}needsReEvaluation(e,i,n){const s=e.transform.projectionOptions,l=e.style.getBrightness(),u=this.brightness!==l;if(!this.uploaded||this.dirty||s.name!==this.projection.name||kf(n.paint.get("model-color").value,u)||kf(n.paint.get("model-color-mix-intensity").value,u)||kf(n.paint.get("model-roughness").value,u)||kf(n.paint.get("model-emissive-strength").value,u)||kf(n.paint.get("model-height-based-emissive-strength-multiplier").value,u)){this.projection=s,this.brightness=l;const f=this.getNodesInfo();for(const p of f)p.state=null;return!0}return!1}evaluateTransform(e,i){if(e.transform.zoom===this.zoom)return;this.zoom=e.transform.zoom;const n=this.getNodesInfo(),s=this.id.canonical;for(const l of n){const u=l.feature;l.evaluatedTranslation=i.paint.get("model-translation").evaluate(u,{},s),l.evaluatedScale=i.paint.get("model-scale").evaluate(u,{},s)}}evaluate(e,i){const n=this.getNodesInfo();for(const s of n){if(!s.node.meshes)continue;const l=s.feature,u=i&&i[l.id];if(Wo(u,s.state))continue;s.state=structuredClone(u);const f=s.node.meshes&&s.node.meshes[0].featureData,p=s.evaluatedColor[2],g=s.evaluatedRMEA[2],x=this.id.canonical;if(s.hasTranslucentParts=!1,f){for(let b=0;b<F0.length;b++){const w=F0[b];w.length&&(l.properties.part=w);const S=e.paint.get("model-color").evaluate(l,u,x).toPremultipliedRenderColor(null),E=e.paint.get("model-color-mix-intensity").evaluate(l,u,x);s.evaluatedColor[b]=[S.r,S.g,S.b,E],s.evaluatedRMEA[b][0]=e.paint.get("model-roughness").evaluate(l,u,x),s.evaluatedRMEA[b][2]=e.paint.get("model-emissive-strength").evaluate(l,u,x),s.evaluatedRMEA[b][3]=S.a,s.emissionHeightBasedParams[b]=e.paint.get("model-height-based-emissive-strength-multiplier").evaluate(l,u,x),!s.hasTranslucentParts&&S.a<1&&(s.hasTranslucentParts=!0)}delete l.properties.part,iT(s,p!==s.evaluatedColor[2]||g!==s.evaluatedRMEA[2],this.modelTraits)}else s.evaluatedRMEA[0][2]=e.paint.get("model-emissive-strength").evaluate(l,u,x);s.evaluatedTranslation=e.paint.get("model-translation").evaluate(l,u,x),s.evaluatedScale=e.paint.get("model-scale").evaluate(l,u,x),this.updatePbrBuffer(s.node)||(this.needsUpload=!0)}this.dirty=!1}elevationUpdate(e,i,n,s){const l=e.findDEMTileFor(n);if(l&&(l.tileID.canonical!==this.terrainTile||i!==this.terrainExaggeration)){if
7(l.dem&&l.tileID.overscaledZ!==this.elevationReadFromZ){this.elevationReadFromZ=l.tileID.overscaledZ;const u=wh.create(e,n,l);if(!u)return;this.modelTraits&fh.HasMapboxMeshFeatures&&this.updateDEM(e,u,n,s);for(const f of this.getNodesInfo()){const p=f.node;if(!p.footprint||!p.footprint.vertices||!p.footprint.vertices.length)continue;const g=p.footprint.vertices;let x=u.getElevationAt(g[0].x,g[0].y,!0,!0);for(let b=1;b<g.length;b++)x=Math.min(x,u.getElevationAt(g[b].x,g[b].y,!0,!0));p.elevation=x}}this.terrainTile=l.tileID.canonical,this.terrainExaggeration=i}}updateDEM(e,i,n,s){let l=i._dem._modifiedForSources[s];if(l===void 0&&(i._dem._modifiedForSources[s]=[],l=i._dem._modifiedForSources[s]),l.includes(n.canonical))return;const u=i._dem.dim;l.push(n.canonical);let f=!1;for(const p of this.getNodesInfo()){const g=p.node;if(!g.footprint||!g.footprint.grid)continue;const x=g.footprint.grid,b=i.tileCoordToPixel(x.min.x,x.min.y),w=i.tileCoordToPixel(x.max.x,x.max.y),S=Math.min(Math.min(u-w.y,b.x),Math.min(b.y,u-w.x));if(S<0)continue;const E=re(S,2,5);let M=Math.max(0,b.x-E),C=Math.max(0,b.y-E),R=Math.min(w.x+E,u-1),F=Math.min(w.y+E,u-1);for(let q=C;q<=F;++q)for(let ie=M;ie<=R;++ie)Jc[q*u+ie]=255;let z=0,j=0;for(let q=0;q<x.cellsY;++q)for(let ie=0;ie<x.cellsX;++ie){if(!x.cells[q*x.cellsX+ie])continue;const W=i.tileCoordToPixel(x.min.x+ie/x.xScale,x.min.y+q/x.yScale),Q=i.tileCoordToPixel(x.min.x+(ie+1)/x.xScale,x.min.y+(q+1)/x.yScale);for(let Y=W.y;Y<=Math.min(Q.y+1,u-1);++Y)for(let ee=W.x;ee<=Math.min(Q.x+1,u-1);++ee)Jc[Y*u+ee]===255&&(Jc[Y*u+ee]=0,z+=i.getElevationAtPixel(ee,Y),j++)}const $=z/j;M=Math.max(1,b.x-E),C=Math.max(1,b.y-E),R=Math.min(w.x+E,u-2),F=Math.min(w.y+E,u-2),f=!0;for(let q=C;q<=F;++q)for(let ie=M;ie<=R;++ie)Jc[q*u+ie]===0&&(My[q*u+ie]=i._dem.set(ie,q,$));for(let q=1;q<E;++q){M=Math.max(1,b.x-q),C=Math.max(1,b.y-q),R=Math.min(w.x+q,u-2),F=Math.min(w.y+q,u-2);for(let ie=C;ie<=F;++ie)for(let W=M;W<=R;++W){const Q=ie*u+W;if(Jc[Q]===255){let Y=0,ee=0,me=-1,ge=-1;for(let Te=-1;Te<=1;++Te)for(let Ae=-1;Ae<=1;++Ae){const Ie=(ie+Te)*u+W+Ae;if(Jc[Ie]>=q)continue;const Fe=My[Ie],xe=Math.abs(Fe);xe>ee&&(Y=Fe,ee=xe,me=Ae,ge=Te)}if(ee>.1){const Te=1-(q+.5*Math.abs(me*ge))/E;let Ae=i._dem.get(W,ie)+Y*Te;const Ie=i._dem.get(W+me,ie+ge),Fe=i._dem.get(W-me,ie-ge,!0);(Ae-Ie)*(Ae-Fe)>0&&(Ae=(Ie+Fe)/2),My[Q]=i._dem.set(W,ie,Ae),Jc[Q]=q}}}}}f&&(i._demTile.needsDEMTextureUpload=!0,i._dem._timestamp=un.now())}setFilter(e){this.filter=e?Wu(e):null}getNodesInfo(){return this.filter?this.nodesInfo.filter(e=>this.filter.filter(new Wt(this.id.overscaledZ,{worldview:this.worldview}),e.feature,this.id.canonical)):this.nodesInfo}destroy(){const e=this.getNodesInfo();for(const i of e)n_(i.node),qg(i.node)}isEmpty(){return!this.nodesInfo.length}updateReplacement(e,i){if(i.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=i.updateTime;const n=i.getReplacementRegionsForTile(e.toUnwrapped());for(const s of this.getNodesInfo()){const l=s.node.footprint;s.hiddenByReplacement=!!l&&!n.some(u=>u.footprint===l)}}getHeightAtTileCoord(e,i){const n=[0,0,0],s=Ot([]);for(const l of this.getNodesInfo()){const u=l.node.meshes[0],f=u.transformedAabb;if(e<f.min[0]||i<f.min[1]||e>f.max[0]||i>f.max[1])continue;if(l.node.hidden===!0)return{height:1/0,maxHeight:l.feature.properties.height,hidden:!1,verticalScale:l.evaluatedScale[2]};if(an(s,l.node.globalMatrix),n[0]=e,n[1]=i,n[2]=0,Pi(n,n,s),l.node.meshBVH){const b=n[0],w=n[1];I_[0]=b-1,I_[1]=w-1,I_[2]=-1e3,E_[0]=b+1,E_[1]=w+1,E_[2]=1e3;const S=l.node.meshBVH.findHighestPoint(I_,E_);if(S!==null)return{height:S,maxHeight:l.feature.properties.height,hidden:l.hiddenByReplacement,verticalScale:l.evaluatedScale[2]};continue}const p=(n[0]-u.aabb.min[0])/(u.aabb.max[0]-u.aabb.min[0])*Hc|0,g=Math.min(63,(n[1]-u.aabb.min[1])/(u.aabb.max[1]-u.aabb.min[1])*Hc|0)*Hc+Math.min(63,p),x=u.heightmap[g];if(x<0&&l.node.footprint){const b=[];if(l.node.footprint.grid.query(new Ue(e,i),new Ue(e,i),b),b.length>0)return{height:void 0,maxHeight:l.feature.properties.height,hidden:l.hiddenByReplacement,verticalScale:l.evaluatedScale[2]};continue}return l.hiddenByReplacement?void 0:{height:x,maxHeight:l.feature.properties.height,hidden:!1,verticalScale:l.evaluatedScale[2]}}}}function kf(r,e){return r instanceof Ac&&!r.isLightConstant&&e}function k0(r,e,i,n,s,l,u,f){let p=(61440&e|(61440&e)>>4)>>8,g=(3840&e|(3840&e)>>4)>>4,x=240&e|(240&e)>>4;const b=15&e|(15&e)<<4;i[3]>0&&(p=ft(p,255*i[0],i[3]),g=ft(g,255*i[1],i[3]),x=ft(x,255*i[2],i[3]));const w=b/255;p*=w,g*=w,x*=w;const S=p<<8|g,E=x<<8|Math.floor(255*n[3]),M=(function(W){const Q=re(W,0,2);return Math.min(Math.round(.5*Q*255),255)})(n[2])<<8|15*n[0]<<4|15*n[1],C=re(s[0],0,1),R=re(s[1],0,1),F=re(s[2],0,1),z=re(s[3],0,1);let j,$,q,ie;if(C!==R&&u!==l&&R!==C){const W=u-l;$=1/(W*(R-C)),q=-(l+W*C)/(W*(R-C));const Q=re(s[4],-1,1);ie=Math.pow(10,Q),j=255*F<<8|255*z}else j=65535,$=0,q=1,ie=1;if(r.emplaceBack(S,E,M,j,$,q,ie),f){const W=f.length;f.clear();for(let Q=0;Q<W;Q++)f.emplaceBack(S,E,M,j,$,q,ie)}}function iT(r,e,i){const n=r.node;let s=0;const l=i&fh.HasMeshoptCompression;for(const u of n.meshes){if(n.lights&&n.lightMeshIndex===s||!u.featureData)continue;u.featureArray=new Ea,u.featureArray.reserve(u.featureData.length);let f=e;for(const p of u.featureData){const g=l?65535&p:p>>16&65535,x=l?p>>16&65535:65535&p,b=(15&x)<8?15&x:0,w=r.evaluatedRMEA[b],S=r.evaluatedColor[b],E=r.emissionHeightBasedParams[b];let M;if(f&&b===2&&n.lights&&(M=new Ea,M.resize(10*n.lights.length)),k0(u.featureArray,g,S,w,E,u.aabb.min[2],u.aabb.max[2],M),M&&f){f=!1;const C=n.meshes[n.lightMeshIndex];C.featureArray=M,C.featureArray._trim()}}u.featureArray._trim(),s++}if(n.lodMeshes){for(const u of n.lodMeshes)if(u.featureData){u.featureArray=new Ea,u.featureArray.reserve(u.featureData.length);for(const f of u.featureData){const p=l?f>>16&65535:65535&f,g=(15&p)<8?15&p:0;k0(u.featureArray,l?65535&f:f>>16&65535,r.evaluatedColor[g],r.evaluatedRMEA[g],r.emissionHeightBasedParams[g],u.aabb.min[2],u.aabb.max[2],null)}u.featureArray._trim()}}}et(A_,"Tiled3dModelBucket",{omit:["layers"]}),et(B0,"Tiled3dModelFeature");const rT=["id","tile","layer","source","sourceLayer","state"];class Kc{constructor(e,i,n,s,l){this.type="Feature",this._vectorTileFeature=e,this._z=i,this._x=n,this._y=s,this.properties=e?e.properties:{},this.id=l}clone(){const e=new Kc(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 this._geometry===void 0&&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 i of rT)this[i]!==void 0&&(e[i]=this[i]);return e}}class Qc extends tl{constructor(e,i,n,s){super(),this.id=e,this.type="model",this.models=[],this._options=i,this._modelsInfo=new Map,this._abortController=null}cancelModelRequests(){this._abortController&&(this._abortController.abort(),this._abortController=null)}loadGLTFFromURI(e,i){return Xx(this.map._requestManager.transformRequest(e,ca.Model).url,i)}async loadModel(e,i,n){try{const s=await this.loadGLTFFromURI(i.uri,n);if(n.aborted)return;const l=this._modelsInfo.get(e);if(!l)return;const u=Yg(s),f=l.modelSpec,p=new ev(e,f.uri,f.position,f.orientation,u);Qc.applyModelSpecification(p,f),p.computeBoundsAndApplyParent(),this.models.push(p),l.model=p}catch(s){if(s instanceof Error&&s.name==="AbortError")return;const l=s instanceof Error?s.message:"Unknown error";this.fire(new Qa(new Error(`Could not load model ${e} from ${i.uri}: ${l}`)))}}async load(){this._abortController||(this._abortController=new AbortController);const e=this._abortController.signal,i=[];for(const n in this._options.models){const s=this._options.models[n],l=this._modelsInfo.get(n);if(l&&l.model){l.modelSpec=s;const u=l.model;u.position=s.position!=null?new Zt(s.position[0],s.position[1]):new Zt(0,0),u.orientation=s.orientation!=null?s.orientation:[0,0,0],Qc.applyModelSpecification(u,s),u.computeBoundsAndApplyParent(),this.models.push(u)}else l?l.modelSpec=s:(this._modelsInfo.set(n,{modelSpec:s,model:null}),i.push(this.loadModel(n,s,e)))}i.length!==0?(await Promise.allSettled(i),e.aborted||this.fire(new io("data",{dataType:"source",sourceDataType:"metadata"}))):this.loaded()&&this.fire(new io("data",{dataType:"source",sourceDataType:"metadata"}))}static applyModelSpecification(e,i){i.nodeOverrides&&Qc.convertNodeOverrides(e,i.nodeOverrides),i.materialOverrides&&Qc.convertMaterialOverrides(e,i.materialOverrides),i.nodeOverrideNames&&(e.nodeOverrideNames=[...i.nodeOverrideNames]),i.materialOverrideNames&&(e.materialOverrideNames=[...i.materialOverrideNames]),i.featureProperties&&(e.featureProperties=i.featureProperties)}static convertNodeOverrides(e,i){if(Array.isArray(i)&&i.every(n=>typeof n=="string")){e.nodeOverrideNames=[];for(const n of i)e.nodeOverrideNames.push(n)}
vendor: 23,842 bytes, line 7
7else Object.entries(i).forEach(([n,s])=>{const l={orientation:[0,0,0]};if(Object.hasOwn(s,"orientation")){const u=s.orientation;u&&(l.orientation=u)}e.nodeOverrides.set(n,l)})}static convertMaterialOverrides(e,i){if(Array.isArray(i)&&i.every(n=>typeof n=="string")){e.materialOverrideNames=[];for(const n of i)e.materialOverrideNames.push(n)}else Object.entries(i).forEach(([n,s])=>{const l={color:new qt(1,1,1),colorMix:0,emissionStrength:0,opacity:1},u=s["model-color"];u!==void 0&&(l.color.r=u[0],l.color.g=u[1],l.color.b=u[2]);const f=s["model-color-mix-intensity"];f!==void 0&&(l.colorMix=f);const p=s["model-emissive-strength"];p!==void 0&&(l.emissionStrength=p);const g=s["model-opacity"];g!==void 0&&(l.opacity=g),e.materialOverrides.set(n,l)})}onAdd(e){this.map=e,this.load()}hasTransition(){return!1}loaded(){if(this._modelsInfo.size===0)return!0;for(const e of this._modelsInfo.values())if(e.model==null)return!1;return!0}getModels(){return this.models}loadTile(e,i){}serialize(){return this._options}setProperty(e,i){return!1}reload(){this.cancelModelRequests();const e=Rd(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 i=new Map;for(const n in e){const s=e[n],l=this._modelsInfo.get(n);l&&l.modelSpec.uri===s.uri&&i.set(n,l)}if(this._modelsInfo.size!==i.size){this.cancelModelRequests();for(const[n,s]of i)s.model||i.delete(n)}this._modelsInfo=i,this._options.models=e,this.load()}}function Cy(r,e,i,n){const s=1<<r.z;e.lat=pr((n/Xe+r.y)/s),e.lng=mn((i/Xe+r.x)/s)}function nT(r,e,i,n){const s=r.getNodesInfo()[e];if(!s||s.hiddenByReplacement||!s.node.meshes)return;let l=Number.MAX_VALUE;const u=s.node,f=i.tile,p=n.calculatePosMatrix(f.tileID.toUnwrapped(),n.worldSize),g=s.evaluatedScale;let x=0;n.elevation&&u.elevation&&(x=u.elevation*n.elevation.exaggeration()),Cr(p,p,[(u.anchor?u.anchor[0]:0)*(g[0]-1),(u.anchor?u.anchor[1]:0)*(g[1]-1),x]),Br(p,p,g);const b=i.queryGeometry,w=b.isPointQuery()?b.screenBounds:b.screenGeometry,S=function(M){const C=gi([],p,M.globalMatrix);gi(C,n.expandedFarZProjMatrix,C);for(let R=0;R<M.meshes.length;++R){const F=M.meshes[R];if(R===M.lightMeshIndex)continue;const z=$g(w,n,C,F.aabb);z!=null&&(l=Math.min(z,l))}if(M.children)for(const R of M.children)S(R)};if(S(u),l===Number.MAX_VALUE)return;const E=new Zt(0,0);return Cy(f.tileID.canonical,E,s.node.anchor[0],s.node.anchor[1]),{intersectionZ:l,position:E,feature:s.feature}}const oT={circle:class extends Xr{constructor(r,e,i,n){super(r,{layout:J||(J=new bi({"circle-sort-key":new Ze(he.layout_circle["circle-sort-key"]),"circle-elevation-reference":new He(he.layout_circle["circle-elevation-reference"]),visibility:new He(he.layout_circle.visibility)})),paint:K||(K=new bi({"circle-radius":new Ze(he.paint_circle["circle-radius"]),"circle-color":new Ze(he.paint_circle["circle-color"]),"circle-blur":new Ze(he.paint_circle["circle-blur"]),"circle-opacity":new Ze(he.paint_circle["circle-opacity"]),"circle-translate":new He(he.paint_circle["circle-translate"]),"circle-translate-anchor":new He(he.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new He(he.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new He(he.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new Ze(he.paint_circle["circle-stroke-width"]),"circle-stroke-color":new Ze(he.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new Ze(he.paint_circle["circle-stroke-opacity"]),"circle-emissive-strength":new He(he.paint_circle["circle-emissive-strength"]),"circle-color-use-theme":new Ze({type:"string",default:"default","property-type":"data-driven"}),"circle-stroke-color-use-theme":new Ze({type:"string",default:"default","property-type":"data-driven"})}))},e,i,n)}createBucket(r){return new c(r)}queryRadius(r){const e=r;return G("circle-radius",this,e)+G("circle-stroke-width",this,e)+ne(this.paint.get("circle-translate"))}queryIntersectsFeature(r,e,i,n,s,l,u,f){const p=se(this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),l.angle,r.pixelToTileUnitsFactor),g=this.paint.get("circle-radius").evaluate(e,i)+this.paint.get("circle-stroke-width").evaluate(e,i);return vt(r,n,l,u,f,this.paint.get("circle-pitch-alignment")==="map",this.paint.get("circle-pitch-scale")==="map",p,g)}getProgramIds(){return["circle"]}getDefaultProgramParams(r,e,i){const n=Qt(this);return{config:new Ca(this,{zoom:e,lut:i}),defines:n,overrideFog:!1}}is3D(r){return!r&&!!this.layout&&this.layout.get("circle-elevation-reference")!=="none"}hasElevation(){return this.layout&&this.layout.get("circle-elevation-reference")!=="none"}},heatmap:class extends Xr{createBucket(r){return new qi(r)}constructor(r,e,i,n){super(r,{layout:Ir||(Ir=new bi({visibility:new He(he.layout_heatmap.visibility)})),paint:sr||(sr=new bi({"heatmap-radius":new Ze(he.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Ze(he.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new He(he.paint_heatmap["heatmap-intensity"]),"heatmap-color":new zs(he.paint_heatmap["heatmap-color"]),"heatmap-opacity":new He(he.paint_heatmap["heatmap-opacity"]),"heatmap-color-use-theme":new Ze({type:"string",default:"default","property-type":"data-driven"})}))},e,i,n),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(r){r==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=Xt({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(r){return G("heatmap-radius",this,r)}queryIntersectsFeature(r,e,i,n,s,l,u,f){const p=this.paint.get("heatmap-radius").evaluate(e,i);return vt(r,n,l,u,f,!0,!0,new Ue(0,0),p)}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}getProgramIds(){return["heatmap","heatmapTexture"]}getDefaultProgramParams(r,e,i){return r==="heatmap"?{config:new Ca(this,{zoom:e,lut:i}),overrideFog:!1}:{}}},hillshade:class extends Xr{constructor(r,e,i,n){super(r,{layout:mr||(mr=new bi({visibility:new He(he.layout_hillshade.visibility)})),paint:tr||(tr=new bi({"hillshade-illumination-direction":new He(he.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new He(he.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new He(he.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new He(he.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new He(he.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new He(he.paint_hillshade["hillshade-accent-color"]),"hillshade-emissive-strength":new He(he.paint_hillshade["hillshade-emissive-strength"]),"hillshade-shadow-color-use-theme":new Ze({type:"string",default:"default","property-type":"data-driven"}),"hillshade-highlight-color-use-theme":new Ze({type:"string",default:"default","property-type":"data-driven"}),"hillshade-accent-color-use-theme":new Ze({type:"string",default:"default","property-type":"data-driven"})}))},e,i,n)}shouldRedrape(){return this.hasOffscreenPass()&&this.paint.get("hillshade-illumination-anchor")==="viewport"}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}getProgramIds(){return["hillshade","hillshadePrepare"]}getDefaultProgramParams(r,e,i){return{overrideFog:!1}}},fill:class extends Xr{constructor(r,e,i,n){super(r,{layout:nx||(nx=new bi({"fill-sort-key":new Ze(he.layout_fill["fill-sort-key"]),visibility:new He(he.layout_fill.visibility),"fill-elevation-reference":new He(he.layout_fill["fill-elevation-reference"]),"fill-construct-bridge-guard-rail":new Ze(he.layout_fill["fill-construct-bridge-guard-rail"])})),paint:ox||(ox=new bi({"fill-antialias":new He(he.paint_fill["fill-antialias"]),"fill-opacity":new Ze(he.paint_fill["fill-opacity"]),"fill-color":new Ze(he.paint_fill["fill-color"]),"fill-outline-color":new Ze(he.paint_fill["fill-outline-color"]),"fill-translate":new He(he.paint_fill["fill-translate"]),"fill-translate-anchor":new He(he.paint_fill["fill-translate-anchor"]),"fill-pattern":new Ze(he.paint_fill["fill-pattern"]),"fill-pattern-cross-fade":new He(he.paint_fill["fill-pattern-cross-fade"]),"fill-emissive-strength":new He(he.paint_fill["fill-emissive-strength"]),"fill-z-offset":new Ze(he.paint_fill["fill-z-offset"]),"fill-bridge-guard-rail-color":new Ze(he.paint_fill["fill-bridge-guard-rail-color"]),"fill-tunnel-structure-color":new Ze(he.paint_fill["fill-tunnel-structure-color"]),"fill-color-use-theme":new Ze({type:"string",default:"default","property-type":"data-driven"}),"fill-outline-color-use-theme":new Ze({type:"string",default:"default","property-type":"data-driven"}),"fill-bridge-guard-rail-color-use-theme":new Ze({type:"string",default:"default","property-type":"data-driven"}),"fill-tunnel-structure-color-use-theme":new Ze({type:"string",default:"default","property-type":"data-driven"})}))},e,i,n)}getProgramIds(){const r=this.paint.get("fill-pattern"),e=r&&r.constantOr(1),i=[e?"fillPattern":"fill"];return this.paint.get("fill-antialias")&&i.push(e&&!this.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline"),i}getDefaultProgramParams(r,e,i){return{config:new Ca(this,{zoom:e,lut:i}),overrideFog:!1}}recalculate(r,e){super.recalculate(r,e);const i=this.paint._values["fill-outline-color"];i.value.kind==="constant"&&i.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(r){return new Bm(r)}queryRadius(){return ne(this.paint.get("fill-translate"))}queryIntersectsFeature(r,e,i,n,s,l){return!r.queryGeometry.isAboveHorizon&&_(te(r.tilespaceGeometry,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),l.angle,r.pixelToTileUnitsFactor),n)}isTileClipped(){return this.paint.get("fill-z-offset").constantOr(1)===0}is3D(r){if(this.paint.get("fill-z-offset").constantOr(1)!==0)return!0;const e=this.layout&&this.layout.get("fill-elevation-reference")!=="none";return r!=null?e&&!r:e}hasElevation(){return this.layout&&this.layout.get("fill-elevation-reference")!=="none"}hasShadowPass(){return this.layout&&this.layout.get("fill-elevation-reference")!=="none"}},"fill-extrusion":class extends Xr{constructor(r,e,i,n){super(r,{layout:Ix||(Ix=new bi({visibility:new He(he["layout_fill-extrusion"].visibility),"fill-extrusion-edge-radius":new He(he["layout_fill-extrusion"]["fill-extrusion-edge-radius"]),"source-max-zoom":new He(he["layout_fill-extrusion"]["source-max-zoom"])})),paint:Ex||(Ex=new bi({"fill-extrusion-opacity":new He(he["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Ze(he["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new He(he["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new He(he["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Ze(he["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-pattern-cross-fade":new He(he["paint_fill-extrusion"]["fill-extrusion-pattern-cross-fade"]),"fill-extrusion-height":new Ze(he["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Ze(he["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-height-alignment":new He(he["paint_fill-extrusion"]["fill-extrusion-height-alignment"]),"fill-extrusion-base-alignment":new He(he["paint_fill-extrusion"]["fill-extrusion-base-alignment"]),"fill-extrusion-vertical-gradient":new He(he["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"]),"fill-extrusion-ambient-occlusion-intensity":new He(he["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-intensity"]),"fill-extrusion-ambient-occlusion-radius":new He(he["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-radius"]),"fill-extrusion-ambient-occlusion-wall-radius":new He(he["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-wall-radius"]),"fill-extrusion-ambient-occlusion-ground-radius":new He(he["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-ground-radius"]),"fill-extrusion-ambient-occlusion-ground-attenuation":new He(he["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-ground-attenuation"]),"fill-extrusion-flood-light-color":new He(he["paint_fill-extrusion"]["fill-extrusion-flood-light-color"]),"fill-extrusion-flood-light-intensity":new He(he["paint_fill-extrusion"]["fill-extrusion-flood-light-intensity"]),"fill-extrusion-flood-light-wall-radius":new Ze(he["paint_fill-extrusion"]["fill-extrusion-flood-light-wall-radius"]),"fill-extrusion-flood-light-ground-radius":new Ze(he["paint_fill-extrusion"]["fill-extrusion-flood-light-ground-radius"]),"fill-extrusion-flood-light-ground-attenuation":new He(he["paint_fill-extrusion"]["fill-extrusion-flood-light-ground-attenuation"]),"fill-extrusion-vertical-scale":new He(he["paint_fill-extrusion"]["fill-extrusion-vertical-scale"]),"fill-extrusion-rounded-roof":new He(he["paint_fill-extrusion"]["fill-extrusion-rounded-roof"]),"fill-extrusion-cutoff-fade-range":new He(he["paint_fill-extrusion"]["fill-extrusion-cutoff-fade-range"]),"fill-extrusion-front-cutoff":new He(he["paint_fill-extrusion"]["fill-extrusion-front-cutoff"]),"fill-extrusion-emissive-strength":new Ze(he["paint_fill-extrusion"]["fill-extrusion-emissive-strength"]),"fill-extrusion-line-width":new Ze(he["paint_fill-extrusion"]["fill-extrusion-line-width"]),"fill-extrusion-cast-shadows":new He(he["paint_fill-extrusion"]["fill-extrusion-cast-shadows"]),"fill-extrusion-color-use-theme":new Ze({type:"string",default:"default","property-type":"data-driven"}),"fill-extrusion-flood-light-color-use-theme":new Ze({type:"string",default:"default","property-type":"data-driven"})}))},e,i,n),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(r){return new Wm(r)}queryRadius(){return ne(this.paint.get("fill-extrusion-translate"))}is3D(r){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(r,e,i,n,s,l,u,f,p){const g=se(this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),l.angle,r.pixelToTileUnitsFactor),x=this.paint.get("fill-extrusion-height").evaluate(e,i),b=this.paint.get("fill-extrusion-base").evaluate(e,i),w=[0,0],S=f&&l.elevation,E=l.elevation?l.elevation.exaggeration():1,M=r.tile.getBucket(this);if(M instanceof Wm){const j=M.centroidData.find($=>p>=$.vertexArrayOffset&&p<$.vertexArrayOffset+$.vertexCount);if(j&&j.flags&Gm)return!1;if(S){const $=M.centroidVertexArray,q=p+1;q<$.length&&(w[0]=$.geta_centroid_pos0(q),w[1]=$.geta_centroid_pos1(q))}}if(w[0]===0&&w[1]===1)return!1;l.projection.name==="globe"&&(n=Sx([n],[new Ue(0,0),new Ue(Xe,Xe)],r.tileID.canonical).map(j=>j.polygon).flat());const C=S?f:null,[R,F]=Ox(l,n,b,x,g,u,C,w,E,l.center.lat,r.tileID.canonical),z=r.queryGeometry;return Lx(R,F,z.isPointQuery()?z.screenBounds:z.screenGeometry)}},building:class extends Xr{constructor(r,e,i,n){super(r,{layout:Ax||(Ax=new bi({visibility:new He(he.layout_building.visibility),"building-facade":new Ze(he.layout_building["building-facade"]),"building-facade-floors":new Ze(he.layout_building["building-facade-floors"]),"building-facade-unit-width":new Ze(he.layout_building["building-facade-unit-width"]),"building-facade-window":new Ze(he.layout_building["building-facade-window"]),"building-roof-shape":new Ze(he.layout_building["building-roof-shape"]),"building-height":new Ze(he.layout_building["building-height"]),"building-base":new Ze(he.layout_building["building-base"]),"building-flood-light-wall-radius":new Ze(he.layout_building["building-flood-light-wall-radius"]),"building-flood-light-ground-radius":new Ze(he.layout_building["building-flood-light-ground-radius"]),"building-flip-roof-orientation":new Ze(he.layout_building["building-flip-roof-orientation"])})),paint:Mx||(Mx=new bi({"building-opacity":new He(he.paint_building["building-opacity"]),"building-ambient-occlusion-intensity":new He(he.paint_building["building-ambient-occlusion-intensity"]),"building-ambient-occlusion-ground-intensity":new He(he.paint_building["building-ambient-occlusion-ground-intensity"]),"building-ambient-occlusion-ground-radius":new He(he.paint_building["building-ambient-occlusion-ground-radius"]),"building-ambient-occlusion-ground-attenuation":new He(he.paint_building["building-ambient-occlusion-ground-attenuation"]),"building-vertical-scale":new He(he.paint_building["building-vertical-scale"]),"building-cast-shadows":new He(he.paint_building["building-cast-shadows"]),"building-color":new Ze(he.paint_building["building-color"]),"building-emissive-strength":new Ze(he.paint_building["building-emissive-strength"]),"building-facade-emissive-chance":new He(he.paint_building["building-facade-emissive-chance"]),"building-cutoff-fade-range":new He(he.paint_building["building-cutoff-fade-range"]),"building-front-cutoff":new He(he.paint_building["building-front-cutoff"]),"building-flood-light-color":new He(he.paint_building["building-flood-light-color"]),"building-flood-light-intensity":new He(he.paint_building["building-flood-light-intensity"]),"building-flood-light-ground-attenuation":new He(he.paint_building["building-flood-light-ground-attenuation"]),"building-color-use-theme":new Ze({type:"string",default:"default","property-type":"data-driven"}),"building-flood-light-color-use-theme":new Ze({type:"string",default:"default","property-type":"data-driven"})}))},e,i,n),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}prepare(){return dv()}createBucket(r){return new hv(r)}cutoffRange(){return this.paint.get("building-cutoff-fade-range")}hasShadowPass(){return this.paint.get("building-cast-shadows")}hasLightBeamPass(){return!0}canCastShadows(){return!0}is3D(r){return!0}queryRadius(r){return 0}queryIntersectsFeature(r,e,i,n,s,l,u,f,p,g){let x=this.layout.get("building-height").evaluate(e,i);const b=this.layout.get("building-base").evaluate(e,i),w=r.tile.getBucket(this).getFootprint(e);if(w){if(w.hiddenFlags!==0)return!1;x=w.height}const[S,E]=Ox(l,n,b,x,new Ue(0,0),u,null,[0,0],1,l.center.lat,r.tileID.canonical),M=r.queryGeometry;return Lx(S,E,M.isPointQuery()?M.screenBounds:M.screenGeometry)}},line:class extends Xr{constructor(r,e,i,n){const s=wv();super(r,s,e,i,n),s.layout&&(this.layout=new is(s.layout)),this.gradientVersion=0,this.hasElevatedBuckets=!1,this.hasNonElevatedBuckets=!1,this.lineBlendFbos=null,this.lineBlendDensityReadback=null}_handleSpecialPaintPropertyUpdate(r){if(r==="line-gradient"){const e=this._transitionablePaint._values["line-gradient"].value.expression;this.stepInterpolant=e._styleExpression&&e._styleExpression.expression instanceof dl,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(r,e){super.recalculate(r,e),this.paint._values["line-floorwidth"]=(()=>{if(Sf)return Sf;const i=wv();return Sf=new X1(i.paint.properties["line-width"].specification),Sf.useIntegerZoom=!0,Sf})().possiblyEvaluate(this._transitioningPaint._values["line-width"].value,r)}createBucket(r){return new s_(r)}getProgramIds(){const r=[this.paint.get("line-pattern").constantOr(1)?"linePattern":"line"];return this.paint.get("line-blend-mode")!=="default"&&r.push("lineBlendComposite"),r}getDefaultProgramParams(r,e,i){if(r==="lineBlendComposite")return{};const n=vv(this);return{config:new Ca(this,{zoom:e,lut:i}),defines:n,overrideFog:!1}}queryRadius(r){const e=r,i=Tv(G("line-width",this,e),G("line-gap-width",this,e)),n=G("line-offset",this,e);return i/2+Math.abs(n)+ne(this.paint.get("line-translate"))}queryIntersectsFeature(r,e,i,n,s,l){if(r.queryGeometry.isAboveHorizon)return!1;const u=te(r.tilespaceGeometry,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),l.angle,r.pixelToTileUnitsFactor),f=r.pixelToTileUnitsFactor/2*Tv(this.paint.get("line-width").evaluate(e,i),this.paint.get("line-gap-width").evaluate(e,i)),p=this.paint.get("line-offset").evaluate(e,i);return p&&(n=(function(g,x){const b=[],w=new Ue(0,0);for(let S=0;S<g.length;S++){const E=g[S],M=[];for(let C=0;C<E.length;C++){const R=E[C],F=E[C+1],z=C===0?w:R.sub(E[C-1])._unit()._perp(),j=C===E.length-1?w:F.sub(R)._unit()._perp(),$=z._add(j)._unit();$._mult(1/($.x*j.x+$.y*j.y)),M.push($._mult(x)._add(R))}b.push(M)}return b})(n,p*r.pixelToTileUnitsFactor)),(function(g,x,b){for(let w=0;w<x.length;w++){const S=x[w];if(g.length>=3){for(let E=0;E<S.length;E++)if(L(g,S[E]))return!0}if(y(g,S,b))return!0}return!1})(u,n,f)}isTileClipped(){return this.hasNonElevatedBuckets}isDraped(r){return!this.hasElevatedBuckets||this.layout&&this.layout.get("line-elevation-reference")==="hd-road-markup"}hasElevation(){return this.layout&&this.layout.get("line-elevation-reference")!=="none"}hasOffscreenPass(){return this.paint.get("line-blend-mode")!=="default"&&this.paint.get("line-opacity").constantOr(1)!==0&&this.paint.get("line-width").constantOr(1)!==0&&this.visibility!=="none"}resize(){this._destroyLineBlendFbo()}onRemove(r){this._destroyLineBlendFbo(r.painter&&r.painter.context&&r.painter.context.gl||void 0)}_clear(){this._destroyLineBlendFbo()}_destroyLineBlendFbo(r){this.lineBlendFbos&&(this.lineBlendFbos.destroy(),this.lineBlendFbos=null),r&&this.lineBlendDensityReadback&&this.lineBlendDensityReadback.destroy(r),this.lineBlendDensityReadback=null}},symbol:b_,background:class extends Xr{constructor(r,e,i,n){super(r,{layout:g0||(g0=new bi({visibility:new He(he.layout_background.visibility)})),paint:y0||(y0=new bi({"background-pitch-alignment":new He(he.paint_background["background-pitch-alignment"]),"background-color":new He(he.paint_background["background-color"]),"background-pattern":new He(he.paint_background["background-pattern"]),"background-opacity":new He(he.paint_background["background-opacity"]),"background-emissive-strength":new He(he.paint_background["background-emissive-strength"]),"background-color-use-theme":new Ze({type:"string",default:"default","property-type":"data-driven"})}))},e,i,n)}getProgramIds(){return[this.paint.get("background-pattern")?"backgroundPattern":"background"]}getDefaultProgramParams(r,e,i){return{overrideFog:!1}}is3D(r){return this.paint.get("background-pitch-alignment")==="viewport"}},raster:T0,"raster-particle":D0,sky:class extends Xr{constructor(r,e,i,n){super(r,{layout:E0||(E0=new bi({visibility:new He(he.layout_sky.visibility)})),paint:A0||(A0=new bi({"sky-type":new He(he.paint_sky["sky-type"]),"sky-atmosphere-sun":new He(he.paint_sky["sky-atmosphere-sun"]),"sky-atmosphere-sun-intensity":new He(he.paint_sky["sky-atmosphere-sun-intensity"]),"sky-gradient-center":new He(he.paint_sky["sky-gradient-center"]),"sky-gradient-radius":new He(he.paint_sky["sky-gradient-radius"]),"sky-gradient":new zs(he.paint_sky["sky-gradient"]),"sky-atmosphere-halo-color":new He(he.paint_sky["sky-atmosphere-halo-color"]),"sky-atmosphere-color":new He(he.paint_sky["sky-atmosphere-color"]),"sky-opacity":new He(he.paint_sky["sky-opacity"]),"sky-gradient-use
7-theme":new Ze({type:"string",default:"default","property-type":"data-driven"}),"sky-atmosphere-halo-color-use-theme":new Ze({type:"string",default:"default","property-type":"data-driven"}),"sky-atmosphere-color-use-theme":new Ze({type:"string",default:"default","property-type":"data-driven"})}))},e,i,n),this._updateColorRamp()}_clear(){this.skyboxFbo&&(this.skyboxFbo.destroy(),this.skyboxFbo=null),this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null),this._skyboxInvalidated=!0}_handleSpecialPaintPropertyUpdate(r){r==="sky-gradient"?this._updateColorRamp():r!=="sky-atmosphere-sun"&&r!=="sky-atmosphere-halo-color"&&r!=="sky-atmosphere-color"&&r!=="sky-atmosphere-sun-intensity"||(this._skyboxInvalidated=!0)}_updateColorRamp(){this.colorRamp=Xt({expression:this._transitionablePaint._values["sky-gradient"].value.expression,evaluationKey:"skyRadialProgress"}),this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null)}needsSkyboxCapture(r){if(this._skyboxInvalidated||!this.skyboxTexture||!this.skyboxGeometry)return!0;if(!this.paint.get("sky-atmosphere-sun")){const e=r.style.light.properties.get("position");return this._lightPosition.azimuthal!==e.azimuthal||this._lightPosition.polar!==e.polar}return!1}getCenter(r,e){if(this.paint.get("sky-type")==="atmosphere"){const n=this.paint.get("sky-atmosphere-sun"),s=!n,l=r.style.light,u=l.properties.get("position");return s&&l.properties.get("anchor")==="viewport"&&Pt("The sun direction is attached to a light with viewport anchor, lighting may behave unexpectedly."),s?Ey(u.azimuthal,90-u.polar,e):Ey(n[0],90-n[1],e)}const i=this.paint.get("sky-gradient-center");return Ey(i[0],90-i[1],e)}isSky(){return!0}markSkyboxValid(r){this._skyboxInvalidated=!1,this._lightPosition=r.style.light.properties.get("position")}hasOffscreenPass(){return!0}getProgramIds(){const r=this.paint.get("sky-type");return r==="atmosphere"?["skyboxCapture","skybox"]:r==="gradient"?["skyboxGradient"]:null}},slot:class extends Xr{constructor(r,e,i,n){super(r,{paint:M0||(M0=new bi({}))},e,null)}},model:class extends Xr{constructor(r,e,i,n){super(r,{layout:C0||(C0=new bi({visibility:new He(he.layout_model.visibility),"model-id":new Ze(he.layout_model["model-id"]),"model-allow-density-reduction":new He(he.layout_model["model-allow-density-reduction"])})),paint:P0||(P0=new bi({"model-opacity":new Ze(he.paint_model["model-opacity"]),"model-rotation":new Ze(he.paint_model["model-rotation"]),"model-scale":new Ze(he.paint_model["model-scale"]),"model-translation":new Ze(he.paint_model["model-translation"]),"model-color":new Ze(he.paint_model["model-color"]),"model-color-mix-intensity":new Ze(he.paint_model["model-color-mix-intensity"]),"model-type":new He(he.paint_model["model-type"]),"model-cast-shadows":new He(he.paint_model["model-cast-shadows"]),"model-receive-shadows":new He(he.paint_model["model-receive-shadows"]),"model-ambient-occlusion-intensity":new He(he.paint_model["model-ambient-occlusion-intensity"]),"model-emissive-strength":new Ze(he.paint_model["model-emissive-strength"]),"model-roughness":new Ze(he.paint_model["model-roughness"]),"model-height-based-emissive-strength-multiplier":new Ze(he.paint_model["model-height-based-emissive-strength-multiplier"]),"model-cutoff-fade-range":new He(he.paint_model["model-cutoff-fade-range"]),"model-front-cutoff":new He(he.paint_model["model-front-cutoff"]),"model-elevation-reference":new He(he.paint_model["model-elevation-reference"]),"model-ignore-line-cutout":new He(he.paint_model["model-ignore-line-cutout"]),"model-color-use-theme":new Ze({type:"string",default:"default","property-type":"data-driven"})}))},e,i,n),this.layer=r,this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(r){return new Ay(r)}getProgramIds(){return["model"]}is3D(r){return!0}hasShadowPass(){return!0}canCastShadows(){return!0}hasLightBeamPass(){return!0}cutoffRange(){return this.paint.get("model-cutoff-fade-range")}queryRadius(r){return r instanceof A_?8191:0}queryRenderedFeatures(r,e,i){const n=e.getSource();if(!(n&&n instanceof Qc))return{};const s=n,l={};l[this.id]=[];const u=l[this.id];let f=0;for(const p of s.models){const g=e.getFeatureState(this.sourceLayer,p.id),x={type:"Unknown",id:p.id,properties:p.featureProperties},b=this.paint.get("model-rotation").evaluate(x,g),w=this.paint.get("model-scale").evaluate(x,g),S=this.paint.get("model-translation").evaluate(x,g),E=this.paint.get("model-elevation-reference");let M=[];r_(M,p,i,p.position,b,w,S,E==="ground",E==="ground",!1),i.projection.name==="globe"&&(M=i_(M,i));const C=gi([],i.projMatrix,M),R=$g(r.isPointQuery()?r.screenBounds:r.screenGeometry,i,C,p.aabb);if(R!=null){const F=new Kc(void 0,0,0,0,p.id);F.layer=this.layer,F.properties=structuredClone(p.featureProperties),F.properties.layer=this.id,F.properties.uri=p.uri,F.properties.orientation=p.orientation,F.sourceLayer=this.sourceLayer,F.geometry={type:"Point",coordinates:[p.position.lng,p.position.lat]},F.state=g,F.source=this.source,u.push({featureIndex:f,feature:F,intersectionZ:R})}++f}return l}queryIntersectsFeature(r,e,i,n,s,l,u,f,p,g){if(!this.modelManager)return!1;const x=this.modelManager,b=r.tile.getBucket(this);if(!(b&&b instanceof Ay))return!1;for(const w in b.instancesPerModel){const S=b.instancesPerModel[w],E=e.id!==void 0?e.id:e.properties&&Object.hasOwn(e.properties,"id")?e.properties.id:void 0;if(Object.hasOwn(S.idToFeaturesIndex,E)){const M=S.features[S.idToFeaturesIndex[E]],C=x.getModel(w,g||this.scope);if(!C)return!1;let R=[];const F=new Zt(0,0),z=b.canonical;let j=Number.MAX_VALUE;for(let $=0;$<M.instancedDataCount;++$){const q=16*(M.instancedDataOffset+$),ie=S.instancedDataArray.float32,W=[ie[q+4],ie[q+5],ie[q+6]];Cy(z,F,Math.floor(ie[q]),Math.floor(ie[q+1])),r_(R,C,l,F,M.rotation,M.scale,W,!1,!1,!1),l.projection.name==="globe"&&(R=i_(R,l));const Q=gi([],l.projMatrix,R),Y=r.queryGeometry,ee=$g(Y.isPointQuery()?Y.screenBounds:Y.screenGeometry,l,Q,C.aabb);ee!=null&&(j=Math.min(ee,j))}return j!==Number.MAX_VALUE&&j}}return!1}_handleOverridablePaintPropertyUpdate(r,e,i){return!(!this.layout||e.isDataDriven()||i.isDataDriven()||r!=="model-color"&&r!=="model-color-mix-intensity"&&r!=="model-rotation"&&r!=="model-scale"&&r!=="model-translation"&&r!=="model-emissive-strength")}_isPropertyZoomDependent(r){const e=this._transitionablePaint._values[r];return e!=null&&e.value!=null&&e.value.expression!=null&&e.value.expression instanceof Mo}isZoomDependent(){return this._isPropertyZoomDependent("model-scale")||this._isPropertyZoomDependent("model-rotation")||this._isPropertyZoomDependent("model-translation")}},clip:class extends Xr{constructor(r,e,i,n){super(r,{layout:sx||(sx=new bi({"clip-layer-types":ne
vendor: 4,270 bytes, line 7
7w He(he.layout_clip["clip-layer-types"]),"clip-layer-scope":new He(he.layout_clip["clip-layer-scope"]),visibility:new He(he.layout_clip.visibility)})),paint:ax||(ax=new bi({}))},e,i,n)}recalculate(r,e){super.recalculate(r,e)}createBucket(r){return new lx(r)}is3D(r){return!0}}};class Py{constructor(e){this.capacity=e,this.cache=new Map}get(e){if(!this.cache.has(e))return;const i=this.cache.get(e);return this.cache.delete(e),this.cache.set(e,i),i}put(e,i){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,i)}delete(e){this.cache.delete(e)}}et(Py,"LRUCache");class sT{constructor(e){this._callback=e,this._triggered=!1,typeof MessageChannel<"u"&&(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 N0{constructor(e){this._stringToNumber={},this._numberToString=[];for(let i=0;i<e.length;i++){const n=e[i];this._stringToNumber[n]=i,this._numberToString[i]=n}}encode(e){return this._stringToNumber[e]}decode(e){return this._numberToString[e]}}class U0{constructor(e,i){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new ba(Xe,Xe,512),this.featureIndexArray=new Zd,this.promoteId=i,this.is3DTile=!1,this.serializedLayersCache=new Map}insert(e,i,n,s,l,u=0,f=0){const p=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(n,s,l,u);const g=this.grid;for(let x=0;x<i.length;x++){const b=i[x],w=[1/0,1/0,-1/0,-1/0];for(let S=0;S<b.length;S++){const E=b[S];w[0]=Math.min(w[0],E.x),w[1]=Math.min(w[1],E.y),w[2]=Math.max(w[2],E.x),w[3]=Math.max(w[3],E.y)}f!==0&&(w[0]-=f,w[1]-=f,w[2]+=f,w[3]+=f),w[0]<Xe&&w[1]<Xe&&w[2]>=0&&w[3]>=0&&g.insert(p,w[0],w[1],w[2],w[3])}}loadVTLayers(){if(!this.vtLayers){this.vtLayers=new tf(new a_(this.rawTileData)).layers,this.sourceLayerCoder=new N0(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"]),this.vtFeatures={};for(const e in this.vtLayers)this.vtFeatures[e]=[]}return this.vtLayers}query(e,i){const{tilespaceGeometry:n,transform:s,tileTransform:l,pixelPosMatrix:u,availableImages:f,worldview:p}=i;this.loadVTLayers(),this.serializedLayersCache.clear();const g=i.queryRadius?i.queryRadius:0,x=n.bufferedTilespaceBounds,b=this.grid.queryKeys(x.min.x,x.min.y,x.max.x,x.max.y,(M,C,R,F)=>k(n.bufferedTilespaceGeometry,M-g,C-g,R+g,F+g));b.sort(aT);let w=null;s.elevation&&b.length>0&&(w=wh.create(s.elevation,this.tileID));const S={};let E;for(let M=0;M<b.length;M++){const C=b[M];if(C===E)continue;E=C;const R=this.featureIndexArray.get(C);let F=null;this.is3DTile?this.loadMatchingModelFeature(S,R,e,n,s,p):this.loadMatchingFeature(S,R,e,f,p,(z,j,$,q=0)=>(F||(F=gn(z,this.tileID.canonical,l)),j.queryIntersectsFeature(n,z,$,F,this.z,s,u,w,q,i.scope)))}return S}loadMatchingFeature(e,i,n,s,l,u){const{featureIndex:f,bucketIndex:p,sourceLayerIndex:g,layoutVertexArrayOffset:x}=i,b=this.bucketLayerIDs[p],w=n.layers,S=Object.keys(w);if(S.length&&!Gi(S,b))return;const E=n.sourceCache,M=this.sourceLayerCoder.decode(g),C=this.vtLayers[M].feature(f),R=this.getId(C,M);for(let F=0;F<b.length;F++){const z=b[F];if(!w[z])continue;const{styleLayer:j,targets:$}=w[z];let q={};R!==void 0&&(q=E.getFeatureState(j.sourceLayer,R));const ie=!u||u(C,j,q,x);if(!ie)continue;const W=new Kc(C,this.z,this.x,this.y,R);W.tile=this.tileID.canonical,W.state=q;let Q=this.serializedLayersCache.get(z);Q||(Q=j.serialize(),Q.id=z,this.serializedLayersCache.set(z,Q)),W.source=Q.source,W.sourceLayer=Q["source-layer"],W.layer=Object.assign({},Q),W.layer.paint=V0(Q.paint,j.paint,C,q,s),W.layer.layout=V0(Q.layout,j.layout,C,q,s);let Y=!1;for(const ee of $){this.updateFeatureProperties(W,ee);const{filter:me}=ee;if(me){if(C.properties=W.properties,me.needGeometry){const ge=$n(C,!0);if(!me.filter(new Wt(this.tileID.overscaledZ,{worldview:l}),ge,this.tileID.canonical))continue}else if(!me.filter(new Wt(this.tileID.overscaledZ,{worldview:l}),C))continue}Y=!0,ee.targetId&&this.addFeatureVariant(W,ee)}Y&&this.appendToResult(e,z,f,W,ie)}}
7loadMatchingModelFeature(e,i,n,s,l,u){const{featureIndex:f,bucketIndex:p}=i,g=this.bucketLayerIDs[p],x=n.layers,b=Object.keys(x);if(!b.length||Gi(b,g))for(let w=0;w<g.length;w++){const S=g[w],{styleLayer:E,targets:M}=x[S];if(E.type!=="model")continue;const C=s.tile,R=C.getBucket(E);if(!(R&&R instanceof A_))continue;const F=nT(R,f,s,l);if(!F)continue;const{z,x:j,y:$}=C.tileID.canonical,{feature:q,intersectionZ:ie,position:W}=F;let Q={};q.id!==void 0&&(Q=n.sourceCache.getFeatureState(E.sourceLayer,q.id));const Y=new Kc({},z,j,$,q.id);Y.tile=this.tileID.canonical,Y.state=Q,Y.properties=q.properties,Y.geometry={type:"Point",coordinates:[W.lng,W.lat]};let ee=this.serializedLayersCache.get(S);ee||(ee=E.serialize(),ee.id=S,this.serializedLayersCache.set(S,ee)),Y.source=ee.source,Y.sourceLayer=ee["source-layer"],Y.layer=Object.assign({},ee);let me=!1;for(const ge of M){this.updateFeatureProperties(Y,ge);const{filter:Te}=ge;if(Te){if(q.properties=Y.properties,Te.needGeometry){if(!Te.filter(new Wt(this.tileID.overscaledZ,{worldview:u}),q,this.tileID.canonical))continue}else if(!Te.filter(new Wt(this.tileID.overscaledZ,{worldview:u}),q))continue}me=!0,ge.targetId&&this.addFeatureVariant(Y,ge)}me&&this.appendToResult(e,S,f,Y,ie)}}updateFeatureProperties(e,i,n){if(i.properties){const s={};for(const l in i.properties){const u=i.properties[l].evaluate({zoom:this.z},e._vectorTileFeature,e.state,e.tile,n);u!=null&&(s[l]=u)}e.properties=s}}addFeatureVariant(e,i,n){const s={target:i.target,namespace:i.namespace,uniqueFeatureID:i.uniqueFeatureID};i.properties&&(s.properties=e.properties),e.variants=e.variants||{},e.variants[i.targetId]=e.variants[i.targetId]||[],e.variants[i.targetId].push(s)}appendToResult(e,i,n,s,l){let u=e[i];u===void 0&&(u=e[i]=[]),u.push({featureIndex:n,feature:s,intersectionZ:l})}lookupSymbolFeatures(e,i,n,s,l,u){const f={};this.loadVTLayers();for(const p of e)this.loadMatchingFeature(f,{bucketIndex:i,sourceLayerIndex:n,featureIndex:p,layoutVertexArrayOffset:0},s,l,u);return f}loadFeature(e){const{featureIndex:i,sourceLayerIndex:n}=e;this.loadVTLayers();const s=this.sourceLayerCoder.decode(n),l=this.vtFeatures[s];if(l[i])return l[i];const u=this.vtLayers[s].feature(i);return l[i]=u,u}hasLayer(e){for(const i of this.bucketLayerIDs)for(const n of i)if(e===n)return!0;return!1}getId(e,i){let n=e.id;if(this.promoteId){const s=Array.isArray(this.promoteId)||typeof this.promoteId!="object"?this.promoteId:this.promoteId[i];if(s!=null)if(Array.isArray(s)){if(!this.promoteIdExpression){const l=Cs(s);if(l.result!=="success"){const u=l.value.map(f=>`${f.key}: ${f.message}`).join(", ");return void Pt(`Failed to create expression for promoteId: ${u}`)}this.promoteIdExpression=l.value}n=this.promoteIdExpression.evaluate({zoom:0},e)}else n=e.properties[s];typeof n=="boolean"&&(n=Number(n))}return n}}function V0(r,e,i,n,s){return Ne(r,(l,u)=>{const f=e instanceof is?e.get(u):null;return f&&f.evaluate?f.evaluate(i,n,void 0,s):f})}function aT(r,e){return e-r}function j0(r,e){const i={};if(!e)return i;for(const n of r){const s=n.layerIds.map(l=>e.getLayer(l)).filter(Boolean);if(s.length!==0){n.layers=s,n.stateDependentLayerIds&&(n.stateDependentLayers=n.stateDependentLayerIds.map(l=>s.filter(u=>u.id===l)[0])),n.updateExpressions&&n.updateExpressions(s);for(const l of s)i[l.fqid]=n}}return i}et(U0,"FeatureIndex",{omit:["rawTileData","sourceLayerCoder"]});const Bo=32,$s=33,Bl=new Uint16Array(8184);for(let r=0;r<2046;r++){let e=r+2,i=0,n=0,s=0,l=0,u=0,f=0;for(1&e?s=l=u=Bo:i=n=f=Bo;(e>>=1)>1;){const g=i+s>>1,x=n+l>>1;1&e?(s=i,l=n,i=u,n=f):(i=s,n=l,s=u,l=f),u=g,f=x}const p=4*r;Bl[p+0]=i,Bl[p+1]=n,Bl[p+2]=s,Bl[p+3]=l}const Hs=new Uint16Array(2178),kl=new Uint8Array(1089),M_=new Uint16Array(1089);function G0(r){return r===0?-.03125:r===32?.03125:0}const $0={Other:0,Symbol:1,FillExtrusion:2},H0={type:2,extent:Xe,loadGeometry:()=>[[new Ue(0,0),new Ue(8193,0),new Ue(8193,8193),new Ue(0,8193),new Ue(0,0)]]};class lT{constructor(){this.tasks={},this.taskQueue=[],Et(["process"],this),this.invoker=new sT(this.process),this.nextId=0}add(e,i){const n=this.nextId++,s=(function({type:l,renderSourceType:u,zoom:f}){f=f||0;const p=u===$0.Symbol;return l==="message"?0:l!=="maybePrepare"||p?l!=="parseTile"||p?l==="parseTile"&&p?300-f:l==="maybePrepare"&&p?400-f:500:200-f:100-f})(i);return s===0?(e(),null):(this.tasks[n]={fn:e,metadata:i,priority:s,id:n},this.taskQueue.push(n),this.invoker.trigger(),{cancel:()=>{delete this.tasks[n]}})}process(){{if(this.taskQueue=this.taskQueue.filter(n=>!!this.tasks[n]),!this.taskQueue.length)return;const e=this.pick();if(e===null)return;const i=this.tasks[e];if(delete this.tasks[e],this.taskQueue.length&&this.invoker.trigger(),!i)return;i.fn()}}pick(){let e=null,i=1/0;for(let s=0;s<this.taskQueue.length;s++){const l=this.tasks[this.taskQueue[s]];l.priority<i&&(i=l.priority,e=s)}if(e===null)return null;const n=this.taskQueue[e];return this.taskQueue.splice(e,1),n}remove(){this.invoker.remove()}}function q0(r,e,i){try{e=(function(s){if(!s.variants)return s;
vendor: 26,833 bytes, line 7
7if(!Array.isArray(s.variants))throw new Error("variants must be an array");for(const l of s.variants){if(l==null||typeof l!="object"||l.constructor!==Object)throw new Error("variant must be an object");if(!Array.isArray(l.capabilities))throw new Error("capabilities must be an array");if(l.capabilities.length===1&&l.capabilities[0]==="meshopt")return Object.assign(s,l)}return s})(e)}catch(s){return new Error("Failed to process TileJSON variants",{cause:s})}const n=Ke(Object.assign({},e,r),["tilejson","tiles","minzoom","maxzoom","attribution","mapbox_logo","bounds","extra_bounds","scheme","tileSize","encoding","vector_layers","raster_layers","worldview_options","worldview_default","worldview"]);return r.url&&e.tiles&&r.tiles&&(n.tiles=e.tiles),n.tiles=i.canonicalizeTileset(n,r.url),n}const Dy=new Map,Z0=new Map;class W0{constructor(e){this.size=e,this.minimums=[],this.maximums=[],this.leaves=[]}getElevation(e,i){const n=this.toIdx(e,i);return{min:this.minimums[n],max:this.maximums[n]}}isLeaf(e,i){return this.leaves[this.toIdx(e,i)]}toIdx(e,i){return i*this.size+e}}function X0(r,e,i,n){let s=0,l=Number.MAX_VALUE;for(let u=0;u<3;u++)if(Math.abs(n[u])<1e-15){if(i[u]<r[u]||i[u]>e[u])return null}else{const f=1/n[u];let p=(r[u]-i[u])*f,g=(e[u]-i[u])*f;if(p>g){const x=p;p=g,g=x}if(p>s&&(s=p),g<l&&(l=g),s>l)return null}return s}function Y0(r,e,i,n,s,l,u,f,p,g,x){const b=n-r,w=s-e,S=l-i,E=u-r,M=f-e,C=p-i,R=x[1]*C-x[2]*M,F=x[2]*E-x[0]*C,z=x[0]*M-x[1]*E,j=b*R+w*F+S*z;if(Math.abs(j)<1e-15)return null;const $=1/j,q=g[0]-r,ie=g[1]-e,W=g[2]-i,Q=(q*R+ie*F+W*z)*$;if(Q<0||Q>1)return null;const Y=ie*S-W*w,ee=W*b-q*S,me=q*w-ie*b,ge=(x[0]*Y+x[1]*ee+x[2]*me)*$;return ge<0||Q+ge>1?null:(E*Y+M*ee+C*me)*$}function J0(r,e,i){return(r-e)/(i-e)}function K0(r,e,i,n,s,l,u,f,p){const g=1<<i,x=l-n,b=u-s,w=(r+1)/g*x+n,S=(e+0)/g*b+s,E=(e+1)/g*b+s;f[0]=(r+0)/g*x+n,f[1]=S,p[0]=w,p[1]=E}class Q0{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 i=(function(l){const u=Math.ceil(Math.log2(l.dim/8)),f=[];let p=Math.ceil(Math.pow(2,u));const g=1/p,x=(S,E,M,C,R)=>{const F=C?1:0,z=(S+1)*M-F,j=E*M,$=(E+1)*M-F;R[0]=S*M,R[1]=j,R[2]=z,R[3]=$};let b=new W0(p);const w=[];for(let S=0;S<p*p;S++){x(S%p,Math.floor(S/p),g,!1,w);const E=Nl(w[0],w[1],l),M=Nl(w[2],w[1],l),C=Nl(w[2],w[3],l),R=Nl(w[0],w[3],l);b.minimums.push(Math.min(E,M,C,R)),b.maximums.push(Math.max(E,M,C,R)),b.leaves.push(1)}for(f.push(b),p/=2;p>=1;p/=2){const S=f.at(-1);b=new W0(p);for(let E=0;E<p*p;E++){x(E%p,Math.floor(E/p),2,!0,w);const M=S.getElevation(w[0],w[1]),C=S.getElevation(w[2],w[1]),R=S.getElevation(w[2],w[3]),F=S.getElevation(w[0],w[3]),z=S.isLeaf(w[0],w[1]),j=S.isLeaf(w[2],w[1]),$=S.isLeaf(w[2],w[3]),q=S.isLeaf(w[0],w[3]),ie=Math.min(M.min,C.min,R.min,F.min),W=Math.max(M.max,C.max,R.max,F.max),Q=z&&j&&$&&q;b.maximums.push(W),b.minimums.push(ie),b.leaves.push(W-ie<=5&&Q?1:0)}f.push(b)}return f})(this.dem),n=i.length-1,s=i[n];this._addNode(s.minimums[0],s.maximums[0],s.leaves[0]),this._construct(i,0,0,n,0)}raycastRoot(e,i,n,s,l,u,f=1){return X0([e,i,-100],[n,s,this.maximums[0]*f],l,u)}raycast(e,i,n,s,l,u,f=1){if(!this.nodeCount)return null;const p=this.raycastRoot(e,i,n,s,l,u,f);if(p==null)return null;const g=[],x=[],b=[],w=[],S=[{idx:0,t:p,nodex:0,nodey:0,depth:0}];for(;S.length>0;){const{idx:E,t:M,nodex:C,nodey:R,depth:F}=S.pop();if(this.leaves[E]){K0(C,R,F,e,i,n,s,b,w);const j=1<<F,$=(C+0)/j,q=(C+1)/j,ie=(R+0)/j,W=(R+1)/j,Q=Nl($,ie,this.dem)*f,Y=Nl(q,ie,this.dem)*f,ee=Nl(q,W,this.dem)*f,me=Nl($,W,this.dem)*f,ge=Y0(b[0],b[1],Q,w[0],b[1],Y,w[0],w[1],ee,l,u),Te=Y0(w[0],w[1],ee,b[0],w[1],me,b[0],b[1],Q,l,u),Ae=Math.min(ge!==null?ge:Number.MAX_VALUE,Te!==null?Te:Number.MAX_VALUE);if(Ae!==Number.MAX_VALUE)return Ae;{const Ie=wn([],l,u,M);if(eb(Q,Y,me,ee,J0(Ie[0],b[0],w[0]),J0(Ie[1],b[1],w[1]))>=Ie[2])return M}continue}let z=0;for(let j=0;j<this._siblingOffset.length;j++){K0((C<<1)+this._siblingOffset[j][0],(R<<1)+this._siblingOffset[j][1],F+1,e,i,n,s,b,w),b[2]=-100,w[2]=this.maximums[this.childOffsets[E]+j]*f;const $=X0(b,w,l,u);if($!=null){const q=$;g[j]=q;let ie=!1;for(let W=0;W<z&&!ie;W++)q>=g[x[W]]&&(x.splice(W,0,j),ie=!0);ie||(x[z]=j),z++}}for(let j=0;j<z;j++){const $=x[j];S.push({idx:this.childOffsets[E]+$,t:g[$],nodex:(C<<1)+this._siblingOffset[$][0],nodey:(R<<1)+this._siblingOffset[$][1],depth:F+1})}}return null}_addNode(e,i,n){return this.minimums.push(e),this.maximums.push(i),this.leaves.push(n),this.childOffsets.push(0),this.nodeCount++}_construct(e,i,n,s,l){if(e[s].isLeaf(i,n)===1)return;this.childOffsets[l]||(this.childOffsets[l]=this.nodeCount);const u=s-1,f=e[u];let p=0,g=0;for(let x=0;x<this._siblingOffset.length;x++){const b=2*i+this._siblingOffset[x][0],w=2*n+this._siblingOffset[x][1],S=f.getElevation(b,w),E=f.isLeaf(b,w),M=this._addNode(S.min,S.max,E);E&&(p|=1<<x),g||(g=M)}for(let x=0;x<this._siblingOffset.length;x++)p&1<<x||this._construct(e,2*i+this._siblingOffset[x][0],2*n+this._siblingOffset[x][1],u,g+x)}}function eb(r,e,i,n,s,l){return ft(ft(r,i,l),ft(e,n,l),s)}function Nl(r,e,i){const n=i.dim,s=re(r*n-.5,0,n-1),l=re(e*n-.5,0,n-1),u=Math.floor(s),f=Math.floor(l),p=Math.min(u+1,n-1),g=Math.min(f+1,n-1);return eb(i.get(u,f),i.get(p,f),i.get(u,g),i.get(p,g),s-u,l-f)}const cT={mapbox:[6553.6,25.6,.1,1e4],terrarium:[256,1,1/256,32768]};function uT(r,e,i){return(256*r*256+256*e+i)/10-1e4}function hT(r,e,i){return 256*r+e+i/256-32768}class C_{get tree(){return this._tree||this._buildQuadTree(),this._tree}constructor(e,i,n,s=!1){if(this.uid=e,i.height!==i.width)throw new RangeError("DEM tiles must be square");if(n&&n!=="mapbox"&&n!=="terrarium")return void Pt(`"${n}" is not a valid encoding type. Valid types include "mapbox" and "terrarium".`);this.stride=i.height;const l=this.dim=i.height-2,u=new Uint32Array(i.data.buffer);if(this.pixels=new Uint8Array(i.data.buffer),this.floatView=new Float32Array(i.data.buffer),this.borderReady=s,this._modifiedForSources={},!s){for(let p=0;p<l;p++)u[this._idx(-1,p)]=u[this._idx(0,p)],u[this._idx(l,p)]=u[this._idx(l-1,p)],u[this._idx(p,-1)]=u[this._idx(p,0)],u[this._idx(p,l)]=u[this._idx(p,l-1)];u[this._idx(-1,-1)]=u[this._idx(0,0)],u[this._idx(l,-1)]=u[this._idx(l-1,0)],u[this._idx(-1,l)]=u[this._idx(0,l-1)],u[this._idx(l,l)]=u[this._idx(l-1,l-1)]}const f=n==="terrarium"?hT:uT;for(let p=0;p<u.length;++p){const g=4*p;this.floatView[p]=f(this.pixels[g],this.pixels[g+1],this.pixels[g+2])}this._timestamp=un.now()}_buildQuadTree(){this._tree=new Q0(this)}get(e,i,n=!1){n&&(e=re(e,-1,this.dim),i=re(i,-1,this.dim));const s=this._idx(e,i);return this.floatView[s]}set(e,i,n){const s=this._idx(e,i),l=this.floatView[s];return this.floatView[s]=n,n-l}static getUnpackVector(e){return cT[e]}_idx(e,i){if(e<-1||e>=this.dim+1||i<-1||i>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(i+1)*this.stride+(e+1)}static pack(e,i){const n=[0,0,0,0],s=C_.getUnpackVector(i);let l=Math.floor((e+s[3])/s[2]);return n[2]=l%256,l=Math.floor(l/256),n[1]=l%256,l=Math.floor(l/256),n[0]=l,n}getPixels(){return new ri({width:this.stride,height:this.stride},this.pixels)}backfillBorder(e,i,n){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let s=i*this.dim,l=i*this.dim+this.dim,u=n*this.dim,f=n*this.dim+this.dim;switch(i){case-1:s=l-1;break;case 1:l=s+1}switch(n){case-1:u=f-1;break;case 1:f=u+1}const p=-i*this.dim,g=-n*this.dim;for(let x=u;x<f;x++)for(let b=s;b<l;b++){const w=4*this._idx(b,x),S=4*this._idx(b+p,x+g);this.pixels[w+0]=e.pixels[S+0],this.pixels[w+1]=e.pixels[S+1],this.pixels[w+2]=e.pixels[S+2],this.pixels[w+3]=e.pixels[S+3]}}onDeserialize(){this._tree&&(this._tree.dem=this)}}function dT(r,e,i){r===1?e.headerLength=i.readFixed32():r===2?e.x=i.readVarint():r===3?e.y=i.readVarint():r===4?e.z=i.readVarint():r===5&&e.layers.push((function(n,s){return n.readFields(gT,{version:0,name:"",units:"",tileSize:0,buffer:0,pixelFormat:0,dataIndex:[]},s)})(i,i.readVarint()+i.pos))}function fT(r,e,i){r===1?(e.delta_filter=(function(n,s){return n.readFields(pT,{blockSize:0},s)})(i,i.readVarint()+i.pos),e.filter="delta_filter"):r===2?(i.readVarint(),e.filter="zigzag_filter"):r===3?(i.readVarint(),e.filter="bitshuffle_filter"):r===4&&(i.readVarint(),e.filter="byteshuffle_filter")}function pT(r,e,i){r===1&&(e.blockSize=i.readVarint())}function mT(r,e,i){r===1?(i.readVarint(),e.codec="gzip_data"):r===2?(i.readVarint(),e.codec="jpeg_image"):r===3?(i.readVarint(),e.codec="webp_image"):r===4&&(i.readVarint(),e.codec="png_image")}function _T(r,e,i){let n=0,s=0;r===1?e.firstByte=i.readFixed64():r===2?e.lastByte=i.readFixed64():r===3?e.filters.push((function(l,u){return l.readFields(fT,{},u)})(i,i.readVarint()+i.pos)):r===4?e.codec=(function(l,u){return l.readFields(mT,{},u)})(i,i.readVarint()+i.pos):r===5?s=i.readFloat():r===6?n=i.readFloat():r===7?e.bands.push(i.readString()):r===8?e.offset=i.readDouble():r===9&&(e.scale=i.readDouble()),e.offset===0&&(e.offset=s),e.scale===0&&(e.scale=n)}function gT(r,e,i){r===1?e.version=i.readVarint():r===2?e.name=i.readString():r===3?e.units=i.readString():r===4?e.tileSize=i.readVarint():r===5?e.buffer=i.readVarint():r===6?e.pixelFormat=i.readVarint():r===7&&e.dataIndex.push((function(n,s){return n.readFields(_T,{firstByte:0,lastByte:0,filters:[],codec:null,offset:0,scale:0,bands:[]},s)})(i,i.readVarint()+i.pos))}function yT(r,e,i){if(r===2)(function(n,s,l){n.readFields(xT,l,s)})(i,i.readVarint()+i.pos,e);else if(r===3)throw new Error("Not implemented")}function xT(r,e,i){if(r===1){let n=0;const s=i.readVarint()+i.pos;for(;i.pos<s;)e[n++]=i.readVarint()}}function vT(r,e){if(e.length!==4)throw new Error(`Expected data of dimension 4 but got ${e.length}.`);let i=e[3];for(let n=2;n>=1;n--){const s=n===1?1:0,l=n===2?1:0;for(let u=0;u<e[0];u++){const f=e[1]*u;for(let p=s;p<e[1];p++){const g=e[2]*(p+f);for(let x=l;x<e[2];x++){const b=e[3]*(x+g);for(let w=0;w<e[3];w++){const S=b+w;r[S]+=r[S-i]}}}}i*=e[n]}return r}function bT(r){for(let e=0,i=r.length;e<i;e++)r[e]=r[e]>>>1^-(1&r[e]);return r}function wT(r,e){switch(e){case"uint32":return r;case"uint16":for(let i=0;i<r.length;i+=2){const n=r[i],s=r[i+1];r[i]=(240&n)>>4|(61440&n)>>8|(240&s)<<4|61440&s,r[i+1]=15&n|(3840&n)>>4|(15&s)<<8|(3840&s)<<4}return r;case"uint8":for(let i=0;i<r.length;i+=4){const n=r[i],s=r[i+1],l=r[i+2],u=r[i+3];r[i+0]=(192&n)>>6|(192&s)>>4|(192&l)>>2|192&u,r[i+1]=(48&n)>>4|(48&s)>>2|48&l|(48&u)<<2,r[i+2]=(12&n)>>2|12&s|(12&l)<<2|(12&u)<<4,r[i+3]=3&n|(3&s)<<2|(3&l)<<4|(3&u)<<6}return r;default:throw new Error(`Invalid pixel format, "${e}"`)}}et(C_,"DEMData"),et(Q0,"DemMinMaxQuadTree",{omit:["dem"]});var po=Uint8Array,Nf=Uint16Array,TT=Int32Array,tb=new po([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]),ib=new po([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]),ST=new po([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),rb=function(r,e){for(var i=new Nf(31),n=0;n<31;++n)i[n]=e+=1<<r[n-1];var s=new TT(i[30]);for(n=1;n<30;++n)for(var l=i[n];l<i[n+1];++l)s[l]=l-i[n]<<5|n;return{b:i,r:s}},nb=rb(tb,2),ob=nb.b,IT=nb.r;ob[28]=258,IT[258]=28;for(var ET=rb(ib,0).b,sb=new Nf(32768),ar=0;ar<32768;++ar){var Th=(43690&ar)>>1|(21845&ar)<<1;sb[ar]=((65280&(Th=(61680&(Th=(52428&Th)>>2|(13107&Th)<<2))>>4|(3855&Th)<<4))>>8|(255&Th)<<8)>>1}var Uf=function(r,e,i){for(var n=r.length,s=0,l=new Nf(e);s<n;++s)r[s]&&++l[r[s]-1];var u,f=new Nf(e);for(s=1;s<e;++s)f[s]=f[s-1]+l[s-1]<<1;u=new Nf(1<<e);var p=15-e;for(s=0;s<n;++s)if(r[s])for(var g=s<<4|r[s],x=e-r[s],b=f[r[s]-1]++<<x,w=b|(1<<x)-1;b<=w;++b)u[sb[b]>>p]=g;return u},Vf=new po(288);for(ar=0;ar<144;++ar)Vf[ar]=8;for(ar=144;ar<256;++ar)Vf[ar]=9;for(ar=256;ar<280;++ar)Vf[ar]=7;for(ar=280;ar<288;++ar)Vf[ar]=8;var ab=new po(32);for(ar=0;ar<32;++ar)ab[ar]=5;var AT=Uf(Vf,9),MT=Uf(ab,5),Ry=function(r){for(var e=r[0],i=1;i<r.length;++i)r[i]>e&&(e=r[i]);return e},hs=function(r,e,i){var n=e/8|0;return(r[n]|r[n+1]<<8)>>(7&e)&i},zy=function(r,e){var i=e/8|0;return(r[i]|r[i+1]<<8|r[i+2]<<16)>>(7&e)},CT=function(r){return(r+7)/8|0},PT=["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"],ds=function(r,e,i){var n=new Error(e||PT[r]);if(n.code=r,Error.captureStackTrace&&Error.captureStackTrace(n,ds),!i)throw n;return n},DT=new po(0),RT=typeof TextDecoder<"u"&&new TextDecoder;try{RT.decode(DT,{stream:!0})}catch{}const zT={gzip_data:"gzip"};class ko extends Error{constructor(e){super(e),this.name="MRTError"}}const LT={0:"uint32",1:"uint32",2:"uint16",3:"uint8"},lb={uint32:1,uint16:2,uint8:4},OT={uint32:Uint32Array,uint16:Uint16Array,uint8:Uint8Array};let Ly;class P_{constructor(e=5){this.x=NaN,this.y=NaN,this.z=NaN,this.layers={},this._cacheSize=e}getLayer(e){const i=this.layers[e];if(!i)throw new ko(`Layer '${e}' not found`);return i}getHeaderLength(e){const i=new Uint8Array(e),n=new DataView(e);if(i[0]!==13)throw new ko("File is not a valid MRT.");return n.getUint32(1,!0)}parseHeader(e){const i=new Uint8Array(e),n=this.getHeaderLength(e);if(i.length<n)throw new ko(`Expected header with length >= ${n} but got buffer of length ${i.length}`);const s=new Ly(i.subarray(0,n)).readFields(dT,{headerLength:0,x:0,y:0,z:0,layers:[]},void 0);if(!isNaN(this.x)&&(this.x!==s.x||this.y!==s.y||this.z!==s.z))throw new ko(`Invalid attempt to parse header ${s.z}/${s.x}/${s.y} for tile ${this.z}/${this.x}/${this.y}`);this.x=s.x,this.y=s.y,this.z=s.z;for(const l of s.layers)this.layers[l.name]=new cb(l,{cacheSize:this._cacheSize});return this}createDecodingTask(e){const i=[],n=this.getLayer(e.layerName);for(let s of e.blockIndices){const l=n.dataIndex[s],u=l.firstByte-e.firstByte,f=l.lastByte-e.firstByte;if(n._blocksInProgress.has(s))continue;const p={layerName:n.name,firstByte:u,lastByte:f,pixelFormat:n.pixelFormat,blockIndex:s,blockShape:[l.bands.length].concat(n.bandShape),buffer:n.buffer,codec:l.codec.codec,filters:l.filters.map(g=>g.filter)};n._blocksInProgress.add(s),i.push(p)}return new ub(i,()=>{i.forEach(s=>n._blocksInProgress.delete(s.blockIndex))},(s,l)=>{if(i.forEach(u=>n._blocksInProgress.delete(u.blockIndex)),s)throw s;l.forEach(u=>{this.getLayer(u.layerName).processDecodedData(u)})})}}class cb{constructor({version:e,name:i,units:n,tileSize:s,pixelFormat:l,buffer:u,dataIndex:f},p){if(this.version=e,this.version!==1)throw new ko(`Cannot parse raster layer encoded with MRT version ${e}`);this.name=i,this.units=n,this.tileSize=s,this.buffer=u,this.pixelFormat=LT[l],this.dataIndex=f,this.bandShape=[s+2*u,s+2*u,lb[this.pixelFormat]],this._decodedBlocks=new Py(p?p.cacheSize:5),this._blocksInProgress=new Set}get dimension(){return lb[this.pixelFormat]}get cacheSize(){return this._decodedBlocks.capacity}getBandList(){return this.dataIndex.map(({bands:e})=>e).flat()}processDecodedData(e){const i=e.blockIndex.toString();this._decodedBlocks.get(i)||this._decodedBlocks.put(i,e.data)}getBlockForBand(e){let i=0;switch(typeof e){case"string":for(const[n,s]of this.dataIndex.entries()){for(const[l,u]of s.bands.entries())if(u===e)return{bandIndex:i+l,blockIndex:n,blockBandIndex:l};i+=s.bands.length}break;case"number":for(const[n,s]of this.dataIndex.entries()){if(e>=i&&e<i+s.bands.length)return{bandIndex:e,blockIndex:n,blockBandIndex:e-i};i+=s.bands.length}break;default:throw new ko(`Invalid band \`${JSON.stringify(e)}\`. Expected string or integer.`)}return{blockIndex:-1,blockBandIndex:-1}}getDataRange(e){let i=1/0,n=-1/0;const s=[],l=new Set;for(const u of e){const{blockIndex:f}=this.getBlockForBand(u);if(f<0)throw new ko(`Invalid band: ${JSON.stringify(u)}`);const p=this.dataIndex[f];s.includes(f)||s.push(f),l.add(f),i=Math.min(i,p.firstByte),n=Math.max(n,p.lastByte)}if(l.size>this.cacheSize)throw new ko(`Number of blocks to decode (${l.size}) exceeds cache size (${this.cacheSize}).`);return{layerName:this.name,firstByte:i,lastByte:n,blockIndices:s}}hasBand(e){const{blockIndex:i}=this.getBlockForBand(e);return i>=0}hasDataForBand(e){const{blockIndex:i}=this.getBlockForBand(e);return i>=0&&!!this._decodedBlocks.get(i.toString())}getBandView(e){const{blockIndex:i,blockBandIndex:n}=this.getBlockForBand(e);if(i<0)throw new ko(`Band not found: ${JSON.stringify(e)}`);const s=this._decodedBlocks.get(i.toString());if(!s)throw new ko(`Data for band ${JSON.stringify(e)} of layer "${this.name}" not decoded.`);const l=this.dataIndex[i],u=this.bandShape.reduce((g,x)=>g*x,1),f=n*u,p=s.subarray(f,f+u);return{data:p,bytes:new Uint8Array(p.buffer).subarray(p.byteOffset,p.byteOffset+p.byteLength),tileSize:this.tileSize,buffer:this.buffer,pixelFormat:this.pixelFormat,dimension:this.dimension,offset:l.offset,scale:l.scale}}}P_.setPbf=function(r){Ly=r};class ub{constructor(e,i,n){this.tasks=e,this._onCancel=i,this._onComplete=n,this._finalized=!1}cancel(){this._finalized||(this._onCancel(),this._finalized=!0)}complete(e,i){this._finalized||(this._onComplete(e,i),this._finalized=!0)}}P_.performDecoding=function(r,e){const i=new Uint8Array(r);return Promise.all(e.tasks.map(n=>{const{layerName:s,firstByte:l,lastByte:u,pixelFormat:f,blockShape:p,blockIndex:g,filters:x,codec:b}=n,w=i.subarray(l,u+1),S=new Uint32Array(p[0]*p[1]*p[2]);let E;if(b!=="gzip_data")throw new ko(`Unhandled codec: ${b}`);return E=(function(M,C){if(!globalThis.DecompressionStream&&C==="gzip_data")return Promise.resolve(($=(function(W){W[0]==31&&W[1]==139&&W[2]==8||ds(6,"invalid gzip data");var Q=W[3],Y=10;4&Q&&(Y+=2+(W[10]|W[11]<<8));for(var ee=(Q>>3&1)+(Q>>4&1);ee>0;ee-=!W[Y++]);return Y+(2&Q)})(R=M),$+8>R.length&&ds(6,"invalid gzip data"),(function(W,Q,Y,ee){var me=W.length;if(!me||Q.f&&!Q.l)return Y||new po(0);var ge=!Y,Te=ge||Q.i!=2,Ae=Q.i;ge&&(Y=new po(3*me));var Ie=function(Mi){var lr=Y.length;if(Mi>lr){var vn=new po(Math.max(2*lr,Mi));vn.set(Y),Y=vn}},Fe=Q.f||0,xe=Q.p||0,Se=Q.b||0,Me=Q.l,ze=Q.d,Le=Q.m,We=Q.n,De=8*me;do{if(!Me){Fe=hs(W,xe,1);var Ge=hs(W,xe+1,3);if(xe+=3,!Ge){var $e=W[(Yt=CT(xe)+4)-4]|W[Yt-3]<<8,Je=Yt+$e;if(Je>me){Ae&&ds(0);break}Te&&Ie(Se+$e),Y.set(W.subarray(Yt,Je),Se),Q.b=Se+=$e,Q.p=xe=8*Je,Q.f=Fe;continue}if(Ge==1)Me=AT,ze=MT,Le=9,We=5;else if(Ge==2){var Qe=hs(W,xe,31)+257,ct=hs(W,xe+10,15)+4,nt=Qe+hs(W,xe+5,31)+1;xe+=14;for(var mt=new po(nt),Gt=new po(19),wt=0;wt<ct;++wt)Gt[ST[wt]]=hs(W,xe+3*wt,7);xe+=3*ct;var kt=Ry(Gt),Mt=(1<<kt)-1,Oi=Uf(Gt,kt);for(wt=0;wt<nt;){var Yt,jt=Oi[hs(W,xe,Mt)];if(xe+=15&jt,(Yt=jt>>4)<16)mt[wt++]=Yt;else{var ci=0,Si=0;for(Yt==16?(Si=3+hs(W,xe,3),xe+=2,ci=mt[wt-1]):Yt==17?(Si=3+hs(W,xe,7),xe+=3):Yt==18&&(Si=11+hs(W,xe,127),xe+=7);Si--;)mt[wt++]=ci}}var fr=mt.subarray(0,Qe),mi=mt.subarray(Qe);Le=Ry(fr),We=Ry(mi),Me=Uf(fr,Le),ze=Uf(mi,We)}else ds(1);if(xe>De){Ae&&ds(0);break}}Te&&Ie(Se+131072);for(var Fi=(1<<Le)-1,ir=(1<<We)-1,Qi=xe;;Qi=xe){var rr=(ci=Me[zy(W,xe)&Fi])>>4;if((xe+=15&ci)>De){Ae&&ds(0);break}if(ci||ds(2),rr<256)Y[Se++]=rr;else{if(rr==256){Qi=xe,Me=null;break}var zt=rr-254;rr>264&&(zt=hs(W,xe,(1<<(Wi=tb[wt=rr-257]))-1)+ob[wt],xe+=Wi);var Er=ze[zy(W,xe)&ir],Qr=Er>>4;if(Er||ds(3),xe+=15&Er,mi=ET[Qr],Qr>3){var Wi=ib[Qr];mi+=zy(W,xe)&(1<<Wi)-1,xe+=Wi}if(xe>De){Ae&&ds(0);break}Te&&Ie(Se+131072);var gr=Se+zt;if(Se<mi){var $r=0-mi,Ar=Math.min(mi,gr);for($r+Se<0&&ds(3);Se<Ar;++Se)Y[Se]=ee[$r+Se]}for(;Se<gr;++Se)Y[Se]=Y[Se-mi]}}Q.l=Me,Q.p=Qi,Q.b=Se,Q.f=Fe,Me&&(Fe=1,Q.m=Le,Q.d=ze,Q.n=We)}while(!Fe);return Se!=Y.length&&ge?(function(Mi,lr,vn){return(vn==null||vn>Mi.length)&&(vn=Mi.length),new po(Mi.subarray(0,vn))})(Y,0,Se):Y.subarray(0,Se)})(R.subarray($,-8),{i:2},new po(((z=R)[(j=z.length)-4]|z[j-3]<<8|z[j-2]<<16|z[j-1]<<24)>>>0),F)));var R,F,z,j,$;const q=zT[C];if(!q)throw new Error(`Unhandled codec: ${C}`);const ie=new globalThis.DecompressionStream(q);return new Response(new Blob([M]).stream().pipeThrough(ie)).arrayBuffer().then(W=>new Uint8Array(W))})(w,b).then(M=>((function(C,R){C.readFields(yT,R)})(new Ly(M),S),new OT[f](S.buffer))),E.then(M=>{for(let C=x.length-1;C>=0;C--)switch(x[C]){case"delta_filter":vT(M,p);break;case"zigzag_filter":bT(M);break;case"bitshuffle_filter":wT(M,f);break;default:throw new ko(`Unhandled filter "${x[C]}"`)}return{layerName:s,blockIndex:g,data:M}}).catch(M=>{throw M})}))},et(ub,"MRTDecodingBatch",{omit:["_onCancel","_onComplete"]}),et(P_,"MapboxRasterTile"),et(cb,"MapboxRasterLayer",{omit:["_blocksInProgress"]});const hb=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class Oy{static from(e){if(!(e instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[i,n]=new Uint8Array(e,0,2);if(i!==219)throw new Error("Data does not appear to be in a KDBush format.");const s=n>>4;if(s!==1)throw new Error(`Got v${s} data when expected v1.`);const l=hb[15&n];if(!l)throw new Error("Unrecognized array type.");const[u]=new Uint16Array(e,2,1),[f]=new Uint32Array(e,4,1);return new Oy(f,u,l,e)}constructor(e,i=64,n=Float64Array,s){if(isNaN(e)||e<0)throw new Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+i,2),65535),this.ArrayType=n,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;const l=hb.indexOf(this.ArrayType),u=2*e*this.ArrayType.BYTES_PER_ELEMENT,f=e*this.IndexArrayType.BYTES_PER_ELEMENT,p=(8-f%8)%8;if(l<0)throw new Error(`Unexpected typed array class: ${n}.`);s&&s instanceof ArrayBuffer?(this.data=s,this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+f+p,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+u+f+p),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+f+p,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+l]),new Uint16Array(this.data,2,1)[0]=i,new Uint32Array(this.data,4,1)[0]=e)}add(e,i){const n=this._pos>>1;return this.ids[n]=n,this.coords[this._pos++]=e,this.coords[this._pos++]=i,n}finish(){const e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return Fy(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,i,n,s){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:l,coords:u,nodeSize:f}=this,p=[0,l.length-1,0],g=[];for(;p.length;){const x=p.pop()||0,b=p.pop()||0,w=p.pop()||0;if(b-w<=f){for(let C=w;C<=b;C++){const R=u[2*C],F=u[2*C+1];R>=e&&R<=n&&F>=i&&F<=s&&g.push(l[C])}continue}const S=w+b>>1,E=u[2*S],M=u[2*S+1];E>=e&&E<=n&&M>=i&&M<=s&&g.push(l[S]),(x===0?e<=E:i<=M)&&(p.push(w),p.push(S-1),p.push(1-x)),(x===0?n>=E:s>=M)&&(p.push(S+1),p.push(b),p.push(1-x))}return g}within(e,i,n){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:s,coords:l,nodeSize:u}=this,f=[0,s.length-1,0],p=[],g=n*n;for(;f.length;){const x=f.pop()||0,b=f.pop()||0,w=f.pop()||0;if(b-w<=u){for(let C=w;C<=b;C++)fb(l[2*C],l[2*C+1],e,i)<=g&&p.push(s[C]);continue}const S=w+b>>1,E=l[2*S],M=l[2*S+1];fb(E,M,e,i)<=g&&p.push(s[S]),(x===0?e-n<=E:i-n<=M)&&(f.push(w),f.push(S-1),f.push(1-x)),(x===0?e+n>=E:i+n>=M)&&(f.push(S+1),f.push(b),f.push(1-x))}return p}}function Fy(r,e,i,n,s,l){if(s-n<=i)return;const u=n+s>>1;db(r,e,u,n,s,l),Fy(r,e,i,n,u-1,1-l),Fy(r,e,i,u+1,s,1-l)}function db(r,e,i,n,s,l){for(;s>n;){if(s-n>600){const g=s-n+1,x=i-n+1,b=Math.log(g),w=.5*Math.exp(2*b/3),S=.5*Math.sqrt(b*w*(g-w)/g)*(x-g/2<0?-1:1);db(r,e,i,Math.max(n,Math.floor(i-x*w/g+S)),Math.min(s,Math.floor(i+(g-x)*w/g+S)),l)}const u=e[2*i+l];let f=n,p=s;for(jf(r,e,n,i),e[2*s+l]>u&&jf(r,e,n,s);f<p;){for(jf(r,e,f,p),f++,p--;e[2*f+l]<u;)f++;for(;e[2*p+l]>u;)p--}e[2*n+l]===u?jf(r,e,n,p):(p++,jf(r,e,p,s)),p<=i&&(n=p+1),i<=p&&(s=p-1)}}function jf(r,e,i,n){By(r,i,n),By(e,2*i,2*n),By(e,2*i+1,2*n+1)}function By(r,e,i){const n=r[e];r[e]=r[i],r[i]=n}function fb(r,e,i,n){const s=r-i,l=e-n;return s*s+l*l}U.$=jh,U.A=Fn,U.B=2,U.C=qt,U.D=Af,U.E=tl,U.F=jv,U.G=Vh,U.H=Dd,U.I=Dr,U.J=mu,U.K=uc,U.L=Py,U.M=hd,U.N=zu,U.O=Lp,U.P=Ue,U.Q=Ou,U.R=ca,U.S=wl,U.T=Gs,U.U=Cs,U.V=_d,U.W=Ao,U.X=ya,U.Y=kn,U.Z=Zr,U._=hc,U.a=function(r){return fi.API_CDN_URL_REGEX.test(r)},U.a$=Qc,U.a0=tp,U.a1=lo,U.a2=/^(.*)-use-theme$/,U.a3=/^(.*)-transition$/,U.a4=dd,U.a5=zp,U.a6=he,U.a7=Pc,U.a8=bi,U.a9=He,U.aA=function(r){let e=1/0,i=1/0,n=-1/0,s=-1/0;for(const l of r)e=Math.min(e,l.x),i=Math.min(i,l.y),n=Math.max(n,l.x),s=Math.max(s,l.y);return{min:new Ue(e,i),max:new Ue(n,s)}},U.aB=re,U.aC=gi,U.aD=ln,U.aE=Lr,U.aF=L,U.aG=as,U.aH=bm,U.aI=ks,U.aJ=Lo,U.aK=Ke,U.aL=class{constructor(r){this.entries={},this.scheduler=r}request(r,e,i,n){const s=this.entries[r]=this.entries[r]||{callbacks:[]};if(s.result){const[l,u]=s.result;return this.scheduler?this.scheduler.add(()=>{n(l,u)},e):n(l,u),()=>{}}return s.callbacks.push(n),s.cancel||(s.cancel=i((l,u)=>{s.result=[l,u];for(const f of s.callbacks)this.scheduler?this.scheduler.add(()=>{f(l,u)},e):f(l,u);setTimeout(()=>delete this.entries[r],3e3)})),()=>{s.result||(s.callbacks=s.callbacks.filter(l=>l!==n),s.callbacks.length||(s.cancel(),delete this.entries[r]))}}},U.aM=function(r){if("provider"in r&&!r.provider)return null;let e=r.provider;if(!e&&"url"in r&&r.url&&(e=(function(s){try{const l=new URL(s).pathname.split("/").pop()||"",u=l.lastIndexOf(".");return u>=0?l.slice(u+1):""}catch{return""}})(r.url)),!e)return null;const i=fi.TILE_PROVIDER_URLS[e];if(!i)return null;let n;try{n=new URL(i,fi.API_URL).href}catch{return new Error(`TileProvider "${e}" has an invalid URL: "${i}"`)}return{name:e,url:n}},U.aN=function(r,e,i,n,s){const l=function(f,p){if(f)return s(f);if(p){r.url&&p.tiles&&r.tiles&&delete r.tiles;const g=q0(r,p,e);if(g instanceof Error)return s(g);s(null,g)}},u=(function(f,p,g){if(!f)return null;if(!p&&!g)return f;g=g||f.worldview_default;const x=Object.values(f.language||{});if(x.length===0)return null;const b=Object.values(f.worldview||{});if(b.length===0)return null;const w=x.every(E=>E===p),S=b.every(E=>E===g);return w&&S?f:p in(f.language_options||{})||g in(f.worldview_options||{})?null:f.language_options&&f.worldview_options?f:null})(r.data,i,n);return u?un.frame(()=>l(null,u)):r.url?Fh(e.transformRequest(e.normalizeSourceURL(r.url,null,i,n),ca.Source),l):un.frame(()=>{const{data:f,...p}=r;l(null,p)})},U.aO=function(r,e){const i=r.url&&!r.tiles?e.transformRequest(r.url,ca.Source):void 0;return{request:i,options:i?Object.assign({},r,{url:i.url}):r}},U.aP=function(r,e,i){return e?q0(r,e,i):r.tiles&&r.tiles.length>0?{tiles:r.tiles}:new Error('TileJSON is missing required "tiles" property')},U.aQ=function(r,e,i){const n=JSON.stringify(r.request);return r.data&&(this.deduped.entries[n]={result:[null,r.data]}),this.deduped.request(n,{type:"parseTile",renderSourceType:r.render
7SourceType,zoom:r.tileZoom},s=>{const l=Ja(r.request,(u,f,p)=>{u?nc(u)?s(null,null):s(u):f&&s(null,{rawData:f,vectorTile:i?void 0:new tf(new a_(f)),responseHeaders:new Map(p.entries())})});return()=>{l.cancel(),s(null,null)}},e)},U.aR=function(r){return r?{cacheControl:r.get("cache-control"),expires:r.get("expires")}:{cacheControl:void 0,expires:void 0}},U.aS=function(r){Dh++,Dh>Yf&&(r.getActor().send("enforceCacheSizeLimit",Xf),Dh=0)},U.aT=async function(r,e){const i=Z0.get(r);if(i)return i;const n=Dy.get(r);if(n!==void 0)return n;const s=import(e).catch(l=>{throw new Error(`TileProvider "${r}" failed to load: ${l instanceof Error?l.message:String(l)}`)}).then(l=>{const u=l.default;if(typeof u!="function")throw new Error(`TileProvider "${r}" module must default-export a class`);if(typeof u.prototype.loadTile!="function")throw new Error(`TileProvider "${r}" class must have a loadTile method`);return Z0.set(r,u),u}).finally(()=>{Dy.delete(r)});return Dy.set(r,s),s},U.aU=ue,U.aV=T0,U.aW=D0,U.aX=Zt,U.aY=w0,U.aZ=function(r,e){const i=document.createElement("video");i.muted=!0,i.onloadstart=function(){e(null,i)};for(let n=0;n<r.length;n++){const s=document.createElement("source");O_(r[n])||(i.crossOrigin="Anonymous"),s.src=r[n],i.appendChild(s)}return{cancel:()=>{}}},U.a_=wf,U.aa=class{constructor(r){this.specification=r}possiblyEvaluate(r,e){return $i(r.expression.evaluate(e))}interpolate(r,e,i){return{x:ft(r.x,e.x,i),y:ft(r.y,e.y,i),z:ft(r.z,e.z,i),azimuthal:ft(r.azimuthal,e.azimuthal,i),polar:ft(r.polar,e.polar,i)}}},U.ab=Wt,U.ac=Mo,U.ad=Or,U.ae=Pi,U.af=xr,U.ag=ye,U.ah=is,U.ai=oi,U.aj=ft,U.ak=Xe,U.al=np,U.am=V,U.an=dt,U.ao=Oe,U.ap=class{constructor(r,e,i){this.target=r,this.parent=e,this.mapId=i,this.callbacks={},this.cancelCallbacks={},Et(["receive"],this),this.target.addEventListener("message",this.receive,!1),this.scheduler=new lT}send(r,e,i,n,s=!1,l){const u=Math.round(1e18*Math.random()).toString(36).substring(0,10);i&&(i.metadata=l,this.callbacks[u]=i);const f=new Set;return this.target.postMessage({id:u,type:r,hasCallback:!!i,targetMapId:n,mustQueue:s,sourceMapId:this.mapId,data:es(e,f)},f),{cancel:()=>{i&&delete this.callbacks[u],this.target.postMessage({id:u,type:"<cancel>",targetMapId:n,sourceMapId:this.mapId})}}}receive(r){const e=r.data;if(!e)return;const i=e.id;if(i&&(!e.targetMapId||this.mapId===e.targetMapId))if(e.type==="<cancel>"){const n=this.cancelCallbacks[i];delete this.cancelCallbacks[i],n&&n.cancel()}else if(e.mustQueue||ti(self)){const n=this.callbacks[i],s=this.scheduler.add(()=>this.processTask(i,e),n&&n.metadata||{type:"message"});s&&(this.cancelCallbacks[i]=s)}else this.processTask(i,e)}processTask(r,e){if(delete this.cancelCallbacks[r],e.type==="<response>"){const i=this.callbacks[r];delete this.callbacks[r],i&&(e.error?i(ts(e.error)):i(null,ts(e.data)))}else{const i=new Set,n=e.hasCallback?(l,u)=>{this.target.postMessage({id:r,type:"<response>",sourceMapId:this.mapId,error:l?es(l):null,data:es(u,i)},i)}:()=>{},s=ts(e.data);if(this.parent[e.type])this.parent[e.type](e.sourceMapId,s,n);else if(this.parent.getWorkerSource){const l=e.type.split("."),{source:u,scope:f}=s;this.parent.getWorkerSource(e.sourceMapId,{type:l[0],source:u,scope:f,uid:0})[l[1]](s,n)}else n(new Error(`Could not find function ${e.type}`))}}remove(){this.scheduler.remove(),this.target.removeEventListener("message",this.receive,!1)}},U.aq=class{constructor(r){this.specification=r}possiblyEvaluate(r,e){return(function([i,n]){const s=$i([1,i,n]);return{x:s.x,y:s.y,z:s.z}})(r.expression.evaluate(e))}interpolate(r,e,i){return{x:ft(r.x,e.x,i),y:ft(r.y,e.y,i),z:ft(r.z,e.z,i)}}},U.ar=function(r,e,i=0,n=!0){const s=new Ue(i,i),l=r.sub(s),u=e.add(s),f=[l,new Ue(u.x,l.y),u,new Ue(l.x,u.y)];return n&&f.push(l.clone()),f},U.as=function(r,e){const i=[];for(let n=0;n<r.length;n++){const s=Ve(n-1,-1,r.length-1),l=Ve(n+1,-1,r.length-1),u=r[n],f=r[l],p=r[s].sub(u).unit(),g=f.sub(u).unit(),x=g.angleWithSep(p.x,p.y),b=p.add(g).unit().mult(-1*e/Math.sin(x/2));i.push(u.add(b))}return i},U.at=a0,U.au=k,U.av=function(r,e,i=0){return wr(((e.x-i)*r.scale-r.x)*Xe,(e.y*r.scale-r.y)*Xe,Kd(e.z,e.y
vendor: 12,076 bytes, line 7
7))},U.aw=ki,U.ax=ui,U.ay=nf,U.az=_v,U.b=function(r){return fi.API_FONTS_REGEX.test(r)},U.b$=Bc,U.b0=Et,U.b1=P_,U.b2=a_,U.b3=class{constructor(r,e,i,n,s,l){this.tileID=r,this.uid=dt(),this.uses=0,this.tileSize=e,this.tileZoom=i,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasTunnelGeometry=!1,this.hasRTLText=!1,this.dependencies={},this.isRaster=s,n&&n.style&&(this._lastUpdatedBrightness=n.style.getBrightness()),this._lastAvailableImagesCount=0,this._firstPrepareComplete=!1,this.expiredRequestCount=0,this.state="loading",n&&n.transform&&(this.projection=n.transform.projection),this.worldview=l,this._hasAppearances=null}registerFadeDuration(r){const e=r+this.timeAdded;e<un.now()||this.fadeEndTime!==void 0&&e<this.fadeEndTime||(this.fadeEndTime=e)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}get tileTransform(){return this._tileTransform||(this._tileTransform=Yc(this.tileID.canonical,this.projection)),this._tileTransform}loadVectorData(r,e,i){if(this.unloadVectorData(),this.state="loaded",r){r.featureIndex&&(this.latestFeatureIndex=r.featureIndex,r.rawTileData?(this.latestRawTileData=r.rawTileData,this.latestFeatureIndex.rawTileData=r.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=r.collisionBoxArray,this.buckets=j0(r.buckets,e.style),this.hasSymbolBuckets=!1,this.hasTunnelGeometry=!!r.hasTunnelGeometry;for(const n in this.buckets){const s=this.buckets[n];if(s instanceof Fo){if(this.hasSymbolBuckets=!0,!i)break;s.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const n in this.buckets){const s=this.buckets[n];if(s instanceof Fo&&s.hasRTLText){this.hasRTLText=!0,Cd();break}}this.queryPadding=0;for(const n in this.buckets){const s=this.buckets[n],l=e.style.getOwnLayer(n);if(!l)continue;const u=l.queryRadius(s)||0;this.queryPadding=Math.max(this.queryPadding,u)}r.imageAtlas&&(this.imageAtlas=e.style.imageManager.imageAtlasCache.getOrCache(r.imageAtlas)),r.glyphAtlasImage&&(this.glyphAtlasImage=r.glyphAtlasImage),r.lineAtlas&&(this.lineAtlas=r.lineAtlas),this._lastUpdatedBrightness=r.brightness}else this.collisionBoxArray=new Aa}unloadVectorData(){if(this.hasData()){for(const r in this.buckets)this.buckets[r].destroy();this.buckets={},this.imageAtlas&&(this.imageAtlas=null),this.lineAtlas&&(this.lineAtlas=null),this.imageAtlasTexture&&(this.imageAtlasTexture=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.lineAtlasTexture&&this.lineAtlasTexture.destroy(),this._tileBoundsBuffer&&(this._tileBoundsBuffer.destroy(),this._tileBoundsIndexBuffer.destroy(),this._tileBoundsSegments.destroy(),this._tileBoundsBuffer=null),this._tileDebugBuffer&&(this._tileDebugBuffer.destroy(),this._tileDebugSegments.destroy(),this._tileDebugBuffer=null),this._tileDebugIndexBuffer&&(this._tileDebugIndexBuffer.destroy(),this._tileDebugIndexBuffer=null),this._globeTileDebugBorderBuffer&&(this._globeTileDebugBorderBuffer.destroy(),this._globeTileDebugBorderBuffer=null),this._tileDebugTextBuffer&&(this._tileDebugTextBuffer.destroy(),this._tileDebugTextSegments.destroy(),this._tileDebugTextIndexBuffer.destroy(),this._tileDebugTextBuffer=null),this._globeTileDebugTextBuffer&&(this._globeTileDebugTextBuffer.destroy(),this._globeTileDebugTextBuffer=null),this.latestFeatureIndex=null,this.state="unloaded"}}loadModelData(r,e,i){r&&(r.resourceTiming&&(this.resourceTiming=r.resourceTiming),this.buckets=Object.assign({},this.buckets,j0(r.buckets,e.style)),r.featureIndex&&(this.latestFeatureIndex=r.featureIndex))}getBucket(r){return this.buckets[r.fqid]}upload(r,e){for(const s in this.buckets){const l=this.buckets[s];if(l.uploadPending()){let u={},f=[],p={zoom:0,pitch:0,brightness:0,worldview:""};if(e){if(e.style){f=e.style.listImages();const g=l.layers[0],x=g.sourceLayer||"_geojsonTileLayer",b=e.style.getLayerSourceCache(g);b&&(u=b._state.getState(x,void 0))}p={zoom:e.transform.zoom||0,pitch:e.transform.pitch||0,brightness:e.style.getBrightness()||0,worldview:e.worldview||""}}l.upload(r,this.tileID.canonical,u,f,p)}}const i=r.gl,n=this.imageAtlas;!n||this.imageAtlasTexture&&n.uploaded||(this.imageAtlasTexture=null,this.imageAtlasTexture=e.style.imageManager.imageAtlasCache.getTextureForAtlas(n,r,i.RGBA8),n.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new Gs(r,this.glyphAtlasImage,i.R8),this.glyphAtlasImage=null),this.lineAtlas&&!this.lineAtlas.uploaded&&(this.lineAtlasTexture=new Gs(r,this.lineAtlas.image,i.R8),this.lineAtlas.uploaded=!0)}prepare(r,e,i){if(this.imageAtlas&&this.imageAtlasTexture&&e){const b=e.style.getLut(i);this.imageAtlas.patchUpdatedImages(r,this.imageAtlasTexture,i,b)}if(!e||!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData)return;const n=e.style.getBrightness(),s=e.style.listImages(),l=s.length,u=e.style._changes.getUpdatedPaintProperties(),f=Object.keys(this.buckets).some(b=>this.buckets[b].layers.some(w=>u.has(w.fqid))),p=Object.keys(this.buckets).some(b=>this.buckets[b].layers.some(w=>w.hasTransition&&w.hasTransition())),g=this._firstPrepareComplete&&l!==this._lastAvailableImagesCount;this._hasAppearances===null&&(this._hasAppearances=this.hasAppearances(e));const x=this._lastUpdatedBrightness!==n;this._lastAvailableImagesCount=l,this._firstPrepareComplete=!0,(this._lastUpdatedBrightness||n||this._hasAppearances||f||p||g)&&(!(this._hasAppearances||f||p||g)&&this._lastUpdatedBrightness&&n&&Math.abs(this._lastUpdatedBrightness-n)<.001||(this.updateBuckets(e,x,void 0,g||f||p,u,s),this._lastUpdatedBrightness=n))}evaluateQueryRenderedFeaturePadding(){let r=0;for(const e in this.buckets){const i=this.buckets[e];i.evaluateQueryRenderedFeaturePadding&&(r=Math.max(r,i.evaluateQueryRenderedFeaturePadding()))}return r}queryRenderedFeatures(r,e,i,n,s,l,u){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData&&!this.latestFeatureIndex.is3DTile)return{};const f=this.evaluateQueryRenderedFeaturePadding(),p=(function(g,x){const b=$o([],[.5*g.width,.5*-g.height,1]);return Cr(b,b,[1,-1,0]),gi(b,b,g.calculateProjMatrix(x.toUnwrapped())),Float32Array.from(b)})(s,this.tileID);return this.latestFeatureIndex.query(r,{tilespaceGeometry:e,pixelPosMatrix:p,transform:n,availableImages:i,tileTransform:this.tileTransform,worldview:this.worldview,queryRadius:f,scope:u})}querySourceFeatures(r,e){const i=this.latestFeatureIndex;if(!i||!i.rawTileData)return;const n=i.loadVTLayers(),s=e?e.sourceLayer:"",l=n._geojsonTileLayer||n[s];if(!l)return;const u=Wu(e&&e.filter),{z:f,x:p,y:g}=this.tileID.canonical,x={z:f,x:p,y:g};for(let b=0;b<l.length;b++){const w=l.feature(b);if(u.needGeometry){const M=$n(w,!0);if(!u.filter(new Wt(this.tileID.overscaledZ,{worldview:this.worldview}),M,this.tileID.canonical))continue}else if(!u.filter(new Wt(this.tileID.overscaledZ,{worldview:this.worldview}),w))continue;const S=i.getId(w,s),E=new Kc(w,f,p,g,S);E.tile=x,r.push(E)}}loaded(){return this.state==="loaded"||this.state==="errored"}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return!!this.imageAtlas&&!!this.imageAtlas.patternPositions.size}setExpiryData(r){const e=this.expirationTime;if(r.cacheControl){const i=Ei(r.cacheControl);i["max-age"]&&(this.expirationTime=Date.now()+1e3*i["max-age"])}else r.expires&&(this.expirationTime=new Date(r.expires).getTime());if(this.expirationTime){const i=Date.now();let n=!1;if(this.expirationTime>i)n=!1;else if(e)if(this.expirationTime<e)n=!0;else{const s=this.expirationTime-e;s?this.expirationTime=i+Math.max(s,3e4):n=!0}else n=!0;n?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-Date.now(),Math.pow(2,31)-1)}refreshFeatureState(r,e){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData&&!this.latestFeatureIndex.is3DTile||!r)return;const i=r.style.listImages();this.updateBuckets(r,!1,e,void 0,void 0,i)}hasAppearances(r){for(const e in this.buckets)if(r.style.hasLayer(e)&&this.buckets[e].layers.some(i=>i.appearances&&i.appearances.length>0))return!0;return!1}updateBuckets(r,e,i,n,s,l){if(!this.latestFeatureIndex||!r.style)return;const u=l||r.style.listImages(),f=r.style.getBrightness(),p=s||new Set;for(const g in this.buckets){if(!r.style.hasLayer(g))continue;const x=this.buckets[g],b=x.layers[0],w=b.sourceLayer||"_geojsonTileLayer",S=r.style.getLayerSourceCache(b),E=x.layers.some($=>p.has($.fqid)),M=(n||E)&&x instanceof Fo?r.style.getOwnLayer(g):void 0;let C=i&&i[w]||{};S&&!i&&(C=S._state.getState(w,void 0));const R=this.imageAtlas?Object.fromEntries(this.imageAtlas.patternPositions):{},F=Object.keys(C).length>0&&!e;x.hasAppearances=x.layers.some($=>$.appearances&&$.appearances.length>0);const z=F?x.stateDependentLayers:x.layers;if(F&&x.stateDependentLayers.length!==0||e||E||n){const $=this.latestFeatureIndex.loadVTLayers()[w];if(x.update(C,$,u,R,z,e,f,this.tileID.canonical),(n||E)&&(!e||e&&x instanceof Fo&&(!x.text.uboBinder||x.text.uboBinder.isLightConstant||!x.icon.uboBinder||x.icon.uboBinder.isLightConstant))&&x instanceof Fo&&M&&M.type==="symbol"){const q=x;q.text&&q.text.uboBinder&&q.text.uboBinder.updateDynamicExpressions(M,$,this.tileID.canonical,u,C,f),q.icon&&q.icon.uboBinder&&q.icon.uboBinder.updateDynamicExpressions(M,$,this.tileID.canonical,u,C,f)}if(x instanceof Fo){const q=x,ie=r.context;q.text&&q.text.uboBinder&&q.text.uboBinder.upload(ie),q.icon&&q.icon.uboBinder&&q.icon.uboBinder.upload(ie)}}if(F&&x.stateDependentLayers.length!==0||e||x.hasAppearances){const $={zoom:r.transform.zoom,pitch:r.transform.pitch,brightness:r.style.getBrightness()||0,worldview:r.worldview},q=x.updateAppearances(this.tileID.canonical,C,u,$,r.imageManager,F&&x.stateDependentLayers.length!==0);if(q&&q.hasUboChanges){const ie=r.context;x instanceof Fo&&x.text&&x.text.uboBinder&&x.text.uboBinder.upload(ie),x instanceof Fo&&x.icon&&x.icon.uboBinder&&x.icon.uboBinder.upload(ie)}}(x instanceof s_||x instanceof Bm)&&r._terrain&&r._terrain.enabled&&S&&x.uploadPending()&&r._terrain._clearRenderCacheForTile(S.id,this.tileID);const j=r&&r.style&&r.style.getOwnLayer(g);j&&(this.queryPadding=Math.max(this.queryPadding,j.queryRadius(x)||0))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<un.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(r){this.symbolFadeHoldUntil=un.now()+r}setTexture(r,e){const i=e.context,n=i.gl;this.texture=this.texture||e.getTileTexture(r.width),this.texture&&this.texture instanceof Gs?this.texture.update(r):(this.texture=new Gs(i,r,n.RGBA8,{useMipmap:!0}),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE))}setDependencies(r,e){const i={};for(const n of e)i[n]=!0;this.dependencies[r]=i}hasDependency(r,e){for(const i of r){const n=this.dependencies[i];if(n){for(const s of e)if(n[s])return!0}}return!1}clearQueryDebugViz(){}_makeDebugTileBoundsBuffers(r,e){if(!e||e.name==="mercator"||this._tileDebugBuffer)return;const i=gn(H0,this.tileID.canonical,this.tileTransform)[0],n=new Nn,s=new os;for(let l=0;l<i.length;l++){const{x:u,y:f}=i[l];n.emplaceBack(u,f),s.emplaceBack(l)}s.emplaceBack(0),this._tileDebugIndexBuffer=r.createIndexBuffer(s),this._tileDebugBuffer=r.createVertexBuffer(n,pe.members),this._tileDebugSegments=di.simpleSegment(0,0,n.length,s.length)}_makeTileBoundsBuffers(r,e){if(this._tileBoundsBuffer||!e||e.name==="mercator")return;const i=gn(H0,this.tileID.canonical,this.tileTransform)[0];let n,s;if(this.isRaster){const l=(function(u,f){const p=Yc(u,f),g=Math.pow(2,u.z);for(let M=0;M<$s;M++)for(let C=0;C<$s;C++){const R=mn((u.x+(C+G0(C))/Bo)/g),F=pr((u.y+(M+G0(M))/Bo)/g),z=f.project(R,F),j=M*$s+C;Hs[2*j+0]=Math.round((z.x*p.scale-p.x)*Xe),Hs[2*j+1]=Math.round((z.y*p.scale-p.y)*Xe)}kl.fill(0),M_.fill(0);for(let M=2045;M>=0;M--){const C=4*M,R=Bl[C+0],F=Bl[C+1],z=Bl[C+2],j=Bl[C+3],$=R+z>>
vendor: 7,333 bytes, line 7
71,q=F+j>>1,ie=$+q-F,W=q+R-$,Q=F*$s+R,Y=j*$s+z,ee=q*$s+$,me=Math.hypot((Hs[2*Q+0]+Hs[2*Y+0])/2-Hs[2*ee+0],(Hs[2*Q+1]+Hs[2*Y+1])/2-Hs[2*ee+1])>=16;kl[ee]=kl[ee]||(me?1:0),M<1022&&(kl[ee]=kl[ee]||kl[(F+W>>1)*$s+(R+ie>>1)]||kl[(j+W>>1)*$s+(z+ie>>1)])}const x=new Sa,b=new Ai;let w=0;function S(M,C){const R=C*$s+M;return M_[R]===0&&(x.emplaceBack(Hs[2*R+0],Hs[2*R+1],M*Xe/Bo,C*Xe/Bo),M_[R]=++w),M_[R]-1}function E(M,C,R,F,z,j){const $=M+R>>1,q=C+F>>1;if(Math.abs(M-z)+Math.abs(C-j)>1&&kl[q*$s+$])E(z,j,M,C,$,q),E(R,F,z,j,$,q);else{const ie=S(M,C),W=S(R,F),Q=S(z,j);b.emplaceBack(ie,W,Q)}}return E(0,0,Bo,Bo,Bo,0),E(Bo,Bo,0,0,0,Bo),{vertices:x,indices:b}})(this.tileID.canonical,e);n=l.vertices,s=l.indices}else{n=new Sa,s=new Ai;for(const{x:u,y:f}of i)n.emplaceBack(u,f,0,0);const l=Gr(n.int16.subarray(0,4*n.length),void 0,4);for(let u=0;u<l.length;u+=3)s.emplaceBack(l[u],l[u+1],l[u+2])}this._tileBoundsBuffer=r.createVertexBuffer(n,w_.members),this._tileBoundsIndexBuffer=r.createIndexBuffer(s),this._tileBoundsSegments=di.simpleSegment(0,0,n.length,s.length)}_makeGlobeTileDebugBuffers(r,e){const i=e.projection;if(!i||i.name!=="globe"||e.freezeTileCoverage)return;const n=this.tileID.canonical,s=_t(at(n,e)),l=oi(e.zoom);let u;l>0&&(u=an(new Float64Array(16),e.globeMatrix)),this._makeGlobeTileDebugBorderBuffer(r,n,e,s,u,l),this._makeGlobeTileDebugTextBuffer(r,n,e,s,u,l)}_globePoint(r,e,i,n,s,l,u){let f=xt(r,e,i);if(l){const p=1<<i.z,g=as(n.center.lng),x=Lo(n.center.lat),b=(i.x+.5)/p-g;let w=0;b>.5?w=-1:b<-.5&&(w=1);let S=(r/Xe+i.x)/p+w,E=(e/Xe+i.y)/p;S=(S-g)*n._pixelsPerMercatorPixel+g,E=(E-x)*n._pixelsPerMercatorPixel+x;const M=[S*n.worldSize,E*n.worldSize,0];Pi(M,M,l),f=Be(f,M,u)}return Pi(f,f,s)}_makeGlobeTileDebugBorderBuffer(r,e,i,n,s,l){const u=new Nn,f=new os,p=new Ta,g=(b,w,S,E,M)=>{const C=(S-b)/(M-1),R=(E-w)/(M-1),F=u.length;for(let z=0;z<M;z++){const j=b+z*C,$=w+z*R;u.emplaceBack(j,$);const q=this._globePoint(j,$,e,i,n,s,l);p.emplaceBack(q[0],q[1],q[2]),f.emplaceBack(F+z)}},x=Xe;g(0,0,x,0,16),g(x,0,x,x,16),g(x,x,0,x,16),g(0,x,0,0,16),this._tileDebugIndexBuffer=r.createIndexBuffer(f),this._tileDebugBuffer=r.createVertexBuffer(u,pe.members),this._globeTileDebugBorderBuffer=r.createVertexBuffer(p,Ee.members),this._tileDebugSegments=di.simpleSegment(0,0,u.length,f.length)}_makeGlobeTileDebugTextBuffer(r,e,i,n,s,l){const u=new Nn,f=new Ai,p=new Ta,g=25;f.reserve(32),u.reserve(g),p.reserve(g);const x=(b,w)=>g*b+w;for(let b=0;b<g;b++){const w=2048*b;for(let S=0;S<g;S++){const E=2048*S;u.emplaceBack(E,w);const M=this._globePoint(E,w,e,i,n,s,l);p.emplaceBack(M[0],M[1],M[2])}}for(let b=0;b<4;b++)for(let w=0;w<4;w++){const S=x(b,w),E=x(b,w+1),M=x(b+1,w),C=x(b+1,w+1);f.emplaceBack(S,E,M),f.emplaceBack(M,E,C)}this._tileDebugTextIndexBuffer=r.createIndexBuffer(f),this._tileDebugTextBuffer=r.createVertexBuffer(u,pe.members),this._globeTileDebugTextBuffer=r.createVertexBuffer(p,Ee.members),this._tileDebugTextSegments=di.simpleSegment(0,0,g,32)}destroy(r=!0){for(const e in this.buckets)this.buckets[e].destroy(r);this.buckets={},this.imageAtlas&&(this.imageAtlas=null),this.lineAtlas&&(this.lineAtlas=null),this.imageAtlasTexture&&delete this.imageAtlasTexture,this.glyphAtlasTexture&&(this.glyphAtlasTexture.destroy(),delete this.glyphAtlasTexture),this.lineAtlasTexture&&(this.lineAtlasTexture.destroy(),delete this.lineAtlasTexture),this._tileBoundsBuffer&&(this._tileBoundsBuffer.destroy(),this._tileBoundsIndexBuffer.destroy(),this._tileBoundsSegments.destroy(),this._tileBoundsBuffer=null),this._tileDebugBuffer&&(this._tileDebugBuffer.destroy(),this._tileDebugSegments.destroy(),this._tileDebugBuffer=null),this._tileDebugIndexBuffer&&(this._tileDebugIndexBuffer.destroy(),this._tileDebugIndexBuffer=null),this._globeTileDebugBorderBuffer&&(this._globeTileDebugBorderBuffer.destroy(),this._globeTileDebugBorderBuffer=null),this._tileDebugTextBuffer&&(this._tileDebugTextBuffer.destroy(),this._tileDebugTextSegments.destroy(),this._tileDebugTextIndexBuffer.destroy(),this._tileDebugTextBuffer=null),this._globeTileDebugTextBuffer&&(this._globeTileDebugTextBuffer.destroy(),this._globeTileDebugTextBuffer=null),r&&this.texture&&this.texture instanceof Gs&&(this.texture.destroy(),delete this.texture),this.emissiveTexture&&this.emissiveTexture instanceof Gs&&(this.emissiveTexture.destroy(),delete this.emissiveTexture),this.hillshadeFBO&&(this.hillshadeFBO.destroy(),delete this.hillshadeFBO),this.dem&&delete this.dem,this.neighboringTiles&&delete this.neighboringTiles,this.demTexture&&(this.demTexture.destroy(),delete this.demTexture),this.rasterParticleState&&(this.rasterParticleState.destroy(),delete this.rasterParticleState),this.latestFeatureIndex=null,this.state="unloaded"}},U.b4=Ja,U.b5=nc,U.b6=function(r,e){const i=[];for(const n in r)n in e||i.push(n);return i},U.b7=$0,U.b8=["type","source","source-layer","minzoom","maxzoom","filter","layout"],U.b9=Wo,U.bA=Ot,U.bB=Cr,U.bC=dr,U.bD=cx,U.bE=Vm,U.bF=fx,U.bG=px,U.bH=$n,U.bI=Ga,U.bJ=oy,U.bK=Kv,U.bL=gy,U.bM=Oy,U.bN=Ci,U.bO=Qs,U.bP=xs,U.bQ=function(r,e,i){i*=.5;var n=e[0],s=e[1],l=e[2],u=e[3],f=Math.sin(i),p=Math.cos(i);return r[0]=n*p+s*f,r[1]=s*p-n*f,r[2]=l*p+u*f,r[3]=u*p-l*f,r},U.bR=$a,U.bS=Yi,U.bT=$o,U.bU=function(r,e){return r[0]=-e[0],r[1]=-e[1],r[2]=-e[2],r[3]=e[3],r},U.bV=Zl,U.bW=function(r,e,i,n,s){var l=1/Math.tan(e/2);if(r[0]=l/i,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=l,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=-1,r[12]=0,r[13]=0,r[15]=0,s!=null&&s!==1/0){var u=1/(n-s);r[10]=(s+n)*u,r[14]=2*s*n*u}else r[10]=-1,r[14]=-2*n;return r},U.bX=function(r,e,i,n,s,l,u){var f=1/(e-i),p=1/(n-s),g=1/(l-u);return r[0]=-2*f,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=-2*p,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=2*g,r[11]=0,r[12]=(e+i)*f,r[13]=(s+n)*p,r[14]=(u+l)*g,r[15]=1,r},U.bY=Yr,U.bZ=pr,U.b_=function(r,e,i){r[4*e+0]=i[0],r[4*e+1]=i[1],r[4*e+2]=i[2],r[4*e+3]=i[3]},U.ba=an,U.bb=Hl,U.bc=Yn,U.bd=Na,U.be=function(r,e){const{x:i,y:n}=r.point,s=ii(i,n,r.worldSize/r._pixelsPerMercatorPixel,0,0);return gi(s,s,Bt(je(e)))},U.bf=eu,U.bg=Va,U.bh=Js,U.bi=wn,U.bj=kr,U.bk=Xi,U.bl=gh,U.bm=zn,U.bn=ly,U.bo=function(r,e,i,n,s){const l=5*e+2;r.float32[l+0]=i,r.float32[l+1]=n,r.float32[l+2]=s},U.bp=vh,U.bq=ba,U.br=Qn,U.bs=ra,U.bt=ia,U.bu=Ha,U.bv=Ve,U.bw=function(r,e,i,n){var s=new ji(4);return s[0]=r,s[1]=e,s[2]=i,s[3]=n,s},U.bx=class{isDataAvailableAtPoint(r){const e=this._source();if(this.isUsingMockSource()||!e||r.y<0||r.y>1)return!1;const i=e.getSource().maxzoom,n=1<<i,s=Math.floor(r.x),l=Math.floor((r.x-s)*n),u=Math.floor(r.y*n),f=this.findDEMTileFor(new ue(i,s,i,l,u));return!(!f||!f.dem)}getAtPointOrZero(r,e=0){return this.getAtPoint(r,e)||0}getAtPoint(r,e,i=!0){if(this.isUsingMockSource())return null;e==null&&(e=null);const n=this._source();if(!n||r.y<0||r.y>1)return e;const s=n.getSource().maxzoom,l=1<<s,u=Math.floor(r.x),f=r.x-u,p=new ue(s,u,s,Math.floor(f*l),Math.floor(r.y*l)),g=this.findDEMTileFor(p);if(!g||!g.dem)return e;const x=g.dem,b=1<<g.tileID.canonical.z,w=(f*b-g.tileID.canonical.x)*x.dim,S=(r.y*b-g.tileID.canonical.y)*x.dim,E=Math.floor(w),M=Math.floor(S);return(i?this.exaggeration():1)*ft(ft(x.get(E,M),x.get(E,M+1),S-M),ft(x.get(E+1,M),x.get(E+1,M+1),S-M),w-E)}static getAtTileOffset(r,e,i,n){const s=1<<r.canonical.z;return n?n.pointElevation(e):i?i.getAtPointOrZero(new Or(r.wrap+(r.canonical.x+e.x/Xe)/s,(r.canonical.y+e.
vendor: 41,171 bytes, line 7
7y/Xe)/s)):0}static getAtTileOffsetFunc(r,e,i,n){return(s,l,u)=>{const f=this.getAtTileOffset(r,s,l,u),p=n.upVector(r.canonical,s.x,s.y);return Ci(p,p,f*n.upVectorScale(r.canonical,e,i).metersToTile),p}}getForTilePoints(r,e,i,n){if(this.isUsingMockSource())return!1;const s=wh.create(this,r,n);return!!s&&(e.forEach(l=>{l[2]=this.exaggeration()*s.getElevationAt(l[0],l[1],i,!0)}),!0)}getMinMaxForTile(r){if(this.isUsingMockSource())return null;const e=this.findDEMTileFor(r);if(!e||!e.dem)return null;const i=e.dem.tree,n=e.tileID,s=1<<r.canonical.z-n.canonical.z;let l=r.canonical.x/s-n.canonical.x,u=r.canonical.y/s-n.canonical.y,f=0;for(let p=0;p<r.canonical.z-n.canonical.z&&!i.leaves[f];p++){l*=2,u*=2;const g=2*Math.floor(u)+Math.floor(l);f=i.childOffsets[f]+g,l%=1,u%=1}return{min:this.exaggeration()*i.minimums[f],max:this.exaggeration()*i.maximums[f]}}getMinElevationBelowMSL(){throw new Error("Pure virtual method called.")}raycast(r,e,i){throw new Error("Pure virtual method called.")}pointCoordinate(r){throw new Error("Pure virtual method called.")}_source(){throw new Error("Pure virtual method called.")}isUsingMockSource(){throw new Error("Pure virtual method called.")}exaggeration(){throw new Error("Pure virtual method called.")}findDEMTileFor(r){throw new Error("Pure virtual method called.")}get visibleDemTiles(){throw new Error("Getter must be implemented in subclass.")}getMinMaxForVisibleTiles(){const r=this.visibleDemTiles;if(r.length===0)return null;let e=!1,i=Number.MAX_VALUE,n=Number.MIN_VALUE;for(const s of r){const l=this.getMinMaxForTile(s.tileID);l&&(i=Math.min(i,l.min),n=Math.max(n,l.max),e=!0)}return e?{min:i,max:n}:null}},U.by=Xm,U.bz=d,U.c=Wa,U.c$=Xx,U.c0=kc,U.c1=Hi,U.c2=Vn,U.c3=Fs,U.c4=d0,U.c5=function(r,e){return r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]&&r[3]===e[3]},U.c6=go,U.c7=function(r){var e=r[0],i=r[1],n=r[2],s=r[3];return Math.sqrt(e*e+i*i+n*n+s*s)},U.c8=tu,U.c9=Ua,U.cA=e_,U.cB=Wl,U.cC=Yx,U.cD=function(r){const e=Yx(r,!0);return eu([],[e[0],e[1],e[4],e[5]])},U.cE=Br,U.cF=Hn,U.cG=jo,U.cH=function(r,e){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},U.cI=function(r){const{x:e,y:i}=r.point,{lng:n,lat:s}=r._center;return ii(e,i,r.worldSize,n,s)},U.cJ=Yl,U.cK=_s,U.cL=X,U.cM=N,U.cN=5,U.cO=function(r,e,i){let n=0;for(let s=0;s<2;++s)r[s]>0&&(n+=(r[s]-0)*(r[s]-0)),e[s]<0&&(n+=(0-e[s])*(0-e[s]));return n},U.cP=function(r){return r*r*r*r*r},U.cQ=Uc,U.cR=45,U.cS=Xd,U.cT=function(r,e,i){const n=Math.sqrt(r*r+e*e+i*i),s=n>0?Math.acos(i/n)*oa:0;let l=r!==0||e!==0?Math.atan2(-e,-r)*oa+90:0;return l<0&&(l+=360),[n,l,s]},U.cU=wr,U.cV=$i,U.cW=Cn,U.cX=er,U.cY=wi,U.cZ=Jn,U.c_=function(r){return[Math.pow(r[0],1/2.2),Math.pow(r[1],1/2.2),Math.pow(r[2],1/2.2)]},U.ca=de,U.cb=3,U.cc=2,U.cd=7,U.ce=6,U.cf=Ks,U.cg=ni,U.ch=Xl,U.ci=0,U.cj=1,U.ck=4,U.cl=5,U.cm=ve,U.cn=sf,U.co=Jx,U.cp=oe,U.cq=tt,U.cr=function(r,e,i,n,s,l,u,f,p){if(p.name==="globe")return tt(r,e,new oe(i,n,s),!1);const g=Yc({z:i,x:n,y:s},p);return new wi([(l+g.x/g.scale)*e,e*(g.y/g.scale),u],[(l+g.x2/g.scale)*e,e*(g.y2/g.scale),f])},U.cs=function(r,e,i){return r[0]=Math.min(e[0],i[0]),r[1]=Math.min(e[1],i[1]),r[2]=Math.min(e[2],i[2]),r[3]=Math.min(e[3],i[3]),r},U.ct=function(r,e,i){return r[0]=Math.max(e[0],i[0]),r[1]=Math.max(e[1],i[1]),r[2]=Math.max(e[2],i[2]),r[3]=Math.max(e[3],i[3]),r},U.cu=function(r){const e=Math.round((r+45+360)%360/90)%4;return ae[e]},U.cv=_n,U.cw=ea,U.cx=6,U.cy=function(r){const e=Ot(new Float64Array(16));gi(e,r.pixelMatrix,r.globeMatrix);const i=[0,Mn,0],n=[0,Gn,0];return Pi(i,i,e),Pi(n,n,e),[i[0]>0&&i[0]<=r.width&&i[1]>0&&i[1]<=r.height&&!$t(r,new Zt(r.center.lat,90)),n[0]>0&&n[0]<=r.width&&n[1]>0&&n[1]<=r.height&&!$t(r,new Zt(r.center.lat,-90))]},U.cz=function(r,e){const{scale:i}=r.tileTransform,n=i*Xe/(r.tileSize*Math.pow(2,e.zoom-r.tileID.overscaledZ+r.tileID.canonical.z)),s=e.inverseAdjustmentMatrix;return new Float32Array([s[0]*n,s[1]*n,s[2]*n,s[3]*n])},U.d=function(r){return fi.API_TILEJSON_REGEX.test(r)},U.d$=Dt,U.d0=Yg,U.d1=ev,U.d2=_,U.d3=class{static calculate(r,e,i){const n=new Set,s=new Map,l=new Set,u=new Set;for(const p of Object.values(r))for(const[g,x]of Object.entries(p.floors)){l.add(g),x.isDefault&&u.add(g),x.conflicts&&s.set(g,x.conflicts);const b=g===e,w=x.connections&&e&&x.connections.has(e);(b||w)&&n.add(g)}const f=p=>{const g=s.get(p)||new Set;for(const x of n)if((s.get(x)||new Set).has(p)||g.has(x))return!0;return!1};if(i)for(const p of i)l.has(p)&&(f(p)||n.add(p));for(const p of u)n.has(p)||f(p)||n.add(p);return n}},U.d4=h_,U.d5=py,U.d6=su,U.d7=function(){return{API_URL:fi.API_URL,DRACO_URL:fi.DRACO_URL,MESHOPT_URL:fi.MESHOPT_URL,MESHOPT_SIMD_URL:fi.MESHOPT_SIMD_URL,BUILDING_GEN_URL:fi.BUILDING_GEN_URL}},U.d8=Ad,U.d9=Ph,U.dA=pe,U.dB=di,U.dC=ri,U.dD=Pe,U.dE=Nn,U.dF=Ai,U.dG=function(r,e){return[Math.pow(r[0],2.2)*e,Math.pow(r[1],2.2)*e,Math.pow(r[2],2.2)*e]},U.dH=$l,U.dI=function(r,e){var i=Math.sin(e),n=Math.cos(e);return r[0]=n,r[1]=i,r[2]=0,r[3]=-i,r[4]=n,r[5]=0,r[6]=0,r[7]=0,r[8]=1,r},U.dJ=gs,U.dK=Vt,U.dL=or,U.dM=xo,U.dN=Iy,U.dO=function(r,e){const i=[0,0,0];return Pi(i,i,_t(je(e.canonical))),Pi(i,i,r),i},U.dP=r=>({u_matrix:new Fs(r),u_texsize:new Vn(r),u_pixels_to_tile_units:new Ml(r),u_device_pixel_ratio:new Hi(r),u_width_scale:new Hi(r),u_floor_width_scale:new Hi(r),u_image:new Bc(r),u_units_to_pixels:new Vn(r),u_tile_units_to_pixels:new Hi(r),u_alpha_discard_threshold:new Hi(r),u_trim_offset:new Vn(r),u_trim_fade_range:new Vn(r),u_trim_gradient_mix_range:new Vn(r),u_trim_color:new Xd(r),u_zbias_factor:new Hi(r),u_tile_to_meter:new Hi(r),u_ground_shadow_factor:new kc(r),u_pattern_transition:new Hi(r)}),U.dQ=r=>({u_matrix:new Fs(r),u_pixels_to_tile_units:new Ml(r),u_device_pixel_ratio:new Hi(r),u_width_scale:new Hi(r),u_floor_width_scale:new Hi(r),u_units_to_pixels:new Vn(r),u_dash_image:new Bc(r),u_gradient_image:new Bc(r),u_image_height:new Hi(r),u_texsize:new Vn(r),u_tile_units_to_pixels:new Hi(r),u_alpha_discard_threshold:new Hi(r),u_trim_offset:new Vn(r),u_trim_fade_range:new Vn(r),u_trim_gradient_mix_range:new Vn(r),u_trim_color:new Xd(r),u_zbias_factor:new Hi(r),u_tile_to_meter:new Hi(r),u_ground_shadow_factor:new kc(r)}),U.dR=r=>({u_camera_to_center_distance:new Hi(r),u_extrude_scale:new Ml(r),u_device_pixel_ratio:new Hi(r),u_matrix:new Fs(r),u_inv_rot_matrix:new Fs(r),u_merc_center:new Vn(r),u_tile_id:new kc(r),u_zoom_transition:new Hi(r),u_up_dir:new kc(r),u_emissive_strength:new Hi(r)}),U.dS=Po,U.dT=ow,U.dU=class{constructor(r,e,i,n){this.context=r,this.format=n,this.size=i,this.texture=r.gl.createTexture();const[s,l,u]=this.size,{gl:f}=r;f.bindTexture(f.TEXTURE_3D,this.texture),r.pixelStoreUnpackFlipY.set(!1),r.pixelStoreUnpack.set(1),r.pixelStoreUnpackPremultiplyAlpha.set(!1),"data"in e&&e.data&&f.texImage3D(f.TEXTURE_3D,0,this.format,s,l,u,0,Vg(this.format),jg(this.format),e.data)}bind(r,e){const{context:i}=this,{gl:n}=i;n.bindTexture(n.TEXTURE_3D,this.texture),r!==this.minFilter&&(n.texParameteri(n.TEXTURE_3D,n.TEXTURE_MAG_FILTER,r),n.texParameteri(n.TEXTURE_3D,n.TEXTURE_MIN_FILTER,r),this.minFilter=r),e!==this.wrapS&&(n.texParameteri(n.TEXTURE_3D,n.TEXTURE_WRAP_S,e),n.texParameteri(n.TEXTURE_3D,n.TEXTURE_WRAP_T,e),this.wrapS=e)}destroy(){const{gl:r}=this.context;r.deleteTexture(this.texture),this.texture=null}},U.dV=Qt,U.dW=(r,e,i,n,s,l)=>{const u=r.transform,f=u.projection.name==="globe";let p;if(l.paint.get("circle-pitch-alignment")==="map")if(f){const x=Vt(u.zoom,e.canonical)*u._pixelsPerMercatorPixel;p=Float32Array.from([x,0,0,x])}else p=u.calculatePixelsToTileUnitsMatrix(i);else p=new Float32Array([u.pixelsToGLUnits[0],0,0,u.pixelsToGLUnits[1]]);const g={u_camera_to_center_distance:r.transform.getCameraToCenterDistance(u.projection),u_matrix:r.translatePosMatrix(e.projMatrix,i,l.paint.get("circle-translate"),l.paint.get("circle-translate-anchor")),u_device_pixel_ratio:un.devicePixelRatio,u_extrude_scale:p,u_inv_rot_matrix:Ri,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0],u_emissive_strength:l.paint.get("circle-emissive-strength")};if(f){g.u_inv_rot_matrix=n,g.u_merc_center=s,g.u_tile_id=[e.canonical.x,e.canonical.y,1<<e.canonical.z],g.u_zoom_transition=oi(u.zoom);const x=s[0]*Xe,b=s[1]*Xe;g.u_up_dir=u.projection.upVector(new oe(0,0,0),x,b)}return g},U.dX=vv,U.dY=Vr,U.dZ=(r,e,i,n,s,l,u,f,p,g)=>{const x=r.transform,b=x.pitch<15?gv(.07,.7,re((14-x.zoom)/5,0,1)):.07,w=i.paint.get("line-trim-color-use-theme").constantOr("default")==="none";return{u_matrix:xv(r,e,i,n),u_texsize:e.imageAtlasTexture?e.imageAtlasTexture.size:[0,0],u_pixels_to_tile_units:x.calculatePixelsToTileUnitsMatrix(e),u_device_pixel_ratio:s,u_width_scale:l,u_floor_width_scale:u,u_image:0,u_tile_units_to_pixels:yv(e,x),u_units_to_pixels:[1/x.pixelsToGLUnits[0],1/x.pixelsToGLUnits[1]],u_alpha_discard_threshold:0,u_trim_offset:f,u_trim_fade_range:i.paint.get("line-trim-fade-range"),u_trim_gradient_mix_range:[1,1],u_trim_color:i.paint.get("line-trim-color").toPremultipliedRenderColor(w?null:i.lut).toArray01(),u_zbias_factor:b,u_tile_to_meter:Cn(e.tileID.canonical,0),u_ground_shadow_factor:p,u_pattern_transition:g}},U.d_=(r,e,i,n,s,l,u,f,p,g)=>{const x=r.transform,b=x.calculatePixelsToTileUnitsMatrix(e),w=i.paint.get("line-trim-color-use-theme").constantOr("default")==="none",S=x.pitch<15?gv(.07,.7,re((14-x.zoom)/5,0,1)):.07;return{u_matrix:xv(r,e,i,n),u_pixels_to_tile_units:b,u_device_pixel_ratio:l,u_width_scale:u,u_floor_width_scale:f,u_units_to_pixels:[1/x.pixelsToGLUnits[0],1/x.pixelsToGLUnits[1]],u_dash_image:0,u_gradient_image:1,u_image_height:s,u_texsize:bv(i)&&e.lineAtlasTexture?e.lineAtlasTexture.size:[0,0],u_tile_units_to_pixels:yv(e,r.transform),u_alpha_discard_threshold:0,u_trim_offset:p,u_trim_fade_range:i.paint.get("line-trim-fade-range"),u_trim_gradient_mix_range:[1,1],u_trim_color:i.paint.get("line-trim-color").toPremultipliedRenderColor(w?null:i.lut).toArray01(),u_zbias_factor:S,u_tile_to_meter:Cn(e.tileID.canonical,0),u_ground_shadow_factor:g}},U.da=cu,U.db=Jt,U.dc=function(r){const e=r.indexOf(Co);return e>=0?r.slice(0,e):r},U.dd=dv,U.de=function(r){return r.includes(Co)},U.df=function(r){const e=r.lastIndexOf(Co);return e>=0?r.slice(e+1):""},U.dg=function(r){const e=[],i=r.id;return i===void 0&&e.push({message:`layers.${i}: missing required property "id"`}),r.render===void 0&&e.push({message:`layers.${i}: missing required method "render"`}),r.renderingMode&&r.renderingMode!=="2d"&&r.renderingMode!=="3d"&&e.push({message:`layers.${i}: property "renderingMode" must be either "2d" or "3d"`}),e},U.dh=function(r,e,i,n){return r.type==="custom"?new tT(r,e):new oT[r.type](r,e,i,n)},U.di=Ct,U.dj=Wu,U.dk=nm,U.dl=class extends Kc{constructor(r,e){super(r._vectorTileFeature,r._z,r._x,r._y,r.id),r.state&&(this.state=Object.assign({},r.state)),this.target=e.target,this.namespace=e.namespace,e.properties&&(this.properties=e.properties),this.target&&("featuresetId"in this.target&&!this.target.importId||"layerId"in this.target)&&(this.source=r.source,this.sourceLayer=r.sourceLayer,this.layer=r.layer)}toJSON(){const r=super.toJSON();return r.target=this.target,r.namespace=this.namespace,r}},U.dm=Hu,U.dn=function(r){return r({pluginStatus:Wr,pluginURL:so}),Hu.on("pluginStateChange",r),r},U.dp=ym,U.dq=class extends Do{constructor(r){super(r),this.current=new Float32Array(9)}set(r,e,i){if(!this.fetchUniformLocation(r,e))return;const n=this.current;for(let s=0;s<9;s++)if(i[s]!==n[s]){n.set(i),this.gl.uniformMatrix3fv(this.location,!1,n);break}}},U.dr=le,U.ds=function(r,e,i){const n=oi(i.zoom),s=r.style.map._antialias,l=r.terrain&&r.terrain.exaggeration()>0;return n===0&&!s&&!l},U.dt=function(r){const e=r.pixelsPerMeter,i=e/Yr(1,r.center.lat),n=Ot(new Float64Array(16));return Cr(n,n,[r.point.x,r.point.y,0]),Br(n,n,[i,i,e]),Float32Array.from(n)},U.du=it,U.dv=function(r){const e=80.051129;r=re(r,-80.051129,e)/e*90;const i=Math.pow(Math.abs(Math.sin(V(r))),3);return Math.round(i*(lh.length-1))},U.dw=function(r,e,i,n){const s=e.getNorth(),l=e.getSouth(),u=e.getWest(),f=e.getEast(),p=1<<r.z,g=f-u,x=s-l,b=g/Cl,w=-x/lh[i],S=[0,b,0,w,0,0,s,u,0];if(r.z>0){const E=180/n;ms(S,S,[E/g+1,0,0,0,E/x+1,0,-.5*E/b,.5*E/w,1])}return S[2]=p,S[5]=r.x,S[8]=r.y,S},U.dx=_t,U.dy=je,U.dz=function(r,e,i){const n=Ot(new Float64Array(16)),s=(e/(1<<r)-.5)*Math.PI*2;return Go(n,i.globeMatrix,s),Float32Array.from(n)},U.e=function(r){return r.indexOf("mapbox:")===0},U.e$=Gg,U.e0=Xt,U.e1=Kd,U.e2=be,U.e3=Wm,U.e4=Tx,U.e5=Oa,U.e6=450,U.e7=7,U.e8=Da,U.e9=function(r,e){if(r===e){var i=e[1],n=e[2],s=e[3],l=e[6],u=e[7],f=e[11];r[1]=e[4],r[2]=e[8],r[3]=e[12],r[4]=i,r[6]=e[9],r[7]=e[13],r[8]=n,r[9]=l,r[11]=e[14],r[12]=s,r[13]=u,r[14]=f}else r[0]=e[0],r[1]=e[4],r[2]=e[8],r[3]=e[12],r[4]=e[1],r[5]=e[5],r[6]=e[9],r[7]=e[13],r[8]=e[2],r[9]=e[6],r[10]=e[10],r[11]=e[14],r[12]=e[3],r[13]=e[7],r[14]=e[11],r[15]=e[15];return r},U.eA=function(r,e){var i=2*Math.acos(e[3]),n=Math.sin(i/2);return n>sn?(r[0]=e[0]/n,r[1]=e[1]/n,r[2]=e[2]/n):(r[0]=1,r[1]=0,r[2]=0),i},U.eB=Cy,U.eC=r_,U.eD=i_,U.eE=[1,1,1],U.eF=wh,U.eG=function(r,e,i,n){var s=e[0],l=e[1],u=e[2],f=e[3];return r[0]=s+n*(i[0]-s),r[1]=l+n*(i[1]-l),r[2]=u+n*(i[2]-u),r[3]=f+n*(i[3]-f),r},U.eH=fh,U.eI=en,U.eJ=class{constructor(){this._updateTime=0,this._sourceIds=[],this._activeRegions=[],this._prevRegions=[],this._globalClipBounds={min:new Ue(1/0,1/0),max:new Ue(-1/0,-1/0)}}clear(){this._activeRegions.length>0&&++this._updateTime,this._activeRegions=[],this._prevRegions=[]}get updateTime(){return this._updateTime}getReplacementRegionsForTile(r,e=!1){const i=hx(new Ue(0,0),new Ue(Xe,Xe),r),n=[];if(e&&!Rg(i,this._globalClipBounds))return n;for(const s of this._activeRegions){if(s.hiddenByOverlap||!Rg(i,s))continue;const l=Zb(s.min,s.max,r);n.push({min:l.min,max:l.max,sourceId:this._sourceIds[s.priority],footprint:s.footprint,footprintTileId:s.tileId,order:s.order,clipMask:s.clipMask,clipScope:s.clipScope})}return n}setSources(r){this._setSources(r.map(e=>({getSourceId:()=>e.cache.id,getFootprints:()=>{const i=[];for(const n of e.cache.getVisibleCoordinates()){const s=e.cache.getTile(n).buckets[e.layer];s&&s.updateFootprints(n.toUnwrapped(),i)}return i},getOrder:()=>e.order,getClipMask:()=>e.clipMask,getClipScope:()=>e.clipScope})))}_addSource(r){const e=r.getFootprints();if(e.length===0)return;const i=r.getOrder(),n=r.getClipMask(),s=r.getClipScope();for(const l of e){if(!l.footprint)continue;const u=hx(l.footprint.min,l.footprint.max,l.id);this._activeRegions.push({min:u.min,max:u.max,hiddenByOverlap:!1,priority:this._sourceIds.length,tileId:l.id,footprint:l.footprint,order:i,clipMask:n,clipScope:s})}this._sourceIds.push(r.getSourceId())}_computeReplacement(){this._activeRegions.sort((e,i)=>e.priority-i.priority||Nm(e.min,i.min)||Nm(e.max,i.max)||e.order-i.order||e.clipMask-i.clipMask||(function(n,s){const l=(u,f)=>u+f;return n.length-s.length||n.reduce(l,"").localeCompare(s.reduce(l,""))})(e.clipScope,i.clipScope));let r=this._activeRegions.length!==this._prevRegions.length;if(!r){let e=0;for(;!r&&e!==this._activeRegions.length;){const i=this._activeRegions[e],n=this._prevRegions[e];r=i.priority!==n.priority||!ux(i,n)||i.order!==n.order||i.clipMask!==n.clipMask||!Wo(i.clipScope,n.clipScope),this._activeRegions[e].hiddenByOverlap=n.hiddenByOverlap,++e}}if(r){++this._updateTime;for(const i of this._activeRegions)i.order!==_f&&(this._globalClipBounds.min.x=Math.min(this._globalClipBounds.min.x,i.min.x),this._globalClipBounds.min.y=Math.min(this._globalClipBounds.min.y,i.min.y),this._globalClipBounds.max.x=Math.max(this._globalClipBounds.max.x,i.max.x),this._globalClipBounds.max.y=Math.max(this._globalClipBounds.max.y,i.max.y));const e=i=>{const n=this._activeRegions;if(i>=n.length)return i;const s=n[i].priority;for(;i<n.length&&n[i].priority===s;)++i;return i};if(this._sourceIds.length>1){let i=0,n=e(i);for(;i!==n;){let s=i;const l=i;for(;s!==n;){const u=this._activeRegions[s];u.hiddenByOverlap=!1;for(let f=0;f<l;f++){const p=this._activeRegions[f];if(!p.hiddenByOverlap&&u.order===_f&&Rg(u,p)&&(u.hiddenByOverlap=dx(u.footprint,u.tileId,p.footprint,p.tileId),u.hiddenByOverlap))break}++s}i=n,n=e(i)}}}}_setSources(r){[this._prevRegions,this._activeRegions]=[this._activeRegions,[]],this._sourceIds=[];for(let e=r.length-1;e>=0;e--)this._addSource(r[e]);this._computeReplacement()}},U.eK=Sa,U.eL=w_,U.eM=os,U.eN=_f,U.eO=class{constructor(r){this._createGrid(r),this._createPoles(r)}destroy(){this._poleIndexBuffer.destroy(),this._gridBuffer.destroy(),this._gridIndexBuffer.destroy(),this._poleNorthVertexBuffer.destroy(),this._poleSouthVertexBuffer.destroy();for(const r of this._poleSegments)r.destroy();for(const r of this._gridSegments)r.withSkirts.destroy(),r.withoutSkirts.destroy()}_fillGridMeshWithLods(r,e){const i=new Nn,n=new Ai,s=[],l=r+1+2,u=e[0]+1,f=e[0]+1+(1+e.length),p=(g,x,b)=>{let w=g===l-1?g-2:g===0?g:g-1;return w+=b?24575:0,[w,x]};for(let g=0;g<l;++g)i.emplaceBack(...p(g,0,!0));for(let g=0;g<u;++g)for(let x=0;x<l;++x)i.emplaceBack(...p(x,g,(x===0||x===l-1)&&!0));for(let g=0;g<e.length;++g){const x=e[g];for(let b=0;b<l;++b)i.emplaceBack(...p(b,x,!0))}for(let g=0;g<e.length;++g){const x=n.length,b=e[g]+1+2,w=new Ai;for(let M=0;M<b-1;M++){const C=M===b-2,R=C?l*(f-e.length+g-M):l;for(let F=0;F<l-1;F++){const z=M*l+F;M===0||C||F===0||F===l-2?(w.emplaceBack(z+1,z,z+R),w.emplaceBack(z+R,z+R+1,z+1)):(n.emplaceBack(z+1,z,z+R),n.emplaceBack(z+R,z+R+1,z+1))}}const S=di.simpleSegment(0,x,i.length,n.length-x);for(let M=0;M<w.uint16.length;M+=3)n.emplaceBack(w.uint16[M],w.uint16[M+1],w.uint16[M+2]);const E=di.simpleSegment(0,x,i.length,n.length-x);s.push({withoutSkirts:S,withSkirts:E})}return{vertices:i,indices:n,segments:s}}_createGrid(r){const e=this._fillGridMeshWithLods(Cl,lh);this._gridSegments=e.segments,this._gridBuffer=r.createVertexBuffer(e.vertices,pe.members),this._gridIndexBuffer=r.createIndexBuffer(e.indices,!0)}_createPoles(r){const e=new Ai;for(let u=0;u<=Cl;u++)e.emplaceBack(0,u+1,u+2);this._poleIndexBuffer=r.createIndexBuffer(e,!0);const i=new Ia,n=new Ia,s=new Ia,l=new Ia;this._poleSegments=[];for(let u=0,f=0;u<6;u++){const p=360/(1<<u);i.emplaceBack(0,-Lr,0,.5,0),n.emplaceBack(0,-Lr,0,.5,1),s.emplaceBack(0,-Lr,0,.5,.5),l.emplaceBack(0,-Lr,0,.5,.5);for(let g=0;g<=Cl;g++){let x=g/Cl,b=0;const w=ft(0,p,x),[S,E,M]=Bs(At,ai,w,Lr);i.emplaceBack(S,E,M,x,b),n.emplaceBack(S,E,M,x,1-b);const C=V(w);x=.5+.5*Math.sin(C),b=.5+.5*Math.cos(C),s.emplaceBack(S,E,M,x,b),l.emplaceBack(S,E,M,x,1-b)}this._poleSegments.push(di.simpleSegment(f,0,66,64)),f+=66}this._poleNorthVertexBuffer=r.createVertexBuffer(i,fe,!1),this._poleSouthVertexBuffer=r.createVertexBuffer(n,fe,!1),this._texturedPoleNorthVertexBuffer=r.createVertexBuffer(s,fe,!1),this._texturedPoleSouthVertexBuffer=r.createVertexBuffer(l,fe,!1)}getGridBuffers(r,e){return[this._gridBuffer,this._gridIndexBuffer,e?this._gridSegments[r].withSkirts:this._gridSegments[r].withoutSkirts]}getPoleBuffers(r,e){return[e?this._texturedPoleNorthVertexBuffer:this._poleNorthVertexBuffer,e?this._texturedPoleSouthVertexBuffer:this._poleSouthVertexBuffer,this._poleIndexBuffer,this._poleSegments[r]]}},U.eP=qb,U.eQ=ce,U.eR=function(){return!!document.fullscreenElement||!!document.webkitFullscreenElement},U.eS=we,U.eT=vm,U.eU=function(r,e,i){return r[0]=e[0]/i[0],r[1]=e[1]/i[1],r[2]=e[2]/i[2],r},U.eV=ja,U.eW=zo,U.eX=Jl,U.eY=Ti,U.eZ=function([r,e,i]){const n=Math.hypot(r,e,i),s=Math.atan2(r,i),l=.5*Math.PI-Math.acos(-e/n);return new Zt(X(s),X(l))},U.e_=qo,U.ea=Rt,U.eb=Il,U.ec=256,U.ed=function(r){return r>>>=0,r=Math.imul(2747636419^r,2654435769)>>>0,r=Math.imul(r^r>>>16,2654435769)>>>0,(r=Math.imul(r^r>>>16,2654435769)>>>0)/4294967296},U.ee=Os,U.ef=ld,U.eg=Pa,U.eh=Un,U.ei=tn,U.ej=eT,U.ek=at,U.el=Bt,U.em=En,U.en=function(r,e){var i=Math.sin(e),n=Math.cos(e);return r[0]=n,r[1]=0,r[2]=-i,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=i,r[9]=0,r[10]=n,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r},U.eo=function(r,e){var i=Math.sin(e),n=Math.cos(e);return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=n,r[6]=i,r[7]=0,r[8]=0,r[9]=-i,r[10]=n,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r},U.ep=function(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[4],r[4]=e[5],r[5]=e[6],r[6]=e[8],r[7]=e[9],r[8]=e[10],r},U.eq=Ia,U.er=Gd,U.es=function(r,e,i,n,s){return re((r-e)/(i-e)*(s-n)+n,n,s)},U.et=ta,U.eu=function(r,e){var i=e[0],n=e[1],s=e[2],l=e[3],u=e[4],f=e[5],p=e[6],g=e[7],x=e[8],b=x*u-f*g,w=-x*l+f*p,S=g*l-u*p,E=i*b+n*w+s*S;return E?(r[0]=b*(E=1/E),r[1]=(-x*n+s*g)*E,r[2]=(f*n-s*u)*E,r[3]=w*E,r[4]=(x*i-s*p)*E,r[5]=(-f*i+s*l)*E,r[6]=S*E,r[7]=(-g*i+n*p)*E,r[8]=(u*i-n*l)*E,r):null},U.ev=2,U.ew=Kn,U.ex=ys,U.ey=ql,U.ez=function(r,e){var i=new ji(3);ql(i,e);var n=1/i[0],s=1/i[1],l=1/i[2],u=e[0]*n,f=e[1]*s,p=e[2]*l,g=e[4]*n,x=e[5]*s,b=e[6]*l,w=e[8]*n,S=e[9]*s,E=e[10]*l,M=u+x+E,C=0;return M>0?(C=2*Math.sqrt(M+1),r[3]=.25*C,r[0]=(b-S)/C,r[1]=(w-p)/C,r[2]=(f-g)/C):u>x&&u>E?(C=2*Math.sqrt(1+u-x-E),r[3]=(b-S)/C,r[0]=.25*C,r[1]=(f+g)/C,r[2]=(w+p)/C):x>E?(C=2*Math.sqrt(1+x-u-E),r[3]=(w-p)/C,r[0]=(f+g)/C,r[1]=.25*C,r[2]=(b+S)/C):(C=2*Math.sqrt(1+E-u-x),r[3]=(f-g)/C,r[0]=(w+p)/C,r[1]=(b+S)/C,r[2]=.25*C),r},U.f=ws,U.f0=function(r){const e=r.navigator?r.navigator.userAgent:null;return!!(function(i){if(_i==null){const n=i.navigator?i.navigator.userAgent:null;_i=!!i.safari||!(!n||!(_e.test(n)||n.match("Safari")&&!n.match("Chrome")))}return _i})(r)&&!(!e||!(e.match("Version/15.4")||e.match("Version/15.5")||e.match(B)))},U.f1=function(r,e){Xf=r,Yf=e},U.f2=$t,U.f3=si,U.f4=function(r){const e=[0,0,0],i=Ot(new Float64Array(16));return gi(i,r.pixelMatrix,r.globeMatrix),Pi(e,e,i),new Ue(e[0],e[1])},U.f5=function(r,e){if(!r||!e)throw new Error("TileProvider name and URL are required");fi.TILE_PROVIDER_URLS[r]=un.resolveURL(e)},U.f6=Md,U.f7=function(r,e,i=!1){if(Wr===pn.deferred||Wr===pn.loading||Wr===pn.loaded)throw new Error("setRTLTextPlugin cannot be called multiple times.");so=un.resolveURL(r),Wr=pn.deferred,Ds=e,bl(),i||Qp()},U.f8=aa,U.f9=sa,U.fA=s_,U.fB=tf,U.fC=function(r){return r<=1?1:Math.pow(2,Math.floor(Math.log2(r)))},U.fD=C_,U.fE=Ns,U.fF=function(r){let e=0;if(new Uint32Array(r,0,1)[0]!==$x){const i=new Uint32Array(r,0,7),[,,n,s,l,u]=i;e=i.byteLength+s+l+u+l,(n!==r.byteLength||e>=r.byteLength)&&Pt("Invalid b3dm header information.")}return Wx(r,e)},U.fG=function(r,e){const i=r.json.extensionsUsed&&r.json.extensionsUsed.includes("mbx_bvh"),n=Yg(r);for(const s of n){if(!i)for(const l of s.meshes)T1(l);s.lights&&(s.lightMeshIndex=s.meshes.length,s.meshes.push(S1(s.lights,e)))}return n},U.fH=A_,U.fI=ti,U.fJ=ao,U.fK=pn,U.fL=function(r){ou(),Xo?.then(e=>{e.keys().then(i=>{for(let n=0;n<i.length-r;n++)e.delete(i[n]).catch(s=>Pt(s.message))}).catch(i=>Pt(i.message))}).catch(e=>Pt(e.message))},U.fa=bs,U.fb=function(r){const e=rc();if(!e)return;const i=e.delete(Wf);r&&i.then(()=>r()).catch(r)},U.fc=et,U.fd=Fr,U.fe=2,U.ff=xu,U.fg=Yc,U.fh=Aa,U.fi=N0,U.fj=U0,U.fk=fv,U.fl=Ra,U.fm="hd_road_elevation",U.fn=a,U.fo=Ne,U.fp=Bm,U.fq=La,U.fr=hy,U.fs=1,U.ft=Fo,U.fu=function(r,e,i,n,s,l,u,f=1,p,g,x,b){r.createArrays(),r.tilePixelRatio=Xe/(512*r.overscaling),r.compareText={},r.iconsNeedLinear=!1;const w=r.layers[0].layout,S=r.layers[0]._unevaluatedLayout._values,E={};E.scaleFactor=f,E.textSizeScaleRange=w.get("text-size-scale-range"),E.iconSizeScaleRange=w.get("icon-size-scale-range");const[M,C]=E.textSizeScaleRange,[R,F]=E.iconSizeScaleRange;E.textScaleFactor=re(E.scaleFactor,M,C),E.iconScaleFactor=re(E.scaleFactor,R,F);const z=S["text-size"],j=S["icon-size"];if(r.textSizeData.kind==="composite"){const{minZoom:Y,maxZoom:ee}=r.textSizeData;E.compositeTextSizes=[z.possiblyEvaluate(new Wt(Y,{worldview:x}),l),z.possiblyEvaluate(new Wt(ee,{worldview:x}),l)]}if(r.iconSizeData.kind==="composite"){const{minZoom:Y,maxZoom:ee}=r.iconSizeData;E.compositeIconSizes=[j.possiblyEvaluate(new Wt(Y,{worldview:x}),l,b),j.possiblyEvaluate(new Wt(ee,{worldview:x}),l,b)]}E.layoutTextSize=z.possiblyEvaluate(new Wt(u+1,{worldview:x}),l),E.layoutIconSize=j.possiblyEvaluate(new Wt(u+1,{worldview:x}),l,b),E.textMaxSize=z.possiblyEvaluate(new Wt(18,{worldview:x}),l);const $=w.get("symbol-placement"),q=w.get("text-rotation-alignment")==="map"&&$!=="point",ie=w.get("text-size");let W=!1;const Q=[];for(const Y of r.features){const ee=w.get("text-font").evaluate(Y,{},l).join(","),me=ie.evaluate(Y,{},l)*E.textScaleFactor,ge=E.layoutTextSize.evaluate(Y,{},l)*E.textScaleFactor,Te=E.layoutIconSize.evaluate(Y,{},l,b)*E.iconScaleFactor,Ae={horizontal:{},vertical:void 0},Ie=Y.text;let Fe,xe=[0,0];if(Ie){const Mt=Ie.toString(),Oi=w.get("text-letter-spacing").evaluate(Y,{},l)*dr,Yt=w.get("text-line-height").evaluate(Y,{},l)*dr,jt=Wp(Mt)?Oi:0,ci=w.get("text-anchor").evaluate(Y,{},l),Si=w.get("text-variable-anchor");if(!Si){const Qi=w.get("text-radial-offset").evaluate(Y,{},l);if(Qi)xe=Kv(ci,[Qi*dr,_y]);else{const rr=w.get("text-offset").evaluate(Y,{},l);xe=[rr[0]*dr,rr[1]*dr]}}let fr=q?"center":w.get("text-justify").evaluate(Y,{},l);const mi=$==="point",Fi=mi?w.get("text-max-width").evaluate(Y,{},l)*dr:1/0,ir=Qi=>{r.allowVerticalPlacement&&Id(Mt)&&(Ae.vertical=ny(Ie,e,i,s,ee,Fi,Yt,ci,Qi,jt,xe,zn.vertical,!0,ge,me,p,E.textScaleFactor))};if(!q&&Si){const Qi=fr==="auto"?Si.map(zt=>gy(zt)):[fr];let rr=!1;for(let zt=0;zt<Qi.length;zt++){const Er=Qi[zt];if(!Ae.horizontal[Er])if(rr)Ae.horizontal[Er]=Ae.horizontal[0];else{const Qr=ny(Ie,e,i,s,ee,Fi,Yt,"center",Er,jt,xe,zn.horizontal,!1,ge,me,p,E.textScaleFactor);Qr&&(Ae.horizontal[Er]=Qr,rr=Qr.positionedLines.length===1)}}ir("left")}else{if(fr==="auto"&&(fr=gy(ci)),mi||w.get("text-writing-mode").includes("horizontal")||!Id(Mt)){const Qi=ny(Ie,e,i,s,ee,Fi,Yt,ci,fr,jt,xe,zn.horizontal,!1,ge,me,p,E.textScaleFactor);Qi&&(Ae.horizontal[fr]=Qi)}ir(mi?"left":fr)}}let Se,Me,ze,Le,We,De,Ge=!1;const $e=w.get("icon-text-fit").evaluate(Y,{},l);if(Y.icon&&Y.icon.hasPrimary()){const Mt=Pf(Y.icon,r.iconSizeData,S["icon-size"],l,r.zoom,Y,p,E.iconScaleFactor,x,b);Se=Mt.iconPrimary,ze=Mt.iconSecondary;const Oi=Se.toString();if(Me=n.get(Oi),Me&&(We=w.get("icon-offset").evaluate(Y,{},l),De=w.get("icon-anchor").evaluate(Y,{},l),Fe=c_(s.get(Oi),ze?s.get(ze.toString()):void 0,We,De),Ge=Me.sdf,r.sdfIcons===void 0?r.sdfIcons=Me.sdf:r.sdfIcons!==Me.sdf&&Pt("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(Me.pixelRatio!==r.pixelRatio||w.get("icon-rotate").constantOr(1)!==0)&&(r.iconsNeedLinear=!0)),ze){const Yt=ze.toString();Le=n.get(Yt)}}W=W||!(!Y.icon||!Y.icon.hasSecondary());const Je=__(Ae.horizontal)||Ae.vertical;r.iconsInText||(r.iconsInText=!!Je&&Je.iconsInText);const Qe=ge*E.textScaleFactor/dr,{defaultShapedIcon:ct,verticallyShapedIcon:nt}=Nw(r,Fe,w,Y,l,Ae,Qe,We,$e);$e!=="none"&&Fe&&(Lv(Fe)||Ov(Fe))&&(m_(0,Me,Se,Fe,ct,$e,g,n,s),m_(0,Le,ze,Fe,ct,$e,g,n,s),nt&&(m_(0,Me,Se,Fe,nt,$e,g,n,s),m_(0,Le,ze,Fe,nt,$e,g,n,s))),Fe=ct;const{iconBBox:mt,iconVerticalBBox:Gt,textBBox:wt,textVerticalBBox:kt}=Lw(r,Fe,nt,w,Y,l,Te,We,E,s,De,Ae,ge,xe,b);Q.push({feature:Y,shapedTextOrientations:Ae,shapedText:Je,shapedIcon:Fe,iconPrimary:Se,iconSecondary:ze,iconOffset:We,iconAnchor:De,verticallyShapedIcon:nt,layoutTextSize:ge,layoutIconSize:Te,textOffset:xe,isSDFIcon:Ge,iconTextFit:$e,iconCollisionBounds:mt,iconVerticalCollisionBounds:Gt,textCollisionBounds:wt,textVerticalCollisionBounds:kt})}return{featureData:Q,sizes:E,hasAnySecondaryIcon:W,textAlongLine:q,symbolPlacement:$}},U.fv=dy,U.fw=uy,U.fx=$v,U.fy=Hv,U.fz=function(r,e,i,n,s,l,u,f,p,g){r.iconAtlasPositions=g.iconPositions;const{featureData:x,hasAnySecondaryIcon:b,sizes:w,textAlongLine:S,symbolPlacement:E}=e;for(const M of x){const{shapedIcon:C,verticallyShapedIcon:R,feature:F,shapedTextOrientations:z,shapedText:j,layoutTextSize:$,textOffset:q,isSDFIcon:ie,iconPrimary:W,iconSecondary:Q,iconTextFit:Y,iconOffset:ee,iconCollisionBounds:me,iconVerticalCollisionBounds:ge,textCollisionBounds:Te}=M;i0(C,g.iconPositions,W,Q),i0(R,g.iconPositions,W,Q),kw(z,g.iconPositions),Bw(W,Q,g.iconPositions),(j||C)&&Uw(r,F,z,C,R,p,w,$,0,q,ie,n,s,u,f,b,Y,ee,S,E,me,ge,Te)}i&&r.generateCollisionDebugBuffers(l,r.collisionBoxArray,w.textScaleFactor)},U.g=fi,U.h=function(r,e){return oc(Object.assign(r,{method:"GET"}),e)},U.i=function(r){return fi.API_STYLE_REGEX.test(r)&&!Wa(r)},U.j=function(r){return btoa(encodeURIComponent(r).replace(/%([0-9A-F]{2})/g,(e,i)=>String.fromCharCode(+("0x"+i))))},U.k=Rh,U.l=function(r){return decodeURIComponent(atob(r).split("").map(e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)).join(""))},U.m=Fh,U.n=Bh,U.o=un,U.p=function(r,e){return oc(Object.assign(r,{method:"POST"}),e)},U.q=Ht,U.r=vo,U.s=function(r){try{const e=self[r];return e.setItem("_mapbox_test_",1),e.removeItem("_mapbox_test_"),!0}catch{return!1}},U.t=Rd,U.u=function(){return(function r(e){return e?(e^Math.random()*(16>>e/4)).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,r)})()},U.v=function(r){return!!r&&Za.test(r)},U.w=Pt,U.x=class{constructor(r){this.cache=new Map,this.textures=new Map,this.textureAccessTimes=new Map,this.textureMemoryUsed=0,this.maxTextureMemory=1024*(r&&r.maxTextureMemoryMB?r.maxTextureMemoryMB:256)*1024,this.finalizationRegistry=new FinalizationRegistry(e=>{this.cache.delete(e),this.clearExpiredTextures()})}calculateTextureMemory(r){return r.image?Math.ceil(r.image.width*r.image.height*4*(r.patternPositions.size>0?1.33:1)):0}evictTexture(r){const e=this.textures.get(r);if(e){const i=this.calculateTextureMemory(r);e.destroy(),this.textures.delete(r),this.textureAccessTimes.delete(r),this.textureMemoryUsed-=i,r.uploaded=!1}}evictTexturesIfNeeded(r){for(;this.textureMemoryUsed+r>this.maxTextureMemory&&this.textures.size>0;){let e=null,i=1/0;for(const[n]of this.textures.entries()){const s=this.textureAccessTimes.get(n)||0;s<i&&(i=s,e=n)}if(!e)break;this.evictTexture(e)}}findCachedAtlas(r){const e=this.cache.get(r.hash);if(e){const i=e.deref();if(i&&i.contentDescriptor&&this.isMipmapCompatible(r,i.contentDescriptor))return i}for(const[,i]of this.cache.entries()){const n=i.deref();if(n&&n.contentDescriptor){const s=r.subsetOf(n.contentDescriptor),l=this.isMipmapCompatible(r,n.contentDescriptor);if(s&&l)return n}}}getTextureForAtlas(r,e,i){this.textureAccessTimes.set(r,performance.now());let n=this.textures.get(r);if(n)return n;if(r.image){const s=this.calculateTextureMemory(r);return this.evictTexturesIfNeeded(s),n=new Gs(e,r.image,i,{useMipmap:!!r.patternPositions.size}),this.textures.set(r,n),this.textureMemoryUsed+=s,n}return null}clearExpiredTextures(){for(const[r]of this.textures.entries())if(!this.isAtlasCached(r)){const e=this.textures.get(r);if(e){const i=this.calculateTextureMemory(r);e.destroy(),this.textureMemoryUsed-=i}this.textures.delete(r),this.textureAccessTimes.delete(r)}}isAtlasCached(r){if(!r.contentDescriptor)return!1;const e=this.cache.get(r.contentDescriptor.hash);return!!e&&e.deref()===r}getOrCache(r){if(!("image"in r)){const s=this.cache.get(r.sourceAtlasHash);if(s){const l=s.deref();if(l)return l}return Pt("ImageAtlasReference points to GC'd atlas - atlas may have been evicted"),null}if(!r.contentDescriptor)return r;const e=r.contentDescriptor,i=e.hash,n=this.cache.get(i);if(n){const s=n.deref();if(s&&s.contentDescriptor&&this.isMipmapCompatible(e,s.contentDescriptor))return s}return this.cache.set(i,new WeakRef(r)),this.finalizationRegistry.register(r,i,r),r}isMipmapCompatible(r,e){return!r.requiresMipMaps||e.requiresMipMaps}destroyTextures(){for(const r of this.textures.values())r&&r.destroy();this.textures.clear(),this.textureAccessTimes.clear(),this.textureMemoryUsed=0}clear(){for(const r of this.textures.values())r&&r.destroy();this.cache.clear(),this.textures.clear(),this.textureAccessTimes.clear(),this.textureMemoryUsed=0}},U.y=Qa,U.z=io}),Gl(["require","./shared"],function(h,U){function sn(_e){const B=_e?_e.url.toString():void 0;return B?performance.getEntriesByName(B):[]}function ji(_e){if(typeof _e=="number"||typeof _e=="boolean"||typeof _e=="string"||_e==null)return JSON.stringify(_e);if(Array.isArray(_e)){let V="[";for(const X of _e)V+=`${ji(X)},`;return`${V}]`}let B="{";for(const V of Object.keys(_e).sort())B+=`${V}:${ji(_e[V])},`;return`${B}}`}function eu(_e){let B="";for(const V of U.b8)B+=`/${ji(_e[V])}`;return B}function $l(_e,B){return(function V(X){return typeof X=="string"&&X===B||(Array.isArray(X)?X.some(V):!(!X||typeof X!="object")&&Object.values(X).some(V))})(_e)}class ps{constructor(B){this.keyCache=Object.create(null),this._layers=Object.create(null),this._layerConfigs=Object.create(null),B&&this.replace(B)}replace(B,V){this._layerConfigs=Object.create(null),this._layers=Object.create(null),this.update(B,[],V)}update(B,V,X){this._options=X;for(const le of B)this._layerConfigs[le.id]=le,(this._layers[le.id]=U.dh(le,this.scope,null,this._options)).compileFilter(X),this.keyCache[le.id]&&delete this.keyCache[le.id];for(const le of V)delete this.keyCache[le],delete this._layerConfigs[le],delete this._layers[le];this.familiesBySource=Object.create(null);const ae=(function(le,ce){const we=Object.create(null);for(let ye=0;ye<le.length;ye++){const Ve=le[ye];let Oe=ce&&ce[Ve.id];Oe||(Ve.type==="symbol"?Oe=Ve.id:(Oe=eu(Ve),Ve.type==="line"&&Ve.paint&&$l(Ve.paint["line-width"],"line-progress")&&(Oe+=`/${ji(Ve.paint["line-width"])}`))),ce&&(ce[Ve.id]=Oe);let Ke=we[Oe];Ke||(Ke=we[Oe]=[]),Ke.push(Ve)}const re=[];for(const ye in we)re.push(we[ye]);return re})(Object.values(this._layerConfigs),this.keyCache);for(const le of ae){const ce=le.map(Ke=>this._layers[Ke.id]),we=ce[0];if(we.visibility==="none")continue;const re=we.source||"";let ye=this.familiesBySource[re];ye||(ye=this.familiesBySource[re]=Object.create(null));const Ve=we.sourceLayer||"_geojsonTileLayer";let Oe=ye[Ve];Oe||(Oe=ye[Ve]=[]),Oe.push(ce)}}}const ms=1*U.fe;class Na{constructor(B){const V={},X=[];for(const we in B){const re=B[we],ye=V[we]={};for(const Ve in re.glyphs){const Oe=re.glyphs[+Ve];if(!Oe||Oe.bitmap.width===0||Oe.bitmap.height===0)continue;const Ke=Oe.metrics.localGlyph?ms:1,ut={x:0,y:0,w:Oe.bitmap.width+2*Ke,h:Oe.bitmap.height+2*Ke};X.push(ut),ye[Ve]=ut}}const{w:ae,h:le}=U.F(X),ce=new U.fd({width:ae||1,height:le||1});for(const we in B){const re=B[we];for(const ye in re.glyphs){const Ve=re.glyphs[+ye];if(!Ve||Ve.bitmap.width===0||Ve.bitmap.height===0)continue;const Oe=V[we][ye],Ke=Ve.metrics.localGlyph?ms:1;U.fd.copy(Ve.bitmap,ce,{x:0,y:0},{x:Oe.x+Ke,y:Oe.y+Ke},Ve.bitmap)}}this.image=ce,this.positions=V}}function Hl(_e,B,V){_e[B]?V&&(_e[B].center=V):_e[B]={floorIds:new Set,center:V||[0,0],floors:{}}}function Ot(_e,B,V,X){for(const ae of B)Hl(_e,ae),_e[ae].floors[V]=X,_e[ae].floorIds.add(V)}function an(_e){return{id:_e.properties.id.toString(),center:[_e.properties.center_lon||0,_e.properties.center_lat||0]}}function gi(_e,B){const V=_e.properties.id.toString(),X=!!_e.properties.is_default&&_e.properties.is_default,ae=_e.properties.connected_floor_ids?new Set(_e.properties.connected_floor_ids.toString().split(";")):new Set,le=_e.properties.conflicted_floor_ids?new Set(_e.properties.conflicted_floor_ids.toString().split(";")):new Set,ce=_e.properties.structure_ids?new Set(_e.properties.structure_ids.toString().split(";")):new Set,we=_e.properties.name.toString(),re=_e.properties.z_index,ye=(function(Ve,Oe){const Ke=Ve.loadGeometry();if(!Ke||Ke.length===0)return;const ut=Ke.map(dt=>dt.map(Dt=>U.ff(Dt,Oe,Ve.extent)));return ut.length===0?void 0:{type:"Polygon",coordinates:[ut[0]]}})(_e,B);return{id:V,isDefault:X,connections:ae,conflicts:le,buildings:ce,name:we,zIndex:re,geometry:ye}}function Cr(_e,B){return B.every(V=>_e.properties&&_e.properties[V]!=null)}function Br(_e){return Cr(_e,["type","id","name"])&&_e.properties.type==="structure"}function jo(_e){return Cr(_e,["type","id","name","z_index"])&&_e.properties.type==="floor"}U.fc(Na,"GlyphAtlas");class Go{constructor(B){this.tileID=new U.aU(B.tileID.overscaledZ,B.tileID.wrap,B.tileID.canonical.z,B.tileID.canonical.x,B.tileID.canonical.y),this.tileZoom=B.tileZoom,this.uid=B.uid,this.zoom=B.zoom,this.lut=B.lut,this.canonical=B.tileID.canonical,this.pixelRatio=B.pixelRatio,this.tileSize=B.tileSize,this.source=B.source,this.scope=B.scope,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=B.showCollisionBoxes,this.showElevationIdDebug=B.showElevationIdDebug,this.collectResourceTiming=!!B.request&&B.request.collectResourceTiming,this.promoteId=B.promoteId,this.renderSourceType=B.renderSourceType,this.tileTransform=U.fg(B.tileID.canonical,B.projection),this.projection=B.projection,this.worldview=B.worldview,this.localizableLayerIds=B.localizableLayerIds,this.brightness=B.brightness,this.extraShadowCaster=!!B.extraShadowCaster,this.tessellationStep=B.tessellationStep,this.scaleFactor=B.scaleFactor,this.worldview=B.worldview,this.indoor=B.indoor}parse(B,V,X,ae,le,ce){this.status="parsing",this.data=B,this.collisionBoxArray=new U.fh;const we=new U.fi(Object.keys(B.layers).sort()),re=new U.fj(this.tileID,this.promoteId);re.bucketLayerIDs=[];const ye={},Ve=new U.fk(256,256),Oe={featureIndex:re,iconDependencies:new Map,patternDependencies:new Map,glyphDependencies:{},lineAtlas:Ve,availableImages:X,brightness:this.brightness,scaleFactor:this.scaleFactor,showElevationIdDebug:this.showElevationIdDebug,elevationFeatures:void 0,activeFloors:void 0};this.indoor&&(Oe.activeFloors=(function(Dt,Et,Ne,Ct){const Jt=Et.indoorState.activeFloorsVisible;if(!Et.sourceLayers)return Jt?Et.indoorState.activeFloors:void 0;const Gi=(function(hi,Ii){if(!hi)return U.w("No source layers defined in indoor specification"),Ii;if(hi.size===0)return Ii;const $i=hi.difference(Ii);for(const ti of $i)U.w(`Missing source layer required in indoor specification: ${ti}`);return Ii.intersection(Ii)})(Et.sourceLayers,new Set(Object.keys(Dt.layers))),Ni=Et.indoorState,Pt=(function(hi,Ii,$i,ti,Ei){const Ui={};for(const _i of Ii){const Yi=hi.layers[_i];if(Yi)for(let Tr=0;Tr<Yi.length;Tr++){const ur=Yi.feature(Tr);if(Br(ur)){const{id:or,center:xo}=an(ur);Hl(Ui,or,xo);continue}if(jo(ur)){const or=gi(ur,Ei);Ot(Ui,or.buildings,or.id,or)}}else U.w(`indoor source layer not found: ${_i}`)}return{buildings:Ui,activeFloors:U.d3.calculate(Ui,ti,$i)}})(Dt,Gi,Ni.activeFloors,Ni.selectedFloorId,Ct);return Ne.send("setIndoorData",Pt),Jt?Pt.activeFloors:void 0})(B,this.indoor,le,this.canonical));const Ke=[],ut=V.familiesBySource[this.source];for(const Dt in ut){const Et=B.layers[Dt];if(!Et)continue;let Ne=!1,Ct=!1,Jt=!1,Gi=!1;for(const $i of ut[Dt])$i[0].type==="symbol"?Ne=!0:$i[0].type==="fill-extrusion"?Ct=!0:Jt=!0,$i[0].is3D()&&$i[0].type!=="model"&&(Gi=!0);if(this.extraShadowCaster&&!Gi||this.renderSourceType===U.b7.Symbol&&!Ne||this.renderSourceType===U.b7.FillExtrusion&&!Ct||this.renderSourceType===U.b7.Other&&!Jt)continue;Et.version===1&&U.w(`Vector tile source "${this.source}" layer "${Dt}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const Ni=we.encode(Dt),Pt=[],hi=this.localizableLayerIds&&this.localizableLayerIds.has(Dt);let Ii=!1;for(let $i=0,ti=0;$i<Et.length;$i++){const Ei=Et.feature($i),Ui=re.getId(Ei,Dt),_i=Ei.properties?Ei.properties.worldview:null;if(hi&&this.worldview&&typeof _i=="string")if(_i==="all")Ei.properties.$localized=!0;else{if(!_i.split(",").includes(this.worldview))continue;Ei.properties.$localized=!0,Ei.properties.worldview=this.worldview}!Ii&&Ei.properties&&Object.hasOwn(Ei.properties,U.fl)&&(Ii=!0),Pt.push({feature:Ei,id:Ui,index:ti,sourceLayerIndex:Ni}),ti++}Ii&&!Oe.elevationFeatures&&Object.hasOwn(B.layers,U.fm)&&(Oe.elevationFeatures=U.fn.parseFrom(B.layers[U.fm],this.canonical));for(const $i of ut[Dt]){const ti=$i[0];if(this.extraShadowCaster&&(!ti.is3D()||ti.type==="model")||this.renderSourceType===U.b7.Symbol&&ti.type!=="symbol"||this.renderSourceType===U.b7.FillExtrusion&&ti.type!=="fill-extrusion"||this.renderSourceType===U.b7.Other&&(ti.type==="symbol"||ti.type==="fill-extrusion")||ti.minzoom&&this.zoom<Math.floor(ti.minzoom)||ti.maxzoom&&this.zoom>=ti.maxzoom||ti.visibility==="none")continue;Yn($i,this.zoom,Oe.brightness,X,this.worldview,Oe.activeFloors);const Ei=()=>{const Ui=ye[ti.id]=ti.createBucket({index:re.bucketLayerIDs.length,layers:$i,zoom:this.zoom,lut:this.lut,canonical:this.canonical,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:Ni,sourceID:this.source,projection:this.projection.spec,tessellationStep:this.tessellationStep,styleDefinedModelURLs:ae,worldview:this.worldview,localizable:hi,availableImages:X,maxUniformBufferBindings:this.maxUniformBufferBindings,maxUniformBlockSizeDwords:this.maxUniformBlockSizeDwords,disableSymbolUBO:this.disableSymbolUBO});re.bucketLayerIDs.push($i.map(_i=>U.t(_i.id,_i.scope))),Ui.populate(Pt,Oe,this.tileID.canonical,this.tileTransform)};if("prepare"in ti){const Ui=ti.prepare().then(()=>Ei());Ke.push(Ui)}else Ei()}}const dt=()=>{Ve.trim();const Dt=!(!Oe.elevationFeatures||!Oe.elevationFeatures.some(ti=>ti.heightRange.min<0));let Et,Ne,Ct,Jt,Gi,Ni,Pt;const hi={type:"maybePrepare",renderSourceType:this.renderSourceType,zoom:this.zoom},Ii=()=>
7{if(Et)return this.status="done",ce(Et);if(this.extraShadowCaster)this.status="done",ce(null,{buckets:Object.values(ye).filter(ti=>!ti.isEmpty()),featureIndex:re,collisionBoxArray:null,hasTunnelGeometry:Dt,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:Oe.brightness,glyphMap:null,iconMap:null,glyphPositions:null});else if(Ne&&Ct&&Jt&&Pt){const Ei=new Na(Ne),Ui=new Map;for(const[Yi,Tr]of Ct.entries()){const{imagePosition:ur}=U.fr(Yi,Tr,U.fs);Ui.set(Yi,ur)}const _i={};for(const Yi in ye){const Tr=ye[Yi];Tr instanceof U.ft&&(Yn(Tr.layers,this.zoom,Oe.brightness,X,this.worldview,Oe.activeFloors),_i[Yi]=U.fu(Tr,Ne,Ei.positions,Ct,Ui,this.tileID.canonical,this.tileZoom,this.scaleFactor,this.pixelRatio,Gi,this.worldview,X))}Gi.size||Ni.size?this.rasterizeTask=le.send("rasterizeImages",{scope:this.scope,iconTasks:Gi,patternTasks:Ni},(Yi,Tr)=>{if(!Yi)for(const[ur,or]of Tr.entries())Ct.has(ur)&&Ct.set(ur,Object.assign(Ct.get(ur),{data:or})),Jt.has(ur)&&Jt.set(ur,Object.assign(Jt.get(ur),{data:or}));$i(_i,Ei,void 0,Pt)}):$i(_i,Ei,void 0,Pt)}},$i=(ti,Ei,Ui,_i)=>{const Yi=Ct.size>0||Jt.size>0,Tr=Object.keys(ti).length>0;if(!Yi&&!Tr)return this.status="done",void ce(null,{buckets:Object.values(ye).filter(or=>!or.isEmpty()),featureIndex:re,collisionBoxArray:this.collisionBoxArray,hasTunnelGeometry:Dt,glyphAtlasImage:Ei.image,lineAtlas:Ve,imageAtlas:null,brightness:Oe.brightness});const ur=(or,xo)=>{for(const to in ye){const fi=ye[to];if(to in ti)U.fz(fi,ti[to],this.showCollisionBoxes,X,this.tileID.canonical,this.tileZoom,this.projection,this.brightness,Ct,xo);else if(fi.hasPattern&&(fi instanceof U.fA||fi instanceof U.fp||fi instanceof U.e3)){Yn(fi.layers,this.zoom,Oe.brightness,X,this.worldview,Oe.activeFloors);const bs=Object.fromEntries(xo.patternPositions);fi.addFeatures(Oe,this.tileID.canonical,bs,X,this.tileTransform,this.brightness)}}this.status="done",ce(null,{buckets:Object.values(ye).filter(to=>!to.isEmpty()),featureIndex:re,collisionBoxArray:this.collisionBoxArray,hasTunnelGeometry:Dt,glyphAtlasImage:Ei.image,lineAtlas:Ve,imageAtlas:or,brightness:Oe.brightness})};if(Yi){const or=new Map,xo=U.fv(Ct,or),to=U.fv(Jt,or),fi=new U.fw(xo,to,_i,this.lut,or);le.send("checkAtlasCache",{descriptor:fi,scope:this.scope},(bs,sa)=>{let aa,ws;if(bs&&U.w(`[Worker] Error checking atlas cache: ${bs.message}`),sa)aa=new U.fx(sa.sourceHash),ws=sa;else{const Wa=new U.fy(Ct,Jt,this.lut,_i);aa=Wa,ws=Wa}ur(aa,ws)})}else ur(null,{iconPositions:new Map,patternPositions:new Map})};if(!this.extraShadowCaster){const ti=U.fo(Oe.glyphDependencies,_i=>Object.keys(_i).map(Number));Object.keys(ti).length?le.send("getGlyphs",{uid:this.uid,stacks:ti},(_i,Yi)=>{Et||(Et=_i,Ne=Yi,Ii())},void 0,!1,hi):Ne={},Pt=new Map;const Ei=Array.from(Oe.iconDependencies.keys()).map(_i=>U.I.parse(_i)),Ui=Array.from(Oe.patternDependencies.keys()).map(_i=>U.I.parse(_i));Ei.length||Ui.length?le.send("getImages",{icons:Ei,patterns:Ui,source:this.source,scope:this.scope,tileID:this.tileID},(_i,Yi)=>{if(!Et){Et=_i,Ct=new Map,Jt=new Map,Gi=this.updateImageMapAndGetImageTaskQueue(Ct,Yi.images,Oe.iconDependencies),Ni=this.updateImageMapAndGetImageTaskQueue(Jt,Yi.images,Oe.patternDependencies);for(const[Tr,ur]of Yi.versions.entries())Pt.set(Tr,ur);Ii()}},void 0,!1,hi):(Ct=new Map,Jt=new Map,Gi=new Map,Ni=new Map)}if(Oe.elevationFeatures&&Oe.elevationFeatures.length>0){const ti=[];for(const Ui of Object.values(ye))if(Ui instanceof U.fp){const _i=Ui.getUnevaluatedPortalGraph();_i&&ti.push(_i)}const Ei=U.fq.evaluate(ti);for(const Ui of Object.values(ye))if(Ui instanceof U.fp){const _i=B.layers[we.decode(Ui.sourceLayerIndex)];Ui.setEvaluatedPortalGraph(Ei,_i,this.tileID.canonical,Oe.availableImages,Oe.brightness)}}Ii()};Ke.length>0?Promise.allSettled(Ke).then(dt).catch(ce):dt()}updateParameters(B){this.scaleFactor=B.scaleFactor,this.showCollisionBoxes=B.showCollisionBoxes,this.showElevationIdDebug=B.showElevationIdDebug,this.projection=B.projection,this.brightness=B.brightness,this.tileTransform=U.fg(B.tileID.canonical,B.projection),this.extraShadowCaster=B.extraShadowCaster,this.lut=B.lut,this.worldview=B.worldview,this.indoor=B.indoor}updateImageMapAndGetImageTaskQueue(B,V,X){const ae=new Map;for(const le of V.keys()){const ce=X.get(le)||[];for(const we of ce){const re=we.toString(),ye=V.get(we.id.toString());ye.usvg?ae.has(re)||(ae.set(re,we),B.set(re,Object.assign({},ye))):B.set(re,ye)}}return ae}cancelRasterize(){this.rasterizeTask&&this.rasterizeTask.cancel()}}
7function Yn(_e,B,V,X,ae,le){const ce=new U.ab(B,{brightness:V,worldview:ae,activeFloors:le});for(const we of _e)we.recalculate(ce,X)}class _s extends U.E{constructor({actor:B,layerIndex:V,availableImages:X,availableModels:ae,isSpriteLoaded:le,tileProvider:ce,brightness:we,maxUniformBufferBindings:re,maxUniformBlockSizeDwords:ye,disableSymbolUBO:Ve}){super(),this.actor=B,this.layerIndex=V,this.availableImages=X,this.availableModels=ae,this.loadVectorData=U.aQ,this.tileProvider=ce,this.loading={},this.loaded={},this.deduped=new U.aL(B.scheduler),this.isSpriteLoaded=le,this.scheduler=B.scheduler,this.brightness=we,this.maxUniformBufferBindings=re,this.maxUniformBlockSizeDwords=ye,this.disableSymbolUBO=Ve}loadTileData(B,V){if(!this.tileProvider)return this.loadVectorData(B,V);const X=new AbortController;return this.loadTileWithProvider(this.tileProvider,B,X,V),()=>X.abort()}async loadTileWithProvider(B,V,X,ae){const{z:le,x:ce,y:we}=V.tileID.canonical;try{const re=await B.loadTile({z:le,x:ce,y:we},{request:V.request,signal:X.signal});if(X.signal.aborted)return;if(re==null){const Ve=new Error("Tile not found");return Ve.status=404,ae(Ve)}if(re.data==null)return ae(null,null);const ye=new Map;re.expires&&ye.set("expires",re.expires),re.cacheControl&&ye.set("cache-control",re.cacheControl),ae(null,{rawData:re.data,responseHeaders:ye})}catch(re){if(X.signal.aborted)return;ae(re instanceof Error?re:new Error(String(re)))}}loadTile(B,V){const X=B.uid,ae=B&&B.request,le=ae&&ae.collectResourceTiming,ce=this.loading[X]=new Go(B);ce.maxUniformBufferBindings=this.maxUniformBufferBindings,ce.maxUniformBlockSizeDwords=this.maxUniformBlockSizeDwords,ce.disableSymbolUBO=this.disableSymbolUBO,ce.abort=this.loadTileData(B,(we,re)=>{const ye=!this.loading[X];if(delete this.loading[X],ce.cancelRasterize(),ye||we||!re)return ce.status="done",ye||(this.loaded[X]=ce),V(we);const Ve=re.rawData,Oe={},Ke=U.aR(re.responseHeaders);Ke&&Ke.expires&&(Oe.expires=Ke.expires),Ke&&Ke.cacheControl&&(Oe.cacheControl=Ke.cacheControl),ce.vectorTile=re.vectorTile||new U.fB(new U.b2(Ve));const ut=()=>{ce.parse(ce.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,(dt,Dt)=>{if(dt||!Dt)return V(dt);const Et={};if(le){const Ne=sn(ae);Ne.length>0&&(Et.resourceTiming=JSON.parse(JSON.stringify(Ne)))}V(null,Object.assign({rawTileData:Ve.slice(0),responseHeaders:re.responseHeaders},Dt,Oe,Et))})};this.isSpriteLoaded?ut():this.once("isSpriteLoaded",()=>{this.scheduler?this.scheduler.add(ut,{type:"parseTile",renderSourceType:B.renderSourceType,zoom:B.tileZoom}):ut()}),this.loaded=this.loaded||{},this.loaded[X]=ce})}reloadTile(B,V){const X=this.loaded,ae=B.uid;if(X&&X[ae]){const le=X[ae];le.updateParameters(B);const ce=(we,re)=>{const ye=le.reloadCallback;ye&&(delete le.reloadCallback,le.parse(le.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,ye)),V(we,re)};le.status==="parsing"?le.reloadCallback=ce:le.status==="done"&&(le.vectorTile?le.parse(le.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,ce):ce())}else V(null,void 0)}abortTile(B,V){const X=B.uid,ae=this.loading[X];ae&&(ae.abort&&ae.abort(),delete this.loading[X]),V()}removeTile(B,V){const X=this.loaded,ae=B.uid;X&&X[ae]&&delete X[ae],V()}}class $o{constructor(B){this.tileProvider=B.tileProvider,this.loading={}}loadTile(B,V){const X=B.uid;if(this.tileProvider){const le=new AbortController;return this.loading[X]={cancel:()=>le.abort()},void this.loadTileWithProvider(this.tileProvider,X,B,le,V)}const{cancel:ae}=U.b4(B.request,(le,ce,we)=>{const re=!this.loading[X];if(delete this.loading[X],re||le||!ce)return V(le);this.decodeTile(X,ce,B.encoding).then(ye=>{const{expires:Ve,cacheControl:Oe}=U.aR(we);V(null,Object.assign(ye,{expires:Ve,cacheControl:Oe}))}).catch(ye=>V(ye))});this.loading[X]={cancel:ae}}async decodeTile(B,V,X){const ae=await createImageBitmap(new Blob([new Uint8Array(V)],{type:"image/png"})),le=1-(ae.width-U.fC(ae.width))/2,ce=le<1,we=this.getImageData(ae,le);return ae.close(),{dem:new U.fD(B,we,X,ce),borderReady:ce}}async loadTileWithProvider(B,V,X,ae,le){const{z:ce,x:we,y:re}=X.tileID.canonical;try{const ye=await B.loadTile({z:ce,x:we,y:re},{request:X.request,signal:ae.signal});if(ae.signal.aborted)return le(null,null);if(ye==null){const Oe=new Error("Tile not found");return Oe.status=404,le(Oe)}if(ye.data==null)return le(null,null);const Ve=await this.decodeTile(V,ye.data,X.encoding);
7if(ae.signal.aborted)return le(null,null);le(null,Object.assign(Ve,{expires:ye.expires,cacheControl:ye.cacheControl}))}catch(ye){if(ae.signal.aborted||ye instanceof DOMException&&ye.name==="AbortError")return le(null,null);le(ye instanceof Error?ye:new Error(String(ye)))}finally{delete this.loading[V]}}reloadTile(B,V){V(null,null)}abortTile(B,V){const X=B.uid,ae=this.loading[X];ae&&(ae.cancel(),delete this.loading[X]),V()}removeTile(B,V){V()}getImageData(B,V){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(B.width,B.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d",{willReadFrequently:!0})),this.offscreenCanvas.width=B.width,this.offscreenCanvas.height=B.height,this.offscreenCanvasContext.drawImage(B,0,0,B.width,B.height);const X=this.offscreenCanvasContext.getImageData(-V,-V,B.width+2*V,B.height+2*V);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),X}}U.b1.setPbf(U.b2);class Ys{constructor(B){this._mrt=new U.b1(B.partial?30:1/0),this._isHeaderLoaded=!1,this.uid=B.uid,this.tileID=B.tileID,this.source=B.source}parse(B,V){const X=this._mrt;this.status="parsing",this._entireBuffer=B;try{X.parseHeader(B),this._isHeaderLoaded=!0;const ae=[];for(const le in X.layers){const ce=X.getLayer(le),we=ce.getDataRange(ce.getBandList()),re=X.createDecodingTask(we),ye=B.slice(we.firstByte,we.lastByte+1),Ve=U.b1.performDecoding(ye,re).then(Oe=>re.complete(null,Oe)).catch(Oe=>re.complete(Oe,null));ae.push(Ve)}Promise.allSettled(ae).then(()=>V(null,X)).catch(le=>V(le))}catch(ae){V(ae)}}}class ql{constructor({actor:B}){this.actor=B,this.loading={},this.loaded={}}loadTile(B,V){const X=B.uid,ae=B.request,le=this.loading[X]=new Ys(B),{cancel:ce}=U.b4(ae,(we,re,ye)=>{const Ve=!this.loading[X];if(delete this.loading[X],Ve||we||!re)return le.status="done",Ve||(this.loaded[X]=le),V(we);le.parse(re,(Oe,Ke)=>{if(Oe||!Ke)return V(Oe);V(null,Ke,ye)}),this.loaded[X]=le});le.abort=ce}reloadTile(B,V){V(null,void 0)}abortTile(B,V){const X=B.uid,ae=this.loading[X];ae&&(ae.abort&&ae.abort(),delete this.loading[X]),V()}removeTile(B,V){const X=B.uid;this.loaded[X]&&delete this.loaded[X],V()}decodeRasterArray(B,V){U.b1.performDecoding(B.buffer,B.task).then(X=>V(null,X)).catch(X=>V(X))}}const Zl=U.fE.prototype.toGeoJSON;class Wl{constructor(B){this._feature=B,this.extent=U.ak,this.type=B.type,this.properties=B.tags,"id"in B&&!isNaN(B.id)&&(this.id=parseInt(B.id,10))}loadGeometry(){if(this._feature.type===1){const B=[];for(const V of this._feature.geometry)B.push([new U.P(V[0],V[1])]);return B}{const B=[];for(const V of this._feature.geometry){const X=[];for(const ae of V)X.push(new U.P(ae[0],ae[1]));B.push(X)}return B}}toGeoJSON(B,V,X){return Zl.call(this,B,V,X)}}class ni{constructor(B,V){this.name=B,this.extent=U.ak,this.length=V.length,this._jsonFeatures=V}feature(B){return new Wl(this._jsonFeatures[B])}}class Xl{constructor(B){this.layers={},this.extent=U.ak;for(const V of Object.keys(B))this.layers[V]=new ni(V,B[V])}}const xr=64/4096;class wr{constructor(){this.features=new Map}clear(){this.features.clear()}load(B=[],V){for(const X of B){const ae=X.id;if(ae==null)continue;let le=this.features.get(ae);le&&this.updateCache(le,V),X.geometry?(le=er(X),this.updateCache(le,V),this.features.set(ae,le)):this.features.delete(ae),this.updateCache(le,V)}}updateCache(B,V){for(const{canonical:X,uid:ae}of Object.values(V)){const{z:le,x:ce,y:we}=X;Ti(B,Math.pow(2,le),ce,we)&&delete V[ae]}}getTile(B,V,X){const ae=Math.pow(2,B),le=[];for(const ce of this.features.values())Ti(ce,ae,V,X)&&le.push(bn(ce,ae,V,X));return{features:le}}getFeatures(){return[...this.features.values()]}}function Ti({minX:_e,minY:B,maxX:V,maxY:X},ae,le,ce){return _e<(le+1+xr)/ae&&B<(ce+1+xr)/ae&&V>(le-xr)/ae&&X>(ce-xr)/ae}function er(_e){const{id:B,geometry:V,properties:X}=_e;if(!V)return;if(V.type==="GeometryCollection")throw new Error("GeometryCollection not supported in dynamic mode.");const{type:ae,coordinates:le}=V,ce={id:B,type:1,geometry:[],tags:X,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0},we=ce.geometry;if(ae==="Point")Jn(le,we,ce);else if(ae==="MultiPoint")for(const re of le)Jn(re,we,ce);else if(ae==="LineString")ce.type=2,Yl(le,we,ce);else if(ae==="MultiLineString")ce.type=2,vr(le,we,ce);else if(ae==="Polygon")ce.type=3,vr(le,we,ce,!0);else{if(ae!=="MultiPolygon")throw new Error("Input data is not a valid GeoJSON object.");ce.type=3;for(const re of le)vr(re,we,ce,!0)}return ce}function Jn([_e,B],V,X){const ae=U.aG(_e);let le=U.aJ(B);le=le<0?0:le>1?1:le,V.push(ae,le),X.minX=Math.min(X.minX,ae),X.minY=Math.min(X.minY,le),X.maxX=Math.max(X.maxX,ae),X.maxY=M
7ath.max(X.maxY,le)}function Yl(_e,B,V,X=!1,ae=!1){const le=[];for(const ce of _e)Jn(ce,le,V);B.push(le),X&&(function(ce,we){let re=0;for(let ye=0,Ve=ce.length,Oe=Ve-2;ye<Ve;Oe=ye,ye+=2)re+=(ce[ye]-ce[Oe])*(ce[ye+1]+ce[Oe+1]);if(re>0===we)for(let ye=0,Ve=ce.length;ye<Ve/2;ye+=2){const Oe=ce[ye],Ke=ce[ye+1];ce[ye]=ce[Ve-2-ye],ce[ye+1]=ce[Ve-1-ye],ce[Ve-2-ye]=Oe,ce[Ve-1-ye]=Ke}})(le,ae)}function vr(_e,B,V,X=!1){for(let ae=0;ae<_e.length;ae++)Yl(_e[ae],B,V,X,ae===0)}function bn(_e,B,V,X){const{id:ae,type:le,geometry:ce,tags:we}=_e,re=[];if(le===1)(function(ye,Ve,Oe,Ke,ut){for(let dt=0;dt<ye.length;dt+=2){const Dt=Math.round(U.ak*(ye[dt+0]*Ve-Oe)),Et=Math.round(U.ak*(ye[dt+1]*Ve-Ke));ut.push([Dt,Et])}})(ce,B,V,X,re);else if(le===2)for(const ye of ce)Ci(ye,B,V,X,re);else if(le===3)for(const ye of ce)wn(ye,B,V,X,re);return{id:ae,type:le,geometry:re,tags:we}}function Ci(_e,B,V,X,ae){const ce=U.ak+128;let we;for(let re=0;re<_e.length-2;re+=2){let ye=Math.round(U.ak*(_e[re+0]*B-V)),Ve=Math.round(U.ak*(_e[re+1]*B-X)),Oe=Math.round(U.ak*(_e[re+2]*B-V)),Ke=Math.round(U.ak*(_e[re+3]*B-X));const ut=Oe-ye,dt=Ke-Ve;ye<-128&&Oe<-128||(ye<-128?(Ve+=Math.round(dt*((-128-ye)/ut)),ye=-128):Oe<-128&&(Ke=Ve+Math.round(dt*((-128-ye)/ut)),Oe=-128),Ve<-128&&Ke<-128||(Ve<-128?(ye+=Math.round(ut*((-128-Ve)/dt)),Ve=-128):Ke<-128&&(Oe=ye+Math.round(ut*((-128-Ve)/dt)),Ke=-128),ye>=ce&&Oe>=ce||(ye>=ce?(Ve+=Math.round(dt*((ce-ye)/ut)),ye=ce):Oe>=ce&&(Ke=Ve+Math.round(dt*((ce-ye)/ut)),Oe=ce),Ve>=ce&&Ke>=ce||(Ve>=ce?(ye+=Math.round(ut*((ce-Ve)/dt)),Ve=ce):Ke>=ce&&(Oe=ye+Math.round(ut*((ce-Ve)/dt)),Ke=ce),we&&ye===we.at(-1)[0]&&Ve===we.at(-1)[1]||(we=[[ye,Ve]],ae.push(we)),we.push([Oe,Ke])))))}}function wn(_e,B,V,X,ae){const le=(V-xr)/B,ce=(X-xr)/B,we=(V+1+xr)/B,re=(X+1+xr)/B;function ye(Ke,ut){let dt=0;return Ke<le?dt|=1:Ke>we&&(dt|=2),ut<ce?dt|=4:ut>re&&(dt|=8),dt}let Ve=[];for(let Ke=1;Ke<=8;Ke*=2){let ut=_e[_e.length-2],dt=_e.at(-1),Dt=!(ye(ut,dt)&Ke);for(let Et=0;Et<_e.length;Et+=2){const Ne=_e[Et],Ct=_e[Et+1],Jt=!(ye(Ne,Ct)&Ke);Jt!==Dt&&(8&Ke?Ve.push(ut+(Ne-ut)*(re-dt)/(Ct-dt),re):4&Ke?Ve.push(ut+(Ne-ut)*(ce-dt)/(Ct-dt),ce):2&Ke?Ve.push(we,dt+(Ct-dt)*(we-ut)/(Ne-ut)):1&Ke&&Ve.push(le,dt+(Ct-dt)*(le-ut)/(Ne-ut))),Jt&&Ve.push(Ne,Ct),ut=Ne,dt=Ct,Dt=Jt}if(!(_e=Ve).length||Ke===8)break;Ve=[]}const Oe=[];for(let Ke=0;Ke<Ve.length;Ke+=2)Oe.push([Math.round(U.ak*(Ve[Ke]*B-V)),Math.round(U.ak*(Ve[Ke+1]*B-X))]);Oe.length&&ae.push(Oe)}function Js({name:_e,features:B},V){V.writeStringField(1,_e),V.writeVarintField(5,U.ak);const X=new Map,ae=new Map,le={keys:X,values:ae,feature:null};for(const ce of B)le.feature=ce,V.writeMessage(2,Ho,le);for(const ce of X.keys())V.writeStringField(3,ce);for(const ce of ae.keys())V.writeMessage(4,kr,ce)}function Ho(_e,B){const V=_e.feature;V.id!==void 0&&Number.isSafeInteger(+V.id)&&B.writeVarintField(1,+V.id),V.tags&&B.writeMessage(2,Jl,_e),B.writeVarintField(3,V.type),B.writeMessage(4,Xi,V)}function Jl({keys:_e,values:B,feature:V},X){for(const ae of Object.keys(V.tags)){let le=V.tags[ae];if(le===null)continue;let ce=_e.get(ae);ce===void 0&&(ce=_e.size,_e.set(ae,ce)),X.writeVarint(ce);const we=typeof le;we!=="string"&&we!=="boolean"&&we!=="number"&&(le=JSON.stringify(le));let re=B.get(le);re===void 0&&(re=B.size,B.set(le,re)),X.writeVarint(re)}}function Kn(_e,B){return(B<<3)+(7&_e)}function ui(_e){return _e<<1^_e>>31}function Xi(_e,B){const{geometry:V,type:X}=_e;let ae=0,le=0;if(X===1){B.writeVarint(Kn(1,V.length));for(const ce of V){const we=ce[0]-ae,re=ce[1]-le;B.writeVarint(ui(we)),B.writeVarint(ui(re)),ae+=we,le+=re}}else for(const ce of V){if(ce.length===0)continue;B.writeVarint(Kn(1,1));const we=ce.length-(X===3?1:0);for(let re=0;re<we;re++){re===1&&B.writeVarint(Kn(2,we-1));const ye=ce[re][0]-ae,Ve=ce[re][1]-le;B.writeVarint(ui(ye)),B.writeVarint(ui(Ve)),ae+=ye,le+=Ve}X===3&&B.writeVarint(Kn(7,1))}}function kr(_e,B){const V=typeof _e;V==="string"?B.writeStringField(1,_e):V==="boolean"?B.writeBooleanField(7,_e):V==="number"&&(_e%1!=0?B.writeDoubleField(3,_e):_e<0?B.writeSVarintField(6,_e):B.writeVarintField(5,_e))}const Ks={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:_e=>_e},Pi=Math.fround||(gs=new Float32Array(1),_e=>(gs[0]=+_e,gs[0]));var gs;class Ua{constructor(B){this.options=Object.assign(Object.create(Ks),B),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(B){const{log:V,minZoom:X,maxZoom:ae}=this.options;V&&console.time("total time");const le=`prepare ${B.length} points`;V&&console.time(le),this.points=B;const ce=[];for(let re=0;re<B.length;re++){const ye=B[re];
vendor: 4,679 bytes, line 7
7if(!ye.geometry)continue;const[Ve,Oe]=ye.geometry.coordinates,Ke=Pi(ki(Ve)),ut=Pi(ja(Oe));ce.push(Ke,ut,1/0,re,-1,1),this.options.reduce&&ce.push(0)}let we=this.trees[ae+1]=this._createTree(ce);V&&console.timeEnd(le);for(let re=ae;re>=X;re--){const ye=+Date.now();we=this.trees[re]=this._createTree(this._cluster(we,re)),V&&console.log("z%d: %d clusters in %dms",re,we.numItems,+Date.now()-ye)}return V&&console.timeEnd("total time"),this}getClusters(B,V){let X=((B[0]+180)%360+360)%360-180;const ae=Math.max(-90,Math.min(90,B[1]));let le=B[2]===180?180:((B[2]+180)%360+360)%360-180;const ce=Math.max(-90,Math.min(90,B[3]));if(B[2]-B[0]>=360)X=-180,le=180;else if(X>le){const Oe=this.getClusters([X,ae,180,ce],V),Ke=this.getClusters([-180,ae,le,ce],V);return Oe.concat(Ke)}const we=this.trees[this._limitZoom(V)],re=we.range(ki(X),ja(ce),ki(le),ja(ae)),ye=we.data,Ve=[];for(const Oe of re){const Ke=this.stride*Oe;Ve.push(ye[Ke+5]>1?Va(ye,Ke,this.clusterProps):this.points[ye[Ke+3]])}return Ve}getChildren(B){const V=this._getOriginId(B),X=this._getOriginZoom(B),ae="No cluster with the specified id.",le=this.trees[X];if(!le)throw new Error(ae);const ce=le.data;if(V*this.stride>=ce.length)throw new Error(ae);const we=this.options.radius/(this.options.extent*Math.pow(2,X-1)),re=le.within(ce[V*this.stride],ce[V*this.stride+1],we),ye=[];for(const Ve of re){const Oe=Ve*this.stride;ce[Oe+4]===B&&ye.push(ce[Oe+5]>1?Va(ce,Oe,this.clusterProps):this.points[ce[Oe+3]])}if(ye.length===0)throw new Error(ae);return ye}getLeaves(B,V,X){const ae=[];return this._appendLeaves(ae,B,V=V||10,X=X||0,0),ae}getTile(B,V,X){const ae=this.trees[this._limitZoom(B)],le=Math.pow(2,B),{extent:ce,radius:we}=this.options,re=we/ce,ye=(X-re)/le,Ve=(X+1+re)/le,Oe={features:[]};return this._addTileFeatures(ae.range((V-re)/le,ye,(V+1+re)/le,Ve),ae.data,V,X,le,Oe),V===0&&this._addTileFeatures(ae.range(1-re/le,ye,1,Ve),ae.data,le,X,le,Oe),V===le-1&&this._addTileFeatures(ae.range(0,ye,re/le,Ve),ae.data,-1,X,le,Oe),Oe.features.length?Oe:null}getClusterExpansionZoom(B){let V=this._getOriginZoom(B)-1;for(;V<=this.options.maxZoom;){const X=this.getChildren(B);if(V++,X.length!==1)break;B=X[0].properties.cluster_id}return V}_appendLeaves(B,V,X,ae,le){const ce=this.getChildren(V);for(const we of ce){const re=we.properties;if(re&&re.cluster?le+re.point_count<=ae?le+=re.point_count:le=this._appendLeaves(B,re.cluster_id,X,ae,le):le<ae?le++:B.push(we),B.length===X)break}return le}_createTree(B){const V=new U.bM(B.length/this.stride|0,this.options.nodeSize,Float32Array);for(let X=0;X<B.length;X+=this.stride)V.add(B[X],B[X+1]);return V.finish(),V.data=B,V}_addTileFeatures(B,V,X,ae,le,ce){for(const we of B){const re=we*this.stride,ye=V[re+5]>1;let Ve,Oe,Ke;if(ye)Ve=go(V,re,this.clusterProps),Oe=V[re],Ke=V[re+1];else{const Dt=this.points[V[re+3]];Ve=Dt.properties;const[Et,Ne]=Dt.geometry.coordinates;Oe=ki(Et),Ke=ja(Ne)}const ut={type:1,geometry:[[Math.round(this.options.extent*(Oe*le-X)),Math.round(this.options.extent*(Ke*le-ae))]],tags:Ve};let dt;dt=ye||this.options.generateId?V[re+3]:this.points[V[re+3]].id,dt!==void 0&&(ut.id=dt),ce.features.push(ut)}}_limitZoom(B){return Math.max(this.options.minZoom,Math.min(Math.floor(+B),this.options.maxZoom+1))}_cluster(B,V){const{radius:X,extent:ae,reduce:le,minPoints:ce}=this.options,we=X/(ae*Math.pow(2,V)),re=B.data,ye=[],Ve=this.stride;for(let Oe=0;Oe<re.length;Oe+=Ve){if(re[Oe+2]<=V)continue;re[Oe+2]=V;const Ke=re[Oe],ut=re[Oe+1],dt=B.within(re[Oe],re[Oe+1],we),Dt=re[Oe+5];let Et=Dt;for(const Ne of dt){const Ct=Ne*Ve;re[Ct+2]>V&&(Et+=re[Ct+5])}if(Et>Dt&&Et>=ce){let Ne,Ct=Ke*Dt,Jt=ut*Dt,Gi=-1;const Ni=(Oe/Ve<<5)+(V+1)+this.points.length;for(const Pt of dt){const hi=Pt*Ve;if(re[hi+2]<=V)continue;re[hi+2]=V;const Ii=re[hi+5];Ct+=re[hi]*Ii,Jt+=re[hi+1]*Ii,re[hi+4]=Ni,le&&(Ne||(Ne=this._map(re,Oe,!0),Gi=this.clusterProps.length,this.clusterProps.push(Ne)),le(Ne,this._map(re,hi)))}re[Oe+4]=Ni,ye.push(Ct/Et,Jt/Et,1/0,Ni,-1,Et),le&&ye.push(Gi)}else{for(let Ne=0;Ne<Ve;Ne++)ye.push(re[Oe+Ne]);if(Et>1)for(const Ne of dt){const Ct=Ne*Ve;if(!(re[Ct+2]<=V)){re[Ct+2]=V;for(let Jt=0;Jt<Ve;Jt++)ye.push(re[Ct+Jt])}}}}return ye}_getOriginId(B){return B-this.points.length>>5}_getOriginZoom(B){return(B-this.points.length)%32}_map(B,V,X){if(B[V+5]>1){const ce=this.clusterProps[B[V+6]];return X?Object.assign({},ce):ce}const ae=this.points[B[V+3]].properties,le=this.options.map(ae);return X&&le===ae?Object.assign({},le):le}}function Va(_e,B,V){return{type:"Feature",id:_e[B+3],properties:go(_e,B,V),geometry:{type:"Point",coordinates:[(X=_e[B],360*(X-.5)),Qs(_e[B+1])]}};var X}function go(_e,B,V){const X=_e[B+5],ae=X>=1e4?`${Math.round(X/1e3)}
7k`:X>=1e3?Math.round(X/100)/10+"k":X,le=_e[B+6],ce=le===-1?{}:Object.assign({},V[le]);return Object.assign(ce,{cluster:!0,cluster_id:_e[B+3],point_count:X,point_count_abbreviated:ae})}function ki(_e){return _e/360+.5}function ja(_e){const B=Math.sin(_e*Math.PI/180),V=.5-.25*Math.log((1+B)/(1-B))/Math.PI;return V<0?0:V>1?1:V}function Qs(_e){const B=(180-360*_e)*Math.PI/180;return 360*Math.atan(Math.exp(B))/Math.PI-90}function Ga(_e,B,V,X){let ae=X;const le=B+(V-B>>1);let ce,we=V-B;const re=_e[B],ye=_e[B+1],Ve=_e[V],Oe=_e[V+1];for(let Ke=B+3;Ke<V;Ke+=3){const ut=ea(_e[Ke],_e[Ke+1],re,ye,Ve,Oe);if(ut>ae)ce=Ke,ae=ut;else if(ut===ae){const dt=Math.abs(Ke-le);dt<we&&(ce=Ke,we=dt)}}ae>X&&(ce-B>3&&Ga(_e,B,ce,X),_e[ce+2]=ae,V-ce>3&&Ga(_e,ce,V,X))}function ea(_e,B,V,X,ae,le){let ce=ae-V,we=le-X;if(ce!==0||we!==0){const re=((_e-V)*ce+(B-X)*we)/(ce*ce+we*we);re>1?(V=ae,X=le):re>0&&(V+=ce*re,X+=we*re)}return ce=_e-V,we=B-X,ce*ce+we*we}function qo(_e,B,V,X){const ae={id:_e??null,type:B,geometry:V,tags:X,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(B==="Point"||B==="MultiPoint"||B==="LineString")ln(ae,V);else if(B==="Polygon")ln(ae,V[0]);else if(B==="MultiLineString")for(const le of V)ln(ae,le);else if(B==="MultiPolygon")for(const le of V)ln(ae,le[0]);return ae}function ln(_e,B){for(let V=0;V<B.length;V+=3)_e.minX=Math.min(_e.minX,B[V]),_e.minY=Math.min(_e.minY,B[V+1]),_e.maxX=Math.max(_e.maxX,B[V]),_e.maxY=Math.max(_e.maxY,B[V+1])}function ys(_e,B,V,X){if(!B.geometry)return;const ae=B.geometry.coordinates;if(ae&&ae.length===0)return;const le=B.geometry.type,ce=Math.pow(V.tolerance/((1<<V.maxZoom)*V.extent),2);let we=[],re=B.id;if(V.promoteId?re=B.properties[V.promoteId]:V.generateId&&(re=X||0),le==="Point")xs(ae,we);else if(le==="MultiPoint")for(const ye of ae)xs(ye,we);else if(le==="LineString")$a(ae,we,ce,!1);else if(le==="MultiLineString"){if(V.lineMetrics){for(const ye of ae)we=[],$a(ye,we,ce,!1),_e.push(qo(re,"LineString",we,B.properties));return}ta(ae,we,ce,!1)}else if(le==="Polygon")ta(ae,we,ce,!0);else{if(le!=="MultiPolygon"){if(le==="GeometryCollection"){for(const ye of B.geometry.geometries)ys(_e,{id:re,geometry:ye,properties:B.properties},V,X);return}throw new Error("Input data is not a valid GeoJSON object.")}for(const ye of ae){const Ve=[];ta(ye,Ve,ce,!0),we.push(Ve)}}_e.push(qo(re,le,we,B.properties))}function xs(_e,B){B.push(cn(_e[0]),Kl(_e[1]),0)}function $a(_e,B,V,X){let ae,le,ce=0;for(let re=0;re<_e.length;re++){const ye=cn(_e[re][0]),Ve=Kl(_e[re][1]);B.push(ye,Ve,0),re>0&&(ce+=X?(ae*Ve-ye*le)/2:Math.sqrt(Math.pow(ye-ae,2)+Math.pow(Ve-le,2))),ae=ye,le=Ve}const we=B.length-3;B[2]=1,Ga(B,0,we,V),B[we+2]=1,B.size=Math.abs(ce),B.start=0,B.end=B.size}function ta(_e,B,V,X){for(let ae=0;ae<_e.length;ae++){const le=[];$a(_e[ae],le,V,X),B.push(le)}}function cn(_e){return _e/360+.5}function Kl(_e){const B=Math.sin(_e*Math.PI/180),V=.5-.25*Math.log((1+B)/(1-B))/Math.PI;return V<0?0:V>1?1:V}function Tn(_e,B,V,X,ae,le,ce,we){if(X/=B,le>=(V/=B)&&ce<X)return _e;if(ce<V||le>=X)return null;const re=[];for(const ye of _e){const Ve=ye.geometry;let Oe=ye.type;const Ke=ae===0?ye.minX:ye.minY,ut=ae===0?ye.maxX:ye.maxY;if(Ke>=V&&ut<X){re.push(ye);continue}if(ut<V||Ke>=X)continue;let dt=[];if(Oe==="Point"||Oe==="MultiPoint")tu(Ve,dt,V,X,ae);else if(Oe==="LineString")Ql(Ve,dt,V,X,ae,!1,we.lineMetrics);else if(Oe==="MultiLineString")Qn(Ve,dt,V,X,ae,!1);else if(Oe==="Polygon")Qn(Ve,dt,V,X,ae,!0);else if(Oe==="MultiPolygon")for(const Dt of Ve){const Et=[];Qn(Dt,Et,V,X,ae,!0),Et.length&&dt.push(Et)}if(dt.length){if(we.lineMetrics&&Oe==="LineString"){for(const Dt of dt)re.push(qo(ye.id,Oe,Dt,ye.tags));continue}Oe!=="LineString"&&Oe!=="MultiLineString"||(dt.length===1?(Oe="LineString",dt=dt[0]):Oe="MultiLineString"),Oe!=="Point"&&Oe!=="MultiPoint"||(Oe=dt.length===3?"Point":"MultiPoint"),re.push(qo(ye.id,Oe,dt,ye.tags))}}return re.length?re:null}function tu(_e,B,V,X,ae){for(let le=0;le<_e.length;le+=3){const ce=_e[le+ae];ce>=V&&ce<=X&&Zo(B,_e[le],_e[le+1],_e[le+2])}}function Ql(_e,B,V,X,ae,le,ce){let we=Nr(_e);const re=ae===0?ia:eo;let ye,Ve,Oe=_e.start;for(let Et=0;Et<_e.length-3;Et+=3){const Ne=_e[Et],Ct=_e[Et+1],Jt=_e[Et+2],Gi=_e[Et+3],Ni=_e[Et+4],Pt=ae===0?Ne:Ct,hi=ae===0?Gi:Ni;let Ii=!1;ce&&(ye=Math.sqrt(Math.pow(Ne-Gi,2)+Math.pow(Ct-Ni,2))),Pt<V?hi>V&&(Ve=re(we,Ne,Ct,Gi,Ni,V),ce&&(we.start=Oe+ye*Ve)):Pt>X?hi<X&&(Ve=re(we,Ne,Ct,Gi,Ni,X),ce&&(we.start=Oe+ye*Ve)):Zo(we,Ne,Ct,Jt),hi<V&&Pt>=V&&(Ve=re(we,Ne,Ct,Gi,Ni,V),Ii=!0),hi>X&&Pt<=X&&(Ve=re(we,Ne,Ct,Gi,Ni,X),Ii=!0),!le&&Ii&&(ce&&(we.end=Oe+ye*Ve),B.push(we),we=Nr(_e)),ce&&(Oe+=ye)}let Ke=_e.length-3;const ut=_e[Ke],dt=_e[Ke+1],Dt=ae===0?ut:dt;Dt>=V&&Dt<=X&&Zo(we,ut,dt,_e[Ke+2]),Ke=we.length-3,le&&Ke>=3&&(we[Ke]!==we[0]||we[Ke+1]!==we[1])&&Zo(we,we[0],we[1],we[2]),we.length&&B.push(we)}function Nr(_e){const B=[];return B.size=_e.size,B.start=_e.start,B.end=_e.end,B}function Qn(_e,B,V,X,ae,le){for(const ce of _e)Ql(ce,B,V,X,ae,le,!1)}
vendor: 5,016 bytes, line 7
7function Zo(_e,B,V,X){_e.push(B,V,X)}function ia(_e,B,V,X,ae,le){const ce=(le-B)/(X-B);return Zo(_e,le,V+(ae-V)*ce,1),ce}function eo(_e,B,V,X,ae,le){const ce=(le-V)/(ae-V);return Zo(_e,B+(X-B)*ce,le,1),ce}function ra(_e,B){const V=[];for(let X=0;X<_e.length;X++){const ae=_e[X],le=ae.type;let ce;if(le==="Point"||le==="MultiPoint"||le==="LineString")ce=na(ae.geometry,B);else if(le==="MultiLineString"||le==="Polygon"){ce=[];for(const we of ae.geometry)ce.push(na(we,B))}else if(le==="MultiPolygon"){ce=[];for(const we of ae.geometry){const re=[];for(const ye of we)re.push(na(ye,B));ce.push(re)}}V.push(qo(ae.id,le,ce,ae.tags))}return V}function na(_e,B){const V=[];V.size=_e.size,_e.start!==void 0&&(V.start=_e.start,V.end=_e.end);for(let X=0;X<_e.length;X+=3)V.push(_e[X]+B,_e[X+1],_e[X+2]);return V}function ec(_e,B){if(_e.transformed)return _e;const V=1<<_e.z,X=_e.x,ae=_e.y;for(const le of _e.features){const ce=le.geometry,we=le.type;if(le.geometry=[],we===1)for(let re=0;re<ce.length;re+=2)le.geometry.push(yo(ce[re],ce[re+1],B,V,X,ae));else for(let re=0;re<ce.length;re++){const ye=[];for(let Ve=0;Ve<ce[re].length;Ve+=2)ye.push(yo(ce[re][Ve],ce[re][Ve+1],B,V,X,ae));le.geometry.push(ye)}}return _e.transformed=!0,_e}function yo(_e,B,V,X,ae,le){return[Math.round(V*(_e*X-ae)),Math.round(V*(B*X-le))]}function tc(_e,B,V,X,ae){const le=B===ae.maxZoom?0:ae.tolerance/((1<<B)*ae.extent),ce={features:[],numPoints:0,numSimplified:0,numFeatures:_e.length,source:null,x:V,y:X,z:B,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const we of _e)iu(ce,we,le,ae);return ce}function iu(_e,B,V,X){const ae=B.geometry,le=B.type,ce=[];if(_e.minX=Math.min(_e.minX,B.minX),_e.minY=Math.min(_e.minY,B.minY),_e.maxX=Math.max(_e.maxX,B.maxX),_e.maxY=Math.max(_e.maxY,B.maxY),le==="Point"||le==="MultiPoint")for(let we=0;we<ae.length;we+=3)ce.push(ae[we],ae[we+1]),_e.numPoints++,_e.numSimplified++;else if(le==="LineString")Ha(ce,ae,_e,V,!1,!1);else if(le==="MultiLineString"||le==="Polygon")for(let we=0;we<ae.length;we++)Ha(ce,ae[we],_e,V,le==="Polygon",we===0);else if(le==="MultiPolygon")for(let we=0;we<ae.length;we++){const re=ae[we];for(let ye=0;ye<re.length;ye++)Ha(ce,re[ye],_e,V,!0,ye===0)}if(ce.length){let we=B.tags||null;if(le==="LineString"&&X.lineMetrics){we={};for(const ye in B.tags)we[ye]=B.tags[ye];we.mapbox_clip_start=ae.start/ae.size,we.mapbox_clip_end=ae.end/ae.size}const re={geometry:ce,type:le==="Polygon"||le==="MultiPolygon"?3:le==="LineString"||le==="MultiLineString"?2:1,tags:we};B.id!==null&&(re.id=B.id),_e.features.push(re)}}function Ha(_e,B,V,X,ae,le){const ce=X*X;if(X>0&&B.size<(ae?ce:X))return void(V.numPoints+=B.length/3);const we=[];for(let re=0;re<B.length;re+=3)(X===0||B[re+2]>ce)&&(V.numSimplified++,we.push(B[re],B[re+1])),V.numPoints++;ae&&(function(re,ye){let Ve=0;for(let Oe=0,Ke=re.length,ut=Ke-2;Oe<Ke;ut=Oe,Oe+=2)Ve+=(re[Oe]-re[ut])*(re[Oe+1]+re[ut+1]);if(Ve>0===ye)for(let Oe=0,Ke=re.length;Oe<Ke/2;Oe+=2){const ut=re[Oe],dt=re[Oe+1];re[Oe]=re[Ke-2-Oe],re[Oe+1]=re[Ke-1-Oe],re[Ke-2-Oe]=ut,re[Ke-1-Oe]=dt}})(we,le),_e.push(we)}const ru={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class Ch{constructor(B,V){const X=(V=this.options=(function(le,ce){for(const we in ce)le[we]=ce[we];return le})(Object.create(ru),V)).debug;if(X&&console.time("preprocess data"),V.maxZoom<0||V.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(V.promoteId&&V.generateId)throw new Error("promoteId and generateId cannot be used together.");let ae=(function(le,ce){const we=[];if(le.type==="FeatureCollection")for(let re=0;re<le.features.length;re++)ys(we,le.features[re],ce,re);else ys(we,le.type==="Feature"?le:{geometry:le},ce);return we})(B,V);this.tiles={},this.tileCoords=[],X&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",V.indexMaxZoom,V.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),ae=(function(le,ce){const we=ce.buffer/ce.extent;let re=le;const ye=Tn(le,1,-1-we,we,0,-1,2,ce),Ve=Tn(le,1,1-we,2+we,0,-1,2,ce);return(ye||Ve)&&(re=Tn(le,1,-we,1+we,0,-1,2,ce)||[],ye&&(re=ra(ye,1).concat(re)),Ve&&(re=re.concat(ra(Ve,-1)))),re})(ae,V),ae.length&&this.splitTile(ae,0,0,0),X&&(ae.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}splitTile(B,V,X,ae,le,ce,we){const re=[B,V,X,ae],ye=this.options,Ve=ye.debug;for(;re.length;){ae=re.pop(),X=re.pop(),V=re.pop(),B=re.pop();const Oe=1<<V,Ke=qa(V,X,ae);let ut=this.tiles[Ke];if(!ut&&(Ve>1&&console.time("creation"),ut=this.tiles[Ke]=tc(B,V,X,ae,ye),this.tileCoords.push({z:V,x:X,y:ae}),Ve)){Ve>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",V,X,ae,ut.numFeatures,ut.numPoints,ut.numSimplified),console.timeEnd("creation"));const Ii=`z${V}`;this.stats[Ii]=(this.stats[Ii]||0)+1,this.total++}
7if(ut.source=B,le==null){if(V===ye.indexMaxZoom||ut.numPoints<=ye.indexMaxPoints)continue}else{if(V===ye.maxZoom||V===le)continue;if(le!=null){const Ii=le-V;if(X!==ce>>Ii||ae!==we>>Ii)continue}}if(ut.source=null,B.length===0)continue;Ve>1&&console.time("clipping");const dt=.5*ye.buffer/ye.extent,Dt=.5-dt,Et=.5+dt,Ne=1+dt;let Ct=null,Jt=null,Gi=null,Ni=null,Pt=Tn(B,Oe,X-dt,X+Et,0,ut.minX,ut.maxX,ye),hi=Tn(B,Oe,X+Dt,X+Ne,0,ut.minX,ut.maxX,ye);B=null,Pt&&(Ct=Tn(Pt,Oe,ae-dt,ae+Et,1,ut.minY,ut.maxY,ye),Jt=Tn(Pt,Oe,ae+Dt,ae+Ne,1,ut.minY,ut.maxY,ye),Pt=null),hi&&(Gi=Tn(hi,Oe,ae-dt,ae+Et,1,ut.minY,ut.maxY,ye),Ni=Tn(hi,Oe,ae+Dt,ae+Ne,1,ut.minY,ut.maxY,ye),hi=null),Ve>1&&console.timeEnd("clipping"),re.push(Ct||[],V+1,2*X,2*ae),re.push(Jt||[],V+1,2*X,2*ae+1),re.push(Gi||[],V+1,2*X+1,2*ae),re.push(Ni||[],V+1,2*X+1,2*ae+1)}}getTile(B,V,X){B=+B,V=+V,X=+X;const ae=this.options,{extent:le,debug:ce}=ae;if(B<0||B>24)return null;const we=1<<B,re=qa(B,V=V+we&we-1,X);if(this.tiles[re])return ec(this.tiles[re],le);ce>1&&console.log("drilling down to z%d-%d-%d",B,V,X);let ye,Ve=B,Oe=V,Ke=X;for(;!ye&&Ve>0;)Ve--,Oe>>=1,Ke>>=1,ye=this.tiles[qa(Ve,Oe,Ke)];return ye&&ye.source?(ce>1&&(console.log("found parent tile z%d-%d-%d",Ve,Oe,Ke),console.time("drilling down")),this.splitTile(ye.source,Ve,Oe,Ke,B,V,X),ce>1&&console.timeEnd("drilling down"),this.tiles[re]?ec(this.tiles[re],le):null):null}}function qa(_e,B,V){return 32*((1<<_e)*V+B)+_e}function Ue(_e,B){const V=_e.tileID.canonical;if(!this._geoJSONIndex)return void B(null,null);const X=this._geoJSONIndex.getTile(V.z,V.x,V.y);if(!X)return void B(null,null);const ae=ye=>ye.tags&&"3d_elevation_id"in ye.tags&&"source"in ye.tags&&ye.tags.source==="elevation",le=X.features.filter(ye=>ae(ye));let ce={_geojsonTileLayer:X.features};le.length>0&&(ce={_geojsonTileLayer:X.features.filter(ye=>!ae(ye)),hd_road_elevation:le});const we=new Xl(ce),re=(function(ye){const Ve=new U.b2;for(const Oe of Object.keys(ye))Ve.writeMessage(3,Js,{name:Oe,features:ye[Oe]});return Ve.finish()})(ce).buffer;B(null,{vectorTile:we,rawData:re})}class Wo extends _s{constructor(B){super(B),this.loadVectorData=Ue,this._dynamicIndex=new wr}loadData(B,V){const X=B&&B.request,ae=X&&X.collectResourceTiming;this._geoJSONIndex=null,this.loadGeoJSON(B,(le,ce)=>{if(le||!ce)return V(le);if(typeof ce!="object")return V(new Error(`Input data given to '${B.source}' is not a valid GeoJSON object.`));{try{if(B.filter){const re=U.U(B.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(re.result==="error")throw new Error(re.value.map(ye=>`${ye.key}: ${ye.message}`).join(", "));ce.features=ce.features.filter(ye=>re.value.evaluate({zoom:0},ye))}B.dynamic?(ce.type==="Feature"&&(ce={type:"FeatureCollection",features:[ce]}),B.append||(this._dynamicIndex.clear(),this.loaded={}),this._dynamicIndex.load(ce.features,this.loaded),B.cluster&&(ce.features=this._dynamicIndex.getFeatures())):this.loaded={},this._geoJSONIndex=B.cluster?new Ua((function({superclusterOptions:re,clusterProperties:ye}){if(!ye||!re)return re;const Ve={},Oe={},Ke={accumulated:null,zoom:0},ut={properties:null},dt=Object.keys(ye);for(const Dt of dt){const[Et,Ne]=ye[Dt],Ct=U.U(Ne),Jt=U.U(typeof Et=="string"?[Et,["accumulated"],["get",Dt]]:Et);Ve[Dt]=Ct.value,Oe[Dt]=Jt.value}return re.map=Dt=>{ut.properties=Dt;const Et={};for(const Ne of dt)Et[Ne]=Ve[Ne].evaluate(Ke,ut);return Et},re.reduce=(Dt,Et)=>{ut.properties=Et;for(const Ne of dt)Ke.accumulated=Dt[Ne],Dt[Ne]=Oe[Ne].evaluate(Ke,ut)},re})(B)).load(ce.features):B.dynamic?this._dynamicIndex:(function(re,ye){return new Ch(re,ye)})(ce,B.geojsonVtOptions)}catch(re){return V(re)}const we={};if(ae){const re=sn(X);re&&(we.resourceTiming={},we.resourceTiming[B.source]=JSON.parse(JSON.stringify(re)))}V(null,we)}})}reloadTile(B,V){const X=this.loaded;return X&&X[B.uid]?B.partial?V(null,void 0):super.reloadTile(B,V):this.loadTile(B,V)}loadGeoJSON(B,V){if(B.request)U.m(B.request,V);else{if(typeof B.data!="string")return V(new Error(`Input data given to '${B.source}' is not a valid GeoJSON object.`));setTimeout(()=>{try{return V(null,JSON.parse(B.data))}catch{return V(new Error(`Input data given to '${B.source}' is not a valid GeoJSON object.`))}},0)}}
7getClusterExpansionZoom(B,V){try{V(null,this._geoJSONIndex.getClusterExpansionZoom(B.clusterId))}catch(X){V(X)}}getClusterChildren(B,V){try{V(null,this._geoJSONIndex.getChildren(B.clusterId))}catch(X){V(X)}}getClusterLeaves(B,V){try{V(null,this._geoJSONIndex.getLeaves(B.clusterId,B.limit,B.offset))}catch(X){V(X)}}}class vs{constructor(B,V,X){this.tileID=new U.aU(B.tileID.overscaledZ,B.tileID.wrap,B.tileID.canonical.z,B.tileID.canonical.x,B.tileID.canonical.y),this.tileZoom=B.tileZoom,this.uid=B.uid,this.zoom=B.zoom,this.canonical=B.tileID.canonical,this.pixelRatio=B.pixelRatio,this.tileSize=B.tileSize,this.source=B.source,this.overscaling=this.tileID.overscaleFactor(),this.projection=B.projection,this.brightness=V,this.worldview=X}parse(B,V,X,ae){this.status="parsing";const le=new U.aU(X.tileID.overscaledZ,X.tileID.wrap,X.tileID.canonical.z,X.tileID.canonical.x,X.tileID.canonical.y),ce=[],we=V.familiesBySource[X.source],re=new U.fj(le,X.promoteId);re.bucketLayerIDs=[],re.is3DTile=!0,U.fF(B).then(ye=>{const Ve=ye.json.extensionsUsed&&ye.json.extensionsUsed.includes("MAPBOX_mesh_features")||ye.json.asset.extras&&ye.json.asset.extras.MAPBOX_mesh_features,Oe=ye.json.extensionsUsed&&ye.json.extensionsUsed.includes("EXT_meshopt_compression"),Ke=new U.ab(this.zoom,{brightness:this.brightness,worldview:this.worldview});for(const ut in we)for(const dt of we[ut]){const Dt=dt[0];re.bucketLayerIDs.push(dt.map(Ct=>U.t(Ct.id,Ct.scope))),Dt.recalculate(Ke,[]);const Et=U.fG(ye,1/U.cW(X.tileID.canonical)),Ne=new U.fH(dt,Et,le,Ve,Oe,this.brightness,re,this.worldview);Ve||(Ne.needsUpload=!0),ce.push(Ne),Ne.evaluate(Dt)}this.status="done",ae(null,{buckets:ce,featureIndex:re,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:null})}).catch(ye=>ae(new Error(ye.message)))}}class oa{constructor({actor:B,layerIndex:V,availableImages:X,availableModels:ae,brightness:le,worldview:ce}){this.actor=B,this.layerIndex=V,this.availableImages=X,this.availableModels=ae,this.brightness=le,this.loading={},this.loaded={},this.worldview=ce}loadTile(B,V){const X=B.uid,ae=this.loading[X]=new vs(B,this.brightness,this.worldview);U.b4(B.request,(le,ce)=>{const we=!this.loading[X];return delete this.loading[X],we||le?(ae.status="done",we||(this.loaded[X]=ae),V(le)):ce&&ce.byteLength!==0?void ae.parse(ce,this.layerIndex,B,(re,ye)=>{ae.status="done",this.loaded=this.loaded||{},this.loaded[X]=ae,re||!ye?V(re):V(null,ye)}):(ae.status="done",this.loaded[X]=ae,V())})}reloadTile(B,V){const X=this.loaded,ae=B.uid;if(X&&X[ae]){const le=X[ae];le.projection=B.projection,le.brightness=B.brightness;const ce=(we,re)=>{le.reloadCallback&&(delete le.reloadCallback,this.loadTile(B,V)),V(we,re)};le.status==="parsing"?le.reloadCallback=ce:le.status==="done"&&this.loadTile(B,V)}}abortTile(B,V){const X=B.uid;this.loading[X]&&delete this.loading[X],V()}removeTile(B,V){const X=this.loaded,ae=B.uid;X&&X[ae]&&delete X[ae],V()}}class Za{constructor(B){this.self=B,this.actor=new U.ap(B,this),this.layerIndexes={},this.availableImages={},this.availableModels={},this.isSpriteLoaded={},this.rtlPluginParsingListeners=[],this.projections={},this.defaultProjection=U.c4({name:"mercator"}),this.workerSourceTypes={vector:_s,geojson:Wo,"raster-dem":$o,"raster-array":ql,"batched-model":oa},this.workerSources={},this.self.registerWorkerSource=(V,X)=>{if(this.workerSourceTypes[V])throw new Error(`Worker source with name "${V}" already registered.`);this.workerSourceTypes[V]=X}
7,this.self.registerRTLTextPlugin=V=>{if(U.fJ.isParsed())throw new Error("RTL text plugin already registered.");U.fJ.setState({pluginStatus:U.fK.parsed,pluginURL:U.fJ.getPluginURL()}),U.fJ.applyArabicShaping=V.applyArabicShaping,U.fJ.processBidirectionalText=V.processBidirectionalText,U.fJ.processStyledBidirectionalText=V.processStyledBidirectionalText;for(const X of this.rtlPluginParsingListeners)X(null,!0);this.rtlPluginParsingListeners=[]}}clearCaches(B,V,X){delete this.layerIndexes[B],delete this.availableImages[B],delete this.availableModels[B],delete this.workerSources[B],X()}checkIfReady(B,V,X){X()}setReferrer(B,V){this.referrer=V}spriteLoaded(B,V){this.isSpriteLoaded[B]||(this.isSpriteLoaded[B]={});const{scope:X,isLoaded:ae}=V;if(this.isSpriteLoaded[B][X]=ae,this.workerSources[B]&&this.workerSources[B][X])for(const le in this.workerSources[B][X]){const ce=this.workerSources[B][X][le];for(const we in ce){const re=ce[we];re instanceof _s&&(re.isSpriteLoaded=ae,re.fire(new U.z("isSpriteLoaded")))}}}setImages(B,V,X){this.availableImages[B]||(this.availableImages[B]={});const{scope:ae,images:le}=V;if(this.availableImages[B][ae]=le,this.workerSources[B]&&this.workerSources[B][ae]){for(const ce in this.workerSources[B][ae]){const we=this.workerSources[B][ae][ce];for(const re in we)we[re].availableImages=le}X()}else X()}setModels(B,{scope:V,models:X},ae){if(this.availableModels[B]||(this.availableModels[B]={}),this.availableModels[B][V]=X,this.workerSources[B]&&this.workerSources[B][V]){for(const le in this.workerSources[B][V]){const ce=this.workerSources[B][V][le];for(const we in ce)ce[we].availableModels=X}ae()}else ae()}setProjection(B,V){this.projections[B]=U.c4(V)}setBrightness(B,V,X){this.brightness=V,X()}setContextParams(B,V,X){this.maxUniformBufferBindings=V.maxBindingPoints,this.maxUniformBlockSizeDwords=V.maxUniformBlockSizeDwords,this.disableSymbolUBO=V.disableSymbolUBO,X()}setWorldview(B,V,X){this.worldview=V,X()}setLayers(B,V,X){this.getLayerIndex(B,V.scope).replace(V.layers,V.options),X()}updateLayers(B,V,X){this.getLayerIndex(B,V.scope).update(V.layers,V.removedIds,V.options),X()}loadTile(B,V,X){V.projection=this.projections[B]||this.defaultProjection,this.getWorkerSource(B,V).loadTile(V,X)}decodeRasterArray(B,V,X){this.getWorkerSource(B,V).decodeRasterArray(V,X)}reloadTile(B,V,X){V.projection=this.projections[B]||this.defaultProjection,this.getWorkerSource(B,V).reloadTile(V,X)}abortTile(B,V,X){this.getWorkerSource(B,V).abortTile(V,X)}removeTile(B,V,X){this.getWorkerSource(B,V).removeTile(V,X)}removeSource(B,V,X){if(!(this.workerSources[B]&&this.workerSources[B][V.scope]&&this.workerSources[B][V.scope][V.type]&&this.workerSources[B][V.scope][V.type][V.source]))return;const ae=this.workerSources[B][V.scope][V.type][V.source];delete this.workerSources[B][V.scope][V.type][V.source],ae.removeSource!==void 0?ae.removeSource(V,X):X()}loadTileProvider(B,V,X){U.aT(V.name,V.url).then(ae=>{const le=new ae(V.options);return this.getWorkerSource(B,{type:V.type,source:V.source,scope:V.scope},le),le.load&&V.request?le.load({request:V.request}):null}).then(ae=>X(null,ae)).catch(ae=>X(ae instanceof Error?ae:new Error(String(ae))))}async syncRTLPluginState(B,V,X){if(U.fJ.isParsed())return void X(null,!0);if(U.fJ.isParsing())return void this.rtlPluginParsingListeners.push(X);U.fJ.setState(V);const ae=U.fJ.getPluginURL();if(!U.fJ.isLoaded()||U.fJ.isParsed()||U.fJ.isParsing())X(null,!1);else{U.fJ.setState({pluginStatus:U.fK.parsing,pluginURL:ae});try{await import(ae),U.fJ.isParsed()?X(null,!0):this.rtlPluginParsingListeners.push(X)}catch(le){U.fJ.setState({pluginStatus:U.fK.error,pluginURL:ae}),X(le);for(const ce of this.rtlPluginParsingListeners)ce(le);this.rtlPluginParsingListeners=[]}}}setConfig(B,V){Object.assign(U.g,V)}getAvailableImages(B,V){this.availableImages[B]||(this.availableImages[B]={});let X=this.availableImages[B][V];return X||(X=[]),X}getAvailableModels(B,V){this.availableModels[B]||(this.availableModels[B]={});let X=this.availableModels[B][V];return X||(X={}),X}getLayerIndex(B,V){this.layerIndexes[B]||(this.layerIndexes[B]={});let X=this.layerIndexes[B][V];return X||(X=this.layerIndexes[B][V]=new ps,X.scope=V),X}getWorkerSource(B,V,X){const{type:ae,source:le,scope:ce}=V,we=this.workerSources;if(we[B]||(we[B]={}),we[B][ce]||(we[B][ce]={}),we[B][ce][ae]||(we[B][ce][ae]={}),this.isSpriteLoaded[B]||(this.isSpriteLoaded[B]={}),we[B][ce][ae][le])X&&(we[B][ce][ae][le].tileProvider=X);else{const re={send:(Ve,Oe,Ke,ut,dt,Dt)=>this.actor.send(Ve,Oe,Ke,B,dt,Dt),scheduler:this.actor.scheduler},ye=this.workerSourceTypes[ae];if(!ye)throw new Error(`Unknown worker source type "${ae}".`);we[B][ce][ae][le]=new ye({actor:re,layerIndex:this.getLayerIndex(B,ce),availableImages:this.getAvailableImages(B,ce),availableModels:this.getAvailableModels(B,ce),isSpriteLoaded:this.isSpriteLoaded[B][ce],tileProvider:X,brightness:this.brightness,worldview:this.worldview,maxUniformBufferBindings:this.maxUniformBufferBindings,maxUniformBlockSizeDwords:this.maxUniformBlockSizeDwords,disableSymbolUBO:this.disableSymbolUBO})}return we[B][ce][ae][le]}enforceCacheSizeLimit(B,V){U.fL(V)}getWorkerPerformanceMetrics(B,V,X){X(void 0,void 0)}}return U.fI(self)&&(self.worker=new Za(self)),Za}),Gl(["./shared"],function(h){var U="3.24.0";const sn={create:"create",load:"load",fullLoad:"fullLoad"},ji={mark(a){performance.mark(a)},measure(a,t,o){performance.measure(a,t,o)}};function eu(a){const t=a.name.split("?")[0];return h.a(t)&&t.includes("mapbox-gl.js")?"javascript":h.a(t)&&t.includes("mapbox-gl.css")?"css":h.b(t)?"fontRange":h.c(t)?"sprite":h.i(t)?"style":h.d(t)?"tilejson":"other"}var $l,ps={},ms=(function(){if($l)return ps;function a(c){return!t(c)}function t(c){return typeof window>"u"||typeof document>"u"?"not a browser":(function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var m,_,y=new Blob([""],{type:"text/javascript"}),v=URL.createObjectURL(y);try{_=new Worker(v),m=!0}catch{m=!1}return _&&_.terminate(),URL.revokeObjectURL(v),m})()?(function(){var m=document.createElement("canvas");m.width=m.height=1;var _=m.getContext("2d");if(!_)return!1;var y=_.getImageData(0,0,1,1);return y&&y.width===m.width})()?(o[d=c&&c.failIfMajorPerformanceCaveat]===void 0&&(o[d]=(function(m){var _,y=(function(v){var T=document.createElement("canvas"),I=Object.create(a.webGLContextAttributes);return I.failIfMajorPerformanceCaveat=v,T.getContext("webgl2",I)})(m);if(!y)return!1;try{_=y.createShader(y.VERTEX_SHADER)}catch{return!1}return!(!_||y.isContextLost())&&(y.shaderSource(_,"void main() {}"),y.compileShader(_),y.getShaderParameter(_,y.COMPILE_STATUS)===!0)})(d)),o[d]?document.documentMode?"insufficient ECMAScript 6 support":void 0:"insufficient WebGL2 support"):"insufficient Canvas/getImageData support":"insufficient worker support";var d}$l=1,ps.supported=a,ps.notSupportedReason=t;var o={};return a.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0},ps})();const Na=/firefox/i,Hl=/macintosh/i;function Ot(a,t,o){const c=document.createElement(a);return t!=null&&(c.className=t),o&&o.appendChild(c),c}function an(a,t,o){const c=document.createElementNS("http://www.w3.org/2000/svg",a);for(const d of Object.keys(t))c.setAttributeNS(null,d,String(t[d]));return o&&o.appendChild(c),c}const gi=typeof document<"u"?document.documentElement&&document.documentElement.style:null,Cr=gi&&gi.userSelect!==void 0?"userSelect":"WebkitUserSelect";let Br;function jo(){gi&&Cr&&(Br=gi[Cr],gi[Cr]="none")}function Go(){gi&&Cr&&(gi[Cr]=Br)}function Yn(a){a.preventDefault(),a.stopPropagation(),window.removeEventListener("click",Yn,!0)}function _s(){window.addEventListener("click",Yn,!0),window.setTimeout(()=>{window.removeEventListener("click",Yn,!0)},0)}function $o(a,t){const o=a.getBoundingClientRect();return Zl(a,o,t)}function Ys(a,t){const o=a.getBoundingClientRect(),c=[];for(let d=0;d<t.length;d++)c.push(Zl(a,o,t[d]));return c}function ql(a){return Na.test(navigator.userAgent)&&Hl.test(navigator.userAgent)&&a.button===2&&a.ctrlKey?0:a.button}function Zl(a,t,o){const c=a.offsetWidth===t.width?1:a.offsetWidth/t.width;return new h.P((o.clientX-t.left)*c,(o.clientY-t.top)*c)}const Wl="01",ni=/(\.(png|jpg)\d*)(?=$)/,Xl=/^.+\/v4\//,xr=/\.[\w]+$/,wr=/^(\/v4\/|\/(raster|rasterarrays)\/v1\/)/,Ti=/^access_token=(.*)$/,er="NO_ACCESS_TOKEN";class Jn{constructor(t,o,c){this._transformRequestFn=t,this._customAccessToken=o,this._silenceAuthErrors=!!c,this._createSkuToken()}_createSkuToken(){const t=(function(){let o="";for(let c=0;c<10;c++)o+="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[Math.floor(62*Math.random())];return{token:["1",Wl,o].join(""),tokenExpiresAt:Date.now()+432e5}})();this._skuToken=t.token,this._skuTokenExpiresAt=t.tokenExpiresAt}_isSkuTokenExpired(){return Date.now()>this._skuTokenExpiresAt}transformRequest(t,o){return this._transformRequestFn&&this._transformRequestFn(t,o)||{url:t}}
7normalizeStyleURL(t,o){if(!h.e(t))return t;const c=vr(t);return c.params.push(`sdk=js-${U}`),c.path=`/styles/v1${c.path}`,this._makeAPIURL(c,this._customAccessToken||o)}normalizeGlyphsURL(t,o){if(!h.e(t))return t;const c=vr(t);return c.path=`/fonts/v1${c.path}`,this._makeAPIURL(c,this._customAccessToken||o)}normalizeModelURL(t,o){if(!h.e(t))return t;const c=vr(t);return c.path=`/models/v1${c.path}`,this._makeAPIURL(c,this._customAccessToken||o)}normalizeSourceURL(t,o,c,d){if(!h.e(t))return t;const m=vr(t);return m.path=`/v4/${m.authority}.json`,m.params.push("secure"),c&&m.params.push(`language=${c}`),d&&m.params.push(`worldview=${d}`),this._makeAPIURL(m,this._customAccessToken||o)}normalizeIconsetURL(t,o){const c=vr(t);return h.e(t)?(c.path=`/styles/v1${c.path}/iconset.pbf`,this._makeAPIURL(c,this._customAccessToken||o)):bn(c)}normalizeSpriteURL(t,o,c,d){const m=vr(t);return h.e(t)?(m.path=`/styles/v1${m.path}/sprite${o}${c}`,this._makeAPIURL(m,this._customAccessToken||d)):(m.path+=`${o}${c}`,bn(m))}normalizeTileURL(t,o,c){if(this._isSkuTokenExpired()&&this._createSkuToken(),t&&!h.e(t))return t;const d=vr(t);d.path=d.path.replace(ni,`${o||c&&d.authority!=="raster"&&c===512?"@2x":""}${h.k.supported?".webp":"$1"}`),d.authority==="raster"?d.path=`/${h.g.RASTER_URL_PREFIX}${d.path}`:d.authority==="rasterarrays"?d.path=`/${h.g.RASTERARRAYS_URL_PREFIX}${d.path}`:d.authority==="3dtiles"?d.path=`/${h.g.TILES3D_URL_PREFIX}${d.path}`:(d.path=d.path.replace(Xl,"/"),d.path=`/${h.g.TILE_URL_VERSION}${d.path}`);const m=this._customAccessToken||(function(_){for(const y of _){const v=y.match(Ti);if(v)return v[1]}return null})(d.params)||h.g.ACCESS_TOKEN;return h.g.REQUIRE_ACCESS_TOKEN&&m&&this._skuToken&&d.params.push(`sku=${this._skuToken}`),this._makeAPIURL(d,m)}canonicalizeTileURL(t,o){const c=vr(t);if(!wr.test(c.path)||!xr.test(c.path))return t;let d="mapbox://";c.path.startsWith("/raster/v1/")?d+=`raster/${c.path.replace(`/${h.g.RASTER_URL_PREFIX}/`,"")}`:c.path.startsWith("/rasterarrays/v1/")?d+=`rasterarrays/${c.path.replace(`/${h.g.RASTERARRAYS_URL_PREFIX}/`,"")}`:d+=`tiles/${c.path.replace(`/${h.g.TILE_URL_VERSION}/`,"")}`;let m=c.params;return o&&(m=m.filter(_=>!_.match(Ti))),m.length&&(d+=`?${m.join("&")}`),d}canonicalizeTileset(t,o){const c=!!o&&h.e(o),d=[];for(const m of t.tiles||[])h.f(m)?d.push(this.canonicalizeTileURL(m,c)):d.push(m);return d}_makeAPIURL(t,o){const c="See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes",d=vr(h.g.API_URL);if(t.protocol=d.protocol,t.authority=d.authority,t.protocol==="http"){const m=t.params.indexOf("secure");m>=0&&t.params.splice(m,1)}if(d.path!=="/"&&(t.path=`${d.path}${t.path}`),!h.g.REQUIRE_ACCESS_TOKEN)return bn(t);if(o=o||h.g.ACCESS_TOKEN,!this._silenceAuthErrors){if(!o)throw new Error(`An API access token is required to use Mapbox GL. ${c}`);if(o[0]==="s")throw new Error(`Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). ${c}`)}return t.params=t.params.filter(m=>!m.includes("access_token")),t.params.push(`access_token=${o||""}`),bn(t)}}const Yl=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function vr(a){const t=a.match(Yl);if(!t)throw new Error("Unable to parse URL object");return{protocol:t[1],authority:t[2],path:t[3]||"/",params:t[4]?t[4].split("&"):[]}}function bn(a){const t=a.params.length?`?${a.params.join("&")}`:"";return`${a.protocol}://${a.authority}${a.path}${t}`}const Ci="mapbox.eventData";function wn(a){if(!a)return null;const t=a.split(".");if(!t||t.length!==3)return null;try{return JSON.parse(h.l(t[1]))}catch{return null}}function Js(a){return!(!h.g.EVENTS_URL||!a&&!h.g.ACCESS_TOKEN)}class Ho{constructor(t){this.type=t,this.anonId=null,this.anonIdTimestamp=null,this.eventData={},this.queue=[],this.pendingRequest=null}getStorageKey(t){const o=wn(h.g.ACCESS_TOKEN);let c="";return c=o&&o.u?h.j(o.u):h.g.ACCESS_TOKEN||"",t?`${Ci}.${t}:${c}`:`${Ci}:${c}`}fetchEventData(){const t=h.s("localStorage"),o=this.getStorageKey(),c=this.getStorageKey("uuid"),d=this.getStorageKey("uuidTimestamp");if(t)try{const m=localStorage.getItem(o);m&&(this.eventData=JSON.parse(m));const _=localStorage.getItem(c);_&&(this.anonId=_);const y=localStorage.getItem(d);y&&(this.anonIdTimestamp=Number(y));const v=Date.now()-864e5;(!this.anonIdTimestamp||this.anonIdTimestamp<v)&&this.refreshUUID()}catch{h.w("Unable to read from LocalStorage")}}refreshUUID(){this.anonId=h.u(),this.anonIdTimestamp=Date.now()}saveEventData(){const t=h.s("localStorage"),o=this.getStorageKey(),c=this.getStorageKey("uuid"),d=this.getStorageKey("uuidTimestamp"),m=this.anonId,_=this.anonIdTimestamp;if(t&&m)try{localStorage.setItem(c,m),Object.keys(this.eventData).length>=1&&localStorage.setItem(o,JSON.stringify(this.eventData)),_&&localStorage.setItem(d,_.toString())}catch{h.w("Unable to write to LocalStorage")}}processRequests(t){}postEvent(t,o,c,d){if(!h.g.EVENTS_URL)return;const m=vr(h.g.EVENTS_URL);m.params.push(`access_token=${d||h.g.ACCESS_TOKEN||""}`);const _={event:this.type,created:new Date(t).toISOString()},y=o?Object.assign(_,o):_,v={url:bn(m),headers:{"Content-Type":"text/plain"},body:JSON.stringify([y])};this.pendingRequest=h.p(v,T=>{this.pendingRequest=null,c(T),this.saveEventData(),this.processRequests(d)})}queueRequest(t,o){this.queue.push(t),this.processRequests(o)}}class Jl extends Ho{constructor(t){super("metrics"),t&&(this.data=t)}postMetricsEvent(t){if(!Js(t))return;this.anonId||this.fetchEventData(),h.v(this.anonId)||this.refreshUUID();const o=Object.assign({},this.data,{sessionId:this.anonId});this.queueRequest({timestamp:Date.now(),payload:o},t)}processRequests(t){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:o,payload:c}=this.queue.shift();this.postEvent(o,c,()=>{},t)}}
vendor: 6,039 bytes, line 7
7const Kn=new class extends Ho{constructor(a){super("appUserTurnstile"),this._customAccessToken=a}postTurnstileEvent(a,t){Js(t)&&Array.isArray(a)&&a.some(o=>h.e(o)||h.f(o))&&this.queueRequest(Date.now(),t)}processRequests(a){if(this.pendingRequest||this.queue.length===0)return;this.anonId&&this.anonIdTimestamp&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();const t=wn(h.g.ACCESS_TOKEN),o=t?t.u:h.g.ACCESS_TOKEN;let c=o!==this.eventData.tokenU;h.v(this.anonId)||(this.refreshUUID(),c=!0);const d=this.queue.shift();if(this.eventData.lastSuccess){const m=new Date(this.eventData.lastSuccess),_=new Date(d),y=(d-this.eventData.lastSuccess)/864e5;c=c||y>=1||y<-1||m.getDate()!==_.getDate()}else c=!0;c?this.postEvent(d,{sdkIdentifier:"mapbox-gl-js",sdkVersion:U,skuId:Wl,"enabled.telemetry":!1,userId:this.anonId},m=>{m||(this.eventData.lastSuccess=d,this.eventData.tokenU=o)},a):this.processRequests()}},ui=Kn.postTurnstileEvent.bind(Kn),Xi=new class extends Ho{constructor(){super("map.load"),this.success={},this.skuToken=""}postMapLoadEvent(a,t,o,c){this.skuToken=t,this.errorCb=c,h.g.EVENTS_URL&&(o||h.g.ACCESS_TOKEN?this.queueRequest({id:a,timestamp:Date.now()},o):this.errorCb(new Error(er)))}processRequests(a){if(this.pendingRequest||this.queue.length===0)return;const{id:t,timestamp:o}=this.queue.shift();t&&this.success[t]||(this.anonId&&this.anonIdTimestamp||this.fetchEventData(),h.v(this.anonId)||this.refreshUUID(),this.postEvent(o,{sdkIdentifier:"mapbox-gl-js",sdkVersion:U,skuId:Wl,skuToken:this.skuToken,userId:this.anonId},c=>{c?this.errorCb(c):t&&(this.success[t]=!0)},a))}remove(){this.errorCb=null}},kr=Xi.postMapLoadEvent.bind(Xi),Ks=new class extends Ho{constructor(){super("style.load"),this.eventIdPerMapInstanceMap=new Map,this.mapInstanceIdMap=new WeakMap}getMapInstanceId(a){let t=this.mapInstanceIdMap.get(a);return t||(t=h.u(),this.mapInstanceIdMap.set(a,t)),t}getEventId(a){const t=this.eventIdPerMapInstanceMap.get(a)||0;return this.eventIdPerMapInstanceMap.set(a,t+1),t}postStyleLoadEvent(a,t){const{map:o,style:c,importedStyles:d}=t;if(!Js(a))return;const m=this.getMapInstanceId(o),_={mapInstanceId:m,eventId:this.getEventId(m),style:c};d.length&&(_.importedStyles=d),this.queueRequest({timestamp:Date.now(),payload:_},a)}processRequests(a){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:t,payload:o}=this.queue.shift();this.postEvent(t,o,()=>{},a)}},Pi=Ks.postStyleLoadEvent.bind(Ks),gs=new Jl({attributes:[{name:"maps/js/layer-animations/style-with-appearances"}]}),Ua=gs.postMetricsEvent.bind(gs),Va=new Jl({attributes:[{name:"maps/js/layer-animations/runtime-appearances"}]}),go=Va.postMetricsEvent.bind(Va),ki=new class extends Ho{constructor(){super("gljs.performance")}postPerformanceEvent(a,t){Js(a)&&this.queueRequest({timestamp:Date.now(),performanceData:t},a)}processRequests(a){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:t,performanceData:o}=this.queue.shift(),c=(function(d){const m=performance.getEntriesByType("resource"),_=performance.getEntriesByType("mark"),y=(function(D){const O={};if(D){for(const L in D)if(L!=="other")for(const k of D[L]){const N=`${L}ResolveRangeMin`,H=`${L}ResolveRangeMax`,Z=`${L}RequestCount`,G=`${L}RequestCachedCount`;O[N]=Math.min(O[N]||1/0,k.startTime),O[H]=Math.max(O[H]||-1/0,k.responseEnd);const ne=te=>{O[te]===void 0&&(O[te]=0),++O[te]};k.transferSize!==void 0&&k.transferSize===0&&ne(G),ne(Z)}}return O})((function(D,O){const L={};if(D)for(const k of D){const N=O(k);L[N]===void 0&&(L[N]=[]),L[N].push(k)}return L})(m,eu)),v=window.devicePixelRatio,T=navigator.connection||navigator.mozConnection||navigator.webkitConnection,I=T?T.effectiveType:void 0,P={counters:[],metadata:[],attributes:[]},A=(D,O,L)=>{L!=null&&D.push({name:O,value:L.toString()})};for(const D in y)A(P.counters,D,y[D]);if(d.interactionRange[0]!==1/0&&d.interactionRange[1]!==-1/0&&(A(P.counters,"interactionRangeMin",d.interactionRange[0]),A(P.counters,"interactionRangeMax",d.interactionRange[1])),_)for(const D of Object.values(sn)){const O=_.find(L=>L.name===D);O&&A(P.counters,D,O.startTime)}return A(P.counters,"visibilityHidden",d.visibilityHidden),A(P.attributes,"style",(function(D){if(D)for(const O of D){const L=O.name.split("?")[0];if(h.i(L)){const k=L.split("/").slice(-2);if(k.length===2)return`mapbox://styles/${k[0]}/${k[1]}`}}})(m)),A(P.attributes,"terrainEnabled",d.terrainEnabled?"true":"false"),A(P.attributes,"fogEnabled",d.fogEnabled?"true":"false"),A(P.attributes,"projection",d.projection),A(P.attributes,"zoom",d.zoom),A(P.metadata,"devicePixelRatio",v),A(P.metadata,"connectionEffectiveType",I),A(P.metadata,"navigatorUserAgent",navigator.userAgent),A(P.metadata,"screenWidth",window.screen.width),A(P.metadata,"screenHeight",window.screen.height),A(P.metadata,"windowWidth",window.innerWidth),A(P.metadata,"windowHeight",window.innerHeight),A(P.metadata,"mapWidth",d.width/v),A(P.metadata,"mapHeight",d.height/v),A(P.metadata,"webglRenderer",d.renderer),A(P.metadata,"webglVendor",d.vendor),A(P.metadata,"sdkVersion",U),A(P.metadata,"sdkIdentifier","mapbox-gl-js"),P})(o);for(const d of c.metadata);for(const d of c.counters);for(const d of c.attributes);this.postEvent(t,c,()=>{},a)}},ja=ki.postPerformanceEvent.bind(ki),Qs=new class extends Ho{constructor(){super("map.auth"),this.success={},this.skuToken=""}getSession(a,t,o,c){if(!h.g.API_URL||!h.g.SESSION_PATH)return;const d=vr(h.g.API_URL+h.g.SESSION_PATH);d.params.push(`sku=${t||""}`),d.params.push(`access_token=${c||h.g.ACCESS_TOKEN||""}`);const m={url:bn(d),headers:{"Content-Type":"text/plain"}};this.pendingRequest=h.h(m,_=>{this.pendingRequest=null,o(_),this.saveEventData(),this.processRequests(c)})}getSessionAPI(a,t,o,c){this.skuToken=t,this.errorCb=c,h.g.EVENTS_URL&&h.g.SESSION_PATH&&h.g.API_URL&&(o||h.g.ACCESS_TOKEN?this.queueRequest({id:a,timestamp:Date.now()},o):this.errorCb(new Error(er)))}processRequests(a){if(this.pendingRequest||this.queue.length===0)return;const{id:t,timestamp:o}=this.queue.shift();
7t&&this.success[t]||this.getSession(o,this.skuToken,c=>{c?this.errorCb(c):t&&(this.success[t]=!0)},a)}remove(){this.errorCb=null}},Ga=Qs.getSessionAPI.bind(Qs),ea=new Set;function qo(a,t){t?ea.add(a):ea.delete(a)}class ln{constructor(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSourceCaches={},this._updatedPaintProps=new Set,this._updatedImages={}}isDirty(){return this._changed}setDirty(){this._changed=!0}getUpdatedSourceCaches(){return this._updatedSourceCaches}updateSourceCache(t,o){this._updatedSourceCaches[t]=o,this.setDirty()}discardSourceCacheUpdate(t){delete this._updatedSourceCaches[t]}updateLayer(t){const o=t.scope;this._updatedLayers[o]=this._updatedLayers[o]||new Set,this._updatedLayers[o].add(t.id),this.setDirty()}removeLayer(t){const o=t.scope;this._removedLayers[o]=this._removedLayers[o]||{},this._updatedLayers[o]=this._updatedLayers[o]||new Set,this._removedLayers[o][t.id]=t,this._updatedLayers[o].delete(t.id),this._updatedPaintProps.delete(t.fqid),this.setDirty()}getRemovedLayer(t){return this._removedLayers[t.scope]?this._removedLayers[t.scope][t.id]:null}discardLayerRemoval(t){this._removedLayers[t.scope]&&delete this._removedLayers[t.scope][t.id]}getLayerUpdatesByScope(){const t={};for(const o in this._updatedLayers)t[o]=t[o]||{},t[o].updatedIds=Array.from(this._updatedLayers[o].values());for(const o in this._removedLayers)t[o]=t[o]||{},t[o].removedIds=Object.keys(this._removedLayers[o]);return t}getUpdatedPaintProperties(){return this._updatedPaintProps}updatePaintProperties(t){this._updatedPaintProps.add(t.fqid),this.setDirty()}getUpdatedImages(t){return this._updatedImages[t]?Array.from(this._updatedImages[t].values()):[]}updateImage(t,o){this._updatedImages[o]=this._updatedImages[o]||new Set,this._updatedImages[o].add(h.I.toString(t)),this.setDirty()}resetUpdatedImages(t){this._updatedImages[t]&&this._updatedImages[t].clear()}reset(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSourceCaches={},this._updatedPaintProps.clear(),this._updatedImages={}}}function ys(a){const{userImage:t}=a;return!!(t&&t.render&&t.render())&&(a.data.replace(new Uint8Array(t.data.buffer)),!0)}const xs=new h.C(0,0,0);function $a(a,t,o){a===1&&t.icons.push((function(c,d){return(function(m){if(m.usvg_tree.height||(m.usvg_tree.height=m.usvg_tree.width),!m.metadata)return m;const{metadata:_}=m;if(_.content_area){const{content_area:y}=_;y.left==null&&(y.left=0),y.top==null&&(y.top=y.left),y.width==null&&(y.width=m.usvg_tree.width),y.height==null&&(y.height=y.width)}if(_.text_placeholder){const{text_placeholder:y}=_;y.top==null&&(y.top=y.left),y.height==null&&(y.height=y.width)}return _.stretch_x&&_.stretch_x.length&&ta(_,"x"),_.stretch_y&&_.stretch_y.length&&ta(_,"y"),m})(c.readFields(cn,{name:void 0},d))})(o,o.readVarint()+o.pos))}function ta(a,t){const o=[],c=a[`stretch_${t}`];let d=null;for(let m=0;m<c.length;m++)d===null?d=o.length===0?c[0]:o.at(-1)[1]+c[m]:(o.push([d,d+c[m]]),d=null);a[`stretch_${t}_areas`]=o}function cn(a,t,o){a===1?t.name=o.readString():a===2?t.metadata=(function(c,d){return c.readFields(Kl,{stretch_x:null,stretch_y:null,stretch_x_areas:null,stretch_y_areas:null,variables:[]},d)})(o,o.readVarint()+o.pos):a===3&&(t.usvg_tree=(function(c,d){return c.readFields(Nr,{width:20,children:[],linear_gradients:[],radial_gradients:[],clip_paths:[],masks:[]},d)})(o,o.readVarint()+o.pos),t.data="usvg_tree")}function Kl(a,t,o){a===1?t.stretch_x=o.readPackedVarint():a===2?t.stretch_y=o.readPackedVarint():a===3?t.content_area=Tn(o,o.readVarint()+o.pos):a===4?t.variables.push((function(c,d){return c.readFields(Ql,{name:void 0},d)})(o,o.readVarint()+o.pos)):a===5&&(t.text_placeholder=Tn(o,o.readVarint()+o.pos))}function Tn(a,t){return a.readFields(tu,{},t)}function tu(a,t,o){a===1?t.left=o.readVarint():a===2?t.width=o.readVarint():a===3?t.top=o.readVarint():a===4&&(t.height=o.readVarint())}function Ql(a,t,o){a===1?t.name=o.readString():a===2&&(t.rgb_color=yo(o.readVarint()),t.value="rgb_color")}function Nr(a,t,o){a===1?t.width=t.height=o.readVarint():a===2?t.height=o.readVarint():a===3?t.children.push(Qn(o,o.readVarint()+o.pos)):a===4?t.linear_gradients.push((function(c,d){return c.readFields(iu,{spread_method:1,stops:[],x1:0,y1:0,x2:1,y2:0},d)})(o,o.readVarint()+o.pos)):a===5?t.radial_gradients.push((function(c,d){return c.readFields(Ch,{spread_method:1,stops:[],cx:.5,cy:.5,r:.5,fx:.5,fy:.5,fr:0},d)})(o,o.readVarint()+o.pos)):a===7?t.clip_paths.push((function(c,d){return c.readFields(qa,{children:[]},d)})(o,o.readVarint()+o.pos)):a===8&&t.masks.push((function(c,d){const m=c.readFields(Ue,{left:0,width:20,mask_type:1,children:[]},d);return m.height==null&&(m.height=m.width),m.top==null&&(m.top=m.left),m})(o,o.readVarint()+o.pos))}function Qn(a,t){return a.readFields(Zo,{},t)}function Zo(a,t,o){a===1?(t.group=(function(c,d){return c.readFields(ia,{opacity:255,children:[]},d)})(o,o.readVarint()+o.pos),t.node="group"):a===2&&(t.path=(function(c,d){return c.readFields(na,{paint_order:1,commands:[],step:1,diffs:[],rule:1},d)})(o,o.readVarint()+o.pos),t.node="path")}function ia(a,t,o){a===1?t.transform=eo(o,o.readVarint()+o.pos):a===2?t.opacity=o.readVarint():a===5?t.clip_path_idx=o.readVarint():a===6?t.mask_idx=o.readVarint():a===7&&t.children.push(Qn(o,o.readVarint()+o.pos))}function eo(a,t){return a.readFields(ra,{sx:1,ky:0,kx:0,sy:1,tx:0,ty:0},t)}function ra(a,t,o){a===1?t.sx=o.readFloat():a===2?t.ky=o.readFloat():a===3?t.kx=o.readFloat():a===4?t.sy=o.readFloat():a===5?t.tx=o.readFloat():a===6&&(t.ty=o.readFloat())}function na(a,t,o){a===1?t.fill=(function(c,d){return c.readFields(ec,{rgb_color:xs,paint:"rgb_color",opacity:255},d)})(o,o.readVarint()+o.pos):a===2?t.stroke=(function(c,d){return c.readFields(tc,{rgb_color:xs,paint:"rgb_color",dasharray:[],dashoffset:0,miterlimit:4,opacity:255,width:1,linecap:1,linejoin:1},d)})(o,o.readVarint()+o.pos):a===3?t.paint_order=o.readVarint():a===5?o.readPackedVarint(t.commands):a===6?t.step=o.readFloat():a===7?o.readPackedSVarint(t.diffs):a===8&&(t.rule=o.readVarint())}function ec(a,t,o){a===1?(t.rgb_color=yo(o.readVarint()),t.paint="rgb_color"):a===2?(t.linear_gradient_idx=o.readVarint(),t.paint="linear_gradient_idx"):a===3?(t.radial_gradient_idx=o.readVarint(),t.paint="radial_gradient_idx"):a===5&&(t.opacity=o.readVarint())}function yo(a){return new h.C((a>>16&255)/255,(a>>8&255)/255,(255&a)/255,1)}function tc(a,t,o){a===1?(t.rgb_color=yo(o.readVarint()),t.paint="rgb_color"):a===2?(t.linear_gradient_idx=o.readVarint(),t.paint="linear_gradient_idx"):a===3?(t.radial_gradient_idx=o.readVarint(),t.paint="radial_gradient_idx"):a===5?o.readPackedFloat(t.dasharray):a===6?t.dashoffset=o.readFloat():a===7?t.miterlimit=o.readFloat():a===8?t.opacity=o.readVarint():a===9?t.width=o.readFloat():a===10?t.linecap=o.readVarint():a===11&&(t.linejoin=o.readVarint())}function iu(a,t,o){a===1?t.transform=eo(o,o.readVarint()+o.pos):a===2?t.spread_method=o.readVarint():a===3?t.stops.push(Ha(o,o.readVarint()+o.pos)):a===4?t.x1=o.readFloat():a===5?t.y1=o.readFloat():a===6?t.x2=o.readFloat():a===7&&(t.y2=o.readFloat())}function Ha(a,t){return a.readFields(ru,{offset:0,opacity:255,rgb_color:xs},t)}function ru(a,t,o){a===1?t.offset=o.readFloat():a===2?t.opacity=o.readVarint():a===3&&(t.rgb_color=yo(o.readVarint()))}function Ch(a,t,o){a===1?t.transform=eo(o,o.readVarint()+o.pos):a===2?t.spread_method=o.readVarint():a===3?t.stops.push(Ha(o,o.readVarint()+o.pos)):a===4?t.cx=o.readFloat():a===5?t.cy=o.readFloat():a===6?t.r=o.readFloat():a===7?t.fx=o.readFloat():a===8?t.fy=o.readFloat():a===9&&(t.fr=o.readFloat())}function qa(a,t,o){a===1?t.transform=eo(o,o.readVarint()+o.pos):a===2?t.clip_path_idx=o.readVarint():a===3&&t.children.push(Qn(o,o.readVarint()+o.pos))}function Ue(a,t,o){a===1?t.left=t.top=o.readFloat():a===2?t.width=t.height=o.readFloat():a===3?t.top=o.readFloat():a===4?t.height=o.readFloat():a===5?t.mask_type=o.readVarint():a===6?t.mask_idx=o.readVarint():a===7&&t.children.push(Qn(o,o.readVarint()+o.pos))}class Wo{static calculate(t={},o=[]){const c=new Map,d=new Map;if(Object.keys(t).length===0)return c;o.forEach(m=>{d.set(m.name,m.rgb_color||new h.C(0,0,0))});for(const[m,_]of Object.entries(t))d.has(m)?c.set(d.get(m).toString(),_):console.warn(`Ignoring unknown image variable "${m}"`);return c}}function vs(a,t=255,o){const c=o.get(a.toString())||a;if(t===255)return c.toString();const d=c.clone();return d.a*=t/255,d.toString()}const oa=[];let Za=0;function _e(a,t){if(Za>=oa.length){const c=h.r()?new OffscreenCanvas(a,t):document.createElement("canvas");oa.push(c.getContext("2d",{willReadFrequently:!0}))}const o=oa[Za++];return o.canvas.width=a,o.canvas.height=t,o}function B(){Za--}function V(a,t,o,c,d){for(const m of c.children)X(a,t,o,m,d)}function X(a,t,o,c,d){c.group?(a.save(),(function(m,_,y,v,T){const I=v.mask_idx!=null?y.masks[v.mask_idx]:null,P=v.clip_path_idx!=null?y.clip_paths[v.clip_path_idx]:null;if(v.transform&&(_=Ke(v.transform).preMultiplySelf(_)),!(function(D,O,L){return D.opacity!==255||O||L})(v,P!=null,I!=null))return void V(m,_,y,v,T);const A=_e(m.canvas.width,m.canvas.height);V(A,_,y,v,T),P&&Ve(A,_,y,P),I&&Oe(A,_,y,I,T),m.globalAlpha=v.opacity/255,m.drawImage(A.canvas,0,0),B()}
vendor: 28,578 bytes, lines 7-8
7)(a,t,o,c.group,d),a.restore()):c.path&&(a.save(),(function(m,_,y,v,T){m.setTransform(_),v.paint_order===1?(ae(m,y,v,T),ce(m,y,v,T)):(ce(m,y,v,T),ae(m,y,v,T))})(a,t,o,c.path,d),a.restore())}function ae(a,t,o,c){const d=o.fill;if(!d)return;const m=d.opacity/255;switch(a.save(),a.beginPath(),ut(o,a),d.paint){case"rgb_color":a.fillStyle=vs(d.rgb_color,d.opacity,c);break;case"linear_gradient_idx":{const _=t.linear_gradients[d.linear_gradient_idx];_.transform&&a.setTransform(Ke(_.transform).preMultiplySelf(a.getTransform())),a.fillStyle=we(a,_,m,c);break}case"radial_gradient_idx":{const _=t.radial_gradients[d.radial_gradient_idx];_.transform&&a.setTransform(Ke(_.transform).preMultiplySelf(a.getTransform())),a.fillStyle=re(a,_,m,c)}}a.fill(le(o)),a.restore()}function le(a){return a.rule===1?"nonzero":a.rule===2?"evenodd":void 0}function ce(a,t,o,c){const d=o.stroke;if(!d)return;const m=dt(o);a.lineWidth=d.width,a.miterLimit=d.miterlimit,a.setLineDash(d.dasharray),a.lineDashOffset=d.dashoffset;const _=d.opacity/255;switch(d.paint){case"rgb_color":a.strokeStyle=vs(d.rgb_color,d.opacity,c);break;case"linear_gradient_idx":a.strokeStyle=we(a,t.linear_gradients[d.linear_gradient_idx],_,c,!0);break;case"radial_gradient_idx":a.strokeStyle=re(a,t.radial_gradients[d.radial_gradient_idx],_,c,!0)}switch(d.linejoin){case 2:case 1:a.lineJoin="miter";break;case 3:a.lineJoin="round";break;case 4:a.lineJoin="bevel"}switch(d.linecap){case 1:a.lineCap="butt";break;case 2:a.lineCap="round";break;case 3:a.lineCap="square"}a.stroke(m)}function we(a,t,o,c,d=!1){if(t.stops.length===1){const A=t.stops[0];return vs(A.rgb_color,A.opacity*o,c)}const{x1:m,y1:_,x2:y,y2:v}=t;let T=new DOMPoint(m,_),I=new DOMPoint(y,v);if(d){const A=Ke(t.transform);T=A.transformPoint(T),I=A.transformPoint(I)}const P=a.createLinearGradient(T.x,T.y,I.x,I.y);for(const A of t.stops)P.addColorStop(A.offset,vs(A.rgb_color,A.opacity*o,c));return P}function re(a,t,o,c,d=!1){if(t.stops.length===1){const N=t.stops[0];return vs(N.rgb_color,N.opacity*o,c)}const m=Ke(t.transform),{fx:_,fy:y,fr:v,cx:T,cy:I,r:P}=t;let A=new DOMPoint(_,y),D=new DOMPoint(T,I),O=v,L=P;if(d){A=m.transformPoint(A),D=m.transformPoint(D);const N=(m.a+m.d)/2;O=v*N,L=t.r*N}const k=a.createRadialGradient(A.x,A.y,O,D.x,D.y,L);for(const N of t.stops)k.addColorStop(N.offset,vs(N.rgb_color,N.opacity*o,c));return k}function ye(a,t,o,c){const d=c.transform?Ke(c.transform).preMultiplySelf(t):t,m=_e(a.canvas.width,a.canvas.height);for(const y of c.children)if(y.group)ye(m,d,o,y.group);else if(y.path){const v=y.path,T=new Path2D;T.addPath(dt(v),d),m.fill(T,le(v))}const _=c.clip_path_idx!=null?o.clip_paths[c.clip_path_idx]:null;_&&Ve(m,d,o,_),a.globalCompositeOperation="source-over",a.drawImage(m.canvas,0,0),B()}function Ve(a,t,o,c){const d=_e(a.canvas.width,a.canvas.height);ye(d,t,o,c),a.globalCompositeOperation="destination-in",a.drawImage(d.canvas,0,0),B()}function Oe(a,t,o,c,d){if(c.children.length===0)return;const m=c.mask_idx!=null?o.masks[c.mask_idx]:null;m&&Oe(a,t,o,m,d);const _=a.canvas.width,y=a.canvas.height,v=_e(_,y),T=c.width,I=c.height,P=c.left,A=c.top,D=new Path2D,O=new Path2D;O.rect(P,A,T,I),D.addPath(O,t),v.clip(D);for(const N of c.children)X(v,t,o,N,d);const L=v.getImageData(0,0,_,y),k=L.data;if(c.mask_type===1)for(let N=0;N<k.length;N+=4)k[N+3]=k[N+3]/255*(.2126*k[N]+.7152*k[N+1]+.0722*k[N+2]);v.putImageData(L,0,0),a.globalCompositeOperation="destination-in",a.drawImage(v.canvas,0,0),B()}function Ke(a){return a?new DOMMatrix([a.sx,a.ky,a.kx,a.sy,a.tx,a.ty]):new DOMMatrix}function ut(a,t){const o=a.step;let c=a.diffs[0]*o,d=a.diffs[1]*o;t.moveTo(c,d);for(let m=0,_=2;m<a.commands.length;m++)switch(a.commands[m]){case 1:c+=a.diffs[_++]*o,d+=a.diffs[_++]*o,t.moveTo(c,d);break;case 2:c+=a.diffs[_++]*o,d+=a.diffs[_++]*o,t.lineTo(c,d);break;case 3:{const y=c+a.diffs[_++]*o,v=d+a.diffs[_++]*o;c=y+a.diffs[_++]*o,d=v+a.diffs[_++]*o,t.quadraticCurveTo(y,v,c,d);break}case 4:{const y=c+a.diffs[_++]*o,v=d+a.diffs[_++]*o,T=y+a.diffs[_++]*o,I=v+a.diffs[_++]*o;c=T+a.diffs[_++]*o,d=I+a.diffs[_++]*o,t.bezierCurveTo(y,v,T,I,c,d);break}case 5:t.closePath();break}return t}function dt(a){return ut(a,new Path2D)}class Dt{constructor(){this.cacheMap=new Map,this.cacheDependenciesMap=new Map}static _getImage(t){return new h.q(t,t.data)}getFromCache(t,o,c){return this.cacheMap.has(c)||this.cacheMap.set(c,new h.L(150)),this.cacheMap.get(c).get(h.t(t.toString(),o))}setInCache(t,o,c,d){this.cacheDependenciesMap.has(d)||this.cacheDependenciesMap.set(d,new Map),this.cacheMap.has(d)||this.cacheMap.set(d,new h.L(150));const m=this.cacheDependenciesMap.get(d),_=h.t(t.id.toString(),c);m.get(_)||m.set(_,new Set);const y=this.cacheMap.get(d),v=t.toString();m.get(_).add(v),y.put(h.t(t.toString(),c),o)}removeImagesFromCacheByIds(t,o,c=0){if(!this.cacheMap.has(c)||!this.cacheDependenciesMap.has(c))return;const d=this.cacheMap.get(c),m=this.cacheDependenciesMap.get(c);for(const _ of t){const y=h.t(_.toString(),o);if(m.has(y)){for(const v of m.get(y))d.delete(v);m.delete(y)}}}rasterize(t,o,c,d){const m=this.getFromCache(t,c,d);if(m)return m.clone();const _=(function(v,T){const I=Wo.calculate(T.params,v.metadata?v.metadata.variables:[]),P=v.usvg_tree,A=P.width,D=P.height,O=Math.max(1,Math.round(A*T.sx)),L=Math.max(1,Math.round(D*T.sy)),k=new DOMMatrix([O/A,0,0,L/D,0,0]),N=_e(O,L);V(N,k,P,P,I);const H=N.getImageData(0,0,O,L);return B(),H})(o.icon,t),y=Dt._getImage(_);return this.setInCache(t,y,c,d),y.clone()}}class Et extends h.E{constructor(t){super(),this.imageProviders=new Map,this.images=new Map,this.updatedImages=new Map,this.callbackDispatchedThisFrame=new Map,this.imageVersions=new Map,this.loaded=new Map,this.requestors=[],this.patterns=new Map,this.patternsInFlight=new Set,this.atlasImage=new Map,this.atlasTexture=new Map,this.imageAtlasCache=new h.x,this.dirty=!0,this.spriteFormat=t,this.imageRasterizer=new Dt}addScope(t){this.loaded.set(t,!1),this.imageProviders.set(t,new Map),this.images.set(t,new Map),this.updatedImages.set(t,new Set),this.callbackDispatchedThisFrame.set(t,new Set),this.imageVersions.set(t,new Map),this.patterns.set(t,new Map),this.atlasImage.set(t,new h.q({width:1,height:1}))}removeScope(t){this.loaded.delete(t),this.imageProviders.delete(t),this.images.delete(t),this.updatedImages.delete(t),this.callbackDispatchedThisFrame.delete(t),this.imageVersions.delete(t),this.patterns.delete(t),this.atlasImage.delete(t);const o=this.atlasTexture.get(t);o&&(o.destroy(),this.atlasTexture.delete(t))}addImageProvider(t,o){this.imageProviders.has(o)||this.imageProviders.set(o,new Map),this.imageProviders.get(o).set(t.id,t)}removeImageProvider(t,o){this.imageProviders.has(o)&&this.imageProviders.get(o).delete(t)}getPendingImageProviders(){const t=[];for(const o of this.imageProviders.values())for(const c of o.values())c.hasPendingRequests()&&t.push(c);return t}isLoaded(){for(const t of this.loaded.keys())if(!this.loaded.get(t))return!1;return!0}setLoaded(t,o){if(this.loaded.get(o)!==t&&(this.loaded.set(o,t),t)){for(const{ids:c,callback:d}of this.requestors)this._notify(c,o,d);this.requestors=[]}}hasImage(t,o){return!!this.getImage(t,o)}getImage(t,o){return this.images.get(o).get(t.toString())}addImage(t,o,c){if(this._validate(t,c)){this.images.get(o).set(t.toString(),c);const d=this.imageVersions.get(o),m=d.get(t.toString())||0;d.set(t.toString(),m+1)}}_validate(t,o){let c=!0;return this._validateStretch(o.stretchX,o.data&&o.data.width)||(this.fire(new h.y(new Error(`Image "${t.name}" has invalid "stretchX" value`))),c=!1),this._validateStretch(o.stretchY,o.data&&o.data.height)||(this.fire(new h.y(new Error(`Image "${t.name}" has invalid "stretchY" value`))),c=!1),this._validateContent(o.content,o)||(this.fire(new h.y(new Error(`Image "${t.name}" has invalid "content" value`))),c=!1),c}_validateStretch(t,o){if(!t)return!0;let c=0;for(const d of t){if(d[0]<c||d[1]<d[0]||o<d[1])return!1;c=d[1]}return!0}_validateContent(t,o){return t?t.length!==4||!o.usvg&&(t[0]<0||o.data.width<t[0]||t[1]<0||o.data.height<t[1]||t[2]<0||o.data.width<t[2]||t[3]<0||o.data.height<t[3])?!1:!(t[2]<t[0]||t[3]<t[1]):!0}updateImage(t,o,c){const d=this.images.get(o).get(t.toString());c.version=d.version+1,this.images.get(o).set(t.toString(),c),this.updatedImages.get(o).add(t);const m=this.imageVersions.get(o),_=m.get(t.toString())||0;m.set(t.toString(),_+1),this.removeFromImageRasterizerCache(t,o)}clearUpdatedImages(t){this.updatedImages.get(t).clear()}removeFromImageRasterizerCache(t,o){this.spriteFormat!=="raster"&&this.imageRasterizer.removeImagesFromCacheByIds([t],o)}removeImage(t,o){const c=this.images.get(o),d=c.get(t.toString());c.delete(t.toString());const m=this.imageVersions.get(o),_=m.get(t.toString())||0;m.set(t.toString(),_+1),this.patterns.get(o).delete(t.toString()),this.removeFromImageRasterizerCache(t,o),d.userImage&&d.userImage.onRemove&&d.userImage.onRemove()}listImages(t){return Array.from(this.images.get(t).keys()).map(o=>h.I.from(o))}getImageVersions(t){const o=this.imageVersions.get(t);if(o)return o}getImages(t,o,c){const d=[],m=[],_=this.imageProviders.get(o);for(const I of t){if(!I.iconsetId){d.push(I);continue}const P=_.get(I.iconsetId);P&&(this.getImage(I,o)?m.push(I):P.addPendingRequest(I))}if(d.length===0)return void this._notify(m,o,c);let y=!0;const v=!!this.loaded.get(o),T=this.images.get(o);if(!v)for(const I of d)T.has(I.toString())||(y=!1);v||y?this._notify(d,o,c):this.requestors.push({ids:d,scope:o,callback:c})}rasterizeImages(t,o){const c=new Map,{iconTasks:d,patternTasks:m,scope:_}=t;for(const y of[d,m])for(const[v,T]of y.entries()){const I=this.getImage(T.id,_);I&&c.set(v,{image:I,imageVariant:T})}o(null,this._rasterizeImages(_,c))}_rasterizeImages(t,o){const c=new Map;for(const[d,{image:m,imageVariant:_}]of o.entries())c.set(d,this.imageRasterizer.rasterize(_,m,t,0));return c}getUpdatedImages(t){return this.updatedImages.get(t)||new Set}_notify(t,o,c){const d=this.images.get(o),m=new Map;for(const _ of t){if(!d.get(_.toString())){if(_.iconsetId)continue;this.fire(new h.z("styleimagemissing",{id:_.name}))}const y=d.get(_.toString());if(!y){h.w(`Image "${_.name}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`);continue}const v={data:y.usvg?null:y.data.clone(),pixelRatio:y.pixelRatio,sdf:y.sdf,usvg:y.usvg,stretchX:y.stretchX,stretchY:y.stretchY,content:y.content,hasRenderCallback:!!(y.userImage&&y.userImage.render)};y.usvg&&Object.assign(v,{width:y.icon.usvg_tree.width,height:y.icon.usvg_tree.height}),m.set(h.I.toString(_),v)}c(null,{images:m,versions:this.getImageVersions(o)})}getPixelSize(t){const{width:o,height:c}=this.atlasImage.get(t);return{width:o,height:c}}getPattern(t,o,c){const d=t.toString(),m=this.patterns.get(o),_=m.get(d),y=this.getImage(t,o);if(!y)return null;if(_){if(_.position.version===y.version)return _.position;_.position.version=y.version}else{if(y.usvg&&!y.data){const v=this.getPatternInFlightId(d,o);if(this.patternsInFlight.has(v))return null;this.patternsInFlight.add(v);const T=new h.A(t).scaleSelf(h.o.devicePixelRatio),I=new Map([[T.toString(),{image:y,imageVariant:T}]]),P=this._rasterizeImages(o,I);return this.storePatternImage(T,o,y,c,P),null}this.storePattern(t,o,y)}return this._updatePatternAtlas(o,c),m.get(d).position}getPatternInFlightId(t,o){return h.t(t,o)}hasPatternsInFlight(){return this.patternsInFlight.size!==0}storePatternImage(t,o,c,d,m){const _=t.toString(),y=m?m.get(_):void 0;y&&(c.data=y,this.storePattern(t.id,o,c),this._updatePatternAtlas(o,d),this.patternsInFlight.delete(this.getPatternInFlightId(t.id.toString(),o)))}storePattern(t,o,c){const d={w:c.data.width+2*h.B,h:c.data.height+2*h.B,x:0,y:0},m=new h.D(d,c,h.B);this.patterns.get(o).set(t.toString(),{bin:d,position:m})}destroyAtlasTextures(){for(const t of this.atlasTexture.values())t&&t.destroy();this.atlasTexture.clear()}bind(t,o){const c=t.gl;let d=this.atlasTexture.get(o);d?this.dirty&&(d.update(this.atlasImage.get(o)),this.dirty=!1):(d=new h.T(t,this.atlasImage.get(o),c.RGBA8),this.atlasTexture.set(o,d)),d.bind(c.LINEAR,c.CLAMP_TO_EDGE)}_updatePatternAtlas(t,o){const c=this.patterns.get(t),d=Array.from(c.values()).map(({bin:T})=>T),{w:m,h:_}=h.F(d),y=this.atlasImage.get(t);y.resize({width:m||1,height:_||1});const v=this.images.get(t);for(const[T,{bin:I,position:P}]of c.entries()){let A=P.padding;const D=I.x+A,O=I.y+A,L=v.get(T).data,k=L.width,N=L.height;A=A>1?A-1:A,h.q.copy(L,y,{x:0,y:0},{x:D,y:O},{width:k,height:N},o),h.q.copy(L,y,{x:0,y:N-A},{x:D,y:O-A},{width:k,height:A},o),h.q.copy(L,y,{x:0,y:0},{x:D,y:O+N},{width:k,height:A},o),h.q.copy(L,y,{x:k-A,y:0},{x:D-A,y:O},{width:A,height:N},o),h.q.copy(L,y,{x:0,y:0},{x:D+k,y:O},{width:A,height:N},o),h.q.copy(L,y,{x:k-A,y:N-A},{x:D-A,y:O-A},{width:A,height:A},o),h.q.copy(L,y,{x:0,y:N-A},{x:D+k,y:O-A},{width:A,height:A},o),h.q.copy(L,y,{x:0,y:0},{x:D+k,y:O+N},{width:A,height:A},o),h.q.copy(L,y,{x:k-A,y:0},{x:D-A,y:O+N},{width:A,height:A},o)}this.dirty=!0}beginFrame(){for(const t of this.images.keys())this.callbackDispatchedThisFrame.set(t,new Set)}dispatchRenderCallbacks(t,o){const c=this.images.get(o);for(const d of t){if(this.callbackDispatchedThisFrame.get(o).has(d.toString()))continue;this.callbackDispatchedThisFrame.get(o).add(d.toString());const m=c.get(d.toString());ys(m)&&this.updateImage(d,o,m)}}}class Ne{constructor(t,o,c,d){this.message=(t?`${t}: `:"")+c,d&&(this.identifier=d),o!=null&&o.__line__&&(this.line=o.__line__)}}class Ct extends Ne{}function Jt(a){const t=a.value,o=a.valueSpec,c=a.style,d=a.styleSpec,m=a.key,_=a.arrayElementValidator||Di;if(!Array.isArray(t))return[new Ne(m,t,`array expected, ${h.J(t)} found`)];if(o.length&&t.length!==o.length)return[new Ne(m,t,`array length ${o.length} expected, length ${t.length} found`)];if(o["min-length"]&&t.length<o["min-length"])return[new Ne(m,t,`array length at least ${o["min-length"]} expected, length ${t.length} found`)];let y={type:o.value,values:o.values,minimum:o.minimum,maximum:o.maximum,function:void 0};d.$version<7&&(y.function=o.function),h.G(o.value)&&(y=o.value);let v=[];for(let T=0;T<t.length;T++)v=v.concat(_({array:t,arrayIndex:T,value:t[T],valueSpec:y,style:c,styleSpec:d,key:`${m}[${T}]`},!0));return v}function Gi(a){const t=a.key,o=a.value,c=a.valueSpec;if(!h.K(o))return[new Ne(t,o,`number expected, ${h.J(o)} found`)];if(o!=o)return[new Ne(t,o,"number expected, NaN found")];if("minimum"in c){let d=c.minimum;if(Array.isArray(c.minimum)&&(d=c.minimum[a.arrayIndex]),o<d)return[new Ne(t,o,`${o} is less than the minimum value ${d}`)]}if("maximum"in c){let d=c.maximum;if(Array.isArray(c.maximum)&&(d=c.maximum[a.arrayIndex]),o>d)return[new Ne(t,o,`${o} is greater than the maximum value ${d}`)]}return[]}function Ni(a){const t=a.key,o=a.value;if(!h.G(o))return[new Ne(t,o,`object expected, ${h.J(o)} found`)];const c=a.valueSpec,d=h.H(o.type);let m,_,y,v={};const T=d!=="categorical"&&o.property===void 0,I=!T,P=(function(L){const k=L.stops;return Array.isArray(k)&&Array.isArray(k[0])&&h.G(k[0][0])})(o),A=Pr({key:a.key,value:a.value,valueSpec:a.styleSpec.function,style:a.style,styleSpec:a.styleSpec,objectElementValidators:{stops:function(L){if(d==="identity")return[new Ne(L.key,L.value,'identity function may not have a "stops" property')];let k=[];const N=L.value;return k=k.concat(Jt({key:L.key,value:N,valueSpec:L.valueSpec,style:L.style,styleSpec:L.styleSpec,arrayElementValidator:D})),Array.isArray(N)&&N.length===0&&k.push(new Ne(L.key,N,"array must have at least one stop")),k},default:function(L){return Di({key:L.key,value:L.value,valueSpec:c,style:L.style,styleSpec:L.styleSpec})}}});return d==="identity"&&T&&A.push(new Ne(a.key,a.value,'missing required property "property"')),d==="identity"||o.stops||A.push(new Ne(a.key,a.value,'missing required property "stops"')),d==="exponential"&&c.expression&&!h.M(c)&&A.push(new Ne(a.key,a.value,"exponential functions not supported")),a.styleSpec.$version>=8&&(I&&!h.N(c)?A.push(new Ne(a.key,a.value,"property functions not supported")):T&&!h.O(c)&&A.push(new Ne(a.key,a.value,"zoom functions not supported"))),d!=="categorical"&&!P||o.property!==void 0||A.push(new Ne(a.key,a.value,'"property" property is required')),A;function D(L){let k=[];const N=L.value,H=L.key;if(!Array.isArray(N))return[new Ne(H,N,`array expected, ${h.J(N)} found`)];if(N.length!==2)return[new Ne(H,N,`array length 2 expected, length ${N.length} found`)];if(P){if(!h.G(N[0]))return[new Ne(H,N,`object expected, ${h.J(N[0])} found`)];const Z=N[0];if(Z.zoom===void 0)return[new Ne(H,N,"object stop key must have zoom")];if(Z.value===void 0)return[new Ne(H,N,"object stop key must have value")];const G=h.H(Z.zoom);if(typeof G!="number")return[new Ne(H,Z.zoom,"stop zoom values must be numbers")];if(y&&y>G)return[new Ne(H,Z.zoom,"stop zoom values must appear in ascending order")];G!==y&&(y=G,_=void 0,v={}),k=k.concat(Pr({key:`${H}[0]`,value:N[0],valueSpec:{zoom:{}},style:L.style,styleSpec:L.styleSpec,objectElementValidators:{zoom:Gi,value:O}}))}else k=k.concat(O({key:`${H}[0]`,value:N[0],style:L.style,styleSpec:L.styleSpec},N));return h.Q(h.S(N[1]))?k.concat([new Ne(`${H}[1]`,N[1],"expressions are not allowed in function stops.")]):k.concat(Di({key:`${H}[1]`,value:N[1],valueSpec:c,style:L.style,styleSpec:L.styleSpec}))}function O(L,k){const N=h.J(L.value),H=h.H(L.value),Z=L.value!==null?L.value:k;if(m){if(N!==m)return[new Ne(L.key,Z,`${N} stop domain type must match previous stop domain type ${m}`)]}else m=N;if(N!=="number"&&N!=="string"&&N!=="boolean"&&typeof H!="number"&&typeof H!="string"&&typeof H!="boolean")return[new Ne(L.key,Z,"stop domain value must be a number, string, or boolean")];if(N!=="number"&&d!=="categorical"){let G=`number expected, ${N} found`;return h.N(c)&&d===void 0&&(G+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new Ne(L.key,Z,G)]}return d!=="categorical"||N!=="number"||typeof H=="number"&&isFinite(H)&&Math.floor(H)===H?d!=="categorical"&&N==="number"&&typeof H=="number"&&typeof _=="number"&&_!==void 0&&H<_?[new Ne(L.key,Z,"stop domain values must appear in ascending order")]:(_=H,d==="categorical"&&H in v?[new Ne(L.key,Z,"stop domain values must be unique")]:(v[H]=!0,[])):[new Ne(L.key,Z,`integer expected, found ${String(H)}`)]}}function Pt(a){const t=(a.expressionContext==="property"?h.V:h.U)(h.S(a.value),a.valueSpec);if(t.result==="error")return t.value.map(c=>new Ne(`${a.key}${c.key}`,a.value,c.message));const o=t.value.expression||t.value._styleExpression.expression;if(a.expressionContext==="property"&&a.propertyKey==="text-font"&&!o.outputDefined())return[new Ne(a.key,a.value,`Invalid data expression for "${a.propertyKey}". Output values must be contained as literals within the expression.`)];if(a.expressionContext==="property"&&a.propertyType==="layout"&&!h.Y(o))return[new Ne(a.key,a.value,'"feature-state" data expressions are not supported with layout properties.')];if(a.expressionContext==="filter")return hi(o,a);if(a.expressionContext==="appearance")return Ii(o,a);if(a.expressionContext&&a.expressionContext.indexOf("cluster")===0){if(!h.W(o,["zoom","feature-state"]))return[new Ne(a.key,a.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(a.expressionContext==="cluster-initial"&&!h.X(o))return[new Ne(a.key,a.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function hi(a,t){const o=new Set(["zoom","feature-state","pitch","distance-from-center"]);if(t.valueSpec&&t.valueSpec.expression)for(const d of t.valueSpec.expression.parameters)o.delete(d);if(o.size===0)return[];const c=[];return a instanceof h.Z&&o.has(a.name)?[new Ne(t.key,t.value,`["${a.name}"] expression is not supported in a filter for a ${t.object.type} layer with id: ${t.object.id}`)]:(a.eachChild(d=>{c.push(...hi(d,t))}),c)}function Ii(a,t){const o=new Set;if(t.valueSpec&&t.valueSpec.expression)for(const d of t.valueSpec.expression.parameters)o.add(d);if(o.size===0)return[];const c=[];return a instanceof h.Z&&!o.has(a.name)?[new Ne(t.key,t.value,`["${a.name}"] is not an allowed parameter`)]:(a.eachChild(d=>{c.push(...Ii(d,t))}),c)}function $i(a){const t=a.key,o=a.value,c=a.valueSpec,d=[];return Array.isArray(c.values)?c.values.includes(h.H(o))||d.push(new Ne(t,o,`expected one of [${c.values.join(", ")}], ${JSON.stringify(o)} found`)):Object.keys(c.values).includes(h.H(o))||d.push(new Ne(t,o,`expected one of [${Object.keys(c.values).join(", ")}], ${JSON.stringify(o)} found`)),d}function ti(a){return h.a1(h.S(a.value))?Pt(Object.assign({},a,{expressionContext:"filter",valueSpec:a.styleSpec[`filter_${a.layerType||"fill"}`]})):Ei(a)}function Ei(a){const t=a.value,o=a.key;if(!Array.isArray(t))return[new Ne(o,t,`array expected, ${h.J(t)} found`)];if(t.length<1)return[new Ne(o,t,"filter array must have at least 1 element")];const c=a.styleSpec;let d=$i({key:`${o}[0]`,value:t[0],valueSpec:c.filter_operator});const m=()=>{t.length>=2&&(h.$(t[1])||d.push(new Ne(`${o}[1]`,t[1],`string expected, ${h.J(t[1])} found`)));for(let _=2;_<t.length;_++)h.H(t[1])==="$type"?d=d.concat($i({key:`${o}[${_}]`,value:t[_],valueSpec:c.geometry_type})):h.$(t[_])||h.K(t[_])||h._(t[_])||d.push(new Ne(`${o}[${_}]`,t[_],`string, number, or boolean expected, ${h.J(t[_])} found.`))};switch(h.H(t[0])){case"<":case"<=":case">":case">=":t.length>=2&&h.H(t[1])==="$type"&&d.push(new Ne(o,t,`"$type" cannot be use with operator "${t[0]}"`)),t.length!==3&&d.push(new Ne(o,t,`filter array for operator "${t[0]}" must have 3 elements`)),m();break;case"==":case"!=":t.length!==3&&d.push(new Ne(o,t,`filter array for operator "${t[0]}" must have 3 elements`)),m();break;case"in":case"!in":m();break;case"any":case"all":case"none":for(let _=1;_<t.length;_++)d=d.concat(Ei({key:`${o}[${_}]`,value:t[_],style:a.style,styleSpec:a.styleSpec}));break;case"has":case"!has":t.length!==2?d.push(new Ne(o,t,`filter array for "${t[0]}" operator must have 2 elements`)):h.$(t[1])||d.push(new Ne(`${o}[1]`,t[1],`string expected, ${h.J(t[1])} found`))}return d}const Ui=/^{([^}]+)}$/;function _i(a,t){const o=a.key,c=a.style,d=a.layer,m=a.styleSpec,_=a.value,y=a.objectKey,v=m[`${t}_${a.layerType}`];if(!v)return[];const T=y.match(h.a2);if(T&&v[T[1]])return h.Q(h.S(_))?[].concat(Di({key:o,value:_,valueSpec:{type:"string",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},style:c,styleSpec:m,expressionContext:"property",propertyType:t,propertyKey:y})):Di({key:o,value:_,valueSpec:{type:"string"},style:c,styleSpec:m});const I=y.match(h.a3);if(t==="paint"&&I&&v[I[1]]&&v[I[1]].transition)return Di({key:o,value:_,valueSpec:m.transition,style:c,styleSpec:m});const P=a.valueSpec||v[y];if(!P)return[new Ct(o,_,`unknown property "${y}"`)];let A;if(h.$(_)&&h.N(P)&&!P.tokens&&(A=Ui.exec(_))){const O=`\`{ "type": "identity", "property": ${A?JSON.stringify(A[1]):'"_"'} }\``;return[new Ne(o,_,`"${y}" does not support interpolation syntax 8Use an identity property function instead: ${O}.`)]}const D=[];if(a.layerType==="symbol")y!=="text-field"||!c||c.glyphs||c.imports||D.push(new Ne(o,_,'use of "text-field" requires a style "glyphs" property')),y==="text-font"&&h.a4(h.S(_))&&h.H(_.type)==="identity"&&D.push(new Ne(o,_,'"text-font" does not support identity functions'));else if(a.layerType==="model"&&t==="paint"&&d&&d.layout&&Object.hasOwn(d.layout,"model-id")&&h.N(P)&&(h.a5(P)||h.O(P))){const O=h.V(h.S(_),P).value,L="expression"in O&&O.expression||"_styleExpression"in O&&O._styleExpression&&O._styleExpression.expression;L&&!h.W(L,["measure-light"])&&(y==="model-emissive-strength"&&h.X(L)&&h.Y(L)||D.push(new Ne(o,_,`${y} does not support measure-light expressions when the model layer source is vector tile or GeoJSON.`)))}return D.concat(Di({key:a.key,value:_,valueSpec:P,style:c,styleSpec:m,expressionContext:"property",propertyType:t,propertyKey:y}))}function Yi(a){return _i(a,"paint")}function Tr(a){return _i(a,"layout")}function ur(a){let t=[];const o=a.value,c=a.key,d=a.style,m=a.styleSpec;if(!h.G(o))return[new Ne(c,o,"object expected")];o.type||o.ref||t.push(new Ne(c,o,'either "type" or "ref" is required'));let _=h.H(o.type);const y=h.H(o.ref);if(o.id){const v=h.H(o.id);for(let T=0;T<a.arrayIndex;T++){const I=d.layers[T];h.H(I.id)===v&&t.push(new Ne(c,o.id,`duplicate layer id "${v}", previously used at line ${I.id.__line__}`))}}if("ref"in o){let v;["type","source","source-layer","filter","layout"].forEach(T=>{T in o&&t.push(new Ne(c,o[T],`"${T}" is prohibited for ref layers`))}),d.layers.forEach(T=>{h.H(T.id)===y&&(v=T)}),v?v.ref?t.push(new Ne(c,o.ref,"ref cannot reference another ref layer")):_=h.H(v.type):typeof y=="string"&&t.push(new Ne(c,o.ref,`ref layer "${y}" not found`))}else if(_!=="background"&&_!=="sky"&&_!=="slot")if(o.source)if(h.$(o.source)){const v=d.sources&&d.sources[o.source],T=v&&h.H(v.type);v?T==="vector"&&_==="raster"?t.push(new Ne(c,o.source,`layer "${o.id}" requires a raster source`)):T==="raster"&&_!=="raster"?t.push(new Ne(c,o.source,`layer "${o.id}" requires a vector source`)):T!=="vector"||o["source-layer"]?T==="raster-dem"&&_!=="hillshade"?t.push(new Ne(c,o.source,"raster-dem source can only be used with layer type 'hillshade'.")):T!=="raster-array"||["raster","raster-particle"].includes(_)?_==="line"&&o.paint&&o.paint["line-gradient"]&&T==="geojson"&&!v.lineMetrics?t.push(new Ne(c,o,`layer "${o.id}" specifies a line-gradient, which requires the GeoJSON source to have \`lineMetrics\` enabled.`)):_==="line"&&o.paint&&o.paint["line-trim-offset"]&&T==="geojson"&&!v.lineMetrics?t.push(new Ne(c,o,`layer "${o.id}" specifies a line-trim-offset, which requires the GeoJSON source to have \`lineMetrics\` enabled.`)):_==="raster-particle"&&T!=="raster-array"&&t.push(new Ne(c,o.source,`layer "${o.id}" requires a 'raster-array' source.`)):t.push(new Ne(c,o.source,"raster-array source can only be used with layer type 'raster'.")):t.push(new Ne(c,o,`layer "${o.id}" must specify a "source-layer"`)):t.push(new Ne(c,o.source,`source "${o.source}" not found`))}else t.push(new Ne(`${c}.source`,o.source,'"source" must be a string'));else t.push(new Ne(c,o,'missing required property "source"'));return t=t.concat(Pr({key:c,value:o,valueSpec:m.layer,style:a.style,styleSpec:a.styleSpec,objectElementValidators:{"*":()=>[],type:()=>Di({key:`${c}.type`,value:o.type,valueSpec:m.layer.type,style:a.style,styleSpec:a.styleSpec,object:o,objectKey:"type"}),filter:v=>ti(Object.assign({layerType:_},v)),layout:v=>Pr({layer:o,key:v.key,value:v.value,valueSpec:{},style:v.style,styleSpec:v.styleSpec,objectElementValidators:{"*":T=>Tr(Object.assign({layerType:_},T))}}),paint:v=>Pr({layer:o,key:v.key,value:v.value,valueSpec:{},style:v.style,styleSpec:v.styleSpec,objectElementValidators:{"*":T=>Yi(Object.assign({layerType:_,layer:o},T))}}),appearances(v){const T=Jt({key:v.key,value:v.value,valueSpec:v.valueSpec,style:v.style,styleSpec:v.styleSpec,arrayElementValidator:A=>(function(D){const{key:O,layer:L,layerType:k}=D,N=h.H(D.value),H=h.H(N.name),Z=h.H(N.condition),G=Pr({key:O,value:N,valueSpec:D.styleSpec.appearance,style:D.style,styleSpec:D.styleSpec,objectElementValidators:{condition:ne=>(function(te){const se=[];return se.push(...Pt({key:te.key,value:te.object.condition,valueSpec:h.a6.appearance.condition,expressionContext:"appearance"})),se})(Object.assign({layer:L,layerType:k},ne)),properties:ne=>(function(te){const se=[],{styleSpec:J,layer:K,layerType:oe}=te,de=J[`paint_${oe}`],ue=J[`layout_${oe}`],ve=te.object[te.objectKey];for(const be in ve){const ke=be in de?"paint":be in ue?"layout":void 0;if(!ke){se.push(new Ne(te.key,be,`unknown property "${be}" for layer type "${oe}"`));continue}const fe=Object.assign({},te,{key:`${te.key}.${be}`,object:ve,objectKey:be,layer:K,layerType:oe,value:ve[be],valueSpec:ke==="paint"?de[be]:ue[be]});se.push(..._i(fe,ke))}return se})(Object.assign({layer:L,layerType:k},ne))}});return H!=="hidden"&&Z===void 0&&G.push(new Ne(D.key,"name",'Appearance with name different than "hidden" must have a condition')),G})(Object.assign({layerType:_,layer:o},A))}),I=Array.isArray(v.value)?v.value:[],P=new Set;return I.forEach((A,D)=>{const O=h.H(A.name);if(O)if(P.has(O)){const L=h.H(o.id);T.push(new Ne(v.key,O,`Duplicated appearance name "${O}" for layer "${L}"`))}else P.add(O)}),T}}})),t}function or({key:a,value:t}){return h.$(t)?[]:[new Ne(a,t,`string expected, ${h.J(t)}
8 found`)]}const xo={promoteId:function a({key:t,value:o}){if(h.$(o))return or({key:t,value:o});if(Array.isArray(o)){const d=[],m=h.S(o),_=h.U(m);return _.result==="error"?(_.value.forEach(y=>{d.push(new Ne(`${t}${y.key}`,null,`${y.message}`))}),d):(h.W(_.value.expression,["zoom","heatmap-density","line-progress","raster-value","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center","measure-light","raster-particle-speed"])||d.push(new Ne(`${t}`,null,"promoteId expression should be only feature dependent")),d)}if(!h.G(o))return[new Ne(t,o,`string, expression or object expected, "${h.J(o)}" found`)];const c=[];for(const d in o)c.push(...a({key:`${t}.${d}`,value:o[d]}));return c}};function to(a){const t=a.value,o=a.key,c=a.styleSpec,d=a.style;if(!h.G(t))return[new Ne(o,t,`object expected, ${h.J(t)} found`)];if(!("type"in t))return[new Ne(o,t,'"type" is required')];const m=h.H(t.type);let _=[];switch(["vector","raster","raster-dem","raster-array"].includes(m)&&("url"in t||"tiles"in t||_.push(new Ct(o,t,'Either "url" or "tiles" is required.'))),m){case"vector":case"raster":case"raster-dem":case"raster-array":return _=_.concat(Pr({key:o,value:t,valueSpec:c[`source_${m.replace("-","_")}`],style:a.style,styleSpec:c,objectElementValidators:xo})),_;case"geojson":if(_=Pr({key:o,value:t,valueSpec:c.source_geojson,style:d,styleSpec:c,objectElementValidators:xo}),"cluster"in t&&"clusterProperties"in t){if(!h.G(t.clusterProperties))return[new Ne(`${o}.clusterProperties`,t,`object expected, ${h.J(t)} found`)];for(const y in t.clusterProperties){const v=t.clusterProperties[y];if(!Array.isArray(v))return[new Ne(`${o}.clusterProperties.${y}`,v,"array expected")];const[T,I]=v,P=typeof T=="string"?[T,["accumulated"],["get",y]]:T;_.push(...Pt({key:`${o}.${y}.map`,value:I,expressionContext:"cluster-map"})),_.push(...Pt({key:`${o}.${y}.reduce`,value:P,expressionContext:"cluster-reduce"}))}}return _;case"video":return Pr({key:o,value:t,valueSpec:c.source_video,style:d,styleSpec:c});case"image":return Pr({key:o,value:t,valueSpec:c.source_image,style:d,styleSpec:c});case"canvas":return[new Ne(o,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return $i({key:`${o}.type`,value:t.type,valueSpec:{values:fi(c)}})}}function fi(a){return a.source.reduce((t,o)=>{const c=a[o];return c.type.type==="enum"&&(t=t.concat(Object.keys(c.type.values||{}))),t},[])}function bs(a,t){const o=!a.includes("://");try{return new URL(a,o&&t?"http://example.com":void 0),!0}catch{return!1}}function sa(a){const t=a.value;return t?h.$(t)?bs(t,!0)?[]:[new Ne(a.key,t,`invalid url "${t}"`)]:[new Ne(a.key,t,`string expected, "${h.J(t)}" found`)]:[]}function aa(a){const t=a.value,o=a.styleSpec,c=o.light,d=a.style;if(t===void 0)return[];if(!h.G(t))return[new Ne("light",t,`object expected, ${h.J(t)} found`)];let m=[];for(const _ in t){const y=_.match(h.a3),v=_.match(h.a2);m=m.concat(v&&c[v[1]]?Di({key:_,value:t[_],valueSpec:{type:"string"},style:d,styleSpec:o}):y&&c[y[1]]&&c[y[1]].transition?Di({key:_,value:t[_],valueSpec:o.transition,style:d,styleSpec:o}):c[_]?Di({key:_,value:t[_],valueSpec:c[_],style:d,styleSpec:o}):[new Ne(_,t[_],`unknown property "${_}"`)])}return m}function ws(a){const t=a.value;if(!t)return[];const o=a.key;if(!h.G(t))return[new Ne(o,t,`object expected, ${h.J(t)} found`)];let c=[];const d=a.styleSpec,m=d["light-3d"],_=a.style,y=a.style.lights;for(const I of["type","id"])if(!(I in t))return c=c.concat([new Ne(o,t,`missing property "${I}"`)]),c;if(!h.$(t.type))return c=c.concat([new Ne(`${o}.type`,t.type,"string expected")]),c;if(y)for(let I=0;I<a.arrayIndex;I++){const P=h.H(t.type),A=y[I];h.H(A.type)===P&&c.push(new Ne(o,t.id,`duplicate light type "${t.type}", previously defined at line ${A.id.__line__}`))}const v=`properties_light_${t.type}`;if(!(v in d))return c=c.concat([new Ne(`${o}.type`,t,`Invalid light type ${t.type}`)]),c;const T=d[v];for(const I in t)if(I==="properties"){const P=t[I];if(!h.G(P))return c=c.concat([new Ne("properties",P,`object expected, ${h.J(P)} found`)]),c;for(const A in P){const D=A.match(h.a3),O=A.match(h.a2);c=c.concat(O&&T[O[1]]?Di({key:I,value:P[A],valueSpec:{type:"string"},style:_,styleSpec:d}):D&&T[D[1]]&&T[D[1]].transition?Di({key:I,value:t[I],valueSpec:d.transition,style:_,styleSpec:d}):T[A]?Di({key:A,value:P[A],valueSpec:T[A],style:_,styleSpec:d}):[new Ct(a.key,P[A],`unknown property "${A}"`)])}}else c=c.concat(m[I]?Di({key:I,value:t[I],valueSpec:m[I],style:_,styleSpec:d}):[new Ct(I,t[I],`unknown property "${I}"`)]);return c}function Wa(a){const t=a.value,o=a.key,c=a.style,d=a.styleSpec,m=d.terrain;if(t==null)return[];if(!h.G(t))return[new Ne("terrain",t,`object expected, ${h.J(t)}
8 found`)];let _=[];for(const y in t){const v=y.match(h.a3),T=y.match(h.a2);_=_.concat(T&&m[T[1]]?Di({key:y,value:t[y],valueSpec:{type:"string"},style:c,styleSpec:d}):v&&m[v[1]]&&m[v[1]].transition?Di({key:y,value:t[y],valueSpec:d.transition,style:c,styleSpec:d}):m[y]?Di({key:y,value:t[y],valueSpec:m[y],style:c,styleSpec:d}):[new Ct(y,t[y],`unknown property "${y}"`)])}if(t.source)if(h.$(t.source)){const y=c.sources&&c.sources[t.source],v=y&&h.H(y.type);y?v!=="raster-dem"&&_.push(new Ne(`${o}.source`,t.source,`terrain cannot be used with a source of type ${v}, it only be used with a "raster-dem" source type`)):_.push(new Ne(`${o}.source`,t.source,`source "${t.source}" not found`))}else _.push(new Ne(`${o}.source`,t.source,"source must be a string"));else _.push(new Ne(o,t,'terrain is missing required property "source"'));return _}function nu(a){const t=a.value,o=a.style,c=a.styleSpec,d=c.fog;if(t===void 0)return[];if(!h.G(t))return[new Ne("fog",t,`object expected, ${h.J(t)} found`)];let m=[];for(const _ in t){const y=_.match(h.a3),v=_.match(h.a2);m=m.concat(v&&d[v[1]]?Di({key:_,value:t[_],valueSpec:{type:"string"},style:o,styleSpec:c}):y&&d[y[1]]&&d[y[1]].transition?Di({key:_,value:t[_],valueSpec:c.transition,style:o,styleSpec:c}):d[_]?Di({key:_,value:t[_],valueSpec:d[_],style:o,styleSpec:c}):[new Ct(_,t[_],`unknown property "${_}"`)])}return m}const ic={"*":()=>[],array:Jt,boolean:function(a){const t=a.value,o=a.key;return h._(t)?[]:[new Ne(o,t,`boolean expected, ${h.J(t)} found`)]},number:Gi,color:function({key:a,value:t}){return h.$(t)?h.a0.parseCSSColor(t)===null?[new Ne(a,t,`color expected, "${t}" found`)]:[]:[new Ne(a,t,`color expected, ${h.J(t)} found`)]},enum:$i,filter:ti,function:Ni,layer:ur,object:Pr,source:to,model:sa,light:aa,"light-3d":ws,terrain:Wa,fog:nu,string:or,formatted:function(a){return or(a).length===0?[]:Pt(a)},resolvedImage:function(a){return or(a).length===0?[]:Pt(a)},projection:function(a){const t=a.value,o=a.styleSpec,c=o.projection,d=a.style;if(h.G(t)){let m=[];for(const _ in t)m=m.concat(Di({key:_,value:t[_],valueSpec:c[_],style:d,styleSpec:o}));return m}return h.$(t)?[]:[new Ne("projection",t,`object or string expected, ${h.J(t)} found`)]},import:function(a){const t=a.key,{value:o,styleSpec:c}=a;if(!h.G(o))return[new Ne(t,o,"import must be an object")];const{data:d,...m}=o;Object.defineProperty(m,"__line__",{value:o.__line__,enumerable:!1});let _=Pr(Object.assign({},a,{value:m,valueSpec:c.import}));return h.H(m.id)===""&&_.push(new Ne(`${a.key}.id`,m,"import id can't be an empty string")),d&&(_=_.concat(Xa(d,c,{key:`${a.key}.data`}))),_},iconset:function(a){const t=a.value,o=a.key,c=a.styleSpec,d=a.style;if(!h.G(t))return[new Ne(o,t,"object expected")];if(!t.type)return[new Ne(o,t,'"type" is required')];const m=h.H(t.type);let _=[];if(_=_.concat(Pr({key:o,value:t,valueSpec:c[`iconset_${m}`],style:d,styleSpec:c})),(function(y,v){return!(y!=="source"||!v.source)})(m,t)){const y=d.sources&&d.sources[t.source],v=y&&h.H(y.type);y?v!=="raster-array"&&_.push(new Ne(o,t.source,`iconset cannot be used with a source of type ${String(v)}, it only be used with a "raster-array" source type`)):_.push(new Ne(o,t.source,`source "${t.source}" not found`))}return _}};function Di(a,t=!1){const o=a.value,c=a.valueSpec,d=a.styleSpec;if(c.expression){if(h.a4(h.H(o)))return Ni(a);if(h.Q(h.S(o)))return Pt(a)}if(c.type&&ic[c.type]){const m=ic[c.type](a);return t===!0&&m.length>0&&Array.isArray(a.value)?Pt(a):m}return Pr(Object.assign({},a,{valueSpec:c.type?d[c.type]:c}))}function Pr(a){const t=a.key,o=a.value,c=a.valueSpec||{},d=a.objectElementValidators||{},m=a.style,_=a.styleSpec;if(!h.G(o))return[new Ne(t,o,`object expected, ${h.J(o)} found`)];let y=[];for(const v in o){const T=v.split(".")[0];let I;d[T]?I=d[T]:c[T]?I=Di:d["*"]?I=d["*"]:c["*"]&&(I=Di),I?y=y.concat(I({key:(t&&`${t}.`)+v,value:o[v],valueSpec:c[T]||c["*"],style:m,styleSpec:_,object:o,objectKey:v},o)):y.push(new Ct(t,o[v],`unknown property "${v}"`))}for(const v in c){if(d[v])continue;const T=c[v];T.required&&T.default===void 0&&o[v]===void 0&&y.push(new Ne(t,o,`missing required property "${v}"`))}return y}function la({key:a,value:t}){const o=or({key:a,value:t});if(o.length)return o;const c=t;return c.includes("{fontstack}")||o.push(new Ne(a,t,'"glyphs" url must include a "{fontstack}" token')),c.includes("{range}")||o.push(new Ne(a,t,'"glyphs" url must include a "{range}" token')),o}function Xa(a,t=h.a6,o={}){return Pr({key:o.key||"",value:a,valueSpec:Object.assign({},t.$root,{"*":{type:"*"}}),styleSpec:t,style:a,objectElementValidators:{glyphs:la}})}function vo(a,t=h.a6){return Ur(Xa(a,t))}const un=a=>Ur(to(a)),Zf=a=>Ur(aa(a)),Ph=a=>Ur(ws(a)),Wf=a=>Ur(Wa(a)),Xf=a=>Ur(nu(a)),Yf=a=>Ur((function(t){const o=t.value,c=t.style,d=t.styleSpec,m=d.snow;if(o===void 0)return[];if(!h.G(o))return[new Ne("snow",o,`object expected, ${h.J(o)} found`)];let _=[];for(const y in o){const v=y.match(h.a3);_=_.concat(v&&m[v[1]]&&m[v[1]].transition?Di({key:y,value:o[y],valueSpec:d.transition,style:c,styleSpec:d}):m[y]?Di({key:y,value:o[y],valueSpec:m[y],style:c,styleSpec:d}):[new Ct(y,o[y],`unknown property "${y}"`)])}return _}
vendor: 22,776 bytes, line 8
8)(a)),Jf=a=>Ur((function(t){const o=t.value,c=t.style,d=t.styleSpec,m=d.rain;if(o===void 0)return[];if(!h.G(o))return[new Ne("rain",o,`object expected, ${h.J(o)} found`)];let _=[];for(const y in o){const v=y.match(h.a3);_=_.concat(v&&m[v[1]]&&m[v[1]].transition?Di({key:y,value:o[y],valueSpec:d.transition,style:c,styleSpec:d}):m[y]?Di({key:y,value:o[y],valueSpec:m[y],style:c,styleSpec:d}):[new Ct(y,o[y],`unknown property "${y}"`)])}return _})(a)),Xo=a=>Ur(ur(a)),rc=a=>Ur(ti(a)),ou=a=>Ur(Yi(a)),Dh=a=>Ur(Tr(a)),Rh=a=>Ur(sa(a));function Ur(a){return a.slice().sort((t,o)=>t.line&&o.line?t.line-o.line:0)}function bo(a,t){let o=!1;if(t&&t.length)for(const c of t)c instanceof Ct?h.w(c.message):(a.fire(new h.y(new Error(c.message))),o=!0);return o}const Ya=h.a6.light;let zh;class Lh extends h.E{constructor(t,o="flat"){super(),this._transitionable=new h.a7(zh||(zh=new h.a8({anchor:new h.a9(Ya.anchor),position:new h.aa(Ya.position),color:new h.a9(Ya.color),intensity:new h.a9(Ya.intensity)}))),this.setLight(t,o),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(t,o,c={}){this._validate(Zf,t,c)||(this._transitionable.setTransitionOrValue(t),this.id=o)}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}_validate(t,o,c){return(!c||c.validate!==!1)&&bo(this,t.call(vo,Object.assign({value:o,style:{glyphs:!0,sprite:!0},styleSpec:h.a6})))}}const Oh=h.a6.terrain;let ca=class extends h.E{constructor(a,t,o,c,d){super(),this.scope=o,this._transitionable=new h.a7(new h.a8({source:new h.a9(Oh.source),exaggeration:new h.a9(Oh.exaggeration)}),o,c),this._transitionable.setTransitionOrValue(a,c),this._transitioning=this._transitionable.untransitioned(),this.drapeRenderMode=t,this.worldview=d}get(){return this._transitionable.serialize()}set(a,t){this._transitionable.setTransitionOrValue(a,t)}updateTransitions(a){this._transitioning=this._transitionable.transitioned(a,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(a){this.properties=this._transitioning.possiblyEvaluate(a)}getExaggeration(a){return this._transitioning.possiblyEvaluate(new h.ab(a,{worldview:this.worldview})).get("exaggeration")}getAttenuationRange(){if(!this.isZoomDependent())return null;const a=this._transitionable._values.exaggeration;if(!a)return null;const t=a.value.expression;if(!t)return null;let o=-1,c=-1,d=1;for(const m of t.zoomStops)d=t.evaluate(new h.ab(m,{worldview:this.worldview})),d>.01?(o=m,c=-1):c=m;return d<.01&&o>0&&c>o?[o,c]:null}isZoomDependent(){const a=this._transitionable._values.exaggeration;return a!=null&&a.value!=null&&a.value.expression!=null&&a.value.expression instanceof h.ac}};const Yo=.05;function nc(a,t,o){const c=h.ag(45,65,o),[d,m]=a.range;let _=1-Math.min(1,Math.exp((t-d)/(m-d)*-6));return _*=_*_,_=Math.min(1,1.00747*_),_*c*a.alpha}function su(a,t,o,c,d){const m=h.ae([],[t,o,c],d.mercatorFogMatrix);return nc(a,h.af(m),d.pitch)}function Kf(a,t,o,c,d,m,_){const y=[[o,c,0],[d,c,0],[d,m,0],[o,m,0]];let v=Number.MAX_VALUE,T=-Number.MAX_VALUE;for(const I of y){const P=h.ae([],I,t),A=h.af(P);v=Math.min(v,A),T=Math.max(T,A)}return[nc(a,v,_.pitch),nc(a,T,_.pitch)]}const Jo=h.a6.fog;class oc extends h.E{constructor(t,o,c,d){super();const m=new h.a8({range:new h.a9(Jo.range),color:new h.a9(Jo.color),"color-use-theme":new h.a9({type:"string","property-type":"data-constant",default:"default"}),"high-color":new h.a9(Jo["high-color"]),"high-color-use-theme":new h.a9({type:"string","property-type":"data-constant",default:"default"}),"space-color":new h.a9(Jo["space-color"]),"space-color-use-theme":new h.a9({type:"string","property-type":"data-constant",default:"default"}),"horizon-blend":new h.a9(Jo["horizon-blend"]),"star-intensity":new h.a9(Jo["star-intensity"]),"vertical-range":new h.a9(Jo["vertical-range"])});this._transitionable=new h.a7(m,c,d),this.set(t,d),this._transitioning=this._transitionable.untransitioned(),this._transform=o,this.properties=new h.ah(m),this.scope=c}get state(){const t=this._transform,o=t.projection.name==="globe",c=h.ai(t.zoom),d=this.properties.get("range"),m=[2,4.5],_=.5/Math.tan(.5*t._fov),y=[d[0]+_,d[1]+_];return{range:o?[h.aj(m[0],y[0],c),h.aj(m[1],y[1],c)]:y,horizonBlend:this.properties.get("horizon-blend"),alpha:this.properties.get("color").a}}get(){return this._transitionable.serialize()}set(t,o,c={}){if(this._validate(Xf,t,c))return;const d=Object.assign({},t);for(const m of Object.keys(Jo))d[m]===void 0&&(d[m]=Jo[m].default);this._options=d,this._transitionable.setTransitionOrValue(this._options,o)}getOpacity(t){if(!this._transform.projection.supportsFog)return 0;const o=this.properties&&this.properties.get("color")||1;return(this._transform.projection.name==="globe"?1:h.ag(45,65,t))*o.a}getOpacityAtLatLng(t,o){return this._transform.projection.supportsFog?(function(c,d,m){const _=h.ad.fromLngLat(d),y=m.elevation?m.elevation.getAtPointOrZero(_):0;return su(c,_.x,_.y,y,m)})(this.state,t,o):0}getOpacityForTile(t){if(!this._transform.projection.supportsFog)return[1,1];const o=this._transform.calculateFogTileMatrix(t.toUnwrapped());return Kf(this.state,o,0,0,h.ak,h.ak,this._transform)}getOpacityForBounds(t,o,c,d,m){return this._transform.projection.supportsFog?Kf(this.state,t,o,c,d,m,this._transform):[1,1]}getRangeForProjection(){return this._transform.projection.supportsFog?this.state.range:[0,1]}isVisibleOnFrustum(t){if(!this._transform.projection.supportsFog)return!1;const o=[4,5,6,7];for(const c of o){const d=t.points[c];let m;if(d[2]>=0)m=d;else{const _=t.points[c-4];m=h.al(_,d,_[2]/(_[2]-d[2]))}if(su(this.state,m[0],m[1],0,this._transform)>=Yo)return!0}return!1}updateConfig(t){this._transitionable.setTransitionOrValue(this._options,t)}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}_validate(t,o,c){return(!c||c.validate!==!1)&&bo(this,t.call(vo,Object.assign({value:o,style:{glyphs:!0,sprite:!0},styleSpec:h.a6})))}}let Fh,Ja,O_=class extends h.E{constructor(a,t,o,c){super();const d=Fh||(Fh=new h.a8({density:new h.a9(h.a6.snow.density),intensity:new h.a9(h.a6.snow.intensity),color:new h.a9(h.a6.snow.color),opacity:new h.a9(h.a6.snow.opacity),vignette:new h.a9(h.a6.snow.vignette),"vignette-color":new h.a9(h.a6.snow["vignette-color"]),"center-thinning":new h.a9(h.a6.snow["center-thinning"]),direction:new h.a9(h.a6.snow.direction),"flake-size":new h.a9(h.a6.snow["flake-size"])}));this._transitionable=new h.a7(d,o,c),this.set(a,c),this._transitioning=this._transitionable.untransitioned(),this.properties=new h.ah(d),this.scope=o}get state(){const a=this.properties.get("opacity"),t=this.properties.get("color"),o=this.properties.get("direction"),c=h.am(o[0]),d=-Math.max(h.am(o[1]),.01),m=[Math.cos(c)*Math.cos(d),Math.sin(c)*Math.cos(d),Math.sin(d)],_=this.properties.get("vignette"),y=this.properties.get("vignette-color");return y.a=_,{density:this.properties.get("density"),intensity:this.properties.get("intensity"),color:new h.C(t.r,t.g,t.b,t.a*a),direction:m,centerThinning:this.properties.get("center-thinning"),flakeSize:this.properties.get("flake-size"),vignetteColor:y}}get(){return this._transitionable.serialize()}set(a,t,o={}){if(this._validate(Yf,a,o))return;const c=Object.assign({},a),d=h.a6.snow;for(const m of Object.keys(d))c[m]===void 0&&(c[m]=d[m].default);this._options=c,this._transitionable.setTransitionOrValue(this._options,t)}updateConfig(a){this._transitionable.setTransitionOrValue(this._options,a)}updateTransitions(a){this._transitioning=this._transitionable.transitioned(a,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(a){this.properties=this._transitioning.possiblyEvaluate(a)}_validate(a,t,o){return(!o||o.validate!==!1)&&bo(this,a.call(vo,Object.assign({value:t,style:{glyphs:!0,sprite:!0},styleSpec:h.a6})))}},au=class extends h.E{constructor(a,t,o,c){super();const d=Ja||(Ja=new h.a8({density:new h.a9(h.a6.rain.density),intensity:new h.a9(h.a6.rain.intensity),color:new h.a9(h.a6.rain.color),opacity:new h.a9(h.a6.rain.opacity),vignette:new h.a9(h.a6.rain.vignette),"vignette-color":new h.a9(h.a6.rain["vignette-color"]),"center-thinning":new h.a9(h.a6.rain["center-thinning"]),direction:new h.a9(h.a6.rain.direction),"droplet-size":new h.a9(h.a6.rain["droplet-size"]),"distortion-strength":new h.a9(h.a6.rain["distortion-strength"])}));this._transitionable=new h.a7(d,o,c),this.set(a,c),this._transitioning=this._transitionable.untransitioned(),this.properties=new h.ah(d),this.scope=o}get state(){const a=this.properties.get("opacity"),t=this.properties.get("color"),o=this.properties.get("direction"),c=h.am(o[0]),d=-Math.max(h.am(o[1]),.01),m=[Math.cos(c)*Math.cos(d),Math.sin(c)*Math.cos(d),Math.sin(d)],_=this.properties.get("vignette-color");return _.a=this.properties.get("vignette"),{density:this.properties.get("density"),intensity:this.properties.get("intensity"),color:new h.C(t.r,t.g,t.b,t.a*a),direction:m,centerThinning:this.properties.get("center-thinning"),dropletSize:this.properties.get("droplet-size"),distortionStrength:this.properties.get("distortion-strength"),vignetteColor:_}}get(){return this._transitionable.serialize()}set(a,t,o={}){if(this._validate(Jf,a,o))return;const c=Object.assign({},a),d=h.a6.rain;for(const m of Object.keys(d))c[m]===void 0&&(c[m]=d[m].default);this._options=c,this._transitionable.setTransitionOrValue(this._options,t)}updateConfig(a){this._transitionable.setTransitionOrValue(this._options,a)}updateTransitions(a){this._transitioning=this._transitionable.transitioned(a,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(a){this.properties=this._transitioning.possiblyEvaluate(a)}_validate(a,t,o){return(!o||o.validate!==!1)&&bo(this,a.call(vo,Object.assign({value:t,style:{glyphs:!0,sprite:!0},styleSpec:h.a6})))}};const hn={workerUrl:"",workerClass:null,workerParams:void 0};function Bh(a){return hn.workerClass!=null?new hn.workerClass:new self.Worker(hn.workerUrl,Object.assign({name:a},hn.workerParams))}const lu="mapboxgl_preloaded_worker_pool";class Ts{constructor(t){this.active={},this.name=t}acquire(t,o=Ts.workerCount){if(!this.workers)for(this.workers=[];this.workers.length<o;){const c=Bh(`${this.name||""}WorkerPool: ${t}-${this.workers.length}`);this.workers.push(c)}return this.active[t]=!0,this.workers.slice()}release(t){delete this.active[t],this.workers&&this.numActive()===0&&(this.workers.forEach(o=>{o.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[lu]}numActive(){return Object.keys(this.active).length}}Ts.workerCount=2;class sc{constructor(t,o,c="Worker",d=Ts.workerCount){this.workerPool=t,this.actors=[],this.currentActor=0,this.id=h.an();const m=this.workerPool.acquire(this.id,d);for(let _=0;_<m.length;_++){const y=new sc.Actor(m[_],o,this.id);y.name=`${c} ${_}`,this.actors.push(y)}this.ready=!1,this.broadcast("checkIfReady",null,()=>{this.ready=!0})}broadcast(t,o,c){h.ao(this.actors,(d,m)=>{d.send(t,o,m)},c=c||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(){this.actors.forEach(t=>{t.remove()}),this.actors=[],this.workerPool.release(this.id)}}sc.Actor=h.ap;class Ka extends h.E{constructor(t,o,c,d){super(),this.scope=c,this._options=t,this.properties=new h.ah(o),this._transitionable=new h.a7(o,c,d),this._transitionable.setTransitionOrValue(t.properties),this._transitioning=this._transitionable.untransitioned()}updateConfig(t){this._transitionable.setTransitionOrValue(this._options.properties,t)}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}get(){return this._options.properties=this._transitionable.serialize(),this._options}set(t,o){this._options=t,this._transitionable.setTransitionOrValue(t.properties,o)}shadowsEnabled(){return!!this.properties&&this.properties.get("cast-shadows")===!0}}let kh;const Qf=()=>kh||(kh=new h.a8({color:new h.a9(h.a6.properties_light_ambient.color),"color-use-theme":new h.a9({type:"string",default:"default","property-type":"data-constant"}),intensity:new h.a9(h.a6.properties_light_ambient.intensity)}));let ep;const cu=()=>ep||(ep=new h.a8({direction:new h.aq(h.a6.properties_light_directional.direction),color:new h.a9(h.a6.properties_light_directional.color),"color-use-theme":new h.a9({type:"string",default:"default","property-type":"data-constant"}),intensity:new h.a9(h.a6.properties_light_directional.intensity),"cast-shadows":new h.a9(h.a6.properties_light_directional["cast-shadows"]),"shadow-quality":new h.a9(h.a6.properties_light_directional["shadow-quality"]),"shadow-intensity":new h.a9(h.a6.properties_light_directional["shadow-intensity"]),"shadow-draw-before-layer":new h.a9(h.a6.properties_light_directional["shadow-draw-before-layer"])}));class io{constructor(t,o,c){this.screenBounds=t,this.cameraPoint=c.getCameraPoint(),this._screenRaycastCache={},this._cameraRaycastCache={},this.isAboveHorizon=o,this.screenGeometry=this.bufferedScreenGeometry(0),this.screenGeometryMercator=this._bufferedScreenMercator(0,c)}static createFromScreenPoints(t,o){let c,d;if(t instanceof h.P||typeof t[0]=="number"){const m=h.P.convert(t);c=[m],d=o.isPointAboveHorizon(m)}else{const m=h.P.convert(t[0]),_=h.P.convert(t[1]),y=m.add(_)._div(2);c=[m,_],d=h.ar(m,_).every(v=>o.isPointAboveHorizon(v))&&o.isPointAboveHorizon(y)}return new io(c,d,o)}isPointQuery(){return this.screenBounds.length===1}bufferedScreenGeometry(t){return h.ar(this.screenBounds[0],this.screenBounds.length===1?this.screenBounds[0]:this.screenBounds[1],t)}bufferedCameraGeometry(t){const o=this.screenBounds[0],c=this.screenBounds.length===1?this.screenBounds[0].add(new h.P(1,1)):this.screenBounds[1],d=h.ar(o,c,0,!1);return this.cameraPoint.y>c.y&&(this.cameraPoint.x>o.x&&this.cameraPoint.x<c.x?d.splice(3,0,this.cameraPoint):this.cameraPoint.x>=c.x?d[2]=this.cameraPoint:this.cameraPoint.x<=o.x&&(d[3]=this.cameraPoint)),h.as(d,t)}bufferedCameraGeometryGlobe(t){const o=this.screenBounds[0],c=this.screenBounds.length===1?this.screenBounds[0].add(new h.P(1,1)):this.screenBounds[1],d=h.ar(o,c,t),m=this.cameraPoint.clone(),_=+(m.x>o.x)+ +(m.x>c.x);switch(3*(+(m.y>o.y)+ +(m.y>c.y))+_){case 0:d[0]=m,d[4]=m.clone();break;case 1:d.splice(1,0,m);break;case 2:d[1]=m;break;case 3:d.splice(4,0,m);break;case 5:d.splice(2,0,m);break;case 6:d[3]=m;break;case 7:d.splice(3,0,m);break;case 8:d[2]=m}return d}containsTile(t,o,c,d=0){const m=Math.max(t.queryPadding,t.evaluateQueryRenderedFeaturePadding())/o._pixelsPerMercatorPixel+1,_=c?this._bufferedCameraMercator(m,o):this._bufferedScreenMercator(m,o);let y=t.tileID.wrap+(_.unwrapped?d:0);const v=_.polygon.map(k=>h.at(t.tileTransform,k,y));if(!h.au(v,0,0,h.ak,h.ak))return;y=t.tileID.wrap+(this.screenGeometryMercator.unwrapped?d:0);const T=this.screenGeometryMercator.polygon.map(k=>h.av(t.tileTransform,k,y)),I=T.map(k=>new h.P(k[0],k[1])),P=o.getFreeCameraOptions().position||new h.ad(0,0,0),A=h.av(t.tileTransform,P,y),D=T.map(k=>{const N=h.aw(k,k,A);return h.ax(N,N),new h.ay(A,N)}),O=h.az(t,1,o.zoom)*o._pixelsPerMercatorPixel;return{queryGeometry:this,tilespaceGeometry:I,tilespaceRays:D,bufferedTilespaceGeometry:v,bufferedTilespaceBounds:(L=h.aA(v),L.min.x=h.aB(L.min.x,0,h.ak),L.min.y=h.aB(L.min.y,0,h.ak),L.max.x=h.aB(L.max.x,0,h.ak),L.max.y=h.aB(L.max.y,0,h.ak),L),tile:t,tileID:t.tileID,pixelToTileUnitsFactor:O};var L}_bufferedScreenMercator(t,o){const c=uu(t);if(this._screenRaycastCache[c])return this._screenRaycastCache[c];{let d;return d=o.projection.name==="globe"?this._projectAndResample(this.bufferedScreenGeometry(t),o):{polygon:this.bufferedScreenGeometry(t).map(m=>o.pointCoordinate3D(m)),unwrapped:!0},this._screenRaycastCache[c]=d,d}}_bufferedCameraMercator(t,o){const c=uu(t);if(this._cameraRaycastCache[c])return this._cameraRaycastCache[c];{let d;return d=o.projection.name==="globe"?this._projectAndResample(this.bufferedCameraGeometryGlobe(t),o):{polygon:this.bufferedCameraGeometry(t).map(m=>o.pointCoordinate3D(m)),unwrapped:!0},this._cameraRaycastCache[c]=d,d}}_projectAndResample(t,o){const c=(function(m,_){const y=h.aC([],_.pixelMatrix,_.globeMatrix),v=[0,-h.aE,0,1],T=[0,h.aE,0,1],I=[0,0,0,1];h.aD(v,v,y),h.aD(T,T,y),h.aD(I,I,y);const P=new h.P(v[0]/v[3],v[1]/v[3]),A=new h.P(T[0]/T[3],T[1]/T[3]),D=h.aF(m,P)&&v[3]<I[3],O=h.aF(m,A)&&T[3]<I[3];if(!D&&!O)return null;const L=(function(J,K,oe){for(let de=1;de<J.length;de++){const ue=el(K.pointCoordinate3D(J[de-1]).x),ve=el(K.pointCoordinate3D(J[de]).x);if(oe<0){if(ue<ve)return{idx:de,t:-ue/(ve-1-ue)}}else if(ve<ue)return{idx:de,t:(1-ue)/(ve+1-ue)}}return null})(m,_,D?-1:1);if(!L)return null;const{idx:k,t:N}=L;let H=k>1?Qa(m.slice(0,k),_):[],Z=k<m.length?Qa(m.slice(k),_):[];H=H.map(J=>new h.P(el(J.x),J.y)),Z=Z.map(J=>new h.P(el(J.x),J.y));const G=[...H];G.length===0&&G.push(Z.at(-1));const ne=G.at(-1),te=h.aj(ne.y,(Z.length===0?H[0]:Z[0]).y,N);let se;return se=D?[new h.P(0,te),new h.P(0,0),new h.P(1,0),new h.P(1,te)]:[new h.P(1,te),new h.P(1,1),new h.P(0,1),new h.P(0,te)],G.push(...se),Z.length===0?G.push(H[0]):G.push(...Z),{polygon:G.map(J=>new h.ad(J.x,J.y)),unwrapped:!1}})(t,o);if(c)return c;const d=(function(m,_){let y=!1,v=-1/0,T=0;for(let P=0;P<m.length-1;P++)m[P].x>v&&(v=m[P].x,T=P);for(let P=0;P<m.length-1;P++){const A=(T+P)%(m.length-1),D=m[A],O=m[A+1];Math.abs(D.x-O.x)>.5&&(D.x<O.x?(D.x+=1,A===0&&(m.at(-1).x+=1)):(O.x+=1,A+1===m.length-1&&(m[0].x+=1)),y=!0)}const I=h.aG(_.center.lng);return y&&I<Math.abs(I-1)&&m.forEach(P=>{P.x-=1}),{polygon:m,unwrapped:y}})(Qa(t,o).map(m=>new h.P(el(m.x),m.y)),o);return{polygon:d.polygon.map(m=>new h.ad(m.x,m.y)),unwrapped:d.unwrapped}}}function Qa(a,t){return h.aH(a,o=>{const c=t.pointCoordinate3D(o);o.x=c.x,o.y=c.y},1/256)}function el(a){return a<0?1+a%1:a%1}function uu(a){return 100*a|0}function tl(a,t){const o=Math.pow(2,t.z),c=Math.floor(h.aG(a.getWest())*o),d=Math.floor(h.aJ(a.getNorth())*o),m=Math.ceil(h.aG(a.getEast())*o),_=Math.ceil(h.aJ(a.getSouth())*o);return t.x>=c&&t.x<m&&t.y>=d&&t.y<_}class Dr{constructor(t,o,c){this.bounds=t?h.aI.convert(this.validateBounds(t)):null,this.minzoom=o||0,this.maxzoom=c||24}validateBounds(t){return Array.isArray(t)&&t.length===4?[Math.max(-180,t[0]),Math.max(-90,t[1]),Math.min(180,t[2]),Math.min(90,t[3])]:[-180,-90,180,90]}addExtraBounds(t){if(t){this.extraBounds||(this.extraBounds=[]);for(const o of t)this.extraBounds.push(h.aI.convert(this.validateBounds(o)))}}contains(t){if(t.z>this.maxzoom||t.z<this.minzoom||this.bounds&&!tl(this.bounds,t))return!1;if(!this.extraBounds)return!0;for(const o of this.extraBounds)if(tl(o,t))return!0;return!1}static fromTileJSON(t){if(!t.bounds&&!t.extra_bounds)return null;const o=new Dr(t.bounds,t.minzoom,t.maxzoom);return o.addExtraBounds(t.extra_bounds),o}}class Nh extends h.E{constructor(t,o,c,d){if(super(),this.id=t,this.dispatcher=c,this.type="vector",this.provider=o.provider,this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,Object.assign(this,h.aK(o,["url","scheme","tileSize","promoteId"])),this._options=Object.assign({type:"vector"},o),this._collectResourceTiming=!!o.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(d),this._tileWorkers={},this._deduped=new h.aL}load(t){this._loaded=!1,this.fire(new h.z("dataloading",{dataType:"source"}));const o=Array.isArray(this.map._language)?this.map._language.join():this.map._language,c=this.map.getWorldview(),d=(_,y)=>{this._tileJSONRequest=null,this._loaded=!0,_?(o&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${o}`),c&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${c}`),this.fire(new h.y(_))):y&&(this._setTileJSON(y),ui(y.tiles,this.map._requestManager._customAccessToken),this.fire(new h.z("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new h.z("data",{dataType:"source",sourceDataType:"content"}))),t&&t(_)};this.provider=this._options.provider;const m=h.aM(this._options);return m instanceof Error?(this._loaded=!0,this.fire(new h.y(m)),void(t&&t())):this.provider&&!m?(this._loaded=!0,this.fire(new h.y(new Error(`TileProvider "${this.provider}" is not registered`))),void(t&&t())):void(this._tileJSONRequest=m?this.loadTileJSONWithProvider(m,d):h.aN(this._options,this.map._requestManager,o,c,d))}loadTileJSONWithProvider(t,o){this.provider=t.name;const{request:c,options:d}=h.aO(this._options,this.map._requestManager),m=new AbortController;return this.dispatcher.broadcast("loadTileProvider",{name:t.name,url:t.url,source:this.id,scope:this.scope,type:this.type,options:d,request:c},(_,y)=>{if(m.signal.aborted)return;if(_)return void o(_);const v=y?y.find(I=>I!=null):null,T=h.aP(this._options,v,this.map._requestManager);T instanceof Error?o(T):o(null,T)}),{cancel:()=>m.abort()}}_setTileJSON(t){if(Object.assign(this,t),this.hasWorldviews=!!t.worldview_options,t.worldview_default&&(this.worldviewDefault=t.worldview_default),t.vector_layers){this.vectorLayers=t.vector_layers,this.vectorLayerIds=[],this.localizableLayerIds=new Set;for(const o of t.vector_layers)this.vectorLayerIds.push(o.id),t.worldview&&t.worldview[o.source]&&this.localizableLayerIds.add(o.id)}this.tileBounds=Dr.fromTileJSON(t)}loaded(){return this._loaded}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}onAdd(t){this.map=t,this.load()}reload(){this.cancelTileJSONRequest();const t=h.t(this.id,this.scope);this.load(()=>this.map.style.clearSource(t))}setTiles(t){return this._options.tiles=t,this.reload(),this}setUrl(t){return this.url=t,this._options.url=t,this.reload(),this}onRemove(t){this.cancelTileJSONRequest()}serialize(){return Object.assign({},this._options)}loadTile(t,o){const c=t.tileID.canonical.url(this.tiles,this.scheme),d=this.map._requestManager.normalizeTileURL(c),m=this.map._requestManager.transformRequest(d,h.R.Tile),_=this.map.style?this.map.style.getLut(this.scope):null,y=_?{image:_.image.clone()}:null,v={request:m,data:void 0,uid:t.uid,tileID:t.tileID,tileZoom:t.tileZoom,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,lut:y,tileSize:this.tileSize*t.tileID.overscaleFactor(),type:this.t
8ype,source:this.id,scope:this.scope,pixelRatio:h.o.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,showElevationIdDebug:!!this.map.painter&&this.map.painter._debugParams.showElevationIdDebug,promoteId:this.promoteId,renderSourceType:t.renderSourceType,brightness:this.map.style&&this.map.style.getBrightness()||0,extraShadowCaster:t.isExtraShadowCaster,tessellationStep:this.map._tessellationStep,scaleFactor:this.map.getScaleFactor(),worldview:this.map.getWorldview()||this.worldviewDefault,indoor:this.map.getIndoorTileOptions(this.id,this.scope)};if(this.hasWorldviews&&h.e(c)&&(v.localizableLayerIds=this.localizableLayerIds),v.request.collectResourceTiming=this._collectResourceTiming,t.actor&&t.state!=="expired")t.state==="loading"?t.reloadCallback=o:t.request=t.actor.send("reloadTile",v,T.bind(this));else if(t.actor=this._tileWorkers[d]=this._tileWorkers[d]||this.dispatcher.getActor(),this.dispatcher.ready||this.provider)t.request=t.actor.send("loadTile",v,T.bind(this),void 0,!0);else{const I=h.aQ.call({deduped:this._deduped},v,(P,A)=>{if(P||!A)T.call(this,P);else{const D=h.aR(A.responseHeaders);v.data={rawData:A.rawData.slice(0),expires:D.expires,cacheControl:D.cacheControl},t.actor&&t.actor.send("loadTile",v,T.bind(this),void 0,!0)}},!0);t.request={cancel:I}}function T(I,P){return delete t.request,t.aborted?o(null):I?o(I):(P&&P.resourceTiming&&(t.resourceTiming=P.resourceTiming),this.map._refreshExpiredTiles&&P&&t.setExpiryData(P),t.loadVectorData(P,this.map.painter),h.aS(this.dispatcher),o(null,P),void(t.reloadCallback&&(this.loadTile(t,t.reloadCallback),t.reloadCallback=null)))}}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.actor&&t.actor.send("abortTile",{uid:t.uid,type:this.t
8ype,source:this.id,scope:this.scope})}unloadTile(t,o){t.actor&&t.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id,scope:this.scope}),t.destroy()}hasTransition(){return!1}afterUpdate(){this._tileWorkers={}}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}class il extends h.E{constructor(t,o,c,d){super(),this.id=t,this.dispatcher=c,this.setEventedParent(d),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=Object.assign({type:"raster"},o),Object.assign(this,h.aK(o,["url","scheme","tileSize"]))}load(t){this._loaded=!1,this.fire(new h.z("dataloading",{dataType:"source"}));const o=this.map.getWorldview(),c=(m,_)=>{this._tileJSONRequest=null,this._loaded=!0,m?this.fire(new h.y(m)):_&&(Object.assign(this,_),_.raster_layers&&(this.rasterLayers=_.raster_layers,this.rasterLayerIds=this.rasterLayers.map(y=>y.id)),this.tileBounds=Dr.fromTileJSON(_),ui(_.tiles),this.fire(new h.z("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new h.z("data",{dataType:"source",sourceDataType:"content"}))),t&&t(m)};this.provider=typeof this._options.provider=="string"?this._options.provider:void 0,this._tileProvider=void 0;const d=h.aM(this._options);return d instanceof Error?(this._loaded=!0,this.fire(new h.y(d)),void(t&&t())):this.provider&&!d?(this._loaded=!0,this.fire(new h.y(new Error(`TileProvider "${this.provider}" is not registered`))),void(t&&t())):void(this._tileJSONRequest=d?this.loadTileJSONWithProvider(d,c):h.aN(this._options,this.map._requestManager,null,o,c))}loadTileJSONWithProvider(t,o){this.provider=t.name;const{request:c,options:d}=h.aO(this._options,this.map._requestManager),m=new AbortController;return h.aT(t.name,t.url).then(_=>{if(m.signal.aborted)return;const y=new _(d);return y.load&&c?y.load({request:c}).then(v=>(this._tileProvider=y,v)):(this._tileProvider=y,null)}).then(_=>{if(m.signal.aborted)return;const y=h.aP(this._options,_,this.map._requestManager);y instanceof Error?o(y):o(null,y)}).catch(_=>{m.signal.aborted||o(_ instanceof Error?_:new Error(String(_)))}),{cancel:()=>m.abort()}}loaded(){return this._loaded}onAdd(t){this.map=t,this.load()}reload(){this.cancelTileJSONRequest();const t=h.t(this.id,this.scope);this.load(()=>this.map.style.clearSource(t))}setTiles(t){return this._options.tiles=t,this.reload(),this}setUrl(t){return this.url=t,this._options.url=t,this.reload(),this}onRemove(t){this.cancelTileJSONRequest()}serialize(){return Object.assign({},this._options)}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(t,o){const c=h.o.devicePixelRatio>=2,d=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,this.scheme),c,this.tileSize),m=this.map._requestManager.transformRequest(d,h.R.Tile);if(this._tileProvider){const _=new AbortController;t.request={cancel:()=>_.abort()},this.loadTileWithProvider(t,this._tileProvider,m,_,o)}else t.request=h.n(m,(_,y,v)=>{if(delete t.request,t.aborted)return t.state="unloaded",o(null);if(_)return t.state="errored",o(_);if(!y)return o(null);const T=h.aR(v);this.map._refreshExpiredTiles&&t.setExpiryData(T),t.setTexture(y,this.map.painter),t.state="loaded",h.aS(this.dispatcher),o(null)})}async loadTileWithProvider(t,o,c,d,m){const{z:_,x:y,y:v}=t.tileID.canonical;try{const T=await o.loadTile({z:_,x:y,y:v},{request:c,signal:d.signal});if(d.signal.aborted)return t.state="unloaded",m(null);if(T==null){const P=new Error("Tile not found");return P.status=404,t.state="errored",m(P)}if(T.data==null)return t.state="loaded",m(null);const I=await createImageBitmap(new Blob([T.data]));if(d.signal.aborted)return t.state="unloaded",m(null);t.setTexture(I,this.map.painter),t.state="loaded",this.map._refreshExpiredTiles&&t.setExpiryData({cacheControl:T.cacheControl,expires:T.expires}),m(null)}catch(T){if(d.signal.aborted||T instanceof DOMException&&T.name==="AbortError")return t.state="unloaded",m(null);t.state="errored",m(T instanceof Error?T:new Error(String(T)))}finally{delete t.request}}abortTile(t,o){t.request&&(t.request.cancel(),delete t.request),o&&o()}unloadTile(t,o){t.texture&&t.texture instanceof h.T?(t.destroy(!1),t.texture&&t.texture instanceof h.T&&this.map.painter.saveTileTexture(t.texture)):t.destroy(),o&&o()}hasTransition(){return!1}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}function tp([a,t],o,c,{scaled:d=!0}={}){const{tileSize:m,buffer:_}=c,{x:y,y:v,z:T}=o;if(!isFinite(y)||!isFinite(v)||!isFinite(T))throw new Error("Invalid MRT header");const I=2**T,P=I*h.aG(a),A=I*h.aJ(t);return(function([D,O],L,{scaled:k=!0}
vendor: 1,179 bytes, line 8
8={}){if(!L)throw new Error("bandView is undefined");const{data:N,tileSize:H,buffer:Z,offset:G,scale:ne,dimension:te}=L;if(D<-Z||D>H+Z||O<-Z||O>H+Z)throw new Error(`Point (${D}, ${O}) out of bounds for tileSize=${H}, buffer=${Z}`);const se=(O+Z)*(H+2*Z)+(D+Z);if(new Uint32Array(N.buffer)[se]===4294967295)return null;let J=[];J=k?[]:new L.data.constructor(te);for(let K=0;K<te;K++)J[K]=Math.round(1e12*(N[te*se+K]*ne+G))/1e12;return J})([Math.min(Math.max(-_,Math.floor((P-y)*m)),m-1+_),Math.min(Math.max(-_,Math.floor((A-v)*m)),m-1+_)],c,{scaled:d})}class ft extends il{constructor(t,o,c,d){super(t,o,c,d),this.type="raster-array",this.maxzoom=22,this.partial=!0,this._loadTilePending={},this._loadTileLoaded={},this._options=Object.assign({type:"raster-array"},o)}triggerRepaint(t){const o=this.map.painter._terrain,c=this.map.style.getSourceCache(this.id);o&&o.enabled&&c&&o._clearRenderCacheForTile(c.id,t.tileID),this.map.triggerRepaint()}loadTile(t,o){const c=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize),d=this.map._requestManager.transformRequest(c,h.R.Tile),m={request:d,uid:t.uid,tileID:t.tileID,type:this.t
8ype,source:this.id,scope:this.scope,partial:this.partial};t.source=this.id,t.scope=this.scope,t.requestParams=d,t.actor||(t.actor=this.dispatcher.getActor());const _=(y,v,T)=>{if(delete t.request,t.aborted)return t.state="unloaded",o(null);if(y)return y.name==="AbortError"?void 0:(t.state="errored",o(y));if(this.map._refreshExpiredTiles&&v){const I=h.aR(T);t.setExpiryData(I)}if(this.partial&&t.state!=="expired")t.state="empty";else if(!this.partial){if(!v)return o(null);t.state="loaded",t._isHeaderLoaded=!0,t._mrt=v}o(null)};t.request=this.partial?t.fetchHeader(void 0,_.bind(this)):t.actor.send("loadTile",m,_.bind(this),void 0,!0)}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.actor&&t.actor.send("abortTile",{uid:t.uid,type:this.type,source:this.id,scope:this.scope})}unloadTile(t,o){const c=t.texturePerLayer;if(t.flushAllQueues(),c.size){t.destroy(!1);for(const d of c.values())this.map.painter.saveTileTexture(d)}else t.destroy()}prepareTile(t,o,c,d){t._isHeaderLoaded&&(t.state!=="empty"&&(t.state="reloading"),t.fetchBandForRender(o,c,d,(m,_)=>{m?(t.state="errored",this.fire(new h.y(m))):_&&(t._isHeaderLoaded=!0,t.setTexturePerLayer(c,_,this.map.painter),t.state="loaded"),this.triggerRepaint(t)}))}getInitialBand(t){if(!this.rasterLayers)return 0;const o=this.rasterLayers.find(({id:m})=>m===t),c=o&&o.fields,d=c&&c.bands&&c.bands;return d?d[0]:0}getTextureDescriptor(t,o,c){if(!t)return;const d=o.sourceLayer||this.rasterLayerIds&&this.rasterLayerIds[0];if(!d)return;let m=null;o instanceof h.aV?m=o.paint.get("raster-array-band"):o instanceof h.aW&&(m=o.paint.get("raster-particle-array-band"));const _=m||this.getInitialBand(d);if(_==null)return;if(!t.textureDescriptorPerLayer.get(o.id))return void this.prepareTile(t,d,o.id,_);
8if(t.updateNeeded(o.id,_)&&!c)return;const y=t.textureDescriptorPerLayer.get(o.id);return Object.assign({},y,{texture:t.texturePerLayer.get(o.id)})}getImages(t,o){const c=new Map;for(const d of t)for(const m of o){const[_,y]=m.split("/"),v=d.getLayer(_);if(!v||!v.hasBand(y)||!v.hasDataForBand(y))continue;const{bytes:T,tileSize:I,buffer:P}=v.getBandView(y),A=I+2*P,D={data:new h.q({width:A,height:A},T),pixelRatio:2,sdf:!1,usvg:!1,version:0};c.set(m,D)}return c}queryRasterArrayValueByBandId(t,o,c){const d=o._mrt;return new Promise(m=>{const _={},y=new Set;for(const[v,T]of Object.entries(d.layers)){if(c.layerName&&v!==c.layerName)continue;const I={};_[v]=I;for(const{bands:P}of T.dataIndex)for(const A of P)c.bands&&!c.bands.includes(A)||(y.add(h.t(v,A)),o.fetchBand(v,null,A,D=>{h.o.frame(()=>{I[A]=D?null:tp([t.lng,t.lat],d,T.getBandView(A)),y.delete(h.t(v,A)),y.size===0&&m(_)})},!1))}y.size===0&&m(_)})}_loadTileForQuery(t,o){if(this._loadTileLoaded[t.uid])return void o(null,t._mrt);if(this._loadTilePending[t.uid])return void this._loadTilePending[t.uid].push(o);this._loadTilePending[t.uid]=[o];const c=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize),d=this.map._requestManager.transformRequest(c,h.R.Tile);t.actor.send("loadTile",{request:d,uid:t.uid,tileID:t.tileID,type:this.t
8ype,source:this.id,scope:this.scope,partial:!1},(m,_,y)=>{if(m)return this._loadTilePending[t.uid].forEach(v=>v(m,null)),void delete this._loadTilePending[t.uid];if(!_)return this._loadTilePending[t.uid].forEach(v=>v(null,null)),void delete this._loadTilePending[t.uid];if(this.map._refreshExpiredTiles&&_){const v=h.aR(y);t.setExpiryData(v)}t._mrt=_,t._isHeaderLoaded=!0,t.state="loaded",this._loadTilePending[t.uid].forEach(v=>v(null,_)),this._loadTileLoaded[t.uid]=!0,delete this._loadTilePending[t.uid]},void 0,!0)}queryRasterArrayValueByAllBands(t,o,c){return new Promise((d,m)=>{this._loadTileForQuery(o,(_,y)=>{_?m(_):d(y?this.queryRasterArrayValueByBandId(t,o,c):null)})})}queryRasterArrayValue(t,o){const c=h.aX.convert(t),d=this.findLoadedParent(c);return d&&d._mrt?o.bands||!this.partial?this.queryRasterArrayValueByBandId(c,d,o):this.queryRasterArrayValueByAllBands(c,d,o):Promise.resolve(null)}findLoadedParent(t){const o=h.ad.fromLngLat(t,this.map.transform.tileSize),c=this.maxzoom+1,d=1<<c,m=Math.floor(o.x),_=Math.floor((o.x-m)*d),y=Math.floor(o.y*d),v=this.map.style.getSourceCache(this.id),T=new h.aU(c,m,c,_,y);return v.findLoadedParent(T,this.minzoom)}}const qt={vector:Nh,raster:il,"raster-dem":class extends il{constructor(a,t,o,c){super(a,t,o,c),this.type="raster-dem",this.maxzoom=22,this._options=Object.assign({type:"raster-dem"},t),this.encoding=t.encoding||"mapbox"}loadTileJSONWithProvider(a,t){this.provider=a.name;const{request:o,options:c}=h.aO(this._options,this.map._requestManager),d=new AbortController;return this.dispatcher.broadcast("loadTileProvider",{name:a.name,url:a.url,source:this.id,scope:this.scope,type:this.type,options:c,request:o},(m,_)=>{if(d.signal.aborted)return;if(m)return void t(m);const y=_?_.find(T=>T!=null):null,v=h.aP(this._options,y,this.map._requestManager);v instanceof Error?t(v):t(null,v)}),{cancel:()=>d.abort()}}loadTile(a,t){const o=this.map._requestManager.normalizeTileURL(a.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize),c=this.map._requestManager.transformRequest(o,h.R.Tile),d={uid:a.uid,tileID:a.tileID,source:this.id,type:this.t
8ype,scope:this.scope,request:c,encoding:this.encoding};a.actor&&a.state!=="expired"||(a.actor=this.dispatcher.getActor(),a.request=a.actor.send("loadTile",d,function(m,_){return delete a.request,a.aborted?(a.state="unloaded",t(null)):m?(a.state="errored",t(m)):(_&&(this.map._refreshExpiredTiles&&a.setExpiryData(_),_.borderReady||a.neighboringTiles||(a.neighboringTiles=this._getNeighboringTiles(a.tileID)),a.dem=_.dem,a.dem.onDeserialize(),a.needsHillshadePrepare=!0,a.needsDEMTextureUpload=!0),a.state="loaded",void t(null))}.bind(this),void 0,!0))}abortTile(a,t){a.request&&(a.request.cancel(),delete a.request),a.actor&&a.actor.send("abortTile",{uid:a.uid,type:this.type,source:this.id,scope:this.scope}),t&&t()}_getNeighboringTiles(a){const t=a.canonical,o=Math.pow(2,t.z),c=(t.x-1+o)%o,d=t.x===0?a.wrap-1:a.wrap,m=(t.x+1+o)%o,_=t.x+1===o?a.wrap+1:a.wrap,y={};return y[new h.aU(a.overscaledZ,d,t.z,c,t.y).key]={backfilled:!1},y[new h.aU(a.overscaledZ,_,t.z,m,t.y).key]={backfilled:!1},t.y>0&&(y[new h.aU(a.overscaledZ,d,t.z,c,t.y-1).key]={backfilled:!1},y[new h.aU(a.overscaledZ,a.wrap,t.z,t.x,t.y-1).key]={backfilled:!1},y[new h.aU(a.overscaledZ,_,t.z,m,t.y-1).key]={backfilled:!1}),t.y+1<o&&(y[new h.aU(a.overscaledZ,d,t.z,c,t.y+1).key]={backfilled:!1},y[new h.aU(a.overscaledZ,a.wrap,t.z,t.x,t.y+1).key]={backfilled:!1},y[new h.aU(a.overscaledZ,_,t.z,m,t.y+1).key]={backfilled:!1}),y}},"raster-array":ft,geojson:class extends h.E{constructor(a,t,o,c){super(),this.id=a,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._loaded=!1,this.actor=o.getActor(),this.setEventedParent(c),this._data=t.data,this._options=Object.assign({},t),this._collectResourceTiming=t.collectResourceTiming,t.maxzoom!==void 0&&(this.maxzoom=t.maxzoom),t.minzoom!==void 0&&(this.minzoom=t.minzoom),t.type&&(this.type=t.type),t.attribution&&(this.attribution=t.attribution),this.promoteId=t.promoteId;const d=h.ak/this.tileSize;this.workerOptions=Object.assign({source:this.id,scope:this.scope,cluster:t.cluster||!1,geojsonVtOptions:{buffer:(t.buffer!==void 0?t.buffer:128)*d,tolerance:(t.tolerance!==void 0?t.tolerance:.375)*d,extent:h.ak,maxZoom:this.maxzoom,lineMetrics:t.lineMetrics||!1,generateId:t.generateId||!1},superclusterOptions:{maxZoom:t.clusterMaxZoom!==void 0?t.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,t.clusterMinPoints||2),extent:h.ak,radius:(t.clusterRadius!==void 0?t.clusterRadius:50)*d,log:!1,generateId:t.generateId||!1},clusterProperties:t.clusterProperties,filter:t.filter,dynamic:t.dynamic},t.workerOptions)}onAdd(a){this.map=a,this.setData(this._data)}setData(a){return this._data=a,this._updateWorkerData(),this}
8updateData(a){if(!this._options.dynamic)return this.fire(new h.y(new Error("Can't call updateData on a GeoJSON source with dynamic set to false.")));if(typeof a!="string"&&(a.type==="Feature"&&(a={type:"FeatureCollection",features:[a]}),a.type!=="FeatureCollection"))return this.fire(new h.y(new Error("Data to update should be a feature or a feature collection.")));if(this._coalesce&&typeof a!="string"&&typeof this._data!="string"&&this._data.type==="FeatureCollection"){const t=new Map;for(const o of this._data.features)t.set(o.id,o);for(const o of a.features)t.set(o.id,o);this._data.features=[...t.values()]}else this._data=a;return this._updateWorkerData(!0),this}getClusterExpansionZoom(a,t){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:a,source:this.id,scope:this.scope},t),this}getClusterChildren(a,t){return this.actor.send("geojson.getClusterChildren",{clusterId:a,source:this.id,scope:this.scope},t),this}getClusterLeaves(a,t,o,c){return this.actor.send("geojson.getClusterLeaves",{source:this.id,scope:this.scope,clusterId:a,limit:t,offset:o},c),this}_updateWorkerData(a=!1){if(this._pendingLoad)return void(this._coalesce=!0);this.fire(new h.z("dataloading",{dataType:"source"})),this._loaded=!1;const t=Object.assign({append:a},this.workerOptions);t.scope=this.scope;const o=this._data;typeof o=="string"?(t.request=this.map._requestManager.transformRequest(h.o.resolveURL(o),h.R.Source),t.request.collectResourceTiming=this._collectResourceTiming):t.data=JSON.stringify(o),this._pendingLoad=this.actor.send(`${this.type}.loadData`,t,(c,d)=>{if(this._loaded=!0,this._pendingLoad=null,c)this.fire(new h.y(c));else{const m={dataType:"source",sourceDataType:this._metadataFired?"content":"metadata"};this._collectResourceTiming&&d&&d.resourceTiming&&d.resourceTiming[this.id]&&(m.resourceTiming=d.resourceTiming[this.id]),a&&(this._partialReload=!0),this.fire(new h.z("data",m)),this._partialReload=!1,this._metadataFired=!0}this._coalesce&&(this._updateWorkerData(a),this._coalesce=!1)})}loaded(){return this._loaded}reload(){const a=h.t(this.id,this.scope);this.map.style.clearSource(a),this._updateWorkerData()}loadTile(a,t){const o=a.actor?"reloadTile":"loadTile";a.actor=this.actor;const c=this.map.style?this.map.style.getLut(this.scope):null,d=c?{image:c.image.clone()}:null,m=this._partialReload,_={type:this.type,uid:a.uid,tileID:a.tileID,tileZoom:a.tileZoom,zoom:a.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,lut:d,scope:this.scope,pixelRatio:h.o.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,showElevationIdDebug:!!this.map.painter&&this.map.painter._debugParams.showElevationIdDebug,promoteId:this.promoteId,brightness:this.map.style&&this.map.style.getBrightness()||0,extraShadowCaster:a.isExtraShadowCaster,scaleFactor:this.map.getScaleFactor(),partial:m,worldview:this.map.getWorldview(),indoor:this.map.getIndoorTileOptions(this.id,this.scope)};a.request=this.actor.send(o,_,(y,v)=>m&&!v?(a.state="loaded",t(null)):(delete a.request,a.destroy(!1),a.aborted?t(null):y?t(y):(a.loadVectorData(v,this.map.painter,o==="reloadTile"),t(null))),void 0,o==="loadTile")}abortTile(a){a.request&&(a.request.cancel(),delete a.request),a.aborted=!0}unloadTile(a,t){this.actor.send("removeTile",{uid:a.uid,type:this.t
8ype,source:this.id,scope:this.scope}),a.destroy()}onRemove(a){this._pendingLoad&&this._pendingLoad.cancel()}serialize(){return Object.assign({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}},video:class extends h.aY{constructor(a,t,o,c){super(a,t,o,c),this.roundZoom=!0,this.type="video",this.options=t}load(){this._loaded=!1;const a=this.options;this.urls=[];for(const t of a.urls)this.urls.push(this.map._requestManager.transformRequest(t,h.R.Source).url);h.aZ(this.urls,(t,o)=>{this._loaded=!0,t?this.fire(new h.y(t)):o&&(this.video=o,this.video.loop=!0,this.video.setAttribute("playsinline",""),this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading())})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(a){if(this.video){const t=this.video.seekable;a<t.start(0)||a>t.end(0)?this.fire(new h.y(new Ne(`sources.${this.id}`,null,`Playback for this video can be set only between the ${t.start(0)} and ${t.end(0)}-second mark.`))):this.video.currentTime=a}}getVideo(){return this.video}
vendor: 7,373 bytes, line 8
8onAdd(a){this.map||(this.map=a,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const a=this.map.painter.context,t=a.gl;this.texture?this.video.paused||(this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE),t.texSubImage2D(t.TEXTURE_2D,0,0,0,t.RGBA,t.UNSIGNED_BYTE,this.video)):(this.texture=new h.T(a,this.video,t.RGBA8),this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE),this.width=this.video.videoWidth,this.height=this.video.videoHeight),this._prepareData(a)}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}},image:h.aY,model:h.a$,"batched-model":class extends h.E{constructor(a,t,o,c){super(),this.type="batched-model",this.id=a,this.tileSize=512,this._options=t,this.tiles=this._options.tiles,this.maxzoom=t.maxzoom||19,this.minzoom=t.minzoom||0,this.roundZoom=!0,this.usedInConflation=!0,this.dispatcher=o,this.reparseOverscaled=!1,this.scheme="xyz",this._loaded=!1,this.setEventedParent(c)}onAdd(a){this.map=a,this.load()}reload(){this.cancelTileJSONRequest();const a=h.t(this.id,this.scope);this.load(()=>this.map.style.clearSource(a))}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}load(a){this._loaded=!1,this.fire(new h.z("dataloading",{dataType:"source"}));const t=Array.isArray(this.map._language)?this.map._language.join():this.map._language,o=this.map.getWorldview();this._tileJSONRequest=h.aN(this._options,this.map._requestManager,t,o,(c,d)=>{this._tileJSONRequest=null,this._loaded=!0,c?(t&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${t}`),o&&o.length!==2&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${o}`),this.fire(new h.y(c))):d&&(Object.assign(this,d),d.bounds&&(this.tileBounds=new Dr(d.bounds,this.minzoom,this.maxzoom)),ui(d.tiles,this.map._requestManager._customAccessToken),this.fire(new h.z("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new h.z("data",{dataType:"source",sourceDataType:"content"}))),a&&a(c)})}hasTransition(){return!1}hasTile(a){return!this.tileBounds||this.tileBounds.contains(a.canonical)}loaded(){return this._loaded}loadTile(a,t){const o=this.map._requestManager.normalizeTileURL(a.tileID.canonical.url(this.tiles,this.scheme)),c={request:this.map._requestManager.transformRequest(o,h.R.Tile),data:void 0,uid:a.uid,tileID:a.tileID,tileZoom:a.tileZoom,zoom:a.tileID.overscaledZ,tileSize:this.tileSize*a.tileID.overscaleFactor(),type:this.type,source:this.id,scope:this.scope,showCollisionBoxes:this.map.showCollisionBoxes,renderSourceType:a.renderSourceType,brightness:this.map.style&&this.map.style.getBrightness()||0,pixelRatio:h.o.devicePixelRatio,promoteId:this.promoteId};if(a.actor&&a.state!=="expired")if(a.state==="loading")a.reloadCallback=t;else{if(a.buckets){const m=Object.values(a.buckets);for(const _ of m)_.dirty=!0;return void(a.state="loaded")}a.request=a.actor.send("reloadTile",c,d.bind(this))}else a.actor=this.dispatcher.getActor(),a.request=a.actor.send("loadTile",c,d.bind(this),void 0,!0);function d(m,_){return a.aborted?t(null):m&&m.status!==404?t(m):(this.map._refreshExpiredTiles&&_&&a.setExpiryData(_),a.loadModelData(_,this.map.painter),a.state="loaded",void t(null))}}serialize(){return Object.assign({},this._options)}},canvas:class extends h.aY{constructor(a,t,o,c){super(a,t,o,c),t.coordinates?Array.isArray(t.coordinates)&&t.coordinates.length===4&&!t.coordinates.some(d=>!Array.isArray(d)||d.length!==2||d.some(m=>typeof m!="number"))||this.fire(new h.y(new Ne(`sources.${a}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new h.y(new Ne(`sources.${a}`,null,'missing required property "coordinates"'))),t.animate&&typeof t.animate!="boolean"&&this.fire(new h.y(new Ne(`sources.${a}`,null,'optional "animate" property must be a boolean value'))),t.canvas?typeof t.canvas=="string"||t.canvas instanceof HTMLCanvasElement||this.fire(new h.y(new Ne(`sources.${a}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new h.y(new Ne(`sources.${a}`,null,'missing required property "canvas"'))),this.options=t,this.animate=t.animate===void 0||t.animate}load(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new h.y(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())}getCanvas(){return this.canvas}onAdd(a){this.map=a,this.load(),this.canvas&&this.animate&&this.play()}onRemove(a){this.pause()}prepare(){let a=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,a=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,a=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const t=this.map.painter.context;this.texture?!a&&!this._playing||this.texture instanceof h.a_||this.texture.update(this.canvas,{premultiply:!0}):this.texture=new h.T(t,this.canvas,t.gl.RGBA8,{premultiply:!0}),this._prepareData(t)}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const a of[this.canvas.width,this.canvas.height])if(isNaN(a)||a<=0)return!0;return!1}},custom:class extends h.E{constructor(a,t,o,c){super(),this.id=a,this.type="custom",this._dataType="raster",this._dispatcher=o,this._implementation=t,this.setEventedParent(c),this.scheme="xyz",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this._loaded=!1,this.roundZoom=!0,this._implementation||this.fire(new h.y(new Error(`Missing implementation for ${this.id} custom source`))),this._implementation.loadTile||this.fire(new h.y(new Error(`Missing loadTile implementation for ${this.id} custom source`))),this._implementation.bounds&&(this.tileBounds=new Dr(this._implementation.bounds,this.minzoom,this.maxzoom));const d=t;d.update=this._update.bind(this),d.clearTiles=this._clearTiles.bind(this),d.coveringTiles=this._coveringTiles.bind(this),Object.assign(this,h.aK(t,["dataType","scheme","minzoom","maxzoom","tileSize","attribution","minTileCacheSize","maxTileCacheSize"]))}serialize(){return h.aK(this,["type","scheme","minzoom","maxzoom","tileSize","attribution"])}load(){this._loaded=!0,this.fire(new h.z("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new h.z("data",{dataType:"source",sourceDataType:"content"}))}loaded(){return this._loaded}onAdd(a){this.map=a,this._loaded=!1,this.fire(new h.z("dataloading",{dataType:"source"})),this._implementation.onAdd&&this._implementation.onAdd(a),this.load()}onRemove(a){this._implementation.onRemove&&this._implementation.onRemove(a)}hasTile(a){if(this._implementation.hasTile){const{x:t,y:o,z:c}=a.canonical;return this._implementation.hasTile({x:t,y:o,z:c})}return!this.tileBounds||this.tileBounds.contains(a.canonical)}loadTile(a,t){const{x:o,y:c,z:d}
8=a.tileID.canonical,m=new AbortController,_=Promise.resolve(this._implementation.loadTile({x:o,y:c,z:d},{signal:m.signal})).then(function(y){return delete a.request,a.aborted?(a.state="unloaded",t(null)):y===void 0?(a.state="errored",t(null)):y===null?(this.loadTileData(a,{width:this.tileSize,height:this.tileSize,data:null}),a.state="loaded",t(null)):(function(v){return v instanceof ImageData||v instanceof HTMLCanvasElement||v instanceof ImageBitmap||v instanceof HTMLImageElement})(y)?(this.loadTileData(a,y),a.state="loaded",void t(null)):(a.state="errored",t(new Error(`Can't infer data type for ${this.id}, only raster data supported at the moment`)))}.bind(this)).catch(y=>{y.name!=="AbortError"&&(a.state="errored",t(y))});_.cancel=()=>m.abort(),a.request=_}loadTileData(a,t){a.setTexture(t,this.map.painter)}unloadTile(a,t){if(a.texture&&a.texture instanceof h.T?(a.destroy(!1),a.texture&&a.texture instanceof h.T&&this.map.painter.saveTileTexture(a.texture)):a.destroy(),this._implementation.unloadTile){const{x:o,y:c,z:d}=a.tileID.canonical;this._implementation.unloadTile({x:o,y:c,z:d})}t&&t()}abortTile(a,t){a.request&&a.request.cancel&&(a.request.cancel(),delete a.request),t&&t()}hasTransition(){return!1}_coveringTiles(){return this.map.transform.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,roundZoom:this.roundZoom}).map(a=>({x:a.canonical.x,y:a.canonical.y,z:a.canonical.z}))}_clearTiles(){const a=h.t(this.id,this.scope);this.map.style.clearSource(a)}_update(){this.fire(new h.z("data",{dataType:"source",sourceDataType:"content"}))}}},hu=function(a,t,o,c){const d=new qt[t.type](a,t,o,c);if(d.id!==a)throw new Error(`Expected Source id to be ${a} instead of ${d.id}`);return h.b0(["load","abort","unload","serialize","prepare"],d),d};function ip(a,t,o=""){return`${o}:${t.id||""}:${t.layer.id}:${(function(c){if("layerId"in c)return`layer:${c.layerId}`;{const{featuresetId:d,importId:m}=c;return`featureset:${d}${m?`:import:${m}`:""}`}})(a.target)}`}function rp(a,t,o,c=""){if(a.uniqueFeatureID){const d=ip(a,t,c);if(o.has(d))return!0;o.add(d)}return!1}function np(a,t,o,c,d=!1,m=void 0){const _=t.sourceCache.transform,y=t.sourceCache.tilesIn(a,t.has3DLayers,d);y.sort(fu);const v=[];for(const T of y){const I=T.tile.queryRenderedFeatures(t,T,o,c,_,d,m);Object.keys(I).length&&v.push({wrappedTileID:T.tile.tileID.wrapped().key,queryResults:I})}for(const T in t.layers){const I=t.layers[T];if(I.styleLayer){const P=I.styleLayer.queryRenderedFeatures(a,t.sourceCache,c);Object.keys(P).length&&v.push({wrappedTileID:0,queryResults:P})}}return v.length===0?{}:(function(T){const I={},P={};for(const A of T){const D=A.queryResults,O=A.wrappedTileID,L=P[O]=P[O]||{};for(const k in D){const N=D[k],H=L[k]=L[k]||{},Z=I[k]=I[k]||[];for(const G of N)H[G.featureIndex]||(H[G.featureIndex]=!0,Z.push(G))}}return I})(v)}function du(a,t,o,c,d,m){const _={},y=c.queryRenderedSymbols(a),v=[];for(const T of Object.keys(y).map(Number))v.push(d[T]);v.sort(fu);for(const T of v){const I=T.featureIndex.lookupSymbolFeatures(y[T.bucketInstanceId],T.bucketIndex,T.sourceLayerIndex,t,o,m);for(const P in I){const A=_[P]=_[P]||[],D=I[P];D.sort((O,L)=>{const k=T.featureSortOrder;if(k){const N=k.indexOf(O.featureIndex);return k.indexOf(L.featureIndex)-N}return L.featureIndex-O.featureIndex});for(const O of D)A.push(O)}}return _}function ro(a,t){const o=a.getRenderableIds().map(m=>a.getTileByID(m)),c=[],d={};for(let m=0;m<o.length;m++){const _=o[m],y=_.tileID.canonical.key;d[y]||(d[y]=!0,_.querySourceFeatures(c,t))}return c}function fu(a,t){const o=a.tileID,c=t.tileID;return o.overscaledZ-c.overscaledZ||o.canonical.y-c.canonical.y||o.wrap-c.wrap||o.canonical.x-c.canonical.x}h.b1.setPbf(h.b2);class Ss extends h.b3{constructor(t,o,c,d,m){super(t,o,c,d,m),this._workQueuePerLayer=new Map,this._fetchQueuePerLayer=new Map,this._taskQueue=new Map,this._isHeaderLoaded=!1,this.textureDescriptorPerLayer=new Map,this.texturePerLayer=new Map}getLayers(){return this._mrt?Object.values(this._mrt.layers):[]}getLayer(t){return this._mrt&&this._mrt.getLayer(t)}setTexturePerLayer(t,o,c){const d=c.context,m=d.gl;let _=this.texturePerLayer.get(t)||c.getTileTexture(o.width);_&&_ instanceof h.T?_.update(o,{premultiply:!1}):_=new h.T(d,o,m.RGBA8,{premultiply:!1}),this.texturePerLayer.has(t)||this.texturePerLayer.set(t,_)}flushQueues(t){const o=this._workQueuePerLayer.get(t)||[],c=this._fetchQueuePerLayer.get(t)||[];for(;o.length;)o.pop()();for(;c.length;)c.pop()()}flushAllQueues(){for(const t of this._workQueuePerLayer.keys()){const o=this._workQueuePerLayer.get(t)||[];for(;o.length;)o.pop()()}for(const t of this._fetchQueuePerLayer.keys()){const o=this._fetchQueuePerLayer.get(t)||[];for(;o.length;)o.pop()()}}fetchHeader(t=16384,o){const c=this._mrt=new h.b1(30),d=Object.assign({}
vendor: 71,038 bytes, line 8
8,this.requestParams,{headers:{Range:"bytes=0-"+(t-1)}});return this.entireBuffer=null,this.request=h.b4(d,(m,_,y)=>{if(m)o(m);else try{const v=c.getHeaderLength(_);if(v>t)return void(this.request=this.fetchHeader(v,o));c.parseHeader(_),this._isHeaderLoaded=!0;let T=0;for(const I of Object.values(c.layers))T=Math.max(T,I.dataIndex.at(-1).lastByte);_.byteLength>=T&&(this.entireBuffer=_),o(null,this.entireBuffer||_,y)}catch(v){o(v)}}),this.request}fetchBandForRender(t,o,c,d){this.fetchBand(t,o,c,m=>{if(m)return void d(m);this.updateTextureDescriptor(t,o,c);const _=this.textureDescriptorPerLayer.get(o);d(null,_?_.img:null)})}fetchBand(t,o,c,d,m=!0){const _=this._mrt;if(!this._isHeaderLoaded||!_)return void d(new Error("Tile header is not ready"));const y=this.actor;if(!y)return void d(new Error("Can't fetch tile band without an actor"));let v;const T=h.t(String(c),h.t(this.tileID.key,t));let I=this._taskQueue.get(T);I?I.add(d):(I=new Set,I.add(d),this._taskQueue.set(T,I));const P=(L,k)=>{v.complete(L,k),L?d(L):(I.forEach(N=>N(null,k)),this._taskQueue.delete(T))},A=(L,k)=>{if(L)return d(L);const N=y.send("decodeRasterArray",{type:"raster-array",source:this.source,scope:this.scope,tileID:this.tileID,uid:this.uid,buffer:k,task:v},P,void 0,!0);if(o!==null){const H=this._workQueuePerLayer.get(o)||[];H.push(()=>{N&&N.cancel(),v.cancel()}),this._workQueuePerLayer.has(o)||this._workQueuePerLayer.set(o,H)}};let D;try{D=_.getLayer(t)}catch(L){if(this.state==="reloading")return;throw L}if(!D)return void d(new Error(`Unknown sourceLayer "${t}"`));if(D.hasDataForBand(c))return I.forEach(L=>L(null,null)),void this._taskQueue.delete(T);const O=D.getDataRange([c]);if(v=_.createDecodingTask(O),!v||v.tasks.length)if(o!==null&&this.flushQueues(o),this.entireBuffer)A(null,this.entireBuffer.slice(O.firstByte,O.lastByte+1));else{const L=Object.assign({},this.requestParams,{headers:{Range:`bytes=${O.firstByte}-${O.lastByte}`}}),k=h.b4(L,A);if(o!==null){const N=this._fetchQueuePerLayer.get(o)||[];N.push(()=>{k.cancel(),v.cancel()}),this._fetchQueuePerLayer.has(o)||this._fetchQueuePerLayer.set(o,N)}}}updateNeeded(t,o){return(!this.textureDescriptorPerLayer.get(t)||this.textureDescriptorPerLayer.get(t).band!==o||this.refreshedUponExpiration)&&this.state!=="errored"}updateTextureDescriptor(t,o,c){if(!this._mrt)return;const d=this._mrt.getLayer(t);if(!d||!d.hasBand(c)||!d.hasDataForBand(c))return;const{bytes:m,tileSize:_,buffer:y,offset:v,scale:T}=d.getBandView(c),I=_+2*y,P=new h.q({width:I,height:I},m),A=this.texturePerLayer.get(o);A&&A instanceof h.T&&A.update(P,{premultiply:!1}),this.textureDescriptorPerLayer.set(o,{layer:t,band:c,img:P,buffer:y,offset:v,tileSize:_,format:d.pixelFormat,mix:[T,256*T,65536*T,16777216*T]})}destroy(t=!1){if(super.destroy(t),delete this._mrt,!t)for(const o of this.texturePerLayer.values())o&&o instanceof h.T&&o.destroy();this.texturePerLayer.clear(),this.textureDescriptorPerLayer.clear(),this.fbo&&(this.fbo.destroy(),delete this.fbo),delete this.request,delete this.requestParams,this._isHeaderLoaded=!1}}class st{constructor(t,o){this.max=t,this.onRemove=o,this.reset()}reset(){for(const t in this.data)for(const o of this.data[t])o.timeout&&clearTimeout(o.timeout),this.onRemove(o.value);return this.data={},this.order=[],this}add(t,o,c){const d=t.wrapped().key;this.data[d]===void 0&&(this.data[d]=[]);const m={value:o,timeout:void 0};if(c!==void 0&&(m.timeout=setTimeout(()=>{this.remove(t,m)},c)),this.data[d].push(m),this.order.push(d),this.order.length>this.max){const _=this._getAndRemoveByKey(this.order[0]);_&&this.onRemove(_)}return this}has(t){return t.wrapped().key in this.data}getAndRemove(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null}_getAndRemoveByKey(t){const o=this.data[t].shift();return o.timeout&&clearTimeout(o.timeout),this.data[t].length===0&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),o.value}getByKey(t){const o=this.data[t];return o?o[0].value:null}get(t){return this.has(t)?this.data[t.wrapped().key][0].value:null}remove(t,o){if(!this.has(t))return this;const c=t.wrapped().key,d=o===void 0?0:this.data[c].indexOf(o),m=this.data[c][d];return this.data[c].splice(d,1),m.timeout&&clearTimeout(m.timeout),this.data[c].length===0&&delete this.data[c],this.onRemove(m.value),this.order.splice(this.order.indexOf(c),1),this}setMaxSize(t){for(this.max=t;this.order.length>this.max;){const o=this._getAndRemoveByKey(this.order[0]);o&&this.onRemove(o)}return this}filter(t){const o=[];for(const c in this.data)for(const d of this.data[c])t(d.value)||o.push(d);for(const c of o)this.remove(c.value.tileID,c)}}class Kt{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(t,o,c){const d=String(o);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][d]=this.stateChanges[t][d]||{},Object.assign(this.stateChanges[t][d],c),this.deletedStates[t]===null){this.deletedStates[t]={};for(const m in this.state[t])m!==d&&(this.deletedStates[t][m]=null)}else if(this.deletedStates[t]&&this.deletedStates[t][d]===null){this.deletedStates[t][d]={};for(const m in this.state[t][d])c[m]||(this.deletedStates[t][d][m]=null)}else for(const m in c)this.deletedStates[t]&&this.deletedStates[t][d]&&this.deletedStates[t][d][m]===null&&delete this.deletedStates[t][d][m]}removeFeatureState(t,o,c){if(this.deletedStates[t]===null)return;const d=String(o);if(this.deletedStates[t]=this.deletedStates[t]||{},c&&o!==void 0)this.deletedStates[t][d]!==null&&(this.deletedStates[t][d]=this.deletedStates[t][d]||{},this.deletedStates[t][d][c]=null);else if(o!==void 0)if(this.stateChanges[t]&&this.stateChanges[t][d])for(c in this.deletedStates[t][d]={},this.stateChanges[t][d])this.deletedStates[t][d][c]=null;else this.deletedStates[t][d]=null;else this.deletedStates[t]=null}getState(t,o){const c=this.state[t]||{},d=this.stateChanges[t]||{},m=this.deletedStates[t];if(m===null)return{};if(o!==void 0){const y=String(o),v=Object.assign({},c[y],d[y]);if(m){const T=m[o];if(T===null)return{};for(const I in T)delete v[I]}return v}const _=Object.assign({},c,d);if(m)for(const y in m)delete _[y];return _}initializeTileState(t,o){t.refreshFeatureState(o)}coalesceChanges(t,o){const c={};for(const d in this.stateChanges){this.state[d]=this.state[d]||{};const m={};for(const _ in this.stateChanges[d])this.state[d][_]||(this.state[d][_]={}),Object.assign(this.state[d][_],this.stateChanges[d][_]),m[_]=this.state[d][_];c[d]=m}for(const d in this.deletedStates){this.state[d]=this.state[d]||{};const m={};if(this.deletedStates[d]===null)for(const _ in this.state[d])m[_]={},this.state[d][_]={};else for(const _ in this.deletedStates[d]){if(this.deletedStates[d][_]===null)this.state[d][_]={};else if(this.state[d][_])for(const y of Object.keys(this.deletedStates[d][_]))delete this.state[d][_][y];m[_]=this.state[d][_]}c[d]=c[d]||{},Object.assign(c[d],m)}if(this.stateChanges={},this.deletedStates={},Object.keys(c).length!==0)for(const d in t)t[d].refreshFeatureState(o,c)}}class Ut extends h.E{constructor(t,o,c){super(),this.id=t,this._renderSourceType=c,this._maxzoomOverride=null,o.on("data",d=>{d.dataType==="source"&&d.sourceDataType==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&d.dataType==="source"&&d.sourceDataType==="content"&&(this.reload(),this.transform&&this.update(this.transform))}),o.on("error",()=>{this._sourceErrored=!0}),this._source=o,this._tiles={},this._cache=new st(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._minTileCacheSize=o.minTileCacheSize,this._maxTileCacheSize=o.maxTileCacheSize,this._loadedParentTiles={},this.castsShadows=!1,this.tileCoverLift=0,this._coveredTiles={},this._shadowCasterTiles={},this._state=new Kt,this._isRaster=this._source.type==="raster"||this._source.type==="raster-dem"||this._source.type==="raster-array"||this._source.type==="custom"&&"_dataType"in this._source&&this._source._dataType==="raster",this._supportsFading=this._source.type==="raster"||this._source.type==="raster-array"||this._source.type==="image"||this._source.type==="video"||this._source.type==="custom",this._isRasterElevatedOverTerrain=!1}onAdd(t){this.map=t,this._minTileCacheSize=this._minTileCacheSize===void 0&&t?t._minTileCacheSize:this._minTileCacheSize,this._maxTileCacheSize=this._maxTileCacheSize===void 0&&t?t._maxTileCacheSize:this._maxTileCacheSize}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;for(const t in this._tiles)if(!this._tiles[t].loaded())return!1;return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const t=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,t&&this.reload(),this.transform&&this.update(this.transform)}setMaxzoomOverride(t){this._maxzoomOverride=t}_loadTile(t,o){return t.renderSourceType=this._renderSourceType,t.isExtraShadowCaster=this._shadowCasterTiles[t.tileID.key],this._source.loadTile(t,o)}_unloadTile(t){if(this._source.unloadTile)return this._source.unloadTile(t)}_abortTile(t){if(this._source.abortTile)return this._source.abortTile(t)}serialize(){return this._source.serialize()}prepare(t){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const o in this._tiles){const c=this._tiles[o];c.upload(t,this.map?this.map.painter:void 0),c.prepare(this.map.style.imageManager,this.map?this.map.painter:null,this._source.scope)}}getIds(){return Object.values(this._tiles).map(t=>t.tileID).sort(qr).map(t=>t.key)}getRenderableIds(t,o){const c=[];for(const d in this._tiles)this._isIdRenderable(+d,t,o)&&c.push(this._tiles[d]);return t?c.sort((d,m)=>{const _=d.tileID,y=m.tileID,v=new h.P(_.canonical.x,_.canonical.y)._rotate(this.transform.angle),T=new h.P(y.canonical.x,y.canonical.y)._rotate(this.transform.angle);return _.overscaledZ-y.overscaledZ||T.y-v.y||T.x-v.x}).map(d=>d.tileID.key):c.map(d=>d.tileID).sort(qr).map(d=>d.key)}hasRenderableParent(t){const o=this.findLoadedParent(t,0);return!!o&&this._isIdRenderable(o.tileID.key)}_isIdRenderable(t,o,c){return this._tiles[t]&&this._tiles[t].hasData()&&!this._coveredTiles[t]&&(o||!this._tiles[t].holdingForFade())&&(c||!this._shadowCasterTiles[t])}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const t in this._tiles)this._tiles[t].state!=="errored"&&this._reloadTile(+t,"reloading")}}_reloadTile(t,o){const c=this._tiles[t];c&&(c.state!=="loading"&&(c.state=o),this._loadTile(c,this._tileLoaded.bind(this,c,t,o)))}_tileLoaded(t,o,c,d,m){if(d){if(t.state="errored",h.b5(d)){if(this._source.fire(new h.z("data",{dataType:"source",sourceDataType:"error",sourceId:this._source.id,tile:t})),!(t.tileID.key in this._loadedParentTiles))return;if(this._source.type==="raster-dem"&&this.usedForTerrain&&this.map.painter.terrain){const y=this.map.painter.terrain;this.update(this.transform,y.getScaledDemTileSize(),!0),y.resetTileLookupCache(this.id)}else this.update(this.transform)}else this._source.fire(new h.y(d,{tile:t}));return}t.timeAdded=h.o.now(),c==="expired"&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(o,t),this._source.type==="raster-dem"&&t.dem&&this._backfillDEM(t),this._state.initializeTileState(t,this.map?this.map.painter:null);let _=new Map;m&&m.responseHeaders&&(_=m.responseHeaders),this._source.fire(new h.z("data",{dataType:"source",tile:t,coord:t.tileID,sourceCacheId:this.id,responseHeaders:_}))}_hasTunnelGeometry(){for(const t in this._tiles){const o=this._tiles[t];if(o&&o.hasTunnelGeometry)return!0}return!1}_backfillDEM(t){const o=this.getRenderableIds();for(let d=0;d<o.length;d++){const m=o[d];if(t.neighboringTiles&&t.neighboringTiles[m]){const _=this.getTileByID(m);c(t,_),c(_,t)}}function c(d,m){if(!d.dem||d.dem.borderReady)return;d.needsHillshadePrepare=!0,d.needsDEMTextureUpload=!0;let _=m.tileID.canonical.x-d.tileID.canonical.x;const y=m.tileID.canonical.y-d.tileID.canonical.y,v=Math.pow(2,d.tileID.canonical.z),T=m.tileID.key;_===0&&y===0||Math.abs(y)>1||(Math.abs(_)>1&&(Math.abs(_+v)===1?_+=v:Math.abs(_-v)===1&&(_-=v)),m.dem&&d.dem&&(d.dem.backfillBorder(m.dem,_,y),d.neighboringTiles&&d.neighboringTiles[T]&&(d.neighboringTiles[T].backfilled=!0)))}}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._tiles[t]}_retainLoadedChildren(t,o,c,d){for(const m in this._tiles){let _=this._tiles[m];if(d[m]||!_.hasData()||_.tileID.overscaledZ<=o||_.tileID.overscaledZ>c)continue;let y=_.tileID;for(;_&&_.tileID.overscaledZ>o+1;){const T=_.tileID.scaledTo(_.tileID.overscaledZ-1);_=this._tiles[T.key],_&&_.hasData()&&(y=T)}let v=y;for(;v.overscaledZ>o;)if(v=v.scaledTo(v.overscaledZ-1),t[v.key]){d[y.key]=y;break}}}findLoadedParent(t,o){if(t.key in this._loadedParentTiles){const c=this._loadedParentTiles[t.key];return c&&c.tileID.overscaledZ>=o?c:null}for(let c=t.overscaledZ-1;c>=o;c--){const d=t.scaledTo(c),m=this._getLoadedTile(d);if(m)return m}}_getLoadedTile(t){const o=this._tiles[t.key];return o&&o.hasData()?o:this._cache.getByKey(this._source.reparseOverscaled?t.wrapped().key:t.canonical.key)}updateCacheSize(t,o){o=o||this._source.tileSize;const c=Math.ceil(t.width/o)+1,d=Math.ceil(t.height/o)+1,m=Math.floor(c*d*5),_=typeof this._minTileCacheSize=="number"?Math.max(this._minTileCacheSize,m):m,y=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,_):_;this._cache.setMaxSize(y)}handleWrapJump(t){const o=Math.round((t-(this._prevLng===void 0?t:this._prevLng))/360);if(this._prevLng=t,o){const c={};for(const d in this._tiles){const m=this._tiles[d];m.tileID=m.tileID.unwrapTo(m.tileID.wrap+o),c[m.tileID.key]=m}this._tiles=c;for(const d in this._timers)clearTimeout(this._timers[d]),delete this._timers[d];for(const d in this._tiles)this._setTileReloadTimer(+d,this._tiles[d])}}update(t,o,c,d,m){if(this.transform=t,!this._sourceLoaded||this._paused||this.transform.freezeTileCoverage||this.usedForTerrain&&!c)return;this.updateCacheSize(t,o),this.transform.projection.name!=="globe"&&this.handleWrapJump(this.transform.center.lng),this._shadowCasterTiles={},this._coveredTiles={};const _=this._source.type==="batched-model";let y,v=this._source.maxzoom;this._maxzoomOverride!==null&&(v=Math.min(v,this._maxzoomOverride));const T=this.map&&this.map.painter?this.map.painter._terrain:null;if(T&&T.sourceCache===this&&T.attenuationRange()){const D=T.attenuationRange()[0],O=Math.floor(D)-Math.log2(T.getDemUpscale());v>O&&(v=O)}const I=this._maxzoomOverride===null&&this._source.reparseOverscaled;if(this.used||this.usedForTerrain){if(this._source.tileID)y=t.getVisibleUnwrappedCoordinates(this._source.tileID).map(D=>new h.aU(D.canonical.z,D.wrap,D.canonical.z,D.canonical.x,D.canonical.y));else if(this.tileCoverLift!==0){const D=t.clone();D.tileCoverLift=this.tileCoverLift,y=D.coveringTiles({tileSize:o||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:v,roundZoom:this._source.roundZoom&&!c,reparseOverscaled:I,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:_}),this._source.minzoom<=1&&t.projection.name==="globe"&&(y.push(new h.aU(1,0,1,0,0)),y.push(new h.aU(1,0,1,1,0)),y.push(new h.aU(1,0,1,0,1)),y.push(new h.aU(1,0,1,1,1)))}else if(y=t.coveringTiles({tileSize:o||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:v,roundZoom:this._source.roundZoom&&!c,reparseOverscaled:I,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:_}),this._source.hasTile){const D=this._source.hasTile.bind(this._source);y=y.filter(O=>D(O))}}else y=[];if(y.length>0&&this.transform.projection.name!=="globe"&&!this.usedForTerrain&&!this._supportsFading){const D=t.coveringZoomLevel({tileSize:o||this._source.tileSize,roundZoom:this._source.roundZoom&&!c}),O=Math.min(D,v);if(_){const L=t.extendTileCover(y,O);for(const k of L)y.push(k)}else if(m){const L=this.transform.getFrustum(O),k=t.extendTileCoverToNearPlane(y,L,O);for(const N of k)y.push(N);if(O>=18&&this._hasTunnelGeometry()){const N=t.extendTileCoverForTunnels(y,L,O,20);for(const H of N)y.push(H)}}else if(this.castsShadows&&d){const L=t.extendTileCover(y,O,d,16);for(const k of L)this._shadowCasterTiles[k.key]=!0,y.push(k)}}const P=this._updateRetainedTiles(y);if(this._supportsFading&&y.length!==0){const D={},O={},L=h.o.now(),k=Object.keys(P);for(const H of k){const Z=P[H],G=this._tiles[H];if(!G||G.fadeEndTime!==void 0&&G.fadeEndTime<=L)continue;const ne=this.findLoadedParent(Z,Math.max(Z.overscaledZ-Ut.maxOverzooming,this._source.minzoom));ne&&(this._addTile(ne.tileID),D[ne.tileID.key]=ne.tileID),O[H]=Z}const N=y.at(-1).overscaledZ;for(const H in this._tiles){const Z=this._tiles[H];if(P[H]||!Z.hasData())continue;let G=Z.tileID;for(;G.overscaledZ>N;){G=G.scaledTo(G.overscaledZ-1);const ne=this._tiles[G.key];if(ne&&ne.hasData()&&O[G.key]){P[H]=Z.tileID;break}}}for(const H in D)P[H]||(this._coveredTiles[H]=!0,P[H]=D[H])}for(const D in P)this._tiles[D].clearFadeHold();const A=h.b6(this._tiles,P);for(const D of A){const O=this._tiles[D];O.hasSymbolBuckets&&!O.holdingForFade()?O.setHoldDuration(this.map._fadeDuration):O.hasSymbolBuckets&&!O.symbolFadeFinished()||this._removeTile(+D)}this._updateLoadedParentTileCache(),this._renderSourceType===h.b7.Symbol&&this._source.afterUpdate&&this._source.afterUpdate()}releaseSymbolFadeTiles(){for(const t in this._tiles)this._tiles[t].holdingForFade()&&this._removeTile(+t)}_updateRetainedTiles(t){const o={};if(t.length===0)return o;const c={},d=t.reduce((T,I)=>Math.min(T,I.overscaledZ),1/0),m=t[0].overscaledZ,_=Math.max(m-Ut.maxOverzooming,this._source.minzoom),y=Math.max(m+Ut.maxUnderzooming,this._source.minzoom),v={};for(const T of t){const I=this._addTile(T);o[T.key]=T,I.hasData()||d<this._source.maxzoom&&(v[T.key]=T)}this._retainLoadedChildren(v,d,y,o);for(const T of t){let I=this._tiles[T.key];if(I.hasData())continue;if(T.canonical.z>=this._source.maxzoom){const A=T.children(this._source.maxzoom)[0],D=this.getTile(A);if(D&&D.hasData()){o[A.key]=A;continue}}else{const A=T.children(this._source.maxzoom);if(o[A[0].key]&&o[A[1].key]&&o[A[2].key]&&o[A[3].key])continue}let P=I.wasRequested();for(let A=T.overscaledZ-1;A>=_;--A){const D=T.scaledTo(A);if(c[D.key]||(c[D.key]=!0,I=this.getTile(D),!I&&P&&(I=this._addTile(D)),I&&(o[D.key]=D,P=I.wasRequested(),I.hasData())))break}}return o}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const t in this._tiles){const o=[];let c,d=this._tiles[t].tileID;for(;d.overscaledZ>0;){if(d.key in this._loadedParentTiles){c=this._loadedParentTiles[d.key];break}o.push(d.key);const m=d.scaledTo(d.overscaledZ-1);if(c=this._getLoadedTile(m),c)break;d=m}for(const m of o)this._loadedParentTiles[m]=c}}_addTile(t){let o=this._tiles[t.key];if(o)return o.isExtraShadowCaster!==!0||this._shadowCasterTiles[t.key]||this._reloadTile(t.key,"reloading"),o;o=this._cache.getAndRemove(t),o&&(this._setTileReloadTimer(t.key,o),o.tileID=t,this._state.initializeTileState(o,this.map?this.map.painter:null),this._cacheTimers[t.key]&&(clearTimeout(this._cacheTimers[t.key]),delete this._cacheTimers[t.key],this._setTileReloadTimer(t.key,o)));const c=!!o;if(!c){const d=this.map?this.map.painter:null,m=this._source.tileSize*t.overscaleFactor();o=this._source.type==="raster-array"?new Ss(t,m,this.transform.tileZoom,d,this._isRaster):new h.b3(t,m,this.transform.tileZoom,d,this._isRaster,this._source.worldview),this._loadTile(o,this._tileLoaded.bind(this,o,t.key,o.state))}return o.uses++,this._tiles[t.key]=o,c||this._source.fire(new h.z("dataloading",{tile:o,coord:o.tileID,dataType:"source"})),o}_setTileReloadTimer(t,o){t in this._timers&&(clearTimeout(this._timers[t]),delete this._timers[t]);const c=o.getExpiryTimeout();c&&(this._timers[t]=setTimeout(()=>{this._reloadTile(t,"expired"),delete this._timers[t]},c))}_removeTile(t){const o=this._tiles[t];o&&(o.uses--,delete this._tiles[t],this._timers[t]&&(clearTimeout(this._timers[t]),delete this._timers[t]),o.uses>0||(o.hasData()&&o.state!=="reloading"||o.state==="empty"?this._cache.add(o.tileID,o,o.getExpiryTimeout()):(o.aborted=!0,this._abortTile(o),this._unloadTile(o))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const t in this._tiles)this._removeTile(+t);this._source._clear&&this._source._clear(),this._cache.reset(),this.map&&this.usedForTerrain&&this.map.painter.terrain&&this.map.painter.terrain.resetTileLookupCache(this.id)}tilesIn(t,o,c){const d=[],m=this.transform;if(!m)return d;const _=m.projection.name==="globe",y=h.aG(m.center.lng);for(const v in this._tiles){const T=this._tiles[v];if(c&&T.clearQueryDebugViz(),T.holdingForFade())continue;let I;if(_){const P=T.tileID.canonical;if(P.z===0){const A=[Math.abs(h.aB(y,...wo(P,-1))-y),Math.abs(h.aB(y,...wo(P,1))-y)];I=[0,2*A.indexOf(Math.min(...A))-1]}else{const A=[Math.abs(h.aB(y,...wo(P,-1))-y),Math.abs(h.aB(y,...wo(P,0))-y),Math.abs(h.aB(y,...wo(P,1))-y)];I=[A.indexOf(Math.min(...A))-1]}}else I=[0];for(const P of I){const A=t.containsTile(T,m,o,P);A&&d.push(A)}}return d}getShadowCasterCoordinates(){return this._getRenderableCoordinates(!1,!0)}getVisibleCoordinates(t){return this._getRenderableCoordinates(t)}_getRenderableCoordinates(t,o){const c=this.getRenderableIds(t,o).map(m=>this._tiles[m].tileID),d=this.transform.projection.name==="globe";for(const m of c)m.projMatrix=this.transform.calculateProjMatrix(m.toUnwrapped()),m.expandedProjMatrix=d?this.transform.calculateProjMatrix(m.toUnwrapped(),!1,!0):m.projMatrix;return c}sortCoordinatesByDistance(t){const o=t.slice(),c=this.transform._camera.position,d=this.transform._camera.forward(),m={};for(const _ of o){const y=1/(1<<_.canonical.z);m[_.key]=((_.canonical.x+.5)*y+_.wrap-c[0])*d[0]+((_.canonical.y+.5)*y-c[1])*d[1]-c[2]*d[2]}return o.sort((_,y)=>m[_.key]-m[y.key]),o}hasTransition(){if(this._source.hasTransition())return!0;if(this._supportsFading){const t=h.o.now();for(const o in this._tiles){const c=this._tiles[o];if(c.fadeEndTime!==void 0&&c.fadeEndTime>=t)return!0}}return!1}setFeatureState(t,o,c){this._state.updateState(t=t||"_geojsonTileLayer",o,c)}removeFeatureState(t,o,c){this._state.removeFeatureState(t=t||"_geojsonTileLayer",o,c)}getFeatureState(t,o){return this._state.getState(t=t||"_geojsonTileLayer",o)}setDependencies(t,o,c){const d=this._tiles[t];d&&d.setDependencies(o,c)}reloadTilesForDependencies(t,o){for(const c in this._tiles)this._tiles[c].hasDependency(t,o)&&this._reloadTile(+c,"reloading");this._cache.filter(c=>!c.hasDependency(t,o))}_preloadTiles(t,o){if(!this._sourceLoaded){const v=()=>{this._sourceLoaded&&(this._source.off("data",v),this._preloadTiles(t,o))};return void this._source.on("data",v)}const c=new Map,d=Array.isArray(t)?t:[t],m=this.map.painter.terrain,_=this.usedForTerrain&&m?m.getScaledDemTileSize():this._source.tileSize;for(const v of d){const T=v.coveringTiles({tileSize:_,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!this.usedForTerrain,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain});for(const I of T)c.set(I.key,I);this.usedForTerrain&&v.updateElevation(!1)}const y=Array.from(c.values());h.ao(y,(v,T)=>{const I=new h.b3(v,this._source.tileSize*v.overscaleFactor(),this.transform.tileZoom,this.map.painter,this._isRaster,this._source.worldview);this._loadTile(I,P=>{this._source.type==="raster-dem"&&I.dem&&this._backfillDEM(I),T(P,I)})},o)}}function qr(a,t){const o=Math.abs(2*a.wrap)-+(a.wrap<0),c=Math.abs(2*t.wrap)-+(t.wrap<0);return a.overscaledZ-t.overscaledZ||c-o||t.canonical.y-a.canonical.y||t.canonical.x-a.canonical.x}function wo(a,t){const o=1<<a.z;return[a.x/o+t,(a.x+1)/o+t]}Ut.maxOverzooming=10,Ut.maxUnderzooming=3;class ei{constructor(t){this.style=t,this.layersGotHidden=!1,this.layers=[]}processLayersChanged(){this.layers=[];const t=!1,o=!1;for(const c in this.style._mergedLayers){const d=this.style._mergedLayers[c];if(d.type==="fill-extrusion"||d.type==="building")this.layers.push({layer:d,visible:t,visibilityChanged:o});else if(d.type==="model"){const m=this.style.getLayerSource(d);m&&m.type==="batched-model"&&this.layers.push({layer:d,visible:t,visibilityChanged:o})}}}onNewFrame(t){this.layersGotHidden=!1;for(const o of this.layers){const c=o.layer;let d=!1;c.type==="fill-extrusion"?d=!c.isHidden(t)&&c.paint.get("fill-extrusion-opacity")>0:c.type==="building"?d=!c.isHidden(t)&&c.paint.get("building-opacity")>0:c.type==="model"&&(d=!c.isHidden(t)&&c.paint.get("model-opacity").constantOr(1)>0),this.layersGotHidden=this.layersGotHidden||!d&&o.visible,o.visible=d}}updateZOffset(t,o){this.currentBuildingBuckets=[];for(const d of this.layers){const m=d.layer,_=this.style.getLayerSourceCache(m);let y=1;m.type==="fill-extrusion"?y=d.visible?m.paint.get("fill-extrusion-vertical-scale"):0:m.type==="building"&&(y=d.visible?m.paint.get("building-vertical-scale"):0);let v=_?_.getTile(o):null;if(!v&&_)for(const T in _._tiles){const I=_._tiles[T];if(o.canonical.isChildOf(I.tileID.canonical)){v=I;break}}this.currentBuildingBuckets.push({bucket:v?v.getBucket(m):null,tileID:v?v.tileID:o,verticalScale:y})}t.hasAnyZOffset=!1;let c=!1;for(let d=0;d<t.symbolInstances.length;d++){const m=t.symbolInstances.get(d),_=m.zOffset,y=this._getHeightAtTileOffset(o,m.tileAnchorX,m.tileAnchorY);m.zOffset=y!==Number.NEGATIVE_INFINITY?y:_,c||_===m.zOffset||(c=!0),t.hasAnyZOffset||m.zOffset===0||(t.hasAnyZOffset=!0)}c&&(t.zOffsetBuffersNeedUpload=!0,t.zOffsetSortDirty=!0)}_mapCoordToOverlappingTile(t,o,c,d){let m=o,_=c;if(t.canonical.z!==d.canonical.z){const y=d.canonical,v=1/(1<<t.canonical.z-y.z);m=(o+t.canonical.x*h.ak)*v-y.x*h.ak|0,_=(c+t.canonical.y*h.ak)*v-y.y*h.ak|0}return{tileX:m,tileY:_}}_getHeightAtTileOffset(t,o,c){let d,m;for(let _=0;_<this.layers.length;++_){const y=this.layers[_].layer;if(y.type!=="fill-extrusion"&&y.type!=="building")continue;const{bucket:v,tileID:T,verticalScale:I}=this.currentBuildingBuckets[_];if(!v)continue;const{tileX:P,tileY:A}=this._mapCoordToOverlappingTile(t,o,c,T),D=v.getHeightAtTileCoord(P,A);D&&D.height!==void 0&&(D.hidden?d=D.height:m=Math.max(D.height*I,m||0))}if(m!==void 0)return m;for(let _=0;_<this.layers.length;++_){const y=this.layers[_];if(y.layer.type!=="model"||!y.visible)continue;const{bucket:v,tileID:T}=this.currentBuildingBuckets[_];if(!v)continue;const{tileX:I,tileY:P}=this._mapCoordToOverlappingTile(t,o,c,T),A=v.getHeightAtTileCoord(I,P);if(A&&!A.hidden)return A.height===void 0&&d!==void 0?Math.min(A.maxHeight,d)*A.verticalScale:A.height?A.height*A.verticalScale:Number.NEGATIVE_INFINITY}return this.layersGotHidden?0:Number.NEGATIVE_INFINITY}}let Is;function rl(){return Is||(Is=new Ts),Is}function ac(a,t){const o={};for(const c in a)c!=="ref"&&(o[c]=a[c]);return h.b8.forEach(c=>{c in t&&(o[c]=t[c])}),o}function Rr(a){a=a.slice();const t=Object.create(null);for(const o of a)t[o.id]=o;for(let o=0;o<a.length;o++){const c=a[o];if(c&&"ref"in c){const d=t[c.ref];d&&(a[o]=ac(c,d))}}return a}const Tt={setStyle:"setStyle",addLayer:"addLayer",removeLayer:"removeLayer",setPaintProperty:"setPaintProperty",setLayoutProperty:"setLayoutProperty",setSlot:"setSlot",setFilter:"setFilter",addSource:"addSource",removeSource:"removeSource",setGeoJSONSourceData:"setGeoJSONSourceData",setLayerZoomRange:"setLayerZoomRange",setLayerProperty:"setLayerProperty",setCenter:"setCenter",setZoom:"setZoom",setBearing:"setBearing",setPitch:"setPitch",setSprite:"setSprite",setGlyphs:"setGlyphs",setTransition:"setTransition",setLight:"setLight",setTerrain:"setTerrain",setFog:"setFog",setSnow:"setSnow",setRain:"setRain",setCamera:"setCamera",setLights:"setLights",setProjection:"setProjection",addImport:"addImport",removeImport:"removeImport",updateImport:"updateImport",addIconset:"addIconset",removeIconset:"removeIconset"};function op(a,t,o){o.push({command:Tt.addSource,args:[a,t[a]]})}function nl(a,t,o){t.push({command:Tt.removeSource,args:[a]}),o[a]=!0}function Uh(a,t,o,c){nl(a,o,c),op(a,t,o)}function lc(a,t,o){let c;for(c in a[o])if(Object.hasOwn(a[o],c)&&c!=="data"&&!h.b9(a[o][c],t[o][c]))return!1;for(c in t[o])if(Object.hasOwn(t[o],c)&&c!=="data"&&!h.b9(a[o][c],t[o][c]))return!1;return!0}function ua(a,t,o,c,d,m){let _;for(_ in t=t||{},a=a||{})Object.hasOwn(a,_)&&(h.b9(a[_],t[_])||o.push({command:m,args:[c,_,t[_],d]}));for(_ in t)Object.hasOwn(t,_)&&!Object.hasOwn(a,_)&&(h.b9(a[_],t[_])||o.push({command:m,args:[c,_,t[_],d]}))}function ol(a){return a.id}function ha(a,t){return a[t.id]=t,a}function zr(a,t,o){const c=t.createTileMatrix(a,a.worldSize,o.toUnwrapped());return h.aC(new Float32Array(16),a.projMatrix,c)}function Fn(a,t,o){if(t.projection.name===o.projection.name)return a.projMatrix;const c=o.clone();return c.setProjection(t.projection),zr(c,t.getProjection(),a)}function Vr(a,t,o){return t.name===o.projection.name?a.projMatrix:zr(o,t,a)}class sp{constructor(t,o){this.reset(t,o)}reset(t,o){this.points=t||[],this._distances=[0];for(let c=1;c<this.points.length;c++)this._distances[c]=this._distances[c-1]+this.points[c].dist(this.points[c-1]);this.length=this._distances.at(-1),this.padding=Math.min(o||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(t){if(this.points.length===1)return this.points[0];t=h.aB(t,0,1);let o=1,c=this._distances[o];const d=t*this.paddedLength+this.padding;for(;c<d&&o<this._distances.length;)c=this._distances[++o];const m=o-1,_=this._distances[m],y=c-_,v=y>0?(d-_)/y:0;return this.points[m].mult(1-v).add(this.points[o].mult(v))}}const sl=Math.tan(85*Math.PI/180);function Ji(a,t,o,c,d,m,_){const y=h.bd();if(o)if(m.name==="globe"){const v=h.be(d,t);h.aC(y,y,v)}else{const v=h.bf([],_);y[0]=v[0],y[1]=v[1],y[4]=v[2],y[5]=v[3],c||h.bc(y,y,d.angle)}else h.aC(y,d.labelPlaneMatrix,a);return y}function Bn(a,t,o,c,d,m,_){const y=Ji(a,t,o,c,d,m,_);return m.name==="globe"&&o||(y[2]=y[6]=y[10]=y[14]=0),y}function no(a,t,o,c,d,m,_){if(o){if(m.name==="globe"){const y=Ji(a,t,o,c,d,m,_);return h.ba(y,y),h.aC(y,a,y),y}{const y=h.bb(a),[v,T,I,P]=_,[A,D,O,L,k,N,H,Z]=y;return y[0]=v*A+T*k,y[1]=v*D+T*N,y[2]=v*O+T*H,y[3]=v*L+T*Z,y[4]=I*A+P*k,y[5]=I*D+P*N,y[6]=I*O+P*H,y[7]=I*L+P*Z,c||h.bc(y,y,-d.angle),y}}return d.glCoordMatrix}function vi(a,t,o,c){const d=[a,t,o,1];o?h.aD(d,d,c):To(d,d,c);const m=d[3];return d[0]/=m,d[1]/=m,d[2]/=m,d}function pu(a,t){return Math.min(.5+a/t*.5,1.5)}function oo(a,t){const o=a[0]/a[3],c=a[1]/a[3];return o>=-t[0]&&o<=t[0]&&c>=-t[1]&&c<=t[1]}function al(a,t,o,c,d,m,_,y,v,T,I=1){const P=o.transform,A=c?a.textSizeData:a.iconSizeData,D=h.bl(A,o.transform.zoom,I),O=P.projection.name==="globe",L=[256/o.width*2+1,256/o.height*2+1],k=c?a.text.dynamicLayoutVertexArray:a.icon.dynamicLayoutVertexArray;k.clear();let N=null;O&&(N=c?a.text.globeExtVertexArray:a.icon.globeExtVertexArray);const H=a.lineVertexArray,Z=c?a.text.placedSymbolArray:a.icon.placedSymbolArray,G=o.transform.width/o.transform.height;let ne,te=!1;for(let se=0;se<Z.length;se++){const J=Z.get(se),{numGlyphs:K,writingMode:oe}=J;if(oe!==h.bm.vertical||te||ne===h.bm.horizontal||(te=!0),ne=oe,(J.hidden||oe===h.bm.vertical)&&!te){ll(K,k);continue}te=!1;const de=new h.P(J.tileAnchorX,J.tileAnchorY),ue=a.elevationType==="road",ve=!!P.elevation||ue;let{x:be,y:ke,z:fe}=P.projection.projectTilePoint(de.x,de.y,T.canonical),Ee=null;if(ve){const it=ue?a.getElevationFeatureForText(se):null;Ee={getElevation:v,elevation:P.elevation,elevationFeature:it};const[ht,xt,yt]=v(de,P.elevation,it);be+=ht,ke+=xt,fe+=yt}const pe=[be,ke,fe,1];if(h.aD(pe,pe,t),!oo(pe,L)){ll(K,k);continue}const Pe=pe[3],Ce=pu(o.transform.getCameraToCenterDistance(P.projection),Pe),Re=h.bn(A,D,J),Ye=_?Re/Ce:Re*Ce,qe=vi(be,ke,fe,d);if(qe[3]<=0){ll(K,k);continue}let je={};const Be=h.am(a.layers[0].layout.get("text-max-angle")),at=Math.cos(Be),ot=_?null:Ee,tt=Vh(J,Ye,!1,y,t,d,m,a.glyphOffsetArray,H,k,N,qe,de,je,G,ot,P.projection,T,_,at);te=tt.useVertical,ot&&tt.needsFlipping&&(je={}),(tt.notEnoughRoom||te||tt.needsFlipping&&Vh(J,Ye,!0,y,t,d,m,a.glyphOffsetArray,H,k,N,qe,de,je,G,ot,P.projection,T,_,at).notEnoughRoom)&&ll(K,k)}c?(a.text.dynamicLayoutVertexBuffer.updateData(k),N&&a.text.globeExtVertexBuffer&&a.text.globeExtVertexBuffer.updateData(N)):(a.icon.dynamicLayoutVertexBuffer.updateData(k),N&&a.icon.globeExtVertexBuffer&&a.icon.globeExtVertexBuffer.updateData(N))}function cc(a,t,o,c,d,m,_,y,v,T,I,P,A,D,O,L,k){const{lineStartIndex:N,glyphStartIndex:H,segment:Z}=y,G=H+y.numGlyphs,ne=N+y.lineLength,te=t.getoffsetX(H),se=t.getoffsetX(G-1),J=hc(a*te,o,c,d,m,_,Z,N,ne,v,T,I,P,A,!0,D,O,L,k);if(!J)return null;const K=hc(a*se,o,c,d,m,_,Z,N,ne,v,T,I,P,A,!0,D,O,L,k);return K?{first:J,last:K}:null}function mu(a,t,o,c){return a===h.bm.horizontal&&Math.abs(c)>Math.abs(o)?{useVertical:!0}:a===h.bm.vertical?c>0?{needsFlipping:!0}:null:t!==0&&(function(d,m){return d===0||Math.abs(m/d)>sl})(o,c)?t===1?{needsFlipping:!0}:null:o<0?{needsFlipping:!0}:null}function Vh(a,t,o,c,d,m,_,y,v,T,I,P,A,D,O,L,k,N,H,Z){const G=t/24,ne=a.lineOffsetX*G,te=a.lineOffsetY*G,{lineStartIndex:se,glyphStartIndex:J,numGlyphs:K,segment:oe,writingMode:de,flipState:ue}=a,ve=se+a.lineLength,be=ke=>{if(I){const[Pe,Ce,Re]=ke.up,Ye=T.length;h.bo(I,Ye+0,Pe,Ce,Re),h.bo(I,Ye+1,Pe,Ce,Re),h.bo(I,Ye+2,Pe,Ce,Re),h.bo(I,Ye+3,Pe,Ce,Re)}const[fe,Ee,pe]=ke.point;h.bp(T,fe,Ee,pe,ke.angle)};if(K>1){const ke=cc(G,y,ne,te,o,P,A,a,v,m,D,L,!1,k,N,H,Z);if(!ke)return{notEnoughRoom:!0};if(c&&!o){let[fe,Ee,pe]=ke.first.point,[Pe,Ce,Re]=ke.last.point;[fe,Ee]=vi(fe,Ee,pe,_),[Pe,Ce]=vi(Pe,Ce,Re,_);const Ye=mu(de,ue,(Pe-fe)*O,Ce-Ee);if(a.flipState=Ye&&Ye.needsFlipping?1:2,Ye)return Ye}be(ke.first);for(let fe=J+1;fe<J+K-1;fe++){const Ee=hc(G*y.getoffsetX(fe),ne,te,o,P,A,oe,se,ve,v,m,D,L,!1,!1,k,N,H,Z);if(!Ee)return T.length-=4*(fe-J),{notEnoughRoom:!0};be(Ee)}be(ke.last)}else{if(c&&!o){const fe=vi(A.x,A.y,0,d),Ee=se+oe+1,pe=new h.P(v.getx(Ee),v.gety(Ee)),Pe=vi(pe.x,pe.y,0,d),Ce=Pe[3]>0?Pe:uc(A,pe,fe,1,d,void 0,k,N.canonical),Re=mu(de,ue,(Ce[0]-fe[0])*O,Ce[1]-fe[1]);if(a.flipState=Re&&Re.needsFlipping?1:2,Re)return Re}const ke=hc(G*y.getoffsetX(J),ne,te,o,P,A,oe,se,ve,v,m,D,L,!1,!1,k,N,H,Z);if(!ke)return{notEnoughRoom:!0};be(ke)}return{}}function jh(a,t,o,c,d){const{x:m,y:_,z:y}=c.projectTilePoint(a.x,a.y,t);if(!d)return vi(m,_,y,o);const[v,T,I]=d.getElevation(a,d.elevation,d.elevationFeature);return vi(m+v,_+T,y+I,o)}function uc(a,t,o,c,d,m,_,y){const v=jh(a.sub(t)._unit()._add(a),y,d,_,m);return h.aw(v,o,v),h.ax(v,v),h.bi(v,o,v,c)}function hc(a,t,o,c,d,m,_,y,v,T,I,P,A,D,O,L,k,N,H){const Z=c?a-t:a+t;let G=Z>0?1:-1,ne=0;c&&(G*=-1,ne=Math.PI),G<0&&(ne+=Math.PI);let te=y+_+(G>0?0:1)|0,se=d,J=d,K=0,oe=0;const de=Math.abs(Z),ue=[],ve=[];let be=m,ke=be,fe=h.bg([]);const Ee=()=>uc(ke,be,J,de-K+1,I,A,L,k.canonical);for(;K+oe<=de;){if(te+=G,te<y||te>=v)return null;if(J=se,ke=be,ue.push(J),D&&ve.push(ke),be=new h.P(T.getx(te),T.gety(te)),se=P[te],!se){const ot=jh(be,k.canonical,I,L,A);se=ot[3]>0?P[te]=ot:Ee()}K+=oe;const Be=h.aw([],se,J),at=h.bh(J,se);if(o&&at>0&&oe>0&&h.bk(fe,Be)/(oe*at)<H)return null;oe=at,fe=Be}O&&A&&(P[te]&&(se=Ee(),oe=h.bh(J,se),fe=h.aw([],se,J)),P[te]=se);const pe=(de-K)/oe,Pe=be.sub(ke)._mult(pe)._add(ke),Ce=h.bi([],J,fe,pe);let Re=[0,0,1],Ye=fe[0],qe=fe[1];if(N&&(Re=L.upVector(k.canonical,Pe.x,Pe.y),Re[0]!==0||Re[1]!==0||Re[2]!==1)){const Be=[Re[2],0,-Re[0]],at=h.bj([],Re,Be);h.ax(Be,Be),h.ax(at,at),Ye=h.bk(fe,Be),qe=h.bk(fe,at)}if(o){const Be=h.bj([],Re,fe);h.ax(Be,Be),h.bi(Ce,Ce,Be,o*G)}const je=ne+Math.atan2(qe,Ye);return ue.push(Ce),D&&ve.push(Pe),{point:Ce,angle:je,path:ue,tilePath:ve,up:Re}}function ll(a,t){const o=t.length,c=o+4*a;t.resize(c),t.float32.fill(-1/0,4*o,4*c)}function To(a,t,o){const c=t[0],d=t[1];return a[0]=o[0]*c+o[4]*d+o[12],a[1]=o[1]*c+o[5]*d+o[13],a[3]=o[3]*c+o[7]*d+o[15],a}const So=100;class Gh{constructor(t,o,c=new h.bq(t.width+200,t.height+200,25),d=new h.bq(t.width+200,t.height+200,25)){this.transform=t,this.grid=c,this.ignoredGrid=d,this.pitchfactor=Math.cos(t._pitch)*t.cameraToCenterDistance,this.screenRightBoundary=t.width+So,this.screenBottomBoundary=t.height+So,this.gridRightBoundary=t.width+200,this.gridBottomBoundary=t.height+200,this.fogState=o,this.clippedSymbols=new Map}clearClippedSymbolsForBucket(t){this.clippedSymbols.delete(t)}markSymbolAsClipped(t,o){let c=this.clippedSymbols.get(t);c||(c=new Set,this.clippedSymbols.set(t,c)),c.add(o)}placeCollisionBox(t,o,c,d,m,_,y,v,T,I,P){let A=c.projectedAnchorX,D=c.projectedAnchorY,O=c.projectedAnchorZ;const L=c.tileAnchorX,k=c.tileAnchorY,N=c.elevation,H=c.tileID,Z=t.getProjection();if(N&&H){const[ve,be,ke]=Z.upVector(H.canonical,c.tileAnchorX,c.tileAnchorY),fe=Z.upVectorScale(H.canonical,this.transform.center.lat,this.transform.worldSize).metersToTile;A+=ve*N*fe,D+=be*N*fe,O+=ke*N*fe}const G=t.projection.name==="globe",ne=t.projection.name==="globe"?h.ai(this.transform.zoom):0;if(H&&G&&ne<1&&!_){const ve=1<<H.canonical.z,be=h.br(L,k);h.bs(be,be,1/h.ak),h.bt(be,be,h.br(H.canonical.x,H.canonical.y)),h.bs(be,be,1/ve),h.bu(be,be,h.br(d[0],d[1])),be[0]=h.bv(be[0],-.5,.5),h.bs(be,be,h.ak);const ke=h.bw(be[0],be[1],h.ak/(2*Math.PI),1);h.aD(ke,ke,m),A=h.aj(A,ke[0],ne),D=h.aj(D,ke[1],ne),O=h.aj(O,ke[2],ne)}const te=this.projectAndGetPerspectiveRatio(I,A,D,O,c.tileID,Z.name==="globe"||!!N||this.transform.pitch>0,Z),se=T*te.perspectiveRatio,J=(c.x1*o+y.x-c.padding)*se+te.point.x,K=(c.y1*o+y.y-c.padding)*se+te.point.y,oe=(c.x2*o+y.x+c.padding)*se+te.point.x,de=(c.y2*o+y.y+c.padding)*se+te.point.y,ue=te.perspectiveRatio<=.55||te.occluded;return!this.isInsideGrid(J,K,oe,de)||!v&&this.grid.hitTest(J,K,oe,de,P)||ue?{box:[],offscreen:!1,occluded:te.occluded}:{box:[J,K,oe,de],offscreen:this.isOffscreen(J,K,oe,de),occluded:!1}}placeCollisionCircles(t,o,c,d,m,_,y,v,T,I,P,A,D,O,L,k){const N=[],H=this.transform.elevation,Z=t.getProjection(),G=t.elevationType==="road",ne=!!H||G,te=h.bx.getAtTileOffsetFunc(k,this.transform.center.lat,this.transform.worldSize,Z),se=new h.P(c.tileAnchorX,c.tileAnchorY),J=new h.P(c.tileAnchorX,c.tileAnchorY);let{x:K,y:oe,z:de}=Z.projectTilePoint(J.x,J.y,k.canonical),ue=null;if(ne){const at=G?t.getElevationFeatureForText(d):null;ue={getElevation:te,elevation:H,elevationFeature:at};const[ot,tt,it]=te(se,H,at);K+=ot,oe+=tt,de+=it}const ve=Z.name==="globe",be=this.projectAndGetPerspectiveRatio(v,K,oe,de,k,ve||!!H||this.transform.pitch>0,Z),{perspectiveRatio:ke}=be,fe=(A?y/ke:y*ke)/h.bC,Ee=vi(K,oe,de,T),pe=c.lineOffsetX*fe,Pe=c.lineOffsetY*fe,Ce=h.am(t.layers[0].layout.get("text-max-angle")),Re=Math.cos(Ce),Ye=be.signedDistanceFromCamera>0?cc(fe,_,pe,Pe,G&&c.flipState===1,Ee,J,c,m,T,{},ne&&!A?ue:null,A&&ne,Z,k,A,Re):null;let qe=!1,je=!1,Be=!0;if(Ye&&!be.occluded){const at=.5*O*ke+L,ot=new h.P(-100,-100),tt=new h.P(this.screenRightBoundary,this.screenBottomBoundary),it=new sp,{first:ht,last:xt}=Ye,yt=ht.path.length;let St=[];for(let bt=yt-1;bt>=1;bt--)St.push(ht.path[bt]);for(let bt=1;bt<xt.path.length;bt++)St.push(xt.path[bt]);const _t=2.5*at;I&&(St=St.map(([bt,Vt,ii],oi)=>(ne&&!ve&&(ii=te(oi<yt-1?ht.tilePath[yt-1-oi]:xt.tilePath[oi-yt+2],H,ue.elevationFeature)[2]),vi(bt,Vt,ii,I))),St.some(bt=>bt[3]<=0)&&(St=[]));let Bt=[];if(St.length>0){let bt=1/0,Vt=-1/0,ii=1/0,oi=-1/0;for(const si of St)bt=Math.min(bt,si[0]),ii=Math.min(ii,si[1]),Vt=Math.max(Vt,si[0]),oi=Math.max(oi,si[1]);Vt>=ot.x&&bt<=tt.x&&oi>=ot.y&&ii<=tt.y&&(Bt=[St.map(si=>new h.P(si[0],si[1]))],(bt<ot.x||Vt>tt.x||ii<ot.y||oi>tt.y)&&(Bt=h.by(Bt,ot.x,ot.y,tt.x,tt.y)))}for(const bt of Bt){it.reset(bt,.25*at);let Vt=0;Vt=it.length<=.5*at?1:Math.ceil(it.paddedLength/_t)+1;for(let ii=0;ii<Vt;ii++){const oi=ii/Math.max(Vt-1,1),si=it.lerp(oi),$t=si.x+So,It=si.y+So;N.push($t,It,at,0);const At=$t-at,ai=It-at,Ri=$t+at,Qt=It+at;if(Be=Be&&this.isOffscreen(At,ai,Ri,Qt),je=je||this.isInsideGrid(At,ai,Ri,Qt),!o&&this.grid.hitTestCircle($t,It,at,D)&&(qe=!0,!P))return{circles:[],offscreen:!1,collisionDetected:qe,occluded:!1}}}}return{circles:!P&&qe||!je?[]:N,offscreen:Be,collisionDetected:qe,occluded:be.occluded}}queryRenderedSymbols(t){if(t.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const o=[];let c=1/0,d=1/0,m=-1/0,_=-1/0;for(const I of t){const P=new h.P(I.x+So,I.y+So);c=Math.min(c,P.x),d=Math.min(d,P.y),m=Math.max(m,P.x),_=Math.max(_,P.y),o.push(P)}const y=this.grid.query(c,d,m,_).concat(this.ignoredGrid.query(c,d,m,_)),v={},T={};for(const I of y){const P=I.key;if(v[P.bucketInstanceId]===void 0&&(v[P.bucketInstanceId]={}),v[P.bucketInstanceId][P.featureIndex])continue;const A=this.clippedSymbols.get(P.bucketInstanceId);if(A&&A.has(P.featureIndex))continue;const D=[new h.P(I.x1,I.y1),new h.P(I.x2,I.y1),new h.P(I.x2,I.y2),new h.P(I.x1,I.y2)];h.bz(o,D)&&(v[P.bucketInstanceId][P.featureIndex]=!0,T[P.bucketInstanceId]===void 0&&(T[P.bucketInstanceId]=[]),T[P.bucketInstanceId].push(P.featureIndex))}return T}insertCollisionBox(t,o,c,d,m){(o?this.ignoredGrid:this.grid).insert({bucketInstanceId:c,featureIndex:d,collisionGroupID:m},t[0],t[1],t[2],t[3])}insertCollisionCircles(t,o,c,d,m){const _=o?this.ignoredGrid:this.grid,y={bucketInstanceId:c,featureIndex:d,collisionGroupID:m};for(let v=0;v<t.length;v+=4)_.insertCircle(y,t[v],t[v+1],t[v+2])}projectAndGetPerspectiveRatio(t,o,c,d,m,_,y){const v=[o,c,d,1];let T=!1;d||this.transform.pitch>0?(h.aD(v,v,t),this.fogState&&m&&y.name!=="globe"&&(T=(function(A,D,O,L,k,N){const H=N.calculateFogTileMatrix(k),Z=[D,O,L];return h.ae(Z,Z,H),nc(A,h.af(Z),N.pitch)})(this.fogState,o,c,d,m.toUnwrapped(),this.transform)>.9)):To(v,v,t);const I=v[3];return{point:new h.P((v[0]/I+1)/2*this.transform.width+So,(-v[1]/I+1)/2*this.transform.height+So),perspectiveRatio:Math.min(.5+this.transform.getCameraToCenterDistance(y)/I*.5,1.5),signedDistanceFromCamera:I,occluded:_&&v[2]>I||T}}isOffscreen(t,o,c,d){return c<So||t>=this.screenRightBoundary||d<So||o>this.screenBottomBoundary}isInsideGrid(t,o,c,d){return c>=0&&t<this.gridRightBoundary&&d>=0&&o<this.gridBottomBoundary}getViewportMatrix(){const t=h.bA([]);return h.bB(t,t,[-100,-100,0]),t}}class Zr{constructor(t,o,c,d){this.opacity=t?Math.max(0,Math.min(1,t.opacity+(t.placed?o:-o))):d&&c?1:0,this.placed=c}isHidden(){return this.opacity===0&&!this.placed}}class dc{constructor(t,o,c,d,m,_=!1){this.text=new Zr(t?t.text:null,o,c,m),this.icon=new Zr(t?t.icon:null,o,d,m),this.clipped=_}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class da{constructor(t,o,c,d=!1){this.text=t,this.icon=o,this.skipFade=c,this.clipped=d}}class ap{constructor(){this.invProjMatrix=h.bd(),this.viewportMatrix=h.bd(),this.circles=[]}}class fc{constructor(t,o,c,d,m){this.bucketInstanceId=t,this.featureIndex=o,this.sourceLayerIndex=c,this.bucketIndex=d,this.tileID=m}}class F_{constructor(t){this.crossSourceCollisions=t,this.maxGroupID=0,this.collisionGroups={}}get(t){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[t]){const o=++this.maxGroupID;this.collisionGroups[t]={ID:o,predicate:c=>c.collisionGroupID===o}}return this.collisionGroups[t]}}function lp(a,t,o,c,d){const{horizontalAlign:m,verticalAlign:_}=h.bJ(a),y=-(m-.5)*t,v=-(_-.5)*o,T=h.bK(a,c);return new h.P(y+T[0]*d,v+T[1]*d)}function fa(a,t,o,c,d){const m=new h.P(a,t);return o&&m._rotate(c?d:-d),m}class pc{constructor(t,o,c,d,m,_){this.transform=t.clone(),this.projection=t.projection.name,this.collisionIndex=new Gh(this.transform,m),this.buildingIndex=_,this.frontCutoffStart=0,this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=o,this.retainedQueryData={},this.collisionGroups=new F_(c),this.collisionCircleArrays={},this.prevPlacement=d,d&&(d.prevPlacement=void 0),this.placedOrientations={},this.lastReplacementSourceUpdateTime=0}getBucketParts(t,o,c,d,m=1){const _=c.getBucket(o),y=c.latestFeatureIndex;if(!_||!y||o.fqid!==_.layerIds[0])return;const v=_.layers[0].layout,T=_.layers[0].paint,I=c.collisionBoxArray,P=Math.pow(2,this.transform.zoom-c.tileID.overscaledZ),A=c.tileSize/h.ak,D=c.tileID.toUnwrapped();this.transform.setProjection(_.projection);const O=(L=c.tileID,k=_.getProjection(),N=this.transform,k.name===this.projection?N.calculateProjMatrix(L.toUnwrapped()):zr(N,k,L));var L,k,N;const H=v.get("text-pitch-alignment")==="map",Z=v.get("text-rotation-alignment")==="map";o.compileFilter(o.options);const G=o.dynamicFilter(),ne=o.dynamicFilterNeedsFeature(),te=o.dynamicFilterNeedsGeometry(),se=this.transform.calculatePixelsToTileUnitsMatrix(c),J=Bn(O,c.tileID.canonical,H,Z,this.transform,_.getProjection(),se);let K=null;const oe=_.getProjection().createInversionMatrix(this.transform,c.tileID.canonical);if(H){const Pe=no(O,c.tileID.canonical,H,Z,this.transform,_.getProjection(),se);K=h.aC([],this.transform.labelPlaneMatrix,Pe)}let de=null;G&&c.latestFeatureIndex&&(de={unwrappedTileID:D,dynamicFilter:G,dynamicFilterNeedsFeature:ne,needGeometry:te}),this.retainedQueryData[_.bucketInstanceId]=new fc(_.bucketInstanceId,y,_.sourceLayerIndex,_.index,c.tileID);const[ue,ve]=_.layers[0].layout.get("text-size-scale-range"),be=h.aB(m,ue,ve),[ke,fe]=v.get("icon-size-scale-range"),Ee=h.aB(m,ke,fe),pe={bucket:_,layout:v,paint:T,posMatrix:O,invMatrix:oe,mercatorCenter:[h.aG(this.transform.center.lng),h.aJ(this.transform.center.lat)],textLabelPlaneMatrix:J,labelToScreenMatrix:K,clippingData:de,scale:P,textPixelRatio:A,holdingForFade:c.holdingForFade(),collisionBoxArray:I,partiallyEvaluatedTextSize:h.bl(_.textSizeData,this.transform.zoom,be),partiallyEvaluatedIconSize:h.bl(_.iconSizeData,this.transform.zoom,Ee),collisionGroup:this.collisionGroups.get(_.sourceID),latestFeatureIndex:c.latestFeatureIndex};if(d)for(const Pe of _.sortKeyRanges){const{sortKey:Ce,symbolInstanceStart:Re,symbolInstanceEnd:Ye}=Pe;t.push({sortKey:Ce,symbolInstanceStart:Re,symbolInstanceEnd:Ye,parameters:pe})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:_.symbolInstances.length,parameters:pe})}attemptAnchorPlacement(t,o,c,d,m,_,y,v,T,I,P,A,D,O,L,k,N,H,Z,G,ne){const{textOffset0:te,textOffset1:se,crossTileID:J}=L,K=[te,se],oe=lp(t,_,y,K,v),de=this.collisionIndex.placeCollisionBox(N,v,o,c,d,m,fa(oe.x,oe.y,T,I,this.transform.angle),O,P,A,D.predicate);if(Z){const ue=N.getSymbolInstanceIconSize(ne,this.transform.zoom,L.placedIconSymbolIndex);if(this.collisionIndex.placeCollisionBox(N,ue,Z,c,d,m,fa(oe.x,oe.y,T,I,this.transform.angle),O,P,A,D.predicate).box.length===0)return}if(de.box.length>0){let ue;return this.prevPlacement&&this.prevPlacement.variableOffsets[J]&&this.prevPlacement.placements[J]&&this.prevPlacement.placements[J].text&&(ue=this.prevPlacement.variableOffsets[J].anchor),this.variableOffsets[J]={textOffset:K,width:_,height:y,anchor:t,textScale:v,prevAnchor:ue},this.markUsedJustification(N,t,L,H),N.allowVerticalPlacement&&(this.markUsedOrientation(N,H,L),this.placedOrientations[J]=H),{shift:oe,placedGlyphBoxes:de}}}placeLayerBucketPart(t,o,c,d,m=1){const{bucket:_,layout:y,paint:v,posMatrix:T,textLabelPlaneMatrix:I,labelToScreenMatrix:P,clippingData:A,textPixelRatio:D,mercatorCenter:O,invMatrix:L,holdingForFade:k,collisionBoxArray:N,partiallyEvaluatedTextSize:H,partiallyEvaluatedIconSize:Z,collisionGroup:G,latestFeatureIndex:ne}=t.parameters,te=y.get("text-optional"),se=y.get("icon-optional"),J=y.get("text-allow-overlap"),K=y.get("icon-allow-overlap"),oe=y.get("text-rotation-alignment")==="map",de=y.get("icon-rotation-alignment")==="map",ue=y.get("text-pitch-alignment")==="map",ve=v.get("symbol-z-offset"),be=y.get("symbol-elevation-reference")==="sea",ke=y.get("symbol-placement"),[fe,Ee]=y.get("text-size-scale-range"),[pe,Pe]=y.get("icon-size-scale-range"),Ce=h.aB(m,fe,Ee),Re=h.aB(m,pe,Pe),Ye=y.get("text-variable-anchor"),qe=oe&&ke!=="point",je=de&&ke!=="point",Be=Ye&&_.hasTextData(),at=_.hasIconTextFit()&&Be&&_.hasIconData();this.transform.setProjection(_.projection);const ot=Be||qe,tt=je||at;let it=J&&(K||!_.hasIconData()||se),ht=K&&(J||!_.hasTextData()||te);const xt=!ve.isConstant();!_.collisionArrays&&N&&_.deserializeCollisionBoxes(N),c&&d&&_.updateCollisionDebugBuffers(this.transform.zoom,N,Ce,Re);const yt=(_t,Bt,bt)=>{const{crossTileID:Vt,numVerticalGlyphVertices:ii}=_t;let oi=null;if(A&&A.dynamicFilterNeedsFeature||xt){const Ht=this.retainedQueryData[_.bucketInstanceId],ri=ne.loadFeature({featureIndex:_t.featureIndex,bucketIndex:Ht.bucketIndex,sourceLayerIndex:Ht.sourceLayerIndex,layoutVertexArrayOffset:0}),Xt=ri.properties?ri.properties.worldview:null;if(_.localizable&&_.worldview&&typeof Xt=="string")if(Xt==="all")ri.properties.$localized=!0;else{if(!Xt.split(",").includes(_.worldview))return;ri.properties.$localized=!0,ri.properties.worldview=_.worldview}oi=A&&A.needGeometry?h.bH(ri,!0):ri}if(A&&!(0,A.dynamicFilter)({zoom:this.transform.zoom,pitch:this.transform.pitch,worldview:_.worldview},oi,this.retainedQueryData[_.bucketInstanceId].tileID.canonical,new h.P(_t.tileAnchorX,_t.tileAnchorY),this.transform.calculateDistanceTileData(A.unwrappedTileID)))return this.placements[Vt]=new da(!1,!1,!1,!0),void o.add(Vt);const si=ve.evaluate(oi,{});if((_t.zOffset||0)+(si||0)>0&&this.frontCutoffStart>0){const Ht=2*this.frontCutoffStart-1,ri=[_t.tileAnchorX,_t.tileAnchorY,0,1],Xt=h.aD(h.bI(),ri,T);if(Xt[1]/Xt[3]<Ht)return this.placements[Vt]=new da(!1,!1,!1,!0),void o.add(Vt)}if(o.has(Vt))return;if(k)return void(this.placements[Vt]=new da(!1,!1,!1));let $t=!1,It=!1,At=!0,ai=!1,Ri=!1,Qt=null,vt={box:null,offscreen:null,occluded:null},yi={box:null},li=null,Li=null,Nt=null,qi=0,Ir=0,sr=0;bt.textFeatureIndex?qi=bt.textFeatureIndex:_t.useRuntimeCollisionCircles&&(qi=_t.featureIndex),bt.verticalTextFeatureIndex&&(Ir=bt.verticalTextFeatureIndex);const mr=_.elevationFeatures?_.elevationFeatures[_t.elevationFeatureIndex]:void 0,tr=Ht=>{Ht.tileID=this.retainedQueryData[_.bucketInstanceId].tileID;const ri=this.transform.elevation;Ht.elevation=be?si:si+h.bx.getAtTileOffset(Ht.tileID,new h.P(Ht.tileAnchorX,Ht.tileAnchorY),ri,mr),Ht.elevation+=_t.zOffset},Jr=bt.textBox;if(Jr){tr(Jr);const Ht=Xt=>{let Zi=h.bm.horizontal;if(_.allowVerticalPlacement&&!Xt&&this.prevPlacement){const hr=this.prevPlacement.placedOrientations[Vt];hr&&(this.placedOrientations[Vt]=hr,Zi=hr,this.markUsedOrientation(_,Zi,_t))}return Zi},ri=(Xt,Zi)=>{if(_.allowVerticalPlacement&&ii>0&&bt.verticalTextBox){for(const hr of _.writingModes)if(hr===h.bm.vertical?(vt=Zi(),yi=vt):vt=Xt(),vt&&vt.box&&vt.box.length)break}else vt=Xt()};if(Ye){let Xt=Ye;if(this.prevPlacement&&this.prevPlacement.variableOffsets[Vt]){const zi=this.prevPlacement.variableOffsets[Vt];Xt.indexOf(zi.anchor)>0&&(Xt=Xt.filter(jr=>jr!==zi.anchor),Xt.unshift(zi.anchor))}const Zi=(zi,jr,Gr)=>{const uo=_.getSymbolInstanceTextSize(H,_t,this.transform.zoom,Bt),yn=(zi.x2-zi.x1)*uo+2*zi.padding,Pn=(zi.y2-zi.y1)*uo+2*zi.padding,ls=_t.hasIconTextFit&&!K?jr:null;ls&&tr(ls);let ho={box:[],offscreen:!1,occluded:!1};const Gc=J?2*Xt.length:Xt.length;for(let Us=0;Us<Gc;++Us){const za=this.attemptAnchorPlacement(Xt[Us%Xt.length],zi,O,L,ot,yn,Pn,uo,oe,ue,D,T,G,Us>=Xt.length,_t,Bt,_,Gr,ls,H,Z);if(za&&(ho=za.placedGlyphBoxes,ho&&ho.box&&ho.box.length)){$t=!0,Qt=za.shift;break}}return ho};ri(()=>Zi(Jr,bt.iconBox,h.bm.horizontal),()=>{const zi=bt.verticalTextBox;return zi&&tr(zi),_.allowVerticalPlacement&&!(vt&&vt.box&&vt.box.length)&&ii>0&&zi?Zi(zi,bt.verticalIconBox,h.bm.vertical):{box:null,offscreen:null,occluded:null}}),vt&&($t=vt.box,At=vt.offscreen,ai=vt.occluded);const hr=Ht(!(!vt||!vt.box));if(!$t&&this.prevPlacement){const zi=this.prevPlacement.variableOffsets[Vt];zi&&(this.variableOffsets[Vt]=zi,this.markUsedJustification(_,zi.anchor,_t,hr))}}else{const Xt=(Zi,hr)=>{const zi=_.getSymbolInstanceTextSize(H,_t,this.transform.zoom,Bt),jr=this.collisionIndex.placeCollisionBox(_,zi,Zi,O,L,ot,new h.P(0,0),J,D,T,G.predicate);return jr&&jr.box&&jr.box.length&&(this.markUsedOrientation(_,hr,_t),this.placedOrientations[Vt]=hr),jr};ri(()=>Xt(Jr,h.bm.horizontal),()=>{const Zi=bt.verticalTextBox;return _.allowVerticalPlacement&&ii>0&&Zi?(tr(Zi),Xt(Zi,h.bm.vertical)):{box:null,offscreen:null,occluded:null}}),Ht(!!(vt&&vt.box&&vt.box.length))}}if(li=vt,$t=li&&li.box&&li.box.length>0,At=li&&li.offscreen,ai=li&&li.occluded,_t.useRuntimeCollisionCircles){const Ht=_t.centerJustifiedTextSymbolIndex>=0?_t.centerJustifiedTextSymbolIndex:_t.verticalPlacedTextSymbolIndex,ri=_.text.placedSymbolArray.get(Ht),Xt=h.bn(_.textSizeData,H,ri),Zi=y.get("text-padding");Li=this.collisionIndex.placeCollisionCircles(_,J,ri,Ht,_.lineVertexArray,_.glyphOffsetArray,Xt,T,I,P,c,ue,G.predicate,_t.collisionCircleDiameter*Xt/h.bC,Zi,this.retainedQueryData[_.bucketInstanceId].tileID),$t=J||Li.circles.length>0&&!Li.collisionDetected,At=At&&Li.offscreen,ai=Li.occluded}if(bt.iconFeatureIndex&&(sr=bt.iconFeatureIndex),bt.iconBox){const Ht=ri=>{tr(ri);const Xt=_t.hasIconTextFit&&Qt?fa(Qt.x,Qt.y,oe,ue,this.transform.angle):new h.P(0,0),Zi=_.getSymbolInstanceIconSize(Z,this.transform.zoom,_t.placedIconSymbolIndex);return this.collisionIndex.placeCollisionBox(_,Zi,ri,O,L,tt,Xt,K,D,T,G.predicate)};yi&&yi.box&&yi.box.length&&bt.verticalIconBox?(Nt=Ht(bt.verticalIconBox),It=Nt.box.length>0):(Nt=Ht(bt.iconBox),It=Nt.box.length>0),At=At&&Nt.offscreen,Ri=Nt.occluded}const Kr=te||_t.numHorizontalGlyphVertices===0&&ii===0,Ki=se||_t.numIconVertices===0;if(Kr||Ki?Ki?Kr||(It=It&&$t):$t=It&&$t:It=$t=It&&$t,$t&&li&&li.box&&this.collisionIndex.insertCollisionBox(li.box,y.get("text-ignore-placement"),_.bucketInstanceId,yi&&yi.box&&Ir?Ir:qi,G.ID),It&&Nt&&this.collisionIndex.insertCollisionBox(Nt.box,y.get("icon-ignore-placement"),_.bucketInstanceId,sr,G.ID),Li&&($t&&this.collisionIndex.insertCollisionCircles(Li.circles,y.get("text-ignore-placement"),_.bucketInstanceId,qi,G.ID),c)){const Ht=_.bucketInstanceId;let ri=this.collisionCircleArrays[Ht];ri===void 0&&(ri=this.collisionCircleArrays[Ht]=new ap);for(let Xt=0;Xt<Li.circles.length;Xt+=4)ri.circles.push(Li.circles[Xt+0]),ri.circles.push(Li.circles[Xt+1]),ri.circles.push(Li.circles[Xt+2]),ri.circles.push(Li.collisionDetected?1:0)}const Fr=_.projection.name!=="globe";it=it&&(Fr||!ai),ht=ht&&(Fr||!Ri),this.placements[Vt]=new da($t||it,It||ht,At||_.justReloaded),o.add(Vt)},St=this.retainedQueryData[_.bucketInstanceId].tileID;if(_.elevationType==="offset"&&this.buildingIndex&&this.buildingIndex.updateZOffset(_,St),_.elevationType==="road"&&_.updateRoadElevation(St.canonical),_.updateZOffset(),_.sortFeaturesByY){const _t=_.getSortedSymbolIndexes(this.transform.angle);for(let Bt=_t.length-1;Bt>=0;--Bt){const bt=_t[Bt];yt(_.symbolInstances.get(bt),bt,_.collisionArrays[bt])}_.hasAnyZOffset&&h.w(`${_.layerIds[0]} layer symbol-z-elevate: symbols are not sorted by elevation if symbol-z-order is evaluated to viewport-y`)}else if(_.hasAnyZOffset){const _t=_.getSortedIndexesByZOffset();for(let Bt=0;Bt<_t.length;++Bt){const bt=_t[Bt];yt(_.symbolInstances.get(bt),bt,_.collisionArrays[bt])}}else for(let _t=t.symbolInstanceStart;_t<t.symbolInstanceEnd;_t++)yt(_.symbolInstances.get(_t),_t,_.collisionArrays[_t]);if(c&&_.bucketInstanceId in this.collisionCircleArrays){const _t=this.collisionCircleArrays[_.bucketInstanceId];h.ba(_t.invProjMatrix,T),_t.viewportMatrix=this.collisionIndex.getViewportMatrix()}_.justReloaded=!1}markUsedJustification(t,o,c,d){const{leftJustifiedTextSymbolIndex:m,centerJustifiedTextSymbolIndex:_,rightJustifiedTextSymbolIndex:y,verticalPlacedTextSymbolIndex:v,crossTileID:T}=c,I=h.bL(o),P=d===h.bm.vertical?v:I==="left"?m:I==="center"?_:I==="right"?y:-1;m>=0&&(t.text.placedSymbolArray.get(m).crossTileID=P>=0&&m!==P?0:T),_>=0&&(t.text.placedSymbolArray.get(_).crossTileID=P>=0&&_!==P?0:T),y>=0&&(t.text.placedSymbolArray.get(y).crossTileID=P>=0&&y!==P?0:T),v>=0&&(t.text.placedSymbolArray.get(v).crossTileID=P>=0&&v!==P?0:T)}markUsedOrientation(t,o,c){const d=o===h.bm.horizontal||o===h.bm.horizontalOnly?o:0,m=o===h.bm.vertical?o:0,{leftJustifiedTextSymbolIndex:_,centerJustifiedTextSymbolIndex:y,rightJustifiedTextSymbolIndex:v,verticalPlacedTextSymbolIndex:T}=c,I=t.text.placedSymbolArray;_>=0&&(I.get(_).placedOrientation=d),y>=0&&(I.get(y).placedOrientation=d),v>=0&&(I.get(v).placedOrientation=d),T>=0&&(I.get(T).placedOrientation=m)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;const o=this.prevPlacement;let c=!1;this.prevZoomAdjustment=o?o.zoomAdjustment(this.transform.zoom):0;const d=o?o.symbolFadeChange(t):1,m=o?o.opacities:{},_=o?o.variableOffsets:{},y=o?o.placedOrientations:{};for(const v in this.placements){const T=this.placements[v],I=m[v];I?(this.opacities[v]=new dc(I,d,T.text,T.icon,null,T.clipped),c=c||T.text!==I.text.placed||T.icon!==I.icon.placed):(this.opacities[v]=new dc(null,d,T.text,T.icon,T.skipFade,T.clipped),c=c||T.text||T.icon)}for(const v in m){const T=m[v];if(!this.opacities[v]){const I=new dc(T,d,!1,!1);I.isHidden()||(this.opacities[v]=I,c=c||T.text.placed||T.icon.placed)}}for(const v in _)this.variableOffsets[v]||!this.opacities[v]||this.opacities[v].isHidden()||(this.variableOffsets[v]=_[v]);for(const v in y)this.placedOrientations[v]||!this.opacities[v]||this.opacities[v].isHidden()||(this.placedOrientations[v]=y[v]);c?this.lastPlacementChangeTime=t:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=o?o.lastPlacementChangeTime:t)}updateLayerOpacities(t,o,c,d){d&&(this.lastReplacementSourceUpdateTime=d.updateTime);const m=new Set;for(const _ of o){const y=_.getBucket(t);y&&_.latestFeatureIndex&&t.fqid===y.layerIds[0]&&(this.updateBucketOpacities(y,m,_,_.collisionBoxArray,c,d,_.tileID,t.scope),y.elevationType==="offset"&&this.buildingIndex&&this.buildingIndex.updateZOffset(y,_.tileID),y.elevationType==="road"&&y.updateRoadElevation(_.tileID.canonical),y.updateZOffset())}}updateBucketOpacities(t,o,c,d,m,_,y,v){t.hasTextData()&&t.text.opacityVertexArray.clear(),t.hasIconData()&&t.icon.opacityVertexArray.clear(),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexArray.clear(),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexArray.clear();const T=t.layers[0].layout,I=t.layers[0].paint,P=!!t.layers[0].dynamicFilter(),A=new dc(null,0,!1,!1,!0),D=T.get("text-allow-overlap"),O=T.get("icon-allow-overlap"),L=T.get("text-variable-anchor"),k=T.get("text-rotation-alignment")==="map",N=T.get("text-pitch-alignment")==="map",H=I.get("symbol-z-offset"),Z=T.get("symbol-elevation-reference")==="sea",G=!H.isConstant(),ne=new dc(null,0,D&&(O||!t.hasIconData()||T.get("icon-optional")),O&&(D||!t.hasTextData()||T.get("text-optional")),!0);!t.collisionArrays&&d&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(d);const te=(J,K,oe)=>{for(let de=0;de<K/4;de++)J.opacityVertexArray.emplaceBack(oe)};let se=0;_&&t.updateReplacement(y,_),this.collisionIndex.clearClippedSymbolsForBucket(t.bucketInstanceId);for(let J=0;J<t.symbolInstances.length;J++){const K=t.symbolInstances.get(J),{numHorizontalGlyphVertices:oe,numVerticalGlyphVertices:de,crossTileID:ue,numIconVertices:ve,tileAnchorX:be,tileAnchorY:ke}=K;let fe=null;const Ee=this.retainedQueryData[t.bucketInstanceId];G&&K&&Ee&&(fe=c.latestFeatureIndex.loadFeature({featureIndex:K.featureIndex,bucketIndex:Ee.bucketIndex,sourceLayerIndex:Ee.sourceLayerIndex,layoutVertexArrayOffset:0}));const pe=H.evaluate(fe,{}),Pe=o.has(ue);let Ce=this.opacities[ue];Pe?Ce=A:Ce||(Ce=ne,this.opacities[ue]=Ce),o.add(ue);const Re=oe>0||de>0,Ye=ve>0,qe=this.placedOrientations[ue],je=qe===h.bm.vertical,Be=qe===h.bm.horizontal||qe===h.bm.horizontalOnly;!Re&&!Ye||Ce.isHidden()||se++;let at=!1;if((Re||Ye)&&_)for(const ot of t.activeReplacements){if(h.bD(ot,m,h.bE.Symbol,v)||ot.min.x>be||be>ot.max.x||ot.min.y>ke||ke>ot.max.y)continue;const tt=h.bF(be,ke,y.canonical,ot.footprintTileId.canonical);if(at=h.bG(tt,ot.footprint),at)break}if(at&&this.collisionIndex.markSymbolAsClipped(t.bucketInstanceId,K.featureIndex),Re){const ot=at?ul:up(Ce.text);te(t.text,oe,je?ul:ot),te(t.text,de,Be?ul:ot);const tt=Ce.text.isHidden(),{leftJustifiedTextSymbolIndex:it,centerJustifiedTextSymbolIndex:ht,rightJustifiedTextSymbolIndex:xt,verticalPlacedTextSymbolIndex:yt}=K,St=t.text.placedSymbolArray,_t=tt||je?1:0;it>=0&&(St.get(it).hidden=_t),ht>=0&&(St.get(ht).hidden=_t),xt>=0&&(St.get(xt).hidden=_t),yt>=0&&(St.get(yt).hidden=tt||Be?1:0);const Bt=this.variableOffsets[ue];Bt&&this.markUsedJustification(t,Bt.anchor,K,qe);const bt=this.placedOrientations[ue];bt&&(this.markUsedJustification(t,"left",K,bt),this.markUsedOrientation(t,bt,K))}if(Ye){const ot=at?ul:up(Ce.icon),{placedIconSymbolIndex:tt,verticalPlacedIconSymbolIndex:it}=K,ht=t.icon.placedSymbolArray,xt=Ce.icon.isHidden()?1:0;tt>=0&&(te(t.icon,ve,je?ul:ot),ht.get(tt).hidden=xt),it>=0&&(te(t.icon,K.numVerticalIconVertices,Be?ul:ot),ht.get(it).hidden=xt)}if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const ot=t.collisionArrays[J];if(ot){let tt=new h.P(0,0),it=!0;if(ot.textBox||ot.verticalTextBox){if(L){const xt=this.variableOffsets[ue];xt?(tt=lp(xt.anchor,xt.width,xt.height,xt.textOffset,xt.textScale),k&&tt._rotate(N?this.transform.angle:-this.transform.angle)):it=!1}P&&(it=!Ce.clipped),ot.textBox&&_u(t.textCollisionBox.collisionVertexArray,Ce.text.placed,!it||je,pe,Z,tt.x,tt.y),ot.verticalTextBox&&_u(t.textCollisionBox.collisionVertexArray,Ce.text.placed,!it||Be,pe,Z,tt.x,tt.y)}const ht=it&&!!(!Be&&ot.verticalIconBox);ot.iconBox&&_u(t.iconCollisionBox.collisionVertexArray,Ce.icon.placed,ht,pe,Z,K.hasIconTextFit?tt.x:0,K.hasIconTextFit?tt.y:0),ot.verticalIconBox&&_u(t.iconCollisionBox.collisionVertexArray,Ce.icon.placed,!ht,pe,Z,K.hasIconTextFit?tt.x:0,K.hasIconTextFit?tt.y:0)}}}if(t.fullyClipped=se===0,t.sortFeatures(this.transform.angle),this.retainedQueryData[t.bucketInstanceId]&&(this.retainedQueryData[t.bucketInstanceId].featureSortOrder=t.featureSortOrder),t.hasTextData()&&t.text.opacityVertexBuffer&&t.text.opacityVertexBuffer.updateData(t.text.opacityVertexArray),t.hasIconData()&&t.icon.opacityVertexBuffer&&t.icon.opacityVertexBuffer.updateData(t.icon.opacityVertexArray),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexBuffer&&t.iconCollisionBox.collisionVertexBuffer.updateData(t.iconCollisionBox.collisionVertexArray),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexBuffer&&t.textCollisionBox.collisionVertexBuffer.updateData(t.textCollisionBox.collisionVertexArray),t.bucketInstanceId in this.collisionCircleArrays){const J=this.collisionCircleArrays[t.bucketInstanceId];t.placementInvProjMatrix=J.invProjMatrix,t.placementViewportMatrix=J.viewportMatrix,t.collisionCircleArray=J.circles,delete this.collisionCircleArrays[t.bucketInstanceId]}}symbolFadeChange(t){return this.fadeDuration===0?1:(t-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(t){return Math.max(0,(this.transform.zoom-t)/1.5)}hasTransitions(t){return t-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(t,o){const c=this.zoomAtLastRecencyCheck===o?1-this.zoomAdjustment(o):1;return this.zoomAtLastRecencyCheck=o,this.commitTime+this.fadeDuration*c>t}isStale(){return this.stale}setStale(){this.stale=!0}}function _u(a,t,o,c,d,m,_){a.emplaceBack(t?1:0,o?1:0,m||0,_||0,c,d?1:0),a.emplaceBack(t?1:0,o?1:0,m||0,_||0,c,d?1:0),a.emplaceBack(t?1:0,o?1:0,m||0,_||0,c,d?1:0),a.emplaceBack(t?1:0,o?1:0,m||0,_||0,c,d?1:0)}const B_=Math.pow(2,25),cl=Math.pow(2,24),cp=Math.pow(2,17),gu=Math.pow(2,16),$h=Math.pow(2,9),Es=Math.pow(2,8),k_=Math.pow(2,1);function up(a){if(a.opacity===0&&!a.placed)return 0;if(a.opacity===1&&a.placed)return 4294967295;const t=a.placed?1:0,o=Math.floor(127*a.opacity);return o*B_+t*cl+o*cp+t*gu+o*$h+t*Es+o*k_+t}const ul=0;class hp{constructor(t){this._sortAcrossTiles=t.layout.get("symbol-z-order")!=="viewport-y"&&t.layout.get("symbol-sort-key").constantOr(1)!==void 0,this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs=new Set,this._bucketParts=[]}continuePlacement(t,o,c,d,m,_){const y=this._bucketParts;for(;this._currentTileIndex<t.length;)if(o.getBucketParts(y,d,t[this._currentTileIndex],this._sortAcrossTiles,_),this._currentTileIndex++,m())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,y.sort((v,T)=>v.sortKey-T.sortKey));this._currentPartIndex<y.length;){const v=y[this._currentPartIndex];if(o.placeLayerBucketPart(v,this._seenCrossTileIDs,c,v.symbolInstanceStart===0,_),this._currentPartIndex++,m())return!0}return!1}}class dp{startNewPlacement(t,o,c,d,m,_,y,v){return this.placement=new pc(t,d,m,_,y,v),this._currentPlacementIndex=o.length-1,this._forceFullPlacement=!1,this._showCollisionBoxes=c,this._fadeDuration=d,this._done=!1,this._inProgressLayer=null,this}requestFullPlacement(){this._forceFullPlacement=!0}isFullPlacementRequested(){return this._forceFullPlacement}setStale(){this.placement&&(this.placement.stale=!0)}isStale(){return!!this.placement&&this.placement.stale}isDone(){return this._done}continuePlacement(t,o,c,d,m){const _=h.o.now(),y=()=>{const v=h.o.now()-_;return!this.isFullPlacementRequested()&&this._fadeDuration!==0&&v>2};for(;this._currentPlacementIndex>=0;){const v=o[t[this._currentPlacementIndex]],T=this.placement.collisionIndex.transform.zoom;if(v.type==="symbol"&&v.visibility!=="none"&&(!v.minzoom||v.minzoom<=T)&&(!v.maxzoom||v.maxzoom>T)){const I=v,P=I.layout.get("symbol-z-elevate"),A=I.layout.get("symbol-sort-key").constantOr(1)!==void 0,D=I.layout.get("symbol-z-order"),O=D==="viewport-y"||D==="auto"&&!(D!=="viewport-y"&&A),L=I.layout.get("text-allow-overlap")||I.layout.get("icon-allow-overlap")||I.layout.get("text-ignore-placement")||I.layout.get("icon-ignore-placement"),k=O&&L,N=this._inProgressLayer=this._inProgressLayer||new hp(I),H=h.t(v.source,v.scope);if(N.continuePlacement(P||k?d[H]:c[H],this.placement,this._showCollisionBoxes,v,y,m))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._forceFullPlacement=!1,this._done=!0}commit(t){return this.placement.commit(t),this.placement}}const mc=512/h.ak/2;class fp{constructor(t,o,c){this.tileID=t,this.bucketInstanceId=c,this.index=new h.bM(o.length,16,Int32Array),this.keys=[],this.crossTileIDs=[];const d=t.canonical.x*h.ak,m=t.canonical.y*h.ak;for(let _=0;_<o.length;_++){const{key:y,crossTileID:v,tileAnchorX:T,tileAnchorY:I}=o.get(_),P=Math.floor((d+T)*mc),A=Math.floor((m+I)*mc);this.index.add(P,A),this.keys.push(y),this.crossTileIDs.push(v)}this.index.finish()}findMatches(t,o,c){const d=this.tileID.canonical.z<o.canonical.z?1:Math.pow(2,this.tileID.canonical.z-o.canonical.z),m=mc/Math.pow(2,o.canonical.z-this.tileID.canonical.z),_=o.canonical.x*h.ak,y=o.canonical.y*h.ak;for(let v=0;v<t.length;v++){const T=t.get(v);if(T.crossTileID)continue;const{key:I,tileAnchorX:P,tileAnchorY:A}=T,D=Math.floor((_+P)*m),O=Math.floor((y+A)*m),L=this.index.range(D-d,O-d,D+d,O+d).sort((k,N)=>k-N);for(const k of L){const N=this.crossTileIDs[k];if(this.keys[k]===I&&!c.has(N)){c.add(N),T.crossTileID=N;break}}}}}class pp{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class mp{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(t){const o=Math.round((t-this.lng)/360);if(o!==0)for(const c in this.indexes){const d=this.indexes[c],m={};for(const _ in d){const y=d[_];y.tileID=y.tileID.unwrapTo(y.tileID.wrap+o),m[y.tileID.key]=y}this.indexes[c]=m}this.lng=t}addBucket(t,o,c){if(this.indexes[t.overscaledZ]&&this.indexes[t.overscaledZ][t.key]){if(this.indexes[t.overscaledZ][t.key].bucketInstanceId===o.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(t.overscaledZ,this.indexes[t.overscaledZ][t.key])}for(let m=0;m<o.symbolInstances.length;m++)o.symbolInstances.get(m).crossTileID=0;this.usedCrossTileIDs[t.overscaledZ]||(this.usedCrossTileIDs[t.overscaledZ]=new Set);const d=this.usedCrossTileIDs[t.overscaledZ];for(const m in this.indexes){const _=this.indexes[m];if(Number(m)>t.overscaledZ)for(const y in _){const v=_[y];v.tileID.isChildOf(t)&&v.findMatches(o.symbolInstances,t,d)}else{const y=_[t.scaledTo(Number(m)).key];y&&y.findMatches(o.symbolInstances,t,d)}}for(let m=0;m<o.symbolInstances.length;m++){const _=o.symbolInstances.get(m);_.crossTileID||(_.crossTileID=c.generate(),d.add(_.crossTileID))}return this.indexes[t.overscaledZ]===void 0&&(this.indexes[t.overscaledZ]={}),this.indexes[t.overscaledZ][t.key]=new fp(t,o.symbolInstances,o.bucketInstanceId),!0}removeBucketCrossTileIDs(t,o){for(const c of o.crossTileIDs)this.usedCrossTileIDs[t].delete(c)}removeStaleBuckets(t){let o=!1;for(const c in this.indexes){const d=this.indexes[c];for(const m in d)t[d[m].bucketInstanceId]||(this.removeBucketCrossTileIDs(c,d[m]),delete d[m],o=!0)}return o}}class _p{constructor(){this.layerIndexes={},this.crossTileIDs=new pp,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(t,o,c,d){let m=this.layerIndexes[t.fqid];m===void 0&&(m=this.layerIndexes[t.fqid]=new mp);let _=!1;const y={};d.name!=="globe"&&m.handleWrapJump(c);for(const v of o){const T=v.getBucket(t);T&&t.fqid===T.layerIds[0]&&(T.bucketInstanceId||(T.bucketInstanceId=++this.maxBucketInstanceId),m.addBucket(v.tileID,T,this.crossTileIDs)&&(_=!0),y[T.bucketInstanceId]=!0)}return m.removeStaleBuckets(y)&&(_=!0),_}pruneUnusedLayers(t){const o={};t.forEach(c=>{o[c]=!0});for(const c in this.layerIndexes)o[c]||delete this.layerIndexes[c]}}const Io=770,Eo=771;class gt{constructor(t,o,c,d){this.blendFunction=t,this.blendColor=o.toNonPremultipliedRenderColor(null),this.mask=c,this.blendEquation=d}}gt.Replace=[1,0,1,0],gt.disabled=new gt(gt.Replace,h.C.transparent,[!1,!1,!1,!1]),gt.unblended=new gt(gt.Replace,h.C.transparent,[!0,!0,!0,!0]),gt.alphaBlended=new gt([1,Eo,1,Eo],h.C.transparent,[!0,!0,!0,!0]),gt.alphaBlendedNonPremultiplied=new gt([Io,Eo,Io,Eo],h.C.transparent,[!0,!0,!0,!0]),gt.multiply=new gt([774,0,774,0],h.C.transparent,[!0,!0,!0,!0]),gt.multiplyAccumulateAlpha=new gt([774,0,1,Eo],h.C.transparent,[!0,!0,!0,!0]),gt.additive=new gt([1,1,1,1],h.C.transparent,[!0,!0,!0,!0]),gt.additiveAlphaWeighted=new gt([Io,1,773,1],h.C.transparent,[!0,!0,!0,!0]),gt.additiveAlphaWeightedUnboundedAlpha=new gt([Io,1,1,1],h.C.transparent,[!0,!0,!0,!0]);class rt{constructor(t,o,c){this.func=t,this.mask=o,this.range=c}}rt.ReadOnly=!1,rt.ReadWrite=!0,rt.disabled=new rt(519,rt.ReadOnly,[0,1]);const pa=7680;class pt{constructor(t,o,c,d,m,_){this.test=t,this.ref=o,this.mask=c,this.fail=d,this.depthFail=m,this.pass=_}}pt.disabled=new pt({func:519,mask:0},0,0,pa,pa,pa);const yu=1029,_c=2305;class lt{constructor(t,o,c){this.enable=t,this.mode=o,this.frontFace=c}}function gc(a,t){const o=h.bS(a,3);h.bV(a,t),h.b_(a,3,o)}function Xe(a,t){const o=h.bP([]);return h.bQ(o,o,-t),h.bR(o,o,-a),o}function Hh(a,t){const o=[a[0],a[1],0],c=[t[0],t[1],0];if(h.af(o)>=1e-15){const _=h.ax([],o);h.bN(c,_,h.bk(c,_)),t[0]=c[0],t[1]=c[1]}const d=h.bj([],t,a);if(h.bO(d)<1e-15)return null;const m=Math.atan2(-d[1],d[0]);return Xe(Math.atan2(Math.sqrt(a[0]*a[0]+a[1]*a[1]),-a[2]),m)}lt.disabled=new lt(!1,yu,_c),lt.backCCW=new lt(!0,yu,_c),lt.backCW=new lt(!0,yu,2304),lt.frontCW=new lt(!0,1028,2304),lt.frontCCW=new lt(!0,1028,_c);class qh{constructor(t,o){this.position=t,this.orientation=o}get position(){return this._position}set position(t){if(t){const o=t instanceof h.ad?t:new h.ad(t[0],t[1],t[2]);
8this._renderWorldCopies&&(o.x=h.bv(o.x,0,1)),this._position=o}else this._position=null}lookAtPoint(t,o,c){if(this.orientation=null,!this.position)return;const d=this.position,m=c||(this._elevation?this._elevation.getAtPointOrZero(h.ad.fromLngLat(t)):0),_=h.ad.fromLngLat(t,m),y=[_.x-d.x,_.y-d.y,_.z-d.z];o||(o=[0,0,1]),o[2]=Math.abs(o[2]),this.orientation=Hh(y,o)}setPitchBearing(t,o){this.orientation=Xe(h.am(t),h.am(-o))}}class ma{constructor(t,o){this._transform=h.bA([]),this.orientation=o,this.position=t}get mercatorPosition(){const t=this.position;return new h.ad(t[0],t[1],t[2])}get position(){const t=h.bS(this._transform,3);return[t[0],t[1],t[2]]}set position(t){var o;t&&h.b_(this._transform,3,[(o=t)[0],o[1],o[2],1])}get orientation(){return this._orientation}set orientation(t){this._orientation=t||h.bP([]),t&&gc(this._transform,this._orientation)}getPitchBearing(){const t=this.forward(),o=this.right();return{bearing:Math.atan2(-o[1],o[0]),pitch:Math.atan2(Math.sqrt(t[0]*t[0]+t[1]*t[1]),-t[2])}}setPitchBearing(t,o){this._orientation=Xe(t,o),gc(this._transform,this._orientation)}forward(){const t=h.bS(this._transform,2);return[-t[0],-t[1],-t[2]]}up(){const t=h.bS(this._transform,1);return[-t[0],-t[1],-t[2]]}right(){const t=h.bS(this._transform,0);return[t[0],t[1],t[2]]}getCameraToWorld(t,o){const c=new Float64Array(16);return h.ba(c,this.getWorldToCamera(t,o)),c}getCameraToWorldMercator(){return this._transform}getWorldToCameraPosition(t,o,c){const d=this.position;h.bN(d,d,-t);const m=new Float64Array(16);return h.bT(m,[c,c,c]),h.bB(m,m,d),m[10]*=o,m}getWorldToCamera(t,o){const c=new Float64Array(16),d=new Float64Array(4),m=this.position;return h.bU(d,this._orientation),h.bN(m,m,-t),h.bV(c,d),h.bB(c,c,m),c[1]*=-1,c[5]*=-1,c[9]*=-1,c[13]*=-1,c[8]*=o,c[9]*=o,c[10]*=o,c[11]*=o,c}getCameraToClipPerspective(t,o,c,d){const m=new Float64Array(16);return h.bW(m,t,o,c,d),m}getCameraToClipOrthographic(t,o,c,d,m,_){const y=new Float64Array(16);return h.bX(y,t,o,c,d,m,_),y}getDistanceToElevation(t,o=!1){const c=t===0?0:h.bY(t,o?h.bZ(this.position[1]):this.position[1]),d=this.forward();return(c-this.position[2])/d[2]}clone(){return new ma([...this.position],[...this.orientation])}}const Ko=(a,t)=>({u_matrix:a,u_ground_shadow_factor:t});class yc{constructor(t=0,o=0,c=0,d=0){if(isNaN(t)||t<0||isNaN(o)||o<0||isNaN(c)||c<0||isNaN(d)||d<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=o,this.left=c,this.right=d}interpolate(t,o,c){return o.top!=null&&t.top!=null&&(this.top=h.aj(t.top,o.top,c)),o.bottom!=null&&t.bottom!=null&&(this.bottom=h.aj(t.bottom,o.bottom,c)),o.left!=null&&t.left!=null&&(this.left=h.aj(t.left,o.left,c)),o.right!=null&&t.right!=null&&(this.right=h.aj(t.right,o.right,c)),this}getCenter(t,o){const c=h.aB((this.left+t-this.right)/2,0,t),d=h.aB((this.top+o-this.bottom)/2,0,o);return new h.P(c,d)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new yc(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const Sn=15;class hl{constructor(t,o,c,d,m,_,y){this.tileSize=512,this._renderWorldCopies=m===void 0||m,this._minZoom=t||0,this._maxZoom=o||22,this._minPitch=c??0,this._maxPitch=d??60,this.setProjection(_),this.setMaxBounds(y),this.width=0,this.height=0,this._center=new h.aX(0,0),this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._nearZ=0,this._farZ=0,this._nearClipOffset=0,this._unmodified=!0,this._edgeInsets=new yc,this._projMatrixCache={},this._alignedProjMatrixCache={},this._fogTileMatrixCache={},this._expandedProjMatrixCache={},this._distanceTileDataCache={},this._camera=new ma,this._centerAltitude=0,this._averageElevation=0,this.cameraElevationReference="ground",this._pixelsPerMercatorPixel=1,this.globeRadius=0,this.globeCenterInViewSpace=[0,0,0],this._tileCoverLift=0,this.freezeTileCoverage=!1,this._horizonShift=.1,this._orthographicProjectionAtLowPitch=!1,this._allowWorldUnderZoom=!1,this.mercatorMatrix=new Float64Array(16),this.mercatorFogMatrix=new Float32Array(16),this.invProjMatrix=new Float64Array(16),this._expandedFarZProjMatrixBuf=new Float64Array(16),this.expandedFarZProjMatrix=this._expandedFarZProjMatrixBuf,this.starsProjMatrix=new Float32Array(16),this.skyboxMatrix=new Float32Array(16),this._mat4Scratch=new Float64Array(16),this.alignedProjMatrix=new Float64Array(16),this.labelPlaneMatr
vendor: 33,589 bytes, line 8
8ix=new Float32Array(16),this.glCoordMatrix=new Float32Array(16),this.pixelMatrix=new Float64Array(16),this.pixelMatrixInverse=new Float64Array(16)}clone(){const t=new hl(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies,this.getProjection(),this.maxBounds);return t._elevation=this._elevation,t._centerAltitude=this._centerAltitude,t._centerAltitudeValidForExaggeration=this._centerAltitudeValidForExaggeration,t.tileSize=this.tileSize,t.mercatorFromTransition=this.mercatorFromTransition,t.width=this.width,t.height=this.height,t.cameraElevationReference=this.cameraElevationReference,t._center=this._center,t._setZoom(this.zoom),t._seaLevelZoom=this._seaLevelZoom,t.angle=this.angle,t._fov=this._fov,t._pitch=this._pitch,t._nearZ=this._nearZ,t._farZ=this._farZ,t._nearClipOffset=this._nearClipOffset,t._averageElevation=this._averageElevation,t._orthographicProjectionAtLowPitch=this._orthographicProjectionAtLowPitch,t._unmodified=this._unmodified,t._edgeInsets=this._edgeInsets.clone(),t._camera=this._camera.clone(),t._calcMatrices(),t.freezeTileCoverage=this.freezeTileCoverage,t.frustumCorners=this.frustumCorners,t._allowWorldUnderZoom=this._allowWorldUnderZoom,t}get isOrthographic(){return this.projection.name!=="globe"&&this._orthographicProjectionAtLowPitch&&this.pitch<Sn}get elevation(){return this._elevation}set elevation(t){this._elevation!==t&&(this._elevation=t,this._updateCameraOnTerrain(),this._calcMatrices())}get nearClipOffset(){return this._nearClipOffset}set nearClipOffset(t){this._nearClipOffset=t,this._calcMatrices()}get depthOcclusionForSymbolsAndCircles(){return this.projection.name!=="globe"&&!this.isOrthographic}updateElevation(t,o=!1){const c=this._elevation&&this._elevation.exaggeration()!==this._centerAltitudeValidForExaggeration;(this._seaLevelZoom==null||c)&&this._updateCameraOnTerrain(),(t||c)&&this._constrainCamera(o),this._calcMatrices()}getProjection(){return h.aK(this.projection,["name","center","parallels"])}setProjection(t){this.projectionOptions=t||{name:"mercator"};const o=this.projection?this.getProjection():void 0;this.projection=h.c4(this.projectionOptions);const c=this.getProjection(),d=!h.b9(o,c);return d&&this._calcMatrices(),this.mercatorFromTransition=!1,d}setOrthographicProjectionAtLowPitch(t){return this._orthographicProjectionAtLowPitch!==t&&(this._orthographicProjectionAtLowPitch=t,this._calcMatrices(),!0)}setMercatorFromTransition(){const t=this.projection.name;this.mercatorFromTransition=!0,this.projectionOptions={name:"mercator"},this.projection=h.c4({name:"mercator"});const o=t!==this.projection.name;return o&&this._calcMatrices(),o}get minZoom(){return this._minZoom}set minZoom(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))}get maxZoom(){return this._maxZoom}set maxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))}get minPitch(){return this._minPitch}set minPitch(t){this._minPitch!==t&&(this._minPitch=t,this.pitch=Math.max(this.pitch,t))}get maxPitch(){return this._maxPitch}set maxPitch(t){this._maxPitch!==t&&(this._maxPitch=t,this.pitch=Math.min(this.pitch,t))}get renderWorldCopies(){return this._renderWorldCopies&&this.projection.supportsWorldCopies===!0}set renderWorldCopies(t){t===void 0?t=!0:t===null&&(t=!1),this._renderWorldCopies=t}get worldSize(){return this.tileSize*this.scale}get cameraWorldSizeForFog(){const t=Math.max(this._camera.getDistanceToElevation(this._averageElevation),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(t))}get cameraWorldSize(){const t=Math.max(this._camera.getDistanceToElevation(this._averageElevation,!0),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(t))}get pixelsPerMeter(){return this.projection.pixelsPerMeter(this.center.lat,this.worldSize)}get cameraPixelsPerMeter(){return h.bY(1,this.center.lat)*this.cameraWorldSizeForFog}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new h.P(this.width,this.height)}get bearing(){return h.bv(this.rotation,-180,180)}set bearing(t){this.rotation=t}get rotation(){return-this.angle/Math.PI*180}set rotation(t){const o=-t*Math.PI/180;if(this.angle===o)return;this._unmodified=!1,this.angle=o,this._calcMatrices();const c=Math.sin(this.angle),d=Math.cos(this.angle);this.rotationMatrix=[d,c,-c,d]}get pitch(){return this._pitch/Math.PI*180}set pitch(t){const o=h.aB(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==o&&(this._unmodified=!1,this._pitch=o,this._calcMatrices())}get aspect(){return this.width/this.height}get fov(){return this._fov/Math.PI*180}set fov(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&&(this._unmodified=!1,this._fov=h.am(t),this._calcMatrices())}get fovX(){return this._fov}get fovY(){const t=1/Math.tan(.5*this.fovX);return 2*Math.atan(1/this.aspect/t)}get averageElevation(){return this._averageElevation}set averageElevation(t){this._averageElevation=t,this._calcFogMatrices(),this._distanceTileDataCache={}}get zoom(){return this._zoom}set zoom(t){const o=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==o&&(this._unmodified=!1,this._setZoom(o),this._updateSeaLevelZoom(),this._constrain(),this._calcMatrices())}_setZoom(t){this._zoom=t,this.scale=this.zoomScale(t),this.tileZoom=Math.floor(t),this.zoomFraction=t-this.tileZoom}get tileCoverLift(){return this._tileCoverLift}set tileCoverLift(t){this._tileCoverLift!==t&&(this._tileCoverLift=t)}_updateCameraOnTerrain(){const t=this.elevation?this.elevation.getAtPoint(this.locationCoordinate(this.center),Number.NEGATIVE_INFINITY):Number.NEGATIVE_INFINITY,o=this.elevation&&t===Number.NEGATIVE_INFINITY&&this.elevation.visibleDemTiles.length>0&&this.elevation.exaggeration()>0&&this._centerAltitudeValidForExaggeration;if(!this._elevation||t===Number.NEGATIVE_INFINITY&&(!o||!this._centerAltitude))return this._centerAltitude=0,this._seaLevelZoom=null,void(this._centerAltitudeValidForExaggeration=void 0);const c=this._elevation;o||this._centerAltitude&&this._centerAltitudeValidForExaggeration&&c.exaggeration()&&this._centerAltitudeValidForExaggeration!==c.exaggeration()?(this._centerAltitude=this._centerAltitude/this._centerAltitudeValidForExaggeration*c.exaggeration(),this._centerAltitudeValidForExaggeration=c.exaggeration()):(this._centerAltitude=t||0,this._centerAltitudeValidForExaggeration=c.exaggeration()),this._updateSeaLevelZoom()}_updateSeaLevelZoom(){if(this._centerAltitudeValidForExaggeration===void 0)return;const t=Math.max(0,(this.pixelsPerMeter*this._centerAltitude+this.cameraToCenterDistance)/this.worldSize);this._seaLevelZoom=this._zoomFromMercatorZ(t)}sampleAverageElevation(){if(!this._elevation)return 0;const t=this._elevation,o=[[.5,.2],[.3,.5],[.5,.5],[.7,.5],[.5,.8]],c=this.horizonLineFromTop();let d=0,m=0;for(let _=0;_<o.length;_++){const y=new h.P(o[_][0]*this.width,c+o[_][1]*(this.height-c)),v=t.pointCoordinate(y);if(!v)continue;const T=1/Math.hypot(v[0]-this._camera.position[0],v[1]-this._camera.position[1]);d+=v[3]*T,m+=T}return m===0?NaN:d/m}get center(){return this._center}set center(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._terrainEnabled()&&(this.cameraElevationReference==="ground"?this._updateCameraOnTerrain():this._updateZoomFromElevation()),this._constrain(),this._calcMatrices())}_updateZoomFromElevation(){if(this._seaLevelZoom==null||!this._elevation)return;const t=this._seaLevelZoom,o=this._elevation.getAtPointOrZero(this.locationCoordinate(this.center)),c=this.pixelsPerMeter/this.worldSize*o,d=this._mercatorZfromZoom(t),m=this._mercatorZfromZoom(this._maxZoom),_=Math.max(d-c,m);this._setZoom(this._zoomFromMercatorZ(_))}get padding(){return this._edgeInsets.toJSON()}set padding(t){this._edgeInsets.equals(t)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,t,1),this._calcMatrices())}equals(t){const o=this.elevation,c=t.elevation,d=o!=null!=(c!=null)||o&&c&&o.exaggeration()!==c.exaggeration();return this.width===t.width&&this.height===t.height&&this.center.lng===t.center.lng&&this.center.lat===t.center.lat&&this.zoom===t.zoom&&this.bearing===t.bearing&&this.pitch===t.pitch&&this.fov===t.fov&&this.projection.name===t.projection.name&&this._edgeInsets.equals(t.padding)&&!d}computeZoomRelativeTo(t){const o=this.rayIntersectionCoordinate(this.pointRayIntersection(this.centerPoint,t.toAltitude()));let c;c=t.z<this._camera.position[2]?[o.x,o.y,o.z]:[t.x,t.y,t.z];const d=h.af(h.aw([],this._camera.position,c));return h.aB(this._zoomFromMercatorZ(d),this._minZoom,this._maxZoom)}setFreeCameraOptions(t){if(!this.height||!t.position&&!t.orientation)return;this._updateCameraState();let o=!1;if(t.orientation&&!h.c5(t.orientation,this._camera.orientation)&&(o=this._setCameraOrientation(t.orientation)),t.position){const c=[t.position.x,t.position.y,t.position.z];h.c6(c,this._camera.position)||(this._setCameraPosition(c),o=!0)}o&&(this._updateStateFromCamera(),this.recenterOnTerrain())}getFreeCameraOptions(){this._updateCameraState();const t=this._camera.position,o=new qh;return o.position=new h.ad(t[0],t[1],t[2]),o.orientation=this._camera.orientation,o._elevation=this.elevation,o._renderWorldCopies=this.renderWorldCopies,o}_setCameraOrientation(t){if(!h.c7(t))return!1;h.c8(t,t);const o=h.c9([],[0,0,-1],t),c=h.c9([],[0,-1,0],t);if(c[2]<0)return!1;const d=Hh(o,c);return!!d&&(this._camera.orientation=d,!0)}_setCameraPosition(t){const o=this.zoomScale(this.minZoom)*this.tileSize,c=this.zoomScale(this.maxZoom)*this.tileSize,d=this.cameraToCenterDistance;t[2]=h.aB(t[2],d/c,d/o),this._camera.position=t}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}get fovAboveCenter(){return this._fov*(.5+this.centerOffset.y/this.height)}isPaddingEqual(t){return this._edgeInsets.equals(t)}interpolatePadding(t,o,c){this._unmodified=!1,this._edgeInsets.interpolate(t,o,c),this._constrain(),this._calcMatrices()}coveringZoomLevel(t){const o=(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize));return Math.max(0,o)}getVisibleUnwrappedCoordinates(t){const o=[new h.ca(0,t)];if(this.renderWorldCopies){const c=this.pointCoordinate(new h.P(0,0)),d=this.pointCoordinate(new h.P(this.width,0)),m=this.pointCoordinate(new h.P(this.width,this.height)),_=this.pointCoordinate(new h.P(0,this.height)),y=Math.floor(Math.min(c.x,d.x,m.x,_.x)),v=Math.floor(Math.max(c.x,d.x,m.x,_.x)),T=1;for(let I=y-T;I<=v+T;I++)I!==0&&o.push(new h.ca(I,t))}return o}isLODDisabled(t){return(!t||this.pitch<=60)&&this._edgeInsets.top<=this._edgeInsets.bottom&&!this._elevation&&!this.projection.isReprojectedInTileSpace}extendTileCover(t,o,c,d){let m=[];const _=c!=null,y=!_;if(y&&this.zoom<o||_&&c[0]===0&&c[1]===0)return m;const v=new Set,T=(P,A,D,O,L)=>{const k=h.cm(A,P,D,O,L);v.has(k)||(m.push(new h.aU(P,A,D,O,L)),v.add(k))};for(let P=0;P<t.length;P++){const A=t[P];if(y&&A.canonical.z!==o||_&&d!==void 0&&d>A.canonical.z)continue;const D=A.canonical,O=A.overscaledZ,L=A.wrap,k=1<<D.z,N=D.x+1<k,H=D.x>0,Z=D.y+1<k,G=D.y>0,ne=A.wrap-(H?0:1),te=A.wrap+(N?0:1),se=H?D.x-1:k-1,J=N?D.x+1:0;if(_)c[0]<0?(T(O,te,D.z,J,D.y),c[1]<0&&Z&&(T(O,L,D.z,D.x,D.y+1),T(O,te,D.z,J,D.y+1)),c[1]>0&&G&&(T(O,L,D.z,D.x,D.y-1),T(O,te,D.z,J,D.y-1))):c[0]>0?(T(O,ne,D.z,se,D.y),c[1]<0&&Z&&(T(O,L,D.z,D.x,D.y+1),T(O,ne,D.z,se,D.y+1)),c[1]>0&&G&&(T(O,L,D.z,D.x,D.y-1),T(O,ne,D.z,se,D.y-1))):c[1]<0&&Z?T(O,L,D.z,D.x,D.y+1):G&&T(O,L,D.z,D.x,D.y-1);else{const K=A.visibleQuadrants;1&K&&(T(O,ne,D.z,se,D.y),G&&(T(O,L,D.z,D.x,D.y-1),T(O,ne,D.z,se,D.y-1))),2&K&&(T(O,te,D.z,J,D.y),G&&(T(O,L,D.z,D.x,D.y-1),T(O,te,D.z,J,D.y-1))),4&K&&(T(O,ne,D.z,se,D.y),Z&&(T(O,L,D.z,D.x,D.y+1),T(O,ne,D.z,se,D.y+1))),8&K&&(T(O,te,D.z,J,D.y),Z&&(T(O,L,D.z,D.x,D.y+1),T(O,te,D.z,J,D.y+1)))}}const I=[];for(const P of m)m.some(A=>P.isChildOf(A))||I.push(P);if(m=I.filter(P=>!t.some(A=>!!(P.overscaledZ<o&&A.isChildOf(P))||P.equals(A)||P.isChildOf(A))),y){const P=1<<o,A=this.projection.name==="globe"?this._camera.mercatorPosition:this.pointCoordinate(this.getCameraPoint()),D=[P*A.x,P*A.y],O=4,L=O*O;m=m.filter(k=>{const N=k.canonical.x+.5-D[0],H=k.canonical.y+.5-D[1];return N*N+H*H<L})}return m}extendTileCoverToNearPlane(t,o,c){const d=[],m=new Set;for(const H of t)m.add(H.key);const _=(H,Z,G,ne,te)=>{const se=h.cm(Z,H,G,ne,te);m.has(se)||(d.push(new h.aU(H,Z,G,ne,te)),m.add(se))},y=t.reduce((H,Z)=>Math.max(H,Z.overscaledZ),c),v=1<<c,T=[new h.P(0,0),new h.P(h.ak,0),new h.P(h.ak,h.ak),new h.P(0,h.ak)],I=new h.P(0,0),P=new h.P(0,0),A=(H,Z)=>{const G=Math.floor(H[0]),ne=Math.floor(H[1]),te=(H[0]-G)*h.ak,se=(H[1]-ne)*h.ak,J=Math.floor(Z[0]),K=Math.floor(Z[1]),oe=(Z[0]-J)*h.ak,de=(Z[1]-K)*h.ak;for(let ue=-1;ue<=1;ue++){const ve=G+ue;if(!(ve<0||ve>=v)){I.x=te-ue*h.ak,P.x=oe-(ve-J)*h.ak;for(let be=-1;be<=1;be++){const ke=ne+be;I.y=se-be*h.ak,P.y=de-(ke-K)*h.ak,h.cM(I,P,T)&&_(y,0,c,ve,ke)}}}},D=o.points,O=D[h.cb],L=D[h.cc],k=this._projectToGround(O,D[h.cd]),N=this._projectToGround(L,D[h.ce]);return A(O,k),A(L,N),d}_projectToGround(t,o){return h.cf(h.cg(),t,o,t[2]/(t[2]-o[2]))}_projectToZ(t,o,c){const d=t[2]-o[2];return Math.abs(d)<1e-6?h.ch(t):h.cf(h.cg(),t,o,(t[2]-c)/d)}extendTileCoverForTunnels(t,o,c,d){if(c<18)return[];const m=o.points,_=m[h.ci],y=m[h.cj],v=m[h.ck],T=m[h.cl];if(v[2]>=0&&T[2]>=0||_[2]<=0||y[2]<=0)return[];const I=v[2]<0?this._projectToZ(_,v,0):v,P=T[2]<0?this._projectToZ(y,T,0):T,A=-d,D=v[2]<A?this._projectToZ(_,v,A):v,O=T[2]<A?this._projectToZ(y,T,A):T,L=this._findExtensionTilesInQuad(t,c,[O,D,P,I],[.5*(I[0]+P[0]),.5*(I[1]+P[1])]);return L.length>3&&(L.length=3),L}_findExtensionTilesInQuad(t,o,c,d){const m=[],_=new Set;for(const J of t)_.add(J.key);const y=t.reduce((J,K)=>Math.max(J,K.overscaledZ),o),v=1<<o,T=[new h.P(c[0][0],c[0][1]),new h.P(c[1][0],c[1][1]),new h.P(c[3][0],c[3][1]),new h.P(c[2][0],c[2][1]),new h.P(c[0][0],c[0][1])],I=c[0][0],P=c[1][0],A=c[2][0],D=c[3][0],O=c[0][1],L=c[1][1],k=c[2][1],N=c[3][1],H=Math.max(0,Math.floor(Math.min(I,P,A,D))),Z=Math.min(v-1,Math.ceil(Math.max(I,P,A,D))-1),G=Math.max(0,Math.floor(Math.min(O,L,k,N))),ne=Math.min(v-1,Math.ceil(Math.max(O,L,k,N))-1);for(let J=G;J<=ne;J++)for(let K=H;K<=Z;K++){if(!h.au(T,K,J,K+1,J+1))continue;const oe=h.cm(0,y,o,K,J);_.has(oe)||(m.push(new h.aU(y,0,o,K,J)),_.add(oe))}const te=d[0],se=d[1];return m.sort((J,K)=>{const oe=J.canonical.x+.5-te,de=J.canonical.y+.5-se,ue=K.canonical.x+.5-te,ve=K.canonical.y+.5-se;return oe*oe+de*de-(ue*ue+ve*ve)||J.canonical.x-K.canonical.x||J.canonical.y-K.canonical.y}),m}coveringTiles(t){let o=this.coveringZoomLevel(t);const c=o,d=this.elevation&&this.elevation.exaggeration(),m=d&&!t.isTerrainDEM,_=this.projection.name==="mercator";if(t.minzoom!==void 0&&o<t.minzoom)return[];t.maxzoom!==void 0&&o>t.maxzoom&&(o=t.maxzoom);const y=this.locationCoordinate(this.center),v=this.center.lat,T=1<<o,I=[T*y.x,T*y.y,0],P=this.projection.name==="globe",A=!P,D=h.cn.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,o,A),O=P?this._camera.mercatorPosition:this.pointCoordinate(this.getCameraPoint()),L=T*h.bY(1,this.center.lat),k=this._camera.position[2]/h.bY(1,this.center.lat),N=[T*O.x,T*O.y,k*(A?1:L)],H=P||d,Z=this.cameraToCenterDistance/t.tileSize*(t.roundZoom?1:.502),G=this.isLODDisabled(!0)?o:0;let ne;if(this._elevation&&t.isTerrainDEM)ne=1e4*this._elevation.exaggeration();else if(this._elevation){const pe=this._elevation.getMinMaxForVisibleTiles();ne=pe?pe.max:this._centerAltitude}else ne=this._centerAltitude;const te=t.isTerrainDEM?-ne:this._elevation?this._elevation.getMinElevationBelowMSL():0,se=this.projection.isReprojectedInTileSpace?h.co(this):1,J=pe=>{const Ce=new h.ad(pe.x+25e-6,pe.y,pe.z),Re=new h.ad(pe.x,pe.y+25e-6,pe.z),Ye=pe.toLngLat(),qe=Ce.toLngLat(),je=Re.toLngLat(),Be=this.locationCoordinate(Ye),at=this.locationCoordinate(qe),ot=this.locationCoordinate(je),tt=Math.hypot(at.x-Be.x,at.y-Be.y),it=Math.hypot(ot.x-Be.x,ot.y-Be.y);return Math.sqrt(tt*it)*se/25e-6},K=pe=>{const Pe=ne,Ce=te;return{aabb:h.cr(this,T,0,0,0,pe,Ce,Pe,this.projection),zoom:0,x:0,y:0,minZ:Ce,maxZ:Pe,wrap:pe,fullyVisible:!1}},oe=[];let de=[];const ue=o,ve=t.reparseOverscaled?c:o,be=(k-this._centerAltitude)*L,ke=pe=>{if(!this._elevation||!pe.tileID||!_)return;const Pe=this._elevation.getMinMaxForTile(pe.tileID),Ce=pe.aabb;Pe?(Ce.min[2]=Pe.min,Ce.max[2]=Pe.max,Ce.center[2]=(Ce.min[2]+Ce.max[2])/2):(pe.shouldSplit=Ee(pe),pe.shouldSplit||(Ce.min[2]=Ce.max[2]=Ce.center[2]=this._centerAltitude))},fe=(pe,Pe)=>{if(.707*Pe<pe)return 1;const Ce=Pe/pe;return Ce/(1.4144271570014144+(Math.pow(1.1,Ce-1.4144271570014144+1)-1)/(1.1-1)-1)},Ee=pe=>{if(pe.zoom<G)return!0;if(pe.zoom===ue)return!1;if(pe.shouldSplit!=null)return pe.shouldSplit;const Pe=pe.aabb.distanceX(N),Ce=pe.aabb.distanceY(N);let Re=be,Ye=1;if(P){Re=pe.aabb.distanceZ(N);const it=Math.pow(2,pe.zoom),ht=h.bZ((pe.y+1)/it),xt=h.bZ(pe.y/it),yt=Math.min(Math.max(v,ht),xt),St=h.cQ(yt)/h.cQ(v);if(Ye=yt===v?1/Math.max(1,this._mercatorScaleRatio-.3):Math.min(1,St/this._mercatorScaleRatio),this.zoom<=h.cN&&pe.zoom===ue-1&&St>=.9)return!0}else if(m&&(Re=pe.aabb.distanceZ(N)*L),this.projection.isReprojectedInTileSpace&&c<=5){const it=Math.pow(2,pe.zoom),ht=J(new h.ad((pe.x+.5)/it,(pe.y+.5)/it));Ye=ht>.85?1:ht}if(!_&&!P){const it=Math.sqrt(Pe*Pe+Ce*Ce+Re*Re);let ht=(1<<ue-pe.zoom)*Z*Ye;return ht*=fe(Math.max(Re,be),it),it<ht}let qe=Number.MAX_VALUE,je=0;const Be=pe.aabb.getCorners(),at=[0,0,0];for(const it of Be){h.aw(at,it,N),P||(m?at[2]*=L:at[2]=be);const ht=h.bk(at,this._camera.forward());ht<qe&&(qe=ht,je=Math.abs(at[2]))}let ot=(1<<ue-pe.zoom)*Z*Ye;if(ot*=fe(Math.max(je,be),qe),qe<ot)return!0;const tt=pe.aabb.closestPoint(I);return tt[0]===I[0]&&tt[1]===I[1]};if(this.renderWorldCopies)for(let pe=1;pe<=3;pe++)oe.push(K(-pe)),oe.push(K(pe));for(oe.push(K(0));oe.length>0;){const pe=oe.pop(),Pe=pe.x,Ce=pe.y;let Re=pe.fullyVisible;const Ye=()=>this.projection.name==="globe"&&(pe.y===0||pe.y===(1<<pe.zoom)-1);if(!Re){let qe=H?pe.aabb.intersects(D):pe.aabb.intersectsFlat(D);if(qe===0&&Ye()){const je=new h.cp(pe.zoom,Pe,Ce);qe=h.cq(this,T,je,!0).intersects(D)}if(qe===0)continue;Re=qe===2}if(pe.zoom===ue||!Ee(pe)){const qe=pe.zoom===ue?ve:pe.zoom;if(t.minzoom&&t.minzoom>qe)continue;let je=0;if(!Re){let tt=H?pe.aabb.intersectsPrecise(D):pe.aabb.intersectsPreciseFlat(D);if(tt===0&&Ye()){const it=new h.cp(pe.zoom,Pe,Ce);tt=h.cq(this,T,it,!0).intersectsPrecise(D)}if(tt===0)continue;if(t.calculateQuadrantVisibility)if(D.containsPoint(pe.aabb.center))je=15;else for(let it=0;it<4;it++)pe.aabb.quadrant(it).intersects(D)!==0&&(je|=1<<it)}const Be=I[0]-(.5+Pe+(pe.wrap<<pe.zoom))*(1<<o-pe.zoom),at=I[1]-.5-Ce,ot=pe.tileID?pe.tileID:new h.aU(qe,pe.wrap,pe.zoom,Pe,Ce);t.calculateQuadrantVisibility&&(ot.visibleQuadrants=je),de.push({tileID:ot,distanceSq:Be*Be+at*at});continue}for(let qe=0;qe<4;qe++){const je=(Pe<<1)+qe%2,Be=(Ce<<1)+(qe>>1),at={aabb:_?pe.aabb.quadrant(qe):h.cr(this,T,pe.zoom+1,je,Be,pe.wrap,pe.minZ,pe.maxZ,this.projection),zoom:pe.zoom+1,x:je,y:Be,wrap:pe.wrap,fullyVisible:Re,tileID:void 0,shouldSplit:void 0,minZ:pe.minZ,maxZ:pe.maxZ};m&&!P&&(at.tileID=new h.aU(pe.zoom+1===ue?ve:pe.zoom+1,pe.wrap,pe.zoom+1,je,Be),ke(at)),oe.push(at)}}if(this.fogCullDistSq){const pe=this.fogCullDistSq,Pe=this.horizonLineFromTop();de=de.filter(Ce=>{const Re=[0,0,0,1],Ye=[h.ak,h.ak,0,1],qe=this.calculateFogTileMatrix(Ce.tileID.toUnwrapped());h.aD(Re,Re,qe),h.aD(Ye,Ye,qe);const je=h.cs([],Re,Ye),Be=h.ct([],Re,Ye),at=h.cO(je,Be);if(at===0)return!0;let ot=!1;const tt=this._elevation;if(tt&&at>pe&&Pe!==0){const it=this.calculateProjMatrix(Ce.tileID.toUnwrapped());let ht;t.isTerrainDEM||(ht=tt.getMinMaxForTile(Ce.tileID)),ht||(ht={min:te,max:ne});const xt=h.cu(this.rotation),yt=[xt[0]*h.ak,xt[1]*h.ak,ht.max];h.ae(yt,yt,it),ot=(1-yt[1])*this.height*.5<Pe}return at<pe||ot})}return de.sort((pe,Pe)=>pe.distanceSq-Pe.distanceSq).map(pe=>pe.tileID)}resize(t,o){this.width=t,this.height=o,this.pixelsToGLUnits=[2/t,-2/o],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(t){return Math.pow(2,t)}scaleZoom(t){return Math.log2(t)}project(t){const o=h.aB(t.lat,-h.cv,h.cv),c=this.projection.project(t.lng,o);return new h.P(c.x*this.worldSize,c.y*this.worldSize)}unproject(t){return this.projection.unproject(t.x/this.worldSize,t.y/this.worldSize)}get point(){return this.project(this.center)}get pointMerc(){return this.point._div(this.worldSize)}get pixelsPerMeterRatio(){return this.pixelsPerMeter/h.bY(1,this.center.lat)/this.worldSize}setLocationAtPoint(t,o){let c,d;const m=this.centerPoint;if(this.projection.name==="globe"){const y=this.worldSize;c=(o.x-m.x)/y,d=(o.y-m.y)/y}else{const y=this.pointCoordinate(o),v=this.pointCoordinate(m);c=y.x-v.x,d=y.y-v.y}const _=this.locationCoordinate(t);this.setLocation(new h.ad(_.x-c,_.y-d))}setLocation(t){this.center=this.coordinateLocation(t),this.projection.wrap&&(this.center=this.center.wrap())}locationPoint(t,o){return this.projection.locationPoint(this,t,o)}locationPoint3D(t,o){return this.projection.locationPoint(this,t,o,!0)}pointLocation(t){return this.coordinateLocation(this.pointCoordinate(t))}pointLocation3D(t,o){return this.coordinateLocation(this.pointCoordinate3D(t,o))}locationCoordinate(t,o){const c=o?h.bY(o,t.lat):void 0,d=this.projection.project(t.lng,t.lat);return new h.ad(d.x,d.y,c)}coordinateLocation(t){return this.projection.unproject(t.x,t.y)}pointRayIntersection(t,o){const c=o??this._centerAltitude,d=[t.x,t.y,0,1],m=[t.x,t.y,1,1];h.aD(d,d,this.pixelMatrixInverse),h.aD(m,m,this.pixelMatrixInverse);const _=m[3];h.cw(d,d,1/d[3]),h.cw(m,m,1/_);const y=d[2],v=m[2];return{p0:d,p1:m,t:y===v?0:(c-y)/(v-y)}}screenPointToMercatorRay(t){const o=[t.x,t.y,0,1],c=[t.x,t.y,1,1];return h.aD(o,o,this.pixelMatrixInverse),h.aD(c,c,this.pixelMatrixInverse),h.cw(o,o,1/o[3]),h.cw(c,c,1/c[3]),o[2]=h.bY(o[2],this._center.lat)*this.worldSize,c[2]=h.bY(c[2],this._center.lat)*this.worldSize,h.cw(o,o,1/this.worldSize),h.cw(c,c,1/this.worldSize),new h.ay([o[0],o[1],o[2]],h.ax([],h.aw([],c,o)))}rayIntersectionCoordinate(t){const{p0:o,p1:c,t:d}=t,m=h.bY(o[2],this._center.lat),_=h.bY(c[2],this._center.lat);return new h.ad(h.aj(o[0],c[0],d)/this.worldSize,h.aj(o[1],c[1],d)/this.worldSize,h.aj(m,_,d))}pointCoordinate(t,o=this._centerAltitude){return this.projection.pointCoordinate(this,t.x,t.y,o)}pointCoordinate3D(t,o){if(!this.elevation)return this.pointCoordinate(t,o);let c=this.projection.pointCoordinate3D(this,t.x,t.y);if(c)return new h.ad(c[0],c[1],c[2]);let d=0,m=this.horizonLineFromTop();if(t.y>m)return this.pointCoordinate(t,o);const _=.02*m,y=t.clone();for(let v=0;v<10&&m-d>_;v++){y.y=h.aj(d,m,.66);const T=this.projection.pointCoordinate3D(this,y.x,y.y);T?(m=y.y,c=T):d=y.y}return c?new h.ad(c[0],c[1],c[2]):this.pointCoordinate(t)}isPointAboveHorizon(t){return this.projection.isPointAboveHorizon(this,t)}isPointOnSurface(t){if(t.y<0||t.y>this.height||t.x<0||t.x>this.width)return!1;if(this.elevation||this.zoom>=h.cx)return!this.isPointAboveHorizon(t);const o=this.pointCoordinate(t);return o.y>=0&&o.y<=1}_coordinatePoint(t,o){const c=o&&this.elevation?this.elevation.getAtPointOrZero(t,this._centerAltitude):this._centerAltitude,d=[t.x*this.worldSize,t.y*this.worldSize,c+t.toAltitude(),1];return h.aD(d,d,this.pixelMatrix),d[3]>0?new h.P(d[0]/d[3],d[1]/d[3]):new h.P(Number.MAX_VALUE,Number.MAX_VALUE)}_getBoundsNonRectangular(){const{top:t,left:o}=this._edgeInsets,c=this.height-this._edgeInsets.bottom,d=this.width-this._edgeInsets.right,m=this.pointLocation3D(new h.P(o,t)),_=this.pointLocation3D(new h.P(d,t)),y=this.pointLocation3D(new h.P(d,c)),v=this.pointLocation3D(new h.P(o,c));let T=Math.min(m.lng,_.lng,y.lng,v.lng),I=Math.max(m.lng,_.lng,y.lng,v.lng),P=Math.min(m.lat,_.lat,y.lat,v.lat),A=Math.max(m.lat,_.lat,y.lat,v.lat);const D=Math.pow(2,-this.zoom)/16*270,O=this.projection.name==="globe"?1:4,L=(k,N,H,Z,G)=>{const ne=(k+H)/2,te=(N+Z)/2,se=new h.P(ne,te),{lng:J,lat:K}=this.pointLocation3D(se),oe=Math.max(0,T-J,P-K,J-I,K-A);T=Math.min(T,J),I=Math.max(I,J),P=Math.min(P,K),A=Math.max(A,K),(G<O||oe>D)&&(L(k,N,ne,te,G+1),L(ne,te,H,Z,G+1))};if(L(o,t,d,t,1),L(d,t,d,c,1),L(d,c,o,c,1),L(o,c,o,t,1),this.projection.name==="globe"){const[k,N]=h.cy(this);k?(A=90,I=180,T=-180):N&&(P=-90,I=180,T=-180)}return new h.aI(new h.aX(T,P),new h.aX(I,A))}_getBoundsRectangular(t,o){const{top:c,left:d}=this._edgeInsets,m=this.height-this._edgeInsets.bottom,_=this.width-this._edgeInsets.right,y=new h.P(d,c),v=new h.P(_,c),T=new h.P(_,m),I=new h.P(d,m);let P=this.pointCoordinate(y,t),A=this.pointCoordinate(v,t);const D=this.pointCoordinate(T,o),O=this.pointCoordinate(I,o),L=(k,N)=>(N.y-k.y)/(N.x-k.x);return P.y>1&&A.y>=0?P=new h.ad((1-O.y)/L(O,P)+O.x,1):P.y<0&&A.y<=1&&(P=new h.ad(-O.y/L(O,P)+O.x,0)),A.y>1&&P.y>=0?A=new h.ad((1-D.y)/L(D,A)+D.x,1):A.y<0&&P.y<=1&&(A=new h.ad(-D.y/L(D,A)+D.x,0)),new h.aI().extend(this.coordinateLocation(P)).extend(this.coordinateLocation(A)).extend(this.coordinateLocation(O)).extend(this.coordinateLocation(D))}_getBoundsRectangularTerrain(){const t=this.elevation;if(!t.visibleDemTiles.length||t.isUsingMockSource())return this._getBoundsRectangular(0,0);const o=t.visibleDemTiles.reduce((c,d)=>{if(d.dem){const m=d.dem.tree;c.min=Math.min(c.min,m.minimums[0]),c.max=Math.max(c.max,m.maximums[0])}return c},{min:Number.MAX_VALUE,max:0});return this._getBoundsRectangular(o.min*t.exaggeration(),o.max*t.exaggeration())}getBounds(){return this.projection.name==="mercator"||this.projection.name==="equirectangular"?this._terrainEnabled()?this._getBoundsRectangularTerrain():this._getBoundsRectangular(0,0):this._getBoundsNonRectangular()}horizonLineFromTop(t=!0){const o=this.height/2/Math.tan(this._fov/2)/Math.tan(Math.max(this._pitch,.1))-this.centerOffset.y,c=this.height/2-o*(1-this._horizonShift);return t?Math.max(0,c):c}getMaxBounds(){return this.maxBounds}setMaxBounds(t){this.maxBounds=t,this.minLat=-h.cv,this.maxLat=h.cv,this.minLng=-180,this.maxLng=180,t&&(this.minLat=t.getSouth(),this.maxLat=t.getNorth(),this.minLng=t.getWest(),this.maxLng=t.getEast(),this.maxLng<this.minLng&&(this.maxLng+=360)),this.worldMinX=h.aG(this.minLng)*this.tileSize,this.worldMaxX=h.aG(this.maxLng)*this.tileSize,this.worldMinY=h.aJ(this.maxLat)*this.tileSize,this.worldMaxY=h.aJ(this.minLat)*this.tileSize,this._constrain()}calculatePosMatrix(t,o){return this.projection.createTileMatrix(this,o,t)}calculateDistanceTileData(t){const o=t.key,c=this._distanceTileDataCache;if(c[o])return c[o];const d=t.canonical,m=1/this.height,_=this.cameraWorldSize,y=_/this.zoomScale(d.z),v=(d.x+Math.pow(2,d.z)*t.wrap)*y,T=d.y*y,I=this.point;I.x*=_/this.worldSize,I.y*=_/this.worldSize;const P=this.angle,A=Math.sin(-P),D=-Math.cos(-P);return c[o]={bearing:[A,D],center:[(I.x-v)*m,(I.y-T)*m],scale:y/h.ak*m},c[o]}calculateFogTileMatrix(t){const o=t.key,c=this._fogTileMatrixCache;if(c[o])return c[o];const d=this.projection.createTileMatrix(this,this.cameraWorldSizeForFog,t);return h.aC(d,this.worldToFogMatrix,d),c[o]=new Float32Array(d),c[o]}calculateProjMatrix(t,o=!1,c=!1){const d=t.key;let m;if(m=c?this._expandedProjMatrixCache:o?this._alignedProjMatrixCache:this._projMatrixCache,m[d])return m[d];const _=this.calculatePosMatrix(t,this.worldSize);let y;return y=this.projection.isReprojectedInTileSpace?this.mercatorMatrix:c?this.expandedFarZProjMatrix:o?this.alignedProjMatrix:this.projMatrix,h.aC(_,y,_),m[d]=new Float32Array(_),m[d]}calculatePixelsToTileUnitsMatrix(t){const o=t.tileID.key,c=this._pixelsToTileUnitsCache;if(c[o])return c[o];const d=h.cz(t,this);return c[o]=d,c[o]}customLayerMatrix(){return this.mercatorMatrix.slice()}globeToMercatorMatrix(){if(this.projection.name==="globe"){const t=1/this.worldSize,o=h.bT([],[t,t,t]);return h.aC(o,o,this.globeMatrix),o}}recenterOnTerrain(){if(!this._elevation||this.projection.name==="globe")return;const t=this._elevation;this._updateCameraState();const o=h.bY(1,this._center.lat)*this.worldSize,c=this._computeCameraPosition(o),d=this._camera.forward(),m=h.bY(1,this._center.lat);c[2]/=m,d[2]/=m,h.ax(d,d);const _=t.raycast(c,d,t.exaggeration());if(_){const y=h.bi([],c,d,_),v=new h.ad(y[0],y[1],h.bY(y[2],h.bZ(y[1]))),T=(v.z+h.af([v.x-c[0],v.y-c[1],v.z-c[2]*m]))*this._pixelsPerMercatorPixel;this._seaLevelZoom=this._zoomFromMercatorZ(T),this._centerAltitude=v.toAltitude(),this._center=this.coordinateLocation(v),this._updateZoomFromElevation(),this._constrain(),this._calcMatrices()}}_constrainCamera(t=!1){if(!this._elevation)return;const o=this._elevation,c=h.bY(1,this._center.lat)*this.worldSize,d=this._computeCameraPosition(c),m=o.getAtPointOrZero(new h.ad(...d)),_=this.pixelsPerMeter/this.worldSize*m,y=this._minimumHeightOverTerrain(),v=d[2]-_;if(v<=y)if(v<0||t){const T=this.locationCoordinate(this._center,this._centerAltitude),I=[d[0],d[1],T.z-d[2]],P=h.af(I);I[2]-=(y-v)/this._pixelsPerMercatorPixel;const A=h.af(I);if(A===0)return;h.bN(I,I,P/A*this._pixelsPerMercatorPixel),this._camera.position=[d[0],d[1],T.z*this._pixelsPerMercatorPixel-I[2]],this._updateStateFromCamera()}else this._isCameraConstrained=!0}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;const t=this.projection.name==="globe"||this.mercatorFromTransition;if(this.projection.isReprojectedInTileSpace||t){const A=this.center;return A.lat=h.aB(A.lat,this.minLat,this.maxLat),(this.maxBounds||!this.renderWorldCopies&&!t)&&(A.lng=h.aB(A.lng,this.minLng,this.maxLng)),this.center=A,void(this._constraining=!1)}const o=this._unmodified,{x:c,y:d}=this.point;let m=0,_=c,y=d;const v=this.width/2,T=this.height/2,I=this.worldMinY*this.scale,P=this.worldMaxY*this.scale;if(d-T<I&&(y=I+T),d+T>P&&(y=P-T),P-I<this.height&&(m=Math.max(m,this.height/(P-I)),y=(P+I)/2),this.maxBounds||!this._renderWorldCopies||!this.projection.wrap){const A=this.worldMinX*this.scale,D=this.worldMaxX*this.scale,O=this.worldSize/2-(A+D)/2;_=(c+O+this.worldSize)%this.worldSize-O,_-v<A&&(_=A+v),_+v>D&&(_=D-v),D-A<this.width&&(m=Math.max(m,this.width/(D-A)),_=(D+A)/2)}_===c&&y===d||this._allowWorldUnderZoom||(this.center=this.unproject(new h.P(_,y))),m&&!this._allowWorldUnderZoom&&(this.zoom+=this.scaleZoom(m)),this._constrainCamera(),this._unmodified=o,this._constraining=!1}_minZoomForBounds(){let t=Math.max(0,this.scaleZoom(Math.max(0,this.height)/(this.worldMaxY-this.worldMinY)));return this.maxBounds&&(t=Math.max(t,this.scaleZoom(this.width/(this.worldMaxX-this.worldMinX)))),t}_maxCameraBoundsDistance(){return this._mercatorZfromZoom(this._minZoomForBounds())}_calcMatrices(){if(!this.height)return;const t=this.centerOffset,o=this.projection.name==="globe",c=this.pixelsPerMeter;this.projection.name==="globe"&&(this._mercatorScaleRatio=h.bY(1,this.center.lat)/h.bY(1,h.cR));const d=h.cA(this.projection,this.zoom,this.width,this.height,1024);this._pixelsPerMercatorPixel=this.projection.pixelSpaceConversion(this.center.lat,this.worldSize,d),this.cameraToCenterDistance=.5/Math.tan(.5*this._fov)*this.height*this._pixelsPerMercatorPixel,this._updateCameraState(),this._farZ=this.projection.farthestPixelDistance(this),this._nearZ=this.height/50;const m=this.projection.zAxisUnit==="meters"?c:1,_=this._camera.getWorldToCamera(this.worldSize,m);let y;const v=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,this._farZ);if(v[8]=2*-t.x/this.width,v[9]=2*t.y/this.height,this.isOrthographic){let ne=.5*this.height/Math.tan(this._fov/2)*1*Math.tan(.5*this._fov),te=ne*this.aspect,se=-te,J=-ne;te-=t.x,se-=t.x,ne+=t.y,J+=t.y,y=this._camera.getCameraToClipOrthographic(se,te,J,ne,this._nearZ+this._nearClipOffset,this._farZ),((K,oe,de,ue)=>{for(let ve=0;ve<16;ve++)K[ve]=h.aj(oe[ve],de[ve],ue)})(y,y,v,h.cP(this.pitch>=Sn?1:this.pitch/Sn))}else y=v;const T=h.cB([],v,_),I=h.cB([],y,_);if(this.projection.isReprojectedInTileSpace){const ne=this.locationCoordinate(this.center);h.bA(this._mat4Scratch);const te=this._mat4Scratch;h.bB(te,te,[ne.x*this.worldSize,ne.y*this.worldSize,0]),h.aC(te,te,h.cC(this)),h.bB(te,te,[-ne.x*this.worldSize,-ne.y*this.worldSize,0]),h.aC(I,I,te),h.aC(T,T,te),this.inverseAdjustmentMatrix=h.cD(this)}else this.inverseAdjustmentMatrix=[1,0,0,1];if(h.cE(this.mercatorMatrix,I,[this.worldSize,this.worldSize,this.worldSize/m,1]),this.projMatrix=I,h.ba(this.invProjMatrix,this.projMatrix),o){const ne=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,1/0);ne[8]=2*-t.x/this.width,ne[9]=2*t.y/this.height,h.cB(this._expandedFarZProjMatrixBuf,ne,_),this.expandedFarZProjMatrix=this._expandedFarZProjMatrixBuf}else this.expandedFarZProjMatrix=this.projMatrix;h.ba(this._mat4Scratch,y),this.frustumCorners=h.cF.fromInvProjectionMatrix(this._mat4Scratch,this.horizonLineFromTop(),this.height),this.cameraFrustum=h.cn.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,0,!o),h.bT(this.skyboxMatrix,[1,-1,1]),h.cG(this.skyboxMatrix,this.skyboxMatrix,this._pitch),h.bc(this.skyboxMatrix,this.skyboxMatrix,this.angle),h.bW(this.starsProjMatrix,this._fov,this.width/this.height,this._nearZ,this._farZ);const P=(Math.PI/2-this._pitch)*(this.height/this._fov)*this._horizonShift;h.cH(this._mat4Scratch,this.starsProjMatrix),this._mat4Scratch[8]=2*-t.x/this.width,this._mat4Scratch[9]=2*(t.y+P)/this.height,h.aC(this.skyboxMatrix,this._mat4Scratch,this.skyboxMatrix);const A=this.point,D=A.x,O=A.y,L=this.width%2/2,k=this.height%2/2,N=Math.cos(this.angle),H=Math.sin(this.angle),Z=D-Math.round(D)+N*L+H*k,G=O-Math.round(O)+N*k+H*L;if(h.cH(this.alignedProjMatrix,I),h.bB(this.alignedProjMatrix,this.alignedProjMatrix,[Z>.5?Z-1:Z,G>
8.5?G-1:G,0]),h.bT(this.labelPlaneMatrix,[this.width/2,-this.height/2,1]),h.bB(this.labelPlaneMatrix,this.labelPlaneMatrix,[1,-1,0]),h.bT(this.glCoordMatrix,[1,-1,1]),h.bB(this.glCoordMatrix,this.glCoordMatrix,[-1,-1,0]),h.cE(this.glCoordMatrix,this.glCoordMatrix,[2/this.width,2/this.height,1]),h.aC(this.pixelMatrix,this.labelPlaneMatrix,T),this._calcFogMatrices(),this._distanceTileDataCache={},!h.ba(this.pixelMatrixInverse,this.pixelMatrix))throw new Error("failed to invert matrix");if(this.projection.name==="globe"||this.mercatorFromTransition){this.globeMatrix=h.cI(this);const ne=[this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]];this.globeCenterInViewSpace=h.ae(ne,ne,_),this.globeRadius=this.worldSize/2/Math.PI-1}else this.globeMatrix=this.pixelMatrixInverse;this._projMatrixCache={},this._alignedProjMatrixCache={},this._pixelsToTileUnitsCache={},this._expandedProjMatrixCache={}}_calcFogMatrices(){this._fogTileMatrixCache={};const t=this.cameraWorldSizeForFog,o=this.cameraPixelsPerMeter,c=this._camera.position,d=1/this.height/this._pixelsPerMercatorPixel,m=[t,t,o];h.bN(m,m,d),h.bN(c,c,-1),h.cJ(c,c,m),h.cK(this.mercatorFogMatrix,c),h.cE(this.mercatorFogMatrix,this.mercatorFogMatrix,m),this.worldToFogMatrix=this._camera.getWorldToCameraPosition(t,o,d)}_computeCameraPosition(t){const o=(t=t||this.pixelsPerMeter)/this.pixelsPerMeter,c=this._camera.forward(),d=this.point,m=this._mercatorZfromZoom(this._seaLevelZoom?this._seaLevelZoom:this._zoom)*o-t/this.worldSize*this._centerAltitude;return[d.x/this.worldSize-c[0]*m,d.y/this.worldSize-c[1]*m,t/this.worldSize*this._centerAltitude-c[2]*m]}_updateCameraState(){this.height&&(this._camera.setPitchBearing(this._pitch,this.angle),this._camera.position=this._computeCameraPosition())}_translateCameraConstrained(t){const o=this._maxCameraBoundsDistance()*Math.cos(this._pitch),c=this._camera.position[2],d=t[2];let m=1;this.projection.wrap&&(this.center=this.center.wrap()),d>0&&(m=Math.min((o-c)/d,1)),this._camera.position=h.bi([],this._camera.position,t,m),this._updateStateFromCamera()}_updateStateFromCamera(){const t=this._camera.position,o=this._camera.forward(),{pitch:c,bearing:d}=this._camera.getPitchBearing(),m=h.bY(this._centerAltitude,this.center.lat)*this._pixelsPerMercatorPixel,_=this._mercatorZfromZoom(this._maxZoom)*Math.cos(h.am(this._maxPitch)),y=Math.max((t[2]-m)/Math.cos(c),_),v=this._zoomFromMercatorZ(y);h.bi(t,t,o,y),this._pitch=h.aB(c,h.am(this.minPitch),h.am(this.maxPitch)),this.angle=h.bv(d,-Math.PI,Math.PI),this._setZoom(h.aB(v,this._minZoom,this._maxZoom)),this._updateSeaLevelZoom(),this._center=this.coordinateLocation(new h.ad(t[0],t[1],t[2])),this._unmodified=!1,this._constrain(),this._calcMatrices()}_worldSizeFromZoom(t){return Math.pow(2,t)*this.tileSize}_mercatorZfromZoom(t){return this.cameraToCenterDistance/this._worldSizeFromZoom(t)}_minimumHeightOverTerrain(){const t=Math.min(this._seaLevelZoom!=null?this._seaLevelZoom:this._zoom,this._maxZoom)+4;return this._mercatorZfromZoom(t)}_zoomFromMercatorZ(t){return this.scaleZoom(this.cameraToCenterDistance/(Math.max(0,t)*this.tileSize))}zoomFromMercatorZAdjusted(t){let o=0,c=h.cx,d=0,m=1/0;for(;c-o>1e-6&&c>o;){const _=o+.5*(c-o),y=this.tileSize*Math.pow(2,_),v=this.getCameraToCenterDistance(this.projection,_,y),T=this.scaleZoom(v/(Math.max(0,t)*this.tileSize)),I=Math.abs(_-T);I<m&&(m=I,d=_),_<T?o=_:c=_}return d}_terrainEnabled(){return!(!this._elevation||!this.projection.supportsTerrain&&(h.w("Terrain is not yet supported with alternate projections. Use mercator or globe to enable terrain."),1))}anyCornerOffEdge(t,o){const c=Math.min(t.x,o.x),d=Math.max(t.x,o.x),m=Math.min(t.y,o.y),_=Math.max(t.y,o.y);if(m<this.horizonLineFromTop(!1))return!0;if(this.projection.name!=="mercator")return!1;const y=[new h.P(c,m),new h.P(d,_),new h.P(c,_),new h.P(d,m)],v=this.renderWorldCopies?-3:0,T=this.renderWorldCopies?4:1;for(const I of y){const P=this.pointRayIntersection(I);if(P.t<0)return!0;const A=this.rayIntersectionCoordinate(P);if(A.x<v||A.y<0||A.x>T||A.y>1)return!0}return!1}isHorizonVisible(){return this.pitch+h.cL(this.fovAboveCenter)>88||this.anyCornerOffEdge(new h.P(0,0),new h.P(this.width,this.height))}zoomDeltaToMovement(t,o){const c=h.af(h.aw([],this._camera.position,t)),d=this._zoomFromMercatorZ(c)+o;return c-this._mercatorZfromZoom(d)}getCameraPoint(){if(this.projection.name==="globe"){const t=(function([o,c,d],m){const _=[o,c,d,1];h.aD(_,_,m);const y=_[3]=Math.max(_[3],1e-6);return _[0]/=y,_[1]/=y,_[2]/=y,_})([this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]],this.pixelMatrix);return new h.P(t[0],t[1])}{const t=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new h.P(0,t))}}getCameraToCenterDistance(t,o=this.zoom,c=this.worldSize){const d=h.cA(t,o,this.width,this.height,1024),m=t.pixelSpaceConversion(this.center.lat,c,d);let _=.5/Math.tan(.5*this._fov)*this.height*m;return this.isOrthographic&&(_=h.aj(1,_,h.cP(this.pitch>=Sn?1:this.pitch/Sn))),_}getWorldToCameraMatrix(){const t=this._camera.getWorldToCamera(this.worldSize,this.projection.zAxisUnit==="meters"?this.pixelsPerMeter:1);return this.projection.name==="globe"&&h.aC(t,t,this.globeMatrix),t}getFrustum(t){return h.cn.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,t,this.projection.zAxisUnit==="meters")}}const In=(a,t)=>{if(t>0&&a.terrain&&h.w("Cutoff is currently disabled on terrain"),t<=0||a.terrain)return{shouldRenderCutoff:!1,uniformValues:{u_cutoff_params:[0,0,0,1]}};const o=a.transform,c=o.pitch,d=o.isLODDisabled(!1)?60:30;if(c<d-15)return{shouldRenderCutoff:!1,uniformValues:{u_cutoff_params:[0,0,0,1]}};const m=o._farZ-o._nearZ,_=t*o.height*1.3,y=Math.pow(2,.85*Math.max(o._zoom-a.minCutoffZoom,0)),v=1.4*o.cameraToCenterDistance*y,T=h.ag(d-15,d,c),I=(1-(P=T))*(o._farZ+_)+P*v;var P;const A=Math.min(_,I-o._nearZ);return{shouldRenderCutoff:T>0,uniformValues:{u_cutoff_params:[o._nearZ,o._farZ,(I-o._nearZ)/m,(I-A-o._nearZ)/m]}}},gp=[];function yp(a){return gp[a]=gp[a]||new Float64Array(16)}class xu{constructor(t,o){this.aabb=t,this.lastCascade=o}}class N_{add(t,o){const c=this.receivers[t.key];c!==void 0?(c.aabb.min[0]=Math.min(c.aabb.min[0],o.min[0]),c.aabb.min[1]=Math.min(c.aabb.min[1],o.min[1]),c.aabb.min[2]=Math.min(c.aabb.min[2],o.min[2]),c.aabb.max[0]=Math.max(c.aabb.max[0],o.max[0]),c.aabb.max[1]=Math.max(c.aabb.max[1],o.max[1]),c.aabb.max[2]=Math.max(c.aabb.max[2],o.max[2])):this.receivers[t.key]=new xu(o,null)}clear(){this.receivers={}}get(t){return this.receivers[t.key]}computeRequiredCascades(t,o,c){const d=h.cY.fromPoints(t.points);let m=0;for(const _ in this.receivers){const y=this.receivers[_];if(!y||!d.intersectsAabb(y.aabb))continue;y.aabb.min=d.closestPoint(y.aabb.min),y.aabb.max=d.closestPoint(y.aabb.max);const v=y.aabb.getCorners();for(let T=0;T<c.length;T++){let I=!0;for(const P of v){const A=[P[0]*o,P[1]*o,P[2]];
vendor: 5,540 bytes, line 8
8if(h.ae(A,A,c[T].matrix),A[0]<-1||A[0]>1||A[1]<-1||A[1]>1){I=!1;break}}if(y.lastCascade=T,m=Math.max(m,T),I)break}}return m+1}}class xp{constructor(t){this.painter=t,this._enabled=!1,this._drawShadowAfterLayer=-1,this._numCascadesToRender=0,this._cascades=[],this._groundShadowTiles=[],this._receivers=new N_,this._depthMode=new rt(t.context.gl.LEQUAL,rt.ReadWrite,[0,1]),this._uniformValues={u_light_matrix_0:new Float32Array(16),u_light_matrix_1:new Float32Array(16),u_shadow_intensity:0,u_fade_range:[0,0],u_shadow_normal_offset:[1,1,1],u_shadow_texel_size:1,u_shadow_map_resolution:1,u_shadow_direction:[0,0,1],u_shadow_bias:[36e-5,.0012,.012],u_shadowmap_0:0,u_shadowmap_1:0},this._forceDisable=!1,this._devtoolsFolder=null,this.useNormalOffset=!1,this._shadowParameters={cascadeCount:2,normalOffset:3,shadowMapResolution:2048}}destroy(){for(const t of this._cascades)t.texture.destroy(),t.framebuffer.destroy();this._cascades=[]}updateShadowParameters(t,o){const c=this.painter;if(this._enabled=!1,this._drawShadowAfterLayer=-1,this._receivers.clear(),!o||!o.properties)return;const d=o.properties.get("shadow-intensity"),m=o.properties.get("shadow-draw-before-layer");if(!o.shadowsEnabled()||d<=0)return;let _=-1,y=0;for(const N of c.style.order){const H=c.style._mergedLayers[N];H.hasShadowPass()&&!H.isHidden(t.zoom)&&(_=y),!m||m!==N&&m!==H.slot||(this._drawShadowAfterLayer=y>0?y-1:0),y+=1}if(this._enabled=_>=0,!this.enabled)return;this._drawShadowAfterLayer<0&&(this._drawShadowAfterLayer=_);const v=c.context,T=this._shadowParameters.shadowMapResolution,I=this._shadowParameters.shadowMapResolution;if(this._cascades.length===0||this._shadowParameters.shadowMapResolution!==this._cascades[0].texture.size[0]){this._cascades=[];for(let N=0;N<this._shadowParameters.cascadeCount;++N){const H=v.gl,Z=v.createFramebuffer(T,I,0,"texture"),G=new h.T(v,{width:T,height:I,data:null},H.DEPTH_COMPONENT16);Z.depthAttachment.set(G.texture),this._cascades.push({framebuffer:Z,texture:G,matrix:[],far:0,boundingSphereRadius:0,frustum:new h.cn,scale:0})}}this.shadowDirection=vu(o);let P=0;if(t.elevation){const N=t.elevation,H=[1e4,-1e4];N.visibleDemTiles.filter(Z=>Z.dem).forEach(Z=>{const G=Z.dem.tree;H[0]=Math.min(H[0],G.minimums[0]),H[1]=Math.max(H[1],G.maximums[0])}),H[0]!==1e4&&(P=(H[1]-H[0])*N.exaggeration())}const A=1.5*t.cameraToCenterDistance,D=3*A,O=new Float64Array(16);for(let N=0;N<this._cascades.length;++N){const H=this._cascades[N];let Z=t.height/50,G=1;this._shadowParameters.cascadeCount===1?G=D:N===0?G=A:(Z=A,G=D);const[ne,te]=U_(t,this.shadowDirection,Z,G,this._shadowParameters.shadowMapResolution,P);H.scale=t.scale,H.matrix=ne,H.boundingSphereRadius=te,h.ba(O,H.matrix),H.frustum=h.cn.fromInvProjectionMatrix(O,1,0,!0),H.far=G}const L=this._cascades.length-1;this._uniformValues.u_fade_range=[.75*this._cascades[L].far,this._cascades[L].far],this._uniformValues.u_shadow_intensity=d,this._uniformValues.u_shadow_direction=[this.shadowDirection[0],this.shadowDirection[1],this.shadowDirection[2]],this._uniformValues.u_shadow_texel_size=1/this._shadowParameters.shadowMapResolution,this._uniformValues.u_shadow_map_resolution=this._shadowParameters.shadowMapResolution,this._uniformValues.u_shadowmap_0=11,this._uniformValues.u_shadowmap_1=12,this._groundShadowTiles=c.transform.coveringTiles({tileSize:512,renderWorldCopies:!0});const k=c.transform.elevation;for(const N of this._groundShadowTiles){let H={min:0,max:0};if(k){const Z=k.getMinMaxForTile(N);Z&&(H=Z)}this.addShadowReceiver(N.toUnwrapped(),H.min,H.max)}}get enabled(){return this._enabled&&!this._forceDisable}set enabled(t){this._enabled=t}drawShadowPass(t,o){if(!this.enabled)return;const c=this.painter,d=c.context;this._numCascadesToRender=this._receivers.computeRequiredCascades(c.transform.getFrustum(0),c.transform.worldSize,this._cascades),d.viewport.set([0,0,this._shadowParameters.shadowMapResolution,this._shadowParameters.shadowMapResolution]);for(let m=0;m<this._numCascadesToRender;++m){c.currentShadowCascade=m,d.bindFramebuffer.set(this._cascades[m].framebuffer.framebuffer),d.clear({color:h.C.white,depth:1});for(const _ of t.order){const y=t._mergedLayers[_];if(!y.hasShadowPass()||y.isHidden(c.transform.zoom))continue;const v=t.getLayerSourceCache(y),T=v?o[v.id]:void 0;(y.type==="model"||T&&T.length)&&c.renderLayer(c,v,y,T)}}c.currentShadowCascade=0}drawGroundShadows(){if(!this.enabled)return;const t=this.painter,o=t.style,c=t.context,d=c.gl,m=o.directionalLight,_=o.ambientLight;if(!m||!_)return;const y=[],v=In(t,t.longestCutoffRange);v.shouldRenderCutoff&&y.push("RENDER_CUTOFF"),y.push("RENDER_SHADOWS"),this.useNormalOffset&&y.push("NORMAL_OFFSET");const T=_a(o,m,_),I=new rt(d.LEQUAL,rt.ReadOnly,t.depthRangeFor3D),P=new pt({func:d.EQUAL,mask:255},0,255,d.KEEP,d.KEEP,d.KEEP);for(const A of this._groundShadowTiles){const D=A.toUnwrapped(),O=t.isTileAffectedByFog(A),L=t.getOrCreateProgram("groundShadow",{defines:y,overrideFog:O});this.setupShadows(D,L),t.uploadCommonUniforms(c,L,D,null,v);const k=Ko(t.transform.calculateProjMatrix(D),T);L.draw(t,d.TRIANGLES,I,P,gt.multiply,lt.disabled,k,"ground_shadow",t.tileExtentBuffer,t.quadTriangleIndexBuffer,t.tileExtentSegments,null,t.transform.zoom,null,null)}}getShadowPassDepthMode(){return this._depthMode}getGroundShadowLayerIndex(){return this._drawShadowAfterLayer}calculateShadowPassMatrixFromTile(t){const o=this.painter.transform,c=o.calculatePosMatrix(t,o.worldSize);return h.aC(c,this._cascades[this.painter.currentShadowCascade].matrix,c),Float32Array.from(c)}
8calculateShadowPassMatrixFromMatrix(t){const o=h.bb(t);return h.aC(o,this._cascades[this.painter.currentShadowCascade].matrix,t),o}setupShadows(t,o,c){if(!this.enabled)return;const d=this.painter.transform,m=this.painter.context,_=m.gl,y=this._uniformValues,v=d.calculatePosMatrix(t,d.worldSize);for(let T=0;T<this._cascades.length;T++){const I=yp(T);h.aC(I,this._cascades[T].matrix,v),y[T===0?"u_light_matrix_0":"u_light_matrix_1"]=I,m.activeTexture.set(_.TEXTURE0+11+T),this._cascades[T].texture.bindExtraParam(_.LINEAR,_.LINEAR,_.CLAMP_TO_EDGE,_.CLAMP_TO_EDGE,_.GREATER)}if(this.useNormalOffset=!!c,this.useNormalOffset){const T=h.cW(t.canonical),I=2/d.tileSize*h.ak/this._shadowParameters.shadowMapResolution,P=I*this._cascades[0].boundingSphereRadius,A=I*this._cascades.at(-1).boundingSphereRadius,D=(c==="vector-tile"?1:3)*(function(O){const L=h.aB((O-22)/-22,0,1);return .125*(1-L)+4*L})(d.zoom);y.u_shadow_normal_offset=[T,P*D,A*D],y.u_shadow_bias=[1e-4,.0012,.012]}else y.u_shadow_bias=[36e-5,.0012,.012];o.setShadowUniformValues(m,y)}setupShadowsFromMatrix(t,o,c=!1){if(!this.enabled)return;const d=this.painter.context,m=d.gl,_=this._uniformValues;for(let y=0;y<this._shadowParameters.cascadeCount;y++){const v=yp(y);h.aC(v,this._cascades[y].matrix,t),_[y===0?"u_light_matrix_0":"u_light_matrix_1"]=v,d.activeTexture.set(m.TEXTURE0+11+y),this._cascades[y].texture.bindExtraParam(m.LINEAR,m.LINEAR,m.CLAMP_TO_EDGE,m.CLAMP_TO_EDGE,m.GREATER)}if(this.useNormalOffset=c,c){const y=this._shadowParameters.normalOffset;_.u_shadow_normal_offset=[1,y,y],_.u_shadow_bias=[6e-5,.0012,.012]}else _.u_shadow_bias=[36e-5,.0012,.012];o.setShadowUniformValues(d,_)}getShadowUniformValues(){return this._uniformValues}getCurrentCascadeFrustum(){return this._cascades[this.painter.currentShadowCascade].frustum}computeSimplifiedTileShadowVolume(t,o,c,d){if(d[2]>=0)return{};const m=(function(v,T,I){const P=I/(1<<v.canonical.z);return new h.cY([v.canonical.x*P+v.wrap*I,v.canonical.y*P+v.wrap*I,0],[(v.canonical.x+1)*P+v.wrap*I,(v.canonical.y+1)*P+v.wrap*I,T])})(t,o,c).getCorners(),_=o/-d[2];d[0]<0?(h.cX(m[0],m[0],[d[0]*_,0,0]),h.cX(m[3],m[3],[d[0]*_,0,0])):d[0]>0&&(h.cX(m[1],m[1],[d[0]*_,0,0]),h.cX(m[2],m[2],[d[0]*_,0,0])),d[1]<0?(h.cX(m[0],m[0],[0,d[1]*_,0]),h.cX(m[1],m[1],[0,d[1]*_,0])):d[1]>0&&(h.cX(m[2],m[2],[0,d[1]*_,0]),h.cX(m[3],m[3],[0,d[1]*_,0]));const y={};return y.vertices=m,y.planes=[xc(m[1],m[0],m[4]),xc(m[2],m[1],m[5]),xc(m[3],m[2],m[6]),xc(m[0],m[3],m[7])],y}addShadowReceiver(t,o,c){this._receivers.add(t,h.cY.fromTileIdAndHeight(t,o,c))}getMaxCascadeForTile(t){const o=this._receivers.get(t);return o&&o.lastCascade?o.lastCascade:0}}function xc(a,t,o){const c=h.aw([],o,t),d=h.aw([],a,t),m=h.bj([],c,d),_=h.af(m);return _===0?[0,0,1,0]:(h.bN(m,m,1/_),[m[0],m[1],m[2],-h.bk(m,t)])}function vu(a){const t=a.properties.get("direction"),o=h.cT(t.x,t.y,t.z);o[2]=h.aB(o[2],0,75);const c=h.cV([o[0],o[1],o[2]]);return h.cU(c.x,c.y,c.z)}function _a(a,t,o){const c=t.properties.get("color-use-theme")==="none",d=t.properties.get("color"),m=t.properties.get("intensity"),_=t.properties.get("direction"),y=[_.x,_.y,_.z],v=o.properties.get("color-use-theme")==="none",T=o.properties.get("color"),I=o.properties.get("intensity"),P=Math.max(h.bk([0,0,1],y),0),A=[0,0,0];h.bN(A,T.toPremultipliedRenderColor(v?null:a.getLut(t.scope)).toArray01Linear().slice(0,3),I);const D=[0,0,0];return h.bN(D,d.toPremultipliedRenderColor(c?null:a.getLut(o.scope)).toArray01Linear().slice(0,3),P*m),h.c_([A[0]>0?A[0]/(A[0]+D[0]):0,A[1]>0?A[1]/(A[1]+D[1]):0,A[2]>0?A[2]/(A[2]+D[2]):0])}function U_(a,t,o,c,d,m){const _=a.zoom,y=a.scale,v=a.worldSize,T=1/v,I=a.aspect,P=Math.sqrt(1+I*I)*Math.tan(.5*a.fovX),A=P*P,D=c-o,O=c+o;let L,k;A>D/O?(L=c,k=c*P):(L=.5*O*(1+A),k=.5*Math.sqrt(D*D+2*(c*c+o*o)*A+O*O*A*A));const N=a.projection.pixelsPerMeter(a.center.lat,v),H=a._camera.getCameraToWorldMercator(),Z=[0,0,-L*T];h.ae(Z,Z,H);let G=k*T;const ne=function(Re){return Re[0]/=y,Re[1]/=y,Re[2]=h.bY(Re[2],a._center.lat),Re},te=a._edgeInsets;if(!(te.left===0&&te.top===0&&te.right===0&&te.bottom===0||te.left===te.right&&te.top===te.bottom)){const Re=a._camera.getWorldToCamera(a.worldSize,a.projection.zAxisUnit==="meters"?N:1),Ye=a._camera.getCameraToClipPerspective(a._fov,a.width/a.height,o,c);Ye[8]=2*-a.centerOffset.x/a.width,Ye[9]=2*a.centerOffset.y/a.height;const qe=new Float64Array(16);h.cB(qe,Ye,Re);const je=new Float64Array(16);h.ba(je,qe);const Be=h.cn.fromInvProjectionMatrix(je,v,_,!0);for(const at of Be.points){const ot=ne(at);G=Math.max(G,h.bO(h.cZ([],Z,ot)))}}G*=d/(d-1);const se=Math.acos(t[2]),J=Math.atan2(-t[0],-t[1]),K=new ma;K.position=Z,K.setPitchBearing(se,J);const oe=K.getWorldToCamera(v,N),de=G*v,ue=Math.min(a._mercatorZfromZoom(17)*v*-2,-2*de),ve=K.getCameraToClipOrthographic(-de,de,-de,de,ue,(de+m*N)/t[2]),be=new Float64Array(16);h.aC(be,ve,oe);const ke=h.cU(Math.floor(1e6*Z[0])/1e6*v,Math.floor(1e6*Z[1])/1e6*v,0),fe=.5*d,Ee=[0,0,0];h.ae(Ee,ke,be),h.bN(Ee,Ee,fe);const pe=[Math.floor(Ee[0]),Math.floor(Ee[1]),Math.floor(Ee[2])],Pe=[0,0,0];h.aw(Pe,Ee,pe),h.bN(Pe,Pe,-1/fe);const Ce=new Float64Array(16);return h.bA(Ce),h.bB(Ce,Ce,Pe),h.aC(be,Ce,be),[be,de]}class V_ extends h.E{constructor(t){super(),this.requestManager=t,this.models={"":{}},this.modelUris={"":{}},this.modelByURL={},this.numModelsLoading={}}loadModel(t,o){return h.c$(this.requestManager.transformRequest(o,h.R.Model).url).then(c=>{const d=h.d0(c),m=new h.d1(t,o,void 0,void 0,d);return m.computeBoundsAndApplyParent(),m}).catch(c=>{if(c&&c.status===404)return null;this.fire(new h.y(new Error(`Could not load model ${t} from ${o}: ${c.message}`)))})}load(t,o,c={forceReload:!1}){this.models[o]||(this.models[o]={});const d=Object.keys(t),m=[],_=[];for(const y of d){const v=t[y];this.hasURLBeenRequested(v)&&!c.forceReload||(this.modelByURL[v]={modelId:y,scope:o},m.push(this.loadModel(y,v)),_.push(y)),this.models[o][y]||(this.models[o][y]={model:null,numReferences:1})}this.numModelsLoading[o]=(this.numModelsLoading[o]||0)+_.length,Promise.allSettled(m).then(y=>{for(let v=0;v<y.length;v++){const{status:T}=y[v];if(T==="rejected")continue;
vendor: 16,896 bytes, line 8
8const{value:I}=y[v];this.models[o][_[v]]||(this.models[o][_[v]]={model:null,numReferences:1}),this.models[o][_[v]].model=I}this.numModelsLoading[o]-=_.length,this.fire(new h.z("data",{dataType:"style"}))}).catch(y=>{this.fire(new h.y(new Error(`Could not load models: ${y.message}`)))})}isLoaded(){for(const t in this.numModelsLoading)if(this.numModelsLoading[t]>0)return!1;return!0}hasModel(t,o,c={exactIdMatch:!1}){return!!(c.exactIdMatch?this.getModel(t,o):this.getModelByURL(this.modelUris[o][t]))}getModel(t,o){return this.models[o]||(this.models[o]={}),this.models[o][t]?this.models[o][t].model:void 0}getModelByURL(t){if(!t)return null;const o=this.modelByURL[t];return o?this.models[o.scope][o.modelId].model:null}hasModelBeenAdded(t,o){return this.models[o]&&this.models[o][t]!==void 0}getModelURIs(t){return this.modelUris[t]||{}}addModel(t,o,c){this.models[c]||(this.models[c]={}),this.modelUris[c]||(this.modelUris[c]={});const d=this.requestManager.normalizeModelURL(o);if((this.hasModel(t,c,{exactIdMatch:!0})||this.hasModelBeenAdded(t,c))&&this.modelUris[c][t]===d)this.models[c][t].numReferences++;else if(this.hasURLBeenRequested(d)){const{scope:m,modelId:_}=this.modelByURL[d];this.models[m][_].numReferences++}else this.modelUris[c][t]=d,this.load({[t]:this.modelUris[c][t]},c)}addModelURLs(t,o){this.models[o]||(this.models[o]={}),this.modelUris[o]||(this.modelUris[o]={});const c=this.modelUris[o];for(const d in t)c[d]=this.requestManager.normalizeModelURL(t[d])}reloadModels(t){this.load(this.modelUris[t],t,{forceReload:!0})}addModelsFromBucket(t,o){this.models[o]||(this.models[o]={}),this.modelUris[o]||(this.modelUris[o]={});const c={};for(const d of t)this.hasModel(d,o,{exactIdMatch:!0})||this.hasURLBeenRequested(d)?this.models[o][d].numReferences++:this.modelUris[o][d]&&!this.hasURLBeenRequested(d)?c[d]=this.modelUris[o][d]:!this.hasURLBeenRequested(d)&&bs(d,!1)&&(this.modelUris[o][d]=this.requestManager.normalizeModelURL(d),c[d]=this.modelUris[o][d]);this.load(c,o)}hasURLBeenRequested(t){return this.modelByURL[t]!==void 0}removeModel(t,o,c=!1,d=!1){if(this.models[o]&&this.models[o][t]&&(this.models[o][t].numReferences--,this.models[o][t].numReferences===0||d)){const m=this.modelUris[o][t];c||delete this.modelUris[o][t],delete this.modelByURL[m];const _=this.models[o][t].model;if(!_)return;delete this.models[o][t],_.destroy()}}destroy(){for(const t of Object.keys(this.models))for(const o of Object.keys(this.models[t])){const c=this.models[t][o].model;delete this.models[t][o],c&&c.destroy()}this.models={"":{}},this.modelUris={"":{}},this.modelByURL={},this.numModelsLoading={}}listModels(t){return this.models[t]||(this.models[t]={}),Object.keys(this.models[t])}upload(t,o){this.models[o]||(this.models[o]={});for(const c in this.models[o])this.models[o][c].model&&this.models[o][c].model.upload(t.context)}}const j_=["RENDER_SHADOWS","NORMAL_OFFSET"],vp=new Set(["symbol","circle"]),Zh=class jy{constructor(){this._queue=[],this._needsBuild=!0,this._idleHandle=null}needsBuild(){return this._needsBuild}buildQueue(t,o,c){this._idleHandle!=null&&typeof cancelIdleCallback<"u"&&cancelIdleCallback(this._idleHandle),this._idleHandle=null,this._queue=[],this._needsBuild=!1;const d=c.stylesheet,m=!!c.fog,_=!!(c.getTerrain()||d&&d.terrain),y=!(!c.projection||c.projection.name!=="globe"),v=_||y,T=!(!c.directionalLight||!c.directionalLight.shadowsEnabled()),I=c.map&&c.map.painter,P=!I||!I.context.extParallelShaderCompile,A=!!I&&I.emissiveMode==="mrt-fallback",D=(O,L=[],k={})=>{this._queue.push({programId:O,params:Object.assign({},k.params,{defines:L,overrideFog:!!k.fog,overrideTerrain:!!k.terrain,overrideGlobe:!!k.globe,overrideRtt:!!k.rtt,precompiled:!0})})};for(const O of t){if(O.visibility==="none")continue;const L=O.getProgramIds();if(L)for(const k of L){if(vp.has(k))continue;const N=O.getDefaultProgramParams(k,o.zoom,c._styleColorTheme.lut);if(!N)continue;const H=I?I.getShaderSource(k):null,Z=v&&(!H||H.usedDefines.has("RENDER_TO_TEXTURE")),G=A&&Z?(N.defines||[]).concat("USE_MRT1"):N.defines;if(P){D(k,N.defines,{params:N}),Z&&D(k,G,{params:N,rtt:!0});continue}const ne=m&&(!H||H.usedDefines.has("FOG")),te=_&&!O.isDraped()&&(!H||H.usedDefines.has("TERRAIN")),se=y&&(!H||H.usedDefines.has("GLOBE")),J=T&&O.hasElevation()&&(!H||H.usedDefines.has("RENDER_SHADOWS"));for(const K of J?[!1,!0]:[!1]){const oe=K?(N.defines||[]).concat(j_):N.defines||[];for(const de of te?[!1,!0]:[!1])for(const ue of se?[!1,!0]:[!1])for(const ve of ne?[!1,!0]:[!1])D(k,oe,{params:N,fog:ve,terrain:de,globe:ue})}Z&&D(k,G,{params:N,rtt:!0})}}if(D("clippingMask"),_)for(const O of[!1,!0])D("terrainRaster",O?["TERRAIN_VERTEX_MORPHING"]:[],{terrain:!0,fog:m});if(!P){if(t.some(O=>O.type==="hillshade")&&D("hillshadePrepare"),T)for(const O of[!1,!0])for(const L of[!1,!0]){const k=[];O&&k.push("RENDER_CUTOFF"),k.push("RENDER_SHADOWS"),L&&k.push("NORMAL_OFFSET"),D("groundShadow",k),m&&D("groundShadow",k,{fog:!0})}if(y){for(const O of[[],["TERRAIN_VERTEX_MORPHING"],["GLOBE_POLES"]])for(const L of[!1,!0]){const k=[...O,"PROJECTION_GLOBE_VIEW"];L&&k.push("CUSTOM_ANTIALIASING"),D("globeRaster",k,{terrain:_,globe:!0,fog:m})}for(const O of[!1,!0]){const L=O?["PROJECTION_GLOBE_VIEW","FOG"]:["FOG"];D("globeAtmosphere",L,{fog:!0,terrain:_,globe:O}),D("globeAtmosphere",[...L,"ALPHA_PASS"],{fog:!0,terrain:_,globe:O})}D("stars",[],{fog:m,terrain:_,globe:!0})}}}_executeBatch(t,o,c){if(c.map&&c.map.isMoving())return void(this._idleHandle=h.o.requestIdleCallback(y=>this._executeBatch(y,o,c)));o.context.sweepPendingPrograms();const d=o.context.extParallelShaderCompile?jy.DEADLINE_MARGIN_KHR_MS:jy.DEADLINE_MARGIN_SYNC_MS;let m=0;for(;this._queue.length>0;){const y=this._queue.shift();if(!y||(o.style=c,o._fogVisible=!!y.params.overrideFog,o.getOrCreateProgram(y.programId,y.params),m++,t.timeRemaining()<=d))break}const _=this._queue.length===0||t.timeRemaining()>d;m>0&&_&&o.context.gl.flush(),this._idleHandle=this._queue.length>0||o.context._pendingPrograms.size>0?h.o.requestIdleCallback(y=>this._executeBatch(y,o,c)):null}processQueue(t,o){this._queue.length!==0&&(this._idleHandle!=null&&typeof cancelIdleCallback<"u"&&cancelIdleCallback(this._idleHandle),this._idleHandle=h.o.requestIdleCallback(c=>this._executeBatch(c,t,o)))}reset(){this._idleHandle!=null&&typeof cancelIdleCallback<"u"&&cancelIdleCallback(this._idleHandle),this._queue=[],this._idleHandle=null,this._needsBuild=!0}};Zh.DEADLINE_MARGIN_KHR_MS=5,Zh.DEADLINE_MARGIN_SYNC_MS=25;let bu=Zh;const Wh=h.a6.colorTheme,bp=new h.a8({data:new h.a9(Wh.data)});function Xh(a){if(!a.metadata||!a.metadata.content_area)return;const t=h.o.devicePixelRatio,{left:o,top:c,width:d,height:m}=a.metadata.content_area,_=o*t,y=c*t;return[_,y,_+d*t,y+m*t]}function vc(a){if(a)return a.map(([t,o])=>[t*h.o.devicePixelRatio,o*h.o.devicePixelRatio])}class Yh{constructor(t,o,c){this.id=t,this.scope=o,this.sourceCache=c,this.pendingRequests=new Set,this.missingRequests=new Set}addPendingRequest(t){this.missingRequests.has(t.name)||this.pendingRequests.has(t.name)||this.pendingRequests.add(t.name)}hasPendingRequests(){return this.pendingRequests.size>0}resolvePendingRequests(){const t=new Map;if(!this.sourceCache.loaded())return t;const o=this.sourceCache.getVisibleCoordinates();if(o.length===0)return t;const c=this.sourceCache.getSource();if(!(c instanceof ft))return t;const d=o.map(_=>this.sourceCache.getTile(_)),m=c.getImages(d,Array.from(this.pendingRequests));for(const[_,y]of m)t.set(h.I.from({name:_,iconsetId:this.id}),y),this.pendingRequests.delete(_);for(const _ of this.pendingRequests)this.missingRequests.add(_);return this.pendingRequests.clear(),t}}class ga{constructor(){this._previousClosestBuildingId=null,this._hysteresisRatio=.8,this._indoorMinimumZoom=16}findClosestBuilding(t,o,c,d,m){if(c<this._indoorMinimumZoom)return this._previousClosestBuildingId=null,null;let _=null,y=Number.MAX_VALUE,v=Number.MAX_VALUE,T=!1;const I=this._previousClosestBuildingId?t[this._previousClosestBuildingId]:null;this._previousClosestBuildingId&&I&&this._isBuildingVisible(I,d,m)&&(T=!0,v=this._calculateDistance(o,I));for(const[P,A]of Object.entries(t)){if(!this._isBuildingVisible(A,d,m))continue;const D=this._calculateDistance(o,A);D<y&&(y=D,_=P)}return T&&_&&this._previousClosestBuildingId&&_!==this._previousClosestBuildingId?y>v*this._hysteresisRatio&&(_=this._previousClosestBuildingId):T&&!_&&(_=this._previousClosestBuildingId),this._previousClosestBuildingId=_,_}_calculateDistance(t,o){if(!o.center)return Number.MAX_VALUE;const c=t.lat-o.center[1],d=t.lng-o.center[0];return c*c+d*d}_isBuildingVisible(t,o,c){if(!c)return!1;for(const d of t.floorIds){const m=t.floors[d];if(!m.geometry)continue;const _=m.geometry;if(_.type==="Polygon"){const y=this._convertRingToPoints(_.coordinates[0]);if(h.bz(y,c))return!0}else if(_.type==="MultiPolygon"){const y=this._convertMultiPolygonToPoints(_.coordinates);if(h.d2(c,y))return!0}}return!1}_convertRingToPoints(t){return t.map(o=>new h.P(o[0],o[1]))}_convertMultiPolygonToPoints(t){return t.map(o=>o.length===0?[]:o[0].map(c=>new h.P(c[0],c[1])))}}class ya extends h.E{constructor(t){super(),this._style=t,this._buildings={},this._activeFloors=new Set,this._closestBuildingId=null,this._indoorState={selectedFloorId:null,activeFloorsVisible:!0,activeFloors:this._activeFloors},this._buildingDetectionStrategy=new ga,this._initialLoadDone=!1,h.b0(["_updateUI"],this),this._style.on("style.load",()=>{this._style.isIndoorEnabled()&&(this._style.map.on("load",()=>{this._initialLoadDone=!0,this._indoorState&&this._indoorState.needsUpdate&&(this._indoorState.needsUpdate=!1,this._style.updateIndoorDependentLayers()),this._updateUI()}),this._style.map.on("move",this._updateUI),this._style.map.on("idle",this._updateUI))})}destroy(){this._buildings={},this._activeFloors=new Set,this._indoorState=null}selectFloor(t){t===this._selectedFloorId&&this._indoorState&&this._indoorState.activeFloorsVisible||(this._selectedFloorId=t,this._recalculateActiveFloors())}setActiveFloorsVisibility(t){this._updateActiveFloors(t),this._updateIndoorSelector()}setIndoorData(t){let o=!1;for(const[c,d]of Object.entries(t.buildings))if(this._buildings[c])for(const m of d.floorIds)this._buildings[c].floorIds.add(m),this._buildings[c].floors[m]?this._mergeFloors(this._buildings[c].floors[m],d.floors[m]):(this._buildings[c].floors[m]=d.floors[m],o=!0);else this._buildings[c]=d,o=!0;o&&this._recalculateActiveFloors()}getIndoorTileOptions(t,o){return this._indoorState?{sourceLayers:this._style.getIndoorSourceLayers(t,o),indoorState:this._indoorState}:null}getControlState(){const t=this._buildings,o=this._closestBuildingId,c=o&&t?t[o]:void 0;if(!c)return{selectedFloorId:null,activeFloorsVisible:!!this._indoorState&&this._indoorState.activeFloorsVisible,floors:[]};let d=null;for(const _ of c.floorIds)if(this._activeFloors&&this._activeFloors.has(_)){d=_;break}const m=Array.from(c.floorIds).map(_=>({id:_,name:c.floors[_].name,zIndex:c.floors[_].zIndex})).sort((_,y)=>y.zIndex-_.zIndex).filter((_,y,v)=>y===0||_.zIndex!==v[y-1].zIndex);return{selectedFloorId:d,activeFloorsVisible:!!this._indoorState&&this._indoorState.activeFloorsVisible,floors:m}}_updateUI(){this._initialLoadDone=!0;const t=this._style.map.transform,o=this._buildingDetectionStrategy.findClosestBuilding(this._buildings,t.center,t.zoom,t.getBounds(),this._makeViewportPolygon());if(o!==this._closestBuildingId){const c=this._closestBuildingId;this._closestBuildingId=o,this._onBuildingTransition(c,o),this._updateIndoorSelector()}}_onBuildingTransition(t,o){if(!this._indoorState)return;!o&&t?(this._indoorState.activeFloors=new Set,this._indoorState.activeFloorsVisible=!1,this._style.updateIndoorDependentLayers()):o&&!t&&(this._recalculateActiveFloors(),this._updateActiveFloors(!0))}_updateIndoorSelector(){this.fire(new h.z("selector-update",this.getControlState()))}_updateActiveFloors(t){this._indoorState={selectedFloorId:this._selectedFloorId,activeFloorsVisible:t,activeFloors:this._activeFloors},this._initialLoadDone?this._style.updateIndoorDependentLayers():this._indoorState.needsUpdate=!0}_recalculateActiveFloors(){if(!this._buildings)return;const t=h.d3.calculate(this._buildings,this._selectedFloorId,this._activeFloors);(function(o,c){if(o===c)return!0;if(!o||!c||o.size!==c.size)return!1;for(const d of o)if(!c.has(d))return!1;return!0})(t,this._activeFloors)||(this._activeFloors=t,this._updateActiveFloors(!!this._indoorState&&this._indoorState.activeFloorsVisible),this._updateIndoorSelector())}_mergeFloors(t,o){o.geometry&&(t.geometry?(t.geometry.type==="Polygon"&&(t.geometry={type:"MultiPolygon",coordinates:[t.geometry.coordinates]}),o.geometry.type==="Polygon"?t.geometry.coordinates.push(o.geometry.coordinates):o.geometry.type==="MultiPolygon"&&t.geometry.coordinates.push(...o.geometry.coordinates)):t.geometry=o.geometry)}_makeViewportPolygon(){const t=this._style.map.transform,o=t.width,c=t.height;return[t.pointLocation(new h.P(0,0)),t.pointLocation(new h.P(o,0)),t.pointLocation(new h.P(o,c)),t.pointLocation(new h.P(0,c))].map(d=>new h.P(d.lng,d.lat))}}const kn=(a,t)=>bo(a,t&&t.filter(o=>o.identifier!=="source.canvas")),Ao=h.aK(Tt,["addLayer","removeLayer","setLights","setPaintProperty","setLayoutProperty","setLayerProperty","setSlot","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setTerrain","setFog","setSnow","setRain","setProjection","setCamera","addImport","removeImport","updateImport","addIconset","removeIconset"]),wp=h.aK(Tt,["setCenter","setZoom","setBearing","setPitch"]),bc=new Set(["background","sky","slot","custom"]),Tp=new Set(["building"]),xa={version:8,layers:[],sources:{}},wc={duration:300,delay:0};class dn extends h.E{constructor(t,o={}){if(super(),this.map=t,this.scope=o.scope||"",this.globalId=null,this.fragments=[],this.importDepth=o.importDepth||0,this.importsCache=o.importsCache||new Map,this.resolvedImports=o.resolvedImports||new Set,this.transition=Object.assign({},wc),this._buildingIndex=new ei(this),this.crossTileSymbolIndex=new _p,this._mergedOrder=[],this._drapedFirstOrder=[],this._mergedLayers={},this._mergedIndoor={},this._mergedSourceCaches={},this._mergedOtherSourceCaches={},this._mergedSymbolSourceCaches={},this._mergedFillExtrusionSourceCaches={},this._clipLayerPresent=!1,this._hasAppearances=!1,this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this._importedAsBasemap=!1,this._changes=o.styleChanges||new ln,this._hasDataDrivenEmissive=!1,this.indoorManager=new ya(this),this.dispatcher=o.dispatcher?o.dispatcher:new sc(rl(),this),this.map.painter&&this.map.painter.context){const d=this.map.painter.context.maxUniformBufferBindings,m=Math.floor(this.map.painter.context.maxUniformBlockSize/4);this.dispatcher.broadcast("setContextParams",{maxBindingPoints:d,maxUniformBlockSizeDwords:m,disableSymbolUBO:this.map.painter.context.disableSymbolUBO})}o.imageManager?this.imageManager=o.imageManager:(this.imageManager=new Et(this.map._spriteFormat),this.imageManager.setEventedParent(this)),this.imageManager.addScope(this.scope),this.glyphManager=o.glyphManager?o.glyphManager:new h.d4(t._requestManager,o.localFontFamily?h.d5.all:o.localIdeographFontFamily?h.d5.ideographs:h.d5.none,o.localFontFamily||o.localIdeographFontFamily,o.fontstackCompositing),o.modelManager?this.modelManager=o.modelManager:(this.modelManager=new V_(t._requestManager),this.modelManager.setEventedParent(this)),this._layers={},this._sourceCaches={},this._otherSourceCaches={},this._symbolSourceCaches={},this._fillExtrusionSourceCaches={},this._loaded=!1,this._initialBroadcastDone=!1,this._programPrecompiler=this.map._precompilePrograms&&this.isRootStyle()?new bu:null,this._availableImages=[],this._availableModels={},this._order=[],this._markersNeedUpdate=!1,this.options=o.configOptions?o.configOptions:new Map,this._configDependentLayers=o.configDependentLayers?o.configDependentLayers:new Set,this._indoorDependentLayers=o.indoorDependentLayers?o.indoorDependentLayers:new Set,this._config=o.config,this._styleColorTheme={lut:null,lutLoading:!1,lutLoadingCorrelationID:0,colorTheme:null,colorThemeOverride:o.colorThemeOverride},this._styleColorThemeForScope={},this._initialConfig=o.initialConfig,this.dispatcher.broadcast("setReferrer",h.d6()),this.dispatcher.broadcast("setConfig",h.d7());const c=this;this._rtlTextPluginCallback=dn.registerForPluginStateChange(d=>{c.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:d.pluginStatus,pluginURL:d.pluginURL},(m,_)=>{if(h.d8(m),_&&_.every(y=>y))for(const y in c._sourceCaches){const v=c._sourceCaches[y],T=v.getSource().type;T!=="vector"&&T!=="geojson"||v.reload()}})}),this.on("data",d=>{if(d.dataType!=="source"||d.sourceDataType!=="metadata")return;const m=this.getOwnSource(d.sourceId);if(m&&m.vectorLayerIds)for(const _ in this._layers){const y=this._layers[_];
8y.source===m.id&&this._validateLayer(y)}})}load(t){return t?(typeof t=="string"?this.loadURL(t):this.loadJSON(t),this):this}_getGlobalId(t){if(!t)return null;if(typeof t=="string"){if(h.e(t))return t;const o=h.d9(t);if(!o.startsWith("http"))try{return new URL(o,location.href).toString()}catch{return o}return o}return`json://${h.da(JSON.stringify(t))}`}_diffStyle(t,o,c){this.globalId=this._getGlobalId(t);const d=(m,_)=>{try{_(null,this.setState(m,c))}catch(y){_(y,!1)}};if(typeof t=="string"){const m=this.map._requestManager.normalizeStyleURL(t),_=this.map._requestManager.transformRequest(m,h.R.Style);h.m(_,(y,v)=>{y?this.fire(new h.y(y)):v&&d(v,o)})}else typeof t=="object"&&d(t,o)}loadURL(t,o={}){this.fire(new h.z("dataloading",{dataType:"style"}));const c=typeof o.validate=="boolean"?o.validate:!h.e(t);this.globalId=this._getGlobalId(t),t=this.map._requestManager.normalizeStyleURL(t,o.accessToken),this.resolvedImports.add(t);const d=this.importsCache.get(t);if(d)return this._load(d,c);const m=this.map._requestManager.transformRequest(t,h.R.Style);this._request=h.m(m,(_,y)=>{if(this._request=null,_)this.fire(new h.y(_));else if(y)return this.importsCache.set(t,y),this._load(y,c)})}loadJSON(t,o={}){this.fire(new h.z("dataloading",{dataType:"style"})),this.globalId=this._getGlobalId(t),this._request=h.o.frame(()=>{this._request=null,this._load(t,o.validate!==!1)})}loadEmpty(){this.fire(new h.z("dataloading",{dataType:"style"})),this._load(xa,!1)}_loadImports(t,o,c){if(this.importDepth>=4)return h.w("Style doesn't support nesting deeper than 5"),Promise.resolve();const d=[];for(const m of t){const _=this._createFragmentStyle(m),y=new Promise(I=>{_.once("style.import.load",I),_.once("error",I)}).then(()=>{this.mergeAll(),this.fire(new h.z("data",{dataType:"style"}))});if(d.push(y),this.resolvedImports.has(m.url)){_.loadEmpty();continue}const v=m.data||this.importsCache.get(m.url);v?(m.data?(_.fire(new h.z("dataloading",{dataType:"style"})),_.globalId=_._getGlobalId(v),queueMicrotask(()=>_._load(v,o))):_.loadJSON(v,{validate:o}),this._isInternalStyle(v)&&(_.globalId=null)):m.url?_.loadURL(m.url,{validate:o}):_.loadEmpty();const T={style:_,id:m.id,config:m.config};if(c){const I=this.fragments.findIndex(({id:P})=>P===c);this.fragments=this.fragments.slice(0,I).concat(T).concat(this.fragments.slice(I))}else this.fragments.push(T)}return Promise.allSettled(d)}getImportGlobalIds(t=this,o=new Set){for(const c of t.fragments)c.style.globalId&&o.add(c.style.globalId),this.getImportGlobalIds(c.style,o);return[...o.values()]}_createFragmentStyle(t){const o=this.scope?h.t(t.id,this.scope):t.id;let c;const d=this._initialConfig&&this._initialConfig[o];(t.config||d)&&(c=Object.assign({},t.config,d));const m=new dn(this.map,{scope:o,styleChanges:this._changes,importDepth:this.importDepth+1,importsCache:this.importsCache,resolvedImports:new Set(this.resolvedImports),dispatcher:this.dispatcher,imageManager:this.imageManager,glyphManager:this.glyphManager,modelManager:this.modelManager,config:c,configOptions:this.options,colorThemeOverride:t["color-theme"],configDependentLayers:this._configDependentLayers,indoorDependentLayers:this._indoorDependentLayers});return m.setEventedParent(this.map,{style:m}),m}_reloadImports(t=!1){this.mergeAll(),this._updateMapProjection(),t||this.updateConfigDependencies(),this._updateLayers(this._indoorDependentLayers),this.map._triggerCameraUpdate(this.camera),(!t||this.isRootStyle()||this.map.style._initialBroadcastDone)&&(t&&this.isRootStyle()?(this.forEachFragmentStyle(o=>{this.dispatcher.broadcast("setLayers",{layers:o._serializeLayers(o._order),scope:o.scope,options:o.options})}),this._initialBroadcastDone=!0):this.dispatcher.broadcast("setLayers",{layers:this._serializeLayers(this._order),scope:this.scope,options:this.options}))}_isInternalStyle(t){return this.isRootStyle()&&(t.fragment||!!t.schema&&t.fragment!==!1)}_load(t,o){if(this._isInternalStyle(t)){const m=Object.assign({},xa,{imports:[{id:"basemap",data:t,url:""}]},t.center?{center:t.center}:{},t.bearing?{bearing:t.bearing}:{},t.pitch?{pitch:t.pitch}:{},t.zoom?{zoom:t.zoom}:{},t.light?{light:t.light}:{});return this._importedAsBasemap=!0,void this._load(m,o)}
vendor: 36,261 bytes, line 8
8if(this.updateConfig(this._config,t.schema),o&&kn(this,vo(t)))return;this._loaded=!0;for(const m in t.sources)this.addSource(m,t.sources[m],{validate:!1,isInitialLoad:!0});this.stylesheet=h.db(t);const c=()=>{if(t.iconsets)for(const v in t.iconsets)this.addIconset(v,t.iconsets[v]);t.sprite?this._loadIconset(t.sprite):(this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0})),!this.glyphManager.url&&t.glyphs&&this.glyphManager.setURL(t.glyphs);const m=Rr(this.stylesheet.layers);if(this._order=m.map(v=>v.id),this.stylesheet.light&&h.w("The `light` root property is deprecated, prefer using `lights` with `flat` light type instead."),this.stylesheet.lights)if(this.stylesheet.lights.length===1&&this.stylesheet.lights[0].type==="flat"){const v=this.stylesheet.lights[0];this.light=new Lh(v.properties,v.id)}else this.setLights(this.stylesheet.lights);this.light||(this.light=new Lh(this.stylesheet.light)),this._layers={};for(const v of m){const T=h.dh(v,this.scope,this._styleColorTheme.lut,this.options);T.expressionDependencies.configDependencies.size!==0&&this._configDependentLayers.add(T.fqid),T.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(T.fqid),this._hasAppearances=this._hasAppearances||T.getAppearances().length!==0,T.setEventedParent(this,{layer:{id:T.id}}),this._layers[T.id]=T;const I=this.getOwnLayerSourceCache(T),P=!!this.directionalLight&&this.directionalLight.shadowsEnabled();I&&T.canCastShadows()&&P&&(I.castsShadows=!0)}if(this.glyphManager.url){const v=new Set;for(const T in this._layers){const I=this._layers[T];if(I.type==="symbol"&&I.layout){const P=I.layout.get("text-font");P&&P.value&&P.value.kind==="constant"&&v.add(P.value.value.join(","))}}for(const T of v)this.glyphManager.prefetchRange(T,0)}this.stylesheet.featuresets&&this.setFeaturesetSelectors(this.stylesheet.featuresets),this.stylesheet.models&&this.addModelURLs(this.stylesheet.models);const _=this.stylesheet.terrain;_&&(this.checkCanvasFingerprintNoise(),this.disableElevatedTerrain||this.terrainSetForDrapingOnly()||this._createTerrain(_,1)),this.stylesheet.fog&&this._createFog(this.stylesheet.fog),this.stylesheet.snow&&this._createSnow(this.stylesheet.snow),this.stylesheet.rain&&this._createRain(this.stylesheet.rain),this.stylesheet.transition&&this.setTransition(this.stylesheet.transition),this.fire(new h.z("data",{dataType:"style"}));const y=this.isRootStyle();t.imports?this._loadImports(t.imports,o).then(()=>{this._reloadImports(!0),this.fire(new h.z(y?"style.load":"style.import.load"))}).catch(v=>{this.fire(new h.y(new Error("Failed to load imports",v))),this.fire(new h.z(y?"style.load":"style.import.load"))}):(this._reloadImports(!0),this.fire(new h.z(y?"style.load":"style.import.load")))};this._styleColorTheme.colorTheme=this.stylesheet["color-theme"];const d=this._styleColorTheme.colorThemeOverride?this._styleColorTheme.colorThemeOverride:this._styleColorTheme.colorTheme;if(d){const m=this._evaluateColorThemeData(d);this._loadColorTheme(m).then(()=>{c()}).catch(_=>{h.w(`Couldn't load color theme from the stylesheet: ${_}`),c()})}else this._styleColorTheme.lut=null,c()}isRootStyle(){return this.importDepth===0}hasAppearances(){return this._hasAppearances||this.fragments.some(t=>t.style.hasAppearances())}mergeAll(){let t,o,c,d,m,_,y,v,T,I;const P={};this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle(A=>{if(A.stylesheet){if(A.disableElevatedTerrain&&(this.disableElevatedTerrain=!0),A.light!=null&&(t=A.light),A.stylesheet.lights)for(const D of A.stylesheet.lights)D.type==="ambient"&&A.ambientLight!=null&&(o=A.ambientLight),D.type==="directional"&&A.directionalLight!=null&&(c=A.directionalLight);d=this._prioritizeTerrain(d,A.terrain,A.stylesheet.terrain),A.stylesheet.fog&&A.fog!=null&&(m=A.fog),A.stylesheet.snow&&A.snow!=null&&(_=A.snow),A.stylesheet.rain&&A.rain!=null&&(y=A.rain),A.stylesheet.camera!=null&&(I=A.stylesheet.camera),A.stylesheet.projection!=null&&(v=A.stylesheet.projection),A.stylesheet.transition!=null&&(T=A.stylesheet.transition),P[A.scope]=A._styleColorTheme}}),this.light=t,this.ambientLight=o,this.directionalLight=c,this.fog=m,this.snow=_,this.rain=y,this._styleColorThemeForScope=P,d===null?delete this.terrain:this.terrain=d,this.camera=I||{"camera-projection":"perspective"},this.projection=v||{name:"mercator"},this.transition=Object.assign({},wc,T),this.mergeSources(),this.mergeLayers(),this.mergeIndoor(),this._programPrecompiler&&this._programPrecompiler.reset()}forEachFragmentStyle(t){const o=c=>{for(const d of c.fragments)o(d.style);t(c)};o(this)}_prioritizeTerrain(t,o,c){const d=t&&t.drapeRenderMode===0;return c===null?o&&o.drapeRenderMode===0?o:d?t:null:o!=null&&(!t||d||o&&o.drapeRenderMode===1)?o:t}mergeTerrain(){let t;this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle(o=>{t=this._prioritizeTerrain(t,o.terrain,o.stylesheet.terrain)}),t===null?delete this.terrain:this.terrain=t,this._programPrecompiler&&this._programPrecompiler.reset()}mergeProjection(){let t;this.forEachFragmentStyle(o=>{o.stylesheet.projection!=null&&(t=o.stylesheet.projection)}),this.projection=t||{name:"mercator"},this._programPrecompiler&&this._programPrecompiler.reset()}mergeSources(){const t={},o={},c={},d={};this.forEachFragmentStyle(m=>{for(const _ in m._sourceCaches){const y=h.t(_,m.scope);t[y]=m._sourceCaches[_]}for(const _ in m._otherSourceCaches){const y=h.t(_,m.scope);o[y]=m._otherSourceCaches[_]}for(const _ in m._symbolSourceCaches){const y=h.t(_,m.scope);c[y]=m._symbolSourceCaches[_]}for(const _ in m._fillExtrusionSourceCaches){const y=h.t(_,m.scope);d[y]=m._fillExtrusionSourceCaches[_]}}),this._mergedSourceCaches=t,this._mergedOtherSourceCaches=o,this._mergedSymbolSourceCaches=c,this._mergedFillExtrusionSourceCaches=d}mergeIndoor(){this.forEachFragmentStyle(t=>{if(t.stylesheet&&t.stylesheet.indoor)for(const o of Object.values(t.stylesheet.indoor)){const c=o,d=h.t(c.sourceId,t.scope);this._mergedIndoor[d]=new Set(c.sourceLayers||[])}})}mergeLayers(){const t={},o=[],c={};this._mergedSlots=[],this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this.forEachFragmentStyle(_=>{for(const y of _._order){const v=_._layers[y];if(v.type==="slot"){const T=h.dc(y);if(t[T])continue;t[T]=[]}v.slot&&t[v.slot]?t[v.slot].push(v):o.push(v)}}),this._mergedOrder=[];let d=-1;const m=(_=[])=>{for(const y of _)if(y.type==="slot"){const v=h.dc(y.id);t[v]&&m(t[v]),this._mergedSlots.push(v)}else{const v=h.t(y.id,y.scope);this._mergedOrder.push(v),c[v]=y,y.is3D(!!this.terrain)&&(this._has3DLayers=!0,d=this._mergedOrder.length-1),y.type==="circle"&&(this._hasCircleLayers=!0),y.type==="symbol"&&(this._hasSymbolLayers=!0),y.type==="clip"&&(this._clipLayerPresent=!0)}};if(m(o),this._has3DLayers){const _={};for(let y=0;y<this._mergedOrder.length;++y){const v=this._mergedOrder[y];_[v]=y===d?1:y<d?c[v].hasOcclusionOpacityProperties?2:0:4}this._mergedOrder.sort((y,v)=>_[y]-_[v])}this._mergedLayers=c,this.updateDrapeFirstLayers(),this._buildingIndex.processLayersChanged(),this._updateDataDrivenEmissiveStrength()}terrainSetForDrapingOnly(){return!!this.terrain&&this.terrain.drapeRenderMode===0}getCamera(){return this.stylesheet.camera}setCamera(t){return this.stylesheet.camera=Object.assign({},this.stylesheet.camera,t),this.camera=this.stylesheet.camera,this}_evaluateColorThemeData(t){return t.data?(function(o,c,d){const m=Object.assign({},c);for(const y of Object.keys(Wh))m[y]===void 0&&(m[y]=Wh[y].default);const _=new h.a7(bp,o,new Map(d));return _.setTransitionOrValue(m,d),_.untransitioned().possiblyEvaluate(new h.ab(0,{worldview:void 0}))})(this.scope,t,this.options).get("data"):null}_loadColorTheme(t){this._styleColorTheme.lutLoading=!0,this._styleColorTheme.lutLoadingCorrelationID+=1;const o=this._styleColorTheme.lutLoadingCorrelationID;return new Promise((c,d)=>{const m="data:image/png;base64,";if(!t||t.length===0)return this._styleColorTheme.lut=null,this._styleColorTheme.lutLoading=!1,void c();let _=t;_.startsWith(m)||(_=m+_);const y=h.I.from("mapbox-reserved-lut"),v=new Image;v.src=_,v.onerror=()=>{this._styleColorTheme.lutLoading=!1,d(new Error("Failed to load image data"))},v.onload=()=>{if(this._styleColorTheme.lutLoadingCorrelationID!==o)return void c();this._styleColorTheme.lutLoading=!1;const{width:T,height:I,data:P}=h.o.getImageData(v);if(I>32)return void d(new Error("The height of the image must be less than or equal to 32 pixels."));if(T!==I*I)return void d(new Error("The width of the image must be equal to the height squared."));this.getImage(y)&&this.removeImage(y),this.addImage(y,{data:new h.q({width:T,height:I},P),pixelRatio:1,sdf:!1,usvg:!1,version:0});const A=this.imageManager.getImage(y,this.scope);A?(this._styleColorTheme.lut={image:A.data,data:t},c()):d(new Error("Missing LUT image."))}})}getLut(t){const o=this._styleColorThemeForScope[t];return o?o.lut:null}setProjection(t){t?this.stylesheet.projection=t:delete this.stylesheet.projection,this.mergeProjection(),this._updateMapProjection()}applyProjectionUpdate(){this._loaded&&(this.dispatcher.broadcast("setProjection",this.map.transform.projectionOptions),this.map.transform.projection.requiresDraping?(this.getTerrain()||this.stylesheet.terrain)&&!this.disableElevatedTerrain||this.setTerrainForDraping():this.terrainSetForDrapingOnly()&&this.setTerrain(null,0))}_updateMapProjection(){this.isRootStyle()&&(this.map._useExplicitProjection?this.applyProjectionUpdate():this.map._prioritizeAndUpdateProjection(null,this.projection))}_loadSprite(t){this._spriteRequest=(function(o,c,d){let m,_,y;const v=h.o.devicePixelRatio>1?"@2x":"";let T=h.m(c.transformRequest(c.normalizeSpriteURL(o,v,".json"),h.R.SpriteJSON),(A,D)=>{T=null,y||(y=A,m=D,P())}),I=h.n(c.transformRequest(c.normalizeSpriteURL(o,v,".png"),h.R.SpriteImage),(A,D)=>{I=null,y||(y=A,_=D,P())});function P(){if(y)d(y);else if(m&&_){const A=h.o.getImageData(_),D={};for(const O in m){const{width:L,height:k,x:N,y:H,sdf:Z,pixelRatio:G,stretchX:ne,stretchY:te,content:se}=m[O],J=new h.q({width:L,height:k});h.q.copy(A,J,{x:N,y:H},{x:0,y:0},{width:L,height:k},null),D[O]={data:J,pixelRatio:G!==void 0?G:1,sdf:Z!==void 0&&Z,stretchX:ne,stretchY:te,content:se,usvg:!1,version:0}}d(null,D)}}return{cancel(){T&&(T.cancel(),T=null),I&&(I.cancel(),I=null)}}})(t,this.map._requestManager,(o,c)=>{if(this._spriteRequest=null,o)this.fire(new h.y(o));else if(c){const d=new Map;for(const m in c)d.set(h.I.from(m),c[m]);this.addImages(d)}this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0}),this.fire(new h.z("data",{dataType:"style"}))})}addIconset(t,o){if(o.type==="sprite")return void this._loadSprite(o.url);const c=this.getOwnSourceCache(o.source);if(!c)return void this.fire(new h.y(new Error(`Source "${o.source}" as specified by iconset "${t}" does not exist and cannot be used as an iconset source`)));const d=c.getSource();if(d.type!=="raster-array")return void this.fire(new h.y(new Error(`Source "${o.source}" as specified by iconset "${t}" is not a "raster-array" source and cannot be used as an iconset source`)));d.partial=!1;const m=new Yh(t,this.scope,c);this.imageManager.addImageProvider(m,this.scope)}removeIconset(t){this.imageManager.removeImageProvider(t,this.scope)}_loadIconset(t){if(!h.e(t)&&this.map._spriteFormat!=="icon_set"||this.map._spriteFormat==="raster")return void this._loadSprite(t);const o=this.map._spriteFormat==="auto";var c,d;this._spriteRequest=(d=(m,_)=>{if(this._spriteRequest=null,m)o?this._loadSprite(t):this.fire(new h.y(m));else if(_){const y=new Map;for(const v in _)y.set(h.I.from(v),_[v]);this.addImages(y)}this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0}),this.fire(new h.z("data",{dataType:"style"}))},h.b4((c=this.map._requestManager).transformRequest(c.normalizeIconsetURL(t),h.R.Iconset),(m,_)=>{if(m)return void d(m);const y={},v=new h.b2(_).readFields($a,{icons:[]},void 0);for(const T of v.icons){const I={version:1,pixelRatio:h.o.devicePixelRatio,content:Xh(T),stretchX:T.metadata?vc(T.metadata.stretch_x_areas):void 0,stretchY:T.metadata?vc(T.metadata.stretch_y_areas):void 0,sdf:!1,usvg:!0,icon:T};y[T.name]=I}d(null,y)}))}_validateLayer(t){const o=this.getOwnSource(t.source);if(!o)return;const c=t.sourceLayer;c&&(o.type==="geojson"||o.vectorLayerIds&&!o.vectorLayerIds.includes(c))&&this.fire(new h.y(new Error(`Source layer "${c}" does not exist on source "${o.id}" as specified by style layer "${t.id}"`)))}loaded(){if(!this._loaded||Object.keys(this._changes.getUpdatedSourceCaches()).length)return!1;for(const t in this._sourceCaches)if(!this._sourceCaches[t].loaded())return!1;if(!this.imageManager.isLoaded()||this.imageManager.hasPatternsInFlight()||!this.modelManager.isLoaded()||this._styleColorTheme.lutLoading)return!1;for(const{style:t}of this.fragments)if(!t.loaded())return!1;return!0}_serializeImports(){if(this.stylesheet.imports)return this.stylesheet.imports.map((t,o)=>{const c=this.fragments[o];return c&&c.style&&(t.data=c.style.serialize()),t})}_serializeSources(){const t={};for(const o in this._sourceCaches){const c=this._sourceCaches[o].getSource();t[c.id]||(t[c.id]=c.serialize())}return t}_serializeLayers(t){const o=[];for(const c of t){const d=this._layers[c];d&&d.type!=="custom"&&o.push(d.serialize())}return o}hasLightTransitions(){return!(!this.light||!this.light.hasTransition())||!(!this.ambientLight||!this.ambientLight.hasTransition())||!(!this.directionalLight||!this.directionalLight.hasTransition())}hasFogTransition(){return!!this.fog&&this.fog.hasTransition()}hasSnowTransition(){return!!this.snow&&this.snow.hasTransition()}hasRainTransition(){return!!this.rain&&this.rain.hasTransition()}hasTransitions(){if(this.hasLightTransitions()||this.hasFogTransition()||this.hasSnowTransition()||this.hasRainTransition())return!0;for(const t in this._sourceCaches)if(this._sourceCaches[t].hasTransition())return!0;for(const t in this._layers)if(this._layers[t].hasTransition())return!0;return!1}_updateDataDrivenEmissiveStrength(){for(const t in this._mergedLayers){const o=this._mergedLayers[t];if(o._transitionablePaint&&o._transitionablePaint._values){const c=o._transitionablePaint._values["line-emissive-strength"];if(c&&c.value&&c.value.isDataDriven())return void(this._hasDataDrivenEmissive=!0)}}this._hasDataDrivenEmissive=!1}hasDataDrivenEmissiveStrength(){return this._hasDataDrivenEmissive}get order(){return this.terrain?this._drapedFirstOrder:this._mergedOrder}_getOrder(t){return t?this.order:this._mergedOrder}isLayerDraped(t){return!!this.terrain&&t.isDraped(this.getLayerSourceCache(t))}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading")}_checkLayer(t){const o=this.getOwnLayer(t);if(o)return o;this.fire(new h.y(new Error(`The layer '${t}' does not exist in the map's style.`)))}_checkSource(t){const o=this.getOwnSource(t);if(o)return o;this.fire(new h.y(new Error(`The source '${t}' does not exist in the map's style.`)))}handleIdle(){const t=this.map.painter;t&&(t.context.sweepPendingPrograms(),this._programPrecompiler&&this._programPrecompiler.processQueue(t,this))}handleContextLost(){this._programPrecompiler&&this._programPrecompiler.reset()}update(t){if(!this._loaded)return;this.ambientLight&&this.ambientLight.recalculate(t),this.directionalLight&&this.directionalLight.recalculate(t);const o=this.calculateLightsBrightness();t.brightness=o||0,o!==this._brightness&&(this._brightness=o,this.dispatcher.broadcast("setBrightness",o)),t.worldview!==this._worldview&&(this._worldview=t.worldview,this.dispatcher.broadcast("setWorldview",this._worldview));const c=this._changes.isDirty();let d=!1;if(this._changes.isDirty()){const v=this._changes.getLayerUpdatesByScope();for(const T in v){const{updatedIds:I,removedIds:P}=v[T];(I||P)&&(this._updateWorkerLayers(T,I,P),d=!0)}this.updateSourceCaches(),this._updateTilesForChangedImages(),this.updateLayers(t),this.light&&this.light.updateTransitions(t),this.ambientLight&&this.ambientLight.updateTransitions(t),this.directionalLight&&this.directionalLight.updateTransitions(t),this.fog&&this.fog.updateTransitions(t),this.snow&&this.snow.updateTransitions(t),this.rain&&this.rain.updateTransitions(t),this._changes.reset()}const m={};for(const v in this._mergedSourceCaches){const T=this._mergedSourceCaches[v];m[v]=T.used,T.used=!1,T.tileCoverLift=0}const _={};for(const v of this._mergedOrder){const T=this._mergedLayers[v];if((T.visibility!=="none"||T.hasTransition())&&T.recalculate(t,this._availableImages),!T.isHidden(t.zoom)){Tp.has(T.type)&&h.dd();const I=this.getLayerSourceCache(T);I&&(I.used=!0,I.tileCoverLift=Math.max(I.tileCoverLift,T.tileCoverLift()))}if(T.type==="fill-extrusion"){const I=h.t(T.source,T.scope);if(I in this._mergedFillExtrusionSourceCaches){const P=T.layout&&T.layout.get("source-max-zoom");if(P!=null){const A=_[I];_[I]=A==null?P:Math.min(A,P)}}}}if(this._programPrecompiler&&this._programPrecompiler.needsBuild()){const v=this._mergedOrder.map(T=>this._mergedLayers[T]);this._programPrecompiler.buildQueue(v,t,this)}for(const v in this._mergedFillExtrusionSourceCaches)this._mergedFillExtrusionSourceCaches[v].setMaxzoomOverride(_[v]!=null?_[v]:null);this.terrain&&d&&this.mergeLayers();const y=this.imageManager.getPendingImageProviders();for(const v of y)v.sourceCache.used=!0;for(const v in m){const T=this._mergedSourceCaches[v];m[v]!==T.used&&T.getSource().fire(new h.z("data",{sourceDataType:"visibility",dataType:"source",sourceId:T.getSource().id}))}this.light&&this.light.recalculate(t),this.terrain&&this.terrain.recalculate(t),this.fog&&this.fog.recalculate(t),this.snow&&this.snow.recalculate(t),this.rain&&this.rain.recalculate(t),this.z=t.zoom,this._markersNeedUpdate&&(this._updateMarkersOpacity(),this._markersNeedUpdate=!1),this.imageManager.clearUpdatedImages(this.scope),c&&this.fire(new h.z("data",{dataType:"style"}))}updateImageProviders(){const t=this.imageManager.getPendingImageProviders();for(const o of t){const c=o.resolvePendingRequests(),d=this.getFragmentStyle(o.scope);d&&d.addImages(c)}}_updateTilesForChangedImages(){const t={};for(const o in this._mergedSourceCaches){const c=this._mergedSourceCaches[o].getSource().scope;t[c]=t[c]||this._changes.getUpdatedImages(c),t[c].length!==0&&this._mergedSourceCaches[o].reloadTilesForDependencies(["icons","patterns"],t[c])}for(const o in t)this._changes.resetUpdatedImages(o)}_updateWorkerLayers(t,o,c){const d=this.getFragmentStyle(t);d&&this.dispatcher.broadcast("updateLayers",{layers:o?d._serializeLayers(o):[],scope:t,removedIds:c||[],options:d.options})}setState(t,o){if(this._checkLoaded(),kn(this,vo(t)))return!1;(t=h.db(t)).layers=Rr(t.layers);const c=(function(_,y){if(!_)return[{command:Tt.setStyle,args:[y]}];let v=[];try{if(!h.b9(_.version,y.version))return[{command:Tt.setStyle,args:[y]}];if(h.b9(_.center,y.center)||v.push({command:Tt.setCenter,args:[y.center]}),h.b9(_.zoom,y.zoom)||v.push({command:Tt.setZoom,args:[y.zoom]}),h.b9(_.bearing,y.bearing)||v.push({command:Tt.setBearing,args:[y.bearing]}),h.b9(_.pitch,y.pitch)||v.push({command:Tt.setPitch,args:[y.pitch]}),h.b9(_.sprite,y.sprite)||v.push({command:Tt.setSprite,args:[y.sprite]}),h.b9(_.glyphs,y.glyphs)||v.push({command:Tt.setGlyphs,args:[y.glyphs]}),h.b9(_.imports,y.imports)||(function(D=[],O=[],L){O=O||[];const k=(D=D||[]).map(ol),N=O.map(ol),H=D.reduce(ha,{}),Z=O.reduce(ha,{}),G=k.slice();let ne,te,se,J;for(ne=0,te=0;ne<k.length;ne++)se=k[ne],Object.hasOwn(Z,se)?te++:(L.push({command:Tt.removeImport,args:[se]}),G.splice(G.indexOf(se,te),1));for(ne=0,te=0;ne<N.length;ne++)se=N[N.length-1-ne],G[G.length-1-ne]!==se&&(Object.hasOwn(H,se)?(L.push({command:Tt.removeImport,args:[se]}),G.splice(G.lastIndexOf(se,G.length-te),1)):te++,J=G[G.length-ne],L.push({command:Tt.addImport,args:[Z[se],J]}),G.splice(G.length-ne,0,se));for(const K of O){const oe=H[K.id];oe&&(delete oe.data,h.b9(oe,K)||L.push({command:Tt.updateImport,args:[K.id,K]}))}})(_.imports,y.imports,v),h.b9(_.transition,y.transition)||v.push({command:Tt.setTransition,args:[y.transition]}),h.b9(_.light,y.light)||v.push({command:Tt.setLight,args:[y.light]}),h.b9(_.fog,y.fog)||v.push({command:Tt.setFog,args:[y.fog]}),h.b9(_.snow,y.snow)||v.push({command:Tt.setSnow,args:[y.snow]}),h.b9(_.rain,y.rain)||v.push({command:Tt.setRain,args:[y.rain]}),h.b9(_.projection,y.projection)||v.push({command:Tt.setProjection,args:[y.projection]}),h.b9(_.lights,y.lights)||v.push({command:Tt.setLights,args:[y.lights]}),h.b9(_.camera,y.camera)||v.push({command:Tt.setCamera,args:[y.camera]}),h.b9(_.iconsets,y.iconsets)||(function(D,O,L){let k;for(k in O=O||{},D=D||{})Object.hasOwn(D,k)&&(Object.hasOwn(O,k)||L.push({command:Tt.removeIconset,args:[k]}));for(k in O){if(!Object.hasOwn(O,k))continue;const N=O[k];Object.hasOwn(D,k)?h.b9(D[k],N)||(L.push({command:Tt.removeIconset,args:[k]}),L.push({command:Tt.addIconset,args:[k,N]})):L.push({command:Tt.addIconset,args:[k,N]})}})(_.iconsets,y.iconsets,v),!h.b9(_["color-theme"],y["color-theme"]))return[{command:Tt.setStyle,args:[y]}];const T={},I=[];(function(D,O,L,k){let N;for(N in O=O||{},D=D||{})Object.hasOwn(D,N)&&(Object.hasOwn(O,N)||nl(N,L,k));for(N in O){if(!Object.hasOwn(O,N))continue;const H=O[N];Object.hasOwn(D,N)?h.b9(D[N],H)||(D[N].type==="geojson"&&H.type==="geojson"&&lc(D,O,N)?L.push({command:Tt.setGeoJSONSourceData,args:[N,H.data]}):Uh(N,O,L,k)):op(N,O,L)}})(_.sources,y.sources,I,T);const P=[];_.layers&&_.layers.forEach(D=>{D.source&&T[D.source]?v.push({command:Tt.removeLayer,args:[D.id]}):P.push(D)});let A=_.terrain;A&&T[A.source]&&(v.push({command:Tt.setTerrain,args:[void 0]}),A=void 0),v=v.concat(I),h.b9(A,y.terrain)||v.push({command:Tt.setTerrain,args:[y.terrain]}),(function(D,O,L){O=O||[];const k=(D=D||[]).map(ol),N=O.map(ol),H=D.reduce(ha,{}),Z=O.reduce(ha,{}),G=k.slice(),ne=Object.create(null);let te,se,J,K,oe,de,ue;for(te=0,se=0;te<k.length;te++)J=k[te],Object.hasOwn(Z,J)?se++:(L.push({command:Tt.removeLayer,args:[J]}),G.splice(G.indexOf(J,se),1));for(te=0,se=0;te<N.length;te++)J=N[N.length-1-te],G[G.length-1-te]!==J&&(Object.hasOwn(H,J)?(L.push({command:Tt.removeLayer,args:[J]}),G.splice(G.lastIndexOf(J,G.length-se),1)):se++,de=G[G.length-te],L.push({command:Tt.addLayer,args:[Z[J],de]}),G.splice(G.length-te,0,J),ne[J]=!0);for(te=0;te<N.length;te++)if(J=N[te],K=H[J],oe=Z[J],!ne[J]&&!h.b9(K,oe))if(h.b9(K.source,oe.source)&&h.b9(K["source-layer"],oe["source-layer"])&&h.b9(K.type,oe.type)){for(ue in ua(K.layout,oe.layout,L,J,null,Tt.setLayoutProperty),ua(K.paint,oe.paint,L,J,null,Tt.setPaintProperty),h.b9(K.slot,oe.slot)||L.push({command:Tt.setSlot,args:[J,oe.slot]}),h.b9(K.filter,oe.filter)||L.push({command:Tt.setFilter,args:[J,oe.filter]}),h.b9(K.minzoom,oe.minzoom)&&h.b9(K.maxzoom,oe.maxzoom)||L.push({command:Tt.setLayerZoomRange,args:[J,oe.minzoom,oe.maxzoom]}),K)Object.hasOwn(K,ue)&&ue!=="layout"&&ue!=="paint"&&ue!=="filter"&&ue!=="metadata"&&ue!=="minzoom"&&ue!=="maxzoom"&&ue!=="slot"&&(ue.indexOf("paint.")===0?ua(K[ue],oe[ue],L,J,ue.slice(6),Tt.setPaintProperty):h.b9(K[ue],oe[ue])||L.push({command:Tt.setLayerProperty,args:[J,ue,oe[ue]]}));for(ue in oe)Object.hasOwn(oe,ue)&&!Object.hasOwn(K,ue)&&ue!=="layout"&&ue!=="paint"&&ue!=="filter"&&ue!=="metadata"&&ue!=="minzoom"&&ue!=="maxzoom"&&ue!=="slot"&&(ue.indexOf("paint.")===0?ua(K[ue],oe[ue],L,J,ue.slice(6),Tt.setPaintProperty):h.b9(K[ue],oe[ue])||L.push({command:Tt.setLayerProperty,args:[J,ue,oe[ue]]}))}else L.push({command:Tt.removeLayer,args:[J]}),de=G[G.lastIndexOf(J)+1],L.push({command:Tt.addLayer,args:[oe,de]})})(P,y.layers,v)}catch(T){console.warn("Unable to compute style diff:",T),v=[{command:Tt.setStyle,args:[y]}]}return v})(this.serialize(),t).filter(_=>!(_.command in wp));if(c.length===0)return!1;const d=c.filter(_=>!(_.command in Ao));if(d.length>0)throw new Error(`Unimplemented: ${d.map(_=>_.command).join(", ")}.`);const m=[];return c.forEach(_=>{m.push(this[_.command](..._.args))}),o&&Promise.all(m).then(o).catch(o),this.stylesheet=t,this.mergeAll(),this.dispatcher.broadcast("setLayers",{layers:this._serializeLayers(this._order),scope:this.scope,options:this.options}),!0}_updateWorkerImages(){this._availableImages=this.imageManager.listImages(this.scope),this.dispatcher.broadcast("setImages",{scope:this.scope,images:this._availableImages})}_updateWorkerModels(){this._availableModels=this.modelManager.getModelURIs(this.scope),this.dispatcher.broadcast("setModels",{scope:this.scope,models:this._availableModels})}addImages(t){if(t.size===0)return this;for(const[o,c]of t.entries()){if(this.getImage(o))return this.fire(new h.y(new Error(`An image with the name "${o.name}" already exists.`)));this.imageManager.addImage(o,this.scope,c),this._changes.updateImage(o,this.scope)}return this._updateWorkerImages(),this.fire(new h.z("data",{dataType:"style"})),this}addImage(t,o){return this.getImage(t)?this.fire(new h.y(new Error(`An image with the name "${t.name}" already exists.`))):(this.imageManager.addImage(t,this.scope,o),this._changes.updateImage(t,this.scope),this._updateWorkerImages(),this.fire(new h.z("data",{dataType:"style"})),this)}updateImage(t,o,c=!1){this.imageManager.updateImage(t,this.scope,o),c&&(this._changes.updateImage(t,this.scope),this._updateWorkerImages(),this.fire(new h.z("data",{dataType:"style"})))}getImage(t){return this.imageManager.getImage(t,this.scope)}removeImage(t){return this.getImage(t)?(this.imageManager.removeImage(t,this.scope),this._changes.updateImage(t,this.scope),this._updateWorkerImages(),this.fire(new h.z("data",{dataType:"style"})),this):this.fire(new h.y(new Error("No image with this name exists.")))}listImages(){return this._checkLoaded(),this._availableImages.slice()}getActualScope(){return this._importedAsBasemap?"basemap":this.scope}addModelURLs(t){return this.modelManager.addModelURLs(t,this.getActualScope()),this._updateWorkerModels(),this.fire(new h.z("data",{dataType:"style"})),this}addModel(t,o,c={}){return this._checkLoaded(),this._validate(Rh,`models.${t}`,o,null,c)||(this.modelManager.addModel(t,o,this.getActualScope()),this.fire(new h.z("data",{dataType:"style"}))),this}hasModel(t){return this.modelManager.hasModel(t,this.getActualScope())}removeModel(t){return this.hasModel(t)?(this.modelManager.removeModel(t,this.getActualScope(),!1,!0),this.fire(new h.z("data",{dataType:"style"})),this):this.fire(new h.y(new Error("No model with this ID exists.")))}listModels(){return this._checkLoaded(),this.modelManager.listModels(this.getActualScope())}addSource(t,o,c={}){if(this._checkLoaded(),this.getOwnSource(t)!==void 0)throw new Error(`There is already a source with ID "${t}".`);if(!o.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(o).join(", ")}.`);if(["vector","raster","geojson","video","image"].includes(o.type)&&this._validate(un,`sources.${t}`,o,null,c))return;this.map&&this.map._collectResourceTiming&&(o.collectResourceTiming=!0);const d=hu(t,o,this.dispatcher,this);d.scope=this.scope,d.setEventedParent(this,()=>({isSourceLoaded:this._isSourceCacheLoaded(d.id),source:d.serialize(),sourceId:d.id}));const m=_=>{const y=(_===h.b7.Symbol?"symbol:":_===h.b7.FillExtrusion?"fill-extrusion:":"other:")+d.id,v=h.t(y,this.scope),T=this._sourceCaches[y]=new Ut(v,d,_);_===h.b7.Symbol?this._symbolSourceCaches[d.id]=T:_===h.b7.FillExtrusion?this._fillExtrusionSourceCaches[d.id]=T:this._otherSourceCaches[d.id]=T,T.onAdd(this.map)};m(h.b7.Other),o.type!=="vector"&&o.type!=="geojson"||(m(h.b7.Symbol),o.type==="vector"&&m(h.b7.FillExtrusion)),d.onAdd&&d.onAdd(this.map),c.isInitialLoad||(this.mergeSources(),this._changes.setDirty())}removeSource(t){this._checkLoaded();const o=this.getOwnSource(t);if(!o)throw new Error("There is no source with this ID");for(const d in this._layers)if(this._layers[d].source===t)return this.fire(new h.y(new Error(`Source "${t}" cannot be removed while layer "${d}" is using it.`)));if(this.terrain&&this.terrain.scope===this.scope&&this.terrain.get().source===t)return this.fire(new h.y(new Error(`Source "${t}" cannot be removed while terrain is using it.`)));if(this.stylesheet.iconsets){const d=Object.entries(this.stylesheet.iconsets).find(([m,_])=>_.type==="source"&&_.source===t);if(d)return this.fire(new h.y(new Error(`Source "${t}" cannot be removed while iconset "${d[0]}" is using it.`)))}const c=this.getOwnSourceCaches(t);for(const d of c){const m=h.dc(d.id);delete this._sourceCaches[m],this._changes.discardSourceCacheUpdate(d.id),d.fire(new h.z("data",{sourceDataType:"metadata",dataType:"source",sourceId:d.getSource().id})),d.setEventedParent(null),d.clearTiles()}return delete this._otherSourceCaches[t],delete this._symbolSourceCaches[t],delete this._fillExtrusionSourceCaches[t],this.mergeSources(),o.setEventedParent(null),o.onRemove&&o.onRemove(this.map),this._changes.setDirty(),this}setGeoJSONSourceData(t,o){this._checkLoaded(),this.getOwnSource(t).setData(o),this._changes.setDirty()}getOwnSource(t){const o=this.getOwnSourceCache(t);return o&&o.getSource()}getOwnSources(){const t=[];for(const o in this._otherSourceCaches){const c=this.getOwnSourceCache(o);c&&t.push(c.getSource())}return t}areTilesLoaded(){const t=this._mergedSourceCaches;for(const o in t){const c=t[o]._tiles;for(const d in c){const m=c[d];if(m.state!=="loaded"&&m.state!=="errored")return!1}}return!0}setLights(t){if(this._checkLoaded(),this._programPrecompiler&&this._programPrecompiler.reset(),!t)return delete this.ambientLight,void delete this.directionalLight;const o=this._getTransitionParameters();for(const m of t){if(this._validate(Ph,"lights",m))return;switch(m.type){case"ambient":if(this.ambientLight){const _=this.ambientLight;_.set(m),_.updateTransitions(o)}else this.ambientLight=new Ka(m,Qf(),this.scope,this.options);break;case"directional":if(this.directionalLight){const _=this.directionalLight;_.set(m),_.updateTransitions(o)}else this.directionalLight=new Ka(m,cu(),this.scope,this.options)}}const c=Object.assign(o,{worldview:this.map.getWorldview()}),d=new h.ab(this.z||0,c);this.ambientLight&&this.ambientLight.recalculate(d),this.directionalLight&&this.directionalLight.recalculate(d),this._brightness=this.calculateLightsBrightness(),this.dispatcher.broadcast("setBrightness",this._brightness)}calculateLightsBrightness(){const t=this.directionalLight,o=this.ambientLight;if(!t||!o)return;const c=A=>.2126*(A[0]<=.03928?A[0]/12.92:Math.pow((A[0]+.055)/1.055,2.4))+.7152*(A[1]<=.03928?A[1]/12.92:Math.pow((A[1]+.055)/1.055,2.4))+.0722*(A[2]<=.03928?A[2]/12.92:Math.pow((A[2]+.055)/1.055,2.4)),d=t.properties.get("color").toNonPremultipliedRenderColor(null).toArray01(),m=t.properties.get("intensity"),_=t.properties.get("direction"),y=1-h.cT(_.x,_.y,_.z)[2]/90,v=c(d)*m*y,T=o.properties.get("color").toNonPremultipliedRenderColor(null).toArray01(),I=o.properties.get("intensity"),P=c(T)*I;return Number(((v+P)/2).toFixed(6))}getBrightness(){return this._brightness}getLights(){if(!this.enable3dLights())return null;const t=[];return this.directionalLight&&t.push(this.directionalLight.get()),this.ambientLight&&t.push(this.ambientLight.get()),t}enable3dLights(){return!!this.ambientLight&&!!this.directionalLight}getFragmentStyle(t){if(t==null||t===""&&this.isRootStyle())return this;if(h.de(t)){const o=h.df(t),c=this.fragments.find(({id:m})=>m===o);if(!c)return;const d=h.dc(t);return c.style.getFragmentStyle(d)}{const o=this.fragments.find(({id:c})=>c===t);return o?o.style:void 0}}setFeaturesetSelectors(t){if(!t)return;const o=(c,d="")=>`${c}::${d}`;this._featuresetSelectors={};for(const c in t){const d={},m=this._featuresetSelectors[c]=[];for(const _ of t[c].selectors){if(_.featureNamespace){const v=this.getOwnLayer(_.layer);if(!v){h.w(`Layer is undefined for selector: ${_.layer}`);continue}const T=o(v.source,v.sourceLayer);if(T in d&&d[T]!==_.featureNamespace){h.w(`"featureNamespace ${_.featureNamespace} of featureset ${c}'s selector is not associated to the same source, skip this selector`);continue}d[T]=_.featureNamespace}let y;if(_.properties)for(const v in _.properties){const T=h.U(_.properties[v]);T.result==="success"&&(y=y||{},y[v]=T.value)}m.push({layerId:_.layer,namespace:_.featureNamespace,properties:y,uniqueFeatureID:_._uniqueFeatureID})}}}getFeaturesetDescriptors(t){const o=this.getFragmentStyle(t);if(!o||!o.stylesheet.featuresets)return[];const c=[];for(const d in o.stylesheet.featuresets)c.push({featuresetId:d,importId:o.scope?o.scope:void 0});return c}getFeaturesetLayers(t,o){const c=this.getFragmentStyle(o),d=c.stylesheet.featuresets;if(!d||!d[t])return this.fire(new h.y(new Error(`The featureset '${t}' does not exist in the map's style and cannot be queried.`))),[];const m=[];for(const _ of d[t].selectors){const y=c.getOwnLayer(_.layer);y&&m.push(y)}return m}getConfigProperty(t,o){const c=this.getFragmentStyle(t);if(!c)return null;const d=h.t(o,c.scope),m=c.options.get(d),_=m?m.value||m.default:null;return _?_.serialize():null}isIndoorEnabled(){return Object.keys(this._mergedIndoor).length>0}getIndoorSourceLayers(t,o){const c=h.t(t,o);return this._mergedIndoor[c]}setIndoorData(t,o){this.indoorManager.setIndoorData(o)}updateIndoorDependentLayers(){this._updateLayers(this._indoorDependentLayers),this.map._styleDirty=!0,this.map.triggerRepaint()}setConfigProperty(t,o,c){const d=this.getFragmentStyle(t);if(!d)return;const m=d.stylesheet.schema;if(!m||!m[o])return;const _=h.U(c);if(_.result!=="success")return void kn(this,_.value);const y=_.value.expression,v=h.t(o,d.scope),T=d.options.get(v);if(!T)return;let I;const{minValue:P,maxValue:A,stepValue:D,type:O,values:L}=m[o],k=h.U(m[o].default);k.result==="success"&&(I=k.value.expression),I?(this.options.set(v,Object.assign({},T,{value:y,default:I,minValue:P,maxValue:A,stepValue:D,type:O,values:L})),this.updateConfigDependencies(o)):this.fire(new h.y(new Error(`No schema defined for the config option "${o}" in the "${t}" fragment.`)))}getConfig(t){const o=this.getFragmentStyle(t);if(!o)return null;const c=o.stylesheet.schema;if(!c)return null;const d={};for(const m in c){const _=h.t(m,o.scope),y=o.options.get(_),v=y?y.value||y.default:null;d[m]=v?v.serialize():null}return d}setConfig(t,o){const c=this.getFragmentStyle(t);c&&(c.updateConfig(o,c.stylesheet.schema),this.updateConfigDependencies())}getSchema(t){const o=this.getFragmentStyle(t);return o?o.stylesheet.schema:null}setSchema(t,o){const c=this.getFragmentStyle(t);c&&(c.stylesheet.schema=o,c.updateConfig(c._config,o),this.updateConfigDependencies())}updateConfig(t,o){if(this._config=t,t||o)if(o)for(const c in o){let d,m;const _=h.U(o[c].default);if(_.result==="success"&&(d=_.value.expression),t&&t[c]!==void 0){const A=h.U(t[c]);A.result==="success"&&(m=A.value.expression)}const{minValue:y,maxValue:v,stepValue:T,type:I,values:P}=o[c];if(d){const A=h.t(c,this.scope);this.options.set(A,{default:d,value:m,minValue:y,maxValue:v,stepValue:T,type:I,values:P})}else this.fire(new h.y(new Error(`No schema defined for config option "${c}".`)))}else this.fire(new h.y(new Error("Attempting to set config for a style without schema.")))}_updateLayers(t,o=()=>!0){for(const c of t){const d=this.getLayer(c);d&&o(d)&&(d.possiblyEvaluateVisibility(),this._updateLayer(d),this._changes.setDirty())}}updateConfigDependencies(t){this._updateLayers(this._configDependentLayers,o=>!t||o.expressionDependencies.configDependencies.has(t)),this.ambientLight&&this.ambientLight.updateConfig(this.options),this.directionalLight&&this.directionalLight.updateConfig(this.options),this.fog&&this.fog.updateConfig(this.options),this.snow&&this.snow.updateConfig(this.options),this.rain&&this.rain.updateConfig(this.options),this.forEachFragmentStyle(o=>{const c=o._styleColorTheme.colorThemeOverride?o._styleColorTheme.colorThemeOverride:o._styleColorTheme.colorTheme;if(c){const d=o._evaluateColorThemeData(c);(!o._styleColorTheme.lut&&d!==""||o._styleColorTheme.lut&&d!==o._styleColorTheme.lut.data)&&o.setColorTheme(c)}}),this._changes.setDirty()}addLayer(t,o,c={}){this._checkLoaded();const d=t.id;if(this._layers[d])return void this.fire(new h.y(new Error(`Layer with i
8d "${d}" already exists on this map`)));let m;if(t.type==="custom"){if(kn(this,h.dg(t)))return;m=h.dh(t,this.scope,this._styleColorTheme.lut,this.options)}else{if(typeof t.source=="object"&&(this.addSource(d,t.source),t=h.db(t),t=Object.assign(t,{source:d})),this._validate(Xo,`layers.${d}`,t,{arrayIndex:-1},c))return;m=h.dh(t,this.scope,this._styleColorTheme.lut,this.options),this._validateLayer(m),m.setEventedParent(this,{layer:{id:d}})}const _=h.t(m.source,m.scope);m.expressionDependencies.configDependencies.size!==0&&this._configDependentLayers.add(_),m.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(_);let y=this._order.length;if(o){const P=this._order.indexOf(o);if(P===-1)return void this.fire(new h.y(new Error(`Layer with id "${o}" does not exist on this map.`)));m.slot&&m.slot!==this._layers[o].slot?h.w(`Layer with id "${o}" has a different slot. Layers can only be rearranged within the same slot.`):y=P}this._order.splice(y,0,d),this._handleLayerOrderChange(),this._layers[d]=m;const v=this.getOwnLayerSourceCache(m),T=!!this.directionalLight&&this.directionalLight.shadowsEnabled();v&&m.canCastShadows()&&T&&(v.castsShadows=!0);const I=this._changes.getRemovedLayer(m);if(I&&m.source&&v&&m.type!=="custom"){this._changes.discardLayerRemoval(m);const P=h.t(m.source,m.scope);I.type!==m.type?this._changes.updateSourceCache(P,"clear"):(this._changes.updateSourceCache(P,"reload"),v.pause())}this._updateLayer(m),m.onAdd&&m.onAdd(this.map),m.scope=this.scope,this.mergeLayers()}moveLayer(t,o){this._checkLoaded();const c=this._checkLayer(t);if(!c||t===o)return;const d=this._order.indexOf(t);this._order.splice(d,1);let m=this._order.length;if(o){const _=this._order.indexOf(o);
vendor: 25,776 bytes, line 8
8if(_===-1)return void this.fire(new h.y(new Error(`Layer with id "${o}" does not exist on this map.`)));c.slot&&c.slot!==this._layers[o].slot?h.w(`Layer with id "${o}" has a different slot. Layers can only be rearranged within the same slot.`):m=_}this._order.splice(m,0,t),this._changes.setDirty(),this._handleLayerOrderChange(),this.mergeLayers()}removeLayer(t){this._checkLoaded();const o=this._checkLayer(t);if(!o)return;o.setEventedParent(null);const c=this._order.indexOf(t);this._order.splice(c,1),delete this._layers[t],this._changes.setDirty(),this._handleLayerOrderChange(),this._configDependentLayers.delete(o.fqid),this._indoorDependentLayers.delete(o.fqid),this._changes.removeLayer(o);const d=this.getOwnLayerSourceCache(o);if(d&&d.castsShadows){let m=!1;for(const _ in this._layers)if(this._layers[_].source===o.source&&this._layers[_].canCastShadows()){m=!0;break}d.castsShadows=m}o.onRemove&&o.onRemove(this.map),this.mergeLayers()}getOwnLayer(t){return this._layers[t]}hasLayer(t){return t in this._mergedLayers}hasLayerType(t){for(const o in this._layers)if(this._layers[o].type===t)return!0;return!1}setLayerZoomRange(t,o,c){this._checkLoaded();const d=this._checkLayer(t);d&&(d.minzoom===o&&d.maxzoom===c||(o!=null&&(d.minzoom=o),c!=null&&(d.maxzoom=c),this._updateLayer(d)))}getSlots(){return this._checkLoaded(),this._mergedSlots}setSlot(t,o){this._checkLoaded();const c=this._checkLayer(t);c&&c.slot!==o&&(c.slot=o,this._updateLayer(c))}setFilter(t,o,c={}){this._checkLoaded();const d=this._checkLayer(t);if(d&&!h.b9(d.filter,o))return o==null?(d.filter=void 0,void this._updateLayer(d)):void(this._validate(rc,`layers.${d.id}.filter`,o,{layerType:d.type},c)||(d.filter=h.db(o),this._updateLayer(d)))}getFilter(t){const o=this._checkLayer(t);if(o)return h.db(o.filter)}setLayoutProperty(t,o,c,d={}){this._checkLoaded();const m=this._checkLayer(t);if(m&&!h.b9(m.getLayoutProperty(o),c)){if(c!=null&&(!d||d.validate!==!1)&&kn(m,Dh.call(vo,{key:`layers.${t}.layout.${o}`,layerType:m.type,objectKey:o,value:c,styleSpec:h.a6,style:{glyphs:!0,sprite:!0}})))return;m.setLayoutProperty(o,c),m.expressionDependencies.configDependencies.size!==0&&this._configDependentLayers.add(m.fqid),m.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(m.fqid),this._updateLayer(m)}}setLayerProperty(t,o,c,d={}){this._checkLoaded();const m=this._checkLayer(t);m&&(o==="appearances"?(m.setAppearances(c),this._updateLayer(m)):m.isPaintProperty(o)?this.setPaintProperty(t,o,c,d):this.setLayoutProperty(t,o,c,d))}getLayoutProperty(t,o){const c=this._checkLayer(t);if(c)return c.getLayoutProperty(o)}setPaintProperty(t,o,c,d={}){this._checkLoaded();const m=this._checkLayer(t);if(!m||h.b9(m.getPaintProperty(o),c)||c!=null&&(!d||d.validate!==!1)&&kn(m,ou.call(vo,{key:`layers.${t}.paint.${o}`,layerType:m.type,objectKey:o,value:c,styleSpec:h.a6})))return;const _=m.setPaintProperty(o,c);m.expressionDependencies.configDependencies.size!==0&&this._configDependentLayers.add(m.fqid),m.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(m.fqid),_&&this._updateLayer(m),this._changes.updatePaintProperties(m)}getPaintProperty(t,o){const c=this._checkLayer(t);if(c)return c.getPaintProperty(o)}setFeatureState(t,o){if(this._checkLoaded(),"target"in t){if("featuresetId"in t.target){const{featuresetId:v,importId:T}=t.target,I=this.getFragmentStyle(T),P=I.getFeaturesetLayers(v);for(const{source:A,sourceLayer:D}of P)I.setFeatureState({id:t.id,source:A,sourceLayer:D},o)}else if("layerId"in t.target){const{layerId:v}=t.target,T=this.getLayer(v);this.setFeatureState({id:t.id,source:T.source,sourceLayer:T.sourceLayer},o)}return}const c=t.source,d=t.sourceLayer,m=this._checkSource(c);if(!m)return;const _=m.type;if(_==="geojson"&&d)return void this.fire(new h.y(new Error("GeoJSON sources cannot have a sourceLayer parameter.")));if(_==="vector"&&!d)return void this.fire(new h.y(new Error("The sourceLayer parameter must be provided for vector source types.")));t.id===void 0&&this.fire(new h.y(new Error("The feature id parameter must be provided.")));const y=this.getOwnSourceCaches(c);for(const v of y)v.setFeatureState(d,t.id,o)}removeFeatureState(t,o){if(this._checkLoaded(),"target"in t){if("featuresetId"in t.target){const{featuresetId:v,importId:T}=t.target,I=this.getFragmentStyle(T),P=I.getFeaturesetLayers(v);for(const{source:A,sourceLayer:D}of P)I.removeFeatureState({id:t.id,source:A,sourceLayer:D},o)}else if("layerId"in t.target){const{layerId:v}=t.target,T=this.getLayer(v);this.removeFeatureState({id:t.id,source:T.source,sourceLayer:T.sourceLayer},o)}return}const c=t.source,d=this._checkSource(c);if(!d)return;const m=d.type,_=m==="vector"?t.sourceLayer:void 0;if(m==="vector"&&!_)return void this.fire(new h.y(new Error("The sourceLayer parameter must be provided for vector source types.")));if(o&&typeof t.id!="string"&&typeof t.id!="number")return void this.fire(new h.y(new Error("A feature id is required to remove its specific state property.")));const y=this.getOwnSourceCaches(c);for(const v of y)v.removeFeatureState(_,t.id,o)}getFeatureState(t){if(this._checkLoaded(),"target"in t){let m;if("featuresetId"in t.target){const{featuresetId:_,importId:y}=t.target,v=this.getFragmentStyle(y),T=v.getFeaturesetLayers(_);for(const{source:I,sourceLayer:P}of T){const A=v.getFeatureState({id:t.id,source:I,sourceLayer:P});if(A&&!m)m=A;else if(!h.b9(m,A))return void this.fire(new h.y(new Error("The same feature id exists in multiple sources in the featureset, but their feature states are not consistent through the sources.")))}}else if("layerId"in t.target){const{layerId:_}=t.target,y=this.getLayer(_);m=this.getFeatureState({id:t.id,source:y.source,sourceLayer:y.sourceLayer})}return m}const o=t.source,c=t.sourceLayer,d=this._checkSource(o);if(d){if(d.type!=="vector"||c)return t.id===void 0&&this.fire(new h.y(new Error("The feature id parameter must be provided."))),this.getOwnSourceCaches(o)[0].getFeatureState(c,t.id);this.fire(new h.y(new Error("The sourceLayer parameter must be provided for vector source types.")))}}setTransition(t){return this.stylesheet.transition=Object.assign({},this.stylesheet.transition,t),this.transition=this.stylesheet.transition,this}getTransition(){return Object.assign({},this.stylesheet.transition)}setWorldview(t){t!==this._worldview&&(this._worldview=t,this.dispatcher.broadcast("setWorldview",this._worldview),this.reloadSources())}serialize(){this._checkLoaded();const t=this.getTerrain(),o=t&&this.terrain&&this.terrain.scope===this.scope?t:this.stylesheet.terrain;return h.di({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,fragment:this.stylesheet.fragment,iconsets:this.stylesheet.iconsets,featuresets:this.stylesheet.featuresets,imports:this._serializeImports(),schema:this.stylesheet.schema,camera:this.stylesheet.camera,light:this.stylesheet.light,lights:this.stylesheet.lights,terrain:o,fog:this.stylesheet.fog,snow:this.stylesheet.snow,rain:this.stylesheet.rain,indoor:this.stylesheet.indoor,center:this.stylesheet.center,"color-theme":this.stylesheet["color-theme"],zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,projection:this.stylesheet.projection,sources:this._serializeSources(),layers:this._serializeLayers(this._order)},c=>c!==void 0)}_updateFilteredLayers(t){for(const o of Object.values(this._mergedLayers))t(o)&&this._updateLayer(o)}_updateLayer(t){this._changes.updateLayer(t);const o=this.getLayerSourceCache(t),c=h.t(t.source,t.scope),d=this._changes.getUpdatedSourceCaches();t.source&&!d[c]&&o&&o.getSource().type!=="raster"&&(this._changes.updateSourceCache(c,"reload"),o.pause()),t.invalidateCompiledFilter()}_flattenAndSortRenderedFeatures(t){const o=y=>this._mergedLayers[y].is3D(!!this.terrain),c=this.order,d={},m=[];for(let y=c.length-1;y>=0;y--){const v=c[y];if(o(v)){d[v]=y;for(const T of t){const I=T[v];if(I)for(const P of I)m.push(P)}}}m.sort((y,v)=>v.intersectionZ-y.intersectionZ);const _=[];for(let y=c.length-1;y>=0;y--){const v=c[y];if(o(v))for(let T=m.length-1;T>=0;T--){const I=m[T].feature;if(I.layer&&d[I.layer.id]<y)break;_.push(I),m.pop()}else for(const T of t){const I=T[v];if(I)for(const P of I)_.push(P.feature)}}return _}queryRasterValue(t,o,c){const d=this.getOwnSource(t);return d?d.type!=="raster-array"?(this.fire(new h.y(new Error('queryRasterValue support only "raster-array" sources.'))),Promise.resolve(null)):d.queryRasterArrayValue(o,c):(this.fire(new h.y(new Error(`Source with id "${t}" does not exist in the style.`))),Promise.resolve(null))}queryRenderedFeatures(t,o,c){let d;o&&!Array.isArray(o)&&o.filter&&(this._validate(rc,"queryRenderedFeatures.filter",o.filter,null,o),d=h.dj(o.filter));const m={},_=I=>{if(bc.has(I.type))return;const P=this.getOwnLayerSourceCache(I),A=m[P.id]=m[P.id]||{sourceCache:P,layers:{},has3DLayers:!1};I.is3D(!!this.terrain)&&(A.has3DLayers=!0),A.layers[I.fqid]=A.layers[I.fqid]||{styleLayer:I,targets:[]},A.layers[I.fqid].targets.push({filter:d})};if(o&&o.layers){if(!Array.isArray(o.layers))return this.fire(new h.y(new Error("parameters.layers must be an Array."))),[];for(const I of o.layers){const P=this._layers[I];if(!P)return this.fire(new h.y(new Error(`The layer '${I}' does not exist in the map's style and cannot be queried for features.`))),[];_(P)}}else for(const I in this._layers)_(this._layers[I]);const y=this._queryRenderedFeatures(t,m,c),v=this._flattenAndSortRenderedFeatures(y),T=[];for(const I of v)h.dk(I.layer.id)===this.scope&&T.push(I);return T}queryRenderedFeatureset(t,o,c){let d;o&&!Array.isArray(o)&&o.filter&&(this._validate(rc,"queryRenderedFeatures.filter",o.filter,null,o),d=h.dj(o.filter));const m="mock",_=[];if(o&&o.target)_.push(Object.assign({},o,{targetId:m,filter:d}));else{const I=this.getFeaturesetDescriptors();for(const P of I)_.push({targetId:m,filter:d,target:P});for(const{style:P}of this.fragments){const A=P.getFeaturesetDescriptors();for(const D of A)_.push({targetId:m,filter:d,target:D})}}const y=this.queryRenderedTargets(t,_,c),v=[],T=new Set;for(const I of y)for(const P of I.variants[m])rp(P,I,T)||v.push(new h.dl(I,P));return v}queryRenderedTargets(t,o,c){const d={},m=(y,v,T,I)=>{const P=d[v.id]=d[v.id]||{sourceCache:v,layers:{},has3DLayers:!1};if(P.layers[y.fqid]=P.layers[y.fqid]||{styleLayer:y,targets:[]},y.is3D(!!this.terrain)&&(P.has3DLayers=!0),!I)return T.uniqueFeatureID=!1,void P.layers[y.fqid].targets.push(T);P.layers[y.fqid].targets.push(Object.assign({},T,{namespace:I.namespace,properties:I.properties,uniqueFeatureID:I.uniqueFeatureID}))};for(const y of o)if("featuresetId"in y.target){const{featuresetId:v,importId:T}=y.target,I=this.getFragmentStyle(T);if(!I||!I._featuresetSelectors)continue;const P=I._featuresetSelectors[v];if(!P){this.fire(new h.y(new Error(`The featureset '${v}' does not exist in the map's style and cannot be queried for features.`)));continue}for(const A of P){const D=I.getOwnLayer(A.layerId);D&&!bc.has(D.type)&&m(D,I.getOwnLayerSourceCache(D),y,A)}}else if("layerId"in y.target){const{layerId:v}=y.target,T=this.getLayer(v);if(!T||bc.has(T.type))continue;m(T,this.getLayerSourceCache(T),y)}const _=this._queryRenderedFeatures(t,d,c);return this._flattenAndSortRenderedFeatures(_)}_queryRenderedFeatures(t,o,c){const d=[],m=!!this.map._showQueryGeometry,_=io.createFromScreenPoints(t,c);for(const y in o){const v=np(_,o[y],this._availableImages,c,m,this.getActualScope());Object.keys(v).length&&d.push(v)}if(this.placement)for(const y in o){if(o[y].sourceCache._renderSourceType!==h.b7.Symbol)continue;const v=du(_.screenGeometry,o[y],this._availableImages,this.placement.collisionIndex,this.placement.retainedQueryData,this.map.getWorldview());Object.keys(v).length&&d.push(v)}return d}querySourceFeatures(t,o){const c=o&&o.filter;c&&this._validate(rc,"querySourceFeatures.filter",c,null,o);let d=[];const m=this.getOwnSourceCaches(t);for(const _ of m)d=d.concat(ro(_,o));return d}addSourceType(t,o,c){return dn.getSourceType(t)?c(new Error(`A source type called "${t}" already exists.`)):(dn.setSourceType(t,o),c(null,null))}getFlatLight(){return this.light.getLight()}setFlatLight(t,o,c={}){this._checkLoaded();const d=this.light.getLight();let m=!1;for(const y in t)if(!h.b9(t[y],d[y])){m=!0;break}if(!m)return;const _=this._getTransitionParameters();this.light.setLight(t,o,c),this.light.updateTransitions(_)}getTerrain(){return this.terrain&&this.terrain.drapeRenderMode===1?this.terrain.get():null}setTerrainForDraping(){this.setTerrain({source:"",exaggeration:0},0)}checkCanvasFingerprintNoise(){this.disableElevatedTerrain===void 0&&(this.disableElevatedTerrain=h.o.hasCanvasFingerprintNoise(),this.disableElevatedTerrain&&h.w("Terrain and hillshade are disabled because of Canvas2D limitations when fingerprinting protection is enabled (e.g. in private browsing mode)."))}setTerrain(t,o=1){if(this._checkLoaded(),!t)return this.terrainSetForDrapingOnly()||(delete this.terrain,this.map.transform.projection.requiresDraping&&this.setTerrainForDraping()),o===0&&delete this.terrain,t===null?this.stylesheet.terrain=null:delete this.stylesheet.terrain,this._force3DLayerUpdate(),void(this._markersNeedUpdate=!0);this.checkCanvasFingerprintNoise();let c=t;const d=!("source"in t)||t.source==null;if(o===1){if(this.disableElevatedTerrain)return;if("source"in c&&typeof c.source=="object"){const y="terrain-dem-src";this.addSource(y,c.source),c=h.db(c),c=Object.assign(c,{source:y})}const m=Object.assign({},c),_={};if(this.terrain&&d){m.source=this.terrain.get().source;const y=this.terrain?this.getFragmentStyle(this.terrain.scope):null;y&&(_.style=y.serialize())}if(this._validate(Wf,"terrain",m,_))return}if(!this.terrain||this.terrain.scope!==this.scope&&!d||this.terrain&&o!==this.terrain.drapeRenderMode){if(!c)return;this._createTerrain(c,o),this.fire(new h.z("data",{dataType:"style"}))}else{const m=this.terrain,_=m.get();for(const y of Object.keys(h.a6.terrain))!Object.hasOwn(c,y)&&h.a6.terrain[y].default&&(c[y]=h.a6.terrain[y].default);for(const y in t)if(!h.b9(t[y],_[y])){m.set(t,this.options),this.stylesheet.terrain=t;const v=this._getTransitionParameters({duration:0});m.updateTransitions(v),this.fire(new h.z("data",{dataType:"style"}));break}}this.mergeTerrain(),this.updateDrapeFirstLayers(),this._markersNeedUpdate=!0}_createFog(t){const o=this.fog=new oc(t,this.map.transform,this.scope,this.options);this.stylesheet.fog=o.get();const c=this._getTransitionParameters({duration:0});o.updateTransitions(c)}_createSnow(t){const o=this.snow=new O_(t,this.map.transform,this.scope,this.options);this.stylesheet.snow=o.get();const c=this._getTransitionParameters({duration:0});o.updateTransitions(c)}_createRain(t){const o=this.rain=new au(t,this.map.transform,this.scope,this.options);this.stylesheet.rain=o.get();const c=this._getTransitionParameters({duration:0});o.updateTransitions(c)}_updateMarkersOpacity(){this.map._markers.length!==0&&this.map._requestDomTask(()=>{for(const t of this.map._markers)t._evaluateOpacity()})}getFog(){return this.fog?this.fog.get():null}setFog(t){if(this._checkLoaded(),t)if(this.fog){const o=this.fog;if(!h.b9(o.get(),t)){o.set(t,this.options),this.stylesheet.fog=o.get();const c=this._getTransitionParameters({duration:0});o.updateTransitions(c)}}else this._createFog(t);else delete this.fog,delete this.stylesheet.fog;this._markersNeedUpdate=!0,this._programPrecompiler&&this._programPrecompiler.reset()}getSnow(){return this.snow?this.snow.get():null}setSnow(t){if(this._checkLoaded(),!t)return delete this.snow,void delete this.stylesheet.snow;if(this.snow){const o=this.snow;if(!h.b9(o.get(),t)){o.set(t,this.options),this.stylesheet.snow=o.get();const c=this._getTransitionParameters({duration:0});o.updateTransitions(c)}}else this._createSnow(t);this._markersNeedUpdate=!0}getRain(){return this.rain?this.rain.get():null}setRain(t){if(this._checkLoaded(),!t)return delete this.rain,void delete this.stylesheet.rain;if(this.rain){const o=this.rain;if(!h.b9(o.get(),t)){o.set(t,this.options),this.stylesheet.rain=o.get();const c=this._getTransitionParameters({duration:0});o.updateTransitions(c)}}else this._createRain(t);this._markersNeedUpdate=!0}_reloadColorTheme(){const t=()=>{for(const d in this._layers)this._layers[d].lut=this._styleColorTheme.lut;for(const d in this._sourceCaches)this._sourceCaches[d].clearTiles()},o=this._styleColorTheme.colorThemeOverride?this._styleColorTheme.colorThemeOverride:this._styleColorTheme.colorTheme;if(!o)return this._styleColorTheme.lut=null,void t();const c=this._evaluateColorThemeData(o);this._loadColorTheme(c).then(()=>{this.fire(new h.z("colorthemeset")),t()}).catch(d=>{h.w(`Couldn't set color theme: ${d}`)})}setColorTheme(t){this._checkLoaded(),this._styleColorTheme.colorThemeOverride&&h.w("Note: setColorTheme is called on a style with a color-theme override, the passed color-theme won't be visible."),this._styleColorTheme.colorTheme=t,this._reloadColorTheme()}setImportColorTheme(t,o){const c=this.getFragmentStyle(t);c&&(c._styleColorTheme.colorThemeOverride=o,c._reloadColorTheme())}_getTransitionParameters(t){return{now:h.o.now(),transition:Object.assign(this.transition,t)}}updateDrapeFirstLayers(){if(!this.terrain)return;const t=[],o=[];for(const c of this._mergedOrder)this.isLayerDraped(this._mergedLayers[c])?t.push(c):o.push(c);this._drapedFirstOrder=[],this._drapedFirstOrder.push(...t),this._drapedFirstOrder.push(...o)}_createTerrain(t,o){const c=this.terrain=new ca(t,o,this.scope,this.options,this.map.getWorldview());o===1&&(this.stylesheet.terrain=t),this.mergeTerrain(),this.updateDrapeFirstLayers(),this._force3DLayerUpdate();const d=this._getTransitionParameters({duration:0});c.updateTransitions(d)}_force3DLayerUpdate(){for(const t in this._layers){const o=this._layers[t];o.type==="fill-extrusion"&&this._updateLayer(o)}}_forceSymbolLayerUpdate(){for(const t in this._layers){const o=this._layers[t];o.type==="symbol"&&this._updateLayer(o)}}_validate(t,o,c,d,m={}){if(m&&m.validate===!1)return!1;const _=Object.assign({},this.serialize());return kn(this,t.call(vo,Object.assign({key:o,style:_,value:c,styleSpec:h.a6},d)))}_remove(){this._programPrecompiler&&(this._programPrecompiler.reset(),this._programPrecompiler=null),this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),h.dm.off("pluginStateChange",this._rtlTextPluginCallback);for(const t in this._mergedLayers)this._mergedLayers[t].setEventedParent(null);for(const t in this._mergedSourceCaches){const o=this._mergedSourceCaches[t];o.clearTiles(),o.setEventedParent(null);const c=o.getSource();c&&c.onRemove&&c.onRemove(this.map)}this.imageManager.removeScope(this.scope),this.imageManager.imageAtlasCache.clear(),this.setEventedParent(null),delete this.fog,delete this.snow,delete this.rain,delete this.terrain,delete this.ambientLight,delete this.directionalLight,this.indoorManager.destroy(),this.isRootStyle()&&(this.imageManager.setEventedParent(null),this.modelManager.setEventedParent(null),this.modelManager.destroy(),this.dispatcher.remove())}clearSource(t){const o=this.getSourceCaches(t);for(const c of o)c.clearTiles()}clearSources(){for(const t in this._mergedSourceCaches)this._mergedSourceCaches[t].clearTiles()}clearLayers(){for(const t in this._mergedLayers){const o=this._mergedLayers[t];o._clear&&o._clear()}}reloadSource(t){const o=this.getSourceCaches(t);for(const c of o)c.resume(),c.reload()}reloadSources(){for(const t of this.getSources())t.reload&&t.reload()}reloadModels(){this.modelManager.reloadModels(""),this.forEachFragmentStyle(t=>{t.modelManager.reloadModels(t.scope)})}updateSources(t){let o;this.directionalLight&&(o=vu(this.directionalLight));const c=new Set,d=new Set,m=new Set;for(const _ in this._mergedLayers){const y=this._mergedLayers[_];y.type==="building"?c.add(y.source):y.type==="raster"&&y.paint&&y.paint.get("raster-elevation-reference")==="ground"&&m.add(y.source),y.hasElevation()&&!d.has(y.source)&&d.add(y.source)}for(const _ in this._mergedSourceCaches){const y=this._mergedSourceCaches[_],v=d.has(y._source.id);y._isRasterElevatedOverTerrain=m.has(y._source.id),c.has(y._source.id)&&(y._source.reparseOverscaled=!1),y.update(t,void 0,void 0,o,v)}}_reloadSources(){for(const t in this._sourceCaches){const o=this._sourceCaches[t];o.resume(),o.reload()}}_handleLayerOrderChange(){this._requestFullLabelPlacement(),this.fire(new h.z("neworder"))}_requestFullLabelPlacement(){this.pauseablePlacement||(this.pauseablePlacement=new dp),this.pauseablePlacement.requestFullPlacement()}_setLabelPlacementStale(){this.placement&&this.placement.setStale()}_updatePlacement(t,o,c,d,m){this.pauseablePlacement||(this.pauseablePlacement=new dp);let _=!1,y=!1;const v={},T={};for(const L of this._mergedOrder){const k=this._mergedLayers[L];if(k.type!=="symbol")continue;const N=h.t(k.source,k.scope);let H=v[N];if(!H){const G=this.getLayerSourceCache(k);if(!G)continue;const ne=G.getRenderableIds(!0).map(te=>G.getTileByID(te));T[N]=ne.slice(),H=v[N]=ne.sort((te,se)=>se.tileID.overscaledZ-te.tileID.overscaledZ||(te.tileID.isLessThan(se.tileID)?-1:1))}const Z=this.crossTileSymbolIndex.addLayer(k,H,t.center.lng,t.projection);_=_||Z}this.crossTileSymbolIndex.pruneUnusedLayers(this._mergedOrder);const I=!!(this.placement&&!t.equals(this.placement.transform)),P=!!(this.placement&&(this.placement.lastReplacementSourceUpdateTime!==0&&!m||this.placement.lastReplacementSourceUpdateTime!==m.updateTime)),A=I||P||_,D=(A||this.pauseablePlacement.isStale())&&c===0,O=this.pauseablePlacement.isDone()&&!this.placement.stillRecent(h.o.now(),t.zoom)&&c!==0;if((this.pauseablePlacement.isFullPlacementRequested()||!this.pauseablePlacement.placement||D||O)&&(this.pauseablePlacement=this.pauseablePlacement.startNewPlacement(t,this._mergedOrder,o,c,d,this.placement,this.fog&&t.projection.supportsFog?this.fog.state:null,this._buildingIndex),this.map.painter)){const L=this.map.painter.maxFrontCutoffRawStart;if(L>0){const k=180*t.pitch/Math.PI;if(k>=15){const N=Math.min(1,Math.max(0,(k-15)/5)),H=N*N*(3-2*N);this.pauseablePlacement.placement.frontCutoffStart=-.5*(1-H)+L*H}}}if(this.pauseablePlacement.isDone()?A&&c!==0&&this.pauseablePlacement.setStale():(this.pauseablePlacement.continuePlacement(this._mergedOrder,this._mergedLayers,v,T,this.map.painter.scaleFactor),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(h.o.now()),y=!0),_&&this.pauseablePlacement.setStale()),y||_){this._buildingIndex.onNewFrame(t.zoom);for(let L=0;L<this._mergedOrder.length;L++){const k=this._mergedLayers[this._mergedOrder[L]];if(k.type!=="symbol"||k.visibility==="none")continue;const N=this.isLayerClipped(k);this.placement.updateLayerOpacities(k,v[h.t(k.source,k.scope)],L,N?m:null)}}return!this.pauseablePlacement.isDone()||this.placement.isStale()||this.placement.hasTransitions(h.o.now())}_releaseSymbolFadeTiles(){for(const t in this._sourceCaches)this._sourceCaches[t].releaseSymbolFadeTiles()}addImport(t,o){this._checkLoaded();const c=this.stylesheet.imports=this.stylesheet.imports||[];if(c.findIndex(({id:m})=>m===t.id)!==-1)return void this.fire(new h.y(new Error(`Import with id '${t.id}' already exists in the map's style.`)));if(!o)return c.push(t),this._loadImports([t],!0);const d=c.findIndex(({id:m})=>m===o);return d===-1&&this.fire(new h.y(new Error(`Import with id "${o}" does not exist on this map.`))),this.stylesheet.imports=c.slice(0,d).concat(t).concat(c.slice(d)),this._loadImports([t],!0,o)}updateImport(t,o){this._checkLoaded();const c=this.stylesheet.imports||[],d=this.getImportIndex(t);return d===-1?this:typeof o=="string"?(this.setImportUrl(t,o),this):(o.url&&o.url!==c[d].url&&this.setImportUrl(t,o.url),h.b9(o.config,c[d].config)||this.setImportConfig(t,o.config,o.data.schema),h.b9(o.data,c[d].data)||this.setImportData(t,o.data),this)}moveImport(t,o){this._checkLoaded();let c=this.stylesheet.imports||[];const d=this.getImportIndex(t);if(d===-1)return this;const m=this.getImportIndex(o);if(m===-1)return this;const _=c[d],y=this.fragments[d];return c=c.filter(({id:v})=>v!==t),this.fragments=this.fragments.filter(({id:v})=>v!==t),this.stylesheet.imports=c.slice(0,m).concat(_).concat(c.slice(m)),this.fragments=this.fragments.slice(0,m).concat(y).concat(this.fragments.slice(m)),this.mergeLayers(),this}setImportUrl(t,o){this._checkLoaded();const c=this.stylesheet.imports||[],d=this.getImportIndex(t);if(d===-1)return this;c[d].url=o;const m=this.fragments[d];return m.style=this._createFragmentStyle(c[d]),m.style.on("style.import.load",()=>this.mergeAll()),m.style.loadURL(o),this}setImportData(t,o){this._checkLoaded();const c=this.getImportIndex(t),d=this.stylesheet.imports||[];return c===-1?this:o?(this.fragments[c].style.setState(o),this._reloadImports(),this):(delete d[c].data,this.setImportUrl(t,d[c].url))}setImportConfig(t,o,c){this._checkLoaded();const d=this.getImportIndex(t),m=this.stylesheet.imports||[];if(d===-1)return this;o?m[d].config=o:delete m[d].config;const _=this.fragments[d];c&&_.style.stylesheet&&(_.style.stylesheet.schema=c);const y=_.style.stylesheet&&_.style.stylesheet.schema;return _.config=o,_.style.updateConfig(o,y),this.updateConfigDependencies(),this}removeImport(t){this._checkLoaded();const o=this.stylesheet.imports||[],c=this.getImportIndex(t);c!==-1&&(o.splice(c,1),this.fragments[c].style._remove(),this.fragments.splice(c,1),this._reloadImports())}getImportIndex(t){const o=(this.stylesheet.imports||[]).findIndex(c=>c.id===t);return o===-1&&this.fire(new h.y(new Error(`Import '${t}' does not exist in the map's style and cannot be updated.`))),o}
8getLayer(t){return this._mergedLayers[t]}getSources(){const t=[];for(const o in this._mergedOtherSourceCaches){const c=this._mergedOtherSourceCaches[o];c&&t.push(c.getSource())}return t}getSource(t,o){const c=this.getSourceCache(t,o);return c&&c.getSource()}getLayerSource(t){const o=this.getLayerSourceCache(t);return o&&o.getSource()}getSourceCache(t,o){const c=h.t(t,o);return this._mergedOtherSourceCaches[c]}getLayerSourceCache(t){const o=h.t(t.source,t.scope);return t.type==="symbol"?this._mergedSymbolSourceCaches[o]:t.type==="fill-extrusion"&&this._mergedFillExtrusionSourceCaches[o]||this._mergedOtherSourceCaches[o]}getSourceCaches(t){if(t==null)return Object.values(this._mergedSourceCaches);const o=[];return this._mergedOtherSourceCaches[t]&&o.push(this._mergedOtherSourceCaches[t]),this._mergedSymbolSourceCaches[t]&&o.push(this._mergedSymbolSourceCaches[t]),this._mergedFillExtrusionSourceCaches[t]&&o.push(this._mergedFillExtrusionSourceCaches[t]),o}updateSourceCaches(){const t=this._changes.getUpdatedSourceCaches();for(const o in t){const c=t[o];c==="reload"?this.reloadSource(o):c==="clear"&&this.clearSource(o)}}updateLayers(t){const o=this._changes.getUpdatedPaintProperties();for(const c of o){const d=this.getLayer(c);d&&d.updateTransitions(t)}}getGlyphsUrl(){return this.stylesheet.glyphs}setGlyphsUrl(t){this.stylesheet.glyphs=t,this.glyphManager.setURL(t)}getImages(t,o,c){this.imageManager.getImages(o.icons.concat(o.patterns),o.scope,c),this._updateTilesForChangedImages();const d=o.icons.map(v=>h.I.toString(v)),m=o.patterns.map(v=>h.I.toString(v)),_=v=>{v&&(v.setDependencies(o.tileID.key,"icons",d),v.setDependencies(o.tileID.key,"patterns",m))},y=h.t(o.source,o.scope);_(this._mergedOtherSourceCaches[y]),_(this._mergedSymbolSourceCaches[y]),(o.icons.some(v=>v.iconsetId)||o.patterns.some(v=>v.iconsetId))&&this.fire(new h.z("data",{dataType:"style"}))}rasterizeImages(t,o,c){this.imageManager.rasterizeImages(o,c)}checkAtlasCache(t,o,c){const d=this.imageManager.imageAtlasCache.findCachedAtlas(o.descriptor);c(null,d&&d.contentDescriptor?{iconPositions:d.iconPositions,patternPositions:d.patternPositions,sourceHash:d.contentDescriptor.hash}:null)}getGlyphs(t,o,c){this.glyphManager.getGlyphs(o.stacks,c)}getOwnSourceCache(t){return this._otherSourceCaches[t]}getOwnLayerSourceCache(t){return t.type==="symbol"?this._symbolSourceCaches[t.source]:t.type==="fill-extrusion"&&this._fillExtrusionSourceCaches[t.source]||this._otherSourceCaches[t.source]}getOwnSourceCaches(t){const o=[];return this._otherSourceCaches[t]&&o.push(this._otherSourceCaches[t]),this._symbolSourceCaches[t]&&o.push(this._symbolSourceCaches[t]),this._fillExtrusionSourceCaches[t]&&o.push(this._fillExtrusionSourceCaches[t]),o}_isSourceCacheLoaded(t){const o=this.getOwnSourceCaches(t);return o.length===0?(this.fire(new h.y(new Error(`There is no source with ID '${t}'`))),!1):o.every(c=>c.loaded())}has3DLayers(){return this._has3DLayers}hasSymbolLayers(){return this._hasSymbolLayers}hasCircleLayers(){return this._hasCircleLayers}isLayerClipped(t,o){if(!this._clipLayerPresent&&t.type!=="fill-extrusion"&&t.type!=="building")return!1;const c=t.type==="fill-extrusion"&&(t.sourceLayer==="building"||t.sourceLayer==="procedural_buildings"),d=t.type==="building";if(t.is3D(!!this.terrain)){if(c||d||o&&o.type==="batched-model"||t.type==="model")return!0}else if(t.type==="symbol")return!0;return!1}_clearWorkerCaches(){this.dispatcher.broadcast("clearCaches")}getBOMObject(){}destroy(){this._clearWorkerCaches(),this.imageManager.imageAtlasCache.clear(),this.fragments.forEach(t=>{t.style._remove()}),this.terrainSetForDrapingOnly()&&(delete this.terrain,delete this.stylesheet.terrain)}}dn.getSourceType=function(a){return qt[a]},dn.setSourceType=function(a,t){qt[a]=t},dn.registerForPluginStateChange=h.dn;var Tc=` 9#define EPSILON 0.0000001 10#define PI 3.141592653589793 11#ifdef RENDER_CUTOFF 12float cutoff_opacity(vec4 cutoff_params,float depth) {float near=cutoff_params.x;float far=cutoff_params.y;float cutoffStart=cutoff_params.z;float cutoffEnd=cutoff_params.w;float linearDepth=(depth-near)/(far-near);return clamp((linearDepth-cutoffStart)/(cutoffEnd-cutoffStart),0.0,1.0);} 13#endif`,Sc=` 14#ifdef DUAL_SOURCE_BLENDING 15layout(location=0,index=0) out vec4 glFragColor;layout(location=0,index=1) out vec4 glFragColorSrc1; 16#elif defined(FLOAT_RENDER_TARGET) 17layout(location=0) out highp vec4 glFragColor; 18#else 19layout(location=0) out vec4 glFragColor; 20#endif 21#ifdef USE_MRT1 22layout(location=1) out vec4 out_Target1; 23#endif 24highp float unpack_depth(highp vec4 rgba_depth) 25{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}highp vec4 pack_depth(highp float ndc_z) {highp float depth=ndc_z*0.5+0.5;const highp vec4 bit_shift=vec4(255.0*255.0*255.0,255.0*255.0,255.0,1.0);const highp vec4 bit_mask =vec4(0.0,1.0/255.0,1.0/255.0,1.0/255.0);highp vec4 res=fract(depth*bit_shift);res-=res.xxyz*bit_mask;return res;} 26#ifdef INDICATOR_CUTOUT 27uniform vec3 u_indicator_cutout_centers;uniform vec4 u_indicator_cutout_params; 28#endif 29const float DITHER_THRESHOLDS[16]=float[16]( 301.0/17.0, 9.0/17.0, 3.0/17.0,11.0/17.0,13.0/17.0, 5.0/17.0,15.0/17.0, 7.0/17.0,4.0/17.0,12.0/17.0, 2.0/17.0,10.0/17.0,16.0
30/17.0, 8.0/17.0,14.0/17.0, 6.0/17.0 31);vec4 applyCutout(vec4 color,float height) { 32#ifdef INDICATOR_CUTOUT 33float verticalFadeRange=u_indicator_cutout_centers.z*0.25;float holeMinOpacity=mix(1.0,u_indicator_cutout_params.x,smoothstep(u_indicator_cutout_centers.z,u_indicator_cutout_centers.z+verticalFadeRange,height));float holeRadius=max(u_indicator_cutout_params.y,0.0);float holeAspectRatio=u_indicator_cutout_params.z;float fadeStart=u_indicator_cutout_params.w;float distA=distance(vec2(gl_FragCoord.x,gl_FragCoord.y*holeAspectRatio),vec2(u_indicator_cutout_centers[0],u_indicator_cutout_centers[1]*holeAspectRatio));return color*min(smoothstep(fadeStart,holeRadius,distA)+holeMinOpacity,1.0); 34#else 35return color; 36#endif 37}float cutoutGroundRoofOpacity(vec4 groundRoof) { 38#ifdef INDICATOR_CUTOUT 39float fadeStartX=u_indicator_cutout_params.w;float holeRadius=u_indicator_cutout_params.y;float holeMinOpacity=mix(u_indicator_cutout_params.x,1.0,smoothstep(u_indicator_cutout_params.z,u_indicator_cutout_centers.z,groundRoof.y));float distX=abs(u_indicator_cutout_centers.x-groundRoof.x);float roofOpacity=mix(holeMinOpacity,1.0,smoothstep(fadeStartX,holeRadius,u_indicator_cutout_centers.y-groundRoof.w));float groundOpacity=min(smoothstep(fadeStartX,holeRadius,distX)+holeMinOpacity,1.0);return max(roofOpacity,groundOpacity); 40#else 41return 1.0; 42#endif 43} 44#ifdef DEBUG_WIREFRAME 45#define HANDLE_WIREFRAME_DEBUG \\ 46glFragColor=vec4(0.7,0.0,0.0,0.7); \\ 47gl_FragDepth=gl_FragCoord.z-0.0001; 48#else 49#define HANDLE_WIREFRAME_DEBUG 50#endif 51#ifdef RENDER_CUTOFF 52uniform highp vec4 u_cutoff_params;in float v_cutoff_opacity; 53#endif 54vec4 textureLodCustom(sampler2D image,highp vec2 pos,highp vec2 lod_coord) {highp vec2 size=vec2(textureSize(image,0));highp vec2 dx=dFdx(lod_coord.xy*size);highp vec2 dy=dFdy(lod_coord.xy*size);highp float delta_max_sqr=max(dot(dx,dx),dot(dy,dy));highp float lod=0.5*log2(delta_max_sqr);return textureLod(image,pos,lod);}vec4 premultiplyColor(vec3 nonPremultipliedColor,float a) {return vec4(nonPremultipliedColor*a,a);}vec3 unpremultiplyColor(vec4 premultipliedColor) {if (premultipliedColor.a > 0.0) {return premultipliedColor.rgb/premultipliedColor.a;}return premultipliedColor.rgb;}vec3 applyLUT(highp sampler3D lut,vec3 col) {vec3 size=vec3(textureSize(lut,0));vec3 uvw=(col.rbg*float(size-1.0)+0.5)/size;return texture(lut,uvw).rgb;}vec4 applyLUT(highp sampler3D lut,vec4 premultipliedColor) {return premultiplyColor(applyLUT(lut,unpremultiplyColor(premultipliedColor)),premultipliedColor.a);}`,dl=` 55#define EXTENT 8192.0 56#define RAD_TO_DEG 180.0/PI 57#define DEG_TO_RAD PI/180.0 58#define GLOBE_RADIUS EXTENT/PI/2.0 59float wrap(float n,float min,float max) {float d=max-min;float w=mod(mod(n-min,d)+d,d)+min;return (w==min) ? max : w;} 60#ifdef PROJECTION_GLOBE_VIEW 61vec3 mercator_tile_position(mat4 matrix,vec2 tile_anchor,vec3 tile_id,vec2 mercator_center) { 62#ifndef PROJECTED_POS_ON_VIEWPORT 63float tiles=tile_id.z;vec2 mercator=(tile_anchor/EXTENT+tile_id.xy)/tiles;mercator-=mercator_center;mercator.x=wrap(mercator.x,-0.5,0.5);vec4 mercator_tile=vec4(mercator.xy*EXTENT,EXTENT/(2.0*PI),1.0);mercator_tile=matrix*mercator_tile;return mercator_tile.xyz; 64#else 65return vec3(0.0); 66#endif 67}vec3 mix_globe_mercator(vec3 globe,vec3 mercator,float t) {return mix(globe,mercator,t);}mat3 globe_mercator_surface_vectors(vec3 pos_normal,vec3 up_dir,float zoom_transition) {vec3 normal=zoom_transition==0.0 ? pos_normal : normalize(mix(pos_normal,up_dir,zoom_transition));vec3 xAxis=normalize(vec3(normal.z,0.0,-normal.x));vec3 yAxis=normalize(cross(normal,xAxis));return mat3(xAxis,yAxis,normal);} 68#endif 69vec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec4 decode_color(const vec2 encodedColor) {return vec4( 70unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0 71);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const vec2 units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);
71return (units_to_pixels*pos+offset)/pattern_size;}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {return get_pattern_pos(pixel_coord_upper,pixel_coord_lower,pattern_size,vec2(tile_units_to_pixels),pos);}float mercatorXfromLng(float lng) {return (180.0+lng)/360.0;}float mercatorYfromLat(float lat) {return (180.0-(RAD_TO_DEG*log(tan(PI/4.0+lat/2.0*DEG_TO_RAD))))/360.0;}vec3 latLngToECEF(vec2 latLng) {latLng=DEG_TO_RAD*latLng;float cosLat=cos(latLng[0]);float sinLat=sin(latLng[0]);float cosLng=cos(latLng[1]);float sinLng=sin(latLng[1]);float sx=cosLat*sinLng*GLOBE_RADIUS;float sy=-sinLat*GLOBE_RADIUS;float sz=cosLat*cosLng*GLOBE_RADIUS;return vec3(sx,sy,sz);} 72#ifdef RENDER_CUTOFF 73uniform vec4 u_cutoff_params;out float v_cutoff_opacity; 74#endif 75const vec4 AWAY=vec4(-1000.0,-1000.0,-1000.0,1);const float skirtOffset=24575.0;vec3 decomposeToPosAndSkirt(ivec2 posWithComposedSkirt) 76{float skirt=float(float(posWithComposedSkirt.x) >=skirtOffset);vec2 pos=vec2(posWithComposedSkirt)-vec2(skirt*skirtOffset,0.0);return vec3(pos,skirt);} 77#ifndef HAS_SHADER_STORAGE_BLOCK_material_buffer 78#define GET_ATTRIBUTE_float(attrib,matInfo,attrib_id) attrib 79#define GET_ATTRIBUTE_vec4(attrib,matInfo,attrib_id) attrib 80#define GET_ATTRIBUTE_vec2(attrib,matInfo,attrib_id) attrib 81#define DECLARE_MATERIAL_TABLE_INFO 82#endif`,Jh="in highp vec3 a_pos_3f;uniform lowp mat4 u_matrix;out highp vec3 v_uv;void main() {const mat3 half_neg_pi_around_x=mat3(1.0,0.0, 0.0,0.0,0.0,-1.0,0.0,1.0, 0.0);v_uv=half_neg_pi_around_x*a_pos_3f;vec4 pos=u_matrix*vec4(a_pos_3f,1.0);gl_Position=pos.xyww;}",Kh=` 83#define ELEVATION_SCALE 7.0 84#define ELEVATION_OFFSET 450.0 85#ifdef PROJECTION_GLOBE_VIEW 86uniform vec3 u_tile_tl_up;uniform vec3 u_tile_tr_up;uniform vec3 u_tile_br_up;uniform vec3 u_tile_bl_up;uniform float u_tile_up_scale;vec3 elevationVector(vec2 pos) {vec2 uv=pos/EXTENT;vec3 up=normalize(mix( 87mix(u_tile_tl_up,u_tile_tr_up,uv.xxx),mix(u_tile_bl_up,u_tile_br_up,uv.xxx),uv.yyy));return up*u_tile_up_scale;} 88#else 89vec3 elevationVector(vec2 pos) { return vec3(0,0,1); } 90#endif 91#ifdef TERRAIN 92uniform highp sampler2D u_dem;uniform highp sampler2D u_dem_prev;uniform vec2 u_dem_tl;uniform vec2 u_dem_tl_prev;uniform float u_dem_scale;uniform float u_dem_scale_prev;uniform float u_dem_size;uniform float u_dem_lerp;uniform float u_exaggeration;uniform float u_meter_to_dem;uniform mat4 u_label_plane_matrix_inv;vec4 tileUvToDemSample(vec2 uv,float dem_size,float dem_scale,vec2 dem_tl) {vec2 pos=dem_size*(uv*dem_scale+dem_tl)+1.0;vec2 f=fract(pos);return vec4((pos-f+0.5)/(dem_size+2.0),f);}float currentElevation(vec2 apos) { 93#ifdef TERRAIN_DEM_FLOAT_FORMAT 94vec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale+u_dem_tl)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture(u_dem,pos).r; 95#else 96float dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale,u_dem_tl);vec2 pos=r.xy;vec2 f=r.zw;float tl=texture(u_dem,pos).r;float tr=texture(u_dem,pos+vec2(dd,0)).r;float bl=texture(u_dem,pos+vec2(0,dd)).r;float br=texture(u_dem,pos+vec2(dd,dd)).r;return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y); 97#endif 98}float prevElevation(vec2 apos) { 99#ifdef TERRAIN_DEM_FLOAT_FORMAT 100vec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale_prev+u_dem_tl_prev)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture(u_dem_prev,pos).r; 101#else 102float dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale_prev,u_dem_tl_prev);vec2 pos=r.xy;vec2 f=r.zw;float tl=texture(u_dem_prev,pos).r;float tr=texture(u_dem_prev,pos+vec2(dd,0)).r;float bl=texture(u_dem_prev,pos+vec2(0,dd)).r;float br=texture(u_dem_prev,pos+vec2(dd,dd)).r;return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y); 103#endif 104} 105#ifdef TERRAIN_VERTEX_MORPHING 106float elevation(vec2 apos) { 107#ifdef ZERO_EXAGGERATION 108return 0.0; 109#endif 110float nextElevation=currentElevation(apos);float prevElevation=prevElevation(apos);return mix(prevElevation,nextElevation,u_dem_lerp);} 111#else 112float elevation(vec2 apos) { 113#ifdef ZERO_EXAGGERATION 114return 0.0; 115#endif 116return currentElevation(apos);} 117#endif 118vec4 fourSample(vec2 pos,vec2 off) {float tl=texture(u_dem,pos).r;float tr=texture(u_dem,pos+vec2(off.x,0.0)).r;float bl=texture(u_dem,pos+vec2(0.0,off.y)).r;float br=texture(u_dem,pos+off).r;return vec4(tl,tr,bl,br);}float flatElevation(vec2 pack) {vec2 apos=floor(pack/8.0);vec2 span=10.0*(pack-apos*8.0);vec2 uvTex=(apos-vec2(1.0,1.0))/8190.0;float size=u_dem_size+2.0;float dd=1.0/size;vec2 pos=u_dem_size*(uvTex*u_dem_scale+u_dem_tl)+1.0;vec2 f=fract(pos);pos=(pos-f+0.5)*dd;vec4 h=fourSample(pos,vec2(dd));float z=mix(mix(h.x,h.y,f.x),mix(h.z,h.w,f.x),f.y);vec2 w=floor(0.5*(span*u_meter_to_dem-1.0));vec2 d=dd*w;h=fourSample(pos-d,2.0*d+vec2(dd));vec4 diff=abs(h.xzxy-h.ywzw);vec2 slope=min(vec2(0.25),u_meter_to_dem*0.5*(diff.xz+diff.yw)/(2.0*w+vec2(1.0)));vec2 fix=slope*span;float base=z+max(fix.x,fix.y);return u_exaggeration*base;}float elevationFromUint16(float word) {return u_exaggeration*(word/ELEVATION_SCALE-ELEVATION_OFFSET);} 119#else 120float elevation(vec2 pos) { return 0.0; } 121#endif 122#ifdef DEPTH_OCCLUSION 123uniform highp sampler2D u_depth;uniform highp vec2 u_depth_size_inv;uniform highp vec2 u_depth_range_unpack;uniform highp float u_occluder_half_size;uniform highp float u_occlusion_depth_offset; 124#ifdef DEPTH_D24 125float unpack_depth(float depth) {return depth*u_depth_range_unpack.x+u_depth_range_unpack.y;}vec4 unpack_depth4(vec4 depth) {return depth*u_depth_range_unpack.x+vec4(u_depth_range_unpack.y);} 126#else 127highp float unpack_depth_rgba(vec4 rgba_depth) 128{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;} 129#endif 130bool isOccluded(vec4 frag) {vec3 coord=frag.xyz/frag.w; 131#ifdef CLIP_ZERO_TO_ONE 132coord.z=-1.0+2.0*coord.z; 133#endif 134#ifdef DEPTH_D24 135float depth=unpack_depth(texture(u_depth,(coord.xy+1.0)*0.5).r); 136#else 137float depth=unpack_depth_rgba(texture(u_depth,(coord.xy+1.0)*0.5)); 138#endif 139return coord.z+u_occlusion_depth_offset > depth;}highp vec4 getCornerDepths(vec2 coord) {highp vec3 df=vec3(u_occluder_half_size*u_depth_
139size_inv,0.0);highp vec2 uv=0.5*coord.xy+0.5; 140#ifdef DEPTH_D24 141highp vec4 depth=vec4( 142texture(u_depth,uv-df.xz).r,texture(u_depth,uv+df.xz).r,texture(u_depth,uv-df.zy).r,texture(u_depth,uv+df.zy).r 143);depth=unpack_depth4(depth); 144#else 145highp vec4 depth=vec4( 146unpack_depth_rgba(texture(u_depth,uv-df.xz)),unpack_depth_rgba(texture(u_depth,uv+df.xz)),unpack_depth_rgba(texture(u_depth,uv-df.zy)),unpack_depth_rgba(texture(u_depth,uv+df.zy)) 147); 148#endif 149return depth;}highp float occlusionFadeMultiSample(vec4 frag) {highp vec3 coord=frag.xyz/frag.w;highp vec2 uv=0.5*coord.xy+0.5; 150#ifdef CLIP_ZERO_TO_ONE 151coord.z=-1.0+2.0*coord.z; 152#endif 153int NX=3;int NY=4;highp vec2 df=u_occluder_half_size*u_depth_size_inv;highp vec2 oneStep=2.0*u_occluder_half_size*u_depth_size_inv/vec2(NX-1,NY-1);highp float res=0.0;for (int y=0; y < NY;++y) {for (int x=0; x < NX;++x) { 154#ifdef DEPTH_D24 155highp float depth=unpack_depth(texture(u_depth,uv-df+vec2(float(x)*oneStep.x,float(y)*oneStep.y)).r); 156#else 157highp float depth=unpack_depth_rgba(texture(u_depth,uv-df+vec2(float(x)*oneStep.x,float(y)*oneStep.y))); 158#endif 159res+=1.0-clamp(300.0*(coord.z+u_occlusion_depth_offset-depth),0.0,1.0);}}res=clamp(2.0*res/float(NX*NY)-0.5,0.0,1.0);return res;}highp float occlusionFade(vec4 frag) {highp vec3 coord=frag.xyz/frag.w; 160#ifdef CLIP_ZERO_TO_ONE 161coord.z=-1.0+2.0*coord.z; 162#endif 163highp vec4 depth=getCornerDepths(coord.xy);return dot(vec4(0.25),vec4(1.0)-clamp(300.0*(vec4(coord.z+u_occlusion_depth_offset)-depth),0.0,1.0));} 164#else 165bool isOccluded(vec4 frag) { return false; }highp float occlusionFade(vec4 frag) { return 1.0; }highp float occlusionFadeMultiSample(vec4 frag) { return 1.0; } 166#endif`,Qh=`#ifdef FOG 167uniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump mat4 u_fog_matrix;out vec3 v_fog_pos;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}vec3 fog_position(vec3 pos) {return (u_fog_matrix*vec4(pos,1.0)).xyz;}vec3 fog_position(vec2 pos) {return fog_position(vec3(pos,0.0));}float fog(vec3 pos) {float depth=length(pos);float opacity=fog_opacity(fog_range(depth));return opacity*fog_horizon_blending(pos/depth);} 168#endif`,va=`#ifdef FOG 169uniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump vec2 u_fog_vertical_limit;uniform mediump float u_fog_temporal_offset;in vec3 v_fog_pos;uniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform highp vec2 u_viewport;uniform float u_globe_transition;uniform int u_is_globe;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}float globe_glow_progress() {highp vec2 uv=gl_FragCoord.xy/u_viewport; 170#ifdef FLIP_Y 171uv.y=1.0-uv.y; 172#endif 173highp vec3 ray_dir=mix( 174mix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);highp vec3 dir=normalize(ray_dir);highp vec3 closest_point=dot(u_globe_pos,dir)*dir;highp float sdf=length(closest_point-u_globe_pos)/u_globe_radius;return sdf+PI*0.5;}float fog_opacity(vec3 pos) {float depth=length(pos);return fog_opacity(fog_range(depth));}vec3 fog_apply(vec3 color,vec3 pos,float opacity_limit) {float depth=length(pos);float opacity;if (u_is_globe==1) {float glow_progress=globe_glow_progress();float t=mix(glow_progress,depth,u_globe_transition);opacity=fog_opacity(fog_range(t));} else {opacity=fog_opacity(fog_range(depth));opacity*=fog_horizon_blending(pos/depth);}return mix(color,u_fog_color.rgb,min(opacity,opacity_limit));}vec3 fog_apply(vec3 color,vec3 pos) {return fog_apply(color,pos,1.0);}vec4 fog_apply_from_vert(vec4 color,float fog_opac) {float alpha=EPSILON+color.a;color.rgb=mix(color.rgb/alpha,u_fog_color.rgb,fog_opac)*alpha;return color;}
174vec3 fog_apply_sky_gradient(vec3 camera_ray,vec3 sky_color) {float horizon_blend=fog_horizon_blending(normalize(camera_ray));return mix(sky_color,u_fog_color.rgb,horizon_blend);}vec4 fog_apply_premultiplied(vec4 color,vec3 pos) {float alpha=EPSILON+color.a;color.rgb=fog_apply(color.rgb/alpha,pos)*alpha;return color;}vec4 fog_apply_premultiplied(vec4 color,vec3 pos,float heightMeters) {float verticalProgress=(u_fog_vertical_limit.x > 0.0 || u_fog_vertical_limit.y > 0.0) ? smoothstep(u_fog_vertical_limit.x,u_fog_vertical_limit.y,heightMeters) : 0.0;float opacityLimit=1.0-smoothstep(0.9,1.0,fog_opacity(pos));return mix(fog_apply_premultiplied(color,pos),color,min(verticalProgress,opacityLimit));}vec3 fog_dither(vec3 color) {return color;}vec4 fog_dither(vec4 color) {return vec4(fog_dither(color.rgb),color.a);} 175#endif`,wu=` 176#ifdef LIGHTING_3D_MODE 177uniform mediump vec3 u_lighting_ambient_color;uniform mediump vec3 u_lighting_directional_dir;uniform mediump vec3 u_lighting_directional_color;uniform mediump vec3 u_ground_radiance;float calculate_ambient_directional_factor(vec3 normal) {float NdotL=dot(normal,u_lighting_directional_dir);const float factor_reduction_max=0.3;float dir_luminance=dot(u_lighting_directional_color,vec3(0.2126,0.7152,0.0722));float directional_factor_min=1.0-factor_reduction_max*min(dir_luminance,1.0);float ambient_directional_factor=mix(directional_factor_min,1.0,min((NdotL+1.0),1.0));const float vertical_factor_min=0.92;float vertical_factor=mix(vertical_factor_min,1.0,normal.z*0.5+0.5);return vertical_factor*ambient_directional_factor;}vec3 linearProduct(vec3 srgbIn,vec3 k) {return srgbIn*pow(k,vec3(1./2.2));}vec3 apply_lighting(vec3 color,vec3 normal,float dir_factor) {float ambient_directional_factor=calculate_ambient_directional_factor(normal);vec3 ambient_contrib=ambient_directional_factor*u_lighting_ambient_color;vec3 directional_contrib=u_lighting_directional_color*dir_factor;return linearProduct(color,ambient_contrib+directional_contrib);}vec4 apply_lighting(vec4 color,vec3 normal,float dir_factor) {return vec4(apply_lighting(color.rgb,normal,dir_factor),color.a);}vec3 apply_lighting(vec3 color,vec3 normal) {float dir_factor=max(dot(normal,u_lighting_directional_dir),0.0);return apply_lighting(color.rgb,normal,dir_factor);}vec4 apply_lighting(vec4 color,vec3 normal) {float dir_factor=max(dot(normal,u_lighting_directional_dir),0.0);return vec4(apply_lighting(color.rgb,normal,dir_factor),color.a);}vec3 apply_lighting_ground(vec3 color) {return color*u_ground_radiance;}vec4 apply_lighting_ground(vec4 color) {return vec4(apply_lighting_ground(color.rgb),color.a);}float calculate_NdotL(vec3 normal) {const float ext=0.70710678118;return (clamp(dot(normal,u_lighting_directional_dir),-ext,1.0)+ext)/(1.0+ext);}vec4 apply_lighting_with_emission_ground(vec4 color,float emissive_strength) {return mix(apply_lighting_ground(color),color,emissive_strength);}vec3 compute_flood_lighting(vec3 flood_light_color,float fully_occluded_factor,float occlusion,vec3 ground_shadow_factor) {vec3 fully_occluded_color=flood_light_color*mix(ground_shadow_factor,vec3(1.0),fully_occluded_factor);float occlusion_ramp=smoothstep(0.0,0.2,1.0-occlusion);return mix(fully_occluded_color,flood_light_color,occlusion_ramp);}vec3 compute_emissive_draped(vec3 unlit_color,float fully_occluded_factor,float occlusion,vec3 ground_shadow_factor) {vec3 fully_occluded_color=unlit_color*mix(ground_shadow_factor,vec3(1.0),fully_occluded_factor);return mix(fully_occluded_color,unlit_color,1.0-occlusion);} 178#endif`,Sp=`#ifdef RASTER_ARRAY 179uniform highp sampler2D u_image0;uniform sampler2D u_image1;const vec4 NODATA=vec4(1);ivec4 _raTexLinearCoord(highp vec2 texCoord,highp vec2 texResolution,out highp vec2 fxy) {texCoord=texCoord*texResolution-0.5;fxy=fract(texCoord);texCoord-=fxy;return ivec4(texCoord.xxyy+vec2(1.5,0.5).xyxy);}vec2 _raTexLinearMix(highp vec2 fxy,highp vec4 colorMix,highp float colorOffset,highp vec4 t00,highp vec4 t10,highp vec4 t01,highp vec4 t11) {vec2 c00=t00==NODATA ? vec2(0) : vec2(colorOffset+dot(t00,colorMix),1);vec2 c10=t10==NODATA ? vec2(0) : vec2(colorOffset+dot(t10,colorMix),1);vec2 c01=t01==NODATA ? vec2(0) : vec2(colorOffset+dot(t01,colorMix),1);vec2 c11=t11==NODATA ? vec2(0) : vec2(colorOffset+dot(t11,colorMix),1);return mix(mix(c01,c11,fxy.x),mix(c00,c10,fxy.x),fxy.y);}
179vec2 raTexture2D_image0_linear(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec2 fxy;ivec4 c=_raTexLinearCoord(texCoord,texResolution,fxy);return _raTexLinearMix(fxy,colorMix,colorOffset,texelFetch(u_image0,c.yz,0),texelFetch(u_image0,c.xz,0),texelFetch(u_image0,c.yw,0),texelFetch(u_image0,c.xw,0) 180);}vec2 raTexture2D_image1_linear(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec2 fxy;ivec4 c=_raTexLinearCoord(texCoord,texResolution,fxy);return _raTexLinearMix(fxy,colorMix,colorOffset,texelFetch(u_image1,c.yz,0),texelFetch(u_image1,c.xz,0),texelFetch(u_image1,c.yw,0),texelFetch(u_image1,c.xw,0) 181);}vec2 raTexture2D_image0_nearest(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec4 t=texelFetch(u_image0,ivec2(texCoord*texResolution),0);return t==NODATA ? vec2(0) : vec2(colorOffset+dot(t,colorMix),1);}vec2 raTexture2D_image1_nearest(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec4 t=texelFetch(u_image1,ivec2(texCoord*texResolution),0);return t==NODATA ? vec2(0) : vec2(colorOffset+dot(t,colorMix),1);} 182#endif`,Ip=`#ifdef RENDER_SHADOWS 183uniform mediump vec3 u_shadow_direction;uniform highp vec3 u_shadow_normal_offset;vec3 shadow_normal_offset(vec3 normal) {float tileInMeters=u_shadow_normal_offset[0];vec3 n=vec3(-normal.xy,tileInMeters*normal.z);float dotScale=min(1.0-dot(normal,u_shadow_direction),1.0)*0.5+0.5;return n*dotScale;}vec3 shadow_normal_offset_model(vec3 normal) {vec3 transformed_normal=vec3(-normal.xy,normal.z);float NDotL=dot(normalize(transformed_normal),u_shadow_direction);float dotScale=min(1.0-NDotL,1.0)*0.5+0.5;return normal*dotScale;}float shadow_normal_offset_multiplier0() {return u_shadow_normal_offset[1];}float shadow_normal_offset_multiplier1() {return u_shadow_normal_offset[2];} 184#endif`,Ep=`#ifdef RENDER_SHADOWS 185precision highp sampler2DShadow;uniform sampler2DShadow u_shadowmap_0;uniform sampler2DShadow u_shadowmap_1;uniform float u_shadow_intensity;uniform float u_shadow_map_resolution;uniform float u_shadow_texel_size;uniform highp vec3 u_shadow_normal_offset;uniform vec2 u_fade_range;uniform mediump vec3 u_shadow_direction;uniform highp vec3 u_shadow_bias;float shadow_sample(sampler2DShadow shadowmap,highp vec3 pos,highp float bias) { 186#ifdef CLIP_ZERO_TO_ONE 187highp vec3 coord=vec3(pos.xy*0.5+0.5,pos.z-bias); 188#else 189highp vec3 coord=vec3(pos.xy*0.5+0.5,pos.z*0.5+0.5-bias); 190#endif 191return texture(shadowmap,coord);}float shadow_occlusion(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth,highp float bias) {light_view_pos0.xyz/=light_view_pos0.w; 192#ifdef SHADOWS_SINGLE_CASCADE 193vec2 abs_bounds=abs(light_view_pos0.xy);if (abs_bounds.x >=1.0 || abs_bounds.y >=1.0) {return 0.0;}return shadow_sample(u_shadowmap_0,light_view_pos0.xyz,bias); 194#else 195light_view_pos1.xyz/=light_view_pos1.w;vec4 abs_bounds=abs(vec4(light_view_pos0.xy,light_view_pos1.xy));if (abs_bounds.x < 1.0 && abs_bounds.y < 1.0) {return shadow_sample(u_shadowmap_0,light_view_pos0.xyz,bias);}if (abs_bounds.z >=1.0 || abs_bounds.w >=1.0) {return 0.0;}float occlusion1=shadow_sample(u_shadowmap_1,light_view_pos1.xyz,bias);return clamp(mix(occlusion1,0.0,smoothstep(u_fade_range.x,u_fade_range.y,view_depth)),0.0,1.0); 196#endif 197}highp float calculate_shadow_bias(float NDotL) { 198#ifdef NORMAL_OFFSET 199return 0.5*u_shadow_bias.x; 200#else 201return 0.5*(u_shadow_bias.x+clamp(u_shadow_bias.y*tan(acos(NDotL)),0.0,u_shadow_bias.z)); 202#endif 203}float shadowed_light_factor_normal(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float NDotL=dot(N,u_shadow_direction);float bias=calculate_shadow_bias(NDotL);float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}float shadowed_light_factor_normal_opacity(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth,float shadow_opacity) {float NDotL=dot(N,u_shadow_direction);float bias=calculate_shadow_bias(NDotL);float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias)*shadow_opacity;return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}float shadowed_light_factor_normal_unbiased(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float NDotL=dot(N,u_shadow_direction);float bias=0.0;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}highp vec2 compute_receiver_plane_depth_bias(highp vec3 pos_dx,highp vec3 pos_dy) 204{highp vec2 biasUV=vec2( 205pos_dy.y*pos_dx.z-pos_dx.y*pos_dy.z,pos_dx.x*pos_dy.z-pos_dy.x*pos_dx.z);biasUV*=1.0/((pos_dx.x*pos_dy.y)-(pos_dx.y*pos_dy.x));return biasUV;}float shadowed_light_factor_plane_bias(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {highp vec3 light_view_pos0_xyz=light_view_pos0.xyz/light_view_pos0.w*0.5+0.5;highp vec3 light_view_pos0_ddx=dFdx(light_view_pos0_xyz);highp vec3 light_view_pos0_ddy=dFdy(light_view_pos0_xyz);highp vec2 plane_depth_bias=compute_receiver_plane_depth_bias(light_view_pos0_ddx,light_view_pos0_ddy);highp float bias=dot(vec2(u_shadow_texel_size,u_shadow_texel_size),plane_depth_bias)+0.0001;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return 1.0-(u_shadow_intensity*occlusion);}float shadowed_light_factor(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float bias=0.0;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return 1.0-(u_shadow_intensity*occlusion);}float shadow_occlusion(float ndotl,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float bias=calculate_shadow_bias(ndotl);return shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);} 206#endif`;
206const Tu=/#include\s+"([^"]+)"/g,Su=/#pragma mapbox: ([\w\-]+) ([\w]+) ([\w]+) ([\w]+)/g,ed=/\b[A-Za-z_][A-Za-z0-9_]*\b/g,td=new Set(["ifdef","ifndef","elif","if","defined"]),Ic=new Set;Qo(Tc,Ic),Qo(dl,Ic),Qo(Sc,Ic);const fl={"_prelude_fog.vertex.glsl":Qh,"_prelude_terrain.vertex.glsl":Kh,"_prelude_shadow.vertex.glsl":Ip,"_prelude_material_table.vertex.glsl":`#ifdef HAS_SHADER_STORAGE_BLOCK_material_buffer 207#define MATERIAL_TABLE_DEBUG 0 208uniform int u_material_offset;uniform int u_vertex_offset;layout(std140,binding=0)readonly buffer material_buffer{uvec4 material_data[];};struct MaterialInfo{uint dataOffset; 209#if MATERIAL_TABLE_DEBUG 210vec4 colorDebug; 211#endif 212};uint read_buf_no_offset(uint iDword) {return material_data[iDword/4u][iDword % 4u];}uint read_buf(uint iDword) {iDword+=uint(u_material_offset/4);return read_buf_no_offset(iDword);}float read_buf_float(uint iDword){return uintBitsToFloat(read_buf(iDword));}uint read_buf_uint8(uint iDword,uint iUint8){uint dwordOffset=iDword+(iUint8/4u);uint byteOffset=iUint8 & 3u;uint bitOffset=8u*byteOffset;uint mask=0xffu << bitOffset;uint dwordVal=read_buf(dwordOffset);return (dwordVal & mask) >> bitOffset;}uint read_buf_uint16(uint iDword,uint iUint16){uint dwordOffset=iDword+(iUint16 >> 1u);uint bitOffset=(iUint16 & 1u)*16u;uint mask=0xffffu << bitOffset;uint dwordVal=read_buf(dwordOffset);return (dwordVal & mask) >> bitOffset;}uint nrDwordsForVertexIdEntries(uint nrMaterialLookupEntries) {return nrMaterialLookupEntries;}uint nrDwordsForMaterialIdEntries(uint nrMaterialLookupEntries) {return (nrMaterialLookupEntries*2u+3u)/4u;}uint findRangeBinarySearch(uint vertexId,uint numRanges,uint dwordOffset) {uint left=0u;uint right=numRanges-1u;for (uint i=0u; i < 16u; i++) { 213if (left > right) {break;}uint mid=(left+right)/2u;uint start=read_buf(dwordOffset+mid);uint nextStart=(mid+1u < numRanges) ? read_buf(dwordOffset+mid+1u) : 0xffffffffu;if (vertexId >=start && vertexId < nextStart) {return mid;} else if (vertexId < start) {if (mid==0u) {break;}right=mid-1u;} else {left=mid+1u;}}return 0u; 214}uint readVertexId(uint dwordOffset,uint iMaterialLookupEntry) {return read_buf(dwordOffset+iMaterialLookupEntry);}uint findRange(uint vertexId,uint numRanges,uint dwordOffset) {uint iRange;if(numRanges <=64u){uint vertexBegin;for(iRange=0u; iRange < numRanges;++iRange) {vertexBegin=readVertexId(dwordOffset,iRange);if(vertexBegin > vertexId) {break;}}iRange=iRange==0u? 0u : iRange-1u;} else { 215iRange=findRangeBinarySearch(vertexId,numRanges,dwordOffset);}return iRange;}MaterialInfo read_material_info(uint vertex_id) {MaterialInfo info; 216#if MATERIAL_TABLE_DEBUG 217const vec4 red=vec4(1.0,0.0,0.0,1.0);const vec4 orange=vec4(1.0,0.5,0.0,1.0);const vec4 yellow=vec4(1.0,1.0,0.0,1.0);const vec4 green=vec4(0.0,1.0,0.0,1.0);const vec4 indigo=vec4(0.294,0.0,0.510,1.0);const vec4 blue=vec4(0.0,0.0,1.0,1.0);const vec4 purple=vec4(0.5,0.0,0.5,1.0);const vec4 pink=vec4(1.0,0.0,1.0,1.0);info.colorDebug=green; 218#endif 219uint offset=0u; 220#if MATERIAL_TABLE_DEBUG 221bool keepFinding=true;uint magic=read_buf(offset);if(magic !=0xCAFEBABEu) {info.colorDebug=red;keepFinding=false;return info;} 222#endif 223offset++; 224#if MATERIAL_TABLE_DEBUG 225uint nrMaterials=read_buf(offset);uint nrVertices=read_buf(offset+1u);if(keepFinding && vertex_id >=nrVertices) {info.colorDebug=red;keepFinding=false;} 226#endif 227offset+=2u;uint nrMaterialLookupEntries=read_buf(offset++);uint perMaterialEntrySizeDwords=read_buf(offset++); 228#if MATERIAL_TABLE_DEBUG 229if(keepFinding && perMaterialEntrySizeDwords !=1u) {info.colorDebug=red;keepFinding=false;} 230#endif 231uint iMaterialLookup=findRange(vertex_id,nrMaterialLookupEntries,offset); 232#if MATERIAL_TABLE_DEBUG 233if(keepFinding) 234{uint vertexBeginCheck=readVertexId(offset,iMaterialLookup);if(vertexBeginCheck > vertex_id) {info.colorDebug=red;keepFinding=false;}if(iMaterialLookup < nrMaterialLookupEntries-1u) {uint vertexEndCheck=readVertexId(offset,iMaterialLookup+1u);if(vertexEndCheck <=vertex_id) {info.colorDebug=red;keepFinding=false;}}} 235#endif 236offset+=nrDwordsForVertexIdEntries(nrMaterialLookupEntries);uint materialId=iMaterialLookup; 237#if MATERIAL_TABLE_DEBUG 238if(keepFinding) {if(materialId >=nrMaterialLookupEntries) {info.colorDebug=red;}} 239#endif 240info.dataOffset=offset+materialId*perMaterialEntrySizeDwords;return info;}uint get_data_location(const MaterialInfo matInfo,uint attribOffsetBytes) 241{uint attribFieldOffsetDwords=attribOffsetBytes/4u;return matInfo.dataOffset+attribFieldOffsetDwords;}vec4 read_material_vec4(const MaterialInfo matInfo,uint attribOffsetBytes){uint loc=get_data_location(matInfo,attribOffsetBytes);return vec4(read_buf_float(loc),read_buf_float(loc+1u),read_buf_float(loc+2u),read_buf_float(loc+3u));}vec2 read_material_vec2(const MaterialInfo matInfo,uint attribOffsetBytes){uint loc=get_data_location(matInfo,attribOffsetBytes);return vec2(read_buf_float(loc),read_buf_float(loc+1u));}float read_material_float(const MaterialInfo matInfo,uint attribOffsetBytes){uint loc=get_data_location(matInfo,attribOffsetBytes);return read_buf_float(loc);} 242#define GET_ATTRIBUTE_float(attrib,matInfo,attrib_offset) read_material_float(matInfo,attrib_offset) 243#define GET_ATTRIBUTE_vec4(attrib,matInfo,attrib_offset) read_material_vec4(matInfo,attrib_offset) 244#define GET_ATTRIBUTE_vec2(attrib,matInfo,attrib_offset) read_material_vec2(matInfo,attrib_offset) 245#define DECLARE_MATERIAL_TABLE_INFO MaterialInfo materialInfo=read_material_info(uint(gl_VertexID)); 246#define DECLARE_MATERIAL_TABLE_INFO_DEBUG(dbgColor) MaterialInfo materialInfo=read_material_info(uint(gl_VertexID)); dbgColor=materialInfo.colorDebug; 247#endif`,"_prelude_fog.fragment.glsl":va,"_prelude_shadow.fragment.glsl":Ep,"_prelude_lighting.glsl":wu,"_prelude_raster_array.glsl":Sp},Iu={},pl="precision highp float;",ml="precision mediump float;",id=` 248#if defined(GL_EXT_blend_func_extended) && defined(DUAL_SOURCE_BLENDING) 249#extension GL_EXT_blend_func_extended : require 250#endif`,fn={preludeTerrain:Ft("",Kh),preludeFog:Ft(va,Qh),preludeShadow:Ft(Ep,Ip
250),preludeRasterArray:Ft(Sp,""),preludeLighting:Ft(wu,wu),preludePrecisionQualifiers:Ft(ml,pl),prelude:Ft(Sc,dl),preludeExtensions:Ft(id,"")},rd=[id,ml,Tc,fn.prelude.fragmentSource].join(` 251`),Eu=[pl,Tc,fn.prelude.vertexSource].join(` 252`);var G_={background:Ft(`#include "_prelude_fog.fragment.glsl" 253#include "_prelude_lighting.glsl" 254uniform vec4 u_color;uniform float u_opacity;uniform mediump float u_emissive_strength; 255#ifdef LIGHTING_3D_MODE 256in vec4 v_color; 257#endif 258void main() {vec4 out_color; 259#ifdef FEATURE_CUTOUT 260vec2 uv=gl_FragCoord.xy*u_inv_viewport_size.xy; 261#ifdef FLIP_Y 262uv.y=1.0-uv.y; 263#endif 264float factorTex=min(texture(u_cutout_factor_image,uv).r,1.0);float cutoutFactor=(1.0-u_feature_cutout_params.x)*factorTex;out_color=u_color*(1.0-cutoutFactor); 265#else 266#ifdef LIGHTING_3D_MODE 267out_color=v_color; 268#else 269out_color=u_color; 270#endif 271#ifdef FOG 272out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); 273#endif 274#endif 275glFragColor=out_color*u_opacity; 276#ifdef USE_MRT1 277out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a); 278#endif 279#ifdef OVERDRAW_INSPECTOR 280glFragColor=vec4(1.0); 281#endif 282HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 283#include "_prelude_lighting.glsl" 284in ivec2 a_pos;uniform mat4 u_matrix;uniform mediump float u_emissive_strength; 285#ifdef LIGHTING_3D_MODE 286uniform mediump vec4 u_color;out vec4 v_color; 287#endif 288void main() {gl_Position=u_matrix*vec4(a_pos,0,1); 289#ifndef FEATURE_CUTOUT 290#ifdef LIGHTING_3D_MODE 291v_color=apply_lighting_with_emission_ground(u_color,u_emissive_strength); 292#endif 293#ifdef FOG 294v_fog_pos=fog_position(vec2(a_pos)); 295#endif 296#endif 297}`),backgroundPattern:Ft(`#include "_prelude_fog.fragment.glsl" 298#include "_prelude_lighting.glsl" 299uniform vec2 u_pattern_tl;uniform vec2 u_pattern_br;uniform vec2 u_texsize;uniform float u_opacity;uniform float u_emissive_strength;uniform sampler2D u_image;in highp vec2 v_pos;void main() {highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(u_pattern_tl/u_texsize,u_pattern_br/u_texsize,imagecoord);vec4 out_color=textureLodCustom(u_image,pos,v_pos); 300#ifdef LIGHTING_3D_MODE 301out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); 302#endif 303#ifdef FOG 304out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); 305#endif 306glFragColor=out_color*u_opacity; 307#ifdef USE_MRT1 308out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a); 309#endif 310#ifdef OVERDRAW_INSPECTOR 311glFragColor=vec4(1.0); 312#endif 313HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 314uniform mat4 u_matrix;uniform vec2 u_pattern_size;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec2 u_pattern_units_to_pixels;in ivec2 a_pos;out highp vec2 v_pos;void main() {vec2 pos=vec2(a_pos);gl_Position=u_matrix*vec4(pos,0,1);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_pattern_size,u_pattern_units_to_pixels,pos); 315#ifdef FOG 316v_fog_pos=fog_position(pos); 317#endif 318}`),circle:Ft(`#include "_prelude_fog.fragment.glsl" 319#include "_prelude_lighting.glsl" 320in vec3 v_data;in float v_visibility; 321#pragma mapbox: define highp vec4 color 322#pragma mapbox: define mediump float radius 323#pragma mapbox: define lowp float blur 324#pragma mapbox: define lowp float opacity 325#pragma mapbox: define highp vec4 stroke_color 326#pragma mapbox: define mediump float stroke_width 327#pragma mapbox: define lowp float stroke_opacity 328uniform float u_emissive_strength;void main() { 329#pragma mapbox: initialize highp vec4 color 330#pragma mapbox: initialize mediump float radius 331#pragma mapbox: initialize lowp float blur 332#pragma mapbox: initialize lowp float opacity 333#pragma mapbox: initialize highp vec4 stroke_color 334#pragma mapbox: initialize mediump float stroke_width 335#pragma mapbox: initialize lowp float stroke_opacity 336vec2 extrude=v_data.xy;float blur_positive=blur < 0.0 ? 0.0 : 1.0;lowp float antialiasblur=v_data.z;float extrude_length=length(extrude)+antialiasblur*(1.0-blur_positive);float antialiased_blur=-max(abs(blur),antialiasblur);float antialiase_blur_opacity=smoothstep(0.0,antialiasblur,extrude_length-1.0);float opacity_t=blur_positive==1.0 ? 337smoothstep(0.0,-antialiased_blur,1.0-extrude_length) : 338smoothstep(antialiased_blur,0.0,extrude_length-1.0)-antialiase_blur_op
338acity;float color_t=stroke_width < 0.01 ? 0.0 : smoothstep( 339antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width) 340);vec4 out_color=mix(color*opacity,stroke_color*stroke_opacity,color_t); 341#ifdef LIGHTING_3D_MODE 342out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); 343#endif 344#ifdef FOG 345out_color=fog_apply_premultiplied(out_color,v_fog_pos); 346#endif 347glFragColor=out_color*(v_visibility*opacity_t); 348#ifdef OVERDRAW_INSPECTOR 349glFragColor=vec4(1.0); 350#endif 351}`,`#include "_prelude_fog.vertex.glsl" 352#include "_prelude_terrain.vertex.glsl" 353#define NUM_VISIBILITY_RINGS 2 354#define INV_SQRT2 0.70710678 355#define ELEVATION_BIAS 0.0001 356#define NUM_SAMPLES_PER_RING 16 357uniform mat4 u_matrix;uniform mat2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;in ivec2 a_pos; 358#ifdef PROJECTION_GLOBE_VIEW 359in ivec4 a_pos_3;in ivec4 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir; 360#endif 361#ifdef ELEVATED_ROADS 362in float a_circle_z_offset; 363#endif 364out vec3 v_data;out float v_visibility; 365#pragma mapbox: define highp vec4 color 366#pragma mapbox: define mediump float radius 367#pragma mapbox: define lowp float blur 368#pragma mapbox: define lowp float opacity 369#pragma mapbox: define highp vec4 stroke_color 370#pragma mapbox: define mediump float stroke_width 371#pragma mapbox: define lowp float stroke_opacity 372vec2 calc_offset(vec2 extrusion,float radius,float stroke_width, float view_scale) {return extrusion*(radius+stroke_width)*u_extrude_scale*view_scale;}float cantilevered_elevation(vec2 pos,float radius,float stroke_width,float view_scale) {vec2 c1=pos+calc_offset(vec2(-1.0,-1.0),radius,stroke_width,view_scale);vec2 c2=pos+calc_offset(vec2(1.0,-1.0),radius,stroke_width,view_scale);vec2 c3=pos+calc_offset(vec2(1.0,1.0),radius,stroke_width,view_scale);vec2 c4=pos+calc_offset(vec2(-1.0,1.0),radius,stroke_width,view_scale);float h1=elevation(c1)+ELEVATION_BIAS;float h2=elevation(c2)+ELEVATION_BIAS;float h3=elevation(c3)+ELEVATION_BIAS;float h4=elevation(c4)+ELEVATION_BIAS;return max(h4,max(h3,max(h1,h2)));}float circle_elevation(vec2 pos) { 373#if defined(TERRAIN) 374return elevation(pos)+ELEVATION_BIAS; 375#else 376return 0.0; 377#endif 378}vec4 project_vertex(vec2 extrusion,vec4 world_center,vec4 projected_center,float radius,float stroke_width, float view_scale,mat3 surface_vectors) {vec2 sample_offset=calc_offset(extrusion,radius,stroke_width,view_scale); 379#ifdef PITCH_WITH_MAP 380#ifdef PROJECTION_GLOBE_VIEW 381return u_matrix*( world_center+vec4(sample_offset.x*surface_vectors[0]+sample_offset.y*surface_vectors[1],0) ); 382#else 383return u_matrix*( world_center+vec4(sample_offset,0,0) ); 384#endif 385#else 386return projected_center+vec4(sample_offset,0,0); 387#endif 388}float get_sample_step() { 389#ifdef PITCH_WITH_MAP 390return 2.0*PI/float(NUM_SAMPLES_PER_RING); 391#else 392return PI/float(NUM_SAMPLES_PER_RING); 393#endif 394}void main() { 395#pragma mapbox: initialize highp vec4 color 396#pragma mapbox: initialize mediump float radius 397#pragma mapbox: initialize lowp float blur 398#pragma mapbox: initialize lowp float opacity 399#pragma mapbox: initialize highp vec4 stroke_color 400#pragma mapbox: initialize mediump float stroke_width 401#pragma mapbox: initialize lowp float stroke_opacity 402vec2 pos2=vec2(a_pos);vec2 extrude=vec2(mod(pos2,2.0)*2.0-1.0);vec2 circle_center=floor(pos2*0.5);float height=circle_elevation(circle_center);vec4 world_center;mat3 surface_vectors; 403#ifdef PROJECTION_GLOBE_VIEW 404surface_vectors=globe_mercator_surface_vectors(vec3(a_pos_normal_3)/16384.0,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(circle_center)*height;vec3 globe_pos=vec3(a_pos_3)+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*height;vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,circle_center,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;vec3 pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);world_center=vec4(pos,1); 405#else
406surface_vectors=mat3(1.0);world_center=vec4(circle_center,height,1); 407#endif 408#ifdef ELEVATED_ROADS 409world_center.z+=a_circle_z_offset+ELEVATION_BIAS; 410#endif 411vec4 projected_center=u_matrix*world_center;float view_scale=0.0; 412#ifdef PITCH_WITH_MAP 413#ifdef SCALE_WITH_MAP 414view_scale=1.0; 415#else 416view_scale=projected_center.w/u_camera_to_center_distance; 417#endif 418#else 419#ifdef SCALE_WITH_MAP 420view_scale=u_camera_to_center_distance; 421#else 422view_scale=projected_center.w; 423#endif 424#endif 425gl_Position=project_vertex(extrude,world_center,projected_center,radius,stroke_width,view_scale,surface_vectors);float visibility=0.0; 426#ifdef TERRAIN 427float step=get_sample_step();vec4 occlusion_world_center;vec4 occlusion_projected_center; 428#ifdef PITCH_WITH_MAP 429float cantilevered_height=cantilevered_elevation(circle_center,radius,stroke_width,view_scale);occlusion_world_center=vec4(circle_center,cantilevered_height,1);occlusion_projected_center=u_matrix*occlusion_world_center; 430#else 431occlusion_world_center=world_center;occlusion_projected_center=projected_center; 432#endif 433for(int ring=0; ring < NUM_VISIBILITY_RINGS; ring++) {float scale=(float(ring)+1.0)/float(NUM_VISIBILITY_RINGS);for(int i=0; i < NUM_SAMPLES_PER_RING; i++) {vec2 extrusion=vec2(cos(step*float(i)),-sin(step*float(i)))*scale;vec4 frag_pos=project_vertex(extrusion,occlusion_world_center,occlusion_projected_center,radius,stroke_width,view_scale,surface_vectors);visibility+=float(!isOccluded(frag_pos));}}visibility/=float(NUM_VISIBILITY_RINGS)*float(NUM_SAMPLES_PER_RING); 434#else 435visibility=1.0; 436#endif 437#ifdef PROJECTION_GLOBE_VIEW 438visibility=1.0; 439#endif 440v_visibility=visibility;lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur); 441#ifdef FOG 442v_fog_pos=fog_position(world_center.xyz); 443#endif 444}`),clippingMask:Ft("void main() {glFragColor=vec4(1.0);}","in ivec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),heatmap:Ft(`#include "_prelude_fog.fragment.glsl" 445uniform highp float u_intensity;in vec2 v_extrude; 446#pragma mapbox: define highp float weight 447#define GAUSS_COEF 0.3989422804014327 448void main() { 449#pragma mapbox: initialize highp float weight 450float d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);glFragColor=vec4(val,1.0,1.0,1.0); 451#ifdef FOG 452if (u_is_globe==0) {glFragColor.r*=pow(1.0-fog_opacity(v_fog_pos),2.0);} 453#endif 454#ifdef OVERDRAW_INSPECTOR 455glFragColor=vec4(1.0); 456#endif 457HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_terrain.vertex.glsl" 458#include "_prelude_fog.vertex.glsl" 459uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;in ivec2 a_pos; 460#ifdef PROJECTION_GLOBE_VIEW 461in ivec4 a_pos_3;in ivec4 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir; 462#endif 463out vec2 v_extrude; 464#pragma mapbox: define highp float weight 465#pragma mapbox: define mediump float radius 466const highp float ZERO=1.0/255.0/16.0; 467#define GAUSS_COEF 0.3989422804014327 468void main() { 469#pragma mapbox: initialize highp float weight 470#pragma mapbox: initialize mediump float radius 471vec2 unscaled_extrude=vec2(mod(vec2(a_pos),2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec2 tilePos=floor(vec2(a_pos)*0.5);vec3 pos; 472#ifdef PROJECTION_GLOBE_VIEW 473vec3 pos_normal_3=vec3(a_pos_normal_3)/16384.0;mat3 surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(tilePos)*elevation(tilePos);vec3 globe_pos=vec3(a_pos_3)+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*elevation(tilePos);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,tilePos,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition); 474#else 475pos=vec3(tilePos+extrude,elevation(tilePos)); 476#endif 477gl_Position=u_matrix*vec4(pos,1); 478#ifdef FOG 479v_fog_pos=fog_position(pos); 480#endif 481}`),heatmapTexture:Ft(`uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;in vec2 v_pos;void main() {float t=texture(u_image,v_pos).r;vec4 color=texture(u_color_ramp,vec2(t,0.5));glFragColor=color*u_opacity; 482#ifdef OVERDRAW_INSPECTOR 483glFragColor=vec4(0.0); 484#endif 485HANDLE_WIREFRAME_DEBUG;}`,"in ivec2 a_pos;out vec2 v_pos;void main() {gl_Position=vec4(a_pos,0,1);v_pos=vec2(a_pos)*0.5+0.5;}"),collisionBox:Ft("in float v_placed;in float v_notUsed;void main() {vec4 red =vec4(1.0,0.0,0.0,1.0);vec4 blue=vec4(0.0,0.0,1.0,0.5);glFragColor =mix(red,blue,step(0.5,v_placed))*0.5;glFragColor*=mix(1.0,0.1,step(0.5,v_notUsed));}",`#include "_prelude_terrain.vertex.glsl" 486in ivec4 a_pos;in ivec2 a_anchor_pos;in ivec2 a_extrude;in uvec2 a_placed;in vec2 a_shift;in vec2 a_elevation_from_sea;in float a_size_scale;in vec2 a_padding;in float a_auto_z_offset;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance; 487#ifdef PROJECTION_GLOBE_VIEW 488uniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform float u_zoom_transition; 489#endif 490out float v_placed;out float v_notUsed;void main() {vec2 anchor_pos=vec2(a_anchor_pos);float feature_elevation=a_elevation_from_sea.x+a_auto_z_offset;float terrain_elevation=(a_elevation_from_sea.y==1.0 ? 0.0 : elevation(anchor_pos));vec3 proj_pos=vec3(a_pos)+elevationVector(anchor_pos)*(feature_elevation+terrain_elevation); 491#ifdef PROJECTION_GLOBE_VIEW 492#ifndef PROJECTED_POS_ON_VIEWPORT 493vec3 globe_pos=proj_pos;vec3 mercator_pos=mercator_tile_position(u_inv_rot_matrix,anchor_pos,u_tile_id,u_merc_center);proj_pos=mix_globe_mercator(globe_pos,mercator_pos,u_zoom_transition); 494#endif 495#endif 496vec4 projectedPoint=u_matrix*vec4(proj_pos,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp( 4970.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,1.5);gl_Position=projectedPoint;gl_Position.xy+=(vec2(a_extrude)*a_size_scale+a_shift+a_padding)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=float(a_placed.x);v_notUsed=float(a_placed.y);}`),collisionCircle:Ft("in float v_radius;in vec2 v_extrude;in float v_perspective_ratio;in float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);glFragColor=color*alpha*opacity_t;}",`in vec2 a_pos_2f;in float a_radius;in ivec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;out float v_radius;out vec2 v_extrude;out float v_perspective_ratio;out float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos_2f;float radius=a_radius;int vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2( 498mix(-1.0,1.0,float(vertexIdx >=2)),mix(-1.0,1.0,float(vertexIdx >=1 && vertexIdx <=2)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp( 4990.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=float(a_flags.x);gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}`),debug:Ft("uniform highp vec4 u_color;uniform sampler2D u_overlay;in vec2 v_uv;void main() {vec4 overlay_color=texture(u_overlay,v_uv);glFragColor=mix(u_color,overlay_color,overlay_color.a);}",`#include "_prelude_terrain.vertex.glsl" 500in ivec2 a_pos; 501#ifdef PROJECTION_GLOBE_VIEW 502in ivec4 a_pos_3; 503#endif 504out vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {vec2 pos=vec2(a_pos);float h=elevation(pos);v_uv=pos/8192.0; 505#ifdef PROJECTION_GLOBE_VIEW
506gl_Position=u_matrix*vec4(vec3(a_pos_3)+elevationVector(pos)*h,1); 507#else 508gl_Position=u_matrix*vec4(pos*u_overlay_scale,h,1); 509#endif 510}`),elevatedStructuresDepth:Ft("void main() {}","in ivec2 a_pos;in float a_height;uniform mat4 u_matrix;uniform float u_depth_bias;void main() {gl_Position=u_matrix*vec4(a_pos,a_height,1);gl_Position.z=gl_Position.z+u_depth_bias;}"),elevatedStructuresDepthReconstruct:Ft(`#ifdef DEPTH_RECONSTRUCTION 511in float v_height; 512#endif 513void main() { 514#ifdef DEPTH_RECONSTRUCTION 515if (v_height >=0.0) 516discard; 517#else 518#ifdef FEATURE_CUTOUT 519apply_feature_cutout(vec4(0.0,0.0,0.0,1.0),gl_FragCoord,get_cutout_factors(gl_FragCoord).x); 520#endif 521#endif 522glFragColor=vec4(1.0,0.0,0.0,1.0);}`,`in ivec2 a_pos;in float a_height;uniform mat4 u_matrix;uniform vec3 u_camera_pos;uniform highp float u_depth_bias;uniform lowp float u_height_scale;uniform lowp float u_reset_depth; 523#ifdef DEPTH_RECONSTRUCTION 524out float v_height; 525#endif 526void main() {vec3 vpos=vec3(a_pos,a_height*u_height_scale); 527#ifdef DEPTH_RECONSTRUCTION 528if (u_camera_pos.z > vpos.z) {vpos-=(u_camera_pos-vpos)*(vpos.z/(u_camera_pos.z-vpos.z));}v_height=a_height; 529#endif 530gl_Position=u_matrix*vec4(vpos,1);gl_Position.z=u_reset_depth==1.0 ? gl_Position.w : gl_Position.z+u_depth_bias;}`),elevatedStructures:Ft(`#include "_prelude_fog.fragment.glsl" 531#include "_prelude_lighting.glsl" 532#include "_prelude_shadow.fragment.glsl" 533in vec3 v_normal;in float v_height; 534#ifdef RENDER_SHADOWS 535in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in float v_depth; 536#endif 537vec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}
537vec3 compute_view_dependent_emissive_color(float ndotl,float emissive_strength,vec3 color) 538{color=sRGBToLinear(color);color=color*(ndotl+(1.0-min(ndotl*57.29,1.0))*emissive_strength);color=linearTosRGB(color.rgb);return color;}uniform float u_emissive_strength; 539#pragma mapbox: define highp vec4 structure_color 540void main() { 541#pragma mapbox: initialize highp vec4 structure_color 542vec3 color=structure_color.xyz;vec2 cutout_factors=vec2(0.0); 543#ifdef FEATURE_CUTOUT 544cutout_factors=get_cutout_factors(gl_FragCoord); 545#endif 546#ifdef LIGHTING_3D_MODE 547vec3 normal=normalize(v_normal);vec3 transformed_normal=vec3(-normal.xy,normal.z);float ndotl=calculate_NdotL(transformed_normal);float emissive_strength=u_emissive_strength;emissive_strength=0.0;vec3 emissive_color=compute_view_dependent_emissive_color(ndotl,emissive_strength,color.xyz); 548#ifdef RENDER_SHADOWS 549float light=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth);light=mix(light,1.0,cutout_factors.y);color.rgb=apply_lighting(color.rgb,transformed_normal,light); 550#else 551color=apply_lighting(color,transformed_normal); 552#endif 553color=mix(color,emissive_color,emissive_strength);if (v_height < 0.0) {float penetration=max(v_height+7.5,0.0);float occlusion=1.0-1.0/PI*acos(1.0-penetration/4.0);color=color*(1.0-pow(occlusion,2.0)*0.3);} 554#endif 555#ifdef FOG 556color=fog_apply(color,v_fog_pos); 557#endif 558vec4 out_color=vec4(color,1.0); 559#ifdef INDICATOR_CUTOUT 560out_color=applyCutout(out_color,v_height); 561#endif 562#ifdef FEATURE_CUTOUT 563out_color=apply_feature_cutout(out_color,gl_FragCoord,cutout_factors.x); 564#endif 565glFragColor=out_color;HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 566#include "_prelude_shadow.vertex.glsl" 567in ivec2 a_pos;in float a_height;in ivec4 a_pos_normal_3;uniform mat4 u_matrix;out vec3 v_normal;out float v_height; 568#ifdef RENDER_SHADOWS 569uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out float v_depth; 570#endif 571#pragma mapbox: define highp vec4 structure_color 572void main() { 573#pragma mapbox: initialize highp vec4 structure_color 574v_normal=vec3(a_pos_normal_3)/16384.0;v_height=a_height;vec3 pos=vec3(vec2(a_pos),a_height);gl_Position=u_matrix*vec4(pos,1); 575#ifdef RENDER_SHADOWS 576vec3 shd_pos0=pos;vec3 shd_pos1=pos; 577#ifdef NORMAL_OFFSET 578vec3 offset=shadow_normal_offset(vec3(-v_normal.xy,v_normal.z));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1(); 579#endif 580v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w; 581#endif 582#ifdef FOG 583v_fog_pos=fog_position(vec2(a_pos)); 584#endif 585}`),fill:Ft(`#include "_prelude_fog.fragment.glsl" 586#include "_prelude_lighting.glsl" 587#include "_prelude_shadow.fragment.glsl" 588#pragma mapbox: define highp vec4 color 589#pragma mapbox: define lowp float opacity 590uniform float u_emissive_strength; 591#ifdef RENDER_SHADOWS 592uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth; 593#endif 594#ifdef ELEVATED_ROADS 595in highp float v_road_z_offset; 596#endif 597#ifdef INDICATOR_CUTOUT 598in highp float v_z_offset; 599#endif 600void main() { 601#pragma mapbox: initialize highp vec4 color 602#pragma mapbox: initialize lowp float opacity 603vec2 cutout_factors=vec2(0.0); 604#ifdef FEATURE_CUTOUT 605cutout_factors=get_cutout_factors(gl_FragCoord); 606#endif 607vec4 out_color=color; 608#ifdef LIGHTING_3D_MODE 609out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); 610#ifdef RENDER_SHADOWS 611float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);light=mix(light,1.0,cutout_factors.y);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light); 612#endif 613#endif 614#ifdef FOG 615out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); 616#endif 617out_color*=opacity; 618#ifdef INDICATOR_CUTOUT 619if (v_z_offset >=0.0) {out_color=applyCutout(out_color,v_z_offset);} 620#endif 621#ifdef FEATURE_CUTOUT 622out_color=apply_feature_cutout(out_color,gl_FragCoord,cutout_factors.x); 623#endif 624glFragColor=out_color; 625#ifdef USE_MRT1 626out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a); 627#endif 628#ifdef OVERDRAW_INSPECTOR 629glFragColor=vec4(1.0); 630#endif 631HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 632#include "_prelude_shadow.vertex.glsl" 633in ivec2 a_pos; 634#ifdef ELEVATED_ROADS 635in float a_road_z_offset;out highp float v_road_z_offset; 636#endif 637#ifdef RENDER_SHADOWS 638uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth; 639#endif 640#ifdef INDICATOR_CUTOUT 641out highp float v_z_offset; 642#endif 643uniform mat4 u_matrix; 644#pragma mapbox: define highp vec4 color 645#pragma mapbox: define lowp float opacity 646#pragma mapbox: define highp float z_offset 647void main() { 648#pragma mapbox: initialize highp vec4 color 649#pragma mapbox: initialize lowp float opacity 650#pragma mapbox: initialize highp float z_offset 651#ifdef ELEVATED_ROADS 652z_offset+=a_road_z_offset;v_road_z_offset=z_offset; 653#endif 654float hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden); 655#ifdef RENDER_SHADOWS 656vec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset); 657#ifdef NORMAL_OFFSET 658vec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1(); 659#endif 660v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w; 661#endif 662#ifdef FOG 663v_fog_pos=fog_position(vec2(a_pos)); 664#endif 665#ifdef INDICATOR_CUTOUT 666v_z_offset=z_offset; 667#endif 668}`),fillOutline:Ft(`#include "_prelude_fog.fragment.glsl" 669#include "_prelude_lighting.glsl" 670#include "_prelude_shadow.fragment.glsl" 671in highp vec2 v_pos;uniform float u_emissive_strength; 672#ifdef RENDER_SHADOWS 673uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth; 674#endif 675#pragma mapbox: define highp vec4 outline_color 676#pragma mapbox: define lowp float opacity 677void main() { 678#pragma mapbox: initialize highp vec4 outline_color 679#pragma mapbox: initialize lowp float opacity 680float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=outline_color;vec2 cutout_factors=vec2(0.0); 681#ifdef FEATURE_CUTOUT 682cutout_factors=get_cutout_factors(gl_FragCoord); 683#endif 684#ifdef LIGHTING_3D_MODE 685out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); 686#ifdef RENDER_SHADOWS 687float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);light=mix(light,1.0,cutout_factors.y);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light); 688#endif 689#endif 690#ifdef FOG 691out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); 692#endif 693#ifdef FEATURE_CUTOUT 694out_color=apply_feature_cutout(out_color,gl_FragCoord,cutout_factors.x); 695#endif 696glFragColor=out_color*(alpha*opacity); 697#ifdef USE_MRT1 698out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a); 699#endif 700#ifdef OVERDRAW_INSPECTOR 701glFragColor=vec4(1.0); 702#endif 703HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 704#include "_prelude_shadow.vertex.glsl" 705in ivec2 a_pos; 706#ifdef ELEVATED_ROADS 707in float a_road_z_offset; 708#endif 709#ifdef RENDER_SHADOWS 710uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth; 711#endif 712uniform mat4 u_matrix;uniform vec2 u_world;out highp vec2 v_pos; 713#pragma mapbox: define highp vec4 outline_color 714#pragma mapbox: define lowp float opacity 715#pragma mapbox: define highp float z_offset 716void main() { 717#pragma mapbox: initialize highp vec4 outline_color 718#pragma mapbox: initialize lowp float opacity 719#pragma mapbox: initialize highp float z_offset 720#ifdef ELEVATED_ROADS 721z_offset+=a_road_z_offset; 722#endif 723float hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden); 724#ifdef FLIP_Y 725v_pos=(vec2(gl_Position.x,-gl_Position.y)/gl_Position.w+1.0)/2.0*u_world; 726#else 727v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world; 728#endif 729#ifdef RENDER_SHADOWS 730vec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset); 731#ifdef NORMAL_OFFSET 732vec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1(); 733#endif 734v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w; 735#endif 736#ifdef FOG 737v_fog_pos=fog_position(vec2(a_pos)); 738#endif 739}`),fillOutlinePattern:Ft(`#include "_prelude_fog.fragment.glsl" 740#include "_prelude_lighting.glsl" 741#include "_prelude_shadow.fragment.glsl" 742uniform vec2 u_texsize;uniform sampler2D u_image; 743#ifdef FILL_PATTERN_TRANSITION 744uniform float u_pattern_transition; 745#endif 746uniform float u_emissive_strength; 747#ifdef APPLY_LUT_ON_GPU 748uniform highp sampler3D u_lutTexture; 749#endif 750#ifdef RENDER_SHADOWS 751uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth; 752#endif 753in highp vec2 v_pos;in highp vec2 v_pos_world; 754#pragma mapbox: define lowp float opacity 755#pragma mapbox: define lowp uvec4 pattern 756#ifdef FILL_PATTERN_TRANSITION 757#pragma mapbox: define mediump uvec4 pattern_b 758#endif 759void main() { 760#pragma mapbox: initialize lowp float opacity 761#pragma mapbox: initialize mediump uvec4 pattern 762#ifdef FILL_PATTERN_TRANSITION 763#pragma mapbox: initialize mediump uvec4 pattern_b 764#endif 765vec2 pattern_tl=vec2(pattern.xy);vec2 pattern_br=vec2(pattern.zw);highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);highp vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);float dist=length(v_pos_world-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=textureLodCustom(u_image,pos,lod_pos); 766#ifdef APPLY_LUT_ON_GPU 767out_color=applyLUT(u_lutTexture,out_color); 768#endif 769#ifdef FILL_PATTERN_TRANSITION 770vec2 pattern_b_tl=pattern_b.xy;vec2 pattern_b_br=pattern_b.zw;highp vec2 pos_b=mix(pattern_b_tl/u_texsize,pattern_b_br/u_texsize,imagecoord);vec4 color_b=textureLodCustom(u_image,pos_b,lod_pos);out_color=out_color*(1.0-u_pattern_transition)+color_b*u_pattern_transition; 771#endif 772vec2 cutout_factors=vec2(0.0); 773#ifdef FEATURE_CUTOUT 774cutout_factors=get_cutout_factors(gl_FragCoord); 775#endif 776#ifdef LIGHTING_3D_MODE 777out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); 778#ifdef RENDER_SHADOWS 779float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);light=mix(light,1.0,cutout_factors.y);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light); 780#endif 781#endif 782#ifdef FEATURE_CUTOUT 783out_color=apply_feature_cutout(out_color,gl_FragCoord,cutout_factors.x); 784#endif 785#ifdef FOG 786out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); 787#endif 788glFragColor=out_color*(alpha*opacity); 789#ifdef USE_MRT1 790out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a); 791#endif 792#ifdef OVERDRAW_INSPECTOR 793glFragColor=vec4(1.0); 794#endif 795HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 796#include "_prelude_shadow.vertex.glsl" 797uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in ivec2 a_pos; 798#ifdef ELEVATED_ROADS 799in float a_road_z_offset; 800#endif 801#ifdef RENDER_SHADOWS 802uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth; 803#endif 804out highp vec2 v_pos;out highp vec2 v_pos_world; 805#pragma mapbox: define lowp float opacity 806#pragma mapbox: define lowp uvec4 pattern 807#ifdef FILL_PATTERN_TRANSITION 808#pragma mapbox: define mediump uvec4 pattern_b 809#endif 810#pragma mapbox: define lowp float pixel_ratio 811#pragma mapbox: define highp float z_offset 812void main() { 813#pragma mapbox: initialize lowp float opacity 814#pragma mapbox: initialize mediump uvec4 pattern 815#ifdef FILL_PATTERN_TRANSITION 816#pragma mapbox: initialize mediump uvec4 pattern_b 817#endif 818#pragma mapbox: initialize lowp float pixel_ratio 819#pragma mapbox: initialize highp float z_offset 820vec2 pattern_tl=vec2(pattern.xy);vec2 pattern_br=vec2(pattern.zw); 821#ifdef ELEVATED_ROADS 822z_offset+=a_road_z_offset; 823#endif 824float hidden=float(opacity==0.0);vec2 pos=vec2(a_pos);gl_Position=mix(u_matrix*vec4(pos,z_offset,1),AWAY,hidden);vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,pos); 825#ifdef FLIP_Y 826v_pos_world=(vec2(gl_Position.x,-gl_Position.y)/gl_Position.w+1.0)/2.0*u_world; 827#else 828v_pos_world=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world; 829#endif 830#ifdef RENDER_SHADOWS 831vec3 shd_pos0=vec3(pos,z_offset);vec3 shd_pos1=vec3(pos,z_offset); 832#ifdef NORMAL_OFFSET 833vec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1(); 834#endif 835v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w; 836#endif 837#ifdef FOG 838v_fog_pos=fog_position(pos); 839#endif 840}`),fillPattern:Ft(`#include "_prelude_fog.fragment.glsl" 841#include "_prelude_lighting.glsl" 842#include "_prelude_shadow.fragment.glsl" 843uniform vec2 u_texsize;uniform sampler2D u_image; 844#ifdef FILL_PATTERN_TRANSITION 845uniform float u_pattern_transition; 846#endif 847in highp vec2 v_pos;uniform float u_emissive_strength; 848#ifdef RENDER_SHADOWS 849uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth; 850#endif 851#ifdef ELEVATED_ROADS 852in highp float v_road_z_offset; 853#endif 854#ifdef APPLY_LUT_ON_GPU 855uniform highp sampler3D u_lutTexture; 856#endif 857#pragma mapbox: define lowp float opacity 858#pragma mapbox: define lowp uvec4 pattern 859#ifdef FILL_PATTERN_TRANSITION 860#pragma mapbox: define mediump uvec4 pattern_b 861#endif 862void main() { 863#pragma mapbox: initialize lowp float opacity 864#pragma mapbox: initialize mediump uvec4 pattern 865#ifdef FILL_PATTERN_TRANSITION 866#pragma mapbox: initialize mediump uvec4 pattern_b 867#endif 868vec2 pattern_tl=vec2(pattern.xy);vec2 pattern_br=vec2(pattern.zw);highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);highp vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);vec4 out_color=textureLodCustom(u_image,pos,lod_pos); 869#ifdef APPLY_LUT_ON_GPU 870out_color=applyLUT(u_lutTexture,out_color); 871#endif 872#ifdef FILL_PATTERN_TRANSITION 873vec2 pattern_b_tl=vec2(pattern_b.xy);vec2 pattern_b_br=vec2(pattern_b.zw);highp vec2 pos_b=mix(pattern_b_tl/u_texsize,pattern_b_br/u_texsize,imagecoord);vec4 color_b=textureLodCustom(u_image,pos_b,lod_pos);out_color=out_color*(1.0-u_pattern_transition)+color_b*u_pattern_transition; 874#endif 875vec2 cutout_factors=vec2(0.0); 876#ifdef FEATURE_CUTOUT 877cutout_factors=get_cutout_factors(gl_FragCoord); 878#endif 879#ifdef LIGHTING_3D_MODE 880out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); 881#ifdef RENDER_SHADOWS 882float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);light=mix(light,1.0,cutout_factors.y); 883#ifdef ELEVATED_ROADS 884out_color.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light); 885#else 886out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light); 887#endif 888#endif 889#endif 890#ifdef FEATURE_CUTOUT 891out_color=apply_feature_cutout(out_color,gl_FragCoord,cutout_factors.x); 892#endif 893#ifdef FOG 894out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); 895#endif 896glFragColor=out_color*opacity; 897#ifdef USE_MRT1 898out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a); 899#endif 900#ifdef OVERDRAW_INSPECTOR 901glFragColor=vec4(1.0); 902#endif 903HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 904#include "_prelude_shadow.vertex.glsl" 905uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in ivec2 a_pos; 906#ifdef ELEVATED_ROADS 907in float a_road_z_offset;out highp float v_road_z_offset; 908#endif 909#ifdef RENDER_SHADOWS 910uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp floa
910t v_depth; 911#endif 912out highp vec2 v_pos; 913#pragma mapbox: define lowp float opacity 914#pragma mapbox: define lowp uvec4 pattern 915#ifdef FILL_PATTERN_TRANSITION 916#pragma mapbox: define mediump uvec4 pattern_b 917#endif 918#pragma mapbox: define lowp float pixel_ratio 919#pragma mapbox: define highp float z_offset 920void main() { 921#pragma mapbox: initialize lowp float opacity 922#pragma mapbox: initialize mediump uvec4 pattern 923#pragma mapbox: initialize lowp float pixel_ratio 924#pragma mapbox: initialize highp float z_offset 925#ifdef FILL_PATTERN_TRANSITION 926#pragma mapbox: initialize mediump uvec4 pattern_b 927#endif 928vec2 pattern_tl=vec2(pattern.xy);vec2 pattern_br=vec2(pattern.zw);vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio; 929#ifdef ELEVATED_ROADS 930z_offset+=a_road_z_offset;v_road_z_offset=z_offset; 931#endif 932float hidden=float(opacity==0.0);vec2 pos=vec2(a_pos);gl_Position=mix(u_matrix*vec4(pos,z_offset,1),AWAY,hidden);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,pos); 933#ifdef RENDER_SHADOWS 934vec3 shd_pos0=vec3(pos,z_offset);vec3 shd_pos1=vec3(pos,z_offset); 935#ifdef NORMAL_OFFSET 936vec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1(); 937#endif 938v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w; 939#endif 940#ifdef FOG 941v_fog_pos=fog_position(pos); 942#endif 943}`),lineBlendComposite:Ft(`uniform highp sampler2D u_image;uniform float u_opacity;uniform int u_blend_mode;uniform highp float u_max_density;in vec2 v_pos; 944#define ADDITIVE 1 945void main() {vec4 color=texture(u_image,v_pos);if (u_blend_mode==ADDITIVE) {if (color.a <=0.0) {discard;}highp float density=color.a;vec3 avgColor=color.rgb/max(density,0.001);highp float n=density/max(u_max_density,0.001);highp float t=sqrt(n/(n+1.0));glFragColor=vec4(avgColor*t,t);} else {vec3 multiplyFactor=color.rgb*u_opacity+(1.0-u_opacity);glFragColor=vec4(multiplyFactor,1.0);} 946#ifdef OVERDRAW_INSPECTOR 947glFragColor=vec4(0.0); 948#endif 949HANDLE_WIREFRAME_DEBUG;}`,"in ivec2 a_pos;out vec2 v_pos;void main() {gl_Position=vec4(a_pos,0,1);v_pos=vec2(a_pos)*0.5+0.5;}"),lineBlendReduce:Ft("uniform highp sampler2D u_image;uniform vec2 u_texel_size;uniform bool u_first_pass;in vec2 v_pos;void main() {vec2 o=u_texel_size*0.5;vec4 s0=texture(u_image,v_pos+vec2(-o.x,-o.y));vec4 s1=texture(u_image,v_pos+vec2( o.x,-o.y));vec4 s2=texture(u_image,v_pos+vec2(-o.x, o.y));vec4 s3=texture(u_image,v_pos+vec2( o.x, o.y));float r0; float g0;float r1; float g1;float r2; float g2;float r3; float g3;if (u_first_pass) {float a0=s0.a;float a1=s1.a;float a2=s2.a;float a3=s3.a;r0=a0; g0=a0 > 0.0 ? 1.0 : 0.0;r1=a1; g1=a1 > 0.0 ? 1.0 : 0.0;r2=a2; g2=a2 > 0.0 ? 1.0 : 0.0;r3=a3; g3=a3 > 0.0 ? 1.0 : 0.0;} else {r0=s0.r; g0=s0.g;r1=s1.r; g1=s1.g;r2=s2.r; g2=s2.g;r3=s3.r; g3=s3.g;}glFragColor=vec4((r0+r1+r2+r3)*0.25,(g0+g1+g2+g3)*0.25,0.0,0.0);}","in ivec2 a_pos;out vec2 v_pos;void main() {gl_Position=vec4(a_pos,0,1);v_pos=vec2(a_pos)*0.5+0.5;}"),fillExtrusion:Ft(`#include "_prelude_fog.fragment.glsl" 950#include "_prelude_shadow.fragment.glsl" 951#include "_prelude_lighting.glsl" 952in vec4 v_color;in vec4 v_flat; 953#ifdef RENDER_SHADOWS 954in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1; 955#endif 956uniform lowp float u_opacity; 957#ifdef RENDER_FRONT_CUTOFF 958in float v_front_cutoff_opacity; 959#endif 960#ifdef INDICATOR_CUTOUT 961#ifdef FEATURE_CUTOUT 962in vec4 v_ground_roof; 963#endif 964#endif 965#ifdef FAUX_AO 966uniform lowp vec2 u_ao;in vec2 v_ao; 967#endif 968#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE) 969in vec4 v_roof_color; 970#endif 971#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE) 972in highp vec3 v_normal; 973#endif 974uniform vec3 u_flood_light_color;uniform highp float u_vertical_scale;uniform float u_flood_light_intensity;uniform vec3 u_ground_shadow_factor; 975#if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT) 976in float v_flood_radius;in float v_has_floodlight; 977#endif 978in float v_height; 979#pragma mapbox: define highp float emissive_strength 980void main() { 981#pragma mapbox: initialize highp float emissive_strength 982#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE) 983vec3 normal=normalize(v_normal); 984#endif 985float z;vec4 color=v_color; 986#ifdef ZERO_ROOF_RADIUS 987z=float(normal.z > 0.00001); 988#ifdef LIGHTING_3D_MODE 989normal=mix(normal,vec3(0.0,0.0,1.0),z); 990#else 991color=mix(v_color,v_roof_color,z); 992#endif 993#endif 994float h=max(0.0,v_height);float ao_shade=1.0; 995#ifdef FAUX_AO 996float intensity=u_ao[0];float h_floors=h/(u_ao[1]*u_vertical_scale);float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);ao_shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0
996),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x; 997#ifdef ZERO_ROOF_RADIUS 998concave*=(1.0-z); 999#endif 1000float x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);ao_shade*=mix(1.0,x_shade*x_shade*x_shade,concave); 1001#ifdef LIGHTING_3D_MODE 1002#ifdef FLOOD_LIGHT 1003color.rgb*=mix(ao_shade,1.0,v_has_floodlight); 1004#else 1005color.rgb*=ao_shade; 1006#endif 1007#else 1008color.rgb*=ao_shade; 1009#endif 1010#endif 1011#ifdef LIGHTING_3D_MODE 1012float flood_radiance=0.0; 1013#ifdef FLOOD_LIGHT 1014flood_radiance=(1.0-min(h/v_flood_radius,1.0))*u_flood_light_intensity*v_has_floodlight; 1015#endif 1016#ifdef RENDER_SHADOWS 1017#ifdef FLOOD_LIGHT 1018float ndotl_unclamped=dot(normal,u_shadow_direction);float ndotl=max(0.0,ndotl_unclamped);float occlusion=ndotl_unclamped < 0.0 ? 1.0 : shadow_occlusion(ndotl,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);vec3 litColor=apply_lighting(color.rgb,normal,(1.0-u_shadow_intensity*occlusion)*ndotl);vec3 floodLitColor=compute_flood_lighting(u_flood_light_color*u_opacity,1.0-u_shadow_intensity,occlusion,u_ground_shadow_factor);color.rgb=mix(litColor,floodLitColor,flood_radiance); 1019#else 1020float shadowed_lighting_factor; 1021#ifdef RENDER_CUTOFF 1022shadowed_lighting_factor=shadowed_light_factor_normal_opacity(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w,v_cutoff_opacity);if (v_cutoff_opacity==0.0) {discard;} 1023#else 1024shadowed_lighting_factor=shadowed_light_factor_normal(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w); 1025#endif 1026color.rgb=apply_lighting(color.rgb,normal,shadowed_lighting_factor); 1027#endif 1028#else 1029color.rgb=apply_lighting(color.rgb,normal); 1030#ifdef FLOOD_LIGHT 1031color.rgb=mix(color.rgb,u_flood_light_color*u_opacity,flood_radiance); 1032#endif 1033#endif 1034color.rgb=mix(color.rgb,v_flat.rgb,emissive_strength);color*=u_opacity; 1035#endif 1036#ifdef FOG 1037color=fog_dither(fog_apply_premultiplied(color,v_fog_pos,h)); 1038#endif 1039#ifdef INDICATOR_CUTOUT 1040#ifdef FEATURE_CUTOUT 1041{float ditherOpacity=cutoutGroundRoofOpacity(v_ground_roof);if (ditherOpacity < 1.0) {int index=(int(gl_FragCoord.x) % 4)*4+(int(gl_FragCoord.y) % 4);if (ditherOpacity < DITHER_THRESHOLDS[index]) {discard;}}} 1042#else 1043color=applyCutout(color,h); 1044#endif 1045#endif 1046#ifdef RENDER_FRONT_CUTOFF 1047if (v_front_cutoff_opacity < 1.0) {int index=(int(gl_FragCoord.x) % 4)*4+(int(gl_FragCoord.y) % 4);if (v_front_cutoff_opacity < DITHER_THRESHOLDS[index]) {discard;}} 1048#endif 1049#ifdef FEATURE_CUTOUT 1050color=apply_feature_cutout(color,gl_FragCoord,get_cutout_factors(gl_FragCoord).x); 1051#endif 1052glFragColor=color; 1053#ifdef OVERDRAW_INSPECTOR 1054glFragColor=vec4(1.0); 1055#endif 1056HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 1057#include "_prelude_terrain.vertex.glsl" 1058#include "_prelude_shadow.vertex.glsl" 1059#include "_prelude_lighting.glsl" 1060#include "_prelude_material_table.vertex.glsl" 1061uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform float u_edge_radius;uniform float u_width_scale;in ivec4 a_pos_normal_ed; 1062#if defined(HAS_CENTROID) || defined(TERRAIN) 1063in uvec2 a_centroid_pos; 1064#endif 1065#ifdef RENDER_WALL_MODE 1066in ivec4 a_join_normal_inside; 1067#endif 1068#ifdef PROJECTION_GLOBE_VIEW 1069in ivec4 a_pos_3;in ivec4 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift; 1070#endif 1071#ifdef TERRAIN 1072uniform int u_height_type;uniform int u_base_type; 1073#endif 1074uniform highp float u_vertical_scale; 1075#ifdef RENDER_FRONT_CUTOFF 1076uniform vec3 u_front_cutoff_params;out float v_front_cutoff_opacity; 1077#endif 1078out vec4 v_color;out vec4 v_flat; 1079#ifdef RENDER_SHADOWS 1080uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1; 1081#endif 1082#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE) 1083out vec4 v_roof_color; 1084#endif 1085#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE) 1086out highp vec3 v_normal; 1087#endif 1088#ifdef FAUX_AO 1089uniform lowp vec2 u_ao;out vec2 v_ao; 1090#endif 1091#if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT)
1092out float v_flood_radius;out float v_has_floodlight; 1093#endif 1094out float v_height; 1095#ifdef INDICATOR_CUTOUT 1096#ifdef FEATURE_CUTOUT 1097out vec4 v_ground_roof; 1098#endif 1099#endif 1100vec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));} 1101#pragma mapbox: define highp float base 1102#pragma mapbox: define highp float height 1103#pragma mapbox: define highp vec4 color 1104#pragma mapbox: define highp float flood_light_wall_radius 1105#pragma mapbox: define highp float line_width 1106#pragma mapbox: define highp float emissive_strength 1107void main() {DECLARE_MATERIAL_TABLE_INFO 1108#pragma mapbox: initialize highp float base 1109#pragma mapbox: initialize highp float height 1110#pragma mapbox: initialize highp vec4 color 1111#pragma mapbox: initialize highp float flood_light_wall_radius 1112#pragma mapbox: initialize highp float line_width 1113#pragma mapbox: initialize highp float emissive_strength 1114base*=u_vertical_scale;height*=u_vertical_scale;vec4 top_up_ny_start=vec4(a_pos_normal_ed & 1);vec4 pos_nx=vec4(a_pos_normal_ed >> 1);float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny_start.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny_start.z-1.0)*(1.0-abs(x_normal)),0.0)); 1115#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE) 1116v_normal=normal; 1117#endif 1118base=max(0.0,base);float attr_height=height;height=max(0.0,top_up_ny_start.y==0.0 && top_up_ny_start.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny_start.x;vec2 centroid_pos=vec2(0.0); 1119#if defined(HAS_CENTROID) || defined(TERRAIN) 1120centroid_pos=vec2(a_centroid_pos); 1121#endif 1122float ele=0.0;float h=0.0;float c_ele=0.0;vec3 pos; 1123#ifdef TERRAIN 1124bool is_flat_height=centroid_pos.x !=0.0 && u_height_type==1;bool is_flat_base=centroid_pos.x !=0.0 && u_base_type==1;ele=elevation(pos_nx.xy);bool is_elevation_encoded=centroid_pos.y==0.0 || (centroid_pos.y > 0.0 && (int(centroid_pos.y) & 7)==7);c_ele=is_flat_height || is_flat_base ? (is_elevation_encoded ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos)) : ele;float h_height=is_flat_height ? max(c_ele+height,ele+base+2.0) : ele+height;float h_base=is_flat_base ? max(c_ele+base,ele+base) : ele+(base==0.0 ?-5.0 : base);h=t > 0.0 ? max(h_base,h_height) : h_base; 1125#else 1126h=t > 0.0 ? height : base; 1127#endif 1128pos=vec3(pos_nx.xy,h); 1129#ifdef PROJECTION_GLOBE_VIEW 1130float lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(vec3(a_pos_normal_3)/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=vec3(a_pos_3)+globe_normal*(u_tile_up_scale*h);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,pos.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*pos.z;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition); 1131#endif 1132float cutoff=1.0;vec3 scaled_pos=pos; 1133#if defined(RENDER_CUTOFF) || defined(RENDER_FRONT_CUTOFF) 1134vec2 centroid_decoded=pos.xy;bool isBorderCentroid=false;if (centroid_pos.x > 0.0 && centroid_pos.y > 0.0) {int iy=int(centroid_pos.y);int spanYbits=iy & 7;if (spanYbits==7) {isBorderCentroid=true;int borderID=(iy >> 3) & 3;float coordAlongBorder=float(iy >> 5)*4.0;if (borderID==0) centroid_decoded=vec2(0.0,coordAlongBorder);else if (borderID==1) centroid_decoded=vec2(EXTENT,coordAlongBorder);else if (borderID==2) centroid_decoded=vec2(coordAlongBorder,0.0);else centroid_decoded=vec2(coordAlongBorder,EXTENT);} else {centroid_decoded=floor(centroid_pos/8.0);}} 1135#endif 1136#if defined(RENDER_CUTOFF) || defined(RENDER_FRONT_CUTOFF) 1137vec4 ground=u_matrix*vec4(centroid_decoded,ele,1.0); 1138#endif 1139#ifdef RENDER_CUTOFF 1140#ifdef CLIP_ZERO_TO_ONE 1141cutoff=cutoff_opacity(u_cutoff_params,ground.z*2.0-ground.w); 1142#else 1143cutoff=cutoff_opacity(u_cutoff_params,ground.z); 1144#endif 1145if (centroid_pos.y !=0.0 && centroid_pos.x !=0.0) {vec3 centroid_random=vec3(centroid_pos.xy,centroid_pos.x+centroid_pos.y+1.0);vec3 ground_pos=centroid_random/8.0;vec3 g=floor(ground_pos);vec3 mod_=centroid_random-g*8.0;float seed=min(1.0,0.1*(min(3.5,max(mod_.x+mod_.y,0.2*attr_height))*0.35+mod_.z));if (cutoff < 0.8-seed) {cutoff=0.0;}}float cutoff_scale=cutoff;v_cutoff_opacity=cutoff;scaled_pos.z=mix(c_ele,h,cutoff_scale); 1146#endif 1147float hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (cutoff==0.0 && centroid_pos.x !=0.0) || (color.a==0.0)); 1148#ifdef RENDER_FRONT_CUTOFF 1149v_front_cutoff_opacity=1.0;if (centroid_pos.x > 0.0 && centroid_pos.y > 0.0) {hidden=max(hidden,float(ground.w <=0.0));
1149float ndc_y=ground.y/max(ground.w,0.001);float threshold=u_front_cutoff_params.x*2.0-1.0;float range_ndc=u_front_cutoff_params.y*2.0;if (!isBorderCentroid) {hidden=max(hidden,float(ndc_y < threshold-range_ndc));}float t=clamp((ndc_y-(threshold-range_ndc))/max(range_ndc,0.001),0.0,1.0);v_front_cutoff_opacity=mix(u_front_cutoff_params.z,1.0,t);} 1150#endif 1151#ifdef RENDER_WALL_MODE 1152vec3 join_normal_inside=vec3(a_join_normal_inside);vec2 wall_offset=u_width_scale*line_width*(join_normal_inside.xy/EXTENT);scaled_pos.xy+=(1.0-join_normal_inside.z)*wall_offset*0.5;scaled_pos.xy-=join_normal_inside.z*wall_offset*0.5; 1153#endif 1154gl_Position=mix(u_matrix*vec4(scaled_pos,1),AWAY,hidden);h=h-ele;v_height=h; 1155#ifdef RENDER_SHADOWS 1156vec3 shd_pos0=pos;vec3 shd_pos1=pos; 1157#ifdef NORMAL_OFFSET 1158vec3 offset=shadow_normal_offset(normal);shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1(); 1159#endif 1160v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1); 1161#endif 1162float NdotL=0.0;float colorvalue=0.0; 1163#ifndef LIGHTING_3D_MODE 1164colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;NdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),NdotL);if (normal.y !=0.0) {float r=0.84;r=mix(0.7,0.98,1.0-u_lightintensity);NdotL*=( 1165(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));} 1166#endif 1167#ifdef FAUX_AO 1168float concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height; 1169#ifdef TERRAIN 1170top_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(ce
1170ntroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height); 1171#endif 1172v_ao=vec2(mix(concave,-concave,start),y_ground);NdotL*=(1.0+0.05*(1.0-top_up_ny_start.y)*u_ao[0]); 1173#ifdef PROJECTION_GLOBE_VIEW 1174top_height+=u_height_lift; 1175#endif 1176gl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w; 1177#endif 1178#ifdef LIGHTING_3D_MODE 1179#ifdef FLOOD_LIGHT 1180float is_wall=1.0-float(t > 0.0 && top_up_ny_start.y > 0.0);v_has_floodlight=float(flood_light_wall_radius > 0.0 && is_wall > 0.0);v_flood_radius=flood_light_wall_radius*u_vertical_scale; 1181#endif 1182v_color=vec4(color.rgb,1.0);float ndotl=calculate_NdotL(normal);v_flat.rgb=sRGBToLinear(color.rgb);v_flat.rgb=v_flat.rgb*(ndotl+(1.0-min(ndotl*57.29,1.0))*emissive_strength);v_flat=vec4(linearTosRGB(v_flat.rgb),1.0); 1183#else 1184v_color=vec4(0.0,0.0,0.0,1.0);v_color.rgb+=clamp(color.rgb*NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_color*=u_opacity; 1185#endif 1186#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE) 1187float roofNdotL=clamp(u_lightpos.z,0.0,1.0);roofNdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),roofNdotL);v_roof_color=vec4(0.0,0.0,0.0,1.0);v_roof_color.rgb+=clamp(color.rgb*roofNdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_roof_color*=u_opacity; 1188#endif 1189#ifdef FOG 1190v_fog_pos=fog_position(pos); 1191#endif 1192#ifdef INDICATOR_CUTOUT 1193#ifdef FEATURE_CUTOUT 1194vec4 pos_ground=u_matrix*vec4(pos.xy,ele,1.0);vec4 pos_roof=u_matrix*vec4(pos.xy,ele+height,1.0);v_ground_roof=vec4(pos_ground.xy/pos_ground.w,pos_roof.xy/pos_roof.w); 1195#endif 1196#endif 1197}`),fillExtrusionDepth:Ft("void main() {}",`#include "_prelude_terrain.vertex.glsl" 1198#include "_prelude_material_table.vertex.glsl" 1199uniform mat4 u_matrix;uniform float u_edge_radius;uniform float u_width_scale;uniform float u_vertical_scale; 1200#ifdef TERRAIN 1201uniform int u_height_type;uniform int u_base_type; 1202#endif 1203in ivec4 a_pos_normal_ed; 1204#if defined(HAS_CENTROID) || defined(TERRAIN) 1205in uvec2 a_centroid_pos; 1206#endif 1207#ifdef RENDER_WALL_MODE 1208in ivec4 a_join_normal_inside; 1209#endif 1210#pragma mapbox: define highp float base 1211#pragma mapbox: define highp float height 1212#pragma mapbox: define highp float line_width 1213#pragma mapbox: define highp vec4 color 1214void main() {DECLARE_MATERIAL_TABLE_INFO 1215#pragma mapbox: initialize highp float base 1216#pragma mapbox: initialize highp float height 1217#pragma mapbox: initialize highp float line_width 1218#pragma mapbox: initialize highp vec4 color 1219base*=u_vertical_scale;height*=u_vertical_scale;vec3 top_up_ny=vec3(a_pos_normal_ed.xyz & 1);vec3 pos_nx=vec3(a_pos_normal_ed.xyz >> 1);base=max(0.0,base);height=max(0.0,top_up_ny.y==0.0 && top_up_ny.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny.x;vec2 centroid_pos=vec2(0.0); 1220#if defined(HAS_CENTROID) || defined(TERRAIN) 1221centroid_pos=vec2(a_centroid_pos); 1222#endif 1223vec3 pos; 1224#ifdef TERRAIN 1225bool is_flat_height=centroid_pos.x !=0.0 && u_height_type==1;bool is_flat_base=centroid_pos.x !=0.0 && u_base_type==1;float ele=elevation(pos_nx.xy);bool is_elevation_encoded=centroid_pos.y==0.0 || (centroid_pos.y > 0.0 && int(centroid_pos.y)-(int(centroid_pos.y)/8)*8==7);float c_ele=is_flat_height || is_flat_base ? (is_elevation_encoded ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos)) : ele;float h_height=is_flat_height ? max(c_ele+height,ele+base+2.0) : ele+height;float h_base=is_flat_base ? max(c_ele+base,ele+base) : ele+(base==0.0 ?-5.0 : base);float h=t > 0.0 ? max(h_base,h_height) : h_base;pos=vec3(pos_nx.xy,h); 1226#else 1227pos=vec3(pos_nx.xy,t > 0.0 ? height : base); 1228#endif 1229#ifdef RENDER_WALL_MODE 1230vec3 join_normal_inside=vec3(a_join_normal_inside);vec2 wall_offset=u_width_scale*line_width*(join_normal_inside.xy/EXTENT);pos.xy+=(1.0-join_normal_inside.z)*wall_offset*0.5;pos.xy-=join_normal_inside.z*wall_offset*0.5; 1231#endif 1232float hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (color.a==0.0));gl_Position=mix(u_matrix*vec4(pos,1),AWAY,hidden);}`),fillExtrusionPattern:Ft(`#include "_prelude_fog.fragment.glsl" 1233#include "_prelude_lighting.glsl" 1234uniform vec2 u_texsize;uniform sampler2D u_image; 1235#ifdef FILL_EXTRUSION_PATTERN_TRANSITION 1236uniform float u_pattern_transition; 1237#endif 1238#ifdef FAUX_AO 1239uniform lowp vec2 u_ao;in vec3 v_ao; 1240#endif 1241#ifdef LIGHTING_3D_MODE 1242in vec3 v_normal; 1243#endif 1244#ifdef APPLY_LUT_ON_GPU 1245uniform highp sampler3D u_lutTexture; 1246#endif 1247in highp vec2 v_pos;in vec4 v_lighting;uniform lowp float u_opacity; 1248#pragma mapbox: define highp float base 1249#pragma mapbox: define highp float height 1250#pragma mapbox: define mediump uvec4 pattern 1251#ifdef FILL_EXTRUSION_PATTERN_TRANSITION 1252#pragma mapbox: define mediump uvec4 pattern_b 1253#endif 1254#pragma mapbox: define highp float pixel_ratio 1255void main() { 1256#pragma mapbox: initialize highp float base 1257#pragma mapbox: initialize highp float height 1258#pragma mapbox: initialize mediump uvec4 pattern 1259#ifdef FILL_EXTRUSION_PATTERN_TRANSITION 1260#pragma mapbox: initialize mediump uvec4 pattern_b 1261#endif 1262#pragma mapbox: initialize highp float pixel_ratio 1263vec2 pattern_tl=vec2(pattern.xy);vec2 pattern_br=vec2(pattern.zw);highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);highp vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);vec4 out_color=textureLodCustom(u_image,pos,lod_pos); 1264#ifdef APPLY_LUT_ON_GPU 1265out_color=applyLUT(u_lutTexture,out_color); 1266#endif 1267#ifdef FILL_EXTRUSION_PATTERN_TRANSITION 1268vec2 pattern_b_tl=vec2(pattern_b.xy);vec2 pattern_b_br=vec2(pattern_b.zw);highp vec2 pos_b=mix(pattern_b_tl/u_texsize,pattern_b_br/u_texsize,imagecoord);vec4 color_b=textureLodCustom(u_image,pos_b,lod_pos);out_color=out_color*(1.0-u_pattern_transition)+color_b*u_pattern_transition; 1269#endif 1270#ifdef LIGHTING_3D_MODE 1271out_color=apply_lighting(out_color,normalize(v_normal))*u_opacity; 1272#else 1273out_color=out_color*v_lighting; 1274#endif 1275#ifdef FAUX_AO 1276float intensity=u_ao[0];float h=max(0.0,v_ao.z);float h_floors=h/u_ao[1];float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);float shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0
1276),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x;float x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);shade*=mix(1.0,x_shade*x_shade*x_shade,concave);out_color.rgb=out_color.rgb*shade; 1277#endif 1278#ifdef FOG 1279out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); 1280#endif 1281#ifdef INDICATOR_CUTOUT 1282out_color=applyCutout(out_color,height); 1283#endif 1284glFragColor=out_color; 1285#ifdef OVERDRAW_INSPECTOR 1286glFragColor=vec4(1.0); 1287#endif 1288HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 1289#include "_prelude_terrain.vertex.glsl" 1290#include "_prelude_lighting.glsl" 1291#include "_prelude_material_table.vertex.glsl" 1292uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform float u_tile_units_to_pixels;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform float u_width_scale;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;in ivec4 a_pos_normal_ed; 1293#if defined(HAS_CENTROID) || defined(TERRAIN) 1294in uvec2 a_centroid_pos; 1295#endif 1296#ifdef RENDER_WALL_MODE 1297in ivec4 a_join_normal_inside; 1298#endif 1299#ifdef PROJECTION_GLOBE_VIEW 1300in ivec4 a_pos_3;in ivec4 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift; 1301#endif 1302#ifdef TERRAIN 1303uniform int u_height_type;uniform int u_base_type; 1304#endif 1305out highp vec2 v_pos;out vec4 v_lighting; 1306#ifdef FAUX_AO 1307uniform lowp vec2 u_ao;out vec3 v_ao; 1308#endif 1309#ifdef LIGHTING_3D_MODE 1310out vec3 v_normal; 1311#endif 1312#pragma mapbox: define highp float base 1313#pragma mapbox: define highp float height 1314#pragma mapbox: define highp vec4 color 1315#pragma mapbox: define mediump uvec4 pattern 1316#ifdef FILL_EXTRUSION_PATTERN_TRANSITION 1317#pragma mapbox: define mediump uvec4 pattern_b 1318#endif 1319#pragma mapbox: define highp float pixel_ratio 1320#pragma mapbox: define highp float line_width 1321void main() {DECLARE_MATERIAL_TABLE_INFO 1322#pragma mapbox: initialize highp float base 1323#pragma mapbox: initialize highp float height 1324#pragma mapbox: initialize highp vec4 color 1325#pragma mapbox: initialize mediump uvec4 pattern 1326#ifdef FILL_EXTRUSION_PATTERN_TRANSITION 1327#pragma mapbox: initialize mediump uvec4 pattern_b 1328#endif 1329#pragma mapbox: initialize highp float pixel_ratio 1330#pragma mapbox: initialize highp float line_width 1331vec2 pattern_tl=vec2(pattern.xy);vec2 pattern_br=vec2(pattern.zw);vec4 top_up_ny_start=vec4(a_pos_normal_ed & 1);vec4 pos_nx=vec4(a_pos_normal_ed >> 1);float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny_start.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny_start.z-1.0)*(1.0-abs(x_normal)),0.0));float edgedistance=float(a_pos_normal_ed.w);vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;base=max(0.0,base);height=max(0.0,height);float t=top_up_ny_start.x;float z=t > 0.0 ? height : base;vec2 centroid_pos=vec2(0.0); 1332#if defined(HAS_CENTROID) || defined(TERRAIN) 1333centroid_pos=vec2(a_centroid_pos); 1334#endif 1335float ele=0.0;float h=z;vec3 p;float c_ele; 1336#ifdef TERRAIN 1337bool is_flat_height=centroid_pos.x !=0.0 && u_height_type==1;bool is_flat_base=centroid_pos.x !=0.0 && u_base_type==1;ele=elevation(pos_nx.xy);bool is_elevation_encoded=centroid_pos.y==0.0 || (centroid_pos.y > 0.0 && int(centroid_pos.y)-(int(centroid_pos.y)/8)*8==7);c_ele=is_flat_height || is_flat_base ? (is_elevation_encoded ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos)) : ele;float h_height=is_flat_height ? max(c_ele+height,ele+base+2.0) : ele+height;float h_base=is_flat_base ? max(c_ele+base,ele+base) : ele+(base==0.0 ?-5.0 : base);h=t > 0.0 ? max(h_base,h_height) : h_base;p=vec3(pos_nx.xy,h); 1338#else 1339p=vec3(pos_nx.xy,z); 1340#endif 1341#ifdef PROJECTION_GLOBE_VIEW 1342float lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(vec3(a_pos_normal_3)/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=vec3(a_pos_3)+globe_normal*(u_tile_up_scale*(p.z+lift));vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,p.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*p.z;p=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition); 1343#endif 1344#ifdef RENDER_WALL_MODE 1345vec3 join_normal_inside=vec3(a_join_normal_inside);vec2 wall_offset=u_width_scale*line_width*(join_normal_inside.xy/EXTENT);p.xy+=(1.0-join_normal_inside.z)*wall_offset*0.5;p.xy-=join_normal_inside.z*wall_offset*0.5; 1346#endif 1347float hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (color.a==0.0));gl_Position=mix(u_matrix*vec4(p,1),AWAY,hidden);vec2 pos=normal.z==1.0 1348? pos_nx.xy 1349: vec2(edgedistance,z*u_height_factor);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float NdotL=0.0; 1350#ifdef LIGHTING_3D_MODE 1351NdotL=calculate_NdotL(normal); 1352#else 1353NdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),NdotL); 1354#endif 1355if (normal.y !=0.0) {float r=0.84; 1356#ifndef LIGHTING_3D_MODE 1357r=mix(0.7,0.98,1.0-u_lightintensity); 1358#endif 1359NdotL*=( 1360(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));} 1361#ifdef FAUX_AO
1362float concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height; 1363#ifdef TERRAIN 1364top_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(centroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height); 1365#endif 1366v_ao=vec3(mix(concave,-concave,start),y_ground,h-ele);NdotL*=(1.0+0.05*(1.0-top_up_ny_start.y)*u_ao[0]); 1367#ifdef PROJECTION_GLOBE_VIEW 1368top_height+=u_height_lift; 1369#endif 1370gl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w; 1371#endif 1372#ifdef LIGHTING_3D_MODE 1373v_normal=normal; 1374#else 1375v_lighting.rgb+=clamp(NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity; 1376#endif 1377#ifdef FOG 1378v_fog_pos=fog_position(p); 1379#endif 1380}`),groundShadow:Ft(`#include "_prelude_shadow.fragment.glsl" 1381precision highp float;uniform vec3 u_ground_shadow_factor;in vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1; 1382#ifdef FOG 1383in float v_fog_opacity; 1384#endif 1385void main() {float light=shadowed_light_factor_plane_bias(v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);vec3 shadow=mix(u_ground_shadow_factor,vec3(1.0),light); 1386#ifdef RENDER_CUTOFF 1387shadow=mix(vec3(1.0),shadow,cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w)); 1388#endif 1389#ifdef FOG 1390shadow=mix(shadow,vec3(1.0),v_fog_opacity); 1391#endif 1392#ifdef INDICATOR_CUTOUT 1393shadow=mix(shadow,vec3(1.0),1.0-applyCutout(vec4(1.0),0.0).r); 1394#endif 1395#ifdef FEATURE_CUTOUT 1396shadow=mix(shadow,vec3(1.0),get_cutout_factors(gl_FragCoord).y); 1397#endif 1398glFragColor=vec4(shadow,1.0);}`,`#include "_prelude_fog.vertex.glsl" 1399uniform mat4 u_matrix;uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;in ivec2 a_pos;out vec4 v_pos_light_view_0;out vec4 v_pos_light_view_1; 1400#ifdef FOG 1401out float v_fog_opacity; 1402#endif 1403void main() {gl_Position=u_matrix*vec4(a_pos,0.0,1.0);v_pos_light_view_0=u_light_matrix_0*vec4(a_pos,0.0,1.0);v_pos_light_view_1=u_light_matrix_1*vec4(a_pos,0.0,1.0); 1404#ifdef FOG 1405v_fog_pos=fog_position(vec2(a_pos));v_fog_opacity=fog(v_fog_pos); 1406#endif 1407}`),fillExtrusionGroundEffect:Ft(`uniform highp float u_ao_pass;uniform highp float u_opacity;uniform highp float u_flood_light_intensity;uniform highp vec3 u_flood_light_color;uniform highp float u_attenuation;uniform sampler2D u_fb;uniform float u_fb_size; 1408#ifdef SDF_SUBPASS 1409in highp vec2 v_pos;in highp vec4 v_line_segment;in highp float v_flood_light_radius_tile;in highp vec2 v_ao;float line_df(highp vec2 a,highp vec2 b,highp vec2 p) {highp vec2 ba=b-a;highp vec2 pa=p-a;highp float r=clamp(dot(pa,ba)/dot(ba,ba),0.0,1.0);return length(pa-r*ba);} 1410#ifdef FOG 1411in highp float v_fog; 1412#endif 1413#endif 1414void main() { 1415#ifdef CLEAR_SUBPASS 1416vec4 color=vec4(1.0); 1417#ifdef CLEAR_FROM_TEXTURE 1418color=texture(u_fb,gl_FragCoord.xy/vec2(u_fb_size)); 1419#endif 1420glFragColor=color; 1421#else 1422#ifdef SDF_SUBPASS 1423highp float d=line_df(v_line_segment.xy,v_line_segment.zw,v_pos);highp float effect_radius=mix(v_flood_light_radius_tile,v_ao.y,u_ao_pass);d/=effect_radius;d=min(d,1.0);d=1.0-pow(1.0-d,u_attenuation);highp float effect_intensity=mix(u_flood_light_intensity,v_ao.x,u_ao_pass);highp float fog=1.0; 1424#ifdef FOG 1425fog=v_fog; 1426#endif 1427#ifdef RENDER_CUTOFF 1428fog*=v_cutoff_opacity; 1429#endif 1430glFragColor=vec4(vec3(0.0),mix(1.0,d,effect_intensity*u_opacity*fog)); 1431#else 1432#ifdef USE_MRT1 1433out_Target1=vec4(1.0-texture(u_fb,gl_FragCoord.xy/vec2(u_fb_size)).a,0.0,0.0,0.0); 1434#else 1435vec4 color=mix(vec4(u_flood_light_color,1.0),vec4(vec3(0.0),1.0),u_ao_pass); 1436#ifdef OVERDRAW_INSPECTOR 1437color=vec4(1.0); 1438#endif 1439glFragColor=color; 1440#endif 1441#endif 1442HANDLE_WIREFRAME_DEBUG; 1443#endif 1444}`,`#include "_prelude_fog.vertex.glsl" 1445in highp ivec4 a_pos_end;in highp int a_angular_offset_factor;in highp uint a_hidden_by_landmark; 1446#ifdef SDF_SUBPASS 1447out highp vec2 v_pos;out highp vec4 v_line_segment;out highp float v_flood_light_radius_tile;out highp vec2 v_ao; 1448#ifdef FOG 1449out highp float v_fog; 1450#endif 1451#endif 1452uniform highp float u_flood_light_intensity;uniform highp mat4 u_matrix;uniform highp float u_ao_pass;uniform highp float u_meter_to_tile;uniform highp float u_edge_radius;uniform highp float u_dynamic_offset;uniform highp vec2 u_ao;
1453#pragma mapbox: define highp float flood_light_ground_radius 1454const float TANGENT_CUTOFF=4.0;const float NORM=32767.0;void main() { 1455#pragma mapbox: initialize highp float flood_light_ground_radius 1456vec4 pos_end=vec4(a_pos_end);vec2 p=pos_end.xy;vec2 q=floor(pos_end.zw*0.5);vec2 start_bottom=pos_end.zw-q*2.0;float fl_ground_radius=abs(flood_light_ground_radius);float direction=flood_light_ground_radius < 0.0 ?-1.0 : 1.0;float flood_radius_tile=fl_ground_radius*u_meter_to_tile;vec2 v=normalize(q-p);float ao_radius=u_ao.y/3.5;float effect_radius=mix(flood_radius_tile,ao_radius,u_ao_pass)+u_edge_radius;float angular_offset_factor=float(a_angular_offset_factor)/NORM*TANGENT_CUTOFF;float angular_offset=direction*angular_offset_factor*effect_radius;float top=1.0-start_bottom.y;float side=(0.5-start_bottom.x)*2.0;vec2 extrusion_parallel=v*side*mix(u_dynamic_offset,angular_offset,top);vec2 perp=vec2(v.y,-v.x);vec2 extrusion_perp=direction*perp*effect_radius*top;vec3 pos=vec3(mix(q,p,start_bottom.x),0.0);pos.xy+=extrusion_parallel+extrusion_perp; 1457#ifdef SDF_SUBPASS 1458v_pos=pos.xy;v_line_segment=vec4(p,q)+perp.xyxy*u_edge_radius;v_flood_light_radius_tile=flood_radius_tile;v_ao=vec2(u_ao.x,ao_radius); 1459#ifdef FOG 1460v_fog_pos=fog_position(pos);v_fog=1.0-fog(v_fog_pos); 1461#endif 1462#endif 1463float hidden_by_landmark=0.0; 1464#ifdef HAS_CENTROID 1465hidden_by_landmark=float(a_hidden_by_landmark); 1466#endif 1467float isFloodlit=float(fl_ground_radius > 0.0 && u_flood_light_intensity > 0.0);float hidden=mix(1.0-isFloodlit,isFloodlit,u_ao_pass);hidden+=hidden_by_landmark;gl_Position=mix(u_matrix*vec4(pos,1.0),AWAY,float(hidden > 0.0)); 1468#ifdef RENDER_CUTOFF 1469v_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z); 1470#endif 1471}`),hillshadePrepare:Ft(`precision highp float;uniform highp sampler2D u_image;in vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;float getElevation(vec2 coord) {return texture(u_image,coord).r/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y));float b=getElevation(v_pos+vec2(0,-epsilon.y));float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y));float d=getElevation(v_pos+vec2(-epsilon.x,0));float e=getElevation(v_pos+vec2(epsilon.x,0));float f=getElevation(v_pos+vec2(-epsilon.x,epsilon.y));float g=getElevation(v_pos+vec2(0,epsilon.y));float h=getElevation(v_pos+vec2(epsilon.x,epsilon.y));float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2( 1472(c+e+e+h)-(a+d+d+f),(f+g+g+h)-(a+b+b+c) 1473)/pow(2.0,exaggeration+(19.2562-u_zoom));glFragColor=clamp(vec4( 1474deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);}`,"uniform mat4 u_matrix;uniform vec2 u_dimension;in ivec2 a_pos;in uvec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(vec2(a_texture_pos)/8192.0)*scale+epsilon;}"),hillshade:Ft(`#include "_prelude_fog.fragment.glsl" 1475#include "_prelude_lighting.glsl" 1476uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;uniform float u_emissive_strength;void main() {vec4 pixel=texture(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);glFragColor=accent_color*(1.0-shade_color.a)+shade_color; 1477#ifdef LIGHTING_3D_MODE 1478glFragColor=apply_lighting_with_emission_ground(glFragColor,u_emissive_strength); 1479#endif 1480#ifdef FOG 1481glFragColor=fog_dither(fog_apply_premultiplied(glFragColor,v_fog_pos)); 1482#endif 1483#ifdef USE_MRT1 1484out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a); 1485#endif 1486#ifdef OVERDRAW_INSPECTOR 1487glFragColor=vec4(1.0); 1488#endif 1489HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 1490uniform mat4 u_matrix;in ivec2 a_pos;in uvec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=vec2(a_texture_pos)/8192.0; 1491#ifdef FOG 1492v_fog_pos=fog_position(vec2(a_pos)); 1493#endif 1494}
1494`),line:Ft(`#include "_prelude_fog.fragment.glsl" 1495#include "_prelude_lighting.glsl" 1496#include "_prelude_shadow.fragment.glsl" 1497uniform lowp float u_device_pixel_ratio;uniform highp float u_width_scale;uniform highp float u_floor_width_scale;uniform float u_alpha_discard_threshold;uniform highp vec2 u_trim_offset;uniform highp vec2 u_trim_fade_range;uniform highp vec2 u_trim_gradient_mix_range;uniform lowp vec4 u_trim_color;uniform bool u_emissive_in_shadows;uniform bool u_clip_to_tile_borders;in vec4 v_width2_dilute;in vec2 v_normal;in float v_gamma_scale;in highp vec3 v_uv;in vec2 v_tile_pos; 1498#ifdef ELEVATED_ROADS 1499in highp float v_road_z_offset; 1500#endif 1501#ifdef VARIABLE_LINE_WIDTH 1502in float stub_side; 1503#endif 1504#ifdef RENDER_LINE_DASH 1505uniform sampler2D u_dash_image;in vec2 v_tex; 1506#endif 1507#ifdef DEBUG_ELEVATION_ID 1508in vec3 v_elevation_id_col; 1509#endif 1510#ifdef RENDER_LINE_GRADIENT 1511uniform sampler2D u_gradient_image; 1512#endif 1513#ifdef INDICATOR_CUTOUT 1514in highp float v_z_offset; 1515#endif 1516#ifdef RENDER_SHADOWS 1517uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth; 1518#endif 1519float luminance(vec3 c) {return (c.r+c.r+c.b+c.g+c.g+c.g)*0.1667;} 1520#pragma mapbox: define highp vec4 color 1521#pragma mapbox: define lowp float floorwidth 1522#pragma mapbox: define mediump uvec4 dash 1523#pragma mapbox: define lowp float blur 1524#pragma mapbox: define lowp float opacity 1525#pragma mapbox: define mediump float side_z_offset 1526#pragma mapbox: define lowp float border_width 1527#pragma mapbox: define lowp vec4 border_color 1528#pragma mapbox: define lowp float emissive_strength 1529float linearstep(float edge0,float edge1,float x) {return clamp((x-edge0)/(edge1-edge0),0.0,1.0);}void main() { 1530#pragma mapbox: initialize highp vec4 color 1531#pragma mapbox: initialize lowp float floorwidth 1532#pragma mapbox: initialize mediump uvec4 dash 1533#pragma mapbox: initialize lowp float blur 1534#pragma mapbox: initialize lowp float opacity 1535#pragma mapbox: initialize mediump float side_z_offset 1536#pragma mapbox: initialize lowp float border_width 1537#pragma mapbox: initialize lowp vec4 border_color 1538#pragma mapbox: initialize lowp float emissive_strength 1539float dist=length(v_normal)*v_width2_dilute.x; 1540#ifdef VARIABLE_LINE_WIDTH 1541blur=mix(blur,0.0,stub_side); 1542#endif 1543float diluted_opacity=opacity*v_width2_dilute.z;float blur2=(u_width_scale*blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2_dilute.y-blur2),v_width2_dilute.x-dist)/blur2,0.0,1.0); 1544#ifdef VARIABLE_LINE_WIDTH 1545alpha=mix(alpha,1.0,stub_side); 1546#endif 1547alpha=side_z_offset > 0.0 ? 1.0-alpha : alpha; 1548#ifdef RENDER_LINE_DASH 1549float sdfdist=texture(u_dash_image,v_tex).r;
1549float sdfgamma=1.0/(2.0*u_device_pixel_ratio)/(float(dash.z)+float(dash.w)/65535.0);float scaled_floorwidth=(floorwidth*u_floor_width_scale);alpha*=linearstep(0.5-sdfgamma/scaled_floorwidth,0.5+sdfgamma/scaled_floorwidth,sdfdist); 1550#endif 1551highp vec4 out_color; 1552#ifdef RENDER_LINE_GRADIENT 1553out_color=texture(u_gradient_image,v_uv.xy); 1554#else 1555out_color=color; 1556#endif 1557float trim_alpha=1.0; 1558#ifdef RENDER_LINE_TRIM_OFFSET 1559highp float trim_start=u_trim_offset[0];highp float trim_end=u_trim_offset[1];highp float line_progress=v_uv[2];if (trim_end > trim_start) {highp float start_transition=max(0.0,min(1.0,(line_progress-trim_start)/max(u_trim_fade_range[0],1.0e-9)));highp float end_transition=max(0.0,min(1.0,(trim_end-line_progress)/max(u_trim_fade_range[1],1.0e-9)));highp float transition_factor=min(start_transition,end_transition);highp float gradient_trim_color_mix_factor=0.0; 1560#ifdef RENDER_LINE_GRADIENT 1561gradient_trim_color_mix_factor=smoothstep(u_trim_gradient_mix_range.x,u_trim_gradient_mix_range.y,line_progress); 1562#endif 1563highp vec4 trim_color=mix(u_trim_color,out_color,gradient_trim_color_mix_factor);out_color=mix(u_trim_gradient_mix_range.x < 1.0 ? color : out_color,trim_color,transition_factor);trim_alpha=1.0-transition_factor;} 1564#endif 1565if (u_alpha_discard_threshold !=0.0) {if (alpha < u_alpha_discard_threshold) {discard;}} 1566#ifdef RENDER_LINE_BORDER 1567#ifndef VARIABLE_LINE_WIDTH 1568float edgeBlur=((border_width*u_width_scale)+1.0/u_device_pixel_ratio);float alpha2=clamp(min(dist-(v_width2_dilute.y-edgeBlur),v_width2_dilute.x-dist)/edgeBlur,0.0,1.0);if (alpha2 < 1.) {float smoothAlpha=smoothstep(0.6,1.0,alpha2);if (border_color.a==0.0) {float Y=(out_color.a > 0.01) ? luminance(out_color.rgb/out_color.a) : 1.;float adjustment=(Y > 0.) ? 0.5/Y : 0.45;if (out_color.a > 0.25 && Y < 0.25) {vec3 borderColor=(Y > 0.) ? out_color.rgb : vec3(1,1,1)*out_color.a;out_color.rgb=out_color.rgb+borderColor*(adjustment*(1.0-smoothAlpha));} else {out_color.rgb*=(0.6 +0.4*smoothAlpha);}} else {out_color=mix(border_color*trim_alpha,out_color,smoothAlpha);}out_color*=v_width2_dilute.w;} 1569#endif 1570#endif 1571vec2 cutout_factors=vec2(0.0); 1572#ifdef FEATURE_CUTOUT 1573cutout_factors=get_cutout_factors(gl_FragCoord); 1574#endif 1575#ifdef LIGHTING_3D_MODE 1576out_color=apply_lighting_with_emission_ground(out_color,emissive_strength); 1577#ifdef RENDER_SHADOWS 1578float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);light=mix(light,1.0,cutout_factors.y);light=u_emissive_in_shadows ? mix(light,1.0,emissive_strength) : light; 1579#ifdef ELEVATED_ROADS 1580out_color.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light); 1581#else 1582out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light); 1583#endif 1584#endif 1585#endif 1586#ifdef FOG 1587out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); 1588#endif 1589out_color*=(alpha*diluted_opacity); 1590#ifdef INDICATOR_CUTOUT 1591out_color=applyCutout(out_color,v_z_offset); 1592#endif 1593#ifdef FEATURE_CUTOUT 1594out_color=apply_feature_cutout(out_color,gl_FragCoord,cutout_factors.x); 1595#endif 1596#ifdef LINE_BLEND_ADDITIVE 1597{float cov=alpha*diluted_opacity;glFragColor=vec4(cov > 0.0 ? out_color.rgb/cov : vec3(0.0),cov);} 1598#else 1599#ifdef LINE_BLEND_MULTIPLY 1600glFragColor=vec4(out_color.rgb+(1.0-out_color.a),1.0); 1601#else 1602glFragColor=out_color; 1603#endif 1604#endif 1605#ifdef DUAL_SOURCE_BLENDING 1606glFragColorSrc1=vec4(vec3(0.0),emissive_strength); 1607#else 1608#ifdef USE_MRT1 1609out_Target1=vec4(emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a); 1610#endif 1611#endif 1612#ifdef OVERDRAW_INSPECTOR 1613glFragColor=vec4(1.0); 1614#endif 1615#ifdef DEBUG_ELEVATION_ID 1616glFragColor=vec4(v_elevation_id_col,1.0); 1617#endif 1618if (u_clip_to_tile_borders) {if (v_tile_pos.x > 1.0 || v_tile_pos.y > 1.0 || v_tile_pos.x < 0.0 || v_tile_pos.y < 0.0) {discard;}}HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 1619#include "_prelude_shadow.vertex.glsl" 1620#include "_prelude_terrain.vertex.glsl" 1621#define EXTRUDE_SCALE 0.015873016 1622in ivec2 a_pos_normal;in uvec4 a_data; 1623#if defined(ELEVATED) || defined(ELEVATED_ROADS) || defined(VARIABLE_LINE_WIDTH) 1624in vec3 a_z_offset_width; 1625#endif 1626#ifdef DEBUG_ELEVATION_ID 1627in vec3 a_elevation_id_col; 1628#endif 1629#ifdef DEBUG_ELEVATION_ID 1630out vec3 v_elevation_id_col; 1631#endif 1632#ifdef ELEVATION_GROUND_SCALE 1633in float a_elevation_ground_scale; 1634#endif 1635#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET) || defined(RENDER_LINE_CURVE) 1636in highp vec3 a_packed; 1637#endif 1638#ifdef RENDER_LINE_DASH 1639in float a_linesofar; 1640#endif 1641uniform mat4 u_matrix;uniform mat2 u_pixels_to_tile_units;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;uniform float u_width_scale;uniform float u_z_offset;uniform highp float u_floor_width_scale; 1642#ifdef RENDER_LINE_CURVE 1643uniform mat3 u_curve_points_x;uniform mat3 u_curve_points_y;uniform mat3 u_curve_points_z;uniform float u_curve_point_count; 1644#endif 1645#ifdef ELEVATED 1646uniform lowp float u_zbias_factor;uniform lowp float u_tile_to_meter;float sample_elevation(vec2 apos) { 1647#ifdef ELEVATION_REFERENCE_SEA 1648return 0.0; 1649#else 1650return elevation(apos); 1651#endif 1652} 1653#endif 1654out vec2 v_normal;out vec4 v_width2_dilute;out float v_gamma_scale;out highp vec3 v_uv;out vec2 v_tile_pos; 1655#ifdef ELEVATED_ROADS 1656out highp float v_road_z_offset; 1657#endif 1658#ifdef VARIABLE_LINE_WIDTH 1659out float stub_side; 1660#endif 1661#ifdef RENDER_LINE_DASH 1662uniform vec2 u_texsize;uniform float u_tile_units_to_pixels;out vec2 v_tex; 1663#endif 1664#ifdef RENDER_LINE_GRADIENT 1665uniform float u_image_height; 1666#endif 1667#ifdef INDICATOR_CUTOUT 1668out highp float v_z_offset; 1669#endif 1670#ifdef RENDER_SHADOWS 1671uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth; 1672#endif 1673#pragma mapbox: define highp vec4 color 1674#pragma mapbox: define lowp float floorwidth 1675#pragma mapbox: define mediump uvec4 dash 1676#pragma mapbox: define lowp float blur 1677#pragma mapbox: define lowp float opacity 1678#pragma mapbox: define mediump float gapwidth 1679#pragma mapbox: define lowp float offset 1680#pragma mapbox: define mediump float width 1681#pragma mapbox: define mediump float side_z_offset 1682#pragma mapbox: define lowp float border_width 1683#pragma mapbox: define lowp vec4 border_color 1684#pragma mapbox: define lowp float emissive_strength 1685#ifdef RENDER_LINE_CURVE 1686vec3 getCurvePoint(int index) {int row=index/3;int col=index-row*3;float x=u_curve_points_x[row][col];float y=u_curve_points_y[row][col];float z=u_curve_points_z[row][col];return vec3(x,y,z);}vec3 catmullRom(vec3 p0,vec3 p1,vec3 p2,vec3 p3,float t) {float t2
1686=t*t;float t3=t2*t;return 0.5*( 16872.0*p1+(-p0+p2)*t+(2.0*p0-5.0*p1+4.0*p2-p3)*t2+(-p0+3.0*p1-3.0*p2+p3)*t3 1688);}vec2 catmullRomTangent(vec2 p0,vec2 p1,vec2 p2,vec2 p3,float t) {float t2=t*t;return 0.5*( 1689(-p0+p2)+(2.0*p0-5.0*p1+4.0*p2-p3)*2.0*t+(-p0+3.0*p1-3.0*p2+p3)*3.0*t2 1690);}struct CurveResult {vec3 point;vec2 tangent;};CurveResult calculateCurve(float line_progress) {float curve_progress=line_progress*(u_curve_point_count-1.0);float curve_progress_local=fract(curve_progress);float curve_segment=floor(curve_progress);int seg=int(curve_segment);vec3 p1=getCurvePoint(seg);vec3 p2=getCurvePoint(seg+1);float is_first_seg=step(curve_segment,0.5);vec3 p0_extrapolated=p1-(p2-p1);vec3 p0_fetched=getCurvePoint(max(seg-1,0));vec3 p0=mix(p0_fetched,p0_extrapolated,is_first_seg);int last_seg=int(u_curve_point_count)-2;float is_last_seg=step(float(last_seg)-0.5,curve_segment);vec3 p3_extrapolated=p2+(p2-p1);vec3 p3_fetched=getCurvePoint(min(seg+2,int(u_curve_point_count)-1));vec3 p3=mix(p3_fetched,p3_extrapolated,is_last_seg);vec3 point=catmullRom(p0,p1,p2,p3,curve_progress_local);vec2 tangent=catmullRomTangent(p0.xy,p1.xy,p2.xy,p3.xy,curve_progress_local)*(u_curve_point_count-1.0);CurveResult result;result.point=point;result.tangent=tangent;return result;} 1691#endif 1692void main() { 1693#pragma mapbox: initialize highp vec4 color 1694#pragma mapbox: initialize lowp float floorwidth 1695#pragma mapbox: initialize mediump uvec4 dash 1696#pragma mapbox: initialize lowp float blur 1697#pragma mapbox: initialize lowp float opacity 1698#pragma mapbox: initialize mediump float gapwidth 1699#pragma mapbox: initialize lowp float offset 1700#pragma mapbox: initialize mediump float width 1701#pragma mapbox: initialize mediump float side_z_offset 1702#pragma mapbox: initialize lowp float border_width 1703#pragma mapbox: initialize lowp vec4 border_color 1704#pragma mapbox: initialize lowp float emissive_strength 1705float a_z_offset=u_z_offset; 1706#if defined(ELEVATED) || defined(ELEVATED_ROADS) 1707a_z_offset+=a_z_offset_width.x; 1708#endif 1709#ifdef DEBUG_ELEVATION_ID 1710v_elevation_id_col=a_elevation_id_col; 1711#endif 1712highp float line_progress=0.0; 1713#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET) || defined(RENDER_LINE_CURVE) 1714line_progress=a_packed[2]; 1715#endif 1716float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=vec2(a_data.xy)-128.0;float a_direction=float(a_data.z & 3u)-1.0;vec2 pos_normal=vec2(a_pos_normal);vec2 pos=floor(pos_normal*0.5);mediump vec2 normal=pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;offset=-1.0*offset*u_width_scale;bool left=normal.y==1.0; 1717#ifdef RENDER_LINE_CURVE 1718CurveResult curve=calculateCurve(line_progress);pos=curve.point.xy*8192.0;a_extrude=length(a_extrude)*normalize(curve.tangent);a_extrude=left ? vec2(-a_extrude.y,a_extrude.x) : vec2(a_extrude.y,-a_extrude.x);a_z_offset+=curve.point.z; 1719#endif 1720gapwidth=gapwidth/2.0;float halfwidth;float dilute_scale=1.0;float dilute_border_scale=1.0; 1721#ifdef VARIABLE_LINE_WIDTH 1722float left_width=a_z_offset_width.y;float right_width=a_z_offset_width.z;halfwidth=(u_width_scale*(left ? left_width : right_width))/2.0;if (side_z_offset !=0.0) {float left_f=step(1.0,normal.y);float is_negative=step(side_z_offset,0.0);float apply=mix(1.0-left_f,left_f,is_negative);a_extrude*=apply;a_z_offset+=abs(side_z_offset)*apply;v_normal*=left_f;}offset=border_width > 0.0 ? (left_width+right_width)*u_width_scale*0.5 : offset;halfwidth=border_width > 0.0 ? border_width*u_width_scale*0.5 : halfwidth;bool zero_right_width=border_width==0.0 && right_width==0.0;stub_side=zero_right_width ?-normal.y : 0.0;v_normal=!left && zero_right_width ? vec2(0.0) : v_normal;ANTIALIASING=!left && zero_right_width ? 0.0 : ANTIALIASING; 1723#else 1724halfwidth=(u_width_scale*width)/2.0; 1725#endif 1726float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*EXTRUDE_SCALE;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*EXTRUDE_SCALE*normal.y*mat2(t,-u,u,t);float hidden=float(opacity==0.0);vec2 extrude=dist*u_pixels_to_tile_units;
1726vec4 projected_extrude=u_matrix*vec4(extrude,0.0,0.0);vec2 projected_extrude_xy=projected_extrude.xy; 1727#ifdef ELEVATED_ROADS 1728v_road_z_offset=a_z_offset;v_tile_pos=pos+offset2*u_pixels_to_tile_units;gl_Position=u_matrix*vec4(v_tile_pos,a_z_offset,1.0); 1729#else 1730#ifdef ELEVATED 1731vec2 offsetTile=offset2*u_pixels_to_tile_units;vec2 offset_pos=pos+offsetTile;float ele=0.0;float scaled_z_offset=a_z_offset; 1732#ifdef ELEVATION_GROUND_SCALE 1733scaled_z_offset=a_z_offset*mix(1.0,u_exaggeration,a_elevation_ground_scale); 1734#endif 1735#ifdef CROSS_SLOPE_VERTICAL 1736float top=pos_normal.y-2.0*floor(pos_normal.y*0.5);float line_height=2.0*u_tile_to_meter*outset*top*u_pixels_to_tile_units[1][1]+scaled_z_offset;ele=sample_elevation(offset_pos)+line_height;projected_extrude=vec4(0); 1737#else 1738#ifdef CROSS_SLOPE_HORIZONTAL 1739float ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,max(ele1,ele2));ele=ele_max+scaled_z_offset; 1740#else 1741float ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,0.5*(ele1+ele2));ele=ele_max-ele0+ele1+scaled_z_offset; 1742#endif 1743#endif 1744v_tile_pos=offset_pos;gl_Position=u_matrix*vec4(v_tile_pos,ele,1.0)+projected_extrude;float z=clamp(gl_Position.z/gl_Position.w,0.5,1.0);float zbias=max(0.00005,(pow(z,0.8)-z)*u_zbias_factor*u_exaggeration);gl_Position.z-=(gl_Position.w*zbias);gl_Position=mix(gl_Position,AWAY,hidden); 1745#else 1746v_tile_pos=pos+offset2*u_pixels_to_tile_units;gl_Position=u_matrix*vec4(v_tile_pos,0.0,1.0); 1747#endif 1748#endif 1749#ifndef ELEVATED 1750#ifndef VARIABLE_LINE_WIDTH 1751#ifndef RENDER_TO_TEXTURE 1752float base_w=gl_Position.w;vec2 screen_width=abs(projected_extrude.xy/base_w*u_units_to_pixels);float max_extrude_component=max(screen_width.x,screen_width.y);if (width >=1.0 && base_w > 0.0 && max_extrude_component > 0.0001) {float min_pixel=1.05;if (max_extrude_component < min_pixel) {vec2 abs_pos=abs(gl_Position.xy);float is_out=max(abs_pos.x,abs_pos.y)/base_w;dilute_scale=mix(max_extrude_component/min_pixel,1.0,smoothstep(2.5,4.5,is_out));projected_extrude/=dilute_scale;}else if (gapwidth > 0.0) {float visible_ratio=(halfwidth+ANTIALIASING)/outset;vec2 visible_screen_width=screen_width*visible_ratio;float max_visible_component=max(visible_screen_width.x,visible_screen_width.y);dilute_scale=min(1.0,max_visible_component/min_pixel);}else 1753{ 1754#ifdef RENDER_LINE_BORDER 1755float border_ratio=(border_width*u_width_scale+ANTIALIASING)/outset;screen_width*=border_ratio;float max_border_component=max(screen_width.x,screen_width.y);dilute_border_scale=min(1.0,max_border_component/min_pixel); 1756#endif 1757}} 1758#endif 1759#endif 1760v_tile_pos=(v_tile_pos+extrude)/EXTENT; 1761#ifdef ELEVATED_ROADS 1762gl_Position=gl_Position+projected_extrude; 1763#else 1764gl_Position=mix(gl_Position+projected_extrude,AWAY,hidden); 1765#endif 1766#endif 1767#ifdef ELEVATED_ROADS 1768#ifdef RENDER_SHADOWS 1769vec3 shd_pos=vec3(pos+(offset2+dist)*u_pixels_to_tile_units,a_z_offset);vec3 shd_pos0=shd_pos;vec3 shd_pos1=shd_pos; 1770#ifdef NORMAL_OFFSET 1771vec3 shd_pos_offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=shd_pos_offset*shadow_normal_offset_multiplier0();shd_pos1+=shd_pos_offset*shadow_normal_offset_multiplier1(); 1772#endif 1773v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w; 1774#endif 1775#endif 1776#ifndef RENDER_TO_TEXTURE 1777float epsilon=0.0001;float extrude_length_without_perspective=max(length(dist),epsilon);float extrude_length_with_perspective=max(length(projected_extrude_xy/gl_Position.w*u_units_to_pixels),epsilon);v_gamma_scale=mix(extrude_length_without_perspective/extrude_length_with_perspective,1.0,step(0.01,blur)); 1778#else 1779v_gamma_scale=1.0; 1780#endif 1781#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET) 1782highp float a_uv_x=a_packed[0];float a_split_index=a_packed[1]; 1783#ifdef RENDER_LINE_GRADIENT 1784highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec3(a_uv_x,a_split_index*texel_height-half_texel_height,line_progress); 1785#else 1786v_uv=vec3(a_uv_x,0.0,line_progress); 1787#endif 1788#endif 1789#ifdef RENDER_LINE_DASH 1790vec4 dashf=vec4(dash);float totalLength=dashf.z+dashf.w/65535.0;float scale=totalLength==0.0 ? 0.0 : u_tile_units_to_pixels/totalLength;v_tex=vec2(a_linesofar*scale/(floorwidth*u_floor_width_scale),(-normal.y*dashf.y+dashf.x+0.5)/u_texsize.y); 1791#endif 1792v_width2_dilute=vec4(outset,inset,dilute_scale,dilute_border_scale); 1793#ifdef FOG 1794v_fog_pos=fog_position(pos); 1795#endif 1796#ifdef INDICATOR_CUTOUT 1797v_z_offset=a_z_offset; 1798#endif 1799}`),linePattern:Ft(`#include "_prelude_fog.fragment.glsl" 1800#include "_prelude_lighting.glsl" 1801#include "_prelude_shadow.fragment.glsl" 1802uniform highp float u_device_pixel_ratio;uniform highp float u_width_scale;
1802uniform highp float u_alpha_discard_threshold;uniform highp vec2 u_texsize;uniform highp float u_tile_units_to_pixels;uniform highp vec2 u_trim_offset;uniform highp vec2 u_trim_fade_range;uniform lowp vec4 u_trim_color;uniform sampler2D u_image; 1803#ifdef APPLY_LUT_ON_GPU 1804uniform highp sampler3D u_lutTexture; 1805#endif 1806#ifdef LINE_PATTERN_TRANSITION 1807uniform float u_pattern_transition; 1808#endif 1809in vec2 v_normal;in vec2 v_width2;in highp float v_linesofar;in float v_gamma_scale;in float v_width; 1810#ifdef RENDER_LINE_TRIM_OFFSET 1811in highp vec3 v_uv; 1812#endif 1813#ifdef ELEVATED_ROADS 1814in highp float v_road_z_offset; 1815#endif 1816#ifdef LINE_JOIN_NONE 1817in vec2 v_pattern_data; 1818#endif 1819#ifdef INDICATOR_CUTOUT 1820in highp float v_z_offset; 1821#endif 1822#ifdef RENDER_SHADOWS 1823uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth; 1824#endif 1825#pragma mapbox: define mediump uvec4 pattern 1826#ifdef LINE_PATTERN_TRANSITION 1827#pragma mapbox: define mediump uvec4 pattern_b 1828#endif 1829#pragma mapbox: define mediump float pixel_ratio 1830#pragma mapbox: define mediump float blur 1831#pragma mapbox: define mediump float opacity 1832#pragma mapbox: define lowp float emissive_strength 1833void main() { 1834#pragma mapbox: initialize mediump uvec4 pattern 1835#ifdef LINE_PATTERN_TRANSITION 1836#pragma mapbox: initialize mediump uvec4 pattern_b 1837#endif 1838#pragma mapbox: initialize mediump float pixel_ratio 1839#pragma mapbox: initialize mediump float blur 1840#pragma mapbox: initialize mediump float opacity 1841#pragma mapbox: initialize lowp float emissive_strength 1842vec2 pattern_tl=vec2(pattern.xy);vec2 pattern_br=vec2(pattern.zw);vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;highp float pattern_size=display_size.x/u_tile_units_to_pixels;float aspect=display_size.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(u_width_scale*blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);highp float pattern_x=v_linesofar/pattern_size*aspect;highp float x=mod(pattern_x,1.0);highp float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;highp vec2 pos=mix(pattern_tl*texel_size-texel_size,pattern_br*texel_size+texel_size,vec2(x,y));highp vec2 lod_pos=mix(pattern_tl*texel_size-texel_size,pattern_br*texel_size+texel_size,vec2(pattern_x,y));vec4 color=textureLodCustom(u_image,pos,lod_pos); 1843#ifdef APPLY_LUT_ON_GPU 1844color=applyLUT(u_lutTexture,color); 1845#endif 1846#ifdef LINE_PATTERN_TRANSITION 1847vec2 pattern_b_tl=vec2(pattern_b.xy);vec2 pattern_b_br=vec2(pattern_b.zw);highp vec2 pos_b=mix(pattern_b_tl*texel_size-texel_size,pattern_b_br*texel_size+texel_size,vec2(x,y));vec4 color_b=textureLodCustom(u_image,pos_b,lod_pos);color=color*(1.0-u_pattern_transition)+color_b*u_pattern_transition; 1848#endif 1849#ifdef RENDER_LINE_TRIM_OFFSET 1850highp float trim_start=u_trim_offset[0];highp float trim_end=u_trim_offset[1];highp float line_progress=v_uv[2];if (trim_end > trim_start) {highp float start_transition=max(0.0,min(1.0,(line_progress-trim_start)/max(u_trim_fade_range[0],1.0e-9)));highp float end_transition=max(0.0,min(1.0,(trim_end-line_progress)/max(u_trim_fade_range[1],1.0e-9)));highp float transition_factor=min(start_transition,end_transition);color=mix(color,color.a*u_trim_color,transition_factor);} 1851#endif 1852#ifdef LINE_JOIN_NONE 1853highp float pattern_len=pattern_size/aspect;highp float segment_phase=pattern_len-mod(v_linesofar-v_pattern_data.x+pattern_len,pattern_len);highp float visible_start=segment_phase-step(pattern_len*0.5,segment_phase)*pattern_len;highp float visible_end=floor((v_pattern_data.y-segment_phase)/pattern_len)*pattern_len+segment_phase;visible_end+=step(pattern_len*0.5,v_pattern_data.y-visible_end)*pattern_len;if (v_pattern_data.x < visible_start || v_pattern_data.x >=visible_end) {color=vec4(0.0);} 1854#endif 1855#ifdef LIGHTING_3D_MODE 1856color=apply_lighting_with_emission_ground(color,emissive_strength); 1857#ifdef RENDER_SHADOWS 1858float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth); 1859#ifdef ELEVATED_ROADS 1860color.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light); 1861#else 1862color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light); 1863#endif 1864#endif 1865#endif 1866#ifdef FOG 1867color=fog_dither(fog_apply_premultiplied(color,v_fog_pos)); 1868#endif 1869color*=(alpha*opacity);if (u_alpha_discard_threshold !=0.0) {if (color.a < u_alpha_discard_threshold) {discard;}} 1870#ifdef INDICATOR_CUTOUT 1871color=applyCutout(color,v_z_offset); 1872#endif 1873glFragColor=color; 1874#ifdef DUAL_SOURCE_BLENDING 1875glFragColorSrc1=vec4(vec3(0.0),emissive_strength); 1876#else 1877#ifdef USE_MRT1 1878out_Target1=vec4(emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a); 1879#endif 1880#endif 1881#ifdef OVERDRAW_INSPECTOR 1882glFragColor=vec4(1.0); 1883#endif 1884HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 1885#include "_prelude_shadow.vertex.glsl" 1886#include "_prelude_terrain.vertex.glsl" 1887#define scale 0.015873016 1888in ivec2 a_pos_normal;in uvec4 a_data; 1889#if defined(ELEVATED) || defined(ELEVATED_ROADS) 1890in vec3 a_z_offset_width; 1891#endif 1892#ifdef ELEVATION_GROUND_SCALE 1893in float a_elevation_ground_scale; 1894#endif 1895#ifdef RENDER_LINE_TRIM_OFFSET 1896in highp vec3 a_packed; 1897#endif 1898in highp float a_linesofar; 1899#ifdef LINE_JOIN_NONE 1900in highp vec3 a_pattern_data;out vec2 v_pattern_data; 1901#endif 1902#ifdef INDICATOR_CUTOUT 1903out highp float v_z_offset; 1904#endif 1905uniform mat4 u_matrix;uniform float u_tile_units_to_pixels;uniform vec2 u_units_to_pixels;uniform mat2 u_pixels_to_tile_units;uniform float u_device_pixel_ratio;uniform float u_width_scale;uniform float u_floor_width_scale; 1906#ifdef ELEVATED 1907uniform lowp float u_zbias_factor;uniform lowp float u_tile_to_meter;float sample_elevation(vec2 apos) { 1908#ifdef ELEVATION_REFERENCE_SEA 1909return 0.0; 1910#else 1911return elevation(apos); 1912#endif 1913} 1914#endif 1915out vec2 v_normal;out vec2 v_width2;out highp float v_linesofar;out float v_gamma_scale;out float v_width; 1916#ifdef RENDER_LINE_TRIM_OFFSET 1917out highp vec3 v_uv; 1918#endif 1919#ifdef ELEVATED_ROADS 1920out highp float v_road_z_offset; 1921#endif 1922#ifdef RENDER_SHADOWS 1923uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth; 1924#endif 1925#pragma mapbox: define mediump float blur 1926#pragma mapbox: define mediump float opacity 1927#pragma mapbox: define mediump float offset 1928#pragma mapbox: define mediump float gapwidth 1929#pragma mapbox: define mediump float width 1930#pragma mapbox: define mediump float floorwidth 1931#pragma mapbox: define mediump uvec4 pattern 1932#ifdef LINE_PATTERN_TRANSITION 1933#pragma mapbox: define mediump uvec4 pattern_b 1934#endif 1935#pragma mapbox: define mediump float pixel_ratio 1936#pragma mapbox: define lowp float emissive_strength 1937void main() { 1938#pragma mapbox: initialize mediump float blur 1939#pragma mapbox: initialize mediump float opacity 1940#pragma mapbox: initialize mediump float offset 1941#pragma mapbox: initialize mediump float gapwidth 1942#pragma mapbox: initialize mediump float width 1943#pragma mapbox: initialize mediump float floorwidth 1944#pragma mapbox: initialize mediump uvec4 pattern 1945#ifdef LINE_PATTERN_TRANSITION 1946#pragma mapbox: initialize mediump uvec4 pattern_b 1947#endif 1948#pragma mapbox: initialize mediump float pixel_ratio 1949#pragma mapbox: initialize lowp float emissive_strength 1950float a_z_offset; 1951#if defined(ELEVATED) || defined(ELEVATED_ROADS) 1952a_z_offset=a_z_offset_width.x; 1953#endif 1954float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=vec2(a_data.xy)-128.0;float a_direction=float(a_data.z & 3u)-1.0;vec2 pos_normal=vec2(a_pos_normal);vec2 pos=floor(pos_normal*0.5);vec2 normal=pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=(u_width_scale*width)/2.0;offset=-1.0*offset*u_width_scale;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);vec2 dist=outset*a_extrude*scale;float u=0.5*a_direction;float t=1.0-abs(u);vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float hidden=float(opacity==0.0);vec2 extrude=dist*u_pixels_to_tile_units;
1954vec4 projected_extrude=u_matrix*vec4(extrude,0.0,0.0);vec2 projected_extrude_xy=projected_extrude.xy; 1955#ifdef ELEVATED_ROADS 1956v_road_z_offset=a_z_offset;gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,a_z_offset,1.0)+projected_extrude; 1957#else 1958#ifdef ELEVATED 1959vec2 offsetTile=offset2*u_pixels_to_tile_units;vec2 offset_pos=pos+offsetTile;float ele=0.0;float scaled_z_offset=a_z_offset; 1960#ifdef ELEVATION_GROUND_SCALE 1961scaled_z_offset=a_z_offset*mix(1.0,u_exaggeration,a_elevation_ground_scale); 1962#endif 1963#ifdef CROSS_SLOPE_VERTICAL 1964float top=pos_normal.y-2.0*floor(pos_normal.y*0.5);float line_height=2.0*u_tile_to_meter*outset*top*u_pixels_to_tile_units[1][1]+scaled_z_offset;ele=sample_elevation(offset_pos)+line_height;projected_extrude=vec4(0); 1965#else 1966#ifdef CROSS_SLOPE_HORIZONTAL 1967float ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,max(ele1,ele2));ele=ele_max+scaled_z_offset; 1968#else 1969float ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,0.5*(ele1+ele2));ele=ele_max-ele0+ele1+scaled_z_offset; 1970#endif 1971#endif 1972gl_Position=u_matrix*vec4(offset_pos,ele,1.0)+projected_extrude;float z=clamp(gl_Position.z/gl_Position.w,0.5,1.0);float zbias=max(0.00005,(pow(z,0.8)-z)*u_zbias_factor*u_exaggeration);gl_Position.z-=(gl_Position.w*zbias);gl_Position=mix(gl_Position,AWAY,hidden); 1973#else 1974gl_Position=mix(u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude,AWAY,hidden); 1975#endif 1976#endif 1977#ifdef ELEVATED_ROADS 1978#ifdef RENDER_SHADOWS 1979vec3 shd_pos=vec3(pos+(offset2+dist)*u_pixels_to_tile_units,a_z_offset);vec3 shd_pos0=shd_pos;vec3 shd_pos1=shd_pos; 1980#ifdef NORMAL_OFFSET 1981vec3 shd_pos_offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=shd_pos_offset*shadow_normal_offset_multiplier0();shd_pos1+=shd_pos_offset*shadow_normal_offset_multiplier1(); 1982#endif 1983v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w; 1984#endif 1985#endif 1986#ifndef RENDER_TO_TEXTURE 1987float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude_xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=mix(extrude_length_without_perspective/extrude_length_with_perspective,1.0,step(0.01,blur)); 1988#else 1989v_gamma_scale=1.0; 1990#endif 1991#ifdef RENDER_LINE_TRIM_OFFSET 1992highp float a_uv_x=a_packed[0];highp float line_progress=a_packed[2];v_uv=vec3(a_uv_x,0.0,line_progress); 1993#endif 1994v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=(floorwidth*u_floor_width_scale); 1995#ifdef LINE_JOIN_NONE 1996v_width=(floorwidth*u_floor_width_scale)+ANTIALIASING;mediump float pixels_to_tile_units=1.0/u_tile_units_to_pixels;mediump float pixel_ratio_inverse=1.0/pixel_ratio;mediump float aspect=v_width/(float(pattern.w-pattern.y)*pixel_ratio_inverse);highp float subt_multiple=float(pattern.z-pattern.x)*pixel_ratio_inverse*pixels_to_tile_units*aspect*32.0;highp float subt=floor(a_pattern_data.z/subt_multiple)*subt_multiple;float offset_sign=(fract(a_pattern_data.x)-0.5)*4.0;float line_progress_offset=offset_sign*v_width*0.5*pixels_to_tile_units;v_linesofar=(a_pattern_data.z-subt)+a_linesofar+line_progress_offset;v_pattern_data=vec2(a_pattern_data.x+line_progress_offset,a_pattern_data.y); 1997#endif 1998#ifdef FOG 1999v_fog_pos=fog_position(pos); 2000#endif 2001#ifdef INDICATOR_CUTOUT 2002v_z_offset=a_z_offset; 2003#endif 2004}`),raster:Ft(`#include "_prelude_fog.fragment.glsl" 2005#include "_prelude_lighting.glsl" 2006#include "_prelude_raster_array.glsl" 2007uniform float u_fade_t;uniform float u_opacity;uniform highp float u_raster_elevation;uniform highp float u_zoom_transition;in vec2 v_pos0;in vec2 v_pos1;in float v_depth; 2008#ifdef PROJECTION_GLOBE_VIEW 2009in float v_split_fade; 2010#endif 2011uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;uniform float u_emissive_strength; 2012#ifndef RASTER_ARRAY 2013uniform highp sampler2D u_image0;uniform sampler2D u_image1; 2014#endif 2015#ifdef RASTER_COLOR 2016uniform sampler2D u_color_ramp;uniform highp vec4 u_colorization_mix;uniform highp float u_colorization_offset;uniform vec2 u_texture_res; 2017#endif 2018void main() {vec4 color0,color1,color;vec2 value; 2019#ifdef RASTER_COLOR 2020#ifdef RASTER_ARRAY 2021#ifdef RASTER_ARRAY_LINEAR 2022value=mix( 2023raTexture2D_image0_linear(v_pos0,u_texture_res,u_colorization_mix,u_colorization_offset),raTexture2D_image1_linear(v_pos1,u_texture_res,u_colorization_mix,u_colorization_offset),u_fade_t 2024); 2025#else 2026value=mix( 2027raTexture2D_image0_nearest(v_pos0,u_texture_res,u_colorization_mix,u_colorization_offset),raTexture2D_image1_nearest(v_pos1,u_texture_res,u_colorization_mix,u_colorization_offset),u_fade_t 2028); 2029#endif 2030if (value.y > 0.0) value.x/=value.y; 2031#else 2032color=mix(texture(u_image0,v_pos0),texture(u_image1,v_pos1),u_fade_t);value=vec2(u_colorization_offset+dot(color.rgb,u_colorization_mix.rgb),color.a); 2033#endif 2034color=texture(u_color_ramp,vec2(value.x,0.5));if (color.a > 0.0) color.rgb/=color.a;color.a*=value.y; 2035#else 2036color0=texture(u_image0,v_pos0);color1=texture(u_image1,v_pos1);if (color0.a > 0.0) color0.rgb/=color0.a;if (color1.a > 0.0) color1.rgb/=color1.a;color=mix(color0,color1,u_fade_t); 2037#endif 2038color.a*=u_opacity; 2039#ifdef GLOBE_POLES 2040color.a*=1.0-smoothstep(0.0,0.05,u_zoom_transition); 2041#endif 2042vec3 rgb=color.rgb;rgb=vec3( 2043dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);vec3 out_color=mix(u_high_vec,u_low_vec,rgb); 2044#ifdef LIGHTING_3D_MODE 2045out_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),u_emissive_strength).rgb; 2046#endif 2047#ifdef FOG 2048highp float fog_limit_high_meters=1000000.0;highp float fog_limit_low_meters=600000.0;float fog_limit=1.0-smoothstep(fog_limit_low_meters,fog_limit_high_meters,u_raster_elevation);out_color=fog_dither(fog_apply(out_color,v_fog_pos,fog_limit)); 2049#endif 2050glFragColor=vec4(out_color*color.a,color.a); 2051#ifdef PROJECTION_GLOBE_VIEW 2052glFragColor*=mix(1.0,1.0-smoothstep(0.0,0.05,u_zoom_transition),smoothstep(0.8,0.9,v_split_fade)); 2053#endif 2054#ifdef RENDER_CUTOFF 2055glFragColor=glFragColor*cutoff_opacity(u_cutoff_params,v_depth); 2056#endif 2057#ifdef OVERDRAW_INSPECTOR 2058glFragColor=vec4(1.0); 2059#endif 2060#ifdef USE_MRT1 2061out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a); 2062#endif 2063HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 2064#include "_prelude_terrain.vertex.glsl" 2065uniform mat4 u_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform mat3 u_grid_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform vec2 u_perspective_transform;uniform vec2 u_texture_offset;uniform float u_raster_elevation;uniform float u_zoom_transition;uniform vec2 u_merc_center; 2066#ifdef ELEVATED 2067uniform lowp float u_zbias_factor; 2068#endif 2069#define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8 2070#ifdef GLOBE_POLES 2071in vec3 a_globe_pos;in vec2 a_uv; 2072#else 2073in ivec2 a_pos;in uvec2 a_texture_pos; 2074#endif 2075out vec2 v_pos0;out vec2 v_pos1;out float v_depth; 2076#ifdef PROJECTION_GLOBE_VIEW 2077out float v_split_fade; 2078#endif 2079void main() {vec2 uv; 2080#ifdef GLOBE_POLES 2081vec3 globe_pos=a_globe_pos;uv=a_uv;float ele=u_raster_elevation; 2082#ifdef ELEVATION_REFERENCE_GROUND 2083ele+=elevation(uv*EXTENT); 2084#endif 2085globe_pos+=normalize(globe_pos)*ele*GLOBE_UPSCALE;gl_Position=u_matrix*u_globe_matrix*vec4(globe_pos,1.0); 2086#ifdef FOG 2087v_fog_pos=fog_position((u_normalize_matrix*vec4(a_globe_pos,1.0)).xyz); 2088#endif 2089#else 2090vec4 world_pos; 2091#ifdef PROJECTION_GLOBE_VIEW 2092vec2 texture_pos=vec2(a_texture_pos);uv=texture_pos/8192.0;vec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);float mercatorY=mercatorYfromLat(latLng[0]);float mercatorX=mercatorXfromLng(latLng[1]); 2093float tiles=u_grid_matrix[0][2];
2093if (tiles > 0.0) {float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];float uvY=mercatorY*tiles-idy;float uvX=mercatorX*tiles-idx;uv=vec2(uvX,uvY);}float ele=u_raster_elevation; 2094#ifdef ELEVATION_REFERENCE_GROUND 2095ele+=elevation(uv*EXTENT)-decomposed_pos_and_skirt.z; 2096#endif 2097vec4 merc_world_pos=vec4(0.0); 2098v_split_fade=0.0;if (u_zoom_transition > 0.0) {vec2 merc_pos=vec2(mercatorX,mercatorY);merc_world_pos=vec4(merc_pos,ele,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;float opposite_merc_center=mod(u_merc_center.x+0.5,1.0);float dist_from_poles=(abs(mercatorY-0.5)*2.0);float range=0.1;v_split_fade=abs(opposite_merc_center-mercatorX);v_split_fade=clamp(1.0-v_split_fade,0.0,1.0);v_split_fade=max(smoothstep(1.0-range,1.0,dist_from_poles),max(smoothstep(1.0-range,1.0,v_split_fade),smoothstep(1.0-range,1.0,1.0-v_split_fade)));}vec3 globe_pos=latLngToECEF(latLng.xy);globe_pos+=normalize(globe_pos)*ele*GLOBE_UPSCALE;vec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);world_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition),1.0); 2099#ifdef FOG 2100v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz); 2101#endif 2102#else 2103float ele=0.0;vec2 decodedPos=vec2(a_pos); 2104#ifdef ELEVATION_REFERENCE_GROUND 2105vec3 decomposedPosAndSkirt=decomposeToPosAndSkirt(a_pos);float skirt=decomposedPosAndSkirt.z;decodedPos=decomposedPosAndSkirt.xy;uv=decodedPos/8192.0;ele=elevation(decodedPos)-skirt; 2106#else 2107uv=vec2(a_texture_pos)/8192.0; 2108#endif 2109world_pos=vec4(decodedPos,(u_raster_elevation+ele),1.0); 2110#ifdef FOG 2111v_fog_pos=fog_position(decodedPos); 2112#endif 2113#endif 2114float w=1.0+dot(uv*EXTENT,u_perspective_transform);gl_Position=u_matrix*world_pos*w; 2115#endif 2116v_pos0=uv;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;v_pos0=u_texture_offset.x+u_texture_offset.y*v_pos0;v_pos1=u_texture_offset.x+u_texture_offset.y*v_pos1; 2117#ifdef ELEVATED 2118float z=clamp(gl_Position.z/gl_Position.w,0.5,1.0);float zbias=max(0.00005,(pow(z,0.8)-z)*u_zbias_factor);gl_Position.z-=(gl_Position.w*zbias); 2119#endif 2120#ifdef RENDER_CUTOFF 2121v_depth=gl_Position.z; 2122#endif 2123}`),symbol:Ft(`#include "_prelude_lighting.glsl" 2124#include "_prelude_shadow.fragment.glsl" 2125#define SDF_PX 8.0 2126#define SDF 1.0 2127#define ICON 0.0 2128uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;uniform bool u_is_halo;uniform lowp float u_scale_factor; 2129#ifdef ICON_TRANSITION 2130uniform float u_icon_transition; 2131#endif 2132#ifdef COLOR_ADJUSTMENT 2133uniform mat4 u_color_adj_mat; 2134#endif 2135#ifdef INDICATOR_CUTOUT 2136in highp float v_z_offset; 2137#else 2138#ifdef RENDER_SHADOWS 2139in highp float v_z_offset; 2140#endif 2141#endif 2142in vec2 v_tex_a; 2143#ifdef ICON_TRANSITION 2144in vec2 v_tex_b; 2145#endif 2146in float v_draw_halo;in vec3 v_gamma_scale_size_fade_opacity; 2147#ifdef RENDER_TEXT_AND_SYMBOL 2148in float is_sdf;in vec2 v_tex_a_icon; 2149#endif 2150#ifdef RENDER_SHADOWS 2151uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth; 2152#endif 2153#ifdef APPLY_LUT_ON_GPU 2154uniform highp sampler3D u_lutTexture; 2155#endif 2156#ifdef USE_PAINT_PROPERTIES_UBO 2157in lowp float v_opacity; 2158#ifdef RENDER_SDF 2159in lowp vec4 v_fill_np_color;in lowp vec4 v_halo_np_color;in lowp float v_halo_width;in lowp float v_halo_blur; 2160#endif 2161#ifdef LIGHTING_3D_MODE 2162in lowp float v_emissive_strength; 2163#endif 2164#else 2165#pragma mapbox: define highp vec4 fill_color 2166#pragma mapbox: define highp vec4 halo_color 2167#pragma mapbox: define lowp float opacity 2168#pragma mapbox: define lowp float halo_width 2169#pragma mapbox: define lowp float halo_blur 2170#pragma mapbox: define lowp float emissive_strength 2171#endif 2172void main() { 2173#ifdef USE_PAINT_PROPERTIES_UBO 2174lowp float opacity=v_opacity;lowp vec4 fill_color=vec4(0.0);lowp vec4 halo_color=vec4(0.0);lowp float halo_width=0.0;lowp float halo_blur=0.0; 2175#ifdef RENDER_SDF 2176fill_color=vec4(v_fill_np_color.rgb*v_fill_np_color.a,v_fill_np_color.a);halo_color=vec4(v_halo_np_color.rgb*v_halo_np_color.a,v_halo_np_color.a);halo_width=v_halo_width;halo_blur=v_halo_blur; 2177#endif 2178lowp float emissive_strength=0.0; 2179#ifdef LIGHTING_3D_MODE 2180emissive_strength=v_emissive_strength; 2181#endif 2182#else 2183#pragma mapbox: initialize highp vec4 fill_color 2184#pragma mapbox: initialize highp vec4 halo_color 2185#pragma mapbox: initialize lowp float opacity 2186#pragma mapbox: initialize lowp float halo_width 2187#pragma mapbox: initialize lowp float halo_blur 2188#pragma mapbox: initialize lowp float emissive_strength 2189#endif 2190vec4 out_color;float fade_opacity=v_gamma_scale_size_fade_opacity[2]; 2191#ifdef RENDER_TEXT_AND_SYMBOL 2192if (is_sdf==ICON) {vec2 tex_icon=v_tex_a_icon;lowp float alpha=opacity*fade_opacity;
2192glFragColor=texture(u_texture_icon,tex_icon)*alpha; 2193#ifdef OVERDRAW_INSPECTOR 2194glFragColor=vec4(1.0); 2195#endif 2196return;} 2197#endif 2198vec2 cutout_factors=vec2(0.0); 2199#ifdef FEATURE_CUTOUT 2200cutout_factors=get_cutout_factors(gl_FragCoord); 2201#endif 2202#ifdef RENDER_SDF 2203float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_gamma_scale_size_fade_opacity.x;float size=v_gamma_scale_size_fade_opacity.y;float fontScale=u_is_text ? size/24.0 : size;out_color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;bool draw_halo=v_draw_halo > 0.0;if (draw_halo) {out_color=halo_color;gamma=(halo_blur*u_scale_factor*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width*u_scale_factor/fontScale)/SDF_PX;}lowp float dist=texture(u_texture,v_tex_a).r;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);out_color*=alpha; 2204#else 2205#ifdef ICON_TRANSITION 2206vec4 a=texture(u_texture,v_tex_a)*(1.0-u_icon_transition);vec4 b=texture(u_texture,v_tex_b)*u_icon_transition;out_color=(a+b); 2207#else 2208out_color=texture(u_texture,v_tex_a); 2209#endif 2210#ifdef APPLY_LUT_ON_GPU 2211out_color=applyLUT(u_lutTexture,out_color); 2212#endif 2213#ifdef COLOR_ADJUSTMENT 2214out_color=u_color_adj_mat*out_color; 2215#endif 2216#endif 2217out_color*=opacity*fade_opacity; 2218#ifdef LIGHTING_3D_MODE 2219out_color=apply_lighting_with_emission_ground(out_color,emissive_strength); 2220#ifdef RENDER_SHADOWS 2221float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);light=mix(light,1.0,cutout_factors.y); 2222#ifdef TERRAIN 2223out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light); 2224#else 2225out_color.rgb*=mix(v_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light); 2226#endif 2227#endif 2228#endif 2229#ifdef INDICATOR_CUTOUT 2230out_color=applyCutout(out_color,v_z_offset); 2231#endif 2232#ifdef FEATURE_CUTOUT 2233out_color=apply_feature_cutout(out_color,gl_FragCoord,cutout_factors.x); 2234#endif 2235glFragColor=out_color; 2236#ifdef OVERDRAW_INSPECTOR 2237glFragColor=vec4(1.0); 2238#endif 2239HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_terrain.vertex.glsl" 2240#include "_prelude_shadow.vertex.glsl" 2241#define USING_APPEARANCE 1.0 2242in ivec4 a_pos_offset;in uvec4 a_tex_size;in ivec4 a_pixeloffset;in vec4 a_projected_pos;in uint a_fade_opacity; 2243#ifdef Z_OFFSET 2244in float a_auto_z_offset; 2245#endif 2246#ifdef PROJECTION_GLOBE_VIEW 2247in ivec4 a_globe_anchor;in vec3 a_globe_normal; 2248#endif 2249#ifdef ICON_TRANSITION 2250in uvec2 a_texb; 2251#endif 2252#ifdef OCCLUSION_QUERIES 2253in float a_occlusion_query_opacity; 2254#endif 2255#ifdef ELEVATED_ROADS 2256in vec3 a_x_axis;in vec3 a_y_axis;uniform float u_normal_scale; 2257#endif 2258#ifdef INDICATOR_CUTOUT 2259out highp float v_z_offset; 2260#else 2261#ifdef RENDER_SHADOWS 2262out highp float v_z_offset; 2263#endif 2264#endif 2265uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_elevation_from_sea;uniform bool u_pitch_with_map;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec3 u_up_vector;uniform vec2 u_texsize_icon;uniform bool u_is_halo; 2266#ifdef PROJECTION_GLOBE_VIEW 2267uniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_camera_forward;uniform float u_zoom_transition;uniform vec3 u_ecef_origin;uniform mat4 u_tile_matrix; 2268#endif 2269out vec2 v_tex_a; 2270#ifdef ICON_TRANSITION 2271out vec2 v_tex_b; 2272#endif 2273out float v_draw_halo;out vec3 v_gamma_scale_size_fade_opacity; 2274#ifdef RENDER_TEXT_AND_SYMBOL 2275out float is_sdf;out vec2 v_tex_a_icon; 2276#endif 2277#ifdef RENDER_SHADOWS 2278uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth; 2279#endif 2280#ifdef USE_PAINT_PROPERTIES_UBO 2281#ifndef MAX_UBO_SIZE_VEC4 2282#define MAX_UBO_SIZE_VEC4 1024u 2283#endif 2284#define SPP_HEADER_SIZE_VEC4 3u 2285#define DWORDS_PER_VEC4 4u 2286struct SymbolPaintProperties {vec4 fill_np_color;vec4 halo_np_color;float opacity;float halo_width;float halo_blur;float emissive_strength;float occlusion_opacity;float z_offset;vec2 translate;};struct PropertyType {bool isDataDriven;bool isZoomDependent;uint offsetDwords;};struct SymbolPropertyHeader {uint dataDrivenBlockSizeVec4;PropertyType fill_np_color;PropertyType halo_np_color;PropertyType opacity;PropertyType halo_width;PropertyType halo_blur;PropertyType emissive_strength;PropertyType occlusion_opacity;PropertyType z_offset;PropertyType translate;};uniform float u_zoom;uniform lowp vec4 u_spp_fill_np_color;uniform lowp vec4 u_spp_halo_np_color;uniform lowp float u_spp_opacity;uniform lowp float u_spp_halo_width;uniform lowp float u_spp_halo_blur;uniform lowp float u_spp_emissive_strength;uniform lowp float u_spp_occlusion_opacity;uniform highp float u_spp_z_offset;uniform lowp vec2 u_spp_translate_rotation;in float a_feature_index;layout(std140) uniform SymbolPaintPropertiesHeaderUniform {uvec4 header[SPP_HEADER_SIZE_VEC4];} u_spp_header;layout(std140) uniform SymbolPaintPropertiesUniform {vec4 properties[MAX_UBO_SIZE_VEC4];} u_spp_properties;layout(std140) uniform SymbolPaintPropertiesIndexUniform {uvec4 block_indices[MAX_UBO_SIZE_VEC4];} u_spp_index;out lowp float v_opacity; 2287#ifdef RENDER_SDF 2288out lowp vec4 v_fill_np_color;out lowp vec4 v_halo_np_color;out lowp float v_halo_width;out lowp float v_halo_blur; 2289#endif 2290#ifdef LIGHTING_3D_MODE 2291out lowp float v_emissive_strength; 2292#endif 2293PropertyType getPropertyType(uint propertyIndex,uint dataDrivenMask,uint zoomDependentMask,uint offsetDwords) {PropertyType type;type.isDataDriven=(dataDrivenMask & (1u << propertyIndex)) !=0u;type.isZoomDependent=(zoomDependentMask & (1u << propertyIndex)) !=0u;type.offsetDwords=offsetDwords;return type;}SymbolPropertyHeader readSymbolPropertiesHeader() {SymbolPropertyHeader header;uint dataDrivenMask=u_spp_header.header[0][0];uint zoomDependentMask=u_spp_header.header[0][1];header.dataDrivenBlockSizeVec4=u_spp_header.header[0][2];header.fill_np_color =getPropertyType(0u,dataDrivenMask,zoomDependentMask,u_spp_header.header[0][3]);header.halo_np_color =getPropertyType(1u,dataDrivenMask,zoomDependentMask,u_spp_header.header[1][0]);header.opacity =getPropertyType(2u,dataDrivenMask,zoomDependentMask,u_spp_header.header[1][1]);header.halo_width =getPropertyType(3u,dataDrivenMask,zoomDependentMask,u_spp_header.header[1][2]);header.halo_blur =getPropertyType(4u,dataDrivenMask,zoomDependentMask,u_spp_header.header[1][3]);header.emissive_strength =getPropertyType(5u,dataDrivenMask,zoomDependentMask,u_spp_header.header[2][0]);header.occlusion_opacity =getPropertyType(6u,dataDrivenMask,zoomDependentMask,u_spp_header.header[2][1]);header.z_offset =getPropertyType(7u,dataDrivenMask,zoomDependentMask,u_spp_header.header[2][2]);header.translate =getPropertyType(8u,dataDrivenMask,zoomDependentMask,u_spp_header.header[2][3]);return header;}uint uvec4At(uvec4 v,uint index) {return (index==0u) ? v.x : 2294(index==1u) ? v.y : 2295(index==2u) ? v.z : v.w;}float vec4At(vec4 v,uint index) {return (index==0u) ? v.x : 2296(index==1u) ? v.y : 2297(index==2u) ? v.z : v.w;}vec4 readVec4(uint baseOffsetVec4,uint propertyOffsetDwords) {return u_spp_properties.properties[baseOffsetVec4+propertyOffsetDwords/DWORDS_PER_VEC4];}float readFloat(vec4 slot,uint propertyOffsetDwords) {return slot[propertyOffsetDwords % DWORDS_PER_VEC4];}uint readUint(uvec4 slot,uint offset) {return slot[offset % DWORDS_PER_VEC4];}vec2 readVec2(vec4 slot,uint propertyOffsetDwords) {float x=vec4At(slot,propertyOffsetDwords % DWORDS_PER_VEC4);float y=vec4At(slot,propertyOffsetDwords % DWORDS_PER_VEC4+1u);return vec2(x,y);}uint getDataDrivenBlockOffsetVec4(uint dataDrivenBlockSizeVec4) {uint featureIndex=uint(a_feature_index);uvec4 slot=u_spp_index.block_indices[featureIndex/DWORDS_PER_VEC4];uint blockIndex=uvec4At(slot,featureIndex % DWORDS_PER_VEC4);return blockIndex*dataDrivenBlockSizeVec4;}vec4 readColorProperty(PropertyType propertyType,uint dataDrivenBlockSizeVec4) {uint blockOffsetVec4=getDataDrivenBlockOffsetVec4(dataDrivenBlockSizeVec4);vec4 color=readVec4(blockOffsetVec4,propertyType.offsetDwords);if (propertyType.isZoomDependent) {color=unpack_mix_color(color,u_zoom);} else {vec2 packedColor=readVec2(color,propertyType.offsetDwords);color=decode_color(packedColor);}return color;}vec2 readVec2Property(PropertyType propertyType,uint dataDrivenBlockSizeVec4) {uint blockOffsetVec4=getDataDrivenBlockOffsetVec4(dataDrivenBlockSizeVec4);vec4 slot=readVec4(blockOffsetVec4,propertyType.offsetDwords);if (propertyType.isZoomDependent) {vec2 minVal=slot.xy;vec2 maxVal=slot.zw;return mix(minVal,maxVal,u_zoom);}return readVec2(slot,propertyType.offsetDwords);}float readFloatProperty(PropertyType propertyType,uint dataDrivenBlockSizeVec4) {uint blockOffsetVec4=getDataDrivenBlockOffsetVec4(dataDrivenBlockSizeVec4);vec4 slot=readVec4(blockOffsetVec4,propertyType.offsetDwords);float value;if (propertyType.isZoomDependent) {vec2 packedValues=readVec2(slot,propertyType.offsetDwords);value=unpack_mix_vec2(packedValues,u_zoom);} else {value=readFloat(slot,propertyType.offsetDwords);}return value;}SymbolPaintProperties readSymbolPaintProperties() {SymbolPropertyHeader header=readSymbolPropertiesHeader();uint sizeVec4=header.dataDrivenBlockSizeVec4;SymbolPaintProperties props;props.fill_np_color =header.fill_np_color.isDataDriven ? readColorProperty(header.fill_np_color,sizeVec4) : u_spp_fill_np_color;props.halo_np_color =header.halo_np_color.isDataDriven ? readColorProperty(header.halo_np_color,sizeVec4) : u_spp_halo_np_color;props.opacity =header.opacity.isDataDriven ? readFloatProperty(header.opacity,sizeVec4) : u_spp_opacity;props.halo_width =header.halo_width.isDataDriven ? readFloatProperty(header.halo_width,sizeVec4) : u_spp_halo_width;props.halo_blur =header.halo_blur.isDataDriven ? readFloatProperty(header.halo_blur,sizeVec4) : u_spp_halo_blur;props.emissive_strength =header.emissive_strength.isDataDriven ? readFloatProperty(header.emissive_strength,sizeVec4) : u_spp_emissive_strength;props.occlusion_opacity =header.occlusion_opacity.isDataDriven ? readFloatProperty(header.occlusion_opacity,sizeVec4) : u_spp_occlusion_opacity;props.z_offset =header.z_offset.isDataDriven ? readFloatProperty(header.z_offset,sizeVec4) : u_spp_z_offset;props.translate =header.translate.isDataDriven ? readVec2Property(header.translate,sizeVec4) : vec2(0.0);return props;} 2298#else 2299#pragma mapbox: define highp vec4 fill_color 2300#pragma mapbox: define highp vec4 halo_color 2301#pragma mapbox: define lowp float opacity 2302#pragma mapbox: define lowp float halo_width 2303#pragma mapbox: define lowp float halo_blur 2304#pragma mapbox: define lowp float emissive_strength 2305#pragma mapbox: define lowp float occlusion_opacity 2306#pragma mapbox: define highp float z_offset 2307#endif 2308vec2 unpack_opacity(uint packedOpacity) {return vec2(float(packedOpacity/2u)/127.0,float(packedOpacity & 1u));}void main() { 2309#ifdef USE_PAINT_PROPERTIES_UBO 2310SymbolPaintProperties paint_properties=readSymbolPaintProperties();lowp float opacity=paint_properties.opacity;v_opacity=opacity; 2311#ifdef RENDER_SDF 2312v_fill_np_color=paint_properties.fill_np_color;v_halo_np_color=paint_properties.halo_np_color;v_halo_width=paint_properties.halo_width;v_halo_blur=paint_properties.halo_blur; 2313#endif 2314#ifdef LIGHTING_3D_MODE 2315v_emissive_strength=paint_properties.emissive_strength; 2316#endif 2317lowp float occlusion_opacity=paint_properties.occlusion_opacity;highp float z_offset=paint_properties.z_offset; 2318#else 2319#pragma mapbox: initialize highp vec4 fill_color 2320#pragma mapbox: initialize highp vec4 halo_color 2321#pragma mapbox: initialize lowp float opacity 2322#pragma mapbox: initialize lowp float halo_width 2323#pragma mapbox: initialize lowp float halo_blur 2324#pragma mapbox: initialize lowp float emissive_strength 2325#pragma mapbox: initialize lowp float occlusion_opacity 2326#pragma mapbox: initialize highp float z_offset 2327#endif 2328vec2 a_pos=vec2(a_pos_offset.xy);vec2 a_offset=vec2(a_pos_offset.zw);vec2 a_tex=vec2(a_tex_size.xy);vec2 a_size=vec2(a_tex_size.zw);float a_size_min=floor(a_size[0]*0.5);float a_size_max= floor(a_size[1]*0.5);float a_apperance=a_size[1]-2.0*a_size_max;vec2 a_pxoffset=vec2(a_pixeloffset.xy);vec2 a_min_font_scale=vec2(a_pixeloffset.zw)/256.0;highp float segment_angle=-a_projected_pos[3];float size;if (a_apperance==USING_APPEARANCE) {size=a_size_max/128.0;} else if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size_max,u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 tile_anchor=a_pos;float e=u_elevation_from_sea ? z_offset : z_offset+elevation(tile_anchor); 2329#ifdef Z_OFFSET 2330e+=a_auto_z_offset; 2331#endif 2332vec3 h=elevationVector(tile_anchor)*e;float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;vec3 world_pos_globe; 2333#ifdef PROJECTION_GLOBE_VIEW 2334mercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);world_pos_globe=vec3(a_globe_anchor)+h;world_pos=mix_globe_mercator(world_pos_globe,mercator_pos,u_zoom_transition);vec4 ecef_point=u_tile_matrix*vec4(world_pos,1.0);vec3 origin_to_point=ecef_point.xyz-u_ecef_origin;globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0; 2335#else 2336world_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0; 2337#endif 2338vec4 projected_point=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projected_point.w;highp float distance_ratio=u_pitch_with_map ? 2339camera_to_anchor_distance/u_camera_to_center_distance : 2340u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp( 23410.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float font_scale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetprojected_point;vec2 a; 2342#ifdef PROJECTION_GLOBE_VIEW 2343vec3 displacement=vec3(a_globe_normal.z,0,-a_globe_normal.x);
2343offsetprojected_point=u_matrix*vec4(vec3(a_globe_anchor)+displacement,1);vec4 projected_point_globe=u_matrix*vec4(world_pos_globe,1);a=projected_point_globe.xy/projected_point_globe.w; 2344#else 2345offsetprojected_point=u_matrix*vec4(tile_anchor+vec2(1,0),0,1);a=projected_point.xy/projected_point.w; 2346#endif 2347vec2 b=offsetprojected_point.xy/offsetprojected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos; 2348#ifdef PROJECTION_GLOBE_VIEW 2349#ifdef PROJECTED_POS_ON_VIEWPORT 2350projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xyz+h,1.0); 2351#else 2352vec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz,mercator_pos,u_zoom_transition)+h;projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0); 2353#endif 2354#else 2355projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0); 2356#endif 2357highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*max(a_min_font_scale,font_scale)+a_pxoffset/16.0); 2358#ifdef TERRAIN 2359#ifdef PITCH_WITH_MAP_TERRAIN 2360vec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy); 2361#endif 2362#endif 2363#ifdef Z_OFFSET 2364z+=u_pitch_with_map ? a_auto_z_offset+z_offset : 0.0; 2365#else 2366z+=u_pitch_with_map ? z_offset : 0.0; 2367#endif 2368float occlusion_fade=globe_occlusion_fade;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float out_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change)); 2369#ifdef DEPTH_OCCLUSION 2370float depth_occlusion=occlusionFadeMultiSample(projected_point);float depth_occlusion_multplier=mix(occlusion_opacity,1.0,depth_occlusion);out_fade_opacity*=depth_occlusion_multplier; 2371#endif 2372#ifdef OCCLUSION_QUERIES 2373float occludedFadeMultiplier=mix(occlusion_opacity,1.0,a_occlusion_query_opacity);out_fade_opacity*=occludedFadeMultiplier; 2374#endif 2375#ifdef Z_TEST_OCCLUSION 2376out_fade_opacity*=occlusion_opacity; 2377#endif 2378float alpha=opacity*out_fade_opacity;float hidden=float(alpha==0.0 || projected_point.w <=0.0 || occlusion_fade==0.0);vec3 pos; 2379#ifdef PROJECTION_GLOBE_VIEW 2380vec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);pos=projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y; 2381#else 2382#ifdef ELEVATED_ROADS 2383vec3 xAxis=vec3(a_x_axis.xy,a_x_axis.z*u_normal_scale);vec3 yAxis=vec3(a_y_axis.xy,a_y_axis.z*u_normal_scale);pos=projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y; 2384#else 2385pos=vec3(projected_pos.xy/projected_pos.w+offset,z); 2386#endif 2387#endif 2388gl_Position=mix(u_coord_matrix*vec4(pos,1.0),AWAY,hidden); 2389#ifdef USE_PAINT_PROPERTIES_UBO 2390{vec2 tr=paint_properties.translate;vec2 rotated_tr=vec2( 2391u_spp_translate_rotation.x*tr.x-u_spp_translate_rotation.y*tr.y,u_spp_translate_rotation.y*tr.x+u_spp_translate_rotation.x*tr.y 2392);gl_Position.xy+=(u_coord_matrix*vec4(rotated_tr,0.0,0.0)).xy;} 2393#endif 2394float gamma_scale=gl_Position.w;v_draw_halo=(u_is_halo && float(gl_InstanceID)==0.0) ? 1.0 : 0.0;v_gamma_scale_size_fade_opacity=vec3(gamma_scale,size,out_fade_opacity);v_tex_a=a_tex/u_texsize; 2395#ifdef RENDER_TEXT_AND_SYMBOL 2396is_sdf=a_size[0]-2.0*a_size_min;v_tex_a_icon=a_tex/u_texsize_icon; 2397#endif 2398#ifdef ICON_TRANSITION 2399v_tex_b=vec2(a_texb)/u_texsize; 2400#endif 2401#ifdef RENDER_SHADOWS 2402vec4 shd_pos=u_inv_matrix*vec4(pos,1.0);vec3 shd_pos0=shd_pos.xyz;vec3 shd_pos1=shd_pos.xyz; 2403#ifdef NORMAL_OFFSET 2404vec3 shd_pos_offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=shd_pos_offset*shadow_normal_offset_multiplier0();shd_pos1+=shd_pos_offset*shadow_normal_offset_multiplier1(); 2405#endif 2406v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w; 2407#endif 2408#ifdef INDICATOR_CUTOUT 2409v_z_offset=e; 2410#else 2411#ifdef RENDER_SHADOWS 2412v_z_offset=e; 2413#endif 2414#endif 2415}`),terrainRaster:Ft(`#include "_prelude_fog.fragment.glsl" 2416#include "_prelude_shadow.fragment.glsl" 2417#include "_prelude_lighting.glsl" 2418uniform sampler2D u_image0; 2419#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS
2420uniform sampler2D u_image1;uniform float u_emissive_texture_available; 2421#endif 2422in vec2 v_pos0; 2423#ifdef FOG 2424in float v_fog_opacity; 2425#endif 2426#ifdef RENDER_SHADOWS 2427in vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1; 2428#endif 2429uniform vec3 u_ground_shadow_factor;void main() {vec4 image_color=texture(u_image0,v_pos0);vec4 color; 2430#ifdef LIGHTING_3D_MODE 2431const vec3 normal=vec3(0.0,0.0,1.0); 2432#ifdef RENDER_SHADOWS 2433float cutoffOpacity=1.0; 2434#ifdef RENDER_CUTOFF 2435cutoffOpacity=cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w); 2436#endif 2437#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS 2438float emissive_strength=u_emissive_texture_available > 0.5 ? texture(u_image1,v_pos0).r : image_color.a;vec3 unlit_base=image_color.rgb*(1.0-emissive_strength);vec3 emissive_base=image_color.rgb*emissive_strength;float ndotl=u_shadow_direction.z;float occlusion=ndotl < 0.0 ? 1.0 : shadow_occlusion(v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w,0.0);ndotl=max(0.0,ndotl);vec3 lit=apply_lighting(unlit_base,normal,mix(1.0,(1.0-(u_shadow_intensity*occlusion))*ndotl,cutoffOpacity));vec3 emissive=compute_emissive_draped(emissive_base,1.0-u_shadow_intensity,occlusion,u_ground_shadow_factor);color.rgb=lit+emissive;color.a=1.0; 2439#else 2440float lighting_factor=shadowed_light_factor_normal_unbiased(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);color=apply_lighting(image_color,normal,mix(1.0,lighting_factor,cutoffOpacity)); 2441#endif 2442#else 2443float lighting_factor=u_lighting_directional_dir.z;color=apply_lighting(image_color,normal,lighting_factor); 2444#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS 2445float emissive_strength=u_emissive_texture_available > 0.5 ? texture(u_image1,v_pos0).r : image_color.a;color.rgb=mix(color.rgb,image_color.rgb,emissive_strength);color.a=1.0; 2446#endif 2447#endif 2448#else 2449color=image_color; 2450#endif 2451#ifdef FOG 2452#ifdef ZERO_EXAGGERATION 2453color=fog_dither(fog_apply_premultiplied(color,v_fog_pos)); 2454#else 2455color=fog_dither(fog_apply_from_vert(color,v_fog_opacity)); 2456#endif 2457#endif 2458glFragColor=color; 2459#ifdef OVERDRAW_INSPECTOR 2460glFragColor=vec4(1.0); 2461#endif 2462HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 2463#include "_prelude_terrain.vertex.glsl" 2464uniform mat4 u_matrix;uniform float u_skirt_height;in ivec2 a_pos;out vec2 v_pos0; 2465#ifdef FOG 2466out float v_fog_opacity; 2467#endif 2468#ifdef RENDER_SHADOWS 2469uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out vec4 v_pos_light_view_0;out vec4 v_pos_light_view_1; 2470#endif 2471void main() {vec3 decomposedPosAndSkirt=decomposeToPosAndSkirt(a_pos);float skirt=decomposedPosAndSkirt.z;vec2 decodedPos=decomposedPosAndSkirt.xy;float elevation=elevation(decodedPos)-skirt*u_skirt_height;v_pos0=decodedPos/8192.0;gl_Position=u_matrix*vec4(decodedPos,elevation,1.0); 2472#ifdef FOG 2473#ifdef ZERO_EXAGGERATION 2474v_fog_pos=fog_position(decodedPos); 2475#else 2476v_fog_opacity=fog(fog_position(vec3(decodedPos,elevation))); 2477#endif 2478#endif 2479#ifdef RENDER_SHADOWS 2480vec3 pos=vec3(decodedPos,elevation);v_pos_light_view_0=u_light_matrix_0*vec4(pos,1.);v_pos_light_view_1=u_light_matrix_1*vec4(pos,1.); 2481#endif 2482}`),terrainDepth:Ft("precision highp float;in float v_depth;void main() {glFragColor=pack_depth(v_depth);}",`#include "_prelude_terrain.vertex.glsl" 2483uniform mat4 u_matrix;in ivec2 a_pos;out float v_depth;void main() {float elevation=elevation(vec2(a_pos));gl_Position=u_matrix*vec4(a_pos,elevation,1.0);v_depth=gl_Position.z/gl_Position.w;}`),skybox:Ft(`#include "_prelude_fog.fragment.glsl" 2484in lowp vec3 v_uv;uniform lowp samplerCube u_cubemap;uniform lowp float u_opacity;uniform highp float u_temporal_offset;uniform highp vec3 u_sun_direction;float sun_disk(highp vec3 ray_direction,highp vec3 sun_direction) {highp float cos_angle=dot(normalize(ray_direction),sun_direction);const highp float cos_sun_angular_diameter=0.99996192306;const highp float smoothstep_delta=1e-5;return smoothstep( 2485cos_sun_angular_diameter-smoothstep_delta,cos_sun_angular_diameter+smoothstep_delta,cos_angle);}float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(e
2485nd-start)+new_start;}void main() {vec3 uv=v_uv;const float y_bias=0.015;uv.y+=y_bias;uv.y=pow(abs(uv.y),1.0/5.0);uv.y=map(uv.y,0.0,1.0,-1.0,1.0);vec3 sky_color=texture(u_cubemap,uv).rgb; 2486#ifdef FOG 2487sky_color=fog_apply_sky_gradient(v_uv.xzy,sky_color); 2488#endif 2489sky_color+=0.1*sun_disk(v_uv,u_sun_direction);glFragColor=vec4(sky_color*u_opacity,u_opacity); 2490#ifdef OVERDRAW_INSPECTOR 2491glFragColor=vec4(1.0); 2492#endif 2493}`,Jh),skyboxGradient:Ft(`#include "_prelude_fog.fragment.glsl" 2494in highp vec3 v_uv;uniform lowp sampler2D u_color_ramp;uniform highp vec3 u_center_direction;uniform lowp float u_radius;uniform lowp float u_opacity;uniform highp float u_temporal_offset;void main() {float progress=acos(dot(normalize(v_uv),u_center_direction))/u_radius;vec4 color=texture(u_color_ramp,vec2(progress,0.5)); 2495#ifdef FOG 2496color.rgb=fog_apply_sky_gradient(v_uv.xzy,color.rgb/color.a)*color.a; 2497#endif 2498color*=u_opacity;glFragColor=color; 2499#ifdef OVERDRAW_INSPECTOR 2500glFragColor=vec4(1.0); 2501#endif 2502}`,Jh),skyboxCapture:Ft
vendor: 3,792 bytes, lines 2502-2513
2502(` 2503in highp vec3 v_position;uniform highp float u_sun_intensity;uniform highp float u_luminance;uniform lowp vec3 u_sun_direction;uniform highp vec4 u_color_tint_r;uniform highp vec4 u_color_tint_m;precision highp float; 2504#define BETA_R vec3(5.5e-6,13.0e-6,22.4e-6) 2505#define BETA_M vec3(21e-6,21e-6,21e-6) 2506#define MIE_G 0.76 2507#define DENSITY_HEIGHT_SCALE_R 8000.0 2508#define DENSITY_HEIGHT_SCALE_M 1200.0 2509#define PLANET_RADIUS 6360e3 2510#define ATMOSPHERE_RADIUS 6420e3 2511#define SAMPLE_STEPS 10 2512#define DENSITY_STEPS 4 2513float ray_sphere_exit(vec3 orig,vec3 dir,float radius) {float a=dot(dir,dir);float b=2.0*dot(dir,orig);float c=dot(orig,orig)-radius*radius;float d=sqrt(b*b-4.0*a*c);return (-b+d)/(2.0*a);}vec3 extinction(vec2 density) {return exp(-vec3(BETA_R*u_color_tint_r.a*density.x+BETA_M*u_color_tint_m.a*density.y));}vec2 local_density(vec3 point) {float height=max(length(point)-PLANET_RADIUS,0.0);float exp_r=exp(-height/DENSITY_HEIGHT_SCALE_R);float exp_m=exp(-height/DENSITY_HEIGHT_SCALE_M);return vec2(exp_r,exp_m);}float phase_ray(float cos_angle) {return (3.0/(16.0*PI))*(1.0+cos_angle*cos_angle);}float phase_mie(float cos_angle) {return (3.0/(8.0*PI))*((1.0-MIE_G*MIE_G)*(1.0+cos_angle*cos_angle))/((2.0+MIE_G*MIE_G)*pow(1.0+MIE_G*MIE_G-2.0*MIE_G*cos_angle,1.5));}vec2 density_to_atmosphere(vec3 point,vec3 light_dir) {float ray_len=ray_sphere_exit(point,light_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(DENSITY_STEPS);vec2 density_point_to_atmosphere=vec2(0.0);for (int i=0; i < DENSITY_STEPS;++i) {vec3 point_on_ray=point+light_dir*((float(i)+0.5)*step_len);density_point_to_atmosphere+=local_density(point_on_ray)*step_len;;}return density_point_to_atmosphere;}vec3 atmosphere(vec3 ray_dir,vec3 sun_direction,float sun_intensity) {vec2 density_orig_to_point=vec2(0.0);vec3 scatter_r=vec3(0.0);vec3 scatter_m=vec3(0.0);vec3 origin=vec3(0.0,PLANET_RADIUS,0.0);float ray_len=ray_sphere_exit(origin,ray_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(SAMPLE_STEPS);for (int i=0; i < SAMPLE_STEPS;++i) {vec3 point_on_ray=origin+ray_dir*((float(i)+0.5)*step_len);vec2 density=local_density(point_on_ray)*step_len;density_orig_to_point+=density;vec2 density_point_to_atmosphere=density_to_atmosphere(point_on_ray,sun_direction);vec2 density_orig_to_atmosphere=density_orig_to_point+density_point_to_atmosphere;vec3 extinction=extinction(density_orig_to_atmosphere);scatter_r+=density.x*extinction;scatter_m+=density.y*extinction;}float cos_angle=dot(ray_dir,sun_direction);float phase_r=phase_ray(cos_angle);float phase_m=phase_mie(cos_angle);vec3 beta_r=BETA_R*u_color_tint_r.rgb*u_color_tint_r.a;vec3 beta_m=BETA_M*u_color_tint_m.rgb*u_color_tint_m.a;return (scatter_r*phase_r*beta_r+scatter_m*phase_m*beta_m)*sun_intensity;}const float A=0.15;const float B=0.50;const float C=0.10;const float D=0.20;const float E=0.02;const float F=0.30;vec3 uncharted2_tonemap(vec3 x) {return ((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;}void main() {vec3 ray_direction=v_position;ray_direction.y=pow(ray_direction.y,5.0);const float y_bias=0.015;ray_direction.y+=y_bias;vec3 color=atmosphere(normalize(ray_direction),u_sun_direction,u_sun_intensity);float white_scale=1.0748724675633854;color=uncharted2_tonemap((log2(2.0/pow(u_luminance,4.0)))*color)*white_scale;glFragColor=vec4(color,1.0);}`,"in highp vec3 a_pos_3f;uniform mat3 u_matrix_3f;out highp vec3 v_position;float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(end-start)+new_start;}void main() {vec4 pos=vec4(u_matrix_3f*a_pos_3f,1.0);v_position=pos.xyz;v_position.y*=-1.0;v_position.y=map(v_position.y,-1.0,1.0,0.0,1.0);gl_Position=vec4(a_pos_3f.xy,0.0,1.0);}"),globe
2513Raster:Ft(`#include "_prelude_fog.fragment.glsl" 2514#include "_prelude_lighting.glsl" 2515uniform sampler2D u_image0; 2516#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS 2517uniform sampler2D u_image1;uniform float u_emissive_texture_available; 2518#endif 2519uniform float u_far_z_cutoff;in vec2 v_pos0; 2520#ifndef FOG 2521uniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform vec2 u_viewport; 2522#endif 2523void main() {vec4 color; 2524#ifdef CUSTOM_ANTIALIASING 2525highp vec2 uv=gl_FragCoord.xy/u_viewport; 2526#ifdef FLIP_Y 2527uv.y=1.0-uv.y; 2528#endif 2529highp vec3 ray_dir=mix( 2530mix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);highp vec3 dir=normalize(ray_dir);highp vec3 closest_point=dot(u_globe_pos,dir)*dir;highp float norm_dist_from_center=1.0-length(closest_point-u_globe_pos)/u_globe_radius;const float antialias_pixel=2.0;highp float antialias_factor=antialias_pixel*fwidth(norm_dist_from_center);highp float antialias=smoothstep(0.0,antialias_factor,norm_dist_from_center);vec4 raster=texture(u_image0,v_pos0); 2531#ifdef LIGHTING_3D_MODE 2532#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS 2533float emissive_strength=u_emissive_texture_available > 0.5 ? texture(u_image1,v_pos0).r : raster.a;raster=apply_lighting_with_emission_ground(raster,emissive_strength);color=vec4(clamp(raster.rgb,vec3(0),vec3(1))*antialias,antialias); 2534#else 2535raster=apply_lighting_ground(raster);color=vec4(raster.rgb*antialias,raster.a*antialias); 2536#endif 2537#else 2538color=vec4(raster.rgb*antialias,raster.a*antialias); 2539#endif 2540#else 2541color=texture(u_image0,v_pos0); 2542#ifdef LIGHTING_3D_MODE 2543#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS 2544float emissive_strength=u_emissive_texture_available > 0.5 ? texture(u_image1,v_pos0).r : color.a;color=apply_lighting_with_emission_ground(color,emissive_strength);color.a=1.0; 2545#else 2546color=apply_lighting_ground(color); 2547#endif 2548#endif 2549#endif 2550#ifdef FOG 2551color=fog_dither(fog_apply_premultiplied(color,v_fog_pos)); 2552#endif 2553color*=1.0-step(u_far_z_cutoff,1.0/gl_FragCoord.w);glFragColor=color; 2554#ifdef OVERDRAW_INSPECTOR 2555glFragColor=vec4(1.0); 2556#endif 2557HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 2558#include "_prelude_terrain.vertex.glsl" 2559uniform mat4 u_proj_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform float u_zoom_transition;uniform vec2 u_merc_center;uniform mat3 u_grid_matrix;uniform float u_skirt_height; 2560#ifdef GLOBE_POLES 2561in vec3 a_globe_pos;in vec2 a_uv; 2562#else 2563in ivec2 a_pos; 2564#endif 2565out vec2 v_pos0;void main() { 2566#ifdef GLOBE_POLES 2567vec3 globe_pos=a_globe_pos;vec2 uv=a_uv; 2568#else 2569float tiles=u_grid_matrix[0][2];float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];vec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);float mercatorY=mercatorYfromLat(latLng[0]);float uvY=mercatorY*tiles-idy;float mercatorX=mercatorXfromLng(latLng[1]);float uvX=mercatorX*tiles-idx;vec3 globe_pos=latLngToECEF(latLng.xy);vec2 merc_pos=vec2(mercatorX,mercatorY);vec2 uv=vec2(uvX,uvY); 2570#endif 2571v_pos0=uv;vec2 tile_pos=uv*EXTENT;vec3 globe_derived_up_vector=normalize(globe_pos)*u_tile_up_scale; 2572#ifdef GLOBE_POLES 2573vec3 up_vector=globe_derived_up_vector; 2574#else 2575vec3 up_vector=elevationVector(tile_pos); 2576#endif 2577float height=elevation(tile_pos);globe_pos+=up_vector*height; 2578#ifndef GLOBE_POLES 2579globe_pos-=globe_derived_up_vector*u_skirt_height*decomposed_pos_and_skirt.z; 2580#endif 2581#ifdef GLOBE_POLES 2582vec4 interpolated_pos=u_globe_matrix*vec4(globe_pos,1.0); 2583#else 2584vec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);if (u_zoom_transition > 0.0) {merc_world_pos=vec4(merc_pos,height-u_skirt_height*decomposed_pos_and_skirt.z,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition),1.0); 2585#endif 2586gl_Position=u_proj_matrix*interpolated_pos; 2587#ifdef FOG 2588v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz); 2589#endif 2590}`),globeAtmosphere:Ft(`#include "_prelude_fog.fragment.glsl" 2591uniform float u_transition;uniform highp float u_fadeout_range;uniform highp float u_temporal_offset;uniform vec4 u_atmosphere_fog_color;uniform vec4 u_high_color;uniform vec4 u_space_color;uniform float u_horizon_angle;in highp vec3 v_ray_dir;in highp vec3 v_horizon_dir;void main() {highp vec3 dir=normalize(v_ray_dir);float globe_pos_dot_dir; 2592#ifdef PROJECTION_GLOBE_VIEW 2593globe_pos_dot_dir=dot(u_globe_pos,dir);highp vec3 closest_point_forward=abs(globe_pos_dot_dir)*dir;float norm_dist_from_center=length(closest_point_forward-u_globe_pos)/u_globe_radius;if (norm_dist_from_center < 0.98) { 2594#ifdef ALPHA_PASS 2595glFragColor=vec4(0,0,0,0);return; 2596#else 2597#ifdef NATIVE 2598glFragColor=vec4(1,1,1,1); 2599#else 2600glFragColor=vec4(0,0,0,1); 2601#endif 2602return; 2603#endif 2604} 2605#endif 2606highp vec3 horizon_dir=normalize(v_horizon_dir);float horizon_angle_mercator=dir.y < horizon_dir.y ? 26070.0 : max(acos(clamp(dot(dir,horizon_dir),-1.0,1.0)),0.0);float horizon_angle; 2608#ifdef PROJECTION_GLOBE_VIEW 2609highp vec3 closest_point=globe_pos_dot_dir*dir;highp float closest_point_to_center=length(closest_point-u_globe_pos);highp float theta=asin(clamp(closest_point_to_center/length(u_globe_pos),-1.0,1.0));horizon_angle=globe_pos_dot_dir < 0.0 ? 2610PI-theta-u_horizon_angle : theta-u_horizon_angle;float angle_t=pow(u_transition,10.0);horizon_angle=mix(horizon_angle,horizon_angle_mercator,angle_t); 2611#else 2612horizon_angle=horizon_angle_mercator; 2613#endif 2614horizon_angle/=PI;float t=exp(-horizon_angle/u_fadeout_range);float alpha_0=u_atmosphere_fog_color.a;float alpha_1=u_high_color.a;float alpha_2=u_space_color.a;vec3 color_stop_0=u_atmosphere_fog_color.rgb;vec3 color_stop_1=u_high_color.rgb;
2614vec3 color_stop_2=u_space_color.rgb; 2615#ifdef ALPHA_PASS 2616float a0=mix(alpha_2,1.0,alpha_1);float a1=mix(a0,1.0,alpha_0);float a2=mix(a0,a1,t);float a =mix(alpha_2,a2,t);glFragColor=vec4(1.0,1.0,1.0,a); 2617#else 2618vec3 c0=mix(color_stop_2,color_stop_1,alpha_1);vec3 c1=mix(c0,color_stop_0,alpha_0);vec3 c2=mix(c0,c1,t);vec3 c=c2;glFragColor=vec4(c*t,t); 2619#endif 2620}`,`in vec3 a_pos;in vec2 a_uv;uniform vec3 u_frustum_tl;uniform vec3 u_frustum_tr;uniform vec3 u_frustum_br;uniform vec3 u_frustum_bl;uniform float u_horizon;out highp vec3 v_ray_dir;out highp vec3 v_horizon_dir;void main() {v_ray_dir=mix( 2621mix(u_frustum_tl,u_frustum_tr,a_uv.x),mix(u_frustum_bl,u_frustum_br,a_uv.x),a_uv.y);v_horizon_dir=mix( 2622mix(u_frustum_tl,u_frustum_bl,u_horizon),mix(u_frustum_tr,u_frustum_br,u_horizon),a_uv.x);gl_Position=vec4(a_pos,1.0);}`),model:Ft(`#include "_prelude_fog.fragment.glsl" 2623#include "_prelude_shadow.fragment.glsl" 2624#include "_prelude_lighting.glsl" 2625uniform float u_opacity; 2626#ifdef DITHERED_DISCARD 2627uniform float u_dithered_discard_threshold; 2628#endif 2629uniform vec3 u_lightcolor;uniform vec3 u_lightpos;uniform float u_lightintensity;uniform vec4 u_baseColorFactor;uniform vec4 u_emissiveFactor;uniform float u_metallicFactor;uniform float u_roughnessFactor;uniform float u_emissive_strength;in highp vec4 v_position_height;in lowp vec4 v_color_mix; 2630#ifdef RENDER_SHADOWS 2631in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in float v_depth_shadows; 2632#endif 2633#ifdef OCCLUSION_TEXTURE_TRANSFORM 2634uniform vec4 u_occlusionTextureTransform; 2635#endif 2636#pragma mapbox: define-attribute highp vec3 normal_3f 2637#pragma mapbox: define-attribute highp vec3 color_3f 2638#pragma mapbox: define-attribute highp vec4 color_4f 2639#pragma mapbox: define-attribute highp vec2 uv_2f 2640#pragma mapbox: initialize-attribute highp vec3 normal_3f 2641#pragma mapbox: initialize-attribute highp vec3 color_3f 2642#pragma mapbox: initialize-attribute highp vec4 color_4f 2643#pragma mapbox: initialize-attribute highp vec2 uv_2f 2644#ifdef HAS_ATTRIBUTE_a_pbr 2645in lowp vec4 v_roughness_metallic_emissive_alpha;in mediump vec4 v_height_based_emission_params; 2646#endif 2647#ifdef HAS_TEXTURE_u_baseColorTexture 2648uniform sampler2D u_baseColorTexture;uniform bool u_baseTextureIsAlpha;uniform bool u_alphaMask;uniform float u_alphaCutoff; 2649#endif 2650#ifdef HAS_TEXTURE_u_metallicRoughnessTexture 2651uniform sampler2D u_metallicRoughnessTexture; 2652#endif 2653#ifdef HAS_TEXTURE_u_occlusionTexture 2654uniform sampler2D u_occlusionTexture;uniform float u_aoIntensity; 2655#endif 2656#ifdef HAS_TEXTURE_u_normalTexture 2657uniform sampler2D u_normalTexture; 2658#endif 2659#ifdef HAS_TEXTURE_u_emissionTexture 2660uniform sampler2D u_emissionTexture; 2661#endif 2662#ifdef APPLY_LUT_ON_GPU 2663uniform highp sampler3D u_lutTexture; 2664#endif 2665#ifdef TERRAIN_FRAGMENT_OCCLUSION 2666in highp float v_depth;uniform highp sampler2D u_depthTexture;uniform highp vec2 u_inv_depth_size;uniform highp vec2 u_depth_range_unpack; 2667#ifdef DEPTH_D24 2668highp float unpack_depth(highp float depth) {return depth*u_depth_range_unpack.x+u_depth_range_unpack.y;} 2669#else 2670highp float unpack_depth_rgba(highp vec4 rgba_depth) 2671{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;} 2672#endif 2673bool isOccluded() {highp vec2 coord=gl_FragCoord.xy*u_inv_depth_size; 2674#ifdef FLIP_Y 2675coord.y=1.0-coord.y; 2676#endif 2677#ifdef DEPTH_D24 2678highp float depth=unpack_depth(texture(u_depthTexture,coord).r); 2679#else 2680highp float depth=unpack_depth_rgba(texture(u_depthTexture,coord)); 2681#endif 2682return v_depth > depth+0.0005;} 2683#endif 2684#define saturate(_x) clamp(_x,0.,1.) 2685vec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}float calculate_NdotL(vec3 normal,vec3 lightDir) {const float ext=0.70710678118;return (clamp(dot(normal,lightDir),-ext,1.0)+ext)/(1.0+ext);}vec3 getDiffuseShadedColor(vec3 albedo,vec3 normal,vec3 lightDir,vec3 lightColor) 2686{ 2687#ifdef LIGHTING_3D_MODE 2688vec3 transformed_normal=vec3(-normal.xy,normal.z);float lighting_factor; 2689#ifdef RENDER_SHADOWS 2690lighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows); 2691#else 2692lighting_factor=saturate(dot(transformed_normal,u_lighting_directional_dir)); 2693#endif 2694return apply_lighting(albedo,transformed_normal,lighting_factor); 2695#else 2696vec3 n=normal;float colorvalue=((albedo.x*0.2126)+(albedo.y*0.7152))+(albedo.z*0.0722);vec3 c=vec3(0.03,0.03,0.03);float directional=clamp(dot(n,vec3(lightDir)),0.0,1.0);directional=mix(1.0-u_lightintensity,max((1.0-colorvalue)+u_lightintensity,1.0),directional);vec3 c3=c+clamp((albedo*directional)*lightColor,mix(vec3(0.0),vec3(0.3),vec3(1.0)-light
2696Color),vec3(1.0));return c3; 2697#endif 2698}vec4 getBaseColor() {vec4 albedo=u_baseColorFactor; 2699#ifdef HAS_ATTRIBUTE_a_color_3f 2700albedo*=vec4(color_3f,1.0); 2701#endif 2702#ifdef HAS_ATTRIBUTE_a_pbr 2703#else 2704#ifdef HAS_ATTRIBUTE_a_color_4f 2705albedo*=color_4f; 2706#endif 2707#endif 2708#if defined (HAS_TEXTURE_u_baseColorTexture) && defined (HAS_ATTRIBUTE_a_uv_2f) 2709vec4 texColor=texture(u_baseColorTexture,uv_2f);if(u_alphaMask) {if (texColor.w < u_alphaCutoff) {discard;}} 2710#ifdef UNPREMULT_TEXTURE_IN_SHADER 2711texColor=vec4(unpremultiplyColor(texColor),1.0); 2712#endif 2713if(u_baseTextureIsAlpha) {if (texColor.r < 0.5) {discard;}} else {texColor.rgb=sRGBToLinear(texColor.rgb);albedo*=texColor;} 2714#endif 2715vec4 color=vec4(mix(albedo.rgb,v_color_mix.rgb,v_color_mix.a),albedo.a); 2716#ifdef APPLY_LUT_ON_GPU 2717color=applyLUT(u_lutTexture,color); 2718#endif 2719return color;}highp mat3 cotangentFrame(highp vec3 N,highp vec3 p,highp vec2 uv ) { 2720#ifdef HAS_TEXTURE_u_normalTexture 2721highp vec3 dp1=vec3(dFdx(p.x),dFdx(p.y),dFdx(p.z));highp vec3 dp2=vec3(dFdy(p.x),dFdy(p.y),dFdy(p.z));highp vec2 duv1=vec2(dFdx(uv.x),dFdx(uv.y));highp vec2 duv2=vec2(dFdy(uv.x),dFdy(uv.y));highp vec3 dp2perp=cross( dp2,N );highp vec3 dp1perp=cross( N,dp1 );highp vec3 T=dp2perp*duv1.x+dp1perp*duv2.x;highp vec3 B=dp2perp*duv1.y+dp1perp*duv2.y; 2722#ifdef FLIP_Y 2723T=-T;B=-B; 2724#endif 2725highp float lengthT=dot(T,T);highp float lengthB=dot(B,B);highp float maxLength=max(lengthT,lengthB);highp float invmax=inversesqrt( maxLength );highp mat3 res=mat3( T*invmax,B*invmax,N );return res; 2726#else 2727return mat3(1.0); 2728#endif 2729}highp vec3 getNormal(){highp vec3 n; 2730#ifdef HAS_ATTRIBUTE_a_normal_3f 2731n=normalize(normal_3f); 2732#else 2733highp vec3 fdx=vec3(dFdx(v_position_height.x),dFdx(v_position_height.y),dFdx(v_position_height.z));highp vec3 fdy=vec3(dFdy(v_position_height.x),dFdy(v_position_height.y),dFdy(v_position_height.z)); 2734#ifdef FLIP_Y 2735n=normalize(cross(fdx,fdy)); 2736#else 2737n=normalize(cross(fdx,fdy))*-1.0; 2738#endif 2739#endif 2740#if defined(HAS_TEXTURE_u_normalTexture) && defined(HAS_ATTRIBUTE_a_uv_2f) 2741vec3 nMap=texture( u_normalTexture,uv_2f).xyz;nMap=normalize(2.0*nMap-vec3(1.0));highp vec3 v=normalize(-v_position_height.xyz);highp mat3 TBN=cotangentFrame(n,v,uv_2f);n=normalize(TBN*nMap); 2742#endif 2743return n;}struct Material {float perceptualRoughness;float alphaRoughness;float metallic;vec3 f90;vec4 baseColor;vec3 diffuseColor;vec3 specularColor;highp vec3 normal;};Material getPBRMaterial() {Material mat;mat.baseColor=getBaseColor();mat.perceptualRoughness=u_roughnessFactor;mat.metallic=u_metallicFactor; 2744#ifdef HAS_ATTRIBUTE_a_pbr 2745mat.perceptualRoughness=v_roughness_metallic_emissive_alpha.x;mat.metallic=v_roughness_metallic_emissive_alpha.y;mat.baseColor.w*=v_roughness_metallic_emissive_alpha.w; 2746#endif 2747#if defined(HAS_TEXTURE_u_metallicRoughnessTexture) && defined(HAS_ATTRIBUTE_a_uv_2f) 2748vec4 mrSample=texture(u_metallicRoughnessTexture,uv_2f);mat.perceptualRoughness*=mrSample.g;mat.metallic*=mrSample.b; 2749#endif 2750const float c_minRoughness=0.04;mat.perceptualRoughness=clamp(mat.perceptualRoughness,c_minRoughness,1.0);mat.metallic=saturate(mat.metallic);mat.alphaRoughness=mat.perceptualRoughness*mat.perceptualRoughness;const vec3 f0=vec3(0.04);mat.diffuseColor=mat.baseColor.rgb*(vec3(1.0)-f0);mat.diffuseColor*=1.0-mat.metallic;mat.specularColor=mix(f0,mat.baseColor.rgb,mat.metallic);highp float reflectance=max(max(mat.specularColor.r,mat.specularColor.g),mat.specularColor.b);highp float reflectance90=saturate(reflectance*25.0);mat.f90=vec3(reflectance90);mat.normal=getNormal();return mat;}float V_GGX(float NdotL,float NdotV,float roughness) 2751{float a2=roughness*roughness;float GGXV=NdotL*sqrt(NdotV*NdotV*(1.0-a2)+a2);float GGXL=NdotV*sqrt(NdotL*NdotL*(1.0-a2)+a2);return 0.5/(GGXV+GGXL);}float V_GGXFast(float NdotL,float NdotV,float roughness) {float a=roughness;float GGXV=NdotL*(NdotV*(1.0-a)+a);float GGXL=NdotV*(NdotL*(1.0-a)+a);return 0.5/(GGXV+GGXL);}vec3 F_Schlick(vec3 specularColor,vec3 f90,float VdotH) 2752{return specularColor+(f90-specularColor)*pow(clamp(1.0-VdotH,0.0,1.0),5.0);}vec3 F_SchlickFast(vec3 specularColor,float VdotH) 2753{float x=1.0-VdotH;float x4=x*x*x*x;return specularColor+(1.0-specularColor)*x4*x;}float D_GGX(highp float NdotH,float alphaRoughness) 2754{highp float a4=alphaRoughness*alphaRoughness;highp float f=(NdotH*a4-NdotH)*NdotH+1.0;return a4/(PI*f*f);}vec3 diffuseBurley(Material mat,float LdotH,float NdotL,float NdotV) 2755{float f90=2.0*LdotH*LdotH*mat.alphaRoughness-0.5;return (mat.diffuseColor/PI)*(1.0+f90*pow((1.0-NdotL),5.0))*(1.0+f90*pow((1.0-NdotV),5.0));}vec3 diffuseLambertian(Material mat) 2756{ 2757#ifdef LIGHTING_3D_MODE 2758return mat.diffuseColor; 2759#else 2760return mat.diffuseColor/PI; 2761#endif 2762}vec3 EnvBRDFApprox(vec3 specularColor,float roughness,highp float NdotV) 2763{vec4 c0=vec4(-1,-0.0275,-0.572,0.022);vec4 c1=vec4(1,0.0425,1.04,-0.04);highp vec4 r=roughness*c0+c1;highp float a004=min(r.x*r.x,exp2(-9.28*NdotV))*r.x+r.y;vec2 AB=vec2(-1.04,1.04)*a004+r.zw;return specularColor*AB.x+AB.y;}vec3 computeIndirectLightContribution(Material mat,float NdotV,vec3 normal) 2764{vec3 env_light=vec3(0.65,0.65,0.65); 2765#ifdef LIGHTING_3D_MODE 2766float ambient_factor=calculate_ambient_directional_factor(normal);env_light=u_lighting_ambient_color*ambient_factor; 2767#endif 2768vec3 envBRDF=EnvBRDFApprox(mat.specularColor,mat.perceptualRoughness,NdotV);vec3 indirectSpecular= envBRDF*env_light;vec3 indirectDiffuse=mat.diffuseColor*env_light;return indirectSpecular+indirectDiffuse;}vec3 computeLightContribution(Material mat,vec3 lightPosition,vec3 lightColor) 2769{highp vec3 n=mat.normal;highp vec3 v=normalize(-v_position_height.xyz);highp vec3 l=normalize(lightPosition);highp vec3 h=normalize(v+l);float NdotV=clamp(abs(dot(n,v)),0.001,1.0);float NdotL=saturate(dot(n,l));highp float NdotH=saturate(dot(n,h));float VdotH=saturate(dot(v,h));vec3 f=F_SchlickFast(mat.specularColor,VdotH);float g=V_GGXFast(NdotL,NdotV,mat.alphaRoughness);float d=D_GGX(NdotH,mat.alphaRoughness);vec3 diffuseTerm=(1.0-f)*diffuseLambertian(mat);vec3 specularTerm=f*g*d;vec3 transformed_normal=vec3(-n.xy,n.z);float lighting_factor; 2770#ifdef RENDER_SHADOWS 2771lighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows); 2772#else 2773lighting_factor=NdotL; 2774#endif 2775vec3 directLightColor=(specularTerm+diffuseTerm)*lighting_factor*light
2775Color;vec3 indirectLightColor=computeIndirectLightContribution(mat,NdotV,transformed_normal);vec3 color=(saturate(directLightColor)+indirectLightColor);float intensityFactor=1.0; 2776#if !defined(LIGHTING_3D_MODE) 2777const vec3 luminosityFactor=vec3(0.2126,0.7152,0.0722);float luminance=dot(diffuseTerm,luminosityFactor);intensityFactor=mix((1.0-u_lightintensity),max((1.0-luminance+u_lightintensity),1.0),NdotL); 2778#endif 2779color*=intensityFactor;return color;}void main() { 2780#ifdef TERRAIN_FRAGMENT_OCCLUSION 2781if (isOccluded()) {discard;} 2782#endif 2783vec3 lightDir=u_lightpos;vec3 lightColor=u_lightcolor; 2784#ifdef LIGHTING_3D_MODE 2785lightDir=u_lighting_directional_dir;lightDir.xy=-lightDir.xy;lightColor=u_lighting_directional_color; 2786#endif 2787vec4 finalColor; 2788#ifdef DIFFUSE_SHADED 2789vec3 N=getNormal();vec3 baseColor=getBaseColor().rgb;vec3 diffuse=getDiffuseShadedColor(baseColor,N,lightDir,lightColor); 2790#ifdef HAS_TEXTURE_u_occlusionTexture 2791float ao=(texture(u_occlusionTexture,uv_2f).r-1.0)*u_aoIntensity+1.0;diffuse*=ao; 2792#endif 2793finalColor=vec4(mix(diffuse,baseColor,u_emissive_strength),1.0)*u_opacity; 2794#else 2795Material mat=getPBRMaterial();vec3 color=computeLightContribution(mat,lightDir,lightColor);float ao=1.0; 2796#if defined (HAS_TEXTURE_u_occlusionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f) 2797#ifdef OCCLUSION_TEXTURE_TRANSFORM 2798vec2 uv=uv_2f.xy*u_occlusionTextureTransform.zw+u_occlusionTextureTransform.xy; 2799#else 2800vec2 uv=uv_2f; 2801#endif 2802ao=(texture(u_occlusionTexture,uv).x-1.0)*u_aoIntensity+1.0;color*=ao; 2803#endif 2804vec4 emissive=u_emissiveFactor; 2805#if defined(HAS_TEXTURE_u_emissionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f) 2806emissive.rgb*=sRGBToLinear(texture(u_emissionTexture,uv_2f).rgb); 2807#endif 2808#ifdef APPLY_LUT_ON_GPU 2809float emissiveFactorLength=max(length(u_emissiveFactor.rgb),0.001);emissive.rgb=sRGBToLinear(applyLUT(u_lutTexture,linearTosRGB(emissive.rgb/emissiveFactorLength).rbg))*emissiveFactorLength; 2810#endif 2811color+=emissive.rgb;float opacity=mat.baseColor.w*u_opacity; 2812#ifdef HAS_ATTRIBUTE_a_pbr 2813float resEmission=v_roughness_metallic_emissive_alpha.z;resEmission*=v_height_based_emission_params.z+v_height_based_emission_params.w*pow(clamp(v_height_based_emission_params.x,0.0,1.0),v_height_based_emission_params.y);vec3 color_mix=v_color_mix.rgb; 2814#ifdef APPLY_LUT_ON_GPU 2815color_mix=applyLUT(u_lutTexture,color_mix); 2816#endif 2817color=mix(color,color_mix,min(1.0,resEmission)); 2818#ifdef HAS_ATTRIBUTE_a_color_4f 2819float distance=length(vec2(1.3*max(0.0,abs(color_4f.x)-color_4f.z),color_4f.
2819y));distance+= mix(0.5,0.0,clamp(resEmission-1.0,0.0,1.0));opacity*=v_roughness_metallic_emissive_alpha.w*saturate(1.0-distance*distance); 2820#endif 2821#endif 2822vec3 unlitColor=mat.baseColor.rgb*ao+emissive.rgb;color=mix(color,unlitColor,u_emissive_strength);color=linearTosRGB(color);color*=opacity;finalColor=vec4(color,opacity); 2823#endif 2824#ifdef DITHERED_DISCARD 2825if (abs(u_dithered_discard_threshold) < 1.0) {float ditherValue=fract(52.9829189*fract(0.06711056*gl_FragCoord.x+0.00583715*gl_FragCoord.y));float compareValue=mix(1.0-ditherValue,ditherValue,step(0.0,u_dithered_discard_threshold));if (abs(u_dithered_discard_threshold) < compareValue) {discard;}} 2826#endif 2827#ifdef FOG 2828finalColor=fog_dither(fog_apply_premultiplied(finalColor,v_fog_pos,v_position_height.w)); 2829#endif 2830#ifdef RENDER_CUTOFF 2831finalColor*=v_cutoff_opacity; 2832#endif 2833#ifdef INDICATOR_CUTOUT 2834finalColor=applyCutout(finalColor,v_position_height.w); 2835#endif 2836#ifdef FEATURE_CUTOUT 2837finalColor=apply_feature_cutout(finalColor,gl_FragCoord,get_cutout_factors(gl_FragCoord).x); 2838#endif 2839glFragColor=finalColor; 2840#ifdef OVERDRAW_INSPECTOR 2841glFragColor=vec4(1.0); 2842#endif 2843HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 2844#include "_prelude_shadow.vertex.glsl" 2845in vec3 a_pos_3f; 2846#pragma mapbox: define-attribute highp vec3 normal_3f 2847#pragma mapbox: define-attribute highp vec2 uv_2f 2848#pragma mapbox: define-attribute highp vec3 color_3f 2849#pragma mapbox: define-attribute highp vec4 color_4f 2850#pragma mapbox: define-attribute-vertex-shader-only highp uvec4 pbr 2851#pragma mapbox: define-attribute-vertex-shader-only highp vec3 heightBasedEmissiveStrength 2852uniform mat4 u_matrix;uniform mat4 u_node_matrix;uniform mat4 u_lighting_matrix;uniform vec3 u_camera_pos;uniform vec4 u_color_mix; 2853#ifdef INSTANCED_ARRAYS 2854in vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3; 2855#else 2856uniform highp mat4 u_normal_matrix; 2857#endif 2858#ifdef RENDER_SHADOWS 2859uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out float v_depth_shadows; 2860#endif 2861out vec4 v_position_height;out lowp vec4 v_color_mix; 2862#ifdef TERRAIN_FRAGMENT_OCCLUSION 2863out highp float v_depth; 2864#endif 2865#ifdef HAS_ATTRIBUTE_a_pbr 2866out lowp vec4 v_roughness_metallic_emissive_alpha;out mediump vec4 v_height_based_emission_params; 2867#endif 2868vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}void main() { 2869#pragma mapbox: initialize-attribute highp vec3 normal_3f 2870#pragma mapbox: initialize-attribute highp vec2 uv_2f 2871#pragma mapbox: initialize-attribute highp vec3 color_3f 2872#pragma mapbox: initialize-attribute highp vec4 color_4f 2873#pragma mapbox: initialize-attribute-custom highp uvec4 pbr 2874#pragma mapbox: initialize-attribute-custom highp vec3 heightBasedEmissiveStrength 2875highp mat4 normal_matrix; 2876#ifdef INSTANCED_ARRAYS 2877normal_matrix=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3); 2878#else 2879normal_matrix=u_normal_matrix; 2880#endif 2881vec3 local_pos;mat3 rs; 2882#ifdef MODEL_POSITION_ON_GPU 2883vec3 pos_color=normal_matrix[0].xyz;vec4 translate=normal_matrix[1];vec3 pos_a=floor(pos_color);vec3 rgb=1.05*(pos_color-pos_a);float hidden=float(pos_a.x > EXTENT);float color_mix=pos_a.z/100.0;v_color_mix=vec4(sRGBToLinear(rgb),color_mix);float meter_to_tile=normal_matrix[0].w;vec4 pos=vec4(pos_a.xy,translate.z,1.0);rs[0].x=normal_matrix[1].w;rs[0].yz=normal_matrix[2].xy;rs[1].xy=normal_matrix[2].zw;rs[1].z=normal_matrix[3].x;rs[2].xyz=normal_matrix[3].yzw;vec4 pos_node=u_lighting_matrix*vec4(a_pos_3f,1.0);vec3 rotated_pos_node=rs*pos_node.xyz;vec3 pos_model_tile=(rotated_pos_node+vec3(translate.xy,0.0))*vec3(meter_to_tile,meter_to_tile,1.0);pos.xyz+=pos_model_tile;local_pos=pos.xyz;gl_Position=mix(u_matrix*pos,AWAY,hidden);pos.z*=meter_to_tile;v_position_height.xyz=pos.xyz-u_camera_pos; 2884#else 2885local_pos=a_pos_3f;gl_Position=u_matrix*vec4(a_pos_3f,1);v_position_height.xyz=vec3(u_lighting_matrix*vec4(a_pos_3f,1));v_color_mix=vec4(sRGBToLinear(u_color_mix.rgb),u_color_mix.a); 2886#endif 2887v_position_height.w=a_pos_3f.z; 2888#ifdef HAS_ATTRIBUTE_a_pbr 2889vec4 albedo_c=decode_color(vec2(pbr.xy));vec2 e_r_m=unpack_float(float(pbr.z));vec2 r_m= unpack_float(e_r_m.y*16.0);r_m.r=r_m.r*16.0;v_color_mix=vec4(albedo_c.rgb,1.0);v_roughness_metallic_emissive_alpha=vec4(vec3(r_m,e_r_m.x)/255.0,albedo_c.a);v_roughness_metallic_emissive_alpha.z*=2.0;float heightBasedRelativeIntepolation=a_pos_3f.z*heightBasedEmissiveStrength.x+heightBasedEmissiveStrength.y;v_height_based_emission_params.x=heightBasedRelativeIntepolation;v_height_based_emission_params.y=heightBasedEmissiveStrength.z;vec2 emissionMultiplierValues=unpack_float(float(pbr.w))/256.0;v_height_based_emission_params.z=emissionMultiplierValues.x;v_height_based_emission_params.w=emissionMultiplierValues.y-emissionMultiplierValues.x; 2890#endif 2891#ifdef FOG 2892v_fog_pos=fog_position(local_pos); 2893#endif 2894#ifdef RENDER_CUTOFF 2895v_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z); 2896#endif 2897#ifdef TERRAIN_FRAGMENT_OCCLUSION 2898v_depth=gl_Position.z/gl_Position.w; 2899#ifdef CLIP_ZERO_TO_ONE 2900v_depth=-1.0+2.0*v_depth; 2901#endif 2902#endif 2903#ifdef HAS_ATTRIBUTE_a_normal_3f 2904#ifdef MODEL_POSITION_ON_GPU 2905float x_squared_scale=dot(rs[0],rs[0]);float y_squared_scale=dot(rs[1],rs[1]);float z_squared_scale=dot(rs[2],rs[2]);vec3 squared_scale=vec3(x_squared_scale,y_squared_scale,z_squared_scale);normal_3f=rs*((u_lighting_matrix*vec4(normal_3f,0.0)).xyz/squared_scale);normal_3f=normalize(normal_3f); 2906#else
2907normal_3f=vec3(normal_matrix*vec4(normal_3f,0)); 2908#endif 2909#endif 2910#ifdef HAS_ATTRIBUTE_a_pbr 2911#ifdef HAS_ATTRIBUTE_a_color_4f 2912v_roughness_metallic_emissive_alpha.w=clamp(color_4f.a*v_roughness_metallic_emissive_alpha.w*(v_roughness_metallic_emissive_alpha.z-1.0),0.0,1.0); 2913#endif 2914#endif 2915#ifdef RENDER_SHADOWS 2916vec4 shadow_pos=u_node_matrix*vec4(local_pos,1.0); 2917#ifdef NORMAL_OFFSET 2918#ifdef HAS_ATTRIBUTE_a_normal_3f 2919#ifdef MODEL_POSITION_ON_GPU 2920vec3 offset=shadow_normal_offset(vec3(-normal_3f.xy,normal_3f.z));shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0(); 2921#else 2922vec3 offset=shadow_normal_offset_model(normal_3f);shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0(); 2923#endif 2924#endif 2925#endif 2926v_pos_light_view_0=u_light_matrix_0*shadow_pos;v_pos_light_view_1=u_light_matrix_1*shadow_pos;v_depth_shadows=gl_Position.w; 2927#endif 2928}`),modelDepth:Ft("void main() {}",`in vec3 a_pos_3f;uniform mat4 u_matrix; 2929#ifdef MODEL_POSITION_ON_GPU 2930#ifdef INSTANCED_ARRAYS 2931in vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3; 2932#else 2933uniform highp mat4 u_instance; 2934#endif 2935uniform highp mat4 u_node_matrix; 2936#endif 2937void main() { 2938#ifdef MODEL_POSITION_ON_GPU 2939highp mat4 instance; 2940#ifdef INSTANCED_ARRAYS 2941instance=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3); 2942#else 2943instance=u_instance; 2944#endif 2945vec3 pos_color=instance[0].xyz;vec4 translate=instance[1];vec3 pos_a=floor(pos_color);float hidden=float(pos_a.x > EXTENT);float meter_to_tile=instance[0].w;vec4 pos=vec4(pos_a.xy,translate.z,1.0);mat3 rs;rs[0].x=instance[1].w;rs[0].yz=instance[2].xy;
2945rs[1].xy=instance[2].zw;rs[1].z=instance[3].x;rs[2].xyz=instance[3].yzw;vec4 pos_node=u_node_matrix*vec4(a_pos_3f,1.0);vec3 rotated_pos_node=rs*pos_node.xyz;vec3 pos_model_tile=(rotated_pos_node+vec3(translate.xy,0.0))*vec3(meter_to_tile,meter_to_tile,1.0);pos.xyz+=pos_model_tile;gl_Position=mix(u_matrix*pos,AWAY,hidden); 2946#else 2947gl_Position=u_matrix*vec4(a_pos_3f,1); 2948#endif 2949}`),stars:Ft(`in highp vec2 v_uv;in mediump float v_intensity;float shapeCircle(in vec2 uv) 2950{float beginFade=0.6;float lengthFromCenter=length(v_uv);return 1.0-clamp((lengthFromCenter-beginFade)/(1.0-beginFade),0.0,1.0);}void main() {float alpha=shapeCircle(v_uv);vec3 color=vec3(1.0,1.0,1.0);alpha*=v_intensity;glFragColor=vec4(color*alpha,alpha);HANDLE_WIREFRAME_DEBUG;}`,` 2951in vec3 a_pos_3f;in vec2 a_uv;in float a_size_scale;in float a_opacity;uniform mat4 u_matrix;uniform vec3 u_up;uniform vec3 u_right;uniform float u_intensity_multiplier;out highp vec2 v_uv;out mediump float v_intensity;void main() {v_uv=a_uv;v_intensity=a_opacity*u_intensity_multiplier;vec3 pos=a_pos_3f;pos+=a_uv.x*u_right*a_size_scale;pos+=a_uv.y*u_up*a_size_scale;gl_Position=u_matrix*vec4(pos,1.0);}`),occlusion:Ft("uniform vec4 u_color;void main() {glFragColor=u_color;}",`#include "_prelude_terrain.vertex.glsl" 2952in highp vec2 a_offset_xy;uniform highp vec3 u_anchorPos;uniform mat4 u_matrix;uniform vec2 u_screenSizePx;uniform vec2 u_occluderSizePx;void main() {vec3 world_pos=u_anchorPos; 2953#ifdef TERRAIN 2954float e=elevation(world_pos.xy);world_pos.z+=e; 2955#endif 2956vec4 projected_point=u_matrix*vec4(world_pos,1.0);projected_point.xy+=projected_point.w*a_offset_xy*0.5*u_occluderSizePx/u_screenSizePx;gl_Position=projected_point;}`)};function Qo(a,t){const o=a.split(` 2957`);for(let c of o){if(c=c.trimStart(),c[0]!=="#"||!c.includes("if")||c.startsWith("#endif"))continue;const d=c.match(ed);if(d)for(const m of d)td.has(m)||t.add(m)}}function Au(a){return new Set(["uint","int","uvec2","ivec2","uvec3","ivec3","uvec4","ivec4"]).has(a)}function Ft(a,t){const o=new Set,c=[],d=[];a=a.replace(Tu,(_,y)=>(d.push(y),"")),t=t.replace(Tu,(_,y)=>(c.push(y),""));let m=new Set(Ic);Qo(a,m),Qo(t,m);for(const _ of[...c,...d])Iu[_]||(Iu[_]=new Set,Qo(fl[_],Iu[_])),m=new Set([...m,...Iu[_]]);return{fragmentSource:a=a.replace(Su,(_,y,v,T,I)=>(o.add(I),y==="define"?` 2958#ifndef HAS_UNIFORM_u_${I} 2959${Au(T)?"flat ":""}in ${v} ${T} ${I}; 2960#else 2961uniform ${v} ${T} u_${I}; 2962#endif 2963`:y==="initialize"?` 2964#ifdef HAS_UNIFORM_u_${I} 2965 ${v} ${T} ${I} = u_${I}; 2966#endif 2967`:y==="define-attribute"?` 2968#ifdef HAS_ATTRIBUTE_a_${I} 2969 in ${v} ${T} ${I}; 2970#endif 2971`:y==="initialize-attribute"?"":void 0)),vertexSource:t=t.replace(Su,(_,y,v,T,I)=>{const P=`MATERIAL_ATTRIBUTE_OFFSET_${I}`,A=T==="float"?"vec2":T,D=`GET_ATTRIBUTE_${A}(a_${I}, materialInfo, ${P})`,O=I.includes("color")?"color":A;return y==="define-attribute-vertex-shader-only"?` 2972#ifdef HAS_ATTRIBUTE_a_${I} 2973in ${v} ${T} a_${I}; 2974#endif 2975`:o.has(I)?y==="define"?` 2976#ifndef HAS_UNIFORM_u_${I} 2977uniform lowp float u_${I}_t; 2978 #if !defined(${P}) 2979 in ${v} ${A} a_${I}; 2980 #endif 2981${Au(T)?"flat ":""}out ${v} ${T} ${I}; 2982#else 2983uniform ${v} ${T} u_${I}; 2984#endif 2985`:y==="initialize"?O==="vec4"||O==="uvec4"?` 2986#ifndef HAS_UNIFORM_u_${I} 2987 ${I} = a_${I}; 2988#else 2989 ${v} ${T} ${I} = u_${I}; 2990#endif 2991`:` 2992#if !defined(HAS_UNIFORM_u_${I}) 2993 #ifdef ${P} 2994 ${I} = unpack_mix_${O}(${D}, u_${I}_t); 2995 #else 2996 ${I} = unpack_mix_${O}(a_${I}, u_${I}_t); 2997 #endif 2998#else 2999 ${v} ${T} ${I} = u_${I}; 3000#endif 3001`:y==="define-attribute"?` 3002#ifdef HAS_ATTRIBUTE_a_${I} 3003 in ${v} ${T} a_${I}; 3004 out ${v} ${T} ${I}; 3005#endif 3006`:y==="initialize-attribute"?` 3007#ifdef HAS_ATTRIBUTE_a_${I} 3008 ${I} = a_${I}; 3009#endif 3010`:void 0:y==="define"?` 3011#ifndef HAS_UNIFORM_u_${I} 3012uniform lowp float u_${I}_t; 3013 #if !defined(${P}) 3014 in ${v} ${A} a_${I}; 3015 #endif 3016#else 3017uniform ${v} ${T} u_${I}; 3018#endif 3019`:y==="define-instanced"?O==="mat4"?` 3020#ifdef INSTANCED_ARRAYS 3021in vec4 a_${I}0; 3022in vec4 a_${I}1; 3023in vec4 a_${I}2; 3024in vec4 a_${I}3; 3025#else 3026uniform ${v} ${T} u_${I}; 3027#endif 3028`:` 3029#ifdef INSTANCED_ARRAYS 3030in ${v} ${A} a_${I}; 3031#else 3032uniform ${v} ${T} u_${I}; 3033#endif 3034`:y==="initialize-attribute-custom"?` 3035#ifdef HAS_ATTRIBUTE_a_${I} 3036 ${v} ${T} ${I} = a_${I}; 3037#endif 3038`:O==="vec4"||O==="uvec4"?` 3039#ifndef HAS_UNIFORM_u_${I} 3040 #ifdef ${P} 3041 ${v} ${T} ${I} = ${D}; 3042 #else 3043 ${v} ${T} ${I} = a_${I}; 3044 #endif 3045#else 3046 ${v} ${T} ${I} = u_${I}; 3047#endif 3048`:` 3049#ifndef HAS_UNIFORM_u_${I} 3050 #ifdef ${P} 3051 ${v} ${T} ${I} = unpack_mix_${O}(${D}, u_${I}_t); 3052 #else 3053 ${v} ${T} ${I} = unpack_mix_${O}(a_${I}, u_${I}_t); 3054 #endif 3055#else 3056 ${v} ${T} ${I} = u_${I}; 3057#endif 3058`}),usedDefines:m,vertexIncludes:c,fragmentIncludes:d}}class nd{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffers=[],this.vao=null}bind(t,o,c,d,m,_,y,v){this.context=t;let T=this.boundPaintVertexBuffers.length!==d.length;for(let P=0;!T&&P<d.length;P++)this.boundPaintVertexBuffers[P]!==d[P]&&(T=!0);let I=this.boundDynamicVertexBuffers.length!==y.length;for(let P=0;!I&&P<y.length;P++)this.boundDynamicVertexBuffers[P]!==y[P]&&(I=!0);if(!this.vao||this.boundProgram!==o||this.boundLayoutVertexBuffer!==c||T||I||this.boundIndexBuffer!==m||this.boundVertexOffset!==_)this.freshBind(o,c,d,m,_,y,v);else{t.bindVertexArrayOES.set(this.vao);for(const P of y)P&&(P.bind(),v&&P.instanceCount&&P.setVertexAttribDivisor(t.gl,o,v));m&&m.dynamicDraw&&m.bind()}}freshBind(t,o,c,d,m,_,y){const v=this.context,T=v.gl;this.vao&&this.destroy(),this.vao=v.gl.createVertexArray(),v.bindVertexArrayOES.set(this.vao),this.boundProgram=t,this.boundLayoutVertexBuffer=o,this.boundPaintVertexBuffers=c,this.boundIndexBuffer=d,this.boundVertexOffset=m,this.boundDynamicVertexBuffers=_,o.enableAttributes(T,t),o.bind(),o.setVertexAttribPointers(T,t,m);for(const I of c)I.enableAttributes(T,t),I.bind(),I.setVertexAttribPointers(T,t,m);for(const I of _)I&&(I.enableAttributes(T,t),I.bind(),I.setVertexAttribPointers(T,t,m),y&&I.instanceCount&&I.setVertexAttribDivisor(T,t,y));d&&d.bind()}destroy(){this.vao&&(this.context.gl.deleteVertexArray(this.vao),this.vao=null)}}function Mu(a,t){const o=Math.pow(2,t.canonical.z),c=t.canonical.y;return[new h.ad(0,c/o).toLngLat().lat,new h.ad(0,(c+1)/o).toLngLat().lat]}function od(a,t,o,c,d,m,_){const y=a.context,v=y.gl,T=o.hillshadeFBO;if(!T)return;a.prepareDrawTile();const I=a.isTileAffectedByFog(t),P=[];a.terrain&&a.terrain.renderingToTexture&&a.emissiveMode==="mrt-fallback"&&P.push("USE_MRT1");const A=a.getOrCreateProgram("hillshade",{overrideFog:I,defines:P});y.activeTexture.set(v.TEXTURE0),v.bindTexture(v.TEXTURE_2D,T.colorAttachment0.get());const D=((N,H,Z,G)=>{const ne=Z.paint.get("hillshade-shadow-color"),te=Z.paint.get("hillshade-shadow-color-use-theme").
vendor: 52,258 bytes, lines 3058-3063
3058constantOr("default")==="none",se=Z.paint.get("hillshade-highlight-color"),J=Z.paint.get("hillshade-highlight-color-use-theme").constantOr("default")==="none",K=Z.paint.get("hillshade-accent-color"),oe=Z.paint.get("hillshade-accent-color-use-theme").constantOr("default")==="none",de=Z.paint.get("hillshade-emissive-strength");let ue=h.am(Z.paint.get("hillshade-illumination-direction"));if(Z.paint.get("hillshade-illumination-anchor")==="viewport")ue-=N.transform.angle;else if(N.style&&N.style.enable3dLights()&&N.style.directionalLight){const be=N.style.directionalLight.properties.get("direction"),ke=h.cT(be.x,be.y,be.z);ue=h.am(ke[1])}const ve=!N.options.moving;return{u_matrix:G||N.transform.calculateProjMatrix(H.tileID.toUnwrapped(),ve),u_image:0,u_latrange:Mu(0,H.tileID),u_light:[Z.paint.get("hillshade-exaggeration"),ue],u_shadow:ne.toPremultipliedRenderColor(te?null:Z.lut),u_highlight:se.toPremultipliedRenderColor(J?null:Z.lut),u_emissive_strength:de,u_accent:K.toPremultipliedRenderColor(oe?null:Z.lut)}})(a,o,c,a.terrain?t.projMatrix:null);a.uploadCommonUniforms(y,A,t.toUnwrapped());const{tileBoundsBuffer:O,tileBoundsIndexBuffer:L,tileBoundsSegments:k}=a.getTileBoundsBuffers(o);A.draw(a,v.TRIANGLES,d,m,_,lt.disabled,D,c.id,O,L,k)}function Cu(a,t,o){if(!t.needsDEMTextureUpload)return;const c=a.context,d=c.gl;c.pixelStoreUnpackPremultiplyAlpha.set(!1),t.demTexture=t.demTexture||a.getTileTexture(o.stride);const m=o.getPixels();t.demTexture?t.demTexture.update(m,{premultiply:!1}):t.demTexture=new h.T(c,m,d.R32F,{premultiply:!1}),t.needsDEMTextureUpload=!1}function Pu(a,t,o){const c=a.context,d=c.gl;if(!t.dem)return;const m=t.dem;if(c.activeTexture.set(d.TEXTURE1),Cu(a,t,m),!t.demTexture)return;t.demTexture.bind(d.NEAREST,d.CLAMP_TO_EDGE);const _=m.dim;c.activeTexture.set(d.TEXTURE0);let y=t.hillshadeFBO;if(!y){const A=new h.T(c,{width:_,height:_,data:null},d.RGBA8);A.bind(d.LINEAR,d.CLAMP_TO_EDGE),y=t.hillshadeFBO=c.createFramebuffer(_,_,1,"renderbuffer"),y.colorAttachment0.set(A.texture)}c.bindFramebuffer.set(y.framebuffer),c.viewport.set([0,0,_,_]);const{tileBoundsBuffer:v,tileBoundsIndexBuffer:T,tileBoundsSegments:I}=a.getMercatorTileBoundsBuffers(),P=[];a.linearFloatFilteringSupported()&&P.push("TERRAIN_DEM_FLOAT_FORMAT"),a.terrain&&a.terrain.renderingToTexture&&a.emissiveMode==="mrt-fallback"&&P.push("USE_MRT1"),a.getOrCreateProgram("hillshadePrepare",{defines:P}).draw(a,d.TRIANGLES,rt.disabled,pt.disabled,gt.unblended,lt.disabled,((A,D)=>{const O=D.stride,L=h.bd();return h.bX(L,0,h.ak,-h.ak,0,0,1),h.bB(L,L,[0,-h.ak,0]),{u_matrix:L,u_image:1,u_dimension:[O,O],u_zoom:A.overscaledZ}})(t.tileID,m),o.id,v,T,I),t.needsHillshadePrepare=!1}class xi{constructor(t){this.gl=t.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(t){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class Ap extends xi{getDefault(){return h.C.transparent.toNonPremultipliedRenderColor(null)}set(t){const o=this.current;(t.r!==o.r||t.g!==o.g||t.b!==o.b||t.a!==o.a||this.dirty)&&(this.gl.clearColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class Mp extends xi{getDefault(){return 1}set(t){(t!==this.current||this.dirty)&&(this.gl.clearDepth(t),this.current=t,this.dirty=!1)}}class _l extends xi{getDefault(){return 0}set(t){(t!==this.current||this.dirty)&&(this.gl.clearStencil(t),this.current=t,this.dirty=!1)}}class $_ extends xi{getDefault(){return[!0,!0,!0,!0]}set(t){const o=this.current;(t[0]!==o[0]||t[1]!==o[1]||t[2]!==o[2]||t[3]!==o[3]||this.dirty)&&(this.gl.colorMask(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class H_ extends xi{getDefault(){return!0}set(t){(t!==this.current||this.dirty)&&(this.gl.depthMask(t),this.current=t,this.dirty=!1)}}class q_ extends xi{getDefault(){return 255}set(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1)}}class Z_ extends xi{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(t){const o=this.current;(t.func!==o.func||t.ref!==o.ref||t.mask!==o.mask||this.dirty)&&(this.gl.stencilFunc(t.func,t.ref,t.mask),this.current=t,this.dirty=!1)}}class W_ extends xi{getDefault(){const t=this.gl;return[t.KEEP,t.KEEP,t.KEEP]}set(t){const o=this.current;(t[0]!==o[0]||t[1]!==o[1]||t[2]!==o[2]||this.dirty)&&(this.gl.stencilOp(t[0],t[1],t[2]),this.current=t,this.dirty=!1)}}class X_ extends xi{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const o=this.gl;t?o.enable(o.STENCIL_TEST):o.disable(o.STENCIL_TEST),this.current=t,this.dirty=!1}}class sd extends xi{getDefault(){return[0,1]}set(t){const o=this.current;(t[0]!==o[0]||t[1]!==o[1]||this.dirty)&&(this.gl.depthRange(t[0],t[1]),this.current=t,this.dirty=!1)}}class ad extends xi{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const o=this.gl;t?o.enable(o.DEPTH_TEST):o.disable(o.DEPTH_TEST),this.current=t,this.dirty=!1}}class ld extends xi{getDefault(){return this.gl.LESS}set(t){(t!==this.current||this.dirty)&&(this.gl.depthFunc(t),this.current=t,this.dirty=!1)}}class gl extends xi{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const o=this.gl;t?o.enable(o.BLEND):o.disable(o.BLEND),this.current=t,this.dirty=!1}}class Cp extends xi{getDefault(){const t=this.gl;return[t.ONE,t.ZERO,t.ONE,t.ZERO]}set(t){const o=this.current;(t[0]!==o[0]||t[1]!==o[1]||t[2]!==o[2]||t[3]!==o[3]||this.dirty)&&(this.gl.blendFuncSeparate(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class Pp extends xi{getDefault(){return h.C.transparent.toNonPremultipliedRenderColor(null)}set(t){const o=this.current;(t.r!==o.r||t.g!==o.g||t.b!==o.b||t.a!==o.a||this.dirty)&&(this.gl.blendColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class Dp extends xi{getDefault(){return this.gl.FUNC_ADD}set(t){(t!==this.current||this.dirty)&&(this.gl.blendEquationSeparate(t,t),this.current=t,this.dirty=!1)}}class cd extends xi{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const o=this.gl;t?o.enable(o.CULL_FACE):o.disable(o.CULL_FACE),this.current=t,this.dirty=!1}}class As extends xi{getDefault(){return this.gl.BACK}set(t){(t!==this.current||this.dirty)&&(this.gl.cullFace(t),this.current=t,this.dirty=!1)}}class Du extends xi{getDefault(){return this.gl.CCW}set(t){(t!==this.current||this.dirty)&&(this.gl.frontFace(t),this.current=t,this.dirty=!1)}}let Ru=class extends xi{getDefault(){return null}set(a){(a!==this.current||this.dirty)&&(this.gl.useProgram(a),this.current=a,this.dirty=!1)}};class Rp extends xi{getDefault(){return this.gl.TEXTURE0}set(t){(t!==this.current||this.dirty)&&(this.gl.activeTexture(t),this.current=t,this.dirty=!1)}}class Ms extends xi{getDefault(){const t=this.gl;return[0,0,t.drawingBufferWidth,t.drawingBufferHeight]}set(t){const o=this.current;(t[0]!==o[0]||t[1]!==o[1]||t[2]!==o[2]||t[3]!==o[3]||this.dirty)&&(this.gl.viewport(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class ud extends xi{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const o=this.gl;o.bindFramebuffer(o.FRAMEBUFFER,t),this.current=t,this.dirty=!1}}class zu extends xi{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const o=this.gl;o.bindRenderbuffer(o.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class zp extends xi{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const o=this.gl;o.bindTexture(o.TEXTURE_2D,t),this.current=t,this.dirty=!1}}class Lp extends xi{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const o=this.gl;o.bindBuffer(o.ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class hd extends xi{getDefault(){return null}set(t){const o=this.gl;o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class dd extends xi{getDefault(){return null}set(t){this.gl&&(t!==this.current||this.dirty)&&(this.gl.bindVertexArray(t),this.current=t,this.dirty=!1)}}class Y_ extends xi{getDefault(){return 4}set(t){if(t===this.current&&!this.dirty)return;const o=this.gl;o.pixelStorei(o.UNPACK_ALIGNMENT,t),this.current=t,this.dirty=!1}}class Op extends xi{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const o=this.gl;o.pixelStorei(o.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t),this.current=t,this.dirty=!1}}class Ec extends xi{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const o=this.gl;o.pixelStorei(o.UNPACK_FLIP_Y_WEBGL,t),this.current=t,this.dirty=!1}}class fd extends xi{constructor(t,o){super(t),this.context=t,this.parent=o}getDefault(){return null}}class Lu extends fd{constructor(t,o,c=0){super(t,o),this.attachmentPoint=t.gl.COLOR_ATTACHMENT0+c}setDirty(){this.dirty=!0}set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const o=this.gl;o.framebufferTexture2D(o.FRAMEBUFFER,this.attachmentPoint,o.TEXTURE_2D,t,0),this.current=t,this.dirty=!1}}class pd extends fd{attachment(){return this.gl.DEPTH_ATTACHMENT}set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const o=this.gl;o.framebufferRenderbuffer(o.FRAMEBUFFER,this.attachment(),o.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class J_ extends fd{attachment(){return this.gl.DEPTH_ATTACHMENT}set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const o=this.gl;o.framebufferTexture2D(o.FRAMEBUFFER,this.attachment(),o.TEXTURE_2D,t,0),this.current=t,this.dirty=!1}}class md extends pd{attachment(){return this.gl.DEPTH_STENCIL_ATTACHMENT}}const Ou=(a,t,o,c)=>({u_matrix:a,u_image0:0,u_image1:1,u_skirt_height:t,u_ground_shadow_factor:o,u_emissive_texture_available:c}),Cs=(a,t,o,c,d,m,_,y,v,T,I,P,A,D,O,L,k)=>({u_proj_matrix:Float32Array.from(a),u_globe_matrix:t,u_normalize_matrix:Float32Array.from(c),u_merc_matrix:o,u_zoom_transition:d,u_merc_center:m,u_image0:0,u_image1:1,u_frustum_tl:_,u_frustum_tr:y,u_frustum_br:v,u_frustum_bl:T,u_globe_pos:I,u_globe_radius:P,u_viewport:A,u_grid_matrix:k?Float32Array.from(k):new Float32Array(9),u_skirt_height:D,u_far_z_cutoff:O,u_emissive_texture_available:L});function Ac(a,t){return a!=null&&t!=null&&!(!a.hasData()||!t.hasData())&&a.demTexture!=null&&t.demTexture!=null&&a.tileID.key!==t.tileID.key}const Mo=new class{constructor(){this.operations={}}newMorphing(a,t,o,c,d){if(a in this.operations){const m=this.operations[a];m.to.tileID.key!==o.tileID.key&&(m.queued=o)}else this.operations[a]={startTime:c,phase:0,duration:d,from:t,to:o,queued:null}}getMorphValuesForProxy(a){if(!(a in this.operations))return null;const t=this.operations[a];return{from:t.from,to:t.to,phase:t.phase}}update(a){for(const t in this.operations){const o=this.operations[t];for(o.phase=(a-o.startTime)/o.duration;o.phase>=1||!this._validOp(o);)if(!this._nextOp(o,a)){delete this.operations[t];break}}}_nextOp(a,t){return!!a.queued&&(a.from=a.to,a.to=a.queued,a.queued=null,a.phase=0,a.startTime=t,!0)}_validOp(a){return a.from.hasData()&&a.to.hasData()}};function _d(a,t,o){if(t===0)return 0;const c=t<1&&o===514?.25/t:1;return 6*Math.pow(1.5,22-a)*Math.max(t,1)*c}function Fu(a,t){const o=1<<a.z;return!t&&(a.x===0||a.x===o-1)||a.y===0||a.y===o-1}function yl(a,t){if(!a.style||!a.style.enable3dLights())return;const o=a.context,c=o.gl;o.activeTexture.set(c.TEXTURE1),t?t.bind(c.LINEAR,c.CLAMP_TO_EDGE):a.emptyTexture.bind(c.LINEAR,c.CLAMP_TO_EDGE)}const ba=a=>({u_matrix:a});function xl(a,t,o,c,d){if(d>0){const m=h.o.now(),_=(m-a.timeAdded)/d,y=t?(m-t.timeAdded)/d:-1,v=o.getSource(),T=c.coveringZoomLevel({tileSize:v.tileSize,roundZoom:v.roundZoom}),I=!t||Math.abs(t.tileID.overscaledZ-T)>Math.abs(a.tileID.overscaledZ-T),P=I&&a.refreshedUponExpiration?1:h.aB(I?_:1-y,0,1);return t?{opacity:1,mix:1-P,isFading:_<1}:{opacity:P,mix:0,isFading:_<1}}return{opacity:1,mix:0,isFading:!1}}class et extends Ut{constructor(t){const o={type:"raster-dem",maxzoom:Math.ceil(t.transform.maxZoom)},c=hu("mock-dem",o,t.style.dispatcher,t.style);super("mock-dem",c,null),c.setEventedParent(this),this._sourceLoaded=!0}_loadTile(t,o){t.state="loaded",o(null)}}class Fp extends Ut{constructor(t){const o=hu("proxy",{type:"geojson",maxzoom:Math.ceil(t.transform.maxZoom)},t.style.dispatcher,t.style);super("proxy",o,null),o.setEventedParent(this),this.map=this.getSource().map=t,this.used=this._sourceLoaded=!0,this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}update(t,o,c){if(t.freezeTileCoverage)return;this.transform=t;const d=t.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}).reduce((m,_)=>{if(m[_.key]="",!this._tiles[_.key]){const y=new h.b3(_,this._source.tileSize*_.overscaleFactor(),t.tileZoom,void 0,void 0,this._source.worldview);y.state="loaded",this._tiles[_.key]=y}return m},{});for(const m in this._tiles)m in d||(this.freeFBO(m),this._tiles[m].unloadVectorData(),delete this._tiles[m])}freeFBO(t){const o=this.proxyCachedFBO[t];if(o!==void 0){const c=Object.values(o);this.renderCachePool.push(...c),delete this.proxyCachedFBO[t]}}deallocRenderCache(){this.renderCache.forEach(t=>t.fb.destroy()),this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}}class es extends h.aU{constructor(t,o,c){super(t.overscaledZ,t.wrap,t.canonical.z,t.canonical.x,t.canonical.y),this.proxyTileKey=o,this.projMatrix=c}}class ts extends h.bx{constructor(t,o){super(),this.painter=t,this.terrainTileForTile={},this.prevTerrainTileForTile={};const[c,d,m]=(function(){const v=new h.dE,T=new h.dF,I=131;v.reserve(17161),T.reserve(33800);const P=h.ak/128,A=h.ak+P/2,D=A+P;for(let L=-P;L<D;L+=P)for(let k=-P;k<D;k+=P){const N=k<0||k>A||L<0||L>A?24575:0,H=h.aB(Math.round(k),0,h.ak),Z=h.aB(Math.round(L),0,h.ak);v.emplaceBack(H+N,Z)}const O=(L,k)=>{const N=k*I+L;T.emplaceBack(N+1,N,N+I),T.emplaceBack(N+I,N+I+1,N+1)};for(let L=1;L<129;L++)for(let k=1;k<129;k++)O(k,L);return[0,129].forEach(L=>{for(let k=0;k<130;k++)O(k,L),O(L,k)}),[v,T,32768]})(),_=t.context;this.gridBuffer=_.createVertexBuffer(c,h.dA.members),this.gridIndexBuffer=_.createIndexBuffer(d),this.gridSegments=h.dB.simpleSegment(0,0,c.length,d.length),this.gridNoSkirtSegments=h.dB.simpleSegment(0,0,c.length,m),this.proxyCoords=[],this.proxiedCoords={},this._visibleDemTiles=[],this._drapedRenderBatches=[],this._sourceTilesOverlap={},this.proxySourceCache=new Fp(o.map),this.orthoMatrix=h.bd(),h.bX(this.orthoMatrix,this.painter.transform.projection.name==="globe"?.015:0,h.ak,0,h.ak,0,1);const y=_.gl;this._overlapStencilMode=new pt({func:y.GEQUAL,mask:255},0,255,y.KEEP,y.KEEP,y.REPLACE),this._previousZoom=t.transform.zoom,this.pool=[],this._findCoveringTileCache={},this._tilesDirty={},this.style=o,this._useVertexMorphing=!0,this._exaggeration=1,this._mockSourceCache=new et(o.map),this._pendingGroundEffectLayers=[],this._emissiveTexture=!1,this._devtoolsFolder=null}set style(t){t.on("data",this._onStyleDataEvent.bind(this)),this._style=t,this._style.map.on("moveend",()=>{this._clearLineLayersFromRenderCache()})}update(t,o,c){if(t&&t.terrain){this._style!==t&&(this.style=t,this._evaluationZoom=void 0);const d=t.terrain.properties,m=t.terrain.drapeRenderMode===0,_=t.terrain.isZoomDependent();this._previousUpdateTimestamp=this.enabled?this._updateTimestamp:void 0,this._updateTimestamp=h.o.now();const y=t.terrain&&t.terrain.scope,v=d.get("source"),T=m?this._mockSourceCache:t.getSourceCache(v,y);if(!T)return void h.w(`Couldn't find terrain source "${v}".`);if(this.sourceCache=T,this._attenuationRange=t.terrain.getAttenuationRange(),this._exaggeration=_?this.calculateExaggeration(o):d.get("exaggeration"),!o.projection.requiresDraping&&_&&this._exaggeration===0)return void this._disable();this.enabled=!0;const I=()=>{this.sourceCache.used&&h.w(`Raster DEM source '${this.sourceCache.id}' is used both for terrain and as layer source. 3059This leads to lower resolution of hillshade. For full hillshade resolution but higher memory consumption, define another raster DEM source.`);const P=this.getScaledDemTileSize();this.sourceCache.update(o,P,!0),this.resetTileLookupCache(this.sourceCache.id)};this.sourceCache.usedForTerrain||(this.resetTileLookupCache(this.sourceCache.id),this.sourceCache.usedForTerrain=!0,I(),this._initializing=!0),I(),o.updateElevation(!0,c),this.resetTileLookupCache(this.proxySourceCache.id),this.proxySourceCache.update(o),this._emptyDEMTextureDirty=!0,this._previousZoom=o.zoom}else this._disable()}calculateExaggeration(t){if(this._attenuationRange&&t.zoom>=Math.ceil(this._attenuationRange[1]))return this._style.terrain.getExaggeration(t.zoom);const o=this._previousCameraAltitude,c=t.getFreeCameraOptions().position.z/t.pixelsPerMeter*t.worldSize;this._previousCameraAltitude=c;const d=o!=null?c-o:Number.MAX_VALUE;if(Math.abs(d)<2)return this._exaggeration;const m=t.zoom,_=this._style.terrain;if(!this._previousUpdateTimestamp)return _.getExaggeration(m);let y=m-this._previousZoom;const v=this._previousUpdateTimestamp;let T=m;this._evaluationZoom!=null&&(T=this._evaluationZoom,Math.abs(m-T)>.5&&(y=.5*(m-T+y)),y*d<0&&(T+=y)),this._evaluationZoom=T;const I=_.getExaggeration(T),P=I===_.getExaggeration(Math.max(0,T-.1));if(P&&Math.abs(I-this._exaggeration)<.01)return I;let A=Math.min(.1,.00375*(this._updateTimestamp-v));return(P||I<.1||Math.abs(y)<1e-4)&&(A=Math.min(.2,4*A)),h.aj(this._exaggeration,I,A)}resetTileLookupCache(t){this._findCoveringTileCache[t]={}}attenuationRange(){return this._attenuationRange}getDemUpscale(){return this.proxySourceCache.getSource().tileSize/128}getScaledDemTileSize(){return this.sourceCache.getSource().tileSize/128*this.proxySourceCache.getSource().tileSize}_onStyleDataEvent(t){t.dataType==="source"&&t.coord?this._clearRenderCacheForTile(t.sourceCacheId,t.coord):t.dataType==="style"&&(this.invalidateRenderCache=!0,this._evaluationZoom=void 0,this._previousUpdateTimestamp=void 0,this._previousCameraAltitude=void 0)}_disable(){if(this.enabled&&(this.enabled=!1,this._emptyDEMTextureDirty=!0,this._sharedDepthStencil=void 0,this._evaluationZoom=void 0,this._previousUpdateTimestamp=void 0,this.proxySourceCache.deallocRenderCache(),this._style))for(const t in this._style._mergedSourceCaches)this._style._mergedSourceCaches[t].usedForTerrain=!1}destroy(){this._disable(),this._emptyDEMTexture&&this._emptyDEMTexture.destroy(),this.pool.forEach(t=>t.fb.destroy()),this.pool=[],this.framebufferCopyTexture&&this.framebufferCopyTexture.destroy()}_source(){return this.enabled?this.sourceCache:null}isUsingMockSource(){return this.sourceCache===this._mockSourceCache}exaggeration(){return this.enabled?this._exaggeration:0}get visibleDemTiles(){return this._visibleDemTiles}get drapeBufferSize(){const t=2*this.proxySourceCache.getSource().tileSize;return[t,t]}set useVertexMorphing(t){this._useVertexMorphing=t}updateTileBinding(t){if(!this.enabled)return;this.prevTerrainTileForTile=this.terrainTileForTile;const o=this.proxySourceCache,c=this.painter.transform;this._initializing&&(this._initializing=c._centerAltitude===0&&this.getAtPointOrZero(h.ad.fromLngLat(c.center),-1)===-1,this._emptyDEMTextureDirty=!this._initializing);const d=this.proxyCoords=o.getIds().map(v=>{const T=o.getTileByID(v).tileID;return T.projMatrix=c.calculateProjMatrix(T.toUnwrapped()),T});(function(v,T){const I=T.transform.pointCoordinate(T.transform.getCameraPoint()),P=new h.P(I.x,I.y);v.sort((A,D)=>{if(D.overscaledZ-A.overscaledZ)return D.overscaledZ-A.overscaledZ;const O=new h.P(A.canonical.x+(1<<A.canonical.z)*A.wrap,A.canonical.y),L=new h.P(D.canonical.x+(1<<D.canonical.z)*D.wrap,D.canonical.y),k=P.mult(1<<A.canonical.z);return k.x-=.5,k.y-=.5,k.distSqr(O)-k.distSqr(L)})})(d,this.painter);const m=this.proxyToSource||{};this.proxyToSource={},d.forEach(v=>{this.proxyToSource[v.key]={}}),this.terrainTileForTile={};const _=this._style._mergedSourceCaches;for(const v in _){const T=_[v];if(!T.used||(T!==this.sourceCache&&this.resetTileLookupCache(T.id),this._setupProxiedCoordsForOrtho(T,t[v],m),T.usedForTerrain))continue;const I=t[v];(T.getSource().reparseOverscaled||T._isRasterElevatedOverTerrain)&&this._assignTerrainTiles(I)}this.proxiedCoords[o.id]=d.map(v=>new es(v,v.key,this.orthoMatrix)),this._assignTerrainTiles(d),this._prepareDEMTextures(),this._setupDrapedRenderBatches(),this._initFBOPool(),this._setupRenderCache(m),this.renderingToTexture=!1;const y={};this._visibleDemTiles=[];for(const v of this.proxyCoords){const T=this.terrainTileForTile[v.key];if(!T)continue;const I=T.tileID.key;I in y||(this._visibleDemTiles.push(T),y[I]=I)}}_assignTerrainTiles(t){this._initializing||t.forEach(o=>{if(this.terrainTileForTile[o.key])return;const c=this._findTileCoveringTileID(o,this.sourceCache);c&&(this.terrainTileForTile[o.key]=c)})}_prepareDEMTextures(){const t=this.painter.context,o=t.gl;for(const c in this.terrainTileForTile){const d=this.terrainTileForTile[c],m=d.dem;!m||d.demTexture&&!d.needsDEMTextureUpload||(t.activeTexture.set(o.TEXTURE1),Cu(this.painter,d,m))}}_prepareDemTileUniforms(t,o,c,d){if(!o||o.demTexture==null)return!1;const m=t.tileID.canonical,_=Math.pow(2,o.tileID.canonical.z-m.z),y=d||"";return c[`u_dem_tl${y}`]=[m.x*_%1,m.y*_%1],c[`u_dem_scale${y}`]=_,!0}get emptyDEMTexture(){return!this._emptyDEMTextureDirty&&this._emptyDEMTexture?this._emptyDEMTexture:this._updateEmptyDEMTexture()}_getLoadedAreaMinimum(){if(!this.enabled)return 0;let t=0;const o=this._visibleDemTiles.reduce((c,d)=>{if(!d.dem)return c;const m=d.dem.tree.minimums[0];return m>0&&t++,c+m},0);return t?o/t:0}_updateEmptyDEMTexture(){const t=this.painter.context,o=t.gl;t.activeTexture.set(o.TEXTURE2);const c=this._getLoadedAreaMinimum(),d=new h.dC({width:1,height:1},new Float32Array([c]));this._emptyDEMTextureDirty=!1;let m=this._emptyDEMTexture;return m?m.update(d,{premultiply:!1}):m=this._emptyDEMTexture=new h.T(t,d,o.R32F,{premultiply:!1}),m}setupElevationDraw(t,o,c){const d=this.painter.context,m=d.gl,_={u_dem:2,u_dem_prev:4,u_dem_tl:[0,0],u_dem_tl_prev:[0,0],u_dem_scale:0,u_dem_scale_prev:0,u_dem_size:0,u_dem_lerp:1,u_depth:3,u_depth_size_inv:[0,0],u_depth_range_unpack:[0,1],u_occluder_half_size:16,u_occlusion_depth_offset:-1e-4,u_exaggeration:0};_.u_exaggeration=this.exaggeration();let y=null,v=null,T=1;if(c&&c.morphing&&this._useVertexMorphing){const D=c.morphing.srcDemTile,O=c.morphing.dstDemTile;T=c.morphing.phase,D&&O&&(this._prepareDemTileUniforms(t,D,_,"_prev")&&(v=D),this._prepareDemTileUniforms(t,O,_)&&(y=O))}const I=D=>D&&D.demTexture&&this.painter.linearFloatFilteringSupported()?m.LINEAR:m.NEAREST;let P=null;var A;if(this.enabled?v&&y?(P=y.demTexture,d.activeTexture.set(m.TEXTURE4),v.demTexture.bind(I(v),m.CLAMP_TO_EDGE),_.u_dem_lerp=T):(y=this.terrainTileForTile[t.tileID.key],P=this._prepareDemTileUniforms(t,y,_)?y.demTexture:this.emptyDEMTexture):P=this.emptyDEMTexture,d.activeTexture.set(m.TEXTURE2),P&&(_.u_dem_size=(A=P).size[0]===1?1:A.size[0]-2,P.bind(I(y),m.CLAMP_TO_EDGE)),this.painter.setupDepthForOcclusion(c&&c.useDepthForOcclusion,o,_),c&&c.useMeterToDem&&y){const D=(1<<y.tileID.canonical.z)*h.bY(1,this.painter.transform.center.lat)*this.sourceCache.getSource().tileSize;_.u_meter_to_dem=D}if(c&&c.labelPlaneMatrixInv&&(_.u_label_plane_matrix_inv=c.labelPlaneMatrixInv),o.setTerrainUniformValues(d,_),this.painter.transform.projection.name==="globe"){const D=this.globeUniformValues(this.painter.transform,t.tileID.canonical,c&&c.useDenormalizedUpVectorScale);o.setGlobeUniformValues(d,D)}}globeUniformValues(t,o,c){const d=t.projection;return{u_tile_tl_up:d.upVector(o,0,0),u_tile_tr_up:d.upVector(o,h.ak,0),u_tile_br_up:d.upVector(o,h.ak,h.ak),u_tile_bl_up:d.upVector(o,0,h.ak),u_tile_up_scale:c?h.dD(1):d.upVectorScale(o,t.center.lat,t.worldSize).metersToTile}}renderToBackBuffer(t){const o=this.painter,c=this.painter.context;t.length!==0&&(c.bindFramebuffer.set(null),c.viewport.set([0,0,o.width,o.height]),o.gpuTimingDeferredRenderStart(),this.renderingToTexture=!1,(function(d,m,_,y,v){if(d.transform.projection.name==="globe")(function(T,I,P,A,D){const O=T.context,L=O.gl;let k,N;const H=T.transform,Z=h.ds(T,O,H),G=(ve,be)=>{if(N===be)return;const ke=[];be===1&&ke.push("TERRAIN_VERTEX_MORPHING"),ke.push("PROJECTION_GLOBE_VIEW"),Z&&ke.push("CUSTOM_ANTIALIASING");const fe=T.isTileAffectedByFog(ve);k=T.getOrCreateProgram("globeRaster",{defines:ke,overrideFog:fe}),N=be},ne=T.colorModeForRenderPass(),te=new rt(L.LEQUAL,rt.ReadWrite,T.depthRangeFor3D);Mo.update(D);const se=h.dt(H),J=[h.aG(H.center.lng),h.aJ(H.center.lat)],K=T.globeSharedBuffers,oe=[H.width*h.o.devicePixelRatio,H.height*h.o.devicePixelRatio],de=Float32Array.from(H.globeMatrix),ue={useDenormalizedUpVectorScale:!0};{const ve=T.transform,be=_d(ve.zoom,I.exaggeration(),I.sourceCache._source.tileSize);N=-1;const ke=L.TRIANGLES;for(const fe of A){const Ee=P.getTile(fe),pe=pt.disabled,Pe=I.prevTerrainTileForTile[fe.key],Ce=I.terrainTileForTile[fe.key];Ac(Pe,Ce)&&Mo.newMorphing(fe.key,Pe,Ce,D,250),yl(T,Ee.emissiveTexture),O.activeTexture.set(L.TEXTURE0),Ee.texture&&Ee.texture.bind(L.LINEAR,L.CLAMP_TO_EDGE);const Re=Mo.getMorphValuesForProxy(fe.key),Ye=Re?1:0;Re&&Object.assign(ue,{morphing:{srcDemTile:Re.from,dstDemTile:Re.to,phase:h.dr(Re.phase)}});const qe=h.du(fe.canonical),je=h.dv(qe.getCenter().lat),Be=h.dw(fe.canonical,qe,je,ve.worldSize/ve._pixelsPerMercatorPixel),at=h.dx(h.dy(fe.canonical)),ot=T.emissiveMode==="mrt-fallback"?1:0,tt=Cs(ve.expandedFarZProjMatrix,de,se,at,h.ai(ve.zoom),J,ve.frustumCorners.TL,ve.frustumCorners.TR,ve.frustumCorners.BR,ve.frustumCorners.BL,ve.globeCenterInViewSpace,ve.globeRadius,oe,be,ve._farZ,ot,Be);if(G(fe,Ye),k&&(I.setupElevationDraw(Ee,k,ue),T.uploadCommonUniforms(O,k,fe.toUnwrapped()),K)){const[it,ht,xt]=K.getGridBuffers(je,be!==0);k.draw(T,ke,te,pe,ne,lt.backCCW,tt,"globe_raster",it,ht,xt)}}}if(K&&(T.renderDefaultNorthPole||T.renderDefaultSouthPole)){const ve=["GLOBE_POLES","PROJECTION_GLOBE_VIEW"];Z&&ve.push("CUSTOM_ANTIALIASING"),k=T.getOrCreateProgram("globeRaster",{defines:ve});for(const be of A){const{x:ke,y:fe,z:Ee}=be.canonical,pe=fe===0,Pe=fe===(1<<Ee)-1,[Ce,Re,Ye,qe]=K.getPoleBuffers(Ee,!1);if(qe&&(pe||Pe)){const je=P.getTile(be);yl(T,je.emissiveTexture),O.activeTexture.set(L.TEXTURE0),je.texture&&je.texture.bind(L.LINEAR,L.CLAMP_TO_EDGE);let Be=h.dz(Ee,ke,H);const at=h.dx(h.dy(be.canonical)),ot=T.emissiveMode==="mrt-fallback"?1:0,tt=(it,ht)=>it.draw(T,L.TRIANGLES,te,pt.disabled,ne,lt.disabled,Cs(H.expandedFarZProjMatrix,Be,Be,at,0,J,H.frustumCorners.TL,H.frustumCorners.TR,H.frustumCorners.BR,H.frustumCorners.BL,H.globeCenterInViewSpace,H.globeRadius,oe,0,H._farZ,ot),"globe_pole_raster",ht,Ye,qe);I.setupElevationDraw(je,k,ue),T.uploadCommonUniforms(O,k,be.toUnwrapped()),pe&&T.renderDefaultNorthPole&&tt(k,Ce),Pe&&T.renderDefaultSouthPole&&(Be=h.cE(h.bd(),Be,[1,-1,1]),tt(k,Re))}}}})(d,m,_,y,v);else{const T=d.context,I=T.gl;let P,A;const D=d.shadowRenderer,O=In(d,d.longestCutoffRange),L=ne=>{if(A===ne)return;const te=[];ne===1&&te.push("TERRAIN_VERTEX_MORPHING"),O.shouldRenderCutoff&&te.push("RENDER_CUTOFF"),D&&(te.push("RENDER_SHADOWS"),D.useNormalOffset&&te.push("NORMAL_OFFSET")),P=d.getOrCreateProgram("terrainRaster",{defines:te}),A=ne},k=d.colorModeForRenderPass(),N=new rt(I.LEQUAL,rt.ReadWrite,d.depthRangeFor3D);Mo.update(v);const H=d.transform,Z=_d(H.zoom,m.exaggeration(),m.sourceCache._source.tileSize);let G=[0,0,0];if(D){const ne=d.style.directionalLight,te=d.style.ambientLight;ne&&te&&(G=_a(d.style,ne,te))}{A=-1;const ne=I.TRIANGLES,[te,se]=[m.gridIndexBuffer,m.gridSegments];for(const J of y){const K=_.getTile(J),oe=pt.disabled,de=m.prevTerrainTileForTile[J.key],ue=m.terrainTileForTile[J.key];Ac(de,ue)&&Mo.newMorphing(J.key,de,ue,v,250),yl(d,K.emissiveTexture),T.activeTexture.set(I.TEXTURE0),K.texture&&K.texture.bind(I.LINEAR,I.CLAMP_TO_EDGE);const ve=Mo.getMorphValuesForProxy(J.key),be=ve?1:0;let ke;ve&&(ke={morphing:{srcDemTile:ve.from,dstDemTile:ve.to,phase:h.dr(ve.phase)}});const fe=d.emissiveMode==="mrt-fallback"?1:0,Ee=Ou(J.projMatrix,Fu(J.canonical,H.renderWorldCopies)?Z/10:Z,G,fe);if(L(be),!P)continue;m.setupElevationDraw(K,P,ke);const pe=J.toUnwrapped();D&&D.setupShadows(pe,P),d.uploadCommonUniforms(T,P,pe,null,O),P.draw(d,ne,N,oe,k,lt.backCCW,Ee,"terrain_raster",m.gridBuffer,te,se)}}}})(o,this,this.proxySourceCache,t,this._updateTimestamp),this.renderingToTexture=!0,o.gpuTimingDeferredRenderEnd(),t.splice(0,t.length))}renderBatch(t){if(this._drapedRenderBatches.length===0)return t+1;this.renderingToTexture=!0;const o=this.painter,c=this.painter.context,d=this.proxySourceCache,m=this.proxiedCoords[d.id],_=this._drapedRenderBatches.shift(),y=o.style.order,v=[];this._updateFBOs(o.emissiveMode==="mrt-fallback");let T=0;for(const I of m){const P=d.getTileByID(I.proxyTileKey),A=d.proxyCachedFBO[I.key]?d.proxyCachedFBO[I.key][t]:void 0,D=A!==void 0?d.renderCache[A]:this.pool[T++],O=A!==void 0;if(P.texture=D.tex,P.emissiveTexture=D.emissiveTex,O&&!D.dirty){v.push(P.tileID);continue}c.bindFramebuffer.set(D.fb.framebuffer);const L=c.gl;let k;L.drawBuffers(o.emissiveMode==="mrt-fallback"?[L.COLOR_ATTACHMENT0,L.COLOR_ATTACHMENT1]:[L.COLOR_ATTACHMENT0]),this.renderedToTile=!1,D.dirty&&(c.clear({color:h.C.transparent,stencil:0}),D.dirty=!1);for(let N=_.start;N<=_.end;++N){const H=o.style._mergedLayers[y[N]];if(H.isHidden(o.transform.zoom))continue;const Z=o.style.getLayerSourceCache(H),G=Z?this.proxyToSource[I.key][Z.id]:[I];if(!G)continue;const ne=G;c.viewport.set([0,0,D.fb.width,D.fb.height]),k!==(Z?Z.id:null)&&(this._setupStencil(D,G,H,Z),k=Z?Z.id:null),o.renderLayer(o,Z,H,ne)}if(L.drawBuffers([L.COLOR_ATTACHMENT0]),this._drapedRenderBatches.length===0)for(const N of this._pendingGroundEffectLayers){const H=o.style._mergedLayers[y[N]];if(H.isHidden(o.transform.zoom))continue;const Z=o.style.getLayerSourceCache(H),G=Z?this.proxyToSource[I.key][Z.id]:[I];if(!G)continue;const ne=G;c.viewport.set([0,0,D.fb.width,D.fb.height]),k!==(Z?Z.id:null)&&(this._setupStencil(D,G,H,Z),k=Z?Z.id:null),o.renderLayer(o,Z,H,ne)}this.renderedToTile?(D.dirty=!0,v.push(P.tileID)):O||--T,T===5&&(T=0,this.renderToBackBuffer(v))}return this.renderToBackBuffer(v),this.renderingToTexture=!1,c.bindFramebuffer.set(null),c.viewport.set([0,0,o.width,o.height]),_.end+1}postRender(){}isLayerOrderingCorrect(t){const o=t.order.length;let c=-1,d=o;for(let m=0;m<o;++m)this._style.isLayerDraped(t._mergedLayers[t.order[m]])?c=Math.max(c,m):d=Math.min(d,m);return d>c}getMinElevationBelowMSL(){let t=0;return this._visibleDemTiles.filter(o=>o.dem).forEach(o=>{t=Math.min(t,o.dem.tree.minimums[0])}),t===0?t:(t-30)*this._exaggeration}raycast(t,o,c){if(!this._visibleDemTiles)return null;const d=this._visibleDemTiles.filter(m=>m.dem).map(m=>{const _=m.tileID,y=1<<_.overscaledZ,{x:v,y:T}=_.canonical,I=v/y,P=(v+1)/y,A=T/y,D=(T+1)/y;return{minx:I,miny:A,maxx:P,maxy:D,t:m.dem.tree.raycastRoot(I,A,P,D,t,o,c),tile:m}});d.sort((m,_)=>(m.t!==null?m.t:Number.MAX_VALUE)-(_.t!==null?_.t:Number.MAX_VALUE));for(const m of d){if(m.t==null)return null;const _=m.tile.dem.tree.raycast(m.minx,m.miny,m.maxx,m.maxy,t,o,c);if(_!=null)return _}return null}_createFBO(){const t=this.painter.context,o=t.gl,c=this.drapeBufferSize;t.activeTexture.set(o.TEXTURE0);const d=new h.T(t,{width:c[0],height:c[1],data:null},o.RGBA8);d.bind(o.LINEAR,o.CLAMP_TO_EDGE);const m=t.createFramebuffer(c[0],c[1],1,null);let _;return m.colorAttachment0.set(d.texture),this._emissiveTexture&&(_=new h.T(t,{width:c[0],height:c[1],data:null},o.R8),_.bind(o.LINEAR,o.CLAMP_TO_EDGE),m.createColorAttachment(t,1),m.colorAttachment1.set(_.texture)),m.depthAttachment=new md(t,m.framebuffer),this._sharedDepthStencil===void 0?(this._sharedDepthStencil=t.createRenderbuffer(t.gl.DEPTH_STENCIL,c[0],c[1]),this._stencilRef=0,m.depthAttachment.set(this._sharedDepthStencil),t.clear({stencil:0})):m.depthAttachment.set(this._sharedDepthStencil),t.extTextureFilterAnisotropic&&o.texParameterf(o.TEXTURE_2D,t.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,t.extTextureFilterAnisotropicMax),{fb:m,tex:d,emissiveTex:_,dirty:!1}}_updateFBOs(t){if(this._emissiveTexture!==t){for(const o of this.pool)this._updateFBO(o,t);for(const o of this.proxySourceCache.renderCache)this._updateFBO(o,t);this._emissiveTexture=t}}_updateFBO(t,o){const c=t.fb,d=this.painter.context,m=d.gl,_=this.drapeBufferSize;if(o){const y=new h.T(d,{width:_[0],height:_[1],data:null},m.R8);y.bind(m.LINEAR,m.CLAMP_TO_EDGE),t.emissiveTex=y,c.createColorAttachment(d,1),c.colorAttachment1.set(y.texture)}else t.emissiveTex=void 0,c.removeColorAttachment(d,1);t.dirty=!0}_initFBOPool(){for(;this.pool.length<Math.min(5,this.proxyCoords.length);)this.pool.push(this._createFBO())}_shouldDisableRenderCache(){if(this._style.hasLightTransitions())return!0;for(const t in this._style._mergedSourceCaches)if(this._style._mergedSourceCaches[t].hasTransition())return!0;return this._style.order.some(t=>{const o=this._style._mergedLayers[t],c=o.isHidden(this.painter.transform.zoom);return o.type==="hillshade"||o.type==="custom"?!c&&o.shouldRedrape():!c&&o.hasTransition()})}_clearLineLayersFromRenderCache(){let t=!1;for(const c of this._style.getSources())if(c instanceof Nh){t=!0;break}if(!t)return;const o={};for(let c=0;c<this._style.order.length;++c){const d=this._style._mergedLayers[this._style.order[c]],m=this._style.getLayerSourceCache(d);if(!m||o[m.id]||d.isHidden(this.painter.transform.zoom)||d.type!=="line")continue;const _=d.widthExpression(),y=d.emissiveStrengthExpression();if(_ instanceof h.ac||y instanceof h.ac){o[m.id]=!0;for(const v of this.proxyCoords){const T=this.proxyToSource[v.key][m.id];if(T)for(const I of T)this._clearRenderCacheForTile(m.id,I)}}}}_clearRasterLayersFromRenderCache(){let t=!1;for(const c in this._style._mergedSourceCaches)if(this._style._mergedSourceCaches[c]._source instanceof il){t=!0;break}if(!t)return;const o={};for(let c=0;c<this._style.order.length;++c){const d=this._style._mergedLayers[this._style.order[c]],m=this._style.getLayerSourceCache(d);if(!m||o[m.id]||d.isHidden(this.painter.transform.zoom)||d.type!=="raster")continue;const _=d.paint.get("raster-fade-duration");for(const y of this.proxyCoords){const v=this.proxyToSource[y.key][m.id];if(v)for(const T of v){const I=xl(m.getTile(T),m.findLoadedParent(T,0),m,this.painter.transform,_);(I.opacity!==1||I.mix!==0)&&this._clearRenderCacheForTile(m.id,T)}}}}_setupDrapedRenderBatches(){this._style.updateDrapeFirstLayers();const t=this._style.order,o=t.length;if(o===0)return;const c=[];this._pendingGroundEffectLayers=[];let d,m=0,_=this._style._mergedLayers[t[m]];for(;!this._style.isLayerDraped(_)&&_.isHidden(this.painter.transform.zoom)&&++m<o;)_=this._style._mergedLayers[t[m]];for(;m<o;++m){const y=this._style._mergedLayers[t[m]];y.isHidden(this.painter.transform.zoom)||(this._style.isLayerDraped(y)?d===void 0&&(d=m):(y.type==="fill-extrusion"&&this._pendingGroundEffectLayers.push(m),d!==void 0&&(c.push({start:d,end:m-1}),d=void 0)))}if(d!==void 0&&c.push({start:d,end:m-1}),c.length!==0){const y=c.at(-1);this._pendingGroundEffectLayers.every(v=>v>y.end)||h.w("fill-extrusion with flood lighting and/or ground ambient occlusion should be moved to be on top of all draped layers.")}this._drapedRenderBatches=c}_setupRenderCache(t){const o=this.proxySourceCache;if(this._shouldDisableRenderCache()||this.invalidateRenderCache){if(this.invalidateRenderCache=!1,o.renderCache.length>o.renderCachePool.length){const _=Object.values(o.proxyCachedFBO);o.proxyCachedFBO={};for(let y=0;y<_.length;++y){const v=Object.values(_[y]);o.renderCachePool.push(...v)}}return}this._clearRasterLayersFromRenderCache();const c=this.proxyCoords,d=this._tilesDirty;for(let _=c.length-1;_>=0;_--){const y=c[_];if(o.getTileByID(y.key),o.proxyCachedFBO[y.key]!==void 0){const v=t[y.key],T=this.proxyToSource[y.key];let I=0;for(const P in T){const A=T[P],D=v[P];if(!D||D.length!==A.length||A.some((O,L)=>O!==D[L]||d[P]&&Object.hasOwn(d[P],O.key))){I=-1;break}++I}for(const P in o.proxyCachedFBO[y.key])o.renderCache[o.proxyCachedFBO[y.key][P]].dirty=I<0||I!==Object.values(v).length}}const m=[...this._drapedRenderBatches];m.sort((_,y)=>y.end-y.start-(_.end-_.start));for(const _ of m)for(const y of c){if(o.proxyCachedFBO[y.key])continue;let v=o.renderCachePool.pop();v===void 0&&o.renderCache.length<50&&(v=o.renderCache.length,o.renderCache.push(this._createFBO())),v!==void 0&&(o.proxyCachedFBO[y.key]={},o.proxyCachedFBO[y.key][_.start]=v,o.renderCache[v].dirty=!0)}this._tilesDirty={}}_setupStencil(t,o,c,d){if(!d||!this._sourceTilesOverlap[d.id])return void(this._overlapStencilType&&(this._overlapStencilType=!1));const m=this.painter.context,_=m.gl;if(o.length<=1)return void(this._overlapStencilType=!1);let y;if(c.isTileClipped())y=o.length,this._overlapStencilMode.test={func:_.EQUAL,mask:255},this._overlapStencilType="Clip";else{if(!(o[0].overscaledZ>o.at(-1).overscaledZ))return void(this._overlapStencilType=!1);y=1,this._overlapStencilMode.test={func:_.GREATER,mask:255},this._overlapStencilType="Mask"}this._stencilRef+y>255&&(m.clear({stencil:0}),this._stencilRef=0),this._stencilRef+=y,this._overlapStencilMode.ref=this._stencilRef,c.isTileClipped()&&this._renderTileClippingMasks(o,this._overlapStencilMode.ref)}clipOrMaskOverlapStencilType(){return this._overlapStencilType==="Clip"||this._overlapStencilType==="Mask"}stencilModeForRTTOverlap(t){return this.renderingToTexture&&this._overlapStencilType?(this._overlapStencilType==="Clip"&&(this._overlapStencilMode.ref=this.painter._tileClippingMaskIDs[t.key]),this._overlapStencilMode):pt.disabled}_renderTileClippingMasks(t,o){const c=this.painter,d=this.painter.context,m=d.gl;c._tileClippingMaskIDs={},d.setColorMode(gt.disabled),d.setDepthMode(rt.disabled);const _=c.getOrCreateProgram("clippingMask");for(const y of t){const v=c._tileClippingMaskIDs[y.key]=--o;_.draw(c,m.TRIANGLES,rt.disabled,new pt({func:m.ALWAYS,mask:0},v,255,m.KEEP,m.KEEP,m.REPLACE),gt.disabled,lt.disabled,ba(y.projMatrix),"$clipping",c.tileExtentBuffer,c.quadTriangleIndexBuffer,c.tileExtentSegments)}}pointCoordinate(t){const o=this.painter.transform;if(t.x<0||t.x>o.width||t.y<0||t.y>o.height)return null;const c=[t.x,t.y,1,1];h.aD(c,c,o.pixelMatrixInverse),h.cw(c,c,1/c[3]),c[0]/=o.worldSize,c[1]/=o.worldSize;const d=o._camera.position,m=h.bY(1,o.center.lat),_=[d[0],d[1],d[2]/m,0],y=h.cZ([],c.slice(0,3),_);h.ax(y,y);const v=this.raycast(_,y,this._exaggeration);return v!==null&&v?(h.bi(_,_,y,v),_[3]=_[2],_[2]*=m,_):null}_setupProxiedCoordsForOrtho(t,o,c){if(t.getSource()instanceof h.aY)return this._setupProxiedCoordsForImageSource(t,o,c);this._findCoveringTileCache[t.id]=this._findCoveringTileCache[t.id]||{};const d=this.proxiedCoords[t.id]=[],m=this.proxyCoords;for(let v=0;v<m.length;v++){const T=m[v],I=this._findTileCoveringTileID(T,t);if(I){const P=this._createProxiedId(T,I,c[T.key]&&c[T.key][t.id]);d.push(P),this.proxyToSource[T.key][t.id]=[P]}}let _=!1;const y=new Set;for(let v=0;v<o.length;v++){const T=t.getTile(o[v]);if(!T||!T.hasData())continue;const I=this._findTileCoveringTileID(T.tileID,this.proxySourceCache);if(I&&I.tileID.canonical.z!==T.tileID.canonical.z){const P=this.proxyToSource[I.tileID.key][t.id],A=this._createProxiedId(I.tileID,T,c[I.tileID.key]&&c[I.tileID.key][t.id]);P?P.splice(P.length-1,0,A):this.proxyToSource[I.tileID.key][t.id]=[A];const D=this.proxyToSource[I.tileID.key][t.id];y.has(D)||y.add(D),d.push(A),_=!0}}if(this._sourceTilesOverlap[t.id]=_,_)for(const v of y)v.sort((T,I)=>I.overscaledZ-T.overscaledZ)}_setupProxiedCoordsForImageSource(t,o,c){if(!t.getSource().loaded())return;const d=this.proxiedCoords[t.id]=[],m=this.proxyCoords,_=t.getSource(),y=_.tileID;if(!y)return;const v=new h.P(y.x,y.y)._div(1<<y.z),T=_.coordinates.map(h.ad.fromLngLat).reduce((P,A)=>(P.min.x=Math.min(P.min.x,A.x-v.x),P.min.y=Math.min(P.min.y,A.y-v.y),P.max.x=Math.max(P.max.x,A.x-v.x),P.max.y=Math.max(P.max.y,A.y-v.y),P),{min:new h.P(Number.MAX_VALUE,Number.MAX_VALUE),max:new h.P(-Number.MAX_VALUE,-Number.MAX_VALUE)}),I=(P,A)=>{const D=P.wrap+P.canonical.x/(1<<P.canonical.z),O=P.canonical.y/(1<<P.canonical.z),L=h.ak/(1<<P.canonical.z),k=A.wrap+A.canonical.x/(1<<A.canonical.z),N=A.canonical.y/(1<<A.canonical.z);return D+L<k+T.min.x||D>k+T.max.x||O+L<N+T.min.y||O>N+T.max.y};for(let P=0;P<m.length;P++){const A=m[P];for(let D=0;D<o.length;D++){const O=t.getTile(o[D]);if(!O||!O.hasData()||I(A,O.tileID))continue;const L=this._createProxiedId(A,O,c[A.key]&&c[A.key][t.id]),k=this.proxyToSource[A.key][t.id];k?k.push(L):this.proxyToSource[A.key][t.id]=[L],d.push(L)}}}_createProxiedId(t,o,c){let d=this.orthoMatrix;if(c){const m=c.find(_=>_.key===o.tileID.key);if(m)return m}if(o.tileID.key!==t.key){const m=t.canonical.z-o.tileID.canonical.z;let _,y,v;d=h.bd();const T=o.tileID.wrap-t.wrap<<t.overscaledZ;m>0?(_=h.ak>>m,y=_*((o.tileID.canonical.x<<m)-t.canonical.x+T),v=_*((o.tileID.canonical.y<<m)-t.canonical.y)):(_=h.ak<<-m,y=h.ak*(o.tileID.canonical.x-(t.canonical.x+T<<-m)),v=h.ak*(o.tileID.canonical.y-(t.canonical.y<<-m))),h.bX(d,0,_,0,_,0,1),h.bB(d,d,[y,v,0])}return new es(o.tileID,t.key,d)}_findTileCoveringTileID(t,o){let c=o.getTile(t);if(c&&c.hasData())return c;const d=this._findCoveringTileCache[o.id],m=d[t.key];if(c=m?o.getTileByID(m):null,c&&c.hasData()||m===null)return c;let _=c?c.tileID:t,y=_.overscaledZ;const v=o.getSource().minzoom,T=[];if(!m){const P=o.getSource().maxzoom;if(t.canonical.z>=P){const A=t.canonical.z-P;o.getSource().reparseOverscaled?(y=Math.max(t.canonical.z+2,o.transform.tileZoom),_=new h.aU(y,t.wrap,P,t.canonical.x>>A,t.canonical.y>>A)):A!==0&&(y=P,_=new h.aU(y,t.wrap,P,t.canonical.x>>A,t.canonical.y>>A))}_.key!==t.key&&(T.push(_.key),c=o.getTile(_))}const I=P=>{T.forEach(A=>{d[A]=P}),T.length=0};for(y-=1;y>=v&&(!c||!c.hasData());y--){c&&I(c.tileID.key);const P=_.calculateScaledKey(y);if(c=o.getTileByID(P),c&&c.hasData())break;const A=d[P];if(A===null)break;A===void 0?T.push(P):c=o.getTileByID(A)}return I(c?c.tileID.key:null),c&&c.hasData()?c:null}findDEMTileFor(t){return this.enabled?this._findTileCoveringTileID(t,this.sourceCache):null}prepareDrawTile(){this.renderedToTile=!0}_clearRenderCacheForTile(t,o){let c=this._tilesDirty[t];c||(c=this._tilesDirty[t]={}),c[o.key]=!0}}function Bp(a,t,o){const c=(function(y,v,T){const I=h.bk(v,y),P=h.bk(T,[.2126,.7152,.0722]),A=(O,L,k)=>(1-k)*O+k*L,D=A(1-.3*Math.min(P,1),1,Math.min(I+1,1));return A(.92,1,Math.asin(h.aB(v[2],-1,1))/Math.PI+.5)*D})(a,[0,0,1],t),d=[0,0,0];h.bN(d,o.slice(0,3),c);const m=[0,0,0];h.bN(m,t.slice(0,3),a[2]);const _=[0,0,0];return h.cX(_,d,m),h.c_(_)}const kp=["fill","fillOutline","fillPattern","line","linePattern","background","backgroundPattern","hillshade","raster"],Np=["stars","rainParticle","snowParticle","fillExtrusion","fillExtrusionGroundEffect","building","buildingBloom","elevatedStructures","model","symbol"];class gd{static cacheKey(t,o,c,d){const m=[o];d&&m.push(d.cacheKey);for(const _ of c)(typeof _=="string"&&_.includes(" ")||t.usedDefines.has(_))&&m.push(_);return m.join("/")}constructor(t,o,c,d,m,_,y=!1){const v=t.gl;this.program=v.createProgram(),this._context=t,this._fixedUniformsFn=m,this._pending=!0,this._precompiled=y,this.attributes={},this.configuration=d,this.name=o,this.fixedDefines=[..._],y?t._compileStats.precompiled++:t._compileStats.onDemand++;const T=`#version 300 es 3060${(d?d.defines():[]).concat(_.map(k=>`#define ${k}`)).join(` 3061`)}`,I=[T,rd];for(const k of c.fragmentIncludes)I.push(fl[k]);I.push(c.fragmentSource);const P=I.join(` 3062`),A=[T,Eu];for(const k of c.vertexIncludes)A.push(fl[k]);this.forceManualRenderingForInstanceIDShaders=t.forceManualRenderingForInstanceIDShaders&&c.vertexSource.includes("gl_InstanceID"),this.forceManualRenderingForInstanceIDShaders&&A.push("uniform int u_instanceID;"),A.push(c.vertexSource);let D=A.join(` 3063`);this.forceManualRenderingForInstanceIDShaders&&(D=D.replaceAll("gl_InstanceID","u_instanceID"));const O=v.createShader(v.FRAGMENT_SHADER);if(v.isContextLost())return this.failedToCreate=!0,void(this._pending=!1);v.shaderSource(O,P),v.compileShader(O),v.attachShader(this.program,O);const L=v.createShader(v.VERTEX_SHADER);if(v.isContextLost())return this.failedToCreate=!0,void(this._pending=!1);v.shaderSource(L,D),v.compileShader(L),v.attachShader(this.program,L),v.linkProgram(this.program),this._fragmentShader=O,this._vertexShader=L,t.extParallelShaderCompile?t._pendingPrograms.add(this):this._finalize()}_finalize(){if(!this._pending)return;this._pending=!1;const t=this._context,o=t.gl;t._pendingPrograms.delete(this);const c=h.o.now(),d=o.getProgramParameter(this.program,o.LINK_STATUS),m=h.o.now()-c,_=t._compileStats;if(_.totalStallMs+=m,m>_.maxStallMs&&(_.maxStallMs=m),m>1){_.framesMissed+=Math.floor(60*m/1e3);const T=this.fixedDefines.join(",");_.stalls.push({name:`${this.name}${T?"/":""}${T}`,ms:m,timestamp:c})}if(this._fragmentShader&&(d||h.w(`Fragment shader '${this.name}': ${o.getShaderInfoLog(this._fragmentShader)}`),o.deleteShader(this._fragmentShader),this._fragmentShader=null),this._vertexShader&&(d||h.w(`Vertex shader '${this.name}': ${o.getShaderInfoLog(this._vertexShader)}`),o.deleteShader(this._vertexShader),this._vertexShader=null),!d)return h.w(`Failed to link program '${this.name}': ${o.getProgramInfoLog(this.program)}`),void(this.failedToCreate=!0);this.fixedUniforms=this._fixedUniformsFn(t),this.fixedUniformsEntries=Object.entries(this.fixedUniforms),this.binderUniforms=this.configuration?this.configuration.getUniforms(t):[],this.forceManualRenderingForInstanceIDShaders&&(this.instancingUniforms=(T=>({u_instanceID:new h.b$(T)}))(t));const y=this.fixedDefines,v=this.name;(y.includes("TERRAIN")||y.includes("ELEVATED")||v.includes("symbol")||v.includes("circle"))&&(this.terrainUniforms=(T=>({u_dem:new h.b$(T),u_dem_prev:new h.b$(T),u_dem_tl:new h.c2(T),u_dem_scale:new h.c1(T),u_dem_tl_prev:new h.c2(T),u_dem_scale_prev:new h.c1(T),u_dem_size:new h.c1(T),u_dem_lerp:new h.c1(T),u_exaggeration:new h.c1(T),u_depth:new h.b$(T),u_depth_size_inv:new h.c2(T),u_depth_range_unpack:new h.c2(T),u_occluder_half_size:new h.c1(T),u_occlusion_depth_offset:new h.c1(T),u_meter_to_dem:new h.c1(T),u_label_plane_matrix_inv:new h.c3(T)}))(t)),y.includes("GLOBE")&&(this.globeUniforms=(T=>({u_tile_tl_up:new h.c0(T),u_tile_tr_up:new h.c0(T),u_tile_br_up:new h.c0(T),u_tile_bl_up:new h.c0(T),u_tile_up_scale:new h.c1(T)}))(t)),y.includes("FOG")&&(this.fogUniforms=(T=>({u_fog_matrix:new h.c3(T),u_fog_range:new h.c2(T),u_fog_color:new h.cS(T),u_fog_horizon_blend:new h.c1(T),u_fog_vertical_limit:new h.c2(T),u_fog_temporal_offset:new h.c1(T),u_frustum_tl:new h.c0(T),u_frustum_tr:new h.c0(T),u_frustum_br:new h.c0(T),u_frustum_bl:new h.c0(T),u_globe_pos:new h.c0(T),u_globe_radius:new h.c1(T),u_globe_transition:new h.c1(T),u_is_globe:new h.b$(T),u_viewport:new h.c2(T)}))(t)),y.includes("RENDER_CUTOFF")&&(this.cutoffUniforms=(T=>({u_cutoff_params:new h.cS(T)}))(t)),y.includes("LIGHTING_3D_MODE")&&(this.lightsUniforms=(T=>({u_lighting_ambient_color:new h.c0(T),u_lighting_directional_dir:new h.c0(T),u_lighting_directional_color:new h.c0(T),u_ground_radiance:new h.c0(T)}))(t)),y.includes("RENDER_SHADOWS")&&(this.shadowUniforms=(T=>({u_light_matrix_0:new h.c3(T),u_light_matrix_1:new h.c3(T),u_fade_range:new h.c2(T),u_shadow_normal_offset:new h.c0(T),u_shadow_intensity:new h.c1(T),u_shadow_texel_size:new h.c1(T),u_shadow_map_resolution:new h.c1(T),u_shadow_direction:new h.c0(T),u_shadow_bias:new h.c0(T),u_shadowmap_0:new h.b$(T),u_shadowmap_1:new h.b$(T)}))(t))}maybeFinalize(){if(!this._pending)return;const t=this._context.extParallelShaderCompile;t&&!this._context.gl.getProgramParameter(this.program,t.COMPLETION_STATUS_KHR)||this._finalize()}_ensureReady(){this._pending&&(this._finalize(),this._context.sweepPendingPrograms())}getAttributeLocation(t,o){this._ensureReady();let c=this.attributes[o];return c===void 0&&(c=this.attributes[o]=t.getAttribLocation(this.program,o)),c}setTerrainUniformValues(t,o){if(this._ensureReady(),!this.terrainUniforms)return;const c=this.terrainUniforms;if(!this.failedToCreate){t.program.set(this.program);for(const d in o)c[d]&&c[d].set(this.program,d,o[d])}}setGlobeUniformValues(t,o){if(this._ensureReady(),!this.globeUniforms)return;const c=this.globeUniforms;if(!this.failedToCreate){t.program.set(this.program);for(const d in o)c[d]&&c[d].set(this.program,d,o[d])}}setFogUniformValues(t,o){if(this._ensureReady(),!this.fogUniforms)return;const c=this.fogUniforms;if(!this.failedToCreate){t.program.set(this.program);for(const d in o)c[d].set(this.program,d,o[d])}}setCutoffUniformValues(t,o){if(this._ensureReady(),!this.cutoffUniforms)return;const c=this.cutoffUniforms;if(!this.failedToCreate){t.program.set(this.program);for(const d in o)c[d].set(this.program,d,o[d])}}setLightsUniformValues(t,o){if(this._ensureReady(),!this.lightsUniforms)return;const c=this.lightsUniforms;if(!this.failedToCreate){t.program.set(this.program);for(const d in o)c[d].set(this.program,d,o[d])}}setShadowUniformValues(t,o){if(this._ensureReady(),this.failedToCreate||!this.shadowUniforms)return;const c=this.shadowUniforms;t.program.set(this.program);for(const d in o)c[d].set(this.program,d,o[d])}_drawDebugWireframe(t,o,c,d,m,_,y,v,T,I){const P=t.options.wireframe;if(P.terrain===!1&&P.layers2D===!1&&P.layers3D===!1)return;const A=t.context;if(!(!(!P.terrain||this.name!=="terrainRaster"&&this.name!=="globeRaster")||!(!P.layers2D||t._terrain&&t._terrain.renderingToTexture||!kp.includes(this.name))||!(!P.layers3D||!Np.includes(this.name))))return;const D=A.gl,O=t.wireframeDebugCache.getLinesFromTrianglesBuffer(t.frameCounter,m,A);if(!O)return;const L=[...this.fixedDefines,"DEBUG_WIREFRAME"],k=t.getOrCreateProgram(this.name,{config:this.configuration,defines:L});k._ensureReady(),A.program.set(k.program);const N=(G,ne,te)=>{if(ne[G]&&te[G])for(const se in ne[G])te[G][se]&&te[G][se].set(te.program,se,ne[G][se].current)};T&&T.setUniforms(k.program,A,k.binderUniforms,y,{zoom:v}),N("fixedUniforms",this,k),N("terrainUniforms",this,k),N("globeUniforms",this,k),N("fogUniforms",this,k),N("lightsUniforms",this,k),N("shadowUniforms",this,k),O.bind(),A.setColorMode(new gt([D.ONE,D.ONE_MINUS_SRC_ALPHA,D.ZERO,D.ONE],h.C.transparent,[!0,!0,!0,!1])),A.setDepthMode(new rt(o.func===D.LESS?D.LEQUAL:o.func,rt.ReadOnly,o.range)),A.setStencilMode(pt.disabled);const H=3*_.primitiveLength*2,Z=3*_.primitiveOffset*2*2;if(this.forceManualRenderingForInstanceIDShaders){const G=I||1;for(let ne=0;ne<G;++ne)k.instancingUniforms.u_instanceID.set(this.program,"u_instanceID",ne),D.drawElements(D.LINES,H,D.UNSIGNED_SHORT,Z)}else I&&I>1?D.drawElementsInstanced(D.LINES,H,D.UNSIGNED_SHORT,Z,I):D.drawElements(D.LINES,H,D.UNSIGNED_SHORT,Z);m.bind(),A.program.set(this.program),A.setDepthMode(o),A.setStencilMode(c),A.setColorMode(d)}checkUniforms(t,o,c){if(this.fixedDefines.includes(o)){for(const d of Object.keys(c))if(!c[d].initialized)throw new Error(`Program '${this.name}', from draw '${t}': uniform ${d} not set but required by ${o} being defined`)}}draw(t,o,c,d,m,_,y,v,T,I,P,A,D,O,L,k){const N=t.context,H=N.gl;if(this._ensureReady(),this.failedToCreate)return;N.program.set(this.program),N.setDepthMode(c),N.setStencilMode(d),N.setColorMode(m),N.setCullFace(_);for(const[J,K]of this.fixedUniformsEntries)K.set(this.program,J,y[J]);O&&O.setUniforms(this.program,N,this.binderUniforms,A,{zoom:D});const Z={[H.POINTS]:1,[H.LINES]:2,[H.TRIANGLES]:3,[H.LINE_STRIP]:1}[o];this.checkUniforms(v,"RENDER_SHADOWS",this.shadowUniforms);const G=L||[],ne=O?O.getPaintVertexBuffers():[],te=o===H.TRIANGLES&&I,se=k&&k>0?1:void 0;for(const J of P.get()){const K=J.vaos||(J.vaos={});if((K[v]||(K[v]=new nd)).bind(N,this,T,ne,I,J.vertexOffset,G,se),this.forceManualRenderingForInstanceIDShaders){const oe=k||1;for(let de=0;de<oe;++de)this.instancingUniforms.u_instanceID.set(this.program,"u_instanceID",de),I?H.drawElements(o,J.primitiveLength*Z,H.UNSIGNED_SHORT,J.primitiveOffset*Z*2):H.drawArrays(o,J.vertexOffset,J.vertexLength)}else k&&k>1?H.drawElementsInstanced(o,J.primitiveLength*Z,H.UNSIGNED_SHORT,J.primitiveOffset*Z*2,k):I?H.drawElements(o,J.primitiveLength*Z,H.UNSIGNED_SHORT,J.primitiveOffset*Z*2):H.drawArrays(o,J.vertexOffset,J.vertexLength);te&&this._drawDebugWireframe(t,c,d,m,I,J,A,D,O,k)}}}
3063function yd(a,t,o=0){const c=Math.pow(2,t.tileID.overscaledZ),d=t.tileSize*Math.pow(2,a.transform.tileZoom)/c,m=d*(t.tileID.canonical.x+t.tileID.wrap*c),_=d*t.tileID.canonical.y;return{u_image:0,u_texsize:t.imageAtlasTexture?t.imageAtlasTexture.size:[0,0],u_tile_units_to_pixels:1/h.az(t,1,a.transform.tileZoom),u_pixel_coord_upper:[m>>16,_>>16],u_pixel_coord_lower:[65535&m,65535&_],u_pattern_transition:o}}const Mc={terrain:0,flat:1},Bu=h.bd(),ku=(a,t,o,c,d,m,_,y,v,T,I,P,A,D,O,L,k,N,H=[0,0,1])=>{const Z=t.style.light,G=Z.properties.get("position"),ne=[G.x,G.y,G.z],te=h.dH();Z.properties.get("anchor")==="viewport"&&(h.dI(te,-t.transform.angle),h.dJ(ne,ne,te));const se=Z.properties.get("color").toPremultipliedRenderColor(null),J=t.transform,K={u_matrix:a,u_lightpos:ne,u_lightintensity:Z.properties.get("intensity"),u_lightcolor:[se.r,se.g,se.b],u_vertical_gradient:+o,u_opacity:c,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:Bu,u_merc_center:[0,0],u_up_dir:[0,0,0],u_height_lift:0,u_height_type:Mc[T],u_base_type:Mc[I],u_ao:d,u_edge_radius:m,u_width_scale:_,u_flood_light_color:O,u_vertical_scale:L,u_flood_light_intensity:k,u_ground_shadow_factor:N,u_front_cutoff_params:H};return J.projection.name==="globe"&&(K.u_tile_id=[y.canonical.x,y.canonical.y,1<<y.canonical.z],K.u_zoom_transition=P,K.u_inv_rot_matrix=D,K.u_merc_center=A,K.u_up_dir=J.projection.upVector(new h.cp(0,0,0),A[0]*h.ak,A[1]*h.ak),K.u_height_lift=v),K},Nu=(a,t,o,c,d,m)=>({u_matrix:a,u_edge_radius:t,u_width_scale:o,u_vertical_scale:c,u_height_type:Mc[d],u_base_type:Mc[m]}),Up=(a,t,o,c,d,m,_,y,v,T,I,P,A,D,O,L,k,N)=>{const H=ku(a,t,o,c,d,m,_,y,T,I,P,A,D,O,L,k,1,[0,0,0]),Z={u_height_factor:-Math.pow(2,y.overscaledZ)/v.tileSize/8};return Object.assign(H,yd(t,v,N),Z)},xd=(a,t,o)=>({u_matrix:a,u_emissive_strength:t,u_ground_shadow_factor:o}),vd=(a,t,o,c,d,m=0)=>Object.assign(xd(a,t,d),yd(o,c,m)),Vp=(a,t,o,c)=>({u_matrix:a,u_world:o,u_emissive_strength:t,u_ground_shadow_factor:c}),jp=(a,t,o,c,d,m,_=0)=>Object.assign(vd(a,t,o,c,m,_),{u_world:d}),Gp=(a,t)=>({u_matrix:a,u_depth_bias:t}),bd=(a,t)=>({u_matrix:a,u_ground_shadow_factor:t}),vl=(a,t,o,c,d)=>({u_matrix:a,u_camera_pos:[t[0],t[1],t[2]],u_depth_bias:o,u_height_scale:c,u_reset_depth:d}),$p=(a,t,o)=>({u_image:a,u_texel_size:t,u_first_pass:o?1:0}),Hp=(a,t,o,c,d,m,_,y)=>{const v=h.ak/m.tileSize;return{u_matrix:a,u_inv_rot_matrix:t,u_camera_to_center_distance:o.getCameraToCenterDistance(y),u_extrude_scale:[o.pixelsToGLUnits[0]/v,o.pixelsToGLUnits[1]/v],u_zoom_transition:c,u_tile_id:_,u_merc_center:d}},qp=(a,t,o,c)=>({u_matrix:a,u_inv_matrix:t,u_camera_to_center_distance:o.getCameraToCenterDistance(c),u_viewport_size:[o.width,o.height]}),Uu=(a,t,o=1)=>({u_matrix:a,u_color:t,u_overlay:0,u_overlay_scale:o}),wd=h.bd(),Zp=(a,t,o,c,d,m,_)=>{const y=a.transform,v=y.projection.name==="globe",T=v?h.dK(y.zoom,t.canonical)*y._pixelsPerMercatorPixel:h.az(o,1,m),I={u_matrix:t.projMatrix,u_extrude_scale:T,u_intensity:_,u_inv_rot_matrix:wd,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0]};if(v){I.u_inv_rot_matrix=c,I.u_merc_center=d,I.u_tile_id=[t.canonical.x,t.canonical.y,1<<t.canonical.z],I.u_zoom_transition=h.ai(y.zoom);const P=d[0]*h.ak,A=d[1]*h.ak;I.u_up_dir=y.projection.upVector(new h.cp(0,0,0),P,A)}return I};function Vu(a,[t,o,c,d],[m,_]){if(m===_)return[0,0,0,0];const y=255*(a-1)/(a*(_-m));return[t*y,o*y,c*y,d*y]}function Td(a,t,[o,c]){return o===c?0:.5/a+(t-o)*(a-1)/(a*(c-o))}function Sd(a){const t=a.terrain?a.terrain.exaggeration():1;var o;return(a.transform.pitch<15?.07*(1-(o=h.aB((14-a.transform.zoom)/5,0,1)))+.7*o:.07)*t}const ju=(a,t,o,c,d,m,_,y,v,T,I,P,A,D,O,L,k,N,H,Z,G,ne)=>({u_matrix:t,u_normalize_matrix:o,u_globe_matrix:c,u_merc_matrix:d,u_grid_matrix:m,u_tl_parent:_,u_scale_parent:I,u_fade_t:P.mix,u_opacity:P.opacity*A.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:A.paint.get("raster-brightness-min"),u_brightness_high:A.paint.get("raster-brightness-max"),u_saturation_factor:h.dM(A.paint.get("raster-saturation")),u_contrast_factor:h.dL(A.paint.get("raster-contrast")),u_spin_weights:Id(A.paint.get("raster-hue-rotate")),u_perspective_transform:D,u_raster_elevation:O,u_zoom_transition:y,u_merc_center:v,u_cutoff_params:T,u_colorization_mix:Vu(h.dN,k,H),u_colorization_offset:Td(h.dN,N,H),u_color_ramp:L,u_texture_offset:[G/(Z+2*G),Z/(Z+2*G)],u_texture_res:[Z+2*G,Z+2*G],u_emissive_strength:ne,u_zbias_factor:Sd(a)});function Id(a){a*=Math.PI/180;const t=Math.sin(a),o=Math.cos(a);return[(2*o+1)/3,(-Math.sqrt(3)*t-o+1)/3,(Math.sqrt(3)*t-o+1)/3]}const Wp=h.bd(),Xp=(a,t,o,c,d,m,_,y,v,T,I,P,A,D,O,L,k,N,H,Z,G,ne,te,se)=>{const J=d.transform,K={u_is_size_zoom_constant:+(a==="constant"||a==="source"),u_is_size_feature_constant:+(a==="constant"||a==="c
3063amera"),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_camera_to_center_distance:J.getCameraToCenterDistance(H),u_rotate_symbol:+o,u_aspect_ratio:J.width/J.height,u_fade_change:d.options.fadeDuration?d.symbolFadeChange:1,u_matrix:m,u_label_plane_matrix:_,u_coord_matrix:y,u_is_text:+T,u_elevation_from_sea:v?1:0,u_pitch_with_map:+c,u_texsize:I,u_texsize_icon:P,u_texture:0,u_texture_icon:1,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:Wp,u_merc_center:[0,0],u_camera_forward:[0,0,0],u_ecef_origin:[0,0,0],u_tile_matrix:Wp,u_up_vector:[0,-1,0],u_color_adj_mat:ne,u_icon_transition:te||0,u_gamma_scale:c?d.transform.getCameraToCenterDistance(H)*Math.cos(d.terrain?0:d.transform._pitch):1,u_device_pixel_ratio:h.o.devicePixelRatio,u_is_halo:1,u_scale_factor:se||1,u_ground_shadow_factor:Z,u_inv_matrix:h.ba(h.bd(),_),u_normal_scale:G,u_lutTexture:10,u_zoom:J.zoom-Math.floor(J.zoom),u_spp_fill_np_color:[0,0,0,1],u_spp_halo_np_color:[0,0,0,0],u_spp_opacity:1,u_spp_halo_width:0,u_spp_halo_blur:0,u_spp_emissive_strength:0,u_spp_occlusion_opacity:1,u_spp_z_offset:0,u_spp_translate_rotation:[1,0]};return H.name==="globe"&&(K.u_tile_id=[D.canonical.x,D.canonical.y,1<<D.canonical.z],K.u_zoom_transition=O,K.u_inv_rot_matrix=k,K.u_merc_center=L,K.u_camera_forward=J._camera.forward(),K.u_ecef_origin=h.dO(J.globeMatrix,D.toUnwrapped()),K.u_tile_matrix=J.globeMatrix,K.u_up_vector=N),K},Yp=(a,t,o,c)=>({u_matrix:a,u_emissive_strength:t,u_opacity:o,u_color:c}),Gu=(a,t,o,c,d,m,_,y,v)=>Object.assign((function(T,I,P,A,D,O){const{width:L,height:k}=A.imageManager.getPixelSize(I),N=Math.pow(2,O.tileID.overscaledZ),H=O.tileSize*Math.pow(2,A.transform.tileZoom)/N,Z=H*(O.tileID.canonical.x+O.tileID.wrap*N),G=H*O.tileID.canonical.y;return{u_image:0,u_pattern_tl:P.tl,u_pattern_br:P.br,u_texsize:[L,k],u_pattern_size:P.displaySize,u_pattern_units_to_pixels:D?[A.transform.width,-1*A.transform.height]:[1/h.az(O,1,A.transform.tileZoom),1/h.az(O,1,A.transform.tileZoom)],u_pixel_coord_upper:[Z>>16,G>>16],u_pixel_coord_lower:[65535&Z,65535&G]}})(0,m,_,c,y,v),{u_matrix:a,u_emissive_strength:t,u_opacity:o}),Ed=new Float32Array(h.bA([])),$u=(a,t,o,c,d,m,_,y,v,T,I,P,A,D=[0,0,0],O,L,k,N=1)=>{const H=d.style.light,Z=H.properties.get("position"),G=[-Z.x,-Z.y,Z.z],ne=h.dH();H.properties.get("anchor")==="viewport"&&(h.dI(ne,-d.transform.angle),h.dJ(G,G,ne));const te=I.alphaMode==="MASK",se=H.properties.get("color").toNonPremultipliedRenderColor(null),J=A.paint.get("model-ambient-occlusion-intensity"),K=A.paint.get("model-color").constantOr(h.C.white).toNonPremultipliedRenderColor(null);return K.a=A.paint.get("model-color-mix-intensity").constantOr(0),k&&(K.r=k[0],K.g=k[1],K.b=k[2],K.a=k[3]),L&&(K.r=L.color.r,K.g=L.color.g,K.b=L.color.b,K.a=L.colorMix,P=L.emissionStrength,m*=L.opacity),{u_matrix:a,u_lighting_matrix:t,u_normal_matrix:o,u_node_matrix:c||Ed,u_lightpos:G,u_lightintensity:H.properties.get("intensity"),u_lightcolor:[se.r,se.g,se.b],u_camera_pos:D,u_opacity:m,u_baseTextureIsAlpha:0,u_alphaMask:+te,u_alphaCutoff:I.alphaCutoff,u_baseColorFactor:_.toNonPremultipliedRenderColor(null).toArray01(),u_emissiveFactor:y.toNonPremultipliedRenderColor(null).toArray01(),u_metallicFactor:v,u_roughnessFactor:T,u_baseColorTexture:5,u_metallicRoughnessTexture:6,u_normalTexture:7,u_occlusionTexture:8,u_emissionTexture:9,u_lutTexture:10,u_color_mix:K.toArray01(),u_aoIntensity:J,u_emissive_strength:P,u_occlusionTextureTransform:O||[0,0,0,0],u_dithered_discard_threshold:N}},Jp=(a,t=Ed,o=Ed)=>({u_matrix:a,u_instance:t,u_node_matrix:o}),Kp={fillExtrusion:a=>({u_matrix:new h.c3(a),u_lightpos:new h.c0(a),u_lightintensity:new h.c1(a),u_lightcolor:new h.c0(a),u_vertical_gradient:new h.c1(a),u_opacity:new h.c1(a),u_edge_radius:new h.c1(a),u_width_scale:new h.c1(a),u_ao:new h.c2(a),u_height_type:new h.b$(a),u_base_type:new h.b$(a),u_tile_id:new h.c0(a),u_zoom_transition:new h.c1(a),u_inv_rot_matrix:new h.c3(a),u_merc_center:new h.c2(a),u_up_dir:new h.c0(a),u_height_lift:new h.c1(a),u_flood_light_color:new h.c0(a),u_vertical_scale:new h.c1(a),u_flood_light_intensity:new h.c1(a),u_ground_shadow_factor:new h.c0(a),u_front_cutoff_params:new h.c0(a)}),fillExtrusionDepth:a=>({u_matrix:new h.c3(a),u_edge_radius:new h.c1(a),u_width_scale:new h.c1(a),u_vertical_scale:new h.c1(a),u_height_type:new h.b$(a),u_base_type:new h.b$(a)}),fillExtrusionPattern:a=>({u_matrix:new h.c3(a),u_lightpos:new h.c0(a),u_lightintensity:new h.c1(a),u_lightcolor:new h.c0(a),u_vertical_gradient:new h.c1(a),u_height_factor:new h.c1(a),u_edge_radius:new h.c1(a),u_width_scale:new h.c1(a),u_ao:new h.c2(a),u_height_type:new h.b$(a),u_base_type:new h.b$(a),u_tile_id:new h.c0(a),u_zoom_transition:new h.c1(a),u_inv_rot_matrix:new h.c3(a),u_merc_center:new h.c2(a),u_up_dir:new h.c0(a),u_height_lift:new h.c1(a),u_image:new h.b$(a),u_texsize:new h.c2(a),u_pixel_coord_upper:new h.c2(a),u_pixel_coord_lower:new h.c2(a),u_tile_units_to_pixels:new h.c1(a),u_opacity:new h.c1(a),u_pattern_transition:new h.c1(a)}),fillExtrusionGroundEffect:a=>({u_matrix:new h.c3(a),u_opacity:new h.c1(a),u_ao_pass:new h.c1(a),u_meter_to_tile:new h.c1(a),u_ao:new h.c2(a),u_flood_light_intensity:new h.c1(a),u_flood_light_color:new h.c0(a),u_attenuation:new h.c1(a),u_edge_radius:new h.c1(a),u_fb:new h.b$(a),u_fb_size:new h.c1(a),u_dynamic_offset:new h.c1(a)}),fill:a=>({u_matrix:new h.c3(a),u_emissive_strength:new h.c1(a),u_ground_shadow_factor:new h.c0(a)}),fillPattern:a=>({u_matrix:new h.c3(a),u_emissive_strength:new h.c1(a),u_image:new h.b$(a),u_texsize:new h.c2(a),u_pixel_coord_upper:new h.c2(a),u_pixel_coord_lower:new h.c2(a),u_tile_units_to_pixels:new h.c1(a),u_ground_shadow_factor:new h.c0(a),u_pattern_transition:new h.c1(a)}),fillOutline:a=>({u_matrix:new h.c3(a),u_emissive_strength:new h.c1(a),u_world:new h.c2(a),u_ground_shadow_factor:new h.c0(a)}),fillOutlinePattern:a=>({u_matrix:new h.c3(a),u_emissive_strength:new h.c1(a),u_world:new h.c2(a),u_image:new h.b$(a),u_texsize:new h.c2(a),u_pixel_coord_upper:new h.c2(a),u_pixel_coord_lower:new h.c2(a),u_tile_units_to_pixels:new h.c1(a),u_ground_shadow_factor:new h.c0(a),u_pattern_transition:new h.c1(a)}),lineBlendComposite:a=>({u_image:new h.b$(a),u_opacity:new h.c1(a),u_blend_mode:new h.b$(a),u_max_density:new h.c1(a)}),lineBlendReduce:a=>({u_image:new h.b$(a),u_texel_size:new h.c2(a),u_first_pass:new h.b$(a)}),elevatedStructuresDepth:a=>({u_matrix:new h.c3(a),u_depth_bias:new h.c1(a)}),elevatedStructures:a=>({u_matrix:new h.c3(a),u_ground_shadow_factor:new h.c0(a)}),elevatedStructuresDepthReconstruct:a=>({u_matrix:new h.c3(a),u_camera_pos:new h.c0(a),u_depth_bias:new h.c1(a),u_height_scale:new h.c1(a),u_reset_depth:new h.c1(a)}),circle:h.dR,collisionBox:a=>({u_matrix:new h.c3(a),u_inv_rot_matrix:new h.c3(a),u_camera_to_center_distance:new h.c1(a),u_extrude_scale:new h.c2(a),u_zoom_transition:new h.c1(a),u_merc_center:new h.c2(a),u_tile_id:new h.c0(a)}),collisionCircle:a=>({u_matrix:new h.c3(a),u_inv_matrix:new h.c3(a),u_camera_to_center_distance:new h.c1(a),u_viewport_size:new h.c2(a)}
3063),debug:a=>({u_color:new h.dp(a),u_matrix:new h.c3(a),u_overlay:new h.b$(a),u_overlay_scale:new h.c1(a)}),clippingMask:a=>({u_matrix:new h.c3(a)}),heatmap:a=>({u_extrude_scale:new h.c1(a),u_intensity:new h.c1(a),u_matrix:new h.c3(a),u_inv_rot_matrix:new h.c3(a),u_merc_center:new h.c2(a),u_tile_id:new h.c0(a),u_zoom_transition:new h.c1(a),u_up_dir:new h.c0(a)}),heatmapTexture:a=>({u_image:new h.b$(a),u_color_ramp:new h.b$(a),u_opacity:new h.c1(a)}),hillshade:a=>({u_matrix:new h.c3(a),u_image:new h.b$(a),u_latrange:new h.c2(a),u_light:new h.c2(a),u_shadow:new h.dp(a),u_highlight:new h.dp(a),u_emissive_strength:new h.c1(a),u_accent:new h.dp(a)}),hillshadePrepare:a=>({u_matrix:new h.c3(a),u_image:new h.b$(a),u_dimension:new h.c2(a),u_zoom:new h.c1(a)}),line:h.dQ,linePattern:h.dP,raster:a=>({u_matrix:new h.c3(a),u_normalize_matrix:new h.c3(a),u_globe_matrix:new h.c3(a),u_merc_matrix:new h.c3(a),u_grid_matrix:new h.dq(a),u_tl_parent:new h.c2(a),u_scale_parent:new h.c1(a),u_fade_t:new h.c1(a),u_opacity:new h.c1(a),u_image0:new h.b$(a),u_image1:new h.b$(a),u_brightness_low:new h.c1(a),u_brightness_high:new h.c1(a),u_saturation_factor:new h.c1(a),u_contrast_factor:new h.c1(a),u_spin_weights:new h.c0(a),u_perspective_transform:new h.c2(a),u_raster_elevation:new h.c1(a),u_zoom_transition:new h.c1(a),u_merc_center:new h.c2(a),u_cutoff_params:new h.cS(a),u_colorization_mix:new h.cS(a),u_colorization_offset:new h.c1(a),u_color_ramp:new h.b$(a),u_texture_offset:new h.c2(a),u_texture_res:new h.c2(a),u_emissive_strength:new h.c1(a),u_zbias_factor:new h.c1(a)}),symbol:a=>({u_is_size_zoom_constant:new h.b$(a),u_is_size_feature_constant:new h.b$(a),u_size_t:new h.c1(a),u_size:new h.c1(a),u_camera_to_center_distance:new h.c1(a),u_rotate_symbol:new h.b$(a),u_aspect_ratio:new h.c1(a),u_fade_change:new h.c1(a),u_matrix:new h.c3(a),u_label_plane_matrix:new h.c3(a),u_coord_matrix:new h.c3(a),u_is_text:new h.b$(a),u_elevation_from_sea:new h.b$(a),u_pitch_with_map:new h.b$(a),u_texsize:new h.c2(a),u_texsize_icon:new h.c2(a),u_texture:new h.b$(a),u_texture_icon:new h.b$(a),u_gamma_scale:new h.c1(a),u_device_pixel_ratio:new h.c1(a),u_tile_id:new h.c0(a),u_zoom_transition:new h.c1(a),u_inv_rot_matrix:new h.c3(a),u_merc_center:new h.c2(a),u_camera_forward:new h.c0(a),u_tile_matrix:new h.c3(a),u_up_vector:new h.c0(a),u_ecef_origin:new h.c0(a),u_is_halo:new h.b$(a),u_icon_transition:new h.c1(a),u_color_adj_mat:new h.c3(a),u_scale_factor:new h.c1(a),u_ground_shadow_factor:new h.c0(a),u_inv_matrix:new h.c3(a),u_normal_scale:new h.c1(a),u_lutTexture:new h.b$(a),u_zoom:new h.c1(a),u_spp_fill_np_color:new h.cS(a),u_spp_halo_np_color:new h.cS(a),u_spp_opacity:new h.c1(a),u_spp_halo_width:new h.c1(a),u_spp_halo_blur:new h.c1(a),u_spp_emissive_strength:new h.c1(a),u_spp_occlusion_opacity:new h.c1(a),u_spp_z_offset:new h.c1(a),u_spp_translate_rotation:new h.c2(a)}),background:a=>({u_matrix:new h.c3(a),u_emissive_strength:new h.c1(a),u_opacity:new h.c1(a),u_color:new h.dp(a)}),backgroundPattern:a=>({u_matrix:new h.c3(a),u_emissive_strength:new h.c1(a),u_opacity:new h.c1(a),u_image:new h.b$(a),u_pattern_tl:new h.c2(a),u_pattern_br:new h.c2(a),u_texsize:new h.c2(a),u_pattern_size:new h.c2(a),u_pixel_coord_upper:new h.c2(a),u_pixel_coord_lower:new h.c2(a),u_pattern_units_to_pixels:new h.c2(a)}),terrainRaster:a=>({u_matrix:new h.c3(a),u_image0:new h.b$(a),u_image1:new h.b$(a),u_skirt_height:new h.c1(a),u_ground_shadow_factor:new h.c0(a),u_emissive_texture_available:new h.c1(a)}),skybox:a=>({u_matrix:new h.c3(a),u_sun_direction:new h.c0(a),u_cubemap:new h.b$(a),u_opacity:new h.c1(a),u_temporal_offset:new h.c1(a)}),skyboxGradient:a=>({u_matrix:new h.c3(a),u_color_ramp:new h.b$(a),u_center_direction:new h.c0(a),u_radius:new h.c1(a),u_opacity:new h.c1(a),u_temporal_offset:new h.c1(a)}),skyboxCapture:a=>({u_matrix_3f:new h.dq(a),u_sun_direction:new h.c0(a),u_sun_intensity:new h.c1(a),u_color_tint_r:new h.cS(a),u_color_tint_m:new h.cS(a),u_luminance:new h.c1(a)}),globeRaster:a=>({u_proj_matrix:new h.c3(a),u_globe_matrix:new h.c3(a),u_normalize_matrix:new h.c3(a),u_merc_matrix:new h.c3(a),u_zoom_transition:new h.c1(a),u_merc_center:new h.c2(a),u_image0:new h.b$(a),u_image1:new h.b$(a),u_grid_matrix:new h.dq(a),u_skirt_height:new h.c1(a),u_far_z_cutoff:new h.c1(a),u_frustum_tl:new h.c0(a),u_frustum_tr:new h.c0(a),u_frustum_br:new h.c0(a),u_frustum_bl:new h.c0(a),u_globe_pos:new h.c0(a),u_globe_radius:new h.c1(a),u_viewport:new h.c2(a),u_emissive_texture_available:new h.c1(a)}),globeAtmosphere:a=>({u_frustum_tl:new h.c0(a),u_frustum_tr:new h.c0(a),u_frustum_br:new h.c0(a),u_frustum_bl:new h.c0(a),u_horizon:new h.c1(a),u_transition:new h.c1(a),u_fadeout_range:new h.c1(a),u_atmosphere_fog_color:new h.cS(a),u_high_color:new h.cS(a),u_space_color:new h.cS(a),u_temporal_offset:new h.c1(a),u_horizon_angle:new h.c1(a)}),model:a=>({u_matrix:new h.c3(a),u_lighting_matrix:new h.c3(a),u_normal_matrix:new h.c3(a),u_node_matrix:new h.c3(a),u_lightpos:new h.c0(a),u_lightintensity:new h.c1(a),u_lightcolor:new h.c0(a),u_camera_pos:new h.c0(a),u_opacity:new h.c1(a),u_baseColorFactor:new h.cS(a),u_emissiveFactor:new h.cS(a),u_metallicFactor:new h.c1(a),u_roughnessFactor:new h.c1(a),u_baseTextureIsAlpha:new h.b$(a),u_alph
vendor: 35,202 bytes, line 3063
3063aMask:new h.b$(a),u_alphaCutoff:new h.c1(a),u_baseColorTexture:new h.b$(a),u_metallicRoughnessTexture:new h.b$(a),u_normalTexture:new h.b$(a),u_occlusionTexture:new h.b$(a),u_emissionTexture:new h.b$(a),u_lutTexture:new h.b$(a),u_color_mix:new h.cS(a),u_aoIntensity:new h.c1(a),u_emissive_strength:new h.c1(a),u_occlusionTextureTransform:new h.cS(a),u_dithered_discard_threshold:new h.c1(a)}),modelDepth:a=>({u_matrix:new h.c3(a),u_instance:new h.c3(a),u_node_matrix:new h.c3(a)}),groundShadow:a=>({u_matrix:new h.c3(a),u_ground_shadow_factor:new h.c0(a)}),stars:a=>({u_matrix:new h.c3(a),u_up:new h.c0(a),u_right:new h.c0(a),u_intensity_multiplier:new h.c1(a)}),occlusion:a=>({u_matrix:new h.c3(a),u_anchorPos:new h.c0(a),u_screenSizePx:new h.c2(a),u_occluderSizePx:new h.c2(a),u_color:new h.cS(a)})};class Ps{constructor(t,o,c,d){this.id=Ps.uniqueIdxCounter,Ps.uniqueIdxCounter++,this.context=t;const m=t.gl;this.buffer=m.createBuffer(),this.dynamicDraw=!!c,this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),m.bufferData(m.ELEMENT_ARRAY_BUFFER,o.arrayBuffer,this.dynamicDraw?m.DYNAMIC_DRAW:m.STATIC_DRAW),this.dynamicDraw||d||o.destroy()}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(t){this.id=Ps.uniqueIdxCounter,Ps.uniqueIdxCounter++;const o=this.context.gl;this.context.unbindVAO(),this.bind(),o.bufferSubData(o.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}Ps.uniqueIdxCounter=0;const K_={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class pn{constructor(t,o,c,d,m,_){this.length=o.length,this.attributes=c,this.itemSize=o.bytesPerElement,this.dynamicDraw=d,this.instanceCount=_,this.context=t;const y=t.gl;this.buffer=y.createBuffer(),t.bindVertexBuffer.set(this.buffer),y.bufferData(y.ARRAY_BUFFER,o.arrayBuffer,this.dynamicDraw?y.DYNAMIC_DRAW:y.STATIC_DRAW),this.dynamicDraw||m||o.destroy()}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(t){const o=this.context.gl;this.bind(),o.bufferSubData(o.ARRAY_BUFFER,0,t.arrayBuffer)}enableAttributes(t,o){for(const c of this.attributes){const d=o.getAttributeLocation(t,c.name);d!==-1&&t.enableVertexAttribArray(d)}}setVertexAttribPointers(t,o,c){for(const d of this.attributes){const m=o.getAttributeLocation(t,d.name);if(m!==-1){const _=d.offset+this.itemSize*(c||0);d.type==="Float32"?t.vertexAttribPointer(m,d.components,t.FLOAT,!1,this.itemSize,_):t.vertexAttribIPointer(m,d.components,t[K_[d.type]],this.itemSize,_)}}}setVertexAttribDivisor(t,o,c){for(let d=0;d<this.attributes.length;d++){const m=o.getAttributeLocation(t,this.attributes[d].name);m!==-1&&this.instanceCount&&this.instanceCount>0&&t.vertexAttribDivisor(m,c)}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class Ds{constructor(t,o,c,d,m){this.context=t,this.width=o,this.height=c;const _=this.framebuffer=t.gl.createFramebuffer();d>0&&(this.colorAttachment0=new Lu(t,_,0)),d>1&&(this.colorAttachment1=new Lu(t,_,1)),m&&(this.depthAttachmentType=m,this.depthAttachment=m==="renderbuffer"?new pd(t,_):new J_(t,_))}static createWithTexture(t,o,c,d,m){const _=t.gl;if(t.activeTexture.set(_.TEXTURE1),t.viewport.set([0,0,c,d]),o&&o.width===c&&o.height===d)return _.bindTexture(_.TEXTURE_2D,o.colorAttachment0.get()),t.bindFramebuffer.set(o.framebuffer),o;o&&o.destroy();const y=t.extRenderToTextureHalfFloat||t.extColorBufferFloat?t.gl.RGBA16F:t.gl.RGBA8,v=new h.T(t,{width:c,height:d,data:null},y);v.bind(_.LINEAR,_.CLAMP_TO_EDGE);const T=t.createFramebuffer(c,d,1,null);if(T.format=y,T.colorAttachment0.set(v.texture),m){const I=t.createRenderbuffer(_.DEPTH24_STENCIL8,c,d);t.bindFramebuffer.set(T.framebuffer),_.framebufferRenderbuffer(_.FRAMEBUFFER,_.DEPTH_STENCIL_ATTACHMENT,_.RENDERBUFFER,I),T._stencilRbo=I}return T}createColorAttachment(t,o){o===0?this.colorAttachment0=new Lu(t,this.framebuffer,0):o===1&&(this.colorAttachment1=new Lu(t,this.framebuffer,1))}removeColorAttachment(t,o){const c=this.context.gl;let d;o===0?(d=this.colorAttachment0.get(),this.colorAttachment0=void 0):o===1&&(d=this.colorAttachment1.get(),this.colorAttachment1=void 0),d&&c.deleteTexture(d)}destroy(){const t=this.context.gl;if(this.colorAttachment0){const o=this.colorAttachment0.get();o&&t.deleteTexture(o)}if(this.colorAttachment1){const o=this.colorAttachment1.get();o&&t.deleteTexture(o)}if(this.depthAttachment&&this.depthAttachmentType)if(this.depthAttachmentType==="renderbuffer"){const o=this.depthAttachment.get();o&&t.deleteRenderbuffer(o)}else{const o=this.depthAttachment.get();o&&t.deleteTexture(o)}this._stencilRbo&&(t.deleteRenderbuffer(this._stencilRbo),this._stencilRbo=null),t.deleteFramebuffer(this.framebuffer)}}class Wr{constructor(t,o){this.gl=t,this._pendingPrograms=new Set,this._compileStats={precompiled:0,onDemand:0,totalStallMs:0,maxStallMs:0,framesMissed:0,stalls:[]},this.clearColor=new Ap(this),this.clearDepth=new Mp(this),this.clearStencil=new _l(this),this.colorMask=new $_(this),this.depthMask=new H_(this),this.stencilMask=new q_(this),this.stencilFunc=new Z_(this),this.stencilOp=new W_(this),this.stencilTest=new X_(this),this.depthRange=new sd(this),this.depthTest=new ad(this),this.depthFunc=new ld(this),this.blend=new gl(this),this.blendFunc=new Cp(this),this.blendColor=new Pp(this),this.blendEquation=new Dp(this),this.cullFace=new cd(this),this.cullFaceSide=new As(this),this.frontFace=new Du(this),this.program=new Ru(this),this.activeTexture=new Rp(this),this.viewport=new Ms(this),this.bindFramebuffer=new ud(this),this.bindRenderbuffer=new zu(this),this.bindTexture=new zp(this),this.bindVertexBuffer=new Lp(this),this.bindElementBuffer=new hd(this),this.bindVertexArrayOES=new dd(this),this.pixelStoreUnpack=new Y_(this),this.pixelStoreUnpackPremultiplyAlpha=new Op(this),this.pixelStoreUnpackFlipY=new Ec(this),this.options=o?Object.assign({},o):{},this.options.extTextureFilterAnisotropicForceOff||(this.extTextureFilterAnisotropic=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=t.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT))),this.extDebugRendererInfo=t.getExtension("WEBGL_debug_renderer_info"),this.extDebugRendererInfo&&(this.renderer=t.getParameter(this.extDebugRendererInfo.UNMASKED_RENDERER_WEBGL),this.vendor=t.getParameter(this.extDebugRendererInfo.UNMASKED_VENDOR_WEBGL)),this.forceManualRenderingForInstanceIDShaders=o&&!!o.forceManualRenderingForInstanceIDShaders||this.renderer&&this.renderer.includes("PowerVR"),this.disableSymbolUBO=o&&!!o.forceDisableSymbolUBO,this.options.extTextureFloatLinearForceOff||(this.extTextureFloatLinear=t.getExtension("OES_texture_float_linear")),this.extRenderToTextureHalfFloat=t.getExtension("EXT_color_buffer_half_float"),this.extColorBufferFloat=t.getExtension("EXT_color_buffer_float"),this.extTimerQuery=t.getExtension("EXT_disjoint_timer_query_webgl2"),this.maxTextureSize=t.getParameter(t.MAX_TEXTURE_SIZE),this.maxUniformBlockSize=Math.min(t.getParameter(t.MAX_UNIFORM_BLOCK_SIZE),32768),this.maxUniformBufferBindings=t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS),this.extBlendFuncExtended=t.getExtension("WEBGL_blend_func_extended"),this.extParallelShaderCompile=t.getExtension("KHR_parallel_shader_compile")}sweepPendingPrograms(){if(this._pendingPrograms.size!==0)for(const t of this._pendingPrograms)t.maybeFinalize()}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.bindVertexArrayOES.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(t,o,c){return new Ps(this,t,o,c)}createVertexBuffer(t,o,c,d,m){return new pn(this,t,o,c,d,m)}createRenderbuffer(t,o,c){const d=this.gl,m=d.createRenderbuffer();return this.bindRenderbuffer.set(m),d.renderbufferStorage(d.RENDERBUFFER,t,o,c),this.bindRenderbuffer.set(null),m}createFramebuffer(t,o,c,d){return new Ds(this,t,o,c,d)}clear({color:t,depth:o,stencil:c,colorMask:d}){const m=this.gl;let _=0;t&&(_|=m.COLOR_BUFFER_BIT,this.clearColor.set(t.toNonPremultipliedRenderColor(null)),this.colorMask.set(d||[!0,!0,!0,!0])),o!==void 0&&(_|=m.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(o),this.depthMask.set(!0)),c!==void 0&&(_|=m.STENCIL_BUFFER_BIT,this.clearStencil.set(c),this.stencilMask.set(255)),m.clear(_)}setCullFace(t){t.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(t.mode),this.frontFace.set(t.frontFace))}setDepthMode(t){t.func!==this.gl.ALWAYS||t.mask?(this.depthTest.set(!0),this.depthFunc.set(t.func),this.depthMask.set(t.mask),this.depthRange.set(t.range)):this.depthTest.set(!1)}setStencilMode(t){t.test.func!==this.gl.ALWAYS||t.mask?(this.stencilTest.set(!0),this.stencilMask.set(t.mask),this.stencilOp.set([t.fail,t.depthFail,t.pass]),this.stencilFunc.set({func:t.test.func,ref:t.ref,mask:t.test.mask})):this.stencilTest.set(!1)}setColorMode(t){h.b9(t.blendFunction,gt.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(t.blendFunction),this.blendColor.set(t.blendColor),t.blendEquation?this.blendEquation.set(t.blendEquation):this.blendEquation.setDefault()),this.colorMask.set(t.mask)}unbindVAO(){this.bindVertexArrayOES.set(null)}}let so;function Ad(a,t,o,c,d,m,_){const y=a.context,v=y.gl,T=a.transform,I=[h.aG(T.center.lng),h.aJ(T.center.lat)],P=o.layout.get("symbol-placement"),A=o.layout.get("text-variable-anchor"),D=o.layout.get("icon-rotation-alignment")==="map",O=o.layout.get("text-rotation-alignment")==="map",L=P!=="point",k=[];let N=0,H=0;for(let J=0;J<c.length;J++){const K=c[J],oe=t.getTile(K),de=oe.getBucket(o);if(!de)continue;const ue=de.getProjection().createInversionMatrix(T,K.canonical),ve=[],be=Fn(K,de,T),ke=!_&&D&&L,fe=_&&O&&L,Ee=A&&de.hasTextData(),pe=de.hasIconTextFit()&&Ee&&de.hasIconData(),Pe=ke||fe||_&&Ee||pe,Ce=de.projection.name==="globe",Re=Ce?h.ai(T.zoom):0;Ce&&(ve.push("PROJECTION_GLOBE_VIEW"),Pe&&ve.push("PROJECTED_POS_ON_VIEWPORT"));const Ye=a.getOrCreateProgram("collisionBox",{defines:ve});let qe=be;d[0]===0&&d[1]===0||(qe=a.translatePosMatrix(be,oe,d,m));const je=_?de.textCollisionBox:de.iconCollisionBox,Be=de.collisionCircleArray;if(Be.length>0){const ot=h.bd(),tt=qe;h.cB(ot,de.placementInvProjMatrix,T.glCoordMatrix),h.cB(ot,ot,de.placementViewportMatrix),k.push({circleArray:Be,circleOffset:H,transform:tt,invTransform:ot,projection:de.getProjection()}),N+=Be.length/4,H=N}if(!je)continue;a.terrain&&a.terrain.setupElevationDraw(oe,Ye);const at=Ce?[K.canonical.x,K.canonical.y,1<<K.canonical.z]:[0,0,0];Ye.draw(a,v.LINES,rt.disabled,pt.disabled,a.colorModeForRenderPass(),lt.disabled,Hp(qe,ue,T,Re,I,oe,at,de.getProjection()),o.id,je.layoutVertexBuffer,je.indexBuffer,je.segments,null,T.zoom,null,[je.collisionVertexBuffer,je.collisionVertexBufferExt])}if(!_||!k.length)return;const Z=a.getOrCreateProgram("collisionCircle"),G=new h.dS;G.resize(4*N),G._trim();let ne=0;for(const J of k)for(let K=0;K<J.circleArray.length/4;K++){const oe=4*K,de=J.circleArray[oe+0],ue=J.circleArray[oe+1],ve=J.circleArray[oe+2],be=J.circleArray[oe+3];G.emplace(ne++,de,ue,ve,be,0),G.emplace(ne++,de,ue,ve,be,1),G.emplace(ne++,de,ue,ve,be,2),G.emplace(ne++,de,ue,ve,be,3)}(!so||so.length<2*N)&&(so=(function(J){const K=2*J,oe=new h.dF;oe.resize(K),oe._trim();for(let de=0;de<K;de++){const ue=6*de;oe.uint16[ue+0]=4*de+0,oe.uint16[ue+1]=4*de+1,oe.uint16[ue+2]=4*de+2,oe.uint16[ue+3]=4*de+2,oe.uint16[ue+4]=4*de+3,oe.uint16[ue+5]=4*de+0}return oe})(N));const te=y.createIndexBuffer(so,!0),se=y.createVertexBuffer(G,h.dT.members,!0);for(const J of k){const K=qp(J.transform,J.invTransform,T,J.projection);Z.draw(a,v.TRIANGLES,rt.disabled,pt.disabled,a.colorModeForRenderPass(),lt.disabled,K,o.id,se,te,h.dB.simpleSegment(0,2*J.circleOffset,J.circleArray.length,J.circleArray.length/2),null,T.zoom)}se.destroy(),te.destroy()}const bl=h.bd();function Hu(a){const t=a._camera.getWorldToCamera(a.worldSize,1),o=h.aC([],t,a.globeMatrix);h.ba(o,o);const c=[0,0,0],d=[0,1,0,0];return h.aD(d,d,o),c[0]=d[0],c[1]=d[1],c[2]=d[2],h.ax(c,c),c}function Md({width:a,height:t,anchor:o,textOffset:c,textScale:d},m){const{horizontalAlign:_,verticalAlign:y}=h.bJ(o),v=-(_-.5)*a,T=-(y-.5)*t,I=h.bK(o,c);return new h.P((v/d+I[0])*m,(T/d+I[1])*m)}function Qp(a,t,o,c,d,m,_,y,v,T){const I=a.text.placedSymbolArray,P=a.text.dynamicLayoutVertexArray,A=a.icon.dynamicLayoutVertexArray,D={},O=a.getProjection(),L=Vr(_,O,d),k=d.elevation,N=O.upVectorScale(_.canonical,d.center.lat,d.worldSize).metersToTile;P.clear();for(let H=0;H<I.length;H++){const Z=I.get(H),{tileAnchorX:G,tileAnchorY:ne,numGlyphs:te}=Z,se=Z.hidden||!Z.crossTileID||a.allowVerticalPlacement&&!Z.placedOrientation?null:c[Z.crossTileID];if(se){let J=0,K=0,oe=0;const de=a.elevationType==="road";if(k||de){const Ce=de?a.getElevationFeatureForText(H):null,Re=h.bx.getAtTileOffset(_,new h.P(G,ne),k,Ce),[Ye,qe,je]=O.upVector(_.canonical,G,ne);J=Re*Ye*N,K=Re*qe*N,oe=Re*je*N}let[ue,ve,be,ke]=vi(Z.projectedAnchorX+J,Z.projectedAnchorY+K,Z.projectedAnchorZ+oe,o?L:m);const fe=pu(d.getCameraToCenterDistance(O),ke);let Ee=h.bn(a.textSizeData,v,Z)*fe/h.bC;o&&(Ee*=a.tilePixelRatio/y);const pe=Md(se,Ee);o?({x:ue,y:ve,z:be}=O.projectTilePoint(G+pe.x,ne+pe.y,_.canonical),[ue,ve,be]=vi(ue+J,ve+K,be+oe,m)):(t&&pe._rotate(-d.angle),ue+=pe.x,ve+=pe.y,be=0);const Pe=a.allowVerticalPlacement&&Z.placedOrientation===h.bm.vertical?Math.PI/2:0;for(let Ce=0;Ce<te;Ce++)h.bp(P,ue,ve,be,Pe);T&&Z.associatedIconIndex>=0&&(D[Z.associatedIconIndex]={x:ue,y:ve,z:be,angle:Pe})}else ll(te,P)}if(T){A.clear();const H=a.icon.placedSymbolArray;for(let Z=0;Z<H.length;Z++){const G=H.get(Z),{numGlyphs:ne}=G,te=D[Z];if(G.hidden||!te)ll(ne,A);else{const{x:se,y:J,z:K,angle:oe}=te;for(let de=0;de<ne;de++)h.bp(A,se,J,K,oe)}}a.icon.dynamicLayoutVertexBuffer.updateData(A)}a.text.dynamicLayoutVertexBuffer.updateData(P)}function ao(a,t,o,c,d,m,_={}){const y=o.paint.get("icon-translate"),v=o.paint.get("text-translate"),T=o.paint.get("icon-translate-anchor"),I=o.paint.get("text-translate-anchor"),P=o.layout.get("icon-rotation-alignment"),A=o.layout.get("text-rotation-alignment"),D=o.layout.get("icon-pitch-alignment"),O=o.layout.get("text-pitch-alignment"),L=o.layout.get("icon-keep-upright"),k=o.layout.get("text-keep-upright"),N=o.paint.get("icon-color-saturation"),H=o.paint.get("icon-color-contrast"),Z=o.paint.get("icon-color-brightness-min"),G=o.paint.get("icon-color-brightness-max"),ne=o.layout.get("symbol-elevation-reference")==="sea",te=o.layout.get("icon-image-use-theme")==="none",se=a.context,J=se.gl,K=a.transform,oe=P==="map",de=A==="map",ue=D==="map",ve=O==="map",be=o.layout.get("symbol-sort-key").constantOr(1)!==void 0;let ke=!1;const fe=a.depthModeForSublayer(0,rt.ReadOnly),Ee=new rt(a.context.gl.LEQUAL,rt.ReadOnly,a.depthRangeFor3D),pe=[h.aG(K.center.lng),h.aJ(K.center.lat)],Pe=o.layout.get("text-variable-anchor"),Ce=K.projection.name==="globe",Re=[],Ye=[0,-1,0];for(const qe of c){const je=t.getTile(qe),Be=je.getBucket(o);if(!Be||Be.projection.name==="mercator"&&Ce||Be.fullyClipped)continue;const at=Be.projection.name==="globe",ot=at?h.ai(K.zoom):0,tt=Vr(qe,Be.getProjection(),K),it=K.calculatePixelsToTileUnitsMatrix(je),ht=Pe&&Be.hasTextData(),xt=Be.hasIconTextFit()&&ht&&Be.hasIconData(),yt=Be.getProjection().createInversionMatrix(K,qe.canonical),St=(1<<je.tileID.canonical.z)*h.ak/a.transform.worldSize,_t=Qt=>{let vt=[0,0,0];if(Qt){const yi=a.style.directionalLight,li=a.style.ambientLight;yi&&li&&(vt=_a(a.style,yi,li))}return vt},Bt=Qt=>{if(a.context.disableSymbolUBO)return;Qt.push("USE_PAINT_PROPERTIES_UBO");const vt=Math.floor(a.context.maxUniformBlockSize/4),yi=Math.floor(vt/4);Qt.push(`MAX_UBO_SIZE_VEC4 ${yi}u`)},bt=Qt=>{K.depthOcclusionForSymbolsAndCircles&&(o.hasOcclusionOpacityProperties||a.terrain)&&(Qt.push("DEPTH_D24"),Qt.push("DEPTH_OCCLUSION"))},Vt=Qt=>{o.lut&&!te&&(o.lut.texture||(o.lut.texture=new h.dU(a.context,o.lut.image,[o.lut.image.height,o.lut.image.height,o.lut.image.height],se.gl.RGBA8)),se.activeTexture.set(se.gl.TEXTURE0+10),o.lut.texture&&o.lut.texture.bind(se.gl.LINEAR,se.gl.CLAMP_TO_EDGE),Qt.push("APPLY_LUT_ON_GPU"))},ii=()=>{const Qt=oe&&o.layout.get("symbol-placement")!=="point",vt=[];bt(vt),Vt(vt);const yi=Qt||xt,li=Be.elevationType==="road",Li=a.shadowRenderer,Nt=li&&ue&&!!Li&&Li.enabled,qi=_t(Nt),Ir=li&&ue&&!a.terrain?Ee:fe,sr=o.paint.get("icon-image-cross-fade");a.terrainRenderModeElevated()&&ue&&vt.push("PITCH_WITH_MAP_TERRAIN"),at&&(vt.push("PROJECTION_GLOBE_VIEW"),yi&&vt.push("PROJECTED_POS_ON_VIEWPORT")),sr>0&&Be.hasAnySecondaryIcon&&vt.push("ICON_TRANSITION"),!Be.icon.zOffsetVertexBuffer||li&&a.terrain||vt.push("Z_OFFSET"),N===0&&H===0&&Z===0&&G===1||vt.push("COLOR_ADJUSTMENT"),Be.sdfIcons&&vt.push("RENDER_SDF"),Nt&&vt.push("RENDER_SHADOWS","NORMAL_OFFSET"),li&&ue&&!a.terrain&&Be.icon.orientationVertexBuffer&&vt.push("ELEVATED_ROADS"),Bt(vt);const mr=se.disableSymbolUBO?Be.icon.programConfigurations.get(o.id):null,tr=a.getOrCreateProgram("symbol",{config:mr,defines:vt}),Jr=je.imageAtlasTexture?je.imageAtlasTexture.size:[0,0],Kr=Be.iconSizeData,Ki=h.bl(Kr,K.zoom),Fr=ue||!K.isOrthographic,Ht=Ji(tt,je.tileID.canonical,ue,oe,K,Be.getProjection(),it),ri=no(tt,je.tileID.canonical,ue,oe,K,Be.getProjection(),it),Xt=Be.icon.uboBinder&&Be.icon.uboBinder.cachedHeader&&256&Be.icon.uboBinder.cachedHeader.dataDrivenMask?[0,0]:y,Zi=a.translatePosMatrix(ri,je,Xt,T,!0),hr=a.translatePosMatrix(tt,je,Xt,T),zi=yi?bl:Ht,jr=oe&&!ue&&!Qt;let Gr=Ye;!Ce&&!K.mercatorFromTransition||oe||(Gr=Hu(K));const uo=at?Gr:Ye,yn=o.getColorAdjustmentMatrix(N,H,Z,G),Pn=Xp(Kr.kind,Ki,jr,ue,a,hr,zi,Zi,ne,!1,Jr,[0,0],0,qe,ot,pe,yt,uo,Be.getProjection(),qi,St,yn,sr,null),ls=je.imageAtlasTexture?je.imageAtlasTexture:null,ho=o.layout.get("icon-size").constantOr(0)!==1||Be.iconsNeedLinear,Gc=Be.sdfIcons||a.options.rotating||a.options.zooming||ho||Fr?J.LINEAR:J.NEAREST,Us=Be.sdfIcons&&o.paint.get("icon-halo-width").constantOr(1)!==0,za=a.terrain&&ue&&Qt?h.ba(h.bd(),Ht):bl;if(Qt&&Be.icon){const lf=h.bx.getAtTileOffsetFunc(qe,K.center.lat,K.worldSize,Be.getProjection()),cf=Bn(tt,je.tileID.canonical,ue,oe,K,Be.getProjection(),it),ch=o.layout.get("icon-size-scale-range"),xg=h.aB(a.scaleFactor,ch[0],ch[1]);al(Be,tt,a,!1,cf,ri,ue,L,lf,qe,xg)}return{program:tr,buffers:Be.icon,uniformValues:Pn,atlasTexture:ls,atlasTextureIcon:null,atlasInterpolation:Gc,atlasInterpolationIcon:null,isSDF:Be.sdfIcons,hasHalo:Us,depthMode:Ir,tile:je,renderWithShadows:Nt,labelPlaneMatrixInv:za}},oi=()=>{const Qt=de&&o.layout.get("symbol-placement")!=="point",vt=[],yi=Qt||Pe||xt,li=Be.elevationType==="road",Li=a.shadowRenderer,Nt=li&&ve&&!!Li&&Li.enabled,qi=_t(Nt),Ir=li&&ve&&!a.terrain?Ee:fe;a.terrainRenderModeElevated()&&ve&&vt.push("PITCH_WITH_MAP_TERRAIN"),at&&(vt.push("PROJECTION_GLOBE_VIEW"),yi&&vt.push("PROJECTED_POS_ON_VIEWPORT")),!Be.text.zOffsetVertexBuffer||li&&a.terrain||vt.push("Z_OFFSET"),Be.iconsInText&&vt.push("RENDER_TEXT_AND_SYMBOL"),vt.push("RENDER_SDF"),Nt&&vt.push("RENDER_SHADOWS","NORMAL_OFFSET"),li&&ve&&!a.terrain&&Be.text.orientationVertexBuffer&&vt.push("ELEVATED_ROADS"),bt(vt),Bt(vt);const sr=se.disableSymbolUBO?Be.text.programConfigurations.get(o.id):null,mr=a.getOrCreateProgram("symbol",{config:sr,defines:vt});let tr,Jr=[0,0],Kr=null;const Ki=Be.textSizeData;Be.iconsInText&&(Jr=je.imageAtlasTexture?je.imageAtlasTexture.size:[0,0],Kr=je.imageAtlasTexture?je.imageAtlasTexture:null,tr=ve||!K.isOrthographic||a.options.rotating||a.options.zooming||Ki.kind==="composite"||Ki.kind==="camera"?J.LINEAR:J.NEAREST);const Fr=je.glyphAtlasTexture?je.glyphAtlasTexture.size:[0,0],Ht=o.layout.get("text-size-scale-range"),ri=h.aB(a.scaleFactor,Ht[0],Ht[1]),Xt=h.bl(Ki,K.zoom,ri),Zi=Ji(tt,je.tileID.canonical,ve,de,K,Be.getProjection(),it),hr=no(tt,je.tileID.canonical,ve,de,K,Be.getProjection(),it),zi=Be.text.uboBinder&&Be.text.uboBinder.cachedHeader&&256&Be.text.uboBinder.cachedHeader.dataDrivenMask?[0,0]:v,jr=a.translatePosMatrix(hr,je,zi,I,!0),Gr=a.translatePosMatrix(tt,je,zi,I),uo=yi?bl:Zi,yn=de&&!ve&&!Qt;let Pn=Ye;!Ce&&!K.mercatorFromTransition||de||(Pn=Hu(K));const ls=Xp(Ki.kind,Xt,yn,ve,a,Gr,uo,jr,ne,!0,Fr,Jr,0,qe,ot,pe,yt,at?Pn:Ye,Be.getProjection(),qi,St,null,null,ri),ho=je.glyphAtlasTexture?je.glyphAtlasTexture:null,Gc=J.LINEAR,Us=o.paint.get("text-halo-width").constantOr(1)!==0,za=a.terrain&&ve&&Qt?h.ba(h.bd(),Zi):bl;if(Qt&&Be.text){const lf=h.bx.getAtTileOffsetFunc(qe,K.center.lat,K.worldSize,Be.getProjection()),cf=Bn(tt,je.tileID.canonical,ve,de,K,Be.getProjection(),it);al(Be,tt,a,!0,cf,hr,ve,k,lf,qe,ri)}return{program:mr,buffers:Be.text,uniformValues:ls,atlasTexture:ho,atlasTextureIcon:Kr,atlasInterpolation:Gc,atlasInterpolationIcon:tr,isSDF:!0,hasHalo:Us,depthMode:Ir,tile:je,renderWithShadows:Nt,labelPlaneMatrixInv:za}},si=Be.icon.segments.get().length,$t=Be.text.segments.get().length,It=si&&!_.onlyText?ii():null,At=$t&&!_.onlyIcons?oi():null,ai=o.paint.get("icon-opacity").constantOr(1),Ri=o.paint.get("text-opacity").constantOr(1);if(be&&Be.canOverlap){ke=!0;const Qt=ai&&!_.onlyText?Be.icon.segments.get():[],vt=Ri&&!_.onlyIcons?Be.text.segments.get():[];for(const yi of Qt)Re.push({segments:new h.dB([yi]),sortKey:yi.sortKey,state:It});for(const yi of vt)Re.push({segments:new h.dB([yi]),sortKey:yi.sortKey,state:At})}else _.onlyText||Re.push({segments:ai?Be.icon.segments:new h.dB([]),sortKey:0,state:It}),_.onlyIcons||Re.push({segments:Ri?Be.text.segments:new h.dB([]),sortKey:0,state:At})}ke&&Re.sort((qe,je)=>qe.sortKey-je.sortKey);for(const qe of Re){const je=qe.state;if(je)if(a.terrain?a.terrain.setupElevationDraw(je.tile,je.program,{useDepthForOcclusion:K.depthOcclusionForSymbolsAndCircles,labelPlaneMatrixInv:je.labelPlaneMatrixInv}):a.setupDepthForOcclusion(K.depthOcclusionForSymbolsAndCircles,je.program),se.activeTexture.set(J.TEXTURE0),je.atlasTexture&&je.atlasTexture.bind(je.atlasInterpolation,J.CLAMP_TO_EDGE,!0),je.atlasTextureIcon&&(se.activeTexture.set(J.TEXTURE1),je.atlasTextureIcon&&je.atlasTextureIcon.bind(je.atlasInterpolationIcon,J.CLAMP_TO_EDGE,!0)),je.renderWithShadows&&a.shadowRenderer.setupShadows(je.tile.tileID.toUnwrapped(),je.program,"vector-tile"),a.uploadCommonLightUniforms(a.context,je.program),je.hasHalo){const Be=je.uniformValues;Be.u_is_halo=1,Cd(je.buffers,qe.segments,o,a,je.program,je.depthMode,d,m,Be,2),Be.u_is_halo=0}else{if(je.isSDF){const Be=je.uniformValues;je.hasHalo&&(Be.u_is_halo=1,Cd(je.buffers,qe.segments,o,a,je.program,je.depthMode,d,m,Be,1)),Be.u_is_halo=0}Cd(je.buffers,qe.segments,o,a,je.program,je.depthMode,d,m,je.uniformValues,1)}}}function Cd(a,t,o,c,d,m,_,y,v,T){const I=c.context,P=I.gl,A=[a.dynamicLayoutVertexBuffer,a.opacityVertexBuffer,a.iconTransitioningVertexBuffer,a.globeExtVertexBuffer,a.zOffsetVertexBuffer,a.orientationVertexBuffer];a.featureIdBuffer&&A.push(a.featureIdBuffer);const D=a.uboBinder?null:a.programConfigurations.get(o.id);if(a.uboBinder){a.uboBinder.layer=o;const k=c.transform.zoom,N=c.style.getBrightness?c.style.getBrightness():null,H=a.uboBinder.getConstantUniformValues(k,N);v.u_spp_fill_np_color=H.fill_np_color,v.u_spp_halo_np_color=H.halo_np_color,v.u_spp_opacity=H.opacity,v.u_spp_halo_width=H.halo_width,v.u_spp_halo_blur=H.halo_blur,v.u_spp_emissive_strength=H.emissive_strength,v.u_spp_occlusion_opacity=H.occlusion_opacity,v.u_spp_z_offset=H.z_offset;const Z=o.paint.get(a.uboBinder.isText?"text-translate-anchor":"icon-translate-anchor"),G=a.uboBinder.cachedHeader&&256&a.uboBinder.cachedHeader.dataDrivenMask&&Z==="map"?c.transform.angle:0;v.u_spp_translate_rotation=[Math.cos(G),Math.sin(G)]}const{batchIndices:O,batchSegments:L}=a.getBatchGrouping(t);for(const k of O){const N=L.get(k);a.uboBinder&&a.uboBinder.bind(I,d.program,k),d.draw(c,P.TRIANGLES,m,_,y,lt.disabled,v,o.id,a.layoutVertexBuffer,a.indexBuffer,N,o.paint,c.transform.zoom,D,A,T)}}function Wt(a,t,o,c,d,m){const _=o.paint.get("line-width"),y=o.paint.get("line-emissive-strength").isConstant(),v=o.paint.get("line-emissive-strength").constantOr(0),T=o.paint.get("line-occlusion-opacity"),I=o.layout.get("line-elevation-reference"),P=o.layout.get("line-width-unit")==="meters",A=I==="sea",D=!(!a.terrain||!a.terrain.enabled),O=a.context,L=O.gl;if(o.hasElevatedBuckets&&a.transform.projection.name==="globe")return;const k=o.layout.get("line-cross-slope"),N=k!==void 0,H=k<1,Z=d||a.colorModeForDrapableLayerRenderPass(y?v:null),G=a.terrain&&a.terrain.renderingToTexture||m,ne=G?1:h.o.devicePixelRatio,te=o.paint.get("line-dasharray"),se=te.constantOr(1),J=o.layout.get("line-cap"),K=te.constantOr(null),oe=J.constantOr(null),de=o.paint.get("line-pattern"),ue=de.constantOr(1),ve=o.paint.get("line-pattern-cross-fade"),be=de.constantOr(null),ke=o.paint.get("line-opacity").constantOr(1);let fe=!ue&&ke!==1||a.depthOcclusion&&T>0&&T<1;const Ee=o.paint.get("line-gradient"),pe=ue?"linePattern":"line",Pe=h.dX(o);let Ce;if(G&&a.terrain&&a.terrain.clipOrMaskOverlapStencilType()&&(fe=!1),T!==0&&a.depthOcclusion){const Be=o.paint._values["line-opacity"];Be&&Be.value&&Be.value.kind==="constant"?Ce=Be.value:h.w(`Occlusion opacity for layer ${o.id} is supported only when line-opacity isn't data-driven.`)}_.value.kind!=="constant"&&_.value.isLineProgressConstant===!1&&Pe.push("VARIABLE_LINE_WIDTH"),a._debugParams.showElevationIdDebug&&Pe.push("DEBUG_ELEVATION_ID"),G&&(a.emissiveMode!=="dual-source-blending"||y?a.emissiveMode==="mrt-fallback"&&Pe.push("USE_MRT1"):Pe.push("DUAL_SOURCE_BLENDING"));const Re={},Ye=(Be,at,ot,tt,it,ht)=>{for(const xt of Be){const yt=t.getTile(xt);if(ue&&!yt.patternsLoaded())continue;const St=yt.getBucket(o);if(!St||St.elevationType!=="none"&&!it||St.elevationType==="none"&&it)continue;a.prepareDrawTile();const _t=[...at],Bt=a.shadowRenderer,bt=St.elevationType==="road"&&!!Bt&&Bt.enabled;let Vt=[0,0,0];if(bt){const Nt=a.style.directionalLight,qi=a.style.ambientLight;Nt&&qi&&(Vt=_a(a.style,Nt,qi)),_t.push("RENDER_SHADOWS","NORMAL_OFFSET")}const ii=St.programConfigurations.get(o.id);let oi=!1;if(be&&yt.imageAtlas){const Nt=h.dY.from(be),qi=Nt.getPrimary().scaleSelf(ne).toString(),Ir=yt.imageAtlas.patternPositions.get(qi),sr=Nt.getSecondary(),mr=sr?yt.imageAtlas.patternPositions.get(sr.scaleSelf(ne).toString()):null;oi=!!Ir&&!!mr,Ir&&ii.setConstantPatternPositions(Ir,mr)}ve>0&&(oi||ii.getPatternTransitionVertexBuffer("line-pattern"))&&_t.push("LINE_PATTERN_TRANSITION"),St.elevationGroundScaleVertexBuffer&&_t.push("ELEVATION_GROUND_SCALE");const si=a.isTileAffectedByFog(xt),$t=a.getOrCreateProgram(pe,{config:ii,defines:_t,overrideFog:si});if(!ue&&K&&oe&&yt.lineAtlas){const Nt=yt.lineAtlas.getDash(K,oe);Nt&&ii.setConstantPatternPositions(Nt)}bt&&Bt.setupShadows(yt.tileID.toUnwrapped(),$t,"vector-tile");let[It,At]=o.paint.get("line-trim-offset");(oe==="round"||oe==="square")&&It!==At&&(It===0&&(It-=1),At===1&&(At+=1));const ai=G?xt.projMatrix:null,Ri=P?1/St.tileToMeter/h.az(yt,1,a.transform.zoom):1,Qt=P?1/St.tileToMeter/h.az(yt,1,Math.floor(a.transform.zoom)):1,vt=se?o.paint._values["line-floorwidth"]:null;let yi;if(vt&&vt.value.kind==="constant"){const Nt=St.zoom;Nt in Re||(Re[Nt]=Math.max(.01,o.widthExpression().evaluate({zoom:Nt}))),yi=vt.value.value;const qi=Math.floor(a.transform.zoom);vt.value.value=Re[Nt]*Math.pow(2,qi-yt.tileID.overscaledZ)}const li=ue?h.dZ(a,yt,o,ai,ne,Ri,Qt,[It,At],Vt,ve):h.d_(a,yt,o,ai,St.lineClipsArray.length,ne,Ri,Qt,[It,At],Vt);if(Ee){const Nt=St.gradients[o.id];let qi=Nt.texture;if(o.gradientVersion!==Nt.version){let Ir=256;if(o.stepInterpolant){const sr=t.getSource().maxzoom,mr=xt.canonical.z===sr?Math.ceil(1<<a.transform.maxZoom-xt.canonical.z):1;Ir=h.aB(h.d$(St.maxLineLength/h.ak*1024*mr),256,O.maxTextureSize)}Nt.gradient=h.e0({expression:o.gradientExpression(),evaluationKey:"lineProgress",resolution:Ir,image:Nt.gradient||void 0,clips:St.lineClipsArray}),Nt.texture?Nt.texture.update(Nt.gradient):Nt.texture=new h.T(O,Nt.gradient,L.RGBA8),Nt.version=o.gradientVersion,qi=Nt.texture}O.activeTexture.set(L.TEXTURE1),qi.bind(o.stepInterpolant?L.NEAREST:L.LINEAR,L.CLAMP_TO_EDGE)}se&&(O.activeTexture.set(L.TEXTURE0),yt.lineAtlasTexture&&yt.lineAtlasTexture.bind(L.LINEAR,L.REPEAT),ii.updatePaintBuffers()),ue&&(O.activeTexture.set(L.TEXTURE0),yt.imageAtlasTexture&&yt.imageAtlasTexture.bind(L.LINEAR,L.CLAMP_TO_EDGE),ii.updatePaintBuffers()),it&&a.terrain.setupElevationDraw(yt,$t),a.uploadCommonUniforms(O,$t,xt.toUnwrapped());const Li=Nt=>{Ce!=null&&(Ce.value=ke*T),$t.draw(a,L.TRIANGLES,ot,Nt,Z,lt.disabled,li,o.id,St.layoutVertexBuffer,St.indexBuffer,St.segments,o.paint,a.transform.zoom,ii,[St.layoutVertexBuffer2,St.patternVertexBuffer,St.zOffsetVertexBuffer,St.elevationIdColVertexBuffer,St.elevationGroundScaleVertexBuffer]),Ce!=null&&(Ce.value=ke)};if(fe&&!it){const Nt=a.stencilModeForClipping(xt).ref;Nt===0&&G&&O.clear({stencil:0});const qi={func:L.EQUAL,mask:255};li.u_alpha_discard_threshold=.8,Li(new pt(qi,Nt,255,L.KEEP,L.KEEP,L.INVERT)),li.u_alpha_discard_threshold=0,Li(new pt(qi,Nt,255,L.KEEP,L.KEEP,L.KEEP))}else li.u_alpha_discard_threshold=fe&&it&&ht?.8:0,Li(it?tt:a.stencilModeForClipping(xt));yi!==void 0&&(vt.value.value=yi)}};let qe=a.depthModeForSublayer(0,rt.ReadOnly);const je=new rt(a.depthOcclusion?L.GREATER:L.LEQUAL,rt.ReadOnly,a.depthRangeFor3D);if(o.hasNonElevatedBuckets){const Be=!G&&a.terrain;T!==0&&Be?h.w(`Occlusion opacity for layer ${o.id} is supported on terrain only if the layer has line-z-offset enabled.`):Be?h.w(`Cannot render non-elevated lines in immediate mode when terrain is enabled. Layer: ${o.id}.`):Ye(c,Pe,qe,pt.disabled,!1,!0)}if(o.hasElevatedBuckets){I==="hd-road-markup"?D||(qe=je,Pe.push("ELEVATED_ROADS")):(Pe.push("ELEVATED"),qe=je,N&&Pe.push(H?"CROSS_SLOPE_HORIZONTAL":"CROSS_SLOPE_VERTICAL"),A&&Pe.push("ELEVATION_REFERENCE_SEA"));const Be=fe?a.stencilModeFor3D():pt.disabled;a.forceTerrainMode=!0,Ye(c,Pe,qe,Be,!0,!0),fe&&Ye(c,Pe,qe,Be,!0,!1),a.forceTerrainMode=!1}fe&&(a.resetStencilClippingMasks(),G&&O.clear({stencil:0})),T===0||a.depthOcclusion||G||a.layersWithOcclusionOpacity.push(a.currentLayer)}class Cc{destroy(){this.fbo&&(this.fbo.destroy(),this.fbo=null),this.drapeFbo&&(this.drapeFbo.destroy(),this.drapeFbo=null)}}class Pd{constructor(t){this.pbo=t.createBuffer(),this.sync=null,this.fboA=null,this.fboB=null,this.maxDensity=0}destroy(t){this.sync&&(t.deleteSync(this.sync),this.sync=null),t.deleteBuffer(this.pbo),this.fboA&&(this.fboA.destroy(),this.fboA=null),this.fboB&&(this.fboB.destroy(),this.fboB=null)}}const Pc={additive:{clearColor:new h.C(0,0,0,0),colorMode:gt.additiveAlphaWeighted,compositeUniformValue:1},multiply:{clearColor:new h.C(1,1,1,1),colorMode:gt.multiply,compositeUniformValue:0}};function Dc(a){return!(!a.extRenderToTextureHalfFloat&&!a.extColorBufferFloat)}function qu(a,t){return a==="additive"&&Dc(t)?gt.additiveAlphaWeightedUnboundedAlpha:Pc[a].colorMode}function Zu(a,t,o){const c=a.context,d=c.gl;let m=o.width,_=o.height,y=o.colorAttachment0.get();t.lineBlendDensityReadback||(t.lineBlendDensityReadback=new Pd(d));const v=t.lineBlendDensityReadback;let T=0,I=!0;for(;m>1||_>1;){const D=Math.max(1,Math.floor(m/2)),O=Math.max(1,Math.floor(_/2)),L=T===0?"fboA":"fboB";v[L]=Ds.createWithTexture(c,v[L],D,O,!1);const k=v[L];c.bindFramebuffer.set(k.framebuffer),c.viewport.set([0,0,D,O]),c.activeTexture.set(d.TEXTURE0),d.bindTexture(d.TEXTURE_2D,y),a.getOrCreateProgram("lineBlendReduce").draw(a,d.TRIANGLES,rt.disabled,pt.disabled,gt.unblended,lt.disabled,$p(0,[1/m,1/_],I),t.id,a.viewportBuffer,a.quadTriangleIndexBuffer,a.viewportSegments,t.paint,a.transform.zoom),m=D,_=O,y=k.colorAttachment0.get(),T=1-T,I=!1}const P=Dc(c),A=P?16:4;v.sync&&(d.deleteSync(v.sync),v.sync=null),d.bindBuffer(d.PIXEL_PACK_BUFFER,v.pbo),d.bufferData(d.PIXEL_PACK_BUFFER,A,d.STREAM_READ),d.readPixels(0,0,1,1,d.RGBA,P?d.FLOAT:d.UNSIGNED_BYTE,0),d.bindBuffer(d.PIXEL_PACK_BUFFER,null),v.sync=d.fenceSync(d.SYNC_GPU_COMMANDS_COMPLETE,0),c.viewport.set([0,0,a.width,a.height])}function Rs(a,t,o){if(!Dc(a.context))return;const c=t.lineBlendDensityReadback;c&&c.sync?((function(d,m,_){if(d.sync&&m.getSyncParameter(d.sync,m.SYNC_STATUS)===m.SIGNALED){if(m.deleteSync(d.sync),d.sync=null,m.bindBuffer(m.PIXEL_PACK_BUFFER,d.pbo),Dc(_)){const y=new Float32Array(4);m.getBufferSubData(m.PIXEL_PACK_BUFFER,0,y);const v=y[1];d.maxDensity=Math.max(2*(v>0?y[0]/v:0),1)}else d.maxDensity=1;m.bindBuffer(m.PIXEL_PACK_BUFFER,null)}})(c,a.context.gl,a.context),c.sync||(Zu(a,t,o),a.style.map.triggerRepaint())):(Zu(a,t,o),a.style.map.triggerRepaint())}function is(a,t,o,c,d,m){const _=a.context,y=_.gl,v=o==="additive"?1:t.paint.get("line-opacity").constantOr(1),T=o==="additive"?(function(P,A){const D=A.paint.get("line-blend-additive-clamp");if(D>0)return D;const O=A.lineBlendDensityReadback;return O&&O.maxDensity!==0?O.maxDensity:null})(0,t):1;if(T===null)return;_.bindFramebuffer.set(d),m&&_.viewport.set([0,0,m[0],m[1]]),_.activeTexture.set(y.TEXTURE0),y.bindTexture(y.TEXTURE_2D,c.colorAttachment0.get());const I=qu(o,a.context);a.getOrCreateProgram("lineBlendComposite").draw(a,y.TRIANGLES,rt.disabled,pt.disabled,I,lt.disabled,((P,A,D,O)=>({u_image:0,u_opacity:A,u_blend_mode:D,u_max_density:O}))(0,v,Pc[o].compositeUniformValue,T),t.id,a.viewportBuffer,a.quadTriangleIndexBuffer,a.viewportSegments,t.paint,a.transform.zoom)}function He(a,t){const o=1<<a.canonical.z,c=(t.x*o-a.canonical.x-a.wrap*o)*h.ak,d=(t.y*o-a.canonical.y)*h.ak,m=h.e1(t.z,t.y);return h.cU(c,d,m)}function Ze(a,t,o,c,d){if(!o.layout||o.layout.get("fill-elevation-reference")==="none"||o.paint.get("fill-opacity").constantOr(1)===0)return;
3063const m=a.context.gl,_=new rt(a.context.gl.LEQUAL,rt.ReadWrite,a.depthRangeFor3D),y=new rt(a.context.gl.GREATER,rt.ReadWrite,a.depthRangeFor3D),v=(function(D){let O=.01;return D.isOrthographic&&(O=h.aj(1e-4,O,h.cP(D.pitch>=Sn?1:D.pitch/Sn))),2*O})(a.transform),T=a.transform.getFreeCameraOptions().position,I="elevatedStructuresDepthReconstruct",P=a.getOrCreateProgram(I,{defines:["DEPTH_RECONSTRUCTION"]}),A=a.getOrCreateProgram(I);for(const D of c){const O=t.getTile(D),L=O.getBucket(o);if(!L)continue;const k=L.elevatedStructures;if(!k||!k.depthSegments)continue;const N=L.elevationBufferData.heightRange,H=He(D.toUnwrapped(),T),Z=a.translatePosMatrix(D.projMatrix,O,o.paint.get("fill-translate"),o.paint.get("fill-translate-anchor"));let G,ne,te,se;if(d==="initialize"){if(!N||N.min>=1||k.depthSegments.segments[0].primitiveLength===0)continue;G=vl(Z,H,v,1,0),ne=_,te=k.depthSegments,se=P}else if(d==="reset"){if(!N||N.min>=0||k.maskSegments.segments[0].primitiveLength===0)continue;G=vl(Z,H,0,0,1),ne=y,te=k.maskSegments,se=P}else if(d==="geometry"){if(k.depthSegments.segments[0].primitiveLength===0)continue;G=vl(Z,H,v,1,0),ne=_,te=k.depthSegments,se=A}se.draw(a,m.TRIANGLES,ne,pt.disabled,gt.disabled,lt.disabled,G,o.id,k.vertexBuffer,k.indexBuffer,te,o.paint,a.transform.zoom)}}function zs(a,t,o,c){const{painter:d,sourceCache:m,layer:_,coords:y,colorMode:v,elevationType:T,terrainEnabled:I,pass:P}=a,A=d.context.gl,D=_.paint.get("fill-pattern"),O=_.paint.get("fill-pattern-cross-fade"),L=D.constantOr(null);let k=T;T!=="road"||t&&!I||(k="none");const N=k==="road",H=a.painter.shadowRenderer,Z=N&&!!H&&H.enabled,G=new rt(d.context.gl.LEQUAL,rt.ReadOnly,d.depthRangeFor3D);let ne=[0,0,0];if(Z){const K=d.style.directionalLight,oe=d.style.ambientLight;K&&oe&&(ne=_a(d.style,K,oe))}const te=D&&D.constantOr(1),se=d.terrain&&d.terrain.renderingToTexture,J=(K,oe)=>{let de,ue,ve,be,ke;oe?(de=te&&!_.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",ve=A.LINES):(de=te?"fillPattern":"fill",ve=A.TRIANGLES);for(const fe of y){const Ee=m.getTile(fe);if(te&&!Ee.patternsLoaded())continue;const pe=Ee.getBucket(_);if(!pe)continue;const Pe=t?pe.elevationBufferData:pe.bufferData;if(Pe.isEmpty())continue;d.prepareDrawTile();const Ce=Pe.programConfigurations.get(_.id),Re=d.isTileAffectedByFog(fe),Ye=[],qe=[];N&&(Ye.push("ELEVATED_ROADS"),qe.push(Pe.elevatedLayoutVertexBuffer)),Z&&Ye.push("RENDER_SHADOWS","NORMAL_OFFSET"),se&&o&&Ye.push("USE_MRT1"),te&&(d.context.activeTexture.set(A.TEXTURE0),Ee.imageAtlasTexture&&Ee.imageAtlasTexture.bind(A.LINEAR,A.CLAMP_TO_EDGE),Ce.updatePaintBuffers());let je=!1;if(L&&Ee.imageAtlas){const it=Ee.imageAtlas,ht=h.dY.from(L),xt=ht.getPrimary().scaleSelf(h.o.devicePixelRatio).toString(),yt=ht.getSecondary(),St=it.patternPositions.get(xt),_t=yt?it.patternPositions.get(yt.scaleSelf(h.o.devicePixelRatio).toString()):null;je=!!St&&!!_t,St&&Ce.setConstantPatternPositions(St,_t)}O>0&&(je||Ce.getPatternTransitionVertexBuffer("fill-pattern"))&&Ye.push("FILL_PATTERN_TRANSITION");const Be=d.getOrCreateProgram(de,{config:Ce,overrideFog:Re,defines:Ye}),at=d.translatePosMatrix(fe.projMatrix,Ee,_.paint.get("fill-translate"),_.paint.get("fill-translate-anchor"));Z&&H.setupShadows(Ee.tileID.toUnwrapped(),Be,"vector-tile");const ot=_.paint.get("fill-emissive-strength");if(oe){be=Pe.lineIndexBuffer,ke=Pe.lineSegments;const it=d.terrain&&d.terrain.renderingToTexture?d.terrain.drapeBufferSize:[A.drawingBufferWidth,A.drawingBufferHeight];ue=de==="fillOutlinePattern"&&te?jp(at,ot,d,Ee,it,ne,O):Vp(at,ot,it,ne)}else be=Pe.indexBuffer,ke=Pe.triangleSegments,ue=te?vd(at,ot,d,Ee,ne,O):xd(at,ot,ne);d.uploadCommonUniforms(d.context,Be,fe.toUnwrapped());let tt=K;(T==="road"&&!I||T==="offset")&&(tt=G),Be.draw(d,ve,tt,c||d.stencilModeForClipping(fe),v,lt.disabled,ue,_.id,Pe.layoutVertexBuffer,be,ke,_.paint,d.transform.zoom,Ce,qe)}};d.renderPass===P&&J(d.depthModeForSublayer(1,d.renderPass==="opaque"?rt.ReadWrite:rt.ReadOnly),!1),k==="none"&&d.renderPass==="translucent"&&_.paint.get("fill-antialias")&&J(d.depthModeForSublayer(_.getPaintProperty("fill-outline-color")?2:0,rt.ReadOnly),!0)}const bi=new Float32Array(16);function he(a,t,o,c,d,m,_,y){o.resetLayerRenderingStats(a);const v=a.context,T=v.gl,I=a.transform,P=o.paint.get("fill-extrusion-pattern"),A=o.paint.get("fill-extrusion-pattern-cross-fade"),D=P.constantOr(null),O=P.constantOr(1),L=o.paint.get("fill-extrusion-opacity"),k=a.style.enable3dLights(),N=o.paint.get(k&&!O?"fill-extrusion-ambient-occlusion-wall-radius":"fill-extrusion-ambient-occlusion-radius"),H=[o.paint.get("fill-extrusion-ambient-occlusion-intensity"),N],Z=o.layout.get("fill-extrusion-edge-radius"),G=Z>0&&!o.paint.get("fill-extrusion-rounded-roof"),ne=G?0:Z,te=I.projection.name==="globe"?h.e4():0,se=I.projection.name==="globe",J=se?h.ai(I.zoom):0,K=[h.aG(I.center.lng),h.aJ(I.center.lat)],oe=o.paint.get("fill-extrusion-flood-light-color-use-theme").
vendor: 19,027 bytes, line 3063
3063constantOr("default")==="none",de=o.paint.get("fill-extrusion-flood-light-color").toNonPremultipliedRenderColor(oe?null:o.lut).toArray01().slice(0,3),ue=o.paint.get("fill-extrusion-flood-light-intensity"),ve=o.paint.get("fill-extrusion-vertical-scale"),be=o.paint.get("fill-extrusion-line-width").constantOr(1)!==0,ke=o.paint.get("fill-extrusion-height-alignment"),fe=o.paint.get("fill-extrusion-base-alignment"),Ee=In(a,o.paint.get("fill-extrusion-cutoff-fade-range")),pe=o.paint.get("fill-extrusion-front-cutoff"),Pe=wl(I.pitch,pe,!!a.terrain),Ce=Pe[2]<1;Ce&&(a.maxFrontCutoffRawStart=Math.max(a.maxFrontCutoffRawStart,pe[0]));const Re=[];let Ye;se&&Re.push("PROJECTION_GLOBE_VIEW"),H[0]>0&&Re.push("FAUX_AO"),G&&Re.push("ZERO_ROOF_RADIUS"),y&&Re.push("HAS_CENTROID"),ue>0&&Re.push("FLOOD_LIGHT"),Ee.shouldRenderCutoff&&Re.push("RENDER_CUTOFF"),Ce&&Re.push("RENDER_FRONT_CUTOFF"),be&&Re.push("RENDER_WALL_MODE");const qe=a.renderPass==="shadow",je=a.shadowRenderer,Be=qe&&!!je,at=qe?lt.disabled:lt.backCCW;a.shadowRenderer&&(a.shadowRenderer.useNormalOffset=!0);let ot=[0,0,0];if(je){const ht=a.style.directionalLight,xt=a.style.ambientLight;ht&&xt&&(ot=_a(a.style,ht,xt)),qe||(Re.push("RENDER_SHADOWS"),je.useNormalOffset&&Re.push("NORMAL_OFFSET")),Ye=Re.concat(["SHADOWS_SINGLE_CASCADE"])}const tt=Be?"fillExtrusionDepth":O?"fillExtrusionPattern":"fillExtrusion",it=o.getLayerRenderingStats();for(const ht of c){const xt=t.getTile(ht),yt=xt.getBucket(o);if(!yt||yt.projection.name!==I.projection.name)continue;let St=!1;je&&(St=je.getMaxCascadeForTile(ht.toUnwrapped())===0);const _t=a.isTileAffectedByFog(ht),Bt=yt.programConfigurations.get(o.id);let bt=!1;if(D&&xt.imageAtlas){const At=xt.imageAtlas,ai=h.dY.from(D),Ri=ai.getPrimary().scaleSelf(h.o.devicePixelRatio).toString(),Qt=ai.getSecondary(),vt=At.patternPositions.get(Ri),yi=Qt?At.patternPositions.get(Qt.scaleSelf(h.o.devicePixelRatio).toString()):null;bt=!!vt&&!!yi,vt&&Bt.setConstantPatternPositions(vt,yi)}A>0&&(bt||Bt.getPatternTransitionVertexBuffer("fill-extrusion-pattern"))&&Re.push("FILL_EXTRUSION_PATTERN_TRANSITION");const Vt=a.getOrCreateProgram(tt,{config:Bt,defines:St?Ye:Re,overrideFog:_t});if(a.terrain&&a.terrain.setupElevationDraw(xt,Vt,{useMeterToDem:!0}),!yt.centroidVertexBuffer){const At=Vt.getAttributeLocation(T,"a_centroid_pos");At!==-1&&T.vertexAttribI4ui(At,0,0,0,0)}!qe&&je&&je.setupShadows(xt.tileID.toUnwrapped(),Vt,"vector-tile"),O&&(a.context.activeTexture.set(T.TEXTURE0),xt.imageAtlasTexture&&xt.imageAtlasTexture.bind(T.LINEAR,T.CLAMP_TO_EDGE),Bt.updatePaintBuffers());const ii=o.paint.get("fill-extrusion-vertical-gradient"),oi=1/yt.tileToMeter;let si;if(qe&&je){if(im(xt.tileID,yt.maxHeight,a))continue;const At=je.calculateShadowPassMatrixFromTile(xt.tileID.toUnwrapped());si=Nu(At,ne,oi,ve,ke,fe)}else{const At=a.translatePosMatrix(ht.expandedProjMatrix,xt,o.paint.get("fill-extrusion-translate"),o.paint.get("fill-extrusion-translate-anchor")),ai=I.projection.createInversionMatrix(I,ht.canonical);si=O?Up(At,a,ii,L,H,ne,oi,ht,xt,te,ke,fe,J,K,ai,de,ve,A):ku(At,a,ii,L,H,ne,oi,ht,te,ke,fe,J,K,ai,de,ve,ue,ot,Pe)}a.uploadCommonUniforms(v,Vt,ht.toUnwrapped(),null,Ee);let $t=yt.segments;if(I.projection.name==="mercator"&&!qe&&($t=yt.getVisibleSegments(xt.tileID,a.terrain,a.transform.getFrustum(0)),!$t.get().length))continue;if(it)if(qe)for(const At of $t.get())it.numRenderedVerticesInShadowPass+=At.primitiveLength;else for(const At of $t.get())it.numRenderedVerticesInTransparentPass+=At.primitiveLength;const It=[];(a.terrain||y)&&It.push(yt.centroidVertexBuffer),se&&It.push(yt.layoutVertexExtBuffer),be&&It.push(yt.wallVertexBuffer),Vt.draw(a,v.gl.TRIANGLES,d,m,_,at,si,o.id,yt.layoutVertexBuffer,yt.indexBuffer,$t,o.paint,a.transform.zoom,Bt,It)}a.shadowRenderer&&(a.shadowRenderer.useNormalOffset=!1)}class Dd{constructor(){this.translate=[0,0],this.translateAnchor="map",this.edgeRadius=0,this.cutoffFadeRange=0}}function wl(a,t,o){if(!(t[2]<1)||o)return[0,0,1];const c=180*a/Math.PI;if(c<15)return[-.5,t[1],t[2]];const d=Math.min(1,Math.max(0,(c-15)/5)),m=d*d*(3-2*d);return[-.5*(1-m)+t[0]*m,t[1],t[2]]}function lo(a,t,o,c,d,m,_,y,v,T,I,P,A,D,O,L,k,N,H,Z,G){const ne=t.context,te=ne.gl,se=t.transform,J=t.transform.zoom,K=[],oe=a.translate,de=a.translateAnchor,ue=a.edgeRadius,ve=In(t,a.cutoffFadeRange);I==="clear"?(K.push("CLEAR_SUBPASS"),Z&&(K.push("CLEAR_FROM_TEXTURE"),ne.activeTexture.set(te.TEXTURE0),Z.bind(te.LINEAR,te.CLAMP_TO_EDGE))):I==="sdf"?K.push("SDF_SUBPASS"):I==="emissive"&&(K.push("USE_MRT1"),ne.activeTexture.set(te.TEXTURE0),Z.bind(te.LINEAR,te.CLAMP_TO_EDGE)),N&&K.push("HAS_CENTROID"),ve.shouldRenderCutoff&&K.push("RENDER_CUTOFF");const be=(ke,fe,Ee,pe,Pe)=>{let Ce=K;fe.groundRadiusBuffer!=null&&(Ce=K.concat("HAS_ATTRIBUTE_a_flood_light_ground_radius"));const Re=fe.programConfigurations.get(c.id),Ye=t.isTileAffectedByFog(ke),qe=t.getOrCreateProgram("fillExtrusionGroundEffect",{config:Re,defines:Ce,overrideFog:Ye}),je=((at,ot,tt,it,ht,xt,yt,St,_t,Bt,bt)=>({u_matrix:ot,u_opacity:tt,u_ao_pass:it?1:0,u_meter_to_tile:ht,u_ao:xt,u_flood_light_intensity:yt,u_flood_light_color:St,u_attenuation:_t,u_edge_radius:Bt,u_fb:0,u_fb_size:bt,u_dynamic_offset:1}))(0,pe,P,T,Pe,[A,D*Pe],O,L,k,J>=17?0:ue*Pe,Z?Z.size[0]:0),Be=[];N&&Be.push(fe.hiddenByLandmarkVertexBuffer),fe.groundRadiusBuffer!=null&&Be.push(fe.groundRadiusBuffer),t.uploadCommonUniforms(ne,qe,ke.toUnwrapped(),null,ve),qe.draw(t,ne.gl.TRIANGLES,m,_,y,v,je,c.id,fe.vertexBuffer,fe.indexBuffer,Ee,c.paint,J,Re,Be)};for(const ke of d){const fe=o.getTile(ke),Ee=fe.getBucket(c);if(!Ee||Ee.projection.name!==se.projection.name||!Ee.groundEffect||Ee.groundEffect&&!Ee.groundEffect.hasData())continue;const pe=Ee.groundEffect,Pe=1/Ee.tileToMeter;{const Ce=t.translatePosMatrix(ke.projMatrix,fe,oe,de),Re=pe.getDefaultSegment();be(ke,pe,Re,Ce,Pe)}if(H)for(let Ce=0;Ce<4;Ce++){const Re=h.e2[Ce](ke),Ye=o.getTile(Re);if(!Ye)continue;const qe=Ye.getBucket(c);if(!qe||qe.projection.name!==se.projection.name||!qe.groundEffect||qe.groundEffect&&!qe.groundEffect.hasData())continue;const je=qe.groundEffect;let Be,at;Ce===0?(Be=[-h.ak,0,0],at=1):Ce===1?(Be=[h.ak,0,0],at=0):Ce===2?(Be=[0,-h.ak,0],at=3):(Be=[0,h.ak,0],at=2);const ot=je.regionSegments[at];ot&&(h.bB(bi,ke.projMatrix,Be),be(ke,je,ot,t.translatePosMatrix(bi,fe,oe,de),Pe))}}}function Wu(a,t,o,c,d,m,_){c.centroidVertexArray.length===0&&c.createCentroidsBuffer();const y=m?m.findDEMTileFor(o):null;if(!(y&&y.dem||_))return;m&&y&&y.dem&&c.selfDEMTileTimestamp!==y.dem._timestamp&&(c.borderDoneWithNeighborZ=[-1,-1,-1,-1],c.selfDEMTileTimestamp=y.dem._timestamp);const v=(N,H)=>{(N.flags|H.flags)&h.e5?(N.flags|=h.e5,H.flags|=h.e5):(N.flags&=~h.e5,H.flags&=~h.e5)},T=N=>new h.P(Math.ceil((N+h.e6)*h.e7),0),I=(N,H,Z)=>{const G=Math.ceil((N+h.e6)*h.e7),ne=Math.floor(Math.max(0,Math.min(h.ak-1,Z))/4);return new h.P(G,ne<<5|(3&H)<<3|7)},P=N=>{const H=t.getSource().minzoom,Z=ne=>{const te=t.getTileByID(ne);if(te&&te.hasData())return te.getBucket(d)},G=[0,-1,1];for(const ne of G){if(N.overscaledZ+ne<H)continue;const te=Z(N.calculateScaledKey(N.overscaledZ+ne));if(te)return te}},A=[0,0,0],D=(N,H)=>(A[0]=Math.min(N.min.y,H.min.y),A[1]=Math.max(N.max.y,H.max.y),A[2]=h.ak-H.min.x>N.max.x?H.min.x-h.ak:N.max.x,A),O=(N,H)=>(A[0]=Math.min(N.min.x,H.min.x),A[1]=Math.max(N.max.x,H.max.x),A[2]=h.ak-H.min.y>N.max.y?H.min.y-h.ak:N.max.y,A),L=[(N,H)=>D(N,H),(N,H)=>D(H,N),(N,H)=>O(N,H),(N,H)=>O(H,N)],k=(N,H,Z,G,ne,te,se)=>{if(!m)return 0;const J=[[te?Z:N,te?N:Z,0],[te?Z:H,te?H:Z,0]],K=se<0?h.ak+se:se,oe=[te?K:(N+H)/2,te?(N+H)/2:K,0];return Z===0&&se<0||Z!==0&&se>0?m.getForTilePoints(ne,[oe],!0,G):J.push(oe),m.getForTilePoints(o,J,!0,y),Math.max(J[0][2],J[1][2],oe[2])/m.exaggeration()};for(let N=0;N<4;N++){const H=c.borderFeatureIndices[N];if(H.length===0)continue;const Z=h.e2[N](o),G=P(Z);if(!(G&&G instanceof h.e3))continue;const ne=m?m.findDEMTileFor(Z):null;if(!(ne&&ne.dem||_)||(m&&ne&&ne.dem&&c.borderDEMTileTimestamp[N]!==ne.dem._timestamp&&(c.borderDoneWithNeighborZ[N]=-1,c.borderDEMTileTimestamp[N]=ne.dem._timestamp),c.borderDoneWithNeighborZ[N]===G.canonical.z))continue;G.centroidVertexArray.length===0&&G.createCentroidsBuffer();const te=(N<2?1:5)-N,se=G.borderDoneWithNeighborZ[te]!==c.canonical.z,J=G.borderFeatureIndices[te];let K=0;if(c.canonical.z!==G.canonical.z){for(const ve of H)c.showCentroid(c.featuresOnBorder[ve]);if(se)for(const ve of J)G.showCentroid(G.featuresOnBorder[ve]);c.borderDoneWithNeighborZ[N]=G.canonical.z,G.borderDoneWithNeighborZ[te]=c.canonical.z;continue}const oe=new Map,de=new Set,ue=new Set;for(let ve=0;ve<J.length;ve++){const be=G.featuresOnBorder[J[ve]];be.buildingId!==void 0&&oe.set(be.buildingId,ve)}for(const ve of H){const be=c.featuresOnBorder[ve],ke=c.centroidData.get(be.centroidDataIndex);if(be.buildingId===void 0)continue;const fe=oe.get(be.buildingId);if(fe===void 0)continue;const Ee=G.featuresOnBorder[J[fe]],pe=G.centroidData.get(Ee.centroidDataIndex);de.add(ve),ue.add(fe),_&&v(ke,pe);const Pe=ke.groupCentroidPos.x!==0||ke.groupCentroidPos.y!==0?ke.groupCentroidPos:be.centroid(),Ce=pe.groupCentroidPos.x!==0||pe.groupCentroidPos.y!==0?pe.groupCentroidPos:Ee.centroid(),Re=N<2?Math.round((Pe.y+Ce.y)/2):Math.round((Pe.x+Ce.x)/2),Ye=be.intersectsCount()>1||Ee.intersectsCount()>1;{let qe=0;if(ne&&ne.dem&&!Ye){const je=L[N](ke,pe),Be=N%2?h.ak-1:0;qe=k(je[0],Math.min(h.ak-1,je[1]),Be,ne,Z,N<2,je[2])}ke.centroidXY=I(qe,N,Re),pe.centroidXY=I(qe,te,Re)}if(c.writeCentroidToBuffer(ke),G.writeCentroidToBuffer(pe),be.buildingId!==void 0){for(const qe of c.centroidData)qe.buildingId===be.buildingId&&qe!==ke&&(qe.centroidXY=ke.centroidXY,c.writeCentroidToBuffer(qe));for(const qe of G.centroidData)qe.buildingId===be.buildingId&&qe!==pe&&(qe.centroidXY=pe.centroidXY,G.writeCentroidToBuffer(qe))}}for(const ve of H){if(de.has(ve))continue;const be=c.featuresOnBorder[ve],ke=c.centroidData.get(be.centroidDataIndex),fe=be.borders[N];let Ee;for(;K<J.length;){if(ue.has(K)){K++;continue}Ee=G.featuresOnBorder[J[K]];const pe=Ee.borders[te];if(pe[1]>fe[0]+3||pe[0]>fe[0]-3)break;G.showCentroid(Ee),K++}if(Ee&&K<J.length){let pe=K,Pe=0;for(;;)if(ue.has(K)){if(++K===J.length)break;Ee=G.featuresOnBorder[J[K]]}else{if(Ee.borders[te][0]>fe[1]-3||(Pe++,++K===J.length))break;Ee=G.featuresOnBorder[J[K]]}for(;pe<J.length&&ue.has(pe);)pe++;if(pe>=J.length){c.showCentroid(be);continue}Ee=G.featuresOnBorder[J[pe]];let Ce=!1;if(Pe>=1){const qe=Ee.borders[te];Math.abs(fe[0]-qe[0])<3&&Math.abs(fe[1]-qe[1])<3&&(Pe=1,Ce=!0,K=pe+1)}else if(Pe===0){c.showCentroid(be);continue}const Re=G.centroidData.get(Ee.centroidDataIndex);_&&Ce&&v(ke,Re);const Ye=be.intersectsCount()>1||Ee.intersectsCount()>1;if(Pe>1)K=pe,ke.centroidXY=Re.centroidXY=new h.P(0,0);else if(ne&&ne.dem&&!Ye){const qe=L[N](ke,Re),je=N%2?h.ak-1:0,Be=k(qe[0],Math.min(h.ak-1,qe[1]),je,ne,Z,N<2,qe[2]);ke.centroidXY=Re.centroidXY=T(Be)}else Ye?ke.centroidXY=Re.centroidXY=new h.P(0,0):(ke.centroidXY=c.encodeBorderCentroid(be),Re.centroidXY=G.encodeBorderCentroid(Ee));c.writeCentroidToBuffer(ke),G.writeCentroidToBuffer(Re)}else c.showCentroid(be)}c.borderDoneWithNeighborZ[N]=G.canonical.z,G.borderDoneWithNeighborZ[te]=c.canonical.z}(c.needsCentroidUpdate||!c.centroidVertexBuffer&&c.centroidVertexArray.length!==0)&&c.uploadCentroid(a)}const em=[1,0,0],tm=[0,1,0],Tl=[0,0,1];function im(a,t,o){const c=o.transform,d=o.shadowRenderer;if(!d)return!0;const m=o.frameCounter,_=o.currentShadowCascade;let y=o._shadowCullCache;if(!y||y.frame!==m||y.cascade!==_){const N=c.tileSize*d._cascades[_].scale,H=c.scaleZoom(N),Z=d.shadowDirection,G=[Z[0],Z[1],-Z[2]],ne=[em,tm,Tl,G,[G[0],0,G[2]],[0,G[1],G[2]]];y={frame:m,cascade:_,cameraFrustum:h.cn.fromInvProjectionMatrix(c.invProjMatrix,c.worldSize,H,c.projection.name!=="globe"),edges:ne,shadowDir:G,ws:N,zoom:H},o._shadowCullCache=y}const{cameraFrustum:v,edges:T,shadowDir:I,ws:P,zoom:A}=y;let D=t;if(c.elevation){const N=c.elevation.getMinMaxForTile(a);N&&(D+=N.max)}D/=h.e8(c.center.lat,A);const O=d.computeSimplifiedTileShadowVolume(a.toUnwrapped(),D,P,I);if(!O)return!1;const{vertices:L,planes:k}=O;return v.intersectsPrecise(L,k,T)===0||d.getCurrentCascadeFrustum().intersectsPrecise(L,k,T)===0}const Q_=(a,t,o,c,d,m,_,y,v,T=[0,0,1])=>({u_matrix:a,u_normal_matrix:t,u_opacity:o,u_faux_facade_ao_intensity:c,u_camera_pos:d,u_tile_to_meter:m,u_facade_emissive_chance:_,u_flood_light_color:y,u_flood_light_intensity:v,u_front_cutoff_params:T}),rm=a=>({u_matrix:a}),Xu=a=>({u_matrix:a}),Yu=new Float32Array(16),wa=new Float32Array(16);function Rc(a){const{painter:t,source:o,layer:c,coords:d}=a;let m=a.defines;const _=t.context,y=t.renderPass==="shadow",v=t.renderPass==="light-beam",T=t.shadowRenderer,I=h.e8(t.transform.center.lat,t.transform.zoom),P=In(t,c.paint.get("building-cutoff-fade-range"));P.shouldRenderCutoff&&(m=m.concat("RENDER_CUTOFF"));const A=c.paint.get("building-front-cutoff"),D=A[2]<1&&!t.terrain,O=wl(t.transform.pitch,A,!!t.terrain);D&&(m=m.concat("RENDER_FRONT_CUTOFF"),t.maxFrontCutoffRawStart=Math.max(t.maxFrontCutoffRawStart,A[0])),a.floodLightIntensity>0&&(m=m.concat("FLOOD_LIGHT"));for(const L of d){const k=o.getTile(L),N=k.getBucket(c);if(!N)continue;T&&T.getMaxCascadeForTile(L.toUnwrapped())===0&&(m=m.concat("SHADOWS_SINGLE_CASCADE"));const H=N.programConfigurations.get(c.id);let Z,G;const ne=t.translatePosMatrix(L.expandedProjMatrix,k,[0,0],"map");h.cE(Yu,ne,[1,1,a.verticalScale]);const te=Yu;let se;if(y&&T){if(im(k.tileID,N.maxHeight*I,t))continue;const K=T.calculateShadowPassMatrixFromTile(k.tileID.toUnwrapped());h.cE(K,K,[1,1,a.verticalScale]),se=Xu(K),Z=G=t.getOrCreateProgram("buildingDepth",{config:H,defines:m,overrideFog:!1})}else if(v)Z=G=t.getOrCreateProgram("buildingBloom",{config:H,defines:m,overrideFog:!1}),se=rm(te);else{const K=t.transform.calculatePosMatrix(L.toUnwrapped(),t.transform.worldSize);h.cE(K,K,[1,1,a.verticalScale]),h.cE(wa,K,[1,-1,1/I]),h.ba(wa,wa),h.e9(wa,wa);const oe=wa,de=t.transform.getFreeCameraOptions().position,ue=1<<L.canonical.z;if(se=Q_(te,oe,a.opacity,a.facadeAOIntensity,[((de.x-L.wrap)*ue-L.canonical.x)*h.ak,(de.y*ue-L.canonical.y)*h.ak,de.z*ue*h.ak],N.tileToMeter,a.facadeEmissiveChance,a.floodLightColor,a.floodLightIntensity,O),G=t.getOrCreateProgram("building",{config:H,defines:m,overrideFog:!1}),a.depthOnly===!0)Z=G;else{const ve=m.concat(["BUILDING_FAUX_FACADE","HAS_ATTRIBUTE_a_faux_facade_color_emissive"]);Z=t.getOrCreateProgram("building",{config:H,defines:ve,overrideFog:!1})}T&&(T.setupShadowsFromMatrix(K,G,!0),Z!==G&&T.setupShadowsFromMatrix(K,Z,!0))}const J=(K,oe)=>{if(v){const de=K.entranceBloom;oe.draw(t,_.gl.TRIANGLES,a.depthMode,pt.disabled,a.blendMode,lt.disabled,se,c.id,de.layoutVertexBuffer,de.indexBuffer,de.segmentsBucket,c.paint,t.transform.zoom,H,[de.layoutAttenuationBuffer,de.layoutColorBuffer])}else{const de=K.segmentsBucket;let ue=[K.layoutNormalBuffer,K.layoutCentroidBuffer,K.layoutColorBuffer,K.layoutFloodLightDataBuffer];K.layoutFacadePaintBuffer&&(ue=ue.concat([K.layoutFacadeDataBuffer,K.layoutFacadeVerticalRangeBuffer,K.layoutFacadePaintBuffer])),oe.draw(t,_.gl.TRIANGLES,a.depthMode,pt.disabled,a.blendMode,y?lt.disabled:lt.backCW,se,c.id,K.layoutVertexBuffer,K.indexBuffer,de,c.paint,t.transform.zoom,H,ue)}};t.uploadCommonUniforms(_,G,L.toUnwrapped(),null,P),N.buildingWithoutFacade&&J(N.buildingWithoutFacade,G),N.buildingWithFacade&&(Z!==G&&t.uploadCommonUniforms(_,Z,L.toUnwrapped(),null,P),J(N.buildingWithFacade,Z))}}function zc(a,t,o,c,d,m,_,y,v,T,I,P,A,D){const O=a.context.gl,L=a.depthModeForSublayer(1,rt.ReadOnly,O.LEQUAL,!0),k=.1*(1-(N=I))+3*N;var N;const H=a._showOverdrawInspector,Z=P,G=new Dd;H||lo(G,a,t,o,c,L,new pt({func:O.ALWAYS,mask:255},255,255,O.KEEP,O.KEEP,O.REPLACE),new gt([O.ONE,O.ONE,O.ONE,O.ONE],h.C.transparent,[!1,!1,!1,!0],O.MIN),lt.disabled,d,"sdf",m,_,y,v,T,k,Z,!1,void 0);{const ne=H?pt.disabled:new pt({func:O.EQUAL,mask:255},255,255,O.KEEP,O.DECR,O.DECR),te=H?a.colorModeForRenderPass():new gt([O.ONE_MINUS_DST_ALPHA,O.DST_ALPHA,O.ONE,O.ONE],h.C.transparent,[!0,!0,!0,!0]);lo(G,a,t,o,c,L,ne,te,lt.disabled,d,"color",m,_,y,v,T,k,Z,!1,void 0)}}const Co=.05,Rd=(a,t,o,c,d,m,_,y,v,T,I,P)=>({u_matrix:a,u_normalize_matrix:t,u_globe_matrix:o,u_merc_matrix:c,u_grid_matrix:d,u_tl_parent:m,u_scale_parent:T,u_fade_t:I.mix,u_opacity:I.opacity,u_image0:0,u_image1:1,u_raster_elevation:P,u_zoom_transition:_,u_merc_center:y,u_cutoff_params:v}),nm=(a,t,o,c,d,m,_,y,v,T)=>({u_particle_texture:a,u_particle_texture_side_len:t,u_tile_offset:o,u_velocity:c,u_color_ramp:m,u_velocity_res:d,u_max_speed:_,u_uv_offset:y,u_data_scale:[255*v[0],255*v[1]],u_data_offset:T,u_particle_pos_scale:1.1,u_particle_pos_offset:[Co,Co]}),om=(a,t,o,c,d,m,_,y,v,T)=>({u_particle_texture:a,u_particle_texture_side_len:t,u_velocity:o,u_velocity_res:c,u_max_speed:d,u_speed_factor:m,u_reset_rate:_,u_rand_seed:Math.random(),u_uv_offset:y,u_data_scale:[255*v[0],255*v[1]],u_data_offset:T,u_particle_pos_scale:1.1,u_particle_pos_offset:[Co,Co]});var sm=h.ea([{name:"a_index",type:"Int16",components:1}]);class am{constructor(t,o,c,d){const m={width:c[0],height:c[1],data:null},_=t.gl;this.targetColorTexture=new h.T(t,m,_.RGBA8,{useMipmap:!1}),this.backgroundColorTexture=new h.T(t,m,_.RGBA8,{useMipmap:!1}),this.context=t,this.updateParticleTexture(o,d),this.lastInvalidatedAt=0}updateParticleTexture(t,o){if(this.particleTextureDimension===o.width)return;(this.particleTexture0||this.particleTexture1||this.particleIndexBuffer||this.particleSegment)&&(this.particleTexture0.destroy(),this.particleTexture1.destroy(),this.particleIndexBuffer.destroy(),this.particleSegment.destroy());const c=this.context.gl,d=o.width*o.height;this.particleTexture0=new h.T(this.context,o,c.RGBA8,{premultiply:!1,useMipmap:!1}),this.particleTexture1=new h.T(this.context,o,c.RGBA8,{premultiply:!1,useMipmap:!1});const m=new h.eb;m.reserve(d);for(let _=0;_<d;_++)m.emplaceBack(_);this.particleIndexBuffer=this.context.createVertexBuffer(m,sm.members,!0),this.particleSegment=h.dB.simpleSegment(0,0,this.particleIndexBuffer.length,0),this.particleTextureDimension=o.width}update(t){return!(this.lastInvalidatedAt<t&&(this.lastInvalidatedAt=h.o.now(),1))}destroy(){this.targetColorTexture.destroy(),this.backgroundColorTexture.destroy(),this.particleIndexBuffer.destroy(),this.particleTexture0.destroy(),this.particleTexture1.destroy(),this.particleSegment.destroy()}}function lm(a,t,o){if(!a)return null;const c=t.getTextureDescriptor(a,o,!0);if(!c)return null;let{texture:d,mix:m,offset:_,tileSize:y,buffer:v,format:T}=c;if(!d||!T)return null;let I=!1;return T==="uint32"&&(I=!0,m[3]=0,m=Vu(h.ec,m,[0,o.paint.get("raster-particle-max-speed")]),_=Td(h.ec,_,[0,o.paint.get("raster-particle-max-speed")])),{texture:d,textureOffset:[v/(y+2*v),y/(y+2*v)],tileSize:y,scalarData:I,scale:m,offset:_,defines:["RASTER_ARRAY",{uint8:"DATA_FORMAT_UINT8",uint16:"DATA_FORMAT_UINT16",uint32:"DATA_FORMAT_UINT32"}[T]]}}function eg(a){const t=a._nearZ,o=a.projection.farthestPixelDistance(a),c=o-t,d=.2*a.height,m=t+d;
3063return[t,o,(m-d-t)/c,(m-t)/c]}var zd=`#ifdef RASTER_ARRAY 3064uniform sampler2D u_velocity;uniform mediump vec2 u_velocity_res;uniform mediump float u_max_speed;const vec4 NO_DATA=vec4(1);const vec2 INVALID_VELOCITY=vec2(-1);uniform highp vec2 u_uv_offset;uniform highp float u_data_offset;uniform highp vec2 u_data_scale;ivec4 rasterArrayLinearCoord(highp vec2 texCoord,highp vec2 texResolution,out highp vec2 fxy) {texCoord=texCoord*texResolution-0.5;fxy=fract(texCoord);texCoord-=fxy;return ivec4(texCoord.xxyy+vec2(1.5,0.5).xyxy);}highp vec2 lookup_velocity(highp vec2 uv) {uv=u_uv_offset.x+u_uv_offset.y*uv;highp vec2 fxy;ivec4 c=rasterArrayLinearCoord(uv,u_velocity_res,fxy);highp vec4 tl=texelFetch(u_velocity,c.yz,0);highp vec4 tr=texelFetch(u_velocity,c.xz,0);highp vec4 bl=texelFetch(u_velocity,c.yw,0);highp vec4 br=texelFetch(u_velocity,c.xw,0);if (tl==NO_DATA) {return INVALID_VELOCITY;}if (tr==NO_DATA) {return INVALID_VELOCITY;}if (bl==NO_DATA) {return INVALID_VELOCITY;}if (br==NO_DATA) {return INVALID_VELOCITY;}highp vec4 t=mix(mix(bl,br,fxy.x),mix(tl,tr,fxy.x),fxy.y);highp vec2 velocity=u_data_offset+vec2(dot(t.rg,u_data_scale),dot(t.ba,u_data_scale));velocity.y=-velocity.y;velocity/=max(u_max_speed,length(velocity));return velocity;} 3065#endif 3066uniform highp float u_particle_pos_scale;uniform highp vec2 u_particle_pos_offset;highp vec4 pack_pos_to_rgba(highp vec2 p) {highp vec2 v=(p+u_particle_pos_offset)/u_particle_pos_scale;highp vec4 r=vec4(v.x,fract(v.x*255.0),v.y,fract(v.y*255.0));return vec4(r.x-r.y/255.0,r.y,r.z-r.w/255.0,r.w);}highp vec2 unpack_pos_from_rgba(highp vec4 v) {v=floor(v*255.0+0.5)/255.0;highp vec2 p=vec2(v.x+(v.y/255.0),v.z+(v.w/255.0));return u_particle_pos_scale*p-u_particle_pos_offset;}`;fl["_prelude_raster_particle.glsl"]||(fl["_prelude_raster_particle.glsl"]=zd);var tg={building:Ft(`#include "_prelude_fog.fragment.glsl" 3067#include "_prelude_shadow.fragment.glsl" 3068#include "_prelude_lighting.glsl" 3069const float window_depth=0.5;const float ao_radius=0.2;in vec4 v_color;in highp vec3 v_normal;in highp vec3 v_pos; 3070#ifdef RENDER_FRONT_CUTOFF 3071in float v_front_cutoff_opacity; 3072#endif 3073#ifdef INDICATOR_CUTOUT 3074#ifdef FEATURE_CUTOUT 3075in vec4 v_ground_roof; 3076#endif 3077#endif 3078#ifdef BUILDING_FAUX_FACADE 3079in lowp float v_faux_facade;in highp float v_faux_facade_ed;in highp vec2 v_faux_facade_window;in highp vec2 v_faux_facade_floor;in highp vec2 v_faux_facade_range;in highp float v_aspect;in highp vec3 v_tbn_0;in highp vec3 v_tbn_1;in highp vec3 v_tbn_2;in highp vec4 v_faux_color_emissive;uniform float u_faux_facade_ao_intensity; 3080#endif 3081#ifdef RENDER_SHADOWS 3082in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1; 3083#endif 3084#ifdef FLOOD_LIGHT 3085in highp float v_flood_radius;in float v_has_flood_light; 3086#endif 3087uniform lowp float u_opacity;uniform vec3 u_camera_pos;uniform highp float u_tile_to_meter;uniform float u_facade_emissive_chance;uniform vec3 u_flood_light_color;uniform float u_flood_light_intensity;vec3 linearTosRGB(in vec3 color) {return pow(color,vec3(1./2.2));} 3088#ifdef BUILDING_FAUX_FACADE 3089highp float hash12(in highp vec2 p) {highp vec3 p3 =fract(vec3(p.xyx)*0.1031);p3+=dot(p3,p3.yzx+33.33);return fract((p3.x+p3.y)*p3.z);}float min3(in vec3 v) {return min(min(v.x,v.y),v.z);}highp vec2 get_uv_mask_id(in highp vec2 q,out highp float mask,out highp vec2 id) {highp vec2 p=q;mask=step(v_faux_facade_range.x,p.y)*step(p.y,v_faux_facade_range.y);p.y=p.y-v_faux_facade_range.x;highp vec2 uv=modf(p/v_faux_facade_floor,id);highp vec4 d=(v_faux_facade_floor.xyxy+vec4(-v_faux_facade_window,v_faux_facade_window))*0.5;highp vec4 edge=d/v_faux_facade_floor.xyxy;highp vec2 m=step(edge.xy,uv)*step(uv,edge.zw);mask*=m.x*m.y;uv-=vec2(0.5);uv*=vec2(0.5)/(vec2(0.5)-edge.xy);uv+=vec2(0.5);return uv;}highp float ray_unit_box(in highp vec3 ray_o,in highp vec3 ray_d,in highp vec3 bmin,in highp vec3 bmax) {highp vec3 planes=mix(bmin,bmax,step(0.0,ray_d));highp vec3 t=(planes-ray_o)/ray_d;return min3(t);}float get_emissive(in vec2 id) {if (u_facade_emissive_chance > 0.0) {return (step(hash12(id),u_facade_emissive_chance)+0.05)*v_faux_color_emissive.a;}return 0.0;}vec3 get_shade_info(in highp vec3 v,in highp vec3 v_normalized,in vec3 color,in vec2 id,in mat3 tbn,inout vec3 out_normal,inout float out_emissive) {vec3 out_color=color;highp vec3 abs_v=abs(v_normalized);bool x_major=abs_v.x >=abs_v.y && abs_v.x >=abs_v.z;bool y_major=abs_v.y >=abs_v.x && abs_v.y >=abs_v.z;bool z_major=abs_v.z >=abs_v.x && abs_v.z >=abs_v.y; 3090#if 0 3091if (x_major) {out_color=v.x > 0.0 ? vec3(1.0,0.0,0.0) : vec3(0.0,1.0,1.0);} else if (y_major) {out_color=v.y > 0.0 ? vec3(0.0,1.0,0.0) : vec3(1.0,0.0,1.0);} else if (z_major) {out_color=v.z > 0.0 ? vec3(0.0,0.0,1.0) : vec3(1.0,1.0,0.0);}out_emissive=1.0; 3092#else 3093if (x_major) {out_normal=-sign(v.x)*tbn[0];} else if (y_major) {out_normal=vec3(0.0,0.0,-sign(v.y));} else if (z_major) {out_color=v_faux_color_emissive.rgb;
3093out_emissive=v.z <=0.0 ? get_emissive(id) : out_emissive;}float ao=1.0;if (u_faux_facade_ao_intensity > 0.0) {vec4 ao_range=v_faux_facade_window.xxyy*0.5-vec4(0,ao_radius,0,ao_radius);vec2 ao_range_z=vec2(window_depth*0.5)-vec2(0.0,ao_radius);if (x_major || y_major) {ao*=smoothstep(-ao_range_z.x,-ao_range_z.y,v.z);} else if (z_major) {ao*=smoothstep(-ao_range.x,-ao_range.y,v.x)*(1.0-smoothstep(ao_range.y,ao_range.x,v.x));ao*=smoothstep(-ao_range.z,-ao_range.w,v.y)*(1.0-smoothstep(ao_range.w,ao_range.z,v.y));}ao=mix(1.0,min(1.0,ao+0.25),u_faux_facade_ao_intensity);}out_color*=ao; 3094#endif 3095return out_color;} 3096#endif 3097vec3 apply_lighting_linear(in vec3 color,in vec3 normal,in float dir_factor) {float ambient_directional_factor=calculate_ambient_directional_factor(normal);vec3 ambient_contrib=ambient_directional_factor*u_lighting_ambient_color;vec3 directional_contrib=u_lighting_directional_color*dir_factor;return color*(ambient_contrib+directional_contrib);}void main() {vec3 normal=normalize(v_normal);vec3 base_color=v_color.rgb;float emissive=v_color.a; 3098#ifdef BUILDING_FAUX_FACADE 3099if (v_faux_facade > 0.0) {highp mat3 tbn=mat3(v_tbn_0,v_tbn_1,v_tbn_2);highp vec3 v=vec3(v_pos.xy,v_pos.z/u_tile_to_meter)-u_camera_pos;highp vec3 view_tangent=transpose(tbn)*v;highp vec2 q=vec2(v_faux_facade_ed,v_pos.z);float mask=0.0;vec2 id=vec2(0.0);highp vec2 uv=get_uv_mask_id(q,mask,id);uv*=v_faux_facade_window;highp vec3 bmin=vec3(0.0,0.0,-window_depth);highp vec3 bmax=bmin+vec3(v_faux_facade_window,window_depth);highp vec3 ray_o=vec3(uv,0.0);highp vec3 ray_d=normalize(view_tangent);highp float t_min=ray_unit_box(ray_o,ray_d,bmin,bmax);highp vec3 hit=ray_o+t_min*ray_d;highp vec3 r=vec3(v_faux_facade_window,-window_depth);hit-=r*0.5;highp vec3 normalized=hit/r;vec3 out_normal=normal;float out_emissive=emissive;vec3 room_color=get_shade_info(hit,normalized,base_color,id,tbn,out_normal,out_emissive);base_color=mix(base_color,room_color,mask);normal=mix(normal,out_normal,mask);emissive=mix(emissive,out_emissive,mask);} 3100#endif 3101vec4 color=vec4(base_color,1.0);vec3 xy_flipped_normal=vec3(-normal.xy,normal.z);float shadowed_lighting_factor=0.0; 3102#ifdef RENDER_SHADOWS 3103#ifdef RENDER_CUTOFF 3104shadowed_lighting_factor=shadowed_light_factor_normal_opacity(xy_flipped_normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w,v_cutoff_opacity);if (v_cutoff_opacity==0.0) {discard;} 3105#else 3106shadowed_lighting_factor=shadowed_light_factor_normal(xy_flipped_normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w); 3107#endif 3108#else 3109shadowed_lighting_factor=max(0.0,dot(xy_flipped_normal,u_lighting_directional_dir)); 3110#endif 3111color.rgb=apply_lighting_linear(color.rgb,xy_flipped_normal,shadowed_lighting_factor);color.rgb=linearTosRGB(color.rgb); 3112#ifdef FLOOD_LIGHT 3113float flood_radiance=(1.0-min(v_pos.z/v_flood_radius,1.0))*u_flood_light_intensity*v_has_flood_light;color.rgb=mix(color.rgb,u_flood_light_color,flood_radiance); 3114#endif 3115color.rgb=mix(color.rgb,linearTosRGB(base_color.rgb),emissive); 3116#ifdef FOG 3117color=fog_dither(fog_apply_premultiplied(color,v_fog_pos,v_pos.z)); 3118#endif 3119color*=u_opacity; 3120#ifdef INDICATOR_CUTOUT 3121#ifdef FEATURE_CUTOUT 3122{float ditherOpacity=cutoutGroundRoofOpacity(v_ground_roof);if (ditherOpacity < 1.0) {int index=(int(gl_FragCoord.x) % 4)*4+(int(gl_FragCoord.y) % 4);if (ditherOpacity < DITHER_THRESHOLDS[index]) {discard;}}} 3123#else 3124color=applyCutout(color,v_pos.z); 3125#endif 3126#endif 3127#ifdef RENDER_FRONT_CUTOFF 3128if (v_front_cutoff_opacity < 1.0) {int index=(int(gl_FragCoord.x) % 4)*4+(int(gl_FragCoord.y) % 4);if (v_front_cutoff_opacity < DITHER_THRESHOLDS[index]) {discard;}} 3129#endif 3130#ifdef FEATURE_CUTOUT 3131color=apply_feature_cutout(color,gl_FragCoord,get_cutout_factors(gl_FragCoord).x); 3132#endif 3133glFragColor=color; 3134#ifdef DEBUG_SHOW_NORMALS 3135color.rgb=xy_flipped_normal*0.5+vec3(0.5,0.5,0.5);color.a=1.0;glFragColor=color; 3136#endif 3137#ifdef OVERDRAW_INSPECTOR 3138glFragColor=vec4(1.0); 3139#endif 3140HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 3141#include "_prelude_shadow.vertex.glsl" 3142in vec3 a_pos_3f;in ivec4 a_normal_3;in ivec4 a_centroid_3; 3143#ifdef FLOOD_LIGHT 3144in int a_flood_light_wall_radius_1i16; 3145#endif 3146#ifdef BUILDING_FAUX_FACADE 3147in uvec4 a_faux_facade_data;in uvec2 a_faux_facade_vertical_range; 3148#endif 3149uniform mat4 u_matrix;uniform mat4 u_normal_matrix;uniform highp float u_tile_to_meter; 3150#ifdef RENDER_FRONT_CUTOFF 3151uniform vec3 u_front_cutoff_params;out float v_front_cutoff_opacity; 3152#endif 3153#ifdef INDICATOR_CUTOUT 3154#ifdef FEATURE_CUTOUT 3155out vec4 v_ground_roof; 3156#endif 3157#endif 3158out vec4 v_color;out vec3 v_normal;out highp vec3 v_pos; 3159#ifdef BUILDING_FAUX_FACADE 3160out lowp float v_faux_facade;out highp float v_faux_facade_ed;out highp vec2 v_faux_facade_window;out highp vec2 v_faux_facade_floor;out highp vec2 v_faux_facade_range;out highp float v_aspect;out highp vec3 v_tbn_0;out highp vec3 v_tbn_1;out highp vec3 v_tbn_2;out highp vec4 v_faux_color_emissive; 3161#endif 3162#ifdef RENDER_SHADOWS 3163uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1; 3164#endif 3165#ifdef FLOOD_LIGHT
3166out highp float v_flood_radius;out float v_has_flood_light; 3167#endif 3168const float MAX_UINT_16=65535.0;const float MAX_INT_16=32767.0;const float MAX_UINT_8=255.0;const float TWO_POW_8=256.0;const float FLOOD_LIGHT_MAX_RADIUS_METER=2048.0;vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));} 3169#ifdef BUILDING_FAUX_FACADE 3170mat3 get_tbn(in vec3 normal) {const vec3 bitangent=vec3(0.0,0.0,1.0);vec3 tangent=normalize(vec3(normal.y,-normal.x,0.0));return mat3(tangent,bitangent,normal);} 3171#endif 3172#pragma mapbox: define-attribute-vertex-shader-only highp uvec2 part_color_emissive 3173#pragma mapbox: define-attribute-vertex-shader-only highp uvec2 faux_facade_color_emissive 3174void main() { 3175#pragma mapbox: initialize-attribute-custom highp uvec2 part_color_emissive 3176#pragma mapbox: initialize-attribute-custom highp uvec2 faux_facade_color_emissive 3177#ifdef FLOOD_LIGHT 3178v_flood_radius=(float(a_flood_light_wall_radius_1i16)/MAX_INT_16*FLOOD_LIGHT_MAX_RADIUS_METER);v_has_flood_light=step(0.0,v_flood_radius); 3179#endif 3180vec4 color_emissive=decode_color(vec2(part_color_emissive));v_color=vec4(sRGBToLinear(color_emissive.rgb),color_emissive.a);vec3 a_normal_3f=vec3(a_normal_3)/MAX_INT_16;v_normal=vec3(u_normal_matrix*vec4(a_normal_3f,0.0));float hidden=0.0;float depth_offset=0.0;vec2 centroid_xy=vec2(a_centroid_3.xy >> 2);vec2 spanBits=vec2(a_centroid_3.xy & 3); 3181#ifdef BUILDING_FAUX_FACADE 3182vec4 faux_facade_data=vec4(a_faux_facade_data);v_faux_facade=faux_facade_data.x;if (v_faux_facade > 0.0) {v_faux_facade_ed=faux_facade_data.x *u_tile_to_meter;float window_x_perc=floor(faux_facade_data.y/TWO_POW_8);float window_y_perc=faux_facade_data.y-TWO_POW_8*window_x_perc;vec2 window_perc=vec2(window_x_perc,window_y_perc)/MAX_UINT_8;v_faux_facade_floor=(faux_facade_data.zw/MAX_UINT_16*EXTENT)*u_tile_to_meter;v_faux_facade_window=window_perc*v_faux_facade_floor;v_faux_facade_range=(vec2(a_faux_facade_vertical_range)/MAX_UINT_16*EXTENT)*u_tile_to_meter;v_aspect=v_faux_facade_window.x/v_faux_facade_window.y;mat3 tbn=get_tbn(normalize(v_normal));v_tbn_0=tbn[0];v_tbn_1=tbn[1];v_tbn_2=tbn[2];v_faux_color_emissive=decode_color(vec2(faux_facade_color_emissive));v_faux_color_emissive.rgb=sRGBToLinear(v_faux_color_emissive.rgb);depth_offset=min(1000.0,float(a_centroid_3.z))*0.0000002;} 3183#endif 3184v_pos=a_pos_3f; 3185#if defined(RENDER_CUTOFF) || defined(RENDER_FRONT_CUTOFF) 3186float halfSpanX=spanBits.x*10.0/u_tile_to_meter;float halfSpanY=spanBits.y*10.0/u_tile_to_meter;vec2 screenUpInTile=vec2(u_matrix[0][1],u_matrix[1][1]);vec2 spanOffset=vec2(halfSpanX,halfSpanY)*sign(screenUpInTile);vec2 cutoff_highestCorner=centroid_xy+spanOffset;vec2 cutoff_lowestCorner=centroid_xy-spanOffset; 3187#endif 3188#if defined(RENDER_CUTOFF) || defined(RENDER_FRONT_CUTOFF) 3189vec4 ground=u_matrix*vec4(centroid_xy,0.0,1.0); 3190#endif 3191#ifdef RENDER_CUTOFF 3192v_cutoff_opacity=cutoff_opacity(u_cutoff_params,ground.z);hidden=float(v_cutoff_opacity==0.0);v_pos.z*=v_cutoff_opacity; 3193#endif 3194#ifdef RENDER_SHADOWS 3195vec3 shadow_pos=v_pos; 3196#ifdef NORMAL_OFFSET 3197vec3 offset=shadow_normal_offset_model(v_normal);shadow_pos+=offset*shadow_normal_offset_multiplier0(); 3198#endif 3199v_pos_light_view_0=u_light_matrix_0*vec4(shadow_pos,1.0);v_pos_light_view_1=u_light_matrix_1*vec4(shadow_pos,1.0); 3200#endif 3201#ifdef FOG 3202v_fog_pos=fog_position(v_pos); 3203#endif 3204#ifdef RENDER_FRONT_CUTOFF 3205v_front_cutoff_opacity=1.0;{hidden=max(hidden,float(ground.w <=0.0));
3205float ndc_y=ground.y/max(ground.w,0.001);float threshold=u_front_cutoff_params.x*2.0-1.0;float range_ndc=u_front_cutoff_params.y*2.0;hidden=max(hidden,float(ndc_y < threshold-range_ndc));float t=clamp((ndc_y-(threshold-range_ndc))/max(range_ndc,0.001),0.0,1.0);v_front_cutoff_opacity=mix(u_front_cutoff_params.z,1.0,t);} 3206#endif 3207gl_Position=mix(u_matrix*vec4(v_pos,1),AWAY,hidden);gl_Position.z-=depth_offset*gl_Position.w; 3208#ifdef INDICATOR_CUTOUT 3209#ifdef FEATURE_CUTOUT 3210vec4 ic_ground=u_matrix*vec4(v_pos.xy,0.0,1.0);vec4 ic_roof=u_matrix*vec4(v_pos.xy,v_pos.z,1.0);v_ground_roof=vec4(ic_ground.xy/ic_ground.w,ic_roof.xy/ic_roof.w); 3211#endif 3212#endif 3213}`),buildingBloom:Ft(`in vec4 v_color_emissive; 3214#pragma mapbox: define-attribute highp vec4 bloom_attenuation 3215#pragma mapbox: initialize-attribute highp vec4 bloom_attenuation 3216float saturate(float val) {return clamp(val,0.0,1.0);}void main() {float emission=v_color_emissive.a;float opacity=1.0; 3217#ifdef HAS_ATTRIBUTE_a_bloom_attenuation 3218float distance=length(vec2(1.3*max(0.0,abs(bloom_attenuation.x)-bloom_attenuation.z),bloom_attenuation.y));distance+= mix(0.5,0.0,clamp(emission-1.0,0.0,1.0));opacity*=saturate(1.0-distance*distance); 3219#endif 3220#ifdef RENDER_CUTOFF 3221opacity*=v_cutoff_opacity; 3222#endif 3223glFragColor=vec4(v_color_emissive.rgb,1.0)*opacity;}`,`in vec3 a_pos_3f; 3224#pragma mapbox: define-attribute-vertex-shader-only highp uvec2 part_color_emissive 3225#pragma mapbox: define-attribute highp vec4 bloom_attenuation 3226out vec4 v_color_emissive;uniform mat4 u_matrix;vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}void main() { 3227#pragma mapbox: initialize-attribute-custom highp uvec2 part_color_emissive 3228#pragma mapbox: initialize-attribute highp vec4 bloom_attenuation 3229#ifdef HAS_ATTRIBUTE_a_part_color_emissive 3230vec4 color_emissive=decode_color(vec2(part_color_emissive));float part_emissive=color_emissive.a*5.0;v_color_emissive=vec4(sRGBToLinear(color_emissive.rgb),part_emissive); 3231#else 3232v_color_emissive=vec4(1.0); 3233#endif 3234gl_Position=u_matrix*vec4(a_pos_3f,1.0); 3235#ifdef RENDER_CUTOFF 3236v_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z); 3237#endif 3238}`),buildingDepth:Ft("void main() {}","in vec3 a_pos_3f;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos_3f,1.0);}"),rasterParticle:Ft(`#include "_prelude_fog.fragment.glsl" 3239#include "_prelude_lighting.glsl" 3240uniform float u_fade_t;uniform float u_opacity;uniform highp float u_raster_elevation;in vec2 v_pos0;in vec2 v_pos1;uniform sampler2D u_image0;uniform sampler2D u_image1;void main() {vec4 color0,color1,color;color0=texture(u_image0,v_pos0);color1=texture(u_image1,v_pos1);if (color0.a > 0.0) color0.rgb/=color0.a;if (color1.a > 0.0) color1.rgb/=color1.a;color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 out_color=color.rgb; 3241#ifdef LIGHTING_3D_MODE 3242out_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),1.0).rgb; 3243#endif 3244#ifdef FOG 3245highp float fog_limit_high_meters=1000000.0;highp float fog_limit_low_meters=600000.0;float fog_limit=1.0-smoothstep(fog_limit_low_meters,fog_limit_high_meters,u_raster_elevation);out_color=fog_dither(fog_apply(out_color,v_fog_pos,fog_limit)); 3246#endif 3247glFragColor=vec4(out_color*color.a,color.a); 3248#ifdef OVERDRAW_INSPECTOR 3249glFragColor=vec4(1.0); 3250#endif 3251HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" 3252uniform mat4 u_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform mat3 u_grid_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_raster_elevation;uniform float u_zoom_transition;uniform vec2 u_merc_center; 3253#define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8 3254in ivec2 a_pos;in uvec2 a_texture_pos;out vec2 v_pos0;out vec2 v_pos1;void main() {float w=1.0;vec2 uv; 3255#ifdef PROJECTION_GLOBE_VIEW 3256vec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);float mercatorY=mercatorYfromLat(latLng[0]);float mercatorX=mercatorXfromLng(latLng[1]);float tiles=u_grid_matrix[0][2];float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];float uvX=mercatorX*tiles-idx;float uvY=mercatorY*tiles-idy;uv=vec2(uvX,uvY);vec3 globe_pos=latLngToECEF(latLng.xy);globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;vec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);if (u_zoom_transition > 0.0) {vec2 merc_pos=vec2(mercatorX,mercatorY);merc_world_pos=vec4(merc_pos,u_raster_elevation,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition)*w,w);gl_Position=u_matrix*interpolated_pos; 3257#ifdef FOG 3258v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz); 3259#endif 3260#else 3261uv=vec2(a_texture_pos)/8192.0;
3261gl_Position=u_matrix*vec4(vec2(a_pos)*w,u_raster_elevation*w,w); 3262#ifdef FOG 3263v_fog_pos=fog_position(vec2(a_pos)); 3264#endif 3265#endif 3266v_pos0=uv;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}`),rasterParticleDraw:Ft("uniform sampler2D u_color_ramp;in float v_particle_speed;void main() {glFragColor=texture(u_color_ramp,vec2(v_particle_speed,0.5));}",`#include "_prelude_raster_particle.glsl" 3267in int a_index;uniform sampler2D u_particle_texture;uniform float u_particle_texture_side_len;uniform vec2 u_tile_offset;out float v_particle_speed;void main() {ivec2 pixel_coord=ivec2( 3268mod(float(a_index),u_particle_texture_side_len),float(a_index)/u_particle_texture_side_len);vec4 pixel=texelFetch(u_particle_texture,pixel_coord,0);vec2 pos=unpack_pos_from_rgba(pixel)+u_tile_offset;vec2 tex_coord=fract(pos);vec2 velocity=lookup_velocity(tex_coord);if (velocity==INVALID_VELOCITY) {gl_Position=AWAY;v_particle_speed=0.0;} else {gl_Position=vec4(2.0*pos-1.0,0,1);v_particle_speed=length(velocity);}gl_PointSize=1.0;}`),rasterParticleTexture:Ft("uniform sampler2D u_texture;uniform float u_opacity;in vec2 v_tex_pos;void main() {vec4 color=texture(u_texture,v_tex_pos);glFragColor=vec4(floor(255.0*color*u_opacity)/255.0);}","in ivec2 a_pos;out vec2 v_tex_pos;void main() {vec2 uv=0.5*vec2(a_pos)+vec2(0.5);v_tex_pos=uv;gl_Position=vec4(a_pos,0.0,1.0);}"),rasterParticleUpdate:Ft(`#include "_prelude_raster_particle.glsl" 3269uniform sampler2D u_particle_texture;uniform mediump float u_particle_texture_side_len;uniform mediump float u_speed_factor;uniform highp float u_reset_rate;uniform highp float u_rand_seed;in highp vec2 v_tex_coord;vec2 linearstep(vec2 edge0,vec2 edge1,vec2 x) {return clamp((x-edge0)/(edge1-edge0),vec2(0),vec2(1));}const highp vec3 rand_constants=vec3(12.9898,78.233,4375.85453);highp float rand(const highp vec2 co) {highp float t=dot(rand_constants.xy,co);return fract(sin(t)*(rand_constants.z+t));}void main() {ivec2 pixel_coord=ivec2(v_tex_coord*u_particle_texture_side_len);highp vec4 pixel=texelFetch(u_particle_texture,pixel_coord,0);highp vec2 pos=unpack_pos_from_rgba(pixel);highp vec2 velocity=lookup_velocity(clamp(pos,0.0,1.0));highp vec2 dp=velocity==INVALID_VELOCITY ? vec2(0) : velocity*u_speed_factor;pos=pos+dp;highp vec2 seed=(pos+v_tex_coord)*u_rand_seed;highp vec2 random_pos=vec2(rand(seed+1.3),rand(seed+2.1));highp vec2 persist_rate=pow( 3270linearstep(vec2(-u_particle_pos_offset),vec2(0),pos)*linearstep(vec2(1.0+u_particle_pos_offset),vec2(1),pos),vec2(4) 3271);highp vec2 per_frame_persist=pow(persist_rate,abs(dp)/u_particle_pos_offset);highp float drop_rate=1.0-per_frame_persist.x*per_frame_persist.y;drop_rate=any(greaterThanEqual(abs(pos-0.5),vec2(0.5+u_particle_pos_offset))) ? 1.0 : drop_rate;highp float drop=step(1.0-drop_rate-u_reset_rate,rand(seed));highp vec2 next_pos=mix(pos,random_pos,drop);glFragColor=pack_pos_to_rgba(next_pos);}`,"in ivec2 a_pos;out vec2 v_tex_coord;void main() {v_tex_coord=0.5*vec2(a_pos+ivec2(1));gl_Position=vec4(a_pos,0.0,1.0);}"),snowParticle:Ft("in highp vec2 uv;in highp float alphaMultiplier;uniform vec4 u_particleColor;uniform vec2 u_simpleShapeParameters;void main() {float t=clamp((length(uv)-u_simpleShapeParameters.x)/(1.0-u_simpleShapeParameters.x),0.0,1.0);float alpha=1.0-pow(t,pow(10.0,u_simpleShapeParameters.y));alpha*=alphaMultiplier;alpha*=u_particleColor.a;vec3 color=u_particleColor.rgb*alpha;glFragColor=vec4(color,alpha) ;HANDLE_WIREFRAME_DEBUG;}",` 3272in highp vec3 a_pos_3f;in highp vec2 a_uv;in highp vec4 a_snowParticleData;in highp vec4 a_snowParticleDataHorizontalOscillation;uniform mat4 u_modelview;uniform mat4 u_projection;uniform vec3 u_cam_pos;uniform vec2 u_screenSize;uniform float u_time;uniform float u_boxSize;uniform float u_velocityConeAperture; 3273uniform float u_velocity;uniform vec3 u_direction;uniform float u_horizontalOscillationRadius; 3274uniform float u_horizontalOscillationRate; 3275uniform float u_billboardSize;uniform vec2 u_thinningCenterPos;uniform vec3 u_thinningShape;uniform float u_thinningAffectedRatio;uniform float u_thinningParticleOffset;out highp vec2 uv;out highp float alphaMultiplier;void main() {vec3 pos=a_pos_3f;float halfBoxSize=0.5*u_boxSize;pos.xyz*=halfBoxSize;pos+=u_cam_pos;float velocityConeApertureRad=radians(u_velocityConeAperture*0.5);float coneAnglePichRad=velocityConeApertureRad*a_snowParticleData.z;float coneAngleHeadingRad=a_snowParticleData.w*radians(360.0);vec3 localZ=normalize(u_direction);vec3 localX=normalize(cross(localZ,vec3(1,0,0)));vec3 localY=normalize(cross(localZ,localX));vec3 direction;direction.x=cos(coneAngleHeadingRad)*sin(coneAnglePichRad);direction.y=sin(coneAngleHeadingRad)*sin(coneAnglePichRad);direction.z=cos(coneAnglePichRad);direction=normalize(direction);vec3 simPosLocal=vec3(0,0,0);float velocityScale=(1.0+3.0*a_snowParticleData.y)*u_velocity;simPosLocal+=direction*velocityScale*u_time;float horizontalOscillationRadius=u_horizontalOscillationRadius*a_snowParticleDataHorizontalOscillation.x;float horizontalOscillationAngle=u_horizontalOscillationRate*u_time*(-1.0+2.0*a_snowParticleDataHorizontalOscillation.y);
3275simPosLocal.xy+=horizontalOscillationRadius*vec2(cos(horizontalOscillationAngle),sin(horizontalOscillationAngle));vec3 simPos=localX*simPosLocal.x+ 3276localY*simPosLocal.y+localZ*simPosLocal.z;pos+=simPos;pos=fract((pos+vec3(halfBoxSize))/vec3(u_boxSize))*u_boxSize-vec3(halfBoxSize);float clipZ=-u_cam_pos.z+pos.z;vec4 posView=u_modelview*vec4(pos,1.0);float size=u_billboardSize;alphaMultiplier=1.0;vec4 posScreen=u_projection*posView;posScreen/=posScreen.w;posScreen.xy=vec2(0.5)+posScreen.xy*0.5;posScreen.xy*=u_screenSize;vec2 thinningCenterPos=u_thinningCenterPos.xy;thinningCenterPos.y=u_screenSize.y-thinningCenterPos.y;float screenDist=length((thinningCenterPos-posScreen.xy)/(0.5*u_screenSize));screenDist+=a_snowParticleData.x*u_thinningParticleOffset;float scaleFactorMode=0.0;float thinningShapeDist=u_thinningShape.x+u_thinningShape.y;if (screenDist < thinningShapeDist) {float thinningFadeRatio=clamp((screenDist-u_thinningShape.x)/u_thinningShape.y,0.0,1.0);thinningFadeRatio=pow(thinningFadeRatio,u_thinningShape.z);if (a_snowParticleData.x < u_thinningAffectedRatio) {scaleFactorMode=1.0-thinningFadeRatio;alphaMultiplier=thinningFadeRatio;}}vec4 posScreen1=u_projection*vec4(posView.x-size,posView.yzw);posScreen1/=posScreen1.w;vec4 posScreen2=u_projection*vec4(posView.x+size,posView.yzw);posScreen2/=posScreen2.w;posScreen1.xy=vec2(0.5)+posScreen1.xy*0.5;posScreen1.xy*=u_screenSize;posScreen2.xy=vec2(0.5)+posScreen2.xy*0.5;posScreen2.xy*=u_screenSize;float screenLength=length(posScreen1.xy-posScreen2.xy);float screenEpsilon=3.0;float scaleFactor=1.0;if (screenLength < screenEpsilon) {scaleFactor=screenEpsilon/max(screenLength,0.01);scaleFactor=mix(scaleFactor,1.0,scaleFactorMode);}float screenEpsilon2=15.0;if (screenLength > screenEpsilon2) {scaleFactor=screenEpsilon2/max(screenLength,0.01);}size*=scaleFactor;vec2 right=size*vec2(1,0);vec2 up=size*vec2(0,1);posView.xy+=right*a_uv.x;posView.xy+=up*a_uv.y;uv=a_uv;gl_Position=u_projection*posView;}`),rainParticle:Ft("in highp vec2 uv;in highp float particleRandomValue;uniform sampler2D u_texScreen;uniform float u_distortionStrength;uniform vec4 u_color;uniform vec2 u_thinningCenterPos;uniform vec3 u_thinningShape;uniform float u_thinningAffectedRatio;uniform float u_thinningParticleOffset;uniform float u_shapeDirectionalPower;uniform float u_mode;void main() {vec2 st=uv*0.5+vec2(0.5);vec2 uvm=uv;uvm.y=-1.0+2.0*pow(st.y,u_shapeDirectionalPower);float shape=clamp(1.0-length(uvm),0.0,1.0);float alpha=abs(shape)*u_color.a;vec2 screenSize=vec2(textureSize(u_texScreen,0));vec2 thinningCenterPos=u_thinningCenterPos.xy;thinningCenterPos.y=screenSize.y-thinningCenterPos.y;float screenDist=length((thinningCenterPos-gl_FragCoord.xy)/(0.5*screenSize));screenDist+=(0.5+0.5*particleRandomValue)*u_thinningParticleOffset;float thinningShapeDist=u_thinningShape.x+u_thinningShape.y;float thinningAlpha=1.0;if (screenDist < thinningShapeDist) {float thinningFadeRatio=clamp((screenDist-u_thinningShape.x)/u_thinningShape.y,0.0,1.0);thinningFadeRatio=pow(thinningFadeRatio,u_thinningShape.z);thinningAlpha*=thinningFadeRatio;}vec2 offsetXY=normalize(uvm)*abs(shape);vec2 stScreen=(gl_FragCoord.xy+offsetXY*u_distortionStrength*thinningAlpha)/screenSize;vec3 colorScreen=texture(u_texScreen,stScreen).rgb;alpha*=thinningAlpha;glFragColor=mix(vec4(colorScreen,1.0),vec4(u_color.rgb*alpha,alpha),u_mode);HANDLE_WIREFRAME_DEBUG;}",` 3277in highp vec3 a_pos_3f;in highp vec2 a_uv;in highp vec4 a_rainParticleData;uniform mat4 u_modelview;uniform mat4 u_projection;uniform vec3 u_cam_pos;uniform float u_time;uniform float u_boxSize;uniform float u_velocityConeAperture; 3278uniform float u_velocity; 3279uniform vec2 u_rainDropletSize;uniform vec3 u_rainDirection;out highp vec2 uv;out highp float particleRandomValue;void main() {vec3 pos=a_pos_3f;float halfBoxSize=0.5*u_boxSize;pos*=halfBoxSize; 3280pos+=u_cam_pos;float velocityConeApertureRad=radians(u_velocityConeAperture*0.5);float coneAnglePichRad=velocityConeApertureRad*a_rainParticleData.z;float coneAngleHeadingRad=a_rainParticleData.w*radians(360.0);vec3 localZ=normalize(u_rainDirection);vec3 localX=normalize(cross(localZ,vec3(1,0,0)));vec3 localY=normalize(cross(localZ,localX));vec3 directionLocal;directionLocal.x=cos(coneAngleHeadingRad)*sin(coneAnglePichRad);directionLocal.y=sin(coneAngleHeadingRad)*sin(coneAnglePichRad);directionLocal.z=cos(coneAnglePichRad);directionLocal=normalize(directionLocal);vec3 directionWorld=localX*directionLocal.x+localY*directionLocal.y+localZ*directionLocal.z;float velocityScale=(1.0+3.0*a_rainParticleData.y)*u_velocity;vec3 simPosLocal=vec3(0,0,0);simPosLocal+=directionLocal*velocityScale*u_time;vec3 simPos=localX*simPosLocal.x+ 3281localY*simPosLocal.y+localZ*simPosLocal.z;pos+=simPos;pos=fract((pos+vec3(halfBoxSize))/vec3(u_boxSize))*u_boxSize-vec3(halfBoxSize);vec4 posView=u_modelview*vec4(pos,1.0);vec3 directionView=normalize((u_modelview*vec4(directionWorld,0.0)).xyz);vec3 side=cross(directionView,normalize(posView.xyz));posView.xyz+=side*a_uv.x*u_rainDropletSize.x;posView.xyz+=directionView*a_uv.y*u_rainDropletSize.y;uv=a_uv;particleRandomValue=a_rainParticleData.x;gl_Position=u_projection*posView;}`),vignette:Ft("uniform vec3 u_vignetteShape;uniform vec4 u_vignetteColor;in vec2 st;void main() {float screenDist=length(st);float alpha=clamp((screenDist-u_vignetteShape.x)/u_vignetteShape.y,0.0,1.0);alpha=pow(alpha,u_vignetteShape.z)*u_vignetteColor.a;vec3 color=u_vignetteColor.rgb;glFragColor=vec4(color*alpha,alpha) ;}","in vec2 a_pos_2f;out vec2 st;void main() {st=a_pos_2f;gl_Position=vec4(a_pos_2f,0,1);}")};Ft(zd,"");const Xr=h.ea([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_rainParticleData",components:4}]),ig=h.ea([{type:"Float32",name:"a_pos_2f",components:2}]);class Lc{destroy(){this.vignetteVx&&this.vignetteVx.destroy(),this.vignetteIdx&&this.vignetteIdx.destroy()}draw(t,o){const c=t.getOrCreateProgram("vignette");
vendor: 56,554 bytes, line 3281
3281if(!this.vignetteVx||!this.vignetteIdx){const _=new h.ee,y=new h.dF;_.emplaceBack(-1,-1),_.emplaceBack(1,-1),_.emplaceBack(1,1),_.emplaceBack(-1,1),y.emplaceBack(0,1,2),y.emplaceBack(0,2,3),this.vignetteVx=t.context.createVertexBuffer(_,ig.members),this.vignetteIdx=t.context.createIndexBuffer(y)}const d=h.dB.simpleSegment(0,0,4,6);if(this.vignetteVx&&this.vignetteIdx){t.uploadCommonUniforms(t.context,c);const _={u_vignetteShape:(m={vignetteShape:[o.start,o.range,Math.pow(10,o.fadePower)],vignetteColor:[o.color.r,o.color.g,o.color.b,o.color.a*o.strength]}).vignetteShape,u_vignetteColor:m.vignetteColor};c.draw(t,t.context.gl.TRIANGLES,rt.disabled,pt.disabled,gt.alphaBlended,lt.disabled,_,"vignette",this.vignetteVx,this.vignetteIdx,d)}var m}}class rg{constructor(){this._accumulatedOffsetX=0,this._accumulatedOffsetY=0,this._accumulatedElevation=0}update(t,o){const c=t.getFreeCameraOptions().position,d=c.toAltitude(),m=c.toLngLat(),_=h.am(m.lng),y=h.am(m.lat),v=t.pixelsPerMeter/o,T=_*h.eg,I=h.eg*Math.log(Math.tan(Math.PI/4+y/2));if(this._offsetXPrev===void 0)this._offsetXPrev=0,this._offsetYPrev=0,this._elevationPrev=0,this._accumulatedOffsetX=0,this._accumulatedOffsetY=0,this._accumulatedElevation=0;else{const P=-this._offsetYPrev+I,A=-this._elevationPrev+d;this._accumulatedOffsetX+=(-this._offsetXPrev+T)*v,this._accumulatedOffsetY+=P*v,this._accumulatedElevation+=A*v,this._offsetXPrev=T,this._offsetYPrev=I,this._elevationPrev=d}}getPosition(){return[this._accumulatedOffsetX,this._accumulatedOffsetY,this._accumulatedElevation]}}function pi(a,t){return[-(a[0]-Math.floor(a[0]/t)*t),-(a[1]-Math.floor(a[1]/t)*t),-(a[2]-Math.floor(a[2]/t)*t)]}function Rt(a){const t=h.ef(1323123451230),o=[];for(let c=0;c<a;++c){const d=2*t()-1,m=2*t()-1,_=2*t()-1;o.push(h.cU(d,m,_))}return o}function rs(a,t,o,c,d){const m=h.aB((d-o)/(c-o),0,1);return(1-m)*a+m*t}class Nn{constructor(t){this._movement=new rg,this._accumulatedTimeFromStart=0,this._prevTime=Date.now()/1e3,this._vignette=new Lc,this._ppmScaleFactor=t}destroy(){this.particlesVx&&this.particlesVx.destroy(),this.particlesIdx&&this.particlesIdx.destroy(),this._vignette&&this._vignette.destroy()}updateOnRender(t,o){const c=t.transform;this._movement.update(c,this._ppmScaleFactor);const d=c.starsProjMatrix,m=h.bP([]);h.bR(m,m,h.am(90)-c._pitch),h.bQ(m,m,-c.angle);const _=h.bV(new Float32Array(16),m),y=new Float32Array([1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1]),v=h.e9([],y),T=h.aC([],v,_),I=Date.now()/1e3;return this._accumulatedTimeFromStart+=(I-this._prevTime)*o,this._prevTime=I,{projectionMatrix:d,modelviewMatrix:T}}}const Ta=h.ea([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_snowParticleData",components:4},{type:"Float32",name:"a_snowParticleDataHorizontalOscillation",components:2}]),Sa={building:a=>({u_matrix:new h.c3(a),u_normal_matrix:new h.c3(a),u_opacity:new h.c1(a),u_faux_facade_ao_intensity:new h.c1(a),u_camera_pos:new h.c0(a),u_tile_to_meter:new h.c1(a),u_facade_emissive_chance:new h.c1(a),u_flood_light_color:new h.c0(a),u_flood_light_intensity:new h.c1(a),u_front_cutoff_params:new h.c0(a)}),buildingBloom:a=>({u_matrix:new h.c3(a)}),buildingDepth:a=>({u_matrix:new h.c3(a)}),rasterParticle:a=>({u_matrix:new h.c3(a),u_normalize_matrix:new h.c3(a),u_globe_matrix:new h.c3(a),u_merc_matrix:new h.c3(a),u_grid_matrix:new h.dq(a),u_tl_parent:new h.c2(a),u_scale_parent:new h.c1(a),u_fade_t:new h.c1(a),u_opacity:new h.c1(a),u_image0:new h.b$(a),u_image1:new h.b$(a),u_raster_elevation:new h.c1(a),u_zoom_transition:new h.c1(a),u_merc_center:new h.c2(a),u_cutoff_params:new h.cS(a)}),rasterParticleTexture:a=>({u_texture:new h.b$(a),u_opacity:new h.c1(a)}),rasterParticleDraw:a=>({u_particle_texture:new h.b$(a),u_particle_texture_side_len:new h.c1(a),u_tile_offset:new h.c2(a),u_velocity:new h.b$(a),u_color_ramp:new h.b$(a),u_velocity_res:new h.c2(a),u_max_speed:new h.c1(a),u_uv_offset:new h.c2(a),u_data_scale:new h.c2(a),u_data_offset:new h.c1(a),u_particle_pos_scale:new h.c1(a),u_particle_pos_offset:new h.c2(a)}),rasterParticleUpdate:a=>({u_particle_texture:new h.b$(a),u_particle_texture_side_len:new h.c1(a),u_velocity:new h.b$(a),u_velocity_res:new h.c2(a),u_max_speed:new h.c1(a),u_speed_factor:new h.c1(a),u_reset_rate:new h.c1(a),u_rand_seed:new h.c1(a),u_uv_offset:new h.c2(a),u_data_scale:new h.c2(a),u_data_offset:new h.c1(a),u_particle_pos_scale:new h.c1(a),u_particle_pos_offset:new h.c2(a)}),snowParticle:a=>({u_modelview:new h.c3(a),u_projection:new h.c3(a),u_time:new h.c1(a),u_cam_pos:new h.c0(a),u_velocityConeAperture:new h.c1(a),u_velocity:new h.c1(a),u_horizontalOscillationRadius:new h.c1(a),u_horizontalOscillationRate:new h.c1(a),u_boxSize:new h.c1(a),u_billboardSize:new h.c1(a),u_simpleShapeParameters:new h.c2(a),u_screenSize:new h.c2(a),u_thinningCenterPos:new h.c2(a),u_thinningShape:new h.c0(a),u_thinningAffectedRatio:new h.c1(a),u_thinningParticleOffset:new h.c1(a),u_particleColor:new h.cS(a),u_direction:new h.c0(a)}),rainParticle:a=>({u_modelview:new h.c3(a),u_projection:new h.c3(a),u_time:new h.c1(a),u_cam_pos:new h.c0(a),u_texScreen:new h.b$(a),u_velocityConeAperture:new h.c1(a),u_velocity:new h.c1(a),u_boxSize:new h.c1(a),u_rainDropletSize:new h.c2(a),u_distortionStrength:new h.c1(a),u_rainDirection:new h.c0(a),u_color:new h.cS(a),u_screenSize:new h.c2(a),u_thinningCenterPos:new h.c2(a),u_thinningShape:new h.c0(a),u_thinningAffectedRatio:new h.c1(a),u_thinningParticleOffset:new h.c1(a),u_shapeDirectionalPower:new h.c1(a),u_shapeNormalPower:new h.c1(a),u_mode:new h.c1(a)}),vignette:a=>({u_vignetteShape:new h.c0(a),u_vignetteColor:new h.cS(a)})},Sr={drawBuilding:function(a,t,o,c){a.currentLayer<a.firstLightBeamLayer&&(a.firstLightBeamLayer=a.currentLayer);const d=o.paint.get("building-ambient-occlusion-ground-intensity"),m=o.paint.get("building-ambient-occlusion-ground-radius"),_=o.paint.get("building-ambient-occlusion-ground-attenuation"),y=o.paint.get("building-opacity");if(y<=0)return;let v=d>0&&m>0,T=!0;const I=o.paint.get("building-vertical-scale");if(I<=0)return;a.shadowRenderer||(T=!1);const P=a.conflationActive&&a.style.isLayerClipped(o,t.getSource()),A=a.style.order.indexOf(o.fqid);if((function(D,O,L,k,N,H){for(const Z of H){const G=O.getTile(Z).getBucket(L);G&&(N&&G.updateReplacement(Z,D.replacementSource,k),G.uploadUpdatedIndexBuffer(D.context))}})(a,t,o,A,P,c),(function(D,O,L,k){for(const N of k){const H=O.getTile(N).getBucket(L);H&&H.needsEvaluation()&&H.uploadUpdatedColorBuffer(D.context)}})(a,t,o,c),o.resetLayerRenderingStats(a),a.shadowRenderer&&(a.shadowRenderer.useNormalOffset=!0),a.renderPass==="shadow"&&a.shadowRenderer){const D=[],O=a.shadowRenderer.getShadowPassDepthMode();Rc({painter:a,source:t,layer:o,coords:c,defines:D,blendMode:gt.disabled,depthMode:O,opacity:y,verticalScale:I,facadeEmissiveChance:0,facadeAOIntensity:0,floodLightIntensity:0,floodLightColor:[0,0,0]})}else if(a.renderPass==="translucent"){let D=["HAS_ATTRIBUTE_a_part_color_emissive","LIGHTING_3D_MODE"];T&&(D=D.concat("RENDER_SHADOWS")),a.shadowRenderer&&a.shadowRenderer.useNormalOffset&&(D=D.concat("NORMAL_OFFSET"));const O=o.paint.get("building-facade-emissive-chance"),L=o.paint.get("building-ambient-occlusion-intensity"),k=o.paint.get("building-flood-light-intensity"),N=o.paint.get("building-flood-light-color-use-theme").constantOr("default")==="none",H=o.paint.get("building-flood-light-color").toNonPremultipliedRenderColor(N?null:o.lut).toArray01().slice(0,3),Z=o.paint.get("building-flood-light-ground-attenuation"),G=k>0,ne=new rt(a.context.gl.LEQUAL,rt.ReadWrite,a.depthRangeFor3D);y<1&&Rc({painter:a,source:t,layer:o,coords:c,defines:D,blendMode:gt.disabled,depthMode:ne,opacity:y,verticalScale:I,facadeEmissiveChance:O,facadeAOIntensity:L,floodLightIntensity:k,floodLightColor:H,depthOnly:!0});const te=a.colorModeForRenderPass();Rc({painter:a,source:t,layer:o,coords:c,defines:D,blendMode:te,depthMode:ne,opacity:y,verticalScale:I,facadeEmissiveChance:O,facadeAOIntensity:L,floodLightIntensity:k,floodLightColor:H});const se=o.paint.get("building-front-cutoff");wl(a.transform.pitch,se,!!a.terrain),v&&zc(a,t,o,c,!0,y,d,m,k,H,_,P),G&&zc(a,t,o,c,!1,y,d,m,k,H,Z,P)}else if(a.renderPass==="light-beam"){const D=["HAS_ATTRIBUTE_a_part_color_emissive","HAS_ATTRIBUTE_a_bloom_attenuation"],O=new rt(a.context.gl.LEQUAL,rt.ReadOnly,a.depthRangeFor3D);Rc({painter:a,source:t,layer:o,coords:c,defines:D,blendMode:gt.alphaBlended,depthMode:O,opacity:y,verticalScale:I,facadeEmissiveChance:0,facadeAOIntensity:0,floodLightIntensity:0,floodLightColor:[0,0,0]})}a.shadowRenderer&&(a.shadowRenderer.useNormalOffset=!1),a.resetStencilClippingMasks()},drawRasterParticle:function(a,t,o,c,d,m){a.renderPass==="offscreen"&&(function(_,y,v,T){if(!T.length)return;const I=_.context,P=I.gl,A=y.getSource();if(!(A instanceof ft))return;const D=Math.ceil(Math.sqrt(v.paint.get("raster-particle-count")));let O=v.particlePositionRGBAImage;if(!O||O.width!==D){const Z=(function(G){const ne=G*G,te=new Uint8Array(4*ne),se=.9090909090909091;for(let J=0;J<ne;J++){const K=se*(h.ed(2*J+0)+Co),oe=se*(h.ed(2*J+1)+Co),de=255*K%1,ue=255*oe%1,ve=de,be=oe-ue/255,ke=ue;te[4*J+0]=255*(K-de/255),te[4*J+1]=255*ve,te[4*J+2]=255*be,te[4*J+3]=255*ke}return te})(D);O=v.particlePositionRGBAImage=new h.q({width:D,height:D},Z)}let L=v.particleFramebuffer;L?L.width!==D&&(L.destroy(),L=v.particleFramebuffer=I.createFramebuffer(D,D,1,null)):L=v.particleFramebuffer=I.createFramebuffer(D,D,1,null);const k=[];for(const Z of T){const G=y.getTile(Z);if(!(G instanceof Ss))continue;const ne=lm(G,A,v);if(!ne)continue;const te=[G.tileSize,G.tileSize];let se=v.tileFramebuffer;se||(se=v.tileFramebuffer=I.createFramebuffer(te[0],te[1],1,null));let J=G.rasterParticleState;J||(J=G.rasterParticleState=new am(I,Z,te,O));const K=J.update(v.lastInvalidatedAt);J.particleTextureDimension!==D&&J.updateParticleTexture(Z,O);const oe=J.targetColorTexture;J.targetColorTexture=J.backgroundColorTexture,J.backgroundColorTexture=oe;const de=J.particleTexture0;J.particleTexture0=J.particleTexture1,J.particleTexture1=de,k.push([Z,ne,J,K])}if(k.length===0)return;const N=h.o.now(),H=v.previousDrawTimestamp?.001*(N-v.previousDrawTimestamp):.0167;if(v.previousDrawTimestamp=N,v.hasColorMap()){I.activeTexture.set(P.TEXTURE0+2);let Z=v.colorRampTexture;Z||(Z=v.colorRampTexture=new h.T(I,v.colorRamp,P.RGBA8)),Z.bind(P.LINEAR,P.CLAMP_TO_EDGE)}I.bindFramebuffer.set(v.tileFramebuffer.framebuffer),(function(Z,G,ne){const te=Z.context,se=te.gl,J=G.tileFramebuffer;te.activeTexture.set(se.TEXTURE0);const K={u_texture:0,u_opacity:1.05*(de=G.paint.get("raster-particle-fade-opacity-factor"))/(de+.05)},oe=Z.getOrCreateProgram("rasterParticleTexture",{defines:[],overrideFog:!1});var de;for(const ue of ne){const[,,ve,be]=ue;J.colorAttachment0.set(ve.targetColorTexture.texture),te.viewport.set([0,0,J.width,J.height]),te.clear({color:h.C.transparent}),be&&(ve.backgroundColorTexture.bind(se.NEAREST,se.CLAMP_TO_EDGE),oe.draw(Z,se.TRIANGLES,rt.disabled,pt.disabled,gt.alphaBlended,lt.disabled,K,G.id,Z.viewportBuffer,Z.quadTriangleIndexBuffer,Z.viewportSegments))}})(_,v,k),(function(Z,G,ne,te){const se=Z.context,J=se.gl,K=ne.tileFramebuffer,oe=Z.transform.projection.name==="globe",de=ne.paint.get("raster-particle-max-speed");for(const ue of te){const[ve,be,ke]=ue;se.activeTexture.set(J.TEXTURE0+0),be.texture.bind(J.LINEAR,J.CLAMP_TO_EDGE),K.colorAttachment0.set(ke.targetColorTexture.texture);const fe=Z.getOrCreateProgram("rasterParticleDraw",{defines:be.defines,overrideFog:!1});se.activeTexture.set(J.TEXTURE0+1);const Ee=be.scalarData?[]:[0,1,2,3].map(Ce=>h.e2[Ce](ve));Ee.push(ve);const pe=ve.canonical.x,Pe=ve.canonical.y;for(const Ce of Ee){const Re=G.getTile(oe?Ce.wrapped():Ce);if(!Re)continue;const Ye=Re.rasterParticleState;if(!Ye)continue;const qe=Ce.canonical.x+(1<<Ce.canonical.z)*(Ce.wrap-ve.wrap),je=Ce.canonical.y;Ye.particleTexture0.bind(J.NEAREST,J.CLAMP_TO_EDGE);const Be=nm(1,Ye.particleTexture0.size[0],[qe-pe,je-Pe],0,be.texture.size,2,de,be.textureOffset,be.scale,be.offset);fe.draw(Z,J.POINTS,rt.disabled,pt.disabled,gt.alphaBlended,lt.disabled,Be,ne.id,Ye.particleIndexBuffer,void 0,Ye.particleSegment)}}})(_,y,v,k),I.bindFramebuffer.set(v.particleFramebuffer.framebuffer),(function(Z,G,ne,te){const se=Z.context,J=se.gl,K=G.paint.get("raster-particle-max-speed"),oe=te*G.paint.get("raster-particle-speed-factor")*.15,de=(function(ve){return Math.pow(ve,6)})(.01+1*G.paint.get("raster-particle-reset-rate-factor")),ue=G.particleFramebuffer;se.viewport.set([0,0,ue.width,ue.height]);for(const ve of ne){const[,be,ke]=ve;se.activeTexture.set(J.TEXTURE0+0),be.texture.bind(J.LINEAR,J.CLAMP_TO_EDGE),se.activeTexture.set(J.TEXTURE0+1);const fe=ke.particleTexture0;fe.bind(J.NEAREST,J.CLAMP_TO_EDGE);const Ee=om(1,fe.size[0],0,be.texture.size,K,oe,de,be.textureOffset,be.scale,be.offset);ue.colorAttachment0.set(ke.particleTexture1.texture),se.clear({color:h.C.transparent}),Z.getOrCreateProgram("rasterParticleUpdate",{defines:be.defines}).draw(Z,J.TRIANGLES,rt.disabled,pt.disabled,gt.unblended,lt.disabled,Ee,G.id,Z.viewportBuffer,Z.quadTriangleIndexBuffer,Z.viewportSegments)}})(_,v,k,H)})(a,t,o,c),a.renderPass==="translucent"&&((function(_,y,v,T){const I=_.context,P=I.gl,A=y.getSource().tileSize,D=5*(1-h.ag(h.cx,h.cx+1,_.transform.zoom))*A+v.paint.get("raster-particle-elevation"),O=!_.options.moving,L=_.transform.projection.name==="globe";if(!T.length)return;const[k,N]=_.stencilConfigForOverlap(T),H=[];L&&H.push("PROJECTION_GLOBE_VIEW");const Z=_.stencilModeFor3D();for(const G of N){const ne=G.toUnwrapped(),te=y.getTile(G);if(!te.rasterParticleState)continue;const se=te.rasterParticleState,J=100;te.registerFadeDuration(J);const K=y.findLoadedParent(G,0),oe=xl(te,K,y,_.transform,J);let de,ue;_.terrain&&_.terrain.prepareDrawTile(),I.activeTexture.set(P.TEXTURE0),se.targetColorTexture.bind(P.LINEAR,P.CLAMP_TO_EDGE),I.activeTexture.set(P.TEXTURE1),K&&K.rasterParticleState?(K.rasterParticleState.targetColorTexture.bind(P.LINEAR,P.CLAMP_TO_EDGE),de=Math.pow(2,K.tileID.overscaledZ-te.tileID.overscaledZ),ue=[te.tileID.canonical.x*de%1,te.tileID.canonical.y*de%1]):se.targetColorTexture.bind(P.LINEAR,P.CLAMP_TO_EDGE);const ve=L?_.transform.expandedFarZProjMatrix:_.transform.calculateProjMatrix(ne,O),be=_.transform,ke=eg(be),fe=h.du(G.canonical),Ee=h.dv(fe.getCenter().lat);let pe,Pe,Ce,Re,Ye;L?(pe=Float32Array.from(h.dx(h.dy(G.canonical))),Pe=Float32Array.from(be.globeMatrix),Ce=Float32Array.from(h.dt(be)),Re=[h.aG(be.center.lng),h.aJ(be.center.lat)],Ye=Float32Array.from(h.dw(G.canonical,fe,Ee,be.worldSize/be._pixelsPerMercatorPixel))):(pe=new Float32Array(16),Pe=new Float32Array(9),Ce=new Float32Array(16),Re=[0,0],Ye=new Float32Array(9));const qe=Rd(ve,pe,Pe,Ce,Ye,ue||[0,0],h.ai(_.transform.zoom),Re,ke,de||1,oe,D),je=_.isTileAffectedByFog(G),Be=_.getOrCreateProgram("rasterParticle",{defines:H,overrideFog:je});if(_.uploadCommonUniforms(I,Be,ne),L){const at=new rt(P.LEQUAL,rt.ReadOnly,_.depthRangeFor3D),ot=0,tt=_.globeSharedBuffers;if(tt){const[it,ht,xt]=tt.getGridBuffers(Ee,ot!==0);Be.draw(_,P.TRIANGLES,at,Z,gt.alphaBlended,_.renderElevatedRasterBackface?lt.frontCCW:lt.backCCW,qe,v.id,it,ht,xt)}}else{const at=_.depthModeForSublayer(0,rt.ReadOnly),ot=k[G.overscaledZ],{tileBoundsBuffer:tt,tileBoundsIndexBuffer:it,tileBoundsSegments:ht}=_.getTileBoundsBuffers(te);Be.draw(_,P.TRIANGLES,at,ot,gt.alphaBlended,lt.disabled,qe,v.id,tt,it,ht)}}_.resetStencilClippingMasks()})(a,t,o,c),a.style.map.triggerRepaint())},prepareRasterParticle:function(a,t,o){const c=t.getSource();if(!(c instanceof ft&&c.loaded()))return;const d=a.sourceLayer||c.rasterLayerIds&&c.rasterLayerIds[0];if(!d)return;const m=a.paint.get("raster-particle-array-band")||c.getInitialBand(d);if(m==null)return;const _=t.getIds().map(y=>t.getTileByID(y));for(const y of _)y.updateNeeded(a.id,m)&&c.prepareTile(y,d,a.id,m)},Rain:class extends Nn{constructor(){super(4.25),this._params={intensity:.5,timeFactor:1,velocityConeAperture:0,velocity:300,boxSize:2500,dropletSizeX:1,dropletSizeYScale:10,distortionStrength:70,screenThinning:{intensity:.57,start:.46,range:1.17,fadePower:.17,affectedRatio:1,particleOffset:-.2},color:{r:.66,g:.68,b:.74,a:.7},direction:{x:-50,y:-35},shapeDirPower:2,shapeNormalPower:1},this._vignetteParams={strength:1,start:.7,range:1,fadePower:.4,color:{r:.27,g:.27,b:.27,a:1}},this.particlesCount=16e3,this._devtoolsFolder=null,this._painter=null}destroy(){super.destroy()}update(a){const t=a.context;if(!this.particlesVx){const o=Rt(this.particlesCount),c=new h.eh,d=new h.dF;let m=0;const _=h.ef(1323123451230);for(let y=0;y<o.length;++y){const v=o[y],T=[2*_()-1,_(),_(),_()];c.emplaceBack(v[0],v[1],v[2],-1,-1,...T),c.emplaceBack(v[0],v[1],v[2],1,-1,...T),c.emplaceBack(v[0],v[1],v[2],1,1,...T),c.emplaceBack(v[0],v[1],v[2],-1,1,...T),d.emplaceBack(m+0,m+1,m+2),d.emplaceBack(m+0,m+2,m+3),m+=4}this.particlesVx=t.createVertexBuffer(c,Xr.members),this.particlesIdx=t.createIndexBuffer(d)}}getDrawParams(a){if(!a.style.rain)return null;const t=a.style.rain.state,o=structuredClone(this._params);o.intensity=t.density,o.timeFactor=t.intensity,o.color=structuredClone(t.color),o.screenThinning.intensity=t.centerThinning,o.dropletSizeX=t.dropletSize[0],o.dropletSizeYScale=t.dropletSize[1]/t.dropletSize[0],o.distortionStrength=100*t.distortionStrength;const c=structuredClone(this._vignetteParams);return c.strength=1,c.color=structuredClone(t.vignetteColor),{params:o,vignetteParams:c,revealParams:{revealStart:0,revealRange:.01},direction:structuredClone(t.direction)}}draw(a){const t=this.getDrawParams(a);if(!t)return;const{params:o,revealParams:c,direction:d,vignetteParams:m}=t,_=a.transform.zoom;if(c.revealStart>_)return;const y=rs(0,1,c.revealStart,c.revealStart+c.revealRange,_);if(!this.particlesVx||!this.particlesIdx)return;m.strength*=y;const v=this.updateOnRender(a,o.timeFactor),T=a.context,I=T.gl,P=a.transform;this.screenTexture&&this.screenTexture.size[0]===a.width&&this.screenTexture.size[1]===a.height||(this.screenTexture=new h.T(T,{width:a.width,height:a.height,data:null},I.RGBA8)),o.distortionStrength>0&&(T.activeTexture.set(I.TEXTURE0),this.screenTexture.bind(I.LINEAR,I.CLAMP_TO_EDGE),I.copyTexSubImage2D(I.TEXTURE_2D,0,0,0,0,0,a.width,a.height));const A=a.getOrCreateProgram("rainParticle");a.uploadCommonUniforms(T,A),T.activeTexture.set(I.TEXTURE0),this.screenTexture.bind(I.LINEAR,I.CLAMP_TO_EDGE);const D=[o.color.r,o.color.g,o.color.b,o.color.a],O=(L,k)=>{const N=pi(this._movement.getPosition(),L),H=o.dropletSizeX,Z=o.dropletSizeX*o.dropletSizeYScale,G=a.width/2,ne=a.height/2,te=rs(0,o.screenThinning.start,0,1,o.screenThinning.intensity),se=rs(.001,o.screenThinning.range,0,1,o.screenThinning.intensity),J=rs(0,o.screenThinning.particleOffset,0,1,o.screenThinning.intensity),K=(oe={modelview:v.modelviewMatrix,projection:v.projectionMatrix,time:this._accumulatedTimeFromStart,camPos:N,velocityConeAperture:o.velocityConeAperture,velocity:o.velocity,boxSize:L,rainDropletSize:[H,Z],distortionStrength:o.distortionStrength,rainDirection:d,color:D,screenSize:[P.width,P.height],thinningCenterPos:[G,ne],thinningShape:[te,se,Math.pow(10,o.screenThinning.fadePower)],thinningAffectedRatio:o.screenThinning.affectedRatio,thinningParticleOffset:J,shapeDirectionalPower:o.shapeDirPower,shapeNormalPower:o.shapeNormalPower,mode:k?0:1},{u_modelview:Float32Array.from(oe.modelview),u_projection:Float32Array.from(oe.projection),u_time:oe.time,u_cam_pos:oe.camPos,u_texScreen:0,u_velocityConeAperture:oe.velocityConeAperture,u_velocity:oe.velocity,u_boxSize:oe.boxSize,u_rainDropletSize:oe.rainDropletSize,u_distortionStrength:oe.distortionStrength,u_rainDirection:oe.rainDirection,u_color:oe.color,u_screenSize:oe.screenSize,u_thinningCenterPos:oe.thinningCenterPos,u_thinningShape:oe.thinningShape,u_thinningAffectedRatio:oe.thinningAffectedRatio,u_thinningParticleOffset:oe.thinningParticleOffset,u_shapeDirectionalPower:oe.shapeDirectionalPower,u_shapeNormalPower:oe.shapeNormalPower,u_mode:oe.mode});var oe;const de=Math.round(o.intensity*this.particlesCount),ue=h.dB.simpleSegment(0,0,4*de,2*de);A.draw(a,I.TRIANGLES,rt.disabled,pt.disabled,gt.alphaBlended,lt.disabled,K,"rain_particles",this.particlesVx,this.particlesIdx,ue)};o.distortionStrength>0&&O(o.boxSize,!0),O(o.boxSize,!1),this._vignette.draw(a,m)}},Snow:class extends Nn{constructor(){super(2.25),this._params={intensity:.85,timeFactor:.75,velocityConeAperture:70,velocity:40,horizontalOscillationRadius:4,horizontalOscillationRate:1.5,boxSize:2e3,billboardSize:2,shapeFadeStart:.27,shapeFadePower:.21,screenThinning:{intensity:.4,start:.15,range:1.4,fadePower:.24,affectedRatio:1,particleOffset:-.2},color:{r:1,g:1,b:1,a:1},direction:{x:-50,y:-35}},this._vignetteParams={strength:.3,start:.78,range:.46,fadePower:.2,color:{r:1,g:1,b:1,a:1}},this.particlesCount=16e3,this._devtoolsFolder=null,this._painter=null}destroy(){super.destroy()}update(a){const t=a.context;if(!this.particlesVx){const o=Rt(this.particlesCount),c=new h.ei,d=new h.dF;let m=0;const _=h.ef(1323123451230);for(let y=0;y<o.length;++y){const v=o[y],T=_(),I=_(),P=_(),A=[y/o.length,T,I,P],D=[_(),_()];c.emplaceBack(v[0],v[1],v[2],-1,-1,...A,...D),c.emplaceBack(v[0],v[1],v[2],1,-1,...A,...D),c.emplaceBack(v[0],v[1],v[2],1,1,...A,...D),c.emplaceBack(v[0],v[1],v[2],-1,1,...A,...D),d.emplaceBack(m+0,m+1,m+2),d.emplaceBack(m+0,m+2,m+3),m+=4}this.particlesVx=t.createVertexBuffer(c,Ta.members),this.particlesIdx=t.createIndexBuffer(d)}}getDrawParams(a){if(!a.style.snow)return null;const t=a.style.snow.state,o=structuredClone(this._params);o.intensity=t.density,o.timeFactor=t.intensity,o.color=structuredClone(t.color),o.screenThinning.intensity=t.centerThinning,o.billboardSize=2.79*t.flakeSize;const c=structuredClone(this._vignetteParams);return c.strength=1,c.color=structuredClone(t.vignetteColor),{params:o,vignetteParams:c,revealParams:{revealStart:0,revealRange:.01},direction:structuredClone(t.direction)}}draw(a){const t=this.getDrawParams(a);if(!t)return;const{params:o,revealParams:c,direction:d,vignetteParams:m}=t,_=a.transform.zoom;if(c.revealStart>_)return;const y=rs(0,1,c.revealStart,c.revealStart+c.revealRange,_);m.strength*=y;const v=this.updateOnRender(a,o.timeFactor);if(!this.particlesVx||!this.particlesIdx)return;const T=a.context,I=T.gl,P=a.transform,A=a.getOrCreateProgram("snowParticle");a.uploadCommonUniforms(T,A),((D,O,L)=>{const k=pi(this._movement.getPosition(),D),N=P.width/2,H=P.height/2,Z=rs(0,L.screenThinning.start,0,1,L.screenThinning.intensity),G=rs(.001,L.screenThinning.range,0,1,L.screenThinning.intensity),ne=rs(0,L.screenThinning.particleOffset,0,1,L.screenThinning.intensity),te=(se={modelview:v.modelviewMatrix,projection:v.projectionMatrix,time:this._accumulatedTimeFromStart,camPos:k,velocityConeAperture:L.velocityConeAperture,velocity:L.velocity,horizontalOscillationRadius:L.horizontalOscillationRadius,horizontalOscillationRate:L.horizontalOscillationRate,boxSize:D,billboardSize:1*L.billboardSize,simpleShapeParameters:[L.shapeFadeStart,L.shapeFadePower],screenSize:[P.width,P.height],thinningCenterPos:[N,H],thinningShape:[Z,G,Math.pow(10,L.screenThinning.fadePower)],thinningAffectedRatio:L.screenThinning.affectedRatio,thinningParticleOffset:ne,color:[L.color.r,L.color.g,L.color.b,L.color.a],direction:d},{u_modelview:Float32Array.from(se.modelview),u_projection:Float32Array.from(se.projection),u_time:se.time,u_cam_pos:se.camPos,u_velocityConeAperture:se.velocityConeAperture,u_velocity:se.velocity,u_horizontalOscillationRadius:se.horizontalOscillationRadius,u_horizontalOscillationRate:se.horizontalOscillationRate,u_boxSize:se.boxSize,u_billboardSize:se.billboardSize,u_simpleShapeParameters:se.simpleShapeParameters,u_screenSize:se.screenSize,u_thinningCenterPos:se.thinningCenterPos,u_thinningShape:se.thinningShape,u_thinningAffectedRatio:se.thinningAffectedRatio,u_thinningParticleOffset:se.thinningParticleOffset,u_particleColor:se.color,u_direction:se.direction});var se;const J=Math.round(L.intensity*this.particlesCount),K=h.dB.simpleSegment(0,0,4*J,2*J);this.particlesVx&&this.particlesIdx&&A.draw(a,I.TRIANGLES,rt.disabled,pt.disabled,gt.alphaBlended,lt.disabled,te,"snow_particles",this.particlesVx,this.particlesIdx,K)})(o.boxSize,0,o),this._vignette.draw(a,m)}},shaders:tg,programUniforms:Sa};function Ju(a){return[a[0]*h.ej,a[1]*h.ej,a[2]*h.ej,0]}function Oc(a,t,o,c,d,m,_,y,v){const T=c.getSource(),I=o.globeSharedBuffers;if(!I)return;let P,A,D;if(t&&(P=c.getTile(t)),T instanceof h.aY?(A=T.texture,D=h.dz(0,0,o.transform)):P&&t&&(A=P.texture,D=h.dz(t.canonical.z,t.canonical.x,o.transform)),!A||!D)return;a||(D=h.cE(h.bd(),D,[1,-1,1]));const O=o.context,L=O.gl,k=d.paint.get("raster-resampling")==="nearest"?L.NEAREST:L.LINEAR,N=o.colorModeForDrapableLayerRenderPass(m),H=_.defines;H.push("GLOBE_POLES");const Z=new rt(L.LEQUAL,rt.ReadWrite,o.depthRangeFor3D),G=o.transform.expandedFarZProjMatrix,ne=Float32Array.from(h.dx(h.dy(new h.cp(0,0,0))));o.terrain&&o.terrain.prepareDrawTile(),O.activeTexture.set(L.TEXTURE0),A.bind(k,L.CLAMP_TO_EDGE),O.activeTexture.set(L.TEXTURE1),A.bind(k,L.CLAMP_TO_EDGE),"useMipmap"in A&&O.extTextureFilterAnisotropic&&o.transform.pitch>20&&L.texParameterf(L.TEXTURE_2D,O.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,O.extTextureFilterAnisotropicMax);const[te,se,J,K]=t?I.getPoleBuffers(t.canonical.z,!1):I.getPoleBuffers(0,!0),oe=d.paint.get("raster-elevation");let de;a?(de=te,o.renderDefaultNorthPole=oe!==0):(de=se,o.renderDefaultSouthPole=oe!==0);const ue=Ju(_.mix),ve=((ke,fe,Ee,pe,Pe,Ce,Re,Ye,qe,je,Be,at,ot,tt)=>ju(ke,fe,Ee,pe,new Float32Array(16),new Float32Array(9),[0,0],Pe,[0,0],[0,0,0,0],1,{opacity:1,mix:0},Re,[0,0],qe,2,Be,at,ot,1,0,tt))(o,G,ne,D,h.ai(o.transform.zoom),0,d,0,oe,0,ue,_.offset,_.range,m),be=o.getOrCreateProgram("raster",{defines:H});o.uploadCommonUniforms(O,be,null),be.draw(o,L.TRIANGLES,Z,v,N,y,ve,d.id,de,J,K)}function Ld(a){if(a.isOrthographic)return[0,0,0,0];const t=a._nearZ,o=a.projection.farthestPixelDistance(a),c=o-t,d=.2*a.height,m=t+d;return[t,o,(m-d-t)/c,(m-t)/c]}function Od(a,t,o,c){if(a)return t instanceof ft&&a instanceof Ss?t.getTextureDescriptor(a,o,!0):{texture:a.texture,mix:Ju(c.mix),offset:c.offset,buffer:0,tileSize:1}}const Fd=h.bA(new Float32Array(16)),En=new h.C(1,0,0,1),Ls=new h.C(0,1,0,1),Sl=new h.C(0,0,1,1),Ku=new h.C(1,0,1,1),Bd=new h.C(0,1,1,1);function kd(a,t,o,c,d,m,_){const y=a.context,v=a.transform,T=y.gl,I=v.projection.name==="globe",P=I?["PROJECTION_GLOBE_VIEW"]:[];let A=h.bb(o.projMatrix);if(I&&h.ai(v.zoom)>0){const ue=h.ek(o.canonical,v),ve=h.el(ue);A=h.aC(new Float32Array(16),v.globeMatrix,ve),h.aC(A,v.projMatrix,A)}const D=h.bd();D[12]+=2*d/(h.o.devicePixelRatio*v.width),D[13]+=2*m/(h.o.devicePixelRatio*v.height),h.aC(A,D,A);const O=a.getOrCreateProgram("debug",{defines:P}),L=t.getTileByID(o.key);a.terrain&&a.terrain.setupElevationDraw(L,O);const k=rt.disabled,N=pt.disabled,H=a.colorModeForRenderPass(),Z="$debug";y.activeTexture.set(T.TEXTURE0),a.emptyTexture.bind(T.LINEAR,T.CLAMP_TO_EDGE),I?L._makeGlobeTileDebugBuffers(a.context,v):L._makeDebugTileBoundsBuffers(a.context,v.projection);const G=L._tileDebugBuffer||a.debugBuffer,ne=L._tileDebugIndexBuffer||a.debugIndexBuffer,te=L._tileDebugSegments||a.debugSegments;if(O.draw(a,T.LINE_STRIP,k,N,H,lt.disabled,Uu(A,c.toPremultipliedRenderColor(null)),Z,G,ne,te,null,null,null,[L._globeTileDebugBorderBuffer]),_){const ue=L.latestRawTileData,ve=Math.floor((ue&&ue.byteLength||0)/1024);let be=o.canonical.toString();o.overscaledZ!==o.canonical.z&&(be+=` => ${o.overscaledZ}`),be+=` ${L.state}`,be+=` ${ve}kb`,(function(ke,fe){ke.initDebugOverlayCanvas();const Ee=ke.debugOverlayCanvas,pe=ke.context.gl,Pe=ke.debugOverlayCanvas.getContext("2d");Pe.clearRect(0,0,Ee.width,Ee.height),Pe.shadowColor="white",Pe.shadowBlur=2,Pe.lineWidth=1.5,Pe.strokeStyle="white",Pe.textBaseline="top",Pe.font="bold 36px Open Sans, sans-serif",Pe.fillText(fe,5,5),Pe.strokeText(fe,5,5),ke.debugOverlayTexture.update(Ee),ke.debugOverlayTexture.bind(pe.LINEAR,pe.CLAMP_TO_EDGE)})(a,be)}const se=t.getTile(o).tileSize,J=512/Math.min(se,512)*(o.overscaledZ/v.zoom)*.5,K=L._tileDebugTextBuffer||a.debugBuffer,oe=L._tileDebugTextIndexBuffer||a.quadTriangleIndexBuffer,de=L._tileDebugTextSegments||a.debugSegments;O.draw(a,T.TRIANGLES,k,N,gt.alphaBlended,lt.disabled,Uu(A,h.C.transparent.toPremultipliedRenderColor(null),J),Z,K,oe,de,null,null,null,[L._globeTileDebugTextBuffer])}function ns(a,t,o,c){en(a,0,t+o/2,a.transform.width,o,c)}function Qu(a,t,o,c){en(a,t-o/2,0,o,a.transform.height,c)}function en(a,t,o,c,d,m){const _=a.context,y=_.gl;y.enable(y.SCISSOR_TEST),y.scissor(t*h.o.devicePixelRatio,o*h.o.devicePixelRatio,c*h.o.devicePixelRatio,d*h.o.devicePixelRatio),_.clear({color:m}),y.disable(y.SCISSOR_TEST)}const Nd=h.ea([{name:"a_pos_3f",components:3,type:"Float32"}]),{members:eh}=Nd;function Po(a,t,o,c){a.emplaceBack(t,o,c)}class th{constructor(t){this.vertexArray=new h.em,this.indices=new h.dF,Po(this.vertexArray,-1,-1,1),Po(this.vertexArray,1,-1,1),Po(this.vertexArray,-1,1,1),Po(this.vertexArray,1,1,1),Po(this.vertexArray,-1,-1,-1),Po(this.vertexArray,1,-1,-1),Po(this.vertexArray,-1,1,-1),Po(this.vertexArray,1,1,-1),this.indices.emplaceBack(5,1,3),this.indices.emplaceBack(3,7,5),this.indices.emplaceBack(6,2,0),this.indices.emplaceBack(0,4,6),this.indices.emplaceBack(2,6,7),this.indices.emplaceBack(7,3,2),this.indices.emplaceBack(5,4,0),this.indices.emplaceBack(0,1,5),this.indices.emplaceBack(0,2,3),this.indices.emplaceBack(3,1,0),this.indices.emplaceBack(7,6,4),this.indices.emplaceBack(4,5,7),this.vertexBuffer=t.createVertexBuffer(this.vertexArray,eh),this.indexBuffer=t.createIndexBuffer(this.indices),this.segment=h.dB.simpleSegment(0,0,36,12)}}function Ai(a,t,o,c,d,m){const _=a.context.gl,y=t.paint.get("sky-atmosphere-color"),v=t.paint.get("sky-atmosphere-halo-color"),T=t.paint.get("sky-atmosphere-sun-intensity"),I=((P,A,D,O,L)=>({u_matrix_3f:P,u_sun_direction:A,u_sun_intensity:D,u_color_tint_r:[O.r,O.g,O.b,O.a],u_color_tint_m:[L.r,L.g,L.b,L.a],u_luminance:5e-5}))(h.ep(h.dH(),c),d,T,y.toPremultipliedRenderColor(null),v.toPremultipliedRenderColor(null));_.framebufferTexture2D(_.FRAMEBUFFER,_.COLOR_ATTACHMENT0,_.TEXTURE_CUBE_MAP_POSITIVE_X+m,t.skyboxTexture,0),o.draw(a,_.TRIANGLES,rt.disabled,pt.disabled,gt.unblended,lt.frontCW,I,"skyboxCapture",t.skyboxGeometry.vertexBuffer,t.skyboxGeometry.indexBuffer,t.skyboxGeometry.segment)}const Ud=h.ea([{type:"Float32",name:"a_pos",components:3},{type:"Float32",name:"a_uv",components:2}]);class Vd{constructor(t){const o=new h.eq;o.emplaceBack(-1,1,1,0,0),o.emplaceBack(1,1,1,1,0),o.emplaceBack(1,-1,1,1,1),o.emplaceBack(-1,-1,1,0,1);const c=new h.dF;c.emplaceBack(0,1,2),c.emplaceBack(2,3,0),this.vertexBuffer=t.createVertexBuffer(o,Ud.members),this.indexBuffer=t.createIndexBuffer(c),this.segments=h.dB.simpleSegment(0,0,4,2)}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy()}}const jd=h.ea([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_size_scale",components:1},{type:"Float32",name:"a_opacity",components:1}]);class Ia{constructor(){this.colorModeAlphaBlendedWriteRGB=new gt([1,Eo,1,Eo],h.C.transparent,[!0,!0,!0,!1]),this.colorModeWriteAlpha=new gt([1,0,1,0],h.C.transparent,[!1,!1,!1,!0]),this.params={starsCount:16e3,sizeMultiplier:.15,sizeRange:100,intensityRange:200},this.updateNeeded=!0,this._painter=null,this._devtoolsFolder=null}update(t){this._painter=t;const o=t.context;if(!this.atmosphereBuffer||this.updateNeeded){this.updateNeeded=!1,this.atmosphereBuffer=new Vd(o);let c=this.params;const d=c.sizeRange,m=c.intensityRange,_=(function(P){const A=h.ef(30),D=[];for(let O=0;O<P;++O){const L=2*Math.PI*A(),k=Math.acos(1-2*A())-.5*Math.PI;D.push(h.cU(Math.cos(k)*Math.cos(L),Math.cos(k)*Math.sin(L),Math.sin(k)))}return D})(c.starsCount),y=h.ef(300),v=new h.er,T=new h.dF;let I=0;for(let P=0;P<_.length;++P){const A=h.bN([],_[P],200),D=Math.max(0,1+.01*d*(1*y()-.5)),O=Math.max(0,1+.01*m*(1*y()-.5));v.emplaceBack(A[0],A[1],A[2],-1,-1,D,O),v.emplaceBack(A[0],A[1],A[2],1,-1,D,O),v.emplaceBack(A[0],A[1],A[2],1,1,D,O),v.emplaceBack(A[0],A[1],A[2],-1,1,D,O),T.emplaceBack(I+0,I+1,I+2),T.emplaceBack(I+0,I+2,I+3),I+=4}this.starsVx=o.createVertexBuffer(v,jd.members),this.starsIdx=o.createIndexBuffer(T),this.starsSegments=h.dB.simpleSegment(0,0,v.length,T.length)}}destroy(){this.atmosphereBuffer&&this.atmosphereBuffer.destroy(),this.starsVx&&this.starsVx.destroy(),this.starsIdx&&this.starsIdx.destroy(),this._painter=null}drawAtmosphereGlow(t,o){const c=t.context,d=c.gl,m=t.transform,_=new rt(d.LEQUAL,rt.ReadOnly,[0,1]),y=h.ai(m.zoom),v=t.style.getLut(o.scope),T=o.properties.get("color-use-theme")==="none",I=o.properties.get("color").toNonPremultipliedRenderColor(T?null:v),P=o.properties.get("high-color-use-theme")==="none",A=o.properties.get("high-color").toNonPremultipliedRenderColor(P?null:v),D=o.properties.get("space-color-use-theme")==="none",O=o.properties.get("space-color").toNonPremultipliedRenderColor(D?null:v),L=5e-4,k=h.es(o.properties.get("horizon-blend"),0,1,L,.25),N=h.ds(t,c,m)&&k===L?m.worldSize/(2*Math.PI*1.025)-1:m.globeRadius,H=t.frameCounter/1e3%1,Z=h.af(m.globeCenterInViewSpace),G=Math.sqrt(Math.pow(Z,2)-Math.pow(N,2)),ne=Math.acos(G/Z),te=se=>{const J=m.projection.name==="globe"?["PROJECTION_GLOBE_VIEW","FOG"]:["FOG"];se&&J.push("ALPHA_PASS");const K=t.getOrCreateProgram("globeAtmosphere",{defines:J}),oe=((ue,ve,be,ke,fe,Ee,pe,Pe,Ce,Re,Ye,qe)=>({u_frustum_tl:ue,u_frustum_tr:ve,u_frustum_br:be,u_frustum_bl:ke,u_horizon:fe,u_transition:Ee,u_fadeout_range:pe,u_atmosphere_fog_color:Pe.toArray01(),u_high_color:Ce.toArray01(),u_space_color:Re.toArray01(),u_temporal_offset:Ye,u_horizon_angle:qe}))(m.frustumCorners.TL,m.frustumCorners.TR,m.frustumCorners.BR,m.frustumCorners.BL,m.frustumCorners.horizon,y,k,I,A,O,H,ne);t.uploadCommonUniforms(c,K);const de=this.atmosphereBuffer;de&&K.draw(t,d.TRIANGLES,_,pt.disabled,se?this.colorModeWriteAlpha:this.colorModeAlphaBlendedWriteRGB,lt.backCW,oe,se?"atmosphere_glow_alpha":"atmosphere_glow",de.vertexBuffer,de.indexBuffer,de.segments)};te(!1),te(!0)}drawStars(t,o){const c=h.aB(o.properties.get("star-intensity"),0,1);if(c===0)return;const d=t.context,m=d.gl,_=t.transform,y=t.getOrCreateProgram("stars"),v=h.bP([]);h.bR(v,v,-_._pitch),h.bQ(v,v,-_.angle),h.bR(v,v,h.am(_._center.lat)),h.et(v,v,-h.am(_._center.lng));const T=h.bV(new Float32Array(16),v),I=h.aC([],_.starsProjMatrix,T),P=h.ep([],T),A=h.eu([],P);let D=this.params.sizeMultiplier;const O=[0,1,0];h.dJ(O,O,A),h.bN(O,O,D);const L=[1,0,0];h.dJ(L,L,A),h.bN(L,L,D);const k=(N=O,H=L,Z=c,{u_matrix:Float32Array.from(I),u_up:N,u_right:H,u_intensity_multiplier:Z});var N,H,Z;t.uploadCommonUniforms(d,y),this.starsVx&&this.starsIdx&&y.draw(t,m.TRIANGLES,rt.disabled,pt.disabled,this.colorModeAlphaBlendedWriteRGB,lt.disabled,k,"atmosphere_stars",this.starsVx,this.starsIdx,this.starsSegments)}}class Gd{constructor(){this.visibleTiles=[]}updateBorders(t,o){const c=[],d=[],m=t._getRenderableCoordinates(!1,!0);for(const v of m){const T=t.getTile(v);if(!T.hasData())continue;const I=T.getBucket(o);I&&(I.isEmpty()||(c.push(v.key),d.push({bucket:I,tileID:v.canonical})))}let _=c.length!==this.visibleTiles.length;if(!_){c.sort();for(let v=0;v<c.length;v++)if(c[v]!==this.visibleTiles[v]){_=!0;break}}if(!_)return;const y=new Set;this.visibleTiles=c,d.sort((v,T)=>v.tileID.z-T.tileID.z||v.tileID.x-T.tileID.x||v.tileID.y-T.tileID.y);for(const v of d){const T=new Array,I=new Array,P=v.bucket;for(const A of P.featuresOnBorder)y.has(A.featureId)?I.push(A.footprintIndex):(y.add(A.featureId),T.push(A.footprintIndex));P.updateFootprintHiddenFlags(T,h.ev,!1),P.updateFootprintHiddenFlags(I,h.ev,!0)}}}const tn=new Float64Array(16),Un=new Float64Array(16),Os=new Float64Array(16),$d=new Float32Array(16),os=[0,0,0];function ih(a,t,o){const c=o.cameraWorldSizeForFog/o.worldSize;return h.cE(a,o.worldToFogMatrix,[c,c,1]),h.aC(a,a,t),a}function Ea(a,t,o,c,d){const m=o.material,_=c.context,{baseColorTexture:y,metallicRoughnessTexture:v}=m.pbrMetallicRoughness,{normalTexture:T,occlusionTexture:I,emissionTexture:P}=m;function A(O,L,k){if(O&&(a.push(L),_.activeTexture.set(_.gl.TEXTURE0+k),O.gfxTexture)){const{minFilter:N,magFilter:H,wrapS:Z,wrapT:G}=O.sampler;O.gfxTexture.bindExtraParam(N,H,Z,G)}}A(y,"HAS_TEXTURE_u_baseColorTexture",5),A(v,"HAS_TEXTURE_u_metallicRoughnessTexture",6),A(T,"HAS_TEXTURE_u_normalTexture",7),A(I,"HAS_TEXTURE_u_occlusionTexture",8),A(P,"HAS_TEXTURE_u_emissionTexture",9),d&&(d.texture||(d.texture=new h.dU(c.context,d.image,[d.image.height,d.image.height,d.image.height],_.gl.RGBA8)),_.activeTexture.set(_.gl.TEXTURE0+10),d.texture&&d.texture.bind(_.gl.LINEAR,_.gl.CLAMP_TO_EDGE),a.push("APPLY_LUT_ON_GPU")),o.texcoordBuffer&&(a.push("HAS_ATTRIBUTE_a_uv_2f"),t.push(o.texcoordBuffer)),o.colorBuffer&&(a.push(o.colorBuffer.itemSize===12?"HAS_ATTRIBUTE_a_color_3f":"HAS_ATTRIBUTE_a_color_4f"),t.push(o.colorBuffer)),o.normalBuffer&&(a.push("HAS_ATTRIBUTE_a_normal_3f"),t.push(o.normalBuffer)),o.pbrBuffer&&(a.push("HAS_ATTRIBUTE_a_pbr"),a.push("HAS_ATTRIBUTE_a_heightBasedEmissiveStrength"),t.push(o.pbrBuffer)),m.alphaMode!=="OPAQUE"&&m.alphaMode!=="MASK"||a.push("UNPREMULT_TEXTURE_IN_SHADER"),m.defined||a.push("DIFFUSE_SHADED");const D=c.shadowRenderer;D&&(a.push("RENDER_SHADOWS"),D.useNormalOffset&&a.push("NORMAL_OFFSET"))}function Il(a,t,o,c,d,m){const _=a.modelOpacity,y=t.context,v=new rt(t.context.gl.LEQUAL,a.isLightMesh?rt.ReadOnly:rt.ReadWrite,t.depthRangeFor3D),T=t.transform,I=a.mesh,P=I.material,A=P.pbrMetallicRoughness,D=t.style.fog;t.transform.projection.zAxisUnit==="pixels"?tn.set(a.nodeModelMatrix):h.aC(tn,c.zScaleMatrix,a.nodeModelMatrix),h.aC(tn,c.negCameraPosMatrix,tn),h.ba(Un,tn),h.e9(Un,Un);const O=o.paint.get("model-color-use-theme").constantOr("default")==="none",L=o.paint.get("model-emissive-strength").constantOr(0),k=$u(a.worldViewProjection,tn,Un,null,t,_,A.baseColorFactor,P.emissiveFactor,A.metallicFactor,A.roughnessFactor,P,L,o,void 0,void 0,a.materialOverride,a.modelColor),N={defines:[]},H=[],Z=t.shadowRenderer;Z&&(Z.useNormalOffset=!1),Ea(N.defines,H,I,t,O?null:o.lut);let G=null;if(D&&(G=ih(Os,a.nodeModelMatrix,t.transform),T.projection.name!=="globe")){const se=I.aabb.min,J=I.aabb.max,[K,oe]=D.getOpacityForBounds(G,se[0],se[1],J[0],J[1]);N.overrideFog=K>=Yo||oe>=Yo}const ne=In(t,o.paint.get("model-cutoff-fade-range"));ne.shouldRenderCutoff&&N.defines.push("RENDER_CUTOFF");const te=t.getOrCreateProgram("model",N);t.uploadCommonUniforms(y,te,null,G,ne),t.renderPass!=="shadow"&&Z&&Z.setupShadowsFromMatrix(a.nodeModelMatrix,te),te.draw(t,y.gl.TRIANGLES,v,d,m,I.material.doubleSided?lt.disabled:lt.backCCW,k,o.id,I.vertexBuffer,I.indexBuffer,I.segments,o.paint,t.transform.zoom,void 0,H)}function Fc(a,t){return a.style._importedAsBasemap?"basemap":t.scope}function rh(a,t,o,c,d,m,_,y,v,T){const I=a.transform,P=!!t.isGeometryBloom&&t.isGeometryBloom;if(P&&a.renderPass==="shadow")return;const A=I.projection.name==="globe"?h.eD(o,I):[...o];h.aC(A,A,t.globalMatrix);const D=h.aC([],c,A);if(t.meshes)for(const O of t.meshes){const L=y.get(O.material.name);if(L&&L.opacity<=0)continue;if(O.material.alphaMode!=="BLEND"){_.push({mesh:O,depth:0,modelIndex:d,worldViewProjection:D,nodeModelMatrix:A,isLightMesh:P,materialOverride:L,modelOpacity:v,modelColor:T,node:t,modelMatrix:o});continue}const k=h.ae([],O.centroid,D);!I.isOrthographic&&k[2]<=0||m.push({mesh:O,depth:k[2],modelIndex:d,worldViewProjection:D,nodeModelMatrix:A,isLightMesh:P,materialOverride:L,modelOpacity:v,modelColor:T,node:t,modelMatrix:o})}if(t.children)for(const O of t.children)rh(a,O,o,c,d,m,_,y,v,T)}function Aa(a,t,o,c){const d=o.shadowRenderer;if(!d)return;const m=d.getShadowPassDepthMode(),_=d.calculateShadowPassMatrixFromMatrix(t),y=Jp(_);o.getOrCreateProgram("modelDepth").draw(o,o.context.gl.TRIANGLES,m,pt.disabled,gt.disabled,lt.disabled,y,c.id,a.vertexBuffer,a.indexBuffer,a.segments,c.paint,o.transform.zoom,void 0,void 0)}function Hd(a,t,o,c){const d=(function(I,P){if(P.footprintDebugMesh)return P.footprintDebugMesh;if(!P.footprint)return null;const A=I.context,D=P.footprint.vertices,O=P.footprint.indices,L=new h.dE;L.reserve(D.length);for(const oe of D)L.emplaceBack(oe.x,oe.y);const k=new h.dF;k.reserve(O.length);for(let oe=0;oe<O.length;oe+=3)k.emplaceBack(O[oe],O[oe+1],O[oe+2]);const N=A.createVertexBuffer(L,h.dA.members),H=A.createIndexBuffer(k),Z=h.dB.simpleSegment(0,0,D.length,O.length),G=P.id||P.name||"footprint";let ne;const te=parseInt(G,10);ne=isNaN(te)?(function(oe){let de=0;for(let ue=0;ue<oe.length;ue++)de=(de<<5)-de+oe.charCodeAt(ue)|0;return de})(G):te;const se=h.ed(ne),J=h.ed(ne+1),K=h.ed(ne+2);return P.footprintDebugMesh={vertexBuffer:N,indexBuffer:H,segments:Z,color:new h.C(se,J,K,.5)},P.footprintDebugMesh})(a,o);if(!d)return;const m=a.context,_=m.gl,y=a.getOrCreateProgram("debug"),v=d.color,T=rt.disabled;m.activeTexture.set(_.TEXTURE0),a.emptyTexture.bind(_.LINEAR,_.CLAMP_TO_EDGE),y.draw(a,_.TRIANGLES,T,pt.disabled,gt.alphaBlended,lt.disabled,Uu(c,v.toPremultipliedRenderColor(null)),"$debug",d.vertexBuffer,d.indexBuffer,d.segments)}function cm(a,t,o,c,d,m){for(const _ of d){const y=Object.assign({},c);y.part=_;const v={type:"Unknown",id:t,properties:y},T={orientation:a.paint.get("model-rotation").evaluate(v,o)};m.set(_,T)}}function um(a,t,o,c,d,m){for(const _ of d){const y=Object.assign({},c);y.part=_;const v={type:"Unknown",id:t,properties:y},T={color:a.paint.get("model-color").evaluate(v,o),colorMix:a.paint.get("model-color-mix-intensity").evaluate(v,o),opacity:a.paint.get("model-opacity").evaluate(v,o),emissionStrength:a.paint.get("model-emissive-strength").evaluate(v,o)};m.set(_,T)}}function qd(a,t,o,c,d){let m=!1;for(const y of c)y.modelOpacity!==1&&(Il(y,a,t,d[y.modelIndex],pt.disabled,gt.disabled),m=!0);for(const y of c)Il(y,a,t,d[y.modelIndex],y.modelOpacity!==1?a.stencilModeFor3D():pt.disabled,a.colorModeForRenderPass());m&&a.resetStencilClippingMasks();const _=gt.additive;for(const y of o)Il(y,a,t,d[y.modelIndex],pt.disabled,y.isLightMesh?_:a.colorModeForRenderPass())}function hm(a,t,o){const c=t.updateZoomBasedPaintProperties(),d=(function(m,_,y){let v,T,I,P=m.terrain?m.terrain.exaggeration():0;if(m.terrain&&P>0){const A=m.terrain,D=A.findDEMTileFor(y);D&&D.dem?v=h.eF.create(A,y,D):P=0}if(P===0&&(_.terrainElevationMin=0,_.terrainElevationMax=0),P===_.validForExaggeration&&(P===0||v&&v._demTile&&v._demTile.tileID===_.validForDEMTile.id&&v._dem._timestamp===_.validForDEMTile.timestamp))return!1;for(const A in _.instancesPerModel){const D=_.instancesPerModel[A];for(let O=0;O<D.instancedDataArray.length;++O){const L=(v?P*v.getElevationAt(0|D.instancedDataArray.float32[16*O],0|D.instancedDataArray.float32[16*O+1],!0,!0):0)+D.instancesEvaluatedElevation[O];D.instancedDataArray.float32[16*O+6]=L,T=T?Math.min(_.terrainElevationMin,L):L,I=I?Math.max(_.terrainElevationMax,L):L}}return _.terrainElevationMin=T||0,_.terrainElevationMax=I||0,_.validForExaggeration=P,_.validForDEMTile=v&&v._demTile?{id:v._demTile.tileID,timestamp:v._dem._timestamp}:{id:void 0,timestamp:0},!0})(a,t,o);(c||d)&&(t.uploaded=!1,t.upload(a.context))}const co={shadowUniformsInitialized:!1,useSingleShadowCascade:!1,tileMatrix:new Float64Array(16),shadowTileMatrix:new Float32Array(16),aabb:new h.cY([0,0,0],[h.ak,h.ak,0])};function dm(a,t){const o=1<<a.canonical.z,c=t.getFreeCameraOptions().position,d=t.elevation,m=a.canonical.x/o,_=(a.canonical.x+1)/o,y=a.canonical.y/o,v=(a.canonical.y+1)/o;let T=t._centerAltitude;if(d){const D=d.getMinMaxForTile(a);D&&D.max>T&&(T=D.max)}const I=h.aB(c.x,m,_)-c.x,P=h.aB(c.y,y,v)-c.y,A=h.bY(T,t.center.lat)-c.z;return t._zoomFromMercatorZ(Math.sqrt(I*I+P*P+A*A))}function Zd(a,t,o,c,d,m,_){const y=a.context,v=a.renderPass==="shadow",T=a.shadowRenderer,I=v&&T?T.getShadowPassDepthMode():new rt(y.gl.LEQUAL,rt.ReadWrite,a.depthRangeFor3D),P=a.isTileAffectedByFog(m),A=a.transform.projection.name==="globe";if(o.meshes)for(const D of o.meshes){const O=A?[]:["MODEL_POSITION_ON_GPU"],L=[];let k,N,H;const Z=!A&&c.instancedDataArray.length>20;Z&&O.push("INSTANCED_ARRAYS");const G=In(a,t.paint.get("model-cutoff-fade-range"));if(G.shouldRenderCutoff&&O.push("RENDER_CUTOFF"),v&&T)k=a.getOrCreateProgram("modelDepth",{defines:O}),N=Jp(_.shadowTileMatrix,_.shadowTileMatrix,o.globalMatrix),H=gt.disabled;else{Ea(O,L,D,a,t.paint.get("model-color-use-theme").constantOr("default")==="none"?null:t.lut),k=a.getOrCreateProgram("model",{defines:O,overrideFog:P});const te=D.material,se=te.pbrMetallicRoughness,J=t.paint.get("model-opacity").constantOr(1),K=t.paint.get("model-emissive-strength").constantOr(0);N=$u(m.expandedProjMatrix,o.globalMatrix,$d,null,a,J,se.baseColorFactor,te.emissiveFactor,se.metallicFactor,se.roughnessFactor,te,K,t,d),T&&(_.shadowUniformsInitialized?k.setShadowUniformValues(y,T.getShadowUniformValues()):(T.setupShadows(m.toUnwrapped(),k,"model-tile"),_.shadowUniformsInitialized=!0)),H=G.shouldRenderCutoff||J<1||te.alphaMode!=="OPAQUE"?gt.alphaBlended:gt.unblended}a.uploadCommonUniforms(y,k,m.toUnwrapped(),null,G);const ne=D.material.doubleSided?lt.disabled:lt.backCCW;if(Z)L.push(c.instancedDataBuffer),k.draw(a,y.gl.TRIANGLES,I,pt.disabled,H,ne,N,t.id,D.vertexBuffer,D.indexBuffer,D.segments,t.paint,a.transform.zoom,void 0,L,c.instancedDataArray.length);else{const te=v?"u_instance":"u_normal_matrix";for(let se=0;se<c.instancedDataArray.length;++se)N[te]=new Float32Array(c.instancedDataArray.arrayBuffer,64*se,16),k.draw(a,y.gl.TRIANGLES,I,pt.disabled,H,ne,N,t.id,D.vertexBuffer,D.indexBuffer,D.segments,t.paint,a.transform.zoom,void 0,L)}}if(o.children)for(const D of o.children)Zd(a,t,D,c,d,m,_)}const fm=[1,-1,1];function pm(a,t,o,c){const d=a.node;if(d.lodMeshes&&d.lodMeshes.length>0)if(a.targetLod<0)a.targetLod=t>c?1:0;else{const m=o/1e3;a.targetLod=t>c?Math.min(a.targetLod+m,1):Math.max(a.targetLod-m,0)}else a.targetLod=0}function mm(a,t,o,c){if(!o.modelManager)return!0;const d=o.modelManager;if(!o.shadowRenderer)return!0;const m=o.shadowRenderer,_=t.aabb;let y=!0,v=a.maxHeight;if(v===0){let I=0;for(const P in a.instancesPerModel){const A=d.getModel(P,c);A?I=Math.max(I,Math.max(Math.max(A.aabb.max[0],A.aabb.max[1]),A.aabb.max[2])):y=!1}v=a.maxScale*I*1.41+a.maxVerticalOffset,y&&(a.maxHeight=v)}_.max[2]=v,_.min[2]+=a.terrainElevationMin,_.max[2]+=a.terrainElevationMax,h.ae(_.min,_.min,t.tileMatrix),h.ae(_.max,_.max,t.tileMatrix);const T=_.intersects(m.getCurrentCascadeFrustum());return o.currentShadowCascade===0&&(a.isInsideFirstShadowMapFrustum=T===2),T===0}function ng(a,t){const o=a.uniformValues.u_cutoff_params[0],c=a.uniformValues.u_cutoff_params[1],d=a.uniformValues.u_cutoff_params[2],m=a.uniformValues.u_cutoff_params[3];return c===o||m===d?1:h.aB(((t-o)/(c-o)-d)/(m-d),0,1)}function og(a,t,o,c){if(t.pitch<20)return 1;const d=t.getWorldToCameraMatrix();h.aC(d,d,a);const m=h.bw(o.min[0],o.min[1],o.min[2],1);let _=h.aD(h.bI(),m,d),y=_,v=_;m[1]=o.max[1],_=h.aD(h.bI(),m,d),y=_[1]<y[1]?_:y,v=_[1]>v[1]?_:v,m[0]=o.max[0],_=h.aD(h.bI(),m,d),y=_[1]<y[1]?_:y,v=_[1]>v[1]?_:v,m[1]=o.min[1],_=h.aD(h.bI(),m,d),y=_[1]<y[1]?_:y,v=_[1]>v[1]?_:v;const T=h.aB(c[0],0,1),I=100*t.pixelsPerMeter*h.aB(c[1],0,1),P=h.aB(c[2],0,1),A=h.eG(h.bI(),y,v,T),D=Math.tan(.5*t.fovX),O=-A[2]*D;if(I===0)return A[1]<-Math.abs(O)?P:1;const L=(-Math.abs(O)-A[1])/I,k=(H,Z,G)=>(1-G)*H+G*Z,N=h.aB(k(1,P,L),P,1);return k(1,N,h.aB((t.pitch-20)/20,0,1))}class sg{}class di{constructor(){this._storage=new Map}getLinesFromTrianglesBuffer(t,o,c){{const P=this._storage.get(o.id);if(P)return P.lastUsedFrameIdx=t,P.buf}const d=c.gl,m=d.getBufferParameter(d.ELEMENT_ARRAY_BUFFER,d.BUFFER_SIZE),_=new ArrayBuffer(m),y=new Int16Array(_);d.getBufferSubData(d.ELEMENT_ARRAY_BUFFER,0,new Int16Array(_));const v=new h.eI;for(let P=0;P<m/2;P+=3){const A=y[P],D=y[P+1],O=y[P+2];v.emplaceBack(A,D),v.emplaceBack(D,O),v.emplaceBack(O,A)}const T=c.bindVertexArrayOES.current,I=new sg;return I.buf=new Ps(c,v),I.lastUsedFrameIdx=t,this._storage.set(o.id,I),c.bindVertexArrayOES.set(T),I.buf}update(t){for(const[o,c]of this._storage)t-c.lastUsedFrameIdx>30&&(c.buf.destroy(),this._storage.delete(o))}destroy(){for(const[t,o]of this._storage)o.buf.destroy(),this._storage.delete(t)}}class El{constructor(){this.occluderSize=30,this.depthOffset=-1e-4}}const nh={symbol:function(a,t,o,c,d){if(a.renderPass!=="translucent")return;const m=pt.disabled,_=a.colorModeForRenderPass(),y=o.layout.get("text-variable-anchor"),v=o.layout.get("text-size-scale-range"),T=h.aB(a.scaleFactor,v[0],v[1]);y&&(function(A,D,O,L,k,N,H,Z){const G=D.transform,ne=k==="map",te=N==="map";for(const se of A){const J=L.getTile(se),K=J.getBucket(O);if(!K||!K.text||!K.text.segments.get().length)continue;const oe=h.bl(K.textSizeData,G.zoom,Z),de=Vr(se,K.getProjection(),G),ue=G.calculatePixelsToTileUnitsMatrix(J),ve=Ji(de,J.tileID.canonical,te,ne,G,K.getProjection(),ue),be=K.hasIconTextFit()&&K.hasIconData();oe&&Qp(K,ne,te,H,G,ve,se,Math.pow(2,G.zoom-J.tileID.overscaledZ),oe,be)}})(c,a,o,t,o.layout.get("text-rotation-alignment"),o.layout.get("text-pitch-alignment"),d,T);const I=o.paint.get("icon-opacity").constantOr(1)!==0,P=o.paint.get("text-opacity").constantOr(1)!==0;o.layout.get("symbol-sort-key").constantOr(1)!==void 0&&(I||P)?ao(a,t,o,c,m,_):(I&&ao(a,t,o,c,m,_,{onlyIcons:!0}),P&&ao(a,t,o,c,m,_,{onlyText:!0})),t.map.showCollisionBoxes&&(Ad(a,t,o,c,o.paint.get("text-translate"),o.paint.get("text-translate-anchor"),!0),Ad(a,t,o,c,o.paint.get("icon-translate"),o.paint.get("icon-translate-anchor"),!1))},circle:function(a,t,o,c){if(a.renderPass!=="translucent")return;const d=o.paint.get("circle-opacity"),m=o.paint.get("circle-stroke-width"),_=o.paint.get("circle-stroke-opacity"),y=o.layout.get("circle-sort-key").constantOr(1)!==void 0,v=o.paint.get("circle-emissive-strength");if(d.constantOr(1)===0&&(m.constantOr(1)===0||_.constantOr(1)===0))return;const T=a.context,I=T.gl,P=a.transform,A=!(!a.terrain||!a.terrain.enabled),D=o.layout.get("circle-elevation-reference"),O=a.depthModeForSublayer(0,rt.ReadOnly),L=new rt(a.context.gl.LEQUAL,rt.ReadOnly,a.depthRangeFor3D),k=D==="none"||A?O:L,N=pt.disabled,H=a.colorModeForDrapableLayerRenderPass(v),Z=P.projection.name==="globe",G=[h.aG(P.center.lng),h.aJ(P.center.lat)],ne=[];for(let se=0;se<c.length;se++){const J=c[se],K=t.getTile(J),oe=K.getBucket(o);if(!oe||oe.projection.name!==P.projection.name)continue;const de=oe.programConfigurations.get(o.id),ue=oe.layoutVertexBuffer,ve=oe.globeExtVertexBuffer,be=oe.indexBuffer,ke=h.dV(o),fe=[ve],Ee=a.isTileAffectedByFog(J);Z&&ke.push("PROJECTION_GLOBE_VIEW"),ke.push("DEPTH_D24"),a.terrain&&P.depthOcclusionForSymbolsAndCircles&&ke.push("DEPTH_OCCLUSION"),oe.hasElevation&&!a.terrain&&(ke.push("ELEVATED_ROADS"),fe.push(oe.elevatedLayoutVertexBuffer));const pe=a.getOrCreateProgram("circle",{config:de,defines:ke,overrideFog:Ee}),Pe=P.projection.createInversionMatrix(P,J.canonical),Ce={programConfiguration:de,program:pe,layoutVertexBuffer:ue,dynamicBuffers:fe,indexBuffer:be,uniformValues:h.dW(a,J,K,Pe,G,o),tile:K};if(y){const Re=oe.segments.get();for(const Ye of Re)ne.push({segments:new h.dB([Ye]),sortKey:Ye.sortKey,state:Ce})}else ne.push({segments:oe.segments,sortKey:0,state:Ce})}y&&ne.sort((se,J)=>se.sortKey-J.sortKey);const te={useDepthForOcclusion:P.depthOcclusionForSymbolsAndCircles};for(const se of ne){const{programConfiguration:J,program:K,layoutVertexBuffer:oe,dynamicBuffers:de,indexBuffer:ue,uniformValues:ve,tile:be}=se.state,ke=se.segments;a.terrain&&a.terrain.setupElevationDraw(be,K,te),a.uploadCommonUniforms(T,K,be.tileID.toUnwrapped()),K.draw(a,I.TRIANGLES,k,N,H,lt.disabled,ve,o.id,oe,ue,ke,o.paint,P.zoom,J,de)}},heatmap:function(a,t,o,c){if(o.paint.get("heatmap-opacity")!==0)if(a.renderPass==="offscreen"){const d=a.context,m=d.gl,_=pt.disabled,y=new gt([m.ONE,m.ONE,m.ONE,m.ONE],h.C.transparent,[!0,!0,!0,!0]),v=a.transform.projection.name==="globe"?.5:.25;o.heatmapFbo=Ds.createWithTexture(d,o.heatmapFbo,a.width*v,a.height*v),d.clear({color:h.C.transparent});const T=a.transform,I=T.projection.name==="globe",P=I?["PROJECTION_GLOBE_VIEW"]:[],A=I?lt.frontCCW:lt.disabled,D=[h.aG(T.center.lng),h.aJ(T.center.lat)];for(let O=0;O<c.length;O++){const L=c[O];if(t.hasRenderableParent(L))continue;const k=t.getTile(L),N=k.getBucket(o);if(!N||N.projection.name!==T.projection.name)continue;const H=a.isTileAffectedByFog(L),Z=N.programConfigurations.get(o.id),G=a.getOrCreateProgram("heatmap",{config:Z,defines:P,overrideFog:H}),{zoom:ne}=a.transform;a.terrain&&a.terrain.setupElevationDraw(k,G),a.uploadCommonUniforms(d,G,L.toUnwrapped());const te=T.projection.createInversionMatrix(T,L.canonical);G.draw(a,m.TRIANGLES,rt.disabled,_,y,A,Zp(a,L,k,te,D,ne,o.paint.get("heatmap-intensity")),o.id,N.layoutVertexBuffer,N.indexBuffer,N.segments,o.paint,a.transform.zoom,Z,I?[N.globeExtVertexBuffer]:null)}d.viewport.set([0,0,a.width,a.height])}else a.renderPass==="translucent"&&(a.context.setColorMode(a.colorModeForRenderPass()),(function(d,m){const _=d.context,y=_.gl,v=m.heatmapFbo;if(!v)return;_.activeTexture.set(y.TEXTURE0),y.bindTexture(y.TEXTURE_2D,v.colorAttachment0.get()),_.activeTexture.set(y.TEXTURE1);let T=m.colorRampTexture;T||(T=m.colorRampTexture=new h.T(_,m.colorRamp,y.RGBA8)),T.bind(y.LINEAR,y.CLAMP_TO_EDGE),d.getOrCreateProgram("heatmapTexture").draw(d,y.TRIANGLES,rt.disabled,pt.disabled,d.colorModeForRenderPass(),lt.disabled,((I,P)=>({u_image:0,u_color_ramp:1,u_opacity:P.paint.get("heatmap-opacity")}))(0,m),m.id,d.viewportBuffer,d.quadTriangleIndexBuffer,d.viewportSegments,m.paint,d.transform.zoom)})(a,o))},line:function(a,t,o,c){const d=o.paint.get("line-opacity"),m=o.paint.get("line-width");if(d.constantOr(1)===0||m.constantOr(1)===0)return;const _=o.paint.get("line-blend-mode"),y=a.terrain&&a.terrain.renderingToTexture;if(_==="default"||a.transform.projection.name==="globe")a.renderPass==="translucent"&&Wt(a,t,o,c);else{if(y)return void(function(v,T,I,P,A){if(v.renderPass!=="translucent")return;const D=v.context,O=D.gl,L=v.terrain;if(!L)return;const k=D.bindFramebuffer.current,N=v.emissiveMode==="mrt-fallback",H=L.drapeBufferSize[0],Z=L.drapeBufferSize[1];I.lineBlendFbos||(I.lineBlendFbos=new Cc),I.lineBlendFbos.drapeFbo=Ds.createWithTexture(D,I.lineBlendFbos.drapeFbo,H,Z,!0),N&&O.drawBuffers([O.COLOR_ATTACHMENT0]),D.clear({color:Pc[A].clearColor,depth:1,stencil:0});const G=v.currentStencilSource,ne=v._tileClippingMaskIDs,te=v.nextStencilID;v.currentStencilSource=void 0,v._tileClippingMaskIDs={},v.nextStencilID=1;const se=v._terrain;v._terrain=null,v._renderTileClippingMasks(I,T,P),Wt(v,T,I,P,qu(A,v.context),!0),v._terrain=se,v.currentStencilSource=G,v._tileClippingMaskIDs=ne,v.nextStencilID=te,N&&O.drawBuffers([O.COLOR_ATTACHMENT0,O.COLOR_ATTACHMENT1]);const J=L.drapeBufferSize,K=I.lineBlendFbos&&I.lineBlendFbos.drapeFbo;K&&(A==="additive"&&Rs(v,I,K),is(v,I,A,K,k,J))})(a,t,o,c,_);if(a.renderPass==="offscreen")return void(function(v,T,I,P,A){const D=v.context,O=Math.ceil(v.width),L=Math.ceil(v.height);I.lineBlendFbos||(I.lineBlendFbos=new Cc),I.lineBlendFbos.fbo=Ds.createWithTexture(D,I.lineBlendFbos.fbo,O,L,!0),D.clear({color:Pc[A].clearColor,depth:1,stencil:0});const k=v.currentStencilSource,N=v._tileClippingMaskIDs,H=v.nextStencilID;v.currentStencilSource=void 0,v._tileClippingMaskIDs={},v.nextStencilID=1,v._renderTileClippingMasks(I,T,P);const Z=v.renderPass;v.renderPass="translucent",Wt(v,T,I,P,qu(A,v.context)),v.renderPass=Z,v.currentStencilSource=k,v._tileClippingMaskIDs=N,v.nextStencilID=H,D.viewport.set([0,0,v.width,v.height]),A==="additive"&&Rs(v,I,I.lineBlendFbos.fbo)})(a,t,o,c,_);if(a.renderPass==="translucent"){const v=o.lineBlendFbos&&o.lineBlendFbos.fbo;return void(v&&is(a,o,_,v,null))}}},fill:function(a,t,o,c){const d=o.paint.get("fill-color"),m=o.paint.get("fill-opacity");if(m.constantOr(1)===0)return;const _=o.paint.get("fill-emissive-strength"),y=a.colorModeForDrapableLayerRenderPass(_),v=o.paint.get("fill-pattern"),T=a.opaquePassEnabledForLayer()&&!v.constantOr(1)&&d.constantOr(h.C.transparent).a===1&&m.constantOr(0)===1?"opaque":"translucent";let I="none";o.layout.get("fill-elevation-reference")!=="none"?I="road":o.paint.get("fill-z-offset").constantOr(1)!==0&&(I="offset");const P=!(!a.terrain||!a.terrain.enabled),A={painter:a,sourceCache:t,layer:o,coords:c,colorMode:y,elevationType:I,terrainEnabled:P,pass:T};
3281if(a.renderPass==="shadow")return void(a.shadowRenderer&&I==="road"&&!P&&(function(O){const{painter:L,sourceCache:k,layer:N,coords:H}=O,Z=L.context.gl,G=O.painter.shadowRenderer;for(const ne of H){const te=k.getTile(ne),se=te.getBucket(N);if(!se)continue;const J=se.elevatedStructures;if(!J||!J.shadowCasterSegments||J.shadowCasterSegments.segments[0].primitiveLength===0)continue;L.prepareDrawTile();const K=se.bufferData.programConfigurations.get(N.id),oe=L.isTileAffectedByFog(ne),de=L.getOrCreateProgram("elevatedStructuresDepth",{config:K,overrideFog:oe}),ue=G.calculateShadowPassMatrixFromTile(te.tileID.toUnwrapped());L.uploadCommonUniforms(L.context,de,ne.toUnwrapped());const ve=Gp(ue,0);de.draw(L,Z.TRIANGLES,G.getShadowPassDepthMode(),pt.disabled,gt.disabled,lt.disabled,ve,N.id,J.vertexBuffer,J.indexBuffer,J.shadowCasterSegments,N.paint,L.transform.zoom,K)}})(A));const D=a.emissiveMode==="mrt-fallback";if(I!=="offset"){if(zs(A,!1,D),I==="road"){const O=!P&&a.renderPass==="translucent";O&&Ze(a,t,o,c,"geometry"),zs(A,!0,D,pt.disabled),O&&(function(L){const{painter:k,sourceCache:N,layer:H,coords:Z,colorMode:G}=L,ne=k.context.gl,te=L.painter.shadowRenderer,se=!!te&&te.enabled,J=new rt(k.context.gl.LEQUAL,rt.ReadOnly,k.depthRangeFor3D);let K=[0,0,0];if(se){const de=k.style.directionalLight,ue=k.style.ambientLight;de&&ue&&(K=_a(k.style,de,ue))}const oe=de=>{for(const ue of Z){const ve=N.getTile(ue),be=ve.getBucket(H);if(!be)continue;const ke=be.elevatedStructures;if(!ke)continue;let fe,Ee;if(de?(fe=ke.renderableBridgeSegments,Ee=ke.bridgeProgramConfigurations.get(H.id)):(fe=ke.renderableTunnelSegments,Ee=ke.tunnelProgramConfigurations.get(H.id)),!fe||fe.segments[0].primitiveLength===0)continue;Ee.updatePaintBuffers(),k.prepareDrawTile();const pe=k.isTileAffectedByFog(ue),Pe=[];se&&Pe.push("RENDER_SHADOWS","NORMAL_OFFSET");const Ce=k.getOrCreateProgram("elevatedStructures",{config:Ee,overrideFog:pe,defines:Pe}),Re=k.translatePosMatrix(ue.projMatrix,ve,H.paint.get("fill-translate"),H.paint.get("fill-translate-anchor"));se&&te.setupShadows(ve.tileID.toUnwrapped(),Ce,"vector-tile");const Ye=bd(Re,K);k.uploadCommonUniforms(k.context,Ce,ue.toUnwrapped()),Ce.draw(k,ne.TRIANGLES,J,pt.disabled,G,lt.backCCW,Ye,H.id,ke.vertexBuffer,ke.indexBuffer,fe,H.paint,k.transform.zoom,Ee,[ke.vertexBufferNormal])}};oe(!0),oe(!1)})(A)}}else zs(A,!1,D,a.stencilModeFor3D())},"fill-extrusion":function(a,t,o,c){const d=o.paint.get("fill-extrusion-opacity"),m=a.context,_=m.gl,y=a.terrain,v=y&&y.renderingToTexture;if(d===0)return;const T=a.emissiveMode==="mrt-fallback",I=a.conflationActive&&a.style.isLayerClipped(o,t.getSource()),P=a.style.order.indexOf(o.fqid);if(I&&(function(A,D,O,L,k){for(const N of L){const H=D.getTile(N).getBucket(O);H&&(H.updateReplacement(N,A.replacementSource,k),H.uploadCentroid(A.context))}})(a,t,o,c,P),y||I)for(const A of c){const D=t.getTile(A).getBucket(o);D&&Wu(a.context,t,A,D,o,y,I)}if(a.renderPass==="shadow"&&a.shadowRenderer){if(y&&d<.65&&o._transitionablePaint._values["fill-extrusion-opacity"].value.expression instanceof h.ac)return;const A=a.shadowRenderer.getShadowPassDepthMode();he(a,t,o,c,A,pt.disabled,gt.disabled,I)}else if(a.renderPass==="translucent"){const A=!o.paint.get("fill-extrusion-pattern").constantOr(1),D=o.paint.get("fill-extrusion-color").constantOr(h.C.white);if(!v&&D.a!==0){const O=new rt(a.context.gl.LEQUAL,rt.ReadWrite,a.depthRangeFor3D);d===1&&A?he(a,t,o,c,O,pt.disabled,gt.unblended,I):(he(a,t,o,c,O,pt.disabled,gt.disabled,I),he(a,t,o,c,O,a.stencilModeFor3D(),a.colorModeForRenderPass(),I),a.resetStencilClippingMasks())}if(a.style.enable3dLights()&&A&&(!y&&a.transform.projection.name!=="globe"||v)){const O=o.paint.get("fill-extrusion-opacity"),L=o.paint.get("fill-extrusion-ambient-occlusion-intensity"),k=o.paint.get("fill-extrusion-ambient-occlusion-ground-radius"),N=o.paint.get("fill-extrusion-flood-light-intensity"),H=o.paint.get("fill-extrusion-flood-light-color-use-theme").constantOr("default")==="none",Z=o.paint.get("fill-extrusion-flood-light-color").toNonPremultipliedRenderColor(H?null:o.lut).toArray01().slice(0,3),G=L>0&&k>0,ne=N>0,te=(K,oe,de)=>(1-de)*K+de*oe,se=new Dd;se.translate=o.paint.get("fill-extrusion-translate"),se.translateAnchor=o.paint.get("fill-extrusion-translate-anchor"),se.edgeRadius=o.layout.get("fill-extrusion-edge-radius"),se.cutoffFadeRange=o.paint.get("fill-extrusion-cutoff-fade-range");const J=K=>{const oe=a.depthModeForSublayer(1,rt.ReadOnly,_.LEQUAL,!0),de=o.paint.get(K?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),ue=te(.1,3,de),ve=a._showOverdrawInspector;if(!ve){const be=new pt({func:_.ALWAYS,mask:255},255,255,_.KEEP,_.KEEP,_.REPLACE),ke=new gt([_.ONE,_.ONE,_.ONE,_.ONE],h.C.transparent,[!1,!1,!1,!0],_.MIN);lo(se,a,t,o,c,oe,be,ke,lt.disabled,K,"sdf",O,L,k,N,Z,ue,I,!1)}{const be=ve?pt.disabled:new pt({func:_.EQUAL,mask:255},255,255,_.KEEP,_.DECR,_.DECR),ke=ve?a.colorModeForRenderPass():new gt([_.ONE_MINUS_DST_ALPHA,_.DST_ALPHA,_.ONE,_.ONE],h.C.transparent,[!0,!0,!0,!0]);lo(se,a,t,o,c,oe,be,ke,lt.disabled,K,"color",O,L,k,N,Z,ue,I,!1)}};if(v){const K=()=>{const de=y.drapeBufferSize[0],ue=y.drapeBufferSize[1];let ve=y.framebufferCopyTexture;return ve&&(!ve||ve.size[0]===de&&ve.size[1]===ue)||(ve&&ve.destroy(),ve=y.framebufferCopyTexture=new h.T(m,new h.q({width:de,height:ue}),_.RGBA8)),ve.bind(_.LINEAR,_.CLAMP_TO_EDGE),_.copyTexSubImage2D(_.TEXTURE_2D,0,0,0,0,0,de,ue),ve},oe=(de,ue,ve)=>{const be=a.depthModeForSublayer(1,rt.ReadOnly,_.LEQUAL,!1),ke=o.paint.get(de?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),fe=te(.1,3,ke);{const Ee=new gt([_.ONE,_.ONE,_.ONE,_.ONE],h.C.transparent,[!1,!1,!1,!0]);lo(se,a,t,o,c,be,pt.disabled,Ee,lt.disabled,de,"clear",O,L,k,N,Z,fe,I,ue)}{const Ee=new pt({func:_.ALWAYS,mask:255}
3281,255,255,_.KEEP,_.KEEP,_.REPLACE),pe=new gt([_.ONE,_.ONE,_.ONE,_.ONE],h.C.transparent,[!1,!1,!1,!0],_.MIN);lo(se,a,t,o,c,be,Ee,pe,lt.disabled,de,"sdf",O,L,k,N,Z,fe,I,ue)}T&&!de&&(ve=K());{const Ee=de?_.ZERO:_.ONE_MINUS_DST_ALPHA,pe=new pt({func:_.EQUAL,mask:255},255,255,_.KEEP,_.DECR,_.DECR),Pe=new gt([Ee,_.DST_ALPHA,_.ONE_MINUS_DST_ALPHA,_.ZERO],h.C.transparent,[!0,!0,!0,!0]);lo(se,a,t,o,c,be,pe,Pe,lt.disabled,de,"color",O,L,k,N,Z,fe,I,ue)}if(!T||de){const Ee=new gt([_.ONE,_.ONE,_.ONE,de?_.ZERO:_.ONE],h.C.transparent,[!1,!1,!1,!0],de?_.FUNC_ADD:_.MAX);lo(se,a,t,o,c,be,pt.disabled,Ee,lt.disabled,de,"clear",O,L,k,N,Z,fe,I,ue,ve)}else{_.drawBuffers([_.NONE,_.COLOR_ATTACHMENT1]);const Ee=new pt({func:_.EQUAL,mask:255},254,255,_.KEEP,_.DECR,_.DECR),pe=new gt([_.ONE,_.ONE,_.ONE,_.ONE],h.C.transparent,[!0,!1,!1,!1],_.MAX);lo(se,a,t,o,c,be,Ee,pe,lt.disabled,de,"emissive",O,L,k,N,Z,fe,I,ue,ve),_.drawBuffers([_.COLOR_ATTACHMENT0])}};if(G||ne){let de;a.prepareDrawTile(),T&&!G||(de=K()),G&&oe(!0,!1,de),ne&&oe(!1,!0,de)}}else G&&J(!0),ne&&J(!1),(G||ne)&&a.resetStencilClippingMasks()}}},hillshade:function(a,t,o,c){if(a.renderPass!=="offscreen"&&a.renderPass!=="translucent"||a.style.disableElevatedTerrain)return;const d=a.context,m=a.terrain&&a.terrain.renderingToTexture,[_,y]=a.renderPass!=="translucent"||m?[{},c]:a.stencilConfigForOverlap(c);for(const v of y){const T=t.getTile(v);if(T.needsHillshadePrepare&&a.renderPass==="offscreen")Pu(a,T,o);else if(a.renderPass==="translucent"){const I=a.depthModeForSublayer(0,rt.ReadOnly),P=o.paint.get("hillshade-emissive-strength"),A=a.colorModeForDrapableLayerRenderPass(P),D=m&&a.terrain?a.terrain.stencilModeForRTTOverlap(v):_[v.overscaledZ];od(a,v,T,o,I,D,A)}}d.viewport.set([0,0,a.width,a.height]),a.resetStencilClippingMasks()},raster:function(a,t,o,c,d,m){if(a.renderPass!=="translucent")return;const _=o.paint.get("raster-opacity");if(_===0)return;const y=a.transform.projection.name==="globe",v=o.paint.get("raster-elevation")!==0,T=v&&y,I=a.terrain&&a.terrain.exaggeration()>0&&v&&o.paint.get("raster-elevation-reference")==="ground",P=!y&&I;if(a.renderElevatedRasterBackface&&!T)return;const A=a.context,D=A.gl,O=t.getSource(),L=(function(K,oe,de,ue,ve){const be=oe.paint.get("raster-color"),ke=K.type==="raster-array",fe=[],Ee=oe.paint.get("raster-resampling"),pe=oe.paint.get("raster-color-mix");let Pe=oe.paint.get("raster-color-range");const Ce=[pe[0],pe[1],pe[2],0],Re=pe[3];let Ye=Ee==="nearest"?ue.NEAREST:ue.LINEAR;if(ke&&(fe.push("RASTER_ARRAY"),be||fe.push("RASTER_COLOR"),Ee==="linear"&&fe.push("RASTER_ARRAY_LINEAR"),Ye=ue.NEAREST,!Pe&&K.rasterLayers)){const qe=K.rasterLayers.find(({id:je})=>je===oe.sourceLayer);qe&&qe.fields&&qe.fields.range&&(Pe=qe.fields.range)}if(Pe=Pe||[0,1],be){fe.push("RASTER_COLOR"),de.activeTexture.set(ue.TEXTURE2),oe.updateColorRamp(Pe);let qe=oe.colorRampTexture;qe||(qe=oe.colorRampTexture=new h.T(de,oe.colorRamp,ue.RGBA8)),qe.bind(Ye,ue.CLAMP_TO_EDGE)}return ve&&fe.push("USE_MRT1"),{mix:Ce,range:Pe,offset:Re,defines:fe,resampling:Ye}})(O,o,A,D,a.terrain&&a.terrain.renderingToTexture&&a.emissiveMode==="mrt-fallback");if(O instanceof h.aY&&!c.length&&!y)return;const k=o.paint.get("raster-emissive-strength"),N=a.colorModeForDrapableLayerRenderPass(k),H=a.terrain&&a.terrain.renderingToTexture,Z=!a.options.moving,G=o.paint.get("raster-resampling")==="nearest"?D.NEAREST:D.LINEAR;if(O instanceof h.aY&&!c.length&&(O.onNorthPole||O.onSouthPole)){const K=v?a.stencilModeFor3D():pt.disabled;return void Oc(!!O.onNorthPole,null,a,t,o,k,L,lt.disabled,K)}if(!c.length)return;const[ne,te]=O instanceof h.aY||H?[{},c]:a.stencilConfigForOverlap(c),se=te.at(-1).overscaledZ;T&&L.defines.push("PROJECTION_GLOBE_VIEW"),v&&L.defines.push("RENDER_CUTOFF","ELEVATED"),I&&L.defines.push("ELEVATION_REFERENCE_GROUND");const J=(K,oe,de)=>{for(const ue of K){const ve=ue.toUnwrapped(),be=t.getTile(ue);if(H&&(!be||!be.hasData()))continue;A.activeTexture.set(D.TEXTURE0);const ke=Od(be,O,o,L);if(!ke||!ke.texture)continue;const{texture:fe,mix:Ee,offset:pe,tileSize:Pe,buffer:Ce}=ke;let Re,Ye;H?(Re=rt.disabled,Ye=ue.projMatrix):v?(Re=new rt(D.LEQUAL,rt.ReadWrite,a.depthRangeFor3D),Ye=y?a.transform.expandedFarZProjMatrix:a.transform.calculateProjMatrix(ve,Z)):(Re=a.depthModeForSublayer(ue.overscaledZ-se,_===1?rt.ReadWrite:rt.ReadOnly,D.LESS),Ye=a.transform.calculateProjMatrix(ve,Z));const qe=a.terrain&&H?a.terrain.stencilModeForRTTOverlap(ue):ne[ue.overscaledZ],je=m?0:o.paint.get("raster-fade-duration");be.registerFadeDuration(je);const Be=t.findLoadedParent(ue,0),at=xl(be,Be,t,a.transform,je);let ot,tt;!at.isFading&&be.refreshedUponExpiration&&(be.refreshedUponExpiration=!1),a.terrain&&a.terrain.prepareDrawTile(),A.activeTexture.set(D.TEXTURE0),fe.bind(G,D.CLAMP_TO_EDGE),A.activeTexture.set(D.TEXTURE1),Be?(Be.texture&&Be.texture.bind(G,D.CLAMP_TO_EDGE),ot=Math.pow(2,Be.tileID.overscaledZ-be.tileID.overscaledZ
vendor: 14,959 bytes, line 3281
3281),tt=[be.tileID.canonical.x*ot%1,be.tileID.canonical.y*ot%1]):fe.bind(G,D.CLAMP_TO_EDGE),"useMipmap"in fe&&A.extTextureFilterAnisotropic&&a.transform.pitch>20&&D.texParameterf(D.TEXTURE_2D,A.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,A.extTextureFilterAnisotropicMax);const it=a.transform;let ht;const xt=v?Ld(it):[0,0,0,0];let yt,St,_t,Bt,bt,Vt=0;if(T&&O instanceof h.aY&&O.coordinates.length>3)yt=Float32Array.from(h.dx(h.dy(new h.cp(0,0,0)))),St=Float32Array.from(it.globeMatrix),_t=Float32Array.from(h.dt(it)),Bt=[h.aG(it.center.lng),h.aJ(it.center.lat)],ht=O.elevatedGlobePerspectiveTransform,bt=O.elevatedGlobeGridMatrix||new Float32Array(9);else if(T){const $t=h.du(ue.canonical);Vt=h.dv($t.getCenter().lat),yt=Float32Array.from(h.dx(h.dy(ue.canonical))),St=Float32Array.from(it.globeMatrix),_t=Float32Array.from(h.dt(it)),Bt=[h.aG(it.center.lng),h.aJ(it.center.lat)],ht=[0,0],bt=Float32Array.from(h.dw(ue.canonical,$t,Vt,it.worldSize/it._pixelsPerMercatorPixel))}else ht=O instanceof h.aY?O.perspectiveTransform:[0,0],yt=new Float32Array(16),St=new Float32Array(9),_t=new Float32Array(16),Bt=[0,0],bt=new Float32Array(9);const ii=ju(a,Ye,yt,St,_t,bt,tt||[0,0],h.ai(a.transform.zoom),Bt,xt,ot||1,at,o,ht,v?o.paint.get("raster-elevation"):0,2,Ee,pe,L.range,Pe,Ce,k),oi=a.isTileAffectedByFog(ue),si=a.getOrCreateProgram("raster",{defines:L.defines,overrideFog:oi});if(a.uploadCommonUniforms(A,si,ve),O instanceof h.aY){const $t=O.elevatedGlobeVertexBuffer,It=O.elevatedGlobeIndexBuffer;if(H||!y)O.boundsBuffer&&O.boundsSegments&&si.draw(a,D.TRIANGLES,Re,pt.disabled,N,lt.disabled,ii,o.id,O.boundsBuffer,a.quadTriangleIndexBuffer,O.boundsSegments);else if($t&&It){const At=it.zoom<=h.cN?O.elevatedGlobeSegments:O.getSegmentsForLongitude(it.center.lng);At&&si.draw(a,D.TRIANGLES,Re,pt.disabled,N,oe,ii,o.id,$t,It,At)}}else if(T){Re=new rt(D.LEQUAL,rt.ReadOnly,a.depthRangeFor3D);const $t=a.globeSharedBuffers;if($t){I&&(a.terrain.setupElevationDraw(be,si),a.uploadCommonUniforms(A,si,be.tileID.toUnwrapped()));const[It,At,ai]=$t.getGridBuffers(Vt,!1),Ri=si.getAttributeLocation(D,"a_texture_pos");Ri!==-1&&D.vertexAttribI4ui(Ri,0,0,0,0),si.draw(a,D.TRIANGLES,Re,de||qe,a.colorModeForRenderPass(),oe,ii,o.id,It,At,ai)}}else if(P)Re=new rt(D.LEQUAL,rt.ReadWrite,a.depthRangeFor3D),a.terrain.setupElevationDraw(be,si),a.uploadCommonUniforms(A,si,be.tileID.toUnwrapped()),it.pitch>20&&si.draw(a,D.TRIANGLES,Re,pt.disabled,gt.disabled,lt.frontCCW,ii,o.id,a.terrain.gridBuffer,a.terrain.gridIndexBuffer,a.terrain.gridSegments),si.draw(a,D.TRIANGLES,Re,qe,N,lt.backCCW,ii,o.id,a.terrain.gridBuffer,a.terrain.gridIndexBuffer,a.terrain.gridSegments);else{const{tileBoundsBuffer:$t,tileBoundsIndexBuffer:It,tileBoundsSegments:At}=a.getTileBoundsBuffers(be);si.draw(a,D.TRIANGLES,Re,qe,N,lt.disabled,ii,o.id,$t,It,At)}}if(!(O instanceof h.aY)&&T)for(const ue of K){const ve=ue.canonical.y===(1<<ue.canonical.z)-1;ue.canonical.y===0&&Oc(!0,ue,a,t,o,k,L,oe,de||pt.disabled),ve&&Oc(!1,ue,a,t,o,k,L,oe===lt.frontCW?lt.backCW:lt.frontCW,de||pt.disabled)}};T?J(te,a.renderElevatedRasterBackface?lt.backCW:lt.frontCW,a.stencilModeFor3D()):J(te,lt.disabled,void 0),a.resetStencilClippingMasks()},background:function(a,t,o,c){const d=o.paint.get("background-color"),m=o.paint.get("background-color-use-theme").constantOr("default")==="none",_=o.paint.get("background-opacity"),y=o.paint.get("background-emissive-strength"),v=o.paint.get("background-pitch-alignment")==="viewport";if(_===0)return;const T=a.context,I=T.gl,P=a.transform,A=P.tileSize,D=o.paint.get("background-pattern");let O;if(D!==void 0&&(D===null||(O=a.imageManager.getPattern(h.I.from(D.toString()),o.scope,a.style.getLut(o.scope)),!O)))return;const L=!D&&d.a===1&&_===1&&a.opaquePassEnabledForLayer()?"opaque":"translucent";if(a.renderPass!==L)return;const k=pt.disabled,N=a.depthModeForSublayer(0,L==="opaque"?rt.ReadWrite:rt.ReadOnly),H=a.colorModeForDrapableLayerRenderPass(y),Z=D?"backgroundPattern":"background";let G,ne=c;ne||(G=a.getBackgroundTiles(),ne=Object.values(G).map(se=>se.tileID)),D&&(T.activeTexture.set(I.TEXTURE0),a.imageManager.bind(a.context,o.scope));const te=[];if(a.terrain&&a.terrain.renderingToTexture&&a.emissiveMode==="mrt-fallback"&&te.push("USE_MRT1"),v){const se=a.getOrCreateProgram(Z,{overrideFog:!1,overrideRtt:!0,defines:te}),J=Fd,K=new h.aU(0,0,0,0,0),oe=D?Gu(J,y,_,a,0,o.scope,O,v,{tileID:K,tileSize:A}):Yp(J,y,_,d.toPremultipliedRenderColor(m?null:o.lut));return void se.draw(a,I.TRIANGLES,N,k,H,lt.disabled,oe,o.id,a.viewportBuffer,a.quadTriangleIndexBuffer,a.viewportSegments)}for(const se of ne){const J=a.isTileAffectedByFog(se),K=a.getOrCreateProgram(Z,{overrideFog:J,defines:te}),oe=se.toUnwrapped(),de=c?se.projMatrix:a.transform.calculateProjMatrix(oe);a.prepareDrawTile();const ue=t?t.getTile(se):G?G[se.key]:new h.b3(se,A,P.zoom,a),ve=D?Gu(de,y,_,a,0,o.scope,O,v,{tileID:se,tileSize:A}):Yp(de,y,_,d.toPremultipliedRenderColor(m?null:o.lut));a.uploadCommonUniforms(T,K,oe);const{tileBoundsBuffer:be,tileBoundsIndexBuffer:ke,tileBoundsSegments:fe}=a.getTileBoundsBuffers(ue);K.draw(a,I.TRIANGLES,N,k,H,lt.disabled,ve,o.id,be,ke,fe)}},sky:function(a,t,o){const c=a._atmosphere?h.ai(a.transform.zoom):1,d=o.paint.get("sky-opacity")*c;if(d===0)return;const m=a.context,_=o.paint.get("sky-type"),y=new rt(m.gl.LEQUAL,rt.ReadOnly,[0,1]),v=a.frameCounter/1e3%1;_==="atmosphere"?a.renderPass==="offscreen"?o.needsSkyboxCapture(a)&&((function(T,I){const P=T.context,A=P.gl;let D=I.skyboxFbo;if(!D){D=I.skyboxFbo=P.createFramebuffer(32,32,1,null),I.skyboxGeometry=new th(P),I.skyboxTexture=P.gl.createTexture(),A.bindTexture(A.TEXTURE_CUBE_MAP,I.skyboxTexture),A.texParameteri(A.TEXTURE_CUBE_MAP,A.TEXTURE_WRAP_S,A.CLAMP_TO_EDGE),A.texParameteri(A.TEXTURE_CUBE_MAP,A.TEXTURE_WRAP_T,A.CLAMP_TO_EDGE),A.texParameteri(A.TEXTURE_CUBE_MAP,A.TEXTURE_MIN_FILTER,A.LINEAR),A.texParameteri(A.TEXTURE_CUBE_MAP,A.TEXTURE_MAG_FILTER,A.LINEAR);for(let N=0;N<6;++N)A.texImage2D(A.TEXTURE_CUBE_MAP_POSITIVE_X+N,0,A.RGBA,32,32,0,A.RGBA,A.UNSIGNED_BYTE,null)}P.bindFramebuffer.set(D.framebuffer),P.viewport.set([0,0,32,32]);const O=I.getCenter(T,!0),L=T.getOrCreateProgram("skyboxCapture"),k=new Float64Array(16);h.en(k,.5*-Math.PI),Ai(T,I,L,k,O,0),h.en(k,.5*Math.PI),Ai(T,I,L,k,O,1),h.eo(k,.5*-Math.PI),Ai(T,I,L,k,O,2),h.eo(k,.5*Math.PI),Ai(T,I,L,k,O,3),h.bA(k),Ai(T,I,L,k,O,4),h.en(k,Math.PI),Ai(T,I,L,k,O,5),P.viewport.set([0,0,T.width,T.height])})(a,o),o.markSkyboxValid(a)):a.renderPass==="sky"&&(function(T,I,P,A,D){const O=T.context,L=O.gl,k=T.transform,N=T.getOrCreateProgram("skybox");O.activeTexture.set(L.TEXTURE0),L.bindTexture(L.TEXTURE_CUBE_MAP,I.skyboxTexture);const H=((Z,G,ne,te,se)=>({u_matrix:Z,u_sun_direction:G,u_cubemap:0,u_opacity:te,u_temporal_offset:se}))(k.skyboxMatrix,I.getCenter(T,!1),0,A,D);T.uploadCommonUniforms(O,N),N.draw(T,L.TRIANGLES,P,pt.disabled,T.colorModeForRenderPass(),lt.backCW,H,"skybox",I.skyboxGeometry.vertexBuffer,I.skyboxGeometry.indexBuffer,I.skyboxGeometry.segment)})(a,o,y,d,v):_==="gradient"&&a.renderPass==="sky"&&(function(T,I,P,A,D){const O=T.context,L=O.gl,k=T.transform,N=T.getOrCreateProgram("skyboxGradient");I.skyboxGeometry||(I.skyboxGeometry=new th(O)),O.activeTexture.set(L.TEXTURE0);let H=I.colorRampTexture;H||(H=I.colorRampTexture=new h.T(O,I.colorRamp,L.RGBA8)),H.bind(L.LINEAR,L.CLAMP_TO_EDGE);const Z=((G,ne,te,se,J)=>({u_matrix:G,u_color_ramp:0,u_center_direction:ne,u_radius:h.am(te),u_opacity:se,u_temporal_offset:J}))(k.skyboxMatrix,I.getCenter(T,!1),I.paint.get("sky-gradient-radius"),A,D);T.uploadCommonUniforms(O,N),N.draw(T,L.TRIANGLES,P,pt.disabled,T.colorModeForRenderPass(),lt.backCW,Z,"skyboxGradient",I.skyboxGeometry.vertexBuffer,I.skyboxGeometry.indexBuffer,I.skyboxGeometry.segment)})(a,o,y,d,v)},custom:function(a,t,o,c){const d=a.context,m=o.implementation;if(!a.transform.projection.unsupportedLayers||!a.transform.projection.unsupportedLayers.includes("custom")||a.terrain&&(a.terrain.renderingToTexture||a.renderPass==="offscreen")&&o.isDraped(t)){if(a.renderPass==="offscreen"){const _=m.prerender;if(_){if(a.setCustomLayerDefaults(),d.setColorMode(a.colorModeForRenderPass()),a.transform.projection.name==="globe"){const y=a.transform.pointMerc;_.call(m,d.gl,a.transform.customLayerMatrix(),a.transform.getProjection(),a.transform.globeToMercatorMatrix(),h.ai(a.transform.zoom),[y.x,y.y],a.transform.pixelsPerMeterRatio)}else _.call(m,d.gl,a.transform.customLayerMatrix());d.setDirty(),a.setBaseState()}}else if(a.renderPass==="translucent"){if(a.terrain&&a.terrain.renderingToTexture){const y=m.renderToTile;if(y){const v=c[0].canonical,T={x:v.x+c[0].wrap*(m.wrapTileId?0:1<<v.z),y:v.y,z:v.z};d.setDepthMode(rt.disabled),d.setStencilMode(pt.disabled),d.setColorMode(a.colorModeForRenderPass()),a.setCustomLayerDefaults(),y.call(m,d.gl,T),d.setDirty(),a.setBaseState()}return}a.setCustomLayerDefaults(),d.setColorMode(a.colorModeForRenderPass()),d.setStencilMode(pt.disabled);const _=m.renderingMode==="3d"?new rt(a.context.gl.LEQUAL,rt.ReadWrite,a.depthRangeFor3D):a.depthModeForSublayer(0,rt.ReadOnly);if(d.setDepthMode(_),a.transform.projection.name==="globe"){const y=a.transform.pointMerc;m.render(d.gl,a.transform.customLayerMatrix(),a.transform.getProjection(),a.transform.globeToMercatorMatrix(),h.ai(a.transform.zoom),[y.x,y.y],a.transform.pixelsPerMeterRatio)}else m.render(d.gl,a.transform.customLayerMatrix());d.setDirty(),a.setBaseState(),d.bindFramebuffer.set(null)}}else h.w("Custom layers are not yet supported with this projection. Use mercator or globe to enable usage of custom layers.")},model:function(a,t,o,c){if(a.renderPass==="opaque")return;const d=o.paint.get("model-opacity").constantOr(1),m=o.paint.get("model-elevation-reference"),_=m==="ground",y=m==="ground";if(d===0)return;const v=o.paint.get("model-cast-shadows");if(a.renderPass==="shadow"&&(!v||a.terrain&&d<.65&&o._transitionablePaint._values["model-opacity"].value.expression instanceof h.ac))return;const T=a.shadowRenderer,I=o.paint.get("model-receive-shadows");T&&(T.useNormalOffset=!0,I||(T.enabled=!1));const P=()=>{T&&(T.useNormalOffset=!0,I||(T.enabled=!0))},A=t.getSource();if(a.renderPass==="light-beam"&&A.type!=="batched-model")return;if(A.type==="vector"||A.type==="geojson")return(function(G,ne,te,se,J){const K=G.transform,oe=K.projection.name==="globe",de=K.getFreeCameraOptions().position;if(!G.modelManager)return;const ue=G.modelManager;te.modelManager=ue;const ve=G.shadowRenderer;if(!Object.hasOwn(te._unevaluatedLayout._values,"model-id"))return;const be=te._unevaluatedLayout._values["model-id"],ke=Object.assign({},te.layout.get("model-id").parameters),fe=G.style.order.indexOf(te.fqid),Ee=te.paint.get("model-opacity").constantOr(1);for(const pe of se){const Pe=ne.getTile(pe).getBucket(te);if(!Pe||Pe.projection.name!==K.projection.name)continue;const Ce=Pe.getModelUris();if(Ce&&!Pe.modelsRequested&&(ue.addModelsFromBucket(Ce,J),Pe.modelsRequested=!0),oe)ke.zoom=pe.overscaledZ;else{const tt=dm(pe,K);ke.zoom=tt}const Re=be.possiblyEvaluate(ke);if(hm(G,Pe,pe),co.shadowUniformsInitialized=!1,co.useSingleShadowCascade=!!ve&&ve.getMaxCascadeForTile(pe.toUnwrapped())===0,G.renderPass==="shadow"&&ve){if(G.currentShadowCascade===1&&Pe.isInsideFirstShadowMapFrustum)continue;const tt=K.calculatePosMatrix(pe.toUnwrapped(),K.worldSize);if(co.tileMatrix.set(tt),co.shadowTileMatrix.set(ve.calculateShadowPassMatrixFromMatrix(tt)),co.aabb.min=[0,0,0],co.aabb.max[0]=co.aabb.max[1]=h.ak,co.aabb.max[2]=0,mm(Pe,co,G,te.scope))continue}const Ye=1<<pe.canonical.z,qe=[((de.x-pe.wrap)*Ye-pe.canonical.x)*h.ak,(de.y*Ye-pe.canonical.y)*h.ak,de.z*Ye*h.ak];G.conflationActive&&Object.keys(Pe.instancesPerModel).length>0&&G.style.isLayerClipped(te,ne.getSource())&&Pe.updateReplacement(pe,G.replacementSource,fe,te.scope)&&(Pe.uploaded=!1,Pe.upload(G.context));let je=0;const Be=new Array,at=new Array,ot=new Array;for(let tt in Pe.instancesPerModel){const it=Pe.instancesPerModel[tt];it.features.length>0&&!oe&&(tt=Re.evaluate(it.features[0].feature,{}));const ht=ue.getModel(tt,J);if(ht||ue.hasURLBeenRequested(tt)||Pe.modelUris.includes(tt)||(Pe.modelUris.push(tt),Pe.modelsRequested=!1),ht&&ht.uploaded)if(oe){const xt=h.bN([],[de.x,de.y,de.z],G.transform.worldSize);h.ew(xt,xt);for(let yt=0;yt<it.instancedDataArray.length;++yt){const St=[0,0,0],_t=[1,1,1],Bt=h.ex(),bt=it.tileCoordinatesForInstance(yt),Vt=it.transformForInstance(yt);h.ey(_t,Vt),h.ez(Bt,Vt),h.eA(St,Bt);const ii=it.translationForInstance(yt),oi=new h.aX(0,0);h.eB(Pe.canonical,oi,bt.x,bt.y);const si=h.bd();h.eC(si,ht,G.transform,oi,St,_t,ii,!0,!1,!1);const $t=it.colorForInstance(yt),It=h.cK([],xt),At=h.e8(oi.lat,G.transform.zoom),ai=h.bT([],[1,1,1/At]);ot.push({zScaleMatrix:ai,negCameraPosMatrix:It});for(const Ri of ht.nodes)rh(G,Ri,si,G.transform.expandedFarZProjMatrix,je,Be,at,ht.materialOverrides,Ee,$t);++je}}else for(const xt of ht.nodes)Zd(G,te,xt,it,qe,pe,co)}if(oe)if(G.renderPass==="shadow"){for(const tt of at)Aa(tt.mesh,tt.nodeModelMatrix,G,te);for(const tt of Be)Aa(tt.mesh,tt.nodeModelMatrix,G,te)}else qd(G,te,Be,at,ot)}})(a,t,o,c,Fc(a,o)),void P();if(!A.loaded())return;if(A.type==="batched-model")return(function(G,ne,te,se){te.resetLayerRenderingStats(G);const J=G.context,K=G.transform,oe=G.style.fog,de=G.shadowRenderer;if(K.projection.name!=="mercator")return void h.w(`Drawing 3D landmark models for ${K.projection.name} projection is not yet implemented`);const ue=G.transform.getFreeCameraOptions().position,ve=h.bN([],[ue.x,ue.y,ue.z],G.transform.worldSize),be=h.ew([],ve),ke=h.cK([],be),fe=h.e8(K.center.lat,K.zoom),Ee=h.bT([],[1,1,1/fe]),pe=te.paint.get("model-opacity").constantOr(1),Pe=new rt(J.gl.LEQUAL,rt.ReadWrite,G.depthRangeFor3D),Ce=new rt(J.gl.LEQUAL,rt.ReadOnly,G.depthRangeFor3D),Re=new h.cY([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),Ye=G.renderPass==="shadow",qe=Ye&&de?de.getCurrentCascadeFrustum():K.getFrustum(K.scaleZoom(K.worldSize)),je=te.paint.get("model-front-cutoff"),Be=je[2]<1,at=In(G,te.paint.get("model-cutoff-fade-range")),ot=te.getLayerRenderingStats();(function(tt,it,ht,xt){const yt=tt.terrain?tt.terrain.exaggeration():0,St=tt.transform.zoom;for(const _t of xt){const Bt=it.getTile(_t).getBucket(ht);Bt&&(Bt.setFilter(ht.filter),tt.conflationActive&&Bt.updateReplacement(_t,tt.replacementSource),Bt.evaluateTransform(tt,ht),tt.terrain&&yt>0&&Bt.elevationUpdate(tt.terrain,yt,_t,ht.source),Bt.needsReEvaluation(tt,St,ht)&&Bt.evaluate(ht))}})(G,ne,te,se),(function(){const tt=new Map;let it,ht,xt;Be?(it=se.length-1,ht=-1,xt=-1):(it=0,ht=se.length,xt=1);const yt=new Float64Array(16),St=h.cg(),_t=new h.P(0,0);for(let Bt=it;Bt!==ht;Bt+=xt){const bt=se[Bt],Vt=ne.getTile(bt).getBucket(te);if(!Vt||!Vt.uploaded)continue;let ii=!1;de&&(ii=de.getMaxCascadeForTile(bt.toUnwrapped())===0);const oi=K.calculatePosMatrix(bt.toUnwrapped(),K.worldSize),si=Vt.modelTraits;!Ye&&Be&&(h.ba(yt,oi),h.ae(St,ve,yt),_t.x=St[0],_t.y=St[1]);const $t=[];Vt.setFilter(te.filter);
3281for(const It of Vt.getNodesInfo()){if(It.hiddenByReplacement||!It.node.meshes)continue;const At=It.node;let ai=0;G.terrain&&At.elevation&&(ai=At.elevation*G.terrain.exaggeration());const Ri=(()=>{const tr=It.aabb;return Re.min=[...tr.min],Re.max=[...tr.max],Re.min[2]+=ai,Re.max[2]+=ai,h.ae(Re.min,Re.min,oi),h.ae(Re.max,Re.max,oi),Re})(),Qt=It.evaluatedScale;if(Qt[0]<=1&&Qt[1]<=1&&Qt[2]<=1&&Ri.intersects(qe)===0)continue;if(!Ye){const tr=Ri.min,Jr=Ri.max;os[0]=.5*(tr[0]+Jr[0]),os[1]=.5*(tr[1]+Jr[1]),os[2]=.5*(tr[2]+Jr[2]);const Kr=h.bh(ve,os)*fe;pm(It,Kr,Math.min(G._debugParams.dt,1e3/30),G._debugParams.lodSwitchDistance)}if(!Ye&&Be){const tr=.16666666666666666;It.cameraCollisionOpacity=ve[0]>Ri.min[0]&&ve[0]<Ri.max[0]&&ve[1]>Ri.min[1]&&ve[1]<Ri.max[1]&&ve[2]*fe<Ri.max[2]&&At.footprint&&h.bG(_t,At.footprint)?Math.max(It.cameraCollisionOpacity-tr,0):Math.min(1,It.cameraCollisionOpacity+tr)}const vt=[...oi],yi=1/h.cW(bt.canonical),li=At.anchor?At.anchor[0]:0,Li=At.anchor?At.anchor[1]:0;h.bB(vt,vt,[li*(Qt[0]-1)+It.evaluatedTranslation[0]*yi,Li*(Qt[1]-1)+It.evaluatedTranslation[1]*yi,ai+It.evaluatedTranslation[2]]),h.c6(Qt,h.eE)||h.cE(vt,vt,Qt);const Nt=h.aC([],vt,At.globalMatrix),qi=h.aC([],K.expandedFarZProjMatrix,Nt),Ir=h.aC([],K.expandedFarZProjMatrix,vt),sr=h.aD([],[li,Li,ai,1],qi)[2];At.hidden=!1;let mr=pe;Ye||(Be&&(mr*=It.cameraCollisionOpacity,mr*=og(vt,K,It.aabb,je)),mr*=ng(at,sr)),mr!==0?$t.push({nodeInfo:It,depth:sr,opacity:mr,wvpForNode:qi,wvpForTile:Ir,nodeModelMatrix:Nt,tileModelMatrix:vt}):At.hidden=!0}Ye||$t.sort((It,At)=>!Be||It.opacity===1&&At.opacity===1?It.depth<At.depth?-1:1:It.opacity===1?-1:At.opacity===1?1:It.depth>At.depth?-1:1);for(const It of $t){const At=It.nodeInfo,ai=At.node;if(G._debugParams.show3DModelFootprints&&ai.footprint){const sr=ai.id||ai.name||"footprint";tt.has(sr)||tt.set(sr,{node:ai,mvp:It.wvpForTile})}h.aC(tn,Ee,It.tileModelMatrix),h.aC(tn,ke,tn),h.ba(Un,tn),h.e9(Un,Un),h.cE(Un,Un,fm),h.aC(tn,tn,ai.globalMatrix);const Ri=G.renderPass==="light-beam",Qt=te.paint.get("model-color-use-theme").constantOr("default")==="none",vt=si&h.eH.HasMapboxMeshFeatures,yi=vt?0:At.evaluatedRMEA[0][2],li=At.targetLod,Li=ai.lodMeshes&&ai.lodMeshes.length>0,Nt=Li&&li>0&&li<1;if(Ye&&Li&&Math.round(li)===1)continue;const qi=Nt?2:1,Ir=Li&&Math.round(li)===1;for(let sr=0;sr<qi;++sr){const mr=Nt?sr===1:Ir,tr=mr?ai.lodMeshes:ai.meshes,Jr=Nt?mr?-li:1-li:1;for(let Kr=0;Kr<tr.length;++Kr){const Ki=tr[Kr],Fr=!mr&&Kr===ai.lightMeshIndex;let Ht=It.wvpForNode;if(Fr){if(!Ri&&!G.terrain&&G.shadowRenderer){G.currentLayer<G.firstLightBeamLayer&&(G.firstLightBeamLayer=G.currentLayer);continue}Ht=It.wvpForTile}else if(Ri)continue;const ri={defines:[]},Xt=[];if(!Ye&&de&&(de.useNormalOffset=!!Ki.normalBuffer),Ea(ri.defines,Xt,Ki,G,Qt?null:te.lut),vt||ri.defines.push("DIFFUSE_SHADED"),ii&&ri.defines.push("SHADOWS_SINGLE_CASCADE"),ot&&(Ye?ot.numRenderedVerticesInShadowPass+=Ki.vertexArray.length:ot.numRenderedVerticesInTransparentPass+=Ki.vertexArray.length),Ye){Aa(Ki,It.nodeModelMatrix,G,te);continue}let Zi=null;if(oe&&(Zi=ih(Os,It.nodeModelMatrix,G.transform),K.projection.name!=="globe")){const yn=Ki.aabb.min,Pn=Ki.aabb.max,[ls,ho]=oe.getOpacityForBounds(Zi,yn[0],yn[1],Pn[0],Pn[1]);ri.overrideFog=ls>=Yo||ho>=Yo}const hr=Ki.material;let zi;hr.occlusionTexture&&hr.occlusionTexture.offsetScale&&(zi=hr.occlusionTexture.offsetScale,ri.defines.push("OCCLUSION_TEXTURE_TRANSFORM")),Nt&&ri.defines.push("DITHERED_DISCARD");const jr=G.getOrCreateProgram("model",ri);!Ye&&de&&de.setupShadowsFromMatrix(It.tileModelMatrix,jr,de.useNormalOffset),G.uploadCommonUniforms(J,jr,null,Zi);const Gr=hr.pbrMetallicRoughness;Gr.metallicFactor=.9,Gr.roughnessFactor=.5;const uo=$u(Ht,tn,Un,ai.globalMatrix,G,It.opacity,Gr.baseColorFactor,hr.emissiveFactor,Gr.metallicFactor,Gr.roughnessFactor,hr,yi,te,[0,0,0],zi,void 0,void 0,Jr);!Fr&&(At.hasTranslucentParts||It.opacity<1)&&jr.draw(G,J.gl.TRIANGLES,Pe,pt.disabled,gt.disabled,lt.backCCW,uo,te.id,Ki.vertexBuffer,Ki.indexBuffer,Ki.segments,te.paint,G.transform.zoom,void 0,Xt),jr.draw(G,J.gl.TRIANGLES,Fr?Ce:Pe,pt.disabled,Fr||It.opacity<1||At.hasTranslucentParts?gt.alphaBlended:gt.unblended,lt.backCCW,uo,te.id,Ki.vertexBuffer,Ki.indexBuffer,Ki.segments,te.paint,G.transform.zoom,void 0,Xt)}}}}if(G._debugParams.show3DModelFootprints&&tt.size>0){const Bt=Array.from(tt.keys()).sort();for(const bt of Bt){const{node:Vt,mvp:ii}=tt.get(bt);Hd(G,0,Vt,ii)}}})()})(a,t,o,c),void P();if(A.type!=="model")return;const D=A.getModels(),O=[],L=a.transform.getFreeCameraOptions().position,k=h.bN([],[L.x,L.y,L.z],a.transform.worldSize);h.ew(k,k);const N=[],H=[];let Z=0;for(const G of D){const ne=t.getFeatureState("",G.id),te={type:"Unknown",id:G.
vendor: 98,396 bytes, line 3281
3281id,properties:G.featureProperties},se=o.paint.get("model-rotation").evaluate(te,ne),J=o.paint.get("model-scale").evaluate(te,ne),K=o.paint.get("model-translation").evaluate(te,ne),oe=o.paint.get("model-opacity").evaluate(te,ne);cm(o,G.id,ne,G.featureProperties,G.nodeOverrideNames,G.nodeOverrides),um(o,G.id,ne,G.featureProperties,G.materialOverrideNames,G.materialOverrides),G.nodeOverrides.size>0&&G.computeBoundsAndApplyParent(),G.computeModelMatrix(a,se,J,K,y,_,!1);const de=h.cK([],k),ue=h.e8(G.position.lat,a.transform.zoom),ve=h.bT([],[1,1,1/ue]);O.push({zScaleMatrix:ve,negCameraPosMatrix:de});for(const be of G.nodes)rh(a,be,G.matrix,a.transform.expandedFarZProjMatrix,Z,N,H,G.materialOverrides,oe);Z++}if(N.sort((G,ne)=>ne.depth-G.depth),a.renderPass!=="shadow"){if(a._debugParams.show3DModelFootprints){const G=a.transform.projMatrix,ne=new Map,te=(J,K)=>{if(J.footprint){const oe=J.id||J.name||"footprint";if(!ne.has(oe)){const de=h.aC([],G,K);ne.set(oe,{node:J,mvp:de})}}};for(const J of H)te(J.node,J.modelMatrix);for(const J of N)te(J.node,J.modelMatrix);const se=Array.from(ne.keys()).sort();for(const J of se){const{node:K,mvp:oe}=ne.get(J);Hd(a,0,K,oe)}}qd(a,o,N,H,O),P()}else{for(const G of H)Aa(G.mesh,G.nodeModelMatrix,a,o);for(const G of N)Aa(G.mesh,G.nodeModelMatrix,a,o);P()}}},Wd={line:function(a,t,o){if(a.hasElevatedBuckets=!1,a.hasNonElevatedBuckets=!1,a._unevaluatedLayout.getValue("line-elevation-reference")!==void 0||a._unevaluatedLayout.getValue("line-z-offset")!==void 0){if(t){const c=t.getVisibleCoordinates();for(const d of c){const m=t.getTile(d).getBucket(a);if(m&&(m.elevationType!=="none"?a.hasElevatedBuckets=!0:a.hasNonElevatedBuckets=!0,a.hasElevatedBuckets&&a.hasNonElevatedBuckets))break}}}else a.hasNonElevatedBuckets=!0},model:function(a,t,o){const c=t.getSource();if(!c.loaded())return;if(c.type==="vector"||c.type==="geojson")return void(o.modelManager&&o.modelManager.upload(o,Fc(o,a)));if(c.type==="batched-model"||c.type!=="model")return;const d=c.getModels();for(const m of d)m.upload(o.context)},raster:function(a,t,o){const c=t.getSource();if(!(c instanceof ft&&c.loaded()))return;const d=a.sourceLayer||c.rasterLayerIds&&c.rasterLayerIds[0];if(!d)return;const m=a.paint.get("raster-array-band")||c.getInitialBand(d);if(m==null)return;const _=t.getIds().map(y=>t.getTileByID(y));for(const y of _)y.updateNeeded(a.id,m)&&c.prepareTile(y,d,a.id,m)}},_m={fill:Ze},Al={fill:function(a,t,o,c){if(!o.layout||o.layout.get("fill-elevation-reference")==="none"||o.paint.get("fill-opacity").constantOr(1)===0)return;const d=a.context.gl,m=new rt(d.LEQUAL,rt.ReadOnly,a.depthRangeFor3D),_=new pt({func:d.ALWAYS,mask:255},255,255,d.KEEP,d.KEEP,d.REPLACE),y=a.transform.getFreeCameraOptions().position,v=a.getOrCreateProgram("elevatedStructuresDepthReconstruct");for(const T of c){const I=t.getTile(T),P=I.getBucket(o);if(!P)continue;const A=P.elevatedStructures;if(!A||!A.depthSegments||A.depthSegments.segments[0].primitiveLength===0)continue;const D=He(T.toUnwrapped(),y),O=a.translatePosMatrix(T.projMatrix,I,o.paint.get("fill-translate"),o.paint.get("fill-translate-anchor")),L=vl(O,D,0,1,0);v.draw(a,d.TRIANGLES,m,_,gt.disabled,lt.disabled,L,o.id,A.vertexBuffer,A.indexBuffer,A.depthSegments,o.paint,a.transform.zoom)}}};class gm{constructor(t,o,c,d,m){this.context=new Wr(t,o),this.transform=c,this._tileTextures={},this.frameCopies=[],this.loadTimeStamps=[],this._debugParams={averageFPS:0,fpsHistory:[],fpsWindow:30,dt:0,timeStamp:h.o.now(),continousRedraw:!1,enabledLayers:{},buildingsShowNormals:!1,buildingsDrawGroundAO:!0,buildingsDrawShadowPass:!0,buildingsDrawTranslucentPass:!0,showTerrainProxyTiles:!1,terrainSortTilesHiZFirst:!0,terrainDisableRenderCache:!1,forceEnablePrecipitation:!1,overrideSnowParams:!1,snowParamsOverride:null,snowRevealParamsOverride:null,snowVignetteParamsOverride:null,overrideRainParams:!1,rainParamsOverride:null,rainRevealParamsOverride:null,rainVignetteParamsOverride:null,overrideStarsParams:!1,starsParamsOverride:null,show3DModelFootprints:!1,showElevationIdDebug:!1,lodSwitchDistance:3e3},this.occlusionParams=new El,this.setup(),this.numSublayers=Ut.maxUnderzooming+Ut.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.deferredRenderGpuTimeQueries=[],this.gpuTimers={},this.frameCounter=0,this._shadowCullCache=null,this._backgroundTiles={},this.conflationActive=!1,this.replacementSource=new h.eJ,this.longestCutoffRange=0,this.minCutoffZoom=0,this._fogVisible=!1,this._cachedTileFogOpacities={},this._shadowRenderer=new xp(this),this._wireframeDebugCache=new di,this.renderDefaultNorthPole=!0,this.renderDefaultSouthPole=!0,this.layersWithOcclusionOpacity=[];const _=new h.q({width:1,height:1},Uint8Array.of(0,0,0,0));this.emptyDepthTexture=new h.T(this.context,_,t.RGBA8),this._clippingActiveLastFrame=!1,this.scaleFactor=d,this.maxFrontCutoffRawStart=0,this.worldview=m,this._forceEmissiveMode=!1,this.emissiveMode="constant"}updateTerrain(t,o){const c=!!t&&!!t.terrain&&this.transform.projection.supportsTerrain;if(!(c||this._terrain&&this._terrain.enabled))return;this._terrain||(this._terrain=new ts(this,t));const d=this._terrain;this.transform.elevation=c?d:null,d.update(t,this.transform,o),this.transform.elevation&&!d.enabled&&(this.transform.elevation=null)}_updateFog(t){const o=t.fog;if(!o||this.transform.projection.name==="globe"||o.getOpacity(this.transform.pitch)<1||o.properties.get("horizon-blend")<.03)return void(this.transform.fogCullDistSq=null);const[c,d]=o.getRangeForProjection();if(c>d)return void(this.transform.fogCullDistSq=null);const m=c+.78*(d-c);this.transform.fogCullDistSq=m*m}get terrain(){return this.transform._terrainEnabled()&&this._terrain&&this._terrain.enabled||this._forceTerrainMode?this._terrain:null}get forceTerrainMode(){return this._forceTerrainMode}set forceTerrainMode(t){t&&!this._terrain&&(this._terrain=new ts(this,this.style)),this._forceTerrainMode=t}get shadowRenderer(){return this._shadowRenderer&&this._shadowRenderer.enabled?this._shadowRenderer:null}get wireframeDebugCache(){return this._wireframeDebugCache}resize(t,o){if(this.width=t*h.o.devicePixelRatio,this.height=o*h.o.devicePixelRatio,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const c of this.style.order)this.style._mergedLayers[c].resize()}setup(){const t=this.context,o=new h.dE;o.emplaceBack(0,0),o.emplaceBack(h.ak,0),o.emplaceBack(0,h.ak),o.emplaceBack(h.ak,h.ak),this.tileExtentBuffer=t.createVertexBuffer(o,h.dA.members),this.tileExtentSegments=h.dB.simpleSegment(0,0,4,2);const c=new h.dE;c.emplaceBack(0,0),c.emplaceBack(h.ak,0),c.emplaceBack(0,h.ak),c.emplaceBack(h.ak,h.ak),this.debugBuffer=t.createVertexBuffer(c,h.dA.members),this.debugSegments=h.dB.simpleSegment(0,0,4,5);const d=new h.dE;d.emplaceBack(-1,-1),d.emplaceBack(1,-1),d.emplaceBack(-1,1),d.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(d,h.dA.members),this.viewportSegments=h.dB.simpleSegment(0,0,4,2);const m=new h.eK;m.emplaceBack(0,0,0,0),m.emplaceBack(h.ak,0,h.ak,0),m.emplaceBack(0,h.ak,0,h.ak),m.emplaceBack(h.ak,h.ak,h.ak,h.ak),this.mercatorBoundsBuffer=t.createVertexBuffer(m,h.eL.members),this.mercatorBoundsSegments=h.dB.simpleSegment(0,0,4,2);const _=new h.dF;_.emplaceBack(0,1,2),_.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(_);const y=new h.eM;for(const T of[0,1,3,2,0])y.emplaceBack(T);this.debugIndexBuffer=t.createIndexBuffer(y),this.emptyTexture=new h.T(t,new h.q({width:1,height:1},Uint8Array.of(0,0,0,0)),t.gl.RGBA8),this.identityMat=h.bd();const v=this.context.gl;this.stencilClearMode=new pt({func:v.ALWAYS,mask:0},0,255,v.ZERO,v.ZERO,v.ZERO),this.loadTimeStamps.push(performance.now())}getMercatorTileBoundsBuffers(){return{tileBoundsBuffer:this.mercatorBoundsBuffer,tileBoundsIndexBuffer:this.quadTriangleIndexBuffer,tileBoundsSegments:this.mercatorBoundsSegments}}getTileBoundsBuffers(t){return t._makeTileBoundsBuffers(this.context,this.transform.projection),t._tileBoundsBuffer?{tileBoundsBuffer:t._tileBoundsBuffer,tileBoundsIndexBuffer:t._tileBoundsIndexBuffer,tileBoundsSegments:t._tileBoundsSegments}:this.getMercatorTileBoundsBuffers()}clearStencil(){const t=this.context.gl;this.nextStencilID=1,this.currentStencilSource=void 0,this._tileClippingMaskIDs={},this.getOrCreateProgram("clippingMask").draw(this,t.TRIANGLES,rt.disabled,this.stencilClearMode,gt.disabled,lt.disabled,ba(this.identityMat),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}resetStencilClippingMasks(){this.terrain||(this.currentStencilSource=void 0,this._tileClippingMaskIDs={})}_renderTileClippingMasks(t,o,c){if(!o||this.currentStencilSource===o.id||!t.isTileClipped()||!c||c.length===0)return;if(this._tileClippingMaskIDs&&!this.terrain){let y=!1;for(const v of c)if(this._tileClippingMaskIDs[v.key]===void 0){y=!0;break}if(!y)return}this.currentStencilSource=o.id;const d=this.context,m=d.gl;this.nextStencilID+c.length>256&&this.clearStencil(),d.setColorMode(gt.disabled),d.setDepthMode(rt.disabled);const _=this.getOrCreateProgram("clippingMask");this._tileClippingMaskIDs={};for(const y of c){const v=o.getTile(y),T=this._tileClippingMaskIDs[y.key]=this.nextStencilID++,{tileBoundsBuffer:I,tileBoundsIndexBuffer:P,tileBoundsSegments:A}=this.getTileBoundsBuffers(v);_.draw(this,m.TRIANGLES,rt.disabled,new pt({func:m.ALWAYS,mask:0},T,255,m.KEEP,m.KEEP,m.REPLACE),gt.disabled,lt.disabled,ba(y.projMatrix),"$clipping",I,P,A)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const t=this.nextStencilID++,o=this.context.gl;return new pt({func:o.NOTEQUAL,mask:255},t,255,o.KEEP,o.KEEP,o.REPLACE)}stencilModeForClipping(t){if(this.terrain)return this.terrain.stencilModeForRTTOverlap(t);const o=this.context.gl;return new pt({func:o.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,o.KEEP,o.KEEP,o.REPLACE)}stencilConfigForOverlap(t){const o=this.context.gl,c=t.sort((_,y)=>y.overscaledZ-_.overscaledZ),d=c.at(-1).overscaledZ,m=c[0].overscaledZ-d+1;if(m>1){this.currentStencilSource=void 0,this.nextStencilID+m>256&&this.clearStencil();const _={};for(let y=0;y<m;y++)_[y+d]=new pt({func:o.GEQUAL,mask:255},y+this.nextStencilID,255,o.KEEP,o.KEEP,o.REPLACE);return this.nextStencilID+=m,[_,c]}return[{[d]:pt.disabled},c]}colorModeForRenderPass(){const t=this.context.gl;return this._showOverdrawInspector?new gt([t.CONSTANT_COLOR,t.ONE,t.CONSTANT_COLOR,t.ONE],new h.C(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?gt.unblended:gt.alphaBlended}colorModeForDrapableLayerRenderPass(t){const o=this.context.gl;return this.style&&this.style.enable3dLights()&&this.terrain&&this.terrain.renderingToTexture&&this.renderPass==="translucent"?t!=null&&this.emissiveMode!=="mrt-fallback"||this.emissiveMode==="constant"?new gt([o.ONE,o.ONE_MINUS_SRC_ALPHA,o.CONSTANT_ALPHA,o.ONE_MINUS_SRC_ALPHA],new h.C(0,0,0,t??0),[!0,!0,!0,!0]):this.emissiveMode==="dual-source-blending"?new gt([o.ONE,o.ONE_MINUS_SRC_ALPHA,this.context.extBlendFuncExtended.SRC1_ALPHA_WEBGL,o.ONE_MINUS_SRC_ALPHA],h.C.transparent,[!0,!0,!0,!0]):this.colorModeForRenderPass():this.colorModeForRenderPass()}depthModeForSublayer(t,o,c,d=!1){if(this.depthOcclusion)return new rt(this.context.gl.GREATER,rt.ReadOnly,this.depthRangeFor3D);if(!this.opaquePassEnabledForLayer()&&!d)return rt.disabled;const m=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new rt(c||this.context.gl.LEQUAL,o,[m,m])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}blitDepth(){const t=this.context.gl,o=Math.ceil(this.width),c=Math.ceil(this.height),d=this.context.bindFramebuffer.get(),m=t.getParameter(t.TEXTURE_BINDING_2D);this.depthFBO&&this.depthFBO.width===o&&this.depthFBO.height===c||(this.depthFBO&&(this.depthFBO.destroy(),this.depthFBO=void 0,this.depthTexture=void 0),o!==0&&c!==0&&(this.depthFBO=new Ds(this.context,o,c,0,"texture"),this.depthTexture=new h.T(this.context,{width:o,height:c,data:null},t.DEPTH24_STENCIL8),this.depthFBO.depthAttachment.set(this.depthTexture.texture))),this.context.bindFramebuffer.set(d),t.bindTexture(t.TEXTURE_2D,m),this.depthFBO&&(t.bindFramebuffer(t.READ_FRAMEBUFFER,null),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,this.depthFBO.framebuffer),t.blitFramebuffer(0,0,o,c,0,0,o,c,t.DEPTH_BUFFER_BIT,t.NEAREST),t.bindFramebuffer(t.FRAMEBUFFER,this.context.bindFramebuffer.current))}render(t,o){this.context.sweepPendingPrograms(),this._wireframeDebugCache.update(this.frameCounter),this.style=t,this.options=o;const c=this.style._mergedLayers,d=!(!this.terrain||!this.terrain.enabled),m=()=>this.style._getOrder(d);let _=m(),y=!1,v=!1,T=null,I=0,P=!1;for(const fe of _){const Ee=c[fe];Ee.visibility!=="none"&&(Ee.type==="circle"?y=!0:Ee.type==="building"?(T=Ee,++I):Ee.type==="symbol"&&(Ee.hasOcclusionOpacityProperties?v=!0:y=!0))}this.updateEmissiveMode();let A=_.map(fe=>c[fe]);const D=this.style._mergedSourceCaches;this.imageManager=t.imageManager,this.modelManager=t.modelManager,this.symbolFadeChange=t.placement.symbolFadeChange(h.o.now()),this.imageManager.beginFrame();for(const fe in D){const Ee=D[fe];Ee.used&&(Ee.prepare(this.context),Ee.getSource().usedInConflation&&++I)}let O=!1;for(const fe of A)fe.isHidden(this.transform.zoom)||(fe.type==="clip"&&(O=!0),this.prepareLayer(fe));const L={},k={},N={},H={},Z={};for(const fe in D){const Ee=D[fe];L[fe]=Ee.getVisibleCoordinates(),k[fe]=L[fe].slice().reverse(),N[fe]=Ee.getVisibleCoordinates(!0).reverse(),H[fe]=Ee.getShadowCasterCoordinates(),Z[fe]=Ee.sortCoordinatesByDistance(L[fe])}const G=fe=>{const Ee=this.style.getLayerSourceCache(fe);return Ee&&Ee.used?Ee.getSource():null};if(I||O||this._clippingActiveLastFrame){const fe=[],Ee=[];let pe=0;for(const Pe of A)this.isSourceForClippingOrConflation(Pe,G(Pe))&&(fe.push(Pe),Ee.push(pe)),pe++;if(fe&&(O||fe.length>1)||this._clippingActiveLastFrame){O=!1;const Pe=[];for(let Ce=0;Ce<fe.length;Ce++){const Re=fe[Ce],Ye=Ee[Ce],qe=this.style.getLayerSourceCache(Re);if(!qe||!qe.used||!qe.getSource().usedInConflation&&Re.type!=="clip"&&Re.type!=="building")continue;let je=h.eN,Be=h.bE.None;const at=[];let ot=!0;if(Re.type==="building")je=h.eP;else if(Re.type==="clip")if(je=Ye,Re.isHidden(this.transform.zoom))ot=!1;else{if(!Re.layout){ot=!1;continue}for(const tt of Re.layout.get("clip-layer-types"))Be|=tt==="model"?h.bE.Model:tt==="symbol"?h.bE.Symbol:h.bE.FillExtrusion;for(const tt of Re.layout.get("clip-layer-scope"))at.push(h.t(tt,Re.scope));O=!0}ot&&Pe.push({layer:Re.fqid,cache:qe,order:je,clipMask:Be,clipScope:at})}this.replacementSource.setSources(Pe),P=!0}}this._clippingActiveLastFrame=O,P||this.replacementSource.clear(),this.conflationActive=P,this.minCutoffZoom=0,this.longestCutoffRange=0,this.maxFrontCutoffRawStart=0,this.opaquePassCutoff=1/0,this._lastOcclusionLayer=-1,this.layersWithOcclusionOpacity=[];for(let fe=0;fe<A.length;fe++){const Ee=A[fe];if(Ee.visibility==="none")continue;const pe=Ee.cutoffRange();if(this.longestCutoffRange=Math.max(pe,this.longestCutoffRange),pe>0){const Pe=G(Ee);Pe&&(this.minCutoffZoom=Math.max(Pe.minzoom,this.minCutoffZoom)),Ee.minzoom&&(this.minCutoffZoom=Math.max(Ee.minzoom,this.minCutoffZoom))}Ee.is3D(d)&&(this.opaquePassCutoff===1/0&&(this.opaquePassCutoff=fe),this._lastOcclusionLayer=fe)}const ne=this.style&&this.style.fog;ne?(this._fogVisible=ne.getOpacity(this.transform.pitch)!==0,this._fogVisible&&this.transform.projection.name!=="globe"&&(this._fogVisible=ne.isVisibleOnFrustum(this.transform.cameraFrustum))):this._fogVisible=!1,this._cachedTileFogOpacities={},this.terrain&&(this.terrain.updateTileBinding(N),this.opaquePassCutoff=0,_=m(),A=_.map(fe=>c[fe]));const te=this._shadowRenderer;if(te){te.updateShadowParameters(this.transform,this.style.directionalLight);for(const fe in D)for(const Ee of L[fe]){let pe={min:0,max:0};this.terrain&&(pe=this.terrain.getMinMaxForTile(Ee)||pe),te.addShadowReceiver(Ee.toUnwrapped(),pe.min,pe.max)}}this.transform.projection.name!=="globe"||this.globeSharedBuffers||(this.globeSharedBuffers=new h.eO(this.context)),this.style.fog&&this.transform.projection.supportsFog?(this._atmosphere||(this._atmosphere=new Ia),this._atmosphere.update(this)):this._atmosphere&&(this._atmosphere.destroy(),this._atmosphere=void 0);let se=!(!this.style||!this.style.snow),J=!(!this.style||!this.style.rain);if(se&&!this._snow&&Sr.Snow&&(this._snow=new Sr.Snow),!se&&this._snow&&(this._snow.destroy(),delete this._snow),J&&!this._rain&&Sr.Rain&&(this._rain=new Sr.Rain),!J&&this._rain&&(this._rain.destroy(),delete this._rain),this._snow&&this._snow.update(this),this._rain&&this._rain.update(this),T){this.buildingTileBorderManager||(this.buildingTileBorderManager=new Gd);const fe=this.style.getLayerSourceCache(T);this.buildingTileBorderManager.updateBorders(fe,T)}if(!ea.has(this.context.gl))return;this.renderPass="offscreen";for(const fe of A){const Ee=t.getLayerSourceCache(fe);if(!fe.hasOffscreenPass()||fe.isHidden(this.transform.zoom))continue;const pe=Ee?k[Ee.id]:void 0;(fe.type==="custom"||fe.type==="raster"||fe.type==="raster-particle"||fe.isSky()||pe&&pe.length)&&this.renderLayer(this,Ee,fe,pe)}this.depthRangeFor3D=[0,1-(A.length+2)*this.numSublayers*this.depthEpsilon],this._shadowRenderer&&(this.renderPass="shadow",this._shadowRenderer.drawShadowPass(this.style,H)),this.context.bindFramebuffer.set(null),this.context.viewport.set([0,0,this.width,this.height]);const K=this.transform.projection.name==="globe"||this.transform.isHorizonVisible(),oe=(()=>{if(o.showOverdrawInspector)return h.C.black;const fe=this.style.fog;if(fe&&this.transform.projection.supportsFog){const Ee=this.style.getLut(fe.scope);if(!K){const pe=fe.properties.get("color-use-theme")==="none",Pe=fe.properties.get("color").toNonPremultipliedRenderColor(pe?null:Ee).toArray01();return new h.C(...Pe)}if(K){const pe=fe.properties.get("space-color-use-theme")==="none",Pe=fe.properties.get("space-color").toNonPremultipliedRenderColor(pe?null:Ee).toArray01();return new h.C(...Pe)}}return h.C.transparent})();if(this.context.clear({color:oe,depth:1}),this.clearStencil(),this._showOverdrawInspector=o.showOverdrawInspector,this.renderPass="opaque",this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&K&&this._atmosphere.drawStars(this,this.style.fog),!this.terrain)for(this.currentLayer=_.length-1;this.currentLayer>=0;this.currentLayer--){const fe=A[this.currentLayer],Ee=t.getLayerSourceCache(fe);if(fe.isSky())continue;const pe=Ee?(fe.is3D(d)?Z:k)[Ee.id]:void 0;this._renderTileClippingMasks(fe,Ee,pe),this.renderLayer(this,Ee,fe,pe)}if(this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&K&&this._atmosphere.drawAtmosphereGlow(this,this.style.fog),this.renderPass="sky",(!this._atmosphere||h.ai(this.transform.zoom)>0)&&(this.transform.projection.name==="globe"||this.transform.isHorizonVisible()))for(this.currentLayer=0;this.currentLayer<_.length;this.currentLayer++){const fe=A[this.currentLayer],Ee=t.getLayerSourceCache(fe);fe.isSky()&&this.renderLayer(this,Ee,fe,Ee?k[Ee.id]:void 0)}function de(fe,Ee){let pe;return Ee&&(pe=(fe.type==="symbol"?N:fe.is3D(d)?Z:k)[Ee.id]),pe}if(this.renderPass="translucent",this.transform.projection.name==="globe"){for(this.renderElevatedRasterBackface=!0,this.currentLayer=0;this.currentLayer<_.length;){const fe=A[this.currentLayer];if(fe.type==="raster"||fe.type==="raster-particle"){const Ee=t.getLayerSourceCache(fe);this.renderLayer(this,Ee,fe,de(fe,Ee))}++this.currentLayer}this.renderElevatedRasterBackface=!1}this.currentLayer=0,this.firstLightBeamLayer=Number.MAX_SAFE_INTEGER;const ue=te?te.getGroundShadowLayerIndex():-1;let ve=!1,be=-1;for(let fe=0;fe<_.length;++fe){const Ee=A[fe];Ee.isHidden(this.transform.zoom)||Ee.is3D(d)&&(be=fe)}v&&be===-1&&(y=!0);let ke=!1;for(;this.currentLayer<_.length;){const fe=A[this.currentLayer],Ee=t.getLayerSourceCache(fe);if(fe.isSky())++this.currentLayer;else if(this.terrain&&this.style.isLayerDraped(fe)){if(fe.isHidden(this.transform.zoom)){++this.currentLayer;continue}this.currentLayer=this.terrain.renderBatch(this.currentLayer),this._lastOcclusionLayer=Math.max(this.currentLayer,this._lastOcclusionLayer)}else{if(!ke&&fe.is3D(d)&&!d){const pe=this.currentLayer,Pe=Ce=>{for(this.currentLayer=0;this.currentLayer<A.length;this.currentLayer++){const Re=A[this.currentLayer];if(_m[Re.type]){const Ye=this.style.getLayerSourceCache(Re);_m[Re.type](this,Ye,Re,de(Re,Ye),Ce)}}};Pe("initialize"),Pe("reset"),this.currentLayer=pe,ke=!0}if(y&&!ve&&this.terrain&&!this.transform.isOrthographic&&(ve=!0,this.blitDepth()),v&&be!==-1&&this.currentLayer===be+1&&!this.transform.isOrthographic&&this.blitDepth(),this.terrain||this._renderTileClippingMasks(fe,Ee,Ee?L[Ee.id]:void 0),this.renderLayer(this,Ee,fe,de(fe,Ee)),!this.terrain&&te&&this.currentLayer===ue){{this.clearStencil(),this.resetStencilClippingMasks();const pe=this.currentLayer;for(this.currentLayer=0;this.currentLayer<A.length;this.currentLayer++){const Pe=A[this.currentLayer];if(Al[Pe.type]){const Ce=this.style.getLayerSourceCache(Pe);Al[Pe.type](this,Ce,Pe,de(Pe,Ce))}}this.currentLayer=pe}if(te.drawGroundShadows(),this.firstLightBeamLayer<=this.currentLayer){const pe=this.currentLayer;for(this.renderPass="light-beam",this.currentLayer=this.firstLightBeamLayer;this.currentLayer<=pe;this.currentLayer++){const Pe=A[this.currentLayer];if(!Pe.hasLightBeamPass())continue;const Ce=t.getLayerSourceCache(Pe);this.renderLayer(this,Ce,Pe,Ce?k[Ce.id]:void 0)}this.currentLayer=pe,this.renderPass="translucent"}}if(this.currentLayer>=this._lastOcclusionLayer&&this.layersWithOcclusionOpacity.length>0){const pe=this.currentLayer;this.depthOcclusion=!0;for(const Pe of this.layersWithOcclusionOpacity){this.currentLayer=Pe;const Ce=A[this.currentLayer],Re=t.getLayerSourceCache(Ce),Ye=Re?k[Re.id]:void 0;this.terrain||this._renderTileClippingMasks(Ce,Re,Re?L[Re.id]:void 0),this.renderLayer(this,Re,Ce,Ye)}this.depthOcclusion=!1,this.currentLayer=pe,this.renderPass="translucent",this.layersWithOcclusionOpacity=[]}++this.currentLayer}}if(this.terrain&&this.terrain.postRender(),this._snow&&this._snow.draw(this),this._rain&&this._rain.draw(this),this.options.showTileBoundaries||this.options.showQueryGeometry||this.options.showTileAABBs){let fe=null;A.forEach(Ee=>{const pe=t.getLayerSourceCache(Ee);pe&&!Ee.isHidden(this.transform.zoom)&&pe.getVisibleCoordinates().length&&(!fe||fe.getSource().maxzoom<pe.getSource().maxzoom)&&(fe=pe)}),fe&&this.options.showTileBoundaries&&(function(Ee,pe,Pe,Ce,Re,Ye){for(let qe=0;qe<Pe.length;qe++)kd(Ee,pe,Pe[qe],Ce,0,0,Ye)})(this,fe,fe.getVisibleCoordinates(),h.C.red,0,this.options.showParseStatus)}this.options.showPadding&&(function(fe){const Ee=fe.transform.padding;ns(fe,fe.transform.height-(Ee.top||0),3,En),ns(fe,Ee.bottom||0,3,Ls),Qu(fe,Ee.left||0,3,Sl),Qu(fe,fe.transform.width-(Ee.right||0),3,Ku);const pe=fe.transform.centerPoint;(function(Pe,Ce,Re,Ye){en(Pe,Ce-1,Re-10,2,20,Ye),en(Pe,Ce-10,Re-1,20,2,Ye)})(fe,pe.x,fe.transform.height-pe.y,Bd)})(this),this.context.setDefault(),this.frameCounter=(this.frameCounter+1)%Number.MAX_SAFE_INTEGER,this.tileLoaded&&this.options.speedIndexTiming&&(this.loadTimeStamps.push(performance.now()),this.saveCanvasCopy()),P||(this.conflationActive=!1)}prepareLayer(t){this.gpuTimingStart(t);const{unsupportedLayers:o}=this.transform.projection,c=!o||!o.includes(t.type);if(Wd[t.type]&&(c||this.terrain&&t.type==="custom")){const d=this.style.getLayerSourceCache(t);Wd[t.type](t,d,this)}this.gpuTimingEnd()}renderLayer(t,o,c,d){c.isHidden(this.transform.zoom)||(c.type==="background"||c.type==="sky"||c.type==="custom"||c.type==="model"||c.type==="raster"||c.type==="raster-particle"||d&&d.length)&&(this.id=c.id,this.gpuTimingStart(c),(!t.transform.projection.unsupportedLayers||!t.transform.projection.unsupportedLayers.includes(c.type)||t.terrain&&c.type==="custom")&&c.type!=="clip"&&c.type!=="slot"&&nh[c.type]&&nh[c.type](t,o,c,d,this.style.placement.variableOffsets,this.options.isInitialLoad),nh[c.type]||(async function(){await(async function(){return Promise.resolve()})(),Object.assign(nh,{building:Sr.drawBuilding,"raster-particle":Sr.drawRasterParticle}),Object.assign(Wd,{"raster-particle":Sr.prepareRasterParticle})})(),this.gpuTimingEnd())}gpuTimingStart(t){if(!this.options.gpuTiming)return;const o=this.context.extTimerQuery,c=this.context.gl;let d=this.gpuTimers[t.id];d||(d=this.gpuTimers[t.id]={calls:0,cpuTime:0,query:c.createQuery()}),d.calls++,c.beginQuery(o.TIME_ELAPSED_EXT,d.query)}gpuTimingDeferredRenderStart(){if(this.options.gpuTimingDeferredRender){const t=this.context.extTimerQuery,o=this.context.gl,c=o.createQuery();this.deferredRenderGpuTimeQueries.push(c),o.beginQuery(t.TIME_ELAPSED_EXT,c)}}gpuTimingDeferredRenderEnd(){this.options.gpuTimingDeferredRender&&this.context.gl.endQuery(this.context.extTimerQuery.TIME_ELAPSED_EXT)}gpuTimingEnd(){this.options.gpuTiming&&this.context.gl.endQuery(this.context.extTimerQuery.TIME_ELAPSED_EXT)}collectGpuTimers(){const t=this.gpuTimers;return this.gpuTimers={},t}collectDeferredRenderGpuQueries(){const t=this.deferredRenderGpuTimeQueries;return this.deferredRenderGpuTimeQueries=[],t}queryGpuTimers(t){const o={};for(const c in t){const d=t[c],m=this.context.extTimerQuery,_=m.getQueryParameter(d.query,this.context.gl.QUERY_RESULT)/1e6;m.deleteQueryEXT(d.query),o[c]=_}return o}queryGpuTimeDeferredRender(t){if(!this.options.gpuTimingDeferredRender)return 0;const o=this.context.gl;let c=0;for(const d of t)c+=o.getQueryParameter(d,o.QUERY_RESULT)/1e6,o.deleteQuery(d);return c}translatePosMatrix(t,o,c,d,m){if(!c[0]&&!c[1])return t;const _=m?d==="map"?this.transform.angle:0:d==="viewport"?-this.transform.angle:0;if(_){const T=Math.sin(_),I=Math.cos(_);c=[c[0]*I-c[1]*T,c[0]*T+c[1]*I]}const y=[m?c[0]:h.az(o,c[0],this.transform.zoom),m?c[1]:h.az(o,c[1],this.transform.zoom),0],v=new Float32Array(16);return h.bB(v,t,y),v}saveTileTexture(t){if(t.context!==this.context)return;const o=t.size[0],c=this._tileTextures[o];c?c.push(t):this._tileTextures[o]=[t]}getTileTexture(t){const o=this._tileTextures[t];return o&&o.length>0?o.pop():null}terrainRenderModeElevated(){return this.style&&!!this.style.getTerrain()&&!!this.terrain&&!this.terrain.renderingToTexture||this.forceTerrainMode}linearFloatFilteringSupported(){return this.context.extTextureFloatLinear!=null}currentGlobalDefines(t,o,c,d,m){const _=c===void 0?this.terrain&&this.terrain.renderingToTexture:c,y=d===void 0?this.terrainRenderModeElevated():d,v=m===void 0?this.transform.projection.name==="globe":m,T=[];return this.style&&this.style.enable3dLights()&&(t==="globeRaster"||t==="terrainRaster"?(T.push("LIGHTING_3D_MODE"),T.push("LIGHTING_3D_ALPHA_EMISSIVENESS")):_||T.push("LIGHTING_3D_MODE")),y&&(T.push("TERRAIN"),this.linearFloatFilteringSupported()&&T.push("TERRAIN_DEM_FLOAT_FORMAT")),v&&T.push("GLOBE"),!this._fogVisible||_||o!==void 0&&!o||T.push("FOG"),_&&T.push("RENDER_TO_TEXTURE"),this._showOverdrawInspector&&T.push("OVERDRAW_INSPECTOR"),T}getOrCreateProgram(t,o){this.cache=this.cache||{};const{defines:c,config:d,overrideFog:m,overrideRtt:_,overrideTerrain:y,overrideGlobe:v,precompiled:T}=o||{},I=this.currentGlobalDefines(t,m,_,y,v).concat(c||[]),P=this.getShaderSource(t),A=Kp[t]||Sr.programUniforms[t],D=gd.cacheKey(P,t,I,d);return this.cache[D]||(this.cache[D]=new gd(this.context,t,P,d,A,I,T)),this.cache[D]}getShaderSource(t){return G_[t]||Sr.shaders&&Sr.shaders[t]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.frontFace.setDefault(),this.context.cullFaceSide.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new h.T(this.context,this.debugOverlayCanvas,this.context.gl.RGBA8))}destroy(){this._terrain&&this._terrain.destroy(),this._atmosphere&&(this._atmosphere.destroy(),this._atmosphere=void 0),this.globeSharedBuffers&&this.globeSharedBuffers.destroy(),this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this._wireframeDebugCache.destroy(),this.depthFBO&&(this.depthFBO.destroy(),this.depthFBO=void 0,this.depthTexture=void 0),this.emptyDepthTexture&&this.emptyDepthTexture.destroy()}prepareDrawTile(){this.terrain&&this.terrain.prepareDrawTile()}uploadCommonLightUniforms(t,o){if(this.style.enable3dLights()){const c=this.style.directionalLight,d=this.style.ambientLight;if(c&&d){const m=((_,y,v)=>{const T=_.properties.get("direction"),I=_.properties.get("color-use-theme")==="none",P=_.properties.get("color").toNonPremultipliedRenderColor(I?null:v.getLut(_.scope)).toArray01(),A=_.properties.get("intensity"),D=y.properties.get("color-use-theme")==="none",O=y.properties.get("color").toNonPremultipliedRenderColor(D?null:v.getLut(y.scope)).toArray01(),L=y.properties.get("intensity"),k=[T.x,T.y,T.z],N=h.dG(O,L),H=h.dG(P,A);return{u_lighting_ambient_color:N,u_lighting_directional_dir:k,u_lighting_directional_color:H,u_ground_radiance:Bp(k,H,N)}})(c,d,this.style);o.setLightsUniformValues(t,m)}}}uploadCommonUniforms(t,o,c,d,m){if(this.uploadCommonLightUniforms(t,o),this.terrain&&this.terrain.renderingToTexture)return;const _=this.style.fog;if(_){const y=_.getOpacity(this.transform.pitch),v=((T,I,P,A,D,O,L,k,N,H,Z,G)=>{const ne=T.transform,te=I.properties.get("color-use-theme")==="none",se=I.properties.get("color").toNonPremultipliedRenderColor(te?null:T.style.getLut(I.scope)).toArray01();se[3]=A;const J=T.frameCounter/1e3%1,[K,oe]=I.properties.get("vertical-range");return{u_fog_matrix:P?ne.calculateFogTileMatrix(P):G||T.identityMat,u_fog_range:I.getRangeForProjection(),u_fog_color:se,u_fog_horizon_blend:I.properties.get("horizon-blend"),u_fog_vertical_limit:[Math.min(K,oe),oe],u_fog_temporal_offset:J,u_frustum_tl:D,u_frustum_tr:O,u_frustum_br:L,u_frustum_bl:k,u_globe_pos:N,u_globe_radius:H,u_viewport:Z,u_globe_transition:h.ai(ne.zoom),u_is_globe:+(ne.projection.name==="globe")}})(this,_,c,y,this.transform.frustumCorners.TL,this.transform.frustumCorners.TR,this.transform.frustumCorners.BR,this.transform.frustumCorners.BL,this.transform.globeCenterInViewSpace,this.transform.globeRadius,[this.transform.width*h.o.devicePixelRatio,this.transform.height*h.o.devicePixelRatio],d);o.setFogUniformValues(t,v)}m&&o.setCutoffUniformValues(t,m.uniformValues)}setTileLoadedFlag(t){this.tileLoaded=t}saveCanvasCopy(){const t=this.canvasCopy();t&&(this.frameCopies.push(t),this.tileLoaded=!1)}canvasCopy(){const t=this.context.gl,o=t.createTexture();return t.bindTexture(t.TEXTURE_2D,o),t.copyTexImage2D(t.TEXTURE_2D,0,t.RGBA,0,0,t.drawingBufferWidth,t.drawingBufferHeight,0),o}getCanvasCopiesAndTimestamps(){return{canvasCopies:this.frameCopies,timeStamps:this.loadTimeStamps}}averageElevationNeedsEasing(){if(!this.transform._elevation)return!1;const t=this.style&&this.style.fog;return!!t&&t.getOpacity(this.transform.pitch)!==0}getBackgroundTiles(){const t=this._backgroundTiles,o=this._backgroundTiles={},c=this.transform.coveringTiles({tileSize:512});for(const d of c)o[d.key]=t[d.key]||new h.b3(d,512,this.transform.tileZoom,this,void 0,this.worldview);return o}clearBackgroundTiles(){this._backgroundTiles={}}isSourceForClippingOrConflation(t,o){return!(!t.is3D(!(!this.terrain||!this.terrain.enabled))||t.type!=="clip"&&t.type!=="building"&&(t.minzoom&&t.minzoom>this.transform.zoom||(this.style._clipLayerPresent||t.sourceLayer!=="building"&&t.sourceLayer!=="procedural_buildings")&&(!o||o.type!=="batched-model")))}isTileAffectedByFog(t){if(!this.style||!this.style.fog)return!1;if(this.transform.projection.name==="globe")return!0;let o=this._cachedTileFogOpacities[t.key];return o||(this._cachedTileFogOpacities[t.key]=o=this.style.fog.getOpacityForTile(t)),o[0]>=Yo||o[1]>=Yo}setupDepthForOcclusion(t,o,c){const d=this.context,m=d.gl,_=!!c;var y;c||(c={u_dem:2,u_dem_prev:4,u_dem_tl:[0,0],u_dem_tl_prev:[0,0],u_dem_scale:0,u_dem_scale_prev:0,u_dem_size:0,u_dem_lerp:1,u_depth:3,u_depth_size_inv:[0,0],u_depth_range_unpack:[0,1],u_occluder_half_size:16,u_occlusion_depth_offset:-1e-4,u_exaggeration:0}),d.activeTexture.set(m.TEXTURE3),t&&this.depthFBO&&this.depthTexture?(this.depthTexture.bind(m.NEAREST,m.CLAMP_TO_EDGE),c.u_depth_size_inv=[1/this.depthFBO.width,1/this.depthFBO.height],c.u_depth_range_unpack=[2/((y=this.depthRangeFor3D)[1]-y[0]),-1-2*y[0]/(y[1]-y[0])],c.u_occluder_half_size=.5*this.occlusionParams.occluderSize,c.u_occlusion_depth_offset=this.occlusionParams.depthOffset):this.emptyDepthTexture.bind(m.NEAREST,m.CLAMP_TO_EDGE),d.activeTexture.set(m.TEXTURE0),_||o.setTerrainUniformValues(d,c)}updateEmissiveMode(){if(this._forceEmissiveMode)return;const t=this.style.hasDataDrivenEmissiveStrength();this.emissiveMode=t?this.context.extBlendFuncExtended?"dual-source-blending":"mrt-fallback":"constant"}}function oh(a,t){let o=!1,c=null;const d=()=>{c=null,o&&(a(),c=setTimeout(d,t),o=!1)};return()=>(o=!0,c||d(),c)}const sh=/(#.+)?$/;class Do{constructor(t){this._hashName=t&&encodeURIComponent(t),h.b0(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=oh(this._updateHashUnthrottled.bind(this),300)}addTo(t){return this._map=t,window.addEventListener("hashchange",this._onHashChange,!1),t.on("moveend",this._updateHash),this}remove(){return this._map?(this._map.off("moveend",this._updateHash),window.removeEventListener("hashchange",this._onHashChange,!1),clearTimeout(this._updateHash()),this._map=void 0,this):this}getHashString(){const t=this._map;if(!t)return"";const o=Bc(t);if(this._hashName){const c=this._hashName;let d=!1;const m=location.hash.slice(1).split("&").map(_=>{const y=_.split("=")[0];return y===c?(d=!0,`${y}=${o}`):_}).filter(_=>_);return d||m.push(`${c}=${o}`),`#${m.join("&")}`}return`#${o}`}_getCurrentHash(){const t=location.hash.replace("#","");if(this._hashName){let o;return t.split("&").map(c=>c.split("=")).forEach(c=>{c[0]===this._hashName&&(o=c)}),(o&&o[1]||"").split("/")}return t.split("/")}_onHashChange(){const t=this._map;if(!t)return!1;const o=this._getCurrentHash();if(o.length>=3&&!o.some(c=>isNaN(Number(c)))){const c=t.dragRotate.isEnabled()&&t.touchZoomRotate.isEnabled()?+(o[3]||0):t.getBearing();return t.jumpTo({center:[+o[2],+o[1]],zoom:+o[0],bearing:c,pitch:+(o[4]||0)}),!0}return!1}_updateHashUnthrottled(){history.replaceState(history.state,"",location.href.replace(sh,this.getHashString()))}}function Bc(a,t){const o=a.getCenter(),c=Math.round(100*a.getZoom())/100,d=Math.ceil((c*Math.LN2+Math.log(512/360/.5))/Math.LN10),m=Math.pow(10,d),_=Math.round(o.lng*m)/m,y=Math.round(o.lat*m)/m,v=a.getBearing(),T=a.getPitch();let I=t?`/${_}/${y}/${c}`:`${c}/${y}/${_}`;return(v||T)&&(I+="/"+Math.round(10*v)/10),T&&(I+=`/${Math.round(T)}`),I}const Hi={linearity:.3,easing:h.eQ(0,0,.3,1)},Vn=Object.assign({deceleration:2500,maxSpeed:1400},Hi),kc=Object.assign({deceleration:20,maxSpeed:1400},Hi),ag=Object.assign({deceleration:1e3,maxSpeed:360},Hi),Xd=Object.assign({deceleration:1e3,maxSpeed:90},Hi);class ym{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:h.o.now(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,o=h.o.now();for(;t.length>0&&o-t[0].time>160;)t.shift()}_onMoveEnd(t){if(this._map._prefersReducedMotion()||(this._drainInertiaBuffer(),this._inertiaBuffer.length<2))return;const o={zoom:0,bearing:0,pitch:0,pan:new h.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:m}of this._inertiaBuffer)o.zoom+=m.zoomDelta||0,o.bearing+=m.bearingDelta||0,o.pitch+=m.pitchDelta||0,m.panDelta&&o.pan._add(m.panDelta),m.around&&(o.around=m.around),m.pinchAround&&(o.pinchAround=m.pinchAround);const c=this._inertiaBuffer.at(-1).time-this._inertiaBuffer[0].time,d={};if(o.pan.mag()){const m=Ml(o.pan.mag(),c,Object.assign({},Vn,t||{}));d.offset=o.pan.mult(m.amount/o.pan.mag()),d.center=this._map.transform.center,Fs(d,m)}if(o.zoom){const m=Ml(o.zoom,c,kc);d.zoom=this._map.transform.zoom+m.amount,Fs(d,m)}if(o.bearing){const m=Ml(o.bearing,c,ag);d.bearing=this._map.transform.bearing+h.aB(m.amount,-179,179),Fs(d,m)}if(o.pitch){const m=Ml(o.pitch,c,Xd);d.pitch=this._map.transform.pitch+m.amount,Fs(d,m)}if(d.zoom||d.bearing){const m=o.pinchAround===void 0?o.around:o.pinchAround;d.around=m?this._map.unproject(m):this._map.getCenter()}return this.clear(),d.noMoveStart=!0,d}}function Fs(a,t){(!a.duration||a.duration<t.duration)&&(a.duration=t.duration,a.easing=t.easing)}function Ml(a,t,o){const{maxSpeed:c,linearity:d,deceleration:m}=o,_=h.aB(a*d/(t/1e3),-c,c),y=Math.abs(_)/(m*d);return{easing:o.easing,duration:1e3*y,amount:_*(y/2)}}class rn extends h.z{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,o,c,d={}){const m=$o(o.getCanvasContainer(),c),_=o.unproject(m);super(t,Object.assign({point:m,lngLat:_,originalEvent:c},d)),this._defaultPrevented=!1,this.target=o}}class Ma extends h.z{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,o,c){const d=t==="touchend"?c.changedTouches:c.touches,m=Ys(o.getCanvasContainer(),d),_=m.map(v=>o.unproject(v)),y=m.reduce((v,T,I,P)=>v.add(T.div(P.length)),new h.P(0,0));super(t,{points:m,point:y,lngLats:_,lngLat:o.unproject(y),originalEvent:c}),this._defaultPrevented=!1}}class ah extends h.z{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,o){super("wheel",{originalEvent:o}),this._defaultPrevented=!1}}class Nc{constructor(t,o){this._map=t,this._clickTolerance=o.clickTolerance}reset(){this._mousedownPos=void 0}wheel(t){return this._firePreventable(new ah(this._map,t))}mousedown(t,o){return this._mousedownPos=o,this._firePreventable(new rn(t.type,this._map,t))}mouseup(t){this._map.fire(new rn(t.type,this._map,t))}preclick(t){const o=new MouseEvent("preclick",t);this._map.fire(new rn(o.type,this._map,o))}click(t,o){this._mousedownPos&&this._mousedownPos.dist(o)>=this._clickTolerance||(this.preclick(t),this._map.fire(new rn(t.type,this._map,t)))}dblclick(t){return this._firePreventable(new rn(t.type,this._map,t))}mouseover(t){this._map.fire(new rn(t.type,this._map,t))}mouseout(t){this._map.fire(new rn(t.type,this._map,t))}touchstart(t){return this._firePreventable(new Ma(t.type,this._map,t))}touchmove(t){this._map.fire(new Ma(t.type,this._map,t))}touchend(t){this._map.fire(new Ma(t.type,this._map,t))}touchcancel(t){this._map.fire(new Ma(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class ss{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._contextMenuEvent=void 0}mousemove(t){this._map.fire(new rn(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new rn("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._map.fire(new rn(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Ro{constructor(t,o){this._map=t,this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=o.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(t,o){this.isEnabled()&&t.shiftKey&&t.button===0&&(jo(),this._startPos=this._lastPos=o,this._active=!0)}mousemoveWindow(t,o){if(!this._active)return;const c=o,d=this._startPos,m=this._lastPos;if(!d||!m||m.equals(c)||!this._box&&c.dist(d)<this._clickTolerance)return;this._lastPos=c,this._box||(this._box=Ot("div","mapboxgl-boxzoom",this._container),this._container.classList.add("mapboxgl-crosshair"),this._fireEvent("boxzoomstart",t));const _=Math.min(d.x,c.x),y=Math.max(d.x,c.x),v=Math.min(d.y,c.y),T=Math.max(d.y,c.y);this._map._requestDomTask(()=>{this._box&&(this._box.style.transform=`translate(${_}px,${v}px)`,this._box.style.width=y-_+"px",this._box.style.height=T-v+"px")})}mouseupWindow(t,o){if(!this._active)return;const c=this._startPos,d=o;if(c&&t.button===0){if(this.reset(),_s(),c.x!==d.x||c.y!==d.y)return this._map.fire(new h.z("boxzoomend",{originalEvent:t})),{cameraAnimation:m=>m.fitScreenCoordinates(c,d,this._map.getBearing(),{linear:!1})};this._fireEvent("boxzoomcancel",t)}}keydown(t){this._active&&t.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",t))}blur(){this.reset()}reset(){this._active=!1,this._container.classList.remove("mapboxgl-crosshair"),this._box&&(this._box.remove(),this._box=null),Go(),delete this._startPos,delete this._lastPos}_fireEvent(t,o){return this._map.fire(new h.z(t,{originalEvent:o}))}}function jn(a,t){const o={};for(let c=0;c<a.length;c++)o[a[c].identifier]=t[c];return o}class Ca{constructor(t){this.reset(),this.numTouches=t.numTouches}reset(){this.centroid=void 0,this.startTime=0,this.touches={},this.aborted=!1}touchstart(t,o,c){(this.centroid||c.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===0&&(this.startTime=t.timeStamp),c.length===this.numTouches&&(this.centroid=(function(d){const m=new h.P(0,0);for(const _ of d)m._add(_);return m.div(d.length)})(o),this.touches=jn(c,o)))}touchmove(t,o,c){if(this.aborted||!this.centroid)return;const d=jn(c,o);for(const m in this.touches){const _=d[m];(!_||_.dist(this.touches[m])>30)&&(this.aborted=!0)}}touchend(t,o,c){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),c.length===0){const d=!this.aborted&&this.centroid;if(this.reset(),d)return d}}}class An{constructor(t){this.singleTap=new Ca(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,this.lastTap=void 0,this.count=0,this.singleTap.reset()}touchstart(t,o,c){this.singleTap.touchstart(t,o,c)}touchmove(t,o,c){this.singleTap.touchmove(t,o,c)}touchend(t,o,c){const d=this.singleTap.touchend(t,o,c);if(d){const m=t.timeStamp-this.lastTime<500,_=!this.lastTap||this.lastTap.dist(d)<30;if(m&&_||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=d,this.count===this.numTaps)return this.reset(),d}}}class lg{constructor(){this._zoomIn=new An({numTouches:1,numTaps:2}),this._zoomOut=new An({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(t,o,c){this._zoomIn.touchstart(t,o,c),this._zoomOut.touchstart(t,o,c)}touchmove(t,o,c){this._zoomIn.touchmove(t,o,c),this._zoomOut.touchmove(t,o,c)}touchend(t,o,c){const d=this._zoomIn.touchend(t,o,c),m=this._zoomOut.touchend(t,o,c);return d?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:_=>_.easeTo({duration:300,zoom:_.getZoom()+1,around:_.unproject(d)},{originalEvent:t})}):m?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:_=>_.easeTo({duration:300,zoom:_.getZoom()-1,around:_.unproject(m)},{originalEvent:t})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}const cg=0,ug=2,hg={[cg]:1,[ug]:2},Yd={Control:"ctrlKey",Alt:"altKey",Shift:"shiftKey",Meta:"metaKey"};class Lr{constructor(t){this.reset(),this._clickTolerance=t.clickTolerance||1}blur(){this.reset()}reset(){this._active=!1,this._moved=!1,this._lastPoint=void 0,this._eventButton=void 0}_correctButton(t,o){return!1}_move(t,o){return{}}mousedown(t,o){if(this._lastPoint)return;const c=ql(t);this._correctButton(t,c)&&(this._lastPoint=o,this._eventButton=c)}mousemoveWindow(t,o){const c=this._lastPoint;if(c){if(t.preventDefault(),this._eventButton!=null&&(function(d,m){const _=hg[m];return d.buttons===void 0||(d.buttons&_)!==_})(t,this._eventButton))this.reset();else if(this._moved||!(o.dist(c)<this._clickTolerance))return this._moved=!0,this._lastPoint=o,this._move(c,o)}}mouseupWindow(t){this._lastPoint&&ql(t)===this._eventButton&&(this._moved&&_s(),this.reset())}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Cl extends Lr{mousedown(t,o){super.mousedown(t,o),this._lastPoint&&(this._active=!0)}_correctButton(t,o){return o===0&&!t.ctrlKey}_move(t,o){return{around:o,panDelta:o.sub(t)}}}class lh extends Lr{constructor(t){super(t),this._pitchRotateKey=t.pitchRotateKey?Yd[t.pitchRotateKey]:void 0}_correctButton(t,o){return this._pitchRotateKey?o===0&&t[this._pitchRotateKey]:o===0&&t.ctrlKey||o===2}_move(t,o){const c=.8*(o.x-t.x);if(c)return this._active=!0,{bearingDelta:c}}contextmenu(t){this._pitchRotateKey||t.preventDefault()}}class Mn extends Lr{constructor(t){super(t),this._pitchRotateKey=t.pitchRotateKey?Yd[t.pitchRotateKey]:void 0}_correctButton(t,o){return this._pitchRotateKey?o===0&&t[this._pitchRotateKey]:o===0&&t.ctrlKey||o===2}_move(t,o){const c=-.5*(o.y-t.y);if(c)return this._active=!0,{pitchDelta:c}}contextmenu(t){this._pitchRotateKey||t.preventDefault()}}class Gn{constructor(t,o){this._map=t,this._el=t.getCanvasContainer(),this._minTouches=1,this._clickTolerance=o.clickTolerance||1,this.reset(),h.b0(["_addTouchPanBlocker","_showTouchPanBlockerAlert"],this)}reset(){this._active=!1,this._touches={},this._sum=new h.P(0,0)}touchstart(t,o,c){return this._calculateTransform(t,o,c)}touchmove(t,o,c){if(this._active&&!(c.length<this._minTouches)){if(this._map._cooperativeGestures&&!this._map.isMoving()){if(c.length===1&&!h.eR())return void this._showTouchPanBlockerAlert();this._alertContainer.style.visibility!=="hidden"&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}return t.cancelable&&t.preventDefault(),this._calculateTransform(t,o,c)}}touchend(t,o,c){this._calculateTransform(t,o,c),this._active&&c.length<this._minTouches&&this.reset()}touchcancel(){this.reset()}_calculateTransform(t,o,c){c.length>0&&(this._active=!0);const d=jn(c,o),m=new h.P(0,0),_=new h.P(0,0);let y=0;for(const T in d){const I=d[T],P=this._touches[T];P&&(m._add(I),_._add(I.sub(P)),y++,d[T]=I)}if(this._touches=d,y<this._minTouches||!_.mag())return;const v=_.div(y);return this._sum._add(v),this._sum.mag()<this._clickTolerance?void 0:{around:m.div(y),panDelta:v}}enable(){this._enabled=!0,this._map._cooperativeGestures&&(this._addTouchPanBlocker(),this._el.classList.add("mapboxgl-touch-pan-blocker-override","mapboxgl-scrollable-page"))}disable(){this._enabled=!1,this._map._cooperativeGestures&&(clearTimeout(this._alertTimer),this._alertContainer.remove(),this._el.classList.remove("mapboxgl-touch-pan-blocker-override","mapboxgl-scrollable-page")),this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}_addTouchPanBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=Ot("div","mapboxgl-touch-pan-blocker",this._map._container),this._alertContainer.textContent=this._map._getUIString("TouchPanBlocker.Message"),this._alertContainer.style.fontSize=`${Math.max(10,Math.min(24,Math.floor(.05*this._el.clientWidth)))}px`)}_showTouchPanBlockerAlert(){this._alertContainer.style.visibility="visible",this._alertContainer.classList.add("mapboxgl-touch-pan-blocker-show"),this._alertContainer.setAttribute("role","alert"),clearTimeout(this._alertTimer),this._alertTimer=window.setTimeout(()=>{this._alertContainer.classList.remove("mapboxgl-touch-pan-blocker-show"),this._alertContainer.removeAttribute("role")},500)}}class Bs{constructor(){this.reset()}reset(){this._active=!1,this._firstTwoTouches=void 0}_start(t){}_move(t,o,c){return{}}touchstart(t,o,c){this._firstTwoTouches||c.length<2||(this._firstTwoTouches=[c[0].identifier,c[1].identifier],this._start([o[0],o[1]]))}touchmove(t,o,c){const d=this._firstTwoTouches;if(!d)return;t.preventDefault();const[m,_]=d,y=zo(c,o,m),v=zo(c,o,_);if(!y||!v)return;const T=this._aroundCenter?null:y.add(v).div(2);return this._move([y,v],T,t)}touchend(t,o,c){if(!this._firstTwoTouches)return;const[d,m]=this._firstTwoTouches,_=zo(c,o,d),y=zo(c,o,m);_&&y||(this._active&&_s(),this.reset())}touchcancel(){this.reset()}enable(t){this._enabled=!0,this._aroundCenter=!!t&&t.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}function zo(a,t,o){for(let c=0;c<a.length;c++)if(a[c].identifier===o)return t[c]}function Pa(a,t){return Math.log2(a/t)}class Jd extends Bs{reset(){super.reset(),this._distance=0,this._startDistance=0}_start(t){this._startDistance=this._distance=t[0].dist(t[1])}_move(t,o){const c=this._distance;if(this._distance=t[0].dist(t[1]),this._active||!(Math.abs(Pa(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:Pa(this._distance,c),pinchAround:o}}}function Zt(a,t){return 180*a.angleWith(t)/Math.PI}class ks extends Bs{reset(){super.reset(),this._minDiameter=0,this._startVector=void 0,this._vector=void 0}_start(t){this._startVector=this._vector=t[0].sub(t[1]),this._minDiameter=t[0].dist(t[1])}_move(t,o){const c=this._vector;if(this._vector=t[0].sub(t[1]),c&&(this._active||!this._isBelowThreshold(this._vector)))return this._active=!0,{bearingDelta:Zt(this._vector,c),pinchAround:o}}_isBelowThreshold(t){this._minDiameter=Math.min(this._minDiameter,t.mag());const o=25/(Math.PI*this._minDiameter)*360,c=this._startVector;if(!c)return!1;const d=Zt(t,c);return Math.abs(d)<o}}function Uc(a){return Math.abs(a.y)>Math.abs(a.x)}class as extends Bs{constructor(t){super(),this._map=t}reset(){super.reset(),this._valid=void 0,this._firstMove=void 0,this._lastPoints=void 0}_start(t){this._lastPoints=t,Uc(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,o,c){const d=this._lastPoints;if(!d)return;const m=t[0].sub(d[0]),_=t[1].sub(d[1]);return this._map._cooperativeGestures&&!h.eR()&&c.touches.length<3||(this._valid=this.gestureBeginsVertically(m,_,c.timeStamp),!this._valid)?void 0:(this._lastPoints=t,this._active=!0,{pitchDelta:(m.y+_.y)/2*-.5})}gestureBeginsVertically(t,o,c){if(this._valid!==void 0)return this._valid;const d=t.mag()>=2,m=o.mag()>=2;if(!d&&!m)return;if(!d||!m)return this._firstMove==null&&(this._firstMove=c),c-this._firstMove<100&&void 0;const _=t.y>0==o.y>0;return Uc(t)&&Uc(o)&&_}}const Lo={panStep:100,bearingStep:15,pitchStep:10};class Yr{constructor(){const t=Lo;this._panStep=t.panStep,this._bearingStep=t.bearingStep,this._pitchStep=t.pitchStep,this._rotationDisabled=!1}blur(){this.reset()}reset(){this._active=!1}keydown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let o=0,c=0,d=0,m=0,_=0;switch(t.keyCode){case 61:case 107:case 171:case 187:o=1;break;case 189:case 109:case 173:o=-1;break;case 37:t.shiftKey?c=-1:(t.preventDefault(),m=-1);break;case 39:t.shiftKey?c=1:(t.preventDefault(),m=1);break;case 38:t.shiftKey?d=1:(t.preventDefault(),_=-1);break;case 40:t.shiftKey?d=-1:(t.preventDefault(),_=1);break;default:return}return this._rotationDisabled&&(c=0,d=0),{cameraAnimation:y=>{const v=y.getZoom();y.easeTo({duration:300,easeId:"keyboardHandler",easing:mn,zoom:o?Math.round(v)+o*(t.shiftKey?2:1):v,bearing:y.getBearing()+c*this._bearingStep,pitch:y.getPitch()+d*this._pitchStep,offset:[-m*this._panStep,-_*this._panStep],center:y.getCenter()},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function mn(a){return a*(2-a)}const pr=4.000244140625,Kd=1/450,_n=/(Mac|iPad)/i;class xm{constructor(t,o){this._map=t,this._el=t.getCanvasContainer(),this._handler=o,this._delta=0,this._lastDelta=0,this._defaultZoomRate=.01,this._wheelZoomRate=Kd,h.b0(["_onTimeout","_addScrollZoomBlocker","_showBlockerAlert"],this)}setZoomRate(t){this._defaultZoomRate=t}setWheelZoomRate(t){this._wheelZoomRate=t}isEnabled(){return!!this._enabled}isActive(){return this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!t&&t.around==="center",this._map._cooperativeGestures&&this._addScrollZoomBlocker())}disable(){this.isEnabled()&&(this._enabled=!1,this._map._cooperativeGestures&&(clearTimeout(this._alertTimer),this._alertContainer.remove()))}wheel(t){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!(t.ctrlKey||t.metaKey||this.isZooming()||h.eR()))return void this._showBlockerAlert();this._alertContainer.style.visibility!=="hidden"&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}let o=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY;const c=h.o.now(),d=c-(this._lastWheelEventTime||0);this._lastWheelEventTime=c,o!==0&&o%pr===0?this._type="wheel":o!==0&&Math.abs(o)<4?this._type="trackpad":d>400?(this._type=null,this._lastValue=o,this._timeout=window.setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(d*o)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,o+=this._lastValue)),t.shiftKey&&o&&(o/=4),this._type&&(this._lastWheelEvent=t,this._delta-=o,this._active||this._start(t)),t.preventDefault()}_onTimeout(t){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(t)}_start(t){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const o=$o(this._el,t);this._aroundPoint=this._aroundCenter?this._map.transform.centerPoint:o,this._aroundCoord=this._map.transform.pointCoordinate3D(this._aroundPoint),this._targetZoom=void 0,this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const t=this._map.transform;this._type==="wheel"&&t.projection.wrap&&(t._center.lng>=180||t._center.lng<=-180)&&(this._prevEase=null,this._easing=null,this._lastWheelEvent=null,this._lastWheelEventTime=0);const o=()=>t._terrainEnabled()&&this._aroundCoord?t.computeZoomRelativeTo(this._aroundCoord):t.zoom;if(this._delta!==0){const T=this._type==="wheel"&&Math.abs(this._delta)>pr?this._wheelZoomRate:this._defaultZoomRate;let I=2/(1+Math.exp(-Math.abs(this._delta*T)));this._delta<0&&I!==0&&(I=1/I);const P=o(),A=Math.pow(2,P),D=typeof this._targetZoom=="number"?t.zoomScale(this._targetZoom):A;this._targetZoom=Math.min(t.maxZoom,Math.max(t.minZoom,t.scaleZoom(D*I))),this._type==="wheel"&&(this._startZoom=P,this._easing=this._smoothOutEasing(200)),this._lastDelta=this._delta,this._delta=0}const c=typeof this._targetZoom=="number"?this._targetZoom:o(),d=this._startZoom,m=this._easing;let _,y=!1;if(this._type==="wheel"&&d&&m){const T=Math.min((h.o.now()-this._lastWheelEventTime)/200,1),I=m(T);_=h.aj(d,c,I),T<1?this._frameId||(this._frameId=!0):y=!0}else _=c,y=!0;this._active=!0,y&&(this._active=!1,this._finishTimeout=window.setTimeout(()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200));let v=_-o();return v*this._lastDelta<0&&(v=0),{noInertia:!0,needsRenderFrame:!y,zoomDelta:v,around:this._aroundPoint,aroundCoord:this._aroundCoord,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let o=h.eS;if(this._prevEase){const c=this._prevEase,d=(h.o.now()-c.start)/c.duration,m=c.easing(d+.01)-c.easing(d),_=.27/Math.sqrt(m*m+1e-4)*.01,y=Math.sqrt(.0729-_*_);o=h.eQ(_,y,.25,1)}return this._prevEase={start:h.o.now(),duration:t,easing:o},o}blur(){this.reset()}reset(){this._active=!1}_addScrollZoomBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=Ot("div","mapboxgl-scroll-zoom-blocker",this._map._container),this._alertContainer.textContent=_n.test(navigator.userAgent)?this._map._getUIString("ScrollZoomBlocker.CmdMessage"):this._map._getUIString("ScrollZoomBlocker.CtrlMessage"),this._alertContainer.style.fontSize=`${Math.max(10,Math.min(24,Math.floor(.05*this._el.clientWidth)))}px`)}_showBlockerAlert(){this._alertContainer.style.visibility="visible",this._alertContainer.classList.add("mapboxgl-scroll-zoom-blocker-show"),this._alertContainer.setAttribute("role","alert"),clearTimeout(this._alertTimer),this._alertTimer=window.setTimeout(()=>{this._alertContainer.classList.remove("mapboxgl-scroll-zoom-blocker-show"),this._alertContainer.removeAttribute("role")},200)}}class Da{constructor(t,o){this._clickZoom=t,this._tapZoom=o}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class vm{constructor(){this.reset()}reset(){this._active=!1}blur(){this.reset()}dblclick(t,o){return t.preventDefault(),{cameraAnimation:c=>{c.easeTo({duration:300,zoom:c.getZoom()+(t.shiftKey?-1:1),around:c.unproject(o)},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Cn{constructor(){this._tap=new An({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,this._swipePoint=void 0,this._swipeTouch=0,this._tapTime=0,this._tap.reset()}touchstart(t,o,c){this._swipePoint||(this._tapTime&&t.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?c.length>0&&(this._swipePoint=o[0],this._swipeTouch=c[0].identifier):this._tap.touchstart(t,o,c))}touchmove(t,o,c){if(this._tapTime){if(this._swipePoint){if(c[0].identifier!==this._swipeTouch)return;const d=o[0],m=d.y-this._swipePoint.y;return this._swipePoint=d,t.preventDefault(),this._active=!0,{zoomDelta:m/128}}}else this._tap.touchmove(t,o,c)}touchend(t,o,c){this._tapTime?this._swipePoint&&c.length===0&&this.reset():this._tap.touchend(t,o,c)&&(this._tapTime=t.timeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Or{constructor(t,o,c){this._el=t,this._mousePan=o,this._touchPan=c}enable(t){this._inertiaOptions=t||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("mapboxgl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("mapboxgl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class Qd{constructor(t,o,c){this._pitchWithRotate=t.pitchWithRotate,this._mouseRotate=o,this._mousePitch=c}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class bm{constructor(t,o,c,d){this._el=t,this._touchZoom=o,this._touchRotate=c,this._tapDragZoom=d,this._rotationDisabled=!1,this._enabled=!0}enable(t){this._touchZoom.enable(t),this._rotationDisabled||this._touchRotate.enable(t),this._tapDragZoom.enable(),this._el.classList.add("mapboxgl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("mapboxgl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}const Pl=a=>a.zoom||a.drag||a.pitch||a.rotate;class dg extends h.z{}class ef{constructor(){this.constants=[1,1,.01],this.radius=0}setup(t,o){const c=h.aw([],o,t);this.radius=h.af(c[2]<0?h.eU([],c,this.constants):[c[0],c[1],0])}projectRay(t){h.eU(t,t,this.constants),h.ax(t,t),h.eV(t,t,this.constants);const o=h.bN([],t,this.radius);if(o[2]>0){const c=h.bN([],[0,0,1],h.bk(o,[0,0,1])),d=h.bN([],h.ax([],[o[0],o[1],0]),this.radius),m=h.cX([],o,h.bN([],h.aw([],h.cX([],d,c),o),2));o[0]=m[0],o[1]=m[1]}return o}}function Vc(a){return a.panDelta&&a.panDelta.mag()||a.zoomDelta||a.bearingDelta||a.pitchDelta}class fg{constructor(t,o){this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new ym(t),this._bearingSnap=o.bearingSnap,this._previousActiveHandlers={},this._trackingEllipsoid=new ef,this._dragOrigin=null,this._eventsInProgress={},this._addDefaultHandlers(o),h.b0(["handleEvent","handleWindowEvent"],this);const c=this._el;this._listeners=[[c,"touchstart",{passive:!0}],[c,"touchmove",{passive:!1}],[c,"touchend",void 0],[c,"touchcancel",void 0],[c,"mousedown",void 0],[c,"mousemove",void 0],[c,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[c,"mouseover",void 0],[c,"mouseout",void 0],[c,"dblclick",void 0],[c,"click",void 0],[c,"keydown",{capture:!1}],[c,"keyup",void 0],[c,"wheel",{passive:!1}],[c,"contextmenu",void 0],[window,"blur",void 0]];for(const[d,m,_]of this._listeners){const y=d===document?this.handleWindowEvent:this.handleEvent;d.addEventListener(m,y,_)}}destroy(){for(const[t,o,c]of this._listeners){const d=t===document?this.handleWindowEvent:this.handleEvent;t.removeEventListener(o,d,c)}}_addDefaultHandlers(t){const o=this._map,c=o.getCanvasContainer();this._add("mapEvent",new Nc(o,t));const d=o.boxZoom=new Ro(o,t);this._add("boxZoom",d);const m=new lg,_=new vm;o.doubleClickZoom=new Da(_,m),this._add("tapZoom",m),this._add("clickZoom",_);const y=new Cn;this._add("tapDragZoom",y);const v=o.touchPitch=new as(o);this._add("touchPitch",v);const T=new lh(t),I=new Mn(t);o.dragRotate=new Qd(t,T,I),this._add("mouseRotate",T,["mousePitch"]),this._add("mousePitch",I,["mouseRotate"]);const P=new Cl(t),A=new Gn(o,t);o.dragPan=new Or(c,P,A),this._add("mousePan",P),this._add("touchPan",A,["touchZoom","touchRotate"]);const D=new ks,O=new Jd;o.touchZoomRotate=new bm(c,O,D,y),this._add("touchRotate",D,["touchPan","touchZoom"]),this._add("touchZoom",O,["touchPan","touchRotate"]),this._add("blockableMapEvent",new ss(o));const L=o.scrollZoom=new xm(o,this);this._add("scrollZoom",L,["mousePan"]);const k=o.keyboard=new Yr;this._add("keyboard",k);for(const N of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])t.interactive&&t[N]&&o[N].enable(t[N])}_add(t,o,c){this._handlers.push({handlerName:t,handler:o,allowed:c}),this._handlersById[t]=o}stop(t){if(!this._updatingCamera){for(const{handler:o}of this._handlers)o.reset();this._inertia.clear(),this._fireEvents({},{},t),this._changes=[],this._originalZoom=void 0}}isActive(){for(const{handler:t}of this._handlers)if(t.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!Pl(this._eventsInProgress)||this.isZooming()}_isDragging(){return!!this._eventsInProgress.drag}_blockedByActive(t,o,c){for(const d in t)if(!(d===c||o&&o.includes(d)))return!0;return!1}handleWindowEvent(t){this.handleEvent(t,`${t.type}Window`)}_getMapTouches(t){const o=[];for(const c of t)this._el.contains(c.target)&&o.push(c);return o}handleEvent(t,o){this._updatingCamera=!0;const c=t.type==="renderFrame",d=c?void 0:t,m={needsRenderFrame:!1},_={},y={},v=t.touches?this._getMapTouches(t.touches):void 0,T=v?Ys(this._el,v):c?void 0:$o(this._el,t);for(const{handlerName:A,handler:D,allowed:O}of this._handlers){if(!D.isEnabled())continue;let L;this._blockedByActive(y,O,A)?D.reset():D[o||t.type]&&(L=D[o||t.type](t,T,v),this.mergeHandlerResult(m,_,L,A,d),L&&L.needsRenderFrame&&this._triggerRenderFrame()),(L||D.isActive())&&(y[A]=D)}const I={};for(const A in this._previousActiveHandlers)y[A]||(I[A]=d);this._previousActiveHandlers=y,(Object.keys(I).length||Vc(m))&&(this._changes.push([m,_,I]),this._triggerRenderFrame()),(Object.keys(y).length||Vc(m))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:P}=m;P&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],P(this._map))}mergeHandlerResult(t,o,c,d,m){if(!c)return;Object.assign(t,c);const _={handlerName:d,originalEvent:c.originalEvent||m};c.zoomDelta!==void 0&&(o.zoom=_),c.panDelta!==void 0&&(o.drag=_),c.pitchDelta!==void 0&&(o.pitch=_),c.bearingDelta!==void 0&&(o.rotate=_)}_applyChanges(){const t={},o={},c={};for(const[d,m,_]of this._changes)d.panDelta&&(t.panDelta=(t.panDelta||new h.P(0,0))._add(d.panDelta)),d.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+d.zoomDelta),d.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+d.bearingDelta),d.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+d.pitchDelta),d.around!==void 0&&(t.around=d.around),d.aroundCoord!==void 0&&(t.aroundCoord=d.aroundCoord),d.pinchAround!==void 0&&(t.pinchAround=d.pinchAround),d.noInertia&&(t.noInertia=d.noInertia),Object.assign(o,m),Object.assign(c,_);this._updateMapTransform(t,o,c),this._changes=[]}_updateMapTransform(t,o,c){const d=this._map,m=d.transform,_=H=>[H.x,H.y,H.z];if((()=>{const H=this._eventsInProgress.drag;return H&&!this._handlersById[H.handlerName].isActive()})()&&!Vc(t)){const H=m.zoom;m.cameraElevationReference="sea",this._originalZoom!=null&&m._orthographicProjectionAtLowPitch&&m.projection.name!=="globe"&&m.pitch===0?(m.cameraElevationReference="ground",m.zoom=this._originalZoom):(m.recenterOnTerrain(),m.cameraElevationReference="ground"),H!==m.zoom&&this._map._update(!0)}if(m._isCameraConstrained&&d._stop(!0),!Vc(t))return void this._fireEvents(o,c,!0);let{panDelta:y,zoomDelta:v,bearingDelta:T,pitchDelta:I,around:P,aroundCoord:A,pinchAround:D}=t;m._isCameraConstrained&&(v>0&&(v=0),m._isCameraConstrained=!1),D!==void 0&&(P=D),(v||(H=>o[H]&&!this._eventsInProgress[H])("drag"))&&P&&(this._dragOrigin=_(m.pointCoordinate3D(P)),this._originalZoom=m.zoom,this._trackingEllipsoid.setup(m._camera.position,this._dragOrigin)),m.cameraElevationReference="sea",d._stop(!0),P=P||d.transform.centerPoint,T&&(m.bearing+=T),I&&(m.pitch+=I),m._updateCameraState();const O=[0,0,0];if(y)if(m.projection.name==="mercator"){const H=this._trackingEllipsoid.projectRay(m.screenPointToMercatorRay(P).dir),Z=this._trackingEllipsoid.projectRay(m.screenPointToMercatorRay(P.sub(y)).dir);O[0]=Z[0]-H[0],O[1]=Z[1]-H[1]}else{const H=m.pointCoordinate(P);if(m.projection.name==="globe"){y=y.rotate(-m.angle);const Z=m._pixelsPerMercatorPixel/m.worldSize;O[0]=-y.x*h.eT(h.bZ(H.y))*Z,O[1]=-y.y*h.eT(m.center.lat)*Z}else{const Z=m.pointCoordinate(P.sub(y));H&&Z&&(O[0]=Z.x-H.x,O[1]=Z.y-H.y)}}const L=m.zoom,k=[0,0,0];if(v){const H=_(A||m.pointCoordinate3D(P)),Z={dir:h.ax([],h.aw([],H,m._camera.position))};if(Z.dir[2]<0){const G=m.zoomDeltaToMovement(H,v);h.bN(k,Z.dir,G)}}const N=h.cX(O,O,k);m._translateCameraConstrained(N),v&&Math.abs(m.zoom-L)>1e-4&&m.recenterOnTerrain(),m.cameraElevationReference="ground",this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(o,c,!0)}_fireEvents(t,o,c){const d=Pl(this._eventsInProgress),m=Pl(t),_={};for(const I in t){const{originalEvent:P}=t[I];this._eventsInProgress[I]||(_[`${I}start`]=P),this._eventsInProgress[I]=t[I]}!d&&m&&this._fireEvent("movestart",m.originalEvent);for(const I in _)this._fireEvent(I,_[I]);m&&this._fireEvent("move",m.originalEvent);for(const I in t){const{originalEvent:P}=t[I];this._fireEvent(I,P)}const y={};let v;for(const I in this._eventsInProgress){const{handlerName:P,originalEvent:A}=this._eventsInProgress[I];this._handlersById[P].isActive()||(delete this._eventsInProgress[I],v=o[P]||A,y[`${I}end`]=v)}for(const I in y)this._fireEvent(I,y[I]);const T=Pl(this._eventsInProgress);if(c&&(d||m)&&!T){this._updatingCamera=!0;const I=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),P=A=>A!==0&&-this._bearingSnap<A&&A<this._bearingSnap;I?(P(I.bearing||this._map.getBearing())&&(I.bearing=0),this._map.easeTo(I,{originalEvent:v})):(this._map.fire(new h.z("moveend",{originalEvent:v})),P(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(t,o){this._map.fire(new h.z(t,o?{originalEvent:o}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(t=>{this._frameId=void 0,this.handleEvent(new dg("renderFrame",{timeStamp:t})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}const gn="map.setFreeCameraOptions(...) and map.getFreeCameraOptions() are not yet supported for non-mercator projections.";class $n extends h.E{constructor(t,o){super(),this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=o.bearingSnap,this._respectPrefersReducedMotion=o.respectPrefersReducedMotion!==!1,h.b0(["_renderFrameCallback"],this)}getCenter(){return new h.aX(this.transform.center.lng,this.transform.center.lat)}setCenter(t,o){return this.jumpTo({center:t},o)}panBy(t,o,c){return t=h.P.convert(t).mult(-1),this.panTo(this.transform.center,Object.assign({offset:t},o),c)}panTo(t,o,c){return this.easeTo(Object.assign({center:t},o),c)}getZoom(){return this.transform.zoom}setZoom(t,o){return this.jumpTo({zoom:t},o),this}zoomTo(t,o,c){return this.easeTo(Object.assign({zoom:t},o),c)}zoomIn(t,o){return this.zoomTo(this.getZoom()+1,t,o),this}zoomOut(t,o){return this.zoomTo(this.getZoom()-1,t,o),this}getBearing(){return this.transform.bearing}setBearing(t,o){return this.jumpTo({bearing:t},o),this}getPadding(){return this.transform.padding}setPadding(t,o){return this.jumpTo({padding:t},o),this}rotateTo(t,o,c){return this.easeTo(Object.assign({bearing:t},o),c)}resetNorth(t,o){return this.rotateTo(0,Object.assign({duration:1e3},t),o),this}resetNorthPitch(t,o){return this.easeTo(Object.assign({bearing:0,pitch:0,duration:1e3},t),o),this}snapToNorth(t,o){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(t,o):this}getPitch(){return this.transform.pitch}setPitch(t,o){return this.jumpTo({pitch:t},o),this}cameraForBounds(t,o){t=h.aI.convert(t);const c=o&&o.bearing||0,d=o&&o.pitch||0,m=t.getNorthWest(),_=t.getSouthEast();return this._cameraForBounds(this.transform,m,_,c,d,o)}_extendPadding(t){const o={top:0,right:0,bottom:0,left:0};return t==null?Object.assign({},o,this.transform.padding):typeof t=="number"?{top:t,bottom:t,right:t,left:t}:Object.assign({},o,t)}_extendCameraOptions(t){return(t=Object.assign({offset:[0,0],maxZoom:this.transform.maxZoom},t)).padding=this._extendPadding(t.padding),t}_minimumAABBFrustumDistance(t,o){const c=o.max[0]-o.min[0],d=o.max[1]-o.min[1];return c/d>t.aspect?c/(2*Math.tan(.5*t.fovX)*t.aspect):d/(2*Math.tan(.5*t.fovY)*t.aspect)}_cameraForBoundsOnGlobe(t,o,c,d,m,_){const y=t.clone(),v=this._extendCameraOptions(_);y.bearing=d,y.pitch=m;const T=h.aX.convert(o),I=h.aX.convert(c),P=.5*(T.lat+I.lat),A=.5*(T.lng+I.lng),D=h.eW(P,A),O=h.ax([],D),L=h.ax([],h.bj([],O,[0,1,0])),k=h.bj([],L,O),N=[L[0],L[1],L[2],0,k[0],k[1],k[2],0,O[0],O[1],O[2],0,0,0,0,1],H=[D,h.eW(T.lat,T.lng),h.eW(I.lat,T.lng),h.eW(I.lat,I.lng),h.eW(T.lat,I.lng),h.eW(P,T.lng),h.eW(P,I.lng),h.eW(T.lat,A),h.eW(I.lat,A)];let Z=h.cY.fromPoints(H.map(Ce=>[h.bk(L,Ce),h.bk(k,Ce),h.bk(O,Ce)]));const G=h.ae([],Z.center,N);h.eX(G)===0&&h.eY(G,0,0,1),h.ax(G,G),h.bN(G,G,h.aE),y.center=h.eZ(G);const ne=y.getWorldToCameraMatrix(),te=h.ba(new Float64Array(16),ne);Z=h.cY.applyTransform(Z,h.aC([],ne,N));const se=this._extendAABB(Z,y,v,d);if(!se)return void h.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");Z=se,h.ae(G,G,ne);const J=.5*(Z.max[2]-Z.min[2]),K=this._minimumAABBFrustumDistance(y,Z),oe=h.bN([],[0,0,1],J),de=h.cX(oe,G,oe),ue=K+(y.pitch===0?0:h.bh(G,de)),ve=y.globeCenterInViewSpace,be=h.aw([],G,[ve[0],ve[1],ve[2]]);h.ax(be,be),h.bN(be,be,ue);const ke=h.cX([],G,be);h.ae(ke,ke,te);const fe=h.eg/h.aE,Ee=h.af(ke),pe=h.bY(Math.max(Ee*fe-h.eg,Number.EPSILON),0),Pe=Math.min(y.zoomFromMercatorZAdjusted(pe),v.maxZoom);return Pe>.5*(h.cN+h.cx)?(y.setProjection({name:"mercator"}),y.zoom=Pe,this._cameraForBounds(y,o,c,d,m,_)):{center:y.center,zoom:Pe,bearing:d,pitch:m}}_extendAABB(t,o,c,d){const m=.5*((c.padding.left||0)+(c.padding.right||0)),_=.5*((c.padding.top||0)+(c.padding.bottom||0)),y=_,v=m,T=m,I=_,P=o.width-(v+T),A=o.height-(y+I),D=h.aw([],t.max,t.min),O=Math.min(P/D[0],A/D[1]),L=Math.min(o.scaleZoom(o.scale*O),c.maxZoom);if(isNaN(L))return null;const k=o.scale/o.zoomScale(L),N=new h.cY([t.min[0]-v*k,t.min[1]-I*k,t.min[2]],[t.max[0]+T*k,t.max[1]+y*k,t.max[2]]),H=(typeof c.offset.x=="number"&&typeof c.offset.y=="number"?new h.P(c.offset.x,c.offset.y):h.P.convert(c.offset)).rotate(-h.am(d));return N.center[0]-=H.x*k,N.center[1]+=H.y*k,N}queryTerrainElevation(t,o){const c=this.transform.elevation;return c?(o=Object.assign({},{exaggerated:!0},o),c.getAtPoint(h.ad.fromLngLat(t),null,o.exaggerated)):null}_cameraForBounds(t,o,c,d,m,_){if(t.projection.name==="globe")return this._cameraForBoundsOnGlobe(t,o,c,d,m,_);const y=t.clone(),v=this._extendCameraOptions(_);y.bearing=d,y.pitch=m;const T=h.aX.convert(o),I=h.aX.convert(c),P=new h.aX(T.lng,I.lat),A=new h.aX(I.lng,T.lat),D=y.project(T),O=y.project(I),L=this.queryTerrainElevation(T),k=this.queryTerrainElevation(I),N=this.queryTerrainElevation(P),H=this.queryTerrainElevation(A),Z=[[D.x,D.y,Math.min(L||0,k||0,N||0,H||0)],[O.x,O.y,Math.max(L||0,k||0,N||0,H||0)]];let G=h.cY.fromPoints(Z);const ne=y.getWorldToCameraMatrix(),te=h.ba(new Float64Array(16),ne);G=h.cY.applyTransform(G,ne);const se=this._extendAABB(G,y,v,d);if(!se)return void h.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");G=se;const J=.5*h.aw([],G.max,G.min)[2],K=this._minimumAABBFrustumDistance(y,G),oe=[0,0,1,0];h.aD(oe,oe,ne),h.e_(oe,oe);const de=h.bN([],oe,K+J),ue=h.cX([],G.center,de);h.ae(G.center,G.center,te),h.ae(ue,ue,te);const ve=y.unproject(new h.P(G.center[0],G.center[1])),be=h.e$(y.projection,ve),ke=Math.pow(2,be),fe=Math.min(y._zoomFromMercatorZ(ue[2]*y.pixelsPerMeter*ke/y.worldSize),v.maxZoom);return y.mercatorFromTransition&&fe<.5*(h.cN+h.cx)?(y.setProjection({name:"globe"}),y.zoom=fe,this._cameraForBounds(y,o,c,d,m,_)):{center:ve,zoom:fe,bearing:d,pitch:m}}fitBounds(t,o,c){const d=this.cameraForBounds(t,o);return this._fitInternal(d,o,c)}fitScreenCoordinates(t,o,c,d,m){const _=h.P.convert(t),y=h.P.convert(o),v=new h.P(Math.min(_.x,y.x),Math.min(_.y,y.y)),T=new h.P(Math.max(_.x,y.x),Math.max(_.y,y.y));if(this.transform.projection.name==="mercator"&&this.transform.anyCornerOffEdge(_,y))return this;const I=this.transform.pointLocation3D(v),P=this.transform.pointLocation3D(T),A=this.transform.pointLocation3D(new h.P(v.x,T.y)),D=this.transform.pointLocation3D(new h.P(T.x,v.y)),O=[Math.min(I.lng,P.lng,A.lng,D.lng),Math.min(I.lat,P.lat,A.lat,D.lat)],L=[Math.max(I.lng,P.lng,A.lng,D.lng),Math.max(I.lat,P.lat,A.lat,D.lat)],k=d&&d.pitch?d.pitch:this.getPitch(),N=this._cameraForBounds(this.transform,O,L,c,k,d);return this._fitInternal(N,d,m)}_fitInternal(t,o,c){return t?(o=Object.assign(t,o)).linear?this.easeTo(o,c):this.flyTo(o,c):this}jumpTo(t,o){this.stop();const c=t.preloadOnly?this.transform.clone():this.transform;let d=!1,m=!1,_=!1;"zoom"in t&&c.zoom!==+t.zoom&&(d=!0,c.zoom=+t.zoom),t.center!==void 0&&(c.center=h.aX.convert(t.center)),"bearing"in t&&c.bearing!==+t.bearing&&(m=!0,c.bearing=+t.bearing),"pitch"in t&&c.pitch!==+t.pitch&&(_=!0,c.pitch=+t.pitch);const y=typeof t.padding=="number"?this._extendPadding(t.padding):t.padding;if(t.padding!=null&&!c.isPaddingEqual(y))if(t.retainPadding===!1){const v=c.clone();v.padding=y,c.setLocationAtPoint(c.center,v.centerPoint)}else c.padding=y;return t.preloadOnly?(this._preloadTiles(c),this):(this.fire(new h.z("movestart",o)).fire(new h.z("move",o)),d&&this.fire(new h.z("zoomstart",o)).fire(new h.z("zoom",o)).fire(new h.z("zoomend",o)),m&&this.fire(new h.z("rotatestart",o)).fire(new h.z("rotate",o)).fire(new h.z("rotateend",o)),_&&this.fire(new h.z("pitchstart",o)).fire(new h.z("pitch",o)).fire(new h.z("pitchend",o)),this.fire(new h.z("moveend",o)))}getFreeCameraOptions(){return this.transform.projection.supportsFreeCamera||h.w(gn),this.transform.getFreeCameraOptions()}setFreeCameraOptions(t,o){const c=this.transform;if(!c.projection.supportsFreeCamera)return h.w(gn),this;this.stop();const d=c.zoom,m=c.pitch,_=c.bearing;c.setFreeCameraOptions(t);const y=d!==c.zoom,v=m!==c.pitch,T=_!==c.bearing;return this.fire(new h.z("movestart",o)).fire(new h.z("move",o)),y&&this.fire(new h.z("zoomstart",o)).fire(new h.z("zoom",o)).fire(new h.z("zoomend",o)),T&&this.fire(new h.z("rotatestart",o)).fire(new h.z("rotate",o)).fire(new h.z("rotateend",o)),v&&this.fire(new h.z("pitchstart",o)).fire(new h.z("pitch",o)).fire(new h.z("pitchend",o)),this.fire(new h.z("moveend",o)),this}easeTo(t,o){this._stop(!1,t.easeId),((t=Object.assign({offset:[0,0],duration:500,easing:h.eS},t)).animate===!1||this._prefersReducedMotion(t))&&(t.duration=0);const c=this.transform,d=this.getZoom(),m=this.getBearing(),_=this.getPitch(),y=this.getPadding(),v="zoom"in t?+t.zoom:d,T="bearing"in t?this._normalizeBearing(t.bearing,m):m,I="pitch"in t?+t.pitch:_,P=this._extendPadding(t.padding),A=h.P.convert(t.offset);let D,O,L;if(c.projection.name==="globe"){const oe=h.ad.fromLngLat(c.center),de=A.rotate(-c.angle);oe.x+=de.x/c.worldSize,oe.y+=de.y/c.worldSize;const ue=oe.toLngLat(),ve=h.aX.convert(t.center||ue);this._normalizeCenter(ve),D=c.centerPoint.add(de),O=new h.P(oe.x,oe.y).mult(c.worldSize),L=new h.P(h.aG(ve.lng),h.aJ(ve.lat)).mult(c.worldSize).sub(O)}else{D=c.centerPoint.add(A);const oe=c.pointLocation(D),de=h.aX.convert(t.center||oe);this._normalizeCenter(de),O=c.project(oe),L=c.project(de).sub(O)}const k=c.zoomScale(v-d);let N,H;t.around&&(N=h.aX.convert(t.around),H=c.locationPoint(N));const Z=this._zooming||v!==d,G=this._rotating||m!==T,ne=this._pitching||I!==_,te=!c.isPaddingEqual(P),se=t.retainPadding===!1?c.clone():c,J=oe=>de=>{if(Z&&(oe.zoom=h.aj(d,v,de)),G&&(oe.bearing=h.aj(m,T,de)),ne&&(oe.pitch=h.aj(_,I,de)),te&&(se.interpolatePadding(y,P,de),D=se.centerPoint.add(A)),N)oe.setLocationAtPoint(N,H);else{const ue=oe.zoomScale(oe.zoom-d),ve=v>d?Math.min(2,k):Math.max(.5,k),be=Math.pow(ve,1-de),ke=oe.unproject(O.add(L.mult(de*be)).mult(ue));oe.setLocationAtPoint(oe.renderWorldCopies?ke.wrap():ke,D)}return t.preloadOnly||this._fireMoveEvents(o),oe};if(t.preloadOnly){const oe=this._emulate(J,t.duration,c);return this._preloadTiles(oe),this}const K={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=Z,this._rotating=G,this._pitching=ne,this._padding=te,this._easeId=t.easeId,this._prepareEase(o,t.noMoveStart,K),this._ease(J(c),oe=>{c.cameraElevationReference==="sea"&&c.recenterOnTerrain(),this._afterEase(o,oe)},t),this}_prepareEase(t,o,c={}){this._moving=!0,this.transform.cameraElevationReference="sea",this.transform._orthographicProjectionAtLowPitch&&this.transform.pitch===0&&this.transform.projection.name!=="globe"&&(this.transform.cameraElevationReference="ground"),o||c.moving||this.fire(new h.z("movestart",t)),this._zooming&&!c.zooming&&this.fire(new h.z("zoomstart",t)),this._rotating&&!c.rotating&&this.fire(new h.z("rotatestart",t)),this._pitching&&!c.pitching&&this.fire(new h.z("pitchstart",t))}_fireMoveEvents(t){this.fire(new h.z("move",t)),this._zooming&&this.fire(new h.z("zoom",t)),this._rotating&&this.fire(new h.z("rotate",t)),this._pitching&&this.fire(new h.z("pitch",t))}_afterEase(t,o){if(this._easeId&&o&&this._easeId===o)return;this._easeId=void 0,this.transform.cameraElevationReference="ground";const c=this._zooming,d=this._rotating,m=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,c&&this.fire(new h.z("zoomend",t)),d&&this.fire(new h.z("rotateend",t)),m&&this.fire(new h.z("pitchend",t)),this.fire(new h.z("moveend",t))}flyTo(t,o){if(this._prefersReducedMotion(t)){const Ce=h.aK(t,["center","zoom","bearing","pitch","around","padding","retainPadding"]);return this.jumpTo(Ce,o)}this.stop(),t=Object.assign({offset:[0,0],speed:1.2,curve:1.42,easing:h.eS},t);const c=this.transform,d=this.getZoom(),m=this.getBearing(),_=this.getPitch(),y=this.getPadding(),v="zoom"in t?h.aB(+t.zoom,c.minZoom,c.maxZoom):d,T="bearing"in t?this._normalizeBearing(t.bearing,m):m,I="pitch"in t?+t.pitch:_,P=this._extendPadding(t.padding),A=c.zoomScale(v-d),D=h.P.convert(t.offset);let O=c.centerPoint.add(D);const L=c.pointLocation(O),k=h.aX.convert(t.center||L);this._normalizeCenter(k);const N=c.project(L),H=c.project(k).sub(N);let Z=t.curve;const G=Math.max(c.width,c.height),ne=G/A,te=H.mag();if("minZoom"in t){const Ce=h.aB(Math.min(t.minZoom,d,v),c.minZoom,c.maxZoom),Re=G/c.zoomScale(Ce-d);Z=Math.sqrt(Re/te*2)}const se=Z*Z;function J(Ce){const Re=(ne*ne-G*G+(Ce?-1:1)*se*se*te*te)/(2*(Ce?ne:G)*se*te);return Math.log(Math.sqrt(Re*Re+1)-Re)}function K(Ce){return(Math.exp(Ce)-Math.exp(-Ce))/2}function oe(Ce){return(Math.exp(Ce)+Math.exp(-Ce))/2}const de=J(0);let ue=function(Ce){return oe(de)/oe(de+Z*Ce)},ve=function(Ce){return G*((oe(de)*(K(Re=de+Z*Ce)/oe(Re))-K(de))/se)/te;var Re},be=(J(1)-de)/Z;if(Math.abs(te)<1e-6||!isFinite(be)){if(Math.abs(G-ne)<1e-6)return this.easeTo(t,o);const Ce=ne<G?-1:1;be=Math.abs(Math.log(ne/G))/Z,ve=function(){return 0},ue=function(Re){return Math.exp(Ce*Z*Re)}}t.duration="duration"in t?+t.duration:1e3*be/("screenSpeed"in t?+t.screenSpeed/Z:+t.speed),t.maxDuration&&t.duration>t.maxDuration&&(t.duration=0);const ke=m!==T,fe=I!==_,Ee=!c.isPaddingEqual(P),pe=t.retainPadding===!1?c.clone():c,Pe=Ce=>Re=>{const Ye=Re*be,qe=1/ue(Ye);Ce.zoom=Re===1?v:d+Ce.scaleZoom(qe),ke&&(Ce.bearing=h.aj(m,T,Re)),fe&&(Ce.pitch=h.aj(_,I,Re)),Ee&&(pe.interpolatePadding(y,P,Re),O=pe.centerPoint.add(D));const je=Re===1?k:Ce.unproject(N.add(H.mult(ve(Ye))).mult(qe));return Ce.setLocationAtPoint(Ce.renderWorldCopies?je.wrap():je,O),Ce._updateCameraOnTerrain(),t.preloadOnly||this._fireMoveEvents(o),Ce};if(t.preloadOnly){const Ce=this._emulate(Pe,t.duration,c);return this._preloadTiles(Ce),this}return this._zooming=!0,this._rotating=ke,this._pitching=fe,this._padding=Ee,this._prepareEase(o,!1),this._ease(Pe(c),()=>this._afterEase(o),t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_requestRenderFrame(t){}_cancelRenderFrame(t){}_stop(t,o){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),this._easeFrameId=void 0,this._onEaseFrame=void 0),this._onEaseEnd){const c=this._onEaseEnd;this._onEaseEnd=void 0,c.call(this,o)}if(!t){const c=this.handlers;c&&c.stop(!1)}return this}_ease(t,o,c){c.animate===!1||c.duration===0?(t(1),o()):(this._easeStart=h.o.now(),this._easeOptions=c,this._onEaseFrame=t,this._onEaseEnd=o,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const t=Math.min((h.o.now()-this._easeStart)/this._easeOptions.duration,1),o=this._onEaseFrame;o&&o(this._easeOptions.easing(t)),t<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(t,o){t=h.bv(t,-180,180);const c=Math.abs(t-o);return Math.abs(t-360-o)<c&&(t-=360),Math.abs(t+360-o)<c&&(t+=360),t}_normalizeCenter(t){const o=this.transform;if(o.maxBounds||o.projection.name!=="globe"&&!o.renderWorldCopies)return;const c=t.lng-o.center.lng;t.lng+=c>180?-360:c<-180?360:0}_prefersReducedMotion(t){return this._respectPrefersReducedMotion&&h.o.prefersReducedMotion&&!(t&&t.essential)}_emulate(t,o,c){const d=Math.ceil(15*o/1e3),m=[],_=t(c.clone());for(let y=0;y<=d;y++){const v=_(y/d);m.push(v.clone())}return m}_preloadTiles(t,o){}}const Ns=/^(https?:|mailto:)/i;class wm{constructor(t={}){this.options=t,h.b0(["_toggleAttribution","_updateEditLink","_updateData","_updateCompact"],this)}getDefaultPosition(){return"bottom-right"}onAdd(t){const o=this.options&&this.options.compact,c=t._getUIString("AttributionControl.ToggleAttribution");this._map=t,this._container=Ot("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=Ot("button","mapboxgl-ctrl-attrib-button",this._container),this._compactButton.type="button",this._compactButton.addEventListener("click",this._toggleAttribution),this._compactButton.setAttribute("aria-label",c);const d=Ot("span","mapboxgl-ctrl-icon",this._compactButton);return d.setAttribute("aria-hidden","true"),d.setAttribute("title",c),this._innerContainer=Ot("div","mapboxgl-ctrl-attrib-inner",this._container),o&&this._container.classList.add("mapboxgl-compact"),this._updateAttributions(),this._updateEditLink(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("moveend",this._updateEditLink),o===void 0&&(this._map.on("resize",this._updateCompact),this._updateCompact()),this._container}onRemove(){this._container.remove(),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("moveend",this._updateEditLink),this._map.off("resize",this._updateCompact),this._map=void 0,this._attribHTML=void 0}_toggleAttribution(){this._container.classList.contains("mapboxgl-compact-show")?(this._container.classList.remove("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","false")):(this._container.classList.add("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","true"))}_updateEditLink(){let t=this._editLink;t||(t=this._editLink=this._container.querySelector(".mapbox-improve-map"));const o=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:this._map._requestManager._customAccessToken||h.g.ACCESS_TOKEN}];if(t){const c=o.reduce((d,m,_)=>(m.value&&(d+=`${m.key}=${m.value}${_<o.length-1?"&":""}`),d),"?");t.href=`${h.g.FEEDBACK_URL}/${c}#${Bc(this._map,!0)}`,t.rel="noopener nofollow"}}_updateData(t){!t||(t.dataType!=="source"||t.sourceDataType!=="metadata"&&t.sourceDataType!=="visibility")&&t.dataType!=="style"||(this._updateAttributions(),this._updateEditLink())}_updateAttributions(){if(!this._map.style)return;let t=[];if(this._map.style.stylesheet){const d=this._map.style.stylesheet;this.styleOwner=d.owner,this.styleId=d.id}const o=this._map.style._mergedSourceCaches;for(const d in o){const m=o[d];if(m.used){const _=m.getSource();_.attribution&&!t.includes(_.attribution)&&t.push(_.attribution)}}t.sort((d,m)=>d.length-m.length),t=t.filter((d,m)=>{for(let _=m+1;_<t.length;_++)if(t[_].includes(d))return!1;return!0}),this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=[...this.options.customAttribution,...t]:t.unshift(this.options.customAttribution));const c=t.map(d=>(function(m){const _=new DOMParser().parseFromString(m,"text/html");return Array.from(_.body.querySelectorAll("*")).reverse().forEach(y=>{const v=y.textContent||"";if(y.tagName!=="A")return void y.replaceWith(...y.childNodes);const T=y.getAttribute("href");if(!T||!Ns.test(T))return void y.replaceWith(_.createTextNode(v));const I=_.createElement("a");I.href=T,I.textContent=v,I.rel="noopener nofollow";const P=y.getAttribute("class");P&&(I.className=P),y.replaceWith(I)}),_.body.innerHTML})(d)).join(" | ");c!==this._attribHTML&&(this._attribHTML=c,t.length?(this._innerContainer.innerHTML=c,this._container.classList.remove("mapboxgl-attrib-empty")):this._container.classList.add("mapboxgl-attrib-empty"),this._editLink=null)}_updateCompact(){this._map.getCanvasContainer().offsetWidth<=640?this._container.classList.add("mapboxgl-compact"):this._container.classList.remove("mapboxgl-compact","mapboxgl-compact-show")}}class Tm{constructor(){h.b0(["_updateLogo","_updateCompact"],this)}onAdd(t){this._map=t,this._container=Ot("div","mapboxgl-ctrl");const o=Ot("a","mapboxgl-ctrl-logo");return o.target="_blank",o.rel="noopener nofollow",o.href="https://www.mapbox.com/",o.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),o.setAttribute("rel","noopener nofollow"),this._container.appendChild(o),this._container.style.display="none",this._map.on("sourcedata",this._updateLogo),this._updateLogo(),this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){this._container.remove(),this._map.off("sourcedata",this._updateLogo),this._map.off("resize",this._updateCompact)}getDefaultPosition(){return"bottom-left"}_updateLogo(t){t&&t.sourceDataType!=="metadata"||(this._container.style.display=this._logoRequired()?"block":"none")}_logoRequired(){if(!this._map.style)return!0;const t=this._map.style._sourceCaches;if(Object.entries(t).length===0)return!0;for(const o in t){const c=t[o].getSource();if(Object.hasOwn(c,"mapbox_logo")&&!c.mapbox_logo)return!1}return!0}_updateCompact(){const t=this._container.children;if(t.length){const o=t[0];this._map.getCanvasContainer().offsetWidth<250?o.classList.add("mapboxgl-compact"):o.classList.remove("mapboxgl-compact")}}}class Sm{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(t){const o=++this._id;return this._queue.push({callback:t,id:o,cancelled:!1}),o}remove(t){const o=this._currentlyRunning,c=o?this._queue.concat(o):this._queue;for(const d of c)if(d.id===t)return void(d.cancelled=!0)}run(t=0){const o=this._currentlyRunning=this._queue;this._queue=[];for(const c of o)if(!c.cancelled&&(c.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}class pg{constructor(t){this.jumpTo(t)}getValue(t){if(t<=this._startTime)return this._start;if(t>=this._endTime)return this._end;const o=h.dr((t-this._startTime)/(this._endTime-this._startTime));return this._start*(1-o)+this._end*o}isEasing(t){return t>=this._startTime&&t<=this._endTime}jumpTo(t){this._startTime=-1/0,this._endTime=-1/0,this._start=t,this._end=t}easeTo(t,o,c){this._start=this.getValue(o),this._end=t,this._startTime=o,this._endTime=o+c}}const tf={"AttributionControl.ToggleAttribution":"Toggle attribution","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"Mapbox homepage","Map.Title":"Map","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScrollZoomBlocker.CtrlMessage":"Use ctrl + scroll to zoom the map","ScrollZoomBlocker.CmdMessage":"Use â + scroll to zoom the map","TouchPanBlocker.Message":"Use two fingers to move the map"};class Im extends h.z{constructor(t,o,c,d){const{point:m,lngLat:_,originalEvent:y,target:v}=t;super(t.type,{point:m,lngLat:_,originalEvent:y,target:v}),this.preventDefault=()=>{t.preventDefault()},this.id=o,this.interaction=c,this.feature=d}}class Ra{constructor(t){this.map=t,this.interactionsByType=new Map,this.delegatedInteractions=new Map,this.typeById=new Map,this.filters=new Map,this.handleType=this.handleType.bind(this),this.handleMove=this.handleMove.bind(this),this.handleOut=this.handleOut.bind(this),this.hoveredFeatures=new Map,this.prevHoveredFeatures=new Map}add(t,o){if(this.typeById.has(t))throw new Error(`Interaction id "${t}" already exists.`);const c=o.filter;let d=o.type;c&&this.filters.set(t,h.dj(c)),d==="mouseover"&&(d="mouseenter"),d==="mouseout"&&(d="mouseleave");const m=this.interactionsByType.get(d)||new Map;d==="mouseenter"||d==="mouseleave"?(this.delegatedInteractions.size===0&&(this.map.on("mousemove",this.handleMove),this.map.on("mouseout",this.handleOut)),this.delegatedInteractions.set(t,o)):m.size===0&&this.map.on(d,this.handleType),m.size===0&&this.interactionsByType.set(d,m),m.set(t,o),this.typeById.set(t,d)}get(t){const o=this.typeById.get(t);if(!o)return;const c=this.interactionsByType.get(o);return c?c.get(t):void 0}remove(t){const o=this.typeById.get(t);if(!o)return;this.typeById.delete(t),this.filters.delete(t);const c=this.interactionsByType.get(o);c&&(c.delete(t),o==="mouseenter"||o==="mouseleave"?(this.delegatedInteractions.delete(t),this.delegatedInteractions.size===0&&(this.map.off("mousemove",this.handleMove),this.map.off("mouseout",this.handleOut))):c.size===0&&this.map.off(o,this.handleType))}queryTargets(t,o){const c=[];for(const[d,m]of o)m.target&&c.push({targetId:d,target:m.target,filter:this.filters.get(d)});return this.map.style.queryRenderedTargets(t,c,this.map.transform)}handleMove(t){this.prevHoveredFeatures=this.hoveredFeatures,this.hoveredFeatures=new Map;const o=this.queryTargets(t.point,Array.from(this.delegatedInteractions).reverse());o.length&&(t.type="mouseenter",this.handleType(t,o));const c=new Map;for(const[d,{feature:m}]of this.prevHoveredFeatures)this.hoveredFeatures.has(d)||c.set(m.id,m);c.size&&(t.type="mouseleave",this.handleType(t,Array.from(c.values())))}handleOut(t){const o=Array.from(this.hoveredFeatures.values()).map(({feature:c})=>c);o.length&&(t.type="mouseleave",this.handleType(t,o)),this.hoveredFeatures.clear()}handleType(t,o){const c=t.type==="mouseenter";if(c&&!this.interactionsByType.has(t.type))return void h.w("mouseenter interaction required for mouseleave to work.");const d=Array.from(this.interactionsByType.get(t.type)).reverse(),m=!!o;o=o||this.queryTargets(t.point,d);let _=!1;const y=new Set;for(const v of o){for(const[T,I]of d){if(!I.target)continue;const P=v.variants?v.variants[T]:null;if(P){for(const A of P){if(rp(A,v,y,T))continue;const D=new h.dl(v,A),O=ip(A,v,T);m&&D.id!==void 0&&(D.state=this.map.getFeatureState(D));const L=c?this.prevHoveredFeatures.get(O):null,k=new Im(t,T,I,D),N=L?L.stop:I.handler(k);if(c&&this.hoveredFeatures.set(O,{feature:v,stop:N}),N!==!1){_=!0;break}}if(_)break}}if(_)break}if(!_)for(const[v,T]of d){const{handler:I,target:P}=T;if(!P&&I(new Im(t,v,T,null))!==!1)break}}}function Em(a,t){if(Array.isArray(a)&&Array.isArray(t)){const o=new Set(a),c=new Set(t);return o.size===c.size&&a.every(d=>c.has(d))}return h.b9(a,t)}const mg=/matrix.*\((.+)\)/,Am={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:85,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,performanceMetricsCollection:!0,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,antialias:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,minTileCacheSize:null,maxTileCacheSize:null,localIdeographFontFamily:"sans-serif",localFontFamily:null,fontstackCompositing:"client",transformRequest:null,accessToken:null,fadeDuration:300,respectPrefersReducedMotion:!0,crossSourceCollisions:!0,collectResourceTiming:!1,testMode:!1,precompilePrograms:!0,scaleFactor:1},_g={showCompass:!0,showZoom:!0,visualizePitch:!1};class gg{constructor(t,o,c=!1){this._clickTolerance=10,this.element=o,this.mouseRotate=new lh({clickTolerance:t.dragRotate._mouseRotate._clickTolerance}),this.map=t,c&&(this.mousePitch=new Mn({clickTolerance:t.dragRotate._mousePitch._clickTolerance})),h.b0(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),o.addEventListener("mousedown",this.mousedown),o.addEventListener("touchstart",this.touchstart,{passive:!1}),o.addEventListener("touchmove",this.touchmove),o.addEventListener("touchend",this.touchend),o.addEventListener("touchcancel",this.reset)}down(t,o){this.mouseRotate.mousedown(t,o),this.mousePitch&&this.mousePitch.mousedown(t,o),jo()}move(t,o){const c=this.map,d=this.mouseRotate.mousemoveWindow(t,o),m=d&&d.bearingDelta;if(m&&c.setBearing(c.getBearing()+m),this.mousePitch){const _=this.mousePitch.mousemoveWindow(t,o),y=_&&_.pitchDelta;y&&c.setPitch(c.getPitch()+y)}}off(){const t=this.element;t.removeEventListener("mousedown",this.mousedown),t.removeEventListener("touchstart",this.touchstart),t.removeEventListener("touchmove",this.touchmove),t.removeEventListener("touchend",this.touchend),t.removeEventListener("touchcancel",this.reset),this.offTemp()}offTemp(){Go(),window.removeEventListener("mousemove",this.mousemove),window.removeEventListener("mouseup",this.mouseup)}mousedown(t){this.down(Object.assign({},t,{button:t.button,type:t.type,ctrlKey:!0,preventDefault:()=>t.preventDefault()}),$o(this.element,t)),window.addEventListener("mousemove",this.mousemove),window.addEventListener("mouseup",this.mouseup)}mousemove(t){this.move(t,$o(this.element,t))}mouseup(t){this.mouseRotate.mouseupWindow(t),this.mousePitch&&this.mousePitch.mouseupWindow(t),this.offTemp()}touchstart(t){t.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=Ys(this.element,t.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:()=>t.preventDefault()},this._startPos))}touchmove(t){t.targetTouches.length!==1?this.reset():(this._lastPos=Ys(this.element,t.targetTouches)[0],this.move({buttons:1,preventDefault:()=>t.preventDefault()},this._lastPos))}touchend(t){t.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),this.reset()}reset(){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()}}function Oo(a,t,o){if(a=new h.aX(a.lng,a.lat),t){const c=new h.aX(a.lng-360,a.lat),d=new h.aX(a.lng+360,a.lat),m=360*Math.ceil(Math.abs(a.lng-o.center.lng)/360),_=o.locationPoint3D(a).distSqr(t),y=t.x<0||t.y<0||t.x>o.width||t.y>o.height;o.locationPoint3D(c).distSqr(t)<_&&(y||Math.abs(c.lng-o.center.lng)<m)?a=c:o.locationPoint3D(d).distSqr(t)<_&&(y||Math.abs(d.lng-o.center.lng)<m)&&(a=d)}for(;Math.abs(a.lng-o.center.lng)>180;){const c=o.locationPoint3D(a);if(c.x>=0&&c.y>=0&&c.x<=o.width&&c.y<=o.height)break;a.lng>o.center.lng?a.lng-=360:a.lng+=360}return a}
3281const rf={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"},nf=/\s+/,Hn={rotation:0,rotationAlignment:"auto",pitchAlignment:"auto",occludedOpacity:.2,altitude:0};class jc extends h.E{constructor(t,o){super(),(t instanceof HTMLElement||o)&&(t=Object.assign({element:t},o)),h.b0(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress","_clearFadeTimer"],this);const{anchor:c="center",color:d="#3FB1CE",scale:m=1,draggable:_=!1,clickTolerance:y=0,rotation:v=Hn.rotation,rotationAlignment:T=Hn.rotationAlignment,pitchAlignment:I=Hn.pitchAlignment,occludedOpacity:P=Hn.occludedOpacity,altitude:A=Hn.altitude}=t||{};this._anchor=c,this._color=d,this._scale=m,this._draggable=_,this._clickTolerance=y,this._rotation=v,this._rotationAlignment=T,this._pitchAlignment=I,this._occludedOpacity=P,this._altitude=A,this._state="inactive",this._isDragging=!1,this._updateMoving=()=>this._update(!0),t&&t.element?(this._element=t.element,this._offset=h.P.convert(t&&t.offset||[0,0])):(this._defaultMarker=!0,this._element=this._createDefaultMarker(),this._offset=h.P.convert(t&&t.offset||[0,-14])),this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label","Map marker"),this._element.hasAttribute("role")||this._element.setAttribute("role","img"),this._element.classList.add("mapboxgl-marker"),this._element.addEventListener("dragstart",L=>{L.preventDefault()}),this._element.addEventListener("mousedown",L=>{L.preventDefault()});const D=this._element.classList;for(const L in rf)D.remove(`mapboxgl-marker-anchor-${L}`);D.add(`mapboxgl-marker-anchor-${this._anchor}`);const O=t&&t.className?t.className.trim().split(nf):[];D.add(...O),this._popup=null}_createDefaultMarker(){const t=Ot("div"),o=an("svg",{display:"block",height:41*this._scale+"px",width:27*this._scale+"px",viewBox:"0 0 27 41"},t);if(this._altitude===0){const c=an("radialGradient",{id:"shadowGradient"},an("defs",{},o));an("stop",{offset:"10%","stop-opacity":.4},c),an("stop",{offset:"100%","stop-opacity":.05},c),an("ellipse",{cx:13.5,cy:34.8,rx:10.5,ry:5.25,fill:"url(#shadowGradient)"},o)}return an("path",{fill:this._color,d:"M27,13.5C27,19.07 20.25,27 14.75,34.5C14.02,35.5 12.98,35.5 12.25,34.5C6.75,27 0,19.22 0,13.5C0,6.04 6.04,0 13.5,0C20.96,0 27,6.04 27,13.5Z"},o),an("path",{opacity:.25,d:"M13.5,0C6.04,0 0,6.04 0,13.5C0,19.22 6.75,27 12.25,34.5C13,35.52 14.02,35.5 14.75,34.5C20.25,27 27,19.07 27,13.5C27,6.04 20.96,0 13.5,0ZM13.5,1C20.42,1 26,6.58 26,13.5C26,15.9 24.5,19.18 22.22,22.74C19.95,26.3 16.71,30.14 13.94,33.91C13.74,34.18 13.61,34.32 13.5,34.44C13.39,34.32 13.26,34.18 13.06,33.91C10.28,30.13 7.41,26.31 5.02,22.77C2.62,19.23 1,15.95 1,13.5C1,6.58 6.58,1 13.5,1Z"},o),an("circle",{fill:"white",cx:13.5,cy:13.5,r:5.5},o),t}addTo(t){return t===this._map||(this.remove(),this._map=t,t.getCanvasContainer().appendChild(this._element),t.on("move",this._updateMoving),t.on("moveend",this._update),t.on("remove",this._clearFadeTimer),t._addMarker(this),this.setDraggable(this._draggable),this._update(),t.on("click",this._onMapClick)),this}remove(){const t=this._map;return t&&(t.off("click",this._onMapClick),t.off("move",this._updateMoving),t.off("moveend",this._update),t.off("mousedown",this._addDragHandler),t.off("touchstart",this._addDragHandler),t.off("mouseup",this._onUp),t.off("touchend",this._onUp),t.off("mousemove",this._onMove),t.off("touchmove",this._onMove),t.off("remove",this._clearFadeTimer),t._removeMarker(this),this._map=void 0),this._clearFadeTimer(),this._element.remove(),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=h.aX.convert(t),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(!0),this}setAltitude(t){return t===this._altitude||(this._defaultMarker&&(this._altitude===0&&t!==0||this._altitude!==0&&t===0)&&(this._element=this._createDefaultMarker()),this._altitude=t||Hn.altitude,this._update()),this}getAltitude(){return this._altitude}getElement(){return this._element}setPopup(t){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeAttribute("role"),this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),t){if(!("offset"in t.options)){const d=Math.sqrt(Math.pow(13.5,2)/2);t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[
vendor: 21,625 bytes, lines 3281-3286
32810,-38.1],"bottom-left":[d,-1*(38.1-13.5+d)],"bottom-right":[-d,-1*(38.1-13.5+d)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=t,t._marker=this,t._altitude=this._altitude,this._lngLat&&this._popup.setLngLat(this._lngLat),this._element.setAttribute("role","button"),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress),this._element.setAttribute("aria-expanded","false")}return this}_onKeyPress(t){const o=t.code,c=t.charCode||t.keyCode;o!=="Space"&&o!=="Enter"&&c!==32&&c!==13||this.togglePopup()}_onMapClick(t){const o=t.originalEvent.target,c=this._element;this._popup&&(o===c||c.contains(o))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){const t=this._popup;return t?(t.isOpen()?(t.remove(),this._element.setAttribute("aria-expanded","false")):this._map&&(t.addTo(this._map),this._element.setAttribute("aria-expanded","true")),this):this}_behindTerrain(){const t=this._map,o=this._pos;if(!t||!o)return!1;const c=t.unproject(o,this._altitude),d=t.getFreeCameraOptions();if(!d.position)return!1;const m=d.position.toLngLat();return m.distanceTo(c)<.9*m.distanceTo(this._lngLat)}_evaluateOpacity(){const t=this._map;if(!t)return;const o=this._pos;if(!o||o.x<0||o.x>t.transform.width||o.y<0||o.y>t.transform.height)return void this._clearFadeTimer();const c=t.unproject(o,this._altitude);let d;t._showingGlobe()&&h.f2(t.transform,this._lngLat)?d=0:(d=1-t._queryFogOpacity(c),t.transform._terrainEnabled()&&t.getTerrain()&&this._behindTerrain()&&(d*=this._occludedOpacity)),this._element.style.opacity=`${d}`,this._element.style.pointerEvents=d>0?"auto":"none",this._popup&&this._popup._setOpacity(d),this._fadeTimer=null}_clearFadeTimer(){this._fadeTimer&&(clearTimeout(this._fadeTimer),this._fadeTimer=null)}_updateDOM(){const t=this._pos;if(!t||!this._map)return;const o=this._offset.mult(this._scale);this._element.style.transform=` 3282 translate(${t.x}px,${t.y}px) 3283 ${rf[this._anchor]} 3284 ${this._calculateXYTransform()} ${this._calculateZTransform()} 3285 translate(${o.x}px,${o.y}px) 3286 `}_calculateXYTransform(){const t=this._pos,o=this._map,c=this.getPitchAlignment();if(!o||!t||c!=="map")return"";if(!o._showingGlobe()){const v=o.getPitch();return v?`rotateX(${v}deg)`:""}const d=h.cL(h.f3(o.transform,this._lngLat)),m=t.sub(h.f4(o.transform)),_=Math.abs(m.x)+Math.abs(m.y);if(_===0)return"";const y=d/_;return`rotateX(${-m.y*y}deg) rotateY(${m.x*y}deg)`}_calculateZTransform(){const t=this._pos,o=this._map;if(!o||!t)return"";let c=0;const d=this.getRotationAlignment();if(d==="map")if(o._showingGlobe()){const m=o.project(new h.aX(this._lngLat.lng,this._lngLat.lat+.001),this._altitude),_=o.project(new h.aX(this._lngLat.lng,this._lngLat.lat-.001),this._altitude).sub(m);c=h.cL(Math.atan2(_.y,_.x))-90}else c=-o.getBearing();else if(d==="horizon"){const m=h.ag(4,6,o.getZoom()),_=h.f4(o.transform);_.y+=m*o.transform.height;const y=t.sub(_),v=h.cL(Math.atan2(y.y,y.x));c=(v>90?v-270:v+90)*(1-m)}return c+=this._rotation,c?`rotateZ(${c}deg)`:""}_update(t){cancelAnimationFrame(this._updateFrameId);const o=this._map;o&&(o.transform.renderWorldCopies&&(this._lngLat=Oo(this._lngLat,this._pos,o.transform)),this._pos=o.project(this._lngLat,this._altitude),t===!0?this._updateFrameId=requestAnimationFrame(()=>{this._element&&this._pos&&this._anchor&&(this._pos=this._pos.round(),this._updateDOM())}):this._pos=this._pos.round(),o._requestDomTask(()=>{this._map&&(this._element&&this._pos&&this._anchor&&this._updateDOM(),(o._showingGlobe()||o.getTerrain()||o.getFog())&&!this._fadeTimer&&(this._fadeTimer=window.setTimeout(this._evaluateOpacity.bind(this),60)))}))}getOffset(){return this._offset}setOffset(t){return this._offset=h.P.convert(t),this._update(),this}addClassName(t){return this._element.classList.add(t),this}removeClassName(t){return this._element.classList.remove(t),this}toggleClassName(t){return this._element.classList.toggle(t)}_onMove(t){const o=this._map;if(!o)return;const c=this._pointerdownPos,d=this._positionDelta;if(c&&d){if(!this._isDragging){const m=this._clickTolerance||o._clickTolerance;if(t.point.dist(c)<m)return;this._isDragging=!0}this._pos=t.point.sub(d),this._lngLat=o.unproject(this._pos,this._altitude),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new h.z("dragstart"))),this.fire(new h.z("drag"))}}_onUp(){this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1;const t=this._map;t&&(t.off("mousemove",this._onMove),t.off("touchmove",this._onMove)),this._state==="active"&&this.fire(new h.z("dragend")),this._state="inactive"}_addDragHandler(t){const o=this._map,c=this._pos;o&&c&&this._element.contains(t.originalEvent.target)&&(t.preventDefault(),this._positionDelta=t.point.sub(c),this._pointerdownPos=t.point,this._state="pending",o.on("mousemove",this._onMove),o.on("touchmove",this._onMove),o.once("mouseup",this._onUp),o.once("touchend",this._onUp))}setDraggable(t){this._draggable=!!t;const o=this._map;return o&&(t?(o.on("mousedown",this._addDragHandler),o.on("touchstart",this._addDragHandler)):(o.off("mousedown",this._addDragHandler),o.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(t){return this._rotation=t||Hn.rotation,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(t){return this._rotationAlignment=t||Hn.rotationAlignment,this._update(),this}getRotationAlignment(){return this._rotationAlignment==="auto"||this._rotationAlignment==="horizon"&&this._map&&!this._map._showingGlobe()?"viewport":this._rotationAlignment}setPitchAlignment(t){return this._pitchAlignment=t||Hn.pitchAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment==="auto"?this.getRotationAlignment():this._pitchAlignment}setOccludedOpacity(t){return this._occludedOpacity=t||Hn.occludedOpacity,this._update(),this}getOccludedOpacity(){return this._occludedOpacity}}const of={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0,showUserHeading:!1,showButton:!0,followUserLocation:!0},yg={maxWidth:100,unit:"metric"},Mm={kilometer:"km",meter:"m",mile:"mi",foot:"ft","nautical-mile":"nm"},Cm=/\s+/,sf={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",altitude:0},wi=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function af(a=new h.P(0,0),t="bottom"){if(typeof a=="number"){const o=Math.round(Math.sqrt(.5*Math.pow(a,2)));switch(t){case"top":return new h.P(0,a);case"top-left":return new h.P(o,o);case"top-right":return new h.P(-o,o);case"bottom":return new h.P(0,-a);case"bottom-left":return new h.P(o,-o);case"bottom-right":return new h.P(-o,-o);case"left":return new h.P(a,0);case"right":return new h.P(-a,0)}return new h.P(0,0)}return a instanceof h.P||Array.isArray(a)?h.P.convert(a):h.P.convert(a[t]||[0,0])}return{version:U,supported:ms.supported,setRTLTextPlugin:h.f7,getRTLTextPluginStatus:h.f6,addTileProvider:h.f5,Map:class extends $n{constructor(a){ji.mark(sn.create);const t=a;if((a=Object.assign({},Am,a)).minZoom!=null&&a.maxZoom!=null&&a.minZoom>a.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(a.minPitch!=null&&a.maxPitch!=null&&a.minPitch>a.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(a.minPitch!=null&&a.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(a.maxPitch!=null&&a.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");a.antialias&&h.f0(window)&&(a.antialias=!1,h.w("Antialiasing is disabled for this WebGL context to avoid browser bug: https://github.com/mapbox/mapbox-gl-js/issues/11609")),super(new hl(a.minZoom,a.maxZoom,a.minPitch,a.maxPitch,a.renderWorldCopies,null,null),a),this._repaint=!!a.repaint,this._interactive=a.interactive,this._minTileCacheSize=a.minTileCacheSize,this._maxTileCacheSize=a.maxTileCacheSize,this._failIfMajorPerformanceCaveat=a.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=a.preserveDrawingBuffer,this._antialias=a.antialias,this._trackResize=a.trackResize,this._bearingSnap=a.bearingSnap,this._refreshExpiredTiles=a.refreshExpiredTiles,this._fadeDuration=a.fadeDuration,this._isInitialLoad=!0,this._crossSourceCollisions=a.crossSourceCollisions,this._collectResourceTiming=a.collectResourceTiming,this._language=this._parseLanguage(a.language),this._worldview=a.worldview,this._renderTaskQueue=new Sm,this._domRenderTaskQueue=new Sm,this._controls=[],this._markers=[],this._popups=[],this._mapId=h.an(),this._locale=Object.assign({},tf,a.locale),this._clickTolerance=a.clickTolerance,this._cooperativeGestures=a.cooperativeGestures,this._performanceMetricsCollection=a.performanceMetricsCollection,this._tessellationStep=a.tessellationStep,this._containerWidth=0,this._containerHeight=0,this._showParseStatus=!0,this._precompilePrograms=a.precompilePrograms,this._averageElevationLastSampledAt=-1/0,this._averageElevationExaggeration=0,this._averageElevation=new pg(0),this._interactionRange=[1/0,-1/0],this._visibilityHidden=0,this._useExplicitProjection=!1,this._frameId=0,this._scaleFactor=a.scaleFactor,this._requestManager=new Jn(a.transformRequest,a.accessToken,a.testMode);const o=wn(a.accessToken||h.g.ACCESS_TOKEN);if(o&&"atlas"in o&&typeof o.atlas=="number"&&(this._tokenExpiration=o.atlas),this._silenceAuthErrors=!!a.testMode,this._contextCreateOptions=a.contextCreateOptions?Object.assign({},a.contextCreateOptions):{},typeof a.container=="string"){const c=document.getElementById(a.container);if(!c)throw new Error(`Container '${a.container.toString()}' not found.`);this._container=c}else{if(!(a.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=a.container}if(this._container.childNodes.length>0&&h.w("The map container element should be empty, otherwise the map's interactivity will be negatively impacted. If you want to display a message when WebGL is not supported, use the Mapbox GL Supported plugin instead."),a.maxBounds&&this.setMaxBounds(a.maxBounds),this._spriteFormat="auto",h.b0(["_onWindowOnline","_onWindowResize","_onVisibilityChange","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._setupPainter(),this.painter===void 0)throw new Error("Failed to initialize WebGL.");if(this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this._fullscreenchangeEvent="onfullscreenchange"in document?"fullscreenchange":"webkitfullscreenchange",window.addEventListener("online",this._onWindowOnline,!1),window.addEventListener("resize",this._onWindowResize,!1),window.addEventListener("orientationchange",this._onWindowResize,!1),window.addEventListener(this._fullscreenchangeEvent,this._onWindowResize,!1),window.addEventListener("visibilitychange",this._onVisibilityChange,!1),this.handlers=new fg(this,a),this._localFontFamily=a.localFontFamily,this._localIdeographFontFamily=a.localIdeographFontFamily,this._fontstackCompositing=a.fontstackCompositing,(a.style||!a.testMode)&&this.setStyle(a.style||h.g.DEFAULT_STYLE,{config:a.config,localFontFamily:this._localFontFamily,localIdeographFontFamily:this._localIdeographFontFamily,fontstackCompositing:this._fontstackCompositing}),a.projection&&this.setProjection(a.projection),a.hash&&(this._hash=new Do(typeof a.hash=="string"&&a.hash||void 0).addTo(this)),!this._hash||!this._hash._onHashChange()){t.center==null&&t.zoom==null||(this.transform._unmodified=!1),this.jumpTo({center:a.center,zoom:a.zoom,bearing:a.bearing,pitch:a.pitch});const c=a.bounds;c&&(this.resize(),this.fitBounds(c,Object.assign({},a.fitBoundsOptions,{duration:0})))}this.resize(),a.attributionControl&&this.addControl(new wm({customAttribution:a.customAttribution})),this._logoControl=new Tm,this.addControl(this._logoControl,a.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet),this._postStyleLoadEvent(),this._postStyleWithAppearanceEvent()}),this.on("data",c=>{this._update(c.dataType==="style"),this.fire(new h.z(`${c.dataType}data`,c))}),this.on("dataloading",c=>{this.fire(new h.z(`${c.dataType}dataloading`,c))}),this._interactions=new Ra(this)}_getMapId(){return this._mapId}addControl(a,t){if(t===void 0&&(t=a.getDefaultPosition?a.getDefaultPosition():"top-right"),!a||!a.onAdd)return this.fire(new h.y(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const o=a.onAdd(this);this._controls.push(a);const c=this._controlPositions[t];return t.includes("bottom")?c.insertBefore(o,c.firstChild):c.appendChild(o),this}removeControl(a){if(!a||!a.onRemove)return this.fire(new h.y(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const t=this._controls.indexOf(a);return t>-1&&this._controls.splice(t,1),a.onRemove(this),this}hasControl(a){return this._controls.includes(a)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}resize(a){if(this._updateContainerDimensions(),this._containerWidth===this.transform.width&&this._containerHeight===this.transform.height)return this;this._resizeCanvas(this._containerWidth,this._containerHeight),this.transform.resize(this._containerWidth,this._containerHeight),this.painter.resize(Math.ceil(this._containerWidth),Math.ceil(this._containerHeight));const t=!this._moving;return t&&this.fire(new h.z("movestart",a)).fire(new h.z("move",a)),this.fire(new h.z("resize",a)),t&&this.fire(new h.z("moveend",a)),this}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()||null}setMaxBounds(a){return this.transform.setMaxBounds(h.aI.convert(a)),this._update()}setMinZoom(a){if((a=a??-2)>=-2&&a<=this.transform.maxZoom)return this.transform.minZoom=a,this._update(),this.getZoom()<a?this.setZoom(a):this.fire(new h.z("zoomstart")).fire(new h.z("zoom")).fire(new h.z("zoomend")),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(a){if((a=a??22)>=this.transform.minZoom)return this.transform.maxZoom=a,this._update(),this.getZoom()>a?this.setZoom(a):this.fire(new h.z("zoomstart")).fire(new h.z("zoom")).fire(new h.z("zoomend")),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(a){if((a=a??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(a>=0&&a<=this.transform.maxPitch)return this.transform.minPitch=a,this._update(),this.getPitch()<a?this.setPitch(a):this.fire(new h.z("pitchstart")).fire(new h.z("pitch")).fire(new h.z("pitchend")),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(a){if((a=a??85)>85)throw new Error("maxPitch must be less than or equal to 85");if(a>=this.transform.minPitch)return this.transform.maxPitch=a,this._update(),this.getPitch()>a?this.setPitch(a):this.fire(new h.z("pitchstart")).fire(new h.z("pitch")).fire(new h.z("pitchend")),this;throw new Error("maxPitch must be greater than or equal to minPitch")}getMaxPitch(){return this.transform.maxPitch}getScaleFactor(){return this._scaleFactor}setScaleFactor(a){return this._scaleFactor=a,this.painter.scaleFactor=a,this.style&&this.style._setLabelPlacementStale(),this.style._updateFilteredLayers(t=>t.type==="symbol"),this._update(!0),this}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(a){return this.transform.renderWorldCopies=a,this.transform.renderWorldCopies||this._forceMarkerAndPopupUpdate(!0),this._update()}getLanguage(){return this._language}_parseLanguage(a){return a==="auto"?navigator.language:Array.isArray(a)?a.length===0?void 0:a.map(t=>t==="auto"?navigator.language:t):a}setLanguage(a){const t=this._parseLanguage(a);if(!this.style||t===this._language)return this;this._language=t,this.style.reloadSources();for(const o of this._controls)o._setLanguage&&o._setLanguage(this._language);return this}getWorldview(){return this._worldview}setWorldview(a){return this.style&&a!==this._worldview?(this._worldview=a,this._styleDirty=!0,this.style.setWorldview(a),this):this}getProjection(){return this.transform.mercatorFromTransition?{name:"globe",center:[0,0]}:this.transform.getProjection()}_showingGlobe(){return this.transform.projection.name==="globe"}setProjection(a){return this._lazyInitEmptyStyle(),a?typeof a=="string"&&(a={name:a}):a=null,this._useExplicitProjection=!!a,this._prioritizeAndUpdateProjection(a,this.style.projection)}_updateProjectionTransition(){if(this.getProjection().name!=="globe")return;const a=this.transform,t=a.projection.name;let o;t==="globe"&&a.zoom>=h.cx?(a.setMercatorFromTransition(),o=!0):t==="mercator"&&a.zoom<h.cx&&(a.setProjection({name:"globe"}),o=!0),o&&(this.style.applyProjectionUpdate(),this.style._forceSymbolLayerUpdate(),this._update(!0))}_prioritizeAndUpdateProjection(a,t){return this._updateProjection(a||t||{name:"mercator"})}_updateProjection(a){let t;const o=this.transform.mercatorFromTransition;t=a.name==="globe"&&this.transform.zoom>=h.cx?this.transform.setMercatorFromTransition():this.transform.setProjection(a),this.style.applyProjectionUpdate();const c=this.transform.getProjection().name==="mercator"&&o!==this.transform.mercatorFromTransition;return(t||c)&&(this.painter.clearBackgroundTiles(),this.style.clearSources(),this._update(!0),this._forceMarkerAndPopupUpdate(!0)),this}project(a,t){return this.transform.locationPoint3D(h.aX.convert(a),t)}unproject(a,t){return this.transform.pointLocation3D(h.P.convert(a),t)}isMoving(){return this._moving||this.handlers&&this.handlers.isMoving()||!1}isZooming(){return this._zooming||this.handlers&&this.handlers.isZooming()||!1}isRotating(){return this._rotating||this.handlers&&this.handlers.isRotating()||!1}_isDragging(){return this.handlers&&this.handlers._isDragging()||!1}_createDelegatedListener(a,t,o){const c=d=>{let m=[];if(Array.isArray(t)){const _=t.filter(y=>this.getLayer(y));m=_.length?this.queryRenderedFeatures(d,{layers:_}):[]}else m=this.queryRenderedFeatures(d,{target:t});return m};if(a==="mouseenter"||a==="mouseover"){let d=!1;return{listener:o,targets:t,delegates:{mousemove:_=>{const y=c(_.point);y.length?d||(d=!0,o.call(this,new rn(a,this,_.originalEvent,{features:y}))):d=!1},mouseout:()=>{d=!1}}}}if(a==="mouseleave"||a==="mouseout"){let d=!1;return{listener:o,targets:t,delegates:{mousemove:y=>{c(y.point).length?d=!0:d&&(d=!1,o.call(this,new rn(a,this,y.originalEvent)))},mouseout:y=>{d&&(d=!1,o.call(this,new rn(a,this,y.originalEvent)))}}}}{const d=m=>{const _=c(m.point);_.length&&(m.features=_,o.call(this,m),delete m.features)};return{listener:o,targets:t,delegates:{[a]:d}}}}on(a,t,o){if(typeof t=="function"||o===void 0)return super.on(a,t);if(typeof t=="string"&&(t=[t]),!this._areTargetsValid(t))return this;const c=this._createDelegatedListener(a,t,o);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[a]=this._delegatedListeners[a]||[],this._delegatedListeners[a].push(c);for(const d in c.delegates)this.on(d,c.delegates[d]);return this}once(a,t,o){if(typeof t=="function"||o===void 0)return super.once(a,t);if(typeof t=="string"&&(t=[t]),!this._areTargetsValid(t))return this;const c=this._createDelegatedListener(a,t,o);for(const d in c.delegates)this.once(d,c.delegates[d]);return this}off(a,t,o){if(typeof t=="function"||o===void 0)return super.off(a,t);if(typeof t=="string"&&(t=[t]),!this._areTargetsValid(t))return this;const c=this._delegatedListeners?this._delegatedListeners[a]:void 0;return c&&(d=>{for(let m=0;m<d.length;m++){const _=d[m];if(_.listener===o&&Em(_.targets,t)){for(const y in _.delegates)this.off(y,_.delegates[y]);return d.splice(m,1),this}}})(c),this}queryRenderedFeatures(a,t){if(!this.style)return[];if(a===void 0||a instanceof h.P||Array.isArray(a)||t!==void 0||(t=a,a=void 0),a=a||[[0,0],[this.transform.width,this.transform.height]],!t){const m=this.style.queryRenderedFeatures(a,void 0,this.transform),_=this.style.queryRenderedFeatureset(a,void 0,this.transform);return m.concat(_)}let o=!0;if(t.target&&(o=this._isTargetValid(t.target),o&&!t.layers))return this.style.queryRenderedFeatureset(a,t,this.transform);let c=!0;if(t.layers&&Array.isArray(t.layers)){for(const m of t.layers)if(!this._isValidId(m)){c=!1;break}if(c&&!t.target)return this.style.queryRenderedFeatures(a,t,this.transform)}let d=[];return c&&(d=d.concat(this.style.queryRenderedFeatures(a,t,this.transform))),o&&(d=d.concat(this.style.queryRenderedFeatureset(a,t,this.transform))),d}querySourceFeatures(a,t){return!a||typeof a=="string"&&!this._isValidId(a)?[]:this.style.querySourceFeatures(a,t)}queryRasterValue(a,t,o){return this._isValidId(a)?this.style.queryRasterValue(a,t,o):Promise.resolve(null)}isPointOnSurface(a){const{name:t}=this.transform.projection;return t!=="globe"&&t!=="mercator"&&h.w(`${t} projection does not support isPointOnSurface, this API may behave unex
3286pectedly.`),this.transform.isPointOnSurface(h.P.convert(a))}addInteraction(a,t){return this._interactions.add(a,t),this}removeInteraction(a){return this._interactions.remove(a),this}getCooperativeGestures(){return this._cooperativeGestures}setCooperativeGestures(a){return this._cooperativeGestures=a,this}setStyle(a,t){return t=Object.assign({},{localIdeographFontFamily:this._localIdeographFontFamily,localFontFamily:this._localFontFamily,fontstackCompositing:this._fontstackCompositing},t),this.style&&a&&t.diff!==!1&&t.localFontFamily===this._localFontFamily&&t.localIdeographFontFamily===this._localIdeographFontFamily&&t.fontstackCompositing===this._fontstackCompositing&&!t.config?(this.style._diffStyle(a,(o,c)=>{if(o){const d=typeof o=="string"?o:o instanceof Error?o.message:o.error;h.w(`Unable to perform style diff: ${d}. Rebuilding the style from scratch.`),this._updateStyle(a,t)}else c&&this._update(!0)},()=>this._postStyleLoadEvent()),this):(this._localIdeographFontFamily=t.localIdeographFontFamily,this._localFontFamily=t.localFontFamily,this._fontstackCompositing=t.fontstackCompositing,this._updateStyle(a,t))}_getUIString(a){const t=this._locale[a];if(t==null)throw new Error(`Missing UI string '${a}'`);return t}_updateStyle(a,t){if(this.style&&(this.style.setEventedParent(null),this.style._remove(),this.style=void 0),a){const o=Object.assign({},t);t&&t.config&&(o.initialConfig=t.config,delete o.config),this.style=new dn(this,o).load(a),this.style.setEventedParent(this,{style:this.style})}return this._updateTerrain(),this}_lazyInitEmptyStyle(){this.style||(this.style=new dn(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():(h.w("There is no style added to the map."),!1)}_isValidId(a){return a==null?(this.fire(new h.y(new Error("IDs can't be empty."))),!1):!h.de(a)||(this.fire(new h.y(new Error(`IDs can't contain special symbols: "${a}".`))),!1)}_isTargetValid(a){return"featuresetId"in a?this._isValidId("importId"in a?a.importId:a.featuresetId):"layerId"in a&&this._isValidId(a.layerId)}_areTargetsValid(a){if(Array.isArray(a)){for(const t of a)if(!this._isValidId(t))return!1;return!0}return this._isTargetValid(a)}addSource(a,t){return this._isValidId(a)?(this._lazyInitEmptyStyle(),this.style.addSource(a,t),this._update(!0)):this}isSourceLoaded(a){return!!this._isValidId(a)&&!!this.style&&this.style._isSourceCacheLoaded(a)}areTilesLoaded(){return this.style.areTilesLoaded()}addSourceType(a,t,o){this._lazyInitEmptyStyle(),this.style.addSourceType(a,t,o)}removeSource(a){return this._isValidId(a)?(this.style.removeSource(a),this._updateTerrain(),this._update(!0)):this}getSource(a){return this._isValidId(a)?this.style.getOwnSource(a):null}addImage(a,t,{pixelRatio:o=1,sdf:c=!1,stretchX:d,stretchY:m,content:_}={}){this._lazyInitEmptyStyle();const y=h.I.from(a);if(t instanceof HTMLImageElement||ImageBitmap&&t instanceof ImageBitmap){const{width:v,height:T,data:I}=h.o.getImageData(t);this.style.addImage(y,{data:new h.q({width:v,height:T},I),pixelRatio:o,stretchX:d,stretchY:m,content:_,sdf:c,version:0,usvg:!1})}else if(t.width===void 0||t.height===void 0)this.fire(new h.y(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));else{const{width:v,height:T}=t,I=t;this.style.addImage(y,{data:new h.q({width:v,height:T},new Uint8Array(I.data)),pixelRatio:o,stretchX:d,stretchY:m,content:_,sdf:c,usvg:!1,version:0,userImage:I}),I.onAdd&&I.onAdd(this,a)}}updateImage(a,t){this._lazyInitEmptyStyle();const o=h.I.from(a),c=this.style.getImage(o);if(!c)return void this.fire(new h.y(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const d=t instanceof HTMLImageElement||ImageBitmap&&t instanceof ImageBitmap?h.o.getImageData(t):t,{width:m,height:_,data:y}=d;if(m===void 0||_===void 0)return void this.fire(new h.y(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(m!==(c.usvg?c.icon.usvg_tree.width:c.data.width)||_!==(c.usvg?c.icon.usvg_tree.height:c.data.height))return void this.fire(new h.y(new Error(`The width and height of the updated image (${m}, ${_}) 3287 must be that same as the previous version of the image 3288 (${c.data.width}, ${c.data.height})`)));const v=!(t instanceof HTMLImageElement||ImageBitmap&&t instanceof ImageBitmap);let T=!1;c.usvg?(c.data=new h.q({width:m,height:_},new Uint8Array(y)),c.usvg=!1,c.icon=void 0,T=!0):c.data.replace(y,v),this.style.updateImage(o,c,T)}hasImage(a){return a?!!this.style&&!!this.style.getImage(h.I.from(a)):(this.fire(new h.y(new Error("Missing required image id"))),!1)}removeImage(a){this.style.removeImage(h.I.from(a))}loadImage(a,t){h.n(this._requestManager.transformRequest(a,h.R.Image),(o,c)=>{t(o,c)})}listImages(){return this.style.listImages().map(a=>a.name)}addModel(a,t){this._lazyInitEmptyStyle(),this.style.addModel(a,t)}hasModel(a){return a?this.style.hasModel(a):(this.fire(new h.y(new Error("Missing required model id"))),!1)}removeModel(a){this.style.removeModel(a)}listModels(){return this.style.listModels()}addLayer(a,t){return this._isValidId(a.id)?(this._lazyInitEmptyStyle(),this.style.addLayer(a,t),this._update(!0)):this}getSlot(a){const t=this.getLayer(a);return t&&t.slot||null}setSlot(a,t){return this.style.setSlot(a,t),this.style.mergeLayers(),this._update(!0)}
vendor: 22,506 bytes, line 3288
3288addImport(a,t){return this.style.addImport(a,t).catch(o=>this.fire(new h.y(new Error("Failed to add import",o)))),this}updateImport(a,t){return typeof t!="string"&&t.id!==a?(this.removeImport(a),this.addImport(t)):(this.style.updateImport(a,t),this._update(!0))}removeImport(a){return this.style.removeImport(a),this}moveImport(a,t){return this.style.moveImport(a,t),this._update(!0)}moveLayer(a,t){return this._isValidId(a)?(this.style.moveLayer(a,t),this._update(!0)):this}removeLayer(a){return this._isValidId(a)?(this.style.removeLayer(a),this._update(!0)):this}getLayer(a){if(!this._isValidId(a))return null;const t=this.style.getOwnLayer(a);return t?t.type==="custom"?t.implementation:t.serialize():void 0}getSlots(){return this.style.getSlots()}setLayerZoomRange(a,t,o){return this._isValidId(a)?(this.style.setLayerZoomRange(a,t,o),this._update(!0)):this}setFilter(a,t,o={}){return this._isValidId(a)?(this.style.setFilter(a,t,o),this._update(!0)):this}getFilter(a){return this._isValidId(a)?this.style.getFilter(a):null}setPaintProperty(a,t,o,c={}){return this._isValidId(a)?(this.style.setPaintProperty(a,t,o,c),this._update(!0)):this}getPaintProperty(a,t){return this._isValidId(a)?this.style.getPaintProperty(a,t):null}setLayoutProperty(a,t,o,c={}){return this._isValidId(a)?(this.style.setLayoutProperty(a,t,o,c),this._update(!0)):this}getLayoutProperty(a,t){return this._isValidId(a)?this.style.getLayoutProperty(a,t):null}setLayerProperty(a,t,o,c={}){return this._isValidId(a)?(t==="appearances"&&this._postAddingAppearancesToStyleEvent(),this.style.setLayerProperty(a,t,o,c),this._update(!0)):this}getGlyphsUrl(){return this.style.getGlyphsUrl()}setGlyphsUrl(a){return this.style.setGlyphsUrl(a),this._update(!0)}getSchema(a){return this.style.getSchema(a)}setSchema(a,t){return this.style.setSchema(a,t),this._update(!0)}getConfig(a){return this.style.getConfig(a)}setConfig(a,t){return this.style.setConfig(a,t),this._update(!0)}getConfigProperty(a,t){return this.style.getConfigProperty(a,t)}setConfigProperty(a,t,o){return this.style.setConfigProperty(a,t,o),this._update(!0)}getFeaturesetDescriptors(a){return this.style.getFeaturesetDescriptors(a)}setLights(a){if(this._lazyInitEmptyStyle(),a&&a.length===1&&a[0].type==="flat"){const t=a[0];t.properties?this.style.setFlatLight(t.properties,t.id,{}):this.style.setFlatLight({},"flat")}else this.style.setLights(a),this.painter.terrain&&(this.painter.terrain.invalidateRenderCache=!0);return this._update(!0)}getLights(){const a=this.style.getLights()||[];return a.length===0&&a.push({id:this.style.light.id,type:"flat",properties:this.style.getFlatLight()}),a}setLight(a,t={}){return console.log("The `map.setLight` function is deprecated, prefer using `map.setLights` with `flat` light type instead."),this.setLights([{id:"flat",type:"flat",properties:a}])}getLight(){return console.log("The `map.getLight` function is deprecated, prefer using `map.getLights` instead."),this.style.getFlatLight()}setTerrain(a){return this._lazyInitEmptyStyle(),!a&&this.transform.projection.requiresDraping?this.style.setTerrainForDraping():this.style.setTerrain(a),this._averageElevationLastSampledAt=-1/0,this._update(!0)}getTerrain(){return this.style?this.style.getTerrain():null}setFog(a){return this._lazyInitEmptyStyle(),this.style.setFog(a),this._update(!0)}getFog(){return this.style?this.style.getFog():null}setSnow(a){return this._lazyInitEmptyStyle(),this.style.setSnow(a),this._update(!0)}getSnow(){return this.style?this.style.getSnow():null}setRain(a){return this._lazyInitEmptyStyle(),this.style.setRain(a),this._update(!0)}getRain(){return this.style?this.style.getRain():null}setColorTheme(a){return this._lazyInitEmptyStyle(),this.style.setColorTheme(a),this._update(!0)}setImportColorTheme(a,t){return this._lazyInitEmptyStyle(),this.style.setImportColorTheme(a,t),this._update(!0)}setCamera(a){return this.style.setCamera(a),this._triggerCameraUpdate(a)}getNearClipOffset(){return this.transform.nearClipOffset}setNearClipOffset(a){const t=this.transform.nearClipOffset!==a;return this.transform.nearClipOffset=a,this._update(t)}_triggerCameraUpdate(a){return this._update(this.transform.setOrthographicProjectionAtLowPitch(a["camera-projection"]==="orthographic"))}getCamera(){return this.style.camera}_queryFogOpacity(a){return this.style&&this.style.fog?this.style.fog.getOpacityAtLatLng(h.aX.convert(a),this.transform):0}setFeatureState(a,t){return a.source&&!this._isValidId(a.source)?this:(this.style.setFeatureState(a,t),this._update())}removeFeatureState(a,t){return a.source&&!this._isValidId(a.source)?this:(this.style.removeFeatureState(a,t),this._update())}getFeatureState(a){return a.source&&!this._isValidId(a.source)?null:this.style.getFeatureState(a)}_selectIndoorFloor(a){this.style.indoorManager.selectFloor(a)}_setIndoorActiveFloorsVisibility(a){this.style.indoorManager.setActiveFloorsVisibility(a)}getIndoorTileOptions(a,t){return this.style&&this.style.isIndoorEnabled()?this.style.indoorManager.getIndoorTileOptions(a,t):null}_updateContainerDimensions(){if(!this._container)return;const a=this._container.getBoundingClientRect().width||400,t=this._container.getBoundingClientRect().height||300;let o,c,d,m=this._container;for(;m&&(!c||!d);){const _=window.getComputedStyle(m).transform;_&&_!=="none"&&(o=_.match(mg)[1].split(", "),o[0]&&o[0]!=="0"&&o[0]!=="1"&&(c=o[0]),o[3]&&o[3]!=="0"&&o[3]!=="1"&&(d=o[3])),m=m.parentElement}this._containerWidth=c?Math.abs(a/c):a,this._containerHeight=d?Math.abs(t/d):t}_detectMissingCSS(){window.getComputedStyle(this._missingCSSCanary).getPropertyValue("background-color")!=="rgb(250, 128, 114)"&&h.w("This page appears to be missing CSS declarations for Mapbox GL JS, which may cause the map to display incorrectly. Please ensure your page includes mapbox-gl.css, as described in https://www.mapbox.com/mapbox-gl-js/api/.")}_setupContainer(){const a=this._container;a.classList.add("mapboxgl-map"),(this._missingCSSCanary=Ot("div","mapboxgl-canary",a)).style.visibility="hidden",this._detectMissingCSS();const t=this._canvasContainer=Ot("div","mapboxgl-canvas-container",a);this._canvas=Ot("canvas","mapboxgl-canvas",t),this._interactive&&(t.classList.add("mapboxgl-interactive"),this._canvas.setAttribute("tabindex","0")),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region"),this._updateContainerDimensions(),this._resizeCanvas(this._containerWidth,this._containerHeight);const o=this._controlContainer=Ot("div","mapboxgl-control-container",a),c=this._controlPositions={};["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"].forEach(d=>{c[d]=Ot("div",`mapboxgl-ctrl-${d}`,o)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(a,t){const o=h.o.devicePixelRatio||1;this._canvas.width=o*Math.ceil(a),this._canvas.height=o*Math.ceil(t),this._canvas.style.width=`${a}px`,this._canvas.style.height=`${t}px`}_addMarker(a){this._markers.push(a)}_removeMarker(a){const t=this._markers.indexOf(a);t!==-1&&this._markers.splice(t,1)}_addPopup(a){this._popups.push(a)}_removePopup(a){const t=this._popups.indexOf(a);t!==-1&&this._popups.splice(t,1)}_setupPainter(){const a=Object.assign({},ms.supported.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),t=this._canvas.getContext("webgl2",a);t?(qo(t,!0),this.painter=new gm(t,this._contextCreateOptions,this.transform,this._scaleFactor,this._worldview),this.on("data",o=>{if(o.dataType==="source"){const c=this.transform.elevation?this.transform.elevation._source():null;c&&o.sourceCacheId===c.id&&this.style&&this.style._setLabelPlacementStale(),this.painter.setTileLoadedFlag(!0)}}),h.k.testSupport(t)):this.fire(new h.y(new Error("Failed to initialize WebGL")))}_contextLost(a){a.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.style&&this.style.handleContextLost(),this.fire(new h.z("webglcontextlost",{originalEvent:a}))}_contextRestored(a){this._setupPainter(),this.painter.resize(Math.ceil(this._containerWidth),Math.ceil(this._containerHeight)),this._updateTerrain(),this.style&&(this.style.clearLayers(),this.style.imageManager.destroyAtlasTextures(),this.style.imageManager.imageAtlasCache.destroyTextures(),this.style.reloadModels(),this.style.clearSources()),this._update(),this.fire(new h.z("webglcontextrestored",{originalEvent:a}))}_onMapScroll(a){if(a.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}idle(){return!this.isMoving()&&this.loaded()}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}frameReady(){return this.loaded()&&!this._placementDirty}_update(a){return this.style?(this._styleDirty=this._styleDirty||a,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(a){return this._update(),this._renderTaskQueue.add(a)}_cancelRenderFrame(a){this._renderTaskQueue.remove(a)}_requestDomTask(a){!this.loaded()||this.loaded()&&!this.isMoving()?a():this._domRenderTaskQueue.add(a)}_render(a){let t;this.fire(new h.z("renderstart")),++this._frameId;const o=this.painter.context.extTimerQuery,c=h.o.now(),d=this.painter.context.gl;if(this.listens("gpu-timing-frame")&&(t=d.createQuery(),d.beginQuery(o.TIME_ELAPSED_EXT,t)),this.painter.context.setDirty(),this.painter.setBaseState(),(this.isMoving()||this.isRotating()||this.isZooming())&&(this._interactionRange[0]=Math.min(this._interactionRange[0],performance.now()),this._interactionRange[1]=Math.max(this._interactionRange[1],performance.now())),this._renderTaskQueue.run(a),this._domRenderTaskQueue.run(a),this._removed)return;this._updateProjectionTransition();const m=this._isInitialLoad?0:this._fadeDuration;if(this.style&&this._styleDirty){this._styleDirty=!1;const v=this.transform.zoom,T=this.transform.pitch,I=h.o.now(),P=new h.ab(v,{now:I,fadeDuration:m,pitch:T,transition:this.style.transition,worldview:this._worldview});this.style.update(P)}this.style&&this.style.hasFogTransition()&&(this.style._markersNeedUpdate=!0,this._sourcesDirty=!0);let _=!1;if(this.style&&this._sourcesDirty?(this._sourcesDirty=!1,this.painter._updateFog(this.style),this._updateTerrain(),_=this._updateAverageElevation(c),this.style.updateSources(this.transform),this.style.updateImageProviders(),this.isMoving()||this._forceMarkerAndPopupUpdate()):_=this._updateAverageElevation(c),this.style&&(this._placementDirty=this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,m,this._crossSourceCollisions,this.painter.replacementSource)),this.style&&this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showParseStatus:this.showParseStatus,wireframe:{terrain:this.showTerrainWireframe,layers2D:this.showLayers2DWireframe,layers3D:this.showLayers3DWireframe},showOverdrawInspector:this._showOverdrawInspector,showQueryGeometry:!!this._showQueryGeometry,showTileAABBs:this.showTileAABBs,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:m,isInitialLoad:this._isInitialLoad,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer"),gpuTimingDeferredRender:!!this.listens("gpu-timing-deferred-render"),speedIndexTiming:this.speedIndexTiming}),this.fire(new h.z("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,ji.mark(sn.load),this.fire(new h.z("load"))),this.style&&this.style.hasTransitions()&&(this._styleDirty=!0),this.style&&(this.style.snow||this.style.rain)&&(this._styleDirty=!0),this.style&&this.style.imageManager.hasPatternsInFlight()&&(this._styleDirty=!0),this.style&&!this.style.modelManager.isLoaded()&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),t){const v=h.o.now()-c;d.endQuery(o.TIME_ELAPSED_EXT),setTimeout(()=>{const T=d.getQueryParameter(t,d.QUERY_RESULT)/1e6;d.deleteQuery(t),this.fire(new h.z("gpu-timing-frame",{cpuTime:v,gpuTime:T}))},50)}if(this.listens("gpu-timing-layer")){const v=this.painter.collectGpuTimers();setTimeout(()=>{const T=this.painter.queryGpuTimers(v);this.fire(new h.z("gpu-timing-layer",{layerTimes:T}))},50)}if(this.listens("gpu-timing-deferred-render")){const v=this.painter.collectDeferredRenderGpuQueries();setTimeout(()=>{const T=this.painter.queryGpuTimeDeferredRender(v);this.fire(new h.z("gpu-timing-deferred-render",{gpuTime:T}))},50)}const y=this._sourcesDirty||this._styleDirty||this._placementDirty||_;if(y||this._repaint)this.triggerRepaint();else{const v=this.idle();if(v&&(_=this._updateAverageElevation(c,!0)),_)this.triggerRepaint();else{if(this._triggerFrame(!1),v&&(this.fire(new h.z("idle")),this._isInitialLoad=!1,this.speedIndexTiming)){const T=this._calculateSpeedIndex();this.fire(new h.z("speedindexcompleted",{speedIndex:T})),this.speedIndexTiming=!1}v&&this.style&&this.style.handleIdle()}}!this._loaded||this._fullyLoaded||y||(this._fullyLoaded=!0,ji.mark(sn.fullLoad),this._performanceMetricsCollection&&ja(this._requestManager._customAccessToken,{width:this.painter.width,height:this.painter.height,interactionRange:this._interactionRange,visibilityHidden:this._visibilityHidden,terrainEnabled:!!this.painter.style.getTerrain(),fogEnabled:!!this.painter.style.getFog(),projection:this.getProjection().name,zoom:this.transform.zoom,renderer:this.painter.context.renderer,vendor:this.painter.context.vendor}),this._authenticate())}_forceMarkerAndPopupUpdate(a){for(const t of this._markers)a&&!this.getRenderWorldCopies()&&(t._lngLat=t._lngLat.wrap()),t._update();for(const t of this._popups)!a||this.getRenderWorldCopies()||t._trackPointer||(t._lngLat=t._lngLat.wrap()),t._update()}_updateAverageElevation(a,t=!1){const o=d=>(this.transform.averageElevation=d,this._update(!1),!0);if(!this.painter.averageElevationNeedsEasing())return this.transform.averageElevation!==0&&o(0);const c=this.transform.elevation&&this.transform.elevation.exaggeration()!==this._averageElevationExaggeration;if(c||(t||a-this._averageElevationLastSampledAt>500)&&!this._averageElevation.isEasing(a)){const d=this.transform.averageElevation;let m=this.transform.sampleAverageElevation();this.transform.elevation!=null&&(this._averageElevationExaggeration=this.transform.elevation.exaggeration()),isNaN(m)?m=0:this._averageElevationLastSampledAt=a;const _=Math.abs(d-m);if(_>1){if(this._isInitialLoad||c)return this._averageElevation.jumpTo(m),o(m);this._averageElevation.easeTo(m,a,300)}else if(_>1e-4)return this._averageElevation.jumpTo(m),o(m)}return!!this._averageElevation.isEasing(a)&&o(this._averageElevation.getValue(a))}_isTokenExpired(){return this._tokenExpiration!=null&&Date.now()>this._tokenExpiration}_revokeAuth(){const a=this.painter.context.gl;qo(a,!1),this._logoControl instanceof Tm&&this._logoControl._updateLogo(),a&&a.clear(a.DEPTH_BUFFER_BIT|a.COLOR_BUFFER_BIT|a.STENCIL_BUFFER_BIT),this._silenceAuthErrors||this.fire(new h.y(new Error("A valid Mapbox access token is required to use Mapbox GL JS. To create an account or a new access token, visit https://account.mapbox.com/")))}_authenticate(){Ga(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,a=>{a&&(a.message!==er&&a.status!==401||this._revokeAuth())}),this._isTokenExpired()&&this._revokeAuth(),kr(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,()=>{})}_postStyleLoadEvent(){this.style.globalId&&Pi(this._requestManager._customAccessToken,{map:this,style:this.style.globalId,importedStyles:this.style.getImportGlobalIds()})}_postStyleWithAppearanceEvent(){this.style.globalId&&this.style.hasAppearances()&&Ua(this._requestManager._customAccessToken)}_postAddingAppearancesToStyleEvent(){go(this._requestManager._customAccessToken)}_updateTerrain(){const a=this._isDragging();this.painter.updateTerrain(this.style,a)}_calculateSpeedIndex(){const a=this.painter.canvasCopy(),t=this.painter.getCanvasCopiesAndTimestamps();t.timeStamps.push(performance.now());const o=this.painter.context.gl,c=o.createFramebuffer();function d(m){o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,o.TEXTURE_2D,m,0);const _=new Uint8Array(o.drawingBufferWidth*o.drawingBufferHeight*4);return o.readPixels(0,0,o.drawingBufferWidth,o.drawingBufferHeight,o.RGBA,o.UNSIGNED_BYTE,_),_}return o.bindFramebuffer(o.FRAMEBUFFER,c),this._canvasPixelComparison(d(a),t.canvasCopies.map(d),t.timeStamps)}_canvasPixelComparison(a,t,o){let c=o[1]-o[0];const d=a.length/4;for(let m=0;m<t.length;m++){const _=t[m];let y=0;for(let v=0;v<_.length;v+=4)_[v]===a[v]&&_[v+1]===a[v+1]&&_[v+2]===a[v+2]&&_[v+3]===a[v+3]&&(y+=1);c+=(o[m+2]-o[m+1])*(1-y/d)}return c}remove(){if(this._removed)return;this._hash&&this._hash.remove();for(const t of this._controls)t.onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this._domRenderTaskQueue.clear(),this.style&&this.style.destroy(),this.painter.destroy(),this.handlers&&this.handlers.destroy(),this.handlers=void 0,this.setStyle(null),window.removeEventListener("resize",this._onWindowResize,!1),window.removeEventListener("orientationchange",this._onWindowResize,!1),window.removeEventListener(this._fullscreenchangeEvent,this._onWindowResize,!1),window.removeEventListener("online",this._onWindowOnline,!1),window.removeEventListener("visibilitychange",this._onVisibilityChange,!1);const a=this.painter.context.gl.getExtension("WEBGL_lose_context");a&&a.loseContext(),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvasContainer.remove(),this._controlContainer.remove(),this._missingCSSCanary.remove(),this._canvas=void 0,this._canvasContainer=void 0,this._controlContainer=void 0,this._missingCSSCanary=void 0,this._container.classList.remove("mapboxgl-map"),this._container.removeEventListener("scroll",this._onMapScroll,!1),ea.delete(this.painter.context.gl),Qs.remove(),Xi.remove(),this._removed=!0,this.fire(new h.z("remove"))}triggerRepaint(){this._triggerFrame(!0)}_triggerFrame(a){this._renderNextFrame=this._renderNextFrame||a,this.style&&!this._frame&&(this._frame=h.o.frame(t=>{const o=!!this._renderNextFrame;this._frame=null,this._renderNextFrame=null,o&&this._render(t)}))}_preloadTiles(a){const t=this.style?this.style.getSourceCaches():[];return h.ao(t,(o,c)=>o._preloadTiles(a,c),()=>{this.triggerRepaint()}),this}_onWindowOnline(){this._update()}_onWindowResize(a){this._trackResize&&this.resize({originalEvent:a})._update()}_onVisibilityChange(){document.visibilityState==="hidden"&&this._visibilityHidden++}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(a){this._showTileBoundaries!==a&&(this._showTileBoundaries=a,this._update())}get showParseStatus(){return!!this._showParseStatus}set showParseStatus(a){this._showParseStatus!==a&&(this._showParseStatus=a,this._update())}get showTerrainWireframe(){return!!this._showTerrainWireframe}set showTerrainWireframe(a){this._showTerrainWireframe!==a&&(this._showTerrainWireframe=a,this._update())}get showLayers2DWireframe(){return!!this._showLayers2DWireframe}set showLayers2DWireframe(a){this._showLayers2DWireframe!==a&&(this._showLayers2DWireframe=a,this._update())}get showLayers3DWireframe(){return!!this._showLayers3DWireframe}set showLayers3DWireframe(a){this._showLayers3DWireframe!==a&&(this._showLayers3DWireframe=a,this._update())}get showElevationIdDebug(){return!!this.painter&&this.painter._debugParams.showElevationIdDebug}set showElevationIdDebug(a){this.painter&&this.painter._debugParams.showElevationIdDebug!==a&&(this.painter._debugParams.showElevationIdDebug=a,this.style&&a?this.style._reloadSources():this._update())}get speedIndexTiming(){return!!this._speedIndexTiming}set speedIndexTiming(a){this._speedIndexTiming!==a&&(this._speedIndexTiming=a,this._update())}get showPadding(){return!!this._showPadding}set showPadding(a){this._showPadding!==a&&(this._showPadding=a,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(a){this._showCollisionBoxes!==a&&(this._showCollisionBoxes=a,this.style&&a?this.style._reloadSources():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(a){this._showOverdrawInspector!==a&&(this._showOverdrawInspector=a,this._update())}get repaint(){return!!this._repaint}set repaint(a){this._repaint!==a&&(this._repaint=a,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(a){this._vertices=a,this._update()}get showTileAABBs(){return!!this._showTileAABBs}set showTileAABBs(a){this._showTileAABBs!==a&&(this._showTileAABBs=a,a&&this._update())}_setCacheLimits(a,t){h.f1(a,t)}get version(){return U}},NavigationControl:class{constructor(a={}){this.options=Object.assign({},_g,a),this._container=Ot("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",t=>t.preventDefault()),this.options.showZoom&&(h.b0(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("mapboxgl-ctrl-zoom-in",t=>{this._map&&this._map.zoomIn({},{originalEvent:t})}),Ot("span","mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("mapboxgl-ctrl-zoom-out",t=>{this._map&&this._map.zoomOut({},{originalEvent:t})}),Ot("span","mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(h.b0(["_rotateCompassArrow"],this),this._compass=this._createButton("mapboxgl-ctrl-compass",t=>{const o=this._map;o&&(this.options.visualizePitch?o.resetNorthPitch({},{originalEvent:t}):o.resetNorth({},{originalEvent:t}))}),this._compassIcon=Ot("span","mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){const a=this._map;if(!a)return;const t=a.getZoom(),o=t===a.getMaxZoom(),c=t===a.getMinZoom();this._zoomInButton.disabled=o,this._zoomOutButton.disabled=c,this._zoomInButton.setAttribute("aria-disabled",o.toString()),this._zoomOutButton.setAttribute("aria-disabled",c.toString())}_rotateCompassArrow(){const a=this._map;if(!a)return;const t=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(a.transform.pitch*(Math.PI/180)
3288),.5)}) rotateX(${a.transform.pitch}deg) rotateZ(${a.transform.angle*(180/Math.PI)}deg)`:`rotate(${a.transform.angle*(180/Math.PI)}deg)`;a._requestDomTask(()=>{this._compassIcon&&(this._compassIcon.style.transform=t)})}onAdd(a){return this._map=a,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),a.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&a.on("pitch",this._rotateCompassArrow),a.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new gg(a,this._compass,this.options.visualizePitch)),this._container}onRemove(){const a=this._map;a&&(this._container.remove(),this.options.showZoom&&a.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&a.off("pitch",this._rotateCompassArrow),a.off("rotate",this._rotateCompassArrow),this._handler&&this._handler.off(),this._handler=void 0),this._map=void 0)}_createButton(a,t){const o=Ot("button",a,this._container);return o.type="button",o.addEventListener("click",t),o}_setButtonTitle(a,t){if(!this._map)return;const o=this._map._getUIString(`NavigationControl.${t}`);a.setAttribute("aria-label",o),a.firstElementChild&&a.firstElementChild.setAttribute("title",o)}},GeolocateControl:class extends h.E{constructor(a={}){super();const t=navigator.geolocation;this.options=Object.assign({geolocation:t},of,a),h.b0(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker","_updateMarkerRotation","_onDeviceOrientation"],this),this._updateMarkerRotationThrottled=oh(this._updateMarkerRotation,20),this._numberOfWatches=0}onAdd(a){return this._map=a,this._container=Ot("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkGeolocationSupport(this._setupUI),this._container}onRemove(){this._clearRequestTimeout(),this._geolocationWatchID!==void 0&&(this.options.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),this._container.remove(),this._map.off("zoom",this._onZoom),this._map=void 0,this._numberOfWatches=0,this._noTimeout=!1}_checkGeolocationSupport(a){const t=(o=!!this.options.geolocation)=>{this._supportsGeolocation=o,a(o)};this._supportsGeolocation!==void 0?a(this._supportsGeolocation):navigator.permissions!==void 0?navigator.permissions.query({name:"geolocation"}).then(o=>t(o.state!=="denied")).catch(()=>t()):t()}_isOutOfMapMaxBounds(a){const t=this._map.getMaxBounds(),o=a.coords;return!!t&&(o.longitude<t.getWest()||o.longitude>t.getEast()||o.latitude<t.getSouth()||o.latitude>t.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting")}}_onSuccess(a){if(this._map){if(this._clearRequestTimeout(),this._isOutOfMapMaxBounds(a))return this._setErrorState(),this.fire(new h.z("outofmaxbounds",a)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=a,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this.options.followUserLocation?(this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active")):(this._watchState="BACKGROUND",this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"));break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background")}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(a),this.options.followUserLocation&&(!this.options.trackUserLocation||this._watchState==="ACTIVE_LOCK")&&this._updateCamera(a),this.options.showUserLocation&&this._userLocationDotMarker.removeClassName("mapboxgl-user-location-dot-stale"),this.fire(new h.z("geolocate",Object.assign({coords:a.coords,timestamp:a.timestamp},a.toJSON?{toJSON:a.toJSON.bind(a)}:{}))),this._finish()}}_updateCamera(a){const t=new h.aX(a.coords.longitude,a.coords.latitude),o=a.coords.accuracy,c=this._map.getBearing(),d=Object.assign({bearing:c},this.options.fitBoundsOptions);this._map.fitBounds(t.toBounds(o),d,{geolocateSource:!0})}_updateMarker(a){if(a){const t=new h.aX(a.coords.longitude,a.coords.latitude);this._accuracyCircleMarker.setLngLat(t).addTo(this._map),this._userLocationDotMarker.setLngLat(t).addTo(this._map),this._accuracy=a.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){const a=this._map.transform,t=h.bY(1,a._center.lat)*a.worldSize,o=Math.ceil(2*this._accuracy*t);this._circleElement.style.width=`${o}px`,this._circleElement.style.height=`${o}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}_updateMarkerRotation(){this._userLocationDotMarker&&typeof this._heading=="number"?(this._userLocationDotMarker.setRotation(this._heading),this._userLocationDotMarker.addClassName("mapboxgl-user-location-show-heading")):(this._userLocationDotMarker.removeClassName("mapboxgl-user-location-show-heading"),this._userLocationDotMarker.setRotation(0))}_onError(a){if(this._map){if(this._clearRequestTimeout(),this.options.trackUserLocation)if(
3288a.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.setAttribute("aria-label",t),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",t),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(a.code===3&&this._noTimeout)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._userLocationDotMarker.addClassName("mapboxgl-user-location-dot-stale"),this.fire(new h.z("error",{code:a.code,message:a.message,PERMISSION_DENIED:a.PERMISSION_DENIED,POSITION_UNAVAILABLE:a.POSITION_UNAVAILABLE,TIMEOUT:a.TIMEOUT})),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_startRequestTimeout(){this._clearRequestTimeout();const a=this.options.positionOptions.timeout;a&&(this._requestTimeoutId=window.setTimeout(()=>{this._onError({code:3,message:"Geolocation request timed out"})},a))}_clearRequestTimeout(){this._requestTimeoutId!==void 0&&(clearTimeout(this._requestTimeoutId),this._requestTimeoutId=void 0)}_setupUI(a){if(this._map!==void 0){if(this._container.addEventListener("contextmenu",t=>t.preventDefault()),this._geolocateButton=Ot("button","mapboxgl-ctrl-geolocate",this._container),Ot("span","mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",a===!1){h.w("Geolocation support is not available so the GeolocateControl will be disabled.");const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.setAttribute("aria-label",t),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",t)}else{const t=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.setAttribute("aria-label",t),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",t)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=Ot("div","mapboxgl-user-location"),this._dotElement.appendChild(Ot("div","mapboxgl-user-location-dot")),this._dotElement.appendChild(Ot("div","mapboxgl-user-location-heading")),this._userLocationDotMarker=new jc({element:this._dotElement,rotationAlignment:"map",pitchAlignment:"map"}),this._circleElement=Ot("div","mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new jc({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.showButton||(this._container.style.display="none"),this.options.trackUserLocation&&this._map.on("movestart",t=>{t.geolocateSource||this._watchState!=="ACTIVE_LOCK"||t.originalEvent&&t.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this.fire(new h.z("trackuserlocationend")))})}}_onDeviceOrientation(a){this._userLocationDotMarker&&(a.webkitCompassHeading?this._heading=a.webkitCompassHeading:a.absolute===!0&&(this._heading=-1*a.alpha),this._updateMarkerRotationThrottled())}trigger(){if(!this._setup)return h.w("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new h.z("trackuserlocationstart"));break;
3288case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":this._numberOfWatches--,this._noTimeout=!1,this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this.fire(new h.z("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new h.z("trackuserlocationstart"))}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"BACKGROUND":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background");break;case"BACKGROUND_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error")}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let a;this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),this._numberOfWatches++,this._numberOfWatches>1?(a={maximumAge:6e5,timeout:0},this._noTimeout=!0):(a=this.options.positionOptions,this._noTimeout=!1),this._geolocationWatchID=this.options.geolocation.watchPosition(this._onSuccess,this._onError,a),this._startRequestTimeout(),this.options.showUserHeading&&this._addDeviceOrientationListener()}}else this.options.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._startRequestTimeout(),this._timeoutId=window.setTimeout(this._finish,1e4);return!0}setFollowUserLocation(a){return this.options.followUserLocation=a??of.followUserLocation,this.options.trackUserLocation&&this._watchState!=="OFF"&&(this.options.followUserLocation?this._watchState!=="BACKGROUND"&&this._watchState!=="BACKGROUND_ERROR"||(this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new h.z("trackuserlocationstart"))):this._watchState!=="ACTIVE_LOCK"&&this._watchState!=="ACTIVE_ERROR"||(this._watchState="BACKGROUND",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"),this.fire(new h.z("trackuserlocationend")))),this}_addDeviceOrientationListener(){const a=()=>{const t="ondeviceorientationabsolute"in window?"deviceorientationabsolute":"deviceorientation";window.addEventListener(t,this._onDeviceOrientation)};typeof DeviceOrientationEvent.requestPermission=="function"?DeviceOrientationEvent.requestPermission().then(t=>{t==="granted"&&a()}).catch(console.error):a()}_clearWatch(){this._clearRequestTimeout(),this.options.geolocation.clearWatch(this._geolocationWatchID),window.removeEventListener("deviceorientation",this._onDeviceOrientation),window.removeEventListener("deviceorientationabsolute",this._onDeviceOrientation),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","fal
3288se"),this.options.showUserLocation&&this._updateMarker(null)}},AttributionControl:wm,ScaleControl:class{constructor(a={}){this.options=Object.assign({},yg,a),h.b0(["_update","_setScale","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_update(){const a=this.options.maxWidth||100,t=this._map,o=t._containerHeight/2,c=t._containerWidth/2-a/2,d=t.unproject([c,o]),m=t.unproject([c+a,o]),_=d.distanceTo(m);if(this.options.unit==="imperial"){const y=3.2808*_;y>5280?this._setScale(a,y/5280,"mile"):this._setScale(a,y,"foot")}else this.options.unit==="nautical"?this._setScale(a,_/1852,"nautical-mile"):_>=1e3?this._setScale(a,_/1e3,"kilometer"):this._setScale(a,_,"meter")}_setScale(a,t,o){this._map._requestDomTask(()=>{const c=(function(m){const _=Math.pow(10,`${Math.floor(m)}`.length-1);let y=m/_;return y=y>=10?10:y>=5?5:y>=3?3:y>=2?2:y>=1?1:(function(v){const T=Math.pow(10,Math.ceil(-Math.log(v)/Math.LN10));return Math.round(v*T)/T})(y),_*y})(t),d=c/t;this._container.innerHTML=o!=="nautical-mile"?new Intl.NumberFormat(this._language,{style:"unit",unitDisplay:"short",unit:o}).format(c):`${c} ${Mm[o]}`,this._container.style.width=a*d+"px"})}onAdd(a){return this._map=a,this._language=a.getLanguage(),this._container=Ot("div","mapboxgl-ctrl mapboxgl-ctrl-scale",a.getContainer()),this._container.dir="auto",this._map.on("move",this._update),this._update(),this._container}onRemove(){this._container.remove(),this._map.off("move",this._update),this._map=void 0}_setLanguage(a){this._language=a,this._update()}setUnit(a){this.options.unit=a,this._update()}},FullscreenControl:class{constructor(a={}){this._fullscreen=!1,a&&a.container&&(a.container instanceof HTMLElement?this._container=a.container:h.w("Full screen control 'container' must be a DOM element.")),h.b0(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onwebkitfullscreenchange"in document&&(this._fullscreenchange="webkitfullscreenchange")}onAdd(a){return this._map=a,this._container||(this._container=this._map.getContainer()),this._controlContainer=Ot("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",h.w("This device does not support fullscreen mode.")),this._controlContainer}onRemove(){this._controlContainer.remove(),this._map=null,document.removeEventListener(this._fullscreenchange,this._changeIcon)}_checkFullscreenSupport(){return!(!document.fullscreenEnabled&&!document.webkitFullscreenEnabled)}_setupUI(){const a=this._fullscreenButton=Ot("button","mapboxgl-ctrl-fullscreen",this._controlContainer);Ot("span","mapboxgl-ctrl-icon",a).setAttribute("aria-hidden","true"),a.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){const a=this._getTitle();this._fullscreenButton.setAttribute("aria-label",a),this._fullscreenButton.firstElementChild&&this._fullscreenButton.firstElementChild.setAttribute("title",a)}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_changeIcon(){(document.fullscreenElement||document.webkitFullscreenElement)===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"),this._updateTitle())}_onClickFullscreen(){this._isFullscreen()?document.exitFullscreen?document.exitFullscreen():document.webkitCancelFullScreen&&document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()}},IndoorControl:class{constructor(){h.b0(["_onIndoorUpdate","_onStyleData","_scrollUp","_scrollDown","_toggleIndoor"],this),this._visibleFloorStart=0,this._lastSelectedFloorId=null}onAdd(a){return this._map=a,this._container=Ot("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.style.display="none",this._map.on("styledata",this._onStyleData),this._updateConnection(),this._container}_onStyleData(){this._updateConnection()}_updateConnection(){if(this._map&&this._map.style&&this._map.style.indoorManager){const a=this._map.style.indoorManager;a.off("selector-update",this._onIndoorUpdate),a.on("selector-update",this._onIndoorUpdate),this._onIndoorUpdate(a.getControlState())}}_createButton(a,t){const o=Ot("button",a,this._container);return o.type="button",o.addEventListener("click",t),o}_setButtonTitle(a,t){a.setAttribute("aria-label",t),a.textContent=t}onRemove(){this._container&&this._container.remove(),this._map&&(this._map.off("styledata",this._onStyleData),this._map.style&&this._map.style.indoorManager.off("selector-update",this._onIndoorUpdate),this._map=null)}getDefaultPosition(){return"top-right"}_onIndoorUpdate(a){if(!a||!a.floors||a.floors.length===0)return this._model=a,void(this._container.style.display="none");const t=this._model;this._model=a,this._container.style.display="inline-block";const o=!t||t.floors.length!==a.floors.length||t.floors.some((c,d)=>c.id!==a.floors[d].id);if(o&&(this._visibleFloorStart=0,this._lastSelectedFloorId=null),a.selectedFloorId){if(a.selectedFloorId!==this._lastSelectedFloorId||o){const c=a.floors.findIndex(d=>d.id===a.selectedFloorId);if(c!==-1){const d=a.floors.length;let m,_;d<=5?(m=0,_=d-1):this._visibleFloorStart===0?(m=0,_=3):this._visibleFloorStart>=d-3?(m=d-3-1,_=d-1):(m=this._visibleFloorStart,_=this._visibleFloorStart+3-1),c<m?this._visibleFloorStart=c:c>_&&(this._visibleFloorStart=c-2)}}this._lastSelectedFloorId=a.selectedFloorId}this._render()}
vendor: 9,295 bytes, line 3288
3288_render(){if(!this._container||!this._model||!this._model.floors)return;this._container.innerHTML="";const a=this._createButton("mapboxgl-ctrl-indoor-toggle",this._toggleIndoor);Ot("span","mapboxgl-ctrl-icon",a).setAttribute("aria-hidden","true"),this._model.activeFloorsVisible||a.classList.add("mapboxgl-ctrl-level-button-selected"),this._container.appendChild(a);const t=this._model.floors,o=t.length;if(o<=5)return void t.forEach(_=>this._createFloorButton(_));const c=this._visibleFloorStart===0,d=this._visibleFloorStart>=o-3;if(c)this._createFloorButton(t[0]);else{const _=this._createButton("mapboxgl-ctrl-arrow-up",this._scrollUp);Ot("span","mapboxgl-ctrl-icon",_).setAttribute("aria-hidden","true"),this._container.appendChild(_)}let m=[];if(m=c?t.slice(1,4):d?t.slice(this._visibleFloorStart-1,this._visibleFloorStart+3-1):t.slice(this._visibleFloorStart,this._visibleFloorStart+3),m.forEach(_=>this._createFloorButton(_)),d)this._createFloorButton(t[o-1]);else{const _=this._createButton("mapboxgl-ctrl-arrow-down",this._scrollDown);Ot("span","mapboxgl-ctrl-icon",_).setAttribute("aria-hidden","true"),this._container.appendChild(_)}}_createFloorButton(a){const t=this._createButton("mapboxgl-ctrl-level-button",()=>{const m=a.id;this._model&&this._model.selectedFloorId===m&&this._model.activeFloorsVisible||this._map&&(this._model&&!this._model.activeFloorsVisible&&this._map.style&&this._map.style.indoorManager&&this._map.style.indoorManager.setActiveFloorsVisibility(!0),this._map._selectIndoorFloor(m))}),o=(a.name||"").trim(),c=a.zIndex.toString(),d=o?Array.from(o).slice(0,3).join(""):c;this._setButtonTitle(t,d),this._model&&this._model.activeFloorsVisible&&a.id===this._model.selectedFloorId&&t.classList.add("mapboxgl-ctrl-level-button-selected"),this._container&&this._container.appendChild(t)}_toggleIndoor(){this._map&&this._map.style&&this._map.style.indoorManager&&this._model&&this._model.activeFloorsVisible&&this._map.style.indoorManager.setActiveFloorsVisibility(!1)}_scrollUp(){if(this._visibleFloorStart>0){this._visibleFloorStart--,this._visibleFloorStart===1&&(this._visibleFloorStart=0);const a=this._model&&this._model.floors||[];if(a.length>3){const t=a.length-3;this._visibleFloorStart===t-1&&(this._visibleFloorStart=t-2)}this._render()}}_scrollDown(){if(this._model&&this._model.floors){const a=this._model.floors.length-3;this._visibleFloorStart<a&&(this._visibleFloorStart++,this._visibleFloorStart===1&&(this._visibleFloorStart=2),this._visibleFloorStart===a-1&&(this._visibleFloorStart=a),this._visibleFloorStart>a&&(this._visibleFloorStart=a),this._render())}}},Popup:class extends h.E{constructor(a){super(),this.options=Object.assign(Object.create(sf),a),this._altitude=this.options.altitude,h.b0(["_update","_onClose","remove","_onMouseEvent"],this),this._classList=new Set(a&&a.className?a.className.trim().split(Cm):[])}addTo(a){return this._map&&this.remove(),this._map=a,this.options.closeOnClick&&a.on("preclick",this._onClose),this.options.closeOnMove&&a.on("move",this._onClose),a.on("remove",this.remove),this._update(),a._addPopup(this),this._focusFirstElement(),this._trackPointer?(a.on("mousemove",this._onMouseEvent),a.on("mouseup",this._onMouseEvent),a._canvasContainer.classList.add("mapboxgl-track-pointer")):a.on("move",this._update),this.fire(new h.z("open")),this}isOpen(){return!!this._map}remove(){this._content&&this._content.remove(),this._container&&(this._container.remove(),this._container=void 0);const a=this._map;return a&&(a.off("move",this._update),a.off("move",this._onClose),a.off("preclick",this._onClose),a.off("click",this._onClose),a.off("remove",this.remove),a.off("mousemove",this._onMouseEvent),a.off("mouseup",this._onMouseEvent),a.off("drag",this._onMouseEvent),a._canvasContainer&&a._canvasContainer.classList.remove("mapboxgl-track-pointer"),a._removePopup(this),this._map=void 0),this.fire(new h.z("close")),this}getLngLat(){return this._lngLat}setLngLat(a){this._lngLat=h.aX.convert(a),this._pos=null,this._trackPointer=!1,this._update();const t=this._map;return t&&(t.on("move",this._update),t.off("mousemove",this._onMouseEvent),t._canvasContainer.classList.remove("mapboxgl-track-pointer")),this}getAltitude(){return this._altitude}setAltitude(a){return this._altitude=a,this._update(),this}trackPointer(){this._trackPointer=!0,this._pos=null,this._update();const a=this._map;return a&&(a.off("move",this._update),a.on("mousemove",this._onMouseEvent),a.on("drag",this._onMouseEvent),a._canvasContainer.classList.add("mapboxgl-track-pointer")),this}getElement(){return this._container}setText(a){return this.setDOMContent(document.createTextNode(a))}setHTML(a){const t=document.createDocumentFragment(),o=document.createElement("body");let c;for(o.innerHTML=a;c=o.firstChild,c;)t.appendChild(c);return this.setDOMContent(t)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(a){return this.options.maxWidth=a,this._update(),this}setDOMContent(a){let t=this._content;if(t)for(;t.hasChildNodes();)t.firstChild&&t.removeChild(t.firstChild);else t=this._content=Ot("div","mapboxgl-popup-content",this._container||void 0);if(t.appendChild(a),this.options.closeButton){const o=this._closeButton=Ot("button","mapboxgl-popup-close-button",t);o.type="button",o.setAttribute("aria-label","Close popup"),o.innerHTML='<span aria-hidden="true">×</span>',o.addEventListener("click",this._onClose)}return this._update(),this._focusFirstElement(),this}addClassName(a){return this._classList.add(a),this._updateClassList(),this}removeClassName(a){return this._classList.delete(a),this._updateClassList(),this}setOffset(a){return this.options.offset=a,this._update(),this}toggleClassName(a){let t;return this._classList.delete(a)?t=!1:(this._classList.add(a),t=!0),this._updateClassList(),t}_onMouseEvent(a){this._update(a.point)}_getAnchor(a){if(this.options.anchor)return this.options.anchor;const t=this._map,o=this._container,c=this._pos;if(!t||!o||!c)return"bottom";const d=o.offsetWidth,m=o.offsetHeight,_=c.x<d/2,y=c.x>t.transform.width-d/2;if(c.y+a<m)return _?"top-left":y?"top-right":"top";if(c.y>t.transform.height-m){if(_)return"bottom-left";if(y)return"bottom-right"}return _?"left":y?"right":"bottom"}_updateClassList(){const a=this._container;if(!a)return;const t=[...this._classList];t.push("mapboxgl-popup"),this._anchor&&t.push(`mapboxgl-popup-anchor-${this._anchor}`),this._trackPointer&&t.push("mapboxgl-popup-track-pointer"),a.className=t.join(" ")}_update(a){const t=this._map,o=this._content;if(!t||!this._lngLat&&!this._trackPointer||!o)return;let c=this._container;if(c||(c=this._container=Ot("div","mapboxgl-popup",t.getContainer()),this._tip=Ot("div","mapboxgl-popup-tip",c),c.appendChild(o)),this.options.maxWidth&&c.style.maxWidth!==this.options.maxWidth&&(c.style.maxWidth=this.options.maxWidth),t.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=Oo(this._lngLat,this._pos,t.transform)),!this._trackPointer||a){const d=this._pos=this._trackPointer&&a instanceof h.P?a:t.project(this._lngLat,this._altitude),m=af(this.options.offset),_=this._anchor=this._getAnchor(m.y),y=af(this.options.offset,_),v=d.add(y).round();t._requestDomTask(()=>{this._container&&_&&(this._container.style.transform=`${rf[_]} translate(${v.x}px,${v.y}px)`)})}if(!this._marker&&t._showingGlobe()){const d=h.f2(t.transform,this._lngLat)?0:1;this._setOpacity(d)}this._updateClassList()}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const a=this._container.querySelector(wi);a&&a.focus()}_onClose(){this.remove()}_setOpacity(a){this._container&&(this._container.style.opacity=`${a}`),this._content&&(this._content.style.pointerEvents=a?"auto":"none")}},Marker:jc,Style:dn,LngLat:h.aX,LngLatBounds:h.aI,Point:h.P,MercatorCoordinate:h.ad,FreeCameraOptions:qh,Evented:h.E,config:h.g,prewarm:function(){rl().acquire(lu)},clearPrewarmedResources:function(){const a=Is;a&&(a.isPreloaded()&&a.numActive()===1?(a.release(lu),Is=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},get accessToken(){return h.g.ACCESS_TOKEN},set accessToken(a){h.g.ACCESS_TOKEN=a},get baseApiUrl(){return h.g.API_URL},set baseApiUrl(a){h.g.API_URL=a},get workerCount(){return Ts.workerCount},set workerCount(a){Ts.workerCount=a},get maxParallelImageRequests(){return h.g.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(a){h.g.MAX_PARALLEL_IMAGE_REQUESTS=a},clearStorage(a){h.fb(a)},get workerUrl(){return hn.workerUrl},set workerUrl(a){hn.workerUrl=a},get workerClass(){return hn.workerClass},set workerClass(a){hn.workerClass=a},get workerParams(){return hn.workerParams},set workerParams(a){hn.workerParams=a},get dracoUrl(){return h.fa()},set dracoUrl(a){h.g.DRACO_URL=h.o.resolveURL(a)},get meshoptUrl(){return h.f9()},set meshoptUrl(a){const t=h.o.resolveURL(a);h.g.MESHOPT_URL=t,h.g.MESHOPT_SIMD_URL=t},get buildingGenUrl(){return h.f8()},set buildingGenUrl(a){h.g.BUILDING_GEN_URL=h.o.resolveURL(a)},setNow:h.o.setNow,restoreNow:h.o.restoreNow}});var Eb=Xs;return Eb}))})(z_)),z_.exports}var Ib=qT();const ZT=$T(Ib),XT=GT({__proto__:null,default:ZT},[Ib]);export{XT as m};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.