PageSourceSearch

https://www.poolerkaratetsd.com/_astro/ContactMap.astro_astro_type_script_index_0_lang.DdKsP27Q.js

js poolerkaratetsd.com collected 2026-10-09 22:36:52 UTC 1,860,074 bytes, 3,338 lines download raw bytes

vendor: 19,460 bytes, line 1
1function BT(tn){return tn&&tn.__esModule&&Object.prototype.hasOwnProperty.call(tn,"default")?tn.default:tn}var Eg={exports:{}},kT=Eg.exports,K1;function NT(){return K1||(K1=1,(function(tn,Sg){(function(ha,da){tn.exports=da()})(kT,(function(){let ha,da,od;function gu(u,N){if(!ha)ha=N;else if(!da)da=N;else{const jr={};ha(void 0,jr),od=N(jr);const Gi="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 = {}; ("+ha+")(undefined, sharedChunk); ("+da+")(undefined, sharedChunk); self.onerror = null;";typeof window<"u"&&window&&window.URL&&window.URL.createObjectURL&&(od.workerUrl=window.URL.createObjectURL(new Blob([Gi],{type:"text/javascript"})))}}gu(["require","exports"],function(u,N){var jr=1e-6,Gi=typeof Float32Array<"u"?Float32Array:Array;function il(r,e){var i=e[0],o=e[1],a=e[2],c=e[3],h=i*c-a*o;return h?(r[0]=c*(h=1/h),r[1]=-o*h,r[2]=-a*h,r[3]=i*h,r):null}function No(){var r=new Gi(9);return Gi!=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 yu(r,e,i){var o=e[0],a=e[1],c=e[2],h=e[3],f=e[4],_=e[5],y=e[6],v=e[7],b=e[8],T=i[0],S=i[1],C=i[2],P=i[3],R=i[4],L=i[5],V=i[6],B=i[7],G=i[8];return r[0]=T*o+S*h+C*y,r[1]=T*a+S*f+C*v,r[2]=T*c+S*_+C*b,r[3]=P*o+R*h+L*y,r[4]=P*a+R*f+L*v,r[5]=P*c+R*_+L*b,r[6]=V*o+B*h+G*y,r[7]=V*a+B*f+G*v,r[8]=V*c+B*_+G*b,r}function rl(){var r=new Gi(16);return Gi!=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 ni(r){var e=new Gi(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 ki(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 bo(r,e){var i=e[0],o=e[1],a=e[2],c=e[3],h=e[4],f=e[5],_=e[6],y=e[7],v=e[8],b=e[9],T=e[10],S=e[11],C=e[12],P=e[13],R=e[14],L=e[15],V=i*f-o*h,B=i*_-a*h,G=i*y-c*h,H=o*_-a*f,Z=o*y-c*f,oe=a*y-c*_,X=v*P-b*C,ee=v*R-T*C,ie=v*L-S*C,ne=b*R-T*P,fe=b*L-S*P,ge=T*L-S*R,we=V*ge-B*fe+G*ne+H*ie-Z*ee+oe*X;return we?(r[0]=(f*ge-_*fe+y*ne)*(we=1/we),r[1]=(a*fe-o*ge-c*ne)*we,r[2]=(P*oe-R*Z+L*H)*we,r[3]=(T*Z-b*oe-S*H)*we,r[4]=(_*ie-h*ge-y*ee)*we,r[5]=(i*ge-a*ie+c*ee)*we,r[6]=(R*G-C*oe-L*B)*we,r[7]=(v*oe-T*G+S*B)*we,r[8]=(h*fe-f*ie+y*X)*we,r[9]=(o*ie-i*fe-c*X)*we,r[10]=(C*Z-P*G+L*V)*we,r[11]=(b*G-v*Z-S*V)*we,r[12]=(f*ee-h*ne-_*X)*we,r[13]=(i*ne-o*ee+a*X)*we,r[14]=(P*B-C*H-R*V)*we,r[15]=(v*H-b*B+T*V)*we,r):null}function Ri(r,e,i){var o=e[0],a=e[1],c=e[2],h=e[3],f=e[4],_=e[5],y=e[6],v=e[7],b=e[8],T=e[9],S=e[10],C=e[11],P=e[12],R=e[13],L=e[14],V=e[15],B=i[0],G=i[1],H=i[2],Z=i[3];return r[0]=B*o+G*f+H*b+Z*P,r[1]=B*a+G*_+H*T+Z*R,r[2]=B*c+G*y+H*S+Z*L,r[3]=B*h+G*v+H*C+Z*V,r[4]=(B=i[4])*o+(G=i[5])*f+(H=i[6])*b+(Z=i[7])*P,r[5]=B*a+G*_+H*T+Z*R,r[6]=B*c+G*y+H*S+Z*L,r[7]=B*h+G*v+H*C+Z*V,r[8]=(B=i[8])*o+(G=i[9])*f+(H=i[10])*b+(Z=i[11])*P,r[9]=B*a+G*_+H*T+Z*R,r[10]=B*c+G*y+H*S+Z*L,r[11]=B*h+G*v+H*C+Z*V,r[12]=(B=i[12])*o+(G=i[13])*f+(H=i[14])*b+(Z=i[15])*P,r[13]=B*a+G*_+H*T+Z*R,r[14]=B*c+G*y+H*S+Z*L,r[15]=B*h+G*v+H*C+Z*V,r}function wn(r,e,i){var o,a,c,h,f,_,y,v,b,T,S,C,P=i[0],R=i[1],L=i[2];return e===r?(r[12]=e[0]*P+e[4]*R+e[8]*L+e[12],r[13]=e[1]*P+e[5]*R+e[9]*L+e[13],r[14]=e[2]*P+e[6]*R+e[10]*L+e[14],r[15]=e[3]*P+e[7]*R+e[11]*L+e[15]):(a=e[1],c=e[2],h=e[3],f=e[4],_=e[5],y=e[6],v=e[7],b=e[8],T=e[9],S=e[10],C=e[11],r[0]=o=e[0],r[1]=a,r[2]=c,r[3]=h,r[4]=f,r[5]=_,r[6]=y,r[7]=v,r[8]=b,r[9]=T,r[10]=S,r[11]=C,r[12]=o*P+f*R+b*L+e[12],r[13]=a*P+_*R+T*L+e[13],r[14]=c*P+y*R+S*L+e[14],r[15]=h*P+v*R+C*L+e[15]),r}function Gr(r,e,i){var o=i[0],a=i[1],c=i[2];return r[0]=e[0]*o,r[1]=e[1]*o,r[2]=e[2]*o,r[3]=e[3]*o,r[4]=e[4]*a,r[5]=e[5]*a,r[6]=e[6]*a,r[7]=e[7]*a,r[8]=e[8]*c,r[9]=e[9]*c,r[10]=e[10]*c,r[11]=e[11]*c,r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15],r}function ts(r,e,i){var o=Math.sin(i),a=Math.cos(i),c=e[4],h=e[5],f=e[6],_=e[7],y=e[8],v=e[9],b=e[10],T=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]=c*a+y*o,r[5]=h*a+v*o,r[6]=f*a+b*o,r[7]=_*a+T*o,r[8]=y*a-c*o,r[9]=v*a-h*o,r[10]=b*a-f*o,r[11]=T*a-_*o,r}function wo(r,e,i){var o=Math.sin(i),a=Math.cos(i),c=e[0],h=e[1],f=e[2],_=e[3],y=e[8],v=e[9],b=e[10],T=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]=c*a-y*o,r[1]=h*a-v*o,r[2]=f*a-b*o,r[3]=_*a-T*o,r[8]=c*o+y*a,r[9]=h*o+v*a,r[10]=f*o+b*a,r[11]=_*o+T*a,r}function Tn(r,e,i){var o=Math.sin(i),a=Math.cos(i),c=e[0],h=e[1],f=e[2],_=e[3],y=e[4],v=e[5],b=e[6],T=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]=c*a+y*o,r[1]=h*a+v*o,r[2]=f*a+b*o,r[3]=_*a+T*o,r[4]=y*a-c*o,r[5]=v*a-h*o,r[6]=b*a-f*o,r[7]=T*a-_*o,r}function eo(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 fa(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 nl(r,e,i){var o,a,c,h=i[0],f=i[1],_=i[2],y=Math.sqrt(h*h+f*f+_*_);return y<jr?null:(h*=y=1/y,f*=y,_*=y,o=Math.sin(e),a=Math.cos(e),r[0]=h*h*(c=1-a)+a,r[1]=f*h*c+_*o,r[2]=_*h*c-f*o,r[3]=0,r[4]=h*f*c-_*o,r[5]=f*f*c+a,r[6]=_*f*c+h*o,r[7]=0,r[8]=h*_*c+f*o,r[9]=f*_*c-h*o,r[10]=_*_*c+a,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r)}function sc(r,e){var i=e[0],o=e[1],a=e[2],c=e[4],h=e[5],f=e[6],_=e[8],y=e[9],v=e[10];return r[0]=Math.sqrt(i*i+o*o+a*a),r[1]=Math.sqrt(c*c+h*h+f*f),r[2]=Math.sqrt(_*_+y*y+v*v),r}function pa(r,e){var i=e[0],o=e[1],a=e[2],c=e[3],h=i+i,f=o+o,_=a+a,y=i*h,v=o*h,b=o*f,T=a*h,S=a*f,C=a*_,P=c*h,R=c*f,L=c*_;return r[0]=1-b-C,r[1]=v+L,r[2]=T-R,r[3]=0,r[4]=v-L,r[5]=1-y-C,r[6]=S+P,r[7]=0,r[8]=T+R,r[9]=S-P,r[10]=1-y-b,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}var zs=Ri;function ti(){var r=new Gi(3);return Gi!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r}function ma(r){var e=new Gi(3);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e}function Bn(r){var e=r[0],i=r[1],o=r[2];return Math.sqrt(e*e+i*i+o*o)}function Cr(r,e,i){var o=new Gi(3);return o[0]=r,o[1]=e,o[2]=i,o}function Di(r,e,i,o){return r[0]=e,r[1]=i,r[2]=o,r}function gr(r,e,i){return r[0]=e[0]+i[0],r[1]=e[1]+i[1],r[2]=e[2]+i[2],r}function Vo(r,e,i){return r[0]=e[0]-i[0],r[1]=e[1]-i[1],r[2]=e[2]-i[2],r}function ol(r,e,i){return r[0]=e[0]*i[0],r[1]=e[1]*i[1],r[2]=e[2]*i[2],r}function Ls(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 Fs(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 mi(r,e,i){return r[0]=e[0]*i,r[1]=e[1]*i,r[2]=e[2]*i,r}function rn(r,e,i,o){return r[0]=e[0]+i[0]*o,r[1]=e[1]+i[1]*o,r[2]=e[2]+i[2]*o,r}function to(r,e){var i=e[0]-r[0],o=e[1]-r[1],a=e[2]-r[2];return Math.sqrt(i*i+o*o+a*a)}function sl(r,e){var i=e[0]-r[0],o=e[1]-r[1],a=e[2]-r[2];return i*i+o*o+a*a}function Os(r){var e=r[0],i=r[1],o=r[2];return e*e+i*i+o*o}function To(r,e){return r[0]=-e[0],r[1]=-e[1],r[2]=-e[2],r}function bi(r,e){var i=e[0],o=e[1],a=e[2],c=i*i+o*o+a*a;return c>0&&(c=1/Math.sqrt(c)),r[0]=e[0]*c,r[1]=e[1]*c,r[2]=e[2]*c,r}function Xi(r,e){return r[0]*e[0]+r[1]*e[1]+r[2]*e[2]}function hr(r,e,i){var o=e[0],a=e[1],c=e[2],h=i[0],f=i[1],_=i[2];return r[0]=a*_-c*f,r[1]=c*h-o*_,r[2]=o*f-a*h,r}function _a(r,e,i,o){var a=e[0],c=e[1],h=e[2];return r[0]=a+o*(i[0]-a),r[1]=c+o*(i[1]-c),r[2]=h+o*(i[2]-h),r}function Zi(r,e,i){var o=e[0],a=e[1],c=e[2],h=i[3]*o+i[7]*a+i[11]*c+i[15];return r[0]=(i[0]*o+i[4]*a+i[8]*c+i[12])/(h=h||1),r[1]=(i[1]*o+i[5]*a+i[9]*c+i[13])/h,r[2]=(i[2]*o+i[6]*a+i[10]*c+i[14])/h,r}function Bs(r,e,i){var o=i[0],a=i[1],c=i[2],h=i[3],f=e[0],_=e[1],y=e[2],v=a*y-c*_,b=c*f-o*y,T=o*_-a*f;return r[0]=f+h*(v+=v)+a*(T+=T)-c*(b+=b),r[1]=_+h*b+c*v-o*T,r[2]=y+h*T+o*b-a*v,r}function al(r){return r[0]=0,r[1]=0,r[2]=0,r}function is(r,e){return r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]}var or=Vo,ll=ol,rs=Bn;function xu(){var r=new Gi(4);return Gi!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0,r[3]=0),r}function ac(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 vu(r,e){var i=e[0],o=e[1],a=e[2],c=e[3],h=i*i+o*o+a*a+c*c;return h>0&&(h=1/Math.sqrt(h)),r[0]=i*h,r[1]=o*h,r[2]=a*h,r[3]=c*h,r}function kn(r,e,i){var o=e[0],a=e[1],c=e[2],h=e[3];return r[0]=i[0]*o+i[4]*a+i[8]*c+i[12]*h,r[1]=i[1]*o+i[5]*a+i[9]*c+i[13]*h,r[2]=i[2]*o+i[6]*a+i[10]*c+i[14]*h,r[3]=i[3]*o+i[7]*a+i[11]*c+i[15]*h,r}function ks(){var r=new Gi(4);return Gi!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r[3]=1,r}function ga(r){return r[0]=0,r[1]=0,r[2]=0,r[3]=1,r}function lc(r,e,i){i*=.5;var o=e[0],a=e[1],c=e[2],h=e[3],f=Math.sin(i),_=Math.cos(i);return r[0]=o*_+h*f,r[1]=a*_+c*f,r[2]=c*_-a*f,r[3]=h*_-o*f,r}function Ns(r,e,i){i*=.5;var o=e[0],a=e[1],c=e[2],h=e[3],f=Math.sin(i),_=Math.cos(i);return r[0]=o*_-c*f,r[1]=a*_+h*f,r[2]=c*_+o*f,r[3]=h*_-a*f,r}ti(),xu();var qr,ya,cc,cl=vu,ul=(qr=ti(),ya=Cr(1,0,0),cc=Cr(0,1,0),function(r,e,i){var o=Xi(e,i);return o<-.999999?(hr(qr,ya,e),rs(qr)<1e-6&&hr(qr,cc,e),bi(qr,qr),(function(a,c,h){h*=.5;var f=Math.sin(h);a[0]=f*c[0],a[1]=f*c[1],a[2]=f*c[2],a[3]=Math.cos(h)})(r,qr,Math.PI),r):o>.999999?(r[0]=0,r[1]=0,r[2]=0,r[3]=1,r):(hr(qr,e,i),r[0]=qr[0],r[1]=qr[1],r[2]=qr[2],r[3]=1+o,cl(r,r))});function yr(){var r=new Gi(2);return Gi!=Float32Array&&(r[0]=0,r[1]=0),r}function Eo(r,e){var i=new Gi(2);return i[0]=r,i[1]=e,i}function hl(r,e,i){return r[0]=e,r[1]=i,r}function ns(r,e,i){return r[0]=e[0]+i[0],r[1]=e[1]+i[1],r}function Uo(r,e,i){return r[0]=e[0]-i[0],r[1]=e[1]-i[1],r}function Vs(r,e,i){return r[0]=e[0]*i,r[1]=e[1]*i,r}function os(r){var e=r[0],i=r[1];return Math.sqrt(e*e+i*i)}function uc(r,e){var i=e[0],o=e[1],a=i*i+o*o;return a>0&&(a=1/Math.sqrt(a)),r[0]=e[0]*a,r[1]=e[1]*a,r}function Hr(r,e){return r[0]*e[0]+r[1]*e[1]}ks(),ks(),No();var sd=Uo;function dl(r,e,i,o){const a=3*r,c=3*(i-r)-a,h=1-a-c,f=3*e,_=3*(o-e)-f,y=1-f-_;return function(v,b=1e-6){if(v<=0)return 0;if(v>=1)return 1;let T=v;for(let P=0;P<8;P++){const R=((h*T+c)*T+a)*T-v;if(Math.abs(R)<b)return((y*T+_)*T+f)*T;const L=(3*h*T+2*c)*T+a;if(Math.abs(L)<1e-6)break;T-=R/L}let S=0,C=1;T=v;for(let P=0;P<20;P++){const R=((h*T+c)*T+a)*T;if(Math.abs(R-v)<b)break;v>R?S=T:C=T,T=.5*(S+C)}return((y*T+_)*T+f)*T}}function Ne(r,e){this.x=r,this.y=e}function En(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(!En(r[i],e[i]))return!1;return!0}if(typeof r=="object"&&r!==null&&e!==null){if(typeof e!="object")return!1;const i=r,o=e;if(Object.keys(i).length!==Object.keys(o).length)return!1;for(const a in i)if(!En(i[a],o[a]))return!1;return!0}return r===e}function ss(r,e,i=0,o=r.length-1,a=ad){for(;o>i;){if(o-i>600){const _=o-i+1,y=e-i+1,v=Math.log(_),b=.5*Math.exp(2*v/3),T=.5*Math.sqrt(v*b*(_-b)/_)*(y-_/2<0?-1:1);ss(r,e,Math.max(i,Math.floor(e-y*b/_+T)),Math.min(o,Math.floor(e+(_-y)*b/_+T)),a)}const c=r[e];let h=i,f=o;for(Us(r,i,e),a(r[o],c)>0&&Us(r,i,o);h<f;){for(Us(r,h,f),h++,f--;a(r[h],c)<0;)h++;for(;a(r[f],c)>0;)f--}a(r[i],c)===0?Us(r,i,f):(f++,Us(r,f,o)),f<=e&&(i=f+1),e<=f&&(o=f-1)}}function Us(r,e,i){const o=r[e];r[e]=r[i],r[i]=o}function ad(r,e){return r<e?-1:r>e?1:0}function bu(r){let e=0;for(let i,o,a=0,c=r.length,h=c-1;a<c;h=a++)i=r[a],o=r[h],e+=(o.x-i.x)*(i.y+o.y);return e}function hc(r,e){return e.area-r.area}function as(r,e){const i=r.length;if(i<=1)return[r];const o=[];let a,c;for(let h=0;h<i;h++){const f=bu(r[h]);f!==0&&(r[h].area=Math.abs(f),c===void 0&&(c=f<0),c===f<0?(a&&o.push(a),a=[r[h]]):a.push(r[h]))}if(a&&o.push(a),e>1)for(let h=0;h<o.length;h++){const f=o[h];f.length<=e||(ss(f,e,1,f.length-1,hc),o[h]=f.slice(0,e))}return o}function Nn(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 ls(r,e){return!(r[0]<=e[0]||r[2]>=e[2]||r[1]<=e[1]||r[3]>=e[3])}function dc(r,e,i){const o=r[0]-e[0],a=r[1]-e[1],c=r[0]-i[0],h=r[1]-i[1];return o*h-c*a===0&&o*c<=0&&a*h<=0}function cs(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 Vn(r,e,i=!1){let o=!1;for(let a=0,c=e.length;a<c;a++){const h=e[a];for(let f=0,_=h.length,y=_-1;f<_;y=f++){const v=h[y],b=h[f];if(dc(r,v,b))return i;cs(r,v,b)&&(o=!o)}}return o}function fl(r,e,i,o){const a=o[0]-i[0],c=o[1]-i[1],h=(r[0]-i[0])*c-a*(r[1]-i[1]),f=(e[0]-i[0])*c-a*(e[1]-i[1]);return h>0&&f<0||h<0&&f>0}function us(r,e,i,o){return(a=[o[0]-i[0],o[1]-i[1]])[0]*(c=[e[0]-r[0],e[1]-r[1]])[1]-a[1]*c[0]!==0&&!(!fl(r,e,i,o)||!fl(i,o,r,e));var a,c}function pl(r){const e=new Ne(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),i=new Ne(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);for(const o of r[0])e.x>o.x&&(e.x=o.x),e.y>o.y&&(e.y=o.y),i.x<o.x&&(i.x=o.x),i.y<o.y&&(i.y=o.y);return{min:e,max:i}}yr(),Ne.prototype={clone(){return new Ne(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),o=i*this.x+e*this.y;return this.x=e*this.x-i*this.y,this.y=o,this},_rotateAround(r,e){const i=Math.cos(r),o=Math.sin(r),a=e.y+o*(this.x-e.x)+i*(this.y-e.y);return this.x=e.x+i*(this.x-e.x)-o*(this.y-e.y),this.y=a,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:Ne},Ne.convert=function(r){if(r instanceof Ne)return r;if(Array.isArray(r))return new Ne(+r[0],+r[1]);if(r.x!==void 0&&r.y!==void 0)return new Ne(+r.x,+r.y);throw new Error("Expected [x, y] or {x, y} point format")};const wu=Math.PI/180,ml=180/Math.PI,Tu=/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;function jt(r){return r*wu}function de(r){return r*ml}const F=[[0,0],[1,0],[1,1],[0,1]];function j(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)}const re=dl(.25,.1,.25,1);function te(r,e,i){return Math.min(i,Math.max(e,r))}function ce(r,e,i){return(i=te((i-r)/(e-r),0,1))*i*(3-2*i)}function le(r,e,i){const o=i-e,a=((r-e)%o+o)%o+e;return a===e?i:a}function ye(r,e,i){if(!r.length)return i(null,[]);let o=r.length;const a=new Array(r.length);let c=null;r.forEach((h,f)=>{e(h,(_,y)=>{_&&(c=_),a[f]=y,--o===0&&i(c,a)})})}function K(r,e){const i={};for(let o=0;o<e.length;o++){const a=e[o];a in r&&(i[a]=r[a])}return i}let be=1;function Oe(r){return r<=1?1:Math.pow(2,Math.ceil(Math.log2(r)))}function qe(r,e){r.forEach(i=>{e[i]&&(e[i]=e[i].bind(e))})}function Ye(r,e,i){const o={};for(const a in r)o[a]=e.call(this,r[a],a,r);return o}function st(r,e,i){const o={};for(const a in r)e.call(this,r[a],a,r)&&(o[a]=r[a]);return o}function ot(r){return Array.isArray(r)?r.map(ot):typeof r=="object"&&r?Ye(r,ot):r}function Xt(r,e){for(let i=0;i<r.length;i++)if(e.includes(r[i]))return!0;return!1}const St={};function ht(r){St[r]||(typeof console<"u"&&console.warn(r),St[r]=!0)}function Vt(r,e,i){return(i.y-r.y)*(e.x-r.x)>(e.y-r.y)*(i.x-r.x)}function di([r,e,i]){const o=jt(e+90),a=jt(i);return{x:r*Math.cos(o)*Math.sin(a),y:r*Math.sin(o)*Math.sin(a),z:r*Math.cos(a),azimuthal:e,polar:i}}function Ai(r){return(typeof self<"u"||r!==void 0)&&typeof WorkerGlobalScope<"u"&&(r!==void 0?r:self)instanceof WorkerGlobalScope}function tr(r){const e={};if(r.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(i,o,a,c)=>{const h=a||c;return e[o]=!h||h.toLowerCase(),""}),e["max-age"]){const i=parseInt(e["max-age"],10);isNaN(i)?delete e["max-age"]:e["max-age"]=i}return e}function sr(r,e){return[r[4*e],r[4*e+1],r[4*e+2],r[4*e+3]]}function qi(r){return r>0?1/(1.001-r):1+r}function Tr(r){return r>0?1-1/(1.001-r):-r}function io(r,e,i){return(r-e.min)*(i.max-i.min)/(e.max-e.min)+i.min}let Sn,Ci,zi,Yi,xi,Hi;function pn(){return Sn==null&&(Sn=self.OffscreenCanvas&&!!new OffscreenCanvas(1,1).getContext("2d")&&typeof self.createImageBitmap=="function"),Sn}const Ki={requestIdleCallback:r=>{if(typeof requestIdleCallback<"u")return requestIdleCallback(r);setTimeout(()=>r({didTimeout:!1,timeRemaining:()=>50}),0)},now:()=>Yi!==void 0?Yi:performance.now(),setNow(r){Yi=r},restoreNow(){Yi=void 0},frame(r){const e=requestAnimationFrame(r);return{cancel:()=>cancelAnimationFrame(e)}},getImageData(r,e=0){const{width:i,height:o}=r;xi||(xi=document.createElement("canvas"));const a=xi.getContext("2d",{willReadFrequently:!0});if(!a)throw new Error("failed to create canvas 2d context");return(i>xi.width||o>xi.height)&&(xi.width=i,xi.height=o),a.clearRect(-e,-e,i+2*e,o+2*e),a.drawImage(r,0,0,i,o),a.getImageData(-e,-e,i+2*e,o+2*e)},resolveURL:r=>(Ci||(Ci=document.createElement("a")),Ci.href=r,Ci.href),get devicePixelRatio(){return window.devicePixelRatio},get prefersReducedMotion(){return!!window.matchMedia&&(zi==null&&(zi=window.matchMedia("(prefers-reduced-motion: reduce)")),zi.matches)},hasCanvasFingerprintNoise(){if(Hi!==void 0)return Hi;if(!pn())return Hi=!1,!1;const r=new OffscreenCanvas(85,1),e=r.getContext("2d",{willReadFrequently:!0});let i=0;for(let a=0;a<r.width;++a)e.fillStyle=`rgba(${i++},${i++},${i++}, 255)`,e.fillRect(a,0,1,1);const o=e.getImageData(0,0,r.width,r.height);i=0;for(let a=0;a<o.data.length;++a)if(a%4!=3&&i++!==o.data[a])return Hi=!0,!0;return Hi=!1,!1}};let So;const ii={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(!ii.API_URL)return null;
1try{const r=new URL(ii.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 jo(){return new URL(ii.DRACO_URL,ii.API_URL).href}function vi(){if(typeof WebAssembly!="object")throw new Error("WebAssembly not supported, cannot instantiate meshoptimizer");return new URL((function(){if(So===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]);So=WebAssembly.validate(r)}return So})()?ii.MESHOPT_SIMD_URL:ii.MESHOPT_URL,ii.API_URL).href}function ar(){return new URL(ii.BUILDING_GEN_URL,ii.API_URL).href}const kr={supported:!1,testSupport:function(r){!_l&&Nr&&(Bp?Np(r):mn=r)}};let mn,Nr,_l=!1,Bp=!1;const kp=typeof self<"u"?self:{};function Np(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,Nr),r.isContextLost())return;kr.supported=!0}
1catch{}r.deleteTexture(e),_l=!0}function Vp(r,e){const i=r.indexOf("?");if(i<0)return`${r}?${new URLSearchParams(e).toString()}`;const o=new URLSearchParams(r.slice(i));for(const a in e)o.set(a,e[a]);return`${r.slice(0,i)}?${o.toString()}`}function ld(r,e={persistentParams:[]}){const i=r.indexOf("?");if(i<0)return r;const o=new URLSearchParams,a=new URLSearchParams(r.slice(i));for(const h of e.persistentParams){const f=a.get(h);f&&o.set(h,f)}const c=o.toString();return`${r.slice(0,i)}${c.length>0?`?${c}`:""}`}kp.document&&(Nr=kp.document.createElement("img"),Nr.onload=function(){mn&&Np(mn),mn=null,Bp=!0},Nr.onerror=function(){_l=!0,mn=null},Nr.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const Up="mapbox-tiles";let jp=500,fc=50;const Gp=["language","worldview","jobid"];let hs;function qp(){try{return caches}catch{}}function nn(){const r=qp();r&&hs==null&&(hs=r.open(Up))}let xa=1/0;function gl(r){return ii.API_URL_REGEX.test(r)}function cd(r){return ii.API_SPRITE_REGEX.test(r)}const va={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Iconset:"Iconset",Image:"Image",Model:"Model"};Object.freeze(va);
vendor: 24,703 bytes, line 1
1class pc extends Error{constructor(e,i,o){super(),this.url=o,this.statusText=e,this.status=i}get message(){return this.status===401&&gl(this.url)?`${this.statusText}: you may have provided an invalid Mapbox access token. See https://docs.mapbox.com/api/guides/#access-tokens-and-token-scopes`:this.statusText}toString(){return`${this.name}: ${this.message} (${this.status}): ${this.url}`}}function Hp(r){return typeof r=="object"&&r!==null&&"status"in r&&r.status===404}const yl=Ai()?()=>self.worker.referrer:()=>(location.protocol==="blob:"?parent:self).location.href,ba=/^\w+:/,Eu=/[\r\n]+/;async function ud(r,e){let i;return i=r.type==="arrayBuffer"?await e.arrayBuffer():r.type==="json"?await e.json():await e.text(),{data:i,headers:e.headers}}async function mc(r,e){return e&&e.throwIfAborted(),(i=r.url).startsWith("file:")||yl().startsWith("file:")&&!ba.test(i)?(async function(o,a){return new Promise((c,h)=>{const f=new XMLHttpRequest,_=()=>{a.removeEventListener("abort",_),f.abort(),h(a.reason)};a&&a.addEventListener("abort",_),f.open(o.method||"GET",o.url,!0),o.type==="arrayBuffer"&&(f.responseType="arraybuffer");for(const y in o.headers)f.setRequestHeader(y,o.headers[y]);o.type==="json"&&(f.responseType="text",f.setRequestHeader("Accept","application/json")),f.withCredentials=o.credentials==="include",f.onerror=()=>{a&&a.removeEventListener("abort",_),h(new Error(f.statusText))},f.onload=()=>{if(a&&a.removeEventListener("abort",_),(f.status>=200&&f.status<300||f.status===0)&&f.response!==null){let y=f.response;if(o.type==="json")try{y=JSON.parse(f.response)}catch(b){return void h(b)}const v=new Headers;f.getAllResponseHeaders().trim().split(Eu).forEach(b=>{const T=b.split(": "),S=T.shift(),C=T.join(": ");S&&v.set(S,C)}),c({data:y,headers:v})}else h(new pc(f.statusText,f.status,o.url))},f.send(o.body)})})(r,e):(async function(o,a){const c=new Request(o.url,{method:o.method||"GET",body:o.body,credentials:o.credentials,headers:o.headers,referrer:yl(),referrerPolicy:o.referrerPolicy,signal:a}),h=(f=c.url).indexOf("sku=")>0&&gl(f);var f;if(o.type==="json"&&c.headers.set("Accept","application/json"),h){let T=null;try{T=await(async function(S){if(nn(),hs==null)return null;const C=await hs;let P=ld(S.url,{persistentParams:Gp});const R=S.headers.get("Range");R&&(P=Vp(P,{range:R}));const L=await C.match(P);if(!L)return null;const V=(function(B){if(!B)return!1;const G=new Date(B.headers.get("expires")||0),H=tr(B.headers.get("cache-control")||"");return Number(G)>Date.now()&&!H["no-cache"]})(L);return C.delete(P).catch(B=>ht(B.message)),V&&C.put(P,L.clone()).catch(B=>ht(B.message)),{response:L,fresh:V}})(c)}catch(S){S.message!=="SecurityError"&&ht(S.toString())}if(T&&T.fresh)return a&&a.throwIfAborted(),ud(o,T.response)}const _=Date.now();let y;try{y=await fetch(c)}catch(T){throw T.name==="AbortError"?T:new Error(`${T.message} ${o.url}`,{cause:T})}if(a&&a.throwIfAborted(),!y.ok)throw new pc(y.statusText,y.status,o.url);const v=h?y.clone():null,b=await ud(o,y);return v&&(async function(T,S,C){if(nn(),hs==null)return;const P=tr(S.headers.get("cache-control")||"");if(P["no-store"])return;const R={status:S.status,statusText:S.statusText,headers:new Headers(S.headers)};P["max-age"]&&R.headers.set("Expires",new Date(C+1e3*P["max-age"]).toUTCString());const L=R.headers.get("expires");if(!L||new Date(L).getTime()-C<42e4)return;let V=ld(T.url,{persistentParams:Gp});if(S.status===206){const H=T.headers.get("Range");if(!H)return;R.status=200,V=Vp(V,{range:H})}const B=new Response((G=S.status)!==200&&G!==404&&[101,103,204,205,304].includes(G)?null:S.body,R);var G;if(nn(),hs!=null)try{await(await hs).put(V,B)}catch(H){ht(H.message)}})(c,v,_),b})(r,e);var i}async function Go(r,e){return mc(Object.assign(r,{type:"json"}),e)}async function xl(r,e){return mc(Object.assign(r,{type:"arrayBuffer"}),e)}function $p(r){const e=document.createElement("a");return e.href=r,e.protocol===location.protocol&&e.host===location.host}let vl,Su;function Iu(r,e=0){const a=r.length,c=a-(3&a);let h,f=0|e,_=0;for(;_<c;)h=255&r.charCodeAt(_)|(255&r.charCodeAt(_+1))<<8|(255&r.charCodeAt(_+2))<<16|(255&r.charCodeAt(_+3))<<24,_+=4,h=Math.imul(h,3432918353),h=h<<15|h>>>17,h=Math.imul(h,461845907),f^=h,f=f<<13|f>>>19,f=Math.imul(f,5)+3864292196|0;h=0;const y=3&a;return y>0&&(y>=3&&(h^=(255&r.charCodeAt(_+2))<<16),y>=2&&(h^=(255&r.charCodeAt(_+1))<<8),h^=255&r.charCodeAt(_),h=Math.imul(h,3432918353),h=h<<15|h>>>17,h=Math.imul(h,461845907),f^=h),f^=a,f^=f>>>16,f=Math.imul(f,2246822507),f^=f>>>13,f=Math.imul(f,3266489909),f^=f>>>16,f>>>0}vl=[],Su=0;class Un{constructor(e,...i){Object.assign(this,i[0]||{}),this.type=e}}class hd extends Un{constructor(e,i={}){super("error",{error:e,...i})}}function Au(r,e,i){i[r]&&i[r].includes(e)||(i[r]=i[r]||[],i[r].push(e))}function ds(r,e,i){if(i&&i[r]){const o=i[r].indexOf(e);o!==-1&&i[r].splice(o,1)}}class wa{on(e,i){return this._listeners=this._listeners||{},Au(e,i,this._listeners),this}off(e,i){return ds(e,i,this._listeners),ds(e,i,this._oneTimeListeners),this}once(e,i){return i?(this._oneTimeListeners=this._oneTimeListeners||{},Au(e,i,this._oneTimeListeners),this):new Promise(o=>{this.once(e,o)})}fire(e,i){const o=typeof e=="string"?new Un(e,i):e,a=o.type;if(this.listens(a)){o.target=this;const c=this._listeners&&this._listeners[a]?this._listeners[a].slice():[];for(const _ of c)_.call(this,o);const h=this._oneTimeListeners&&this._oneTimeListeners[a]?this._oneTimeListeners[a].slice():[];for(const _ of h)ds(a,_,this._oneTimeListeners),_.call(this,o);const f=this._eventedParent;if(f){const _=typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData;Object.assign(o,_),f.fire(o)}}else o instanceof hd&&console.error(o.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 In{constructor(e){typeof e=="string"?this.name=e:(this.name=e.name,this.iconsetId=e.iconsetId)}static from(e){return new In(e)}static toString(e){return e.iconsetId?`${e.name}�${e.iconsetId}`:e.name}static parse(e){const[i,o]=e.split("�");return new In({name:i,iconsetId:o})}static isEqual(e,i){return e.name===i.name&&e.iconsetId===i.iconsetId}toString(){return In.toString(this)}serialize(){return{name:this.name,iconsetId:this.iconsetId}}}var dd,fd={},Zp=(function(){if(dd)return fd;dd=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(c){return(c=Math.round(c))<0?0:c>255?255:c}function i(c){return e(c[c.length-1]==="%"?parseFloat(c)/100*255:parseInt(c))}function o(c){return(h=c[c.length-1]==="%"?parseFloat(c)/100:parseFloat(c))<0?0:h>1?1:h;var h}function a(c,h,f){return f<0?f+=1:f>1&&(f-=1),6*f<1?c+(h-c)*f*6:2*f<1?h:3*f<2?c+(h-c)*(2/3-f)*6:c}try{fd.parseCSSColor=function(c){var h,f=c.replace(/ /g,"").toLowerCase();if(f in r)return r[f].slice();if(f[0]==="#")return f.length===4?(h=parseInt(f.substr(1),16))>=0&&h<=4095?[(3840&h)>>4|(3840&h)>>8,240&h|(240&h)>>4,15&h|(15&h)<<4,1]:null:f.length===7&&(h=parseInt(f.substr(1),16))>=0&&h<=16777215?[(16711680&h)>>16,(65280&h)>>8,255&h,1]:null;var _=f.indexOf("("),y=f.indexOf(")");if(_!==-1&&y+1===f.length){var v=f.substr(0,_),b=f.substr(_+1,y-(_+1)).split(","),T=1;switch(v){case"rgba":if(b.length!==4)return null;T=o(b.pop());case"rgb":return b.length!==3?null:[i(b[0]),i(b[1]),i(b[2]),T];case"hsla":if(b.length!==4)return null;T=o(b.pop());case"hsl":if(b.length!==3)return null;var S=(parseFloat(b[0])%360+360)%360/360,C=o(b[1]),P=o(b[2]),R=P<=.5?P*(C+1):P+C-P*C,L=2*P-R;return[e(255*a(L,R,S+1/3)),e(255*a(L,R,S)),e(255*a(L,R,S-1/3)),T];default:return null}}return null}}catch{}return fd})();function yt(r,e,i){return r*(1-i)+e*i}const Wp=new Map;class $t{constructor(e,i,o,a=1){this.r=e,this.g=i,this.b=o,this.a=a}static parse(e){if(!e)return;if(e instanceof $t)return e;if(typeof e!="string")return;const i=Wp.get(e);if(i)return i;const o=Zp.parseCSSColor(e);if(!o)return;const a=new $t(o[0]/255,o[1]/255,o[2]/255,o[3]);return Wp.set(e,a),a}toString(){const{r:e,g:i,b:o,a}=this;return`rgba(${Math.round(255*e)},${Math.round(255*i)},${Math.round(255*o)},${a})`}toNonPremultipliedRenderColor(e){const{r:i,g:o,b:a,a:c}=this;return new pd(e,i,o,a,c)}toPremultipliedRenderColor(e){const{r:i,g:o,b:a,a:c}=this;return new md(e,i*c,o*c,a*c,c)}clone(){return new $t(this.r,this.g,this.b,this.a)}}class Xp{constructor(e,i,o,a,c,h=!1){if(this.premultiplied=!1,this.premultiplied=h,e){const f=e.image.height,_=f*f;this.premultiplied?(i=c===0?0:i/c*(f-1),o=c===0?0:o/c*(f-1),a=c===0?0:a/c*(f-1)):(i*=f-1,o*=f-1,a*=f-1),i=Math.max(0,Math.min(f-1,i)),o=Math.max(0,Math.min(f-1,o)),a=Math.max(0,Math.min(f-1,a));const y=Math.floor(i),v=Math.floor(o),b=Math.floor(a),T=Math.ceil(i),S=Math.ceil(o),C=Math.ceil(a),P=i-y,R=o-v,L=a-b,V=e.image.data,B=4*(y+v*_+b*f),G=4*(y+v*_+C*f),H=4*(y+S*_+b*f),Z=4*(y+S*_+C*f),oe=4*(T+v*_+b*f),X=4*(T+v*_+C*f),ee=4*(T+S*_+b*f),ie=4*(T+S*_+C*f);this.r=yt(yt(yt(V[B],V[G],L),yt(V[H],V[Z],L),R),yt(yt(V[oe],V[X],L),yt(V[ee],V[ie],L),R),P)/255*(this.premultiplied?c:1),this.g=yt(yt(yt(V[B+1],V[G+1],L),yt(V[H+1],V[Z+1],L),R),yt(yt(V[oe+1],V[X+1],L),yt(V[ee+1],V[ie+1],L),R),P)/255*(this.premultiplied?c:1),this.b=yt(yt(yt(V[B+2],V[G+2],L),yt(V[H+2],V[Z+2],L),R),yt(yt(V[oe+2],V[X+2],L),yt(V[ee+2],V[ie+2],L),R),P)/255*(this.premultiplied?c:1),this.a=c}else this.r=i,this.g=o,this.b=a,this.a=c}toArray(){const{r:e,g:i,b:o,a}=this;return[255*e,255*i,255*o,a]}toHslaArray(){let{r:e,g:i,b:o,a}=this;if(this.premultiplied){if(a===0)return[0,0,0,0];const C=1/a;e*=C,i*=C,o*=C}const c=Math.min(Math.max(e,0),1),h=Math.min(Math.max(i,0),1),f=Math.min(Math.max(o,0),1),_=Math.min(c,h,f),y=Math.max(c,h,f),v=y-_,b=.5*(_+y);if(v===0)return[0,0,100*b,a];const T=b>.5?v/(2-y-_):v/(y+_);let S;switch(y){case c:S=60*((h-f)/v+(h<f?6:0));break;case h:S=60*((f-c)/v+2);break;default:S=60*((c-h)/v+4)}return[S,100*T,100*b,a]}toArray01(){const{r:e,g:i,b:o,a}=this;return[e,i,o,a]}toArray01Scaled(e){const{r:i,g:o,b:a}=this;return[i*e,o*e,a*e]}toArray01Linear(){const{r:e,g:i,b:o,a}=this;return[Math.pow(e,2.2),Math.pow(i,2.2),Math.pow(o,2.2),a]}}class pd extends Xp{constructor(e,i,o,a,c){super(e,i,o,a,c,!1)}}class md extends Xp{constructor(e,i,o,a,c){super(e,i,o,a,c,!0)}}function pt(r,e,i){return r.map((o,a)=>yt(o,e[a],i))}$t.black=new $t(0,0,0,1),$t.white=new $t(1,1,1,1),$t.transparent=new $t(0,0,0,0),$t.red=new $t(1,0,0,1),$t.blue=new $t(0,0,1,1);var nt=Object.freeze({__proto__:null,array:pt,color:function(r,e,i){return new $t(yt(r.r,e.r,i),yt(r.g,e.g,i),yt(r.b,e.b,i),yt(r.a,e.a,i))},number:yt});class jn extends Error{constructor(e,i){super(i),this.message=i,this.key=e}}class Cu{constructor(e,i=[]){this.parent=e,this.bindings={};for(const[o,a]of i)this.bindings[o]=a}concat(e){return new Cu(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 js={kind:"null"},ct={kind:"number"},Jt={kind:"string"},Yt={kind:"boolean"},_n={kind:"color"},qo={kind:"object"},Qt={kind:"value"},bl={kind:"collator"},gn={kind:"formatted"},wl={kind:"resolvedImage"};function $r(r,e){return{kind:"array",itemType:r,N:e}}function lr(r){if(r.kind==="array"){const e=lr(r.itemType);return typeof r.N=="number"?`array<${e}, ${r.N}>`:r.itemType.kind==="value"?"array":`array<${e}>`}return r.kind}const Yp=[js,ct,Jt,Yt,_n,gn,qo,$r(Qt),wl];function Tl(r,e){if(e.kind==="error")return null;if(r.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!Tl(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 Yp)if(!Tl(i,e))return null}}return`Expected ${lr(r)} but found ${lr(e)} instead.`}function Mu(r,e){return e.some(i=>i.kind===r.kind)}function El(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 _c(r,e){return r.kind==="array"&&e.kind==="array"?r.N===e.N&&_c(r.itemType,e.itemType):r.kind===e.kind}class Sl{constructor(e,i,o){this.sensitivity=e?i?"variant":"case":i?"accent":"base",this.locale=o,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 fs{constructor(e,i,o,a,c){this.text=e.normalize?e.normalize():e,this.image=i,this.scale=o,this.fontStack=a,this.textColor=c}}class Zr{constructor(e){this.sections=e}static fromString(e){return new Zr([new fs(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 a=i.image.getPrimary().id.toString();e.push(["image",a]);continue}e.push(i.text);const o={};i.fontStack&&(o["text-font"]=["literal",i.fontStack.split(",")]),i.scale&&(o["font-scale"]=i.scale),i.textColor&&(o["text-color"]=["rgba"].concat(i.textColor.toNonPremultipliedRenderColor(null).toArray())),e.push(o)}return e}}class Vr{constructor(e,i={}){this.id=In.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,o,a,c;try{({id:i,params:o,sx:a,sy:c}=JSON.parse(e)||{})}catch{return null}return i?new Vr(i,{params:o,sx:a,sy:c}):null}scaleSelf(e,i=e){return this.sx*=e,this.sy*=i,this}}class Wr{constructor(e,i,o,a,c=!1){this.primaryId=In.from(e),this.primaryOptions=i,o&&(this.secondaryId=In.from(o)),this.secondaryOptions=a,this.available=c}toString(){return this.primaryId&&this.secondaryId?`[${this.primaryId.name},${this.secondaryId.name}]`:this.primaryId.name}hasPrimary(){return!!this.primaryId}getPrimary(){return new Vr(this.primaryId,this.primaryOptions)}hasSecondary(){return!!this.secondaryId}getSecondary(){return this.secondaryId?new Vr(this.secondaryId,this.secondaryOptions):null}static from(e){return typeof e=="string"?Wr.build({name:e}):e}static build(e,i,o,a){return!e||typeof e=="object"&&!("name"in e)?null:new Wr(e,o,i,a)}}function ps(r,e,i,o){return typeof r=="number"&&r>=0&&r<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof i=="number"&&i>=0&&i<=255?o===void 0||typeof o=="number"&&o>=0&&o<=1?null:`Invalid rgba value [${[r,e,i,o].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof o=="number"?[r,e,i,o]:[r,e,i]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Gs(r){if(r===null||typeof r=="string"||typeof r=="boolean"||typeof r=="number"||r instanceof $t||r instanceof Sl||r instanceof Zr||r instanceof Wr)return!0;if(Array.isArray(r)){for(const e of r)if(!Gs(e))return!1;return!0}if(typeof r=="object"){for(const e in r)if(!Gs(r[e]))return!1;return!0}return!1}function lt(r){if(r===null)return js;if(typeof r=="string")return Jt;if(typeof r=="boolean")return Yt;if(typeof r=="number")return ct;if(r instanceof $t)return _n;if(r instanceof Sl)return bl;if(r instanceof Zr)return gn;if(r instanceof Wr)return wl;if(Array.isArray(r)){const e=r.length;let i;for(const o of r){const a=lt(o);if(i){if(i===a)continue;i=Qt;break}i=a}return $r(i||Qt,e)}return qo}function Io(r){return r===null?"":typeof r=="string"||typeof r=="number"||typeof r=="boolean"?String(r):r instanceof Zr||r instanceof Wr||r instanceof $t?r.toString():JSON.stringify(r)}class Ao{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(!Gs(e[1]))return i.error("invalid value");const o=e[1];let a=lt(o);const c=i.expectedType;return a.kind!=="array"||a.N!==0||!c||c.kind!=="array"||typeof c.N=="number"&&c.N!==0||(a=c),new Ao(a,o)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}serialize(){return this.type.kind==="array"||this.type.kind==="object"?["literal",this.value]:this.value instanceof $t?["rgba"].concat(this.value.toNonPremultipliedRenderColor(null).toArray()):this.value instanceof Zr?this.value.serialize():this.value}}class ir{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}}const ms={string:Jt,number:ct,boolean:Yt,object:qo};class dt{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 o,a=1;const c=e[0];if(c==="array"){let f,_;if(e.length>2){const y=e[1];if(typeof y!="string"||!(y in ms)||y==="object")return i.error('The item type argument of "array" must be one of string, number, boolean',1);f=ms[y],a++}else f=Qt;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);_=e[2],a++}o=$r(f,_)}else o=ms[c];const h=[];for(;a<e.length;a++){const f=i.parse(e[a],a,Qt);if(!f)return null;h.push(f)}return new dt(o,h)}evaluate(e){for(let i=0;i<this.args.length;i++){const o=this.args[i].evaluate(e);if(!Tl(this.type,lt(o)))return o;if(i===this.args.length-1)throw new ir(`The expression ${JSON.stringify(this.args[i].serialize())} evaluated to ${lr(lt(o))} but was expected to be of type ${lr(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 o=e.itemType;if(o.kind==="string"||o.kind==="number"||o.kind==="boolean"){i.push(o.kind);const a=e.N;(typeof a=="number"||this.args.length>1)&&i.push(a)}}return i.concat(this.args.map(o=>o.serialize()))}}class Il{constructor(e){this.type=gn,this.sections=e}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");const o=e[1];if(!Array.isArray(o)&&typeof o=="object")return i.error("First argument must be an image or text section.");const a=[];let c=!1;for(let h=1;h<=e.length-1;++h){const f=e[h];if(c&&typeof f=="object"&&!Array.isArray(f)){c=!1;let _=null;if(f["font-scale"]&&(_=i.parseObjectValue(f["font-scale"],h,"font-scale",ct),!_))return null;let y=null;if(f["text-font"]&&(y=i.parseObjectValue(f["text-font"],h,"text-font",$r(Jt)),!y))return null;let v=null;if(f["text-color"]&&(v=i.parseObjectValue(f["text-color"],h,"text-color",_n),!v))return null;const b=a.at(-1);b.scale=_,b.font=y,b.textColor=v}else{const _=i.parse(e[h],h,Qt);if(!_)return null;const y=_.type.kind;if(y!=="string"&&y!=="value"&&y!=="null"&&y!=="resolvedImage")return i.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");c=!0,a.push({content:_,scale:null,font:null,textColor:null})}}return new Il(a)}evaluate(e){return new Zr(this.sections.map(i=>{const o=i.content.evaluate(e);return _c(lt(o),wl)?new fs("",o,null,null,null):new fs(Io(o),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 o={};i.scale&&(o["font-scale"]=i.scale.serialize()),i.font&&(o["text-font"]=i.font.serialize()),i.textColor&&(o["text-color"]=i.textColor.serialize()),e.push(o)}return e}}class Ta{constructor(e,i,o,a){this._imageWarnHistory={},this.type=wl,this.namePrimary=e,this.nameSecondary=i,o&&(this.paramsPrimary=o.params,this.iconsetIdPrimary=o.iconset?o.iconset.id:void 0),a&&(this.paramsSecondary=a.params,this.iconsetIdSecondary=a.iconset?a.iconset.id:void 0)}static parse(e,i){if(e.length<2)return i.error("Expected two or more arguments.");let o=1;const a=[];function c(){if(o<e.length){const f=i.parse(e[o],o++,Jt);return f?(a.push({image:f,options:{}}),!0):(i.error(a.length?"Secondary image variant is not a string.":"No image name provided."),!1)}return!0}function h(){if(o<e.length){const _=e[o];if((f=_)===null||typeof f!="object"||Array.isArray(f))return!0;const y=_.params,v=_.iconset,b=i.concat(o);if(!y&&!v)return o++,!0;if(y){if(typeof y!="object"||y.constructor!==Object)return b.error('Image options "params" should be an object'),!1;const T={},S=b.concat(void 0,"params");for(const C in y){if(!C)return S.error("Image parameter name should be non-empty"),!1;const P=S.concat(void 0,C).parse(y[C],void 0,_n,void 0,{typeAnnotation:"coerce"});if(!P)return!1;T[C]=P}a.at(-1).options.params=T}if(v){if(typeof v!="object"||v.constructor!==Object)return b.error('Image options "iconset" should be an object'),!1;if(!v.id)return b.error('Image options "iconset" should have an "i
1d" property'),!1;a.at(-1).options.iconset=v}return o++,!0}var f;return!0}for(let f=0;f<2;f++)if(!c()||!h())return;return new Ta(a[0].image,a[1]?a[1].image:void 0,a[0].options,a[1]?a[1].options:void 0)}evaluateParams(e,i){const o={};if(i){for(const a in i)if(i[a])try{o[a]=i[a].evaluate(e)}catch{continue}if(Object.keys(o).length!==0)return{params:o}}}evaluate(e){const i={name:this.namePrimary.evaluate(e),iconsetId:this.iconsetIdPrimary},o=this.nameSecondary?{name:this.nameSecondary.evaluate(e),iconsetId:this.iconsetIdSecondary}:void 0,a=Wr.build(i,o,this.paramsPrimary?this.evaluateParams(e,this.paramsPrimary):void 0,this.paramsSecondary?this.evaluateParams(e,this.paramsSecondary):void 0);if(a&&e.availableImages){const c=a.getPrimary().id;if(a.available=e.availableImages.some(h=>In.isEqual(h,c)),a.available){const h=a.getSecondary()?a.getSecondary().id:null;h&&(a.available=e.availableImages.some(f=>In.isEqual(f,h)))}}return a}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 o={};if(i&&(o.iconset={id:i}),e){o.params={};for(const a in e)e[a]&&(o.params[a]=e[a].serialize())}return Object.keys(o).length>0?o: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 _d(r){return yd(r)?"string":Pu(r)?"number":Kp(r)?"boolean":Array.isArray(r)?"array":r===null?"null":gd(r)?"object":typeof r}function gd(r){return r!=null&&!Array.isArray(r)&&typeof r!="function"&&!(r instanceof String||r instanceof Number||r instanceof Boolean)&&typeof r=="object"}function yd(r){return typeof r=="string"||r instanceof String}function Pu(r){return typeof r=="number"||r instanceof Number}function Kp(r){return typeof r=="boolean"||r instanceof Boolean}const Jp={"to-boolean":Yt,"to-color":_n,"to-number":ct,"to-string":Jt};class yn{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 o=e[0],a=[];let c=js;if(o==="to-array"){if(!Array.isArray(e[1]))return null;const h=e[1].length;if(i.expectedType){if(i.expectedType.kind!=="array")return i.error(`Expected ${i.expectedType.kind} but found array.`);c=$r(i.expectedType.itemType,h)}else{if(!(h>0&&Gs(e[1][0])))return null;c=$r(lt(e[1][0]),h)}for(let f=0;f<h;f++){const _=e[1][f];let y;if(Array.isArray(_))y=i.parse(_,void 0,c.itemType);else{const v=_d(_);if(v!==c.itemType.kind)return i.error(`Expected ${c.itemType.kind} but found ${v}.`);y=i.registry.literal.parse(["literal",_===void 0?null:_],i)}if(!y)return null;a.push(y)}}else{if((o==="to-boolean"||o==="to-string")&&e.length!==2)return i.error("Expected one argument.");c=Jp[o];for(let h=1;h<e.length;h++){const f=i.parse(e[h],h,Qt);if(!f)return null;a.push(f)}}return new yn(c,a)}evaluate(e){if(this.type.kind==="boolean")return!!this.args[0].evaluate(e);if(this.type.kind==="color"){let i,o;for(const a of this.args){if(i=a.evaluate(e),o=null,i instanceof $t)return i;if(typeof i=="string"){const c=e.parseColor(i);if(c)return c}else if(Array.isArray(i)&&(o=i.length<3||i.length>4?`Invalid rbga value ${JSON.stringify(i)}: expected an array containing either three or four numeric values.`:ps(i[0],i[1],i[2],i[3]),!o))return new $t(i[0]/255,i[1]/255,i[2]/255,i[3])}throw new ir(o||`Could not parse color from value '${typeof i=="string"?i:String(JSON.stringify(i))}'`)}if(this.type.kind==="number"){let i=null;for(const o of this.args){if(i=o.evaluate(e),i===null)return 0;const a=Number(i);if(!isNaN(a))return a}throw new ir(`Could not convert ${JSON.stringify(i)} to number.`)}return this.type.kind==="formatted"?Zr.fromString(Io(this.args[0].evaluate(e))):this.type.kind==="resolvedImage"?Wr.build(Io(this.args[0].evaluate(e))):this.type.kind==="array"?this.args.map(i=>i.evaluate(e)):Io(this.args[0].evaluate(e))}
vendor: 24,329 bytes, line 1
1eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}serialize(){if(this.type.kind==="formatted")return new Il([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if(this.type.kind==="resolvedImage")return new Ta(this.args[0]).serialize();const e=this.type.kind==="array"?[]:[`to-${this.type.kind}`];return this.eachChild(i=>{e.push(i.serialize())}),e}}const xd=["Unknown","Point","LineString","Polygon"];class Ru{constructor(e,i,o){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this.availableImages=null,this.canonical=null,this.featureTileCoord=null,this.featureDistanceData=null,this.scope=e,this.options=i,this.iconImageUseTheme=o}id(){return this.feature&&this.feature.id!==void 0?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?xd[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:o,y:a}=this.featureTileCoord;return this.featureDistanceData.bearing[0]*(o*i-e[0])+this.featureDistanceData.bearing[1]*(a*i-e[1])}return 0}parseColor(e){return $t.parse(e)}getConfig(e){return this.options?this.options.get(e):null}}class Xr{constructor(e,i,o,a,c){this.name=e,this.type=i,this._evaluate=o,this.args=a,this._overloadIndex=c}evaluate(e){if(!this._evaluate){const i=Xr.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 o=e[0],a=Xr.definitions[o];if(!a)return i.error(`Unknown expression "${o}". If you wanted a literal array, use ["literal", [...]].`,0);const c=Array.isArray(a)?a[0]:a.type,h=Array.isArray(a)?[[a[1],a[2]]]:a.overloads,f=[];let _=null,y=-1;for(const[v,b]of h){if(Array.isArray(v)&&v.length!==e.length-1)continue;f.push(v),y++,_===null?_=i._forkForSignature():_.errors.length=0;const T=[];let S=!1;for(let C=1;C<e.length;C++){const P=e[C],R=Array.isArray(v)?v[C-1]:v.type,L=_.parse(P,1+T.length,R);if(!L){S=!0;break}T.push(L)}if(!S)if(Array.isArray(v)&&v.length!==T.length)_.error(`Expected ${v.length} arguments, but found ${T.length} instead.`);else{for(let C=0;C<T.length;C++){const P=Array.isArray(v)?v[C]:v.type;_.checkSubtype(P,T[C].type,C+1)}if(_.errors.length===0)return new Xr(o,c,b,T,y)}}if(f.length===1)i.errors.push(..._.errors);else{const v=(f.length?f:h.map(([T])=>T)).map(Qp).join(" | "),b=[];for(let T=1;T<e.length;T++){const S=i.parse(e[T],1+b.length);if(!S)return null;b.push(lr(S.type))}i.error(`Expected arguments of type ${v}, but found (${b.join(", ")}) instead.`)}return null}static register(e,i){Xr.definitions=i;for(const o in i)e[o]=Xr}}function Qp(r){return Array.isArray(r)?`(${r.map(lr).join(", ")})`:`(${lr(r.type)}...)`}class Al{constructor(e,i,o){this.type=bl,this.locale=o,this.caseSensitive=e,this.diacriticSensitive=i}static parse(e,i){if(e.length!==2)return i.error("Expected one argument."),null;const o=e[1];if(typeof o!="object"||Array.isArray(o))return i.error("Collator options argument must be an object."),null;const a=o["case-sensitive"]===void 0?i.parse(!1,1,Yt):i.parseObjectValue(o["case-sensitive"],1,"case-sensitive",Yt);if(!a)return null;const c=o["diacritic-sensitive"]===void 0?i.parse(!1,1,Yt):i.parseObjectValue(o["diacritic-sensitive"],1,"diacritic-sensitive",Yt);if(!c)return null;let h=null;return o.locale&&(h=i.parseObjectValue(o.locale,1,"locale",Jt),!h)?null:new Al(a,c,h)}evaluate(e){return new Sl(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 Ur(r){return(180+r)/360}function Yr(r){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r*Math.PI/360)))/360}function on(r){return 360*r-180}function Er(r){return 360/Math.PI*Math.atan(Math.exp((180-360*r)*Math.PI/180))-90}const Ho=8192;function Du(r,e){const i=Ur(r[0]),o=Yr(r[1]),a=Math.pow(2,e.z);return[Math.round(i*a*Ho),Math.round(o*a*Ho)]}function Ig(r,e){for(let i=0;i<e.length;i++)if(Vn(r,e[i]))return!0;return!1}function zu(r,e,i){for(const o of i)for(let a=0,c=o.length,h=c-1;a<c;h=a++)if(us(r,e,o[h],o[a]))return!0;return!1}function em(r,e){for(let i=0;i<r.length;++i)if(!Vn(r[i],e))return!1;for(let i=0;i<r.length-1;++i)if(zu(r[i],r[i+1],e))return!1;return!0}function Lu(r,e){for(let i=0;i<e.length;i++)if(em(r,e[i]))return!0;return!1}function vd(r,e,i){const o=[];for(let a=0;a<r.length;a++){const c=[];for(let h=0;h<r[a].length;h++){const f=Du(r[a][h],i);Nn(e,f),c.push(f)}o.push(c)}return o}function Fu(r,e,i){const o=[];for(let a=0;a<r.length;a++){const c=vd(r[a],e,i);o.push(c)}return o}function bd(r,e,i,o){if(r[0]<i[0]||r[0]>i[2]){const a=.5*o;let c=r[0]-i[0]>a?-o:i[0]-r[0]>a?o:0;c===0&&(c=r[0]-i[2]>a?-o:i[2]-r[0]>a?o:0),r[0]+=c}Nn(e,r)}function Cl(r,e,i,o){const a=Math.pow(2,o.z)*Ho,c=[o.x*Ho,o.y*Ho],h=[];if(!r)return h;for(const f of r)for(const _ of f){const y=[_.x+c[0],_.y+c[1]];bd(y,e,i,a),h.push(y)}return h}function Ou(r,e,i,o){const a=Math.pow(2,o.z)*Ho,c=[o.x*Ho,o.y*Ho],h=[];if(!r)return h;for(const _ of r){const y=[];for(const v of _){const b=[v.x+c[0],v.y+c[1]];Nn(e,b),y.push(b)}h.push(y)}if(e[2]-e[0]<=a/2){(f=e)[0]=f[1]=1/0,f[2]=f[3]=-1/0;for(const _ of h)for(const y of _)bd(y,e,i,a)}var f;return h}class _s{constructor(e,i){this.type=Yt,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(Gs(e[1])){const o=e[1];if(o.type==="FeatureCollection")for(let a=0;a<o.features.length;++a){const c=o.features[a].geometry.type;if(c==="Polygon"||c==="MultiPolygon")return new _s(o,o.features[a].geometry)}else if(o.type==="Feature"){const a=o.geometry.type;if(a==="Polygon"||a==="MultiPolygon")return new _s(o,o.geometry)}else if(o.type==="Polygon"||o.type==="MultiPolygon")return new _s(o,o)}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,o){const a=[1/0,1/0,-1/0,-1/0],c=[1/0,1/0,-1/0,-1/0],h=i.canonicalID();if(!h)return!1;if(o.type==="Polygon"){const f=vd(o.coordinates,c,h),_=Cl(i.geometry(),a,c,h);if(!ls(a,c))return!1;for(const y of _)if(!Vn(y,f))return!1}if(o.type==="MultiPolygon"){const f=Fu(o.coordinates,c,h),_=Cl(i.geometry(),a,c,h);if(!ls(a,c))return!1;for(const y of _)if(!Ig(y,f))return!1}return!0})(e,this.geometries);if(e.geometryType()==="LineString")return(function(i,o){const a=[1/0,1/0,-1/0,-1/0],c=[1/0,1/0,-1/0,-1/0],h=i.canonicalID();if(!h)return!1;if(o.type==="Polygon"){const f=vd(o.coordinates,c,h),_=Ou(i.geometry(),a,c,h);if(!ls(a,c))return!1;for(const y of _)if(!em(y,f))return!1}if(o.type==="MultiPolygon"){const f=Fu(o.coordinates,c,h),_=Ou(i.geometry(),a,c,h);if(!ls(a,c))return!1;for(const y of _)if(!Lu(y,f))return!1}return!0})(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}serialize(){return["within",this.geojson]}}class gc{constructor(e=[],i=(o,a)=>o<a?-1:o>a?1:0){if(this.data=e,this.length=this.data.length,this.compare=i,this.length>0)for(let o=(this.length>>1)-1;o>=0;o--)this._down(o)}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:o}=this,a=i[e];for(;e>0;){const c=e-1>>1,h=i[c];if(o(a,h)>=0)break;i[e]=h,e=c}i[e]=a}_down(e){const{data:i,compare:o}=this,a=this.length>>1,c=i[e];for(;e<a;){let h=1+(e<<1);const f=h+1;if(f<this.length&&o(i[f],i[h])<0&&(h=f),o(i[h],c)>=0)break;i[e]=i[h],e=h}i[e]=c}}var Ke=8192;const Ml=1/298.257223563,wd=Ml*(2-Ml),tm=Math.PI/180;function Td(r){const e=6378.137*tm*1e3,i=Math.cos(r*tm),o=1/(1-wd*(1-i*i)),a=Math.sqrt(o);return[e*a*i,e*a*o*(1-wd)]}function qs(r){for(;r<-180;)r+=360;for(;r>180;)r-=360;return r}function yc(r,e,i,o){const a=qs(r[0]-e[0])*i,c=(r[1]-e[1])*o;return Math.sqrt(a*a+c*c)}function An(r,e,i,o,a){let c=e[0],h=e[1],f=qs(i[0]-c)*o,_=(i[1]-h)*a;if(f!==0||_!==0){const y=(qs(r[0]-c)*o*f+(r[1]-h)*a*_)/(f*f+_*_);y>1?(c=i[0],h=i[1]):y>0&&(c+=f/o*y,h+=_/a*y)}return f=qs(r[0]-c)*o,_=(r[1]-h)*a,Math.sqrt(f*f+_*_)}function im(r,e){return e.dist-r.dist}function Ed(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 Bu(r){return r[1]-r[0]+1}function gs(r,e){const i=r[1]>=r[0]&&r[1]<e;return i||console.warn("Distance Expression: Index is out of range"),i}function Sd(r,e){if(r[0]>r[1])return[null,null];const i=Bu(r);if(e){if(i===2)return[r,null];const o=Math.floor(i/2);return[[r[0],r[0]+o],[r[0]+o,r[1]]]}{if(i===1)return[r,null];const o=Math.floor(i/2)-1;return[[r[0],r[0]+o],[r[0]+o+1,r[1]]]}}function Ea(r,e){const i=[1/0,1/0,-1/0,-1/0];if(!gs(e,r.length))return i;for(let o=e[0];o<=e[1];++o)Nn(i,r[o]);return i}function Pl(r){const e=[1/0,1/0,-1/0,-1/0];for(let i=0;i<r.length;++i)for(let o=0;o<r[i].length;++o)Nn(e,r[i][o]);return e}function Sa(r,e,i,o){if(Ed(r)||Ed(e))return NaN;let a=0,c=0;return r[2]<e[0]&&(a=e[0]-r[2]),r[0]>e[2]&&(a=r[0]-e[2]),r[1]>e[3]&&(c=r[1]-e[3]),r[3]<e[1]&&(c=e[1]-r[3]),yc([0,0],[a,c],i,o)}function xc(r,e,i=8192){const o=Math.pow(2,e.z),a=(r.y/i+e.y)/o;return[on((r.x/i+e.x)/o),Er(a)]}function rm(r,e){const i=[];for(let o=0;o<r.length;++o)i.push(xc(r[o],e));return i}function Id(r,e,i,o){const a=(function(c,h,f,_){let y=1/0,v=c[0][0],b=c[0][1];for(let T=0;T<c.length-1;T++){let S=c[T][0],C=c[T][1],P=qs(c[T+1][0]-S)*f,R=(c[T+1][1]-C)*_,L=0;P===0&&R===0||(L=(qs(h[0]-S)*f*P+(h[1]-C)*_*R)/(P*P+R*R),L>1?(S=c[T+1][0],C=c[T+1][1]):L>0&&(S+=P/f*L,C+=R/_*L)),P=qs(h[0]-S)*f,R=(h[1]-C)*_;const V=P*P+R*R;V<y&&(y=V,v=S,b=C)}return[v,b]})(e,r,i,o);return yc(r,a,i,o)}function Ad(r,e,i,o,a,c){const h=i.slice(o[0],o[1]+1);let f=1/0;for(let _=e[0];_<=e[1];++_)if((f=Math.min(f,Id(r[_],h,a,c)))===0)return 0;return f}function ku(r,e,i,o,a,c){const h=Math.min(An(r,i,o,a,c),An(e,i,o,a,c)),f=Math.min(An(i,r,e,a,c),An(o,r,e,a,c));return Math.min(h,f)}function Cd(r,e,i,o,a,c){if(!gs(e,r.length)||!gs(o,i.length))return NaN;let h=1/0;for(let f=e[0];f<e[1];++f)for(let _=o[0];_<o[1];++_){if(us(r[f],r[f+1],i[_],i[_+1]))return 0;h=Math.min(h,ku(r[f],r[f+1],i[_],i[_+1],a,c))}return h}function nm(r,e,i,o,a,c){if(!gs(e,r.length)||!gs(o,i.length))return NaN;let h=1/0;for(let f=e[0];f<=e[1];++f)for(let _=o[0];_<=o[1];++_)if((h=Math.min(h,yc(r[f],i[_],a,c)))===0)return h;return h}function om(r,e,i,o){if(Vn(r,e,!0))return 0;let a=1/0;for(const c of e){const h=c.length;if(h<2)return console.warn("Distance Expression: Invalid polygon!"),NaN;if(c[0]!==c[h-1]&&(a=Math.min(a,An(r,c[h-1],c[0],i,o)))===0||(a=Math.min(a,Id(r,c,i,o)))===0)return a}return a}function sm(r,e,i,o,a){if(!gs(e,r.length))return NaN;for(let h=e[0];h<=e[1];++h)if(Vn(r[h],i,!0))return 0;let c=1/0;for(let h=e[0];h<e[1];++h)for(const f of i)for(let _=0,y=f.length,v=y-1;_<y;v=_++){if(us(r[h],r[h+1],f[v],f[_]))return 0;c=Math.min(c,ku(r[h],r[h+1],f[v],f[_],o,a))}return c}function Md(r,e){for(const i of r)for(let o=0;o<=i.length-1;++o)if(Vn(i[o],e,!0))return!0;return!1}function am(r,e,i,o,a=1/0){const c=Pl(r),h=Pl(e);if(a!==1/0&&Sa(c,h,i,o)>=a)return a;if(ls(c,h)){if(Md(r,e))return 0}else if(Md(e,r))return 0;let f=a;for(const _ of r)for(let y=0,v=_.length,b=v-1;y<v;b=y++)for(const T of e)for(let S=0,C=T.length,P=C-1;S<C;P=S++){if(us(_[b],_[y],T[P],T[S]))return 0;f=Math.min(f,ku(_[b],_[y],T[P],T[S],i,o))}return f}function Nu(r,e,i,o,a,c,h,f){if(h===null||f===null)return;const _=Sa(Ea(a,h),Ea(c,f),i,o);_<e&&r.push({dist:_,range1:h,range2:f})}function Ag(r,e,i,o,a,c=1/0){let h=Math.min(yc(r[0],i[0][0],o,a),c);if(h===0)return h;const f=new gc([{dist:0,range1:[0,r.length-1],range2:[0,0]}],im),_=e?50:100,y=Pl(i);for(;f.length;){const v=f.pop();if(v.dist>=h)continue;const b=v.range1;if(Bu(b)<=_){if(!gs(b,r.length))return NaN;if(e){const T=sm(r,b,i,o,a);if((h=Math.min(h,T))===0)return h}else for(let T=b[0];T<=b[1];++T){const S=om(r[T],i,o,a);if((h=Math.min(h,S))===0)return h}}else{const T=Sd(b,e);if(T[0]!==null){const S=Sa(Ea(r,T[0]),y,o,a);S<h&&f.push({dist:S,range1:T[0],range2:[0,0]})}if(T[1]!==null){const S=Sa(Ea(r,T[1]),y,o,a);S<h&&f.push({dist:S,range1:T[1],range2:[0,0]})}}}return h}function vc(r,e,i,o,a,c,h=1/0){let f=Math.min(h,yc(r[0],i[0],a,c));if(f===0)return f;const _=new gc([{dist:0,range1:[0,r.length-1],range2:[0,i.length-1]}],im),y=e?50:100,v=o?50:100;for(;_.length;){const b=_.pop();if(b.dist>=f)continue;const T=b.range1,S=b.range2;if(Bu(T)<=y&&Bu(S)<=v){if(!gs(T,r.length)||!gs(S,i.length))return NaN;if(e&&o?f=Math.min(f,Cd(r,T,i,S,a,c)):e||o?e&&!o?f=Math.min(f,Ad(i,S,r,T,a,c)):!e&&o&&(f=Math.min(f,Ad(r,T,i,S,a,c))):f=Math.min(f,nm(r,T,i,S,a,c)),f===0)return f}else{const C=Sd(T,e),P=Sd(S,o);Nu(_,f,a,c,r,i,C[0],P[0]),Nu(_,f,a,c,r,i,C[0],P[1]),Nu(_,f,a,c,r,i,C[1],P[0]),Nu(_,f,a,c,r,i,C[1],P[1])}}return f}function Ia(r,e,i,o,a,c=1/0){let h=c;const f=Ea(r,[0,r.length-1]);for(const _ of i)if(!(h!==1/0&&Sa(f,Ea(_,[0,_.length-1]),o,a)>=h)&&(h=Math.min(h,vc(r,e,_,!0,o,a,h)),h===0))return h;return h}function Aa(r,e,i,o,a,c=1/0){let h=c;const f=Ea(r,[0,r.length-1]);for(const _ of i){if(h!==1/0&&Sa(f,Pl(_),o,a)>=h)continue;const y=Ag(r,e,_,o,a,h);if(isNaN(y))return y;if((h=Math.min(h,y))===0)return h}return h}function Vu(r){return r==="Point"||r==="MultiPoint"||r==="LineString"||r==="MultiLineString"||r==="Polygon"||r==="MultiPolygon"}class Hs{constructor(e,i){this.type=ct,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(Gs(e[1])){const o=e[1];if(o.type==="FeatureCollection"){for(let a=0;a<o.features.length;++a)if(Vu(o.features[a].geometry.type))return new Hs(o,o.features[a].geometry)}else if(o.type==="Feature"){if(Vu(o.geometry.type))return new Hs(o,o.geometry)}else if(Vu(o.type))return new Hs(o,o)}return i.error("'distance' expression needs to be an array with format ['Distance', GeoJSONObj].")}evaluate(e){const i=e.geometry(),o=e.canonicalID();if(i!=null&&o!=null){if(e.geometryType()==="Point")return(function(a,c,h){const f=[];for(const v of a)for(const b of v)f.push(xc(b,c));const[_,y]=Td(f[0][1]);return h.type==="Point"||h.type==="MultiPoint"||h.type==="LineString"?vc(f,!1,h.type==="Point"?[h.coordinates]:h.coordinates,h.type==="LineString",_,y):h.type==="MultiLineString"?Ia(f,!1,h.coordinates,_,y):h.type==="Polygon"||h.type==="MultiPolygon"?Aa(f,!1,h.type==="Polygon"?[h.coordinates]:h.coordinates,_,y):null})(i,o,this.geometries);if(e.geometryType()==="LineString")return(function(a,c,h){const f=[];for(const v of a){const b=[];for(const T of v)b.push(xc(T,c));f.push(b)}const[_,y]=Td(f[0][0][1]);if(h.type==="Point"||h.type==="MultiPoint"||h.type==="LineString")return Ia(h.type==="Point"?[h.coordinates]:h.coordinates,h.type==="LineString",f,_,y);if(h.type==="MultiLineString"){let v=1/0;for(let b=0;b<h.coordinates.length;b++){const T=Ia(h.coordinates[b],!0,f,_,y,v);if(isNaN(T))return T;if((v=Math.min(v,T))===0)return v}return v}if(h.type==="Polygon"||h.type==="MultiPolygon"){let v=1/0;for(let b=0;b<f.length;b++){const T=Aa(f[b],!0,h.type==="Polygon"?[h.coordinates]:h.coordinates,_,y,v);if(isNaN(T))return T;if((v=Math.min(v,T))===0)return v}return v}return null})(i,o,this.geometries);if(e.geometryType()==="Polygon")return(function(a,c,h){const f=[];for(const v of as(a,0)){const b=[];for(let T=0;T<v.length;++T)b.push(rm(v[T],c));f.push(b)}const[_,y]=Td(f[0][0][0][1]);if(h.type==="Point"||h.type==="MultiPoint"||h.type==="LineString")return Aa(h.type==="Point"?[h.coordinates]:h.coordinates,h.type==="LineString",f,_,y);if(h.type==="MultiLineString"){let v=1/0;for(let b=0;b<h.coordinates.length;b++){const T=Aa(h.coordinates[b],!0,f,_,y,v);if(isNaN(T))return T;if((v=Math.min(v,T))===0)return v}return v}return h.type==="Polygon"||h.type==="MultiPolygon"?(function(v,b,T,S){let C=1/0;for(const P of v)for(const R of b){const L=am(P,R,T,S,C);if(isNaN(L))return L;if((C=Math.min(C,L))===0)return C}return C})(h.type==="Polygon"?[h.coordinates]:h.coordinates,f,_,y):null})(i,o,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 $s(r){if(r instanceof Xr&&(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 _s||r instanceof Hs)return!1;if(r instanceof Dt)return r.featureConstant;let e=!0;return r.eachChild(i=>{e&&!$s(i)&&(e=!1)}),e}function Ca(r){if(r instanceof Xr&&r.name==="feature-state")return!1;let e=!0;return r.eachChild(i=>{e&&!Ca(i)&&(e=!1)}),e}function Pd(r,e){if(r instanceof Xr&&e.has(r.name))return!1;let i=!0;return r.eachChild(o=>{i&&!Pd(o,e)&&(i=!1)}),i}function Zs(r,e){return Pd(r,new Set(e))}function lm(r,e,i){return[r,e,i].filter(Boolean).join("�")}function Ws(r,e){switch(r){case"string":return Io(e);case"number":return+e;case"boolean":return!!e;case"color":return $t.parse(e);case"formatted":return Zr.fromString(Io(e));case"resolvedImage":return Wr.build(Io(e))}return e}function Rd(r,e,i,o){return o!==void 0&&(r=o*Math.round(r/o)),e!==void 0&&r<e&&(r=e),i!==void 0&&r>i&&(r=i),r}class Dt{constructor(e,i,o,a=!1){this.type=e,this.key=i,this.scope=o,this.featureConstant=a}static parse(e,i){let o=i.expectedType;if(o==null&&(o=Qt),e.length<2||e.length>3)return i.error("Invalid number of arguments for 'config' expression.");const a=i.parse(e[1],1);if(!(a instanceof Ao))return i.error("Key name of 'config' expression must be a string literal.");let c,h=!0;const f=Io(a.value);if(e.length>=3){const _=i.parse(e[2],2);if(!(_ instanceof Ao))return i.error("Scope of 'config' expression must be a string literal.");c=Io(_.value)}if(i.options){const _=lm(f,c,i._scope),y=i.options.get(_);y&&(h=$s(y.value||y.default))}return new Dt(o,f,c,h)}evaluate(e){const i=lm(this.key,this.scope,e.scope),o=e.getConfig(i);if(!o)return null;const{type:a,value:c,values:h,minValue:f,maxValue:_,stepValue:y}=o,v=o.default.evaluate(e);let b=v;if(c){const T=e.scope;e.scope=(T||"").split("�").slice(1).join("�"),b=c.evaluate(e),e.scope=T}return a&&(b=Ws(a,b)),b===void 0||f===void 0&&_===void 0&&y===void 0||(typeof b=="number"?b=Rd(b,f,_,y):Array.isArray(b)&&(b=b.map(T=>typeof T=="number"?Rd(T,f,_,y):T))),c!==void 0&&b!==void 0&&h&&!h.includes(b)&&(b=v,a&&(b=Ws(a,b))),(a&&a!==this.type||b!==void 0&&!_c(lt(b),this.type))&&(b=Ws(this.type.kind,b)),b}eachChild(){}outputDefined(){return!1}serialize(){const e=["config",this.key];return this.scope&&e.concat(this.scope),e}}class Uu{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 o=e[1];return i.scope.has(o)?new Uu(o,i.scope.get(o)):i.error(`Unknown variable "${o}". Make sure "${o}" 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 ju{constructor(e,i=[],o,a=new Cu,c=[],h,f,_){this.registry=e,this.path=i,this.scope=a,this.errors=c,this.expectedType=o,this._scope=h,this.options=f,this.iconImageUseTheme=_}get key(){let e="";for(let i=0;i<this.path.length;i++){const o=this.path[i];e+=typeof o=="string"?`['${o}']`:`[${o}]`}return e}parse(e,i,o,a,c={}){if(i||o){const h=this.expectedType,f=this.scope;a&&(this.scope=this.scope.concat(a)),this.expectedType=o||null;const _=typeof i=="number";_&&this.path.push(i);const y=this._parse(e,c);return _&&this.path.pop(),this.expectedType=h,this.scope=f,y}return this._parse(e,c)}parseObjectValue(e,i,o,a,c,h={}){const f=this.expectedType,_=this.scope;c&&(this.scope=this.scope.concat(c)),this.expectedType=a||null,this.path.push(i),this.path.push(o);const y=this._parse(e,h);return this.path.pop(),this.path.pop(),this.expectedType=f,this.scope=_,y}_parse(e,i){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 o=typeof e[0]=="string"?this.registry[e[0]]:void 0;if(o){let a=o.parse(e,this);if(!a)return null;if(this.expectedType){const c=this.expectedType,h=a.type;if(c.kind!=="string"&&c.kind!=="number"&&c.kind!=="boolean"&&c.kind!=="object"&&c.kind!=="array"||h.kind!=="value")if(c.kind!=="color"&&c.kind!=="formatted"&&c.kind!=="resolvedImage"||h.kind!=="value"&&h.kind!=="string"){if(this.checkSubtype(c,h))return null}else a=bc(a,c,i.typeAnnotation||"coerce");else a=bc(a,c,i.typeAnnotation||"assert")}if(!(a instanceof Ao)&&a.type.kind!=="resolvedImage"&&Gu(a)){const c=new Ru(this._scope,this.options,this.iconImageUseTheme);try{a=new Ao(a.type,a.evaluate(c))}catch(h){return this.error(h.message),null}}return a}return yn.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,o,a){const c=a?this.scope.concat(a):this.scope,h=this.path.slice();return typeof e=="number"&&h.push(e),typeof i=="string"&&h.push(i),new ju(this.registry,h,o||null,c,this.errors,this._scope,this.options,this.iconImageUseTheme)}_forkForSignature(){return new ju(this.registry,this.path.slice(),null,this.scope,[],this._scope,this.options,this.iconImageUseTheme)}error(e,...i){const o=`${this.key}${i.map(a=>`[${a}]`).join("")}`;this.errors.push(new jn(o,e))}checkSubtype(e,i,o){const a=Tl(e,i);return a&&this.error(a,...typeof o=="number"?[o]:[]),a}}const Cg=new Set(["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 bc(r,e,i){return i==="assert"?new dt(e,[r]):i==="coerce"?new yn(e,[r]):r}function Gu(r){if(r instanceof Uu)return Gu(r.boundExpression);if(r instanceof Xr&&r.name==="error"||r instanceof Al||r instanceof _s||r instanceof Hs||r instanceof Dt)return!1;const e=r instanceof yn||r instanceof dt;let i=!0;return r.eachChild(o=>{i=e?i&&Gu(o):i&&o instanceof Ao}),!!i&&$s(r)&&Pd(r,Cg)}function Ma(r,e){const i=r.length-1;let o,a,c=0,h=i,f=0;for(;c<=h;)if(f=Math.floor((c+h)/2),o=r[f],a=r[f+1],o<=e){if(f===i||e<a)return f;c=f+1}else{if(!(o>e))throw new ir("Input is not a number.");h=f-1}return 0}class wc{constructor(e,i,o){this.type=e,this.input=i,this.labels=[],this.outputs=[];for(const[a,c]of o)this.labels.push(a),this.outputs.push(c)}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 o=i.parse(e[1],1,ct);if(!o)return null;const a=[];let c=null;i.expectedType&&i.expectedType.kind!=="value"&&(c=i.expectedType);for(let h=1;h<e.length;h+=2){const f=h===1?-1/0:e[h],_=e[h+1],y=h,v=h+1;if(typeof f!="number")return i.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not c
1omputed expressions) for the input values.',y);if(a.length&&a.at(-1)[0]>=f)return i.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',y);const b=i.parse(_,v,c);if(!b)return null;c=c||b.type,a.push([f,b])}return new wc(c,o,a)}evaluate(e){const i=this.labels,o=this.outputs;if(i.length===1)return o[0].evaluate(e);const a=this.input.evaluate(e);if(a<=i[0])return o[0].evaluate(e);const c=i.length;return a>=i[c-1]?o[c-1].evaluate(e):o[Ma(i,a)].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 cm=.95047,um=1.08883,Tc=4/29,Rl=6/29,hm=3*Rl*Rl,Cn=Rl*Rl*Rl,Dd=Math.PI/180,qu=180/Math.PI;function Hu(r){return r>Cn?Math.pow(r,1/3):r/hm+Tc}function Ec(r){return r>Rl?r*r*r:hm*(r-Tc)}function zd(r){return 255*(r<=.0031308?12.92*r:1.055*Math.pow(r,1/2.4)-.055)}function Ld(r){return(r/=255)<=.04045?r/12.92:Math.pow((r+.055)/1.055,2.4)}function dm(r){const e=Ld(r.r),i=Ld(r.g),o=Ld(r.b),a=Hu((.4124564*e+.3575761*i+.1804375*o)/cm),c=Hu((.2126729*e+.7151522*i+.072175*o)/1);return{l:116*c-16,a:500*(a-c),b:200*(c-Hu((.0193339*e+.119192*i+.9503041*o)/um)),alpha:r.a}}function fm(r){let e=(r.l+16)/116,i=isNaN(r.a)?e:e+r.a/500,o=isNaN(r.b)?e:e-r.b/200;return e=1*Ec(e),i=cm*Ec(i),o=um*Ec(o),new $t(zd(3.2404542*i-1.5371385*e-.4985314*o),zd(-.969266*i+1.8760108*e+.041556*o),zd(.0556434*i-.2040259*e+1.0572252*o),r.alpha)}function pm(r,e,i){const o=e-r;return r+i*(o>180||o<-180?o-360*Math.round(o/360):o)}const Dl={forward:dm,reverse:fm,interpolate:function(r,e,i){return{l:yt(r.l,e.l,i),a:yt(r.a,e.a,i),b:yt(r.b,e.b,i),alpha:yt(r.alpha,e.alpha,i)}}},$o={forward:function(r){const{l:e,a:i,b:o}=dm(r),a=Math.atan2(o,i)*qu;return{h:a<0?a+360:a,c:Math.sqrt(i*i+o*o),l:e,alpha:r.a}},reverse:function(r){const e=r.h*Dd,i=r.c;return fm({l:r.l,a:Math.cos(e)*i,b:Math.sin(e)*i,alpha:r.alpha})},interpolate:function(r,e,i){return{h:pm(r.h,e.h,i),c:yt(r.c,e.c,i),l:yt(r.l,e.l,i),alpha:yt(r.alpha,e.alpha,i)}}};var Sc=Object.freeze({__proto__:null,hcl:$o,lab:Dl});class Mn{constructor(e,i,o,a,c){this.type=e,this.operator=i,this.interpolation=o,this.input=a,this.labels=[],this.outputs=[];for(const[h,f]of c)this.labels.push(h),this.outputs.push(f)}static interpolationFactor(e,i,o,a){let c=0;if(e.name==="exponential")c=Fd(i,e.base,o,a);else if(e.name==="linear")c=Fd(i,1,o,a);else if(e.name==="cubic-bezier"){const h=e.controlPoints;c=dl(h[0],h[1],h[2],h[3])(Fd(i,1,o,a))}return c}static parse(e,i){let[o,a,c,...h]=e;if(!Array.isArray(a)||a.length===0)return i.error("Expected an interpolation type expression.",1);if(a[0]==="linear")a={name:"linear"};else if(a[0]==="exponential"){const y=a[1];if(typeof y!="number")return i.error("Exponential interpolation requires a numeric base.",1,1);a={name:"exponential",base:y}}else{if(a[0]!=="cubic-bezier")return i.error(`Unknown interpolation type ${String(a[0])}`,1,0);{const y=a.slice(1);if(y.length!==4||y.some(v=>typeof v!="number"||v<0||v>1))return i.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);a={name:"cubic-bezier",controlPoints:y}}}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(c=i.parse(c,2,ct),!c)return null;const f=[];let _=null;o==="interpolate-hcl"||o==="interpolate-lab"?_=_n:i.expectedType&&i.expectedType.kind!=="value"&&(_=i.expectedType);for(let y=0;y<h.length;y+=2){const v=h[y],b=h[y+1],T=y+3,S=y+4;if(typeof v!="number")return i.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',T);if(f.length&&f.at(-1)[0]>=v)return i.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',T);const C=i.parse(b,S,_);if(!C)return null;_=_||C.type,f.push([v,C])}return _.kind==="number"||_.kind==="color"||_.kind==="array"&&_.itemType.kind==="number"&&typeof _.N=="number"?new Mn(_,o,a,c,f):i.error(`Type ${lr(_)} is not interpolatable.`)}evaluate(e){const i=this.labels,o=this.outputs;if(i.length===1)return o[0].evaluate(e);const a=this.input.evaluate(e);if(a<=i[0])return o[0].evaluate(e);const c=i.length;if(a>=i[c-1])return o[c-1].evaluate(e);const h=Ma(i,a),f=Mn.interpolationFactor(this.interpolation,a,i[h],i[h+1]),_=o[h].evaluate(e),y=o[h+1].evaluate(e);return this.operator==="interpolate"?nt[this.type.kind.toLowerCase()](_,y,f):this.operator==="interpolate-hcl"?$o.reverse($o.interpolate($o.forward(_),$o.forward(y),f)):Dl.reverse(Dl.interpolate(Dl.forward(_),Dl.forward(y),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 o=0;o<this.labels.length;o++)i.push(this.labels[o],this.outputs[o].serialize());return i}}function Fd(r,e,i,o){const a=o-i,c=r-i;return a===0?0:e===1?c/a:(Math.pow(e,c)-1)/(Math.pow(e,a)-1)}class ys{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 o=null;const a=i.expectedType;a&&a.kind!=="value"&&(o=a);const c=[];for(const f of e.slice(1)){const _=i.parse(f,1+c.length,o,void 0,{typeAnnotation:"omit"});if(!_)return null;o=o||_.type,c.push(_)}const h=a&&c.some(f=>Tl(a,f.type));return new ys(h?Qt:o,c)}evaluate(e){let i,o=null,a=0;for(const c of this.args){if(a++,o=c.evaluate(e),o&&o instanceof Wr&&!o.available&&(i||(i=o),o=null,a===this.args.length))return i;if(o!==null)break}return o}
1eachChild(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 Mg=/[^a-zA-Z0-9_]/;class $u{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 o=[];for(let c=1;c<e.length-1;c+=2){const h=e[c];if(typeof h!="string")return i.error(`Expected string, but found ${typeof h} instead.`,c);if(Mg.test(h))return i.error("Variable names must contain only alphanumeric characters or '_'.",c);const f=i.parse(e[c+1],c+1);if(!f)return null;o.push([h,f])}const a=i.parse(e.at(-1),e.length-1,i.expectedType,o);return a?new $u(o,a):null}outputDefined(){return this.result.outputDefined()}serialize(){const e=["let"];for(const[i,o]of this.bindings)e.push(i,o.serialize());return e.push(this.result.serialize()),e}}class Od{constructor(e,i,o){this.type=e,this.index=i,this.input=o}static parse(e,i){if(e.length!==3)return i.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const o=i.parse(e[1],1,ct),a=i.parse(e[2],2,$r(i.expectedType||Qt));return o&&a?new Od(a.type.itemType,o,a):null}evaluate(e){const i=this.index.evaluate(e),o=this.input.evaluate(e);if(i<0)throw new ir("Array index out of bounds: negative index");if(i>=o.length)throw new ir("Array index out of bounds: index exceeds array size");if(i!==Math.floor(i))throw new ir("Array index must be an integer. Use at-interpolated for fractional indices");return o[i]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}class Zu{constructor(e,i,o){this.type=e,this.index=i,this.input=o}static parse(e,i){if(e.length!==3)return i.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const o=i.parse(e[1],1,ct),a=i.parse(e[2],2,$r(i.expectedType||Qt));return o&&a?new Zu(a.type.itemType,o,a):null}evaluate(e){const i=this.index.evaluate(e),o=this.input.evaluate(e);if(i<0)throw new ir(`Array index out of bounds: ${i} < 0.`);if(i>o.length-1)throw new ir(`Array index out of bounds: ${i} > ${o.length-1}.`);if(i===Math.floor(i))return o[i];const a=Math.floor(i),c=Math.ceil(i),h=o[a],f=o[c];if(typeof h!="number"||typeof f!="number")throw new ir(`Cannot interpolate between non-number values at index ${i}.`);return yt(h,f,i-a)}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}serialize(){return["at-interpolated",this.index.serialize(),this.input.serialize()]}}class Wu{constructor(e,i){this.type=Yt,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 o=i.parse(e[1],1,Qt),a=i.parse(e[2],2,Qt);return o&&a?Mu(o.type,[Yt,Jt,ct,js,Qt])?new Wu(o,a):(i.error(`Expected first argument to be of type boolean, string, number or null, but found ${lr(o.type)} instead`),null):null}evaluate(e){const i=this.needle.evaluate(e),o=this.haystack.evaluate(e);if(o==null)return!1;if(!El(i,["boolean","string","number","null"]))throw new ir(`Expected first argument to be of type boolean, string, number or null, but found ${lr(lt(i))} instead.`);if(!El(o,["string","array"]))throw new ir(`Expected second argument to be of type array or string, but found ${lr(lt(o))} instead.`);return o.includes(i)}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}}class Ic{constructor(e,i,o){this.type=ct,this.needle=e,this.haystack=i,this.fromIndex=o}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 o=i.parse(e[1],1,Qt),a=i.parse(e[2],2,Qt);if(!o||!a)return null;if(!Mu(o.type,[Yt,Jt,ct,js,Qt]))return i.error(`Expected first argument to be of type boolean, string, number or null, but found ${lr(o.type)} instead`),null;if(e.length===4){const c=i.parse(e[3],3,ct);return c?new Ic(o,a,c):null}return new Ic(o,a)}evaluate(e){const i=this.needle.evaluate(e),o=this.haystack.evaluate(e);if(!El(i,["boolean","string","number","null"]))throw new ir(`Expected first argument to be of type boolean, string, number or null, but found ${lr(lt(i))} instead.`);if(!El(o,["string","array"]))throw new ir(`Expected second argument to be of type array or string, but found ${lr(lt(o))} instead.`);if(this.fromIndex){const a=this.fromIndex.evaluate(e);return o.indexOf(i,a)}return o.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 Pn{constructor(e,i,o,a,c,h){this.inputType=e,this.type=i,this.input=o,this.cases=a,this.outputs=c,this.otherwise=h}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 o,a;i.expectedType&&i.expectedType.kind!=="value"&&(a=i.expectedType);const c={},h=[];for(let y=2;y<e.length-1;y+=2){let v=e[y];const b=e[y+1];if(Array.isArray(v)||(v=[v]),v.length===0)return i.error("Expected at least one branch label.",y);
vendor: 4,153 bytes, line 1
1for(const S of v){if(typeof S!="number"&&typeof S!="string")return i.error("Branch labels must be numbers or strings.",y);if(typeof S=="number"&&Math.abs(S)>Number.MAX_SAFE_INTEGER)return i.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`,y);if(typeof S=="number"&&Math.floor(S)!==S)return i.error("Numeric branch labels must be integer values.",y);if(o){if(i.checkSubtype(o,lt(S),y))return null}else o=lt(S);if(c[String(S)]!==void 0)return i.error("Branch labels must be unique.",y);c[String(S)]=h.length}const T=i.parse(b,y,a);if(!T)return null;a=a||T.type,h.push(T)}const f=i.parse(e[1],1,Qt);if(!f)return null;const _=i.parse(e.at(-1),e.length-1,a);return _?f.type.kind!=="value"&&i.checkSubtype(o,f.type,1)?null:new Pn(o,a,f,c,h,_):null}evaluate(e){const i=this.input.evaluate(e);return(_c(lt(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(),o=[],a={};for(const h of i){const f=a[this.cases[h]];f===void 0?(a[this.cases[h]]=o.length,o.push([this.cases[h],[h]])):o[f][1].push(h)}const c=h=>this.inputType.kind==="number"?Number(h):h;for(const[h,f]of o)e.push(f.length===1?c(f[0]):f.map(c)),e.push(this.outputs[h].serialize());return e.push(this.otherwise.serialize()),e}}class ro{constructor(e,i,o){this.type=e,this.branches=i,this.otherwise=o}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 o;i.expectedType&&i.expectedType.kind!=="value"&&(o=i.expectedType);const a=[];for(let h=1;h<e.length-1;h+=2){const f=i.parse(e[h],h,Yt);if(!f)return null;const _=i.parse(e[h+1],h+1,o);if(!_)return null;a.push([f,_]),o=o||_.type}const c=i.parse(e.at(-1),e.length-1,o);return c?new ro(o,a,c):null}evaluate(e){for(const[i,o]of this.branches)if(i.evaluate(e))return o.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(const[i,o]of this.branches)e(i),e(o);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 Co{constructor(e,i,o,a){this.type=e,this.input=i,this.beginIndex=o,this.endIndex=a}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 o=i.parse(e[1],1,Qt),a=i.parse(e[2],2,ct);if(!o||!a)return null;if(!Mu(o.type,[$r(Qt),Jt,Qt]))return i.error(`Expected first argument to be of type array or string, but found ${lr(o.type)} instead`),null;if(e.length===4){const c=i.parse(e[3],3,ct);return c?new Co(o.type,o,a,c):null}return new Co(o.type,o,a)}evaluate(e){const i=this.input.evaluate(e),o=this.beginIndex.evaluate(e);if(!El(i,["string","array"]))throw new ir(`Expected first argument to be of type array or string, but found ${lr(lt(i))} instead.`);if(this.endIndex){const a=this.endIndex.evaluate(e);return i.slice(o,a)}return i.slice(o)}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 no{constructor(e,i){this.type=$r(Jt),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 o=i.parse(e[1],1,Jt),a=i.parse(e[2],2,Jt);return o&&a?new no(o,a):void 0}evaluate(e){const i=this.str.evaluate(e),o=this.delimiter.evaluate(e);return i.split(o)}eachChild(e){e(this.str),e(this.delimiter)}outputDefined(){return!1}serialize(){return["split",this.str.serialize(),this.delimiter.serialize()]}}function xs(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 Ac(r,e,i,o){return o.compare(e,i)===0}function Pa(r,e,i){const o=r!=="=="&&r!=="!=";return class J1{constructor(c,h,f){this.type=Yt,this.lhs=c,this.rhs=h,this.collator=f,this.hasUntypedArgument=c.type.kind==="value"||h.type.kind==="value"}static parse(c,h){if(c.length!==3&&c.length!==4)return h.error("Expected two or three arguments.");const f=c[0];let _=h.parse(c[1],1,Qt);if(!_)return null;if(!xs(f,_.type))return h.error(`"${f}" comparisons are not supported for type '${lr(_.type)}'.`,1);let y=h.parse(c[2],2,Qt);if(!y)return null;if(!xs(f,y.type))return h.error(`"${f}" comparisons are not supported for type '${lr(y.type)}'.`,2);if(_.type.kind!==y.type.kind&&_.type.kind!=="value"&&y.type.kind!=="value")return h.error(`Cannot compare types '${lr(_.type)}' and '${lr(y.type)}'.`);o&&(_.type.kind==="value"&&y.type.kind!=="value"?_=new dt(y.type,[_]):_.type.kind!=="value"&&y.type.kind==="value"&&(y=new dt(_.type,[y])));let v=null;if(c.length===4){if(_.type.kind!=="string"&&y.type.kind!=="string"&&_.type.kind!=="value"&&y.type.kind!=="value")return h.error("Cannot use collator to compare non-string types.");if(v=h.parse(c[3],3,bl),!v)return null}return new J1(_,y,v)}evaluate(c){const h=this.lhs.evaluate(c),f=this.rhs.evaluate(c);if(o&&this.hasUntypedArgument){const _=lt(h),y=lt(f);if(_.kind!==y.kind||_.kind!=="string"&&_.kind!=="number")throw new ir(`Expected arguments for "${r}" to be (string, string) or (number, number), but found (${_.kind}, ${y.kind}) instead.`)}if(this.collator&&!o&&this.hasUntypedArgument){const _=lt(h),y=lt(f);if(_.kind!=="string"||y.kind!=="string")return e(c,h,f)}return this.collator?i(c,h,f,this.collator.evaluate(c)):e(c,h,f)}eachChild(c){c(this.lhs),c(this.rhs),this.collator&&c(this.collator)}outputDefined(){return!0}serialize(){const c=[r];return this.eachChild(h=>{c.push(h.serialize())}),c}}}const Xu=Pa("==",function(r,e,i){return e===i},Ac),mm=Pa("!=",function(r,e,i){return e!==i},function(r,e,i,o){return!Ac(0,e,i,o)}),Pg=Pa("<",function(r,e,i){return e<i},function(r,e,i,o){return o.compare(e,i)<0}),zl=Pa(">",function(r,e,i){return e>i},function(r,e,i,o){return o.compare(e,i)>0}),Bd=Pa("<=",function(r,e,i){return e<=i},function(r,e,i,o){return o.compare(e,i)<=0}),_m=Pa(">=",function(r,e,i){return e>=i},function(r,e,i,o){return o.compare(e,i)>=0});class Xs{constructor(e,i,o,a,c,h){this.type=Jt,this.number=e,this.locale=i,this.currency=o,this.unit=a,this.minFractionDigits=c,this.maxFractionDigits=h}static parse(e,i){if(e.length!==3)return i.error("Expected two arguments.");const o=i.parse(e[1],1,ct);if(!o)return null;const a=e[2];if(typeof a!="object"||Array.isArray(a))return i.error("NumberFormat options argument must be an object.");let c=null;if(a.locale&&(c=i.parseObjectValue(a.locale,2,"locale",Jt),!c))return null;let h=null;if(a.currency&&(h=i.parseObjectValue(a.currency,2,"currency",Jt),!h))return null;let f=null;if(a.unit&&(f=i.parseObjectValue(a.unit,2,"unit",Jt),!f))return null;let _=null;if(a["min-fraction-digits"]&&(_=i.parseObjectValue(a["min-fraction-digits"],2,"min-fraction-digits",ct),!_))return null;let y=null;return a["max-fraction-digits"]&&(y=i.parseObjectValue(a["max-fraction-digits"],2,"max-fraction-digits",ct),!y)?null:new Xs(o,c,h,f,_,y)}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 Ll{constructor(e){this.type=ct,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 o=i.parse(e[1],1);return o?o.type.kind!=="array"&&o.type.kind!=="string"&&o.type.kind!=="value"?(i.error(`Expected argument of type string or array, but found ${lr(o.type)} instead.`),null):new Ll(o):null}evaluate(e){const i=this.input.evaluate(e);if(typeof i=="string"||Array.isArray(i))return i.length;throw new ir(`Expected value to be of type string or array, but found ${lr(lt(i))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}serialize(){const e=["length"];return this.eachChild(i=>{e.push(i.serialize())}),e}}function kd(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 Mo={"==":Xu,"!=":mm,">":zl,"<":Pg,">=":_m,"<=":Bd,array:dt,at:Od,"at-interpolated":Zu,boolean:dt,case:ro,coalesce:ys,collator:Al,format:Il,image:Ta,in:Wu,"index-of":Ic,interpolate:Mn,"interpolate-hcl":Mn,"interpolate-lab":Mn,length:Ll,let:$u,literal:Ao,match:Pn,number:dt,"number-format":Xs,object:dt,slice:Co,step:wc,string:dt,"to-boolean":yn,"to-color":yn,"to-number":yn,"to-string":yn,var:Uu,within:_s,distance:Hs,config:Dt,split:no};function gm(r,[e,i,o,a]){e=e.evaluate(r),i=i.evaluate(r),o=o.evaluate(r);const c=a?a.evaluate(r):1,h=ps(e,i,o,c);if(h)throw new ir(h);return new $t(e/255,i/255,o/255,c)}function ym(r,[e,i,o,a]){e=e.evaluate(r),i=i.evaluate(r),o=o.evaluate(r);const c=a?a.evaluate(r):1,h=(function(y,v,b,T){return typeof y=="number"&&y>=0&&y<=360?typeof v=="number"&&v>=0&&v<=100&&typeof b=="number"&&b>=0&&b<=100?T===void 0||typeof T=="number"&&T>=0&&T<=1?null:`Invalid hsla value [${[y,v,b,T].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid hsla value [${(typeof T=="number"?[y,v,b,T]:[y,v,b]).join(", ")}]: 's', and 'l' must be between 0 and 100.`:`Invalid hsla value [${(typeof T=="number"?[y,v,b,T]:[y,v,b]).join(", ")}]: 'h' must be between 0 and 360.`})(e,i,o,c);if(h)throw new ir(h);const f=`hsla(${e}, ${i}%, ${o}%, ${c})`,_=$t.parse(f);if(!_)throw new ir(`Failed to parse HSLA color: ${f}`);return _}function Yu(r,e){return r in e}function Nd(r,e){const i=e[r];return i===void 0?null:i}function Ys(r){return{type:r}}function Cc(r){if(r instanceof Dt)return new Set([r.key]);let e=new Set;return r.eachChild(i=>{e=new Set([...e,...Cc(i)])}),e}function Ku(r){if(r instanceof Xr&&r.name==="is-active-floor")return!0;let e=!1;return r.eachChild(i=>{!e&&Ku(i)&&(e=!0)}),e}function xm(r){return{result:"success",value:r}}function Ks(r){return{result:"error",value:r}}function Vd(r,e){return!!r&&!!r.parameters&&r.parameters.includes(e)}function Ju(r){return r["property-type"]==="data-driven"}function Ud(r){return Vd(r.expression,"measure-light")}
vendor: 37,220 bytes, line 1
1function jd(r){return Vd(r.expression,"zoom")}function Zo(r){return!!r.expression&&r.expression.interpolated}function Qu(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)}function Rg(r){return r}function vm(r,e){const i=e.type==="color",o=r.stops&&typeof r.stops[0][0]=="object",a=o||!(o||r.property!==void 0),c=r.type||(Zo(e)?"exponential":"interval");if(i&&((r={...r}).stops&&(r.stops=r.stops.map(y=>[y[0],$t.parse(y[1])])),r.default=$t.parse(r.default?r.default:e.default)),r.colorSpace&&r.colorSpace!=="rgb"&&!Sc[r.colorSpace])throw new Error(`Unknown color space: ${r.colorSpace}`);let h,f,_;if(c==="exponential")h=Gd;else if(c==="interval")h=Dg;else if(c==="categorical"){h=eh,f=Object.create(null);for(const y of r.stops)f[y[0]]=y[1];_=typeof r.stops[0][0]}else{if(c!=="identity")throw new Error(`Unknown function type "${c}"`);h=zg}if(o){const y={},v=[];for(let S=0;S<r.stops.length;S++){const C=r.stops[S],P=C[0].zoom;y[P]===void 0&&(y[P]={zoom:P,type:r.type,property:r.property,default:r.default,stops:[]},v.push(P)),y[P].stops.push([C[0].value,C[1]])}const b=[];for(const S of v)b.push([y[S].zoom,vm(y[S],e)]);const T={name:"linear"};return{kind:"composite",interpolationType:T,interpolationFactor:Mn.interpolationFactor.bind(void 0,T),zoomStops:b.map(S=>S[0]),evaluate:({zoom:S},C)=>Gd({stops:b,base:r.base},e,S).evaluate(S,C)}}if(a){const y=c==="exponential"?{name:"exponential",base:r.base!==void 0?r.base:1}:null;return{kind:"camera",interpolationType:y,interpolationFactor:Mn.interpolationFactor.bind(void 0,y),zoomStops:r.stops.map(v=>v[0]),evaluate:({zoom:v})=>h(r,e,v,f,_)}}return{kind:"source",evaluate(y,v){const b=v&&v.properties?v.properties[r.property]:void 0;return b===void 0?Mc(r.default,e.default):h(r,e,b,f,_)}}}function Mc(r,e,i){return r!==void 0?r:e!==void 0?e:i!==void 0?i:void 0}function eh(r,e,i,o,a){return Mc(typeof i===a?o[i]:void 0,r.default,e.default)}function Dg(r,e,i){if(!Pu(i))return Mc(r.default,e.default);const o=r.stops.length;if(o===1||i<=r.stops[0][0])return r.stops[0][1];if(i>=r.stops[o-1][0])return r.stops[o-1][1];const a=Ma(r.stops.map(c=>c[0]),i);return r.stops[a][1]}function Gd(r,e,i){const o=r.base!==void 0?r.base:1;if(!Pu(i))return Mc(r.default,e.default);const a=r.stops.length;if(a===1||i<=r.stops[0][0])return r.stops[0][1];if(i>=r.stops[a-1][0])return r.stops[a-1][1];const c=Ma(r.stops.map(v=>v[0]),i),h=(function(v,b,T,S){const C=S-T,P=v-T;return C===0?0:b===1?P/C:(Math.pow(b,P)-1)/(Math.pow(b,C)-1)})(i,o,r.stops[c][0],r.stops[c+1][0]),f=r.stops[c][1],_=r.stops[c+1][1];let y=nt[e.type]||Rg;if(r.colorSpace&&r.colorSpace!=="rgb"){const v=Sc[r.colorSpace];y=(b,T)=>v.reverse(v.interpolate(v.forward(b),v.forward(T),h))}return typeof f.evaluate=="function"?{evaluate(...v){const b=f.evaluate.apply(void 0,v),T=_.evaluate.apply(void 0,v);if(b!==void 0&&T!==void 0)return y(b,T,h)}}:y(f,_,h)}function zg(r,e,i){return e.type==="color"?i=$t.parse(i):e.type==="formatted"?i=Zr.fromString(i.toString()):e.type==="resolvedImage"?i=Wr.build(i.toString()):_d(i)===e.type||e.type==="enum"&&e.values[i]||(i=void 0),Mc(i,r.default,e.default)}Xr.register(Mo,{error:[{kind:"error"},[Jt],(r,[e])=>{throw new ir(e.evaluate(r))}],typeof:[Jt,[Qt],(r,[e])=>lr(lt(e.evaluate(r)))],"to-rgba":[$r(ct,4),[_n],(r,[e])=>e.evaluate(r).toNonPremultipliedRenderColor(null).toArray()],"to-hsla":[$r(ct,4),[_n],(r,[e])=>e.evaluate(r).toNonPremultipliedRenderColor(null).toHslaArray()],rgb:[_n,[ct,ct,ct],gm],rgba:[_n,[ct,ct,ct,ct],gm],hsl:[_n,[ct,ct,ct],ym],hsla:[_n,[ct,ct,ct,ct],ym],has:{type:Yt,overloads:[[[Jt],(r,[e])=>Yu(e.evaluate(r),r.properties())],[[Jt,qo],(r,[e,i])=>Yu(e.evaluate(r),i.evaluate(r))]]},get:{type:Qt,overloads:[[[Jt],(r,[e])=>Nd(e.evaluate(r),r.properties())],[[Jt,qo],(r,[e,i])=>Nd(e.evaluate(r),i.evaluate(r))]]},"feature-state":[Qt,[Jt],(r,[e])=>Nd(e.evaluate(r),r.featureState||{})],properties:[qo,[],r=>r.properties()],"geometry-type":[Jt,[],r=>r.geometryType()],worldview:[Jt,[],r=>r.globals.worldview||""],"is-active-floor":[Yt,Ys(Jt),(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(o=>{const a=o.evaluate(r);return i.has(a)})}],id:[Qt,[],r=>r.id()],zoom:[ct,[],r=>r.globals.zoom],pitch:[ct,[],r=>r.globals.pitch||0],"distance-from-center":[ct,[],r=>r.distanceFromCenter()],"measure-light":[ct,[Jt],(r,[e])=>r.measureLight(e.evaluate(r))],"heatmap-density":[ct,[],r=>r.globals.heatmapDensity||0],"line-progress":[ct,[],r=>r.globals.lineProgress||0],"raster-value":[ct,[],r=>r.globals.rasterValue||0],"raster-particle-speed":[ct,[],r=>r.globals.rasterParticleSpeed||0],"sky-radial-progress":[ct,[],r=>r.globals.skyRadialProgress||0],accumulated:[Qt,[],r=>r.globals.accumulated===void 0?null:r.globals.accumulated],"+":[ct,Ys(ct),(r,e)=>{let i=0;for(const o of e)i+=o.evaluate(r);return i}],"*":[ct,Ys(ct),(r,e)=>{let i=1;for(const o of e)i*=o.evaluate(r);return i}],"-":{type:ct,overloads:[[[ct,ct],(r,[e,i])=>e.evaluate(r)-i.evaluate(r)],[[ct],(r,[e])=>-e.evaluate(r)]]},"/":[ct,[ct,ct],(r,[e,i])=>e.evaluate(r)/i.evaluate(r)],"%":[ct,[ct,ct],(r,[e,i])=>e.evaluate(r)%i.evaluate(r)],ln2:[ct,[],()=>Math.LN2],pi:[ct,[],()=>Math.PI],e:[ct,[],()=>Math.E],"^":[ct,[ct,ct],(r,[e,i])=>Math.pow(e.evaluate(r),i.evaluate(r))],sqrt:[ct,[ct],(r,[e])=>Math.sqrt(e.evaluate(r))],log10:[ct,[ct],(r,[e])=>Math.log(e.evaluate(r))/Math.LN10],ln:[ct,[ct],(r,[e])=>Math.log(e.evaluate(r))],log2:[ct,[ct],(r,[e])=>Math.log2(e.evaluate(r))],sin:[ct,[ct],(r,[e])=>Math.sin(e.evaluate(r))],cos:[ct,[ct],(r,[e])=>Math.cos(e.evaluate(r))],tan:[ct,[ct],(r,[e])=>Math.tan(e.evaluate(r))],asin:[ct,[ct],(r,[e])=>Math.asin(e.evaluate(r))],acos:[ct,[ct],(r,[e])=>Math.acos(e.evaluate(r))],atan:[ct,[ct],(r,[e])=>Math.atan(e.evaluate(r))],min:[ct,Ys(ct),(r,e)=>Math.min(...e.map(i=>i.evaluate(r)))],max:[ct,Ys(ct),(r,e)=>Math.max(...e.map(i=>i.evaluate(r)))],abs:[ct,[ct],(r,[e])=>Math.abs(e.evaluate(r))],round:[ct,[ct],(r,[e])=>{const i=e.evaluate(r);return i<0?-Math.round(-i):Math.round(i)}],floor:[ct,[ct],(r,[e])=>Math.floor(e.evaluate(r))],ceil:[ct,[ct],(r,[e])=>Math.ceil(e.evaluate(r))],"filter-==":[Yt,[Jt,Qt],(r,[e,i])=>r.properties()[e.value]===i.value],"filter-id-==":[Yt,[Qt],(r,[e])=>r.id()===e.value],"filter-type-==":[Yt,[Jt],(r,[e])=>r.geometryType()===e.value],"filter-<":[Yt,[Jt,Qt],(r,[e,i])=>{const o=r.properties()[e.value],a=i.value;return typeof o==typeof a&&o<a}],"filter-id-<":[Yt,[Qt],(r,[e])=>{const i=r.id(),o=e.value;return typeof i==typeof o&&i<o}],"filter->":[Yt,[Jt,Qt],(r,[e,i])=>{const o=r.properties()[e.value],a=i.value;return typeof o==typeof a&&o>a}],"filter-id->":[Yt,[Qt],(r,[e])=>{const i=r.id(),o=e.value;return typeof i==typeof o&&i>o}],"filter-<=":[Yt,[Jt,Qt],(r,[e,i])=>{const o=r.properties()[e.value],a=i.value;return typeof o==typeof a&&o<=a}],"filter-id-<=":[Yt,[Qt],(r,[e])=>{const i=r.id(),o=e.value;return typeof i==typeof o&&i<=o}],"filter->=":[Yt,[Jt,Qt],(r,[e,i])=>{const o=r.properties()[e.value],a=i.value;return typeof o==typeof a&&o>=a}],"filter-id->=":[Yt,[Qt],(r,[e])=>{const i=r.id(),o=e.value;return typeof i==typeof o&&i>=o}],"filter-has":[Yt,[Qt],(r,[e])=>e.value in r.properties()],"filter-has-id":[Yt,[],r=>r.id()!==null&&r.id()!==void 0],"filter-type-in":[Yt,[$r(Jt)],(r,[e])=>e.value.includes(r.geometryType())],"filter-id-in":[Yt,[$r(Qt)],(r,[e])=>e.value.includes(r.id())],"filter-in-small":[Yt,[Jt,$r(Qt)],(r,[e,i])=>i.value.includes(r.properties()[e.value])],"filter-in-large":[Yt,[Jt,$r(Qt)],(r,[e,i])=>(function(o,a,c,h){for(;c<=h;){const f=c+h>>1;if(a[f]===o)return!0;a[f]>o?h=f-1:c=f+1}return!1})(r.properties()[e.value],i.value,0,i.value.length-1)],all:{type:Yt,overloads:[[[Yt,Yt],(r,[e,i])=>e.evaluate(r)&&i.evaluate(r)],[Ys(Yt),(r,e)=>{for(const i of e)if(!i.evaluate(r))return!1;return!0}]]},any:{type:Yt,overloads:[[[Yt,Yt],(r,[e,i])=>e.evaluate(r)||i.evaluate(r)],[Ys(Yt),(r,e)=>{for(const i of e)if(i.evaluate(r))return!0;return!1}]]},"!":[Yt,[Yt],(r,[e])=>!e.evaluate(r)],"is-supported-script":[Yt,[Jt],(r,[e])=>{const i=r.globals&&r.globals.isSupportedScript;return!i||i(e.evaluate(r))}],upcase:[Jt,[Jt],(r,[e])=>e.evaluate(r).toUpperCase()],downcase:[Jt,[Jt],(r,[e])=>e.evaluate(r).toLowerCase()],concat:[Jt,Ys(Qt),(r,e)=>e.map(i=>Io(i.evaluate(r))).join("")],"resolved-locale":[Jt,[bl],(r,[e])=>e.evaluate(r).resolvedLocale()],random:[ct,[ct,ct,Qt],(r,e)=>{const[i,o,a]=e.map(h=>h.evaluate(r));if(i>o||i===o)return i;let c;if(typeof a=="string")c=(function(h){let f=0;if(h.length===0)return f;for(let _=0;_<h.length;_++)f=(f<<5)-f+h.charCodeAt(_),f&=f;return f})(a);else{if(typeof a!="number")throw new ir(`Invalid seed input: ${a}`);c=a}return i+kd(c)()*(o-i)}]});class th{constructor(e,i,o,a,c){this.expression=e,this._warningHistory={},this._scope=o,this._options=a,this._iconImageUseTheme=c,this._evaluator=new Ru(o,a,c),this._defaultValue=i?(function(h){return h.type==="color"&&(Qu(h.default)||Array.isArray(h.default))?new $t(0,0,0,0):h.type==="color"?$t.parse(h.default)||null:h.default===void 0?null:h.default})(i):null,this._enumValues=i&&i.type==="enum"?i.values:null,this.configDependencies=Cc(e),this.isIndoorDependent=Ku(e)}evaluateWithoutErrorHandling(e,i,o,a,c,h,f,_){return this._evaluator.globals=e,this._evaluator.feature=i,this._evaluator.featureState=o,this._evaluator.canonical=a||null,this._evaluator.availableImages=c||null,this._evaluator.formattedSection=h,this._evaluator.featureTileCoord=f||null,this._evaluator.featureDistanceData=_||null,this.expression.evaluate(this._evaluator)}evaluate(e,i,o,a,c,h,f,_,y){this._evaluator||(this._evaluator=new Ru(this._scope,this._options,this._iconImageUseTheme)),this._evaluator.globals=e,this._evaluator.feature=i||null,this._evaluator.featureState=o||null,this._evaluator.canonical=a||null,this._evaluator.availableImages=c||null,this._evaluator.formattedSection=h||null,this._evaluator.featureTileCoord=f||null,this._evaluator.featureDistanceData=_||null,this._evaluator.iconImageUseTheme=y||null;try{const v=this.expression.evaluate(this._evaluator);if(v==null||typeof v=="number"&&v!=v)return this._defaultValue;if(this._enumValues&&!(v in this._enumValues))throw new ir(`Expected value to be one of ${Object.keys(this._enumValues).map(b=>JSON.stringify(b)).join(", ")}, but found ${JSON.stringify(v)} instead.`);return v}catch(v){const b=v;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 ih(r){return Array.isArray(r)&&r.length>0&&typeof r[0]=="string"&&r[0]in Mo}function Fl(r,e,i,o,a){const c=new ju(Mo,[],e?(function(f){const _={color:_n,string:Jt,number:ct,enum:Jt,boolean:Yt,formatted:gn,resolvedImage:wl};return f.type==="array"?$r(_[f.value]||Qt,f.length):_[f.type]})(e):void 0,void 0,void 0,i,o,a),h=c.parse(r,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return h?xm(new th(h,e,i,o,a)):Ks(c.errors)}class rh{constructor(e,i,o,a){this.kind=e,this._styleExpression=i,this.isLightConstant=o,this.isLineProgressConstant=a,this.isStateDependent=e!=="constant"&&!Ca(i.expression),this.configDependencies=Cc(i.expression),this.isIndoorDependent=Ku(i.expression)}evaluateWithoutErrorHandling(e,i,o,a,c,h){return this._styleExpression.evaluateWithoutErrorHandling(e,i,o,a,c,h)}evaluate(e,i,o,a,c,h,f){return this._styleExpression.evaluate(e,i,o,a,c,h,void 0,void 0,f)}}class Pc{constructor(e,i,o,a,c,h){this.kind=e,this.zoomStops=o,this._styleExpression=i,this.isStateDependent=e!=="camera"&&!Ca(i.expression),this.isIndoorDependent=Ku(i.expression),this.isLightConstant=c,this.isLineProgressConstant=h,this.configDependencies=Cc(i.expression),this.interpolationType=a}evaluateWithoutErrorHandling(e,i,o,a,c,h){return this._styleExpression.evaluateWithoutErrorHandling(e,i,o,a,c,h)}evaluate(e,i,o,a,c,h){return this._styleExpression.evaluate(e,i,o,a,c,h)}interpolationFactor(e,i,o){return this.interpolationType?Mn.interpolationFactor(this.interpolationType,e,i,o):0}}function bm(r,e,i,o,a){if((r=Fl(r,e,i,o,a)).result==="error")return r;const c=r.value.expression,h=$s(c);if(!h&&!Ju(e))return Ks([new jn("","data expressions not supported")]);const f=Zs(c,["zoom","pitch","distance-from-center"]);if(!f&&!jd(e))return Ks([new jn("","zoom expressions not supported")]);const _=Zs(c,["measure-light"]);if(!_&&!Ud(e))return Ks([new jn("","measure-light expression not supported")]);const y=Zs(c,["line-progress"]);if(!y&&!(function(T){return Vd(T.expression,"line-progress")})(e))return Ks([new jn("","line-progress expression not supported")]);const v=e.expression&&e.expression.relaxZoomRestriction,b=Rc(c);return b||f||v?b instanceof jn?Ks([b]):b instanceof Mn&&!Zo(e)?Ks([new jn("",'"interpolate" expressions cannot be used with this property')]):xm(b?new Pc(h&&y?"camera":"composite",r.value,b.labels,b instanceof Mn?b.interpolation:void 0,_,y):new rh(h&&y?"constant":"source",r.value,_,y)):Ks([new jn("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression, or in the properties of atmosphere.')])}class sn{constructor(e,i){this._parameters=e,this._specification=i,Object.assign(this,vm(this._parameters,this._specification))}static deserialize(e){return new sn(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function Rc(r){let e=null;if(r instanceof $u)e=Rc(r.result);else if(r instanceof ys){for(const i of r.args)if(e=Rc(i),e)break}else(r instanceof wc||r instanceof Mn)&&r.input instanceof Xr&&r.input.name==="zoom"&&(e=r);return e instanceof jn||r.eachChild(i=>{const o=Rc(i);o instanceof jn?e=o:e&&o&&e!==o&&(e=new jn("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}class vs{constructor(e,i,o){if(this.boxSeen=new Uint32Array(0),this.circleSeen=new Uint32Array(0),this.generation=0,e instanceof ArrayBuffer){const a=new Int32Array(e);this.width=a[0],this.height=a[1],this.xCellCount=a[2],this.yCellCount=a[3],this.boxUid=a[4],this.circleUid=a[5];const c=this.xCellCount*this.yCellCount,h=[];for(let v=0;v<c;v++){const b=a[6+v],T=a[6+v+1];h.push(b===T?null:a.subarray(b,T))}const f=a[6+c],_=[];for(let v=0;v<c;v++){const b=a[f+v],T=a[f+v+1];_.push(b===T?null:a.subarray(b,T))}let y=a[f+c];this.boxCells=h,this.circleCells=_,this.boxKeys=a.subarray(y,y+this.boxUid),y+=this.boxUid,this.circleKeys=a.subarray(y,y+this.circleUid),y+=this.circleUid,this.bboxes=a.subarray(y,y+4*this.boxUid),y+=4*this.boxUid,this.circles=a.subarray(y,y+3*this.circleUid)}else{this.width=e,this.height=i,this.xCellCount=Math.ceil(e/o),this.yCellCount=Math.ceil(i/o);const a=this.xCellCount*this.yCellCount,c=[],h=[];for(let f=0;f<a;f++)c.push([]),h.push([]);this.boxCells=c,this.circleCells=h,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}clear(){for(const e of this.boxCells)e&&(e.length=0);for(const e of this.circleCells)e&&(e.length=0);this.circleKeys.length=0,this.boxKeys.length=0,this.bboxes.length=0,this.circles.length=0,this.boxUid=0,this.circleUid=0}insert(e,i,o,a,c){const h=this.boxUid++,f=this._xCell(i),_=this._yCell(o),y=this._xCell(a),v=this._yCell(c);for(let b=f;b<=y;b++)for(let T=_;T<=v;T++)this.boxCells[this.xCellCount*T+b].push(h);this.boxKeys.push(e),this.bboxes.push(i,o,a,c)}insertCircle(e,i,o,a){const c=this.circleUid++,h=this._xCell(i-a),f=this._yCell(o-a),_=this._xCell(i+a),y=this._yCell(o+a);for(let v=h;v<=_;v++)for(let b=f;b<=y;b++)this.circleCells[this.xCellCount*b+v].push(c);this.circleKeys.push(e),this.circles.push(i,o,a)}query(e,i,o,a,c){const h=[];if(o<0||e>this.width||a<0||i>this.height)return h;const f=this._nextGen(),{boxCells:_,circleCells:y,boxKeys:v,circleKeys:b,bboxes:T,circles:S,boxSeen:C,circleSeen:P,xCellCount:R}=this,L=this._xCell(e),V=this._yCell(i),B=this._xCell(o),G=this._yCell(a);for(let H=L;H<=B;H++)for(let Z=V;Z<=G;Z++){const oe=R*Z+H,X=_[oe];if(X)for(let ie=0;ie<X.length;ie++){const ne=X[ie];if(C[ne]===f)continue;C[ne]=f;const fe=4*ne,ge=T[fe],we=T[fe+1],Se=T[fe+2],Ee=T[fe+3];e<=Se&&i<=Ee&&o>=ge&&a>=we&&(!c||c(v[ne]))&&h.push({key:v[ne],x1:ge,y1:we,x2:Se,y2:Ee})}const ee=y[oe];if(ee)for(let ie=0;ie<ee.length;ie++){const ne=ee[ie];if(P[ne]===f)continue;P[ne]=f;const fe=3*ne,ge=S[fe],we=S[fe+1],Se=S[fe+2];!this._circleAndRectCollide(ge,we,Se,e,i,o,a)||c&&!c(b[ne])||h.push({key:b[ne],x1:ge-Se,y1:we-Se,x2:ge+Se,y2:we+Se})}}return h}queryKeys(e,i,o,a,c){const h=[];if(o<0||e>this.width||a<0||i>this.height)return h;const f=this._nextGen(),{boxCells:_,boxKeys:y,bboxes:v,boxSeen:b,xCellCount:T,xScale:S,yScale:C}=this,P=this._xCell(e),R=this._yCell(i),L=this._xCell(o),V=this._yCell(a);for(let B=P;B<=L;B++)for(let G=R;G<=V;G++){if(c&&!c(B/S,G/C,(B+1)/S,(G+1)/C))continue;const H=_[T*G+B];if(H)for(let Z=0;Z<H.length;Z++){const oe=H[Z];if(b[oe]===f)continue;b[oe]=f;const X=4*oe,ee=v[X],ie=v[X+1],ne=v[X+2],fe=v[X+3];(c?c(ee,ie,ne,fe):e<=ne&&i<=fe&&o>=ee&&a>=ie)&&h.push(y[oe])}}return h}hitTest(e,i,o,a,c){if(o<0||e>this.width||a<0||i>this.height)return!1;const h=this._nextGen(),{boxCells:f,circleCells:_,boxKeys:y,circleKeys:v,bboxes:b,circles:T,boxSeen:S,circleSeen:C,xCellCount:P}=this,R=this._xCell(e),L=this._yCell(i),V=this._xCell(o),B=this._yCell(a);for(let G=R;G<=V;G++)for(let H=L;H<=B;H++){const Z=P*H+G,oe=f[Z];if(oe)for(let ee=0;ee<oe.length;ee++){const ie=oe[ee];if(S[ie]===h)continue;S[ie]=h;const ne=4*ie;if(e<=b[ne+2]&&i<=b[ne+3]&&o>=b[ne]&&a>=b[ne+1]&&(!c||c(y[ie])))return!0}const X=_[Z];if(X)for(let ee=0;ee<X.length;ee++){const ie=X[ee];if(C[ie]===h)continue;C[ie]=h;const ne=3*ie;if(this._circleAndRectCollide(T[ne],T[ne+1],T[ne+2],e,i,o,a)&&(!c||c(v[ie])))return!0}}return!1}hitTestCircle(e,i,o,a){const c=e-o,h=i-o,f=e+o,_=i+o;if(f<0||c>this.width||_<0||h>this.height)return!1;const y=this._nextGen(),{boxCells:v,circleCells:b,boxKeys:T,circleKeys:S,bboxes:C,circles:P,boxSeen:R,circleSeen:L,xCellCount:V}=this,B=this._xCell(c),G=this._yCell(h),H=this._xCell(f),Z=this._yCell(_);for(let oe=B;oe<=H;oe++)for(let X=G;X<=Z;X++){const ee=V*X+oe,ie=v[ee];if(ie)for(let fe=0;fe<ie.length;fe++){const ge=ie[fe];if(R[ge]===y)continue;R[ge]=y;const we=4*ge;if(this._circleAndRectCollide(e,i,o,C[we],C[we+1],C[we+2],C[we+3])&&(!a||a(T[ge])))return!0}const ne=b[ee];if(ne)for(let fe=0;fe<ne.length;fe++){const ge=ne[fe];if(L[ge]===y)continue;L[ge]=y;const we=3*ge;if(this._circlesCollide(P[we],P[we+1],P[we+2],e,i,o)&&(!a||a(S[ge])))return!0}}return!1}static serialize(e,i){const o=e.toArrayBuffer();return i&&i.add(o),{buffer:o}}static deserialize(e){return new vs(e.buffer)}toArrayBuffer(){const e=this.xCellCount*this.yCellCount;let i=0,o=0;for(let f=0;f<e;f++)i+=this.boxCells[f].length,o+=this.circleCells[f].length;const a=new Int32Array(6+(e+1)+i+(e+1)+o+this.boxUid+this.circleUid+4*this.boxUid+3*this.circleUid);a[0]=this.width,a[1]=this.height,a[2]=this.xCellCount,a[3]=this.yCellCount,a[4]=this.boxUid,a[5]=this.circleUid;let c=6+(e+1);for(let f=0;f<e;f++){a[6+f]=c;const _=this.boxCells[f];a.set(_,c),c+=_.length}a[6+e]=c;const h=c;c+=e+1;for(let f=0;f<e;f++){a[h+f]=c;const _=this.circleCells[f];a.set(_,c),c+=_.length}return a[h+e]=c,a.set(this.boxKeys,c),c+=this.boxUid,a.set(this.circleKeys,c),c+=this.circleUid,a.set(this.bboxes,c),c+=4*this.boxUid,a.set(this.circles,c),a.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,o,a,c,h){const f=a-e,_=c-i,y=o+h;return y*y>f*f+_*_}_circleAndRectCollide(e,i,o,a,c,h,f){const _=(h-a)/2,y=Math.abs(e-(a+_));if(y>_+o)return!1;const v=(f-c)/2,b=Math.abs(i-(c+v));if(b>v+o)return!1;if(y<=_||b<=v)return!0;const T=y-_,S=b-v;return T*T+S*S<=o*o}}const nh={};function Je(r,e,i={}){Object.defineProperty(r,"_classRegistryKey",{value:e,writable:!1}),nh[e]={klass:r,omit:i.omit||[]}}Je(Object,"Object"),Je(vs,"Grid"),delete Ne.prototype.constructor,Je($t,"Color"),Je(Zr,"Formatted"),Je(fs,"FormattedSection"),Je(Wr,"ResolvedImage"),Je(sn,"StylePropertyFunction"),Je(th,"StyleExpression",{omit:["_evaluator"]}),Je(In,"ImageId"),Je(Vr,"ImageVariant"),Je(Pc,"ZoomDependentExpression"),Je(rh,"ZoomConstantExpression"),Je(Xr,"CompoundExpression",{omit:["_evaluate"]});for(const r in Mo)nh[Mo[r]._classRegistryKey]||Je(Mo[r],`Expression${r}`);function qd(r){return r&&(r instanceof ArrayBuffer||r.constructor&&r.constructor.name==="ArrayBuffer")}const wm={Error,TypeError,RangeError,SyntaxError,ReferenceError,URIError,EvalError},Hd=new Set(["message","stack","cause","errors","name","class"]);function oo(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 h=r.length,f=[];f.length=h;for(let _=0;_<h;_++)f[_]=oo(r[_],e);return f}if(ArrayBuffer.isView(r))return e&&e.add(r.buffer),r;if(qd(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 h={$name:"Map",entries:[]};for(const[f,_]of r.entries())h.entries.push(oo(f),oo(_,e));return h}if(r instanceof Headers)return{$name:"Headers",entries:[...r]};if(r instanceof Set){const h={$name:"Set"};let f=0;for(const _ of r.values())h[++f]=oo(_);return h}if(r instanceof Date||r instanceof RegExp||r instanceof Boolean||r instanceof Number||r instanceof String)return r;if(r instanceof Error){const h=r,f=h.constructor&&h.constructor.name||"Error",_={$name:"$Error",class:h instanceof pc?"AJAXError":h instanceof DOMException?"DOMException":h instanceof AggregateError?"AggregateError":wm[f]?f:"Error",name:h.name,message:h.message};h.stack&&(_.stack=h.stack),"cause"in h&&h.cause!==h&&(_.cause=oo(h.cause,e)),h instanceof AggregateError&&(_.errors=h.errors.filter(v=>v!==h).map(v=>oo(v,e)));const y=h;for(const v in y)Object.hasOwn(y,v)&&(Hd.has(v)||(_[v]=oo(y[v],e)));return _}const o=r.constructor||Object,a=o._classRegistryKey;if(!a)throw new Error(`Can't serialize object of unregistered class "${o.name}".`);const c=o.serialize?o.serialize(r,e):{};if(!o.serialize){const h=nh[a].omit,f=r;for(const _ in f)Object.hasOwn(f,_)&&(h.includes(_)||(c[_]=oo(f[_],e)))}if(c.$name)throw new Error("$name property is reserved for worker serialization logic.");return a!=="Object"&&(c.$name=a),c}function Rn(r){if(r===null||typeof r!="object")return r;if(Array.isArray(r)){for(let a=0;a<r.length;a++)r[a]=Rn(r[a]);return r}if(ArrayBuffer.isView(r)||qd(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 a=r.entries||[],c=new Map;for(let h=0;h<a.length;h+=2)c.set(Rn(a[h]),Rn(a[h+1]));return c}if(e==="Headers")return new Headers(r.entries);if(e==="Set"){const a=new Set;for(const c in r)c!=="$name"&&a.add(Rn(r[c]));return a}if(e==="BigInt")return BigInt(r.value);if(e==="$Error"){const a=r.class||"Error",c=r.name||a,h=r.message||"";let f;f=a==="DOMException"?new DOMException(h,c):a==="AggregateError"?new AggregateError((r.errors||[]).map(Rn),h):a==="AJAXError"?new pc(r.statusText,r.status,r.url):new(wm[a]||Error)(h),a!=="DOMException"&&(f.name=c),r.stack&&(f.stack=r.stack),"cause"in r&&(f.cause=Rn(r.cause));const _=f;for(const y in r)Object.hasOwn(r,y)&&(y==="$name"||Hd.has(y)||(_[y]=Rn(r[y])));return f}const{klass:i}=nh[e];if(!i)throw new Error(`Can't deserialize unregistered class "${e}".`);if(i.deserialize)return i.deserialize(r);const o=Object.create(i.prototype);for(const a in r)a!=="$name"&&(o[a]=Rn(r[a]));return o}const $d=r=>r>=1536&&r<=1791,Zd=r=>r>=1872&&r<=1919,oh=r=>r>=2208&&r<=2303,Wd=r=>r>=11904&&r<=12031,Xd=r=>r>=12032&&r<=12255,sh=r=>r>=12272&&r<=12287,Ol=r=>r>=12288&&r<=12351,Bl=r=>r>=12352&&r<=12447,Dc=r=>r>=12448&&r<=12543,Yd=r=>r>=12544&&r<=12591,Kd=r=>r>=12704&&r<=12735,Jd=r=>r>=12736&&r<=12783,kl=r=>r>=12784&&r<=12799,Tm=r=>r>=12800&&r<=13055,Em=r=>r>=13056&&r<=13311,ah=r=>r>=13312&&r<=19903,Qd=r=>r>=19968&&r<=40959,Sm=r=>r>=40960&&r<=42127,ef=r=>r>=42128&&r<=42191,tf=r=>r>=44032&&r<=55215,rf=r=>r>=63744&&r<=64255,nf=r=>r>=64336&&r<=65023,Ft=r=>r>=65040&&r<=65055,Nl=r=>r>=65072&&r<=65103,lh=r=>r>=65104&&r<=65135,zc=r=>r>=65136&&r<=65279,Ra=r=>r>=65280&&r<=65519;function ch(r){for(const e of r)if(Vl(e.charCodeAt(0)))return!0;return!1}function Im(r){for(const e of r)if(!uh(e.charCodeAt(0)))return!1;return!0}function uh(r){return!($d(r)||Zd(r)||oh(r)||nf(r)||zc(r))}function Am(r){return!(r<11904||!(Kd(r)||Yd(r)||Nl(r)||rf(r)||Em(r)||Wd(r)||Jd(r)||Ol(r)||ah(r)||Qd(r)||Tm(r)||Ra(r)||Bl(r)||sh(r)||Xd(r)||kl(r)||Dc(r)||Ft(r)||ef(r)||Sm(r)))}function Vl(r){return!(r!==746&&r!==747&&(r<4352||!(Kd(r)||Yd(r)||Nl(r)&&!(r>=65097&&r<=65103)||rf(r)||Em(r)||Wd(r)||Jd(r)||!(!Ol(r)||r>=12296&&r<=12305||r>=12308&&r<=12319||r===12336)||ah(r)||Qd(r)||Tm(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)||tf(r)||Bl(r)||sh(r)||(e=>e>=12688&&e<=12703)(r)||Xd(r)||kl(r)||Dc(r)&&r!==12540||!(!Ra(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)||!(!lh(r)||r>=65112&&r<=65118||r>=65123&&r<=65126)||(e=>e>=5120&&e<=5759)(r)||(e=>e>=6320&&e<=6399)(r)||Ft(r)||(e=>e>=19904&&e<=19967)(r)||Sm(r)||ef(r))))}function so(r){return r===12312||r===12313||r===12316||r===12540||r===12448}function hh(r){return!(Vl(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)||Ol(e)||Dc(e)||(i=>i>=57344&&i<=63743)(e)||Nl(e)||lh(e)||Ra(e)||e===8734||e===8756||e===8757||e>=9984&&e<=10087||e>=10102&&e<=10131||e===65532||e===65533)})(r))}function of(r){return $d(r)||Zd(r)||oh(r)||nf(r)||zc(r)}function sf(r){return r>=1424&&r<=2303||nf(r)||zc(r)}function Cm(r,e){return!(!e&&sf(r)||r>=2304&&r<=3583||r>=3840&&r<=4255||(i=>i>=6016&&i<=6143)(r))}function Lg(r){for(const e of r)if(sf(e.charCodeAt(0)))return!0;return!1}const Dn={unavailable:"unavailable",deferred:"deferred",loading:"loading",parsing:"parsing",parsed:"parsed",loaded:"loaded",error:"error"};let af=null,Kr=Dn.unavailable,Js=null;const Ul=function(r){r&&(Kr=Dn.error),af&&af(r)};function dh(){lf.fire(new Un("pluginStateChange",{pluginStatus:Kr,pluginURL:Js}))}const lf=new wa,fh=function(){return Kr},Zt=function(){if(Kr!==Dn.deferred||!Js)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");Kr=Dn.loading,dh(),Js&&xl({url:Js}).then(()=>{Kr=Dn.loaded,dh()}).catch(r=>{Ul(r)})},Wo={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>Kr===Dn.loaded||Wo.applyArabicShaping!=null,isLoading:()=>Kr===Dn.loading,setState(r){Kr=r.pluginStatus,Js=r.pluginURL},isParsing:()=>Kr===Dn.parsing,isParsed:()=>Kr===Dn.parsed,getPluginURL:()=>Js};class oi{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,o){for(const a of i)if(!Cm(a.charCodeAt(0),o))return!1;return!0})(e,Wo.isLoaded())}}class ph{constructor(e,i,o,a,c){this.property=e,this.value=i,this.expression=(function(h,f,_,y,v){if(Qu(h))return new sn(h,f);if(ih(h)||Array.isArray(h)&&h.length>0){const b=bm(h,f,_,y,v);if(b.result==="error")throw new Error(b.value.map(T=>`${T.key}: ${T.message}`).join(", "));return b.value}{let b=h;return typeof h=="string"&&f.type==="color"&&(b=$t.parse(h)),{kind:"constant",configDependencies:new Set,isIndoorDependent:!1,evaluate:()=>b}}})(i===void 0?e.specification.default:i,e.specification,o,a,c)}isIndoorDependent(){return this.expression.isIndoorDependent}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(e,i,o,a){return this.property.possiblyEvaluate(this,e,i,o,a)}}class cf{constructor(e,i,o,a){this.property=e,this.value=new ph(e,void 0,i,o,a)}transitioned(e,i){return new Fc(this.property,this.value,i,{...e.transition,...this.transition},e.now)}untransitioned(){return new Fc(this.property,this.value,null,{},0)}}class Lc{constructor(e,i,o,a){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues),this._scope=i,this._options=o,this._iconImageUseTheme=a,this._isIndoorDependent=!1,this.configDependencies=new Set}getValue(e){return ot(this._values[e].value.value)}setValue(e,i){Object.hasOwn(this._values,e)||(this._values[e]=new cf(this._values[e].property,this._scope,this._options,this._iconImageUseTheme)),this._values[e].value=new ph(this._values[e].property,i===null?void 0:ot(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 o=this._properties.properties;if(e)for(const a in e){const c=e[a];if(a.endsWith("-transition")){const h=a.slice(0,-11);o[h]&&this.setTransition(h,c)}else Object.hasOwn(o,a)&&this.setValue(a,c)}}getTransition(e){return ot(this._values[e].transition)}setTransition(e,i){Object.hasOwn(this._values,e)||(this._values[e]=new cf(this._values[e].property)),this._values[e].transition=ot(i)||void 0}serialize(){const e={};for(const i of Object.keys(this._values)){const o=this.getValue(i);o!==void 0&&(e[i]=o);const a=this.getTransition(i);a!==void 0&&(e[`${i}-transition`]=a)}return e}transitioned(e,i){const o=new Oc(this._properties);for(const a of Object.keys(this._values))o._values[a]=this._values[a].transitioned(e,i._values[a]);return o}untransitioned(){const e=new Oc(this._properties);for(const i of Object.keys(this._values))e._values[i]=this._values[i].untransitioned();return e}isIndoorDependent(){return this._isIndoorDependent}}class Fc{constructor(e,i,o,a,c){const h=a.delay||0,f=a.duration||0;c=c||0,this.property=e,this.value=i,this.begin=c+h,this.end=this.begin+f,e.specification.transition&&(a.delay||a.duration)&&(this.prior=o)}possiblyEvaluate(e,i,o){const a=e.now||0,c=this.value.possiblyEvaluate(e,i,o),h=this.prior;if(h){if(a>this.end)return this.prior=null,c;if(this.value.isDataDriven())return this.prior=null,c;if(a<this.begin)return h.possiblyEvaluate(e,i,o);{const f=(a-this.begin)/(this.end-this.begin);return this.property.interpolate(h.possiblyEvaluate(e,i,o),c,j(f))}}return c}}class Oc{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,i,o){const a=new Xo(this._properties);for(const c of Object.keys(this._values))a._values[c]=this._values[c].possiblyEvaluate(e,i,o);return a}hasTransition(){for(const e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class Bc{constructor(e,i,o,a){this._properties=e,this._values=Object.create(e.defaultPropertyValues),this._scope=i,this._options=o,this._iconImageUseTheme=a,this._isIndoorDependent=!1,this.configDependencies=new Set}getValue(e){return ot(this._values[e].value)}setValue(e,i){this._values[e]=new ph(this._values[e].property,i===null?void 0:ot(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 o=this.getValue(i);o!==void 0&&(e[i]=o)}return e}possiblyEvaluate(e,i,o,a){const c=new Xo(this._properties);for(const h of Object.keys(this._values))c._values[h]=this._values[h].possiblyEvaluate(e,i,o,a);return c}isIndoorDependent(){return this._isIndoorDependent}}class bs{constructor(e,i,o,a){this.property=e,this.value=i,this.parameters=o,this.iconImageUseTheme=a}isConstant(){return this.value.kind==="constant"}constantOr(e){return this.value.kind==="constant"?this.value.value:e}evaluate(e,i,o,a,c){return this.property.evaluate(this.value,this.parameters,e,i,o,a,this.iconImageUseTheme,c)}}class Xo{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,o){const a=nt[this.specification.type];return a?a(e,i,o):e}}class $e{constructor(e,i){this.specification=e,this.overrides=i}possiblyEvaluate(e,i,o,a,c){return e.expression.kind==="constant"||e.expression.kind==="camera"?new bs(this,{kind:"constant",value:e.expression.evaluate(i,null,{},o,a,void 0,c)},i):new bs(this,e.expression,i,c)}interpolate(e,i,o){if(e.value.kind!=="constant"||i.value.kind!=="constant")return e;if(e.value.value===void 0||i.value.value===void 0)return new bs(this,{kind:"constant",value:void 0},e.parameters);const a=nt[this.specification.type];return a?new bs(this,{kind:"constant",value:a(e.value.value,i.value.value,o)},e.parameters):e}evaluate(e,i,o,a,c,h,f,_){return e.kind==="constant"?e.value:e.evaluate(i,o,a,c,h,_,f)}}class ws{constructor(e){this.specification=e}possiblyEvaluate(e,i,o,a){return!!e.expression.evaluate(i,null,{},o,a)}interpolate(){return!1}}class Li{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];const i=new oi(0,{});for(const o in e){const a=e[o],c=a.specification;c&&c.overridable&&this.overridableProperties.push(o);const h=this.defaultPropertyValues[o]=new ph(a,void 0),f=this.defaultTransitionablePropertyValues[o]=new cf(a);this.defaultTransitioningPropertyValues[o]=f.untransitioned(),this.defaultPossiblyEvaluatedValues[o]=h.possiblyEvaluate(i)}}}Je($e,"DataDrivenProperty"),Je(He,"DataConstantProperty"),Je(ws,"ColorRampProperty");var pe=JSON.parse('{"expression":1,"transition":{"duration":{"type":"number","default":300,"minimum":0},"delay":{"type":"number","default":0,"minimum":0}},"appearance":{"condition":{"type":"boolean","expression":{"interpolated":1,"parameters":["distance-from-center","feature","feature-state","measure-light","pitch","zoom"]},"property-type":"data-driven"},"name":{"type":"string"},"properties":{"type":"*"}},"function":{"type":{"type":"enum","default":"exponential","values":{"identity":1,"exponential":1,"interval":1,"categorical":1}},"default":{"type":"*"},"expression":1,"stops":{"type":"array","value":"function_stop"},"base":{"type":"number","default":1,"minimum":0},"property":{"type":"string","default":"$zoom"},"colorSpace":{"type":"enum","default":"rgb","values":{"rgb":1,"lab":1,"hcl":1}}},"$version":8,"$root":{"transition":{"type":"transition"},"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},"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"},"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":{"type":{"type":"enum","values":{"string":1,"number":1,"boolean":1,"color":1
vendor: 41,124 bytes, line 1
1}},"default":{"type":"*","expression":1},"values":{"type":"array","value":"*"},"array":{"type":"boolean"},"minValue":{"type":"number"},"maxValue":{"type":"number"},"stepValue":{"type":"number"},"metadata":{"type":"*"}},"models":{"*":{"type":"model"}},"light-3d":{"type":{"type":"enum","values":{"ambient":{},"directional":{},"flat":{}}},"id":{"type":"string"},"properties":{"type":"properties"}},"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","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1,"use-theme":1},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"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":1,"parameters":["zoom"]},"transition":1},"shadow-draw-before-layer":{"type":"string"}},"properties_light_ambient":{"color":{"type":"color","default":"#ffffff","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1,"use-theme":1},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1}},"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","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1,"use-theme":1},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1}},"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","default":[-180,-85.051129,180,85.051129],"length":4,"value":"number"},"extra_bounds":{"type":"array","value":{"type":"array","length":4,"value":"number"}},"scheme":{"type":"enum","default":"xyz","values":{"xyz":1,"tms":1}},"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","default":[-180,-85.051129,180,85.051129],"length":4,"value":"number"},"extra_bounds":{"type":"array","value":{"type":"array","length":4,"value":"number"}},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"scheme":{"type":"enum","default":"xyz","values":{"xyz":1,"tms":1}},"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","default":[-180,-85.051129,180,85.051129],"length":4,"value":"number"},"extra_bounds":{"type":"array","value":{"type":"array","length":4,"value":"number"}},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"attribution":{"type":"string"},"encoding":{"type":"enum","default":"mapbox","values":{"terrarium":1,"mapbox":1}},"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","default":[-180,-85.051129,180,85.051129],"length":4,"value":"number"},"extra_bounds":{"type":"array","value":{"type":"array","length":4,"value":"number"}},"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,"minimum":0,"maximum":512},"filter":{"type":"*"},"tolerance":{"type":"number","default":0.375},"cluster":{"type":"boolean","default":false},"clusterRadius":{"type":"number","default":50,"minimum":0},"clusterMaxZoom":{"type":"number"},"clusterMinPoints":{"type":"number"},"clusterProperties":{"type":"*"},"lineMetrics":{"type":"boolean","default":false},"generateId":{"type":"boolean","default":false},"promoteId":{"type":"promoteId"},"dynamic":{"type":"boolean","default":false}},"source_video":{"type":{"type":"enum","values":{"video":1}},"urls":{"type":"array","value":"string"},"coordinates":{"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"source_image":{"type":{"type":"enum","values":{"image":1}},"url":{"type":"string"},"coordinates":{"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"modelNodeOverride":{"orientation":{"type":"array","default":[0,0,0],"length":3,"value":"number"}},"modelLightOverrides":{"light-ambient-color":{"type":"color"},"light-ambient-intensity":{"type":"number"},"light-directional-color":{"type":"color"},"light-directional-intensity":{"type":"number"}},"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","default":[0,0],"minimum":[-180,-90],"maximum":[180,90],"length":2,"value":"number"},"orientation":{"type":"array","default":[0,0,0],"length":3,"value":"number"},"lightOverrides":{"type":"modelLightOverrides"},"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":{"type":{"type":"enum","values":{"fill":{},"line":{},"symbol":{},"circle":{},"heatmap":{},"fill-extrusion":{},"building":{},"raster":{},"raster-particle":{},"hillshade":{},"model":{},"background":{},"sky":{},"slot":{},"clip":{}}},"id":{"type":"string"},"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"}},"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","default":"visible","values":{"visible":1,"none":1},"expression":1}},"layout_sky":{"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1}},"layout_model":{"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1},"model-id":{"type":"string","default":"","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"model-allow-density-reduction":{"type":"boolean","default":true}},"layout_clip":{"clip-layer-types":{"type":"array","default":[],"value":"enum","values":{"model":1,"symbol":1},"expression":1},"clip-layer-scope":{"type":"array","default":[],"value":"string","expression":1},"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1}},"layout_fill":{"fill-sort-key":{"type":"number","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1},"fill-elevation-reference":{"type":"enum","default":"none","values":{"none":1,"hd-road-base":1,"hd-road-markup":1},"expression":1},"fill-construct-bridge-guard-rail":{"type":"boolean","default":"true","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"}},"layout_circle":{"circle-sort-key":{"type":"number","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"circle-elevation-reference":{"type":"enum","default":"none","values":{"none":1,"hd-road-markup":1},"expression":1},"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1}},"layout_heatmap":{"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1}},"layout_fill-extrusion":{"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1},"fill-extrusion-edge-radius":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":1},"source-max-zoom":{"type":"number","minimum":0,"maximum":24}},"layout_building":{"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1},"building-facade":{"type":"boolean","default":false,"expression":{"parameters":["feature"]},"property-type":"data-driven"},"building-facade-floors":{"type":"number","default":3,"minimum":1,"maximum":200,"expression":{"parameters":["feature"]},"property-type":"data-driven"},"building-facade-unit-width":{"type":"number","default":3.1,"minimum":1,"maximum":20,"expression":{"parameters":["feature"]},"property-type":"data-driven"},"building-facade-window":{"type":"array","default":[0.9,0.9],"minimum":0.1,"maximum":1,"length":2,"value":"number","expression":{"parameters":["feature"]},"property-type":"data-driven"},"building-roof-shape":{"type":"enum","default":"flat","values":{"flat":1,"hipped":1,"gabled":1,"parapet":1,"mansard":1,"skillion":1,"pyramidal":1},"expression":{"parameters":["feature"]},"property-type":"data-driven"},"building-height":{"type":"number","default":0,"minimum":0,"expression":1,"transition":1,"property-type":"data-driven"},"building-base":{"type":"number","default":0,"minimum":0,"expression":1,"transition":1,"property-type":"data-driven"},"building-flood-light-wall-radius":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state"]},"transition":1,"property-type":"data-driven"},"building-flood-light-ground-radius":{"type":"number","default":0,"expression":{"interpolated":1,"parameters":["feature","feature-state"]},"transition":1,"property-type":"data-driven"},"building-flip-roof-orientation":{"type":"boolean","default":false,"expression":{"interpolated":1,"parameters":["feature","feature-state"]},"transition":1,"property-type":"data-driven"}},"layout_line":{"line-cap":{"type":"enum","default":"butt","values":{"butt":1,"round":1,"square":1},"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"line-join":{"type":"enum","default":"miter","values":{"bevel":1,"round":1,"miter":1,"none":1},"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"line-miter-limit":{"type":"number","default":2,"expression":{"interpolated":1,"parameters":["zoom"]}},"line-round-limit":{"type":"number","default":1.05,"expression":{"interpolated":1,"parameters":["zoom"]}},"line-sort-key":{"type":"number","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"line-z-offset":{"type":"number","default":0,"expression":{"parameters":["feature","line-progress","zoom"]},"property-type":"data-driven"},"line-elevation-reference":{"type":"enum","default":"none","values":{"none":1,"sea":1,"ground":1,"hd-road-markup":1},"expression":1},"line-cross-slope":{"type":"number","expression":1},"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1},"line-width-unit":{"type":"enum","default":"pixels","values":{"pixels":1,"meters":1},"expression":{"parameters":["zoom"]}},"line-elevation-ground-scale":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","line-progress","zoom"]},"transition":1,"property-type":"data-driven"}},"layout_symbol":{"symbol-placement":{"type":"enum","default":"point","values":{"point":1,"line":1,"line-center":1},"expression":{"parameters":["zoom"]}},"symbol-spacing":{"type":"number","default":250,"minimum":1,"expression":{"interpolated":1,"parameters":["zoom"]}},"symbol-avoid-edges":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"symbol-sort-key":{"type":"number","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"symbol-z-order":{"type":"enum","default":"auto","values":{"auto":1,"viewport-y":1,"source":1},"expression":{"parameters":["zoom"]}},"symbol-z-elevate":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"symbol-elevation-reference":{"type":"enum","default":"ground","values":{"sea":1,"ground":1,"hd-road-markup":1},"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","default":"auto","values":{"map":1,"viewport":1,"auto":1},"expression":{"parameters":["zoom"]}},"icon-size":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","zoom"]},"property-type":"data-driven","appearance":1},"icon-size-scale-range":{"type":"array","default":[0.8,2],"minimum":[0.1,0.1],"maximum":[10,10],"length":2,"value":"number","expression":1},"icon-text-fit":{"type":"enum","default":"none","values":{"none":1,"width":1,"height":1,"both":1},"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"icon-text-fit-padding":{"type":"array","default":[0,0,0,0],"length":4,"value":"number","expression":{"interpolated":1,"parameters":["feature","zoom"]},"property-type":"data-driven"},"icon-image":{"type":"resolvedImage","expression":{"parameters":["feature","zoom"]},"use-theme":1,"property-type":"data-driven","appearance":1,"tokens":1},"icon-rotate":{"type":"number","default":0,"expression":{"interpolated":1,"parameters":["feature","zoom"]},"property-type":"data-driven","appearance":1},"icon-padding":{"type":"number","default":2,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]}},"icon-keep-upright":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-offset":{"type":"array","default":[0,0],"length":2,"value":"number","expression":{"interpolated":1,"parameters":["feature","zoom"]},"property-type":"data-driven","appearance":1},"icon-anchor":{"type":"enum","default":"center","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":["feature","zoom"]},"property-type":"data-driven"},"icon-pitch-alignment":{"type":"enum","default":"auto","values":{"map":1,"viewport":1,"auto":1},"expression":{"parameters":["zoom"]}},"text-pitch-alignment":{"type":"enum","default":"auto","values":{"map":1,"viewport":1,"auto":1},"expression":{"parameters":["zoom"]}},"text-rotation-alignment":{"type":"enum","default":"auto","values":{"map":1,"viewport":1,"auto":1},"expression":{"parameters":["zoom"]}},"text-field":{"type":"formatted","default":"","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven","tokens":1},"text-font":{"type":"array","default":["Open Sans Regular","Arial Unicode MS Regular"],"value":"string","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"text-size":{"type":"number","default":16,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","zoom"]},"property-type":"data-driven","appearance":1},"text-size-scale-range":{"type":"array","default":[0.8,2],"minimum":[0.1,0.1],"maximum":[10,10],"length":2,"value":"number","expression":1},"text-max-width":{"type":"number","default":10,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","zoom"]},"property-type":"data-driven"},"text-line-height":{"type":"number","default":1.2,"expression":{"interpolated":1,"parameters":["feature","zoom"]},"property-type":"data-driven"},"text-letter-spacing":{"type":"number","default":0,"expression":{"interpolated":1,"parameters":["feature","zoom"]},"property-type":"data-driven"},"text-justify":{"type":"enum","default":"center","values":{"auto":1,"left":1,"center":1,"right":1},"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"text-radial-offset":{"type":"number","default":0,"expression":{"interpolated":1,"parameters":["feature","zoom"]},"property-type":"data-driven"},"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","default":"center","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":["feature","zoom"]},"property-type":"data-driven"},"text-max-angle":{"type":"number","default":45,"expression":{"interpolated":1,"parameters":["zoom"]}},"text-writing-mode":{"type":"array","value":"enum","values":{"horizontal":1,"vertical":1},"expression":{"parameters":["zoom"]}},"text-rotate":{"type":"number","default":0,"expression":{"interpolated":1,"parameters":["feature","zoom"]},"property-type":"data-driven","appearance":1},"text-padding":{"type":"number","default":2,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]}},"text-keep-upright":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"text-transform":{"type":"enum","default":"none","values":{"none":1,"uppercase":1,"lowercase":1},"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"text-offset":{"type":"array","default":[0,0],"length":2,"value":"number","expression":{"interpolated":1,"parameters":["feature","zoom"]},"property-type":"data-driven","appearance":1},"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","default":"visible","values":{"visible":1,"none":1},"expression":1}},"layout_raster":{"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1}},"layout_raster-particle":{"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1}},"layout_hillshade":{"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1}},"filter":{"type":"array","value":"*"},"filter_symbol":{"type":"boolean","default":false,"expression":{"parameters":["distance-from-center","feature","pitch","zoom"]},"property-type":"data-driven"},"filter_fill":{"type":"boolean","default":false,"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"filter_hillshade":{"type":"boolean","default":false,"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"filter_raster":{"type":"boolean","default":false,"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"filter_raster-particle":{"type":"boolean","default":false,"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"filter_clip":{"type":"boolean","default":false,"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"filter_model":{"type":"boolean","default":false,"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"filter_line":{"type":"boolean","default":false,"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"filter_circle":{"type":"boolean","default":false,"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"filter_fill-extrusion":{"type":"boolean","default":false,"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"filter_building":{"type":"boolean","default":false,"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"filter_heatmap":{"type":"boolean","default":false,"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"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_stop":{"type":"array","minimum":0,"maximum":24,"length":2,"value":["number","color"]},"fog":{"range":{"type":"array","default":[0.5,10],"minimum":-20,"maximum":20,"length":2,"value":"number","expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1,"use-theme":1},"high-color":{"type":"color","default":"#245cdf","expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1,"use-theme":1},"space-color":{"type":"color","default":["interpolate",["linear"],["zoom"],4,"#010b19",7,"#367ab9"],"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1,"use-theme":1},"horizon-blend":{"type":"number","default":["interpolate",["linear"],["zoom"],4,0.2,7,0.1],"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"star-intensity":{"type":"number","default":["interpolate",["linear"],["zoom"],5,0.35,6,0],"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"vertical-range":{"type":"array","default":[0,0],"minimum":0,"length":2,"value":"number","expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1}},"snow":{"density":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.85],"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1,"use-theme":1},"opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"vignette":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.3],"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"vignette-color":{"type":"color","default":"#ffffff","expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1,"use-theme":1},"center-thinning":{"type":"number","default":0.4,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"direction":{"type":"array","default":[0,50],"minimum":0,"maximum":360,"length":2,"value":"number","expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"flake-size":{"type":"number","default":0.71,"minimum":0,"maximum":5,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1}},"rain":{"density":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.5],"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"color":{"type":"color","default":["interpolate",["linear"],["measure-light","brightness"],0,"#03113d",0.3,"#a8adbc"],"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1,"use-theme":1},"opacity":{"type":"number","default":["interpolate",["linear"],["measure-light","brightness"],0,0.88,1,0.7],"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"vignette":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,1],"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"vignette-color":{"type":"color","default":["interpolate",["linear"],["measure-light","brightness"],0,"#001736",0.3,"#464646"],"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1,"use-theme":1},"center-thinning":{"type":"number","default":0.57,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"direction":{"type":"array","default":[0,80],"minimum":0,"maximum":360,"length":2,"value":"number","expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"droplet-size":{"type":"array","default":[2.6,18.2],"minimum":0,"maximum":50,"length":2,"value":"number","expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"distortion-strength":{"type":"number","default":0.7,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1}},"camera":{"camera-projection":{"type":"enum","default":"perspective","values":{"perspective":1,"orthographic":1}}},"colorTheme":{"data":{"type":"string","expression":1}},"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","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1,"use-theme":1},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1}},"projection":{"name":{"type":"enum","default":"mercator","values":{"albers":1,"equalEarth":1,"equirectangular":1,"lambertConformalConic":1,"mercator":1,"naturalEarth":1,"winkelTripel":1,"globe":1}},"center":{"type":"array","minimum":[-180,-90],"maximum":[180,90],"length":2,"value":"number"},"parallels":{"type":"array","minimum":[-90,-90],"maximum":[90,90],"length":2,"value":"number"}},"terrain":{"source":{"type":"string"},"exaggeration":{"type":"number","default":1,"minimum":0,"maximum":1000,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1}},"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,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"fill-color":{"type":"color","default":"#000000","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven"},"fill-outline-color":{"type":"color","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven"},"fill-translate":{"type":"array","default":[0,0],"length":2,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"fill-translate-anchor":{"type":"enum","default":"map","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"fill-pattern":{"type":"resolvedImage","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"fill-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]}},"fill-emissive-strength":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1},"fill-z-offset":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","zoom"]},"transition":1,"property-type":"data-driven"},"fill-bridge-guard-rail-color":{"type":"color","default":"rgba(241, 236, 225, 255)","expression":{"interpolated":1,"parameters":["feature","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven"},"fill-tunnel-structure-color":{"type":"color","default":"rgba(241, 236, 225, 255)","expression":{"interpolated":1,"parameters":["feature","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"fill-extrusion-color":{"type":"color","default":"#000000","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven"},"fill-extrusion-translate":{"type":"array","default":[0,0],"length":2,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"fill-extrusion-translate-anchor":{"type":"enum","default":"map","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"fill-extrusion-pattern":{"type":"resolvedImage","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"fill-extrusion-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]}},"fill-extrusion-height":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","zoom"]},"transition":1,"property-type":"data-driven"},"fill-extrusion-base":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","zoom"]},"transition":1,"property-type":"data-driven"},"fill-extrusion-height-alignment":{"type":"enum","default":"flat","values":{"terrain":1,"flat":1}},"fill-extrusion-base-alignment":{"type":"enum","default":"terrain","values":{"terrain":1,"flat":1}},"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":1,"parameters":["zoom"]},"transition":1},"fill-extrusion-ambient-occlusion-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"fill-extrusion-ambient-occlusion-wall-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"fill-extrusion-ambient-occlusion-ground-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"fill-extrusion-ambient-occlusion-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"fill-extrusion-flood-light-color":{"type":"color","default":"#ffffff","expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1,"use-theme":1},"fill-extrusion-flood-light-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1},"fill-extrusion-flood-light-wall-radius":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state"]},"transition":1,"property-type":"data-driven"},"fill-extrusion-flood-light-ground-radius":{"type":"number","default":0,"expression":{"interpolated":1,"parameters":["feature","feature-state"]},"transition":1,"property-type":"data-driven"},"fill-extrusion-flood-light-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"fill-extrusion-vertical-scale":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"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":1},"fill-extrusion-front-cutoff":{"type":"array","default":[0,0,1],"minimum":[0,0,0],"maximum":[1,1,1],"length":3,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]}},"fill-extrusion-emissive-strength":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"fill-extrusion-line-width":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"fill-extrusion-cast-shadows":{"type":"boolean","default":true}},"paint_building":{"building-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"building-ambient-occlusion-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"parameters":[]},"transition":1},"building-ambient-occlusion-ground-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"building-ambient-occlusion-ground-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"building-ambient-occlusion-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"building-vertical-scale":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"building-cast-shadows":{"type":"boolean","default":true},"building-color":{"type":"color","default":"rgba(193, 154, 127, 1)","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light"]},"use-theme":1,"property-type":"data-driven"},"building-emissive-strength":{"type":"number","default":0,"minimum":0,"maximum":5,"expression":{"interpolated":1,"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":1,"parameters":["measure-light","zoom"]}},"building-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":1},"building-front-cutoff":{"type":"array","default":[0,0,1],"minimum":[0,0,0],"maximum":[1,1,1],"length":3,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]}},"building-flood-light-color":{"type":"color","default":"#ffffff","expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1,"use-theme":1},"building-flood-light-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1},"building-flood-light-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1}},"paint_line":{"line-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"line-color":{"type":"color","default":"#000000","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven"},"line-translate":{"type":"array","default":[0,0],"length":2,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"line-translate-anchor":{"type":"enum","default":"map","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"line-width":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","line-progress","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"line-gap-width":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"line-offset":{"type":"number","default":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"line-blur":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"line-dasharray":{"type":"array","minimum":0,"value":"number","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"line-pattern":{"type":"resolvedImage","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"line-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]}},"line-gradient":{"type":"color","expression":{"interpolated":1,"parameters":["line-progress"]},"use-theme":1},"line-trim-offset":{"type":"array","default":[0,0],"minimum":[0,0],"maximum":[1,1],"length":2,"value":"number"},"line-trim-fade-range":{"type":"array","default":[0,0],"minimum":[0,0],"maximum":[1,1],"length":2,"value":"number","expression":{"interpolated":1,"parameters":["measure-light","zoom"]}},"line-trim-color":{"type":"color","default":"transparent","expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1,"use-theme":1},"line-emissive-strength":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["line-progress","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"line-border-width":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","zoom"]},"transition":1,"property-type":"data-driven"},"line-border-color":{"type":"color","default":"rgba(0, 0, 0, 0)","expression":{"interpolated":1,"parameters":["feature","feature-state","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven"},"line-
1occlusion-opacity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"line-blend-mode":{"type":"enum","default":"default","values":{"default":1,"multiply":1,"additive":1},"expression":{"parameters":["zoom"]}},"line-blend-additive-clamp":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]}}},"paint_circle":{"circle-radius":{"type":"number","default":5,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"circle-color":{"type":"color","default":"#000000","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven"},"circle-blur":{"type":"number","default":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"circle-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"circle-translate":{"type":"array","default":[0,0],"length":2,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"circle-translate-anchor":{"type":"enum","default":"map","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"circle-pitch-scale":{"type":"enum","default":"map","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"circle-pitch-alignment":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"circle-stroke-width":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"circle-stroke-color":{"type":"color","default":"#000000","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven"},"circle-stroke-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"circle-emissive-strength":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1}},"paint_heatmap":{"heatmap-radius":{"type":"number","default":30,"minimum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"heatmap-weight":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"property-type":"data-driven"},"heatmap-intensity":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"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"],"expression":{"interpolated":1,"parameters":["heatmap-density"]},"use-theme":1},"heatmap-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1}},"paint_symbol":{"icon-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven","appearance":1},"icon-occlusion-opacity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven","appearance":1},"icon-emissive-strength":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":1,"parameters":["feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven","appearance":1},"text-emissive-strength":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":1,"parameters":["feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven","appearance":1},"icon-color":{"type":"color","default":"#000000","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven","appearance":1},"icon-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven","appearance":1},"icon-halo-width":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven","appearance":1},"icon-halo-blur":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven","appearance":1},"icon-translate":{"type":"array","default":[0,0],"length":2,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1,"appearance":1},"icon-translate-anchor":{"type":"enum","default":"map","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"icon-image-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]}},"text-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven","appearance":1},"text-occlusion-opacity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven","appearance":1},"text-color":{"type":"color","default":"#000000","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven","appearance":1,"overridable":1},"text-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven","appearance":1},"text-halo-width":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven","appearance":1},"text-halo-blur":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven","appearance":1},"text-translate":{"type":"array","default":[0,0],"length":2,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1,"appearance":1},"text-translate-anchor":{"type":"enum","default":"map","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"icon-color-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":1},"icon-color-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":1},"icon-color-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":1},"icon-color-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":1},"symbol-z-offset":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","zoom"]},"transition":1,"property-type":"data-driven","appearance":1}},"paint_raster":{"raster-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"raster-color":{"type":"color","expression":{"interpolated":1,"parameters":["raster-value"]},"use-theme":1},"raster-color-mix":{"type":"array","default":[0.2126,0.7152,0.0722,0],"length":4,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"raster-color-range":{"type":"array","length":2,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"raster-hue-rotate":{"type":"number","default":0,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"raster-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"raster-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"raster-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"raster-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"raster-resampling":{"type":"enum","default":"linear","values":{"linear":1,"nearest":1},"expression":{"parameters":["zoom"]}},"raster-fade-duration":{"type":"number","default":300,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]}},"raster-emissive-strength":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1},"raster-array-band":{"type":"string"},"raster-elevation":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"raster-elevation-reference":{"type":"enum","default":"sea","values":{"sea":1,"ground":1},"expression":1}},"paint_raster-particle":{"raster-particle-array-band":{"type":"string"},"raster-particle-count":{"type":"number","default":512,"minimum":1},"raster-particle-color":{"type":"color","expression":{"interpolated":1,"parameters":["raster-particle-speed"]},"use-theme":1},"raster-particle-max-speed":{"type":"number","default":1,"minimum":1},"raster-particle-speed-factor":{"type":"number","default":0.2,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"raster-particle-fade-opacity-factor":{"type":"number","default":0.98,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"raster-particle-reset-rate-factor":{"type":"number","default":0.8,"minimum":0,"maximum":1},"raster-particle-elevation":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1}},"paint_hillshade":{"hillshade-illumination-direction":{"type":"number","default":335,"minimum":0,"maximum":359,"expression":{"interpolated":1,"parameters":["zoom"]}},"hillshade-illumination-anchor":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"hillshade-exaggeration":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"hillshade-shadow-color":{"type":"color","default":"#000000","expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1,"use-theme":1},"hillshade-highlight-color":{"type":"color","default":"#FFFFFF","expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1,"use-theme":1},"hillshade-accent-color":{"type":"color","default":"#000000","expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1,"use-theme":1},"hillshade-emissive-strength":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1}},"paint_background":{"background-pitch-alignment":{"type":"enum","default":"map","values":{"map":1,"viewport":1},"expression":{"parameters":[]}},"background-color":{"type":"color","default":"#000000","expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1,"use-theme":1},"background-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom"]}},"background-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"background-emissive-strength":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1}},"paint_sky":{"sky-type":{"type":"enum","default":"atmosphere","values":{"gradient":1,"atmosphere":1},"expression":{"parameters":["zoom"]}},"sky-atmosphere-sun":{"type":"array","minimum":[0,0],"maximum":[360,180],"length":2,"value":"number","expression":{"parameters":["zoom"]}},"sky-atmosphere-sun-intensity":{"type":"number","default":10,"minimum":0,"maximum":100},"sky-gradient-center":{"type":"array","default":[0,0],"minimum":[0,0],"maximum":[360,180],"length":2,"value":"number","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"],"expression":{"interpolated":1,"parameters":["sky-radial-progress"]},"use-theme":1},"sky-atmosphere-halo-color":{"type":"color","default":"white","use-theme":1},"sky-atmosphere-color":{"type":"color","default":"white","use-theme":1},"sky-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1}},"paint_model":{"model-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state","zoom"]},"transition":1,"property-type":"data-driven"},"model-rotation":{"type":"array","default":[0,0,0],"length":3,"value":"number","expression":{"interpolated":1,"parameters":["feature","feature-state","zoom"]},"transition":1,"property-type":"data-driven"},"model-scale":{"type":"array","default":[1,1,1],"length":3,"value":"number","expression":{"interpolated":1,"parameters":["feature","feature-state","zoom"]},"transition":1,"property-type":"data-driven"},"model-translation":{"type":"array","default":[0,0,0],"length":3,"value":"number","expression":{"interpolated":1,"parameters":["feature","feature-state","zoom"]},"transition":1,"property-type":"data-driven"},"model-color":{"type":"color","default":"#ffffff","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven"},"model-color-mix-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light"]},"transition":1,"property-type":"data-driven"},"model-type":{"type":"enum","default":"common-3d","values":{"common-3d":1,"location-indicator":1}},"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":1,"parameters":["zoom"]},"transition":1},"model-emissive-strength":{"type":"number","default":0,"minimum":0,"maximum":5,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light"]},"transition":1,"property-type":"data-driven"},"model-roughness":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state"]},"transition":1,"property-type":"data-driven"},"model-height-based-emissive-strength-multiplier":{"type":"array","default":[1,1,1,1,0],"length":5,"value":"number","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light"]},"transition":1,"property-type":"data-driven"},"model-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":1},"model-front-cutoff":{"type":"array","default":[0,0,1],"minimum":[0,0,0],"maximum":[1,1,1],"length":3,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]}},"model-elevation-reference":{"type":"enum","default":"ground","values":{"sea":1,"ground":1,"hd-road-markup":1},"expression":1},"model-line-cutout-mode":{"type":"enum","default":"enabled","values
1":{"enabled":1,"disabled":1,"enabled-above-cutout":1},"expression":1}},"promoteId":{"*":{"type":"*"}}}');function Mm(r){return r instanceof Number||r instanceof String||r instanceof Boolean?r.valueOf():r}function kc(r){if(Array.isArray(r))return r.map(kc);if(r instanceof Object&&!(r instanceof Number||r instanceof String||r instanceof Boolean)){const e={},i=r;for(const o in i)e[o]=kc(i[o]);return e}return Mm(r)}function Nc(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(!Nc(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}function jl(r,e="",i=null,o="fill"){if(r==null)return{filter:()=>!0,needGeometry:!1,needFeature:!1};Nc(r)||(r=mh(r));const a=r;let c=!0;try{c=(function(v){if(!Ts(v))return v;let b=kc(v);return Pm(b),b=Vc(b),b})(a)}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(a,null,2)}
7        `)}let h=null,f=null;if(o!=="background"&&o!=="sky"&&o!=="slot"){f=pe[`filter_${o}`];const v=Fl(c,f,e,i);if(v.result==="error")throw new Error(v.value.map(b=>`${b.key}: ${b.message}`).join(", "));h=(b,T,S)=>v.value.evaluate(b,T,{},S)}let _=null,y=null;if(c!==a){const v=Fl(a,f,e,i);if(v.result==="error")throw new Error(v.value.map(b=>`${b.key}: ${b.message}`).join(", "));_=(b,T,S,C,P)=>v.value.evaluate(b,T,{},S,void 0,void 0,C,P),y=!$s(v.value.expression)}return{filter:h,dynamicFilter:_||void 0,needGeometry:Rm(c),needFeature:!!y}}function Vc(r){if(!Array.isArray(r))return r;const e=(function(i){if(Fg.has(i[0])){for(let o=1;o<i.length;o++)if(Ts(i[o]))return!0}return i})(r);return e===!0?e:e.map(i=>Vc(i))}function Pm(r){let e=!1;const i=[];if(r[0]==="case"){for(let o=1;o<r.length-1;o+=2)e=e||Ts(r[o]),i.push(r[o+1]);i.push(r.at(-1))}else if(r[0]==="match"){e=e||Ts(r[1]);for(let o=2;o<r.length-1;o+=2)i.push(r[o+1]);i.push(r.at(-1))}else if(r[0]==="step"){e=e||Ts(r[1]);for(let o=1;o<r.length-1;o+=2)i.push(r[o+1])}e&&(r.length=0,r.push("any",...i));for(let o=1;o<r.length;o++)Pm(r[o])}function Ts(r){if(!Array.isArray(r))return!1;if((e=r[0])==="pitch"||e==="distance-from-center")return!0;var e;
vendor: 35,267 bytes, line 7
7for(let i=1;i<r.length;i++)if(Ts(r[i]))return!0;return!1}const Fg=new Set(["in","==","!=",">",">=","<","<=","to-boolean"]);function Og(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 mh(r){if(!r)return!0;const e=r[0];return r.length<=1?e!=="any":e==="=="?uf(r[1],r[2],"=="):e==="!="?Uc(uf(r[1],r[2],"==")):e==="<"||e===">"||e==="<="||e===">="?uf(r[1],r[2],e):e==="any"?(i=r.slice(1),["any"].concat(i.map(mh))):e==="all"?["all"].concat(r.slice(1).map(mh)):e==="none"?["all"].concat(r.slice(1).map(mh).map(Uc)):e==="in"?Dm(r[1],r.slice(2)):e==="!in"?Uc(Dm(r[1],r.slice(2))):e==="has"?zm(r[1]):e!=="!has"||Uc(zm(r[1]));var i}function uf(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 Dm(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(Og)]]:["filter-in-small",r,["literal",e]]}}function zm(r){switch(r){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",r]}}function Uc(r){return["!",r]}const Yo="�";function hf(r,e){return e?`${r}${Yo}${e}`:r}function Po(r){const e=r.indexOf(Yo);return e>=0?r.slice(e+1):""}let df;const Lm=()=>df||(df=new Li({"icon-size":new $e(pe.layout_symbol["icon-size"]),"icon-image":new $e(pe.layout_symbol["icon-image"]),"icon-rotate":new $e(pe.layout_symbol["icon-rotate"]),"icon-offset":new $e(pe.layout_symbol["icon-offset"]),"text-size":new $e(pe.layout_symbol["text-size"]),"text-rotate":new $e(pe.layout_symbol["text-rotate"]),"text-offset":new $e(pe.layout_symbol["text-offset"])}));let Fm;const ff=()=>Fm||(Fm=new Li({"icon-opacity":new $e(pe.paint_symbol["icon-opacity"]),"icon-occlusion-opacity":new $e(pe.paint_symbol["icon-occlusion-opacity"]),"icon-emissive-strength":new $e(pe.paint_symbol["icon-emissive-strength"]),"text-emissive-strength":new $e(pe.paint_symbol["text-emissive-strength"]),"icon-color":new $e(pe.paint_symbol["icon-color"]),"icon-halo-color":new $e(pe.paint_symbol["icon-halo-color"]),"icon-halo-width":new $e(pe.paint_symbol["icon-halo-width"]),"icon-halo-blur":new $e(pe.paint_symbol["icon-halo-blur"]),"icon-translate":new $e(pe.paint_symbol["icon-translate"]),"text-opacity":new $e(pe.paint_symbol["text-opacity"]),"text-occlusion-opacity":new $e(pe.paint_symbol["text-occlusion-opacity"]),"text-color":new $e(pe.paint_symbol["text-color"],{runtimeType:_n,getOverride:r=>r.textColor,hasOverride:r=>!!r.textColor}),"text-halo-color":new $e(pe.paint_symbol["text-halo-color"]),"text-halo-width":new $e(pe.paint_symbol["text-halo-width"]),"text-halo-blur":new $e(pe.paint_symbol["text-halo-blur"]),"text-translate":new $e(pe.paint_symbol["text-translate"]),"symbol-z-offset":new $e(pe.paint_symbol["symbol-z-offset"]),"icon-color-use-theme":new $e({type:"string",default:"default","property-type":"data-driven"}),"icon-halo-color-use-theme":new $e({type:"string",default:"default","property-type":"data-driven"}),"text-color-use-theme":new $e({type:"string",default:"default","property-type":"data-driven"}),"text-halo-color-use-theme":new $e({type:"string",default:"default","property-type":"data-driven"})}));class pf{constructor(e,i,o,a,c,h){this._conditionSpec=e,this._propertiesSpec=o;const f=Fl(e,pe.appearance.condition);if(f.result==="success"&&(this.condition=f.value),this.name=i,o){this.layoutProperties=new Xo(Lm()),this.unevaluatedLayout=new Bc(Lm(),a,c,h),this.paintProperties=new Xo(ff()),this.unevaluatedPaint=new Bc(ff(),a,c,"");for(const _ in o)_ in this.unevaluatedLayout._values?this.unevaluatedLayout.setValue(_,o[_]):_ in this.unevaluatedPaint._values&&this.unevaluatedPaint.setValue(_,o[_])}}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}getName(){return this.name}getLayoutProperty(e){return this.layoutProperties.get(e)}getPaintProperty(e){return this.paintProperties.get(e)}getUnevaluatedLayoutProperties(){return this.unevaluatedLayout}getUnevaluatedLayoutProperty(e){return this.unevaluatedLayout._values[e]}getUnevaluatedPaintProperty(e){return this.unevaluatedPaint._values[e]}recalculate(e,i,o){this.unevaluatedLayout&&(this.layoutProperties=this.unevaluatedLayout.possiblyEvaluate(e,void 0,i,o)),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():{},...this.unevaluatedPaint?this.unevaluatedPaint.serialize():{}};return Object.keys(i).length>0&&(e.properties=i),e}hasIconLayoutProperties(){const e=this.hasLayoutProperty("icon-image"),i=this.hasLayoutProperty("icon-size"),o=this.hasLayoutProperty("icon-offset"),a=this.hasLayoutProperty("icon-rotate");return e||i||o||a}hasTextLayoutProperties(){const e=this.hasLayoutProperty("text-size"),i=this.hasLayoutProperty("text-offset"),o=this.hasLayoutProperty("text-rotate");return e||i||o}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 Om="-transition",Bg=new Set(["fill","line","background","hillshade","raster"]);class an extends wa{constructor(e,i,o,a,c,h){if(super(),this.id=e.id,this.fqid=hf(this.id,o),this.type=e.type,this.scope=o,this.lut=a,this.options=c,this.iconImageUseTheme=h,this.appearances=new Array,this.appearancesVersion=0,this._featureFilter={filter:()=>!0,needGeometry:!1,needFeature:!1},this._filterCompiled=!1,e.type!=="custom"&&(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),e.slot&&(this.slot=e.slot),e.appearances&&this.setAppearances(e.appearances),i.layout&&(this._unevaluatedLayout=new Bc(i.layout,this.scope,c,this.iconImageUseTheme)),i.paint)){this._transitionablePaint=new Lc(i.paint,this.scope,c);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._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Xo(i.paint)}}onAdd(e){}onRemove(e){}isDraped(e){return!this.is3D(!0)&&Bg.has(this.type)}getLayoutProperty(e){return e==="visibility"?this.visibility:this._unevaluatedLayout.getValue(e)}setLayoutProperty(e,i){if(this.type==="custom"&&e==="visibility")return void(this.visibility=i);const o=this._unevaluatedLayout;o._properties.properties[e]&&(o.setValue(e,i),e==="visibility"&&this.possiblyEvaluateVisibility())}setAppearances(e){this.appearances=[],e.forEach(i=>{this.appearances.push(new pf(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(Om)?this._transitionablePaint.getTransition(e.slice(0,-11)):this._transitionablePaint.getValue(e)}isPaintProperty(e){return!!this._transitionablePaint._properties.properties[e]}setPaintProperty(e,i){const o=this._transitionablePaint,a=o._properties.properties;if(e.endsWith(Om)){const b=e.slice(0,-11);return a[b]&&o.setTransition(b,i||void 0),!1}if(!a[e])return!1;const c=o._values[e],h=c.value.isDataDriven(),f=c.value;o.setValue(e,i),this._handleSpecialPaintPropertyUpdate(e);const _=o._values[e].value,y=_.isDataDriven(),v=e.endsWith("pattern")||e==="line-dasharray";return y||h||v||this._handleOverridablePaintPropertyUpdate(e,f,_)}_handleSpecialPaintPropertyUpdate(e){}getProgramIds(){return null}getDefaultProgramParams(e,i,o){return null}_handleOverridablePaintPropertyUpdate(e,i,o){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())),st(e,(i,o)=>!(i===void 0||o==="layout"&&!Object.keys(i).length||o==="paint"&&!Object.keys(i).length))}is3D(e){return!1}hasElevation(){return!1}mayUse(e){return!1}prepare(){return Promise.resolve()}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 bs&&Ju(i.property.specification)&&(i.value.kind==="source"||i.value.kind==="composite")&&i.value.isStateDependent)return!0}for(const e of this.appearances)if(!Ca(e.condition.expression))return!0;return!1}compileFilter(e){this._filterCompiled||(this._featureFilter=jl(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,o){return{}}queryRadius(e){}queryIntersectsFeature(e,i,o,a,c,h,f,_,y,v){}}function _h(r,e,i){if(!r._unevaluatedLayout)return!1;const o=r._unevaluatedLayout.getValue(e);return o!==void 0&&(typeof o!="string"||i(o))}function Gl(r,e,i=2){const o=e&&e.length,a=o?e[0]*i:r.length;let c=Bm(r,0,a,i,!0);const h=[];if(!c||c.next===c.prev)return h;let f,_,y;if(o&&(c=(function(v,b,T,S){const C=[];for(let P=0,R=b.length;P<R;P++){const L=Bm(v,b[P]*S,P<R-1?b[P+1]*S:v.length,S,!1);L===L.next&&(L.steiner=!0),C.push(jg(L))}C.sort(km);for(let P=0;P<C.length;P++)T=Ug(C[P],T);return T})(r,e,c,i)),r.length>80*i){f=r[0],_=r[1];let v=f,b=_;for(let T=i;T<a;T+=i){const S=r[T],C=r[T+1];S<f&&(f=S),C<_&&(_=C),S>v&&(v=S),C>b&&(b=C)}y=Math.max(v-f,b-_),y=y!==0?32767/y:0}return za(c,h,i,f,_,y,0),h}function Bm(r,e,i,o,a){let c;if(a===(function(h,f,_,y){let v=0;for(let b=f,T=_-y;b<_;b+=y)v+=(h[T]-h[b])*(h[b+1]+h[T+1]),T=b;return v})(r,e,i,o)>0)for(let h=e;h<i;h+=o)c=Mi(h/o|0,r[h],r[h+1],c);else for(let h=i-o;h>=e;h-=o)c=Mi(h/o|0,r[h],r[h+1],c);return c&&ln(c,c.next)&&(jc(c),c=c.next),c}function Da(r,e){if(!r)return r;e||(e=r);let i,o=r;do if(i=!1,o.steiner||!ln(o,o.next)&&dr(o.prev,o,o.next)!==0)o=o.next;else{if(jc(o),o=e=o.prev,o===o.next)break;i=!0}while(i||o!==e);return e}function za(r,e,i,o,a,c,h){if(!r)return;!h&&c&&(function(_,y,v,b){let T=_;do T.z===0&&(T.z=ql(T.x,T.y,y,v,b)),T.prevZ=T.prev,T.nextZ=T.next,T=T.next;while(T!==_);T.prevZ.nextZ=null,T.prevZ=null,(function(S){let C,P=1;do{let R,L=S;S=null;let V=null;for(C=0;L;){C++;let B=L,G=0;for(let Z=0;Z<P&&(G++,B=B.nextZ,B);Z++);let H=P;for(;G>0||H>0&&B;)G!==0&&(H===0||!B||L.z<=B.z)?(R=L,L=L.nextZ,G--):(R=B,B=B.nextZ,H--),V?V.nextZ=R:S=R,R.prevZ=V,V=R;L=B}V.nextZ=null,P*=2}while(C>1)})(T)})(r,o,a,c);let f=r;for(;r.prev!==r.next;){const _=r.prev,y=r.next;if(c?mf(r,o,a,c):kg(r))e.push(_.i,r.i,y.i),jc(r),r=y.next,f=y.next;else if((r=y)===f){h?h===1?za(r=Ng(Da(r),e),e,i,o,a,c,2):h===2&&Vg(r,e,i,o,a,c):za(Da(r),e,i,o,a,c,1);break}}}function kg(r){const e=r.prev,i=r,o=r.next;if(dr(e,i,o)>=0)return!1;const a=e.x,c=i.x,h=o.x,f=e.y,_=i.y,y=o.y,v=Math.min(a,c,h),b=Math.min(f,_,y),T=Math.max(a,c,h),S=Math.max(f,_,y);let C=o.next;for(;C!==e;){if(C.x>=v&&C.x<=T&&C.y>=b&&C.y<=S&&Fa(a,f,c,_,h,y,C.x,C.y)&&dr(C.prev,C,C.next)>=0)return!1;C=C.next}return!0}function mf(r,e,i,o){const a=r.prev,c=r,h=r.next;if(dr(a,c,h)>=0)return!1;const f=a.x,_=c.x,y=h.x,v=a.y,b=c.y,T=h.y,S=Math.min(f,_,y),C=Math.min(v,b,T),P=Math.max(f,_,y),R=Math.max(v,b,T),L=ql(S,C,e,i,o),V=ql(P,R,e,i,o);let B=r.prevZ,G=r.nextZ;for(;B&&B.z>=L&&G&&G.z<=V;){if(B.x>=S&&B.x<=P&&B.y>=C&&B.y<=R&&B!==a&&B!==h&&Fa(f,v,_,b,y,T,B.x,B.y)&&dr(B.prev,B,B.next)>=0||(B=B.prevZ,G.x>=S&&G.x<=P&&G.y>=C&&G.y<=R&&G!==a&&G!==h&&Fa(f,v,_,b,y,T,G.x,G.y)&&dr(G.prev,G,G.next)>=0))return!1;G=G.nextZ}for(;B&&B.z>=L;){if(B.x>=S&&B.x<=P&&B.y>=C&&B.y<=R&&B!==a&&B!==h&&Fa(f,v,_,b,y,T,B.x,B.y)&&dr(B.prev,B,B.next)>=0)return!1;B=B.prevZ}for(;G&&G.z<=V;){if(G.x>=S&&G.x<=P&&G.y>=C&&G.y<=R&&G!==a&&G!==h&&Fa(f,v,_,b,y,T,G.x,G.y)&&dr(G.prev,G,G.next)>=0)return!1;G=G.nextZ}return!0}function Ng(r,e){let i=r;do{const o=i.prev,a=i.next.next;!ln(o,a)&&Um(o,i,i.next,a)&&Hl(o,a)&&Hl(a,o)&&(e.push(o.i,i.i,a.i),jc(i),jc(i.next),i=r=a),i=i.next}while(i!==r);return Da(i)}function Vg(r,e,i,o,a,c){let h=r;do{let f=h.next.next;for(;f!==h.prev;){if(h.i!==f.i&&Vm(h,f)){let _=jm(h,f);return h=Da(h,h.next),_=Da(_,_.next),za(h,e,i,o,a,c,0),void za(_,e,i,o,a,c,0)}f=f.next}h=h.next}while(h!==r)}function km(r,e){let i=r.x-e.x;return 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 Ug(r,e){const i=(function(a,c){let h=c;const f=a.x,_=a.y;let y,v=-1/0;if(ln(a,h))return h;do{if(ln(a,h.next))return h.next;if(_<=h.y&&_>=h.next.y&&h.next.y!==h.y){const P=h.x+(_-h.y)*(h.next.x-h.x)/(h.next.y-h.y);if(P<=f&&P>v&&(v=P,y=h.x<h.next.x?h:h.next,P===f))return y}h=h.next}while(h!==c);if(!y)return null;const b=y,T=y.x,S=y.y;let C=1/0;h=y;do{if(f>=h.x&&h.x>=T&&f!==h.x&&Nm(_<S?f:v,_,T,S,_<S?v:f,_,h.x,h.y)){const P=Math.abs(_-h.y)/(f-h.x);Hl(h,a)&&(P<C||P===C&&(h.x>y.x||h.x===y.x&&La(y,h)))&&(y=h,C=P)}h=h.next}while(h!==b);return y})(r,e);if(!i)return e;const o=jm(i,r);return Da(o,o.next),Da(i,i.next)}function La(r,e){return dr(r.prev,r,e.prev)<0&&dr(e.next,r,r.next)<0}function ql(r,e,i,o,a){return(r=1431655765&((r=858993459&((r=252645135&((r=16711935&((r=(r-i)*a|0)|r<<8))|r<<4))|r<<2))|r<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-o)*a|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function jg(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 Nm(r,e,i,o,a,c,h,f){return(a-h)*(e-f)>=(r-h)*(c-f)&&(r-h)*(o-f)>=(i-h)*(e-f)&&(i-h)*(c-f)>=(a-h)*(o-f)}function Fa(r,e,i,o,a,c,h,f){return!(r===h&&e===f)&&Nm(r,e,i,o,a,c,h,f)}function Vm(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!(function(i,o){let a=i;do{if(a.i!==i.i&&a.next.i!==i.i&&a.i!==o.i&&a.next.i!==o.i&&Um(a,a.next,i,o))return!0;a=a.next}while(a!==i);return!1})(r,e)&&(Hl(r,e)&&Hl(e,r)&&(function(i,o){let a=i,c=!1;const h=(i.x+o.x)/2,f=(i.y+o.y)/2;do a.y>f!=a.next.y>f&&a.next.y!==a.y&&h<(a.next.x-a.x)*(f-a.y)/(a.next.y-a.y)+a.x&&(c=!c),a=a.next;while(a!==i);return c})(r,e)&&(dr(r.prev,r,e.prev)||dr(r,e.prev,e))||ln(r,e)&&dr(r.prev,r,r.next)>0&&dr(e.prev,e,e.next)>0)}function dr(r,e,i){return(e.y-r.y)*(i.x-e.x)-(e.x-r.x)*(i.y-e.y)}function ln(r,e){return r.x===e.x&&r.y===e.y}function Um(r,e,i,o){const a=yh(dr(r,e,i)),c=yh(dr(r,e,o)),h=yh(dr(i,o,r)),f=yh(dr(i,o,e));return a!==c&&h!==f||!(a!==0||!gh(r,i,e))||!(c!==0||!gh(r,o,e))||!(h!==0||!gh(i,r,o))||!(f!==0||!gh(i,e,o))}function gh(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 yh(r){return r>0?1:r<0?-1:0}function Hl(r,e){return dr(r.prev,r,r.next)<0?dr(r,e,r.next)>=0&&dr(r,r.prev,e)>=0:dr(r,e,r.prev)<0||dr(r,r.next,e)<0}function jm(r,e){const i=_f(r.i,r.x,r.y),o=_f(e.i,e.x,e.y),a=r.next,c=e.prev;return r.next=e,e.prev=r,i.next=a,a.prev=i,o.next=i,i.prev=o,c.next=o,o.prev=c,o}function Mi(r,e,i,o){const a=_f(r,e,i);return o?(a.next=o.next,a.prev=o,o.next.prev=a,o.next=a):(a.prev=a,a.next=a),a}function jc(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 _f(r,e,i){return{i:r,x:e,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function Gm(r,e,i=1){if(!r)return null;const o=typeof r=="string"?Wr.from(r).getPrimary():r.getPrimary(),a=typeof r=="string"?null:r.getSecondary();for(const c of[o,a]){if(!c)continue;const h=c.id.toString();e.has(h)||e.set(h,[]),c.scaleSelf(i),e.get(h).push(c)}return{primary:o.toString(),secondary:a?a.toString():null}}function gf(r,e,i,o){const a=o.patternDependencies;let c=!1;for(const h of e){const f=h.paint.get(`${r}-pattern`);f.isConstant()||(c=!0),Gm(f.constantOr(null),a,i)&&(c=!0)}return c}function yf(r,e,i,o,a,c){const h=c.patternDependencies;for(const f of e){const _=f.paint.get(`${r}-pattern`).value;if(_.kind!=="constant"){const y=Gm(_.evaluate({zoom:o},i,{},void 0,c.availableImages),h,a);if(!y)continue;const{primary:v,secondary:b}=y;v&&(i.patterns[f.id]=[v,b].filter(Boolean))}}return i}const cn=Ke/Math.PI/2,Oa=64,xf=[Oa,32,16],ao=-cn,lo=cn;function $l(r,e,i,o=cn){return i=jt(i),[r*Math.sin(i)*o,-e*o,r*Math.cos(i)*o]}function Ba(r,e,i){return $l(Math.cos(jt(r)),Math.sin(jt(r)),e,i)}const Zl=63710088e-1,vf=2*Math.PI*Zl;class Kt{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 Kt(le(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,o=this.lat*i,a=e.lat*i,c=Math.sin(o)*Math.sin(a)+Math.cos(o)*Math.cos(a)*Math.cos((e.lng-this.lng)*i);return Zl*Math.acos(Math.min(c,1))}toBounds(e=0){const i=360*e/40075017,o=i/Math.cos(Math.PI/180*this.lat);return new Qs({lng:this.lng-o,lat:this.lat-i},{lng:this.lng+o,lat:this.lat+i})}toEcef(e){return Ba(this.lat,this.lng,cn+e*cn/Zl)}static convert(e){if(e instanceof Kt)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new Kt(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null)return new Kt(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 Qs{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 Kt?new Kt(e.lng,e.lat):Kt.convert(e),this}setSouthWest(e){return this._sw=e instanceof Kt?new Kt(e.lng,e.lat):Kt.convert(e),this}extend(e){const i=this._sw,o=this._ne;let a,c;if(e instanceof Kt)a=e,c=e;else{if(!(e instanceof Qs))return Array.isArray(e)?e.length===4||e.every(Array.isArray)?this.extend(Qs.convert(e)):this.extend(Kt.convert(e)):typeof e=="object"&&e!==null&&Object.hasOwn(e,"lat")&&(Object.hasOwn(e,"lon")||Object.hasOwn(e,"lng"))?this.extend(Kt.convert(e)):this;if(a=e._sw,c=e._ne,!a||!c)return this}return i||o?(i.lng=Math.min(a.lng,i.lng),i.lat=Math.min(a.lat,i.lat),o.lng=Math.max(c.lng,o.lng),o.lat=Math.max(c.lat,o.lat)):(this._sw=new Kt(a.lng,a.lat),this._ne=new Kt(c.lng,c.lat)),this}getCenter(){return new Kt((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 Kt(this.getWest(),this.getNorth())}getSouthEast(){return new Kt(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:o}=Kt.convert(e);let a=this._sw.lng<=i&&i<=this._ne.lng;return this._sw.lng>this._ne.lng&&(a=this._sw.lng>=i&&i>=this._ne.lng),this._sw.lat<=o&&o<=this._ne.lat&&a}static convert(e){if(e)return e instanceof Qs?e:new Qs(e)}}function bf(r){return vf*Math.cos(r*Math.PI/180)}function un(r,e){return r/bf(e)}function wf(r,e){return r*bf(Er(e))}const co=85.051129;function qm(r){return Math.cos(jt(te(r,-85.051129,co)))}function ka(r,e){const i=te(e,0,25.5),o=Math.pow(2,i);return qm(r)*vf/(512*o)}function Hm(r){return 1/Math.cos(r*Math.PI/180)}function zn(r,e=0){const i=Math.exp(Math.PI*(1-(r.y+e/Ke)/(1<<r.z)*2));return 80150034*i/(i*i+1)/Ke/(1<<r.z)}class Jr{constructor(e,i,o=0){this.x=+e,this.y=+i,this.z=+o}static fromLngLat(e,i=0){const o=Kt.convert(e);return new Jr(Ur(o.lng),Yr(o.lat),un(i,o.lat))}toLngLat(){return new Kt(on(this.x),Er(this.y))}toAltitude(){return wf(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/vf*Hm(Er(this.y))}}function Tf(r,e,i,o,a,c,h,f,_){const y=(e+o)/2,v=(i+a)/2,b=new Ne(y,v);f(b),(function(T,S,C,P,R,L){const V=C-R,B=P-L;return Math.abs((P-S)*V-(C-T)*B)/Math.hypot(V,B)})(b.x,b.y,c.x,c.y,h.x,h.y)>=_?(Tf(r,e,i,y,v,c,b,f,_),Tf(r,y,v,o,a,b,h,f,_)):r.push(h)}function $m(r,e,i){let o=r[0],a=o.x,c=o.y;e(o);const h=[o];for(let f=1;f<r.length;f++){const _=r[f],{x:y,y:v}=_;e(_),Tf(h,a,c,y,v,o,_,e,i),a=y,c=v,o=_}return h}function Ef(r,e,i,o){if(o(e,i)){const a=e.add(i)._mult(.5);Ef(r,e,a,o),Ef(r,a,i,o)}else r.push(i)}function Gg(r,e){let i=r[0];const o=[i];for(let a=1;a<r.length;a++){const c=r[a];Ef(o,i,c,e),i=c}return o}const Sf=Math.pow(2,14)-1,Zm=-Sf-1;function If(r,e){const i=Math.round(r.x*e),o=Math.round(r.y*e);return r.x=te(i,Zm,Sf),r.y=te(o,Zm,Sf),(i<r.x||i>r.x+1||o<r.y||o>r.y+1)&&ht("Geometry exceeds allowed extent, reduce your vector tile buffer size"),r}function xn(r,e,i){const o=r.loadGeometry(),a=r.extent,c=Ke/a;if(e&&i&&i.projection.isReprojectedInTileSpace){const h=1<<e.z,{scale:f,x:_,y,projection:v}=i,b=T=>{const S=on((e.x+T.x/a)/h),C=Er((e.y+T.y/a)/h),P=v.project(S,C);T.x=(P.x*f-_)*a,T.y=(P.y*f-y)*a};for(let T=0;T<o.length;T++)if(r.type!==1)o[T]=$m(o[T],b,1);else{const S=[];for(const C of o[T])C.x<0||C.x>=a||C.y<0||C.y>=a||(b(C),S.push(C));o[T]=S}}for(const h of o)for(const f of h)If(f,c);return o}function uo(r,e){return{type:r.type,id:r.id,properties:r.properties,geometry:e?xn(r):[]}}const qg={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Gc{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 Hg=new ArrayBuffer(0);class _i{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=Hg),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}resizeExact(e){this.reserveExact(e),this.length=e}reserve(e){e>this.capacity&&this._allocate(Math.max(e,Math.floor(5*this.capacity),128))}reserveExact(e){(e>this.capacity||!this.arrayBuffer)&&this._allocate(e)}_allocate(e){this._reallocCount++,this.capacity=e,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 zt(r,e=1){let i=0,o=0;return{members:r.map(a=>{const c=qg[a.type].BYTES_PER_ELEMENT,h=i=Na(i,Math.max(e,c)),f=a.components||1;return o=Math.max(o,c),i+=c*f,{name:a.name,type:a.type,components:f,offset:h}}),size:Na(i,Math.max(o,e)),alignment:e}}function Na(r,e){return Math.ceil(r/e)*e}class Es extends _i{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i){const o=this.length;return this.resize(o+1),this.emplace(o,e,i)}emplace(e,i,o){const a=2*e;return this.int16[a+0]=i,this.int16[a+1]=o,e}}Es.prototype.bytesPerElement=4,Je(Es,"StructArrayLayout2i4");class Wl extends _i{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,o){const a=this.length;return this.resize(a+1),this.emplace(a,e,i,o)}emplace(e,i,o,a){const c=3*e;return this.int16[c+0]=i,this.int16[c+1]=o,this.int16[c+2]=a,e}}Wl.prototype.bytesPerElement=6,Je(Wl,"StructArrayLayout3i6");class qc extends _i{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,o,a){const c=this.length;return this.resize(c+1),this.emplace(c,e,i,o,a)}emplace(e,i,o,a,c){const h=4*e;return this.int16[h+0]=i,this.int16[h+1]=o,this.uint16[h+2]=a,this.uint16[h+3]=c,e}}qc.prototype.bytesPerElement=8,Je(qc,"StructArrayLayout2i2ui8");class Ko extends _i{_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}}Ko.prototype.bytesPerElement=4,Je(Ko,"StructArrayLayout1f4");class Af extends _i{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,o){const a=this.length;return this.resize(a+1),this.emplace(a,e,i,o)}emplace(e,i,o,a){const c=4*e,h=2*e;return this.int16[c+0]=i,this.int16[c+1]=o,this.float32[h+1]=a,e}}Af.prototype.bytesPerElement=8,Je(Af,"StructArrayLayout2i1f8");class xh extends _i{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,o){const a=this.length;return this.resize(a+1),this.emplace(a,e,i,o)}emplace(e,i,o,a){const c=4*e;return this.int16[c+0]=i,this.int16[c+1]=o,this.int16[c+2]=a,e}}xh.prototype.bytesPerElement=8,Je(xh,"StructArrayLayout3i8");class vh extends _i{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,o,a){const c=this.length;return this.resize(c+1),this.emplace(c,e,i,o,a)}emplace(e,i,o,a,c){const h=4*e;return this.int16[h+0]=i,this.int16[h+1]=o,this.int16[h+2]=a,this.int16[h+3]=c,e}}vh.prototype.bytesPerElement=8,Je(vh,"StructArrayLayout4i8");class Cf extends _i{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,o,a,c){const h=this.length;return this.resize(h+1),this.emplace(h,e,i,o,a,c)}emplace(e,i,o,a,c,h){const f=5*e;return this.int16[f+0]=i,this.int16[f+1]=o,this.int16[f+2]=a,this.int16[f+3]=c,this.int16[f+4]=h,e}}Cf.prototype.bytesPerElement=10,Je(Cf,"StructArrayLayout5i10");class Mf extends _i{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,o,a,c,h,f){const _=this.length;return this.resize(_+1),this.emplace(_,e,i,o,a,c,h,f)}emplace(e,i,o,a,c,h,f,_){const y=6*e,v=12*e,b=3*e;return this.int16[y+0]=i,this.int16[y+1]=o,this.uint8[v+4]=a,this.uint8[v+5]=c,this.uint8[v+6]=h,this.uint8[v+7]=f,this.float32[b+2]=_,e}}Mf.prototype.bytesPerElement=12,Je(Mf,"StructArrayLayout2i4ub1f12");class ho extends _i{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,o){const a=this.length;return this.resize(a+1),this.emplace(a,e,i,o)}emplace(e,i,o,a){const c=3*e;return this.float32[c+0]=i,this.float32[c+1]=o,this.float32[c+2]=a,e}}ho.prototype.bytesPerElement=12,Je(ho,"StructArrayLayout3f12");class Ss extends _i{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,o,a,c){const h=this.length;return this.resize(h+1),this.emplace(h,e,i,o,a,c)}emplace(e,i,o,a,c,h){const f=6*e,_=3*e;return this.uint16[f+0]=i,this.uint16[f+1]=o,this.uint16[f+2]=a,this.uint16[f+3]=c,this.float32[_+2]=h,e}}Ss.prototype.bytesPerElement=12,Je(Ss,"StructArrayLayout4ui1f12");class Va extends _i{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,o,a){const c=this.length;return this.resize(c+1),this.emplace(c,e,i,o,a)}emplace(e,i,o,a,c){const h=4*e;return this.uint16[h+0]=i,this.uint16[h+1]=o,this.uint16[h+2]=a,this.uint16[h+3]=c,e}}Va.prototype.bytesPerElement=8,Je(Va,"StructArrayLayout4ui8");class Hc extends _i{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,o,a,c,h){const f=this.length;return this.resize(f+1),this.emplace(f,e,i,o,a,c,h)}emplace(e,i,o,a,c,h,f){const _=6*e;return this.int16[_+0]=i,this.int16[_+1]=o,this.int16[_+2]=a,this.int16[_+3]=c,this.int16[_+4]=h,this.int16[_+5]=f,e}}Hc.prototype.bytesPerElement=12,Je(Hc,"StructArrayLayout6i12");class Pf extends _i{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,o,a,c,h,f,_,y,v,b,T){const S=this.length;return this.resize(S+1),this.emplace(S,e,i,o,a,c,h,f,_,y,v,b,T)}emplace(e,i,o,a,c,h,f,_,y,v,b,T,S){const C=12*e;return this.int16[C+0]=i,this.int16[C+1]=o,this.int16[C+2]=a,this.int16[C+3]=c,this.uint16[C+4]=h,this.uint16[C+5]=f,this.uint16[C+6]=_,this.uint16[C+7]=y,this.int16[C+8]=v,this.int16[C+9]=b,this.int16[C+10]=T,this.int16[C+11]=S,e}}Pf.prototype.bytesPerElement=24,Je(Pf,"StructArrayLayout4i4ui4i24");class Rf extends _i{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,o,a,c,h){const f=this.length;return this.resize(f+1),this.emplace(f,e,i,o,a,c,h)}emplace(e,i,o,a,c,h,f){const _=10*e,y=5*e;return this.int16[_+0]=i,this.int16[_+1]=o,this.int16[_+2]=a,this.float32[y+2]=c,this.float32[y+3]=h,this.float32[y+4]=f,e}}Rf.prototype.bytesPerElement=20,Je(Rf,"StructArrayLayout3i3f20");class Is extends _i{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,o,a){const c=this.length;return this.resize(c+1),this.emplace(c,e,i,o,a)}emplace(e,i,o,a,c){const h=4*e;return this.float32[h+0]=i,this.float32[h+1]=o,this.float32[h+2]=a,this.float32[h+3]=c,e}}Is.prototype.bytesPerElement=16,Je(Is,"StructArrayLayout4f16");class Df extends _i{_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}}Df.prototype.bytesPerElement=4,Je(Df,"StructArrayLayout1ul4");class fo extends _i{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i){const o=this.length;return this.resize(o+1),this.emplace(o,e,i)}emplace(e,i,o){const a=2*e;return this.uint16[a+0]=i,this.uint16[a+1]=o,e}}fo.prototype.bytesPerElement=4,Je(fo,"StructArrayLayout2ui4");class zf extends _i{_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,o,a,c,h,f,_,y,v,b,T,S){const C=this.length;return this.resize(C+1),this.emplace(C,e,i,o,a,c,h,f,_,y,v,b,T,S)}emplace(e,i,o,a,c,h,f,_,y,v,b,T,S,C){const P=20*e,R=10*e;return this.int16[P+0]=i,this.int16[P+1]=o,this.int16[P+2]=a,this.int16[P+3]=c,this.int16[P+4]=h,this.float32[R+3]=f,this.float32[R+4]=_,this.float32[R+5]=y,this.float32[R+6]=v,this.int16[P+14]=b,this.uint32[R+8]=T,this.uint16[P+18]=S,this.uint16[P+19]=C,e}}zf.prototype.bytesPerElement=40,Je(zf,"StructArrayLayout5i4f1i1ul2ui40");class bh extends _i{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,o,a,c,h,f){const _=this.length;return this.resize(_+1),this.emplace(_,e,i,o,a,c,h,f)}emplace(e,i,o,a,c,h,f,_){const y=8*e;return this.int16[y+0]=i,this.int16[y+1]=o,this.int16[y+2]=a,this.int16[y+4]=c,this.int16[y+5]=h,this.int16[y+6]=f,this.int16[y+7]=_,e}}bh.prototype.bytesPerElement=16,Je(bh,"StructArrayLayout3i2i2i16");class Lf extends _i{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,o,a,c){const h=this.length;return this.resize(h+1),this.emplace(h,e,i,o,a,c)}emplace(e,i,o,a,c,h){const f=4*e,_=8*e;return this.float32[f+0]=i,this.float32[f+1]=o,this.float32[f+2]=a,this.int16[_+6]=c,this.int16[_+7]=h,e}}Lf.prototype.bytesPerElement=16,Je(Lf,"StructArrayLayout2f1f2i16");class wh extends _i{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,o,a,c,h){const f=this.length;return this.resize(f+1),this.emplace(f,e,i,o,a,c,h)}emplace(e,i,o,a,c,h,f){const _=20*e,y=5*e;return this.uint8[_+0]=i,this.uint8[_+1]=o,this.float32[y+1]=a,this.float32[y+2]=c,this.float32[y+3]=h,this.float32[y+4]=f,e}}wh.prototype.bytesPerElement=20,Je(wh,"StructArrayLayout2ub4f20");class Mr extends _i{_refreshViews(){this.uint8=new Uint8Arra
vendor: 11,381 bytes, line 7
7y(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,o){const a=this.length;return this.resize(a+1),this.emplace(a,e,i,o)}emplace(e,i,o,a){const c=3*e;return this.uint16[c+0]=i,this.uint16[c+1]=o,this.uint16[c+2]=a,e}}Mr.prototype.bytesPerElement=6,Je(Mr,"StructArrayLayout3ui6");class Th extends _i{_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,o,a,c,h,f,_,y,v,b,T,S,C,P,R,L,V,B,G,H){const Z=this.length;return this.resize(Z+1),this.emplace(Z,e,i,o,a,c,h,f,_,y,v,b,T,S,C,P,R,L,V,B,G,H)}emplace(e,i,o,a,c,h,f,_,y,v,b,T,S,C,P,R,L,V,B,G,H,Z){const oe=30*e,X=15*e,ee=60*e;return this.int16[oe+0]=i,this.int16[oe+1]=o,this.int16[oe+2]=a,this.float32[X+2]=c,this.float32[X+3]=h,this.uint16[oe+8]=f,this.uint16[oe+9]=_,this.uint32[X+5]=y,this.uint32[X+6]=v,this.uint32[X+7]=b,this.uint16[oe+16]=T,this.uint16[oe+17]=S,this.uint16[oe+18]=C,this.float32[X+10]=P,this.float32[X+11]=R,this.uint8[ee+48]=L,this.uint8[ee+49]=V,this.uint8[ee+50]=B,this.uint32[X+13]=G,this.int16[oe+28]=H,this.uint8[ee+58]=Z,e}}Th.prototype.bytesPerElement=60,Je(Th,"StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60");class Eh extends _i{_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,o,a,c,h,f,_,y,v,b,T,S,C,P,R,L,V,B,G,H,Z,oe,X,ee,ie,ne,fe,ge,we,Se,Ee,Ve){const Ie=this.length;return this.resize(Ie+1),this.emplace(Ie,e,i,o,a,c,h,f,_,y,v,b,T,S,C,P,R,L,V,B,G,H,Z,oe,X,ee,ie,ne,fe,ge,we,Se,Ee,Ve)}emplace(e,i,o,a,c,h,f,_,y,v,b,T,S,C,P,R,L,V,B,G,H,Z,oe,X,ee,ie,ne,fe,ge,we,Se,Ee,Ve,Ie){const Te=20*e,Ce=40*e,ze=80*e;return this.float32[Te+0]=i,this.float32[Te+1]=o,this.int16[Ce+4]=a,this.int16[Ce+5]=c,this.int16[Ce+6]=h,this.int16[Ce+7]=f,this.int16[Ce+8]=_,this.int16[Ce+9]=y,this.int16[Ce+10]=v,this.int16[Ce+11]=b,this.int16[Ce+12]=T,this.uint16[Ce+13]=S,this.uint16[Ce+14]=C,this.uint16[Ce+15]=P,this.uint16[Ce+16]=R,this.uint16[Ce+17]=L,this.uint16[Ce+18]=V,this.uint16[Ce+19]=B,this.uint16[Ce+20]=G,this.uint16[Ce+21]=H,this.uint16[Ce+22]=Z,this.uint16[Ce+23]=oe,this.uint16[Ce+24]=X,this.uint16[Ce+25]=ee,this.uint16[Ce+26]=ie,this.uint16[Ce+27]=ne,this.uint32[Te+14]=fe,this.float32[Te+15]=ge,this.float32[Te+16]=we,this.float32[Te+17]=Se,this.float32[Te+18]=Ee,this.uint8[ze+76]=Ve,this.uint16[Ce+39]=Ie,e}}Eh.prototype.bytesPerElement=80,Je(Eh,"StructArrayLayout2f9i15ui1ul4f1ub1ui80");class Sh extends _i{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,o,a,c,h){const f=this.length;return this.resize(f+1),this.emplace(f,e,i,o,a,c,h)}emplace(e,i,o,a,c,h,f){const _=6*e;return this.float32[_+0]=i,this.float32[_+1]=o,this.float32[_+2]=a,this.float32[_+3]=c,this.float32[_+4]=h,this.float32[_+5]=f,e}}Sh.prototype.bytesPerElement=24,Je(Sh,"StructArrayLayout6f24");class ea extends _i{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,o,a,c){const h=this.length;return this.resize(h+1),this.emplace(h,e,i,o,a,c)}emplace(e,i,o,a,c,h){const f=5*e;return this.float32[f+0]=i,this.float32[f+1]=o,this.float32[f+2]=a,this.float32[f+3]=c,this.float32[f+4]=h,e}}ea.prototype.bytesPerElement=20,Je(ea,"StructArrayLayout5f20");class Ff extends _i{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,o,a,c,h,f){const _=this.length;return this.resize(_+1),this.emplace(_,e,i,o,a,c,h,f)}emplace(e,i,o,a,c,h,f,_){const y=7*e;return this.float32[y+0]=i,this.float32[y+1]=o,this.float32[y+2]=a,this.float32[y+3]=c,this.float32[y+4]=h,this.float32[y+5]=f,this.float32[y+6]=_,e}}Ff.prototype.bytesPerElement=28,Je(Ff,"StructArrayLayout7f28");class Jo extends _i{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,o,a,c,h,f,_,y,v,b){const T=this.length;return this.resize(T+1),this.emplace(T,e,i,o,a,c,h,f,_,y,v,b)}emplace(e,i,o,a,c,h,f,_,y,v,b,T){const S=11*e;return this.float32[S+0]=i,this.float32[S+1]=o,this.float32[S+2]=a,this.float32[S+3]=c,this.float32[S+4]=h,this.float32[S+5]=f,this.float32[S+6]=_,this.float32[S+7]=y,this.float32[S+8]=v,this.float32[S+9]=b,this.float32[S+10]=T,e}}Jo.prototype.bytesPerElement=44,Je(Jo,"StructArrayLayout11f44");class Of extends _i{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,o,a,c,h,f,_,y){const v=this.length;return this.resize(v+1),this.emplace(v,e,i,o,a,c,h,f,_,y)}emplace(e,i,o,a,c,h,f,_,y,v){const b=9*e;return this.float32[b+0]=i,this.float32[b+1]=o,this.float32[b+2]=a,this.float32[b+3]=c,this.float32[b+4]=h,this.float32[b+5]=f,this.float32[b+6]=_,this.float32[b+7]=y,this.float32[b+8]=v,e}}Of.prototype.bytesPerElement=36,Je(Of,"StructArrayLayout9f36");class Ua extends _i{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i){const o=this.length;return this.resize(o+1),this.emplace(o,e,i)}emplace(e,i,o){const a=2*e;return this.float32[a+0]=i,this.float32[a+1]=o,e}}Ua.prototype.bytesPerElement=8,Je(Ua,"StructArrayLayout2f8");class ta extends _i{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,o,a){const c=this.length;return this.resize(c+1),this.emplace(c,e,i,o,a)}emplace(e,i,o,a,c){const h=6*e;return this.uint32[3*e+0]=i,this.uint16[h+2]=o,this.uint16[h+3]=a,this.uint16[h+4]=c,e}}ta.prototype.bytesPerElement=12,Je(ta,"StructArrayLayout1ul3ui12");class Ih extends _i{_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}}Ih.prototype.bytesPerElement=2,Je(Ih,"StructArrayLayout1ui2");class Xl extends _i{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,o,a,c,h,f,_,y,v,b,T,S,C,P,R){const L=this.length;return this.resize(L+1),this.emplace(L,e,i,o,a,c,h,f,_,y,v,b,T,S,C,P,R)}emplace(e,i,o,a,c,h,f,_,y,v,b,T,S,C,P,R,L){const V=16*e;return this.float32[V+0]=i,this.float32[V+1]=o,this.float32[V+2]=a,this.float32[V+3]=c,this.float32[V+4]=h,this.float32[V+5]=f,this.float32[V+6]=_,this.float32[V+7]=y,this.float32[V+8]=v,this.float32[V+9]=b,this.float32[V+10]=T,this.float32[V+11]=S,this.float32[V+12]=C,this.float32[V+13]=P,this.float32[V+14]=R,this.float32[V+15]=L,e}}Xl.prototype.bytesPerElement=64,Je(Xl,"StructArrayLayout16f64");class $c extends _i{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,o,a,c,h,f){const _=this.length;return this.resize(_+1),this.emplace(_,e,i,o,a,c,h,f)}emplace(e,i,o,a,c,h,f,_){const y=10*e,v=5*e;return this.uint16[y+0]=i,this.uint16[y+1]=o,this.uint16[y+2]=a,this.uint16[y+3]=c,this.float32[v+2]=h,this.float32[v+3]=f,this.float32[v+4]=_,e}}$c.prototype.bytesPerElement=20,Je($c,"StructArrayLayout4ui3f20");class ja extends _i{_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}}ja.prototype.bytesPerElement=2,Je(ja,"StructArrayLayout1i2");class Zc extends _i{_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}}Zc.prototype.bytesPerElement=1,Je(Zc,"StructArrayLayout1ub1");class Wm extends Gc{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]}}Wm.prototype.size=40;class Xm extends zf{get(e){return new Wm(this,e)}}Je(Xm,"CollisionBoxArray");class Ah extends Gc{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.float32[this._pos4+2]}get tileAnchorY(){return this._structArray.float32[this._pos4+3]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+8]}get numGlyphs(){return this._structArray.uint16[this._pos2+9]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+5]}get lineStartIndex(){return this._structArray.uint32[this._pos4+6]}get lineLength(){return this._structArray.uint32[this._pos4+7]}get segment(){return this._structArray.uint16[this._pos2+16]}get lowerSize(){return this._structArray.uint16[this._pos2+17]}get upperSize(){return this._structArray.uint16[this._pos2+18]}get lineOffsetX(){return this._structArray.float32[this._pos4+10]}get lineOffsetY(){return this._structArray.float32[this._pos4+11]}get writingMode(){return this._structArray.uint8[this._pos1+48]}get placedOrientation(){return this._structArray.uint8[this._pos1+49]}set placedOrientation(e){this._structArray.uint8[this._pos1+49]=e}get hidden(){return this._structArray.uint8[this._pos1+50]}set hidden(e){this._structArray.uint8[this._pos1+50]=e}get crossTileID(){return this._structArray.uint32[this._pos4+13]}set crossTileID(e){this._structArray.uint32[this._pos4+13]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+28]}get flipState(){return this._structArray.uint8[this._pos1+58]}set flipState(e){this._structArray.uint8[this._pos1+58]=e}}Ah.prototype.size=60;class Ch extends Th{get(e){return new Ah(this,e)}}Je(Ch,"PlacedSymbolArray");class Mh extends Gc{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]}
vendor: 19,950 bytes, line 7
7get 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]}}Mh.prototype.size=80;class Bf extends Eh{get(e){return new Mh(this,e)}}Je(Bf,"SymbolInstanceArray");class Ym extends Ko{getoffsetX(e){return this.float32[1*e+0]}}Je(Ym,"GlyphOffsetArray");class Wc extends Es{getx(e){return this.int16[2*e+0]}gety(e){return this.int16[2*e+1]}}Je(Wc,"SymbolLineVertexArray");class Xc extends Gc{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]}}Xc.prototype.size=12;class Ph extends ta{get(e){return new Xc(this,e)}}Je(Ph,"FeatureIndexArray");class kf extends fo{geta_centroid_pos0(e){return this.uint16[2*e+0]}geta_centroid_pos1(e){return this.uint16[2*e+1]}}Je(kf,"FillExtrusionCentroidArray");class Nf extends Gc{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]}}Nf.prototype.size=6;class Vf extends Wl{get(e){return new Nf(this,e)}}Je(Vf,"FillExtrusionWallArray");const Uf=zt([{name:"a_pos",components:2,type:"Int16"}],4),Km=zt([{name:"a_road_z_offset",components:1,type:"Float32"}],4),jf=zt([{name:"a_pos",components:2,type:"Int16"},{name:"a_height",components:1,type:"Float32"}],4),$g=zt([{name:"a_pos_normal_3",components:3,type:"Int16"}],4);class wi{constructor(e=[]){this.segments=e}_prepareSegment(e,i,o,a,c){let h=this.segments.at(-1);return e>wi.MAX_VERTEX_ARRAY_LENGTH&&ht(`Max vertices per segment is ${wi.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!h||h.vertexLength+e>wi.MAX_VERTEX_ARRAY_LENGTH||h.sortKey!==a||c!==void 0&&h&&h.batchIndex!==void 0&&h.batchIndex!==c)&&(h={vertexOffset:i,primitiveOffset:o,vertexLength:0,primitiveLength:0},a!==void 0&&(h.sortKey=a),c!==void 0&&(h.batchIndex=c),this.segments.push(h)),h}prepareSegment(e,i,o,a,c){return this._prepareSegment(e,i.length,o.length,a,c)}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,o,a){return new wi([{vertexOffset:e,primitiveOffset:i,vertexLength:o,primitiveLength:a,vaos:{},sortKey:0}])}}function Yl(r,e){return 256*(r=te(Math.floor(r),0,255))+te(Math.floor(e),0,255)}wi.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Je(wi,"SegmentVector");const Zg=zt([{name:"a_pattern",components:4,type:"Uint16"},{name:"a_pixel_ratio",components:1,type:"Float32"}]),Wg=zt([{name:"a_pattern_b",components:4,type:"Uint16"}]),Xg=zt([{name:"a_dash",components:4,type:"Uint16"}]);class Yc{constructor(){this.ids=[],this.uniqueIds=[],this.positions=[],this.indexed=!1}add(e,i,o,a){this.ids.push(Jm(e)),this.positions.push(i,o,a)}eachPosition(e,i){const o=Jm(e);let a=0,c=this.ids.length-1;for(;a<c;){const h=a+c>>1;this.ids[h]>=o?c=h:a=h+1}for(;this.ids[a]===o;)i(this.positions[3*a],this.positions[3*a+1],this.positions[3*a+2]),a++}static serialize(e,i){const o=new Float64Array(e.ids),a=new Uint32Array(e.positions);return Gf(o,a,0,o.length-1),i&&(i.add(o.buffer),i.add(a.buffer)),{ids:o,positions:a}}static deserialize(e){const i=new Yc;let o;i.ids=e.ids,i.positions=e.positions;for(const a of i.ids)a!==o&&i.uniqueIds.push(a),o=a;return i.indexed=!0,i}}function Jm(r){const e=+r;return Number.isSafeInteger(e)?e:Iu(String(r))}function Gf(r,e,i,o){for(;i<o;){const a=r[i+o>>1];let c=i-1,h=o+1;for(;;){do c++;while(r[c]<a);do h--;while(r[h]>a);if(c>=h)break;Kc(r,c,h),Kc(e,3*c,3*h),Kc(e,3*c+1,3*h+1),Kc(e,3*c+2,3*h+2)}h-i<o-h?(Gf(r,e,i,h),i=h+1):(Gf(r,e,h+1,o),o=h)}}function Kc(r,e,i){const o=r[e];r[e]=r[i],r[i]=o}Je(Yc,"FeaturePositionMap");class Ro{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,o){throw new Error("Uniform#set() must be implemented by each concrete Uniform")}}class Ga extends Ro{constructor(e){super(e),this.current=0}set(e,i,o){this.fetchUniformLocation(e,i)&&this.current!==o&&(this.current=o,this.gl.uniform1i(this.location,o))}}class rr extends Ro{constructor(e){super(e),this.current=0}set(e,i,o){this.fetchUniformLocation(e,i)&&this.current!==o&&(this.current=o,this.gl.uniform1f(this.location,o))}}class po extends Ro{constructor(e){super(e),this.current=[0,0]}set(e,i,o){this.fetchUniformLocation(e,i)&&(o[0]===this.current[0]&&o[1]===this.current[1]||(this.current=o,this.gl.uniform2f(this.location,o[0],o[1])))}}class mo extends Ro{constructor(e){super(e),this.current=[0,0,0]}set(e,i,o){this.fetchUniformLocation(e,i)&&(o[0]===this.current[0]&&o[1]===this.current[1]&&o[2]===this.current[2]||(this.current=o,this.gl.uniform3f(this.location,o[0],o[1],o[2])))}}class Qm extends Ro{constructor(e){super(e),this.current=[0,0,0,0]}set(e,i,o){this.fetchUniformLocation(e,i)&&(o[0]===this.current[0]&&o[1]===this.current[1]&&o[2]===this.current[2]&&o[3]===this.current[3]||(this.current=o,this.gl.uniform4ui(this.location,o[0],o[1],o[2],o[3])))}}class ia extends Ro{constructor(e){super(e),this.current=[0,0,0,0]}set(e,i,o){this.fetchUniformLocation(e,i)&&(o[0]===this.current[0]&&o[1]===this.current[1]&&o[2]===this.current[2]&&o[3]===this.current[3]||(this.current=o,this.gl.uniform4f(this.location,o[0],o[1],o[2],o[3])))}}class e_ extends Ro{constructor(e){super(e),this.current=$t.transparent.toPremultipliedRenderColor(null)}set(e,i,o){this.fetchUniformLocation(e,i)&&(o.r===this.current.r&&o.g===this.current.g&&o.b===this.current.b&&o.a===this.current.a||(this.current=o,this.gl.uniform4f(this.location,o.r,o.g,o.b,o.a)))}}class Jc extends Ro{constructor(e){super(e),this.current=new Float32Array(16)}set(e,i,o){if(!this.fetchUniformLocation(e,i))return;const a=this.current;if(o[12]!==a[12]||o[0]!==a[0])return a.set(o),void this.gl.uniformMatrix4fv(this.location,!1,a);for(let c=1;c<16;c++)if(o[c]!==a[c]){a.set(o),this.gl.uniformMatrix4fv(this.location,!1,a);break}}}class qf extends Ro{constructor(e){super(e),this.current=new Float32Array(4)}set(e,i,o){if(!this.fetchUniformLocation(e,i))return;const a=this.current;for(let c=0;c<4;c++)if(o[c]!==a[c]){a.set(o),this.gl.uniformMatrix2fv(this.location,!1,a);break}}}function Hf(r){return[Yl(255*r.r,255*r.g),Yl(255*r.b,255*r.a)]}function Rh(r,e,i,o,a,c,h,f){return!!r&&(r.kind==="composite"||r.kind==="source"?r.evaluate(new oi(0,{brightness:c,worldview:f}),e,i,a,o,h)==="none":r.value==="none")}class Dh{constructor(e,i,o,a){this.value=e,this.uniformNames=i.map(c=>`u_${c}`),this.type=o,this.context=a}setUniform(e,i,o,a,c){const h=a.constantOr(this.value);i.set(e,c,h instanceof $t?h.toPremultipliedRenderColor(this.lutExpression&&this.lutExpression.kind==="constant"&&this.lutExpression.value==="none"?null:this.context.lut):h)}getBinding(e,i){return this.type==="color"?new e_(e):new rr(e)}}class Qc{constructor(e,i){this.uniformNames=i.map(o=>`u_${o}`),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,o,a,c){let h=null;c!=="u_pattern"&&c!=="u_dash"||(h=this.pattern),c==="u_pattern_b"&&(h=this.patternTransition),c==="u_pixel_ratio"&&(h=this.pixelRatio),h&&i.set(e,c,h)}getBinding(e,i){return i==="u_pattern"||i==="u_pattern_b"||i==="u_dash"?new Qm(e):new rr(e)}}class Gn{constructor(e,i,o,a){this.expression=e,this.type=o,this.maxValue=0,this.paintVertexAttributes=i.map(c=>({name:`a_${c}`,type:"Float32",components:o==="color"?2:1,offset:0})),this.paintVertexArray=new a}populatePaintArray(e,i,o,a,c,h,f,_){const y=this.paintVertexArray.length,v=this.expression.kind==="composite"||this.expression.kind==="source"?this.expression.evaluate(new oi(0,{brightness:h,worldview:_}),i,{},c,a,f):this.expression.kind==="constant"&&this.expression.value,b=Rh(this.lutExpression,i,{},a,c,h,f,_);this.paintVertexArray.resize(e),this._setPaintValue(y,e,v,b?null:this.context.lut)}updatePaintArray(e,i,o,a,c,h,f,_){const y=this.expression.kind==="composite"||this.expression.kind==="source"?this.expression.evaluate({zoom:0,brightness:f,worldview:_},o,a,void 0,c):this.expression.kind==="constant"&&this.expression.value,v=Rh(this.lutExpression,o,a,c,void 0,f,void 0,_);this._setPaintValue(e,i,y,v?null:this.context.lut)}_setPaintValue(e,i,o,a){if(this.type==="color"){const c=Hf(o.toPremultipliedRenderColor(a));for(let h=e;h<i;h++)this.paintVertexArray.emplace(h,c[0],c[1])}else{for(let c=e;c<i;c++)this.paintVertexArray.emplace(c,o);this.maxValue=Math.max(this.maxValue,Math.abs(o))}}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 qn{constructor(e,i,o,a,c,h){this.expression=e,this.uniformNames=i.map(f=>`u_${f}_t`),this.type=o,this.useIntegerZoom=a,this.context=c,this.maxValue=0,this.paintVertexAttributes=i.map(f=>({name:`a_${f}`,type:"Float32",components:o==="color"?4:2,offset:0})),this.paintVertexArray=new h}populatePaintArray(e,i,o,a,c,h,f,_){const y=this.expression.evaluate(new oi(this.context.zoom,{brightness:h,worldview:_}),i,{},c,a,f),v=this.expression.evaluate(new oi(this.context.zoom+1,{brightness:h,worldview:_}),i,{},c,a,f),b=Rh(this.lutExpression,i,{},a,c,h,f,_),T=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(T,e,y,v,b?null:this.context.lut)}updatePaintArray(e,i,o,a,c,h,f,_){const y=this.expression.evaluate({zoom:this.context.zoom,brightness:f,worldview:_},o,a,void 0,c),v=this.expression.evaluate({zoom:this.context.zoom+1,brightness:f,worldview:_},o,a,void 0,c),b=Rh(this.lutExpression,o,a,c,void 0,f,void 0,_);this._setPaintValue(e,i,y,v,b?null:this.context.lut)}_setPaintValue(e,i,o,a,c){if(this.type==="color"){const h=Hf(o.toPremultipliedRenderColor(c)),f=Hf(a.toPremultipliedRenderColor(c));for(let _=e;_<i;_++)this.paintVertexArray.emplace(_,h[0],h[1],f[0],f[1])}else{for(let h=e;h<i;h++)this.paintVertexArray.emplace(h,o,a);this.maxValue=Math.max(this.maxValue,Math.abs(o),Math.abs(a))}}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,o,a,c){const h=this.useIntegerZoom?Math.floor(o.zoom):o.zoom,f=te(this.expression.interpolationFactor(h,this.context.zoom,this.context.zoom+1),0,1);i.set(e,c,f)}getBinding(e,i){return new rr(e)}}class Do{constructor(e,i,o,a,c){this.expression=e,this.layerId=c,this.paintVertexAttributes=(o==="array"?Xg:Zg).members;for(let h=0;h<i.length;++h);this.paintVertexArray=new a,this.paintTransitionVertexArray=new Va}populatePaintArray(e,i,o,a){const c=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValues(c,e,i.patterns&&i.patterns[this.layerId],o)}updatePaintArray(e,i,o,a,c,h,f){this._setPaintValues(e,i,o.patterns&&o.patterns[this.layerId],h)}_setPaintValues(e,i,o,a){if(!a||!o)return;const c=a[o[0]],h=a[o[1]];if(c){if(c){const{tl:f,br:_,pixelRatio:y}=c;for(let v=e;v<i;v++)this.paintVertexArray.emplace(v,f[0],f[1],_[0],_[1],y)}if(h){this.paintTransitionVertexArray.resize(this.paintVertexArray.length);const{tl:f,br:_}=h;for(let y=e;y<i;y++)this.paintTransitionVertexArray.emplace(y,f[0],f[1],_[0],_[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,Wg.members,i))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy(),this.paintTransitionVertexBuffer&&this.paintTransitionVertexBuffer.destroy()}}class qa{constructor(e,i,o=()=>!0){this.binders={},this._buffers=[],this.context=i;const a=[],c=e;for(const h in e.paint._values){const f=c.paint.get(h);if(h.endsWith("-use-theme")||!o(h)||!(f instanceof bs&&Ju(f.property.specification)))continue;const _=Kg(h,e.type),y=f.value,v=f.property.specification.type,b=!!f.property.useIntegerZoom,T=h==="line-dasharray"||h.endsWith("pattern"),S=c.paint.get(`${h}-use-theme`),C=h==="line-dasharray"&&c.layout.get("line-cap").value.kind!=="constant"||S&&S.value.kind!=="constant";if(y.kind!=="constant"||C)if(y.kind==="source"||C||T){const P=i_(h,v,"source");this.binders[h]=T?new Do(y,_,v,P,e.id):new Gn(y,_,v,P),a.push(`/a_${h}`)}else{const P=i_(h,v,"composite");this.binders[h]=new qn(y,_,v,b,i,P),a.push(`/z_${h}`)}else this.binders[h]=T?new Qc(y.value,_):new Dh(y.value,_,v,i),a.push(`/u_${h}`);S&&(this.binders[h].lutExpression=S.value)}this.cacheKey=a.sort().join("")}updateExpressions(e){const i=e;for(const o in this.binders){const a=this.binders[o];if(a instanceof Gn||a instanceof qn||a instanceof Do){const c=i.paint.get(o);a.expression=c.value}}}getMaxValue(e){const i=this.binders[e];return i instanceof Gn||i instanceof qn?i.maxValue:0}populatePaintArrays(e,i,o,a,c,h,f,_){for(const y in this.binders){const v=this.binders[y];v.context=this.context,(v instanceof Gn||v instanceof qn||v instanceof Do)&&v.populatePaintArray(e,i,o,a,c,h,f,_)}}setConstantPatternPositions(e,i){for(const o in this.binders){const a=this.binders[o];a instanceof Qc&&a.setConstantPatternPositions(e,i)}}getPatternTransitionVertexBuffer(e){const i=this.binders[e];return i instanceof Do?i.paintTransitionVertexBuffer:null}updatePaintArrays(e,i,o,a,c,h,f,_,y,v){let b=!1;const T=Object.keys(e),S=T.length!==0&&!_,C=S?T:i.uniqueIds;this.context.lut=c.lut;for(const P in this.binders){const R=this.binders[P];if(R.context=this.context,(R instanceof Gn||R instanceof qn||R instanceof Do)&&R.expression&&R.expression.kind&&R.expression.kind!=="constant"&&(R.expression.isStateDependent===!0||R.expression.isLightConstant===!1)){const L=c.paint.get(P);R.expression=L.value;for(const V of C){const B=e[V.toString()];i.eachPosition(V,(G,H,Z)=>{const oe=a.feature(G);R.updatePaintArray(H,Z,oe,B,h,f,y,v)})}if(!S)for(const V of o.uniqueIds){const B=e[V.toString()];o.eachPosition(V,(G,H,Z)=>{const oe=a.feature(G);R.updatePaintArray(H,Z,oe,B,h,f,y,v)})}b=!0}}return b}defines(){const e=[];for(const i in this.binders){const o=this.binders[i];(o instanceof Dh||o instanceof Qc)&&e.push(...o.uniformNames.map(a=>`#define HAS_UNIFORM_${a}`))}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e){const i=[];for(const o in this.binders){const a=this.binders[o];if(a instanceof Dh||a instanceof Qc||a instanceof qn)for(const c of a.uniformNames)i.push({name:c,property:o,binding:a.getBinding(e,c)})}return i}setUniforms(e,i,o,a,c){for(const{name:h,property:f,binding:_}of o)this.binders[f].setUniform(e,_,c,a.get(f),h)}updatePaintBuffers(){this._buffers=[];for(const e in this.binders){const i=this.binders[e];(i instanceof Gn||i instanceof qn||i instanceof Do)&&i.paintVertexBuffer&&this._buffers.push(i.paintVertexBuffer),i instanceof Do&&i.paintTransitionVertexBuffer&&this._buffers.push(i.paintTransitionVertexBuffer)}}upload(e){for(const i in this.binders){const o=this.binders[i];(o instanceof Gn||o instanceof qn||o instanceof Do)&&o.upload(e)}this.updatePaintBuffers()}destroy(){for(const e in this.binders){const i=this.binders[e];(i instanceof Gn||i instanceof qn||i instanceof Do)&&i.destroy()}}}class _o{constructor(e,i,o=()=>!0){this.programConfigurations={};for(const a of e)this.programConfigurations[a.id]=new qa(a,i,o);this.needsUpload=!1,this._featureMap=new Yc,this._featureMapWithoutIds=new Yc,this._bufferOffset=0,this._idlessCounter=0}populatePaintArrays(e,i,o,a,c,h,f,_,y){for(const v in this.programConfigurations)this.programConfigurations[v].populatePaintArrays(e,i,a,c,h,f,_,y);i.id!==void 0?this._featureMap.add(i.id,o,this._bufferOffset,e):(this._featureMapWithoutIds.add(this._idlessCounter,o,this._bufferOffset,e),this._idlessCounter+=1),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,i,o,a,c,h,f,_){for(const y of o)this.needsUpload=this.programConfigurations[y.id].updatePaintArrays(e,this._featureMap,this._featureMapWithoutIds,i,y,a,c,h,f||0,_)||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 o of e){const a=this.programConfigurations[o.id];a&&(a.updateExpressions(o),i.add(o.id))}for(const o in this.programConfigurations)i.has(o)||delete this.programConfigurations[o]}}const Yg={"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":["ga
7pwidth"],"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 Kg(r,e){return Yg[r]||[r.replace(`${e}-`,"").replace(/-/g,"_")]}const t_={"line-pattern":{source:Ss,composite:Ss},"fill-pattern":{source:Ss,composite:Ss},"fill-extrusion-pattern":{source:Ss,composite:Ss},"line-dasharray":{source:Va,composite:Va}},zh={color:{source:Ua,composite:Is},number:{source:Ko,composite:Ua}};function i_(r,e,i){const o=t_[r];return o&&o[i]||zh[e][i]}Je(Dh,"ConstantBinder"),Je(Qc,"PatternConstantBinder"),Je(Gn,"SourceExpressionBinder",{omit:["expression"]}),Je(Do,"PatternCompositeBinder",{omit:["expression"]}),Je(qn,"CompositeExpressionBinder",{omit:["expression"]}),Je(qa,"ProgramConfiguration",{omit:["_buffers"]}),Je(_o,"ProgramConfigurationSet");class $f{constructor(e,i,o){this.layoutVertexArray=new Es,this.indexArray=new Mr,this.lineIndexArray=new fo,this.triangleSegments=new wi,this.lineSegments=new wi,this.programConfigurations=new _o(e,{zoom:i,lut:o}),this.uploaded=!1}update(e,i,o,a,c,h,f,_){this.programConfigurations.updatePaintArrays(e,i,c,o,a,h,f,_)}isEmpty(){return this.layoutVertexArray.length===0}needsUpload(){return this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Uf.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.lineIndexBuffer=e.createIndexBuffer(this.lineIndexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.lineIndexBuffer.destroy(),this.programConfigurations.destroy(),this.triangleSegments.destroy(),this.lineSegments.destroy())}populatePaintArrays(e,i,o,a,c,h,f){this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,o,a,c,h,void 0,f)}}Je($f,"FillBufferData");class Zf{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 $f(e.layers,e.zoom,e.lut),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.projection=e.projection,this.sourceLayerIndex=e.sourceLayerIndex,this.sourceLayerName=e.sourceLayerName||"",this.worldview=e.worldview,this.hasAppearances=null}updateFootprints(e,i){}updateAppearances(e,i,o,a){return{hasLayoutChanges:!1,hasUboChanges:!1}}populate(e,i,o,a){this.hasPattern=gf("fill",this.layers,this.pixelRatio,i);const c=this.layers[0].layout.get("fill-sort-key"),h=[];for(const{feature:f,id:_,index:y,sourceLayerIndex:v}of e){const b=this.layers[0]._featureFilter.needGeometry,T=uo(f,b);if(!this.layers[0]._featureFilter.filter(new oi(this.zoom,{worldview:this.worldview,activeFloors:i.activeFloors}),T,o))continue;const S=c?c.evaluate(T,{},o,i.availableImages):void 0,C={id:_,properties:f.properties,type:f.type,sourceLayerIndex:v,index:y,geometry:b?T.geometry:xn(f,o,a),patterns:{},sortKey:S};h.push(C)}c&&h.sort((f,_)=>f.sortKey-_.sortKey);for(const f of h){const{geometry:_,index:y,sourceLayerIndex:v}=f;if(this.hasPattern){const b=yf("fill",this.layers,f,this.zoom,this.pixelRatio,i);this.patternFeatures.push(b)}else this.addFeature(f,_,y,o,{},i.availableImages,i.brightness,i.elevationFeatures);i.featureIndex.insert(e[y].feature,_,y,v,this.index)}!this.hasPattern&&this.hdExt&&this.hdExt.buildFrcSegments(this)}update(e,i,o,a,c,h,f){this.bufferData.update(e,i,o,a,c,h,f,this.worldview),this.hdExt&&this.hdExt.update(e,i,o,a,c,h,f,this.worldview)}updateExpressions(e){this.bufferData.programConfigurations.updateExpressions(e),this.hdExt&&this.hdExt.updateExpressions(e)}addFeatures(e,i,o,a,c,h){for(const f of this.patternFeatures)this.addFeature(f,f.geometry,f.index,i,o,a,h,e.elevationFeatures);this.hdExt&&this.hdExt.buildFrcSegments(this)}isEmpty(){return this.bufferData.isEmpty()&&(!this.hdExt||this.hdExt.isEmpty())}uploadPending(){return!this.uploaded||this.bufferData.needsUpload()||this.hdExt!=null&&this.hdExt.needsUpload()}upload(e){this.bufferData.upload(e),this.hdExt&&this.hdExt.upload(e)}destroy(){this.bufferData.destroy(),this.hdExt&&this.hdExt.destroy()}
vendor: 41,345 bytes, line 7
7addFeature(e,i,o,a,c,h=[],f,_){const y=this.hdExt?this.hdExt.trackFeatureFrc(e.properties):null,v=this.bufferData.indexArray.length,b=as(i,500);this.hdExt!=null&&this.hdExt.handleFeature(e,b,o,a,_,this)||this.addGeometry(b,this.bufferData),this.bufferData.populatePaintArrays(e,o,c,h,a,f,this.worldview),this.hdExt&&this.hdExt.populatePaintArrays(e,o,c,h,a,f,this.worldview),this.hdExt&&this.hdExt.recordFeatureRange(this,v,this.bufferData.indexArray.length,y)}addGeometry(e,i,o,a){let c=Number.POSITIVE_INFINITY,h=Number.NEGATIVE_INFINITY,f=null;o&&(f=o.elevationSampler.constantElevation(o.elevation,o.bias),f!=null&&(c=f,h=f));const _=o?i:null,y=(v,b,T)=>{if(o!=null)if(b.push(v),f!=null)_.elevatedLayoutVertexArray.emplaceBack(f),T.push(f);else{const S=o.elevationSampler.pointElevation(v,o.elevation,o.bias);_.elevatedLayoutVertexArray.emplaceBack(S),T.push(S),c=Math.min(c,S),h=Math.max(h,S)}};for(const v of e){let b=0;for(const H of v)b+=H.length;const T=i.triangleSegments.prepareSegment(b,i.layoutVertexArray,i.indexArray),S=T.vertexLength,C=[],P=[],R=[],L=[],V=[],B=i.layoutVertexArray.length;for(const H of v){if(H.length===0)continue;H!==v[0]&&P.push(C.length/2);const Z=i.lineSegments.prepareSegment(H.length,i.layoutVertexArray,i.lineIndexArray),oe=Z.vertexLength;o&&V.push(i.layoutVertexArray.length-B),y(H[0],R,L),i.layoutVertexArray.emplaceBack(H[0].x,H[0].y),i.lineIndexArray.emplaceBack(oe+H.length-1,oe),C.push(H[0].x),C.push(H[0].y);for(let X=1;X<H.length;X++)y(H[X],R,L),i.layoutVertexArray.emplaceBack(H[X].x,H[X].y),i.lineIndexArray.emplaceBack(oe+X-1,oe+X),C.push(H[X].x),C.push(H[X].y);Z.vertexLength+=H.length,Z.primitiveLength+=H.length}const G=Gl(C,P);for(let H=0;H<G.length;H+=3)i.indexArray.emplaceBack(S+G[H],S+G[H+1],S+G[H+2]);if(G.length>0&&o&&a){const H=o.elevation.isTunnel(),Z=o.elevation.safeArea,oe=a.addVertices(R,L);a.addTriangles(G,oe,H);const X=V.length;if(X>0){for(let ee=0;ee<X-1;ee++)a.addRenderableRing(o.index,V[ee]+oe,V[ee+1]-V[ee],H,Z,o.featureInfo);a.addRenderableRing(o.index,V[X-1]+oe,R.length-V[X-1],H,Z,o.featureInfo)}}T.vertexLength+=b,T.primitiveLength+=G.length/3}return[c,h]}}Je(Zf,"FillBucket",{omit:["layers","patternFeatures"]});const Jg=zt([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"},{name:"a_linesofar",components:1,type:"Float32"}],4),Qg=zt([{name:"a_z_offset_width",components:4,type:"Float32"}],4),Lh=zt([{name:"a_elevation_id_col",components:3,type:"Float32"}],4),Fh=zt([{name:"a_elevation_ground_scale",components:1,type:"Float32"}],4),{members:Hn}=Jg,Oh=zt([{name:"a_packed",components:3,type:"Float32"}]),{members:ey}=Oh,ty=zt([{name:"a_pattern_data",components:3,type:"Float32"}]),{members:iy}=ty;class ra{constructor(e,i,o,a,c){for(this.properties=Object.create(null),this.extent=o,this.type=0,this.id=void 0,this._pbf=e,this._geometry=-1,this._keys=a,this._values=c;e.pos<i;){const h=e.readVarint();if(h===8)this.id=e.readVarint();else if(h===18){const f=e.readVarint()+e.pos;for(;e.pos<f;){const _=a[e.readVarint()],y=c[e.readVarint()];this.properties[_]=y}}else h===24?this.type=e.readVarint():(h===34&&(this._geometry=e.pos),e.skip(h))}}loadGeometry(){if(this._geometry<0)throw new Error("feature has no geometry");const e=this._pbf;e.pos=this._geometry;const i=e.readVarint()+e.pos,o=[];let a,c=1,h=0,f=0,_=0;for(;e.pos<i;){if(h<=0){const y=e.readVarint();if(c=7&y,h=y>>3,h===0)continue}if(h--,c===1)f+=e.readSVarint(),_+=e.readSVarint(),a&&o.push(a),a=[new Ne(f,_)];else if(c===2)f+=e.readSVarint(),_+=e.readSVarint(),a&&a.push(new Ne(f,_));else{if(c!==7)throw new Error(`unknown command ${c}`);a&&a.push(a[0].clone())}}return a&&o.push(a),o}bbox(){if(this._geometry<0)throw new Error("feature has no geometry");const e=this._pbf;e.pos=this._geometry;const i=e.readVarint()+e.pos;let o=1,a=0,c=0,h=0,f=1/0,_=-1/0,y=1/0,v=-1/0;for(;e.pos<i;){if(a<=0){const b=e.readVarint();if(o=7&b,a=b>>3,a===0)continue}if(a--,o===1||o===2)c+=e.readSVarint(),h+=e.readSVarint(),c<f&&(f=c),c>_&&(_=c),h<y&&(y=h),h>v&&(v=h);else if(o!==7)throw new Error(`unknown command ${o}`)}return[f,y,_,v]}toGeoJSON(e,i,o){const a=this.extent*Math.pow(2,o),c=this.extent*e,h=this.extent*i,f=this.loadGeometry();function _(T){return[360*(T.x+c)/a-180,360/Math.PI*Math.atan(Math.exp((1-2*(T.y+h)/a)*Math.PI))-90]}function y(T){return T.map(_)}let v;if(this.type===1){const T=[];for(const C of f)T.push(C[0]);const S=y(T);v=T.length===1?{type:"Point",coordinates:S[0]}:{type:"MultiPoint",coordinates:S}}else if(this.type===2){const T=f.map(y);v=T.length===1?{type:"LineString",coordinates:T[0]}:{type:"MultiLineString",coordinates:T}}else{if(this.type!==3)throw new Error("unknown feature type");{const T=(function(C){const P=C.length;if(P<=1)return[C];const R=[];let L,V;for(let B=0;B<P;B++){const G=Wf(C[B]);G!==0&&(V===void 0&&(V=G<0),V===G<0?(L&&R.push(L),L=[C[B]]):L&&L.push(C[B]))}return L&&R.push(L),R})(f),S=[];for(const C of T)S.push(C.map(y));v=S.length===1?{type:"Polygon",coordinates:S[0]}:{type:"MultiPolygon",coordinates:S}}}const b={type:"Feature",geometry:v,properties:this.properties};return this.id!=null&&(b.id=this.id),b}}function Wf(r){let e=0;for(let i,o,a=0,c=r.length,h=c-1;a<c;h=a++)i=r[a],o=r[h],e+=(o.x-i.x)*(i.y+o.y);return e}ra.types=["Unknown","Point","LineString","Polygon"];class ry{constructor(e,i){for(this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],i===void 0&&(i=e.length);e.pos<i;){const o=e.readVarint();o===10?this.name=e.readString():o===18?(this._features.push(e.pos),e.skip(o)):o===26?this._keys.push(e.readString()):o===34?this._values.push(Xf(e)):o===40?this.extent=e.readVarint():o===120?this.version=e.readVarint():e.skip(o)}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 ra(this._pbf,i,this.extent,this._keys,this._values)}}function Xf(r){let e=null;const i=r.readVarint()+r.pos;for(;r.pos<i;){const o=r.readVarint();e=o===10?r.readString():o===21?r.readFloat():o===25?r.readDouble():o===32?r.readVarint(!0):o===40?r.readVarint():o===48?r.readSVarint():o===56?r.readBoolean():(r.skip(o),null)}if(e==null)throw new Error("unknown feature value");return e}class Yf{constructor(e,i=e.length){const o=Object.create(null);for(;e.pos<i;){const a=e.readVarint();if(a===26){const c=new ry(e,e.readVarint()+e.pos);c.length&&(o[c.name]=c)}else e.skip(a)}this.layers=o}}function Kf(r,e){for(let i=0;i<r.length;i++)if(As(e,r[i]))return!0;for(let i=0;i<e.length;i++)if(As(r,e[i]))return!0;return!!eu(r,e)}function ny(r,e,i){return!!As(r,e)||!!Qf(e,r,i)}function Jf(r,e){if(r.length===1)return tu(e,r[0]);for(let i=0;i<e.length;i++){const o=e[i];for(let a=0;a<o.length;a++)if(As(r,o[a]))return!0}for(let i=0;i<r.length;i++)if(tu(e,r[i]))return!0;for(let i=0;i<e.length;i++)if(eu(r,e[i]))return!0;return!1}function r_(r,e,i){if(r.length>1){if(eu(r,e))return!0;for(let o=0;o<e.length;o++)if(Qf(e[o],r,i))return!0}for(let o=0;o<r.length;o++)if(Qf(r[o],e,i))return!0;return!1}function eu(r,e){if(r.length===0||e.length===0)return!1;for(let i=0;i<r.length-1;i++){const o=r[i],a=r[i+1];for(let c=0;c<e.length-1;c++)if(oy(o,a,e[c],e[c+1]))return!0}return!1}function oy(r,e,i,o){return Vt(r,i,o)!==Vt(e,i,o)&&Vt(r,e,i)!==Vt(r,e,o)}function Bh(r,e,i){return(r.x-i.x)*(e.y-i.y)-(r.y-i.y)*(e.x-i.x)}function n_(r,e,i,o){const a=Bh(r,e,o),c=Bh(r,e,i);if(Math.sign(a)===Math.sign(c))return;const h=Bh(i,o,r),f=h+c-a;return Math.sign(h)!==Math.sign(f)?[h/(h-f),c/(c-a)]:void 0}function Qf(r,e,i){const o=i*i;if(e.length===1)return r.distSqr(e[0])<o;for(let a=1;a<e.length;a++)if(kh(r,e[a-1],e[a])<o)return!0;return!1}function kh(r,e,i){const o=e.distSqr(i);if(o===0)return r.distSqr(e);const a=((r.x-e.x)*(i.x-e.x)+(r.y-e.y)*(i.y-e.y))/o;return r.distSqr(a<0?e:a>1?i:i.sub(e)._mult(a)._add(e))}function tu(r,e){let i,o,a,c=!1;for(let h=0;h<r.length;h++){i=r[h];for(let f=0,_=i.length-1;f<i.length;_=f++)o=i[f],a=i[_],o.y>e.y!=a.y>e.y&&e.x<(a.x-o.x)*(e.y-o.y)/(a.y-o.y)+o.x&&(c=!c)}return c}function As(r,e){let i=!1;for(let o=0,a=r.length-1;o<r.length;a=o++){const c=r[o],h=r[a];c.y>e.y!=h.y>e.y&&e.x<(h.x-c.x)*(e.y-c.y)/(h.y-c.y)+c.x&&(i=!i)}return i}function o_(r,e,i,o,a){for(const h of r)if(e<=h.x&&i<=h.y&&o>=h.x&&a>=h.y)return!0;const c=[new Ne(e,i),new Ne(e,a),new Ne(o,a),new Ne(o,i)];if(r.length>2){for(const h of c)if(As(r,h))return!0}for(let h=0;h<r.length-1;h++)if(Ha(r[h],r[h+1],c))return!0;return!1}function Ha(r,e,i){const o=i[0],a=i[2];if(r.x<o.x&&e.x<o.x||r.x>a.x&&e.x>a.x||r.y<o.y&&e.y<o.y||r.y>a.y&&e.y>a.y)return!1;const c=Vt(r,e,i[0]);return c!==Vt(r,e,i[1])||c!==Vt(r,e,i[2])||c!==Vt(r,e,i[3])}function Kl(r,e,i,o,a,c){let h=e.y-r.y,f=r.x-e.x;if(c=c||0){const _=h*h+f*f;if(_===0)return!0;const y=Math.sqrt(_);h/=y,f/=y}return!((i.x-r.x)*h+(i.y-r.y)*f-c<0||(o.x-r.x)*h+(o.y-r.y)*f-c<0||(a.x-r.x)*h+(a.y-r.y)*f-c<0)}function iu(r,e,i,o,a,c,h){return!(Kl(r,e,o,a,c,h)||Kl(e,i,o,a,c,h)||Kl(i,r,o,a,c,h)||Kl(o,a,r,e,i,h)||Kl(a,c,r,e,i,h)||Kl(c,o,r,e,i,h))}class $a extends Ne{constructor(e,i,o){super(e,i),this.z=o}}class s_ extends $a{constructor(e,i,o,a){super(e,i,o),this.w=a}}function a_(r,e,i,o){const a=i==="x"?"y":"x",c=(o-r[i])/(e[i]-r[i]);r[a]=Math.round(r[a]+(e[a]-r[a])*c),r[i]=o,Object.hasOwn(r,"z")&&(r.z=yt(r.z,e.z,c)),Object.hasOwn(r,"w")&&(r.w=yt(r.w,e.w,c))}function l_(r,e,i,o){const a=i,c=o;for(const h of["x","y"]){let f=r,_=e;f[h]>=_[h]&&(f=e,_=r),f[h]<a&&_[h]>a&&a_(f,_,h,a),f[h]<c&&_[h]>c&&a_(_,f,h,c)}}function ru(r,e,i,o,a,c){const h=[];for(let f=0;f<r.length;f++){const _=r[f];let y;const v=h.length;let b=0;for(let T=0;T<_.length-1;T++){let S=_[T],C=_[T+1],P=0;const R=b;let L,V;c&&(P=Math.hypot(C.x-S.x,C.y-S.y),b+=P,L=S,V=C),S.x<e&&C.x<e||(S.x<e?S=new Ne(e,S.y+(e-S.x)/(C.x-S.x)*(C.y-S.y))._round():C.x<e&&(C=new Ne(e,S.y+(e-S.x)/(C.x-S.x)*(C.y-S.y))._round()),S.y<i&&C.y<i||(S.y<i?S=new Ne(S.x+(i-S.y)/(C.y-S.y)*(C.x-S.x),i)._round():C.y<i&&(C=new Ne(S.x+(i-S.y)/(C.y-S.y)*(C.x-S.x),i)._round()),S.x>=o&&C.x>=o||(S.x>=o?S=new Ne(o,S.y+(o-S.x)/(C.x-S.x)*(C.y-S.y))._round():C.x>=o&&(C=new Ne(o,S.y+(o-S.x)/(C.x-S.x)*(C.y-S.y))._round()),S.y>=a&&C.y>=a||(S.y>=a?S=new Ne(S.x+(a-S.y)/(C.y-S.y)*(C.x-S.x),a)._round():C.y>=a&&(C=new Ne(S.x+(a-S.y)/(C.y-S.y)*(C.x-S.x),a)._round()),y&&S.equals(y.at(-1))||(y=[S],h.push(y),c&&c.push({progress:{min:R+c_(L,V,S)*P,max:1},parentIndex:f,prevPoint:L,nextPoint:V})),y.push(C),c&&(c.at(-1).progress.max=R+c_(L,V,C)*P,c.at(-1).nextPoint=V)))))}if(c&&b>0)for(let T=v;T<h.length;T++)c[T].progress.min/=b,c[T].progress.max/=b}return h}function sy(r,e,i,o,a){if(r.length<2)return void o.push(r);const c=[];for(;e.valid();){const[y,v]=e.get();for(let b=0;b<r.length-1;b++){const T=r[b],S=r[b+1],C=n_(T,S,y,v);if(C){const[P]=C,R=new Ne(yt(T.x,S.x,P),yt(T.y,S.y,P));c.push({t:b+P,distance:0,point:R})}}e.next()}if(c.length===0)return void o.push(r);c.sort((y,v)=>y.t-v.t);let h=0,f=0,_=[];for(o.push(_);h!==r.length;){if(f===c.length){for(;h!==r.length;)_.length!==0&&_.at(-1).equals(r[h])||_.push(r[h]),h++;break}c[f].t<=h?(_.length!==0&&_.at(-1).equals(c[f].point)||_.push(c[f].point),Math.trunc(c[f].t),f++):(_.length!==0&&_.at(-1).equals(r[h])||_.push(r[h]),h++)}}function c_(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 u_(r,{width:e,height:i},o,a){if(a){if(a instanceof Uint8ClampedArray)a=new Uint8Array(a.buffer);else if(a.length!==e*i*o)throw new RangeError("mismatched image size")}else a=new Uint8Array(e*i*o);return r.width=e,r.height=i,r.data=a,r}function h_(r,e,i){const{width:o,height:a}=e;o===r.width&&a===r.height||(ep(r,e,{x:0,y:0},{x:0,y:0},{width:Math.min(r.width,o),height:Math.min(r.height,a)},i,null),r.width=o,r.height=a,r.data=e.data)}function ep(r,e,i,o,a,c,h,f){if(a.width===0||a.height===0)return e;if(a.width>r.width||a.height>r.height||i.x>r.width-a.width||i.y>r.height-a.height)throw new RangeError("out of range source coordinates for image copy");if(a.width>e.width||a.height>e.height||o.x>e.width-a.width||o.y>e.height-a.height)throw new RangeError("out of range destination coordinates for image copy");const _=r.data,y=e.data,v=c===4&&f;for(let b=0;b<a.height;b++){const T=((i.y+b)*r.width+i.x)*c,S=((o.y+b)*e.width+o.x)*c;if(v)for(let C=0;C<a.width;C++){const P=T+C*c+3,R=S+C*c;y[R+0]=255,y[R+1]=255,y[R+2]=255,y[R+3]=_[P]}else if(h)for(let C=0;C<a.width;C++){const P=T+C*c,R=S+C*c,L=new $t(_[P+0]/255,_[P+1]/255,_[P+2]/255,_[P+3]).toNonPremultipliedRenderColor(h).toArray();y[R+0]=L[0],y[R+1]=L[1],y[R+2]=L[2],y[R+3]=L[3]}else for(let C=0;C<a.width*c;C++)y[S+C]=_[T+C]}return e}class na{constructor(e,i){u_(this,e,1,i)}resize(e){h_(this,new na(e),1)}clone(){return new na({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,i,o,a,c){ep(e,i,o,a,c,1,null)}}class Or{constructor(e,i){u_(this,e,4,i)}resize(e){h_(this,new Or(e),4)}replace(e,i){i?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new Or({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,i,o,a,c,h,f){ep(e,i,o,a,c,4,h,f)}}class d_{constructor(e,i){this.width=e.width,this.height=e.height,this.data=i instanceof Uint8Array?new Float32Array(i.buffer):i}}Je(na,"AlphaImage"),Je(Or,"RGBAImage");class f_{constructor(e,i){this.width=e,this.height=i,this.nextRow=0,this.image=new na({width:e,height:i}),this.positions={},this.uploaded=!1}getDash(e,i){const o=this.getKey(e,i);return this.positions[o]}trim(){const e=this.width,i=this.height=Oe(this.nextRow);this.image.resize({width:e,height:i})}getKey(e,i){return e.join(",")+i}getDashRanges(e,i,o){const a=[];let c=e.length%2==1?-e.at(-1)*o:0,h=e[0]*o,f=!0;a.push({left:c,right:h,isDash:f,zeroLength:e[0]===0});let _=e[0];for(let y=1;y<e.length;y++){f=!f;const v=e[y];c=_*o,_+=v,h=_*o,a.push({left:c,right:h,isDash:f,zeroLength:v===0})}return a}addRoundDash(e,i,o){const a=i/2;for(let c=-o;c<=o;c++){const h=this.width*(this.nextRow+o+c);let f=0,_=e[f];for(let y=0;y<this.width;y++){y/_.right>1&&(_=e[++f]);const v=Math.abs(y-_.left),b=Math.abs(y-_.right),T=Math.min(v,b);let S;const C=c/o*(a+1);if(_.isDash){const P=a-Math.abs(C);S=Math.sqrt(T*T+P*P)}else S=a-Math.sqrt(T*T+C*C);this.image.data[h+y]=Math.max(0,Math.min(255,S+128))}}}addRegularDash(e,i){for(let _=e.length-1;_>=0;--_){const y=e[_],v=e[_+1];y.zeroLength?e.splice(_,1):v&&v.isDash===y.isDash&&(v.left=y.left,e.splice(_,1))}const o=e[0],a=e.at(-1);o.isDash===a.isDash&&(o.left=a.left-this.width,a.right=o.right+this.width);const c=this.width*this.nextRow;let h=0,f=e[h];for(let _=0;_<this.width;_++){_/f.right>1&&(f=e[++h]);const y=Math.abs(_-f.left),v=Math.abs(_-f.right),b=Math.min(y,v);this.image.data[c+_]=Math.max(0,Math.min(255,(f.isDash?b:-b)+i+128))}}addDash(e,i){const o=this.getKey(e,i);if(this.positions[o])return this.positions[o];const a=i==="round",c=a?7:0,h=2*c+1;if(this.nextRow+h>this.height)return ht("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&&(ht("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,T=this.getDashRanges(e,this.width,b);a?this.addRoundDash(T,b,c):this.addRegularDash(T,i==="square"?.5*b:0)}const _=this.nextRow+c;this.nextRow+=h;const y=Math.floor(f),v={tl:[_,c],br:[y,Math.round(65535*(f-y))]};return this.positions[o]=v,v}}Je(f_,"LineAtlas");const $n="3d_elevation_id",p_="level",ay=ra.types,Nh=Math.cos(Math.PI/180*37.5),ly=Math.cos(Math.PI/180*5);class Vh{constructor(e){this.evaluationGlobals={zoom:0,lineProgress:void 0},this.elevationType="none",this.isSeaLevelReference=!1,this.showElevationIdDebug=!1,this.terrainEnabled=!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 Mf,this.layoutVertexArray2=new ho,this.patternVertexArray=new ho,this.indexArray=new Mr,this.programConfigurations=new _o(e.layers,{zoom:e.zoom,lut:e.lut}),this.segments=new wi,this.sourceLayerName=e.sourceLayerName||"",this.maxLineLength=0,this.zOffsetVertexArray=new Is,this.elevationIdColVertexArray=new ho,this.elevationGroundScaleVertexArray=new Ko,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,o,a){return{hasLayoutChanges:!1,hasUboChanges:!1}}populate(e,i,o,a){this.showElevationIdDebug=i.showElevationIdDebug,this.terrainEnabled=i.terrainEnabled,this.hasPattern=gf("line",this.layers,this.pixelRatio,i);const c=this.layers[0].layout.get("line-sort-key");this.tileToMeter=zn(o);const h=this.layers[0].layout.get("line-elevation-reference");if(h==="hd-road-markup")this.elevationType="road";else{const T=this.layers[0].layout.get("line-z-offset"),S=T.isConstant()&&!T.constantOr(0);this.elevationType=h!=="sea"&&h!=="ground"&&S?"none":"offset",this.elevationType==="offset"&&h==="none"&&ht(`line-elevation-reference: ground is used for the layer ${this.layerIds[0]} because non-zero line-z-offset value was found.`),this.isSeaLevelReference=h==="sea"}const f=this.layers[0].layout.get("line-cross-slope");this.hasCrossSlope=this.elevationType==="offset"&&f!==void 0;const _=[];for(const{feature:T,id:S,index:C,sourceLayerIndex:P}of e){const R=this.layers[0]._featureFilter.needGeometry,L=uo(T,R);if(!this.layers[0]._featureFilter.filter(new oi(this.zoom,{worldview:this.worldview,activeFloors:i.activeFloors}),L,o))continue;const V=c?c.evaluate(L,{},o):void 0,B={id:S,properties:T.properties,type:T.type,sourceLayerIndex:P,index:C,geometry:R?L.geometry:xn(T,o,a),patterns:{},sortKey:V};_.push(B)}c&&_.sort((T,S)=>T.sortKey-S.sortKey);const{lineAtlas:y,featureIndex:v}=i,b=this.addConstantDashes(y);for(const T of _){const{geometry:S,index:C,sourceLayerIndex:P}=T;if(b&&this.addFeatureDashes(T,y),this.hasPattern){const R=yf("line",this.layers,T,this.zoom,this.pixelRatio,i);this.patternFeatures.push(R)}else this.addFeature(T,S,C,o,y.positions,i.availableImages,i.brightness,i.elevationFeatures,i.elevationParams,i.crossSourceElevationEnabled);v.insert(e[C].feature,S,C,P,this.index)}!this.hasPattern&&this.hdExt&&this.hdExt.buildFrcSegments(this),this.hdExt&&this.hdExt.endPopulate()}addConstantDashes(e){let i=!1;for(const o of this.layers){const a=o.paint.get("line-dasharray").value,c=o.layout.get("line-cap").value;if(a.kind!=="constant"||c.kind!=="constant")i=!0;else{const h=c.value,f=a.value;if(!f)continue;e.addDash(f,h)}}return i}addFeatureDashes(e,i){const o=this.zoom;for(const a of this.layers){const c=a.paint.get("line-dasharray").value,h=a.layout.get("line-cap").value;if(c.kind==="constant"&&h.kind==="constant")continue;let f,_;if(c.kind==="constant"){if(f=c.value,!f)continue}else f=c.evaluate({zoom:o},e);_=h.kind==="constant"?h.value:h.evaluate({zoom:o},e),i.addDash(f,_),e.patterns[a.id]=[i.getKey(f,_)]}}update(e,i,o,a,c,h,f,_,y){this.programConfigurations.updatePaintArrays(e,i,c,o,a,h,f,y)}updateExpressions(e){this.programConfigurations.updateExpressions(e)}addFeatures(e,i,o,a,c,h){for(const f of this.patternFeatures)this.addFeature(f,f.geometry,f.index,i,o,a,h,e.elevationFeatures,e.elevationParams,e.crossSourceElevationEnabled);this.hdExt&&(this.hdExt.buildFrcSegments(this),this.hdExt.endPopulate())}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,ey)),this.patternVertexArray.length!==0&&(this.patternVertexBuffer=e.createVertexBuffer(this.patternVertexArray,iy)),!this.zOffsetVertexBuffer&&this.zOffsetVertexArray.length>0&&(this.zOffsetVertexBuffer=e.createVertexBuffer(this.zOffsetVertexArray,Qg.members,!0)),!this.elevationIdColVertexBuffer&&this.elevationIdColVertexArray.length>0&&(this.elevationIdColVertexBuffer=e.createVertexBuffer(this.elevationIdColVertexArray,Lh.members,!0)),!this.elevationGroundScaleVertexBuffer&&this.elevationGroundScaleVertexArray.length>0&&(this.elevationGroundScaleVertexBuffer=e.createVertexBuffer(this.elevationGroundScaleVertexArray,Fh.members,!0)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Hn),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 o,a;if(i&&i>0?(o=`mapbox_clip_start_${i}`,a=`mapbox_clip_end_${i}`):(o="mapbox_clip_start",a="mapbox_clip_end"),e.properties&&Object.hasOwn(e.properties,o)&&Object.hasOwn(e.properties,a))return{start:+e.properties[o],end:+e.properties[a]}}addFeature(e,i,o,a,c,h,f,_,y,v){const b=this.layers[0].layout,T=this.hdExt?this.hdExt.trackFeatureFrc(e.properties):null,S=this.indexArray.length,C=b.get("line-join").evaluate(e,{}),P=b.get("line-cap").evaluate(e,{}),R=b.get("line-miter-limit"),L=b.get("line-round-limit");this.lineClips=this.lineFeatureClips(e),this.lineFeature=e;const V=!(!e.properties||!Object.hasOwn(e.properties,"mapbox_line_metrics"))&&e.properties.mapbox_line_metrics;this.zOffsetValue=b.get("line-z-offset").value;const B=this.layers[0].paint,G=B.get("line-width").value;G.kind!=="constant"&&G.isLineProgressConstant===!1&&(this.variableWidthValue=G);const H=B.get("line-emissive-strength").value;if(H.kind!=="constant"&&H.isLineProgressConstant===!1&&(this.variableEmissiveStrengthValue=H),this.isSeaLevelReference){const Z=b.get("line-elevation-ground-scale").value;Z.kind==="constant"&&Z.value===0||(this.elevationGroundScaleValue=Z)}if(this.hdExt==null||!this.hdExt.handleFeature(e,i,a,_,y,!!v,C,P,R,L,this))for(let Z=0;Z<i.length;Z++)this.addLine(i[Z],e,a,C,P,R,L,void 0,V&&Z>0?Z:null);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,o,c,h,a,f,void 0,this.worldview),this.hdExt&&this.hdExt.recordFeatureRange(this,S,this.indexArray.length,T)}fillNonElevatedRoadSegment(e){for(let i=Math.max(e,this.zOffsetVertexArray.length);i<this.layoutVertexArray.length;i++)this.zOffsetVertexArray.emplaceBack(0,0,0,0),this.showElevationIdDebug&&this.elevationIdColVertexArray.emplaceBack(0,0,0)}addLine(e,i,o,a,c,h,f,_,y){this.distance=0,this.prevDistance=0,this.scaledDistance=0,this.totalDistance=0,this.totalFeatureLength=0,this.lineSoFar=0,this.currentVertex=void 0,this.lineClips=y?this.lineFeatureClips(i,y):this.lineClips;const v=a==="none";this.patternJoinNone=this.hasPattern&&v,this.currentLineJoinType=a,this.segmentStart=0,this.segmentStartf32=0,this.segmentPoints=[];const b=_&&_.progress.min>0,T=_&&_.progress.max<1;if(this.lineClips){let ee={min:this.lineClips.start,max:this.lineClips.end},ie=1;if(_){const ge=this.lineClips.end-this.lineClips.start;ee=(function(we,Se,Ee){return{min:io(we.min,Se,Ee),max:io(we.max,Se,Ee)}})(_.progress,{min:0,max:1},ee),ge>0&&(ie=(ee.max-ee.min)/ge)}const ne=+i.properties.mapbox_clip_feature_len,fe=+i.properties.mapbox_clip_seg_len;if(Number.isNaN(ne)||Number.isNaN(fe)){for(let we=0;we<e.length-1;we++)this.totalDistance+=e[we].dist(e[we+1]);const ge=this.totalDistance/(ee.max-ee.min);this.totalFeatureLength=Number.isFinite(ge)?ge:0,this.lineClips.start=ee.min,this.lineClips.end=ee.max,this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}else this.totalFeatureLength=ne,this.distance=fe*ie,this.lineClips.start=ee.min,this.lineClips.end=ee.max,this.maxLineLength=Math.max(this.maxLineLength,this.distance);this.lineClipsArray.push(this.lineClips),this.updateScaledDistance()}const S=ay[i.type]==="Polygon";let C=e.length;for(;C>=2&&e[C-1].equals(e[C-2]);)C--;let P=0;for(;P<C-1&&e[P].equals(e[P+1]);)P++;if(C<(S?3:2))return;a==="bevel"&&(h=1.05);const R=this.segments.prepareSegment(10*C,this.layoutVertexArray,this.indexArray);let L,V,B,G,H,Z,oe,X;_&&_.prevDir&&(Z=_.prevDir.perp()),_&&_.nextDir&&(oe=_.nextDir.perp()),this.e1=this.e2=-1,S&&(L=e[C-2],H=e[P].sub(L)._unit()._perp());for(let ee=P;ee<C;ee++){if(B=ee===C-1?S?e[P+1]:void 0:e[ee+1],B&&e[ee].equals(B))continue;H&&(G=H),L&&(V=L),L=e[ee],X=this.evaluateLineProgressFeatures(V?V.dist(L):0),H=B?B.sub(L)._unit()._perp():G,G=G||H;const ie=V&&B;let ne=ie?a:S||v?"butt":c;const fe=G.x*H.x+G.y*H.y;if(v){const Ce=function(ze){if(ze.patternJoinNone){const Fe=ze.segmentPoints.length/2,Be=ze.lineSoFar-ze.segmentStart;for(let De=0;De<Fe;++De){const Ge=ze.segmentPoints[2*De+1],Ze=Math.round(ze.segmentPoints[2*De])+.5+.25*Ge;ze.patternVertexArray.emplaceBack(Ze,Be,ze.segmentStart),ze.patternVertexArray.emplaceBack(Ze,Be,ze.segmentStart)}ze.segmentPoints.length=0}ze.e1=ze.e2=-1};if(ie&&fe<ly){this.updateDistance(V,L),this.addCurrentVertex(L,G,1,1,R,X),Ce(this),this.addCurrentVertex(L,H,-1,-1,R,X);continue}if(V){if(!B){this.updateDistance(V,L),this.addCurrentVertex(L,G,1,1,R,X),Ce(this);continue}ne="miter"}}let ge=G.add(H);ge.x===0&&ge.y===0||ge._unit();const we=ge.x*H.x+ge.y*H.y,Se=we!==0?1/we:1/0,Ee=2*Math.sqrt(2-2*we),Ve=we<Nh&&V&&B,Ie=G.x*H.y-G.y*H.x>0,Te=this.overscaling<=16?122880/(512*this.overscaling):0;if(ie&&ne==="round"){if(Se<f)ne="miter";else if(Se<=2){const Ce=tp(L,-10,8202);ne=this.elevationType==="offset"&&(Ce||this.hasCrossSlope)?"miter":"fakeround"}}if(ne==="miter"&&Se>h&&(ne="bevel"),ne==="bevel"&&(Se>2&&(ne="flipbevel"),Se<h&&(ne="miter")),V&&!(ne==="miter"&&Ve)&&this.updateDistance(V,L),ne==="miter")if(Ve){const Ce=L.dist(V);if(Ce>2*Te){const Fe=L.sub(L.sub(V)._mult(Te/Ce)._round());this.updateDistance(V,Fe),this.addCurrentVertex(Fe,G,0,0,R,X),V=Fe}this.updateDistance(V,L),ge._mult(Se),this.addCurrentVertex(L,ge,0,0,R,X);const ze=L.dist(B);if(ze>2*Te){const Fe=L.add(B.sub(L)._mult(Te/ze)._round());this.updateDistance(L,Fe),this.addCurrentVertex(Fe,H,0,0,R,X),L=Fe}}else ge._mult(Se),this.addCurrentVertex(L,ge,0,0,R,X);else if(ne==="flipbevel"){if(Se>100)ge=H.mult(-1);else{const Ce=Se*G.add(H).mag()/G.sub(H).mag();ge._perp()._mult(Ce*(Ie?-1:1))}this.addCurrentVertex(L,ge,0,0,R,X),this.addCurrentVertex(L,ge.mult(-1),0,0,R,X)}else if(ne==="bevel"||ne==="fakeround"){const Ce=L.dist(V);let ze=1;if(this.elevationType==="offset"&&ne==="bevel"&&this.currentLineJoinType!=="round"&&!this.patternJoinNone&&X!=null&&V&&B){const Qe=4*Te;Ce<Qe&&(ze=Math.max(0,Ce/Qe))}X!=null&&V&&this.addCurrentVertex(L,oe||G,-ze,-ze,R,X);const Fe=Ce<=2*Te&&ne!=="bevel",Be=ge.mult(Ie?1:-1);Be._mult(Se);const De=H.mult(Ie?-1:1),Ge=G.mult(Ie?-1:1),Ze=this.evaluateLineProgressFeatures(this.distance);if(X==null&&(this.addHalfVertex(L,Be.x,Be.y,!1,!Ie,0,R,Ze),Fe||this.addHalfVertex(L,Be.x+2*Ge.x,Be.y+2*Ge.y,!1,Ie,0,R,Ze)),ne==="fakeround"){const Qe=Math.round(180*Ee/Math.PI/20);this.addHalfVertex(L,Ge.x,Ge.y,!1,Ie,0,R,Ze);for(let Xe=0;Xe<Qe;Xe++){let rt=Xe/Qe;if(rt!==.5){const ft=rt-.5;rt+=rt*ft*(rt-1)*((1.0904+fe*(fe*(3.55645-1.43519*fe)-3.2452))*ft*ft+(.848013+fe*(.215638*fe-1.06021)))}const vt=De.sub(Ge)._mult(rt)._add(Ge)._unit();this.addHalfVertex(L,vt.x,vt.y,!1,Ie,0,R,Ze)}this.addHalfVertex(L,De.x,De.y,!1,Ie,0,R,Ze)}Fe||X!=null||this.addHalfVertex(L,Be.x+2*De.x,Be.y+2*De.y,!1,Ie,0,R,Ze),X!=null&&B&&this.addCurrentVertex(L,Z||H,ze,ze,R,X)}else if(ne==="butt")this.addCurrentVertex(L,ge,0,0,R,X);else if(ne==="square"){if(!V){const Ce=b?0:-1;this.addCurrentVertex(L,ge,Ce,Ce,R,X)}if(this.addCurrentVertex(L,ge,0,0,R,X),V){const Ce=T?0:1;this.addCurrentVertex(L,ge,Ce,Ce,R,X)}}else if(ne==="round"){if(V){const Ce=!ie&&oe?oe:G;this.addCurrentVertex(L,Ce,0,0,R,X),!ie&&T||this.addCurrentVertex(L,Ce,1,1,R,X,!0)}if(B){const Ce=!ie&&Z?Z:H;!ie&&b||this.addCurrentVertex(L,Ce,-1,-1,R,X,!0),this.addCurrentVertex(L,Ce,0,0,R,X)}}}}addVerticesTo(e,i,o,a,c,h,f,_,y,v){const b=(i.w-e.w)/this.tessellationStep|0;let T=0;const S=this.scaledDistance;if(b>1){this.lineSoFar=e.w;const P=(i.x-e.x)/b,R=(i.y-e.y)/b,L=(i.z-e.z)/b,V=(i.w-e.w)/b,B=i.x-e.x,G=i.y-e.y,H=Math.sqrt(B*B+G*G);if(H===0)return;const Z=-G/H,oe=B/H,X=Z,ee=oe,ie=-Z,ne=-oe;for(let fe=1;fe<b;++fe){e.x+=P,e.y+=R,e.z+=L,this.lineSoFar+=V,T+=V;const ge=this.evaluateLineProgressFeatures(this.prevDistance+T);this.scaledDistance=(this.prevDistance+T)/this.totalDistance,this.addHalfVertex(e,X,ee,v,!1,0,y,ge),this.addHalfVertex(e,ie,ne,v,!0,0,y,ge)}}this.lineSoFar=i.w,this.scaledDistance=S;const C=this.evaluateLineProgressFeatures(this.distance);this.addHalfVertex(i,o,a,v,!1,f,y,C),this.addHalfVertex(i,c,h,v,!0,-_,y,C)}evaluateLineProgressFeatures(e){if(!this.variableWidthValue&&!this.variableEmissiveStrengthValue&&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):ht(`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,i*=.5);let o=0;this.variableEmissiveStrengthValue&&this.variableEmissiveStrengthValue.kind!=="constant"&&(o=this.variableEmissiveStrengthValue.evaluate(this.evaluationGlobals,this.lineFeature)||0);const a=this.evaluateElevationGroundScale();return this.elevationType!=="offset"?{zOffset:0,variableWidth:i,elevationGroundScale:a,variableEmissiveStrength:o}:this.zOffsetValue.kind==="constant"?{zOffset:this.zOffsetValue.value,variableWidth:i,elevationGroundScale:a,variableEmissiveStrength:o}:{zOffset:this.zOffsetValue.evaluate(this.evaluationGlobals,this.lineFeature)||0,variableWidth:i,elevationGroundScale:a,variableEmissiveStrength:o}}evaluateElevationGroundScale(){return this.elevationGroundScaleValue?this.elevationGroundScaleValue.kind==="constant"?this.elevationGroundScaleValue.value:this.elevationGroundScaleValue.evaluate(this.evaluationGlobals,this.lineFeature)||0:0}addCurrentVertex(e,i,o,a,c,h,f=!1){const _=i.x+i.y*o,y=i.y-i.x*o,v=i.y*a-i.x,b=-i.y-i.x*a;if(h!=null){const T=this.elevationType==="offset",S=this.elevationType==="offset"?2:10,C=-S,P=Ke+S,R=h.zOffset,L=new s_(e.x,e.y,R,this.lineSoFar),V=!!T&&tp(e,C,P),B=this.lineSoFar,G=this.distance;if(this.currentVertex)if(V){const H=this.currentVertexIsOutside,Z=this.currentVertex,oe=new s_(e.x,e.y,R,this.lineSoFar);if(l_(Z,oe,C,P),!tp(oe,C,P)){if(H){this.e1=this.e2=-1,this.distance-=Z.dist(L),this.lineSoFar=Z.w;const X=this.evaluateLineProgressFeatures(Z.w-this.totalFeatureLength*(this.lineClips?this.lineClips.start:0));this.addHalfVertex(Z,_,y,f,!1,o,c,X),this.addHalfVertex(Z,v,b,f,!0,-a,c,X),this.prevDistance=this.distance}this.distance=this.prevDistance+Z.dist(oe),this.scaledDistance=this.distance/this.totalDistance,this.addVerticesTo(Z,oe,_,y,v,b,o,a,c,f),this.distance=G,this.scaledDistance=this.distance/this.totalDistance}}else{const H=this.currentVertex;if(this.currentVertexIsOutside){l_(H,L,C,P),this.e1=this.e2=-1,this.distance-=H.dist(L),this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=H.w;const Z=this.evaluateLineProgressFeatures(H.w-this.totalFeatureLength*(this.lineClips?this.lineClips.start:0));this.addHalfVertex(H,_,y,f,!1,o,c,Z),this.addHalfVertex(H,v,b,f,!0,-a,c,Z),this.prevDistance=this.distance,this.distance=G,this.scaledDistance=this.distance/this.totalDistance}this.addVerticesTo(H,L,_,y,v,b,o,a,c,f)}else V||(this.addHalfVertex(e,_,y,f,!1,o,c,h),this.addHalfVertex(e,v,b,f,!0,-a,c,h));this.currentVertex=L,this.currentVertexIsOutside=V,this.lineSoFar=B}else this.addHalfVertex(e,_,y,f,!1,o,c,h),this.addHalfVertex(e,v,b,f,!0,-a,c,h)}addHalfVertex({x:e,y:i},o,a,c,h,f,_,y){if(this.patternJoinNone&&(this.segmentPoints.length===0&&(this.segmentStart=this.lineSoFar,this.segmentStartf32=Math.fround(this.lineSoFar)),h||this.segmentPoints.push(this.lineSoFar-this.segmentStart,f)),this.layoutVertexArray.emplaceBack((e<<1)+(c?1:0),(i<<1)+(h?1:0),Math.round(63*o)+128,Math.round(63*a)+128,1+(f===0?0:f<0?-1:1),0,this.lineSoFar-this.segmentStartf32),this.lineClips){const b=yt(this.lineClips.start,this.lineClips.end,this.scaledDistance);this.layoutVertexArray2.emplaceBack(this.scaledDistance,this.lineClipsArray.length,b)}const v=_.vertexLength++;if(this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,v),_.primitiveLength++),h?this.e2=v:this.e1=v,y!=null&&(this.zOffsetVertexArray.emplaceBack(y.zOffset,y.variableWidth,y.variableWidth,y.variableEmissiveStrength),this.showElevationIdDebug&&this.elevationIdColVertexArray.emplaceBack(0,0,0)),this.elevationGroundScaleValue){const b=y?y.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 tp(r,e,i){return r.x<e||r.x>i||r.y<e||r.y>i}Je(Vh,"LineBucket",{omit:["layers","patternFeatures","currentVertex","currentVertexIsOutside"]});const cy=zt([{name:"a_pos",components:2,type:"Int16"}],4),m_=zt([{name:"a_circle_z_offset",components:1,type:"Float32"}],4),__=zt([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]);class nu{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 Es,this.indexArray=new Mr,this.segments=new wi,this.programConfigurations=new _o(e.layers,{zoom:e.zoom,lut:e.lut}),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.worldview=e.worldview,this.hasAppearances=null}updateFootprints(e,i){}updateAppearances(e,i,o,a){return{hasLayoutChanges:!1,hasUboChanges:!1}}populate(e,i,o,a){const c=this.layers[0],h=[];let f=null;c.type==="circle"&&(f=c.layout.get("circle-sort-key"));for(const{feature:y,id:v,index:b,sourceLayerIndex:T}of e){const S=this.layers[0]._featureFilter.needGeometry,C=uo(y,S);if(!this.layers[0]._featureFilter.filter(new oi(this.zoom,{worldview:this.worldview,activeFloors:i.activeFloors}),C,o))continue;const P=f?f.evaluate(C,{},o):void 0,R={id:v,properties:y.properties,type:y.type,sourceLayerIndex:T,index:b,geometry:S?C.geometry:xn(y,o,a),patterns:{},sortKey:P};h.push(R)}f&&h.sort((y,v)=>y.sortKey-v.sortKey);let _=null;a.projection.name==="globe"&&(this.globeExtVertexArray=new Hc,_=a.projection);for(const y of h){const{geometry:v,index:b,sourceLayerIndex:T}=y,S=e[b].feature;this.addFeature(y,v,b,i.availableImages,o,_,i.brightness,i.elevationFeatures),i.featureIndex.insert(S,v,b,T,this.index)}this.hdExt&&this.hdExt.finalize()}update(e,i,o,a,c,h,f){this.programConfigurations.updatePaintArrays(e,i,c,o,a,h,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,cy.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.globeExtVertexArray&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,__.members)),this.hdExt&&this.hdExt.upload(e)),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.hdExt&&this.hdExt.destroy())}addFeature(e,i,o,a,c,h,f,_){this.hdExt&&this.hdExt.beginFeature(e,_,c);for(const y of i)for(const v of y){const b=v.x,T=v.y;if(b<0||b>=Ke||T<0||T>=Ke)continue;if(h){const P=h.projectTilePoint(b,T,c),R=h.upVector(c,b,T);this.addGlobeExtVertex(P,R),this.addGlobeExtVertex(P,R),this.addGlobeExtVertex(P,R),this.addGlobeExtVertex(P,R)}const S=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),C=S.vertexLength;this.addCircleVertex(b,T,-1,-1),this.addCircleVertex(b,T,1,-1),this.addCircleVertex(b,T,1,1),this.addCircleVertex(b,T,-1,1),this.hdExt&&this.hdExt.writeVertexQuad(b,T),this.indexArray.emplaceBack(C,C+1,C+2),this.indexArray.emplaceBack(C,C+2,C+3),S.vertexLength+=4,S.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,o,{},a,c,f,void 0,this.worldview)}addCircleVertex(e,i,o,a){this.layoutVertexArray.emplaceBack(2*e+(o+1)/2,2*i+(a+1)/2)}addGlobeExtVertex(e,i){this.globeExtVertexArray.emplaceBack(e.x,e.y,e.z,i[0]*16384,i[1]*16384,i[2]*16384)}}Je(nu,"CircleBucket",{omit:["layers"]});const uy=zt([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_tex_size",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),hy=zt([{name:"a_globe_anchor",components:3,type:"Int16"},{name:"a_globe_normal",components:3,type:"Float32"}],4),g_=zt([{name:"a_projected_pos",components:4,type:"Float32"}],4);zt([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const dy=zt([{name:"a_auto_z_offset",components:1,type:"Float32"}],4),fy=zt([{name:"a_feature_index",components:1,type:"Float32"}],4),py=zt([{name:"a_x_axis",components:3,type:"Float32"},{name:"a_y_axis",components:3,type:"Float32"}]),my=zt([{name:"a_texb",components:2,type:"Uint16"}]),_y=zt([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_elevation_from_sea",components:2,type:"Float32"}]),gy=zt([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"},{name:"a_auto_z_offset",components:1,type:"Float32"}]);zt([{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 ip=zt([{name:"a_pos",components:3,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),rp=zt([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);zt([{name:"triangle",components:3,type:"Uint16"}]),zt([{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"}]),zt([{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]),zt([{type:"Float32",name:"offsetX"}]),zt([{type:"Int16",name:"x"},{type:"Int16",name:"y"}]);const Za=class _u{static getBlockIndices(e){let i=_u._blockIndicesTemplate;if(!i){i=_u._blockIndicesTemplate=new Uint32Array(e);for(let o=0;o<e;o++)i[o]=o}return i}constructor(e,i,o,a){this.batchIndex=i,this.headerBuffer=null,this.propertiesBuffer=null,this.blockIndicesBuffer=null,this.context=e||null,this.propsDwords=o,this.totalBytes=4*this.propsDwords,this.headerData=a,this.propertiesData=new Float32Array(this.propsDwords),this._headerDirty=!0,this._propsDirtyMin=-1,this._propsDirtyMax=-1,this._blockIndicesDirty=!0,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,_u.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)}writeDataDrivenBlock(e,i){const o=this.headerData,a=4*o[2];if(a===0)return;const c=i*a;if(c+a>this.propertiesData.length)throw new Error(`UBO write out of bounds: feature index ${i} exceeds propertiesData capacity`);const h=o[0],f=o[1],_=f>>>16;for(let v=0;v<9;v++)h&1<<v&&this._copyFromFlat(c+o[3+v],v,e,_u.EVAL_FLAT_OFFSETS[v],f,_);(this._propsDirtyMin===-1||c<this._propsDirtyMin)&&(this._propsDirtyMin=c);const y=c+a;y>this._propsDirtyMax&&(this._propsDirtyMax=y)}rightSizeForTransfer(){const e=this._propsDirtyMax===-1?0:this._propsDirtyMax;e<this.propertiesData.length&&(this.propertiesData=this.propertiesData.slice(0,e))}_copyFromFlat(e,i,o,a,c,h){const f=i<2,_=i===8,y=!!(c&1<<i);if(this.propertiesData.set(o.subarray(a,a+(f||_&&y?4:_||y?2:1)),e),h&1<<i){const v=f||_?4:2,b=_u.EVAL_FLAT_ZOOM_OFFSETS[i];this.propertiesData[e+v]=o[b],this.propertiesData[e+v+1]=o[b+1]}}upload(e){this.context||(this.context=e);const i=e.gl;this.headerBuffer&&this.propertiesBuffer&&this.blockIndicesBuffer||this._initBuffers(e);let o=!1;if(this._headerDirty&&(i.bindBuffer(i.UNIFORM_BUFFER,this.headerBuffer),i.bufferSubData(i.UNIFORM_BUFFER,0,this.headerData),this._headerDirty=!1,o=!0),this._propsDirtyMin!==-1){const a=this._propsDirtyMin,c=this._propsDirtyMax;i.bindBuffer(i.UNIFORM_BUFFER,this.propertiesBuffer),i.bufferSubData(i.UNIFORM_BUFFER,4*a,this.propertiesData,a,c-a),this._propsDirtyMin=-1,this._propsDirtyMax=-1,o=!0}this._blockIndicesDirty&&(i.bindBuffer(i.UNIFORM_BUFFER,this.blockIndicesBuffer),i.bufferSubData(i.UNIFORM_BUFFER,0,_u.getBlockIndices(this.propsDwords)),this._blockIndicesDirty=!1,o=!0),o&&i.bindBuffer(i.UNIFORM_BUFFER,null)}bind(e,i){const o=e.gl,a=(h,f,_)=>{if(!f)return;const y=o.getUniformBlockIndex(i,h);y!==o.INVALID_INDEX&&(o.uniformBlockBinding(i,y,_),o.bindBufferBase(o.UNIFORM_BUFFER,_,f))},c=3*this.batchIndex;a("SymbolPaintPropertiesHeaderUniform",this.headerBuffer,c),a("SymbolPaintPropertiesUniform",this.propertiesBuffer,c+1),a("SymbolPaintPropertiesIndexUniform",this.blockIndicesBuffer,c+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)}}};Za.HEADER_DWORDS=12,Za.HEADER_BYTES=48,Za.EVAL_FLAT_OFFSETS=[0,4,8,10,12,14,16,18,20],Za.EVAL_FLAT_ZOOM_OFFSETS=[24,26,28,30,32,34,36,38,40],Za.EVAL_FLAT_TOTAL=42,Za._blockIndicesTemplate=null;let vn=Za;function Uh(r,e,i,o,a,c,h,f){return!!r&&(r.kind==="constant"?r.value==="none":r.evaluate({zoom:0,brightness:c,worldview:f},e,i,a,o,h)==="none")}function y_(r){if(!(r instanceof bs))return!1;const e=r.value;return(e.kind==="source"||e.kind==="composite")&&e.isStateDependent}Je(vn,"SymbolPropertiesUBO",{omit:["headerBuffer","propertiesBuffer","blockIndicesBuffer"]});const oa=["icon","text"].map(r=>[`${r}-color`,`${r}-halo-color`,`${r}-opacity`,`${r}-halo-width`,`${r}-halo-blur`,`${r}-emissive-strength`,`${r}-occlusion-opacity`,"symbol-z-offset",`${r}-translate`]),Pr=new Float32Array(vn.EVAL_FLAT_TOTAL),Jl=[0,0],x_=new WeakMap;
7class np{constructor(e,i,o,a,c="",h,f){this.layer=e,this.zoom=i,this.lut=o,this.isText=a,this.worldview=c,this.maxUniformBufferBindings=h||24,this.uboSizeDwords=f||4096,this.allFeatureVtIndices=[],this.allFeatureIds=[],this.allFormattedSections=[],this.featureVertexRangesFromId=null,this.featureVertexRangesFromVtIndex=null,this.ubos=[],this.featureCount=0,this.cachedConstantUniforms=null,this.cachedConstantRenderZoom=null,this.cachedConstantBrightness=void 0,this.activeAppearanceByVtIndex=null,this.sharedZoomRanges=new Float32Array(18),this._zoomRangeScratch=new Float32Array(2),this._floorZoom=Math.floor(this.zoom),this.header=new Uint32Array(vn.HEADER_DWORDS),this.updateHeader(),this.isAllConstant=this.header[0]===0;const _=4*this.header[2];this.maxFeaturesPerBatch=_===0?Number.MAX_SAFE_INTEGER:Math.floor(this.uboSizeDwords/_)}updateHeader(){const e=this.layer.paint;let i=0,o=0,a=0,c=0,h=0,f=!0;const _=this._floorZoom,y=oa[+this.isText];for(let b=0;b<9;b++){const T=y[b],S=b<2,C=b===8,P=e.get(T),R=!(!P||typeof P.isConstant!="function"||P.isConstant()),L=this._appearancesHavePaintProperties(T);if(!R&&!L){const X=this._layerUnevaluated(T);X&&X.expression&&X.expression.kind==="camera"&&(c|=1<<b);continue}i|=1<<b;const V=this._collectZoomSignatures(T,_),B=V.hasZoom,G=V.differs;B&&(o|=1<<b),G&&(a|=1<<b);const H=P&&P.value;let Z,oe;H&&H.isLightConstant===!1&&(f=!1),G?(Z=!0,oe=S||C?8:4):(Z=S||C&&B,oe=Z?4:C||B?2:1),Z&&h%4!=0?h=h+3&-4:C&&h%4==3&&h++,this.header[3+b]=h,h+=oe,B&&!G&&V.representative&&this._computeZoomRange(V.representative,_,this.sharedZoomRanges,2*b)}const v=h===0?0:h+3&-4;this.header[0]=i,this.header[1]=o|a<<16,this.header[2]=v/4,this.isLightConstant=f,this.cameraMask=c}_recomputeSharedRanges(){const e=this._floorZoom,i=oa[+this.isText];let o=0;for(let a=0;a<9;a++){const c=i[a];if(this.header[0]&1<<a){if(this.header[1]&1<<a&&!(this.header[1]>>>16&1<<a)){const h=this._collectZoomSignatures(c,e);h.representative&&this._computeZoomRange(h.representative,e,this.sharedZoomRanges,2*a)}}else{const h=this._layerUnevaluated(c);h&&h.expression&&h.expression.kind==="camera"&&(o|=1<<a)}}this.cameraMask=o}_collectZoomSignatures(e,i){let o=!1,a=!1,c=null,h=0,f=0;const _=y=>{if(!y)return;this._computeZoomRange(y,i,this._zoomRangeScratch,0);const v=this._zoomRangeScratch[0],b=this._zoomRangeScratch[1];o?v===h&&b===f||(a=!0):(o=!0,h=v,f=b,c=y)};_(this._zoomExprOf(this._layerUnevaluated(e)));for(const y of this.layer.getAppearances()||[])y.hasPaintProperty(e)&&_(this._zoomExprOf(y.getUnevaluatedPaintProperty(e)));return{hasZoom:o,differs:a,representative:c}}evaluateAllProperties(e,i,o,a,c,h,f){const _={brightness:c,worldview:this.worldview},y={feature:e,featureState:i,canonical:o,availableImages:a,params:new oi(this.zoom,_),paramsNext:new oi(this.zoom+1,_),formattedSection:h,activeAppearance:f},v=this.header,b=oa[+this.isText],T=v[1]>>>16;for(let S=0;S<9;S++){const C=b[S],P=S===8,R=!!(v[1]&1<<S),L=!!(T&1<<S),V=vn.EVAL_FLAT_OFFSETS[S],B=vn.EVAL_FLAT_ZOOM_OFFSETS[S];S<2?this._evaluateColorValue(C,R,L,B,y,V):P?this._evaluateTranslateValue(C,R,L,B,y,V):this._evaluateFloatValue(C,R,L,B,y,V)}return Pr}_resolveProp(e,i,o=!1,a){const c=this.layer.paint,h=c.get(e),f=e,_=!(!i||!i.hasPaintProperty(f)),y=_?a&&h&&h.property.overrides&&h.property.overrides.hasOverride(a)?h:i.paintProperties.get(f):c.get(e);if(o||!y||typeof y.isConstant!="function"||!y.isConstant())return y;const v=_?i.getUnevaluatedPaintProperty(f):this._layerUnevaluated(e);return this._unbakeCamera(y,v)}_unbakeCamera(e,i){const o=i&&i.expression;if(!o||o.kind!=="camera")return e;let a=x_.get(i);return a||(a=new bs(e.property,o,e.parameters,e.iconImageUseTheme),x_.set(i,a)),a}_layerUnevaluated(e){const i=this.layer._transitionablePaint._values[e];return i&&i.value}_zoomExprOf(e){const i=e&&e.expression;return!i||i.kind!=="composite"&&i.kind!=="camera"?null:i}_evalAt(e,i,o){return e.property.evaluate(e.value,i,o.feature,o.featureState,o.canonical,o.availableImages,e.iconImageUseTheme,o.formattedSection)}_evaluateColorValue(e,i,o,a,c,h){const f=this._resolveProp(e,c.activeAppearance,!1,c.formattedSection);if(o&&this._writeZoomRange(f,a),!f)return Pr[h]=0,Pr[h+1]=0,Pr[h+2]=0,void(Pr[h+3]=1);const _=this._resolveProp(`${e}-use-theme`,c.activeAppearance,!0),y=Uh(_&&typeof _!="string"?_.value:void 0,c.feature,c.featureState,c.availableImages,c.canonical,c.params.brightness,c.formattedSection,this.worldview)?null:this.lut,v=(f.isConstant()?f.constantOr($t.transparent):this._evalAt(f,c.params,c)||$t.transparent).toNonPremultipliedRenderColor(y);if(Pr[h]=Yl(255*v.r,255*v.g),Pr[h+1]=Yl(255*v.b,255*v.a),i){const b=(this._evalAt(f,c.paramsNext,c)||$t.transparent).toNonPremultipliedRenderColor(y);Pr[h+2]=Yl(255*b.r,255*b.g),Pr[h+3]=Yl(255*b.b,255*b.a)}else Pr[h+2]=0,Pr[h+3]=0}_computeZoomRange(e,i,o,a){let c=0,h=1;
vendor: 4,820 bytes, line 7
7const f=!e||e.kind!=="composite"&&e.kind!=="camera"?null:e.zoomStops;if(f&&f.length>0)if(e.interpolationType==null){c=h=1;for(const _ of f)if(_>i&&_<i+1){c=h=_-i;break}}else f[0]>i&&f[0]<i+1&&(c=f[0]-i);o[a]=c,o[a+1]=h}_writeZoomRange(e,i){this._computeZoomRange(e&&e.value,this._floorZoom,Pr,i)}_evaluateFloatValue(e,i,o,a,c,h){const f=e.endsWith("opacity")?1:0,_=this._resolveProp(e,c.activeAppearance);o&&this._writeZoomRange(_,a);const y=_?_.isConstant()?_.constantOr(f):this._evalAt(_,c.params,c):f;if(Pr[h]=y??f,i){const v=this._evalAt(_,c.paramsNext,c);Pr[h+1]=v??f}else Pr[h+1]=0}_evaluateTranslateValue(e,i,o,a,c,h){const f=this._resolveProp(e,c.activeAppearance);o&&this._writeZoomRange(f,a);const _=!!f&&typeof f.isConstant=="function"&&!f.isConstant(),y=f?typeof f.isConstant!="function"?f:_?this._evalAt(f,c.params,c):f.constantOr(Jl):void 0;if(Pr[h]=y?y[0]:0,Pr[h+1]=y?y[1]:0,i){const v=_?this._evalAt(f,c.paramsNext,c):y;Pr[h+2]=v?v[0]:0,Pr[h+3]=v?v[1]:0}else Pr[h+2]=0,Pr[h+3]=0}_appearancesHavePaintProperties(e){return this.layer.getAppearances().some(i=>i.hasPaintProperty(e))}hasStateDependentPaint(e){const i=e.paint,o=oa[+this.isText];for(const a of o)if(y_(i.get(a)))return!0;for(const a of e.getAppearances()||[])for(const c of o){const h=c;if(a.hasPaintProperty(h)&&y_(a.paintProperties.get(h)))return!0}return!1}hasPerFeatureTranslate(){return!!(256&this.header[0])}getCurrentBatchIndex(){return this.maxFeaturesPerBatch===0?0:Math.floor(this.featureCount/this.maxFeaturesPerBatch)}_writeFeatureBlock(e,i){const o=this.isAllConstant?0:e;let a=Math.floor(o/this.maxFeaturesPerBatch),c=o%this.maxFeaturesPerBatch;this._batchExceedsDeviceLimit(a)&&(a=0,c=0);const h=this.ubos[a];return!!h&&(h.writeDataDrivenBlock(i,c),!0)}_batchExceedsDeviceLimit(e){return 3*e+2>=this.maxUniformBufferBindings}_reevaluateAt(e,i,o,a,c,h){if(!i)return;const f=this.allFeatureVtIndices[e],_=i.feature(f);if(!_)return;const y=this.allFeatureIds[e],v=y!=null&&c[y]||{},b={type:_.type,id:y,properties:_.properties||{},geometry:[]},T=this.activeAppearanceByVtIndex?this.activeAppearanceByVtIndex.get(f):void 0,S=this.evaluateAllProperties(b,v,o,a,h,(this.allFormattedSections?this.allFormattedSections[e]:void 0)||void 0,T);this._writeFeatureBlock(e,S)}_ensureRangeMaps(){if(!this.featureVertexRangesFromId){this.featureVertexRangesFromId=new Map,this.featureVertexRangesFromVtIndex=new Map;for(let e=0;e<this.allFeatureVtIndices.length;e++){const i=this.allFeatureIds[e];if(i!=null){let c=this.featureVertexRangesFromId.get(i);c||this.featureVertexRangesFromId.set(i,c=[]),c.push(e)}const o=this.allFeatureVtIndices[e];let a=this.featureVertexRangesFromVtIndex.get(o);a||this.featureVertexRangesFromVtIndex.set(o,a=[]),a.push(e)}}}populateUBO(e,i,o,a,c,h){const f=e.id,_=this.header,y=this.evaluateAllProperties(e,{},o,a,c,h);let v,b;this.isAllConstant?(v=0,b=this.featureCount===0,b&&(this.featureCount=1)):(v=this.featureCount++,b=!0);let T=Math.floor(v/this.maxFeaturesPerBatch),S=v%this.maxFeaturesPerBatch;return b&&(this._batchExceedsDeviceLimit(T)?(ht(`Too many symbol features: batch ${T} requires binding points up to ${3*T+2}, device limit ${this.maxUniformBufferBindings}. Some features will render incorrectly.`),T=0,S=0):(this.ubos[T]||(this.ubos[T]=new vn(null,T,this.uboSizeDwords,_)),this.ubos[T].writeDataDrivenBlock(y,S))),this.allFeatureVtIndices.push(i),this.allFeatureIds.push(f),this.allFormattedSections.push(h||null),S}updateFeatures(e,i,o,a,c,h,f){this.layer=i,this.cachedConstantUniforms=null,this._ensureRangeMaps();for(const _ of e){const y=this.featureVertexRangesFromId.get(_);if(y)for(const v of y)this._reevaluateAt(v,o,a,c,h,f)}}updateDynamicExpressions(e,i,o,a,c,h){if(this.layer=e,this.cachedConstantUniforms=null,this._recomputeSharedRanges(),this.header[0]!==0)for(let f=0;f<this.allFeatureVtIndices.length;f++)this._reevaluateAt(f,i,o,a,c,h)}updateFeaturePaintForAppearance(e,i,o,a,c,h,f){if(!this.layer||(this.activeAppearanceByVtIndex||(this.activeAppearanceByVtIndex=new Map),this.activeAppearanceByVtIndex.set(e,f||null),this.header[0]===0))return!1;this._ensureRangeMaps();const _=this.featureVertexRangesFromVtIndex.get(e);if(!_)return!1;let y=!1;for(const v of _){const b=this.evaluateAllProperties(i,o,a,c,h,(this.allFormattedSections?this.allFormattedSections[v]:void 0)||void 0,f);y=this._writeFeatureBlock(v,b)||y}return y}getConstantUniformValues(e,i){const o=this.header,a=!!this.cameraMask,c=!!o[1];if(this.cachedConstantUniforms&&this.cachedConstantBrightness===i&&(!a&&!c||this.cachedConstantRenderZoom===e))return this.cachedConstantUniforms;const h=this.layer.paint,f=a?new oi(e,{brightness:i,worldview:this.worldview}):null,_={type:1,id:void 0,properties:{},geometry:[]},y=oa[+this.isText],v=C=>{const P=y[C],R=h.get(P);if(!R)return[0,0,0,1];const L=h.get(`${P}
7-use-theme`),V=Uh(L&&typeof L!="string"?L.value:void 0,_,{},[],void 0,i,void 0,this.worldview)?null:this.lut;return(this.cameraMask&1<<C&&f?R.property.evaluate(R.value,f,_,{},void 0,[])||$t.transparent:R.constantOr($t.transparent)).toNonPremultipliedRenderColor(V).toArray01()},b=(C,P)=>{const R=h.get(y[C]);if(!R)return P;if(this.cameraMask&1<<C&&f){const L=R.property.evaluate(R.value,f,_,{},void 0,[]);return L??P}return R.constantOr(P)},T=new Float32Array(9);if(c){const C=e-Math.floor(e);for(let P=0;P<9;P++){if(!(o[1]&1<<P))continue;const R=this.sharedZoomRanges[2*P],L=this.sharedZoomRanges[2*P+1];T[P]=R===L?C>=R?1:0:Math.max(0,Math.min(1,(C-R)/(L-R)))}}const S={fill_np_color:v(0),halo_np_color:v(1),opacity:b(2,1),halo_width:b(3,0),halo_blur:b(4,0),emissive_strength:b(5,0),occlusion_opacity:b(6,1),z_offset:b(7,0),zoomFactors:T};return this.cachedConstantUniforms=S,this.cachedConstantRenderZoom=e,this.cachedConstantBrightness=i,S}finalize(){for(const e of this.ubos)e.rightSizeForTransfer()}upload(e){for(const i of this.ubos)i.upload(e)}bind(e,i,o=0){this.ubos[o]&&this.ubos[o].bind(e,i)}destroy(){for(const e of this.ubos)e.destroy();this.ubos=[],this.featureVertexRangesFromId=null,this.featureVertexRangesFromVtIndex=null,this.allFeatureVtIndices=[],this.allFeatureIds=[],this.featureCount=0,this.maxFeaturesPerBatch=0}}Je(np,"SymbolPropertyBinderUBO",{omit:["layer","cachedConstantUniforms","cachedConstantRenderZoom","cachedConstantBrightness","activeAppearanceByVtIndex","featureVertexRangesFromId","featureVertexRangesFromVtIndex"]});const fr=24;function yy(r,e,i){return r.sections.forEach(o=>{o.text=(function(a,c,h){const f=c.layout.get("text-transform").evaluate(h,{});return f==="uppercase"?a=a.toLocaleUpperCase():f==="lowercase"&&(a=a.toLocaleLowerCase()),Wo.applyArabicShaping&&(a=Wo.applyArabicShaping(a)),a})(o.text,e,i)}),r}const ou={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂","←":"↑","→":"↓"};function v_(r){return r==="︶"||r==="﹈"||r==="︸"||r==="﹄"||r==="﹂"||r==="︾"||r==="︼"||r==="︺"||r==="︘"||r==="﹀"||r==="︐"||r==="︓"||r==="︔"||r==="`"||r===" ̄"||r==="︑"||r==="︒"}function op(r){return r==="︵"||r==="﹇"||r==="︷"||r==="﹃"||r==="﹁"||r==="︽"||r==="︻"||r==="︹"||r==="︗"||r==="︿"}const jh=4294967296,xy=1/jh,s=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");class t{constructor(e){this.buf=ArrayBuffer.isView(e)?e:new Uint8Array(e),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this._valueStart=-1,this.length=this.buf.length}readFields(e,i,o=this.length){let a;for(;a=this.nextField(o);)e(a,i,this);return i}readMessage(e,i){return this.readFields(e,i,this.readVarint()+this.pos)}readFixed32(){const e=this.dataView.getUint32(this.pos,!0);return this.pos+=4,e}readSFixed32(){const e=this.dataView.getInt32(this.pos,!0);return this.pos+=4,e}readFixed64(){const e=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*jh;return this.pos+=8,e}readSFixed64(){const e=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*jh;return this.pos+=8,e}readFloat(){const e=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,e}readDouble(){const e=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,e}readVarint(e){const i=this.buf,o=i[this.pos++];if(o<128)return o;let a,c=127&o;return a=i[this.pos++],c|=(127&a)<<7,a<128?c:(a=i[this.pos++],c|=(127&a)<<14,a<128?c:(a=i[this.pos++],c|=(127&a)<<21,a<128?c:(a=i[this.pos],c|=(15&a)<<28,(function(h,f,_){const y=_.buf;let v,b;if(b=y[_.pos++],v=(112&b)>>4,b<128||(b=y[_.pos++],v|=(127&b)<<3,b<128)||(b=y[_.pos++],v|=(127&b)<<10,b<128)||(b=y[_.pos++],v|=(127&b)<<17,b<128)||(b=y[_.pos++],v|=(127&b)<<24,b<128)||(b=y[_.pos++],v|=(1&b)<<31,b<128))return n(h,v,f);throw new Error("Expected varint not more than 10 bytes")})(c,e,this))))}readSVarint(){const e=this.readVarint();return e%2==1?(e+1)/-2:e/2}readBoolean(){return!!this.readVarint()}readString(){const e=this.readVarint()+this.pos,i=this.pos;return this.pos=e,e-i>=12&&s?s.decode(this.buf.subarray(i,e)):(function(o,a,c){let h="",f=a;for(;f<c;){const _=o[f];let y,v,b,T=null,S=_>239?4:_>223?3:_>191?2:1;if(f+S>c)break;S===1?_<128&&(T=_):S===2?(y=o[f+1],(192&y)==128&&(T=(31&_)<<6|63&y,T<=127&&(T=null))):S===3?
vendor: 5,573 bytes, line 7
7(y=o[f+1],v=o[f+2],(192&y)==128&&(192&v)==128&&(T=(15&_)<<12|(63&y)<<6|63&v,(T<=2047||T>=55296&&T<=57343)&&(T=null))):S===4&&(y=o[f+1],v=o[f+2],b=o[f+3],(192&y)==128&&(192&v)==128&&(192&b)==128&&(T=(15&_)<<18|(63&y)<<12|(63&v)<<6|63&b,(T<=65535||T>=1114112)&&(T=null))),T===null?(T=65533,S=1):T>65535&&(T-=65536,h+=String.fromCharCode(T>>>10&1023|55296),T=56320|1023&T),h+=String.fromCharCode(T),f+=S}return h})(this.buf,i,e)}readBytes(){const e=this.readVarint()+this.pos,i=this.buf.subarray(this.pos,e);return this.pos=e,i}readPackedVarint(e=[],i){const o=this.readPackedEnd();for(;this.pos<o;)e.push(this.readVarint(i));return e}readPackedSVarint(e=[]){const i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readSVarint());return e}readPackedBoolean(e=[]){const i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readBoolean());return e}readPackedFloat(e=[]){const i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readFloat());return e}readPackedDouble(e=[]){const i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readDouble());return e}readPackedFixed32(e=[]){const i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readFixed32());return e}readPackedSFixed32(e=[]){const i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readSFixed32());return e}readPackedFixed64(e=[]){const i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readFixed64());return e}readPackedSFixed64(e=[]){const i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readSFixed64());return e}readPackedEnd(){return this.type===2?this.readVarint()+this.pos:this.pos+1}nextField(e=this.length){if(this.pos===this._valueStart&&this.skip(this.type),this.pos>=e)return 0;const i=this.readVarint();return this.type=7&i,this._valueStart=this.pos,i>>>3}skip(e){const i=7&e;if(i===0)for(;this.buf[this.pos++]>127;);else if(i===2)this.pos=this.readVarint()+this.pos;else if(i===5)this.pos+=4;else{if(i!==1)throw new Error(`Unimplemented type: ${i}`);this.pos+=8}}}function n(r,e,i){return i?4294967296*e+(r>>>0):4294967296*(e>>>0)+(r>>>0)}function l(r,e,i){const o=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));i.realloc(o),i.buf.copyWithin(r+o,r,i.pos)}function d(r,e){for(let i=0;i<r.length;i++)e.writeVarint(r[i])}function p(r,e){for(let i=0;i<r.length;i++)e.writeSVarint(r[i])}function m(r,e){for(let i=0;i<r.length;i++)e.writeFloat(r[i])}function g(r,e){for(let i=0;i<r.length;i++)e.writeDouble(r[i])}function x(r,e){for(let i=0;i<r.length;i++)e.writeBoolean(r[i])}function w(r,e){for(let i=0;i<r.length;i++)e.writeFixed32(r[i])}function E(r,e){for(let i=0;i<r.length;i++)e.writeSFixed32(r[i])}function A(r,e){for(let i=0;i<r.length;i++)e.writeFixed64(r[i])}function I(r,e){for(let i=0;i<r.length;i++)e.writeSFixed64(r[i])}function M(r,e,i){let o;for(;o=r.nextField(e);)o===3?i.glyphs.push(D(r,r.readVarint()+r.pos)):o===4?i.ascender=r.readSVarint():o===5&&(i.descender=r.readSVarint())}function D(r,e){let i,o,a=0,c=0,h=0,f=0,_=0,y=0;for(;o=r.nextField(e);)o===1?a=r.readVarint():o===2?i=r.readBytes():o===3?c=r.readVarint():o===4?h=r.readVarint():o===5?f=r.readSVarint():o===6?_=r.readSVarint():o===7&&(y=r.readVarint());return{id:a,bitmap:new na({width:c+6,height:h+6},i),metrics:{width:c,height:h,left:f,top:_,advance:y}}}const z={horizontal:1,vertical:2,horizontalOnly:3};class O{constructor(){this.scale=1,this.fontStack="",this.image=null}static forText(e,i){const o=new O;return o.scale=e||1,o.fontStack=i,o}static forImage(e){const i=new O;return i.image=e,i}}class k{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(e,i,o,a=1){const c=new k;for(let h=0;h<e.sections.length;h++){const f=e.sections[h];f.image?c.addImageSection(f,o,a):c.addTextSection(f,i)}return c}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,o){let a="";for(let c=0;c<i.length;c++){const h=i.charCodeAt(c+1)||null,f=i.charCodeAt(c-1)||null;a+=!o&&(h&&hh(h)&&!ou[i[c+1]]||f&&hh(f)&&!ou[i[c-1]])||!ou[i[c]]?i[c]:ou[i[c]]}return a})(this.text,e)}trim(){let e=0;for(let o=0;o<this.text.length&&$[this.text.charCodeAt(o)];o++)e++;let i=this.text.length;for(let o=this.text.length-1;o>=0&&o>=e&&$[this.text.charCodeAt(o)];o--)i--;this.text=this.text.substring(e,i),this.sectionIndex=this.sectionIndex.slice(e,i)}substring(e,i){const o=new k;return o.text=this.text.substring(e,i),o.sectionIndex=this.sectionIndex.slice(e,i),o.sections=this.sections,o}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(O.forText(e.scale,e.fontStack||i));const o=this.sections.length-1;for(let a=0;a<e.text.length;++a)this.sectionIndex.push(o)}addImageSection(e,i,o=1){const a=e.image?e.image.getPrimary():null;if(!a)return void ht("Can't add FormattedSection with an empty image.");a.scaleSelf(i*o);const c=this.getNextImageSectionCharCode();c?(this.text+=String.fromCodePoint(c),this.sections.push(O.forImage(a)),this.sectionIndex.push(this.sections.length-1)):ht("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function q(r,e,i,o,a,c,h,f,_,y,v,b,T,S,C,P=1,R=1){const L=k.fromFeature(r,a,P,R);b===z.vertical&&L.verticalizePunctuation(T);let V=[];
7const B=(function(X,ee,ie,ne,fe,ge,we=1){if(!X)return[];const Se=[],Ee=(function(Te,Ce,ze,Fe,Be,De,Ge=1){let Ze=0;for(let Qe=0;Qe<Te.length();Qe++){const Xe=Te.getSection(Qe);Ze+=Q(Te.getCodePoint(Qe),Xe,Fe,Be,Ce,De,Ge)}return Ze/Math.max(1,Math.ceil(Ze/ze))})(X,ee,ie,ne,fe,ge,we),Ve=X.text.includes("​");let Ie=0;for(let Te=0;Te<X.length();Te++){const Ce=X.getSection(Te),ze=X.getCodePoint(Te);if($[ze]||(Ie+=Q(ze,Ce,ne,fe,ee,ge,we)),Te<X.length()-1){const Fe=Am(ze);(U[ze]||Fe||Ce.image)&&Se.push(W(Te+1,Ie,Ee,Se,ae(ze,X.getCodePoint(Te+1),Fe&&Ve),!1))}}return J(W(X.length(),Ie,Ee,Se,0,!0))})(L,y,c,e,o,S,R),{processBidirectionalText:G,processStyledBidirectionalText:H}=Wo;if(G&&L.sections.length===1){const X=G(L.toString(),B);for(const ee of X){const ie=new k;ie.text=ee,ie.sections=L.sections;for(let ne=0;ne<ee.length;ne++)ie.sectionIndex.push(0);V.push(ie)}}else if(H){const X=H(L.text,L.sectionIndex,B);for(const ee of X){const ie=new k;ie.text=ee[0],ie.sectionIndex=ee[1],ie.sections=L.sections,V.push(ie)}}else V=(function(X,ee){const ie=[],ne=X.text;let fe=0;for(const ge of ee)ie.push(X.substring(fe,ge)),fe=ge;return fe<ne.length&&ie.push(X.substring(fe,ne.length)),ie})(L,B);const Z=[],oe={positionedLines:Z,text:L.toString(),top:v[1],bottom:v[1],left:v[0],right:v[0],writingMode:b,iconsInText:!1,verticalizable:!1,hasBaseline:!1};if((function(X,ee,ie,ne,fe,ge,we,Se,Ee,Ve,Ie,Te,Ce=1){let ze=0,Fe=0,Be=0;const De=Se==="right"?1:Se==="left"?0:.5;let Ge=!1;for(const vt of fe){const ft=vt.getSections();for(const xt of ft){if(xt.image)continue;const mt=ee[xt.fontStack];if(mt&&(Ge=mt.ascender!==void 0&&mt.descender!==void 0,!Ge))break}if(!Ge)break}let Ze=0;for(const vt of fe){vt.trim();const ft=vt.getMaxScale(),xt=(ft-1)*fr,mt={positionedGlyphs:[],lineOffset:0};X.positionedLines[Ze]=mt;const Rt=mt.positionedGlyphs;let ut=0;if(!vt.length()){Fe+=ge,++Ze;continue}let Gt=0,Nt=0;for(let qt=0;qt<vt.length();qt++){const Pi=vt.getSection(qt),Dr=vt.getSectionIndex(qt),ai=vt.getCodePoint(qt);let hi=Pi.scale,Ji=null,vr=null,Vi=null,It=fr,zr=0,br=Ee;br===z.vertical&&so(ai)&&(br=z.horizontal);const wr=!(br===z.horizontal||!Ie&&!Vl(ai)||Ie&&($[ai]||of(ai)));if(Pi.image){const Wi=ne.get(Pi.image.toString());if(!Wi)continue;Vi=Pi.image,X.iconsInText=X.iconsInText||!0,vr=Wi.paddedRect;const Qi=Wi.displaySize,mr=Qi[0]*Ce,ji=Qi[1]*Ce;hi=hi*fr/Te,Ji={width:mr,height:ji,left:0,top:-3,advance:wr?ji:mr,localGlyph:!1},zr=Ge?-Ji.height*hi:ft*fr-17-ji*hi,It=Ji.advance;const yi=(wr?mr:ji)*hi-fr*ft;yi>0&&yi>ut&&(ut=yi)}else{const Wi=ie[Pi.fontStack];if(!Wi)continue;Wi[ai]&&(vr=Wi[ai]);const Qi=ee[Pi.fontStack];if(!Qi)continue;const mr=Qi.glyphs[ai];if(!mr)continue;if(Ji=mr.metrics,It=ai!==8203?fr:0,Ge){const ji=Qi.ascender!==void 0?Math.abs(Qi.ascender):0,yi=Qi.descender!==void 0?Math.abs(Qi.descender):0,Lr=(ji+yi)*hi;Gt<Lr&&(Gt=Lr,Nt=(ji-yi)/2*hi),zr=-ji*hi}else zr=(ft-hi)*fr-17}wr?(X.verticalizable=!0,Rt.push({glyph:ai,image:Vi,x:ze,y:Fe+zr,vertical:wr,scale:hi,localGlyph:Ji.localGlyph,fontStack:Pi.fontStack,sectionIndex:Dr,metrics:Ji,rect:vr}),ze+=It*hi+Ve):(Rt.push({glyph:ai,image:Vi,x:ze,y:Fe+zr,vertical:wr,scale:hi,localGlyph:Ji.localGlyph,fontStack:Pi.fontStack,sectionIndex:Dr,metrics:Ji,rect:vr}),ze+=Ji.advance*hi+Ve)}Rt.length!==0&&(Be=Math.max(ze-Ve,Be),Ge?ue(Rt,De,ut,Nt,ge*ft/2):ue(Rt,De,ut,0,ge/2)),ze=0;const Wt=ge*ft+ut;mt.lineOffset=Math.max(ut,xt),Fe+=Wt,++Ze}const Qe=Fe,{horizontalAlign:Xe,verticalAlign:rt}=se(we);(function(vt,ft,xt,mt,Rt,ut){const Gt=(ft-xt)*Rt,Nt=-ut*mt;for(const Wt of vt)for(const qt of Wt.positionedGlyphs)qt.x+=Gt,qt.y+=Nt})(X.positionedLines,De,Xe,rt,Be,Qe),X.top+=-rt*Qe,X.bottom=X.top+Qe,X.left+=-Xe*Be,X.right=X.left+Be,X.hasBaseline=Ge})(oe,e,i,o,V,h,f,_,b,y,T,C,R),!(function(X){for(const ee of X)if(ee.positionedGlyphs.length!==0)return!1;return!0})(Z))return oe}const $={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},U={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 Q(r,e,i,o,a,c,h=1){if(e.image){const f=o.get(e.image.toString());return f?f.displaySize[0]*h*e.scale*fr/c+a:0}{const f=i[e.fontStack],_=f&&f.glyphs[r];return _?_.metrics.advance*e.scale+a:0}}function Y(r,e,i,o){const a=Math.pow(r-e,2);return o?r<e?a/2:2*a:a+Math.abs(i)*i}function ae(r,e,i){let o=0;return r===10&&(o-=1e4),i&&(o+=150),r!==40&&r!==65288||(o+=50),e!==41&&e!==65289||(o+=50),o}function W(r,e,i,o,a,c){let h=null,f=Y(e,i,a,c);for(const _ of o){const y=Y(e-_.x,i,a,c)+_.badness;y<=f&&(h=_,f=y)}return{index:r,x:e,priorBreak:h,badness:f}}function J(r){return r?J(r.priorBreak).concat(r.index):[]}function se(r){let e=.5,i=.5;
vendor: 27,475 bytes, line 7
7switch(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 ue(r,e,i,o,a){if(!(e||i||o||a))return;const c=r.length-1,h=r[c],f=(h.x+h.metrics.advance*h.scale)*e;for(let _=0;_<=c;_++)r[_].x-=f,r[_].y+=i+o+a}function he(r){return r.imagePrimary!==void 0&&r.top!==void 0&&r.bottom!==void 0&&r.left!==void 0&&r.right!==void 0}function ve(r,e,i,o){const{horizontalAlign:a,verticalAlign:c}=se(o),h=i[0]-r.displaySize[0]*a,f=i[1]-r.displaySize[1]*c;return{imagePrimary:r,imageSecondary:e,top:f,bottom:f+r.displaySize[1],left:h,right:h+r.displaySize[0]}}function xe(r,e,i,o,a,c){const h=r.imagePrimary;let f;if(h.content){const R=h.content,L=h.pixelRatio||1;f=[R[0]/L,R[1]/L,h.displaySize[0]-R[2]/L,h.displaySize[1]-R[3]/L]}const _=e.left*c,y=e.right*c;let v,b,T,S;i==="width"||i==="both"?(S=a[0]+_-o[3],b=a[0]+y+o[1]):(S=a[0]+(_+y-h.displaySize[0])/2,b=S+h.displaySize[0]);const C=e.top*c,P=e.bottom*c;return i==="height"||i==="both"?(v=a[1]+C-o[0],T=a[1]+P+o[2]):(v=a[1]+(C+P-h.displaySize[1])/2,T=v+h.displaySize[1]),{imagePrimary:h,imageSecondary:void 0,top:v,right:b,bottom:T,left:S,collisionPadding:f}}function Le(r){return!r.imagePrimary.stretchX}function _e(r){return!r.imagePrimary.stretchY}function Pe(r){return{width:r.right-r.left,height:r.bottom-r.top}}const me=128;function Re(r,e,i,o){const{expression:a}=e;if(a.kind==="constant")return{kind:"constant",layoutSize:a.evaluate(new oi(r+1,{worldview:i}),void 0,void 0,void 0,o)};if(a.kind==="source")return{kind:"source"};{const{zoomStops:c,interpolationType:h}=a;let f=0;for(;f<c.length&&c[f]<=r;)f++;f=Math.max(0,f-1);let _=f;for(;_<c.length&&c[_]<r+1;)_++;_=Math.min(c.length-1,_);const y=c[f],v=c[_];return a.kind==="composite"?{kind:"composite",minZoom:y,maxZoom:v,interpolationType:h}:{kind:"camera",minZoom:y,maxZoom:v,minSize:a.evaluate(new oi(y,{worldview:i}),void 0,void 0,void 0,o),maxSize:a.evaluate(new oi(v,{worldview:i}),void 0,void 0,void 0,o),interpolationType:h}}}function Me(r,{uSize:e,uSizeT:i},{lowerSize:o,upperSize:a}){return r.kind==="source"?o/me:r.kind==="composite"?yt(o/me,a/me,i):e}function Ae(r,e,i=1){let o=0,a=0;if(r.kind==="constant")a=r.layoutSize*i;else if(r.kind!=="source"){const{interpolationType:c,minZoom:h,maxZoom:f}=r,_=c?te(Mn.interpolationFactor(c,e,h,f),0,1):0;r.kind==="camera"?a=yt(r.minSize,r.maxSize,_)*i:o=_*i}return{uSizeT:o,uSize:a}}class We extends Ne{constructor(e,i,o,a,c){super(e,i),this.angle=a,this.z=o,c!==void 0&&(this.segment=c)}clone(){return new We(this.x,this.y,this.z,this.angle,this.segment)}}function ke(r,e,i,o,a){if(e.segment===void 0)return!0;let c=e,h=e.segment+1,f=0;for(;f>-i/2;){if(h--,h<0)return!1;f-=r[h].dist(c),c=r[h]}f+=r[h].dist(r[h+1]),h++;const _=[];let y=0;for(;f<i/2;){const v=r[h],b=r[h+1];if(!b)return!1;let T=r[h-1].angleTo(v)-v.angleTo(b);for(T=Math.abs((T+3*Math.PI)%(2*Math.PI)-Math.PI),_.push({distance:f,angleDelta:T}),y+=T;f-_[0].distance>o;)y-=_.shift().angleDelta;if(y>a)return!1;h++,f+=v.dist(b)}return!0}function Ue(r){let e=0;for(let i=0;i<r.length-1;i++)e+=r[i].dist(r[i+1]);return e}function je(r,e,i){return r?.6*e*i:0}function et(r,e){return Math.max(r?r.right-r.left:0,e?e.right-e.left:0)}function tt(r,e,i,o,a,c){const h=je(i,a,c),f=et(i,o)*c;let _=0;const y=Ue(r)/2;for(let v=0;v<r.length-1;v++){const b=r[v],T=r[v+1],S=b.dist(T);if(_+S>y){const C=(y-_)/S,P=yt(b.x,T.x,C),R=yt(b.y,T.y,C),L=new We(P,R,0,T.angleTo(b),v);return!h||ke(r,L,f,h,e)?L:void 0}_+=S}}function it(r,e,i,o,a,c,h,f,_){const y=je(o,c,h),v=et(o,a),b=v*h,T=r[0].x===0||r[0].x===_||r[0].y===0||r[0].y===_;return e-b<e/4&&(e=b+e/4),at(r,T?e/2*f%e:(v/2+2*c)*h*f%e,e,y,i,b,T,!1,_)}function at(r,e,i,o,a,c,h,f,_){const y=c/2,v=Ue(r);let b=0,T=e-i,S=[];for(let C=0;C<r.length-1;C++){const P=r[C],R=r[C+1],L=P.dist(R),V=R.angleTo(P);for(;T+i<b+L;){T+=i;const B=(T-b)/L,G=yt(P.x,R.x,B),H=yt(P.y,R.y,B);if(G>=0&&G<_&&H>=0&&H<_&&T-y>=0&&T+y<=v){const Z=new We(G,H,0,V,C);o&&!ke(r,Z,c,o,a)||S.push(Z)}}b+=L}return f||S.length||h||(S=at(r,b/2,i,o,a,c,h,!0,_)),S}function bt(r){let e=0,i=0;for(const h of r)e+=h.w*h.h,i=Math.max(i,h.w);r.sort((h,f)=>f.h-h.h);const o=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),i),h:1/0}];let a=0,c=0;for(const h of r)for(let f=o.length-1;f>=0;f--){const _=o[f];if(!(h.w>_.w||h.h>_.h)){if(h.x=_.x,h.y=_.y,c=Math.max(c,h.y+h.h),a=Math.max(a,h.x+h.w),h.w===_.w&&h.h===_.h){const y=o.pop();y&&f<o.length&&(o[f]=y)}else h.h===_.h?(_.x+=h.w,_.w-=h.w):h.w===_.w?(_.y+=h.h,_.h-=h.h):(o.push({x:_.x+h.w,y:_.y,w:_.w-h.w,h:h.h}),_.y+=h.h,_.h-=h.h);break}}return{w:a,h:c,fill:e/(a*c)||0}}function _t(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 Ct(r){let e=0;for(let i=0;i<r.length;i++)e=(e<<5)-e+r.charCodeAt(i),e&=e;return e}function At(r,e){return(r<<5)-r+e}function gt(r,e,i,o){for(const[a]of r.entries()){const c=o&&o.get(a)||Vr.parse(a),h=c.id.toString(),f=e.get(h)||0;i.push({id:a,version:f,sx:c.sx,sy:c.sy})}}Je(We,"Anchor");class Et{constructor(e,i,o,a,c){this.iconDescriptors=[],this.patternDescriptors=[],this.requiresMipMaps=i.size>0,gt(e,o,this.iconDescriptors,c),gt(i,o,this.patternDescriptors,c),this.iconDescriptors.sort(_t),this.patternDescriptors.sort(_t);let h=0;const f=a?a.data:"";f&&(h=At(h,Ct(f))),h=At(h,1);for(const _ of this.iconDescriptors)h=At(h,Ct(_.id)),h=At(h,_.version),h=At(h,_.sx),h=At(h,_.sy);h=At(h,1);for(const _ of this.patternDescriptors)h=At(h,Ct(_.id)),h=At(h,_.version),h=At(h,_.sx),h=At(h,_.sy);this.hash=h}subsetOf(e){return this.isSubsetArray(this.iconDescriptors,e.iconDescriptors,_t)&&this.isSubsetArray(this.patternDescriptors,e.patternDescriptors,_t)}isSubsetArray(e,i,o){let a=0,c=0;if(e.length>i.length)return!1;for(;a<e.length&&c<i.length;){const h=o(e[a],i[c]);if(h===0)a++,c++;else{if(h<0)return!1;c++}}return a===e.length}}function wt(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 Ot(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}}Je(Et,"AtlasContentDescriptor");class Ht{constructor(e,i,o,a){this.context=e,this.format=o,this.useMipmap=a&&a.useMipmap,this.texture=e.gl.createTexture(),this.update(i,{premultiply:a&&a.premultiply})}update(e,i){const o=e&&e instanceof HTMLVideoElement&&e.width===0?e.videoWidth:e.width,a=e&&e instanceof HTMLVideoElement&&e.height===0?e.videoHeight:e.height,{context:c}=this,{gl:h}=c,{x:f,y:_}=i&&i.position?i.position:{x:0,y:0},y=f+o,v=_+a;this.size&&(this.size[0]!==y||this.size[1]!==v)&&(!i||i.recreateWhenResize===void 0||i.recreateWhenResize)&&(h.bindTexture(h.TEXTURE_2D,null),h.deleteTexture(this.texture),this.texture=h.createTexture(),this.size=null),h.bindTexture(h.TEXTURE_2D,this.texture),c.pixelStoreUnpackFlipY.set(!1),c.pixelStoreUnpack.set(1),c.pixelStoreUnpackPremultiplyAlpha.set(this.format===h.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&&y>0&&v>0){const T=this.useMipmap?Math.floor(Math.log2(Math.max(y,v)))+1:1;h.texStorage2D(h.TEXTURE_2D,T,this.format,y,v),this.size=[y,v]}this.size&&(b?h.texSubImage2D(h.TEXTURE_2D,0,f,_,wt(this.format),Ot(this.format),e):"data"in e&&e.data&&h.texSubImage2D(h.TEXTURE_2D,0,f,_,o,a,wt(this.format),Ot(this.format),e.data)),this.useMipmap&&h.generateMipmap(h.TEXTURE_2D)}bind(e,i,o=!1){const{context:a}=this,{gl:c}=a;c.bindTexture(c.TEXTURE_2D,this.texture),e!==this.minFilter&&(c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,e),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,this.useMipmap&&!o?e===c.NEAREST?c.NEAREST_MIPMAP_NEAREST:c.LINEAR_MIPMAP_LINEAR:e),this.minFilter=e),i!==this.wrapS&&(c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,i),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,i),this.wrapS=i)}bindExtraParam(e,i,o,a,c){const{context:h}=this,{gl:f}=h;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),o!==this.wrapS&&(f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_S,o),this.wrapS=o),a!==this.wrapT&&(f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_T,a),this.wrapT=a),c!==this.compareMode&&(c?(f.texParameteri(f.TEXTURE_2D,f.TEXTURE_COMPARE_MODE,f.COMPARE_REF_TO_TEXTURE),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_COMPARE_FUNC,c)):f.texParameteri(f.TEXTURE_2D,f.TEXTURE_COMPARE_MODE,f.NONE),this.compareMode=c)}destroy(){const{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}}class fi{static getImagePositionScale(e,i,o){if(i&&e){const{sx:a,sy:c}=e;return{x:a,y:c}}return{x:o,y:o}}constructor(e,i,o,a){this.paddedRect=e;const{pixelRatio:c,version:h,stretchX:f,stretchY:_,content:y,sdf:v,usvg:b}=i;this.pixelRatio=c,this.stretchX=f,this.stretchY=_,this.content=y,this.version=h,this.padding=o,this.sdf=v,this.usvg=b,this.scale=fi.getImagePositionScale(a,b,c)}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 ei(r,e,i){const o=Vr.parse(r),a=(function(c,h,f=[1,1]){return{x:0,y:0,w:(c.data?c.data.width:c.width*f[0])+2*h,h:(c.data?c.data.height:c.height*f[1])+2*h}})(e,i,[o.sx,o.sy]);return{bin:a,imagePosition:new fi(a,e,i,o),imageVariant:o}}function kt(r,e){const i=[];for(const[a,c]of r.entries()){const h=Vr.parse(a);h&&(i.push({key:a,value:c,variant:h}),e&&e.set(a,h))}i.sort((a,c)=>{const h=a.variant.id.toString().localeCompare(c.variant.id.toString());return h!==0?h:a.variant.sx!==c.variant.sx?a.variant.sx-c.variant.sx:a.variant.sy!==c.variant.sy?a.variant.sy-c.variant.sy:a.key.localeCompare(c.key)});const o=new Map;for(const a of i)o.set(a.key,a.value);return o}class gi{constructor(e){this.sourceAtlasHash=e}}class si{constructor(e,i,o,a){const c=new Map,h=new Map;this.haveRenderCallbacks=[];const f=[],_=a!==void 0,y=_?new Map:void 0,v=_?kt(e,y):e,b=_?kt(i,y):i;this.addImages(v,c,1,f),this.addImages(b,h,2,f);const{w:T,h:S}=bt(f),C=new Or({width:T||1,height:S||1});for(const[P,R]of v.entries()){const L=c.get(P).paddedRect;Or.copy(R.data,C,{x:0,y:0},{x:L.x+1,y:L.y+1},R.data,null,R.sdf)}for(const[P,R]of b.entries()){const L=h.get(P),V=L.paddedRect;let B=L.padding;const G=V.x+B,H=V.y+B,Z=R.data.width,oe=R.data.height;B=B>1?B-1:B,Or.copy(R.data,C,{x:0,y:0},{x:G,y:H},R.data,o),Or.copy(R.data,C,{x:0,y:oe-B},{x:G,y:H-B},{width:Z,height:B},o),Or.copy(R.data,C,{x:0,y:0},{x:G,y:H+oe},{width:Z,height:B},o),Or.copy(R.data,C,{x:Z-B,y:0},{x:G-B,y:H},{width:B,height:oe},o),Or.copy(R.data,C,{x:0,y:0},{x:G+Z,y:H},{width:B,height:oe},o),Or.copy(R.data,C,{x:Z-B,y:oe-B},{x:G-B,y:H-B},{width:B,height:B},o),Or.copy(R.data,C,{x:0,y:oe-B},{x:G+Z,y:H-B},{width:B,height:B},o),Or.copy(R.data,C,{x:0,y:0},{x:G+Z,y:H+oe},{width:B,height:B},o),Or.copy(R.data,C,{x:Z-B,y:0},{x:G-B,y:H+oe},{width:B,height:B},o)}this.lut=o,this.image=C,this.iconPositions=c,this.patternPositions=h,_&&(this.contentDescriptor=new Et(v,b,a,o,y))}addImages(e,i,o,a){for(const[c,h]of e.entries()){const{bin:f,imagePosition:_,imageVariant:y}=ei(c,h,o);i.set(c,_),a.push(f),h.hasRenderCallback&&this.haveRenderCallbacks.push(y.id)}}patchUpdatedImages(e,i,o,a){this.haveRenderCallbacks=this.haveRenderCallbacks.filter(c=>e.hasImage(c,o)),e.dispatchRenderCallbacks(this.haveRenderCallbacks,o);for(const c of e.getUpdatedImages(o)){for(const h of this.iconPositions.keys()){const f=Vr.parse(h);if(In.isEqual(f.id,c)){const _=e.getImage(c,o);this.patchUpdatedImage(this.iconPositions.get(h),_,i,null)}}for(const h of this.patternPositions.keys()){const f=Vr.parse(h);if(In.isEqual(f.id,c)){const _=e.getImage(c,o);this.patchUpdatedImage(this.patternPositions.get(h),_,i,a||this.lut)}}}}patchUpdatedImage(e,i,o,a=null){if(!e||!i||e.version===i.version)return;e.version=i.version;const[c,h]=e.tl,f=e.sdf;if(this.lut||f){const _={width:i.data.width,height:i.data.height},y=new Or(_);Or.copy(i.data,y,{x:0,y:0},{x:0,y:0},_,a,f),o.update(y,{position:{x:c,y:h},recreateWhenResize:!1})}else o.update(i.data,{position:{x:c,y:h},recreateWhenResize:!1})}}Je(fi,"ImagePosition"),Je(si,"ImageAtlas",{omit:["lut"]}),Je(gi,"ImageAtlasReference");class Si{constructor(e){this.pendingRequests=new Map,this.cachedRanges=new Map,this.fontstackCompositing=e&&e.fontstackCompositing||"client"}loadGlyphRange(e,i,o,a,c){if(this.fontstackCompositing==="server")return void Si.loadGlyphRange(e,i,o,a,c);const h=e.split(",").map(f=>f.trim()).filter(f=>f.length>0);h.length!==0?h.length!==1?this._loadMultipleFonts(h,i,o,a,c):this._loadFont(h[0],i,o,a,c):c(new Error("Empty fontstack"))}_loadMultipleFonts(e,i,o,a,c){const h=e.map(()=>null),f={completed:0,firstError:null,callbackCalled:!1},_=(y,v,b)=>{if(!f.callbackCalled&&(v&&!f.firstError&&(f.firstError=v),b&&(h[y]=b),f.completed++,f.completed===e.length)){f.callbackCalled=!0;const T=h.filter(C=>C!==null);if(T.length===0)return void c(f.firstError||new Error("All fonts failed to load"));const S=this._composeGlyphs(T);c(null,S)}};for(let y=0;y<e.length;y++)this._loadFont(e[y],i,o,a,(v,b)=>{_(y,v,b)})}_loadFont(e,i,o,a,c){const h=`${e}:${i}`;if(this.cachedRanges.has(h)){const _=this.cachedRanges.get(h);return void Ki.frame(()=>c(null,_))}const f=this.pendingRequests.get(h);f?f.push(c):(this.pendingRequests.set(h,[c]),Si.loadGlyphRange(e,i,o,a,(_,y)=>{_||this.cachedRanges.set(h,y||null);const v=this.pendingRequests.get(h);if(this.pendingRequests.delete(h),v)for(const b of v)b(_,y)}))}_composeGlyphs(e){const i={};let o,a;for(const c of e)if(o===void 0&&c.ascender!==void 0&&(o=c.ascender),a===void 0&&c.descender!==void 0&&(a=c.descender),c.glyphs)for(const h in c.glyphs)i[h]===void 0&&(i[h]=c.glyphs[h]);return{glyphs:i,ascender:o,descender:a}}}Si.loadGlyphRange=async function(r,e,i,o,a){const c=256*e,h=c+255;let f;try{const _=await o.transformRequest(o.normalizeGlyphsURL(i).replace("{fontstack}",r).replace("{range}",`${c}-${h}`),va.Glyphs),{data:y}=await xl(_),v={},b=(function(T){return(function(S){const C={glyphs:[]};let P;for(;P=S.nextField();)P===1&&M(S,S.readVarint()+S.pos,C);return C})(new t(T))})(y);for(const T of b.glyphs)v[T.id]=T;f={glyphs:v,ascender:b.ascender,descender:b.descender}}catch(_){return a(_)}a(null,f)};const Mt=1e20,Lt=new Float64Array(256);for(let r=0;r<256;r++){const e=.5-Math.pow(r/255,.45454545454545453);Lt[r]=e*Math.abs(e)}function Tt(r,e,i,o,a,c,h,f,_){for(let y=e;y<e+o;y++)li(r,i*c+y,c,a,h,f,_);for(let y=i;y<i+a;y++)li(r,y*c+e,1,o,h,f,_)}function li(r,e,i,o,a,c,h){c[0]=0,h[0]=-Mt,h[1]=Mt,a[0]=r[e];for(let f=1,_=0,y=0;f<o;f++){a[f]=r[e+f*i];const v=f*f;do{const b=c[_];y=(a[f]-a[b]+v-b*b)/(f-b)/2}while(y<=h[_]&&--_>-1);_++,c[_]=f,h[_]=y,h[_+1]=Mt}for(let f=0,_=0;f<o;f++){for(;h[_+1]<f;)_++;const y=c[_],v=f-y;r[e+f*i]=a[y]+v*v}}Lt[255]=-Mt;const ci=/bold/i,$i=/medium/i,Ui=/light/i,cr={none:0,ideographs:1,all:2};class pr{constructor(e,i,o,a){this.requestManager=e,this.localGlyphMode=i,this.localFontFamily=o,this.url="",this.entries={},this.localGlyphs={200:{},400:{},500:{},900:{}},this.glyphLoader=new Si({fontstackCompositing:a})}setURL(e){this.url=e}prefetchRange(e,i){const o=this.url||ii.GLYPHS_URL;if(!o)return;let a=this.entries[e];a||(a=this.entries[e]={glyphs:{},requests:{},ranges:{}}),a.ranges[i]||a.requests[i]||(a.requests[i]=[],this.glyphLoader.loadGlyphRange(e,i,o,this.requestManager,(c,h)=>{if(h){a.ascender=h.ascender,a.descender=h.descender;for(const f in h.glyphs)this._doesCharSupportLocalGlyph(+f)||(a.glyphs[+f]=h.glyphs[+f]);a.ranges[i]=!0}for(const f of a.requests[i]||[])f(c,h);delete a.requests[i]}))}getGlyphs(e,i){const o=[],a=this.url||ii.GLYPHS_URL;for(const c in e)for(const h of e[c])o.push({stack:c,id:h});ye(o,({stack:c,id:h},f)=>{let _=this.entries[c];_||(_=this.entries[c]={glyphs:{},requests:{},ranges:{},ascender:void 0,descender:void 0});let y=_.glyphs[h];if(y!==void 0)return void f(null,{stack:c,id:h,glyph:y});if(y=this._tinySDF(_,c,h),y)return _.glyphs[h]=y,void f(null,{stack:c,id:h,glyph:y});const v=Math.floor(h/256);if(256*v>65535)return ht("glyphs > 65535 not supported"),void f(null,{stack:c,id:h,glyph:y});if(_.ranges[v])return void f(null,{stack:c,id:h,glyph:y});let b=_.requests[v];b||(b=_.requests[v]=[],this.glyphLoader.loadGlyphRange(c,v,a,this.requestManager,(T,S)=>{if(S){_.ascender=S.ascender,_.descender=S.descender;for(const C in S.glyphs)this._doesCharSupportLocalGlyph(+C)||(_.glyphs[+C]=S.glyphs[+C]);_.ranges[v]=!0}for(const C of b)C(T,S);delete _.requests[v]})),b.push((T,S)=>{T?f(T):S&&f(null,{stack:c,id:h,glyph:S.glyphs[h]||null})})},(c,h)=>{if(c)i(c);else if(h){const f={};for(const{stack:_,id:y,glyph:v}of h)f[_]===void 0&&(f[_]={}),f[_].glyphs===void 0&&(f[_].glyphs={}),f[_].glyphs[y]=v&&{id:v.id,bitmap:v.bitmap.clone(),metrics:v.metrics},f[_].ascender=this.entries[_].ascender,f[_].descender=this.entries[_].descender;i(null,f)}})}_doesCharSupportLocalGlyph(e){return this.localGlyphMode!==cr.none&&(this.localGlyphMode===cr.all?!!this.localFontFamily:!!this.localFontFamily&&(Qd(e)||tf(e)||Bl(e)||Dc(e)||Ol(e)||ah(e)||(i=e)>=131072&&i<=173791||(o=>o>=66736&&o<=66815)(e)));var i}_tinySDF(e,i,o){const a=this.localFontFamily;if(!a||!this._doesCharSupportLocalGlyph(o))return;let c=e.tinySDF;if(!c){let R="400";ci.test(i)?R="900":$i.test(i)?R="500":Ui.test(i)&&(R="200"),c=e.tinySDF=new pr.TinySDF({fontFamily:a,fontWeight:R,fontSize:48,buffer:6,radius:16}),c.fontWeight=R}const h=c.fontWeight;if(this.localGlyphs[h][o])return this.localGlyphs[h][o];const f=String.fromCodePoint(o),{data:_,width:y,height:v,glyphWidth:b,glyphHeight:T,glyphLeft:S,glyphTop:C,glyphAdvance:P}=c.draw(f);return this.localGlyphs[h][o]={id:o,bitmap:new na({width:y,height:v},_),metrics:{width:b/2,height:T/2,left:S/2,top:C/2-27,advance:P/2,localGlyph:!0}}}}function Br(r,e){return r+e[1]-e[0]}function Qr(r,e,i,o,a=1){const c=[],h=r.imagePrimary,f=h.pixelRatio,_=h.paddedRect.w-2,y=h.paddedRect.h-2,v=(r.right-r.left)*a,b=(r.bottom-r.top)*a,T=h.stretchX||[[0,_]],S=h.stretchY||[[0,y]],C=T.reduce(Br,0),P=S.reduce(Br,0),R=_-C,L=y-P;let V=0,B=C,G=0,H=P,Z=0,oe=R,X=0,ee=L;if(h.content&&o){const ne=h.content;V=Ti(T,0,ne[0]),G=Ti(S,0,ne[1]),B=Ti(T,ne[0],ne[2]),H=Ti(S,ne[1],ne[3]),Z=ne[0]-V,X=ne[1]-G,oe=ne[2]-ne[0]-B,ee=ne[3]-ne[1]-H}const ie=(ne,fe,ge,we)=>{const Se=Fi(ne.stretch-V,B,v,r.left*a),Ee=ri(ne.fixed-Z,oe,ne.stretch,C),Ve=Fi(fe.stretch-G,H,b,r.top*a),Ie=ri(fe.fixed-X,ee,fe.stretch,P),Te=Fi(ge.stretch-V,B,v,r.left*a),Ce=ri(ge.fixed-Z,oe,ge.stretch,C),ze=Fi(we.stretch-G,H,b,r.top*a),Fe=ri(we.fixed-X,ee,we.stretch,P),Be=new Ne(Se,Ve),De=new Ne(Te,Ve),Ge=new Ne(Te,ze),Ze=new Ne(Se,ze),Qe=new Ne(Ee/f,Ie/f),Xe=new Ne(Ce/f,Fe/f),rt=e*Math.PI/180;if(rt){const ut=Math.sin(rt),Gt=Math.cos(rt),Nt=[Gt,-ut,ut,Gt];Be._matMult(Nt),De._matMult(Nt),Ze._matMult(Nt),Ge._matMult(Nt)}const vt=ne.stretch+ne.fixed,ft=ge.stretch+ge.fixed,xt=fe.stretch+fe.fixed,mt=we.stretch+we.fixed,Rt=r.imageSecondary;return{tl:Be,tr:De,bl:Ze,br:Ge,texPrimary:{x:h.paddedRect.x+1+vt,y:h.paddedRect.y+1+xt,w:ft-vt,h:mt-xt},texSecondary:Rt?{x:Rt.paddedRect.x+1+vt,y:Rt.paddedRect.y+1+xt,w:ft-vt,h:mt-xt}:void 0,writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Qe,pixelOffsetBR:Xe,minFontScaleX:oe/f/v,minFontScaleY:ee/f/b,isSDF:i}};if(h.stretchX||h.stretchY){const ne=Ii(T,R,C),fe=Ii(S,L,P);for(let ge=0;ge<ne.length-1;ge++){const we=ne[ge],Se=ne[ge+1];for(let Ee=0;Ee<fe.length-1;Ee++)c.push(ie(we,fe[Ee],Se,fe[Ee+1]))}}else c.push(ie({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:_+1},{fixed:0,stretch:y+1}));return c}function Ut(r,e){const i=r.stretchY||[[0,r.paddedRect.h-2]];return r.stretchX||r.stretchY?Ei(r.stretchX||[[0,r.paddedRect.w-2]])*Ei(i):1}function Ti(r,e,i){let o=0;for(const a of r)o+=Math.max(e,Math.min(i,a[1]))-Math.max(e,Math.min(i,a[0]));return o}function Ii(r,e,i){const o=[{fixed:-1,stretch:0}];for(const[a,c]of r){const h=o.at(-1);o.push({fixed:a-h.stretch,stretch:h.stretch}),o.push({fixed:a-h.stretch,stretch:h.stretch+(c-a)})}return o.push({fixed:e+1,stretch:i}),o}function Ei(r){return 2*r.length+1}function Fi(r,e,i,o){return r/e*i+o}function ri(r,e,i,o){return r-e*i/o}function pi(r,e,i,o){const a=e+r.positionedLines[o].lineOffset;return o===0?i+a/2:i+(a+(e+r.positionedLines[o-1].lineOffset))/2}function Bt(r,e,i,o,a,c,h,f,_,y=1){const v=[];if(e.positionedLines.length===0)return v;const b=(_!==void 0?_:o.layout.get("text-rotate").evaluate(c,{}))*Math.PI/180,T=(function(L){const V=L[0],B=L[1],G=V*B;return G>0?[V,-B]:G<0?[-V,B]:V===0?[B,V]:[B,-V]})(i);let S=Math.abs(e.top-e.bottom);for(const L of e.positionedLines)S-=L.lineOffset;const C=e.positionedLines.length,P=S/C;let R=e.top-i[1];for(let L=0;L<C;++L){const V=e.positionedLines[L];R=pi(e,P,R,L);for(const B of V.positionedGlyphs){if(!B.rect)continue;const G=B.rect||{};let H=4,Z=!0,oe=1,X=0;if(B.image){const Ge=h.get(B.image.toString());if(!Ge)continue;if(Ge.sdf){ht("SDF images are not supported in formatted text and will be ignored.");continue}Z=!1,oe=Ge.pixelRatio,H=1/oe,Ge.usvg||(oe/=y)}const ee=(a||f)&&B.vertical,ie=B.metrics.advance*B.scale/2,ne=B.metrics,fe=B.rect;if(fe===null)continue;f&&e.verticalizable&&(X=B.image?ie-B.metrics.width*B.scale/2:0);const ge=a?[B.x+ie,B.y]:[0,0];let we=[0,0],Se=[0,0],Ee=!1;a||(ee?(Se=[B.x+ie+T[0],B.y+T[1]-X],Ee=!0):we=[B.x+ie+i[0],B.y+i[1]-X]);const Ve=fe.w*B.scale/(oe*(B.localGlyph?2:1)),Ie=fe.h*B.scale/(oe*(B.localGlyph?2:1));let Te,Ce,ze,Fe;if(ee){const Ge=B.y-R,Ze=new Ne(-ie,ie-Ge),Qe=-Math.PI/2,Xe=new Ne(...Se);Te=new Ne(-ie+we[0],we[1]),Te._rotateAround(Qe,Ze)._add(Xe),Te.x+=-Ge+ie,Te.y-=(ne.left-H)*B.scale;const rt=B.image?ne.advance*B.scale:fr*B.scale,vt=String.fromCodePoint(B.glyph);v_(vt)?Te.x+=(1-H)*B.scale:op(vt)?Te.x+=rt-ne.height*B.scale+(-H-1)*B.scale:Te.x+=B.image||ne.width+2*H===fe.w&&ne.height+2*H===fe.h?(rt-Ie)/2:(rt-(ne.height+2*H)*B.scale)/2,Ce=new Ne(Te.x,Te.y-Ve),ze=new Ne(Te.x+Ie,Te.y),Fe=new Ne(Te.x+Ie,Te.y-Ve)}else{const Ge=(ne.left-H)*B.scale-ie+we[0],Ze=(-ne.top-H)*B.scale+we[1],Qe=Ge+Ve,Xe=Ze+Ie;Te=new Ne(Ge,Ze),Ce=new Ne(Qe,Ze),ze=new Ne(Ge,Xe),Fe=new Ne(Qe,Xe)}if(b){let Ge;Ge=a?new Ne(0,0):Ee?new Ne(T[0],T[1]):new Ne(i[0],i[1]),Te._rotateAround(b,Ge),Ce._rotateAround(b,Ge),ze._rotateAround(b,Ge),Fe._rotateAround(b,Ge)}const Be=new Ne(0,0),De=new Ne(0,0);v.push({tl:Te,tr:Ce,bl:ze,br:Fe,texPrimary:G,texSecondary:void 0,writingMode:e.writingMode,glyphOffset:ge,sectionIndex:B.sectionIndex,isSDF:Z,pixelOffsetTL:Be,pixelOffsetBR:De,minFontScaleX:0,minFontScaleY:0})}}return v}function Oi(r,e=1,i=!1){let o=1/0,a=1/0,c=-1/0,h=-1/0;const f=r[0];for(let S=0;S<f.length;S++){const C=f[S];(!S||C.x<o)&&(o=C.x),(!S||C.y<a)&&(a=C.y),(!S||C.x>c)&&(c=C.x),(!S||C.y>h)&&(h=C.y)}const _=Math.min(c-o,h-a);let y=_/2;const v=new gc([],Rr);if(_===0)return new Ne(o,a);for(let S=o;S<c;S+=_)for(let C=a;C<h;C+=_)v.push(new ui(S+y,C+y,y,r));let b=(function(S){let C=0,P=0,R=0;const L=S[0];for(let V=0,B=L.length,G=B-1;V<B;G=V++){const H=L[V],Z=L[G],oe=H.x*Z.y-Z.x*H.y;P+=(H.x+Z.x)*oe,R+=(H.y+Z.y)*oe,C+=3*oe}return new ui(P/C,R/C,0,S)})(r),T=v.length;for(;v.length;){const S=v.pop();(S.d>b.d||!b.d)&&(b=S,i&&console.log("found best %d after %d probes",Math.round(1e4*S.d)/1e4,T)),S.max-b.d<=e||(y=S.h/2,v.push(new ui(S.p.x-y,S.p.y-y,y,r)),v.push(new ui(S.p.x+y,S.p.y-y,y,r)),v.push(new ui(S.p.x-y,S.p.y+y,y,r)),v.push(new ui(S.p.x+y,S.p.y+y,y,r)),T+=4)}return i&&(console.log(`num probes: ${T}`),console.log(`best distance: ${b.d}`)),b.p}function Rr(r,e){return e.max-r.max}pr.TinySDF=class{constructor({fontSize:r=24,buffer:e=3,radius:i=8,cutoff:o=.25,fontFamily:a="sans-serif",fontWeight:c="normal",fontStyle:h="normal",lang:f=null}={}){this.buffer=e,this.radius=i,this.cutoff=o,this.lang=f;const _=this.size=r+4*e,y=this._createCanvas(_),v=this.ctx=y.getContext("2d",{willReadFrequently:!0});v.font=`${h} ${c} ${r}px ${a}`,v.textBaseline="alphabetic",v.textAlign="left",v.fillStyle="black",this.gridOuter=new Float64Array(_*_),this.gridInner=new Float64Array(_*_),this.f=new Float64Array(_),this.z=new Float64Array(_+1),this.v=new Uint16Array(_)}_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:o,actualBoundingBoxLeft:a,actualBoundingBoxRight:c}=this.ctx.measureText(r),h=Math.ceil(i),f=Math.floor(-a),_=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(c)-f)),y=Math.max(0,Math.min(this.size-this.buffer,h+Math.ceil(o))),v=_+2*this.buffer,b=y+2*this.buffer,T=Math.max(v*b,0),S=new Uint8ClampedArray(T),C={data:S,width:v,height:b,glyphWidth:_,glyphHeight:y,glyphTop:h,glyphLeft:f,glyphAdvance:e};if(_===0||y===0)return C;const{ctx:P,buffer:R,gridInner:L,gridOuter:V}=this;this.lang&&(P.lang=this.lang),P.clearRect(R,R,_,y),P.fillText(r,R-f,R+h);const B=P.getImageData(R,R,_,y);V.fill(Mt,0,T),L.fill(0,0,T);let G=3;for(let X=0;X<y;X++){let ee=(X+R)*v+R;for(let ie=0;ie<_;ie++,G+=4,ee++){const ne=B.data[G];if(ne===0)continue;const fe=Lt[ne];V[ee]=Math.max(0,fe),L[ee]=Math.max(0,-fe)}}Tt(V,0,0,v,b,v,this.f,this.v,this.z);const H=Math.min(R,1);Tt(L,R-H,R-H,_+2*H,y+2*H,v,this.f,this.v,this.z);const Z=255/this.radius,oe=255*(1-this.cutoff);for(let X=0;X<T;X++){const ee=Math.sqrt(V[X])-Math.sqrt(L[X]);S[X]=Math.round(oe-Z*ee)}return C}};class ui{constructor(e,i,o,a){this.p=new Ne(e,i),this.h=o,this.d=(function(c,h){let f=!1,_=1/0;for(let y=0;y<h.length;y++){const v=h[y];for(let b=0,T=v.length,S=T-1;b<T;S=b++){const C=v[b],P=v[S];C.y>c.y!=P.y>c.y&&c.x<(P.x-C.x)*(c.y-C.y)/(P.y-C.y)+C.x&&(f=!f),_=Math.min(_,kh(c,C,P))}}return(f?1:-1)*Math.sqrt(_)})(this.p,a),this.max=this.d+this.h*Math.SQRT2}}const Fr=Object.keys,go=Number.POSITIVE_INFINITY,Ln=Math.sqrt(2);function hn(r,e,i,o,a,c){const h=he(r)&&r.collisionPadding?r.collisionPadding:[0,0,0,0],f={top:r.top-h[1],bottom:r.bottom+h[3],left:r.left-h[0],right:r.right+h[2],scaled:!1};return o!==void 0&&(function(_,y){_.top*=y,_.bottom*=y,_.left*=y,_.right*=y,_.scaled=!0})(f,o),c&&(f.left+=c[0],f.right+=c[0],f.top+=c[1],f.bottom+=c[1]),i&&(function(_,y,v){if(!y)return;const b=jt(y),T=new Ne(v?v[0]:0,v?v[1]:0),S=new Ne(_.left,_.top),C=new Ne(_.right,_.top),P=new Ne(_.left,_.bottom),R=new Ne(_.right,_.bottom);
7S._rotateAround(b,T),C._rotateAround(b,T),P._rotateAround(b,T),R._rotateAround(b,T),_.left=Math.min(S.x,C.x,P.x,R.x),_.right=Math.max(S.x,C.x,P.x,R.x),_.top=Math.min(S.y,C.y,P.y,R.y),_.bottom=Math.max(S.y,C.y,P.y,R.y)})(f,i,a),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 Zn(r,[e,i]){let o=0,a=0;if(i===go){e<0&&(e=0);const c=e/Ln;switch(r){case"top-right":case"top-left":a=c-7;break;case"bottom-right":case"bottom-left":a=7-c;break;case"bottom":a=7-e;break;case"top":a=e-7}switch(r){case"top-right":case"bottom-right":o=-c;break;case"top-left":case"bottom-left":o=c;break;case"left":o=e;break;case"right":o=-e}}else{switch(e=Math.abs(e),i=Math.abs(i),r){case"top-right":case"top-left":case"top":a=i-7;break;case"bottom-right":case"bottom-left":case"bottom":a=7-i}switch(r){case"top-right":case"bottom-right":case"right":o=-e;break;case"top-left":case"bottom-left":case"left":o=e}}return[o,a]}function Wn(r,e,i,o,a,c,h,f,_,y,v,b,T,S,C){const P=r.layers[0],R=P.appearances;if(R.length===0)return{iconBBox:null,iconVerticalBBox:null,textBBox:null,textVerticalBBox:null};const L={iconBBox:null,iconVerticalBBox:null},V={textBBox:null,textVerticalBBox:null},{baseIconRotate:B,baseTextRotate:G,iconScaleFactor:H}=(function(oe,X,ee){const ie=oe.get("icon-rotate").evaluate(X,{},ee),ne=oe.get("text-rotate").evaluate(X,{},ee),[fe,ge]=oe.get("icon-size-scale-range");return{baseIconRotate:ie,baseTextRotate:ne,iconScaleFactor:te(1,fe,ge)}})(o,a,c);e&&(L.iconBBox=hn(e,L.iconBBox,B),i)&&(L.iconVerticalBBox=hn(i,L.iconVerticalBBox,B+90));const Z=b_(b.horizontal);Z&&(V.textBBox=hn(Z,V.textBBox,G,1,S)),b.vertical&&(V.textVerticalBBox=hn(b.vertical,V.textVerticalBBox,G+90,1,S));for(const oe of R)oe.hasIconLayoutProperties()&&yo(L,r,P,oe,a,c,f,B,h,_,e,y,H,v,C),oe.hasTextLayoutProperties()&&zo(V,P,oe,a,c,S,G,T,Z,b.vertical);return{iconBBox:L.iconBBox,iconVerticalBBox:L.iconVerticalBBox,textBBox:V.textBBox,textVerticalBBox:V.textVerticalBBox}}function yo(r,e,i,o,a,c,h,f,_,y,v,b,T,S,C){const{appearanceIconOffset:P,appearanceIconRotate:R,appearanceIconSize:L}=bn(o,i,a,c,h,f,_,y.iconScaleFactor);let V=null,B=null,G=null;o.hasLayoutProperty("icon-image")?G=(function(Z,oe,X,ee,ie,ne,fe,ge){let we=null;const Se=oe.getAppearanceValueAndResolveTokens(X,"icon-image",ee,ie,ge);if(Se){const Ee=Z.getResolvedImageFromTokens(Se),Ve=X.hasLayoutProperty("icon-size")?X.getUnevaluatedLayoutProperty("icon-size"):oe._unevaluatedLayout._values["icon-size"],Ie=su(Ee,Re(Z.zoom,Ve,Z.worldview,ge),Ve,ie,Z.zoom,ee,Z.pixelRatio,fe,Z.worldview,ge);we=ne.get(Ie.iconPrimary.toString())}return we})(e,i,o,a,c,b,T,C):v&&(G=v.imagePrimary),G&&(V=ve(G,null,P,S),e.allowVerticalPlacement&&(B=ve(G,null,P,S)));const H=_>0?L/_:1;V&&(r.iconBBox=hn(V,r.iconBBox,R,H!==1?H:void 0)),B&&(r.iconVerticalBBox=hn(B,r.iconVerticalBBox,R+90,H!==1?H:void 0))}function bn(r,e,i,o,a,c,h,f){const _=r.hasLayoutProperty("icon-offset")?e.getAppearanceValueAndResolveTokens(r,"icon-offset",i,o,[]):null,y=_&&Array.isArray(_)?_:a,v=r.hasLayoutProperty("icon-rotate")?e.getAppearanceValueAndResolveTokens(r,"icon-rotate",i,o,[]):null,b=typeof v=="number"?v:c,T=r.hasLayoutProperty("icon-size")?e.getAppearanceValueAndResolveTokens(r,"icon-size",i,o,[]):null;return{appearanceIconOffset:y,appearanceIconRotate:b,appearanceIconSize:typeof T=="number"?T*f:h}}function zo(r,e,i,o,a,c,h,f,_,y){const{appearanceTextOffset:v,appearanceTextRotate:b,appearanceTextSize:T}=Qo(i,e,o,a,c,h,f),S=T/f,C=[(v[0]-c[0])*S,(v[1]-c[1])*S],P=C[0]!==0||C[1]!==0;_&&(r.textBBox=hn(_,r.textBBox,b,S,v,P?C:void 0)),y&&(r.textVerticalBBox=hn(y,r.textVerticalBBox,b+90,S,v,P?C:void 0))}function Qo(r,e,i,o,a,c,h){const f=r.hasLayoutProperty("text-offset")?e.getAppearanceValueAndResolveTokens(r,"text-offset",i,o,[]):null,_=f&&Array.isArray(f)?[f[0]*fr,f[1]*fr]:a,y=r.hasLayoutProperty("text-rotate")?e.getAppearanceValueAndResolveTokens(r,"text-rotate",i,o,[]):null,v=typeof y=="number"?y:c,b=r.hasLayoutProperty("text-size")?e.getAppearanceValueAndResolveTokens(r,"text-size",i,o,[]):null;return{appearanceTextOffset:_,appearanceTextRotate:v,appearanceTextSize:typeof b=="number"?b:h}}function sa(r,e,i,o,a,c,h,f,_){if(!e||!e.usvg)return;const y=Pe(o),v=Pe(a),b=c!=="both"&&c!=="width"||!Le(o)?1:v.width/y.width,T=c!=="both"&&c!=="height"||!_e(o)?1:v.height/y.height;i.scaleSelf(b,T);const S=i.toString();h.set(S,i),f.set(S,e);const{imagePosition:C}=ei(S,e,1);_.set(S,C)}function sp(r,e,i,o,a,c,h,f,_,y){if(!r)return;const v=(function(b,T,S,C,P,R,L){if(b.kind==="camera")return b.maxSize;if(b.kind==="composite"){const V=T.possiblyEvaluate(new oi(b.maxZoom,{worldview:R}),S,L).evaluate(P,{},S,L),B=T.possiblyEvaluate(new oi(b.minZoom,{worldview:R}),S,L).evaluate(P,{},S,L);return Math.max(V,B)}return T.possiblyEvaluate(new oi(C,{worldview:R}),S,L).evaluate(P,{},S,L)})(e,i,o,a,c,_,y);return r.scaleSelf(v*f*h)}function su(r,e,i,o,a,c,h,f,_,y){return{iconPrimary:sp(r.getPrimary(),e,i,o,a,c,h,f,_,y),iconSecondary:sp(r.getSecondary(),e,i,o,a,c,h,f,_,y)}}function Q1(r,e,i){if(!e)return;const o=i.get(r.toString()),a=i.get(e.toString());o&&a&&(o.paddedRect.w===a.paddedRect.w&&o.paddedRect.h===a.paddedRect.h||ht(`Mismatch in icon variant sizes: ${r.toString()} and ${e.toString()}`),o.usvg!==a.usvg&&ht(`Mismatch in icon variant image types: ${r.id} and ${e.id}`))}function Rx(r,e,i,o){if(!r)return;const a=e.get(i.toString());if(a&&(r.imagePrimary=a),o){const c=e.get(o.toString());r.imageSecondary=c}}function eb(r,e){for(const i in r.horizontal)Dx(r.horizontal[i],e);Dx(r.vertical,e)}function Dx(r,e){if(r){for(const i of r.positionedLines)for(const o of i.positionedGlyphs)if(o.image!==null){const a=o.image.toString();o.rect=e.get(a).paddedRect}}}function vy(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 tb(r,e,i,o,a,c,h,f,_){const y=b_(c.horizontal)||c.vertical,v=i.get("icon-text-fit-padding").evaluate(o,{},a);let b,T=e;return e&&_!=="none"&&(r.allowVerticalPlacement&&c.vertical&&(b=xe(e,c.vertical,_,v,f,h)),y&&(T=xe(e,y,_,v,f,h))),{defaultShapedIcon:T,verticallyShapedIcon:b}}function zx(r,e){return r*e/24}function ib(r,e,i,o,a,c,h,f,_,y,v,b,T,S,C,P,R,L,V,B,G,H,Z,oe,X,ee,ie,ne){let fe=h.textMaxSize.evaluate(e,{},T);fe===void 0?fe=f*h.textScaleFactor:fe*=h.textScaleFactor;const ge=r.layers[0].layout,we=zx(f,h.textScaleFactor),Se=b_(i.horizontal)||i.vertical,Ee=r.hasAnyAppearanceLayoutProperty(["text-size","text-offset","text-rotate"]),Ve=r.getAppearanceFeatureData(e.index);(R!=="none"||Ee)&&Ve&&(Ve.textShaping=Se,Ve.iconTextFitPadding=ge.get("icon-text-fit-padding").evaluate(e,{},T),Ve.fontScale=we,Ve.textScaleFactor=h.textScaleFactor);const Ie=S.name==="globe",Te=r.tilePixelRatio*fe/24,Ce=(Ze=r.overscaling,r.zoom>18&&Ze>2&&(Ze>>=1),Math.max(Ke/(512*Ze),1)*ge.get("symbol-spacing")),ze=ge.get("text-padding")*r.tilePixelRatio,Fe=ge.get("icon-padding")*r.tilePixelRatio,Be=jt(ge.get("text-max-angle")),De=ge.get("icon-rotation-alignment")==="map"&&B!=="point",Ge=Ce/2;var Ze;r.hasAnyIconTextFit===!1&&R!=="none"&&(r.hasAnyIconTextFit=!0);const Qe=e.properties?+e.properties[$n]:null,Xe=r.hdExt?r.hdExt.elevationFeatureIdToIndex:void 0,rt=Qe&&Xe?Xe.get(Qe):65535,vt=(ft,xt,mt)=>{if(xt.x<0||xt.x>=Ke||xt.y<0||xt.y>=Ke||ee&&ee.length>0&&e.properties&&ne&&ne(ee,e.properties,xt,T,ie))return;let Rt=null;if(Ie){const{x:ut,y:Gt,z:Nt}=S.projectTilePoint(xt.x,xt.y,mt);Rt={anchor:new We(ut,Gt,Nt,0,void 0),up:S.upVector(mt,xt.x,xt.y)}}(function(ut,Gt,Nt,Wt,qt,Pi,Dr,ai,hi,Ji,vr,Vi,It,zr,br,wr,Wi,Qi,mr,ji,yi,Lr,pu,Ir,Kn,oc,Dp,yg,el,tl,xg,ed){const Pt=ut.addToLineVertexArray(Gt,Wt);let ur,Bi,nr,Jn,Qn,xo,vo,vg=0,bg=0,td=0,zp=0,id=-1,_r=-1;const er={};let Ar=Iu("");const fn=Nt?Nt.anchor:Gt,en=yg!=="none";let ua=0,Rs=0;if(hi._unevaluatedLayout.getValue("text-radial-offset")===void 0){const On=hi.layout.get("text-offset").evaluate(yi,{},Kn);ua=On[0]*fr,Rs=On[1]*fr}else ua=hi.layout.get("text-radial-offset").evaluate(yi,{},Kn)*fr,Rs=go;if(ut.allowVerticalPlacement&&qt.vertical){const On=qt.vertical;if(br)xo=Ty(On),ai&&(vo=Ty(ai));else{const Bo=hi.layout.get("text-rotate").evaluate(yi,{},Kn)+90;nr=w_(Ji,fn,Gt,vr,Vi,It,On,zr,Bo,wr,ed),ai&&(Jn=w_(Ji,fn,Gt,vr,Vi,It,ai,Qi,Bo,null,xg))}}if(Pi){const On=hi.layout.get("icon-rotate").evaluate(yi,{},Kn),Bo=Qr(Pi,On,pu,en,Lr.iconScaleFactor),ko=ai?Qr(ai,On,pu,en,Lr.iconScaleFactor):void 0;Bi=w_(Ji,fn,Gt,vr,Vi,It,Pi,Qi,On,null,tl);const Ds=(function(mu,MT,j1,PT,RT,G1,q1,DT,jT,Cx){const H1=mu.layers[0],$1=H1.appearances;let nd=MT.length;if(j1&&(nd=Math.max(nd,j1.length)),$1.length===0)return nd;const[zT,LT]=PT.get("icon-size-scale-range"),FT=te(1,zT,LT);for(const Tg of $1)if(Tg.hasLayoutProperty("icon-image")){const Z1=H1.getAppearanceValueAndResolveTokens(Tg,"icon-image",G1,q1,Cx);if(Z1){const W1=mu.getResolvedImageFromTokens(Z1);if(W1){const X1=Tg.hasLayoutProperty("icon-size")?Tg.getUnevaluatedLayoutProperty("icon-size"):RT._values["icon-size"],OT=su(W1,Re(mu.zoom,X1,mu.worldview,Cx),X1,q1,mu.zoom,G1,mu.pixelRatio,FT,mu.worldview,Cx),Y1=DT.get(OT.iconPrimary.toString());
7Y1&&(nd=Math.max(nd,Ut(Y1)))}}}return nd})(ut,Bo,ko,hi.layout,hi._unevaluatedLayout,yi,Kn,ut.iconAtlasPositions,0,Ir);vg=4*Ds;const Lp=hi.layout.get("icon-size").evaluate(yi,{},Kn,Ir),AT=Lr.compositeIconSizes?Lr.compositeIconSizes[0].evaluate(yi,{},Kn,Ir):0,CT=Lr.compositeIconSizes?Lr.compositeIconSizes[1].evaluate(yi,{},Kn,Ir):0,U1=wy(ut.layerIds[0],ut.iconSizeData,Lp,Pi.imagePrimary.usvg?1:Lr.iconScaleFactor,AT,CT);ut.addSymbols(ut.icon,Bo,U1,ji,mr,yi,void 0,Nt,Gt,Pt.lineStartIndex,Pt.lineLength,-1,Ir,Kn,oc,Dp,ut.symbolInstances.length,Ds),id=ut.icon.placedSymbolArray.length-1,ko&&(bg=4*Ds,ut.addSymbols(ut.icon,ko,U1,ji,mr,yi,z.vertical,Nt,Gt,Pt.lineStartIndex,Pt.lineLength,-1,Ir,Kn,oc,Dp,ut.symbolInstances.length,Ds),_r=ut.icon.placedSymbolArray.length-1)}for(const On in qt.horizontal){const Bo=On,ko=qt.horizontal[Bo];ur||(Ar=Iu(ko.text),br?Qn=Ty(ko):ur=w_(Ji,fn,Gt,vr,Vi,It,ko,zr,hi.layout.get("text-rotate").evaluate(yi,{},Kn),wr,ed));const Ds=ko.positionedLines.length===1;if(td+=Lx(ut,Nt,Gt,ko,Dr,hi,br,yi,wr,Pt,qt.vertical?z.horizontal:z.horizontalOnly,Ds?Fr(qt.horizontal):[Bo],er,id,Lr,Ir,Kn,ut.symbolInstances.length,oc),Ds)break}qt.vertical&&(zp+=Lx(ut,Nt,Gt,qt.vertical,Dr,hi,br,yi,wr,Pt,z.vertical,["vertical"],er,_r,Lr,Ir,Kn,ut.symbolInstances.length,oc));let Oo=-1;const rd=(On,Bo)=>On?Math.max(On,Bo):Bo;Oo=rd(Qn,Oo),Oo=rd(xo,Oo),Oo=rd(vo,Oo);const wg=Oo>-1?1:0;ut.glyphOffsetArray.length>=65535&&ht("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),yi.sortKey!==void 0&&ut.addToSortKeyRanges(ut.symbolInstances.length,yi.sortKey),ut.symbolInstances.emplaceBack(Gt.x,Gt.y,fn.x,fn.y,fn.z,er.right>=0?er.right:-1,er.center>=0?er.center:-1,er.left>=0?er.left:-1,er.vertical>=0?er.vertical:-1,id,_r,Ar,ur!==void 0?ur:ut.collisionBoxArray.length,ur!==void 0?ur+1:ut.collisionBoxArray.length,nr!==void 0?nr:ut.collisionBoxArray.length,nr!==void 0?nr+1:ut.collisionBoxArray.length,Bi!==void 0?Bi:ut.collisionBoxArray.length,Bi!==void 0?Bi+1:ut.collisionBoxArray.length,Jn||ut.collisionBoxArray.length,Jn?Jn+1:ut.collisionBoxArray.length,vr,td,zp,vg,bg,wg,0,ua,Rs,Oo,0,en?1:0,el)})(r,xt,Rt,ft,i,o,c,a,r.layers[0],r.collisionBoxArray,e.index,e.sourceLayerIndex,r.index,ze,V,y,0,Fe,De,L,e,h,v,b,T,C,P,R,rt,G,H,Z)};if(B==="line")for(const ft of ru(e.geometry,0,0,Ke,Ke)){const xt=it(ft,Ce,Be,i.vertical||Se,o,24,Te,r.overscaling,Ke);for(const mt of xt)Se&&rb(r,Se.text,Ge,mt)||vt(ft,mt,T)}else if(B==="line-center"){for(const ft of e.geometry)if(ft.length>1){const xt=tt(ft,Be,i.vertical||Se,o,24,Te);xt&&vt(ft,xt,T)}}else if(e.type==="Polygon")for(const ft of as(e.geometry,0)){const xt=Oi(ft,16);vt(ft[0],new We(xt.x,xt.y,0,0,void 0),T)}else if(e.type==="LineString")for(const ft of e.geometry)vt(ft,new We(ft[0].x,ft[0].y,0,0,void 0),T);else if(e.type==="Point")for(const ft of e.geometry)for(const xt of ft)vt([xt],new We(xt.x,xt.y,0,0,void 0),T)}const by=255,au=by*me;function Lx(r,e,i,o,a,c,h,f,_,y,v,b,T,S,C,P,R,L,V){const B=Bt(0,o,_,c,h,f,a,r.allowVerticalPlacement,void 0,C.textScaleFactor),G=c.layout.get("text-size").evaluate(f,{},R),H=C.compositeTextSizes?C.compositeTextSizes[0].evaluate(f,{},R):0,Z=C.compositeTextSizes?C.compositeTextSizes[1].evaluate(f,{},R):0,oe=wy(r.layerIds[0],r.textSizeData,G,C.textScaleFactor,H,Z);r.addSymbols(r.text,B,oe,_,h,f,v,e,i,y.lineStartIndex,y.lineLength,S,P,R,V,!1,L,B.length);for(const X of b)T[X]=r.text.placedSymbolArray.length-1;return 4*B.length}function wy(r,e,i,o,a,c){const h=e;let f=null;return h.kind==="source"?(f=[me*i*o],f[0]>au&&ht(`${r}: Value for "text-size" or "icon-size" is >= ${by}. Reduce your "text-size" or "icon-size".`)):h.kind==="composite"&&(f=[me*a*o,me*c*o],(f[0]>au||f[1]>au)&&ht(`${r}: Value for "text-size" or "icon-size" is >= ${by}. Reduce your "text-size" or "icon-size".`)),f}function b_(r){for(const e in r)return r[e];return null}function w_(r,e,i,o,a,c,h,f,_,y,v){let b,T,S,C;if(b=v?v.top:h.top,T=v?v.bottom:h.bottom,S=v?v.left:h.left,C=v?v.right:h.right,he(h)&&h.collisionPadding){const P=h.collisionPadding;S-=P[0],b-=P[1],C+=P[2],T+=P[3]}if(_){const P=new Ne(S,b),R=new Ne(C,b),L=new Ne(S,T),V=new Ne(C,T),B=jt(_);let G=new Ne(0,0);
vendor: 31,567 bytes, line 7
7y&&(G=new Ne(y[0],y[1])),P._rotateAround(B,G),R._rotateAround(B,G),L._rotateAround(B,G),V._rotateAround(B,G),S=Math.min(P.x,R.x,L.x,V.x),C=Math.max(P.x,R.x,L.x,V.x),b=Math.min(P.y,R.y,L.y,V.y),T=Math.max(P.y,R.y,L.y,V.y)}return r.emplaceBack(e.x,e.y,e.z,i.x,i.y,S,b,C,T,f,o,a,c),r.length-1}function Ty(r){he(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 rb(r,e,i,o){const a=r.compareText;if(e in a){const c=a[e];for(let h=c.length-1;h>=0;h--)if(o.dist(c[h])<i)return!0}else a[e]=[];return a[e].push(o),!1}const nb=zt([{type:"Float32",name:"a_globe_pos",components:3},{type:"Float32",name:"a_uv",components:2}]),{members:T_}=nb,ob=zt([{name:"a_pos_3",components:3,type:"Int16"}]);var Fx=zt([{name:"a_pos",type:"Int16",components:2}]);class sb{constructor(e,i){this.pos=e,this.dir=i}intersectsPlane(e,i,o){const a=Hr(i,this.dir);if(Math.abs(a)<1e-6)return!1;const c=((e[0]-this.pos[0])*i[0]+(e[1]-this.pos[1])*i[1])/a;return o[0]=this.pos[0]+this.dir[0]*c,o[1]=this.pos[1]+this.dir[1]*c,!0}}class Ey{constructor(e,i){this.pos=e,this.dir=i}intersectsPlane(e,i,o){const a=Xi(i,this.dir);if(Math.abs(a)<1e-6)return!1;const c=((e[0]-this.pos[0])*i[0]+(e[1]-this.pos[1])*i[1]+(e[2]-this.pos[2])*i[2])/a;return o[0]=this.pos[0]+this.dir[0]*c,o[1]=this.pos[1]+this.dir[1]*c,o[2]=this.pos[2]+this.dir[2]*c,!0}closestPointOnSphere(e,i,o){if((function(S,C){var P=S[0],R=S[1],L=S[2],V=C[0],B=C[1],G=C[2];return Math.abs(P-V)<=jr*Math.max(1,Math.abs(P),Math.abs(V))&&Math.abs(R-B)<=jr*Math.max(1,Math.abs(R),Math.abs(B))&&Math.abs(L-G)<=jr*Math.max(1,Math.abs(L),Math.abs(G))})(this.pos,e)||i===0)return o[0]=o[1]=o[2]=0,!1;const[a,c,h]=this.dir,f=this.pos[0]-e[0],_=this.pos[1]-e[1],y=this.pos[2]-e[2],v=a*a+c*c+h*h,b=2*(f*a+_*c+y*h),T=b*b-4*v*(f*f+_*_+y*y-i*i);if(T<0){const S=Math.max(-b/2,0),C=f+a*S,P=_+c*S,R=y+h*S,L=Math.hypot(C,P,R);return o[0]=C*i/L,o[1]=P*i/L,o[2]=R*i/L,!1}{const S=(-b-Math.sqrt(T))/(2*v);if(S<0){const C=Math.hypot(f,_,y);return o[0]=f*i/C,o[1]=_*i/C,o[2]=y*i/C,!1}return o[0]=f+a*S,o[1]=_+c*S,o[2]=y+h*S,!0}}}class Sy{constructor(e,i,o,a,c){this.TL=e,this.TR=i,this.BR=o,this.BL=a,this.horizon=c}static fromInvProjectionMatrix(e,i,o){const a=[-1,1,1],c=[1,1,1],h=[1,-1,1],f=[-1,-1,1],_=Zi(a,a,e),y=Zi(c,c,e),v=Zi(h,h,e),b=Zi(f,f,e);return new Sy(_,y,v,b,i/o)}}function Iy(r,e,i,o){const a=e[0],c=e[1],h=e[2],f=i[0],_=i[1],y=i[2];let v=1/0,b=-1/0;for(let T=0;T<r.length;T++){const S=r[T],C=(S[0]-a)*f+(S[1]-c)*_+(S[2]-h)*y;C<v&&(v=C),C>b&&(b=C)}return o[0]=v,o[1]=b,o}function Ox(r,e){let i=!0;for(let o=0;o<r.planes.length;o++){const a=r.planes[o];let c=0;for(let h=0;h<e.length;h++)c+=+(Xi(a,e[h])+a[3]>=0);if(c===0)return 0;c!==e.length&&(i=!1)}return i?2:1}const ab=[0,0];function Bx(r,e){for(const i of r.projections){const o=Iy(e,r.points[0],i.axis,ab);if(i.projection[1]<o[0]||i.projection[0]>o[1])return 0}return 1}function kx(r,e){const i=e[0],o=e[1],a=e[2],c=e[3];for(let h=0;h<r.length;h++){const f=r[h];if(i*f[0]+o*f[1]+a*f[2]+c>=0)return!0}return!1}class Ay{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=Ni.fromPoints(this.points),this.projections=[],this.frustumEdges=[or([],this.points[2],this.points[3]),or([],this.points[0],this.points[3]),or([],this.points[4],this.points[0]),or([],this.points[5],this.points[1]),or([],this.points[6],this.points[2]),or([],this.points[7],this.points[3])];for(const o of this.frustumEdges){const a=[0,-o[2],o[1]],c=[o[2],0,-o[0]];this.projections.push({axis:a,projection:Iy(this.points,this.points[0],a,[0,0])}),this.projections.push({axis:c,projection:Iy(this.points,this.points[0],c,[0,0])})}}static fromInvProjectionMatrix(e,i,o,a){const c=Math.pow(2,o),h=[[-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(y=>{const v=kn([],y,e),b=1/v[3]/i*c;return(T=v)[0]=(S=v)[0]*(C=[b,b,a?1/v[3]:b,b])[0],T[1]=S[1]*C[1],T[2]=S[2]*C[2],T[3]=S[3]*C[3],T;var T,S,C}),f=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(y=>{const v=bi([],hr([],or([],h[y[0]],h[y[1]]),or([],h[y[2]],h[y[1]]))),b=-Xi(v,h[y[1]]);return v.concat(b)}),_=[];for(let y=0;y<h.length;y++)_.push([h[y][0],h[y][1],h[y][2]]);return new Ay(_,f)}intersectsPrecise(e,i,o){for(let _=0;_<i.length;_++)if(!kx(e,i[_]))return 0;for(let _=0;_<this.planes.length;_++)if(!kx(e,this.planes[_]))return 0;const a=this.points,c=a[0][0],h=a[0][1],f=a[0][2];for(const _ of o)for(const y of this.frustumEdges){const v=_[1]*y[2]-_[2]*y[1],b=_[2]*y[0]-_[0]*y[2],T=_[0]*y[1]-_[1]*y[0];if(v===0&&b===0&&T===0)continue;let S=1/0,C=-1/0;for(let L=0;L<a.length;L++){const V=a[L],B=(V[0]-c)*v+(V[1]-h)*b+(V[2]-f)*T;B<S&&(S=B),B>C&&(C=B)}let P=1/0,R=-1/0;for(let L=0;L<e.length;L++){const V=e[L],B=(V[0]-c)*v+(V[1]-h)*b+(V[2]-f)*T;B<P&&(P=B),B>R&&(R=B)}if(S>R||P>C)return 0}return 1}containsPoint(e){for(const i of this.planes){const o=i[3];if(Xi([i[0],i[1],i[2]],e)+o<0)return!1}return!0}}class Ni{static fromPoints(e){const i=[1/0,1/0,1/0],o=[-1/0,-1/0,-1/0];for(const a of e)Ls(i,i,a),Fs(o,o,a);return new Ni(i,o)}static fromTileIdAndHeight(e,i,o){const a=1<<e.canonical.z,c=e.canonical.x,h=e.canonical.y;return new Ni([c/a,h/a,i],[(c+1)/a,(h+1)/a,o])}static applyTransform(e,i){const o=e.getCorners();for(let a=0;a<o.length;++a)Zi(o[a],o[a],i);return Ni.fromPoints(o)}static applyTransformFast(e,i){const o=[i[12],i[13],i[14]],a=[...o];for(let c=0;c<3;c++)for(let h=0;h<3;h++){const f=i[4*h+c],_=f*e.min[h],y=f*e.max[h];o[c]+=Math.min(_,y),a[c]+=Math.max(_,y)}return new Ni(o,a)}static projectAabbCorners(e,i){const o=e.getCorners();for(let a=0;a<o.length;++a)Zi(o[a],o[a],i);return o}constructor(e,i){this.min=e,this.max=i,this.center=mi([],gr([],this.min,this.max),.5)}quadrant(e){const i=[e%2==0,e<2],o=ma(this.min),a=ma(this.max);for(let c=0;c<i.length;c++)o[c]=i[c]?this.min[c]:this.center[c],a[c]=i[c]?this.center[c]:this.max[c];return a[2]=this.max[2],new Ni(o,a)}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)?Ox(e,this.getCorners()):0}intersectsFlat(e){return this.intersectsAabb(e.bounds)?Ox(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)?Bx(e,this.getCorners()):0}intersectsPreciseFlat(e,i){return i||this.intersectsFlat(e)?Bx(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])]}}function E_(r){return r*cn/Zl}Je(Ni,"Aabb");const lb=[new Ni([ao,ao,ao],[lo,lo,lo]),new Ni([ao,ao,ao],[0,0,lo]),new Ni([0,ao,ao],[lo,0,lo]),new Ni([ao,0,ao],[0,lo,lo]),new Ni([0,0,ao],[lo,lo,lo])];function Nx(r,e,i,o=!0){const a=mi([],r._camera.position,r.worldSize),c=[e,i,1,1];kn(c,c,r.pixelMatrixInverse),ac(c,c,1/c[3]);const h=bi([],or([],c,a)),f=r.globeMatrix,_=[f[12],f[13],f[14]],y=or([],_,a),v=Bn(y),b=bi([],y),T=r.worldSize/(2*Math.PI),S=Xi(b,h),C=Math.asin(T/v);if(C<Math.acos(S)){if(!o)return null;const ie=[],ne=[];mi(ie,h,v/S),bi(ne,or(ne,ie,y)),bi(h,gr(h,y,mi(h,ne,Math.tan(C)*v)))}const P=[];new Ey(a,h).closestPointOnSphere(_,T,P);const R=bi([],sr(f,0)),L=bi([],sr(f,1)),V=bi([],sr(f,2)),B=Xi(R,P),G=Xi(L,P),H=Xi(V,P),Z=de(Math.asin(-G/T));let oe=de(Math.atan2(B,H));oe=r.center.lng+(function(ie,ne){const fe=(ne-ie+180)%360-180;return fe<-180?fe+360:fe})(r.center.lng,oe);const X=Ur(oe),ee=te(Yr(Z),0,1);return new Jr(X,ee)}class cb{constructor(e,i,o){this.a=or([],e,o),this.b=or([],i,o),this.center=o;const a=bi([],this.a),c=bi([],this.b);this.angle=Math.acos(Xi(a,c))}}function Cy(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(o,a,c,h){const f=Math.sin(c);return o*(Math.sin((1-h)*c)/f)+a*(Math.sin(h*c)/f)})(r.a[e],r.b[e],r.angle,te(i,0,1))+r.center[e]}function aa(r){if(r.z<=1)return lb[r.z+2*r.y+r.x];const e=My(S_(r));return Ni.fromPoints(e)}function Wa(r,e,i){return mi(r,r,1-i),rn(r,r,e,i)}function Vx(r,e,i){for(const o of r)Zi(o,o,e),mi(o,o,i)}function Ux(r,e,i,o){const a=e/r.worldSize,c=r.globeMatrix;if(i.z<=1){const ee=aa(i).getCorners();return Vx(ee,c,a),Ni.fromPoints(ee)}const h=S_(i,o),f=My(h,cn+E_(r._tileCoverLift));Vx(f,c,a);const _=Number.MAX_VALUE,y=[-_,-_,-_],v=[_,_,_];if(h.contains(r.center)){for(const ne of f)Ls(v,v,ne),Fs(y,y,ne);y[2]=0;const ee=r.point,ie=[ee.x*a,ee.y*a,0];return Ls(v,v,ie),Fs(y,y,ie),new Ni(v,y)}if(r._tileCoverLift>0){for(const ee of f)Ls(v,v,ee),Fs(y,y,ee);return new Ni(v,y)}const b=[c[12]*a,c[13]*a,c[14]*a],T=h.getCenter(),S=te(r.center.lat,-85.051129,co),C=te(T.lat,-85.051129,co),P=Ur(r.center.lng),R=Yr(S);let L=P-Ur(T.lng);const V=R-Yr(C);L>.5?L-=1:L<-.5&&(L+=1);let B=0;Math.abs(L)>Math.abs(V)?B=L>=0?1:3:(B=V>=0?0:2,rn(b,b,[c[4]*a,c[5]*a,c[6]*a],-Math.sin(jt(V>=0?h.getSouth():h.getNorth()))*cn));const G=f[B],H=f[(B+1)%4],Z=new cb(G,H,b),oe=[Cy(Z,0)||G[0],Cy(Z,1)||G[1],Cy(Z,2)||G[2]],X=Ql(r.zoom);if(X>0){const ee=(function({x:ne,y:fe,z:ge},we,Se,Ee,Ve){const Ie=1/(1<<ge);let Te=ne*Ie,Ce=Te+Ie,ze=fe*Ie,Fe=ze+Ie,Be=0;const De=(Te+Ce)/2-Ee;return De>.5?Be=-1:De<-.5&&(Be=1),Te=((Te+Be)*we-(Ee*=we))*Se+Ee,Ce=((Ce+Be)*we-Ee)*Se+Ee,ze=(ze*we-(Ve*=we))*Se+Ve,Fe=(Fe*we-Ve)*Se+Ve,[[Te,Fe,0],[Ce,Fe,0],[Ce,ze,0],[Te,ze,0]]})(i,e,r._pixelsPerMercatorPixel,P,R);for(let ne=0;ne<f.length;ne++)Wa(f[ne],ee[ne],X);const ie=gr([],ee[B],ee[(B+1)%4]);mi(ie,ie,.5),Wa(oe,ie,X)}for(const ee of f)Ls(v,v,ee),Fs(y,y,ee);return v[2]=Math.min(G[2],H[2]),Ls(v,v,oe),Fs(y,y,oe),new Ni(v,y)}function S_({x:r,y:e,z:i},o=!1){const a=1/(1<<i),c=new Kt(on(r*a),e===(1<<i)-1&&o?-90:Er((e+1)*a)),h=new Kt(on((r+1)*a),e===0&&o?90:Er(e*a));return new Qs(c,h)}function My(r,e=cn){const i=jt(r.getNorth()),o=jt(r.getSouth()),a=Math.cos(i),c=Math.cos(o),h=Math.sin(i),f=Math.sin(o),_=r.getWest(),y=r.getEast();return[$l(c,f,_,e),$l(c,f,y,e),$l(a,h,y,e),$l(a,h,_,e)]}function ap(r,e,i,o){const a=1<<i.z,c=(r/Ke+i.x)/a;return Ba(Er((e/Ke+i.y)/a),on(c),o)}function I_({min:r,max:e}){return 16383/Math.max(e[0]-r[0],e[1]-r[1],e[2]-r[2])}const A_=new Float64Array(16);function C_(r){const e=I_(r),i=fa(A_,[e,e,e]);return wn(i,i,To([],r.min))}function Py(r){const e=1/I_(r);return eo(A_,r.min),Gr(A_,A_,[e,e,e])}function Ry(r){const e=Ke/(2*Math.PI);return r/(2*Math.PI)/e}function jx(r,e){return Ke/(512*Math.pow(2,r))*I_(aa(e))}function Gx(r,e,i,o,a){const c=Ry(i),h=[r,e,-i/(2*Math.PI)],f=ki(new Float64Array(16));return wn(f,f,h),Gr(f,f,[c,c,c]),ts(f,f,jt(-a)),wo(f,f,jt(-o)),f}function Ql(r){return ce(5,6,r)}function qx(r,e){const i=Ba(e.lat,e.lng),o=(function(C){const P=Ba(C._center.lat,C._center.lng);let R=hr([],Cr(0,1,0),P);const L=nl([],-C.angle,P);R=Zi(R,R,L),nl(L,-C._pitch,R);const V=bi([],P);return mi(V,V,E_(C.cameraToCenterDistance/C.pixelsPerMeter)),Zi(V,V,L),gr([],P,V)})(r);return h=(a=Vo([],o,i))[0],f=a[1],_=a[2],y=(c=i)[0],v=c[1],b=c[2],S=(T=Math.sqrt((h*h+f*f+_*_)*(y*y+v*v+b*b)))&&Xi(a,c)/T,Math.acos(Math.min(Math.max(S,-1),1));var a,c,h,f,_,y,v,b,T,S}function Dy(r,e){return qx(r,e)>Math.PI/2*1.01}const Hx=jt(85),ub=Math.cos(Hx),hb=Math.sin(Hx);function $x(r,e){const i=r.fovAboveCenter,o=r.elevation?r.elevation.getMinElevationBelowMSL()*e:0,a=Math.min(o,r.isOrthographic?-10*e:0),c=(r._camera.position[2]*r.worldSize-a)/Math.cos(r._pitch),h=Math.sin(i)*c/Math.sin(Math.max(Math.PI/2-r._pitch-i,.01));let f=Math.sin(r._pitch)*h+c;const _=c*(1/r._horizonShift);if(!r.elevation||r.elevation.exaggeration()===0){let y=Math.max(r.zoom-17,0);r.isOrthographic&&(y/=10),f*=1+y}return Math.min(1.01*f,_)}class lp{constructor(e,i,o){this.z=e,this.x=i,this.y=o,this.key=Gh(0,e,e,i,o)}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 o=(function(c,h,f){const _=2**f,y=2*Math.PI*6378137,v=y*(c/_-.5),b=y*(.5-(h+1)/_);return`${v},${b},${v+y/_},${b+y/_}`})(this.x,this.y,this.z),a=(function(c,h,f){let _,y="";for(let v=c;v>0;v--)_=1<<v-1,y+=(h&_?1:0)+(f&_?2:0);return y})(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}",a).replace("{bbox-epsg-3857}",o)}toString(){return`${this.z}/${this.x}/${this.y}`}}class Zx{constructor(e,i){this.wrap=e,this.canonical=i,this.key=Gh(e,i.z,i.z,i.x,i.y)}}class dn{constructor(e,i,o,a,c){this.overscaledZ=e,this.wrap=i,this.canonical=new lp(o,+a,+c),this.key=i===0&&e===o?this.canonical.key:Gh(i,e,o,a,c)}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 dn(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new dn(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 Gh(this.wrap*+i,e,this.canonical.z,this.canonical.x,this.canonical.y);{const o=this.canonical.z-e;return Gh(this.wrap*+i,e,e,this.canonical.x>>o,this.canonical.y>>o)}}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 dn(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const i=this.canonical.z+1,o=2*this.canonical.x,a=2*this.canonical.y;return[new dn(i,this.wrap,i,o,a),new dn(i,this.wrap,i,o+1,a),new dn(i,this.wrap,i,o,a+1),new dn(i,this.wrap,i,o+1,a+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 dn(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new dn(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 Zx(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}}function Gh(r,e,i,o,a){const c=1<<Math.min(i,22);let h=c*(a%c)+o%c;return r&&i<22&&(h+=c*c*((r<0?-2*r-1:2*r)%(1<<2*(22-i)))),16*(32*h+i)+(e-i)}const db=[r=>{let e=r.canonical.x-1,i=r.wrap;return e<0&&(e=(1<<r.canonical.z)-1,i--),new dn(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 dn(r.overscaledZ,i,r.canonical.z,e,r.canonical.y)},r=>new dn(r.overscaledZ,r.wrap,r.canonical.z,r.canonical.x,(r.canonical.y===0?1<<r.canonical.z:r.canonical.y)-1),r=>new dn(r.overscaledZ,r.wrap,r.canonical.z,r.canonical.x,r.canonical.y===(1<<r.canonical.z)-1?0:r.canonical.y+1)];function zy(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),o=r.x*i,a=(r.x+1)*i,c=r.y*i,h=(r.y+1)*i,f=on(o),_=on(a),y=Er(c),v=Er(h),b=e.project(f,y),T=e.project(_,y),S=e.project(_,v),C=e.project(f,v);let P=Math.min(b.x,T.x,S.x,C.x),R=Math.min(b.y,T.y,S.y,C.y),L=Math.max(b.x,T.x,S.x,C.x),V=Math.max(b.y,T.y,S.y,C.y);const B=i/16;function G(Z,oe,X,ee,ie,ne){const fe=(X+ie)/2,ge=(ee+ne)/2,we=e.project(on(fe),Er(ge)),Se=Math.max(0,P-we.x,R-we.y,we.x-L,we.y-V);P=Math.min(P,we.x),L=Math.max(L,we.x),R=Math.min(R,we.y),V=Math.max(V,we.y),Se>B&&(G(Z,we,X,ee,fe,ge),G(we,oe,fe,ge,ie,ne))}G(b,T,o,c,a,c),G(T,S,a,c,a,h),G(S,C,a,h,o,h),G(C,b,o,h,o,c),P-=B,R-=B,L+=B,V+=B;const H=1/Math.max(L-P,V-R);return{scale:H,x:P*H,y:R*H,x2:L*H,y2:V*H,projection:e}}Je(lp,"CanonicalTileID"),Je(dn,"OverscaledTileID",{omit:["projMatrix","expandedProjMatrix"]});const fb=ki(new Float32Array(16));class ec{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 Kt(0,0)}projectTilePoint(e,i,o){return{x:e,y:i,z:0}}locationPoint(e,i,o,a=!0){return e._coordinatePoint(e.locationCoordinate(i,o),a)}pixelsPerMeter(e,i){return un(1,e)*i}pixelSpaceConversion(e,i,o){return 1}farthestPixelDistance(e){return $x(e,e.pixelsPerMeter)}pointCoordinate(e,i,o,a){const c=e.horizonLineFromTop(!1),h=new Ne(i,Math.max(c,o));return e.rayIntersectionCoordinate(e.pointRayIntersection(h,a))}pointCoordinate3D(e,i,o){const a=new Ne(i,o);if(e.elevation)return e.elevation.pointCoordinate(a);{const c=this.pointCoordinate(e,a.x,a.y,0);return[c.x,c.y,c.z]}}isPointAboveHorizon(e,i){if(e.elevation&&e.elevation.visibleDemTiles.length)return!this.pointCoordinate3D(e,i.x,i.y);const o=e.horizonLineFromTop();return i.y<o}createInversionMatrix(e,i){return fb}createTileMatrix(e,i,o){let a,c,h;const f=o.canonical,_=ki(new Float64Array(16));if(this.isReprojectedInTileSpace){const y=zy(f,this);a=1,c=y.x+o.wrap*y.scale,h=y.y,Gr(_,_,[a/y.scale,a/y.scale,e.pixelsPerMeter/i])}else a=i/e.zoomScale(f.z),c=(f.x+Math.pow(2,f.z)*o.wrap)*a,h=f.y*a;return wn(_,_,[c,h,0]),Gr(_,_,[a/Ke,a/Ke,1]),_}upVector(e,i,o){return[0,0,1]}upVectorScale(e,i,o){return{metersToTile:1}}}class pb extends ec{constructor(e){super(e),this.range=[4,7],this.center=e.center||[-96,37.5];const[i,o]=this.parallels=e.parallels||[29.5,45.5],a=Math.sin(jt(i));this.n=(a+Math.sin(jt(o)))/2,this.c=1+a*(2*this.n-a),this.r0=Math.sqrt(this.c)/this.n}project(e,i){const{n:o,c:a,r0:c}=this,h=jt(e-this.center[0]),f=jt(i),_=Math.sqrt(a-2*o*Math.sin(f))/o;return{x:_*Math.sin(h*o),y:_*Math.cos(h*o)-c,z:0}}unproject(e,i){const{n:o,c:a,r0:c}=this,h=c+i;let f=Math.atan2(e,Math.abs(h))*Math.sign(h);h*o<0&&(f-=Math.PI*Math.sign(e)*Math.sign(h));const _=jt(this.center[0])*o;f=le(f,-Math.PI-_,Math.PI-_);const y=te(de(f/o)+this.center[0],-180,180),v=Math.asin(te((a-(e*e+h*h)*o*o)/(2*o),-1,1)),b=te(de(v),-85.051129,co);return new Kt(y,b)}}const cp=1.340264,up=-.081106,hp=893e-6,dp=.003796,M_=Math.sqrt(3)/2;class mb extends ec{project(e,i){i=i/180*Math.PI,e=e/180*Math.PI;const o=Math.asin(M_*Math.sin(i)),a=o*o,c=a*a*a;return{x:.5*(e*Math.cos(o)/(M_*(cp+3*up*a+c*(7*hp+9*dp*a)))/Math.PI+.5),y:1-.5*(o*(cp+up*a+c*(hp+dp*a))/Math.PI+1),z:0}}unproject(e,i){e=(2*e-.5)*Math.PI;let o=i=(2*(1-i)-1)*Math.PI,a=o*o,c=a*a*a;for(let v,b,T,S=0;S<12&&(b=o*(cp+up*a+c*(hp+dp*a))-i,T=cp+3*up*a+c*(7*hp+9*dp*a),v=b/T,o=te(o-v,-Math.PI/3,Math.PI/3),a=o*o,c=a*a*a,!(Math.abs(v)<1e-12));++S);const h=M_*e*(cp+3*up*a+c*(7*hp+9*dp*a))/Math.cos(o),f=Math.asin(Math.sin(o)/M_),_=te(180*h/Math.PI,-180,180),y=te(180*f/Math.PI,-85.051129,co);return new Kt(_,y)}}class _b extends ec{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 o=360*(e-.5),a=te(360*(.5-i),-85.051129,co);return new Kt(o,a)}}const qh=Math.PI/2;function P_(r){return Math.tan((qh+r)/2)}class gb extends ec{constructor(e){super(e),this.center=e.center||[0,30];const[i,o]=this.parallels=e.parallels||[30,30];let a=jt(i),c=jt(o);this.southernCenter=a+c<0,this.southernCenter&&(a=-a,c=-c);const h=Math.cos(a),f=P_(a);this.n=a===c?Math.sin(a):Math.log(h/Math.cos(c))/Math.log(P_(c)/f),this.f=h*Math.pow(P_(a),this.n)/this.n}project(e,i){i=jt(i),this.southernCenter&&(i=-i),e=jt(e-this.center[0]);const o=1e-6,{n:a,f:c}=this;c>0?i<-qh+o&&(i=-qh+o):i>qh-o&&(i=qh-o);const h=c/Math.pow(P_(i),a);let f=h*Math.sin(a*e),_=c-h*Math.cos(a*e);return f=.5*(f/Math.PI+.5),_=.5*(_/Math.PI+.5),{x:f,y:this.southernCenter?_:1-_,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:o,f:a}=this,c=a-i,h=Math.sign(c),f=Math.sign(o)*Math.sqrt(e*e+c*c);let _=Math.atan2(e,Math.abs(c))*h;c*o<0&&(_-=Math.PI*Math.sign(e)*h);const y=te(de(_/o)+this.center[0],-180,180),v=te(de(2*Math.atan(Math.pow(a/f,1/o))-qh),-85.051129,co);return new Kt(y,this.southernCenter?-v:v)}}class Wx extends ec{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:Ur(e),y:Yr(i),z:0}}unproject(e,i){const o=on(e),a=Er(i);return new Kt(o,a)}}const Xx=jt(co);class yb extends ec{project(e,i){const o=(i=jt(i))*i,a=o*o;return{x:.5*((e=jt(e))*(.8707-.131979*o+a*(a*(.003971*o-.001529*a)-.013791))/Math.PI+.5),y:1-.5*(i*(1.007226+o*(.015085+a*(.028874*o-.044475-.005916*a)))/Math.PI+1),z:0}}unproject(e,i){e=(2*e-.5)*Math.PI;let o=i=(2*(1-i)-1)*Math.PI,a=25,c=0,h=o*o;do{h=o*o;const y=h*h;c=(o*(1.007226+h*(.015085+y*(.028874*h-.044475-.005916*y)))-i)/(1.007226+h*(.045255+y*(.259866*h-.311325-.005916*11*y))),o=te(o-c,-Xx,Xx)}while(Math.abs(c)>1e-6&&--a>0);h=o*o;const f=te(de(e/(.8707+h*(h*(h*h*h*(.003971-.001529*h)-.013791)-.131979))),-180,180),_=de(o);return new Kt(f,_)}}const Yx=jt(co);class xb extends ec{project(e,i){i=jt(i),e=jt(e);const o=Math.cos(i),a=2/Math.PI,c=Math.acos(o*Math.cos(e/2)),h=Math.sin(c)/c,f=.5*(e*a+2*o*Math.sin(e/2)/h)||0,_=.5*(i+Math.sin(i)/h)||0;return{x:.5*(f/Math.PI+.5),y:1-.5*(_/Math.PI+1),z:0}}unproject(e,i){let o=e=(2*e-.5)*Math.PI,a=i=(2*(1-i)-1)*Math.PI,c=25;const h=1e-6;let f=0,_=0;do{const y=Math.cos(a),v=Math.sin(a),b=2*v*y,T=v*v,S=y*y,C=Math.cos(o/2),P=Math.sin(o/2),R=2*C*P,L=P*P,V=1-S*C*C,B=V?1/V:0,G=V?Math.acos(y*C)*Math.sqrt(1/V):0,H=.5*(2*G*y*P+2*o/Math.PI)-e,Z=.5*(G*v+a)-i,oe=.5*B*(S*L+G*y*C*T)+1/Math.PI,X=B*(R*b/4-G*v*P),ee=.125*B*(b*P-G*v*S*R),ie=.5*B*(T*C+G*L*y)+.5,ne=X*ee-ie*oe;f=(Z*X-H*ie)/ne,_=(H*ee-Z*oe)/ne,o=te(o-f,-Math.PI,Math.PI),a=te(a-_,-Yx,Yx)}while((Math.abs(f)>h||Math.abs(_)>h)&&--c>0);return new Kt(de(o),de(a))}}class Kx extends ec{constructor(e){super(e),this.center=e.center||[0,0],this.parallels=e.parallels||[0,0],this.cosPhi=Math.max(.01,Math.cos(jt(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:o,cosPhi:a}=this;return{x:jt(e)*a*o+.5,y:-Math.sin(jt(i))/a*o+.5,z:0}}unproject(e,i){const{scale:o,cosPhi:a}=this,c=-(i-.5)/o,h=te(de((e-.5)/o)/a,-180,180),f=Math.asin(te(c*a,-1,1)),_=te(de(f),-85.051129,co);return new Kt(h,_)}}class vb extends Wx{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,o){const a=ap(e,i,o);return Zi(a,a,C_(aa(o))),{x:a[0],y:a[1],z:a[2]}}locationPoint(e,i,o){const a=Ba(i.lat,i.lng),c=bi([],a),h=o?e._centerAltitude+o:e.elevation?e.elevation.getAtPointOrZero(e.locationCoordinate(i),e._centerAltitude):e._centerAltitude;rn(a,a,c,un(1,0)*Ke*h);const f=ki(new Float64Array(16));return Ri(f,e.pixelMatrix,e.globeMatrix),Zi(a,a,f),new Ne(a[0],a[1])}pixelsPerMeter(e,i){return un(1,0)*i}pixelSpaceConversion(e,i,o){const a=un(1,e)*i,c=yt(un(1,45)*i,a,o);return this.pixelsPerMeter(e,i)/c}createTileMatrix(e,i,o){const a=Py(aa(o.canonical));return Ri(new Float64Array(16),e.globeMatrix,a)}createInversionMatrix(e,i){const{center:o}=e,a=C_(aa(i));return wo(a,a,jt(o.lng)),ts(a,a,jt(o.lat)),Gr(a,a,[e._pixelsPerMercatorPixel,e._pixelsPerMercatorPixel,1]),Float32Array.from(a)}pointCoordinate(e,i,o,a){return Nx(e,i,o,!0)||new Jr(0,0)}pointCoordinate3D(e,i,o){const a=this.pointCoordinate(e,i,o,0);return[a.x,a.y,a.z]}isPointAboveHorizon(e,i){return!Nx(e,i.x,i.y,!1)}farthestPixelDistance(e){const i=(function(a,c){const h=a.cameraToCenterDistance,f=a._centerAltitude*c,_=a._camera,y=a._camera.forward(),v=gr([],mi([],y,-h),[0,0,f]),b=a.worldSize/(2*Math.PI),T=[0,0,-b],S=a.width/a.height,C=Math.tan(a.fovAboveCenter),P=mi([],_.up(),C),R=mi([],_.right(),C*S),L=bi([],gr([],gr([],y,P),R)),V=[];let B;if(new Ey(v,L).closestPointOnSphere(T,b,V)){const G=gr([],V,T),H=or([],G,v);B=Math.cos(a.fovAboveCenter)*Bn(H)}else{const G=or([],v,T),H=or([],T,v);bi(H,H);const Z=Bn(G)-b;B=Math.sqrt(Z*(Z+2*b));const oe=Math.acos(B/(b+Z))-Math.acos(Xi(y,H));B*=Math.cos(oe)}return 1.01*B})(e,this.pixelsPerMeter(e.center.lat,e.worldSize)),o=Ql(e.zoom);if(o>0){const a=$x(e,un(1,e.center.lat)*e.worldSize),c=e.worldSize/(2*Math.PI),h=Math.max(e.width,e.height)/e.worldSize*Math.PI;return yt(i,a+c*(1-Math.cos(h)),Math.pow(o,10))}return i}upVector(e,i,o){return ap(i,o,e,1)}upVectorScale(e){return{metersToTile:E_(I_(aa(e)))}}}function Jx(r){const e=r.parallels,i=!!e&&Math.abs(e[0]+e[1])<.01;switch(r.name){case"mercator":return new Wx(r);case"equirectangular":return new _b(r);case"naturalEarth":return new yb(r);case"equalEarth":return new mb(r);case"winkelTripel":return new xb(r);case"albers":return i?new Kx(r):new pb(r);case"lambertConformalConic":return i?new Kx(r):new gb(r);case"globe":return new vb(r)}throw new Error(`Invalid projection name: ${r.name}`)}const fp=Number.MAX_SAFE_INTEGER,bb=fp-1;function Qx(r,e,i,o){return r.order<e||r.order===fp||!(r.clipMask&i)||(function(a,c){if(c.length===0)return!1;let h=a;for(;h!=="";){if(c.includes(h))return!1;h=Po(h)}return!0})(o,r.clipScope)}function R_(r,e){return r.x-e.x||r.y-e.y}function ev(r,e){return R_(r.min,e.min)===0&&R_(r.max,e.max)===0}function Ly(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 D_(r,e){if(r.length!==e.length)return!1;for(let i=0;i<r.length;i++)if(r[i].sourceId!==e[i].sourceId||!ev(r[i],e[i])||r[i].order!==e[i].order||r[i].clipMask!==e[i].clipMask||!En(r[i].clipScope,e[i].clipScope))return!1;return!0}function tv(r,e,i){const o=1/Ke,a=1/(1<<i.canonical.z),c=(e.x*o+i.canonical.x)*a+i.wrap,h=(e.y*o+i.canonical.y)*a;return{min:new Ne((r.x*o+i.canonical.x)*a+i.wrap,(r.y*o+i.canonical.y)*a),max:new Ne(c,h)}}function wb(r,e,i){const o=1<<i.canonical.z,a=((e.x-i.wrap)*o-i.canonical.x)*Ke,c=(e.y*o-i.canonical.y)*Ke;return{min:new Ne(((r.x-i.wrap)*o-i.canonical.x)*Ke,(r.y*o-i.canonical.y)*Ke),max:new Ne(a,c)}}function Fy(r,e,i,o,a,c,h){const f=r.indices,_=r.vertices,y=[];for(let v=o;v<o+a;v+=3){const b=e[i[v+0]+c],T=e[i[v+1]+c],S=e[i[v+2]+c],C=Math.min(b.x,T.x,S.x),P=Math.max(b.x,T.x,S.x),R=Math.min(b.y,T.y,S.y),L=Math.max(b.y,T.y,S.y);y.length=0,r.grid.query(new Ne(C,R),new Ne(P,L),y);for(let V=0;V<y.length;V++){const B=y[V];if(iu(_[f[3*B+0]],_[f[3*B+1]],_[f[3*B+2]],b,T,S,h))return!0}}return!1}function iv(r,e,i,o){if(!r||!i)return!1;let a=r.vertices;if(!e.canonical.equals(o.canonical)||e.wrap!==o.wrap){if(i.vertices.length<r.vertices.length)return iv(i,o,r,e);const c=e.canonical,h=o.canonical,f=Math.pow(2,h.z-c.z);a=r.vertices.map(_=>new Ne((_.x+c.x*Ke)*f-h.x*Ke,(_.y+c.y*Ke)*f-h.y*Ke))}return Fy(i,a,r.indices,0,r.indices.length,0,0)}function rv(r,e,i,o){const a=Math.pow(2,o.z-i.z);return new Ne((r+i.x*Ke)*a-o.x*Ke,(e+i.y*Ke)*a-o.y*Ke)}function nv(r,e){const i=[];e.grid.queryPoint(r,i);const o=e.indices,a=e.vertices;for(let c=0;c<i.length;c++){const h=i[c];if(As([a[o[3*h+0]],a[o[3*h+1]],a[o[3*h+2]]],r))return!0}return!1}class Tb{constructor(e,i){this.lastParams=null,this.lastAllFeaturesIndex=-2,this.appearancesVersion=i,this.appearances=e;const o=e.map(a=>(function(c){if(!c.condition)return{featureDependent:!1,stateDependent:!1,zoomDependent:!1,pitchDependent:!1,brightnessDependent:!1,worldviewDependent:!1};const h=c.condition.expression;return{featureDependent:!$s(h),stateDependent:!Ca(h),zoomDependent:!Zs(h,["zoom"]),pitchDependent:!Zs(h,["pitch"]),brightnessDependent:!Zs(h,["brightness","measure-light"]),worldviewDependent:!Zs(h,["worldview"])}})(a));this.anyFeatureDependent=o.some(a=>a.featureDependent),this.anyStateDependent=o.some(a=>a.stateDependent)}update(e,i){const o=this.lastParams,a=!o||o.zoom!==e.zoom||o.pitch!==(e.pitch||0)||o.brightness!==(e.brightness||0)||o.worldview!==e.worldview;this.lastParams={zoom:e.zoom,pitch:e.pitch||0,brightness:e.brightness||0,worldview:e.worldview};const c=i&&this.anyStateDependent;if(!a&&!c&&this.lastAllFeaturesIndex!==-2)return{kind:"no-changes"};if(!this.anyFeatureDependent&&!c){const h=this.evaluateAllFeatures(e);return h===this.lastAllFeaturesIndex?{kind:"no-changes"}:(this.lastAllFeaturesIndex=h,{kind:"all-features",appearanceIndex:h})}return{kind:"per-feature"}}evaluateAllFeatures(e){for(let i=0;i<this.appearances.length;i++){const o=this.appearances[i];if(o.condition&&o.condition.evaluate(e,void 0,void 0,void 0))return i}return-1}}const Eb=ra.types,Sb=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function pp(r,e,i,o,a,c,h,f,_,y,v,b,T){const S=f?Math.min(au,Math.round(f[0])):0,C=f?Math.min(au,Math.round(f[1])):0;r.emplaceBack(e,i,Math.round(32*o),Math.round(32*a),c,h,(S<<1)+(_?1:0),0+(C<<1),16*y,16*v,256*b,256*T)}function mp(r,e,i){r.emplaceBack(e,i)}function _p(r,e,i,o,a,c,h){r.emplaceBack(e,i,o,a,c,h)}function Hh(r,e,i,o,a){r.emplaceBack(e,i,o,a),r.emplaceBack(e,i,o,a),r.emplaceBack(e,i,o,a),r.emplaceBack(e,i,o,a)}function Ib(r){for(const e of r.sections)if(Lg(e.text))return!0;return!1}const $h=12;class Oy{constructor(e){this.layoutVertexArray=new Pf,this.indexArray=new Mr,this.programConfigurations=e,this.segments=new wi,this.dynamicLayoutVertexArray=new Is,this.opacityVertexArray=new Df,this.placedSymbolArray=new Ch,this.iconTransitioningVertexArray=new fo,this.globeExtVertexArray=new Rf,this.zOffsetVertexArray=new Ko,this.orientationVertexArray=new Sh,this.symbolInstanceIndices=[],this.uboBinder=null,this.featureIdArray=new Ko,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 o=new Map;for(const h of e.get()){const f=h.batchIndex!==void 0?h.batchIndex:0;o.has(f)||o.set(f,[]),o.get(f).push(h)}const a=Array.from(o.keys()).sort((h,f)=>h-f),c=new Map;for(const h of a){const f=o.get(h);c.set(h,new wi(f))}return i&&(this.cachedBatchIndices=a,this.cachedBatchSegments=c),{batchIndices:a,batchSegments:c}}
vendor: 3,249 bytes, line 7
7snapshotSymbolVertexData(e,i){const o=e*$h;return this.layoutVertexArray.uint16.slice(o,o+i*$h)}restoreSymbolVertexData(e,i){this.layoutVertexArray.uint16.set(i,e*$h)}snapshotIconTransitioningVertexData(e,i){const o=2*e;return this.iconTransitioningVertexArray.uint16.slice(o,o+2*i)}restoreIconTransitioningVertexData(e,i){this.iconTransitioningVertexArray.uint16.set(i,2*e)}updateSymbolVertexData(e,i,o,a,c,h,f,_,y,v,b,T,S){const C=this.layoutVertexArray.uint16,P=e*$h;C[P]=i,C[P+1]=o,C[P+2]=a,C[P+3]=c,C[P+4]=h,C[P+5]=f,C[P+6]=_,C[P+7]=y,C[P+8]=v,C[P+9]=b,C[P+10]=T,C[P+11]=S}upload(e,i,o,a,c,h){this.isEmpty()||(o&&(this.cachedBatchIndices=null,this.cachedBatchSegments=null,this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,uy.members,!!h),this.indexBuffer=e.createIndexBuffer(this.indexArray,i),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,g_.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,Sb,!0),this.iconTransitioningVertexArray.length>0&&(this.iconTransitioningVertexBuffer=e.createVertexBuffer(this.iconTransitioningVertexArray,my.members,!0)),this.globeExtVertexArray.length>0&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,hy.members,!0)),!this.zOffsetVertexBuffer&&(this.zOffsetVertexArray.length>0||c)&&(this.zOffsetVertexBuffer=e.createVertexBuffer(this.zOffsetVertexArray,dy.members,!0)),!this.orientationVertexBuffer&&this.orientationVertexArray&&this.orientationVertexArray.length>0&&(this.orientationVertexBuffer=e.createVertexBuffer(this.orientationVertexArray,py.members,!0)),this.opacityVertexBuffer.itemSize=1,this.featureIdArray.length>0&&(this.featureIdBuffer=e.createVertexBuffer(this.featureIdArray,fy.members,!1))),(o||a)&&(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())}}Je(Oy,"SymbolBuffers",{omit:["cachedBatchIndices","cachedBatchSegments"]});class By{constructor(e,i,o){this.layoutVertexArray=new e,this.layoutAttributes=i,this.indexArray=new o,this.segments=new wi,this.collisionVertexArray=new wh,this.collisionVertexArrayExt=new Is}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,_y.members,!0),this.collisionVertexBufferExt=e.createVertexBuffer(this.collisionVertexArrayExt,gy.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy(),this.collisionVertexBufferExt.de
vendor: 26,772 bytes, line 7
7stroy())}}Je(By,"CollisionBuffers");class z_{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(h=>h.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=ki([]),this.placementViewportMatrix=ki([]);const i=this.layers[0]._unevaluatedLayout._values;this.worldview=e.worldview,this.localizable=e.localizable,this.maxUniformBufferBindings=e.maxUniformBufferBindings,this.maxUniformBlockSizeDwords=e.maxUniformBlockSizeDwords,this.textSizeData=Re(this.zoom,i["text-size"],this.worldview,e.availableImages),this.iconSizeData=Re(this.zoom,i["icon-size"],this.worldview,e.availableImages);const o=this.layers[0].layout,a=o.get("symbol-sort-key"),c=o.get("symbol-z-order");this.lut=e.lut,this.canOverlap=o.get("text-allow-overlap")||o.get("icon-allow-overlap")||o.get("text-ignore-placement")||o.get("icon-ignore-placement"),this.sortFeaturesByKey=c!=="viewport-y"&&a.constantOr(1)!==void 0,this.sortFeaturesByY=(c==="viewport-y"||c==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,this.writingModes=o.get("text-writing-mode").map(h=>z[h]),this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id),this.sourceID=e.sourceID,this.projection=e.projection,this.hasAnyZOffset=!1,this.zOffsetSortDirty=!1,this.zOffsetBuffersNeedUpload=!1,this.elevationType="none",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 o=Array.isArray(e)?e:[e];return i.some(a=>o.some(c=>a.hasLayoutProperty(c)))}getAppearanceFeatureData(e){return this.featureAppearanceData.get(e)}createArrays(){this.text=new Oy(new _o(this.layers,{zoom:this.zoom,lut:this.lut},e=>e.startsWith("text")||e.startsWith("symbol"))),this.icon=new Oy(new _o(this.layers,{zoom:this.zoom,lut:this.lut},e=>e.startsWith("icon")||e.startsWith("symbol"))),this.text.uboBinder=new np(this.layers[0],this.zoom,this.lut,!0,"",this.maxUniformBufferBindings,this.maxUniformBlockSizeDwords),this.icon.uboBinder=new np(this.layers[0],this.zoom,this.lut,!1,"",this.maxUniformBufferBindings,this.maxUniformBlockSizeDwords),this.glyphOffsetArray=new Ym,this.lineVertexArray=new Wc,this.symbolInstances=new Bf}calculateGlyphDependencies(e,i,o,a,c){for(const h of e){const f=h.codePointAt(0);if(f===void 0)break;if(i[f]=!0,a&&c&&f<=65535){const _=ou[h];_&&(i[_.charCodeAt(0)]=!0)}}}calculateEffectiveAppearanceIconSize(e,i,o,a,c,h,f){if(!e.hasLayoutProperty("icon-size"))return f*h;let _=1;const y=e.getUnevaluatedLayoutProperty("icon-size"),v=Re(this.zoom,y,this.worldview,c),b=Ae(v,i);if(v.kind!=="constant"&&v.kind!=="camera"||(_=b.uSize),v.kind==="composite"){const{minZoom:T,maxZoom:S}=v,C=y.possiblyEvaluate(new oi(T,{worldview:this.worldview}),a),P=y.possiblyEvaluate(new oi(S,{worldview:this.worldview}),a),R=C.evaluate(o,{},a,c);_=R+(P.evaluate(o,{},a,c)-R)*b.uSizeT}return v.kind==="source"&&(_=y.possiblyEvaluate(new oi(this.zoom,{worldview:this.worldview}),a).evaluate(o,{},a,c)),_*h}updateFootprints(e,i){}updateReplacement(e,i){if(i.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=i.updateTime;const o=i.getReplacementRegionsForTile(e.toUnwrapped(),!0);return!D_(this.activeReplacements,o)&&(this.activeReplacements=o,!0)}getResolvedImageFromTokens(e){return typeof e=="string"?Wr.build(e):e}populate(e,i,o,a){const c=this.layers[0],h=c.layout,f=this.projection.name==="globe",_=h.get("text-font"),y=h.get("text-field"),v=h.get("icon-image"),[b,T]=h.get("icon-size-scale-range"),S=te(i.scaleFactor||1,b,T),[C,P]=h.get("text-size-scale-range"),R=te(i.scaleFactor||1,C,P),L=(y.value.kind!=="constant"||y.value.value instanceof Zr&&!y.value.value.isEmpty()||y.value.value.toString().length>0)&&(_.value.kind!=="constant"||_.value.value.length>0),V=v.value.kind!=="constant"||!!v.value.value||Object.keys(v.parameters).length>0,B=this.hasAnyAppearanceLayoutProperty("icon-image"),G=h.get("symbol-sort-key");if(this.features=[],this.featureAppearanceData=new Map,!L&&!V&&!B)return;const H=i.iconDependencies,Z=i.glyphDependencies,oe=i.availableImages,X=new oi(this.zoom,{worldview:this.worldview,activeFloors:i.activeFloors}),ee=ie=>{const ne=ie.id.toString();H.has(ne)?H.get(ne).push(ie):H.set(ne,[ie])};for(const ie of e){const{feature:ne,id:fe,index:ge,sourceLayerIndex:we}=ie,Se=c._featureFilter.needGeometry,Ee=uo(ne,Se);if(!c._featureFilter.filter(X,Ee,o))continue;if(Se||(Ee.geometry=xn(ne,o,a)),f&&ne.type!==1&&o.z<=5){const De=Ee.geometry,Ge=.98078528056,Ze=(Qe,Xe)=>Xi(ap(Qe.x,Qe.y,o,1),ap(Xe.x,Xe.y,o,1))<Ge;for(let Qe=0;Qe<De.length;Qe++)De[Qe]=Gg(De[Qe],Ze)}let Ve,Ie;if(L){const De=c.getValueAndResolveTokens("text-field",Ee,o,oe),Ge=Zr.factory(De);Ib(Ge)&&(this.hasRTLText=!0),(!this.hasRTLText||fh()==="unavailable"||this.hasRTLText&&Wo.isParsed())&&(Ve=yy(Ge,c,Ee))}if(V){const De=c.getValueAndResolveTokens("icon-image",Ee,o,oe);Ie=this.getResolvedImageFromTokens(De)}const Te=this.layers[0];let Ce=!1;if(!Ie&&B){const De=Te.getAppearances();for(const Ge of De)if(Ge.getLayoutProperty("icon-image")){const Ze=Te.getAppearanceValueAndResolveTokens(Ge,"icon-image",Ee,o,oe);if(Ze){Ie=this.getResolvedImageFromTokens(Ze),Ce=!0;break}}}if(!Ve&&!Ie)continue;const ze=this.sortFeaturesByKey?G.evaluate(Ee,{},o):void 0,Fe={id:fe,text:Ve,icon:Ie,index:ge,sourceLayerIndex:we,geometry:Ee.geometry,properties:ne.properties,type:Eb[ne.type],sortKey:ze};if(this.features.push(Fe),this.featureAppearanceData.set(ge,{id:fe,properties:ne.properties,usesAppearanceIconAsPlaceholder:Ce}),Ie){const De=Te._unevaluatedLayout._values,{iconPrimary:Ge,iconSecondary:Ze}=su(Ie,this.iconSizeData,De["icon-size"],o,this.zoom,Fe,this.pixelRatio,S,this.worldview,oe);ee(Ge),Ze&&(this.hasAnySecondaryIcon=!0,ee(Ze))}const Be=Te.getAppearances();if(Be.length!==0&&Be.forEach(De=>{if(!De.getLayoutProperty("icon-image"))return;const{iconPrimary:Ge,iconSecondary:Ze}=this.getCombinedIconVariants(De,Te,Ee,o,oe,Fe,S);Ge&&(ee(Ge),Ze&&(this.hasAnySecondaryIcon=!0,ee(Ze)))}),Ve){const De=_.evaluate(Ee,{},o).join(","),Ge=h.get("text-rotation-alignment")==="map"&&h.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.includes(z.vertical);for(const Ze of Ve.sections)if(Ze.image){const Qe=Ze.image.getPrimary().scaleSelf(this.pixelRatio*R),Xe=Qe.id.toString(),rt=H.get(Xe)||[];rt.push(Qe),H.set(Xe,rt)}else{const Qe=ch(Ve.toString()),Xe=Ze.fontStack||De,rt=Z[Xe]=Z[Xe]||{};this.calculateGlyphDependencies(Ze.text,rt,Ge,this.allowVerticalPlacement,Qe)}}}h.get("symbol-placement")==="line"&&(this.features=(function(ie){const ne={},fe={},ge=[];let we=0;function Se(Te){ge.push(ie[Te]),we++}function Ee(Te,Ce,ze){const Fe=fe[Te];return delete fe[Te],fe[Ce]=Fe,ge[Fe].geometry[0].pop(),ge[Fe].geometry[0]=ge[Fe].geometry[0].concat(ze[0]),Fe}function Ve(Te,Ce,ze){const Fe=ne[Ce];return delete ne[Ce],ne[Te]=Fe,ge[Fe].geometry[0].shift(),ge[Fe].geometry[0]=ze[0].concat(ge[Fe].geometry[0]),Fe}function Ie(Te,Ce,ze){const Fe=ze?Ce[0].at(-1):Ce[0][0];return`${Te}:${Fe.x}:${Fe.y}`}for(let Te=0;Te<ie.length;Te++){const Ce=ie[Te],ze=Ce.geometry,Fe=Ce.text?Ce.text.toString():null;if(!Fe||ze.length>1){Se(Te);continue}const Be=Ie(Fe,ze,!1),De=Ie(Fe,ze,!0);if(Be in fe&&De in ne&&fe[Be]!==ne[De]){const Ge=Ve(Be,De,ze),Ze=Ee(Be,De,ge[Ge].geometry);delete ne[Be],delete fe[De],fe[Ie(Fe,ge[Ze].geometry,!0)]=Ze,ge[Ge].geometry=null}else Be in fe?Ee(Be,De,ze):De in ne?Ve(Be,De,ze):(Se(Te),ne[Be]=we-1,fe[De]=we-1)}return ge.filter(Te=>Te.geometry)})(this.features)),h.get("symbol-elevation-reference")==="hd-road-markup"?(this.elevationType="road",this.hdExt&&i.elevationFeatures&&i.elevationFeatures.length>0&&this.hdExt.addElevationFeatures(i.elevationFeatures)):h.get("symbol-z-elevate")&&(this.elevationType="offset"),this.elevationType!=="none"&&(this.zOffsetBuffersNeedUpload=!0),this.sortFeaturesByKey&&this.features.sort((ie,ne)=>ie.sortKey-ne.sortKey)}getCombinedIconVariants(e,i,o,a,c,h,f){let _;if(e.hasLayoutProperty("icon-image")){const y=i.getAppearanceValueAndResolveTokens(e,"icon-image",o,a,c);_=this.getResolvedImageFromTokens(y)}else{const y=i.getValueAndResolveTokens("icon-image",o,a,c);_=this.getResolvedImageFromTokens(y)}if(_){const y=e.hasLayoutProperty("icon-size")?e.getUnevaluatedLayoutProperty("icon-size"):i._unevaluatedLayout._values["icon-size"],v=Re(this.zoom,y,this.worldview,c),{iconPrimary:b,iconSecondary:T}=su(_,v,y,a,this.zoom,h,this.pixelRatio,f,this.worldview,c);return{iconPrimary:b,iconSecondary:T}}return{iconPrimary:void 0,iconSecondary:void 0}}getCombinedIconPrimary(e,i,o,a,c,h,f){return this.getCombinedIconVariants(e,i,o,a,c,h,f).iconPrimary}updateSymbolInstanceIconVertices(e,i,o,a,c,h){const{canonical:f,availableImages:_,globalProperties:y,layer:v,iconScaleFactor:b,featureState:T,layoutIconOffset:S,layoutIconSize:C,layoutIconRotate:P}=h;if(e.placedIconSymbolIndex<0)return{vertexOffsetDelta:0,hasChanges:!1};if(i.activeAppearanceIndex===o)return{vertexOffsetDelta:e.numIconVertices,hasChanges:!1};const R=o>=0?v.appearances[o]:null;if(R){const L={sortKey:void 0,text:void 0,icon:null,index:e.featureIndex,sourceLayerIndex:e.featureIndex,geometry:[],properties:i.properties,type:"Point",id:i.id},{iconPrimary:V,iconSecondary:B}=this.getCombinedIconVariants(R,v,a,f,_,L,b);if(!V)return{vertexOffsetDelta:0,hasChanges:!1};const G=V.toString(),H=this.iconAtlasPositions&&this.iconAtlasPositions.get(G);if(H){const{appearanceIconOffset:Z,appearanceIconRotate:oe}=bn(R,v,a,f,S,P,C,b),X=v.layout.get("icon-anchor").evaluate(a,T,f);let ee=ve(H,B?this.iconAtlasPositions&&this.iconAtlasPositions.get(B.toString()):void 0,Z,X);const ie=H.sdf,ne=v.layout.get("icon-text-fit").constantOr("none");ne!=="none"&&i.textShaping&&i.iconTextFitPadding&&i.fontScale&&(ee=xe(ee,i.textShaping,ne,i.iconTextFitPadding,Z,i.fontScale));const fe=this.calculateEffectiveAppearanceIconSize(R,y.zoom,a,f,_,b,C),ge=0,we=1+(Math.min(au,Math.round(fe*me))<<1),Se=Qr(ee,oe,ie,ne!=="none",b),Ee=this.icon.iconTransitioningVertexArray.length>0;i.isUsingAppearanceIconVertexData||(i.isUsingAppearanceIconVertexData=!0,i.layoutBasedIconVertexData=this.icon.snapshotSymbolVertexData(c,e.numIconVertices),Ee&&(i.layoutBasedIconTransitioningVertexData=this.icon.snapshotIconTransitioningVertexData(c,e.numIconVertices)));const Ve=Math.floor(e.numIconVertices/4),Ie=Math.min(Se.length,Ve);let Te=c;const Ce=Ee?this.icon.iconTransitioningVertexArray.uint16:null;for(let Fe=0;Fe<Ie;++Fe){const Be=Se[Fe],De=i.layoutBasedIconVertexData[0]||e.tileAnchorX,Ge=i.layoutBasedIconVertexData[1]||e.tileAnchorY,Ze=16*Be.pixelOffsetTL.x,Qe=16*Be.pixelOffsetTL.y,Xe=16*Be.pixelOffsetBR.x,rt=16*Be.pixelOffsetBR.y,vt=16*Be.minFontScaleX,ft=16*Be.minFontScaleY;if(this.icon.updateSymbolVertexData(Te,De,Ge,Math.round(32*Be.tl.x),Math.round(32*Be.tl.y),Be.texPrimary.x,Be.texPrimary.y,ge,we,Ze,Qe,vt,ft),this.icon.updateSymbolVertexData(Te+1,De,Ge,Math.round(32*Be.tr.x),Math.round(32*Be.tr.y),Be.texPrimary.x+Be.texPrimary.w,Be.texPrimary.y,ge,we,Xe,Qe,vt,ft),this.icon.updateSymbolVertexData(Te+2,De,Ge,Math.round(32*Be.bl.x),Math.round(32*Be.bl.y),Be.texPrimary.x,Be.texPrimary.y+Be.texPrimary.h,ge,we,Ze,rt,vt,ft),this.icon.updateSymbolVertexData(Te+3,De,Ge,Math.round(32*Be.br.x),Math.round(32*Be.br.y),Be.texPrimary.x+Be.texPrimary.w,Be.texPrimary.y+Be.texPrimary.h,ge,we,Xe,rt,vt,ft),Ce){const xt=Be.texSecondary?Be.texSecondary:Be.texPrimary,mt=2*Te;Ce[mt]=xt.x,Ce[mt+1]=xt.y,Ce[mt+2]=xt.x+xt.w,Ce[mt+3]=xt.y,Ce[mt+4]=xt.x,Ce[mt+5]=xt.y+xt.h,Ce[mt+6]=xt.x+xt.w,Ce[mt+7]=xt.y+xt.h}Te+=4}const ze=e.numIconVertices-4*Ie;for(let Fe=0;Fe<ze;++Fe)this.icon.updateSymbolVertexData(Te+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(c,0,0,0,0,0,0,0,0,0,0,0,0),this.icon.updateSymbolVertexData(c+1,0,0,0,0,0,0,0,0,0,0,0,0),this.icon.updateSymbolVertexData(c+2,0,0,0,0,0,0,0,0,0,0,0,0),this.icon.updateSymbolVertexData(c+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(c,i.layoutBasedIconVertexData),i.layoutBasedIconTransitioningVertexData&&this.icon.restoreIconTransitioningVertexData(c,i.layoutBasedIconTransitioningVertexData),i.isUsingAppearanceIconVertexData=!1,{vertexOffsetDelta:i.layoutBasedIconVertexData.length/$h,hasChanges:!0}}return{vertexOffsetDelta:e.numIconVertices,hasChanges:!1}}updateSymbolInstanceTextVertices(e,i,o,a,c,h){const{canonical:f,layer:_,textScaleFactor:y,imageMap:v,featureState:b,layoutTextOffset:T,layoutTextSize:S,layoutTextRotate:C,layoutMinZoomSize:P,layoutMaxZoomSize:R,layoutTextSizeMinZoom:L,layoutTextSizeMaxZoom:V,availableImages:B}=h,G=e.numHorizontalGlyphVertices>0||e.numVerticalGlyphVertices>0;if(!G)return{vertexOffsetDelta:G?e.numHorizontalGlyphVertices+e.numVerticalGlyphVertices:0,hasChanges:!1};if(i.activeAppearanceIndex===o)return{vertexOffsetDelta:e.numHorizontalGlyphVertices+e.numVerticalGlyphVertices,hasChanges:!1};const H=o>=0?_.appearances[o]:null;if(H&&i.textShaping){const{appearanceTextOffset:Z,appearanceTextRotate:oe,appearanceTextSize:X}=Qo(H,_,a,f,T,C,S);i.fontScale=zx(X,i.textScaleFactor);const ee=H.getUnevaluatedLayoutProperty("text-size");let ie=this.textSizeData,ne=L,fe=V;H.hasLayoutProperty("text-size")&&(ie=Re(this.zoom,ee,this.worldview,B),ne=this.textSizeData.kind==="composite"?this.textSizeData.minZoom:0,fe=this.textSizeData.kind==="composite"?this.textSizeData.maxZoom:0);const ge=i.textShaping.bottom-T[1],we=i.textShaping.left-T[0],Se=i.textShaping.right-T[0];i.textShaping.top=Z[1]+(i.textShaping.top-T[1]),i.textShaping.bottom=Z[1]+ge,i.textShaping.left=Z[0]+we,i.textShaping.right=Z[0]+Se;const Ee=Bt(0,i.textShaping,Z,_,!1,a,v,this.allowVerticalPlacement,oe),Ve=X&&ie.kind==="composite"?ee.possiblyEvaluate(new oi(ne,{}),f).evaluate(a,b,f):P,Ie=X&&ie.kind==="composite"?ee.possiblyEvaluate(new oi(fe,{}),f).evaluate(a,b,f):R,Te=wy(H.name,ie,X,y,Ve,Ie),Ce=Array.isArray(Te)?Te[1]:X,ze=0,Fe=1+(Math.min(au,Math.round(Ce*me))<<1);i.isUsingAppearanceTextVertexData||(i.isUsingAppearanceTextVertexData=!0,i.layoutBasedTextVertexData=this.text.snapshotSymbolVertexData(c,e.numHorizontalGlyphVertices+e.numVerticalGlyphVertices));for(let Be=0;Be<Ee.length&&Be<(e.numHorizontalGlyphVertices+e.numVerticalGlyphVertices)/4;++Be){const De=Ee[Be],Ge=De.glyphOffset[1],Ze=e.tileAnchorX,Qe=e.tileAnchorY,Xe=c+4*Be;this.text.updateSymbolVertexData(Xe,Ze,Qe,Math.round(32*De.tl.x),Math.round(32*(Ge+De.tl.y)),De.texPrimary.x,De.texPrimary.y,ze,Fe,De.pixelOffsetTL.x,De.pixelOffsetTL.y,De.minFontScaleX,De.minFontScaleY),this.text.updateSymbolVertexData(Xe+1,Ze,Qe,Math.round(32*De.tr.x),Math.round(32*(Ge+De.tr.y)),De.texPrimary.x+De.texPrimary.w,De.texPrimary.y,ze,Fe,De.pixelOffsetBR.x,De.pixelOffsetTL.y,De.minFontScaleX,De.minFontScaleY),this.text.updateSymbolVertexData(Xe+2,Ze,Qe,Math.round(32*De.bl.x),Math.round(32*(Ge+De.bl.y)),De.texPrimary.x,De.texPrimary.y+De.texPrimary.h,ze,Fe,De.pixelOffsetTL.x,De.pixelOffsetBR.y,De.minFontScaleX,De.minFontScaleY),this.text.updateSymbolVertexData(Xe+3,Ze,Qe,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,Fe,De.pixelOffsetBR.x,De.pixelOffsetBR.y,De.minFontScaleX,De.minFontScaleY)}return{vertexOffsetDelta:e.numHorizontalGlyphVertices+e.numVerticalGlyphVertices,hasChanges:!0}}return i.isUsingAppearanceTextVertexData?(this.text.restoreSymbolVertexData(c,i.layoutBasedTextVertexData),i.isUsingAppearanceTextVertexData=!1,{vertexOffsetDelta:i.layoutBasedTextVertexData.length/$h,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,o,a,c,h,f,_){if(this.text.uboBinder||this.text.programConfigurations.updatePaintArrays(e,i,c,o,a,h,f,this.worldview),this.icon.uboBinder||this.icon.programConfigurations.updatePaintArrays(e,i,c,o,a,h,f,this.worldview),_){if(h)for(const y of[this.text.uboBinder,this.icon.uboBinder])y&&!y.isLightConstant&&y.updateDynamicExpressions(c[0],i,_,o,e,f);else if(Object.keys(e).length>0){const y=c[0],v=[this.text.uboBinder,this.icon.uboBinder].filter(b=>b&&b.hasStateDependentPaint(y));if(v.length>0){const b=new Set(Object.keys(e).map(T=>{const S=Number(T);return!isNaN(S)&&Number.isSafeInteger(S)&&String(S)===T?S:T}));for(const T of v)T.updateFeatures(b,y,i,_,o,e,f)}}}}updateZOffset(){const e=(c,h,f)=>{o+=h,o>c.length&&c.resize(o);for(let _=-h;_<0;_++)c.emplace(_+o,f)},i=(c,h,f)=>{a+=h,a>c.length&&c.resize(a);for(let _=-h;_<0;_++)c.emplace(_+a,f)};if(!this.zOffsetBuffersNeedUpload)return;this.zOffsetBuffersNeedUpload=!1;let o=0,a=0;for(let c=0;c<this.symbolInstances.length;c++){const h=this.symbolInstances.get(c),{numHorizontalGlyphVertices:f,numVerticalGlyphVertices:_,numIconVertices:y}=h,v=h.zOffset,b=y>0;if((f>0||_>0)&&(e(this.text.zOffsetVertexArray,f,v),e(this.text.zOffsetVertexArray,_,v)),b){const{placedIconSymbolIndex:T,verticalPlacedIconSymbolIndex:S}=h;T>=0&&i(this.icon.zOffsetVertexArray,y,v),S>=0&&i(this.icon.zOffsetVertexArray,h.numVerticalIconVertices,v)}}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,o,a,c){!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(h=>h.appearances&&h.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,o,a,c,h=!1){const f={hasLayoutChanges:!1,hasUboChanges:!1};if(!e||!o||!this.featureAppearanceData)return f;const _=i||{},y=this.icon.layoutVertexArray&&this.icon.layoutVertexArray.length>0&&this.icon.layoutVertexArray.arrayBuffer,v=this.text.layoutVertexArray&&this.text.layoutVertexArray.length>0&&this.text.layoutVertexArray.arrayBuffer;if(!y&&!v)return f;const b=this.layers[0],T=b.layout;this.featureAppearances&&this.featureAppearances.appearancesVersion===b.appearancesVersion||(this.featureAppearances=new Tb(b.appearances,b.appearancesVersion));const S=this.featureAppearances.update(a,h);if(S.kind==="no-changes")return f;let C=1,P=0,R=!1,L=!1;if(y){const[oe,X]=T.get("icon-size-scale-range");C=te(1,oe,X)}let V=1,B=0,G=!1;if(v){const[oe,X]=T.get("text-size-scale-range");V=te(1,oe,X)}const H=new Map;if(c&&o)for(const oe of o){const X=c.getImage(oe,b.scope);if(X){const ee=new Vr(oe.toString());H.set(ee.toString(),X)}}const Z=[this.text.uboBinder,this.icon.uboBinder];for(let oe=0;oe<this.symbolInstances.length;oe++){const X=this.symbolInstances.get(oe),ee=this.getAppearanceFeatureData(X.featureIndex);if(!ee)continue;const ie=ee.id,ne=ie!==void 0?_[String(ie)]:void 0,fe={type:"Point",id:ee.id,properties:ee.properties,geometry:[]};let ge;if(S.kind==="all-features")ge=S.appearanceIndex;else{const Se=b.appearances?b.appearances.findIndex(Ee=>Ee.isActive({globals:a,feature:fe,canonical:e,featureState:ne})):-1;ge=Se>=0?Se:-1}const we=ee.activeAppearanceIndex!==ge;if(v){const Se=T.get("text-size"),Ee=this.textSizeData.kind==="composite"?this.textSizeData.minZoom:0,Ve=this.textSizeData.kind==="composite"?this.textSizeData.maxZoom:0,Ie={canonical:e,layer:b,featureState:ne,availableImages:o,textScaleFactor:V,imageMap:H,layoutTextOffset:T.get("text-offset").evaluate(fe,ne,e).map(Ce=>Ce*fr),layoutTextSize:Se.evaluate(fe,ne,e),layoutTextRotate:T.get("text-rotate").evaluate(fe,ne,e),layoutMinZoomSize:Se.evaluate(fe,{zoom:Ee},e),layoutMaxZoomSize:Se.evaluate(fe,{zoom:Ve},e),layoutTextSizeMinZoom:Ee,layoutTextSizeMaxZoom:Ve},Te=this.updateSymbolInstanceTextVertices(X,ee,ge,fe,B,Ie);B+=Te.vertexOffsetDelta,G=G||Te.hasChanges}if(y){const Se={canonical:e,layer:b,featureState:ne,availableImages:o,globalProperties:a,iconScaleFactor:C,layoutIconOffset:T.get("icon-offset").evaluate(fe,ne,e),layoutIconSize:T.get("icon-size").evaluate(fe,ne,e,o),layoutIconRotate:T.get("icon-rotate").evaluate(fe,ne,e)},Ee=this.updateSymbolInstanceIconVertices(X,ee,ge,fe,P,Se);P+=Ee.vertexOffsetDelta,R=R||Ee.hasChanges}if(we){const Se=X.featureIndex,Ee=a?a.brightness:null,Ve=ne||{},Ie=ge>=0?b.appearances[ge]:null;for(const Te of Z)Te&&(Te.layer=b,L=Te.updateFeaturePaintForAppearance(Se,fe,Ve,e,o,Ee,Ie)||L)}ee.activeAppearanceIndex=ge}return R&&this.icon.layoutVertexBuffer&&this.icon.layoutVertexArray.arrayBuffer!==null&&this.icon.layoutVertexArray.length===this.icon.layoutVertexBuffer.length&&this.icon.layoutVertexBuffer.updateData(this.icon.layoutVertexArray),R&&this.icon.iconTransitioningVertexBuffer&&this.icon.iconTransitioningVertexArray.length>0&&this.icon.iconTransitioningVertexArray.length===this.icon.iconTransitioningVertexBuffer.length&&this.icon.iconTransitioningVertexBuffer.updateData(this.icon.iconTransitioningVertexArray),G&&this.text.layoutVertexBuffer&&this.text.layoutVertexArray.arrayBuffer!==null&&this.text.layoutVertexArray.length===this.text.layoutVertexBuffer.length&&this.text.layoutVertexBuffer.updateData(this.text.layoutVertexArray),{hasLayoutChanges:R||G,hasUboChanges:L}}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}getProjection(){return this.projectionInstance||(this.projectionInstance=Jx(this.projection)),this.projectionInstance}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(e,i){const o=this.lineVertexArray.length;if(e.segment!==void 0)for(const{x:a,y:c}of i)this.lineVertexArray.emplaceBack(a,c);return{lineStartIndex:o,lineLength:this.lineVertexArray.length-o}}addSymbols(e,i,o,a,c,h,f,_,y,v,b,T,S,C,P,R,L,V){const B=e.indexArray,G=e.layoutVertexArray,H=e.globeExtVertexArray,Z=V,oe=e.uboBinder?e.uboBinder.getCurrentBatchIndex():void 0,X=e.segments.prepareSegment(4*Z,G,B,this.canOverlap?h.sortKey:void 0,oe),ee=this.glyphOffsetArray.length,ie=X.vertexLength,ne=this.allowVerticalPlacement&&f===z.vertical?Math.PI/2:0,fe=h.text&&h.text.sections;let ge=G.length,we=-1;for(let Ve=0;Ve<i.length;Ve++){const{tl:Ie,tr:Te,bl:Ce,br:ze,texPrimary:Fe,texSecondary:Be,pixelOffsetTL:De,pixelOffsetBR:Ge,minFontScaleX:Ze,minFontScaleY:Qe,glyphOffset:Xe,isSDF:rt,sectionIndex:vt}=i[Ve],ft=X.vertexLength,xt=Xe[1];if(pp(G,y.x,y.y,Ie.x,xt+Ie.y,Fe.x,Fe.y,o,rt,De.x,De.y,Ze,Qe),pp(G,y.x,y.y,Te.x,xt+Te.y,Fe.x+Fe.w,Fe.y,o,rt,Ge.x,De.y,Ze,Qe),pp(G,y.x,y.y,Ce.x,xt+Ce.y,Fe.x,Fe.y+Fe.h,o,rt,De.x,Ge.y,Ze,Qe),pp(G,y.x,y.y,ze.x,xt+ze.y,Fe.x+Fe.w,Fe.y+Fe.h,o,rt,Ge.x,Ge.y,Ze,Qe),_){const{x:mt,y:Rt,z:ut}=_.anchor,[Gt,Nt,Wt]=_.up;_p(H,mt,Rt,ut,Gt,Nt,Wt),_p(H,mt,Rt,ut,Gt,Nt,Wt),_p(H,mt,Rt,ut,Gt,Nt,Wt),_p(H,mt,Rt,ut,Gt,Nt,Wt),Hh(e.dynamicLayoutVertexArray,mt,Rt,ut,ne)}else Hh(e.dynamicLayoutVertexArray,y.x,y.y,y.z,ne);if(R){const mt=Be||Fe;mp(e.iconTransitioningVertexArray,mt.x,mt.y),mp(e.iconTransitioningVertexArray,mt.x+mt.w,mt.y),mp(e.iconTransitioningVertexArray,mt.x,mt.y+mt.h),mp(e.iconTransitioningVertexArray,mt.x+mt.w,mt.y+mt.h)}if(B.emplaceBack(ft,ft+1,ft+2),B.emplaceBack(ft+1,ft+2,ft+3),X.vertexLength+=4,X.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(Xe[0]),(Ve===i.length-1||vt!==i[Ve+1].sectionIndex)&&(e.uboBinder||e.programConfigurations.populatePaintArrays(G.length,h,h.index,{},S,C,P,fe&&fe[vt],this.worldview),e.uboBinder)){const mt=e.uboBinder.populateUBO(h,h.index,C,S,P,fe&&fe[vt]);we=mt;const Rt=G.length-ge;for(let ut=0;ut<Rt;ut++)e.featureIdArray.emplaceBack(mt);ge=G.length}}const Se=V-i.length;if(Se!==0&&(this._addNullVertices(Se,G,o,_,H,e,R,X,B),e.uboBinder&&we>=0)){const Ve=4*Se;for(let Ie=0;Ie<Ve;Ie++)e.featureIdArray.emplaceBack(we)}const Ee=_?_.anchor:y;e.placedSymbolArray.emplaceBack(Ee.x,Ee.y,Ee.z,y.x,y.y,ee,this.glyphOffsetArray.length-ee,ie,v,b,y.segment,o?o[0]:0,o?o[1]:0,a[0],a[1],f,0,0,0,T,0),e.symbolInstanceIndices.push(L)}_addNullVertices(e,i,o,a,c,h,f,_,y){for(let v=0;v<e;v++){for(let T=0;T<4;T++)pp(i,0,0,0,0,0,0,o,!1,0,0,0,0),a&&_p(c,0,0,0,0,0,0),Hh(h.dynamicLayoutVertexArray,0,0,0,0),f&&mp(h.iconTransitioningVertexArray,0,0);const b=_.vertexLength;y.emplaceBack(b,b+1,b+2),y.emplaceBack(b+1,b+2,b+3),_.vertexLength+=4,_.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(0)}}_commitLayoutVertex(e,i,o,a,c,h,f){e.emplaceBack(i,o,a,c,h,Math.round(f.x),Math.round(f.y))}_addCollisionDebugVertices(e,i,o,a,c,h,f){const _=o.segments.prepareSegment(4,o.layoutVertexArray,o.indexArray),y=_.vertexLength,v=f.tileAnchorX,b=f.tileAnchorY;for(let S=0;S<4;S++)o.collisionVertexArray.emplaceBack(0,0,0,0,0,0);this._commitDebugCollisionVertexUpdate(o.collisionVertexArrayExt,i,e.padding,f.zOffset),this._commitLayoutVertex(o.layoutVertexArray,a,c,h,v,b,new Ne(e.x1,e.y1)),this._commitLayoutVertex(o.layoutVertexArray,a,c,h,v,b,new Ne(e.x2,e.y1)),this._commitLayoutVertex(o.layoutVertexArray,a,c,h,v,b,new Ne(e.x2,e.y2)),this._commitLayoutVertex(o.layoutVertexArray,a,c,h,v,b,new Ne(e.x1,e.y2)),_.vertexLength+=4;const T=o.indexArray;T.emplaceBack(y,y+1),T.emplaceBack(y+1,y+2),T.emplaceBack(y+2,y+3),T.emplaceBack(y+3,y),_.primitiveLength+=4}_addTextDebugCollisionBoxes(e,i,o,a,c,h){for(let f=a;f<c;f++){const _=o.get(f),y=this.getSymbolInstanceTextSize(e,h,i,f);this._addCollisionDebugVertices(_,y,this.textCollisionBox,_.projectedAnchorX,_.projectedAnchorY,_.projectedAnchorZ,h)}}_addIconDebugCollisionBoxes(e,i,o,a,c,h){for(let f=a;f<c;f++){const _=o.get(f),y=this.getSymbolInstanceIconSize(e,i,h.placedIconSymbolIndex);this._addCollisionDebugVertices(_,y,this.iconCollisionBox,_.projectedAnchorX,_.projectedAnchorY,_.projectedAnchorZ,h)}}generateCollisionDebugBuffers(e,i,o){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new By(bh,ip.members,fo),this.iconCollisionBox=new By(bh,ip.members,fo);
vendor: 5,135 bytes, line 7
7const a=Ae(this.iconSizeData,e),c=Ae(this.textSizeData,e,o);for(let h=0;h<this.symbolInstances.length;h++){const f=this.symbolInstances.get(h);this._addTextDebugCollisionBoxes(c,e,i,f.textBoxStartIndex,f.textBoxEndIndex,f),this._addTextDebugCollisionBoxes(c,e,i,f.verticalTextBoxStartIndex,f.verticalTextBoxEndIndex,f),this._addIconDebugCollisionBoxes(a,e,i,f.iconBoxStartIndex,f.iconBoxEndIndex,f),this._addIconDebugCollisionBoxes(a,e,i,f.verticalIconBoxStartIndex,f.verticalIconBoxEndIndex,f)}}getSymbolInstanceTextSize(e,i,o,a){const c=this.text.placedSymbolArray.get(i.rightJustifiedTextSymbolIndex>=0?i.rightJustifiedTextSymbolIndex:i.centerJustifiedTextSymbolIndex>=0?i.centerJustifiedTextSymbolIndex:i.leftJustifiedTextSymbolIndex>=0?i.leftJustifiedTextSymbolIndex:i.verticalPlacedTextSymbolIndex>=0?i.verticalPlacedTextSymbolIndex:a),h=Me(this.textSizeData,e,c)/fr;return this.tilePixelRatio*h}getSymbolInstanceIconSize(e,i,o){const a=this.icon.placedSymbolArray.get(o),c=Me(this.iconSizeData,e,a);return this.tilePixelRatio*c}_commitDebugCollisionVertexUpdate(e,i,o,a){e.emplaceBack(i,-o,-o,a),e.emplaceBack(i,o,-o,a),e.emplaceBack(i,o,o,a),e.emplaceBack(i,-o,o,a)}_updateTextDebugCollisionBoxes(e,i,o,a,c,h,f){for(let _=a;_<c;_++){const y=o.get(_),v=this.getSymbolInstanceTextSize(e,h,i,_);this._commitDebugCollisionVertexUpdate(this.textCollisionBox.collisionVertexArrayExt,v,y.padding,h.zOffset)}}_updateIconDebugCollisionBoxes(e,i,o,a,c,h,f){for(let _=a;_<c;_++){const y=o.get(_),v=this.getSymbolInstanceIconSize(e,i,h.placedIconSymbolIndex);this._commitDebugCollisionVertexUpdate(this.iconCollisionBox.collisionVertexArrayExt,v,y.padding,h.zOffset)}}updateCollisionDebugBuffers(e,i,o,a){if(!this.hasDebugData())return;this.hasTextCollisionBoxData()&&this.textCollisionBox.collisionVertexArrayExt.clear(),this.hasIconCollisionBoxData()&&this.iconCollisionBox.collisionVertexArrayExt.clear();const c=Ae(this.iconSizeData,e,a),h=Ae(this.textSizeData,e,o);for(let f=0;f<this.symbolInstances.length;f++){const _=this.symbolInstances.get(f);this._updateTextDebugCollisionBoxes(h,e,i,_.textBoxStartIndex,_.textBoxEndIndex,_,o),this._updateTextDebugCollisionBoxes(h,e,i,_.verticalTextBoxStartIndex,_.verticalTextBoxEndIndex,_,o),this._updateIconDebugCollisionBoxes(c,e,i,_.iconBoxStartIndex,_.iconBoxEndIndex,_,a),this._updateIconDebugCollisionBoxes(c,e,i,_.verticalIconBoxStartIndex,_.verticalIconBoxEndIndex,_,a)}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,o,a,c,h,f,_,y){const v={};if(i<o){const{x1:b,y1:T,x2:S,y2:C,padding:P,projectedAnchorX:R,projectedAnchorY:L,projectedAnchorZ:V,tileAnchorX:B,tileAnchorY:G,featureIndex:H}=e.get(i);v.textBox={x1:b,y1:T,x2:S,y2:C,padding:P,projectedAnchorX:R,projectedAnchorY:L,projectedAnchorZ:V,tileAnchorX:B,tileAnchorY:G},v.textFeatureIndex=H}if(a<c){const{x1:b,y1:T,x2:S,y2:C,padding:P,projectedAnchorX:R,projectedAnchorY:L,projectedAnchorZ:V,tileAnchorX:B,tileAnchorY:G,featureIndex:H}=e.get(a);v.verticalTextBox={x1:b,y1:T,x2:S,y2:C,padding:P,projectedAnchorX:R,projectedAnchorY:L,projectedAnchorZ:V,tileAnchorX:B,tileAnchorY:G},v.verticalTextFeatureIndex=H}if(h<f){const{x1:b,y1:T,x2:S,y2:C,padding:P,projectedAnchorX:R,projectedAnchorY:L,projectedAnchorZ:V,tileAnchorX:B,tileAnchorY:G,featureIndex:H}=e.get(h);v.iconBox={x1:b,y1:T,x2:S,y2:C,padding:P,projectedAnchorX:R,projectedAnchorY:L,projectedAnchorZ:V,tileAnchorX:B,tileAnchorY:G},v.iconFeatureIndex=H}if(_<y){const{x1:b,y1:T,x2:S,y2:C,padding:P,projectedAnchorX:R,projectedAnchorY:L,projectedAnchorZ:V,tileAnchorX:B,tileAnchorY:G,featureIndex:H}=e.get(_);v.verticalIconBox={x1:b,y1:T,x2:S,y2:C,padding:P,projectedAnchorX:R,projectedAnchorY:L,projectedAnchorZ:V,tileAnchorX:B,tileAnchorY:G},v.verticalIconFeatureIndex=H}return v}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let i=0;i<this.symbolInstances.length;i++){const o=this.symbolInstances.get(i);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,o.textBoxStartIndex,o.textBoxEndIndex,o.verticalTextBoxStartIndex,o.verticalTextBoxEndIndex,o.iconBoxStartIndex,o.iconBoxEndIndex,o.verticalIconBoxStartIndex,o.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 o=e.placedSymbolArray.get(i),a=o.vertexStartIndex+4*o.numGlyphs;for(let c=o.vertexStartIndex;c<a;c+=4)e.indexArray.emplaceBack(c,c+1,c+2),e.indexArray.emplaceBack(c+1,c+2,c+3)}
vendor: 152,794 bytes, line 7
7getSortedSymbolIndexes(e){if(this.sortedAngle===e&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const i=Math.sin(e),o=Math.cos(e),a=[],c=[],h=[];for(let f=0;f<this.symbolInstances.length;++f){h.push(f);const _=this.symbolInstances.get(f);a.push(0|Math.round(i*_.tileAnchorX+o*_.tileAnchorY)),c.push(_.featureIndex)}return h.sort((f,_)=>a[f]-a[_]||c[_]-c[f]),h}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 o=this.sortKeyRanges.at(-1);o&&o.sortKey===i?o.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.sortFeaturesByY=!1;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 o=this.symbolInstances.get(i);this.featureSortOrder.push(o.featureIndex);const{rightJustifiedTextSymbolIndex:a,centerJustifiedTextSymbolIndex:c,leftJustifiedTextSymbolIndex:h,verticalPlacedTextSymbolIndex:f,placedIconSymbolIndex:_,verticalPlacedIconSymbolIndex:y}=o;a>=0&&this.addIndicesForPlacedSymbol(this.text,a),c>=0&&c!==a&&this.addIndicesForPlacedSymbol(this.text,c),h>=0&&h!==c&&h!==a&&this.addIndicesForPlacedSymbol(this.text,h),f>=0&&this.addIndicesForPlacedSymbol(this.text,f),_>=0&&this.addIndicesForPlacedSymbol(this.icon,_),y>=0&&this.addIndicesForPlacedSymbol(this.icon,y)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}Je(z_,"SymbolBucket",{omit:["layers","collisionBoxArray","compareText","features"]}),z_.addDynamicAttributes=Hh;class ov extends $f{constructor(e,i,o){super(e,i,o),this.elevatedLayoutVertexArray=new Ko}upload(e){const i=this.uploaded;super.upload(e),!i&&this.elevatedLayoutVertexArray.length>0&&(this.elevatedLayoutVertexBuffer=e.createVertexBuffer(this.elevatedLayoutVertexArray,Km.members))}destroy(){this.elevatedLayoutVertexBuffer&&this.elevatedLayoutVertexBuffer.destroy(),super.destroy()}}Je(ov,"ElevatedFillBufferData");class Xa{constructor(){this.portals=[]}static isOnBorder(e,i){return e<=0&&i<=0||e>=Ke&&i>=Ke}static evaluate(e){if(e.length===0)return new Xa;let i=[];for(const _ of e)i.push(..._.portals);if(i.length===0)return new Xa;for(const _ of i){const y=_.va,v=_.vb;(Xa.isOnBorder(y.x,v.x)||Xa.isOnBorder(y.y,v.y))&&(_.type="border")}const o=i.filter(_=>_.type!=="unevaluated"),a=i.filter(_=>_.type==="unevaluated");if(a.length===0)return new Xa;a.sort((_,y)=>_.hash===y.hash?_.isTunnel===y.isTunnel?0:_.isTunnel?-1:1:_.hash<y.hash?1:-1),i=o.concat(a);let c=o.length,h=c,f=c;do if(h++,h===i.length||i[c].hash!==i[h].hash){if(h-c===2){f<c&&(i[f]=i[c],i[c]=null);const _=i[f],y=i[h-1];_.type=_.isTunnel!==y.isTunnel?"tunnel":"polygon",_.connection={a:_.connection.a,b:y.connection.a},f++}c=h}while(c!==i.length);return i.splice(f),i.sort((_,y)=>_.hash<y.hash?1:-1),{portals:i}}}Je(Xa,"ElevationPortalGraph");class Ab{constructor(e,i,o){this.outPositions=e,this.outNormals=i,this.outIndices=o,this.vertexLookup=new Map}addVertex(e,i,o){let a=e[2];o!=null&&(a*=o);const c=`${e[0]},${e[1]},${e[2]},${i[0]},${i[1]},${i[2]}`,h=this.vertexLookup.get(c);if(h!=null)return h;const f=this.outPositions.length;this.vertexLookup.set(c,f);const _=Math.trunc(16384*i[0]),y=Math.trunc(16384*i[1]),v=Math.trunc(16384*i[2]);return this.outPositions.emplaceBack(e[0],e[1],a),this.outNormals.emplaceBack(_,y,v),f}addTriangle(e,i,o){this.outIndices.emplaceBack(e,i,o)}addTriangles(e,i,o,a=0){if(e.length===0)return;const c=ti(),h=ti();for(let f=0;f<e.length;f+=3){const _=i[e[f+0]],y=i[e[f+1]],v=i[e[f+2]],b=o[e[f+1]]+a,T=o[e[f+2]]+a;Di(c,_.x,_.y,o[e[f+0]]+a);const S=this.addVertex(c,h);Di(c,y.x,y.y,b);const C=this.addVertex(c,h);Di(c,v.x,v.y,T);const P=this.addVertex(c,h);this.outIndices.emplaceBack(S,C,P)}}addQuad(e,i,o,a,c,h){const f=this.addVertex(e,c,h),_=this.addVertex(i,c,h),y=this.addVertex(o,c,h),v=this.addVertex(a,c,h);this.addTriangle(f,_,y),this.addTriangle(y,v,f)}getVertexCount(){return this.outPositions.length}clearVertexLookup(){this.vertexLookup.clear()}}class Xn{constructor(e,i,o,a){this.unevaluatedPortals=new Xa,this.bridgeFeatureSections=[],this.tunnelFeatureSections=[],this.vertexHashLookup=new Map,this.unevalVertices=[],this.unevalHeights=[],this.unevalTriangles=[],this.unevalTunnelTriangles=[],this.unevalEdges=[],this.vertexPositions=new Af,this.vertexNormals=new xh,this.indexArray=new Mr,this.tileToMeters=zn(e),this.bridgeProgramConfigurations=new _o(i,{zoom:o,lut:a},c=>c!=="fill-tunnel-structure-color"),this.tunnelProgramConfigurations=new _o(i,{zoom:o,lut:a},c=>c!=="fill-bridge-guard-rail-color")}addVertices(e,i){const o=this.unevalVertices.length;for(let a=0;a<e.length;a++)this.unevalVertices.push(e[a]),this.unevalHeights.push(i[a]);return o}addTriangles(e,i,o){const a=o?this.unevalTunnelTriangles:this.unevalTriangles;for(const c of e)a.push(c+i)}addRenderableRing(e,i,o,a,c,h){const f=[new Ne(c.min.x,c.min.y),new Ne(c.max.x,c.min.y),new Ne(c.max.x,c.max.y),new Ne(c.min.x,c.max.y)];for(let _=0;_<o-1;_++){const y=i+_,v=y+1,b=this.unevalVertices[y],T=this.unevalVertices[v];if(!(b.x>=c.min.x&&b.x<=c.max.x&&b.y>=c.min.y&&b.y<=c.max.y||T.x>=c.min.x&&T.x<=c.max.x&&T.y>=c.min.y&&T.y<=c.max.y||Ha(b,T,f))||this.isOnBorder(b.x,T.x)||this.isOnBorder(b.y,T.y))continue;const S=Xn.computeEdgeHash(this.unevalVertices[y],this.unevalVertices[v]);let C,P=this.vertexHashLookup.get(Xn.computePosHash(b));P!=null?C=P.next:(P=this.vertexHashLookup.get(Xn.computePosHash(T)),C=P!=null?P.prev:S),this.unevalEdges.push({polygonIdx:e,a:y,b:v,hash:S,portalHash:C,isTunnel:a,type:"unevaluated",featureInfo:h})}}addPortalCandidates(e,i,o,a,c){if(i.length!==0){this.vertexHashLookup.clear();for(const h of i){if(h.length===0)continue;const f=h[0];let _=Xn.computeEdgeHash(f[f.length-2],f.at(-1));for(let y=0;y<f.length-1;y++){const v=f[y+0],b=f[y+1],T=Eo(b.x-v.x,b.y-v.y),S=os(T);if(S===0)continue;let C="unevaluated";const P=a.pointElevation(v),R=a.pointElevation(b);Math.abs(P)<.01&&Math.abs(R)<.01?C="entrance":(this.isOnBorder(v.x,b.x)||this.isOnBorder(v.y,b.y))&&(C="border");const L=Xn.computeEdgeHash(v,b);this.unevaluatedPortals.portals.push({connection:{a:e,b:void 0},va:v,vb:b,vab:T,length:S,hash:L,isTunnel:o,type:C});const V=Xn.computePosHash(v);this.vertexHashLookup.set(V,{prev:_,next:L}),_=L}}}}construct(e){if(this.unevalVertices.length===0)return;const i=()=>({vertexOffset:0,primitiveOffset:this.indexArray.length}),o=T=>{T.primitiveLength=this.indexArray.length-T.primitiveOffset},a=new Ab(this.vertexPositions,this.vertexNormals,this.indexArray);this.prepareEdges(e.portals,this.unevalEdges);const c=i(),h=i(),f=i(),_=(T,S)=>{T.sort((P,R)=>P.type===S&&R.type!==S?-1:P.type!==S&&R.type===S?1:0);const C=T.findIndex(P=>P.type!==S);return C>=0?C:T.length};let y=0;this.unevalEdges.length>0&&(y=_(this.unevalEdges,"none"),this.constructBridgeStructures(a,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:y},this.tileToMeters)),o(f);const v=i(),b=i();if(this.unevalEdges.length>0){const T=this.unevalEdges.splice(y),S=_(T,"tunnel")+y;this.unevalEdges.push(...T),this.constructTunnelStructures(a,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:y},{min:y,max:S})}o(v),a.addTriangles(this.unevalTriangles,this.unevalVertices,this.unevalHeights),o(b),a.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,this.unevalHeights),o(h),a.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,this.unevalHeights,4),o(c),this.maskSegments=wi.simpleSegment(0,b.primitiveOffset,0,b.primitiveLength),this.depthSegments=wi.simpleSegment(0,h.primitiveOffset,0,h.primitiveLength),this.renderableBridgeSegments=wi.simpleSegment(0,f.primitiveOffset,0,f.primitiveLength),this.renderableTunnelSegments=wi.simpleSegment(0,v.primitiveOffset,0,v.primitiveLength),this.shadowCasterSegments=wi.simpleSegment(0,c.primitiveOffset,0,c.primitiveLength)}update(e,i,o,a,c,h,f,_){this.bridgeProgramConfigurations.updatePaintArrays(e,i,c,o,a,h,f,_),this.tunnelProgramConfigurations.updatePaintArrays(e,i,c,o,a,h,f,_)}upload(e){this.vertexBuffer||this.vertexPositions.length===0||this.vertexNormals.length===0||this.indexArray.length===0||(this.vertexBuffer=e.createVertexBuffer(this.vertexPositions,jf.members),this.vertexBufferNormal=e.createVertexBuffer(this.vertexNormals,$g.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,o,a,c){const h=(f,_)=>{for(let y=0;y<_.length-1;y++){const v=_[y].featureIndex,b=_[y+1].vertexStart,T=e.feature(v);f.populatePaintArrays(b,T,v,{},o,i,a,void 0,c)}};h(this.bridgeProgramConfigurations,this.bridgeFeatureSections),h(this.tunnelProgramConfigurations,this.tunnelFeatureSections)}computeVertexConnections(e,i,o,a,c){const h=new Map;for(let f=a;f<c;f++){const _=o[f],y=_.a,v=_.b,b=Xn.computePosHash(e[y]),T=Xn.computePosHash(e[v]);let S=h.get(b);S||(S={},h.set(b,S));let C=h.get(T);C||(C={},h.set(T,C)),i[y]<=0&&i[v]<=0||(S.to=v,C.from=y)}return h}isTerminalVertex(e,i){const o=Xn.computePosHash(this.unevalVertices[e]),a=i.get(o);return!a||!a.from||!a.to}constructBridgeStructures(e,i,o,a,c,h){e.clearVertexLookup();const f=this.computeVertexConnections(i,o,a,c.min,c.max),_=1/h,y=.5*_,v=(Se,Ee)=>Di(Se,i[Ee].x,i[Ee].y,o[Ee]*_),b=ti(),T=ti(),S=ti(),C=ti(),P=ti(),R=(Se,Ee)=>{const Ve=f.get(Xn.computePosHash(i[Ee])),Ie=Ve.from,Te=Ve.to;if(!Ie||!Te)return;v(b,Ie),v(T,Ee),v(S,Te),al(C),is(b,T)||(or(P,T,b),bi(C,P)),is(S,T)||(or(P,S,T),gr(C,C,bi(P,P)));const Ce=rs(C);return Ce>0?mi(Se,C,1/Ce):void 0};let L=Number.POSITIVE_INFINITY;this.sortSubarray(a,c.min,c.max,(Se,Ee)=>Se.featureInfo.featureIndex-Ee.featureInfo.featureIndex);const V=ti(),B=ti(),G=ti(),H=ti(),Z=ti(),oe=ti(),X=ti(),ee=ti(),ie=ti(),ne=[ti(),ti(),ti(),ti()],fe=[ti(),ti(),ti(),ti()],ge=[{coord:new Ne(0,0),height:0},{coord:new Ne(0,0),height:0}],we=(Se,Ee)=>Se>Ee;for(let Se=c.min;Se<c.max;Se++){const Ee=a[Se];if(!Ee.featureInfo.guardRailEnabled||!this.prepareEdgePoints(ge,i,o,Ee,we))continue;const[Ve,Ie]=ge;if(Di(V,Ve.coord.x,Ve.coord.y,_*Ve.height),Di(B,Ie.coord.x,Ie.coord.y,_*Ie.height),is(V,B))continue;or(G,B,V),bi(G,G);const Te=R(ee,Ee.a)||G,Ce=R(ie,Ee.b)||G;Di(H,Te[1],-Te[0],0),bi(H,H),Di(Z,Ce[1],-Ce[0],0),bi(Z,Z),hr(ee,H,Te),bi(oe,ee),hr(ee,Z,Ce),bi(X,ee),gr(ne[0],V,mi(ee,or(ee,H,oe),y)),gr(ne[1],V,mi(ee,gr(ee,H,oe),y)),gr(ne[2],V,mi(ee,oe,y)),ne[3]=V,gr(fe[0],B,mi(ee,or(ee,Z,X),y)),gr(fe[1],B,mi(ee,gr(ee,Z,X),y)),gr(fe[2],B,mi(ee,X,y)),fe[3]=B,L=this.addFeatureSection(Ee.featureInfo.featureIndex,L,this.bridgeFeatureSections,e);const ze=e.addVertex(ne[0],H,h),Fe=e.addVertex(ne[1],H,h),Be=e.addVertex(fe[0],Z,h),De=e.addVertex(fe[1],Z,h);e.addTriangle(ze,Fe,Be),e.addTriangle(Fe,De,Be);const Ge=e.addVertex(ne[1],oe,h),Ze=e.addVertex(ne[2],oe,h),Qe=e.addVertex(fe[1],X,h),Xe=e.addVertex(fe[2],X,h);e.addTriangle(Ge,Ze,Qe),e.addTriangle(Ze,Xe,Qe),To(H,H),To(Z,Z);const rt=e.addVertex(ne[2],H,h),vt=e.addVertex(ne[3],H,h),ft=e.addVertex(fe[2],Z,h),xt=e.addVertex(fe[3],Z,h);e.addTriangle(rt,vt,ft),e.addTriangle(vt,xt,ft);const mt=this.isTerminalVertex(Ee.a,f),Rt=this.isTerminalVertex(Ee.b,f);Ve.height<.01&&mt&&e.addQuad(ne[3],ne[2],ne[1],ne[0],To(Te,Te),h),Ie.height<.01&&Rt&&e.addQuad(fe[0],fe[1],fe[2],fe[3],Ce,h)}this.bridgeFeatureSections.push({featureIndex:Number.POSITIVE_INFINITY,vertexStart:e.getVertexCount()})}constructTunnelStructures(e,i,o,a,c,h){e.clearVertexLookup();let f=Number.POSITIVE_INFINITY;const _=(L,V)=>L.featureInfo.featureIndex-V.featureInfo.featureIndex;this.sortSubarray(a,c.min,c.max,_),this.sortSubarray(a,h.min,h.max,_);const y=L=>bi(L,L),v=[{coord:new Ne(0,0),height:0},{coord:new Ne(0,0),height:0}],b=(L,V)=>L<V,T=ti(),S=ti(),C=ti(),P=ti(),R=ti();for(let L=c.min;L<c.max;L++){if(!this.prepareEdgePoints(v,i,o,a[L],b))continue;const[V,B]=v,G=y(Di(R,-(B.coord.y-V.coord.y),B.coord.x-V.coord.x,0));f=this.addFeatureSection(a[L].featureInfo.featureIndex,f,this.tunnelFeatureSections,e),e.addQuad(Di(T,V.coord.x,V.coord.y,V.height),Di(S,B.coord.x,B.coord.y,B.height),Di(C,B.coord.x,B.coord.y,a[L].isTunnel?B.height+4:0),Di(P,V.coord.x,V.coord.y,a[L].isTunnel?V.height+4:0),G)}for(let L=h.min;L<h.max;L++){const V=a[L];V.isTunnel&&([V.a,V.b]=[V.b,V.a]);const B=i[V.a],G=i[V.b],H=y(Di(R,-(G.y-B.y),G.x-B.x,0));f=this.addFeatureSection(V.featureInfo.featureIndex,f,this.tunnelFeatureSections,e),e.addQuad(Di(T,G.x,G.y,0),Di(S,B.x,B.y,0),Di(C,B.x,B.y,o[V.a]+4),Di(P,G.x,G.y,o[V.b]+4),H),e.addQuad(Di(T,B.x,B.y,0),Di(S,G.x,G.y,0),Di(C,G.x,G.y,o[V.b]+4),Di(P,B.x,B.y,o[V.a]+4),H)}this.tunnelFeatureSections.push({featureIndex:Number.POSITIVE_INFINITY,vertexStart:e.getVertexCount()})}setElevatedPoint(e,i,o,a){e.coord.x=i,e.coord.y=o,e.height=a}prepareEdgePoints(e,i,o,a,c){let h=i[a.a].x,f=i[a.a].y,_=i[a.b].x,y=i[a.b].y,v=o[a.a],b=o[a.b];const T=c(v,0),S=c(b,0);if(T&&S)return this.setElevatedPoint(e[0],h,f,v),this.setElevatedPoint(e[1],_,y,b),!0;if(!T&&!S)return!1;if(T){if(!S){const C=b/(b-v);_=yt(_,h,C),y=yt(y,f,C),b=yt(b,v,C)}}else{const C=v/(v-b);h=yt(h,_,C),f=yt(f,y,C),v=yt(v,b,C)}return this.setElevatedPoint(e[0],h,f,v),this.setElevatedPoint(e[1],_,y,b),!0}prepareEdges(e,i){if(i.length===0)return;i.sort((f,_)=>f.hash===_.hash?_.polygonIdx-f.polygonIdx:_.hash>f.hash?1:-1);let o=0,a=0,c=0,h=i[o].polygonIdx;do a++,(a===i.length||i[o].hash!==i[a].hash)&&((a-o===1||i[a-1].polygonIdx!==h)&&(c<o&&(i[c]=i[o],i[o]=null),i[c].type="none",c++),o=a,o!==i.length&&(h=i[o].polygonIdx));while(o!==i.length);if(i.splice(c),i.length!==0&&e.length!==0){i.sort((y,v)=>y.portalHash<v.portalHash?1:-1);let f=0,_=0;for(;f!==i.length&&_!==e.length;){const y=i[f],v=e[_];y.portalHash>v.hash?f++:v.hash>y.portalHash?_++:(y.type=v.type,f++)}}}isOnBorder(e,i){return e<=0&&i<=0||e>=Ke&&i>=Ke}addFeatureSection(e,i,o,a){return e!==i&&(i=e,o.push({featureIndex:e,vertexStart:a.getVertexCount()}),a.clearVertexLookup()),i}sortSubarray(e,i,o,a){const c=e.slice(i,o);c.sort(a),e.splice(i,c.length,...c)}static computeEdgeHash(e,i){return(e.y===i.y&&e.x>i.x||e.y>i.y)&&([e,i]=[i,e]),BigInt(Xn.computePosHash(e))<<32n|BigInt(Xn.computePosHash(i))}static computePosHash(e){return((65535&e.x)<<16|65535&e.y)>>>0}}class Cb{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,o){return this.get(e,!0,i,o)}optional(e,i,o){return this.get(e,!1,i,o)}success(){return this._valid}get(e,i,o,a){const c=Object.hasOwn(this.feature.properties,e)?+this.feature.properties[e]:void 0;return this._valid&&c!==void 0&&!Number.isNaN(c)?o(a?a(c):c):i&&(this._valid=!1),this}}class sv{constructor(e,i){this.featureFunc=e,this.vertexFunc=i}parseFeature(e,i,o){return this.featureFunc(e,i,o)}parseVertex(e,i,o){return this.vertexFunc(e,i,o)}}const Mb=new sv((r,e,i)=>r.reset(e).require($n,o=>{i.id=o}).optional("fixed_height_relative",o=>{i.constantHeight=o},Ya.decodeRelativeHeight).geometry(o=>{i.bounds=o},pl).success(),(r,e,i)=>r.reset(e).require($n,o=>{i.id=o}).require("elevation_idx",o=>{i.idx=o}).require("extent",o=>{i.extent=o}).require("height_relative",o=>{i.height=o},Ya.decodeRelativeHeight).geometry(o=>{i.position=o},Ya.getPoint).success()),Pb=new sv((r,e,i)=>r.reset(e).require($n,o=>{i.id=o}).optional("fixed_height",o=>{i.constantHeight=o},Ya.decodeMetricHeight).geometry(o=>{i.bounds=o},pl).success(),(r,e,i)=>r.reset(e).require($n,o=>{i.id=o}).require("elevation_idx",o=>{i.idx=o}).require("extent",o=>{i.extent=o}).require("height",o=>{i.height=o},Ya.decodeMetricHeight).geometry(o=>{i.position=o},Ya.getPoint).success());class Ya{static getPoint(e){return Eo(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"?Pb:void 0:Mb}static parse(e){const i=[],o=[],a=e.length,c=new Cb;for(let h=0;h<a;h++){const f=e.feature(h),_=f.properties.version,y=Ya.getVersionSchema(_);if(y===void 0){ht(`Unknown elevation feature version number ${_||"(unknown)"}`);continue}const v=f.properties.type;if(!v)continue;const b=ra.types[f.type];if(b==="Point"&&v==="curve_point"){const T={};y.parseVertex(c,f,T)&&i.push(T)}else if(b==="Polygon"&&v==="curve_meta"){const T={};y.parseFeature(c,f,T)&&o.push(T)}}return{vertices:i,features:o}}}const Rb=[yr(),yr(),yr(),yr(),yr(),yr(),yr()],lu=yr(),cu=yr();function L_(r){return[r[0],r[1]]}function F_(r){return Eo(r[0],r[1])}class av{constructor(e,i,o=null){this.feature=e,this.metersToTile=i,this.sampler=o,this.index=0}get(){const e=this.feature.vertices[this.index],i=this.feature.vertexProps[this.index].dir,o=i[1],a=-i[0],c=(e.extent+1)*this.metersToTile,h=this.sampler?this.sampler.pointTransform(e.position):e.position;return[new Ne(Math.trunc(h[0]+o*c),Math.trunc(h[1]+a*c)),new Ne(Math.trunc(h[0]-o*c),Math.trunc(h[1]-a*c))]}next(){this.index++}valid(){return this.index<this.feature.vertices.length}}class Ka{constructor(e,i,o,a,c,h){if(this.vertices=new Array,this.vertexProps=new Array,this.edges=new Array,this.edgeProps=new Array,this.id=e,this.heightRange={min:o,max:o},this.safeArea=i,this.constantHeight=o,this.constantHeight==null&&(this.constantHeight!=null||a.length!==0)){this.vertices=a,this.edges=c;for(let f=0;f<this.vertices.length;f++)this.vertices[f].index=this.vertices[f].index!==void 0?this.vertices[f].index:f;this.edges=this.edges.filter(f=>{return f.a<this.vertices.length&&f.b<this.vertices.length&&!((_=this.vertices[f.a].position)[0]===(y=this.vertices[f.b].position)[0]&&_[1]===y[1]);var _,y}),this.heightRange={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};for(const f of this.vertices)this.vertexProps.push({dir:Eo(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 _=this.vertices[f.a].position,y=this.vertices[f.b].position,v=Uo(yr(),y,_),b=os(v),T=Vs(yr(),v,1/b);this.edgeProps.push({vec:v,dir:T,len:b});const S=this.vertexProps[f.a].dir,C=this.vertexProps[f.b].dir;ns(S,S,T),ns(C,C,T)}for(const f of this.vertexProps)f.dir[0]===0&&f.dir[1]===0||uc(f.dir,f.dir);this.tessellate(h)}}pointElevation(e){if(this.constantHeight!=null)return this.constantHeight;const i=this.getClosestEdge(e);if(i==null)return 0;const[o,a]=i;return yt(this.vertices[this.edges[o].a].height,this.vertices[this.edges[o].b].height,a)}computeSlopeNormal(e,i){const o=this.getClosestEdge(e);if(!o)return Cr(0,0,1);const a=o[0],c=this.edges[a],h=this.edgeProps[a].vec,f=Cr(h[0],h[1],(this.vertices[c.b].height-this.vertices[c.a].height)*i),_=Cr(f[1],-f[0],0);hr(_,_,f);const y=Bn(_);return y>0?mi(_,_,1/y):Di(_,0,0,1)}getSafeArea(){return this.safeArea}isTunnel(){return this.heightRange.max<=-5}getClosestEdge(e){if(this.edges.length===0)return;let i=0,o=Number.POSITIVE_INFINITY,a=0;const[c,h,f,_,y,v,b]=Rb;hl(b,e.x,e.y);const T=new sb(b,null);for(let S=0;S<this.edges.length;S++){const C=this.edges[S],P=this.edgeProps[S].dir;T.dir=P;const R=this.vertices[C.a].position,L=this.vertices[C.b].position,V=T.intersectsPlane(R,this.vertexProps[C.a].dir,c),B=T.intersectsPlane(L,this.vertexProps[C.b].dir,h);if(!V||!B)continue;Uo(f,h,c),Uo(_,b,c);const G=Hr(f,f),H=G>0?Hr(_,f)/G:0,Z=te(H,0,1),oe=Math.abs((H-Z)*this.edgeProps[S].len);Uo(y,b,R),hl(v,P[1],-P[0]);const X=oe+Math.abs(Hr(y,v));X<o&&(i=S,o=X,a=Z)}return[i,a]}tessellate(e){const i=ti(),o=ti(),a=ti(),c=ti();for(let h=this.edges.length-1;h>=0;--h){const f=this.edges[h].a,_=this.edges[h].b,{position:y,height:v,extent:b}=this.vertices[f],{position:T,height:S,extent:C}=this.vertices[_],P=this.vertexProps[f].dir,R=this.vertexProps[_].dir;if(Di(i,y[0]/e,y[1]/e,v),Di(o,T[0]/e,T[1]/e,S),Di(a,P[1],-P[0],0),mi(a,a,b),Di(c,R[1],-R[0],0),mi(c,c,C),this.distSqLines(Cr(i[0]+.5*a[0],i[1]+.5*a[1],i[2]+.5*a[2]),Cr(o[0]-.5*c[0],o[1]-.5*c[1],o[2]-.5*c[2]),Cr(i[0]-.5*a[0],i[1]-.5*a[1],i[2]-.5*a[2]),Cr(o[0]+.5*c[0],o[1]+.5*c[1],o[2]+.5*c[2]))<=.0025000000000000005)continue;const L=this.vertices.length,V=ns(yr(),y,T);this.vertices.push({position:Vs(V,V,.5),height:.5*(v+S),extent:.5*(b+C),index:.5*((this.vertices[f].index!==void 0?this.vertices[f].index:f)+(this.vertices[_].index!==void 0?this.vertices[_].index:_))});const B=ns(yr(),P,R);this.vertexProps.push({dir:uc(B,B)}),this.edges.splice(h,1),this.edgeProps.splice(h,1),this.edges.push({a:f,b:L}),this.edges.push({a:L,b:_});const G=Uo(yr(),this.vertices[L].position,y),H=os(G),Z={vec:G,dir:Vs(yr(),G,1/H),len:H};this.edgeProps.push(Z),this.edgeProps.push(Z)}}distSqLines(e,i,o,a){const c=Vo(ti(),i,e),h=Vo(ti(),a,o),f=Vo(ti(),e,o),_=Xi(c,c),y=Xi(c,h),v=Xi(c,f),b=Xi(h,h),T=Xi(h,f),S=_*b-y*y;if(S===0)return sl(_a(c,o,a,Xi(f,h)/Xi(h,h)),e);const C=(_*T-y*v)/S;return sl(_a(c,e,i,(y*T-v*b)/S),_a(h,o,a,C))}static serialize(e,i){const o={id:e.id,heightRange:{min:e.heightRange.min,max:e.heightRange.max},safeArea:(a=e.safeArea,{min:{x:a.min.x,y:a.min.y},max:{x:a.max.x,y:a.max.y}})};var a;return e.constantHeight!=null?(o.constantHeight=e.constantHeight,o):e.vertices.length===0?(o.vertices=[],o.vertexProps=[],o.edges=[],o.edgeProps=[],o):(o.vertices=e.vertices.map(c=>({position:L_(c.position),height:c.height,extent:c.extent,index:c.index})),o.vertexProps=e.vertexProps.map(c=>({dir:L_(c.dir)})),o.edges=e.edges.map(c=>({a:c.a,b:c.b})),o.edgeProps=e.edgeProps.map(c=>({vec:L_(c.vec),dir:L_(c.dir),len:c.len})),o)}static deserialize(e){const i=(function(a){return{min:new Ne(a.min.x,a.min.y),max:new Ne(a.max.x,a.max.y)}})(e.safeArea);if(e.constantHeight!=null)return new Ka(e.id,i,e.constantHeight);if(!e.vertices||e.vertices.length===0){const a=Object.create(Ka.prototype);return a.id=e.id,a.constantHeight=void 0,a.heightRange={min:e.heightRange.min,max:e.heightRange.max},a.safeArea=i,a.vertices=[],a.vertexProps=[],a.edges=[],a.edgeProps=[],a}const o=Object.create(Ka.prototype);return o.id=e.id,o.constantHeight=void 0,o.heightRange={min:e.heightRange.min,max:e.heightRange.max},o.safeArea=i,o.vertices=e.vertices.map(a=>({position:F_(a.position),height:a.height,extent:a.extent,index:a.index})),o.vertexProps=(e.vertexProps||[]).map(a=>({dir:F_(a.dir)})),o.edges=(e.edges||[]).map(a=>({a:a.a,b:a.b})),o.edgeProps=(e.edgeProps||[]).map(a=>({vec:F_(a.vec),dir:F_(a.dir),len:a.len})),o}}class O_{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)*Ke,this.yOffset=(e.y*this.zScale-i.y)*Ke)}pointTransform(e){return Eo(e[0]*this.zScale+this.xOffset,e[1]*this.zScale+this.yOffset)}pointTransformInPlace(e){e[0]=e[0]*this.zScale+this.xOffset,e[1]=e[1]*this.zScale+this.yOffset}constantElevation(e,i){if(e.constantHeight!=null)return this.computeBiasedHeight(e.constantHeight,i)}pointElevation(e,i,o){const a=this.constantElevation(i,o);return a??(e.x=e.x*this.zScale+this.xOffset,e.y=e.y*this.zScale+this.yOffset,this.computeBiasedHeight(i.pointElevation(e),o))}computeBiasedHeight(e,i){return i<=0?e:e+i*ce(0,i,e>=0?e:Math.abs(.5*e))}}function Db(r){if(r===0)return[0,0,0];const e=kd(r);return[e(),e(),e()]}function lv(r,e){let i=0,o=r.length-1;for(;i<=o;){const a=i+o>>1;r[a].feature.id<e?i=a+1:o=a-1}return i<r.length&&r[i].feature.id===e?i:-1}function B_(r,e,i,o){if(!r.properties)return;const a=+r.properties[$n];if(Number.isNaN(a))return;if(e){const h=e.find(f=>f.id===a);if(h&&o)return{tileId:o,feature:h}}if(!i||i.length===0)return;const c=lv(i,a);if(!(c<0)){if(o){for(let h=c;h<i.length&&i[h].feature.id===a;h++)if(i[h].tileId.key===o.key)return i[h]}return i[c]}}function zb(r,e){return r>e?1:r<e?-1:0}Je(Ka,"ElevationFeature");class ky{constructor(e=zb,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,o,a,c,h;e.parent;)(o=(i=e.parent).parent)&&o.parent?((a=o.parent).left===o?a.left=e:a.right=e,e.parent=a):(e.parent=null,this._root=e),c=e.left,h=e.right,e===i.left?(o&&(o.left===i?(i.right?(o.left=i.right,o.left.parent=o):o.left=null,i.right=o,o.parent=i):(c?(o.right=c,c.parent=o):o.right=null,e.left=o,o.parent=e)),h?(i.left=h,h.parent=i):i.left=null,e.right=i,i.parent=e):(o&&(o.right===i?(i.left?(o.right=i.left,o.right.parent=o):o.right=null,i.left=o,o.parent=i):(h?(o.left=h,h.parent=o):o.left=null,e.right=o,o.parent=e)),c?(i.right=c,c.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 o=this._root,a=null,c=this._compare;if(this._noDuplicates)for(;o;){if(a=o,c(o.key,e)===0)return;o=c(o.key,e)<0?o.right:o.left}else for(;o;)a=o,o=c(o.key,e)<0?o.right:o.left;return o={key:e,data:i,left:null,right:null,parent:a},a?c(a.key,o.key)<0?a.right=o:a.left=o:this._root=o,this.splay(o),this._size++,o}find(e){for(var i=this._root,o=this._compare;i;){var a=o(i.key,e);if(a<0)i=i.right;else{if(!(a>0))return i;i=i.left}}return null}contains(e){for(var i=this._root,o=this._compare;i;){var a=o(e,i.key);if(a===0)return!0;i=a<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 o=this.minNode(i.right);o.parent!==i&&(this.replace(o,o.right),o.right=i.right,o.right.parent=o),this.replace(i,o),o.left=i.left,o.left.parent=o}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 o=i.left,a=i.right,c=null;o&&(o.parent=null,c=this.maxNode(o),this.splay(c),this._root=c),a&&(o?c.right=a:this._root=a,a.parent=c),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,o=[],a=!1,c=0;!a;)i?(o.push(i),i=i.left):o.length>0?(e(i=o.pop(),c++),i=i.right):a=!0;return this}range(e,i,o,a){const c=[],h=this._compare;let f,_=this._root;for(;c.length!==0||_;)if(_)c.push(_),_=_.left;else{if(_=c.pop(),f=h(_.key,i),f>0)break;if(h(_.key,e)>=0&&o.call(a,_))return this;_=_.right}return this}keys(){for(var e=this._root,i=[],o=[],a=!1;!a;)e?(i.push(e),e=e.left):i.length>0?(e=i.pop(),o.push(e.key),e=e.right):a=!0;return o}values(){for(var e=this._root,i=[],o=[],a=!1;!a;)e?(i.push(e),e=e.left):i.length>0?(e=i.pop(),o.push(e.data),e=e.right):a=!0;return o}at(e){for(var i=this._root,o=[],a=!1,c=0;!a;)if(i)o.push(i),i=i.left;else if(o.length>0){if(i=o.pop(),c===e)return i;c++,i=i.right}else a=!0;return null}load(e=[],i=[],o=!1){if(this._size!==0)throw new Error("bulk-load: tree is not empty");const a=e.length;return o&&Vy(e,i,0,a-1,this._compare),this._root=Ny(null,e,i,0,a),this._size=a,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,o,a,c){return new ky(o,c).load(e,i,a)}}function Ny(r,e,i,o,a){const c=a-o;if(c>0){const h=o+Math.floor(c/2),f={key:e[h],data:i[h],parent:r};return f.left=Ny(f,e,i,o,h),f.right=Ny(f,e,i,h+1,a),f}return null}function Vy(r,e,i,o,a){if(i>=o)return;const c=r[i+o>>1];let h=i-1,f=o+1;for(;;){do h++;while(a(r[h],c)<0);do f--;while(a(r[f],c)>0);if(h>=f)break;let _=r[h];r[h]=r[f],r[f]=_,_=e[h],e[h]=e[f],e[f]=_}Vy(r,e,i,f,a),Vy(r,e,f+1,o,a)}const cv=11102230246251565e-32,Fn=134217729,Lb=(3+8*cv)*cv;function Uy(r,e,i,o,a){let c,h,f,_,y=e[0],v=o[0],b=0,T=0;v>y==v>-y?(c=y,y=e[++b]):(c=v,v=o[++T]);let S=0;if(b<r&&T<i)for(v>y==v>-y?(h=y+c,f=c-(h-y),y=e[++b]):(h=v+c,f=c-(h-v),v=o[++T]),c=h,f!==0&&(a[S++]=f);b<r&&T<i;)v>y==v>-y?(h=c+y,_=h-c,f=c-(h-_)+(y-_),y=e[++b]):(h=c+v,_=h-c,f=c-(h-_)+(v-_),v=o[++T]),c=h,f!==0&&(a[S++]=f);for(;b<r;)h=c+y,_=h-c,f=c-(h-_)+(y-_),y=e[++b],c=h,f!==0&&(a[S++]=f);for(;T<i;)h=c+v,_=h-c,f=c-(h-_)+(v-_),v=o[++T],c=h,f!==0&&(a[S++]=f);return c===0&&S!==0||(a[S++]=c),S}function gp(r){return new Float64Array(r)}const Zh=gp(4),uv=gp(8),hv=gp(12),dv=gp(16),Yn=gp(4);function yp(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=!fv(e,i)||e.isVertical()?e.prevInResult:e)),r.resultTransition=fv(r,i)?(function(o,a){let c,h=!o.inOut,f=!o.otherInOut;switch(a){case 0:c=h&&f;break;case 1:c=h||f;break;case 3:c=h!==f;break;case 2:c=o.isSubject?h&&!f:f&&!h}return c?1:-1})(r,i):0}function fv(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 Wh{constructor(e,i,o,a,c){this.left=i,this.point=e,this.otherEvent=o,this.isSubject=a??!1,this.type=c||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,o=this.otherEvent.point;return this.left?(i[0]-e[0])*(o[1]-e[1])-(o[0]-e[0])*(i[1]-e[1])>0:(o[0]-e[0])*(i[1]-e[1])-(i[0]-e[0])*(o[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 Wh(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 la(r,e){return r[0]===e[0]&&r[1]===e[1]}function jy(r,e,i){const o=(function(a,c,h,f,_,y){const v=(c-y)*(h-_),b=(a-_)*(f-y),T=v-b;if(v===0||b===0||v>0!=b>0)return T;const S=Math.abs(v+b);return Math.abs(T)>=33306690738754716e-32*S?T:-(function(C,P,R,L,V,B,G){let H,Z,oe,X,ee,ie,ne,fe,ge,we,Se,Ee,Ve,Ie,Te,Ce,ze,Fe;const Be=C-V,De=R-V,Ge=P-B,Ze=L-B;Ie=Be*Ze,ie=Fn*Be,ne=ie-(ie-Be),fe=Be-ne,ie=Fn*Ze,ge=ie-(ie-Ze),we=Ze-ge,Te=fe*we-(Ie-ne*ge-fe*ge-ne*we),Ce=Ge*De,ie=Fn*Ge,ne=ie-(ie-Ge),fe=Ge-ne,ie=Fn*De,ge=ie-(ie-De),we=De-ge,ze=fe*we-(Ce-ne*ge-fe*ge-ne*we),Se=Te-ze,ee=Te-Se,Zh[0]=Te-(Se+ee)+(ee-ze),Ee=Ie+Se,ee=Ee-Ie,Ve=Ie-(Ee-ee)+(Se-ee),Se=Ve-Ce,ee=Ve-Se,Zh[1]=Ve-(Se+ee)+(ee-Ce),Fe=Ee+Se,ee=Fe-Ee,Zh[2]=Ee-(Fe-ee)+(Se-ee),Zh[3]=Fe;let Qe=(function(xt,mt){let Rt=mt[0];for(let ut=1;ut<4;ut++)Rt+=mt[ut];return Rt})(0,Zh),Xe=22204460492503146e-32*G;if(Qe>=Xe||-Qe>=Xe||(ee=C-Be,H=C-(Be+ee)+(ee-V),ee=R-De,oe=R-(De+ee)+(ee-V),ee=P-Ge,Z=P-(Ge+ee)+(ee-B),ee=L-Ze,X=L-(Ze+ee)+(ee-B),H===0&&Z===0&&oe===0&&X===0)||(Xe=11093356479670487e-47*G+Lb*Math.abs(Qe),Qe+=Be*X+Ze*H-(Ge*oe+De*Z),Qe>=Xe||-Qe>=Xe))return Qe;Ie=H*Ze,ie=Fn*H,ne=ie-(ie-H),fe=H-ne,ie=Fn*Ze,ge=ie-(ie-Ze),we=Ze-ge,Te=fe*we-(Ie-ne*ge-fe*ge-ne*we),Ce=Z*De,ie=Fn*Z,ne=ie-(ie-Z),fe=Z-ne,ie=Fn*De,ge=ie-(ie-De),we=De-ge,ze=fe*we-(Ce-ne*ge-fe*ge-ne*we),Se=Te-ze,ee=Te-Se,Yn[0]=Te-(Se+ee)+(ee-ze),Ee=Ie+Se,ee=Ee-Ie,Ve=Ie-(Ee-ee)+(Se-ee),Se=Ve-Ce,ee=Ve-Se,Yn[1]=Ve-(Se+ee)+(ee-Ce),Fe=Ee+Se,ee=Fe-Ee,Yn[2]=Ee-(Fe-ee)+(Se-ee),Yn[3]=Fe;const rt=Uy(4,Zh,4,Yn,uv);Ie=Be*X,ie=Fn*Be,ne=ie-(ie-Be),fe=Be-ne,ie=Fn*X,ge=ie-(ie-X),we=X-ge,Te=fe*we-(Ie-ne*ge-fe*ge-ne*we),Ce=Ge*oe,ie=Fn*Ge,ne=ie-(ie-Ge),fe=Ge-ne,ie=Fn*oe,ge=ie-(ie-oe),we=oe-ge,ze=fe*we-(Ce-ne*ge-fe*ge-ne*we),Se=Te-ze,ee=Te-Se,Yn[0]=Te-(Se+ee)+(ee-ze),Ee=Ie+Se,ee=Ee-Ie,Ve=Ie-(Ee-ee)+(Se-ee),Se=Ve-Ce,ee=Ve-Se,Yn[1]=Ve-(Se+ee)+(ee-Ce),Fe=Ee+Se,ee=Fe-Ee,Yn[2]=Ee-(Fe-ee)+(Se-ee),Yn[3]=Fe;const vt=Uy(rt,uv,4,Yn,hv);Ie=H*X,ie=Fn*H,ne=ie-(ie-H),fe=H-ne,ie=Fn*X,ge=ie-(ie-X),we=X-ge,Te=fe*we-(Ie-ne*ge-fe*ge-ne*we),Ce=Z*oe,ie=Fn*Z,ne=ie-(ie-Z),fe=Z-ne,ie=Fn*oe,ge=ie-(ie-oe),we=oe-ge,ze=fe*we-(Ce-ne*ge-fe*ge-ne*we),Se=Te-ze,ee=Te-Se,Yn[0]=Te-(Se+ee)+(ee-ze),Ee=Ie+Se,ee=Ee-Ie,Ve=Ie-(Ee-ee)+(Se-ee),Se=Ve-Ce,ee=Ve-Se,Yn[1]=Ve-(Se+ee)+(ee-Ce),Fe=Ee+Se,ee=Fe-Ee,Yn[2]=Ee-(Fe-ee)+(Se-ee),Yn[3]=Fe;const ft=Uy(vt,hv,4,Yn,dv);return dv[ft-1]})(a,c,h,f,_,y,S)})(r[0],r[1],e[0],e[1],i[0],i[1]);return o>0?-1:o<0?1:0}function tc(r,e){const i=r.point,o=e.point;return i[0]>o[0]?1:i[0]<o[0]?-1:i[1]!==o[1]?i[1]>o[1]?1:-1:(function(a,c,h){return a.left!==c.left?a.left?1:-1:jy(h,a.otherEvent.point,c.otherEvent.point)!==0?a.isBelow(c.otherEvent.point)?-1:1:!a.isSubject&&c.isSubject?1:-1})(r,e,i)}function ic(r,e,i){const o=new Wh(e,!1,r,r.isSubject),a=new Wh(e,!0,r.otherEvent,r.isSubject);return la(r.point,r.otherEvent.point)&&console.warn("what is that, a collapsed segment?",r),o.contourId=a.contourId=r.contourId,tc(a,r.otherEvent)>0&&(r.otherEvent.left=!0,a.left=!1),r.otherEvent.otherEvent=a,r.otherEvent=o,i.push(a),i.push(o),i}function k_(r,e){return r[0]*e[1]-r[1]*e[0]}function Gy(r,e){return r[0]*e[0]+r[1]*e[1]}function qy(r,e,i){const o=(function(_,y,v,b){const T=[y[0]-_[0],y[1]-_[1]],S=[b[0]-v[0],b[1]-v[1]];function C(oe,X,ee){return[oe[0]+X*ee[0],oe[1]+X*ee[1]]}const P=[v[0]-_[0],v[1]-_[1]];let R=k_(T,S),L=R*R;const V=Gy(T,T);if(L>0){const oe=k_(P,S)/R;if(oe<0||oe>1)return null;const X=k_(P,T)/R;return X<0||X>1?null:oe===0||oe===1?[C(_,oe,T)]:X===0||X===1?[C(v,X,S)]:[C(_,oe,T)]}if(R=k_(P,T),L=R*R,L>0)return null;const B=Gy(T,P)/V,G=B+Gy(T,S)/V,H=Math.min(B,G),Z=Math.max(B,G);return H<=1&&Z>=0?H===1?[C(_,H>0?H:0,T)]:Z===0?[C(_,Z<1?Z:1,T)]:[C(_,H>0?H:0,T),C(_,Z<1?Z:1,T)]:null})(r.point,r.otherEvent.point,e.point,e.otherEvent.point),a=o?o.length:0;if(a===0||a===1&&(la(r.point,e.point)||la(r.otherEvent.point,e.otherEvent.point))||a===2&&r.isSubject===e.isSubject)return 0;if(a===1)return!la(r.point,o[0])&&!la(r.otherEvent.point,o[0])&&ic(r,o[0],i),!la(e.point,o[0])&&!la(e.otherEvent.point,o[0])&&ic(e,o[0],i),1;const c=[];let h=!1,f=!1;return la(r.point,e.point)?h=!0:tc(r,e)===1?c.push(e,r):c.push(r,e),la(r.otherEvent.point,e.otherEvent.point)?f=!0:tc(r.otherEvent,e.otherEvent)===1?c.push(e.otherEvent,r.otherEvent):c.push(r.otherEvent,e.otherEvent),h&&f||h?(e.type=1,r.type=e.inOut===r.inOut?2:3,h&&!f&&ic(c[1].otherEvent,c[0].point,i),2):f?(ic(c[0],c[1].point,i),3):c[0]!==c[3].otherEvent?(ic(c[0],c[1].point,i),ic(c[1],c[2].point,i),3):(ic(c[0],c[1].point,i),ic(c[3].otherEvent,c[2].point,i),3)}function Fb(r,e){if(r===e)return 0;if(jy(r.point,r.otherEvent.point,e.point)!==0||jy(r.point,r.otherEvent.point,e.otherEvent.point)!==0)return la(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:tc(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,o=e.point;if(i[0]===o[0]&&i[1]===o[1])return i=r.otherEvent.point,o=e.otherEvent.point,i[0]===o[0]&&i[1]===o[1]?0:(r.contourId??0)>(e.contourId??0)?1:-1}return tc(r,e)===1?1:-1}class Ob{constructor(){this.points=[],this.holeIds=[],this.holeOf=null,this.depth=null}isExterior(){return this.holeOf==null}}function Bb(r,e,i,o){let a,c=r+1,h=e[r].point;const f=e.length;for(c<f&&(a=e[c].point);c<f&&a[0]===h[0]&&a[1]===h[1];){if(!i[c])return c;c++,c<f&&(a=e[c].point)}for(c=r-1;i[c]&&c>o;)c--;return c}function kb(r,e,i){const o=new Ob;if(r.prevInResult!=null){const a=r.prevInResult,c=a.outputContourId;if(a.resultTransition>0){const h=e[c];if(h.holeOf!=null){const f=h.holeOf;e[f].holeIds.push(i),o.holeOf=f,o.depth=e[c].depth}else e[c].holeIds.push(i),o.holeOf=c,o.depth=e[c].depth+1}else o.holeOf=null,o.depth=e[c].depth}else o.holeOf=null,o.depth=0;return o}const pv=Math.max,mv=Math.min;let N_=0;function _v(r,e,i,o,a,c){let h,f,_,y,v,b;for(h=0,f=r.length-1;h<f;h++){if(_=r[h],y=r[h+1],v=new Wh(_,!1,void 0,e),b=new Wh(y,!1,v,e),v.otherEvent=b,_[0]===y[0]&&_[1]===y[1])continue;v.contourId=b.contourId=i,c||(v.isExteriorRing=!1,b.isExteriorRing=!1),tc(v,b)>0?b.left=!0:v.left=!0;const T=_[0],S=_[1];a[0]=mv(a[0],T),a[1]=mv(a[1],S),a[2]=pv(a[2],T),a[3]=pv(a[3],S),o.push(v),o.push(b)}}const V_=[];function gv(r,e,i){let o=r,a=e;typeof r[0][0][0]=="number"&&(o=[r]),typeof e[0][0][0]=="number"&&(a=[e]);let c=(function(T,S,C){let P=null;return T.length*S.length===0&&(C===0?P=V_:C===2?P=T:(C===1||C===3)&&(P=T.length===0?S:T)),P})(o,a,i);if(c)return c===V_?null:c;const h=[1/0,1/0,-1/0,-1/0],f=[1/0,1/0,-1/0,-1/0],_=(function(T,S,C,P,R){const L=new gc(void 0,tc);let V,B,G,H,Z,oe;for(G=0,H=T.length;G<H;G++)for(V=T[G],Z=0,oe=V.length;Z<oe;Z++)B=Z===0,B&&N_++,_v(V[Z],!0,N_,L,C,B);for(G=0,H=S.length;G<H;G++)for(V=S[G],Z=0,oe=V.length;Z<oe;Z++)B=Z===0,R===2&&(B=!1),B&&N_++,_v(V[Z],!1,N_,L,P,B);return L})(o,a,h,f,i);if(c=(function(T,S,C,P,R){let L=null;return(C[0]>P[2]||P[0]>C[2]||C[1]>P[3]||P[1]>C[3])&&(R===0?L=V_:R===2?L=T:(R===1||R===3)&&(L=T.concat(S))),L})(o,a,h,f,i),c)return c===V_?null:c;const y=(function(T,S,C,P,R,L){const V=new ky(Fb),B=[],G=Math.min(P[2],R[2]);let H,Z,oe;for(;T.length!==0;){let X=T.pop();if(B.push(X),L===0&&X.point[0]>G||L===2&&X.point[0]>P[2])break;if(X.left){Z=H=V.insert(X),oe=V.minNode(),H=H!==oe?V.prev(H):null,Z=V.next(Z);const ee=H?H.key:null;let ie;if(yp(X,ee,L),Z&&qy(X,Z.key,T)===2&&(yp(X,ee,L),yp(Z.key,X,L)),H&&qy(H.key,X,T)===2){let ne=H;ne=ne!==oe?V.prev(ne):null,ie=ne?ne.key:null,yp(ee,ie,L),yp(X,ee,L)}}else X=X.otherEvent,Z=H=V.find(X),H&&Z&&(H=H!==oe?V.prev(H):null,Z=V.next(Z),V.remove(X),Z&&H&&qy(H.key,Z.key,T))}return B})(_,0,0,h,f,i),v=(function(T){let S,C;const P=(function(V){let B,G,H,Z,oe;const X=[];for(G=0,H=V.length;G<H;G++)B=V[G],(B.left&&B.inResult||!B.left&&B.otherEvent.inResult)&&X.push(B);let ee=!1;for(;!ee;)for(ee=!0,G=0,H=X.length;G<H;G++)G+1<H&&tc(X[G],X[G+1])===1&&(Z=X[G],X[G]=X[G+1],X[G+1]=Z,ee=!1);for(G=0,H=X.length;G<H;G++)B=X[G],B.otherPos=G;for(G=0,H=X.length;G<H;G++)B=X[G],B.left||(oe=B.otherPos,B.otherPos=B.otherEvent.otherPos,B.otherEvent.otherPos=oe);return X})(T),R={},L=[];for(S=0,C=P.length;S<C;S++){if(R[S])continue;const V=L.length,B=kb(P[S],L,V),G=oe=>{R[oe]=!0,oe<P.length&&P[oe]&&(P[oe].outputContourId=V)};let H=S,Z=S;for(B.points.push(P[S].point);G(H),H=P[H].otherPos,G(H),B.points.push(P[H].point),H=Bb(H,P,R,Z),!(H==Z||H>=P.length)&&P[H];);L.push(B)}return L})(y),b=[];for(let T=0;T<v.length;T++){let S=v[T];if(S.isExterior()){let C=[S.points];for(let P=0;P<S.holeIds.length;P++)C.push(v[S.holeIds[P]].points);b.push(C)}}return b}function Nb(r,e){const i=gv(Hy(r),Hy([e]),0);return i==null?[]:xv(i)}function Vb(r,e,i=0){let a=Hy(r,65536);const c=[];for(;e.valid();e.next()){const[h,f]=e.get();let _=h.x*65536,y=h.y*65536,v=f.x*65536,b=f.y*65536;const T=v-_,S=b-y,C=Math.hypot(T,S);if(C===0)continue;_-=T*i,y-=S*i,v+=T*i,b+=S*i;const P=Math.trunc(S/C*3),R=-Math.trunc(T/C*3);c.push([[[_,y],[v,b],[v+P,b+R],[_+P,y+R],[_,y]]])}return c.length>0&&(a=gv(a,c,2)),xv(a,1/65536,.001)}function Hy(r,e=1){return[r.map(i=>i.map(o=>[o.x*e,o.y*e]))]}function yv(r,e){const i=Math.floor(r)+.5;return Math.abs(r-i)<=e?Math.round(i):Math.round(r)}class Ub{constructor(e){this.xs=[],this.ys=[],this.ixs=[],this.iys=[],this.buckets=new Map,this.tolerance=e}canonicalize(e,i){const o=this.tolerance,a=Math.floor(e/o),c=Math.floor(i/o);for(let _=-1;_<=1;_++){const y=this.buckets.get(a+_);if(y)for(let v=-1;v<=1;v++){const b=y.get(c+v);if(b){for(const T of b)if(Math.abs(this.xs[T]-e)<=o&&Math.abs(this.ys[T]-i)<=o){const S=this.ixs[T],C=this.iys[T];return this.xs[T]===e&&this.ys[T]===i||this.store(e,i,S,C,a,c),[S,C]}}}}const h=yv(e,o),f=yv(i,o);return this.store(e,i,h,f,a,c),[h,f]}store(e,i,o,a,c,h){const f=this.xs.length;this.xs.push(e),this.ys.push(i),this.ixs.push(o),this.iys.push(a);let _=this.buckets.get(c);_||(_=new Map,this.buckets.set(c,_));let y=_.get(h);y||(y=[],_.set(h,y)),y.push(f)}}function xv(r,e=1,i){const o=i!=null?new Ub(i):null;return r.map(a=>a.map((c,h)=>{const f=c.map(_=>{const y=_[0]*e,v=_[1]*e;if(o){const[b,T]=o.canonicalize(y,v);return new Ne(b,T)}return new Ne(Math.round(y),Math.round(v))});return h>0&&f.reverse(),f}))}class $y{constructor(){this.frcCoverage=new Set,this.featureTriSegments=[],this.frcPerLevel=new Map,this.frcNonRoadSegments=new wi}empty(){return this.frcCoverage.size===0}}function vv(r,e,i){if(r.frcCoverage.size===0||r.featureTriSegments.length===0)return;const o=i.get(),a=e.uint16,c=[];r.featureTriSegments.sort((b,T)=>b.segIdx!==T.segIdx?b.segIdx-T.segIdx:b.frc===null&&T.frc===null?0:b.frc===null?-1:T.frc===null?1:T.frc-b.frc);const h=new Map;let f=0,_=r.featureTriSegments[0].frc,y={vertexOffset:o[f].vertexOffset,primitiveOffset:0,vertexLength:o[f].vertexLength,primitiveLength:0,vaos:{},sortKey:void 0};const v=()=>{y.primitiveLength>0&&(h.has(_)||h.set(_,[]),h.get(_).push({...y}))};for(const b of r.featureTriSegments){b.segIdx!==f&&(v(),f=b.segIdx,_=b.frc,y={vertexOffset:o[f].vertexOffset,primitiveOffset:c.length/3,vertexLength:o[f].vertexLength,primitiveLength:0,vaos:{},sortKey:void 0}),b.frc!==_&&(v(),_=b.frc,y={...y,primitiveOffset:c.length/3,primitiveLength:0});for(let T=b.start;T<b.end;T++)c.push(a[T]);y.primitiveLength+=(b.end-b.start)/3}v();for(let b=0;b<c.length;b++)a[b]=c[b];for(const[b,T]of h)b!==null?r.frcPerLevel.set(b,new wi(T)):r.frcNonRoadSegments=new wi(T);r.featureTriSegments=[]}Je($y,"FrcSegmentData");const jb={motorway:0,motorway_link:0,trunk:1,trunk_link:1,primary:2,primary_link:2,secondary:3,secondary_link:3,tertiary:4,tertiary_link:4,unclassified:5,unclassified_link:5,street:6,street_limited:6,residential:6,service:7,living_street:7,pedestrian:8,track:8,path:8,footway:8,cycleway:8,sidewalk:8,crossing:8};function U_(r){for(const e of["class","incident_class"]){const i=r[e];if(typeof i!="string")continue;const o=jb[i];if(o!==void 0)return o}return null}function Zy(r,e,i){for(const o of r)if(o.startsWith("(")){const a=o.indexOf(")");if(a===-1)continue;if(o.slice(1,a)===e&&o.slice(a+1)===i)return!0}else if(o===i)return!0;return!1}class bv{constructor(e,i,o){this.elevationMode=i,i&&(this.elevationBufferData=new ov(e.layers,e.zoom,e.lut)),o&&(this.frcData=new $y)}isEmpty(){const e=!this.elevationBufferData||this.elevationBufferData.isEmpty(),i=!this.frcData||this.frcData.empty();return e&&i}needsUpload(){return!!this.elevationBufferData&&this.elevationBufferData.needsUpload()}trackFeatureFrc(e){if(!this.frcData)return null;const i=U_(e||{});return i!==null&&this.frcData.frcCoverage.add(i),i}recordFeatureRange(e,i,o,a){if(!this.frcData||o<=i)return;const c=e.bufferData.triangleSegments.get();this.frcData.featureTriSegments.push({start:3*i,end:3*o,segIdx:c.length>0?c.length-1:0,frc:a})}buildFrcSegments(e){this.frcData&&!this.frcData.empty()&&vv(this.frcData,e.bufferData.indexArray,e.bufferData.triangleSegments)}handleFeature(e,i,o,a,c,h){const f=new Array;if(!this.elevationMode)return!1;const _=B_(e,c,void 0,a);if(!_)return!1;{const v=this.clipPolygonsToTile(i,1);v.length>0&&f.push({polygons:v,elevationFeature:_.feature,elevationTileID:_.tileId})}const y={guardRailEnabled:h.layers[0].layout.get("fill-construct-bridge-guard-rail").evaluate(e,{},a),featureIndex:o};for(const v of f)if(v.elevationFeature){if(this.elevationMode==="hd-road-base"){this.elevatedStructures||(this.elevatedStructures=new Xn(v.elevationTileID,h.layers,h.zoom,h.lut));const T=v.elevationFeature.isTunnel();let S=0;Object.hasOwn(e.properties,p_)&&(S=+e.properties[p_]),this.elevatedStructures.addPortalCandidates(v.elevationFeature.id,v.polygons,T,v.elevationFeature,S)}v.elevationFeature.constantHeight==null&&(v.polygons=this.prepareElevatedPolygons(v.polygons,v.elevationFeature,v.elevationTileID));const b=new O_(a,v.elevationTileID);this.addElevatedGeometry(h,v.polygons,b,v.elevationFeature,this.elevationMode==="hd-road-base"?0:.05,o,y)}return!0}populatePaintArrays(e,i,o,a,c,h,f){this.elevationBufferData&&this.elevationBufferData.populatePaintArrays(e,i,o,a,c,h,f)}update(e,i,o,a,c,h,f,_){this.elevationBufferData&&this.elevationBufferData.update(e,i,o,a,c,h,f,_),this.elevatedStructures&&this.elevatedStructures.update(e,i,o,a,c,h,f,_)}updateExpressions(e){this.elevationBufferData&&this.elevationBufferData.programConfigurations.updateExpressions(e),this.elevatedStructures&&(this.elevatedStructures.bridgeProgramConfigurations.updateExpressions(e),this.elevatedStructures.tunnelProgramConfigurations.updateExpressions(e))}upload(e){this.elevationBufferData&&this.elevationBufferData.upload(e),this.elevatedStructures&&this.elevatedStructures.upload(e)}destroy(){this.elevationBufferData&&this.elevationBufferData.destroy(),this.elevatedStructures&&this.elevatedStructures.destroy()}getUnevaluatedPortalGraph(){return this.elevatedStructures?this.elevatedStructures.unevaluatedPortals:void 0}setEvaluatedPortalGraph(e,i,o,a,c,h){this.elevatedStructures&&(this.elevatedStructures.construct(e),this.elevatedStructures.populatePaintArrays(i,o,a,c,h))}addElevatedGeometry(e,i,o,a,c,h,f){const _={elevation:a,elevationSampler:o,bias:c,index:h,featureInfo:f},[y,v]=e.addGeometry(i,this.elevationBufferData,_,this.elevatedStructures);this.elevationBufferData.heightRange==null?this.elevationBufferData.heightRange={min:y,max:v}:(this.elevationBufferData.heightRange.min=Math.min(this.elevationBufferData.heightRange.min,y),this.elevationBufferData.heightRange.max=Math.max(this.elevationBufferData.heightRange.max,v))}prepareElevatedPolygons(e,i,o){const a=1/zn(o),c=[];for(const h of e){const f=Vb(h,new av(i,a),.1);c.push(...f)}return c}clipPolygonsToTile(e,i){const o=-i,a=-i,c=Ke+i,h=Ke+i;let f=0;const _=[],y=[];for(;f<e.length;f++){const T=e[f],S=pl(T);(S.min.x>=o&&S.max.x<=c&&S.min.y>=a&&S.max.y<=h?_:y).push(T)}if(_.length===e.length)return e;const v=[new Ne(o,a),new Ne(c,a),new Ne(c,h),new Ne(o,h),new Ne(o,a)],b=_;for(const T of y)b.push(...Nb(T,v));return b}}function Gb(r,e){return r.nextPoint.sub(e.at(-2)).unit()}function qb(r,e){return e[1].sub(r.prevPoint).unit()}Je(bv,"FillHDExtension"),Je(Xn,"ElevatedStructures");class wv{constructor(e,i){this.elevationEnabled=e,this.hasDeferredElevationFeatures=!1,i&&(this.frcData=new $y)}isEmpty(){const e=!this.elevationEnabled||this.heightRange===void 0,i=!this.frcData||this.frcData.empty();return e&&i}trackFeatureFrc(e){if(!this.frcData)return null;const i=U_(e||{});return i!==null&&this.frcData.frcCoverage.add(i),i}recordFeatureRange(e,i,o,a){if(!this.frcData||o<=i)return;const c=e.segments.get();this.frcData.featureTriSegments.push({start:3*i,end:3*o,segIdx:c.length>0?c.length-1:0,frc:a})}buildFrcSegments(e){this.frcData&&!this.frcData.empty()&&vv(this.frcData,e.indexArray,e.segments)}handleFeature(e,i,o,a,c,h,f,_,y,v,b){if(!this.elevationEnabled)return!1;if(!b.terrainEnabled){const R=B_(e,a,c?c.registry:void 0,o),L=e.properties!=null&&Object.hasOwn(e.properties,$n)&&!Number.isNaN(+e.properties[$n]);if(!R&&L&&h&&(!c||!c.allProvidersReady))return this.hasDeferredElevationFeatures=!0,!0;if(R){let V=R.feature,B=R.tileId;if(!R.tileId.equals(o)){const Z=this.mergedFeatureCache?this.mergedFeatureCache.get(V.id):void 0;if(Z)V=Z,B=o;else{const oe=(function(X,ee,ie){if(!X.properties||!ee||ee.length===0)return[];const ne=+X.properties[$n];if(Number.isNaN(ne))return[];const fe=lv(ee,ne);if(fe<0)return[];const ge=[];for(let we=fe;we<ee.length&&ee[we].feature.id===ne;we++){const Se=ee[we];(Se.tileId.isChildOf(ie)||ie.isChildOf(Se.tileId)||Se.feature.constantHeight!=null)&&ge.push(Se)}return ge})(e,c?c.registry:void 0,o);oe.length>1&&(V=(function(X,ee){const ie=ee.slice().sort((Ie,Te)=>Te.tileId.z-Ie.tileId.z),ne=new Ne(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),fe=new Ne(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY),ge=[];for(const Ie of ie){const Te=new O_(Ie.tileId,X);for(const ze of Ie.feature.vertices)ge.push({position:Te.pointTransform(ze.position),height:ze.height,extent:ze.extent,index:ze.index});const Ce=Ie.feature.safeArea;lu[0]=Ce.min.x,lu[1]=Ce.min.y,cu[0]=Ce.max.x,cu[1]=Ce.max.y,Te.pointTransformInPlace(lu),Te.pointTransformInPlace(cu),ne.x=Math.min(ne.x,lu[0],cu[0]),ne.y=Math.min(ne.y,lu[1],cu[1]),fe.x=Math.max(fe.x,lu[0],cu[0]),fe.y=Math.max(fe.y,lu[1],cu[1])}const we={min:ne,max:fe};if(ie[0].feature.constantHeight!=null)return new Ka(ie[0].feature.id,we,ie[0].feature.constantHeight);ge.sort((Ie,Te)=>Ie.index-Te.index);const Se=[];for(const Ie of ge)Se.length!==0&&Se.at(-1).index===Ie.index||Se.push(Ie);const Ee=[];for(let Ie=1;Ie<Se.length;Ie++)Se[Ie].index-Se[Ie-1].index<=1&&Ee.push({a:Ie-1,b:Ie});const Ve=1/zn(X);return new Ka(ie[0].feature.id,we,void 0,Se,Ee,Ve)})(o,oe),B=o,this.mergedFeatureCache||(this.mergedFeatureCache=new Map),this.mergedFeatureCache.set(V.id,V))}}const G=ru(i,-1,-1,8193,8193),H=this.prepareElevatedLines(G,V,B,o);for(const Z of H){const oe=b.layoutVertexArray.length;b.addLine(Z,e,o,f,_,y,v);const X=new O_(o,B),ee=b.showElevationIdDebug?Db(V.id):null;for(let ie=oe;ie<b.layoutVertexArray.length;ie++){const ne=new Ne(b.layoutVertexArray.int16[6*ie]>>1,b.layoutVertexArray.int16[6*ie+1]>>1),fe=X.pointElevation(ne,V,.05);this.updateHeightRange(fe),ie<b.zOffsetVertexArray.length?b.zOffsetVertexArray.float32[4*ie]=fe:b.zOffsetVertexArray.emplaceBack(fe,0,0,0),ee?ie<b.elevationIdColVertexArray.length?(b.elevationIdColVertexArray.float32[3*ie]=ee[0],b.elevationIdColVertexArray.float32[3*ie+1]=ee[1],b.elevationIdColVertexArray.float32[3*ie+2]=ee[2]):b.elevationIdColVertexArray.emplaceBack(ee[0],ee[1],ee[2]):b.showElevationIdDebug&&(ie<b.elevationIdColVertexArray.length?(b.elevationIdColVertexArray.float32[3*ie]=0,b.elevationIdColVertexArray.float32[3*ie+1]=0,b.elevationIdColVertexArray.float32[3*ie+2]=0):b.elevationIdColVertexArray.emplaceBack(0,0,0))}}return!0}if(L&&h&&c&&c.allProvidersReady&&c.hasCoveringTile)return!0}const T=!(!e.properties||!Object.hasOwn(e.properties,"mapbox_line_metrics"))&&e.properties.mapbox_line_metrics,S=b.layoutVertexArray.length,C=[],P=ru(i,-1,-1,8193,8193,C);for(let R=0;R<P.length;R++){const L=P[R],V=C[R],B={progress:{min:V.progress.min,max:V.progress.max},nextDir:Gb(V,L),prevDir:qb(V,L)};b.addLine(L,e,o,f,_,y,v,B,T&&V.parentIndex>0?V.parentIndex:null)}return b.fillNonElevatedRoadSegment(S),!0}prepareElevatedLines(e,i,o,a){if(i.constantHeight!=null)return e;const c=[],h=1/zn(a),f=o.equals(a)?null:new O_(o,a);for(const _ of e)sy(_,new av(i,h,f),0,c);return c}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}}endPopulate(){this.mergedFeatureCache=void 0}}Je(wv,"LineHDExtension");class Tv{constructor(){this.elevatedLayoutVertexArray=new Ko,this.hasElevation=!1}beginFeature(e,i,o){const a=B_(e,i,void 0,o);this.currentFeatureElevation=a?a.feature:void 0}writeVertexQuad(e,i){const o=this.currentFeatureElevation?this.currentFeatureElevation.pointElevation(new Ne(e,i)):0;this.hasElevation=this.hasElevation||o!==0;for(let a=0;a<4;a++)this.elevatedLayoutVertexArray.emplaceBack(o)}finalize(){this.hasElevation||(this.elevatedLayoutVertexArray=void 0)}upload(e){this.elevatedLayoutVertexArray&&!this.elevatedLayoutVertexBuffer&&(this.elevatedLayoutVertexBuffer=e.createVertexBuffer(this.elevatedLayoutVertexArray,m_.members))}destroy(){this.elevatedLayoutVertexBuffer&&this.elevatedLayoutVertexBuffer.destroy()}}Je(Tv,"CircleHDExtension");const j_=(r,e,i,o)=>{for(let a=0;a<e;a++)r.emplaceBack(i[0],i[1],i[2],o[0],o[1],o[2])};class Ev{constructor(){this.elevationFeatures=[],this.elevationFeatureIdToIndex=new Map,this.elevationStateComplete=!1}addElevationFeatures(e){for(const i of e)this.elevationFeatureIdToIndex.set(i.id,this.elevationFeatures.length),this.elevationFeatures.push(i)}updateRoadElevation(e,i){if(this.elevationStateComplete)return;this.elevationStateComplete=!0,e.hasAnyZOffset=!1;let o=!1;const a=zn(i),c=1/a;let h=!1,f=!1;for(let _=0;_<e.symbolInstances.length;_++){const y=e.symbolInstances.get(_),v=Cr(1,0,0),b=Cr(0,1,0),{numHorizontalGlyphVertices:T,numVerticalGlyphVertices:S,numIconVertices:C,numVerticalIconVertices:P}=y,R=T>0||S>0,L=C>0,V=this.elevationFeatures[y.elevationFeatureIndex];if(V){const B=new Ne(y.tileAnchorX,y.tileAnchorY),G=.075+V.pointElevation(B);y.zOffset!==G&&(o=!0,y.zOffset=G),G!==0&&(e.hasAnyZOffset=!0);const H=V.computeSlopeNormal(B,c),Z=ul(ks(),Cr(0,0,1),H);Bs(v,v,Z),Bs(b,b,Z),v[2]*=a,b[2]*=a,v[0]===1&&v[1]===0&&v[2]===0&&b[0]===0&&b[1]===1&&b[2]===0||(h=h||R,f=f||L)}if(R&&(j_(e.text.orientationVertexArray,T,v,b),j_(e.text.orientationVertexArray,S,v,b)),L){const{placedIconSymbolIndex:B,verticalPlacedIconSymbolIndex:G}=y;B>=0&&j_(e.icon.orientationVertexArray,C,v,b),G>=0&&j_(e.icon.orientationVertexArray,P,v,b)}}h||(e.text.orientationVertexArray=void 0),f||(e.icon.orientationVertexArray=void 0),o&&(e.zOffsetBuffersNeedUpload=!0,e.zOffsetSortDirty=!0)}getElevationFeatureForPlacedSymbol(e,i,o){const a=e.symbolInstances.get(i.symbolInstanceIndices[o]).elevationFeatureIndex;if(a<this.elevationFeatures.length)return this.elevationFeatures[a]}}Je(Ev,"SymbolHDExtension");let Cs=null,G_=null,Wy=null,q_=null;const Sv=5120,Iv=5121,Av=5122,Cv=5123,Mv=5125,Pv=5126,H_={[Sv]:Int8Array,[Iv]:Uint8Array,[Av]:Int16Array,[Cv]:Uint16Array,[Mv]:Uint32Array,[Pv]:Float32Array},Hb={[Sv]:"DT_INT8",[Iv]:"DT_UINT8",[Av]:"DT_INT16",[Cv]:"DT_UINT16",[Mv]:"DT_UINT32",[Pv]:"DT_FLOAT32"},xp={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16};function Rv(r,e,i){const o=i.json.bufferViews.length,a=i.buffers.length;e.bufferView=o,i.json.bufferViews[o]={buffer:a,byteLength:r.byteLength},i.buffers[a]=r}const Xy="KHR_draco_mesh_compression";function $b(r,e){const i=r.extensions&&r.extensions[Xy];if(!i)return;const o=new Cs.Decoder,a=Fv(e,i.bufferView),c=new Cs.Mesh;if(!o.DecodeArrayToMesh(a,a.byteLength,c))throw new Error("Failed to decode Draco mesh");const h=e.json.accessors[r.indices],f=H_[h.componentType],_=h.count*f.BYTES_PER_ELEMENT,y=Cs._malloc(_);f===Uint16Array?o.GetTrianglesUInt16Array(c,_,y):o.GetTrianglesUInt32Array(c,_,y),Rv(Cs.memory.buffer.slice(y,y+_),h,e),Cs._free(y);for(const v of Object.keys(i.attributes)){const b=o.GetAttributeByUniqueId(c,i.attributes[v]),T=e.json.accessors[r.attributes[v]],S=Hb[T.componentType],C=T.count*xp[T.type]*H_[T.componentType].BYTES_PER_ELEMENT,P=Cs._malloc(C);o.GetAttributeDataArrayForAllPoints(c,b,Cs[S],C,P),Rv(Cs.memory.buffer.slice(P,P+C),T,e),Cs._free(P)}o.destroy(),c.destroy(),delete r.extensions[Xy]}const $_="EXT_meshopt_compression";function Zb(r,e){if(!r.extensions||!r.extensions[$_])return;const i=r.extensions[$_],o=new Uint8Array(e.buffers[i.buffer],i.byteOffset||0,i.byteLength||0),a=new Uint8Array(i.count*i.byteStride);Wy.decodeGltfBuffer(a,i.count,i.byteStride,o,i.mode,i.filter),r.buffer=e.buffers.length,r.byteOffset=0,e.buffers[r.buffer]=a.buffer,delete r.extensions[$_]}const Dv=1179937895,zv=new TextDecoder("utf8");function Lv(r,e){return new URL(r,e).href}async function Wb(r,e,i,o,a){const c=await fetch(Lv(r.uri,o),{signal:a}),h=await c.arrayBuffer();e.buffers[i]=h}function Fv(r,e){const i=r.json.bufferViews[e];return new Uint8Array(r.buffers[i.buffer],i.byteOffset||0,i.byteLength)}async function Xb(r,e,i,o,a){if(r.uri){const c=Lv(r.uri,o),h=await fetch(c,{signal:a}),f=await h.blob(),_=await createImageBitmap(f);e.images[i]=_}else if(r.bufferView!==void 0){const c=Fv(e,r.bufferView),h=new Blob([c],{type:r.mimeType}),f=await createImageBitmap(h);e.images[i]=f}}async function Ov(r,e=0,i,o){const a={json:null,images:[],buffers:[]};if(new Uint32Array(r,e,1)[0]===Dv){const S=new Uint32Array(r,e);let C=2;const P=(S[C++]>>2)-3,R=S[C++]>>2;if(C++,a.json=JSON.parse(zv.decode(S.subarray(C,C+R))),C+=R,C<P){const L=S[C++];C++;const V=e+(C<<2);a.buffers[0]=r.slice(V,V+L)}}else a.json=JSON.parse(zv.decode(new Uint8Array(r,e)));const{buffers:c,images:h,meshes:f,extensionsUsed:_,bufferViews:y}=a.json;if(c){const S=[];for(let C=0;C<c.length;C++){const P=c[C];P.uri?S.push(Wb(P,a,C,i,o)):a.buffers[C]||(a.buffers[C]=null)}await Promise.all(S)}o&&o.throwIfAborted();const v=[],b=_&&_.includes(Xy),T=_&&_.includes($_);if(b&&v.push((function(){if(!Cs)return G_!=null||(G_=(function(S){let C,P=null;function R(){C=new Uint8Array(P.buffer)}function L(){throw new Error("Unexpected Draco error.")}return WebAssembly.instantiateStreaming(S,{a:{a:L,d:function(V,B,G){return C.copyWithin(V,B,B+G)},c:function(V){const B=C.length,G=Math.max(V>>>0,Math.ceil(1.2*B)),H=Math.ceil((G-B)/65536);try{return P.grow(H),R(),!0}catch{return!1}},b:L}}).then(V=>{const{Rb:B,Qb:G,P:H,T:Z,X:oe,Ja:X,La:ee,Qa:ie,Va:ne,Wa:fe,eb:ge,jb:we,f:Se,e:Ee,yb:Ve,zb:Ie,Ab:Te,Bb:Ce,Db:ze,Gb:Fe}=V.instance.exports;P=Ee;const Be=(()=>{let De=0,Ge=0,Ze=0,Qe=0;return Xe=>{Ze&&(B(Qe),B(De),Ge+=Ze,Ze=De=0),De||(Ge+=128,De=G(Ge));const rt=Xe.length+7&-8;let vt=De;rt>=Ge&&(Ze=rt,vt=Qe=G(rt));for(let ft=0;ft<Xe.length;ft++)C[vt+ft]=Xe[ft];return vt}})();return R(),Se(),{memory:Ee,_free:B,_malloc:G,Mesh:class{constructor(){this.ptr=H()}destroy(){Z(this.ptr)}},Decoder:class{constructor(){this.ptr=X()}destroy(){we(this.ptr)}DecodeArrayToMesh(De,Ge,Ze){const Qe=Be(De),Xe=ee(this.ptr,Qe,Ge,Ze.ptr);return!!oe(Xe)}GetAttributeByUniqueId(De,Ge){return{ptr:ie(this.ptr,De.ptr,Ge)}}GetTrianglesUInt16Array(De,Ge,Ze){ne(this.ptr,De.ptr,Ge,Ze)}GetTrianglesUInt32Array(De,Ge,Ze){fe(this.ptr,De.ptr,Ge,Ze)}GetAttributeDataArrayForAllPoints(De,Ge,Ze,Qe,Xe){ge(this.ptr,De.ptr,Ge.ptr,Ze,Qe,Xe)}},DT_INT8:Ve(),DT_UINT8:Ie(),DT_INT16:Te(),DT_UINT16:Ce(),DT_UINT32:ze(),DT_FLOAT32:Fe()}})})(fetch(jo())).then(S=>{Cs=S,G_=null})),G_})()),T&&v.push((function(){var S;if(!Wy)return q_!=null||(q_=(S=fetch(vi()),WebAssembly.instantiateStreaming(S,{}).then(C=>{const{sbrk:P,memory:R,meshopt_decodeVertexBuffer:L,meshopt_decodeIndexBuffer:V,meshopt_decodeIndexSequence:B,meshopt_decodeFilterOct:G,meshopt_decodeFilterQuat:H,meshopt_decodeFilterExp:Z}=C.instance.exports,oe={ATTRIBUTES:L,TRIANGLES:V,INDICES:B},X={OCTAHEDRAL:G,QUATERNION:H,EXPONENTIAL:Z};return C.instance.exports.__wasm_call_ctors(),{decodeGltfBuffer(ee,ie,ne,fe,ge,we){const Se=ie+3&-4,Ee=P(Se*ne),Ve=P(fe.length),Ie=new Uint8Array(R.buffer);Ie.set(fe,Ve);const Te=oe[ge](Ee,ie,ne,Ve,fe.length);if(Te===0&&X[we]&&X[we](Ee,Se,ne),ee.set(Ie.subarray(Ee,Ee+ie*ne)),P(Ee-P(0)),Te!==0)throw new Error(`Malformed buffer data: ${Te}`)}}})).then(C=>{Wy=C,q_=null})),q_})()),h)for(let S=0;S<h.length;S++)v.push(Xb(h[S],a,S,i,o));if(v.length&&await Promise.all(v),o&&o.throwIfAborted(),b&&f)for(const{primitives:S}of f)for(const C of S)$b(C,a);if(T&&f&&y)for(const S of y)Zb(S,a);return a}async function Bv(r,e){const{data:i}=await xl({url:r},e);return Ov(i,0,r,e)}class Z_{constructor(e,i,o,a){if(this.triangleCount=i.length/3,this.min=new Ne(0,0),this.max=new Ne(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[c,h]=[e[0].clone(),e[0].clone()];for(let b=1;b<e.length;++b){const T=e[b];c.x=Math.min(c.x,T.x),c.y=Math.min(c.y,T.y),h.x=Math.max(h.x,T.x),h.y=Math.max(h.y,T.y)}if(a){const b=Math.ceil(Math.max(h.x-c.x,h.y-c.y)/a);o=Math.max(o,b)}if(o===0)return;this.min=c,this.max=h;const f=this.max.sub(this.min);f.x=Math.max(f.x,1),f.y=Math.max(f.y,1);const _=Math.max(f.x,f.y)/o;this.cellsX=Math.max(1,Math.ceil(f.x/_)),this.cellsY=Math.max(1,Math.ceil(f.y/_)),this.xScale=1/_,this.yScale=1/_;const y=[];for(let b=0;b<this.triangleCount;b++){const T=e[i[3*b+0]].sub(this.min),S=e[i[3*b+1]].sub(this.min),C=e[i[3*b+2]].sub(this.min),P=ca(Math.floor(Math.min(T.x,S.x,C.x)),this.xScale,this.cellsX),R=ca(Math.floor(Math.max(T.x,S.x,C.x)),this.xScale,this.cellsX),L=ca(Math.floor(Math.min(T.y,S.y,C.y)),this.yScale,this.cellsY),V=ca(Math.floor(Math.max(T.y,S.y,C.y)),this.yScale,this.cellsY),B=new Ne(0,0),G=new Ne(0,0),H=new Ne(0,0),Z=new Ne(0,0);for(let oe=L;oe<=V;++oe){B.y=G.y=oe*_,H.y=Z.y=(oe+1)*_;for(let X=P;X<=R;++X)B.x=H.x=X*_,G.x=Z.x=(X+1)*_,(iu(T,S,C,B,G,Z)||iu(T,S,C,B,Z,H))&&y.push({cellIdx:oe*this.cellsX+X,triIdx:b})}}if(y.length===0)return;y.sort((b,T)=>b.cellIdx-T.cellIdx||b.triIdx-T.triIdx);let v=0;for(;v<y.length;){const b=y[v].cellIdx,T={start:this.payload.length,len:0};for(;v<y.length&&y[v].cellIdx===b;)++T.len,this.payload.push(y[v++].triIdx);this.cells[b]=T}}_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 o=ca(e.x-this.min.x,this.xScale,this.cellsX),a=ca(e.y-this.min.y,this.yScale,this.cellsY),c=this.cells[a*this.cellsX+o];if(c){this._lazyInitLookup();for(let h=0;h<c.len;h++){const f=this.payload[c.start+h],_=Math.floor(f/8),y=1<<f%8;if(!(this.lookup[_]&y)&&(this.lookup[_]|=y,i.push(f),i.length===this.triangleCount))return}}}query(e,i,o){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 a=ca(e.x-this.min.x,this.xScale,this.cellsX),c=ca(i.x-this.min.x,this.xScale,this.cellsX),h=ca(e.y-this.min.y,this.yScale,this.cellsY),f=ca(i.y-this.min.y,this.yScale,this.cellsY);for(let _=h;_<=f;_++)for(let y=a;y<=c;y++){const v=this.cells[_*this.cellsX+y];if(v)for(let b=0;b<v.len;b++){const T=this.payload[v.start+b],S=Math.floor(T/8),C=1<<T%8;if(!(this.lookup[S]&C)&&(this.lookup[S]|=C,o.push(T),o.length===this.triangleCount))return}}}}function ca(r,e,i){return Math.max(0,Math.min(i-1,Math.floor(r*e)))}Je(Z_,"TriangleGridIndex");const Yb=zt([{name:"a_pos_3f",components:3,type:"Float32"}]),Kb=zt([{name:"a_color_3f",components:3,type:"Float32"}]),Jb=zt([{name:"a_color_4f",components:4,type:"Float32"}]),Qb=zt([{name:"a_uv_2f",components:2,type:"Float32"}]),ew=zt([{name:"a_normal_3f",components:3,type:"Float32"}]),tw=zt([{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"}]),iw=zt([{name:"a_pbr",components:4,type:"Uint16"},{name:"a_heightBasedEmissiveStrength",components:3,type:"Float32"}]);function kv(r,e){const i=W_(r.projection,r.zoom,r.width,r.height),o=(function(c,h,f,_,y){const v=new Kt(f.lng-180*rc,f.lat),b=new Kt(f.lng+180*rc,f.lat),T=c.project(v.lng,v.lat),S=c.project(b.lng,b.lat),C=-Math.atan2(S.y-T.y,S.x-T.x),P=Jr.fromLngLat(f);P.y=te(P.y,-1+rc,1-rc);const R=P.toLngLat(),L=c.project(R.lng,R.lat),V=Jr.fromLngLat(R);V.x+=rc;const B=V.toLngLat(),G=c.project(B.lng,B.lat),H=Vv(G.x-L.x,G.y-L.y,C),Z=Jr.fromLngLat(R);Z.y+=rc;const oe=Z.toLngLat(),X=c.project(oe.lng,oe.lat),ee=Vv(X.x-L.x,X.y-L.y,C),ie=Math.abs(H.x)/Math.abs(ee.y),ne=ki([]);Tn(ne,ne,-C*(1-(y?0:_)));const fe=ki([]);return Gr(fe,fe,[1,1-(1-ie)*_,1]),fe[4]=-ee.x/ee.y*_,Tn(fe,fe,C),Ri(fe,ne,fe),fe})(r.projection,0,r.center,i,e),a=Nv(r);return Gr(o,o,[a,a,1]),o}function Nv(r){const e=r.projection,i=W_(r.projection,r.zoom,r.width,r.height),o=Yy(e,r.center),a=Yy(e,Kt.convert(e.center));return Math.pow(2,o*i+(1-i)*a)}function W_(r,e,i,o,a=1/0){const c=r.range;if(!c)return 0;const h=Math.min(a,Math.max(i,o)),f=Math.log2(h/1024);return ce(c[0]+f,c[1]+f,e)}const rc=1/4e4;function Yy(r,e){const i=te(e.lat,-85.051129,co),o=new Kt(e.lng-180*rc,i),a=new Kt(e.lng+180*rc,i),c=r.project(o.lng,i),h=r.project(a.lng,i),f=Jr.fromLngLat(o),_=Jr.fromLngLat(a),y=h.x-c.x,v=h.y-c.y,b=_.x-f.x,T=_.y-f.y,S=Math.sqrt((b*b+T*T)/(y*y+v*v));return Math.log2(S)}function Vv(r,e,i){const o=Math.cos(i),a=Math.sin(i);return{x:r*o-e*a,y:r*a+e*o}}const rw=new Float64Array([1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,1]);function Uv(r,e,i){ki(r),Tn(r,r,jt(e[2])),ts(r,r,jt(e[0])),wo(r,r,jt(e[1])),Gr(r,r,i),Ri(r,r,rw)}function X_(r,e,i,o,a,c,h,f){const _=[i[0]-e[0],i[1]-e[1],0],y=[o[0]-e[0],o[1]-e[1],0];if(Bn(_)<1e-12||Bn(y)<1e-12)return ga(r);const v=hr([],_,y);bi(v,v),Vo(y,o,e),_[2]=(c-a)*f,y[2]=(h-a)*f;const b=_;return hr(b,_,y),bi(b,b),ul(r,v,b)}function Y_(r,e,i=!1){const o=Ql(e.zoom),a=(function(c,h,f){const _=h.worldSize,y=[c[12],c[13],c[14]],v=Er(y[1]/_),b=on(y[0]/_),T=ki([]),S=un(1,v)*_,C=un(1,0)*_*ka(v,h.zoom),P=1/Ry(_);let R=C*P;if(f){const G=W_(h.projection,h.zoom,h.width,h.height,1024);R=P*h.projection.pixelSpaceConversion(h.center.lat,_,G)}const L=Ba(v,b);gr(L,L,mi([],bi([],L),S*R*y[2]));const V=(function(G){const H=[G[0],G[1],G[2]];let Z=[0,1,0];const oe=hr([],Z,H);return hr(Z,H,oe),Os(Z)===0&&(Z=[0,1,0],hr(oe,H,Z)),bi(oe,oe),bi(Z,Z),bi(H,H),[oe[0],oe[1],oe[2],0,Z[0],Z[1],Z[2],0,H[0],H[1],H[2],0,G[0],G[1],G[2],1]})(L);Gr(T,T,[R,R,R*S]),wn(T,T,[-y[0],-y[1],-y[2]]);const B=Ri([],h.globeMatrix,V);return Ri(B,B,T),Ri(B,B,c),B})(r,e,i);if(o>0){const c=(function(h,f){const _=f.worldSize,y=un(1,0)*_*ka(f.center.lat,f.zoom)/Ry(_),v=un(1,f.center.lat)*_,b=ki([]);wo(b,b,jt(f.center.lng)),ts(b,b,jt(f.center.lat)),wn(b,b,[0,0,cn]),Gr(b,b,[y,y,y*v]);const T=f.point;return wn(b,b,[-T.x,-T.y,0]),Ri(b,b,h),Ri(b,f.globeMatrix,b)})(r,e);return(function(h,f,_){const y=(C,P,R)=>{const L=Bn(C),V=Bn(P),B=Wa(C,P,R);return mi(B,B,1/Bn(B)*yt(L,V,R))},v=y([h[0],h[1],h[2]],[f[0],f[1],f[2]],_),b=y([h[4],h[5],h[6]],[f[4],f[5],f[6]],_),T=y([h[8],h[9],h[10]],[f[8],f[9],f[10]],_),S=Wa([h[12],h[13],h[14]],[f[12],f[13],f[14]],_);return[v[0],v[1],v[2],0,b[0],b[1],b[2],0,T[0],T[1],T[2],0,S[0],S[1],S[2],1]})(a,c,o)}return a}function Ky(r,e,i,o){const a=Ni.projectAabbCorners(o,i);let c=Number.MAX_VALUE;for(let f=0;f<a.length;++f){const _=a[f];_[0]=(.5*_[0]+.5)*e.width,_[1]=(.5-.5*_[1])*e.height,_[2]<c&&(c=_[2])}const h=(function(f){const _=[];let y=0;for(let S=1;S<f.length;S++)(f[S][0]<f[y][0]||f[S][0]===f[y][0]&&f[S][1]<f[y][1])&&(y=S);let v,b=y;const T=new Uint8Array(f.length);do{if(T[b])break;_.push(new Ne(f[b][0],f[b][1])),T[b]=1,v=(b+1)%f.length;for(let S=0;S<f.length;S++){if(f[S][0]===f[v][0]&&f[S][1]===f[v][1]||f[S][0]===f[b][0]&&f[S][1]===f[b][1])continue;const C=[f[S][0]-f[b][0],f[S][1]-f[b][1]],P=[f[v][0]-f[b][0],f[v][1]-f[b][1]],R=C[0]*P[1]-C[1]*P[0];(R>0||R===0&&C[0]*P[0]+C[1]*P[1]>=0&&C[0]*C[0]+C[1]*C[1]>P[0]*P[0]+P[1]*P[1])&&(v=S)}b=v}while(b!==y);return _.length>0&&_.push(_[0]),_})(a);if(Kf(r,h))return c}const uu=64,Xh={CoordinateSpaceTile:1,HasMapboxMeshFeatures:4,HasMeshoptCompression:8};function K_(r,e,i,o,a,c,h,f,_,y=!1){const v=i.zoom,b=i.project(o),T=ka(o.lat,v),S=1/T;ki(r),wn(r,r,[b.x+h[0]*S,b.y+h[1]*S,h[2]]);let C=1,P=1;const R=i.worldSize;if(y){if(i.projection.name==="mercator"){let G=0;i.elevation&&(G=i.elevation.getAtPointOrZero(new Jr(b.x/R,b.y/R),0));const H=kn([],[b.x,b.y,G,1],i.projMatrix)[3]/i.cameraToCenterDistance;C=H,P=H*ka(i.center.lat,v)}else if(i.projection.name==="globe"){const G=Y_(r,i),H=[0,0,0,1];kn(H,H,Ri([],i.projMatrix,G));const Z=H[3]/i.cameraToCenterDistance,oe=Ql(v),X=i.projection.pixelsPerMeter(o.lat,R)*ka(o.lat,v),ee=i.projection.pixelsPerMeter(i.center.lat,R)*ka(i.center.lat,v);C=Z/yt(X,qm(i.center.lat),oe),P=Z*T/X,C*=ee,P*=ee}}else C=S;Gr(r,r,[C,C,P]);const L=[...r],V=e.orientation,B=[];if(Uv(B,[V[0]+(a?a[0]:0),V[1]+(a?a[1]:0),V[2]+(a?a[2]:0)],c),Ri(r,L,B),f&&i.elevation){let G=0;const H=[];if(_&&i.elevation){G=(function(oe,X,ee,ie,ne){const fe=X.elevation;if(!fe)return 0;const ge=Ni.projectAabbCorners(ee,ie),we=un(1,ne.lat)*X.worldSize,Se=(function(Ze,Qe){const Xe=[0,0,1],rt=[{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 vt of rt){const ft=Ze[vt.corners[0]],xt=Ze[vt.corners[1]],mt=Ze[vt.corners[2]],Rt=[xt[0]-ft[0],xt[1]-ft[1],Qe*(xt[2]-ft[2])],ut=hr(Rt,Rt,[mt[0]-ft[0],mt[1]-ft[1],Qe*(mt[2]-ft[2])]);bi(ut,ut),vt.dotProductWithUp=Xi(ut,Xe)}return rt.sort((vt,ft)=>vt.dotProductWithUp-ft.dotProductWithUp),rt[0].corners})(ge,we),Ee=ge[Se[0]],Ve=ge[Se[1]],Ie=ge[Se[2]],Te=ge[Se[3]],Ce=fe.getAtPointOrZero(new Jr(Ee[0]/X.worldSize,Ee[1]/X.worldSize),0),ze=fe.getAtPointOrZero(new Jr(Ve[0]/X.worldSize,Ve[1]/X.worldSize),0),Fe=fe.getAtPointOrZero(new Jr(Ie[0]/X.worldSize,Ie[1]/X.worldSize),0),Be=fe.getAtPointOrZero(new Jr(Te[0]/X.worldSize,Te[1]/X.worldSize),0),De=(Ce+Be)/2,Ge=(ze+Fe)/2;return De>Ge?ze<Fe?X_(oe,Ve,Te,Ee,ze,Be,Ce,we):X_(oe,Ie,Ee,Te,Fe,Ce,Be,we):Ce<Be?X_(oe,Ee,Ve,Ie,Ce,ze,Fe,we):X_(oe,Te,Ie,Ve,Be,Fe,ze,we),Math.max(De,Ge)})(H,i,e.aabb,r,o);const Z=Ri([],pa([],H),B);Ri(r,L,Z)}else G=i.elevation.getAtPointOrZero(new Jr(b.x/R,b.y/R),0);G!==0&&(r[14]+=G)}}class jv{constructor(e,i,o,a,c){this.materialOverrides=new Map,this.nodeOverrides=new Map,this.materialOverrideNames=[],this.nodeOverrideNames=[],this.featureProperties={},this.id=e,this.uri=i,this.position=o!=null?new Kt(o[0],o[1]):new Kt(0,0),this.orientation=a??[0,0,0],this.nodes=c,this.uploaded=!1,this.aabb=new Ni([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),this.matrix=[]}_applyTransformations(e,i){Ri(e.globalMatrix,i,e.localMatrix);const o=this.nodeOverrides.get(e.name);if(o!==void 0){if(o.orientation){const h=[];c=o.orientation,ki(a=h),wo(a,a,jt(c[1])),Tn(a,a,jt(c[2])),ts(a,a,jt(c[0])),Ri(e.globalMatrix,e.globalMatrix,h)}o.minZoom&&(e.minZoom=o.minZoom),o.maxZoom&&(e.maxZoom=o.maxZoom)}var a,c;if(e.meshes)for(const h of e.meshes){const f=Ni.applyTransformFast(h.aabb,e.globalMatrix);this.aabb.encapsulate(f)}if(e.children)for(const h of e.children)this._applyTransformations(h,e.globalMatrix)}computeBoundsAndApplyParent(){const e=ki([]);this.aabb=new Ni([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,o,a,c,h,f=!1){K_(this.matrix,this,e.transform,this.position,i,o,a,c,h,f)}upload(e){if(!this.uploaded){for(const i of this.nodes)Jy(i,e);for(const i of this.nodes)J_(i);this.uploaded=!0}}destroy(){for(const e of this.nodes)Qy(e)}}function vp(r,e,i=!1){r.uploaded||(r.gfxTexture=new Ht(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 Gv(r,e,i){r.indexBuffer=e.createIndexBuffer(r.indexArray,!1,!0),r.vertexBuffer=e.createVertexBuffer(r.vertexArray,Yb.members,!1,!0),r.normalArray&&(r.normalBuffer=e.createVertexBuffer(r.normalArray,ew.members,!1,!0)),r.texcoordArray&&(r.texcoordBuffer=e.createVertexBuffer(r.texcoordArray,Qb.members,!1,!0)),r.colorArray&&(r.colorBuffer=e.createVertexBuffer(r.colorArray,(r.colorArray.bytesPerElement===12?Kb:Jb).members,!1,!0)),r.featureArray&&(r.pbrBuffer=e.createVertexBuffer(r.featureArray,iw.members,!0)),r.segments=wi.simpleSegment(0,0,r.vertexArray.length,r.indexArray.length);const o=r.material;o.pbrMetallicRoughness.baseColorTexture&&vp(o.pbrMetallicRoughness.baseColorTexture,e),o.pbrMetallicRoughness.metallicRoughnessTexture&&vp(o.pbrMetallicRoughness.metallicRoughnessTexture,e),o.normalTexture&&vp(o.normalTexture,e),o.occlusionTexture&&vp(o.occlusionTexture,e,i),o.emissionTexture&&vp(o.emissionTexture,e)}function Jy(r,e,i){if(r.meshes)for(const o of r.meshes)Gv(o,e,i);if(r.lodMeshes)for(const o of r.lodMeshes)Gv(o,e,i);if(r.children)for(const o of r.children)Jy(o,e,i)}function qv(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 J_(r){if(r.meshes)for(const e of r.meshes)qv(e);if(r.lodMeshes)for(const e of r.lodMeshes)qv(e);if(r.children)for(const e of r.children)J_(e)}function Hv(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 Qy(r){if(r.meshes)for(const e of r.meshes)Hv(e);if(r.lodMeshes)for(const e of r.lodMeshes)Hv(e);if(r.footprintDebugMesh&&(r.footprintDebugMesh.vertexBuffer.destroy(),r.footprintDebugMesh.indexBuffer.destroy(),r.footprintDebugMesh.segments.destroy()),r.children)for(const e of r.children)Qy(e)}function ex(r,e,i,o){return r[0]<=o[0]&&e[0]>=i[0]&&r[1]<=o[1]&&e[1]>=i[1]&&r[2]<=o[2]&&e[2]>=i[2]}function nw(r,e,i,o,a,c,h,f,_,y,v){const b=.5*(y[0]+v[0]),T=.5*(y[1]+v[1]),S=.5*(y[2]+v[2]),C=.5*(v[0]-y[0]),P=.5*(v[1]-y[1]),R=.5*(v[2]-y[2]),L=r-b,V=e-T,B=i-S,G=o-b,H=a-T,Z=c-S,oe=h-b,X=f-T,ee=_-S,ie=G-L,ne=H-V,fe=Z-B,ge=oe-G,we=X-H,Se=ee-Z,Ee=L-oe,Ve=V-X,Ie=B-ee;let Te,Ce,ze,Fe,Be,De;if(Te=B*ne-V*fe,Ce=Z*ne-H*fe,ze=ee*ne-X*fe,Fe=Math.min(Te,Ce,ze),Be=Math.max(Te,Ce,ze),De=Math.abs(fe)*P+Math.abs(ne)*R,Fe>De||Be<-De||(Te=B*we-V*Se,Ce=Z*we-H*Se,ze=ee*we-X*Se,Fe=Math.min(Te,Ce,ze),Be=Math.max(Te,Ce,ze),De=Math.abs(Se)*P+Math.abs(we)*R,Fe>De||Be<-De)||(Te=B*Ve-V*Ie,Ce=Z*Ve-H*Ie,ze=ee*Ve-X*Ie,Fe=Math.min(Te,Ce,ze),Be=Math.max(Te,Ce,ze),De=Math.abs(Ie)*P+Math.abs(Ve)*R,Fe>De||Be<-De)||(Te=L*fe-B*ie,Ce=G*fe-Z*ie,ze=oe*fe-ee*ie,Fe=Math.min(Te,Ce,ze),Be=Math.max(Te,Ce,ze),De=Math.abs(fe)*C+Math.abs(ie)*R,Fe>De||Be<-De)||(Te=L*Se-B*ge,Ce=G*Se-Z*ge,ze=oe*Se-ee*ge,Fe=Math.min(Te,Ce,ze),Be=Math.max(Te,Ce,ze),De=Math.abs(Se)*C+Math.abs(ge)*R,Fe>De||Be<-De)||(Te=L*Ie-B*Ee,Ce=G*Ie-Z*Ee,ze=oe*Ie-ee*Ee,Fe=Math.min(Te,Ce,ze),Be=Math.max(Te,Ce,ze),De=Math.abs(Ie)*C+Math.abs(Ee)*R,Fe>De||Be<-De)||(Te=V*ie-L*ne,Ce=H*ie-G*ne,ze=X*ie-oe*ne,Fe=Math.min(Te,Ce,ze),Be=Math.max(Te,Ce,ze),De=Math.abs(ne)*C+Math.abs(ie)*P,Fe>De||Be<-De)||(Te=V*ge-L*we,Ce=H*ge-G*we,ze=X*ge-oe*we,Fe=Math.min(Te,Ce,ze),Be=Math.max(Te,Ce,ze),De=Math.abs(we)*C+Math.abs(ge)*P,Fe>De||Be<-De)||(Te=V*Ee-L*Ve,Ce=H*Ee-G*Ve,ze=X*Ee-oe*Ve,Fe=Math.min(Te,Ce,ze),Be=Math.max(Te,Ce,ze),De=Math.abs(Ve)*C+Math.abs(Ee)*P,Fe>De||Be<-De)||(Fe=Math.min(L,G,oe),Be=Math.max(L,G,oe),Fe>C||Be<-C)||(Fe=Math.min(V,H,X),Be=Math.max(V,H,X),Fe>P||Be<-P)||(Fe=Math.min(B,Z,ee),Be=Math.max(B,Z,ee),Fe>R||Be<-R))return!1;const Ge=ne*Se-fe*we,Ze=fe*ge-ie*Se,Qe=ie*we-ne*ge,Xe=-(Ge*L+Ze*V+Qe*B);return De=C*Math.abs(Ge)+P*Math.abs(Ze)+R*Math.abs(Qe),!(Math.abs(Xe)>De)}const ow=[];class $v{serializeFromGltf(e,i,o,a){if(e.length<7)return;let c=0;if(e[c++]!==109||e[c++]!==98||e[c++]!==120||e[c++]!==98||e[c++]!==118||e[c++]!==104||e[c++]!==43)return;const h=new DataView(e.buffer,e.byteOffset),f=h.getUint16(c,!0);if(c+=2,f===0)return;this._nodes=[];let _=0;for(let v=0;v<f;v++){const b=[i[3*_],i[3*_+1],i[3*_+2]],T=[o[3*_],o[3*_+1],o[3*_+2]];_++;const S=h.getUint16(c,!0);c+=2;let C=0,P=0;S===65535&&(C=h.getUint16(c,!0),c+=2,P=h.getUint32(c,!0),c+=4),this._nodes.push({aabbMin:b,aabbMax:T,backChild:S,indexCount:C,indexOffset:P})}const y=h.getUint32(c,!0);this._indices=a.slice(0,y)}setVertices(e){this._vertices=e}findHighestPoint(e,i){if(!this._nodes||this._nodes.length===0||!ex(this._nodes[0].aabbMin,this._nodes[0].aabbMax,e,i))return null;const o=ow;o.length=0,o.push(0);let a=-1/0;for(;o.length>0;){const c=o.pop(),h=this._nodes[c];if(h.aabbMax[2]<=a)continue;if(h.backChild===65535){for(let S=0;S<h.indexCount;S+=3){const C=3*this._indices[h.indexOffset+S],P=3*this._indices[h.indexOffset+S+1],R=3*this._indices[h.indexOffset+S+2];nw(this._vertices[C],this._vertices[C+1],this._vertices[C+2],this._vertices[P],this._vertices[P+1],this._vertices[P+2],this._vertices[R],this._vertices[R+1],this._vertices[R+2],e,i)&&(a=Math.max(a,this._vertices[C+2],this._vertices[P+2],this._vertices[R+2]))}continue}const f=c+1,_=h.backChild,y=this._nodes[f],v=this._nodes[_],b=ex(y.aabbMin,y.aabbMax,e,i),T=ex(v.aabbMin,v.aabbMax,e,i);b&&T?y.aabbMax[2]<v.aabbMax[2]?(o.push(f),o.push(_)):(o.push(_),o.push(f)):b?o.push(f):T&&o.push(_)}return a>=0?a:null}}function hu(r,e){const i=r.json.bufferViews[e.bufferView],o=H_[e.componentType];return new o(r.buffers[i.buffer],(e.byteOffset||0)+(i.byteOffset||0),e.count*(i.byteStride&&i.byteStride!==xp[e.type]*o.BYTES_PER_ELEMENT?i.byteStride/o.BYTES_PER_ELEMENT:xp[e.type]))}function tx(r,e,i,o){const a=H_[e.componentType],c=(function(b){switch(b){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:return 1}})(a),h=r.json.bufferViews[e.bufferView],f=h.byteStride?h.byteStride/a.BYTES_PER_ELEMENT:xp[e.type],_=i.float32,y=_.length/i.capacity,v=e.count*f;for(let b=0,T=0;b<v;b+=f,T+=y)for(let S=0;S<y;S++)_[T+S]=o[b+S]*c}function sw(r,e,i){const o=r.indices,a=r.attributes,c={};c.indexArray=new Mr;const h=e.json.accessors[o],f=hu(e,h);c.indexArray.resizeExact(h.count/3),c.indexArray.uint16.set(f),c.vertexArray=new ho;const _=e.json.accessors[a.POSITION],y=hu(e,_);c.vertexArray.resizeExact(_.count),c.vertexArray.float32.set(y),c.aabb=new Ni(_.min,_.max);const[v,b,T]=_.min,[S,C,P]=_.max;if(c.centroid=[.5*(v+S),.5*(b+C),.5*(T+P)],a.COLOR_0!==void 0){const L=e.json.accessors[a.COLOR_0],V=xp[L.type],B=hu(e,L);c.colorArray=V===3?new ho:new Is,c.colorArray.resizeExact(L.count),tx(e,L,c.colorArray,B)}if(a.NORMAL!==void 0){c.normalArray=new ho;const L=e.json.accessors[a.NORMAL];c.normalArray.resizeExact(L.count);const V=hu(e,L);tx(e,L,c.normalArray,V)}if(a.TEXCOORD_0!==void 0&&i.length>0){c.texcoordArray=new Ua;const L=e.json.accessors[a.TEXCOORD_0];c.texcoordArray.resizeExact(L.count);const V=hu(e,L);tx(e,L,c.texcoordArray,V)}if(a._FEATURE_ID_RGBA4444!==void 0){const L=e.json.accessors[a._FEATURE_ID_RGBA4444];e.json.extensionsUsed&&e.json.extensionsUsed.includes("EXT_meshopt_compression")&&(c.featureData=hu(e,L))}a._FEATURE_RGBA4444!==void 0&&(c.featureData=new Uint32Array(hu(e,e.json.accessors[a._FEATURE_RGBA4444]).buffer));const R=r.material;return c.material=(function(L,V){const{emissiveFactor:B=[0,0,0],alphaMode:G="OPAQUE",alphaCutoff:H=.5,normalTexture:Z,occlusionTexture:oe,emissiveTexture:X,doubleSided:ee,name:ie}=L,{baseColorFactor:ne=[1,1,1,1],metallicFactor:fe=1,roughnessFactor:ge=1,baseColorTexture:we,metallicRoughnessTexture:Se}=L.pbrMetallicRoughness||{},Ee=oe?V[oe.index]:void 0;if(oe&&oe.extensions&&oe.extensions.KHR_texture_transform&&Ee){const Ve=oe.extensions.KHR_texture_transform;Ee.offsetScale=[Ve.offset[0],Ve.offset[1],Ve.scale[0],Ve.scale[1]]}return{name:ie,pbrMetallicRoughness:{baseColorFactor:new $t(...ne),metallicFactor:fe,roughnessFactor:ge,baseColorTexture:we?V[we.index]:void 0,metallicRoughnessTexture:Se?V[Se.index]:void 0},doubleSided:ee,emissiveFactor:new $t(...B),alphaMode:G,alphaCutoff:H,normalTexture:Z?V[Z.index]:void 0,occlusionTexture:Ee,emissionTexture:X?V[X.index]:void 0,defined:L.defined===void 0}})(R!==void 0?e.json.materials[R]:{defined:!1},i),c}function ix(r,e,i){const{matrix:o,rotation:a,translation:c,scale:h,mesh:f,extras:_,children:y,name:v}=r,b={};if(b.name=v,b.localMatrix=o||(function(T,S,C,P){var R=S[0],L=S[1],V=S[2],B=S[3],G=R+R,H=L+L,Z=V+V,oe=R*G,X=R*H,ee=R*Z,ie=L*H,ne=L*Z,fe=V*Z,ge=B*G,we=B*H,Se=B*Z,Ee=P[0],Ve=P[1],Ie=P[2];return T[0]=(1-(ie+fe))*Ee,T[1]=(X+Se)*Ee,T[2]=(ee-we)*Ee,T[3]=0,T[4]=(X-Se)*Ve,T[5]=(1-(oe+fe))*Ve,T[6]=(ne+ge)*Ve,T[7]=0,T[8]=(ee+we)*Ie,T[9]=(ne-ge)*Ie,T[10]=(1-(oe+ie))*Ie,T[11]=0,T[12]=C[0],T[13]=C[1],T[14]=C[2],T[15]=1,T})([],a||[0,0,0,1],c||[0,0,0],h||[1,1,1]),b.globalMatrix=ni(b.localMatrix),f!==void 0){b.meshes=i[f];const T=b.anchor=[0,0];for(const S of b.meshes){const{min:C,max:P}=S.aabb;T[0]+=C[0]+P[0],T[1]+=C[1]+P[1]}T[0]=Math.floor(T[0]/b.meshes.length/2),T[1]=Math.floor(T[1]/b.meshes.length/2)}if(_&&(_.id&&(b.id=_.id),_.lights&&(b.lights=(function(T){if(!T.length)return[];const S=(function(V){const B=atob(V),G=new Uint8Array(B.length);for(let H=0;H<B.length;H++)G[H]=B.codePointAt(H);return G})(T),C=[],P=S.length/24,R=new Uint16Array(S.buffer),L=new Float32Array(S.buffer);for(let V=0;V<P;V++){const B=R[2*V*6]/30,G=R[2*V*6+1]/30,H=R[2*V*6+10]/100,Z=L[6*V+1],oe=L[6*V+2],X=L[6*V+3],ee=L[6*V+4],ie=X-Z,ne=ee-oe,fe=Math.hypot(ie,ne);C.push({pos:[Z+.5*ie,oe+.5*ne,G],normal:[ne/fe,-ie/fe,0],width:fe,height:B,depth:H,points:[Z,oe,X,ee]})}return C})(_.lights)),_.MAPBOX_geometry_bloom&&(b.isGeometryBloom=_.MAPBOX_geometry_bloom),_.MAPBOX_zoom_min&&(b.minZoom=_.MAPBOX_zoom_min),_.MAPBOX_zoom_max&&(b.maxZoom=_.MAPBOX_zoom_max)),y){const T=[];for(const S of y)T.push(ix(e.json.nodes[S],e,i));b.children=T}if(r.extensions&&r.extensions.mbx_bvh&&(b.meshBVH=(function(T,S,C){const P=S.binaryAccessor,R=S.positionMinAccessor,L=S.positionMaxAccessor,V=S.indexAccessor;if(!(Number.isInteger(P)&&Number.isInteger(R)&&Number.isInteger(L)&&Number.isInteger(V)))return null;const B=T.json.accessors;if(P>=B.length||R>=B.length||L>=B.length||V>=B.length)return null;const G=B[P],H=B[R],Z=B[L],oe=B[V];if(G.bufferView===void 0||H.bufferView===void 0||Z.bufferView===void 0||oe.bufferView===void 0)return null;const X=T.json.bufferViews;if(G.bufferView>=X.length||H.bufferView>=X.length||Z.bufferView>=X.length||oe.bufferView>=X.length)return null;const ee=X[G.bufferView],ie=X[H.bufferView],ne=X[Z.bufferView],fe=X[oe.bufferView];if(ee.buffer>=T.buffers.length||ie.buffer>=T.buffers.length||ne.buffer>=T.buffers.length||fe.buffer>=T.buffers.length)return null;const ge=(Be,De,Ge)=>Be>=0&&Be<=Ge&&De<=Ge-Be,we=G.byteOffset||0,Se=H.byteOffset||0,Ee=Z.byteOffset||0,Ve=oe.byteOffset||0;if(!(ge(we,0,ee.byteLength)&&ge(Se,3*H.count*4,ie.byteLength)&&ge(Ee,3*Z.count*4,ne.byteLength)&&ge(Ve,4*oe.count,fe.byteLength)))return null;const Ie=new Uint8Array(T.buffers[ee.buffer],(ee.byteOffset||0)+we,ee.byteLength-we),Te=new Float32Array(T.buffers[ie.buffer],(ie.byteOffset||0)+Se,3*H.count),Ce=new Float32Array(T.buffers[ne.buffer],(ne.byteOffset||0)+Ee,3*Z.count),ze=new Uint32Array(T.buffers[fe.buffer],(fe.byteOffset||0)+Ve,oe.count),Fe=new $v;if(Fe.serializeFromGltf(Ie,Te,Ce,ze),C!==void 0&&T.json.meshes&&T.json.meshes[C]){const Be=T.json.meshes[C].primitives[0];if(Be&&Be.attributes.POSITION!==void 0&&Be.attributes.POSITION<B.length){const De=B[Be.attributes.POSITION];if(De.bufferView!==void 0&&De.bufferView<X.length){const Ge=X[De.bufferView];if(Ge.buffer<T.buffers.length){const Ze=De.byteOffset||0,Qe=Ge.byteStride?Ge.byteStride/4:3;if(ge(Ze,De.count*Qe*4,Ge.byteLength)){const Xe=(Ge.byteOffset||0)+Ze;if(Qe===3)Fe.setVertices(new Float32Array(T.buffers[Ge.buffer],Xe,3*De.count));else{const rt=new Float32Array(T.buffers[Ge.buffer],Xe,De.count*Qe),vt=new Float32Array(3*De.count);for(let ft=0;ft<De.count;ft++)vt[3*ft]=rt[ft*Qe],vt[3*ft+1]=rt[ft*Qe+1],vt[3*ft+2]=rt[ft*Qe+2];Fe.setVertices(vt)}}}}}}return Fe})(e,r.extensions.mbx_bvh,f)),!b.meshBVH&&b.children){for(const T of b.children)if(T.meshBVH){b.meshBVH=T.meshBVH;break}}return b}function aw(r){if(r.vertices.length===0||r.indices.length===0)return null;const e=new Z_(r.vertices,r.indices,8,256),[i,o]=[e.min.clone(),e.max.clone()];return{vertices:r.vertices,indices:r.indices,grid:e,min:i,max:o}}function lw(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 o=[];for(const h of i){if(!Array.isArray(h)||h.length!==2)continue;const f=h[0],_=h[1];typeof f=="number"&&typeof _=="number"&&o.push(new Ne(f,_))}if(o.length<3)return null;o.length>1&&o.at(-1).equals(o[0])&&o.pop();let a=0;for(let h=0;h<o.length;h++){const f=o[h],_=o[(h+1)%o.length],y=o[(h+2)%o.length];a+=(f.x-_.x)*(y.y-_.y)-(y.x-_.x)*(f.y-_.y)}a>0&&o.reverse();const c=Gl(o.flatMap(h=>[h.x,h.y]),[]);return c.length===0?null:{vertices:o,indices:c}}function cw(r,e){const i=[],o=[];let a=0;const c=[];for(const h of r){a=i.length;const f=h.vertexArray.float32,_=h.indexArray.uint16;for(let y=0;y<h.vertexArray.length;y++)c[0]=f[3*y+0],c[1]=f[3*y+1],c[2]=f[3*y+2],Zi(c,c,e),i.push(new Ne(c[0],c[1]));for(let y=0;y<3*h.indexArray.length;y++)o.push(_[y]+a)}if(o.length%3!=0)return null;for(let h=0;h<o.length;h+=3){const f=i[o[h+0]],_=i[o[h+1]],y=i[o[h+2]];(f.x-_.x)*(y.y-_.y)-(y.x-_.x)*(f.y-_.y)>0&&([o[h+1],o[h+2]]=[o[h+2],o[h+1]])}return{vertices:i,indices:o}}function Zv(r,e){for(let i=0;i<r.length;i++)if(r[i].name===e)return i;return-1}function rx(r){const e=(function(v,b){const T=[],S=WebGL2RenderingContext;if(v.json.textures)for(const C of v.json.textures){const P={magFilter:S.LINEAR,minFilter:S.NEAREST,wrapS:S.REPEAT,wrapT:S.REPEAT};C.sampler!==void 0&&Object.assign(P,v.json.samplers[C.sampler]),T.push({image:b[C.source],sampler:P,uploaded:!1})}return T})(r,r.images),i=(function(v,b){const T=[];if(!v.json.meshes)return T;for(const S of v.json.meshes){const C=[];for(const P of S.primitives)C.push(sw(P,v,b));T.push(C)}return T})(r,e),{scenes:o,scene:a,nodes:c}=r.json;let h=o?Zv(o,"Default Scene"):-1;h<0&&(h=a||0);const f=o&&o[h]?o[h].nodes||[]:[...c.keys()],_=[];for(const v of f)_.push(ix(c[v],r,i));(function(v,b,T){const S={},C=new Set;for(let P=0;P<v.length;P++){const R=T[b[P]];if(!R.extras)continue;const L=R.extras["mapbox:footprint:version"],V=R.extras["mapbox:footprint:id"];(L||V)&&C.add(P),L==="1.0.0"&&V&&(S[V]=P)}for(let P=0;P<v.length;P++){if(C.has(P))continue;const R=v[P],L=T[b[P]];if(!L.extras)continue;let V=null;R.id in S&&(V=cw(v[S[R.id]].meshes,R.localMatrix)),V||(V=lw(L)),V&&(R.footprint=aw(V))}if(C.size>0){const P=Array.from(C.values()).sort((R,L)=>R-L);for(let R=P.length-1;R>=0;R--)v.splice(P[R],1)}})(_,f,r.json.nodes);const y=o?Zv(o,"LOD"):-1;if(y>=0){const v=o[y].nodes,b=new Map;for(const T of v){const S=ix(c[T],r,i);S.id&&b.set(S.id,S)}for(const T of _)if(T.id){const S=b.get(T.id);S&&S.meshes&&(T.lodMeshes=S.meshes,S.meshBVH&&(T.meshBVH=S.meshBVH))}}return _}function uw(r){r.heightmap=new Float32Array(4096),r.heightmap.fill(-1);const e=r.vertexArray.float32,i=r.aabb.min[0]-1,o=r.aabb.min[1]-1,a=uu/(r.aabb.max[0]-i+2),c=uu/(r.aabb.max[1]-o+2);for(let h=0;h<e.length;h+=3){const f=e[h+2],_=(e[h+0]-i)*a|0,y=(e[h+1]-o)*c|0;f>r.heightmap[y*uu+_]&&(r.heightmap[y*uu+_]=f)}}function Wv(r,e,i,o,a){i.reserve(i.length+4*r.length),o.reserve(o.length+10*r.length),a.reserve(a.length+10*r.length);let c=o.length;for(const h of r){const f=Math.min(10,Math.max(4,1.3*h.height))*e,_=[-h.normal[1],h.normal[0],0],y=Math.min(.29,.1*h.width/h.depth),v=h.width-2*h.depth*e*(y+.01),b=rn([],h.pos,_,v/2),T=rn([],h.pos,_,-v/2),S=[b[0],b[1],b[2]+h.height],C=[T[0],T[1],T[2]+h.height],P=rn([],h.normal,_,y);mi(P,P,f);const R=rn([],h.normal,_,-y);mi(R,R,f),gr(P,b,P),gr(R,T,R),b[2]+=.1,T[2]+=.1,o.emplaceBack(P[0],P[1],P[2]),o.emplaceBack(R[0],R[1],R[2]),o.emplaceBack(b[0],b[1],b[2]),o.emplaceBack(T[0],T[1],T[2]),o.emplaceBack(S[0],S[1],S[2]),o.emplaceBack(C[0],C[1],C[2]),o.emplaceBack(b[0],b[1],b[2]),o.emplaceBack(T[0],T[1],T[2]),o.emplaceBack(P[0],P[1],P[2]),o.emplaceBack(R[0],R[1],R[2]);const L=v/f/2;a.emplaceBack(-L-y,-1,L,.8),a.emplaceBack(L+y,-1,L,.8),a.emplaceBack(-L,0,L,1.3),a.emplaceBack(L,0,L,1.3),a.emplaceBack(L+y,-.8,L,.7),a.emplaceBack(L+y,-.8,L,.7),a.emplaceBack(0,0,L,1.3),a.emplaceBack(0,0,L,1.3),a.emplaceBack(L+y,-1.2,L,.8),a.emplaceBack(L+y,-1.2,L,.8),i.emplaceBack(6+c,4+c,8+c),i.emplaceBack(7+c,9+c,5+c),i.emplaceBack(0+c,1+c,2+c),i.emplaceBack(1+c,3+c,2+c),c+=10}}function hw(r,e){const i={};i.indexArray=new Mr,i.vertexArray=new ho,i.colorArray=new Is,i.indexArray.reserveExact(4*r.length),i.vertexArray.reserveExact(10*r.length),i.colorArray.reserveExact(10*r.length),Wv(r,e,i.indexArray,i.vertexArray,i.colorArray);const o={defined:!0};o.emissiveFactor=$t.black;const a={};return a.baseColorFactor=$t.white,o.pbrMetallicRoughness=a,i.material=o,i.aabb=new Ni([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),i}Je($v,"ModelBVH");const Xv=zt([{name:"a_pos_3f",components:3,type:"Float32"}]),dw=zt([{name:"a_normal_3",components:3,type:"Int16"}]),fw=zt([{name:"a_centroid_3",components:3,type:"Int16"}]),Yv=zt([{name:"a_part_color_emissive",components:2,type:"Uint16"}]),pw=zt([{name:"a_faux_facade_color_emissive",components:2,type:"Uint16"}]),mw=zt([{name:"a_faux_facade_data",components:4,type:"Uint16"}]),_w=zt([{name:"a_faux_facade_vertical_range",components:2,type:"Uint16"}]),gw=zt([{name:"a_bloom_attenuation",components:4,type:"Float32"}]),yw=zt([{name:"a_flood_light_wall_radius_1i16",components:1,type:"Int16"}]),xw=zt([{name:"a_pos_normal_ed",components:4,type:"Int16"}]),vw=zt([{name:"a_pos_end",components:4,type:"Int16"},{name:"a_angular_offset_factor",components:1,type:"Int16"}]),bw=zt([{name:"a_flood_light_ground_radius",components:1,type:"Float32"}]),ww=zt([{name:"a_centroid_pos",components:2,type:"Uint16"}]),Tw=zt([{name:"a_join_normal_inside",components:3,type:"Int16"}]),Ew=zt([{name:"a_hidden_by_landmark",components:1,type:"Uint8"}]),Sw=zt([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]),{members:Iw}=xw;function Q_(r,e,i,o){const a=[],c=o===0?(h,f,_,y,v,b)=>{h.push(new Ne(b,_+(b-f)/(y-f)*(v-_)))}:(h,f,_,y,v,b)=>{h.push(new Ne(f+(b-_)/(v-_)*(y-f),b))};for(const h of r){const f=[];for(const _ of h){if(_.length<=2)continue;const y=[];for(let T=0;T<_.length-1;T++){const S=_[T].x,C=_[T].y,P=_[T+1].x,R=_[T+1].y,L=o===0?S:C,V=o===0?P:R;L<e?V>e&&c(y,S,C,P,R,e):L>i?V<i&&c(y,S,C,P,R,i):y.push(_[T]),V<e&&L>=e&&c(y,S,C,P,R,e),V>i&&L<=i&&c(y,S,C,P,R,i)}let v=_.at(-1);const b=o===0?v.x:v.y;b>=e&&b<=i&&y.push(v),y.length&&(v=y.at(-1),y[0].x===v.x&&y[0].y===v.y||y.push(y[0]),f.push(y))}f.length&&a.push(f)}return a}const eg={None:0,Model:1,Symbol:2,FillExtrusion:4},nx=[new Ne(0,0),new Ne(Ke,0),new Ne(Ke,Ke),new Ne(0,Ke)];function Kv(r,e){const i=[];let o=[];if(!e||r.length<2)return[r];if(r.length===2)return Ha(r[0],r[1],nx)?[r]:[];for(let a=0;a<r.length+2;a++){const c=a===0?r.at(-1):r[(a-1)%r.length],h=r[a%r.length],f=r[(a+1)%r.length],_=Ha(c,h,nx),y=Ha(h,f,nx),v=_||y;v&&o.push(h),v&&y||o.length>0&&(o.length>1&&i.push(o),o=[])}return o.length>1&&i.push(o),i}const ox=ra.types,Aw=["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"],Cw=["fill-extrusion-flood-light-ground-radius"],Mw=Math.pow(2,13),Pw=Math.pow(2,15)-1,tg=new Ne(0,1),Ja=2147483648,ig=1073741824;function bp(r,e,i,o,a,c,h,f){r.emplaceBack((e<<1)+h,(i<<1)+c,(Math.floor(o*Mw)<<1)+a,Math.round(f))}function wp(r,e,i){r.emplaceBack(e.x*Ke,e.y*Ke,i?1:0)}function rg(r,e,i,o,a,c){r.emplaceBack(e.x,e.y,(i.x<<1)+o,(i.y<<1)+a,c)}function Tp(r,e,i){r.emplaceBack(e.x,e.y,e.z,i[0]*16384,i[1]*16384,i[2]*16384)}class Jv{constructor(){this.vertexOffset=0,this.vertexCount=0,this.indexOffset=0,this.indexCount=0}}class ng{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 o=e.data.length,a=new Uint32Array(4*o),c=[];c.length=o;for(let h=0;h<o;h++){const f=e.data[h],_=4*h;a[_]=f.vertexOffset,a[_+1]=f.vertexCount,a[_+2]=f.indexOffset,a[_+3]=f.indexCount,c[h]=f.ringIndices}return i&&i.add(a.buffer),{scalars:a,rings:c}}static deserialize(e){const{scalars:i,rings:o}=e,a=i.length/4,c=new ng,h=[];h.length=a,c.data=h;for(let f=0;f<a;f++){const _=4*f,y=new Jv;y.vertexOffset=i[_],y.vertexCount=i[_+1],y.indexOffset=i[_+2],y.indexCount=i[_+3],y.ringIndices=o[f],c.data[f]=y}return c}}class og{constructor(){this.centroidXY=new Ne(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 Ne(Number.MAX_VALUE,Number.MAX_VALUE),this.max=new Ne(-Number.MAX_VALUE,-Number.MAX_VALUE),this.height=0,this.buildingId=0,this.groupCentroidPos=new Ne(0,0)}span(){return new Ne(this.max.x-this.min.x,this.max.y-this.min.y)}}class sg{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 o=e.data.length,a=new Float64Array(15*o);for(let c=0;c<o;c++){const h=e.data[c],f=15*c;a[f]=h.centroidXY.x,a[f+1]=h.centroidXY.y,a[f+2]=h.min.x,a[f+3]=h.min.y,a[f+4]=h.max.x,a[f+5]=h.max.y,a[f+6]=h.groupCentroidPos.x,a[f+7]=h.groupCentroidPos.y,a[f+8]=h.vertexArrayOffset,a[f+9]=h.vertexCount,a[f+10]=h.groundVertexArrayOffset,a[f+11]=h.groundVertexCount,a[f+12]=h.footprintSegLen,a[f+13]=h.height,a[f+14]=h.buildingId}return i&&i.add(a.buffer),{buffer:a}}static deserialize(e){const i=e.buffer,o=i.length/15,a=new sg;a.buffer=i;const c=[];c.length=o,a.data=c;let h=0;for(let f=0;f<o;f++){const _=15*f,y=new og;y.centroidXY=new Ne(i[_],i[_+1]),y.min=new Ne(i[_+2],i[_+3]),y.max=new Ne(i[_+4],i[_+5]),y.groupCentroidPos=new Ne(i[_+6],i[_+7]),y.vertexArrayOffset=i[_+8],y.vertexCount=i[_+9],y.groundVertexArrayOffset=i[_+10],y.groundVertexCount=i[_+11],y.footprintSegLen=i[_+12],y.height=i[_+13],y.buildingId=i[_+14],y.footprintSegIdx=h,h+=y.footprintSegLen,a.data[f]=y}return a}}class sx{constructor(){this.acc=new Ne(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,o){this.accCount++,this.acc._add(i);let a=!!this.borders;i.x<e.min.x?(e.min.x=i.x,a=!0):i.x>e.max.x&&(e.max.x=i.x,a=!0),i.y<e.min.y?(e.min.y=i.y,a=!0):i.y>e.max.y&&(e.max.y=i.y,a=!0),((i.x===0||i.x===Ke)&&i.x===o.x)!=((i.y===0||i.y===Ke)&&i.y===o.y)&&this.processBorderOverlap(i,o),a&&this.checkBorderIntersection(i,o)}checkBorderIntersection(e,i){i.x<0!=e.x<0&&this.addBorderIntersection(0,yt(i.y,e.y,(0-i.x)/(e.x-i.x))),i.x>Ke!=e.x>Ke&&this.addBorderIntersection(1,yt(i.y,e.y,(Ke-i.x)/(e.x-i.x))),i.y<0!=e.y<0&&this.addBorderIntersection(2,yt(i.x,e.x,(0-i.y)/(e.y-i.y))),i.y>Ke!=e.y>Ke&&this.addBorderIntersection(3,yt(i.x,e.x,(Ke-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 o=this.borders[e];i<o[0]&&(o[0]=i),i>o[1]&&(o[1]=i)}processBorderOverlap(e,i){if(e.x===i.x){if(e.y===i.y)return;const o=e.x===0?0:1;this.addBorderIntersection(o,i.y),this.addBorderIntersection(o,e.y)}else{const o=e.y===0?2:3;this.addBorderIntersection(o,i.x),this.addBorderIntersection(o,e.x)}}centroid(){return this.accCount===0?new Ne(0,0):new Ne(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 Qv(r,e){const i=r.add(e)._unit(),o=te(r.x*i.x+r.y*i.y,-1,1);var a,c,h;return h=Math.acos(o),Math.min(4,Math.max(-4,Math.tan(h)))/4*Pw*((a=r).x*(c=e).y-a.y*c.x<0?-1:1)}const Rw=[r=>r.x<0,r=>r.x>Ke,r=>r.y<0,r=>r.y>Ke];function Dw(r,e,i,o){const a=[4];if(o===0)return a;i._mult(o);const c=r.sub(i),h=e.sub(i),f=[r,e,c,h];for(let _=0;_<4;_++)for(const y of f)if(Rw[_](y)){a.push(_);break}return a}class ax{constructor(e){this.groundRadiusArray=null,this.groundRadiusBuffer=null,this.vertexArray=new Cf,this.indexArray=new Mr,this.programConfigurations=new _o(e.layers,{zoom:e.zoom,lut:e.lut},i=>Cw.includes(i)),this._segments=new wi,this.hiddenByLandmarkVertexArray=new Zc,this._segmentToGroundQuads={},this._segmentToGroundQuads[0]=[],this._segmentToRegionTriCounts={},this._segmentToRegionTriCounts[0]=[0,0,0,0,0],this.regionSegments={},this.regionSegments[4]=new wi}getDefaultSegment(){return this.regionSegments[4]}hasData(){return this.vertexArray.length!==0}addData(e,i,o,a=!1){const c=e.length;if(c>2){let h=Math.max(0,this._segments.get().length-1);const f=this._segments._prepareSegment(4*c,this.vertexArray.length,2*this._segmentToGroundQuads[h].length);let _;h!==this._segments.get().length-1&&(h++,this._segmentToGroundQuads[h]=[],this._segmentToRegionTriCounts[h]=[0,0,0,0,0]);{const y=e[0],v=e[1];_=Qv(y.sub(e[c-1])._perp()._unit(),v.sub(y)._perp()._unit())}for(let y=0;y<c;y++){const v=y===c-1?0:y+1,b=e[y],T=e[v],S=e[v===c-1?0:v+1],C=T.sub(b)._perp()._unit(),P=Qv(C,S.sub(T)._perp()._unit()),R=_,L=P;if(lx(b,T,i)||a&&i0(b,i)&&i0(T,i)){_=P;continue}const V=f.vertexLength;rg(this.vertexArray,b,T,1,1,R),rg(this.vertexArray,b,T,1,0,R),rg(this.vertexArray,b,T,0,1,L),rg(this.vertexArray,b,T,0,0,L),f.vertexLength+=4;const B=Dw(b,T,C,o);for(const G of B)this._segmentToGroundQuads[h].push({id:V,region:G}),this._segmentToRegionTriCounts[h][G]+=2,f.primitiveLength+=2;_=P}}}prepareBorderSegments(){if(!this.hasData())return;const e=this._segments.get(),i=e.length;for(let o=0;o<i;o++)this._segmentToGroundQuads[o].sort((a,c)=>a.region-c.region);for(let o=0;o<i;o++){const a=this._segmentToGroundQuads[o],c=e[o],h=this._segmentToRegionTriCounts[o];h.reduce((_,y)=>_+y,0);let f=0;for(let _=0;_<=4;_++){const y=h[_];if(y!==0){let v=this.regionSegments[_];v||(v=this.regionSegments[_]=new wi);const b={vertexOffset:c.vertexOffset,primitiveOffset:c.primitiveOffset+f,vertexLength:c.vertexLength,primitiveLength:y};v.get().push(b)}f+=y}for(let _=0;_<a.length;_++){const y=a[_].id;this.indexArray.emplaceBack(y,y+1,y+3),this.indexArray.emplaceBack(y,y+3,y+2)}}this._segmentToGroundQuads=null,this._segmentToRegionTriCounts=null,this._segments.destroy(),this._segments=null}addPaintPropertiesData(e,i,o,a,c,h,f){this.hasData()&&this.programConfigurations.populatePaintArrays(this.vertexArray.length,e,i,o,a,c,h,void 0,f)}upload(e){this.hasData()&&(this.vertexBuffer=e.createVertexBuffer(this.vertexArray,vw.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.groundRadiusArray!=null&&(this.groundRadiusBuffer=e.createVertexBuffer(this.groundRadiusArray,bw.members)))}uploadPaintProperties(e){this.hasData()&&this.programConfigurations.upload(e)}update(e,i,o,a,c,h,f,_){this.hasData()&&this.programConfigurations.updatePaintArrays(e,i,o,a,c,h,f,_)}updateHiddenByLandmark(e){this.updateHiddenByLandmarkRange(e.groundVertexArrayOffset,e.groundVertexCount,!!(e.flags&Ja||e.flags&ig))}updateHiddenByLandmarkRange(e,i,o){if(!this.hasData())return;const a=i+e;if(i!==0){for(let c=e;c<a;++c)this.hiddenByLandmarkVertexArray.emplace(c,o?1:0);this._needsHiddenByLandmarkUpdate=!0}}uploadHiddenByLandmark(e){this.hasData()&&this._needsHiddenByLandmarkUpdate&&(!this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexArray.length>0?this.hiddenByLandmarkVertexBuffer=e.createVertexBuffer(this.hiddenByLandmarkVertexArray,Ew.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 ag{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 sg,this.footprintIndices=new Mr,this.footprintVertices=new Es,this.footprintSegments=new ng,this.layoutVertexArray=new vh,this.centroidVertexArray=new kf,this.wallVertexArray=new Vf,this.indexArray=new Mr,this.programConfigurations=new _o(e.layers,{zoom:e.zoom,lut:e.lut},i=>Aw.includes(i)),this.segments=new wi,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.groundEffect=new ax(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,o,a){return{hasLayoutChanges:!1,hasUboChanges:!1}}populate(e,i,o,a){this.features=[],this.hasPattern=gf("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=zn(o),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:c,id:h,index:f,sourceLayerIndex:_}of e){const y=this.layers[0]._featureFilter.needGeometry,v=uo(c,y);if(!this.layers[0]._featureFilter.filter(new oi(this.zoom,{worldview:this.worldview,activeFloors:i.activeFloors}),v,o))continue;const b={id:h,sourceLayerIndex:_,index:f,geometry:y?v.geometry:xn(c,o,a),properties:c.properties,type:c.type,patterns:{}},T=this.layoutVertexArray.length,S=ox[b.type]==="Polygon";if(this.hasPattern)this.features.push({featureId:c.id,feature:yf("fill-extrusion",this.layers,b,this.zoom,this.pixelRatio,i)});else if(this.wallMode)for(const C of b.geometry)for(const P of Kv(C,S))this.addFeature(c.id,b,[P],f,o,{},i.availableImages,a,i.brightness);else this.addFeature(c.id,b,b.geometry,f,o,{},i.availableImages,a,i.brightness);i.featureIndex.insert(c,b.geometry,f,_,this.index,T)}this._finalizeBuildingGroups(),this.sortBorders(),this.projection.name==="mercator"&&this.splitToSubtiles(),this.groundEffect.prepareBorderSegments(),this.polygonSegments.length=0}addFeatures(e,i,o,a,c,h){for(const{featureId:f,feature:_}of this.features){const y=ox[_.type]==="Polygon",{geometry:v}=_;if(this.wallMode)for(const b of v)for(const T of Kv(b,y))this.addFeature(f,_,[T],_.index,i,o,a,c,h);else this.addFeature(f,_,v,_.index,i,o,a,c,h)}this._finalizeBuildingGroups(),this.sortBorders(),this.projection.name==="mercator"&&this.splitToSubtiles()}update(e,i,o,a,c,h,f){this.programConfigurations.updatePaintArrays(e,i,c,o,a,h,f,this.worldview),this.groundEffect.update(e,i,c,o,a,h,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,Iw),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.wallVertexBuffer=e.createVertexBuffer(this.wallVertexArray,Tw.members),this.layoutVertexExtArray&&(this.layoutVertexExtBuffer=e.createVertexBuffer(this.layoutVertexExtArray,Sw.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,ww.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,o,a,c,h,f,_,y){const v=this.layers[0].paint.get("fill-extrusion-flood-light-ground-radius").evaluate(i,{})/this.tileToMeter,b=[new Ne(0,0),new Ne(Ke,Ke)],T=_.projection,S=T.name==="globe",C=this.wallMode||ox[i.type]==="Polygon",P=new sx;P.centroidDataIndex=this.centroidData.length;const R=new og;R.buildingId=e,i.properties&&Object.hasOwn(i.properties,"building_id")&&(R.buildingId=Number(i.properties.building_id)),P.buildingId=R.buildingId;const L=this.layers[0].paint.get("fill-extrusion-base").evaluate(i,{},c)<=0,V=this.layers[0].paint.get("fill-extrusion-height").evaluate(i,{},c);let B;if(R.height=V,R.vertexArrayOffset=this.layoutVertexArray.length,R.groundVertexArrayOffset=this.groundEffect.vertexArray.length,S&&!this.layoutVertexExtArray&&(this.layoutVertexExtArray=new Hc),this.wallMode){if(S)return void ht("Non zero fill-extrusion-line-width is not yet supported on globe.");if(o.length!==1)return;B=(function(ie){const ne=ie[0].x===ie.at(-1).x&&ie[0].y===ie.at(-1).y;(function(Ge){let Ze=0;const Qe=Ge.length;for(let Xe=0;Xe<Qe;Xe++)Ze+=(Ge[(Xe+1)%Qe].x-Ge[Xe].x)*(Ge[(Xe+1)%Qe].y+Ge[Xe].y);return Ze>=0})(ie)||(ie=ie.reverse());const ge={geometry:[],joinNormals:[],indices:[]},we=[],Se=[],Ee=[];let Ve=ie.length;for(;Ve>=2&&ie[Ve-1].equals(ie[Ve-2]);)Ve--;if(Ve<(ne?3:2))return ge;let Ie,Te,Ce,ze,Fe,Be=0;for(;Be<Ve-1&&ie[Be].equals(ie[Be+1]);)Be++;ne&&(Ie=ie[Ve-2],Fe=ie[Be].sub(Ie)._unit()._perp());for(let Ge=Be;Ge<Ve;Ge++){if(Ce=Ge===Ve-1?ne?ie[Be+1]:void 0:ie[Ge+1],Ce&&ie[Ge].equals(Ce))continue;Fe&&(ze=Fe),Ie&&(Te=Ie),Ie=ie[Ge],Fe=Ce?Ce.sub(Ie)._unit()._perp():ze,ze=ze||Fe;let Ze=ze.add(Fe);Ze.x===0&&Ze.y===0||Ze._unit();const Qe=Ze.x*Fe.x+Ze.y*Fe.y,Xe=Qe!==0?1/Qe:1/0,rt=ze.x*Fe.y-ze.y*Fe.x>0;let vt="miter";const ft=2;vt==="miter"&&Xe>ft&&(vt="bevel"),vt==="bevel"&&(Xe>100&&(vt="flipbevel"),Xe<ft&&(vt="miter"));const xt=(mt,Rt,ut,Gt)=>{const Nt=new Ne(mt.x,mt.y),Wt=new Ne(mt.x,mt.y);Nt.x+=Rt.x*Gt,Nt.y+=Rt.y*Gt,Wt.x-=Rt.x*Math.max(ut,1),Wt.y-=Rt.y*Math.max(ut,1),Ee.push(Rt),we.push(Nt),Se.push(Wt)};if(vt==="miter")Ze._mult(Xe),xt(Ie,Ze,0,0);else if(vt==="flipbevel")Ze=Fe.mult(-1),xt(Ie,Ze,0,0),xt(Ie,Ze.mult(-1),0,0);else{const mt=-Math.sqrt(Xe*Xe-1),Rt=rt?mt:0,ut=rt?0:mt;Te&&xt(Ie,ze,Rt,ut),Ce&&xt(Ie,Fe,Rt,ut)}}ge.geometry=[...we,...Se.reverse(),we[0]],ge.joinNormals=[...Ee,...Ee.reverse(),Ee.at(-1)];const De=ge.geometry.length-1;for(let Ge=0;Ge<De/2;Ge++)if(Ge+1<De/2){let Ze=Ge,Qe=Ge+1,Xe=De-1-Ge,rt=De-2-Ge;Ze=Ze===0?De-1:Ze-1,Qe=Qe===0?De-1:Qe-1,Xe=Xe===0?De-1:Xe-1,rt=rt===0?De-1:rt-1,ge.indices.push(Xe),ge.indices.push(Qe),ge.indices.push(Ze),ge.indices.push(Xe),ge.indices.push(rt),ge.indices.push(Qe)}return ge})(o[0]),o=[B.geometry]}const G=(ie,ne)=>ie<(ne.length-1)/2||ie===ne.length-1,H=this.wallMode?[o]:as(o,500);for(let ie=H.length-1;ie>=0;ie--){const ne=H[ie];(ne.length===0||Lw(ne[0]))&&H.splice(ie,1)}let Z;if(S)Z=s0(H,b,c);else{Z=[];for(const ie of H)Z.push({polygon:ie,bounds:b})}const oe=C?this.edgeRadius:0,X=oe>0&&this.zoom<17,ee=(ie,ne)=>{if(ie.length===0)return!1;const fe=ie.at(-1);return ne.x===fe.x&&ne.y===fe.y};for(const{polygon:ie,bounds:ne}of Z){let fe=0,ge=0;for(const Ve of ie)C&&!Ve[0].equals(Ve.at(-1))&&Ve.push(Ve[0]),ge+=C?Ve.length-1:Ve.length;const we=this.segments.prepareSegment((C?5:4)*ge,this.layoutVertexArray,this.indexArray);R.footprintSegIdx<0&&(R.footprintSegIdx=this.footprintSegments.length),R.polygonSegIdx<0&&(R.polygonSegIdx=this.polygonSegments.length);const Se={triangleArrayOffset:this.indexArray.length,triangleCount:0,triangleSegIdx:this.segments.segments.length-1},Ee=new Jv;if(Ee.vertexOffset=this.footprintVertices.length,Ee.indexOffset=3*this.footprintIndices.length,Ee.ringIndices=[],C){const Ve=[],Ie=[];fe=we.vertexLength;for(let Ce=0;Ce<ie.length;Ce++){const ze=ie[Ce];ze.length&&Ce!==0&&Ie.push(Ve.length/2);const Fe=[];let Be,De;Be=ze[1].sub(ze[0])._perp()._unit(),Ee.ringIndices.push(ze.length-1);for(let Ge=1;Ge<ze.length;Ge++){const Ze=ze[Ge],Qe=ze[Ge===ze.length-1?1:Ge+1],Xe=Ze.clone();if(oe){De=Qe.sub(Ze)._perp()._unit();const rt=Be.add(De)._unit(),vt=oe*Math.min(4,1/(Be.x*rt.x+Be.y*rt.y));Xe.x+=vt*rt.x,Xe.y+=vt*rt.y,Xe.x=Math.round(Xe.x),Xe.y=Math.round(Xe.y),Be=De}if(!L||oe!==0&&!X||ee(Fe,Xe)||Fe.push(Xe),bp(this.layoutVertexArray,Xe.x,Xe.y,0,0,1,1,0),this.wallMode){const rt=G(Ge,ze);wp(this.wallVertexArray,B.joinNormals[Ge],!rt)}we.vertexLength++,this.footprintVertices.emplaceBack(Ze.x,Ze.y),Ve.push(Ze.x,Ze.y),S&&Tp(this.layoutVertexExtArray,T.projectTilePoint(Xe.x,Xe.y,c),T.upVector(c,Xe.x,Xe.y))}L&&(oe===0||X)&&(Fe.length!==0&&ee(Fe,Fe[0])&&Fe.pop(),this.groundEffect.addData(Fe,ne,v))}const Te=this.wallMode?B.indices:Gl(Ve,Ie);for(let Ce=0;Ce<Te.length;Ce+=3)this.footprintIndices.emplaceBack(Ee.vertexOffset+Te[Ce+0],Ee.vertexOffset+Te[Ce+1],Ee.vertexOffset+Te[Ce+2]),this.indexArray.emplaceBack(fe+Te[Ce],fe+Te[Ce+2],fe+Te[Ce+1]),we.primitiveLength++;Ee.indexCount+=Te.length,Ee.vertexCount+=this.footprintVertices.length-Ee.vertexOffset}for(let Ve=0;Ve<ie.length;Ve++){const Ie=ie[Ve];P.startRing(R,Ie[0]);let Te=Ie.length>4&&r0(Ie[Ie.length-2],Ie[0],Ie[1]),Ce=oe?zw(Ie[Ie.length-2],Ie[0],Ie[1],oe):0;const ze=[];let Fe,Be,De;Be=Ie[1].sub(Ie[0])._perp()._unit();let Ge=!0;for(let Ze=1,Qe=0;Ze<Ie.length;Ze++){let Xe=Ie[Ze-1],rt=Ie[Ze];const vt=Ie[Ze===Ie.length-1?1:Ze+1];if(P.appendEdge(R,rt,Xe),lx(rt,Xe,ne)){oe&&(Be=vt.sub(rt)._perp()._unit(),Ge=!Ge);continue}const ft=rt.sub(Xe)._perp(),xt=ft.x/(Math.abs(ft.x)+Math.abs(ft.y)),mt=ft.y>0?1:0,Rt=Xe.dist(rt);if(Qe+Rt>32768&&(Qe=0),oe){De=vt.sub(rt)._perp()._unit();let Wt=t0(Xe,rt,vt,e0(Be,De),oe);isNaN(Wt)&&(Wt=0);const qt=rt.sub(Xe)._unit();Xe=Xe.add(qt.mult(Ce))._round(),rt=rt.add(qt.mult(-Wt))._round(),Ce=Wt,Be=De,L&&this.zoom>=17&&(ee(ze,Xe)||ze.push(Xe),ee(ze,rt)||ze.push(rt))}const ut=we.vertexLength,Gt=Ie.length>4&&r0(Xe,rt,vt);let Nt=n0(Qe,Te,Ge);if(bp(this.layoutVertexArray,Xe.x,Xe.y,xt,mt,0,0,Nt),bp(this.layoutVertexArray,Xe.x,Xe.y,xt,mt,0,1,Nt),this.wallMode){const Wt=G(Ze-1,Ie),qt=B.joinNormals[Ze-1];wp(this.wallVertexArray,qt,Wt),wp(this.wallVertexArray,qt,Wt)}if(Qe+=Rt,Nt=n0(Qe,Gt,!Ge),Te=Gt,bp(this.layoutVertexArray,rt.x,rt.y,xt,mt,0,0,Nt),bp(this.layoutVertexArray,rt.x,rt.y,xt,mt,0,1,Nt),this.wallMode){const Wt=G(Ze,Ie),qt=B.joinNormals[Ze];wp(this.wallVertexArray,qt,Wt),wp(this.wallVertexArray,qt,Wt)}if(we.vertexLength+=4,this.indexArray.emplaceBack(ut+0,ut+1,ut+2),this.indexArray.emplaceBack(ut+1,ut+3,ut+2),we.primitiveLength+=2,oe){const Wt=fe+(Ze===1?Ie.length-2:Ze-2),qt=Ze===1?fe:Wt+1;if(this.indexArray.emplaceBack(ut+1,Wt,ut+3),this.indexArray.emplaceBack(Wt,qt,ut+3),we.primitiveLength+=2,Fe===void 0&&(Fe=ut),!lx(vt,Ie[Ze],ne)){const Pi=Ze===Ie.length-1?Fe:we.vertexLength;this.indexArray.emplaceBack(ut+2,ut+3,Pi),this.indexArray.emplaceBack(ut+3,Pi+1,Pi),this.indexArray.emplaceBack(ut+3,qt,Pi+1),we.primitiveLength+=3}Ge=!Ge}if(S){const Wt=this.layoutVertexExtArray,qt=T.projectTilePoint(Xe.x,Xe.y,c),Pi=T.projectTilePoint(rt.x,rt.y,c),Dr=T.upVector(c,Xe.x,Xe.y),ai=T.upVector(c,rt.x,rt.y);Tp(Wt,qt,Dr),Tp(Wt,qt,Dr),Tp(Wt,Pi,ai),Tp(Wt,Pi,ai)}}C&&(fe+=Ie.length-1),L&&oe&&this.zoom>=17&&(ze.length!==0&&ee(ze,ze[0])&&ze.pop(),this.groundEffect.addData(ze,ne,v,oe>0))}this.footprintSegments.push(Ee),Se.triangleCount=this.indexArray.length-Se.triangleArrayOffset,this.polygonSegments.push(Se),++R.footprintSegLen,++R.polygonSegLen}if(R.vertexCount=this.layoutVertexArray.length-R.vertexArrayOffset,R.groundVertexCount=this.groundEffect.vertexArray.length-R.groundVertexArrayOffset,R.vertexCount!==0){if(R.centroidXY=P.borders?tg:this.encodeCentroid(P,R),i.properties&&Object.hasOwn(i.properties,"building_id")){const ie=R.buildingId;let ne=this.buildingGroups.get(ie);ne||(ne={accX:0,accY:0,accCount:0,mergedMin:new Ne(Number.MAX_VALUE,Number.MAX_VALUE),mergedMax:new Ne(-Number.MAX_VALUE,-Number.MAX_VALUE),partIndices:[]},this.buildingGroups.set(ie,ne)),ne.accX+=P.acc.x,ne.accY+=P.acc.y,ne.accCount+=P.accCount,ne.mergedMin.x=Math.min(ne.mergedMin.x,R.min.x),ne.mergedMin.y=Math.min(ne.mergedMin.y,R.min.y),ne.mergedMax.x=Math.max(ne.mergedMax.x,R.max.x),ne.mergedMax.y=Math.max(ne.mergedMax.y,R.max.y),ne.partIndices.push(this.centroidData.length)}if(this.centroidData.push(R),P.borders){this.featuresOnBorder.push(P);const ie=this.featuresOnBorder.length-1;for(let ne=0;ne<P.borders.length;ne++)P.borders[ne][0]!==Number.MAX_VALUE&&this.borderFeatureIndices[ne].push(ie)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,i,a,h,f,c,y,void 0,this.worldview),this.groundEffect.addPaintPropertiesData(i,a,h,f,c,y,this.worldview),this.maxHeight=Math.max(this.maxHeight,V)}}_finalizeBuildingGroups(){for(const[,e]of this.buildingGroups){if(e.partIndices.length===0)continue;const i=new sx;i.acc=new Ne(e.accX,e.accY),i.accCount=e.accCount;const o=new og;o.min=e.mergedMin,o.max=e.mergedMax;const a=this.encodeCentroid(i,o),c=i.centroid();for(const h of e.partIndices){const f=this.centroidData.get(h);f.centroidXY.x===tg.x&&f.centroidXY.y===tg.y||(f.centroidXY=a),f.min=e.mergedMin,f.max=e.mergedMax,f.groupCentroidPos=c}}this.buildingGroups.clear()}sortBorders(){for(let e=0;e<this.borderFeatureIndices.length;e++)this.borderFeatureIndices[e].sort((i,o)=>this.featuresOnBorder[i].borders[e][0]-this.featuresOnBorder[o].borders[e][0])}splitToSubtiles(){const e=[];for(let f=0;f<this.centroidData.length;f++){const _=this.centroidData.get(f),y=+(_.min.y+_.max.y>Ke),v=2*y+(+(_.min.x+_.max.x>Ke)^y);for(let b=0;b<_.polygonSegLen;b++){const T=_.polygonSegIdx+b;e.push({centroidIdx:f,subtile:v,polygonSegmentIdx:T,triangleSegmentIdx:this.polygonSegments[T].triangleSegIdx})}}const i=new Mr;e.sort((f,_)=>f.triangleSegmentIdx===_.triangleSegmentIdx?f.subtile-_.subtile:f.triangleSegmentIdx-_.triangleSegmentIdx);let o=0,a=0,c=0;for(const f of e){if(f.triangleSegmentIdx!==o)break;c++}const h=e.length;for(;a!==e.length;){o=e[a].triangleSegmentIdx;let f=0,_=a,y=a;for(let v=_;v<c&&e[v].subtile===f;v++)y++;for(;_!==c;){const v=e[_];f=v.subtile;const b=this.centroidData.get(v.centroidIdx).min.clone(),T=this.centroidData.get(v.centroidIdx).max.clone(),S={vertexOffset:this.segments.segments[o].vertexOffset,primitiveOffset:i.length,vertexLength:this.segments.segments[o].vertexLength,primitiveLength:0,sortKey:void 0,vaos:{}};for(let C=_;C<y;C++){const P=e[C],R=this.polygonSegments[P.polygonSegmentIdx],L=this.centroidData.get(P.centroidIdx).min,V=this.centroidData.get(P.centroidIdx).max,B=this.indexArray.uint16;for(let G=R.triangleArrayOffset;G<R.triangleArrayOffset+R.triangleCount;G++)i.emplaceBack(B[3*G],B[3*G+1],B[3*G+2]);S.primitiveLength+=R.triangleCount,b.x=Math.min(b.x,L.x),b.y=Math.min(b.y,L.y),T.x=Math.max(T.x,V.x),T.y=Math.max(T.y,V.y)}S.primitiveLength>0&&this.triangleSubSegments.push({segment:S,min:b,max:T}),_=y;for(let C=_;C<c&&e[C].subtile===e[_].subtile;C++)y++}a=c;for(let v=a;v<h&&e[v].triangleSegmentIdx===e[a].triangleSegmentIdx;v++)c++}i._trim(),this.indexArray=i}getVisibleSegments(e,i,o){const a=new wi;if(this.wallMode){for(const P of this.triangleSubSegments)a.segments.push(P.segment);return a}let c=0,h=0;const f=1<<e.canonical.z;if(i){const P=i.getMinMaxForTile(e);P&&(c=P.min,h=P.max)}h+=this.maxHeight;const _=e.toUnwrapped();let y;const v=[_.canonical.x/f+_.wrap,_.canonical.y/f],b=[(_.canonical.x+1)/f+_.wrap,(_.canonical.y+1)/f],T=(P,R,L)=>[yt(P[0],R[0],L[0]),yt(P[1],R[1],L[1])],S=[],C=[];for(const P of this.triangleSubSegments){S[0]=P.min.x/Ke,S[1]=P.min.y/Ke,C[0]=P.max.x/Ke,C[1]=P.max.y/Ke;const R=T(v,b,S),L=T(v,b,C);if(new Ni([R[0],R[1],c],[L[0],L[1],h]).intersectsPrecise(o)===0){y&&(a.segments.push(y),y=void 0);continue}const V=P.segment;y&&y.vertexOffset!==V.vertexOffset&&(a.segments.push(y),y=void 0),y?(y.vertexLength+=V.vertexLength,y.primitiveLength+=V.primitiveLength):y={vertexOffset:V.vertexOffset,primitiveLength:V.primitiveLength,vertexLength:V.vertexLength,primitiveOffset:V.primitiveOffset,sortKey:void 0,vaos:{}}}return y&&a.segments.push(y),a}encodeCentroid(e,i){const o=e.centroid(),a=i.span(),c=Math.min(7,Math.round(a.x*this.tileToMeter/10)),h=Math.min(6,Math.round(a.y*this.tileToMeter/10));return new Ne(te(o.x,1,8191)<<3|c,te(o.y,1,8191)<<3|h)}encodeBorderCentroid(e){if(!e.borders)return new Ne(0,0);const i=e.borders,o=Number.MAX_VALUE;if(i[0][0]!==o||i[1][0]!==o){const a=i[0][0]!==o?0:1;return new Ne(6|(i[0][0]!==o?0:65528),(i[a][0]+i[a][1])/2<<3|6)}{const a=i[2][0]!==o?2:3;return new Ne((i[a][0]+i[a][1])/2<<3|6,6|(i[2][0]!==o?0:65528))}}showCentroid(e){const i=this.centroidData.get(e.centroidDataIndex);if(i.flags&=Ja,i.groupCentroidPos.x!==0||i.groupCentroidPos.y!==0){const o=i.span(),a=Math.min(7,Math.round(o.x*this.tileToMeter/10)),c=Math.min(6,Math.round(o.y*this.tileToMeter/10));i.centroidXY=new Ne(te(i.groupCentroidPos.x,1,8191)<<3|a,te(i.groupCentroidPos.y,1,8191)<<3|c)}else i.centroidXY=new Ne(0,0);this.writeCentroidToBuffer(i)}writeCentroidToBuffer(e){this.groundEffect.updateHiddenByLandmark(e);const i=e.vertexArrayOffset,o=e.vertexCount+e.vertexArrayOffset,a=-1073741824&e.flags?tg:e.centroidXY,c=this.centroidVertexArray.geta_centroid_pos0(i);if(this.centroidVertexArray.geta_centroid_pos1(i)!==a.y||c!==a.x){for(let h=i;h<o;++h)this.centroidVertexArray.emplace(h,a.x,a.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,o){if(i.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=i.updateTime;const a=i.getReplacementRegionsForTile(e.toUnwrapped());if(D_(this.activeReplacements,a))return;if(this.activeReplacements=a,this.centroidVertexArray.length===0)this.createCentroidsBuffer();else for(const h of this.centroidData)h.flags&=1073741823;const c=[];for(const h of this.activeReplacements){if(h.order<o)continue;const f=Math.max(1,Math.pow(2,h.footprintTileId.canonical.z-e.canonical.z));if(h.footprint.buildingIds)for(const _ of this.centroidData)_.flags&Ja||_.flags&ig||h.min.x>_.max.x||_.min.x>h.max.x||h.min.y>_.max.y||_.min.y>h.max.y||h.footprint.buildingIds.has(_.buildingId)&&(_.flags|=h.clipMask!==eg.None?-1073741824:Ja);else for(const _ of this.centroidData)if(!(_.flags&Ja||_.flags&ig||h.min.x>_.max.x||_.min.x>h.max.x||h.min.y>_.max.y||_.min.y>h.max.y))for(let y=0;y<_.footprintSegLen;y++){const v=this.footprintSegments.get(_.footprintSegIdx+y);if(c.length=0,Fw(this.footprintVertices,v.vertexOffset,v.vertexCount,h.footprintTileId.canonical,e.canonical,c),Fy(h.footprint,c,this.footprintIndices.uint16,v.indexOffset,v.indexCount,-v.vertexOffset,-f)){_.flags|=h.clipMask!==eg.None?-1073741824:Ja;break}}}for(const h of this.centroidData)this.writeCentroidToBuffer(h);this.borderDoneWithNeighborZ=[-1,-1,-1,-1]}footprintContainsPoint(e,i,o){let a=!1;for(let c=0;c<o.footprintSegLen;c++){const h=this.footprintSegments.get(o.footprintSegIdx+c);let f=0;for(const _ of h.ringIndices){for(let y=f,v=_+f-1;y<_+f;v=y++){const b=this.footprintVertices.int16[2*(y+h.vertexOffset)+0],T=this.footprintVertices.int16[2*(y+h.vertexOffset)+1],S=this.footprintVertices.int16[2*(v+h.vertexOffset)+1];T>i!=S>i&&e<(this.footprintVertices.int16[2*(v+h.vertexOffset)+0]-b)*(i-T)/(S-T)+b&&(a=!a)}f=_}}return a}getHeightAtTileCoord(e,i){let o=Number.NEGATIVE_INFINITY,a=!0;const c=4*(e+Ke)*Ke+(i+Ke);if(Object.hasOwn(this.partLookup,c)){const _=this.partLookup[c];return _?{height:_.height,hidden:!!(_.flags&Ja)}:void 0}const h=this.centroidData.buffer,f=this.centroidData.length;for(let _=0;_<f;_++){const y=15*_;if(e>h[y+4]||h[y+2]>e||i>h[y+5]||h[y+3]>i)continue;const v=h[y+13];if(v<=o)continue;const b=this.centroidData.get(_);this.footprintContainsPoint(e,i,b)&&(o=v,this.partLookup[c]=b,a=!!(b.flags&Ja))}if(o!==Number.NEGATIVE_INFINITY)return{height:o,hidden:a};this.partLookup[c]=void 0}}function e0(r,e){const i=r.add(e)._unit();return r.x*i.x+r.y*i.y}function zw(r,e,i,o){const a=e.sub(r)._perp()._unit(),c=i.sub(e)._perp()._unit();return t0(r,e,i,e0(a,c),o)}function t0(r,e,i,o,a){const c=Math.sqrt(1-o*o);return Math.min(r.dist(e)/3,e.dist(i)/3,a*c/o)}function lx(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 i0(r,e){return r.x<e[0].x||r.x>e[1].x||r.y<e[0].y||r.y>e[1].y}function Lw(r){return r.every(e=>e.x<=0)||r.every(e=>e.x>=Ke)||r.every(e=>e.y<=0)||r.every(e=>e.y>=Ke)}function r0(r,e,i){if(r.x<0||r.x>=Ke||e.x<0||e.x>=Ke||i.x<0||i.x>=Ke)return!1;const o=i.sub(e),a=o.perp(),c=r.sub(e);return(o.x*c.x+o.y*c.y)/Math.sqrt((o.x*o.x+o.y*o.y)*(c.x*c.x+c.y*c.y))>-.866&&a.x*c.x+a.y*c.y<0}function n0(r,e,i){const o=e?2|r:-3&r;return i?1|o:-2&o}function o0(){const r=Math.PI/32,e=Math.tan(r),i=Zl;return i*Math.sqrt(1+2*e*e)-i}function s0(r,e,i){const o=1<<i.z,a=on(i.x/o),c=on((i.x+1)/o),h=Er(i.y/o),f=Er((i.y+1)/o);return(function(_,y,v,b,T=0,S){const C=[];if(!_.length||!v||!b)return C;const P=(Z,oe)=>{for(const X of Z)C.push({polygon:X,bounds:oe})},R=Math.ceil(Math.log2(v)),L=Math.ceil(Math.log2(b)),V=R-L,B=[];for(let Z=0;Z<Math.abs(V);Z++)B.push(V>0?0:1);for(let Z=0;Z<Math.min(R,L);Z++)B.push(0),B.push(1);let G=_;if(G=Q_(G,y[0].y-T,y[1].y+T,1),G=Q_(G,y[0].x-T,y[1].x+T,0),!G.length)return C;const H=[];for(B.length?H.push({polygons:G,bounds:y,depth:0}):P(G,y);H.length;){const Z=H.pop(),oe=Z.depth,X=B[oe],ee=Z.bounds[0],ie=Z.bounds[1],ne=X===0?ee.x:ee.y,fe=X===0?ie.x:ie.y,ge=S?S(X,ne,fe):.5*(ne+fe),we=Q_(Z.polygons,ne-T,ge+T,X),Se=Q_(Z.polygons,ge-T,fe+T,X);if(we.length){const Ee=[ee,new Ne(X===0?ge:ie.x,X===1?ge:ie.y)];B.length>oe+1?H.push({polygons:we,bounds:Ee,depth:oe+1}):P(we,Ee)}if(Se.length){const Ee=[new Ne(X===0?ge:ee.x,X===1?ge:ee.y),ie];B.length>oe+1?H.push({polygons:Se,bounds:Ee,depth:oe+1}):P(Se,Ee)}}return C})(r,e,Math.ceil((c-a)/11.25),Math.ceil((h-f)/11.25),1,(_,y,v)=>{if(_===0)return .5*(y+v);{const b=Er((i.y+y/Ke)/o);return(Yr(.5*(Er((i.y+v/Ke)/o)+b))*o-i.y)*Ke}})}function Fw(r,e,i,o,a,c){const h=Math.pow(2,o.z-a.z);for(let f=0;f<i;f++){let _=r.int16[2*(f+e)+0],y=r.int16[2*(f+e)+1];_=(_+a.x*Ke)*h-o.x*Ke,y=(y+a.y*Ke)*h-o.y*Ke,c.push(new Ne(_,y))}}Je(ag,"FillExtrusionBucket",{omit:["layers","features"]}),Je(og,"PartData"),Je(sg,"PartDataArray"),Je(ng,"FootprintSegmentArray"),Je(sx,"BorderCentroidData"),Je(ax,"GroundEffect");const cx=4096;class Ow{constructor(e){this.module=e,this.memoryStack=this.module.malloc(cx),this.memoryStackNextFree=this.memoryStack}createIntArray(e){const i=this.memoryStackNextFree;return this.memoryStackNextFree+=e.length*Int32Array.BYTES_PER_ELEMENT,this.memoryStackNextFree-this.memoryStack>cx?-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>cx?-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,o){this.module.setFauxFacadeOptions(e?1:0,i?1:0,o)}setFacadeClassifierOptions(e){this.module.setFacadeClassifierOptions(e)}generateMesh(e,i){this.memoryStackNextFree=this.memoryStack;for(const f of e){const _=this.createIntArray(f.ringIndices),y=this.createFloatArray(f.coordinates);if(_===-1||y===-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,y,_,f.ringIndices.length-1)}for(const f of i){let _;_=f.entrances?JSON.parse(f.entrances):[];const y=this.createFloatArray(_),v=this.createFloatArray(f.coordinates);if(y===-1||v===-1)return`building_gen: Out of stack memory: ${this.memoryStackNextFree-this.memoryStack}/4096`;this.module.addFacade(f.sourceId,f.crossPerc,f.distanceToRoad,y,_.length,v,f.coordinates.length)}if(!this.module.generateMesh()){const f=this.module.getLastError();return this.readStringBuffer(f)}const o=this.module.getMeshCount(),a=new Array(o);for(let f=0;f<o;f++){const _=this.module.getPositionsPtr(f),y=this.module.getPositionsLength(f),v=new Float32Array(this.module.heapF32.buffer,_,y),b=this.module.getNormalsPtr(f),T=this.module.getNormalsLength(f),S=new Float32Array(this.module.heapF32.buffer,b,T),C=this.module.getAOPtr(f),P=this.module.getAOLength(f),R=new Float32Array(this.module.heapF32.buffer,C,P),L=this.module.getUVPtr(f),V=this.module.getUVLength(f),B=new Float32Array(this.module.heapF32.buffer,L,V),G=this.module.getFauxFacadePtr(f),H=this.module.getFauxFacadeLength(f),Z=new Uint8Array(this.module.heapU8.buffer,G,H),oe=this.module.getIndicesPtr(f),X=this.module.getIndicesLength(f),ee=new Int16Array(this.module.heap16.buffer,oe,X),ie=this.module.getBuildingPart(f);a[f]={positions:v,normals:S,ao:R,uv:B,isFauxFacade:Z,indices:ee,buildingPart:ie}}const c=this.module.getRingCount(),h=[];for(let f=0;f<c;f++){const _=this.module.getRingPtr(f),y=this.module.getRingLength(f),v=new Float32Array(this.module.heapF32.buffer,_,y);h.push(v)}return{meshes:a,outerRingLength:this.module.getOuterRingLength(),modifiedPolygonRings:h}}}const a0=ra.types,lg=32767;function Bw(r,e){const i=Ke+e;for(const o of r)for(const a of o)if(a.x<-e||a.x>i||a.y<-e||a.y>i)return!1;return!0}function kw(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 l0,c0,Yh=null,u0=null,Lo=null;class ux{constructor(){this.layoutVertexArray=new ho,this.layoutAttenuationArray=new Is,this.layoutColorArray=new fo,this.indexArray=new Mr,this.indexArrayForConflation=new Mr,this.segmentsBucket=new wi}}class hx{constructor(e){this.layoutFacadePaintArray=null,this.layoutFacadeDataArray=null,this.layoutFacadeVerticalRangeArray=null,this.segmentsBucket=new wi,this.entranceBloom=new ux;const i=66560;this.layoutVertexArray=new ho,this.layoutVertexArray.reserve(i),this.layoutNormalArray=new Wl,this.layoutNormalArray.reserve(i),this.layoutCentroidArray=new Wl,this.layoutCentroidArray.reserve(i),this.layoutColorArray=new fo,this.layoutColorArray.reserve(i),this.layoutFloodLightDataArray=new ja,this.layoutFloodLightDataArray.reserve(i),this.layoutAOArray=new Zc,this.layoutAOArray.reserve(i),this.indexArray=new Mr,this.indexArray.reserve(66560),this.indexArrayForConflation=new Mr,this.segmentsBucket=new wi,this.entranceBloom=new ux,e&&(this.layoutFacadePaintArray=new fo,this.layoutFacadeDataArray=new Va,this.layoutFacadeVerticalRangeArray=new fo)}reserve(e,i,o){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),o&&(this.layoutFacadePaintArray.reserveForAdditional(e),this.layoutFacadeDataArray.reserveForAdditional(e),this.layoutFacadeVerticalRangeArray.reserveForAdditional(e))}}class h0{constructor(e){this.requiresHDRuntime=!0,this.colorBufferUploaded=!1,this.maxHeight=0,this.replacementUpdateTime=0,this.activeReplacements=[],this.footprints=[],this.footprintsVertices=new Ua,this.footprintsIndices=new Ih,this.footprintsMin=new Ne(1/0,1/0),this.footprintsMax=new Ne(-1/0,-1/0),this.featuresOnBorder=[],this.buildingWithoutFacade=new hx(!1),this.buildingWithFacade=new hx(!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 _o(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 ax(e),this.groundEffect.groundRadiusArray=new Ko,this.hasAppearances=null}updateFootprints(e,i){const o=new Z_([],[],1),a={vertices:[],indices:new Uint32Array(0),grid:o,min:this.footprintsMin,max:this.footprintsMax,buildingIds:this.buildingIds};i.push({footprint:a,id:e})}updateAppearances(e,i,o,a){return{hasLayoutChanges:!1,hasUboChanges:!1}}populate(e,i,o,a){if(!Lo)return;const c=zn(o);this.tileToMeter=c,this.brightness=i.brightness,Lo.setStyle({normalScale:[1,-1,c],tileToMeters:c}),Lo.setAOOptions(!1,.3),Lo.setMetricOptions(!1,16),Lo.setStructuralOptions(!0),Lo.setFacadeClassifierOptions(3);const h=new Map,f=new Map;let _=0;for(const{feature:R}of e){if(a0[R.type]!=="LineString"){h.set(R.id,R.properties.source_id);continue}const L=this.layers[0]._featureFilter.needGeometry;if(L&&!this.layers[0]._featureFilter.filter(new oi(this.zoom),R,o))continue;const V=uo(R,L);if(!L&&!this.layers[0]._featureFilter.filter(new oi(this.zoom),V,o))continue;const B=L?V.geometry:xn(R,o,a),G=[];for(const X of B)for(const ee of X)G.push(ee.x),G.push(ee.y);const H={coordinates:G,crossPerc:R.properties.cross_perc,distanceToRoad:R.properties.distance_to_road,entrances:R.properties.entrances,sourceId:0},Z=R.properties.source_id;let oe=f.get(Z);oe||(oe=[],f.set(Z,oe)),oe.push(H),++_}this.maxHeight=0;const y=new Array,v=new Set,b=R=>{R!=null&&v.add(R)},T=(R,L)=>{R!=null&&y.push({buildingId:R,footprintIndex:L})},S=64*(e.length-_),C=S/2;this.buildingWithFacade.reserve(S,C,!0),this.buildingWithoutFacade.reserve(2*S,2*C,!1),this.footprintsIndices.reserve(16*(e.length-_)),this.footprintsVertices.reserve(8*(e.length-_));for(const{feature:R,id:L,index:V,sourceLayerIndex:B}of e){if(a0[R.type]==="LineString")continue;const G=this.layers[0]._featureFilter.needGeometry;if(G&&!this.layers[0]._featureFilter.filter(new oi(this.zoom),R,o))continue;let H=null;if(R.properties&&Object.hasOwn(R.properties,"building_id")&&(H=Number(R.properties.building_id),v.has(H)))continue;const Z=uo(R,G);if(!G&&!this.layers[0]._featureFilter.filter(new oi(this.zoom),Z,o))continue;const oe=G?Z.geometry:xn(R,o,a),X=as(oe,500);let ee=!1;for(const Pt of X)if(Pt.length!==1){ee=!0;break}if(ee){b(H);continue}if(!Bw(oe,163)){b(H);continue}const ie=this.layers[0],ne=kw(ie.layout.get("building-roof-shape").evaluate(R,{},o)),fe=ie.layout.get("building-base").evaluate(R,{},o),ge=ie.layout.get("building-height").evaluate(R,{},o),we=ie.layout.get("building-flood-light-ground-radius").evaluate(R,{},o),Se=ie.paint.get("building-ambient-occlusion-intensity"),Ee=we/this.tileToMeter;R.properties["building-part"]="roof";const Ve=ie.paint.get("building-color").evaluate(R,{},this.canonical).toPremultipliedRenderColor(this.lut),Ie=ie.paint.get("building-emissive-strength").evaluate(R,{},this.canonical);R.properties["building-part"]="wall";const Te=ie.paint.get("building-color").evaluate(R,{},this.canonical).toPremultipliedRenderColor(this.lut),Ce=ie.paint.get("building-emissive-strength").evaluate(R,{},this.canonical);R.properties["building-part"]="window";const ze=ie.paint.get("building-color").evaluate(R,{},this.canonical).toPremultipliedRenderColor(this.lut),Fe=ie.paint.get("building-emissive-strength").evaluate(R,{},this.canonical);R.properties["building-part"]="door";const Be=ie.paint.get("building-color").evaluate(R,{},this.canonical).toPremultipliedRenderColor(this.lut),De=ie.paint.get("building-emissive-strength").evaluate(R,{},this.canonical);let Ge=ie.layout.get("building-flood-light-wall-radius").evaluate(R,{},o);Ge=te(Ge,0,2048);const Ze=Ge/2048*lg,Qe=h.get(L),Xe=f.get(Qe)||[],rt=Xe.length!==0&&ie.layout.get("building-facade").evaluate(R,{},o);Lo.setFacadeOptions(4,!0),Lo.setFauxFacadeOptions(rt,!1,1);let vt=0,ft=0,xt=0,mt=0,Rt=0,ut=0,Gt=0,Nt=0,Wt=0,qt=0,Pi=0;if(rt){let Pt=Math.round(ie.layout.get("building-facade-floors").evaluate(R,{},o));if(fe===0){Pt=Math.max(1,Pt-(Xe.length>0?1:0));let Bi=4;if(ge>100){const nr=[10,13,15];Bi=nr[R.id?R.id%nr.length:0]}else ge<=10&&(Bi=3);Lo.setFacadeOptions(Bi,!0),Rt=(ge<15?1.3:1.61803)*Bi/c}else Rt=fe/c;ut=ge/c,Rt=Math.min(Rt,ut),xt=ie.layout.get("building-facade-unit-width").evaluate(R,{},o)/c,mt=(ut-Rt)/Pt,Lo.setFauxFacadeOptions(!0,!0,xt);const ur=ie.layout.get("building-facade-window").evaluate(R,{},o);vt=ur[0],ft=ur[1],Gt=Math.floor(65535*Math.min(1,Rt/Ke)),Nt=Math.floor(65535*Math.min(1,ut/Ke)),Wt=Math.floor(255*vt)<<8|Math.floor(255*ft),qt=Math.floor(65535*Math.min(1,xt/Ke)),Pi=Math.floor(65535*Math.min(1,mt/Ke))}const Dr=Array(X.length),ai={x:1/0,y:1/0},hi={x:-1/0,y:-1/0},Ji={x:0,y:0};let vr=0;for(let Pt=0;Pt<X.length;Pt++){const ur=X[Pt];if(ur.length>0){const Bi=[],nr=Array(ur.length+1);nr[0]=0;for(let Jn=0;Jn<ur.length;Jn++){const Qn=ur[Jn];for(let xo=0;xo<Qn.length;xo++){const vo=Qn[Qn.length-xo-1];ai.x=Math.min(ai.x,vo.x),ai.y=Math.min(ai.y,vo.y),hi.x=Math.max(hi.x,vo.x),hi.y=Math.max(hi.y,vo.y),Ji.x+=vo.x,Ji.y+=vo.y,vr++,Bi.push(vo.x),Bi.push(vo.y)}nr[Jn+1]=Bi.length}Dr[Pt]={id:R.id?R.id:0,height:ge,minHeight:fe,sourceId:0,roofType:ne,coordinates:Bi,ringIndices:nr}}}Ji.x/=vr||1,Ji.y/=vr||1;const Vi=Lo.generateMesh(Dr,Xe);if(typeof Vi=="string"){ht(`Unable to generate building ${R.id}: ${Vi}`),b(H);continue}if(Vi.meshes.length===0||Vi.modifiedPolygonRings.length===0){b(H);continue}const It=rt?this.buildingWithFacade:this.buildingWithoutFacade;let zr=0;for(const Pt of Vi.meshes)zr+=Pt.positions.length/3;const br=It.segmentsBucket.prepareSegment(zr,It.layoutVertexArray,It.indexArray),wr=[];let Wi=null,Qi=0,mr=-1;const ji=It.layoutVertexArray.length,yi=ji+zr;It.layoutVertexArray.resize(yi),It.layoutCentroidArray.resize(yi),It.layoutNormalArray.resize(yi),It.layoutAOArray.resize(yi),It.layoutColorArray.resize(yi),It.layoutFloodLightDataArray.resize(yi),rt&&(It.layoutFacadePaintArray.resize(yi),It.layoutFacadeDataArray.resize(yi),It.layoutFacadeVerticalRangeArray.resize(yi));const Lr=It.indexArray.length;let pu=0,Ir=ji;for(const Pt of Vi.meshes){let ur,Bi;if(Pt.buildingPart===1)ur=Ve,Bi=Ie;else if(Pt.buildingPart===0)ur=Te,Bi=Ce;else if(Pt.buildingPart===2)ur=ze,Bi=Fe;else{if(Pt.buildingPart!==3)continue;ur=Be,Bi=De}if(Bi=te(Bi,0,1),Pt.buildingPart===3){const _r=new Array;for(let en=0;en<Pt.positions.length;en+=12){const ua=Pt.positions[en+0],Rs=Pt.positions[en+1],Oo=Pt.positions[en+3],rd=Pt.positions[en+4],wg=Pt.positions[en+2],On=Pt.positions[en+8]-wg,Bo=1,ko=Oo-ua,Ds=rd-Rs,Lp=Math.hypot(ko,Ds);_r.push({pos:[ua+.5*ko,Rs+.5*Ds,wg],normal:[Ds/Lp,-ko/Lp,0],width:Lp,height:On,depth:Bo,points:[ua,Rs,Oo,rd]})}const er=It.entranceBloom.segmentsBucket.prepareSegment(10*_r.length,It.entranceBloom.layoutVertexArray,It.entranceBloom.indexArray),Ar=It.entranceBloom.layoutVertexArray.length;Qi=It.entranceBloom.indexArray.length,Wv(_r,.5/this.tileToMeter,It.entranceBloom.indexArray,It.entranceBloom.layoutVertexArray,It.entranceBloom.layoutAttenuationArray);const fn=It.entranceBloom.layoutVertexArray.length-Ar;mr=It.entranceBloom.indexArray.length-Qi;for(let en=0;en<fn;en++)It.entranceBloom.layoutColorArray.emplaceBack(255*Be.r<<8|255*Be.g,255*Be.b<<8|51*De);er.vertexLength+=fn,er.primitiveLength+=mr,Wi={part:Pt.buildingPart,vertexOffset:Ar,vertexLength:fn}}It.layoutVertexArray.float32.set(Pt.positions,3*Ir);const nr=Pt.positions.length/3;for(let _r=0;_r<nr;++_r){const er=3*_r;pu=Math.max(pu,Pt.positions[er+2]);const Ar=Pt.normals[er+1]*lg,fn=Pt.normals[er+2]*lg,en=3*(Ir+_r);It.layoutNormalArray.int16[en]=Pt.normals[er]*lg,It.layoutNormalArray.int16[en+1]=Ar,It.layoutNormalArray.int16[en+2]=fn;const ua=Pt.ao[_r];It.layoutAOArray.uint8[Ir+_r]=255*ua;const Rs=1+(ua-1)*Se,Oo=255*ur.b*Rs<<8|255*Bi;It.layoutColorArray.uint16[2*(Ir+_r)]=255*ur.r*Rs<<8|255*ur.g*Rs,It.layoutColorArray.uint16[2*(Ir+_r)+1]=Oo}const Jn=Math.min(8191,Math.max(0,Math.floor(Ji.x))),Qn=Math.min(8191,Math.max(0,Math.floor(Ji.y))),xo=Math.floor(ge),vo=20,vg=4*Jn+Math.min(3,Math.round((hi.x-ai.x)*this.tileToMeter/vo)),bg=4*Qn+Math.min(3,Math.round((hi.y-ai.y)*this.tileToMeter/vo));for(let _r=0;_r<nr;++_r){const er=3*(Ir+_r);It.layoutCentroidArray.int16[er]=vg,It.layoutCentroidArray.int16[er+1]=bg,It.layoutCentroidArray.int16[er+2]=xo}if(It.layoutFloodLightDataArray.int16.fill(Pt.buildingPart===0?Ze:0,Ir,Ir+nr),rt){const _r=255*ze.r<<8|255*ze.g,er=255*ze.b<<8|255*Fe;for(let Ar=0;Ar<nr;++Ar){const fn=2*(Ir+Ar);It.layoutFacadePaintArray.uint16[fn]=_r,It.layoutFacadePaintArray.uint16[fn+1]=er}for(let Ar=0;Ar<nr;++Ar)if(Pt.isFauxFacade[Ar]){const fn=Math.min(65535,Math.floor(Pt.uv[2*Ar]*Vi.outerRingLength));It.layoutFacadeDataArray.emplace(Ir+Ar,1|fn,Wt,qt,Pi),It.layoutFacadeVerticalRangeArray.emplace(Ir+Ar,Gt,Nt)}else It.layoutFacadeDataArray.emplace(Ir+Ar,0,0,0,0),It.layoutFacadeVerticalRangeArray.emplace(Ir+Ar,0,0)}const td=br.vertexLength,zp=Pt.indices.length/3,id=It.indexArray.length;It.indexArray.resize(id+zp);for(let _r=0;_r<zp;++_r){const er=3*_r,Ar=3*id+er;It.indexArray.uint16[Ar]=td+Pt.indices[er],It.indexArray.uint16[Ar+1]=td+Pt.indices[er+1],It.indexArray.uint16[Ar+2]=td+Pt.indices[er+2]}Pt.buildingPart!==1&&Pt.buildingPart!==0&&Pt.buildingPart!==2&&Pt.buildingPart!==3||wr.push({part:Pt.buildingPart,vertexOffset:Ir,vertexLength:Pt.positions.length/3}),Ir+=nr,br.vertexLength+=nr,br.primitiveLength+=Pt.indices.length/3}this.maxHeight=Math.max(this.maxHeight,pu);const Kn=It.indexArray.length-Lr,oc=this.footprintsIndices.length,Dp=this.footprintsVertices.length,yg=[],el=new Ne(1/0,1/0),tl=new Ne(-1/0,-1/0),xg=this.groundEffect.vertexArray.length;for(const Pt of Vi.modifiedPolygonRings){const ur=[],Bi=new Ne(1/0,1/0),nr=new Ne(-1/0,-1/0);for(let Jn=0;Jn<Pt.length;Jn+=2){const Qn=Pt.length-Jn-2;Bi.x=Math.min(Bi.x,Pt[Qn]),Bi.y=Math.min(Bi.y,Pt[Qn+1]),nr.x=Math.max(nr.x,Pt[Qn]),nr.y=Math.max(nr.y,Pt[Qn+1]);const xo=new Ne(Pt[Qn],Pt[Qn+1]);ur.push(xo),yg.push(xo.x,xo.y),this.footprintsVertices.emplaceBack(xo.x,xo.y)}el.x=Math.min(el.x,Bi.x),el.y=Math.min(el.y,Bi.y),tl.x=Math.max(tl.x,nr.x),tl.y=Math.max(tl.y,nr.y),this.groundEffect.addData(ur,[Bi,nr],Ee)}const ed=this.groundEffect.vertexArray.length-xg;this.groundEffect.groundRadiusArray.reserveForAdditional(ed);for(let Pt=0;Pt<ed;Pt++)this.groundEffect.groundRadiusArray.emplaceBack(we);(ai.x<0||hi.x>Ke||ai.y<0||hi.y>Ke)&&this.featuresOnBorder.push({featureId:R.id,footprintIndex:this.footprints.length});{const Pt=Gl(yg,null,2);this.footprintsIndices.resize(this.footprintsIndices.length+Pt.length),this.footprintsIndices.uint16.set(Pt,oc),this.buildingIds.add(H??R.id),this.footprintsMin.x=Math.min(this.footprintsMin.x,el.x),this.footprintsMin.y=Math.min(this.footprintsMin.y,el.y),this.footprintsMax.x=Math.max(this.footprintsMax.x,tl.x),this.footprintsMax.y=Math.max(this.footprintsMax.y,tl.y);const ur={footprintVertexOffset:Dp,footprintVertexLength:this.footprintsVertices.length-Dp,footprintIndexOffset:oc,footprintIndexLength:this.footprintsIndices.length-oc,min:el,max:tl,hiddenFlags:0,indicesOffset:Lr,indicesLength:Kn,bloomIndicesOffset:Qi,bloomIndicesLength:mr,groundEffectVertexOffset:xg,groundEffectVertexLength:ed,hasFauxFacade:rt,height:pu,promoteId:L,feature:Z,parts:wr,buildingBloom:Wi},Bi=this.footprints.length;R.id!==void 0&&this.featureFootprintLookup.set(R.id,Bi),T(H,Bi),this.footprints.push(ur)}this.programConfigurations.populatePaintArrays(It.layoutVertexArray.length,R,V,{},i.availableImages,o,i.brightness),this.groundEffect.addPaintPropertiesData(R,V,{},i.availableImages,o,i.brightness),i.featureIndex.insert(R,oe,V,B,this.index,ji)}y.forEach(({buildingId:R,footprintIndex:L})=>{v.has(R)&&(this.footprints[L].hiddenFlags|=4)});const P=new Set;this.buildingIds.forEach((R,L,V)=>{v.has(R)||P.add(R)}),this.buildingIds=P,this.groundEffect.prepareBorderSegments()}update(e,i,o,a,c,h,f){this.programConfigurations.updatePaintArrays(e,i,c,o,a,h,f),this.groundEffect.update(e,i,c,o,a,h,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=o=>{o.layoutVertexBuffer=e.createVertexBuffer(o.layoutVertexArray,Xv.members),o.layoutNormalBuffer=e.createVertexBuffer(o.layoutNormalArray,dw.members),o.layoutCentroidBuffer=e.createVertexBuffer(o.layoutCentroidArray,fw.members),o.layoutFloodLightDataBuffer=e.createVertexBuffer(o.layoutFloodLightDataArray,yw.members),o.layoutFacadeDataArray&&o.layoutFacadeDataArray.length&&(o.layoutFacadeDataBuffer=e.createVertexBuffer(o.layoutFacadeDataArray,mw.members)),o.layoutFacadeVerticalRangeArray&&o.layoutFacadeVerticalRangeArray.length&&(o.layoutFacadeVerticalRangeBuffer=e.createVertexBuffer(o.layoutFacadeVerticalRangeArray,_w.members)),o.entranceBloom.layoutVertexArray.length&&(o.entranceBloom.layoutVertexBuffer=e.createVertexBuffer(o.entranceBloom.layoutVertexArray,Xv.members),o.entranceBloom.layoutAttenuationBuffer=e.createVertexBuffer(o.entranceBloom.layoutAttenuationArray,gw.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,o=!0){let a=!1;const c=o?i:0,h=0|(o?-1:~i);this.groundEffect.hiddenByLandmarkVertexArray.length===0&&this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length);for(const f of e){const _=this.footprints[f],y=_.hiddenFlags&h|c;_.hiddenFlags!==y&&(_.hiddenFlags=y,a=!0,this.groundEffect.updateHiddenByLandmarkRange(_.groundEffectVertexOffset,_.groundEffectVertexLength,_.hiddenFlags!==0))}return a&&(this.indexArrayForConflationUploaded=!1),a}uploadUpdatedIndexBuffer(e){if(this.groundEffect.uploadHiddenByLandmark(e),this.indexArrayForConflationUploaded)return;const i=a=>{a.indexArray.length!==0&&(a.indexArrayForConflation.resize(a.indexArray.length),a.indexArrayForConflation.uint16.set(a.indexArray.uint16),a.entranceBloom.indexArrayForConflation.resize(a.entranceBloom.indexArray.length),a.entranceBloom.indexArrayForConflation.uint16.set(a.entranceBloom.indexArray.uint16))};i(this.buildingWithoutFacade),i(this.buildingWithFacade);for(const a of this.footprints){const c=a.hasFauxFacade?this.buildingWithFacade:this.buildingWithoutFacade,h=a.indicesOffset+a.indicesLength;if(a.hiddenFlags!==0){for(let _=a.indicesOffset;_<h;_++)c.indexArrayForConflation.uint16[3*_+0]=0,c.indexArrayForConflation.uint16[3*_+1]=0,c.indexArrayForConflation.uint16[3*_+2]=0;const f=a.bloomIndicesOffset+a.bloomIndicesLength;for(let _=a.bloomIndicesOffset;_<f;_++)c.entranceBloom.indexArrayForConflation.uint16[3*_+0]=0,c.entranceBloom.indexArrayForConflation.uint16[3*_+1]=0,c.entranceBloom.indexArrayForConflation.uint16[3*_+2]=0}}const o=a=>{a.indexArray.length!==0&&(a.indexBuffer?a.indexBuffer.updateData(a.indexArrayForConflation):a.indexBuffer=e.createIndexBuffer(a.indexArrayForConflation,!0),a.entranceBloom.indexBuffer?a.entranceBloom.indexBuffer.updateData(a.entranceBloom.indexArrayForConflation):a.entranceBloom.indexBuffer=e.createIndexBuffer(a.entranceBloom.indexArrayForConflation,!0))};o(this.buildingWithoutFacade),o(this.buildingWithFacade),this.indexArrayForConflationUploaded=!0}uploadUpdatedColorBuffer(e){const i=o=>{o.layoutColorBuffer?o.layoutColorBuffer.updateData(o.layoutColorArray):o.layoutColorBuffer=e.createVertexBuffer(o.layoutColorArray,Yv.members,!0),o.layoutFacadePaintArray&&(o.layoutFacadePaintBuffer?o.layoutFacadePaintBuffer.updateData(o.layoutFacadePaintArray):o.layoutFacadePaintBuffer=e.createVertexBuffer(o.layoutFacadePaintArray,pw.members,!0)),o.entranceBloom.layoutColorBuffer?o.entranceBloom.layoutColorBuffer.updateData(o.entranceBloom.layoutColorArray):o.entranceBloom.layoutColorBuffer=e.createVertexBuffer(o.entranceBloom.layoutColorArray,Yv.members,!0)};i(this.buildingWithoutFacade),i(this.buildingWithFacade),this.colorBufferUploaded=!0}evaluate(e,i){const o=e.paint.get("building-ambient-occlusion-intensity");for(const a of this.footprints){if(4&a.hiddenFlags)continue;const c=i[a.promoteId],h=a.feature;h.properties["building-part"]="roof";const f=e.paint.get("building-color").evaluate(h,c,this.canonical).toPremultipliedRenderColor(this.lut),_=e.paint.get("building-emissive-strength").evaluate(h,c,this.canonical);h.properties["building-part"]="wall";const y=e.paint.get("building-color").evaluate(h,c,this.canonical).toPremultipliedRenderColor(this.lut),v=e.paint.get("building-emissive-strength").evaluate(h,c,this.canonical);h.properties["building-part"]="window";const b=e.paint.get("building-color").evaluate(h,c,this.canonical).toPremultipliedRenderColor(this.lut),T=e.paint.get("building-emissive-strength").evaluate(h,c,this.canonical);h.properties["building-part"]="door";const S=e.paint.get("building-color").evaluate(h,c,this.canonical).toPremultipliedRenderColor(this.lut),C=e.paint.get("building-emissive-strength").evaluate(h,c,this.canonical),P=a.hasFauxFacade?this.buildingWithFacade:this.buildingWithoutFacade;for(const L of a.parts){let V,B=f;L.part===1?(B=f,V=_):L.part===0?(B=y,V=v):L.part===2?(B=b,V=T):L.part===3&&(B=S,V=C),V=te(V,0,1);for(let G=0;G<L.vertexLength;G++){const H=L.vertexOffset+G,Z=1+(P.layoutAOArray.uint8[H]/255-1)*o;P.layoutColorArray.emplace(H,B.r*Z*255<<8|B.g*Z*255,B.b*Z*255<<8|255*V),a.hasFauxFacade&&P.layoutFacadePaintArray.emplace(H,255*b.r<<8|255*b.g,255*b.b<<8|255*T)}}const R=a.buildingBloom;if(R)for(let L=0;L<R.vertexLength;L++)P.entranceBloom.layoutColorArray.emplace(R.vertexOffset+L,255*S.r<<8|255*S.g,255*S.b<<8|51*C)}}needsEvaluation(){return!this.colorBufferUploaded}updateReplacement(e,i,o){if(i.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=i.updateTime;const a=i.getReplacementRegionsForTile(e.toUnwrapped());if(D_(this.activeReplacements,a))return;this.activeReplacements=a;for(const h of this.footprints)h.hiddenFlags&=-2;const c=[];for(const h of this.activeReplacements){if(h.order<o)continue;const f=Math.max(1,Math.pow(2,h.footprintTileId.canonical.z-e.canonical.z));for(const _ of this.footprints)_.min.x>h.max.x||_.max.x<h.min.x||_.min.y>h.max.y||_.max.y<h.min.y||(c.length=0,Vw(this.footprintsVertices,_.footprintVertexOffset,_.footprintVertexLength,h.footprintTileId.canonical,e.canonical,c),Fy(h.footprint,c,this.footprintsIndices.uint16,_.footprintIndexOffset,_.footprintIndexLength,0,-f)&&(_.hiddenFlags|=1))}this.groundEffect.hiddenByLandmarkVertexArray.length===0&&this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length);for(const h of this.footprints)this.groundEffect.updateHiddenByLandmarkRange(h.groundEffectVertexOffset,h.groundEffectVertexLength,h.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 o=Number.NEGATIVE_INFINITY,a=!0;const c=4*(e+Ke)*Ke+(i+Ke);if(Object.hasOwn(this.footprintLookup,c)){const f=this.footprintLookup[c];return f?{height:f.height,hidden:f.hiddenFlags!==0}:void 0}const h=new Ne(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<=o||Nw(h,this.footprintsVertices.float32.subarray(2*f.footprintVertexOffset,2*(f.footprintVertexOffset+f.footprintVertexLength)),this.footprintsIndices.uint16.subarray(f.footprintIndexOffset,f.footprintIndexOffset+f.footprintIndexLength))&&(o=f.height,this.footprintLookup[c]=f,a=f.hiddenFlags!==0);if(o!==Number.NEGATIVE_INFINITY)return{height:o,hidden:a};this.footprintLookup[c]=void 0}}function Nw(r,e,i){for(let o=0;o<i.length;o+=3){const a=i[o],c=i[o+1],h=i[o+2],f=e[2*a+0],_=e[2*a+1],y=e[2*c+0],v=e[2*c+1],b=e[2*h+0],T=e[2*h+1],S=(f-b)*(r.y-T)-(_-T)*(r.x-b),C=(y-f)*(r.y-_)-(v-_)*(r.x-f);if(S<0!=C<0&&S!==0&&C!==0)continue;const P=(b-y)*(r.y-v)-(T-v)*(r.x-y);if(P===0||P<0==S+C<=0)return!0}return!1}function Vw(r,e,i,o,a,c){const h=Math.pow(2,o.z-a.z);for(let f=0;f<i;f++){let _=r.float32[2*(f+e)+0],y=r.float32[2*(f+e)+1];_=(_+a.x*Ke)*h-o.x*Ke,y=(y+a.y*Ke)*h-o.y*Ke,c.push(new Ne(_,y))}}Je(h0,"BuildingBucket",{omit:["layers"]}),Je(hx,"BuildingGeometry"),Je(ux,"BuildingBloomGeometry");class d0{constructor(e=0,i=[]){this.frcMask=e,this.rings=i}hasGeometry(){return this.rings.length>0&&this.rings[0].length>0}}async function cg(){}function Kh(r,e,i){const o=e.paint.get(r).value;return o.kind==="constant"?o.value:i.programConfigurations.get(e.id).getMaxValue(r)}function ug(r){return Math.sqrt(r[0]*r[0]+r[1]*r[1])}function f0(r,e,i,o,a){if(!e[0]&&!e[1])return r;const c=Ne.convert(e)._mult(a);i==="viewport"&&c._rotate(-o);const h=[];for(let f=0;f<r.length;f++)h.push(r[f].sub(c));return h}function p0(r,e,i,o){const a=Ne.convert(r)._mult(o);return e==="viewport"&&a._rotate(-i),a}Je(d0,"FrcCoveragePolygon");const Uw=rl(),m0=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 _0(r,e,i,o,a,c,h,f,_){if(c&&r.queryGeometry.isAboveHorizon)return!1;c&&(_*=r.pixelToTileUnitsFactor);const y=r.tileID.canonical,v=i.projection.upVectorScale(y,i.center.lat,i.worldSize).metersToTile;for(const b of e)for(const T of b){const S=T.add(f),C=a&&i.elevation?i.elevation.exaggeration()*a.getElevationAt(S.x,S.y,!0):0,P=i.projection.projectTilePoint(S.x,S.y,y);if(C>0){const B=i.projection.upVector(y,S.x,S.y);P.x+=B[0]*v*C,P.y+=B[1]*v*C,P.z+=B[2]*v*C}const R=c?S:jw(P.x,P.y,P.z,o),L=c?r.tilespaceRays.map(B=>qw(B,C)):r.queryGeometry.screenGeometry,V=kn([],[P.x,P.y,P.z,1],o);if(!h&&c?_*=V[3]/i.cameraToCenterDistance:h&&!c&&(_*=i.cameraToCenterDistance/V[3]),c){const B=Er((T.y/Ke+y.y)/(1<<y.z));_/=i.projection.pixelsPerMeter(B,1)/un(1,B)}if(ny(L,R,_))return!0}return!1}function jw(r,e,i,o){const a=kn([],[r,e,i,1],o);
7return new Ne(a[0]/a[3],a[1]/a[3])}const g0=Cr(0,0,0),Gw=Cr(0,0,1);function qw(r,e){const i=ti();return g0[2]=e,r.intersectsPlane(g0,Gw,i),new Ne(i[0],i[1])}class y0 extends nu{}let x0,v0,b0,w0,T0,E0,S0,I0,A0,C0,M0,P0,R0,D0;function Ep(r){const e={},i=r.resolution||256,o=r.clips?r.clips.length:1,a=r.image||new Or({width:i,height:o}),c=r.lut||null,h=(f,_,y)=>{e[r.evaluationKey]=y;const v=r.expression.evaluate(e),b=v?v.toNonPremultipliedRenderColor(c):null;b&&(a.data[f+_+0]=Math.floor(255*b.r),a.data[f+_+1]=Math.floor(255*b.g),a.data[f+_+2]=Math.floor(255*b.b),a.data[f+_+3]=Math.floor(255*b.a))};if(r.clips)for(let f=0,_=0;f<o;++f,_+=4*i)for(let y=0,v=0;y<i;y++,v+=4){const b=y/(i-1),{start:T,end:S}=r.clips[f];h(_,v,yt(T,S,b))}else for(let f=0,_=0;f<i;f++,_+=4)h(0,_,f/(i-1));return a}Je(y0,"HeatmapBucket",{omit:["layers"]});class z0{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 o of this.footprints)i.push({footprint:o,id:e})}updateAppearances(e,i,o,a){return{hasLayoutChanges:!1,hasUboChanges:!1}}populate(e,i,o,a){const c=[];for(const{feature:h,id:f,index:_,sourceLayerIndex:y}of e){const v=this.layers[0]._featureFilter.needGeometry,b=uo(h,v);if(!this.layers[0]._featureFilter.filter(new oi(this.zoom,{worldview:this.worldview,activeFloors:i.activeFloors}),b,o))continue;const T={id:f,properties:h.properties,type:h.type,sourceLayerIndex:y,index:_,geometry:v?b.geometry:xn(h,o,a),patterns:{}};c.push(T)}for(const h of c){const{geometry:f,index:_,sourceLayerIndex:y}=h;this.addFeature(h,f,_,o,{},i.availableImages,i.brightness),i.featureIndex.insert(e[_].feature,f,_,y,this.index)}}isEmpty(){return this.footprints.length===0}uploadPending(){return!1}upload(e){}update(e,i,o,a,c,h,f){}destroy(){}addFeature(e,i,o,a,c,h=[],f){for(const _ of as(i,2)){const y=[],v=[],b=[],T=new Ne(1/0,1/0),S=new Ne(-1/0,-1/0);for(const R of _)if(R.length!==0){R!==_[0]&&b.push(v.length/2);for(let L=0;L<R.length;L++)v.push(R[L].x),v.push(R[L].y),y.push(R[L]),T.x=Math.min(T.x,R[L].x),T.y=Math.min(T.y,R[L].y),S.x=Math.max(S.x,R[L].x),S.y=Math.max(S.y,R[L].y)}const C=Gl(v,b),P=new Z_(y,C,8,256);this.footprints.push({vertices:y,indices:C,grid:P,min:T,max:S})}}}function Sp(r,e){return r.x*e.x+r.y*e.y}function L0(r,e){if(r.length===1){let i=0;const o=e[i++];let a;for(;!a||o.equals(a);)if(a=e[i++],!a)return 1/0;for(;i<e.length;i++){const c=e[i],h=r[0],f=a.sub(o),_=c.sub(o),y=h.sub(o),v=Sp(f,f),b=Sp(f,_),T=Sp(_,_),S=Sp(y,f),C=Sp(y,_),P=v*T-b*b,R=(T*S-b*C)/P,L=(v*C-b*S)/P,V=o.z*(1-R-L)+a.z*R+c.z*L;if(isFinite(V))return V}return 1/0}{let i=1/0;for(const o of e)i=Math.min(i,o.z);return i}}function F0(r,e,i){let o=1/0;Jf(i,e)&&(o=L0(i,e[0]));for(let a=0;a<e.length;a++){const c=e[a],h=r[a];for(let f=0;f<c.length-1;f++){const _=c[f],y=[_,c[f+1],h[f+1],h[f],_];Kf(i,y)&&(o=Math.min(o,L0(i,y)))}}return o!==1/0&&o}function O0(r,e,i,o,a,c,h,f,_,y,v){return r.projection.name==="globe"?(function(b,T,S,C,P,R,L,V,B,G,H){const Z=[],oe=[],X=b.projection.upVectorScale(H,b.center.lat,b.worldSize).metersToTile,ee=[0,0,0,1],ie=[0,0,0,1],ne=(ge,we,Se,Ee)=>{ge[0]=we,ge[1]=Se,ge[2]=Ee,ge[3]=1},fe=o0();S>0&&(S+=fe),C+=fe;for(const ge of T){const we=[],Se=[];for(const Ee of ge){const Ve=Ee.x+P.x,Ie=Ee.y+P.y,Te=b.projection.projectTilePoint(Ve,Ie,H),Ce=b.projection.upVector(H,Ee.x,Ee.y);let ze=S,Fe=C;if(L){const Be=B0(Ve,Ie,S,C,L,V,B,G);ze+=Be.base,Fe+=Be.top}S!==0?ne(ee,Te.x+Ce[0]*X*ze,Te.y+Ce[1]*X*ze,Te.z+Ce[2]*X*ze):ne(ee,Te.x,Te.y,Te.z),ne(ie,Te.x+Ce[0]*X*Fe,Te.y+Ce[1]*X*Fe,Te.z+Ce[2]*X*Fe),Zi(ee,ee,R),Zi(ie,ie,R),we.push(new $a(ee[0],ee[1],ee[2])),Se.push(new $a(ie[0],ie[1],ie[2]))}Z.push(we),oe.push(Se)}return[Z,oe]})(r,e,i,o,a,c,h,f,_,y,v):h?(function(b,T,S,C,P,R,L,V,B){const G=[],H=[],Z=[0,0,0,1];for(const oe of b){const X=[],ee=[];for(const ie of oe){const ne=ie.x+C.x,fe=ie.y+C.y,ge=B0(ne,fe,T,S,R,L,V,B);Z[0]=ne,Z[1]=fe,Z[2]=ge.base,Z[3]=1,kn(Z,Z,P),Z[3]=Math.max(Z[3],1e-5);const we=new $a(Z[0]/Z[3],Z[1]/Z[3],Z[2]/Z[3]);Z[0]=ne,Z[1]=fe,Z[2]=ge.top,Z[3]=1,kn(Z,Z,P),Z[3]=Math.max(Z[3],1e-5);const Se=new $a(Z[0]/Z[3],Z[1]/Z[3],Z[2]/Z[3]);X.push(we),ee.push(Se)}G.push(X),H.push(ee)}return[G,H]})(e,i,o,a,c,h,f,_,y):(function(b,T,S,C,P){const R=[],L=[],V=P[8]*T,B=P[9]*T,G=P[10]*T,H=P[11]*T,Z=P[8]*S,oe=P[9]*S,X=P[10]*S,ee=P[11]*S;for(const ie of b){const ne=[],fe=[];for(const ge of ie){const we=ge.x+C.x,Se=ge.y+C.y,Ee=P[0]*we+P[4]*Se+P[12],Ve=P[1]*we+P[5]*Se+P[13],Ie=P[2]*we+P[6]*Se+P[14],Te=P[3]*we+P[7]*Se+P[15],Ce=Ee+V,ze=Ve+B,Fe=Ie+G,Be=M
vendor: 29,478 bytes, line 7
7ath.max(Te+H,1e-5),De=Ee+Z,Ge=Ve+oe,Ze=Ie+X,Qe=Math.max(Te+ee,1e-5);ne.push(new $a(Ce/Be,ze/Be,Fe/Be)),fe.push(new $a(De/Qe,Ge/Qe,Ze/Qe))}R.push(ne),L.push(fe)}return[R,L]})(e,i,o,a,c)}function B0(r,e,i,o,a,c,h,f){const _=h*a.getElevationAt(r,e,!0,!0),y=c[0]!==0,v=y?c[1]===0?h*(c[0]/7-450):h*(function(b,T,S){const C=Math.floor(T[0]/8),P=Math.floor(T[1]/8),R=10*(T[0]-8*C),L=10*(T[1]-8*P),V=b.getElevationAt(C,P,!0,!0),B=b.getMeterToDEM(S),G=Math.floor(.5*(R*B-1)),H=Math.floor(.5*(L*B-1)),Z=b.tileCoordToPixel(C,P),oe=2*G+1,X=2*H+1,ee=(function(Se,Ee,Ve,Ie,Te){return[Se.getElevationAtPixel(Ee,Ve,!0),Se.getElevationAtPixel(Ee+Te,Ve,!0),Se.getElevationAtPixel(Ee,Ve+Te,!0),Se.getElevationAtPixel(Ee+Ie,Ve+Te,!0)]})(b,Z.x-G,Z.y-H,oe,X),ie=Math.abs(ee[0]-ee[1]),ne=Math.abs(ee[2]-ee[3]),fe=Math.abs(ee[0]-ee[2])+Math.abs(ee[1]-ee[3]),ge=Math.min(.25,.5*B*(ie+ne)/oe),we=Math.min(.25,.5*B*fe/X);return V+Math.max(ge*R,we*L)})(a,c,f):_;return{base:_+(i===0?-1:i),top:y?Math.max(v+o,_+i+2):_+o}}function k0(r,e,i){return e*(Ke/(r.tileSize*Math.pow(2,i-r.tileID.overscaledZ)))}function N0(r,e){return 1/k0(r,1,e.tileZoom)}function V0(r,e,i,o){return r.translatePosMatrix(o||e.tileID.projMatrix,e,i.paint.get("line-translate"),i.paint.get("line-translate-anchor"))}Je(z0,"ClipBucket",{omit:["layers"]});const U0=r=>{const e=[];j0(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 o=r.layout.get("line-join").constantOr("miter")==="none",a=!!r.paint.get("line-pattern").constantOr(1);return o&&a&&e.push("LINE_JOIN_NONE"),e};function j0(r){const e=r.paint.get("line-dasharray").value;return e.kind!=="constant"||e.value}let dx;const G0=()=>dx||(dx={layout:R0||(R0=new Li({"line-cap":new $e(pe.layout_line["line-cap"]),"line-join":new $e(pe.layout_line["line-join"]),"line-miter-limit":new He(pe.layout_line["line-miter-limit"]),"line-round-limit":new He(pe.layout_line["line-round-limit"]),"line-sort-key":new $e(pe.layout_line["line-sort-key"]),"line-z-offset":new $e(pe.layout_line["line-z-offset"]),"line-elevation-reference":new He(pe.layout_line["line-elevation-reference"]),"line-cross-slope":new He(pe.layout_line["line-cross-slope"]),visibility:new He(pe.layout_line.visibility),"line-width-unit":new He(pe.layout_line["line-width-unit"]),"line-elevation-ground-scale":new $e(pe.layout_line["line-elevation-ground-scale"])})),paint:D0||(D0=new Li({"line-opacity":new $e(pe.paint_line["line-opacity"]),"line-color":new $e(pe.paint_line["line-color"]),"line-translate":new He(pe.paint_line["line-translate"]),"line-translate-anchor":new He(pe.paint_line["line-translate-anchor"]),"line-width":new $e(pe.paint_line["line-width"]),"line-gap-width":new $e(pe.paint_line["line-gap-width"]),"line-offset":new $e(pe.paint_line["line-offset"]),"line-blur":new $e(pe.paint_line["line-blur"]),"line-dasharray":new $e(pe.paint_line["line-dasharray"]),"line-pattern":new $e(pe.paint_line["line-pattern"]),"line-pattern-cross-fade":new He(pe.paint_line["line-pattern-cross-fade"]),"line-gradient":new ws(pe.paint_line["line-gradient"]),"line-trim-offset":new He(pe.paint_line["line-trim-offset"]),"line-trim-fade-range":new He(pe.paint_line["line-trim-fade-range"]),"line-trim-color":new He(pe.paint_line["line-trim-color"]),"line-emissive-strength":new $e(pe.paint_line["line-emissive-strength"]),"line-border-width":new $e(pe.paint_line["line-border-width"]),"line-border-color":new $e(pe.paint_line["line-border-color"]),"line-occlusion-opacity":new He(pe.paint_line["line-occlusion-opacity"]),"line-blend-mode":new He(pe.paint_line["line-blend-mode"]),"line-blend-additive-clamp":new He(pe.paint_line["line-blend-additive-clamp"]),"line-color-use-theme":new $e({type:"string",default:"default","property-type":"data-driven"}),"line-gradient-use-theme":new $e({type:"string",default:"default","property-type":"data-driven"}),"line-trim-color-use-theme":new $e({type:"string",default:"default","property-type":"data-driven"}),"line-border-color-use-theme":new $e({type:"string",default:"default","property-type":"data-driven"})}))},dx);class Hw extends $e{possiblyEvaluate(e,i){return i=new oi(Math.floor(i.zoom),{now:i.now,fadeDuration:i.fadeDuration,transition:i.transition,worldview:i.worldview}),super.possiblyEvaluate(e,i)}evaluate(e,i,o,a){return i={...i,zoom:Math.floor(i.zoom)},super.evaluate(e,i,o,a)}}let Ip,q0,H0,fx;function $0(r,e){return e>0?e+2*r:r}function Z0(r,e){return e.replace(/{([^{}]+)}/g,(i,o)=>o in r?String(r[o]):"")}class W0{constructor(e){this.type=e.property.overrides?e.property.overrides.runtimeType:js,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}}Je(W0,"FormatSectionOverride",{omit:["defaultValue"]});const px=()=>fx||(fx={layout:q0||(q0=new Li({"symbol-placement":new He(pe.layout_symbol["symbol-placement"]),"symbol-spacing":new He(pe.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new He(pe.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new $e(pe.layout_symbol["symbol-sort-key"]),"symbol-z-order":new He(pe.layout_symbol["symbol-z-order"]),"symbol-z-elevate":new He(pe.layout_symbol["symbol-z-elevate"]),"symbol-elevation-reference":new He(pe.layout_symbol["symbol-elevation-reference"]),"icon-allow-overlap":new He(pe.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new He(pe.layout_symbol["icon-ignore-placement"]),"icon-optional":new He(pe.layout_symbol["icon-optional"]),"icon-rotation-alignment":new He(pe.layout_symbol["icon-rotation-alignment"]),"icon-size":new $e(pe.layout_symbol["icon-size"]),"icon-size-scale-range":new He(pe.layout_symbol["icon-size-scale-range"]),"icon-text-fit":new $e(pe.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new $e(pe.layout_symbol["icon-text-fit-padding"]),"icon-image":new $e(pe.layout_symbol["icon-image"]),"icon-image-use-theme":new He({type:"string",default:"default","property-type":"data-constant"}),"icon-rotate":new $e(pe.layout_symbol["icon-rotate"]),"icon-padding":new He(pe.layout_symbol["icon-padding"]),"icon-keep-upright":new He(pe.layout_symbol["icon-keep-upright"]),"icon-offset":new $e(pe.layout_symbol["icon-offset"]),"icon-anchor":new $e(pe.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new He(pe.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new He(pe.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new He(pe.layout_symbol["text-rotation-alignment"]),"text-field":new $e(pe.layout_symbol["text-field"]),"text-font":new $e(pe.layout_symbol["text-font"]),"text-size":new $e(pe.layout_symbol["text-size"]),"text-size-scale-range":new He(pe.layout_symbol["text-size-scale-range"]),"text-max-width":new $e(pe.layout_symbol["text-max-width"]),"text-line-height":new $e(pe.layout_symbol["text-line-height"]),"text-letter-spacing":new $e(pe.layout_symbol["text-letter-spacing"]),"text-justify":new $e(pe.layout_symbol["text-justify"]),"text-radial-offset":new $e(pe.layout_symbol["text-radial-offset"]),"text-variable-anchor":new He(pe.layout_symbol["text-variable-anchor"]),"text-anchor":new $e(pe.layout_symbol["text-anchor"]),"text-max-angle":new He(pe.layout_symbol["text-max-angle"]),"text-writing-mode":new He(pe.layout_symbol["text-writing-mode"]),"text-rotate":new $e(pe.layout_symbol["text-rotate"]),"text-padding":new He(pe.layout_symbol["text-padding"]),"text-keep-upright":new He(pe.layout_symbol["text-keep-upright"]),"text-transform":new $e(pe.layout_symbol["text-transform"]),"text-offset":new $e(pe.layout_symbol["text-offset"]),"text-allow-overlap":new He(pe.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new He(pe.layout_symbol["text-ignore-placement"]),"text-optional":new He(pe.layout_symbol["text-optional"]),visibility:new He(pe.layout_symbol.visibility)})),paint:H0||(H0=new Li({"icon-opacity":new $e(pe.paint_symbol["icon-opacity"]),"icon-occlusion-opacity":new $e(pe.paint_symbol["icon-occlusion-opacity"]),"icon-emissive-strength":new $e(pe.paint_symbol["icon-emissive-strength"]),"text-emissive-strength":new $e(pe.paint_symbol["text-emissive-strength"]),"icon-color":new $e(pe.paint_symbol["icon-color"]),"icon-halo-color":new $e(pe.paint_symbol["icon-halo-color"]),"icon-halo-width":new $e(pe.paint_symbol["icon-halo-width"]),"icon-halo-blur":new $e(pe.paint_symbol["icon-halo-blur"]),"icon-translate":new He(pe.paint_symbol["icon-translate"]),"icon-translate-anchor":new He(pe.paint_symbol["icon-translate-anchor"]),"icon-image-cross-fade":new He(pe.paint_symbol["icon-image-cross-fade"]),"text-opacity":new $e(pe.paint_symbol["text-opacity"]),"text-occlusion-opacity":new $e(pe.paint_symbol["text-occlusion-opacity"]),"text-color":new $e(pe.paint_symbol["text-color"],{runtimeType:_n,getOverride:r=>r.textColor,hasOverride:r=>!!r.textColor}),"text-halo-color":new $e(pe.paint_symbol["text-halo-color"]),"text-halo-width":new $e(pe.paint_symbol["text-halo-width"]),"text-halo-blur":new $e(pe.paint_symbol["text-halo-blur"]),"text-translate":new He(pe.paint_symbol["text-translate"]),"text-translate-anchor":new He(pe.paint_symbol["text-translate-anchor"]),"icon-color-saturation":new He(pe.paint_symbol["icon-color-saturation"]),"icon-color-contrast":new He(pe.paint_symbol["icon-color-contrast"]),"icon-color-brightness-min":new He(pe.paint_symbol["icon-color-brightness-min"]),"icon-color-brightness-max":new He(pe.paint_symbol["icon-color-brightness-max"]),"symbol-z-offset":new $e(pe.paint_symbol["symbol-z-offset"]),"icon-color-use-theme":new $e({type:"string",default:"default","property-type":"data-driven"}),"icon-halo-color-use-theme":new $e({type:"string",default:"default","property-type":"data-driven"}),"text-color-use-theme":new $e({type:"string",default:"default","property-type":"data-driven"}),"text-halo-color-use-theme":new $e({type:"string",default:"default","property-type":"data-driven"})}))},fx);class hg extends an{constructor(e,i,o,a){super(e,px(),i,o,a,e.layout?e.layout["icon-image-use-theme"]:null),this._colorAdjustmentMatrix=ki([]),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(a=>{a.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 o=this.layout.get("text-writing-mode");if(o){const a=[];for(const c of o)a.includes(c)||a.push(c);this.layout._values["text-writing-mode"]=a}else this.layout._values["text-writing-mode"]=this.layout.get("symbol-placement")==="point"?["horizontal"]:["horizontal","vertical"];this._setPaintOverrides()}getColorAdjustmentMatrix(e,i,o,a){return this._saturation===e&&this._contrast===i&&this._brightnessMin===o&&this._brightnessMax===a||(this._colorAdjustmentMatrix=(function(c,h,f,_){c=Tr(c),h=qi(h);const y=rl(),v=c/3,b=1-2*v,T=[b,v,v,0,v,b,v,0,v,v,b,0,0,0,0,1],S=.5-.5*h,C=_-f;return Ri(y,[C,0,0,0,0,C,0,0,0,0,C,0,f,f,f,1],[h,0,0,0,0,h,0,0,0,0,h,0,S,S,S,1]),Ri(y,y,T),y})(e,i,o,a),this._saturation=e,this._contrast=i,this._brightnessMin=o,this._brightnessMax=a),this._colorAdjustmentMatrix}getValueAndResolveTokens(e,i,o,a){const c=this.layout.get(e).evaluate(i,{},o,a),h=this._unevaluatedLayout._values[e];return h.isDataDriven()||ih(h.value)||!c?c:Z0(i.properties,c)}getAppearanceValueAndResolveTokens(e,i,o,a,c){const h=e.getLayoutProperty(i);if(!h)return;const f=h.evaluate(o,{},a,c),_=e.getUnevaluatedLayoutProperties()._values[i];return _.isDataDriven()||ih(_.value)||!f||typeof f!="string"?f:Z0(o.properties,f)}createBucket(e){return new z_(e)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(const e of px().paint.overridableProperties){if(!hg.hasPaintOverride(this.layout,e))continue;const i=this.paint.get(e),o=new W0(i),a=new th(o,i.property.specification,this.scope,this.options,this.layout.get("icon-image-use-theme"));let c=null;c=i.value.kind==="constant"||i.value.kind==="source"?new rh("source",a):new Pc("composite",a,i.value.zoomStops,i.value.interpolationType),this.paint._values[e]=new bs(i.property,c,i.parameters)}}_handleOverridablePaintPropertyUpdate(e,i,o){return!(!this.layout||i.isDataDriven()||o.isDataDriven())&&hg.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,i){const o=e.get("text-field"),a=px().paint.properties[i];let c=!1;const h=f=>{for(const _ of f)if(a.overrides&&a.overrides.hasOverride(_))return void(c=!0)};if(o.value.kind==="constant"&&o.value.value instanceof Zr)h(o.value.value.sections);else if(o.value.kind==="source"){const f=y=>{c||(y instanceof Ao&&lt(y.value)===gn?h(y.value.sections):y instanceof Il?h(y.sections):y.eachChild(f))},_=o.value;_._styleExpression&&f(_._styleExpression.expression)}return c}getProgramIds(){return["symbol"]}getDefaultProgramParams(e,i,o){return{config:new qa(this,{zoom:i,lut:o}),overrideFog:!1}}hasElevation(){return this.layout&&this.layout.get("symbol-elevation-reference")==="hd-road-markup"}mayUse(e){return e==="HD"&&_h(this,"symbol-elevation-reference",i=>i==="hd-road-markup")}prepare(){return this.mayUse("HD")?cg():Promise.resolve()}}let X0,Y0,K0,J0;const mx=1024,$w=(Math.pow(mx,2)-1)/268170240;class Q0 extends an{constructor(e,i,o,a){super(e,{layout:K0||(K0=new Li({visibility:new He(pe.layout_raster.visibility)})),paint:J0||(J0=new Li({"raster-opacity":new He(pe.paint_raster["raster-opacity"]),"raster-color":new ws(pe.paint_raster["raster-color"]),"raster-color-mix":new He(pe.paint_raster["raster-color-mix"]),"raster-color-range":new He(pe.paint_raster["raster-color-range"]),"raster-hue-rotate":new He(pe.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new He(pe.paint_raster["raster-brightness-min"]),"raster-brightness-max":new He(pe.paint_raster["raster-brightness-max"]),"raster-saturation":new He(pe.paint_raster["raster-saturation"]),"raster-contrast":new He(pe.paint_raster["raster-contrast"]),"raster-resampling":new He(pe.paint_raster["raster-resampling"]),"raster-fade-duration":new He(pe.paint_raster["raster-fade-duration"]),"raster-emissive-strength":new He(pe.paint_raster["raster-emissive-strength"]),"raster-array-band":new He(pe.paint_raster["raster-array-band"]),"raster-elevation":new He(pe.paint_raster["raster-elevation"]),"raster-elevation-reference":new He(pe.paint_raster["raster-elevation-reference"]),"raster-color-use-theme":new $e({type:"string",default:"default","property-type":"data-driven"})}))},i,o,a),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){const i=e?e._source:null;return(!i||i.type!=="image"&&i.type!=="video"&&i.type!=="canvas"||!i.onNorthPole&&!i.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,[o,a]=e||this._transitionablePaint._values["raster-color-range"].value.expression.evaluate({zoom:0})||[NaN,NaN];isNaN(o)&&isNaN(a)||o===this._curRampRange[0]&&a===this._curRampRange[1]||(this.colorRamp=Ep({expression:i,evaluationKey:"rasterValue",image:this.colorRamp,clips:[{start:o,end:a}],resolution:mx}),this.colorRampTexture=null,this._curRampRange=[o,a])}is3D(e){return this.paint.get("raster-elevation")>0}}let e1,t1,i1,r1,n1,o1,s1;class a1 extends an{constructor(e,i,o,a){super(e,{layout:e1||(e1=new Li({visibility:new He(pe["layout_raster-particle"].visibility)})),paint:t1||(t1=new Li({"raster-particle-array-band":new He(pe["paint_raster-particle"]["raster-particle-array-band"]),"raster-particle-count":new He(pe["paint_raster-particle"]["raster-particle-count"]),"raster-particle-color":new ws(pe["paint_raster-particle"]["raster-particle-color"]),"raster-particle-max-speed":new He(pe["paint_raster-particle"]["raster-particle-max-speed"]),"raster-particle-speed-factor":new He(pe["paint_raster-particle"]["raster-particle-speed-factor"]),"raster-particle-fade-opacity-factor":new He(pe["paint_raster-particle"]["raster-particle-fade-opacity-factor"]),"raster-particle-reset-rate-factor":new He(pe["paint_raster-particle"]["raster-particle-reset-rate-factor"]),"raster-particle-elevation":new He(pe["paint_raster-particle"]["raster-particle-elevation"]),"raster-particle-color-use-theme":new $e({type:"string",default:"default","property-type":"data-driven"})}))},i,o,a),this._updateColorRamp(),this.lastInvalidatedAt=Ki.now()}mayUse(e){return e==="HD"}_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=Ep({expression:e,evaluationKey:"rasterParticleSpeed",image:this.colorRamp,clips:[{start:0,end:i}],resolution:256}),this.colorRampTexture=null}_invalidateAnimationState(){this.lastInvalidatedAt=Ki.now()}tileCoverLift(){return this.paint.get("raster-particle-elevation")}}class Zw extends an{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 _x(r,e,i){const o=[0,0,1],a=ga([]);return Ns(a,a,i?-jt(r)+Math.PI:jt(r)),lc(a,a,-jt(e)),Bs(o,o,a),bi(o,o)}class l1{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 c1{constructor(){this.maxScale=1,this.maxXYTranslationDistance=0,this.instancedDataArray=new Xl,this.instancesEvaluatedElevation=[],this.features=[],this.idToFeaturesIndex={}}colorForInstance(e){const i=16*e,o=this.instancedDataArray.float32;let a=Math.floor(o[i+2]);const c=1.05*(o[i+2]-a);return a/=100,[o[i]%1*1.05,o[i+1]%1*1.05,c,a]}tileCoordinatesForInstance(e){const i=16*e,o=this.instancedDataArray.float32;let a=o[i+0];return a=a>Ke?a-Ke:a,new Ne(Math.trunc(a),Math.trunc(o[i+1]))}translationForInstance(e){const i=16*e,o=this.instancedDataArray.float32;return[o[i+4],o[i+5],o[i+6]]}rotationScaleForInstance(e){const i=16*e,o=this.instancedDataArray.float32;return[o[i+7],o[i+8],o[i+9],o[i+10],o[i+11],o[i+12],o[i+13],o[i+14],o[i+15]]}transformForInstance(e){const i=16*e,o=this.instancedDataArray.float32;return[o[i+7],o[i+8],o[i+9],o[i+4],o[i+10],o[i+11],o[i+12],o[i+5],o[i+13],o[i+14],o[i+15],o[i+6],0,0,0,1]}}class gx{constructor(e){this.requiresStandardRuntime=!0,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,o,a){return{hasLayoutChanges:!1,hasUboChanges:!1}}populate(e,i,o,a){this.tileToMeter=zn(o);const c=this.layers[0]._featureFilter.needGeometry;this.lookup=new Uint8Array(this.lookupDim*this.lookupDim);const h=this.layers[0].paint.get("model-elevation-reference")==="hd-road-markup"?i.elevationFeatures:void 0;for(const{feature:f,id:_,index:y,sourceLayerIndex:v}of e){const b=_??(f.properties&&Object.hasOwn(f.properties,"id")?f.properties.id:void 0),T=uo(f,c);if(!this.layers[0]._featureFilter.filter(new oi(this.zoom,{worldview:this.worldview,activeFloors:i.activeFloors}),T,o))continue;const S={id:b,sourceLayerIndex:v,index:y,geometry:c?T.geometry:xn(f,o,a),properties:f.properties,type:f.type,patterns:{}},C=this.addFeature(S,S.geometry,T,h,o);C&&i.featureIndex.insert(f,S.geometry,y,v,this.index,this.instancesPerModel[C].instancedDataArray.length,256)}this.lookup=null}evaluateQueryRenderedFeaturePadding(){const e=this.layers[0].modelManager,i=this.layers[0].scope;let o=0;for(const a of this.modelUris){const c=e.getModel(a,i);if(!c)continue;const h=this.instancesPerModel[a];if(h){const f=.5*to(c.aabb.max,c.aabb.min)*h.maxScale+h.maxXYTranslationDistance,_=Math.min(Ke,Math.max(f/this.tileToMeter,256));o=Math.max(_,o)}}return o}update(e,i,o,a){for(const c in this.instancesPerModel){const h=this.instancesPerModel[c];for(const f in e)Object.hasOwn(h.idToFeaturesIndex,f)&&(this.evaluate(h.features[h.idToFeaturesIndex[f]],e[f],h,!0),this.uploaded=!1)}this.maxHeight=0}updateZoomBasedPaintProperties(){if(!this.hasZoomDependentProperties)return!1;let e=!1;for(const i in this.instancesPerModel){const o=this.instancesPerModel[i];for(const a of o.features){const c=this.layers[0],h=a.feature,f=this.canonical,_=c.paint.get("model-rotation").evaluate(h,{},f),y=c.paint.get("model-scale").evaluate(h,{},f),v=c.paint.get("model-translation").evaluate(h,{},f);is(a.rotation,_)&&is(a.scale,y)&&is(a.translation,v)||(this.evaluate(a,a.featureStates,o,!0),e=!0)}}return e}updateReplacement(e,i,o,a){if(i.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=i.updateTime;const c=i.getReplacementRegionsForTile(e.toUnwrapped(),!0);if(D_(this.activeReplacements,c))return!1;this.activeReplacements=c;let h=!1;for(const f in this.instancesPerModel){const _=this.instancesPerModel[f],y=_.instancedDataArray;for(const v of _.features){const b=v.instancedDataOffset,T=v.instancedDataCount;for(let S=0;S<T;S++){const C=16*(S+b);let P=y.float32[C+0];const R=P>Ke;P=R?P-Ke:P;const L=Math.floor(P),V=Math.floor(y.float32[C+1]);let B=!1;for(const G of this.activeReplacements)if(!Qx(G,o,eg.Model,a)&&!(G.min.x>L||L>G.max.x||G.min.y>V||V>G.max.y)&&(B=nv(rv(L,V,e.canonical,G.footprintTileId.canonical),G.footprint),B))break;y.float32[C]=B?P+Ke:P,h=h||B!==R}}}return h}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 o=this.instancesPerModel[i];o.instancedDataArray.length<0||o.instancedDataArray.length===0||(o.instancedDataBuffer?o.instancedDataBuffer.updateData(o.instancedDataArray):o.instancedDataBuffer=e.createVertexBuffer(o.instancedDataArray,tw.members,!0,void 0,this.instanceCount))}this.uploaded=!0}destroy(e){for(const o in this.instancesPerModel){const a=this.instancesPerModel[o];a.instancedDataArray.length!==0&&a.instancedDataBuffer&&a.instancedDataBuffer.destroy()}const i=this.layers[0].modelManager;if(e&&i&&this.modelUris&&this.modelsRequested)for(const o of this.modelUris)i.removeModel(o,"",!0)}addFeature(e,i,o,a,c){const h=this.layers[0],f=h.layout.get("model-id"),_=h.layout.get("model-allow-density-reduction"),y=f.evaluate(o,{},this.canonical);if(!y)return ht(`modelId is not evaluated for layer ${h.id} and it is not going to get rendered.`),y;!y.includes("://")&&!this.styleDefinedModelURLs[y]||this.modelUris.includes(y)||this.modelUris.push(y),this.instancesPerModel[y]||(this.instancesPerModel[y]=new c1);const v=this.instancesPerModel[y],b=v.instancedDataArray,T=new l1(o,b.length);let S;if(a){const C=B_(e,a,void 0,c);S=C?C.feature:void 0}for(const C of i)for(const P of C){if(P.x<0||P.x>=Ke||P.y<0||P.y>=Ke)continue;if(this.lookupDim!==0&&_){const L=(this.lookupDim-1)/Ke,V=this.lookupDim*(P.y*L|0)+P.x*L|0;if(this.lookup){if(this.lookup[V]!==0)continue;this.lookup[V]=1}}this.instanceCount++;const R=b.length;if(b.resize(R+1),a){v.instancesRoadElevation||(v.instancesRoadElevation=[]);const L=S?S.pointElevation(new Ne(P.x,P.y)):0;v.instancesRoadElevation.push(L)}v.instancesEvaluatedElevation.push(0),b.float32[16*R]=P.x,b.float32[16*R+1]=P.y}return T.instancedDataCount=v.instancedDataArray.length-T.instancedDataOffset,T.instancedDataCount>0&&(e.id&&(v.idToFeaturesIndex[e.id]=v.features.length),v.features.push(T),this.evaluate(T,{},v,!1)),y}getModelUris(){return this.modelUris}evaluate(e,i,o,a){const c=this.layers[0],h=e.feature,f=this.canonical,_=e.rotation=c.paint.get("model-rotation").evaluate(h,i,f),y=e.scale=c.paint.get("model-scale").evaluate(h,i,f),v=e.translation=c.paint.get("model-translation").evaluate(h,i,f),{r:b,g:T,b:S}=c.paint.get("model-color").evaluate(h,i,f),C=c.paint.get("model-color-mix-intensity").evaluate(h,i,f),P=[];this.maxVerticalOffset<v[2]&&(this.maxVerticalOffset=v[2]);const R=v[0]*v[0]+v[1]*v[1],L=R>0?Math.sqrt(R):0;o.maxScale=Math.max(Math.max(o.maxScale,y[0]),Math.max(y[1],y[2])),o.maxXYTranslationDistance=Math.max(o.maxXYTranslationDistance,L),this.maxScale=Math.max(Math.max(this.maxScale,y[0]),Math.max(y[1],y[2])),Uv(P,_,y);const V=Math.round(100*C)+S/1.05;for(let B=0;B<e.instancedDataCount;++B){const G=e.instancedDataOffset+B,H=16*G,Z=o.instancedDataArray.float32;let oe=0;a&&(oe=Z[H+6]-o.instancesEvaluatedElevation[G]);const X=0|Z[H+1];Z[H]=(0|Z[H])+b/1.05,Z[H+1]=X+T/1.05,Z[H+2]=V,Z[H+3]=1/(f.z>10?this.tileToMeter:zn(f,X)),Z[H+4]=v[0],Z[H+5]=v[1],Z[H+6]=v[2]+(o.instancesRoadElevation?o.instancesRoadElevation[G]:0)+oe,Z[H+7]=P[0],Z[H+8]=P[1],Z[H+9]=P[2],Z[H+10]=P[4],Z[H+11]=P[5],Z[H+12]=P[6],Z[H+13]=P[8],Z[H+14]=P[9],Z[H+15]=P[10],o.instancesEvaluatedElevation[G]=v[2]}}}Je(gx,"ModelBucket",{omit:["layers"]}),Je(c1,"PerModelAttributes"),Je(l1,"ModelFeature");class Jh{constructor(e,i,o){this._demTile=e,this._dem=this._demTile.dem,this._scale=i,this._offset=o}static create(e,i,o){const a=o||e.findDEMTileFor(i);if(!a||!a.dem)return;const c=a.dem,h=a.tileID,f=1<<i.canonical.z-h.canonical.z;return new Jh(a,c.dim/Ke/f,[(i.canonical.x/f-h.canonical.x)*c.dim,(i.canonical.y/f-h.canonical.y)*c.dim])}tileCoordToPixel(e,i){const o=i*this._scale+this._offset[1];return new Ne(Math.floor(e*this._scale+this._offset[0]),Math.floor(o))}getElevationAt(e,i,o,a){const c=e*this._scale+this._offset[0],h=i*this._scale+this._offset[1],f=Math.floor(c),_=Math.floor(h),y=this._dem;return a=!!a,o?yt(yt(y.get(f,_,a),y.get(f,_+1,a),h-_),yt(y.get(f+1,_,a),y.get(f+1,_+1,a),h-_),c-f):y.get(f,_,a)}getElevationAtPixel(e,i,o){return this._dem.get(e,i,!!o)}getMeterToDEM(e){return(1<<this._demTile.tileID.canonical.z)*un(1,e)*this._dem.stride}}
7const yx=new Float32Array(262144),du=new Uint8Array(262144),dg=[0,0,0],fg=[0,0,0];function u1(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,u1(i));return e}function h1(r,e,i){if(r.meshes)for(const o of r.meshes){if(o.aabb.min[0]===1/0)continue;const a=Ni.applyTransform(o.aabb,r.globalMatrix);i.insert(e,a.min[0],a.min[1],a.max[0],a.max[1])}if(r.children)for(const o of r.children)h1(o,e,i)}const pg=["","wall","door","roof","window","lamp","logo"];class d1{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:u1(e)}},this.aabb=this._getLocalBounds(),this.state=null}_getLocalBounds(){if(!this.node.meshes)return new Ni([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);if(!this.aabb){let e=0;const i=new Ni([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);for(const o of this.node.meshes)this.node.lightMeshIndex!==e&&(o.transformedAabb=Ni.applyTransformFast(o.aabb,this.node.globalMatrix),i.encapsulate(o.transformedAabb)),e++;this.aabb=i}return this.aabb}}class mg{constructor(e,i,o,a,c,h,f,_){this.requiresStandardRuntime=!0,this.id=o,this.layers=e,this.layerIds=this.layers.map(y=>y.fqid),this.stateDependentLayerIds=this.layers.filter(y=>y.isStateDependent()).map(y=>y.id),this.modelTraits|=Xh.CoordinateSpaceTile,this.uploaded=!1,this.hasPattern=!1,a&&(this.modelTraits|=Xh.HasMapboxMeshFeatures),c&&(this.modelTraits|=Xh.HasMeshoptCompression),this.zoom=-1,this.terrainExaggeration=1,this.projection={name:"mercator"},this.replacementUpdateTime=0,this.elevationReadFromZ=255,this.brightness=h,this.worldview=_,this.dirty=!0,this.needsUpload=!1,this.filter=null,this.nodesInfo=[];for(const y of i)this.nodesInfo.push(new d1(y)),h1(y,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 o of this.getNodesInfo()){const a=o.node;a.footprint&&i.push({footprint:a.footprint,id:e})}}updateAppearances(e,i,o,a){return{hasLayoutChanges:!1,hasUboChanges:!1}}update(e){const i=Object.keys(e).length!==0;if(i&&!this.stateDependentLayers.length)return;const o=i?this.stateDependentLayers:this.layers;if(!En(e,this.states))for(const a of o)this.evaluate(a,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 o of i){const a=o.node;this.uploaded?this.updatePbrBuffer(a):Jy(a,e,!0)}for(const o of i)J_(o.node);this.uploaded=!0,this.needsUpload=!1}updatePbrBuffer(e){let i=!1;if(!e.meshes)return i;for(const o of e.meshes)o.pbrBuffer&&(o.pbrBuffer.updateData(o.featureArray),i=!0);if(e.lodMeshes)for(const o of e.lodMeshes)o.pbrBuffer&&(o.pbrBuffer.updateData(o.featureArray),i=!0);return i}needsReEvaluation(e,i,o){const a=e.transform.projectionOptions,c=e.style.getBrightness(),h=this.brightness!==c;if(!this.uploaded||this.dirty||a.name!==this.projection.name||Ap(o.paint.get("model-color").value,h)||Ap(o.paint.get("model-color-mix-intensity").value,h)||Ap(o.paint.get("model-roughness").value,h)||Ap(o.paint.get("model-emissive-strength").value,h)||Ap(o.paint.get("model-height-based-emissive-strength-multiplier").value,h)){this.projection=a,this.brightness=c;const f=this.getNodesInfo();for(const _ of f)_.state=null;return!0}return!1}evaluateTransform(e,i){if(e.transform.zoom===this.zoom)return;this.zoom=e.transform.zoom;const o=this.getNodesInfo(),a=this.id.canonical;for(const c of o){const h=c.feature;c.evaluatedTranslation=i.paint.get("model-translation").evaluate(h,{},a),c.evaluatedScale=i.paint.get("model-scale").evaluate(h,{},a)}}evaluate(e,i){const o=this.getNodesInfo();for(const a of o){if(!a.node.meshes)continue;const c=a.feature,h=i&&i[c.id];if(En(h,a.state))continue;a.state=structuredClone(h);const f=a.node.meshes&&a.node.meshes[0].featureData,_=a.evaluatedColor[2],y=a.evaluatedRMEA[2],v=this.id.canonical;if(a.hasTranslucentParts=!1,f){for(let b=0;b<pg.length;b++){const T=pg[b];T.length&&(c.properties.part=T);const S=e.paint.get("model-color").evaluate(c,h,v).toPremultipliedRenderColor(null),C=e.paint.get("model-color-mix-intensity").evaluate(c,h,v);a.evaluatedColor[b]=[S.r,S.g,S.b,C],a.evaluatedRMEA[b][0]=e.paint.get("model-roughness").evaluate(c,h,v),a.evaluatedRMEA[b][2]=e.paint.get("model-emissive-strength").evaluate(c,h,v),a.evaluatedRMEA[b][3]=S.a,a.emissionHeightBasedParams[b]=e.paint.get("model-height-based-emissive-strength-multiplier").evaluate(c,h,v),!a.hasTranslucentParts&&S.a<1&&(a.hasTranslucentParts=!0)}delete c.properties.part,Xw(a,_!==a.evaluatedColor[2]||y!==a.evaluatedRMEA[2],this.modelTraits)}else a.evaluatedRMEA[0][2]=e.paint.get("model-emissive-strength").evaluate(c,h,v);a.evaluatedTranslation=e.paint.get("model-translation").evaluate(c,h,v),a.evaluatedScale=e.paint.get("model-scale").evaluate(c,h,v),this.updatePbrBuffer(a.node)||(this.needsUpload=!0)}this.dirty=!1}
7elevationUpdate(e,i,o,a){const c=e.findDEMTileFor(o);if(c&&(c.tileID.canonical!==this.terrainTile||i!==this.terrainExaggeration)){if(c.dem&&c.tileID.overscaledZ!==this.elevationReadFromZ){this.elevationReadFromZ=c.tileID.overscaledZ;const h=Jh.create(e,o,c);if(!h)return;this.modelTraits&Xh.HasMapboxMeshFeatures&&this.updateDEM(e,h,o,a);for(const f of this.getNodesInfo()){const _=f.node;if(!_.footprint||!_.footprint.vertices||!_.footprint.vertices.length)continue;const y=_.footprint.vertices;let v=h.getElevationAt(y[0].x,y[0].y,!0,!0);for(let b=1;b<y.length;b++)v=Math.min(v,h.getElevationAt(y[b].x,y[b].y,!0,!0));_.elevation=v}}this.terrainTile=c.tileID.canonical,this.terrainExaggeration=i}}updateDEM(e,i,o,a){let c=i._dem._modifiedForSources[a];if(c===void 0&&(i._dem._modifiedForSources[a]=[],c=i._dem._modifiedForSources[a]),c.includes(o.canonical))return;const h=i._dem.dim;c.push(o.canonical);let f=!1;for(const _ of this.getNodesInfo()){const y=_.node;if(!y.footprint||!y.footprint.grid)continue;const v=y.footprint.grid,b=i.tileCoordToPixel(v.min.x,v.min.y),T=i.tileCoordToPixel(v.max.x,v.max.y),S=Math.min(Math.min(h-T.y,b.x),Math.min(b.y,h-T.x));if(S<0)continue;const C=te(S,2,5);let P=Math.max(0,b.x-C),R=Math.max(0,b.y-C),L=Math.min(T.x+C,h-1),V=Math.min(T.y+C,h-1);for(let Z=R;Z<=V;++Z)for(let oe=P;oe<=L;++oe)du[Z*h+oe]=255;let B=0,G=0;for(let Z=0;Z<v.cellsY;++Z)for(let oe=0;oe<v.cellsX;++oe){if(!v.cells[Z*v.cellsX+oe])continue;const X=i.tileCoordToPixel(v.min.x+oe/v.xScale,v.min.y+Z/v.yScale),ee=i.tileCoordToPixel(v.min.x+(oe+1)/v.xScale,v.min.y+(Z+1)/v.yScale);for(let ie=X.y;ie<=Math.min(ee.y+1,h-1);++ie)for(let ne=X.x;ne<=Math.min(ee.x+1,h-1);++ne)du[ie*h+ne]===255&&(du[ie*h+ne]=0,B+=i.getElevationAtPixel(ne,ie),G++)}const H=B/G;P=Math.max(1,b.x-C),R=Math.max(1,b.y-C),L=Math.min(T.x+C,h-2),V=Math.min(T.y+C,h-2),f=!0;for(let Z=R;Z<=V;++Z)for(let oe=P;oe<=L;++oe)du[Z*h+oe]===0&&(yx[Z*h+oe]=i._dem.set(oe,Z,H));for(let Z=1;Z<C;++Z){P=Math.max(1,b.x-Z),R=Math.max(1,b.y-Z),L=Math.min(T.x+Z,h-2),V=Math.min(T.y+Z,h-2);for(let oe=R;oe<=V;++oe)for(let X=P;X<=L;++X){const ee=oe*h+X;if(du[ee]===255){let ie=0,ne=0,fe=-1,ge=-1;for(let we=-1;we<=1;++we)for(let Se=-1;Se<=1;++Se){const Ee=(oe+we)*h+X+Se;if(du[Ee]>=Z)continue;const Ve=yx[Ee],Ie=Math.abs(Ve);Ie>ne&&(ie=Ve,ne=Ie,fe=Se,ge=we)}if(ne>.1){const we=1-(Z+.5*Math.abs(fe*ge))/C;let Se=i._dem.get(X,oe)+ie*we;const Ee=i._dem.get(X+fe,oe+ge),Ve=i._dem.get(X-fe,oe-ge,!0);(Se-Ee)*(Se-Ve)>0&&(Se=(Ee+Ve)/2),yx[ee]=i._dem.set(X,oe,Se),du[ee]=Z}}}}}f&&(i._demTile.needsDEMTextureUpload=!0,i._dem._timestamp=Ki.now())}setFilter(e){this.filter=e?jl(e):null}getNodesInfo(){return this.filter?this.nodesInfo.filter(e=>this.filter.filter(new oi(this.id.overscaledZ,{worldview:this.worldview}),e.feature,this.id.canonical)):this.nodesInfo}destroy(){const e=this.getNodesInfo();for(const i of e)J_(i.node),Qy(i.node)}isEmpty(){return!this.nodesInfo.length}updateReplacement(e,i){if(i.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=i.updateTime;const o=i.getReplacementRegionsForTile(e.toUnwrapped());for(const a of this.getNodesInfo()){const c=a.node.footprint;a.hiddenByReplacement=!!c&&!o.some(h=>h.footprint===c)}}getHeightAtTileCoord(e,i){const o=[0,0,0],a=ki([]);for(const c of this.getNodesInfo()){const h=c.node.meshes[0],f=h.transformedAabb;if(e<f.min[0]||i<f.min[1]||e>f.max[0]||i>f.max[1])continue;if(c.node.hidden===!0)return{height:1/0,maxHeight:c.feature.properties.height,hidden:!1,verticalScale:c.evaluatedScale[2]};if(bo(a,c.node.globalMatrix),o[0]=e,o[1]=i,o[2]=0,Zi(o,o,a),c.node.meshBVH){const b=o[0],T=o[1];dg[0]=b-1,dg[1]=T-1,dg[2]=-1e3,fg[0]=b+1,fg[1]=T+1,fg[2]=1e3;const S=c.node.meshBVH.findHighestPoint(dg,fg);if(S!==null)return{height:S,maxHeight:c.feature.properties.height,hidden:c.hiddenByReplacement,verticalScale:c.evaluatedScale[2]};continue}const _=(o[0]-h.aabb.min[0])/(h.aabb.max[0]-h.aabb.min[0])*uu|0,y=Math.min(63,(o[1]-h.aabb.min[1])/(h.aabb.max[1]-h.aabb.min[1])*uu|0)*uu+Math.min(63,_),v=h.heightmap[y];if(v<0&&c.node.footprint){const b=[];if(c.node.footprint.grid.query(new Ne(e,i),new Ne(e,i),b),b.length>0)return{height:void 0,maxHeight:c.feature.properties.height,hidden:c.hiddenByReplacement,verticalScale:c.evaluatedScale[2]};continue}return c.hiddenByReplacement?void 0:{height:v,maxHeight:c.feature.properties.height,hidden:!1,verticalScale:c.evaluatedScale[2]}}}}function Ap(r,e){return r instanceof rh&&!r.isLightConstant&&e}function Ww(r){const e=te(r,0,2);return Math.min(Math.round(.5*e*255),255)}const f1=new Float64Array(10*pg.length);function p1(r,e,i,o,a){if(!r.featureData)return;const c=r.featureArray=new $c;c.reserveExact(r.featureData.length),(function(y,v,b){const T=b-v;for(let S=0;S<pg.length;S++){const C=y.evaluatedRMEA[S],P=y.evaluatedColor[S],R=y.emissionHeightBasedParams[S],L=te(R[0],0,1),V=te(R[1],0,1);let B=65535,G=0,H=1,Z=1;if(L!==V&&T!==0){const ee=te(R[2],0,1),ie=te(R[3],0,1),ne=T*(V-L);G=1/ne,H=-(v+T*L)/ne,Z=Math.pow(10,te(R[4],-1,1)),B=255*ee<<8|255*ie}const oe=f1,X=10*S;oe[X]=255*P[0],oe[X+1]=255*P[1],oe[X+2]=255*P[2],oe[X+3]=P[3],oe[X+4]=Math.floor(255*C[3]),oe[X+5]=Ww(C[2])<<8|15*C[0]<<4|15*C[1],oe[X+6]=B,oe[X+7]=G,oe[X+8]=H,oe[X+9]=Z}})(e,r.aabb.min[2],r.aabb.max[2]);const h=f1,f=e.node;let _=a&&!!f.lights;for(const y of r.featureData){const v=y>>i&65535,b=y>>o&15,T=b<8?b:0,S=10*T;let C=(61440&v|(61440&v)>>4)>>8,P=(3840&v|(3840&v)>>4)>>4,R=240&v|(240&v)>>4;const L=(15&v|(15&v)<<4)/255,V=h[S+3];V>
70&&(C=yt(C,h[S],V),P=yt(P,h[S+1],V),R=yt(R,h[S+2],V)),C*=L,P*=L,R*=L;const B=C<<8|P,G=R<<8|h[S+4],H=h[S+5],Z=h[S+6],oe=h[S+7],X=h[S+8],ee=h[S+9];if(c.emplaceBack(B,G,H,Z,oe,X,ee),_&&T===2){_=!1;const ie=10*f.lights.length,ne=new $c;ne.reserveExact(ie);for(let fe=0;fe<ie;fe++)ne.emplaceBack(B,G,H,Z,oe,X,ee);f.meshes[f.lightMeshIndex].featureArray=ne}}}function Xw(r,e,i){const o=r.node,a=i&Xh.HasMeshoptCompression,c=a?0:16,h=a?16:0;for(let f=0;f<o.meshes.length;f++)o.lights&&o.lightMeshIndex===f||p1(o.meshes[f],r,c,h,e);if(o.lodMeshes)for(const f of o.lodMeshes)p1(f,r,c,h,!1)}Je(mg,"Tiled3dModelBucket",{omit:["layers"]}),Je(d1,"Tiled3dModelFeature");const Yw=["id","tile","layer","source","sourceLayer","state"];class fu{constructor(e,i,o,a,c){this.type="Feature",this._vectorTileFeature=e,this._z=i,this._x=o,this._y=a,this.properties=e?e.properties:{},this.id=c}clone(){const e=new fu(this._vectorTileFeature,this._z,this._x,this._y,this.id);return this.state&&(e.state={...this.state}),this.layer&&(e.layer={...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 Yw)this[i]!==void 0&&(e[i]=this[i]);return e}}class Qa extends wa{constructor(e,i,o,a){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)}async loadGLTFFromURI(e,i){return Bv((await this.map._requestManager.transformRequest(e,va.Model,i)).url,i)}async loadModel(e,i,o){try{const a=await this.loadGLTFFromURI(i.uri,o);if(o.aborted)return;const c=this._modelsInfo.get(e);if(!c)return;const h=rx(a),f=c.modelSpec,_=new jv(e,f.uri,f.position,f.orientation,h);Qa.applyModelSpecification(_,f),_.computeBoundsAndApplyParent(),this.models.push(_),c.model=_}catch(a){if(o.aborted)return;this.fire(new hd(new Error(`Could not load model ${e} from ${i.uri}`,{cause:a})))}}async load(){this._abortController||(this._abortController=new AbortController);const e=this._abortController.signal,i=[];for(const o in this._options.models){const a=this._options.models[o],c=this._modelsInfo.get(o);if(c&&c.model){c.modelSpec=a;const h=c.model;h.position=a.position!=null?new Kt(a.position[0],a.position[1]):new Kt(0,0),h.orientation=a.orientation!=null?a.orientation:[0,0,0],Qa.applyModelSpecification(h,a),h.computeBoundsAndApplyParent(),this.models.push(h)}else c?c.modelSpec=a:(this._modelsInfo.set(o,{modelSpec:a,model:null}),i.push(this.loadModel(o,a,e)))}i.length!==0?(await Promise.allSettled(i),e.aborted||this.fire(new Un("data",{dataType:"source",sourceDataType:"metadata"}))):this.loaded()&&this.fire(new Un("data",{dataType:"source",sourceDataType:"metadata"}))}static arrayFromColorSpecification(e){const i=e;if(i===void 0)return;if(Array.isArray(i))return[i[0],i[1],i[2]];const o=$t.parse(i);return o?[o.r,o.g,o.b]:void 0}static applyModelSpecification(e,i){if(i.nodeOverrides&&Qa.convertNodeOverrides(e,i.nodeOverrides),i.materialOverrides&&Qa.convertMaterialOverrides(e,i.materialOverrides),i.nodeOverrideNames&&(e.nodeOverrideNames=[...i.nodeOverrideNames]),i.materialOverrideNames&&(e.materialOverrideNames=[...i.materialOverrideNames]),i.featureProperties&&(e.featureProperties=i.featureProperties),i.lightOverrides){const o=i.lightOverrides,a=Qa.arrayFromColorSpecification(o["light-ambient-color"]),c=Qa.arrayFromColorSpecification(o["light-directional-color"]);e.lightOverrides={ambientIntensity:o["light-ambient-intensity"],ambientColor:a,directionalIntensity:o["light-directional-intensity"],directionalColor:c}}else e.lightOverrides=void 0}static convertNodeOverrides(e,i){if(Array.isArray(i)&&i.every(o=>typeof o=="string")){e.nodeOverrideNames=[];for(const o of i)e.nodeOverrideNames.push(o)}
vendor: 25,961 bytes, line 7
7else Object.entries(i).forEach(([o,a])=>{const c={orientation:[0,0,0],minZoom:void 0,maxZoom:void 0};if(Object.hasOwn(a,"orientation")){const h=a.orientation;h&&(c.orientation=h)}Object.hasOwn(a,"minzoom")&&(c.minZoom=a.minzoom),Object.hasOwn(a,"maxzoom")&&(c.maxZoom=a.maxzoom),e.nodeOverrides.set(o,c)})}static convertMaterialOverrides(e,i){if(Array.isArray(i)&&i.every(o=>typeof o=="string")){e.materialOverrideNames=[];for(const o of i)e.materialOverrideNames.push(o)}else Object.entries(i).forEach(([o,a])=>{const c=a["model-color"],h={color:c!==void 0?new $t(c[0],c[1],c[2]):new $t(1,1,1),colorMix:0,emissionStrength:0,opacity:1},f=a["model-color-mix-intensity"];f!==void 0&&(h.colorMix=f);const _=a["model-emissive-strength"];_!==void 0&&(h.emissionStrength=_);const y=a["model-opacity"];y!==void 0&&(h.opacity=y),e.materialOverrides.set(o,h)})}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=hf(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 o in e){const a=e[o],c=this._modelsInfo.get(o);c&&c.modelSpec.uri===a.uri&&i.set(o,c)}if(this._modelsInfo.size!==i.size){this.cancelModelRequests();for(const[o,a]of i)a.model||i.delete(o)}this._modelsInfo=i,this._options.models=e,this.load()}}function xx(r,e,i,o){const a=1<<r.z;e.lat=Er((o/Ke+r.y)/a),e.lng=on((i/Ke+r.x)/a)}function Kw(r,e,i,o){const a=r.getNodesInfo()[e];if(!a||a.hiddenByReplacement||!a.node.meshes)return;let c=Number.MAX_VALUE;const h=a.node,f=i.tile,_=o.calculatePosMatrix(f.tileID.toUnwrapped(),o.worldSize),y=a.evaluatedScale;let v=0;o.elevation&&h.elevation&&(v=h.elevation*o.elevation.exaggeration()),wn(_,_,[(h.anchor?h.anchor[0]:0)*(y[0]-1),(h.anchor?h.anchor[1]:0)*(y[1]-1),v]),Gr(_,_,y);const b=i.queryGeometry,T=b.isPointQuery()?b.screenBounds:b.screenGeometry,S=function(P){const R=Ri([],_,P.globalMatrix);Ri(R,o.expandedFarZProjMatrix,R);for(let L=0;L<P.meshes.length;++L){const V=P.meshes[L];if(L===P.lightMeshIndex)continue;const B=Ky(T,o,R,V.aabb);B!=null&&(c=Math.min(B,c))}if(P.children)for(const L of P.children)S(L)};if(S(h),c===Number.MAX_VALUE)return;const C=new Kt(0,0);return xx(f.tileID.canonical,C,a.node.anchor[0],a.node.anchor[1]),{intersectionZ:c,position:C,feature:a.feature}}const Jw={circle:class extends an{constructor(r,e,i,o){super(r,{layout:l0||(l0=new Li({"circle-sort-key":new $e(pe.layout_circle["circle-sort-key"]),"circle-elevation-reference":new He(pe.layout_circle["circle-elevation-reference"]),visibility:new He(pe.layout_circle.visibility)})),paint:c0||(c0=new Li({"circle-radius":new $e(pe.paint_circle["circle-radius"]),"circle-color":new $e(pe.paint_circle["circle-color"]),"circle-blur":new $e(pe.paint_circle["circle-blur"]),"circle-opacity":new $e(pe.paint_circle["circle-opacity"]),"circle-translate":new He(pe.paint_circle["circle-translate"]),"circle-translate-anchor":new He(pe.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new He(pe.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new He(pe.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new $e(pe.paint_circle["circle-stroke-width"]),"circle-stroke-color":new $e(pe.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new $e(pe.paint_circle["circle-stroke-opacity"]),"circle-emissive-strength":new He(pe.paint_circle["circle-emissive-strength"]),"circle-color-use-theme":new $e({type:"string",default:"default","property-type":"data-driven"}),"circle-stroke-color-use-theme":new $e({type:"string",default:"default","property-type":"data-driven"})}))},e,i,o)}createBucket(r){return new nu(r)}queryRadius(r){const e=r;return Kh("circle-radius",this,e)+Kh("circle-stroke-width",this,e)+ug(this.paint.get("circle-translate"))}queryIntersectsFeature(r,e,i,o,a,c,h,f){const _=p0(this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),c.angle,r.pixelToTileUnitsFactor),y=this.paint.get("circle-radius").evaluate(e,i)+this.paint.get("circle-stroke-width").evaluate(e,i);return _0(r,o,c,h,f,this.paint.get("circle-pitch-alignment")==="map",this.paint.get("circle-pitch-scale")==="map",_,y)}getProgramIds(){return["circle"]}getDefaultProgramParams(r,e,i){const o=m0(this);return{config:new qa(this,{zoom:e,lut:i}),defines:o,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"}mayUse(r){return r==="HD"&&_h(this,"circle-elevation-reference",e=>e==="hd-road-markup")}prepare(){return this.mayUse("HD")?cg():Promise.resolve()}},heatmap:class extends an{createBucket(r){return new y0(r)}constructor(r,e,i,o){super(r,{layout:x0||(x0=new Li({visibility:new He(pe.layout_heatmap.visibility)})),paint:v0||(v0=new Li({"heatmap-radius":new $e(pe.paint_heatmap["heatmap-radius"]),"heatmap-weight":new $e(pe.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new He(pe.paint_heatmap["heatmap-intensity"]),"heatmap-color":new ws(pe.paint_heatmap["heatmap-color"]),"heatmap-opacity":new He(pe.paint_heatmap["heatmap-opacity"]),"heatmap-color-use-theme":new $e({type:"string",default:"default","property-type":"data-driven"})}))},e,i,o),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(r){r==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=Ep({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 Kh("heatmap-radius",this,r)}queryIntersectsFeature(r,e,i,o,a,c,h,f){const _=this.paint.get("heatmap-radius").evaluate(e,i);return _0(r,o,c,h,f,!0,!0,new Ne(0,0),_)}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}getProgramIds(){return["heatmap","heatmapTexture"]}getDefaultProgramParams(r,e,i){return r==="heatmap"?{config:new qa(this,{zoom:e,lut:i}),overrideFog:!1}:{}}},hillshade:class extends an{constructor(r,e,i,o){super(r,{layout:b0||(b0=new Li({visibility:new He(pe.layout_hillshade.visibility)})),paint:w0||(w0=new Li({"hillshade-illumination-direction":new He(pe.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new He(pe.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new He(pe.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new He(pe.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new He(pe.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new He(pe.paint_hillshade["hillshade-accent-color"]),"hillshade-emissive-strength":new He(pe.paint_hillshade["hillshade-emissive-strength"]),"hillshade-shadow-color-use-theme":new $e({type:"string",default:"default","property-type":"data-driven"}),"hillshade-highlight-color-use-theme":new $e({type:"string",default:"default","property-type":"data-driven"}),"hillshade-accent-color-use-theme":new $e({type:"string",default:"default","property-type":"data-driven"})}))},e,i,o)}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 an{constructor(r,e,i,o){super(r,{layout:T0||(T0=new Li({"fill-sort-key":new $e(pe.layout_fill["fill-sort-key"]),visibility:new He(pe.layout_fill.visibility),"fill-elevation-reference":new He(pe.layout_fill["fill-elevation-reference"]),"fill-construct-bridge-guard-rail":new $e(pe.layout_fill["fill-construct-bridge-guard-rail"])})),paint:E0||(E0=new Li({"fill-antialias":new He(pe.paint_fill["fill-antialias"]),"fill-opacity":new $e(pe.paint_fill["fill-opacity"]),"fill-color":new $e(pe.paint_fill["fill-color"]),"fill-outline-color":new $e(pe.paint_fill["fill-outline-color"]),"fill-translate":new He(pe.paint_fill["fill-translate"]),"fill-translate-anchor":new He(pe.paint_fill["fill-translate-anchor"]),"fill-pattern":new $e(pe.paint_fill["fill-pattern"]),"fill-pattern-cross-fade":new He(pe.paint_fill["fill-pattern-cross-fade"]),"fill-emissive-strength":new He(pe.paint_fill["fill-emissive-strength"]),"fill-z-offset":new $e(pe.paint_fill["fill-z-offset"]),"fill-bridge-guard-rail-color":new $e(pe.paint_fill["fill-bridge-guard-rail-color"]),"fill-tunnel-structure-color":new $e(pe.paint_fill["fill-tunnel-structure-color"]),"fill-color-use-theme":new $e({type:"string",default:"default","property-type":"data-driven"}),"fill-outline-color-use-theme":new $e({type:"string",default:"default","property-type":"data-driven"}),"fill-bridge-guard-rail-color-use-theme":new $e({type:"string",default:"default","property-type":"data-driven"}),"fill-tunnel-structure-color-use-theme":new $e({type:"string",default:"default","property-type":"data-driven"})}))},e,i,o)}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 qa(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 Zf(r)}queryRadius(){return ug(this.paint.get("fill-translate"))}queryIntersectsFeature(r,e,i,o,a,c){return!r.queryGeometry.isAboveHorizon&&Jf(f0(r.tilespaceGeometry,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),c.angle,r.pixelToTileUnitsFactor),o)}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"}mayUse(r){return r==="HD"&&_h(this,"fill-elevation-reference",e=>e!=="none")}prepare(){return this.mayUse("HD")?cg():Promise.resolve()}hasShadowPass(){return this.layout&&this.layout.get("fill-elevation-reference")!=="none"}},"fill-extrusion":class extends an{constructor(r,e,i,o){super(r,{layout:A0||(A0=new Li({visibility:new He(pe["layout_fill-extrusion"].visibility),"fill-extrusion-edge-radius":new He(pe["layout_fill-extrusion"]["fill-extrusion-edge-radius"]),"source-max-zoom":new He(pe["layout_fill-extrusion"]["source-max-zoom"])})),paint:C0||(C0=new Li({"fill-extrusion-opacity":new He(pe["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new $e(pe["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new He(pe["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new He(pe["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new $e(pe["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-pattern-cross-fade":new He(pe["paint_fill-extrusion"]["fill-extrusion-pattern-cross-fade"]),"fill-extrusion-height":new $e(pe["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new $e(pe["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-height-alignment":new He(pe["paint_fill-extrusion"]["fill-extrusion-height-alignment"]),"fill-extrusion-base-alignment":new He(pe["paint_fill-extrusion"]["fill-extrusion-base-alignment"]),"fill-extrusion-vertical-gradient":new He(pe["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"]),"fill-extrusion-ambient-occlusion-intensity":new He(pe["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-intensity"]),"fill-extrusion-ambient-occlusion-radius":new He(pe["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-radius"]),"fill-extrusion-ambient-occlusion-wall-radius":new He(pe["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-wall-radius"]),"fill-extrusion-ambient-occlusion-ground-radius":new He(pe["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-ground-radius"]),"fill-extrusion-ambient-occlusion-ground-attenuation":new He(pe["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-ground-attenuation"]),"fill-extrusion-flood-light-color":new He(pe["paint_fill-extrusion"]["fill-extrusion-flood-light-color"]),"fill-extrusion-flood-light-intensity":new He(pe["paint_fill-extrusion"]["fill-extrusion-flood-light-intensity"]),"fill-extrusion-flood-light-wall-radius":new $e(pe["paint_fill-extrusion"]["fill-extrusion-flood-light-wall-radius"]),"fill-extrusion-flood-light-ground-radius":new $e(pe["paint_fill-extrusion"]["fill-extrusion-flood-light-ground-radius"]),"fill-extrusion-flood-light-ground-attenuation":new He(pe["paint_fill-extrusion"]["fill-extrusion-flood-light-ground-attenuation"]),"fill-extrusion-vertical-scale":new He(pe["paint_fill-extrusion"]["fill-extrusion-vertical-scale"]),"fill-extrusion-rounded-roof":new He(pe["paint_fill-extrusion"]["fill-extrusion-rounded-roof"]),"fill-extrusion-cutoff-fade-range":new He(pe["paint_fill-extrusion"]["fill-extrusion-cutoff-fade-range"]),"fill-extrusion-front-cutoff":new He(pe["paint_fill-extrusion"]["fill-extrusion-front-cutoff"]),"fill-extrusion-emissive-strength":new $e(pe["paint_fill-extrusion"]["fill-extrusion-emissive-strength"]),"fill-extrusion-line-width":new $e(pe["paint_fill-extrusion"]["fill-extrusion-line-width"]),"fill-extrusion-cast-shadows":new He(pe["paint_fill-extrusion"]["fill-extrusion-cast-shadows"]),"fill-extrusion-color-use-theme":new $e({type:"string",default:"default","property-type":"data-driven"}),"fill-extrusion-flood-light-color-use-theme":new $e({type:"string",default:"default","property-type":"data-driven"})}))},e,i,o),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(r){return new ag(r)}queryRadius(){return ug(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,o,a,c,h,f,_){const y=p0(this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),c.angle,r.pixelToTileUnitsFactor),v=this.paint.get("fill-extrusion-height").evaluate(e,i),b=this.paint.get("fill-extrusion-base").evaluate(e,i),T=[0,0],S=f&&c.elevation,C=c.elevation?c.elevation.exaggeration():1,P=r.tile.getBucket(this);if(P instanceof ag){const G=P.centroidData.find(H=>_>=H.vertexArrayOffset&&_<H.vertexArrayOffset+H.vertexCount);if(G&&G.flags&ig)return!1;if(S){const H=P.centroidVertexArray,Z=_+1;Z<H.length&&(T[0]=H.geta_centroid_pos0(Z),T[1]=H.geta_centroid_pos1(Z))}}if(T[0]===0&&T[1]===1)return!1;c.projection.name==="globe"&&(o=s0([o],[new Ne(0,0),new Ne(Ke,Ke)],r.tileID.canonical).map(G=>G.polygon).flat());const R=S?f:null,[L,V]=O0(c,o,b,v,y,h,R,T,C,c.center.lat,r.tileID.canonical),B=r.queryGeometry;return F0(L,V,B.isPointQuery()?B.screenBounds:B.screenGeometry)}},building:class extends an{constructor(r,e,i,o){super(r,{layout:M0||(M0=new Li({visibility:new He(pe.layout_building.visibility),"building-facade":new $e(pe.layout_building["building-facade"]),"building-facade-floors":new $e(pe.layout_building["building-facade-floors"]),"building-facade-unit-width":new $e(pe.layout_building["building-facade-unit-width"]),"building-facade-window":new $e(pe.layout_building["building-facade-window"]),"building-roof-shape":new $e(pe.layout_building["building-roof-shape"]),"building-height":new $e(pe.layout_building["building-height"]),"building-base":new $e(pe.layout_building["building-base"]),"building-flood-light-wall-radius":new $e(pe.layout_building["building-flood-light-wall-radius"]),"building-flood-light-ground-radius":new $e(pe.layout_building["building-flood-light-ground-radius"]),"building-flip-roof-orientation":new $e(pe.layout_building["building-flip-roof-orientation"])})),paint:P0||(P0=new Li({"building-opacity":new He(pe.paint_building["building-opacity"]),"building-ambient-occlusion-intensity":new He(pe.paint_building["building-ambient-occlusion-intensity"]),"building-ambient-occlusion-ground-intensity":new He(pe.paint_building["building-ambient-occlusion-ground-intensity"]),"building-ambient-occlusion-ground-radius":new He(pe.paint_building["building-ambient-occlusion-ground-radius"]),"building-ambient-occlusion-ground-attenuation":new He(pe.paint_building["building-ambient-occlusion-ground-attenuation"]),"building-vertical-scale":new He(pe.paint_building["building-vertical-scale"]),"building-cast-shadows":new He(pe.paint_building["building-cast-shadows"]),"building-color":new $e(pe.paint_building["building-color"]),"building-emissive-strength":new $e(pe.paint_building["building-emissive-strength"]),"building-facade-emissive-chance":new He(pe.paint_building["building-facade-emissive-chance"]),"building-cutoff-fade-range":new He(pe.paint_building["building-cutoff-fade-range"]),"building-front-cutoff":new He(pe.paint_building["building-front-cutoff"]),"building-flood-light-color":new He(pe.paint_building["building-flood-light-color"]),"building-flood-light-intensity":new He(pe.paint_building["building-flood-light-intensity"]),"building-flood-light-ground-attenuation":new He(pe.paint_building["building-flood-light-ground-attenuation"]),"building-color-use-theme":new $e({type:"string",default:"default","property-type":"data-driven"}),"building-flood-light-color-use-theme":new $e({type:"string",default:"default","property-type":"data-driven"})}))},e,i,o),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}mayUse(r){return r==="HD"}prepare(){return(async function(){return(function(){if(!Ai(self)||Lo!=null||u0!=null)return null;if(Yh!=null)return Yh;const r=fetch(ar());return Yh=(function(e){let i,o,a,c,h;function f(){i=new Uint8Array(h.buffer),o=new Int16Array(h.buffer),a=new Int32Array(h.buffer),c=new Float32Array(h.buffer)}function _(){throw new Error("Unexpected BuildingGen error.")}const y=()=>{},v={a:{a:_,f:function(b){const T=i.length,S=Math.max(b>>>0,Math.ceil(1.2*T)),C=Math.ceil((S-T)/65536);try{return h.grow(C),f(),!0}catch{return!1}},g:_,b:y,c:y,d:y,e:y}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(e,v):e.then(b=>b.arrayBuffer()).then(b=>WebAssembly.instantiate(b,v))).then(b=>{const T=b.instance.exports;return(0,T.g)(),h=T.f,f(),new Ow({setStyle:T.h,setAOOptions:T.i,setMetricOptions:T.j,setStructuralOptions:T.k,setFacadeOptions:T.l,setFauxFacadeOptions:T.m,setFacadeClassifierOptions:T.n,addFeature:T.o,addFacade:T.p,generateMesh:T.q,getLastError:T.r,getOuterRingLength:T.s,getMeshCount:T.t,getPositionsPtr:T.u,getPositionsLength:T.v,getNormalsPtr:T.w,getNormalsLength:T.x,getAOPtr:T.y,getAOLength:T.z,getUVPtr:T.A,getUVLength:T.B,getFauxFacadePtr:T.C,getFauxFacadeLength:T.D,getIndicesPtr:T.E,getIndicesLength:T.F,getBuildingPart:T.G,getRingCount:T.H,getRingPtr:T.I,getRingLength:T.J,malloc:T.K,free:T.L,heapU8:i,heap16:o,heap32:a,heapF32:c})})})(r).then(e=>{Yh=null,Lo=e}).catch(e=>{ht("Could not load building-gen"),Yh=null,u0=e}),Yh})()})()}createBucket(r){return new h0(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,o,a,c,h,f,_,y){let v=this.layout.get("building-height").evaluate(e,i);const b=this.layout.get("building-base").evaluate(e,i),T=r.tile.getBucket(this).getFootprint(e);if(T){if(T.hiddenFlags!==0)return!1;v=T.height}const[S,C]=O0(c,o,b,v,new Ne(0,0),h,null,[0,0],1,c.center.lat,r.tileID.canonical),P=r.queryGeometry;return F0(S,C,P.isPointQuery()?P.screenBounds:P.screenGeometry)}},line:class extends an{constructor(r,e,i,o){const a=G0();super(r,a,e,i,o),a.layout&&(this.layout=new Xo(a.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 wc,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}else r==="line-gradient-use-theme"&&(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(Ip)return Ip;const i=G0();return Ip=new Hw(i.paint.properties["line-width"].specification),Ip.useIntegerZoom=!0,Ip})().possiblyEvaluate(this._transitioningPaint._values["line-width"].value,r)}createBucket(r){return new Vh(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 o=U0(this);return{config:new qa(this,{zoom:e,lut:i}),defines:o,overrideFog:!1}}queryRadius(r){const e=r,i=$0(Kh("line-width",this,e),Kh("line-gap-width",this,e)),o=Kh("line-offset",this,e);return i/2+Math.abs(o)+ug(this.paint.get("line-translate"))}queryIntersectsFeature(r,e,i,o,a,c){if(r.queryGeometry.isAboveHorizon)return!1;const h=f0(r.tilespaceGeometry,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),c.angle,r.pixelToTileUnitsFactor),f=r.pixelToTileUnitsFactor/2*$0(this.paint.get("line-width").evaluate(e,i),this.paint.get("line-gap-width").evaluate(e,i)),_=this.paint.get("line-offset").evaluate(e,i);return _&&(o=(function(y,v){const b=[],T=new Ne(0,0);for(let S=0;S<y.length;S++){const C=y[S],P=[];for(let R=0;R<C.length;R++){const L=C[R],V=C[R+1],B=R===0?T:L.sub(C[R-1])._unit()._perp(),G=R===C.length-1?T:V.sub(L)._unit()._perp(),H=B._add(G)._unit();H._mult(1/(H.x*G.x+H.y*G.y)),P.push(H._mult(v)._add(L))}b.push(P)}return b})(o,_*r.pixelToTileUnitsFactor)),(function(y,v,b){for(let T=0;T<v.length;T++){const S=v[T];if(y.length>=3){for(let C=0;C<S.length;C++)if(As(y,S[C]))return!0}if(r_(y,S,b))return!0}return!1})(h,o,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"}mayUse(r){return r==="HD"&&_h(this,"line-elevation-reference",e=>e==="hd-road-markup")}prepare(){return this.mayUse("HD")?cg():Promise.resolve()}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:hg,background:class extends an{constructor(r,e,i,o){super(r,{layout:X0||(X0=new Li({visibility:new He(pe.layout_background.visibility)})),paint:Y0||(Y0=new Li({"background-pitch-alignment":new He(pe.paint_background["background-pitch-alignment"]),"background-color":new He(pe.paint_background["background-color"]),"background-pattern":new He(pe.paint_background["background-pattern"]),"background-opacity":new He(pe.paint_background["background-opacity"]),"background-emissive-strength":new He(pe.paint_background["background-emissive-strength"]),"background-color-use-theme":new $e({type:"string",default:"default","property-type":"data-driven"})}))},e,i,o)}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:Q0,"raster-particle":a1,sky:class extends an{constructor(r,e,i,o){super(r,{layout:i1||(i1=new Li({visibility:new He(pe.layout_sky.visibility)})),paint:r1||(r1=new Li({"sky-type":new He(pe.paint_sky["sky-type"]),"sky-atmosphere-sun":new He(pe.paint_sky["sky-atmosphere-sun"]),"sky-atmosphere-sun-intensity":new He(pe.paint_sky["sky-atmosphere-sun-intensity"]),"sky-gradient-center":new He(pe.paint_sky["sky-gradient-center"]),"sky-gradient-radius":new He(pe.paint_sky["sky-gradient-radius"]),"sky-gradient":new ws(pe.paint_sky["sky-gradient"]),"sky-atmosphere-halo-color":new He(pe.paint_sky["sky-atmosphere-halo-color"]),"sky-atmosphere-color":new He(pe.paint_sky["sky-atmosphere-color"]),"sky-opacity":new He(pe.paint_sky["sky-opacity"]),"sky-gradient-use
7-theme":new $e({type:"string",default:"default","property-type":"data-driven"}),"sky-atmosphere-halo-color-use-theme":new $e({type:"string",default:"default","property-type":"data-driven"}),"sky-atmosphere-color-use-theme":new $e({type:"string",default:"default","property-type":"data-driven"})}))},e,i,o),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=Ep({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 o=this.paint.get("sky-atmosphere-sun"),a=!o,c=r.style.light,h=c.properties.get("position");return a&&c.properties.get("anchor")==="viewport"&&ht("The sun direction is attached to a light with viewport anchor, lighting may behave unexpectedly."),a?_x(h.azimuthal,90-h.polar,e):_x(o[0],90-o[1],e)}const i=this.paint.get("sky-gradient-center");return _x(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 an{constructor(r,e,i,o){super(r,{paint:n1||(n1=new Li({}))},e,null)}},model:class extends an{constructor(r,e,i,o){super(r,{layout:o1||(o1=new Li({visibility:new He(pe.layout_model.visibility),"model-id":new $e(pe.layout_model["model-id"]),"model-allow-density-reduction":new He(pe.layout_model["model-allow-density-reduction"])})),paint:s1||(s1=new Li({"model-opacity":new $e(pe.paint_model["model-opacity"]),"model-rotation":new $e(pe.paint_model["model-rotation"]),"model-scale":new $e(pe.paint_model["model-scale"]),"model-translation":new $e(pe.paint_model["model-translation"]),"model-color":new $e(pe.paint_model["model-color"]),"model-color-mix-intensity":new $e(pe.paint_model["model-color-mix-intensity"]),"model-type":new He(pe.paint_model["model-type"]),"model-cast-shadows":new He(pe.paint_model["model-cast-shadows"]),"model-receive-shadows":new He(pe.paint_model["model-receive-shadows"]),"model-ambient-occlusion-intensity":new He(pe.paint_model["model-ambient-occlusion-intensity"]),"model-emissive-strength":new $e(pe.paint_model["model-emissive-strength"]),"model-roughness":new $e(pe.paint_model["model-roughness"]),"model-height-based-emissive-strength-multiplier":new $e(pe.paint_model["model-height-based-emissive-strength-multiplier"]),"model-cutoff-fade-range":new He(pe.paint_model["model-cutoff-fade-range"]),"model-front-cutoff":new He(pe.paint_model["model-front-cutoff"]),"model-elevation-reference":new He(pe.paint_model["model-elevation-reference"]),"model-line-cutout-mode":new He(pe.paint_model["model-line-cutout-mode"]),"model-color-use-theme":new $e({type:"string",default:"default","property-type":"data-driven"})}))},e,i,o),this.layer=r,this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}mayUse(r){return r==="Standard"}prepare(){return(async function(){return Promise.resolve()})()}createBucket(r){return new gx(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 mg?8191:0}queryRenderedFeatures(r,e,i){const o=e.getSource();
vendor: 111,228 bytes, line 7
7if(!(o&&o instanceof Qa))return{};const a=o,c={};c[this.id]=[];const h=c[this.id];let f=0;for(const _ of a.models){const y=e.getFeatureState(this.sourceLayer,_.id),v={type:"Unknown",id:_.id,properties:_.featureProperties},b=this.paint.get("model-rotation").evaluate(v,y),T=this.paint.get("model-scale").evaluate(v,y),S=this.paint.get("model-translation").evaluate(v,y),C=this.paint.get("model-elevation-reference");let P=[];K_(P,_,i,_.position,b,T,S,C==="ground",C==="ground",!1),i.projection.name==="globe"&&(P=Y_(P,i));const R=Ri([],i.projMatrix,P),L=Ky(r.isPointQuery()?r.screenBounds:r.screenGeometry,i,R,_.aabb);if(L!=null){const V=new fu(void 0,0,0,0,_.id);V.layer=this.layer,V.properties=structuredClone(_.featureProperties),V.properties.layer=this.id,V.properties.uri=_.uri,V.properties.orientation=_.orientation,V.sourceLayer=this.sourceLayer,V.geometry={type:"Point",coordinates:[_.position.lng,_.position.lat]},V.state=y,V.source=this.source,h.push({featureIndex:f,feature:V,intersectionZ:L})}++f}return c}queryIntersectsFeature(r,e,i,o,a,c,h,f,_,y){if(!this.modelManager)return!1;const v=this.modelManager,b=r.tile.getBucket(this);if(!(b&&b instanceof gx))return!1;for(const T in b.instancesPerModel){const S=b.instancesPerModel[T],C=e.id!==void 0?e.id:e.properties&&Object.hasOwn(e.properties,"id")?e.properties.id:void 0;if(Object.hasOwn(S.idToFeaturesIndex,C)){const P=S.features[S.idToFeaturesIndex[C]],R=v.getModel(T,y||this.scope);if(!R)return!1;let L=[];const V=new Kt(0,0),B=b.canonical;let G=Number.MAX_VALUE;for(let H=0;H<P.instancedDataCount;++H){const Z=16*(P.instancedDataOffset+H),oe=S.instancedDataArray.float32,X=[oe[Z+4],oe[Z+5],oe[Z+6]];xx(B,V,Math.floor(oe[Z]),Math.floor(oe[Z+1])),K_(L,R,c,V,P.rotation,P.scale,X,!1,!1,!1),c.projection.name==="globe"&&(L=Y_(L,c));const ee=Ri([],c.projMatrix,L),ie=r.queryGeometry,ne=Ky(ie.isPointQuery()?ie.screenBounds:ie.screenGeometry,c,ee,R.aabb);ne!=null&&(G=Math.min(ne,G))}return G!==Number.MAX_VALUE&&G}}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 Pc}isZoomDependent(){return this._isPropertyZoomDependent("model-scale")||this._isPropertyZoomDependent("model-rotation")||this._isPropertyZoomDependent("model-translation")}},clip:class extends an{constructor(r,e,i,o){super(r,{layout:S0||(S0=new Li({"clip-layer-types":new He(pe.layout_clip["clip-layer-types"]),"clip-layer-scope":new He(pe.layout_clip["clip-layer-scope"]),visibility:new He(pe.layout_clip.visibility)})),paint:I0||(I0=new Li({}))},e,i,o)}recalculate(r,e){super.recalculate(r,e)}createBucket(r){return new z0(r)}is3D(r){return!0}}};class vx{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)}}Je(vx,"LRUCache");class Qw{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&&(this._channel.port1.close(),this._channel.port2.close()),this._callback=()=>{}}}const m1={Other:0,Symbol:1,FillExtrusion:2,HdRoadCoverage:3,HdRoadElevation:4};class eT{constructor(){this.tasks=new Map,qe(["process"],this),this.invoker=new Qw(this.process),this.nextId=0}add(e,i){const o=this.nextId++,a=(function({type:c,renderSourceType:h,zoom:f}){f=f||0;const _=h===m1.Symbol;return c==="message"?0:c!=="maybePrepare"||_?c!=="parseTile"||_?c==="parseTile"&&_?300-f:c==="maybePrepare"&&_?400-f:500:200-f:100-f})(i);return a===0?(e(),null):(this.tasks.set(o,{fn:e,metadata:i,priority:a,id:o}),this.invoker.trigger(),{cancel:()=>{this.tasks.delete(o)}})}process(){{const e=this.pick();if(!e)return;this.tasks.delete(e.id),this.tasks.size>0&&this.invoker.trigger(),e.fn()}}pick(){let e=null,i=1/0;for(const o of this.tasks.values())o.priority<i&&(i=o.priority,e=o);return e}remove(){this.tasks.clear(),this.invoker.remove()}}const _1={type:"message"};class g1{constructor(e){this._stringToNumber={},this._numberToString=[];for(let i=0;i<e.length;i++){const o=e[i];this._stringToNumber[o]=i,this._numberToString[i]=o}}encode(e){return this._stringToNumber[e]}decode(e){return this._numberToString[e]}}class y1{constructor(e,i){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new vs(Ke,Ke,512),this.featureIndexArray=new Ph,this.promoteId=i,this.is3DTile=!1,this.serializedLayersCache=new Map}insert(e,i,o,a,c,h=0,f=0){const _=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(o,a,c,h);const y=this.grid;for(let v=0;v<i.length;v++){const b=i[v],T=[1/0,1/0,-1/0,-1/0];for(let S=0;S<b.length;S++){const C=b[S];T[0]=Math.min(T[0],C.x),T[1]=Math.min(T[1],C.y),T[2]=Math.max(T[2],C.x),T[3]=Math.max(T[3],C.y)}f!==0&&(T[0]-=f,T[1]-=f,T[2]+=f,T[3]+=f),T[0]<Ke&&T[1]<Ke&&T[2]>=0&&T[3]>=0&&y.insert(_,T[0],T[1],T[2],T[3])}}loadVTLayers(){if(!this.vtLayers){this.vtLayers=new Yf(new t(this.rawTileData)).layers,this.sourceLayerCoder=new g1(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:o,transform:a,tileTransform:c,pixelPosMatrix:h,availableImages:f,worldview:_}=i;this.loadVTLayers(),this.serializedLayersCache.clear();const y=i.queryRadius?i.queryRadius:0,v=o.bufferedTilespaceBounds,b=this.grid.queryKeys(v.min.x,v.min.y,v.max.x,v.max.y,(P,R,L,V)=>o_(o.bufferedTilespaceGeometry,P-y,R-y,L+y,V+y));b.sort(tT);let T=null;a.elevation&&b.length>0&&(T=Jh.create(a.elevation,this.tileID));const S={};let C;for(let P=0;P<b.length;P++){const R=b[P];if(R===C)continue;C=R;const L=this.featureIndexArray.get(R);let V=null;this.is3DTile?this.loadMatchingModelFeature(S,L,e,o,a,_):this.loadMatchingFeature(S,L,e,f,_,(B,G,H,Z=0)=>(V||(V=xn(B,this.tileID.canonical,c)),G.queryIntersectsFeature(o,B,H,V,this.z,a,h,T,Z,i.scope)))}return S}loadMatchingFeature(e,i,o,a,c,h){const{featureIndex:f,bucketIndex:_,sourceLayerIndex:y,layoutVertexArrayOffset:v}=i,b=this.bucketLayerIDs[_],T=o.layers,S=Object.keys(T);if(S.length&&!Xt(S,b))return;const C=o.sourceCache,P=this.sourceLayerCoder.decode(y),R=this.vtLayers[P].feature(f),L=this.getId(R,P);for(let V=0;V<b.length;V++){const B=b[V];if(!T[B])continue;const{styleLayer:G,targets:H}=T[B];let Z={};L!==void 0&&(Z=C.getFeatureState(G.sourceLayer,L));const oe=!h||h(R,G,Z,v);if(!oe)continue;const X=new fu(R,this.z,this.x,this.y,L);X.tile=this.tileID.canonical,X.state=Z;let ee=this.serializedLayersCache.get(B);ee||(ee=G.serialize(),ee.id=B,this.serializedLayersCache.set(B,ee)),X.source=ee.source,X.sourceLayer=ee["source-layer"],X.layer={...ee},X.layer.paint=x1(ee.paint,G.paint,R,Z,a),X.layer.layout=x1(ee.layout,G.layout,R,Z,a);const ie=new oi(this.tileID.overscaledZ,{worldview:c});let ne=!1;for(const fe of H){this.updateFeatureProperties(X,fe);const{filter:ge}=fe;if(ge){if(R.properties=X.properties,ge.needGeometry){const we=uo(R,!0);if(!ge.filter(ie,we,this.tileID.canonical))continue}else if(!ge.filter(ie,R))continue}ne=!0,fe.targetId&&this.addFeatureVariant(X,fe)}ne&&this.appendToResult(e,B,f,X,oe)}}loadMatchingModelFeature(e,i,o,a,c,h){const{featureIndex:f,bucketIndex:_}=i,y=this.bucketLayerIDs[_],v=o.layers,b=Object.keys(v);if(!b.length||Xt(b,y))for(let T=0;T<y.length;T++){const S=y[T],{styleLayer:C,targets:P}=v[S];if(C.type!=="model")continue;const R=a.tile,L=R.getBucket(C);if(!(L&&L instanceof mg))continue;const V=Kw(L,f,a,c);if(!V)continue;const{z:B,x:G,y:H}=R.tileID.canonical,{feature:Z,intersectionZ:oe,position:X}=V;let ee={};Z.id!==void 0&&(ee=o.sourceCache.getFeatureState(C.sourceLayer,Z.id));const ie=new fu({},B,G,H,Z.id);ie.tile=this.tileID.canonical,ie.state=ee,ie.properties=Z.properties,ie.geometry={type:"Point",coordinates:[X.lng,X.lat]};let ne=this.serializedLayersCache.get(S);ne||(ne=C.serialize(),ne.id=S,this.serializedLayersCache.set(S,ne)),ie.source=ne.source,ie.sourceLayer=ne["source-layer"],ie.layer={...ne};const fe=new oi(this.tileID.overscaledZ,{worldview:h});let ge=!1;for(const we of P){this.updateFeatureProperties(ie,we);const{filter:Se}=we;if(Se){if(Z.properties=ie.properties,Se.needGeometry){if(!Se.filter(fe,Z,this.tileID.canonical))continue}else if(!Se.filter(fe,Z))continue}ge=!0,we.targetId&&this.addFeatureVariant(ie,we)}ge&&this.appendToResult(e,S,f,ie,oe)}}updateFeatureProperties(e,i,o){if(i.properties){const a={};for(const c in i.properties){const h=i.properties[c].evaluate({zoom:this.z},e._vectorTileFeature,e.state,e.tile,o);h!=null&&(a[c]=h)}e.properties=a}}addFeatureVariant(e,i,o){const a={target:i.target,namespace:i.namespace,uniqueFeatureID:i.uniqueFeatureID};i.properties&&(a.properties=e.properties),e.variants=e.variants||{},e.variants[i.targetId]=e.variants[i.targetId]||[],e.variants[i.targetId].push(a)}appendToResult(e,i,o,a,c){let h=e[i];h===void 0&&(h=e[i]=[]),h.push({featureIndex:o,feature:a,intersectionZ:c})}lookupSymbolFeatures(e,i,o,a,c,h){const f={};this.loadVTLayers();for(const _ of e)this.loadMatchingFeature(f,{bucketIndex:i,sourceLayerIndex:o,featureIndex:_,layoutVertexArrayOffset:0},a,c,h);return f}loadFeature(e){const{featureIndex:i,sourceLayerIndex:o}=e;this.loadVTLayers();const a=this.sourceLayerCoder.decode(o),c=this.vtFeatures[a];if(c[i])return c[i];const h=this.vtLayers[a].feature(i);return c[i]=h,h}hasLayer(e){for(const i of this.bucketLayerIDs)for(const o of i)if(e===o)return!0;return!1}getId(e,i){let o=e.id;if(this.promoteId){const a=Array.isArray(this.promoteId)||typeof this.promoteId!="object"?this.promoteId:this.promoteId[i];if(a!=null)if(Array.isArray(a)){if(!this.promoteIdExpression){const c=Fl(a);if(c.result!=="success"){const h=c.value.map(f=>`${f.key}: ${f.message}`).join(", ");return void ht(`Failed to create expression for promoteId: ${h}`)}this.promoteIdExpression=c.value}o=this.promoteIdExpression.evaluate({zoom:0},e)}else o=e.properties[a];typeof o=="boolean"&&(o=Number(o))}return o}}function x1(r,e,i,o,a){return Ye(r,(c,h)=>{const f=e instanceof Xo?e.get(h):null;return f&&f.evaluate?f.evaluate(i,o,void 0,a):f})}function tT(r,e){return e-r}function iT(r,e){const i={};let o;for(;o=r.nextField(e);)o===1?(i.delta_filter=rT(r,r.readVarint()+r.pos),i.filter="delta_filter"):o===2?(r.readVarint(),i.filter="zigzag_filter"):o===3?(r.readVarint(),i.filter="bitshuffle_filter"):o===4&&(r.readVarint(),i.filter="byteshuffle_filter");return i}function rT(r,e){const i={blockSize:0};let o;for(;o=r.nextField(e);)o===1&&(i.blockSize=r.readVarint());return i}function nT(r,e){const i={};let o;for(;o=r.nextField(e);)o===1?(r.readVarint(),i.codec="gzip_data"):o===2?(r.readVarint(),i.codec="jpeg_image"):o===3?(r.readVarint(),i.codec="webp_image"):o===4&&(r.readVarint(),i.codec="png_image");return i}function oT(r,e){const i={firstByte:0,lastByte:0,filters:[],codec:null,offset:0,scale:0,bands:[]};let o,a=0,c=0;for(;o=r.nextField(e);)o===1?i.firstByte=r.readFixed64():o===2?i.lastByte=r.readFixed64():o===3?i.filters.push(iT(r,r.readVarint()+r.pos)):o===4?i.codec=nT(r,r.readVarint()+r.pos):o===5?c=r.readFloat():o===6?a=r.readFloat():o===7?i.bands.push(r.readString()):o===8?i.offset=r.readDouble():o===9&&(i.scale=r.readDouble());return i.offset===0&&(i.offset=c),i.scale===0&&(i.scale=a),i}function sT(r,e){const i={version:0,name:"",units:"",tileSize:0,buffer:0,pixelFormat:0,dataIndex:[]};let o;for(;o=r.nextField(e);)o===1?i.version=r.readVarint():o===2?i.name=r.readString():o===3?i.units=r.readString():o===4?i.tileSize=r.readVarint():o===5?i.buffer=r.readVarint():o===6?i.pixelFormat=r.readVarint():o===7&&i.dataIndex.push(oT(r,r.readVarint()+r.pos));return i}function aT(r,e,i){let o;for(;o=r.nextField(e);)if(o===1){let a=0;const c=r.readVarint()+r.pos;for(;r.pos<c;)i[a++]=r.readVarint()}return i}function lT(r,e){if(e.length!==4)throw new Error(`Expected data of dimension 4 but got ${e.length}.`);let i=e[3];for(let o=2;o>=1;o--){const a=o===1?1:0,c=o===2?1:0;for(let h=0;h<e[0];h++){const f=e[1]*h;for(let _=a;_<e[1];_++){const y=e[2]*(_+f);for(let v=c;v<e[2];v++){const b=e[3]*(v+y);for(let T=0;T<e[3];T++){const S=b+T;r[S]+=r[S-i]}}}}i*=e[o]}return r}function cT(r){for(let e=0,i=r.length;e<i;e++)r[e]=r[e]>>>1^-(1&r[e]);return r}function uT(r,e){switch(e){case"uint32":return r;case"uint16":for(let i=0;i<r.length;i+=2){const o=r[i],a=r[i+1];r[i]=(240&o)>>4|(61440&o)>>8|(240&a)<<4|61440&a,r[i+1]=15&o|(3840&o)>>4|(15&a)<<8|(3840&a)<<4}return r;case"uint8":for(let i=0;i<r.length;i+=4){const o=r[i],a=r[i+1],c=r[i+2],h=r[i+3];r[i+0]=(192&o)>>6|(192&a)>>4|(192&c)>>2|192&h,r[i+1]=(48&o)>>4|(48&a)>>2|48&c|(48&h)<<2,r[i+2]=(12&o)>>2|12&a|(12&c)<<2|(12&h)<<4,r[i+3]=3&o|(3&a)<<2|(3&c)<<4|(3&h)<<6}return r;default:throw new Error(`Invalid pixel format, "${e}"`)}}Je(y1,"FeatureIndex",{omit:["rawTileData","sourceLayerCoder"]});var Fo=Uint8Array,Cp=Uint16Array,hT=Int32Array,v1=new Fo([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]),b1=new Fo([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]),dT=new Fo([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),w1=function(r,e){for(var i=new Cp(31),o=0;o<31;++o)i[o]=e+=1<<r[o-1];var a=new hT(i[30]);for(o=1;o<30;++o)for(var c=i[o];c<i[o+1];++c)a[c]=c-i[o]<<5|o;return{b:i,r:a}},T1=w1(v1,2),E1=T1.b,fT=T1.r;E1[28]=258,fT[258]=28;for(var pT=w1(b1,0).b,S1=new Cp(32768),xr=0;xr<32768;++xr){var Qh=(43690&xr)>>1|(21845&xr)<<1;S1[xr]=((65280&(Qh=(61680&(Qh=(52428&Qh)>>2|(13107&Qh)<<2))>>4|(3855&Qh)<<4))>>8|(255&Qh)<<8)>>1}var Mp=function(r,e,i){for(var o=r.length,a=0,c=new Cp(e);a<o;++a)r[a]&&++c[r[a]-1];var h,f=new Cp(e);for(a=1;a<e;++a)f[a]=f[a-1]+c[a-1]<<1;h=new Cp(1<<e);var _=15-e;for(a=0;a<o;++a)if(r[a])for(var y=a<<4|r[a],v=e-r[a],b=f[r[a]-1]++<<v,T=b|(1<<v)-1;b<=T;++b)h[S1[b]>>_]=y;return h},Pp=new Fo(288);for(xr=0;xr<144;++xr)Pp[xr]=8;for(xr=144;xr<256;++xr)Pp[xr]=9;for(xr=256;xr<280;++xr)Pp[xr]=7;for(xr=280;xr<288;++xr)Pp[xr]=8;var I1=new Fo(32);for(xr=0;xr<32;++xr)I1[xr]=5;var mT=Mp(Pp,9),_T=Mp(I1,5),bx=function(r){for(var e=r[0],i=1;i<r.length;++i)r[i]>e&&(e=r[i]);return e},Ms=function(r,e,i){var o=e/8|0;return(r[o]|r[o+1]<<8)>>(7&e)&i},wx=function(r,e){var i=e/8|0;return(r[i]|r[i+1]<<8|r[i+2]<<16)>>(7&e)},gT=function(r){return(r+7)/8|0},yT=["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"],Ps=function(r,e,i){var o=new Error(e||yT[r]);if(o.code=r,Error.captureStackTrace&&Error.captureStackTrace(o,Ps),!i)throw o;return o},xT=new Fo(0),vT=typeof TextDecoder<"u"&&new TextDecoder;try{vT.decode(xT,{stream:!0})}catch{}const bT={gzip_data:"gzip"};class es extends Error{constructor(e){super(e),this.name="MRTError"}}const wT={0:"uint32",1:"uint32",2:"uint16",3:"uint8"},A1={uint32:1,uint16:2,uint8:4},TT={uint32:Uint32Array,uint16:Uint16Array,uint8:Uint8Array};let Tx;class _g{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 es(`Layer '${e}' not found`);return i}getHeaderLength(e){const i=new Uint8Array(e),o=new DataView(e);if(i[0]!==13)throw new es("File is not a valid MRT.");return o.getUint32(1,!0)}parseHeader(e){const i=new Uint8Array(e),o=this.getHeaderLength(e);if(i.length<o)throw new es(`Expected header with length >= ${o} but got buffer of length ${i.length}`);const a=(function(c){const h={headerLength:0,x:0,y:0,z:0,layers:[]};let f;for(;f=c.nextField(void 0);)f===1?h.headerLength=c.readFixed32():f===2?h.x=c.readVarint():f===3?h.y=c.readVarint():f===4?h.z=c.readVarint():f===5&&h.layers.push(sT(c,c.readVarint()+c.pos));return h})(new Tx(i.subarray(0,o)));if(!isNaN(this.x)&&(this.x!==a.x||this.y!==a.y||this.z!==a.z))throw new es(`Invalid attempt to parse header ${a.z}/${a.x}/${a.y} for tile ${this.z}/${this.x}/${this.y}`);this.x=a.x,this.y=a.y,this.z=a.z;for(const c of a.layers)this.layers[c.name]=new C1(c,{cacheSize:this._cacheSize});return this}createDecodingTask(e){const i=[],o=this.getLayer(e.layerName);for(let a of e.blockIndices){const c=o.dataIndex[a],h=c.firstByte-e.firstByte,f=c.lastByte-e.firstByte;if(o._blocksInProgress.has(a))continue;const _={layerName:o.name,firstByte:h,lastByte:f,pixelFormat:o.pixelFormat,blockIndex:a,blockShape:[c.bands.length].concat(o.bandShape),buffer:o.buffer,codec:c.codec.codec,filters:c.filters.map(y=>y.filter)};o._blocksInProgress.add(a),i.push(_)}return new M1(i,()=>{i.forEach(a=>o._blocksInProgress.delete(a.blockIndex))},(a,c)=>{if(i.forEach(h=>o._blocksInProgress.delete(h.blockIndex)),a)throw a;c.forEach(h=>{this.getLayer(h.layerName).processDecodedData(h)})})}}class C1{constructor({version:e,name:i,units:o,tileSize:a,pixelFormat:c,buffer:h,dataIndex:f},_){if(this.version=e,this.version!==1)throw new es(`Cannot parse raster layer encoded with MRT version ${e}`);this.name=i,this.units=o,this.tileSize=a,this.buffer=h,this.pixelFormat=wT[c],this.dataIndex=f,this.bandShape=[a+2*h,a+2*h,A1[this.pixelFormat]],this._decodedBlocks=new vx(_?_.cacheSize:5),this._blocksInProgress=new Set}get dimension(){return A1[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[o,a]of this.dataIndex.entries()){for(const[c,h]of a.bands.entries())if(h===e)return{bandIndex:i+c,blockIndex:o,blockBandIndex:c};i+=a.bands.length}break;case"number":for(const[o,a]of this.dataIndex.entries()){if(e>=i&&e<i+a.bands.length)return{bandIndex:e,blockIndex:o,blockBandIndex:e-i};i+=a.bands.length}break;default:throw new es(`Invalid band \`${JSON.stringify(e)}\`. Expected string or integer.`)}return{blockIndex:-1,blockBandIndex:-1}}getDataRange(e){let i=1/0,o=-1/0;const a=[],c=new Set;for(const h of e){const{blockIndex:f}=this.getBlockForBand(h);if(f<0)throw new es(`Invalid band: ${JSON.stringify(h)}`);const _=this.dataIndex[f];a.includes(f)||a.push(f),c.add(f),i=Math.min(i,_.firstByte),o=Math.max(o,_.lastByte)}if(c.size>this.cacheSize)throw new es(`Number of blocks to decode (${c.size}) exceeds cache size (${this.cacheSize}).`);return{layerName:this.name,firstByte:i,lastByte:o,blockIndices:a}}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:o}=this.getBlockForBand(e);if(i<0)throw new es(`Band not found: ${JSON.stringify(e)}`);const a=this._decodedBlocks.get(i.toString());if(!a)throw new es(`Data for band ${JSON.stringify(e)} of layer "${this.name}" not decoded.`);const c=this.dataIndex[i],h=this.bandShape.reduce((y,v)=>y*v,1),f=o*h,_=a.subarray(f,f+h);return{data:_,bytes:new Uint8Array(_.buffer).subarray(_.byteOffset,_.byteOffset+_.byteLength),tileSize:this.tileSize,buffer:this.buffer,pixelFormat:this.pixelFormat,dimension:this.dimension,offset:c.offset,scale:c.scale}}}_g.setPbf=function(r){Tx=r};class M1{constructor(e,i,o){this.tasks=e,this._onCancel=i,this._onComplete=o,this._finalized=!1}cancel(){this._finalized||(this._onCancel(),this._finalized=!0)}complete(e,i){this._finalized||(this._onComplete(e,i),this._finalized=!0)}}function P1(r,e,i){try{e=(function(a){if(!a.variants)return a;if(!Array.isArray(a.variants))throw new Error("variants must be an array");for(const c of a.variants){if(c==null||typeof c!="object"||c.constructor!==Object)throw new Error("variant must be an object");if(!Array.isArray(c.capabilities))throw new Error("capabilities must be an array");if(c.capabilities.length===1&&c.capabilities[0]==="meshopt")return Object.assign(a,c)}return a})(e)}catch(a){return new Error("Failed to process TileJSON variants",{cause:a})}const o=K({...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&&(o.tiles=e.tiles),o.tiles=i.canonicalizeTileset(o,r.url),o}_g.performDecoding=function(r,e){const i=new Uint8Array(r);return Promise.all(e.tasks.map(o=>{const{layerName:a,firstByte:c,lastByte:h,pixelFormat:f,blockShape:_,blockIndex:y,filters:v,codec:b}=o,T=i.subarray(c,h+1),S=new Uint32Array(_[0]*_[1]*_[2]);let C;if(b!=="gzip_data")throw new es(`Unhandled codec: ${b}`);return C=(function(P,R){if(!globalThis.DecompressionStream&&R==="gzip_data")return Promise.resolve((H=(function(X){X[0]==31&&X[1]==139&&X[2]==8||Ps(6,"invalid gzip data");var ee=X[3],ie=10;4&ee&&(ie+=2+(X[10]|X[11]<<8));for(var ne=(ee>>3&1)+(ee>>4&1);ne>0;ne-=!X[ie++]);return ie+(2&ee)})(L=P),H+8>L.length&&Ps(6,"invalid gzip data"),(function(X,ee,ie,ne){var fe=X.length;if(!fe||ee.f&&!ee.l)return ie||new Fo(0);var ge=!ie,we=ge||ee.i!=2,Se=ee.i;ge&&(ie=new Fo(3*fe));var Ee=function(ji){var yi=ie.length;if(ji>yi){var Lr=new Fo(Math.max(2*yi,ji));Lr.set(ie),ie=Lr}},Ve=ee.f||0,Ie=ee.p||0,Te=ee.b||0,Ce=ee.l,ze=ee.d,Fe=ee.m,Be=ee.n,De=8*fe;do{if(!Ce){Ve=Ms(X,Ie,1);var Ge=Ms(X,Ie+1,3);if(Ie+=3,!Ge){var Ze=X[(Nt=gT(Ie)+4)-4]|X[Nt-3]<<8,Qe=Nt+Ze;if(Qe>fe){Se&&Ps(0);break}we&&Ee(Te+Ze),ie.set(X.subarray(Nt,Qe),Te),ee.b=Te+=Ze,ee.p=Ie=8*Qe,ee.f=Ve;continue}if(Ge==1)Ce=mT,ze=_T,Fe=9,Be=5;else if(Ge==2){var Xe=Ms(X,Ie,31)+257,rt=Ms(X,Ie+10,15)+4,vt=Xe+Ms(X,Ie+5,31)+1;Ie+=14;for(var ft=new Fo(vt),xt=new Fo(19),mt=0;mt<rt;++mt)xt[dT[mt]]=Ms(X,Ie+3*mt,7);Ie+=3*rt;var Rt=bx(xt),ut=(1<<Rt)-1,Gt=Mp(xt,Rt);for(mt=0;mt<vt;){var Nt,Wt=Gt[Ms(X,Ie,ut)];if(Ie+=15&Wt,(Nt=Wt>>4)<16)ft[mt++]=Nt;else{var qt=0,Pi=0;for(Nt==16?(Pi=3+Ms(X,Ie,3),Ie+=2,qt=ft[mt-1]):Nt==17?(Pi=3+Ms(X,Ie,7),Ie+=3):Nt==18&&(Pi=11+Ms(X,Ie,127),Ie+=7);Pi--;)ft[mt++]=qt}}var Dr=ft.subarray(0,Xe),ai=ft.subarray(Xe);Fe=bx(Dr),Be=bx(ai),Ce=Mp(Dr,Fe),ze=Mp(ai,Be)}else Ps(1);if(Ie>De){Se&&Ps(0);break}}we&&Ee(Te+131072);for(var hi=(1<<Fe)-1,Ji=(1<<Be)-1,vr=Ie;;vr=Ie){var Vi=(qt=Ce[wx(X,Ie)&hi])>>4;if((Ie+=15&qt)>De){Se&&Ps(0);break}if(qt||Ps(2),Vi<256)ie[Te++]=Vi;else{if(Vi==256){vr=Ie,Ce=null;break}var It=Vi-254;Vi>264&&(It=Ms(X,Ie,(1<<(wr=v1[mt=Vi-257]))-1)+E1[mt],Ie+=wr);var zr=ze[wx(X,Ie)&Ji],br=zr>>4;if(zr||Ps(3),Ie+=15&zr,ai=pT[br],br>3){var wr=b1[br];ai+=wx(X,Ie)&(1<<wr)-1,Ie+=wr}if(Ie>De){Se&&Ps(0);break}we&&Ee(Te+131072);var Wi=Te+It;if(Te<ai){var Qi=0-ai,mr=Math.min(ai,Wi);for(Qi+Te<0&&Ps(3);Te<mr;++Te)ie[Te]=ne[Qi+Te]}for(;Te<Wi;++Te)ie[Te]=ie[Te-ai]}}ee.l=Ce,ee.p=vr,ee.b=Te,ee.f=Ve,Ce&&(Ve=1,ee.m=Fe,ee.d=ze,ee.n=Be)}while(!Ve);return Te!=ie.length&&ge?(function(ji,yi,Lr){return(Lr==null||Lr>ji.length)&&(Lr=ji.length),new Fo(ji.subarray(0,Lr))})(ie,0,Te):ie.subarray(0,Te)})(L.subarray(H,-8),{i:2},new Fo(((B=L)[(G=B.length)-4]|B[G-3]<<8|B[G-2]<<16|B[G-1]<<24)>>>0),V)));var L,V,B,G,H;const Z=bT[R];if(!Z)throw new Error(`Unhandled codec: ${R}`);const oe=new globalThis.DecompressionStream(Z);return new Response(new Blob([P]).stream().pipeThrough(oe)).arrayBuffer().then(X=>new Uint8Array(X))})(T,b).then(P=>((function(R,L){let V;for(;V=R.nextField();)if(V===2)aT(R,R.readVarint()+R.pos,L);else if(V===3)throw new Error("Not implemented")})(new Tx(P),S),new TT[f](S.buffer))),C.then(P=>{for(let R=v.length-1;R>=0;R--)switch(v[R]){case"delta_filter":lT(P,_);break;case"zigzag_filter":cT(P);break;case"bitshuffle_filter":uT(P,f);break;default:throw new es(`Unhandled filter "${v[R]}"`)}return{layerName:a,blockIndex:y,data:P}}).catch(P=>{throw P})}))},Je(M1,"MRTDecodingBatch",{omit:["_onCancel","_onComplete"]}),Je(_g,"MapboxRasterTile"),Je(C1,"MapboxRasterLayer",{omit:["_blocksInProgress"]});const Ex=new Map,R1=new Map;class D1{constructor(e){this.size=e,this.minimums=[],this.maximums=[],this.leaves=[]}getElevation(e,i){const o=this.toIdx(e,i);return{min:this.minimums[o],max:this.maximums[o]}}isLeaf(e,i){return this.leaves[this.toIdx(e,i)]}toIdx(e,i){return i*this.size+e}}function z1(r,e,i,o){let a=0,c=Number.MAX_VALUE;for(let h=0;h<3;h++)if(Math.abs(o[h])<1e-15){if(i[h]<r[h]||i[h]>e[h])return null}else{const f=1/o[h];let _=(r[h]-i[h])*f,y=(e[h]-i[h])*f;if(_>y){const v=_;_=y,y=v}if(_>a&&(a=_),y<c&&(c=y),a>c)return null}return a}function L1(r,e,i,o,a,c,h,f,_,y,v){const b=o-r,T=a-e,S=c-i,C=h-r,P=f-e,R=_-i,L=v[1]*R-v[2]*P,V=v[2]*C-v[0]*R,B=v[0]*P-v[1]*C,G=b*L+T*V+S*B;if(Math.abs(G)<1e-15)return null;const H=1/G,Z=y[0]-r,oe=y[1]-e,X=y[2]-i,ee=(Z*L+oe*V+X*B)*H;if(ee<0||ee>1)return null;const ie=oe*S-X*T,ne=X*b-Z*S,fe=Z*T-oe*b,ge=(v[0]*ie+v[1]*ne+v[2]*fe)*H;return ge<0||ee+ge>1?null:(C*ie+P*ne+R*fe)*H}function F1(r,e,i,o,a,c,h,f,_){const y=1<<i,v=c-o,b=h-a,T=(r+1)/y*v+o,S=(e+0)/y*b+a,C=(e+1)/y*b+a;f[0]=(r+0)/y*v+o,f[1]=S,_[0]=T,_[1]=C}class O1{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(c){const h=c.dim,f=Math.ceil(Math.log2(h/8)),_=[];let y=Math.ceil(Math.pow(2,f));const v=(R,L,V,B,G)=>{const H=B?1:0,Z=(R+1)*V-H,oe=L*V,X=(L+1)*V-H;G[0]=R*V,G[1]=oe,G[2]=Z,G[3]=X};let b=new D1(y);const T=1/y,{floatView:S,stride:C}=c,P=[];for(let R=0;R<y*y;R++){const L=Math.floor(R/y),V=R%y;v(V,L,T,!1,P);const B=nc(P[0],P[1],c),G=nc(P[2],P[1],c),H=nc(P[2],P[3],c),Z=nc(P[0],P[3],c),oe=Math.min(B,G,H,Z),X=Math.max(0,8*V-1),ee=Math.min(h-1,8*(V+1)),ie=Math.max(0,8*L-1),ne=Math.min(h-1,8*(L+1));let fe=-1/0;for(let ge=ie;ge<=ne;ge++){const we=(ge+1)*C;for(let Se=X;Se<=ee;Se++){const Ee=S[we+Se+1];Ee>fe&&(fe=Ee)}}b.minimums.push(oe),b.maximums.push(fe),b.leaves.push(1)}for(_.push(b),y/=2;y>=1;y/=2){const R=_.at(-1);b=new D1(y);for(let L=0;L<y*y;L++){v(L%y,Math.floor(L/y),2,!0,P);const V=R.getElevation(P[0],P[1]),B=R.getElevation(P[2],P[1]),G=R.getElevation(P[2],P[3]),H=R.getElevation(P[0],P[3]),Z=R.isLeaf(P[0],P[1]),oe=R.isLeaf(P[2],P[1]),X=R.isLeaf(P[2],P[3]),ee=R.isLeaf(P[0],P[3]),ie=Math.min(V.min,B.min,G.min,H.min),ne=Math.max(V.max,B.max,G.max,H.max),fe=Z&&oe&&X&&ee;b.maximums.push(ne),b.minimums.push(ie),b.leaves.push(ne-ie<=5&&fe?1:0)}_.push(b)}return _})(this.dem),o=i.length-1,a=i[o];this._addNode(a.minimums[0],a.maximums[0],a.leaves[0]),this._construct(i,0,0,o,0)}raycastRoot(e,i,o,a,c,h,f=1){return z1([e,i,-100],[o,a,this.maximums[0]*f],c,h)}raycast(e,i,o,a,c,h,f=1){if(!this.nodeCount)return null;const _=this.raycastRoot(e,i,o,a,c,h,f);if(_==null)return null;const y=[],v=[],b=[],T=[],S=[{idx:0,t:_,nodex:0,nodey:0,depth:0}];for(;S.length>0;){const{idx:C,t:P,nodex:R,nodey:L,depth:V}=S.pop();if(this.leaves[C]){F1(R,L,V,e,i,o,a,b,T);const G=1<<V,H=R/G,Z=(R+1)/G,oe=L/G,X=(L+1)/G,{dim:ee,floatView:ie,stride:ne}=this.dem,fe=Math.floor(H*ee),ge=Math.ceil(Z*ee),we=Math.floor(oe*ee),Se=ge-fe,Ee=Math.ceil(X*ee)-we;if(Se<=0||Ee<=0)continue;const Ve=b[0],Ie=b[1],Te=(T[0]-Ve)/Se,Ce=(T[1]-Ie)/Ee,ze=Math.max(0,P),Fe=c[0]+h[0]*ze,Be=c[1]+h[1]*ze,De=Math.abs(h[0])>1e-10,Ge=Math.abs(h[1])>1e-10,Ze=h[0]>=0?1:-1,Qe=h[1]>=0?1:-1;let Xe=Math.max(0,Math.min(Se-1,Math.floor((Fe-Ve)/Te))),rt=Math.max(0,Math.min(Ee-1,Math.floor((Be-Ie)/Ce)));const vt=De?Math.abs(Te/h[0]):Number.MAX_VALUE,ft=Ge?Math.abs(Ce/h[1]):Number.MAX_VALUE;let xt=De?ze+(Ve+(h[0]>=0?Xe+1:Xe)*Te-Fe)/h[0]:Number.MAX_VALUE,mt=Ge?ze+(Ie+(h[1]>=0?rt+1:rt)*Ce-Be)/h[1]:Number.MAX_VALUE;const Rt=(Vi,It)=>ie[(It+1)*ne+Vi+1]*f;let ut=Rt(fe+Xe,we+rt),Gt=Rt(fe+Xe+1,we+rt),Nt=Rt(fe+Xe,we+rt+1),Wt=Rt(fe+Xe+1,we+rt+1),qt=null;for(let Vi=0;Vi<Se+Ee;Vi++){const It=Math.min(xt,mt);if(h[2]>=0||c[2]+h[2]*It<=Math.max(ut,Gt,Nt,Wt)){const br=Ve+Xe*Te,wr=br+Te,Wi=Ie+rt*Ce,Qi=Wi+Ce,mr=L1(wr,Wi,Gt,br,Wi,ut,br,Qi,Nt,c,h),ji=L1(br,Qi,Nt,wr,Qi,Wt,wr,Wi,Gt,c,h);mr!=null&&mr>=0&&(qt===null||mr<qt)&&(qt=mr),ji!=null&&ji>=0&&(qt===null||ji<qt)&&(qt=ji)}const zr=xt<mt;if(zr?(Xe+=Ze,xt+=vt):(rt+=Qe,mt+=ft),Xe<0||Xe>=Se||rt<0||rt>=Ee||qt!==null&&It>qt)break;zr?Ze>0?(ut=Gt,Nt=Wt,Gt=Rt(fe+Xe+1,we+rt),Wt=Rt(fe+Xe+1,we+rt+1)):(Gt=ut,Wt=Nt,ut=Rt(fe+Xe,we+rt),Nt=Rt(fe+Xe,we+rt+1)):Qe>0?(ut=Nt,Gt=Wt,Nt=Rt(fe+Xe,we+rt+1),Wt=Rt(fe+Xe+1,we+rt+1)):(Nt=ut,Wt=Gt,ut=Rt(fe+Xe,we+rt),Gt=Rt(fe+Xe+1,we+rt))}if(qt!==null)return qt||0;const Pi=rn([],c,h,P),Dr=(Pi[0]-b[0])/(T[0]-b[0]),ai=(Pi[1]-b[1])/(T[1]-b[1]),hi=nc(H,oe,this.dem)*f,Ji=nc(Z,oe,this.dem)*f,vr=nc(Z,X,this.dem)*f;if(B1(hi,Ji,nc(H,X,this.dem)*f,vr,Dr,ai)>=Pi[2])return P;continue}let B=0;for(let G=0;G<this._siblingOffset.length;G++){F1((R<<1)+this._siblingOffset[G][0],(L<<1)+this._siblingOffset[G][1],V+1,e,i,o,a,b,T),b[2]=-100,T[2]=this.maximums[this.childOffsets[C]+G]*f;const H=z1(b,T,c,h);if(H!=null){const Z=H;y[G]=Z;let oe=!1;for(let X=0;X<B&&!oe;X++)Z>=y[v[X]]&&(v.splice(X,0,G),oe=!0);oe||(v[B]=G),B++}}for(let G=0;G<B;G++){const H=v[G];S.push({idx:this.childOffsets[C]+H,t:y[H],nodex:(R<<1)+this._siblingOffset[H][0],nodey:(L<<1)+this._siblingOffset[H][1],depth:V+1})}}return null}_addNode(e,i,o){return this.minimums.push(e),this.maximums.push(i),this.leaves.push(o),this.childOffsets.push(0),this.nodeCount++}_construct(e,i,o,a,c){if(e[a].isLeaf(i,o)===1)return;this.childOffsets[c]||(this.childOffsets[c]=this.nodeCount);const h=a-1,f=e[h];let _=0,y=0;for(let v=0;v<this._siblingOffset.length;v++){const b=2*i+this._siblingOffset[v][0],T=2*o+this._siblingOffset[v][1],S=f.getElevation(b,T),C=f.isLeaf(b,T),P=this._addNode(S.min,S.max,C);C&&(_|=1<<v),y||(y=P)}for(let v=0;v<this._siblingOffset.length;v++)_&1<<v||this._construct(e,2*i+this._siblingOffset[v][0],2*o+this._siblingOffset[v][1],h,y+v)}}function B1(r,e,i,o,a,c){return yt(yt(r,i,c),yt(e,o,c),a)}function nc(r,e,i){const o=i.dim,a=te(r*o-.5,0,o-1),c=te(e*o-.5,0,o-1),h=Math.floor(a),f=Math.floor(c),_=Math.min(h+1,o-1),y=Math.min(f+1,o-1);return B1(i.get(h,f),i.get(_,f),i.get(h,y),i.get(_,y),a-h,c-f)}const ET={mapbox:[6553.6,25.6,.1,1e4],terrarium:[256,1,1/256,32768]};function ST(r,e,i){return(256*r*256+256*e+i)/10-1e4}function IT(r,e,i){return 256*r+e+i/256-32768}class gg{get tree(){return this._tree||this._buildQuadTree(),this._tree}constructor(e,i,o,a=!1){if(this.uid=e,i.height!==i.width)throw new RangeError("DEM tiles must be square");if(o&&o!=="mapbox"&&o!=="terrarium")return void ht(`"${o}" is not a valid encoding type. Valid types include "mapbox" and "terrarium".`);this.stride=i.height;const c=this.dim=i.height-2,h=new Uint32Array(i.data.buffer);if(this.pixels=new Uint8Array(i.data.buffer),this.floatView=new Float32Array(i.data.buffer),this.borderReady=a,this._modifiedForSources={},!a){for(let _=0;_<c;_++)h[this._idx(-1,_)]=h[this._idx(0,_)],h[this._idx(c,_)]=h[this._idx(c-1,_)],h[this._idx(_,-1)]=h[this._idx(_,0)],h[this._idx(_,c)]=h[this._idx(_,c-1)];h[this._idx(-1,-1)]=h[this._idx(0,0)],h[this._idx(c,-1)]=h[this._idx(c-1,0)],h[this._idx(-1,c)]=h[this._idx(0,c-1)],h[this._idx(c,c)]=h[this._idx(c-1,c-1)]}const f=o==="terrarium"?IT:ST;for(let _=0;_<h.length;++_){const y=4*_;this.floatView[_]=f(this.pixels[y],this.pixels[y+1],this.pixels[y+2])}this._timestamp=Ki.now()}_buildQuadTree(){this._tree=new O1(this)}get(e,i,o=!1){o&&(e=te(e,-1,this.dim),i=te(i,-1,this.dim));const a=this._idx(e,i);return this.floatView[a]}set(e,i,o){const a=this._idx(e,i),c=this.floatView[a];return this.floatView[a]=o,o-c}static getUnpackVector(e){return ET[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 o=[0,0,0,0],a=gg.getUnpackVector(i);let c=Math.floor((e+a[3])/a[2]);return o[2]=c%256,c=Math.floor(c/256),o[1]=c%256,c=Math.floor(c/256),o[0]=c,o}getPixels(){return new d_({width:this.stride,height:this.stride},this.pixels)}backfillBorder(e,i,o){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let a=i*this.dim,c=i*this.dim+this.dim,h=o*this.dim,f=o*this.dim+this.dim;switch(i){case-1:a=c-1;break;case 1:c=a+1}switch(o){case-1:h=f-1;break;case 1:f=h+1}const _=-i*this.dim,y=-o*this.dim;for(let v=h;v<f;v++)for(let b=a;b<c;b++){const T=4*this._idx(b,v),S=4*this._idx(b+_,v+y);this.pixels[T+0]=e.pixels[S+0],this.pixels[T+1]=e.pixels[S+1],this.pixels[T+2]=e.pixels[S+2],this.pixels[T+3]=e.pixels[S+3]}}onDeserialize(){this._tree&&(this._tree.dem=this)}}Je(gg,"DEMData"),Je(O1,"DemMinMaxQuadTree",{omit:["dem"]});const k1=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],Sr=new Uint32Array(96);class Sx{static from(e){if(!e||e.byteLength===void 0||e.buffer)throw new Error("Data must be an instance of ArrayBuffer or SharedArrayBuffer.");const[i,o]=new Uint8Array(e,0,2);if(i!==219)throw new Error("Data does not appear to be in a KDBush format.");const a=o>>4;if(a!==1)throw new Error(`Got v${a} data when expected v1.`);const c=k1[15&o];if(!c)throw new Error("Unrecognized array type.");const[h]=new Uint16Array(e,2,1),[f]=new Uint32Array(e,4,1);return new Sx(f,h,c,void 0,e)}constructor(e,i=64,o=Float64Array,a=ArrayBuffer,c){if(isNaN(e)||e<0)throw new Error(`Unexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+i,2),65535),this.ArrayType=o,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;const h=k1.indexOf(this.ArrayType),f=2*e*this.ArrayType.BYTES_PER_ELEMENT,_=e*this.IndexArrayType.BYTES_PER_ELEMENT,y=(8-_%8)%8;if(h<0)throw new Error(`Unexpected typed array class: ${o}.`);if(c)this.data=c,this.ids=new this.IndexArrayType(c,8,e),this.coords=new o(c,8+_+y,2*e),this._pos=2*e,this._finished=!0;else{const v=this.data=new a(8+f+_+y);this.ids=new this.IndexArrayType(v,8,e),this.coords=new o(v,8+_+y,2*e),this._pos=0,this._finished=!1,new Uint8Array(v,0,2).set([219,16+h]),new Uint16Array(v,2,1)[0]=i,new Uint32Array(v,4,1)[0]=e}}add(e,i){const o=this._pos>>1;return this.ids[o]=o,this.coords[this._pos++]=e,this.coords[this._pos++]=i,o}finish(){const e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return Ix(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,i,o,a){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:c,coords:h,nodeSize:f}=this;Sr[0]=0,Sr[1]=c.length-1,Sr[2]=0;let _=3;const y=[];for(;_>0;){const v=Sr[--_],b=Sr[--_],T=Sr[--_];if(b-T<=f){for(let R=T;R<=b;R++){const L=h[2*R],V=h[2*R+1];L>=e&&L<=o&&V>=i&&V<=a&&y.push(c[R])}continue}const S=T+b>>1,C=h[2*S],P=h[2*S+1];C>=e&&C<=o&&P>=i&&P<=a&&y.push(c[S]),(v===0?e<=C:i<=P)&&(Sr[_++]=T,Sr[_++]=S-1,Sr[_++]=1-v),(v===0?o>=C:a>=P)&&(Sr[_++]=S+1,Sr[_++]=b,Sr[_++]=1-v)}return y}within(e,i,o){const a=[];return this.withinInto(e,i,o,a),a}withinInto(e,i,o,a){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:c,coords:h,nodeSize:f}=this;Sr[0]=0,Sr[1]=c.length-1,Sr[2]=0;let _=3,y=0;const v=o*o;for(;_>0;){const b=Sr[--_],T=Sr[--_],S=Sr[--_];if(T-S<=f){for(let L=S;L<=T;L++)V1(h[2*L],h[2*L+1],e,i)<=v&&(a[y++]=c[L]);continue}const C=S+T>>1,P=h[2*C],R=h[2*C+1];V1(P,R,e,i)<=v&&(a[y++]=c[C]),(b===0?e-o<=P:i-o<=R)&&(Sr[_++]=S,Sr[_++]=C-1,Sr[_++]=1-b),(b===0?e+o>=P:i+o>=R)&&(Sr[_++]=C+1,Sr[_++]=T,Sr[_++]=1-b)}return y}}function Ix(r,e,i,o,a,c){if(a-o<=i)return;const h=o+a>>1;N1(r,e,h,o,a,c),Ix(r,e,i,o,h-1,1-c),Ix(r,e,i,h+1,a,1-c)}function N1(r,e,i,o,a,c){for(;a>o;){if(a-o>600){const y=a-o+1,v=i-o+1,b=Math.log(y),T=.5*Math.exp(2*b/3),S=.5*Math.sqrt(b*T*(y-T)/y)*(v-y/2<0?-1:1);N1(r,e,i,Math.max(o,Math.floor(i-v*T/y+S)),Math.min(a,Math.floor(i+(y-v)*T/y+S)),c)}const h=e[2*i+c];let f=o,_=a;for(Rp(r,e,o,i),e[2*a+c]>h&&Rp(r,e,o,a);f<_;){for(Rp(r,e,f,_),f++,_--;e[2*f+c]<h;)f++;for(;e[2*_+c]>h;)_--}e[2*o+c]===h?Rp(r,e,o,_):(_++,Rp(r,e,_,a)),_<=i&&(o=_+1),i<=_&&(a=_-1)}}function Rp(r,e,i,o){Ax(r,i,o),Ax(e,2*i,2*o),Ax(e,2*i+1,2*o+1)}function Ax(r,e,i){const o=r[e];r[e]=r[i],r[i]=o}function V1(r,e,i,o){const a=r-i,c=e-o;return a*a+c*c}N.$=Kp,N.A=hd,N.B=Un,N.C=$t,N.D=Vr,N.E=wa,N.F=2,N.G=fi,N.H=bt,N.I=In,N.J=gd,N.K=Mm,N.L=vx,N.M=_d,N.N=Pu,N.O=Zo,N.P=Ne,N.Q=Ju,N.R=va,N.S=jd,N.T=Ht,N.U=ih,N.V=kc,N.W=bm,N.X=Zs,N.Y=$s,N.Z=Ca,N._=Xr,N.a=function(r){return ii.API_CDN_URL_REGEX.test(r)},N.a$=Me,N.a0=yd,N.a1=Nc,N.a2=/^(.*)-use-theme$/,N.a3=/^(.*)-transition$/,N.a4=Qu,N.a5=Ud,N.a6=Lc,N.a7=Li,N.a8=He,N.a9=class{constructor(r){this.specification=r}possiblyEvaluate(r,e){return di(r.expression.evaluate(e))}interpolate(r,e,i){return{x:yt(r.x,e.x,i),y:yt(r.y,e.y,i),z:yt(r.z,e.z,i),azimuthal:yt(r.azimuthal,e.azimuthal,i),polar:yt(r.polar,e.polar,i)}}},N.aA=function(r,e,i){i*=.5;var o=e[0],a=e[1],c=e[2],h=e[3],f=Math.sin(i),_=Math.cos(i);return r[0]=o*_+a*f,r[1]=a*_-o*f,r[2]=c*_+h*f,r[3]=h*_-c*f,r},N.aB=lc,N.aC=ki,N.aD=sr,N.aE=bo,N.aF=fa,N.aG=wn,N.aH=function(r,e){return r[0]=-e[0],r[1]=-e[1],r[2]=-e[2],r[3]=e[3],r},N.aI=pa,N.aJ=function(r,e,i,o,a){var c=1/Math.tan(e/2);if(r[0]=c/i,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=c,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=-1,r[12]=0,r[13]=0,r[15]=0,a!=null&&a!==1/0){var h=1/(o-a);r[10]=(a+o)*h,r[14]=2*a*o*h}else r[10]=-1,r[14]=-2*o;return r},N.aK=function(r,e,i,o,a,c,h){var f=1/(e-i),_=1/(o-a),y=1/(c-h);return r[0]=-2*f,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=-2*_,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=2*y,r[11]=0,r[12]=(e+i)*f,r[13]=(a+o)*_,r[14]=(h+c)*y,r[15]=1,r},N.aL=un,N.aM=Er,N.aN=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]},N.aO=kn,N.aP=Ri,N.aQ=ni,N.aR=Tn,N.aS=rl,N.aT=function(r,e){const{x:i,y:o}=r.point,a=Gx(i,o,r.worldSize/r._pixelsPerMercatorPixel,0,0);return Ri(a,a,Py(aa(e)))},N.aU=il,N.aV=al,N.aW=or,N.aX=to,N.aY=rn,N.aZ=Ae,N.a_=z,N.aa=oi,N.ab=Pc,N.ac=Jr,N.ad=Zi,N.ae=Bn,N.af=ce,N.ag=Xo,N.ah=Ql,N.ai=yt,N.aj=Ke,N.ak=pt,N.al=jt,N.am=function(){return be++},N.an=class{constructor(r,e,i){this.target=r,this.parent=e,this.mapId=i,this.pendingResponses=new Map,qe(["receive"],this),this.target.addEventListener("message",this.receive,!1),this.scheduler=new eT}send(r,e,i){const{signal:o,targetMapId:a,metadata:c}=i||{},h=Math.round(1e18*Math.random()).toString(36).substring(0,10),f=new Set;return o&&o.aborted?Promise.reject(o.reason):(this.target.postMessage({id:h,type:r,targetMapId:a,sourceMapId:this.mapId,data:oo(e,f)},[...f]),new Promise((_,y)=>{const v={resolve:_,reject:y,metadata:c||_1};if(o){const b=()=>{this.pendingResponses.delete(h),y(o.reason)};o.addEventListener("abort",b,{once:!0}),v.detach=()=>o.removeEventListener("abort",b)}this.pendingResponses.set(h,v)}))}notify(r,e,i){const{targetMapId:o}=i||{},a=new Set;this.target.postMessage({type:r,targetMapId:o,sourceMapId:this.mapId,data:oo(e,a)},[...a])}sendCancelable(r,e,i,o){const a=new AbortController;return this.send(r,e,{...i,signal:a.signal}).then(c=>o(null,c)).catch(c=>{c.name!=="AbortError"&&o(c)}),a}getWorkerSourceActor(r){return{scheduler:this.scheduler,send:(e,i,o)=>this.send(e,i,{...o,targetMapId:r}),notify:(e,i)=>{this.notify(e,i,{targetMapId:r})},sendCancelable:(e,i,o,a)=>this.sendCancelable(e,i,{...o,targetMapId:r},a)}}receive(r){const e=r.data;if(!e)return;const i=e.id;if(!e.targetMapId||this.mapId===e.targetMapId)if(Ai(self)){const o=this.pendingResponses.get(i);this.scheduler.add(()=>{this.processTask(i,e)},o&&o.metadata||_1)}else this.processTask(i,e)}async processTask(r,e){if(e.type==="<response>"){const a=this.pendingResponses.get(r);if(this.pendingResponses.delete(r),a){a.detach&&a.detach();try{e.error?a.reject(Rn(e.error)):a.resolve(Rn(e.data))}catch(c){a.reject(c)}}return}const i=new Set,o=Rn(e.data);try{let a;if(this.parent[e.type])a=await this.parent[e.type](e.sourceMapId,o);else{if(!this.parent.getWorkerSource)throw new Error(`Could not find function ${e.type}`);{const c=e.type.split("."),{source:h,scope:f}=o;a=await this.parent.getWorkerSource(e.sourceMapId,{type:c[0],source:h,scope:f,uid:0})[c[1]](o)}}if(!r)return;this.target.postMessage({id:r,type:"<response>",sourceMapId:this.mapId,error:null,data:oo(a,i)},[...i])}catch(a){this.target.postMessage({id:r,type:"<response>",sourceMapId:this.mapId,error:oo(a),data:null},[])}}remove(){for(const r of this.pendingResponses.values())r.detach&&r.detach(),r.reject(new DOMException("Actor removed","AbortError"));this.pendingResponses.clear(),this.scheduler.remove(),this.target.removeEventListener("message",this.receive,!1)}},N.ao=class{constructor(r){this.specification=r}possiblyEvaluate(r,e){return(function([i,o]){const a=di([1,i,o]);return{x:a.x,y:a.y,z:a.z}})(r.expression.evaluate(e))}interpolate(r,e,i){return{x:yt(r.x,e.x,i),y:yt(r.y,e.y,i),z:yt(r.z,e.z,i)}}},N.ap=Jc,N.aq=mo,N.ar=rr,N.as=te,N.at=le,N.au=bi,N.av=mi,N.aw=Xi,N.ax=hr,N.ay=rs,N.az=ga,N.b=function(r){return ii.API_FONTS_REGEX.test(r)},N.b$=po,N.b0=function(r,e,i,o,a){const c=5*e+2;r.float32[c+0]=i,r.float32[c+1]=o,r.float32[c+2]=a},N.b1=Hh,N.b2=Kt,N.b3=K,N.b4=Jx,N.b5=En,N.b6=function(r,e){return r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]&&r[3]===e[3]},N.b7=is,N.b8=function(r){var e=r[0],i=r[1],o=r[2],a=r[3];return Math.sqrt(e*e+i*i+o*o+a*a)},N.b9=cl,N.bA=Ey,N.bB=6,N.bC=function(r){const e=ki(new Float64Array(16));Ri(e,r.pixelMatrix,r.globeMatrix);const i=[0,ao,0],o=[0,lo,0];return Zi(i,i,e),Zi(o,o,e),[i[0]>0&&i[0]<=r.width&&i[1]>0&&i[1]<=r.height&&!Dy(r,new Kt(r.center.lat,90)),o[0]>0&&o[0]<=r.width&&o[1]>0&&o[1]<=r.height&&!Dy(r,new Kt(r.center.lat,-90))]},N.bD=Qs,N.bE=Ur,N.bF=Yr,N.bG=function(r,e){const{scale:i}=r.tileTransform,o=i*Ke/(r.tileSize*Math.pow(2,e.zoom-r.tileID.overscaledZ+r.tileID.canonical.z)),a=e.inverseAdjustmentMatrix;return new Float32Array([a[0]*o,a[1]*o,a[2]*o,a[3]*o])},N.bH=W_,N.bI=zs,N.bJ=kv,N.bK=function(r){const e=kv(r,!0);return il([],[e[0],e[1],e[4],e[5]])},N.bL=Gr,N.bM=Sy,N.bN=ts,N.bO=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},N.bP=function(r){const{x:e,y:i}=r.point,{lng:o,lat:a}=r._center;return Gx(e,i,r.worldSize,o,a)},N.bQ=ol,N.bR=eo,N.bS=de,N.bT=Ha,N.bU=5,N.bV=function(r,e,i){let o=0;for(let a=0;a<2;++a)r[a]>0&&(o+=(r[a]-0)*(r[a]-0)),e[a]<0&&(o+=(0-e[a])*(0-e[a]));return o},N.bW=function(r){return r*r*r*r*r},N.bX=bf,N.bY=45,N.bZ=ia,N.b_=Ga,N.ba=Bs,N.bb=Zx,N.bc=3,N.bd=2,N.be=7,N.bf=6,N.bg=_a,N.bh=ti,N.bi=ma,N.bj=0,N.bk=1,N.bl=4,N.bm=5,N.bn=o_,N.bo=Gh,N.bp=dn,N.bq=Ay,N.br=Nv,N.bs=lp,N.bt=Ux,N.bu=function(r,e,i,o,a,c,h,f,_){if(_.name==="globe")return Ux(r,e,new lp(i,o,a),!1);const y=zy({z:i,x:o,y:a},_);return new Ni([(c+y.x/y.scale)*e,e*(y.y/y.scale),h],[(c+y.x2/y.scale)*e,e*(y.y2/y.scale),f])},N.bv=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},N.bw=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},N.bx=function(r){const e=Math.round((r+45+360)%360/90)%4;return F[e]},N.by=co,N.bz=ac,N.c=cd,N.c$=Ih,N.c0=db,N.c1=k0,N.c2=No,N.c3=function(r,e){var i=Math.sin(e),o=Math.cos(e);return r[0]=o,r[1]=i,r[2]=0,r[3]=-i,r[4]=o,r[5]=0,r[6]=0,r[7]=0,r[8]=1,r},N.c4=function(r,e,i){var o=e[0],a=e[1],c=e[2];return r[0]=o*i[0]+a*i[3]+c*i[6],r[1]=o*i[1]+a*i[4]+c*i[7],r[2]=o*i[2]+a*i[5]+c*i[8],r},N.c5=function(r,e,i){const o=Math.sqrt(r*r+e*e+i*i),a=o>0?Math.acos(i/o)*ml:0;let c=r!==0||e!==0?Math.atan2(-e,-r)*ml+90:0;return c<0&&(c+=360),[o,c,a]},N.c6=Cr,N.c7=function(r){return[Math.pow(r[0],1/2.2),Math.pow(r[1],1/2.2),Math.pow(r[2],1/2.2)]},N.c8=di,N.c9=e_,N.cA=Vo,N.cB=ag,N.cC=o0,N.cD=Wr,N.cE=Ja,N.cF=450,N.cG=7,N.cH=2,N.cI=Kf,N.cJ=Jf,N.cK=qe,N.cL=class{static calculate(r,e,i){const o=new Set,a=new Map,c=new Set,h=new Set;for(const _ of Object.values(r))for(const[y,v]of Object.entries(_.floors)){c.add(y),v.isDefault&&h.add(y),v.conflicts&&a.set(y,v.conflicts);const b=y===e,T=v.connections&&e&&v.connections.has(e);(b||T)&&o.add(y)}const f=_=>{const y=a.get(_)||new Set;for(const v of o)if((a.get(v)||new Set).has(_)||y.has(v))return!0;return!1};if(i)for(const _ of i)c.has(_)&&(f(_)||o.add(_));for(const _ of h)o.has(_)||f(_)||o.add(_);return o}},N.cM=class extends Ro{constructor(r){super(r),this.current=new Float32Array(9)}set(r,e,i){if(!this.fetchUniformLocation(r,e))return;const o=this.current;for(let a=0;a<9;a++)if(i[a]!==o[a]){o.set(i),this.gl.uniformMatrix3fv(this.location,!1,o);break}}},N.cN=zy,N.cO=on,N.cP=qc,N.cQ=zt,N.cR=Xm,N.cS=z_,N.cT=function(){Wo.isLoading()||Wo.isLoaded()||fh()!=="deferred"||Zt()},N.cU=jl,N.cV=uo,N.cW=fu,N.cX=tr,N.cY=Vh,N.cZ=Zf,N.c_=xn,N.ca=Ni,N.cb=To,N.cc=ka,N.cd=ks,N.ce=sc,N.cf=function(r,e){var i=new Gi(3);sc(i,e);var o=1/i[0],a=1/i[1],c=1/i[2],h=e[0]*o,f=e[1]*a,_=e[2]*c,y=e[4]*o,v=e[5]*a,b=e[6]*c,T=e[8]*o,S=e[9]*a,C=e[10]*c,P=h+v+C,R=0;return P>0?(R=2*Math.sqrt(P+1),r[3]=.25*R,r[0]=(b-S)/R,r[1]=(T-_)/R,r[2]=(f-y)/R):h>v&&h>C?(R=2*Math.sqrt(1+h-v-C),r[3]=(b-S)/R,r[0]=.25*R,r[1]=(f+y)/R,r[2]=(T+_)/R):v>C?(R=2*Math.sqrt(1+v-h-C),r[3]=(T-_)/R,r[0]=(f+y)/R,r[1]=.25*R,r[2]=(b+S)/R):(R=2*Math.sqrt(1+C-h-v),r[3]=(f-y)/R,r[0]=(T+_)/R,r[1]=(b+S)/R,r[2]=.25*R),r},N.cg=function(r,e){var i=2*Math.acos(e[3]),o=Math.sin(i/2);return o>jr?(r[0]=e[0]/o,r[1]=e[1]/o,r[2]=e[2]/o):(r[0]=1,r[1]=0,r[2]=0),i},N.ch=xx,N.ci=K_,N.cj=Y_,N.ck=Xh,N.cl=function(r,e){if(r===e){var i=e[1],o=e[2],a=e[3],c=e[6],h=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]=o,r[9]=c,r[11]=e[14],r[12]=a,r[13]=h,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},N.cm=nv,N.cn=zn,N.co=Es,N.cp=Mr,N.cq=Fx,N.cr=wi,N.cs=Jh,N.ct=class{constructor(r,e,i,o){this.context=r,this.format=o,this.size=i,this.texture=r.gl.createTexture();const[a,c,h]=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,a,c,h,0,wt(this.format),Ot(this.format),e.data)}bind(r,e){const{context:i}=this,{gl:o}=i;o.bindTexture(o.TEXTURE_3D,this.texture),r!==this.minFilter&&(o.texParameteri(o.TEXTURE_3D,o.TEXTURE_MAG_FILTER,r),o.texParameteri(o.TEXTURE_3D,o.TEXTURE_MIN_FILTER,r),this.minFilter=r),e!==this.wrapS&&(o.texParameteri(o.TEXTURE_3D,o.TEXTURE_WRAP_S,e),o.texParameteri(o.TEXTURE_3D,o.TEXTURE_WRAP_T,e),this.wrapS=e)}destroy(){const{gl:r}=this.context;r.deleteTexture(this.texture),this.texture=null}},N.cu=[1,1,1],N.cv=function(r,e,i,o){var a=new Gi(4);return a[0]=r,a[1]=e,a[2]=i,a[3]=o,a},N.cw=xu,N.cx=function(r,e,i,o){var a=e[0],c=e[1],h=e[2],f=e[3];return r[0]=a+o*(i[0]-a),r[1]=c+o*(i[1]-c),r[2]=h+o*(i[2]-h),r[3]=f+o*(i[3]-f),r},N.cy=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},N.cz=gr,N.d=function(r){return ii.API_TILEJSON_REGEX.test(r)},N.d$=Zn,N.d0=Gl,N.d1=function(r,e){const i=Ql(e.zoom);if(i===0)return aa(r);const o=S_(r),a=My(o),c=Ur(o.getWest())*e.worldSize,h=Ur(o.getEast())*e.worldSize,f=Yr(o.getNorth())*e.worldSize,_=Yr(o.getSouth())*e.worldSize,y=[c,f,0],v=[h,f,0],b=[c,_,0],T=[h,_,0],S=bo([],e.globeMatrix);return Zi(y,y,S),Zi(v,v,S),Zi(b,b,S),Zi(T,T,S),a[0]=Wa(a[0],b,i),a[1]=Wa(a[1],T,i),a[2]=Wa(a[2],v,i),a[3]=Wa(a[3],y,i),Ni.fromPoints(a)},N.d2=C_,N.d3=ap,N.d4=Wa,N.d5=Wl,N.d6=ob,N.d7=_g,N.d8=t,N.d9=xl,N.dA=ye,N.dB="hd_road_coverage",N.dC=function(r){const e=r.indexOf(Yo);return e>=0?r.slice(0,e):r},N.dD=Po,N.dE=function(r,e,i=0,o=!0){const a=new Ne(i,i),c=r.sub(a),h=e.add(a),f=[c,new Ne(h.x,c.y),h,new Ne(c.x,h.y)];return o&&f.push(c.clone()),f},N.dF=function(r,e){const i=[];for(let o=0;o<r.length;o++){const a=le(o-1,-1,r.length-1),c=le(o+1,-1,r.length-1),h=r[o],f=r[c],_=r[a].sub(h).unit(),y=f.sub(h).unit(),v=y.angleWithSep(_.x,_.y),b=_.add(y).unit().mult(-1*e/Math.sin(v/2));i.push(h.add(b))}return i},N.dG=function(r,{x:e,y:i},o=0){return new Ne(((e-o)*r.scale-r.x)*Ke,(i*r.scale-r.y)*Ke)},N.dH=function(r,e,i=0){return Cr(((e.x-i)*r.scale-r.x)*Ke,(e.y*r.scale-r.y)*Ke,wf(e.z,e.y))},N.dI=function(r){let e=1/0,i=1/0,o=-1/0,a=-1/0;for(const c of r)e=Math.min(e,c.x),i=Math.min(i,c.y),o=Math.max(o,c.x),a=Math.max(a,c.y);return{min:new Ne(e,i),max:new Ne(o,a)}},N.dJ=cn,N.dK=As,N.dL=$m,N.dM=class{constructor(r){this.entries={},this.scheduler=r}request(r,e,i,o){const a=this.entries[r]=this.entries[r]||{callbacks:[]};if(a.result){const[c,h]=a.result;return this.scheduler?this.scheduler.add(()=>{o(c,h)},e):o(c,h),()=>{}}return a.callbacks.push(o),a.cancel||(a.cancel=i((c,h)=>{a.result=[c,h];for(const f of a.callbacks)this.scheduler?this.scheduler.add(()=>{f(c,h)},e):f(c,h);setTimeout(()=>delete this.entries[r],3e3)})),()=>{a.result||(a.callbacks=a.callbacks.filter(c=>c!==o),a.callbacks.length||(a.cancel(),delete this.entries[r]))}}},N.dN=function(r,e,i){const o=JSON.stringify(r.request);return r.data&&(this.deduped.entries[o]={result:[null,r.data]}),this.deduped.request(o,{type:"parseTile",renderSourceType:r.renderSourceType,zoom:r.tileZoom},a=>{const c=new AbortController;return xl(r.request,c.signal).then(({data:h,headers:f})=>{a(null,{rawData:h,vectorTile:i?void 0:new Yf(new t(h)),headers:f})}).catch(h=>{c.signal.aborted||(Hp(h)?a(null,null):a(h))}),()=>{c.abort(),a(null,null)}},e)},N.dO=class{constructor(r,e){this.context=r,this.texture=e}bind(r,e){const{context:i}=this,{gl:o}=i;o.bindTexture(o.TEXTURE_2D,this.texture),r!==this.minFilter&&(o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,r),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,r),this.minFilter=r),e!==this.wrapS&&(o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,e),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,e),this.wrapS=e)}},N.dP=function(r,e,i,o){for(;e<i;){const a=e+i>>1;r[a]<=o?e=a+1:i=a}return e},N.dQ=function(r,e,i,o){for(;e<i;){const a=e+i>>1;r[a]<o?e=a+1:i=a}return e},N.dR=Oa,N.dS=function(r,e){var i=e[0],o=e[1],a=e[2],c=e[3],h=e[4],f=e[5],_=e[6],y=e[7],v=e[8];return r[0]=h*v-f*y,r[1]=a*y-o*v,r[2]=o*f-a*h,r[3]=f*_-c*v,r[4]=i*v-a*_,r[5]=a*c-i*f,r[6]=c*y-h*_,r[7]=o*_-i*y,r[8]=i*h-o*c,r},N.dT=yu,N.dU=async function(r){const e=document.createElement("video");e.muted=!0;for(const i of r){const o=document.createElement("source");$p(i)||(e.crossOrigin="Anonymous"),o.src=i,e.appendChild(o)}return await new Promise((i,o)=>{e.onloadstart=()=>i(),e.onerror=()=>o(new Error(`Could not load video: ${r.join(", ")}`))}),e},N.dV=Qa,N.dW=["type","source","source-layer","minzoom","maxzoom","filter","layout"],N.dX=Qx,N.dY=eg,N.dZ=rv,N.d_=se,N.da=function(r){if("provider"in r&&!r.provider)return null;let e=r.provider;if(!e&&"url"in r&&r.url&&(e=(function(a){try{const c=new URL(a).pathname.split("/").pop()||"",h=c.lastIndexOf(".");return h>=0?c.slice(h+1):""}catch{return""}})(r.url)),!e)return null;const i=ii.TILE_PROVIDER_URLS[e];if(!i)return null;let o;try{o=new URL(i,ii.API_URL).href}catch{return new Error(`TileProvider "${e}" has an invalid URL: "${i}"`)}return{name:e,url:o}},N.db=function(r,e,i,o,a){const c=function(f,_){if(f)return a(f);if(_){r.url&&_.tiles&&r.tiles&&delete r.tiles;const y=P1(r,_,e);if(y instanceof Error)return a(y);a(null,y)}},h=(function(f,_,y){if(!f)return null;if(!_&&!y)return f;y=y||f.worldview_default;const v=Object.values(f.language||{});if(v.length===0)return null;const b=Object.values(f.worldview||{});if(b.length===0)return null;const T=v.every(C=>C===_),S=b.every(C=>C===y);return T&&S?f:_ in(f.language_options||{})||y in(f.worldview_options||{})?null:f.language_options&&f.worldview_options?f:null})(r.data,i,o);if(h)return Ki.frame(()=>c(null,h));if(r.url){const f=new AbortController;return(async()=>{const _=await e.transformRequest(e.normalizeSourceURL(r.url,null,i,o),va.Source,f.signal),{data:y}=await Go(_,f.signal);c(null,y)})().catch(_=>{f.signal.aborted||c(_)}),{cancel:()=>f.abort()}}return Ki.frame(()=>{const{data:f,..._}=r;c(null,_)})},N.dc=function(r){return r?{cacheControl:r.get("cache-control"),expires:r.get("expires")}:{cacheControl:void 0,expires:void 0}},N.dd=function(r){xa++,xa>fc&&(r.getActor().notify("enforceCacheSizeLimit",jp),xa=0)},N.de=async function(r,e,i){const o=r.url&&!r.tiles?await e.transformRequest(r.url,va.Source,i):void 0;return{request:o,options:o?{...r,url:o.url}:r}},N.df=async function(r,e){const i=R1.get(r);if(i)return i;const o=Ex.get(r);if(o!==void 0)return o;const a=import(e).catch(c=>{throw new Error(`TileProvider "${r}" failed to load: ${c instanceof Error?c.message:String(c)}`)}).then(c=>{const h=c.default;if(typeof h!="function")throw new Error(`TileProvider "${r}" module must default-export a class`);if(typeof h.prototype.loadTile!="function")throw new Error(`TileProvider "${r}" class must have a loadTile method`);return R1.set(r,h),h}).finally(()=>{Ex.delete(r)});return Ex.set(r,a),a},N.dg=function(r,e,i){return e?P1(r,e,i):r.tiles&&r.tiles.length>0?{tiles:r.tiles}:new Error('TileJSON is missing required "tiles" property')},N.dh=Q0,N.di=a1,N.dj=ja,N.dk=S_,N.dl=function(r){const e=80.051129;r=te(r,-80.051129,e)/e*90;const i=Math.pow(Math.abs(Math.sin(jt(r))),3);return Math.round(i*(xf.length-1))},N.dm=aa,N.dn=function(r){const e=r.pixelsPerMeter,i=e/un(1,r.center.lat),o=ki(new Float64Array(16));return wn(o,o,[r.point.x,r.point.y,0]),Gr(o,o,[i,i,e]),Float32Array.from(o)},N.dp=function(r,e,i,o){const a=e.getNorth(),c=e.getSouth(),h=e.getWest(),f=e.getEast(),_=1<<r.z,y=f-h,v=a-c,b=y/Oa,T=-v/xf[i],S=[0,b,0,T,0,0,a,h,0];if(r.z>0){const C=180/o;yu(S,S,[C/y+1,0,0,0,C/v+1,0,-.5*C/b,.5*C/T,1])}return S[2]=_,S[5]=r.x,S[8]=r.y,S},N.dq=256,N.dr=Ua,N.ds=kd,N.dt=Zl,N.du=Of,N.dv=Jo,N.dw=wf,N.dx=Hp,N.dy=function(r,e){const i=[];for(const o in r)o in e||i.push(o);return i},N.dz=m1,N.e=function(r){return r.indexOf("mapbox:")===0},N.e$=fo,N.e0=vy,N.e1=vs,N.e2=Eo,N.e3=Vs,N.e4=ns,N.e5=sd,N.e6=class{isDataAvailableAtPoint(r){const e=this._source();if(this.isUsingMockSource()||!e||r.y<0||r.y>1)return!1;const i=e.getSource().maxzoom,o=1<<i,a=Math.floor(r.x),c=Math.floor((r.x-a)*o),h=Math.floor(r.y*o),f=this.findDEMTileFor(new dn(i,a,i,c,h));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 o=this._source();if(!o||r.y<0||r.y>1)return e;const a=o.getSource().maxzoom,c=1<<a,h=Math.floor(r.x),f=r.x-h,_=new dn(a,h,a,Math.floor(f*c),Math.floor(r.y*c)),y=this.findDEMTileFor(_);if(!y||!y.dem)return e;const v=y.dem,b=1<<y.tileID.canonical.z,T=(f*b-y.tileID.canonical.x)*v.dim,S=(r.y*b-y.tileID.canonical.y)*v.dim,C=Math.floor(T),P=Math.floor(S);return(i?this.exaggeration():1)*yt(yt(v.get(C,P),v.get(C,P+1),S-P),yt(v.get(C+1,P),v.get(C+1,P+1),S-P),T-C)}static getAtTileOffset(r,e,i,o){const a=1<<r.canonical.z;return o?o.pointElevation(e):i?i.getAtPointOrZero(new Jr(r.wrap+(r.canonical.x+e.x/Ke)/a,(r.canonical.y+e.y/Ke)/a)):0}static getAtTileOffsetFunc(r,e,i,o){return(a,c,h)=>{const f=this.getAtTileOffset(r,a,c,h),_=o.upVector(r.canonical,a.x,a.y);return mi(_,_,f*o.upVectorScale(r.canonical,e,i).metersToTile),_}}getForTilePoints(r,e,i,o){if(this.isUsingMockSource())return!1;const a=Jh.create(this,r,o);return!!a&&(e.forEach(c=>{c[2]=this.exaggeration()*a.getElevationAt(c[0],c[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,o=e.tileID,a=1<<r.canonical.z-o.canonical.z;let c=r.canonical.x/a-o.canonical.x,h=r.canonical.y/a-o.canonical.y,f=0;for(let _=0;_<r.canonical.z-o.canonical.z&&!i.leaves[f];_++){c*=2,h*=2;const y=2*Math.floor(h)+Math.floor(c);f=i.childOffsets[f]+y,c%=1,h%=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,o=Number.MIN_VALUE;for(const a of r){const c=this.getMinMaxForTile(a.tileID);c&&(i=Math.min(i,c.min),o=Math.max(o,c.max),e=!0)}return e?{min:i,max:o}:null}},N.e7=ru,N.e8=fr,N.e9=Sx,N.eA=mx,N.eB=qi,N.eC=Tr,N.eD=function(r,e){const i=[0,0,0];return Zi(i,i,C_(aa(e.canonical))),Zi(i,i,r),i},N.eE=r=>({u_matrix:new Jc(r),u_texsize:new po(r),u_pixels_to_tile_units:new qf(r),u_device_pixel_ratio:new rr(r),u_width_scale:new rr(r),u_floor_width_scale:new rr(r),u_image:new Ga(r),u_units_to_pixels:new po(r),u_tile_units_to_pixels:new rr(r),u_alpha_discard_threshold:new rr(r),u_trim_offset:new po(r),u_trim_fade_range:new po(r),u_trim_gradient_mix_range:new po(r),u_trim_color:new ia(r),u_zbias_factor:new rr(r),u_tile_to_meter:new rr(r),u_ground_shadow_factor:new mo(r),u_pattern_transition:new rr(r),u_opacity_multiplier:new rr(r)}),N.eF=r=>({u_matrix:new Jc(r),u_pixels_to_tile_units:new qf(r),u_device_pixel_ratio:new rr(r),u_width_scale:new rr(r),u_floor_width_scale:new rr(r),u_units_to_pixels:new po(r),u_dash_image:new Ga(r),u_gradient_image:new Ga(r),u_image_height:new rr(r),u_texsize:new po(r),u_tile_units_to_pixels:new rr(r),u_alpha_discard_threshold:new rr(r),u_trim_offset:new po(r),u_trim_fade_range:new po(r),u_trim_gradient_mix_range:new po(r),u_trim_color:new ia(r),u_zbias_factor:new rr(r),u_tile_to_meter:new rr(r),u_ground_shadow_factor:new mo(r),u_opacity_multiplier:new rr(r)}),N.eG=r=>({u_camera_to_center_distance:new rr(r),u_extrude_scale:new qf(r),u_device_pixel_ratio:new rr(r),u_matrix:new Jc(r),u_inv_rot_matrix:new Jc(r),u_merc_center:new po(r),u_tile_id:new mo(r),u_zoom_transition:new rr(r),u_up_dir:new mo(r),u_emissive_strength:new rr(r)}),N.eH=Lf,N.eI=rp,N.eJ=m0,N.eK=(r,e,i,o,a,c)=>{const h=r.transform,f=h.projection.name==="globe";let _;if(c.paint.get("circle-pitch-alignment")==="map")if(f){const v=jx(h.zoom,e.canonical)*h._pixelsPerMercatorPixel;_=Float32Array.from([v,0,0,v])}else _=h.calculatePixelsToTileUnitsMatrix(i);else _=new Float32Array([h.pixelsToGLUnits[0],0,0,h.pixelsToGLUnits[1]]);const y={u_camera_to_center_distance:r.transform.getCameraToCenterDistance(h.projection),u_matrix:r.translatePosMatrix(e.projMatrix,i,c.paint.get("circle-translate"),c.paint.get("circle-translate-anchor")),u_device_pixel_ratio:Ki.devicePixelRatio,u_extrude_scale:_,u_inv_rot_matrix:Uw,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0],u_emissive_strength:c.paint.get("circle-emissive-strength")};if(f){y.u_inv_rot_matrix=o,y.u_merc_center=a,y.u_tile_id=[e.canonical.x,e.canonical.y,1<<e.canonical.z],y.u_zoom_transition=Ql(h.zoom);const v=a[0]*Ke,b=a[1]*Ke;y.u_up_dir=h.projection.upVector(new lp(0,0,0),v,b)}return y},N.eL=U0,N.eM=(r,e,i,o,a,c,h,f,_,y)=>{const v=r.transform,b=v.pitch<15?yt(.07,.7,te((14-v.zoom)/5,0,1)):.07,T=i.paint.get("line-trim-color-use-theme").constantOr("default")==="none";return{u_matrix:V0(r,e,i,o),u_texsize:e.imageAtlasTexture?e.imageAtlasTexture.size:[0,0],u_pixels_to_tile_units:v.calculatePixelsToTileUnitsMatrix(e),u_device_pixel_ratio:a,u_width_scale:c,u_floor_width_scale:h,u_image:0,u_tile_units_to_pixels:N0(e,v),u_units_to_pixels:[1/v.pixelsToGLUnits[0],1/v.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(T?null:i.lut).toArray01(),u_zbias_factor:b,u_tile_to_meter:zn(e.tileID.canonical,0),u_ground_shadow_factor:_,u_pattern_transition:y,u_opacity_multiplier:1}},N.eN=(r,e,i,o,a,c,h,f,_,y)=>{const v=r.transform,b=v.calculatePixelsToTileUnitsMatrix(e),T=i.paint.get("line-trim-color-use-theme").constantOr("default")==="none",S=v.pitch<15?yt(.07,.7,te((14-v.zoom)/5,0,1)):.07;return{u_matrix:V0(r,e,i,o),u_pixels_to_tile_units:b,u_device_pixel_ratio:c,u_width_scale:h,u_floor_width_scale:f,u_units_to_pixels:[1/v.pixelsToGLUnits[0],1/v.pixelsToGLUnits[1]],u_dash_image:0,u_gradient_image:1,u_image_height:a,u_texsize:j0(i)&&e.lineAtlasTexture?e.lineAtlasTexture.size:[0,0],u_tile_units_to_pixels:N0(e,r.transform),u_alpha_discard_threshold:0,u_trim_offset:_,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(T?null:i.lut).toArray01(),u_zbias_factor:S,u_tile_to_meter:zn(e.tileID.canonical,0),u_ground_shadow_factor:y,u_opacity_multiplier:1}},N.eO=Oe,N.eP=Ep,N.eQ=$w,N.eR=Py,N.eS=ho,N.eT=function(r,e){var i=Math.sin(e),o=Math.cos(e);return r[0]=o,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]=o,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r},N.eU=function(r,e){var i=Math.sin(e),o=Math.cos(e);return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=o,r[6]=i,r[7]=0,r[8]=0,r[9]=-i,r[10]=o,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r},N.eV=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},N.eW=ea,N.eX=Ff,N.eY=function(r,e,i,o,a){return te((r-e)/(i-e)*(a-o)+o,o,a)},N.eZ=Ns,N.e_=function(r,e){var i=e[0],o=e[1],a=e[2],c=e[3],h=e[4],f=e[5],_=e[6],y=e[7],v=e[8],b=v*h-f*y,T=-v*c+f*_,S=y*c-h*_,C=i*b+o*T+a*S;return C?(r[0]=b*(C=1/C),r[1]=(-v*o+a*y)*C,r[2]=(f*o-a*h)*C,r[3]=T*C,r[4]=(v*i-a*_)*C,r[5]=(-f*i+a*c)*C,r[6]=S*C,r[7]=(-y*i+o*_)*C,r[8]=(h*i-o*c)*C,r):null},N.ea=Bv,N.eb=rx,N.ec=jv,N.ed=function(){return{API_URL:ii.API_URL,DRACO_URL:ii.DRACO_URL,MESHOPT_URL:ii.MESHOPT_URL,MESHOPT_SIMD_URL:ii.MESHOPT_SIMD_URL,BUILDING_GEN_URL:ii.BUILDING_GEN_URL}},N.ee=yl,N.ef=pr,N.eg=cr,N.eh=Ul,N.ei=ld,N.ej=Iu,N.ek=ot,N.el=function(r){return r.includes(Yo)},N.em=function(r){const e=r.lastIndexOf(Yo);return e>=0?r.slice(e+1):""},N.en=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},N.eo=function(r,e,i,o){return r.type==="custom"?new Zw(r,e):new Jw[r.type](r,e,i,o)},N.ep=st,N.eq=class extends fu{constructor(r,e){super(r._vectorTileFeature,r._z,r._x,r._y,r.id),r.state&&(this.state={...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}},N.er=lf,N.es=function(r){return r({pluginStatus:Kr,pluginURL:Js}),lf.on("pluginStateChange",r),r},N.et=j,N.eu=function(r,e,i){const o=Ql(i.zoom),a=r.style.map._antialias,c=r.terrain&&r.terrain.exaggeration()>0;return o===0&&!a&&!c},N.ev=function(r,e,i){const o=ki(new Float64Array(16)),a=(e/(1<<r)-.5)*Math.PI*2;return wo(o,i.globeMatrix,a),Float32Array.from(o)},N.ew=d_,N.ex=E_,N.ey=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]},N.ez=jx,N.f=gl,N.f$=Yf,N.f0=class{constructor(){this._updateTime=0,this._sourceIds=[],this._activeRegions=[],this._prevRegions=[],this._globalClipBounds={min:new Ne(1/0,1/0),max:new Ne(-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=tv(new Ne(0,0),new Ne(Ke,Ke),r),o=[];if(e&&!Ly(i,this._globalClipBounds))return o;for(const a of this._activeRegions){if(a.hiddenByOverlap||!Ly(i,a))continue;const c=wb(a.min,a.max,r);o.push({min:c.min,max:c.max,sourceId:this._sourceIds[a.priority],footprint:a.footprint,footprintTileId:a.tileId,order:a.order,clipMask:a.clipMask,clipScope:a.clipScope})}return o}setSources(r){this._setSources(r.map(e=>({getSourceId:()=>e.cache.id,getFootprints:()=>{const i=[];for(const o of e.cache.getVisibleCoordinates()){const a=e.cache.getTile(o).buckets[e.layer];a&&a.updateFootprints(o.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(),o=r.getClipMask(),a=r.getClipScope();for(const c of e){if(!c.footprint)continue;const h=tv(c.footprint.min,c.footprint.max,c.id);this._activeRegions.push({min:h.min,max:h.max,hiddenByOverlap:!1,priority:this._sourceIds.length,tileId:c.id,footprint:c.footprint,order:i,clipMask:o,clipScope:a})}this._sourceIds.push(r.getSourceId())}_computeReplacement(){this._activeRegions.sort((e,i)=>e.priority-i.priority||R_(e.min,i.min)||R_(e.max,i.max)||e.order-i.order||e.clipMask-i.clipMask||(function(o,a){const c=(h,f)=>h+f;return o.length-a.length||o.reduce(c,"").localeCompare(a.reduce(c,""))})(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],o=this._prevRegions[e];r=i.priority!==o.priority||!ev(i,o)||i.order!==o.order||i.clipMask!==o.clipMask||!En(i.clipScope,o.clipScope),this._activeRegions[e].hiddenByOverlap=o.hiddenByOverlap,++e}}if(r){++this._updateTime;for(const i of this._activeRegions)i.order!==fp&&(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 o=this._activeRegions;if(i>=o.length)return i;const a=o[i].priority;for(;i<o.length&&o[i].priority===a;)++i;return i};if(this._sourceIds.length>1){let i=0,o=e(i);for(;i!==o;){let a=i;const c=i;for(;a!==o;){const h=this._activeRegions[a];h.hiddenByOverlap=!1;for(let f=0;f<c;f++){const _=this._activeRegions[f];if(!_.hiddenByOverlap&&h.order===fp&&Ly(h,_)&&(h.hiddenByOverlap=iv(h.footprint,h.tileId,_.footprint,_.tileId),h.hiddenByOverlap))break}++a}i=o,o=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()}},N.f1=fp,N.f2=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 Es,o=new Mr,a=[],c=r+1+2,h=e[0]+1,f=e[0]+1+(1+e.length),_=(y,v,b)=>{let T=y===c-1?y-2:y===0?y:y-1;return T+=b?24575:0,[T,v]};for(let y=0;y<c;++y)i.emplaceBack(..._(y,0,!0));for(let y=0;y<h;++y)for(let v=0;v<c;++v)i.emplaceBack(..._(v,y,(v===0||v===c-1)&&!0));for(let y=0;y<e.length;++y){const v=e[y];for(let b=0;b<c;++b)i.emplaceBack(..._(b,v,!0))}for(let y=0;y<e.length;++y){const v=o.length,b=e[y]+1+2,T=new Mr;for(let P=0;P<b-1;P++){const R=P===b-2,L=R?c*(f-e.length+y-P):c;for(let V=0;V<c-1;V++){const B=P*c+V;P===0||R||V===0||V===c-2?(T.emplaceBack(B+1,B,B+L),T.emplaceBack(B+L,B+L+1,B+1)):(o.emplaceBack(B+1,B,B+L),o.emplaceBack(B+L,B+L+1,B+1))}}const S=wi.simpleSegment(0,v,i.length,o.length-v);for(let P=0;P<T.uint16.length;P+=3)o.emplaceBack(T.uint16[P],T.uint16[P+1],T.uint16[P+2]);const C=wi.simpleSegment(0,v,i.length,o.length-v);a.push({withoutSkirts:S,withSkirts:C})}return{vertices:i,indices:o,segments:a}}_createGrid(r){const e=this._fillGridMeshWithLods(Oa,xf);this._gridSegments=e.segments,this._gridBuffer=r.createVertexBuffer(e.vertices,Fx.members),this._gridIndexBuffer=r.createIndexBuffer(e.indices,!0)}_createPoles(r){const e=new Mr;for(let h=0;h<=Oa;h++)e.emplaceBack(0,h+1,h+2);this._poleIndexBuffer=r.createIndexBuffer(e,!0);const i=new ea,o=new ea,a=new ea,c=new ea;this._poleSegments=[];for(let h=0,f=0;h<6;h++){const _=360/(1<<h);i.emplaceBack(0,-cn,0,.5,0),o.emplaceBack(0,-cn,0,.5,1),a.emplaceBack(0,-cn,0,.5,.5),c.emplaceBack(0,-cn,0,.5,.5);for(let y=0;y<=Oa;y++){let v=y/Oa,b=0;const T=yt(0,_,v),[S,C,P]=$l(ub,hb,T,cn);i.emplaceBack(S,C,P,v,b),o.emplaceBack(S,C,P,v,1-b);const R=jt(T);v=.5+.5*Math.sin(R),b=.5+.5*Math.cos(R),a.emplaceBack(S,C,P,v,b),c.emplaceBack(S,C,P,v,1-b)}this._poleSegments.push(wi.simpleSegment(f,0,66,64)),f+=66}this._poleNorthVertexBuffer=r.createVertexBuffer(i,T_,!1),this._poleSouthVertexBuffer=r.createVertexBuffer(o,T_,!1),this._texturedPoleNorthVertexBuffer=r.createVertexBuffer(a,T_,!1),this._texturedPoleSouthVertexBuffer=r.createVertexBuffer(c,T_,!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]]}},N.f3=bb,N.f4=dl,N.f5=function(){return!!document.fullscreenElement||!!document.webkitFullscreenElement},N.f6=re,N.f7=Hm,N.f8=function(r,e,i){return r[0]=e[0]/i[0],r[1]=e[1]/i[1],r[2]=e[2]/i[2],r},N.f9=ll,N.fA=d0,N.fB=U_,N.fC=Vn,N.fD=xc,N.fE=function(r,e){const i=r.layers[0].layout.get("fill-elevation-reference"),o=i==="hd-road-base"||i==="hd-road-markup"?i:null,a=!!e&&e.length>0&&Zy(e,r.layers[0].source,r.sourceLayerName);(o||a)&&(r.hdExt=new bv(r,o,a))},N.fF=function(r,e){const i=r.layers[0].layout.get("line-elevation-reference")==="hd-road-markup",o=!!e&&e.length>0&&Zy(e,r.layers[0].source,r.sourceLayerName);(i||o)&&(r.hdExt=new wv(i,o))},N.fG=nu,N.fH=function(r){const e=r.layers[0];e.type==="circle"&&e.layout.get("circle-elevation-reference")==="hd-road-markup"&&(r.hdExt=new Tv)},N.fI=function(r){r.layers[0].layout.get("symbol-elevation-reference")==="hd-road-markup"&&(r.hdExt=new Ev)},N.fJ=Je,N.fK=na,N.fL=2,N.fM=g1,N.fN=y1,N.fO=f_,N.fP=Zy,N.fQ=$n,N.fR=function(r,e){const i=U_(r);return i!==null&&!!(e&1<<i)},N.fS=Ye,N.fT=ei,N.fU=1,N.fV=function(r,e,i,o,a,c,h,f=1,_,y,v,b,T,S,C,P,R){r.createArrays(),r.tilePixelRatio=Ke/(512*r.overscaling),r.compareText={},r.iconsNeedLinear=!1;const L=r.layers[0].layout,V=r.layers[0]._unevaluatedLayout._values,B={};B.scaleFactor=f,B.textSizeScaleRange=L.get("text-size-scale-range"),B.iconSizeScaleRange=L.get("icon-size-scale-range");const[G,H]=B.textSizeScaleRange,[Z,oe]=B.iconSizeScaleRange;B.textScaleFactor=te(B.scaleFactor,G,H),B.iconScaleFactor=te(B.scaleFactor,Z,oe);const X=V["text-size"],ee=V["icon-size"];if(r.textSizeData.kind==="composite"){const{minZoom:Ee,maxZoom:Ve}=r.textSizeData;B.compositeTextSizes=[X.possiblyEvaluate(new oi(Ee,{worldview:v}),c),X.possiblyEvaluate(new oi(Ve,{worldview:v}),c)]}if(r.iconSizeData.kind==="composite"){const{minZoom:Ee,maxZoom:Ve}=r.iconSizeData;B.compositeIconSizes=[ee.possiblyEvaluate(new oi(Ee,{worldview:v}),c,b),ee.possiblyEvaluate(new oi(Ve,{worldview:v}),c,b)]}B.layoutTextSize=X.possiblyEvaluate(new oi(h+1,{worldview:v}),c),B.layoutIconSize=ee.possiblyEvaluate(new oi(h+1,{worldview:v}),c,b),B.textMaxSize=X.possiblyEvaluate(new oi(18,{worldview:v}),c);const ie=L.get("symbol-placement"),ne=L.get("text-rotation-alignment")==="map"&&ie!=="point",fe=L.get("text-size");let ge=!1;const we=[],Se=T!=null&&T!==0;for(const Ee of r.features){if(Se&&Ee.properties&&P&&P(Ee.properties,T))continue;const Ve=L.get("text-font").evaluate(Ee,{},c).join(","),Ie=fe.evaluate(Ee,{},c)*B.textScaleFactor,Te=B.layoutTextSize.evaluate(Ee,{},c)*B.textScaleFactor,Ce=B.layoutIconSize.evaluate(Ee,{},c,b)*B.iconScaleFactor,ze={horizontal:{},vertical:void 0},Fe=Ee.text;let Be,De=[0,0];if(Fe){const Dr=Fe.toString(),ai=L.get("text-letter-spacing").evaluate(Ee,{},c)*fr,hi=L.get("text-line-height").evaluate(Ee,{},c)*fr,Ji=Im(Dr)?ai:0,vr=L.get("text-anchor").evaluate(Ee,{},c),Vi=L.get("text-variable-anchor");if(!Vi){const Wi=L.get("text-radial-offset").evaluate(Ee,{},c);if(Wi)De=Zn(vr,[Wi*fr,go]);else{const Qi=L.get("text-offset").evaluate(Ee,{},c);De=[Qi[0]*fr,Qi[1]*fr]}}let It=ne?"center":L.get("text-justify").evaluate(Ee,{},c);const zr=ie==="point",br=zr?L.get("text-max-width").evaluate(Ee,{},c)*fr:1/0,wr=Wi=>{r.allowVerticalPlacement&&ch(Dr)&&(ze.vertical=q(Fe,e,i,a,Ve,br,hi,vr,Wi,Ji,De,z.vertical,!0,Te,Ie,_,B.textScaleFactor))};if(!ne&&Vi){const Wi=It==="auto"?Vi.map(mr=>vy(mr)):[It];let Qi=!1;for(let mr=0;mr<Wi.length;mr++){const ji=Wi[mr];if(!ze.horizontal[ji])if(Qi)ze.horizontal[ji]=ze.horizontal[0];else{const yi=q(Fe,e,i,a,Ve,br,hi,"center",ji,Ji,De,z.horizontal,!1,Te,Ie,_,B.textScaleFactor);yi&&(ze.horizontal[ji]=yi,Qi=yi.positionedLines.length===1)}}wr("left")}else{if(It==="auto"&&(It=vy(vr)),zr||L.get("text-writing-mode").includes("horizontal")||!ch(Dr)){const Wi=q(Fe,e,i,a,Ve,br,hi,vr,It,Ji,De,z.horizontal,!1,Te,Ie,_,B.textScaleFactor);Wi&&(ze.horizontal[It]=Wi)}wr(zr?"left":It)}}let Ge,Ze,Qe,Xe,rt,vt,ft=!1;const xt=L.get("icon-text-fit").evaluate(Ee,{},c);if(Ee.icon&&Ee.icon.hasPrimary()){const Dr=su(Ee.icon,r.iconSizeData,V["icon-size"],c,r.zoom,Ee,_,B.iconScaleFactor,v,b);Ge=Dr.iconPrimary,Qe=Dr.iconSecondary;const ai=Ge.toString();if(Ze=o.get(ai),Ze&&(rt=L.get("icon-offset").evaluate(Ee,{},c),vt=L.get("icon-anchor").evaluate(Ee,{},c),Be=ve(a.get(ai),Qe?a.get(Qe.toString()):void 0,rt,vt),ft=Ze.sdf,r.sdfIcons===void 0?r.sdfIcons=Ze.sdf:r.sdfIcons!==Ze.sdf&&ht("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(Ze.pixelRatio!==r.pixelRatio||L.get("icon-rotate").constantOr(1)!==0)&&(r.iconsNeedLinear=!0)),Qe){const hi=Qe.toString();Xe=o.get(hi)}}ge=ge||!(!Ee.icon||!Ee.icon.hasSecondary());const mt=b_(ze.horizontal)||ze.vertical;r.iconsInText||(r.iconsInText=!!mt&&mt.iconsInText);const Rt=Te*B.textScaleFactor/fr,{defaultShapedIcon:ut,verticallyShapedIcon:Gt}=tb(r,Be,L,Ee,c,ze,Rt,rt,xt);xt!=="none"&&Be&&(Le(Be)||_e(Be))&&(sa(0,Ze,Ge,Be,ut,xt,y,o,a),sa(0,Xe,Qe,Be,ut,xt,y,o,a),Gt&&(sa(0,Ze,Ge,Be,Gt,xt,y,o,a),sa(0,Xe,Qe,Be,Gt,xt,y,o,a))),Be=ut;const{iconBBox:Nt,iconVerticalBBox:Wt,textBBox:qt,textVerticalBBox:Pi}=Wn(r,Be,Gt,L,Ee,c,Ce,rt,B,a,vt,ze,Te,De,b);we.push({feature:Ee,shapedTextOrientations:ze,shapedText:mt,shapedIcon:Be,iconPrimary:Ge,iconSecondary:Qe,iconOffset:rt,iconAnchor:vt,verticallyShapedIcon:Gt,layoutTextSize:Te,layoutIconSize:Ce,textOffset:De,isSDFIcon:ft,iconTextFit:xt,iconCollisionBounds:Nt,iconVerticalCollisionBounds:Wt,textCollisionBounds:qt,textVerticalCollisionBounds:Pi})}return{featureData:we,sizes:B,hasAnySecondaryIcon:ge,textAlongLine:ne,symbolPlacement:ie,coverageFrcMask:T,coveragePolygons:S,coverageTileZoom:C,isFeatureCoveredByFrcMask:P,symbolAnchorInFrcCoverage:R}},N.fW=kt,N.fX=Et,N.fY=gi,N.fZ=si,N.f_=function(r,e,i,o,a,c,h,f,_,y){r.iconAtlasPositions=y.iconPositions;const{featureData:v,sizes:b,textAlongLine:T,symbolPlacement:S,coveragePolygons:C,coverageTileZoom:P,symbolAnchorInFrcCoverage:R}=e,L=e.hasAnySecondaryIcon||r.hasAnySecondaryIcon;for(const V of v){const{shapedIcon:B,verticallyShapedIcon:G,feature:H,shapedTextOrientations:Z,shapedText:oe,layoutTextSize:X,textOffset:ee,isSDFIcon:ie,iconPrimary:ne,iconSecondary:fe,iconTextFit:ge,iconOffset:we,iconCollisionBounds:Se,iconVerticalCollisionBounds:Ee,textCollisionBounds:Ve}=V;Rx(B,y.iconPositions,ne,fe),Rx(G,y.iconPositions,ne,fe),eb(Z,y.iconPositions),Q1(ne,fe,y.iconPositions),(oe||B)&&ib(r,H,Z,B,G,_,b,X,0,ee,ie,o,a,h,f,L,ge,we,T,S,Se,Ee,Ve,0,0,C,P,R)}i&&r.generateCollisionDebugBuffers(c,r.collisionBoxArray,b.textScaleFactor),r.text.uboBinder&&r.text.uboBinder.finalize(),r.icon.uboBinder&&r.icon.uboBinder.finalize()},N.fa=Ba,N.fb=Os,N.fc=Di,N.fd=function([r,e,i]){const o=Math.hypot(r,e,i),a=Math.atan2(r,i),c=.5*Math.PI-Math.acos(-e/o);return new Kt(de(a),de(c))},N.fe=vu,N.ff=Yy,N.fg=function(r,e){jp=r,fc=e},N.fh=Dy,N.fi=qx,N.fj=function(r){const e=[0,0,0],i=ki(new Float64Array(16));return Ri(i,r.pixelMatrix,r.globeMatrix),Zi(e,e,i),new Ne(e[0],e[1])},N.fk=function(r,e){if(!r||!e)throw new Error("TileProvider name and URL are required");ii.TILE_PROVIDER_URLS[r]=Ki.resolveURL(e)},N.fl=fh,N.fm=function(r,e,i=!1){if(Kr===Dn.deferred||Kr===Dn.loading||Kr===Dn.loaded)throw new Error("setRTLTextPlugin cannot be called multiple times.");Js=Ki.resolveURL(r),Kr=Dn.deferred,af=e,dh(),i||Zt()},N.fn=function(r){ii.BUILDING_GEN_URL=Ki.resolveURL(r)},N.fo=ar,N.fp=function(r){const e=Ki.resolveURL(r);ii.MESHOPT_URL=e,ii.MESHOPT_SIMD_URL=e},N.fq=vi,N.fr=function(r){ii.DRACO_URL=Ki.resolveURL(r)},N.fs=jo,N.ft=function(r){const e=qp();if(!e)return;const i=e.delete(Up);r&&i.then(()=>r()).catch(r)},N.fu=function(r){ii.MAX_PARALLEL_IMAGE_REQUESTS=r},N.fv=function(r){ii.API_URL=r},N.fw=function(r){ii.ACCESS_TOKEN=r},N.fx="hd_road_elevation",N.fy=class{static parseFrom(r,e){const i=Ya.parse(r);if(!i)return[];let{vertices:o,features:a}=i;const c=1/zn(e);a.sort((y,v)=>y.id-v.id),o.sort((y,v)=>y.id-v.id||y.idx-v.idx),o=o.filter((y,v,b)=>v===b.findIndex(T=>T.id===y.id&&T.idx===y.idx));const h=new Array;let f=0;const _=o.length;for(const y of a){if(y.constantHeight){h.push(new Ka(y.id,y.bounds,y.constantHeight));continue}for(;f!==_&&o[f].id<y.id;)f++;if(f===_||o[f].id!==y.id)continue;const v=new Array,b=new Array,T=f;for(;f!==_&&o[f].id===y.id;){const S=o[f];if(v.push({position:S.position,height:S.height,extent:S.extent,index:S.idx}),f!==T&&o[f-1].idx===S.idx-1){const C=f-T;b.push({a:C-1,b:C})}f++}h.push(new Ka(y.id,y.bounds,void 0,v,b,c))}return h}},N.fz=Xa,N.g=ii,N.g0=function(r){return r<=1?1:Math.pow(2,Math.floor(Math.log2(r)))},N.g1=gg,N.g2=ra,N.g3=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.length=this.buf.length}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*xy),!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*xy),!0),this.pos+=8}writeVarint(r){if((r=+r||0)>=0&&r<128)return this.pos>=this.length&&this.realloc(1),void(this.buf[this.pos++]=r);r>268435455||r<0?(function(e,i){let o,a;if(e>=0?(o=e%4294967296|0,a=e/4294967296|0):(o=~(-e%4294967296),a=~(-e/4294967296),4294967295^o?o=o+1|0:(o=0,a=a+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");i.realloc(10),(function(c,h,f){f.buf[f.pos++]=127&c|128,c>>>=7,f.buf[f.pos++]=127&c|128,c>>>=7,f.buf[f.pos++]=127&c|128,c>>>=7,f.buf[f.pos++]=127&c|128,f.buf[f.pos]=127&(c>>>=7)})(o,0,i),(function(c,h){const f=(7&c)<<4;h.buf[h.pos++]|=f|((c>>>=3)?128:0),c&&(h.buf[h.pos++]=127&c|((c>>>=7)?128:0),c&&(h.buf[h.pos++]=127&c|((c>>>=7)?128:0),c&&(h.buf[h.pos++]=127&c|((c>>>=7)?128:0),c&&(h.buf[h.pos++]=127&c|((c>>>=7)?128:0),c&&(h.buf[h.pos++]=127&c)))))})(a,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(o,a,c){for(let h,f,_=0;_<a.length;_++){if(h=a.charCodeAt(_),h>55295&&h<57344){if(!f){h>56319||_+1===a.length?(o[c++]=239,o[c++]=191,o[c++]=189):f=h;continue}if(h<56320){o[c++]=239,o[c++]=191,o[c++]=189,f=h;continue}h=f-55296<<10|h-56320|65536,f=null}else f&&(o[c++]=239,o[c++]=191,o[c++]=189,f=null);h<128?o[c++]=h:(h<2048?o[c++]=h>>6|192:(h<65536?o[c++]=h>>12|224:(o[c++]=h>>18|240,o[c++]=h>>12&63|128),o[c++]=h>>6&63|128),o[c++]=63&h|128)}return c})(this.buf,r,this.pos);const i=this.pos-e;i>=128&&l(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),this.buf.set(r,this.pos),this.pos+=e}writeRawMessage(r,e){this.pos++;const i=this.pos;r(e,this);const o=this.pos-i;o>=128&&l(i,o,this),this.pos=i-1,this.writeVarint(o),this.pos+=o}writeMessage(r,e,i){this.writeTag(r,2),this.writeRawMessage(e,i)}writePackedVarint(r,e){e.length&&this.writeMessage(r,d,e)}writePackedSVarint(r,e){e.length&&this.writeMessage(r,p,e)}writePackedBoolean(r,e){e.length&&this.writeMessage(r,x,e)}writePackedFloat(r,e){e.length&&this.writeMessage(r,m,e)}writePackedDouble(r,e){e.length&&this.writeMessage(r,g,e)}writePackedFixed32(r,e){e.length&&this.writeMessage(r,w,e)}writePackedSFixed32(r,e){e.length&&this.writeMessage(r,E,e)}writePackedFixed64(r,e){e.length&&this.writeMessage(r,A,e)}writePackedSFixed64(r,e){e.length&&this.writeMessage(r,I,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)}},N.g4=function(r){let e=0;if(new Uint32Array(r,0,1)[0]!==Dv){const i=new Uint32Array(r,0,7),[,,o,a,c,h]=i;e=i.byteLength+a+c+h+c,(o!==r.byteLength||e>=r.byteLength)&&ht("Invalid b3dm header information.")}return Ov(r,e)},N.g5=function(r,e){const i=r.json.extensionsUsed&&r.json.extensionsUsed.includes("mbx_bvh"),o=rx(r);for(const a of o){if(!i)for(const c of a.meshes)uw(c);a.lights&&(a.lightMeshIndex=a.meshes.length,a.meshes.push(hw(a.lights,e)))}return o},N.g6=mg,N.g7=Ai,N.g8=Wo,N.g9=Dn,N.ga=function(r){nn(),hs?.then(e=>{e.keys().then(i=>{for(let o=0;o<i.length-r;o++)e.delete(i[o]).catch(a=>ht(a.message))}).catch(i=>ht(i.message))}).catch(e=>ht(e.message))},N.h=async function(r,e){return mc(Object.assign(r,{method:"GET"}),e)},N.i=function(r){return ii.API_STYLE_REGEX.test(r)&&!cd(r)},N.j=function(r){return btoa(encodeURIComponent(r).replace(/%([0-9A-F]{2})/g,(e,i)=>String.fromCharCode(+("0x"+i))))},N.k=kr,N.l=function(r){return decodeURIComponent(atob(r).split("").map(e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)).join(""))},N.m=pe,N.n=Fl,N.o=Go,N.p=async function(r,e){return mc(Object.assign(r,{method:"POST"}),e)},N.q=async function(r,e){kr.supported&&(r.headers||(r.headers={}),r.headers.accept="image/webp,*/*");const i=await(function(o){return new Promise((a,c)=>{if(o&&o.aborted)return void c(o.reason);const h=()=>{const y=vl.shift();y?y():Su--};if(Su<ii.MAX_PARALLEL_IMAGE_REQUESTS)return Su++,void a(h);const f=()=>{o&&o.removeEventListener("abort",_),a(h)},_=()=>{const y=vl.indexOf(f);y!==-1&&vl.splice(y,1),c(o.reason)};o&&o.addEventListener("abort",_),vl.push(f)})})(e);try{const{data:o,headers:a}=await xl(r,e);let c;try{c=await createImageBitmap(new Blob([new Uint8Array(o)],{type:"image/png"}))}catch(h){throw new Error(`Could not load image because of ${h.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`,{cause:h})}return e&&e.throwIfAborted(),{data:c,headers:a}}finally{i()}},N.r=Ki,N.s=function(r){try{const e=self[r];return e.setItem("_mapbox_test_",1),e.removeItem("_mapbox_test_"),!0}catch{return!1}},N.t=Or,N.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)})()},N.v=function(r){return!!r&&Tu.test(r)},N.w=ht,N.x=pn,N.y=hf,N.z=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.currentFrameAtlases=new Set,this.finalizationRegistry=new FinalizationRegistry(e=>{this.cache.delete(e),this.clearExpiredTextures()})}beginFrame(){this.currentFrameAtlases.clear()}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[o]of this.textures.entries()){if(this.currentFrameAtlases.has(o))continue;const a=this.textureAccessTimes.get(o)||0;a<i&&(i=a,e=o)}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 o=i.deref();if(o&&o.contentDescriptor){const a=r.subsetOf(o.contentDescriptor),c=this.isMipmapCompatible(r,o.contentDescriptor);if(a&&c)return o}}}getTextureForAtlas(r,e,i){this.textureAccessTimes.set(r,performance.now()),this.currentFrameAtlases.add(r);let o=this.textures.get(r);if(o)return o;if(r.image){const a=this.calculateTextureMemory(r);return this.evictTexturesIfNeeded(a),o=new Ht(e,r.image,i,{useMipmap:!!r.patternPositions.size}),this.textures.set(r,o),this.textureMemoryUsed+=a,o}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 a=this.cache.get(r.sourceAtlasHash);if(a){const c=a.deref();if(c)return c}return ht("ImageAtlasReference points to GC'd atlas - atlas may have been evicted"),null}if(!r.contentDescriptor)return r;const e=r.contentDescriptor,i=e.hash,o=this.cache.get(i);if(o){const a=o.deref();if(a&&a.contentDescriptor&&this.isMipmapCompatible(e,a.contentDescriptor))return a}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}}}),gu(["require","./shared"],function(u,N){function jr(de){const F=de?de.url.toString():void 0;return F?performance.getEntriesByName(F):[]}function Gi(de,F){if(Object.hasOwn(de.layers,N.fx))return N.fy.parseFrom(de.layers[N.fx],F)}function il({buckets:de,data:F,sourceLayerCoder:j,canonical:re,options:te}){if(!te.elevationFeatures||te.elevationFeatures.length===0)return;const ce=[];for(const ye of Object.values(de))if(ye instanceof N.cZ&&ye.hdExt){const K=ye.hdExt.getUnevaluatedPortalGraph();K&&ce.push(K)}const le=N.fz.evaluate(ce);for(const ye of Object.values(de))if(ye instanceof N.cZ&&ye.hdExt){const K=F.layers[j.decode(ye.sourceLayerIndex)];ye.hdExt.setEvaluatedPortalGraph(le,K,re,te.availableImages,te.brightness,ye.worldview)}}function No(de){const F=[];for(let j=0;j<de.length;j++){const re=de.feature(j),te=re.properties.frc_mask;if(te==null)continue;const ce=Number(te);if(!ce)continue;const le=re.loadGeometry();if(le.length>0){let K=!1;for(const be of le[0])if(be.x<0||be.x>N.aj||be.y<0||be.y>N.aj){K=!0;break}if(K)continue}const ye=le.length===1&&le[0].length===5&&le[0].some(K=>K.x<=0&&K.y<=0)&&le[0].some(K=>K.x>=N.aj&&K.y<=0)&&le[0].some(K=>K.x>=N.aj&&K.y>=N.aj)&&le[0].some(K=>K.x<=0&&K.y>=N.aj);F.push(new N.fA(ce,ye?[]:le))}return F}function yu(de,F,j,re,te){const ce=N.fB(F);if(ce===null)return!1;let le=j.x,ye=j.y;const K=te??re.z;if(re.z!==K){const be=1<<re.z-K,Oe=N.aj/be;le=re.x%be*Oe+j.x/be,ye=re.y%be*Oe+j.y/be}for(const be of de){if(!(be.hasGeometry()&&be.frcMask&1<<ce))continue;const Oe=be.rings.map(qe=>qe.map(Ye=>[Ye.x,Ye.y]));if(N.fC([le,ye],Oe))return!0}return!1}function rl(de,F,j,re){const te=F.indoorState.activeFloorsVisible;if(!F.sourceLayers)return te?F.indoorState.activeFloors:void 0;const ce=(function(K,be){if(!K)return N.w("No source layers defined in indoor specification"),be;if(K.size===0)return be;const Oe=K.difference(be);for(const qe of Oe)N.w(`Missing source layer required in indoor specification: ${qe}`);return be.intersection(be)})(F.sourceLayers,new Set(Object.keys(de.layers))),le=F.indoorState,ye=(function(K,be,Oe,qe,Ye){const st={};for(const ot of be){const Xt=K.layers[ot];if(Xt)for(let St=0;St<Xt.length;St++){const ht=Xt.feature(St);if(Gr(ht)){const{id:Vt,center:di}=bo(ht);ni(st,Vt,di);continue}if(ts(ht)){const Vt=Ri(ht,Ye);ki(st,Vt.buildings,Vt.id,Vt)}}else N.w(`indoor source layer not found: ${ot}`)}return{buildings:st,activeFloors:N.cL.calculate(st,qe,Oe)}})(de,ce,le.activeFloors,le.selectedFloorId,re);return j.notify("setIndoorData",ye),te?ye.activeFloors:void 0}function ni(de,F,j){de[F]?j&&(de[F].center=j):de[F]={floorIds:new Set,center:j||[0,0],floors:{}}}function ki(de,F,j,re){for(const te of F)ni(de,te),de[te].floors[j]=re,de[te].floorIds.add(j)}function bo(de){return{id:de.properties.id.toString(),center:[de.properties.center_lon||0,de.properties.center_lat||0]}}function Ri(de,F){const j=de.properties.id.toString(),re=!!de.properties.is_default&&de.properties.is_default,te=de.properties.connected_floor_ids?new Set(de.properties.connected_floor_ids.toString().split(";")):new Set,ce=de.properties.conflicted_floor_ids?new Set(de.properties.conflicted_floor_ids.toString().split(";")):new Set,le=de.properties.structure_ids?new Set(de.properties.structure_ids.toString().split(";")):new Set,ye=de.properties.name.toString(),K=de.properties.z_index,be=(function(Oe,qe){const Ye=Oe.loadGeometry();if(!Ye||Ye.length===0)return;const st=Ye.map(ot=>ot.map(Xt=>N.fD(Xt,qe,Oe.extent)));return st.length===0?void 0:{type:"Polygon",coordinates:[st[0]]}})(de,F);return{id:j,isDefault:re,connections:te,conflicts:ce,buildings:le,name:ye,zIndex:K,geometry:be}}function wn(de,F){return F.every(j=>de.properties&&de.properties[j]!=null)}function Gr(de){return wn(de,["type","id","name"])&&de.properties.type==="structure"}function ts(de){return wn(de,["type","id","name","z_index"])&&de.properties.type==="floor"}function wo(de,F){de instanceof N.cZ?N.fE(de,F):de instanceof N.cY?N.fF(de,F):de instanceof N.fG?N.fH(de):de instanceof N.cS&&N.fI(de)}function Tn(de){for(const F in de){const j=de[F];if(j instanceof N.cY&&j.hdExt&&j.hdExt.hasDeferredElevationFeatures)return!0}return!1}function eo(de){if(typeof de=="number"||typeof de=="boolean"||typeof de=="string"||de==null)return JSON.stringify(de);if(Array.isArray(de)){let j="[";for(const re of de)j+=`${eo(re)},`;return`${j}]`}let F="{";for(const j of Object.keys(de).sort())F+=`${j}:${eo(de[j])},`;return`${F}}`}function fa(de){let F="";for(const j of N.dW)F+=`/${eo(de[j])}`;return F}function nl(de,F){return(function j(re){return typeof re=="string"&&re===F||(Array.isArray(re)?re.some(j):!(!re||typeof re!="object")&&Object.values(re).some(j))})(de)}class sc{constructor(F){this.keyCache=Object.create(null),this._layers=Object.create(null),this._layerConfigs=Object.create(null),F&&this.replace(F)}replace(F,j){this._layerConfigs=Object.create(null),this._layers=Object.create(null),this.update(F,[],j)}update(F,j,re){this._options=re;for(const ce of F)this._layerConfigs[ce.id]=ce,(this._layers[ce.id]=N.eo(ce,this.scope,null,this._options)).compileFilter(re),this.keyCache[ce.id]&&delete this.keyCache[ce.id];for(const ce of j)delete this.keyCache[ce],delete this._layerConfigs[ce],delete this._layers[ce];this.familiesBySource=Object.create(null);const te=(function(ce,le){const ye=Object.create(null);for(let be=0;be<ce.length;be++){const Oe=ce[be];let qe=le&&le[Oe.id];qe||(Oe.type==="symbol"?qe=Oe.id:(qe=fa(Oe),Oe.type==="line"&&Oe.paint&&(nl(Oe.paint["line-width"],"line-progress")&&(qe+=`/${eo(Oe.paint["line-width"])}`),nl(Oe.paint["line-emissive-strength"],"line-progress")&&(qe+=`/${eo(Oe.paint["line-emissive-strength"])}`)))),le&&(le[Oe.id]=qe);let Ye=ye[qe];Ye||(Ye=ye[qe]=[]),Ye.push(Oe)}const K=[];for(const be in ye)K.push(ye[be]);return K})(Object.values(this._layerConfigs),this.keyCache);for(const ce of te){const le=ce.map(Ye=>this._layers[Ye.id]),ye=le[0];if(ye.visibility==="none")continue;const K=ye.source||"";let be=this.familiesBySource[K];be||(be=this.familiesBySource[K]=Object.create(null));const Oe=ye.sourceLayer||"_geojsonTileLayer";let qe=be[Oe];qe||(qe=be[Oe]=[]),qe.push(le)}}}const pa=1*N.fL;class zs{constructor(F){const j={},re=[];for(const ye in F){const K=F[ye],be=j[ye]={};for(const Oe in K.glyphs){const qe=K.glyphs[+Oe];if(!qe||qe.bitmap.width===0||qe.bitmap.height===0)continue;const Ye=qe.metrics.localGlyph?pa:1,st={x:0,y:0,w:qe.bitmap.width+2*Ye,h:qe.bitmap.height+2*Ye};re.push(st),be[Oe]=st}}const{w:te,h:ce}=N.H(re),le=new N.fK({width:te||1,height:ce||1});for(const ye in F){const K=F[ye];for(const be in K.glyphs){const Oe=K.glyphs[+be];if(!Oe||Oe.bitmap.width===0||Oe.bitmap.height===0)continue;const qe=j[ye][be],Ye=Oe.metrics.localGlyph?pa:1;N.fK.copy(Oe.bitmap,le,{x:0,y:0},{x:qe.x+Ye,y:qe.y+Ye},Oe.bitmap)}}this.image=le,this.positions=j}}function ti(de){for(const F of de)if(F.hdExt!=null||F.requiresHDRuntime)return!0;return!1}function ma(de){for(const F of de)if(F.requiresStandardRuntime)return!0;return!1}N.fJ(zs,"GlyphAtlas");class Bn{constructor(F){this.tileID=new N.bp(F.tileID.overscaledZ,F.tileID.wrap,F.tileID.canonical.z,F.tileID.canonical.x,F.tileID.canonical.y),this.tileZoom=F.tileZoom,this.uid=F.uid,this.zoom=F.zoom,this.lut=F.lut,this.canonical=F.tileID.canonical,this.pixelRatio=F.pixelRatio,this.tileSize=F.tileSize,this.source=F.source,this.scope=F.scope,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=F.showCollisionBoxes,this.showElevationIdDebug=F.showElevationIdDebug,this.collectResourceTiming=!!F.request&&F.request.collectResourceTiming,this.promoteId=F.promoteId,this.renderSourceType=F.renderSourceType,this.frcCoverage=F.frcCoverage||null,this.elevation=F.elevation||null,this.crossSourceElevationEnabled=!!F.crossSourceElevationEnabled,this.terrainEnabled=!!F.terrainEnabled,this.deferRoadStructure=!1,this.tileTransform=N.cN(F.tileID.canonical,F.projection),this.projection=F.projection,this.worldview=F.worldview,this.localizableLayerIds=F.localizableLayerIds,this.brightness=F.brightness,this.extraShadowCaster=!!F.extraShadowCaster,this.tessellationStep=F.tessellationStep,this.scaleFactor=F.scaleFactor,this.worldview=F.worldview,this.indoor=F.indoor}isLayerActiveForTile(F){return!(this.renderSourceType===N.dz.Symbol&&F.type!=="symbol"||this.renderSourceType===N.dz.FillExtrusion&&F.type!=="fill-extrusion"||this.renderSourceType===N.dz.Other&&(F.type==="symbol"||F.type==="fill-extrusion")||this.renderSourceType===N.dz.HdRoadElevation||F.minzoom&&this.zoom<Math.floor(F.minzoom)||F.maxzoom&&this.zoom>=F.maxzoom||F.visibility==="none")}parse(F,j,re,te,ce,le){this._parseAfterHD(F,j,re,te,ce,le)}_parseAfterHD(F,j,re,te,ce,le){let ye;if(this.status="parsing",this.data=F,this.renderSourceType===N.dz.HdRoadCoverage){const St=F.layers[N.dB];ye=St&&No?No(St):[]}this.collisionBoxArray=new N.cR;const K=new N.fM(Object.keys(F.layers).sort()),be=new N.fN(this.tileID,this.promoteId);be.bucketLayerIDs=[];const Oe={},qe=new N.fO(256,256),Ye={featureIndex:be,iconDependencies:new Map,patternDependencies:new Map,glyphDependencies:{},lineAtlas:qe,availableImages:re,brightness:this.brightness,scaleFactor:this.scaleFactor,showElevationIdDebug:this.showElevationIdDebug,elevationFeatures:void 0,elevationParams:this.elevation,crossSourceElevationEnabled:this.crossSourceElevationEnabled,terrainEnabled:this.terrainEnabled,activeFloors:void 0};this.indoor&&rl&&(Ye.activeFloors=rl(F,this.indoor,ce,this.canonical));const st=[],ot=j.familiesBySource[this.source];if(this.renderSourceType===N.dz.HdRoadElevation){const St=Gi&&Gi(F,this.canonical)||[],ht=new zs({});return this.status="done",void le(null,{buckets:[],containsHdExt:!1,containsStandardExt:!1,featureIndex:be,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:ht.image,lineAtlas:qe,imageAtlas:null,brightness:this.brightness,parsedElevationFeatures:St})}if(this.deferRoadStructure=!1,this.renderSourceType!==N.dz.HdRoadCoverage&&this.frcCoverage!=null&&!this.frcCoverage.resolved&&this.frcCoverage.frcMask===null){for(const St in ot)if(N.fP&&N.fP(this.frcCoverage.sourceLayers,this.source,St)){this.deferRoadStructure=!0;break}}for(const St in ot){const ht=F.layers[St];if(!ht)continue;let Vt=!1,di=!1,Ai=!1,tr=!1;for(const Ci of ot[St])Ci[0].type==="symbol"?Vt=!0:Ci[0].type==="fill-extrusion"?di=!0:Ai=!0,Ci[0].is3D()&&Ci[0].type!=="model"&&(tr=!0);if(this.extraShadowCaster&&!tr||this.renderSourceType===N.dz.Symbol&&!Vt||this.renderSourceType===N.dz.FillExtrusion&&!di||(this.renderSourceType===N.dz.Other||this.renderSourceType===N.dz.HdRoadCoverage)&&!Ai)continue;const sr=this.frcCoverage!=null&&!!N.fP&&N.fP(this.frcCoverage.sourceLayers,this.source,St);if(this.deferRoadStructure&&sr)continue;ht.version===1&&N.w(`Vector tile source "${this.source}" layer "${St}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const qi=K.encode(St),Tr=[],io=this.localizableLayerIds&&this.localizableLayerIds.has(St);let Sn=!1;for(let Ci=0,zi=0;Ci<ht.length;Ci++){const Yi=ht.feature(Ci),xi=be.getId(Yi,St),Hi=Yi.properties?Yi.properties.worldview:null;if(io&&this.worldview&&typeof Hi=="string")if(Hi==="all")Yi.properties.$localized=!0;else{if(!Hi.split(",").includes(this.worldview))continue;Yi.properties.$localized=!0,Yi.properties.worldview=this.worldview}!Sn&&Yi.properties&&Object.hasOwn(Yi.properties,N.fQ)&&(Sn=!0),sr&&this.frcCoverage&&this.frcCoverage.frcMask&&Yi.properties&&N.fR&&N.fR(Yi.properties,this.frcCoverage.frcMask)||(Tr.push({feature:Yi,id:xi,index:zi,sourceLayerIndex:qi}),zi++)}Sn&&!Ye.elevationFeatures&&Gi&&(Ye.elevationFeatures=Gi(F,this.canonical));for(const Ci of ot[St]){const zi=Ci[0];if(this.extraShadowCaster&&(!zi.is3D()||zi.type==="model")||this.renderSourceType===N.dz.Symbol&&zi.type!=="symbol"||this.renderSourceType===N.dz.FillExtrusion&&zi.type!=="fill-extrusion"||!(this.renderSourceType!==N.dz.Other&&this.renderSourceType!==N.dz.HdRoadCoverage||zi.type!=="symbol"&&zi.type!=="fill-extrusion")||!this.isLayerActiveForTile(zi))continue;Cr(Ci,this.zoom,Ye.brightness,re,this.worldview,Ye.activeFloors);const Yi=be.bucketLayerIDs.length;be.bucketLayerIDs.push(Ci.map(Hi=>N.y(Hi.id,Hi.scope)));const xi=()=>{const Hi=Oe[zi.id]=zi.createBucket({index:Yi,layers:Ci,zoom:this.zoom,lut:this.lut,canonical:this.canonical,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:qi,sourceLayerName:St,sourceID:this.source,projection:this.projection.spec,tessellationStep:this.tessellationStep,styleDefinedModelURLs:te,worldview:this.worldview,localizable:io,availableImages:re,maxUniformBufferBindings:this.maxUniformBufferBindings,maxUniformBlockSizeDwords:this.maxUniformBlockSizeDwords});wo&&wo(Hi,this.frcCoverage?this.frcCoverage.sourceLayers:null),Hi.populate(Tr,Ye,this.tileID.canonical,this.tileTransform)};zi.mayUse("HD")||zi.mayUse("Standard")?st.push(zi.prepare().then(()=>xi())):xi()}}const Xt=()=>{qe.trim();const St=!(!Ye.elevationFeatures||!Ye.elevationFeatures.some(Ci=>Ci.heightRange.min<0));let ht,Vt,di,Ai,tr,sr,qi;const Tr={type:"maybePrepare",renderSourceType:this.renderSourceType,zoom:this.zoom},io=()=>{if(ht)return this.status="done",le(ht);if(this.extraShadowCaster){this.status="done";const Ci=Object.values(Oe).filter(Yi=>!Yi.isEmpty()),zi=Ye.elevationFeatures;le(null,{buckets:Ci,containsHdExt:ti(Ci),containsStandardExt:ma(Ci),featureIndex:be,collisionBoxArray:null,hasTunnelGeometry:St,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:Ye.brightness,hasDeferredElevationFeatures:!!Tn&&Tn(Oe),parsedElevationFeatures:zi,glyphMap:null,iconMap:null,glyphPositions:null})}else if(Vt&&di&&Ai&&qi){const zi=new zs(Vt),Yi=new Map;for(const[Hi,pn]of di.entries()){const{imagePosition:Ki}=N.fT(Hi,pn,N.fU);Yi.set(Hi,Ki)}const xi={};for(const Hi in Oe){const pn=Oe[Hi];pn instanceof N.cS&&(Cr(pn.layers,this.zoom,Ye.brightness,re,this.worldview,Ye.activeFloors),xi[Hi]=N.fV(pn,Vt,zi.positions,di,Yi,this.tileID.canonical,this.tileZoom,this.scaleFactor,this.pixelRatio,tr,this.worldview,re,this.frcCoverage?this.frcCoverage.frcMask:null,this.frcCoverage?this.frcCoverage.polygons:null,this.frcCoverage?this.frcCoverage.tileZoom:null,N.fR||null,yu||null))}tr.size||sr.size?this.rasterizeTask=ce.sendCancelable("rasterizeImages",{scope:this.scope,iconTasks:tr,patternTasks:sr},{},(Hi,pn)=>{if(!Hi)for(const[Ki,So]of pn.entries())di.has(Ki)&&di.set(Ki,Object.assign(di.get(Ki),{data:So})),Ai.has(Ki)&&Ai.set(Ki,Object.assign(Ai.get(Ki),{data:So}));Sn(xi,zi,void 0,qi)}):Sn(xi,zi,void 0,qi)}},Sn=(Ci,zi,Yi,xi)=>{const Hi=di.size>0||Ai.size>0,pn=Object.keys(Ci).length>0,Ki=Ye.elevationFeatures;if(!Hi&&!pn){this.status="done";const ii=Object.values(Oe).filter(jo=>!jo.isEmpty());return void le(null,{buckets:ii,containsHdExt:ti(ii),containsStandardExt:ma(ii),featureIndex:be,collisionBoxArray:this.collisionBoxArray,hasTunnelGeometry:St,glyphAtlasImage:zi.image,lineAtlas:qe,imageAtlas:null,brightness:Ye.brightness,hasDeferredRoadStructure:this.deferRoadStructure,frcCoveragePolygons:ye,hasDeferredElevationFeatures:!!Tn&&Tn(Oe),parsedElevationFeatures:Ki})}const So=(ii,jo)=>{for(const ar in Oe){const kr=Oe[ar];if(ar in Ci)N.f_(kr,Ci[ar],this.showCollisionBoxes,re,this.tileID.canonical,this.tileZoom,this.projection,this.brightness,di,jo);else if(kr.hasPattern&&(kr instanceof N.cY||kr instanceof N.cZ||kr instanceof N.cB)){Cr(kr.layers,this.zoom,Ye.brightness,re,this.worldview,Ye.activeFloors);const mn=Object.fromEntries(jo.patternPositions);kr.addFeatures(Ye,this.tileID.canonical,mn,re,this.tileTransform,this.brightness)}}this.status="done";const vi=Object.values(Oe).filter(ar=>!ar.isEmpty());le(null,{buckets:vi,containsHdExt:ti(vi),containsStandardExt:ma(vi),featureIndex:be,collisionBoxArray:this.collisionBoxArray,hasTunnelGeometry:St,glyphAtlasImage:zi.image,lineAtlas:qe,imageAtlas:ii,brightness:Ye.brightness,hasDeferredRoadStructure:this.deferRoadStructure,frcCoveragePolygons:ye,hasDeferredElevationFeatures:!!Tn&&Tn(Oe),parsedElevationFeatures:Ki})};if(Hi){const ii=new Map,jo=N.fW(di,ii),vi=N.fW(Ai,ii),ar=new N.fX(jo,vi,xi,this.lut,ii);ce.send("checkAtlasCache",{descriptor:ar,scope:this.scope}).then(kr=>{let mn,Nr;if(kr)mn=new N.fY(kr.sourceHash),Nr=kr;else{const _l=new N.fZ(di,Ai,this.lut,xi);mn=_l,Nr=_l}So(mn,Nr)}).catch(kr=>{kr.name!=="AbortError"&&N.w(`[Worker] Error checking atlas cache: ${kr.message}`);const mn=new N.fZ(di,Ai,this.lut,xi);So(mn,mn)})}else So(null,{iconPositions:new Map,patternPositions:new Map})};if(!this.extraShadowCaster){const Ci=N.fS(Ye.glyphDependencies,xi=>Object.keys(xi).map(Number));Object.keys(Ci).length?ce.send("getGlyphs",{uid:this.uid,stacks:Ci},{metadata:Tr}).then(xi=>{ht||(Vt=xi,io())}).catch(xi=>{ht||(ht=xi,io())}):Vt={},qi=new Map;const zi=Array.from(Ye.iconDependencies.keys()).map(xi=>N.I.parse(xi)),Yi=Array.from(Ye.patternDependencies.keys()).map(xi=>N.I.parse(xi));zi.length||Yi.length?ce.send("getImages",{icons:zi,patterns:Yi,source:this.source,scope:this.scope,tileID:this.tileID},{metadata:Tr}).then(xi=>{if(!ht){di=new Map,Ai=new Map,tr=this.updateImageMapAndGetImageTaskQueue(di,xi.images,Ye.iconDependencies),sr=this.updateImageMapAndGetImageTaskQueue(Ai,xi.images,Ye.patternDependencies);for(const[Hi,pn]of xi.versions.entries())qi.set(Hi,pn);io()}}).catch(xi=>{ht||(ht=xi,io())}):(di=new Map,Ai=new Map,tr=new Map,sr=new Map)}il&&il({buckets:Oe,data:F,sourceLayerCoder:K,canonical:this.tileID.canonical,options:Ye}),io()};st.length>0?Promise.allSettled(st).then(Xt).catch(le):Xt()}updateParameters(F){this.scaleFactor=F.scaleFactor,this.showCollisionBoxes=F.showCollisionBoxes,this.showElevationIdDebug=F.showElevationIdDebug,this.projection=F.projection,this.brightness=F.brightness,this.tileTransform=N.cN(F.tileID.canonical,F.projection),this.extraShadowCaster=F.extraShadowCaster,this.lut=F.lut,this.worldview=F.worldview,this.indoor=F.indoor,this.frcCoverage=F.frcCoverage||null,this.elevation=F.elevation||null,this.terrainEnabled=!!F.terrainEnabled}updateImageMapAndGetImageTaskQueue(F,j,re){const te=new Map;for(const ce of j.keys()){const le=re.get(ce)||[];for(const ye of le){const K=ye.toString(),be=j.get(ye.id.toString());be.usvg?te.has(K)||(te.set(K,ye),F.set(K,{...be})):F.set(K,be)}}return te}cancelRasterize(){this.rasterizeTask&&this.rasterizeTask.abort()}}function Cr(de,F,j,re,te,ce){const le=new N.aa(F,{brightness:j,worldview:te,activeFloors:ce});for(const ye of de)ye.recalculate(le,re)}class Di extends N.E{constructor({actor:F,layerIndex:j,availableImages:re,availableModels:te,isSpriteLoaded:ce,tileProvider:le,brightness:ye,maxUniformBufferBindings:K,maxUniformBlockSizeDwords:be}){super(),this.actor=F,this.layerIndex=j,this.availableImages=re,this.availableModels=te,this.loadVectorData=N.dN,this.tileProvider=le,this.loading={},this.loaded={},this.deduped=new N.dM(F.scheduler),this.isSpriteLoaded=ce,this.scheduler=F.scheduler,this.brightness=ye,this.maxUniformBufferBindings=K,this.maxUniformBlockSizeDwords=be}loadTileData(F,j){if(!this.tileProvider)return this.loadVectorData(F,j);const re=new AbortController;return this.loadTileWithProvider(this.tileProvider,F,re,j),()=>re.abort()}async loadTileWithProvider(F,j,re,te){const{z:ce,x:le,y:ye}=j.tileID.canonical;try{const K=await F.loadTile({z:ce,x:le,y:ye},{request:j.request,signal:re.signal});if(re.signal.aborted)return;if(K==null){const Oe=new Error("Tile not found");return Oe.status=404,te(Oe)}if(K.data==null)return te(null,null);if(K.data instanceof ImageBitmap)return te(new Error("Vector tiles require ArrayBuffer data"));const be=new Headers;K.expires&&be.set("expires",K.expires),K.cacheControl&&be.set("cache-control",K.cacheControl),te(null,{rawData:K.data,headers:be})}catch(K){if(re.signal.aborted)return;te(K instanceof Error?K:new Error(String(K)))}}_fetchTileData(F,j){return new Promise((re,te)=>{F.abort=this.loadTileData(j,(ce,le)=>{ce?te(ce):re(le)})})}async _parse(F,j){const re=!this.isSpriteLoaded;return re&&await this.once("isSpriteLoaded"),new Promise((te,ce)=>{const le=()=>F.parse(F.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,(ye,K)=>{ye?ce(ye):te(K)});re&&this.scheduler?this.scheduler.add(le,{type:"parseTile",renderSourceType:j.renderSourceType,zoom:j.tileZoom}):le()})}async loadTile(F){const j=F.uid,re=F&&F.request,te=re&&re.collectResourceTiming,ce=this.loading[j]=new Bn(F);ce.maxUniformBufferBindings=this.maxUniformBufferBindings,ce.maxUniformBlockSizeDwords=this.maxUniformBlockSizeDwords;const le=(ot,Xt)=>{const St=ce.reloadCallback;St&&(delete ce.reloadCallback,ot||!Xt?St(ot,null):ce.parse(ce.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,St))};let ye,K;try{ye=await this._fetchTileData(ce,F)}catch(ot){K=ot}const be=!this.loading[j];if(delete this.loading[j],ce.cancelRasterize(),K||be||!ye){if(ce.status="done",be||(this.loaded[j]=ce),K)throw K;return null}const Oe=ye.rawData;let qe;ce.vectorTile=ye.vectorTile||new N.f$(new N.d8(Oe)),this.loaded=this.loaded||{},this.loaded[j]=ce;try{qe=await this._parse(ce,F)}catch(ot){throw le(ot),ot}if(!qe)return le(null,null),null;const Ye={};if(te){const ot=jr(re);ot.length>0&&(Ye.resourceTiming=JSON.parse(JSON.stringify(ot)))}const st={rawTileData:Oe.slice(0),headers:ye.headers,...qe,...Ye};return le(null,qe),st}async reloadTile(F){const j=this.loaded,re=F.uid;if(j&&j[re])return new Promise((te,ce)=>{const le=j[re];le.updateParameters(F);const ye=(K,be)=>{const Oe=le.reloadCallback;Oe&&(delete le.reloadCallback,le.parse(le.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,Oe)),K?ce(K):te(be)};le.status==="parsing"?le.reloadCallback=ye:le.status==="done"?le.vectorTile?le.parse(le.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,ye):ye():te(void 0)})}abortTile(F){const j=F.uid,re=this.loading[j];re&&(re.abort&&re.abort(),delete this.loading[j])}removeTile(F){const j=this.loaded,re=F.uid;j&&j[re]&&delete j[re]}}class gr{constructor(F){this.tileProvider=F.tileProvider,this.loading={}}async loadTile(F){const j=F.uid,re=new AbortController;if(this.loading[j]={cancel:()=>re.abort()},this.tileProvider)return this.loadTileWithProvider(this.tileProvider,j,F,re);try{const{data:te,headers:ce}=await N.d9(F.request,re.signal);if(!te)return null;const le=await this.decodeTile(j,te,F.encoding);return le.headers=ce,le}catch(te){if(re.signal.aborted)return null;throw te}finally{delete this.loading[j]}}async decodeTile(F,j,re){const te=j instanceof ImageBitmap?j:await createImageBitmap(new Blob([new Uint8Array(j)],{type:"image/png"})),ce=1-(te.width-N.g0(te.width))/2,le=ce<1,ye=this.getImageData(te,ce);return te.close(),{dem:new N.g1(F,ye,re,le),borderReady:le}}async loadTileWithProvider(F,j,re,te){const{z:ce,x:le,y:ye}=re.tileID.canonical;try{const K=await F.loadTile({z:ce,x:le,y:ye},{request:re.request,signal:te.signal});if(te.signal.aborted)return null;if(K==null){const qe=new Error("Tile not found");throw qe.status=404,qe}if(K.data==null)return null;const be=await this.decodeTile(j,K.data,re.encoding);
7if(te.signal.aborted)return null;const Oe=new Headers;return K.expires&&Oe.set("expires",K.expires),K.cacheControl&&Oe.set("cache-control",K.cacheControl),be.headers=Oe,be}catch(K){if(te.signal.aborted)return null;throw K}finally{delete this.loading[j]}}async reloadTile(F){}abortTile(F){const j=F.uid,re=this.loading[j];re&&(re.cancel(),delete this.loading[j])}removeTile(F){}getImageData(F,j){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(F.width,F.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d",{willReadFrequently:!0})),this.offscreenCanvas.width=F.width,this.offscreenCanvas.height=F.height,this.offscreenCanvasContext.drawImage(F,0,0,F.width,F.height);const re=this.offscreenCanvasContext.getImageData(-j,-j,F.width+2*j,F.height+2*j);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),re}}N.d7.setPbf(N.d8);class Vo{constructor(F){this._mrt=new N.d7(F.partial?30:1/0),this._isHeaderLoaded=!1,this.uid=F.uid,this.tileID=F.tileID,this.source=F.source}async parse(F){const j=this._mrt;this.status="parsing",this._entireBuffer=F,j.parseHeader(F),this._isHeaderLoaded=!0;const re=[];for(const te in j.layers){const ce=j.getLayer(te),le=ce.getDataRange(ce.getBandList()),ye=j.createDecodingTask(le),K=F.slice(le.firstByte,le.lastByte+1);re.push(N.d7.performDecoding(K,ye).then(be=>ye.complete(null,be)).catch(be=>ye.complete(be,null)))}return await Promise.allSettled(re),j}}class ol{constructor({actor:F}){this.actor=F,this.loading={},this.loaded={}}async loadTile(F){const j=F.uid,re=new AbortController,te=this.loading[j]=new Vo(F);te.abort=()=>re.abort();try{const{data:ce,headers:le}=await N.d9(F.request,re.signal);return ce?(this.loaded[j]=te,{mrt:await te.parse(ce),headers:le}):(te.status="done",this.loaded[j]=te,null)}catch(ce){if(re.signal.aborted)return null;throw te.status="done",this.loaded[j]=te,ce}finally{delete this.loading[j]}}async reloadTile(F){}abortTile(F){const j=F.uid,re=this.loading[j];re&&(re.abort&&re.abort(),delete this.loading[j])}removeTile(F){const j=F.uid;this.loaded[j]&&delete this.loaded[j]}async decodeRasterArray(F){return N.d7.performDecoding(F.buffer,F.task)}}const Ls=N.g2.prototype.toGeoJSON;class Fs{constructor(F){this._feature=F,this.extent=N.aj,this.type=F.type,this.properties=F.tags,"id"in F&&!isNaN(F.id)&&(this.id=parseInt(F.id,10))}loadGeometry(){if(this._feature.type===1){const F=[];for(const j of this._feature.geometry)F.push([new N.P(j[0],j[1])]);return F}{const F=[];for(const j of this._feature.geometry){const re=[];for(const te of j)re.push(new N.P(te[0],te[1]));F.push(re)}return F}}toGeoJSON(F,j,re){return Ls.call(this,F,j,re)}}class mi{constructor(F,j){this.name=F,this.extent=N.aj,this.length=j.length,this._jsonFeatures=j}feature(F){return new Fs(this._jsonFeatures[F])}}class rn{constructor(F){this.layers={},this.extent=N.aj;for(const j of Object.keys(F))this.layers[j]=new mi(j,F[j])}}const to=64/4096;class sl{constructor(){this.features=new Map}clear(){this.features.clear()}load(F=[],j){for(const re of F){const te=re.id;if(te==null)continue;let ce=this.features.get(te);ce&&this.updateCache(ce,j),re.geometry?(ce=To(re),this.updateCache(ce,j),this.features.set(te,ce)):this.features.delete(te),this.updateCache(ce,j)}}updateCache(F,j){for(const{canonical:re,uid:te}of Object.values(j)){const{z:ce,x:le,y:ye}=re;Os(F,Math.pow(2,ce),le,ye)&&delete j[te]}}getTile(F,j,re){const te=Math.pow(2,F),ce=[];for(const le of this.features.values())Os(le,te,j,re)&&ce.push(_a(le,te,j,re));return{features:ce}}getFeatures(){return[...this.features.values()]}}function Os({minX:de,minY:F,maxX:j,maxY:re},te,ce,le){return de<(ce+1+to)/te&&F<(le+1+to)/te&&j>(ce-to)/te&&re>(le-to)/te}function To(de){const{id:F,geometry:j,properties:re}=de;if(!j)return;if(j.type==="GeometryCollection")throw new Error("GeometryCollection not supported in dynamic mode.");const{type:te,coordinates:ce}=j,le={id:F,type:1,geometry:[],tags:re,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0},ye=le.geometry;if(te==="Point")bi(ce,ye,le);else if(te==="MultiPoint")for(const K of ce)bi(K,ye,le);else if(te==="LineString")le.type=2,Xi(ce,ye,le);else if(te==="MultiLineString")le.type=2,hr(ce,ye,le);else if(te==="Polygon")le.type=3,hr(ce,ye,le,!0);else{if(te!=="MultiPolygon")throw new Error("Input data is not a valid GeoJSON object.");le.type=3;for(const K of ce)hr(K,ye,le,!0)}return le}function bi([de,F],j,re){const te=N.bE(de);let ce=N.bF(F);ce=ce<0?0:ce>1?1:ce,j.push(te,ce),re.minX=Math.min(re.minX,te),re.minY=Math.min(re.minY,ce),re.maxX=Math.max(re.maxX,te),re.maxY=Math.max(re.maxY,ce)}function Xi(de,F,j,re=!1,te=!1){const ce=[];for(const le of de)bi(le,ce,j);F.push(ce),re&&(function(le,ye){let K=0;for(let be=0,Oe=le.length,qe=Oe-2;be<Oe;qe=be,be+=2)K+=(le[be]-le[qe])*(le[be+1]+le[qe+1]);if(K>0===ye)for(let be=0,Oe=le.length;be<Oe/2;be+=2){const qe=le[be],Ye=le[be+1];le[be]=le[Oe-2-be],le[be+1]=le[Oe-1-be],le[Oe-2-be]=qe,le[Oe-1-be]=Ye}})(ce,te)}function hr(de,F,j,re=!1){for(let te=0;te<de.length;te++)Xi(de[te],F,j,re,te===0)}function _a(de,F,j,re){const{id:te,type:ce,geometry:le,tags:ye}=de,K=[];if(ce===1)(function(be,Oe,qe,Ye,st){for(let ot=0;ot<be.length;ot+=2){const Xt=Math.round(N.aj*(be[ot+0]*Oe-qe)),St=Math.round(N.aj*(be[ot+1]*Oe-Ye));st.push([Xt,St])}})(le,F,j,re,K);else if(ce===2)for(const be of le)Zi(be,F,j,re,K);else if(ce===3)for(const be of le)Bs(be,F,j,re,K);return{id:te,type:ce,geometry:K,tags:ye}}function Zi(de,F,j,re,te){const le=N.aj+128;let ye;for(let K=0;K<de.length-2;K+=2){let be=Math.round(N.aj*(de[K+0]*F-j)),Oe=Math.round(N.aj*(de[K+1]*F-re)),qe=Math.round(N.aj*(de[K+2]*F-j)),Ye=Math.round(N.aj*(de[K+3]*F-re));const st=qe-be,ot=Ye-Oe;be<-128&&qe<-128||(be<-128?(Oe+=Math.round(ot*((-128-be)/st)),be=-128):qe<-128&&(Ye=Oe+Math.round(ot*((-128-be)/st)),qe=-128),Oe<-128&&Ye<-128||(Oe<-128?(be+=Math.round(st*((-128-Oe)/ot)),Oe=-128):Ye<-128&&(qe=be+Math.round(st*((-128-Oe)/ot)),Ye=-128),be>=le&&qe>=le||(be>=le?(Oe+=Math.round(ot*((le-be)/st)),be=le):qe>=le&&(Ye=Oe+Math.round(ot*((le-be)/st)),qe=le),Oe>=le&&Ye>=le||(Oe>=le?(be+=Math.round(st*((le-Oe)/ot)),Oe=le):Ye>=le&&(qe=be+Math.round(st*((le-Oe)/ot)),Ye=le),ye&&be===ye.at(-1)[0]&&Oe===ye.at(-1)[1]||(ye=[[be,Oe]],te.push(ye)),ye.pu
7sh([qe,Ye])))))}}function Bs(de,F,j,re,te){const ce=(j-to)/F,le=(re-to)/F,ye=(j+1+to)/F,K=(re+1+to)/F;function be(Ye,st){let ot=0;return Ye<ce?ot|=1:Ye>ye&&(ot|=2),st<le?ot|=4:st>K&&(ot|=8),ot}let Oe=[];for(let Ye=1;Ye<=8;Ye*=2){let st=de[de.length-2],ot=de.at(-1),Xt=!(be(st,ot)&Ye);for(let St=0;St<de.length;St+=2){const ht=de[St],Vt=de[St+1],di=!(be(ht,Vt)&Ye);di!==Xt&&(8&Ye?Oe.push(st+(ht-st)*(K-ot)/(Vt-ot),K):4&Ye?Oe.push(st+(ht-st)*(le-ot)/(Vt-ot),le):2&Ye?Oe.push(ye,ot+(Vt-ot)*(ye-st)/(ht-st)):1&Ye&&Oe.push(ce,ot+(Vt-ot)*(ce-st)/(ht-st))),di&&Oe.push(ht,Vt),st=ht,ot=Vt,Xt=di}if(!(de=Oe).length||Ye===8)break;Oe=[]}const qe=[];for(let Ye=0;Ye<Oe.length;Ye+=2)qe.push([Math.round(N.aj*(Oe[Ye]*F-j)),Math.round(N.aj*(Oe[Ye+1]*F-re))]);qe.length&&te.push(qe)}function al({name:de,features:F},j){j.writeStringField(1,de),j.writeVarintField(5,N.aj);const re=new Map,te=new Map,ce={keys:re,values:te,feature:null};for(const le of F)ce.feature=le,j.writeMessage(2,is,ce);for(const le of re.keys())j.writeStringField(3,le);for(const le of te.keys())j.writeMessage(4,ac,le)}function is(de,F){const j=de.feature;j.id!==void 0&&Number.isSafeInteger(+j.id)&&F.writeVarintField(1,+j.id),j.tags&&F.writeMessage(2,or,de),F.writeVarintField(3,j.type),F.writeMessage(4,xu,j)}function or({keys:de,values:F,feature:j},re){for(const te of Object.keys(j.tags)){let ce=j.tags[te];if(ce===null)continue;let le=de.get(te);le===void 0&&(le=de.size,de.set(te,le)),re.writeVarint(le);const ye=typeof ce;ye!=="string"&&ye!=="boolean"&&ye!=="number"&&(ce=JSON.stringify(ce));let K=F.get(ce);K===void 0&&(K=F.size,F.set(ce,K)),re.writeVarint(K)}}function ll(de,F){return(F<<3)+(7&de)}function rs(de){return de<<1^de>>31}function xu(de,F){const{geometry:j,type:re}=de;let te=0,ce=0;if(re===1){F.writeVarint(ll(1,j.length));for(const le of j){const ye=le[0]-te,K=le[1]-ce;F.writeVarint(rs(ye)),F.writeVarint(rs(K)),te+=ye,ce+=K}}else for(const le of j){if(le.length===0)continue;F.writeVarint(ll(1,1));const ye=le.length-(re===3?1:0);for(let K=0;K<ye;K++){K===1&&F.writeVarint(ll(2,ye-1));const be=le[K][0]-te,Oe=le[K][1]-ce;F.writeVarint(rs(be)),F.writeVarint(rs(Oe)),te+=be,ce+=Oe}re===3&&F.writeVarint(ll(7,1))}}function ac(de,F){const j=typeof de;j==="string"?F.writeStringField(1,de):j==="boolean"?F.writeBooleanField(7,de):j==="number"&&(de%1!=0?F.writeDoubleField(3,de):de<0?F.writeSVarintField(6,de):F.writeVarintField(5,de))}const vu={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:de=>de},kn=Math.fround||(ks=new Float32Array(1),de=>(ks[0]=+de,ks[0]));var ks;class ga{constructor(F){this.options=Object.assign(Object.create(vu),F),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(F){const{log:j,minZoom:re,maxZoom:te}=this.options;j&&console.time("total time");const ce=`prepare ${F.length} points`;j&&console.time(ce),this.points=F;const le=[];for(let K=0;K<F.length;K++){const be=F[K];if(!be.geometry)continue;const[Oe,qe]=be.geometry.coordinates,Ye=kn(qr(Oe)),st=kn(ya(qe));le.push(Ye,st,1/0,K,-1,1),this.options.reduce&&le.push(0)}let ye=this.trees[te+1]=this._createTree(le);j&&console.timeEnd(ce);for(let K=te;K>=re;K--){const be=+Date.now();ye=this.trees[K]=this._createTree(this._cluster(ye,K)),j&&console.log("z%d: %d clusters in %dms",K,ye.numItems,+Date.now()-be)}return j&&console.timeEnd("total time"),this}getClusters(F,j){let re=((F[0]+180)%360+360)%360-180;const te=Math.max(-90,Math.min(90,F[1]));let ce=F[2]===180?180:((F[2]+180)%360+360)%360-180;const le=Math.max(-90,Math.min(90,F[3]));if(F[2]-F[0]>=360)re=-180,ce=180;else if(re>ce){const qe=this.getClusters([re,te,180,le],j),Ye=this.getClusters([-180,te,ce,le],j);return qe.concat(Ye)}const ye=this.trees[this._limitZoom(j)],K=ye.range(qr(re),ya(le),qr(ce),ya(te)),be=ye.data,Oe=[];for(const qe of K){const Ye=this.stride*qe;Oe.push(be[Ye+5]>1?lc(be,Ye,this.clusterProps):this.points[be[Ye+3]])}return Oe}getChildren(F){const j=this._getOriginId(F),re=this._getOriginZoom(F),te="No cluster with the specified id.",ce=this.trees[re];
vendor: 11,828 bytes, line 7
7if(!ce)throw new Error(te);const le=ce.data;if(j*this.stride>=le.length)throw new Error(te);const ye=this.options.radius/(this.options.extent*Math.pow(2,re-1)),K=ce.within(le[j*this.stride],le[j*this.stride+1],ye),be=[];for(const Oe of K){const qe=Oe*this.stride;le[qe+4]===F&&be.push(le[qe+5]>1?lc(le,qe,this.clusterProps):this.points[le[qe+3]])}if(be.length===0)throw new Error(te);return be}getLeaves(F,j,re){const te=[];return this._appendLeaves(te,F,j=j||10,re=re||0,0),te}getTile(F,j,re){const te=this.trees[this._limitZoom(F)],ce=Math.pow(2,F),{extent:le,radius:ye}=this.options,K=ye/le,be=(re-K)/ce,Oe=(re+1+K)/ce,qe={features:[]};return this._addTileFeatures(te.range((j-K)/ce,be,(j+1+K)/ce,Oe),te.data,j,re,ce,qe),j===0&&this._addTileFeatures(te.range(1-K/ce,be,1,Oe),te.data,ce,re,ce,qe),j===ce-1&&this._addTileFeatures(te.range(0,be,K/ce,Oe),te.data,-1,re,ce,qe),qe.features.length?qe:null}getClusterExpansionZoom(F){let j=this._getOriginZoom(F)-1;for(;j<=this.options.maxZoom;){const re=this.getChildren(F);if(j++,re.length!==1)break;F=re[0].properties.cluster_id}return j}_appendLeaves(F,j,re,te,ce){const le=this.getChildren(j);for(const ye of le){const K=ye.properties;if(K&&K.cluster?ce+K.point_count<=te?ce+=K.point_count:ce=this._appendLeaves(F,K.cluster_id,re,te,ce):ce<te?ce++:F.push(ye),F.length===re)break}return ce}_createTree(F){const j=new N.e9(F.length/this.stride|0,this.options.nodeSize,Float32Array);for(let re=0;re<F.length;re+=this.stride)j.add(F[re],F[re+1]);return j.finish(),j.data=F,j}_addTileFeatures(F,j,re,te,ce,le){for(const ye of F){const K=ye*this.stride,be=j[K+5]>1;let Oe,qe,Ye;if(be)Oe=Ns(j,K,this.clusterProps),qe=j[K],Ye=j[K+1];else{const Xt=this.points[j[K+3]];Oe=Xt.properties;const[St,ht]=Xt.geometry.coordinates;qe=qr(St),Ye=ya(ht)}const st={type:1,geometry:[[Math.round(this.options.extent*(qe*ce-re)),Math.round(this.options.extent*(Ye*ce-te))]],tags:Oe};let ot;ot=be||this.options.generateId?j[K+3]:this.points[j[K+3]].id,ot!==void 0&&(st.id=ot),le.features.push(st)}}_limitZoom(F){return Math.max(this.options.minZoom,Math.min(Math.floor(+F),this.options.maxZoom+1))}_cluster(F,j){const{radius:re,extent:te,reduce:ce,minPoints:le}=this.options,ye=re/(te*Math.pow(2,j)),K=F.data,be=[],Oe=this.stride;for(let qe=0;qe<K.length;qe+=Oe){if(K[qe+2]<=j)continue;K[qe+2]=j;const Ye=K[qe],st=K[qe+1],ot=F.within(K[qe],K[qe+1],ye),Xt=K[qe+5];let St=Xt;for(const ht of ot){const Vt=ht*Oe;K[Vt+2]>j&&(St+=K[Vt+5])}if(St>Xt&&St>=le){let ht,Vt=Ye*Xt,di=st*Xt,Ai=-1;const tr=(qe/Oe<<5)+(j+1)+this.points.length;for(const sr of ot){const qi=sr*Oe;if(K[qi+2]<=j)continue;K[qi+2]=j;const Tr=K[qi+5];Vt+=K[qi]*Tr,di+=K[qi+1]*Tr,K[qi+4]=tr,ce&&(ht||(ht=this._map(K,qe,!0),Ai=this.clusterProps.length,this.clusterProps.push(ht)),ce(ht,this._map(K,qi)))}K[qe+4]=tr,be.push(Vt/St,di/St,1/0,tr,-1,St),ce&&be.push(Ai)}else{for(let ht=0;ht<Oe;ht++)be.push(K[qe+ht]);if(St>1)for(const ht of ot){const Vt=ht*Oe;if(!(K[Vt+2]<=j)){K[Vt+2]=j;for(let di=0;di<Oe;di++)be.push(K[Vt+di])}}}}return be}_getOriginId(F){return F-this.points.length>>5}_getOriginZoom(F){return(F-this.points.length)%32}_map(F,j,re){if(F[j+5]>1){const le=this.clusterProps[F[j+6]];return re?Object.assign({},le):le}const te=this.points[F[j+3]].properties,ce=this.options.map(te);return re&&ce===te?Object.assign({},ce):ce}}function lc(de,F,j){return{type:"Feature",id:de[F+3],properties:Ns(de,F,j),geometry:{type:"Point",coordinates:[(re=de[F],360*(re-.5)),cc(de[F+1])]}};var re}function Ns(de,F,j){const re=de[F+5],te=re>=1e4?`${Math.round(re/1e3)}k`:re>=1e3?Math.round(re/100)/10+"k":re,ce=de[F+6],le=ce===-1?{}:Object.assign({},j[ce]);return Object.assign(le,{cluster:!0,cluster_id:de[F+3],point_count:re,point_count_abbreviated:te})}function qr(de){return de/360+.5}function ya(de){const F=Math.sin(de*Math.PI/180),j=.5-.25*Math.log((1+F)/(1-F))/Math.PI;return j<0?0:j>1?1:j}function cc(de){const F=(180-360*de)*Math.PI/180;return 360*Math.atan(Math.exp(F))/Math.PI-90}function cl(de,F,j,re){let te=re;const ce=F+(j-F>>1);let le,ye=j-F;const K=de[F],be=de[F+1],Oe=de[j],qe=de[j+1];for(let Ye=F+3;Ye<j;Ye+=3){const st=ul(de[Ye],de[Ye+1],K,be,Oe,qe);if(st>te)le=Ye,te=st;else if(st===te){const ot=Math.abs(Ye-ce);ot<ye&&(le=Ye,ye=ot)}}te>re&&(le-F>3&&cl(de,F,le,re),de[le+2]=te,j-le>3&&cl(de,le,j,re))}function ul(de,F,j,re,te,ce){let le=te-j,ye=ce-re;if(le!==0||ye!==0){const K=((de-j)*le+(F-re)*ye)/(le*le+ye*ye);K>1?(j=te,re=ce):K>0&&(j+=le*K,re+=ye*K)}return le=de-j,ye=F-re,le*le+ye*ye}function yr(de,F,j,re){const te={id:de??null,type:F,geometry:j,tags:re,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(F==="Point"||F==="MultiPoint"||F==="LineString")Eo(te,j);else if(F==="Polygon")Eo(te,j[0]);else if(F==="MultiLineString")for(const ce of j)Eo(te,ce);else if(F==="MultiPolygon")for(const ce of j)Eo(te,ce[0]);return te}function Eo(de,F){for(let j=0;j<F.length;j+=3)de.minX=Math.min(de.minX,F[j]),de.minY=Math.min(de.minY,F[j+1]),de.maxX=Math.max(de.maxX,F[j]),de.maxY=Math.max(de.maxY,F[j+1])}function hl(de,F,j,re){if(!F.geometry)return;const te=F.geometry.coordinates;if(te&&te.length===0)return;const ce=F.geometry.type,le=Math.pow(j.tolerance/((1<<j.maxZoom)*j.extent),2);let ye=[],K=F.id;if(j.promoteId?K=F.properties[j.promoteId]:j.generateId&&(K=re||0),ce==="Point")ns(te,ye);else if(ce==="MultiPoint")for(const be of te)ns(be,ye);else if(ce==="LineString")Uo(te,ye,le,!1);else if(ce==="MultiLineString"){if(j.lineMetrics){for(const be of te)ye=[],Uo(be,ye,le,!1),de.push(yr(K,"LineString",ye,F.properties));return}Vs(te,ye,le,!1)}else if(ce==="Polygon")Vs(te,ye,le,!0);else{if(ce!=="MultiPolygon"){if(ce==="GeometryCollection"){for(const be of F.geometry.geometries)hl(de,{id:K,geometry:be,properties:F.properties},j,re);return}throw new Error("Input data is not a valid GeoJSON object.")}for(const be of te){const Oe=[];Vs(be,Oe,le,!0),ye.push(Oe)}}de.push(yr(K,ce,ye,F.properties))}function ns(de,F){F.push(os(de[0]),uc(de[1]),0)}function Uo(de,F,j,re){let te,ce,le=0;for(let K=0;K<de.length;K++){const be=os(de[K][0]),Oe=uc(de[K][1]);F.push(be,Oe,0),K>0&&(le+=re?(te*Oe-be*ce)/2:Math.sqrt(Math.pow(be-te,2)+Math.pow(Oe-ce,2))),te=be,ce=Oe}const ye=F.length-3;F[2]=1,cl(F,0,ye,j),F[ye+2]=1,F.size=Math.abs(le),F.start=0,F.end=F.size}function Vs(de,F,j,re){for(let te=0;te<de.length;te++){const ce=[];Uo(de[te],ce,j,re),F.push(ce)}}function os(de){return de/360+.5}function uc(de){const F=Math.sin(de*Math.PI/180),j=.5-.25*Math.log((1+F)/(1-F))/Math.PI;return j<0?0:j>1?1:j}function Hr(de,F,j,re,te,ce,le,ye){if(re/=F,ce>=(j/=F)&&le<re)return de;if(le<j||ce>=re)return null;const K=[];for(const be of de){const Oe=be.geometry;let qe=be.type;const Ye=te===0?be.minX:be.minY,st=te===0?be.maxX:be.maxY;if(Ye>=j&&st<re){K.push(be);continue}if(st<j||Ye>=re)continue;let ot=[];if(qe==="Point"||qe==="MultiPoint")sd(Oe,ot,j,re,te);else if(qe==="LineString")dl(Oe,ot,j,re,te,!1,ye.lineMetrics);else if(qe==="MultiLineString")En(Oe,ot,j,re,te,!1);else if(qe==="Polygon")En(Oe,ot,j,re,te,!0);else if(qe==="MultiPolygon")for(const Xt of Oe){const St=[];En(Xt,St,j,re,te,!0),St.length&&ot.push(St)}if(ot.length){if(ye.lineMetrics&&qe==="LineString"){for(const Xt of ot)K.push(yr(be.id,qe,Xt,be.tags));continue}qe!=="LineString"&&qe!=="MultiLineString"||(ot.length===1?(qe="LineString",ot=ot[0]):qe="MultiLineString"),qe!=="Point"&&qe!=="MultiPoint"||(qe=ot.length===3?"Point":"MultiPoint"),K.push(yr(be.id,qe,ot,be.tags))}}return K.length?K:null}function sd(de,F,j,re,te){for(let ce=0;ce<de.length;ce+=3){const le=de[ce+te];le>=j&&le<=re&&ss(F,de[ce],de[ce+1],de[ce+2])}}function dl(de,F,j,re,te,ce,le){let ye=Ne(de);const K=te===0?Us:ad;let be,Oe,qe=de.start;for(let St=0;St<de.length-3;St+=3){const ht=de[St],Vt=de[St+1],di=de[St+2],Ai=de[St+3],tr=de[St+4],sr=te===0?ht:Vt,qi=te===0?Ai:tr;let Tr=!1;le&&(be=Math.sqrt(Math.pow(ht-Ai,2)+Math.pow(Vt-tr,2))),sr<j?qi>=j&&(Oe=K(ye,ht,Vt,Ai,tr,j),le&&(ye.start=qe+be*Oe)):sr>re?qi<=re&&(Oe=K(ye,ht,Vt,Ai,tr,re),le&&(ye.start=qe+be*Oe)):ss(ye,ht,Vt,di),qi<j&&sr>=j&&(Oe=K(ye,ht,Vt,Ai,tr,j),Tr=!0),qi>re&&sr<=re&&(Oe=K(ye,ht,Vt,Ai,tr,re),Tr=!0),!ce&&Tr&&(le&&(ye.end=qe+be*Oe),F.push(ye),ye=Ne(de)),le&&(qe+=be)}let Ye=de.length-3;const st=de[Ye],ot=de[Ye+1],Xt=te===0?st:ot;Xt>=j&&Xt<=re&&ss(ye,st,ot,de[Ye+2]),Ye=ye.length-3,ce&&Ye>=3&&(ye[Ye]!==ye[0]||ye[Ye+1]!==ye[1])&&ss(ye,ye[0],ye[1],ye[2]),ye.length&&F.push(ye)}function Ne(de){const F=[];return F.size=de.size,F.start=de.start,F.end=de.end,F}function En(de,F,j,re,te,ce){for(const le of de)dl(le,F,j,re,te,ce,!1)}function ss(de,F,j,re){de.push(F,j,re)}function Us(de,F,j,re,te,ce){const le=(ce-F)/(re-F);return ss(de,ce,j+(te-j)*le,1),le}function ad(de,F,j,re,te,ce){const le=(ce-j)/(te-j);return ss(de,F+(re-F)*le,ce,1),le}function bu(de,F){const j=[];for(let re=0;re<de.length;re++){const te=de[re],ce=te.type;let le;if(ce==="Point"||ce==="MultiPoint"||ce==="LineString")le=hc(te.geometry,F);else if(ce==="MultiLineString"||ce==="Polygon"){le=[];for(const ye of te.geometry)le.push(hc(ye,F))}else if(ce==="MultiPolygon"){le=[];for(const ye of te.geometry){const K=[];for(const be of ye)K.push(hc(be,F));le.push(K)}}j.push(yr(te.id,ce,le,te.tags))}return j}function hc(de,F){const j=[];j.size=de.size,de.start!==void 0&&(j.start=de.start,j.end=de.end);for(let re=0;re<de.length;re+=3)j.push(de[re]+F,de[re+1],de[re+2]);return j}function as(de,F){if(de.transformed)return de;const j=1<<de.z,re=de.x,te=de.y;for(const ce of de.features){const le=ce.geometry,ye=ce.type;if(ce.geometry=[],ye===1)for(let K=0;K<le.length;K+=2)ce.geometry.push(Nn(le[K],le[K+1],F,j,re,te));else for(let K=0;K<le.length;K++){const be=[];for(let Oe=0;Oe<le[K].length;Oe+=2)be.push(Nn(le[K][Oe],le[K][Oe+1],F,j,re,te));ce.geometry.push(be)}}return de.transformed=!0,de}function Nn(de,F,j,re,te,ce){return[Math.round(j*(de*re-te)),Math.round(j*(F*re-ce))]}function ls(de,F,j,re,te){const ce=F===te.maxZoom?0:te.tolerance/((1<<F)*te.extent),le={features:[],numPoints:0,numSimplified:0,numFeatures:de.length,source:null,x:j,y:re,z:F,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const ye of de)dc(le,ye,ce,te);return le}function dc(de,F,j,re){const te=F.geometry,ce=F.type,le=[];if(de.minX=Math.min(de.minX,F.minX),de.minY=Math.min(de.minY,F.minY),de.maxX=Math.max(de.maxX,F.maxX),de.maxY=Math.max(de.maxY,F.maxY),ce==="Point"||ce==="MultiPoint")for(let ye=0;ye<te.length;ye+=3)le.push(te[ye],te[ye+1]),de.numPoints++,de.numSimplified++;else if(ce==="LineString")cs(le,te,de,j,!1,!1);else if(ce==="MultiLineString"||ce==="Polygon")for(let ye=0;ye<te.length;ye++)cs(le,te[ye],de,j,ce==="Polygon",ye===0);else if(ce==="MultiPolygon")for(let ye=0;ye<te.length;ye++){const K=te[ye];for(let be=0;be<K.length;be++)cs(le,K[be],de,j,!0,be===0)}if(le.length){let ye=F.tags||null;if(ce==="LineString"&&re.lineMetrics){ye={};for(const be in F.tags)ye[be]=F.tags[be];ye.mapbox_clip_start=te.start/te.size,ye.mapbox_clip_end=te.end/te.size}const K={geometry:le,type:ce==="Polygon"||ce==="MultiPolygon"?3:ce==="LineString"||ce==="MultiLineString"?2:1,tags:ye};F.id!==null&&(K.id=F.id),de.features.push(K)}}function cs(de,F,j,re,te,ce){const le=re*re;if(re>0&&F.size<(te?le:re))return void(j.numPoints+=F.length/3);const ye=[];for(let K=0;K<F.length;K+=3)(re===0||F[K+2]>le)&&(j.numSimplified++,ye.push(F[K],F[K+1])),j.numPoints++;te&&(function(K,be){let Oe=0;for(let qe=0,Ye=K.length,st=Ye-2;qe<Ye;st=qe,qe+=2)Oe+=(K[qe]-K[st])*(K[qe+1]+K[st+1]);if(Oe>0===be)for(let qe=0,Ye=K.length;qe<Ye/2;qe+=2){const st=K[qe],ot=K[qe+1];K[qe]=K[Ye-2-qe],K[qe+1]=K[Ye-1-qe],K[Ye-2-qe]=st,K[Ye-1-qe]=ot}})(ye,ce),de.push(ye)}const Vn={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class fl{constructor(F,j){const re=(j=this.options=(function(ce,le){for(const ye in le)ce[ye]=le[ye];return ce}
7)(Object.create(Vn),j)).debug;if(re&&console.time("preprocess data"),j.maxZoom<0||j.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(j.promoteId&&j.generateId)throw new Error("promoteId and generateId cannot be used together.");let te=(function(ce,le){const ye=[];if(ce.type==="FeatureCollection")for(let K=0;K<ce.features.length;K++)hl(ye,ce.features[K],le,K);else hl(ye,ce.type==="Feature"?ce:{geometry:ce},le);return ye})(F,j);this.tiles={},this.tileCoords=[],re&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",j.indexMaxZoom,j.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),te=(function(ce,le){const ye=le.buffer/le.extent;let K=ce;const be=Hr(ce,1,-1-ye,ye,0,-1,2,le),Oe=Hr(ce,1,1-ye,2+ye,0,-1,2,le);return(be||Oe)&&(K=Hr(ce,1,-ye,1+ye,0,-1,2,le)||[],be&&(K=bu(be,1).concat(K)),Oe&&(K=K.concat(bu(Oe,-1)))),K})(te,j),te.length&&this.splitTile(te,0,0,0),re&&(te.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(F,j,re,te,ce,le,ye){const K=[F,j,re,te],be=this.options,Oe=be.debug;for(;K.length;){te=K.pop(),re=K.pop(),j=K.pop(),F=K.pop();const qe=1<<j,Ye=us(j,re,te);let st=this.tiles[Ye];if(!st&&(Oe>1&&console.time("creation"),st=this.tiles[Ye]=ls(F,j,re,te,be),this.tileCoords.push({z:j,x:re,y:te}),Oe)){Oe>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",j,re,te,st.numFeatures,st.numPoints,st.numSimplified),console.timeEnd("creation"));const Tr=`z${j}`;this.stats[Tr]=(this.stats[Tr]||0)+1,this.total++}if(st.source=F,ce==null){if(j===be.indexMaxZoom||st.numPoints<=be.indexMaxPoints)continue}else{if(j===be.maxZoom||j===ce)continue;if(ce!=null){const Tr=ce-j;if(re!==le>>Tr||te!==ye>>Tr)continue}}if(st.source=null,F.length===0)continue;Oe>1&&console.time("clipping");const ot=.5*be.buffer/be.extent,Xt=.5-ot,St=.5+ot,ht=1+ot;let Vt=null,di=null,Ai=null,tr=null;const sr=Hr(F,qe,re-ot,re+St,0,st.minX,st.maxX,be),qi=Hr(F,qe,re+Xt,re+ht,0,st.minX,st.maxX,be);sr&&(Vt=Hr(sr,qe,te-ot,te+St,1,st.minY,st.maxY,be),di=Hr(sr,qe,te+Xt,te+ht,1,st.minY,st.maxY,be)),qi&&(Ai=Hr(qi,qe,te-ot,te+St,1,st.minY,st.maxY,be),tr=Hr(qi,qe,te+Xt,te+ht,1,st.minY,st.maxY,be)),Oe>1&&console.timeEnd("clipping"),K.push(Vt||[],j+1,2*re,2*te),K.push(di||[],j+1,2*re,2*te+1),K.push(Ai||[],j+1,2*re+1,2*te),K.push(tr||[],j+1,2*re+1,2*te+1)}}getTile(F,j,re){F=+F,j=+j,re=+re;const te=this.options,{extent:ce,debug:le}=te;if(F<0||F>24)return null;const ye=1<<F,K=us(F,j=j+ye&ye-1,re);if(this.tiles[K])return as(this.tiles[K],ce);le>1&&console.log("drilling down to z%d-%d-%d",F,j,re);let be,Oe=F,qe=j,Ye=re;for(;!be&&Oe>0;)Oe--,qe>>=1,Ye>>=1,be=this.tiles[us(Oe,qe,Ye)];return be&&be.source?(le>1&&(console.log("found parent tile z%d-%d-%d",Oe,qe,Ye),console.time("drilling down")),this.splitTile(be.source,Oe,qe,Ye,F,j,re),le>1&&console.timeEnd("drilling down"),this.tiles[K]?as(this.tiles[K],ce):null):null}}function us(de,F,j){return 32*((1<<de)*j+F)+de}function pl(de,F){const j=de.tileID.canonical;if(!this._geoJSONIndex)return void F(null,null);const re=this._geoJSONIndex.getTile(j.z,j.x,j.y);if(!re)return void F(null,null);const te=be=>be.tags&&"3d_elevation_id"in be.tags&&"source"in be.tags&&be.tags.source==="elevation",ce=re.features.filter(be=>te(be));let le={_geojsonTileLayer:re.features};ce.length>0&&(le={_geojsonTileLayer:re.features.filter(be=>!te(be)),hd_road_elevation:ce});const ye=new rn(le),K=(function(be){const Oe=new N.g3;for(const qe of Object.keys(be))Oe.writeMessage(3,al,{name:qe,features:be[qe]});return Oe.finish()})(le).buffer;F(null,{vectorTile:ye,rawData:K,headers:new Headers})}class wu extends Di{constructor(F){super(F),this.loadVectorData=pl,this._dynamicIndex=new sl}async loadData(F){const j=F&&F.request,re=j&&j.collectResourceTiming;this._geoJSONIndex=null;let te=await new Promise((le,ye)=>{this.loadGeoJSON(F,(K,be)=>{K?ye(K):le(be)})});if(!te)return{};if(typeof te!="object")throw new Error(`Input data given to '${F.source}' is not a valid GeoJSON object.`);if(F.filter){const le=N.n(F.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(le.result==="error")throw new Error(le.value.map(ye=>`${ye.key}: ${ye.message}`).join(", "));te.features=te.features.filter(ye=>le.value.evaluate({zoom:0},ye))}F.dynamic?(te.type==="Feature"&&(te={type:"FeatureCollection",features:[te]}),F.append||(this._dynamicIndex.clear(),this.loaded={}),this._dynamicIndex.load(te.features,this.loaded),F.cluster&&(te.features=this._dynamicIndex.getFeatures())):this.loaded={},this._geoJSONIndex=F.cluster?new ga((function({superclusterOptions:le,clusterProperties:ye}){if(!ye||!le)return le;const K={},be={},Oe={accumulated:null,zoom:0},qe={properties:null},Ye=Object.keys(ye);for(const st of Ye){const[ot,Xt]=ye[st],St=N.n(Xt),ht=N.n(typeof ot=="string"?[ot,["accumulated"],["get",st]]:ot);K[st]=St.value,be[st]=ht.value}return le.map=st=>{qe.properties=st;const ot={};for(const Xt of Ye)ot[Xt]=K[Xt].evaluate(Oe,qe);return ot},le.reduce=(st,ot)=>{qe.properties=ot;for(const Xt of Ye)Oe.accumulated=st[Xt],st[Xt]=be[Xt].evaluate(Oe,qe)},le})(F)).load(te.features):F.dynamic?this._dynamicIndex:(function(le,ye){return new fl(le,ye)}
vendor: 12,636 bytes, line 7
7)(te,F.geojsonVtOptions);const ce={};if(re){const le=jr(j);le&&(ce.resourceTiming={},ce.resourceTiming[F.source]=JSON.parse(JSON.stringify(le)))}return ce}async reloadTile(F){const j=this.loaded;return j&&j[F.uid]?F.partial?void 0:super.reloadTile(F):this.loadTile(F)}loadGeoJSON(F,j){if(F.request)N.o(F.request).then(({data:re})=>j(null,re)).catch(re=>j(re));else{if(typeof F.data!="string")return j(new Error(`Input data given to '${F.source}' is not a valid GeoJSON object.`));setTimeout(()=>{try{return j(null,JSON.parse(F.data))}catch{return j(new Error(`Input data given to '${F.source}' is not a valid GeoJSON object.`))}},0)}}getClusterExpansionZoom(F){return this._geoJSONIndex.getClusterExpansionZoom(F.clusterId)}getClusterChildren(F){return this._geoJSONIndex.getChildren(F.clusterId)}getClusterLeaves(F){return this._geoJSONIndex.getLeaves(F.clusterId,F.limit,F.offset)}}class ml{constructor(F,j,re){this.tileID=new N.bp(F.tileID.overscaledZ,F.tileID.wrap,F.tileID.canonical.z,F.tileID.canonical.x,F.tileID.canonical.y),this.tileZoom=F.tileZoom,this.uid=F.uid,this.zoom=F.zoom,this.canonical=F.tileID.canonical,this.pixelRatio=F.pixelRatio,this.tileSize=F.tileSize,this.source=F.source,this.overscaling=this.tileID.overscaleFactor(),this.projection=F.projection,this.brightness=j,this.worldview=re}async parse(F,j,re){this.status="parsing";const te=new N.bp(re.tileID.overscaledZ,re.tileID.wrap,re.tileID.canonical.z,re.tileID.canonical.x,re.tileID.canonical.y),ce=[],le=j.familiesBySource[re.source],ye=new N.fN(te,re.promoteId);ye.bucketLayerIDs=[],ye.is3DTile=!0;const K=await N.g4(F),be=K.json.extensionsUsed&&K.json.extensionsUsed.includes("MAPBOX_mesh_features")||K.json.asset.extras&&K.json.asset.extras.MAPBOX_mesh_features,Oe=K.json.extensionsUsed&&K.json.extensionsUsed.includes("EXT_meshopt_compression"),qe=new N.aa(this.zoom,{brightness:this.brightness,worldview:this.worldview});for(const Ye in le)for(const st of le[Ye]){const ot=st[0];ye.bucketLayerIDs.push(st.map(ht=>N.y(ht.id,ht.scope))),ot.recalculate(qe,[]);const Xt=N.g5(K,1/N.cn(re.tileID.canonical)),St=new N.g6(st,Xt,te,be,Oe,this.brightness,ye,this.worldview);be||(St.needsUpload=!0),ce.push(St),St.evaluate(ot)}return this.status="done",{buckets:ce,featureIndex:ye,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:null}}}class Tu{constructor({actor:F,layerIndex:j,availableImages:re,availableModels:te,brightness:ce,worldview:le}){this.actor=F,this.layerIndex=j,this.availableImages=re,this.availableModels=te,this.brightness=ce,this.loading={},this.loaded={},this.worldview=le}async loadTile(F){const j=F.uid,re=new AbortController,te=this.loading[j]=new ml(F,this.brightness,this.worldview);te.abort=()=>re.abort();const ce=(ye,K)=>{const be=te.reloadCallback;be&&(delete te.reloadCallback,be(ye,K))};let le;try{le=(await N.d9(F.request,re.signal)).data}catch(ye){if(delete this.loading[j],te.status="done",this.loaded[j]=te,re.signal.aborted)return null;throw ye}if(delete this.loading[j],!le||le.byteLength===0)return te.status="done",this.loaded[j]=te,null;try{const ye=await te.parse(le,this.layerIndex,F);return this.loaded[j]=te,ce(null,ye),ye}catch(ye){throw this.loaded[j]=te,ce(ye),ye}}async reloadTile(F){const j=this.loaded&&this.loaded[F.uid];if(j)return j.projection=F.projection,j.brightness=F.brightness,j.status==="parsing"&&await new Promise((re,te)=>{j.reloadCallback=ce=>{ce?te(ce):re()}}),this.loadTile(F)}abortTile(F){const j=F.uid,re=this.loading[j];re&&(re.abort&&re.abort(),delete this.loading[j])}removeTile(F){const j=this.loaded,re=F.uid;j&&j[re]&&delete j[re]}}class jt{constructor(F){this.self=F,this.actor=new N.an(F,this),this.layerIndexes={},this.availableImages={},this.availableModels={},this.isSpriteLoaded={},this.rtlPluginParsingListeners=[],this.projections={},this.defaultProjection=N.b4({name:"mercator"}),this.workerSourceTypes={vector:Di,geojson:wu,"raster-dem":gr,"raster-array":ol,"batched-model":Tu},this.workerSources={},this.self.registerWorkerSource=(j,re)=>{if(this.workerSourceTypes[j])throw new Error(`Worker source with name "${j}" already registered.`);this.workerSourceTypes[j]=re},this.self.registerRTLTextPlugin=j=>{if(N.g8.isParsed())throw new Error("RTL text plugin already registered.");N.g8.setState({pluginStatus:N.g9.parsed,pluginURL:N.g8.getPluginURL()}),N.g8.applyArabicShaping=j.applyArabicShaping,N.g8.processBidirectionalText=j.processBidirectionalText,N.g8.processStyledBidirectionalText=j.processStyledBidirectionalText;for(const{resolve:re}of this.rtlPluginParsingListeners)re(!0);this.rtlPluginParsingListeners=[]}}clearCaches(F,j){delete this.layerIndexes[F],delete this.availableImages[F],delete this.availableModels[F],delete this.workerSources[F],delete this.isSpriteLoaded[F]}checkIfReady(F,j){}spriteLoaded(F,j){const{scope:re}=j;if(this.isSpriteLoaded[F]||(this.isSpriteLoaded[F]={}),this.isSpriteLoaded[F][re]=!0,this.workerSources[F]&&this.workerSources[F][re])for(const te in this.workerSources[F][re]){const ce=this.workerSources[F][re][te];for(const le in ce){const ye=ce[le];ye instanceof Di&&(ye.isSpriteLoaded=!0,ye.fire(new N.B("isSpriteLoaded")))}}}setImages(F,j){this.availableImages[F]||(this.availableImages[F]={});const{scope:re,images:te}=j;if(this.availableImages[F][re]=te,j.isSpriteLoaded&&this.spriteLoaded(F,{scope:re}),this.workerSources[F]&&this.workerSources[F][re])for(const ce in this.workerSources[F][re]){const le=this.workerSources[F][re][ce];for(const ye in le)le[ye].availableImages=te}}setModels(F,{scope:j,models:re}){if(this.availableModels[F]||(this.availableModels[F]={}),this.availableModels[F][j]=re,this.workerSources[F]&&this.workerSources[F][j])for(const te in this.workerSources[F][j]){const ce=this.workerSources[F][j][te];for(const le in ce)ce[le].availableModels=re}}setProjection(F,j){this.projections[F]=N.b4(j)}setGlobalParams(F,j){if(this.referrer=j.referrer,Object.assign(N.g,j.config),j.contextOptions){const{maxBindingPoints:re,maxUniformBlockSizeDwords:te}=j.contextOptions;this.maxUniformBufferBindings=re,this.maxUniformBlockSizeDwords=te}}upsertRenderParams(F,j){j.brightness!==void 0&&(this.brightness=j.brightness),j.worldview!==void 0&&(this.worldview=j.worldview)}setLayers(F,j){this.getLayerIndex(F,j.scope).replace(j.layers,j.options)}updateLayers(F,j){this.getLayerIndex(F,j.scope).update(j.layers,j.removedIds,j.options)}loadTile(F,j){return j.projection=this.projections[F]||this.defaultProjection,this.getWorkerSource(F,j).loadTile(j)}decodeRasterArray(F,j){return this.getWorkerSource(F,j).decodeRasterArray(j)}reloadTile(F,j){return j.projection=this.projections[F]||this.defaultProjection,this.getWorkerSource(F,j).reloadTile(j)}abortTile(F,j){return this.getWorkerSource(F,j).abortTile(j)}removeTile(F,j){return this.getWorkerSource(F,j).removeTile(j)}removeSource(F,j){if(!(this.workerSources[F]&&this.workerSources[F][j.scope]&&this.workerSources[F][j.scope][j.type]&&this.workerSources[F][j.scope][j.type][j.source]))return;const re=this.workerSources[F][j.scope][j.type][j.source];return delete this.workerSources[F][j.scope][j.type][j.source],re.removeSource!==void 0?re.removeSource(j):void 0}async loadTileProvider(F,j){const re=new(await N.df(j.name,j.url))(j.options);return this.getWorkerSource(F,{type:j.type,source:j.source,scope:j.scope},re),re.load&&j.request?re.load({request:j.request}):null}async syncRTLPluginState(F,j){if(N.g8.isParsed())return!0;if(N.g8.isParsing())return new Promise((te,ce)=>{this.rtlPluginParsingListeners.push({resolve:te,reject:ce})});N.g8.setState(j);const re=N.g8.getPluginURL();if(!N.g8.isLoaded()||N.g8.isParsed()||N.g8.isParsing())return!1;N.g8.setState({pluginStatus:N.g9.parsing,pluginURL:re});try{return await import(re),!!N.g8.isParsed()||new Promise((te,ce)=>{this.rtlPluginParsingListeners.push({resolve:te,reject:ce})})}catch(te){N.g8.setState({pluginStatus:N.g9.error,pluginURL:re});for(const{reject:ce}of this.rtlPluginParsingListeners)ce(te);throw this.rtlPluginParsingListeners=[],te}}getAvailableImages(F,j){this.availableImages[F]||(this.availableImages[F]={});let re=this.availableImages[F][j];return re||(re=[]),re}getAvailableModels(F,j){this.availableModels[F]||(this.availableModels[F]={});let re=this.availableModels[F][j];return re||(re={}),re}getLayerIndex(F,j){this.layerIndexes[F]||(this.layerIndexes[F]={});let re=this.layerIndexes[F][j];return re||(re=this.layerIndexes[F][j]=new sc,re.scope=j),re}getWorkerSource(F,j,re){const{type:te,source:ce,scope:le}=j,ye=this.workerSources;if(ye[F]||(ye[F]={}),ye[F][le]||(ye[F][le]={}),ye[F][le][te]||(ye[F][le][te]={}),this.isSpriteLoaded[F]||(this.isSpriteLoaded[F]={}),ye[F][le][te][ce])re&&(ye[F][le][te][ce].tileProvider=re);else{const K=this.actor.getWorkerSourceActor(F),be=this.workerSourceTypes[te];if(!be)throw new Error(`Unknown worker source type "${te}".`);ye[F][le][te][ce]=new be({actor:K,layerIndex:this.getLayerIndex(F,le),availableImages:this.getAvailableImages(F,le),availableModels:this.getAvailableModels(F,le),isSpriteLoaded:this.isSpriteLoaded[F][le],tileProvider:re,brightness:this.brightness,worldview:this.worldview,maxUniformBufferBindings:this.maxUniformBufferBindings,maxUniformBlockSizeDwords:this.maxUniformBlockSizeDwords})}return ye[F][le][te][ce]}enforceCacheSizeLimit(F,j){N.ga(j)}}return N.g7(self)&&(self.worker=new jt(self)),jt}),gu(["./shared"],function(u){const N={antialias:!1,alpha:!0,stencil:!0,depth:!0};let jr,Gi;function il(s){const t=document.createElement("canvas"),n=Object.create(N);n.failIfMajorPerformanceCaveat=s;const l=t.getContext("webgl2",n);if(!l)return!1;let d;try{d=l.createShader(l.VERTEX_SHADER)}catch{return!1}return!(!d||l.isContextLost())&&(l.shaderSource(d,"void main() {}"),l.compileShader(d),l.getShaderParameter(d,l.COMPILE_STATUS)===!0)}var No="3.26.0";const yu=/firefox/i,rl=/macintosh/i;function ni(s,t,n){const l=document.createElement(s);return t!=null&&(l.className=t),n&&n.appendChild(l),l}function ki(s,t,n){const l=document.createElementNS("http://www.w3.org/2000/svg",s);for(const d of Object.keys(t))l.setAttributeNS(null,d,String(t[d]));return n&&n.appendChild(l),l}const bo=typeof document<"u"?document.documentElement&&document.documentElement.style:null,Ri=bo&&bo.userSelect!==void 0?"userSelect":"WebkitUserSelect";let wn;function Gr(){bo&&Ri&&(wn=bo[Ri],bo[Ri]="none")}function ts(){bo&&Ri&&(bo[Ri]=wn)}function wo(s){s.preventDefault(),s.stopPropagation(),window.removeEventListener("click",wo,!0)}function Tn(){window.addEventListener("click",wo,!0),window.setTimeout(()=>{window.removeEventListener("click",wo,!0)},0)}function eo(s,t){const n=s.getBoundingClientRect();return sc(s,n,t)}function fa(s,t){const n=s.getBoundingClientRect(),l=[];for(let d=0;d<t.length;d++)l.push(sc(s,n,t[d]));return l}function nl(s){return yu.test(navigator.userAgent)&&rl.test(navigator.userAgent)&&s.button===2&&s.ctrlKey?0:s.button}function sc(s,t,n){const l=s.offsetWidth===t.width?1:s.offsetWidth/t.width;return new u.P((n.clientX-t.left)*l,(n.clientY-t.top)*l)}const pa="01",zs={create:"create",load:"load",fullLoad:"fullLoad"},ti={mark(s){performance.mark(s)},measure(s,t,n){performance.measure(s,t,n)}};function ma(s){const t=s.name.split("?")[0];return u.a(t)&&t.includes("mapbox-gl.js")?"javascript":u.a(t)&&t.includes("mapbox-gl.css")?"css":u.b(t)?"fontRange":u.c(t)?"sprite":u.i(t)?"style":u.d(t)?"tilejson":"other"}const Bn=/(\.(png|jpg)\d*)(?=$)/,Cr=/^.+\/v4\//,Di=/\.[\w]+$/,gr=/^(\/v4\/|\/(raster|rasterarrays)\/v1\/)/,Vo=/^access_token=(.*)$/,ol="NO_ACCESS_TOKEN";class Ls{constructor(t,n,l){this._transformRequestFn=t,this._customAccessToken=n,this._silenceAuthErrors=!!l,this._createSkuToken()}_createSkuToken(){const t=(function(){let n="";for(let l=0;l<10;l++)n+="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[Math.floor(62*Math.random())];return{token:["1",pa,n].join(""),tokenExpiresAt:Date.now()+432e5}})();this._skuToken=t.token,this._skuTokenExpiresAt=t.tokenExpiresAt}_isSkuTokenExpired(){return Date.now()>this._skuTokenExpiresAt}async transformRequest(t,n,l){if(!this._transformRequestFn)return{url:t};const d=l?{signal:l}:{};return await this._transformRequestFn(t,n,d)||{url:t}}normalizeStyleURL(t,n){if(!u.e(t))return t;const l=mi(t);return l.params.push(`sdk=js-${No}`),l.path=`/styles/v1${l.path}`,this._makeAPIURL(l,this._customAccessToken||n)}normalizeGlyphsURL(t,n){if(!u.e(t))return t;const l=mi(t);return l.path=`/fonts/v1${l.path}`,this._makeAPIURL(l,this._customAccessToken||n)}normalizeModelURL(t,n){if(!u.e(t))return t;const l=mi(t);return l.path=`/models/v1${l.path}`,this._makeAPIURL(l,this._customAccessToken||n)}
7normalizeSourceURL(t,n,l,d){if(!u.e(t))return t;const p=mi(t);return p.path=`/v4/${p.authority}.json`,p.params.push("secure"),l&&p.params.push(`language=${l}`),d&&p.params.push(`worldview=${d}`),this._makeAPIURL(p,this._customAccessToken||n)}normalizeIconsetURL(t,n){const l=mi(t);return u.e(t)?(l.path=`/styles/v1${l.path}/iconset.pbf`,this._makeAPIURL(l,this._customAccessToken||n)):rn(l)}normalizeSpriteURL(t,n,l,d){const p=mi(t);return u.e(t)?(p.path=`/styles/v1${p.path}/sprite${n}${l}`,this._makeAPIURL(p,this._customAccessToken||d)):(p.path+=`${n}${l}`,rn(p))}normalizeTileURL(t,n,l){if(this._isSkuTokenExpired()&&this._createSkuToken(),t&&!u.e(t))return t;const d=mi(t);d.path=d.path.replace(Bn,`${n||l&&d.authority!=="raster"&&l===512?"@2x":""}${u.k.supported?".webp":"$1"}`),d.authority==="raster"?d.path=`/${u.g.RASTER_URL_PREFIX}${d.path}`:d.authority==="rasterarrays"?d.path=`/${u.g.RASTERARRAYS_URL_PREFIX}${d.path}`:d.authority==="3dtiles"?d.path=`/${u.g.TILES3D_URL_PREFIX}${d.path}`:(d.path=d.path.replace(Cr,"/"),d.path=`/${u.g.TILE_URL_VERSION}${d.path}`);const p=this._customAccessToken||(function(m){for(const g of m){const x=g.match(Vo);if(x)return x[1]}return null})(d.params)||u.g.ACCESS_TOKEN;return u.g.REQUIRE_ACCESS_TOKEN&&p&&this._skuToken&&d.params.push(`sku=${this._skuToken}`),this._makeAPIURL(d,p)}canonicalizeTileURL(t,n){const l=mi(t);if(!gr.test(l.path)||!Di.test(l.path))return t;let d="mapbox://";l.path.startsWith("/raster/v1/")?d+=`raster/${l.path.replace(`/${u.g.RASTER_URL_PREFIX}/`,"")}`:l.path.startsWith("/rasterarrays/v1/")?d+=`rasterarrays/${l.path.replace(`/${u.g.RASTERARRAYS_URL_PREFIX}/`,"")}`:d+=`tiles/${l.path.replace(`/${u.g.TILE_URL_VERSION}/`,"")}`;let p=l.params;return n&&(p=p.filter(m=>!m.match(Vo))),p.length&&(d+=`?${p.join("&")}`),d}canonicalizeTileset(t,n){const l=!!n&&u.e(n),d=[];for(const p of t.tiles||[])u.f(p)?d.push(this.canonicalizeTileURL(p,l)):d.push(p);return d}_makeAPIURL(t,n){const l="See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes",d=mi(u.g.API_URL);if(t.protocol=d.protocol,t.authority=d.authority,t.protocol==="http"){const p=t.params.indexOf("secure");p>=0&&t.params.splice(p,1)}if(d.path!=="/"&&(t.path=`${d.path}${t.path}`),!u.g.REQUIRE_ACCESS_TOKEN)return rn(t);if(n=n||u.g.ACCESS_TOKEN,!this._silenceAuthErrors){if(!n)throw new Error(`An API access token is required to use Mapbox GL. ${l}`);if(n[0]==="s")throw new Error(`Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). ${l}`)}return t.params=t.params.filter(p=>!p.includes("access_token")),t.params.push(`access_token=${n||""}`),rn(t)}}const Fs=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function mi(s){const t=s.match(Fs);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 rn(s){const t=s.params.length?`?${s.params.join("&")}`:"";return`${s.protocol}://${s.authority}${s.path}${t}`}const to="mapbox.eventData";function sl(s){if(!s)return null;const t=s.split(".");if(!t||t.length!==3)return null;try{return JSON.parse(u.l(t[1]))}catch{return null}}function Os(s){return!(!u.g.EVENTS_URL||!s&&!u.g.ACCESS_TOKEN)}let To;const bi=/^[\w.+-]+(\/[\w.+-]+)?$/;let Xi="other";class hr{constructor(t){this.type=t,this.anonId=null,this.anonIdTimestamp=null,this.eventData={},this.queue=[],this.pendingRequest=!1}getStorageKey(t){const n=sl(u.g.ACCESS_TOKEN);let l="";return l=n&&n.u?u.j(n.u):u.g.ACCESS_TOKEN||"",t?`${to}.${t}:${l}`:`${to}:${l}`}fetchEventData(){const t=u.s("localStorage"),n=this.getStorageKey(),l=this.getStorageKey("uuid"),d=this.getStorageKey("uuidTimestamp");if(t)try{const p=localStorage.getItem(n);p&&(this.eventData=JSON.parse(p));const m=localStorage.getItem(l);m&&(this.anonId=m);const g=localStorage.getItem(d);g&&(this.anonIdTimestamp=Number(g));const x=Date.now()-864e5;(!this.anonIdTimestamp||this.anonIdTimestamp<x)&&this.refreshUUID()}catch{u.w("Unable to read from LocalStorage")}}refreshUUID(){this.anonId=u.u(),this.anonIdTimestamp=Date.now()}saveEventData(){const t=u.s("localStorage"),n=this.getStorageKey(),l=this.getStorageKey("uuid"),d=this.getStorageKey("uuidTimestamp"),p=this.anonId,m=this.anonIdTimestamp;if(t&&p)try{localStorage.setItem(l,p),Object.keys(this.eventData).length>=1&&localStorage.setItem(n,JSON.stringify(this.eventData)),m&&localStorage.setItem(d,m.toString())}catch{u.w("Unable to write to LocalStorage")}}processRequests(t){}
7postEvent(t,n,l,d){if(!u.g.EVENTS_URL)return;const p=mi(u.g.EVENTS_URL);p.params.push(`access_token=${d||u.g.ACCESS_TOKEN||""}`);const m={event:this.type,created:new Date(t).toISOString()},g=n?Object.assign(m,n):m,x={url:rn(p),headers:{"Content-Type":"text/plain"},body:JSON.stringify([g])};this.pendingRequest=!0,u.p(x).then(()=>{this.pendingRequest=!1,l(null),this.saveEventData(),this.processRequests(d)}).catch(w=>{this.pendingRequest=!1,l(w),this.saveEventData(),this.processRequests(d)})}queueRequest(t,n){this.queue.push(t),this.processRequests(n)}}class _a extends hr{constructor(t){super("metrics"),t&&(this.data=t)}postMetricsEvent(t){if(!Os(t))return;this.anonId||this.fetchEventData(),u.v(this.anonId)||this.refreshUUID();const n={...this.data,sessionId:this.anonId};this.queueRequest({timestamp:Date.now(),payload:n},t)}processRequests(t){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:n,payload:l}=this.queue.shift();this.postEvent(n,l,()=>{},t)}}const Zi=new class extends hr{constructor(s){super("appUserTurnstile"),this._customAccessToken=s}postTurnstileEvent(s,t){Os(t)&&Array.isArray(s)&&s.some(n=>u.e(n)||u.f(n))&&this.queueRequest(Date.now(),t)}processRequests(s){if(this.pendingRequest||this.queue.length===0)return;this.anonId&&this.anonIdTimestamp&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();const t=sl(u.g.ACCESS_TOKEN),n=t?t.u:u.g.ACCESS_TOKEN;let l=n!==this.eventData.tokenU;
vendor: 55,995 bytes, lines 7-8
7u.v(this.anonId)||(this.refreshUUID(),l=!0);const d=this.queue.shift();if(this.eventData.lastSuccess){const m=new Date(this.eventData.lastSuccess),g=new Date(d),x=(d-this.eventData.lastSuccess)/864e5;l=l||x>=1||x<-1||m.getDate()!==g.getDate()}else l=!0;if(!l)return void this.processRequests();const p={version:"2.2",sdkIdentifier:"mapbox-gl-js",sdkVersion:No,skuId:pa,"enabled.telemetry":!1,userId:this.anonId,bundleFormat:"umd",bundleDistribution:Xi};To&&(p.sdkInfo=To),this.postEvent(d,p,m=>{m||(this.eventData.lastSuccess=d,this.eventData.tokenU=n)},s)}},Bs=Zi.postTurnstileEvent.bind(Zi),al=new class extends hr{constructor(){super("map.load"),this.success={},this.skuToken=""}postMapLoadEvent(s,t,n,l){this.skuToken=t,this.errorCb=l,u.g.EVENTS_URL&&(n||u.g.ACCESS_TOKEN?this.queueRequest({id:s,timestamp:Date.now()},n):this.errorCb(new Error(ol)))}processRequests(s){if(this.pendingRequest||this.queue.length===0)return;const{id:t,timestamp:n}=this.queue.shift();if(t&&this.success[t])return;this.anonId&&this.anonIdTimestamp||this.fetchEventData(),u.v(this.anonId)||this.refreshUUID();const l={version:"2.2",sdkIdentifier:"mapbox-gl-js",sdkVersion:No,skuId:pa,skuToken:this.skuToken,userId:this.anonId,bundleFormat:"umd",bundleDistribution:Xi};To&&(l.sdkInfo=To),this.postEvent(n,l,d=>{d?this.errorCb(d):t&&(this.success[t]=!0)},s)}remove(){this.errorCb=null}},is=al.postMapLoadEvent.bind(al),or=new class extends hr{constructor(){super("style.load"),this.eventIdPerMapInstanceMap=new Map,this.mapInstanceIdMap=new WeakMap}getMapInstanceId(s){let t=this.mapInstanceIdMap.get(s);return t||(t=u.u(),this.mapInstanceIdMap.set(s,t)),t}getEventId(s){const t=this.eventIdPerMapInstanceMap.get(s)||0;return this.eventIdPerMapInstanceMap.set(s,t+1),t}postStyleLoadEvent(s,t){const{map:n,style:l,importedStyles:d}=t;if(!Os(s))return;const p=this.getMapInstanceId(n),m={mapInstanceId:p,eventId:this.getEventId(p),style:l};d.length&&(m.importedStyles=d),this.queueRequest({timestamp:Date.now(),payload:m},s)}processRequests(s){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:t,payload:n}=this.queue.shift();this.postEvent(t,n,()=>{},s)}},ll=or.postStyleLoadEvent.bind(or),rs=new _a({attributes:[{name:"maps/js/layer-animations/style-with-appearances"}]}),xu=rs.postMetricsEvent.bind(rs),ac=new _a({attributes:[{name:"maps/js/layer-animations/runtime-appearances"}]}),vu=ac.postMetricsEvent.bind(ac),kn=new class extends hr{constructor(){super("gljs.performance")}postPerformanceEvent(s,t){Os(s)&&this.queueRequest({timestamp:Date.now(),performanceData:t},s)}processRequests(s){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:t,performanceData:n}=this.queue.shift(),l=(function(d){const p=performance.getEntriesByType("resource"),m=performance.getEntriesByType("mark"),g=(function(M){const D={};if(M){for(const z in M)if(z!=="other")for(const O of M[z]){const k=`${z}ResolveRangeMin`,q=`${z}ResolveRangeMax`,$=`${z}RequestCount`,U=`${z}RequestCachedCount`;D[k]=Math.min(D[k]||1/0,O.startTime),D[q]=Math.max(D[q]||-1/0,O.responseEnd);const Q=Y=>{D[Y]===void 0&&(D[Y]=0),++D[Y]};O.transferSize!==void 0&&O.transferSize===0&&Q(U),Q($)}}return D})((function(M,D){const z={};if(M)for(const O of M){const k=D(O);z[k]===void 0&&(z[k]=[]),z[k].push(O)}return z})(p,ma)),x=window.devicePixelRatio,w=navigator.connection||navigator.mozConnection||navigator.webkitConnection,E=w?w.effectiveType:void 0,A={counters:[],metadata:[],attributes:[]},I=(M,D,z)=>{z!=null&&M.push({name:D,value:z.toString()})};for(const M in g)I(A.counters,M,g[M]);if(d.interactionRange[0]!==1/0&&d.interactionRange[1]!==-1/0&&(I(A.counters,"interactionRangeMin",d.interactionRange[0]),I(A.counters,"interactionRangeMax",d.interactionRange[1])),m)for(const M of Object.values(zs)){const D=m.find(z=>z.name===M);D&&I(A.counters,M,D.startTime)}return I(A.counters,"visibilityHidden",d.visibilityHidden),I(A.attributes,"style",(function(M){if(M)for(const D of M){const z=D.name.split("?")[0];if(u.i(z)){const O=z.split("/").slice(-2);if(O.length===2)return`mapbox://styles/${O[0]}/${O[1]}`}}})(p)),I(A.attributes,"terrainEnabled",d.terrainEnabled?"true":"false"),I(A.attributes,"fogEnabled",d.fogEnabled?"true":"false"),I(A.attributes,"projection",d.projection),I(A.attributes,"zoom",d.zoom),I(A.metadata,"devicePixelRatio",x),I(A.metadata,"connectionEffectiveType",E),I(A.metadata,"navigatorUserAgent",navigator.userAgent),I(A.metadata,"screenWidth",window.screen.width),I(A.metadata,"screenHeight",window.screen.height),I(A.metadata,"windowWidth",window.innerWidth),I(A.metadata,"windowHeight",window.innerHeight),I(A.metadata,"mapWidth",d.width/x),I(A.metadata,"mapHeight",d.height/x),I(A.metadata,"webglRenderer",d.renderer),I(A.metadata,"webglVendor",d.vendor),I(A.metadata,"sdkVersion",No),I(A.metadata,"sdkIdentifier","mapbox-gl-js"),A})(n);for(const d of l.metadata);for(const d of l.counters);for(const d of l.attributes);this.postEvent(t,l,()=>{},s)}},ks=kn.postPerformanceEvent.bind(kn),ga=new class extends hr{constructor(){super("map.auth"),this.success={},this.skuToken=""}getSession(s,t,n,l){if(!u.g.API_URL||!u.g.SESSION_PATH)return;const d=mi(u.g.API_URL+u.g.SESSION_PATH);d.params.push(`sku=${t||""}`),d.params.push(`access_token=${l||u.g.ACCESS_TOKEN||""}`);const p={url:rn(d),headers:{"Content-Type":"text/plain"}};this.pendingRequest=!0,u.h(p).then(()=>{this.pendingRequest=!1,n(null),this.saveEventData(),this.processRequests(l)}).catch(m=>{this.pendingRequest=!1,n(m),this.saveEventData(),this.processRequests(l)})}getSessionAPI(s,t,n,l){this.skuToken=t,this.errorCb=l,u.g.EVENTS_URL&&u.g.SESSION_PATH&&u.g.API_URL&&(n||u.g.ACCESS_TOKEN?this.queueRequest({id:s,timestamp:Date.now()},n):this.errorCb(new Error(ol)))}processRequests(s){if(this.pendingRequest||this.queue.length===0)return;const{id:t,timestamp:n}=this.queue.shift();t&&this.success[t]||this.getSession(n,this.skuToken,l=>{l?this.errorCb(l):t&&(this.success[t]=!0)},s)}remove(){this.errorCb=null}},lc=ga.getSessionAPI.bind(ga),Ns=new Set;function qr(s,t){t?Ns.add(s):Ns.delete(s)}class ya{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,n){this._updatedSourceCaches[t]=n,this.setDirty()}discardSourceCacheUpdate(t){delete this._updatedSourceCaches[t]}updateLayer(t){const n=t.scope;this._updatedLayers[n]=this._updatedLayers[n]||new Set,this._updatedLayers[n].add(t.id),this.setDirty()}removeLayer(t){const n=t.scope;this._removedLayers[n]=this._removedLayers[n]||{},this._updatedLayers[n]=this._updatedLayers[n]||new Set,this._removedLayers[n][t.id]=t,this._updatedLayers[n].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 n in this._updatedLayers)t[n]=t[n]||{},t[n].updatedIds=Array.from(this._updatedLayers[n].values());for(const n in this._removedLayers)t[n]=t[n]||{},t[n].removedIds=Object.keys(this._removedLayers[n]);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,n){this._updatedImages[n]=this._updatedImages[n]||new Set,this._updatedImages[n].add(u.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={}}}class cc{constructor(t){this._layer=t,this._filterDependencies=void 0}invalidateFilter(){this._filterDependencies=void 0}get _filterDeps(){return this._filterDependencies===void 0&&(this._filterDependencies=this._computeFilterDependencies()),this._filterDependencies}_computeFilterDependencies(){const t=this._layer;if(!t.type||t.type==="custom"||t.type==="background"||t.type==="sky"||t.type==="slot")return null;const n=u.n(t.filter,u.m[`filter_${t.type}`]);return n.result==="error"?null:{configDependencies:n.value.configDependencies,isIndoorDependent:n.value.isIndoorDependent}}hasConfigDependency(t){const{_unevaluatedLayout:n,_transitionablePaint:l}=this._layer;if(n&&n.configDependencies.has(t)||l&&l.configDependencies.has(t))return!0;const d=this._filterDeps;return!!d&&d.configDependencies.has(t)}get isConfigDependent(){const{_unevaluatedLayout:t,_transitionablePaint:n}=this._layer;if(t&&t.configDependencies.size!==0||n&&n.configDependencies.size!==0)return!0;const l=this._filterDeps;return!!l&&l.configDependencies.size!==0}get isIndoorDependent(){const{_unevaluatedLayout:t,_transitionablePaint:n}=this._layer;if(t&&t.isIndoorDependent()||n&&n.isIndoorDependent())return!0;const l=this._filterDeps;return!!l&&l.isIndoorDependent}}function cl(s){const{userImage:t}=s;return!!(t&&t.render&&t.render())&&(s.data.replace(new Uint8Array(t.data.buffer)),!0)}const ul=new u.C(0,0,0);function yr(s,t){const n=[],l=s[`stretch_${t}`];let d=null;for(let p=0;p<l.length;p++)d===null?d=n.length===0?l[0]:n.at(-1)[1]+l[p]:(n.push([d,d+l[p]]),d=null);s[`stretch_${t}_areas`]=n}function Eo(s,t){const n={name:void 0};let l;for(;l=s.nextField(t);)l===1?n.name=s.readString():l===2?n.metadata=hl(s,s.readVarint()+s.pos):l===3&&(n.usvg_tree=Vs(s,s.readVarint()+s.pos),n.data="usvg_tree");return(function(d){if(d.usvg_tree.height||(d.usvg_tree.height=d.usvg_tree.width),!d.metadata)return d;const{metadata:p}=d;if(p.content_area){const{content_area:m}=p;m.left==null&&(m.left=0),m.top==null&&(m.top=m.left),m.width==null&&(m.width=d.usvg_tree.width),m.height==null&&(m.height=m.width)}if(p.text_placeholder){const{text_placeholder:m}=p;m.top==null&&(m.top=m.left),m.height==null&&(m.height=m.width)}return p.stretch_x&&p.stretch_x.length&&yr(p,"x"),p.stretch_y&&p.stretch_y.length&&yr(p,"y"),d})(n)}function hl(s,t){const n={stretch_x:null,stretch_y:null,stretch_x_areas:null,stretch_y_areas:null,variables:[]};let l;for(;l=s.nextField(t);)l===1?n.stretch_x=s.readPackedVarint():l===2?n.stretch_y=s.readPackedVarint():l===3?n.content_area=ns(s,s.readVarint()+s.pos):l===4?n.variables.push(Uo(s,s.readVarint()+s.pos)):l===5&&(n.text_placeholder=ns(s,s.readVarint()+s.pos));return n}function ns(s,t){const n={};let l;for(;l=s.nextField(t);)l===1?n.left=s.readVarint():l===2?n.width=s.readVarint():l===3?n.top=s.readVarint():l===4&&(n.height=s.readVarint());return n}function Uo(s,t){const n={name:void 0};let l;for(;l=s.nextField(t);)l===1?n.name=s.readString():l===2&&(n.rgb_color=En(s.readVarint()),n.value="rgb_color");return n}function Vs(s,t){const n={width:20,children:[],linear_gradients:[],radial_gradients:[],clip_paths:[],masks:[],height:20};let l;for(;l=s.nextField(t);)l===1?n.width=n.height=s.readVarint():l===2?n.height=s.readVarint():l===3?n.children.push(os(s,s.readVarint()+s.pos)):l===4?n.linear_gradients.push(ss(s,s.readVarint()+s.pos)):l===5?n.radial_gradients.push(ad(s,s.readVarint()+s.pos)):l===7?n.clip_paths.push(bu(s,s.readVarint()+s.pos)):l===8&&n.masks.push(hc(s,s.readVarint()+s.pos));return n}function os(s,t){const n={};let l;for(;l=s.nextField(t);)l===1?(n.group=uc(s,s.readVarint()+s.pos),n.node="group"):l===2&&(n.path=sd(s,s.readVarint()+s.pos),n.node="path");return n}function uc(s,t){const n={opacity:255,children:[]};let l;for(;l=s.nextField(t);)l===1?n.transform=Hr(s,s.readVarint()+s.pos):l===2?n.opacity=s.readVarint():l===5?n.clip_path_idx=s.readVarint():l===6?n.mask_idx=s.readVarint():l===7&&n.children.push(os(s,s.readVarint()+s.pos));return n}function Hr(s,t){const n={sx:1,ky:0,kx:0,sy:1,tx:0,ty:0};let l;for(;l=s.nextField(t);)l===1?n.sx=s.readFloat():l===2?n.ky=s.readFloat():l===3?n.kx=s.readFloat():l===4?n.sy=s.readFloat():l===5?n.tx=s.readFloat():l===6&&(n.ty=s.readFloat());return n}function sd(s,t){const n={paint_order:1,commands:[],step:1,diffs:[],rule:1};let l;for(;l=s.nextField(t);)l===1?n.fill=dl(s,s.readVarint()+s.pos):l===2?n.stroke=Ne(s,s.readVarint()+s.pos):l===3?n.paint_order=s.readVarint():l===5?s.readPackedVarint(n.commands):l===6?n.step=s.readFloat():l===7?s.readPackedSVarint(n.diffs):l===8&&(n.rule=s.readVarint());return n}function dl(s,t){const n={rgb_color:ul,paint:"rgb_color",opacity:255};let l;for(;l=s.nextField(t);)l===1?(n.rgb_color=En(s.readVarint()),n.paint="rgb_color"):l===2?(n.linear_gradient_idx=s.readVarint(),n.paint="linear_gradient_idx"):l===3?(n.radial_gradient_idx=s.readVarint(),n.paint="radial_gradient_idx"):l===5&&(n.opacity=s.readVarint());return n}function Ne(s,t){const n={rgb_color:ul,paint:"rgb_color",dasharray:[],dashoffset:0,miterlimit:4,opacity:255,width:1,linecap:1,linejoin:1};let l;for(;l=s.nextField(t);)l===1?(n.rgb_color=En(s.readVarint()),n.paint="rgb_color"):l===2?(n.linear_gradient_idx=s.readVarint(),n.paint="linear_gradient_idx"):l===3?(n.radial_gradient_idx=s.readVarint(),n.paint="radial_gradient_idx"):l===5?s.readPackedFloat(n.dasharray):l===6?n.dashoffset=s.readFloat():l===7?n.miterlimit=s.readFloat():l===8?n.opacity=s.readVarint():l===9?n.width=s.readFloat():l===10?n.linecap=s.readVarint():l===11&&(n.linejoin=s.readVarint());return n}function En(s){return new u.C((s>>16&255)/255,(s>>8&255)/255,(255&s)/255,1)}function ss(s,t){const n={spread_method:1,stops:[],x1:0,y1:0,x2:1,y2:0};let l;for(;l=s.nextField(t);)l===1?n.transform=Hr(s,s.readVarint()+s.pos):l===2?n.spread_method=s.readVarint():l===3?n.stops.push(Us(s,s.readVarint()+s.pos)):l===4?n.x1=s.readFloat():l===5?n.y1=s.readFloat():l===6?n.x2=s.readFloat():l===7&&(n.y2=s.readFloat());return n}function Us(s,t){const n={offset:0,opacity:255,rgb_color:ul};let l;for(;l=s.nextField(t);)l===1?n.offset=s.readFloat():l===2?n.opacity=s.readVarint():l===3&&(n.rgb_color=En(s.readVarint()));return n}function ad(s,t){const n={spread_method:1,stops:[],cx:.5,cy:.5,r:.5,fx:.5,fy:.5,fr:0};let l;for(;l=s.nextField(t);)l===1?n.transform=Hr(s,s.readVarint()+s.pos):l===2?n.spread_method=s.readVarint():l===3?n.stops.push(Us(s,s.readVarint()+s.pos)):l===4?n.cx=s.readFloat():l===5?n.cy=s.readFloat():l===6?n.r=s.readFloat():l===7?n.fx=s.readFloat():l===8?n.fy=s.readFloat():l===9&&(n.fr=s.readFloat());return n}function bu(s,t){const n={children:[]};let l;for(;l=s.nextField(t);)l===1?n.transform=Hr(s,s.readVarint()+s.pos):l===2?n.clip_path_idx=s.readVarint():l===3&&n.children.push(os(s,s.readVarint()+s.pos));return n}function hc(s,t){const n={left:0,width:20,mask_type:1,children:[]};let l;for(;l=s.nextField(t);)l===1?n.left=n.top=s.readFloat():l===2?n.width=n.height=s.readFloat():l===3?n.top=s.readFloat():l===4?n.height=s.readFloat():l===5?n.mask_type=s.readVarint():l===6?n.mask_idx=s.readVarint():l===7&&n.children.push(os(s,s.readVarint()+s.pos));return n.height==null&&(n.height=n.width),n.top==null&&(n.top=n.left),n}class as{static calculate(t={},n=[]){const l=new Map,d=new Map;if(Object.keys(t).length===0)return l;n.forEach(p=>{d.set(p.name,p.rgb_color||new u.C(0,0,0))});for(const[p,m]of Object.entries(t))d.has(p)?l.set(d.get(p).toString(),m):console.warn(`Ignoring unknown image variable "${p}"`);return l}}function Nn(s,t=255,n){const l=n.get(s.toString())||s;return t===255?l.toString():new u.C(l.r,l.g,l.b,l.a*t/255).toString()}const ls=[];let dc=0;function cs(s,t){if(dc>=ls.length){const l=u.x()?new OffscreenCanvas(s,t).getContext("2d",{willReadFrequently:!0}):document.createElement("canvas").getContext("2d",{willReadFrequently:!0});ls.push(l)}const n=ls[dc++];return n.canvas.width=s,n.canvas.height=t,n}function Vn(){dc--}function fl(s,t,n,l,d){for(const p of l.children)us(s,t,n,p,d)}function us(s,t,n,l,d){l.group?(s.save(),(function(p,m,g,x,w){const E=x.mask_idx!=null?g.masks[x.mask_idx]:null,A=x.clip_path_idx!=null?g.clip_paths[x.clip_path_idx]:null;if(x.transform&&(m=re(x.transform).preMultiplySelf(m)),!(function(M,D,z){return M.opacity!==255||D||z})(x,A!=null,E!=null))return void fl(p,m,g,x,w);const I=cs(p.canvas.width,p.canvas.height);fl(I,m,g,x,w),A&&F(I,m,g,A),E&&j(I,m,g,E,w),p.globalAlpha=x.opacity/255,p.drawImage(I.canvas,0,0),Vn()})(s,t,n,l.group,d),s.restore()):l.path&&(s.save(),(function(p,m,g,x,w){p.setTransform(m),x.paint_order===1?(pl(p,g,x,w),ml(p,g,x,w)):(ml(p,g,x,w),pl(p,g,x,w))})(s,t,n,l.path,d),s.restore())}function pl(s,t,n,l){const d=n.fill;if(!d)return;const p=d.opacity/255;switch(s.save(),s.beginPath(),te(n,s),d.paint){case"rgb_color":s.fillStyle=Nn(d.rgb_color,d.opacity,l);break;case"linear_gradient_idx":{const m=t.linear_gradients[d.linear_gradient_idx];m.transform&&s.setTransform(re(m.transform).preMultiplySelf(s.getTransform())),s.fillStyle=Tu(s,m,p,l);break}case"radial_gradient_idx":{const m=t.radial_gradients[d.radial_gradient_idx];m.transform&&s.setTransform(re(m.transform).preMultiplySelf(s.getTransform())),s.fillStyle=jt(s,m,p,l)}}s.fill(wu(n)),s.restore()}function wu(s){return s.rule===1?"nonzero":s.rule===2?"evenodd":void 0}function ml(s,t,n,l){const d=n.stroke;if(!d)return;const p=ce(n);s.lineWidth=d.width,s.miterLimit=d.miterlimit,s.setLineDash(d.dasharray),s.lineDashOffset=d.dashoffset;const m=d.opacity/255;switch(d.paint){case"rgb_color":s.strokeStyle=Nn(d.rgb_color,d.opacity,l);break;case"linear_gradient_idx":s.strokeStyle=Tu(s,t.linear_gradients[d.linear_gradient_idx],m,l,!0);break;case"radial_gradient_idx":s.strokeStyle=jt(s,t.radial_gradients[d.radial_gradient_idx],m,l,!0)}switch(d.linejoin){case 2:case 1:s.lineJoin="miter";break;case 3:s.lineJoin="round";break;case 4:s.lineJoin="bevel"}switch(d.linecap){case 1:s.lineCap="butt";break;case 2:s.lineCap="round";break;case 3:s.lineCap="square"}s.stroke(p)}function Tu(s,t,n,l,d=!1){if(t.stops.length===1){const I=t.stops[0];return Nn(I.rgb_color,I.opacity*n,l)}const{x1:p,y1:m,x2:g,y2:x}=t;let w=new DOMPoint(p,m),E=new DOMPoint(g,x);if(d){const I=re(t.transform);w=I.transformPoint(w),E=I.transformPoint(E)}const A=s.createLinearGradient(w.x,w.y,E.x,E.y);for(const I of t.stops)A.addColorStop(I.offset,Nn(I.rgb_color,I.opacity*n,l));return A}function jt(s,t,n,l,d=!1){if(t.stops.length===1){const k=t.stops[0];return Nn(k.rgb_color,k.opacity*n,l)}const p=re(t.transform),{fx:m,fy:g,fr:x,cx:w,cy:E,r:A}=t;let I=new DOMPoint(m,g),M=new DOMPoint(w,E),D=x,z=A;if(d){I=p.transformPoint(I),M=p.transformPoint(M);const k=(p.a+p.d)/2;D=x*k,z=t.r*k}const O=s.createRadialGradient(I.x,I.y,D,M.x,M.y,z);for(const k of t.stops)O.addColorStop(k.offset,Nn(k.rgb_color,k.opacity*n,l));return O}function de(s,t,n,l){const d=l.transform?re(l.transform).preMultiplySelf(t):t,p=cs(s.canvas.width,s.canvas.height);for(const g of l.children)if(g.group)de(p,d,n,g.group);else if(g.path){const x=g.path,w=new Path2D;w.addPath(ce(x),d),p.fill(w,wu(x))}const m=l.clip_path_idx!=null?n.clip_paths[l.clip_path_idx]:null;m&&F(p,d,n,m),s.globalCompositeOperation="source-over",s.drawImage(p.canvas,0,0),Vn()}function F(s,t,n,l){const d=cs(s.canvas.width,s.canvas.height);de(d,t,n,l),s.globalCompositeOperation="destination-in",s.drawImage(d.canvas,0,0),Vn()}function j(s,t,n,l,d){if(l.children.length===0)return;const p=l.mask_idx!=null?n.masks[l.mask_idx]:null;p&&j(s,t,n,p,d);const m=s.canvas.width,g=s.canvas.height,x=cs(m,g),w=l.width,E=l.height,A=l.left,I=l.top,M=new Path2D,D=new Path2D;D.rect(A,I,w,E),M.addPath(D,t),x.clip(M);for(const k of l.children)us(x,t,n,k,d);const z=x.getImageData(0,0,m,g),O=z.data;if(l.mask_type===1)for(let k=0;k<O.length;k+=4)O[k+3]=O[k+3]/255*(.2126*O[k]+.7152*O[k+1]+.0722*O[k+2]);x.putImageData(z,0,0),s.globalCompositeOperation="destination-in",s.drawImage(x.canvas,0,0),Vn()}function re(s){return s?new DOMMatrix([s.sx,s.ky,s.kx,s.sy,s.tx,s.ty]):new DOMMatrix}function te(s,t){const n=s.step;let l=s.diffs[0]*n,d=s.diffs[1]*n;t.moveTo(l,d);for(let p=0,m=2;p<s.commands.length;p++)switch(s.commands[p]){case 1:l+=s.diffs[m++]*n,d+=s.diffs[m++]*n,t.moveTo(l,d);break;case 2:l+=s.diffs[m++]*n,d+=s.diffs[m++]*n,t.lineTo(l,d);break;case 3:{const g=l+s.diffs[m++]*n,x=d+s.diffs[m++]*n;l=g+s.diffs[m++]*n,d=x+s.diffs[m++]*n,t.quadraticCurveTo(g,x,l,d);break}case 4:{const g=l+s.diffs[m++]*n,x=d+s.diffs[m++]*n,w=g+s.diffs[m++]*n,E=x+s.diffs[m++]*n;l=w+s.diffs[m++]*n,d=E+s.diffs[m++]*n,t.bezierCurveTo(g,x,w,E,l,d);break}case 5:t.closePath()}return t}function ce(s){return te(s,new Path2D)}class le{constructor(){this.cacheMap=new Map,this.cacheDependenciesMap=new Map}static _getImage(t){return new u.t(t,t.data)}getFromCache(t,n,l){return this.cacheMap.has(l)||this.cacheMap.set(l,new u.L(150)),this.cacheMap.get(l).get(u.y(t.toString(),n))}setInCache(t,n,l,d){this.cacheDependenciesMap.has(d)||this.cacheDependenciesMap.set(d,new Map),this.cacheMap.has(d)||this.cacheMap.set(d,new u.L(150));const p=this.cacheDependenciesMap.get(d),m=u.y(t.id.toString(),l);p.get(m)||p.set(m,new Set);const g=this.cacheMap.get(d),x=t.toString();p.get(m).add(x),g.put(u.y(t.toString(),l),n)}removeImagesFromCacheByIds(t,n,l=0){if(!this.cacheMap.has(l)||!this.cacheDependenciesMap.has(l))return;const d=this.cacheMap.get(l),p=this.cacheDependenciesMap.get(l);for(const m of t){const g=u.y(m.toString(),n);if(p.has(g)){for(const x of p.get(g))d.delete(x);p.delete(g)}}}rasterize(t,n,l,d){const p=this.getFromCache(t,l,d);if(p)return p.clone();const m=(function(x,w){const E=as.calculate(w.params,x.metadata?x.metadata.variables:[]),A=x.usvg_tree,I=A.width,M=A.height,D=Math.max(1,Math.round(I*w.sx)),z=Math.max(1,Math.round(M*w.sy)),O=new DOMMatrix([D/I,0,0,z/M,0,0]),k=cs(D,z);fl(k,O,A,A,E);const q=k.getImageData(0,0,D,z);return Vn(),q})(n.icon,t),g=le._getImage(m);return this.setInCache(t,g,l,d),g.clone()}}class ye extends u.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 u.z,this.dirty=!0,this.spriteFormat=t,this.imageRasterizer=new le}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 u.t({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 n=this.atlasTexture.get(t);n&&(n.destroy(),this.atlasTexture.delete(t))}addImageProvider(t,n){this.imageProviders.has(n)||this.imageProviders.set(n,new Map),this.imageProviders.get(n).set(t.id,t)}removeImageProvider(t,n){this.imageProviders.has(n)&&this.imageProviders.get(n).delete(t)}getPendingImageProviders(){const t=[];for(const n of this.imageProviders.values())for(const l of n.values())l.hasPendingRequests()&&t.push(l);return t}isLoaded(){for(const t of this.loaded.keys())if(!this.loaded.get(t))return!1;return!0}setLoaded(t,n){if(this.loaded.get(n)!==t&&(this.loaded.set(n,t),t)){for(const{ids:l,callback:d}of this.requestors)this._notify(l,n,d);this.requestors=[]}}hasImage(t,n){return!!this.getImage(t,n)}getImage(t,n){return this.images.get(n).get(t.toString())}addImage(t,n,l){if(this._validate(t,l)){this.images.get(n).set(t.toString(),l);const d=this.imageVersions.get(n),p=d.get(t.toString())||0;d.set(t.toString(),p+1)}}_validate(t,n){let l=!0;return this._validateStretch(n.stretchX,n.data&&n.data.width)||(this.fire(new u.A(new Error(`Image "${t.name}" has invalid "stretchX" value`))),l=!1),this._validateStretch(n.stretchY,n.data&&n.data.height)||(this.fire(new u.A(new Error(`Image "${t.name}" has invalid "stretchY" value`))),l=!1),this._validateContent(n.content,n)||(this.fire(new u.A(new Error(`Image "${t.name}" has invalid "content" value`))),l=!1),l}_validateStretch(t,n){if(!t)return!0;let l=0;for(const d of t){if(d[0]<l||d[1]<d[0]||n<d[1])return!1;l=d[1]}return!0}_validateContent(t,n){return t?t.length!==4||!n.usvg&&(t[0]<0||n.data.width<t[0]||t[1]<0||n.data.height<t[1]||t[2]<0||n.data.width<t[2]||t[3]<0||n.data.height<t[3])?!1:!(t[2]<t[0]||t[3]<t[1]):!0}updateImage(t,n,l){const d=this.images.get(n).get(t.toString());l.version=d.version+1,this.images.get(n).set(t.toString(),l),this.updatedImages.get(n).add(t);const p=this.imageVersions.get(n),m=p.get(t.toString())||0;p.set(t.toString(),m+1),this.removeFromImageRasterizerCache(t,n)}clearUpdatedImages(t){this.updatedImages.get(t).clear()}removeFromImageRasterizerCache(t,n){this.spriteFormat!=="raster"&&this.imageRasterizer.removeImagesFromCacheByIds([t],n)}removeImage(t,n){const l=this.images.get(n),d=l.get(t.toString());l.delete(t.toString());const p=this.imageVersions.get(n),m=p.get(t.toString())||0;p.set(t.toString(),m+1),this.patterns.get(n).delete(t.toString()),this.removeFromImageRasterizerCache(t,n),d.userImage&&d.userImage.onRemove&&d.userImage.onRemove()}listImages(t){return Array.from(this.images.get(t).keys()).map(n=>u.I.from(n))}getImageVersions(t){return this.imageVersions.get(t)||new Map}getImages(t,n,l){const d=[],p=[],m=this.imageProviders.get(n);for(const E of t){if(!E.iconsetId){d.push(E);continue}const A=m.get(E.iconsetId);A&&(this.getImage(E,n)?p.push(E):A.addPendingRequest(E))}if(d.length===0)return void this._notify(p,n,l);let g=!0;const x=!!this.loaded.get(n),w=this.images.get(n);if(!x)for(const E of d)w.has(E.toString())||(g=!1);x||g?this._notify(d,n,l):this.requestors.push({ids:d,scope:n,callback:l})}rasterizeImages(t,n){const l=new Map,{iconTasks:d,patternTasks:p,scope:m}=t;for(const g of[d,p])for(const[x,w]of g.entries()){const E=this.getImage(w.id,m);E&&l.set(x,{image:E,imageVariant:w})}n(null,this._rasterizeImages(m,l))}_rasterizeImages(t,n){const l=new Map;for(const[d,{image:p,imageVariant:m}]of n.entries())l.set(d,this.imageRasterizer.rasterize(m,p,t,0));return l}getUpdatedImages(t){return this.updatedImages.get(t)||new Set}_notify(t,n,l){const d=this.images.get(n),p=new Map;for(const m of t){if(!d.get(m.toString())){if(m.iconsetId)continue;this.fire(new u.B("styleimagemissing",{id:m.name}))}const g=d.get(m.toString());if(!g){u.w(`Image "${m.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 x={data:g.usvg?null:g.data.clone(),pixelRatio:g.pixelRatio,sdf:g.sdf,usvg:g.usvg,stretchX:g.stretchX,stretchY:g.stretchY,content:g.content,hasRenderCallback:!!(g.userImage&&g.userImage.render)};g.usvg&&Object.assign(x,{width:g.icon.usvg_tree.width,height:g.icon.usvg_tree.height}),p.set(u.I.toString(m),x)}l(null,{images:p,versions:this.getImageVersions(n)})}getPixelSize(t){const{width:n,height:l}=this.atlasImage.get(t);return{width:n,height:l}}getPattern(t,n,l){const d=t.toString(),p=this.patterns.get(n),m=p.get(d),g=this.getImage(t,n);if(!g)return null;if(m){if(m.position.version===g.version)return m.position;m.position.version=g.version}else{if(g.usvg&&!g.data){const x=this.getPatternInFlightId(d,n);if(this.patternsInFlight.has(x))return null;this.patternsInFlight.add(x);const w=new u.D(t).scaleSelf(u.r.devicePixelRatio),E=new Map([[w.toString(),{image:g,imageVariant:w}]]),A=this._rasterizeImages(n,E);return this.storePatternImage(w,n,g,l,A),null}this.storePattern(t,n,g)}return this._updatePatternAtlas(n,l),p.get(d).position}getPatternInFlightId(t,n){return u.y(t,n)}hasPatternsInFlight(){return this.patternsInFlight.size!==0}storePatternImage(t,n,l,d,p){const m=t.toString(),g=p?p.get(m):void 0;g&&(l.data=g,this.storePattern(t.id,n,l),this._updatePatternAtlas(n,d),this.patternsInFlight.delete(this.getPatternInFlightId(t.id.toString(),n)))}storePattern(t,n,l){const d={w:l.data.width+2*u.F,h:l.data.height+2*u.F,x:0,y:0},p=new u.G(d,l,u.F);this.patterns.get(n).set(t.toString(),{bin:d,position:p})}destroyAtlasTextures(){for(const t of this.atlasTexture.values())t&&t.destroy();this.atlasTexture.clear()}bind(t,n){const l=t.gl;let d=this.atlasTexture.get(n);d?this.dirty&&(d.update(this.atlasImage.get(n)),this.dirty=!1):(d=new u.T(t,this.atlasImage.get(n),l.RGBA8),this.atlasTexture.set(n,d)),d.bind(l.LINEAR,l.CLAMP_TO_EDGE)}_updatePatternAtlas(t,n){const l=this.patterns.get(t),d=Array.from(l.values()).map(({bin:w})=>w),{w:p,h:m}=u.H(d),g=this.atlasImage.get(t);g.resize({width:p||1,height:m||1});const x=this.images.get(t);for(const[w,{bin:E,position:A}]of l.entries()){let I=A.padding;const M=E.x+I,D=E.y+I,z=x.get(w).data,O=z.width,k=z.height;I=I>1?I-1:I,u.t.copy(z,g,{x:0,y:0},{x:M,y:D},{width:O,height:k},n),u.t.copy(z,g,{x:0,y:k-I},{x:M,y:D-I},{width:O,height:I},n),u.t.copy(z,g,{x:0,y:0},{x:M,y:D+k},{width:O,height:I},n),u.t.copy(z,g,{x:O-I,y:0},{x:M-I,y:D},{width:I,height:k},n),u.t.copy(z,g,{x:0,y:0},{x:M+O,y:D},{width:I,height:k},n),u.t.copy(z,g,{x:O-I,y:k-I},{x:M-I,y:D-I},{width:I,height:I},n),u.t.copy(z,g,{x:0,y:k-I},{x:M+O,y:D-I},{width:I,height:I},n),u.t.copy(z,g,{x:0,y:0},{x:M+O,y:D+k},{width:I,height:I},n),u.t.copy(z,g,{x:O-I,y:0},{x:M-I,y:D+k},{width:I,height:I},n)}this.dirty=!0}beginFrame(){for(const t of this.images.keys())this.callbackDispatchedThisFrame.set(t,new Set);this.imageAtlasCache.beginFrame()}dispatchRenderCallbacks(t,n){const l=this.images.get(n);for(const d of t){if(this.callbackDispatchedThisFrame.get(n).has(d.toString()))continue;this.callbackDispatchedThisFrame.get(n).add(d.toString());const p=l.get(d.toString());cl(p)&&this.updateImage(d,n,p)}}}class K{constructor(t,n,l,d){this.message=(t?`${t}: `:"")+l,d&&(this.identifier=d),n!=null&&n.__line__&&(this.line=n.__line__)}}class be extends K{}function Oe(s){const t=s.value,n=s.valueSpec,l=s.style,d=s.styleSpec,p=s.key,m=s.arrayElementValidator||vi;if(!Array.isArray(t))return[new K(p,t,`array expected, ${u.M(t)} found`)];if(n.length&&t.length!==n.length)return[new K(p,t,`array length ${n.length} expected, length ${t.length} found`)];if(n["min-length"]&&t.length<n["min-length"])return[new K(p,t,`array length at least ${n["min-length"]} expected, length ${t.length} found`)];let g={type:n.value,values:n.values,minimum:n.minimum,maximum:n.maximum,function:void 0};d.$version<7&&(g.function=n.function),u.J(n.value)&&(g=n.value);let x=[];for(let w=0;w<t.length;w++)x=x.concat(m({array:t,arrayIndex:w,value:t[w],valueSpec:g,style:l,styleSpec:d,key:`${p}[${w}]`},!0));return x}function qe(s){const t=s.key,n=s.value,l=s.valueSpec;if(!u.N(n))return[new K(t,n,`number expected, ${u.M(n)} found`)];if(n!=n)return[new K(t,n,"number expected, NaN found")];if("minimum"in l){let d=l.minimum;if(Array.isArray(l.minimum)&&(d=l.minimum[s.arrayIndex]),n<d)return[new K(t,n,`${n} is less than the minimum value ${d}`)]}if("maximum"in l){let d=l.maximum;if(Array.isArray(l.maximum)&&(d=l.maximum[s.arrayIndex]),n>d)return[new K(t,n,`${n} is greater than the maximum value ${d}`)]}return[]}function Ye(s){const t=s.key,n=s.value;if(!u.J(n))return[new K(t,n,`object expected, ${u.M(n)} found`)];const l=s.valueSpec,d=u.K(n.type);let p,m,g,x={};const w=d!=="categorical"&&n.property===void 0,E=!w,A=(function(z){const O=z.stops;return Array.isArray(O)&&Array.isArray(O[0])&&u.J(O[0][0])})(n),I=ar({key:s.key,value:s.value,valueSpec:s.styleSpec.function,style:s.style,styleSpec:s.styleSpec,objectElementValidators:{stops:function(z){if(d==="identity")return[new K(z.key,z.value,'identity function may not have a "stops" property')];let O=[];const k=z.value;return O=O.concat(Oe({key:z.key,value:k,valueSpec:z.valueSpec,style:z.style,styleSpec:z.styleSpec,arrayElementValidator:M})),Array.isArray(k)&&k.length===0&&O.push(new K(z.key,k,"array must have at least one stop")),O},default:function(z){return vi({key:z.key,value:z.value,valueSpec:l,style:z.style,styleSpec:z.styleSpec})}}});return d==="identity"&&w&&I.push(new K(s.key,s.value,'missing required property "property"')),d==="identity"||n.stops||I.push(new K(s.key,s.value,'missing required property "stops"')),d==="exponential"&&l.expression&&!u.O(l)&&I.push(new K(s.key,s.value,"exponential functions not supported")),s.styleSpec.$version>=8&&(E&&!u.Q(l)?I.push(new K(s.key,s.value,"property functions not supported")):w&&!u.S(l)&&I.push(new K(s.key,s.value,"zoom functions not supported"))),d!=="categorical"&&!A||n.property!==void 0||I.push(new K(s.key,s.value,'"property" property is required')),I;function M(z){let O=[];const k=z.value,q=z.key;if(!Array.isArray(k))return[new K(q,k,`array expected, ${u.M(k)} found`)];if(k.length!==2)return[new K(q,k,`array length 2 expected, length ${k.length} found`)];if(A){if(!u.J(k[0]))return[new K(q,k,`object expected, ${u.M(k[0])} found`)];const $=k[0];if($.zoom===void 0)return[new K(q,k,"object stop key must have zoom")];if($.value===void 0)return[new K(q,k,"object stop key must have value")];const U=u.K($.zoom);if(typeof U!="number")return[new K(q,$.zoom,"stop zoom values must be numbers")];if(g&&g>U)return[new K(q,$.zoom,"stop zoom values must appear in ascending order")];U!==g&&(g=U,m=void 0,x={}),O=O.concat(ar({key:`${q}[0]`,value:k[0],valueSpec:{zoom:{}},style:z.style,styleSpec:z.styleSpec,objectElementValidators:{zoom:qe,value:D}}))}else O=O.concat(D({key:`${q}[0]`,value:k[0],style:z.style,styleSpec:z.styleSpec},k));return u.U(u.V(k[1]))?O.concat([new K(`${q}[1]`,k[1],"expressions are not allowed in function stops.")]):O.concat(vi({key:`${q}[1]`,value:k[1],valueSpec:l,style:z.style,styleSpec:z.styleSpec}))}function D(z,O){const k=u.M(z.value),q=u.K(z.value),$=z.value!==null?z.value:O;if(p){if(k!==p)return[new K(z.key,$,`${k} stop domain type must match previous stop domain type ${p}`)]}else p=k;if(k!=="number"&&k!=="string"&&k!=="boolean"&&typeof q!="number"&&typeof q!="string"&&typeof q!="boolean")return[new K(z.key,$,"stop domain value must be a number, string, or boolean")];if(k!=="number"&&d!=="categorical"){let U=`number expected, ${k} found`;return u.Q(l)&&d===void 0&&(U+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new K(z.key,$,U)]}return d!=="categorical"||k!=="number"||typeof q=="number"&&isFinite(q)&&Math.floor(q)===q?d!=="categorical"&&k==="number"&&typeof q=="number"&&typeof m=="number"&&m!==void 0&&q<m?[new K(z.key,$,"stop domain values must appear in ascending order")]:(m=q,d==="categorical"&&q in x?[new K(z.key,$,"stop domain values must be unique")]:(x[q]=!0,[])):[new K(z.key,$,`integer expected, found ${String(q)}`)]}}function st(s){const t=(s.expressionContext==="property"?u.W:u.n)(u.V(s.value),s.valueSpec);if(t.result==="error")return t.value.map(l=>new K(`${s.key}${l.key}`,s.value,l.message));const n=t.value.expression||t.value._styleExpression.expression;if(s.expressionContext==="property"&&s.propertyKey==="text-font"&&!n.outputDefined())return[new K(s.key,s.value,`Invalid data expression for "${s.propertyKey}". Output values must be contained as literals within the expression.`)];if(s.expressionContext==="property"&&s.propertyType==="layout"&&!u.Z(n))return[new K(s.key,s.value,'"feature-state" data expressions are not supported with layout properties.')];if(s.expressionContext==="filter")return ot(n,s);if(s.expressionContext==="appearance")return ht(n,s);if(s.expressionContext&&s.expressionContext.indexOf("cluster")===0){if(!u.X(n,["zoom","feature-state"]))return[new K(s.key,s.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(s.expressionContext==="cluster-initial"&&!u.Y(n))return[new K(s.key,s.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function ot(s,t){const n=new Set(["zoom","feature-state","pitch","distance-from-center"]);if(t.valueSpec&&t.valueSpec.expression)for(const d of t.valueSpec.expression.parameters)n.delete(d);if(n.size===0)return[];const l=[];return s instanceof u._&&n.has(s.name)?[new K(t.key,t.value,`["${s.name}"] expression is not supported in a filter for a ${t.object.type} layer with id: ${t.object.id}`)]:(s.eachChild(d=>{l.push(...ot(d,t))}),l)}const Xt=new Set(["get","has","properties","geometry-type","id"]),St=new Set(["zoom","pitch","distance-from-center","feature","feature-state","measure-light","heatmap-density","line-progress","raster-value","raster-particle-speed","sky-radial-progress"]);function ht(s,t){if(t.valueSpec&&t.valueSpec.expression)for(const l of t.valueSpec.expression.parameters)St.delete(l);if(St.size===0)return[];const n=[];if(s instanceof u._){const l=Xt.has(s.name)?"feature":s.name;if(St.has(l))return[new K(t.key,t.value,`["${s.name}"] is not an allowed parameter`)]}return s.eachChild(l=>{n.push(...ht(l,t))}),n}function Vt(s){const t=s.key,n=s.value,l=s.valueSpec,d=[];return Array.isArray(l.values)?l.values.includes(u.K(n))||d.push(new K(t,n,`expected one of [${l.values.join(", ")}], ${JSON.stringify(n)} found`)):Object.keys(l.values).includes(u.K(n))||d.push(new K(t,n,`expected one of [${Object.keys(l.values).join(", ")}], ${JSON.stringify(n)} found`)),d}function di(s){if(u.a1(u.V(s.value))){const t=s.layerType||"fill";return st({...s,expressionContext:"filter",valueSpec:s.styleSpec[`filter_${t}`]})}return Ai(s)}function Ai(s){const t=s.value,n=s.key;if(!Array.isArray(t))return[new K(n,t,`array expected, ${u.M(t)} found`)];if(t.length<1)return[new K(n,t,"filter array must have at least 1 element")];const l=s.styleSpec;let d=Vt({key:`${n}[0]`,value:t[0],valueSpec:l.filter_operator});const p=()=>{t.length>=2&&(u.a0(t[1])||d.push(new K(`${n}[1]`,t[1],`string expected, ${u.M(t[1])} found`)));for(let m=2;m<t.length;m++)u.K(t[1])==="$type"?d=d.concat(Vt({key:`${n}[${m}]`,value:t[m],valueSpec:l.geometry_type})):u.a0(t[m])||u.N(t[m])||u.$(t[m])||d.push(new K(`${n}[${m}]`,t[m],`string, number, or boolean expected, ${u.M(t[m])} found.`))};switch(u.K(t[0])){case"<":case"<=":case">":case">=":t.length>=2&&u.K(t[1])==="$type"&&d.push(new K(n,t,`"$type" cannot be use with operator "${t[0]}"`)),t.length!==3&&d.push(new K(n,t,`filter array for operator "${t[0]}" must have 3 elements`)),p();break;case"==":case"!=":t.length!==3&&d.push(new K(n,t,`filter array for operator "${t[0]}" must have 3 elements`)),p();break;case"in":case"!in":p();break;case"any":case"all":case"none":for(let m=1;m<t.length;m++)d=d.concat(Ai({key:`${n}[${m}]`,value:t[m],style:s.style,styleSpec:s.styleSpec}));break;case"has":case"!has":t.length!==2?d.push(new K(n,t,`filter array for "${t[0]}" operator must have 2 elements`)):u.a0(t[1])||d.push(new K(`${n}[1]`,t[1],`string expected, ${u.M(t[1])} found`))}return d}const tr=/^{([^}]+)}$/;function sr(s,t){const n=s.key,l=s.style,d=s.layer,p=s.styleSpec,m=s.value,g=s.objectKey,x=p[`${t}_${s.layerType}`];if(!x)return[];const w=g.match(u.a2);if(w&&x[w[1]])return u.U(u.V(m))?[].concat(vi({key:n,value:m,valueSpec:{type:"string",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},style:l,styleSpec:p,expressionContext:"property",propertyType:t,propertyKey:g})):vi({key:n,value:m,valueSpec:{type:"string"},style:l,styleSpec:p});const E=g.match(u.a3);if(t==="paint"&&E&&x[E[1]]&&x[E[1]].transition)return vi({key:n,value:m,valueSpec:p.transition,style:l,styleSpec:p});const A=s.valueSpec||x[g];if(!A)return[new be(n,m,`unknown property "${g}"`)];let I;if(u.a0(m)&&u.Q(A)&&!A.tokens&&(I=tr.exec(m))){const D=`\`{ "type": "identity", "property": ${I?JSON.stringify(I[1]):'"_"'} }\``;return[new K(n,m,`"${g}" does not support interpolation syntax
8Use an identity property function instead: ${D}.`)]}const M=[];if(s.layerType==="symbol")g!=="text-field"||!l||l.glyphs||l.imports||M.push(new K(n,m,'use of "text-field" requires a style "glyphs" property')),g==="text-font"&&u.a4(u.V(m))&&u.K(m.type)==="identity"&&M.push(new K(n,m,'"text-font" does not support identity functions'));else if(s.layerType==="model"&&t==="paint"&&d&&d.layout&&Object.hasOwn(d.layout,"model-id")&&u.Q(A)&&(u.a5(A)||u.S(A))){const D=u.W(u.V(m),A).value,z="expression"in D&&D.expression||"_styleExpression"in D&&D._styleExpression&&D._styleExpression.expression;z&&!u.X(z,["measure-light"])&&(g==="model-emissive-strength"&&u.Y(z)&&u.Z(z)||M.push(new K(n,m,`${g} does not support measure-light expressions when the model layer source is vector tile or GeoJSON.`)))}return M.concat(vi({key:s.key,value:m,valueSpec:A,style:l,styleSpec:p,expressionContext:"property",propertyType:t,propertyKey:g}))}function qi(s){return sr(s,"paint")}function Tr(s){return sr(s,"layout")}function io(s){let t=[];const n=s.value,l=s.key,d=s.style,p=s.styleSpec;if(!u.J(n))return[new K(l,n,"object expected")];n.type||n.ref||t.push(new K(l,n,'either "type" or "ref" is required'));let m=u.K(n.type);const g=u.K(n.ref);if(n.id){const x=u.K(n.id);for(let w=0;w<s.arrayIndex;w++){const E=d.layers[w];u.K(E.id)===x&&t.push(new K(l,n.id,`duplicate layer id "${x}", previously used at line ${E.id.__line__}`))}}if("ref"in n){let x;["type","source","source-layer","filter","layout"].forEach(w=>{w in n&&t.push(new K(l,n[w],`"${w}" is prohibited for ref layers`))}),d.layers.forEach(w=>{u.K(w.id)===g&&(x=w)}),x?x.ref?t.push(new K(l,n.ref,"ref cannot reference another ref layer")):m=u.K(x.type):typeof g=="string"&&t.push(new K(l,n.ref,`ref layer "${g}" not found`))}else if(m!=="background"&&m!=="sky"&&m!=="slot")if(n.source)if(u.a0(n.source)){const x=d.sources&&Object.hasOwn(d.sources,n.source)?d.sources[n.source]:void 0,w=x&&u.K(x.type);x?w==="vector"&&m==="raster"?t.push(new K(l,n.source,`layer "${n.id}" requires a raster source`)):w==="raster"&&m!=="raster"?t.push(new K(l,n.source,`layer "${n.id}" requires a vector source`)):w!=="vector"||n["source-layer"]?w==="raster-dem"&&m!=="hillshade"?t.push(new K(l,n.source,"raster-dem source can only be used with layer type 'hillshade'.")):w!=="raster-array"||["raster","raster-particle"].includes(m)?m==="line"&&n.paint&&n.paint["line-gradient"]&&w==="geojson"&&!x.lineMetrics?t.push(new K(l,n,`layer "${n.id}" specifies a line-gradient, which requires the GeoJSON source to have \`lineMetrics\` enabled.`)):m==="line"&&n.paint&&n.paint["line-trim-offset"]&&w==="geojson"&&!x.lineMetrics?t.push(new K(l,n,`layer "${n.id}" specifies a line-trim-offset, which requires the GeoJSON source to have \`lineMetrics\` enabled.`)):m==="raster-particle"&&w!=="raster-array"&&t.push(new K(l,n.source,`layer "${n.id}" requires a 'raster-array' source.`)):t.push(new K(l,n.source,"raster-array source can only be used with layer type 'raster'.")):t.push(new K(l,n,`layer "${n.id}" must specify a "source-layer"`)):t.push(new K(l,n.source,`source "${n.source}" not found`))}else t.push(new K(`${l}.source`,n.source,'"source" must be a string'));else t.push(new K(l,n,'missing required property "source"'));return t=t.concat(ar({key:l,value:n,valueSpec:p.layer,style:s.style,styleSpec:s.styleSpec,objectElementValidators:{"*":()=>[],type:()=>vi({key:`${l}.type`,value:n.type,valueSpec:p.layer.type,style:s.style,styleSpec:s.styleSpec,object:n,objectKey:"type"}),filter:x=>di({layerType:m,...x}),layout:x=>ar({layer:n,key:x.key,value:x.value,valueSpec:{},style:x.style,styleSpec:x.styleSpec,objectElementValidators:{"*":w=>Tr({layerType:m,...w})}}),paint:x=>ar({layer:n,key:x.key,value:x.value,valueSpec:{},style:x.style,styleSpec:x.styleSpec,objectElementValidators:{"*":w=>qi({layerType:m,layer:n,...w})}}),appearances(x){const w=Oe({key:x.key,value:x.value,valueSpec:x.valueSpec,style:x.style,styleSpec:x.styleSpec,arrayElementValidator:I=>(function(M){const{key:D,layer:z,layerType:O}=M,k=u.K(M.value),q=u.K(k.name),$=u.K(k.condition),U=ar({key:D,value:k,valueSpec:M.styleSpec.appearance,style:M.style,styleSpec:M.styleSpec,objectElementValidators:{condition:Q=>(function(Y){const ae=[];return ae.push(...st({key:Y.key,value:Y.object.condition,valueSpec:u.m.appearance.condition,expressionContext:"appearance"})),ae})({...Q}),properties:Q=>(function(Y){const ae=[],{styleSpec:W,layer:J,layerType:se}=Y,ue=W[`paint_${se}`],he=W[`layout_${se}`],ve=Y.object[Y.objectKey];for(const xe in ve){const Le=xe in ue?"paint":xe in he?"layout":void 0;if(!Le){ae.push(new K(Y.key,xe,`unknown property "${xe}" for layer type "${se}"`));continue}const _e={...Y,key:`${Y.key}.${xe}`,objectKey:xe,layer:J,layerType:se,value:ve[xe],valueSpec:Le==="paint"?ue[xe]:he[xe]};ae.push(...sr(_e,Le))}return ae})({layer:z,layerType:O,...Q})}});return q!=="hidden"&&$===void 0&&U.push(new K(M.key,"name",'Appearance with name different than "hidden" must have a condition')),U})({layerType:m,layer:n,...I})}),E=Array.isArray(x.value)?x.value:[],A=new Set;return E.forEach((I,M)=>{const D=u.K(I.name);if(D)if(A.has(D)){const z=u.K(n.id);w.push(new K(x.key,D,`Duplicated appearance name "${D}" for layer "${z}"`))}else A.add(D)}),w}}})),t}function Sn({key:s,value:t}){return u.a0(t)?[]:[new K(s,t,`string expected, ${u.M(t)} found`)]}const Ci={promoteId:function s({key:t,value:n}){if(u.a0(n))return Sn({key:t,value:n});if(Array.isArray(n)){const d=[],p=u.V(n),m=u.n(p);return m.result==="error"?(m.value.forEach(g=>{d.push(new K(`${t}${g.key}`,null,`${g.message}`))}),d):(u.X(m.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 K(`${t}`,null,"promoteId expression should be only feature dependent")),d)}if(!u.J(n))return[new K(t,n,`string, expression or object expected, "${u.M(n)}" found`)];const l=[];for(const d in n)l.push(...s({key:`${t}.${d}`,value:n[d]}));return l}};function zi(s){const t=s.value,n=s.key,l=s.styleSpec,d=s.style;if(!u.J(t))return[new K(n,t,`object expected, ${u.M(t)} found`)];if(!("type"in t))return[new K(n,t,'"type" is required')];const p=u.K(t.type);let m=[];switch(["vector","raster","raster-dem","raster-array"].includes(p)&&("url"in t||"tiles"in t||m.push(new be(n,t,'Either "url" or "tiles" is required.'))),p){case"vector":case"raster":case"raster-dem":case"raster-array":return m=m.concat(ar({key:n,value:t,valueSpec:l[`source_${p.replace("-","_")}`],style:s.style,styleSpec:l,objectElementValidators:Ci})),m;case"geojson":if(m=ar({key:n,value:t,valueSpec:l.source_geojson,style:d,styleSpec:l,objectElementValidators:Ci}),"cluster"in t&&"clusterProperties"in t){if(!u.J(t.clusterProperties))return[new K(`${n}.clusterProperties`,t,`object expected, ${u.M(t)} found`)];for(const g in t.clusterProperties){const x=t.clusterProperties[g];if(!Array.isArray(x))return[new K(`${n}.clusterProperties.${g}`,x,"array expected")];const[w,E]=x,A=typeof w=="string"?[w,["accumulated"],["get",g]]:w;m.push(...st({key:`${n}.${g}.map`,value:E,expressionContext:"cluster-map"})),m.push(...st({key:`${n}.${g}.reduce`,value:A,expressionContext:"cluster-reduce"}))}}return m;case"video":return ar({key:n,value:t,valueSpec:l.source_video,style:d,styleSpec:l});case"image":return ar({key:n,value:t,valueSpec:l.source_image,style:d,styleSpec:l});case"canvas":return[new K(n,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Vt({key:`${n}.type`,value:t.type,valueSpec:{values:Yi(l)}})}}function Yi(s){return s.source.reduce((t,n)=>{const l=s[n];return l.type.type==="enum"&&(t=t.concat(Object.keys(l.type.values||{}))),t},[])}function xi(s,t){const n=!s.includes("://");try{return new URL(s,n&&t?"http://example.com":void 0),!0}catch{return!1}}function Hi(s){const t=s.value;return t?u.a0(t)?xi(t,!0)?[]:[new K(s.key,t,`invalid url "${t}"`)]:[new K(s.key,t,`string expected, "${u.M(t)}" found`)]:[]}function pn(s){const t=s.value,n=s.styleSpec,l=n.light,d=s.style;if(t===void 0)return[];if(!u.J(t))return[new K("light",t,`object expected, ${u.M(t)} found`)];let p=[];for(const m in t){const g=m.match(u.a3),x=m.match(u.a2);p=p.concat(x&&l[x[1]]?vi({key:m,value:t[m],valueSpec:{type:"string"},style:d,styleSpec:n}):g&&l[g[1]]&&l[g[1]].transition?vi({key:m,value:t[m],valueSpec:n.transition,style:d,styleSpec:n}):l[m]?vi({key:m,value:t[m],valueSpec:l[m],style:d,styleSpec:n}):[new K(m,t[m],`unknown property "${m}"`)])}return p}function Ki(s){const t=s.value;if(!t)return[];const n=s.key;if(!u.J(t))return[new K(n,t,`object expected, ${u.M(t)} found`)];let l=[];const d=s.styleSpec,p=d["light-3d"],m=s.style,g=s.style.lights;for(const E of["type","id"])if(!(E in t))return l=l.concat([new K(n,t,`missing property "${E}"`)]),l;if(!u.a0(t.type))return l=l.concat([new K(`${n}.type`,t.type,"string expected")]),l;if(g)for(let E=0;E<s.arrayIndex;E++){const A=u.K(t.type),I=g[E];u.K(I.type)===A&&l.push(new K(n,t.id,`duplicate light type "${t.type}", previously defined at line ${I.id.__line__}`))}const x=`properties_light_${t.type}`;if(!(x in d))return l=l.concat([new K(`${n}.type`,t,`Invalid light type ${t.type}`)]),l;const w=d[x];for(const E in t)if(E==="properties"){const A=t[E];if(!u.J(A))return l=l.concat([new K("properties",A,`object expected, ${u.M(A)} found`)]),l;for(const I in A){const M=I.match(u.a3),D=I.match(u.a2);l=l.concat(D&&w[D[1]]?vi({key:E,value:A[I],valueSpec:{type:"string"},style:m,styleSpec:d}):M&&w[M[1]]&&w[M[1]].transition?vi({key:E,value:t[E],valueSpec:d.transition,style:m,styleSpec:d}):w[I]?vi({key:I,value:A[I],valueSpec:w[I],style:m,styleSpec:d}):[new be(s.key,A[I],`unknown property "${I}"`)])}}else l=l.concat(p[E]?vi({key:E,value:t[E],valueSpec:p[E],style:m,styleSpec:d}):[new be(E,t[E],`unknown property "${E}"`)]);return l}function So(s){const t=s.value,n=s.key,l=s.style,d=s.styleSpec,p=d.terrain;if(t==null)return[];if(!u.J(t))return[new K("terrain",t,`object expected, ${u.M(t)} found`)];let m=[];for(const g in t){const x=g.match(u.a3),w=g.match(u.a2);m=m.concat(w&&p[w[1]]?vi({key:g,value:t[g],valueSpec:{type:"string"},style:l,styleSpec:d}):x&&p[x[1]]&&p[x[1]].transition?vi({key:g,value:t[g],valueSpec:d.transition,style:l,styleSpec:d}):p[g]?vi({key:g,value:t[g],valueSpec:p[g],style:l,styleSpec:d}):[new be(g,t[g],`unknown property "${g}"`)])}if(t.source)if(u.a0(t.source)){const g=l.sources&&Object.hasOwn(l.sources,t.source)?l.sources[t.source]:void 0,x=g&&u.K(g.type);g?x!=="raster-dem"&&m.push(new K(`${n}.source`,t.source,`terrain cannot be used with a source of type ${x}, it only be used with a "raster-dem" source type`)):m.push(new K(`${n}.source`,t.source,`source "${t.source}" not found`))}else m.push(new K(`${n}.source`,t.source,"source must be a string"));else m.push(new K(n,t,'terrain is missing required property "source"'));return m}function ii(s){const t=s.value,n=s.style,l=s.styleSpec,d=l.fog;if(t===void 0)return[];if(!u.J(t))return[new K("fog",t,`object expected, ${u.M(t)} found`)];let p=[];for(const m in t){const g=m.match(u.a3),x=m.match(u.a2);p=p.concat(x&&d[x[1]]?vi({key:m,value:t[m],valueSpec:{type:"string"},style:n,styleSpec:l}):g&&d[g[1]]&&d[g[1]].transition?vi({key:m,value:t[m],valueSpec:l.transition,style:n,styleSpec:l}):d[m]?vi({key:m,value:t[m],valueSpec:d[m],style:n,styleSpec:l}):[new be(m,t[m],`unknown property "${m}"`)])}return p}const jo={"*":()=>[],array:Oe,boolean:function(s){const t=s.value,n=s.key;return u.$(t)?[]:[new K(n,t,`boolean expected, ${u.M(t)} found`)]},number:qe,color:function({key:s,value:t}){return u.a0(t)?u.C.parse(u.K(t))===void 0?[new K(s,t,`color expected, "${t}" found`)]:[]:[new K(s,t,`color expected, ${u.M(t)} found`)]},enum:Vt,filter:di,function:Ye,layer:io,object:ar,source:zi,model:Hi,light:pn,"light-3d":Ki,terrain:So,fog:ii,string:Sn,formatted:function(s){return Sn(s).length===0?[]:st(s)},resolvedImage:function(s){return Sn(s).length===0?[]:st(s)},projection:function(s){const t=s.value,n=s.styleSpec,l=n.projection,d=s.style;if(u.J(t)){let p=[];for(const m in t)p=p.concat(vi({key:m,value:t[m],valueSpec:l[m],style:d,styleSpec:n}));return p}return u.a0(t)?[]:[new K("projection",t,`object or string expected, ${u.M(t)} found`)]},import:function(s){const t=s.key,{value:n,styleSpec:l}=s;if(!u.J(n))return[new K(t,n,"import must be an object")];const{data:d,...p}=n;Object.defineProperty(p,"__line__",{value:n.__line__,enumerable:!1});let m=ar({...s,value:p,valueSpec:l.import});return u.K(p.id)===""&&m.push(new K(`${s.key}.id`,p,"import id can't be an empty string")),u.K(p.id)==="__proto__"&&m.push(new K(`${s.key}.id`,p,`import id can't be "__proto__"`)),d&&(m=m.concat(mn(d,l,{key:`${s.key}.data`}))),m},iconset:function(s){const t=s.value,n=s.key,l=s.styleSpec,d=s.style;if(!u.J(t))return[new K(n,t,"object expected")];if(!t.type)return[new K(n,t,'"type" is required')];const p=u.K(t.type);let m=[];if(m=m.concat(ar({key:n,value:t,valueSpec:l[`iconset_${p}`],style:d,styleSpec:l})),(function(g,x){return!(g!=="source"||!x.source)})(p,t)){const g=d.sources&&Object.hasOwn(d.sources,t.source)?d.sources[t.source]:void 0,x=g&&u.K(g.type);g?x!=="raster-array"&&m.push(new K(n,t.source,`iconset cannot be used with a source of type ${String(x)}, it only be used with a "raster-array" source type`)):m.push(new K(n,t.source,`source "${t.source}" not found`))}return m},option:function(s){const t=s.styleSpec,n=s.value,l=u.J(n)&&u.K(n.array)===!0||!u.J(n)?void 0:u.K(n.type);return ar({...s,valueSpec:t.option,objectElementValidators:l?{default:d=>Array.isArray(d.value)?vi({...d,valueSpec:{...d.valueSpec,type:l}}):vi(d)}:void 0})}};function vi(s,t=!1){const n=s.value,l=s.valueSpec,d=s.styleSpec;if(l.expression){if(u.a4(u.K(n)))return Ye(s);if(u.U(u.V(n)))return st(s)}if(l.type&&jo[l.type]){const p=jo[l.type](s);return t===!0&&p.length>0&&Array.isArray(s.value)?st(s):p}return ar({...s,valueSpec:l.type?d[l.type]:l})}function ar(s){const t=s.key,n=s.value,l=s.valueSpec||{},d=s.objectElementValidators||{},p=s.style,m=s.styleSpec;if(!u.J(n))return[new K(t,n,`object expected, ${u.M(n)} found`)];let g=[];for(const x in n){if(!Object.hasOwn(n,x))continue;const w=x.split(".")[0],E=Object.hasOwn(l,w),A=Object.hasOwn(l,"*"),I=E?l[w]:A?l["*"]:void 0;let M;Object.hasOwn(d,w)?M=d[w]:E?M=vi:Object.hasOwn(d,"*")?M=d["*"]:A&&(M=vi),M?g=g.concat(M({key:(t&&`${t}.`)+x,value:n[x],valueSpec:I,style:p,styleSpec:m,object:n,objectKey:x},n)):g.push(new be(t,n[x],`unknown property "${x}"`))}for(const x in l){if(!Object.hasOwn(l,x)||Object.hasOwn(d,x))continue;const w=l[x];!w.required||w.default!==void 0||Object.hasOwn(n,x)&&n[x]!==void 0||g.push(new K(t,n,`missing required property "${x}"`))}return g}function kr({key:s,value:t}){const n=Sn({key:s,value:t});if(n.length)return n;const l=t;return l.includes("{fontstack}")||n.push(new K(s,t,'"glyphs" url must include a "{fontstack}" token')),l.includes("{range}")||n.push(new K(s,t,'"glyphs" url must include a "{range}" token')),n}function mn(s,t=u.m,n={}){return ar({key:n.key||"",value:s,valueSpec:{...t.$root,"*":{type:"*"}},styleSpec:t,style:s,objectElementValidators:{glyphs:kr}})}function Nr(s,t=u.m){return nn(mn(s,t))}const _l=s=>nn(zi(s)),Bp=s=>nn(pn(s)),kp=s=>nn(Ki(s)),Np=s=>nn(So(s)),Vp=s=>nn(ii(s)),ld=s=>nn((function(t){const n=t.value,l=t.style,d=t.styleSpec,p=d.snow;if(n===void 0)return[];if(!u.J(n))return[new K("snow",n,`object expected, ${u.M(n)} found`)];let m=[];for(const g in n){const x=g.match(u.a3);m=m.concat(x&&p[x[1]]&&p[x[1]].transition?vi({key:g,value:n[g],valueSpec:d.transition,style:l,styleSpec:d}):p[g]?vi({key:g,value:n[g],valueSpec:p[g],style:l,styleSpec:d}):[new be(g,n[g],`unknown property "${g}"`)])}return m})(s)),Up=s=>nn((function(t){const n=t.value,l=t.style,d=t.styleSpec,p=d.rain;if(n===void 0)return[];if(!u.J(n))return[new K("rain",n,`object expected, ${u.M(n)} found`)];let m=[];for(const g in n){const x=g.match(u.a3);m=m.concat(x&&p[x[1]]&&p[x[1]].transition?vi({key:g,value:n[g],valueSpec:d.transition,style:l,styleSpec:d}):p[g]?vi({key:g,value:n[g],valueSpec:p[g],style:l,styleSpec:d}):[new be(g,n[g],`unknown property "${g}
8"`)])}return m})(s)),jp=s=>nn(io(s)),fc=s=>nn(di(s)),Gp=s=>nn(qi(s)),hs=s=>nn(Tr(s)),qp=s=>nn(Hi(s));function nn(s){return s.slice().sort((t,n)=>t.line&&n.line?t.line-n.line:0)}function xa(s,t){let n=!1;if(t&&t.length)for(const l of t)l instanceof be?u.w(l.message):(s.fire(new u.A(new Error(l.message))),n=!0);return n}const gl=u.m.light;let cd;class va extends u.E{constructor(t,n="flat"){super(),this._transitionable=new u.a6(cd||(cd=new u.a7({anchor:new u.a8(gl.anchor),position:new u.a9(gl.position),color:new u.a8(gl.color),intensity:new u.a8(gl.intensity)}))),this.setLight(t,n),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(t,n,l={}){this._validate(Bp,t,l)||(this._transitionable.setTransitionOrValue(t),this.id=n)}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,n,l){return(!l||l.validate!==!1)&&xa(this,t.call(Nr,{value:n,style:{glyphs:!0,sprite:!0},styleSpec:u.m}))}}const pc=u.m.terrain;let Hp=class extends u.E{constructor(s,t,n,l,d){super(),this.scope=n,this._transitionable=new u.a6(new u.a7({source:new u.a8(pc.source),exaggeration:new u.a8(pc.exaggeration)}),n,l),this._transitionable.setTransitionOrValue(s,l),this._transitioning=this._transitionable.untransitioned(),this.drapeRenderMode=t,this.worldview=d}get(){return this._transitionable.serialize()}set(s,t){this._transitionable.setTransitionOrValue(s,t)}updateTransitions(s){this._transitioning=this._transitionable.transitioned(s,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(s){this.properties=this._transitioning.possiblyEvaluate(s)}getExaggeration(s){return this._transitioning.possiblyEvaluate(new u.aa(s,{worldview:this.worldview})).get("exaggeration")}getAttenuationRange(){if(!this.isZoomDependent())return null;const s=this._transitionable._values.exaggeration;if(!s)return null;const t=s.value.expression;if(!t)return null;let n=-1,l=-1,d=1;for(const p of t.zoomStops)d=t.evaluate(new u.aa(p,{worldview:this.worldview})),d>.01?(n=p,l=-1):l=p;return d<.01&&n>0&&l>n?[n,l]:null}isZoomDependent(){const s=this._transitionable._values.exaggeration;return s!=null&&s.value!=null&&s.value.expression!=null&&s.value.expression instanceof u.ab}};function yl(s,t){const n=s?s.terrain:null;return!!n&&(!t||!!t.projection.requiresDraping||!n.isZoomDependent()||n.getExaggeration(t.zoom)>0)}const ba=.05;function Eu(s,t,n){const l=u.af(45,65,n),[d,p]=s.range;let m=1-Math.min(1,Math.exp((t-d)/(p-d)*-6));return m*=m*m,m=Math.min(1,1.00747*m),m*l*s.alpha}function ud(s,t,n,l,d){const p=u.ad([],[t,n,l],d.mercatorFogMatrix);return Eu(s,u.ae(p),d.pitch)}function mc(s,t,n,l,d,p,m){const g=[[n,l,0],[d,l,0],[d,p,0],[n,p,0]];let x=Number.MAX_VALUE,w=-Number.MAX_VALUE;for(const E of g){const A=u.ad([],E,t),I=u.ae(A);x=Math.min(x,I),w=Math.max(w,I)}return[Eu(s,x,m.pitch),Eu(s,w,m.pitch)]}const Go=u.m.fog;class xl extends u.E{constructor(t,n,l,d){super();const p=new u.a7({range:new u.a8(Go.range),color:new u.a8(Go.color),"color-use-theme":new u.a8({type:"string","property-type":"data-constant",default:"default"}),"high-color":new u.a8(Go["high-color"]),"high-color-use-theme":new u.a8({type:"string","property-type":"data-constant",default:"default"}),"space-color":new u.a8(Go["space-color"]),"space-color-use-theme":new u.a8({type:"string","property-type":"data-constant",default:"default"}),"horizon-blend":new u.a8(Go["horizon-blend"]),"star-intensity":new u.a8(Go["star-intensity"]),"vertical-range":new u.a8(Go["vertical-range"])});this._transitionable=new u.a6(p,l,d),this.set(t,d),this._transitioning=this._transitionable.untransitioned(),this._transform=n,this.properties=new u.ag(p),this.scope=l}get state(){const t=this._transform,n=t.projection.name==="globe",l=u.ah(t.zoom),d=this.properties.get("range"),p=[2,4.5],m=.5/Math.tan(.5*t._fov),g=[d[0]+m,d[1]+m];return{range:n?[u.ai(p[0],g[0],l),u.ai(p[1],g[1],l)]:g,horizonBlend:this.properties.get("horizon-blend"),alpha:this.properties.get("color").a}}get(){return this._transitionable.serialize()}set(t,n,l={}
vendor: 9,212 bytes, line 8
8){if(this._validate(Vp,t,l))return;const d={...t};for(const p of Object.keys(Go))d[p]===void 0&&(d[p]=Go[p].default);this._options=d,this._transitionable.setTransitionOrValue(this._options,n)}getOpacity(t){if(!this._transform.projection.supportsFog)return 0;const n=this.properties&&this.properties.get("color")||1;return(this._transform.projection.name==="globe"?1:u.af(45,65,t))*n.a}getOpacityAtLatLng(t,n){return this._transform.projection.supportsFog?(function(l,d,p){const m=u.ac.fromLngLat(d),g=p.elevation?p.elevation.getAtPointOrZero(m):0;return ud(l,m.x,m.y,g,p)})(this.state,t,n):0}getOpacityForTile(t){if(!this._transform.projection.supportsFog)return[1,1];const n=this._transform.calculateFogTileMatrix(t.toUnwrapped());return mc(this.state,n,0,0,u.aj,u.aj,this._transform)}getOpacityForBounds(t,n,l,d,p){return this._transform.projection.supportsFog?mc(this.state,t,n,l,d,p,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 n=[4,5,6,7];for(const l of n){const d=t.points[l];let p;if(d[2]>=0)p=d;else{const m=t.points[l-4];p=u.ak(m,d,m[2]/(m[2]-d[2]))}if(ud(this.state,p[0],p[1],0,this._transform)>=ba)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,n,l){return(!l||l.validate!==!1)&&xa(this,t.call(Nr,{value:n,style:{glyphs:!0,sprite:!0},styleSpec:u.m}))}}let $p,vl,Su=class extends u.E{constructor(s,t,n,l){super();const d=$p||($p=new u.a7({density:new u.a8(u.m.snow.density),intensity:new u.a8(u.m.snow.intensity),color:new u.a8(u.m.snow.color),opacity:new u.a8(u.m.snow.opacity),vignette:new u.a8(u.m.snow.vignette),"vignette-color":new u.a8(u.m.snow["vignette-color"]),"center-thinning":new u.a8(u.m.snow["center-thinning"]),direction:new u.a8(u.m.snow.direction),"flake-size":new u.a8(u.m.snow["flake-size"])}));this._transitionable=new u.a6(d,n,l),this.set(s,l),this._transitioning=this._transitionable.untransitioned(),this.properties=new u.ag(d),this.scope=n}get state(){const s=this.properties.get("opacity"),t=this.properties.get("color"),n=this.properties.get("direction"),l=u.al(n[0]),d=-Math.max(u.al(n[1]),.01),p=[Math.cos(l)*Math.cos(d),Math.sin(l)*Math.cos(d),Math.sin(d)],m=this.properties.get("vignette"),g=this.properties.get("vignette-color"),x=new u.C(g.r,g.g,g.b,m);return{density:this.properties.get("density"),intensity:this.properties.get("intensity"),color:new u.C(t.r,t.g,t.b,t.a*s),direction:p,centerThinning:this.properties.get("center-thinning"),flakeSize:this.properties.get("flake-size"),vignetteColor:x}}get(){return this._transitionable.serialize()}set(s,t,n={}){if(this._validate(ld,s,n))return;const l={...s},d=u.m.snow;for(const p of Object.keys(d))l[p]===void 0&&(l[p]=d[p].default);this._options=l,this._transitionable.setTransitionOrValue(this._options,t)}updateConfig(s){this._transitionable.setTransitionOrValue(this._options,s)}updateTransitions(s){this._transitioning=this._transitionable.transitioned(s,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(s){this.properties=this._transitioning.possiblyEvaluate(s)}_validate(s,t,n){return(!n||n.validate!==!1)&&xa(this,s.call(Nr,{value:t,style:{glyphs:!0,sprite:!0},styleSpec:u.m}))}},Iu=class extends u.E{constructor(s,t,n,l){super();const d=vl||(vl=new u.a7({density:new u.a8(u.m.rain.density),intensity:new u.a8(u.m.rain.intensity),color:new u.a8(u.m.rain.color),opacity:new u.a8(u.m.rain.opacity),vignette:new u.a8(u.m.rain.vignette),"vignette-color":new u.a8(u.m.rain["vignette-color"]),"center-thinning":new u.a8(u.m.rain["center-thinning"]),direction:new u.a8(u.m.rain.direction),"droplet-size":new u.a8(u.m.rain["droplet-size"]),"distortion-strength":new u.a8(u.m.rain["distortion-strength"])}));this._transitionable=new u.a6(d,n,l),this.set(s,l),this._transitioning=this._transitionable.untransitioned(),this.properties=new u.ag(d),this.scope=n}get state(){const s=this.properties.get("opacity"),t=this.properties.get("color"),n=this.properties.get("direction"),l=u.al(n[0]),d=-Math.max(u.al(n[1]),.01),p=[Math.cos(l)*Math.cos(d),Math.sin(l)*Math.cos(d),Math.sin(d)],m=this.properties.get("vignette-color"),g=new u.C(m.r,m.g,m.b,this.properties.get("vignette"));return{density:this.properties.get("density"),intensity:this.properties.get("intensity"),color:new u.C(t.r,t.g,t.b,t.a*s),direction:p,centerThinning:this.properties.get("center-thinning"),dropletSize:this.properties.get("droplet-size"),distortionStrength:this.properties.get("distortion-strength"),vignetteColor:g}}get(){return this._transitionable.serialize()}set(s,t,n={}){if(this._validate(Up,s,n))return;const l={...s},d=u.m.rain;for(const p of Object.keys(d))l[p]===void 0&&(l[p]=d[p].default);this._options=l,this._transitionable.setTransitionOrValue(this._options,t)}updateConfig(s){this._transitionable.setTransitionOrValue(this._options,s)}updateTransitions(s){this._transitioning=this._transitionable.transitioned(s,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(s){this.properties=this._transitioning.possiblyEvaluate(s)}_validate(s,t,n){return(!n||n.validate!==!1)&&xa(this,s.call(Nr,{value:t,style:{glyphs:!0,sprite:!0},styleSpec:u.m}))}};const Un={workerUrl:"",workerClass:null,workerParams:void 0};function hd(s){return Un.workerClass!=null?new Un.workerClass:new self.Worker(Un.workerUrl,{name:s,...Un.workerParams})}const Au="mapboxgl_preloaded_worker_pool";class ds{constructor(t){this.active={},this.name=t}acquire(t,n=ds.workerCount){if(!this.workers)for(this.workers=[];this.workers.length<n;){const l=hd(`${this.name||""}WorkerPool: ${t}-${this.workers.length}`);this.workers.push(l)}return this.active[t]=!0,this.workers.slice()}release(t){delete this.active[t],this.workers&&this.numActive()===0&&(this.workers.forEach(n=>{n.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[Au]}numActive(){return Object.keys(this.active).length}}ds.workerCount=2;class wa{constructor(t,n,l="Worker",d=ds.workerCount){this.workerPool=t,this.actors=[],this.currentActor=0,this.id=u.am();const p=this.workerPool.acquire(this.id,d);for(let m=0;m<p.length;m++){const g=new wa.Actor(p[m],n,this.id);g.name=`${l} ${m}`,this.actors.push(g)}this.ready=!1,this.send("checkIfReady",null).then(()=>{this.ready=!0}).catch(()=>{})}send(t,n,l){return Promise.all(this.actors.map(d=>d.send(t,n,l)))}broadcast(t,n){for(const l of this.actors)l.notify(t,n)}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)}}wa.Actor=u.an;class In extends u.E{constructor(t,n,l,d){super(),this.scope=l,this._options=t,this.properties=new u.ag(n),this._transitionable=new u.a6(n,l,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,n){this._options=t,this._transitionable.setTransitionOrValue(t.properties,n)}shadowsEnabled(){return!!this.properties&&this.properties.get("cast-shadows")===!0}}let dd;const fd=()=>dd||(dd=new u.a7({color:new u.a8(u.m.properties_light_ambient.color),"color-use-theme":new u.a8({type:"string",default:"default","property-type":"data-constant"}),intensity:new u.a8(u.m.properties_light_ambient.intensity)}));let Zp;const yt=()=>Zp||(Zp=new u.a7({direction:new u.ao(u.m.properties_light_directional.direction),color:new u.a8(u.m.properties_light_directional.color),"color-use-theme":new u.a8({type:"string",default:"default","property-type":"data-constant"}),intensity:new u.a8(u.m.properties_light_directional.intensity),"cast-shadows":new u.a8(u.m.properties_light_directional["cast-shadows"]),"shadow-quality":new u.a8(u.m.properties_light_directional["shadow-quality"]),"shadow-intensity":new u.a8(u.m.properties_light_directional["shadow-intensity"]),"shadow-draw-before-layer":new u.a8(u.m.properties_light_directional["shadow-draw-before-layer"])})),Wp=(s,t,n,l,d,p,m,g,x,w=[0,0,1])=>({u_matrix:s,u_normal_matrix:t,u_opacity:n,u_faux_facade_ao_intensity:l,u_camera_pos:d,u_tile_to_meter:p,u_facade_emissive_chance:m,u_flood_light_color:g,u_flood_light_intensity:x,u_front_cutoff_params:w}),$t=s=>({u_matrix:s}),Xp=s=>({u_matrix:s}),pd=1029,md=2305;class pt{constructor(t,n,l){this.enable=t,this.mode=n,this.frontFace=l}}pt.disabled=new pt(!1,pd,md),pt.backCCW=new pt(!0,pd,md),pt.backCW=new pt(!0,pd,2304),pt.frontCW=new pt(!0,1028,2304),pt.frontCCW=new pt(!0,1028,md);
8class nt{constructor(t,n,l){this.func=t,this.mask=n,this.range=l}}nt.ReadOnly=!1,nt.ReadWrite=!0,nt.disabled=new nt(519,nt.ReadOnly,[0,1]);class jn{constructor(t=0,n=0,l=0,d=0){if(isNaN(t)||t<0||isNaN(n)||n<0||isNaN(l)||l<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=n,this.left=l,this.right=d}interpolate(t,n,l){return n.top!=null&&t.top!=null&&(this.top=u.ai(t.top,n.top,l)),n.bottom!=null&&t.bottom!=null&&(this.bottom=u.ai(t.bottom,n.bottom,l)),n.left!=null&&t.left!=null&&(this.left=u.ai(t.left,n.left,l)),n.right!=null&&t.right!=null&&(this.right=u.ai(t.right,n.right,l)),this}getCenter(t,n){const l=u.as((this.left+t-this.right)/2,0,t),d=u.as((this.top+n-this.bottom)/2,0,n);return new u.P(l,d)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new jn(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}function Cu(s,t){const n=u.aD(s,3);u.aI(s,t),u.aN(s,3,n)}function js(s,t){const n=u.az([]);return u.aA(n,n,-t),u.aB(n,n,-s),n}function ct(s,t){const n=[s[0],s[1],0],l=[t[0],t[1],0];if(u.ae(n)>=1e-15){const m=u.au([],n);u.av(l,m,u.aw(l,m)),t[0]=l[0],t[1]=l[1]}const d=u.ax([],t,s);if(u.ay(d)<1e-15)return null;const p=Math.atan2(-d[1],d[0]);return js(Math.atan2(Math.sqrt(s[0]*s[0]+s[1]*s[1]),-s[2]),p)}class Jt{constructor(t,n){this.position=t,this.orientation=n}get position(){return this._position}set position(t){if(t){const n=t instanceof u.ac?t:new u.ac(t[0],t[1],t[2]);
8this._renderWorldCopies&&(n.x=u.at(n.x,0,1)),this._position=n}else this._position=null}lookAtPoint(t,n,l){if(this.orientation=null,!this.position)return;const d=this.position,p=l||(this._elevation?this._elevation.getAtPointOrZero(u.ac.fromLngLat(t)):0),m=u.ac.fromLngLat(t,p),g=[m.x-d.x,m.y-d.y,m.z-d.z];n||(n=[0,0,1]),n[2]=Math.abs(n[2]),this.orientation=ct(g,n)}setPitchBearing(t,n){this.orientation=js(u.al(t),u.al(-n))}}class Yt{constructor(t,n){this._transform=u.aC([]),this.orientation=n,this.position=t}get mercatorPosition(){const t=this.position;return new u.ac(t[0],t[1],t[2])}get position(){const t=u.aD(this._transform,3);return[t[0],t[1],t[2]]}set position(t){var n;t&&u.aN(this._transform,3,[(n=t)[0],n[1],n[2],1])}get orientation(){return this._orientation}set orientation(t){this._orientation=t||u.az([]),t&&Cu(this._transform,this._orientation)}getPitchBearing(){const t=this.forward(),n=this.right();return{bearing:Math.atan2(-n[1],n[0]),pitch:Math.atan2(Math.sqrt(t[0]*t[0]+t[1]*t[1]),-t[2])}}setPitchBearing(t,n){this._orientation=js(t,n),Cu(this._transform,this._orientation)}forward(){const t=u.aD(this._transform,2);return[-t[0],-t[1],-t[2]]}up(){const t=u.aD(this._transform,1);return[-t[0],-t[1],-t[2]]}right(){const t=u.aD(this._transform,0);return[t[0],t[1],t[2]]}getCameraToWorld(t,n){const l=new Float64Array(16);return u.aE(l,this.getWorldToCamera(t,n)),l}getCameraToWorldMercator(){return this._transform}getWorldToCameraPosition(t,n,l){const d=this.position;u.av(d,d,-t);const p=new Float64Array(16);return u.aF(p,[l,l,l]),u.aG(p,p,d),p[10]*=n,p}getWorldToCamera(t,n){const l=new Float64Array(16),d=new Float64Array(4),p=this.position;return u.aH(d,this._orientation),u.av(p,p,-t),u.aI(l,d),u.aG(l,l,p),l[1]*=-1,l[5]*=-1,l[9]*=-1,l[13]*=-1,l[8]*=n,l[9]*=n,l[10]*=n,l[11]*=n,l}getCameraToClipPerspective(t,n,l,d){const p=new Float64Array(16);return u.aJ(p,t,n,l,d),p}getCameraToClipOrthographic(t,n,l,d,p,m){const g=new Float64Array(16);return u.aK(g,t,n,l,d,p,m),g}getDistanceToElevation(t,n=!1){const l=t===0?0:u.aL(t,n?u.aM(this.position[1]):this.position[1]),d=this.forward();return(l-this.position[2])/d[2]}clone(){return new Yt([...this.position],[...this.orientation])}}const _n=Math.tan(85*Math.PI/180);function qo(s,t,n,l,d,p,m){const g=u.aS();if(n)if(p.name==="globe"){const x=u.aT(d,t);u.aP(g,g,x)}else{const x=u.aU([],m);g[0]=x[0],g[1]=x[1],g[4]=x[2],g[5]=x[3],l||u.aR(g,g,d.angle)}else u.aP(g,d.labelPlaneMatrix,s);return g}function Qt(s,t,n,l,d,p,m){const g=qo(s,t,n,l,d,p,m);return p.name==="globe"&&n||(g[2]=g[6]=g[10]=g[14]=0),g}function bl(s,t,n,l,d,p,m){if(n){if(p.name==="globe"){const g=qo(s,t,n,l,d,p,m);return u.aE(g,g),u.aP(g,s,g),g}{const g=u.aQ(s),[x,w,E,A]=m,[I,M,D,z,O,k,q,$]=g;return g[0]=x*I+w*O,g[1]=x*M+w*k,g[2]=x*D+w*q,g[3]=x*z+w*$,g[4]=E*I+A*O,g[5]=E*M+A*k,g[6]=E*D+A*q,g[7]=E*z+A*$,l||u.aR(g,g,-d.angle),g}}return d.glCoordMatrix}function gn(s,t,n,l){const d=[s,t,n,1];n?u.aO(d,d,l):Zr(d,d,l);const p=d[3];return d[0]/=p,d[1]/=p,d[2]/=p,d}function wl(s,t){return Math.min(.5+s/t*.5,1.5)}function $r(s,t){const n=s[0]/s[3],l=s[1]/s[3];return n>=-t[0]&&n<=t[0]&&l>=-t[1]&&l<=t[1]}function lr(s,t,n,l,d,p,m,g,x,w,E=1){const A=n.transform,I=l?s.textSizeData:s.iconSizeData,M=u.aZ(I,n.transform.zoom,E),D=A.projection.name==="globe",z=[256/n.width*2+1,256/n.height*2+1],O=l?s.text.dynamicLayoutVertexArray:s.icon.dynamicLayoutVertexArray;O.clear();let k=null;D&&(k=l?s.text.globeExtVertexArray:s.icon.globeExtVertexArray);const q=s.lineVertexArray,$=l?s.text.placedSymbolArray:s.icon.placedSymbolArray,U=n.transform.width/n.transform.height;let Q,Y=!1;for(let ae=0;ae<$.length;ae++){const W=$.get(ae),{numGlyphs:J,writingMode:se}=W;if(se!==u.a_.vertical||Y||Q===u.a_.horizontal||(Y=!0),Q=se,(W.hidden||se===u.a_.vertical)&&!Y){fs(J,O);continue}Y=!1;const ue=new u.P(W.tileAnchorX,W.tileAnchorY),he=s.elevationType==="road",ve=!!A.elevation||he;let{x:xe,y:Le,z:_e}=A.projection.projectTilePoint(ue.x,ue.y,w.canonical),Pe=null;if(ve){const at=he&&s.hdExt?s.hdExt.getElevationFeatureForPlacedSymbol(s,l?s.text:s.icon,ae):null;Pe={getElevation:x,elevation:A.elevation,elevationFeature:at};const[bt,_t,Ct]=x(ue,A.elevation,at);xe+=bt,Le+=_t,_e+=Ct}const me=[xe,Le,_e,1];if(u.aO(me,me,t),!$r(me,z)){fs(J,O);continue}const Re=me[3],Me=wl(n.transform.getCameraToCenterDistance(A.projection),Re),Ae=u.a$(I,M,W),We=m?Ae/Me:Ae*Me,ke=gn(xe,Le,_e,d);if(ke[3]<=0){fs(J,O);continue}let Ue={};const je=u.al(s.layers[0].layout.get("text-max-angle")),et=Math.cos(je),tt=m?null:Pe,it=Mu(W,We,!1,g,t,d,p,s.glyphOffsetArray,q,O,k,ke,ue,Ue,U,tt,A.projection,w,m,et);Y=it.useVertical,tt&&it.needsFlipping&&(Ue={}),(it.notEnoughRoom||Y||it.needsFlipping&&Mu(W,We,!0,g,t,d,p,s.glyphOffsetArray,q,O,k,ke,ue,Ue,U,tt,A.projection,w,m,et).notEnoughRoom)&&fs(J,O)}l?(s.text.dynamicLayoutVertexBuffer.updateData(O),k&&s.text.globeExtVertexBuffer&&s.text.globeExtVertexBuffer.updateData(k)):(s.icon.dynamicLayoutVertexBuffer.updateData(O),k&&s.icon.globeExtVertexBuffer&&s.icon.globeExtVertexBuffer.updateData(k))}function Yp(s,t,n,l,d,p,m,g,x,w,E,A,I,M,D,z,O){const{lineStartIndex:k,glyphStartIndex:q,segment:$}=g,U=q+g.numGlyphs,Q=k+g.lineLength,Y=t.getoffsetX(q),ae=t.getoffsetX(U-1),W=Sl(s*Y,n,l,d,p,m,$,k,Q,x,w,E,A,I,!0,M,D,z,O);if(!W)return null;const J=Sl(s*ae,n,l,d,p,m,$,k,Q,x,w,E,A,I,!0,M,D,z,O);return J?{first:W,last:J}:null}function Tl(s,t,n,l){return s===u.a_.horizontal&&Math.abs(l)>
8Math.abs(n)?{useVertical:!0}:s===u.a_.vertical?l>0?{needsFlipping:!0}:null:t!==0&&(function(d,p){return d===0||Math.abs(p/d)>_n})(n,l)?t===1?{needsFlipping:!0}:null:n<0?{needsFlipping:!0}:null}function Mu(s,t,n,l,d,p,m,g,x,w,E,A,I,M,D,z,O,k,q,$){const U=t/24,Q=s.lineOffsetX*U,Y=s.lineOffsetY*U,{lineStartIndex:ae,glyphStartIndex:W,numGlyphs:J,segment:se,writingMode:ue,flipState:he}=s,ve=ae+s.lineLength,xe=Le=>{if(E){const[Re,Me,Ae]=Le.up,We=w.length;u.b0(E,We+0,Re,Me,Ae),u.b0(E,We+1,Re,Me,Ae),u.b0(E,We+2,Re,Me,Ae),u.b0(E,We+3,Re,Me,Ae)}const[_e,Pe,me]=Le.point;u.b1(w,_e,Pe,me,Le.angle)};if(J>1){const Le=Yp(U,g,Q,Y,n,A,I,s,x,p,M,z,!1,O,k,q,$);if(!Le)return{notEnoughRoom:!0};if(l&&!n){let[_e,Pe,me]=Le.first.point,[Re,Me,Ae]=Le.last.point;[_e,Pe]=gn(_e,Pe,me,m),[Re,Me]=gn(Re,Me,Ae,m);const We=Tl(ue,he,(Re-_e)*D,Me-Pe);if(s.flipState=We&&We.needsFlipping?1:2,We)return We}xe(Le.first);for(let _e=W+1;_e<W+J-1;_e++){const Pe=Sl(U*g.getoffsetX(_e),Q,Y,n,A,I,se,ae,ve,x,p,M,z,!1,!1,O,k,q,$);if(!Pe)return w.length-=4*(_e-W),{notEnoughRoom:!0};xe(Pe)}xe(Le.last)}else{if(l&&!n){const _e=gn(I.x,I.y,0,d),Pe=ae+se+1,me=new u.P(x.getx(Pe),x.gety(Pe)),Re=gn(me.x,me.y,0,d),Me=Re[3]>0?Re:_c(I,me,_e,1,d,void 0,O,k.canonical),Ae=Tl(ue,he,(Me[0]-_e[0])*D,Me[1]-_e[1]);if(s.flipState=Ae&&Ae.needsFlipping?1:2,Ae)return Ae}const Le=Sl(U*g.getoffsetX(W),Q,Y,n,A,I,se,ae,ve,x,p,M,z,!1,!1,O,k,q,$);if(!Le)return{notEnoughRoom:!0};xe(Le)}return{}}function El(s,t,n,l,d){const{x:p,y:m,z:g}=l.projectTilePoint(s.x,s.y,t);if(!d)return gn(p,m,g,n);const[x,w,E]=d.getElevation(s,d.elevation,d.elevationFeature);return gn(p+x,m+w,g+E,n)}function _c(s,t,n,l,d,p,m,g){const x=El(s.sub(t)._unit()._add(s),g,d,m,p);return u.aW(x,n,x),u.au(x,x),u.aY(x,n,x,l)}function Sl(s,t,n,l,d,p,m,g,x,w,E,A,I,M,D,z,O,k,q){const $=l?s-t:s+t;let U=$>0?1:-1,Q=0;l&&(U*=-1,Q=Math.PI),U<0&&(Q+=Math.PI);let Y=g+m+(U>0?0:1)|0,ae=d,W=d,J=0,se=0;const ue=Math.abs($),he=[],ve=[];let xe=p,Le=xe,_e=u.aV([]);const Pe=()=>_c(Le,xe,W,ue-J+1,E,I,z,O.canonical);for(;J+se<=ue;){if(Y+=U,Y<g||Y>=x)return null;if(W=ae,Le=xe,he.push(W),M&&ve.push(Le),xe=new u.P(w.getx(Y),w.gety(Y)),ae=A[Y],!ae){const tt=El(xe,O.canonical,E,z,I);ae=tt[3]>0?A[Y]=tt:Pe()}J+=se;const je=u.aW([],ae,W),et=u.aX(W,ae);if(n&&et>0&&se>0&&u.aw(_e,je)/(se*et)<q)return null;se=et,_e=je}D&&I&&(A[Y]&&(ae=Pe(),se=u.aX(W,ae),_e=u.aW([],ae,W)),A[Y]=ae);const me=(ue-J)/se,Re=xe.sub(Le)._mult(me)._add(Le),Me=u.aY([],W,_e,me);let Ae=[0,0,1],We=_e[0],ke=_e[1];if(k&&(Ae=z.upVector(O.canonical,Re.x,Re.y),Ae[0]!==0||Ae[1]!==0||Ae[2]!==1)){const je=[Ae[2],0,-Ae[0]],et=u.ax([],Ae,je);u.au(je,je),u.au(et,et),We=u.aw(_e,je),ke=u.aw(_e,et)}if(n){const je=u.ax([],Ae,_e);u.au(je,je),u.aY(Me,Me,je,n*U)}const Ue=Q+Math.atan2(ke,We);return he.push(Me),M&&ve.push(Re),{point:Me,angle:Ue,path:he,tilePath:ve,up:Ae}}function fs(s,t){const n=t.length,l=n+4*s;t.resize(l),t.float32.fill(-1/0,4*n,4*l)}function Zr(s,t,n){const l=t[0],d=t[1];return s[0]=n[0]*l+n[4]*d+n[12],s[1]=n[1]*l+n[5]*d+n[13],s[3]=n[3]*l+n[7]*d+n[15],s}const Vr=15;class Wr{constructor(t,n,l,d,p,m,g){this.tileSize=512,this._renderWorldCopies=p===void 0||p,this._minZoom=t||0,this._maxZoom=n||22,this._minPitch=l??0,this._maxPitch=d??60,this.setProjection(m),this.setMaxBounds(g),this.width=0,this.height=0,this._center=new u.b2(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 jn,this._projMatrixCache={},this._alignedProjMatrixCache={},this._fogTileMatrixCache={},this._expandedProjMatrixCache={},this._distanceTileDataCache={},this._camera=new Yt,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: 5,729 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 Wr(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<Vr}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,n=!1){const l=this._elevation&&this._elevation.exaggeration()!==this._centerAltitudeValidForExaggeration;(this._seaLevelZoom==null||l)&&this._updateCameraOnTerrain(),(t||l)&&this._constrainCamera(n),this._calcMatrices()}getProjection(){return u.b3(this.projection,["name","center","parallels"])}setProjection(t){this.projectionOptions=t||{name:"mercator"};const n=this.projection?this.getProjection():void 0;this.projection=u.b4(this.projectionOptions);const l=this.getProjection(),d=!u.b5(n,l);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=u.b4({name:"mercator"});const n=t!==this.projection.name;return n&&this._calcMatrices(),n}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 u.aL(1,this.center.lat)*this.cameraWorldSizeForFog}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new u.P(this.width,this.height)}get bearing(){return u.at(this.rotation,-180,180)}set bearing(t){this.rotation=t}get rotation(){return-this.angle/Math.PI*180}set rotation(t){const n=-t*Math.PI/180;if(this.angle===n)return;this._unmodified=!1,this.angle=n,this._calcMatrices();const l=Math.sin(this.angle),d=Math.cos(this.angle);this.rotationMatrix=[d,l,-l,d]}get pitch(){return this._pitch/Math.PI*180}set pitch(t){const n=u.as(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==n&&(this._unmodified=!1,this._pitch=n,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=u.al(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 n=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==n&&(this._unmodified=!1,this._setZoom(n),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,n=this.elevation&&t===Number.NEGATIVE_INFINITY&&this.elevation.visibleDemTiles.length>0&&this.elevation.exaggeration()>
80&&this._centerAltitudeValidForExaggeration;if(!this._elevation||t===Number.NEGATIVE_INFINITY&&(!n||!this._centerAltitude))return this._centerAltitude=0,this._seaLevelZoom=null,void(this._centerAltitudeValidForExaggeration=void 0);const l=this._elevation;n||this._centerAltitude&&this._centerAltitudeValidForExaggeration&&l.exaggeration()&&this._centerAltitudeValidForExaggeration!==l.exaggeration()?(this._centerAltitude=this._centerAltitude/this._centerAltitudeValidForExaggeration*l.exaggeration(),this._centerAltitudeValidForExaggeration=l.exaggeration()):(this._centerAltitude=t||0,this._centerAltitudeValidForExaggeration=l.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,n=[[.5,.2],[.3,.5],[.5,.5],[.7,.5],[.5,.8]],l=this.horizonLineFromTop();let d=0,p=0;for(let m=0;m<n.length;m++){const g=new u.P(n[m][0]*this.width,l+n[m][1]*(this.height-l)),x=t.pointCoordinate(g);if(!x)continue;const w=1/Math.hypot(x[0]-this._camera.position[0],x[1]-this._camera.position[1]);d+=x[3]*w,p+=w}return p===0?NaN:d/p}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,n=this._elevation.getAtPointOrZero(this.locationCoordinate(this.center)),l=this.pixelsPerMeter/this.worldSize*n,d=this._mercatorZfromZoom(t),p=this._mercatorZfromZoom(this._maxZoom),m=Math.max(d-l,p);this._setZoom(this._zoomFromMercatorZ(m))}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 n=this.elevation,l=t.elevation,d=n!=null!=(l!=null)||n&&l&&n.exaggeration()!==l.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 n=this.rayIntersectionCoordinate(this.pointRayIntersection(this.centerPoint,t.toAltitude()));let l;l=t.z<this._camera.position[2]?[n.x,n.y,n.z]:[t.x,t.y,t.z];const d=u.ae(u.aW([],this._camera.position,l));return u.as(this._zoomFromMercatorZ(d),this._minZoom,this._maxZoom)}setFreeCameraOptions(t){if(!this.height||!t.position&&!t.orientation)return;this._updateCameraState();let n=!1;if(t.orientation&&!u.b6(t.orientation,this._camera.orientation)&&(n=this._setCameraOrientation(t.orientation)),t.position){const l=[t.position.x,t.position.y,t.position.z];u.b7(l,this._camera.position)||(this._setCameraPosition(l),n=!0)}n&&(this._updateStateFromCamera(),this.recenterOnTerrain())}getFreeCameraOptions(){this._updateCameraState();const t=this._camera.position,n=new Jt;return n.position=new u.ac(t[0],t[1],t[2]),n.orientation=this._camera.orientation,n._elevation=this.elevation,n._renderWorldCopies=this.renderWorldCopies,n}_setCameraOrientation(t){if(!u.b8(t))return!1;u.b9(t,t);const n=u.ba([],[0,0,-1],t),l=u.ba([],[0,-1,0],t);if(l[2]<0)return!1;const d=ct(n,l);return!!d&&(this._camera.orientation=d,!0)}_setCameraPosition(t){const n=this.zoomScale(this.minZoom)*this.tileSize,l=this.zoomScale(this.maxZoom)*this.tileSize,d=this.cameraToCenterDistance;t[2]=u.as(t[2],d/l,d/n),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,n,l){this._unmodified=!1,this._edgeInsets.interpolate(t,n,l),this._constrain(),this._calcMatrices()}coveringZoomLevel(t){const n=(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize));return Math.max(0,n)}getVisibleUnwrappedCoordinates(t){const n=[new u.bb(0,t)];if(this.renderWorldCopies){const l=this.pointCoordinate(new u.P(0,0)),d=this.pointCoordinate(new u.P(this.width,0)),p=this.pointCoordinate(new u.P(this.width,this.height)),m=this.pointCoordinate(new u.P(0,this.height)),g=Math.floor(Math.min(l.x,d.x,p.x,m.x)),x=Math.floor(Math.max(l.x,d.x,p.x,m.x)),w=1;for(let E=g-w;E<=x+w;E++)E!==0&&n.push(new u.bb(E,t))}return n}isLODDisabled(t){return(!t||this.pitch<=60)&&this._edgeInsets.top<=this._edgeInsets.bottom&&!this._elevation&&!this.projection.isReprojectedInTileSpace}extendTileCover(t,n,l,d){let p=[];const m=l!=null,g=!m;if(g&&this.zoom<n||m&&l[0]===0&&l[1]===0)return p;const x=new Set,w=(A,I,M,D,z)=>{const O=u.bo(I,A,M,D,z);x.has(O)||(p.push(new u.bp(A,I,M,D,z)),x.add(O))};for(let A=0;A<t.length;A++){const I=t[A];
8if(g&&I.canonical.z!==n||m&&d!==void 0&&d>I.canonical.z)continue;const M=I.canonical,D=I.overscaledZ,z=I.wrap,O=1<<M.z,k=M.x+1<O,q=M.x>0,$=M.y+1<O,U=M.y>0,Q=I.wrap-(q?0:1),Y=I.wrap+(k?0:1),ae=q?M.x-1:O-1,W=k?M.x+1:0;if(m)l[0]<0?(w(D,Y,M.z,W,M.y),l[1]<0&&$&&(w(D,z,M.z,M.x,M.y+1),w(D,Y,M.z,W,M.y+1)),l[1]>0&&U&&(w(D,z,M.z,M.x,M.y-1),w(D,Y,M.z,W,M.y-1))):l[0]>0?(w(D,Q,M.z,ae,M.y),l[1]<0&&$&&(w(D,z,M.z,M.x,M.y+1),w(D,Q,M.z,ae,M.y+1)),l[1]>0&&U&&(w(D,z,M.z,M.x,M.y-1),w(D,Q,M.z,ae,M.y-1))):l[1]<0&&$?w(D,z,M.z,M.x,M.y+1):U&&w(D,z,M.z,M.x,M.y-1);else{const J=I.visibleQuadrants;1&J&&(w(D,Q,M.z,ae,M.y),U&&(w(D,z,M.z,M.x,M.y-1),w(D,Q,M.z,ae,M.y-1))),2&J&&(w(D,Y,M.z,W,M.y),U&&(w(D,z,M.z,M.x,M.y-1),w(D,Y,M.z,W,M.y-1))),4&J&&(w(D,Q,M.z,ae,M.y),$&&(w(D,z,M.z,M.x,M.y+1),w(D,Q,M.z,ae,M.y+1))),8&J&&(w(D,Y,M.z,W,M.y),$&&(w(D,z,M.z,M.x,M.y+1),w(D,Y,M.z,W,M.y+1)))}}const E=[];for(const A of p)p.some(I=>A.isChildOf(I))||E.push(A);if(p=E.filter(A=>!t.some(I=>!!(A.overscaledZ<n&&I.isChildOf(A))||A.equals(I)||A.isChildOf(I))),g){const A=1<<n,I=this.projection.name==="globe"?this._camera.mercatorPosition:this.pointCoordinate(this.getCameraPoint()),M=[A*I.x,A*I.y],D=4,z=D*D;p=p.filter(O=>{const k=O.canonical.x+.5-M[0],q=O.canonical.y+.5-M[1];return k*k+q*q<z})}return p}extendTileCoverToNearPlane(t,n,l){const d=[],p=new Set;for(const q of t)p.add(q.key);const m=(q,$,U,Q,Y)=>{const ae=u.bo($,q,U,Q,Y);p.has(ae)||(d.push(new u.bp(q,$,U,Q,Y)),p.add(ae))},g=t.reduce((q,$)=>Math.max(q,$.overscaledZ),l),x=1<<l,w=[new u.P(0,0),new u.P(u.aj,0),new u.P(u.aj,u.aj),new u.P(0,u.aj)],E=new u.P(0,0),A=new u.P(0,0),I=(q,$)=>{const U=Math.floor(q[0]),Q=Math.floor(q[1]),Y=(q[0]-U)*u.aj,ae=(q[1]-Q)*u.aj,W=Math.floor($[0]),J=Math.floor($[1]),se=($[0]-W)*u.aj,ue=($[1]-J)*u.aj;for(let he=-1;he<=1;he++){const ve=U+he;if(!(ve<0||ve>=x)){E.x=Y-he*u.aj,A.x=se-(ve-W)*u.aj;for(let xe=-1;xe<=1;xe++){const Le=Q+xe;E.y=ae-xe*u.aj,A.y=ue-(Le-J)*u.aj,u.bT(E,A,w)&&m(g,0,l,ve,Le)}}}},M=n.points,D=M[u.bc],z=M[u.bd],O=this._projectToGround(D,M[u.be]),k=this._projectToGround(z,M[u.bf]);return I(D,O),I(z,k),d}_projectToGround(t,n){return u.bg(u.bh(),t,n,t[2]/(t[2]-n[2]))}_projectToZ(t,n,l){const d=t[2]-n[2];return Math.abs(d)<1e-6?u.bi(t):u.bg(u.bh(),t,n,(t[2]-l)/d)}extendTileCoverForTunnels(t,n,l,d){if(l<18)return[];const p=n.points,m=p[u.bj],g=p[u.bk],x=p[u.bl],w=p[u.bm];if(x[2]>=0&&w[2]>=0||m[2]<=0||g[2]<=0)return[];const E=x[2]<0?this._projectToZ(m,x,0):x,A=w[2]<0?this._projectToZ(g,w,0):w,I=-d,M=x[2]<I?this._projectToZ(m,x,I):x,D=w[2]<I?this._projectToZ(g,w,I):w,z=this._findExtensionTilesInQuad(t,l,[D,M,A,E],[.5*(E[0]+A[0]),.5*(E[1]+A[1])]);return z.length>3&&(z.length=3),z}_findExtensionTilesInQuad(t,n,l,d){const p=[],m=new Set;for(const W of t)m.add(W.key);const g=t.reduce((W,J)=>Math.max(W,J.overscaledZ),n),x=1<<n,w=[new u.P(l[0][0],l[0][1]),new u.P(l[1][0],l[1][1]),new u.P(l[3][0],l[3][1]),new u.P(l[2][0],l[2][1]),new u.P(l[0][0],l[0][1])],E=l[0][0],A=l[1][0],I=l[2][0],M=l[3][0],D=l[0][1],z=l[1][1],O=l[2][1],k=l[3][1],q=Math.max(0,Math.floor(Math.min(E,A,I,M))),$=Math.min(x-1,Math.ceil(Math.max(E,A,I,M))-1),U=Math.max(0,Math.floor(Math.min(D,z,O,k))),Q=Math.min(x-1,Math.ceil(Math.max(D,z,O,k))-1);for(let W=U;W<=Q;W++)for(let J=q;J<=$;J++){if(!u.bn(w,J,W,J+1,W+1))continue;const se=u.bo(0,g,n,J,W);m.has(se)||(p.push(new u.bp(g,0,n,J,W)),m.add(se))}const Y=d[0],ae=d[1];return p.sort((W,J)=>{const se=W.canonical.x+.5-Y,ue=W.canonical.y+.5-ae,he=J.canonical.x+.5-Y,ve=J.canonical.y+.5-ae;return se*se+ue*ue-(he*he+ve*ve)||W.canonical.x-J.canonical.x||W.canonical.y-J.canonical.y}),p}coveringTiles(t){let n=this.coveringZoomLevel(t);const l=n,d=this.elevation&&this.elevation.exaggeration(),p=d&&!t.isTerrainDEM,m=this.projection.name==="mercator";if(t.minzoom!==void 0&&n<t.minzoom)return[];t.maxzoom!==void 0&&n>t.maxzoom&&(n=t.maxzoom);const g=this.locationCoordinate(this.center),x=this.center.lat,w=1<<n,E=[w*g.x,w*g.y,0],A=this.projection.name==="globe",I=!A,M=u.bq.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,n,I),D=A?this._camera.mercatorPosition:this.pointCoordinate(this.getCameraPoint()),z=w*u.aL(1,this.center.lat),O=this._camera.position[2]/u.aL(1,this.center.lat),k=[w*D.x,w*D.y,O*(I?1:z)],q=A||d,$=this.cameraToCenterDistance/t.tileSize*(t.roundZoom?1:.502),U=this.isLODDisabled(!0)?n:0;let Q;if(this._elevation&&t.isTerrainDEM)Q=1e4*this._elevation.exaggeration();else if(this._elevation){const me=this._elevation.getMinMaxForVisibleTiles();Q=me?me.max:this._centerAltitude}else Q=this._centerAltitude;const Y=t.isTerrainDEM?-Q:this._elevation?this._elevation.getMinElevationBelowMSL():0,ae=this.projection.isReprojectedInTileSpace?u.br(this):1,W=me=>{const Me=new u.ac(me.x+25e-6,me.y,me.z),Ae=new u.ac(me.x,me.y+25e-6,me.z),We=me.toLngLat(),ke=Me.toLngLat(),Ue=Ae.toLngLat(),je=this.locationCoordinate(We),et=this.locationCoordinate(ke),tt=this.locationCoordinate(Ue),it=Math.hypot(et.x-je.x,et.y-je.y),at=Math.hypot(tt.x-je.x,tt.y-je.y);return Math.sqrt(it*at)*ae/25e-6},J=me=>{const Re=Q,Me=Y;return{aabb:u.bu(this,w,0,0,0,me,Me,Re,this.projection),zoom:0,x:0,y:0,minZ:Me,maxZ:Re,wrap:me,fullyVisible:!1}},se=[];let ue=[];const he=n,ve=t.reparseOverscaled?l:n,xe=(O-this._centerAltitude)*z,Le=me=>
8{if(!this._elevation||!me.tileID||!m)return;const Re=this._elevation.getMinMaxForTile(me.tileID),Me=me.aabb;Re?(Me.min[2]=Re.min,Me.max[2]=Re.max,Me.center[2]=(Me.min[2]+Me.max[2])/2):(me.shouldSplit=Pe(me),me.shouldSplit||(Me.min[2]=Me.max[2]=Me.center[2]=this._centerAltitude))},_e=(me,Re)=>{if(.707*Re<me)return 1;const Me=Re/me;return Me/(1.4144271570014144+(Math.pow(1.1,Me-1.4144271570014144+1)-1)/(1.1-1)-1)},Pe=me=>{if(me.zoom<U)return!0;if(me.zoom===he)return!1;if(me.shouldSplit!=null)return me.shouldSplit;const Re=me.aabb.distanceX(k),Me=me.aabb.distanceY(k);let Ae=xe,We=1;if(A){Ae=me.aabb.distanceZ(k);const at=Math.pow(2,me.zoom),bt=u.aM((me.y+1)/at),_t=u.aM(me.y/at),Ct=Math.min(Math.max(x,bt),_t),At=u.bX(Ct)/u.bX(x);if(We=Ct===x?1/Math.max(1,this._mercatorScaleRatio-.3):Math.min(1,At/this._mercatorScaleRatio),this.zoom<=u.bU&&me.zoom===he-1&&At>=.9)return!0}else if(p&&(Ae=me.aabb.distanceZ(k)*z),this.projection.isReprojectedInTileSpace&&l<=5){const at=Math.pow(2,me.zoom),bt=W(new u.ac((me.x+.5)/at,(me.y+.5)/at));We=bt>.85?1:bt}if(!m&&!A){const at=Math.sqrt(Re*Re+Me*Me+Ae*Ae);let bt=(1<<he-me.zoom)*$*We;return bt*=_e(Math.max(Ae,xe),at),at<bt}let ke=Number.MAX_VALUE,Ue=0;const je=me.aabb.getCorners(),et=[0,0,0];for(const at of je){u.aW(et,at,k),A||(p?et[2]*=z:et[2]=xe);const bt=u.aw(et,this._camera.forward());bt<ke&&(ke=bt,Ue=Math.abs(et[2]))}let tt=(1<<he-me.zoom)*$*We;if(tt*=_e(Math.max(Ue,xe),ke),ke<tt)return!0;const it=me.aabb.closestPoint(E);return it[0]===E[0]&&it[1]===E[1]};if(this.renderWorldCopies)for(let me=1;me<=3;me++)se.push(J(-me)),se.push(J(me));for(se.push(J(0));se.length>0;){const me=se.pop(),Re=me.x,Me=me.y;let Ae=me.fullyVisible;const We=()=>this.projection.name==="globe"&&(me.y===0||me.y===(1<<me.zoom)-1);if(!Ae){let ke=q?me.aabb.intersects(M):me.aabb.intersectsFlat(M);if(ke===0&&We()){const Ue=new u.bs(me.zoom,Re,Me);ke=u.bt(this,w,Ue,!0).intersects(M)}if(ke===0)continue;Ae=ke===2}if(me.zoom===he||!Pe(me)){const ke=me.zoom===he?ve:me.zoom;if(t.minzoom&&t.minzoom>ke)continue;let Ue=0;if(!Ae){let it=q?me.aabb.intersectsPrecise(M):me.aabb.intersectsPreciseFlat(M);if(it===0&&We()){const at=new u.bs(me.zoom,Re,Me);it=u.bt(this,w,at,!0).intersectsPrecise(M)}if(it===0)continue;if(t.calculateQuadrantVisibility)if(M.containsPoint(me.aabb.center))Ue=15;else for(let at=0;at<4;at++)me.aabb.quadrant(at).intersects(M)!==0&&(Ue|=1<<at)}const je=E[0]-(.5+Re+(me.wrap<<me.zoom))*(1<<n-me.zoom),et=E[1]-.5-Me,tt=me.tileID?me.tileID:new u.bp(ke,me.wrap,me.zoom,Re,Me);t.calculateQuadrantVisibility&&(tt.visibleQuadrants=Ue),ue.push({tileID:tt,distanceSq:je*je+et*et});continue}for(let ke=0;ke<4;ke++){const Ue=(Re<<1)+ke%2,je=(Me<<1)+(ke>>1),et={aabb:m?me.aabb.quadrant(ke):u.bu(this,w,me.zoom+1,Ue,je,me.wrap,me.minZ,me.maxZ,this.projection),zoom:me.zoom+1,x:Ue,y:je,wrap:me.wrap,fullyVisible:Ae,tileID:void 0,shouldSplit:void 0,minZ:me.minZ,maxZ:me.maxZ};p&&!A&&(et.tileID=new u.bp(me.zoom+1===he?ve:me.zoom+1,me.wrap,me.zoom+1,Ue,je),Le(et)),se.push(et)}}if(this.fogCullDistSq){const me=this.fogCullDistSq,Re=this.horizonLineFromTop();ue=ue.filter(Me=>{const Ae=[0,0,0,1],We=[u.aj,u.aj,0,1],ke=this.calculateFogTileMatrix(Me.tileID.toUnwrapped());u.aO(Ae,Ae,ke),u.aO(We,We,ke);const Ue=u.bv([],Ae,We),je=u.bw([],Ae,We),et=u.bV(Ue,je);if(et===0)return!0;let tt=!1;const it=this._elevation;if(it&&et>me&&Re!==0){const at=this.calculateProjMatrix(Me.tileID.toUnwrapped());let bt;t.isTerrainDEM||(bt=it.getMinMaxForTile(Me.tileID)),bt||(bt={min:Y,max:Q});const _t=u.bx(this.rotation),Ct=[_t[0]*u.aj,_t[1]*u.aj,bt.max];u.ad(Ct,Ct,at),tt=(1-Ct[1])*this.height*.5<Re}return et<me||tt})}return ue.sort((me,Re)=>me.distanceSq-Re.distanceSq).map(me=>me.tileID)}resize(t,n){this.width=t,this.height=n,this.pixelsToGLUnits=[2/t,-2/n],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 n=u.as(t.lat,-u.by,u.by),l=this.projection.project(t.lng,n);return new u.P(l.x*this.worldSize,l.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/u.aL(1,this.center.lat)/this.worldSize}setLocationAtPoint(t,n){let l,d;const p=this.centerPoint;if(this.projection.name==="globe"){const g=this.worldSize;l=(n.x-p.x)/g,d=(n.y-p.y)/g}else{const g=this.pointCoordinate(n),x=this.pointCoordinate(p);l=g.x-x.x,d=g.y-x.y}const m=this.locationCoordinate(t);this.setLocation(new u.ac(m.x-l,m.y-d))}setLocation(t){this.center=this.coordinateLocation(t),this.projection.wrap&&(this.center=this.center.wrap())}locationPoint(t,n){return this.projection.locationPoint(this,t,n)}locationPoint3D(t,n){return this.projection.locationPoint(this,t,n,!0)}pointLocation(t){return this.coordinateLocation(this.pointCoordinate(t))}pointLocation3D(t,n){return this.coordinateLocation(this.pointCoordinate3D(t,n))}locationCoordinate(t,n){const l=n?u.aL(n,t.lat):void 0,d=this.projection.project(t.lng,t.lat);return new u.ac(d.x,d.y,l)}coordinateLocation(t){return this.projection.unproject(t.x,t.y)}pointRayIntersection(t,n){const l=n??this._centerAltitude,d=[t.x,t.y,0,1],p=[t.x,t.y,1,1];u.aO(d,d,this.pixelMatrixInverse),u.aO(p,p,this.pixelMatrixInverse);const m=p[3];u.bz(d,d,1/d[3]),u.bz(p,p,1/m);const g=d[2],x=p[2];return{p0:d,p1:p,t:g===x?0:(l-g)/(x-g)}}screenPointToMercatorRay(t){const n=[t.x,t.y,0,1],l=[t.x,t.y,1,1];return u.aO(n,n,this.pixelMatrixInverse),u.aO(l,l,this.pixelMatrixInverse),u.bz(n,n,1/n[3]),u.bz(l,l,1/l[3]),n[2]=u.aL(n[2],this._center.lat)*this.worldSize,l[2]=u.aL(l[2],this._center.lat)*this.worldSize,u.bz(n,n,1/this.worldSize),u.bz(l,l,1/this.worldSize),new u.bA([n[0],n[1],n[2]],u.au([],u.aW([],l,n)))}rayIntersectionCoordinate(t){const{p0:n,p1:l,t:d}=t,p=u.aL(n[2],this._center.lat),m=u.aL(l[2],this._center.lat);return new u.ac(u.ai(n[0],l[0],d)/this.worldSize,u.ai(n[1],l[1],d)/this.worldSize,u.ai(p,m,d))}pointCoordinate(t,n=this._centerAltitude){return this.projection.pointCoordinate(this,t.x,t.y,n)}pointCoordinate3D(t,n){if(!this.elevation)return this.pointCoordinate(t,n);let l=this.projection.pointCoordinate3D(this,t.x,t.y);if(l)return new u.ac(l[0],l[1],l[2]);let d=0,p=this.horizonLineFromTop();if(t.y>p)return this.pointCoordinate(t,n);const m=.02*p,g=t.clone();for(let x=0;x<10&&p-d>m;x++){g.y=u.ai(d,p,.66);const w=this.projection.pointCoordinate3D(this,g.x,g.y);w?(p=g.y,l=w):d=g.y}return l?new u.ac(l[0],l[1],l[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>=u.bB)return!this.isPointAboveHorizon(t);const n=this.pointCoordinate(t);return n.y>=0&&n.y<=1}_coordinatePoint(t,n){const l=n&&this.elevation?this.elevation.getAtPointOrZero(t,this._centerAltitude):this._centerAltitude,d=[t.x*this.worldSize,t.y*this.worldSize,l+t.toAltitude(),1];return u.aO(d,d,this.pixelMatrix),d[3]>0?new u.P(d[0]/d[3],d[1]/d[3]):new u.P(Number.MAX_VALUE,Number.MAX_VALUE)}_getBoundsNonRectangular(){const{top:t,left:n}=this._edgeInsets,l=this.height-this._edgeInsets.bottom,d=this.width-this._edgeInsets.right,p=this.pointLocation3D(new u.P(n,t)),m=this.pointLocation3D(new u.P(d,t)),g=this.pointLocation3D(new u.P(d,l)),x=this.pointLocation3D(new u.P(n,l));let w=Math.min(p.lng,m.lng,g.lng,x.lng),E=Math.max(p.lng,m.lng,g.lng,x.lng),A=Math.min(p.lat,m.lat,g.lat,x.lat),I=Math.max(p.lat,m.lat,g.lat,x.lat);const M=Math.pow(2,-this.zoom)/16*270,D=this.projection.name==="globe"?1:4,z=(O,k,q,$,U)=>{const Q=(O+q)/2,Y=(k+$)/2,ae=new u.P(Q,Y),{lng:W,lat:J}=this.pointLocation3D(ae),se=Math.max(0,w-W,A-J,W-E,J-I);w=Math.min(w,W),E=Math.max(E,W),A=Math.min(A,J),I=Math.max(I,J),(U<D||se>M)&&(z(O,k,Q,Y,U+1),z(Q,Y,q,$,U+1))};
8if(z(n,t,d,t,1),z(d,t,d,l,1),z(d,l,n,l,1),z(n,l,n,t,1),this.projection.name==="globe"){const[O,k]=u.bC(this);O?(I=90,E=180,w=-180):k&&(A=-90,E=180,w=-180)}return new u.bD(new u.b2(w,A),new u.b2(E,I))}_getBoundsRectangular(t,n){const{top:l,left:d}=this._edgeInsets,p=this.height-this._edgeInsets.bottom,m=this.width-this._edgeInsets.right,g=new u.P(d,l),x=new u.P(m,l),w=new u.P(m,p),E=new u.P(d,p);let A=this.pointCoordinate(g,t),I=this.pointCoordinate(x,t);const M=this.pointCoordinate(w,n),D=this.pointCoordinate(E,n),z=(O,k)=>(k.y-O.y)/(k.x-O.x);return A.y>1&&I.y>=0?A=new u.ac((1-D.y)/z(D,A)+D.x,1):A.y<0&&I.y<=1&&(A=new u.ac(-D.y/z(D,A)+D.x,0)),I.y>1&&A.y>=0?I=new u.ac((1-M.y)/z(M,I)+M.x,1):I.y<0&&A.y<=1&&(I=new u.ac(-M.y/z(M,I)+M.x,0)),new u.bD().extend(this.coordinateLocation(A)).extend(this.coordinateLocation(I)).extend(this.coordinateLocation(D)).extend(this.coordinateLocation(M))}_getBoundsRectangularTerrain(){const t=this.elevation;if(!t.visibleDemTiles.length||t.isUsingMockSource())return this._getBoundsRectangular(0,0);const n=t.visibleDemTiles.reduce((l,d)=>{if(d.dem){const p=d.dem.tree;l.min=Math.min(l.min,p.minimums[0]),l.max=Math.max(l.max,p.maximums[0])}return l},{min:Number.MAX_VALUE,max:0});return this._getBoundsRectangular(n.min*t.exaggeration(),n.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 n=this.height/2/Math.tan(this._fov/2)/Math.tan(Math.max(this._pitch,.1))-this.centerOffset.y,l=this.height/2-n*(1-this._horizonShift);return t?Math.max(0,l):l}getMaxBounds(){return this.maxBounds}setMaxBounds(t){this.maxBounds=t,this.minLat=-u.by,this.maxLat=u.by,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=u.bE(this.minLng)*this.tileSize,this.worldMaxX=u.bE(this.maxLng)*this.tileSize,this.worldMinY=u.bF(this.maxLat)*this.tileSize,this.worldMaxY=u.bF(this.minLat)*this.tileSize,this._constrain()}calculatePosMatrix(t,n){return this.projection.createTileMatrix(this,n,t)}calculateDistanceTileData(t){const n=t.key,l=this._distanceTileDataCache;if(l[n])return l[n];const d=t.canonical,p=1/this.height,m=this.cameraWorldSize,g=m/this.zoomScale(d.z),x=(d.x+Math.pow(2,d.z)*t.wrap)*g,w=d.y*g,E=this.point;E.x*=m/this.worldSize,E.y*=m/this.worldSize;const A=this.angle,I=Math.sin(-A),M=-Math.cos(-A);return l[n]={bearing:[I,M],center:[(E.x-x)*p,(E.y-w)*p],scale:g/u.aj*p},l[n]}calculateFogTileMatrix(t){const n=t.key,l=this._fogTileMatrixCache;if(l[n])return l[n];const d=this.projection.createTileMatrix(this,this.cameraWorldSizeForFog,t);return u.aP(d,this.worldToFogMatrix,d),l[n]=new Float32Array(d),l[n]}calculateProjMatrix(t,n=!1,l=!1){const d=t.key;let p;if(p=l?this._expandedProjMatrixCache:n?this._alignedProjMatrixCache:this._projMatrixCache,p[d])return p[d];const m=this.calculatePosMatrix(t,this.worldSize);let g;return g=this.projection.isReprojectedInTileSpace?this.mercatorMatrix:l?this.expandedFarZProjMatrix:n?this.alignedProjMatrix:this.projMatrix,u.aP(m,g,m),p[d]=new Float32Array(m),p[d]}calculatePixelsToTileUnitsMatrix(t){const n=t.tileID.key,l=this._pixelsToTileUnitsCache;if(l[n])return l[n];const d=u.bG(t,this);return l[n]=d,l[n]}customLayerMatrix(){return this.mercatorMatrix.slice()}globeToMercatorMatrix(){if(this.projection.name==="globe"){const t=1/this.worldSize,n=u.aF([],[t,t,t]);return u.aP(n,n,this.globeMatrix),n}}recenterOnTerrain(){if(!this._elevation||this.projection.name==="globe")return;const t=this._elevation;this._updateCameraState();const n=u.aL(1,this._center.lat)*this.worldSize,l=this._computeCameraPosition(n),d=this._camera.forward(),p=u.aL(1,this._center.lat);l[2]/=p,d[2]/=p,u.au(d,d);const m=t.raycast(l,d,t.exaggeration());if(m){const g=u.aY([],l,d,m),x=new u.ac(g[0],g[1],u.aL(g[2],u.aM(g[1]))),w=(x.z+u.ae([x.x-l[0],x.y-l[1],x.z-l[2]*p]))*this._pixelsPerMercatorPixel;this._seaLevelZoom=this._zoomFromMercatorZ(w),this._centerAltitude=x.toAltitude(),this._center=this.coordinateLocation(x),this._updateZoomFromElevation(),this._constrain(),this._calcMatrices()}}_constrainCamera(t=!1){if(!this._elevation)return;const n=this._elevation,l=u.aL(1,this._center.lat)*this.worldSize,d=this._computeCameraPosition(l),p=n.getAtPointOrZero(new u.ac(...d)),m=this.pixelsPerMeter/this.worldSize*p,g=this._minimumHeightOverTerrain(),x=d[2]-m;if(x<=g)if(x<0||t){const w=this.locationCoordinate(this._center,this._centerAltitude),E=[d[0],d[1],w.z-d[2]],A=u.ae(E);E[2]-=(g-x)/this._pixelsPerMercatorPixel;const I=u.ae(E);if(I===0)return;u.av(E,E,A/I*this._pixelsPerMercatorPixel),this._camera.position=[d[0],d[1],w.z*this._pixelsPerMercatorPixel-E[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 I=this.center;return I.lat=u.as(I.lat,this.minLat,this.maxLat),(this.maxBounds||!this.renderWorldCopies&&!t)&&(I.lng=u.as(I.lng,this.minLng,this.maxLng)),this.center=I,void(this._constraining=!1)}const n=this._unmodified,{x:l,y:d}=this.point;let p=0,m=l,g=d;const x=this.width/2,w=this.height/2,E=this.worldMinY*this.scale,A=this.worldMaxY*this.scale;if(d-w<E&&(g=E+w),d+w>A&&(g=A-w),A-E<this.height&&(p=Math.max(p,this.height/(A-E)),g=(A+E)/2),this.maxBounds||!this._renderWorldCopies||!this.projection.wrap){const I=this.worldMinX*this.scale,M=this.worldMaxX*this.scale,D=this.worldSize/2-(I+M)/2;
8m=(l+D+this.worldSize)%this.worldSize-D,m-x<I&&(m=I+x),m+x>M&&(m=M-x),M-I<this.width&&(p=Math.max(p,this.width/(M-I)),m=(M+I)/2)}m===l&&g===d||this._allowWorldUnderZoom||(this.center=this.unproject(new u.P(m,g))),p&&!this._allowWorldUnderZoom&&(this.zoom+=this.scaleZoom(p)),this._constrainCamera(),this._unmodified=n,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,n=this.projection.name==="globe",l=this.pixelsPerMeter;this.projection.name==="globe"&&(this._mercatorScaleRatio=u.aL(1,this.center.lat)/u.aL(1,u.bY));const d=u.bH(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 p=this.projection.zAxisUnit==="meters"?l:1,m=this._camera.getWorldToCamera(this.worldSize,p);let g;const x=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,this._farZ);if(x[8]=2*-t.x/this.width,x[9]=2*t.y/this.height,this.isOrthographic){let Q=.5*this.height/Math.tan(this._fov/2)*1*Math.tan(.5*this._fov),Y=Q*this.aspect,ae=-Y,W=-Q;Y-=t.x,ae-=t.x,Q+=t.y,W+=t.y,g=this._camera.getCameraToClipOrthographic(ae,Y,W,Q,this._nearZ+this._nearClipOffset,this._farZ),((J,se,ue,he)=>{for(let ve=0;ve<16;ve++)J[ve]=u.ai(se[ve],ue[ve],he)})(g,g,x,u.bW(this.pitch>=Vr?1:this.pitch/Vr))}else g=x;const w=u.bI([],x,m),E=u.bI([],g,m);if(this.projection.isReprojectedInTileSpace){const Q=this.locationCoordinate(this.center);u.aC(this._mat4Scratch);const Y=this._mat4Scratch;u.aG(Y,Y,[Q.x*this.worldSize,Q.y*this.worldSize,0]),u.aP(Y,Y,u.bJ(this)),u.aG(Y,Y,[-Q.x*this.worldSize,-Q.y*this.worldSize,0]),u.aP(E,E,Y),u.aP(w,w,Y),this.inverseAdjustmentMatrix=u.bK(this)}else this.inverseAdjustmentMatrix=[1,0,0,1];if(u.bL(this.mercatorMatrix,E,[this.worldSize,this.worldSize,this.worldSize/p,1]),this.projMatrix=E,u.aE(this.invProjMatrix,this.projMatrix),n){const Q=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,1/0);Q[8]=2*-t.x/this.width,Q[9]=2*t.y/this.height,u.bI(this._expandedFarZProjMatrixBuf,Q,m),this.expandedFarZProjMatrix=this._expandedFarZProjMatrixBuf}else this.expandedFarZProjMatrix=this.projMatrix;u.aE(this._mat4Scratch,g),this.frustumCorners=u.bM.fromInvProjectionMatrix(this._mat4Scratch,this.horizonLineFromTop(),this.height),this.cameraFrustum=u.bq.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,0,!n),u.aF(this.skyboxMatrix,[1,-1,1]),u.bN(this.skyboxMatrix,this.skyboxMatrix,this._pitch),u.aR(this.skyboxMatrix,this.skyboxMatrix,this.angle),u.aJ(this.starsProjMatrix,this._fov,this.width/this.height,this._nearZ,this._farZ);const A=(Math.PI/2-this._pitch)*(this.height/this._fov)*this._horizonShift;u.bO(this._mat4Scratch,this.starsProjMatrix),this._mat4Scratch[8]=2*-t.x/this.width,this._mat4Scratch[9]=2*(t.y+A)/this.height,u.aP(this.skyboxMatrix,this._mat4Scratch,this.skyboxMatrix);const I=this.point,M=I.x,D=I.y,z=this.width%2/2,O=this.height%2/2,k=Math.cos(this.angle),q=Math.sin(this.angle),$=M-Math.round(M)+k*z+q*O,U=D-Math.round(D)+k*O+q*z;if(u.bO(this.alignedProjMatrix,E),u.aG(this.alignedProjMatrix,this.alignedProjMatrix,[$>.5?$-1:$,U>.5?U-1:U,0]),u.aF(this.labelPlaneMatrix,[this.width/2,-this.height/2,1]),u.aG(this.labelPlaneMatrix,this.labelPlaneMatrix,[1,-1,0]),u.aF(this.glCoordMatrix,[1,-1,1]),u.aG(this.glCoordMatrix,this.glCoordMatrix,[-1,-1,0]),u.bL(this.glCoordMatrix,this.glCoordMatrix,[2/this.width,2/this.height,1]),u.aP(this.pixelMatrix,this.labelPlaneMatrix,w),this._calcFogMatrices(),this._distanceTileDataCache={},!u.aE(this.pixelMatrixInverse,this.pixelMatrix))throw new Error("failed to invert matrix");if(this.projection.name==="globe"||this.mercatorFromTransition){this.globeMatrix=u.bP(this);const Q=[this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]];this.globeCenterInViewSpace=u.ad(Q,Q,m),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,n=this.cameraPixelsPerMeter,l=this._camera.position,d=1/this.height/this._pixelsPerMercatorPixel,p=[t,t,n];u.av(p,p,d),u.av(l,l,-1),u.bQ(l,l,p),u.bR(this.mercatorFogMatrix,l),u.bL(this.mercatorFogMatrix,this.mercatorFogMatrix,p),this.worldToFogMatrix=this._camera.getWorldToCameraPosition(t,n,d)}_computeCameraPosition(t){const n=(t=t||this.pixelsPerMeter)/this.pixelsPerMeter,l=this._camera.forward(),d=this.point,p=this._mercatorZfromZoom(this._seaLevelZoom?this._seaLevelZoom:this._zoom)*n-t/this.worldSize*this._centerAltitude;return[d.x/this.worldSize-l[0]*p,d.y/this.worldSize-l[1]*p,t/this.worldSize*this._centerAltitude-l[2]*p]}_updateCameraState(){this.height&&(this._camera.setPitchBearing(this._pitch,this.angle),this._camera.position=this._computeCameraPosition())}_translateCameraConstrained(t){const n=this._maxCameraBoundsDistance()*Math.cos(this._pitch),l=this._camera.position[2],d=t[2];let p=1;this.projection.wrap&&(this.center=this.center.wrap()),d>0&&(p=Math.min((n-l)/d,1)),this._camera.position=u.aY([],this._camera.position,t,p),this._updateStateFromCamera()}_updateStateFromCamera(){const t=this._camera.position,n=this._camera.forward(),{pitch:l,bearing:d}=this._camera.getPitchBearing(),p=u.aL(this._centerAltitude,this.center.lat)*this._pixelsPerMercatorPixel,m=this._mercatorZfromZoom(this._maxZoom)*Math.cos(u.al(this._maxPitch)),g=Math.max((t[2]-p)/Math.cos(l),m),x=this._zoomFromMercatorZ(g);u.aY(t,t,n,g),this._pitch=u.as(l,u.al(this.minPitch),u.al(this.maxPitch)),this.angle=u.at(d,-Math.PI,Math.PI),this._setZoom(u.as(x,this._minZoom,this._maxZoom)),this._updateSeaLevelZoom(),this._center=this.coordinateLocation(new u.ac(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 n=0,l=u.bB,d=0,p=1/0;for(;l-n>1e-6&&l>n;){const m=n+.5*(l-n),g=this.tileSize*Math.pow(2,m),x=this.getCameraToCenterDistance(this.projection,m,g),w=this.scaleZoom(x/(Math.max(0,t)*this.tileSize)),E=Math.abs(m-w);E<p&&(p=E,d=m),m<w?n=m:l=m}return d}_terrainEnabled(){return!(!this._elevation||!this.projection.supportsTerrain&&(u.w("Terrain is not yet supported with alternate projections. Use mercator or globe to enable terrain."),1))}anyCornerOffEdge(t,n){const l=Math.min(t.x,n.x),d=Math.max(t.x,n.x),p=Math.min(t.y,n.y),m=Math.max(t.y,n.y);if(p<this.horizonLineFromTop(!1))return!0;
8if(this.projection.name!=="mercator")return!1;const g=[new u.P(l,p),new u.P(d,m),new u.P(l,m),new u.P(d,p)],x=this.renderWorldCopies?-3:0,w=this.renderWorldCopies?4:1;for(const E of g){const A=this.pointRayIntersection(E);if(A.t<0)return!0;const I=this.rayIntersectionCoordinate(A);if(I.x<x||I.y<0||I.x>w||I.y>1)return!0}return!1}isHorizonVisible(){return this.pitch+u.bS(this.fovAboveCenter)>88||this.anyCornerOffEdge(new u.P(0,0),new u.P(this.width,this.height))}zoomDeltaToMovement(t,n){const l=u.ae(u.aW([],this._camera.position,t)),d=this._zoomFromMercatorZ(l)+n;return l-this._mercatorZfromZoom(d)}getCameraPoint(){if(this.projection.name==="globe"){const t=(function([n,l,d],p){const m=[n,l,d,1];u.aO(m,m,p);const g=m[3]=Math.max(m[3],1e-6);return m[0]/=g,m[1]/=g,m[2]/=g,m})([this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]],this.pixelMatrix);return new u.P(t[0],t[1])}{const t=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new u.P(0,t))}}getCameraToCenterDistance(t,n=this.zoom,l=this.worldSize){const d=u.bH(t,n,this.width,this.height,1024),p=t.pixelSpaceConversion(this.center.lat,l,d);let m=.5/Math.tan(.5*this._fov)*this.height*p;return this.isOrthographic&&(m=u.ai(1,m,u.bW(this.pitch>=Vr?1:this.pitch/Vr))),m}getWorldToCameraMatrix(){const t=this._camera.getWorldToCamera(this.worldSize,this.projection.zAxisUnit==="meters"?this.pixelsPerMeter:1);return this.projection.name==="globe"&&u.aP(t,t,this.globeMatrix),t}getFrustum(t){return u.bq.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,t,this.projection.zAxisUnit==="meters")}}const ps=(s,t)=>{if(t<=0||s.terrain)return{shouldRenderCutoff:!1,uniformValues:{u_cutoff_params:[0,0,0,1]}};const n=s.transform,l=n.pitch,d=n.isLODDisabled(!1)?60:30;if(l<d-15)return{shouldRenderCutoff:!1,uniformValues:{u_cutoff_params:[0,0,0,1]}};const p=n._farZ-n._nearZ,m=t*n.height*1.3,g=Math.pow(2,.85*Math.max(n._zoom-s.minCutoffZoom,0)),x=1.4*n.cameraToCenterDistance*g,w=u.af(d-15,d,l),E=u.ai(n._farZ+m,x,w),A=Math.min(m,E-n._nearZ);return{shouldRenderCutoff:w>0,uniformValues:{u_cutoff_params:[n._nearZ,n._farZ,(E-n._nearZ)/p,(E-A-n._nearZ)/p]}}},Gs=7680;class lt{constructor(t,n,l,d,p,m){this.test=t,this.ref=n,this.mask=l,this.fail=d,this.depthFail=p,this.pass=m}}lt.disabled=new lt({func:519,mask:0},0,0,Gs,Gs,Gs);const Io=new Float32Array(16);function Ao(s,t,n,l,d,p,m,g,x,w,E,A,I,M,D,z,O,k,q,$,U){const Q=t.context,Y=Q.gl,ae=t.transform,W=t.transform.zoom,J=[],se=s.translate,ue=s.translateAnchor,he=s.edgeRadius,ve=ps(t,s.cutoffFadeRange);E==="clear"?(J.push("CLEAR_SUBPASS"),$&&(J.push("CLEAR_FROM_TEXTURE"),Q.activeTexture.set(Y.TEXTURE0),$.bind(Y.LINEAR,Y.CLAMP_TO_EDGE))):E==="sdf"?J.push("SDF_SUBPASS"):E==="emissive"&&(J.push("USE_MRT1"),Q.activeTexture.set(Y.TEXTURE0),$.bind(Y.LINEAR,Y.CLAMP_TO_EDGE)),k&&J.push("HAS_CENTROID"),ve.shouldRenderCutoff&&J.push("RENDER_CUTOFF");const xe=(Le,_e,Pe,me,Re)=>{let Me=J;_e.groundRadiusBuffer!=null&&(Me=J.concat("HAS_ATTRIBUTE_a_flood_light_ground_radius"));const Ae=_e.programConfigurations.get(l.id),We=t.isTileAffectedByFog(Le),ke=t.getOrCreateProgram("fillExtrusionGroundEffect",{config:Ae,defines:Me,overrideFog:We}),Ue=((et,tt,it,at,bt,_t,Ct,At,gt,Et)=>({u_matrix:et,u_opacity:tt,u_ao_pass:it?1:0,u_meter_to_tile:at,u_ao:bt,u_flood_light_intensity:_t,u_flood_light_color:Ct,u_attenuation:At,u_edge_radius:gt,u_fb:0,u_fb_size:Et,u_dynamic_offset:1}))(me,A,w,Re,[I,M*Re],D,z,O,W>=17?0:he*Re,$?$.size[0]:0),je=[];k&&je.push(_e.hiddenByLandmarkVertexBuffer),_e.groundRadiusBuffer!=null&&je.push(_e.groundRadiusBuffer),t.uploadCommonUniforms(Q,ke,Le.toUnwrapped(),null,ve),ke.draw(t,Q.gl.TRIANGLES,p,m,g,x,Ue,l.id,_e.vertexBuffer,_e.indexBuffer,Pe,l.paint,W,Ae,je)};for(const Le of d){const _e=n.getTile(Le),Pe=_e.getBucket(l);if(!Pe||Pe.projection.name!==ae.projection.name||!Pe.groundEffect||Pe.groundEffect&&!Pe.groundEffect.hasData())continue;const me=Pe.groundEffect,Re=1/Pe.tileToMeter;{const Me=t.translatePosMatrix(Le.projMatrix,_e,se,ue),Ae=me.getDefaultSegment();xe(Le,me,Ae,Me,Re)}if(q)for(let Me=0;Me<4;Me++){const Ae=u.c0[Me](Le),We=n.getTile(Ae);if(!We)continue;
8const ke=We.getBucket(l);if(!ke||ke.projection.name!==ae.projection.name||!ke.groundEffect||ke.groundEffect&&!ke.groundEffect.hasData())continue;const Ue=ke.groundEffect;let je,et;Me===0?(je=[-u.aj,0,0],et=1):Me===1?(je=[u.aj,0,0],et=0):Me===2?(je=[0,-u.aj,0],et=3):(je=[0,u.aj,0],et=2);const tt=Ue.regionSegments[et];tt&&(u.aG(Io,Le.projMatrix,je),xe(Le,Ue,tt,t.translatePosMatrix(Io,_e,se,ue),Re))}}}const ir=770,ms=771;class dt{constructor(t,n,l,d){this.blendFunction=t,this.blendColor=n.toNonPremultipliedRenderColor(null),this.mask=l,this.blendEquation=d}}function Il(s,t,n=0){const l=Math.pow(2,t.tileID.overscaledZ),d=t.tileSize*Math.pow(2,s.transform.tileZoom)/l,p=d*(t.tileID.canonical.x+t.tileID.wrap*l),m=d*t.tileID.canonical.y;return{u_image:0,u_texsize:t.imageAtlasTexture?t.imageAtlasTexture.size:[0,0],u_tile_units_to_pixels:1/u.c1(t,1,s.transform.tileZoom),u_pixel_coord_upper:[p>>16,m>>16],u_pixel_coord_lower:[65535&p,65535&m],u_pattern_transition:n}}dt.Replace=[1,0,1,0],dt.disabled=new dt(dt.Replace,u.C.transparent,[!1,!1,!1,!1]),dt.unblended=new dt(dt.Replace,u.C.transparent,[!0,!0,!0,!0]),dt.alphaBlended=new dt([1,ms,1,ms],u.C.transparent,[!0,!0,!0,!0]),dt.alphaBlendedNonPremultiplied=new dt([ir,ms,ir,ms],u.C.transparent,[!0,!0,!0,!0]),dt.multiply=new dt([774,0,774,0],u.C.transparent,[!0,!0,!0,!0]),dt.multiplyAccumulateAlpha=new dt([774,0,1,ms],u.C.transparent,[!0,!0,!0,!0]),dt.additive=new dt([1,1,1,1],u.C.transparent,[!0,!0,!0,!0]),dt.additiveAlphaWeighted=new dt([ir,1,773,1],u.C.transparent,[!0,!0,!0,!0]),dt.additiveAlphaWeightedUnboundedAlpha=new dt([ir,1,1,1],u.C.transparent,[!0,!0,!0,!0]);const Ta={terrain:0,flat:1},_d=u.aS(),gd=[0,0,0],yd=(s,t,n,l,d,p,m,g,x,w,E,A,I,M,D,z,O,k,q=[0,0,1],$=!1)=>{let U=gd,Q=0,Y=gd;if(!$){const J=t.style.light,se=J.properties.get("position");if(U=[se.x,se.y,se.z],J.properties.get("anchor")==="viewport"){const he=u.c2();u.c3(he,-t.transform.angle),u.c4(U,U,he)}const ue=J.properties.get("color").toPremultipliedRenderColor(null);Q=J.properties.get("intensity"),Y=[ue.r,ue.g,ue.b]}const ae=t.transform,W={u_matrix:s,u_lightpos:U,u_lightintensity:Q,u_lightcolor:Y,u_vertical_gradient:+n,u_opacity:l,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:_d,u_merc_center:[0,0],u_up_dir:[0,0,0],u_height_lift:0,u_height_type:Ta[w],u_base_type:Ta[E],u_ao:d,u_edge_radius:p,u_width_scale:m,u_flood_light_color:D,u_vertical_scale:z,u_flood_light_intensity:O,u_ground_shadow_factor:k,u_front_cutoff_params:q};return ae.projection.name==="globe"&&(W.u_tile_id=[g.canonical.x,g.canonical.y,1<<g.canonical.z],W.u_zoom_transition=A,W.u_inv_rot_matrix=M,W.u_merc_center=I,W.u_up_dir=ae.projection.upVector(new u.bs(0,0,0),I[0]*u.aj,I[1]*u.aj),W.u_height_lift=x),W},Pu=(s,t,n,l,d,p)=>({u_matrix:s,u_edge_radius:t,u_width_scale:n,u_vertical_scale:l,u_height_type:Ta[d],u_base_type:Ta[p]}),Kp=(s,t,n,l,d,p,m,g,x,w,E,A,I,M,D,z,O,k,q=!1)=>{const $=yd(s,t,n,l,d,p,m,g,w,E,A,I,M,D,z,O,1,[0,0,0],[0,0,1],q),U={u_height_factor:-Math.pow(2,g.overscaledZ)/x.tileSize/8};return Object.assign($,Il(t,x,k),U)};function Jp(s){const t=s.properties.get("direction"),n=u.c5(t.x,t.y,t.z);n[2]=u.as(n[2],0,75);const l=u.c8([n[0],n[1],n[2]]);return u.c6(l.x,l.y,l.z)}function yn(s,t,n){const l=t.properties.get("color-use-theme")==="none",d=t.properties.get("color"),p=t.properties.get("intensity"),m=t.properties.get("direction"),g=[m.x,m.y,m.z],x=n.properties.get("color-use-theme")==="none",w=n.properties.get("color"),E=n.properties.get("intensity"),A=Math.max(u.aw([0,0,1],g),0),I=[0,0,0];u.av(I,w.toPremultipliedRenderColor(x?null:s.getLut(t.scope)).toArray01Linear().slice(0,3),E);const M=[0,0,0];return u.av(M,d.toPremultipliedRenderColor(l?null:s.getLut(n.scope)).toArray01Linear().slice(0,3),A*p),u.c7([I[0]>0?I[0]/(I[0]+M[0]):0,I[1]>0?I[1]/(I[1]+M[1]):0,I[2]>0?I[2]/(I[2]+M[2]):0])}const xd=new Float32Array(u.aC([])),Ru=[0,0,0],Xr=(s,t,n,l,d,p,m,g,x,w,E,A,I,M=[0,0,0],D,z,O,k=1,q=!1)=>{let $=Ru,U=0,Q=Ru;if(!q){const J=d.style.light,se=J.properties.get("position");if($=[-se.x,-se.y,se.z],J.properties.get("anchor")==="viewport"){const he=u.c2();u.c3(he,-d.transform.angle),u.c4($,$,he)}const ue=J.properties.get("color").toNonPremultipliedRenderColor(null);U=J.properties.get("intensity"),Q=[ue.r,ue.g,ue.b]}const Y=E.alphaMode==="MASK",ae=I.paint.get("model-ambient-occlusion-intensity"),W=I.paint.get("model-color").constantOr(u.C.white).toNonPremultipliedRenderColor(null);return W.a=I.paint.get("model-color-mix-intensity").constantOr(0),O&&(W.r=O[0],W.g=O[1],W.b=O[2],W.a=O[3]),z&&(W.r=z.color.r,W.g=z.color.g,W.b=z.color.b,W.a=z.colorMix,A=z.emissionStrength,p*=z.opacity),{u_matrix:s,u_lighting_matrix:t,u_normal_matrix:n,u_node_matrix:l||xd,u_lightpos:$,u_lightintensity:U,u_lightcolor:Q,u_camera_pos:M,u_opacity:p,u_baseTextureIsAlpha:0,u_alphaMask:+Y,u_alphaCutoff:E.alphaCutoff,u_baseColorFactor:m.toNonPremultipliedRenderColor(null).toArray01(),u_emissiveFactor:g.toNonPremultipliedRenderColor(null).toArray01(),u_metallicFactor:x,u_roughnessFactor:w,u_baseColorTexture:5,u_metallicRoughnessTexture:6,u_normalTexture:7,u_occlusionTexture:8,u_emissionTexture:9,u_lutTexture:10,u_color_mix:W.toArray01(),u_aoIntensity:ae,u_emissive_strength:A,u_occlusionTextureTransform:D||[0,0,0,0],u_dithered_discard_threshold:k}},Qp=(s,t=xd,n=xd)=>({u_matrix:s,u_instance:t,u_node_matrix:n}),Al=(s,t,n=1)=>({u_matrix:s,u_color:t,u_overlay:0,u_overlay_scale:n}),Ur=new Float64Array(16),Yr=new Float64Array(16),on=new Float64Array(16),Er=new Float64Array(16),Ho=new Float64Array(16),Du=new Float64Array(16),Ig=new Float64Array(16),zu=[0,0,0],em=new Float32Array(16),Lu=[0,0,0],vd=[0,0,0],Fu=[];function bd(s,t,n){const l=n.cameraWorldSizeForFog/n.worldSize;return u.bL(s,n.worldToFogMatrix,[l,l,1]),u.aP(s,s,t),s}function Cl(s,t,n,l){return u.aG(s,t,n),u.b7(l,u.cu)||u.bL(s,s,l),s}function Ou(s,t,n,l,d){const p=n.material,m=l.context,{baseColorTexture:g,metallicRoughnessTexture:x}=p.pbrMetallicRoughness,{normalTexture:w,occlusionTexture:E,emissionTexture:A}=p;function I(D,z,O){if(D&&(s.push(z),m.activeTexture.set(m.gl.TEXTURE0+O),D.gfxTexture)){const{minFilter:k,magFilter:q,wrapS:$,wrapT:U}=D.sampler;D.gfxTexture.bindExtraParam(k,q,$,U)}}I(g,"HAS_TEXTURE_u_baseColorTexture",5),I(x,"HAS_TEXTURE_u_metallicRoughnessTexture",6),I(w,"HAS_TEXTURE_u_normalTexture",7),I(E,"HAS_TEXTURE_u_occlusionTexture",8),I(A,"HAS_TEXTURE_u_emissionTexture",9),d&&(d.texture||(d.texture=new u.ct(l.context,d.image,[d.image.height,d.image.height,d.image.height],m.gl.RGBA8)),m.activeTexture.set(m.gl.TEXTURE0+10),d.texture&&d.texture.bind(m.gl.LINEAR,m.gl.CLAMP_TO_EDGE),s.push("APPLY_LUT_ON_GPU")),n.texcoordBuffer&&(s.push("HAS_ATTRIBUTE_a_uv_2f"),t.push(n.texcoordBuffer)),n.colorBuffer&&(s.push(n.colorBuffer.itemSize===12?"HAS_ATTRIBUTE_a_color_3f":"HAS_ATTRIBUTE_a_color_4f"),t.push(n.colorBuffer)),n.normalBuffer&&(s.push("HAS_ATTRIBUTE_a_normal_3f"),t.push(n.normalBuffer)),n.pbrBuffer&&(s.push("HAS_ATTRIBUTE_a_pbr"),s.push("HAS_ATTRIBUTE_a_heightBasedEmissiveStrength"),t.push(n.pbrBuffer)),p.alphaMode!=="OPAQUE"&&p.alphaMode!=="MASK"||s.push("UNPREMULT_TEXTURE_IN_SHADER"),p.defined||s.push("DIFFUSE_SHADED");const M=l.shadowRenderer;M&&(s.push("RENDER_SHADOWS"),M.useNormalOffset&&s.push("NORMAL_OFFSET"))}function _s(s,t,n,l,d,p){const m=s.modelOpacity,g=t.context,x=new nt(t.context.gl.LEQUAL,s.isLightMesh?nt.ReadOnly:nt.ReadWrite,t.depthRangeFor3D),w=t.transform,E=s.mesh,A=E.material,I=A.pbrMetallicRoughness,M=t.style.fog;t.transform.projection.zAxisUnit==="pixels"?Ur.set(s.nodeModelMatrix):u.aP(Ur,l.zScaleMatrix,s.nodeModelMatrix),u.aP(Ur,l.negCameraPosMatrix,Ur),u.aE(Yr,Ur),u.cl(Yr,Yr);
vendor: 7,067 bytes, line 8
8const D=n.paint.get("model-color-use-theme").constantOr("default")==="none",z=n.paint.get("model-emissive-strength").constantOr(0),O={defines:[]},k=[],q=t.shadowRenderer;q&&(q.useNormalOffset=!1),Ou(O.defines,k,E,t,D?null:n.lut);let $=null;if(M&&($=bd(on,s.nodeModelMatrix,t.transform),w.projection.name!=="globe")){const ae=E.aabb.min,W=E.aabb.max,[J,se]=M.getOpacityForBounds($,ae[0],ae[1],W[0],W[1]);O.overrideFog=J>=ba||se>=ba}const U=ps(t,n.paint.get("model-cutoff-fade-range"));U.shouldRenderCutoff&&O.defines.push("RENDER_CUTOFF");const Q=t.getOrCreateProgram("model",O),Y=Xr(s.worldViewProjection,Ur,Yr,null,t,m,I.baseColorFactor,A.emissiveFactor,I.metallicFactor,I.roughnessFactor,A,z,n,void 0,void 0,s.materialOverride,s.modelColor,1,Q.fixedDefines.includes("LIGHTING_3D_MODE"));t.uploadCommonUniforms(g,Q,null,$,U,s.lightOverrides),t.renderPass!=="shadow"&&q&&q.setupShadowsFromMatrix(s.nodeModelMatrix,Q),Q.draw(t,g.gl.TRIANGLES,x,d,p,E.material.doubleSided?pt.disabled:pt.backCCW,Y,n.id,E.vertexBuffer,E.indexBuffer,E.segments,n.paint,t.transform.zoom,void 0,k)}function gc(s,t){return s.style._importedAsBasemap?"basemap":t.scope}function Ke(s,t,n,l,d,p,m,g,x,w,E){const A=s.transform,I=!!t.isGeometryBloom&&t.isGeometryBloom;if(t.minZoom!==void 0&&s.transform.zoom<t.minZoom||t.maxZoom!==void 0&&s.transform.zoom>t.maxZoom||I&&s.renderPass==="shadow")return;const M=A.projection.name==="globe"?u.cj(n,A):[...n];u.aP(M,M,t.globalMatrix);const D=u.aP([],l,M);if(t.meshes)for(const z of t.meshes){const O=g.get(z.material.name);if(O&&O.opacity<=0)continue;if(z.material.alphaMode!=="BLEND"){m.push({mesh:z,depth:0,modelIndex:d,worldViewProjection:D,nodeModelMatrix:M,isLightMesh:I,materialOverride:O,modelOpacity:x,modelColor:w,lightOverrides:E,node:t,modelMatrix:n});continue}const k=u.ad([],z.centroid,D);!A.isOrthographic&&k[2]<=0||p.push({mesh:z,depth:k[2],modelIndex:d,worldViewProjection:D,nodeModelMatrix:M,isLightMesh:I,materialOverride:O,modelOpacity:x,modelColor:w,lightOverrides:E,node:t,modelMatrix:n})}if(t.children)for(const z of t.children)Ke(s,z,n,l,d,p,m,g,x,w,E)}function Ml(s,t,n,l,d){const p=n.shadowRenderer;if(!p)return;const m=p.getShadowPassDepthMode(),g=d||p.calculateShadowPassMatrixFromMatrix(t),x=Qp(g);n.getOrCreateProgram("modelDepth").draw(n,n.context.gl.TRIANGLES,m,lt.disabled,dt.disabled,pt.disabled,x,l.id,s.vertexBuffer,s.indexBuffer,s.segments,l.paint,n.transform.zoom,void 0,void 0)}function wd(s,t,n,l){const d=(function(E,A){if(A.footprintDebugMesh)return A.footprintDebugMesh;if(!A.footprint)return null;const I=E.context,M=A.footprint.vertices,D=A.footprint.indices,z=new u.co;z.reserve(M.length);for(const se of M)z.emplaceBack(se.x,se.y);const O=new u.cp;O.reserve(D.length);for(let se=0;se<D.length;se+=3)O.emplaceBack(D[se],D[se+1],D[se+2]);const k=I.createVertexBuffer(z,u.cq.members),q=I.createIndexBuffer(O),$=u.cr.simpleSegment(0,0,M.length,D.length),U=A.id||A.name||"footprint";let Q;const Y=parseInt(U,10);Q=isNaN(Y)?(function(se){let ue=0;for(let he=0;he<se.length;he++)ue=(ue<<5)-ue+se.charCodeAt(he)|0;return ue})(U):Y;const ae=u.cy(Q),W=u.cy(Q+1),J=u.cy(Q+2);return A.footprintDebugMesh={vertexBuffer:k,indexBuffer:q,segments:$,color:new u.C(ae,W,J,.5)},A.footprintDebugMesh})(s,n);if(!d)return;const p=s.context,m=p.gl,g=s.getOrCreateProgram("debug"),x=d.color,w=nt.disabled;p.activeTexture.set(m.TEXTURE0),s.emptyTexture.bind(m.LINEAR,m.CLAMP_TO_EDGE),g.draw(s,m.TRIANGLES,w,lt.disabled,dt.alphaBlended,pt.disabled,Al(l,x.toPremultipliedRenderColor(null)),"$debug",d.vertexBuffer,d.indexBuffer,d.segments)}function tm(s,t,n,l,d,p){for(const m of d){const g={...l};g.part=m;const x={type:"Unknown",id:t,properties:g},w={orientation:s.paint.get("model-rotation").evaluate(x,n)};p.set(m,w)}}function Td(s,t,n,l,d,p){for(const m of d){const g={...l};g.part=m;const x={type:"Unknown",id:t,properties:g},w={color:s.paint.get("model-color").evaluate(x,n),colorMix:s.paint.get("model-color-mix-intensity").evaluate(x,n),opacity:s.paint.get("model-opacity").evaluate(x,n),emissionStrength:s.paint.get("model-emissive-strength").evaluate(x,n)};p.set(m,w)}}function qs(s,t,n,l,d){let p=!1;for(const g of l)g.modelOpacity!==1&&(_s(g,s,t,d[g.modelIndex],lt.disabled,dt.disabled),p=!0);for(const g of l)_s(g,s,t,d[g.modelIndex],g.modelOpacity!==1?s.stencilModeFor3D():lt.disabled,s.colorModeForRenderPass());p&&s.resetStencilClippingMasks();const m=dt.additive;for(const g of n)_s(g,s,t,d[g.modelIndex],lt.disabled,g.isLightMesh?m:s.colorModeForRenderPass())}function yc(s,t,n){const l=t.updateZoomBasedPaintProperties(),d=(function(p,m,g){let x,w,E,A=p.terrain?p.terrain.exaggeration():0;if(p.terrain&&A>0){const I=p.terrain,M=I.findDEMTileFor(g);M&&M.dem?x=u.cs.create(I,g,M):A=0}if(A===0&&(m.terrainElevationMin=0,m.terrainElevationMax=0),A===m.validForExaggeration&&(A===0||x&&x._demTile&&x._demTile.tileID===m.validForDEMTile.id&&x._dem._timestamp===m.validForDEMTile.timestamp))return!1;for(const I in m.instancesPerModel){const M=m.instancesPerModel[I];for(let D=0;D<M.instancedDataArray.length;++D){const z=(x?A*x.getElevationAt(0|M.instancedDataArray.float32[16*D],0|M.instancedDataArray.float32[16*D+1],!0,!0):0)+M.instancesEvaluatedElevation[D];M.instancedDataArray.float32[16*D+6]=z,w=w?Math.min(m.terrainElevationMin,z):z,E=E?Math.max(m.terrainElevationMax,z):z}}return m.terrainElevationMin=w||0,m.terrainElevationMax=E||0,m.validForExaggeration=A,m.validForDEMTile=x&&x._demTile?{id:x._demTile.tileID,timestamp:x._dem._timestamp}:{id:void 0,timestamp:0},!0})(s,t,n);(l||d)&&(t.uploaded=!1,t.upload(s.context))}const An={shadowUniformsInitialized:!1,useSingleShadowCascade:!1,tileMatrix:new Float64Array(16),shadowTileMatrix:new Float32Array(16),aabb:new u.ca([0,0,0],[u.aj,u.aj,0])};function im(s,t){const n=1<<s.canonical.z,l=t.getFreeCameraOptions().position,d=t.elevation,p=s.canonical.x/n,m=(s.canonical.x+1)/n,g=s.canonical.y/n,x=(s.canonical.y+1)/n;let w=t._centerAltitude;if(d){const M=d.getMinMaxForTile(s);M&&M.max>w&&(w=M.max)}const E=u.as(l.x,p,m)-l.x,A=u.as(l.y,g,x)-l.y,I=u.aL(w,t.center.lat)-l.z;return t._zoomFromMercatorZ(Math.sqrt(E*E+A*A+I*I))}function Ed(s,t,n,l,d,p,m){const g=s.context,x=s.renderPass==="shadow",w=s.shadowRenderer,E=x&&w?w.getShadowPassDepthMode():new nt(g.gl.LEQUAL,nt.ReadWrite,s.depthRangeFor3D),A=s.isTileAffectedByFog(p),I=s.transform.projection.name==="globe";if(n.meshes)for(const M of n.meshes){const D=I?[]:["MODEL_POSITION_ON_GPU"],z=[];let O,k,q;const $=!I&&l.instancedDataArray.length>20;$&&D.push("INSTANCED_ARRAYS");const U=ps(s,t.paint.get("model-cutoff-fade-range"));if(U.shouldRenderCutoff&&D.push("RENDER_CUTOFF"),x&&w)O=s.getOrCreateProgram("modelDepth",{defines:D}),k=Qp(m.shadowTileMatrix,m.shadowTileMatrix,n.globalMatrix),q=dt.disabled;else{Ou(D,z,M,s,t.paint.get("model-color-use-theme").constantOr("default")==="none"?null:t.lut),O=s.getOrCreateProgram("model",{defines:D,overrideFog:A});const Y=M.material,ae=Y.pbrMetallicRoughness,W=t.paint.get("model-opacity").constantOr(1),J=t.paint.get("model-emissive-strength").constantOr(0);
8k=Xr(p.expandedProjMatrix,n.globalMatrix,em,null,s,W,ae.baseColorFactor,Y.emissiveFactor,ae.metallicFactor,ae.roughnessFactor,Y,J,t,d,void 0,void 0,void 0,1,O.fixedDefines.includes("LIGHTING_3D_MODE")),w&&(m.shadowUniformsInitialized?O.setShadowUniformValues(g,w.getShadowUniformValues()):(w.setupShadows(p.toUnwrapped(),O,"model-tile"),m.shadowUniformsInitialized=!0)),q=U.shouldRenderCutoff||W<1||Y.alphaMode!=="OPAQUE"?dt.alphaBlended:dt.unblended}s.uploadCommonUniforms(g,O,p.toUnwrapped(),null,U);const Q=M.material.doubleSided?pt.disabled:pt.backCCW;if($)z.push(l.instancedDataBuffer),O.draw(s,g.gl.TRIANGLES,E,lt.disabled,q,Q,k,t.id,M.vertexBuffer,M.indexBuffer,M.segments,t.paint,s.transform.zoom,void 0,z,l.instancedDataArray.length);else{const Y=x?"u_instance":"u_normal_matrix";for(let ae=0;ae<l.instancedDataArray.length;++ae)k[Y]=new Float32Array(l.instancedDataArray.arrayBuffer,64*ae,16),O.draw(s,g.gl.TRIANGLES,E,lt.disabled,q,Q,k,t.id,M.vertexBuffer,M.indexBuffer,M.segments,t.paint,s.transform.zoom,void 0,z)}}if(n.children)for(const M of n.children)Ed(s,t,M,l,d,p,m)}function Bu(s,t,n,l,d){const p=s.node;if(p.lodMeshes&&p.lodMeshes.length>0)if(s.targetLod<0)s.targetLod=t>l?1:0;else{const m=d>0?n/1e3/d:1;s.targetLod=u.as(t>l?s.targetLod+m:s.targetLod-m,0,1)}else s.targetLod=0}function gs(s,t,n,l){if(!n.modelManager)return!0;const d=n.modelManager;if(!n.shadowRenderer)return!0;const p=n.shadowRenderer,m=t.aabb;let g=!0,x=s.maxHeight;if(x===0){let E=0;for(const A in s.instancesPerModel){const I=d.getModel(A,l);I?E=Math.max(E,Math.max(Math.max(I.aabb.max[0],I.aabb.max[1]),I.aabb.max[2])):g=!1}x=s.maxScale*E*1.41+s.maxVerticalOffset,g&&(s.maxHeight=x)}m.max[2]=x,m.min[2]+=s.terrainElevationMin,m.max[2]+=s.terrainElevationMax,u.ad(m.min,m.min,t.tileMatrix),u.ad(m.max,m.max,t.tileMatrix);const w=m.intersects(p.getCurrentCascadeFrustum());return n.currentShadowCascade===0&&(s.isInsideFirstShadowMapFrustum=w===2),w===0}function Sd(s,t){const n=s.uniformValues.u_cutoff_params[0],l=s.uniformValues.u_cutoff_params[1],d=s.uniformValues.u_cutoff_params[2],p=s.uniformValues.u_cutoff_params[3];return l===n||p===d?1:u.as(((t-n)/(l-n)-d)/(p-d),0,1)}function Ea(s,t,n,l){if(t.pitch<20)return 1;const d=t.getWorldToCameraMatrix();u.aP(d,d,s);const p=u.cv(n.min[0],n.min[1],n.min[2],1);let m=u.aO(u.cw(),p,d),g=m,x=m;p[1]=n.max[1],m=u.aO(u.cw(),p,d),g=m[1]<g[1]?m:g,x=m[1]>x[1]?m:x,p[0]=n.max[0],m=u.aO(u.cw(),p,d),g=m[1]<g[1]?m:g,x=m[1]>x[1]?m:x,p[1]=n.min[1],m=u.aO(u.cw(),p,d),g=m[1]<g[1]?m:g,x=m[1]>x[1]?m:x;const w=u.as(l[0],0,1),E=100*t.pixelsPerMeter*u.as(l[1],0,1),A=u.as(l[2],0,1),I=u.cx(u.cw(),g,x,w),M=Math.tan(.5*t.fovX),D=-I[2]*M;if(E===0)return I[1]<-Math.abs(D)?A:1;const z=(-Math.abs(D)-I[1])/E,O=u.as(u.ai(1,A,z),A,1);return u.ai(1,O,u.as((t.pitch-20)/20,0,1))}var Pl=`
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`,Sa=`
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);}`,xc=`
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`,rm="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;}",Id=`
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`,Ad=`#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`,ku=`#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`,Cd=`
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`,nm=`#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`,om=`#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`,sm=`#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`;
vendor: 7,635 bytes, lines 206-297
206const Md=/#include\s+"([^"]+)"/g,am=/#pragma mapbox: ([\w\-]+) ([\w]+) ([\w]+) ([\w]+)/g,Nu=/\b[A-Za-z_][A-Za-z0-9_]*\b/g,Ag=new Set(["ifdef","ifndef","elif","if","defined"]),vc=new Set;Ws(Pl,vc),Ws(xc,vc),Ws(Sa,vc);const Ia={"_prelude_fog.vertex.glsl":Ad,"_prelude_terrain.vertex.glsl":Id,"_prelude_shadow.vertex.glsl":om,"_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":ku,"_prelude_shadow.fragment.glsl":sm,"_prelude_lighting.glsl":Cd,"_prelude_raster_array.glsl":nm},Aa={},Vu="precision highp float;",Hs="precision mediump float;",$s=`
248#if defined(GL_EXT_blend_func_extended) && defined(DUAL_SOURCE_BLENDING)
249#extension GL_EXT_blend_func_extended : require
250#endif`,Ca={preludeTerrain:Dt("",Id),preludeFog:Dt(ku,Ad),preludeShadow:Dt(sm,om),preludeRasterArray:Dt(nm,""),preludeLighting:Dt(Cd,Cd),preludePrecisionQualifiers:Dt(Hs,Vu),prelude:Dt(Sa,xc),preludeExtensions:Dt($s,"")},Pd=[$s,Hs,Pl,Ca.prelude.fragmentSource].join(`
251`),Zs=[Vu,Pl,Ca.prelude.vertexSource].join(`
252`);var lm={background:Dt(`#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}
297`),backgroundPattern:Dt(`#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:Dt(`#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_opacity;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*v
372iew_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:Dt("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:Dt(`#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:Dt(`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:Dt("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:Dt("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:Dt("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}`),fill:Dt(`#include "_prelude_fog.fragment.glsl"
511#include "_prelude_lighting.glsl"
512#include "_prelude_shadow.fragment.glsl"
513#pragma mapbox: define highp vec4 color
514#pragma mapbox: define lowp float opacity
515uniform float u_emissive_strength;uniform lowp float u_opacity_multiplier;
516#ifdef RENDER_SHADOWS
517uniform 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;
518#endif
519#ifdef ELEVATED_ROADS
520in highp float v_road_z_offset;
521#endif
522#ifdef INDICATOR_CUTOUT
523in highp float v_z_offset;
524#endif
525void main() {
526#pragma mapbox: initialize highp vec4 color
527#pragma mapbox: initialize lowp float opacity
528vec2 cutout_factors=vec2(0.0);
529#ifdef FEATURE_CUTOUT
530cutout_factors=get_cutout_factors(gl_FragCoord);
531#endif
532vec4 out_color=color;
533#ifdef LIGHTING_3D_MODE
534out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);
535#ifdef RENDER_SHADOWS
536float 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);
537#endif
538#endif
539#ifdef FOG
540out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
541#endif
542out_color*=(opacity*u_opacity_multiplier);
543#ifdef INDICATOR_CUTOUT
544if (v_z_offset >=0.0) {out_color=applyCutout(out_color,v_z_offset);}
545#endif
546#ifdef FEATURE_CUTOUT
547float z=0.0;
548#ifdef ELEVATED_ROADS
549z=v_road_z_offset;
550#endif
551out_color=apply_feature_cutout(out_color,gl_FragCoord,cutout_factors.x,z);
552#endif
553glFragColor=out_color;
554#ifdef USE_MRT1
555out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);
556#endif
557#ifdef OVERDRAW_INSPECTOR
558glFragColor=vec4(1.0);
559#endif
560HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
561#include "_prelude_shadow.vertex.glsl"
562in ivec2 a_pos;
563#ifdef ELEVATED_ROADS
564in float a_road_z_offset;out highp float v_road_z_offset;
565#endif
566#ifdef RENDER_SHADOWS
567uniform 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;
568#endif
569#ifdef INDICATOR_CUTOUT
570out highp float v_z_offset;
571#endif
572uniform mat4 u_matrix;uniform lowp float u_opacity_multiplier;
573#pragma mapbox: define highp vec4 color
574#pragma mapbox: define lowp float opacity
575#pragma mapbox: define highp float z_offset
576void main() {
577#pragma mapbox: initialize highp vec4 color
578#pragma mapbox: initialize lowp float opacity
579#pragma mapbox: initialize highp float z_offset
580#ifdef ELEVATED_ROADS
581z_offset+=a_road_z_offset;v_road_z_offset=z_offset;
582#endif
583float hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);
584#ifdef RENDER_SHADOWS
585vec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset);
586#ifdef NORMAL_OFFSET
587vec3 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();
588#endif
589v_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;
590#endif
591#ifdef FOG
592v_fog_pos=fog_position(vec2(a_pos));
593#endif
594#ifdef INDICATOR_CUTOUT
595v_z_offset=z_offset;
596#endif
597}`),fillOutline:Dt(`#include "_prelude_fog.fragment.glsl"
598#include "_prelude_lighting.glsl"
599#include "_prelude_shadow.fragment.glsl"
600in highp vec2 v_pos;uniform float u_emissive_strength;uniform lowp float u_opacity_multiplier;
601#ifdef ELEVATED_ROADS
602in highp float v_road_z_offset;
603#endif
604#ifdef RENDER_SHADOWS
605uniform 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;
606#endif
607#pragma mapbox: define highp vec4 outline_color
608#pragma mapbox: define lowp float opacity
609void main() {
610#pragma mapbox: initialize highp vec4 outline_color
611#pragma mapbox: initialize lowp float opacity
612float 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);
613#ifdef FEATURE_CUTOUT
614cutout_factors=get_cutout_factors(gl_FragCoord);
615#endif
616#ifdef LIGHTING_3D_MODE
617out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);
618#ifdef RENDER_SHADOWS
619float 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);
620#endif
621#endif
622#ifdef FOG
623out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
624#endif
625#ifdef FEATURE_CUTOUT
626float z=0.0;
627#ifdef ELEVATED_ROADS
628z=v_road_z_offset;
629#endif
630out_color=apply_feature_cutout(out_color,gl_FragCoord,cutout_factors.x,z);
631#endif
632glFragColor=out_color*(alpha*opacity*u_opacity_multiplier);
633#ifdef USE_MRT1
634out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);
635#endif
636#ifdef OVERDRAW_INSPECTOR
637glFragColor=vec4(1.0);
638#endif
639HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
640#include "_prelude_shadow.vertex.glsl"
641in ivec2 a_pos;
642#ifdef ELEVATED_ROADS
643in float a_road_z_offset;out highp float v_road_z_offset;
644#endif
645#ifdef RENDER_SHADOWS
646uniform 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;
647#endif
648uniform mat4 u_matrix;uniform vec2 u_world;uniform lowp float u_opacity_multiplier;out highp vec2 v_pos;
649#pragma mapbox: define highp vec4 outline_color
650#pragma mapbox: define lowp float opacity
651#pragma mapbox: define highp float z_offset
652void main() {
653#pragma mapbox: initialize highp vec4 outline_color
654#pragma mapbox: initialize lowp float opacity
655#pragma mapbox: initialize highp float z_offset
656#ifdef ELEVATED_ROADS
657z_offset+=a_road_z_offset;v_road_z_offset=z_offset;
658#endif
659float hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);
660#ifdef FLIP_Y
661v_pos=(vec2(gl_Position.x,-gl_Position.y)/gl_Position.w+1.0)/2.0*u_world;
662#else
663v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;
664#endif
665#ifdef RENDER_SHADOWS
666vec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset);
667#ifdef NORMAL_OFFSET
668vec3 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();
669#endif
670v_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;
671#endif
672#ifdef FOG
673v_fog_pos=fog_position(vec2(a_pos));
674#endif
675}
675`),fillOutlinePattern:Dt(`#include "_prelude_fog.fragment.glsl"
676#include "_prelude_lighting.glsl"
677#include "_prelude_shadow.fragment.glsl"
678uniform vec2 u_texsize;uniform sampler2D u_image;
679#ifdef FILL_PATTERN_TRANSITION
680uniform float u_pattern_transition;
681#endif
682uniform float u_emissive_strength;uniform lowp float u_opacity_multiplier;
683#ifdef APPLY_LUT_ON_GPU
684uniform highp sampler3D u_lutTexture;
685#endif
686#ifdef RENDER_SHADOWS
687uniform 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;
688#endif
689#ifdef ELEVATED_ROADS
690in highp float v_road_z_offset;
691#endif
692in highp vec2 v_pos;in highp vec2 v_pos_world;
693#pragma mapbox: define lowp float opacity
694#pragma mapbox: define lowp uvec4 pattern
695#ifdef FILL_PATTERN_TRANSITION
696#pragma mapbox: define mediump uvec4 pattern_b
697#endif
698void main() {
699#pragma mapbox: initialize lowp float opacity
700#pragma mapbox: initialize mediump uvec4 pattern
701#ifdef FILL_PATTERN_TRANSITION
702#pragma mapbox: initialize mediump uvec4 pattern_b
703#endif
704vec2 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);
705#ifdef APPLY_LUT_ON_GPU
706out_color=applyLUT(u_lutTexture,out_color);
707#endif
708#ifdef FILL_PATTERN_TRANSITION
709vec2 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;
710#endif
711vec2 cutout_factors=vec2(0.0);
712#ifdef FEATURE_CUTOUT
713cutout_factors=get_cutout_factors(gl_FragCoord);
714#endif
715#ifdef LIGHTING_3D_MODE
716out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);
717#ifdef RENDER_SHADOWS
718float 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);
719#endif
720#endif
721#ifdef FEATURE_CUTOUT
722float z=0.0;
723#ifdef ELEVATED_ROADS
724z=v_road_z_offset;
725#endif
726out_color=apply_feature_cutout(out_color,gl_FragCoord,cutout_factors.x,z);
727#endif
728#ifdef FOG
729out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
730#endif
731glFragColor=out_color*(alpha*opacity*u_opacity_multiplier);
732#ifdef USE_MRT1
733out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);
734#endif
735#ifdef OVERDRAW_INSPECTOR
736glFragColor=vec4(1.0);
737#endif
738HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
739#include "_prelude_shadow.vertex.glsl"
740uniform mat4 u_matrix;uniform vec2 u_world;uniform lowp float u_opacity_multiplier;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in ivec2 a_pos;
741#ifdef ELEVATED_ROADS
742in float a_road_z_offset;out highp float v_road_z_offset;
743#endif
744#ifdef RENDER_SHADOWS
745uniform 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;
746#endif
747out highp vec2 v_pos;out highp vec2 v_pos_world;
748#pragma mapbox: define lowp float opacity
749#pragma mapbox: define lowp uvec4 pattern
750#ifdef FILL_PATTERN_TRANSITION
751#pragma mapbox: define mediump uvec4 pattern_b
752#endif
753#pragma mapbox: define lowp float pixel_ratio
754#pragma mapbox: define highp float z_offset
755void main() {
756#pragma mapbox: initialize lowp float opacity
757#pragma mapbox: initialize mediump uvec4 pattern
758#ifdef FILL_PATTERN_TRANSITION
759#pragma mapbox: initialize mediump uvec4 pattern_b
760#endif
761#pragma mapbox: initialize lowp float pixel_ratio
762#pragma mapbox: initialize highp float z_offset
763vec2 pattern_tl=vec2(pattern.xy);vec2 pattern_br=vec2(pattern.zw);
764#ifdef ELEVATED_ROADS
765z_offset+=a_road_z_offset;v_road_z_offset=z_offset;
766#endif
767float 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);
768#ifdef FLIP_Y
769v_pos_world=(vec2(gl_Position.x,-gl_Position.y)/gl_Position.w+1.0)/2.0*u_world;
770#else
771v_pos_world=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;
772#endif
773#ifdef RENDER_SHADOWS
774vec3 shd_pos0=vec3(pos,z_offset);vec3 shd_pos1=vec3(pos,z_offset);
775#ifdef NORMAL_OFFSET
776vec3 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();
777#endif
778v_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;
779#endif
780#ifdef FOG
781v_fog_pos=fog_position(pos);
782#endif
783}
783`),fillPattern:Dt(`#include "_prelude_fog.fragment.glsl"
784#include "_prelude_lighting.glsl"
785#include "_prelude_shadow.fragment.glsl"
786uniform vec2 u_texsize;uniform sampler2D u_image;
787#ifdef FILL_PATTERN_TRANSITION
788uniform float u_pattern_transition;
789#endif
790in highp vec2 v_pos;uniform float u_emissive_strength;uniform lowp float u_opacity_multiplier;
791#ifdef RENDER_SHADOWS
792uniform 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;
793#endif
794#ifdef ELEVATED_ROADS
795in highp float v_road_z_offset;
796#endif
797#ifdef APPLY_LUT_ON_GPU
798uniform highp sampler3D u_lutTexture;
799#endif
800#pragma mapbox: define lowp float opacity
801#pragma mapbox: define lowp uvec4 pattern
802#ifdef FILL_PATTERN_TRANSITION
803#pragma mapbox: define mediump uvec4 pattern_b
804#endif
805void main() {
806#pragma mapbox: initialize lowp float opacity
807#pragma mapbox: initialize mediump uvec4 pattern
808#ifdef FILL_PATTERN_TRANSITION
809#pragma mapbox: initialize mediump uvec4 pattern_b
810#endif
811vec2 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);
812#ifdef APPLY_LUT_ON_GPU
813out_color=applyLUT(u_lutTexture,out_color);
814#endif
815#ifdef FILL_PATTERN_TRANSITION
816vec2 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;
817#endif
818vec2 cutout_factors=vec2(0.0);
819#ifdef FEATURE_CUTOUT
820cutout_factors=get_cutout_factors(gl_FragCoord);
821#endif
822#ifdef LIGHTING_3D_MODE
823out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);
824#ifdef RENDER_SHADOWS
825float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);light=mix(light,1.0,cutout_factors.y);
826#ifdef ELEVATED_ROADS
827out_color.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light);
828#else
829out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);
830#endif
831#endif
832#endif
833#ifdef FEATURE_CUTOUT
834float z=0.0;
835#ifdef ELEVATED_ROADS
836z=v_road_z_offset;
837#endif
838out_color=apply_feature_cutout(out_color,gl_FragCoord,cutout_factors.x,z);
839#endif
840#ifdef FOG
841out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
842#endif
843glFragColor=out_color*(opacity*u_opacity_multiplier);
844#ifdef USE_MRT1
845out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);
846#endif
847#ifdef OVERDRAW_INSPECTOR
848glFragColor=vec4(1.0);
849#endif
850HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
851#include "_prelude_shadow.vertex.glsl"
852uniform mat4 u_matrix;uniform lowp float u_opacity_multiplier;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in ivec2 a_pos;
853#ifdef ELEVATED_ROADS
854in float a_road_z_offset;out highp float v_road_z_offset;
855#endif
856#ifdef RENDER_SHADOWS
857uniform 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;
858#endif
859out highp vec2 v_pos;
860#pragma mapbox: define lowp float opacity
861#pragma mapbox: define lowp uvec4 pattern
862#ifdef FILL_PATTERN_TRANSITION
863#pragma mapbox: define mediump uvec4 pattern_b
864#endif
865#pragma mapbox: define lowp float pixel_ratio
866#pragma mapbox: define highp float z_offset
867void main() {
868#pragma mapbox: initialize lowp float opacity
869#pragma mapbox: initialize mediump uvec4 pattern
870#pragma mapbox: initialize lowp float pixel_ratio
871#pragma mapbox: initialize highp float z_offset
872#ifdef FILL_PATTERN_TRANSITION
873#pragma mapbox: initialize mediump uvec4 pattern_b
874#endif
875vec2 pattern_tl=vec2(pattern.xy);vec2 pattern_br=vec2(pattern.zw);vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;
876#ifdef ELEVATED_ROADS
877z_offset+=a_road_z_offset;v_road_z_offset=z_offset;
878#endif
879float 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);
880#ifdef RENDER_SHADOWS
881vec3 shd_pos0=vec3(pos,z_offset);vec3 shd_pos1=vec3(pos,z_offset);
882#ifdef NORMAL_OFFSET
883vec3 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();
884#endif
885v_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;
886#endif
887#ifdef FOG
888v_fog_pos=fog_position(pos);
889#endif
890}`),lineBlendComposite:Dt(`uniform highp sampler2D u_image;uniform float u_opacity;uniform int u_blend_mode;uniform highp float u_max_density;in vec2 v_pos;
891#define ADDITIVE 1
892void 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);}
893#ifdef OVERDRAW_INSPECTOR
894glFragColor=vec4(0.0);
895#endif
896HANDLE_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:Dt("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:Dt(`#include "_prelude_fog.fragment.glsl"
897#include "_prelude_shadow.fragment.glsl"
898#include "_prelude_lighting.glsl"
899in vec4 v_color;in vec4 v_flat;
900#ifdef RENDER_SHADOWS
901in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;
902#endif
903uniform lowp float u_opacity;
904#ifdef RENDER_FRONT_CUTOFF
905in float v_front_cutoff_opacity;
906#endif
907#ifdef INDICATOR_CUTOUT
908#ifdef FEATURE_CUTOUT
909in vec4 v_ground_roof;
910#endif
911#endif
912#ifdef FAUX_AO
913uniform lowp vec2 u_ao;in vec2 v_ao;
914#endif
915#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)
916in vec4 v_roof_color;
917#endif
918#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)
919in highp vec3 v_normal;
920#endif
921uniform vec3 u_flood_light_color;uniform highp float u_vertical_scale;uniform float u_flood_light_intensity;uniform vec3 u_ground_shadow_factor;
922#if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT)
923in float v_flood_radius;in float v_has_floodlight;
924#endif
925in float v_height;
926#pragma mapbox: define highp float emissive_strength
927void main() {
928#pragma mapbox: initialize highp float emissive_strength
929#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)
930vec3 normal=normalize(v_normal);
931#endif
932float z;vec4 color=v_color;
933#ifdef ZERO_ROOF_RADIUS
934z=float(normal.z > 0.00001);
935#ifdef LIGHTING_3D_MODE
936normal=mix(normal,vec3(0.0,0.0,1.0),z);
937#else
938color=mix(v_color,v_roof_color,z);
939#endif
940#endif
941float h=max(0.0,v_height);float ao_shade=1.0;
942#ifdef FAUX_AO
943float 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),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x;
944#ifdef ZERO_ROOF_RADIUS
945concave*=(1.0-z);
946#endif
947float 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);
948#ifdef LIGHTING_3D_MODE
949#ifdef FLOOD_LIGHT
950color.rgb*=mix(ao_shade,1.0,v_has_floodlight);
951#else
952color.rgb*=ao_shade;
953#endif
954#else
955color.rgb*=ao_shade;
956#endif
957#endif
958#ifdef LIGHTING_3D_MODE
959float flood_radiance=0.0;
960#ifdef FLOOD_LIGHT
961flood_radiance=(1.0-min(h/v_flood_radius,1.0))*u_flood_light_intensity*v_has_floodlight;
962#endif
963#ifdef RENDER_SHADOWS
964#ifdef FLOOD_LIGHT
965float 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);
966#else
967float shadowed_lighting_factor;
968#ifdef RENDER_CUTOFF
969shadowed_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;}
970#else
971shadowed_lighting_factor=shadowed_light_factor_normal(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);
972#endif
973color.rgb=apply_lighting(color.rgb,normal,shadowed_lighting_factor);
974#endif
975#else
976color.rgb=apply_lighting(color.rgb,normal);
977#ifdef FLOOD_LIGHT
978color.rgb=mix(color.rgb,u_flood_light_color*u_opacity,flood_radiance);
979#endif
980#endif
981color.rgb=mix(color.rgb,v_flat.rgb,emissive_strength);color*=u_opacity;
982#endif
983#ifdef FOG
984color=fog_dither(fog_apply_premultiplied(color,v_fog_pos,h));
985#endif
986#ifdef INDICATOR_CUTOUT
987#ifdef FEATURE_CUTOUT
988{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;}}}
989#else
990color=applyCutout(color,h);
991#endif
992#endif
993#ifdef RENDER_FRONT_CUTOFF
994if (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;}}
995#endif
996#ifdef FEATURE_CUTOUT
997color=apply_feature_cutout(color,gl_FragCoord,get_cutout_factors(gl_FragCoord).x,0.0);
998#endif
999glFragColor=color;
1000#ifdef OVERDRAW_INSPECTOR
1001glFragColor=vec4(1.0);
1002#endif
1003HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
1004#include "_prelude_terrain.vertex.glsl"
1005#include "_prelude_shadow.vertex.glsl"
1006#include "_prelude_lighting.glsl"
1007#include "_prelude_material_table.vertex.glsl"
1008uniform mat4 u_matrix;
1009#ifndef LIGHTING_3D_MODE
1010uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;
1011#endif
1012uniform 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;
1013#if defined(HAS_CENTROID) || defined(TERRAIN)
1014in uvec2 a_centroid_pos;
1015#endif
1016#ifdef RENDER_WALL_MODE
1017in ivec4 a_join_normal_inside;
1018#endif
1019#ifdef PROJECTION_GLOBE_VIEW
1020in 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;
1021#endif
1022#ifdef TERRAIN
1023uniform int u_height_type;uniform int u_base_type;
1024#endif
1025uniform highp float u_vertical_scale;
1026#ifdef RENDER_FRONT_CUTOFF
1027uniform vec3 u_front_cutoff_params;out float v_front_cutoff_opacity;
1028#endif
1029out vec4 v_color;out vec4 v_flat;
1030#ifdef RENDER_SHADOWS
1031uniform 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;
1032#endif
1033#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)
1034out vec4 v_roof_color;
1035#endif
1036#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)
1037out highp vec3 v_normal;
1038#endif
1039#ifdef FAUX_AO
1040uniform lowp vec2 u_ao;out vec2 v_ao;
1041#endif
1042#if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT)
1043out float v_flood_radius;out float v_has_floodlight;
1044#endif
1045out float v_height;
1046#ifdef INDICATOR_CUTOUT
1047#ifdef FEATURE_CUTOUT
1048out vec4 v_ground_roof;
1049#endif
1050#endif
1051vec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}
1052#pragma mapbox: define highp float base
1053#pragma mapbox: define highp float height
1054#pragma mapbox: define highp vec4 color
1055#pragma mapbox: define highp float flood_light_wall_radius
1056#pragma mapbox: define highp float line_width
1057#pragma mapbox: define highp float emissive_strength
1058void main() {DECLARE_MATERIAL_TABLE_INFO
1059#pragma mapbox: initialize highp float base
1060#pragma mapbox: initialize highp float height
1061#pragma mapbox: initialize highp vec4 color
1062#pragma mapbox: initialize highp float flood_light_wall_radius
1063#pragma mapbox: initialize highp float line_width
1064#pragma mapbox: initialize highp float emissive_strength
1065base*=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));
1066#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)
1067v_normal=normal;
1068#endif
1069base=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);
1070#if defined(HAS_CENTROID) || defined(TERRAIN)
1071centroid_pos=vec2(a_centroid_pos);
1072#endif
1073float ele=0.0;float h=0.0;float c_ele=0.0;vec3 pos;
1074#ifdef TERRAIN
1075bool 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;
1076#else
1077h=t > 0.0 ? height : base;
1078#endif
1079pos=vec3(pos_nx.xy,h);
1080#ifdef PROJECTION_GLOBE_VIEW
1081float 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);
1082#endif
1083float cutoff=1.0;vec3 scaled_pos=pos;
1084#if defined(RENDER_CUTOFF) || defined(RENDER_FRONT_CUTOFF)
1085vec2 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);}}
1086#endif
1087#if defined(RENDER_CUTOFF) || defined(RENDER_FRONT_CUTOFF)
1088vec4 ground=u_matrix*vec4(centroid_decoded,ele,1.0);
1089#endif
1090#ifdef RENDER_CUTOFF
1091#ifdef CLIP_ZERO_TO_ONE
1092cutoff=cutoff_opacity(u_cutoff_params,ground.z*2.0-ground.w);
1093#else
1094cutoff=cutoff_opacity(u_cutoff_params,ground.z);
1095#endif
1096if (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);
1097#endif
1098float hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (cutoff==0.0 && centroid_pos.x !=0.0) || (color.a==0.0));
1099#ifdef RENDER_FRONT_CUTOFF
1100v_front_cutoff_opacity=1.0;if (centroid_pos.x > 0.0 && centroid_pos.y > 0.0) {hidden=max(hidden,float(ground.w <=0.0));float 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);}
1101#endif
1102#ifdef RENDER_WALL_MODE
1103vec3 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;
1104#endif
1105gl_Position=mix(u_matrix*vec4(scaled_pos,1),AWAY,hidden);h=h-ele;v_height=h;
1106#ifdef RENDER_SHADOWS
1107vec3 shd_pos0=pos;vec3 shd_pos1=pos;
1108#ifdef NORMAL_OFFSET
1109vec3 offset=shadow_normal_offset(normal);shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();
1110#endif
1111v_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);
1112#endif
1113float NdotL=0.0;float colorvalue=0.0;
1114#ifndef LIGHTING_3D_MODE
1115colorvalue=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*=(
1116(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));}
1117#endif
1118#ifdef FAUX_AO
1119float 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;
1120#ifdef TERRAIN
1121top_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(ce
1121ntroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height);
1122#endif
1123v_ao=vec2(mix(concave,-concave,start),y_ground);NdotL*=(1.0+0.05*(1.0-top_up_ny_start.y)*u_ao[0]);
1124#ifdef PROJECTION_GLOBE_VIEW
1125top_height+=u_height_lift;
1126#endif
1127gl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w;
1128#endif
1129#ifdef LIGHTING_3D_MODE
1130#ifdef FLOOD_LIGHT
1131float 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;
1132#endif
1133v_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);
1134#else
1135v_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;
1136#endif
1137#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)
1138float 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;
1139#endif
1140#ifdef FOG
1141v_fog_pos=fog_position(pos);
1142#endif
1143#ifdef INDICATOR_CUTOUT
1144#ifdef FEATURE_CUTOUT
1145vec4 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);
1146#endif
1147#endif
1148}`),fillExtrusionPattern:Dt(`#include "_prelude_fog.fragment.glsl"
1149#include "_prelude_lighting.glsl"
1150uniform vec2 u_texsize;uniform sampler2D u_image;
1151#ifdef FILL_EXTRUSION_PATTERN_TRANSITION
1152uniform float u_pattern_transition;
1153#endif
1154#ifdef FAUX_AO
1155uniform lowp vec2 u_ao;in vec3 v_ao;
1156#endif
1157#ifdef LIGHTING_3D_MODE
1158in vec3 v_normal;
1159#endif
1160#ifdef APPLY_LUT_ON_GPU
1161uniform highp sampler3D u_lutTexture;
1162#endif
1163in highp vec2 v_pos;in vec4 v_lighting;uniform lowp float u_opacity;
1164#pragma mapbox: define highp float base
1165#pragma mapbox: define highp float height
1166#pragma mapbox: define mediump uvec4 pattern
1167#ifdef FILL_EXTRUSION_PATTERN_TRANSITION
1168#pragma mapbox: define mediump uvec4 pattern_b
1169#endif
1170#pragma mapbox: define highp float pixel_ratio
1171void main() {
1172#pragma mapbox: initialize highp float base
1173#pragma mapbox: initialize highp float height
1174#pragma mapbox: initialize mediump uvec4 pattern
1175#ifdef FILL_EXTRUSION_PATTERN_TRANSITION
1176#pragma mapbox: initialize mediump uvec4 pattern_b
1177#endif
1178#pragma mapbox: initialize highp float pixel_ratio
1179vec2 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);
1180#ifdef APPLY_LUT_ON_GPU
1181out_color=applyLUT(u_lutTexture,out_color);
1182#endif
1183#ifdef FILL_EXTRUSION_PATTERN_TRANSITION
1184vec2 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;
1185#endif
1186#ifdef LIGHTING_3D_MODE
1187out_color=apply_lighting(out_color,normalize(v_normal))*u_opacity;
1188#else
1189out_color=out_color*v_lighting;
1190#endif
1191#ifdef FAUX_AO
1192float 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),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;
1193#endif
1194#ifdef FOG
1195out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
1196#endif
1197#ifdef INDICATOR_CUTOUT
1198out_color=applyCutout(out_color,height);
1199#endif
1200glFragColor=out_color;
1201#ifdef OVERDRAW_INSPECTOR
1202glFragColor=vec4(1.0);
1203#endif
1204HANDLE_WIREFRAME_DEBUG;}`,
vendor: 5,532 bytes, lines 1204-1300
1204`#include "_prelude_fog.vertex.glsl"
1205#include "_prelude_terrain.vertex.glsl"
1206#include "_prelude_lighting.glsl"
1207#include "_prelude_material_table.vertex.glsl"
1208uniform 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;
1209#ifndef LIGHTING_3D_MODE
1210uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;
1211#endif
1212in ivec4 a_pos_normal_ed;
1213#if defined(HAS_CENTROID) || defined(TERRAIN)
1214in uvec2 a_centroid_pos;
1215#endif
1216#ifdef RENDER_WALL_MODE
1217in ivec4 a_join_normal_inside;
1218#endif
1219#ifdef PROJECTION_GLOBE_VIEW
1220in 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;
1221#endif
1222#ifdef TERRAIN
1223uniform int u_height_type;uniform int u_base_type;
1224#endif
1225out highp vec2 v_pos;out vec4 v_lighting;
1226#ifdef FAUX_AO
1227uniform lowp vec2 u_ao;out vec3 v_ao;
1228#endif
1229#ifdef LIGHTING_3D_MODE
1230out vec3 v_normal;
1231#endif
1232#pragma mapbox: define highp float base
1233#pragma mapbox: define highp float height
1234#pragma mapbox: define highp vec4 color
1235#pragma mapbox: define mediump uvec4 pattern
1236#ifdef FILL_EXTRUSION_PATTERN_TRANSITION
1237#pragma mapbox: define mediump uvec4 pattern_b
1238#endif
1239#pragma mapbox: define highp float pixel_ratio
1240#pragma mapbox: define highp float line_width
1241void main() {DECLARE_MATERIAL_TABLE_INFO
1242#pragma mapbox: initialize highp float base
1243#pragma mapbox: initialize highp float height
1244#pragma mapbox: initialize highp vec4 color
1245#pragma mapbox: initialize mediump uvec4 pattern
1246#ifdef FILL_EXTRUSION_PATTERN_TRANSITION
1247#pragma mapbox: initialize mediump uvec4 pattern_b
1248#endif
1249#pragma mapbox: initialize highp float pixel_ratio
1250#pragma mapbox: initialize highp float line_width
1251vec2 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);
1252#if defined(HAS_CENTROID) || defined(TERRAIN)
1253centroid_pos=vec2(a_centroid_pos);
1254#endif
1255float ele=0.0;float h=z;vec3 p;float c_ele;
1256#ifdef TERRAIN
1257bool 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);
1258#else
1259p=vec3(pos_nx.xy,z);
1260#endif
1261#ifdef PROJECTION_GLOBE_VIEW
1262float 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);
1263#endif
1264#ifdef RENDER_WALL_MODE
1265vec3 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;
1266#endif
1267float 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
1268? pos_nx.xy
1269: 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;
1270#ifdef LIGHTING_3D_MODE
1271NdotL=calculate_NdotL(normal);
1272#else
1273NdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),NdotL);
1274#endif
1275if (normal.y !=0.0) {float r=0.84;
1276#ifndef LIGHTING_3D_MODE
1277r=mix(0.7,0.98,1.0-u_lightintensity);
1278#endif
1279NdotL*=(
1280(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));}
1281#ifdef FAUX_AO
1282float 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;
1283#ifdef TERRAIN
1284top_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);
1285#endif
1286v_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]);
1287#ifdef PROJECTION_GLOBE_VIEW
1288top_height+=u_height_lift;
1289#endif
1290gl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w;
1291#endif
1292#ifdef LIGHTING_3D_MODE
1293v_normal=normal;
1294#else
1295v_lighting.rgb+=clamp(NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;
1296#endif
1297#ifdef FOG
1298v_fog_pos=fog_position(p);
1299#endif
1300}`),
1300hillshadePrepare:Dt(`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(
1301(c+e+e+h)-(a+d+d+f),(f+g+g+h)-(a+b+b+c)
1302)/pow(2.0,exaggeration+(19.2562-u_zoom));glFragColor=clamp(vec4(
1303deriv.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:Dt(`#include "_prelude_fog.fragment.glsl"
1304#include "_prelude_lighting.glsl"
1305uniform 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;
1306#ifdef LIGHTING_3D_MODE
1307glFragColor=apply_lighting_with_emission_ground(glFragColor,u_emissive_strength);
1308#endif
1309#ifdef FOG
1310glFragColor=fog_dither(fog_apply_premultiplied(glFragColor,v_fog_pos));
1311#endif
1312#ifdef USE_MRT1
1313out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);
1314#endif
1315#ifdef OVERDRAW_INSPECTOR
1316glFragColor=vec4(1.0);
1317#endif
1318HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
1319uniform 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;
1320#ifdef FOG
1321v_fog_pos=fog_position(vec2(a_pos));
1322#endif
1323}`),line:Dt(`#include "_prelude_fog.fragment.glsl"
1324#include "_prelude_lighting.glsl"
1325#include "_prelude_shadow.fragment.glsl"
1326uniform lowp float u_device_pixel_ratio;uniform highp float u_width_scale;uniform float u_alpha_discard_threshold;uniform lowp float u_opacity_multiplier;uniform bool u_clip_to_tile_borders;in vec4 v_width2_dilute;in vec2 v_normal;in float v_gamma_scale;in vec2 v_tile_pos;
1327#ifdef ELEVATED_ROADS
1328in highp float v_road_z_offset;
1329#endif
1330#ifdef VARIABLE_LINE_WIDTH
1331in float stub_side;
1332#endif
1333#ifdef RENDER_LINE_DASH
1334uniform sampler2D u_dash_image;uniform highp float u_floor_width_scale;in vec2 v_tex;
1335#endif
1336#ifdef DEBUG_ELEVATION_ID
1337in vec3 v_elevation_id_col;
1338#endif
1339#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)
1340in highp vec3 v_uv;
1341#endif
1342#ifdef RENDER_LINE_GRADIENT
1343uniform sampler2D u_gradient_image;
1344#endif
1345#ifdef RENDER_LINE_TRIM_OFFSET
1346uniform 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;
1347#endif
1348#ifdef INDICATOR_CUTOUT
1349in highp float v_z_offset;
1350#endif
1351#ifdef RENDER_SHADOWS
1352uniform bool u_emissive_in_shadows;uniform 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;
1353#endif
1354float luminance(vec3 c) {return (c.r+c.r+c.b+c.g+c.g+c.g)*0.1667;}
1355#pragma mapbox: define highp vec4 color
1356#pragma mapbox: define lowp float floorwidth
1357#pragma mapbox: define mediump uvec4 dash
1358#pragma mapbox: define lowp float blur
1359#pragma mapbox: define lowp float opacity
1360#pragma mapbox: define mediump float side_z_offset
1361#pragma mapbox: define lowp float border_width
1362#pragma mapbox: define lowp vec4 border_color
1363#pragma mapbox: define lowp float emissive_strength
1364float linearstep(float edge0,float edge1,float x) {return  clamp((x-edge0)/(edge1-edge0),0.0,1.0);}void main() {
1365#pragma mapbox: initialize highp vec4 color
1366#pragma mapbox: initialize lowp float floorwidth
1367#pragma mapbox: initialize mediump uvec4 dash
1368#pragma mapbox: initialize lowp float blur
1369#pragma mapbox: initialize lowp float opacity
1370#pragma mapbox: initialize mediump float side_z_offset
1371#pragma mapbox: initialize lowp float border_width
1372#pragma mapbox: initialize lowp vec4 border_color
1373#pragma mapbox: initialize lowp float emissive_strength
1374float dist=length(v_normal)*v_width2_dilute.x;float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;
1375#ifdef RENDER_LINE_BORDER
1376#ifndef VARIABLE_LINE_WIDTH
1377ANTIALIASING*=8.0;
1378#endif
1379#endif
1380#ifdef VARIABLE_LINE_WIDTH
1381blur=mix(blur,0.0,stub_side);
1382#endif
1383float 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);float pxStep;float delta;
1384#ifdef RENDER_LINE_BORDER
1385#ifndef VARIABLE_LINE_WIDTH
1386pxStep=fwidth(dist);float out_edge=v_width2_dilute.x-dist;float in_edge=dist-(v_width2_dilute.y-2.0*ANTIALIASING);delta=v_width2_dilute.y > 0.0 ? min(in_edge,out_edge) : out_edge;float edge=ANTIALIASING;alpha=delta > 0.0 ? smoothstep(edge-pxStep,u_width_scale*blur+edge+pxStep,delta) : 0.0;
1387#endif
1388#endif
1389#ifdef RENDER_LINE_DASH
1390float sdfdist=texture(u_dash_image,v_tex).r;float sdfgamma=ANTIALIASING/(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);
1391#endif
1392highp vec4 out_color;
1393#ifdef RENDER_LINE_GRADIENT
1394out_color=texture(u_gradient_image,v_uv.xy);
1395#else
1396out_color=color;
1397#endif
1398float trim_alpha=1.0;
1399#ifdef RENDER_LINE_TRIM_OFFSET
1400highp 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;
1401#ifdef RENDER_LINE_GRADIENT
1402gradient_trim_color_mix_factor=smoothstep(u_trim_gradient_mix_range.x,u_trim_gradient_mix_range.y,line_progress);
1403#endif
1404highp 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;}
1405#endif
1406if (u_alpha_discard_threshold !=0.0) {if (alpha < u_alpha_discard_threshold) {discard;}}
1407#ifdef RENDER_LINE_BORDER
1408#ifndef VARIABLE_LINE_WIDTH
1409float edge2=border_width*u_width_scale+ANTIALIASING;float alpha2=smoothstep(edge2-pxStep,edge2+pxStep,delta);if (alpha2 < 1.) {if (border_color.a==0.0) {
1410#ifndef RENDER_LINE_GRADIENT
1411float 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-alpha2));} else {out_color.rgb*=(0.6+0.4*alpha2);}
1412#else
1413out_color.rgb*=(0.6+0.4*alpha2);
1414#endif
1415} else {out_color=mix(border_color*trim_alpha,out_color,alpha2);}out_color*=v_width2_dilute.w;}
1416#endif
1417#endif
1418vec2 cutout_factors=vec2(0.0);
1419#ifdef FEATURE_CUTOUT
1420cutout_factors=get_cutout_factors(gl_FragCoord);
1421#endif
1422#ifdef LIGHTING_3D_MODE
1423out_color=apply_lighting_with_emission_ground(out_color,emissive_strength);
1424#ifdef RENDER_SHADOWS
1425float 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;
1426#ifdef ELEVATED_ROADS
1427out_color.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light);
1428#else
1429out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);
1430#endif
1431#endif
1432#endif
1433#ifdef FOG
1434out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
1435#endif
1436out_color*=(alpha*diluted_opacity*u_opacity_multiplier);
1437#ifdef INDICATOR_CUTOUT
1438out_color=applyCutout(out_color,v_z_offset);
1439#endif
1440#ifdef FEATURE_CUTOUT
1441float z=0.0;
1442#ifdef ELEVATED_ROADS
1443z=v_road_z_offset;
1444#endif
1445out_color=apply_feature_cutout(out_color,gl_FragCoord,cutout_factors.x,z);
1446#endif
1447#ifdef LINE_BLEND_ADDITIVE
1448{float cov=alpha*diluted_opacity;glFragColor=vec4(cov > 0.0 ? out_color.rgb/cov : vec3(0.0),cov);}
1449#else
1450#ifdef LINE_BLEND_MULTIPLY
1451glFragColor=vec4(out_color.rgb+(1.0-out_color.a),1.0);
1452#else
1453glFragColor=out_color;
1454#endif
1455#endif
1456#ifdef DUAL_SOURCE_BLENDING
1457glFragColorSrc1=vec4(vec3(0.0),emissive_strength);
1458#else
1459#ifdef USE_MRT1
1460out_Target1=vec4(emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);
1461#endif
1462#endif
1463#ifdef OVERDRAW_INSPECTOR
1464glFragColor=vec4(1.0);
1465#endif
1466#ifdef DEBUG_ELEVATION_ID
1467glFragColor=vec4(v_elevation_id_col,1.0);
1468#endif
1469if (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"
1470#include "_prelude_shadow.vertex.glsl"
1471#include "_prelude_terrain.vertex.glsl"
1472#define EXTRUDE_SCALE 0.015873016
1473in ivec2 a_pos_normal;in uvec4 a_data;
1474#if defined(ELEVATED) || defined(ELEVATED_ROADS) || defined(VARIABLE_LINE_WIDTH) || defined(VARIABLE_LINE_EMISSIVE_STRENGTH)
1475in vec4 a_z_offset_width;
1476#endif
1477#ifdef DEBUG_ELEVATION_ID
1478in vec3 a_elevation_id_col;
1479#endif
1480#ifdef DEBUG_ELEVATION_ID
1481out vec3 v_elevation_id_col;
1482#endif
1483#ifdef ELEVATION_GROUND_SCALE
1484in float a_elevation_ground_scale;
1485#endif
1486#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET) || defined(RENDER_LINE_CURVE)
1487in highp vec3 a_packed;
1488#endif
1489#ifdef RENDER_LINE_DASH
1490in float a_linesofar;
1491#endif
1492uniform 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;
1493#ifdef RENDER_LINE_CURVE
1494uniform mat3 u_curve_points_x;uniform mat3 u_curve_points_y;uniform mat3 u_curve_points_z;uniform float u_curve_point_count;
1495#endif
1496#ifdef ELEVATED
1497uniform lowp float u_zbias_factor;uniform lowp float u_tile_to_meter;float sample_elevation(vec2 apos) {
1498#ifdef ELEVATION_REFERENCE_SEA
1499return 0.0;
1500#else
1501return elevation(apos);
1502#endif
1503}
1504#endif
1505out vec2 v_normal;out vec4 v_width2_dilute;out float v_gamma_scale;out vec2 v_tile_pos;
1506#ifdef ELEVATED_ROADS
1507out highp float v_road_z_offset;
1508#endif
1509#ifdef VARIABLE_LINE_WIDTH
1510out float stub_side;
1511#endif
1512#ifdef RENDER_LINE_DASH
1513uniform highp float u_floor_width_scale;uniform vec2 u_texsize;uniform float u_tile_units_to_pixels;out vec2 v_tex;
1514#endif
1515#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)
1516out highp vec3 v_uv;
1517#endif
1518#ifdef RENDER_LINE_GRADIENT
1519uniform float u_image_height;
1520#endif
1521#ifdef INDICATOR_CUTOUT
1522out highp float v_z_offset;
1523#endif
1524#ifdef RENDER_SHADOWS
1525uniform 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;
1526#endif
1527#pragma mapbox: define highp vec4 color
1528#pragma mapbox: define lowp float floorwidth
1529#pragma mapbox: define mediump uvec4 dash
1530#pragma mapbox: define lowp float blur
1531#pragma mapbox: define lowp float opacity
1532#pragma mapbox: define mediump float gapwidth
1533#pragma mapbox: define lowp float offset
1534#pragma mapbox: define mediump float width
1535#pragma mapbox: define mediump float side_z_offset
1536#pragma mapbox: define lowp float border_width
1537#pragma mapbox: define lowp vec4 border_color
1538#pragma mapbox: define lowp float emissive_strength
1539#ifdef RENDER_LINE_CURVE
1540vec3 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
1540=t*t;float t3=t2*t;return 0.5*(
15412.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
1542);}vec2 catmullRomTangent(vec2 p0,vec2 p1,vec2 p2,vec2 p3,float t) {float t2=t*t;return 0.5*(
1543(-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
1544);}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;}
1545#endif
1546void main() {
1547#pragma mapbox: initialize highp vec4 color
1548#pragma mapbox: initialize lowp float floorwidth
1549#pragma mapbox: initialize mediump uvec4 dash
1550#pragma mapbox: initialize lowp float blur
1551#pragma mapbox: initialize lowp float opacity
1552#pragma mapbox: initialize mediump float gapwidth
1553#pragma mapbox: initialize lowp float offset
1554#pragma mapbox: initialize mediump float width
1555#pragma mapbox: initialize mediump float side_z_offset
1556#pragma mapbox: initialize lowp float border_width
1557#pragma mapbox: initialize lowp vec4 border_color
1558#pragma mapbox: initialize lowp float emissive_strength
1559#ifdef VARIABLE_LINE_EMISSIVE_STRENGTH
1560emissive_strength=a_z_offset_width.w;
1561#endif
1562float a_z_offset=u_z_offset;
1563#if defined(ELEVATED) || defined(ELEVATED_ROADS)
1564a_z_offset+=a_z_offset_width.x;
1565#endif
1566#ifdef DEBUG_ELEVATION_ID
1567v_elevation_id_col=a_elevation_id_col;
1568#endif
1569highp float line_progress=0.0;
1570#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET) || defined(RENDER_LINE_CURVE)
1571line_progress=a_packed[2];
1572#endif
1573float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;
1574#ifdef RENDER_LINE_BORDER
1575#ifndef VARIABLE_LINE_WIDTH
1576ANTIALIASING*=8.0;
1577#endif
1578#endif
1579vec2 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;
1580#ifdef RENDER_LINE_CURVE
1581CurveResult 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;
1582#endif
1583gapwidth=gapwidth/2.0;float halfwidth;float dilute_scale=1.0;float dilute_border_scale=1.0;float symmetric_outset=0.0;
1584#ifdef VARIABLE_LINE_WIDTH
1585float left_width=a_z_offset_width.y;float right_width=a_z_offset_width.z;halfwidth=u_width_scale*(left ? left_width : right_width);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*=apply;}offset=border_width > 0.0 ? (left_width+right_width)*u_width_scale : 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;symmetric_outset=zero_right_width ? u_width_scale*left_width : halfwidth;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;
1586#else
1587halfwidth=(u_width_scale*width)/2.0;
1588#endif
1589float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth > 0.0 ? ANTIALIASING : 0.0);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;
1589vec4 projected_extrude=u_matrix*vec4(extrude,0.0,0.0);vec2 projected_extrude_xy=projected_extrude.xy;
1590#ifdef ELEVATED_ROADS
1591v_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);
1592#else
1593#ifdef ELEVATED
1594vec2 offsetTile=offset2*u_pixels_to_tile_units;vec2 offset_pos=pos+offsetTile;float ele=0.0;float scaled_z_offset=a_z_offset;
1595#ifdef ELEVATION_GROUND_SCALE
1596scaled_z_offset=a_z_offset*mix(1.0,u_exaggeration,a_elevation_ground_scale);
1597#endif
1598#ifdef CROSS_SLOPE_VERTICAL
1599float 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);
1600#else
1601#ifdef CROSS_SLOPE_HORIZONTAL
1602float 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;
1603#else
1604float 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;
1605#endif
1606#endif
1607v_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);
1608#else
1609v_tile_pos=pos+offset2*u_pixels_to_tile_units;gl_Position=u_matrix*vec4(v_tile_pos,0.0,1.0);
1610#endif
1611#endif
1612#ifndef ELEVATED
1613#ifndef VARIABLE_LINE_WIDTH
1614#ifndef RENDER_TO_TEXTURE
1615float 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
1616{
1617#ifdef RENDER_LINE_BORDER
1618float 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);
1619#endif
1620}}
1621#endif
1622#endif
1623v_tile_pos=(v_tile_pos+extrude)/EXTENT;
1624#ifdef ELEVATED_ROADS
1625gl_Position=gl_Position+projected_extrude;
1626#else
1627gl_Position=mix(gl_Position+projected_extrude,AWAY,hidden);
1628#endif
1629#endif
1630#ifdef ELEVATED_ROADS
1631#ifdef RENDER_SHADOWS
1632vec3 shd_pos=vec3(pos+(offset2+dist)*u_pixels_to_tile_units,a_z_offset);vec3 shd_pos0=shd_pos;vec3 shd_pos1=shd_pos;
1633#ifdef NORMAL_OFFSET
1634vec3 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();
1635#endif
1636v_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;
1637#endif
1638#endif
1639#ifndef RENDER_TO_TEXTURE
1640float 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));
1641#else
1642v_gamma_scale=1.0;
1643#endif
1644#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)
1645highp float a_uv_x=a_packed[0];float a_split_index=a_packed[1];
1646#ifdef RENDER_LINE_GRADIENT
1647highp 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);
1648#else
1649v_uv=vec3(a_uv_x,0.0,line_progress);
1650#endif
1651#endif
1652#ifdef RENDER_LINE_DASH
1653vec4 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);
1654#endif
1655v_width2_dilute=vec4(outset,inset,dilute_scale,dilute_border_scale);
1656#ifdef VARIABLE_LINE_WIDTH
1657v_width2_dilute.x=symmetric_outset;
1658#endif
1659#ifdef FOG
1660v_fog_pos=fog_position(pos);
1661#endif
1662#ifdef INDICATOR_CUTOUT
1663v_z_offset=a_z_offset;
1664#endif
1665}
1665`),linePattern:Dt(`#include "_prelude_fog.fragment.glsl"
1666#include "_prelude_lighting.glsl"
1667#include "_prelude_shadow.fragment.glsl"
1668uniform highp float u_device_pixel_ratio;uniform highp float u_width_scale;uniform highp float u_alpha_discard_threshold;uniform lowp float u_opacity_multiplier;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;
1669#ifdef APPLY_LUT_ON_GPU
1670uniform highp sampler3D u_lutTexture;
1671#endif
1672#ifdef LINE_PATTERN_TRANSITION
1673uniform float u_pattern_transition;
1674#endif
1675in vec2 v_normal;in vec2 v_width2;in highp float v_linesofar;in float v_gamma_scale;in float v_width;
1676#ifdef RENDER_LINE_TRIM_OFFSET
1677in highp vec3 v_uv;
1678#endif
1679#ifdef ELEVATED_ROADS
1680in highp float v_road_z_offset;
1681#endif
1682#ifdef LINE_JOIN_NONE
1683in vec2 v_pattern_data;
1684#endif
1685#ifdef INDICATOR_CUTOUT
1686in highp float v_z_offset;
1687#endif
1688#ifdef RENDER_SHADOWS
1689uniform 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;
1690#endif
1691#pragma mapbox: define mediump uvec4 pattern
1692#ifdef LINE_PATTERN_TRANSITION
1693#pragma mapbox: define mediump uvec4 pattern_b
1694#endif
1695#pragma mapbox: define mediump float pixel_ratio
1696#pragma mapbox: define mediump float blur
1697#pragma mapbox: define mediump float opacity
1698#pragma mapbox: define lowp float emissive_strength
1699void main() {
1700#pragma mapbox: initialize mediump uvec4 pattern
1701#ifdef LINE_PATTERN_TRANSITION
1702#pragma mapbox: initialize mediump uvec4 pattern_b
1703#endif
1704#pragma mapbox: initialize mediump float pixel_ratio
1705#pragma mapbox: initialize mediump float blur
1706#pragma mapbox: initialize mediump float opacity
1707#pragma mapbox: initialize lowp float emissive_strength
1708vec2 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);
1709#ifdef APPLY_LUT_ON_GPU
1710color=applyLUT(u_lutTexture,color);
1711#endif
1712#ifdef LINE_PATTERN_TRANSITION
1713vec2 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;
1714#endif
1715#ifdef RENDER_LINE_TRIM_OFFSET
1716highp 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);}
1717#endif
1718#ifdef LINE_JOIN_NONE
1719highp 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);}
1720#endif
1721#ifdef LIGHTING_3D_MODE
1722color=apply_lighting_with_emission_ground(color,emissive_strength);
1723#ifdef RENDER_SHADOWS
1724float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);
1725#ifdef ELEVATED_ROADS
1726color.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light);
1727#else
1728color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);
1729#endif
1730#endif
1731#endif
1732#ifdef FOG
1733color=fog_dither(fog_apply_premultiplied(color,v_fog_pos));
1734#endif
1735color*=(alpha*opacity*u_opacity_multiplier);if (u_alpha_discard_threshold !=0.0) {if (color.a < u_alpha_discard_threshold) {discard;}}
1736#ifdef INDICATOR_CUTOUT
1737color=applyCutout(color,v_z_offset);
1738#endif
1739glFragColor=color;
1740#ifdef DUAL_SOURCE_BLENDING
1741glFragColorSrc1=vec4(vec3(0.0),emissive_strength);
1742#else
1743#ifdef USE_MRT1
1744out_Target1=vec4(emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);
1745#endif
1746#endif
1747#ifdef OVERDRAW_INSPECTOR
1748glFragColor=vec4(1.0);
1749#endif
1750HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
1751#include "_prelude_shadow.vertex.glsl"
1752#include "_prelude_terrain.vertex.glsl"
1753#define scale 0.015873016
1754in ivec2 a_pos_normal;in uvec4 a_data;
1755#if defined(ELEVATED) || defined(ELEVATED_ROADS)
1756in vec4 a_z_offset_width;
1757#endif
1758#ifdef ELEVATION_GROUND_SCALE
1759in float a_elevation_ground_scale;
1760#endif
1761#ifdef RENDER_LINE_TRIM_OFFSET
1762in highp vec3 a_packed;
1763#endif
1764in highp float a_linesofar;
1765#ifdef LINE_JOIN_NONE
1766in highp vec3 a_pattern_data;out vec2 v_pattern_data;
1767#endif
1768#ifdef INDICATOR_CUTOUT
1769out highp float v_z_offset;
1770#endif
1771uniform 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;
1772#ifdef ELEVATED
1773uniform lowp float u_zbias_factor;uniform lowp float u_tile_to_meter;float sample_elevation(vec2 apos) {
1774#ifdef ELEVATION_REFERENCE_SEA
1775return 0.0;
1776#else
1777return elevation(apos);
1778#endif
1779}
1780#endif
1781out vec2 v_normal;out vec2 v_width2;out highp float v_linesofar;out float v_gamma_scale;out float v_width;
1782#ifdef RENDER_LINE_TRIM_OFFSET
1783out highp vec3 v_uv;
1784#endif
1785#ifdef ELEVATED_ROADS
1786out highp float v_road_z_offset;
1787#endif
1788#ifdef RENDER_SHADOWS
1789uniform 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;
1790#endif
1791#pragma mapbox: define mediump float blur
1792#pragma mapbox: define mediump float opacity
1793#pragma mapbox: define mediump float offset
1794#pragma mapbox: define mediump float gapwidth
1795#pragma mapbox: define mediump float width
1796#pragma mapbox: define mediump float floorwidth
1797#pragma mapbox: define mediump uvec4 pattern
1798#ifdef LINE_PATTERN_TRANSITION
1799#pragma mapbox: define mediump uvec4 pattern_b
1800#endif
1801#pragma mapbox: define mediump float pixel_ratio
1802#pragma mapbox: define lowp float emissive_strength
1803void main() {
1804#pragma mapbox: initialize mediump float blur
1805#pragma mapbox: initialize mediump float opacity
1806#pragma mapbox: initialize mediump float offset
1807#pragma mapbox: initialize mediump float gapwidth
1808#pragma mapbox: initialize mediump float width
1809#pragma mapbox: initialize mediump float floorwidth
1810#pragma mapbox: initialize mediump uvec4 pattern
1811#ifdef LINE_PATTERN_TRANSITION
1812#pragma mapbox: initialize mediump uvec4 pattern_b
1813#endif
1814#pragma mapbox: initialize mediump float pixel_ratio
1815#pragma mapbox: initialize lowp float emissive_strength
1816float a_z_offset;
1817#if defined(ELEVATED) || defined(ELEVATED_ROADS)
1818a_z_offset=a_z_offset_width.x;
1819#endif
1820float 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;
1820vec4 projected_extrude=u_matrix*vec4(extrude,0.0,0.0);vec2 projected_extrude_xy=projected_extrude.xy;
1821#ifdef ELEVATED_ROADS
1822v_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;
1823#else
1824#ifdef ELEVATED
1825vec2 offsetTile=offset2*u_pixels_to_tile_units;vec2 offset_pos=pos+offsetTile;float ele=0.0;float scaled_z_offset=a_z_offset;
1826#ifdef ELEVATION_GROUND_SCALE
1827scaled_z_offset=a_z_offset*mix(1.0,u_exaggeration,a_elevation_ground_scale);
1828#endif
1829#ifdef CROSS_SLOPE_VERTICAL
1830float 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);
1831#else
1832#ifdef CROSS_SLOPE_HORIZONTAL
1833float 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;
1834#else
1835float 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;
1836#endif
1837#endif
1838gl_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);
1839#else
1840gl_Position=mix(u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude,AWAY,hidden);
1841#endif
1842#endif
1843#ifdef ELEVATED_ROADS
1844#ifdef RENDER_SHADOWS
1845vec3 shd_pos=vec3(pos+(offset2+dist)*u_pixels_to_tile_units,a_z_offset);vec3 shd_pos0=shd_pos;vec3 shd_pos1=shd_pos;
1846#ifdef NORMAL_OFFSET
1847vec3 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();
1848#endif
1849v_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;
1850#endif
1851#endif
1852#ifndef RENDER_TO_TEXTURE
1853float 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));
1854#else
1855v_gamma_scale=1.0;
1856#endif
1857#ifdef RENDER_LINE_TRIM_OFFSET
1858highp float a_uv_x=a_packed[0];highp float line_progress=a_packed[2];v_uv=vec3(a_uv_x,0.0,line_progress);
1859#endif
1860v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=(floorwidth*u_floor_width_scale);
1861#ifdef LINE_JOIN_NONE
1862v_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);
1863#endif
1864#ifdef FOG
1865v_fog_pos=fog_position(pos);
1866#endif
1867#ifdef INDICATOR_CUTOUT
1868v_z_offset=a_z_offset;
1869#endif
1870}`),raster:Dt(`#include "_prelude_fog.fragment.glsl"
1871#include "_prelude_lighting.glsl"
1872#include "_prelude_raster_array.glsl"
1873uniform 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;
1874#ifdef PROJECTION_GLOBE_VIEW
1875in float v_split_fade;
1876#endif
1877uniform 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;
1878#ifndef RASTER_ARRAY
1879uniform highp sampler2D u_image0;uniform sampler2D u_image1;
1880#endif
1881#ifdef RASTER_COLOR
1882uniform sampler2D u_color_ramp;uniform highp vec4 u_colorization_mix;uniform highp float u_colorization_offset;uniform vec2 u_texture_res;
1883#endif
1884void main() {vec4 color0,color1,color;vec2 value;
1885#ifdef RASTER_COLOR
1886#ifdef RASTER_ARRAY
1887#ifdef RASTER_ARRAY_LINEAR
1888value=mix(
1889raTexture2D_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
1890);
1891#else
1892value=mix(
1893raTexture2D_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
1894);
1895#endif
1896if (value.y > 0.0) value.x/=value.y;
1897#else
1898color=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);
1899#endif
1900color=texture(u_color_ramp,vec2(value.x,0.5));if (color.a > 0.0) color.rgb/=color.a;color.a*=value.y;
1901#else
1902color0=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);
1903#endif
1904color.a*=u_opacity;
1905#ifdef GLOBE_POLES
1906color.a*=1.0-smoothstep(0.0,0.05,u_zoom_transition);
1907#endif
1908vec3 rgb=color.rgb;rgb=vec3(
1909dot(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);
1910#ifdef LIGHTING_3D_MODE
1911out_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),u_emissive_strength).rgb;
1912#endif
1913#ifdef FOG
1914highp 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));
1915#endif
1916glFragColor=vec4(out_color*color.a,color.a);
1917#ifdef PROJECTION_GLOBE_VIEW
1918glFragColor*=mix(1.0,1.0-smoothstep(0.0,0.05,u_zoom_transition),smoothstep(0.8,0.9,v_split_fade));
1919#endif
1920#ifdef RENDER_CUTOFF
1921glFragColor=glFragColor*cutoff_opacity(u_cutoff_params,v_depth);
1922#endif
1923#ifdef OVERDRAW_INSPECTOR
1924glFragColor=vec4(1.0);
1925#endif
1926#ifdef USE_MRT1
1927out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);
1928#endif
1929HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
1930#include "_prelude_terrain.vertex.glsl"
1931uniform 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;
1932#ifdef ELEVATED
1933uniform lowp float u_zbias_factor;
1934#endif
1935#define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8
1936#ifdef GLOBE_POLES
1937in vec3 a_globe_pos;in vec2 a_uv;
1938#else
1939in ivec2 a_pos;in uvec2 a_texture_pos;
1940#endif
1941out vec2 v_pos0;out vec2 v_pos1;out float v_depth;
1942#ifdef PROJECTION_GLOBE_VIEW
1943out float v_split_fade;
1944#endif
1945void main() {vec2 uv;
1946#ifdef GLOBE_POLES
1947vec3 globe_pos=a_globe_pos;uv=a_uv;float ele=u_raster_elevation;
1948#ifdef ELEVATION_REFERENCE_GROUND
1949ele+=elevation(uv*EXTENT);
1950#endif
1951globe_pos+=normalize(globe_pos)*ele*GLOBE_UPSCALE;gl_Position=u_matrix*u_globe_matrix*vec4(globe_pos,1.0);
1952#ifdef FOG
1953v_fog_pos=fog_position((u_normalize_matrix*vec4(a_globe_pos,1.0)).xyz);
1954#endif
1955#else
1956vec4 world_pos;
1957#ifdef PROJECTION_GLOBE_VIEW
1958vec2 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]);  
1959float tiles=u_grid_matrix[0][2];
1959if (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;
1960#ifdef ELEVATION_REFERENCE_GROUND
1961ele+=elevation(uv*EXTENT)-decomposed_pos_and_skirt.z;
1962#endif
1963vec4 merc_world_pos=vec4(0.0);   
1964v_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);
1965#ifdef FOG
1966v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);
1967#endif
1968#else
1969float ele=0.0;vec2 decodedPos=vec2(a_pos);
1970#ifdef ELEVATION_REFERENCE_GROUND
1971vec3 decomposedPosAndSkirt=decomposeToPosAndSkirt(a_pos);float skirt=decomposedPosAndSkirt.z;decodedPos=decomposedPosAndSkirt.xy;uv=decodedPos/8192.0;ele=elevation(decodedPos)-skirt;
1972#else
1973uv=vec2(a_texture_pos)/8192.0;
1974#endif
1975world_pos=vec4(decodedPos,(u_raster_elevation+ele),1.0);
1976#ifdef FOG
1977v_fog_pos=fog_position(decodedPos);
1978#endif
1979#endif
1980float w=1.0+dot(uv*EXTENT,u_perspective_transform);gl_Position=u_matrix*world_pos*w;
1981#endif
1982v_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;
1983#ifdef ELEVATED
1984float 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);
1985#endif
1986#ifdef RENDER_CUTOFF
1987v_depth=gl_Position.z;
1988#endif
1989}`),symbol:Dt(`#include "_prelude_lighting.glsl"
1990#include "_prelude_shadow.fragment.glsl"
1991#define SDF_PX 8.0
1992#define SDF 1.0
1993#define ICON 0.0
1994uniform sampler2D u_texture;
1995#ifdef RENDER_TEXT_AND_SYMBOL
1996uniform sampler2D u_texture_icon;
1997#endif
1998uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;uniform bool u_is_sdf;uniform lowp float u_scale_factor;uniform lowp float u_opacity_multiplier;
1999#ifdef ICON_TRANSITION
2000uniform float u_icon_transition;
2001#endif
2002#ifdef COLOR_ADJUSTMENT
2003uniform mat4 u_color_adj_mat;
2004#endif
2005#ifdef INDICATOR_CUTOUT
2006in highp float v_z_offset;
2007#else
2008#ifdef RENDER_SHADOWS
2009in highp float v_z_offset;
2010#endif
2011#endif
2012in vec2 v_tex_a;
2013#ifdef ICON_TRANSITION
2014in vec2 v_tex_b;
2015#endif
2016in float v_draw_halo;in vec3 v_gamma_scale_size_fade_opacity;
2017#ifdef RENDER_TEXT_AND_SYMBOL
2018in float is_sdf;in vec2 v_tex_a_icon;
2019#endif
2020#ifdef RENDER_SHADOWS
2021uniform 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;
2022#endif
2023#ifdef APPLY_LUT_ON_GPU
2024uniform highp sampler3D u_lutTexture;
2025#endif
2026in lowp float v_opacity;in 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;
2027#ifdef LIGHTING_3D_MODE
2028in lowp float v_emissive_strength;
2029#endif
2030void main() {lowp 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;if (u_is_sdf) {fill_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;}lowp float emissive_strength=0.0;
2031#ifdef LIGHTING_3D_MODE
2032emissive_strength=v_emissive_strength;
2033#endif
2034vec4 out_color;float fade_opacity=v_gamma_scale_size_fade_opacity[2];
2035#ifdef RENDER_TEXT_AND_SYMBOL
2036if (is_sdf==ICON) {vec2 tex_icon=v_tex_a_icon;lowp float alpha=opacity*fade_opacity*u_opacity_multiplier;
2036glFragColor=texture(u_texture_icon,tex_icon)*alpha;
2037#ifdef OVERDRAW_INSPECTOR
2038glFragColor=vec4(1.0);
2039#endif
2040return;}
2041#endif
2042vec2 cutout_factors=vec2(0.0);
2043#ifdef FEATURE_CUTOUT
2044cutout_factors=get_cutout_factors(gl_FragCoord);
2045#endif
2046if (u_is_sdf) {float 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;} else {
2047#ifdef ICON_TRANSITION
2048vec4 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);
2049#else
2050out_color=texture(u_texture,v_tex_a);
2051#endif
2052#ifdef APPLY_LUT_ON_GPU
2053out_color=applyLUT(u_lutTexture,out_color);
2054#endif
2055#ifdef COLOR_ADJUSTMENT
2056out_color=u_color_adj_mat*out_color;
2057#endif
2058}out_color*=opacity*fade_opacity*u_opacity_multiplier;
2059#ifdef LIGHTING_3D_MODE
2060out_color=apply_lighting_with_emission_ground(out_color,emissive_strength);
2061#ifdef RENDER_SHADOWS
2062float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);light=mix(light,1.0,cutout_factors.y);
2063#ifdef TERRAIN
2064out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);
2065#else
2066out_color.rgb*=mix(v_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light);
2067#endif
2068#endif
2069#endif
2070#ifdef INDICATOR_CUTOUT
2071out_color=applyCutout(out_color,v_z_offset);
2072#endif
2073#ifdef FEATURE_CUTOUT
2074out_color=apply_feature_cutout(out_color,gl_FragCoord,cutout_factors.x,0.0);
2075#endif
2076glFragColor=out_color;
2077#ifdef OVERDRAW_INSPECTOR
2078glFragColor=vec4(1.0);
2079#endif
2080HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_terrain.vertex.glsl"
2081#include "_prelude_shadow.vertex.glsl"
2082#define USING_APPEARANCE 1.0
2083in ivec4 a_pos_offset;in uvec4 a_tex_size;in ivec4 a_pixeloffset;in vec4 a_projected_pos;in uint a_fade_opacity;
2084#ifdef Z_OFFSET
2085in float a_auto_z_offset;
2086#endif
2087#ifdef PROJECTION_GLOBE_VIEW
2088in ivec4 a_globe_anchor;in vec3 a_globe_normal;
2089#endif
2090#ifdef ICON_TRANSITION
2091in uvec2 a_texb;
2092#endif
2093#ifdef OCCLUSION_QUERIES
2094in float a_occlusion_query_opacity;
2095#endif
2096#ifdef ELEVATED_ROADS
2097in vec3 a_x_axis;in vec3 a_y_axis;uniform float u_normal_scale;
2098#endif
2099#ifdef INDICATOR_CUTOUT
2100out highp float v_z_offset;
2101#else
2102#ifdef RENDER_SHADOWS
2103out highp float v_z_offset;
2104#endif
2105#endif
2106uniform 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;
2107#ifdef RENDER_SHADOWS
2108uniform mat4 u_inv_matrix;
2109#endif
2110uniform 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;
2111#ifdef PROJECTION_GLOBE_VIEW
2112uniform vec3 u_up_vector;
2113#endif
2114#ifdef RENDER_TEXT_AND_SYMBOL
2115uniform vec2 u_texsize_icon;
2116#endif
2117uniform bool u_is_halo;
2118#ifdef PROJECTION_GLOBE_VIEW
2119uniform 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;
2120#endif
2121out vec2 v_tex_a;
2122#ifdef ICON_TRANSITION
2123out vec2 v_tex_b;
2124#endif
2125out float v_draw_halo;out vec3 v_gamma_scale_size_fade_opacity;
2126#ifdef RENDER_TEXT_AND_SYMBOL
2127out float is_sdf;out vec2 v_tex_a_icon;
2128#endif
2129#ifdef RENDER_SHADOWS
2130uniform 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;
2131#endif
2132#ifndef MAX_UBO_SIZE_VEC4
2133#define MAX_UBO_SIZE_VEC4 1024u
2134#endif
2135#define SPP_HEADER_SIZE_VEC4 3u
2136#define DWORDS_PER_VEC4 4u
2137struct 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;float zoomFactor;bool hasAppearanceZoomStops;};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 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;uniform highp float u_spp_fill_color_zoom_factor;uniform highp float u_spp_halo_color_zoom_factor;uniform highp float u_spp_opacity_zoom_factor;uniform highp float u_spp_halo_width_zoom_factor;uniform highp float u_spp_halo_blur_zoom_factor;uniform highp float u_spp_emissive_strength_zoom_factor;uniform highp float u_spp_occlusion_opacity_zoom_factor;uniform highp float u_spp_z_offset_zoom_factor;uniform highp float u_spp_translate_zoom_factor;uniform highp float u_spp_zoom_fraction;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;out 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;
2138#ifdef LIGHTING_3D_MODE
2139out lowp float v_emissive_strength;
2140#endif
2141PropertyType getPropertyType(uint propertyIndex,uint dataDrivenMask,uint zoomDependentMask,uint appearanceZoomStopsMask,uint offsetDwords,float zoomFactor) {PropertyType type;type.isDataDriven=(dataDrivenMask & (1u << propertyIndex)) !=0u;type.isZoomDependent=(zoomDependentMask & (1u << propertyIndex)) !=0u;type.offsetDwords=offsetDwords;type.zoomFactor=zoomFactor;type.hasAppearanceZoomStops=(appearanceZoomStopsMask & (1u << propertyIndex)) !=0u;return type;}SymbolPropertyHeader readSymbolPropertiesHeader() {SymbolPropertyHeader header;uint dataDrivenMask           =u_spp_header.header[0][0];uint zoomMask                 =u_spp_header.header[0][1];uint zoomDependentMask        =zoomMask & 0xFFFFu;uint appearanceZoomStopsMask  =zoomMask >> 16u;header.dataDrivenBlockSizeVec4=u_spp_header.header[0][2];header.fill_np_color    =getPropertyType(0u,dataDrivenMask,zoomDependentMask,appearanceZoomStopsMask,u_spp_header.header[0][3],u_spp_fill_color_zoom_factor);header.halo_np_color    =getPropertyType(1u,dataDrivenMask,zoomDependentMask,appearanceZoomStopsMask,u_spp_header.header[1][0],u_spp_halo_color_zoom_factor);header.opacity          =getPropertyType(2u,dataDrivenMask,zoomDependentMask,appearanceZoomStopsMask,u_spp_header.header[1][1],u_spp_opacity_zoom_factor);header.halo_width       =getPropertyType(3u,dataDrivenMask,zoomDependentMask,appearanceZoomStopsMask,u_spp_header.header[1][2],u_spp_halo_width_zoom_factor);header.halo_blur        =getPropertyType(4u,dataDrivenMask,zoomDependentMask,appearanceZoomStopsMask,u_spp_header.header[1][3],u_spp_halo_blur_zoom_factor);header.emissive_strength=getPropertyType(5u,dataDrivenMask,zoomDependentMask,appearanceZoomStopsMask,u_spp_header.header[2][0],u_spp_emissive_strength_zoom_factor);header.occlusion_opacity=getPropertyType(6u,dataDrivenMask,zoomDependentMask,appearanceZoomStopsMask,u_spp_header.header[2][1],u_spp_occlusion_opacity_zoom_factor);header.z_offset         =getPropertyType(7u,dataDrivenMask,zoomDependentMask,appearanceZoomStopsMask,u_spp_header.header[2][2],u_spp_z_offset_zoom_factor);header.translate        =getPropertyType(8u,dataDrivenMask,zoomDependentMask,appearanceZoomStopsMask,u_spp_header.header[2][3],u_spp_translate_zoom_factor);return header;}float appearanceZoomStopsFactor(float zm,float zM) {if (zm==zM) {return u_spp_zoom_fraction >=zm ? 1.0 : 0.0;}return clamp((u_spp_zoom_fraction-zm)/(zM-zm),0.0,1.0);}uint uvec4At(uvec4 v,uint index) {return (index==0u) ? v.x :
2142(index==1u) ? v.y :
2143(index==2u) ? v.z : v.w;}float vec4At(vec4 v,uint index) {return (index==0u) ? v.x :
2144(index==1u) ? v.y :
2145(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 vec4At(slot,propertyOffsetDwords % DWORDS_PER_VEC4);}uint readUint(uvec4 slot,uint offset) {return uvec4At(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) {float t=propertyType.zoomFactor;if (propertyType.hasAppearanceZoomStops) {vec4 zoomRange=readVec4(blockOffsetVec4,propertyType.offsetDwords+4u);t=appearanceZoomStopsFactor(zoomRange.x,zoomRange.y);}color=unpack_mix_color(color,t);} 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) {float t=propertyType.zoomFactor;if (propertyType.hasAppearanceZoomStops) {vec4 zoomRange=readVec4(blockOffsetVec4,propertyType.offsetDwords+4u);t=appearanceZoomStopsFactor(zoomRange.x,zoomRange.y);}return mix(slot.xy,slot.zw,t);}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);float t=propertyType.hasAppearanceZoomStops
2146? appearanceZoomStopsFactor(readFloat(slot,propertyType.offsetDwords+2u),readFloat(slot,propertyType.offsetDwords+3u))
2147: propertyType.zoomFactor;value=unpack_mix_vec2(packedValues,t);} 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;}vec2 unpack_opacity(uint packedOpacity) {return vec2(float(packedOpacity/2u)/127.0,float(packedOpacity & 1u));}void main() {SymbolPaintProperties paint_properties=readSymbolPaintProperties();lowp float opacity=paint_properties.opacity;v_opacity=opacity;v_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;
2148#ifdef LIGHTING_3D_MODE
2149v_emissive_strength=paint_properties.emissive_strength;
2150#endif
2151lowp float occlusion_opacity=paint_properties.occlusion_opacity;highp float z_offset=paint_properties.z_offset;vec2 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);
2152#ifdef Z_OFFSET
2153e+=a_auto_z_offset;
2154#endif
2155vec3 h=elevationVector(tile_anchor)*e;float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;vec3 world_pos_globe;
2156#ifdef PROJECTION_GLOBE_VIEW
2157mercator_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;
2158#else
2159world_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0;
2160#endif
2161vec4 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 ?
2162camera_to_anchor_distance/u_camera_to_center_distance :
2163u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(
21640.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;
2165#ifdef PROJECTION_GLOBE_VIEW
2166vec3 displacement=vec3(a_globe_normal.z,0,-a_globe_normal.x);
2166offsetprojected_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;
2167#else
2168offsetprojected_point=u_matrix*vec4(tile_anchor+vec2(1,0),0,1);a=projected_point.xy/projected_point.w;
2169#endif
2170vec2 b=offsetprojected_point.xy/offsetprojected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos;
2171#ifdef PROJECTION_GLOBE_VIEW
2172#ifdef PROJECTED_POS_ON_VIEWPORT
2173projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xyz+h,1.0);
2174#else
2175vec3 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);    
2176#endif
2177#else
2178projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0);
2179#endif
2180highp 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);
2181#ifdef TERRAIN
2182#ifdef PITCH_WITH_MAP_TERRAIN
2183vec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);
2184#endif
2185#endif
2186#ifdef Z_OFFSET
2187z+=u_pitch_with_map ? a_auto_z_offset+z_offset : 0.0;
2188#else
2189z+=u_pitch_with_map ? z_offset : 0.0;
2190#endif
2191float 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));
2192#ifdef DEPTH_OCCLUSION
2193float depth_occlusion=occlusionFadeMultiSample(projected_point);float depth_occlusion_multplier=mix(occlusion_opacity,1.0,depth_occlusion);out_fade_opacity*=depth_occlusion_multplier;
2194#endif
2195#ifdef OCCLUSION_QUERIES
2196float occludedFadeMultiplier=mix(occlusion_opacity,1.0,a_occlusion_query_opacity);out_fade_opacity*=occludedFadeMultiplier;
2197#endif
2198#ifdef Z_TEST_OCCLUSION
2199out_fade_opacity*=occlusion_opacity;
2200#endif
2201float alpha=opacity*out_fade_opacity;float hidden=float(alpha==0.0 || projected_point.w <=0.0 || occlusion_fade==0.0);vec3 pos;
2202#ifdef PROJECTION_GLOBE_VIEW
2203vec3 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;
2204#else
2205#ifdef ELEVATED_ROADS
2206vec3 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;
2207#else
2208pos=vec3(projected_pos.xy/projected_pos.w+offset,z);
2209#endif
2210#endif
2211gl_Position=mix(u_coord_matrix*vec4(pos,1.0),AWAY,hidden);{vec2 tr=paint_properties.translate;vec2 rotated_tr=vec2(
2212u_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
2213);gl_Position.xy+=(u_coord_matrix*vec4(rotated_tr,0.0,0.0)).xy;}float 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;
2214#ifdef RENDER_TEXT_AND_SYMBOL
2215is_sdf=a_size[0]-2.0*a_size_min;v_tex_a_icon=a_tex/u_texsize_icon;
2216#endif
2217#ifdef ICON_TRANSITION
2218v_tex_b=vec2(a_texb)/u_texsize;
2219#endif
2220#ifdef RENDER_SHADOWS
2221vec4 shd_pos=u_inv_matrix*vec4(pos,1.0);vec3 shd_pos0=shd_pos.xyz;vec3 shd_pos1=shd_pos.xyz;
2222#ifdef NORMAL_OFFSET
2223vec3 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();
2224#endif
2225v_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;
2226#endif
2227#ifdef INDICATOR_CUTOUT
2228v_z_offset=e;
2229#else
2230#ifdef RENDER_SHADOWS
2231v_z_offset=e;
2232#endif
2233#endif
2234}`),terrainRaster:Dt(`#include "_prelude_fog.fragment.glsl"
2235#include "_prelude_shadow.fragment.glsl"
2236#include "_prelude_lighting.glsl"
2237uniform sampler2D u_image0;
2238#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS
2239uniform sampler2D u_image1;uniform float u_emissive_texture_available;
2240#endif
2241in vec2 v_pos0;
2242#ifdef FOG
2243in float v_fog_opacity;
2244#endif
2245#ifdef RENDER_SHADOWS
2246in vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1;
2247#endif
2248uniform vec3 u_ground_shadow_factor;void main() {vec4 image_color=texture(u_image0,v_pos0);vec4 color;
2249#ifdef LIGHTING_3D_MODE
2250const vec3 normal=vec3(0.0,0.0,1.0);
2251#ifdef RENDER_SHADOWS
2252float cutoffOpacity=1.0;
2253#ifdef RENDER_CUTOFF
2254cutoffOpacity=cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w);
2255#endif
2256#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS
2257float 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;
2258#else
2259float 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));
2260#endif
2261#else
2262float lighting_factor=u_lighting_directional_dir.z;color=apply_lighting(image_color,normal,lighting_factor);
2263#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS
2264float 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;
2265#endif
2266#endif
2267#else
2268color=image_color;
2269#endif
2270#ifdef FOG
2271#ifdef ZERO_EXAGGERATION
2272color=fog_dither(fog_apply_premultiplied(color,v_fog_pos));
2273#else
2274color=fog_dither(fog_apply_from_vert(color,v_fog_opacity));
2275#endif
2276#endif
2277glFragColor=color;
2278#ifdef OVERDRAW_INSPECTOR
2279glFragColor=vec4(1.0);
2280#endif
2281HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
2282#include "_prelude_terrain.vertex.glsl"
2283uniform mat4 u_matrix;uniform float u_skirt_height;in ivec2 a_pos;out vec2 v_pos0;
2284#ifdef FOG
2285out float v_fog_opacity;
2286#endif
2287#ifdef RENDER_SHADOWS
2288uniform 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;
2289#endif
2290void 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);
2291#ifdef FOG
2292#ifdef ZERO_EXAGGERATION
2293v_fog_pos=fog_position(decodedPos);
2294#else
2295v_fog_opacity=fog(fog_position(vec3(decodedPos,elevation)));
2296#endif
2297#endif
2298#ifdef RENDER_SHADOWS
2299vec3 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.);
2300#endif
2301}`),terrainDepth:Dt("precision highp float;in float v_depth;void main() {glFragColor=pack_depth(v_depth);}",`#include "_prelude_terrain.vertex.glsl"
2302uniform 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:Dt(`#include "_prelude_fog.fragment.glsl"
2303in 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(
2304cos_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
2304nd-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;
2305#ifdef FOG
2306sky_color=fog_apply_sky_gradient(v_uv.xzy,sky_color);
2307#endif
2308sky_color+=0.1*sun_disk(v_uv,u_sun_direction);glFragColor=vec4(sky_color*u_opacity,u_opacity);
2309#ifdef OVERDRAW_INSPECTOR
2310glFragColor=vec4(1.0);
2311#endif
2312}`,rm),skyboxGradient:Dt(`#include "_prelude_fog.fragment.glsl"
2313in 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));
2314#ifdef FOG
2315color.rgb=fog_apply_sky_gradient(v_uv.xzy,color.rgb/color.a)*color.a;
2316#endif
2317color*=u_opacity;glFragColor=color;
2318#ifdef OVERDRAW_INSPECTOR
2319glFragColor=vec4(1.0);
2320#endif
2321}`,rm),skyboxCapture:Dt
vendor: 3,792 bytes, lines 2321-2332
2321(`
2322in 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;
2323#define BETA_R                  vec3(5.5e-6,13.0e-6,22.4e-6)
2324#define BETA_M                  vec3(21e-6,21e-6,21e-6)
2325#define MIE_G                   0.76
2326#define DENSITY_HEIGHT_SCALE_R  8000.0
2327#define DENSITY_HEIGHT_SCALE_M  1200.0
2328#define PLANET_RADIUS           6360e3
2329#define ATMOSPHERE_RADIUS       6420e3
2330#define SAMPLE_STEPS            10
2331#define DENSITY_STEPS           4
2332float 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
2332Raster:Dt(`#include "_prelude_fog.fragment.glsl"
2333#include "_prelude_lighting.glsl"
2334uniform sampler2D u_image0;
2335#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS
2336uniform sampler2D u_image1;uniform float u_emissive_texture_available;
2337#endif
2338uniform float u_far_z_cutoff;in vec2 v_pos0;
2339#ifndef FOG
2340uniform 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;
2341#endif
2342void main() {vec4 color;
2343#ifdef CUSTOM_ANTIALIASING
2344highp vec2 uv=gl_FragCoord.xy/u_viewport;
2345#ifdef FLIP_Y
2346uv.y=1.0-uv.y;
2347#endif
2348highp vec3 ray_dir=mix(
2349mix(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);
2350#ifdef LIGHTING_3D_MODE
2351#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS
2352float 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);
2353#else
2354raster=apply_lighting_ground(raster);color=vec4(raster.rgb*antialias,raster.a*antialias);
2355#endif
2356#else
2357color=vec4(raster.rgb*antialias,raster.a*antialias);
2358#endif
2359#else
2360color=texture(u_image0,v_pos0);
2361#ifdef LIGHTING_3D_MODE
2362#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS
2363float 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;
2364#else
2365color=apply_lighting_ground(color);
2366#endif
2367#endif
2368#endif
2369#ifdef FOG
2370color=fog_dither(fog_apply_premultiplied(color,v_fog_pos));
2371#endif
2372color*=1.0-step(u_far_z_cutoff,1.0/gl_FragCoord.w);glFragColor=color;
2373#ifdef OVERDRAW_INSPECTOR
2374glFragColor=vec4(1.0);
2375#endif
2376HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
2377#include "_prelude_terrain.vertex.glsl"
2378uniform 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;
2379#ifdef GLOBE_POLES
2380in vec3 a_globe_pos;in vec2 a_uv;
2381#else
2382in ivec2 a_pos;
2383#endif
2384out vec2 v_pos0;void main() {
2385#ifdef GLOBE_POLES
2386vec3 globe_pos=a_globe_pos;vec2 uv=a_uv;
2387#else
2388float 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);
2389#endif
2390v_pos0=uv;vec2 tile_pos=uv*EXTENT;vec3 globe_derived_up_vector=normalize(globe_pos)*u_tile_up_scale;
2391#ifdef GLOBE_POLES
2392vec3 up_vector=globe_derived_up_vector;
2393#else
2394vec3 up_vector=elevationVector(tile_pos);
2395#endif
2396float height=elevation(tile_pos);globe_pos+=up_vector*height;
2397#ifndef GLOBE_POLES
2398globe_pos-=globe_derived_up_vector*u_skirt_height*decomposed_pos_and_skirt.z;
2399#endif
2400#ifdef GLOBE_POLES
2401vec4 interpolated_pos=u_globe_matrix*vec4(globe_pos,1.0);
2402#else
2403vec4 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);
2404#endif
2405gl_Position=u_proj_matrix*interpolated_pos;
2406#ifdef FOG
2407v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);
2408#endif
2409}`),globeAtmosphere:Dt(`#include "_prelude_fog.fragment.glsl"
2410uniform 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;
2411#ifdef PROJECTION_GLOBE_VIEW
2412globe_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) {
2413#ifdef ALPHA_PASS
2414glFragColor=vec4(0,0,0,0);return;
2415#else
2416#ifdef NATIVE
2417glFragColor=vec4(1,1,1,1);
2418#else
2419glFragColor=vec4(0,0,0,1);
2420#endif
2421return;
2422#endif
2423}
2424#endif
2425highp vec3 horizon_dir=normalize(v_horizon_dir);float horizon_angle_mercator=dir.y < horizon_dir.y ?
24260.0 : max(acos(clamp(dot(dir,horizon_dir),-1.0,1.0)),0.0);float horizon_angle;
2427#ifdef PROJECTION_GLOBE_VIEW
2428highp 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 ?
2429PI-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);
2430#else
2431horizon_angle=horizon_angle_mercator;
2432#endif
2433horizon_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;
2433vec3 color_stop_2=u_space_color.rgb;
2434#ifdef ALPHA_PASS
2435float 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);
2436#else
2437vec3 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);
2438#endif
2439}`,`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(
2440mix(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(
2441mix(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);}`),stars:Dt(`in highp vec2 v_uv;in mediump float v_intensity;float shapeCircle(in vec2 uv)
2442{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;}`,`
2443in 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:Dt("uniform vec4 u_color;void main() {glFragColor=u_color;}",`#include "_prelude_terrain.vertex.glsl"
2444in 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;
2445#ifdef TERRAIN
2446float e=elevation(world_pos.xy);world_pos.z+=e;
2447#endif
2448vec4 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 Ws(s,t){const n=s.split(`
2449`);for(let l of n){if(l=l.trimStart(),l[0]!=="#"||!l.includes("if")||l.startsWith("#endif"))continue;const d=l.match(Nu);if(d)for(const p of d)Ag.has(p)||t.add(p)}}function Rd(s){return new Set(["uint","int","uvec2","ivec2","uvec3","ivec3","uvec4","ivec4"]).has(s)}function Dt(s,t){const n=new Set,l=[],d=[];s=s.replace(Md,(m,g)=>(d.push(g),"")),t=t.replace(Md,(m,g)=>(l.push(g),""));let p=new Set(vc);Ws(s,p),Ws(t,p);for(const m of[...l,...d])Aa[m]||(Aa[m]=new Set,Ws(Ia[m],Aa[m])),p=new Set([...p,...Aa[m]]);return{fragmentSource:s=s.replace(am,(m,g,x,w,E)=>(n.add(E),g==="define"?`
2450#ifndef HAS_UNIFORM_u_${E}
2451${Rd(w)?"flat ":""}in ${x} ${w} ${E};
2452#else
2453uniform ${x} ${w} u_${E};
2454#endif
2455`:g==="initialize"?`
2456#ifdef HAS_UNIFORM_u_${E}
2457    ${x} ${w} ${E} = u_${E};
2458#endif
2459`:g==="define-attribute"?`
2460#ifdef HAS_ATTRIBUTE_a_${E}
2461    in ${x}
2461 ${w} ${E};
2462#endif
2463`:g==="initialize-attribute"?"":void 0)),vertexSource:t=t.replace(am,(m,g,x,w,E)=>{const A=`MATERIAL_ATTRIBUTE_OFFSET_${E}`,I=w==="float"?"vec2":w,M=`GET_ATTRIBUTE_${I}(a_${E}, materialInfo, ${A})`,D=E.includes("color")?"color":I;return g==="define-attribute-vertex-shader-only"?`
2464#ifdef HAS_ATTRIBUTE_a_${E}
2465in ${x} ${w} a_${E};
2466#endif
2467`:n.has(E)?g==="define"?`
2468#ifndef HAS_UNIFORM_u_${E}
2469uniform lowp float u_${E}_t;
2470    #if !defined(${A})
2471        in ${x} ${I} a_${E};
2472    #endif
2473${Rd(w)?"flat ":""}out ${x} ${w} ${E};
2474#else
2475uniform ${x} ${w} u_${E};
2476#endif
2477`:g==="initialize"?D==="vec4"||D==="uvec4"?`
2478#ifndef HAS_UNIFORM_u_${E}
2479    ${E} = a_${E};
2480#else
2481    ${x} ${w} ${E} = u_${E};
2482#endif
2483`:`
2484#if !defined(HAS_UNIFORM_u_${E})
2485    #ifdef ${A}
2486        ${E} = unpack_mix_${D}(${M}, u_${E}_t);
2487    #else
2488        ${E} = unpack_mix_${D}(a_${E}, u_${E}_t);
2489    #endif
2490#else
2491    ${x} ${w} ${E} = u_${E};
2492#endif
2493`:g==="define-attribute"?`
2494#ifdef HAS_ATTRIBUTE_a_${E}
2495    in ${x} ${w} a_${E};
2496    out ${x} ${w} ${E};
2497#endif
2498`:g==="initialize-attribute"?`
2499#ifdef HAS_ATTRIBUTE_a_${E}
2500    ${E} = a_${E};
2501#endif
2502`:void 0:g==="define"?`
2503#ifndef HAS_UNIFORM_u_${E}
2504uniform lowp float u_${E}_t;
2505    #if !defined(${A})
2506        in ${x} ${I} a_${E};
2507    #endif
2508#else
2509uniform ${x} ${w} u_${E};
2510#endif
2511`:g==="define-instanced"?D==="mat4"?`
2512#ifdef INSTANCED_ARRAYS
2513in vec4 a_${E}0;
2514in vec4 a_${E}1;
2515in vec4 a_${E}2;
2516in vec4 a_${E}3;
2517#else
2518uniform ${x} ${w} u_${E};
2519#endif
2520`:`
2521#ifdef INSTANCED_ARRAYS
2522in ${x} ${I} a_${E};
2523#else
2524uniform ${x} ${w} u_${E};
2525#endif
2526`:g==="initialize-attribute-custom"?`
2527#ifdef HAS_ATTRIBUTE_a_${E}
2528    ${x} ${w} ${E} = a_${E};
2529#endif
2530`:D==="vec4"||D==="uvec4"?`
2531#ifndef HAS_UNIFORM_u_${E}
2532    #ifdef ${A}
2533        ${x} ${w} ${E} = ${M};
2534    #else
2535        ${x} ${w} ${E} = a_${E};
2536    #endif
2537#else
2538    ${x} ${w} ${E} = u_${E};
2539#endif
2540`:`
2541#ifndef HAS_UNIFORM_u_${E}
2542    #ifdef ${A}
2543        ${x} ${w} ${E} = unpack_mix_${D}(${M}, u_${E}_t);
2544    #else
2545        ${x} ${w} ${E} = unpack_mix_${D}(a_${E}, u_${E}_t);
2546    #endif
2547#else
2548    ${x} ${w} ${E} = u_${E};
2549#endif
2550`}),usedDefines:p,vertexIncludes:l,fragmentIncludes:d}}var Uu={model:Dt(`#include "_prelude_fog.fragment.glsl"
2551#include "_prelude_shadow.fragment.glsl"
2552#include "_prelude_lighting.glsl"
2553uniform float u_opacity;
2554#ifdef DITHERED_DISCARD
2555uniform float u_dithered_discard_threshold;
2556#endif
2557#ifndef LIGHTING_3D_MODE
2558uniform vec3 u_lightcolor;uniform vec3 u_lightpos;uniform float u_lightintensity;
2559#endif
2560uniform 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;
2561#ifdef RENDER_SHADOWS
2562in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in float v_depth_shadows;
2563#endif
2564#ifdef OCCLUSION_TEXTURE_TRANSFORM
2565uniform vec4 u_occlusionTextureTransform;
2566#endif
2567#pragma mapbox: define-attribute highp vec3 normal_3f
2568#pragma mapbox: define-attribute highp vec3 color_3f
2569#pragma mapbox: define-attribute highp vec4 color_4f
2570#pragma mapbox: define-attribute highp vec2 uv_2f
2571#pragma mapbox: initialize-attribute highp vec3 normal_3f
2572#pragma mapbox: initialize-attribute highp vec3 color_3f
2573#pragma mapbox: initialize-attribute highp vec4 color_4f
2574#pragma mapbox: initialize-attribute highp vec2 uv_2f
2575#ifdef HAS_ATTRIBUTE_a_pbr
2576in lowp vec4 v_roughness_metallic_emissive_alpha;in mediump vec4 v_height_based_emission_params;
2577#endif
2578#ifdef HAS_TEXTURE_u_baseColorTexture
2579uniform sampler2D u_baseColorTexture;uniform bool u_baseTextureIsAlpha;uniform bool u_alphaMask;uniform float u_alphaCutoff;
2580#endif
2581#ifdef HAS_TEXTURE_u_metallicRoughnessTexture
2582uniform sampler2D u_metallicRoughnessTexture;
2583#endif
2584#ifdef HAS_TEXTURE_u_occlusionTexture
2585uniform sampler2D u_occlusionTexture;uniform float u_aoIntensity;
2586#endif
2587#ifdef HAS_TEXTURE_u_normalTexture
2588uniform sampler2D u_normalTexture;
2589#endif
2590#ifdef HAS_TEXTURE_u_emissionTexture
2591uniform sampler2D u_emissionTexture;
2592#endif
2593#ifdef APPLY_LUT_ON_GPU
2594uniform highp sampler3D u_lutTexture;
2595#endif
2596#ifdef FEATURE_CUTOUT_VERTEX
2597in highp float v_cutout_factor;
2598#endif
2599#ifdef TERRAIN_FRAGMENT_OCCLUSION
2600in highp float v_depth;uniform highp sampler2D u_depthTexture;
2600uniform highp vec2 u_inv_depth_size;uniform highp vec2 u_depth_range_unpack;
2601#ifdef DEPTH_D24
2602highp float unpack_depth(highp float depth) {return  depth*u_depth_range_unpack.x+u_depth_range_unpack.y;}
2603#else
2604highp float unpack_depth_rgba(highp vec4 rgba_depth)
2605{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;}
2606#endif
2607bool isOccluded() {highp vec2 coord=gl_FragCoord.xy*u_inv_depth_size;
2608#ifdef FLIP_Y
2609coord.y=1.0-coord.y;
2610#endif
2611#ifdef DEPTH_D24
2612highp float depth=unpack_depth(texture(u_depthTexture,coord).r);
2613#else
2614highp float depth=unpack_depth_rgba(texture(u_depthTexture,coord));
2615#endif
2616return v_depth > depth+0.0005;}
2617#endif
2618#define saturate(_x) clamp(_x,0.,1.)
2619vec3 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)
2620{
2621#ifdef LIGHTING_3D_MODE
2622vec3 transformed_normal=vec3(-normal.xy,normal.z);float lighting_factor;
2623#ifdef RENDER_SHADOWS
2624lighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows);
2625#else
2626lighting_factor=saturate(dot(transformed_normal,u_lighting_directional_dir));
2627#endif
2628return apply_lighting(albedo,transformed_normal,lighting_factor);
2629#else
2630vec3 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)-lightColor),vec3(1.0));return c3;
2631#endif
2632}vec4 getBaseColor() {vec4 albedo=u_baseColorFactor;
2633#ifdef HAS_ATTRIBUTE_a_color_3f
2634albedo*=vec4(color_3f,1.0);
2635#endif
2636#ifdef HAS_ATTRIBUTE_a_pbr
2637#else
2638#ifdef HAS_ATTRIBUTE_a_color_4f
2639albedo*=color_4f;
2640#endif
2641#endif
2642#if defined (HAS_TEXTURE_u_baseColorTexture) && defined (HAS_ATTRIBUTE_a_uv_2f)
2643vec4 texColor=texture(u_baseColorTexture,uv_2f);if(u_alphaMask) {if (texColor.w < u_alphaCutoff) {discard;}}
2644#ifdef UNPREMULT_TEXTURE_IN_SHADER
2645texColor=vec4(unpremultiplyColor(texColor),1.0);
2646#endif
2647if(u_baseTextureIsAlpha) {if (texColor.r < 0.5) {discard;}} else {texColor.rgb=sRGBToLinear(texColor.rgb);albedo*=texColor;}
2648#endif
2649vec4 color=vec4(mix(albedo.rgb,v_color_mix.rgb,v_color_mix.a),albedo.a);
2650#ifdef APPLY_LUT_ON_GPU
2651color=applyLUT(u_lutTexture,color);
2652#endif
2653return color;}highp mat3 cotangentFrame(highp vec3 N,highp vec3 p,highp vec2 uv ) {
2654#ifdef HAS_TEXTURE_u_normalTexture
2655highp 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;
2656#ifdef FLIP_Y
2657T=-T;B=-B;
2658#endif
2659highp 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;
2660#else
2661return mat3(1.0);
2662#endif
2663}highp vec3 getNormal(){highp vec3 n;
2664#ifdef HAS_ATTRIBUTE_a_normal_3f
2665n=normalize(normal_3f);
2666#else
2667highp 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));
2668#ifdef FLIP_Y
2669n=normalize(cross(fdx,fdy));
2670#else
2671n=normalize(cross(fdx,fdy))*-1.0;
2672#endif
2673#endif
2674#if defined(HAS_TEXTURE_u_normalTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)
2675vec3 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);
2676#endif
2677return 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;
2678#ifdef HAS_ATTRIBUTE_a_pbr
vendor: 4,221 bytes, lines 2678-2713
2678
2679mat.perceptualRoughness=v_roughness_metallic_emissive_alpha.x;mat.metallic=v_roughness_metallic_emissive_alpha.y;mat.baseColor.w*=v_roughness_metallic_emissive_alpha.w;
2680#endif
2681#if defined(HAS_TEXTURE_u_metallicRoughnessTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)
2682vec4 mrSample=texture(u_metallicRoughnessTexture,uv_2f);mat.perceptualRoughness*=mrSample.g;mat.metallic*=mrSample.b;
2683#endif
2684const 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)
2685{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)
2686{return specularColor+(f90-specularColor)*pow(clamp(1.0-VdotH,0.0,1.0),5.0);}vec3 F_SchlickFast(vec3 specularColor,float VdotH)
2687{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)
2688{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)
2689{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)
2690{
2691#ifdef LIGHTING_3D_MODE
2692return mat.diffuseColor;
2693#else
2694return mat.diffuseColor/PI;
2695#endif
2696}vec3 EnvBRDFApprox(vec3 specularColor,float roughness,highp float NdotV)
2697{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)
2698{vec3 env_light=vec3(0.65,0.65,0.65);
2699#ifdef LIGHTING_3D_MODE
2700float ambient_factor=calculate_ambient_directional_factor(normal);env_light=u_lighting_ambient_color*ambient_factor;
2701#endif
2702vec3 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)
2703{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;
2704#ifdef RENDER_SHADOWS
2705lighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows);
2706#else
2707lighting_factor=NdotL;
2708#endif
2709vec3 directLightColor=(specularTerm+diffuseTerm)*lighting_factor*lightColor;vec3 indirectLightColor=computeIndirectLightContribution(mat,NdotV,transformed_normal);vec3 color=(saturate(directLightColor)+indirectLightColor);float intensityFactor=1.0;
2710#if !defined(LIGHTING_3D_MODE)
2711const 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);
2712#endif
2713color*=intensityFactor;return color;}void main() {
2713
2714#ifdef TERRAIN_FRAGMENT_OCCLUSION
2715if (isOccluded()) {discard;}
2716#endif
2717vec3 lightDir;vec3 lightColor;
2718#ifdef LIGHTING_3D_MODE
2719lightDir=u_lighting_directional_dir;lightDir.xy=-lightDir.xy;lightColor=u_lighting_directional_color;
2720#else
2721lightDir=u_lightpos;lightColor=u_lightcolor;
2722#endif
2723vec4 finalColor;
2724#ifdef DIFFUSE_SHADED
2725vec3 N=getNormal();vec3 baseColor=getBaseColor().rgb;vec3 diffuse=getDiffuseShadedColor(baseColor,N,lightDir,lightColor);
2726#ifdef HAS_TEXTURE_u_occlusionTexture
2727float ao=(texture(u_occlusionTexture,uv_2f).r-1.0)*u_aoIntensity+1.0;diffuse*=ao;
2728#endif
2729finalColor=vec4(mix(diffuse,baseColor,u_emissive_strength),1.0)*u_opacity;
2730#else
2731Material mat=getPBRMaterial();vec3 color=computeLightContribution(mat,lightDir,lightColor);float ao=1.0;
2732#if defined (HAS_TEXTURE_u_occlusionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)
2733#ifdef OCCLUSION_TEXTURE_TRANSFORM
2734vec2 uv=uv_2f.xy*u_occlusionTextureTransform.zw+u_occlusionTextureTransform.xy;
2735#else
2736vec2 uv=uv_2f;
2737#endif
2738ao=(texture(u_occlusionTexture,uv).x-1.0)*u_aoIntensity+1.0;color*=ao;
2739#endif
2740vec4 emissive=u_emissiveFactor;
2741#if defined(HAS_TEXTURE_u_emissionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)
2742emissive.rgb*=sRGBToLinear(texture(u_emissionTexture,uv_2f).rgb);
2743#endif
2744#ifdef APPLY_LUT_ON_GPU
2745float emissiveFactorLength=max(length(u_emissiveFactor.rgb),0.001);emissive.rgb=sRGBToLinear(applyLUT(u_lutTexture,linearTosRGB(emissive.rgb/emissiveFactorLength).rbg))*emissiveFactorLength;
2746#endif
2747color+=emissive.rgb;float opacity=mat.baseColor.w*u_opacity;
2748#ifdef HAS_ATTRIBUTE_a_pbr
2749float 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;
2750#ifdef APPLY_LUT_ON_GPU
2751color_mix=applyLUT(u_lutTexture,color_mix);
2752#endif
2753color=mix(color,color_mix,min(1.0,resEmission));
2754#ifdef HAS_ATTRIBUTE_a_color_4f
2755float distance=length(vec2(1.3*max(0.0,abs(color_4f.x)-color_4f.z),color_4f.
2755y));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);
2756#endif
2757#endif
2758vec3 unlitColor=mat.baseColor.rgb*ao+emissive.rgb;color=mix(color,unlitColor,u_emissive_strength);color=linearTosRGB(color);color*=opacity;finalColor=vec4(color,opacity);
2759#endif
2760#ifdef DITHERED_DISCARD
2761if (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;}}
2762#endif
2763#ifdef FOG
2764finalColor=fog_dither(fog_apply_premultiplied(finalColor,v_fog_pos,v_position_height.w));
2765#endif
2766#ifdef RENDER_CUTOFF
2767finalColor*=v_cutoff_opacity;
2768#endif
2769#ifdef INDICATOR_CUTOUT
2770finalColor=applyCutout(finalColor,v_position_height.w);
2771#endif
2772#ifdef FEATURE_CUTOUT_VERTEX
2773apply_feature_cutout_dither(gl_FragCoord,v_cutout_factor);
2774#else
2775#ifdef FEATURE_CUTOUT
2776finalColor=apply_feature_cutout(finalColor,gl_FragCoord,get_cutout_factors(gl_FragCoord).x,0.0);
2777#endif
2778#endif
2779glFragColor=finalColor;
2780#ifdef OVERDRAW_INSPECTOR
2781glFragColor=vec4(1.0);
2782#endif
2783HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
2784#include "_prelude_shadow.vertex.glsl"
2785in vec3 a_pos_3f;
2786#pragma mapbox: define-attribute highp vec3 normal_3f
2787#pragma mapbox: define-attribute highp vec2 uv_2f
2788#pragma mapbox: define-attribute highp vec3 color_3f
2789#pragma mapbox: define-attribute highp vec4 color_4f
2790#pragma mapbox: define-attribute-vertex-shader-only highp uvec4 pbr
2791#pragma mapbox: define-attribute-vertex-shader-only highp vec3 heightBasedEmissiveStrength
2792uniform mat4 u_matrix;uniform mat4 u_node_matrix;uniform mat4 u_lighting_matrix;uniform vec3 u_camera_pos;uniform vec4 u_color_mix;
2793#ifdef INSTANCED_ARRAYS
2794in vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3;
2795#else
2796uniform highp mat4 u_normal_matrix;
2797#endif
2798#ifdef RENDER_SHADOWS
2799uniform 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;
2800#endif
2801out vec4 v_position_height;out lowp vec4 v_color_mix;
2802#ifdef TERRAIN_FRAGMENT_OCCLUSION
2803out highp float v_depth;
2804#endif
2805#ifdef FEATURE_CUTOUT_VERTEX
2806out highp float v_cutout_factor;
2807#endif
2808#ifdef HAS_ATTRIBUTE_a_pbr
2809out lowp vec4 v_roughness_metallic_emissive_alpha;out mediump vec4 v_height_based_emission_params;
2810#endif
2811vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}void main() {
2812#pragma mapbox: initialize-attribute highp vec3 normal_3f
2813#pragma mapbox: initialize-attribute highp vec2 uv_2f
2814#pragma mapbox: initialize-attribute highp vec3 color_3f
2815#pragma mapbox: initialize-attribute highp vec4 color_4f
2816#pragma mapbox: initialize-attribute-custom highp uvec4 pbr
2817#pragma mapbox: initialize-attribute-custom highp vec3 heightBasedEmissiveStrength
2818highp mat4 normal_matrix;
2819#ifdef INSTANCED_ARRAYS
2820normal_matrix=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3);
2821#else
2822normal_matrix=u_normal_matrix;
2823#endif
2824#ifdef FEATURE_CUTOUT_VERTEX
2825v_cutout_factor=1.0;
2826#endif
2827vec3 local_pos;mat3 rs;
2828#ifdef MODEL_POSITION_ON_GPU
2829vec3 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;
2830#ifdef FEATURE_CUTOUT_VERTEX
2831highp vec4 ground_pos=vec4(pos_a.xy,0.0,1.0);highp vec4 cutout_clip_pos=mix(u_matrix*ground_pos,AWAY,hidden);highp vec3 cutout_ndc=cutout_clip_pos.xyz/cutout_clip_pos.w;vec2 uv=cutout_ndc.xy*0.5+0.5;highp float fragDepthNDC=cutout_ndc.z*0.5+0.5;
2832#ifdef FLIP_Y
2833fragDepthNDC=cutout_ndc.z;
2834#endif
2835highp float cutoutFactor=get_cutout_factors_vert(uv).x;highp float cutoutDepthNDC=sample_cutout_depth(u_cutout_depth_image,uv);highp float groundThreshold=0.001;
2835highp float groundLimit=clamp((fragDepthNDC+groundThreshold-cutoutDepthNDC)/groundThreshold+0.5,0.0,1.0);v_cutout_factor=mix(1.0-cutoutFactor,1.0,groundLimit);
2836#endif
2837#else
2838local_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);
2839#endif
2840v_position_height.w=a_pos_3f.z;
2841#ifdef HAS_ATTRIBUTE_a_pbr
2842vec4 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;
2843#endif
2844#ifdef FOG
2845v_fog_pos=fog_position(local_pos);
2846#endif
2847#ifdef RENDER_CUTOFF
2848v_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z);
2849#endif
2850#ifdef TERRAIN_FRAGMENT_OCCLUSION
2851v_depth=gl_Position.z/gl_Position.w;
2852#ifdef CLIP_ZERO_TO_ONE
2853v_depth=-1.0+2.0*v_depth; 
2854#endif
2855#endif
2856#ifdef HAS_ATTRIBUTE_a_normal_3f
2857#ifdef MODEL_POSITION_ON_GPU
2858float 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);
2859#else
2860normal_3f=vec3(normal_matrix*vec4(normal_3f,0));
2861#endif
2862#endif
2863#ifdef HAS_ATTRIBUTE_a_pbr
2864#ifdef HAS_ATTRIBUTE_a_color_4f
2865v_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);
2866#endif
2867#endif
2868#ifdef RENDER_SHADOWS
2869vec4 shadow_pos=u_node_matrix*vec4(local_pos,1.0);
2870#ifdef NORMAL_OFFSET
2871#ifdef HAS_ATTRIBUTE_a_normal_3f
2872#ifdef MODEL_POSITION_ON_GPU
2873vec3 offset=shadow_normal_offset(vec3(-normal_3f.xy,normal_3f.z));shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0();
2874#else
2875vec3 offset=shadow_normal_offset_model(normal_3f);shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0();
2876#endif
2877#endif
2878#endif
2879v_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;
2880#endif
2881}`),modelDepth:Dt("void main() {}",`in vec3 a_pos_3f;uniform mat4 u_matrix;
2882#ifdef MODEL_POSITION_ON_GPU
2883#ifdef INSTANCED_ARRAYS
2884in vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3;
2885#else
2886uniform highp mat4 u_instance;
2887#endif
2888uniform highp mat4 u_node_matrix;
2889#endif
2890void main() {
2891#ifdef MODEL_POSITION_ON_GPU
2892highp mat4 instance;
2893#ifdef INSTANCED_ARRAYS
2894instance=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3);
2895#else
2896instance=u_instance;
2897#endif
2898vec3 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;
2898rs[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);
2899#else
2900gl_Position=u_matrix*vec4(a_pos_3f,1);
2901#endif
2902}`),fillExtrusionDepth:Dt("void main() {}",`#include "_prelude_terrain.vertex.glsl"
2903#include "_prelude_material_table.vertex.glsl"
2904uniform mat4 u_matrix;uniform float u_edge_radius;uniform float u_width_scale;uniform float u_vertical_scale;
2905#ifdef TERRAIN
2906uniform int u_height_type;uniform int u_base_type;
2907#endif
2908in ivec4 a_pos_normal_ed;
2909#if defined(HAS_CENTROID) || defined(TERRAIN)
2910in uvec2 a_centroid_pos;
2911#endif
2912#ifdef RENDER_WALL_MODE
2913in ivec4 a_join_normal_inside;
2914#endif
2915#pragma mapbox: define highp float base
2916#pragma mapbox: define highp float height
2917#pragma mapbox: define highp float line_width
2918#pragma mapbox: define highp vec4 color
2919void main() {DECLARE_MATERIAL_TABLE_INFO
2920#pragma mapbox: initialize highp float base
2921#pragma mapbox: initialize highp float height
2922#pragma mapbox: initialize highp float line_width
2923#pragma mapbox: initialize highp vec4 color
2924base*=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);
2925#if defined(HAS_CENTROID) || defined(TERRAIN)
2926centroid_pos=vec2(a_centroid_pos);
2927#endif
2928vec3 pos;
2929#ifdef TERRAIN
2930bool 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);
2931#else
2932pos=vec3(pos_nx.xy,t > 0.0 ? height : base);
2933#endif
2934#ifdef RENDER_WALL_MODE
2935vec3 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;
2936#endif
2937float 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);}`),fillExtrusionGroundEffect:Dt(`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;
2938#ifdef SDF_SUBPASS
2939in 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);}
2940#ifdef FOG
2941in highp float v_fog;
2942#endif
2943#endif
2944void main() {
2945#ifdef CLEAR_SUBPASS
2946vec4 color=vec4(1.0);
2947#ifdef CLEAR_FROM_TEXTURE
2948color=texture(u_fb,gl_FragCoord.xy/vec2(u_fb_size));
2949#endif
2950glFragColor=color;
2951#else
2952#ifdef SDF_SUBPASS
2953highp 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;
2954#ifdef FOG
2955fog=v_fog;
2956#endif
2957#ifdef RENDER_CUTOFF
2958fog*=v_cutoff_opacity;
2959#endif
2960glFragColor=vec4(vec3(0.0),mix(1.0,d,effect_intensity*u_opacity*fog));
2961#else
2962#ifdef USE_MRT1
2963out_Target1=vec4(1.0-texture(u_fb,gl_FragCoord.xy/vec2(u_fb_size)).a,0.0,0.0,0.0);
2964#else
2965vec4 color=mix(vec4(u_flood_light_color,1.0),vec4(vec3(0.0),1.0),u_ao_pass);
2966#ifdef OVERDRAW_INSPECTOR
2967color=vec4(1.0);
2968#endif
2969glFragColor=color;
2970#endif
2971#endif
2972HANDLE_WIREFRAME_DEBUG;
2973#endif
2974}`,`#include "_prelude_fog.vertex.glsl"
2975in highp ivec4 a_pos_end;in highp int a_angular_offset_factor;in highp uint a_hidden_by_landmark;
2976#ifdef SDF_SUBPASS
2977out highp vec2 v_pos;out highp vec4 v_line_segment;out highp float v_flood_light_radius_tile;out highp vec2 v_ao;
2978#ifdef FOG
2979out highp float v_fog;
2980#endif
2981#endif
2982uniform 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;
2983#pragma mapbox: define highp float flood_light_ground_radius
2984const float TANGENT_CUTOFF=4.0;const float NORM=32767.0;void main() {
2985#pragma mapbox: initialize highp float flood_light_ground_radius
2986vec4 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;
2987#ifdef SDF_SUBPASS
2988v_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);
2989#ifdef FOG
2990v_fog_pos=fog_position(pos);v_fog=1.0-fog(v_fog_pos);
2991#endif
2992#endif
2993float hidden_by_landmark=0.0;
2994#ifdef HAS_CENTROID
2995hidden_by_landmark=float(a_hidden_by_landmark);
2996#endif
2997float 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));
2998#ifdef RENDER_CUTOFF
2999v_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z);
3000#endif
3001}`),groundShadow:Dt(`#include "_prelude_shadow.fragment.glsl"
3002precision highp float;uniform vec3 u_ground_shadow_factor;in vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1;
3003#ifdef FOG
3004in float v_fog_opacity;
3005#endif
3006void 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);
3007#ifdef RENDER_CUTOFF
3008shadow=mix(vec3(1.0),shadow,cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w));
3009#endif
3010#ifdef FOG
3011shadow=mix(shadow,vec3(1.0),v_fog_opacity);
3012#endif
3013#ifdef INDICATOR_CUTOUT
3014shadow=mix(shadow,vec3(1.0),1.0-applyCutout(vec4(1.0),0.0).r);
3015#endif
3016#ifdef FEATURE_CUTOUT
3017vec2 uv=gl_FragCoord.xy*u_inv_viewport_size.xy;
3018#ifdef FLIP_Y
3019uv.y=1.0-uv.y;
3020#endif
3021highp float cutoutFactor=get_cutout_factors(gl_FragCoord).y;highp float cutoutDepthNDC=sample_cutout_depth_bilinear(u_cutout_depth_image,uv);highp float fragDepthNDC=gl_FragCoord.z/u_feature_cutout_params.w;highp float groundThreshold=-0.001;highp float groundLimit=clamp((fragDepthNDC+groundThreshold-cutoutDepthNDC)/groundThreshold+0.5,0.0,1.0);cutoutFactor=mix(0.0,cutoutFactor,groundLimit);shadow=mix(shadow,vec3(1.0),cutoutFactor);
3022#endif
3023glFragColor=vec4(shadow,1.0);}`,`#include "_prelude_fog.vertex.glsl"
3024uniform 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;
3025#ifdef FOG
3026out float v_fog_opacity;
3027#endif
3028void 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);
3029#ifdef FOG
3030v_fog_pos=fog_position(vec2(a_pos));v_fog_opacity=fog(v_fog_pos);
3031#endif
3032}`)};const ju=(s,t)=>({u_matrix:s,u_ground_shadow_factor:t}),Cg={model:s=>({u_matrix:new u.ap(s),u_lighting_matrix:new u.ap(s),u_normal_matrix:new u.ap(s),u_node_matrix:new u.ap(s),u_lightpos:new u.aq(s),u_lightintensity:new u.ar(s),u_lightcolor:new u.aq(s),u_camera_pos:new u.aq(s),u_opacity:new u.ar(s),u_baseColorFactor:new u.bZ(s),u_emissiveFactor:new u.bZ(s),u_metallicFactor:new u.ar(s),u_roughnessFactor:new u.ar(s),u_baseTextureIsAlpha:new u.b_(s),u_alph
3032aMask:new u.b_(s),u_alphaCutoff:new u.ar(s),u_baseColorTexture:new u.b_(s),u_metallicRoughnessTexture:new u.b_(s),u_normalTexture:new u.b_(s),u_occlusionTexture:new u.b_(s),u_emissionTexture:new u.b_(s),u_lutTexture:new u.b_(s),u_color_mix:new u.bZ(s),u_aoIntensity:new u.ar(s),u_emissive_strength:new u.ar(s),u_occlusionTextureTransform:new u.bZ(s),u_dithered_discard_threshold:new u.ar(s)}),modelDepth:s=>({u_matrix:new u.ap(s),u_instance:new u.ap(s),u_node_matrix:new u.ap(s)}),groundShadow:s=>({u_matrix:new u.ap(s),u_ground_shadow_factor:new u.aq(s)}),fillExtrusionDepth:s=>({u_matrix:new u.ap(s),u_edge_radius:new u.ar(s),u_width_scale:new u.ar(s),u_vertical_scale:new u.ar(s),u_height_type:new u.b_(s),u_base_type:new u.b_(s)}),fillExtrusionGroundEffect:s=>({u_matrix:new u.ap(s),u_opacity:new u.ar(s),u_ao_pass:new u.ar(s),u_meter_to_tile:new u.ar(s),u_ao:new u.b$(s),u_flood_light_intensity:new u.ar(s),u_flood_light_color:new u.aq(s),u_attenuation:new u.ar(s),u_edge_radius:new u.ar(s),u_fb:new u.b_(s),u_fb_size:new u.ar(s),u_dynamic_offset:new u.ar(s)})},bc=[];function Gu(s){return bc[s]=bc[s]||new Float64Array(16)}const Ma=[],wc=new Float32Array(16);class cm{constructor(t,n){this.aabb=t,this.lastCascade=n}}class um{add(t,n){const l=this.receivers[t.key];l!==void 0?(l.aabb.min[0]=Math.min(l.aabb.min[0],n.min[0]),l.aabb.min[1]=Math.min(l.aabb.min[1],n.min[1]),l.aabb.min[2]=Math.min(l.aabb.min[2],n.min[2]),l.aabb.max[0]=Math.max(l.aabb.max[0],n.max[0]),l.aabb.max[1]=Math.max(l.aabb.max[1],n.max[1]),l.aabb.max[2]=Math.max(l.aabb.max[2],n.max[2])):this.receivers[t.key]=new cm(n,null)}clear(){this.receivers={}}get(t){return this.receivers[t.key]}computeRequiredCascades(t,n,l){const d=u.ca.fromPoints(t.points);let p=0;for(const m in this.receivers){const g=this.receivers[m];if(!g||!d.intersectsAabb(g.aabb))continue;g.aabb.min=d.closestPoint(g.aabb.min),g.aabb.max=d.closestPoint(g.aabb.max);const x=g.aabb.getCorners();for(let w=0;w<l.length;w++){let E=!0;for(const A of x){const I=[A[0]*n,A[1]*n,A[2]];if(u.ad(I,I,l[w].matrix),I[0]<-1||I[0]>1||I[1]<-1||I[1]>1){E=!1;break}}if(g.lastCascade=w,p=Math.max(p,w),E)break}}return p+1}}function Tc(s,t,n){const l=u.aW([],n,t),d=u.aW([],s,t),p=u.ax([],l,d),m=u.ae(p);return m===0?[0,0,1,0]:(u.av(p,p,1/m),[p[0],p[1],p[2],-u.aw(p,t)])}function Rl(s,t,n,l,d,p){const m=s.zoom,g=s.scale,x=s.worldSize,w=1/x,E=s.aspect,A=Math.sqrt(1+E*E)*Math.tan(.5*s.fovX),I=A*A,M=l-n,D=l+n;let z,O;I>M/D?(z=l,O=l*A):(z=.5*D*(1+I),O=.5*Math.sqrt(M*M+2*(l*l+n*n)*I+D*D*I*I));const k=s.projection.pixelsPerMeter(s.center.lat,x),q=s._camera.getCameraToWorldMercator(),$=[0,0,-z*w];u.ad($,$,q);let U=O*w;const Q=function(Ae){return Ae[0]/=g,Ae[1]/=g,Ae[2]=u.aL(Ae[2],s._center.lat),Ae},Y=s._edgeInsets;if(!(Y.left===0&&Y.top===0&&Y.right===0&&Y.bottom===0||Y.left===Y.right&&Y.top===Y.bottom)){const Ae=s._camera.getWorldToCamera(s.worldSize,s.projection.zAxisUnit==="meters"?k:1),We=s._camera.getCameraToClipPerspective(s._fov,s.width/s.height,n,l);We[8]=2*-s.centerOffset.x/s.width,We[9]=2*s.centerOffset.y/s.height;const ke=new Float64Array(16);u.bI(ke,We,Ae);const Ue=new Float64Array(16);u.aE(Ue,ke);const je=u.bq.fromInvProjectionMatrix(Ue,x,m,!0);for(const et of je.points){const tt=Q(et);U=Math.max(U,u.ay(u.cA([],$,tt)))}}U*=d/(d-1);const ae=Math.acos(t[2]),W=Math.atan2(-t[0],-t[1]),J=new Yt;J.position=$,J.setPitchBearing(ae,W);const se=J.getWorldToCamera(x,k),ue=U*x,he=Math.min(s._mercatorZfromZoom(17)*x*-2,-2*ue),ve=J.getCameraToClipOrthographic(-ue,ue,-ue,ue,he,(ue+p*k)/t[2]),xe=new Float64Array(16);u.aP(xe,ve,se);const Le=u.c6(Math.floor(1e6*$[0])/1e6*x,Math.floor(1e6*$[1])/1e6*x,0),_e=.5*d,Pe=[0,0,0];u.ad(Pe,Le,xe),u.av(Pe,Pe,_e);const me=[Math.floor(Pe[0]),Math.floor(Pe[1]),Math.floor(Pe[2])],Re=[0,0,0];u.aW(Re,Pe,me),u.av(Re,Re,-1/_e);const Me=new Float64Array(16);return u.aC(Me),u.aG(Me,Me,Re),u.aP(xe,Me,xe),[xe,ue]}const hm={loaded:!0,drawModels:function(s,t,n,l){if(s.renderPass==="opaque")return;const d=n.paint.get("model-opacity").constantOr(1),p=n.paint.get("model-elevation-reference"),m=p==="ground",g=p==="ground";if(d===0)return;const x=n.paint.get("model-cast-shadows");
vendor: 16,365 bytes, line 3032
3032if(s.renderPass==="shadow"&&(!x||s.terrain&&d<.65&&n._transitionablePaint._values["model-opacity"].value.expression instanceof u.ab))return;const w=s.shadowRenderer,E=n.paint.get("model-receive-shadows");w&&(w.useNormalOffset=!0,E||(w.enabled=!1));const A=()=>{w&&(w.useNormalOffset=!0,E||(w.enabled=!0))},I=t.getSource();if(s.renderPass==="light-beam"&&I.type!=="batched-model")return;if(I.type==="vector"||I.type==="geojson")return(function(U,Q,Y,ae,W){const J=U.transform,se=J.projection.name==="globe",ue=J.getFreeCameraOptions().position;if(!U.modelManager)return;const he=U.modelManager;Y.modelManager=he;const ve=U.shadowRenderer;if(!Object.hasOwn(Y._unevaluatedLayout._values,"model-id"))return;const xe=Y._unevaluatedLayout._values["model-id"],Le={...Y.layout.get("model-id").parameters},_e=U.style.order.indexOf(Y.fqid),Pe=Y.paint.get("model-opacity").constantOr(1);for(const me of ae){const Re=Q.getTile(me).getBucket(Y);if(!Re||Re.projection.name!==J.projection.name)continue;const Me=Re.getModelUris();if(Me&&!Re.modelsRequested&&(he.addModelsFromBucket(Me,W),Re.modelsRequested=!0),se)Le.zoom=me.overscaledZ;else{const it=im(me,J);Le.zoom=it}const Ae=xe.possiblyEvaluate(Le);if(yc(U,Re,me),An.shadowUniformsInitialized=!1,An.useSingleShadowCascade=!!ve&&ve.getMaxCascadeForTile(me.toUnwrapped())===0,U.renderPass==="shadow"&&ve){if(U.currentShadowCascade===1&&Re.isInsideFirstShadowMapFrustum)continue;const it=J.calculatePosMatrix(me.toUnwrapped(),J.worldSize);if(An.tileMatrix.set(it),An.shadowTileMatrix.set(ve.calculateShadowPassMatrixFromMatrix(it)),An.aabb.min=[0,0,0],An.aabb.max[0]=An.aabb.max[1]=u.aj,An.aabb.max[2]=0,gs(Re,An,U,Y.scope))continue}const We=1<<me.canonical.z,ke=[((ue.x-me.wrap)*We-me.canonical.x)*u.aj,(ue.y*We-me.canonical.y)*u.aj,ue.z*We*u.aj];U.conflationActive&&Object.keys(Re.instancesPerModel).length>0&&U.style.isLayerClipped(Y,Q.getSource())&&Re.updateReplacement(me,U.replacementSource,_e,Y.scope)&&(Re.uploaded=!1,Re.upload(U.context));let Ue=0;const je=new Array,et=new Array,tt=new Array;for(let it in Re.instancesPerModel){const at=Re.instancesPerModel[it];at.features.length>0&&!se&&(it=Ae.evaluate(at.features[0].feature,{}));const bt=he.getModel(it,W);if(bt||he.hasURLBeenRequested(it)||Re.modelUris.includes(it)||(Re.modelUris.push(it),Re.modelsRequested=!1),bt&&bt.uploaded)if(se){const _t=u.av([],[ue.x,ue.y,ue.z],U.transform.worldSize);u.cb(_t,_t);for(let Ct=0;Ct<at.instancedDataArray.length;++Ct){const At=[0,0,0],gt=[1,1,1],Et=u.cd(),wt=at.tileCoordinatesForInstance(Ct),Ot=at.transformForInstance(Ct);u.ce(gt,Ot),u.cf(Et,Ot),u.cg(At,Et);const Ht=at.translationForInstance(Ct),fi=new u.b2(0,0);u.ch(Re.canonical,fi,wt.x,wt.y);const ei=u.aS();u.ci(ei,bt,U.transform,fi,At,gt,Ht,!0,!1,!1);const kt=at.colorForInstance(Ct),gi=u.bR([],_t),si=u.cc(fi.lat,U.transform.zoom),Si=u.aF([],[1,1,1/si]);tt.push({zScaleMatrix:Si,negCameraPosMatrix:gi});for(const Mt of bt.nodes)Ke(U,Mt,ei,U.transform.expandedFarZProjMatrix,Ue,je,et,bt.materialOverrides,Pe,kt);++Ue}}else for(const _t of bt.nodes)Ed(U,Y,_t,at,ke,me,An)}if(se)if(U.renderPass==="shadow"){for(const it of et)Ml(it.mesh,it.nodeModelMatrix,U,Y);for(const it of je)Ml(it.mesh,it.nodeModelMatrix,U,Y)}else qs(U,Y,je,et,tt)}})(s,t,n,l,gc(s,n)),void A();if(!I.loaded())return;if(I.type==="batched-model")return(function(U,Q,Y,ae){Y.resetLayerRenderingStats(U);const W=U.context,J=U.transform,se=U.style.fog,ue=U.shadowRenderer;if(J.projection.name!=="mercator")return void u.w(`Drawing 3D landmark models for ${J.projection.name} projection is not yet implemented`);const he=U.transform.getFreeCameraOptions().position,ve=u.av([],[he.x,he.y,he.z],U.transform.worldSize),xe=u.cb([],ve),Le=u.bR([],xe),_e=u.cc(J.center.lat,J.zoom),Pe=u.aF([],[1,1,1/_e]),me=u.aP([],Le,Pe),Re=Y.paint.get("model-opacity").constantOr(1),Me=new nt(W.gl.LEQUAL,nt.ReadWrite,U.depthRangeFor3D),Ae=new nt(W.gl.LEQUAL,nt.ReadOnly,U.depthRangeFor3D),We=new u.ca([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),ke=U.renderPass==="shadow",Ue=U.renderPass==="light-beam",je=Y.paint.get("model-color-use-theme").constantOr("default")==="none",et=ke&&ue?ue.getCurrentCascadeFrustum():J.getFrustum(J.scaleZoom(J.worldSize)),tt=Y.paint.get("model-front-cutoff"),it=tt[2]<1,at=ps(U,Y.paint.get("model-cutoff-fade-range")),bt=Y.getLayerRenderingStats();(function(_t,Ct,At,gt){const Et=_t.terrain?_t.terrain.exaggeration():0,wt=_t.transform.zoom;for(const Ot of gt){const Ht=Ct.getTile(Ot).getBucket(At);Ht&&(Ht.setFilter(At.filter),_t.conflationActive&&Ht.updateReplacement(Ot,_t.replacementSource),Ht.evaluateTransform(_t,At),_t.terrain&&Et>0&&Ht.elevationUpdate(_t.terrain,Et,Ot,At.source),Ht.needsReEvaluation(_t,wt,At)&&Ht.evaluate(At))}})(U,Q,Y,ae),(function(){const _t=new Map;let Ct,At,gt;it?(Ct=ae.length-1,At=-1,gt=-1):(Ct=0,At=ae.length,gt=1);const Et=u.bh(),wt=new u.P(0,0);for(let Ot=Ct;Ot!==At;Ot+=gt){const Ht=ae[Ot],fi=Q.getTile(Ht).getBucket(Y);if(!fi||!fi.uploaded)continue;let ei=!1;ue&&(ei=ue.getMaxCascadeForTile(Ht.toUnwrapped())===0);const kt=J.calculatePosMatrix(Ht.toUnwrapped(),J.worldSize),gi=!!(fi.modelTraits&u.ck.HasMapboxMeshFeatures);u.aP(Er,me,kt),u.aP(Ho,J.expandedFarZProjMatrix,kt),u.aE(Du,Er),u.cl(Du,Du);const si=!ke&&ue&&ue.enabled?ue.computeCascadeTileMatrices(kt):null;!ke&&it&&(u.aE(Yr,kt),u.ad(Et,ve,Yr),wt.x=Et[0],wt.y=Et[1]);const Si=[];fi.setFilter(Y.filter);for(const Mt of fi.getNodesInfo()){if(Mt.hiddenByReplacement||!Mt.node.meshes)continue;const Lt=Mt.node;let Tt=0;U.terrain&&Lt.elevation&&(Tt=Lt.elevation*U.terrain.exaggeration());const li=(()=>{const Ei=Mt.aabb,Fi=We.min,ri=We.max;return Fi[0]=Ei.min[0],Fi[1]=Ei.min[1],Fi[2]=Ei.min[2]+Tt,ri[0]=Ei.max[0],ri[1]=Ei.max[1],ri[2]=Ei.max[2]+Tt,u.ad(Fi,Fi,kt),u.ad(ri,ri,kt),We})(),ci=Mt.evaluatedScale;if(ci[0]<=1&&ci[1]<=1&&ci[2]<=1&&li.intersects(et)===0)continue;if(!ke){const Ei=li.min,Fi=li.max;Lu[0]=.5*(Ei[0]+Fi[0]),Lu[1]=.5*(Ei[1]+Fi[1]),Lu[2]=.5*(Ei[2]+Fi[2]);const ri=u.aX(ve,Lu)*_e,pi=U._debugParams.lodSwitchDistance,Bt=pi>=0;if(Bt&&pi>=9999)Mt.targetLod=0;else{let Oi;if(Bt)Oi=pi;else{const Rr=(Fi[2]-Ei[2])*_e*ci[2],ui=Math.max(Fi[0]-Ei[0],Fi[1]-Ei[1])*_e*Math.max(ci[0],ci[1]);let Fr;Fr=Rr>=30?1:ui>=80?.5:Math.max(Rr,ui)>=20?.25:0,Oi=2e3+3e3*Fr}Bu(Mt,ri,Math.min(U.frameTimeDelta,1e3/30),Oi,U._debugParams.lodSwitchFadeDuration)}}if(!ke&&it){const Ei=.16666666666666666;Mt.cameraCollisionOpacity=ve[0]>li.min[0]&&ve[0]<li.max[0]&&ve[1]>li.min[1]&&ve[1]<li.max[1]&&ve[2]*_e<li.max[2]&&Lt.footprint&&u.cm(wt,Lt.footprint)?Math.max(Mt.cameraCollisionOpacity-Ei,0):Math.min(1,Mt.cameraCollisionOpacity+Ei)}const $i=1/u.cn(Ht.canonical),Ui=Lt.anchor?Lt.anchor[0]:0,cr=Lt.anchor?Lt.anchor[1]:0,pr=[Ui*(ci[0]-1)+Mt.evaluatedTranslation[0]*$i,cr*(ci[1]-1)+Mt.evaluatedTranslation[1]*$i,Tt+Mt.evaluatedTranslation[2]],Br=Cl(new Float64Array(16),kt,pr,ci),Qr=u.aP([],Br,Lt.globalMatrix),Ut=u.aP([],J.expandedFarZProjMatrix,Qr),Ti=Ut[2]*Ui+Ut[6]*cr+Ut[10]*Tt+Ut[14];Lt.hidden=!1;let Ii=Re;ke||(it&&(Ii*=Mt.cameraCollisionOpacity,Ii*=Ea(Br,J,Mt.aabb,tt)),Ii*=Sd(at,Ti)),Ii!==0?Si.push({nodeInfo:Mt,depth:Ti,opacity:Ii,wvpForNode:Ut,nodeModelMatrix:Qr,tileModelMatrix:Br,tileTranslation:pr}):Lt.hidden=!0}ke||Si.sort((Mt,Lt)=>!it||Mt.opacity===1&&Lt.opacity===1?Mt.depth<Lt.depth?-1:1:Mt.opacity===1?-1:Lt.opacity===1?1:Mt.depth>Lt.depth?-1:1);for(const Mt of Si){const Lt=Mt.nodeInfo,Tt=Lt.node;let li=null;if(U._debugParams.show3DModelFootprints&&Tt.footprint){const Ii=Tt.id||Tt.name||"footprint";if(!_t.has(Ii)){const Ei=Cl(new Float64Array(16),Ho,Mt.tileTranslation,Mt.nodeInfo.evaluatedScale);_t.set(Ii,{node:Tt,mvp:Ei})}}const ci=Mt.nodeInfo.evaluatedScale;Cl(Ur,Er,Mt.tileTranslation,ci),zu[0]=1/ci[0],zu[1]=-1/ci[1],zu[2]=1/ci[2],u.bL(Yr,Du,zu),u.aP(Ur,Ur,Tt.globalMatrix);const $i=gi?0:Lt.evaluatedRMEA[0][2],Ui=Lt.targetLod,cr=Tt.lodMeshes&&Tt.lodMeshes.length>0,pr=cr&&Ui>0&&Ui<1;if(ke&&cr&&Math.round(Ui)===1)continue;const Br=!ke&&se?bd(on,Mt.nodeModelMatrix,U.transform):null,Qr=ke&&ue?ue.calculateShadowPassMatrixFromMatrix(Mt.nodeModelMatrix):null,Ut=pr?2:1,Ti=cr&&Math.round(Ui)===1;for(let Ii=0;Ii<Ut;++Ii){const Ei=pr?Ii===1:Ti,Fi=Ei?Tt.lodMeshes:Tt.meshes,ri=pr?Ei?-Ui:1-Ui:1;for(let pi=0;pi<Fi.length;++pi){const Bt=Fi[pi],Oi=!Ei&&pi===Tt.lightMeshIndex;let Rr=Mt.wvpForNode;if(Oi){if(!Ue&&!U.terrain&&U.shadowRenderer){U.currentLayer<U.firstLightBeamLayer&&(U.firstLightBeamLayer=U.currentLayer);continue}Rr=Cl(Ig,Ho,Mt.tileTranslation,Mt.nodeInfo.evaluatedScale)}else if(Ue)continue;const ui={defines:[]},Fr=[],go=!!Bt.normalBuffer;if(!ke&&ue&&(ue.useNormalOffset=go),Ou(ui.defines,Fr,Bt,U,je?null:Y.lut),gi||ui.defines.push("DIFFUSE_SHADED"),ei&&ui.defines.push("SHADOWS_SINGLE_CASCADE"),bt&&(ke?bt.numRenderedVerticesInShadowPass+=Bt.vertexArray.length:bt.numRenderedVerticesInTransparentPass+=Bt.vertexArray.length),ke){Ml(Bt,Mt.nodeModelMatrix,U,Y,Qr);continue}if(se&&J.projection.name!=="globe"){const bn=Bt.aabb.min,zo=Bt.aabb.max,[Qo,sa]=se.getOpacityForBounds(Br,bn[0],bn[1],zo[0],zo[1]);ui.overrideFog=Qo>=ba||sa>=ba}const Ln=Bt.material;let hn;Ln.occlusionTexture&&Ln.occlusionTexture.offsetScale&&(hn=Ln.occlusionTexture.offsetScale,ui.defines.push("OCCLUSION_TEXTURE_TRANSFORM")),pr&&ui.defines.push("DITHERED_DISCARD");const Zn=U.getOrCreateProgram("model",ui);if(!ke&&ue&&ue.enabled)if(li!==go){for(let bn=0;bn<si.length;bn++)Cl(Fu[bn]=Fu[bn]||new Float64Array(16),si[bn],Mt.tileTranslation,Mt.nodeInfo.evaluatedScale);ue.setupShadowsFromCascadeMatrices(Fu,Zn,go),li=go}else Zn.setShadowUniformValues(W,ue.getShadowUniformValues());U.uploadCommonUniforms(W,Zn,null,Br);const Wn=Ln.pbrMetallicRoughness;Wn.metallicFactor=.9,Wn.roughnessFactor=.5;const yo=Xr(Rr,Ur,Yr,Tt.globalMatrix,U,Mt.opacity,Wn.baseColorFactor,Ln.emissiveFactor,Wn.metallicFactor,Wn.roughnessFactor,Ln,$i,Y,vd,hn,void 0,void 0,ri,Zn.fixedDefines.includes("LIGHTING_3D_MODE"));!Oi&&(Lt.hasTranslucentParts||Mt.opacity<1)&&Zn.draw(U,W.gl.TRIANGLES,Me,lt.disabled,dt.disabled,pt.backCCW,yo,Y.id,Bt.vertexBuffer,Bt.indexBuffer,Bt.segments,Y.paint,U.transform.zoom,void 0,Fr),Zn.draw(U,W.gl.TRIANGLES,Oi?Ae:Me,lt.disabled,Oi||Mt.opacity<1||Lt.hasTranslucentParts?dt.alphaBlended:dt.unblended,pt.backCCW,yo,Y.id,Bt.vertexBuffer,Bt.indexBuffer,Bt.segments,Y.paint,U.transform.zoom,void 0,Fr)}}}}if(U._debugParams.show3DModelFootprints&&_t.size>0){const Ot=Array.from(_t.keys()).sort();for(const Ht of Ot){const{node:fi,mvp:ei}=_t.get(Ht);wd(U,0,fi,ei)}}})()})(s,t,n,l),void A();if(I.type!=="model")return;const M=I.getModels(),D=[],z=s.transform.getFreeCameraOptions().position,O=u.av([],[z.x,z.y,z.z],s.transform.worldSize);u.cb(O,O);const k=[],q=[];let $=0;for(const U of M){const Q=t.getFeatureState("",U.id),Y={type:"Unknown",id:U.id,properties:U.featureProperties},ae=n.paint.get("model-rotation").evaluate(Y,Q),W=n.paint.get("model-scale").evaluate(Y,Q),J=n.paint.get("model-translation").evaluate(Y,Q),se=n.paint.get("model-opacity").evaluate(Y,Q);tm(n,U.id,Q,U.featureProperties,U.nodeOverrideNames,U.nodeOverrides),Td(n,U.id,Q,U.featureProperties,U.materialOverrideNames,U.materialOverrides),U.nodeOverrides.size>0&&U.computeBoundsAndApplyParent(),U.computeModelMatrix(s,ae,W,J,g,m,!1);const ue=u.bR([],O),he=u.cc(U.position.lat,s.transform.zoom),ve=u.aF([],[1,1,1/he]);D.push({zScaleMatrix:ve,negCameraPosMatrix:ue});for(const xe of U.nodes)Ke(s,xe,U.matrix,s.transform.expandedFarZProjMatrix,$,k,q,U.materialOverrides,se,void 0,U.lightOverrides);$++}if(k.sort((U,Q)=>Q.depth-U.depth),s.renderPass!=="shadow"){if(s._debugParams.show3DModelFootprints){const U=s.transform.projMatrix,Q=new Map,Y=(W,J)=>{if(W.footprint){const se=W.id||W.name||"footprint";if(!Q.has(se)){const ue=u.aP([],U,J);Q.set(se,{node:W,mvp:ue})}}};for(const W of q)Y(W.node,W.modelMatrix);for(const W of k)Y(W.node,W.modelMatrix);const ae=Array.from(Q.keys()).sort();for(const W of ae){const{node:J,mvp:se}=Q.get(W);wd(s,0,J,se)}}qs(s,n,k,q,D),A()}else{for(const U of q)Ml(U.mesh,U.nodeModelMatrix,s,n);for(const U of k)Ml(U.mesh,U.nodeModelMatrix,s,n);A()}},prepare:function(s,t,n){const l=t.getSource();if(!l.loaded())return;if(l.type==="vector"||l.type==="geojson")return void(n.modelManager&&n.modelManager.upload(n,gc(n,s)));if(l.type==="batched-model"||l.type!=="model")return;const d=l.getModels();for(const p of d)p.upload(n.context)},shaders:Uu,programUniforms:Cg,ShadowRenderer:class{constructor(s){this.painter=s,this._enabled=!1,this._drawShadowAfterLayer=-1,this._numCascadesToRender=0,this._cascades=[],this._groundShadowTiles=[],this._receivers=new um,this._depthMode=new nt(s.context.gl.LEQUAL,nt.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 s of this._cascades)s.texture.destroy(),s.framebuffer.destroy();this._cascades=[]}updateShadowParameters(s,t){const n=this.painter;if(this._enabled=!1,this._drawShadowAfterLayer=-1,this._receivers.clear(),!t||!t.properties)return;const l=t.properties.get("shadow-intensity"),d=t.properties.get("shadow-draw-before-layer");if(!t.shadowsEnabled()||l<=0)return;let p=-1,m=0;for(const O of n.style.order){const k=n.style._mergedLayers[O];k.hasShadowPass()&&!k.isHidden(s.zoom)&&(p=m),!d||d!==O&&d!==k.slot||(this._drawShadowAfterLayer=m>0?m-1:0),m+=1}if(this._enabled=p>=0,!this.enabled)return;this._drawShadowAfterLayer<0&&(this._drawShadowAfterLayer=p);const g=n.context,x=this._shadowParameters.shadowMapResolution,w=this._shadowParameters.shadowMapResolution;if(this._cascades.length===0||this._shadowParameters.shadowMapResolution!==this._cascades[0].texture.size[0]){this._cascades=[];for(let O=0;O<this._shadowParameters.cascadeCount;++O){const k=g.gl,q=g.createFramebuffer(x,w,0,"texture"),$=new u.T(g,{width:x,height:w,data:null},k.DEPTH_COMPONENT16);q.depthAttachment.set($.texture),this._cascades.push({framebuffer:q,texture:$,matrix:[],far:0,boundingSphereRadius:0,frustum:new u.bq,scale:0})}}this.shadowDirection=Jp(t);let E=0;if(s.elevation){const O=s.elevation,k=[1e4,-1e4];O.visibleDemTiles.filter(q=>q.dem).forEach(q=>{const $=q.dem.tree;k[0]=Math.min(k[0],$.minimums[0]),k[1]=Math.max(k[1],$.maximums[0])}),k[0]!==1e4&&(E=(k[1]-k[0])*O.exaggeration())}const A=1.5*s.cameraToCenterDistance,I=3*A,M=new Float64Array(16);for(let O=0;O<this._cascades.length;++O){const k=this._cascades[O];let q=s.height/50,$=1;this._shadowParameters.cascadeCount===1?$=I:O===0?$=A:(q=A,$=I);const[U,Q]=Rl(s,this.shadowDirection,q,$,this._shadowParameters.shadowMapResolution,E);k.scale=s.scale,k.matrix=U,k.boundingSphereRadius=Q,u.aE(M,k.matrix),k.frustum=u.bq.fromInvProjectionMatrix(M,1,0,!0),k.far=$}const D=this._cascades.length-1;this._uniformValues.u_fade_range=[.75*this._cascades[D].far,this._cascades[D].far],this._uniformValues.u_shadow_intensity=l,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=n.transform.coveringTiles({tileSize:512,renderWorldCopies:!0});const z=n.transform.elevation;for(const O of this._groundShadowTiles){let k={min:0,max:0};if(z){const q=z.getMinMaxForTile(O);q&&(k=q)}this.addShadowReceiver(O.toUnwrapped(),k.min,k.max)}}get enabled(){return this._enabled&&!this._forceDisable}set enabled(s){this._enabled=s}drawShadowPass(s,t){if(!this.enabled)return;const n=this.painter,l=n.context;this._numCascadesToRender=this._receivers.computeRequiredCascades(n.transform.getFrustum(0),n.transform.worldSize,this._cascades),l.viewport.set([0,0,this._shadowParameters.shadowMapResolution,this._shadowParameters.shadowMapResolution]);for(let d=0;d<this._numCascadesToRender;++d){n.currentShadowCascade=d,l.bindFramebuffer.set(this._cascades[d].framebuffer.framebuffer),l.clear({color:u.C.white,depth:1});for(const p of s.order){const m=s._mergedLayers[p];
3032if(!m.hasShadowPass()||m.isHidden(n.transform.zoom))continue;const g=s.getLayerSourceCache(m),x=g?t[g.id]:void 0;(m.type==="model"||x&&x.length)&&n.renderLayer(n,g,m,x)}}n.currentShadowCascade=0}drawGroundShadows(){if(!this.enabled)return;const s=this.painter,t=s.style,n=s.context,l=n.gl,d=t.directionalLight,p=t.ambientLight;if(!d||!p)return;const m=[],g=ps(s,s.longestCutoffRange);g.shouldRenderCutoff&&m.push("RENDER_CUTOFF"),m.push("RENDER_SHADOWS"),this.useNormalOffset&&m.push("NORMAL_OFFSET");const x=yn(t,d,p),w=new nt(l.LEQUAL,nt.ReadOnly,s.depthRangeFor3D),E=new lt({func:l.EQUAL,mask:255},0,255,l.KEEP,l.KEEP,l.KEEP);for(const A of this._groundShadowTiles){const I=A.toUnwrapped(),M=s.isTileAffectedByFog(A),D=s.getOrCreateProgram("groundShadow",{defines:m,overrideFog:M});this.setupShadows(I,D),s.uploadCommonUniforms(n,D,I,null,g);const z=ju(s.transform.calculateProjMatrix(I),x);D.draw(s,l.TRIANGLES,w,E,dt.multiply,pt.disabled,z,"ground_shadow",s.tileExtentBuffer,s.quadTriangleIndexBuffer,s.tileExtentSegments,null,s.transform.zoom,null,null)}}getShadowPassDepthMode(){return this._depthMode}getGroundShadowLayerIndex(){return this._drawShadowAfterLayer}calculateShadowPassMatrixFromTile(s){const t=this.painter.transform,n=t.calculatePosMatrix(s,t.worldSize);return u.aP(n,this._cascades[this.painter.currentShadowCascade].matrix,n),Float32Array.from(n)}calculateShadowPassMatrixFromMatrix(s){return u.aP(wc,this._cascades[this.painter.currentShadowCascade].matrix,s)}setupShadows(s,t,n){if(!this.enabled)return;const l=this.painter.transform,d=this.painter.context,p=d.gl,m=this._uniformValues,g=l.calculatePosMatrix(s,l.worldSize);for(let x=0;x<this._cascades.length;x++){const w=Gu(x);u.aP(w,this._cascades[x].matrix,g),m[x===0?"u_light_matrix_0":"u_light_matrix_1"]=w,d.activeTexture.set(p.TEXTURE0+11+x),this._cascades[x].texture.bindExtraParam(p.LINEAR,p.LINEAR,p.CLAMP_TO_EDGE,p.CLAMP_TO_EDGE,p.GREATER)}if(this.useNormalOffset=!!n,this.useNormalOffset){const x=u.cn(s.canonical),w=2/l.tileSize*u.aj/this._shadowParameters.shadowMapResolution,E=w*this._cascades[0].boundingSphereRadius,A=w*this._cascades.at(-1).boundingSphereRadius,I=(n==="vector-tile"?1:3)*(function(M){const D=u.as((M-22)/-22,0,1
3032);return .125*(1-D)+4*D})(l.zoom);m.u_shadow_normal_offset=[x,E*I,A*I],m.u_shadow_bias=[1e-4,.0012,.012]}else m.u_shadow_bias=[36e-5,.0012,.012];t.setShadowUniformValues(d,m)}computeCascadeTileMatrices(s){const t=this._shadowParameters.cascadeCount;for(let n=0;n<t;n++){const l=Ma[n]=Ma[n]||new Float64Array(16);u.aP(l,this._cascades[n].matrix,s)}return Ma.length=t,Ma}setupShadowsFromMatrix(s,t,n=!1){if(!this.enabled)return;const l=this._shadowParameters.cascadeCount;for(let d=0;d<l;d++)u.aP(Gu(d),this._cascades[d].matrix,s);bc.length=l,this.setupShadowsFromCascadeMatrices(bc,t,n)}setupShadowsFromCascadeMatrices(s,t,n=!1){if(!this.enabled)return;const l=this.painter.context,d=l.gl,p=this._uniformValues;for(let m=0;m<this._shadowParameters.cascadeCount;m++)p[m===0?"u_light_matrix_0":"u_light_matrix_1"]=s[m],l.activeTexture.set(d.TEXTURE0+11+m),this._cascades[m].texture.bindExtraParam(d.LINEAR,d.LINEAR,d.CLAMP_TO_EDGE,d.CLAMP_TO_EDGE,d.GREATER);if(this.useNormalOffset=n,n){const m=this._shadowParameters.normalOffset;p.u_shadow_normal_offset=[1,m,m],p.u_shadow_bias=[6e-5,.0012,.012]}else p.u_shadow_bias=[36e-5,.0012,.012];t.setShadowUniformValues(l,p)}getShadowUniformValues(){return this._uniformValues}getCurrentCascadeFrustum(){return this._cascades[this.painter.currentShadowCascade].frustum}computeSimplifiedTileShadowVolume(s,t,n,l){if(l[2]>=0)return{};const d=(function(g,x,w){const E=w/(1<<g.canonical.z);return new u.ca([g.canonical.x*E+g.wrap*w,g.canonical.y*E+g.wrap*w,0],[(g.canonical.x+1)*E+g.wrap*w,(g.canonical.y+1)*E+g.wrap*w,x])})(s,t,n).getCorners(),p=t/-l[2];l[0]<0?(u.cz(d[0],d[0],[l[0]*p,0,0]),u.cz(d[3],d[3],[l[0]*p,0,0])):l[0]>0&&(u.cz(d[1],d[1],[l[0]*p,0,0]),u.cz(d[2],d[2],[l[0]*p,0,0])),l[1]<0?(u.cz(d[0],d[0],[0,l[1]*p,0]),u.cz(d[1],d[1],[0,l[1]*p,0])):l[1]>0&&(u.cz(d[2],d[2],[0,l[1]*p,0]),u.cz(d[3],d[3],[0,l[1]*p,0]));const m={};return m.vertices=d,m.planes=[Tc(d[1],d[0],d[4]),Tc(d[2],d[1],d[5]),Tc(d[3],d[2],d[6]),Tc(d[0],d[3],d[7])],m}addShadowReceiver(s,t,n){this._receivers.add(s,u.ca.fromTileIdAndHeight(s,t,n))}getMaxCascadeForTile(s){const t=this._receivers.get(s);return t&&t.lastCascade?t.lastCascade:0}},drawGroundEffect:Ao},Cn=hm;async function Dd(){return Promise.resolve()}function qu(s,t,n,l,d,p,m,g){n.resetLayerRenderingStats(s);const x=s.context,w=x.gl,E=s.transform,A=n.paint.get("fill-extrusion-pattern"),I=n.paint.get("fill-extrusion-pattern-cross-fade"),M=A.constantOr(null),D=A.constantOr(1),z=n.paint.get("fill-extrusion-opacity"),O=s.style.enable3dLights(),k=n.paint.get(O&&!D?"fill-extrusion-ambient-occlusion-wall-radius":"fill-extrusion-ambient-occlusion-radius"),q=[n.paint.get("fill-extrusion-ambient-occlusion-intensity"),k],$=n.layout.get("fill-extrusion-edge-radius"),U=$>0&&!n.paint.get("fill-extrusion-rounded-roof"),Q=U?0:$,Y=E.projection.name==="globe"?u.cC():0,ae=E.projection.name==="globe",W=ae?u.ah(E.zoom):0,J=[u.bE(E.center.lng),u.bF(E.center.lat)],se=n.paint.get("fill-extrusion-flood-light-color-use-theme").constantOr("default")==="none",ue=n.paint.get("fill-extrusion-flood-light-color").toNonPremultipliedRenderColor(se?null:n.lut).toArray01().slice(0,3),he=n.paint.get("fill-extrusion-flood-light-intensity"),ve=n.paint.get("fill-extrusion-vertical-scale"),xe=n.paint.get("fill-extrusion-line-width").constantOr(1)!==0,Le=n.paint.get("fill-extrusion-height-alignment"),_e=n.paint.get("fill-extrusion-base-alignment"),Pe=ps(s,n.paint.get("fill-extrusion-cutoff-fade-range")),me=n.paint.get("fill-extrusion-front-cutoff"),Re=Ec(E.pitch,me,!!s.terrain),Me=Re[2]<1;Me&&(s.maxFrontCutoffRawStart=Math.max(s.maxFrontCutoffRawStart,me[0]));const Ae=[];let We;ae&&Ae.push("PROJECTION_GLOBE_VIEW"),q[0]>0&&Ae.push("FAUX_AO"),U&&Ae.push("ZERO_ROOF_RADIUS"),g&&Ae.push("HAS_CENTROID"),he>0&&Ae.push("FLOOD_LIGHT"),Pe.shouldRenderCutoff&&Ae.push("RENDER_CUTOFF"),Me&&Ae.push("RENDER_FRONT_CUTOFF"),xe&&Ae.push("RENDER_WALL_MODE");const ke=s.renderPass==="shadow",Ue=s.shadowRenderer,je=ke&&!!Ue,et=ke?pt.disabled:pt.backCCW;s.shadowRenderer&&(s.shadowRenderer.useNormalOffset=!0);let tt=[0,0,0];if(Ue){const bt=s.style.directionalLight,_t=s.style.ambientLight;bt&&_t&&(tt=yn(s.style,bt,_t)),ke||(Ae.push("RENDER_SHADOWS"),Ue.useNormalOffset&&Ae.push("NORMAL_OFFSET")),We=Ae.concat(["SHADOWS_SINGLE_CASCADE"])}const it=je?"fillExtrusionDepth":D?"fillExtrusionPattern":"fillExtrusion",at=n.getLayerRenderingStats();for(const bt of l){const _t=t.getTile(bt),Ct=_t.getBucket(n);
vendor: 44,684 bytes, line 3032
3032if(!Ct||Ct.projection.name!==E.projection.name)continue;let At=!1;Ue&&(At=Ue.getMaxCascadeForTile(bt.toUnwrapped())===0);const gt=s.isTileAffectedByFog(bt),Et=Ct.programConfigurations.get(n.id);let wt=!1;if(M&&_t.imageAtlas){const si=_t.imageAtlas,Si=u.cD.from(M),Mt=Si.getPrimary().scaleSelf(u.r.devicePixelRatio).toString(),Lt=Si.getSecondary(),Tt=si.patternPositions.get(Mt),li=Lt?si.patternPositions.get(Lt.scaleSelf(u.r.devicePixelRatio).toString()):null;wt=!!Tt&&!!li,Tt&&Et.setConstantPatternPositions(Tt,li)}I>0&&(wt||Et.getPatternTransitionVertexBuffer("fill-extrusion-pattern"))&&Ae.push("FILL_EXTRUSION_PATTERN_TRANSITION");const Ot=s.getOrCreateProgram(it,{config:Et,defines:At?We:Ae,overrideFog:gt});if(s.terrain&&s.terrain.setupElevationDraw(_t,Ot,{useMeterToDem:!0}),!Ct.centroidVertexBuffer){const si=Ot.getAttributeLocation(w,"a_centroid_pos");si!==-1&&w.vertexAttribI4ui(si,0,0,0,0)}!ke&&Ue&&Ue.setupShadows(_t.tileID.toUnwrapped(),Ot,"vector-tile"),D&&(s.context.activeTexture.set(w.TEXTURE0),_t.imageAtlasTexture&&_t.imageAtlasTexture.bind(w.LINEAR,w.CLAMP_TO_EDGE),Et.updatePaintBuffers());const Ht=n.paint.get("fill-extrusion-vertical-gradient"),fi=1/Ct.tileToMeter;let ei;if(ke&&Ue){if(pm(_t.tileID,Ct.maxHeight,s))continue;const si=Ue.calculateShadowPassMatrixFromTile(_t.tileID.toUnwrapped());ei=Pu(si,Q,fi,ve,Le,_e)}else{const si=s.translatePosMatrix(bt.expandedProjMatrix,_t,n.paint.get("fill-extrusion-translate"),n.paint.get("fill-extrusion-translate-anchor")),Si=E.projection.createInversionMatrix(E,bt.canonical),Mt=Ot.fixedDefines.includes("LIGHTING_3D_MODE");ei=D?Kp(si,s,Ht,z,q,Q,fi,bt,_t,Y,Le,_e,W,J,Si,ue,ve,I,Mt):yd(si,s,Ht,z,q,Q,fi,bt,Y,Le,_e,W,J,Si,ue,ve,he,tt,Re,Mt)}s.uploadCommonUniforms(x,Ot,bt.toUnwrapped(),null,Pe);let kt=Ct.segments;if(E.projection.name==="mercator"&&!ke&&(kt=Ct.getVisibleSegments(_t.tileID,s.terrain,s.transform.getFrustum(0)),!kt.get().length))continue;if(at)if(ke)for(const si of kt.get())at.numRenderedVerticesInShadowPass+=si.primitiveLength;else for(const si of kt.get())at.numRenderedVerticesInTransparentPass+=si.primitiveLength;const gi=[];(s.terrain||g)&&gi.push(Ct.centroidVertexBuffer),ae&&gi.push(Ct.layoutVertexExtBuffer),xe&&gi.push(Ct.wallVertexBuffer),Ot.draw(s,x.gl.TRIANGLES,d,p,m,et,ei,n.id,Ct.layoutVertexBuffer,Ct.indexBuffer,kt,n.paint,s.transform.zoom,Et,gi)}s.shadowRenderer&&(s.shadowRenderer.useNormalOffset=!1)}class Hu{constructor(){this.translate=[0,0],this.translateAnchor="map",this.edgeRadius=0,this.cutoffFadeRange=0}}function Ec(s,t,n){if(!(t[2]<1)||n)return[0,0,1];const l=180*s/Math.PI;if(l<15)return[-.5,t[1],t[2]];const d=Math.min(1,Math.max(0,(l-15)/5)),p=d*d*(3-2*d);return[-.5*(1-p)+t[0]*p,t[1],t[2]]}function zd(s,t,n,l,d,p,m){l.centroidVertexArray.length===0&&l.createCentroidsBuffer();const g=p?p.findDEMTileFor(n):null;if(!(g&&g.dem||m))return;p&&g&&g.dem&&l.selfDEMTileTimestamp!==g.dem._timestamp&&(l.borderDoneWithNeighborZ=[-1,-1,-1,-1],l.selfDEMTileTimestamp=g.dem._timestamp);const x=(k,q)=>{(k.flags|q.flags)&u.cE?(k.flags|=u.cE,q.flags|=u.cE):(k.flags&=~u.cE,q.flags&=~u.cE)},w=k=>new u.P(Math.ceil((k+u.cF)*u.cG),0),E=(k,q,$)=>{const U=Math.ceil((k+u.cF)*u.cG),Q=Math.floor(Math.max(0,Math.min(u.aj-1,$))/4);return new u.P(U,Q<<5|(3&q)<<3|7)},A=k=>{const q=t.getSource().minzoom,$=Q=>{const Y=t.getTileByID(Q);if(Y&&Y.hasData())return Y.getBucket(d)},U=[0,-1,1];for(const Q of U){if(k.overscaledZ+Q<q)continue;const Y=$(k.calculateScaledKey(k.overscaledZ+Q));if(Y)return Y}},I=[0,0,0],M=(k,q)=>(I[0]=Math.min(k.min.y,q.min.y),I[1]=Math.max(k.max.y,q.max.y),I[2]=u.aj-q.min.x>k.max.x?q.min.x-u.aj:k.max.x,I),D=(k,q)=>(I[0]=Math.min(k.min.x,q.min.x),I[1]=Math.max(k.max.x,q.max.x),I[2]=u.aj-q.min.y>k.max.y?q.min.y-u.aj:k.max.y,I),z=[(k,q)=>M(k,q),(k,q)=>M(q,k),(k,q)=>D(k,q),(k,q)=>D(q,k)],O=(k,q,$,U,Q,Y,ae)=>{if(!p)return 0;const W=[[Y?$:k,Y?k:$,0],[Y?$:q,Y?q:$,0]],J=ae<0?u.aj+ae:ae,se=[Y?J:(k+q)/2,Y?(k+q)/2:J,0];return $===0&&ae<0||$!==0&&ae>0?p.getForTilePoints(Q,[se],!0,U):W.push(se),p.getForTilePoints(n,W,!0,g),Math.max(W[0][2],W[1][2],se[2])/p.exaggeration()};for(let k=0;k<4;k++){const q=l.borderFeatureIndices[k];if(q.length===0)continue;const $=u.c0[k](n),U=A($);if(!(U&&U instanceof u.cB))continue;const Q=p?p.findDEMTileFor($):null;if(!(Q&&Q.dem||m)||(p&&Q&&Q.dem&&l.borderDEMTileTimestamp[k]!==Q.dem._timestamp&&(l.borderDoneWithNeighborZ[k]=-1,l.borderDEMTileTimestamp[k]=Q.dem._timestamp),l.borderDoneWithNeighborZ[k]===U.canonical.z))continue;U.centroidVertexArray.length===0&&U.createCentroidsBuffer();const Y=(k<2?1:5)-k,ae=U.borderDoneWithNeighborZ[Y]!==l.canonical.z,W=U.borderFeatureIndices[Y];let J=0;if(l.canonical.z!==U.canonical.z){for(const ve of q)l.showCentroid(l.featuresOnBorder[ve]);if(ae)for(const ve of W)U.showCentroid(U.featuresOnBorder[ve]);l.borderDoneWithNeighborZ[k]=U.canonical.z,U.borderDoneWithNeighborZ[Y]=l.canonical.z;continue}const se=new Map,ue=new Set,he=new Set;for(let ve=0;ve<W.length;ve++){const xe=U.featuresOnBorder[W[ve]];xe.buildingId!==void 0&&se.set(xe.buildingId,ve)}for(const ve of q){const xe=l.featuresOnBorder[ve],Le=l.centroidData.get(xe.centroidDataIndex);if(xe.buildingId===void 0)continue;const _e=se.get(xe.buildingId);if(_e===void 0)continue;const Pe=U.featuresOnBorder[W[_e]],me=U.centroidData.get(Pe.centroidDataIndex);ue.add(ve),he.add(_e),m&&x(Le,me);const Re=Le.groupCentroidPos.x!==0||Le.groupCentroidPos.y!==0?Le.groupCentroidPos:xe.centroid(),Me=me.groupCentroidPos.x!==0||me.groupCentroidPos.y!==0?me.groupCentroidPos:Pe.centroid(),Ae=k<2?Math.round((Re.y+Me.y)/2):Math.round((Re.x+Me.x)/2),We=xe.intersectsCount()>1||Pe.intersectsCount()>1;{let ke=0;if(Q&&Q.dem&&!We){const Ue=z[k](Le,me),je=k%2?u.aj-1:0;ke=O(Ue[0],Math.min(u.aj-1,Ue[1]),je,Q,$,k<2,Ue[2])}Le.centroidXY=E(ke,k,Ae),me.centroidXY=E(ke,Y,Ae)}if(l.writeCentroidToBuffer(Le),U.writeCentroidToBuffer(me),xe.buildingId!==void 0){for(const ke of l.centroidData)ke.buildingId===xe.buildingId&&ke!==Le&&(ke.centroidXY=Le.centroidXY,l.writeCentroidToBuffer(ke));for(const ke of U.centroidData)ke.buildingId===xe.buildingId&&ke!==me&&(ke.centroidXY=me.centroidXY,U.writeCentroidToBuffer(ke))}}for(const ve of q){if(ue.has(ve))continue;const xe=l.featuresOnBorder[ve],Le=l.centroidData.get(xe.centroidDataIndex),_e=xe.borders[k];let Pe;for(;J<W.length;){if(he.has(J)){J++;continue}Pe=U.featuresOnBorder[W[J]];const me=Pe.borders[Y];if(me[1]>_e[0]+3||me[0]>_e[0]-3)break;U.showCentroid(Pe),J++}if(Pe&&J<W.length){let me=J,Re=0;for(;;)if(he.has(J)){if(++J===W.length)break;Pe=U.featuresOnBorder[W[J]]}else{if(Pe.borders[Y][0]>_e[1]-3||(Re++,++J===W.length))break;Pe=U.featuresOnBorder[W[J]]}for(;me<W.length&&he.has(me);)me++;if(me>=W.length){l.showCentroid(xe);continue}Pe=U.featuresOnBorder[W[me]];let Me=!1;if(Re>=1){const ke=Pe.borders[Y];Math.abs(_e[0]-ke[0])<3&&Math.abs(_e[1]-ke[1])<3&&(Re=1,Me=!0,J=me+1)}else if(Re===0){l.showCentroid(xe);continue}const Ae=U.centroidData.get(Pe.centroidDataIndex);m&&Me&&x(Le,Ae);const We=xe.intersectsCount()>1||Pe.intersectsCount()>1;if(Re>1)J=me,Le.centroidXY=Ae.centroidXY=new u.P(0,0);else if(Q&&Q.dem&&!We){const ke=z[k](Le,Ae),Ue=k%2?u.aj-1:0,je=O(ke[0],Math.min(u.aj-1,ke[1]),Ue,Q,$,k<2,ke[2]);Le.centroidXY=Ae.centroidXY=w(je)}else We?Le.centroidXY=Ae.centroidXY=new u.P(0,0):(Le.centroidXY=l.encodeBorderCentroid(xe),Ae.centroidXY=U.encodeBorderCentroid(Pe));l.writeCentroidToBuffer(Le),U.writeCentroidToBuffer(Ae)}else l.showCentroid(xe)}l.borderDoneWithNeighborZ[k]=U.canonical.z,U.borderDoneWithNeighborZ[Y]=l.canonical.z}(l.needsCentroidUpdate||!l.centroidVertexBuffer&&l.centroidVertexArray.length!==0)&&l.uploadCentroid(s)}const Ld=[1,0,0],dm=[0,1,0],fm=[0,0,1];function pm(s,t,n){const l=n.transform,d=n.shadowRenderer;if(!d)return!0;const p=n.frameCounter,m=n.currentShadowCascade;let g=n._shadowCullCache;if(!g||g.frame!==p||g.cascade!==m){const k=l.tileSize*d._cascades[m].scale,q=l.scaleZoom(k),$=d.shadowDirection,U=[$[0],$[1],-$[2]],Q=[Ld,dm,fm,U,[U[0],0,U[2]],[0,U[1],U[2]]];g={frame:p,cascade:m,cameraFrustum:u.bq.fromInvProjectionMatrix(l.invProjMatrix,l.worldSize,q,l.projection.name!=="globe"),edges:Q,shadowDir:U,ws:k,zoom:q},n._shadowCullCache=g}const{cameraFrustum:x,edges:w,shadowDir:E,ws:A,zoom:I}=g;let M=t;if(l.elevation){const k=l.elevation.getMinMaxForTile(s);k&&(M+=k.max)}M/=u.cc(l.center.lat,I);const D=d.computeSimplifiedTileShadowVolume(s.toUnwrapped(),M,A,E);if(!D)return!1;const{vertices:z,planes:O}=D;return x.intersectsPrecise(z,O,w)===0||d.getCurrentCascadeFrustum().intersectsPrecise(z,O,w)===0}const Dl=new Float32Array(16),$o=new Float32Array(16);function Sc(s){const{painter:t,source:n,layer:l,coords:d}=s;let p=s.defines;const m=t.context,g=t.renderPass==="shadow",x=t.renderPass==="light-beam",w=t.shadowRenderer,E=u.cc(t.transform.center.lat,t.transform.zoom),A=ps(t,l.paint.get("building-cutoff-fade-range"));A.shouldRenderCutoff&&(p=p.concat("RENDER_CUTOFF"));const I=l.paint.get("building-front-cutoff"),M=I[2]<1&&!t.terrain,D=Ec(t.transform.pitch,I,!!t.terrain);M&&(p=p.concat("RENDER_FRONT_CUTOFF"),t.maxFrontCutoffRawStart=Math.max(t.maxFrontCutoffRawStart,I[0])),s.floodLightIntensity>0&&(p=p.concat("FLOOD_LIGHT"));for(const z of d){const O=n.getTile(z),k=O.getBucket(l);if(!k)continue;w&&w.getMaxCascadeForTile(z.toUnwrapped())===0&&(p=p.concat("SHADOWS_SINGLE_CASCADE"));const q=k.programConfigurations.get(l.id);let $,U;const Q=t.translatePosMatrix(z.expandedProjMatrix,O,[0,0],"map");u.bL(Dl,Q,[1,1,s.verticalScale]);const Y=Dl;let ae;if(g&&w){if(pm(O.tileID,k.maxHeight*E,t))continue;const J=w.calculateShadowPassMatrixFromTile(O.tileID.toUnwrapped());u.bL(J,J,[1,1,s.verticalScale]),ae=Xp(J),$=U=t.getOrCreateProgram("buildingDepth",{config:q,defines:p,overrideFog:!1})}else if(x)$=U=t.getOrCreateProgram("buildingBloom",{config:q,defines:p,overrideFog:!1}),ae=$t(Y);else{const J=t.transform.calculatePosMatrix(z.toUnwrapped(),t.transform.worldSize);u.bL(J,J,[1,1,s.verticalScale]),u.bL($o,J,[1,-1,1/E]),u.aE($o,$o),u.cl($o,$o);const se=$o,ue=t.transform.getFreeCameraOptions().position,he=1<<z.canonical.z;if(ae=Wp(Y,se,s.opacity,s.facadeAOIntensity,[((ue.x-z.wrap)*he-z.canonical.x)*u.aj,(ue.y*he-z.canonical.y)*u.aj,ue.z*he*u.aj],k.tileToMeter,s.facadeEmissiveChance,s.floodLightColor,s.floodLightIntensity,D),U=t.getOrCreateProgram("building",{config:q,defines:p,overrideFog:!1}),s.depthOnly===!0)$=U;else{const ve=p.concat(["BUILDING_FAUX_FACADE","HAS_ATTRIBUTE_a_faux_facade_color_emissive"]);$=t.getOrCreateProgram("building",{config:q,defines:ve,overrideFog:!1})}w&&(w.setupShadowsFromMatrix(J,U,!0),$!==U&&$.setShadowUniformValues(m,w.getShadowUniformValues()))}const W=(J,se)=>{if(x){const ue=J.entranceBloom;se.draw(t,m.gl.TRIANGLES,s.depthMode,lt.disabled,s.blendMode,pt.disabled,ae,l.id,ue.layoutVertexBuffer,ue.indexBuffer,ue.segmentsBucket,l.paint,t.transform.zoom,q,[ue.layoutAttenuationBuffer,ue.layoutColorBuffer])}else{const ue=J.segmentsBucket;let he=[J.layoutNormalBuffer,J.layoutCentroidBuffer,J.layoutColorBuffer,J.layoutFloodLightDataBuffer];J.layoutFacadePaintBuffer&&(he=he.concat([J.layoutFacadeDataBuffer,J.layoutFacadeVerticalRangeBuffer,J.layoutFacadePaintBuffer])),se.draw(t,m.gl.TRIANGLES,s.depthMode,lt.disabled,s.blendMode,g?pt.disabled:pt.backCW,ae,l.id,J.layoutVertexBuffer,J.indexBuffer,ue,l.paint,t.transform.zoom,q,he)}};t.uploadCommonUniforms(m,U,z.toUnwrapped(),null,A),k.buildingWithoutFacade&&W(k.buildingWithoutFacade,U),k.buildingWithFacade&&($!==U&&t.uploadCommonUniforms(m,$,z.toUnwrapped(),null,A),W(k.buildingWithFacade,$))}}function Mn(s,t,n,l,d,p,m,g,x,w,E,A,I,M){const D=s.context.gl,z=s.depthModeForSublayer(1,nt.ReadOnly,D.LEQUAL,!0),O=u.ai(.1,3,E),k=s._showOverdrawInspector,q=A,$=new Hu;k||Ao($,s,t,n,l,z,new lt({func:D.ALWAYS,mask:255},255,255,D.KEEP,D.KEEP,D.REPLACE),new dt([D.ONE,D.ONE,D.ONE,D.ONE],u.C.transparent,[!1,!1,!1,!0],D.MIN),pt.disabled,d,"sdf",p,m,g,x,w,O,q,!1,void 0);{const U=k?lt.disabled:new lt({func:D.EQUAL,mask:255},255,255,D.KEEP,D.DECR,D.DECR),Q=k?s.colorModeForRenderPass():new dt([D.ONE_MINUS_DST_ALPHA,D.DST_ALPHA,D.ONE,D.ONE],u.C.transparent,[!0,!0,!0,!0]);Ao($,s,t,n,l,z,U,Q,pt.disabled,d,"color",p,m,g,x,w,O,q,!1,void 0)}}class Fd{constructor(){this._previousClosestBuildingId=null,this._hysteresisRatio=.8,this._indoorMinimumZoom=16}findClosestBuilding(t,n,l,d,p){if(l<this._indoorMinimumZoom)return this._previousClosestBuildingId=null,null;let m=null,g=Number.MAX_VALUE,x=Number.MAX_VALUE,w=!1;const E=this._previousClosestBuildingId?t[this._previousClosestBuildingId]:null;this._previousClosestBuildingId&&E&&this._isBuildingVisible(E,d,p)&&(w=!0,x=this._calculateDistance(n,E));for(const[A,I]of Object.entries(t)){if(!this._isBuildingVisible(I,d,p))continue;const M=this._calculateDistance(n,I);M<g&&(g=M,m=A)}return w&&m&&this._previousClosestBuildingId&&m!==this._previousClosestBuildingId?g>x*this._hysteresisRatio&&(m=this._previousClosestBuildingId):w&&!m&&(m=this._previousClosestBuildingId),this._previousClosestBuildingId=m,m}_calculateDistance(t,n){if(!n.center)return Number.MAX_VALUE;const l=t.lat-n.center[1],d=t.lng-n.center[0];return l*l+d*d}_isBuildingVisible(t,n,l){if(!l)return!1;for(const d of t.floorIds){const p=t.floors[d];if(!p.geometry)continue;const m=p.geometry;if(m.type==="Polygon"){const g=this._convertRingToPoints(m.coordinates[0]);if(u.cI(g,l))return!0}else if(m.type==="MultiPolygon"){const g=this._convertMultiPolygonToPoints(m.coordinates);if(u.cJ(l,g))return!0}}return!1}_convertRingToPoints(t){return t.map(n=>new u.P(n[0],n[1]))}_convertMultiPolygonToPoints(t){return t.map(n=>n.length===0?[]:n[0].map(l=>new u.P(l[0],l[1])))}}const ys=.05,Mg=(s,t,n,l,d,p,m,g,x,w,E,A)=>({u_matrix:s,u_normalize_matrix:t,u_globe_matrix:n,u_merc_matrix:l,u_grid_matrix:d,u_tl_parent:p,u_scale_parent:w,u_fade_t:E.mix,u_opacity:E.opacity,u_image0:0,u_image1:1,u_raster_elevation:A,u_zoom_transition:m,u_merc_center:g,u_cutoff_params:x}),$u=(s,t,n,l,d,p,m,g,x,w)=>({u_particle_texture:s,u_particle_texture_side_len:t,u_tile_offset:n,u_velocity:l,u_color_ramp:p,u_velocity_res:d,u_max_speed:m,u_uv_offset:g,u_data_scale:[255*x[0],255*x[1]],u_data_offset:w,u_particle_pos_scale:1.1,u_particle_pos_offset:[ys,ys]}),Od=(s,t,n,l,d,p,m,g,x,w)=>({u_particle_texture:s,u_particle_texture_side_len:t,u_velocity:n,u_velocity_res:l,u_max_speed:d,u_speed_factor:p,u_reset_rate:m,u_rand_seed:Math.random(),u_uv_offset:g,u_data_scale:[255*x[0],255*x[1]],u_data_offset:w,u_particle_pos_scale:1.1,u_particle_pos_offset:[ys,ys]});function Zu(s,[t,n,l,d],[p,m]){if(p===m)return[0,0,0,0];const g=255*(s-1)/(s*(m-p));return[t*g,n*g,l*g,d*g]}function Wu(s,t,[n,l]){return n===l?0:.5/s+(t-n)*(s-1)/(s*(l-n))}function Ic(s,t){const n={};if(!t)return n;for(const l of s){const d=l.layerIds.map(p=>t.getLayer(p)).filter(Boolean);if(d.length!==0){l.layers=d,l.stateDependentLayerIds&&(l.stateDependentLayers=l.stateDependentLayerIds.map(p=>d.filter(m=>m.id===p)[0])),l.updateExpressions&&l.updateExpressions(d);for(const p of d)n[p.fqid]=l}}return n}const Pn=32,ro=33,Co=new Uint16Array(8184);for(let s=0;s<2046;s++){let t=s+2,n=0,l=0,d=0,p=0,m=0,g=0;for(1&t?d=p=m=Pn:n=l=g=Pn;(t>>=1)>1;){const w=n+d>>1,E=l+p>>1;1&t?(d=n,p=l,n=m,l=g):(n=d,l=p,d=m,p=g),m=w,g=E}const x=4*s;Co[x+0]=n,Co[x+1]=l,Co[x+2]=d,Co[x+3]=p}const no=new Uint16Array(2178),xs=new Uint8Array(1089),Ac=new Uint16Array(1089);function Pa(s){return s===0?-.03125:s===32?.03125:0}var Xu=u.cQ([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Uint16",components:2}]);const mm={type:2,extent:u.aj,loadGeometry:()=>[[new u.P(0,0),new u.P(u.aj+1,0),new u.P(u.aj+1,u.aj+1),new u.P(0,u.aj+1),new u.P(0,0)]]};let Pg=0;class zl{constructor(t,n,l,d,p,m){this.tileID=t,this.uid=u.am(),this.uses=0,this.tileSize=n,this.tileZoom=l,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasTunnelGeometry=!1,this.hasRTLText=!1,this.dependencies={},this.isRaster=p,d&&d.style&&(this._lastUpdatedBrightness=d.style.getBrightness()),this._lastAvailableImagesCount=0,this._firstPrepareComplete=!1,this.expiredRequestCount=0,this.state="loading",d&&d.transform&&(this.projection=d.transform.projection),this.worldview=m,this._hasAppearances=null}registerFadeDuration(t){const n=t+this.timeAdded;n<u.r.now()||this.fadeEndTime!==void 0&&n<this.fadeEndTime||(this.fadeEndTime=n)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}get tileTransform(){return this._tileTransform||(this._tileTransform=u.cN(this.tileID.canonical,this.projection)),this._tileTransform}loadVectorData(t,n,l){if(this.unloadVectorData(),this.state="loaded",t){t.featureIndex&&(this.latestFeatureIndex=t.featureIndex,t.rawTileData?(this.latestRawTileData=t.rawTileData,this.latestFeatureIndex.rawTileData=t.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=t.collisionBoxArray,this.buckets=Ic(t.buckets,n.style),t.frcCoveragePolygons&&t.frcCoveragePolygons.length>0&&(this.frcCoveragePolygons=t.frcCoveragePolygons),this.hasDeferredRoadStructure=!!t.hasDeferredRoadStructure,t.parsedElevationFeatures!==void 0&&(this.parsedElevationFeatures=t.parsedElevationFeatures,this.parsedElevationGeneration=++Pg),this.hasDeferredElevationFeatures=!!t.hasDeferredElevationFeatures,this.hasSymbolBuckets=!1,this.hasTunnelGeometry=!!t.hasTunnelGeometry;for(const d in this.buckets){const p=this.buckets[d];if(p instanceof u.cS){if(this.hasSymbolBuckets=!0,!l)break;p.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const d in this.buckets){const p=this.buckets[d];if(p instanceof u.cS&&p.hasRTLText){this.hasRTLText=!0,u.cT();break}}this.queryPadding=0;for(const d in this.buckets){const p=this.buckets[d],m=n.style.getOwnLayer(d);if(!m)continue;const g=m.queryRadius(p)||0;this.queryPadding=Math.max(this.queryPadding,g)}t.imageAtlas&&(this.imageAtlas=n.style.imageManager.imageAtlasCache.getOrCache(t.imageAtlas)),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage),t.lineAtlas&&(this.lineAtlas=t.lineAtlas),this._lastUpdatedBrightness=t.brightness}else this.collisionBoxArray=new u.cR}unloadVectorData(){if(this.hasData()){for(const t in this.buckets)this.buckets[t].destroy();this.buckets={},this.imageAtlas&&(this.imageAtlas=null),this.lineAtlas&&(this.lineAtlas=null),this.imageAtlasTexture&&(this.imageAtlasTexture=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(t,n,l){t&&(t.resourceTiming&&(this.resourceTiming=t.resourceTiming),this.buckets={...this.buckets,...Ic(t.buckets,n.style)},t.featureIndex&&(this.latestFeatureIndex=t.featureIndex))}getBucket(t){return this.buckets[t.fqid]}upload(t,n){for(const p in this.buckets){const m=this.buckets[p];if(m.uploadPending()){let g={},x=[],w={zoom:0,pitch:0,brightness:0,worldview:""};if(n){if(n.style){x=n.style.listImages();const E=m.layers[0],A=E.sourceLayer||"_geojsonTileLayer",I=n.style.getLayerSourceCache(E);I&&(g=I._state.getState(A,void 0))}w={zoom:n.transform.zoom||0,pitch:n.transform.pitch||0,brightness:n.style.getBrightness()||0,worldview:n.worldview||""}}m.upload(t,this.tileID.canonical,g,x,w)}}const l=t.gl,d=this.imageAtlas;d&&n&&(this.imageAtlasTexture=n.style.imageManager.imageAtlasCache.getTextureForAtlas(d,t,l.RGBA8),d.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new u.T(t,this.glyphAtlasImage,l.R8),this.glyphAtlasImage=null),this.lineAtlas&&!this.lineAtlas.uploaded&&(this.lineAtlasTexture=new u.T(t,this.lineAtlas.image,l.R8),this.lineAtlas.uploaded=!0)}prepare(t,n,l){if(this.imageAtlas&&this.imageAtlasTexture&&n){const I=n.style.getLut(l);this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture,l,I)}if(!n||!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData)return;const d=n.style.getBrightness(),p=n.style.listImages(),m=p.length,g=n.style._changes.getUpdatedPaintProperties(),x=Object.keys(this.buckets).some(I=>this.buckets[I].layers.some(M=>g.has(M.fqid))),w=Object.keys(this.buckets).some(I=>this.buckets[I].layers.some(M=>M.hasTransition&&M.hasTransition())),E=this._firstPrepareComplete&&m!==this._lastAvailableImagesCount;this._hasAppearances===null&&(this._hasAppearances=this.hasAppearances(n));const A=this._lastUpdatedBrightness!==d;this._lastAvailableImagesCount=m,this._firstPrepareComplete=!0,(this._lastUpdatedBrightness||d||this._hasAppearances||x||w||E)&&(!(this._hasAppearances||x||w||E)&&this._lastUpdatedBrightness&&d&&Math.abs(this._lastUpdatedBrightness-d)<.001||(this.updateBuckets(n,A,void 0,E||x||w,g,p),this._lastUpdatedBrightness=d))}evaluateQueryRenderedFeaturePadding(){let t=0;for(const n in this.buckets){const l=this.buckets[n];l.evaluateQueryRenderedFeaturePadding&&(t=Math.max(t,l.evaluateQueryRenderedFeaturePadding()))}return t}queryRenderedFeatures(t,n,l,d,p,m,g){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData&&!this.latestFeatureIndex.is3DTile)return{};const x=this.evaluateQueryRenderedFeaturePadding(),w=(function(E,A){const I=u.aF([],[.5*E.width,.5*-E.height,1]);return u.aG(I,I,[1,-1,0]),u.aP(I,I,E.calculateProjMatrix(A.toUnwrapped())),Float32Array.from(I)})(p,this.tileID);return this.latestFeatureIndex.query(t,{tilespaceGeometry:n,pixelPosMatrix:w,transform:d,availableImages:l,tileTransform:this.tileTransform,worldview:this.worldview,queryRadius:x,scope:g})}querySourceFeatures(t,n){const l=this.latestFeatureIndex;if(!l||!l.rawTileData)return;const d=l.loadVTLayers(),p=n?n.sourceLayer:"",m=d._geojsonTileLayer||d[p];if(!m)return;const g=u.cU(n&&n.filter),{z:x,x:w,y:E}=this.tileID.canonical,A={z:x,x:w,y:E};for(let I=0;I<m.length;I++){const M=m.feature(I);if(g.needGeometry){const O=u.cV(M,!0);if(!g.filter(new u.aa(this.tileID.overscaledZ,{worldview:this.worldview}),O,this.tileID.canonical))continue}else if(!g.filter(new u.aa(this.tileID.overscaledZ,{worldview:this.worldview}),M))continue;const D=l.getId(M,p),z=new u.cW(M,x,w,E,D);z.tile=A,t.push(z)}}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(t){const n=this.expirationTime;if(t.cacheControl){const l=u.cX(t.cacheControl);l["max-age"]&&(this.expirationTime=Date.now()+1e3*l["max-age"])}else t.expires&&(this.expirationTime=new Date(t.expires).getTime());if(this.expirationTime){const l=Date.now();let d=!1;if(this.expirationTime>l)d=!1;else if(n)if(this.expirationTime<n)d=!0;else{const p=this.expirationTime-n;p?this.expirationTime=l+Math.max(p,3e4):d=!0}else d=!0;d?(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(t,n){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData&&!this.latestFeatureIndex.is3DTile||!t)return;const l=t.style.listImages();this.updateBuckets(t,!1,n,void 0,void 0,l)}hasAppearances(t){for(const n in this.buckets)if(t.style.hasLayer(n)&&this.buckets[n].layers.some(l=>l.appearances&&l.appearances.length>0))return!0;return!1}updateBuckets(t,n,l,d,p,m){if(!this.latestFeatureIndex||!t.style)return;const g=m||t.style.listImages(),x=t.style.getBrightness(),w=p||new Set;for(const E in this.buckets){if(!t.style.hasLayer(E))continue;const A=this.buckets[E],I=A.layers[0],M=I.sourceLayer||"_geojsonTileLayer",D=t.style.getLayerSourceCache(I),z=A.layers.some(Y=>w.has(Y.fqid)),O=(d||z)&&A instanceof u.cS?t.style.getOwnLayer(E):void 0;let k=l&&l[M]||{};D&&!l&&(k=D._state.getState(M,void 0));const q=this.imageAtlas?Object.fromEntries(this.imageAtlas.patternPositions):{},$=Object.keys(k).length>0&&!n;A.hasAppearances=A.layers.some(Y=>Y.appearances&&Y.appearances.length>0);const U=$?A.stateDependentLayers:A.layers;if($&&A.stateDependentLayers.length!==0||n||z||d){const Y=this.latestFeatureIndex.loadVTLayers()[M];if(A.update(k,Y,g,q,U,n,x,this.tileID.canonical),(d||z)&&(!n||n&&A instanceof u.cS&&(!A.text.uboBinder||A.text.uboBinder.isLightConstant||!A.icon.uboBinder||A.icon.uboBinder.isLightConstant))&&A instanceof u.cS&&O&&O.type==="symbol"){const ae=A;ae.text&&ae.text.uboBinder&&ae.text.uboBinder.updateDynamicExpressions(O,Y,this.tileID.canonical,g,k,x),ae.icon&&ae.icon.uboBinder&&ae.icon.uboBinder.updateDynamicExpressions(O,Y,this.tileID.canonical,g,k,x)}if(A instanceof u.cS){const ae=A,W=t.context;ae.text&&ae.text.uboBinder&&ae.text.uboBinder.upload(W),ae.icon&&ae.icon.uboBinder&&ae.icon.uboBinder.upload(W)}}if($&&A.stateDependentLayers.length!==0||n||A.hasAppearances){const Y={zoom:t.transform.zoom,pitch:t.transform.pitch,brightness:t.style.getBrightness()||0,worldview:t.worldview},ae=A.updateAppearances(this.tileID.canonical,k,g,Y,t.imageManager,$&&A.stateDependentLayers.length!==0);if(ae&&ae.hasUboChanges){const W=t.context;A instanceof u.cS&&A.text&&A.text.uboBinder&&A.text.uboBinder.upload(W),A instanceof u.cS&&A.icon&&A.icon.uboBinder&&A.icon.uboBinder.upload(W)}}(A instanceof u.cY||A instanceof u.cZ)&&t._terrain&&t._terrain.enabled&&D&&A.uploadPending()&&t._terrain._clearRenderCacheForTile(D.id,this.tileID);const Q=t&&t.style&&t.style.getOwnLayer(E);Q&&(this.queryPadding=Math.max(this.queryPadding,Q.queryRadius(A)||0))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<u.r.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(t){this.symbolFadeHoldUntil=u.r.now()+t}setTexture(t,n){const l=n.context,d=l.gl;this.texture=this.texture||n.getTileTexture(t.width),this.texture&&this.texture instanceof u.T?this.texture.update(t):(this.texture=new u.T(l,t,d.RGBA8,{useMipmap:!0}),this.texture.bind(d.LINEAR,d.CLAMP_TO_EDGE))}setDependencies(t,n){const l={};for(const d of n)l[d]=!0;this.dependencies[t]=l}hasDependency(t,n){for(const l of t){const d=this.dependencies[l];if(d){for(const p of n)if(d[p])return!0}}return!1}clearQueryDebugViz(){}_makeDebugTileBoundsBuffers(t,n){if(!n||n.name==="mercator"||this._tileDebugBuffer)return;const l=u.c_(mm,this.tileID.canonical,this.tileTransform)[0],d=new u.co,p=new u.c$;for(let m=0;m<l.length;m++){const{x:g,y:x}=l[m];d.emplaceBack(g,x),p.emplaceBack(m)}p.emplaceBack(0),this._tileDebugIndexBuffer=t.createIndexBuffer(p),this._tileDebugBuffer=t.createVertexBuffer(d,u.cq.members),this._tileDebugSegments=u.cr.simpleSegment(0,0,d.length,p.length)}_makeTileBoundsBuffers(t,n){if(this._tileBoundsBuffer||!n||n.name==="mercator")return;const l=u.c_(mm,this.tileID.canonical,this.tileTransform)[0];let d,p;if(this.isRaster){const m=(function(g,x){const w=u.cN(g,x),E=Math.pow(2,g.z);for(let O=0;O<ro;O++)for(let k=0;k<ro;k++){const q=u.cO((g.x+(k+Pa(k))/Pn)/E),$=u.aM((g.y+(O+Pa(O))/Pn)/E),U=x.project(q,$),Q=O*ro+k;no[2*Q+0]=Math.round((U.x*w.scale-w.x)*u.aj),no[2*Q+1]=Math.round((U.y*w.scale-w.y)*u.aj)}xs.fill(0),Ac.fill(0);for(let O=2045;O>=0;O--){const k=4*O,q=Co[k+0],$=Co[k+1],U=Co[k+2],Q=Co[k+3],Y=q+U>>1,ae=$+Q>>1,W=Y+ae-$,J=ae+q-Y,se=$*ro+q,ue=Q*ro+U,he=ae*ro+Y,ve=Math.hypot((no[2*se+0]+no[2*ue+0])/2-no[2*he+0],(no[2*se+1]+no[2*ue+1])/2-no[2*he+1])>=16;xs[he]=xs[he]||(ve?1:0),O<1022&&(xs[he]=xs[he]||xs[($+J>>1)*ro+(q+W>>1)]||xs[(Q+J>>1)*ro+(U+W>>1)])}const A=new u.cP,I=new u.cp;let M=0;function D(O,k){const q=k*ro+O;return Ac[q]===0&&(A.emplaceBack(no[2*q+0],no[2*q+1],O*u.aj/Pn,k*u.aj/Pn),Ac[q]=++M),Ac[q]-1}function z(O,k,q,$,U,Q){const Y=O+q>>1,ae=k+$>>1;if(Math.abs(O-U)+Math.abs(k-Q)>1&&xs[ae*ro+Y])z(U,Q,O,k,Y,ae),z(q,$,U,Q,Y,ae);else{const W=D(O,k),J=D(q,$),se=D(U,Q);I.emplaceBack(W,J,se)}}return z(0,0,Pn,Pn,Pn,0),z(Pn,Pn,0,0,0,Pn),{vertices:A,indices:I}})(this.tileID.canonical,n);d=m.vertices,p=m.indices}else{d=new u.cP,p=new u.cp;for(const{x:g,y:x}of l)d.emplaceBack(g,x,0,0);const m=u.d0(d.int16.subarray(0,4*d.length),void 0,4);for(let g=0;g<m.length;g+=3)p.emplaceBack(m[g],m[g+1],m[g+2])}this._tileBoundsBuffer=t.createVertexBuffer(d,Xu.members),this._tileBoundsIndexBuffer=t.createIndexBuffer(p),this._tileBoundsSegments=u.cr.simpleSegment(0,0,d.length,p.length)}_makeGlobeTileDebugBuffers(t,n){const l=n.projection;if(!l||l.name!=="globe"||n.freezeTileCoverage)return;const d=this.tileID.canonical,p=u.d1(d,n),m=u.d2(p),g=u.ah(n.zoom);let x;g>0&&(x=u.aE(new Float64Array(16),n.globeMatrix)),this._makeGlobeTileDebugBorderBuffer(t,d,n,m,x,g),this._makeGlobeTileDebugTextBuffer(t,d,n,m,x,g)}_globePoint(t,n,l,d,p,m,g){let x=u.d3(t,n,l);if(m){const w=1<<l.z,E=u.bE(d.center.lng),A=u.bF(d.center.lat),I=(l.x+.5)/w-E;let M=0;I>.5?M=-1:I<-.5&&(M=1);let D=(t/u.aj+l.x)/w+M,z=(n/u.aj+l.y)/w;D=(D-E)*d._pixelsPerMercatorPixel+E,z=(z-A)*d._pixelsPerMercatorPixel+A;const O=[D*d.worldSize,z*d.worldSize,0];u.ad(O,O,m),x=u.d4(x,O,g)}return u.ad(x,x,p)}_makeGlobeTileDebugBorderBuffer(t,n,l,d,p,m){const g=new u.co,x=new u.c$,w=new u.d5,E=(I,M,D,z,O)=>{const k=(D-I)/(O-1),q=(z-M)/(O-1),$=g.length;for(let U=0;U<O;U++){const Q=I+U*k,Y=M+U*q;g.emplaceBack(Q,Y);const ae=this._globePoint(Q,Y,n,l,d,p,m);w.emplaceBack(ae[0],ae[1],ae[2]),x.emplaceBack($+U)}},A=u.aj;E(0,0,A,0,16),E(A,0,A,A,16),E(A,A,0,A,16),E(0,A,0,0,16),this._tileDebugIndexBuffer=t.createIndexBuffer(x),this._tileDebugBuffer=t.createVertexBuffer(g,u.cq.members),this._globeTileDebugBorderBuffer=t.createVertexBuffer(w,u.d6.members),this._tileDebugSegments=u.cr.simpleSegment(0,0,g.length,x.length)}_makeGlobeTileDebugTextBuffer(t,n,l,d,p,m){const g=u.aj/4,x=new u.co,w=new u.cp,E=new u.d5,A=25;w.reserve(32),x.reserve(A),E.reserve(A);const I=(M,D)=>A*M+D;for(let M=0;M<A;M++){const D=M*g;for(let z=0;z<A;z++){const O=z*g;x.emplaceBack(O,D);const k=this._globePoint(O,D,n,l,d,p,m);E.emplaceBack(k[0],k[1],k[2])}}for(let M=0;M<4;M++)for(let D=0;D<4;D++){const z=I(M,D),O=I(M,D+1),k=I(M+1,D),q=I(M+1,D+1);w.emplaceBack(z,O,k),w.emplaceBack(k,O,q)}this._tileDebugTextIndexBuffer=t.createIndexBuffer(w),this._tileDebugTextBuffer=t.createVertexBuffer(x,u.cq.members),this._globeTileDebugTextBuffer=t.createVertexBuffer(E,u.d6.members),this._tileDebugTextSegments=u.cr.simpleSegment(0,0,A,32)}destroy(t=!0){for(const n in this.buckets)this.buckets[n].destroy(t);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),t&&this.texture&&this.texture instanceof u.T&&(this.texture.destroy(),delete this.texture),this.emissiveTexture&&this.emissiveTexture instanceof u.T&&(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.d7.setPbf(u.d8);class Bd extends zl{constructor(t,n,l,d,p){super(t,n,l,d,p),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,n,l){const d=l.context,p=d.gl;let m=this.texturePerLayer.get(t)||l.getTileTexture(n.width);m&&m instanceof u.T?m.update(n,{premultiply:!1}):m=new u.T(d,n,p.RGBA8,{premultiply:!1}),this.texturePerLayer.has(t)||this.texturePerLayer.set(t,m)}flushQueues(t){const n=this._workQueuePerLayer.get(t)||[],l=this._fetchQueuePerLayer.get(t)||[];for(;n.length;)n.pop()();for(;l.length;)l.pop()()}flushAllQueues(){for(const t of this._workQueuePerLayer.keys()){const n=this._workQueuePerLayer.get(t)||[];for(;n.length;)n.pop()()}for(const t of this._fetchQueuePerLayer.keys()){const n=this._fetchQueuePerLayer.get(t)||[];for(;n.length;)n.pop()()}}fetchHeader(t=16384,n){const l=this._mrt=new u.d7(30),d={...this.requestParams,headers:{Range:"bytes=0-"+(t-1)}};this.entireBuffer=null;const p=new AbortController;return this.request=p,u.d9(d,p.signal).then(({data:m,headers:g})=>{try{const x=l.getHeaderLength(m);if(x>t)return void(this.request=this.fetchHeader(x,n));l.parseHeader(m),this._isHeaderLoaded=!0;let w=0;for(const E of Object.values(l.layers))w=Math.max(w,E.dataIndex.at(-1).lastByte);m.byteLength>=w&&(this.entireBuffer=m),n(null,this.entireBuffer||m,g)}catch(x){n(x)}}).catch(m=>{p.signal.aborted||n(m)}),this.request}fetchBandForRender(t,n,l,d){this.fetchBand(t,n,l,p=>{if(p)return void d(p);this.updateTextureDescriptor(t,n,l);const m=this.textureDescriptorPerLayer.get(n);d(null,m?m.img:null)})}fetchBand(t,n,l,d){const p=this._mrt;if(!this._isHeaderLoaded||!p)return void d(new Error("Tile header is not ready"));const m=this.actor;if(!m)return void d(new Error("Can't fetch tile band without an actor"));let g;const x=u.y(String(l),u.y(this.tileID.key,t));let w=this._taskQueue.get(x);w?w.add(d):(w=new Set,w.add(d),this._taskQueue.set(x,w));const E=(D,z)=>{g.complete(D,z),D?d(D):(w.forEach(O=>O(null,z)),this._taskQueue.delete(x))},A=(D,z)=>{if(D)return d(D);const O=m.sendCancelable("decodeRasterArray",{type:"raster-array",source:this.source,scope:this.scope,tileID:this.tileID,uid:this.uid,buffer:z,task:g},{},E);if(n!==null){const k=this._workQueuePerLayer.get(n)||[];k.push(()=>{O.abort(),g.cancel()}),this._workQueuePerLayer.has(n)||this._workQueuePerLayer.set(n,k)}};let I;try{I=p.getLayer(t)}catch(D){if(this.state==="reloading")return;throw D}if(!I)return void d(new Error(`Unknown sourceLayer "${t}"`));if(I.hasDataForBand(l))return w.forEach(D=>D(null,null)),void this._taskQueue.delete(x);const M=I.getDataRange([l]);if(g=p.createDecodingTask(M),!g||g.tasks.length)if(n!==null&&this.flushQueues(n),this.entireBuffer)A(null,this.entireBuffer.slice(M.firstByte,M.lastByte+1));else{const D={...this.requestParams,headers:{Range:`bytes=${M.firstByte}-${M.lastByte}`}},z=new AbortController;if(u.d9(D,z.signal).then(({data:O})=>A(null,O)).catch(O=>{z.signal.aborted||A(O)}),n!==null){const O=this._fetchQueuePerLayer.get(n)||[];O.push(()=>{z.abort(),g.cancel()}),this._fetchQueuePerLayer.has(n)||this._fetchQueuePerLayer.set(n,O)}}}updateNeeded(t,n){return(!this.textureDescriptorPerLayer.get(t)||this.textureDescriptorPerLayer.get(t).band!==n||this.refreshedUponExpiration)&&this.state!=="errored"}updateTextureDescriptor(t,n,l){if(!this._mrt)return;const d=this._mrt.getLayer(t);if(!d||!d.hasBand(l)||!d.hasDataForBand(l))return;const{bytes:p,tileSize:m,buffer:g,offset:x,scale:w}=d.getBandView(l),E=m+2*g,A=new u.t({width:E,height:E},p),I=this.texturePerLayer.get(n);I&&I instanceof u.T&&I.update(A,{premultiply:!1}),this.textureDescriptorPerLayer.set(n,{layer:t,band:l,img:A,buffer:g,offset:x,tileSize:m,format:d.pixelFormat,mix:[w,256*w,65536*w,16777216*w]})}destroy(t=!1){if(super.destroy(t),delete this._mrt,!t)for(const n of this.texturePerLayer.values())n&&n instanceof u.T&&n.destroy();this.texturePerLayer.clear(),this.textureDescriptorPerLayer.clear(),this.fbo&&(this.fbo.destroy(),delete this.fbo),delete this.request,delete this.requestParams,this._isHeaderLoaded=!1}}function _m(s,t){const n=Math.pow(2,t.z),l=Math.floor(u.bE(s.getWest())*n),d=Math.floor(u.bF(s.getNorth())*n),p=Math.ceil(u.bE(s.getEast())*n),m=Math.ceil(u.bF(s.getSouth())*n);return t.x>=l&&t.x<p&&t.y>=d&&t.y<m}class Xs{constructor(t,n,l){this.bounds=t?u.bD.convert(this.validateBounds(t)):null,this.minzoom=n||0,this.maxzoom=l||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 n of t)this.extraBounds.push(u.bD.convert(this.validateBounds(n)))}}contains(t){if(t.z>this.maxzoom||t.z<this.minzoom||this.bounds&&!_m(this.bounds,t))return!1;if(!this.extraBounds)return!0;for(const n of this.extraBounds)if(_m(n,t))return!0;return!1}static fromTileJSON(t){if(!t.bounds&&!t.extra_bounds)return null;const n=new Xs(t.bounds,t.minzoom,t.maxzoom);return n.addExtraBounds(t.extra_bounds),n}}class Ll extends u.E{constructor(t,n,l,d){super(),this.id=t,this.dispatcher=l,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={type:"raster",...n},Object.assign(this,u.b3(n,["url","scheme","tileSize"]))}load(t){this._loaded=!1,this.fire(new u.B("dataloading",{dataType:"source"}));const n=this.map.getWorldview(),l=(p,m)=>{this._tileJSONRequest=null,this._loaded=!0,p?this.fire(new u.A(p)):m&&(Object.assign(this,m),m.raster_layers&&(this.rasterLayers=m.raster_layers,this.rasterLayerIds=this.rasterLayers.map(g=>g.id)),this.tileBounds=Xs.fromTileJSON(m),Bs(m.tiles),this.fire(new u.B("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new u.B("data",{dataType:"source",sourceDataType:"content"}))),t&&t(p)};this.provider=typeof this._options.provider=="string"?this._options.provider:void 0,this._tileProvider=void 0;const d=u.da(this._options);return d instanceof Error?(this._loaded=!0,this.fire(new u.A(d)),void(t&&t())):this.provider&&!d?(this._loaded=!0,this.fire(new u.A(new Error(`TileProvider "${this.provider}" is not registered`))),void(t&&t())):void(this._tileJSONRequest=d?this.loadTileJSONWithProvider(d,l):u.db(this._options,this.map._requestManager,null,n,l))}loadTileJSONWithProvider(t,n){this.provider=t.name;const l=new AbortController;return(async()=>{const{request:d,options:p}=await u.de(this._options,this.map._requestManager,l.signal);if(l.signal.aborted)return;const m=await u.df(t.name,t.url);if(l.signal.aborted)return;const g=new m(p);let x=null;if(g.load&&d&&(x=await g.load({request:d}),l.signal.aborted))return;this._tileProvider=g;const w=u.dg(this._options,x,this.map._requestManager);w instanceof Error?n(w):n(null,w)})().catch(d=>{l.signal.aborted||n(new Error(`Could not load tile provider ${t.name}`,{cause:d}))}),{cancel:()=>l.abort()}}loaded(){return this._loaded}onAdd(t){this.map=t,this.load()}reload(){this.cancelTileJSONRequest();const t=u.y(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{...this._options}}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}async loadTile(t,n){const l=u.r.devicePixelRatio>=2,d=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,this.scheme),l,this.tileSize),p=new AbortController;if(t.request=p,this._tileProvider)this.loadTileWithProvider(t,this._tileProvider,d,p,n);else try{const m=await this.map._requestManager.transformRequest(d,u.R.Tile,p.signal);if(p.signal.aborted)return delete t.request,n(null);const{data:g,headers:x}=await u.q(m,p.signal);if(delete t.request,t.aborted)return n(null);const w=u.dc(x);this.map._refreshExpiredTiles&&t.setExpiryData(w),t.setTexture(g,this.map.painter),t.state="loaded",u.dd(this.dispatcher),n(null)}catch(m){if(delete t.request,p.signal.aborted)return n(null);t.state="errored",n(m)}}async loadTileWithProvider(t,n,l,d,p){const{z:m,x:g,y:x}=t.tileID.canonical;try{const w=await this.map._requestManager.transformRequest(l,u.R.Tile,d.signal);if(d.signal.aborted)return p(null);const E=await n.loadTile({z:m,x:g,y:x},{request:w,signal:d.signal});if(d.signal.aborted)return p(null);if(E==null){const I=new Error("Tile not found");return I.status=404,t.state="errored",p(I)}if(E.data==null)return t.state="loaded",p(null);const A=E.data instanceof ImageBitmap?E.data:await createImageBitmap(new Blob([E.data]));if(d.signal.aborted)return p(null);t.setTexture(A,this.map.painter),t.state="loaded",this.map._refreshExpiredTiles&&t.setExpiryData({cacheControl:E.cacheControl,expires:E.expires}),p(null)}catch(w){if(d.signal.aborted)return p(null);t.state="errored",p(new Error(`Could not load tile from ${l}`,{cause:w}))}finally{delete t.request}}abortTile(t,n){t.request&&(t.request.abort(),delete t.request),n&&n()}unloadTile(t,n){t.texture&&t.texture instanceof u.T?(t.destroy(!1),t.texture&&t.texture instanceof u.T&&this.map.painter.saveTileTexture(t.texture)):t.destroy(),n&&n()}hasTransition(){return!1}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}function kd([s,t],n,l,{scaled:d=!0}={}){const{tileSize:p,buffer:m}=l,{x:g,y:x,z:w}=n;if(!isFinite(g)||!isFinite(x)||!isFinite(w))throw new Error("Invalid MRT header");const E=2**w,A=E*u.bE(s),I=E*u.bF(t);return(function([M,D],z,{scaled:O=!0}={}){if(!z)throw new Error("bandView is undefined");const{data:k,tileSize:q,buffer:$,offset:U,scale:Q,dimension:Y}=z;if(M<-$||M>q+$||D<-$||D>q+$)throw new Error(`Point (${M}, ${D}) out of bounds for tileSize=${q}, buffer=${$}`);const ae=(D+$)*(q+2*$)+(M+$);if(new Uint32Array(k.buffer)[ae]===4294967295)return null;let W=[];W=O?[]:new z.data.constructor(Y);for(let J=0;J<Y;J++)W[J]=Math.round(1e12*(k[Y*ae+J]*Q+U))/1e12;return W})([Math.min(Math.max(-m,Math.floor((A-g)*p)),p-1+m),Math.min(Math.max(-m,Math.floor((I-x)*p)),p-1+m)],l,{scaled:d})}class Mo extends Ll{constructor(t,n,l,d){super(t,n,l,d),this.type="raster-array",this.maxzoom=22,this.partial=!0,this._loadTilePending={},this._loadTileLoaded={},this._options={type:"raster-array",...n}}triggerRepaint(t){const n=this.map.painter._terrain,l=this.map.style.getSourceCache(this.id);n&&n.enabled&&l&&n._clearRenderCacheForTile(l.id,t.tileID),this.map.triggerRepaint()}async loadTile(t,n){const l=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize);t.source=this.id,t.scope=this.scope,t.actor||(t.actor=this.dispatcher.getActor());const d=new AbortController;t.request=d;const p=(m,g,x)=>{if(delete t.request,t.aborted)return n(null);if(m)return t.state="errored",n(m);if(this.map._refreshExpiredTiles&&g&&t.setExpiryData(u.dc(x)),this.partial&&t.state!=="expired")t.state="empty";else if(!this.partial){if(!g)return n(null);t.state="loaded",t._isHeaderLoaded=!0,t._mrt=g}n(null)};try{const m=await this.map._requestManager.transformRequest(l,u.R.Tile,d.signal);if(d.signal.aborted)return n(null);t.requestParams=m;const g={request:m,uid:t.uid,tileID:t.tileID,type:this.type,source:this.id,scope:this.scope,partial:this.partial};t.request=this.partial?t.fetchHeader(void 0,(x,w,E)=>{p(x,w,E)}):t.actor.sendCancelable("loadTile",g,{},(x,w)=>x?p(x):w?void p(null,w.mrt,w.headers):p(null,null))}catch(m){if(d.signal.aborted)return n(null);t.state="errored",n(m)}}abortTile(t){t.request&&(t.request.abort(),delete t.request),t.actor&&t.actor.notify("abortTile",{uid:t.uid,type:this.t
3032ype,source:this.id,scope:this.scope})}unloadTile(t,n){const l=t.texturePerLayer;if(t.flushAllQueues(),l.size){t.destroy(!1);for(const d of l.values())this.map.painter.saveTileTexture(d)}else t.destroy()}prepareTile(t,n,l,d){t._isHeaderLoaded&&(t.state!=="empty"&&(t.state="reloading"),t.fetchBandForRender(n,l,d,(p,m)=>{p?(t.state="errored",this.fire(new u.A(p))):m&&(t._isHeaderLoaded=!0,t.setTexturePerLayer(l,m,this.map.painter),t.state="loaded"),this.triggerRepaint(t)}))}getInitialBand(t){if(!this.rasterLayers)return 0;const n=this.rasterLayers.find(({id:p})=>p===t),l=n&&n.fields,d=l&&l.bands&&l.bands;return d?d[0]:0}getTextureDescriptor(t,n,l){if(!t)return;const d=n.sourceLayer||this.rasterLayerIds&&this.rasterLayerIds[0];if(!d)return;let p=null;n instanceof u.dh?p=n.paint.get("raster-array-band"):n instanceof u.di&&(p=n.paint.get("raster-particle-array-band"));const m=p||this.getInitialBand(d);if(m!=null)if(t.textureDescriptorPerLayer.get(n.id)){if(!t.updateNeeded(n.id,m)||l)return{...t.textureDescriptorPerLayer.get(n.id),texture:t.texturePerLayer.get(n.id)}}else this.prepareTile(t,d,n.id,m)}getImages(t,n){const l=new Map;for(const d of t)for(const p of n){const[m,g]=p.split("/"),x=d.getLayer(m);if(!x||!x.hasBand(g)||!x.hasDataForBand(g))continue;const{bytes:w,tileSize:E,buffer:A}=x.getBandView(g),I=E+2*A,M={data:new u.t({width:I,height:I},w),pixelRatio:2,sdf:!1,usvg:!1,version:0};l.set(p,M)}return l}queryRasterArrayValueByBandId(t,n,l){const d=n._mrt;return new Promise(p=>{const m={},g=new Set;for(const[x,w]of Object.entries(d.layers)){if(l.layerName&&x!==l.layerName)continue;const E={};m[x]=E;for(const{bands:A}of w.dataIndex)for(const I of A)l.bands&&!l.bands.includes(I)||(g.add(u.y(x,I)),n.fetchBand(x,null,I,M=>{u.r.frame(()=>{E[I]=M?null:kd([t.lng,t.lat],d,w.getBandView(I)),g.delete(u.y(x,I)),g.size===0&&p(m)})}))}g.size===0&&p(m)})}_loadTileForQuery(t){if(this._loadTileLoaded[t.uid])return Promise.resolve(t._mrt);if(t.uid in this._loadTilePending)return this._loadTilePending[t.uid];const n=this._fetchTileForQuery(t);return this._loadTilePending[t.uid]=n,n}async _fetchTileForQuery(t){const n=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize);try{const l={request:await this.map._requestManager.transformRequest(n,u.R.Tile),uid:t.uid,tileID:t.tileID,type:this.t
vendor: 6,078 bytes, lines 3032-3053
3032ype,source:this.id,scope:this.scope,partial:!1},d=await t.actor.send("loadTile",l);if(!d)return null;const p=d.mrt;return this.map._refreshExpiredTiles&&t.setExpiryData(u.dc(d.headers)),t._mrt=p,t._isHeaderLoaded=!0,t.state="loaded",this._loadTileLoaded[t.uid]=!0,p}finally{delete this._loadTilePending[t.uid]}}async queryRasterArrayValueByAllBands(t,n,l){return await this._loadTileForQuery(n)?this.queryRasterArrayValueByBandId(t,n,l):null}queryRasterArrayValue(t,n){const l=u.b2.convert(t),d=this.findLoadedParent(l);return d&&d._mrt?n.bands||!this.partial?this.queryRasterArrayValueByBandId(l,d,n):this.queryRasterArrayValueByAllBands(l,d,n):Promise.resolve(null)}findLoadedParent(t){const n=u.ac.fromLngLat(t,this.map.transform.tileSize),l=this.maxzoom+1,d=1<<l,p=Math.floor(n.x),m=Math.floor((n.x-p)*d),g=Math.floor(n.y*d),x=this.map.style.getSourceCache(this.id),w=new u.bp(l,p,l,m,g);return x.findLoadedParent(w,this.minzoom)}}var gm=u.cQ([{name:"a_index",type:"Int16",components:1}]);class ym{constructor(t,n,l,d){const p={width:l[0],height:l[1],data:null},m=t.gl;this.targetColorTexture=new u.T(t,p,m.RGBA8,{useMipmap:!1}),this.backgroundColorTexture=new u.T(t,p,m.RGBA8,{useMipmap:!1}),this.context=t,this.updateParticleTexture(n,d),this.lastInvalidatedAt=0}updateParticleTexture(t,n){if(this.particleTextureDimension===n.width)return;(this.particleTexture0||this.particleTexture1||this.particleIndexBuffer||this.particleSegment)&&(this.particleTexture0.destroy(),this.particleTexture1.destroy(),this.particleIndexBuffer.destroy(),this.particleSegment.destroy());const l=this.context.gl,d=n.width*n.height;this.particleTexture0=new u.T(this.context,n,l.RGBA8,{premultiply:!1,useMipmap:!1}),this.particleTexture1=new u.T(this.context,n,l.RGBA8,{premultiply:!1,useMipmap:!1});const p=new u.dj;p.reserve(d);for(let m=0;m<d;m++)p.emplaceBack(m);this.particleIndexBuffer=this.context.createVertexBuffer(p,gm.members,!0),this.particleSegment=u.cr.simpleSegment(0,0,this.particleIndexBuffer.length,0),this.particleTextureDimension=n.width}update(t){return!(this.lastInvalidatedAt<t&&(this.lastInvalidatedAt=u.r.now(),1))}destroy(){this.targetColorTexture.destroy(),this.backgroundColorTexture.destroy(),this.particleIndexBuffer.destroy(),this.particleTexture0.destroy(),this.particleTexture1.destroy(),this.particleSegment.destroy()}}function Yu(s,t,n,l,d){if(d>0){const p=u.r.now(),m=(p-s.timeAdded)/d,g=t?(p-t.timeAdded)/d:-1,x=n.getSource(),w=l.coveringZoomLevel({tileSize:x.tileSize,roundZoom:x.roundZoom}),E=!t||Math.abs(t.tileID.overscaledZ-w)>Math.abs(s.tileID.overscaledZ-w),A=E&&s.refreshedUponExpiration?1:u.as(E?m:1-g,0,1);return t?{opacity:1,mix:1-A,isFading:m<1}:{opacity:A,mix:0,isFading:m<1}}return{opacity:1,mix:0,isFading:!1}}function Nd(s,t,n){if(!s)return null;const l=t.getTextureDescriptor(s,n,!0);if(!l)return null;let{texture:d,mix:p,offset:m,tileSize:g,buffer:x,format:w}=l;if(!d||!w)return null;let E=!1;return w==="uint32"&&(E=!0,p[3]=0,p=Zu(u.dq,p,[0,n.paint.get("raster-particle-max-speed")]),m=Wu(u.dq,m,[0,n.paint.get("raster-particle-max-speed")])),{texture:d,textureOffset:[x/(g+2*x),g/(g+2*x)],tileSize:g,scalarData:E,scale:p,offset:m,defines:["RASTER_ARRAY",{uint8:"DATA_FORMAT_UINT8",uint16:"DATA_FORMAT_UINT16",uint32:"DATA_FORMAT_UINT32"}[w]]}}function Ys(s){const t=s._nearZ,n=s.projection.farthestPixelDistance(s),l=n-t,d=.2*s.height,p=t+d;return[t,n,(p-d-t)/l,(p-t)/l]}var Cc=`#ifdef RASTER_ARRAY
3033uniform 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;}
3034#endif
3035uniform 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;}`;Ia["_prelude_raster_particle.glsl"]||(Ia["_prelude_raster_particle.glsl"]=Cc);var Ku={building:Dt(`#include "_prelude_fog.fragment.glsl"
3036#include "_prelude_shadow.fragment.glsl"
3037#include "_prelude_lighting.glsl"
3038const 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;
3039#ifdef RENDER_FRONT_CUTOFF
3040in float v_front_cutoff_opacity;
3041#endif
3042#ifdef INDICATOR_CUTOUT
3043#ifdef FEATURE_CUTOUT
3044in vec4 v_ground_roof;
3045#endif
3046#endif
3047#ifdef BUILDING_FAUX_FACADE
3048in 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;
3049#endif
3050#ifdef RENDER_SHADOWS
3051in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;
3052#endif
3053#ifdef FLOOD_LIGHT
3054in highp float v_flood_radius;in float v_has_flood_light;
3055#endif
3056uniform 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));}
3057#ifdef BUILDING_FAUX_FACADE
3058highp 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;
3059#if 0
3060if (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;
3061#else
3062if (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;out_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;
3063#endif
3064return out_color;}
3065#endif
3066vec3 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;
3067#ifdef BUILDING_FAUX_FACADE
3068if (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);}
3069#endif
3070vec4 color=vec4(base_color,1.0);vec3 xy_flipped_normal=vec3(-normal.xy,normal.z);float shadowed_lighting_factor=0.0;
3071#ifdef RENDER_SHADOWS
3072#ifdef RENDER_CUTOFF
3073shadowed_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;}
3074#else
3075shadowed_lighting_factor=shadowed_light_factor_normal(xy_flipped_normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);
3076#endif
3077#else
3078shadowed_lighting_factor=max(0.0,dot(xy_flipped_normal,u_lighting_directional_dir));
3079#endif
3080color.rgb=apply_lighting_linear(color.rgb,xy_flipped_normal,shadowed_lighting_factor);color.rgb=linearTosRGB(color.rgb);
3081#ifdef FLOOD_LIGHT
3082float 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);
3083#endif
3084color.rgb=mix(color.rgb,linearTosRGB(base_color.rgb),emissive);
3085#ifdef FOG
3086color=fog_dither(fog_apply_premultiplied(color,v_fog_pos,v_pos.z));
3087#endif
3088color*=u_opacity;
3089#ifdef INDICATOR_CUTOUT
3090#ifdef FEATURE_CUTOUT
3091{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;}}}
3092#else
3093color=applyCutout(color,v_pos.z);
3094#endif
3095#endif
3096#ifdef RENDER_FRONT_CUTOFF
3097if (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;}}
3098#endif
3099#ifdef FEATURE_CUTOUT
3100color=apply_feature_cutout(color,gl_FragCoord,get_cutout_factors(gl_FragCoord).x,0.0);
3101#endif
3102glFragColor=color;
3103#ifdef DEBUG_SHOW_NORMALS
3104color.rgb=xy_flipped_normal*0.5+vec3(0.5,0.5,0.5);color.a=1.0;glFragColor=color;
3105#endif
3106#ifdef OVERDRAW_INSPECTOR
3107glFragColor=vec4(1.0);
3108#endif
3109HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
3110#include "_prelude_shadow.vertex.glsl"
3111in vec3 a_pos_3f;in ivec4 a_normal_3;in ivec4 a_centroid_3;
3112#ifdef FLOOD_LIGHT
3113in int a_flood_light_wall_radius_1i16;
3114#endif
3115#ifdef BUILDING_FAUX_FACADE
3116in uvec4 a_faux_facade_data;in uvec2 a_faux_facade_vertical_range;
3117#endif
3118uniform mat4 u_matrix;uniform mat4 u_normal_matrix;uniform highp float u_tile_to_meter;
3119#ifdef RENDER_FRONT_CUTOFF
3120uniform vec3 u_front_cutoff_params;out float v_front_cutoff_opacity;
3121#endif
3122#ifdef INDICATOR_CUTOUT
3123#ifdef FEATURE_CUTOUT
3124out vec4 v_ground_roof;
3125#endif
3126#endif
3127out vec4 v_color;out vec3 v_normal;out highp vec3 v_pos;
3128#ifdef BUILDING_FAUX_FACADE
3129out 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;
3130#endif
3131#ifdef RENDER_SHADOWS
3132uniform 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;
3133#endif
3134#ifdef FLOOD_LIGHT
3135out highp float v_flood_radius;out float v_has_flood_light;
3136#endif
3137const 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));}
3138#ifdef BUILDING_FAUX_FACADE
3139mat3 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);}
3140#endif
3141#pragma mapbox: define-attribute-vertex-shader-only highp uvec2 part_color_emissive
3142#pragma mapbox: define-attribute-vertex-shader-only highp uvec2 faux_facade_color_emissive
3143void main() {
3144#pragma mapbox: initialize-attribute-custom highp uvec2 part_color_emissive
3145#pragma mapbox: initialize-attribute-custom highp uvec2 faux_facade_color_emissive
3146#ifdef FLOOD_LIGHT
3147v_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);
3148#endif
3149vec4 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);
3150#ifdef BUILDING_FAUX_FACADE
3151vec4 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;}
3152#endif
3153v_pos=a_pos_3f;
3154#if defined(RENDER_CUTOFF) || defined(RENDER_FRONT_CUTOFF)
3155float halfSpanX=spanBits.x*10.0/u_tile_to_meter;float halfSpanY=spanBits.y*10.0/u_tile_to_meter;
3155vec2 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;
3156#endif
3157#if defined(RENDER_CUTOFF) || defined(RENDER_FRONT_CUTOFF)
3158vec4 ground=u_matrix*vec4(centroid_xy,0.0,1.0);
3159#endif
3160#ifdef RENDER_CUTOFF
3161v_cutoff_opacity=cutoff_opacity(u_cutoff_params,ground.z);hidden=float(v_cutoff_opacity==0.0);v_pos.z*=v_cutoff_opacity;
3162#endif
3163#ifdef RENDER_SHADOWS
3164vec3 shadow_pos=v_pos;
3165#ifdef NORMAL_OFFSET
3166vec3 offset=shadow_normal_offset_model(v_normal);shadow_pos+=offset*shadow_normal_offset_multiplier0();
3167#endif
3168v_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);
3169#endif
3170#ifdef FOG
3171v_fog_pos=fog_position(v_pos);
3172#endif
3173#ifdef RENDER_FRONT_CUTOFF
3174v_front_cutoff_opacity=1.0;{hidden=max(hidden,float(ground.w <=0.0));float 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);}
3175#endif
3176gl_Position=mix(u_matrix*vec4(v_pos,1),AWAY,hidden);gl_Position.z-=depth_offset*gl_Position.w;
3177#ifdef INDICATOR_CUTOUT
3178#ifdef FEATURE_CUTOUT
3179vec4 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);
3180#endif
3181#endif
3182}`),buildingBloom:Dt(`in vec4 v_color_emissive;
3183#pragma mapbox: define-attribute highp vec4 bloom_attenuation
3184#pragma mapbox: initialize-attribute highp vec4 bloom_attenuation
3185float saturate(float val) {return clamp(val,0.0,1.0);}void main() {float emission=v_color_emissive.a;float opacity=1.0;
3186#ifdef HAS_ATTRIBUTE_a_bloom_attenuation
3187float 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);
3188#endif
3189#ifdef RENDER_CUTOFF
3190opacity*=v_cutoff_opacity;
3191#endif
3192glFragColor=vec4(v_color_emissive.rgb,1.0)*opacity;}`,`in vec3 a_pos_3f;
3193#pragma mapbox: define-attribute-vertex-shader-only highp uvec2 part_color_emissive
3194#pragma mapbox: define-attribute highp vec4 bloom_attenuation
3195out vec4 v_color_emissive;uniform mat4 u_matrix;vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}void main() {
3196#pragma mapbox: initialize-attribute-custom highp uvec2 part_color_emissive
3197#pragma mapbox: initialize-attribute highp vec4 bloom_attenuation
3198#ifdef HAS_ATTRIBUTE_a_part_color_emissive
3199vec4 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);
3200#else
3201v_color_emissive=vec4(1.0);
3202#endif
3203gl_Position=u_matrix*vec4(a_pos_3f,1.0);
3204#ifdef RENDER_CUTOFF
3205v_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z);
3206#endif
3207}`),buildingDepth:Dt("void main() {}","in vec3 a_pos_3f;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos_3f,1.0);}"),rasterParticle:Dt(`#include "_prelude_fog.fragment.glsl"
3208#include "_prelude_lighting.glsl"
3209uniform 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;
3210#ifdef LIGHTING_3D_MODE
3211out_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),1.0).rgb;
3212#endif
3213#ifdef FOG
3214highp 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));
3215#endif
3216glFragColor=vec4(out_color*color.a,color.a);
3217#ifdef OVERDRAW_INSPECTOR
3218glFragColor=vec4(1.0);
3219#endif
3220HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
3221uniform 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;
3222#define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8
3223in ivec2 a_pos;in uvec2 a_texture_pos;out vec2 v_pos0;out vec2 v_pos1;void main() {float w=1.0;vec2 uv;
3224#ifdef PROJECTION_GLOBE_VIEW
3225vec3 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;
3226#ifdef FOG
3227v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);
3228#endif
3229#else
3230uv=vec2(a_texture_pos)/8192.0;
3230gl_Position=u_matrix*vec4(vec2(a_pos)*w,u_raster_elevation*w,w);
3231#ifdef FOG
3232v_fog_pos=fog_position(vec2(a_pos));
3233#endif
3234#endif
3235v_pos0=uv;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}`),rasterParticleDraw:Dt("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"
3236in 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(
3237mod(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:Dt("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:Dt(`#include "_prelude_raster_particle.glsl"
3238uniform 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(
3239linearstep(vec2(-u_particle_pos_offset),vec2(0),pos)*linearstep(vec2(1.0+u_particle_pos_offset),vec2(1),pos),vec2(4)
3240);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:Dt("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;}",`
3241in 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; 
3242uniform float u_velocity;uniform vec3 u_direction;uniform float u_horizontalOscillationRadius; 
3243uniform float u_horizontalOscillationRate; 
3244uniform 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);
3244simPosLocal.xy+=horizontalOscillationRadius*vec2(cos(horizontalOscillationAngle),sin(horizontalOscillationAngle));vec3 simPos=localX*simPosLocal.x+
3245localY*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:Dt("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;}",`
3246in 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; 
3247uniform float u_velocity; 
3248uniform 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; 
3249pos+=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+
3250localY*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:Dt("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);}"),elevatedStructuresDepth:Dt("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;}"),elevatedStructures:Dt(`#include "_prelude_fog.fragment.glsl"
3251#include "_prelude_lighting.glsl"
3252#include "_prelude_shadow.fragment.glsl"
3253in vec3 v_normal;in float v_height;
3254#ifdef RENDER_SHADOWS
3255in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in float v_depth;
3256#endif
3257vec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}
3257vec3 compute_view_dependent_emissive_color(float ndotl,float emissive_strength,vec3 color)
3258{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;uniform float u_opacity_multiplier;
3259#pragma mapbox: define highp vec4 structure_color
3260void main() {
3261#pragma mapbox: initialize highp vec4 structure_color
3262vec3 color=structure_color.xyz;vec2 cutout_factors=vec2(0.0);
3263#ifdef FEATURE_CUTOUT
3264cutout_factors=get_cutout_factors(gl_FragCoord);
3265#endif
3266#ifdef LIGHTING_3D_MODE
3267vec3 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);
3268#ifdef RENDER_SHADOWS
3269float 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);
3270#else
3271color=apply_lighting(color,transformed_normal);
3272#endif
3273color=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);}
3274#endif
3275#ifdef FOG
3276color=fog_apply(color,v_fog_pos);
3277#endif
3278vec4 out_color=vec4(color,1.0);
3279#ifdef INDICATOR_CUTOUT
3280out_color=applyCutout(out_color,v_height);
3281#endif
3282#ifdef FEATURE_CUTOUT
3283out_color=apply_feature_cutout(out_color,gl_FragCoord,cutout_factors.x,v_height);
3284#endif
3285out_color*=u_opacity_multiplier;glFragColor=out_color;HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
3286#include "_prelude_shadow.vertex.glsl"
3287in 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;
3288#ifdef RENDER_SHADOWS
3289uniform 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;
3290#endif
3291#pragma mapbox: define highp vec4 structure_color
3292void main() {
3293#pragma mapbox: initialize highp vec4 structure_color
3294v_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);
3295#ifdef RENDER_SHADOWS
3296vec3 shd_pos0=pos;vec3 shd_pos1=pos;
3297#ifdef NORMAL_OFFSET
3298vec3 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();
3299#endif
3300v_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;
3301#endif
3302#ifdef FOG
3303v_fog_pos=fog_position(vec2(a_pos));
3304#endif
3305}`),elevatedStructuresDepthReconstruct:Dt(`#ifdef DEPTH_RECONSTRUCTION
3306in float v_height;
3307#endif
3308void main() {
3309#ifdef DEPTH_RECONSTRUCTION
3310if (v_height >=0.0)
3311discard;
3312#else
3313#ifdef FEATURE_CUTOUT
3314apply_feature_cutout(vec4(0.0,0.0,0.0,1.0),gl_FragCoord,get_cutout_factors(gl_FragCoord).x,0.0);
3315#endif
3316#endif
3317glFragColor=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;
3318#ifdef DEPTH_RECONSTRUCTION
3319out float v_height;
3320#endif
3321void main() {vec3 vpos=vec3(a_pos,a_height*u_height_scale);
3322#ifdef DEPTH_RECONSTRUCTION
3323if (u_camera_pos.z > vpos.z) {vpos-=(u_camera_pos-vpos)*(vpos.z/(u_camera_pos.z-vpos.z));}v_height=a_height;
3324#endif
3325gl_Position=u_matrix*vec4(vpos,1);gl_Position.z=u_reset_depth==1.0 ? gl_Position.w : gl_Position.z+u_depth_bias;}`)};Dt(Cc,"");const xm=u.cQ([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_rainParticleData",components:4}]),Ks=u.cQ([{type:"Float32",name:"a_pos_2f",components:2}]);class Vd{destroy(){this.vignetteVx&&this.vignetteVx.destroy(),this.vignetteIdx&&this.vignetteIdx.destroy()}draw(t,n){const l=t.getOrCreateProgram("vignette");if(!this.vignetteVx||!this.vignetteIdx){const m=new u.dr,g=new u.cp;m.emplaceBack(-1,-1),m.emplaceBack(1,-1),m.emplaceBack(1,1),m.emplaceBack(-1,1),g.emplaceBack(0,1,2),g.emplaceBack(0,2,3),this.vignetteVx=t.context.createVertexBuffer(m,Ks.members),this.vignetteIdx=t.context.createIndexBuffer(g)}const d=u.cr.simpleSegment(0,0,4,6);if(this.vignetteVx&&this.vignetteIdx){t.uploadCommonUniforms(t.context,l);const m={u_vignetteShape:(p={vignetteShape:[n.start,n.range,Math.pow(10,n.fadePower)],vignetteColor:[n.color.r,n.color.g,n.color.b,n.color.a*n.strength]}).vignetteShape,u_vignetteColor:p.vignetteColor};l.draw(t,t.context.gl.TRIANGLES,nt.disabled,lt.disabled,dt.alphaBlended,pt.disabled,m,"vignette",this.vignetteVx,this.vignetteIdx,d)}var p}}class Ju{constructor(){this._accumulatedOffsetX=0,this._accumulatedOffsetY=0,this._accumulatedElevation=0}update(t,n){const l=t.getFreeCameraOptions().position,d=l.toAltitude(),p=l.toLngLat(),m=u.al(p.lng),g=u.al(p.lat),x=t.pixelsPerMeter/n,w=m*u.dt,E=u.dt*Math.log(Math.tan(Math.PI/4+g/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 A=-this._offsetYPrev+E,I=-this._elevationPrev+d;this._accumulatedOffsetX+=(-this._offsetXPrev+w)*x,this._accumulatedOffsetY+=A*x,this._accumulatedElevation+=I*x,this._offsetXPrev=w,this._offsetYPrev=E,this._elevationPrev=d}}getPosition(){return[this._accumulatedOffsetX,this._accumulatedOffsetY,this._accumulatedElevation]}}function Ud(s,t){return[-(s[0]-Math.floor(s[0]/t)*t),-(s[1]-Math.floor(s[1]/t)*t),-(s[2]-Math.floor(s[2]/t)*t)]}
vendor: 55,917 bytes, line 3325
3325function jd(s){const t=u.ds(1323123451230),n=[];for(let l=0;l<s;++l){const d=2*t()-1,p=2*t()-1,m=2*t()-1;n.push(u.c6(d,p,m))}return n}function Zo(s,t,n,l,d){const p=u.as((d-n)/(l-n),0,1);return u.ai(s,t,p)}class Qu{constructor(t){this._movement=new Ju,this._accumulatedTimeFromStart=0,this._prevTime=Date.now()/1e3,this._vignette=new Vd,this._ppmScaleFactor=t}destroy(){this.particlesVx&&this.particlesVx.destroy(),this.particlesIdx&&this.particlesIdx.destroy(),this._vignette&&this._vignette.destroy()}updateOnRender(t,n){const l=t.transform;this._movement.update(l,this._ppmScaleFactor);const d=l.starsProjMatrix,p=u.az([]);u.aB(p,p,u.al(90)-l._pitch),u.aA(p,p,-l.angle);const m=u.aI(new Float32Array(16),p),g=new Float32Array([1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1]),x=u.cl([],g),w=u.aP([],x,m),E=Date.now()/1e3;return this._accumulatedTimeFromStart+=(E-this._prevTime)*n,this._prevTime=E,{projectionMatrix:d,modelviewMatrix:w}}}const Rg=u.cQ([{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}]),vm=(s,t)=>({u_matrix:s,u_depth_bias:t}),Mc=(s,t)=>({u_matrix:s,u_ground_shadow_factor:t,u_opacity_multiplier:1}),eh=(s,t,n,l,d)=>({u_matrix:s,u_camera_pos:[t[0],t[1],t[2]],u_depth_bias:n,u_height_scale:l,u_reset_depth:d}),Dg={building:s=>({u_matrix:new u.ap(s),u_normal_matrix:new u.ap(s),u_opacity:new u.ar(s),u_faux_facade_ao_intensity:new u.ar(s),u_camera_pos:new u.aq(s),u_tile_to_meter:new u.ar(s),u_facade_emissive_chance:new u.ar(s),u_flood_light_color:new u.aq(s),u_flood_light_intensity:new u.ar(s),u_front_cutoff_params:new u.aq(s)}),buildingBloom:s=>({u_matrix:new u.ap(s)}),buildingDepth:s=>({u_matrix:new u.ap(s)}),elevatedStructuresDepth:s=>({u_matrix:new u.ap(s),u_depth_bias:new u.ar(s)}),elevatedStructures:s=>({u_matrix:new u.ap(s),u_ground_shadow_factor:new u.aq(s),u_opacity_multiplier:new u.ar(s)}),elevatedStructuresDepthReconstruct:s=>({u_matrix:new u.ap(s),u_camera_pos:new u.aq(s),u_depth_bias:new u.ar(s),u_height_scale:new u.ar(s),u_reset_depth:new u.ar(s)}),rasterParticle:s=>({u_matrix:new u.ap(s),u_normalize_matrix:new u.ap(s),u_globe_matrix:new u.ap(s),u_merc_matrix:new u.ap(s),u_grid_matrix:new u.cM(s),u_tl_parent:new u.b$(s),u_scale_parent:new u.ar(s),u_fade_t:new u.ar(s),u_opacity:new u.ar(s),u_image0:new u.b_(s),u_image1:new u.b_(s),u_raster_elevation:new u.ar(s),u_zoom_transition:new u.ar(s),u_merc_center:new u.b$(s),u_cutoff_params:new u.bZ(s)}),rasterParticleTexture:s=>({u_texture:new u.b_(s),u_opacity:new u.ar(s)}),rasterParticleDraw:s=>({u_particle_texture:new u.b_(s),u_particle_texture_side_len:new u.ar(s),u_tile_offset:new u.b$(s),u_velocity:new u.b_(s),u_color_ramp:new u.b_(s),u_velocity_res:new u.b$(s),u_max_speed:new u.ar(s),u_uv_offset:new u.b$(s),u_data_scale:new u.b$(s),u_data_offset:new u.ar(s),u_particle_pos_scale:new u.ar(s),u_particle_pos_offset:new u.b$(s)}),rasterParticleUpdate:s=>({u_particle_texture:new u.b_(s),u_particle_texture_side_len:new u.ar(s),u_velocity:new u.b_(s),u_velocity_res:new u.b$(s),u_max_speed:new u.ar(s),u_speed_factor:new u.ar(s),u_reset_rate:new u.ar(s),u_rand_seed:new u.ar(s),u_uv_offset:new u.b$(s),u_data_scale:new u.b$(s),u_data_offset:new u.ar(s),u_particle_pos_scale:new u.ar(s),u_particle_pos_offset:new u.b$(s)}),snowParticle:s=>({u_modelview:new u.ap(s),u_projection:new u.ap(s),u_time:new u.ar(s),u_cam_pos:new u.aq(s),u_velocityConeAperture:new u.ar(s),u_velocity:new u.ar(s),u_horizontalOscillationRadius:new u.ar(s),u_horizontalOscillationRate:new u.ar(s),u_boxSize:new u.ar(s),u_billboardSize:new u.ar(s),u_simpleShapeParameters:new u.b$(s),u_screenSize:new u.b$(s),u_thinningCenterPos:new u.b$(s),u_thinningShape:new u.aq(s),u_thinningAffectedRatio:new u.ar(s),u_thinningParticleOffset:new u.ar(s),u_particleColor:new u.bZ(s),u_direction:new u.aq(s)}),rainParticle:s=>({u_modelview:new u.ap(s),u_projection:new u.ap(s),u_time:new u.ar(s),u_cam_pos:new u.aq(s),u_texScreen:new u.b_(s),u_velocityConeAperture:new u.ar(s),u_velocity:new u.ar(s),u_boxSize:new u.ar(s),u_rainDropletSize:new u.b$(s),u_distortionStrength:new u.ar(s),u_rainDirection:new u.aq(s),u_color:new u.bZ(s),u_screenSize:new u.b$(s),u_thinningCenterPos:new u.b$(s),u_thinningShape:new u.aq(s),u_thinningAffectedRatio:new u.ar(s),u_thinningParticleOffset:new u.ar(s),u_shapeDirectionalPower:new u.ar(s),u_shapeNormalPower:new u.ar(s),u_mode:new u.ar(s)}),vignette:s=>({u_vignetteShape:new u.aq(s),u_vignetteColor:new u.bZ(s)})};function Gd(s,t){const n=1<<s.canonical.z,l=(t.x*n-s.canonical.x-s.wrap*n)*u.aj,d=(t.y*n-s.canonical.y)*u.aj,p=u.dw(t.z,t.y);return u.c6(l,d,p)}function zg(s){let t=0;for(const n of s)t|=n.frcMask;return t}class th{constructor(t=[]){this.tiles=t}getTile(t){for(const n of this.tiles)if(n.tileId.z===t.z&&n.tileId.x===t.x&&n.tileId.y===t.y)return n;return null}getTileOrParent(t){for(let n=t.z;n>0;--n){const l=Math.floor(t.x/(1<<t.z-n)),d=Math.floor(t.y/(1<<t.z-n));for(const p of this.tiles)if(p.tileId.z===n&&p.tileId.x===l&&p.tileId.y===d&&p.frcMask!==0)return p}return null}getFullCoverageMask(t){let n=null,l=0;for(let A=t.z;A>0;--A){const I=Math.floor(t.x/(1<<t.z-A)),M=Math.floor(t.y/(1<<t.z-A));for(const D of this.tiles)if(D.tileId.z===A&&D.tileId.x===I&&D.tileId.y===M){n=D,l=A;break}if(n)break}if(!n||n.frcMask===0)return null;const d=1<<t.z-l,p=u.aj/d,m=t.x%d*p,g=t.y%d*p,x=m+p,w=g+p;let E=0;for(const A of n.polygons)A.frcMask!==0&&(A.hasGeometry()?A.rings.length===0||t.z<=l||ih(A.rings,m,g,x,w)&&(E|=A.frcMask):E|=A.frcMask);return E!==0?E:null}equals(t){if(this.tiles.length!==t.length)return!1;for(let n=0;n<this.tiles.length;++n){const l=this.tiles[n],d=t[n];if(l.tileId.z!==d.tileId.z||l.tileId.x!==d.tileId.x||l.tileId.y!==d.tileId.y||l.frcMask!==d.frcMask||l.polygons.length!==d.polygons.length)return!1}return!0}empty(){return this.tiles.length===0}}function ih(s,t,n,l,d){const p=[0,0,0,0],m=[t,l,l,t],g=[n,n,d,d];for(const x of s){const w=x.length;if(!(w<2))for(let E=0,A=w-1;E<w;A=E++){const I=x[A].x,M=x[A].y,D=x[E].x,z=x[E].y;for(let q=0;q<4;++q)M>g[q]!=z>g[q]&&m[q]<I+(D-I)*(g[q]-M)/(z-M)&&p[q]++;let O=0,k=0;if(I<t?O|=1:I>l&&(O|=2),M<n?O|=4:M>d&&(O|=8),D<t?k|=1:D>l&&(k|=2),z<n?k|=4:z>d&&(k|=8),!(O&k)&&(O===0||k===0||Fl(I,M,D,z,t,n,l,d)))return!1}}for(let x=0;x<4;++x)if(!(1&p[x]))return!1;return!0}function Fl(s,t,n,l,d,p,m,g){const x=(w,E,A,I,M,D,z,O)=>{const k=(A-w)*(D-E)-(I-E)*(M-w),q=(A-w)*(O-E)-(I-E)*(z-w);if(k>0&&q>0||k<0&&q<0)return!1;const $=(z-M)*(E-D)-(O-D)*(w-M),U=(z-M)*(I-D)-(O-D)*(A-M);return!($>0&&U>0||$<0&&U<0)};return!!(x(s,t,n,l,d,p,m,p)||x(s,t,n,l,m,p,m,g)||x(s,t,n,l,d,g,m,g)||x(s,t,n,l,d,p,d,g))}class rh{constructor(){this._tileCoverages=[],this._snapshot=new th}clear(){this._tileCoverages=[]}addTileCoverage(t,n){this._tileCoverages.push({tileId:t,polygons:n,frcMask:zg(n)})}empty(){return this._tileCoverages.length===0}updateSnapshotIfNeeded(){if(this._snapshot.equals(this._tileCoverages))return this._snapshot;const t=this._tileCoverages.map(n=>({tileId:n.tileId,polygons:n.polygons,frcMask:n.frcMask}));return this._snapshot=new th(t),this._snapshot}}class Pc{constructor(t,n){this.max=t,this.onRemove=n,this.reset()}reset(){for(const t in this.data)for(const n of this.data[t])n.timeout&&clearTimeout(n.timeout),this.onRemove(n.value);return this.data={},this.order=[],this}add(t,n,l){const d=t.wrapped().key;this.data[d]===void 0&&(this.data[d]=[]);const p={value:n,timeout:void 0};if(l!==void 0&&(p.timeout=setTimeout(()=>{this.remove(t,p)},l)),this.data[d].push(p),this.order.push(d),this.order.length>this.max){const m=this._getAndRemoveByKey(this.order[0]);m&&this.onRemove(m)}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 n=this.data[t].shift();return n.timeout&&clearTimeout(n.timeout),this.data[t].length===0&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),n.value}getByKey(t){const n=this.data[t];return n?n[0].value:null}get(t){return this.has(t)?this.data[t.wrapped().key][0].value:null}remove(t,n){if(!this.has(t))return this;const l=t.wrapped().key,d=n===void 0?0:this.data[l].indexOf(n),p=this.data[l][d];return this.data[l].splice(d,1),p.timeout&&clearTimeout(p.timeout),this.data[l].length===0&&delete this.data[l],this.onRemove(p.value),this.order.splice(this.order.indexOf(l),1),this}setMaxSize(t){for(this.max=t;this.order.length>this.max;){const n=this._getAndRemoveByKey(this.order[0]);n&&this.onRemove(n)}return this}filter(t){const n=[];for(const l in this.data)for(const d of this.data[l])t(d.value)||n.push(d);for(const l of n)this.remove(l.value.tileID,l)}}class bm{constructor(){this.state=Object.create(null),this.stateChanges=Object.create(null),this.deletedStates=Object.create(null)}updateState(t,n,l){const d=String(n);if(this.stateChanges[t]=this.stateChanges[t]||Object.create(null),this.stateChanges[t][d]=this.stateChanges[t][d]||Object.create(null),Object.assign(this.stateChanges[t][d],l),this.deletedStates[t]===null){this.deletedStates[t]=Object.create(null);for(const p in this.state[t])p!==d&&(this.deletedStates[t][p]=null)}else if(this.deletedStates[t]&&this.deletedStates[t][d]===null){this.deletedStates[t][d]=Object.create(null);for(const p in this.state[t][d])l[p]||(this.deletedStates[t][d][p]=null)}else for(const p in l)this.deletedStates[t]&&this.deletedStates[t][d]&&this.deletedStates[t][d][p]===null&&delete this.deletedStates[t][d][p]}removeFeatureState(t,n,l){if(this.deletedStates[t]===null)return;const d=String(n);if(this.deletedStates[t]=this.deletedStates[t]||Object.create(null),l&&n!==void 0)this.deletedStates[t][d]!==null&&(this.deletedStates[t][d]=this.deletedStates[t][d]||Object.create(null),this.deletedStates[t][d][l]=null);else if(n!==void 0)if(this.stateChanges[t]&&this.stateChanges[t][d])for(l in this.deletedStates[t][d]=Object.create(null),this.stateChanges[t][d])this.deletedStates[t][d][l]=null;else this.deletedStates[t][d]=null;else this.deletedStates[t]=null}getState(t,n){const l=this.state[t]||Object.create(null),d=this.stateChanges[t]||Object.create(null),p=this.deletedStates[t];if(p===null)return Object.create(null);if(n!==void 0){const g=String(n),x=Object.assign(Object.create(null),l[g],d[g]);if(p){const w=p[n];if(w===null)return Object.create(null);for(const E in w)delete x[E]}return x}const m=Object.assign(Object.create(null),l,d);if(p)for(const g in p)delete m[g];return m}initializeTileState(t,n){t.refreshFeatureState(n)}coalesceChanges(t,n){const l=Object.create(null);for(const d in this.stateChanges){this.state[d]=this.state[d]||Object.create(null);const p=Object.create(null);for(const m in this.stateChanges[d])this.state[d][m]||(this.state[d][m]=Object.create(null)),Object.assign(this.state[d][m],this.stateChanges[d][m]),p[m]=this.state[d][m];l[d]=p}for(const d in this.deletedStates){this.state[d]=this.state[d]||Object.create(null);const p=Object.create(null);if(this.deletedStates[d]===null)for(const m in this.state[d])p[m]=Object.create(null),this.state[d][m]=Object.create(null);else for(const m in this.deletedStates[d]){if(this.deletedStates[d][m]===null)this.state[d][m]=Object.create(null);else if(this.state[d][m])for(const g of Object.keys(this.deletedStates[d][m]))delete this.state[d][m][g];p[m]=this.state[d][m]}l[d]=l[d]||Object.create(null),Object.assign(l[d],p)}if(this.stateChanges=Object.create(null),this.deletedStates=Object.create(null),Object.keys(l).length!==0)for(const d in t)t[d].refreshFeatureState(n,l)}}class sn extends u.E{constructor(t,n,l){super(),this.id=t,this._renderSourceType=l,this._maxzoomOverride=null,n.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))}),n.on("error",()=>{this._sourceErrored=!0}),this._source=n,this._tiles={},this._cache=new Pc(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._minTileCacheSize=n.minTileCacheSize,this._maxTileCacheSize=n.maxTileCacheSize,this._loadedParentTiles={},this.castsShadows=!1,this.tileCoverLift=0,this._coveredTiles={},this._shadowCasterTiles={},this._state=new bm,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,n){return t.renderSourceType=this._renderSourceType,t.isExtraShadowCaster=this._shadowCasterTiles[t.tileID.key],this._source.loadTile(t,n)}_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 n in this._tiles){const l=this._tiles[n];l.upload(t,this.map?this.map.painter:void 0),l.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(Rc).map(t=>t.key)}getRenderableIds(t,n){const l=[];for(const d in this._tiles)this._isIdRenderable(+d,t,n)&&l.push(this._tiles[d]);return t?l.sort((d,p)=>{const m=d.tileID,g=p.tileID,x=new u.P(m.canonical.x,m.canonical.y)._rotate(this.transform.angle),w=new u.P(g.canonical.x,g.canonical.y)._rotate(this.transform.angle);return m.overscaledZ-g.overscaledZ||w.y-x.y||w.x-x.x}).map(d=>d.tileID.key):l.map(d=>d.tileID).sort(Rc).map(d=>d.key)}hasRenderableParent(t){const n=this.findLoadedParent(t,0);return!!n&&this._isIdRenderable(n.tileID.key)}_isIdRenderable(t,n,l){return this._tiles[t]&&this._tiles[t].hasData()&&!this._coveredTiles[t]&&(n||!this._tiles[t].holdingForFade())&&(l||!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,n){const l=this._tiles[t];l&&(l.state!=="loading"&&(l.state=n),this._loadTile(l,this._tileLoaded.bind(this,l,t,n)))}_tileLoaded(t,n,l,d,p){if(d){if(t.state="errored",u.dx(d)){if(this._source.fire(new u.B("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 g=this.map.painter.terrain;this.update(this.transform,g.getScaledDemTileSize(),!0),g.resetTileLookupCache(this.id)}else this.update(this.transform)}else this._source.fire(new u.A(d,{tile:t}));return}t.timeAdded=u.r.now(),l==="expired"&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(n,t),this._source.type==="raster-dem"&&t.dem&&this._backfillDEM(t),this._state.initializeTileState(t,this.map?this.map.painter:null);let m=new Headers;p&&p.headers&&(m=p.headers),this._source.fire(new u.B("data",{dataType:"source",tile:t,coord:t.tileID,sourceCacheId:this.id,responseHeaders:m}))}_hasTunnelGeometry(){for(const t in this._tiles){const n=this._tiles[t];if(n&&n.hasTunnelGeometry)return!0}return!1}_backfillDEM(t){const n=this.getRenderableIds();for(let d=0;d<n.length;d++){const p=n[d];if(t.neighboringTiles&&t.neighboringTiles[p]){const m=this.getTileByID(p);l(t,m),l(m,t)}}function l(d,p){if(!d.dem||d.dem.borderReady)return;d.needsHillshadePrepare=!0,d.needsDEMTextureUpload=!0;let m=p.tileID.canonical.x-d.tileID.canonical.x;const g=p.tileID.canonical.y-d.tileID.canonical.y,x=Math.pow(2,d.tileID.canonical.z),w=p.tileID.key;m===0&&g===0||Math.abs(g)>1||(Math.abs(m)>1&&(Math.abs(m+x)===1?m+=x:Math.abs(m-x)===1&&(m-=x)),p.dem&&d.dem&&(d.dem.backfillBorder(p.dem,m,g),d.neighboringTiles&&d.neighboringTiles[w]&&(d.neighboringTiles[w].backfilled=!0)))}}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._tiles[t]}_retainLoadedChildren(t,n,l,d){for(const p in this._tiles){let m=this._tiles[p];if(d[p]||!m.hasData()||m.tileID.overscaledZ<=n||m.tileID.overscaledZ>l)continue;let g=m.tileID;for(;m&&m.tileID.overscaledZ>n+1;){const w=m.tileID.scaledTo(m.tileID.overscaledZ-1);m=this._tiles[w.key],m&&m.hasData()&&(g=w)}let x=g;for(;x.overscaledZ>n;)if(x=x.scaledTo(x.overscaledZ-1),t[x.key]){d[g.key]=g;break}}}findLoadedParent(t,n){if(t.key in this._loadedParentTiles){const l=this._loadedParentTiles[t.key];return l&&l.tileID.overscaledZ>=n?l:null}for(let l=t.overscaledZ-1;l>=n;l--){const d=t.scaledTo(l),p=this._getLoadedTile(d);if(p)return p}}_getLoadedTile(t){const n=this._tiles[t.key];return n&&n.hasData()?n:this._cache.getByKey(this._source.reparseOverscaled?t.wrapped().key:t.canonical.key)}updateCacheSize(t,n){n=n||this._source.tileSize;const l=Math.ceil(t.width/n)+1,d=Math.ceil(t.height/n)+1,p=Math.floor(l*d*5),m=typeof this._minTileCacheSize=="number"?Math.max(this._minTileCacheSize,p):p,g=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,m):m;this._cache.setMaxSize(g)}handleWrapJump(t){const n=Math.round((t-(this._prevLng===void 0?t:this._prevLng))/360);if(this._prevLng=t,n){const l={};for(const d in this._tiles){const p=this._tiles[d];p.tileID=p.tileID.unwrapTo(p.tileID.wrap+n),l[p.tileID.key]=p}this._tiles=l;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,n,l,d,p){if(this.transform=t,!this._sourceLoaded||this._paused||this.transform.freezeTileCoverage||this.usedForTerrain&&!l)return;this.updateCacheSize(t,n),this.transform.projection.name!=="globe"&&this.handleWrapJump(this.transform.center.lng),this._shadowCasterTiles={},this._coveredTiles={};const m=this._source.type==="batched-model";let g,x=this._source.maxzoom;this._maxzoomOverride!==null&&(x=Math.min(x,this._maxzoomOverride));const w=this.map&&this.map.painter?this.map.painter._terrain:null;if(w&&w.sourceCache===this&&w.attenuationRange()){const M=w.attenuationRange()[0],D=Math.floor(M)-Math.log2(w.getDemUpscale());x>D&&(x=D)}const E=this._maxzoomOverride===null&&this._source.reparseOverscaled;if(this.used||this.usedForTerrain){if(this._source.tileID)g=t.getVisibleUnwrappedCoordinates(this._source.tileID).map(M=>new u.bp(M.canonical.z,M.wrap,M.canonical.z,M.canonical.x,M.canonical.y));else if(this.tileCoverLift!==0){const M=t.clone();M.tileCoverLift=this.tileCoverLift,g=M.coveringTiles({tileSize:n||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:x,roundZoom:this._source.roundZoom&&!l,reparseOverscaled:E,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:m}),this._source.minzoom<=1&&t.projection.name==="globe"&&(g.push(new u.bp(1,0,1,0,0)),g.push(new u.bp(1,0,1,1,0)),g.push(new u.bp(1,0,1,0,1)),g.push(new u.bp(1,0,1,1,1)))}else if(g=t.coveringTiles({tileSize:n||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:x,roundZoom:this._source.roundZoom&&!l,reparseOverscaled:E,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:m}),this._source.hasTile){const M=this._source.hasTile.bind(this._source);g=g.filter(D=>M(D))}}else g=[];if(g.length>0&&this.transform.projection.name!=="globe"&&!this.usedForTerrain&&!this._supportsFading){const M=t.coveringZoomLevel({tileSize:n||this._source.tileSize,roundZoom:this._source.roundZoom&&!l}),D=Math.min(M,x);if(m){const z=t.extendTileCover(g,D);for(const O of z)g.push(O)}else if(p){const z=this.transform.getFrustum(D),O=t.extendTileCoverToNearPlane(g,z,D);for(const k of O)g.push(k);if(D>=18&&this._hasTunnelGeometry()){const k=t.extendTileCoverForTunnels(g,z,D,20);for(const q of k)g.push(q)}}else if(this.castsShadows&&d){const z=t.extendTileCover(g,D,d,16);for(const O of z)this._shadowCasterTiles[O.key]=!0,g.push(O)}}const A=this._updateRetainedTiles(g);if(this._supportsFading&&g.length!==0){const M={},D={},z=u.r.now(),O=Object.keys(A);for(const q of O){const $=A[q],U=this._tiles[q];if(!U||U.fadeEndTime!==void 0&&U.fadeEndTime<=z)continue;const Q=this.findLoadedParent($,Math.max($.overscaledZ-sn.maxOverzooming,this._source.minzoom));Q&&(this._addTile(Q.tileID),M[Q.tileID.key]=Q.tileID),D[q]=$}const k=g.at(-1).overscaledZ;for(const q in this._tiles){const $=this._tiles[q];if(A[q]||!$.hasData())continue;let U=$.tileID;for(;U.overscaledZ>k;){U=U.scaledTo(U.overscaledZ-1);const Q=this._tiles[U.key];if(Q&&Q.hasData()&&D[U.key]){A[q]=$.tileID;break}}}for(const q in M)A[q]||(this._coveredTiles[q]=!0,A[q]=M[q])}for(const M in A)this._tiles[M].clearFadeHold();const I=u.dy(this._tiles,A);for(const M of I){const D=this._tiles[M];D.hasSymbolBuckets&&!D.holdingForFade()?D.setHoldDuration(this.map._fadeDuration):D.hasSymbolBuckets&&!D.symbolFadeFinished()||this._removeTile(+M)}this._updateLoadedParentTileCache(),this._renderSourceType===u.dz.Symbol&&this._source.afterUpdate&&this._source.afterUpdate()}releaseSymbolFadeTiles(){for(const t in this._tiles)this._tiles[t].holdingForFade()&&this._removeTile(+t)}_updateRetainedTiles(t){const n={};if(t.length===0)return n;const l={},d=t.reduce((w,E)=>Math.min(w,E.overscaledZ),1/0),p=t[0].overscaledZ,m=Math.max(p-sn.maxOverzooming,this._source.minzoom),g=Math.max(p+sn.maxUnderzooming,this._source.minzoom),x={};for(const w of t){const E=this._addTile(w);n[w.key]=w,E.hasData()||d<this._source.maxzoom&&(x[w.key]=w)}this._retainLoadedChildren(x,d,g,n);for(const w of t){let E=this._tiles[w.key];if(E.hasData())continue;if(w.canonical.z>=this._source.maxzoom){const I=w.children(this._source.maxzoom)[0],M=this.getTile(I);if(M&&M.hasData()){n[I.key]=I;continue}}else{const I=w.children(this._source.maxzoom);if(n[I[0].key]&&n[I[1].key]&&n[I[2].key]&&n[I[3].key])continue}let A=E.wasRequested();for(let I=w.overscaledZ-1;I>=m;--I){const M=w.scaledTo(I);if(l[M.key]||(l[M.key]=!0,E=this.getTile(M),!E&&A&&(E=this._addTile(M)),E&&(n[M.key]=M,A=E.wasRequested(),E.hasData())))break}}return n}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const t in this._tiles){const n=[];let l,d=this._tiles[t].tileID;for(;d.overscaledZ>0;){if(d.key in this._loadedParentTiles){l=this._loadedParentTiles[d.key];break}n.push(d.key);const p=d.scaledTo(d.overscaledZ-1);if(l=this._getLoadedTile(p),l)break;d=p}for(const p of n)this._loadedParentTiles[p]=l}}_addTile(t){let n=this._tiles[t.key];if(n)return n.isExtraShadowCaster!==!0||this._shadowCasterTiles[t.key]||this._reloadTile(t.key,"reloading"),n;n=this._cache.getAndRemove(t),n&&(this._setTileReloadTimer(t.key,n),n.tileID=t,this._state.initializeTileState(n,this.map?this.map.painter:null),this._cacheTimers[t.key]&&(clearTimeout(this._cacheTimers[t.key]),delete this._cacheTimers[t.key],this._setTileReloadTimer(t.key,n)));const l=!!n;if(!l){const d=this.map?this.map.painter:null,p=this._source.tileSize*t.overscaleFactor();n=this._source.type==="raster-array"?new Bd(t,p,this.transform.tileZoom,d,this._isRaster):new zl(t,p,this.transform.tileZoom,d,this._isRaster,this._source.worldview),this._loadTile(n,this._tileLoaded.bind(this,n,t.key,n.state))}return n.uses++,this._tiles[t.key]=n,l||this._source.fire(new u.B("dataloading",{tile:n,coord:n.tileID,dataType:"source"})),n}_setTileReloadTimer(t,n){t in this._timers&&(clearTimeout(this._timers[t]),delete this._timers[t]);const l=n.getExpiryTimeout();l&&(this._timers[t]=setTimeout(()=>{this._reloadTile(t,"expired"),delete this._timers[t]},l))}_removeTile(t){const n=this._tiles[t];n&&(n.uses--,delete this._tiles[t],this._timers[t]&&(clearTimeout(this._timers[t]),delete this._timers[t]),n.uses>0||(n.hasData()&&n.state!=="reloading"||n.state==="empty"?this._cache.add(n.tileID,n,n.getExpiryTimeout()):(n.aborted=!0,this._abortTile(n),this._unloadTile(n))))}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,n,l){const d=[],p=this.transform;if(!p)return d;const m=p.projection.name==="globe",g=u.bE(p.center.lng),x=p.getFreeCameraOptions().position||new u.ac(0,0,0);for(const w in this._tiles){const E=this._tiles[w];if(l&&E.clearQueryDebugViz(),E.holdingForFade())continue;let A;if(m){const I=E.tileID.canonical;if(I.z===0){const M=[Math.abs(u.as(g,...vs(I,-1))-g),Math.abs(u.as(g,...vs(I,1))-g)];A=[0,2*M.indexOf(Math.min(...M))-1]}else{const M=[Math.abs(u.as(g,...vs(I,-1))-g),Math.abs(u.as(g,...vs(I,0))-g),Math.abs(u.as(g,...vs(I,1))-g)];A=[M.indexOf(Math.min(...M))-1]}}else A=[0];for(const I of A){const M=t.containsTile(E,p,n,I,x);M&&d.push(M)}}return d}getShadowCasterCoordinates(){return this._getRenderableCoordinates(!1,!0)}getVisibleCoordinates(t){return this._getRenderableCoordinates(t)}_getRenderableCoordinates(t,n){if(!this.transform)return[];const l=this.getRenderableIds(t,n).map(p=>this._tiles[p].tileID),d=this.transform.projection.name==="globe";for(const p of l)p.projMatrix=this.transform.calculateProjMatrix(p.toUnwrapped()),p.expandedProjMatrix=d?this.transform.calculateProjMatrix(p.toUnwrapped(),!1,!0):p.projMatrix;return l}sortCoordinatesByDistance(t){if(!this.transform)return t.slice();const n=t.slice(),l=this.transform._camera.position,d=this.transform._camera.forward(),p={};for(const m of n){const g=1/(1<<m.canonical.z);p[m.key]=((m.canonical.x+.5)*g+m.wrap-l[0])*d[0]+((m.canonical.y+.5)*g-l[1])*d[1]-l[2]*d[2]}return n.sort((m,g)=>p[m.key]-p[g.key]),n}hasTransition(){if(this._source.hasTransition())return!0;if(this._supportsFading){const t=u.r.now();for(const n in this._tiles){const l=this._tiles[n];if(l.fadeEndTime!==void 0&&l.fadeEndTime>=t)return!0}}return!1}setFeatureState(t,n,l){this._state.updateState(t=t||"_geojsonTileLayer",n,l)}removeFeatureState(t,n,l){this._state.removeFeatureState(t=t||"_geojsonTileLayer",n,l)}getFeatureState(t,n){return this._state.getState(t=t||"_geojsonTileLayer",n)}setDependencies(t,n,l){const d=this._tiles[t];d&&d.setDependencies(n,l)}reloadTilesForDependencies(t,n){for(const l in this._tiles)this._tiles[l].hasDependency(t,n)&&this._reloadTile(+l,"reloading");this._cache.filter(l=>!l.hasDependency(t,n))}_preloadTiles(t,n){if(!this._sourceLoaded){const x=()=>{this._sourceLoaded&&(this._source.off("data",x),this._preloadTiles(t,n))};return void this._source.on("data",x)}const l=new Map,d=Array.isArray(t)?t:[t],p=this.map.painter.terrain,m=this.usedForTerrain&&p?p.getScaledDemTileSize():this._source.tileSize;for(const x of d){const w=x.coveringTiles({tileSize:m,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!this.usedForTerrain,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain});for(const E of w)l.set(E.key,E);this.usedForTerrain&&x.updateElevation(!1)}const g=Array.from(l.values());u.dA(g,(x,w)=>{const E=new zl(x,this._source.tileSize*x.overscaleFactor(),this.transform.tileZoom,this.map.painter,this._isRaster,this._source.worldview);this._loadTile(E,A=>{this._source.type==="raster-dem"&&E.dem&&this._backfillDEM(E),w(A,E)})},n)}}function Rc(s,t){const n=Math.abs(2*s.wrap)-+(s.wrap<0),l=Math.abs(2*t.wrap)-+(t.wrap<0);return s.overscaledZ-t.overscaledZ||l-n||t.canonical.y-s.canonical.y||t.canonical.x-s.canonical.x}function vs(s,t){const n=1<<s.z;return[s.x/n+t,(s.x+1)/n+t]}function nh(s,t){if(s.z<=t.z){const l=t.z-s.z;return t.x>>l===s.x&&t.y>>l===s.y}const n=s.z-t.z;return s.x>>n===t.x&&s.y>>n===t.y}function Je(s,t){return s.sourceFQID!==t.sourceFQID?s.sourceFQID<t.sourceFQID?-1:1:s.tileId.z!==t.tileId.z?s.tileId.z-t.tileId.z:s.tileId.x!==t.tileId.x?s.tileId.x-t.tileId.x:s.tileId.y-t.tileId.y}sn.maxOverzooming=10,sn.maxUnderzooming=3;class qd{constructor(t=[]){this.tiles=t}getTilesIntersecting(t){const n=[];for(const l of this.tiles)nh(l.tileId,t)&&n.push(l);return n}equals(t){if(this.tiles.length!==t.length)return!1;for(let n=0;n<this.tiles.length;++n){const l=this.tiles[n],d=t[n];if(l.sourceFQID!==d.sourceFQID||l.tileId.z!==d.tileId.z||l.tileId.x!==d.tileId.x||l.tileId.y!==d.tileId.y||l.generation!==d.generation)return!1}return!0}empty(){return this.tiles.length===0}}class wm{constructor(){this._tiles=[],this._snapshot=new qd,this._snapshotChanged=!1}clear(){this._tiles.length=0}consumeSnapshotChanged(){const t=this._snapshotChanged;return this._snapshotChanged=!1,t}addTileElevation(t,n,l,d){this._tiles.push({sourceFQID:t,tileId:n,features:l,generation:d})}updateSnapshotIfNeeded(){return this._tiles.sort(Je),this._snapshot.equals(this._tiles)||(this._snapshot=new qd(this._tiles.slice()),this._snapshotChanged=!0),this._snapshot}}function Hd(s,t){const n=[];for(const l of s.getTilesIntersecting(t))n.push(`${l.tileId.z}/${l.tileId.x}/${l.tileId.y}:${l.generation}`);return n.sort(),n.join("|")}function oo(s,t){const n=u.dD(s);return n===t||!n&&!t}function Rn(s,t){return s._mergedOtherSourceCaches[t]||s._mergedSymbolSourceCaches[t]||s._mergedHdRoadElevationSourceCaches[t]}function $d(s){const t=s.sourceLayer;return!!t&&t.startsWith("hd_road_")}function Zd(s){return!!s.layout&&(s.type==="line"&&s.layout.get("line-elevation-reference")==="hd-road-markup"||s.type==="circle"&&s.layout.get("circle-elevation-reference")==="hd-road-markup"||s.type==="symbol"&&s.layout.get("symbol-elevation-reference")==="hd-road-markup"||s.type==="fill"&&s.layout.get("fill-elevation-reference")==="hd-road-markup")}function oh(s){const t=new Set;for(const n in s._mergedLayers){const l=s._mergedLayers[n];Zd(l)&&t.add(u.y(l.source,l.scope))}return t}function Wd(s){const t=oh(s),n=new Set;for(const l in s._mergedLayers){const d=s._mergedLayers[l];if(!d.source||!$d(d))continue;const p=u.y(d.source,d.scope);t.has(p)||n.add(p)}return n}function Xd(s){const t=oh(s);if(t.size===0)return!1;const n=sh(s);for(const l of t)for(const d of n)if(l!==d)return!0;return!1}function sh(s){const t=new Set;for(const n in s._mergedLayers){const l=s._mergedLayers[n];l.source&&$d(l)&&t.add(u.y(l.source,l.scope))}return t}function Ol(s,t,n){const l=oh(s);if(l.size===0)return;if(!n){const p=sh(s);for(const m of p)l.delete(m)}if(l.size===0)return;const d=[s._mergedOtherSourceCaches,s._mergedSymbolSourceCaches];for(const p of d)for(const m in p){if(!l.has(m))continue;const g=p[m];for(const x in g._tiles){const w=g._tiles[x];w&&(t&&!t(w)||(w.hasDeferredElevationFeatures=!1,g._reloadTile(+x,"reloading")))}}}class Bl{constructor(){this.elevationSourceCaches={},this.manager=new wm,this._needsCrossSourceElevation=!1,this._ingestFQIDs=new Set,this._terrainActiveLast=void 0}}function Dc(s){s.map&&s.map.painter&&(s.map.painter.elevationCoverageSnapshot=null,s.map.painter.elevationProvidersReady=void 0)}function Yd(s){s._crossSourceElevationActive=!1,(function(t){const n=t._hdElevation,l=!!(t.map&&t.map.painter&&t.map.painter.elevationCoverageSnapshot);return n?!n._needsCrossSourceElevation&&n._ingestFQIDs.size===0&&n.manager._tiles.length===0&&!l:!l})(s)||(Dc(s),s._hdElevation&&(s._hdElevation._needsCrossSourceElevation=!1,s._hdElevation._ingestFQIDs.clear(),s._hdElevation.manager.clear(),s._hdElevation._terrainActiveLast=void 0))}function Kd(s,t,n){const l=u.y(n.id,s.scope);if(t.elevationSourceCaches[l])return;const d=`hd-road-elevation:${n.id}`,p=u.y(d,s.scope),m=s._sourceCaches[d]=new sn(p,n,u.dz.HdRoadElevation);t.elevationSourceCaches[l]=m,m.onAdd(s.map);const g=s._otherSourceCaches[n.id];g&&g._sourceLoaded&&(m._sourceLoaded=!0)}function Jd(s,t){if(yl(s,s.map&&s.map.transform))return t.manager.clear(),void(s.map.painter&&(s.map.painter.elevationCoverageSnapshot=null));if(!t._needsCrossSourceElevation)return void Dc(s);for(const g of t._ingestFQIDs){const x=Rn(s,g);x&&(x.used=!0)}t.manager.clear();let n=!0;for(const g of t._ingestFQIDs){const x=Rn(s,g);if(!x)continue;const w=x._tiles;for(const E in w){const A=w[E];if(!A||!A.loaded())continue;const I=A.parsedElevationFeatures;I!==void 0?t.manager.addTileElevation(g,A.tileID.canonical,I,A.parsedElevationGeneration):n=!1}}const l=t.manager._snapshot,d=t.manager.updateSnapshotIfNeeded();s.map.painter&&(s.map.painter.elevationCoverageSnapshot=d.empty()?null:d);const p=n&&(function(g,x){for(const w of x){const E=Rn(g,w);if(!E||!E._sourceLoaded)return!1;for(const A in E._tiles){const I=E._tiles[A];if(I&&(I.state==="loading"||I.state==="reloading"))return!1}}return!0})(s,Wd(s));s.map.painter&&(s.map.painter.elevationProvidersReady=p);const m=t.manager.consumeSnapshotChanged();(m||p)&&Ol(s,g=>{return!!g.hasDeferredElevationFeatures||m&&(x=d,Hd(l,w=g.tileID.canonical)!==Hd(x,w));var x,w})}const kl=s=>({u_matrix:s});function Tm(s,t){const n=s.context.gl;return new lt({func:n.EQUAL,mask:255},s._tileClippingMaskIDs[t.key]||0,0,n.KEEP,n.KEEP,n.KEEP)}function Em(s,t){const n=s.context.gl;return new lt({func:n.EQUAL,mask:255},255&~(s._tileClippingMaskIDs[t.key]||0),0,n.KEEP,n.KEEP,n.KEEP)}function ah(s,t){if(!s.frcCoverageSnapshot||!s.frcCoverageRenderer)return null;const n=s.frcCoverageSnapshot.getTileOrParent(t.canonical);if(!n||n.frcMask===0)return null;const l=s.frcCoverageRenderer.getBuffers(n.tileId);if(!l)return null;const d=new u.bs(n.tileId.z,n.tileId.x,n.tileId.y),p=new u.bb(t.wrap,d);return{buffers:l,projMatrix:s.transform.calculateProjMatrix(p),coverageTile:n}}function Qd(s,t,n){if(!s.frcCoverageSnapshot)return;const l=s.context,d=l.gl,p=s.getOrCreateProgram("clippingMask");l.setColorMode(dt.disabled),l.setDepthMode(nt.disabled);for(const m of t){const g=ah(s,m);if(!g)continue;const x=g.buffers.frcLevelSegments[n];x&&p.draw(s,d.TRIANGLES,nt.disabled,new lt({func:d.EQUAL,mask:255},s._tileClippingMaskIDs[m.key]||0,255,d.KEEP,d.KEEP,d.INVERT),dt.disabled,pt.disabled,kl(g.projMatrix),`$frc_coverage_${n}`,g.buffers.vertexBuffer,g.buffers.indexBuffer,x)}}function Sm(s,t,n){if(!s.frcCoverageSnapshot)return;const l=s.context,d=l.gl,p=s.getOrCreateProgram("clippingMask");l.setColorMode(dt.disabled),l.setDepthMode(nt.disabled);for(const m of t){const g=ah(s,m);if(!g)continue;const x=g.buffers.frcLevelSegments[n];x&&p.draw(s,d.TRIANGLES,nt.disabled,new lt({func:d.EQUAL,mask:255},255&~(s._tileClippingMaskIDs[m.key]||0),255,d.KEEP,d.KEEP,d.INVERT),dt.disabled,pt.disabled,kl(g.projMatrix),`$frc_coverage_restore_${n}`,g.buffers.vertexBuffer,g.buffers.indexBuffer,x)}}function ef(s,t,n,l,d){if(t.length===0)return;let p=0;for(const g of t)p|=g.frcMask;const m=t.map(g=>g.coord);for(let g=0;g<9;++g)if(p&1<<g){if(Qd(s,m,g),l)for(const x of t)x.frcMask&1<<g&&l(x,g,Tm(s,x.coord));if(n>0&&d)for(const x of t)x.frcMask&1<<g&&d(x,g,Em(s,x.coord));Sm(s,m,g)}}function tf(s){for(const t of s)if(t.rings.length>0&&t.rings[0].length>0)return!0;return!1}function rf(s){const t=s.frcCoverageFadeRange;return!t||t[1]<=t[0]?0:1-Math.max(0,Math.min(1,(s.transform.zoom-t[0])/(t[1]-t[0])))}const nf={loaded:!0,drawBuilding:function(s,t,n,l){s.currentLayer<s.firstLightBeamLayer&&(s.firstLightBeamLayer=s.currentLayer);const d=n.paint.get("building-ambient-occlusion-ground-intensity"),p=n.paint.get("building-ambient-occlusion-ground-radius"),m=n.paint.get("building-ambient-occlusion-ground-attenuation"),g=n.paint.get("building-opacity");if(g<=0)return;let x=d>0&&p>0,w=!0;const E=n.paint.get("building-vertical-scale");if(E<=0)return;s.shadowRenderer||(w=!1);const A=s.conflationActive&&s.style.isLayerClipped(n,t.getSource()),I=s.style.order.indexOf(n.fqid);if((function(M,D,z,O,k,q){for(const $ of q){const U=D.getTile($).getBucket(z);U&&(k&&U.updateReplacement($,M.replacementSource,O),U.uploadUpdatedIndexBuffer(M.context))}})(s,t,n,I,A,l),(function(M,D,z,O){for(const k of O){const q=D.getTile(k).getBucket(z);q&&q.needsEvaluation()&&q.uploadUpdatedColorBuffer(M.context)}})(s,t,n,l),n.resetLayerRenderingStats(s),s.shadowRenderer&&(s.shadowRenderer.useNormalOffset=!0),s.renderPass==="shadow"&&s.shadowRenderer){const M=[],D=s.shadowRenderer.getShadowPassDepthMode();Sc({painter:s,source:t,layer:n,coords:l,defines:M,blendMode:dt.disabled,depthMode:D,opacity:g,verticalScale:E,facadeEmissiveChance:0,facadeAOIntensity:0,floodLightIntensity:0,floodLightColor:[0,0,0]})}else if(s.renderPass==="translucent"){let M=["HAS_ATTRIBUTE_a_part_color_emissive","LIGHTING_3D_MODE"];w&&(M=M.concat("RENDER_SHADOWS")),s.shadowRenderer&&s.shadowRenderer.useNormalOffset&&(M=M.concat("NORMAL_OFFSET"));const D=n.paint.get("building-facade-emissive-chance"),z=n.paint.get("building-ambient-occlusion-intensity"),O=n.paint.get("building-flood-light-intensity"),k=n.paint.get("building-flood-light-color-use-theme").constantOr("default")==="none",q=n.paint.get("building-flood-light-color").toNonPremultipliedRenderColor(k?null:n.lut).toArray01().slice(0,3),$=n.paint.get("building-flood-light-ground-attenuation"),U=O>0,Q=new nt(s.context.gl.LEQUAL,nt.ReadWrite,s.depthRangeFor3D);g<1&&Sc({painter:s,source:t,layer:n,coords:l,defines:M,blendMode:dt.disabled,depthMode:Q,opacity:g,verticalScale:E,facadeEmissiveChance:D,facadeAOIntensity:z,floodLightIntensity:O,floodLightColor:q,depthOnly:!0});const Y=s.colorModeForRenderPass();Sc({painter:s,source:t,layer:n,coords:l,defines:M,blendMode:Y,depthMode:Q,opacity:g,verticalScale:E,facadeEmissiveChance:D,facadeAOIntensity:z,floodLightIntensity:O,floodLightColor:q});const ae=n.paint.get("building-front-cutoff");Ec(s.transform.pitch,ae,!!s.terrain),x&&Mn(s,t,n,l,!0,g,d,p,O,q,m,A),U&&Mn(s,t,n,l,!1,g,d,p,O,q,$,A)}else if(s.renderPass==="light-beam"){const M=["HAS_ATTRIBUTE_a_part_color_emissive","HAS_ATTRIBUTE_a_bloom_attenuation"],D=new nt(s.context.gl.LEQUAL,nt.ReadOnly,s.depthRangeFor3D);Sc({painter:s,source:t,layer:n,coords:l,defines:M,blendMode:dt.alphaBlended,depthMode:D,opacity:g,verticalScale:E,facadeEmissiveChance:0,facadeAOIntensity:0,floodLightIntensity:0,floodLightColor:[0,0,0]})}s.shadowRenderer&&(s.shadowRenderer.useNormalOffset=!1),s.resetStencilClippingMasks()},BuildingTileBorderManager:class{constructor(){this.visibleTiles=[]}updateBorders(s,t){const n=[],l=[],d=s._getRenderableCoordinates(!1,!0);for(const g of d){const x=s.getTile(g);if(!x.hasData())continue;const w=x.getBucket(t);w&&(w.isEmpty()||(n.push(g.key),l.push({bucket:w,tileID:g.canonical})))}let p=n.length!==this.visibleTiles.length;if(!p){n.sort();for(let g=0;g<n.length;g++)if(n[g]!==this.visibleTiles[g]){p=!0;break}}if(!p)return;const m=new Set;this.visibleTiles=n,l.sort((g,x)=>g.tileID.z-x.tileID.z||g.tileID.x-x.tileID.x||g.tileID.y-x.tileID.y);for(const g of l){const x=new Array,w=new Array,E=g.bucket;for(const A of E.featuresOnBorder)m.has(A.featureId)?w.push(A.footprintIndex):(m.add(A.featureId),x.push(A.footprintIndex));E.updateFootprintHiddenFlags(x,u.cH,!1),E.updateFootprintHiddenFlags(w,u.cH,!0)}}},drawRasterParticle:function(s,t,n,l,d,p){s.renderPass==="offscreen"&&(function(m,g,x,w){if(!w.length)return;const E=m.context,A=E.gl,I=g.getSource();if(!(I instanceof Mo))return;const M=Math.ceil(Math.sqrt(x.paint.get("raster-particle-count")));let D=x.particlePositionRGBAImage;if(!D||D.width!==M){const $=(function(U){const Q=U*U,Y=new Uint8Array(4*Q),ae=.9090909090909091;for(let W=0;W<Q;W++){const J=ae*(u.cy(2*W+0)+ys),se=ae*(u.cy(2*W+1)+ys),ue=255*J%1,he=255*se%1,ve=ue,xe=se-he/255,Le=he;Y[4*W+0]=255*(J-ue/255),Y[4*W+1]=255*ve,Y[4*W+2]=255*xe,Y[4*W+3]=255*Le}return Y})(M);D=x.particlePositionRGBAImage=new u.t({width:M,height:M},$)}let z=x.particleFramebuffer;z?z.width!==M&&(z.destroy(),z=x.particleFramebuffer=E.createFramebuffer(M,M,1,null)):z=x.particleFramebuffer=E.createFramebuffer(M,M,1,null);const O=[];for(const $ of w){const U=g.getTile($);if(!(U instanceof Bd))continue;const Q=Nd(U,I,x);if(!Q)continue;const Y=[U.tileSize,U.tileSize];let ae=x.tileFramebuffer;ae||(ae=x.tileFramebuffer=E.createFramebuffer(Y[0],Y[1],1,null));let W=U.rasterParticleState;W||(W=U.rasterParticleState=new ym(E,$,Y,D));const J=W.update(x.lastInvalidatedAt);W.particleTextureDimension!==M&&W.updateParticleTexture($,D);const se=W.targetColorTexture;W.targetColorTexture=W.backgroundColorTexture,W.backgroundColorTexture=se;const ue=W.particleTexture0;W.particleTexture0=W.particleTexture1,W.particleTexture1=ue,O.push([$,Q,W,J])}if(O.length===0)return;const k=u.r.now(),q=x.previousDrawTimestamp?.001*(k-x.previousDrawTimestamp):.0167;if(x.previousDrawTimestamp=k,x.hasColorMap()){E.activeTexture.set(A.TEXTURE0+2);let $=x.colorRampTexture;$||($=x.colorRampTexture=new u.T(E,x.colorRamp,A.RGBA8)),$.bind(A.LINEAR,A.CLAMP_TO_EDGE)}E.bindFramebuffer.set(x.tileFramebuffer.framebuffer),(function($,U,Q){const Y=$.context,ae=Y.gl,W=U.tileFramebuffer;Y.activeTexture.set(ae.TEXTURE0);const J={u_texture:0,u_opacity:1.05*(ue=U.paint.get("raster-particle-fade-opacity-factor"))/(ue+.05)},se=$.getOrCreateProgram("rasterParticleTexture",{defines:[],overrideFog:!1});var ue;for(const he of Q){const[,,ve,xe]=he;W.colorAttachment0.set(ve.targetColorTexture.texture),Y.viewport.set([0,0,W.width,W.height]),Y.clear({color:u.C.transparent}),xe&&(ve.backgroundColorTexture.bind(ae.NEAREST,ae.CLAMP_TO_EDGE),se.draw($,ae.TRIANGLES,nt.disabled,lt.disabled,dt.alphaBlended,pt.disabled,J,U.id,$.viewportBuffer,$.quadTriangleIndexBuffer,$.viewportSegments))}})(m,x,O),(function($,U,Q,Y){const ae=$.context,W=ae.gl,J=Q.tileFramebuffer,se=$.transform.projection.name==="globe",ue=Q.paint.get("raster-particle-max-speed");for(const he of Y){const[ve,xe,Le]=he;ae.activeTexture.set(W.TEXTURE0+0),xe.texture.bind(W.LINEAR,W.CLAMP_TO_EDGE),J.colorAttachment0.set(Le.targetColorTexture.texture);const _e=$.getOrCreateProgram("rasterParticleDraw",{defines:xe.defines,overrideFog:!1});ae.activeTexture.set(W.TEXTURE0+1);const Pe=xe.scalarData?[]:[0,1,2,3].map(Me=>u.c0[Me](ve));Pe.push(ve);const me=ve.canonical.x,Re=ve.canonical.y;for(const Me of Pe){const Ae=U.getTile(se?Me.wrapped():Me);if(!Ae)continue;const We=Ae.rasterParticleState;if(!We)continue;const ke=Me.canonical.x+(1<<Me.canonical.z)*(Me.wrap-ve.wrap),Ue=Me.canonical.y;We.particleTexture0.bind(W.NEAREST,W.CLAMP_TO_EDGE);const je=$u(1,We.particleTexture0.size[0],[ke-me,Ue-Re],0,xe.texture.size,2,ue,xe.textureOffset,xe.scale,xe.offset);_e.draw($,W.POINTS,nt.disabled,lt.disabled,dt.alphaBlended,pt.disabled,je,Q.id,We.particleIndexBuffer,void 0,We.particleSegment)}}})(m,g,x,O),E.bindFramebuffer.set(x.particleFramebuffer.framebuffer),(function($,U,Q,Y){const ae=$.context,W=ae.gl,J=U.paint.get("raster-particle-max-speed"),se=Y*U.paint.get("raster-particle-speed-factor")*.15,ue=(function(ve){return Math.pow(ve,6)})(.01+1*U.paint.get("raster-particle-reset-rate-factor")),he=U.particleFramebuffer;ae.viewport.set([0,0,he.width,he.height]);for(const ve of Q){const[,xe,Le]=ve;ae.activeTexture.set(W.TEXTURE0+0),xe.texture.bind(W.LINEAR,W.CLAMP_TO_EDGE),ae.activeTexture.set(W.TEXTURE0+1);const _e=Le.particleTexture0;_e.bind(W.NEAREST,W.CLAMP_TO_EDGE);const Pe=Od(1,_e.size[0],0,xe.texture.size,J,se,ue,xe.textureOffset,xe.scale,xe.offset);he.colorAttachment0.set(Le.particleTexture1.texture),ae.clear({color:u.C.transparent}),$.getOrCreateProgram("rasterParticleUpdate",{defines:xe.defines}).draw($,W.TRIANGLES,nt.disabled,lt.disabled,dt.unblended,pt.disabled,Pe,U.id,$.viewportBuffer,$.quadTriangleIndexBuffer,$.viewportSegments)}})(m,x,O,q)})(s,t,n,l),s.renderPass==="translucent"&&((function(m,g,x,w){const E=m.context,A=E.gl,I=g.getSource().tileSize,M=5*(1-u.af(u.bB,u.bB+1,m.transform.zoom))*I+x.paint.get("raster-particle-elevation"),D=!m.options.moving,z=m.transform.projection.name==="globe";if(!w.length)return;const[O,k]=m.stencilConfigForOverlap(w),q=[];z&&q.push("PROJECTION_GLOBE_VIEW");const $=m.stencilModeFor3D();for(const U of k){const Q=U.toUnwrapped(),Y=g.getTile(U);if(!Y.rasterParticleState)continue;const ae=Y.rasterParticleState,W=100;Y.registerFadeDuration(W);const J=g.findLoadedParent(U,0),se=Yu(Y,J,g,m.transform,W);let ue,he;m.terrain&&m.terrain.prepareDrawTile(),E.activeTexture.set(A.TEXTURE0),ae.targetColorTexture.bind(A.LINEAR,A.CLAMP_TO_EDGE),E.activeTexture.set(A.TEXTURE1),J&&J.rasterParticleState?(J.rasterParticleState.targetColorTexture.bind(A.LINEAR,A.CLAMP_TO_EDGE),ue=Math.pow(2,J.tileID.overscaledZ-Y.tileID.overscaledZ),he=[Y.tileID.canonical.x*ue%1,Y.tileID.canonical.y*ue%1]):ae.targetColorTexture.bind(A.LINEAR,A.CLAMP_TO_EDGE);const ve=z?m.transform.expandedFarZProjMatrix:m.transform.calculateProjMatrix(Q,D),xe=m.transform,Le=Ys(xe),_e=u.dk(U.canonical),Pe=u.dl(_e.getCenter().lat);let me,Re,Me,Ae,We;z?(me=Float32Array.from(u.d2(u.dm(U.canonical))),Re=Float32Array.from(xe.globeMatrix),Me=Float32Array.from(u.dn(xe)),Ae=[u.bE(xe.center.lng),u.bF(xe.center.lat)],We=Float32Array.from(u.dp(U.canonical,_e,Pe,xe.worldSize/xe._pixelsPerMercatorPixel))):(me=new Float32Array(16),Re=new Float32Array(9),Me=new Float32Array(16),Ae=[0,0],We=new Float32Array(9));const ke=Mg(ve,me,Re,Me,We,he||[0,0],u.ah(m.transform.zoom),Ae,Le,ue||1,se,M),Ue=m.isTileAffectedByFog(U),je=m.getOrCreateProgram("rasterParticle",{defines:q,overrideFog:Ue});if(m.uploadCommonUniforms(E,je,Q),z){const et=new nt(A.LEQUAL,nt.ReadOnly,m.depthRangeFor3D),tt=0,it=m.globeSharedBuffers;if(it){const[at,bt,_t]=it.getGridBuffers(Pe,tt!==0);je.draw(m,A.TRIANGLES,et,$,dt.alphaBlended,m.renderElevatedRasterBackface?pt.frontCCW:pt.backCCW,ke,x.id,at,bt,_t)}}else{const et=m.depthModeForSublayer(0,nt.ReadOnly),tt=O[U.overscaledZ],{tileBoundsBuffer:it,tileBoundsIndexBuffer:at,tileBoundsSegments:bt}=m.getTileBoundsBuffers(Y);je.draw(m,A.TRIANGLES,et,tt,dt.alphaBlended,pt.disabled,ke,x.id,it,at,bt)}}m.resetStencilClippingMasks()})(s,t,n,l),s.style.map.triggerRepaint())},prepareRasterParticle:function(s,t,n){const l=t.getSource();if(!(l instanceof Mo&&l.loaded()))return;const d=s.sourceLayer||l.rasterLayerIds&&l.rasterLayerIds[0];if(!d)return;const p=s.paint.get("raster-particle-array-band")||l.getInitialBand(d);if(p==null)return;const m=t.getIds().map(g=>t.getTileByID(g));for(const g of m)g.updateNeeded(s.id,p)&&l.prepareTile(g,d,s.id,p)},Rain:class extends Qu{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(s){const t=s.context;if(!this.particlesVx){const n=jd(this.particlesCount),l=new u.du,d=new u.cp;let p=0;const m=u.ds(1323123451230);for(let g=0;g<n.length;++g){const x=n[g],w=[2*m()-1,m(),m(),m()];l.emplaceBack(x[0],x[1],x[2],-1,-1,...w),l.emplaceBack(x[0],x[1],x[2],1,-1,...w),l.emplaceBack(x[0],x[1],x[2],1,1,...w),l.emplaceBack(x[0],x[1],x[2],-1,1,...w),d.emplaceBack(p+0,p+1,p+2),d.emplaceBack(p+0,p+2,p+3),p+=4}this.particlesVx=t.createVertexBuffer(l,xm.members),this.particlesIdx=t.createIndexBuffer(d)}}getDrawParams(s){if(!s.style.rain)return null;const t=s.style.rain.state,n=structuredClone(this._params);n.intensity=t.density,n.timeFactor=t.intensity,n.color=structuredClone(t.color),n.screenThinning.intensity=t.centerThinning,n.dropletSizeX=t.dropletSize[0],n.dropletSizeYScale=t.dropletSize[1]/t.dropletSize[0],n.distortionStrength=100*t.distortionStrength;const l=structuredClone(this._vignetteParams);return l.strength=1,l.color=structuredClone(t.vignetteColor),{params:n,vignetteParams:l,revealParams:{revealStart:0,revealRange:.01},direction:structuredClone(t.direction)}}draw(s){const t=this.getDrawParams(s);if(!t)return;const{params:n,revealParams:l,direction:d,vignetteParams:p}=t,m=s.transform.zoom;if(l.revealStart>m)return;const g=Zo(0,1,l.revealStart,l.revealStart+l.revealRange,m);if(!this.particlesVx||!this.particlesIdx)return;p.strength*=g;const x=this.updateOnRender(s,n.timeFactor),w=s.context,E=w.gl,A=s.transform;this.screenTexture&&this.screenTexture.size[0]===s.width&&this.screenTexture.size[1]===s.height||(this.screenTexture=new u.T(w,{width:s.width,height:s.height,data:null},E.RGBA8)),n.distortionStrength>0&&(w.activeTexture.set(E.TEXTURE0),this.screenTexture.bind(E.LINEAR,E.CLAMP_TO_EDGE),E.copyTexSubImage2D(E.TEXTURE_2D,0,0,0,0,0,s.width,s.height));const I=s.getOrCreateProgram("rainParticle");s.uploadCommonUniforms(w,I),w.activeTexture.set(E.TEXTURE0),this.screenTexture.bind(E.LINEAR,E.CLAMP_TO_EDGE);const M=[n.color.r,n.color.g,n.color.b,n.color.a],D=(z,O)=>{const k=Ud(this._movement.getPosition(),z),q=n.dropletSizeX,$=n.dropletSizeX*n.dropletSizeYScale,U=s.width/2,Q=s.height/2,Y=Zo(0,n.screenThinning.start,0,1,n.screenThinning.intensity),ae=Zo(.001,n.screenThinning.range,0,1,n.screenThinning.intensity),W=Zo(0,n.screenThinning.particleOffset,0,1,n.screenThinning.intensity),J=(se={modelview:x.modelviewMatrix,projection:x.projectionMatrix,time:this._accumulatedTimeFromStart,camPos:k,velocityConeAperture:n.velocityConeAperture,velocity:n.velocity,boxSize:z,rainDropletSize:[q,$],distortionStrength:n.distortionStrength,rainDirection:d,color:M,screenSize:[A.width,A.height],thinningCenterPos:[U,Q],thinningShape:[Y,ae,Math.pow(10,n.screenThinning.fadePower)],thinningAffectedRatio:n.screenThinning.affectedRatio,thinningParticleOffset:W,shapeDirectionalPower:n.shapeDirPower,shapeNormalPower:n.shapeNormalPower,mode:O?0:1},{u_modelview:Float32Array.from(se.modelview),u_projection:Float32Array.from(se.projection),u_time:se.time,u_cam_pos:se.camPos,u_texScreen:0,u_velocityConeAperture:se.velocityConeAperture,u_velocity:se.velocity,u_boxSize:se.boxSize,u_rainDropletSize:se.rainDropletSize,u_distortionStrength:se.distortionStrength,u_rainDirection:se.rainDirection,u_color:se.color,u_screenSize:se.screenSize,u_thinningCenterPos:se.thinningCenterPos,u_thinningShape:se.thinningShape,u_thinningAffectedRatio:se.thinningAffectedRatio,u_thinningParticleOffset:se.thinningParticleOffset,u_shapeDirectionalPower:se.shapeDirectionalPower,u_shapeNormalPower:se.shapeNormalPower,u_mode:se.mode});var se;const ue=Math.round(n.intensity*this.particlesCount),he=u.cr.simpleSegment(0,0,4*ue,2*ue);I.draw(s,E.TRIANGLES,nt.disabled,lt.disabled,dt.alphaBlended,pt.disabled,J,"rain_particles",this.particlesVx,this.particlesIdx,he)};n.distortionStrength>0&&D(n.boxSize,!0),D(n.boxSize,!1),this._vignette.draw(s,p)}},Snow:class extends Qu{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(s){const t=s.context;if(!this.particlesVx){const n=jd(this.particlesCount),l=new u.dv,d=new u.cp;let p=0;const m=u.ds(1323123451230);for(let g=0;g<n.length;++g){const x=n[g],w=m(),E=m(),A=m(),I=[g/n.length,w,E,A],M=[m(),m()];l.emplaceBack(x[0],x[1],x[2],-1,-1,...I,...M),l.emplaceBack(x[0],x[1],x[2],1,-1,...I,...M),l.emplaceBack(x[0],x[1],x[2],1,1,...I,...M),l.emplaceBack(x[0],x[1],x[2],-1,1,...I,...M),d.emplaceBack(p+0,p+1,p+2),d.emplaceBack(p+0,p+2,p+3),p+=4}this.particlesVx=t.createVertexBuffer(l,Rg.members),this.particlesIdx=t.createIndexBuffer(d)}}getDrawParams(s){if(!s.style.snow)return null;const t=s.style.snow.state,n=structuredClone(this._params);n.intensity=t.density,n.timeFactor=t.intensity,n.color=structuredClone(t.color),n.screenThinning.intensity=t.centerThinning,n.billboardSize=2.79*t.flakeSize;const l=structuredClone(this._vignetteParams);return l.strength=1,l.color=structuredClone(t.vignetteColor),{params:n,vignetteParams:l,revealParams:{revealStart:0,revealRange:.01},direction:structuredClone(t.direction)}}draw(s){const t=this.getDrawParams(s);if(!t)return;const{params:n,revealParams:l,direction:d,vignetteParams:p}=t,m=s.transform.zoom;if(l.revealStart>m)return;const g=Zo(0,1,l.revealStart,l.revealStart+l.revealRange,m);p.strength*=g;const x=this.updateOnRender(s,n.timeFactor);if(!this.particlesVx||!this.particlesIdx)return;const w=s.context,E=w.gl,A=s.transform,I=s.getOrCreateProgram("snowParticle");s.uploadCommonUniforms(w,I),((M,D,z)=>{const O=Ud(this._movement.getPosition(),M),k=A.width/2,q=A.height/2,$=Zo(0,z.screenThinning.start,0,1,z.screenThinning.intensity),U=Zo(.001,z.screenThinning.range,0,1,z.screenThinning.intensity),Q=Zo(0,z.screenThinning.particleOffset,0,1,z.screenThinning.intensity),Y=(ae={modelview:x.modelviewMatrix,projection:x.projectionMatrix,time:this._accumulatedTimeFromStart,camPos:O,velocityConeAperture:z.velocityConeAperture,velocity:z.velocity,horizontalOscillationRadius:z.horizontalOscillationRadius,horizontalOscillationRate:z.horizontalOscillationRate,boxSize:M,billboardSize:1*z.billboardSize,simpleShapeParameters:[z.shapeFadeStart,z.shapeFadePower],screenSize:[A.width,A.height],thinningCenterPos:[k,q],thinningShape:[$,U,Math.pow(10,z.screenThinning.fadePower)],thinningAffectedRatio:z.screenThinning.affectedRatio,thinningParticleOffset:Q,color:[z.color.r,z.color.g,z.color.b,z.color.a],direction:d},{u_modelview:Float32Array.from(ae.modelview),u_projection:Float32Array.from(ae.projection),u_time:ae.time,u_cam_pos:ae.camPos,u_velocityConeAperture:ae.velocityConeAperture,u_velocity:ae.velocity,u_horizontalOscillationRadius:ae.horizontalOscillationRadius,u_horizontalOscillationRate:ae.horizontalOscillationRate,u_boxSize:ae.boxSize,u_billboardSize:ae.billboardSize,u_simpleShapeParameters:ae.simpleShapeParameters,u_screenSize:ae.screenSize,u_thinningCenterPos:ae.thinningCenterPos,u_thinningShape:ae.thinningShape,u_thinningAffectedRatio:ae.thinningAffectedRatio,u_thinningParticleOffset:ae.thinningParticleOffset,u_particleColor:ae.color,u_direction:ae.direction});var ae;const W=Math.round(z.intensity*this.particlesCount),J=u.cr.simpleSegment(0,0,4*W,2*W);this.particlesVx&&this.particlesIdx&&I.draw(s,E.TRIANGLES,nt.disabled,lt.disabled,dt.alphaBlended,pt.disabled,Y,"snow_particles",this.particlesVx,this.particlesIdx,J)})(n.boxSize,0,n),this._vignette.draw(s,p)}},shaders:Ku,programUniforms:Dg,drawElevatedStructures:function(s){const{painter:t,sourceCache:n,layer:l,coords:d,colorMode:p}=s,m=t.context.gl,g=s.painter.shadowRenderer,x=!!g&&g.enabled,w=new nt(t.context.gl.LEQUAL,nt.ReadOnly,t.depthRangeFor3D);let E=[0,0,0];if(x){const I=t.style.directionalLight,M=t.style.ambientLight;I&&M&&(E=yn(t.style,I,M))}const A=I=>{for(const M of d){const D=n.getTile(M),z=D.getBucket(l);if(!z)continue;const O=z.hdExt?z.hdExt.elevatedStructures:void 0;if(!O)continue;let k,q;if(I?(k=O.renderableBridgeSegments,q=O.bridgeProgramConfigurations.get(l.id)):(k=O.renderableTunnelSegments,q=O.tunnelProgramConfigurations.get(l.id)),!k||k.segments[0].primitiveLength===0)continue;q.updatePaintBuffers(),t.prepareDrawTile();
3325const $=t.isTileAffectedByFog(M),U=[];x&&U.push("RENDER_SHADOWS","NORMAL_OFFSET");const Q=t.getOrCreateProgram("elevatedStructures",{config:q,overrideFog:$,defines:U}),Y=t.translatePosMatrix(M.projMatrix,D,l.paint.get("fill-translate"),l.paint.get("fill-translate-anchor"));x&&g.setupShadows(D.tileID.toUnwrapped(),Q,"vector-tile");const ae=Mc(Y,E);t.uploadCommonUniforms(t.context,Q,M.toUnwrapped()),Q.draw(t,m.TRIANGLES,w,lt.disabled,p,pt.backCCW,ae,l.id,O.vertexBuffer,O.indexBuffer,k,l.paint,t.transform.zoom,q,[O.vertexBufferNormal])}};A(!0),A(!1)},drawElevatedFillShadows:function(s){const{painter:t,sourceCache:n,layer:l,coords:d}=s,p=t.context.gl,m=s.painter.shadowRenderer;for(const g of d){const x=n.getTile(g),w=x.getBucket(l);if(!w)continue;const E=w.hdExt?w.hdExt.elevatedStructures:void 0;if(!E||!E.shadowCasterSegments||E.shadowCasterSegments.segments[0].primitiveLength===0)continue;t.prepareDrawTile();const A=w.bufferData.programConfigurations.get(l.id),I=t.isTileAffectedByFog(g),M=t.getOrCreateProgram("elevatedStructuresDepth",{config:A,overrideFog:I}),D=m.calculateShadowPassMatrixFromTile(x.tileID.toUnwrapped());t.uploadCommonUniforms(t.context,M,g.toUnwrapped());const z=vm(D,0);M.draw(t,p.TRIANGLES,m.getShadowPassDepthMode(),lt.disabled,dt.disabled,pt.disabled,z,l.id,E.vertexBuffer,E.indexBuffer,E.shadowCasterSegments,l.paint,t.transform.zoom,A)}},drawDepthPrepass:function(s,t,n,l,d){if(!t||!n.layout||n.layout.get("fill-elevation-reference")==="none"||n.paint.get("fill-opacity").constantOr(1)===0)return;const p=s.context.gl,m=new nt(s.context.gl.LEQUAL,nt.ReadWrite,s.depthRangeFor3D),g=new nt(s.context.gl.GREATER,nt.ReadWrite,s.depthRangeFor3D),x=(function(M){let D=.01;return M.isOrthographic&&(D=u.ai(1e-4,D,u.bW(M.pitch>=Vr?1:M.pitch/Vr))),2*D})(s.transform),w=s.transform.getFreeCameraOptions().position,E="elevatedStructuresDepthReconstruct",A=s.getOrCreateProgram(E,{defines:["DEPTH_RECONSTRUCTION"]}),I=s.getOrCreateProgram(E);for(const M of l){const D=t.getTile(M),z=D.getBucket(n);if(!z||!z.hdExt)continue;const O=z.hdExt.elevatedStructures,k=z.hdExt.elevationBufferData;if(!O||!O.depthSegments||!k)continue;const q=k.heightRange,$=Gd(M.toUnwrapped(),w),U=s.translatePosMatrix(M.projMatrix,D,n.paint.get("fill-translate"),n.paint.get("fill-translate-anchor"));let Q,Y,ae,W;if(d==="initialize"){if(!q||q.min>=1||O.depthSegments.segments[0].primitiveLength===0)continue;Q=eh(U,$,x,1,0),Y=m,ae=O.depthSegments,W=A}else if(d==="reset"){if(!q||q.min>=0||O.maskSegments.segments[0].primitiveLength===0)continue;Q=eh(U,$,0,0,1),Y=g,ae=O.maskSegments,W=A}else if(d==="geometry"){if(O.depthSegments.segments[0].primitiveLength===0)continue;Q=eh(U,$,x,1,0),Y=m,ae=O.depthSegments,W=I}W.draw(s,p.TRIANGLES,Y,lt.disabled,dt.disabled,pt.disabled,Q,n.id,O.vertexBuffer,O.indexBuffer,ae,n.paint,s.transform.zoom)}},drawGroundShadowMask:function(s,t,n,l){if(!t||!n.layout||n.layout.get("fill-elevation-reference")==="none"||n.paint.get("fill-opacity").constantOr(1)===0)return;const d=s.context.gl,p=new nt(d.LEQUAL,nt.ReadOnly,s.depthRangeFor3D),m=new lt({func:d.ALWAYS,mask:255},255,255,d.KEEP,d.KEEP,d.REPLACE),g=s.transform.getFreeCameraOptions().position,x=s.getOrCreateProgram("elevatedStructuresDepthReconstruct");for(const w of l){const E=t.getTile(w),A=E.getBucket(n);if(!A)continue;const I=A.hdExt?A.hdExt.elevatedStructures:void 0;if(!I||!I.depthSegments||I.depthSegments.segments[0].primitiveLength===0)continue;const M=Gd(w.toUnwrapped(),g),D=s.translatePosMatrix(w.projMatrix,E,n.paint.get("fill-translate"),n.paint.get("fill-translate-anchor")),z=eh(D,M,0,1,0);x.draw(s,d.TRIANGLES,p,m,dt.disabled,pt.disabled,z,n.id,I.vertexBuffer,I.indexBuffer,I.depthSegments,n.paint,s.transform.zoom)}},IndoorManager:class extends u.E{constructor(s,t=!1){super(),this._style=s,this._buildings={},this._activeFloors=new Set,this._closestBuildingId=null,this._indoorState={selectedFloorId:null,activeFloorsVisible:!0,activeFloors:this._activeFloors},this._buildingDetectionStrategy=new Fd,this._initialLoadDone=!1,u.cK(["_updateUI"],this);const n=()=>{this._style.isIndoorEnabled()&&(this._style.map.on("load",()=>
vendor: 1,437 bytes, line 3325
3325{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))};t?(this._initialLoadDone=!0,n()):this._style.on("style.load",n)}destroy(){this._buildings={},this._activeFloors=new Set,this._indoorState=null}selectFloor(s){s===this._selectedFloorId&&this._indoorState&&this._indoorState.activeFloorsVisible||(this._selectedFloorId=s,this._recalculateActiveFloors())}setActiveFloorsVisibility(s){this._updateActiveFloors(s),this._updateIndoorSelector()}setIndoorData(s){let t=!1;for(const[n,l]of Object.entries(s.buildings))if(this._buildings[n])for(const d of l.floorIds)this._buildings[n].floorIds.add(d),this._buildings[n].floors[d]?this._mergeFloors(this._buildings[n].floors[d],l.floors[d]):(this._buildings[n].floors[d]=l.floors[d],t=!0);else this._buildings[n]=l,t=!0;t&&this._recalculateActiveFloors()}getIndoorTileOptions(s,t){return this._indoorState?{sourceLayers:this._style.getIndoorSourceLayers(s,t),indoorState:this._indoorState}:null}getControlState(){const s=this._buildings,t=this._closestBuildingId,n=t&&s?s[t]:void 0;if(!n)return{selectedFloorId:null,activeFloorsVisible:!!this._indoorState&&this._indoorState.activeFloorsVisible,floors:[]};let l=null;for(const p of n.floorIds)if(this._activeFloors&&this._activeFloors.has(p
vendor: 83,888 bytes, line 3325
3325)){l=p;break}const d=Array.from(n.floorIds).map(p=>({id:p,name:n.floors[p].name,zIndex:n.floors[p].zIndex})).sort((p,m)=>m.zIndex-p.zIndex).filter((p,m,g)=>m===0||p.zIndex!==g[m-1].zIndex);return{selectedFloorId:l,activeFloorsVisible:!!this._indoorState&&this._indoorState.activeFloorsVisible,floors:d}}_updateUI(){this._initialLoadDone=!0;const s=this._style.map.transform,t=this._buildingDetectionStrategy.findClosestBuilding(this._buildings,s.center,s.zoom,s.getBounds(),this._makeViewportPolygon());if(t!==this._closestBuildingId){const n=this._closestBuildingId;this._closestBuildingId=t,this._onBuildingTransition(n,t),this._updateIndoorSelector()}}_onBuildingTransition(s,t){if(!this._indoorState)return;!t&&s?(this._indoorState.activeFloors=new Set,this._indoorState.activeFloorsVisible=!1,this._style.updateIndoorDependentLayers()):t&&!s&&(this._recalculateActiveFloors(),this._updateActiveFloors(!0))}_updateIndoorSelector(){this.fire(new u.B("selector-update",this.getControlState()))}_updateActiveFloors(s){this._indoorState={selectedFloorId:this._selectedFloorId,activeFloorsVisible:s,activeFloors:this._activeFloors},this._initialLoadDone?this._style.updateIndoorDependentLayers():this._indoorState.needsUpdate=!0}_recalculateActiveFloors(){if(!this._buildings)return;const s=u.cL.calculate(this._buildings,this._selectedFloorId,this._activeFloors);(function(t,n){if(t===n)return!0;if(!t||!n||t.size!==n.size)return!1;for(const l of t)if(!n.has(l))return!1;return!0})(s,this._activeFloors)||(this._activeFloors=s,this._updateActiveFloors(!!this._indoorState&&this._indoorState.activeFloorsVisible),this._updateIndoorSelector())}_mergeFloors(s,t){t.geometry&&(s.geometry?(s.geometry.type==="Polygon"&&(s.geometry={type:"MultiPolygon",coordinates:[s.geometry.coordinates]}),t.geometry.type==="Polygon"?s.geometry.coordinates.push(t.geometry.coordinates):t.geometry.type==="MultiPolygon"&&s.geometry.coordinates.push(...t.geometry.coordinates)):s.geometry=t.geometry)}_makeViewportPolygon(){const s=this._style.map.transform,t=s.width,n=s.height;return[s.pointLocation(new u.P(0,0)),s.pointLocation(new u.P(t,0)),s.pointLocation(new u.P(t,n)),s.pointLocation(new u.P(0,n))].map(l=>new u.P(l.lng,l.lat))}},HdCoverageState:class{constructor(){this.coverageSourceCaches={},this.manager=new rh}},updateFrcCoverage:function(s,t){t.manager.clear();for(const l in s._mergedHdRoadCoverageSourceCaches){const d=s._mergedHdRoadCoverageSourceCaches[l]._tiles;for(const p in d){const m=d[p];if(!m||!m.loaded())continue;const g=m.frcCoveragePolygons;t.manager.addTileCoverage(m.tileID.canonical,g&&g.length>0?g:[])}}const n=t.manager.updateSnapshotIfNeeded();if(s.map.painter&&(s.map.painter.frcCoverageSnapshot=n.empty()?null:n),!n.empty()){const l=[s._mergedOtherSourceCaches,s._mergedSymbolSourceCaches];for(const d of l)for(const p in d){const m=d[p];for(const g in m._tiles){const x=m._tiles[g];x&&x.hasDeferredRoadStructure&&(x.hasDeferredRoadStructure=!1,m._reloadTile(+g,"reloading"))}}}},updateHdCoverageSourceCache:function(s,t,n){if(n.type!=="fill"||n.sourceLayer!==u.dB||t.coverageSourceCaches[n.source])return;const l=s.getOwnSource(n.source);if(!l||l.type!=="vector")return;const d=`hd-road-coverage:${n.source}`,p=u.y(d,s.scope),m=s._sourceCaches[d]=new sn(p,l,u.dz.HdRoadCoverage);t.coverageSourceCaches[n.source]=m,m.setMaxzoomOverride(14),m.onAdd(s.map);const g=s._otherSourceCaches[n.source];g&&g._sourceLoaded&&(m._sourceLoaded=!0)},updateFrcCoverageFadeRange:function(s,t){let n=null,l=null;const d={globals:{zoom:0}};s.forEachFragmentStyle(p=>{if(n)return;const m=p.stylesheet?p.stylesheet.schema:null;if(!m||!m.sdCoverageFadeRange)return;const g=u.y("sdCoverageFadeRange",p.scope),x=p.options?p.options.get(g):void 0,w=x?x.value||x.default:null;if(w){const M=w.evaluate(d);Array.isArray(M)&&M.length===2&&(M[0]>0||M[1]>0)&&(n=[M[0],M[1]])}const E=u.y("sdCoverageSourceLayers",p.scope),A=p.options?p.options.get(E):void 0,I=A?A.value||A.default:null;if(I){const M=I.evaluate(d);Array.isArray(M)&&M.length>0&&(l=M)}else{const M=s.stylesheet&&s.stylesheet.imports||[];for(const D of M)if(D.id===p.scope){const z=D.config?D.config.sdCoverageSourceLayers:void 0;Array.isArray(z)&&z.length>0&&(l=z);break}}}),t.frcCoverageFadeRange=n,t.frcCoverageSourceLayers=n!=null?l||["road","structure"]:[]},HdElevationState:Bl,setupAndUpdateElevationCoverage:function(s){if(!(function(p){for(const m in p._mergedLayers)if(Zd(p._mergedLayers[m]))return!0;return!1})(s))return void Yd(s);const t=yl(s,s.map&&s.map.transform);s._hdElevation||(s._hdElevation=new Bl);const n=s._hdElevation._terrainActiveLast;if(s._hdElevation._terrainActiveLast=t,n!==void 0&&n!==t&&Ol(s,void 0,!0),t)return void(s.map.painter&&(s.map.painter.elevationCoverageSnapshot=null));if(!Xd(s))return void Yd(s);n===void 0&&Ol(s,void 0,!0);const l=s._hdElevation;l._needsCrossSourceElevation=!0,s._crossSourceElevationActive=!0,l._ingestFQIDs=sh(s);const d=Wd(s);s.forEachFragmentStyle(p=>{for(const m of d){if(!oo(m,p.scope))continue;const g=u.dC(m);if(p._otherSourceCaches[g]||p._symbolSourceCaches[g])continue;const x=p.getOwnSource(g);x&&x.type==="vector"&&(p._hdElevation||(p._hdElevation=new Bl),Kd(p,p._hdElevation,x))}}),s.mergeSources(),Jd(s,l)},updateElevationCoverage:Jd,updateHdElevationSourceCache:Kd,markElevationIngestSourceCachesUsed:function(s){if(!s._hdElevation||!s._hdElevation._needsCrossSourceElevation)return;const t=s._hdElevation._ingestFQIDs;if(t)for(const n of t){const l=Rn(s,n);l&&(l.used=!0)}},updateCrossSourceElevationGate:function(s){s._crossSourceElevationActive=Xd(s);const t=s._mergedHdRoadElevationSourceCaches;t&&Object.keys(t).length!==0&&(s._hdElevation||(s._hdElevation=new Bl),s._hdElevation._needsCrossSourceElevation=s._crossSourceElevationActive)},buildElevationRequestParams:function(s,t,n){if(t.renderSourceType===u.dz.HdRoadElevation||yl(s.style,s.transform)||!n)return null;const l=s.painter?s.painter.elevationCoverageSnapshot:null,d=!(!s.painter||!s.painter.elevationProvidersReady);return l?(function(p,m,g){const x=p.getTilesIntersecting(m);if(x.length===0)return{registry:[],hasCoveringTile:!1,allProvidersReady:g};const w=[];for(const E of x)for(const A of E.features)w.push({tileId:E.tileId,feature:A});return w.sort((E,A)=>E.feature.id-A.feature.id),{registry:w,hasCoveringTile:!0,allProvidersReady:g}})(l,t.tileID.canonical,d):{registry:[],hasCoveringTile:!1,allProvidersReady:d}},FrcCoverageRenderer:class{constructor(){this.tileBuffers=new Map,this._context=null}update(s,t){this._context=s;const n=new Set;for(const l of t){if(l.frcMask===0)continue;let d=!1;for(const m of l.polygons)if(m.hasGeometry()){d=!0;break}if(!d)continue;const p=`${l.tileId.z}/${l.tileId.x}/${l.tileId.y}`;if(n.add(p),!this.tileBuffers.has(p)){const m=this._createBuffers(s,l);m&&this.tileBuffers.set(p,m)}}for(const l of this.tileBuffers.keys())if(!n.has(l)){const d=this.tileBuffers.get(l);d.vertexBuffer.destroy(),d.indexBuffer.destroy();for(const p of d.frcLevelSegments)p&&p.destroy();this.tileBuffers.delete(l)}}getBuffers(s){return this.tileBuffers.get(`${s.z}/${s.x}/${s.y}`)||null}destroy(){for(const s of this.tileBuffers.values()){s.vertexBuffer.destroy(),s.indexBuffer.destroy();for(const t of s.frcLevelSegments)t&&t.destroy()}this.tileBuffers.clear()}_createBuffers(s,t){const n=new u.co,l=new u.cp,d=[];for(const m of t.polygons){if(!m.hasGeometry()||m.rings.length===0)continue;const g=n.length,x=l.length,w=n.length,E=[],A=[];let I=0;for(let D=0;D<m.rings.length;D++){const z=m.rings[D];if(!(z.length<3)){D>0&&A.push(I);for(const O of z)n.emplaceBack(O.x,O.y),E.push(O.x,O.y),I++}}const M=u.d0(E,A.length>0?A:void 0);for(let D=0;D<M.length;D+=3)l.emplaceBack(w+M[D],w+M[D+1],w+M[D+2]);d.push({vertexOffset:g,indexOffset:x,vertexCount:n.length-g,indexCount:l.length-x,frcMask:m.frcMask})}if(n.length===0)return null;const p=new Array(9).fill(null);for(let m=0;m<9;++m){const g=1<<m;if((t.frcMask&g)===0)continue;let x=1/0,w=0,E=0,A=!1;for(const I of d)(I.frcMask&g)!==0&&(x=Math.min(x,I.indexOffset),w=Math.max(w,I.indexOffset+I.indexCount),E=Math.max(E,I.vertexOffset+I.vertexCount),A=!0);A&&(p[m]=u.cr.simpleSegment(0,x,E,w-x))}return{vertexBuffer:s.createVertexBuffer(n,u.cq.members),indexBuffer:s.createIndexBuffer(l),frcLevelSegments:p}}},drawFillFrcCoverageFirstPass:function(s){const{painter:t,bucket:n,coord:l,elevatedGeometry:d}=s,p=n.sourceLayerName==="road",m=n.sourceLayerName==="structure";if(!p&&!m||!t.frcCoverageSnapshot||d)return"fallthrough";const g=t.frcCoverageSnapshot.getTileOrParent(l.canonical);if(!g||g.frcMask===0)return"fallthrough";const x=n.hdExt&&n.hdExt.frcData,w=!!x&&!x.empty(),E=tf(g.polygons);if(m&&!E)return"skip";if(m&&E)return s.polygonCoverageTiles.push({coord:s.coord,bufferData:s.bufferData,program:s.program,programConfiguration:s.programConfiguration,uniformValues:s.uniformValues,depthMode:s.depthMode,dynamicBuffers:s.dynamicBuffers,indexBuffer:s.indexBuffer,segments:s.segments,frcMask:g.frcMask}),"deferred";if(p&&w&&x){const A=g.frcMask,I=t.transform.zoom;for(const[M,D]of x.frcPerLevel)A&1<<M||D.segments.length!==0&&s.program.draw(t,s.drawMode,s.depthMode,s.stencilMode,s.colorMode,pt.disabled,s.uniformValues,s.layer.id,s.bufferData.layoutVertexBuffer,s.indexBuffer,D,s.layer.paint,I,s.programConfiguration,s.dynamicBuffers);return x.frcNonRoadSegments.segments.length>0&&s.program.draw(t,s.drawMode,s.depthMode,s.stencilMode,s.colorMode,pt.disabled,s.uniformValues,s.layer.id,s.bufferData.layoutVertexBuffer,s.indexBuffer,x.frcNonRoadSegments,s.layer.paint,I,s.programConfiguration,s.dynamicBuffers),"drawn"}return"fallthrough"},drawFillFrcCoverageSecondPass:function(s,t,n,l,d){if(n.length===0)return;const p=rf(s),m=s.transform.zoom,g=(x,w,E)=>{E!==1&&(x.uniformValues.u_opacity_multiplier=E),x.program.draw(s,l,x.depthMode,w,d,pt.disabled,x.uniformValues,t.id,x.bufferData.layoutVertexBuffer,x.indexBuffer,x.segments,t.paint,m,x.programConfiguration,x.dynamicBuffers),E!==1&&(x.uniformValues.u_opacity_multiplier=1)};ef(s,n,p,(x,w,E)=>g(x,E,1),(x,w,E)=>g(x,E,p))},drawLineFrcCoverageDetect:function(s,t,n,l,d,p,m,g,x,w){const E=t.hdExt&&t.hdExt.frcData;if(!E||E.frcPerLevel.size===0||!s.frcCoverageSnapshot||l)return null;const A=s.frcCoverageSnapshot.getTileOrParent(n.canonical);if(!A||A.frcMask===0)return null;const I=tf(A.polygons),M=s.frcCoverageFadeRange,D=M!=null&&s.transform.zoom>=M[0];if(I&&D){let z=!1;for(const O of E.frcPerLevel.keys())if(A.frcMask&1<<O){z=!0;break}z&&w.push({coord:n,bucket:t,uniformValues:d,programConfiguration:p,program:m,depthMode:g,colorMode:x,frcMask:A.frcMask})}return{coverageTile:A,frcMask:A.frcMask,active:D,hasPolygonGeometry:I}},drawLineFrcRenderLine:function(s,t,n,l){const d=s.hdExt&&s.hdExt.frcData;if(!d)return;const p=t.frcMask;for(const[g,x]of d.frcPerLevel)p&1<<g||l(n,x);const m=d.frcNonRoadSegments;m.segments.length>0&&l(n,m)},drawLineFrcFadePass:function(s,t,n,l,d,p,m){if(l.hasPolygonGeometry)return;const g=t.hdExt&&t.hdExt.frcData;if(!g||!s.frcCoverageFadeRange)return;const[x,w]=s.frcCoverageFadeRange;if(x>=w)return;const E=1-Math.max(0,Math.min(1,(s.transform.zoom-x)/(w-x)));if(E<=0)return;const A=d?p:s.stencilModeForClipping(n),I=l.frcMask;for(const[M,D]of g.frcPerLevel)I&1<<M&&m(A,D,E)},drawLineFrcCoverageSecondPass:function(s,t,n){if(n.length===0)return;const l=s.context.gl,d=rf(s),p=s.transform.zoom,m=(g,x,w,E)=>{const A=g.bucket.hdExt&&g.bucket.hdExt.frcData,I=A&&A.frcPerLevel.get(x);I&&I.segments.length!==0&&(E!==1&&(g.uniformValues.u_opacity_multiplier=E),g.program.draw(s,l.TRIANGLES,g.depthMode,w,g.colorMode,pt.disabled,g.uniformValues,t.id,g.bucket.layoutVertexBuffer,g.bucket.indexBuffer,I,t.paint,p,g.programConfiguration,[g.bucket.layoutVertexBuffer2,g.bucket.patternVertexBuffer,g.bucket.zOffsetVertexBuffer,g.bucket.elevationIdColVertexBuffer,g.bucket.elevationGroundScaleVertexBuffer]),E!==1&&(g.uniformValues.u_opacity_multiplier=1))};ef(s,n,d,(g,x,w)=>m(g,x,w,1),(g,x,w)=>m(g,x,w,d))}},Ft=nf;async function Nl(){return Promise.resolve()}class lh{constructor(t,n,l){this.screenBounds=t,this.cameraPoint=l.getCameraPoint(),this._screenRaycastCache={},this._cameraRaycastCache={},this.isAboveHorizon=n,this.screenGeometry=this.bufferedScreenGeometry(0),this.screenGeometryMercator=this._bufferedScreenMercator(0,l)}static createFromScreenPoints(t,n){let l,d;if(t instanceof u.P||typeof t[0]=="number"){const p=u.P.convert(t);l=[p],d=n.isPointAboveHorizon(p)}else{const p=u.P.convert(t[0]),m=u.P.convert(t[1]),g=p.add(m)._div(2);l=[p,m],d=u.dE(p,m).every(x=>n.isPointAboveHorizon(x))&&n.isPointAboveHorizon(g)}return new lh(l,d,n)}isPointQuery(){return this.screenBounds.length===1}bufferedScreenGeometry(t){return u.dE(this.screenBounds[0],this.screenBounds.length===1?this.screenBounds[0]:this.screenBounds[1],t)}bufferedCameraGeometry(t){const n=this.screenBounds[0],l=this.screenBounds.length===1?this.screenBounds[0].add(new u.P(1,1)):this.screenBounds[1],d=u.dE(n,l,0,!1);return this.cameraPoint.y>l.y&&(this.cameraPoint.x>n.x&&this.cameraPoint.x<l.x?d.splice(3,0,this.cameraPoint):this.cameraPoint.x>=l.x?d[2]=this.cameraPoint:this.cameraPoint.x<=n.x&&(d[3]=this.cameraPoint)),u.dF(d,t)}bufferedCameraGeometryGlobe(t){const n=this.screenBounds[0],l=this.screenBounds.length===1?this.screenBounds[0].add(new u.P(1,1)):this.screenBounds[1],d=u.dE(n,l,t),p=this.cameraPoint.clone(),m=+(p.x>n.x)+ +(p.x>l.x);switch(3*(+(p.y>n.y)+ +(p.y>l.y))+m){case 0:d[0]=p,d[4]=p.clone();break;case 1:d.splice(1,0,p);break;case 2:d[1]=p;break;case 3:d.splice(4,0,p);break;case 5:d.splice(2,0,p);break;case 6:d[3]=p;break;case 7:d.splice(3,0,p);break;case 8:d[2]=p}return d}containsTile(t,n,l,d=0,p){const m=Math.max(t.queryPadding,t.evaluateQueryRenderedFeaturePadding())/n._pixelsPerMercatorPixel+1,g=l?this._bufferedCameraMercator(m,n):this._bufferedScreenMercator(m,n);let x=t.tileID.wrap+(g.unwrapped?d:0);const w=g.polygon.map(O=>u.dG(t.tileTransform,O,x));if(!u.bn(w,0,0,u.aj,u.aj))return;x=t.tileID.wrap+(this.screenGeometryMercator.unwrapped?d:0);const E=this.screenGeometryMercator.polygon.map(O=>u.dH(t.tileTransform,O,x)),A=E.map(O=>new u.P(O[0],O[1])),I=u.dH(t.tileTransform,p,x),M=E.map(O=>{const k=u.aW(O,O,I);return u.au(k,k),new u.bA(I,k)}),D=u.c1(t,1,n.zoom)*n._pixelsPerMercatorPixel;return{queryGeometry:this,tilespaceGeometry:A,tilespaceRays:M,bufferedTilespaceGeometry:w,bufferedTilespaceBounds:(z=u.dI(w),z.min.x=u.as(z.min.x,0,u.aj),z.min.y=u.as(z.min.y,0,u.aj),z.max.x=u.as(z.max.x,0,u.aj),z.max.y=u.as(z.max.y,0,u.aj),z),tile:t,tileID:t.tileID,pixelToTileUnitsFactor:D};var z}_bufferedScreenMercator(t,n){const l=ch(t);if(this._screenRaycastCache[l])return this._screenRaycastCache[l];{let d;return d=n.projection.name==="globe"?this._projectAndResample(this.bufferedScreenGeometry(t),n):{polygon:this.bufferedScreenGeometry(t).map(p=>n.pointCoordinate3D(p)),unwrapped:!0},this._screenRaycastCache[l]=d,d}}_bufferedCameraMercator(t,n){const l=ch(t);if(this._cameraRaycastCache[l])return this._cameraRaycastCache[l];{let d;return d=n.projection.name==="globe"?this._projectAndResample(this.bufferedCameraGeometryGlobe(t),n):{polygon:this.bufferedCameraGeometry(t).map(p=>n.pointCoordinate3D(p)),unwrapped:!0},this._cameraRaycastCache[l]=d,d}}_projectAndResample(t,n){const l=(function(p,m){const g=u.aP([],m.pixelMatrix,m.globeMatrix),x=[0,-u.dJ,0,1],w=[0,u.dJ,0,1],E=[0,0,0,1];u.aO(x,x,g),u.aO(w,w,g),u.aO(E,E,g);const A=new u.P(x[0]/x[3],x[1]/x[3]),I=new u.P(w[0]/w[3],w[1]/w[3]),M=u.dK(p,A)&&x[3]<E[3],D=u.dK(p,I)&&w[3]<E[3];if(!M&&!D)return null;const z=(function(W,J,se){for(let ue=1;ue<W.length;ue++){const he=Ra(J.pointCoordinate3D(W[ue-1]).x),ve=Ra(J.pointCoordinate3D(W[ue]).x);if(se<0){if(he<ve)return{idx:ue,t:-he/(ve-1-he)}}else if(ve<he)return{idx:ue,t:(1-he)/(ve+1-he)}}return null})(p,m,M?-1:1);if(!z)return null;const{idx:O,t:k}=z;let q=O>1?zc(p.slice(0,O),m):[],$=O<p.length?zc(p.slice(O),m):[];q=q.map(W=>new u.P(Ra(W.x),W.y)),$=$.map(W=>new u.P(Ra(W.x),W.y));const U=[...q];U.length===0&&U.push($.at(-1));const Q=U.at(-1),Y=u.ai(Q.y,($.length===0?q[0]:$[0]).y,k);let ae;return ae=M?[new u.P(0,Y),new u.P(0,0),new u.P(1,0),new u.P(1,Y)]:[new u.P(1,Y),new u.P(1,1),new u.P(0,1),new u.P(0,Y)],U.push(...ae),$.length===0?U.push(q[0]):U.push(...$),{polygon:U.map(W=>new u.ac(W.x,W.y)),unwrapped:!1}})(t,n);if(l)return l;const d=(function(p,m){let g=!1,x=-1/0,w=0;for(let A=0;A<p.length-1;A++)p[A].x>x&&(x=p[A].x,w=A);for(let A=0;A<p.length-1;A++){const I=(w+A)%(p.length-1),M=p[I],D=p[I+1];Math.abs(M.x-D.x)>.5&&(M.x<D.x?(M.x+=1,I===0&&(p.at(-1).x+=1)):(D.x+=1,I+1===p.length-1&&(p[0].x+=1)),g=!0)}const E=u.bE(m.center.lng);return g&&E<Math.abs(E-1)&&p.forEach(A=>{A.x-=1}),{polygon:p,unwrapped:g}})(zc(t,n).map(p=>new u.P(Ra(p.x),p.y)),n);return{polygon:d.polygon.map(p=>new u.ac(p.x,p.y)),unwrapped:d.unwrapped}}}function zc(s,t){return u.dL(s,n=>{const l=t.pointCoordinate3D(n);n.x=l.x,n.y=l.y},1/256)}function Ra(s){return s<0?1+s%1:s%1}function ch(s){return 100*s|0}class Im extends u.E{constructor(t,n,l,d){if(super(),this.id=t,this.dispatcher=l,this.type="vector",this.provider=n.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,u.b3(n,["url","scheme","tileSize","promoteId"])),this._options={type:"vector",...n},this._collectResourceTiming=!!n.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(d),this._tileWorkers={},this._deduped=new u.dM}load(t){this._loaded=!1,this.fire(new u.B("dataloading",{dataType:"source"}));const n=Array.isArray(this.map._language)?this.map._language.join():this.map._language,l=this.map.getWorldview(),d=(m,g)=>{this._tileJSONRequest=null,this._loaded=!0,m?(n&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${n}`),l&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${l}`),this.fire(new u.A(m))):g&&(this._setTileJSON(g),Ft.updateCrossSourceElevationGate&&this.map.style&&Ft.updateCrossSourceElevationGate(this.map.style),Bs(g.tiles,this.map._requestManager._customAccessToken),this.fire(new u.B("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new u.B("data",{dataType:"source",sourceDataType:"content"}))),t&&t(m)};this.provider=this._options.provider;const p=u.da(this._options);return p instanceof Error?(this._loaded=!0,this.fire(new u.A(p)),void(t&&t())):this.provider&&!p?(this._loaded=!0,this.fire(new u.A(new Error(`TileProvider "${this.provider}" is not registered`))),void(t&&t())):void(this._tileJSONRequest=p?this.loadTileJSONWithProvider(p,d):u.db(this._options,this.map._requestManager,n,l,d))}loadTileJSONWithProvider(t,n){this.provider=t.name;const l=new AbortController;return(async()=>{const{request:d,options:p}=await u.de(this._options,this.map._requestManager,l.signal);if(l.signal.aborted)return;const m=await this.dispatcher.send("loadTileProvider",{name:t.name,url:t.url,source:this.id,scope:this.scope,type:this.type,options:p,request:d},{signal:l.signal});if(l.signal.aborted)return;const g=m?m.find(w=>w!=null):null,x=u.dg(this._options,g,this.map._requestManager);x instanceof Error?n(x):n(null,x)})().catch(d=>{l.signal.aborted||n(d)}),{cancel:()=>l.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 n of t.vector_layers)this.vectorLayerIds.push(n.id),t.worldview&&t.worldview[n.source]&&this.localizableLayerIds.add(n.id)}this.tileBounds=Xs.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=u.y(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{...this._options}}async loadTile(t,n){const l=t.tileID.canonical.url(this.tiles,this.scheme),d=this.map._requestManager.normalizeTileURL(l),p=!t.actor||t.state==="expired";if(!p&&t.state==="loading")return void(t.reloadCallback=n);p&&(t.actor=this._tileWorkers[d]=this._tileWorkers[d]||this.dispatcher.getActor());const m=new AbortController;t.request=m;try{const g=await this.map._requestManager.transformRequest(d,u.R.Tile,m.signal);if(m.signal.aborted)return n(null);this.dispatchTile(t,d,l,g,m,p,n)}catch(g){if(m.signal.aborted)return n(null);n(g)}}dispatchTile(t,n,l,d,p,m,g){const x=this.map.style?this.map.style.getLut(this.scope):null,w=x?{image:x.image.clone()}:null,E=!(!this.map.style||!this.map.style._crossSourceElevationActive),A=!(!this.map.style||!E),I={request:d,data:void 0,uid:t.uid,tileID:t.tileID,tileZoom:t.tileZoom,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,lut:w,tileSize:this.tileSize*t.tileID.overscaleFactor(),type:this.type,source:this.id,scope:this.scope,pixelRatio:u.r.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,showElevationIdDebug:!!this.map.painter&&this.map.painter._debugParams.showElevationIdDebug,promoteId:this.promoteId,renderSourceType:t.renderSourceType,frcCoverage:(()=>{const D=this.map.painter,z=D?D.frcCoverageFadeRange:null;if(z==null)return null;const O=D?D.frcCoverageSnapshot:null,k=this.map.transform.zoom<z[0],q=O?O.getTileOrParent(t.tileID.canonical):null,$=t.tileID.overscaledZ>=Math.ceil(z[1]),U=O&&$?O.getFullCoverageMask(t.tileID.canonical):null;return{frcMask:$&&U!=null?U:null,resolved:k||O!=null,polygons:q&&q.frcMask!==0?q.polygons:null,tileZoom:q&&q.frcMask!==0?q.tileId.z:null,sourceLayers:D?D.frcCoverageSourceLayers:["road","structure"]}})(),terrainEnabled:yl(this.map.style,this.map.transform),crossSourceElevationEnabled:A,elevation:Ft.buildElevationRequestParams?Ft.buildElevationRequestParams(this.map,t,E):null,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&&u.e(l)&&(I.localizableLayerIds=this.localizableLayerIds),I.request.collectResourceTiming=this._collectResourceTiming,m)if(this.dispatcher.ready||this.provider)t.request=t.actor.sendCancelable("loadTile",I,{},M.bind(this));else{const D=u.dN.call({deduped:this._deduped},I,(z,O)=>{t.aborted||(z||!O?M.call(this,z):(I.data={rawData:O.rawData.slice(0),headers:O.headers},t.actor&&(t.request=t.actor.sendCancelable("loadTile",I,{},M.bind(this)))))},!0);p.signal.addEventListener("abort",D,{once:!0})}else t.request=t.actor.sendCancelable("reloadTile",I,{},M.bind(this));function M(D,z){return delete t.request,t.aborted?g(null):D?g(D):(z&&z.resourceTiming&&(t.resourceTiming=z.resourceTiming),this.map._refreshExpiredTiles&&z&&t.setExpiryData(u.dc(z.headers)),void function(){if(t.aborted)return g(null);t.loadVectorData(z,this.map.painter),u.dd(this.dispatcher),g(null,z),t.reloadCallback&&(this.loadTile(t,t.reloadCallback),t.reloadCallback=null)}.call(this))}}abortTile(t){t.request&&(t.request.abort(),delete t.request),t.actor&&t.actor.notify("abortTile",{uid:t.uid,type:this.type,source:this.id,scope:this.scope})}unloadTile(t,n){t.actor&&t.actor.notify("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)}}function uh(s,t,n,l,d,p,m,g){const x=[s,t,1,n,l,1,d,p,1],w=[m,g,1],E=u.dS([],x),[A,I,M]=u.c4(w,w,E);return u.dT(x,x,[A,0,0,0,I,0,0,0,M])}function Am(s,t,n,l,d,p,m,g){const x=(function(w,E,A,I,M,D,z,O){const k=uh(0,0,1,0,1,1,0,1),q=uh(w,E,A,I,M,D,z,O),$=u.dS([],k);return u.dT(q,q,$)})(s,t,n,l,d,p,m,g);return[x[2]/x[8]/u.aj,x[5]/x[8]/u.aj]}function Vl(s){return[s[0],Math.min(Math.max(s[1],-u.by),u.by)]}class so extends u.E{constructor(t,n,l,d){super(),this.id=t,this.dispatcher=l,this.coordinates=n.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(d),this.options=n,this._dirty=!1}async load(t,n){if(this._loaded=n||!1,this.fire(new u.B("dataloading",{dataType:"source"})),this.url=this.options.url,!this.url)return t&&(this.coordinates=t),this._loaded=!0,void this._finishLoading();const l=new AbortController;this._imageRequest=l;try{const d=await this.map._requestManager.transformRequest(this.url,u.R.Image,l.signal),{data:p}=await u.q(d,l.signal);this._imageRequest=null,this._loaded=!0,this.image=p,this._dirty=!0,this.width=this.image.width,this.height=this.image.height,t&&(this.coordinates=t),this._finishLoading()}catch(d){if(l.signal.aborted)return;this._imageRequest=null,this._loaded=!0,this.fire(new u.A(d))}}loaded(){return this._loaded}updateImage(t){return t.url?(this._imageRequest&&t.url!==this.options.url&&(this._imageRequest.abort(),this._imageRequest=null),this.options.url=t.url,this.load(t.coordinates,this._loaded),this):this}setTexture(t){if(!(t.handle instanceof WebGLTexture))throw new Error("The provided handle is not a WebGLTexture instance");return this.texture=new u.dO(this.map.painter.context,t.handle),this.width=t.dimensions[0],this.height=t.dimensions[1],this._dirty=!1,this._loaded=!0,this._finishLoading(),this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new u.B("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(t){this.map=t,this.load()}onRemove(t){this._imageRequest&&(this._imageRequest.abort(),this._imageRequest=null),!this.texture||this.texture instanceof u.dO||this.texture.destroy(),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy())}setCoordinates(t){if(this.coordinates=t,this._boundsArray=void 0,this._unsupportedCoords=!1,!t.length)return this;this.onNorthPole=!1,this.onSouthPole=!1;let n=t[0][1],l=t[0][1];for(const p of t)p[1]>l&&(l=p[1]),p[1]<n&&(n=p[1]);const d=(l+n)/2;if(d>u.by?this.onNorthPole=!0:d<-u.by&&(this.onSouthPole=!0),!this.onNorthPole&&!this.onSouthPole){const p=t.map(u.ac.fromLngLat);this.tileID=(function(m){let g=1/0,x=1/0,w=-1/0,E=-1/0;for(const z of m)g=Math.min(g,z.x),x=Math.min(x,z.y),w=Math.max(w,z.x),E=Math.max(E,z.y);const A=Math.max(w-g,E-x),I=Math.max(0,Math.floor(-Math.log2(A))),M=Math.pow(2,I);let D=Math.floor((g+w)/2*M);return D>1&&(D-=1),new u.bs(I,D,Math.floor((x+E)/2*M))})(p),this.minzoom=this.maxzoom=this.tileID.z}return this.fire(new u.B("data",{dataType:"source",sourceDataType:"content"})),this}_clear(){!this.texture||this.texture instanceof u.dO||(this.texture.destroy(),this._dirty=!0),this.texture=null,this._boundsArray=void 0,this._unsupportedCoords=!1}_prepareData(t){for(const Q in this.tiles){const Y=this.tiles[Q];Y.state!=="loaded"&&(Y.state="loaded",Y.texture=this.texture)}if(this._boundsArray||this.onNorthPole||this.onSouthPole||this._unsupportedCoords)return;const n=u.cN(new u.bs(0,0,0),this.map.transform.projection),l=[n.projection.project(this.coordinates[0][0],this.coordinates[0][1]),n.projection.project(this.coordinates[1][0],this.coordinates[1][1]),n.projection.project(this.coordinates[2][0],this.coordinates[2][1]),n.projection.project(this.coordinates[3][0],this.coordinates[3][1])];if(!(function(Q){const Y=Q[1].x-Q[0].x,ae=Q[1].y-Q[0].y,W=Q[2].x-Q[1].x,J=Q[2].y-Q[1].y,se=Q[3].x-Q[2].x,ue=Q[3].y-Q[2].y,he=Q[0].x-Q[3].x,ve=Q[0].y-Q[3].y,xe=Y*J-W*ae,Le=W*ue-se*J,_e=se*ve-he*ue,Pe=he*ae-Y*ve;return xe>0&&Le>0&&_e>0&&Pe>0||xe<0&&Le<0&&_e<0&&Pe<0})(l))return console.warn("Image source coordinates are defining non-convex area in the Mercator projection"),void(this._unsupportedCoords=!0);const d=u.cN(this.tileID,this.map.transform.projection),[p,m,g,x]=this.coordinates.map(Q=>{const Y=d.projection.project(Q[0],Q[1]);return u.dG(d,Y)._round()});this.perspectiveTransform=Am(p.x,p.y,m.x,m.y,g.x,g.y,x.x,x.y);const w=this._boundsArray=new u.cP;w.emplaceBack(p.x,p.y,0,0),w.emplaceBack(m.x,m.y,u.aj,0),w.emplaceBack(x.x,x.y,0,u.aj),w.emplaceBack(g.x,g.y,u.aj,u.aj),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy()),this.boundsBuffer=t.createVertexBuffer(w,Xu.members),this.boundsSegments=u.cr.simpleSegment(0,0,4,2);const E=u.dR,A=E+1,I=E+1,M=A*I,D=E*E*2,z=[],O=(function(Q){return[Vl(Q[0]),Vl(Q[1]),Vl(Q[2]),Vl(Q[3])]})(this.coordinates),[k,q,$,U]=(function(Q){let Y=Q[0][0],ae=Y,W=Q[0][1],J=W;for(let se=1;se<Q.length;se++)Q[se][0]<Y?Y=Q[se][0]:Q[se][0]>ae&&(ae=Q[se][0]),Q[se][1]<W?W=Q[se][1]:Q[se][1]>J&&(J=Q[se][1]);return[Y,W,ae-Y,J-W]})(O);{const Q=new u.cP,[Y,ae,W,J]=(function(Ae){let We=Ae[0].x,ke=We,Ue=Ae[0].y,je=Ue;for(let et=1;et<Ae.length;et++)Ae[et].x<We?We=Ae[et].x:Ae[et].x>ke&&(ke=Ae[et].x),Ae[et].y<Ue?Ue=Ae[et].y:Ae[et].y>je&&(je=Ae[et].y);return[We,Ue,ke-We,je-Ue]})(l),se=Ae=>[(Ae.x-Y)/W,(Ae.y-ae)/J],[ue,he,ve,xe]=l.map(se),Le=(function(Ae,We,ke,Ue,je,et,tt,it){const at=uh(0,0,1,0,1,1,0,1),bt=uh(Ae,We,ke,Ue,je,et,tt,it),_t=u.dS([],bt);return u.dT(at,at,_t)})(ue[0],ue[1],he[0],he[1],ve[0],ve[1],xe[0],xe[1]);this.elevatedGlobePerspectiveTransform=Am(ue[0],ue[1],he[0],he[1],ve[0],ve[1],xe[0],xe[1]);const _e=(Ae,We)=>{z.push(Ae.lng);const ke=Math.round((Ae.lng-k)/$*u.aj),Ue=Math.round((Ae.lat-q)/U*u.aj),je=se(We),et=u.c4([],[je[0],je[1],1],Le),tt=Math.round(et[0]/et[2]*u.aj),it=Math.round(et[1]/et[2]*u.aj);Q.emplaceBack(ke,Ue,tt,it)},Pe=l[3].x-l[0].x,me=l[3].y-l[0].y,Re=l[2].x-l[1].x,Me=l[2].y-l[1].y;for(let Ae=0;Ae<I;Ae++){const We=Ae/E,ke=[l[0].x+We*Pe,l[0].y+We*me],Ue=[l[1].x+We*Re,l[1].y+We*Me],je=Ue[0]-ke[0],et=Ue[1]-ke[1];for(let tt=0;tt<A;tt++){const it=tt/E,at={x:ke[0]+je*it,y:ke[1]+et*it};_e(n.projection.unproject(at.x,at.y),at)}}this.elevatedGlobeVertexBuffer=t.createVertexBuffer(Q,Xu.members)}{this.maxLongitudeTriangleSize=0;let Q=[],Y=new u.cp;const ae=(W,J,se)=>{Y.emplaceBack(W,J,se);const ue=z[W],he=z[J],ve=z[se],xe=Math.min(Math.min(ue,he),ve),Le=Math.max(Math.max(ue,he),ve)-xe;Le>this.maxLongitudeTriangleSize&&(this.maxLongitudeTriangleSize=Le),Q.push(xe+Le/2)};for(let W=0;W<E;W++)for(let J=0;J<E;J++){const se=W*A+J,ue=se+1,he=se+A,ve=he+1;ae(se,he,ue),ae(ue,he,ve)}[Q,Y]=(function(W,J){const se=Array.from({length:W.length},(ve,xe)=>xe);se.sort((ve,xe)=>W[ve]-W[xe]);const ue=[],he=new u.cp;for(let ve=0;ve<se.length;ve++){const xe=se[ve];ue.push(W[xe]);const Le=3*xe,_e=Le+1;he.emplaceBack(J.uint16[Le],J.uint16[_e],J.uint16[_e+1])}return[ue,he]})(Q,Y),this.elevatedGlobeTrianglesCenterLongitudes=Q,this.elevatedGlobeIndexBuffer=t.createIndexBuffer(Y)}this.elevatedGlobeSegments=u.cr.simpleSegment(0,0,M,D),this.elevatedGlobeGridMatrix=new Float32Array([0,$/u.aj,0,U/u.aj,0,0,q,k,0])}prepare(){const t=Object.keys(this.tiles).length!==0;if(this.tileID&&!t)return;const n=this.map.painter.context,l=n.gl;!this._dirty||this.texture instanceof u.dO||(this.texture?this.texture.update(this.image):(this.texture=new u.T(n,this.image,l.RGBA8),this.texture.bind(l.LINEAR,l.CLAMP_TO_EDGE)),this._dirty=!1),t&&this._prepareData(n)}loadTile(t,n){this.tileID&&this.tileID.equals(t.tileID.canonical)?(this.tiles[String(t.tileID.wrap)]=t,t.buckets={},n(null)):(t.state="errored",n(null))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}getSegmentsForLongitude(t){const n=this.elevatedGlobeSegments;if(!this.elevatedGlobeTrianglesCenterLongitudes||!n)return null;const l=this.elevatedGlobeTrianglesCenterLongitudes;let d=(p=t+180)+360*Math.round((l[0]-p)/360);var p;const m=new u.cr,g=(A,I)=>{m.segments.push({vertexOffset:0,primitiveOffset:A,vertexLength:n.segments[0].vertexLength,primitiveLength:I,sortKey:void 0,vaos:{}})},x=.51*this.maxLongitudeTriangleSize;if(Math.abs(l[0]-d)<=x){const A=u.dP(l,0,l.length,d+x);return A===l.length||g(A,u.dQ(l,A+1,l.length,d+360-x)-A),m}d<l[0]&&(d+=360);const w=u.dQ(l,0,l.length,d-x);if(w===l.length)return g(0,l.length),m;g(0,w-0);const E=u.dP(l,w+1,l.length,d+x);return E!==l.length&&g(E,l.length-E),m}}const hh={vector:Im,raster:Ll,"raster-dem":class extends Ll{constructor(s,t,n,l){super(s,t,n,l),this.type="raster-dem",this.maxzoom=22,this._options={type:"raster-dem",...t},this.encoding=t.encoding||"mapbox"}loadTileJSONWithProvider(s,t){this.provider=s.name;const n=new AbortController;return(async()=>{const{request:l,options:d}=await u.de(this._options,this.map._requestManager,n.signal);if(n.signal.aborted)return;const p=await this.dispatcher.send("loadTileProvider",{name:s.name,url:s.url,source:this.id,scope:this.scope,type:this.type,options:d,request:l},{signal:n.signal});if(n.signal.aborted)return;const m=p?p.find(x=>x!=null):null,g=u.dg(this._options,m,this.map._requestManager);g instanceof Error?t(g):t(null,g)})().catch(l=>{n.signal.aborted||t(l)}),{cancel:()=>n.abort()}}async loadTile(s,t){if(s.actor&&s.state!=="expired")return;const n=this.map._requestManager.normalizeTileURL(s.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize);s.actor=this.dispatcher.getActor();const l=new AbortController;s.request=l;try{const d=await this.map._requestManager.transformRequest(n,u.R.Tile,l.signal);if(l.signal.aborted)return t(null);s.request=s.actor.sendCancelable("loadTile",{uid:s.uid,tileID:s.tileID,source:this.id,type:this.type,scope:this.scope,request:d,encoding:this.encoding},{},function(p,m){return delete s.request,s.aborted?t(null):p?(s.state="errored",t(p)):(m&&(this.map._refreshExpiredTiles&&s.setExpiryData(u.dc(m.headers)),m.borderReady||s.neighboringTiles||(s.neighboringTiles=this._getNeighboringTiles(s.tileID)),s.dem=m.dem,s.dem.onDeserialize(),s.needsHillshadePrepare=!0,s.needsDEMTextureUpload=!0),s.state="loaded",void t(null))}.bind(this))}catch(d){if(l.signal.aborted)return t(null);s.state="errored",t(d)}}abortTile(s,t){s.request&&(s.request.abort(),delete s.request),s.actor&&s.actor.notify("abortTile",{uid:s.uid,type:this.type,source:this.id,scope:this.scope}),t&&t()}_getNeighboringTiles(s){const t=s.canonical,n=Math.pow(2,t.z),l=(t.x-1+n)%n,d=t.x===0?s.wrap-1:s.wrap,p=(t.x+1+n)%n,m=t.x+1===n?s.wrap+1:s.wrap,g={};return g[new u.bp(s.overscaledZ,d,t.z,l,t.y).key]={backfilled:!1},g[new u.bp(s.overscaledZ,m,t.z,p,t.y).key]={backfilled:!1},t.y>0&&(g[new u.bp(s.overscaledZ,d,t.z,l,t.y-1).key]={backfilled:!1},g[new u.bp(s.overscaledZ,s.wrap,t.z,t.x,t.y-1).key]={backfilled:!1},g[new u.bp(s.overscaledZ,m,t.z,p,t.y-1).key]={backfilled:!1}),t.y+1<n&&(g[new u.bp(s.overscaledZ,d,t.z,l,t.y+1).key]={backfilled:!1},g[new u.bp(s.overscaledZ,s.wrap,t.z,t.x,t.y+1).key]={backfilled:!1},g[new u.bp(s.overscaledZ,m,t.z,p,t.y+1).key]={backfilled:!1}),g}},"raster-array":Mo,geojson:class extends u.E{constructor(s,t,n,l){super(),this.id=s,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._loaded=!1,this.actor=n.getActor(),this.setEventedParent(l),this._data=t.data,this._options={...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=u.aj/this.tileSize;this.workerOptions={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:u.aj,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:u.aj,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(s){this.map=s,this.setData(this._data)}setData(s){return this._data=s,this._updateWorkerData(),this}updateData(s){if(!this._options.dynamic)return this.fire(new u.A(new Error("Can't call updateData on a GeoJSON source with dynamic set to false.")));if(typeof s!="string"&&(s.type==="Feature"&&(s={type:"FeatureCollection",features:[s]}),s.type!=="FeatureCollection"))return this.fire(new u.A(new Error("Data to update should be a feature or a feature collection.")));if(this._coalesce&&typeof s!="string"&&typeof this._data!="string"&&this._data.type==="FeatureCollection"){const t=new Map;for(const n of this._data.features)t.set(n.id,n);for(const n of s.features)t.set(n.id,n);this._data.features=[...t.values()]}else this._data=s;return this._updateWorkerData(!0),this}getClusterExpansionZoom(s,t){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:s,source:this.id,scope:this.scope}).then(n=>t(null,n)).catch(n=>t(n)),this}getClusterChildren(s,t){return this.actor.send("geojson.getClusterChildren",{clusterId:s,source:this.id,scope:this.scope}).then(n=>t(null,n)).catch(n=>t(n)),this}getClusterLeaves(s,t,n,l){return this.actor.send("geojson.getClusterLeaves",{source:this.id,scope:this.scope,clusterId:s,limit:t,offset:n}).then(d=>l(null,d)).catch(d=>l(d)),this}async _updateWorkerData(s=!1){if(this._pendingLoad)return void(this._coalesce=!0);this.fire(new u.B("dataloading",{dataType:"source"})),this._loaded=!1;const t={append:s,...this.workerOptions};t.scope=this.scope;const n=this._data,l=new AbortController;this._pendingLoad=l;try{if(typeof n=="string"){if(t.request=await this.map._requestManager.transformRequest(u.r.resolveURL(n),u.R.Source,l.signal),l.signal.aborted)return this._pendingLoad=null,void(this._coalesce=!1);t.request.collectResourceTiming=this._collectResourceTiming}else t.data=JSON.stringify(n);const d=await this.actor.send(`${this.type}.loadData`,t,{signal:l.signal});this._loaded=!0,this._pendingLoad=null;const p={dataType:"source",sourceDataType:this._metadataFired?"content":"metadata"};this._collectResourceTiming&&d&&d.resourceTiming&&d.resourceTiming[this.id]&&(p.resourceTiming=d.resourceTiming[this.id]),s&&(this._partialReload=!0),this.fire(new u.B("data",p)),this._partialReload=!1,this._metadataFired=!0}catch(d){if(l.signal.aborted)return this._pendingLoad=null,void(this._coalesce=!1);this._loaded=!0,this._pendingLoad=null,this.fire(new u.A(d))}this._coalesce&&(this._updateWorkerData(s),this._coalesce=!1)}loaded(){return this._loaded}reload(){const s=u.y(this.id,this.scope);this.map.style.clearSource(s),this._updateWorkerData()}loadTile(s,t){const n=s.actor?"reloadTile":"loadTile";s.actor=this.actor;const l=this.map.style?this.map.style.getLut(this.scope):null,d=l?{image:l.image.clone()}:null,p=this._partialReload,m={type:this.type,uid:s.uid,tileID:s.tileID,tileZoom:s.tileZoom,zoom:s.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,lut:d,scope:this.scope,pixelRatio:u.r.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:s.isExtraShadowCaster,scaleFactor:this.map.getScaleFactor(),partial:p,worldview:this.map.getWorldview(),indoor:this.map.getIndoorTileOptions(this.id,this.scope)};s.request=this.actor.sendCancelable(n,m,{},(g,x)=>p&&!x?(s.state="loaded",t(null)):(delete s.request,s.destroy(!1),s.aborted?t(null):g?t(g):(s.loadVectorData(x,this.map.painter,n==="reloadTile"),void t(null))))}abortTile(s){s.request&&(s.request.abort(),delete s.request),s.aborted=!0}unloadTile(s,t){this.actor.notify("removeTile",{uid:s.uid,type:this.type,source:this.id,scope:this.scope}),s.destroy()}onRemove(s){this._pendingLoad&&this._pendingLoad.abort()}serialize(){return{...this._options,type:this.type,data:this._data}}hasTransition(){return!1}},video:class extends so{constructor(s,t,n,l){super(s,t,n,l),this.roundZoom=!0,this.type="video",this.options=t}async load(){this._loaded=!1;const s=this.options,t=new AbortController;this._imageRequest=t;try{const n=await Promise.all(s.urls.map(async d=>(await this.map._requestManager.transformRequest(d,u.R.Source,t.signal)).url));if(t.signal.aborted)return;this.urls=n;const l=await u.dU(n);if(t.signal.aborted)return;this._imageRequest=null,this.video=l,this.video.loop=!0,this.video.setAttribute("playsinline",""),this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading()}catch(n){if(t.signal.aborted)return;this.fire(new u.A(n))}finally{this._loaded=!0}}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(s){if(this.video){const t=this.video.seekable;s<t.start(0)||s>t.end(0)?this.fire(new u.A(new K(`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=s}}getVideo(){return this.video}onAdd(s){this.map||(this.map=s,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 s=this.map.painter.context,t=s.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 u.T(s,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(s)}serialize(){return{type:"video",urls:this.options.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}},image:so,model:u.dV,"batched-model":class extends u.E{constructor(s,t,n,l){super(),this.type="batched-model",this.id=s,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=n,this.reparseOverscaled=!1,this.scheme="xyz",this._loaded=!1,this.setEventedParent(l)}onAdd(s){this.map=s,this.load()}reload(){this.cancelTileJSONRequest();const s=u.y(this.id,this.scope);this.load(()=>this.map.style.clearSource(s))}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}load(s){this._loaded=!1,this.fire(new u.B("dataloading",{dataType:"source"}));const t=Array.isArray(this.map._language)?this.map._language.join():this.map._language,n=this.map.getWorldview();this._tileJSONRequest=u.db(this._options,this.map._requestManager,t,n,(l,d)=>{this._tileJSONRequest=null,this._loaded=!0,l?(t&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${t}`),n&&n.length!==2&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${n}`),this.fire(new u.A(l))):d&&(Object.assign(this,d),d.bounds&&(this.tileBounds=new Xs(d.bounds,this.minzoom,this.maxzoom)),Bs(d.tiles,this.map._requestManager._customAccessToken),this.fire(new u.B("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new u.B("data",{dataType:"source",sourceDataType:"content"}))),s&&s(l)})}hasTransition(){return!1}hasTile(s){return!this.tileBounds||this.tileBounds.contains(s.canonical)}loaded(){return this._loaded}async loadTile(s,t){const n=this.map._requestManager.normalizeTileURL(s.tileID.canonical.url(this.tiles,this.scheme)),l=!s.actor||s.state==="expired";if(l)s.actor=this.dispatcher.getActor();else{if(s.state==="loading")return void(s.reloadCallback=t);if(s.buckets){const g=Object.values(s.buckets);for(const x of g)x.dirty=!0;return void(s.state="loaded")}}const d=l?"loadTile":"reloadTile",p=new AbortController;s.request=p;const m=(g,x)=>(delete s.request,s.aborted?t(null):g&&!u.dx(g)?t(g):(this.map._refreshExpiredTiles&&x&&s.setExpiryData(u.dc(x.headers)),s.loadModelData(x,this.map.painter),s.state="loaded",t(null),void(s.reloadCallback&&(this.loadTile(s,s.reloadCallback),s.reloadCallback=null))));try{const g=await this.map._requestManager.transformRequest(n,u.R.Tile,p.signal);if(p.signal.aborted)return t(null);const x={request:g,data:void 0,uid:s.uid,tileID:s.tileID,tileZoom:s.tileZoom,zoom:s.tileID.overscaledZ,tileSize:this.tileSize*s.tileID.overscaleFactor(),type:this.type,source:this.id,scope:this.scope,showCollisionBoxes:this.map.showCollisionBoxes,renderSourceType:s.renderSourceType,brightness:this.map.style&&this.map.style.getBrightness()||0,pixelRatio:u.r.devicePixelRatio,promoteId:this.promoteId};s.request=s.actor.sendCancelable(d,x,{},m)}catch(g){if(p.signal.aborted)return t(null);t(g)}}abortTile(s){s.request&&(s.request.abort(),delete s.request),s.actor&&s.actor.notify("abortTile",{uid:s.uid,type:this.type,source:this.id,scope:this.scope})}serialize(){return{...this._options}}},canvas:class extends so{constructor(s,t,n,l){super(s,t,n,l),t.coordinates?Array.isArray(t.coordinates)&&t.coordinates.length===4&&!t.coordinates.some(d=>!Array.isArray(d)||d.length!==2||d.some(p=>typeof p!="number"))||this.fire(new u.A(new K(`sources.${s}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new u.A(new K(`sources.${s}`,null,'missing required property "coordinates"'))),t.animate&&typeof t.animate!="boolean"&&this.fire(new u.A(new K(`sources.${s}`,null,'optional "animate" property must be a boolean value'))),t.canvas?typeof t.canvas=="string"||t.canvas instanceof HTMLCanvasElement||this.fire(new u.A(new K(`sources.${s}`,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 u.A(new K(`sources.${s}`,null,'missing required property "canvas"'))),this.options=t,this.animate=t.animate===void 0||t.animate}async 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 u.A(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(s){this.map=s,this.load(),this.canvas&&this.animate&&this.play()}onRemove(s){this.pause()}prepare(){let s=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,s=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,s=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const t=this.map.painter.context;this.texture?!s&&!this._playing||this.texture instanceof u.dO||this.texture.update(this.canvas,{premultiply:!0}):this.texture=new u.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 s of[this.canvas.width,this.canvas.height])if(isNaN(s)||s<=0)return!0;return!1}},custom:class extends u.E{constructor(s,t,n,l){super(),this.id=s,this.type="custom",this._dataType="raster",this._dispatcher=n,this._implementation=t,this.setEventedParent(l),this.scheme="xyz",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this._loaded=!1,this.roundZoom=!0,this._implementation||this.fire(new u.A(new Error(`Missing implementation for ${this.id} custom source`))),this._implementation.loadTile||this.fire(new u.A(new Error(`Missing loadTile implementation for ${this.id} custom source`))),this._implementation.bounds&&(this.tileBounds=new Xs(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,u.b3(t,["dataType","scheme","minzoom","maxzoom","tileSize","attribution","minTileCacheSize","maxTileCacheSize"]))}serialize(){return u.b3(this,["type","scheme","minzoom","maxzoom","tileSize","attribution"])}load(){this._loaded=!0,this.fire(new u.B("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new u.B("data",{dataType:"source",sourceDataType:"content"}))}loaded(){return this._loaded}onAdd(s){this.map=s,this._loaded=!1,this.fire(new u.B("dataloading",{dataType:"source"})),this._implementation.onAdd&&this._implementation.onAdd(s),this.load()}onRemove(s){this._implementation.onRemove&&this._implementation.onRemove(s)}hasTile(s){if(this._implementation.hasTile){const{x:t,y:n,z:l}=s.canonical;return this._implementation.hasTile({x:t,y:n,z:l})}return!this.tileBounds||this.tileBounds.contains(s.canonical)}async loadTile(s,t){const{x:n,y:l,z:d}=s.tileID.canonical,p=new AbortController;s.request=p;try{const m=await this._implementation.loadTile({x:n,y:l,z:d},{signal:p.signal});if(delete s.request,s.aborted)return s.state="unloaded",t(null);if(m===void 0)return s.state="errored",t(null);if(m===null)return this.loadTileData(s,{width:this.tileSize,height:this.tileSize,data:null}),s.state="loaded",t(null);if(!(function(g){return g instanceof ImageData||g instanceof HTMLCanvasElement||g instanceof ImageBitmap||g instanceof HTMLImageElement})(m))return s.state="errored",t(new Error(`Can't infer data type for ${this.id}, only raster data supported at the moment`));this.loadTileData(s,m),s.state="loaded",t(null)}catch(m){if(p.signal.aborted)return;s.state="errored",t(m)}}loadTileData(s,t){s.setTexture(t,this.map.painter)}unloadTile(s,t){if(s.texture&&s.texture instanceof u.T?(s.destroy(!1),s.texture&&s.texture instanceof u.T&&this.map.painter.saveTileTexture(s.texture)):s.destroy(),this._implementation.unloadTile){const{x:n,y:l,z:d}=s.tileID.canonical;this._implementation.unloadTile({x:n,y:l,z:d})}t&&t()}abortTile(s,t){s.request&&(s.request.abort(),delete s.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(s=>({x:s.canonical.x,y:s.canonical.y,z:s.canonical.z}))}_clearTiles(){const s=u.y(this.id,this.scope);this.map.style.clearSource(s)}_update(){this.fire(new u.B("data",{dataType:"source",sourceDataType:"content"}))}}},of=function(s,t,n,l){const d=new hh[t.type](s,t,n,l);if(d.id!==s)throw new Error(`Expected Source id to be ${s} instead of ${d.id}`);return u.cK(["load","abort","unload","serialize","prepare"],d),d};function sf(s,t,n=""){return`${n}:${t.id||""}:${t.layer.id}:${(function(l){if("layerId"in l)return`layer:${l.layerId}`;{const{featuresetId:d,importId:p}=l;return`featureset:${d}${p?`:import:${p}`:""}`}})(s.target)}`}function Cm(s,t,n,l=""){if(s.uniqueFeatureID){const d=sf(s,t,l);if(n.has(d))return!0;n.add(d)}return!1}function Lg(s,t,n,l,d=!1,p=void 0){const m=t.sourceCache.transform,g=t.sourceCache.tilesIn(s,t.has3DLayers,d);g.sort(Kr);const x=[];for(const w of g){const E=w.tile.queryRenderedFeatures(t,w,n,l,m,d,p);Object.keys(E).length&&x.push({wrappedTileID:w.tile.tileID.wrapped().key,queryResults:E})}for(const w in t.layers){const E=t.layers[w];if(E.styleLayer){const A=E.styleLayer.queryRenderedFeatures(s,t.sourceCache,l);Object.keys(A).length&&x.push({wrappedTileID:0,queryResults:A})}}return x.length===0?{}:(function(w){const E={},A={};for(const I of w){const M=I.queryResults,D=I.wrappedTileID,z=A[D]=A[D]||{};for(const O in M){const k=M[O],q=z[O]=z[O]||{},$=E[O]=E[O]||[];for(const U of k)q[U.featureIndex]||(q[U.featureIndex]=!0,$.push(U))}}return E})(x)}function Dn(s,t,n,l,d,p){const m={},g=l.queryRenderedSymbols(s),x=[];for(const w of Object.keys(g).map(Number))x.push(d[w]);x.sort(Kr);for(const w of x){const E=w.featureIndex.lookupSymbolFeatures(g[w.bucketInstanceId],w.bucketIndex,w.sourceLayerIndex,t,n,p);for(const A in E){const I=m[A]=m[A]||[],M=E[A];M.sort((D,z)=>{const O=w.featureSortOrder;if(O){const k=O.indexOf(D.featureIndex);return O.indexOf(z.featureIndex)-k}return z.featureIndex-D.featureIndex});for(const D of M)I.push(D)}}return m}function af(s,t){const n=s.getRenderableIds().map(p=>s.getTileByID(p)),l=[],d={};for(let p=0;p<n.length;p++){const m=n[p],g=m.tileID.canonical.key;d[g]||(d[g]=!0,m.querySourceFeatures(l,t))}return l}function Kr(s,t){const n=s.tileID,l=t.tileID;return n.overscaledZ-l.overscaledZ||n.canonical.y-l.canonical.y||n.wrap-l.wrap||n.canonical.x-l.canonical.x}class Js{constructor(t){this.style=t,this.layersGotHidden=!1,this.layers=[]}processLayersChanged(){this.layers=[];const t=!1,n=!1;for(const l in this.style._mergedLayers){const d=this.style._mergedLayers[l];if(d.type==="fill-extrusion"||d.type==="building")this.layers.push({layer:d,visible:t,visibilityChanged:n});else if(d.type==="model"){const p=this.style.getLayerSource(d);p&&p.type==="batched-model"&&this.layers.push({layer:d,visible:t,visibilityChanged:n})}}}onNewFrame(t){this.layersGotHidden=!1;for(const n of this.layers){const l=n.layer;let d=!1;l.type==="fill-extrusion"?d=!l.isHidden(t)&&l.paint.get("fill-extrusion-opacity")>0:l.type==="building"?d=!l.isHidden(t)&&l.paint.get("building-opacity")>0:l.type==="model"&&(d=!l.isHidden(t)&&l.paint.get("model-opacity").constantOr(1)>0),this.layersGotHidden=this.layersGotHidden||!d&&n.visible,n.visible=d}}updateZOffset(t,n){this.currentBuildingBuckets=[];for(const d of this.layers){const p=d.layer,m=this.style.getLayerSourceCache(p);let g=1;p.type==="fill-extrusion"?g=d.visible?p.paint.get("fill-extrusion-vertical-scale"):0:p.type==="building"&&(g=d.visible?p.paint.get("building-vertical-scale"):0);let x=m?m.getTile(n):null;if(!x&&m)for(const w in m._tiles){const E=m._tiles[w];if(n.canonical.isChildOf(E.tileID.canonical)){x=E;break}}this.currentBuildingBuckets.push({bucket:x?x.getBucket(p):null,tileID:x?x.tileID:n,verticalScale:g})}t.hasAnyZOffset=!1;let l=!1;for(let d=0;d<t.symbolInstances.length;d++){const p=t.symbolInstances.get(d),m=p.zOffset,g=this._getHeightAtTileOffset(n,p.tileAnchorX,p.tileAnchorY);p.zOffset=g!==Number.NEGATIVE_INFINITY?g:m,l||m===p.zOffset||(l=!0),t.hasAnyZOffset||p.zOffset===0||(t.hasAnyZOffset=!0)}l&&(t.zOffsetBuffersNeedUpload=!0,t.zOffsetSortDirty=!0)}_mapCoordToOverlappingTile(t,n,l,d){let p=n,m=l;if(t.canonical.z!==d.canonical.z){const g=d.canonical,x=1/(1<<t.canonical.z-g.z);p=(n+t.canonical.x*u.aj)*x-g.x*u.aj|0,m=(l+t.canonical.y*u.aj)*x-g.y*u.aj|0}return{tileX:p,tileY:m}}_getHeightAtTileOffset(t,n,l){let d,p;for(let m=0;m<this.layers.length;++m){const g=this.layers[m].layer;if(g.type!=="fill-extrusion"&&g.type!=="building")continue;const{bucket:x,tileID:w,verticalScale:E}=this.currentBuildingBuckets[m];if(!x)continue;const{tileX:A,tileY:I}=this._mapCoordToOverlappingTile(t,n,l,w),M=x.getHeightAtTileCoord(A,I);M&&M.height!==void 0&&(M.hidden?d=M.height:p=Math.max(M.height*E,p||0))}if(p!==void 0)return p;for(let m=0;m<this.layers.length;++m){const g=this.layers[m];if(g.layer.type!=="model"||!g.visible)continue;const{bucket:x,tileID:w}=this.currentBuildingBuckets[m];if(!x)continue;const{tileX:E,tileY:A}=this._mapCoordToOverlappingTile(t,n,l,w),I=x.getHeightAtTileCoord(E,A);if(I&&!I.hidden)return I.height===void 0&&d!==void 0?Math.min(I.maxHeight,d)*I.verticalScale:I.height?I.height*I.verticalScale:Number.NEGATIVE_INFINITY}return this.layersGotHidden?0:Number.NEGATIVE_INFINITY}}let Ul;function dh(){return Ul||(Ul=new ds),Ul}function lf(s,t){const n={},l=s,d=t,p=n;for(const m in l)m!=="ref"&&(p[m]=l[m]);return u.dW.forEach(m=>{m in d&&(p[m]=d[m])}),n}function fh(s){s=s.slice();const t=Object.create(null);for(const n of s)t[n.id]=n;for(let n=0;n<s.length;n++){const l=s[n];if(l&&"ref"in l){const d=t[l.ref];d&&(s[n]=lf(l,d))}}return s}const Zt={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 Wo(s,t,n){n.push({command:Zt.addSource,args:[s,t[s]]})}function oi(s,t,n){t.push({command:Zt.removeSource,args:[s]}),n[s]=!0}function ph(s,t,n,l){oi(s,n,l),Wo(s,t,n)}function cf(s,t,n){let l;for(l in s[n])if(Object.hasOwn(s[n],l)&&l!=="data"&&!u.b5(s[n][l],t[n][l]))return!1;for(l in t[n])if(Object.hasOwn(t[n],l)&&l!=="data"&&!u.b5(s[n][l],t[n][l]))return!1;return!0}function Lc(s,t,n,l,d,p){let m;for(m in t=t||{},s=s||{})Object.hasOwn(s,m)&&(u.b5(s[m],t[m])||n.push({command:p,args:[l,m,t[m],d]}));for(m in t)Object.hasOwn(t,m)&&!Object.hasOwn(s,m)&&(u.b5(s[m],t[m])||n.push({command:p,args:[l,m,t[m],d]}))}function Fc(s){return s.id}function Oc(s,t){return s[t.id]=t,s}function Bc(s,t,n){const l=t.createTileMatrix(s,s.worldSize,n.toUnwrapped());return u.aP(new Float32Array(16),s.projMatrix,l)}function bs(s,t,n){if(t.projection.name===n.projection.name)return s.projMatrix;const l=n.clone();return l.setProjection(t.projection),Bc(l,t.getProjection(),s)}function Xo(s,t,n){return t.name===n.projection.name?s.projMatrix:Bc(n,t,s)}class He{constructor(t,n,l,d){this.opacity=t?Math.max(0,Math.min(1,t.opacity+(t.placed?n:-n))):d&&l?1:0,this.placed=l}isHidden(){return this.opacity===0&&!this.placed}}class $e{constructor(t,n,l,d,p,m=!1){this.text=new He(t?t.text:null,n,l,p),this.icon=new He(t?t.icon:null,n,d,p),this.clipped=m}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class ws{constructor(t,n,l,d=!1){this.text=t,this.icon=n,this.skipFade=l,this.clipped=d}}class Li{constructor(){this.invProjMatrix=u.aS(),this.viewportMatrix=u.aS(),this.circles=[]}}class pe{constructor(t,n,l,d,p){this.bucketInstanceId=t,this.featureIndex=n,this.sourceLayerIndex=l,this.bucketIndex=d,this.tileID=p}}class Mm{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 n=++this.maxGroupID;this.collisionGroups[t]={ID:n,predicate:l=>l.collisionGroupID===n}}return this.collisionGroups[t]}}function kc(s,t,n,l,d){const{horizontalAlign:p,verticalAlign:m}=u.d_(s),g=-(p-.5)*t,x=-(m-.5)*n,w=u.d$(s,l);return new u.P(g+w[0]*d,x+w[1]*d)}function Nc(s,t,n,l,d){const p=new u.P(s,t);return n&&p._rotate(l?d:-d),p}function jl(s,t,n,l){const{leftJustifiedTextSymbolIndex:d,centerJustifiedTextSymbolIndex:p,rightJustifiedTextSymbolIndex:m,verticalPlacedTextSymbolIndex:g,crossTileID:x}=n,w=u.e0(t),E=l===u.a_.vertical?g:w==="left"?d:w==="center"?p:w==="right"?m:-1;d>=0&&(s.text.placedSymbolArray.get(d).crossTileID=E>=0&&d!==E?0:x),p>=0&&(s.text.placedSymbolArray.get(p).crossTileID=E>=0&&p!==E?0:x),m>=0&&(s.text.placedSymbolArray.get(m).crossTileID=E>=0&&m!==E?0:x),g>=0&&(s.text.placedSymbolArray.get(g).crossTileID=E>=0&&g!==E?0:x)}function Vc(s,t,n){const l=t===u.a_.horizontal||t===u.a_.horizontalOnly?t:0,d=t===u.a_.vertical?t:0,{leftJustifiedTextSymbolIndex:p,centerJustifiedTextSymbolIndex:m,rightJustifiedTextSymbolIndex:g,verticalPlacedTextSymbolIndex:x}=n,w=s.text.placedSymbolArray;p>=0&&(w.get(p).placedOrientation=l),m>=0&&(w.get(m).placedOrientation=l),g>=0&&(w.get(g).placedOrientation=l),x>=0&&(w.get(x).placedOrientation=d)}class Pm{constructor(t,n,l,d,p,m,g,x){this.transform=t.clone(),this.projection=t.projection.name,this.algorithm=d,this.collisionIndex=this.algorithm.createCollisionDetector(this.transform,m,x),this.buildingIndex=g,this.frontCutoffStart=0,this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=n,this.retainedQueryData={},this.collisionGroups=new Mm(l),this.collisionCircleArrays={},this.prevPlacement=p,p&&(p.prevPlacement=void 0),this.placedOrientations={},this.lastReplacementSourceUpdateTime=0}getBucketParts(t,n,l,d,p=1){const m=l.getBucket(n),g=l.latestFeatureIndex;if(!m||!g||n.fqid!==m.layerIds[0])return;const x=m.layers[0].layout,w=m.layers[0].paint,E=l.collisionBoxArray,A=Math.pow(2,this.transform.zoom-l.tileID.overscaledZ),I=l.tileSize/u.aj,M=l.tileID.toUnwrapped();this.transform.setProjection(m.projection);const D=(z=l.tileID,O=m.getProjection(),k=this.transform,O.name===this.projection?k.calculateProjMatrix(z.toUnwrapped()):Bc(k,O,z));var z,O,k;const q=x.get("text-pitch-alignment")==="map",$=x.get("text-rotation-alignment")==="map";n.compileFilter(n.options);const U=n.dynamicFilter(),Q=n.dynamicFilterNeedsFeature(),Y=n.dynamicFilterNeedsGeometry(),ae=this.transform.calculatePixelsToTileUnitsMatrix(l),W=Qt(D,l.tileID.canonical,q,$,this.transform,m.getProjection(),ae);let J=null;const se=m.getProjection().createInversionMatrix(this.transform,l.tileID.canonical);if(q){const Re=bl(D,l.tileID.canonical,q,$,this.transform,m.getProjection(),ae);J=u.aP([],this.transform.labelPlaneMatrix,Re)}let ue=null;U&&l.latestFeatureIndex&&(ue={unwrappedTileID:M,dynamicFilter:U,dynamicFilterNeedsFeature:Q,needGeometry:Y}),this.retainedQueryData[m.bucketInstanceId]=new pe(m.bucketInstanceId,g,m.sourceLayerIndex,m.index,l.tileID);const[he,ve]=m.layers[0].layout.get("text-size-scale-range"),xe=u.as(p,he,ve),[Le,_e]=x.get("icon-size-scale-range"),Pe=u.as(p,Le,_e),me={bucket:m,layout:x,paint:w,posMatrix:D,invMatrix:se,mercatorCenter:[u.bE(this.transform.center.lng),u.bF(this.transform.center.lat)],textLabelPlaneMatrix:W,labelToScreenMatrix:J,clippingData:ue,scale:A,textPixelRatio:I,holdingForFade:l.holdingForFade(),collisionBoxArray:E,partiallyEvaluatedTextSize:u.aZ(m.textSizeData,this.transform.zoom,xe),partiallyEvaluatedIconSize:u.aZ(m.iconSizeData,this.transform.zoom,Pe),collisionGroup:this.collisionGroups.get(m.sourceID),latestFeatureIndex:l.latestFeatureIndex};if(d)for(const Re of m.sortKeyRanges){const{sortKey:Me,symbolInstanceStart:Ae,symbolInstanceEnd:We}=Re;t.push({sortKey:Me,symbolInstanceStart:Ae,symbolInstanceEnd:We,parameters:me})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:m.symbolInstances.length,parameters:me})}placeLayerBucketPart(t,n,l,d,p=1){this.algorithm.placeLayerBucketPart(this,t,n,l,d,p)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;const n=this.prevPlacement;let l=!1;this.prevZoomAdjustment=n?n.zoomAdjustment(this.transform.zoom):0;const d=n?n.symbolFadeChange(t):1,p=n?n.opacities:{},m=n?n.variableOffsets:{},g=n?n.placedOrientations:{};for(const x in this.placements){const w=this.placements[x],E=p[x];E?(this.opacities[x]=new $e(E,d,w.text,w.icon,null,w.clipped),l=l||w.text!==E.text.placed||w.icon!==E.icon.placed):(this.opacities[x]=new $e(null,d,w.text,w.icon,w.skipFade,w.clipped),l=l||w.text||w.icon)}for(const x in p){const w=p[x];if(!this.opacities[x]){const E=new $e(w,d,!1,!1);E.isHidden()||(this.opacities[x]=E,l=l||w.text.placed||w.icon.placed)}}for(const x in m)this.variableOffsets[x]||!this.opacities[x]||this.opacities[x].isHidden()||(this.variableOffsets[x]=m[x]);for(const x in g)this.placedOrientations[x]||!this.opacities[x]||this.opacities[x].isHidden()||(this.placedOrientations[x]=g[x]);l?this.lastPlacementChangeTime=t:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=n?n.lastPlacementChangeTime:t)}updateLayerOpacities(t,n,l,d){d&&(this.lastReplacementSourceUpdateTime=d.updateTime);const p=new Set;for(const m of n){const g=m.getBucket(t);g&&m.latestFeatureIndex&&t.fqid===g.layerIds[0]&&(this.updateBucketOpacities(g,p,m,m.collisionBoxArray,l,d,m.tileID,t.scope),g.elevationType==="offset"&&this.buildingIndex&&this.buildingIndex.updateZOffset(g,m.tileID),g.elevationType==="road"&&g.hdExt&&g.hdExt.updateRoadElevation(g,m.tileID.canonical),g.updateZOffset())}}updateBucketOpacities(t,n,l,d,p,m,g,x){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 w=t.layers[0].layout,E=t.layers[0].paint,A=!!t.layers[0].dynamicFilter(),I=new $e(null,0,!1,!1,!0),M=w.get("text-allow-overlap"),D=w.get("icon-allow-overlap"),z=w.get("text-variable-anchor"),O=w.get("text-rotation-alignment")==="map",k=w.get("text-pitch-alignment")==="map",q=E.get("symbol-z-offset"),$=w.get("symbol-elevation-reference")==="sea",U=!q.isConstant(),Q=new $e(null,0,M&&(D||!t.hasIconData()||w.get("icon-optional")),D&&(M||!t.hasTextData()||w.get("text-optional")),!0);!t.collisionArrays&&d&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(d);const Y=(W,J,se)=>{for(let ue=0;ue<J/4;ue++)W.opacityVertexArray.emplaceBack(se)};let ae=0;m&&t.updateReplacement(g,m),this.collisionIndex.clearClippedSymbolsForBucket(t.bucketInstanceId);for(let W=0;W<t.symbolInstances.length;W++){const J=t.symbolInstances.get(W),{numHorizontalGlyphVertices:se,numVerticalGlyphVertices:ue,crossTileID:he,numIconVertices:ve,tileAnchorX:xe,tileAnchorY:Le}=J;let _e=null;const Pe=this.retainedQueryData[t.bucketInstanceId];U&&J&&Pe&&(_e=l.latestFeatureIndex.loadFeature({featureIndex:J.featureIndex,bucketIndex:Pe.bucketIndex,sourceLayerIndex:Pe.sourceLayerIndex,layoutVertexArrayOffset:0}));const me=q.evaluate(_e,{}),Re=n.has(he);let Me=this.opacities[he];Re?Me=I:Me||(Me=Q,this.opacities[he]=Me),n.add(he);const Ae=se>0||ue>0,We=ve>0,ke=this.placedOrientations[he],Ue=ke===u.a_.vertical,je=ke===u.a_.horizontal||ke===u.a_.horizontalOnly;!Ae&&!We||Me.isHidden()||ae++;let et=!1;if((Ae||We)&&m)for(const tt of t.activeReplacements){if(u.dX(tt,p,u.dY.Symbol,x)||tt.min.x>xe||xe>tt.max.x||tt.min.y>Le||Le>tt.max.y)continue;const it=u.dZ(xe,Le,g.canonical,tt.footprintTileId.canonical);if(et=u.cm(it,tt.footprint),et)break}if(et&&this.collisionIndex.markSymbolAsClipped(t.bucketInstanceId,J.featureIndex),Ae){const tt=et?Yo:Uc(Me.text);Y(t.text,se,Ue?Yo:tt),Y(t.text,ue,je?Yo:tt);const it=Me.text.isHidden(),{leftJustifiedTextSymbolIndex:at,centerJustifiedTextSymbolIndex:bt,rightJustifiedTextSymbolIndex:_t,verticalPlacedTextSymbolIndex:Ct}=J,At=t.text.placedSymbolArray,gt=it||Ue?1:0;at>=0&&(At.get(at).hidden=gt),bt>=0&&(At.get(bt).hidden=gt),_t>=0&&(At.get(_t).hidden=gt),Ct>=0&&(At.get(Ct).hidden=it||je?1:0);const Et=this.variableOffsets[he];Et&&jl(t,Et.anchor,J,ke);const wt=this.placedOrientations[he];wt&&(jl(t,"left",J,wt),Vc(t,wt,J))}if(We){const tt=et?Yo:Uc(Me.icon),{placedIconSymbolIndex:it,verticalPlacedIconSymbolIndex:at}=J,bt=t.icon.placedSymbolArray,_t=Me.icon.isHidden()?1:0;it>=0&&(Y(t.icon,ve,Ue?Yo:tt),bt.get(it).hidden=_t),at>=0&&(Y(t.icon,J.numVerticalIconVertices,je?Yo:tt),bt.get(at).hidden=_t)}if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const tt=t.collisionArrays[W];if(tt){let it=new u.P(0,0),at=!0;if(tt.textBox||tt.verticalTextBox){if(z){const _t=this.variableOffsets[he];_t?(it=kc(_t.anchor,_t.width,_t.height,_t.textOffset,_t.textScale),O&&it._rotate(k?this.transform.angle:-this.transform.angle)):at=!1}A&&(at=!Me.clipped),tt.textBox&&Ts(t.textCollisionBox.collisionVertexArray,Me.text.placed,!at||Ue,me,$,it.x,it.y),tt.verticalTextBox&&Ts(t.textCollisionBox.collisionVertexArray,Me.text.placed,!at||je,me,$,it.x,it.y)}const bt=at&&!!(!je&&tt.verticalIconBox);tt.iconBox&&Ts(t.iconCollisionBox.collisionVertexArray,Me.icon.placed,bt,me,$,J.hasIconTextFit?it.x:0,J.hasIconTextFit?it.y:0),tt.verticalIconBox&&Ts(t.iconCollisionBox.collisionVertexArray,Me.icon.placed,!bt,me,$,J.hasIconTextFit?it.x:0,J.hasIconTextFit?it.y:0)}}}if(t.fullyClipped=ae===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 W=this.collisionCircleArrays[t.bucketInstanceId];t.placementInvProjMatrix=W.invProjMatrix,t.placementViewportMatrix=W.viewportMatrix,t.collisionCircleArray=W.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,n){const l=this.zoomAtLastRecencyCheck===n?1-this.zoomAdjustment(n):1;return this.zoomAtLastRecencyCheck=n,this.commitTime+this.fadeDuration*l>t}isStale(){return this.stale}setStale(){this.stale=!0}}function Ts(s,t,n,l,d,p,m){s.emplaceBack(t?1:0,n?1:0,p||0,m||0,l,d?1:0),s.emplaceBack(t?1:0,n?1:0,p||0,m||0,l,d?1:0),s.emplaceBack(t?1:0,n?1:0,p||0,m||0,l,d?1:0),s.emplaceBack(t?1:0,n?1:0,p||0,m||0,l,d?1:0)}const Fg=Math.pow(2,25),Og=Math.pow(2,24),Rm=Math.pow(2,17),mh=Math.pow(2,16),uf=Math.pow(2,9),Dm=Math.pow(2,8),zm=Math.pow(2,1);function Uc(s){if(s.opacity===0&&!s.placed)return 0;if(s.opacity===1&&s.placed)return 4294967295;const t=s.placed?1:0,n=Math.floor(127*s.opacity);return n*Fg+t*Og+n*Rm+t*mh+n*uf+t*Dm+n*zm+t}const Yo=0;class hf{constructor(t,n){this.reset(t,n)}reset(t,n){this.points=t||[],this._distances=[0];for(let l=1;l<this.points.length;l++)this._distances[l]=this._distances[l-1]+this.points[l].dist(this.points[l-1]);this.length=this._distances.at(-1),this.padding=Math.min(n||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(t){if(this.points.length===1)return this.points[0];t=u.as(t,0,1);let n=1,l=this._distances[n];const d=t*this.paddedLength+this.padding;for(;l<d&&n<this._distances.length;)l=this._distances[++n];const p=n-1,m=this._distances[p],g=l-m,x=g>0?(d-m)/g:0;return this.points[p].mult(1-x).add(this.points[n].mult(x))}}const Po=100;class df{constructor(t,n){this.gridRightBoundary=0,this.gridBottomBoundary=0,this.clippedSymbols=new Map,this.reset(t,n)}reset(t,n){const l=t.width+200,d=t.height+200;l!==this.gridRightBoundary||d!==this.gridBottomBoundary?(this.grid=new u.e1(l,d,25),this.ignoredGrid=new u.e1(l,d,25)):(this.grid.clear(),this.ignoredGrid.clear()),this.transform=t,this.fogState=n,this.pitchfactor=Math.cos(t._pitch)*t.cameraToCenterDistance,this.screenRightBoundary=t.width+Po,this.screenBottomBoundary=t.height+Po,this.gridRightBoundary=l,this.gridBottomBoundary=d,this.clippedSymbols.clear()}clearClippedSymbolsForBucket(t){this.clippedSymbols.delete(t)}markSymbolAsClipped(t,n){let l=this.clippedSymbols.get(t);l||(l=new Set,this.clippedSymbols.set(t,l)),l.add(n)}placeCollisionBox(t,n,l,d,p,m,g,x,w,E,A){let I=l.projectedAnchorX,M=l.projectedAnchorY,D=l.projectedAnchorZ;const z=l.tileAnchorX,O=l.tileAnchorY,k=l.elevation,q=l.tileID,$=t.getProjection();if(k&&q){const[ve,xe,Le]=$.upVector(q.canonical,l.tileAnchorX,l.tileAnchorY),_e=$.upVectorScale(q.canonical,this.transform.center.lat,this.transform.worldSize).metersToTile;I+=ve*k*_e,M+=xe*k*_e,D+=Le*k*_e}const U=t.projection.name==="globe",Q=t.projection.name==="globe"?u.ah(this.transform.zoom):0;if(q&&U&&Q<1&&!m){const ve=1<<q.canonical.z,xe=u.e2(z,O);u.e3(xe,xe,1/u.aj),u.e4(xe,xe,u.e2(q.canonical.x,q.canonical.y)),u.e3(xe,xe,1/ve),u.e5(xe,xe,u.e2(d[0],d[1])),xe[0]=u.at(xe[0],-.5,.5),u.e3(xe,xe,u.aj);const Le=u.cv(xe[0],xe[1],u.aj/(2*Math.PI),1);u.aO(Le,Le,p),I=u.ai(I,Le[0],Q),M=u.ai(M,Le[1],Q),D=u.ai(D,Le[2],Q)}const Y=this.projectAndGetPerspectiveRatio(E,I,M,D,l.tileID,$.name==="globe"||!!k||this.transform.pitch>0,$),ae=w*Y.perspectiveRatio,W=(l.x1*n+g.x-l.padding)*ae+Y.point.x,J=(l.y1*n+g.y-l.padding)*ae+Y.point.y,se=(l.x2*n+g.x+l.padding)*ae+Y.point.x,ue=(l.y2*n+g.y+l.padding)*ae+Y.point.y,he=Y.perspectiveRatio<=.55||Y.occluded;return!this.isInsideGrid(W,J,se,ue)||!x&&this.grid.hitTest(W,J,se,ue,A)||he?{box:[],offscreen:!1,occluded:Y.occluded}:{box:[W,J,se,ue],offscreen:this.isOffscreen(W,J,se,ue),occluded:!1}}placeCollisionCircles(t,n,l,d,p,m,g,x,w,E,A,I,M,D,z,O){const k=[],q=this.transform.elevation,$=t.getProjection(),U=t.elevationType==="road",Q=!!q||U,Y=u.e6.getAtTileOffsetFunc(O,this.transform.center.lat,this.transform.worldSize,$),ae=new u.P(l.tileAnchorX,l.tileAnchorY),W=new u.P(l.tileAnchorX,l.tileAnchorY);let{x:J,y:se,z:ue}=$.projectTilePoint(W.x,W.y,O.canonical),he=null;if(Q){const et=U&&t.hdExt?t.hdExt.getElevationFeatureForPlacedSymbol(t,t.text,d):null;he={getElevation:Y,elevation:q,elevationFeature:et};const[tt,it,at]=Y(ae,q,et);J+=tt,se+=it,ue+=at}const ve=$.name==="globe",xe=this.projectAndGetPerspectiveRatio(x,J,se,ue,O,ve||!!q||this.transform.pitch>0,$),{perspectiveRatio:Le}=xe,_e=(I?g/Le:g*Le)/u.e8,Pe=gn(J,se,ue,w),me=l.lineOffsetX*_e,Re=l.lineOffsetY*_e,Me=u.al(t.layers[0].layout.get("text-max-angle")),Ae=Math.cos(Me),We=xe.signedDistanceFromCamera>0?Yp(_e,m,me,Re,U&&l.flipState===1,Pe,W,l,p,w,{},Q&&!I?he:null,I&&Q,$,O,I,Ae):null;let ke=!1,Ue=!1,je=!0;if(We&&!xe.occluded){const et=.5*D*Le+z,tt=new u.P(-100,-100),it=new u.P(this.screenRightBoundary,this.screenBottomBoundary),at=new hf,{first:bt,last:_t}=We,Ct=bt.path.length;let At=[];for(let wt=Ct-1;wt>=1;wt--)At.push(bt.path[wt]);for(let wt=1;wt<_t.path.length;wt++)At.push(_t.path[wt]);const gt=2.5*et;E&&(At=At.map(([wt,Ot,Ht],fi)=>(Q&&!ve&&(Ht=Y(fi<Ct-1?bt.tilePath[Ct-1-fi]:_t.tilePath[fi-Ct+2],q,he.elevationFeature)[2]),gn(wt,Ot,Ht,E))),At.some(wt=>wt[3]<=0)&&(At=[]));let Et=[];if(At.length>0){let wt=1/0,Ot=-1/0,Ht=1/0,fi=-1/0;for(const ei of At)wt=Math.min(wt,ei[0]),Ht=Math.min(Ht,ei[1]),Ot=Math.max(Ot,ei[0]),fi=Math.max(fi,ei[1]);Ot>=tt.x&&wt<=it.x&&fi>=tt.y&&Ht<=it.y&&(Et=[At.map(ei=>new u.P(ei[0],ei[1]))],(wt<tt.x||Ot>it.x||Ht<tt.y||fi>it.y)&&(Et=u.e7(Et,tt.x,tt.y,it.x,it.y)))}for(const wt of Et){at.reset(wt,.25*et);let Ot=0;Ot=at.length<=.5*et?1:Math.ceil(at.paddedLength/gt)+1;for(let Ht=0;Ht<Ot;Ht++){const fi=Ht/Math.max(Ot-1,1),ei=at.lerp(fi),kt=ei.x+Po,gi=ei.y+Po;k.push(kt,gi,et,0);const si=kt-et,Si=gi-et,Mt=kt+et,Lt=gi+et;if(je=je&&this.isOffscreen(si,Si,Mt,Lt),Ue=Ue||this.isInsideGrid(si,Si,Mt,Lt),!n&&this.grid.hitTestCircle(kt,gi,et,M)&&(ke=!0,!A))return{circles:[],offscreen:!1,collisionDetected:ke,occluded:!1}}}}return{circles:!A&&ke||!Ue?[]:k,offscreen:je,collisionDetected:ke,occluded:xe.occluded}}queryRenderedSymbols(t){if(t.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const n=[];let l=1/0,d=1/0,p=-1/0,m=-1/0;for(const E of t){const A=new u.P(E.x+Po,E.y+Po);l=Math.min(l,A.x),d=Math.min(d,A.y),p=Math.max(p,A.x),m=Math.max(m,A.y),n.push(A)}const g=this.grid.query(l,d,p,m).concat(this.ignoredGrid.query(l,d,p,m)),x={},w={};for(const E of g){const A=E.key;if(x[A.bucketInstanceId]===void 0&&(x[A.bucketInstanceId]={}),x[A.bucketInstanceId][A.featureIndex])continue;const I=this.clippedSymbols.get(A.bucketInstanceId);if(I&&I.has(A.featureIndex))continue;const M=[new u.P(E.x1,E.y1),new u.P(E.x2,E.y1),new u.P(E.x2,E.y2),new u.P(E.x1,E.y2)];u.cI(n,M)&&(x[A.bucketInstanceId][A.featureIndex]=!0,w[A.bucketInstanceId]===void 0&&(w[A.bucketInstanceId]=[]),w[A.bucketInstanceId].push(A.featureIndex))}return w}insertCollisionBox(t,n,l,d,p){(n?this.ignoredGrid:this.grid).insert({bucketInstanceId:l,featureIndex:d,collisionGroupID:p},t[0],t[1],t[2],t[3])}insertCollisionCircles(t,n,l,d,p){const m=n?this.ignoredGrid:this.grid,g={bucketInstanceId:l,featureIndex:d,collisionGroupID:p};for(let x=0;x<t.length;x+=4)m.insertCircle(g,t[x],t[x+1],t[x+2])}projectAndGetPerspectiveRatio(t,n,l,d,p,m,g){const x=[n,l,d,1];let w=!1;d||this.transform.pitch>0?(u.aO(x,x,t),this.fogState&&p&&g.name!=="globe"&&(w=(function(I,M,D,z,O,k){const q=k.calculateFogTileMatrix(O),$=[M,D,z];return u.ad($,$,q),Eu(I,u.ae($),k.pitch)})(this.fogState,n,l,d,p.toUnwrapped(),this.transform)>.9)):Zr(x,x,t);const E=x[3];return{point:new u.P((x[0]/E+1)/2*this.transform.width+Po,(-x[1]/E+1)/2*this.transform.height+Po),perspectiveRatio:Math.min(.5+this.transform.getCameraToCenterDistance(g)/E*.5,1.5),signedDistanceFromCamera:E,occluded:m&&x[2]>E||w}}isOffscreen(t,n,l,d){return l<Po||t>=this.screenRightBoundary||d<Po||n>this.screenBottomBoundary}isInsideGrid(t,n,l,d){return l>=0&&t<this.gridRightBoundary&&d>=0&&n<this.gridBottomBoundary}getViewportMatrix(){const t=u.aC([]);return u.aG(t,t,[-100,-100,0]),t}}const Lm={default:new class{createCollisionDetector(s,t,n){return n instanceof df?(n.reset(s,t),n):new df(s,t)}shouldPause(s){return s>2}placeLayerBucketPart(s,t,n,l,d,p=1){const{bucket:m,layout:g,paint:x,posMatrix:w,textLabelPlaneMatrix:E,labelToScreenMatrix:A,clippingData:I,textPixelRatio:M,mercatorCenter:D,invMatrix:z,holdingForFade:O,collisionBoxArray:k,partiallyEvaluatedTextSize:q,partiallyEvaluatedIconSize:$,collisionGroup:U,latestFeatureIndex:Q}=t.parameters,Y=g.get("text-optional"),ae=g.get("icon-optional"),W=g.get("text-allow-overlap"),J=g.get("icon-allow-overlap"),se=g.get("text-rotation-alignment")==="map",ue=g.get("icon-rotation-alignment")==="map",he=g.get("text-pitch-alignment")==="map",ve=x.get("symbol-z-offset"),xe=g.get("symbol-elevation-reference")==="sea",Le=g.get("symbol-placement"),[_e,Pe]=g.get("text-size-scale-range"),[me,Re]=g.get("icon-size-scale-range"),Me=u.as(p,_e,Pe),Ae=u.as(p,me,Re),We=g.get("text-variable-anchor"),ke=se&&Le!=="point",Ue=ue&&Le!=="point",je=We&&m.hasTextData(),et=m.hasIconTextFit()&&je&&m.hasIconData();s.transform.setProjection(m.projection);const tt=je||ke,it=Ue||et;let at=W&&(J||!m.hasIconData()||ae),bt=J&&(W||!m.hasTextData()||Y);const _t=!ve.isConstant();!m.collisionArrays&&k&&m.deserializeCollisionBoxes(k),l&&d&&m.updateCollisionDebugBuffers(s.transform.zoom,k,Me,Ae);const Ct=(gt,Et,wt)=>{const{crossTileID:Ot,numVerticalGlyphVertices:Ht}=gt;let fi=null;if(I&&I.dynamicFilterNeedsFeature||_t){const ri=s.retainedQueryData[m.bucketInstanceId],pi=Q.loadFeature({featureIndex:gt.featureIndex,bucketIndex:ri.bucketIndex,sourceLayerIndex:ri.sourceLayerIndex,layoutVertexArrayOffset:0}),Bt=pi.properties?pi.properties.worldview:null;if(m.localizable&&m.worldview&&typeof Bt=="string")if(Bt==="all")pi.properties.$localized=!0;else{if(!Bt.split(",").includes(m.worldview))return;pi.properties.$localized=!0,pi.properties.worldview=m.worldview}fi=I&&I.needGeometry?u.cV(pi,!0):pi}if(I&&!(0,I.dynamicFilter)({zoom:s.transform.zoom,pitch:s.transform.pitch,worldview:m.worldview},fi,s.retainedQueryData[m.bucketInstanceId].tileID.canonical,new u.P(gt.tileAnchorX,gt.tileAnchorY),s.transform.calculateDistanceTileData(I.unwrappedTileID)))return s.placements[Ot]=new ws(!1,!1,!1,!0),void n.add(Ot);const ei=ve.evaluate(fi,{});if((gt.zOffset||0)+(ei||0)>0&&s.frontCutoffStart>0){const ri=2*s.frontCutoffStart-1,pi=[gt.tileAnchorX,gt.tileAnchorY,0,1],Bt=u.aO(u.cw(),pi,w);if(Bt[1]/Bt[3]<ri)return s.placements[Ot]=new ws(!1,!1,!1,!0),void n.add(Ot)}if(n.has(Ot))return;if(O)return void(s.placements[Ot]=new ws(!1,!1,!1));let kt=!1,gi=!1,si=!0,Si=!1,Mt=!1,Lt=null,Tt={box:null,offscreen:null,occluded:null},li={box:null},ci=null,$i=null,Ui=null,cr=0,pr=0,Br=0;wt.textFeatureIndex?cr=wt.textFeatureIndex:gt.useRuntimeCollisionCircles&&(cr=gt.featureIndex),wt.verticalTextFeatureIndex&&(pr=wt.verticalTextFeatureIndex);const Qr=m.hdExt?m.hdExt.elevationFeatures[gt.elevationFeatureIndex]:void 0,Ut=ri=>{ri.tileID=s.retainedQueryData[m.bucketInstanceId].tileID;const pi=s.transform.elevation;ri.elevation=xe?ei:ei+u.e6.getAtTileOffset(ri.tileID,new u.P(ri.tileAnchorX,ri.tileAnchorY),pi,Qr),ri.elevation+=gt.zOffset},Ti=wt.textBox;if(Ti){Ut(Ti);const ri=Bt=>{let Oi=u.a_.horizontal;if(m.allowVerticalPlacement&&!Bt&&s.prevPlacement){const Rr=s.prevPlacement.placedOrientations[Ot];Rr&&(s.placedOrientations[Ot]=Rr,Oi=Rr,Vc(m,Oi,gt))}return Oi},pi=(Bt,Oi)=>{if(m.allowVerticalPlacement&&Ht>0&&wt.verticalTextBox){for(const Rr of m.writingModes)if(Rr===u.a_.vertical?(Tt=Oi(),li=Tt):Tt=Bt(),Tt&&Tt.box&&Tt.box.length)break}else Tt=Bt()};if(We){let Bt=We;if(s.prevPlacement&&s.prevPlacement.variableOffsets[Ot]){const ui=s.prevPlacement.variableOffsets[Ot];Bt.indexOf(ui.anchor)>0&&(Bt=Bt.filter(Fr=>Fr!==ui.anchor),Bt.unshift(ui.anchor))}const Oi=(ui,Fr,go)=>{const Ln=m.getSymbolInstanceTextSize(q,gt,s.transform.zoom,Et),hn=(ui.x2-ui.x1)*Ln+2*ui.padding,Zn=(ui.y2-ui.y1)*Ln+2*ui.padding,Wn=gt.hasIconTextFit&&!J?Fr:null;Wn&&Ut(Wn);let yo={box:[],offscreen:!1,occluded:!1};const bn=W?2*Bt.length:Bt.length;for(let zo=0;zo<bn;++zo){const Qo=this.attemptAnchorPlacement(s,Bt[zo%Bt.length],ui,D,z,tt,hn,Zn,Ln,se,he,M,w,U,zo>=Bt.length,gt,Et,m,go,Wn,q,$);if(Qo&&(yo=Qo.placedGlyphBoxes,yo&&yo.box&&yo.box.length)){kt=!0,Lt=Qo.shift;break}}return yo};pi(()=>Oi(Ti,wt.iconBox,u.a_.horizontal),()=>{const ui=wt.verticalTextBox;return ui&&Ut(ui),m.allowVerticalPlacement&&!(Tt&&Tt.box&&Tt.box.length)&&Ht>0&&ui?Oi(ui,wt.verticalIconBox,u.a_.vertical):{box:null,offscreen:null,occluded:null}}),Tt&&(kt=Tt.box,si=Tt.offscreen,Si=Tt.occluded);const Rr=ri(!(!Tt||!Tt.box));if(!kt&&s.prevPlacement){const ui=s.prevPlacement.variableOffsets[Ot];ui&&(s.variableOffsets[Ot]=ui,jl(m,ui.anchor,gt,Rr))}}else{const Bt=(Oi,Rr)=>{const ui=m.getSymbolInstanceTextSize(q,gt,s.transform.zoom,Et),Fr=s.collisionIndex.placeCollisionBox(m,ui,Oi,D,z,tt,new u.P(0,0),W,M,w,U.predicate);return Fr&&Fr.box&&Fr.box.length&&(Vc(m,Rr,gt),s.placedOrientations[Ot]=Rr),Fr};pi(()=>Bt(Ti,u.a_.horizontal),()=>{const Oi=wt.verticalTextBox;return m.allowVerticalPlacement&&Ht>0&&Oi?(Ut(Oi),Bt(Oi,u.a_.vertical)):{box:null,offscreen:null,occluded:null}}),ri(!!(Tt&&Tt.box&&Tt.box.length))}}if(ci=Tt,kt=ci&&ci.box&&ci.box.length>0,si=ci&&ci.offscreen,Si=ci&&ci.occluded,gt.useRuntimeCollisionCircles){const ri=gt.centerJustifiedTextSymbolIndex>=0?gt.centerJustifiedTextSymbolIndex:gt.verticalPlacedTextSymbolIndex,pi=m.text.placedSymbolArray.get(ri),Bt=u.a$(m.textSizeData,q,pi),Oi=g.get("text-padding");$i=s.collisionIndex.placeCollisionCircles(m,W,pi,ri,m.lineVertexArray,m.glyphOffsetArray,Bt,w,E,A,l,he,U.predicate,gt.collisionCircleDiameter*Bt/u.e8,Oi,s.retainedQueryData[m.bucketInstanceId].tileID),kt=W||$i.circles.length>0&&!$i.collisionDetected,si=si&&$i.offscreen,Si=$i.occluded}if(wt.iconFeatureIndex&&(Br=wt.iconFeatureIndex),wt.iconBox){const ri=pi=>{Ut(pi);const Bt=gt.hasIconTextFit&&Lt?Nc(Lt.x,Lt.y,se,he,s.transform.angle):new u.P(0,0),Oi=m.getSymbolInstanceIconSize($,s.transform.zoom,gt.placedIconSymbolIndex);return s.collisionIndex.placeCollisionBox(m,Oi,pi,D,z,it,Bt,J,M,w,U.predicate)};li&&li.box&&li.box.length&&wt.verticalIconBox?(Ui=ri(wt.verticalIconBox),gi=Ui.box.length>0):(Ui=ri(wt.iconBox),gi=Ui.box.length>0),si=si&&Ui.offscreen,Mt=Ui.occluded}const Ii=Y||gt.numHorizontalGlyphVertices===0&&Ht===0,Ei=ae||gt.numIconVertices===0;if(Ii||Ei?Ei?Ii||(gi=gi&&kt):kt=gi&&kt:gi=kt=gi&&kt,kt&&ci&&ci.box&&s.collisionIndex.insertCollisionBox(ci.box,g.get("text-ignore-placement"),m.bucketInstanceId,li&&li.box&&pr?pr:cr,U.ID),gi&&Ui&&s.c
3325ollisionIndex.insertCollisionBox(Ui.box,g.get("icon-ignore-placement"),m.bucketInstanceId,Br,U.ID),$i&&(kt&&s.collisionIndex.insertCollisionCircles($i.circles,g.get("text-ignore-placement"),m.bucketInstanceId,cr,U.ID),l)){const ri=m.bucketInstanceId;let pi=s.collisionCircleArrays[ri];pi===void 0&&(pi=s.collisionCircleArrays[ri]=new Li);for(let Bt=0;Bt<$i.circles.length;Bt+=4)pi.circles.push($i.circles[Bt+0]),pi.circles.push($i.circles[Bt+1]),pi.circles.push($i.circles[Bt+2]),pi.circles.push($i.collisionDetected?1:0)}const Fi=m.projection.name!=="globe";at=at&&(Fi||!Si),bt=bt&&(Fi||!Mt),s.placements[Ot]=new ws(kt||at,gi||bt,si||m.justReloaded),n.add(Ot)},At=s.retainedQueryData[m.bucketInstanceId].tileID;if(m.elevationType==="offset"&&s.buildingIndex&&s.buildingIndex.updateZOffset(m,At),m.elevationType==="road"&&m.hdExt&&m.hdExt.updateRoadElevation(m,At.canonical),m.updateZOffset(),m.sortFeaturesByY){const gt=m.getSortedSymbolIndexes(s.transform.angle);for(let Et=gt.length-1;Et>=0;--Et){const wt=gt[Et];Ct(m.symbolInstances.get(wt),wt,m.collisionArrays[wt])}m.hasAnyZOffset&&u.w(`${m.layerIds[0]} layer symbol-z-elevate: symbols are not sorted by elevation if symbol-z-order is evaluated to viewport-y`)}else if(m.hasAnyZOffset){const gt=m.getSortedIndexesByZOffset();for(let Et=0;Et<gt.length;++Et){const wt=gt[Et];Ct(m.symbolInstances.get(wt),wt,m.collisionArrays[wt])}}else for(let gt=t.symbolInstanceStart;gt<t.symbolInstanceEnd;gt++)Ct(m.symbolInstances.get(gt),gt,m.collisionArrays[gt]);if(l&&m.bucketInstanceId in s.collisionCircleArrays){const gt=s.collisionCircleArrays[m.bucketInstanceId];u.aE(gt.invProjMatrix,w),gt.viewportMatrix=s.collisionIndex.getViewportMatrix()}m.justReloaded=!1}attemptAnchorPlacement(s,t,n,l,d,p,m,g,x,w,E,A,I,M,D,z,O,k,q,$,U,Q){const{textOffset0:Y,textOffset1:ae,crossTileID:W}=z,J=[Y,ae],se=kc(t,m,g,J,x),ue=s.collisionIndex.placeCollisionBox(k,x,n,l,d,p,Nc(se.x,se.y,w,E,s.transform.angle),D,A,I,M.predicate);if($){const he=k.getSymbolInstanceIconSize(Q,s.transform.zoom,z.placedIconSymbolIndex);if(s.collisionIndex.placeCollisionBox(k,he,$,l,d,p,Nc(se.x,se.y,w,E,s.transform.angle),D,A,I,M.predicate).box.length===0)return}if(ue.box.length>0){let he;return s.prevPlacement&&s.prevPlacement.variableOffsets[W]&&s.prevPlacement.placements[W]&&s.prevPlacement.placements[W].text&&(he=s.prevPlacement.variableOffsets[W].anchor),s.variableOffsets[W]={textOffset:J,width:m,height:g,anchor:t,textScale:x,prevAnchor:he},jl(k,t,z,q),k.allowVerticalPlacement&&(Vc(k,q,z),s.placedOrientations[W]=q),{shift:se,placedGlyphBoxes:ue}}}}};class Fm{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,n,l,d,p,m){const g=this._bucketParts;for(;this._currentTileIndex<t.length;)if(n.getBucketParts(g,d,t[this._currentTileIndex],this._sortAcrossTiles,m),this._currentTileIndex++,p())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,g.sort((x,w)=>x.sortKey-w.sortKey));this._currentPartIndex<g.length;){const x=g[this._currentPartIndex];if(n.placeLayerBucketPart(x,this._seenCrossTileIDs,l,x.symbolInstanceStart===0,m),this._currentPartIndex++,p())return!0}return!1}}class ff{constructor(){this._retiredCI=null}startNewPlacement(t,n,l,d,p,m,g,x,w){return this.placement=new Pm(t,d,p,Lm[w||"default"],m,g,x,this._retiredCI),this._retiredCI=null,this._currentPlacementIndex=n.length-1,this._forceFullPlacement=!1,this._showCollisionBoxes=l,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,n,l,d,p){const m=u.r.now(),g=()=>!this.isFullPlacementRequested()&&this._fadeDuration!==0&&this.placement.algorithm.shouldPause(u.r.now()-m);for(;this._currentPlacementIndex>=0;){const x=n[t[this._currentPlacementIndex]],w=this.placement.collisionIndex.transform.zoom;if(x.type==="symbol"&&x.visibility!=="none"&&(!x.minzoom||x.minzoom<=w)&&(!x.maxzoom||x.maxzoom>w)){const E=x,A=E.layout.get("symbol-z-elevate"),I=E.layout.get("symbol-sort-key").constantOr(1)!==void 0,M=E.layout.get("symbol-z-order"),D=M==="viewport-y"||M==="auto"&&!(M!=="viewport-y"&&I),z=E.layout.get("text-allow-overlap")||E.layout.get("icon-allow-overlap")||E.layout.get("text-ignore-placement")||E.layout.get("icon-ignore-placement"),O=D&&z,k=this._inProgressLayer=this._inProgressLayer||new Fm(E),q=u.y(x.source,x.scope);if(k.continuePlacement(A||O?d[q]:l[q],this.placement,this._showCollisionBoxes,x,g,p))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._forceFullPlacement=!1,this._done=!0}commit(t){return this._retiredCI=this.placement.prevPlacement?this.placement.prevPlacement.collisionIndex:null,this.placement.commit(t),this.placement}}const pf=512/u.aj/2;class Om{constructor(t,n,l){this.tileID=t,this.bucketInstanceId=l,this.index=new u.e9(n.length,16,Int32Array),this.keys=[],this.crossTileIDs=[];const d=t.canonical.x*u.aj,p=t.canonical.y*u.aj;for(let m=0;m<n.length;m++){const{key:g,crossTileID:x,tileAnchorX:w,tileAnchorY:E}=n.get(m),A=Math.floor((d+w)*pf),I=Math.floor((p+E)*pf);this.index.add(A,I),this.keys.push(g),this.crossTileIDs.push(x)}this.index.finish()}
vendor: 43,530 bytes, line 3325
3325findMatches(t,n,l){const d=this.tileID.canonical.z<n.canonical.z?1:Math.pow(2,this.tileID.canonical.z-n.canonical.z),p=pf/Math.pow(2,n.canonical.z-this.tileID.canonical.z),m=n.canonical.x*u.aj,g=n.canonical.y*u.aj;for(let x=0;x<t.length;x++){const w=t.get(x);if(w.crossTileID)continue;const{key:E,tileAnchorX:A,tileAnchorY:I}=w,M=Math.floor((m+A)*p),D=Math.floor((g+I)*p),z=this.index.range(M-d,D-d,M+d,D+d).sort((O,k)=>O-k);for(const O of z){const k=this.crossTileIDs[O];if(this.keys[O]===E&&!l.has(k)){l.add(k),w.crossTileID=k;break}}}}}class Bg{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class an{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(t){const n=Math.round((t-this.lng)/360);if(n!==0)for(const l in this.indexes){const d=this.indexes[l],p={};for(const m in d){const g=d[m];g.tileID=g.tileID.unwrapTo(g.tileID.wrap+n),p[g.tileID.key]=g}this.indexes[l]=p}this.lng=t}addBucket(t,n,l){if(this.indexes[t.overscaledZ]&&this.indexes[t.overscaledZ][t.key]){if(this.indexes[t.overscaledZ][t.key].bucketInstanceId===n.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(t.overscaledZ,this.indexes[t.overscaledZ][t.key])}for(let p=0;p<n.symbolInstances.length;p++)n.symbolInstances.get(p).crossTileID=0;this.usedCrossTileIDs[t.overscaledZ]||(this.usedCrossTileIDs[t.overscaledZ]=new Set);const d=this.usedCrossTileIDs[t.overscaledZ];for(const p in this.indexes){const m=this.indexes[p];if(Number(p)>t.overscaledZ)for(const g in m){const x=m[g];x.tileID.isChildOf(t)&&x.findMatches(n.symbolInstances,t,d)}else{const g=m[t.scaledTo(Number(p)).key];g&&g.findMatches(n.symbolInstances,t,d)}}for(let p=0;p<n.symbolInstances.length;p++){const m=n.symbolInstances.get(p);m.crossTileID||(m.crossTileID=l.generate(),d.add(m.crossTileID))}return this.indexes[t.overscaledZ]===void 0&&(this.indexes[t.overscaledZ]={}),this.indexes[t.overscaledZ][t.key]=new Om(t,n.symbolInstances,n.bucketInstanceId),!0}removeBucketCrossTileIDs(t,n){for(const l of n.crossTileIDs)this.usedCrossTileIDs[t].delete(l)}removeStaleBuckets(t){let n=!1;for(const l in this.indexes){const d=this.indexes[l];for(const p in d)t[d[p].bucketInstanceId]||(this.removeBucketCrossTileIDs(l,d[p]),delete d[p],n=!0)}return n}}class _h{constructor(){this.layerIndexes={},this.crossTileIDs=new Bg,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(t,n,l,d){let p=this.layerIndexes[t.fqid];p===void 0&&(p=this.layerIndexes[t.fqid]=new an);let m=!1;const g={};d.name!=="globe"&&p.handleWrapJump(l);for(const x of n){const w=x.getBucket(t);w&&t.fqid===w.layerIds[0]&&(w.bucketInstanceId||(w.bucketInstanceId=++this.maxBucketInstanceId),p.addBucket(x.tileID,w,this.crossTileIDs)&&(m=!0),g[w.bucketInstanceId]=!0)}return p.removeStaleBuckets(g)&&(m=!0),m}pruneUnusedLayers(t){const n={};t.forEach(l=>{n[l]=!0});for(const l in this.layerIndexes)n[l]||delete this.layerIndexes[l]}}class Gl extends u.E{constructor(t){super(),this.requestManager=t,this.models=Object.create(null),this.models[""]=Object.create(null),this.modelUris=Object.create(null),this.modelUris[""]=Object.create(null),this.modelByURL=Object.create(null),this.numModelsLoading=Object.create(null)}async loadModel(t,n){try{const l=await this.requestManager.transformRequest(n,u.R.Model);if(!this.modelByURL[n])return null;const d=await u.ea(l.url),p=u.eb(d),m=new u.ec(t,n,void 0,void 0,p);return m.computeBoundsAndApplyParent(),m}catch(l){if(l.status===404)return null;this.fire(new u.A(new Error(`Could not load model ${t} from ${n}`,{cause:l})))}}load(t,n,l={forceReload:!1}){this.models[n]||(this.models[n]=Object.create(null));const d=Object.keys(t),p=[],m=[];for(const g of d){const x=t[g];this.hasURLBeenRequested(x)&&!l.forceReload||(this.modelByURL[x]={modelId:g,scope:n},p.push(this.loadModel(g,x)),m.push(g)),this.models[n][g]||(this.models[n][g]={model:null,numReferences:1})}this.numModelsLoading[n]=(this.numModelsLoading[n]||0)+m.length,Promise.allSettled(p).then(g=>{for(let x=0;x<g.length;x++){const{status:w}=g[x];if(w==="rejected")continue;const{value:E}=g[x];this.models[n][m[x]]||(this.models[n][m[x]]={model:null,numReferences:1}),this.models[n][m[x]].model=E}this.numModelsLoading[n]-=m.length,this.fire(new u.B("data",{dataType:"style"}))}).catch(g=>{this.fire(new u.A(new Error(`Could not load models: ${g.message}`)))})}isLoaded(){for(const t in this.numModelsLoading)if(this.numModelsLoading[t]>0)return!1;return!0}hasModel(t,n,l={exactIdMatch:!1}){return!!(l.exactIdMatch?this.getModel(t,n):this.getModelByURL(this.modelUris[n][t]))}getModel(t,n){return this.models[n]||(this.models[n]=Object.create(null)),this.models[n][t]?this.models[n][t].model:void 0}getModelByURL(t){if(!t)return null;const n=this.modelByURL[t];return n?this.models[n.scope][n.modelId].model:null}hasModelBeenAdded(t,n){return this.models[n]&&this.models[n][t]!==void 0}getModelURIs(t){return this.modelUris[t]||Object.create(null)}addModel(t,n,l){this.models[l]||(this.models[l]=Object.create(null)),this.modelUris[l]||(this.modelUris[l]=Object.create(null));const d=this.requestManager.normalizeModelURL(n);if((this.hasModel(t,l,{exactIdMatch:!0})||this.hasModelBeenAdded(t,l))&&this.modelUris[l][t]===d)this.models[l][t].numReferences++;else if(this.hasURLBeenRequested(d)){const{scope:p,modelId:m}=this.modelByURL[d];this.models[p][m].numReferences++}else this.modelUris[l][t]=d,this.load({[t]:this.modelUris[l][t]},l)}addModelURLs(t,n){this.models[n]||(this.models[n]=Object.create(null)),this.modelUris[n]||(this.modelUris[n]=Object.create(null));const l=this.modelUris[n];for(const d of Object.keys(t))l[d]=this.requestManager.normalizeModelURL(t[d])}reloadModels(t){this.load(this.modelUris[t],t,{forceReload:!0})}addModelsFromBucket(t,n){this.models[n]||(this.models[n]=Object.create(null)),this.modelUris[n]||(this.modelUris[n]=Object.create(null));const l=Object.create(null);for(const d of t)this.hasModel(d,n,{exactIdMatch:!0})||this.hasURLBeenRequested(d)?this.models[n][d].numReferences++:this.modelUris[n][d]&&!this.hasURLBeenRequested(d)?l[d]=this.modelUris[n][d]:!this.hasURLBeenRequested(d)&&xi(d,!1)&&(this.modelUris[n][d]=this.requestManager.normalizeModelURL(d),l[d]=this.modelUris[n][d]);this.load(l,n)}hasURLBeenRequested(t){return this.modelByURL[t]!==void 0}removeModel(t,n,l=!1,d=!1){if(this.models[n]&&this.models[n][t]&&(this.models[n][t].numReferences--,this.models[n][t].numReferences===0||d)){const p=this.modelUris[n][t];l||delete this.modelUris[n][t],delete this.modelByURL[p];const m=this.models[n][t].model;if(!m)return;delete this.models[n][t],m.destroy()}}destroy(){for(const t of Object.keys(this.models))for(const n of Object.keys(this.models[t])){const l=this.models[t][n].model;delete this.models[t][n],l&&l.destroy()}this.models=Object.create(null),this.models[""]=Object.create(null),this.modelUris=Object.create(null),this.modelUris[""]=Object.create(null),this.modelByURL=Object.create(null),this.numModelsLoading=Object.create(null)}listModels(t){return this.models[t]||(this.models[t]=Object.create(null)),Object.keys(this.models[t])}upload(t,n){this.models[n]||(this.models[n]=Object.create(null));for(const l in this.models[n])this.models[n][l].model&&this.models[n][l].model.upload(t.context)}}const Bm=["RENDER_SHADOWS","NORMAL_OFFSET"],Da=new Set(["symbol","circle"]),za=class Px{constructor(){this._queue=[],this._needsBuild=!0,this._idleHandle=null}needsBuild(){return this._needsBuild}buildQueue(t,n,l){this._idleHandle!=null&&typeof cancelIdleCallback<"u"&&cancelIdleCallback(this._idleHandle),this._idleHandle=null,this._queue=[],this._needsBuild=!1;const d=!!l.fog,p=l.hasTerrain(),m=!(!l.projection||l.projection.name!=="globe"),g=p||m,x=!(!l.directionalLight||!l.directionalLight.shadowsEnabled()),w=l.map&&l.map.painter,E=!w||!w.context.extParallelShaderCompile,A=!!w&&w.emissiveMode==="mrt-fallback",I=(M,D=[],z={})=>{this._queue.push({programId:M,params:{...z.params,defines:D,overrideFog:!!z.fog,overrideTerrain:!!z.terrain,overrideGlobe:!!z.globe,overrideRtt:!!z.rtt,precompiled:!0}})};for(const M of t){if(M.visibility==="none")continue;const D=M.getProgramIds();if(D)for(const z of D){if(Da.has(z))continue;const O=M.getDefaultProgramParams(z,n.zoom,l._styleColorTheme.lut);if(!O)continue;const k=w?w.getShaderSource(z):null,q=g&&(!k||k.usedDefines.has("RENDER_TO_TEXTURE")),$=A&&q?(O.defines||[]).concat("USE_MRT1"):O.defines;if(E){I(z,O.defines,{params:O}),q&&I(z,$,{params:O,rtt:!0});continue}const U=d&&(!k||k.usedDefines.has("FOG")),Q=p&&!M.isDraped()&&(!k||k.usedDefines.has("TERRAIN")),Y=m&&(!k||k.usedDefines.has("GLOBE")),ae=x&&M.hasElevation()&&(!k||k.usedDefines.has("RENDER_SHADOWS"));for(const W of ae?[!1,!0]:[!1]){const J=W?(O.defines||[]).concat(Bm):O.defines||[];for(const se of Q?[!1,!0]:[!1])for(const ue of Y?[!1,!0]:[!1])for(const he of U?[!1,!0]:[!1])I(z,J,{params:O,fog:he,terrain:se,globe:ue})}q&&I(z,$,{params:O,rtt:!0})}}if(I("clippingMask"),p)for(const M of[!1,!0])I("terrainRaster",M?["TERRAIN_VERTEX_MORPHING"]:[],{terrain:!0,fog:d});if(!E){if(t.some(M=>M.type==="hillshade")&&I("hillshadePrepare"),x)for(const M of[!1,!0])for(const D of[!1,!0]){const z=[];M&&z.push("RENDER_CUTOFF"),z.push("RENDER_SHADOWS"),D&&z.push("NORMAL_OFFSET"),I("groundShadow",z),d&&I("groundShadow",z,{fog:!0})}if(m){for(const M of[[],["TERRAIN_VERTEX_MORPHING"],["GLOBE_POLES"]])for(const D of[!1,!0]){const z=[...M,"PROJECTION_GLOBE_VIEW"];D&&z.push("CUSTOM_ANTIALIASING"),I("globeRaster",z,{terrain:p,globe:!0,fog:d})}for(const M of[!1,!0]){const D=M?["PROJECTION_GLOBE_VIEW","FOG"]:["FOG"];I("globeAtmosphere",D,{fog:!0,terrain:p,globe:M}),I("globeAtmosphere",[...D,"ALPHA_PASS"],{fog:!0,terrain:p,globe:M})}I("stars",[],{fog:d,terrain:p,globe:!0})}}}_executeBatch(t,n,l){if(l.map&&l.map.isMoving())return void(this._idleHandle=u.r.requestIdleCallback(g=>this._executeBatch(g,n,l)));n.context.sweepPendingPrograms();const d=n.context.extParallelShaderCompile?Px.DEADLINE_MARGIN_KHR_MS:Px.DEADLINE_MARGIN_SYNC_MS;let p=0;for(;this._queue.length>0;){const g=this._queue.shift();if(!g||(n.style=l,n._fogVisible=!!g.params.overrideFog,n.getOrCreateProgram(g.programId,g.params),p++,t.timeRemaining()<=d))break}const m=this._queue.length===0||t.timeRemaining()>d;p>0&&m&&n.context.gl.flush(),this._idleHandle=this._queue.length>0||n.context._pendingPrograms.size>0?u.r.requestIdleCallback(g=>this._executeBatch(g,n,l)):null}processQueue(t,n){this._queue.length!==0&&(this._idleHandle!=null&&typeof cancelIdleCallback<"u"&&cancelIdleCallback(this._idleHandle),this._idleHandle=u.r.requestIdleCallback(l=>this._executeBatch(l,t,n)))}reset(){this._idleHandle!=null&&typeof cancelIdleCallback<"u"&&cancelIdleCallback(this._idleHandle),this._queue=[],this._idleHandle=null,this._needsBuild=!0}};za.DEADLINE_MARGIN_KHR_MS=5,za.DEADLINE_MARGIN_SYNC_MS=25;let kg=za;const mf=u.m.colorTheme,Ng=new u.a7({data:new u.a8(mf.data)});function Vg(s){if(!s.metadata||!s.metadata.content_area)return;const t=u.r.devicePixelRatio,{left:n,top:l,width:d,height:p}=s.metadata.content_area,m=n*t,g=l*t;return[m,g,m+d*t,g+p*t]}function km(s){if(s)return s.map(([t,n])=>[t*u.r.devicePixelRatio,n*u.r.devicePixelRatio])}class Ug{constructor(t,n,l){this.id=t,this.scope=n,this.sourceCache=l,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 n=this.sourceCache.getVisibleCoordinates();if(n.length===0)return t;const l=this.sourceCache.getSource();if(!(l instanceof Mo))return t;const d=n.map(m=>this.sourceCache.getTile(m)),p=l.getImages(d,Array.from(this.pendingRequests));for(const[m,g]of p)t.set(u.I.from({name:m,iconsetId:this.id}),g),this.pendingRequests.delete(m);for(const m of this.pendingRequests)this.missingRequests.add(m);return this.pendingRequests.clear(),t}}const La=(s,t)=>xa(s,t&&t.filter(n=>n.identifier!=="source.canvas")),ql=(s,t)=>{const n=s.type&&!s.array&&Array.isArray(t)?{type:s.type,"property-type":"data-constant"}:void 0;return u.n(t,n)},jg=u.b3(Zt,["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"]),Nm=u.b3(Zt,["setCenter","setZoom","setBearing","setPitch"]),Fa=new Set(["background","sky","slot","custom"]),Vm={version:8,layers:[],sources:{}},dr={duration:300,delay:0};class ln extends u.E{constructor(t,n={}){super(),this.map=t,this.scope=n.scope||"",this.globalId=null,this.fragments=[],this.importDepth=n.importDepth||0,this.importsCache=n.importsCache||new Map,this.resolvedImports=n.resolvedImports||new Set,this.transition={...dr},this._buildingIndex=new Js(this),this.crossTileSymbolIndex=new _h,this._mergedOrder=[],this._drapedFirstOrder=[],this._mergedLayers=Object.create(null),this._mergedIndoor={},this._indoorEnabled=!1,this._mergedSourceCaches={},this._mergedOtherSourceCaches=Object.create(null),this._mergedSymbolSourceCaches=Object.create(null),this._mergedFillExtrusionSourceCaches=Object.create(null),this._mergedHdRoadCoverageSourceCaches=Object.create(null),this._mergedHdRoadElevationSourceCaches=Object.create(null),this._hdCoverage=null,this._hdElevation=null,this._crossSourceElevationActive=!1,this._clipLayerPresent=!1,this._hasAppearances=!1,this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this._importedAsBasemap=!1,this._changes=n.styleChanges||new ya,this._hasDataDrivenEmissive=!1,this.indoorManager=null,this.dispatcher=n.dispatcher?n.dispatcher:new wa(dh(),this);const l={referrer:u.ee(),config:u.ed()};if(this.map.painter&&this.map.painter.context){const p=this.map.painter.context.maxUniformBufferBindings,m=Math.floor(this.map.painter.context.maxUniformBlockSize/4);l.contextOptions={maxBindingPoints:p,maxUniformBlockSizeDwords:m}}this.isRootStyle()&&this.dispatcher.broadcast("setGlobalParams",l),n.imageManager?this.imageManager=n.imageManager:(this.imageManager=new ye(this.map._spriteFormat),this.imageManager.setEventedParent(this)),this.imageManager.addScope(this.scope),this.glyphManager=n.glyphManager?n.glyphManager:new u.ef(t._requestManager,n.localFontFamily?u.eg.all:n.localIdeographFontFamily?u.eg.ideographs:u.eg.none,n.localFontFamily||n.localIdeographFontFamily,n.fontstackCompositing),n.modelManager?this.modelManager=n.modelManager:(this.modelManager=new Gl(t._requestManager),this.modelManager.setEventedParent(this)),this._layers=Object.create(null),this._sourceCaches={},this._otherSourceCaches=Object.create(null),this._symbolSourceCaches=Object.create(null),this._fillExtrusionSourceCaches=Object.create(null),this._hdCoverage=null,this._hdElevation=null,this._crossSourceElevationActive=!1,this._loaded=!1,this._initialBroadcastDone=!1,this._programPrecompiler=this.map._precompilePrograms&&this.isRootStyle()?new kg:null,this._availableImages=[],this._availableModels={},this._order=[],this._markersNeedUpdate=!1,this.options=n.configOptions?n.configOptions:new Map,this._layerExpressionDependencies=n.layerExpressionDependencies?n.layerExpressionDependencies:new Map,this._config=n.config,this._styleColorTheme={lut:null,lutLoading:!1,lutLoadingCorrelationID:0,colorTheme:null,colorThemeOverride:n.colorThemeOverride},this._styleColorThemeForScope={},this._initialConfig=n.initialConfig;const d=this;this._rtlTextPluginCallback=ln.registerForPluginStateChange(p=>{d.dispatcher.send("syncRTLPluginState",{pluginStatus:p.pluginStatus,pluginURL:p.pluginURL}).then(m=>{if(u.eh(null),m.every(g=>g))for(const g in d._sourceCaches){const x=d._sourceCaches[g],w=x.getSource().type;w!=="vector"&&w!=="geojson"||x.reload()}}).catch(m=>{u.eh(m)})}),this.on("data",p=>{if(p.dataType!=="source"||p.sourceDataType!=="metadata")return;const m=this.getOwnSource(p.sourceId);if(m&&m.vectorLayerIds)for(const g in this._layers){const x=this._layers[g];x.source===m.id&&this._validateLayer(x)}})}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(u.e(t))return t;const n=u.ei(t);if(!n.startsWith("http"))try{return new URL(n,location.href).toString()}catch{return n}return n}return`json://${u.ej(JSON.stringify(t))}`}_diffStyle(t,n,l){this.globalId=this._getGlobalId(t);const d=(p,m)=>{try{m(null,this.setState(p,l))}catch(g){m(g,!1)}};if(typeof t=="string"){const p=this.map._requestManager.normalizeStyleURL(t),m=new AbortController;this._request={cancel:()=>m.abort()},(async()=>{const g=await this.map._requestManager.transformRequest(p,u.R.Style,m.signal),{data:x}=await u.o(g,m.signal);this._request=null,d(x,n)})().catch(g=>{this._request=null,m.signal.aborted||this.fire(new u.A(g))})}else typeof t=="object"&&d(t,n)}loadURL(t,n={}){this.fire(new u.B("dataloading",{dataType:"style"}));const l=typeof n.validate=="boolean"?n.validate:!u.e(t);this.globalId=this._getGlobalId(t),t=this.map._requestManager.normalizeStyleURL(t,n.accessToken),this.resolvedImports.add(t);const d=this.importsCache.get(t);if(d)return this._load(d,l);const p=new AbortController;this._request={cancel:()=>p.abort()},(async()=>{const m=await this.map._requestManager.transformRequest(t,u.R.Style,p.signal),{data:g}=await u.o(m,p.signal);this._request=null,this.importsCache.set(t,g),this._load(g,l)})().catch(m=>{this._request=null,p.signal.aborted||this.fire(new u.A(m))})}loadJSON(t,n={}){this.fire(new u.B("dataloading",{dataType:"style"})),this.globalId=this._getGlobalId(t),this._request=u.r.frame(()=>{this._request=null,this._load(t,n.validate!==!1)})}loadEmpty(){this.fire(new u.B("dataloading",{dataType:"style"})),this._load(Vm,!1)}_loadImports(t,n,l){if(this.importDepth>=4)return u.w("Style doesn't support nesting deeper than 5"),Promise.resolve();const d=[];for(const p of t){const m=this._createFragmentStyle(p),g=new Promise(E=>{m.once("style.import.load",E),m.once("error",E)}).then(()=>{this.mergeAll(),this.fire(new u.B("data",{dataType:"style"}))});if(d.push(g),this.resolvedImports.has(p.url)){m.loadEmpty();continue}const x=p.data||this.importsCache.get(p.url);x?(p.data?(m.fire(new u.B("dataloading",{dataType:"style"})),m.globalId=m._getGlobalId(x),queueMicrotask(()=>m._load(x,n))):m.loadJSON(x,{validate:n}),this._isInternalStyle(x)&&(m.globalId=null)):p.url?m.loadURL(p.url,{validate:n}):m.loadEmpty();const w={style:m,id:p.id,config:p.config};if(l){const E=this.fragments.findIndex(({id:A})=>A===l);this.fragments=this.fragments.slice(0,E).concat(w).concat(this.fragments.slice(E))}else this.fragments.push(w)}return Promise.allSettled(d)}getImportGlobalIds(t=this,n=new Set){for(const l of t.fragments)l.style.globalId&&n.add(l.style.globalId),this.getImportGlobalIds(l.style,n);return[...n.values()]}_createFragmentStyle(t){const n=this.scope?u.y(t.id,this.scope):t.id;let l;const d=this._initialConfig&&this._initialConfig[n];(t.config||d)&&(l={...t.config,...d});const p=new ln(this.map,{scope:n,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:l,configOptions:this.options,colorThemeOverride:t["color-theme"],layerExpressionDependencies:this._layerExpressionDependencies});return p.setEventedParent(this.map,{style:p}),p}_reloadImports(t=!1){this.mergeAll(),this._updateMapProjection(),t||this.updateConfigDependencies(),this._updateLayers(this._dependentLayerIds(n=>n.isIndoorDependent)),this.map._triggerCameraUpdate(this.camera),(!t||this.isRootStyle()||this.map.style._initialBroadcastDone)&&(t&&this.isRootStyle()?(this.forEachFragmentStyle(n=>{this.dispatcher.broadcast("setLayers",{layers:n._serializeLayers(n._order),scope:n.scope,options:n.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,n){if(this._isInternalStyle(t)){const p={id:"basemap",data:t,url:""},m={...Vm,imports:[p],...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,n)}if(this.updateConfig(this._config,t.schema),n&&La(this,Nr(t)))return;this._loaded=!0;for(const p in t.sources)this.addSource(p,t.sources[p],{validate:!1,isInitialLoad:!0});this.stylesheet=u.ek(t);const l=()=>{if(t.iconsets)for(const w in t.iconsets)this.addIconset(w,t.iconsets[w]);t.sprite?this._loadIconset(t.sprite):(this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope})),!this.glyphManager.url&&t.glyphs&&this.glyphManager.setURL(t.glyphs);const p=fh(this.stylesheet.layers);if(this._order=p.map(w=>w.id),this.stylesheet.light&&u.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 w=this.stylesheet.lights[0];this.light=new va(w.properties,w.id)}else this.setLights(this.stylesheet.lights);this.light||(this.light=new va(this.stylesheet.light)),this._layers=Object.create(null);let m=!1;for(const w of p){const E=u.eo(w,this.scope,this._styleColorTheme.lut,this.options);this._layerExpressionDependencies.set(E.fqid,new cc(E)),this._hasAppearances=this._hasAppearances||E.getAppearances().length!==0,E.setEventedParent(this,{layer:{id:E.id}}),this._layers[E.id]=E,this._updateHdCoverageSourceCache(E)&&(m=!0);const A=this.getOwnLayerSourceCache(E),I=!!this.directionalLight&&this.directionalLight.shadowsEnabled();A&&E.canCastShadows()&&I&&(A.castsShadows=!0)}if(m&&Nl().then(()=>{if(!this.map)return;for(const E in this._layers)this._updateHdCoverageSourceCache(this._layers[E]);this.map.style.mergeAll();const w=this.map.transform;for(const E in this.map.style._mergedHdRoadCoverageSourceCaches){const A=this.map.style._mergedHdRoadCoverageSourceCaches[E];A.used=!0,w&&A.update(w)}this.map._update()}),this.glyphManager.url){const w=new Set;for(const E in this._layers){const A=this._layers[E];if(A.type==="symbol"&&A.layout){const I=A.layout.get("text-font");I&&I.value&&I.value.kind==="constant"&&w.add(I.value.value.join(","))}}for(const E of w)this.glyphManager.prefetchRange(E,0)}this.stylesheet.featuresets&&this.setFeaturesetSelectors(this.stylesheet.featuresets),this.stylesheet.models&&this.addModelURLs(this.stylesheet.models);const g=this.stylesheet.terrain;g&&(this.checkCanvasFingerprintNoise(),this.disableElevatedTerrain||this.terrainSetForDrapingOnly()||this._createTerrain(g,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 u.B("data",{dataType:"style"}));const x=this.isRootStyle();t.imports?this._loadImports(t.imports,n).then(()=>{this._reloadImports(!0),this.fire(new u.B(x?"style.load":"style.import.load"))}).catch(w=>{this.fire(new u.A(new Error("Failed to load imports",w))),this.fire(new u.B(x?"style.load":"style.import.load"))}):(this._reloadImports(!0),this.fire(new u.B(x?"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 p=this._evaluateColorThemeData(d);this._loadColorTheme(p).then(()=>{l()}).catch(m=>{u.w(`Couldn't load color theme from the stylesheet: ${m}`),l()})}else this._styleColorTheme.lut=null,l()}isRootStyle(){return this.importDepth===0}hasAppearances(){return this._hasAppearances||this.fragments.some(t=>t.style.hasAppearances())}mergeAll(){let t,n,l,d,p,m,g,x,w,E;const A={};this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle(I=>{if(I.stylesheet){if(I.disableElevatedTerrain&&(this.disableElevatedTerrain=!0),I.light!=null&&(t=I.light),I.stylesheet.lights)for(const M of I.stylesheet.lights)M.type==="ambient"&&I.ambientLight!=null&&(n=I.ambientLight),M.type==="directional"&&I.directionalLight!=null&&(l=I.directionalLight);d=this._prioritizeTerrain(d,I.terrain,I.stylesheet.terrain),I.stylesheet.fog&&I.fog!=null&&(p=I.fog),I.stylesheet.snow&&I.snow!=null&&(m=I.snow),I.stylesheet.rain&&I.rain!=null&&(g=I.rain),I.stylesheet.camera!=null&&(E=I.stylesheet.camera),I.stylesheet.projection!=null&&(x=I.stylesheet.projection),I.stylesheet.transition!=null&&(w=I.stylesheet.transition),A[I.scope]=I._styleColorTheme}}),this.light=t,this.ambientLight=n,this.directionalLight=l,this.fog=p,this.snow=m,this.rain=g,this._styleColorThemeForScope=A,d===null?delete this.terrain:this.terrain=d,this.camera=E||{"camera-projection":"perspective"},this.projection=x||{name:"mercator"},this.transition={...dr,...w},this.mergeSources(),this.mergeLayers(),this.mergeIndoor(),this._programPrecompiler&&this._programPrecompiler.reset()}forEachFragmentStyle(t){const n=l=>{for(const d of l.fragments)n(d.style);t(l)};n(this)}_prioritizeTerrain(t,n,l){const d=t&&t.drapeRenderMode===0;return l===null?n&&n.drapeRenderMode===0?n:d?t:null:n!=null&&(!t||d||n&&n.drapeRenderMode===1)?n:t}mergeTerrain(){let t;this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle(n=>{t=this._prioritizeTerrain(t,n.terrain,n.stylesheet.terrain)}),t===null?delete this.terrain:this.terrain=t,this._programPrecompiler&&this._programPrecompiler.reset()}mergeProjection(){let t;this.forEachFragmentStyle(n=>{n.stylesheet.projection!=null&&(t=n.stylesheet.projection)}),this.projection=t||{name:"mercator"},this._programPrecompiler&&this._programPrecompiler.reset()}mergeSources(){const t={},n=Object.create(null),l=Object.create(null),d=Object.create(null),p=Object.create(null),m=Object.create(null);this.forEachFragmentStyle(g=>{for(const x in g._sourceCaches){const w=u.y(x,g.scope);t[w]=g._sourceCaches[x]}for(const x in g._otherSourceCaches){const w=u.y(x,g.scope);n[w]=g._otherSourceCaches[x]}for(const x in g._symbolSourceCaches){const w=u.y(x,g.scope);l[w]=g._symbolSourceCaches[x]}for(const x in g._fillExtrusionSourceCaches){const w=u.y(x,g.scope);d[w]=g._fillExtrusionSourceCaches[x]}if(g._hdCoverage){const x=g._hdCoverage.coverageSourceCaches;for(const w in x)p[u.y(w,g.scope)]=x[w]}if(g._hdElevation){const x=g._hdElevation.elevationSourceCaches;for(const w in x)m[w]=x[w]}}),this._mergedSourceCaches=t,this._mergedOtherSourceCaches=n,this._mergedSymbolSourceCaches=l,this._mergedFillExtrusionSourceCaches=d,this._mergedHdRoadCoverageSourceCaches=p,this._mergedHdRoadElevationSourceCaches=m,Object.keys(p).length>0&&!this._hdCoverage&&Ft.HdCoverageState&&(this._hdCoverage=new Ft.HdCoverageState),Ft.updateCrossSourceElevationGate&&Ft.updateCrossSourceElevationGate(this)}mergeIndoor(){this._mergedIndoor={},this.forEachFragmentStyle(t=>{if(t.stylesheet&&t.stylesheet.indoor)for(const n of Object.values(t.stylesheet.indoor)){const l=n,d=u.y(l.sourceId,t.scope);this._mergedIndoor[d]=new Set(l.sourceLayers||[])}}),this._updateIndoorEnabled()}_updateIndoorEnabled(){const t=this._indoorEnabled;if(this._indoorEnabled=!1,Object.keys(this._mergedIndoor).length>0)for(const n of this._mergedOrder){const l=this._mergedLayers[n];if(l.visibility!=="none"&&this._mergedIndoor[u.y(l.source,l.scope)]){this._indoorEnabled=!0;break}}!this._indoorEnabled||t||this.indoorManager||Nl().then(()=>{this._initIndoorManager()})}_initIndoorManager(){if(!this.indoorManager&&Ft.IndoorManager&&this.isRootStyle()&&Object.keys(this._mergedIndoor).length!==0&&(this.indoorManager=new Ft.IndoorManager(this,this._loaded),this._loaded))for(const t of Object.keys(this._mergedIndoor)){const n=this._mergedSourceCaches[t]||this._mergedOtherSourceCaches[t];n&&n.reload()}}mergeLayers(){const t={},n=[],l=Object.create(null);this._mergedSlots=[],this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this.forEachFragmentStyle(m=>{for(const g of m._order){const x=m._layers[g];if(x.type==="slot"){const w=u.dC(g);if(t[w])continue;t[w]=[]}x.slot&&t[x.slot]?t[x.slot].push(x):n.push(x)}}),this._mergedOrder=[];let d=-1;const p=(m=[])=>{for(const g of m)if(g.type==="slot"){const x=u.dC(g.id);t[x]&&p(t[x]),this._mergedSlots.push(x)}else{const x=u.y(g.id,g.scope);this._mergedOrder.push(x),l[x]=g,g.is3D(!!this.terrain)&&(this._has3DLayers=!0,d=this._mergedOrder.length-1),g.type==="circle"&&(this._hasCircleLayers=!0),g.type==="symbol"&&(this._hasSymbolLayers=!0),g.type==="clip"&&(this._clipLayerPresent=!0)}};if(p(n),this._has3DLayers){const m={};for(let g=0;g<this._mergedOrder.length;++g){const x=this._mergedOrder[g];m[x]=g===d?1:g<d?l[x].hasOcclusionOpacityProperties?2:0:4}this._mergedOrder.sort((g,x)=>m[g]-m[x])}this._mergedLayers=l,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={...this.stylesheet.camera,...t},this.camera=this.stylesheet.camera,this}_evaluateColorThemeData(t){return t.data?(function(n,l,d){const p={...l};for(const g of Object.keys(mf))p[g]===void 0&&(p[g]=mf[g].default);const m=new u.a6(Ng,n,new Map(d));return m.setTransitionOrValue(p,d),m.untransitioned().possiblyEvaluate(new u.aa(0,{worldview:void 0}))})(this.scope,t,this.options).get("data"):null}_loadColorTheme(t){this._styleColorTheme.lutLoading=!0,this._styleColorTheme.lutLoadingCorrelationID+=1;const n=this._styleColorTheme.lutLoadingCorrelationID;return new Promise((l,d)=>{const p="data:image/png;base64,";if(!t||t.length===0)return this._styleColorTheme.lut=null,this._styleColorTheme.lutLoading=!1,void l();let m=t;m.startsWith(p)||(m=p+m);const g=u.I.from("mapbox-reserved-lut"),x=new Image;x.src=m,x.onerror=()=>{this._styleColorTheme.lutLoading=!1,d(new Error("Failed to load image data"))},x.onload=()=>{if(this._styleColorTheme.lutLoadingCorrelationID!==n)return void l();this._styleColorTheme.lutLoading=!1;const{width:w,height:E,data:A}=u.r.getImageData(x);if(E>32)return void d(new Error("The height of the image must be less than or equal to 32 pixels."));if(w!==E*E)return void d(new Error("The width of the image must be equal to the height squared."));this.getImage(g)&&this.removeImage(g),this.addImage(g,{data:new u.t({width:w,height:E},A),pixelRatio:1,sdf:!1,usvg:!1,version:0});const I=this.imageManager.getImage(g,this.scope);I?(this._styleColorTheme.lut={image:I.data,data:t},l()):d(new Error("Missing LUT image."))}})}getLut(t){const n=this._styleColorThemeForScope[t];return n?n.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.hasTerrain()||this.setTerrainForDraping():this.terrainSetForDrapingOnly()&&this.setTerrain(null,0))}_updateMapProjection(){this.isRootStyle()&&(this.map._useExplicitProjection?this.applyProjectionUpdate():this.map._prioritizeAndUpdateProjection(null,this.projection))}_loadSprite(t){const n=new AbortController;this._spriteRequest=n,(function(l,d,p,m){let g,x,w;const E=u.r.devicePixelRatio>1?"@2x":"";function A(I){w||I&&p.aborted||(I&&(w=I),(function(){if(w)m(w);else if(g&&x){const M=u.r.getImageData(x),D={};for(const z in g){const{width:O,height:k,x:q,y:$,sdf:U,pixelRatio:Q,stretchX:Y,stretchY:ae,content:W}=g[z],J=new u.t({width:O,height:k});u.t.copy(M,J,{x:q,y:$},{x:0,y:0},{width:O,height:k},null),D[z]={data:J,pixelRatio:Q!==void 0?Q:1,sdf:U!==void 0&&U,stretchX:Y,stretchY:ae,content:W,usvg:!1,version:0}}m(null,D)}})())}(async function(){const I=await d.transformRequest(d.normalizeSpriteURL(l,E,".json"),u.R.SpriteJSON,p),{data:M}=await u.o(I,p);w||(g=M)})().then(()=>A(void 0),I=>A(I)),(async function(){const I=await d.transformRequest(d.normalizeSpriteURL(l,E,".png"),u.R.SpriteImage,p),{data:M}=await u.q(I,p);w||(x=M)})().then(()=>A(void 0),I=>A(I))})(t,this.map._requestManager,n.signal,(l,d)=>{if(this._spriteRequest=null,l)this.dispatcher.broadcast("spriteLoaded",{scope:this.scope}),this.fire(new u.A(l));else if(d){const p=new Map;for(const m in d)p.set(u.I.from(m),d[m]);this.addImages(p,!0)}this.imageManager.setLoaded(!0,this.scope),this.fire(new u.B("data",{dataType:"style"}))})}addIconset(t,n){if(n.type==="sprite")return void this._loadSprite(n.url);const l=this.getOwnSourceCache(n.source);if(!l)return void this.fire(new u.A(new Error(`Source "${n.source}" as specified by iconset "${t}" does not exist and cannot be used as an iconset source`)));const d=l.getSource();if(d.type!=="raster-array")return void this.fire(new u.A(new Error(`Source "${n.source}" as specified by iconset "${t}" is not a "raster-array" source and cannot be used as an iconset source`)));d.partial=!1;const p=new Ug(t,this.scope,l);this.imageManager.addImageProvider(p,this.scope)}removeIconset(t){this.imageManager.removeImageProvider(t,this.scope)}_loadIconset(t){if(!u.e(t)&&this.map._spriteFormat!=="icon_set"||this.map._spriteFormat==="raster")return void this._loadSprite(t);const n=this.map._spriteFormat==="auto",l=new AbortController;this._spriteRequest=l,(async function(d,p,m,g){try{const x=await p.transformRequest(p.normalizeIconsetURL(d),u.R.Iconset,m),{data:w}=await u.d9(x,m),E={},A=(function(I){const M={icons:[]};let D;for(;D=I.nextField(void 0);)D===1&&M.icons.push(Eo(I,I.readVarint()+I.pos));return M})(new u.d8(w));for(const I of A.icons){const M={version:1,pixelRatio:u.r.devicePixelRatio,content:Vg(I),stretchX:I.metadata?km(I.metadata.stretch_x_areas):void 0,stretchY:I.metadata?km(I.metadata.stretch_y_areas):void 0,sdf:!1,usvg:!0,icon:I};E[I.name]=M}g(null,E)}catch(x){m.aborted||g(x)}})(t,this.map._requestManager,l.signal,(d,p)=>{if(this._spriteRequest=null,d)n?this._loadSprite(t):(this.dispatcher.broadcast("spriteLoaded",{scope:this.scope}),this.fire(new u.A(d)));else if(p){const m=new Map;for(const g in p)m.set(u.I.from(g),p[g]);this.addImages(m,!0)}this.imageManager.setLoaded(!0,this.scope),this.fire(new u.B("data",{dataType:"style"}))})}_validateLayer(t){const n=this.getOwnSource(t.source);if(!n)return;const l=t.sourceLayer;l&&(n.type==="geojson"||n.vectorLayerIds&&!n.vectorLayerIds.includes(l))&&this.fire(new u.A(new Error(`Source layer "${l}" does not exist on source "${n.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,n)=>{const l=this.fragments[n];return l&&l.style&&(t.data=l.style.serialize()),t})}_serializeSources(){const t={};for(const n in this._sourceCaches){const l=this._sourceCaches[n].getSource();t[l.id]||(t[l.id]=l.serialize())}return t}_serializeLayers(t){const n=[];for(const l of t){const d=this._layers[l];d&&d.type!=="custom"&&n.push(d.serialize())}return n}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 n=this._mergedLayers[t];if(n._transitionablePaint&&n._transitionablePaint._values){const l=n._transitionablePaint._values["line-emissive-strength"];if(l&&l.value&&l.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 n=this.getOwnLayer(t);if(n)return n;this.fire(new u.A(new Error(`The layer '${t}' does not exist in the map's style.`)))}_checkSource(t){const n=this.getOwnSource(t);if(n)return n;this.fire(new u.A(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 n=this.calculateLightsBrightness();t.brightness=n||0;let l=!1;n!==this._brightness&&(this._brightness=n,l=!0),t.worldview!==this._worldview&&(this._worldview=t.worldview,l=!0),l&&this.dispatcher.broadcast("upsertRenderParams",{brightness:this._brightness,worldview:this._worldview});const d=this._changes.isDirty();let p=!1;if(this._changes.isDirty()){const w=this._changes.getLayerUpdatesByScope();for(const E in w){const{updatedIds:A,removedIds:I}=w[E];(A||I)&&(this._updateWorkerLayers(E,A,I),p=!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 w in this._mergedSourceCaches){const E=this._mergedSourceCaches[w];m[w]=E.used,E.used=!1,E.tileCoverLift=0}const g={};for(const w of this._mergedOrder){const E=this._mergedLayers[w];if((E.visibility!=="none"||E.hasTransition())&&E.recalculate(t,this._availableImages),!E.isHidden(t.zoom)){E.mayUse("HD")&&(E.prepare(),Nl()),E.mayUse("Standard")&&(E.prepare(),Dd());const A=this.getLayerSourceCache(E);A&&(A.used=!0,A.tileCoverLift=Math.max(A.tileCoverLift,E.tileCoverLift()))}if(E.source){const A=u.y(E.source,E.scope),I=this._mergedHdRoadCoverageSourceCaches[A];I&&!I.used&&(I.used=!0)}if(E.type==="fill-extrusion"){const A=u.y(E.source,E.scope);if(A in this._mergedFillExtrusionSourceCaches){const I=E.layout&&E.layout.get("source-max-zoom");if(I!=null){const M=g[A];g[A]=M==null?I:Math.min(M,I)}}}}if(this._programPrecompiler&&this._programPrecompiler.needsBuild()){const w=this._mergedOrder.map(E=>this._mergedLayers[E]);this._programPrecompiler.buildQueue(w,t,this)}for(const w in this._mergedFillExtrusionSourceCaches)this._mergedFillExtrusionSourceCaches[w].setMaxzoomOverride(g[w]!=null?g[w]:null);this.terrain&&p&&this.mergeLayers();const x=this.imageManager.getPendingImageProviders();for(const w of x)w.sourceCache.used=!0;for(const w in m){const E=this._mergedSourceCaches[w];m[w]!==E.used&&E.getSource().fire(new u.B("data",{sourceDataType:"visibility",dataType:"source",sourceId:E.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),d&&this.fire(new u.B("data",{dataType:"style"}))}updateImageProviders(){const t=this.imageManager.getPendingImageProviders();for(const n of t){const l=n.resolvePendingRequests(),d=this.getFragmentStyle(n.scope);d&&d.addImages(l)}}_updateTilesForChangedImages(){const t={};for(const n in this._mergedSourceCaches){const l=this._mergedSourceCaches[n].getSource().scope;t[l]=t[l]||this._changes.getUpdatedImages(l),t[l].length!==0&&this._mergedSourceCaches[n].reloadTilesForDependencies(["icons","patterns"],t[l])}for(const n in t)this._changes.resetUpdatedImages(n)}_updateWorkerLayers(t,n,l){const d=this.getFragmentStyle(t);d&&this.dispatcher.broadcast("updateLayers",{layers:n?d._serializeLayers(n):[],scope:t,removedIds:l||[],options:d.options})}setState(t,n){if(this._checkLoaded(),La(this,Nr(t)))return!1;(t=u.ek(t)).layers=fh(t.layers);const l=(function(m,g){if(!m)return[{command:Zt.setStyle,args:[g]}];let x=[];try{if(!u.b5(m.version,g.version))return[{command:Zt.setStyle,args:[g]}];if(u.b5(m.center,g.center)||x.push({command:Zt.setCenter,args:[g.center]}),u.b5(m.zoom,g.zoom)||x.push({command:Zt.setZoom,args:[g.zoom]}),u.b5(m.bearing,g.bearing)||x.push({command:Zt.setBearing,args:[g.bearing]}),u.b5(m.pitch,g.pitch)||x.push({command:Zt.setPitch,args:[g.pitch]}),u.b5(m.sprite,g.sprite)||x.push({command:Zt.setSprite,args:[g.sprite]}),u.b5(m.glyphs,g.glyphs)||x.push({command:Zt.setGlyphs,args:[g.glyphs]}),u.b5(m.imports,g.imports)||(function(M=[],D=[],z){D=D||[];const O=(M=M||[]).map(Fc),k=D.map(Fc),q=M.reduce(Oc,{}),$=D.reduce(Oc,{}),U=O.slice();let Q,Y,ae,W;for(Q=0,Y=0;Q<O.length;Q++)ae=O[Q],Object.hasOwn($,ae)?Y++:(z.push({command:Zt.removeImport,args:[ae]}),U.splice(U.indexOf(ae,Y),1));for(Q=0,Y=0;Q<k.length;Q++)ae=k[k.length-1-Q],U[U.length-1-Q]!==ae&&(Object.hasOwn(q,ae)?(z.push({command:Zt.removeImport,args:[ae]}),U.splice(U.lastIndexOf(ae,U.length-Y),1)):Y++,W=U[U.length-Q],z.push({command:Zt.addImport,args:[$[ae],W]}),U.splice(U.length-Q,0,ae));for(const J of D){const se=q[J.id];se&&(delete se.data,u.b5(se,J)||z.push({command:Zt.updateImport,args:[J.id,J]}))}})(m.imports,g.imports,x),u.b5(m.transition,g.transition)||x.push({command:Zt.setTransition,args:[g.transition]}),u.b5(m.light,g.light)||x.push({command:Zt.setLight,args:[g.light]}),u.b5(m.fog,g.fog)||x.push({command:Zt.setFog,args:[g.fog]}),u.b5(m.snow,g.snow)||x.push({command:Zt.setSnow,args:[g.snow]}),u.b5(m.rain,g.rain)||x.push({command:Zt.setRain,args:[g.rain]}),u.b5(m.projection,g.projection)||x.push({command:Zt.setProjection,args:[g.projection]}),u.b5(m.lights,g.lights)||x.push({command:Zt.setLights,args:[g.lights]}),u.b5(m.camera,g.camera)||x.push({command:Zt.setCamera,args:[g.camera]}),u.b5(m.iconsets,g.iconsets)||(function(M,D,z){let O;for(O in D=D||{},M=M||{})Object.hasOwn(M,O)&&(Object.hasOwn(D,O)||z.push({command:Zt.removeIconset,args:[O]}));for(O in D){if(!Object.hasOwn(D,O))continue;
3325const k=D[O];Object.hasOwn(M,O)?u.b5(M[O],k)||(z.push({command:Zt.removeIconset,args:[O]}),z.push({command:Zt.addIconset,args:[O,k]})):z.push({command:Zt.addIconset,args:[O,k]})}})(m.iconsets,g.iconsets,x),!u.b5(m["color-theme"],g["color-theme"]))return[{command:Zt.setStyle,args:[g]}];const w={},E=[];(function(M,D,z,O){let k;for(k in D=D||{},M=M||{})Object.hasOwn(M,k)&&(Object.hasOwn(D,k)||oi(k,z,O));for(k in D){if(!Object.hasOwn(D,k))continue;const q=D[k];Object.hasOwn(M,k)?u.b5(M[k],q)||(M[k].type==="geojson"&&q.type==="geojson"&&cf(M,D,k)?z.push({command:Zt.setGeoJSONSourceData,args:[k,q.data]}):ph(k,D,z,O)):Wo(k,D,z)}})(m.sources,g.sources,E,w);const A=[];m.layers&&m.layers.forEach(M=>{M.source&&w[M.source]?x.push({command:Zt.removeLayer,args:[M.id]}):A.push(M)});let I=m.terrain;I&&w[I.source]&&(x.push({command:Zt.setTerrain,args:[void 0]}),I=void 0),x=x.concat(E),u.b5(I,g.terrain)||x.push({command:Zt.setTerrain,args:[g.terrain]}),(function(M,D,z){D=D||[];const O=(M=M||[]).map(Fc),k=D.map(Fc),q=M.reduce(Oc,{}),$=D.reduce(Oc,{}),U=O.slice(),Q=Object.create(null);let Y,ae,W,J,se,ue,he;for(Y=0,ae=0;Y<O.length;Y++)W=O[Y],Object.hasOwn($,W)?ae++:(z.push({command:Zt.removeLayer,args:[W]}),U.splice(U.indexOf(W,ae),1));for(Y=0,ae=0;Y<k.length;Y++)W=k[k.length-1-Y],U[U.length-1-Y]!==W&&(Object.hasOwn(q,W)?(z.push({command:Zt.removeLayer,args:[W]}),U.splice(U.lastIndexOf(W,U.length-ae),1)):ae++,ue=U[U.length-Y],z.push({command:Zt.addLayer,args:[$[W],ue]}),U.splice(U.length-Y,0,W),Q[W]=!0);for(Y=0;Y<k.length;Y++)if(W=k[Y],J=q[W],se=$[W],!Q[W]&&!u.b5(J,se))if(u.b5(J.source,se.source)&&u.b5(J["source-layer"],se["source-layer"])&&u.b5(J.type,se.type)){for(he in Lc(J.layout,se.layout,z,W,null,Zt.setLayoutProperty),Lc(J.paint,se.paint,z,W,null,Zt.setPaintProperty),u.b5(J.slot,se.slot)||z.push({command:Zt.setSlot,args:[W,se.slot]}),u.b5(J.filter,se.filter)||z.push({command:Zt.setFilter,args:[W,se.filter]}),u.b5(J.minzoom,se.minzoom)&&u.b5(J.maxzoom,se.maxzoom)||z.push({command:Zt.setLayerZoomRange,args:[W,se.minzoom,se.maxzoom]}),J)Object.hasOwn(J,he)&&he!=="layout"&&he!=="paint"&&he!=="filter"&&he!=="metadata"&&he!=="minzoom"&&he!=="maxzoom"&&he!=="slot"&&(he.indexOf("paint.")===0?Lc(J[he],se[he],z,W,he.slice(6),Zt.setPaintProperty):u.b5(J[he],se[he])||z.push({command:Zt.setLayerProperty,args:[W,he,se[he]]}));for(he in se)Object.hasOwn(se,he)&&!Object.hasOwn(J,he)&&he!=="layout"&&he!=="paint"&&he!=="filter"&&he!=="metadata"&&he!=="minzoom"&&he!=="maxzoom"&&he!=="slot"&&(he.indexOf("paint.")===0?Lc(J[he],se[he],z,W,he.slice(6),Zt.setPaintProperty):u.b5(J[he],se[he])||z.push({command:Zt.setLayerProperty,args:[W,he,se[he]]}))}else z.push({command:Zt.removeLayer,args:[W]}),ue=U[U.lastIndexOf(W)+1],z.push({command:Zt.addLayer,args:[se,ue]})})(A,g.layers,x)}catch(w){console.warn("Unable to compute style diff:",w),x=[{command:Zt.setStyle,args:[g]}]}return x})(this.serialize(),t).filter(m=>!(m.command in Nm));if(l.length===0)return!1;const d=l.filter(m=>!(m.command in jg));if(d.length>0)throw new Error(`Unimplemented: ${d.map(m=>m.command).join(", ")}.`);const p=[];return l.forEach(m=>{p.push(this[m.command](...m.args))}),n&&Promise.all(p).then(n).catch(n),this.stylesheet=t,this.mergeAll(),this.dispatcher.broadcast("setLayers",{layers:this._serializeLayers(this._order),scope:this.scope,options:this.options}),!0}_updateWorkerImages(t=!1){this._availableImages=this.imageManager.listImages(this.scope);const n={scope:this.scope,images:this._availableImages};t&&(n.isSpriteLoaded=!0),this.dispatcher.broadcast("setImages",n)}_updateWorkerModels(){this._availableModels=this.modelManager.getModelURIs(this.scope),this.dispatcher.broadcast("setModels",{scope:this.scope,models:this._availableModels})}addImages(t,n){if(t.size===0)return n&&this.dispatcher.broadcast("spriteLoaded",{scope:this.scope}),this;for(const[l,d]of t.entries()){if(this.getImage(l))return this.fire(new u.A(new Error(`An image with the name "${l.name}" already exists.`)));this.imageManager.addImage(l,this.scope,d),this._changes.updateImage(l,this.scope)}return this._updateWorkerImages(n),this.fire(new u.B("data",{dataType:"style"})),this}addImage(t,n){return this.getImage(t)?this.fire(new u.A(new Error(`An image with the name "${t.name}" already exists.`))):(this.imageManager.addImage(t,this.scope,n),this._changes.updateImage(t,this.scope),this._updateWorkerImages(),this.fire(new u.B("data",{dataType:"style"})),this)}updateImage(t,n,l=!1){this.imageManager.updateImage(t,this.scope,n),l&&(this._changes.updateImage(t,this.scope),this._updateWorkerImages(),this.fire(new u.B("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 u.B("data",{dataType:"style"})),this):this.fire(new u.A(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 u.B("data",{dataType:"style"})),this}addModel(t,n,l={}
vendor: 10,480 bytes, line 3325
3325){return this._checkLoaded(),this._validate(qp,`models.${t}`,n,null,l)||(this.modelManager.addModel(t,n,this.getActualScope()),this.fire(new u.B("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 u.B("data",{dataType:"style"})),this):this.fire(new u.A(new Error("No model with this ID exists.")))}listModels(){return this._checkLoaded(),this.modelManager.listModels(this.getActualScope())}addSource(t,n,l={}){if(this._checkLoaded(),this.getOwnSource(t)!==void 0)throw new Error(`There is already a source with ID "${t}".`);if(!n.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(n).join(", ")}.`);if(["vector","raster","geojson","video","image"].includes(n.type)&&this._validate(_l,`sources.${t}`,n,null,l))return;this.map&&this.map._collectResourceTiming&&(n.collectResourceTiming=!0);const d=of(t,n,this.dispatcher,this);d.scope=this.scope,d.setEventedParent(this,()=>({isSourceLoaded:this._isSourceCacheLoaded(d.id),source:d.serialize(),sourceId:d.id}));const p=m=>{const g=(m===u.dz.Symbol?"symbol:":m===u.dz.FillExtrusion?"fill-extrusion:":"other:")+d.id,x=u.y(g,this.scope),w=this._sourceCaches[g]=new sn(x,d,m);m===u.dz.Symbol?this._symbolSourceCaches[d.id]=w:m===u.dz.FillExtrusion?this._fillExtrusionSourceCaches[d.id]=w:this._otherSourceCaches[d.id]=w,w.onAdd(this.map)};p(u.dz.Other),n.type!=="vector"&&n.type!=="geojson"||(p(u.dz.Symbol),n.type==="vector"&&p(u.dz.FillExtrusion)),d.onAdd&&d.onAdd(this.map),l.isInitialLoad||(this.mergeSources(),this._changes.setDirty())}removeSource(t){this._checkLoaded();const n=this.getOwnSource(t);if(!n)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 u.A(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 u.A(new Error(`Source "${t}" cannot be removed while terrain is using it.`)));if(this.stylesheet.iconsets){const d=Object.entries(this.stylesheet.iconsets).find(([p,m])=>m.type==="source"&&m.source===t);if(d)return this.fire(new u.A(new Error(`Source "${t}" cannot be removed while iconset "${d[0]}" is using it.`)))}const l=this.getOwnSourceCaches(t);for(const d of l){const p=u.dC(d.id);delete this._sourceCaches[p],this._changes.discardSourceCacheUpdate(d.id),d.fire(new u.B("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._hdCoverage&&delete this._hdCoverage.coverageSourceCaches[t],this._hdElevation&&delete this._hdElevation.elevationSourceCaches[u.y(t,this.scope)],this.mergeSources(),n.setEventedParent(null),n.onRemove&&n.onRemove(this.map),this._changes.setDirty(),this}setGeoJSONSourceData(t,n){this._checkLoaded(),this.getOwnSource(t).setData(n),this._changes.setDirty()}getOwnSource(t){const n=this.getOwnSourceCache(t);return n&&n.getSource()}getOwnSources(){const t=[];for(const n in this._otherSourceCaches){const l=this.getOwnSourceCache(n);l&&t.push(l.getSource())}return t}areTilesLoaded(){const t=this._mergedSourceCaches;for(const n in t){const l=t[n]._tiles;for(const d in l){const p=l[d];if(p.state!=="loaded"&&p.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 n=this._getTransitionParameters();for(const p of t){if(this._validate(kp,"lights",p))return;switch(p.type){case"ambient":if(this.ambientLight){const m=this.ambientLight;m.set(p),m.updateTransitions(n)}else this.ambientLight=new In(p,fd(),this.scope,this.options);break;case"directional":if(this.directionalLight){const m=this.directionalLight;m.set(p),m.updateTransitions(n)}else this.directionalLight=new In(p,yt(),this.scope,this.options)}}const l=Object.assign(n,{worldview:this.map.getWorldview()}),d=new u.aa(this.z||0,l);this.ambientLight&&this.ambientLight.recalculate(d),this.directionalLight&&this.directionalLight.recalculate(d),this._brightness=this.calculateLightsBrightness(),this.dispatcher.broadcast("upsertRenderParams",{brightness:this._brightness})}calculateLightsBrightness(){const t=this.directionalLight,n=this.ambientLight;if(!t||!n)return;const l=I=>.2126*(I[0]<=.03928?I[0]/12.92:Math.pow((I[0]+.055)/1.055,2.4))+.7152*(I[1]<=.03928?I[1]/12.92:Math.pow((I[1]+.055)/1.055,2.4))+.0722*(I[2]<=.03928?I[2]/12.92:Math.pow((I[2]+.055)/1.055,2.4)),d=t.properties.get("color").toNonPremultipliedRenderColor(null).toArray01(),p=t.properties.get("intensity"),m=t.properties.get("direction"),g=1-u.c5(m.x,m.y,m.z)[2]/90,x=l(d)*p*g,w=n.properties.get("color").toNonPremultipliedRenderColor(null).toArray01(),E=n.properties.get("intensity"),A=l(w)*E;return Number(((x+A)/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(u.el(t)){const n=u.em(t),l=this.fragments.find(({id:p})=>p===n);if(!l)return;const d=u.dC(t);return l.style.getFragmentStyle(d)}{const n=this.fragments.find(({id:l})=>l===t);return n?n.style:void 0}}setFeaturesetSelectors(t){if(!t)return;const n=(l,d="")=>`${l}::${d}`;this._featuresetSelectors={};for(const l in t){const d={},p=this._featuresetSelectors[l]=[];for(const m of t[l].selectors){if(m.featureNamespace){const x=this.getOwnLayer(m.layer);if(!x){u.w(`Layer is undefined for selector: ${m.layer}`);continue}const w=n(x.source,x.sourceLayer);if(w in d&&d[w]!==m.featureNamespace){u.w(`"featureNamespace ${m.featureNamespace} of featureset ${l}'s selector is not associated to the same source, skip this selector`);continue}d[w]=m.featureNamespace}let g;if(m.properties)for(const x in m.properties){const w=u.n(m.properties[x]);w.result==="success"&&(g=g||{},g[x]=w.value)}p.push({layerId:m.layer,namespace:m.featureNamespace,properties:g,uniqueFeatureID:m._uniqueFeatureID})}}}getFeaturesetDescriptors(t){const n=this.getFragmentStyle(t);if(!n||!n.stylesheet.featuresets)return[];const l=[];for(const d in n.stylesheet.featuresets)l.push({featuresetId:d,importId:n.scope?n.scope:void 0});return l}getFeaturesetLayers(t,n){const l=this.getFragmentStyle(n),d=l.stylesheet.featuresets;if(!d||!d[t])return this.fire(new u.A(new Error(`The featureset '${t}' does not exist in the map's style and cannot be queried.`))),[];const p=[];for(const m of d[t].selectors){const g=l.getOwnLayer(m.layer);g&&p.push(g)}return p}getConfigProperty(t,n){const l=this.getFragmentStyle(t);if(!l)return null;const d=u.y(n,l.scope),p=l.options.get(d),m=p?p.value||p.default:null;return m?m.serialize():null}isIndoorEnabled(){return this._indoorEnabled}getIndoorSourceLayers(t,n){const l=u.y(t,n);return this._mergedIndoor[l]}setIndoorData(t,n){this.indoorManager&&this.indoorManager.setIndoorData(n)}updateIndoorDependentLayers(){this._updateLayers(this._dependentLayerIds(t=>t.isIndoorDependent)),this.map._styleDirty=!0,this.map.triggerRepaint()}setConfigProperty(t,n,l){const d=this.getFragmentStyle(t);if(!d)return;const p=d.stylesheet.schema;if(!p||!p[n])return;const m=ql(p[n],l);if(m.result!=="success")return void La(this,m.value);const g=m.value.expression,x=u.y(n,d.scope),w=d.options.get(x);if(!w)return;let E;const{minValue:A,maxValue:I,stepValue:M,type:D,values:z}=p[n],O=ql(p[n],p[n].default);O.result==="success"&&(E=O.value.expression),E?(this.options.set(x,{...w,value:g,default:E,minValue:A,maxValue:I,stepValue:M,type:D,values:z}),this.updateConfigDependencies(n)):this.fire(new u.A(new Error(`No schema defined for the config option "${n}" in the "${t}" fragment.`)))}getConfig(t){const n=this.getFragmentStyle(t);if(!n)return null;const l=n.stylesheet.schema;if(!l)return null;const d={};for(const p in l){const m=u.y(p,n.scope),g=n.options.get(m),x=g?g.value||g.default:null;d[p]=x?x.serialize():null}return d}setConfig(t,n){const l=this.getFragmentStyle(t);l&&(l.updateConfig(n,l.stylesheet.schema),this.updateConfigDependencies())}getSchema(t){const n=this.getFragmentStyle(t);return n?n.stylesheet.schema:null}setSchema(t,n){const l=this.getFragmentStyle(t);l&&(l.stylesheet.schema=n,l.updateConfig(l._config,n),this.updateConfigDependencies())}updateConfig(t,n){if(this._config=t,t||n)if(n)for(const l in n){let d,p;const m=ql(n[l],n[l].default);if(m.result==="success"&&(d=m.value.expression),t&&t[l]!==void 0){const I=ql(n[l],t[l]);I.result==="success"&&(p=I.value.expression)}const{minValue:g,maxValue:x,stepValue:w,type:E,values:A}=n[l];if(d){const I=u.y(l,this.scope);this.options.set(I,{default:d,value:p,minValue:g,maxValue:x,stepValue:w,type:E,values:A})}else this.fire(new u.A(new Error(`No schema defined for config option "${l}".`)))}else this.fire(new u.A(new Error("Attempting to set config for a style without schema.")))}_updateLayers(t){for(const n of t){const l=this.getLayer(n);l&&(l.possiblyEvaluateVisibility(),this._updateLayer(l),this._changes.setDirty())}}_dependentLayerIds(t){const n=[];for(const[l,d]of this._layerExpressionDependencies)t(d)&&n.push(l);return n}updateConfigDependencies(t){this._updateLayers(this._dependentLayerIds(n=>t?n.hasConfigDependency(t):n.isConfigDependent)),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(n=>{const l=n._styleColorTheme.colorThemeOverride?n._styleColorTheme.colorThemeOverride:n._styleColorTheme.colorTheme;if(l){const d=n._evaluateColorThemeData(l);(!n._styleColorTheme.lut&&d!==""||n._styleColorTheme.lut&&d!==n._styleColorTheme.lut.data)&&n.setColorTheme(l)}}),this._updateIndoorEnabled(),this._changes.setDirty()}addLayer(t,n,l={}){this._checkLoaded();const d=t.id;if(this._layers[d])return void this.fire(new u.A(new Error(`Layer with i
3325d "${d}" already exists on this map`)));let p;if(t.type==="custom"){if(La(this,u.en(t)))return;p=u.eo(t,this.scope,this._styleColorTheme.lut,this.options)}else{if(typeof t.source=="object"&&(this.addSource(d,t.source),t=u.ek(t),t=Object.assign(t,{source:d})),this._validate(jp,`layers.${d}`,t,{arrayIndex:-1},l))return;p=u.eo(t,this.scope,this._styleColorTheme.lut,this.options),this._validateLayer(p),p.setEventedParent(this,{layer:{id:d}})}this._layerExpressionDependencies.set(p.fqid,new cc(p));let m=this._order.length;if(n){const E=this._order.indexOf(n);if(E===-1)return void this.fire(new u.A(new Error(`Layer with id "${n}" does not exist on this map.`)));p.slot&&p.slot!==this._layers[n].slot?u.w(`Layer with id "${n}" has a different slot. Layers can only be rearranged within the same slot.`):m=E}this._order.splice(m,0,d),this._handleLayerOrderChange(),this._layers[d]=p;const g=this.getOwnLayerSourceCache(p),x=!!this.directionalLight&&this.directionalLight.shadowsEnabled();g&&p.canCastShadows()&&x&&(g.castsShadows=!0);const w=this._changes.getRemovedLayer(p);if(w&&p.source&&g&&p.type!=="custom"){this._changes.discardLayerRemoval(p);const E=u.y(p.source,p.scope);w.type!==p.type?this._changes.updateSourceCache(E,"clear"):(this._changes.updateSourceCache(E,"reload"),g.pause())}this._updateLayer(p),p.onAdd&&p.onAdd(this.map),p.scope=this.scope,this.mergeLayers()}moveLayer(t,n){this._checkLoaded();const l=this._checkLayer(t);if(!l||t===n)return;const d=this._order.indexOf(t);this._order.splice(d,1);let p=this._order.length;if(n){const m=this._order.indexOf(n);
vendor: 27,205 bytes, line 3325
3325if(m===-1)return void this.fire(new u.A(new Error(`Layer with id "${n}" does not exist on this map.`)));l.slot&&l.slot!==this._layers[n].slot?u.w(`Layer with id "${n}" has a different slot. Layers can only be rearranged within the same slot.`):p=m}this._order.splice(p,0,t),this._changes.setDirty(),this._handleLayerOrderChange(),this.mergeLayers()}removeLayer(t){this._checkLoaded();const n=this._checkLayer(t);if(!n)return;n.setEventedParent(null);const l=this._order.indexOf(t);this._order.splice(l,1),delete this._layers[t],this._changes.setDirty(),this._handleLayerOrderChange(),this._layerExpressionDependencies.delete(n.fqid),this._changes.removeLayer(n);const d=this.getOwnLayerSourceCache(n);if(d&&d.castsShadows){let p=!1;for(const m in this._layers)if(this._layers[m].source===n.source&&this._layers[m].canCastShadows()){p=!0;break}d.castsShadows=p}n.onRemove&&n.onRemove(this.map),this.mergeLayers()}getOwnLayer(t){return this._layers[t]}hasLayer(t){return t in this._mergedLayers}hasLayerType(t){for(const n in this._layers)if(this._layers[n].type===t)return!0;return!1}setLayerZoomRange(t,n,l){this._checkLoaded();const d=this._checkLayer(t);d&&(d.minzoom===n&&d.maxzoom===l||(n!=null&&(d.minzoom=n),l!=null&&(d.maxzoom=l),this._updateLayer(d)))}getSlots(){return this._checkLoaded(),this._mergedSlots}setSlot(t,n){this._checkLoaded();const l=this._checkLayer(t);l&&l.slot!==n&&(l.slot=n,this._updateLayer(l))}setFilter(t,n,l={}){this._checkLoaded();const d=this._checkLayer(t);if(!d||u.b5(d.filter,n))return;const p=this._layerExpressionDependencies.get(d.fqid);if(n==null)return d.filter=void 0,p&&p.invalidateFilter(),void this._updateLayer(d);this._validate(fc,`layers.${d.id}.filter`,n,{layerType:d.type},l)||(d.filter=u.ek(n),p&&p.invalidateFilter(),this._updateLayer(d))}getFilter(t){const n=this._checkLayer(t);if(n)return u.ek(n.filter)}setLayoutProperty(t,n,l,d={}){this._checkLoaded();const p=this._checkLayer(t);if(p&&!u.b5(p.getLayoutProperty(n),l)){if(l!=null&&(!d||d.validate!==!1)&&La(p,hs.call(Nr,{key:`layers.${t}.layout.${n}`,layerType:p.type,objectKey:n,value:l,styleSpec:u.m,style:{glyphs:!0,sprite:!0}})))return;p.setLayoutProperty(n,l),this._updateLayer(p)}}getLayerProperty(t,n){const l=this._checkLayer(t);if(l){switch(n){case"minzoom":return l.minzoom;case"maxzoom":return l.maxzoom;case"filter":return this.getFilter(t);case"slot":return l.slot;case"appearances":return l.getAppearances().map(d=>d.serialize())}return l.isPaintProperty(n)?this.getPaintProperty(t,n):this.getLayoutProperty(t,n)}}setLayerProperty(t,n,l,d={}){this._checkLoaded();const p=this._checkLayer(t);if(p){switch(n){case"appearances":return p.setAppearances(l),void this._updateLayer(p);case"minzoom":return this.setLayerZoomRange(t,l);case"maxzoom":return this.setLayerZoomRange(t,null,l);case"filter":return this.setFilter(t,l,d);case"slot":return this.setSlot(t,l)}p.isPaintProperty(n)?this.setPaintProperty(t,n,l,d):this.setLayoutProperty(t,n,l,d)}}getLayoutProperty(t,n){const l=this._checkLayer(t);if(l)return l.getLayoutProperty(n)}setPaintProperty(t,n,l,d={}){this._checkLoaded();const p=this._checkLayer(t);p&&(u.b5(p.getPaintProperty(n),l)||(l==null||d&&d.validate===!1||!La(p,Gp.call(Nr,{key:`layers.${t}.paint.${n}`,layerType:p.type,objectKey:n,value:l,styleSpec:u.m})))&&(p.setPaintProperty(n,l)&&this._updateLayer(p),this._changes.updatePaintProperties(p)))}getPaintProperty(t,n){const l=this._checkLayer(t);if(l)return l.getPaintProperty(n)}setFeatureState(t,n){if(this._checkLoaded(),"target"in t){if("featuresetId"in t.target){const{featuresetId:x,importId:w}=t.target,E=this.getFragmentStyle(w),A=E.getFeaturesetLayers(x);for(const{source:I,sourceLayer:M}of A)E.setFeatureState({id:t.id,source:I,sourceLayer:M},n)}else if("layerId"in t.target){const{layerId:x}=t.target,w=this.getLayer(x);this.setFeatureState({id:t.id,source:w.source,sourceLayer:w.sourceLayer},n)}return}const l=t.source,d=t.sourceLayer,p=this._checkSource(l);if(!p)return;const m=p.type;if(m==="geojson"&&d)return void this.fire(new u.A(new Error("GeoJSON sources cannot have a sourceLayer parameter.")));if(m==="vector"&&!d)return void this.fire(new u.A(new Error("The sourceLayer parameter must be provided for vector source types.")));t.id===void 0&&this.fire(new u.A(new Error("The feature id parameter must be provided.")));const g=this.getOwnSourceCaches(l);for(const x of g)x.setFeatureState(d,t.id,n)}removeFeatureState(t,n){if(this._checkLoaded(),"target"in t){if("featuresetId"in t.target){const{featuresetId:x,importId:w}=t.target,E=this.getFragmentStyle(w),A=E.getFeaturesetLayers(x);for(const{source:I,sourceLayer:M}of A)E.removeFeatureState({id:t.id,source:I,sourceLayer:M},n)}else if("layerId"in t.target){const{layerId:x}=t.target,w=this.getLayer(x);this.removeFeatureState({id:t.id,source:w.source,sourceLayer:w.sourceLayer},n)}return}const l=t.source,d=this._checkSource(l);if(!d)return;const p=d.type,m=p==="vector"?t.sourceLayer:void 0;if(p==="vector"&&!m)return void this.fire(new u.A(new Error("The sourceLayer parameter must be provided for vector source types.")));if(n&&typeof t.id!="string"&&typeof t.id!="number")return void this.fire(new u.A(new Error("A feature id is required to remove its specific state property.")));const g=this.getOwnSourceCaches(l);for(const x of g)x.removeFeatureState(m,t.id,n)}getFeatureState(t){if(this._checkLoaded(),"target"in t){let p;if("featuresetId"in t.target){const{featuresetId:m,importId:g}=t.target,x=this.getFragmentStyle(g),w=x.getFeaturesetLayers(m);for(const{source:E,sourceLayer:A}of w){const I=x.getFeatureState({id:t.id,source:E,sourceLayer:A});if(I&&!p)p=I;else if(!u.b5(p,I))return void this.fire(new u.A(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:m}=t.target,g=this.getLayer(m);p=this.getFeatureState({id:t.id,source:g.source,sourceLayer:g.sourceLayer})}return p}const n=t.source,l=t.sourceLayer,d=this._checkSource(n);if(d){if(d.type!=="vector"||l)return t.id===void 0&&this.fire(new u.A(new Error("The feature id parameter must be provided."))),this.getOwnSourceCaches(n)[0].getFeatureState(l,t.id);this.fire(new u.A(new Error("The sourceLayer parameter must be provided for vector source types.")))}}setTransition(t){return this.stylesheet.transition={...this.stylesheet.transition,...t},this.transition=this.stylesheet.transition,this}getTransition(){return{...this.stylesheet.transition}}setWorldview(t){t!==this._worldview&&(this._worldview=t,this.dispatcher.broadcast("upsertRenderParams",{worldview:this._worldview}),this.reloadSources())}serialize(){this._checkLoaded();const t=this.getTerrain(),n=t&&this.terrain&&this.terrain.scope===this.scope?t:this.stylesheet.terrain;return u.ep({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:n,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)},l=>l!==void 0)}_updateFilteredLayers(t){for(const n of Object.values(this._mergedLayers))t(n)&&this._updateLayer(n)}_updateLayer(t){this._changes.updateLayer(t);const n=this.getLayerSourceCache(t),l=u.y(t.source,t.scope),d=this._changes.getUpdatedSourceCaches();t.source&&!d[l]&&n&&n.getSource().type!=="raster"&&(this._changes.updateSourceCache(l,"reload"),n.pause()),t.invalidateCompiledFilter()}_flattenAndSortRenderedFeatures(t){const n=g=>this._mergedLayers[g].is3D(!!this.terrain),l=this.order,d={},p=[];for(let g=l.length-1;g>=0;g--){const x=l[g];if(n(x)){d[x]=g;for(const w of t){const E=w[x];if(E)for(const A of E)p.push(A)}}}p.sort((g,x)=>x.intersectionZ-g.intersectionZ);const m=[];for(let g=l.length-1;g>=0;g--){const x=l[g];if(n(x))for(let w=p.length-1;w>=0;w--){const E=p[w].feature;if(E.layer&&d[E.layer.id]<g)break;m.push(E),p.pop()}else for(const w of t){const E=w[x];if(E)for(const A of E)m.push(A.feature)}}return m}queryRasterValue(t,n,l){const d=this.getOwnSource(t);return d?d.type!=="raster-array"?(this.fire(new u.A(new Error('queryRasterValue support only "raster-array" sources.'))),Promise.resolve(null)):d.queryRasterArrayValue(n,l):(this.fire(new u.A(new Error(`Source with id "${t}" does not exist in the style.`))),Promise.resolve(null))}queryRenderedFeatures(t,n,l){let d;n&&!Array.isArray(n)&&n.filter&&(this._validate(fc,"queryRenderedFeatures.filter",n.filter,null,n),d=u.cU(n.filter));const p={},m=E=>{if(Fa.has(E.type))return;const A=this.getOwnLayerSourceCache(E),I=p[A.id]=p[A.id]||{sourceCache:A,layers:{},has3DLayers:!1};E.is3D(!!this.terrain)&&(I.has3DLayers=!0),I.layers[E.fqid]=I.layers[E.fqid]||{styleLayer:E,targets:[]},I.layers[E.fqid].targets.push({filter:d})};if(n&&n.layers){if(!Array.isArray(n.layers))return this.fire(new u.A(new Error("parameters.layers must be an Array."))),[];for(const E of n.layers){const A=this._layers[E];if(!A)return this.fire(new u.A(new Error(`The layer '${E}' does not exist in the map's style and cannot be queried for features.`))),[];m(A)}}else for(const E in this._layers)m(this._layers[E]);const g=this._queryRenderedFeatures(t,p,l),x=this._flattenAndSortRenderedFeatures(g),w=[];for(const E of x)u.dD(E.layer.id)===this.scope&&w.push(E);return w}queryRenderedFeatureset(t,n,l){let d;n&&!Array.isArray(n)&&n.filter&&(this._validate(fc,"queryRenderedFeatures.filter",n.filter,null,n),d=u.cU(n.filter));const p="mock",m=[];if(n&&n.target)m.push({...n,targetId:p,filter:d});else{const E=this.getFeaturesetDescriptors();for(const A of E)m.push({targetId:p,filter:d,target:A});for(const{style:A}of this.fragments){const I=A.getFeaturesetDescriptors();for(const M of I)m.push({targetId:p,filter:d,target:M})}}const g=this.queryRenderedTargets(t,m,l),x=[],w=new Set;for(const E of g)for(const A of E.variants[p])Cm(A,E,w)||x.push(new u.eq(E,A));return x}queryRenderedTargets(t,n,l){const d={},p=(g,x,w,E)=>{const A=d[x.id]=d[x.id]||{sourceCache:x,layers:{},has3DLayers:!1};if(A.layers[g.fqid]=A.layers[g.fqid]||{styleLayer:g,targets:[]},g.is3D(!!this.terrain)&&(A.has3DLayers=!0),!E)return w.uniqueFeatureID=!1,void A.layers[g.fqid].targets.push(w);A.layers[g.fqid].targets.push({...w,namespace:E.namespace,properties:E.properties,uniqueFeatureID:E.uniqueFeatureID})};for(const g of n)if("featuresetId"in g.target){const{featuresetId:x,importId:w}=g.target,E=this.getFragmentStyle(w);if(!E||!E._featuresetSelectors)continue;const A=E._featuresetSelectors[x];if(!A){this.fire(new u.A(new Error(`The featureset '${x}' does not exist in the map's style and cannot be queried for features.`)));continue}for(const I of A){const M=E.getOwnLayer(I.layerId);M&&!Fa.has(M.type)&&p(M,E.getOwnLayerSourceCache(M),g,I)}}else if("layerId"in g.target){const{layerId:x}=g.target,w=this.getLayer(x);if(!w||Fa.has(w.type))continue;p(w,this.getLayerSourceCache(w),g)}const m=this._queryRenderedFeatures(t,d,l);return this._flattenAndSortRenderedFeatures(m)}_queryRenderedFeatures(t,n,l){const d=[],p=!!this.map._showQueryGeometry,m=lh.createFromScreenPoints(t,l);for(const g in n){const x=Lg(m,n[g],this._availableImages,l,p,this.getActualScope());Object.keys(x).length&&d.push(x)}if(this.placement)for(const g in n){if(n[g].sourceCache._renderSourceType!==u.dz.Symbol)continue;const x=Dn(m.screenGeometry,n[g],this._availableImages,this.placement.collisionIndex,this.placement.retainedQueryData,this.map.getWorldview());Object.keys(x).length&&d.push(x)}return d}querySourceFeatures(t,n){const l=n&&n.filter;l&&this._validate(fc,"querySourceFeatures.filter",l,null,n);let d=[];const p=this.getOwnSourceCaches(t);for(const m of p)d=d.concat(af(m,n));return d}addSourceType(t,n,l){return ln.getSourceType(t)?l(new Error(`A source type called "${t}" already exists.`)):(ln.setSourceType(t,n),l(null,null))}getFlatLight(){return this.light.getLight()}setFlatLight(t,n,l={}){this._checkLoaded();const d=this.light.getLight();let p=!1;for(const g in t)if(!u.b5(t[g],d[g])){p=!0;break}if(!p)return;const m=this._getTransitionParameters();this.light.setLight(t,n,l),this.light.updateTransitions(m)}hasTerrain(){return!!this.terrain&&this.terrain.drapeRenderMode===1}getTerrain(){return this.hasTerrain()?this.terrain.get():null}setTerrainForDraping(){this.setTerrain({source:"",exaggeration:0},0)}checkCanvasFingerprintNoise(){this.disableElevatedTerrain===void 0&&(this.disableElevatedTerrain=u.r.hasCanvasFingerprintNoise(),this.disableElevatedTerrain&&u.w("Terrain and hillshade are disabled because of Canvas2D limitations when fingerprinting protection is enabled (e.g. in private browsing mode)."))}setTerrain(t,n=1){if(this._checkLoaded(),!t)return this.terrainSetForDrapingOnly()||(delete this.terrain,this.map.transform.projection.requiresDraping&&this.setTerrainForDraping()),n===0&&delete this.terrain,t===null?this.stylesheet.terrain=null:delete this.stylesheet.terrain,this._force3DLayerUpdate(),void(this._markersNeedUpdate=!0);this.checkCanvasFingerprintNoise();let l=t;const d=!("source"in t)||t.source==null;if(n===1){if(this.disableElevatedTerrain)return;if("source"in l&&typeof l.source=="object"){const g="terrain-dem-src";this.addSource(g,l.source),l=u.ek(l),l=Object.assign(l,{source:g})}const p={...l},m={};if(this.terrain&&d){p.source=this.terrain.get().source;const g=this.terrain?this.getFragmentStyle(this.terrain.scope):null;g&&(m.style=g.serialize())}if(this._validate(Np,"terrain",p,m))return}if(!this.terrain||this.terrain.scope!==this.scope&&!d||this.terrain&&n!==this.terrain.drapeRenderMode){if(!l)return;this._createTerrain(l,n),this.fire(new u.B("data",{dataType:"style"}))}else{const p=this.terrain,m=p.get();for(const g of Object.keys(u.m.terrain))!Object.hasOwn(l,g)&&u.m.terrain[g].default&&(l[g]=u.m.terrain[g].default);for(const g in t)if(!u.b5(t[g],m[g])){p.set(t,this.options),this.stylesheet.terrain=t;const x=this._getTransitionParameters({duration:0});p.updateTransitions(x),this.fire(new u.B("data",{dataType:"style"}));break}}this.mergeTerrain(),this.updateDrapeFirstLayers(),this._markersNeedUpdate=!0}_createFog(t){const n=this.fog=new xl(t,this.map.transform,this.scope,this.options);this.stylesheet.fog=n.get();const l=this._getTransitionParameters({duration:0});n.updateTransitions(l)}_createSnow(t){const n=this.snow=new Su(t,this.map.transform,this.scope,this.options);this.stylesheet.snow=n.get();const l=this._getTransitionParameters({duration:0});n.updateTransitions(l)}_createRain(t){const n=this.rain=new Iu(t,this.map.transform,this.scope,this.options);this.stylesheet.rain=n.get();const l=this._getTransitionParameters({duration:0});n.updateTransitions(l)}_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 n=this.fog;if(!u.b5(n.get(),t)){n.set(t,this.options),this.stylesheet.fog=n.get();const l=this._getTransitionParameters({duration:0});n.updateTransitions(l)}}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 n=this.snow;if(!u.b5(n.get(),t)){n.set(t,this.options),this.stylesheet.snow=n.get();const l=this._getTransitionParameters({duration:0});n.updateTransitions(l)}}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 n=this.rain;if(!u.b5(n.get(),t)){n.set(t,this.options),this.stylesheet.rain=n.get();const l=this._getTransitionParameters({duration:0});n.updateTransitions(l)}}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()},n=this._styleColorTheme.colorThemeOverride?this._styleColorTheme.colorThemeOverride:this._styleColorTheme.colorTheme;if(!n)return this._styleColorTheme.lut=null,void t();const l=this._evaluateColorThemeData(n);this._loadColorTheme(l).then(()=>{this.fire(new u.B("colorthemeset")),t()}).catch(d=>{u.w(`Couldn't set color theme: ${d}`)})}setColorTheme(t){this._checkLoaded(),this._styleColorTheme.colorThemeOverride&&u.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,n){const l=this.getFragmentStyle(t);l&&(l._styleColorTheme.colorThemeOverride=n,l._reloadColorTheme())}_getTransitionParameters(t){return{now:u.r.now(),transition:Object.assign(this.transition,t)}}updateDrapeFirstLayers(){if(!this.terrain)return;const t=[],n=[];for(const l of this._mergedOrder)this.isLayerDraped(this._mergedLayers[l])?t.push(l):n.push(l);this._drapedFirstOrder=[],this._drapedFirstOrder.push(...t),this._drapedFirstOrder.push(...n)}_createTerrain(t,n){const l=this.terrain=new Hp(t,n,this.scope,this.options,this.map.getWorldview());n===1&&(this.stylesheet.terrain=t),this.mergeTerrain(),this.updateDrapeFirstLayers(),this._force3DLayerUpdate();const d=this._getTransitionParameters({duration:0});l.updateTransitions(d)}_force3DLayerUpdate(){for(const t in this._layers){const n=this._layers[t];n.type==="fill-extrusion"&&this._updateLayer(n)}}_forceSymbolLayerUpdate(){for(const t in this._layers){const n=this._layers[t];n.type==="symbol"&&this._updateLayer(n)}}_validate(t,n,l,d,p={}){if(p&&p.validate===!1)return!1;const m={...this.serialize()};return La(this,t.call(Nr,{key:n,style:m,value:l,styleSpec:u.m,...d}))}_remove(){this._programPrecompiler&&(this._programPrecompiler.reset(),this._programPrecompiler=null),this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.abort(),this._spriteRequest=null),u.er.off("pluginStateChange",this._rtlTextPluginCallback);for(const t in this._mergedLayers)this._mergedLayers[t].setEventedParent(null);for(const t in this._mergedSourceCaches){const n=this._mergedSourceCaches[t];n.clearTiles(),n.setEventedParent(null);const l=n.getSource();l&&l.onRemove&&l.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&&this.indoorManager.destroy(),this.isRootStyle()&&(this.imageManager.setEventedParent(null),this.modelManager.setEventedParent(null),this.modelManager.destroy(),this.dispatcher.remove())}clearSource(t){const n=this.getSourceCaches(t);for(const l of n)l.clearTiles()}clearSources(){for(const t in this._mergedSourceCaches)this._mergedSourceCaches[t].clearTiles()}clearLayers(){for(const t in this._mergedLayers){const n=this._mergedLayers[t];n._clear&&n._clear()}}reloadSource(t){const n=this.getSourceCaches(t);for(const l of n)l.resume(),l.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 n;this.directionalLight&&(n=Jp(this.directionalLight));const l=new Set,d=new Set,p=new Set;for(const m in this._mergedLayers){const g=this._mergedLayers[m];g.type==="building"?l.add(g.source):g.type==="raster"&&g.paint&&g.paint.get("raster-elevation-reference")==="ground"&&p.add(g.source),g.hasElevation()&&!d.has(g.source)&&d.add(g.source)}this.updateFrcCoverageFadeRange();for(const m in this._mergedSourceCaches){const g=this._mergedSourceCaches[m],x=d.has(g._source.id);g._isRasterElevatedOverTerrain=p.has(g._source.id),l.has(g._source.id)&&(g._source.reparseOverscaled=!1),g.update(t,void 0,void 0,n,x)}this.updateFrcCoverage(),this.updateElevationCoverage(),Ft.markElevationIngestSourceCachesUsed&&Ft.markElevationIngestSourceCachesUsed(this)}_reloadSources(){for(const t in this._sourceCaches){const n=this._sourceCaches[t];n.resume(),n.reload()}}updateFrcCoverageFadeRange(){this.map.painter&&Ft.updateFrcCoverageFadeRange&&Ft.updateFrcCoverageFadeRange(this,this.map.painter)}updateFrcCoverage(){this._hdCoverage&&Ft.updateFrcCoverage&&Ft.updateFrcCoverage(this,this._hdCoverage)}updateElevationCoverage(){this.isRootStyle()&&Ft.setupAndUpdateElevationCoverage&&Ft.setupAndUpdateElevationCoverage(this)}_handleLayerOrderChange(){this._requestFullLabelPlacement(),this.fire(new u.B("neworder"))}_requestFullLabelPlacement(){this.pauseablePlacement||(this.pauseablePlacement=new ff),this.pauseablePlacement.requestFullPlacement()}_setLabelPlacementStale(){this.placement&&this.placement.setStale()}_updatePlacement(t,n,l,d,p,m){this.pauseablePlacement||(this.pauseablePlacement=new ff);let g=!1,x=!1;const w={},E={};for(const O of this._mergedOrder){const k=this._mergedLayers[O];if(k.type!=="symbol")continue;const q=u.y(k.source,k.scope);let $=w[q];if(!$){const Q=this.getLayerSourceCache(k);if(!Q)continue;const Y=Q.getRenderableIds(!0).map(ae=>Q.getTileByID(ae));E[q]=Y.slice(),$=w[q]=Y.sort((ae,W)=>W.tileID.overscaledZ-ae.tileID.overscaledZ||(ae.tileID.isLessThan(W.tileID)?-1:1))}const U=this.crossTileSymbolIndex.addLayer(k,$,t.center.lng,t.projection);g=g||U}this.crossTileSymbolIndex.pruneUnusedLayers(this._mergedOrder);const A=!!(this.placement&&!t.equals(this.placement.transform)),I=!!(this.placement&&(this.placement.lastReplacementSourceUpdateTime!==0&&!p||this.placement.lastReplacementSourceUpdateTime!==p.updateTime)),M=A||I||g,D=(M||this.pauseablePlacement.isStale())&&l===0,z=this.pauseablePlacement.isDone()&&!this.placement.stillRecent(u.r.now(),t.zoom)&&l!==0;if((this.pauseablePlacement.isFullPlacementRequested()||!this.pauseablePlacement.placement||D||z)&&(this.pauseablePlacement=this.pauseablePlacement.startNewPlacement(t,this._mergedOrder,n,l,d,this.placement,this.fog&&t.projection.supportsFog?this.fog.state:null,this._buildingIndex,m),this.map.painter)){const O=this.map.painter.maxFrontCutoffRawStart;if(O>0){const k=180*t.pitch/Math.PI;if(k>=15){const q=Math.min(1,Math.max(0,(k-15)/5)),$=q*q*(3-2*q);this.pauseablePlacement.placement.frontCutoffStart=-.5*(1-$)+O*$}}}if(this.pauseablePlacement.isDone()?M&&l!==0&&this.pauseablePlacement.setStale():(this.pauseablePlacement.continuePlacement(this._mergedOrder,this._mergedLayers,w,E,this.map.painter.scaleFactor),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(u.r.now()),x=!0),g&&this.pauseablePlacement.setStale()),x||g){this._buildingIndex.onNewFrame(t.zoom);for(let O=0;O<this._mergedOrder.length;O++){const k=this._mergedLayers[this._mergedOrder[O]];if(k.type!=="symbol"||k.visibility==="none")continue;const q=this.isLayerClipped(k);this.placement.updateLayerOpacities(k,w[u.y(k.source,k.scope)],O,q?p:null)}}return!this.pauseablePlacement.isDone()||this.placement.isStale()||this.placement.hasTransitions(u.r.now())}_releaseSymbolFadeTiles(){for(const t in this._sourceCaches)this._sourceCaches[t].releaseSymbolFadeTiles()}addImport(t,n){this._checkLoaded();const l=this.stylesheet.imports=this.stylesheet.imports||[];if(l.findIndex(({id:p})=>p===t.id)!==-1)return void this.fire(new u.A(new Error(`Import with id '${t.id}' already exists in the map's style.`)));if(!n)return l.push(t),this._loadImports([t],!0);const d=l.findIndex(({id:p})=>p===n);return d===-1&&this.fire(new u.A(new Error(`Import with id "${n}" does not exist on this map.`))),this.stylesheet.imports=l.slice(0,d).concat(t).concat(l.slice(d)),this._loadImports([t],!0,n)}updateImport(t,n){this._checkLoaded();const l=this.stylesheet.imports||[],d=this.getImportIndex(t);return d===-1?this:typeof n=="string"?(this.setImportUrl(t,n),this):(n.url&&n.url!==l[d].url&&this.setImportUrl(t,n.url),u.b5(n.config,l[d].config)||this.setImportConfig(t,n.config,n.data.schema),u.b5(n.data,l[d].data)||this.setImportData(t,n.data),this)}moveImport(t,n){this._checkLoaded();let l=this.stylesheet.imports||[];const d=this.getImportIndex(t);if(d===-1)return this;const p=this.getImportIndex(n);if(p===-1)return this;const m=l[d],g=this.fragments[d];return l=l.filter(({id:x})=>x!==t),this.fragments=this.fragments.filter(({id:x})=>x!==t),this.stylesheet.imports=l.slice(0,p).concat(m).concat(l.slice(p)),this.fragments=this.fragments.slice(0,p).concat(g).concat(this.fragments.slice(p)),this.mergeLayers(),this}setImportUrl(t,n){this._checkLoaded();const l=this.stylesheet.imports||[],d=this.getImportIndex(t);if(d===-1)return this;l[d].url=n;const p=this.fragments[d];return p.style=this._createFragmentStyle(l[d]),p.style.on("style.import.load",()=>this.mergeAll()),p.style.loadURL(n),this}setImportData(t,n){this._checkLoaded();const l=this.getImportIndex(t),d=this.stylesheet.imports||[];return l===-1?this:n?(this.fragments[l].style.setState(n),this._reloadImports(),this):(delete d[l].data,this.setImportUrl(t,d[l].url))}setImportConfig(t,n,l){this._checkLoaded();const d=this.getImportIndex(t),p=this.stylesheet.imports||[];if(d===-1)return this;n?p[d].config=n:delete p[d].config;const m=this.fragments[d];l&&m.style.stylesheet&&(m.style.stylesheet.schema=l);const g=m.style.stylesheet&&m.style.stylesheet.schema;return m.config=n,m.style.updateConfig(n,g),this.updateConfigDependencies(),this}removeImport(t){this._checkLoaded();const n=this.stylesheet.imports||[],l=this.getImportIndex(t);l!==-1&&(n.splice(l,1),this.fragments[l].style._remove(),this.fragments.splice(l,1),this._reloadImports())}getImportIndex(t){const n=(this.stylesheet.imports||[]).findIndex(l=>l.id===t);return n===-1&&this.fire(new u.A(new Error(`Import '${t}' does not exist in the map's style and cannot be updated.`))),n}getLayer(t){return this._mergedLayers[t]}getSources(){const t=[];for(const n in this._mergedOtherSourceCaches){const l=this._mergedOtherSourceCaches[n];l&&t.push(l.getSource())}return t}getSource(t,n){const l=this.getSourceCache(t,n);return l&&l.getSource()}getLayerSource(t){const n=this.getLayerSourceCache(t);return n&&n.getSource()}getSourceCache(t,n){const l=u.y(t,n);return this._mergedOtherSourceCaches[l]}getLayerSourceCache(t){const n=u.y(t.source,t.scope);return t.type==="symbol"?this._mergedSymbolSourceCaches[n]:t.type==="fill-extrusion"?this._mergedFillExtrusionSourceCaches[n]||this._mergedOtherSourceCaches[n]:t.type==="fill"&&t.sourceLayer===u.dB&&this._mergedHdRoa
3325dCoverageSourceCaches[n]?this._mergedHdRoadCoverageSourceCaches[n]:this._mergedOtherSourceCaches[n]}getSourceCaches(t){if(t==null)return Object.values(this._mergedSourceCaches);const n=[];return this._mergedOtherSourceCaches[t]&&n.push(this._mergedOtherSourceCaches[t]),this._mergedSymbolSourceCaches[t]&&n.push(this._mergedSymbolSourceCaches[t]),this._mergedFillExtrusionSourceCaches[t]&&n.push(this._mergedFillExtrusionSourceCaches[t]),this._mergedHdRoadCoverageSourceCaches[t]&&n.push(this._mergedHdRoadCoverageSourceCaches[t]),this._mergedHdRoadElevationSourceCaches[t]&&n.push(this._mergedHdRoadElevationSourceCaches[t]),n}updateSourceCaches(){const t=this._changes.getUpdatedSourceCaches();for(const n in t){const l=t[n];l==="reload"?this.reloadSource(n):l==="clear"&&this.clearSource(n)}}updateLayers(t){const n=this._changes.getUpdatedPaintProperties();for(const l of n){const d=this.getLayer(l);d&&d.updateTransitions(t)}}getGlyphsUrl(){return this.stylesheet.glyphs}setGlyphsUrl(t){this.stylesheet.glyphs=t,this.glyphManager.setURL(t)}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 n=[];return this._otherSourceCaches[t]&&n.push(this._otherSourceCaches[t]),this._symbolSourceCaches[t]&&n.push(this._symbolSourceCaches[t]),this._fillExtrusionSourceCaches[t]&&n.push(this._fillExtrusionSourceCaches[t]),this._hdCoverage&&this._hdCoverage.coverageSourceCaches[t]&&n.push(this._hdCoverage.coverageSourceCaches[t]),this._hdElevation&&this._hdElevation.elevationSourceCaches[u.y(t,this.scope)]&&n.push(this._hdElevation.elevationSourceCaches[u.y(t,this.scope)]),n}_updateHdCoverageSourceCache(t){return Ft.HdCoverageState&&Ft.updateHdCoverageSourceCache?(this._hdCoverage||(this._hdCoverage=new Ft.HdCoverageState),Ft.updateHdCoverageSourceCache(this,this._hdCoverage,t),!1):t.type==="fill"&&t.sourceLayer===u.dB}_isSourceCacheLoaded(t){const n=this.getOwnSourceCaches(t);return n.length===0?(this.fire(new u.A(new Error(`There is no source with ID '${t}'`))),!1):n.every(l=>l.loaded())}has3DLayers(){return this._has3DLayers}hasSymbolLayers(){return this._hasSymbolLayers}hasCircleLayers(){return this._hasCircleLayers}isLayerClipped(t,n){if(!this._clipLayerPresent&&t.type!=="fill-extrusion"&&t.type!=="building")return!1;const l=t.type==="fill-extrusion"&&(t.sourceLayer==="building"||t.sourceLayer==="procedural_buildings"),d=t.type==="building";if(t.is3D(!!this.terrain)){if(l||d||n&&n.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)}async getImages(t,n){const l=new Promise((x,w)=>{this.imageManager.getImages(n.icons.concat(n.patterns),n.scope,(E,A)=>{E?w(E):x(A)})});this._updateTilesForChangedImages();const d=n.icons.map(x=>u.I.toString(x)),p=n.patterns.map(x=>u.I.toString(x)),m=x=>{x&&(x.setDependencies(n.tileID.key,"icons",d),x.setDependencies(n.tileID.key,"patterns",p))},g=u.y(n.source,n.scope);return m(this._mergedOtherSourceCaches[g]),m(this._mergedSymbolSourceCaches[g]),(n.icons.some(x=>x.iconsetId)||n.patterns.some(x=>x.iconsetId))&&this.fire(new u.B("data",{dataType:"style"})),l}async rasterizeImages(t,n){return new Promise((l,d)=>{this.imageManager.rasterizeImages(n,(p,m)=>{p?d(p):l(m)})})}async checkAtlasCache(t,n){const l=this.imageManager.imageAtlasCache.findCachedAtlas(n.descriptor);return l&&l.contentDescriptor?{iconPositions:l.iconPositions,patternPositions:l.patternPositions,sourceHash:l.contentDescriptor.hash}:null}async getGlyphs(t,n){return new Promise((l,d)=>{this.glyphManager.getGlyphs(n.stacks,(p,m)=>{p?d(p):l(m)})})}}ln.getSourceType=function(s){return hh[s]},ln.setSourceType=function(s,t){hh[s]=t},ln.registerForPluginStateChange=u.es;class Um{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffers=[],this.vao=null}bind(t,n,l,d,p,m,g,x){this.context=t;let w=this.boundPaintVertexBuffers.length!==d.length;for(let A=0;!w&&A<d.length;A++)this.boundPaintVertexBuffers[A]!==d[A]&&(w=!0);let E=this.boundDynamicVertexBuffers.length!==g.length;for(let A=0;!E&&A<g.length;A++)this.boundDynamicVertexBuffers[A]!==g[A]&&(E=!0);if(!this.vao||this.boundProgram!==n||this.boundLayoutVertexBuffer!==l||w||E||this.boundIndexBuffer!==p||this.boundVertexOffset!==m)this.freshBind(n,l,d,p,m,g,x);else{t.bindVertexArrayOES.set(this.vao);for(const A of g)A&&(A.bind(),x&&A.instanceCount&&A.setVertexAttribDivisor(t.gl,n,x));p&&p.dynamicDraw&&p.bind()}}
vendor: 94,645 bytes, lines 3325-3330
3325freshBind(t,n,l,d,p,m,g){const x=this.context,w=x.gl;this.vao&&this.destroy(),this.vao=x.gl.createVertexArray(),x.bindVertexArrayOES.set(this.vao),this.boundProgram=t,this.boundLayoutVertexBuffer=n,this.boundPaintVertexBuffers=l,this.boundIndexBuffer=d,this.boundVertexOffset=p,this.boundDynamicVertexBuffers=m,n.enableAttributes(w,t),n.bind(),n.setVertexAttribPointers(w,t,p);for(const E of l)E.enableAttributes(w,t),E.bind(),E.setVertexAttribPointers(w,t,p);for(const E of m)E&&(E.enableAttributes(w,t),E.bind(),E.setVertexAttribPointers(w,t,p),g&&E.instanceCount&&E.setVertexAttribDivisor(w,t,g));d&&d.bind()}destroy(){this.vao&&(this.context.gl.deleteVertexArray(this.vao),this.vao=null)}}function gh(s,t){const n=Math.pow(2,t.canonical.z),l=t.canonical.y;return[new u.ac(0,l/n).toLngLat().lat,new u.ac(0,(l+1)/n).toLngLat().lat]}function yh(s,t,n,l,d,p,m){const g=s.context,x=g.gl,w=n.hillshadeFBO;if(!w)return;s.prepareDrawTile();const E=s.isTileAffectedByFog(t),A=[];s.terrain&&s.terrain.renderingToTexture&&s.emissiveMode==="mrt-fallback"&&A.push("USE_MRT1");const I=s.getOrCreateProgram("hillshade",{overrideFog:E,defines:A});g.activeTexture.set(x.TEXTURE0),x.bindTexture(x.TEXTURE_2D,w.colorAttachment0.get());const M=((k,q,$,U)=>{const Q=$.paint.get("hillshade-shadow-color"),Y=$.paint.get("hillshade-shadow-color-use-theme").constantOr("default")==="none",ae=$.paint.get("hillshade-highlight-color"),W=$.paint.get("hillshade-highlight-color-use-theme").constantOr("default")==="none",J=$.paint.get("hillshade-accent-color"),se=$.paint.get("hillshade-accent-color-use-theme").constantOr("default")==="none",ue=$.paint.get("hillshade-emissive-strength");let he=u.al($.paint.get("hillshade-illumination-direction"));if($.paint.get("hillshade-illumination-anchor")==="viewport")he-=k.transform.angle;else if(k.style&&k.style.enable3dLights()&&k.style.directionalLight){const xe=k.style.directionalLight.properties.get("direction"),Le=u.c5(xe.x,xe.y,xe.z);he=u.al(Le[1])}const ve=!k.options.moving;return{u_matrix:U||k.transform.calculateProjMatrix(q.tileID.toUnwrapped(),ve),u_image:0,u_latrange:gh(0,q.tileID),u_light:[$.paint.get("hillshade-exaggeration"),he],u_shadow:Q.toPremultipliedRenderColor(Y?null:$.lut),u_highlight:ae.toPremultipliedRenderColor(W?null:$.lut),u_emissive_strength:ue,u_accent:J.toPremultipliedRenderColor(se?null:$.lut)}})(s,n,l,s.terrain?t.projMatrix:null);s.uploadCommonUniforms(g,I,t.toUnwrapped());const{tileBoundsBuffer:D,tileBoundsIndexBuffer:z,tileBoundsSegments:O}=s.getTileBoundsBuffers(n);I.draw(s,x.TRIANGLES,d,p,m,pt.disabled,M,l.id,D,z,O)}function Hl(s,t,n){if(!t.needsDEMTextureUpload)return;const l=s.context,d=l.gl;l.pixelStoreUnpackPremultiplyAlpha.set(!1),t.demTexture=t.demTexture||s.getTileTexture(n.stride);const p=n.getPixels();t.demTexture?t.demTexture.update(p,{premultiply:!1}):t.demTexture=new u.T(l,p,d.R32F,{premultiply:!1}),t.needsDEMTextureUpload=!1}function jm(s,t,n){const l=s.context,d=l.gl;if(!t.dem)return;const p=t.dem;if(l.activeTexture.set(d.TEXTURE1),Hl(s,t,p),!t.demTexture)return;t.demTexture.bind(d.NEAREST,d.CLAMP_TO_EDGE);const m=p.dim;l.activeTexture.set(d.TEXTURE0);let g=t.hillshadeFBO;if(!g){const I=new u.T(l,{width:m,height:m,data:null},d.RGBA8);I.bind(d.LINEAR,d.CLAMP_TO_EDGE),g=t.hillshadeFBO=l.createFramebuffer(m,m,1,"renderbuffer"),g.colorAttachment0.set(I.texture)}l.bindFramebuffer.set(g.framebuffer),l.viewport.set([0,0,m,m]);const{tileBoundsBuffer:x,tileBoundsIndexBuffer:w,tileBoundsSegments:E}=s.getMercatorTileBoundsBuffers(),A=[];s.linearFloatFilteringSupported()&&A.push("TERRAIN_DEM_FLOAT_FORMAT"),s.terrain&&s.terrain.renderingToTexture&&s.emissiveMode==="mrt-fallback"&&A.push("USE_MRT1"),s.getOrCreateProgram("hillshadePrepare",{defines:A}).draw(s,d.TRIANGLES,nt.disabled,lt.disabled,dt.unblended,pt.disabled,((I,M)=>{const D=M.stride,z=u.aS();return u.aK(z,0,u.aj,-u.aj,0,0,1),u.aG(z,z,[0,-u.aj,0]),{u_matrix:z,u_image:1,u_dimension:[D,D],u_zoom:I.overscaledZ}})(t.tileID,p),n.id,x,w,E),t.needsHillshadePrepare=!1}class Mi{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 jc extends Mi{getDefault(){return u.C.transparent.toNonPremultipliedRenderColor(null)}set(t){const n=this.current;(t.r!==n.r||t.g!==n.g||t.b!==n.b||t.a!==n.a||this.dirty)&&(this.gl.clearColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class _f extends Mi{getDefault(){return 1}set(t){(t!==this.current||this.dirty)&&(this.gl.clearDepth(t),this.current=t,this.dirty=!1)}}class Gm extends Mi{getDefault(){return 0}set(t){(t!==this.current||this.dirty)&&(this.gl.clearStencil(t),this.current=t,this.dirty=!1)}}class gf extends Mi{getDefault(){return[!0,!0,!0,!0]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||t[2]!==n[2]||t[3]!==n[3]||this.dirty)&&(this.gl.colorMask(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class yf extends Mi{getDefault(){return!0}set(t){(t!==this.current||this.dirty)&&(this.gl.depthMask(t),this.current=t,this.dirty=!1)}}class cn extends Mi{getDefault(){return 255}set(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1)}}class Oa extends Mi{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(t){const n=this.current;(t.func!==n.func||t.ref!==n.ref||t.mask!==n.mask||this.dirty)&&(this.gl.stencilFunc(t.func,t.ref,t.mask),this.current=t,this.dirty=!1)}}class xf extends Mi{getDefault(){const t=this.gl;return[t.KEEP,t.KEEP,t.KEEP]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||t[2]!==n[2]||this.dirty)&&(this.gl.stencilOp(t[0],t[1],t[2]),this.current=t,this.dirty=!1)}}class ao extends Mi{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.STENCIL_TEST):n.disable(n.STENCIL_TEST),this.current=t,this.dirty=!1}}class lo extends Mi{getDefault(){return[0,1]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||this.dirty)&&(this.gl.depthRange(t[0],t[1]),this.current=t,this.dirty=!1)}}class $l extends Mi{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.DEPTH_TEST):n.disable(n.DEPTH_TEST),this.current=t,this.dirty=!1}}class Ba extends Mi{getDefault(){return this.gl.LESS}set(t){(t!==this.current||this.dirty)&&(this.gl.depthFunc(t),this.current=t,this.dirty=!1)}}class Zl extends Mi{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.BLEND):n.disable(n.BLEND),this.current=t,this.dirty=!1}}class vf extends Mi{getDefault(){const t=this.gl;return[t.ONE,t.ZERO,t.ONE,t.ZERO]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||t[2]!==n[2]||t[3]!==n[3]||this.dirty)&&(this.gl.blendFuncSeparate(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class Kt extends Mi{getDefault(){return u.C.transparent.toNonPremultipliedRenderColor(null)}set(t){const n=this.current;(t.r!==n.r||t.g!==n.g||t.b!==n.b||t.a!==n.a||this.dirty)&&(this.gl.blendColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class Qs extends Mi{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 bf extends Mi{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.CULL_FACE):n.disable(n.CULL_FACE),this.current=t,this.dirty=!1}}class un extends Mi{getDefault(){return this.gl.BACK}set(t){(t!==this.current||this.dirty)&&(this.gl.cullFace(t),this.current=t,this.dirty=!1)}}class wf extends Mi{getDefault(){return this.gl.CCW}set(t){(t!==this.current||this.dirty)&&(this.gl.frontFace(t),this.current=t,this.dirty=!1)}}let co=class extends Mi{getDefault(){return null}set(s){(s!==this.current||this.dirty)&&(this.gl.useProgram(s),this.current=s,this.dirty=!1)}};class qm extends Mi{getDefault(){return this.gl.TEXTURE0}set(t){(t!==this.current||this.dirty)&&(this.gl.activeTexture(t),this.current=t,this.dirty=!1)}}class ka extends Mi{getDefault(){const t=this.gl;return[0,0,t.drawingBufferWidth,t.drawingBufferHeight]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||t[2]!==n[2]||t[3]!==n[3]||this.dirty)&&(this.gl.viewport(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class Hm extends Mi{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindFramebuffer(n.FRAMEBUFFER,t),this.current=t,this.dirty=!1}}class zn extends Mi{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindRenderbuffer(n.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class Jr extends Mi{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindTexture(n.TEXTURE_2D,t),this.current=t,this.dirty=!1}}class Tf extends Mi{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindBuffer(n.ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class $m extends Mi{getDefault(){return null}set(t){const n=this.gl;n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class Ef extends Mi{getDefault(){return null}set(t){this.gl&&(t!==this.current||this.dirty)&&(this.gl.bindVertexArray(t),this.current=t,this.dirty=!1)}}class Gg extends Mi{getDefault(){return 4}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.pixelStorei(n.UNPACK_ALIGNMENT,t),this.current=t,this.dirty=!1}}class Sf extends Mi{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t),this.current=t,this.dirty=!1}}class Zm extends Mi{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,t),this.current=t,this.dirty=!1}}class If extends Mi{constructor(t,n){super(t),this.context=t,this.parent=n}getDefault(){return null}}class xn extends If{constructor(t,n,l=0){super(t,n),this.attachmentPoint=t.gl.COLOR_ATTACHMENT0+l}setDirty(){this.dirty=!0}set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const n=this.gl;n.framebufferTexture2D(n.FRAMEBUFFER,this.attachmentPoint,n.TEXTURE_2D,t,0),this.current=t,this.dirty=!1}}class uo extends If{attachment(){return this.gl.DEPTH_ATTACHMENT}set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const n=this.gl;n.framebufferRenderbuffer(n.FRAMEBUFFER,this.attachment(),n.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class qg extends If{attachment(){return this.gl.DEPTH_ATTACHMENT}set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const n=this.gl;n.framebufferTexture2D(n.FRAMEBUFFER,this.attachment(),n.TEXTURE_2D,t,0),this.current=t,this.dirty=!1}}class Gc extends uo{attachment(){return this.gl.DEPTH_STENCIL_ATTACHMENT}}const Hg=(s,t,n,l)=>({u_matrix:s,u_image0:0,u_image1:1,u_skirt_height:t,u_ground_shadow_factor:n,u_emissive_texture_available:l}),_i=(s,t,n,l,d,p,m,g,x,w,E,A,I,M,D,z,O)=>({u_proj_matrix:Float32Array.from(s),u_globe_matrix:t,u_normalize_matrix:Float32Array.from(l),u_merc_matrix:n,u_zoom_transition:d,u_merc_center:p,u_image0:0,u_image1:1,u_frustum_tl:m,u_frustum_tr:g,u_frustum_br:x,u_frustum_bl:w,u_globe_pos:E,u_globe_radius:A,u_viewport:I,u_grid_matrix:O?Float32Array.from(O):new Float32Array(9),u_skirt_height:M,u_far_z_cutoff:D,u_emissive_texture_available:z});function zt(s,t){return s!=null&&t!=null&&!(!s.hasData()||!t.hasData())&&s.demTexture!=null&&t.demTexture!=null&&s.tileID.key!==t.tileID.key}const Na=new class{constructor(){this.operations={}}newMorphing(s,t,n,l,d){if(s in this.operations){const p=this.operations[s];p.to.tileID.key!==n.tileID.key&&(p.queued=n)}else this.operations[s]={startTime:l,phase:0,duration:d,from:t,to:n,queued:null}}getMorphValuesForProxy(s){if(!(s in this.operations))return null;const t=this.operations[s];return{from:t.from,to:t.to,phase:t.phase}}update(s){for(const t in this.operations){const n=this.operations[t];for(n.phase=(s-n.startTime)/n.duration;n.phase>=1||!this._validOp(n);)if(!this._nextOp(n,s)){delete this.operations[t];break}}}_nextOp(s,t){return!!s.queued&&(s.from=s.to,s.to=s.queued,s.queued=null,s.phase=0,s.startTime=t,!0)}_validOp(s){return s.from.hasData()&&s.to.hasData()}};function Es(s,t,n){if(t===0)return 0;const l=t<1&&n===514?.25/t:1;return 6*Math.pow(1.5,22-s)*Math.max(t,1)*l}function Wl(s,t){const n=1<<s.z;return!t&&(s.x===0||s.x===n-1)||s.y===0||s.y===n-1}function qc(s,t){if(!s.style||!s.style.enable3dLights())return;const n=s.context,l=n.gl;n.activeTexture.set(l.TEXTURE1),t?t.bind(l.LINEAR,l.CLAMP_TO_EDGE):s.emptyTexture.bind(l.LINEAR,l.CLAMP_TO_EDGE)}class Ko extends sn{constructor(t){const n={type:"raster-dem",maxzoom:Math.ceil(t.transform.maxZoom)},l=of("mock-dem",n,t.style.dispatcher,t.style);super("mock-dem",l,null),l.setEventedParent(this),this._sourceLoaded=!0}_loadTile(t,n){t.state="loaded",n(null)}}class Af extends sn{constructor(t){const n=of("proxy",{type:"geojson",maxzoom:Math.ceil(t.transform.maxZoom)},t.style.dispatcher,t.style);super("proxy",n,null),n.setEventedParent(this),this.map=this.getSource().map=t,this.used=this._sourceLoaded=!0,this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}update(t,n,l){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((p,m)=>{if(p[m.key]="",!this._tiles[m.key]){const g=new zl(m,this._source.tileSize*m.overscaleFactor(),t.tileZoom,void 0,void 0,this._source.worldview);g.state="loaded",this._tiles[m.key]=g}return p},{});for(const p in this._tiles)p in d||(this.freeFBO(p),this._tiles[p].unloadVectorData(),delete this._tiles[p])}freeFBO(t){const n=this.proxyCachedFBO[t];if(n!==void 0){const l=Object.values(n);this.renderCachePool.push(...l),delete this.proxyCachedFBO[t]}}deallocRenderCache(){this.renderCache.forEach(t=>t.fb.destroy()),this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}}class xh extends u.bp{constructor(t,n,l){super(t.overscaledZ,t.wrap,t.canonical.z,t.canonical.x,t.canonical.y),this.proxyTileKey=n,this.projMatrix=l}}class vh extends u.e6{constructor(t,n){super(),this.painter=t,this.terrainTileForTile={},this.prevTerrainTileForTile={};const[l,d,p]=(function(){const x=new u.co,w=new u.cp,E=131;x.reserve(17161),w.reserve(33800);const A=u.aj/128,I=u.aj+A/2,M=I+A;for(let z=-A;z<M;z+=A)for(let O=-A;O<M;O+=A){const k=O<0||O>I||z<0||z>I?24575:0,q=u.as(Math.round(O),0,u.aj),$=u.as(Math.round(z),0,u.aj);x.emplaceBack(q+k,$)}const D=(z,O)=>{const k=O*E+z;w.emplaceBack(k+1,k,k+E),w.emplaceBack(k+E,k+E+1,k+1)};for(let z=1;z<129;z++)for(let O=1;O<129;O++)D(O,z);return[0,129].forEach(z=>{for(let O=0;O<130;O++)D(O,z),D(z,O)}),[x,w,32768]})(),m=t.context;this.gridBuffer=m.createVertexBuffer(l,u.cq.members),this.gridIndexBuffer=m.createIndexBuffer(d),this.gridSegments=u.cr.simpleSegment(0,0,l.length,d.length),this.gridNoSkirtSegments=u.cr.simpleSegment(0,0,l.length,p),this.proxyCoords=[],this.proxiedCoords={},this._visibleDemTiles=[],this._drapedRenderBatches=[],this._sourceTilesOverlap={},this.proxySourceCache=new Af(n.map),this.orthoMatrix=u.aS(),u.aK(this.orthoMatrix,this.painter.transform.projection.name==="globe"?.015:0,u.aj,0,u.aj,0,1);const g=m.gl;this._overlapStencilMode=new lt({func:g.GEQUAL,mask:255},0,255,g.KEEP,g.KEEP,g.REPLACE),this._previousZoom=t.transform.zoom,this.pool=[],this._findCoveringTileCache={},this._tilesDirty={},this.style=n,this._useVertexMorphing=!0,this._exaggeration=1,this._mockSourceCache=new Ko(n.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,n,l){if(t&&t.terrain){this._style!==t&&(this.style=t,this._evaluationZoom=void 0);const d=t.terrain.properties,p=t.terrain.drapeRenderMode===0,m=t.terrain.isZoomDependent();this._previousUpdateTimestamp=this.enabled?this._updateTimestamp:void 0,this._updateTimestamp=u.r.now();const g=t.terrain&&t.terrain.scope,x=d.get("source"),w=p?this._mockSourceCache:t.getSourceCache(x,g);if(!w)return void u.w(`Couldn't find terrain source "${x}".`);if(this.sourceCache=w,this._attenuationRange=t.terrain.getAttenuationRange(),this._exaggeration=m?this.calculateExaggeration(n):d.get("exaggeration"),!n.projection.requiresDraping&&m&&this._exaggeration===0)return void this._disable();this.enabled=!0;const E=()=>{this.sourceCache.used&&u.w(`Raster DEM source '${this.sourceCache.id}' is used both for terrain and as layer source.
3326This leads to lower resolution of hillshade. For full hillshade resolution but higher memory consumption, define another raster DEM source.`);const A=this.getScaledDemTileSize();this.sourceCache.update(n,A,!0),this.resetTileLookupCache(this.sourceCache.id)};this.sourceCache.usedForTerrain||(this.resetTileLookupCache(this.sourceCache.id),this.sourceCache.usedForTerrain=!0,E(),this._initializing=!0),E(),n.updateElevation(!0,l),this.resetTileLookupCache(this.proxySourceCache.id),this.proxySourceCache.update(n),this._emptyDEMTextureDirty=!0,this._previousZoom=n.zoom}else this._disable()}calculateExaggeration(t){if(this._attenuationRange&&t.zoom>=Math.ceil(this._attenuationRange[1]))return this._style.terrain.getExaggeration(t.zoom);const n=this._previousCameraAltitude,l=t.getFreeCameraOptions().position.z/t.pixelsPerMeter*t.worldSize;this._previousCameraAltitude=l;const d=n!=null?l-n:Number.MAX_VALUE;if(Math.abs(d)<2)return this._exaggeration;const p=t.zoom,m=this._style.terrain;if(!this._previousUpdateTimestamp)return m.getExaggeration(p);let g=p-this._previousZoom;const x=this._previousUpdateTimestamp;let w=p;this._evaluationZoom!=null&&(w=this._evaluationZoom,Math.abs(p-w)>.5&&(g=.5*(p-w+g)),g*d<0&&(w+=g)),this._evaluationZoom=w;const E=m.getExaggeration(w),A=E===m.getExaggeration(Math.max(0,w-.1));if(A&&Math.abs(E-this._exaggeration)<.01)return E;let I=Math.min(.1,.00375*(this._updateTimestamp-x));return(A||E<.1||Math.abs(g)<1e-4)&&(I=Math.min(.2,4*I)),u.ai(this._exaggeration,E,I)}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 n=this.proxySourceCache,l=this.painter.transform;this._initializing&&(this._initializing=l._centerAltitude===0&&this.getAtPointOrZero(u.ac.fromLngLat(l.center),-1)===-1,this._emptyDEMTextureDirty=!this._initializing);const d=this.proxyCoords=n.getIds().map(x=>{const w=n.getTileByID(x).tileID;return w.projMatrix=l.calculateProjMatrix(w.toUnwrapped()),w});(function(x,w){const E=w.transform.pointCoordinate(w.transform.getCameraPoint()),A=new u.P(E.x,E.y);x.sort((I,M)=>{if(M.overscaledZ-I.overscaledZ)return M.overscaledZ-I.overscaledZ;const D=new u.P(I.canonical.x+(1<<I.canonical.z)*I.wrap,I.canonical.y),z=new u.P(M.canonical.x+(1<<M.canonical.z)*M.wrap,M.canonical.y),O=A.mult(1<<I.canonical.z);return O.x-=.5,O.y-=.5,O.distSqr(D)-O.distSqr(z)})})(d,this.painter);const p=this.proxyToSource||{};this.proxyToSource={},d.forEach(x=>{this.proxyToSource[x.key]={}}),this.terrainTileForTile={};const m=this._style._mergedSourceCaches;for(const x in m){const w=m[x];if(!w.used||!w.transform||(w!==this.sourceCache&&this.resetTileLookupCache(w.id),this._setupProxiedCoordsForOrtho(w,t[x],p),w.usedForTerrain))continue;const E=t[x];(w.getSource().reparseOverscaled||w._isRasterElevatedOverTerrain)&&this._assignTerrainTiles(E)}this.proxiedCoords[n.id]=d.map(x=>new xh(x,x.key,this.orthoMatrix)),this._assignTerrainTiles(d),this._prepareDEMTextures(),this._setupDrapedRenderBatches(),this._initFBOPool(),this._setupRenderCache(p),this.renderingToTexture=!1;const g={};this._visibleDemTiles=[];for(const x of this.proxyCoords){const w=this.terrainTileForTile[x.key];if(!w)continue;const E=w.tileID.key;E in g||(this._visibleDemTiles.push(w),g[E]=E)}}_assignTerrainTiles(t){this._initializing||t.forEach(n=>{if(this.terrainTileForTile[n.key])return;const l=this._findTileCoveringTileID(n,this.sourceCache);l&&(this.terrainTileForTile[n.key]=l)})}_prepareDEMTextures(){const t=this.painter.context,n=t.gl;for(const l in this.terrainTileForTile){const d=this.terrainTileForTile[l],p=d.dem;!p||d.demTexture&&!d.needsDEMTextureUpload||(t.activeTexture.set(n.TEXTURE1),Hl(this.painter,d,p))}}_prepareDemTileUniforms(t,n,l,d){if(!n||n.demTexture==null)return!1;const p=t.tileID.canonical,m=Math.pow(2,n.tileID.canonical.z-p.z),g=d||"";return l[`u_dem_tl${g}`]=[p.x*m%1,p.y*m%1],l[`u_dem_scale${g}`]=m,!0}get emptyDEMTexture(){return!this._emptyDEMTextureDirty&&this._emptyDEMTexture?this._emptyDEMTexture:this._updateEmptyDEMTexture()}_getLoadedAreaMinimum(){if(!this.enabled)return 0;let t=0;const n=this._visibleDemTiles.reduce((l,d)=>{if(!d.dem)return l;const p=d.dem.tree.minimums[0];return p>0&&t++,l+p},0);return t?n/t:0}_updateEmptyDEMTexture(){const t=this.painter.context,n=t.gl;t.activeTexture.set(n.TEXTURE2);const l=this._getLoadedAreaMinimum(),d=new u.ew({width:1,height:1},new Float32Array([l]));this._emptyDEMTextureDirty=!1;let p=this._emptyDEMTexture;return p?p.update(d,{premultiply:!1}):p=this._emptyDEMTexture=new u.T(t,d,n.R32F,{premultiply:!1}),p}setupElevationDraw(t,n,l){const d=this.painter.context,p=d.gl,m={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};m.u_exaggeration=this.exaggeration();let g=null,x=null,w=1;if(l&&l.morphing&&this._useVertexMorphing){const M=l.morphing.srcDemTile,D=l.morphing.dstDemTile;w=l.morphing.phase,M&&D&&(this._prepareDemTileUniforms(t,M,m,"_prev")&&(x=M),this._prepareDemTileUniforms(t,D,m)&&(g=D))}const E=M=>M&&M.demTexture&&this.painter.linearFloatFilteringSupported()?p.LINEAR:p.NEAREST;let A=null;var I;if(this.enabled?x&&g?(A=g.demTexture,d.activeTexture.set(p.TEXTURE4),x.demTexture.bind(E(x),p.CLAMP_TO_EDGE),m.u_dem_lerp=w):(g=this.terrainTileForTile[t.tileID.key],A=this._prepareDemTileUniforms(t,g,m)?g.demTexture:this.emptyDEMTexture):A=this.emptyDEMTexture,d.activeTexture.set(p.TEXTURE2),A&&(m.u_dem_size=(I=A).size[0]===1?1:I.size[0]-2,A.bind(E(g),p.CLAMP_TO_EDGE)),this.painter.setupDepthForOcclusion(l&&l.useDepthForOcclusion,n,m),l&&l.useMeterToDem&&g){const M=(1<<g.tileID.canonical.z)*u.aL(1,this.painter.transform.center.lat)*this.sourceCache.getSource().tileSize;m.u_meter_to_dem=M}if(l&&l.labelPlaneMatrixInv&&(m.u_label_plane_matrix_inv=l.labelPlaneMatrixInv),n.setTerrainUniformValues(d,m),this.painter.transform.projection.name==="globe"){const M=this.globeUniformValues(this.painter.transform,t.tileID.canonical,l&&l.useDenormalizedUpVectorScale);n.setGlobeUniformValues(d,M)}}globeUniformValues(t,n,l){const d=t.projection;return{u_tile_tl_up:d.upVector(n,0,0),u_tile_tr_up:d.upVector(n,u.aj,0),u_tile_br_up:d.upVector(n,u.aj,u.aj),u_tile_bl_up:d.upVector(n,0,u.aj),u_tile_up_scale:l?u.ex(1):d.upVectorScale(n,t.center.lat,t.worldSize).metersToTile}}renderToBackBuffer(t){const n=this.painter,l=this.painter.context;t.length!==0&&(l.bindFramebuffer.set(null),l.viewport.set([0,0,n.width,n.height]),n.gpuTimingDeferredRenderStart(),this.renderingToTexture=!1,(function(d,p,m,g,x){if(d.transform.projection.name==="globe")(function(w,E,A,I,M){const D=w.context,z=D.gl;let O,k;const q=w.transform,$=u.eu(w,D,q),U=(ve,xe)=>{if(k===xe)return;const Le=[];xe===1&&Le.push("TERRAIN_VERTEX_MORPHING"),Le.push("PROJECTION_GLOBE_VIEW"),$&&Le.push("CUSTOM_ANTIALIASING");const _e=w.isTileAffectedByFog(ve);O=w.getOrCreateProgram("globeRaster",{defines:Le,overrideFog:_e}),k=xe},Q=w.colorModeForRenderPass(),Y=new nt(z.LEQUAL,nt.ReadWrite,w.depthRangeFor3D);Na.update(M);const ae=u.dn(q),W=[u.bE(q.center.lng),u.bF(q.center.lat)],J=w.globeSharedBuffers,se=[q.width*u.r.devicePixelRatio,q.height*u.r.devicePixelRatio],ue=Float32Array.from(q.globeMatrix),he={useDenormalizedUpVectorScale:!0};{const ve=w.transform,xe=Es(ve.zoom,E.exaggeration(),E.sourceCache._source.tileSize);k=-1;const Le=z.TRIANGLES;for(const _e of I){const Pe=A.getTile(_e),me=lt.disabled,Re=E.prevTerrainTileForTile[_e.key],Me=E.terrainTileForTile[_e.key];zt(Re,Me)&&Na.newMorphing(_e.key,Re,Me,M,250),qc(w,Pe.emissiveTexture),D.activeTexture.set(z.TEXTURE0),Pe.texture&&Pe.texture.bind(z.LINEAR,z.CLAMP_TO_EDGE);const Ae=Na.getMorphValuesForProxy(_e.key),We=Ae?1:0;Ae&&Object.assign(he,{morphing:{srcDemTile:Ae.from,dstDemTile:Ae.to,phase:u.et(Ae.phase)}});const ke=u.dk(_e.canonical),Ue=u.dl(ke.getCenter().lat),je=u.dp(_e.canonical,ke,Ue,ve.worldSize/ve._pixelsPerMercatorPixel),et=u.d2(u.dm(_e.canonical)),tt=w.emissiveMode==="mrt-fallback"?1:0,it=_i(ve.expandedFarZProjMatrix,ue,ae,et,u.ah(ve.zoom),W,ve.frustumCorners.TL,ve.frustumCorners.TR,ve.frustumCorners.BR,ve.frustumCorners.BL,ve.globeCenterInViewSpace,ve.globeRadius,se,xe,ve._farZ,tt,je);if(U(_e,We),O&&(E.setupElevationDraw(Pe,O,he),w.uploadCommonUniforms(D,O,_e.toUnwrapped()),J)){const[at,bt,_t]=J.getGridBuffers(Ue,xe!==0);O.draw(w,Le,Y,me,Q,pt.backCCW,it,"globe_raster",at,bt,_t)}}}if(J&&(w.renderDefaultNorthPole||w.renderDefaultSouthPole)){const ve=["GLOBE_POLES","PROJECTION_GLOBE_VIEW"];$&&ve.push("CUSTOM_ANTIALIASING"),O=w.getOrCreateProgram("globeRaster",{defines:ve});for(const xe of I){const{x:Le,y:_e,z:Pe}=xe.canonical,me=_e===0,Re=_e===(1<<Pe)-1,[Me,Ae,We,ke]=J.getPoleBuffers(Pe,!1);if(ke&&(me||Re)){const Ue=A.getTile(xe);qc(w,Ue.emissiveTexture),D.activeTexture.set(z.TEXTURE0),Ue.texture&&Ue.texture.bind(z.LINEAR,z.CLAMP_TO_EDGE);let je=u.ev(Pe,Le,q);const et=u.d2(u.dm(xe.canonical)),tt=w.emissiveMode==="mrt-fallback"?1:0,it=(at,bt)=>at.draw(w,z.TRIANGLES,Y,lt.disabled,Q,pt.disabled,_i(q.expandedFarZProjMatrix,je,je,et,0,W,q.frustumCorners.TL,q.frustumCorners.TR,q.frustumCorners.BR,q.frustumCorners.BL,q.globeCenterInViewSpace,q.globeRadius,se,0,q._farZ,tt),"globe_pole_raster",bt,We,ke);E.setupElevationDraw(Ue,O,he),w.uploadCommonUniforms(D,O,xe.toUnwrapped()),me&&w.renderDefaultNorthPole&&it(O,Me),Re&&w.renderDefaultSouthPole&&(je=u.bL(u.aS(),je,[1,-1,1]),it(O,Ae))}}}})(d,p,m,g,x);else{const w=d.context,E=w.gl;let A,I;const M=d.shadowRenderer,D=ps(d,d.longestCutoffRange),z=Q=>{if(I===Q)return;const Y=[];Q===1&&Y.push("TERRAIN_VERTEX_MORPHING"),D.shouldRenderCutoff&&Y.push("RENDER_CUTOFF"),M&&(Y.push("RENDER_SHADOWS"),M.useNormalOffset&&Y.push("NORMAL_OFFSET")),A=d.getOrCreateProgram("terrainRaster",{defines:Y}),I=Q},O=d.colorModeForRenderPass(),k=new nt(E.LEQUAL,nt.ReadWrite,d.depthRangeFor3D);Na.update(x);const q=d.transform,$=Es(q.zoom,p.exaggeration(),p.sourceCache._source.tileSize);let U=[0,0,0];if(M){const Q=d.style.directionalLight,Y=d.style.ambientLight;Q&&Y&&(U=yn(d.style,Q,Y))}{I=-1;const Q=E.TRIANGLES,[Y,ae]=[p.gridIndexBuffer,p.gridSegments];for(const W of g){const J=m.getTile(W),se=lt.disabled,ue=p.prevTerrainTileForTile[W.key],he=p.terrainTileForTile[W.key];zt(ue,he)&&Na.newMorphing(W.key,ue,he,x,250),qc(d,J.emissiveTexture),w.activeTexture.set(E.TEXTURE0),J.texture&&J.texture.bind(E.LINEAR,E.CLAMP_TO_EDGE);const ve=Na.getMorphValuesForProxy(W.key),xe=ve?1:0;let Le;ve&&(Le={morphing:{srcDemTile:ve.from,dstDemTile:ve.to,phase:u.et(ve.phase)}});const _e=d.emissiveMode==="mrt-fallback"?1:0,Pe=Hg(W.projMatrix,Wl(W.canonical,q.renderWorldCopies)?$/10:$,U,_e);if(z(xe),!A)continue;p.setupElevationDraw(J,A,Le);const me=W.toUnwrapped();M&&M.setupShadows(me,A),d.uploadCommonUniforms(w,A,me,null,D),A.draw(d,Q,k,se,O,pt.backCCW,Pe,"terrain_raster",p.gridBuffer,Y,ae)}}}})(n,this,this.proxySourceCache,t,this._updateTimestamp),this.renderingToTexture=!0,n.gpuTimingDeferredRenderEnd(),t.splice(0,t.length))}renderBatch(t){if(this._drapedRenderBatches.length===0)return t+1;this.renderingToTexture=!0;const n=this.painter,l=this.painter.context,d=this.proxySourceCache,p=this.proxiedCoords[d.id],m=this._drapedRenderBatches.shift(),g=n.style.order,x=[];this._updateFBOs(n.emissiveMode==="mrt-fallback");let w=0;for(const E of p){const A=d.getTileByID(E.proxyTileKey),I=d.proxyCachedFBO[E.key]?d.proxyCachedFBO[E.key][t]:void 0,M=I!==void 0?d.renderCache[I]:this.pool[w++],D=I!==void 0;if(A.texture=M.tex,A.emissiveTexture=M.emissiveTex,D&&!M.dirty){x.push(A.tileID);continue}l.bindFramebuffer.set(M.fb.framebuffer);const z=l.gl;let O;z.drawBuffers(n.emissiveMode==="mrt-fallback"?[z.COLOR_ATTACHMENT0,z.COLOR_ATTACHMENT1]:[z.COLOR_ATTACHMENT0]),this.renderedToTile=!1,M.dirty&&(l.clear({color:u.C.transparent,stencil:0}),M.dirty=!1);for(let k=m.start;k<=m.end;++k){const q=n.style._mergedLayers[g[k]];if(q.isHidden(n.transform.zoom))continue;const $=n.style.getLayerSourceCache(q),U=$?this.proxyToSource[E.key][$.id]:[E];if(!U)continue;const Q=U;l.viewport.set([0,0,M.fb.width,M.fb.height]),O!==($?$.id:null)&&(this._setupStencil(M,U,q,$),O=$?$.id:null),n.renderLayer(n,$,q,Q)}if(z.drawBuffers([z.COLOR_ATTACHMENT0]),this._drapedRenderBatches.length===0)for(const k of this._pendingGroundEffectLayers){const q=n.style._mergedLayers[g[k]];if(q.isHidden(n.transform.zoom))continue;const $=n.style.getLayerSourceCache(q),U=$?this.proxyToSource[E.key][$.id]:[E];if(!U)continue;const Q=U;l.viewport.set([0,0,M.fb.width,M.fb.height]),O!==($?$.id:null)&&(this._setupStencil(M,U,q,$),O=$?$.id:null),n.renderLayer(n,$,q,Q)}this.renderedToTile?(M.dirty=!0,x.push(A.tileID)):D||--w,w===5&&(w=0,this.renderToBackBuffer(x))}return this.renderToBackBuffer(x),this.renderingToTexture=!1,l.bindFramebuffer.set(null),l.viewport.set([0,0,n.width,n.height]),m.end+1}postRender(){}isLayerOrderingCorrect(t){const n=t.order.length;let l=-1,d=n;for(let p=0;p<n;++p)this._style.isLayerDraped(t._mergedLayers[t.order[p]])?l=Math.max(l,p):d=Math.min(d,p);return d>l}getMinElevationBelowMSL(){let t=0;return this._visibleDemTiles.filter(n=>n.dem).forEach(n=>{t=Math.min(t,n.dem.tree.minimums[0])}),t===0?t:(t-30)*this._exaggeration}raycast(t,n,l){if(!this._visibleDemTiles)return null;const d=this._visibleDemTiles.filter(p=>p.dem).map(p=>{const m=p.tileID,g=1<<m.overscaledZ,{x,y:w}=m.canonical,E=x/g,A=(x+1)/g,I=w/g,M=(w+1)/g;return{minx:E,miny:I,maxx:A,maxy:M,t:p.dem.tree.raycastRoot(E,I,A,M,t,n,l),tile:p}});d.sort((p,m)=>(p.t!==null?p.t:Number.MAX_VALUE)-(m.t!==null?m.t:Number.MAX_VALUE));for(const p of d){if(p.t==null)return null;const m=p.tile.dem.tree.raycast(p.minx,p.miny,p.maxx,p.maxy,t,n,l);if(m!=null)return m}return null}_createFBO(){const t=this.painter.context,n=t.gl,l=this.drapeBufferSize;t.activeTexture.set(n.TEXTURE0);const d=new u.T(t,{width:l[0],height:l[1],data:null},n.RGBA8);d.bind(n.LINEAR,n.CLAMP_TO_EDGE);const p=t.createFramebuffer(l[0],l[1],1,null);let m;return p.colorAttachment0.set(d.texture),this._emissiveTexture&&(m=new u.T(t,{width:l[0],height:l[1],data:null},n.R8),m.bind(n.LINEAR,n.CLAMP_TO_EDGE),p.createColorAttachment(t,1),p.colorAttachment1.set(m.texture)),p.depthAttachment=new Gc(t,p.framebuffer),this._sharedDepthStencil===void 0?(this._sharedDepthStencil=t.createRenderbuffer(t.gl.DEPTH_STENCIL,l[0],l[1]),this._stencilRef=0,p.depthAttachment.set(this._sharedDepthStencil),t.clear({stencil:0})):p.depthAttachment.set(this._sharedDepthStencil),t.extTextureFilterAnisotropic&&n.texParameterf(n.TEXTURE_2D,t.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,t.extTextureFilterAnisotropicMax),{fb:p,tex:d,emissiveTex:m,dirty:!1}}_updateFBOs(t){if(this._emissiveTexture!==t){for(const n of this.pool)this._updateFBO(n,t);for(const n of this.proxySourceCache.renderCache)this._updateFBO(n,t);this._emissiveTexture=t}}_updateFBO(t,n){const l=t.fb,d=this.painter.context,p=d.gl,m=this.drapeBufferSize;if(n){const g=new u.T(d,{width:m[0],height:m[1],data:null},p.R8);g.bind(p.LINEAR,p.CLAMP_TO_EDGE),t.emissiveTex=g,l.createColorAttachment(d,1),l.colorAttachment1.set(g.texture)}else t.emissiveTex=void 0,l.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 n=this._style._mergedLayers[t],l=n.isHidden(this.painter.transform.zoom);return n.type==="hillshade"||n.type==="custom"?!l&&n.shouldRedrape():!l&&n.hasTransition()})}_clearLineLayersFromRenderCache(){let t=!1;for(const l of this._style.getSources())if(l instanceof Im){t=!0;break}if(!t)return;const n={};for(let l=0;l<this._style.order.length;++l){const d=this._style._mergedLayers[this._style.order[l]],p=this._style.getLayerSourceCache(d);if(!p||n[p.id]||d.isHidden(this.painter.transform.zoom)||d.type!=="line")continue;const m=d.widthExpression(),g=d.emissiveStrengthExpression();if(m instanceof u.ab||g instanceof u.ab){n[p.id]=!0;for(const x of this.proxyCoords){const w=this.proxyToSource[x.key][p.id];if(w)for(const E of w)this._clearRenderCacheForTile(p.id,E)}}}}_clearRasterLayersFromRenderCache(){let t=!1;for(const l in this._style._mergedSourceCaches)if(this._style._mergedSourceCaches[l]._source instanceof Ll){t=!0;break}if(!t)return;const n={};for(let l=0;l<this._style.order.length;++l){const d=this._style._mergedLayers[this._style.order[l]],p=this._style.getLayerSourceCache(d);if(!p||n[p.id]||d.isHidden(this.painter.transform.zoom)||d.type!=="raster")continue;const m=d.paint.get("raster-fade-duration");for(const g of this.proxyCoords){const x=this.proxyToSource[g.key][p.id];if(x)for(const w of x){const E=Yu(p.getTile(w),p.findLoadedParent(w,0),p,this.painter.transform,m);(E.opacity!==1||E.mix!==0)&&this._clearRenderCacheForTile(p.id,w)}}}}_setupDrapedRenderBatches(){this._style.updateDrapeFirstLayers();const t=this._style.order,n=t.length;if(n===0)return;const l=[];this._pendingGroundEffectLayers=[];let d,p=0,m=this._style._mergedLayers[t[p]];for(;!this._style.isLayerDraped(m)&&m.isHidden(this.painter.transform.zoom)&&++p<n;)m=this._style._mergedLayers[t[p]];for(;p<n;++p){const g=this._style._mergedLayers[t[p]];g.isHidden(this.painter.transform.zoom)||(this._style.isLayerDraped(g)?d===void 0&&(d=p):(g.type==="fill-extrusion"&&this._pendingGroundEffectLayers.push(p),d!==void 0&&(l.push({start:d,end:p-1}),d=void 0)))}if(d!==void 0&&l.push({start:d,end:p-1}),l.length!==0){const g=l.at(-1);this._pendingGroundEffectLayers.every(x=>x>g.end)||u.w("fill-extrusion with flood lighting and/or ground ambient occlusion should be moved to be on top of all draped layers.")}this._drapedRenderBatches=l}_setupRenderCache(t){const n=this.proxySourceCache;if(this._shouldDisableRenderCache()||this.invalidateRenderCache){if(this.invalidateRenderCache=!1,n.renderCache.length>n.renderCachePool.length){const m=Object.values(n.proxyCachedFBO);n.proxyCachedFBO={};for(let g=0;g<m.length;++g){const x=Object.values(m[g]);n.renderCachePool.push(...x)}}return}this._clearRasterLayersFromRenderCache();const l=this.proxyCoords,d=this._tilesDirty;for(let m=l.length-1;m>=0;m--){const g=l[m];if(n.getTileByID(g.key),n.proxyCachedFBO[g.key]!==void 0){const x=t[g.key],w=this.proxyToSource[g.key];let E=0;for(const A in w){const I=w[A],M=x[A];if(!M||M.length!==I.length||I.some((D,z)=>D!==M[z]||d[A]&&Object.hasOwn(d[A],D.key))){E=-1;break}++E}for(const A in n.proxyCachedFBO[g.key])n.renderCache[n.proxyCachedFBO[g.key][A]].dirty=E<0||E!==Object.values(x).length}}const p=[...this._drapedRenderBatches];p.sort((m,g)=>g.end-g.start-(m.end-m.start));for(const m of p)for(const g of l){if(n.proxyCachedFBO[g.key])continue;let x=n.renderCachePool.pop();x===void 0&&n.renderCache.length<50&&(x=n.renderCache.length,n.renderCache.push(this._createFBO())),x!==void 0&&(n.proxyCachedFBO[g.key]={},n.proxyCachedFBO[g.key][m.start]=x,n.renderCache[x].dirty=!0)}this._tilesDirty={}}_setupStencil(t,n,l,d){if(!d||!this._sourceTilesOverlap[d.id])return void(this._overlapStencilType&&(this._overlapStencilType=!1));const p=this.painter.context,m=p.gl;if(n.length<=1)return void(this._overlapStencilType=!1);let g;if(l.isTileClipped())g=n.length,this._overlapStencilMode.test={func:m.EQUAL,mask:255},this._overlapStencilType="Clip";else{if(!(n[0].overscaledZ>n.at(-1).overscaledZ))return void(this._overlapStencilType=!1);g=1,this._overlapStencilMode.test={func:m.GREATER,mask:255},this._overlapStencilType="Mask"}this._stencilRef+g>255&&(p.clear({stencil:0}),this._stencilRef=0),this._stencilRef+=g,this._overlapStencilMode.ref=this._stencilRef,l.isTileClipped()&&this._renderTileClippingMasks(n,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):lt.disabled}_renderTileClippingMasks(t,n){const l=this.painter,d=this.painter.context,p=d.gl;l._tileClippingMaskIDs={},d.setColorMode(dt.disabled),d.setDepthMode(nt.disabled);const m=l.getOrCreateProgram("clippingMask");for(const g of t){const x=l._tileClippingMaskIDs[g.key]=--n;m.draw(l,p.TRIANGLES,nt.disabled,new lt({func:p.ALWAYS,mask:0},x,255,p.KEEP,p.KEEP,p.REPLACE),dt.disabled,pt.disabled,kl(g.projMatrix),"$clipping",l.tileExtentBuffer,l.quadTriangleIndexBuffer,l.tileExtentSegments)}}pointCoordinate(t){const n=this.painter.transform;if(t.x<0||t.x>n.width||t.y<0||t.y>n.height)return null;const l=[t.x,t.y,1,1];u.aO(l,l,n.pixelMatrixInverse),u.bz(l,l,1/l[3]),l[0]/=n.worldSize,l[1]/=n.worldSize;const d=n._camera.position,p=u.aL(1,n.center.lat),m=[d[0],d[1],d[2]/p,0],g=u.cA([],l.slice(0,3),m);u.au(g,g);const x=this.raycast(m,g,this._exaggeration);return x!==null&&x?(u.aY(m,m,g,x),m[3]=m[2],m[2]*=p,m):null}_setupProxiedCoordsForOrtho(t,n,l){if(t.getSource()instanceof so)return this._setupProxiedCoordsForImageSource(t,n,l);this._findCoveringTileCache[t.id]=this._findCoveringTileCache[t.id]||{};const d=this.proxiedCoords[t.id]=[],p=this.proxyCoords;for(let x=0;x<p.length;x++){const w=p[x],E=this._findTileCoveringTileID(w,t);if(E){const A=this._createProxiedId(w,E,l[w.key]&&l[w.key][t.id]);d.push(A),this.proxyToSource[w.key][t.id]=[A]}}let m=!1;const g=new Set;for(let x=0;x<n.length;x++){const w=t.getTile(n[x]);if(!w||!w.hasData())continue;const E=this._findTileCoveringTileID(w.tileID,this.proxySourceCache);if(E&&E.tileID.canonical.z!==w.tileID.canonical.z){const A=this.proxyToSource[E.tileID.key][t.id],I=this._createProxiedId(E.tileID,w,l[E.tileID.key]&&l[E.tileID.key][t.id]);A?A.splice(A.length-1,0,I):this.proxyToSource[E.tileID.key][t.id]=[I];const M=this.proxyToSource[E.tileID.key][t.id];g.has(M)||g.add(M),d.push(I),m=!0}}if(this._sourceTilesOverlap[t.id]=m,m)for(const x of g)x.sort((w,E)=>E.overscaledZ-w.overscaledZ)}_setupProxiedCoordsForImageSource(t,n,l){if(!t.getSource().loaded())return;const d=this.proxiedCoords[t.id]=[],p=this.proxyCoords,m=t.getSource(),g=m.tileID;if(!g)return;const x=new u.P(g.x,g.y)._div(1<<g.z),w=m.coordinates.map(u.ac.fromLngLat).reduce((A,I)=>(A.min.x=Math.min(A.min.x,I.x-x.x),A.min.y=Math.min(A.min.y,I.y-x.y),A.max.x=Math.max(A.max.x,I.x-x.x),A.max.y=Math.max(A.max.y,I.y-x.y),A),{min:new u.P(Number.MAX_VALUE,Number.MAX_VALUE),max:new u.P(-Number.MAX_VALUE,-Number.MAX_VALUE)}),E=(A,I)=>{const M=A.wrap+A.canonical.x/(1<<A.canonical.z),D=A.canonical.y/(1<<A.canonical.z),z=u.aj/(1<<A.canonical.z),O=I.wrap+I.canonical.x/(1<<I.canonical.z),k=I.canonical.y/(1<<I.canonical.z);return M+z<O+w.min.x||M>O+w.max.x||D+z<k+w.min.y||D>k+w.max.y};for(let A=0;A<p.length;A++){const I=p[A];for(let M=0;M<n.length;M++){const D=t.getTile(n[M]);if(!D||!D.hasData()||E(I,D.tileID))continue;const z=this._createProxiedId(I,D,l[I.key]&&l[I.key][t.id]),O=this.proxyToSource[I.key][t.id];O?O.push(z):this.proxyToSource[I.key][t.id]=[z],d.push(z)}}}_createProxiedId(t,n,l){let d=this.orthoMatrix;if(l){const p=l.find(m=>m.key===n.tileID.key);if(p)return p}if(n.tileID.key!==t.key){const p=t.canonical.z-n.tileID.canonical.z;let m,g,x;d=u.aS();const w=n.tileID.wrap-t.wrap<<t.overscaledZ;p>0?(m=u.aj>>p,g=m*((n.tileID.canonical.x<<p)-t.canonical.x+w),x=m*((n.tileID.canonical.y<<p)-t.canonical.y)):(m=u.aj<<-p,g=u.aj*(n.tileID.canonical.x-(t.canonical.x+w<<-p)),x=u.aj*(n.tileID.canonical.y-(t.canonical.y<<-p))),u.aK(d,0,m,0,m,0,1),u.aG(d,d,[g,x,0])}return new xh(n.tileID,t.key,d)}_findTileCoveringTileID(t,n){let l=n.getTile(t);if(l&&l.hasData())return l;const d=this._findCoveringTileCache[n.id],p=d[t.key];if(l=p?n.getTileByID(p):null,l&&l.hasData()||p===null)return l;let m=l?l.tileID:t,g=m.overscaledZ;const x=n.getSource().minzoom,w=[];if(!p){const A=n.getSource().maxzoom;if(t.canonical.z>=A){const I=t.canonical.z-A;n.getSource().reparseOverscaled?(g=Math.max(t.canonical.z+2,n.transform.tileZoom),m=new u.bp(g,t.wrap,A,t.canonical.x>>I,t.canonical.y>>I)):I!==0&&(g=A,m=new u.bp(g,t.wrap,A,t.canonical.x>>I,t.canonical.y>>I))}m.key!==t.key&&(w.push(m.key),l=n.getTile(m))}const E=A=>{w.forEach(I=>{d[I]=A}),w.length=0};for(g-=1;g>=x&&(!l||!l.hasData());g--){l&&E(l.tileID.key);const A=m.calculateScaledKey(g);if(l=n.getTileByID(A),l&&l.hasData())break;const I=d[A];if(I===null)break;I===void 0?w.push(A):l=n.getTileByID(I)}return E(l?l.tileID.key:null),l&&l.hasData()?l:null}findDEMTileFor(t){return this.enabled?this._findTileCoveringTileID(t,this.sourceCache):null}prepareDrawTile(){this.renderedToTile=!0}_clearRenderCacheForTile(t,n){let l=this._tilesDirty[t];l||(l=this._tilesDirty[t]={}),l[n.key]=!0}}function Cf(s,t,n){const l=(function(g,x,w){const E=u.aw(x,g),A=u.aw(w,[.2126,.7152,.0722]),I=1-.3*Math.min(A,1),M=u.ai(I,1,Math.min(E+1,1));return u.ai(.92,1,Math.asin(u.as(x[2],-1,1))/Math.PI+.5)*M})(s,[0,0,1],t),d=[0,0,0];u.av(d,n.slice(0,3),l);const p=[0,0,0];u.av(p,t.slice(0,3),s[2]);const m=[0,0,0];return u.cz(m,d,p),u.c7(m)}const Mf=["fill","fillOutline","fillPattern","line","linePattern","background","backgroundPattern","hillshade","raster"],ho=["stars","rainParticle","snowParticle","fillExtrusion","fillExtrusionGroundEffect","building","buildingBloom","elevatedStructures","model","symbol"];class Ss{static cacheKey(t,n,l,d){const p=[n];d&&p.push(d.cacheKey);for(const m of l)(typeof m=="string"&&m.includes(" ")||t.usedDefines.has(m))&&p.push(m);return p.join("/")}constructor(t,n,l,d,p,m,g=!1){const x=t.gl;this.program=x.createProgram(),this._context=t,this._fixedUniformsFn=p,this._pending=!0,this._precompiled=g,this.attributes={},this.configuration=d,this.name=n,this.fixedDefines=[...m],g?t._compileStats.precompiled++:t._compileStats.onDemand++;const w=`#version 300 es
3327${(d?d.defines():[]).concat(m.map(O=>`#define ${O}`)).join(`
3328`)}`,E=[w,Pd];for(const O of l.fragmentIncludes)E.push(Ia[O]);E.push(l.fragmentSource);const A=E.join(`
3329`),I=[w,Zs];for(const O of l.vertexIncludes)I.push(Ia[O]);this.forceManualRenderingForInstanceIDShaders=t.forceManualRenderingForInstanceIDShaders&&l.vertexSource.includes("gl_InstanceID"),this.forceManualRenderingForInstanceIDShaders&&I.push("uniform int u_instanceID;"),I.push(l.vertexSource);let M=I.join(`
3330`);this.forceManualRenderingForInstanceIDShaders&&(M=M.replaceAll("gl_InstanceID","u_instanceID"));const D=x.createShader(x.FRAGMENT_SHADER);if(x.isContextLost())return this.failedToCreate=!0,void(this._pending=!1);x.shaderSource(D,A),x.compileShader(D),x.attachShader(this.program,D);const z=x.createShader(x.VERTEX_SHADER);if(x.isContextLost())return this.failedToCreate=!0,void(this._pending=!1);x.shaderSource(z,M),x.compileShader(z),x.attachShader(this.program,z),x.linkProgram(this.program),this._fragmentShader=D,this._vertexShader=z,t.extParallelShaderCompile?t._pendingPrograms.add(this):this._finalize()}_finalize(){if(!this._pending)return;this._pending=!1;const t=this._context,n=t.gl;t._pendingPrograms.delete(this);const l=u.r.now(),d=n.getProgramParameter(this.program,n.LINK_STATUS),p=u.r.now()-l,m=t._compileStats;if(m.totalStallMs+=p,p>m.maxStallMs&&(m.maxStallMs=p),p>1){m.framesMissed+=Math.floor(60*p/1e3);const w=this.fixedDefines.join(",");m.stalls.push({name:`${this.name}${w?"/":""}${w}`,ms:p,timestamp:l})}if(this._fragmentShader&&(d||u.w(`Fragment shader '${this.name}': ${n.getShaderInfoLog(this._fragmentShader)}`),n.deleteShader(this._fragmentShader),this._fragmentShader=null),this._vertexShader&&(d||u.w(`Vertex shader '${this.name}': ${n.getShaderInfoLog(this._vertexShader)}`),n.deleteShader(this._vertexShader),this._vertexShader=null),!d)return u.w(`Failed to link program '${this.name}': ${n.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=(w=>({u_instanceID:new u.b_(w)}))(t));const g=this.fixedDefines,x=this.name;(g.includes("TERRAIN")||g.includes("ELEVATED")||x.includes("symbol")||x.includes("circle"))&&(this.terrainUniforms=(w=>({u_dem:new u.b_(w),u_dem_prev:new u.b_(w),u_dem_tl:new u.b$(w),u_dem_scale:new u.ar(w),u_dem_tl_prev:new u.b$(w),u_dem_scale_prev:new u.ar(w),u_dem_size:new u.ar(w),u_dem_lerp:new u.ar(w),u_exaggeration:new u.ar(w),u_depth:new u.b_(w),u_depth_size_inv:new u.b$(w),u_depth_range_unpack:new u.b$(w),u_occluder_half_size:new u.ar(w),u_occlusion_depth_offset:new u.ar(w),u_meter_to_dem:new u.ar(w),u_label_plane_matrix_inv:new u.ap(w)}))(t)),g.includes("GLOBE")&&(this.globeUniforms=(w=>({u_tile_tl_up:new u.aq(w),u_tile_tr_up:new u.aq(w),u_tile_br_up:new u.aq(w),u_tile_bl_up:new u.aq(w),u_tile_up_scale:new u.ar(w)}))(t)),g.includes("FOG")&&(this.fogUniforms=(w=>({u_fog_matrix:new u.ap(w),u_fog_range:new u.b$(w),u_fog_color:new u.bZ(w),u_fog_horizon_blend:new u.ar(w),u_fog_vertical_limit:new u.b$(w),u_fog_temporal_offset:new u.ar(w),u_frustum_tl:new u.aq(w),u_frustum_tr:new u.aq(w),u_frustum_br:new u.aq(w),u_frustum_bl:new u.aq(w),u_globe_pos:new u.aq(w),u_globe_radius:new u.ar(w),u_globe_transition:new u.ar(w),u_is_globe:new u.b_(w),u_viewport:new u.b$(w)}))(t)),g.includes("RENDER_CUTOFF")&&(this.cutoffUniforms=(w=>({u_cutoff_params:new u.bZ(w)}))(t)),g.includes("LIGHTING_3D_MODE")&&(this.lightsUniforms=(w=>({u_lighting_ambient_color:new u.aq(w),u_lighting_directional_dir:new u.aq(w),u_lighting_directional_color:new u.aq(w),u_ground_radiance:new u.aq(w)}))(t)),g.includes("RENDER_SHADOWS")&&(this.shadowUniforms=(w=>({u_light_matrix_0:new u.ap(w),u_light_matrix_1:new u.ap(w),u_fade_range:new u.b$(w),u_shadow_normal_offset:new u.aq(w),u_shadow_intensity:new u.ar(w),u_shadow_texel_size:new u.ar(w),u_shadow_map_resolution:new u.ar(w),u_shadow_direction:new u.aq(w),u_shadow_bias:new u.aq(w),u_shadowmap_0:new u.b_(w),u_shadowmap_1:new u.b_(w)}))(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,n){this._ensureReady();let l=this.attributes[n];return l===void 0&&(l=this.attributes[n]=t.getAttribLocation(this.program,n)),l}setTerrainUniformValues(t,n){if(this._ensureReady(),!this.terrainUniforms)return;const l=this.terrainUniforms;if(!this.failedToCreate){t.program.set(this.program);for(const d in n)l[d]&&l[d].set(this.program,d,n[d])}}setGlobeUniformValues(t,n){if(this._ensureReady(),!this.globeUniforms)return;const l=this.globeUniforms;if(!this.failedToCreate){t.program.set(this.program);for(const d in n)l[d]&&l[d].set(this.program,d,n[d])}}setFogUniformValues(t,n){if(this._ensureReady(),!this.fogUniforms)return;const l=this.fogUniforms;if(!this.failedToCreate){t.program.set(this.program);for(const d in n)l[d].set(this.program,d,n[d])}}setCutoffUniformValues(t,n){if(this._ensureReady(),!this.cutoffUniforms)return;const l=this.cutoffUniforms;if(!this.failedToCreate){t.program.set(this.program);for(const d in n)l[d].set(this.program,d,n[d])}}setLightsUniformValues(t,n){if(this._ensureReady(),!this.lightsUniforms)return;const l=this.lightsUniforms;if(!this.failedToCreate){t.program.set(this.program);for(const d in n)l[d].set(this.program,d,n[d])}}setShadowUniformValues(t,n){if(this._ensureReady(),this.failedToCreate||!this.shadowUniforms)return;const l=this.shadowUniforms;t.program.set(this.program);for(const d in n)l[d].set(this.program,d,n[d])}_drawDebugWireframe(t,n,l,d,p,m,g,x,w,E){const A=t.options.wireframe;if(A.terrain===!1&&A.layers2D===!1&&A.layers3D===!1)return;const I=t.context;if(!(!(!A.terrain||this.name!=="terrainRaster"&&this.name!=="globeRaster")||!(!A.layers2D||t._terrain&&t._terrain.renderingToTexture||!Mf.includes(this.name))||!(!A.layers3D||!ho.includes(this.name))))return;const M=I.gl,D=t.wireframeDebugCache.getLinesFromTrianglesBuffer(t.frameCounter,p,I);if(!D)return;const z=[...this.fixedDefines,"DEBUG_WIREFRAME"],O=t.getOrCreateProgram(this.name,{config:this.configuration,defines:z});O._ensureReady(),I.program.set(O.program);const k=(U,Q,Y)=>{if(Q[U]&&Y[U])for(const ae in Q[U])Y[U][ae]&&Y[U][ae].set(Y.program,ae,Q[U][ae].current)};w&&w.setUniforms(O.program,I,O.binderUniforms,g,{zoom:x}),k("fixedUniforms",this,O),k("terrainUniforms",this,O),k("globeUniforms",this,O),k("fogUniforms",this,O),k("lightsUniforms",this,O),k("shadowUniforms",this,O),D.bind(),I.setColorMode(new dt([M.ONE,M.ONE_MINUS_SRC_ALPHA,M.ZERO,M.ONE],u.C.transparent,[!0,!0,!0,!1])),I.setDepthMode(new nt(n.func===M.LESS?M.LEQUAL:n.func,nt.ReadOnly,n.range)),I.setStencilMode(lt.disabled);const q=3*m.primitiveLength*2,$=3*m.primitiveOffset*2*2;if(this.forceManualRenderingForInstanceIDShaders){const U=E||1;for(let Q=0;Q<U;++Q)O.instancingUniforms.u_instanceID.set(this.program,"u_instanceID",Q),M.drawElements(M.LINES,q,M.UNSIGNED_SHORT,$)}else E&&E>1?M.drawElementsInstanced(M.LINES,q,M.UNSIGNED_SHORT,$,E):M.drawElements(M.LINES,q,M.UNSIGNED_SHORT,$);p.bind(),I.program.set(this.program),I.setDepthMode(n),I.setStencilMode(l),I.setColorMode(d)}checkUniforms(t,n,l){if(this.fixedDefines.includes(n)){for(const d of Object.keys(l))if(!l[d].initialized)throw new Error(`Program '${this.name}', from draw '${t}': uniform ${d} not set but required by ${n} being defined`)}}draw(t,n,l,d,p,m,g,x,w,E,A,I,M,D,z,O){const k=t.context,q=k.gl;if(this._ensureReady(),this.failedToCreate)return;k.program.set(this.program),k.setDepthMode(l),k.setStencilMode(d),k.setColorMode(p),k.setCullFace(m);for(const[W,J]of this.fixedUniformsEntries)J.set(this.program,W,g[W]);D&&D.setUniforms(this.program,k,this.binderUniforms,I,{zoom:M});const $={[q.POINTS]:1,[q.LINES]:2,[q.TRIANGLES]:3,[q.LINE_STRIP]:1}[n];this.checkUniforms(x,"RENDER_SHADOWS",this.shadowUniforms);const U=z||[],Q=D?D.getPaintVertexBuffers():[],Y=n===q.TRIANGLES&&E,ae=O&&O>0?1:void 0;for(const W of A.get()){const J=W.vaos||(W.vaos={});if((J[x]||(J[x]=new Um)).bind(k,this,w,Q,E,W.vertexOffset,U,ae),this.forceManualRenderingForInstanceIDShaders){const se=O||1;for(let ue=0;ue<se;++ue)this.instancingUniforms.u_instanceID.set(this.program,"u_instanceID",ue),E?q.drawElements(n,W.primitiveLength*$,q.UNSIGNED_SHORT,W.primitiveOffset*$*2):q.drawArrays(n,W.vertexOffset,W.vertexLength)}else O&&O>1?q.drawElementsInstanced(n,W.primitiveLength*$,q.UNSIGNED_SHORT,W.primitiveOffset*$*2,O):E?q.drawElements(n,W.primitiveLength*$,q.UNSIGNED_SHORT,W.primitiveOffset*$*2):q.drawArrays(n,W.vertexOffset,W.vertexLength);Y&&this._drawDebugWireframe(t,l,d,p,E,W,I,M,D,O)}}}const Va=(s,t,n)=>({u_matrix:s,u_emissive_strength:t,u_ground_shadow_factor:n,u_opacity_multiplier:1}),Hc=(s,t,n,l,d,p=0)=>Object.assign(Va(s,t,d),Il(n,l,p)),Pf=(s,t,n,l)=>({u_matrix:s,u_world:n,u_emissive_strength:t,u_ground_shadow_factor:l,u_opacity_multiplier:1}),Rf=(s,t,n,l,d,p,m=0)=>Object.assign(Hc(s,t,n,l,p,m),{u_world:d}),Is=(s,t,n)=>({u_image:s,u_texel_size:t,u_first_pass:n?1:0}),Df=(s,t,n,l,d,p,m,g)=>{const x=u.aj/p.tileSize;return{u_matrix:s,u_inv_rot_matrix:t,u_camera_to_center_distance:n.getCameraToCenterDistance(g),u_extrude_scale:[n.pixelsToGLUnits[0]/x,n.pixelsToGLUnits[1]/x],u_zoom_transition:l,u_tile_id:m,u_merc_center:d}},fo=(s,t,n,l)=>({u_matrix:s,u_inv_matrix:t,u_camera_to_center_distance:n.getCameraToCenterDistance(l),u_viewport_size:[n.width,n.height]}),zf=u.aS(),bh=(s,t,n,l,d,p,m)=>{const g=s.transform,x=g.projection.name==="globe",w=x?u.ez(g.zoom,t.canonical)*g._pixelsPerMercatorPixel:u.c1(n,1,p),E={u_matrix:t.projMatrix,u_extrude_scale:w,u_intensity:m,u_inv_rot_matrix:zf,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0]};if(x){E.u_inv_rot_matrix=l,E.u_merc_center=d,E.u_tile_id=[t.canonical.x,t.canonical.y,1<<t.canonical.z],E.u_zoom_transition=u.ah(g.zoom);const A=d[0]*u.aj,I=d[1]*u.aj;E.u_up_dir=g.projection.upVector(new u.bs(0,0,0),A,I)}return E};function Lf(s){const t=s.terrain?s.terrain.exaggeration():1;return(s.transform.pitch<15?u.ai(.07,.7,u.as((14-s.transform.zoom)/5,0,1)):.07)*t}const wh=(s,t,n,l,d,p,m,g,x,w,E,A,I,M,D,z,O,k,q,$,U,Q)=>({u_matrix:t,u_normalize_matrix:n,u_globe_matrix:l,u_merc_matrix:d,u_grid_matrix:p,u_tl_parent:m,u_scale_parent:E,u_fade_t:A.mix,u_opacity:A.opacity*I.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:I.paint.get("raster-brightness-min"),u_brightness_high:I.paint.get("raster-brightness-max"),u_saturation_factor:u.eC(I.paint.get("raster-saturation")),u_contrast_factor:u.eB(I.paint.get("raster-contrast")),u_spin_weights:Mr(I.paint.get("raster-hue-rotate")),u_perspective_transform:M,u_raster_elevation:D,u_zoom_transition:g,u_merc_center:x,u_cutoff_params:w,u_colorization_mix:Zu(u.eA,O,q),u_colorization_offset:Wu(u.eA,k,q),u_color_ramp:z,u_texture_offset:[U/($+2*U),$/($+2*U)],u_texture_res:[$+2*U,$+2*U],u_emissive_strength:Q,u_zbias_factor:Lf(s)});function Mr(s){s*=Math.PI/180;const t=Math.sin(s),n=Math.cos(s);return[(2*n+1)/3,(-Math.sqrt(3)*t-n+1)/3,(Math.sqrt(3)*t-n+1)/3]}const Th=u.aS(),Eh=(s,t,n,l,d,p,m,g,x,w,E,A,I,M,D,z,O,k,q,$,U,Q,Y,ae,W)=>{const J=d.transform,se={u_is_size_zoom_constant:+(s==="constant"||s==="source"),u_is_size_feature_constant:+(s==="constant"||s==="camera"),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_camera_to_center_distance:J.getCameraToCenterDistance($),u_rotate_symbol:+n,u_aspect_ratio:J.width/J.height,u_fade_change:d.options.fadeDuration?d.symbolFadeChange:1,u_matrix:p,u_label_plane_matrix:m,u_coord_matrix:g,u_is_text:+w,u_is_sdf:+E,u_elevation_from_sea:x?1:0,u_pitch_with_map:+l,u_texsize:A,u_texsize_icon:I,u_texture:0,u_texture_icon:1,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:Th,u_merc_center:[0,0],u_camera_forward:[0,0,0],u_ecef_origin:[0,0,0],u_tile_matrix:Th,u_up_vector:[0,-1,0],u_color_adj_mat:Y,u_icon_transition:ae||0,u_gamma_scale:E?l?d.transform.getCameraToCenterDistance($)*Math.cos(d.terrain?0:d.transform._pitch):1:0,u_device_pixel_ratio:u.r.devicePixelRatio,u_is_halo:1,u_scale_factor:W||1,u_ground_shadow_factor:U,u_inv_matrix:u.aE(u.aS(),m),u_normal_scale:Q,u_lutTexture:10,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],u_spp_fill_color_zoom_factor:0,u_spp_halo_color_zoom_factor:0,u_spp_opacity_zoom_factor:0,u_spp_halo_width_zoom_factor:0,u_spp_halo_blur_zoom_factor:0,u_spp_emissive_strength_zoom_factor:0,u_spp_occlusion_opacity_zoom_factor:0,u_spp_z_offset_zoom_factor:0,u_spp_translate_zoom_factor:0,u_spp_zoom_fraction:0,u_opacity_multiplier:1};return $.name==="globe"&&(se.u_tile_id=[D.canonical.x,D.canonical.y,1<<D.canonical.z],se.u_zoom_transition=z,se.u_inv_rot_matrix=k,se.u_merc_center=O,se.u_camera_forward=J._camera.forward(),se.u_ecef_origin=u.eD(J.globeMatrix,D.toUnwrapped()),se.u_tile_matrix=J.globeMatrix,se.u_up_vector=q),se},Sh=(s,t,n,l)=>({u_matrix:s,u_emissive_strength:t,u_opacity:n,u_color:l}),ea=(s,t,n,l,d,p,m,g,x)=>Object.assign((function(w,E,A,I,M,D){const{width:z,height:O}=I.imageManager.getPixelSize(E),k=Math.pow(2,D.tileID.overscaledZ),q=D.tileSize*Math.pow(2,I.transform.tileZoom)/k,$=q*(D.tileID.canonical.x+D.tileID.wrap*k),U=q*D.tileID.canonical.y;return{u_image:0,u_pattern_tl:A.tl,u_pattern_br:A.br,u_texsize:[z,O],u_pattern_size:A.displaySize,u_pattern_units_to_pixels:M?[I.transform.width,-1*I.transform.height]:[1/u.c1(D,1,I.transform.tileZoom),1/u.c1(D,1,I.transform.tileZoom)],u_pixel_coord_upper:[$>>16,U>>16],u_pixel_coord_lower:[65535&$,65535&U]}})(0,p,m,l,g,x),{u_matrix:s,u_emissive_strength:t,u_opacity:n}),Ff={fillExtrusion:s=>({u_matrix:new u.ap(s),u_lightpos:new u.aq(s),u_lightintensity:new u.ar(s),u_lightcolor:new u.aq(s),u_vertical_gradient:new u.ar(s),u_opacity:new u.ar(s),u_edge_radius:new u.ar(s),u_width_scale:new u.ar(s),u_ao:new u.b$(s),u_height_type:new u.b_(s),u_base_type:new u.b_(s),u_tile_id:new u.aq(s),u_zoom_transition:new u.ar(s),u_inv_rot_matrix:new u.ap(s),u_merc_center:new u.b$(s),u_up_dir:new u.aq(s),u_height_lift:new u.ar(s),u_flood_light_color:new u.aq(s),u_vertical_scale:new u.ar(s),u_flood_light_intensity:new u.ar(s),u_ground_shadow_factor:new u.aq(s),u_front_cutoff_params:new u.aq(s)}),fillExtrusionPattern:s=>({u_matrix:new u.ap(s),u_lightpos:new u.aq(s),u_lightintensity:new u.ar(s),u_lightcolor:new u.aq(s),u_vertical_gradient:new u.ar(s),u_height_factor:new u.ar(s),u_edge_radius:new u.ar(s),u_width_scale:new u.ar(s),u_ao:new u.b$(s),u_height_type:new u.b_(s),u_base_type:new u.b_(s),u_tile_id:new u.aq(s),u_zoom_transition:new u.ar(s),u_inv_rot_matrix:new u.ap(s),u_merc_center:new u.b$(s),u_up_dir:new u.aq(s),u_height_lift:new u.ar(s),u_image:new u.b_(s),u_texsize:new u.b$(s),u_pixel_coord_upper:new u.b$(s),u_pixel_coord_lower:new u.b$(s),u_tile_units_to_pixels:new u.ar(s),u_opacity:new u.ar(s),u_pattern_transition:new u.ar(s)}),fill:s=>({u_matrix:new u.ap(s),u_emissive_strength:new u.ar(s),u_ground_shadow_factor:new u.aq(s),u_opacity_multiplier:new u.ar(s)}),fillPattern:s=>({u_matrix:new u.ap(s),u_emissive_strength:new u.ar(s),u_image:new u.b_(s),u_texsize:new u.b$(s),u_pixel_coord_upper:new u.b$(s),u_pixel_coord_lower:new u.b$(s),u_tile_units_to_pixels:new u.ar(s),u_ground_shadow_factor:new u.aq(s),u_pattern_transition:new u.ar(s),u_opacity_multiplier:new u.ar(s)}),fillOutline:s=>({u_matrix:new u.ap(s),u_emissive_strength:new u.ar(s),u_world:new u.b$(s),u_ground_shadow_factor:new u.aq(s),u_opacity_multiplier:new u.ar(s)}),fillOutlinePattern:s=>({u_matrix:new u.ap(s),u_emissive_strength:new u.ar(s),u_world:new u.b$(s),u_image:new u.b_(s),u_texsize:new u.b$(s),u_pixel_coord_upper:new u.b$(s),u_pixel_coord_lower:new u.b$(s),u_tile_units_to_pixels:new u.ar(s),u_ground_shadow_factor:new u.aq(s),u_pattern_transition:new u.ar(s),u_opacity_multiplier:new u.ar(s)}),lineBlendComposite:s=>({u_image:new u.b_(s),u_opacity:new u.ar(s),u_blend_mode:new u.b_(s),u_max_density:new u.ar(s)}),lineBlendReduce:s=>({u_image:new u.b_(s),u_texel_size:new u.b$(s),u_first_pass:new u.b_(s)}),circle:u.eG,collisionBox:s=>({u_matrix:new u.ap(s),u_inv_rot_matrix:new u.ap(s),u_camera_to_center_distance:new u.ar(s),u_extrude_scale:new u.b$(s),u_zoom_transition:new u.ar(s),u_merc_center:new u.b$(s),u_tile_id:new u.aq(s)}),collisionCircle:s=>({u_matrix:new u.ap(s),u_inv_matrix:new u.ap(s),u_camera_to_center_distance:new u.ar(s),u_viewport_size:new u.b$(s)}),debug:s=>({u_color:new u.c9(s),u_matrix:new u.ap(s),u_overlay:new u.b_(s),u_overlay_scale:new u.ar(s)}),clippingMask:s=>({u_matrix:new u.ap(s)}),heatmap:s=>({u_extrude_scale:new u.ar(s),u_intensity:new u.ar(s),u_matrix:new u.ap(s),u_inv_rot_matrix:new u.ap(s),u_merc_center:new u.b$(s),u_tile_id:new u.aq(s),u_zoom_transition:new u.ar(s),u_up_dir:new u.aq(s)}),heatmapTexture:s=>({u_image:new u.b_(s),u_color_ramp:new u.b_(s),u_opacity:new u.ar(s)}),hillshade:s=>({u_matrix:new u.ap(s),u_image:new u.b_(s),u_latrange:new u.b$(s),u_light:new u.b$(s),u_shadow:new u.c9(s),u_highlight:new u.c9(s),u_emissive_strength:new u.ar(s),u_accent:new u.c9(s)}),hillshadePrepare:s=>({u_matrix:new u.ap(s),u_image:new u.b_(s),u_dimension:new u.b$(s),u_zoom:new u.ar(s)}),line:u.eF,linePattern:u.eE,raster:s=>({u_matrix:new u.ap(s),u_normalize_matrix:new u.ap(s),u_globe_matrix:new u.ap(s),u_merc_matrix:new u.ap(s),u_grid_matrix:new u.cM(s),u_tl_parent:new u.b$(s),u_scale_parent:new u.ar(s),u_fade_t:new u.ar(s),u_opacity:new u.ar(s),u_image0:new u.b_(s),u_image1:new u.b_(s),u_brightness_low:new u.ar(s),u_brightness_high:new u.ar(s),u_saturation_factor:new u.ar(s),u_contrast_factor:new u.ar(s),u_spin_weights:new u.aq(s),u_perspective_transform:new u.b$(s),u_raster_elevation:new u.ar(s),u_zoom_transition:new u.ar(s),u_merc_center:new u.b$(s),u_cutoff_params:new u.bZ(s),u_colorization_mix:new u.bZ(s),u_colorization_offset:new u.ar(s),u_color_ramp:new u.b_(s),u_texture_offset:new u.b$(s),u_texture_res:new u.b$(s),u_emissive_strength:new u.ar(s),u_zbias_factor:new u.ar(s)}),symbol:s=>({u_is_size_zoom_constant:new u.b_(s),u_is_size_feature_constant:new u.b_(s),u_size_t:new u.ar(s),u_size:new u.ar(s),u_camera_to_center_distance:new u.ar(s),u_rotate_symbol:new u.b_(s),u_aspect_ratio:new u.ar(s),u_fade_change:new u.ar(s),u_matrix:new u.ap(s),u_label_plane_matrix:new u.ap(s),u_coord_matrix:new u.ap(s),u_is_text:new u.b_(s),u_is_sdf:new u.b_(s),u_elevation_from_sea:new u.b_(s),u_pitch_with_map:new u.b_(s),u_texsize:new u.b$(s),u_texsize_icon:new u.b$(s),u_texture:new u.b_(s),u_texture_icon:new u.b_(s),u_gamma_scale:new u.ar(s),u_device_pixel_ratio:new u.ar(s),u_tile_id:new u.aq(s),u_zoom_transition:new u.ar(s),u_inv_rot_matrix:new u.ap(s),u_merc_center:new u.b$(s),u_camera_forward:new u.aq(s),u_tile_matrix:new u.ap(s),u_up_vector:new u.aq(s),u_ecef_origin:new u.aq(s),u_is_halo:new u.b_(s),u_icon_transition:new u.ar(s),u_color_adj_mat:new u.ap(s),u_scale_factor:new u.ar(s),u_ground_shadow_factor:new u.aq(s),u_inv_matrix:new u.ap(s),u_normal_scale:new u.ar(s),u_lutTexture:new u.b_(s),u_spp_fill_np_color:new u.bZ(s),u_spp_halo_np_color:new u.bZ(s),u_spp_opacity:new u.ar(s),u_spp_halo_width:new u.ar(s),u_spp_halo_blur:new u.ar(s),u_spp_emissive_strength:new u.ar(s),u_spp_occlusion_opacity:new u.ar(s),u_spp_z_offset:new u.ar(s),u_spp_translate_rotation:new u.b$(s),u_spp_fill_color_zoom_factor:new u.ar(s),u_spp_halo_color_zoom_factor:new u.ar(s),u_spp_opacity_zoom_factor:new u.ar(s),u_spp_halo_width_zoom_factor:new u.ar(s),u_spp_halo_blur_zoom_factor:new u.ar(s),u_spp_emissive_strength_zoom_factor:new u.ar(s),u_spp_occlusion_opacity_zoom_factor:new u.ar(s),u_spp_z_offset_zoom_factor:new u.ar(s),u_spp_translate_zoom_factor:new u.ar(s),u_spp_zoom_fraction:new u.ar(s),u_opacity_multiplier:new u.ar(s)}),background:s=>({u_matrix:new u.ap(s),u_emissive_strength:new u.ar(s),u_opacity:new u.ar(s),u_color:new u.c9(s)}),backgroundPattern:s=>({u_matrix:new u.ap(s),u_emissive_strength:new u.ar(s),u_opacity:new u.ar(s),u_image:new u.b_(s),u_pattern_tl:new u.b$(s),u_pattern_br:new u.b$(s),u_texsize:new u.b$(s),u_pattern_size:new u.b$(s),u_pixel_coord_upper:new u.b$(s),u_pixel_coord_lower:new u.b$(s),u_pattern_units_to_pixels:new u.b$(s)}),terrainRaster:s=>({u_matrix:new u.ap(s),u_image0:new u.b_(s),u_image1:new u.b_(s),u_skirt_height:new u.ar(s),u_ground_shadow_factor:new u.aq(s),u_emissive_texture_available:new u.ar(s)}),skybox:s=>({u_matrix:new u.ap(s),u_sun_direction:new u.aq(s),u_cubemap:new u.b_(s),u_opacity:new u.ar(s),u_temporal_offset:new u.ar(s)}),skyboxGradient:s=>({u_matrix:new u.ap(s),u_color_ramp:new u.b_(s),u_center_direction:new u.aq(s),u_radius:new u.ar(s),u_opacity:new u.ar(s),u_temporal_offset:new u.ar(s)}),skyboxCapture:s=>({u_matrix_3f:new u.cM(s),u_sun_direction:new u.aq(s),u_sun_intensity:new u.ar(s),u_color_tint_r:new u.bZ(s),u_color_tint_m:new u.bZ(s),u_luminance:new u.ar(s)}),globeRaster:s=>({u_proj_matrix:new u.ap(s),u_globe_matrix:new u.ap(s),u_normalize_matrix:new u.ap(s),u_merc_matrix:new u.ap(s),u_zoom_transition:new u.ar(s),u_merc_center:new u.b$(s),u_image0:new u.b_(s),u_image1:new u.b_(s),u_grid_matrix:new u.cM(s),u_skirt_height:new u.ar(s),u_far_z_cutoff:new u.ar(s),u_frustum_tl:new u.aq(s),u_frustum_tr:new u.aq(s),u_frustum_br:new u.aq(s),u_frustum_bl:new u.aq(s),u_globe_pos:new u.aq(s),u_globe_radius:new u.ar(s),u_viewport:new u.b$(s),u_emissive_texture_available:new u.ar(s)}),globeAtmosphere:s=>({u_frustum_tl:new u.aq(s),u_frustum_tr:new u.aq(s),u_frustum_br:new u.aq(s),u_frustum_bl:new u.aq(s),u_horizon:new u.ar(s),u_transition:new u.ar(s),u_fadeout_range:new u.ar(s),u_atmosphere_fog_color:new u.bZ(s),u_high_color:new u.bZ(s),u_space_color:new u.bZ(s),u_temporal_offset:new u.ar(s),u_horizon_angle:new u.ar(s)}),stars:s=>({u_matrix:new u.ap(s),u_up:new u.aq(s),u_right:new u.aq(s),u_intensity_multiplier:new u.ar(s)}),occlusion:s=>({u_matrix:new u.ap(s),u_anchorPos:new u.aq(s),u_screenSizePx:new u.b$(s),u_occluderSizePx:new u.b$(s),u_color:new u.bZ(s)})};class Jo{constructor(t,n,l,d){this.id=Jo.uniqueIdxCounter,Jo.uniqueIdxCounter++,this.context=t;const p=t.gl;this.buffer=p.createBuffer(),this.dynamicDraw=!!l,this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),p.bufferData(p.ELEMENT_ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?p.DYNAMIC_DRAW:p.STATIC_DRAW),this.dynamicDraw||d||n.destroy()}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(t){this.id=Jo.uniqueIdxCounter,Jo.uniqueIdxCounter++;const n=this.context.gl;this.context.unbindVAO(),this.bind(),n.bufferSubData(n.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}Jo.uniqueIdxCounter=0;const Of={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class Ua{constructor(t,n,l,d,p,m){this.length=n.length,this.attributes=l,this.itemSize=n.bytesPerElement,this.dynamicDraw=d,this.instanceCount=m,this.context=t;const g=t.gl;this.buffer=g.createBuffer(),t.bindVertexBuffer.set(this.buffer),g.bufferData(g.ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?g.DYNAMIC_DRAW:g.STATIC_DRAW),this.dynamicDraw||p||n.destroy()}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(t){const n=this.context.gl;this.bind(),n.bufferSubData(n.ARRAY_BUFFER,0,t.arrayBuffer)}enableAttributes(t,n){for(const l of this.attributes){const d=n.getAttributeLocation(t,l.name);d!==-1&&t.enableVertexAttribArray(d)}}setVertexAttribPointers(t,n,l){for(const d of this.attributes){const p=n.getAttributeLocation(t,d.name);if(p!==-1){const m=d.offset+this.itemSize*(l||0);d.type==="Float32"?t.vertexAttribPointer(p,d.components,t.FLOAT,!1,this.itemSize,m):t.vertexAttribIPointer(p,d.components,t[Of[d.type]],this.itemSize,m)}}}setVertexAttribDivisor(t,n,l){for(let d=0;d<this.attributes.length;d++){const p=n.getAttributeLocation(t,this.attributes[d].name);p!==-1&&this.instanceCount&&this.instanceCount>0&&t.vertexAttribDivisor(p,l)}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class ta{constructor(t,n,l,d,p){this.context=t,this.width=n,this.height=l;const m=this.framebuffer=t.gl.createFramebuffer();d>0&&(this.colorAttachment0=new xn(t,m,0)),d>1&&(this.colorAttachment1=new xn(t,m,1)),p&&(this.depthAttachmentType=p,this.depthAttachment=p==="renderbuffer"?new uo(t,m):new qg(t,m))}static createWithTexture(t,n,l,d,p){const m=t.gl;if(t.activeTexture.set(m.TEXTURE1),t.viewport.set([0,0,l,d]),n&&n.width===l&&n.height===d)return m.bindTexture(m.TEXTURE_2D,n.colorAttachment0.get()),t.bindFramebuffer.set(n.framebuffer),n;n&&n.destroy();const g=t.extRenderToTextureHalfFloat||t.extColorBufferFloat?t.gl.RGBA16F:t.gl.RGBA8,x=new u.T(t,{width:l,height:d,data:null},g);x.bind(m.LINEAR,m.CLAMP_TO_EDGE);const w=t.createFramebuffer(l,d,1,null);if(w.format=g,w.colorAttachment0.set(x.texture),p){const E=t.createRenderbuffer(m.DEPTH24_STENCIL8,l,d);t.bindFramebuffer.set(w.framebuffer),m.framebufferRenderbuffer(m.FRAMEBUFFER,m.DEPTH_STENCIL_ATTACHMENT,m.RENDERBUFFER,E),w._stencilRbo=E}return w}createColorAttachment(t,n){n===0?this.colorAttachment0=new xn(t,this.framebuffer,0):n===1&&(this.colorAttachment1=new xn(t,this.framebuffer,1))}removeColorAttachment(t,n){const l=this.context.gl;let d;n===0?(d=this.colorAttachment0.get(),this.colorAttachment0=void 0):n===1&&(d=this.colorAttachment1.get(),this.colorAttachment1=void 0),d&&l.deleteTexture(d)}destroy(){const t=this.context.gl;if(this.colorAttachment0){const n=this.colorAttachment0.get();n&&t.deleteTexture(n)}if(this.colorAttachment1){const n=this.colorAttachment1.get();n&&t.deleteTexture(n)}if(this.depthAttachment&&this.depthAttachmentType)if(this.depthAttachmentType==="renderbuffer"){const n=this.depthAttachment.get();n&&t.deleteRenderbuffer(n)}else{const n=this.depthAttachment.get();n&&t.deleteTexture(n)}this._stencilRbo&&(t.deleteRenderbuffer(this._stencilRbo),this._stencilRbo=null),t.deleteFramebuffer(this.framebuffer)}}class Ih{constructor(t,n){this.gl=t,this._pendingPrograms=new Set,this._compileStats={precompiled:0,onDemand:0,totalStallMs:0,maxStallMs:0,framesMissed:0,stalls:[]},this.clearColor=new jc(this),this.clearDepth=new _f(this),this.clearStencil=new Gm(this),this.colorMask=new gf(this),this.depthMask=new yf(this),this.stencilMask=new cn(this),this.stencilFunc=new Oa(this),this.stencilOp=new xf(this),this.stencilTest=new ao(this),this.depthRange=new lo(this),this.depthTest=new $l(this),this.depthFunc=new Ba(this),this.blend=new Zl(this),this.blendFunc=new vf(this),this.blendColor=new Kt(this),this.blendEquation=new Qs(this),this.cullFace=new bf(this),this.cullFaceSide=new un(this),this.frontFace=new wf(this),this.program=new co(this),this.activeTexture=new qm(this),this.viewport=new ka(this),this.bindFramebuffer=new Hm(this),this.bindRenderbuffer=new zn(this),this.bindTexture=new Jr(this),this.bindVertexBuffer=new Tf(this),this.bindElementBuffer=new $m(this),this.bindVertexArrayOES=new Ef(this),this.pixelStoreUnpack=new Gg(this),this.pixelStoreUnpackPremultiplyAlpha=new Sf(this),this.pixelStoreUnpackFlipY=new Zm(this),this.options=n?{...n}:{},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=n&&!!n.forceManualRenderingForInstanceIDShaders||this.renderer&&this.renderer.includes("PowerVR"),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,n,l){return new Jo(this,t,n,l)}createVertexBuffer(t,n,l,d,p){return new Ua(this,t,n,l,d,p)}createRenderbuffer(t,n,l){const d=this.gl,p=d.createRenderbuffer();return this.bindRenderbuffer.set(p),d.renderbufferStorage(d.RENDERBUFFER,t,n,l),this.bindRenderbuffer.set(null),p}createFramebuffer(t,n,l,d){return new ta(this,t,n,l,d)}clear({color:t,depth:n,stencil:l,colorMask:d}){const p=this.gl;let m=0;t&&(m|=p.COLOR_BUFFER_BIT,this.clearColor.set(t.toNonPremultipliedRenderColor(null)),this.colorMask.set(d||[!0,!0,!0,!0])),n!==void 0&&(m|=p.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(n),this.depthMask.set(!0)),l!==void 0&&(m|=p.STENCIL_BUFFER_BIT,this.clearStencil.set(l),this.stencilMask.set(255)),p.clear(m)}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){u.b5(t.blendFunction,dt.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 Xl;function $c(s,t,n,l,d,p,m){const g=s.context,x=g.gl,w=s.transform,E=[u.bE(w.center.lng),u.bF(w.center.lat)],A=n.layout.get("symbol-placement"),I=n.layout.get("text-variable-anchor"),M=n.layout.get("icon-rotation-alignment")==="map",D=n.layout.get("text-rotation-alignment")==="map",z=A!=="point",O=[];let k=0,q=0;for(let W=0;W<l.length;W++){const J=l[W],se=t.getTile(J),ue=se.getBucket(n);if(!ue)continue;const he=ue.getProjection().createInversionMatrix(w,J.canonical),ve=[],xe=bs(J,ue,w),Le=!m&&M&&z,_e=m&&D&&z,Pe=I&&ue.hasTextData(),me=ue.hasIconTextFit()&&Pe&&ue.hasIconData(),Re=Le||_e||m&&Pe||me,Me=ue.projection.name==="globe",Ae=Me?u.ah(w.zoom):0;Me&&(ve.push("PROJECTION_GLOBE_VIEW"),Re&&ve.push("PROJECTED_POS_ON_VIEWPORT"));const We=s.getOrCreateProgram("collisionBox",{defines:ve});let ke=xe;d[0]===0&&d[1]===0||(ke=s.translatePosMatrix(xe,se,d,p));const Ue=m?ue.textCollisionBox:ue.iconCollisionBox,je=ue.collisionCircleArray;if(je.length>0){const tt=u.aS(),it=ke;u.bI(tt,ue.placementInvProjMatrix,w.glCoordMatrix),u.bI(tt,tt,ue.placementViewportMatrix),O.push({circleArray:je,circleOffset:q,transform:it,invTransform:tt,projection:ue.getProjection()}),k+=je.length/4,q=k}if(!Ue)continue;s.terrain&&s.terrain.setupElevationDraw(se,We);const et=Me?[J.canonical.x,J.canonical.y,1<<J.canonical.z]:[0,0,0];We.draw(s,x.LINES,nt.disabled,lt.disabled,s.colorModeForRenderPass(),pt.disabled,Df(ke,he,w,Ae,E,se,et,ue.getProjection()),n.id,Ue.layoutVertexBuffer,Ue.indexBuffer,Ue.segments,null,w.zoom,null,[Ue.collisionVertexBuffer,Ue.collisionVertexBufferExt])}if(!m||!O.length)return;const $=s.getOrCreateProgram("collisionCircle"),U=new u.eH;U.resize(4*k),U._trim();let Q=0;for(const W of O)for(let J=0;J<W.circleArray.length/4;J++){const se=4*J,ue=W.circleArray[se+0],he=W.circleArray[se+1],ve=W.circleArray[se+2],xe=W.circleArray[se+3];U.emplace(Q++,ue,he,ve,xe,0),U.emplace(Q++,ue,he,ve,xe,1),U.emplace(Q++,ue,he,ve,xe,2),U.emplace(Q++,ue,he,ve,xe,3)}(!Xl||Xl.length<2*k)&&(Xl=(function(W){const J=2*W,se=new u.cp;se.resize(J),se._trim();for(let ue=0;ue<J;ue++){const he=6*ue;se.uint16[he+0]=4*ue+0,se.uint16[he+1]=4*ue+1,se.uint16[he+2]=4*ue+2,se.uint16[he+3]=4*ue+2,se.uint16[he+4]=4*ue+3,se.uint16[he+5]=4*ue+0}return se})(k));const Y=g.createIndexBuffer(Xl,!0),ae=g.createVertexBuffer(U,u.eI.members,!0);for(const W of O){const J=fo(W.transform,W.invTransform,w,W.projection);$.draw(s,x.TRIANGLES,nt.disabled,lt.disabled,s.colorModeForRenderPass(),pt.disabled,J,n.id,ae,Y,u.cr.simpleSegment(0,2*W.circleOffset,W.circleArray.length,W.circleArray.length/2),null,w.zoom)}ae.destroy(),Y.destroy()}const ja=u.aS();function Zc(s){const t=s._camera.getWorldToCamera(s.worldSize,1),n=u.aP([],t,s.globeMatrix);u.aE(n,n);const l=[0,0,0],d=[0,1,0,0];return u.aO(d,d,n),l[0]=d[0],l[1]=d[1],l[2]=d[2],u.au(l,l),l}function Wm({width:s,height:t,anchor:n,textOffset:l,textScale:d},p){const{horizontalAlign:m,verticalAlign:g}=u.d_(n),x=-(m-.5)*s,w=-(g-.5)*t,E=u.d$(n,l);return new u.P((x/d+E[0])*p,(w/d+E[1])*p)}function Xm(s,t,n,l,d,p,m,g,x,w){const E=s.text.placedSymbolArray,A=s.text.dynamicLayoutVertexArray,I=s.icon.dynamicLayoutVertexArray,M={},D=s.getProjection(),z=Xo(m,D,d),O=d.elevation,k=D.upVectorScale(m.canonical,d.center.lat,d.worldSize).metersToTile;A.clear();for(let q=0;q<E.length;q++){const $=E.get(q),{tileAnchorX:U,tileAnchorY:Q,numGlyphs:Y}=$,ae=$.hidden||!$.crossTileID||s.allowVerticalPlacement&&!$.placedOrientation?null:l[$.crossTileID];if(ae){let W=0,J=0,se=0;const ue=s.elevationType==="road";if(O||ue){const Me=ue&&s.hdExt?s.hdExt.getElevationFeatureForPlacedSymbol(s,s.text,q):null,Ae=u.e6.getAtTileOffset(m,new u.P(U,Q),O,Me),[We,ke,Ue]=D.upVector(m.canonical,U,Q);W=Ae*We*k,J=Ae*ke*k,se=Ae*Ue*k}let[he,ve,xe,Le]=gn($.projectedAnchorX+W,$.projectedAnchorY+J,$.projectedAnchorZ+se,n?z:p);const _e=wl(d.getCameraToCenterDistance(D),Le);let Pe=u.a$(s.textSizeData,x,$)*_e/u.e8;n&&(Pe*=s.tilePixelRatio/g);const me=Wm(ae,Pe);n?({x:he,y:ve,z:xe}=D.projectTilePoint(U+me.x,Q+me.y,m.canonical),[he,ve,xe]=gn(he+W,ve+J,xe+se,p)):(t&&me._rotate(-d.angle),he+=me.x,ve+=me.y,xe=0);const Re=s.allowVerticalPlacement&&$.placedOrientation===u.a_.vertical?Math.PI/2:0;for(let Me=0;Me<Y;Me++)u.b1(A,he,ve,xe,Re);w&&$.associatedIconIndex>=0&&(M[$.associatedIconIndex]={x:he,y:ve,z:xe,angle:Re})}else fs(Y,A)}if(w){I.clear();const q=s.icon.placedSymbolArray;for(let $=0;$<q.length;$++){const U=q.get($),{numGlyphs:Q}=U,Y=M[$];if(U.hidden||!Y)fs(Q,I);else{const{x:ae,y:W,z:J,angle:se}=Y;for(let ue=0;ue<Q;ue++)u.b1(I,ae,W,J,se)}}s.icon.dynamicLayoutVertexBuffer.updateData(I)}s.text.dynamicLayoutVertexBuffer.updateData(A)}function Ah(s,t,n,l,d,p,m={}){const g=n.paint.get("icon-translate"),x=n.paint.get("text-translate"),w=n.paint.get("icon-translate-anchor"),E=n.paint.get("text-translate-anchor"),A=n.layout.get("icon-rotation-alignment"),I=n.layout.get("text-rotation-alignment"),M=n.layout.get("icon-pitch-alignment"),D=n.layout.get("text-pitch-alignment"),z=n.layout.get("icon-keep-upright"),O=n.layout.get("text-keep-upright"),k=n.paint.get("icon-color-saturation"),q=n.paint.get("icon-color-contrast"),$=n.paint.get("icon-color-brightness-min"),U=n.paint.get("icon-color-brightness-max"),Q=n.layout.get("symbol-elevation-reference")==="sea",Y=n.layout.get("icon-image-use-theme")==="none",ae=s.context,W=ae.gl,J=s.transform,se=A==="map",ue=I==="map",he=M==="map",ve=D==="map",xe=n.layout.get("symbol-sort-key").constantOr(1)!==void 0;let Le=!1;const _e=s.depthModeForSublayer(0,nt.ReadOnly),Pe=new nt(s.context.gl.LEQUAL,nt.ReadOnly,s.depthRangeFor3D),me=[u.bE(J.center.lng),u.bF(J.center.lat)],Re=n.layout.get("text-variable-anchor"),Me=J.projection.name==="globe",Ae=[],We=[0,-1,0];for(const ke of l){const Ue=t.getTile(ke),je=Ue.getBucket(n);if(!je||je.projection.name==="mercator"&&Me||je.fullyClipped)continue;const et=je.projection.name==="globe",tt=et?u.ah(J.zoom):0,it=Xo(ke,je.getProjection(),J),at=J.calculatePixelsToTileUnitsMatrix(Ue),bt=Re&&je.hasTextData(),_t=je.hasIconTextFit()&&bt&&je.hasIconData(),Ct=je.getProjection().createInversionMatrix(J,ke.canonical),At=(1<<Ue.tileID.canonical.z)*u.aj/s.transform.worldSize,gt=Lt=>{let Tt=[0,0,0];if(Lt){const li=s.style.directionalLight,ci=s.style.ambientLight;li&&ci&&(Tt=yn(s.style,li,ci))}return Tt},Et=Lt=>{const Tt=Math.floor(s.context.maxUniformBlockSize/4),li=Math.floor(Tt/4);Lt.push(`MAX_UBO_SIZE_VEC4 ${li}u`)},wt=Lt=>{J.depthOcclusionForSymbolsAndCircles&&(n.hasOcclusionOpacityProperties||s.terrain)&&(Lt.push("DEPTH_D24"),Lt.push("DEPTH_OCCLUSION"))},Ot=Lt=>{n.lut&&!Y&&(n.lut.texture||(n.lut.texture=new u.ct(s.context,n.lut.image,[n.lut.image.height,n.lut.image.height,n.lut.image.height],ae.gl.RGBA8)),ae.activeTexture.set(ae.gl.TEXTURE0+10),n.lut.texture&&n.lut.texture.bind(ae.gl.LINEAR,ae.gl.CLAMP_TO_EDGE),Lt.push("APPLY_LUT_ON_GPU"))},Ht=()=>{const Lt=se&&n.layout.get("symbol-placement")!=="point",Tt=[];wt(Tt),Ot(Tt);const li=Lt||_t,ci=je.elevationType==="road",$i=s.shadowRenderer,Ui=ci&&he&&!!$i&&$i.enabled,cr=gt(Ui),pr=ci&&he&&!s.terrain?Pe:_e,Br=n.paint.get("icon-image-cross-fade");s.terrainRenderModeElevated()&&he&&Tt.push("PITCH_WITH_MAP_TERRAIN"),et&&(Tt.push("PROJECTION_GLOBE_VIEW"),li&&Tt.push("PROJECTED_POS_ON_VIEWPORT")),Br>0&&je.hasAnySecondaryIcon&&Tt.push("ICON_TRANSITION"),!je.icon.zOffsetVertexBuffer||ci&&s.terrain||Tt.push("Z_OFFSET"),k===0&&q===0&&$===0&&U===1||Tt.push("COLOR_ADJUSTMENT"),Ui&&Tt.push("RENDER_SHADOWS","NORMAL_OFFSET"),ci&&he&&!s.terrain&&je.icon.orientationVertexBuffer&&Tt.push("ELEVATED_ROADS"),Et(Tt);const Qr=s.getOrCreateProgram("symbol",{defines:Tt}),Ut=Ue.imageAtlasTexture?Ue.imageAtlasTexture.size:[0,0],Ti=je.iconSizeData,Ii=u.aZ(Ti,J.zoom),Ei=he||!J.isOrthographic,Fi=qo(it,Ue.tileID.canonical,he,se,J,je.getProjection(),at),ri=bl(it,Ue.tileID.canonical,he,se,J,je.getProjection(),at),pi=je.icon.uboBinder&&je.icon.uboBinder.hasPerFeatureTranslate()?[0,0]:g,Bt=s.translatePosMatrix(ri,Ue,pi,w,!0),Oi=s.translatePosMatrix(it,Ue,pi,w),Rr=li?ja:Fi,ui=se&&!he&&!Lt;let Fr=We;!Me&&!J.mercatorFromTransition||se||(Fr=Zc(J));const go=et?Fr:We,Ln=n.getColorAdjustmentMatrix(k,q,$,U),hn=Eh(Ti.kind,Ii,ui,he,s,Oi,Rr,Bt,Q,!1,je.sdfIcons,Ut,[0,0],0,ke,tt,me,Ct,go,je.getProjection(),cr,At,Ln,Br,null),Zn=Ue.imageAtlasTexture?Ue.imageAtlasTexture:null,Wn=n.layout.get("icon-size").constantOr(0)!==1||je.iconsNeedLinear,yo=je.sdfIcons||s.options.rotating||s.options.zooming||Wn||Ei?W.LINEAR:W.NEAREST,bn=je.sdfIcons&&n.paint.get("icon-halo-width").constantOr(1)!==0,zo=s.terrain&&he&&Lt?u.aE(u.aS(),Fi):ja;if(Lt&&je.icon){const Qo=u.e6.getAtTileOffsetFunc(ke,J.center.lat,J.worldSize,je.getProjection()),sa=Qt(it,Ue.tileID.canonical,he,se,J,je.getProjection(),at),sp=n.layout.get("icon-size-scale-range"),su=u.as(s.scaleFactor,sp[0],sp[1]);lr(je,it,s,!1,sa,ri,he,z,Qo,ke,su)}return{program:Qr,buffers:je.icon,uniformValues:hn,atlasTexture:Zn,atlasTextureIcon:null,atlasInterpolation:yo,atlasInterpolationIcon:null,isSDF:je.sdfIcons,hasHalo:bn,depthMode:pr,tile:Ue,renderWithShadows:Ui,labelPlaneMatrixInv:zo}},fi=()=>{const Lt=ue&&n.layout.get("symbol-placement")!=="point",Tt=[],li=Lt||Re||_t,ci=je.elevationType==="road",$i=s.shadowRenderer,Ui=ci&&ve&&!!$i&&$i.enabled,cr=gt(Ui),pr=ci&&ve&&!s.terrain?Pe:_e;s.terrainRenderModeElevated()&&ve&&Tt.push("PITCH_WITH_MAP_TERRAIN"),et&&(Tt.push("PROJECTION_GLOBE_VIEW"),li&&Tt.push("PROJECTED_POS_ON_VIEWPORT")),!je.text.zOffsetVertexBuffer||ci&&s.terrain||Tt.push("Z_OFFSET"),je.iconsInText&&Tt.push("RENDER_TEXT_AND_SYMBOL"),Ui&&Tt.push("RENDER_SHADOWS","NORMAL_OFFSET"),ci&&ve&&!s.terrain&&je.text.orientationVertexBuffer&&Tt.push("ELEVATED_ROADS"),wt(Tt),Et(Tt);const Br=s.getOrCreateProgram("symbol",{defines:Tt});let Qr,Ut=[0,0],Ti=null;const Ii=je.textSizeData;je.iconsInText&&(Ut=Ue.imageAtlasTexture?Ue.imageAtlasTexture.size:[0,0],Ti=Ue.imageAtlasTexture?Ue.imageAtlasTexture:null,Qr=ve||!J.isOrthographic||s.options.rotating||s.options.zooming||Ii.kind==="composite"||Ii.kind==="camera"?W.LINEAR:W.NEAREST);const Ei=Ue.glyphAtlasTexture?Ue.glyphAtlasTexture.size:[0,0],Fi=n.layout.get("text-size-scale-range"),ri=u.as(s.scaleFactor,Fi[0],Fi[1]),pi=u.aZ(Ii,J.zoom,ri),Bt=qo(it,Ue.tileID.canonical,ve,ue,J,je.getProjection(),at),Oi=bl(it,Ue.tileID.canonical,ve,ue,J,je.getProjection(),at),Rr=je.text.uboBinder&&je.text.uboBinder.hasPerFeatureTranslate()?[0,0]:x,ui=s.translatePosMatrix(Oi,Ue,Rr,E,!0),Fr=s.translatePosMatrix(it,Ue,Rr,E),go=li?ja:Bt,Ln=ue&&!ve&&!Lt;let hn=We;!Me&&!J.mercatorFromTransition||ue||(hn=Zc(J));const Zn=Eh(Ii.kind,pi,Ln,ve,s,Fr,go,ui,Q,!0,!0,Ei,Ut,0,ke,tt,me,Ct,et?hn:We,je.getProjection(),cr,At,null,null,ri),Wn=Ue.glyphAtlasTexture?Ue.glyphAtlasTexture:null,yo=W.LINEAR,bn=n.paint.get("text-halo-width").constantOr(1)!==0,zo=s.terrain&&ve&&Lt?u.aE(u.aS(),Bt):ja;if(Lt&&je.text){const Qo=u.e6.getAtTileOffsetFunc(ke,J.center.lat,J.worldSize,je.getProjection()),sa=Qt(it,Ue.tileID.canonical,ve,ue,J,je.getProjection(),at);lr(je,it,s,!0,sa,Oi,ve,O,Qo,ke,ri)}return{program:Br,buffers:je.text,uniformValues:Zn,atlasTexture:Wn,atlasTextureIcon:Ti,atlasInterpolation:yo,atlasInterpolationIcon:Qr,isSDF:!0,hasHalo:bn,depthMode:pr,tile:Ue,renderWithShadows:Ui,labelPlaneMatrixInv:zo}},ei=je.icon.segments.get().length,kt=je.text.segments.get().length,gi=ei&&!m.onlyText?Ht():null,si=kt&&!m.onlyIcons?fi():null,Si=n.paint.get("icon-opacity").constantOr(1),Mt=n.paint.get("text-opacity").constantOr(1);if(xe&&je.canOverlap){Le=!0;const Lt=Si&&!m.onlyText?je.icon.segments.get():[],Tt=Mt&&!m.onlyIcons?je.text.segments.get():[];for(const li of Lt)Ae.push({segments:new u.cr([li]),sortKey:li.sortKey,state:gi});for(const li of Tt)Ae.push({segments:new u.cr([li]),sortKey:li.sortKey,state:si})}else m.onlyText||Ae.push({segments:Si?je.icon.segments:new u.cr([]),sortKey:0,state:gi}),m.onlyIcons||Ae.push({segments:Mt?je.text.segments:new u.cr([]),sortKey:0,state:si})}Le&&Ae.sort((ke,Ue)=>ke.sortKey-Ue.sortKey);for(const ke of Ae){const Ue=ke.state;if(Ue)if(s.terrain?s.terrain.setupElevationDraw(Ue.tile,Ue.program,{useDepthForOcclusion:J.depthOcclusionForSymbolsAndCircles,labelPlaneMatrixInv:Ue.labelPlaneMatrixInv}):s.setupDepthForOcclusion(J.depthOcclusionForSymbolsAndCircles,Ue.program),ae.activeTexture.set(W.TEXTURE0),Ue.atlasTexture&&Ue.atlasTexture.bind(Ue.atlasInterpolation,W.CLAMP_TO_EDGE,!0),Ue.atlasTextureIcon&&(ae.activeTexture.set(W.TEXTURE1),Ue.atlasTextureIcon&&Ue.atlasTextureIcon.bind(Ue.atlasInterpolationIcon,W.CLAMP_TO_EDGE,!0)),Ue.renderWithShadows&&s.shadowRenderer.setupShadows(Ue.tile.tileID.toUnwrapped(),Ue.program,"vector-tile"),s.uploadCommonLightUniforms(s.context,Ue.program),Ue.hasHalo){const je=Ue.uniformValues;je.u_is_halo=1,Ch(Ue.buffers,ke.segments,n,s,Ue.program,Ue.depthMode,d,p,je,2),je.u_is_halo=0}else{if(Ue.isSDF){const je=Ue.uniformValues;Ue.hasHalo&&(je.u_is_halo=1,Ch(Ue.buffers,ke.segments,n,s,Ue.program,Ue.depthMode,d,p,je,1)),je.u_is_halo=0}Ch(Ue.buffers,ke.segments,n,s,Ue.program,Ue.depthMode,d,p,Ue.uniformValues,1)}}}function Ch(s,t,n,l,d,p,m,g,x,w){const E=l.context,A=E.gl,I=[s.dynamicLayoutVertexBuffer,s.opacityVertexBuffer,s.iconTransitioningVertexBuffer,s.globeExtVertexBuffer,s.zOffsetVertexBuffer,s.orientationVertexBuffer];s.featureIdBuffer&&I.push(s.featureIdBuffer);const M=s.uboBinder?null:s.programConfigurations.get(n.id);if(s.uboBinder){s.uboBinder.layer=n;const O=l.transform.zoom,k=l.style.getBrightness?l.style.getBrightness():null,q=s.uboBinder.getConstantUniformValues(O,k);x.u_spp_fill_np_color=q.fill_np_color,x.u_spp_halo_np_color=q.halo_np_color,x.u_spp_opacity=q.opacity,x.u_spp_halo_width=q.halo_width,x.u_spp_halo_blur=q.halo_blur,x.u_spp_emissive_strength=q.emissive_strength,x.u_spp_occlusion_opacity=q.occlusion_opacity,x.u_spp_z_offset=q.z_offset;const $=q.zoomFactors;x.u_spp_fill_color_zoom_factor=$[0],x.u_spp_halo_color_zoom_factor=$[1],x.u_spp_opacity_zoom_factor=$[2],x.u_spp_halo_width_zoom_factor=$[3],x.u_spp_halo_blur_zoom_factor=$[4],x.u_spp_emissive_strength_zoom_factor=$[5],x.u_spp_occlusion_opacity_zoom_factor=$[6],x.u_spp_z_offset_zoom_factor=$[7],x.u_spp_translate_zoom_factor=$[8],x.u_spp_zoom_fraction=O-Math.floor(O);const U=n.paint.get(s.uboBinder.isText?"text-translate-anchor":"icon-translate-anchor"),Q=s.uboBinder.hasPerFeatureTranslate()&&U==="map"?l.transform.angle:0;x.u_spp_translate_rotation=[Math.cos(Q),Math.sin(Q)]}const{batchIndices:D,batchSegments:z}=s.getBatchGrouping(t);for(const O of D){const k=z.get(O);s.uboBinder&&s.uboBinder.bind(E,d.program,O),d.draw(l,A.TRIANGLES,p,m,g,pt.disabled,x,n.id,s.layoutVertexBuffer,s.indexBuffer,k,n.paint,l.transform.zoom,M,I,w)}}function Mh(s,t,n,l,d,p){const m=n.paint.get("line-width"),g=n.paint.get("line-emissive-strength").isConstant(),x=n.paint.get("line-emissive-strength").constantOr(0),w=n.paint.get("line-occlusion-opacity"),E=n.layout.get("line-elevation-reference"),A=n.layout.get("line-width-unit")==="meters",I=E==="sea",M=!(!s.terrain||!s.terrain.enabled),D=s.context,z=D.gl;if(n.hasElevatedBuckets&&s.transform.projection.name==="globe")return;const O=n.layout.get("line-cross-slope"),k=O!==void 0,q=O<1,$=d||s.colorModeForDrapableLayerRenderPass(g?x:null),U=s.terrain&&s.terrain.renderingToTexture||p,Q=U?1:u.r.devicePixelRatio,Y=n.paint.get("line-dasharray"),ae=Y.constantOr(1),W=n.layout.get("line-cap"),J=Y.constantOr(null),se=W.constantOr(null),ue=n.paint.get("line-pattern"),he=ue.constantOr(1),ve=n.paint.get("line-pattern-cross-fade"),xe=ue.constantOr(null),Le=n.paint.get("line-opacity").constantOr(1);let _e=!he&&Le!==1||s.depthOcclusion&&w>0&&w<1;const Pe=n.paint.get("line-gradient"),me=he?"linePattern":"line",Re=u.eL(n);let Me;if(U&&s.terrain&&s.terrain.clipOrMaskOverlapStencilType()&&(_e=!1),w!==0&&s.depthOcclusion){const tt=n.paint._values["line-opacity"];tt&&tt.value&&tt.value.kind==="constant"?Me=tt.value:u.w(`Occlusion opacity for layer ${n.id} is supported only when line-opacity isn't data-driven.`)}m.value.kind!=="constant"&&m.value.isLineProgressConstant===!1&&Re.push("VARIABLE_LINE_WIDTH");const Ae=n.paint.get("line-emissive-strength");he||Ae.value.kind==="constant"||Ae.value.isLineProgressConstant!==!1||Re.push("VARIABLE_LINE_EMISSIVE_STRENGTH"),s._debugParams.showElevationIdDebug&&Re.push("DEBUG_ELEVATION_ID"),U&&(s.emissiveMode!=="dual-source-blending"||g?s.emissiveMode==="mrt-fallback"&&Re.push("USE_MRT1"):Re.push("DUAL_SOURCE_BLENDING"));const We={},ke=[],Ue=(tt,it,at,bt,_t,Ct)=>{for(const At of tt){const gt=t.getTile(At);if(he&&!gt.patternsLoaded())continue;const Et=gt.getBucket(n);if(!Et||Et.elevationType!=="none"&&!_t||Et.elevationType==="none"&&_t)continue;s.prepareDrawTile();const wt=[...it],Ot=Et.elevationType==="road",Ht=s.shadowRenderer,fi=Ot&&!!Ht&&Ht.enabled;let ei=[0,0,0];if(fi){const Ut=s.style.directionalLight,Ti=s.style.ambientLight;Ut&&Ti&&(ei=yn(s.style,Ut,Ti)),wt.push("RENDER_SHADOWS","NORMAL_OFFSET")}const kt=Et.programConfigurations.get(n.id);let gi=!1;if(xe&&gt.imageAtlas){const Ut=u.cD.from(xe),Ti=Ut.getPrimary().scaleSelf(Q).toString(),Ii=gt.imageAtlas.patternPositions.get(Ti),Ei=Ut.getSecondary(),Fi=Ei?gt.imageAtlas.patternPositions.get(Ei.scaleSelf(Q).toString()):null;gi=!!Ii&&!!Fi,Ii&&kt.setConstantPatternPositions(Ii,Fi)}ve>0&&(gi||kt.getPatternTransitionVertexBuffer("line-pattern"))&&wt.push("LINE_PATTERN_TRANSITION"),Et.elevationGroundScaleVertexBuffer&&wt.push("ELEVATION_GROUND_SCALE");const si=s.isTileAffectedByFog(At),Si=s.getOrCreateProgram(me,{config:kt,defines:wt,overrideFog:si});if(!he&&J&&se&&gt.lineAtlas){const Ut=gt.lineAtlas.getDash(J,se);Ut&&kt.setConstantPatternPositions(Ut)}fi&&Ht.setupShadows(gt.tileID.toUnwrapped(),Si,"vector-tile");let[Mt,Lt]=n.paint.get("line-trim-offset");(se==="round"||se==="square")&&Mt!==Lt&&(Mt===0&&(Mt-=1),Lt===1&&(Lt+=1));const Tt=U?At.projMatrix:null,li=A?1/Et.tileToMeter/u.c1(gt,1,s.transform.zoom):1,ci=A?1/Et.tileToMeter/u.c1(gt,1,Math.floor(s.transform.zoom)):1,$i=ae?n.paint._values["line-floorwidth"]:null;let Ui;if($i&&$i.value.kind==="constant"){const Ut=Et.zoom;Ut in We||(We[Ut]=Math.max(.01,n.widthExpression().evaluate({zoom:Ut}))),Ui=$i.value.value;const Ti=Math.floor(s.transform.zoom);
3330$i.value.value=We[Ut]*Math.pow(2,Ti-gt.tileID.overscaledZ)}const cr=he?u.eM(s,gt,n,Tt,Q,li,ci,[Mt,Lt],ei,ve):u.eN(s,gt,n,Tt,Et.lineClipsArray.length,Q,li,ci,[Mt,Lt],ei);if(Pe){const Ut=Et.gradients[n.id];let Ti=Ut.texture;if(n.gradientVersion!==Ut.version){let Ii=256;if(n.stepInterpolant){const Fi=t.getSource().maxzoom,ri=At.canonical.z===Fi?Math.ceil(1<<s.transform.maxZoom-At.canonical.z):1;Ii=u.as(u.eO(Et.maxLineLength/u.aj*1024*ri),256,D.maxTextureSize)}const Ei=n.paint.get("line-gradient-use-theme").constantOr("default")==="none";Ut.gradient=u.eP({expression:n.gradientExpression(),evaluationKey:"lineProgress",resolution:Ii,image:Ut.gradient||void 0,clips:Et.lineClipsArray,lut:Ei?null:n.lut}),Ut.texture?Ut.texture.update(Ut.gradient):Ut.texture=new u.T(D,Ut.gradient,z.RGBA8),Ut.version=n.gradientVersion,Ti=Ut.texture}D.activeTexture.set(z.TEXTURE1),Ti.bind(n.stepInterpolant?z.NEAREST:z.LINEAR,z.CLAMP_TO_EDGE)}ae&&(D.activeTexture.set(z.TEXTURE0),gt.lineAtlasTexture&&gt.lineAtlasTexture.bind(z.LINEAR,z.REPEAT),kt.updatePaintBuffers()),he&&(D.activeTexture.set(z.TEXTURE0),gt.imageAtlasTexture&&gt.imageAtlasTexture.bind(z.LINEAR,z.CLAMP_TO_EDGE),kt.updatePaintBuffers()),_t&&!Ot&&s.terrain.setupElevationDraw(gt,Si),s.uploadCommonUniforms(D,Si,At.toUnwrapped());const pr=Ft.drawLineFrcCoverageDetect?Ft.drawLineFrcCoverageDetect(s,Et,At,_t,cr,kt,Si,at,$,ke):null,Br=(Ut,Ti,Ii)=>{Ti&&Ti.get().length!==0&&(Me!=null&&(Me.value=Le*w),Ii!==void 0&&(cr.u_opacity_multiplier=Ii),Si.draw(s,z.TRIANGLES,at,Ut,$,pt.disabled,cr,n.id,Et.layoutVertexBuffer,Et.indexBuffer,Ti,n.paint,s.transform.zoom,kt,[Et.layoutVertexBuffer2,Et.patternVertexBuffer,Et.zOffsetVertexBuffer,Et.elevationIdColVertexBuffer,Et.elevationGroundScaleVertexBuffer]),Ii!==void 0&&(cr.u_opacity_multiplier=1),Me!=null&&(Me.value=Le))},Qr=Ut=>{pr&&pr.active&&Ft.drawLineFrcRenderLine?Ft.drawLineFrcRenderLine(Et,pr,Ut,Br):Br(Ut,Et.segments)};if(_e&&!_t){const Ut=s.stencilModeForClipping(At).ref;Ut===0&&U&&D.clear({stencil:0});const Ti={func:z.EQUAL,mask:255};cr.u_alpha_discard_threshold=.8,Qr(new lt(Ti,Ut,255,z.KEEP,z.KEEP,z.INVERT)),cr.u_alpha_discard_threshold=0,Qr(new lt(Ti,Ut,255,z.KEEP,z.KEEP,z.KEEP))}else cr.u_alpha_discard_threshold=_e&&_t&&Ct?.8:0,Qr(_t?bt:s.stencilModeForClipping(At));pr&&Ft.drawLineFrcFadePass&&Ft.drawLineFrcFadePass(s,Et,At,pr,_t,bt,Br),Ui!==void 0&&($i.value.value=Ui)}};let je=s.depthModeForSublayer(0,nt.ReadOnly);const et=new nt(s.depthOcclusion?z.GREATER:z.LEQUAL,nt.ReadOnly,s.depthRangeFor3D);if(n.hasNonElevatedBuckets){const tt=!U&&s.terrain;w!==0&&tt?u.w(`Occlusion opacity for layer ${n.id} is supported on terrain only if the layer has line-z-offset enabled.`):tt?u.w(`Cannot render non-elevated lines in immediate mode when terrain is enabled. Layer: ${n.id}.`):Ue(l,Re,je,lt.disabled,!1,!0)}if(n.hasElevatedBuckets){E==="hd-road-markup"?M||(je=et,Re.push("ELEVATED_ROADS")):(Re.push("ELEVATED"),je=et,k&&Re.push(q?"CROSS_SLOPE_HORIZONTAL":"CROSS_SLOPE_VERTICAL"),I&&Re.push("ELEVATION_REFERENCE_SEA"));const tt=_e?s.stencilModeFor3D():lt.disabled;E!=="hd-road-markup"&&(s.forceTerrainMode=!0),Ue(l,Re,je,tt,!0,!0),_e&&Ue(l,Re,je,tt,!0,!1),E!=="hd-road-markup"&&(s.forceTerrainMode=!1)}Ft.drawLineFrcCoverageSecondPass&&Ft.drawLineFrcCoverageSecondPass(s,n,ke),_e&&(s.resetStencilClippingMasks(),U&&D.clear({stencil:0})),w===0||s.depthOcclusion||U||s.layersWithOcclusionOpacity.push(s.currentLayer)}class Bf{destroy(){this.fbo&&(this.fbo.destroy(),this.fbo=null),this.drapeFbo&&(this.drapeFbo.destroy(),this.drapeFbo=null)}}class Ym{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 Wc={additive:{clearColor:new u.C(0,0,0,0),colorMode:dt.additiveAlphaWeighted,compositeUniformValue:1},multiply:{clearColor:new u.C(1,1,1,1),colorMode:dt.multiply,compositeUniformValue:0}};function Xc(s){return!(!s.extRenderToTextureHalfFloat&&!s.extColorBufferFloat)}function Ph(s,t){return s==="additive"&&Xc(t)?dt.additiveAlphaWeightedUnboundedAlpha:Wc[s].colorMode}function kf(s,t,n){const l=s.context,d=l.gl;let p=n.width,m=n.height,g=n.colorAttachment0.get();t.lineBlendDensityReadback||(t.lineBlendDensityReadback=new Ym(d));const x=t.lineBlendDensityReadback;let w=0,E=!0;for(;p>1||m>1;){const M=Math.max(1,Math.floor(p/2)),D=Math.max(1,Math.floor(m/2)),z=w===0?"fboA":"fboB";x[z]=ta.createWithTexture(l,x[z],M,D,!1);const O=x[z];l.bindFramebuffer.set(O.framebuffer),l.viewport.set([0,0,M,D]),l.activeTexture.set(d.TEXTURE0),d.bindTexture(d.TEXTURE_2D,g),s.getOrCreateProgram("lineBlendReduce").draw(s,d.TRIANGLES,nt.disabled,lt.disabled,dt.unblended,pt.disabled,Is(0,[1/p,1/m],E),t.id,s.viewportBuffer,s.quadTriangleIndexBuffer,s.viewportSegments,t.paint,s.transform.zoom),p=M,m=D,g=O.colorAttachment0.get(),w=1-w,E=!1}const A=Xc(l),I=A?16:4;x.sync&&(d.deleteSync(x.sync),x.sync=null),d.bindBuffer(d.PIXEL_PACK_BUFFER,x.pbo),d.bufferData(d.PIXEL_PACK_BUFFER,I,d.STREAM_READ),d.readPixels(0,0,1,1,d.RGBA,A?d.FLOAT:d.UNSIGNED_BYTE,0),d.bindBuffer(d.PIXEL_PACK_BUFFER,null),x.sync=d.fenceSync(d.SYNC_GPU_COMMANDS_COMPLETE,0),l.viewport.set([0,0,s.width,s.height])}
vendor: 39,870 bytes, line 3330
3330function Nf(s,t,n){if(!Xc(s.context))return;const l=t.lineBlendDensityReadback;l&&l.sync?((function(d,p,m){if(d.sync&&p.getSyncParameter(d.sync,p.SYNC_STATUS)===p.SIGNALED){if(p.deleteSync(d.sync),d.sync=null,p.bindBuffer(p.PIXEL_PACK_BUFFER,d.pbo),Xc(m)){const g=new Float32Array(4);p.getBufferSubData(p.PIXEL_PACK_BUFFER,0,g);const x=g[1];d.maxDensity=Math.max(2*(x>0?g[0]/x:0),1)}else d.maxDensity=1;p.bindBuffer(p.PIXEL_PACK_BUFFER,null)}})(l,s.context.gl,s.context),l.sync||(kf(s,t,n),s.style.map.triggerRepaint())):(kf(s,t,n),s.style.map.triggerRepaint())}function Vf(s,t,n,l,d,p){const m=s.context,g=m.gl,x=n==="additive"?1:t.paint.get("line-opacity").constantOr(1),w=n==="additive"?(function(A,I){const M=I.paint.get("line-blend-additive-clamp");if(M>0)return M;const D=I.lineBlendDensityReadback;return D&&D.maxDensity!==0?D.maxDensity:null})(0,t):1;if(w===null)return;m.bindFramebuffer.set(d),p&&m.viewport.set([0,0,p[0],p[1]]),m.activeTexture.set(g.TEXTURE0),g.bindTexture(g.TEXTURE_2D,l.colorAttachment0.get());const E=Ph(n,s.context);s.getOrCreateProgram("lineBlendComposite").draw(s,g.TRIANGLES,nt.disabled,lt.disabled,E,pt.disabled,((A,I,M,D)=>({u_image:0,u_opacity:I,u_blend_mode:M,u_max_density:D}))(0,x,Wc[n].compositeUniformValue,w),t.id,s.viewportBuffer,s.quadTriangleIndexBuffer,s.viewportSegments,t.paint,s.transform.zoom)}function Uf(s,t,n,l){const{painter:d,sourceCache:p,layer:m,coords:g,colorMode:x,elevationType:w,terrainEnabled:E,pass:A}=s,I=d.context.gl,M=m.paint.get("fill-pattern"),D=m.paint.get("fill-pattern-cross-fade"),z=M.constantOr(null);let O=w;w!=="road"||t&&!E||(O="none");const k=O==="road",q=s.painter.shadowRenderer,$=k&&!!q&&q.enabled,U=new nt(d.context.gl.LEQUAL,nt.ReadOnly,d.depthRangeFor3D);let Q=[0,0,0];if($){const J=d.style.directionalLight,se=d.style.ambientLight;J&&se&&(Q=yn(d.style,J,se))}const Y=M&&M.constantOr(1),ae=d.terrain&&d.terrain.renderingToTexture,W=(J,se)=>{let ue,he,ve,xe,Le;se?(ue=Y&&!m.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",ve=I.LINES):(ue=Y?"fillPattern":"fill",ve=I.TRIANGLES);const _e=[];for(const Pe of g){const me=p.getTile(Pe);if(Y&&!me.patternsLoaded())continue;const Re=me.getBucket(m);if(!Re)continue;const Me=t?Re.hdExt&&Re.hdExt.elevationBufferData:Re.bufferData;if(!Me||Me.isEmpty())continue;d.prepareDrawTile();const Ae=Me.programConfigurations.get(m.id),We=d.isTileAffectedByFog(Pe),ke=[],Ue=[];k&&(ke.push("ELEVATED_ROADS"),Ue.push(Me.elevatedLayoutVertexBuffer)),$&&ke.push("RENDER_SHADOWS","NORMAL_OFFSET"),ae&&n&&ke.push("USE_MRT1"),Y&&(d.context.activeTexture.set(I.TEXTURE0),me.imageAtlasTexture&&me.imageAtlasTexture.bind(I.LINEAR,I.CLAMP_TO_EDGE),Ae.updatePaintBuffers());let je=!1;if(z&&me.imageAtlas){const Ct=me.imageAtlas,At=u.cD.from(z),gt=At.getPrimary().scaleSelf(u.r.devicePixelRatio).toString(),Et=At.getSecondary(),wt=Ct.patternPositions.get(gt),Ot=Et?Ct.patternPositions.get(Et.scaleSelf(u.r.devicePixelRatio).toString()):null;je=!!wt&&!!Ot,wt&&Ae.setConstantPatternPositions(wt,Ot)}D>0&&(je||Ae.getPatternTransitionVertexBuffer("fill-pattern"))&&ke.push("FILL_PATTERN_TRANSITION");const et=d.getOrCreateProgram(ue,{config:Ae,overrideFog:We,defines:ke}),tt=d.translatePosMatrix(Pe.projMatrix,me,m.paint.get("fill-translate"),m.paint.get("fill-translate-anchor"));$&&q.setupShadows(me.tileID.toUnwrapped(),et,"vector-tile");const it=m.paint.get("fill-emissive-strength");if(se){xe=Me.lineIndexBuffer,Le=Me.lineSegments;const Ct=d.terrain&&d.terrain.renderingToTexture?d.terrain.drapeBufferSize:[I.drawingBufferWidth,I.drawingBufferHeight];he=ue==="fillOutlinePattern"&&Y?Rf(tt,it,d,me,Ct,Q,D):Pf(tt,it,Ct,Q)}else xe=Me.indexBuffer,Le=Me.triangleSegments,he=Y?Hc(tt,it,d,me,Q,D):Va(tt,it,Q);d.uploadCommonUniforms(d.context,et,Pe.toUnwrapped());let at=J;if((w==="road"&&!E||w==="offset")&&(at=U),!Le||Le.get&&Le.get().length===0)continue;const bt=l||d.stencilModeForClipping(Pe);let _t="fallthrough";!se&&Ft.drawFillFrcCoverageFirstPass&&(_t=Ft.drawFillFrcCoverageFirstPass({painter:d,layer:m,bucket:Re,coord:Pe,elevatedGeometry:t,program:et,programConfiguration:Ae,uniformValues:he,drawMode:ve,depthMode:at,stencilMode:bt,colorMode:x,bufferData:Me,indexBuffer:xe,segments:Le,dynamicBuffers:Ue,polygonCoverageTiles:_e})),_t==="fallthrough"&&et.draw(d,ve,at,bt,x,pt.disabled,he,m.id,Me.layoutVertexBuffer,xe,Le,m.paint,d.transform.zoom,Ae,Ue)}!se&&Ft.drawFillFrcCoverageSecondPass&&Ft.drawFillFrcCoverageSecondPass(d,m,_e,ve,x)};d.renderPass===A&&W(d.depthModeForSublayer(1,d.renderPass==="opaque"?nt.ReadWrite:nt.ReadOnly),!1),O==="none"&&d.renderPass==="translucent"&&m.paint.get("fill-antialias")&&W(d.depthModeForSublayer(m.getPaintProperty("fill-outline-color")?2:0,nt.ReadOnly),!0)}function Km(s){return[s[0]*u.eQ,s[1]*u.eQ,s[2]*u.eQ,0]}function jf(s,t,n,l,d,p,m,g,x){const w=l.getSource(),E=n.globeSharedBuffers;if(!E)return;let A,I,M;if(t&&(A=l.getTile(t)),w instanceof so?(I=w.texture,M=u.ev(0,0,n.transform)):A&&t&&(I=A.texture,M=u.ev(t.canonical.z,t.canonical.x,n.transform)),!I||!M)return;s||(M=u.bL(u.aS(),M,[1,-1,1]));const D=n.context,z=D.gl,O=d.paint.get("raster-resampling")==="nearest"?z.NEAREST:z.LINEAR,k=n.colorModeForDrapableLayerRenderPass(p),q=m.defines;q.push("GLOBE_POLES");const $=new nt(z.LEQUAL,nt.ReadWrite,n.depthRangeFor3D),U=n.transform.expandedFarZProjMatrix,Q=Float32Array.from(u.d2(u.dm(new u.bs(0,0,0))));n.terrain&&n.terrain.prepareDrawTile(),D.activeTexture.set(z.TEXTURE0),I.bind(O,z.CLAMP_TO_EDGE),D.activeTexture.set(z.TEXTURE1),I.bind(O,z.CLAMP_TO_EDGE),"useMipmap"in I&&D.extTextureFilterAnisotropic&&n.transform.pitch>20&&z.texParameterf(z.TEXTURE_2D,D.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,D.extTextureFilterAnisotropicMax);const[Y,ae,W,J]=t?E.getPoleBuffers(t.canonical.z,!1):E.getPoleBuffers(0,!0),se=d.paint.get("raster-elevation");let ue;s?(ue=Y,n.renderDefaultNorthPole=se!==0):(ue=ae,n.renderDefaultSouthPole=se!==0);const he=Km(m.mix),ve=((Le,_e,Pe,me,Re,Me,Ae,We,ke,Ue,je,et,tt,it)=>wh(Le,_e,Pe,me,new Float32Array(16),new Float32Array(9),[0,0],Re,[0,0],[0,0,0,0],1,{opacity:1,mix:0},Ae,[0,0],ke,2,je,et,tt,1,0,it))(n,U,Q,M,u.ah(n.transform.zoom),0,d,0,se,0,he,m.offset,m.range,p),xe=n.getOrCreateProgram("raster",{defines:q});n.uploadCommonUniforms(D,xe,null),xe.draw(n,z.TRIANGLES,$,x,k,g,ve,d.id,ue,W,J)}function $g(s){if(s.isOrthographic)return[0,0,0,0];const t=s._nearZ,n=s.projection.farthestPixelDistance(s),l=n-t,d=.2*s.height,p=t+d;return[t,n,(p-d-t)/l,(p-t)/l]}function wi(s,t,n,l){if(s)return t instanceof Mo&&s instanceof Bd?t.getTextureDescriptor(s,n,!0):{texture:s.texture,mix:Km(l.mix),offset:l.offset,buffer:0,tileSize:1}}const Yl=u.aC(new Float32Array(16)),Zg=new u.C(1,0,0,1),Wg=new u.C(0,1,0,1),Xg=new u.C(0,0,1,1),Yc=new u.C(1,0,1,1),Jm=new u.C(0,1,1,1);function Gf(s,t,n,l,d,p,m){const g=s.context,x=s.transform,w=g.gl,E=x.projection.name==="globe",A=E?["PROJECTION_GLOBE_VIEW"]:[];let I=u.aQ(n.projMatrix);if(E&&u.ah(x.zoom)>0){const he=u.d1(n.canonical,x),ve=u.eR(he);I=u.aP(new Float32Array(16),x.globeMatrix,ve),u.aP(I,x.projMatrix,I)}const M=u.aS();M[12]+=2*d/(u.r.devicePixelRatio*x.width),M[13]+=2*p/(u.r.devicePixelRatio*x.height),u.aP(I,M,I);const D=s.getOrCreateProgram("debug",{defines:A}),z=t.getTileByID(n.key);s.terrain&&s.terrain.setupElevationDraw(z,D);const O=nt.disabled,k=lt.disabled,q=s.colorModeForRenderPass(),$="$debug";g.activeTexture.set(w.TEXTURE0),s.emptyTexture.bind(w.LINEAR,w.CLAMP_TO_EDGE),E?z._makeGlobeTileDebugBuffers(s.context,x):z._makeDebugTileBoundsBuffers(s.context,x.projection);const U=z._tileDebugBuffer||s.debugBuffer,Q=z._tileDebugIndexBuffer||s.debugIndexBuffer,Y=z._tileDebugSegments||s.debugSegments;if(D.draw(s,w.LINE_STRIP,O,k,q,pt.disabled,Al(I,l.toPremultipliedRenderColor(null)),$,U,Q,Y,null,null,null,[z._globeTileDebugBorderBuffer]),m){const he=z.latestRawTileData,ve=Math.floor((he&&he.byteLength||0)/1024);let xe=n.canonical.toString();n.overscaledZ!==n.canonical.z&&(xe+=` => ${n.overscaledZ}`),xe+=` ${z.state}`,xe+=` ${ve}kb`,(function(Le,_e){Le.initDebugOverlayCanvas();const Pe=Le.debugOverlayCanvas,me=Le.context.gl,Re=Le.debugOverlayCanvas.getContext("2d");Re.clearRect(0,0,Pe.width,Pe.height),Re.shadowColor="white",Re.shadowBlur=2,Re.lineWidth=1.5,Re.strokeStyle="white",Re.textBaseline="top",Re.font="bold 36px Open Sans, sans-serif",Re.fillText(_e,5,5),Re.strokeText(_e,5,5),Le.debugOverlayTexture.update(Pe),Le.debugOverlayTexture.bind(me.LINEAR,me.CLAMP_TO_EDGE)})(s,xe)}const ae=t.getTile(n).tileSize,W=512/Math.min(ae,512)*(n.overscaledZ/x.zoom)*.5,J=z._tileDebugTextBuffer||s.debugBuffer,se=z._tileDebugTextIndexBuffer||s.quadTriangleIndexBuffer,ue=z._tileDebugTextSegments||s.debugSegments;D.draw(s,w.TRIANGLES,O,k,dt.alphaBlended,pt.disabled,Al(I,u.C.transparent.toPremultipliedRenderColor(null),W),$,J,se,ue,null,null,null,[z._globeTileDebugTextBuffer])}function Kc(s,t,n,l){Ga(s,0,t+n/2,s.transform.width,n,l)}function Ro(s,t,n,l){Ga(s,t-n/2,0,n,s.transform.height,l)}function Ga(s,t,n,l,d,p){const m=s.context,g=m.gl;g.enable(g.SCISSOR_TEST),g.scissor(t*u.r.devicePixelRatio,n*u.r.devicePixelRatio,l*u.r.devicePixelRatio,d*u.r.devicePixelRatio),m.clear({color:p}),g.disable(g.SCISSOR_TEST)}const rr=u.cQ([{name:"a_pos_3f",components:3,type:"Float32"}]),{members:po}=rr;function mo(s,t,n,l){s.emplaceBack(t,n,l)}class Qm{constructor(t){this.vertexArray=new u.eS,this.indices=new u.cp,mo(this.vertexArray,-1,-1,1),mo(this.vertexArray,1,-1,1),mo(this.vertexArray,-1,1,1),mo(this.vertexArray,1,1,1),mo(this.vertexArray,-1,-1,-1),mo(this.vertexArray,1,-1,-1),mo(this.vertexArray,-1,1,-1),mo(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,po),this.indexBuffer=t.createIndexBuffer(this.indices),this.segment=u.cr.simpleSegment(0,0,36,12)}}function ia(s,t,n,l,d,p){const m=s.context.gl,g=t.paint.get("sky-atmosphere-color"),x=t.paint.get("sky-atmosphere-halo-color"),w=t.paint.get("sky-atmosphere-sun-intensity"),E=((A,I,M,D,z)=>({u_matrix_3f:A,u_sun_direction:I,u_sun_intensity:M,u_color_tint_r:[D.r,D.g,D.b,D.a],u_color_tint_m:[z.r,z.g,z.b,z.a],u_luminance:5e-5}))(u.eV(u.c2(),l),d,w,g.toPremultipliedRenderColor(null),x.toPremultipliedRenderColor(null));m.framebufferTexture2D(m.FRAMEBUFFER,m.COLOR_ATTACHMENT0,m.TEXTURE_CUBE_MAP_POSITIVE_X+p,t.skyboxTexture,0),n.draw(s,m.TRIANGLES,nt.disabled,lt.disabled,dt.unblended,pt.frontCW,E,"skyboxCapture",t.skyboxGeometry.vertexBuffer,t.skyboxGeometry.indexBuffer,t.skyboxGeometry.segment)}const e_=u.cQ([{type:"Float32",name:"a_pos",components:3},{type:"Float32",name:"a_uv",components:2}]);class Jc{constructor(t){const n=new u.eW;n.emplaceBack(-1,1,1,0,0),n.emplaceBack(1,1,1,1,0),n.emplaceBack(1,-1,1,1,1),n.emplaceBack(-1,-1,1,0,1);const l=new u.cp;l.emplaceBack(0,1,2),l.emplaceBack(2,3,0),this.vertexBuffer=t.createVertexBuffer(n,e_.members),this.indexBuffer=t.createIndexBuffer(l),this.segments=u.cr.simpleSegment(0,0,4,2)}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy()}}const qf=u.cQ([{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 Hf{constructor(){this.colorModeAlphaBlendedWriteRGB=new dt([1,ms,1,ms],u.C.transparent,[!0,!0,!0,!1]),this.colorModeWriteAlpha=new dt([1,0,1,0],u.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 n=t.context;if(!this.atmosphereBuffer||this.updateNeeded){this.updateNeeded=!1,this.atmosphereBuffer=new Jc(n);let l=this.params;const d=l.sizeRange,p=l.intensityRange,m=(function(A){const I=u.ds(30),M=[];for(let D=0;D<A;++D){const z=2*Math.PI*I(),O=Math.acos(1-2*I())-.5*Math.PI;M.push(u.c6(Math.cos(O)*Math.cos(z),Math.cos(O)*Math.sin(z),Math.sin(O)))}return M})(l.starsCount),g=u.ds(300),x=new u.eX,w=new u.cp;let E=0;for(let A=0;A<m.length;++A){const I=u.av([],m[A],200),M=Math.max(0,1+.01*d*(1*g()-.5)),D=Math.max(0,1+.01*p*(1*g()-.5));x.emplaceBack(I[0],I[1],I[2],-1,-1,M,D),x.emplaceBack(I[0],I[1],I[2],1,-1,M,D),x.emplaceBack(I[0],I[1],I[2],1,1,M,D),x.emplaceBack(I[0],I[1],I[2],-1,1,M,D),w.emplaceBack(E+0,E+1,E+2),w.emplaceBack(E+0,E+2,E+3),E+=4}this.starsVx=n.createVertexBuffer(x,qf.members),this.starsIdx=n.createIndexBuffer(w),this.starsSegments=u.cr.simpleSegment(0,0,x.length,w.length)}}destroy(){this.atmosphereBuffer&&this.atmosphereBuffer.destroy(),this.starsVx&&this.starsVx.destroy(),this.starsIdx&&this.starsIdx.destroy(),this._painter=null}drawAtmosphereGlow(t,n){const l=t.context,d=l.gl,p=t.transform,m=new nt(d.LEQUAL,nt.ReadOnly,[0,1]),g=u.ah(p.zoom),x=t.style.getLut(n.scope),w=n.properties.get("color-use-theme")==="none",E=n.properties.get("color").toNonPremultipliedRenderColor(w?null:x),A=n.properties.get("high-color-use-theme")==="none",I=n.properties.get("high-color").toNonPremultipliedRenderColor(A?null:x),M=n.properties.get("space-color-use-theme")==="none",D=n.properties.get("space-color").toNonPremultipliedRenderColor(M?null:x),z=5e-4,O=u.eY(n.properties.get("horizon-blend"),0,1,z,.25),k=u.eu(t,l,p)&&O===z?p.worldSize/(2*Math.PI*1.025)-1:p.globeRadius,q=t.frameCounter/1e3%1,$=u.ae(p.globeCenterInViewSpace),U=Math.sqrt(Math.pow($,2)-Math.pow(k,2)),Q=Math.acos(U/$),Y=ae=>{const W=p.projection.name==="globe"?["PROJECTION_GLOBE_VIEW","FOG"]:["FOG"];ae&&W.push("ALPHA_PASS");const J=t.getOrCreateProgram("globeAtmosphere",{defines:W}),se=((he,ve,xe,Le,_e,Pe,me,Re,Me,Ae,We,ke)=>({u_frustum_tl:he,u_frustum_tr:ve,u_frustum_br:xe,u_frustum_bl:Le,u_horizon:_e,u_transition:Pe,u_fadeout_range:me,u_atmosphere_fog_color:Re.toArray01(),u_high_color:Me.toArray01(),u_space_color:Ae.toArray01(),u_temporal_offset:We,u_horizon_angle:ke}))(p.frustumCorners.TL,p.frustumCorners.TR,p.frustumCorners.BR,p.frustumCorners.BL,p.frustumCorners.horizon,g,O,E,I,D,q,Q);t.uploadCommonUniforms(l,J);const ue=this.atmosphereBuffer;ue&&J.draw(t,d.TRIANGLES,m,lt.disabled,ae?this.colorModeWriteAlpha:this.colorModeAlphaBlendedWriteRGB,pt.backCW,se,ae?"atmosphere_glow_alpha":"atmosphere_glow",ue.vertexBuffer,ue.indexBuffer,ue.segments)};Y(!1),Y(!0)}drawStars(t,n){const l=u.as(n.properties.get("star-intensity"),0,1);if(l===0)return;const d=t.context,p=d.gl,m=t.transform,g=t.getOrCreateProgram("stars"),x=u.az([]);u.aB(x,x,-m._pitch),u.aA(x,x,-m.angle),u.aB(x,x,u.al(m._center.lat)),u.eZ(x,x,-u.al(m._center.lng));const w=u.aI(new Float32Array(16),x),E=u.aP([],m.starsProjMatrix,w),A=u.eV([],w),I=u.e_([],A);let M=this.params.sizeMultiplier;const D=[0,1,0];u.c4(D,D,I),u.av(D,D,M);const z=[1,0,0];u.c4(z,z,I),u.av(z,z,M);const O=(k=D,q=z,$=l,{u_matrix:Float32Array.from(E),u_up:k,u_right:q,u_intensity_multiplier:$});var k,q,$;t.uploadCommonUniforms(d,g),this.starsVx&&this.starsIdx&&g.draw(t,p.TRIANGLES,nt.disabled,lt.disabled,this.colorModeAlphaBlendedWriteRGB,pt.disabled,O,"atmosphere_stars",this.starsVx,this.starsIdx,this.starsSegments)}}class Rh{}class Dh{constructor(){this._storage=new Map}getLinesFromTrianglesBuffer(t,n,l){{const A=this._storage.get(n.id);if(A)return A.lastUsedFrameIdx=t,A.buf}const d=l.gl,p=d.getBufferParameter(d.ELEMENT_ARRAY_BUFFER,d.BUFFER_SIZE),m=new ArrayBuffer(p),g=new Int16Array(m);d.getBufferSubData(d.ELEMENT_ARRAY_BUFFER,0,new Int16Array(m));const x=new u.e$;for(let A=0;A<p/2;A+=3){const I=g[A],M=g[A+1],D=g[A+2];x.emplaceBack(I,M),x.emplaceBack(M,D),x.emplaceBack(D,I)}const w=l.bindVertexArrayOES.current,E=new Rh;return E.buf=new Jo(l,x),E.lastUsedFrameIdx=t,this._storage.set(n.id,E),l.bindVertexArrayOES.set(w),E.buf}update(t){for(const[n,l]of this._storage)t-l.lastUsedFrameIdx>30&&(l.buf.destroy(),this._storage.delete(n))}destroy(){for(const[t,n]of this._storage)n.buf.destroy(),this._storage.delete(t)}}class Qc{constructor(){this.occluderSize=30,this.depthOffset=-1e-4}}const Gn={symbol:function(s,t,n,l,d){if(s.renderPass!=="translucent")return;const p=lt.disabled,m=s.colorModeForRenderPass(),g=n.layout.get("text-variable-anchor"),x=n.layout.get("text-size-scale-range"),w=u.as(s.scaleFactor,x[0],x[1]);g&&(function(I,M,D,z,O,k,q,$){const U=M.transform,Q=O==="map",Y=k==="map";for(const ae of I){const W=z.getTile(ae),J=W.getBucket(D);if(!J||!J.text||!J.text.segments.get().length)continue;const se=u.aZ(J.textSizeData,U.zoom,$),ue=Xo(ae,J.getProjection(),U),he=U.calculatePixelsToTileUnitsMatrix(W),ve=qo(ue,W.tileID.canonical,Y,Q,U,J.getProjection(),he),xe=J.hasIconTextFit()&&J.hasIconData();se&&Xm(J,Q,Y,q,U,ve,ae,Math.pow(2,U.zoom-W.tileID.overscaledZ),se,xe)}})(l,s,n,t,n.layout.get("text-rotation-alignment"),n.layout.get("text-pitch-alignment"),d,w);const E=n.paint.get("icon-opacity").constantOr(1)!==0,A=n.paint.get("text-opacity").constantOr(1)!==0;n.layout.get("symbol-sort-key").constantOr(1)!==void 0&&(E||A)?Ah(s,t,n,l,p,m):(E&&Ah(s,t,n,l,p,m,{onlyIcons:!0}),A&&Ah(s,t,n,l,p,m,{onlyText:!0})),t.map.showCollisionBoxes&&($c(s,t,n,l,n.paint.get("text-translate"),n.paint.get("text-translate-anchor"),!0),$c(s,t,n,l,n.paint.get("icon-translate"),n.paint.get("icon-translate-anchor"),!1))},circle:function(s,t,n,l){if(s.renderPass!=="translucent")return;const d=n.paint.get("circle-opacity"),p=n.paint.get("circle-stroke-width"),m=n.paint.get("circle-stroke-opacity"),g=n.layout.get("circle-sort-key").constantOr(1)!==void 0,x=n.paint.get("circle-emissive-strength");if(d.constantOr(1)===0&&(p.constantOr(1)===0||m.constantOr(1)===0))return;const w=s.context,E=w.gl,A=s.transform,I=!(!s.terrain||!s.terrain.enabled),M=n.layout.get("circle-elevation-reference"),D=s.depthModeForSublayer(0,nt.ReadOnly),z=new nt(s.context.gl.LEQUAL,nt.ReadOnly,s.depthRangeFor3D),O=M==="none"||I?D:z,k=lt.disabled,q=s.colorModeForDrapableLayerRenderPass(x),$=A.projection.name==="globe",U=[u.bE(A.center.lng),u.bF(A.center.lat)],Q=[];for(let ae=0;ae<l.length;ae++){const W=l[ae],J=t.getTile(W),se=J.getBucket(n);if(!se||se.projection.name!==A.projection.name)continue;const ue=se.programConfigurations.get(n.id),he=se.layoutVertexBuffer,ve=se.globeExtVertexBuffer,xe=se.indexBuffer,Le=u.eJ(n),_e=[ve],Pe=s.isTileAffectedByFog(W);$&&Le.push("PROJECTION_GLOBE_VIEW"),Le.push("DEPTH_D24"),s.terrain&&A.depthOcclusionForSymbolsAndCircles&&Le.push("DEPTH_OCCLUSION"),se.hdExt&&se.hdExt.hasElevation&&!s.terrain&&(Le.push("ELEVATED_ROADS"),_e.push(se.hdExt.elevatedLayoutVertexBuffer));const me=s.getOrCreateProgram("circle",{config:ue,defines:Le,overrideFog:Pe}),Re=A.projection.createInversionMatrix(A,W.canonical),Me={programConfiguration:ue,program:me,layoutVertexBuffer:he,dynamicBuffers:_e,indexBuffer:xe,uniformValues:u.eK(s,W,J,Re,U,n),tile:J};if(g){const Ae=se.segments.get();for(const We of Ae)Q.push({segments:new u.cr([We]),sortKey:We.sortKey,state:Me})}else Q.push({segments:se.segments,sortKey:0,state:Me})}g&&Q.sort((ae,W)=>ae.sortKey-W.sortKey);const Y={useDepthForOcclusion:A.depthOcclusionForSymbolsAndCircles};for(const ae of Q){const{programConfiguration:W,program:J,layoutVertexBuffer:se,dynamicBuffers:ue,indexBuffer:he,uniformValues:ve,tile:xe}=ae.state,Le=ae.segments;s.terrain&&s.terrain.setupElevationDraw(xe,J,Y),s.uploadCommonUniforms(w,J,xe.tileID.toUnwrapped()),J.draw(s,E.TRIANGLES,O,k,q,pt.disabled,ve,n.id,se,he,Le,n.paint,A.zoom,W,ue)}},heatmap:function(s,t,n,l){if(n.paint.get("heatmap-opacity")!==0)if(s.renderPass==="offscreen"){const d=s.context,p=d.gl,m=lt.disabled,g=new dt([p.ONE,p.ONE,p.ONE,p.ONE],u.C.transparent,[!0,!0,!0,!0]),x=s.transform.projection.name==="globe"?.5:.25;n.heatmapFbo=ta.createWithTexture(d,n.heatmapFbo,s.width*x,s.height*x),d.clear({color:u.C.transparent});const w=s.transform,E=w.projection.name==="globe",A=E?["PROJECTION_GLOBE_VIEW"]:[],I=E?pt.frontCCW:pt.disabled,M=[u.bE(w.center.lng),u.bF(w.center.lat)];for(let D=0;D<l.length;D++){const z=l[D];if(t.hasRenderableParent(z))continue;const O=t.getTile(z),k=O.getBucket(n);if(!k||k.projection.name!==w.projection.name)continue;const q=s.isTileAffectedByFog(z),$=k.programConfigurations.get(n.id),U=s.getOrCreateProgram("heatmap",{config:$,defines:A,overrideFog:q}),{zoom:Q}=s.transform;s.terrain&&s.terrain.setupElevationDraw(O,U),s.uploadCommonUniforms(d,U,z.toUnwrapped());const Y=w.projection.createInversionMatrix(w,z.canonical);U.draw(s,p.TRIANGLES,nt.disabled,m,g,I,bh(s,z,O,Y,M,Q,n.paint.get("heatmap-intensity")),n.id,k.layoutVertexBuffer,k.indexBuffer,k.segments,n.paint,s.transform.zoom,$,E?[k.globeExtVertexBuffer]:null)}d.viewport.set([0,0,s.width,s.height])}else s.renderPass==="translucent"&&(s.context.setColorMode(s.colorModeForRenderPass()),(function(d,p){const m=d.context,g=m.gl,x=p.heatmapFbo;if(!x)return;m.activeTexture.set(g.TEXTURE0),g.bindTexture(g.TEXTURE_2D,x.colorAttachment0.get()),m.activeTexture.set(g.TEXTURE1);let w=p.colorRampTexture;w||(w=p.colorRampTexture=new u.T(m,p.colorRamp,g.RGBA8)),w.bind(g.LINEAR,g.CLAMP_TO_EDGE),d.getOrCreateProgram("heatmapTexture").draw(d,g.TRIANGLES,nt.disabled,lt.disabled,d.colorModeForRenderPass(),pt.disabled,((E,A)=>({u_image:0,u_color_ramp:1,u_opacity:A.paint.get("heatmap-opacity")}))(0,p),p.id,d.viewportBuffer,d.quadTriangleIndexBuffer,d.viewportSegments,p.paint,d.transform.zoom)})(s,n))},line:function(s,t,n,l){const d=n.paint.get("line-opacity"),p=n.paint.get("line-width");if(d.constantOr(1)===0||p.constantOr(1)===0)return;const m=n.paint.get("line-blend-mode"),g=s.terrain&&s.terrain.renderingToTexture;if(m==="default"||s.transform.projection.name==="globe")s.renderPass==="translucent"&&Mh(s,t,n,l);else{if(g)return void(function(x,w,E,A,I){if(x.renderPass!=="translucent")return;const M=x.context,D=M.gl,z=x.terrain;if(!z)return;const O=M.bindFramebuffer.current,k=x.emissiveMode==="mrt-fallback",q=z.drapeBufferSize[0],$=z.drapeBufferSize[1];E.lineBlendFbos||(E.lineBlendFbos=new Bf),E.lineBlendFbos.drapeFbo=ta.createWithTexture(M,E.lineBlendFbos.drapeFbo,q,$,!0),k&&D.drawBuffers([D.COLOR_ATTACHMENT0]),M.clear({color:Wc[I].clearColor,depth:1,stencil:0});const U=x.currentStencilSource,Q=x._tileClippingMaskIDs,Y=x.nextStencilID;x.currentStencilSource=void 0,x._tileClippingMaskIDs={},x.nextStencilID=1;const ae=x._terrain;x._terrain=null,x._renderTileClippingMasks(E,w,A),Mh(x,w,E,A,Ph(I,x.context),!0),x._terrain=ae,x.currentStencilSource=U,x._tileClippingMaskIDs=Q,x.nextStencilID=Y,k&&D.drawBuffers([D.COLOR_ATTACHMENT0,D.COLOR_ATTACHMENT1]);const W=z.drapeBufferSize,J=E.lineBlendFbos&&E.lineBlendFbos.drapeFbo;J&&(I==="additive"&&Nf(x,E,J),Vf(x,E,I,J,O,W))})(s,t,n,l,m);if(s.renderPass==="offscreen")return void(function(x,w,E,A,I){const M=x.context,D=Math.ceil(x.width),z=Math.ceil(x.height);E.lineBlendFbos||(E.lineBlendFbos=new Bf),E.lineBlendFbos.fbo=ta.createWithTexture(M,E.lineBlendFbos.fbo,D,z,!0),M.clear({color:Wc[I].clearColor,depth:1,stencil:0});const O=x.currentStencilSource,k=x._tileClippingMaskIDs,q=x.nextStencilID;x.currentStencilSource=void 0,x._tileClippingMaskIDs={},x.nextStencilID=1,x._renderTileClippingMasks(E,w,A);const $=x.renderPass;x.renderPass="translucent",Mh(x,w,E,A,Ph(I,x.context)),x.renderPass=$,x.currentStencilSource=O,x._tileClippingMaskIDs=k,x.nextStencilID=q,M.viewport.set([0,0,x.width,x.height]),I==="additive"&&Nf(x,E,E.lineBlendFbos.fbo)})(s,t,n,l,m);if(s.renderPass==="translucent"){const x=n.lineBlendFbos&&n.lineBlendFbos.fbo;return void(x&&Vf(s,n,m,x,null))}}},fill:function(s,t,n,l){const d=n.paint.get("fill-color"),p=n.paint.get("fill-opacity");if(p.constantOr(1)===0)return;const m=n.paint.get("fill-emissive-strength"),g=s.colorModeForDrapableLayerRenderPass(m),x=n.paint.get("fill-pattern"),w=s.opaquePassEnabledForLayer()&&!x.constantOr(1)&&d.constantOr(u.C.transparent).a===1&&p.constantOr(0)===1?"opaque":"translucent";let E="none";n.layout.get("fill-elevation-reference")!=="none"?E="road":n.paint.get("fill-z-offset").constantOr(1)!==0&&(E="offset");const A=!(!s.terrain||!s.terrain.enabled),I={painter:s,sourceCache:t,layer:n,coords:l,colorMode:g,elevationType:E,terrainEnabled:A,pass:w};if(s.renderPass==="shadow")return void(s.shadowRenderer&&E==="road"&&!A&&Ft.drawElevatedFillShadows&&Ft.drawElevatedFillShadows(I));const M=s.emissiveMode==="mrt-fallback";if(E!=="offset"){if(Uf(I,!1,M),E==="road"){const D=!A&&s.renderPass==="translucent";D&&Ft.drawDepthPrepass&&Ft.drawDepthPrepass(s,t,n,l,"geometry"),Uf(I,!0,M,lt.disabled),D&&Ft.drawElevatedStructures&&Ft.drawElevatedStructures(I)}}else Uf(I,!1,M,s.stencilModeFor3D())},"fill-extrusion":function(s,t,n,l){const d=n.paint.get("fill-extrusion-opacity"),p=s.context,m=p.gl,g=s.terrain,x=g&&g.renderingToTexture;if(d===0)return;const w=s.emissiveMode==="mrt-fallback",E=s.conflationActive&&s.style.isLayerClipped(n,t.getSource()),A=s.style.order.indexOf(n.fqid);if(E&&(function(I,M,D,z,O){for(const k of z){const q=M.getTile(k).getBucket(D);q&&(q.updateReplacement(k,I.replacementSource,O),q.uploadCentroid(I.context))}})(s,t,n,l,A),g||E)for(const I of l){const M=t.getTile(I).getBucket(n);M&&zd(s.context,t,I,M,n,g,E)}if(s.renderPass==="shadow"&&s.shadowRenderer){if(g&&d<.65&&n._transitionablePaint._values["fill-extrusion-opacity"].value.expression instanceof u.ab)return;const I=s.shadowRenderer.getShadowPassDepthMode();qu(s,t,n,l,I,lt.disabled,dt.disabled,E)}else if(s.renderPass==="translucent"){const I=!n.paint.get("fill-extrusion-pattern").constantOr(1),M=n.paint.get("fill-extrusion-color").constantOr(u.C.white);if(!x&&M.a!==0){const z=new nt(s.context.gl.LEQUAL,nt.ReadWrite,s.depthRangeFor3D);d===1&&I?qu(s,t,n,l,z,lt.disabled,dt.unblended,E):(qu(s,t,n,l,z,lt.disabled,dt.disabled,E),qu(s,t,n,l,z,s.stencilModeFor3D(),s.colorModeForRenderPass(),E),s.resetStencilClippingMasks())}const D=s.style.enable3dLights()&&I&&(!g&&s.transform.projection.name!=="globe"||x);if(D&&!Cn.drawGroundEffect&&Dd(),D&&Cn.drawGroundEffect){const z=n.paint.get("fill-extrusion-opacity"),O=n.paint.get("fill-extrusion-ambient-occlusion-intensity"),k=n.paint.get("fill-extrusion-ambient-occlusion-ground-radius"),q=n.paint.get("fill-extrusion-flood-light-intensity"),$=n.paint.get("fill-extrusion-flood-light-color-use-theme").constantOr("default")==="none",U=n.paint.get("fill-extrusion-flood-light-color").toNonPremultipliedRenderColor($?null:n.lut).toArray01().slice(0,3),Q=O>0&&k>0,Y=q>0,ae=new Hu;ae.translate=n.paint.get("fill-extrusion-translate"),ae.translateAnchor=n.paint.get("fill-extrusion-translate-anchor"),ae.edgeRadius=n.layout.get("fill-extrusion-edge-radius"),ae.cutoffFadeRange=n.paint.get("fill-extrusion-cutoff-fade-range");const W=J=>{const se=s.depthModeForSublayer(1,nt.ReadOnly,m.LEQUAL,!0),ue=n.paint.get(J?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),he=u.ai(.1,3,ue),ve=s._showOverdrawInspector;if(!ve){const xe=new lt({func:m.ALWAYS,mask:255},255,255,m.KEEP,m.KEEP,m.REPLACE),Le=new dt([m.ONE,m.ONE,m.ONE,m.ONE],u.C.transparent,[!1,!1,!1,!0],m.MIN);Cn.drawGroundEffect(ae,s,t,n,l,se,xe,Le,pt.disabled,J,"sdf",z,O,k,q,U,he,E,!1)}{const xe=ve?lt.disabled:new lt({func:m.EQUAL,mask:255},255,255,m.KEEP,m.DECR,m.DECR),Le=ve?s.colorModeForRenderPass():new dt([m.ONE_MINUS_DST_ALPHA,m.DST_ALPHA,m.ONE,m.ONE],u.C.transparent,[!0,!0,!0,!0]);Cn.drawGroundEffect(ae,s,t,n,l,se,xe,Le,pt.disabled,J,"color",z,O,k,q,U,he,E,!1)}};if(x){const J=()=>{const ue=g.drapeBufferSize[0],he=g.drapeBufferSize[1];let ve=g.framebufferCopyTexture;return ve&&(!ve||ve.size[0]===ue&&ve.size[1]===he)||(ve&&ve.destroy(),ve=g.framebufferCopyTexture=new u.T(p,new u.t({width:ue,height:he}),m.RGBA8)),ve.bind(m.LINEAR,m.CLAMP_TO_EDGE),m.copyTexSubImage2D(m.TEXTURE_2D,0,0,0,0,0,ue,he),ve},se=(ue,he,ve)=>{const xe=s.depthModeForSublayer(1,nt.ReadOnly,m.LEQUAL,!1),Le=n.paint.get(ue?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),_e=u.ai(.1,3,Le);{const Pe=new dt([m.ONE,m.ONE,m.ONE,m.ONE],u.C.transparent,[!1,!1,!1,!0]);Cn.drawGroundEffect(ae,s,t,n,l,xe,lt.disabled,Pe,pt.disabled,ue,"clear",z,O,k,q,U,_e,E,he)}{const Pe=new lt({func:m.ALWAYS,mask:255},255,255,m.KEEP,m.KEEP,m.REPLACE),me=new dt([m.ONE,m.ONE,m.ONE,m.ONE],u.C.transparent,[!1,!1,!1,!0],m.MIN);Cn.drawGroundEffect(ae,s,t,n,l,xe,Pe,me,pt.disabled,ue,"sdf",z,O,k,q,U,_e,E,he)}w&&!ue&&(ve=J());{const Pe=ue?m.ZERO:m.ONE_MINUS_DST_ALPHA,me=new lt({func:m.EQUAL,mask:255},255,255,m.KEEP,m.DECR,m.DECR),Re=new dt([Pe,m.DST_ALPHA,m.ONE_MINUS_DST_ALPHA,m.ZERO],u.C.transparent,[!0,!0,!0,!0]);Cn.drawGroundEffect(ae,s,t,n,l,xe,me,Re,pt.disabled,ue,"color",z,O,k,q,U,_e,E,he)}if(!w||ue){const Pe=new dt([m.ONE,m.ONE,m.ONE,ue?m.ZERO:m.ONE],u.C.transparent,[!1,!1,!1,!0],ue?m.FUNC_ADD:m.MAX);Cn.drawGroundEffect(ae,s,t,n,l,xe,lt.disabled,Pe,pt.disabled,ue,"clear",z,O,k,q,U,_e,E,he,ve)}else{m.drawBuffers([m.NONE,m.COLOR_ATTACHMENT1]);const Pe=new lt({func:m.EQUAL,mask:255},254,255,m.KEEP,m.DECR,m.DECR),me=new dt([m.ONE,m.ONE,m.ONE,m.ONE],u.C.transparent,[!0,!1,!1,!1],m.MAX);Cn.drawGroundEffect(ae,s,t,n,l,xe,Pe,me,pt.disabled,ue,"emissive",z,O,k,q,U,_e,E,he,ve),m.drawBuffers([m.COLOR_ATTACHMENT0])}};if(Q||Y){let ue;s.prepareDrawTile(),w&&!Q||(ue=J()),Q&&se(!0,!1,ue),Y&&se(!1,!0,ue)}}else Q&&W(!0),Y&&W(!1),(Q||Y)&&s.resetStencilClippingMasks()}}},hillshade:function(s,t,n,l){if(s.renderPass!=="offscreen"&&s.renderPass!=="translucent"||s.style.disableElevatedTerrain)return;const d=s.context,p=s.terrain&&s.terrain.renderingToTexture,[m,g]=s.renderPass!=="translucent"||p?[{},l]:s.stencilConfigForOverlap(l);for(const x of g){const w=t.getTile(x);if(w.needsHillshadePrepare&&s.renderPass==="offscreen")jm(s,w,n);else if(s.renderPass==="translucent"){const E=s.depthModeForSublayer(0,nt.ReadOnly),A=n.paint.get("hillshade-emissive-strength"),I=s.colorModeForDrapableLayerRenderPass(A),M=p&&s.terrain?s.terrain.stencilModeForRTTOverlap(x):m[x.overscaledZ];yh(s,x,w,n,E,M,I)}}d.viewport.set([0,0,s.width,s.height]),s.resetStencilClippingMasks()},raster:function(s,t,n,l,d,p){if(s.renderPass!=="translucent")return;const m=n.paint.get("raster-opacity");if(m===0)return;const g=s.transform.projection.name==="globe",x=n.paint.get("raster-elevation")!==0,w=x&&g,E=s.terrain&&s.terrain.exaggeration()>0&&x&&n.paint.get("raster-elevation-reference")==="ground",A=!g&&E;if(s.renderElevatedRasterBackface&&!w)return;const I=s.context,M=I.gl,D=t.getSource(),z=(function(J,se,ue,he,ve){const xe=se.paint.get("raster-color"),Le=J.type==="raster-array",_e=[],Pe=se.paint.get("raster-resampling"),me=se.paint.get("raster-color-mix");let Re=se.paint.get("raster-color-range");const Me=[me[0],me[1],me[2],0],Ae=me[3];let We=Pe==="nearest"?he.NEAREST:he.LINEAR;if(Le&&(_e.push("RASTER_ARRAY"),xe||_e.push("RASTER_COLOR"),Pe==="linear"&&_e.push("RASTER_ARRAY_LINEAR"),We=he.NEAREST,!Re&&J.rasterLayers)){const ke=J.rasterLayers.find(({id:Ue})=>Ue===se.sourceLayer);ke&&ke.fields&&ke.fields.range&&(Re=ke.fields.range)}if(Re=Re||[0,1],xe){_e.push("RASTER_COLOR"),ue.activeTexture.set(he.TEXTURE2),se.updateColorRamp(Re);let ke=se.colorRampTexture;ke||(ke=se.colorRampTexture=new u.T(ue,se.colorRamp,he.RGBA8)),ke.bind(We,he.CLAMP_TO_EDGE)}return ve&&_e.push("USE_MRT1"),{mix:Me,range:Re,offset:Ae,defines:_e,resampling:We}})(D,n,I,M,s.terrain&&s.terrain.renderingToTexture&&s.emissiveMode==="mrt-fallback");if(D instanceof so&&!l.length&&!g)return;const O=n.paint.get("raster-emissive-strength"),k=s.colorModeForDrapableLayerRenderPass(O),q=s.terrain&&s.terrain.renderingToTexture,$=!s.options.moving,U=n.paint.get("raster-resampling")==="nearest"?M.NEAREST:M.LINEAR;if(D instanceof so&&!l.length&&(D.onNorthPole||D.onSouthPole)){const J=x?s.stencilModeFor3D():lt.disabled;return void jf(!!D.onNorthPole,null,s,t,n,O,z,pt.disabled,J)}if(!l.length)return;const[Q,Y]=D instanceof so||q?[{},l]:s.stencilConfigForOverlap(l),ae=Y.at(-1).overscaledZ;w&&z.defines.push("PROJECTION_GLOBE_VIEW"),x&&z.defines.push("RENDER_CUTOFF","ELEVATED"),E&&z.defines.push("ELEVATION_REFERENCE_GROUND");const W=(J,se,ue)=>{for(const he of J){const ve=he.toUnwrapped(),xe=t.getTile(he);if(q&&(!xe||!xe.hasData()))continue;I.activeTexture.set(M.TEXTURE0);const Le=wi(xe,D,n,z);if(!Le||!Le.texture)continue;const{texture:_e,mix:Pe,offset:me,tileSize:Re,buffer:Me}=Le;let Ae,We;q?(Ae=nt.disabled,We=he.projMatrix):x?(Ae=new nt(M.LEQUAL,nt.ReadWrite,s.depthRangeFor3D),We=g?s.transform.expandedFarZProjMatrix:s.transform.calculateProjMatrix(ve,$)):(Ae=s.depthModeForSublayer(he.overscaledZ-ae,m===1?nt.ReadWrite:nt.ReadOnly,M.LESS),We=s.transform.calculateProjMatrix(ve,$));const ke=s.terrain&&q?s.terrain.stencilModeForRTTOverlap(he):Q[he.overscaledZ],Ue=p?0:n.paint.get("raster-fade-duration");xe.registerFadeDuration(Ue);const je=t.findLoadedParent(he,0),et=Yu(xe,je,t,s.transform,Ue);let tt,it;!et.isFading&&xe.refreshedUponExpiration&&(xe.refreshedUponExpiration=!1),s.terrain&&s.terrain.prepareDrawTile(),I.activeTexture.set(M.TEXTURE0),_e.bind(U,M.CLAMP_TO_EDGE),I.activeTexture.set(M.TEXTURE1),je?(je.texture&&je.texture.bind(U,M.CLAMP_TO_EDGE),tt=Math.pow(2,je.tileID.overscaledZ-xe.tileID.overscaledZ),it=[xe.tileID.canonical.x*tt%1,xe.tileID.canonical.y*tt%1]):_e.bind(U,M.CLAMP_TO_EDGE),"useMipmap"in _e&&I.extTextureFilterAnisotropic&&s.transform.pitch>20&&M.texParameterf(M.TEXTURE_2D,I.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,I.extTextureFilterAnisotropicMax);const at=s.transform;let bt;const _t=x?$g(at):[0,0,0,0];let Ct,At,gt,Et,wt,Ot=0;if(w&&D instanceof so&&D.coordinates.length>3)Ct=Float32Array.from(u.d2(u.dm(new u.bs(0,0,0)))),At=Float32Array.from(at.globeMatrix),gt=Float32Array.from(u.dn(at)),Et=[u.bE(at.center.lng),u.bF(at.center.lat)],bt=D.elevatedGlobePerspectiveTransform,wt=D.elevatedGlobeGridMatrix||new Float32Array(9);else if(w){const kt=u.dk(he.canonical);Ot=u.dl(kt.getCenter().lat),Ct=Float32Array.from(u.d2(u.dm(he.canonical))),At=Float32Array.from(at.globeMatrix),gt=Float32Array.from(u.dn(at)),Et=[u.bE(at.center.lng),u.bF(at.center.lat)],bt=[0,0],wt=Float32Array.from(u.dp(he.canonical,kt,Ot,at.worldSize/at._pixelsPerMercatorPixel))}else bt=D instanceof so?D.perspectiveTransform:[0,0],Ct=new Float32Array(16),At=new Float32Array(9),gt=new Float32Array(16),Et=[0,0],wt=new Float32Array(9);const Ht=wh(s,We,Ct,At,gt,wt,it||[0,0],u.ah(s.transform.zoom),Et,_t,tt||1,et,n,bt,x?n.paint.get("raster-elevation"):0,2,Pe,me,z.range,Re,Me,O),fi=s.isTileAffectedByFog(he),ei=s.getOrCreateProgram("raster",{defines:z.defines,overrideFog:fi});if(s.uploadCommonUniforms(I,ei,ve),D instanceof so){const kt=D.elevatedGlobeVertexBuffer,gi=D.elevatedGlobeIndexBuffer;if(q||!g)D.boundsBuffer&&D.boundsSegments&&ei.draw(s,M.TRIANGLES,Ae,lt.disabled,k,pt.disabled,Ht,n.id,D.boundsBuffer,s.quadTriangleIndexBuffer,D.boundsSegments);else if(kt&&gi){const si=at.zoom<=u.bU?D.elevatedGlobeSegments:D.getSegmentsForLongitude(at.center.lng);si&&ei.draw(s,M.TRIANGLES,Ae,lt.disabled,k,se,Ht,n.id,kt,gi,si)}}else if(w){Ae=new nt(M.LEQUAL,nt.ReadOnly,s.depthRangeFor3D);const kt=s.globeSharedBuffers;if(kt){E&&(s.terrain.setupElevationDraw(xe,ei),s.uploadCommonUniforms(I,ei,xe.tileID.toUnwrapped()));const[gi,si,Si]=kt.getGridBuffers(Ot,!1),Mt=ei.getAttributeLocation(M,"a_texture_pos");Mt!==-1&&M.vertexAttribI4ui(Mt,0,0,0,0),ei.draw(s,M.TRIANGLES,Ae,ue||ke,s.colorModeForRenderPass(),se,Ht,n.id,gi,si,Si)}}else if(A)Ae=new nt(M.LEQUAL,nt.ReadWrite,s.depthRangeFor3D),s.terrain.setupElevationDraw(xe,ei),s.uploadCommonUniforms(I,ei,xe.tileID.toUnwrapped()),at.pitch>20&&ei.draw(s,M.TRIANGLES,Ae,lt.disabled,dt.disabled,pt.frontCCW,Ht,n.id,s.terrain.gridBuffer,s.terrain.gridIndexBuffer,s.terrain.gridSegments),ei.draw(s,M.TRIANGLES,Ae,ke,k,pt.backCCW,Ht,n.id,s.terrain.gridBuffer,s.terrain.gridIndexBuffer,s.terrain.gridSegments);else{const{tileBoundsBuffer:kt,tileBoundsIndexBuffer:gi,tileBoundsSegments:si}=s.getTileBoundsBuffers(xe);ei.draw(s,M.TRIANGLES,Ae,ke,k,pt.disabled,Ht,n.id,kt,gi,si)}}if(!(D instanceof so)&&w)for(const he of J){const ve=he.canonical.y===(1<<he.canonical.z)-1;he.canonical.y===0&&jf(!0,he,s,t,n,O,z,se,ue||lt.disabled),ve&&jf(!1,he,s,t,n,O,z,se===pt.frontCW?pt.backCW:pt.frontCW,ue||lt.disabled)}};w?W(Y,s.renderElevatedRasterBackface?pt.backCW:pt.frontCW,s.stencilModeFor3D()):W(Y,pt.disabled,void 0),s.resetStencilClippingMasks()},background:function(s,t,n,l){const d=n.paint.get("background-color"),p=n.paint.get("background-color-use-theme").constantOr("default")==="none",m=n.paint.get("background-opacity"),g=n.paint.get("background-emissive-strength"),x=n.paint.get("background-pitch-alignment")==="viewport";if(m===0)return;const w=s.context,E=w.gl,A=s.transform,I=A.tileSize,M=n.paint.get("background-pattern");let D;if(M!==void 0&&(M===null||(D=s.imageManager.getPattern(u.I.from(M.toString()),n.scope,s.style.getLut(n.scope)),!D)))return;const z=!M&&d.a===1&&m===1&&s.opaquePassEnabledForLayer()?"opaque":"translucent";if(s.renderPass!==z)return;const O=lt.disabled,k=s.depthModeForSublayer(0,z==="opaque"?nt.ReadWrite:nt.ReadOnly),q=s.colorModeForDrapableLayerRenderPass(g),$=M?"backgroundPattern":"background";let U,Q=l;Q||(U=s.getBackgroundTiles(),Q=Object.values(U).map(ae=>ae.tileID)),M&&(w.activeTexture.set(E.TEXTURE0),s.imageManager.bind(s.context,n.scope));const Y=[];if(s.terrain&&s.terrain.renderingToTexture&&s.emissiveMode==="mrt-fallback"&&Y.push("USE_MRT1"),x){const ae=s.getOrCreateProgram($,{overrideFog:!1,overrideRtt:!0,defines:Y}),W=Yl,J=new u.bp(0,0,0,0,0),se=M?ea(W,g,m,s,0,n.scope,D,x,{tileID:J,tileSize:I}):Sh(W,g,m,d.toPremultipliedRenderColor(p?null:n.lut));return void ae.draw(s,E.TRIANGLES,k,O,q,pt.disabled,se,n.id,s.viewportBuffer,s.quadTriangleIndexBuffer,s.viewportSegments)}for(const ae of Q){const W=s.isTileAffectedByFog(ae),J=s.getOrCreateProgram($,{overrideFog:W,defines:Y}),se=ae.toUnwrapped(),ue=l?ae.projMatrix:s.transform.calculateProjMatrix(se);s.prepareDrawTile();const he=t?t.getTile(ae):U?U[ae.key]:new zl(ae,I,A.zoom,s),ve=M?ea(ue,g,m,s,0,n.scope,D,x,{tileID:ae,tileSize:I}):Sh(ue,g,m,d.toPremultipliedRenderColor(p?null:n.lut));s.uploadCommonUniforms(w,J,se);const{tileBoundsBuffer:xe,tileBoundsIndexBuffer:Le,tileBoundsSegments:_e}=s.getTileBoundsBuffers(he);J.draw(s,E.TRIANGLES,k,O,q,pt.disabled,ve,n.id,xe,Le,_e)}},sky:function(s,t,n){const l=s._atmosphere?u.ah(s.transform.zoom):1,d=n.paint.get("sky-opacity")*l;if(d===0)return;const p=s.context,m=n.paint.get("sky-type"),g=new nt(p.gl.LEQUAL,nt.ReadOnly,[0,1]),x=s.frameCounter/1e3%1;m==="atmosphere"?s.renderPass==="offscreen"?n.needsSkyboxCapture(s)&&((function(w,E){const A=w.context,I=A.gl;let M=E.skyboxFbo;if(!M){M=E.skyboxFbo=A.createFramebuffer(32,32,1,null),E.skyboxGeometry=new Qm(A),E.skyboxTexture=A.gl.createTexture(),I.bindTexture(I.TEXTURE_CUBE_MAP,E.skyboxTexture),I.texParameteri(I.TEXTURE_CUBE_MAP,I.TEXTURE_WRAP_S,I.CLAMP_TO_EDGE),I.texParameteri(I.TEXTURE_CUBE_MAP,I.TEXTURE_WRAP_T,I.CLAMP_TO_EDGE),I.texParameteri(I.TEXTURE_CUBE_MAP,I.TEXTURE_MIN_FILTER,I.LINEAR),I.texParameteri(I.TEXTURE_CUBE_MAP,I.TEXTURE_MAG_FILTER,I.LINEAR);for(let k=0;k<6;++k)I.texImage2D(I.TEXTURE_CUBE_MAP_POSITIVE_X+k,0,I.RGBA,32,32,0,I.RGBA,I.UNSIGNED_BYTE,null)}A.bindFramebuffer.set(M.framebuffer),A.viewport.set([0,0,32,32]);const D=E.getCenter(w,!0),z=w.getOrCreateProgram("skyboxCapture"),O=new Float64Array(16);u.eT(O,.5*-Math.PI),ia(w,E,z,O,D,0),u.eT(O,.5*Math.PI),ia(w,E,z,O,D,1),u.eU(O,.5*-Math.PI),ia(w,E,z,O,D,2),u.eU(O,.5*Math.PI),ia(w,E,z,O,D,3),u.aC(O),ia(w,E,z,O,D,4),u.eT(O,Math.PI),ia(w,E,z,O,D,5),A.viewport.set([0,0,w.width,w.height])})(s,n),n.markSkyboxValid(s)):s.renderPass==="sky"&&(function(w,E,A,I,M){const D=w.context,z
3330=D.gl,O=w.transform,k=w.getOrCreateProgram("skybox");D.activeTexture.set(z.TEXTURE0),z.bindTexture(z.TEXTURE_CUBE_MAP,E.skyboxTexture);const q=(($,U,Q,Y,ae)=>({u_matrix:$,u_sun_direction:U,u_cubemap:0,u_opacity:Y,u_temporal_offset:ae}))(O.skyboxMatrix,E.getCenter(w,!1),0,I,M);w.uploadCommonUniforms(D,k),k.draw(w,z.TRIANGLES,A,lt.disabled,w.colorModeForRenderPass(),pt.backCW,q,"skybox",E.skyboxGeometry.vertexBuffer,E.skyboxGeometry.indexBuffer,E.skyboxGeometry.segment)})(s,n,g,d,x):m==="gradient"&&s.renderPass==="sky"&&(function(w,E,A,I,M){const D=w.context,z=D.gl,O=w.transform,k=w.getOrCreateProgram("skyboxGradient");E.skyboxGeometry||(E.skyboxGeometry=new Qm(D)),D.activeTexture.set(z.TEXTURE0);let q=E.colorRampTexture;q||(q=E.colorRampTexture=new u.T(D,E.colorRamp,z.RGBA8)),q.bind(z.LINEAR,z.CLAMP_TO_EDGE);const $=((U,Q,Y,ae,W)=>({u_matrix:U,u_color_ramp:0,u_center_direction:Q,u_radius:u.al(Y),u_opacity:ae,u_temporal_offset:W}))(O.skyboxMatrix,E.getCenter(w,!1),E.paint.get("sky-gradient-radius"),I,M);w.uploadCommonUniforms(D,k),k.draw(w,z.TRIANGLES,A,lt.disabled,w.colorModeForRenderPass(),pt.backCW,$,"skyboxGradient",E.skyboxGeometry.vertexBuffer,E.skyboxGeometry.indexBuffer,E.skyboxGeometry.segment)})(s,n,g,d,x)},custom:function(s,t,n,l){const d=s.context,p=n.implementation;if(!s.transform.projection.unsupportedLayers||!s.transform.projection.unsupportedLayers.includes("custom")||s.terrain&&(s.terrain.renderingToTexture||s.renderPass==="offscreen")&&n.isDraped(t)){if(s.renderPass==="offscreen"){const m=p.prerender;if(m){if(s.setCustomLayerDefaults(),d.setColorMode(s.colorModeForRenderPass()),s.transform.projection.name==="globe"){const g=s.transform.pointMerc;m.call(p,d.gl,s.transform.customLayerMatrix(),s.transform.getProjection(),s.transform.globeToMercatorMatrix(),u.ah(s.transform.zoom),[g.x,g.y],s.transform.pixelsPerMeterRatio)}else m.call(p,d.gl,s.transform.customLayerMatrix());d.setDirty(),s.setBaseState()}}else if(s.renderPass==="translucent"){if(s.terrain&&s.terrain.renderingToTexture){const g=p.renderToTile;if(g){const x=l[0].canonical,w={x:x.x+l[0].wrap*(p.wrapTileId?0:1<<x.z),y:x.y,z:x.z};d.setDepthMode(nt.disabled),d.setStencilMode(lt.disabled),d.setColorMode(s.colorModeForRenderPass()),s.setCustomLayerDefaults();const E=d.gl;s.emissiveMode==="mrt-fallback"&&E.drawBuffers([E.COLOR_ATTACHMENT0]),g.call(p,d.gl,w),s.emissiveMode==="mrt-fallback"&&E.drawBuffers([E.COLOR_ATTACHMENT0,E.COLOR_ATTACHMENT1]),d.setDirty(),s.setBaseState()}return}s.setCustomLayerDefaults(),d.setColorMode(s.colorModeForRenderPass()),d.setStencilMode(lt.disabled);const m=p.renderingMode==="3d"?new nt(s.context.gl.LEQUAL,nt.ReadWrite,s.depthRangeFor3D):s.depthModeForSublayer(0,nt.ReadOnly);if(d.setDepthMode(m),s.transform.projection.name==="globe"){const g=s.transform.pointMerc;p.render(d.gl,s.transform.customLayerMatrix(),s.transform.getProjection(),s.transform.globeToMercatorMatrix(),u.ah(s.transform.zoom),[g.x,g.y],s.transform.pixelsPerMeterRatio)}else p.render(d.gl,s.transform.customLayerMatrix());d.setDirty(),s.setBaseState(),d.bindFramebuffer.set(null)}}else u.w("Custom layers are not yet supported with this projection. Use mercator or globe to enable usage of custom layers.")}},qn={line:function(s,t,n){if(s.hasElevatedBuckets=!1,s.hasNonElevatedBuckets=!1,s._unevaluatedLayout.getValue("line-elevation-reference")!==void 0||s._unevaluatedLayout.getValue("line-z-offset")!==void 0){if(t){const l=t.getVisibleCoordinates();for(const d of l){const p=t.getTile(d).getBucket(s);if(p&&(p.elevationType!=="none"?s.hasElevatedBuckets=!0:s.hasNonElevatedBuckets=!0,s.hasElevatedBuckets&&s.hasNonElevatedBuckets))break}}}else s.hasNonElevatedBuckets=!0},raster:function(s,t,n){const l=t.getSource();if(!(l instanceof Mo&&l.loaded()))return;const d=s.sourceLayer||l.rasterLayerIds&&l.rasterLayerIds[0];if(!d)return;const p=s.paint.get("raster-array-band")||l.getInitialBand(d);if(p==null)return;const m=t.getIds().map(g=>t.getTileByID(g));for(const g of m)g.updateNeeded(s.id,p)&&l.prepareTile(g,d,s.id,p)}};async function Do(s){if(await Dd(),Object.assign(Gn,{model:Cn.drawModels}),Object.assign(qn,{model:Cn.prepare}),s&&!s._shadowRenderer){const t=Cn.ShadowRenderer;t&&(s._shadowRenderer=new t(s))}}class qa{constructor(t,n,l,d,p){this.context=new Ih(t,n),this.transform=l,this._tileTextures={},this.frameCopies=[],this.loadTimeStamps=[],this.frcCoverageSnapshot=null,this.elevationCoverageSnapshot=null,this.elevationProvidersReady=void 0,this.frcCoverageFadeRange=null,this.frcCoverageSourceLayers=[],this.frcCoverageRenderer=Ft.Fr
3330cCoverageRenderer?new Ft.FrcCoverageRenderer:null,this._debugParams={averageFPS:0,fpsHistory:[],fpsWindow:30,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:-1,lodSwitchFadeDuration:.5},this.occlusionParams=new Qc,this.setup(),this.numSublayers=sn.maxUnderzooming+sn.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.deferredRenderGpuTimeQueries=[],this.gpuTimers={},this.frameCounter=0,this.frameTimeDelta=0,this.lastPaintStartTimeStamp=0,this._shadowCullCache=null,this._backgroundTiles={},this.conflationActive=!1,this.replacementSource=new u.f0,this.longestCutoffRange=0,this.minCutoffZoom=0,this._fogVisible=!1,this._cachedTileFogOpacities={},this._wireframeDebugCache=new Dh,this.renderDefaultNorthPole=!0,this.renderDefaultSouthPole=!0,this.layersWithOcclusionOpacity=[];const m=new u.t({width:1,height:1},Uint8Array.of(0,0,0,0));this.emptyDepthTexture=new u.T(this.context,m,t.RGBA8),this._clippingActiveLastFrame=!1,this.scaleFactor=d,this.maxFrontCutoffRawStart=0,this.worldview=p,this._forceEmissiveMode=!1,this.emissiveMode="constant"}updateTerrain(t,n){const l=!!t&&!!t.terrain&&this.transform.projection.supportsTerrain;if(!(l||this._terrain&&this._terrain.enabled))return;this._terrain||(this._terrain=new vh(this,t));const d=this._terrain;this.transform.elevation=l?d:null,d.update(t,this.transform,n),this.transform.elevation&&!d.enabled&&(this.transform.elevation=null)}_updateFog(t){const n=t.fog;if(!n||this.transform.projection.name==="globe"||n.getOpacity(this.transform.pitch)<1||n.properties.get("horizon-blend")<.03)return void(this.transform.fogCullDistSq=null);const[l,d]=n.getRangeForProjection();if(l>d)return void(this.transform.fogCullDistSq=null);const p=l+.78*(d-l);this.transform.fogCullDistSq=p*p}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 vh(this,this.style)),this._forceTerrainMode=t}get shadowRenderer(){return this._shadowRenderer&&this._shadowRenderer.enabled?this._shadowRenderer:null}get wireframeDebugCache(){return this._wireframeDebugCache}resize(t,n){if(this.width=t*u.r.devicePixelRatio,this.height=n*u.r.devicePixelRatio,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const l of this.style.order)this.style._mergedLayers[l].resize()}setup(){const t=this.context,n=new u.co;n.emplaceBack(0,0),n.emplaceBack(u.aj,0),n.emplaceBack(0,u.aj),n.emplaceBack(u.aj,u.aj),this.tileExtentBuffer=t.createVertexBuffer(n,u.cq.members),this.tileExtentSegments=u.cr.simpleSegment(0,0,4,2);const l=new u.co;l.emplaceBack(0,0),l.emplaceBack(u.aj,0),l.emplaceBack(0,u.aj),l.emplaceBack(u.aj,u.aj),this.debugBuffer=t.createVertexBuffer(l,u.cq.members),this.debugSegments=u.cr.simpleSegment(0,0,4,5);const d=new u.co;d.emplaceBack(-1,-1),d.emplaceBack(1,-1),d.emplaceBack(-1,1),d.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(d,u.cq.members),this.viewportSegments=u.cr.simpleSegment(0,0,4,2);const p=new u.cP;p.emplaceBack(0,0,0,0),p.emplaceBack(u.aj,0,u.aj,0),p.emplaceBack(0,u.aj,0,u.aj),p.emplaceBack(u.aj,u.aj,u.aj,u.aj),this.mercatorBoundsBuffer=t.createVertexBuffer(p,Xu.members),this.mercatorBoundsSegments=u.cr.simpleSegment(0,0,4,2);const m=new u.cp;m.emplaceBack(0,1,2),m.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(m);const g=new u.c$;for(const w of[0,1,3,2,0])g.emplaceBack(w);this.debugIndexBuffer=t.createIndexBuffer(g),this.emptyTexture=new u.T(t,new u.t({width:1,height:1},Uint8Array.of(0,0,0,0)),t.gl.RGBA8),this.identityMat=u.aS();const x=this.context.gl;this.stencilClearMode=new lt({func:x.ALWAYS,mask:0},0,255,x.ZERO,x.ZERO,x.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,nt.disabled,this.stencilClearMode,dt.disabled,pt.disabled,kl(this.identityMat),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}resetStencilClippingMasks(){this.terrain||(this.currentStencilSource=void 0,this._tileClippingMaskIDs={})}_renderTileClippingMasks(t,n,l){if(!n||this.currentStencilSource===n.id||!t.isTileClipped()||!l||l.length===0)return;if(this._tileClippingMaskIDs&&!this.terrain){let g=!1;for(const x of l)if(this._tileClippingMaskIDs[x.key]===void 0){g=!0;break}if(!g)return}this.currentStencilSource=n.id;const d=this.context,p=d.gl;this.nextStencilID+l.length>256&&this.clearStencil(),d.setColorMode(dt.disabled),d.setDepthMode(nt.disabled);const m=this.getOrCreateProgram("clippingMask");this._tileClippingMaskIDs={};for(const g of l){const x=n.getTile(g),w=this._tileClippingMaskIDs[g.key]=this.nextStencilID++,{tileBoundsBuffer:E,tileBoundsIndexBuffer:A,tileBoundsSegments:I}=this.getTileBoundsBuffers(x);m.draw(this,p.TRIANGLES,nt.disabled,new lt({func:p.ALWAYS,mask:0},w,255,p.KEEP,p.KEEP,p.REPLACE),dt.disabled,pt.disabled,kl(g.projMatrix),"$clipping",E,A,I)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const t=this.nextStencilID++,n=this.context.gl;return new lt({func:n.NOTEQUAL,mask:255},t,255,n.KEEP,n.KEEP,n.REPLACE)}stencilModeForClipping(t){if(this.terrain)return this.terrain.stencilModeForRTTOverlap(t);const n=this.context.gl;return new lt({func:n.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,n.KEEP,n.KEEP,n.REPLACE)}stencilConfigForOverlap(t){const n=this.context.gl,l=t.sort((m,g)=>
vendor: 102,991 bytes, lines 3330-3335
3330g.overscaledZ-m.overscaledZ),d=l.at(-1).overscaledZ,p=l[0].overscaledZ-d+1;if(p>1){this.currentStencilSource=void 0,this.nextStencilID+p>256&&this.clearStencil();const m={};for(let g=0;g<p;g++)m[g+d]=new lt({func:n.GEQUAL,mask:255},g+this.nextStencilID,255,n.KEEP,n.KEEP,n.REPLACE);return this.nextStencilID+=p,[m,l]}return[{[d]:lt.disabled},l]}colorModeForRenderPass(){const t=this.context.gl;return this._showOverdrawInspector?new dt([t.CONSTANT_COLOR,t.ONE,t.CONSTANT_COLOR,t.ONE],new u.C(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?dt.unblended:dt.alphaBlended}colorModeForDrapableLayerRenderPass(t){const n=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 dt([n.ONE,n.ONE_MINUS_SRC_ALPHA,n.CONSTANT_ALPHA,n.ONE_MINUS_SRC_ALPHA],new u.C(0,0,0,t??0),[!0,!0,!0,!0]):this.emissiveMode==="dual-source-blending"?new dt([n.ONE,n.ONE_MINUS_SRC_ALPHA,this.context.extBlendFuncExtended.SRC1_ALPHA_WEBGL,n.ONE_MINUS_SRC_ALPHA],u.C.transparent,[!0,!0,!0,!0]):this.colorModeForRenderPass():this.colorModeForRenderPass()}depthModeForSublayer(t,n,l,d=!1){if(this.depthOcclusion)return new nt(this.context.gl.GREATER,nt.ReadOnly,this.depthRangeFor3D);if(!this.opaquePassEnabledForLayer()&&!d)return nt.disabled;const p=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new nt(l||this.context.gl.LEQUAL,n,[p,p])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}blitDepth(){const t=this.context.gl,n=Math.ceil(this.width),l=Math.ceil(this.height),d=this.context.bindFramebuffer.get(),p=t.getParameter(t.TEXTURE_BINDING_2D);this.depthFBO&&this.depthFBO.width===n&&this.depthFBO.height===l||(this.depthFBO&&(this.depthFBO.destroy(),this.depthFBO=void 0,this.depthTexture=void 0),n!==0&&l!==0&&(this.depthFBO=new ta(this.context,n,l,0,"texture"),this.depthTexture=new u.T(this.context,{width:n,height:l,data:null},t.DEPTH24_STENCIL8),this.depthFBO.depthAttachment.set(this.depthTexture.texture))),this.context.bindFramebuffer.set(d),t.bindTexture(t.TEXTURE_2D,p),this.depthFBO&&(t.bindFramebuffer(t.READ_FRAMEBUFFER,null),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,this.depthFBO.framebuffer),t.blitFramebuffer(0,0,n,l,0,0,n,l,t.DEPTH_BUFFER_BIT,t.NEAREST),t.bindFramebuffer(t.FRAMEBUFFER,this.context.bindFramebuffer.current))}render(t,n){this.context.sweepPendingPrograms(),this.frameTimeDelta=this.lastPaintStartTimeStamp===0?0:n.paintStartTimeStamp-this.lastPaintStartTimeStamp,this.lastPaintStartTimeStamp=n.paintStartTimeStamp,this._wireframeDebugCache.update(this.frameCounter),this.style=t,this.options=n,this.frcCoverageSnapshot&&!this.frcCoverageSnapshot.empty()&&(!this.frcCoverageRenderer&&Ft.FrcCoverageRenderer&&(this.frcCoverageRenderer=new Ft.FrcCoverageRenderer),this.frcCoverageRenderer&&this.frcCoverageRenderer.update(this.context,this.frcCoverageSnapshot.tiles));const l=this.style._mergedLayers,d=!(!this.terrain||!this.terrain.enabled),p=()=>this.style._getOrder(d);let m=p(),g=!1,x=!1,w=null,E=0,A=!1;for(const _e of m){const Pe=l[_e];Pe.visibility!=="none"&&(Pe.type==="circle"?g=!0:Pe.type==="building"?(w=Pe,++E):Pe.type==="symbol"&&(Pe.hasOcclusionOpacityProperties?x=!0:g=!0))}this.updateEmissiveMode();let I=m.map(_e=>l[_e]);const M=this.style._mergedSourceCaches;this.imageManager=t.imageManager,this.modelManager=t.modelManager,this.symbolFadeChange=t.placement.symbolFadeChange(u.r.now()),this.imageManager.beginFrame();for(const _e in M){const Pe=M[_e];Pe.used&&(Pe.prepare(this.context),Pe.getSource().usedInConflation&&++E)}let D=!1;for(const _e of I)_e.isHidden(this.transform.zoom)||(_e.type==="clip"&&(D=!0),this.prepareLayer(_e));const z={},O={},k={},q={},$={};for(const _e in M){const Pe=M[_e];z[_e]=Pe.getVisibleCoordinates(),O[_e]=z[_e].slice().reverse(),k[_e]=Pe.getVisibleCoordinates(!0).reverse(),q[_e]=Pe.getShadowCasterCoordinates(),$[_e]=Pe.sortCoordinatesByDistance(z[_e])}const U=_e=>{const Pe=this.style.getLayerSourceCache(_e);return Pe&&Pe.used?Pe.getSource():null};if(E||D||this._clippingActiveLastFrame){const _e=[],Pe=[];let me=0;for(const Re of I)this.isSourceForClippingOrConflation(Re,U(Re))&&(_e.push(Re),Pe.push(me)),me++;if(_e&&(D||_e.length>1)||this._clippingActiveLastFrame){D=!1;const Re=[];for(let Me=0;Me<_e.length;Me++){const Ae=_e[Me],We=Pe[Me],ke=this.style.getLayerSourceCache(Ae);if(!ke||!ke.used||!ke.getSource().usedInConflation&&Ae.type!=="clip"&&Ae.type!=="building")continue;let Ue=u.f1,je=u.dY.None;const et=[];let tt=!0;if(Ae.type==="building")Ue=u.f3;else if(Ae.type==="clip")if(Ue=We,Ae.isHidden(this.transform.zoom))tt=!1;else{if(!Ae.layout){tt=!1;continue}for(const it of Ae.layout.get("clip-layer-types"))je|=it==="model"?u.dY.Model:it==="symbol"?u.dY.Symbol:u.dY.FillExtrusion;for(const it of Ae.layout.get("clip-layer-scope"))et.push(u.y(it,Ae.scope));D=!0}tt&&Re.push({layer:Ae.fqid,cache:ke,order:Ue,clipMask:je,clipScope:et})}this.replacementSource.setSources(Re),A=!0}}this._clippingActiveLastFrame=D,A||this.replacementSource.clear(),this.conflationActive=A,this.minCutoffZoom=0,this.longestCutoffRange=0,this.maxFrontCutoffRawStart=0,this.opaquePassCutoff=1/0,this._lastOcclusionLayer=-1,this.layersWithOcclusionOpacity=[];for(let _e=0;_e<I.length;_e++){const Pe=I[_e];if(Pe.visibility==="none")continue;const me=Pe.cutoffRange();if(this.longestCutoffRange=Math.max(me,this.longestCutoffRange),me>0){const Re=U(Pe);Re&&(this.minCutoffZoom=Math.max(Re.minzoom,this.minCutoffZoom)),Pe.minzoom&&(this.minCutoffZoom=Math.max(Pe.minzoom,this.minCutoffZoom))}Pe.is3D(d)&&(this.opaquePassCutoff===1/0&&(this.opaquePassCutoff=_e),this._lastOcclusionLayer=_e)}const Q=this.style&&this.style.fog;Q?(this._fogVisible=Q.getOpacity(this.transform.pitch)!==0,this._fogVisible&&this.transform.projection.name!=="globe"&&(this._fogVisible=Q.isVisibleOnFrustum(this.transform.cameraFrustum))):this._fogVisible=!1,this._cachedTileFogOpacities={},this.terrain&&(this.terrain.updateTileBinding(k),this.opaquePassCutoff=0,m=p(),I=m.map(_e=>l[_e])),this.style.enable3dLights()&&!this._shadowRenderer&&Do(this);const Y=this._shadowRenderer;if(Y){Y.updateShadowParameters(this.transform,this.style.directionalLight);for(const _e in M)for(const Pe of z[_e]){let me={min:0,max:0};this.terrain&&(me=this.terrain.getMinMaxForTile(Pe)||me),Y.addShadowReceiver(Pe.toUnwrapped(),me.min,me.max)}}this.transform.projection.name!=="globe"||this.globeSharedBuffers||(this.globeSharedBuffers=new u.f2(this.context)),this.style.fog&&this.transform.projection.supportsFog?(this._atmosphere||(this._atmosphere=new Hf),this._atmosphere.update(this)):this._atmosphere&&(this._atmosphere.destroy(),this._atmosphere=void 0);let ae=!(!this.style||!this.style.snow),W=!(!this.style||!this.style.rain);if(ae&&!this._snow&&Ft.Snow&&(this._snow=new Ft.Snow),!ae&&this._snow&&(this._snow.destroy(),delete this._snow),W&&!this._rain&&Ft.Rain&&(this._rain=new Ft.Rain),!W&&this._rain&&(this._rain.destroy(),delete this._rain),this._snow&&this._snow.update(this),this._rain&&this._rain.update(this),w&&(!this.buildingTileBorderManager&&Ft.BuildingTileBorderManager&&(this.buildingTileBorderManager=new Ft.BuildingTileBorderManager),this.buildingTileBorderManager)){const _e=this.style.getLayerSourceCache(w);this.buildingTileBorderManager.updateBorders(_e,w)}if(!Ns.has(this.context.gl))return;this.renderPass="offscreen";for(const _e of I){const Pe=t.getLayerSourceCache(_e);if(!_e.hasOffscreenPass()||_e.isHidden(this.transform.zoom))continue;const me=Pe?O[Pe.id]:void 0;(_e.type==="custom"||_e.type==="raster"||_e.type==="raster-particle"||_e.isSky()||me&&me.length)&&this.renderLayer(this,Pe,_e,me)}this.depthRangeFor3D=[0,1-(I.length+2)*this.numSublayers*this.depthEpsilon],this._shadowRenderer&&(this.renderPass="shadow",this._shadowRenderer.drawShadowPass(this.style,q)),this.context.bindFramebuffer.set(null),this.context.viewport.set([0,0,this.width,this.height]);const J=this.transform.projection.name==="globe"||this.transform.isHorizonVisible(),se=(()=>{if(n.showOverdrawInspector)return u.C.black;const _e=this.style.fog;if(_e&&this.transform.projection.supportsFog){const Pe=this.style.getLut(_e.scope);if(!J){const me=_e.properties.get("color-use-theme")==="none",Re=_e.properties.get("color").toNonPremultipliedRenderColor(me?null:Pe).toArray01();return new u.C(...Re)}if(J){const me=_e.properties.get("space-color-use-theme")==="none",Re=_e.properties.get("space-color").toNonPremultipliedRenderColor(me?null:Pe).toArray01();return new u.C(...Re)}}return u.C.transparent})();if(this.context.clear({color:se,depth:1}),this.clearStencil(),this._showOverdrawInspector=n.showOverdrawInspector,this.renderPass="opaque",this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&J&&this._atmosphere.drawStars(this,this.style.fog),!this.terrain)for(this.currentLayer=m.length-1;this.currentLayer>=0;this.currentLayer--){const _e=I[this.currentLayer],Pe=t.getLayerSourceCache(_e);if(_e.isSky())continue;const me=Pe?(_e.is3D(d)?$:O)[Pe.id]:void 0;this._renderTileClippingMasks(_e,Pe,me),this.renderLayer(this,Pe,_e,me)}if(this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&J&&this._atmosphere.drawAtmosphereGlow(this,this.style.fog),this.renderPass="sky",(!this._atmosphere||u.ah(this.transform.zoom)>0)&&(this.transform.projection.name==="globe"||this.transform.isHorizonVisible()))for(this.currentLayer=0;this.currentLayer<m.length;this.currentLayer++){const _e=I[this.currentLayer],Pe=t.getLayerSourceCache(_e);_e.isSky()&&this.renderLayer(this,Pe,_e,Pe?O[Pe.id]:void 0)}function ue(_e,Pe){let me;return Pe&&(me=(_e.type==="symbol"?k:_e.is3D(d)?$:O)[Pe.id]),me}if(this.renderPass="translucent",this.transform.projection.name==="globe"){for(this.renderElevatedRasterBackface=!0,this.currentLayer=0;this.currentLayer<m.length;){const _e=I[this.currentLayer];if(_e.type==="raster"||_e.type==="raster-particle"){const Pe=t.getLayerSourceCache(_e);this.renderLayer(this,Pe,_e,ue(_e,Pe))}++this.currentLayer}this.renderElevatedRasterBackface=!1}this.currentLayer=0,this.firstLightBeamLayer=Number.MAX_SAFE_INTEGER;const he=Y?Y.getGroundShadowLayerIndex():-1;let ve=!1,xe=-1;for(let _e=0;_e<m.length;++_e){const Pe=I[_e];Pe.isHidden(this.transform.zoom)||Pe.is3D(d)&&(xe=_e)}x&&xe===-1&&(g=!0);let Le=!1;for(;this.currentLayer<m.length;){const _e=I[this.currentLayer],Pe=t.getLayerSourceCache(_e);if(_e.isSky())++this.currentLayer;else if(this.terrain&&this.style.isLayerDraped(_e)){if(_e.isHidden(this.transform.zoom)){++this.currentLayer;continue}this.currentLayer=this.terrain.renderBatch(this.currentLayer),this._lastOcclusionLayer=Math.max(this.currentLayer,this._lastOcclusionLayer)}else{if(!Le&&_e.is3D(d)&&!d){const me=this.currentLayer,Re=Me=>{for(this.currentLayer=0;this.currentLayer<I.length;this.currentLayer++){const Ae=I[this.currentLayer];if(Ae.type==="fill"&&Ft.drawDepthPrepass){const We=this.style.getLayerSourceCache(Ae);Ft.drawDepthPrepass(this,We,Ae,ue(Ae,We),Me)}}};Re("initialize"),Re("reset"),this.currentLayer=me,Le=!0}if(g&&!ve&&this.terrain&&!this.transform.isOrthographic&&(ve=!0,this.blitDepth()),x&&xe!==-1&&this.currentLayer===xe+1&&!this.transform.isOrthographic&&this.blitDepth(),this.terrain||this._renderTileClippingMasks(_e,Pe,Pe?z[Pe.id]:void 0),this.renderLayer(this,Pe,_e,ue(_e,Pe)),!this.terrain&&Y&&this.currentLayer===he){{this.clearStencil(),this.resetStencilClippingMasks();const me=this.currentLayer;for(this.currentLayer=0;this.currentLayer<I.length;this.currentLayer++){const Re=I[this.currentLayer];if(Re.type==="fill"&&Ft.drawGroundShadowMask){const Me=this.style.getLayerSourceCache(Re);Ft.drawGroundShadowMask(this,Me,Re,ue(Re,Me))}}this.currentLayer=me}if(Y.drawGroundShadows(),this.firstLightBeamLayer<=this.currentLayer){const me=this.currentLayer;for(this.renderPass="light-beam",this.currentLayer=this.firstLightBeamLayer;this.currentLayer<=me;this.currentLayer++){const Re=I[this.currentLayer];if(!Re.hasLightBeamPass())continue;const Me=t.getLayerSourceCache(Re);this.renderLayer(this,Me,Re,Me?O[Me.id]:void 0)}this.currentLayer=me,this.renderPass="translucent"}}if(this.currentLayer>=this._lastOcclusionLayer&&this.layersWithOcclusionOpacity.length>0){const me=this.currentLayer;this.depthOcclusion=!0;for(const Re of this.layersWithOcclusionOpacity){this.currentLayer=Re;const Me=I[this.currentLayer],Ae=t.getLayerSourceCache(Me),We=Ae?O[Ae.id]:void 0;this.terrain||this._renderTileClippingMasks(Me,Ae,Ae?z[Ae.id]:void 0),this.renderLayer(this,Ae,Me,We)}this.depthOcclusion=!1,this.currentLayer=me,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 _e=null;I.forEach(Pe=>{const me=t.getLayerSourceCache(Pe);me&&!Pe.isHidden(this.transform.zoom)&&me.getVisibleCoordinates().length&&(!_e||_e.getSource().maxzoom<me.getSource().maxzoom)&&(_e=me)}),_e&&this.options.showTileBoundaries&&(function(Pe,me,Re,Me,Ae,We){for(let ke=0;ke<Re.length;ke++)Gf(Pe,me,Re[ke],Me,0,0,We)})(this,_e,_e.getVisibleCoordinates(),u.C.red,0,this.options.showParseStatus)}this.options.showPadding&&(function(_e){const Pe=_e.transform.padding;Kc(_e,_e.transform.height-(Pe.top||0),3,Zg),Kc(_e,Pe.bottom||0,3,Wg),Ro(_e,Pe.left||0,3,Xg),Ro(_e,_e.transform.width-(Pe.right||0),3,Yc);const me=_e.transform.centerPoint;(function(Re,Me,Ae,We){Ga(Re,Me-1,Ae-10,2,20,We),Ga(Re,Me-10,Ae-1,20,2,We)})(_e,me.x,_e.transform.height-me.y,Jm)})(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()),A||(this.conflationActive=!1)}prepareLayer(t){this.gpuTimingStart(t);const{unsupportedLayers:n}=this.transform.projection,l=!n||!n.includes(t.type);if(qn[t.type]&&(l||this.terrain&&t.type==="custom")){const d=this.style.getLayerSourceCache(t);qn[t.type](t,d,this)}this.gpuTimingEnd()}renderLayer(t,n,l,d){l.isHidden(this.transform.zoom)||(l.type==="background"||l.type==="sky"||l.type==="custom"||l.type==="model"||l.type==="raster"||l.type==="raster-particle"||d&&d.length)&&(this.id=l.id,this.gpuTimingStart(l),(!t.transform.projection.unsupportedLayers||!t.transform.projection.unsupportedLayers.includes(l.type)||t.terrain&&l.type==="custom")&&l.type!=="clip"&&l.type!=="slot"&&Gn[l.type]&&Gn[l.type](t,n,l,d,this.style.placement.variableOffsets,this.options.isInitialLoad),Gn[l.type]||(l.mayUse("HD")&&(async function(){await Nl(),Object.assign(Gn,{building:Ft.drawBuilding,"raster-particle":Ft.drawRasterParticle}),Object.assign(qn,{"raster-particle":Ft.prepareRasterParticle})})(),l.mayUse("Standard")&&Do(t)),this.gpuTimingEnd())}gpuTimingStart(t){if(!this.options.gpuTiming)return;const n=this.context.extTimerQuery,l=this.context.gl;let d=this.gpuTimers[t.id];d||(d=this.gpuTimers[t.id]={calls:0,cpuTime:0,query:l.createQuery()}),d.calls++,l.beginQuery(n.TIME_ELAPSED_EXT,d.query)}gpuTimingDeferredRenderStart(){if(this.options.gpuTimingDeferredRender){const t=this.context.extTimerQuery,n=this.context.gl,l=n.createQuery();this.deferredRenderGpuTimeQueries.push(l),n.beginQuery(t.TIME_ELAPSED_EXT,l)}}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 n={};for(const l in t){const d=t[l],p=this.context.extTimerQuery,m=p.getQueryParameter(d.query,this.context.gl.QUERY_RESULT)/1e6;p.deleteQueryEXT(d.query),n[l]=m}return n}queryGpuTimeDeferredRender(t){if(!this.options.gpuTimingDeferredRender)return 0;const n=this.context.gl;let l=0;for(const d of t)l+=n.getQueryParameter(d,n.QUERY_RESULT)/1e6,n.deleteQuery(d);return l}translatePosMatrix(t,n,l,d,p){if(!l[0]&&!l[1])return t;const m=p?d==="map"?this.transform.angle:0:d==="viewport"?-this.transform.angle:0;if(m){const w=Math.sin(m),E=Math.cos(m);l=[l[0]*E-l[1]*w,l[0]*w+l[1]*E]}const g=[p?l[0]:u.c1(n,l[0],this.transform.zoom),p?l[1]:u.c1(n,l[1],this.transform.zoom),0],x=new Float32Array(16);return u.aG(x,t,g),x}saveTileTexture(t){if(t.context!==this.context)return;const n=t.size[0],l=this._tileTextures[n];l?l.push(t):this._tileTextures[n]=[t]}getTileTexture(t){const n=this._tileTextures[t];return n&&n.length>0?n.pop():null}terrainRenderModeElevated(){return this.style&&this.style.hasTerrain()&&!!this.terrain&&!this.terrain.renderingToTexture||this.forceTerrainMode}linearFloatFilteringSupported(){return this.context.extTextureFloatLinear!=null}currentGlobalDefines(t,n,l,d,p){const m=l===void 0?this.terrain&&this.terrain.renderingToTexture:l,g=d===void 0?this.terrainRenderModeElevated():d,x=p===void 0?this.transform.projection.name==="globe":p,w=[];return this.style&&this.style.enable3dLights()&&(t==="globeRaster"||t==="terrainRaster"?(w.push("LIGHTING_3D_MODE"),w.push("LIGHTING_3D_ALPHA_EMISSIVENESS")):m||w.push("LIGHTING_3D_MODE")),g&&(w.push("TERRAIN"),this.linearFloatFilteringSupported()&&w.push("TERRAIN_DEM_FLOAT_FORMAT")),x&&w.push("GLOBE"),!this._fogVisible||m||n!==void 0&&!n||w.push("FOG"),m&&w.push("RENDER_TO_TEXTURE"),this._showOverdrawInspector&&w.push("OVERDRAW_INSPECTOR"),w}getOrCreateProgram(t,n){this.cache=this.cache||{};const{defines:l,config:d,overrideFog:p,overrideRtt:m,overrideTerrain:g,overrideGlobe:x,precompiled:w}=n||{},E=this.currentGlobalDefines(t,p,m,g,x).concat(l||[]),A=this.getShaderSource(t),I=Ft.programUniforms,M=Cn.programUniforms,D=Ff[t]||I&&I[t]||M&&M[t],z=Ss.cacheKey(A,t,E,d);return this.cache[z]||(this.cache[z]=new Ss(this.context,t,A,d,D,E,w)),this.cache[z]}getShaderSource(t){const n=Ft.shaders,l=Cn.shaders;return lm[t]||n&&n[t]||l&&l[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 u.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,n,l){if(this.style.enable3dLights()){const d=this.style.directionalLight,p=this.style.ambientLight;if(d&&p){const m=((g,x,w,E)=>{const A=g.properties.get("direction"),I=g.properties.get("color-use-theme")==="none",M=g.properties.get("color").toNonPremultipliedRenderColor(I?null:w.getLut(g.scope)).toArray01();let D=g.properties.get("intensity");const z=x.properties.get("color-use-theme")==="none",O=x.properties.get("color").toNonPremultipliedRenderColor(z?null:w.getLut(x.scope)).toArray01();let k=x.properties.get("intensity");const q=[A.x,A.y,A.z];E&&(E.ambientIntensity!==void 0&&(k=E.ambientIntensity),E.directionalIntensity!==void 0&&(D=E.directionalIntensity),E.ambientColor!==void 0&&(O[0]=E.ambientColor[0],O[1]=E.ambientColor[1],O[2]=E.ambientColor[2]),E.directionalColor!==void 0&&(M[0]=E.directionalColor[0],M[1]=E.directionalColor[1],M[2]=E.directionalColor[2]));const $=u.ey(O,k),U=u.ey(M,D);return{u_lighting_ambient_color:$,u_lighting_directional_dir:q,u_lighting_directional_color:U,u_ground_radiance:Cf(q,U,$)}})(d,p,this.style,l);n.setLightsUniformValues(t,m)}}}uploadCommonUniforms(t,n,l,d,p,m){if(this.uploadCommonLightUniforms(t,n,m),this.terrain&&this.terrain.renderingToTexture)return;const g=this.style.fog;if(g){const x=g.getOpacity(this.transform.pitch),w=((E,A,I,M,D,z,O,k,q,$,U,Q)=>{const Y=E.transform,ae=A.properties.get("color-use-theme")==="none",W=A.properties.get("color").toNonPremultipliedRenderColor(ae?null:E.style.getLut(A.scope)).toArray01();W[3]=M;const J=E.frameCounter/1e3%1,[se,ue]=A.properties.get("vertical-range");return{u_fog_matrix:I?Y.calculateFogTileMatrix(I):Q||E.identityMat,u_fog_range:A.getRangeForProjection(),u_fog_color:W,u_fog_horizon_blend:A.properties.get("horizon-blend"),u_fog_vertical_limit:[Math.min(se,ue),ue],u_fog_temporal_offset:J,u_frustum_tl:D,u_frustum_tr:z,u_frustum_br:O,u_frustum_bl:k,u_globe_pos:q,u_globe_radius:$,u_viewport:U,u_globe_transition:u.ah(Y.zoom),u_is_globe:+(Y.projection.name==="globe")}})(this,g,l,x,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*u.r.devicePixelRatio,this.transform.height*u.r.devicePixelRatio],d);n.setFogUniformValues(t,w)}p&&n.setCutoffUniformValues(t,p.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,n=t.createTexture();return t.bindTexture(t.TEXTURE_2D,n),t.copyTexImage2D(t.TEXTURE_2D,0,t.RGBA,0,0,t.drawingBufferWidth,t.drawingBufferHeight,0),n}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,n=this._backgroundTiles={},l=this.transform.coveringTiles({tileSize:512});for(const d of l)n[d.key]=t[d.key]||new zl(d,512,this.transform.tileZoom,this,void 0,this.worldview);return n}clearBackgroundTiles(){this._backgroundTiles={}}isSourceForClippingOrConflation(t,n){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")&&(!n||n.type!=="batched-model")))}isTileAffectedByFog(t){if(!this.style||!this.style.fog)return!1;if(this.transform.projection.name==="globe")return!0;let n=this._cachedTileFogOpacities[t.key];return n||(this._cachedTileFogOpacities[t.key]=n=this.style.fog.getOpacityForTile(t)),n[0]>=ba||n[1]>=ba}setupDepthForOcclusion(t,n,l){const d=this.context,p=d.gl,m=!!l;var g;l||(l={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(p.TEXTURE3),t&&this.depthFBO&&this.depthTexture?(this.depthTexture.bind(p.NEAREST,p.CLAMP_TO_EDGE),l.u_depth_size_inv=[1/this.depthFBO.width,1/this.depthFBO.height],l.u_depth_range_unpack=[2/((g=this.depthRangeFor3D)[1]-g[0]),-1-2*g[0]/(g[1]-g[0])],l.u_occluder_half_size=.5*this.occlusionParams.occluderSize,l.u_occlusion_depth_offset=this.occlusionParams.depthOffset):this.emptyDepthTexture.bind(p.NEAREST,p.CLAMP_TO_EDGE),d.activeTexture.set(p.TEXTURE0),m||n.setTerrainUniformValues(d,l)}updateEmissiveMode(){if(this._forceEmissiveMode)return;const t=this.style.hasDataDrivenEmissiveStrength();this.emissiveMode=t?this.context.extBlendFuncExtended?"dual-source-blending":"mrt-fallback":"constant"}}function _o(s,t){let n=!1,l=null;const d=()=>{l=null,n&&(s(),l=setTimeout(d,t),n=!1)};return()=>(n=!0,l||d(),l)}const Yg=/(#.+)?$/;class Kg{constructor(t){this._hashName=t&&encodeURIComponent(t),u.cK(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=_o(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 n=t_(t);if(this._hashName){const l=this._hashName;let d=!1;const p=location.hash.slice(1).split("&").map(m=>{const g=m.split("=")[0];return g===l?(d=!0,`${g}=${n}`):m}).filter(m=>m);return d||p.push(`${l}=${n}`),`#${p.join("&")}`}return`#${n}`}_getCurrentHash(){const t=location.hash.replace("#","");if(this._hashName){let n;return t.split("&").map(l=>l.split("=")).forEach(l=>{l[0]===this._hashName&&(n=l)}),(n&&n[1]||"").split("/")}return t.split("/")}_onHashChange(){const t=this._map;if(!t)return!1;const n=this._getCurrentHash();if(n.length>=3&&!n.some(l=>isNaN(Number(l)))){const l=t.dragRotate.isEnabled()&&t.touchZoomRotate.isEnabled()?+(n[3]||0):t.getBearing();return t.jumpTo({center:[+n[2],+n[1]],zoom:+n[0],bearing:l,pitch:+(n[4]||0)}),!0}return!1}_updateHashUnthrottled(){history.replaceState(history.state,"",location.href.replace(Yg,this.getHashString()))}}function t_(s,t){const n=s.getCenter(),l=Math.round(100*s.getZoom())/100,d=Math.ceil((l*Math.LN2+Math.log(512/360/.5))/Math.LN10),p=Math.pow(10,d),m=Math.round(n.lng*p)/p,g=Math.round(n.lat*p)/p,x=s.getBearing(),w=s.getPitch();let E=t?`/${m}/${g}/${l}`:`${l}/${g}/${m}`;return(x||w)&&(E+="/"+Math.round(10*x)/10),w&&(E+=`/${Math.round(w)}`),E}const zh={linearity:.3,easing:u.f4(0,0,.3,1)},i_={deceleration:2500,maxSpeed:1400,...zh},$f={deceleration:20,maxSpeed:1400,...zh},Zf={deceleration:1e3,maxSpeed:360,...zh},Jg={deceleration:1e3,maxSpeed:90,...zh};class Qg{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:u.r.now(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,n=u.r.now();for(;t.length>0&&n-t[0].time>160;)t.shift()}_onMoveEnd(t){if(this._map._prefersReducedMotion()||(this._drainInertiaBuffer(),this._inertiaBuffer.length<2))return;const n={zoom:0,bearing:0,pitch:0,pan:new u.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:p}of this._inertiaBuffer)n.zoom+=p.zoomDelta||0,n.bearing+=p.bearingDelta||0,n.pitch+=p.pitchDelta||0,p.panDelta&&n.pan._add(p.panDelta),p.around&&(n.around=p.around),p.pinchAround&&(n.pinchAround=p.pinchAround);const l=this._inertiaBuffer.at(-1).time-this._inertiaBuffer[0].time,d={};if(n.pan.mag()){const p=Fh(n.pan.mag(),l,{...i_,...t||{}});d.offset=n.pan.mult(p.amount/n.pan.mag()),d.center=this._map.transform.center,Lh(d,p)}if(n.zoom){const p=Fh(n.zoom,l,$f);d.zoom=this._map.transform.zoom+p.amount,Lh(d,p)}if(n.bearing){const p=Fh(n.bearing,l,Zf);d.bearing=this._map.transform.bearing+u.as(p.amount,-179,179),Lh(d,p)}if(n.pitch){const p=Fh(n.pitch,l,Jg);d.pitch=this._map.transform.pitch+p.amount,Lh(d,p)}if(d.zoom||d.bearing){const p=n.pinchAround===void 0?n.around:n.pinchAround;d.around=p?this._map.unproject(p):this._map.getCenter()}return this.clear(),d.noMoveStart=!0,d}}function Lh(s,t){(!s.duration||s.duration<t.duration)&&(s.duration=t.duration,s.easing=t.easing)}function Fh(s,t,n){const{maxSpeed:l,linearity:d,deceleration:p}=n,m=u.as(s*d/(t/1e3),-l,l),g=Math.abs(m)/(p*d);return{easing:n.easing,duration:1e3*g,amount:m*(g/2)}}class Hn extends u.B{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,l,d={}){const p=eo(n.getCanvasContainer(),l);super(t,{point:p,lngLat:n.unproject(p),originalEvent:l,...d}),this._defaultPrevented=!1,this.target=n}}class Oh extends u.B{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,l){const d=t==="touchend"?l.changedTouches:l.touches,p=fa(n.getCanvasContainer(),d),m=p.map(x=>n.unproject(x)),g=p.reduce((x,w,E,A)=>x.add(w.div(A.length)),new u.P(0,0));super(t,{points:p,point:g,lngLats:m,lngLat:n.unproject(g),originalEvent:l}),this._defaultPrevented=!1}}class ey extends u.B{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n){super("wheel",{originalEvent:n}),this._defaultPrevented=!1}}class ty{constructor(t,n){this._map=t,this._clickTolerance=n.clickTolerance}reset(){this._mousedownPos=void 0}wheel(t){return this._firePreventable(new ey(this._map,t))}mousedown(t,n){return this._mousedownPos=n,this._firePreventable(new Hn(t.type,this._map,t))}mouseup(t){this._map.fire(new Hn(t.type,this._map,t))}preclick(t){const n=new MouseEvent("preclick",t);this._map.fire(new Hn(n.type,this._map,n))}click(t,n){this._mousedownPos&&this._mousedownPos.dist(n)>=this._clickTolerance||(this.preclick(t),this._map.fire(new Hn(t.type,this._map,t)))}dblclick(t){return this._firePreventable(new Hn(t.type,this._map,t))}mouseover(t){this._map.fire(new Hn(t.type,this._map,t))}mouseout(t){this._map.fire(new Hn(t.type,this._map,t))}touchstart(t){return this._firePreventable(new Oh(t.type,this._map,t))}touchmove(t){this._map.fire(new Oh(t.type,this._map,t))}touchend(t){this._map.fire(new Oh(t.type,this._map,t))}touchcancel(t){this._map.fire(new Oh(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class iy{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._contextMenuEvent=void 0}mousemove(t){this._map.fire(new Hn(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Hn("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._map.fire(new Hn(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class ra{constructor(t,n){this._map=t,this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=n.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(t,n){this.isEnabled()&&t.shiftKey&&t.button===0&&(Gr(),this._startPos=this._lastPos=n,this._active=!0)}mousemoveWindow(t,n){if(!this._active)return;const l=n,d=this._startPos,p=this._lastPos;if(!d||!p||p.equals(l)||!this._box&&l.dist(d)<this._clickTolerance)return;this._lastPos=l,this._box||(this._box=ni("div","mapboxgl-boxzoom",this._container),this._container.classList.add("mapboxgl-crosshair"),this._fireEvent("boxzoomstart",t));const m=Math.min(d.x,l.x),g=Math.max(d.x,l.x),x=Math.min(d.y,l.y),w=Math.max(d.y,l.y);this._map._requestDomTask(()=>{this._box&&(this._box.style.transform=`translate(${m}px,${x}px)`,this._box.style.width=g-m+"px",this._box.style.height=w-x+"px")})}mouseupWindow(t,n){if(!this._active)return;const l=this._startPos,d=n;if(l&&t.button===0){if(this.reset(),Tn(),l.x!==d.x||l.y!==d.y)return this._map.fire(new u.B("boxzoomend",{originalEvent:t})),{cameraAnimation:p=>p.fitScreenCoordinates(l,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),ts(),delete this._startPos,delete this._lastPos}_fireEvent(t,n){return this._map.fire(new u.B(t,{originalEvent:n}))}}function Wf(s,t){const n={};for(let l=0;l<s.length;l++)n[s[l].identifier]=t[l];return n}class ry{constructor(t){this.reset(),this.numTouches=t.numTouches}reset(){this.centroid=void 0,this.startTime=0,this.touches={},this.aborted=!1}touchstart(t,n,l){(this.centroid||l.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===0&&(this.startTime=t.timeStamp),l.length===this.numTouches&&(this.centroid=(function(d){const p=new u.P(0,0);for(const m of d)p._add(m);return p.div(d.length)})(n),this.touches=Wf(l,n)))}touchmove(t,n,l){if(this.aborted||!this.centroid)return;const d=Wf(l,n);for(const p in this.touches){const m=d[p];(!m||m.dist(this.touches[p])>30)&&(this.aborted=!0)}}touchend(t,n,l){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),l.length===0){const d=!this.aborted&&this.centroid;if(this.reset(),d)return d}}}class Xf{constructor(t){this.singleTap=new ry(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,this.lastTap=void 0,this.count=0,this.singleTap.reset()}touchstart(t,n,l){this.singleTap.touchstart(t,n,l)}touchmove(t,n,l){this.singleTap.touchmove(t,n,l)}touchend(t,n,l){const d=this.singleTap.touchend(t,n,l);if(d){const p=t.timeStamp-this.lastTime<500,m=!this.lastTap||this.lastTap.dist(d)<30;if(p&&m||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=d,this.count===this.numTaps)return this.reset(),d}}}class Yf{constructor(){this._zoomIn=new Xf({numTouches:1,numTaps:2}),this._zoomOut=new Xf({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(t,n,l){this._zoomIn.touchstart(t,n,l),this._zoomOut.touchstart(t,n,l)}touchmove(t,n,l){this._zoomIn.touchmove(t,n,l),this._zoomOut.touchmove(t,n,l)}touchend(t,n,l){const d=this._zoomIn.touchend(t,n,l),p=this._zoomOut.touchend(t,n,l);return d?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:m=>m.easeTo({duration:300,zoom:m.getZoom()+1,around:m.unproject(d)},{originalEvent:t})}):p?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:m=>m.easeTo({duration:300,zoom:m.getZoom()-1,around:m.unproject(p)},{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 Kf=0,ny=2,Jf={[Kf]:1,[ny]:2},r_={Control:"ctrlKey",Alt:"altKey",Shift:"shiftKey",Meta:"metaKey"};class eu{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,n){return!1}_move(t,n){return{}}mousedown(t,n){if(this._lastPoint)return;const l=nl(t);this._correctButton(t,l)&&(this._lastPoint=n,this._eventButton=l)}mousemoveWindow(t,n){const l=this._lastPoint;if(l){if(t.preventDefault(),this._eventButton!=null&&(function(d,p){const m=Jf[p];return d.buttons===void 0||(d.buttons&m)!==m})(t,this._eventButton))this.reset();else if(this._moved||!(n.dist(l)<this._clickTolerance))return this._moved=!0,this._lastPoint=n,this._move(l,n)}}mouseupWindow(t){this._lastPoint&&nl(t)===this._eventButton&&(this._moved&&Tn(),this.reset())}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class oy extends eu{mousedown(t,n){super.mousedown(t,n),this._lastPoint&&(this._active=!0)}_correctButton(t,n){return n===0&&!t.ctrlKey}_move(t,n){return{around:n,panDelta:n.sub(t)}}}class Bh extends eu{constructor(t){super(t),this._pitchRotateKey=t.pitchRotateKey?r_[t.pitchRotateKey]:void 0}_correctButton(t,n){return this._pitchRotateKey?n===0&&t[this._pitchRotateKey]:n===0&&t.ctrlKey||n===2}_move(t,n){const l=.8*(n.x-t.x);if(l)return this._active=!0,{bearingDelta:l}}contextmenu(t){this._pitchRotateKey||t.preventDefault()}}class n_ extends eu{constructor(t){super(t),this._pitchRotateKey=t.pitchRotateKey?r_[t.pitchRotateKey]:void 0}_correctButton(t,n){return this._pitchRotateKey?n===0&&t[this._pitchRotateKey]:n===0&&t.ctrlKey||n===2}_move(t,n){const l=-.5*(n.y-t.y);if(l)return this._active=!0,{pitchDelta:l}}contextmenu(t){this._pitchRotateKey||t.preventDefault()}}class Qf{constructor(t,n){this._map=t,this._el=t.getCanvasContainer(),this._minTouches=1,this._clickTolerance=n.clickTolerance||1,this.reset(),u.cK(["_addTouchPanBlocker","_showTouchPanBlockerAlert"],this)}reset(){this._active=!1,this._touches={},this._sum=new u.P(0,0)}touchstart(t,n,l){return this._calculateTransform(t,n,l)}touchmove(t,n,l){if(this._active&&!(l.length<this._minTouches)){if(this._map._cooperativeGestures&&!this._map.isMoving()){if(l.length===1&&!u.f5())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,n,l)}}touchend(t,n,l){this._calculateTransform(t,n,l),this._active&&l.length<this._minTouches&&this.reset()}touchcancel(){this.reset()}_calculateTransform(t,n,l){l.length>0&&(this._active=!0);const d=Wf(l,n),p=new u.P(0,0),m=new u.P(0,0);let g=0;for(const w in d){const E=d[w],A=this._touches[w];A&&(p._add(E),m._add(E.sub(A)),g++,d[w]=E)}if(this._touches=d,g<this._minTouches||!m.mag())return;const x=m.div(g);return this._sum._add(x),this._sum.mag()<this._clickTolerance?void 0:{around:p.div(g),panDelta:x}}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=ni("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 kh{constructor(){this.reset()}reset(){this._active=!1,this._firstTwoTouches=void 0}_start(t){}_move(t,n,l){return{}}touchstart(t,n,l){this._firstTwoTouches||l.length<2||(this._firstTwoTouches=[l[0].identifier,l[1].identifier],this._start([n[0],n[1]]))}touchmove(t,n,l){const d=this._firstTwoTouches;if(!d)return;t.preventDefault();const[p,m]=d,g=tu(l,n,p),x=tu(l,n,m);if(!g||!x)return;const w=this._aroundCenter?null:g.add(x).div(2);return this._move([g,x],w,t)}touchend(t,n,l){if(!this._firstTwoTouches)return;const[d,p]=this._firstTwoTouches,m=tu(l,n,d),g=tu(l,n,p);m&&g||(this._active&&Tn(),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 tu(s,t,n){for(let l=0;l<s.length;l++)if(s[l].identifier===n)return t[l]}function As(s,t){return Math.log2(s/t)}class o_ extends kh{reset(){super.reset(),this._distance=0,this._startDistance=0}_start(t){this._startDistance=this._distance=t[0].dist(t[1])}_move(t,n){const l=this._distance;if(this._distance=t[0].dist(t[1]),this._active||!(Math.abs(As(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:As(this._distance,l),pinchAround:n}}}function Ha(s,t){return 180*s.angleWith(t)/Math.PI}class Kl extends kh{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,n){const l=this._vector;if(this._vector=t[0].sub(t[1]),l&&(this._active||!this._isBelowThreshold(this._vector)))return this._active=!0,{bearingDelta:Ha(this._vector,l),pinchAround:n}}_isBelowThreshold(t){this._minDiameter=Math.min(this._minDiameter,t.mag());const n=25/(Math.PI*this._minDiameter)*360,l=this._startVector;if(!l)return!1;const d=Ha(t,l);return Math.abs(d)<n}}function iu(s){return Math.abs(s.y)>Math.abs(s.x)}class $a extends kh{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,iu(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,n,l){const d=this._lastPoints;if(!d)return;const p=t[0].sub(d[0]),m=t[1].sub(d[1]);return this._map._cooperativeGestures&&!u.f5()&&l.touches.length<3||(this._valid=this.gestureBeginsVertically(p,m,l.timeStamp),!this._valid)?void 0:(this._lastPoints=t,this._active=!0,{pitchDelta:(p.y+m.y)/2*-.5})}gestureBeginsVertically(t,n,l){if(this._valid!==void 0)return this._valid;const d=t.mag()>=2,p=n.mag()>=2;if(!d&&!p)return;if(!d||!p)return this._firstMove==null&&(this._firstMove=l),l-this._firstMove<100&&void 0;const m=t.y>0==n.y>0;return iu(t)&&iu(n)&&m}}const s_={panStep:100,bearingStep:15,pitchStep:10};class a_{constructor(){const t=s_;this._panStep=t.panStep,this._bearingStep=t.bearingStep,this._pitchStep=t.pitchStep,this._rotationDisabled=!1,this._panDisabled=!1}blur(){this.reset()}reset(){this._active=!1}keydown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let n=0,l=0,d=0,p=0,m=0;switch(t.keyCode){case 61:case 107:case 171:case 187:n=1;break;case 189:case 109:case 173:n=-1;break;case 37:t.shiftKey?l=-1:(t.preventDefault(),p=-1);break;case 39:t.shiftKey?l=1:(t.preventDefault(),p=1);break;case 38:t.shiftKey?d=1:(t.preventDefault(),m=-1);break;case 40:t.shiftKey?d=-1:(t.preventDefault(),m=1);break;default:return}return this._rotationDisabled&&(l=0,d=0),this._panDisabled&&(p=0,m=0),{cameraAnimation:g=>{const x=g.getZoom();g.easeTo({duration:300,easeId:"keyboardHandler",easing:l_,zoom:n?Math.round(x)+n*(t.shiftKey?2:1):x,bearing:g.getBearing()+l*this._bearingStep,pitch:g.getPitch()+d*this._pitchStep,offset:[-p*this._panStep,-m*this._panStep],center:g.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}disablePan(){this._panDisabled=!0}enablePan(){this._panDisabled=!1}}function l_(s){return s*(2-s)}const ru=4.000244140625,sy=1/450,c_=/(Mac|iPad)/i;class u_{constructor(t,n){this._map=t,this._el=t.getCanvasContainer(),this._handler=n,this._delta=0,this._lastDelta=0,this._defaultZoomRate=.01,this._wheelZoomRate=sy,u.cK(["_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()||u.f5()))return void this._showBlockerAlert();this._alertContainer.style.visibility!=="hidden"&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}let n=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY;const l=u.r.now(),d=l-(this._lastWheelEventTime||0);this._lastWheelEventTime=l,n!==0&&n%ru===0?this._type="wheel":n!==0&&Math.abs(n)<4?this._type="trackpad":d>400?(this._type=null,this._lastValue=n,this._timeout=window.setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(d*n)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,n+=this._lastValue)),t.shiftKey&&n&&(n/=4),this._type&&(this._lastWheelEvent=t,this._delta-=n,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 n=eo(this._el,t);this._aroundPoint=this._aroundCenter?this._map.transform.centerPoint:n,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 n=()=>t._terrainEnabled()&&this._aroundCoord?t.computeZoomRelativeTo(this._aroundCoord):t.zoom;if(this._delta!==0){const w=this._type==="wheel"&&Math.abs(this._delta)>ru?this._wheelZoomRate:this._defaultZoomRate;let E=2/(1+Math.exp(-Math.abs(this._delta*w)));this._delta<0&&E!==0&&(E=1/E);const A=n(),I=Math.pow(2,A),M=typeof this._targetZoom=="number"?t.zoomScale(this._targetZoom):I;this._targetZoom=Math.min(t.maxZoom,Math.max(t.minZoom,t.scaleZoom(M*E))),this._type==="wheel"&&(this._startZoom=A,this._easing=this._smoothOutEasing(200)),this._lastDelta=this._delta,this._delta=0}const l=typeof this._targetZoom=="number"?this._targetZoom:n(),d=this._startZoom,p=this._easing;let m,g=!1;if(this._type==="wheel"&&d&&p){const w=Math.min((u.r.now()-this._lastWheelEventTime)/200,1),E=p(w);m=u.ai(d,l,E),w<1?this._frameId||(this._frameId=!0):g=!0}else m=l,g=!0;this._active=!0,g&&(this._active=!1,this._finishTimeout=window.setTimeout(()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200));let x=m-n();return x*this._lastDelta<0&&(x=0),{noInertia:!0,needsRenderFrame:!g,zoomDelta:x,around:this._aroundPoint,aroundCoord:this._aroundCoord,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let n=u.f6;if(this._prevEase){const l=this._prevEase,d=(u.r.now()-l.start)/l.duration,p=l.easing(d+.01)-l.easing(d),m=.27/Math.sqrt(p*p+1e-4)*.01,g=Math.sqrt(.0729-m*m);n=u.f4(m,g,.25,1)}return this._prevEase={start:u.r.now(),duration:t,easing:n},n}blur(){this.reset()}reset(){this._active=!1}_addScrollZoomBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=ni("div","mapboxgl-scroll-zoom-blocker",this._map._container),this._alertContainer.textContent=c_.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 h_{constructor(t,n){this._clickZoom=t,this._tapZoom=n}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 ep{constructor(){this.reset()}reset(){this._active=!1}blur(){this.reset()}dblclick(t,n){return t.preventDefault(),{cameraAnimation:l=>{l.easeTo({duration:300,zoom:l.getZoom()+(t.shiftKey?-1:1),around:l.unproject(n)},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class na{constructor(){this._tap=new Xf({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,n,l){this._swipePoint||(this._tapTime&&t.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?l.length>0&&(this._swipePoint=n[0],this._swipeTouch=l[0].identifier):this._tap.touchstart(t,n,l))}touchmove(t,n,l){if(this._tapTime){if(this._swipePoint){if(l[0].identifier!==this._swipeTouch)return;const d=n[0],p=d.y-this._swipePoint.y;return this._swipePoint=d,t.preventDefault(),this._active=!0,{zoomDelta:p/128}}}else this._tap.touchmove(t,n,l)}touchend(t,n,l){this._tapTime?this._swipePoint&&l.length===0&&this.reset():this._tap.touchend(t,n,l)&&(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,n,l){this._el=t,this._mousePan=n,this._touchPan=l}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 d_{constructor(t,n,l){this._pitchWithRotate=t.pitchWithRotate,this._mouseRotate=n,this._mousePitch=l,this._pitchDisabled=!1}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&!this._pitchDisabled&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._pitchDisabled||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}disablePitch(){this._pitchDisabled=!0,this._mousePitch.disable()}enablePitch(){this._pitchDisabled=!1,this._pitchWithRotate&&this._mouseRotate.isEnabled()&&this._mousePitch.enable()}}class f_{constructor(t,n,l,d){this._el=t,this._touchZoom=n,this._touchRotate=l,this._tapDragZoom=d,this._rotationDisabled=!1,this._tapDragZoomDisabled=!1,this._enabled=!0}enable(t){this._touchZoom.enable(t),this._rotationDisabled||this._touchRotate.enable(t),this._tapDragZoomDisabled||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._tapDragZoomDisabled||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()}disableTapDragZoom(){this._tapDragZoomDisabled=!0,this._tapDragZoom.disable()}enableTapDragZoom(){this._tapDragZoomDisabled=!1,this._touchZoom.isEnabled()&&this._tapDragZoom.enable()}}const $n=s=>s.zoom||s.drag||s.pitch||s.rotate;class p_ extends u.B{}class ay{constructor(){this.constants=[1,1,.01],this.radius=0}setup(t,n){const l=u.aW([],n,t);this.radius=u.ae(l[2]<0?u.f8([],l,this.constants):[l[0],l[1],0])}projectRay(t){u.f8(t,t,this.constants),u.au(t,t),u.f9(t,t,this.constants);const n=u.av([],t,this.radius);if(n[2]>0){const l=u.av([],[0,0,1],u.aw(n,[0,0,1])),d=u.av([],u.au([],[n[0],n[1],0]),this.radius),p=u.cz([],n,u.av([],u.aW([],u.cz([],d,l),n),2));n[0]=p[0],n[1]=p[1]}return n}}function Nh(s){return s.panDelta&&s.panDelta.mag()||s.zoomDelta||s.bearingDelta||s.pitchDelta}class ly{constructor(t,n){this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Qg(t),this._bearingSnap=n.bearingSnap,this._previousActiveHandlers={},this._trackingEllipsoid=new ay,this._dragOrigin=null,this._eventsInProgress={},this._addDefaultHandlers(n),u.cK(["handleEvent","handleWindowEvent"],this);const l=this._el;this._listeners=[[l,"touchstart",{passive:!0}],[l,"touchmove",{passive:!1}],[l,"touchend",void 0],[l,"touchcancel",void 0],[l,"mousedown",void 0],[l,"mousemove",void 0],[l,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[l,"mouseover",void 0],[l,"mouseout",void 0],[l,"dblclick",void 0],[l,"click",void 0],[l,"keydown",{capture:!1}],[l,"keyup",void 0],[l,"wheel",{passive:!1}],[l,"contextmenu",void 0],[window,"blur",void 0]];for(const[d,p,m]of this._listeners){const g=d===document?this.handleWindowEvent:this.handleEvent;d.addEventListener(p,g,m)}}destroy(){for(const[t,n,l]of this._listeners){const d=t===document?this.handleWindowEvent:this.handleEvent;t.removeEventListener(n,d,l)}}_addDefaultHandlers(t){const n=this._map,l=n.getCanvasContainer();this._add("mapEvent",new ty(n,t));const d=n.boxZoom=new ra(n,t);this._add("boxZoom",d);const p=new Yf,m=new ep;n.doubleClickZoom=new h_(m,p),this._add("tapZoom",p),this._add("clickZoom",m);const g=new na;this._add("tapDragZoom",g);const x=n.touchPitch=new $a(n);this._add("touchPitch",x);const w=new Bh(t),E=new n_(t);n.dragRotate=new d_(t,w,E),this._add("mouseRotate",w,["mousePitch"]),this._add("mousePitch",E,["mouseRotate"]);const A=new oy(t),I=new Qf(n,t);n.dragPan=new Or(l,A,I),this._add("mousePan",A),this._add("touchPan",I,["touchZoom","touchRotate"]);const M=new Kl,D=new o_;n.touchZoomRotate=new f_(l,D,M,g),this._add("touchRotate",M,["touchPan","touchZoom"]),this._add("touchZoom",D,["touchPan","touchRotate"]),this._add("blockableMapEvent",new iy(n));const z=n.scrollZoom=new u_(n,this);this._add("scrollZoom",z,["mousePan"]);const O=n.keyboard=new a_;this._add("keyboard",O);for(const k of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])t.interactive&&t[k]&&n[k].enable(t[k])}_add(t,n,l){this._handlers.push({handlerName:t,handler:n,allowed:l}),this._handlersById[t]=n}stop(t){if(!this._updatingCamera){for(const{handler:n}of this._handlers)n.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!!$n(this._eventsInProgress)||this.isZooming()}_isDragging(){return!!this._eventsInProgress.drag}_blockedByActive(t,n,l){for(const d in t)if(!(d===l||n&&n.includes(d)))return!0;return!1}handleWindowEvent(t){this.handleEvent(t,`${t.type}Window`)}_getMapTouches(t){const n=[];for(const l of t)this._el.contains(l.target)&&n.push(l);return n}handleEvent(t,n){this._updatingCamera=!0;const l=t.type==="renderFrame",d=l?void 0:t,p={needsRenderFrame:!1},m={},g={},x=t.touches?this._getMapTouches(t.touches):void 0,w=x?fa(this._el,x):l?void 0:eo(this._el,t);for(const{handlerName:I,handler:M,allowed:D}of this._handlers){if(!M.isEnabled())continue;let z;this._blockedByActive(g,D,I)?M.reset():M[n||t.type]&&(z=M[n||t.type](t,w,x),this.mergeHandlerResult(p,m,z,I,d),z&&z.needsRenderFrame&&this._triggerRenderFrame()),(z||M.isActive())&&(g[I]=M)}const E={};for(const I in this._previousActiveHandlers)g[I]||(E[I]=d);this._previousActiveHandlers=g,(Object.keys(E).length||Nh(p))&&(this._changes.push([p,m,E]),this._triggerRenderFrame()),(Object.keys(g).length||Nh(p))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:A}=p;A&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],A(this._map))}mergeHandlerResult(t,n,l,d,p){if(!l)return;Object.assign(t,l);const m={handlerName:d,originalEvent:l.originalEvent||p};l.zoomDelta!==void 0&&(n.zoom=m),l.panDelta!==void 0&&(n.drag=m),l.pitchDelta!==void 0&&(n.pitch=m),l.bearingDelta!==void 0&&(n.rotate=m)}_applyChanges(){const t={},n={},l={};for(const[d,p,m]of this._changes)d.panDelta&&(t.panDelta=(t.panDelta||new u.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(n,p),Object.assign(l,m);this._updateMapTransform(t,n,l),this._changes=[]}_updateMapTransform(t,n,l){const d=this._map,p=d.transform,m=q=>[q.x,q.y,q.z];if((()=>{const q=this._eventsInProgress.drag;return q&&!this._handlersById[q.handlerName].isActive()})()&&!Nh(t)){const q=p.zoom;p.cameraElevationReference="sea",this._originalZoom!=null&&p._orthographicProjectionAtLowPitch&&p.projection.name!=="globe"&&p.pitch===0?(p.cameraElevationReference="ground",p.zoom=this._originalZoom):(p.recenterOnTerrain(),p.cameraElevationReference="ground"),q!==p.zoom&&this._map._update(!0)}if(p._isCameraConstrained&&d._stop(!0),!Nh(t))return void this._fireEvents(n,l,!0);let{panDelta:g,zoomDelta:x,bearingDelta:w,pitchDelta:E,around:A,aroundCoord:I,pinchAround:M}=t;p._isCameraConstrained&&(x>0&&(x=0),p._isCameraConstrained=!1),M!==void 0&&(A=M),(x||(q=>n[q]&&!this._eventsInProgress[q])("drag"))&&A&&(this._dragOrigin=m(p.pointCoordinate3D(A)),this._originalZoom=p.zoom,this._trackingEllipsoid.setup(p._camera.position,this._dragOrigin)),p.cameraElevationReference="sea",d._stop(!0),A=A||d.transform.centerPoint,w&&(p.bearing+=w),E&&(p.pitch+=E),p._updateCameraState();const D=[0,0,0];if(g)if(p.projection.name==="mercator"){const q=this._trackingEllipsoid.projectRay(p.screenPointToMercatorRay(A).dir),$=this._trackingEllipsoid.projectRay(p.screenPointToMercatorRay(A.sub(g)).dir);D[0]=$[0]-q[0],D[1]=$[1]-q[1]}else{const q=p.pointCoordinate(A);if(p.projection.name==="globe"){g=g.rotate(-p.angle);const $=p._pixelsPerMercatorPixel/p.worldSize;D[0]=-g.x*u.f7(u.aM(q.y))*$,D[1]=-g.y*u.f7(p.center.lat)*$}else{const $=p.pointCoordinate(A.sub(g));q&&$&&(D[0]=$.x-q.x,D[1]=$.y-q.y)}}const z=p.zoom,O=[0,0,0];if(x){const q=m(I||p.pointCoordinate3D(A)),$={dir:u.au([],u.aW([],q,p._camera.position))};if($.dir[2]<0){const U=p.zoomDeltaToMovement(q,x);u.av(O,$.dir,U)}}const k=u.cz(D,D,O);p._translateCameraConstrained(k),x&&Math.abs(p.zoom-z)>1e-4&&p.recenterOnTerrain(),p.cameraElevationReference="ground",this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(n,l,!0)}_fireEvents(t,n,l){const d=$n(this._eventsInProgress),p=$n(t),m={};for(const E in t){const{originalEvent:A}=t[E];this._eventsInProgress[E]||(m[`${E}start`]=A),this._eventsInProgress[E]=t[E]}!d&&p&&this._fireEvent("movestart",p.originalEvent);for(const E in m)this._fireEvent(E,m[E]);p&&this._fireEvent("move",p.originalEvent);for(const E in t){const{originalEvent:A}=t[E];this._fireEvent(E,A)}const g={};let x;for(const E in this._eventsInProgress){const{handlerName:A,originalEvent:I}=this._eventsInProgress[E];this._handlersById[A].isActive()||(delete this._eventsInProgress[E],x=n[A]||I,g[`${E}end`]=x)}for(const E in g)this._fireEvent(E,g[E]);const w=$n(this._eventsInProgress);if(l&&(d||p)&&!w){this._updatingCamera=!0;const E=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),A=I=>I!==0&&-this._bearingSnap<I&&I<this._bearingSnap;E?(A(E.bearing||this._map.getBearing())&&(E.bearing=0),this._map.easeTo(E,{originalEvent:x})):(this._map.fire(new u.B("moveend",{originalEvent:x})),A(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(t,n){this._map.fire(new u.B(t,n?{originalEvent:n}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(t=>{this._frameId=void 0,this.handleEvent(new p_("renderFrame",{timeStamp:t})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}const Vh="map.setFreeCameraOptions(...) and map.getFreeCameraOptions() are not yet supported for non-mercator projections.";class tp extends u.E{constructor(t,n){super(),this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=n.bearingSnap,this._respectPrefersReducedMotion=n.respectPrefersReducedMotion!==!1,u.cK(["_renderFrameCallback"],this)}getCenter(){return new u.b2(this.transform.center.lng,this.transform.center.lat)}setCenter(t,n){return this.jumpTo({center:t},n)}panBy(t,n,l){return t=u.P.convert(t).mult(-1),this.panTo(this.transform.center,{offset:t,...n},l)}panTo(t,n,l){return this.easeTo({center:t,...n},l)}getZoom(){return this.transform.zoom}setZoom(t,n){return this.jumpTo({zoom:t},n),this}zoomTo(t,n,l){return this.easeTo({zoom:t,...n},l)}zoomIn(t,n){return this.zoomTo(this.getZoom()+1,t,n),this}zoomOut(t,n){return this.zoomTo(this.getZoom()-1,t,n),this}getBearing(){return this.transform.bearing}setBearing(t,n){return this.jumpTo({bearing:t},n),this}getPadding(){return this.transform.padding}setPadding(t,n){return this.jumpTo({padding:t},n),this}rotateTo(t,n,l){return this.easeTo({bearing:t,...n},l)}resetNorth(t,n){return this.rotateTo(0,{duration:1e3,...t},n),this}resetNorthPitch(t,n){return this.easeTo({bearing:0,pitch:0,duration:1e3,...t},n),this}snapToNorth(t,n){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(t,n):this}getPitch(){return this.transform.pitch}setPitch(t,n){return this.jumpTo({pitch:t},n),this}cameraForBounds(t,n){t=u.bD.convert(t);const l=n&&n.bearing||0,d=n&&n.pitch||0,p=t.getNorthWest(),m=t.getSouthEast();return this._cameraForBounds(this.transform,p,m,l,d,n)}_extendPadding(t){const n={top:0,right:0,bottom:0,left:0};return t==null?{...n,...this.transform.padding}:typeof t=="number"?{top:t,bottom:t,right:t,left:t}:{...n,...t}}_extendCameraOptions(t){return(t={offset:[0,0],maxZoom:this.transform.maxZoom,...t}).padding=this._extendPadding(t.padding),t}_minimumAABBFrustumDistance(t,n){const l=n.max[0]-n.min[0],d=n.max[1]-n.min[1];return l/d>t.aspect?l/(2*Math.tan(.5*t.fovX)*t.aspect):d/(2*Math.tan(.5*t.fovY)*t.aspect)}_cameraForBoundsOnGlobe(t,n,l,d,p,m){const g=t.clone(),x=this._extendCameraOptions(m);g.bearing=d,g.pitch=p;const w=u.b2.convert(n),E=u.b2.convert(l),A=.5*(w.lat+E.lat),I=.5*(w.lng+E.lng),M=u.fa(A,I),D=u.au([],M),z=u.au([],u.ax([],D,[0,1,0])),O=u.ax([],z,D),k=[z[0],z[1],z[2],0,O[0],O[1],O[2],0,D[0],D[1],D[2],0,0,0,0,1],q=[M,u.fa(w.lat,w.lng),u.fa(E.lat,w.lng),u.fa(E.lat,E.lng),u.fa(w.lat,E.lng),u.fa(A,w.lng),u.fa(A,E.lng),u.fa(w.lat,I),u.fa(E.lat,I)];let $=u.ca.fromPoints(q.map(Me=>[u.aw(z,Me),u.aw(O,Me),u.aw(D,Me)]));const U=u.ad([],$.center,k);u.fb(U)===0&&u.fc(U,0,0,1),u.au(U,U),u.av(U,U,u.dJ),g.center=u.fd(U);const Q=g.getWorldToCameraMatrix(),Y=u.aE(new Float64Array(16),Q);$=u.ca.applyTransform($,u.aP([],Q,k));const ae=this._extendAABB($,g,x,d);if(!ae)return void u.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");$=ae,u.ad(U,U,Q);const W=.5*($.max[2]-$.min[2]),J=this._minimumAABBFrustumDistance(g,$),se=u.av([],[0,0,1],W),ue=u.cz(se,U,se),he=J+(g.pitch===0?0:u.aX(U,ue)),ve=g.globeCenterInViewSpace,xe=u.aW([],U,[ve[0],ve[1],ve[2]]);u.au(xe,xe),u.av(xe,xe,he);const Le=u.cz([],U,xe);u.ad(Le,Le,Y);const _e=u.dt/u.dJ,Pe=u.ae(Le),me=u.aL(Math.max(Pe*_e-u.dt,Number.EPSILON),0),Re=Math.min(g.zoomFromMercatorZAdjusted(me),x.maxZoom);return Re>.5*(u.bU+u.bB)?(g.setProjection({name:"mercator"}),g.zoom=Re,this._cameraForBounds(g,n,l,d,p,m)):{center:g.center,zoom:Re,bearing:d,pitch:p}}_extendAABB(t,n,l,d){const p=.5*((l.padding.left||0)+(l.padding.right||0)),m=.5*((l.padding.top||0)+(l.padding.bottom||0)),g=m,x=p,w=p,E=m,A=n.width-(x+w),I=n.height-(g+E),M=u.aW([],t.max,t.min),D=Math.min(A/M[0],I/M[1]),z=Math.min(n.scaleZoom(n.scale*D),l.maxZoom);if(isNaN(z))return null;const O=n.scale/n.zoomScale(z),k=new u.ca([t.min[0]-x*O,t.min[1]-E*O,t.min[2]],[t.max[0]+w*O,t.max[1]+g*O,t.max[2]]),q=(typeof l.offset.x=="number"&&typeof l.offset.y=="number"?new u.P(l.offset.x,l.offset.y):u.P.convert(l.offset)).rotate(-u.al(d));return k.center[0]-=q.x*O,k.center[1]+=q.y*O,k}queryTerrainElevation(t,n){const l=this.transform.elevation;return l?(n={exaggerated:!0,...n},l.getAtPoint(u.ac.fromLngLat(t),null,n.exaggerated)):null}_cameraForBounds(t,n,l,d,p,m){if(t.projection.name==="globe")return this._cameraForBoundsOnGlobe(t,n,l,d,p,m);const g=t.clone(),x=this._extendCameraOptions(m);g.bearing=d,g.pitch=p;const w=u.b2.convert(n),E=u.b2.convert(l),A=new u.b2(w.lng,E.lat),I=new u.b2(E.lng,w.lat),M=g.project(w),D=g.project(E),z=this.queryTerrainElevation(w),O=this.queryTerrainElevation(E),k=this.queryTerrainElevation(A),q=this.queryTerrainElevation(I),$=[[M.x,M.y,Math.min(z||0,O||0,k||0,q||0)],[D.x,D.y,Math.max(z||0,O||0,k||0,q||0)]];let U=u.ca.fromPoints($);const Q=g.getWorldToCameraMatrix(),Y=u.aE(new Float64Array(16),Q);U=u.ca.applyTransform(U,Q);const ae=this._extendAABB(U,g,x,d);if(!ae)return void u.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");U=ae;const W=.5*u.aW([],U.max,U.min)[2],J=this._minimumAABBFrustumDistance(g,U),se=[0,0,1,0];u.aO(se,se,Q),u.fe(se,se);const ue=u.av([],se,J+W),he=u.cz([],U.center,ue);u.ad(U.center,U.center,Y),u.ad(he,he,Y);const ve=g.unproject(new u.P(U.center[0],U.center[1])),xe=u.ff(g.projection,ve),Le=Math.pow(2,xe),_e=Math.min(g._zoomFromMercatorZ(he[2]*g.pixelsPerMeter*Le/g.worldSize),x.maxZoom);return g.mercatorFromTransition&&_e<.5*(u.bU+u.bB)?(g.setProjection({name:"globe"}),g.zoom=_e,this._cameraForBounds(g,n,l,d,p,m)):{center:ve,zoom:_e,bearing:d,pitch:p}}fitBounds(t,n,l){const d=this.cameraForBounds(t,n);return this._fitInternal(d,n,l)}fitScreenCoordinates(t,n,l,d,p){const m=u.P.convert(t),g=u.P.convert(n),x=new u.P(Math.min(m.x,g.x),Math.min(m.y,g.y)),w=new u.P(Math.max(m.x,g.x),Math.max(m.y,g.y));if(this.transform.projection.name==="mercator"&&this.transform.anyCornerOffEdge(m,g))return this;const E=this.transform.pointLocation3D(x),A=this.transform.pointLocation3D(w),I=this.transform.pointLocation3D(new u.P(x.x,w.y)),M=this.transform.pointLocation3D(new u.P(w.x,x.y)),D=[Math.min(E.lng,A.lng,I.lng,M.lng),Math.min(E.lat,A.lat,I.lat,M.lat)],z=[Math.max(E.lng,A.lng,I.lng,M.lng),Math.max(E.lat,A.lat,I.lat,M.lat)],O=d&&d.pitch?d.pitch:this.getPitch(),k=this._cameraForBounds(this.transform,D,z,l,O,d);return this._fitInternal(k,d,p)}_fitInternal(t,n,l){return t?(n=Object.assign(t,n)).linear?this.easeTo(n,l):this.flyTo(n,l):this}jumpTo(t,n){this.stop();const l=t.preloadOnly?this.transform.clone():this.transform;let d=!1,p=!1,m=!1;"zoom"in t&&l.zoom!==+t.zoom&&(d=!0,l.zoom=+t.zoom),t.center!==void 0&&(l.center=u.b2.convert(t.center)),"bearing"in t&&l.bearing!==+t.bearing&&(p=!0,l.bearing=+t.bearing),"pitch"in t&&l.pitch!==+t.pitch&&(m=!0,l.pitch=+t.pitch);const g=typeof t.padding=="number"?this._extendPadding(t.padding):t.padding;if(t.padding!=null&&!l.isPaddingEqual(g))if(t.retainPadding===!1){const x=l.clone();x.padding=g,l.setLocationAtPoint(l.center,x.centerPoint)}else l.padding=g;return t.preloadOnly?(this._preloadTiles(l),this):(this.fire(new u.B("movestart",n)).fire(new u.B("move",n)),d&&this.fire(new u.B("zoomstart",n)).fire(new u.B("zoom",n)).fire(new u.B("zoomend",n)),p&&this.fire(new u.B("rotatestart",n)).fire(new u.B("rotate",n)).fire(new u.B("rotateend",n)),m&&this.fire(new u.B("pitchstart",n)).fire(new u.B("pitch",n)).fire(new u.B("pitchend",n)),this.fire(new u.B("moveend",n)))}getFreeCameraOptions(){return this.transform.projection.supportsFreeCamera||u.w(Vh),this.transform.getFreeCameraOptions()}setFreeCameraOptions(t,n){const l=this.transform;if(!l.projection.supportsFreeCamera)return u.w(Vh),this;this.stop();const d=l.zoom,p=l.pitch,m=l.bearing;l.setFreeCameraOptions(t);const g=d!==l.zoom,x=p!==l.pitch,w=m!==l.bearing;return this.fire(new u.B("movestart",n)).fire(new u.B("move",n)),g&&this.fire(new u.B("zoomstart",n)).fire(new u.B("zoom",n)).fire(new u.B("zoomend",n)),w&&this.fire(new u.B("rotatestart",n)).fire(new u.B("rotate",n)).fire(new u.B("rotateend",n)),x&&this.fire(new u.B("pitchstart",n)).fire(new u.B("pitch",n)).fire(new u.B("pitchend",n)),this.fire(new u.B("moveend",n)),this}easeTo(t,n){this._stop(!1,t.easeId),((t={offset:[0,0],duration:500,easing:u.f6,...t}).animate===!1||this._prefersReducedMotion(t))&&(t.duration=0);const l=this.transform,d=this.getZoom(),p=this.getBearing(),m=this.getPitch(),g=this.getPadding(),x="zoom"in t?+t.zoom:d,w="bearing"in t?this._normalizeBearing(t.bearing,p):p,E="pitch"in t?+t.pitch:m,A=this._extendPadding(t.padding),I=u.P.convert(t.offset);let M,D,z;if(l.projection.name==="globe"){const se=u.ac.fromLngLat(l.center),ue=I.rotate(-l.angle);se.x+=ue.x/l.worldSize,se.y+=ue.y/l.worldSize;const he=se.toLngLat(),ve=u.b2.convert(t.center||he);this._normalizeCenter(ve),M=l.centerPoint.add(ue),D=new u.P(se.x,se.y).mult(l.worldSize),z=new u.P(u.bE(ve.lng),u.bF(ve.lat)).mult(l.worldSize).sub(D)}else{M=l.centerPoint.add(I);const se=l.pointLocation(M),ue=u.b2.convert(t.center||se);this._normalizeCenter(ue),D=l.project(se),z=l.project(ue).sub(D)}const O=l.zoomScale(x-d);let k,q;t.around&&(k=u.b2.convert(t.around),q=l.locationPoint(k));const $=this._zooming||x!==d,U=this._rotating||p!==w,Q=this._pitching||E!==m,Y=!l.isPaddingEqual(A),ae=t.retainPadding===!1?l.clone():l,W=se=>ue=>{if($&&(se.zoom=u.ai(d,x,ue)),U&&(se.bearing=u.ai(p,w,ue)),Q&&(se.pitch=u.ai(m,E,ue)),Y&&(ae.interpolatePadding(g,A,ue),M=ae.centerPoint.add(I)),k)se.setLocationAtPoint(k,q);else{const he=se.zoomScale(se.zoom-d),ve=x>d?Math.min(2,O):Math.max(.5,O),xe=Math.pow(ve,1-ue),Le=se.unproject(D.add(z.mult(ue*xe)).mult(he));se.setLocationAtPoint(se.renderWorldCopies?Le.wrap():Le,M)}return t.preloadOnly||this._fireMoveEvents(n),se};if(t.preloadOnly){const se=this._emulate(W,t.duration,l);return this._preloadTiles(se),this}const J={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=$,this._rotating=U,this._pitching=Q,this._padding=Y,this._easeId=t.easeId,this._prepareEase(n,t.noMoveStart,J),this._ease(W(l),se=>{l.cameraElevationReference==="sea"&&l.recenterOnTerrain(),this._afterEase(n,se)},t),this}_prepareEase(t,n,l={}){this._moving=!0,this.transform.cameraElevationReference="sea",this.transform._orthographicProjectionAtLowPitch&&this.transform.pitch===0&&this.transform.projection.name!=="globe"&&(this.transform.cameraElevationReference="ground"),n||l.moving||this.fire(new u.B("movestart",t)),this._zooming&&!l.zooming&&this.fire(new u.B("zoomstart",t)),this._rotating&&!l.rotating&&this.fire(new u.B("rotatestart",t)),this._pitching&&!l.pitching&&this.fire(new u.B("pitchstart",t))}_fireMoveEvents(t){this.fire(new u.B("move",t)),this._zooming&&this.fire(new u.B("zoom",t)),this._rotating&&this.fire(new u.B("rotate",t)),this._pitching&&this.fire(new u.B("pitch",t))}_afterEase(t,n){if(this._easeId&&n&&this._easeId===n)return;this._easeId=void 0,this.transform.cameraElevationReference="ground";const l=this._zooming,d=this._rotating,p=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,l&&this.fire(new u.B("zoomend",t)),d&&this.fire(new u.B("rotateend",t)),p&&this.fire(new u.B("pitchend",t)),this.fire(new u.B("moveend",t))}flyTo(t,n){if(this._prefersReducedMotion(t)){const Me=u.b3(t,["center","zoom","bearing","pitch","around","padding","retainPadding"]);return this.jumpTo(Me,n)}this.stop(),t={offset:[0,0],speed:1.2,curve:1.42,easing:u.f6,...t};const l=this.transform,d=this.getZoom(),p=this.getBearing(),m=this.getPitch(),g=this.getPadding(),x="zoom"in t?u.as(+t.zoom,l.minZoom,l.maxZoom):d,w="bearing"in t?this._normalizeBearing(t.bearing,p):p,E="pitch"in t?+t.pitch:m,A=this._extendPadding(t.padding),I=l.zoomScale(x-d),M=u.P.convert(t.offset);let D=l.centerPoint.add(M);const z=l.pointLocation(D),O=u.b2.convert(t.center||z);this._normalizeCenter(O);const k=l.project(z),q=l.project(O).sub(k);let $=t.curve;const U=Math.max(l.width,l.height),Q=U/I,Y=q.mag();if("minZoom"in t){const Me=u.as(Math.min(t.minZoom,d,x),l.minZoom,l.maxZoom),Ae=U/l.zoomScale(Me-d);$=Math.sqrt(Ae/Y*2)}const ae=$*$;function W(Me){const Ae=(Q*Q-U*U+(Me?-1:1)*ae*ae*Y*Y)/(2*(Me?Q:U)*ae*Y);return Math.log(Math.sqrt(Ae*Ae+1)-Ae)}function J(Me){return(Math.exp(Me)-Math.exp(-Me))/2}function se(Me){return(Math.exp(Me)+Math.exp(-Me))/2}const ue=W(0);let he=function(Me){return se(ue)/se(ue+$*Me)},ve=function(Me){return U*((se(ue)*(J(Ae=ue+$*Me)/se(Ae))-J(ue))/ae)/Y;var Ae},xe=(W(1)-ue)/$;if(Math.abs(Y)<1e-6||!isFinite(xe)){if(Math.abs(U-Q)<1e-6)return this.easeTo(t,n);const Me=Q<U?-1:1;xe=Math.abs(Math.log(Q/U))/$,ve=function(){return 0},he=function(Ae){return Math.exp(Me*$*Ae)}}t.duration="duration"in t?+t.duration:1e3*xe/("screenSpeed"in t?+t.screenSpeed/$:+t.speed),t.maxDuration&&t.duration>t.maxDuration&&(t.duration=0);const Le=p!==w,_e=E!==m,Pe=!l.isPaddingEqual(A),me=t.retainPadding===!1?l.clone():l,Re=Me=>Ae=>{const We=Ae*xe,ke=1/he(We);Me.zoom=Ae===1?x:d+Me.scaleZoom(ke),Le&&(Me.bearing=u.ai(p,w,Ae)),_e&&(Me.pitch=u.ai(m,E,Ae)),Pe&&(me.interpolatePadding(g,A,Ae),D=me.centerPoint.add(M));const Ue=Ae===1?O:Me.unproject(k.add(q.mult(ve(We))).mult(ke));return Me.setLocationAtPoint(Me.renderWorldCopies?Ue.wrap():Ue,D),Me._updateCameraOnTerrain(),t.preloadOnly||this._fireMoveEvents(n),Me};if(t.preloadOnly){const Me=this._emulate(Re,t.duration,l);return this._preloadTiles(Me),this}return this._zooming=!0,this._rotating=Le,this._pitching=_e,this._padding=Pe,this._prepareEase(n,!1),this._ease(Re(l),()=>this._afterEase(n),t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_requestRenderFrame(t){}_cancelRenderFrame(t){}_stop(t,n){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),this._easeFrameId=void 0,this._onEaseFrame=void 0),this._onEaseEnd){const l=this._onEaseEnd;this._onEaseEnd=void 0,l.call(this,n)}if(!t){const l=this.handlers;l&&l.stop(!1)}return this}_ease(t,n,l){l.animate===!1||l.duration===0?(t(1),n()):(this._easeStart=u.r.now(),this._easeOptions=l,this._onEaseFrame=t,this._onEaseEnd=n,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const t=Math.min((u.r.now()-this._easeStart)/this._easeOptions.duration,1),n=this._onEaseFrame;n&&n(this._easeOptions.easing(t)),t<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(t,n){t=u.at(t,-180,180);const l=Math.abs(t-n);return Math.abs(t-360-n)<l&&(t-=360),Math.abs(t+360-n)<l&&(t+=360),t}_normalizeCenter(t){const n=this.transform;if(n.maxBounds||n.projection.name!=="globe"&&!n.renderWorldCopies)return;const l=t.lng-n.center.lng;t.lng+=l>180?-360:l<-180?360:0}_prefersReducedMotion(t){return this._respectPrefersReducedMotion&&u.r.prefersReducedMotion&&!(t&&t.essential)}_emulate(t,n,l){const d=Math.ceil(15*n/1e3),p=[],m=t(l.clone());for(let g=0;g<=d;g++){const x=m(g/d);p.push(x.clone())}return p}_preloadTiles(t,n){}}const cy=/^(https?:|mailto:)/i;class m_{constructor(t={}){this.options=t,u.cK(["_toggleAttribution","_updateEditLink","_updateData","_updateCompact"],this)}getDefaultPosition(){return"bottom-right"}onAdd(t){const n=this.options&&this.options.compact,l=t._getUIString("AttributionControl.ToggleAttribution");this._map=t,this._container=ni("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=ni("button","mapboxgl-ctrl-attrib-button",this._container),this._compactButton.type="button",this._compactButton.addEventListener("click",this._toggleAttribution),this._compactButton.setAttribute("aria-label",l);const d=ni("span","mapboxgl-ctrl-icon",this._compactButton);return d.setAttribute("aria-hidden","true"),d.setAttribute("title",l),this._innerContainer=ni("div","mapboxgl-ctrl-attrib-inner",this._container),n&&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),n===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 n=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:this._map._requestManager._customAccessToken||u.g.ACCESS_TOKEN}];if(t){const l=n.reduce((d,p,m)=>(p.value&&(d+=`${p.key}=${p.value}${m<n.length-1?"&":""}`),d),"?");t.href=`${u.g.FEEDBACK_URL}/${l}#${t_(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 n=this._map.style._mergedSourceCaches;for(const d in n){const p=n[d];if(p.used){const m=p.getSource();m.attribution&&!t.includes(m.attribution)&&t.push(m.attribution)}}t.sort((d,p)=>d.length-p.length),t=t.filter((d,p)=>{for(let m=p+1;m<t.length;m++)if(t[m].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 l=t.map(d=>(function(p){const m=new DOMParser().parseFromString(p,"text/html");return Array.from(m.body.querySelectorAll("*")).reverse().forEach(g=>{const x=g.textContent||"";if(g.tagName!=="A")return void g.replaceWith(...g.childNodes);const w=g.getAttribute("href");if(!w||!cy.test(w))return void g.replaceWith(m.createTextNode(x));const E=m.createElement("a");E.href=w,E.textContent=x,E.rel="noopener nofollow";const A=g.getAttribute("class");A&&(E.className=A),g.replaceWith(E)}),m.body.innerHTML})(d)).join(" | ");l!==this._attribHTML&&(this._attribHTML=l,t.length?(this._innerContainer.innerHTML=l,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 __{constructor(){u.cK(["_updateLogo","_updateCompact"],this)}onAdd(t){this._map=t,this._container=ni("div","mapboxgl-ctrl");const n=ni("a","mapboxgl-ctrl-logo");return n.target="_blank",n.rel="noopener nofollow",n.href="https://www.mapbox.com/",n.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),n.setAttribute("rel","noopener nofollow"),this._container.appendChild(n),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 n in t){const l=t[n].getSource();if(Object.hasOwn(l,"mapbox_logo")&&!l.mapbox_logo)return!1}return!0}_updateCompact(){const t=this._container.children;if(t.length){const n=t[0];this._map.getCanvasContainer().offsetWidth<250?n.classList.add("mapboxgl-compact"):n.classList.remove("mapboxgl-compact")}}}class nu{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(t){const n=++this._id;return this._queue.push({callback:t,id:n,cancelled:!1}),n}remove(t){const n=this._currentlyRunning,l=n?this._queue.concat(n):this._queue;for(const d of l)if(d.id===t)return void(d.cancelled=!0)}run(t=0){const n=this._currentlyRunning=this._queue;this._queue=[];for(const l of n)if(!l.cancelled&&(l.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}class uy{constructor(t){this.jumpTo(t)}getValue(t){if(t<=this._startTime)return this._start;if(t>=this._endTime)return this._end;const n=u.et((t-this._startTime)/(this._endTime-this._startTime));return this._start*(1-n)+this._end*n}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,n,l){this._start=this.getValue(n),this._end=t,this._startTime=n,this._endTime=n+l}}const hy={"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 g_ extends u.B{constructor(t,n,l,d){const{point:p,lngLat:m,originalEvent:g,target:x}=t;super(t.type,{point:p,lngLat:m,originalEvent:g,target:x}),this.preventDefault=()=>{t.preventDefault()},this.id=n,this.interaction=l,this.feature=d}}class dy{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,n){if(this.typeById.has(t))throw new Error(`Interaction id "${t}" already exists.`);const l=n.filter;let d=n.type;l&&this.filters.set(t,u.cU(l)),d==="mouseover"&&(d="mouseenter"),d==="mouseout"&&(d="mouseleave");const p=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,n)):p.size===0&&this.map.on(d,this.handleType),p.size===0&&this.interactionsByType.set(d,p),p.set(t,n),this.typeById.set(t,d)}get(t){const n=this.typeById.get(t);if(!n)return;const l=this.interactionsByType.get(n);return l?l.get(t):void 0}remove(t){const n=this.typeById.get(t);if(!n)return;this.typeById.delete(t),this.filters.delete(t);const l=this.interactionsByType.get(n);l&&(l.delete(t),n==="mouseenter"||n==="mouseleave"?(this.delegatedInteractions.delete(t),this.delegatedInteractions.size===0&&(this.map.off("mousemove",this.handleMove),this.map.off("mouseout",this.handleOut))):l.size===0&&this.map.off(n,this.handleType))}queryTargets(t,n){const l=[];for(const[d,p]of n)p.target&&l.push({targetId:d,target:p.target,filter:this.filters.get(d)});return this.map.style.queryRenderedTargets(t,l,this.map.transform)}handleMove(t){this.prevHoveredFeatures=this.hoveredFeatures,this.hoveredFeatures=new Map;const n=this.queryTargets(t.point,Array.from(this.delegatedInteractions).reverse());n.length&&(t.type="mouseenter",this.handleType(t,n));const l=new Map;for(const[d,{feature:p}]of this.prevHoveredFeatures)this.hoveredFeatures.has(d)||l.set(p.id,p);l.size&&(t.type="mouseleave",this.handleType(t,Array.from(l.values())))}handleOut(t){const n=Array.from(this.hoveredFeatures.values()).map(({feature:l})=>l);n.length&&(t.type="mouseleave",this.handleType(t,n)),this.hoveredFeatures.clear()}handleType(t,n){const l=t.type==="mouseenter";if(l&&!this.interactionsByType.has(t.type))return void u.w("mouseenter interaction required for mouseleave to work.");const d=Array.from(this.interactionsByType.get(t.type)).reverse(),p=!!n;n=n||this.queryTargets(t.point,d);let m=!1;const g=new Set;for(const x of n){for(const[w,E]of d){if(!E.target)continue;const A=x.variants?x.variants[w]:null;if(A){for(const I of A){if(Cm(I,x,g,w))continue;const M=new u.eq(x,I),D=sf(I,x,w);p&&M.id!==void 0&&(M.state=this.map.getFeatureState(M));const z=l?this.prevHoveredFeatures.get(D):null,O=new g_(t,w,E,M),k=z?z.stop:E.handler(O);if(l&&this.hoveredFeatures.set(D,{feature:x,stop:k}),k!==!1){m=!0;break}}if(m)break}}if(m)break}if(!m)for(const[x,w]of d){const{handler:E,target:A}=w;if(!A&&E(new g_(t,x,w,null))!==!1)break}}}function fy(s,t){if(Array.isArray(s)&&Array.isArray(t)){const n=new Set(s),l=new Set(t);return n.size===l.size&&s.every(d=>l.has(d))}return u.b5(s,t)}const py=/matrix.*\((.+)\)/,my={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},_y={showCompass:!0,showZoom:!0,visualizePitch:!1};class gy{constructor(t,n,l=!1){this._clickTolerance=10,this.element=n,this.mouseRotate=new Bh({clickTolerance:t.dragRotate._mouseRotate._clickTolerance}),this.map=t,l&&(this.mousePitch=new n_({clickTolerance:t.dragRotate._mousePitch._clickTolerance})),u.cK(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),n.addEventListener("mousedown",this.mousedown),n.addEventListener("touchstart",this.touchstart,{passive:!1}),n.addEventListener("touchmove",this.touchmove),n.addEventListener("touchend",this.touchend),n.addEventListener("touchcancel",this.reset)}down(t,n){this.mouseRotate.mousedown(t,n),this.mousePitch&&this.mousePitch.mousedown(t,n),Gr()}move(t,n){const l=this.map,d=this.mouseRotate.mousemoveWindow(t,n),p=d&&d.bearingDelta;if(p&&l.setBearing(l.getBearing()+p),this.mousePitch){const m=this.mousePitch.mousemoveWindow(t,n),g=m&&m.pitchDelta;g&&l.setPitch(l.getPitch()+g)}}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(){ts(),window.removeEventListener("mousemove",this.mousemove),window.removeEventListener("mouseup",this.mouseup)}mousedown(t){this.down({...t,button:t.button,type:t.type,ctrlKey:!0,preventDefault:()=>t.preventDefault()},eo(this.element,t)),window.addEventListener("mousemove",this.mousemove),window.addEventListener("mouseup",this.mouseup)}mousemove(t){this.move(t,eo(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=fa(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=fa(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 ip(s,t,n){if(s=new u.b2(s.lng,s.lat),t){const l=new u.b2(s.lng-360,s.lat),d=new u.b2(s.lng+360,s.lat),p=360*Math.ceil(Math.abs(s.lng-n.center.lng)/360),m=n.locationPoint3D(s).distSqr(t),g=t.x<0||t.y<0||t.x>n.width||t.y>n.height;n.locationPoint3D(l).distSqr(t)<m&&(g||Math.abs(l.lng-n.center.lng)<p)?s=l:n.locationPoint3D(d).distSqr(t)<m&&(g||Math.abs(d.lng-n.center.lng)<p)&&(s=d)}for(;Math.abs(s.lng-n.center.lng)>180;){const l=n.locationPoint3D(s);if(l.x>=0&&l.y>=0&&l.x<=n.width&&l.y<=n.height)break;s.lng>n.center.lng?s.lng-=360:s.lng+=360}return s}const rp={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%)"},Za=/\s+/,vn={rotation:0,rotationAlignment:"auto",pitchAlignment:"auto",occludedOpacity:.2,altitude:0};class Uh extends u.E{constructor(t,n){super(),(t instanceof HTMLElement||n)&&(t={element:t,...n}),u.cK(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress","_clearFadeTimer"],this);const{anchor:l="center",color:d="#3FB1CE",scale:p=1,draggable:m=!1,clickTolerance:g=0,rotation:x=vn.rotation,rotationAlignment:w=vn.rotationAlignment,pitchAlignment:E=vn.pitchAlignment,occludedOpacity:A=vn.occludedOpacity,altitude:I=vn.altitude}=t||{};this._anchor=l,this._color=d,this._scale=p,this._draggable=m,this._clickTolerance=g,this._rotation=x,this._rotationAlignment=w,this._pitchAlignment=E,this._occludedOpacity=A,this._altitude=I,this._state="inactive",this._isDragging=!1,this._updateMoving=()=>this._update(!0),t&&t.element?(this._element=t.element,this._offset=u.P.convert(t&&t.offset||[0,0])):(this._defaultMarker=!0,this._element=this._createDefaultMarker(),this._offset=u.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",D=>{D.preventDefault()}),this._element.addEventListener("mousedown",D=>{D.preventDefault()});const M=this._element.classList;for(const D in rp)M.remove(`mapboxgl-marker-anchor-${D}`);M.add(`mapboxgl-marker-anchor-${this._anchor}`),t&&t.className&&M.add(...t.className.trim().split(Za)),this._popup=null}_createDefaultMarker(){const t=ni("div"),n=ki("svg",{display:"block",height:41*this._scale+"px",width:27*this._scale+"px",viewBox:"0 0 27 41"},t);this._svgElement=n;const l=ki("radialGradient",{id:"shadowGradient"},ki("defs",{},n));ki("stop",{offset:"10%","stop-opacity":.4},l),ki("stop",{offset:"100%","stop-opacity":.05},l);const d=ki("ellipse",{cx:13.5,cy:34.8,rx:10.5,ry:5.25,fill:"url(#shadowGradient)"});return this._shadowElement=d,this._altitude===0&&n.insertBefore(d,n.firstChild),ki("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"},n),ki("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"},n),ki("circle",{fill:"white",cx:13.5,cy:13.5,r:5.5},n),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=u.b2.convert(t),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(!0),this}setAltitude(t){if(t===this._altitude)return this;const n=this._altitude;return this._altitude=t||vn.altitude,this._defaultMarker&&n===0!=(this._altitude===0)&&(this._altitude===0?this._svgElement.insertBefore(this._shadowElement,this._svgElement.firstChild):this._shadowElement.remove()),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:[0,-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 n=t.code,l=t.charCode||t.keyCode;n!=="Space"&&n!=="Enter"&&l!==32&&l!==13||this.togglePopup()}_onMapClick(t){const n=t.originalEvent.target,l=this._element;this._popup&&(n===l||l.contains(n))&&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,n=this._pos;if(!t||!n)return!1;const l=t.unproject(n,this._altitude),d=t.getFreeCameraOptions();if(!d.position)return!1;const p=d.position.toLngLat();return p.distanceTo(l)<.9*p.distanceTo(this._lngLat)}_evaluateOpacity(){const t=this._map;if(!t)return;const n=this._pos;if(!n||n.x<0||n.x>t.transform.width||n.y<0||n.y>t.transform.height)return void this._clearFadeTimer();const l=t.unproject(n,this._altitude);let d;t._showingGlobe()&&u.fh(t.transform,this._lngLat)?d=0:(d=1-t._queryFogOpacity(l),t.transform._terrainEnabled()&&t.style&&t.style.hasTerrain()&&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 n=this._offset.mult(this._scale);this._element.style.transform=`
3331            translate(${t.x}px,${t.y}px)
3332            ${rp[this._anchor]}
3333            ${this._calculateXYTransform()} ${this._calculateZTransform()}
3334            translate(${n.x}px,${n.y}px)
3335        `}_calculateXYTransform(){const t=this._pos,n=this._map,l=this.getPitchAlignment();if(!n||!t||l!=="map")return"";if(!n._showingGlobe()){const x=n.getPitch();return x?`rotateX(${x}deg)`:""}const d=u.bS(u.fi(n.transform,this._lngLat)),p=t.sub(u.fj(n.transform)),m=Math.abs(p.x)+Math.abs(p.y);if(m===0)return"";const g=d/m;return`rotateX(${-p.y*g}deg) rotateY(${p.x*g}deg)`}_calculateZTransform(){const t=this._pos,n=this._map;if(!n||!t)return"";let l=0;const d=this.getRotationAlignment();if(d==="map")if(n._showingGlobe()){const p=n.project(new u.b2(this._lngLat.lng,this._lngLat.lat+.001),this._altitude),m=n.project(new u.b2(this._lngLat.lng,this._lngLat.lat-.001),this._altitude).sub(p);l=u.bS(Math.atan2(m.y,m.x))-90}else l=-n.getBearing();else if(d==="horizon"){const p=u.af(4,6,n.getZoom()),m=u.fj(n.transform);m.y+=p*n.transform.height;const g=t.sub(m),x=u.bS(Math.atan2(g.y,g.x));l=(x>90?x-270:x+90)*(1-p)}return l+=this._rotation,l?`rotateZ(${l}deg)`:""}_update(t){cancelAnimationFrame(this._updateFrameId);const n=this._map;n&&(n.transform.renderWorldCopies&&(this._lngLat=ip(this._lngLat,this._pos,n.transform)),this._pos=n.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(),n._requestDomTask(()=>{this._map&&(this._element&&this._pos&&this._anchor&&this._updateDOM(),(n._showingGlobe()||n.style&&n.style.hasTerrain()||n.getFog())&&!this._fadeTimer&&(this._fadeTimer=window.setTimeout(this._evaluateOpacity.bind(this),60)))}))}getOffset(){return this._offset}setOffset(t){return this._offset=u.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 n=this._map;if(!n)return;const l=this._pointerdownPos,d=this._positionDelta;if(l&&d){if(!this._isDragging){const p=this._clickTolerance||n._clickTolerance;if(t.point.dist(l)<p)return;this._isDragging=!0}this._pos=t.point.sub(d),this._lngLat=n.unproject(this._pos,this._altitude),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new u.B("dragstart"))),this.fire(new u.B("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 u.B("dragend")),this._state="inactive"}_addDragHandler(t){const n=this._map,l=this._pos;n&&l&&this._element.contains(t.originalEvent.target)&&(t.preventDefault(),this._positionDelta=t.point.sub(l),this._pointerdownPos=t.point,this._state="pending",n.on("mousemove",this._onMove),n.on("touchmove",this._onMove),n.once("mouseup",this._onUp),n.once("touchend",this._onUp))}setDraggable(t){this._draggable=!!t;const n=this._map;return n&&(t?(n.on("mousedown",this._addDragHandler),n.on("touchstart",this._addDragHandler)):(n.off("mousedown",this._addDragHandler),n.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(t){return this._rotation=t||vn.rotation,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(t){return this._rotationAlignment=t||vn.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||vn.pitchAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment==="auto"?this.getRotationAlignment():this._pitchAlignment}setOccludedOpacity(t){return this._occludedOpacity=t||vn.occludedOpacity,this._update(),this}getOccludedOpacity(){return this._occludedOpacity}}const y_={OFF:[],WAITING_ACTIVE:["waiting","active"],ACTIVE_LOCK:["active"],ACTIVE_ERROR:["waiting","active-error"],BACKGROUND:["background"],BACKGROUND_ERROR:["waiting","background-error"]},oa=s=>`mapboxgl-ctrl-geolocate-${s}`,Pr=["waiting","active","active-error","background","background-error"].map(oa),Jl={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0,showUserHeading:!1,showButton:!0,followUserLocation:!0},x_={maxWidth:100,unit:"metric"},np={kilometer:"km",meter:"m",mile:"mi",foot:"ft","nautical-mile":"nm"},fr=/\s+/,yy={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",altitude:0},ou=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function v_(s=new u.P(0,0),t="bottom"){if(typeof s=="number"){const n=Math.round(Math.sqrt(.5*Math.pow(s,2)));switch(t){case"top":return new u.P(0,s);case"top-left":return new u.P(n,n);case"top-right":return new u.P(-n,n);case"bottom":return new u.P(0,-s);case"bottom-left":return new u.P(n,-n);case"bottom-right":return new u.P(-n,-n);case"left":return new u.P(s,0);case"right":return new u.P(-s,0)}return new u.P(0,0)}return s instanceof u.P||Array.isArray(s)?u.P.convert(s):u.P.convert(s[t]||[0,0])}const op=typeof document<"u"?document.currentScript:null;var jh;return jh=op&&op.src&&u.a(op.src)?"cdn":"other",Xi=jh,{version:No,supported:function(s){return!(function(t){return typeof window<"u"&&typeof document<"u"?Object.hasOwn?(function(){const n=document.createElement("canvas");n.width=n.height=1;const l=n.getContext("2d");return!!l&&l.getImageData(0,0,1,1).width===n.width})()?(function(n){return n?(Gi===void 0&&(Gi=il(!0)),Gi):(jr===void 0&&(jr=il(!1)),jr)})(t)?"":"insufficient WebGL2 support":"insufficient Canvas/getImageData support":"Object.hasOwn not supported":"not a browser"})(s)},setRTLTextPlugin:u.fm,getRTLTextPluginStatus:u.fl,setSdkInfo:function(s){typeof s!="str
3335ing"||s.length>64||!bi.test(s)?u.w(`Invalid SDK info "${s}"; expected a "Name/version" string. Ignoring.`):To=s},addTileProvider:u.fk,Map:class extends tp{constructor(s){ti.mark(zs.create);const t=s;if((s={...my,...s}).minZoom!=null&&s.maxZoom!=null&&s.minZoom>s.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(s.minPitch!=null&&s.maxPitch!=null&&s.minPitch>s.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(s.minPitch!=null&&s.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(s.maxPitch!=null&&s.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");super(new Wr(s.minZoom,s.maxZoom,s.minPitch,s.maxPitch,s.renderWorldCopies,null,null),s),this._repaint=!!s.repaint,this._interactive=s.interactive,this._minTileCacheSize=s.minTileCacheSize,this._maxTileCacheSize=s.maxTileCacheSize,this._failIfMajorPerformanceCaveat=s.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=s.preserveDrawingBuffer,this._antialias=s.antialias,this._trackResize=s.trackResize,this._bearingSnap=s.bearingSnap,this._refreshExpiredTiles=s.refreshExpiredTiles,this._fadeDuration=s.fadeDuration,this._placementAlgorithm=s.placementAlgorithm||"default",this._isInitialLoad=!0,this._crossSourceCollisions=s.crossSourceCollisions,this._collectResourceTiming=s.collectResourceTiming,this._language=this._parseLanguage(s.language),this._worldview=s.worldview,this._renderTaskQueue=new nu,this._domRenderTaskQueue=new nu,this._controls=[],this._markers=[],this._popups=[],this._mapId=u.am(),this._locale={...hy,...s.locale},this._clickTolerance=s.clickTolerance,this._cooperativeGestures=s.cooperativeGestures,this._performanceMetricsCollection=s.performanceMetricsCollection,this._tessellationStep=s.tessellationStep,this._containerWidth=0,this._containerHeight=0,this._showParseStatus=!0,this._precompilePrograms=s.precompilePrograms,this._averageElevationLastSampledAt=-1/0,this._averageElevationExaggeration=0,this._averageElevation=new uy(0),this._interactionRange=[1/0,-1/0],this._visibilityHidden=0,this._useExplicitProjection=!1,this._frameId=0,this._scaleFactor=s.scaleFactor,this._requestManager=new Ls(s.transformRequest,s.accessToken,s.testMode);const n=sl(s.accessToken||u.g.ACCESS_TOKEN);if(n&&"atlas"in n&&typeof n.atlas=="number"&&(this._tokenExpiration=n.atlas),this._silenceAuthErrors=!!s.testMode,this._contextCreateOptions=s.contextCreateOptions?{...s.contextCreateOptions}:{},typeof s.container=="string"){const l=document.getElementById(s.container);if(!l)throw new Error(`Container '${s.container.toString()}' not found.`);this._container=l}else{if(!(s.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=s.container}if(this._container.childNodes.length>0&&u.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."),s.maxBounds&&this.setMaxBounds(s.maxBounds),this._spriteFormat="auto",u.cK(["_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 ly(this,s),this._localFontFamily=s.localFontFamily,this._localIdeographFontFamily=s.localIdeographFontFamily,this._fontstackCompositing=s.fontstackCompositing,(s.style||!s.testMode)&&this.setStyle(s.style||u.g.DEFAULT_STYLE,{config:s.config,localFontFamily:this._localFontFamily,localIdeographFontFamily:this._localIdeographFontFamily,fontstackCompositing:this._fontstackCompositing}),s.projection&&this.setProjection(s.projection),s.hash&&(this._hash=new Kg(typeof s.hash=="string"&&s.hash||void 0).addTo(this)),!this._hash||!this._hash._onHashChange()){t.center==null&&t.zoom==null||(this.transform._unmodified=!1),this.jumpTo({center:s.center,zoom:s.zoom,bearing:s.bearing,pitch:s.pitch});const l=s.bounds;l&&(this.resize(),this.fitBounds(l,{...s.fitBoundsOptions,duration:0}))}this.resize(),s.attributionControl&&this.addControl(new m_({customAttribution:s.customAttribution}
vendor: 9,354 bytes, line 3335
3335)),this._logoControl=new __,this.addControl(this._logoControl,s.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet),this._postStyleLoadEvent(),this._postStyleWithAppearanceEvent()}),this.on("data",l=>{this._update(l.dataType==="style"),this.fire(new u.B(`${l.dataType}data`,l))}),this.on("dataloading",l=>{this.fire(new u.B(`${l.dataType}dataloading`,l))}),this._interactions=new dy(this)}_getMapId(){return this._mapId}addControl(s,t){if(t===void 0&&(t=s.getDefaultPosition?s.getDefaultPosition():"top-right"),!s||!s.onAdd)return this.fire(new u.A(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const n=s.onAdd(this);this._controls.push(s);const l=this._controlPositions[t];return t.includes("bottom")?l.insertBefore(n,l.firstChild):l.appendChild(n),this}removeControl(s){if(!s||!s.onRemove)return this.fire(new u.A(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const t=this._controls.indexOf(s);return t>-1&&this._controls.splice(t,1),s.onRemove(this),this}hasControl(s){return this._controls.includes(s)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}resize(s){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 u.B("movestart",s)).fire(new u.B("move",s)),this.fire(new u.B("resize",s)),t&&this.fire(new u.B("moveend",s)),this}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()||null}setMaxBounds(s){return this.transform.setMaxBounds(u.bD.convert(s)),this._update()}setMinZoom(s){if((s=s??-2)>=-2&&s<=this.transform.maxZoom)return this.transform.minZoom=s,this._update(),this.getZoom()<s?this.setZoom(s):this.fire(new u.B("zoomstart")).fire(new u.B("zoom")).fire(new u.B("zoomend")),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(s){if((s=s??22)>=this.transform.minZoom)return this.transform.maxZoom=s,this._update(),this.getZoom()>s?this.setZoom(s):this.fire(new u.B("zoomstart")).fire(new u.B("zoom")).fire(new u.B("zoomend")),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(s){if((s=s??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(s>=0&&s<=this.transform.maxPitch)return this.transform.minPitch=s,this._update(),this.getPitch()<s?this.setPitch(s):this.fire(new u.B("pitchstart")).fire(new u.B("pitch")).fire(new u.B("pitchend")),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(s){if((s=s??85)>85)throw new Error("maxPitch must be less than or equal to 85");if(s>=this.transform.minPitch)return this.transform.maxPitch=s,this._update(),this.getPitch()>s?this.setPitch(s):this.fire(new u.B("pitchstart")).fire(new u.B("pitch")).fire(new u.B("pitchend")),this;throw new Error("maxPitch must be greater than or equal to minPitch")}getMaxPitch(){return this.transform.maxPitch}getScaleFactor(){return this._scaleFactor}setScaleFactor(s){return this._scaleFactor=s,this.painter.scaleFactor=s,this.style&&this.style._setLabelPlacementStale(),this.style._updateFilteredLayers(t=>t.type==="symbol"),this._update(!0),this}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(s){return this.transform.renderWorldCopies=s,this.transform.renderWorldCopies||this._forceMarkerAndPopupUpdate(!0),this._update()}getLanguage(){return this._language}_parseLanguage(s){return s==="auto"?navigator.language:Array.isArray(s)?s.length===0?void 0:s.map(t=>t==="auto"?navigator.language:t):s}setLanguage(s){const t=this._parseLanguage(s);if(!this.style||t===this._language)return this;this._language=t,this.style.reloadSources();for(const n of this._controls)n._setLanguage&&n._setLanguage(this._language);return this}getWorldview(){return this._worldview}setWorldview(s){return this.style&&s!==this._worldview?(this._worldview=s,this._styleDirty=!0,this.style.setWorldview(s),this):this}getProjection(){return this.transform.mercatorFromTransition?{name:"globe",center:[0,0]}:this.transform.getProjection()}_showingGlobe(){return this.transform.projection.name==="globe"}setProjection(s){return this._lazyInitEmptyStyle(),s?typeof s=="string"&&(s={name:s}):s=null,this._useExplicitProjection=!!s,this._prioritizeAndUpdateProjection(s,this.style.projection)}_updateProjectionTransition(){if(this.getProjection().name!=="globe")return;const s=this.transform,t=s.projection.name;let n;t==="globe"&&s.zoom>=u.bB?(s.setMercatorFromTransition(),n=!0):t==="mercator"&&s.zoom<u.bB&&(s.setProjection({name:"globe"}),n=!0),n&&(this.style.applyProjectionUpdate(),this.style._forceSymbolLayerUpdate(),this._update(!0))}_prioritizeAndUpdateProjection(s,t){return this._updateProjection(s||t||{name:"mercator"})}_updateProjection(s){let t;const n=this.transform.mercatorFromTransition;t=s.name==="globe"&&this.transform.zoom>=u.bB?this.transform.setMercatorFromTransition():this.transform.setProjection(s),this.style.applyProjectionUpdate();const l=this.transform.getProjection().name==="mercator"&&n!==this.transform.mercatorFromTransition;return(t||l)&&(this.painter.clearBackgroundTiles(),this.style.clearSources(),this._update(!0),this._forceMarkerAndPopupUpdate(!0)),this}project(s,t){return this.transform.locationPoint3D(u.b2.convert(s),t)}unproject(s,t){return this.transform.pointLocation3D(u.P.convert(s),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(s,t,n){const l=d=>{let p=[];if(Array.isArray(t)){const m=t.filter(g=>this.getLayer(g));p=m.length?this.queryRenderedFeatures(d,{layers:m}):[]}else p=this.queryRenderedFeatures(d,{target:t});return p};if(s==="mouseenter"||s==="mouseover"){let d=!1;return{listener:n,targets:t,delegates:{mousemove:m=>{const g=l(m.point);g.length?d||(d=!0,n.call(this,new Hn(s,this,m.originalEvent,{features:g}))):d=!1},mouseout:()=>{d=!1}}}}if(s==="mouseleave"||s==="mouseout"){let d=!1;return{listener:n,targets:t,delegates:{mousemove:g=>{l(g.point).length?d=!0:d&&(d=!1,n.call(this,new Hn(s,this,g.originalEvent)))},mouseout:g=>{d&&(d=!1,n.call(this,new Hn(s,this,g.originalEvent)))}}}}{const d=p=>{const m=l(p.point);m.length&&(p.features=m,n.call(this,p),delete p.features)};return{listener:n,targets:t,delegates:{[s]:d}}}}on(s,t,n){if(typeof t=="function"||n===void 0)return super.on(s,t);if(typeof t=="string"&&(t=[t]),!this._areTargetsValid(t))return this;const l=this._createDelegatedListener(s,t,n);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[s]=this._delegatedListeners[s]||[],this._delegatedListeners[s].push(l);for(const d in l.delegates)this.on(d,l.delegates[d]);return this}once(s,t,n){if(typeof t=="function"||n===void 0)return super.once(s,t);if(typeof t=="string"&&(t=[t]),!this._areTargetsValid(t))return this;const l=this._createDelegatedListener(s,t,n);for(const d in l.delegates)this.once(d,l.delegates[d]);return this}off(s,t,n){if(typeof t=="function"||n===void 0)return super.off(s,t);if(typeof t=="string"&&(t=[t]),!this._areTargetsValid(t))return this;const l=this._delegatedListeners?this._delegatedListeners[s]:void 0;return l&&(d=>{for(let p=0;p<d.length;p++){const m=d[p];if(m.listener===n&&fy(m.targets,t)){for(const g in m.delegates)this.off(g,m.delegates[g]);return d.splice(p,1),this}}})(l),this}queryRenderedFeatures(s,t){if(!this.style)return[];if(s===void 0||s instanceof u.P||Array.isArray(s)||t!==void 0||(t=s,s=void 0),s=s||[[0,0],[this.transform.width,this.transform.height]],!t){const p=this.style.queryRenderedFeatures(s,void 0,this.transform),m=this.style.queryRenderedFeatureset(s,void 0,this.transform);return p.concat(m)}let n=!0;if(t.target&&(n=this._isTargetValid(t.target),n&&!t.layers))return this.style.queryRenderedFeatureset(s,t,this.transform);let l=!0;if(t.layers&&Array.isArray(t.layers)){for(const p of t.layers)if(!this._isValidId(p)){l=!1;break}if(l&&!t.target)return this.style.queryRenderedFeatures(s,t,this.transform)}let d=[];return l&&(d=d.concat(this.style.queryRenderedFeatures(s,t,this.transform))),n&&(d=d.concat(this.style.queryRenderedFeatureset(s,t,this.transform))),d}querySourceFeatures(s,t){return!s||typeof s=="string"&&!this._isValidId(s)?[]:this.style.querySourceFeatures(s,t)}queryRasterValue(s,t,n){return this._isValidId(s)?this.style.queryRasterValue(s,t,n):Promise.resolve(null)}isPointOnSurface(s){const{name:t}=this.transform.projection;return t!=="globe"&&t!=="mercator"&&u.w(`${t} projection does not support isPointOnSurface, this API may behave unex
3335pectedly.`),this.transform.isPointOnSurface(u.P.convert(s))}addInteraction(s,t){return this._interactions.add(s,t),this}removeInteraction(s){return this._interactions.remove(s),this}getCooperativeGestures(){return this._cooperativeGestures}setCooperativeGestures(s){return this._cooperativeGestures=s,this}setStyle(s,t){return t={localIdeographFontFamily:this._localIdeographFontFamily,localFontFamily:this._localFontFamily,fontstackCompositing:this._fontstackCompositing,...t},this.style&&s&&t.diff!==!1&&t.localFontFamily===this._localFontFamily&&t.localIdeographFontFamily===this._localIdeographFontFamily&&t.fontstackCompositing===this._fontstackCompositing&&!t.config?(this.style._diffStyle(s,(n,l)=>{if(n){const d=typeof n=="string"?n:n instanceof Error?n.message:n.error;u.w(`Unable to perform style diff: ${d}. Rebuilding the style from scratch.`),this._updateStyle(s,t)}else l&&this._update(!0)},()=>this._postStyleLoadEvent()),this):(this._localIdeographFontFamily=t.localIdeographFontFamily,this._localFontFamily=t.localFontFamily,this._fontstackCompositing=t.fontstackCompositing,this._updateStyle(s,t))}_getUIString(s){const t=this._locale[s];if(t==null)throw new Error(`Missing UI string '${s}'`);return t}_updateStyle(s,t){if(this.style&&(this.style.setEventedParent(null),this.style._remove(),this.style=void 0),s){const n={...t};t&&t.config&&(n.initialConfig=t.config,delete n.config),this.style=new ln(this,n).load(s),this.style.setEventedParent(this,{style:this.style})}return this._updateTerrain(),this}_lazyInitEmptyStyle(){this.style||(this.style=new ln(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():(u.w("There is no style added to the map."),!1)}_isValidId(s){return s==null?(this.fire(new u.A(new Error("IDs can't be empty."))),!1):!u.el(s)||(this.fire(new u.A(new Error(`IDs can't contain special symbols: "${s}".`))),!1)}_isTargetValid(s){return"featuresetId"in s?this._isValidId("importId"in s?s.importId:s.featuresetId):"layerId"in s&&this._isValidId(s.layerId)}_areTargetsValid(s){if(Array.isArray(s)){for(const t of s)if(!this._isValidId(t))return!1;return!0}return this._isTargetValid(s)}addSource(s,t){return this._isValidId(s)?(this._lazyInitEmptyStyle(),this.style.addSource(s,t),this._update(!0)):this}isSourceLoaded(s){return!!this._isValidId(s)&&!!this.style&&this.style._isSourceCacheLoaded(s)}areTilesLoaded(){return this.style.areTilesLoaded()}addSourceType(s,t,n){this._lazyInitEmptyStyle(),this.style.addSourceType(s,t,n)}removeSource(s){return this._isValidId(s)?(this.style.removeSource(s),this._updateTerrain(),this._update(!0)):this}getSource(s){return this._isValidId(s)?this.style.getOwnSource(s):null}addImage(s,t,{pixelRatio:n=1,sdf:l=!1,stretchX:d,stretchY:p,content:m}={}){this._lazyInitEmptyStyle();const g=u.I.from(s);if(t instanceof HTMLImageElement||ImageBitmap&&t instanceof ImageBitmap){const{width:x,height:w,data:E}=u.r.getImageData(t);this.style.addImage(g,{data:new u.t({width:x,height:w},E),pixelRatio:n,stretchX:d,stretchY:p,content:m,sdf:l,version:0,usvg:!1})}else if(t.width===void 0||t.height===void 0)this.fire(new u.A(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:x,height:w}=t,E=t;this.style.addImage(g,{data:new u.t({width:x,height:w},new Uint8Array(E.data)),pixelRatio:n,stretchX:d,stretchY:p,content:m,sdf:l,usvg:!1,version:0,userImage:E}),E.onAdd&&E.onAdd(this,s)}}updateImage(s,t){this._lazyInitEmptyStyle();const n=u.I.from(s),l=this.style.getImage(n);if(!l)return void this.fire(new u.A(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?u.r.getImageData(t):t,{width:p,height:m,data:g}=d;if(p===void 0||m===void 0)return void this.fire(new u.A(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(p!==(l.usvg?l.icon.usvg_tree.width:l.data.width)||m!==(l.usvg?l.icon.usvg_tree.height:l.data.height))return void this.fire(new u.A(new Error(`The width and height of the updated image (${p}, ${m})
3336                must be that same as the previous version of the image
3337                (${l.data.width}, ${l.data.height})`)));const x=!(t instanceof HTMLImageElement||ImageBitmap&&t instanceof ImageBitmap);let w=!1;l.usvg?(l.data=new u.t({width:p,height:m},new Uint8Array(g)),l.usvg=!1,l.icon=void 0,w=!0):l.data.replace(g,x),this.style.updateImage(n,l,w)}hasImage(s){return s?!!this.style&&!!this.style.getImage(u.I.from(s)):(this.fire(new u.A(new Error("Missing required image id"))),!1)}removeImage(s){this.style.removeImage(u.I.from(s))}loadImage(s,t){(async()=>{const n=await this._requestManager.transformRequest(s,u.R.Image),{data:l}=await u.q(n);return l})().then(n=>
vendor: 23,259 bytes, line 3337
3337t(null,n)).catch(t)}listImages(){return this.style.listImages().map(s=>s.name)}addModel(s,t){this._lazyInitEmptyStyle(),this.style.addModel(s,t)}hasModel(s){return s?this.style.hasModel(s):(this.fire(new u.A(new Error("Missing required model id"))),!1)}removeModel(s){this.style.removeModel(s)}listModels(){return this.style.listModels()}addLayer(s,t){return this._isValidId(s.id)?(this._lazyInitEmptyStyle(),this.style.addLayer(s,t),this._update(!0)):this}getSlot(s){const t=this.getLayer(s);return t&&t.slot||null}setSlot(s,t){return this.style.setSlot(s,t),this.style.mergeLayers(),this._update(!0)}addImport(s,t){return this.style.addImport(s,t).catch(n=>this.fire(new u.A(new Error("Failed to add import",n)))),this}updateImport(s,t){return typeof t!="string"&&t.id!==s?(this.removeImport(s),this.addImport(t)):(this.style.updateImport(s,t),this._update(!0))}removeImport(s){return this.style.removeImport(s),this}moveImport(s,t){return this.style.moveImport(s,t),this._update(!0)}moveLayer(s,t){return this._isValidId(s)?(this.style.moveLayer(s,t),this._update(!0)):this}removeLayer(s){return this._isValidId(s)?(this.style.removeLayer(s),this._update(!0)):this}getLayer(s){if(!this._isValidId(s))return null;const t=this.style.getOwnLayer(s);return t?t.type==="custom"?t.implementation:t.serialize():void 0}getSlots(){return this.style.getSlots()}setLayerZoomRange(s,t,n){return this._isValidId(s)?(this.style.setLayerZoomRange(s,t,n),this._update(!0)):this}setFilter(s,t,n={}){return this._isValidId(s)?(this.style.setFilter(s,t,n),this._update(!0)):this}getFilter(s){return this._isValidId(s)?this.style.getFilter(s):null}setPaintProperty(s,t,n,l={}){return this._isValidId(s)?(this.style.setPaintProperty(s,t,n,l),this._update(!0)):this}getPaintProperty(s,t){return this._isValidId(s)?this.style.getPaintProperty(s,t):null}setLayoutProperty(s,t,n,l={}){return this._isValidId(s)?(this.style.setLayoutProperty(s,t,n,l),this._update(!0)):this}getLayoutProperty(s,t){return this._isValidId(s)?this.style.getLayoutProperty(s,t):null}getLayerProperty(s,t){return this._isValidId(s)?this.style.getLayerProperty(s,t):null}setLayerProperty(s,t,n,l={}){return this._isValidId(s)?(t==="appearances"&&this._postAddingAppearancesToStyleEvent(),this.style.setLayerProperty(s,t,n,l),this._update(!0)):this}getGlyphsUrl(){return this.style.getGlyphsUrl()}setGlyphsUrl(s){return this.style.setGlyphsUrl(s),this._update(!0)}getSchema(s){return this.style.getSchema(s)}setSchema(s,t){return this.style.setSchema(s,t),this._update(!0)}getConfig(s){return this.style.getConfig(s)}setConfig(s,t){return this.style.setConfig(s,t),this._update(!0)}getConfigProperty(s,t){return this.style.getConfigProperty(s,t)}setConfigProperty(s,t,n){return this.style.setConfigProperty(s,t,n),this._update(!0)}getFeaturesetDescriptors(s){return this.style.getFeaturesetDescriptors(s)}setLights(s){if(this._lazyInitEmptyStyle(),s&&s.length===1&&s[0].type==="flat"){const t=s[0];t.properties?this.style.setFlatLight(t.properties,t.id,{}):this.style.setFlatLight({},"flat")}else this.style.setLights(s),this.painter.terrain&&(this.painter.terrain.invalidateRenderCache=!0);return this._update(!0)}getLights(){const s=this.style.getLights()||[];return s.length===0&&s.push({id:this.style.light.id,type:"flat",properties:this.style.getFlatLight()}),s}setLight(s,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:s}])}getLight(){return console.log("The `map.getLight` function is deprecated, prefer using `map.getLights` instead."),this.style.getFlatLight()}setTerrain(s){return this._lazyInitEmptyStyle(),!s&&this.transform.projection.requiresDraping?this.style.setTerrainForDraping():this.style.setTerrain(s),this._averageElevationLastSampledAt=-1/0,this._update(!0)}getTerrain(){return this.style?this.style.getTerrain():null}setFog(s){return this._lazyInitEmptyStyle(),this.style.setFog(s),this._update(!0)}getFog(){return this.style?this.style.getFog():null}setSnow(s){return this._lazyInitEmptyStyle(),this.style.setSnow(s),this._update(!0)}getSnow(){return this.style?this.style.getSnow():null}setRain(s){return this._lazyInitEmptyStyle(),this.style.setRain(s),this._update(!0)}getRain(){return this.style?this.style.getRain():null}setColorTheme(s){return this._lazyInitEmptyStyle(),this.style.setColorTheme(s),this._update(!0)}setImportColorTheme(s,t){return this._lazyInitEmptyStyle(),this.style.setImportColorTheme(s,t),this._update(!0)}setCamera(s){return this.style.setCamera(s),this._triggerCameraUpdate(s)}getNearClipOffset(){return this.transform.nearClipOffset}setNearClipOffset(s){const t=this.transform.nearClipOffset!==s;return this.transform.nearClipOffset=s,this._update(t)}_triggerCameraUpdate(s){return this._update(this.transform.setOrthographicProjectionAtLowPitch(s["camera-projection"]==="orthographic"))}getCamera(){return this.style.camera}_queryFogOpacity(s){return this.style&&this.style.fog?this.style.fog.getOpacityAtLatLng(u.b2.convert(s),this.transform):0}setFeatureState(s,t){return s.source&&!this._isValidId(s.source)?this:(this.style.setFeatureState(s,t),this._update())}removeFeatureState(s,t){return s.source&&!this._isValidId(s.source)?this:(this.style.removeFeatureState(s,t),this._update())}getFeatureState(s){return s.source&&!this._isValidId(s.source)?null:this.style.getFeatureState(s)}_selectIndoorFloor(s){this.style.indoorManager&&this.style.indoorManager.selectFloor(s)}_setIndoorActiveFloorsVisibility(s){this.style.indoorManager&&this.style.indoorManager.setActiveFloorsVisibility(s)}getIndoorTileOptions(s,t){return this.style&&this.style.isIndoorEnabled()&&this.style.indoorManager?this.style.indoorManager.getIndoorTileOptions(s,t):null}_updateContainerDimensions(){if(!this._container)return;const s=this._container.getBoundingClientRect().width||400,t=this._container.getBoundingClientRect().height||300;let n,l,d,p=this._container;for(;p&&(!l||!d);){const m=window.getComputedStyle(p).transform;m&&m!=="none"&&(n=m.match(py)[1].split(", "),n[0]&&n[0]!=="0"&&n[0]!=="1"&&(l=n[0]),n[3]&&n[3]!=="0"&&n[3]!=="1"&&(d=n[3])),p=p.parentElement}this._containerWidth=l?Math.abs(s/l):s,this._containerHeight=d?Math.abs(t/d):t}_detectMissingCSS(){window.getComputedStyle(this._missingCSSCanary).getPropertyValue("background-color")!=="rgb(250, 128, 114)"&&u.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 s=this._container;s.classList.add("mapboxgl-map"),(this._missingCSSCanary=ni("div","mapboxgl-canary",s)).style.visibility="hidden",this._detectMissingCSS();const t=this._canvasContainer=ni("div","mapboxgl-canvas-container",s);this._canvas=ni("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 n=this._controlContainer=ni("div","mapboxgl-control-container",s),l=this._controlPositions={};["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"].forEach(d=>{l[d]=ni("div",`mapboxgl-ctrl-${d}`,n)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(s,t){const n=u.r.devicePixelRatio||1;this._canvas.width=n*Math.ceil(s),this._canvas.height=n*Math.ceil(t),this._canvas.style.width=`${s}px`,this._canvas.style.height=`${t}px`}_addMarker(s){this._markers.push(s)}_removeMarker(s){const t=this._markers.indexOf(s);t!==-1&&this._markers.splice(t,1)}_addPopup(s){this._popups.push(s)}_removePopup(s){const t=this._popups.indexOf(s);t!==-1&&this._popups.splice(t,1)}_setupPainter(){const s={...N,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1},t=this._canvas.getContext("webgl2",s);t?(qr(t,!0),this.painter=new qa(t,this._contextCreateOptions,this.transform,this._scaleFactor,this._worldview),this.on("data",n=>{if(n.dataType==="source"){const l=this.transform.elevation?this.transform.elevation._source():null;l&&n.sourceCacheId===l.id&&this.style&&this.style._setLabelPlacementStale(),this.painter.setTileLoadedFlag(!0)}}),u.k.testSupport(t)):this.fire(new u.A(new Error("Failed to initialize WebGL")))}_contextLost(s){s.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.style&&this.style.handleContextLost(),this.fire(new u.B("webglcontextlost",{originalEvent:s}))}_contextRestored(s){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 u.B("webglcontextrestored",{originalEvent:s}))}_onMapScroll(s){if(s.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(s){return this.style?(this._styleDirty=this._styleDirty||s,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(s){return this._update(),this._renderTaskQueue.add(s)}_cancelRenderFrame(s){this._renderTaskQueue.remove(s)}_requestDomTask(s){!this.loaded()||this.loaded()&&!this.isMoving()?s():this._domRenderTaskQueue.add(s)}_render(s){let t;this.fire(new u.B("renderstart")),++this._frameId;const n=this.painter.context.extTimerQuery,l=u.r.now(),d=this.painter.context.gl;if(this.listens("gpu-timing-frame")&&(t=d.createQuery(),d.beginQuery(n.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(s),this._domRenderTaskQueue.run(s),this._removed)return;this._updateProjectionTransition();const p=this._isInitialLoad?0:this._fadeDuration;if(this.style&&this._styleDirty){this._styleDirty=!1;const x=this.transform.zoom,w=this.transform.pitch,E=u.r.now(),A=new u.aa(x,{now:E,fadeDuration:p,pitch:w,transition:this.style.transition,worldview:this._worldview});this.style.update(A)}this.style&&this.style.hasFogTransition()&&(this.style._markersNeedUpdate=!0,this._sourcesDirty=!0);let m=!1;if(this.style&&this._sourcesDirty?(this._sourcesDirty=!1,this.painter._updateFog(this.style),this._updateTerrain(),m=this._updateAverageElevation(l),this.style.updateSources(this.transform),this.style.updateImageProviders(),this.isMoving()||this._forceMarkerAndPopupUpdate()):m=this._updateAverageElevation(l),this.style&&(this._placementDirty=this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,p,this._crossSourceCollisions,this.painter.replacementSource,this._placementAlgorithm)),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:p,isInitialLoad:this._isInitialLoad,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer"),gpuTimingDeferredRender:!!this.listens("gpu-timing-deferred-render"),speedIndexTiming:this.speedIndexTiming,paintStartTimeStamp:s}),this.fire(new u.B("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,ti.mark(zs.load),this.fire(new u.B("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 x=u.r.now()-l;d.endQuery(n.TIME_ELAPSED_EXT),setTimeout(()=>{const w=d.getQueryParameter(t,d.QUERY_RESULT)/1e6;d.deleteQuery(t),this.fire(new u.B("gpu-timing-frame",{cpuTime:x,gpuTime:w}))},50)}if(this.listens("gpu-timing-layer")){const x=this.painter.collectGpuTimers();setTimeout(()=>{const w=this.painter.queryGpuTimers(x);this.fire(new u.B("gpu-timing-layer",{layerTimes:w}))},50)}if(this.listens("gpu-timing-deferred-render")){const x=this.painter.collectDeferredRenderGpuQueries();setTimeout(()=>{const w=this.painter.queryGpuTimeDeferredRender(x);this.fire(new u.B("gpu-timing-deferred-render",{gpuTime:w}))},50)}const g=this._sourcesDirty||this._styleDirty||this._placementDirty||m;if(g||this._repaint)this.triggerRepaint();else{const x=this.idle();if(x&&(m=this._updateAverageElevation(l,!0)),m)this.triggerRepaint();else{if(this._triggerFrame(!1),x&&(this.fire(new u.B("idle")),this._isInitialLoad=!1,this.speedIndexTiming)){const w=this._calculateSpeedIndex();this.fire(new u.B("speedindexcompleted",{speedIndex:w})),this.speedIndexTiming=!1}x&&this.style&&this.style.handleIdle()}}!this._loaded||this._fullyLoaded||g||(this._fullyLoaded=!0,ti.mark(zs.fullLoad),this._performanceMetricsCollection&&ks(this._requestManager._customAccessToken,{width:this.painter.width,height:this.painter.height,interactionRange:this._interactionRange,visibilityHidden:this._visibilityHidden,terrainEnabled:this.painter.style.hasTerrain(),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(s){for(const t of this._markers)s&&!this.getRenderWorldCopies()&&(t._lngLat=t._lngLat.wrap()),t._update();for(const t of this._popups)!s||this.getRenderWorldCopies()||t._trackPointer||(t._lngLat=t._lngLat.wrap()),t._update()}_updateAverageElevation(s,t=!1){const n=d=>(this.transform.averageElevation=d,this._update(!1),!0);if(!this.painter.averageElevationNeedsEasing())return this.transform.averageElevation!==0&&n(0);const l=this.transform.elevation&&this.transform.elevation.exaggeration()!==this._averageElevationExaggeration;if(l||(t||s-this._averageElevationLastSampledAt>500)&&!this._averageElevation.isEasing(s)){const d=this.transform.averageElevation;let p=this.transform.sampleAverageElevation();this.transform.elevation!=null&&(this._averageElevationExaggeration=this.transform.elevation.exaggeration()),isNaN(p)?p=0:this._averageElevationLastSampledAt=s;const m=Math.abs(d-p);if(m>1){if(this._isInitialLoad||l)return this._averageElevation.jumpTo(p),n(p);this._averageElevation.easeTo(p,s,300)}else if(m>1e-4)return this._averageElevation.jumpTo(p),n(p)}return!!this._averageElevation.isEasing(s)&&n(this._averageElevation.getValue(s))}_isTokenExpired(){return this._tokenExpiration!=null&&Date.now()>this._tokenExpiration}_revokeAuth(){const s=this.painter.context.gl;qr(s,!1),this._logoControl instanceof __&&this._logoControl._updateLogo(),s&&s.clear(s.DEPTH_BUFFER_BIT|s.COLOR_BUFFER_BIT|s.STENCIL_BUFFER_BIT),this._silenceAuthErrors||this.fire(new u.A(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(){lc(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,s=>{s&&(s.message!==ol&&s.status!==401||this._revokeAuth())}),this._isTokenExpired()&&this._revokeAuth(),is(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,()=>{})}_postStyleLoadEvent(){this.style.globalId&&ll(this._requestManager._customAccessToken,{map:this,style:this.style.globalId,importedStyles:this.style.getImportGlobalIds()})}_postStyleWithAppearanceEvent(){this.style.globalId&&this.style.hasAppearances()&&xu(this._requestManager._customAccessToken)}_postAddingAppearancesToStyleEvent(){vu(this._requestManager._customAccessToken)}_updateTerrain(){const s=this._isDragging();this.painter.updateTerrain(this.style,s)}_calculateSpeedIndex(){const s=this.painter.canvasCopy(),t=this.painter.getCanvasCopiesAndTimestamps();t.timeStamps.push(performance.now());const n=this.painter.context.gl,l=n.createFramebuffer();function d(p){n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,p,0);const m=new Uint8Array(n.drawingBufferWidth*n.drawingBufferHeight*4);return n.readPixels(0,0,n.drawingBufferWidth,n.drawingBufferHeight,n.RGBA,n.UNSIGNED_BYTE,m),m}return n.bindFramebuffer(n.FRAMEBUFFER,l),this._canvasPixelComparison(d(s),t.canvasCopies.map(d),t.timeStamps)}_canvasPixelComparison(s,t,n){let l=n[1]-n[0];const d=s.length/4;for(let p=0;p<t.length;p++){const m=t[p];let g=0;for(let x=0;x<m.length;x+=4)m[x]===s[x]&&m[x+1]===s[x+1]&&m[x+2]===s[x+2]&&m[x+3]===s[x+3]&&(g+=1);l+=(n[p+2]-n[p+1])*(1-g/d)}return l}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 s=this.painter.context.gl.getExtension("WEBGL_lose_context");s&&s.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),Ns.delete(this.painter.context.gl),ga.remove(),al.remove(),this._removed=!0,this.fire(new u.B("remove"))}triggerRepaint(){this._triggerFrame(!0)}_triggerFrame(s){this._renderNextFrame=this._renderNextFrame||s,this.style&&!this._frame&&(this._frame=u.r.frame(t=>{const n=!!this._renderNextFrame;this._frame=null,this._renderNextFrame=null,n&&this._render(t)}))}_preloadTiles(s){const t=this.style?this.style.getSourceCaches():[];return u.dA(t,(n,l)=>n._preloadTiles(s,l),()=>{this.triggerRepaint()}),this}_onWindowOnline(){this._update()}_onWindowResize(s){this._trackResize&&this.resize({originalEvent:s})._update()}_onVisibilityChange(){document.visibilityState==="hidden"&&this._visibilityHidden++}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(s){this._showTileBoundaries!==s&&(this._showTileBoundaries=s,this._update())}get showParseStatus(){return!!this._showParseStatus}set showParseStatus(s){this._showParseStatus!==s&&(this._showParseStatus=s,this._update())}get showTerrainWireframe(){return!!this._showTerrainWireframe}set showTerrainWireframe(s){this._showTerrainWireframe!==s&&(this._showTerrainWireframe=s,this._update())}get showLayers2DWireframe(){return!!this._showLayers2DWireframe}set showLayers2DWireframe(s){this._showLayers2DWireframe!==s&&(this._showLayers2DWireframe=s,this._update())}get showLayers3DWireframe(){return!!this._showLayers3DWireframe}set showLayers3DWireframe(s){this._showLayers3DWireframe!==s&&(this._showLayers3DWireframe=s,this._update())}get showElevationIdDebug(){return!!this.painter&&this.painter._debugParams.showElevationIdDebug}set showElevationIdDebug(s){this.painter&&this.painter._debugParams.showElevationIdDebug!==s&&(this.painter._debugParams.showElevationIdDebug=s,this.style&&s?this.style._reloadSources():this._update())}get speedIndexTiming(){return!!this._speedIndexTiming}set speedIndexTiming(s){this._speedIndexTiming!==s&&(this._speedIndexTiming=s,this._update())}get showPadding(){return!!this._showPadding}set showPadding(s){this._showPadding!==s&&(this._showPadding=s,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(s){this._showCollisionBoxes!==s&&(this._showCollisionBoxes=s,this.style&&s?this.style._reloadSources():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(s){this._showOverdrawInspector!==s&&(this._showOverdrawInspector=s,this._update())}get repaint(){return!!this._repaint}set repaint(s){this._repaint!==s&&(this._repaint=s,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(s){this._vertices=s,this._update()}get showTileAABBs(){return!!this._showTileAABBs}set showTileAABBs(s){this._showTileAABBs!==s&&(this._showTileAABBs=s,s&&this._update())}_setCacheLimits(s,t){u.fg(s,t)}get version(){return No}},NavigationControl:class{constructor(s={}){this.options={..._y,...s},this._container=ni("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",t=>t.preventDefault()),this.options.showZoom&&(u.cK(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("mapboxgl-ctrl-zoom-in",t=>{this._map&&this._map.zoomIn({},{originalEvent:t})}),ni("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})}),ni("span","mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(u.cK(["_rotateCompassArrow"],this),this._compass=this._createButton("mapboxgl-ctrl-compass",t=>{const n=this._map;n&&(this.options.visualizePitch?n.resetNorthPitch({},{originalEvent:t}):n.resetNorth({},{originalEvent:t}))}),this._compassIcon=ni("span","mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){const s=this._map;if(!s)return;const t=s.getZoom(),n=t===s.getMaxZoom(),l=t===s.getMinZoom();this._zoomInButton.disabled=n,this._zoomOutButton.disabled=l,this._zoomInButton.setAttribute("aria-disabled",n.toString()),this._zoomOutButton.setAttribute("aria-disabled",l.toString())}_rotateCompassArrow(){const s=this._map;if(!s)return;const t=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(s.transform.pitch*(Math.PI/180)
3337),.5)}) rotateX(${s.transform.pitch}deg) rotateZ(${s.transform.angle*(180/Math.PI)}deg)`:`rotate(${s.transform.angle*(180/Math.PI)}deg)`;s._requestDomTask(()=>{this._compassIcon&&(this._compassIcon.style.transform=t)})}onAdd(s){return this._map=s,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),s.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&s.on("pitch",this._rotateCompassArrow),s.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new gy(s,this._compass,this.options.visualizePitch)),this._container}onRemove(){const s=this._map;s&&(this._container.remove(),this.options.showZoom&&s.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&s.off("pitch",this._rotateCompassArrow),s.off("rotate",this._rotateCompassArrow),this._handler&&this._handler.off(),this._handler=void 0),this._map=void 0)}_createButton(s,t){const n=ni("button",s,this._container);return n.type="button",n.addEventListener("click",t),n}_setButtonTitle(s,t){if(!this._map)return;const n=this._map._getUIString(`NavigationControl.${t}`);s.setAttribute("aria-label",n),s.firstElementChild&&s.firstElementChild.setAttribute("title",n)}},GeolocateControl:class extends u.E{constructor(s={}){super();const t=navigator.geolocation;this.options={geolocation:t,...Jl,...s},u.cK(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker","_updateMarkerRotation","_onDeviceOrientation"],this),this._updateMarkerRotationThrottled=_o(this._updateMarkerRotation,20),this._numberOfWatches=0}onAdd(s){return this._map=s,this._container=ni("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(s){const t=(n=!!this.options.geolocation)=>{this._supportsGeolocation=n,s(n)};this._supportsGeolocation!==void 0?s(this._supportsGeolocation):navigator.permissions!==void 0?navigator.permissions.query({name:"geolocation"}).then(n=>t(n.state!=="denied")).catch(()=>t()):t()}_isOutOfMapMaxBounds(s){const t=this._map.getMaxBounds(),n=s.coords;return!!t&&(n.longitude<t.getWest()||n.longitude>t.getEast()||n.latitude<t.getSouth()||n.latitude>t.getNorth())}_setWatchState(s){this._watchState=s;const t=this._geolocateButton.classList;t.remove(...Pr);for(const n of y_[s])t.add(oa(n))}_setButtonTitle(s){const t=this._map._getUIString(s);this._geolocateButton.setAttribute("aria-label",t),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",t)}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":this._setWatchState("ACTIVE_ERROR");break;case"BACKGROUND":this._setWatchState("BACKGROUND_ERROR")}}_onSuccess(s){if(this._map){if(this._clearRequestTimeout(),this._isOutOfMapMaxBounds(s))return this._setErrorState(),this.fire(new u.B("outofmaxbounds",s)),this._updateMarker(),void this._finish();if(this._lastKnownPosition=s,this.options.trackUserLocation)switch(this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._setWatchState(this.options.followUserLocation?"ACTIVE_LOCK":"BACKGROUND");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._setWatchState("BACKGROUND")}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(s),this.options.followUserLocation&&(!this.options.trackUserLocation||this._watchState==="ACTIVE_LOCK")&&this._updateCamera(s),this.options.showUserLocation&&this._userLocationDotMarker.removeClassName("mapboxgl-user-location-dot-stale"),this.fire(new u.B("geolocate",{coords:s.coords,timestamp:s.timestamp,...s.toJSON?{toJSON:s.toJSON.bind(s)}:{}})),this._finish()}}_updateCamera(s){const t=new u.b2(s.coords.longitude,s.coords.latitude),n=s.coords.accuracy,l={bearing:this._map.getBearing(),...this.options.fitBoundsOptions};this._map.fitBounds(t.toBounds(n),l,{geolocateSource:!0})}_updateMarker(s){if(s){const t=new u.b2(s.coords.longitude,s.coords.latitude);this.options.showAccuracyCircle?this._accuracyCircleMarker.setLngLat(t).addTo(this._map):this._accuracyCircleMarker.remove(),this._userLocationDotMarker.setLngLat(t).addTo(this._map),this._accuracy=s.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){const s=this._map.transform,t=u.aL(1,s._center.lat)*s.worldSize,n=Math.ceil(2*this._accuracy*t);this._circleElement.style.width=`${n}px`,this._circleElement.style.height=`${n}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(s){if(this._map){if(this._clearRequestTimeout(),this.options.trackUserLocation)if(s.code===1)this._setWatchState("OFF"),this._geolocateButton.disabled=!0,this._setButtonTitle("GeolocateControl.LocationNotAvailable"),this._geolocationWatchID!==void 0&&this._clearWatch();else{if(s.code===3&&this._noTimeout)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._userLocationDotMarker.addClassName("mapboxgl-user-location-dot-stale"),this.fire(new u.B("error",{code:s.code,message:s.message,PERMISSION_DENIED:s.PERMISSION_DENIED,POSITION_UNAVAILABLE:s.POSITION_UNAVAILABLE,TIMEOUT:s.TIMEOUT})),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_startRequestTimeout(){this._clearRequestTimeout();const s=this.options.positionOptions.timeout;s&&(this._requestTimeoutId=window.setTimeout(()=>{this._onError({code:3,message:"Geolocation request timed out"})},s))}_clearRequestTimeout(){this._requestTimeoutId!==void 0&&(clearTimeout(this._requestTimeoutId),this._requestTimeoutId=void 0)}_setupUI(s){this._map!==void 0&&(this._container.addEventListener("contextmenu",t=>t.preventDefault()),this._geolocateButton=ni("button","mapboxgl-ctrl-geolocate",this._container),ni("span","mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",s===!1?(u.w("Geolocation support is not available so the GeolocateControl will be disabled."),this._geolocateButton.disabled=!0,this._setButtonTitle("GeolocateControl.LocationNotAvailable")):this._setButtonTitle("GeolocateControl.FindMyLocation"),this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","fal
3337se"),this._watchState="OFF"),this.options.showUserLocation&&(this._createUserLocationMarkers(),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._setWatchState("BACKGROUND"),this.fire(new u.B("trackuserlocationend")))}),this.fire(new u.B("ready")))}_onDeviceOrientation(s){this._userLocationDotMarker&&(s.webkitCompassHeading?this._heading=s.webkitCompassHeading:s.absolute===!0&&(this._heading=-1*s.alpha),this._updateMarkerRotationThrottled())}trigger(){if(!this._setup)return u.w("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._setWatchState("WAITING_ACTIVE"),this.fire(new u.B("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":this._numberOfWatches--,this._noTimeout=!1,this._setWatchState("OFF"),this.fire(new u.B("trackuserlocationend"));break;case"BACKGROUND":this._setWatchState("ACTIVE_LOCK"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new u.B("trackuserlocationstart"))}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let s;this._geolocateButton.classList.add(oa("waiting")),this._geolocateButton.setAttribute("aria-pressed","true"),this._numberOfWatches++,this._numberOfWatches>1?(s={maximumAge:6e5,timeout:0},this._noTimeout=!0):(s=this.options.positionOptions,this._noTimeout=!1),this._geolocationWatchID=this.options.geolocation.watchPosition(this._onSuccess,this._onError,s),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(s){return this.options.followUserLocation=s??Jl.followUserLocation,this.options.trackUserLocation&&this._watchState!=="OFF"&&(this.options.followUserLocation?this._watchState!=="BACKGROUND"&&this._watchState!=="BACKGROUND_ERROR"||(this._setWatchState("ACTIVE_LOCK"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new u.B("trackuserlocationstart"))):this._watchState!=="ACTIVE_LOCK"&&this._watchState!=="ACTIVE_ERROR"||(this._setWatchState("BACKGROUND"),this.fire(new u.B("trackuserlocationend")))),this}setShowAccuracyCircle(s){if(this.options.showAccuracyCircle=s??Jl.showAccuracyCircle,!this._accuracyCircleMarker)return this;if(this.options.showAccuracyCircle){if(this.options.showUserLocation&&this._lastKnownPosition){const{longitude:t,latitude:n,accuracy:l}=this._lastKnownPosition.coords;this._accuracy=l,this._accuracyCircleMarker.setLngLat(new u.b2(t,n)).addTo(this._map),this._updateCircleRadius()}}else this._accuracyCircleMarker.remove();return this}setShowUserHeading(s){return this.options.showUserHeading=s??Jl.showUserHeading,this._setup?(this.options.showUserHeading?this._geolocationWatchID!==void 0&&this._addDeviceOrientationListener():(this._removeDeviceOrientationListener(),this._heading=void 0,this._userLocationDotMarker&&this._updateMarkerRotation()),this):this}setFitBoundsOptions(s){return this.options.fitBoundsOptions=s??Jl.fitBoundsOptions,this}setShowUserLocation(s){return this.options.showUserLocation=s??Jl.showUserLocation,this._setup?(this.options.showUserLocation?(this._userLocationDotMarker||(this._createUserLocationMarkers(),this._map.on("zoom",this._onZoom)),!this._lastKnownPosition||this._watchState!==void 0&&this._watchState==="OFF"||this._updateMarker(this._lastKnownPosition)):(this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this._accuracyCircleMarker&&this._accuracyCircleMarker.remove()),this):this}_addDeviceOrientationListener(){const s=()=>{const t="ondeviceorientationabsolute"in window?"deviceorientationabsolute":"deviceorientation";window.addEventListener(t,this._onDeviceOrientation)};typeof DeviceOrientationEvent.requestPermission=="function"?DeviceOrientationEvent.requestPermission().then(t=>{t==="granted"&&s()}).catch(console.error):s()}_removeDeviceOrientationListener(){window.removeEventListener("deviceorientation",this._onDeviceOrientation),window.removeEventListener("deviceorientationabsolute",this._onDeviceOrientation)}_createUserLocationMarkers(){this._dotElement=ni("div","mapboxgl-user-location"),this._dotElement.appendChild(ni("div","mapboxgl-user-location-dot")),this._dotElement.appendChild(ni("div","mapboxgl-user-location-heading")),this._userLocationDotMarker=new Uh({element:this._dotElement,rotationAlignment:"map",pitchAlignment:"map"}),this._circleElement=ni("div","mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Uh({element:this._circleElement,pitchAlignment:"map"})}_clearWatch(){this._clearRequestTimeout(),this.options.geolocation.clearWatch(this._geolocationWatchID),this._removeDeviceOrientationListener(),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove(oa("waiting")),this._geolocateButton.setAttribute("aria-pressed","fal
3337se"),this.options.showUserLocation&&this._updateMarker(null)}},AttributionControl:m_,ScaleControl:class{constructor(s={}){this.options={...x_,...s},u.cK(["_update","_setScale","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_update(){const s=this.options.maxWidth||100,t=this._map,n=t._containerHeight/2,l=t._containerWidth/2-s/2,d=t.unproject([l,n]),p=t.unproject([l+s,n]),m=d.distanceTo(p);if(this.options.unit==="imperial"){const g=3.2808*m;g>5280?this._setScale(s,g/5280,"mile"):this._setScale(s,g,"foot")}else this.options.unit==="nautical"?this._setScale(s,m/1852,"nautical-mile"):m>=1e3?this._setScale(s,m/1e3,"kilometer"):this._setScale(s,m,"meter")}_setScale(s,t,n){this._map._requestDomTask(()=>{const l=(function(p){const m=Math.pow(10,`${Math.floor(p)}`.length-1);let g=p/m;return g=g>=10?10:g>=5?5:g>=3?3:g>=2?2:g>=1?1:(function(x){const w=Math.pow(10,Math.ceil(-Math.log(x)/Math.LN10));return Math.round(x*w)/w})(g),m*g})(t),d=l/t;this._container.innerHTML=n!=="nautical-mile"?new Intl.NumberFormat(this._language,{style:"unit",unitDisplay:"short",unit:n}).format(l):`${l}&nbsp;${np[n]}`,this._container.style.width=s*d+"px"})}onAdd(s){return this._map=s,this._language=s.getLanguage(),this._container=ni("div","mapboxgl-ctrl mapboxgl-ctrl-scale",s.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(s){this._language=s,this._update()}setUnit(s){this.options.unit=s,this._update()}},FullscreenControl:class{constructor(s={}){this._fullscreen=!1,s&&s.container&&(s.container instanceof HTMLElement?this._container=s.container:u.w("Full screen control 'container' must be a DOM element.")),u.cK(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onwebkitfullscreenchange"in document&&(this._fullscreenchange="webkitfullscreenchange")}onAdd(s){return this._map=s,this._container||(this._container=this._map.getContainer()),this._controlContainer=ni("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",u.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 s=this._fullscreenButton=ni("button","mapboxgl-ctrl-fullscreen",this._controlContainer);ni("span","mapboxgl-ctrl-icon",s).setAttribute("aria-hidden","true"),s.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){const s=this._getTitle();this._fullscreenButton.setAttribute("aria-label",s),this._fullscreenButton.firstElementChild&&this._fullscreenButton.firstElementChild.setAttribute("title",s)}_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(){u.cK(["_onIndoorUpdate","_onStyleData","_scrollUp","_scrollDown","_toggleIndoor"],this),this._visibleFloorStart=0,this._lastSelectedFloorId=null}onAdd(s){return this._map=s,this._container=ni("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.style.display="none",this._map.on("styledata",this._onStyleData),this._map.on("idle",this._onStyleData),this._updateConnection(),this._container}_onStyleData(){this._updateConnection()}_updateConnection(){if(this._map&&this._map.style&&this._map.style.indoorManager){const s=this._map.style.indoorManager;s.off("selector-update",this._onIndoorUpdate),s.on("selector-update",this._onIndoorUpdate),this._onIndoorUpdate(s.getControlState()),this._map.off("idle",this._onStyleData)}}_createButton(s,t){const n=ni("button",s,this._container);return n.type="button",n.addEventListener("click",t),n}_setButtonTitle(s,t){s.setAttribute("aria-label",t),s.textContent=t}onRemove(){this._container&&this._container.remove(),this._map&&(this._map.off("styledata",this._onStyleData),this._map.off("idle",this._onStyleData),this._map.style&&this._map.style.indoorManager&&this._map.style.indoorManager.off("selector-update",this._onIndoorUpdate),this._map=null)}getDefaultPosition(){return"top-right"}_onIndoorUpdate(s){if(!s||!s.floors||s.floors.length===0)return this._model=s,void(this._container.style.display="none");const t=this._model;this._model=s,this._container.style.display="inline-block";const n=!t||t.floors.length!==s.floors.length||t.floors.some((l,d)=>l.id!==s.floors[d].id);if(n&&(this._visibleFloorStart=0,this._lastSelectedFloorId=null),s.selectedFloorId){if(s.selectedFloorId!==this._lastSelectedFloorId||n){const l=s.floors.findIndex(d=>d.id===s.selectedFloorId);if(l!==-1){const d=s.floors.length;let p,m;d<=5?(p=0,m=d-1):this._visibleFloorStart===0?(p=0,m=3):this._visibleFloorStart>=d-3?(p=d-3-1,m=d-1):(p=this._visibleFloorStart,m=this._visibleFloorStart+3-1),l<p?this._visibleFloorStart=l:l>m&&(this._visibleFloorStart=l-2)}}this._lastSelectedFloorId=s.selectedFloorId}this._render()}
vendor: 7,069 bytes, line 3337
3337_render(){if(!this._container||!this._model||!this._model.floors)return;this._container.innerHTML="";const s=this._createButton("mapboxgl-ctrl-indoor-toggle",this._toggleIndoor);ni("span","mapboxgl-ctrl-icon",s).setAttribute("aria-hidden","true"),this._model.activeFloorsVisible||s.classList.add("mapboxgl-ctrl-level-button-selected"),this._container.appendChild(s);const t=this._model.floors,n=t.length;if(n<=5)return void t.forEach(m=>this._createFloorButton(m));const l=this._visibleFloorStart===0,d=this._visibleFloorStart>=n-3;if(l)this._createFloorButton(t[0]);else{const m=this._createButton("mapboxgl-ctrl-arrow-up",this._scrollUp);ni("span","mapboxgl-ctrl-icon",m).setAttribute("aria-hidden","true"),this._container.appendChild(m)}let p=[];if(p=l?t.slice(1,4):d?t.slice(this._visibleFloorStart-1,this._visibleFloorStart+3-1):t.slice(this._visibleFloorStart,this._visibleFloorStart+3),p.forEach(m=>this._createFloorButton(m)),d)this._createFloorButton(t[n-1]);else{const m=this._createButton("mapboxgl-ctrl-arrow-down",this._scrollDown);ni("span","mapboxgl-ctrl-icon",m).setAttribute("aria-hidden","true"),this._container.appendChild(m)}}_createFloorButton(s){const t=this._createButton("mapboxgl-ctrl-level-button",()=>{const p=s.id;this._model&&this._model.selectedFloorId===p&&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(p))}),n=(s.name||"").trim(),l=s.zIndex.toString(),d=n?Array.from(n).slice(0,3).join(""):l;this._setButtonTitle(t,d),this._model&&this._model.activeFloorsVisible&&s.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 s=this._model&&this._model.floors||[];if(s.length>3){const t=s.length-3;this._visibleFloorStart===t-1&&(this._visibleFloorStart=t-2)}this._render()}}_scrollDown(){if(this._model&&this._model.floors){const s=this._model.floors.length-3;this._visibleFloorStart<s&&(this._visibleFloorStart++,this._visibleFloorStart===1&&(this._visibleFloorStart=2),this._visibleFloorStart===s-1&&(this._visibleFloorStart=s),this._visibleFloorStart>s&&(this._visibleFloorStart=s),this._render())}}},Popup:class extends u.E{constructor(s){super(),this.options=Object.assign(Object.create(yy),s),this._altitude=this.options.altitude,u.cK(["_update","_onClose","remove","_onMouseEvent"],this),this._classList=new Set(s&&s.className?s.className.trim().split(fr):[])}addTo(s){return this._map&&this.remove(),this._map=s,this.options.closeOnClick&&s.on("preclick",this._onClose),this.options.closeOnMove&&s.on("move",this._onClose),s.on("remove",this.remove),this._update(),s._addPopup(this),this._focusFirstElement(),this._trackPointer?(s.on("mousemove",this._onMouseEvent),s.on("mouseup",this._onMouseEvent),s._canvasContainer.classList.add("mapboxgl-track-pointer")):s.on("move",this._update),this.fire(new u.B("open")),this}isOpen(){return!!this._map}remove(){this._content&&this._content.remove(),this._container&&(this._container.remove(),this._container=void 0);const s=this._map;return s&&(s.off("move",this._update),s.off("move",this._onClose),s.off("preclick",this._onClose),s.off("click",this._onClose),s.off("remove",this.remove),s.off("mousemove",this._onMouseEvent),s.off("mouseup",this._onMouseEvent),s.off("drag",this._onMouseEvent),s._canvasContainer&&s._canvasContainer.classList.remove("mapboxgl-track-pointer"),s._removePopup(this),this._map=void 0),this.fire(new u.B("close")),this}getLngLat(){return this._lngLat}setLngLat(s){this._lngLat=u.b2.convert(s),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(s){return this._altitude=s,this._update(),this}trackPointer(){this._trackPointer=!0,this._pos=null,this._update();const s=this._map;return s&&(s.off("move",this._update),s.on("mousemove",this._onMouseEvent),s.on("drag",this._onMouseEvent),s._canvasContainer.classList.add("mapboxgl-track-pointer")),this}getElement(){return this._container}setText(s){return this.setDOMContent(document.createTextNode(s))}setHTML(s){const t=document.createDocumentFragment(),n=document.createElement("body");let l;for(n.innerHTML=s;l=n.firstChild,l;)t.appendChild(l);return this.setDOMContent(t)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(s){return this.options.maxWidth=s,this._update(),this}setDOMContent(s){let t=this._content;if(t)for(;t.hasChildNodes();)t.firstChild&&t.removeChild(t.firstChild);else t=this._content=ni("div","mapboxgl-popup-content",this._container||void 0);if(t.appendChild(s),this.options.closeButton){const n=this._closeButton=ni("button","mapboxgl-popup-close-button",t);n.type="button",n.setAttribute("aria-label","Close popup"),n.innerHTML='<span aria-hidden="true">&#215;</span>',n.addEventListener("click",this._onClose)}return this._update(),this._focusFirstElement(),this}addClassName(s){return this._classList.add(s),this._updateClassList(),this}removeClassName(s){return this._classList.delete(s),this._updateClassList(),this}setOffset(s){return this.options.offset=s,this._update(),this}toggleClassName(s){let t;return this._classList.delete(s)?t=!1:(this._classList.add(s),t=!0),this._updateClassList(),t}_onMouseEvent(s){this._update(s.point)}_getAnchor(s){if(this.options.anchor)return this.options.anchor;const t=this._map,n=this._container,l=this._pos;if(!t||!n||!l)return"bottom";const d=n.offsetWidth,p=n.offsetHeight,m=l.x<d/2,g=l.x>t.transform.width-d/2;if(l.y+s<p)return m?"top-left":g?"top-right":"top";if(l.y>t.transform.height-p){if(m)return"bottom-left";if(g)return"bottom-right"}return m?"left":g?"right":"bottom"}_updateClassList(){const s=this._container;if(!s)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"),s.className=t.join(" ")}_update(s){const t=this._map,n=this._content;if(!t||!this._lngLat&&!this._trackPointer||!n)return;let l=this._container;if(l||(l=this._container=ni("div","mapboxgl-popup",t.getContainer()),this._tip=ni("div","mapboxgl-popup-tip",l),l.appendChild(n)),this.options.maxWidth&&l.style.maxWidth!==this.options.maxWidth&&(l.style.maxWidth=this.options.maxWidth),t.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=ip(this._lngLat,this._pos,t.transform)),!this._trackPointer||s){const d=this._pos=this._trackPointer&&s instanceof u.P?s:t.project(this._lngLat,this._altitude),p=v_
3337(this.options.offset),m=this._anchor=this._getAnchor(p.y),g=v_(this.options.offset,m),x=d.add(g).round();t._requestDomTask(()=>{this._container&&m&&(this._container.style.transform=`${rp[m]} translate(${x.x}px,${x.y}px)`)})}if(!this._marker&&t._showingGlobe()){const d=u.fh(t.transform,this._lngLat)?0:1;this._setOpacity(d)}this._updateClassList()}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const s=this._container.querySelector(ou);s&&s.focus()}_onClose(){this.remove()}_setOpacity(s){this._container&&(this._container.style.opacity=`${s}`),this._content&&(this._content.style.pointerEvents=s?"auto":"none")}},Marker:Uh,Style:ln,LngLat:u.b2,LngLatBounds:u.bD,Point:u.P,MercatorCoordinate:u.ac,FreeCameraOptions:Jt,Evented:u.E,config:u.g,prewarm:function(){dh().acquire(Au)},clearPrewarmedResources:function(){const s=Ul;s&&(s.isPreloaded()&&s.numActive()===1?(s.release(Au),Ul=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 u.g.ACCESS_TOKEN},set accessToken(s){u.fw(s)},get baseApiUrl(){return u.g.API_URL},set baseApiUrl(s){u.fv(s)},get workerCount(){return ds.workerCount},set workerCount(s){(function(t){ds.workerCount=t})(s)},get maxParallelImageRequests(){return u.g.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(s){u.fu(s)},clearStorage(s){u.ft(s)},get workerUrl(){return Un.workerUrl},set workerUrl(s){Un.workerUrl=s},get workerClass(){return Un.workerClass},set workerClass(s){Un.workerClass=s},get dracoUrl(){return u.fs()},set dracoUrl(s){u.fr(s)},get meshoptUrl(){return u.fq()},set meshoptUrl(s){u.fp(s)},get buildingGenUrl(){return u.fo()},set buildingGenUrl(s){u.fn(s)},setNow:u.r.setNow,restoreNow:u.r.restoreNow}});var Op=od;return Op}))})(Eg)),Eg.exports}var VT=NT();const Fp=BT(VT);function UT(){const tn=document.querySelector("[data-contact-map]");if(!tn)return;const Sg=tn.dataset.mapboxToken??"",ha=Number(tn.dataset.lat),da=Number(tn.dataset.lng),od=tn.dataset.label??"Pooler Karate",gu=tn.dataset.address??"",Op=tn.dataset.directionsUrl??"";if(!Sg||Number.isNaN(ha)||Number.isNaN(da))return;const u=tn.querySelector("[data-contact-map-canvas]");if(!u)return;u.innerHTML="",Fp.accessToken=Sg;const N=new Fp.Map({container:u,style:"mapbox://styles/mapbox/dark-v11",center:[da,ha],zoom:14,scrollZoom:!1});N.addControl(new Fp.NavigationControl({showCompass:!1}),"top-right");const jr=document.createElement("div");jr.className="contact-map-marker",jr.setAttribute("aria-hidden","true");const Gi=[`<strong>${Mx(od)}</strong>`,gu?`<p>${Mx(gu).replaceAll(`
3338`,"<br />")}</p>`:"",Op?`<a href="${Mx(Op)}" target="_blank" rel="noopener noreferrer">Get directions</a>`:""].filter(Boolean).join("");new Fp.Marker({element:jr,anchor:"center"}).setLngLat([da,ha]).setPopup(new Fp.Popup({offset:16,closeButton:!1}).setHTML(`<div class="contact-map-popup">${Gi}</div>`)).addTo(N),N.on("load",()=>{N.resize()}),window.addEventListener("resize",()=>{N.resize()})}function Mx(tn){return tn.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;").replaceAll("'","&#39;")}UT();

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.