PageSourceSearch

https://public.getgreenspark.com/assets/mapbox-DL6ddhkj.js

js getgreenspark.com collected 2026-09-26 05:06:12 UTC 1,769,153 bytes, 3,262 lines download raw bytes

1import{a as o2,c as s2}from"./localforage-92l_8Lt_.js";(function(){try{var oc=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Em=new Error().stack;Em&&(oc._sentryDebugIds=oc._sentryDebugIds||{},oc._sentryDebugIds[Em]="6570611d-904c-45a7-9d14-8fe81825a5da",oc._sentryDebugIdIdentifier="sentry-dbid-6570611d-904c-45a7-9d14-8fe81825a5da")}catch{}})();var rb={exports:{}};(function(oc,Em){(function(sc,Ku){oc.exports=Ku()})(s2,function(){let sc,Ku,Am;function Cm(a,We){if(!sc)sc=We;else if(!Ku)Ku=We;else{const Oi={};sc(Oi),Am=We(Oi);const Vn="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 = {}; ("+sc+")(sharedChunk); ("+Ku+")(undefined, sharedChunk); self.onerror = null;";typeof window<"u"&&window&&window.URL&&window.URL.createObjectURL&&(Am.workerUrl=window.URL.createObjectURL(new Blob([Vn],{type:"text/javascript"})))}}Cm(["exports"],function(a){var We=1e-6,Oi=typeof Float32Array<"u"?Float32Array:Array;function Vn(r,e){var t=e[0],n=e[1],s=e[2],c=e[3],h=t*c-s*n;return h?(r[0]=c*(h=1/h),r[1]=-n*h,r[2]=-s*h,r[3]=t*h,r):null}function ac(){var r=new Oi(9);return Oi!=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 Ys(r,e){var t=e[0],n=e[1],s=e[2],c=e[3],h=e[4],f=e[5],p=e[6],g=e[7],x=e[8];return r[0]=h*x-f*g,r[1]=s*g-n*x,r[2]=n*f-s*h,r[3]=f*p-c*x,r[4]=t*x-s*p,r[5]=s*c-t*f,r[6]=c*g-h*p,r[7]=n*p-t*g,r[8]=t*h-n*c,r}function yo(r,e,t){var n=e[0],s=e[1],c=e[2],h=e[3],f=e[4],p=e[5],g=e[6],x=e[7],b=e[8],w=t[0],S=t[1],E=t[2],A=t[3],P=t[4],R=t[5],B=t[6],L=t[7],U=t[8];return r[0]=w*n+S*h+E*g,r[1]=w*s+S*f+E*x,r[2]=w*c+S*p+E*b,r[3]=A*n+P*h+R*g,r[4]=A*s+P*f+R*x,r[5]=A*c+P*p+R*b,r[6]=B*n+L*h+U*g,r[7]=B*s+L*f+U*x,r[8]=B*c+L*p+U*b,r}function ps(){var r=new Oi(16);return Oi!=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 Jt(r){var e=new Oi(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 Ei(r){return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=1,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function An(r,e){var t=e[0],n=e[1],s=e[2],c=e[3],h=e[4],f=e[5],p=e[6],g=e[7],x=e[8],b=e[9],w=e[10],S=e[11],E=e[12],A=e[13],P=e[14],R=e[15],B=t*f-n*h,L=t*p-s*h,U=t*g-c*h,G=n*p-s*f,q=n*g-c*f,ie=s*g-c*p,X=x*A-b*E,ee=x*P-w*E,Q=x*R-S*E,J=b*P-w*A,ve=b*R-S*A,Te=w*R-S*P,Ie=B*Te-L*ve+U*J+G*Q-q*ee+ie*X;return Ie?(r[0]=(f*Te-p*ve+g*J)*(Ie=1/Ie),r[1]=(s*ve-n*Te-c*J)*Ie,r[2]=(A*ie-P*q+R*G)*Ie,r[3]=(w*q-b*ie-S*G)*Ie,r[4]=(p*Q-h*Te-g*ee)*Ie,r[5]=(t*Te-s*Q+c*ee)*Ie,r[6]=(P*U-E*ie-R*L)*Ie,r[7]=(x*ie-w*U+S*L)*Ie,r[8]=(h*ve-f*Q+g*X)*Ie,r[9]=(n*Q-t*ve-c*X)*Ie,r[10]=(E*q-A*U+R*B)*Ie,r[11]=(b*U-x*q-S*B)*Ie,r[12]=(f*ee-h*J-p*X)*Ie,r[13]=(t*J-n*ee+s*X)*Ie,r[14]=(A*L-E*G-P*B)*Ie,r[15]=(x*G-b*L+w*B)*Ie,r):null}function Ti(r,e,t){var n=e[0],s=e[1],c=e[2],h=e[3],f=e[4],p=e[5],g=e[6],x=e[7],b=e[8],w=e[9],S=e[10],E=e[11],A=e[12],P=e[13],R=e[14],B=e[15],L=t[0],U=t[1],G=t[2],q=t[3];return r[0]=L*n+U*f+G*b+q*A,r[1]=L*s+U*p+G*w+q*P,r[2]=L*c+U*g+G*S+q*R,r[3]=L*h+U*x+G*E+q*B,r[4]=(L=t[4])*n+(U=t[5])*f+(G=t[6])*b+(q=t[7])*A,r[5]=L*s+U*p+G*w+q*P,r[6]=L*c+U*g+G*S+q*R,r[7]=L*h+U*x+G*E+q*B,r[8]=(L=t[8])*n+(U=t[9])*f+(G=t[10])*b+(q=t[11])*A,r[9]=L*s+U*p+G*w+q*P,r[10]=L*c+U*g+G*S+q*R,r[11]=L*h+U*x+G*E+q*B,r[12]=(L=t[12])*n+(U=t[13])*f+(G=t[14])*b+(q=t[15])*A,r[13]=L*s+U*p+G*w+q*P,r[14]=L*c+U*g+G*S+q*R,r[15]=L*h+U*x+G*E+q*B,r}function Qr(r,e,t){var n,s,c,h,f,p,g,x,b,w,S,E,A=t[0],P=t[1],R=t[2];return e===r?(r[12]=e[0]*A+e[4]*P+e[8]*R+e[12],r[13]=e[1]*A+e[5]*P+e[9]*R+e[13],r[14]=e[2]*A+e[6]*P+e[10]*R+e[14],r[15]=e[3]*A+e[7]*P+e[11]*R+e[15]):(s=e[1],c=e[2],h=e[3],f=e[4],p=e[5],g=e[6],x=e[7],b=e[8],w=e[9],S=e[10],E=e[11],r[0]=n=e[0],r[1]=s,r[2]=c,r[3]=h,r[4]=f,r[5]=p,r[6]=g,r[7]=x,r[8]=b,r[9]=w,r[10]=S,r[11]=E,r[12]=n*A+f*P+b*R+e[12],r[13]=s*A+p*P+w*R+e[13],r[14]=c*A+g*P+S*R+e[14],r[15]=h*A+x*P+E*R+e[15]),r}function Mr(r,e,t){var n=t[0],s=t[1],c=t[2];return r[0]=e[0]*n,r[1]=e[1]*n,r[2]=e[2]*n,r[3]=e[3]*n,r[4]=e[4]*s,r[5]=e[5]*s,r[6]=e[6]*s,r[7]=e[7]*s,r[8]=e[8]*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 xo(r,e,t){var n=Math.sin(t),s=Math.cos(t),c=e[4],h=e[5],f=e[6],p=e[7],g=e[8],x=e[9],b=e[10],w=e[11];return e!==r&&(r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r[4]=c*s+g*n,r[5]=h*s+x*n,r[6]=f*s+b*n,r[7]=p*s+w*n,r[8]=g*s-c*n,r[9]=x*s-h*n,r[10]=b*s-f*n,r[11]=w*s-p*n,r}function Nn(r,e,t){var n=Math.sin(t),s=Math.cos(t),c=e[0],h=e[1],f=e[2],p=e[3],g=e[8],x=e[9],b=e[10],w=e[11];return e!==r&&(r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r[0]=c*s-g*n,r[1]=h*s-x*n,r[2]=f*s-b*n,r[3]=p*s-w*n,r[8]=c*n+g*s,r[9]=h*n+x*s,r[10]=f*n+b*s,r[11]=p*n+w*s,r}function vo(r,e,t){var n=Math.sin(t),s=Math.cos(t),c=e[0],h=e[1],f=e[2],p=e[3],g=e[4],x=e[5],b=e[6],w=e[7];return e!==r&&(r[8]=e[8],r[9]=e[9],r[10]=e[10],r[11]=e[11],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r[0]=c*s+g*n,r[1]=h*s+x*n,r[2]=f*s+b*n,r[3]=p*s+w*n,r[4]=g*s-c*n,r[5]=x*s-h*n,r[6]=b*s-f*n,r[7]=w*s-p*n,r}function Un(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 bo(r,e,t){var n,s,c,h=t[0],f=t[1],p=t[2],g=Math.sqrt(h*h+f*f+p*p);return g<We?null:(h*=g=1/g,f*=g,p*=g,n=Math.sin(e),s=Math.cos(e),r[0]=h*h*(c=1-s)+s,r[1]=f*h*c+p*n,r[2]=p*h*c-f*n,r[3]=0,r[4]=h*f*c-p*n,r[5]=f*f*c+s,r[6]=p*f*c+h*n,r[7]=0,r[8]=h*p*c+f*n,r[9]=f*p*c-h*n,r[10]=p*p*c+s,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r)}function Ha(r,e){var t=e[0],n=e[1],s=e[2],c=e[4],h=e[5],f=e[6],p=e[8],g=e[9],x=e[10];return r[0]=Math.sqrt(t*t+n*n+s*s),r[1]=Math.sqrt(c*c+h*h+f*f),r[2]=Math.sqrt(p*p+g*g+x*x),r}function Za(r,e){var t=e[0],n=e[1],s=e[2],c=e[3],h=t+t,f=n+n,p=s+s,g=t*h,x=n*h,b=n*f,w=s*h,S=s*f,E=s*p,A=c*h,P=c*f,R=c*p;return r[0]=1-b-E,r[1]=x+R,r[2]=w-P,r[3]=0,r[4]=x-R,r[5]=1-g-E,r[6]=S+A,r[7]=0,r[8]=w+P,r[9]=S-A,r[10]=1-g-b,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}var Wa=Ti;function ei(){var r=new Oi(3);return Oi!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r}function lc(r){var e=new Oi(3);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e}function Jr(r){var e=r[0],t=r[1],n=r[2];return Math.sqrt(e*e+t*t+n*n)}function Bi(r,e,t){var n=new Oi(3);
1return n[0]=r,n[1]=e,n[2]=t,n}function ri(r,e,t,n){return r[0]=e,r[1]=t,r[2]=n,r}function er(r,e,t){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r[2]=e[2]+t[2],r}function jn(r,e,t){return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r[2]=e[2]-t[2],r}function wo(r,e,t){return r[0]=e[0]*t[0],r[1]=e[1]*t[1],r[2]=e[2]*t[2],r}function Gn(r,e,t){return r[0]=Math.min(e[0],t[0]),r[1]=Math.min(e[1],t[1]),r[2]=Math.min(e[2],t[2]),r}function Jn(r,e,t){return r[0]=Math.max(e[0],t[0]),r[1]=Math.max(e[1],t[1]),r[2]=Math.max(e[2],t[2]),r}function yi(r,e,t){return r[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*t,r}function un(r,e,t,n){return r[0]=e[0]+t[0]*n,r[1]=e[1]+t[1]*n,r[2]=e[2]+t[2]*n,r}function cc(r,e){var t=e[0]-r[0],n=e[1]-r[1],s=e[2]-r[2];return Math.sqrt(t*t+n*n+s*s)}function Xa(r,e){var t=e[0]-r[0],n=e[1]-r[1],s=e[2]-r[2];return t*t+n*n+s*s}function uc(r){var e=r[0],t=r[1],n=r[2];return e*e+t*t+n*n}function Uo(r,e){return r[0]=-e[0],r[1]=-e[1],r[2]=-e[2],r}function xi(r,e){var t=e[0],n=e[1],s=e[2],c=t*t+n*n+s*s;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 ki(r,e){return r[0]*e[0]+r[1]*e[1]+r[2]*e[2]}function dr(r,e,t){var n=e[0],s=e[1],c=e[2],h=t[0],f=t[1],p=t[2];return r[0]=s*p-c*f,r[1]=c*h-n*p,r[2]=n*f-s*h,r}function ms(r,e,t,n){var s=e[0],c=e[1],h=e[2];return r[0]=s+n*(t[0]-s),r[1]=c+n*(t[1]-c),r[2]=h+n*(t[2]-h),r}function Vi(r,e,t){var n=e[0],s=e[1],c=e[2],h=t[3]*n+t[7]*s+t[11]*c+t[15];return r[0]=(t[0]*n+t[4]*s+t[8]*c+t[12])/(h=h||1),r[1]=(t[1]*n+t[5]*s+t[9]*c+t[13])/h,r[2]=(t[2]*n+t[6]*s+t[10]*c+t[14])/h,r}function _s(r,e,t){var n=e[0],s=e[1],c=e[2];return r[0]=n*t[0]+s*t[3]+c*t[6],r[1]=n*t[1]+s*t[4]+c*t[7],r[2]=n*t[2]+s*t[5]+c*t[8],r}function gs(r,e,t){var n=t[0],s=t[1],c=t[2],h=t[3],f=e[0],p=e[1],g=e[2],x=s*g-c*p,b=c*f-n*g,w=n*p-s*f;return r[0]=f+h*(x+=x)+s*(w+=w)-c*(b+=b),r[1]=p+h*b+c*x-n*w,r[2]=g+h*w+n*b-s*x,r}function To(r){return r[0]=0,r[1]=0,r[2]=0,r}function eo(r,e){return r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]}var Xi=jn,hc=wo,Rr=Jr;function ys(){var r=new Oi(4);return Oi!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0,r[3]=0),r}function Ks(r,e,t){return r[0]=e[0]*t,r[1]=e[1]*t,r[2]=e[2]*t,r[3]=e[3]*t,r}function hn(r,e){var t=e[0],n=e[1],s=e[2],c=e[3],h=t*t+n*n+s*s+c*c;return h>0&&(h=1/Math.sqrt(h)),r[0]=t*h,r[1]=n*h,r[2]=s*h,r[3]=c*h,r}function xs(r,e){return r[0]*e[0]+r[1]*e[1]+r[2]*e[2]+r[3]*e[3]}function br(r,e,t){var n=e[0],s=e[1],c=e[2],h=e[3];return r[0]=t[0]*n+t[4]*s+t[8]*c+t[12]*h,r[1]=t[1]*n+t[5]*s+t[9]*c+t[13]*h,r[2]=t[2]*n+t[6]*s+t[10]*c+t[14]*h,r[3]=t[3]*n+t[7]*s+t[11]*c+t[15]*h,r}function qn(){var r=new Oi(4);return Oi!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r[3]=1,r}function jo(r){return r[0]=0,r[1]=0,r[2]=0,r[3]=1,r}function Ya(r,e,t){t*=.5;var n=e[0],s=e[1],c=e[2],h=e[3],f=Math.sin(t),p=Math.cos(t);return r[0]=n*p+h*f,r[1]=s*p+c*f,r[2]=c*p-s*f,r[3]=h*p-n*f,r}function Go(r,e,t){t*=.5;var n=e[0],s=e[1],c=e[2],h=e[3],f=Math.sin(t),p=Math.cos(t);return r[0]=n*p-c*f,r[1]=s*p+h*f,r[2]=c*p+n*f,r[3]=h*p-s*f,r}ei(),ys();var kr,Qs,Cn,dn=hn,Ka=(kr=ei(),Qs=Bi(1,0,0),Cn=Bi(0,1,0),function(r,e,t){var n=ki(e,t);return n<-.999999?(dr(kr,Qs,e),Rr(kr)<1e-6&&dr(kr,Cn,e),xi(kr,kr),function(s,c,h){h*=.5;var f=Math.sin(h);s[0]=f*c[0],s[1]=f*c[1],s[2]=f*c[2],s[3]=Math.cos(h)}(r,kr,Math.PI),r):n>.999999?(r[0]=0,r[1]=0,r[2]=0,r[3]=1,r):(dr(kr,e,t),r[0]=kr[0],r[1]=kr[1],r[2]=kr[2],r[3]=1+n,dn(r,r))});function vr(){var r=new Oi(2);return Oi!=Float32Array&&(r[0]=0,r[1]=0),r}function So(r,e){var t=new Oi(2);return t[0]=r,t[1]=e,t}function vs(r,e,t){return r[0]=e,r[1]=t,r}function en(r,e,t){return r[0]=e[0]+t[0],r[1]=e[1]+t[1],r}function Io(r,e,t){return r[0]=e[0]-t[0],r[1]=e[1]-t[1],r}function bs(r,e,t){return r[0]=e[0]*t,r[1]=e[1]*t,r}function ws(r){var e=r[0],t=r[1];return Math.sqrt(e*e+t*t)}function to(r,e){var t=e[0],n=e[1],s=t*t+n*n;return s>0&&(s=1/Math.sqrt(s)),r[0]=e[0]*s,r[1]=e[1]*s,r}function qo(r,e){return r[0]*e[0]+r[1]*e[1]}qn(),qn(),ac();var Ts,dc,fc=Io;function $o(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}vr();var pc=function(){if(dc)return Ts;function r(e,t,n,s){this.cx=3*e,this.bx=3*(n-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(s-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=t,this.p2x=n,this.p2y=s}return dc=1,Ts=r,r.prototype={sampleCurveX:function(e){return((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,t){if(t===void 0&&(t=1e-6),e<0)return 0;if(e>1)return 1;for(var n=e,s=0;s<8;s++){var c=this.sampleCurveX(n)-e;if(Math.abs(c)<t)return n;var h=this.sampleCurveDerivativeX(n);
1if(Math.abs(h)<1e-6)break;n-=c/h}var f=0,p=1;for(n=e,s=0;s<20&&(c=this.sampleCurveX(n),!(Math.abs(c-e)<t));s++)e>c?f=n:p=n,n=.5*(p-f)+f;return n},solve:function(e,t){return this.sampleCurveY(this.solveCurveX(e,t))}},Ts}(),Qa=$o(pc);function Fe(r,e){this.x=r,this.y=e}function di(r,e){if(Array.isArray(r)){if(!Array.isArray(e)||r.length!==e.length)return!1;for(let t=0;t<r.length;t++)if(!di(r[t],e[t]))return!1;return!0}if(typeof r=="object"&&r!==null&&e!==null){if(typeof e!="object"||Object.keys(r).length!==Object.keys(e).length)return!1;for(const t in r)if(!di(r[t],e[t]))return!1;return!0}return r===e}Fe.prototype={clone(){return new Fe(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,t=r.y-this.y;return e*e+t*t},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),t=Math.sin(r),n=t*this.x+e*this.y;return this.x=e*this.x-t*this.y,this.y=n,this},_rotateAround(r,e){const t=Math.cos(r),n=Math.sin(r),s=e.y+n*(this.x-e.x)+t*(this.y-e.y);return this.x=e.x+t*(this.x-e.x)-n*(this.y-e.y),this.y=s,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:Fe},Fe.convert=function(r){if(r instanceof Fe)return r;if(Array.isArray(r))return new Fe(+r[0],+r[1]);if(r.x!==void 0&&r.y!==void 0)return new Fe(+r.x,+r.y);throw new Error("Expected [x, y] or {x, y} point format")};const zr=Math.PI/180,Ja=180/Math.PI;function Vt(r){return r*zr}function Zi(r){return r*Ja}const mc=[[0,0],[1,0],[1,1],[0,1]];function el(r){if(r<=0)return 0;if(r>=1)return 1;const e=r*r,t=e*r;return 4*(r<.5?t:3*(r-e)+t-.75)}function pe(r,e,t,n){const s=new Qa(r,e,t,n);return function(c){return s.solve(c)}}const O=pe(.25,.1,.25,1);function k(r,e,t){return Math.min(t,Math.max(e,r))}function W(r,e,t){return(t=k((t-r)/(e-r),0,1))*t*(3-2*t)}function oe(r,e,t){const n=t-e,s=((r-e)%n+n)%n+e;return s===e?t:s}function ae(r,e,t){if(!r.length)return t(null,[]);let n=r.length;const s=new Array(r.length);let c=null;r.forEach((h,f)=>{e(h,(p,g)=>{p&&(c=p),s[f]=g,--n===0&&t(c,s)})})}let ce=1;function me(){return ce++}function he(r){return r<=1?1:Math.pow(2,Math.ceil(Math.log2(r)))}function ge(r,e){r.forEach(t=>{e[t]&&(e[t]=e[t].bind(e))})}function Re(r,e,t){const n={};for(const s in r)n[s]=e.call(this,r[s],s,r);return n}function ze(r,e,t){const n={};for(const s in r)e.call(this,r[s],s,r)&&(n[s]=r[s]);return n}function Xe(r){return Array.isArray(r)?r.map(Xe):typeof r=="object"&&r?Re(r,Xe):r}function ut(r,e){for(let t=0;t<r.length;t++)if(e.indexOf(r[t])>=0)return!0;return!1}const mt={};function lt(r){mt[r]||(typeof console<"u"&&console.warn(r),mt[r]=!0)}function St(r,e,t){return(t.y-r.y)*(e.x-r.x)>(e.y-r.y)*(t.x-r.x)}function vt(r){let e=0;for(let t,n,s=0,c=r.length,h=c-1;s<c;h=s++)t=r[s],n=r[h],e+=(n.x-t.x)*(t.y+n.y);return e}function Ot([r,e,t]){const n=Vt(e+90),s=Vt(t);return{x:r*Math.cos(n)*Math.sin(s),y:r*Math.sin(n)*Math.sin(s),z:r*Math.cos(s),azimuthal:e,polar:t}}function Si(r){return(typeof self<"u"||r!==void 0)&&typeof WorkerGlobalScope<"u"&&(r!==void 0?r:self)instanceof WorkerGlobalScope}function Yi(r){const e={};if(r.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(t,n,s,c)=>{const h=s||c;return e[n]=!h||h.toLowerCase(),""}),e["max-age"]){const t=parseInt(e["max-age"],10);isNaN(t)?delete e["max-age"]:e["max-age"]=t}return e}let Di,vi=null;function fi(r,e){return[r[4*e],r[4*e+1],r[4*e+2],r[4*e+3]]}function Ri(r,e,t,n){for(;e<t;){const s=e+t>>1;r[s]<n?e=s+1:t=s}return e}function bi(r,e,t,n){for(;e<t;){const s=e+t>>1;r[s]<=n?e=s+1:t=s}return e}function pi(r){return r>0?1/(1.001-r):1+r}function _i(r){return r>0?1-1/(1.001-r):-r}function mi(r,e,t){return(r-e.min)*(t.max-t.min)/(e.max-e.min)+t.min}const Nt={API_URL:"https://api.mapbox.com",get API_URL_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/|\?|$)/i},get API_TILEJSON_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/v[0-9]*\/.*\.json.*$)/i},get API_SPRITE_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*\/sprite.*\..*$)/i},get API_FONTS_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/fonts\/v[0-9]*\/)(.*\.pbf.*$)/i},get API_STYLE_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*$)/i},get API_CDN_URL_REGEX(){return/^((https?:)?\/\/)?api\.mapbox\.c(n|om)(\/mapbox-gl-js\/)(.*$)/i},get EVENTS_URL(){if(!Nt.API_URL)return null;
1try{const r=new URL(Nt.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/mapbox-gl-pmtiles-provider-v0.0.1.js"})};function wr(){return new URL(Nt.DRACO_URL,Nt.API_URL).href}function Tr(){if(typeof WebAssembly!="object")throw new Error("WebAssembly not supported, cannot instantiate meshoptimizer");return new URL(function(){if(Di===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]);Di=WebAssembly.validate(r)}return Di}()?Nt.MESHOPT_SIMD_URL:Nt.MESHOPT_URL,Nt.API_URL).href}function Mn(){return new URL(Nt.BUILDING_GEN_URL,Nt.API_URL).href}function Sr(r){return Nt.API_URL_REGEX.test(r)}function $n(r){return Nt.API_SPRITE_REGEX.test(r)}let qr,$r,Eo,io,Pn,tn;function Ss(){return qr==null&&(qr=self.OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&typeof self.createImageBitmap=="function"),qr}const fn={now:()=>io!==void 0?io:performance.now(),setNow(r){io=r},restoreNow(){io=void 0},frame(r){const e=requestAnimationFrame(r);return{cancel:()=>cancelAnimationFrame(e)}},getImageData(r,e=0){const{width:t,height:n}=r;Pn||(Pn=document.createElement("canvas"));const s=Pn.getContext("2d",{willReadFrequently:!0});if(!s)throw new Error("failed to create canvas 2d context");return(t>Pn.width||n>Pn.height)&&(Pn.width=t,Pn.height=n),s.clearRect(-e,-e,t+2*e,n+2*e),s.drawImage(r,0,0,t,n),s.getImageData(-e,-e,t+2*e,n+2*e)},resolveURL:r=>($r||($r=document.createElement("a")),$r.href=r,$r.href),get devicePixelRatio(){return window.devicePixelRatio},get prefersReducedMotion(){return!!window.matchMedia&&(Eo==null&&(Eo=window.matchMedia("(prefers-reduced-motion: reduce)")),Eo.matches)},hasCanvasFingerprintNoise(){if(tn!==void 0)return tn;if(!Ss())return tn=!1,!1;const r=new OffscreenCanvas(85,1),e=r.getContext("2d",{willReadFrequently:!0});let t=0;for(let s=0;s<r.width;++s)e.fillStyle=`rgba(${t++},${t++},${t++}, 255)`,e.fillRect(s,0,1,1);const n=e.getImageData(0,0,r.width,r.height);t=0;for(let s=0;s<n.data.length;++s)if(s%4!=3&&t++!==n.data[s])return tn=!0,!0;return tn=!1,!1}};function uf(r,e){const t=r.indexOf("?");if(t<0)return`${r}?${new URLSearchParams(e).toString()}`;
1const n=new URLSearchParams(r.slice(t));for(const s in e)n.set(s,e[s]);return`${r.slice(0,t)}?${n.toString()}`}function Ho(r,e={persistentParams:[]}){const t=r.indexOf("?");if(t<0)return r;const n=new URLSearchParams,s=new URLSearchParams(r.slice(t));for(const h of e.persistentParams){const f=s.get(h);f&&n.set(h,f)}const c=n.toString();return`${r.slice(0,t)}${c.length>0?`?${c}`:""}`}const _c="mapbox-tiles";let gc=500,Qu=50;const Ju=["language","worldview","jobid"];let Ao;function hf(){try{return caches}catch{}}function yc(){const r=hf();r&&Ao==null&&(Ao=r.open(_c))}let xc=1/0;const tl={supported:!1,testSupport:function(r){!pn&&Js&&(eh?df(r):il=r)}};let il,Js,pn=!1,eh=!1;const ea=typeof self<"u"?self:{};function df(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,Js),r.isContextLost())return;tl.supported=!0}catch{}r.deleteTexture(e),pn=!0}ea.document&&(Js=ea.document.createElement("img"),Js.onload=function(){il&&df(il),il=null,eh=!0},Js.onerror=function(){pn=!0,il=null},Js.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const rl={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Iconset:"Iconset",Image:"Image",Model:"Model"};Object.freeze(rl);class vc extends Error{constructor(e,t,n){t===401&&Sr(n)&&(e+=": you may have provided an invalid Mapbox access token. See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes"),super(e),this.status=t,this.url=n}toString(){return`${this.name}: ${this.message} (${this.status}): ${this.url}`}}function $t(r){return typeof r=="object"&&r!==null&&"status"in r&&r.status===404}const bc=Si()?()=>self.worker.referrer:()=>(location.protocol==="blob:"?parent:self).location.href,ta=function(r,e){return/^file:/.test(t=r.url)||/^file:/.test(bc())&&!/^\w+:/.test(t)?function(n,s){const c=new XMLHttpRequest;c.open(n.method||"GET",n.url,!0),n.type==="arrayBuffer"&&(c.responseType="arraybuffer");for(const h in n.headers)c.setRequestHeader(h,n.headers[h]);return n.type==="json"&&(c.responseType="text",c.setRequestHeader("Accept","application/json")),c.withCredentials=n.credentials==="include",c.onerror=()=>{s(new Error(c.statusText))},c.onload=()=>{if((c.status>=200&&c.status<300||c.status===0)&&c.response!==null){let h=c.response;if(n.type==="json")try{h=JSON.parse(c.response)}catch(p){return s(p)}const f=new Headers;c.getAllResponseHeaders().trim().split(/[\r\n]+/).forEach(p=>{const g=p.split(": "),x=g.shift(),b=g.join(": ");f.append(x,b)}),s(null,h,f)}else s(new vc(c.statusText,c.status,n.url))},c.send(n.body),{cancel:()=>c.abort()}}(r,e):function(n,s){const c=new AbortController,h=new Request(n.url,{method:n.method||"GET",body:n.body,credentials:n.credentials,headers:n.headers,referrer:bc(),referrerPolicy:n.referrerPolicy,signal:c.signal});let f=!1,p=!1;const g=(x=h.url).indexOf("sku=")>0&&Sr(x);var x;n.type==="json"&&h.headers.set("Accept","application/json");const b=(S,E,A)=>{if(p)return;if(S&&S.message!=="SecurityError"&&lt(S.toString()),E&&A)return w(E);const P=Date.now();fetch(h).then(R=>{if(R.ok){const B=g?R.clone():null;return w(R,B,P)}return s(new vc(R.statusText,R.status,n.url))}).catch(R=>{R.name!=="AbortError"&&s(new Error(`${R.message} ${n.url}`))})},w=(S,E,A)=>{(n.type==="arrayBuffer"?S.arrayBuffer():n.type==="json"?S.json():S.text()).then(P=>{p||(E&&A&&function(R,B,L){if(yc(),Ao==null)return;const U=Yi(B.headers.get("cache-control")||"");if(U["no-store"])return;const G={status:B.status,statusText:B.statusText,headers:new Headers};B.headers.forEach((Q,J)=>G.headers.set(J,Q)),U["max-age"]&&G.headers.set("Expires",new Date(L+1e3*U["max-age"]).toUTCString());const q=G.headers.get("expires");if(!q||new Date(q).getTime()-L<42e4)return;
1let ie=Ho(R.url,{persistentParams:Ju});if(B.status===206){const Q=R.headers.get("Range");if(!Q)return;G.status=200,ie=uf(ie,{range:Q})}const X=new Response((ee=B.status)!==200&&ee!==404&&[101,103,204,205,304].includes(ee)?null:B.body,G);var ee;yc(),Ao!=null&&Ao.then(Q=>Q.put(ie,X)).catch(Q=>lt(Q.message))}(h,E,A),f=!0,s(null,P,S.headers))}).catch(P=>{p||s(new Error(P.message))})};return g?function(S,E){if(yc(),Ao==null)return E(null);Ao.then(A=>{let P=Ho(S.url,{persistentParams:Ju});const R=S.headers.get("Range");R&&(P=uf(P,{range:R})),A.match(P).then(B=>{const L=function(U){if(!U)return!1;const G=new Date(U.headers.get("expires")||0),q=Yi(U.headers.get("cache-control")||"");return Number(G)>Date.now()&&!q["no-cache"]}(B);A.delete(P).catch(E),L&&A.put(P,B.clone()).catch(E),E(null,B,L)}).catch(E)}).catch(E)}(h,b):b(null,null),{cancel:()=>{p=!0,f||c.abort()}}}(r,e);var t},nl=function(r,e){return ta(Object.assign(r,{type:"arrayBuffer"}),e)};function Mm(r){const e=document.createElement("a");return e.href=r,e.protocol===location.protocol&&e.host===location.host}let Is,Zo;Is=[],Zo=0;const ia=function(r,e){if(tl.supported&&(r.headers||(r.headers={}),r.headers.accept="image/webp,*/*"),Zo>=Nt.MAX_PARALLEL_IMAGE_REQUESTS){const c={requestParameters:r,callback:e,cancelled:!1,cancel(){this.cancelled=!0}};return Is.push(c),c}Zo++;let t=!1;const n=()=>
1{if(!t)for(t=!0,Zo--;Is.length&&Zo<Nt.MAX_PARALLEL_IMAGE_REQUESTS;){const c=Is.shift(),{requestParameters:h,callback:f,cancelled:p}=c;p||(c.cancel=ia(h,f).cancel)}},s=nl(r,(c,h,f)=>{n(),c?e(c):h&&function(p,g){const x=new Blob([new Uint8Array(p)],{type:"image/png"});createImageBitmap(x).then(b=>{g(null,b)}).catch(b=>{g(new Error(`Could not load image because of ${b.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})}(h,(p,g)=>e(p,g,f))});return{cancel:()=>{s.cancel(),n()}}};var wc,ff,Tc,ol={exports:{}},th={exports:{}},pf={exports:{}},sl=function(){if(Tc)return ol.exports;Tc=1;var r=(wc||(wc=1,th.exports=function(t,n){var s,c,h,f,p,g,x,b;for(c=t.length-(s=3&t.length),h=n,p=3432918353,g=461845907,b=0;b<c;)x=255&t.charCodeAt(b)|(255&t.charCodeAt(++b))<<8|(255&t.charCodeAt(++b))<<16|(255&t.charCodeAt(++b))<<24,++b,h=27492+(65535&(f=5*(65535&(h=(h^=x=(65535&(x=(x=(65535&x)*p+(((x>>>16)*p&65535)<<16)&4294967295)<<15|x>>>17))*g+(((x>>>16)*g&65535)<<16)&4294967295)<<13|h>>>19))+((5*(h>>>16)&65535)<<16)&4294967295))+(((f>>>16)+58964&65535)<<16);switch(x=0,s){case 3:x^=(255&t.charCodeAt(b+2))<<16;case 2:x^=(255&t.charCodeAt(b+1))<<8;case 1:h^=x=(65535&(x=(x=(65535&(x^=255&t.charCodeAt(b)))*p+(((x>>>16)*p&65535)<<16)&4294967295)<<15|x>>>17))*g+(((x>>>16)*g&65535)<<16)&4294967295}return h^=t.length,h=2246822507*(65535&(h^=h>>>16))+((2246822507*(h>>>16)&65535)<<16)&4294967295,h=3266489909*(65535&(h^=h>>>13))+((3266489909*(h>>>16)&65535)<<16)&4294967295,(h^=h>>>16)>>>0}
1),th.exports),e=(ff||(ff=1,pf.exports=function(t,n){for(var s,c=t.length,h=n^c,f=0;c>=4;)s=1540483477*(65535&(s=255&t.charCodeAt(f)|(255&t.charCodeAt(++f))<<8|(255&t.charCodeAt(++f))<<16|(255&t.charCodeAt(++f))<<24))+((1540483477*(s>>>16)&65535)<<16),h=1540483477*(65535&h)+((1540483477*(h>>>16)&65535)<<16)^(s=1540483477*(65535&(s^=s>>>24))+((1540483477*(s>>>16)&65535)<<16)),c-=4,++f;switch(c){case 3:h^=(255&t.charCodeAt(f+2))<<16;case 2:h^=(255&t.charCodeAt(f+1))<<8;case 1:h=1540483477*(65535&(h^=255&t.charCodeAt(f)))+((1540483477*(h>>>16)&65535)<<16)}return h=1540483477*(65535&(h^=h>>>13))+((1540483477*(h>>>16)&65535)<<16),(h^=h>>>15)>>>0}),pf.exports);return ol.exports=r,ol.exports.murmur3=r,ol.exports.murmur2=e,ol.exports}(),ra=$o(sl);class Hn{constructor(e,...t){Object.assign(this,t[0]||{}),this.type=e}}class rn extends Hn{constructor(e,t={}){super("error",Object.assign({error:e},t))}}function ih(r,e,t){t[r]&&t[r].indexOf(e)!==-1||(t[r]=t[r]||[],t[r].push(e))}function rh(r,e,t){if(t&&t[r]){const n=t[r].indexOf(e);n!==-1&&t[r].splice(n,1)}}class na{on(e,t){return this._listeners=this._listeners||{},ih(e,t,this._listeners),this}off(e,t){return rh(e,t,this._listeners),rh(e,t,this._oneTimeListeners),this}once(e,t){return t?(this._oneTimeListeners=this._oneTimeListeners||{},ih(e,t,this._oneTimeListeners),this):new Promise(n=>{this.once(e,n)})}fire(e,t){const n=typeof e=="string"?new Hn(e,t):e,s=n.type;if(this.listens(s)){n.target=this;const c=this._listeners&&this._listeners[s]?this._listeners[s].slice():[];for(const p of c)p.call(this,n);const h=this._oneTimeListeners&&this._oneTimeListeners[s]?this._oneTimeListeners[s].slice():[];for(const p of h)rh(s,p,this._oneTimeListeners),p.call(this,n);const f=this._eventedParent;if(f){const p=typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData;Object.assign(n,p),f.fire(n)}}else n instanceof rn&&console.error(n.error);return this}listens(e){return!!(this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e))}setEventedParent(e,t){return this._eventedParent=e,this._eventedParentData=t,this}}class nn{constructor(e){typeof e=="string"?this.name=e:(this.name=e.name,this.iconsetId=e.iconsetId)}static from(e){return new nn(e)}static toString(e){return e.iconsetId?`${e.name}�${e.iconsetId}`:e.name}static parse(e){const[t,n]=e.split("�");return new nn({name:t,iconsetId:n})}static isEqual(e,t){return e.name===t.name&&e.iconsetId===t.iconsetId}toString(){return nn.toString(this)}serialize(){return{name:this.name,iconsetId:this.iconsetId}}}var nh,Sc={},oh=function(){if(nh)return Sc;nh=1;var r={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function e(c){return(c=Math.round(c))<0?0:c>255?255:c}function t(c){return e(c[c.length-1]==="%"?parseFloat(c)/100*255:parseInt(c))}
vendor: 25,187 bytes, line 1
1function n(c){return(h=c[c.length-1]==="%"?parseFloat(c)/100:parseFloat(c))<0?0:h>1?1:h;var h}function s(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{Sc.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 p=f.indexOf("("),g=f.indexOf(")");if(p!==-1&&g+1===f.length){var x=f.substr(0,p),b=f.substr(p+1,g-(p+1)).split(","),w=1;switch(x){case"rgba":if(b.length!==4)return null;w=n(b.pop());case"rgb":return b.length!==3?null:[t(b[0]),t(b[1]),t(b[2]),w];case"hsla":if(b.length!==4)return null;w=n(b.pop());case"hsl":if(b.length!==3)return null;var S=(parseFloat(b[0])%360+360)%360/360,E=n(b[1]),A=n(b[2]),P=A<=.5?A*(E+1):A+E-A*E,R=2*A-P;return[e(255*s(R,P,S+1/3)),e(255*s(R,P,S)),e(255*s(R,P,S-1/3)),w];default:return null}}return null}}catch{}return Sc}();class jt{constructor(e,t,n,s=1){this.r=e,this.g=t,this.b=n,this.a=s}static parse(e){if(!e)return;if(e instanceof jt)return e;if(typeof e!="string")return;const t=oh.parseCSSColor(e);return t?new jt(t[0]/255,t[1]/255,t[2]/255,t[3]):void 0}toString(){const[e,t,n,s]=[this.r,this.g,this.b,this.a];return`rgba(${Math.round(255*e)},${Math.round(255*t)},${Math.round(255*n)},${s})`}toNonPremultipliedRenderColor(e){const{r:t,g:n,b:s,a:c}=this;return new oa(e,t,n,s,c)}toPremultipliedRenderColor(e){const{r:t,g:n,b:s,a:c}=this;return new mf(e,t*c,n*c,s*c,c)}clone(){return new jt(this.r,this.g,this.b,this.a)}}class al{constructor(e,t,n,s,c,h=!1){if(this.premultiplied=!1,this.premultiplied=h,e){const f=e.image.height,p=f*f;this.premultiplied?(t=c===0?0:t/c*(f-1),n=c===0?0:n/c*(f-1),s=c===0?0:s/c*(f-1)):(t*=f-1,n*=f-1,s*=f-1),t=Math.max(0,Math.min(f-1,t)),n=Math.max(0,Math.min(f-1,n)),s=Math.max(0,Math.min(f-1,s));const g=Math.floor(t),x=Math.floor(n),b=Math.floor(s),w=Math.ceil(t),S=Math.ceil(n),E=Math.ceil(s),A=t-g,P=n-x,R=s-b,B=e.image.data,L=4*(g+x*p+b*f),U=4*(g+x*p+E*f),G=4*(g+S*p+b*f),q=4*(g+S*p+E*f),ie=4*(w+x*p+b*f),X=4*(w+x*p+E*f),ee=4*(w+S*p+b*f),Q=4*(w+S*p+E*f);this.r=dt(dt(dt(B[L],B[U],R),dt(B[G],B[q],R),P),dt(dt(B[ie],B[X],R),dt(B[ee],B[Q],R),P),A)/255*(this.premultiplied?c:1),this.g=dt(dt(dt(B[L+1],B[U+1],R),dt(B[G+1],B[q+1],R),P),dt(dt(B[ie+1],B[X+1],R),dt(B[ee+1],B[Q+1],R),P),A)/255*(this.premultiplied?c:1),this.b=dt(dt(dt(B[L+2],B[U+2],R),dt(B[G+2],B[q+2],R),P),dt(dt(B[ie+2],B[X+2],R),dt(B[ee+2],B[Q+2],R),P),A)/255*(this.premultiplied?c:1),this.a=c}else this.r=t,this.g=n,this.b=s,this.a=c}toArray(){const{r:e,g:t,b:n,a:s}=this;return[255*e,255*t,255*n,s]}toHslaArray(){let{r:e,g:t,b:n,a:s}=this;if(this.premultiplied){if(s===0)return[0,0,0,0];const E=1/s;e*=E,t*=E,n*=E}const c=Math.min(Math.max(e,0),1),h=Math.min(Math.max(t,0),1),f=Math.min(Math.max(n,0),1),p=Math.min(c,h,f),g=Math.max(c,h,f),x=g-p,b=.5*(p+g);if(x===0)return[0,0,100*b,s];const w=b>.5?x/(2-g-p):x/(g+p);let S;switch(g){case c:S=60*((h-f)/x+(h<f?6:0));break;case h:S=60*((f-c)/x+2);break;default:S=60*((c-h)/x+4)}return[S,100*w,100*b,s]}toArray01(){const{r:e,g:t,b:n,a:s}=this;return[e,t,n,s]}toArray01Scaled(e){const{r:t,g:n,b:s}=this;return[t*e,n*e,s*e]}toArray01Linear(){const{r:e,g:t,b:n,a:s}=this;return[Math.pow(e,2.2),Math.pow(t,2.2),Math.pow(n,2.2),s]}}class oa extends al{constructor(e,t,n,s,c){super(e,t,n,s,c,!1)}}class mf extends al{constructor(e,t,n,s,c){super(e,t,n,s,c,!0)}}function dt(r,e,t){return r*(1-t)+e*t}function _f(r,e,t){return r.map((n,s)=>dt(n,e[s],t))}jt.black=new jt(0,0,0,1),jt.white=new jt(1,1,1,1),jt.transparent=new jt(0,0,0,0),jt.red=new jt(1,0,0,1),jt.blue=new jt(0,0,1,1);var ll=Object.freeze({__proto__:null,array:_f,color:function(r,e,t){return new jt(dt(r.r,e.r,t),dt(r.g,e.g,t),dt(r.b,e.b,t),dt(r.a,e.a,t))},number:dt});class Hr extends Error{constructor(e,t){super(t),this.message=t,this.key=e}}class sa{constructor(e,t=[]){this.parent=e,this.bindings={};for(const[n,s]of t)this.bindings[n]=s}concat(e){return new sa(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 aa={kind:"null"},at={kind:"number"},Yt={kind:"string"},Kt={kind:"boolean"},Lr={kind:"color"},la={kind:"object"},Ht={kind:"value"},Ic={kind:"collator"},cl={kind:"formatted"},ul={kind:"resolvedImage"};function Fr(r,e){return{kind:"array",itemType:r,N:e}}function tr(r){if(r.kind==="array"){const e=tr(r.itemType);return typeof r.N=="number"?`array<${e}, ${r.N}>`:r.itemType.kind==="value"?"array":`array<${e}>`}return r.kind}const Pm=[aa,at,Yt,Kt,Lr,cl,la,Fr(Ht),ul];function hl(r,e){if(e.kind==="error")return null;if(r.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!hl(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 t of Pm)if(!hl(t,e))return null}}return`Expected ${tr(r)} but found ${tr(e)} instead.`}function Ec(r,e){return e.some(t=>t.kind===r.kind)}function ro(r,e){return e.some(t=>t==="null"?r===null:t==="array"?Array.isArray(r):t==="object"?r&&!Array.isArray(r)&&typeof r=="object":t===typeof r)}function Ac(r,e){return r.kind==="array"&&e.kind==="array"?r.N===e.N&&Ac(r.itemType,e.itemType):r.kind===e.kind}class Cc{constructor(e,t,n){this.sensitivity=e?t?"variant":"case":t?"accent":"base",this.locale=n,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,t){return this.collator.compare(e,t)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class ca{constructor(e,t,n,s,c){this.text=e.normalize?e.normalize():e,this.image=t,this.scale=n,this.fontStack=s,this.textColor=c}}class Vr{constructor(e){this.sections=e}static fromString(e){return new Vr([new ca(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 Vr?e:Vr.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}serialize(){const e=["format"];for(const t of this.sections){if(t.image){const s=t.image.getPrimary().id.toString();e.push(["image",s]);continue}e.push(t.text);const n={};t.fontStack&&(n["text-font"]=["literal",t.fontStack.split(",")]),t.scale&&(n["font-scale"]=t.scale),t.textColor&&(n["text-color"]=["rgba"].concat(t.textColor.toNonPremultipliedRenderColor(null).toArray())),e.push(n)}return e}}class Dn{constructor(e,t={}){this.id=nn.from(e),this.params=t.params,this.sx=t.sx||1,this.sy=t.sy||1}toString(){return JSON.stringify(this)}static parse(e){let t,n,s,c;try{({id:t,params:n,sx:s,sy:c}=JSON.parse(e)||{})}catch{return null}return t?new Dn(t,{params:n,sx:s,sy:c}):null}scaleSelf(e,t=e){return this.sx*=e,this.sy*=t,this}}class Zr{constructor(e,t,n,s,c=!1){this.primaryId=nn.from(e),this.primaryOptions=t,n&&(this.secondaryId=nn.from(n)),this.secondaryOptions=s,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 Dn(this.primaryId,this.primaryOptions)}hasSecondary(){return!!this.secondaryId}getSecondary(){return this.secondaryId?new Dn(this.secondaryId,this.secondaryOptions):null}static from(e){return typeof e=="string"?Zr.build({name:e}):e}static build(e,t,n,s){return!e||typeof e=="object"&&!("name"in e)?null:new Zr(e,n,t,s)}}function gf(r,e,t,n){return typeof r=="number"&&r>=0&&r<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof t=="number"&&t>=0&&t<=255?n===void 0||typeof n=="number"&&n>=0&&n<=1?null:`Invalid rgba value [${[r,e,t,n].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof n=="number"?[r,e,t,n]:[r,e,t]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Rn(r){if(r===null||typeof r=="string"||typeof r=="boolean"||typeof r=="number"||r instanceof jt||r instanceof Cc||r instanceof Vr||r instanceof Zr)return!0;if(Array.isArray(r)){for(const e of r)if(!Rn(e))return!1;return!0}if(typeof r=="object"){for(const e in r)if(!Rn(r[e]))return!1;return!0}return!1}function ct(r){if(r===null)return aa;if(typeof r=="string")return Yt;if(typeof r=="boolean")return Kt;if(typeof r=="number")return at;if(r instanceof jt)return Lr;if(r instanceof Cc)return Ic;if(r instanceof Vr)return cl;if(r instanceof Zr)return ul;if(Array.isArray(r)){const e=r.length;let t;for(const n of r){const s=ct(n);if(t){if(t===s)continue;t=Ht;break}t=s}return Fr(t||Ht,e)}return la}function rt(r){const e=typeof r;return r===null?"":e==="string"||e==="number"||e==="boolean"?String(r):r instanceof Vr||r instanceof Zr||r instanceof jt?r.toString():JSON.stringify(r)}class Zn{constructor(e,t){this.type=e,this.value=t}static parse(e,t){if(e.length!==2)return t.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!Rn(e[1]))return t.error("invalid value");const n=e[1];let s=ct(n);const c=t.expectedType;return s.kind!=="array"||s.N!==0||!c||c.kind!=="array"||typeof c.N=="number"&&c.N!==0||(s=c),new Zn(s,n)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}serialize(){return this.type.kind==="array"||this.type.kind==="object"?["literal",this.value]:this.value instanceof jt?["rgba"].concat(this.value.toNonPremultipliedRenderColor(null).toArray()):this.value instanceof Vr?this.value.serialize():this.value}}class st{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}}const dl={string:Yt,number:at,boolean:Kt,object:la};class mn{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");let n,s=1;const c=e[0];if(c==="array"){let f,p;if(e.length>2){const g=e[1];if(typeof g!="string"||!(g in dl)||g==="object")return t.error('The item type argument of "array" must be one of string, number, boolean',1);f=dl[g],s++}else f=Ht;if(e.length>3){if(e[2]!==null&&(typeof e[2]!="number"||e[2]<0||e[2]!==Math.floor(e[2])))return t.error('The length argument to "array" must be a positive integer literal',2);p=e[2],s++}n=Fr(f,p)}else n=dl[c];const h=[];for(;s<e.length;s++){const f=t.parse(e[s],s,Ht);if(!f)return null;h.push(f)}return new mn(n,h)}evaluate(e){for(let t=0;t<this.args.length;t++){const n=this.args[t].evaluate(e);if(!hl(this.type,ct(n)))return n;if(t===this.args.length-1)throw new st(`The expression ${JSON.stringify(this.args[t].serialize())} evaluated to ${tr(ct(n))} but was expected to be of type ${tr(this.type)}.`)}return null}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}serialize(){const e=this.type,t=[e.kind];if(e.kind==="array"){const n=e.itemType;if(n.kind==="string"||n.kind==="number"||n.kind==="boolean"){t.push(n.kind);const s=e.N;(typeof s=="number"||this.args.length>1)&&t.push(s)}}return t.concat(this.args.map(n=>n.serialize()))}}class pt{constructor(e){this.type=cl,this.sections=e}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");const n=e[1];if(!Array.isArray(n)&&typeof n=="object")return t.error("First argument must be an image or text section.");const s=[];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 p=null;if(f["font-scale"]&&(p=t.parseObjectValue(f["font-scale"],h,"font-scale",at),!p))return null;let g=null;if(f["text-font"]&&(g=t.parseObjectValue(f["text-font"],h,"text-font",Fr(Yt)),!g))return null;let x=null;if(f["text-color"]&&(x=t.parseObjectValue(f["text-color"],h,"text-color",Lr),!x))return null;const b=s[s.length-1];b.scale=p,b.font=g,b.textColor=x}else{const p=t.parse(e[h],h,Ht);if(!p)return null;const g=p.type.kind;if(g!=="string"&&g!=="value"&&g!=="null"&&g!=="resolvedImage")return t.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");c=!0,s.push({content:p,scale:null,font:null,textColor:null})}}return new pt(s)}evaluate(e){return new Vr(this.sections.map(t=>{const n=t.content.evaluate(e);return Ac(ct(n),ul)?new ca("",n,null,null,null):new ca(rt(n),null,t.scale?t.scale.evaluate(e):null,t.font?t.font.evaluate(e).join(","):null,t.textColor?t.textColor.evaluate(e):null)}))}eachChild(e){for(const t of this.sections)e(t.content),t.scale&&e(t.scale),t.font&&e(t.font),t.textColor&&e(t.textColor)}outputDefined(){return!1}serialize(){const e=["format"];for(const t of this.sections){e.push(t.content.serialize());const n={};t.scale&&(n["font-scale"]=t.scale.serialize()),t.font&&(n["text-font"]=t.font.serialize()),t.textColor&&(n["text-color"]=t.textColor.serialize()),e.push(n)}return e}}class fl{constructor(e,t,n,s){this._imageWarnHistory={},this.type=ul,this.namePrimary=e,this.nameSecondary=t,n&&(this.paramsPrimary=n.params,this.iconsetIdPrimary=n.iconset?n.iconset.id:void 0),s&&(this.paramsSecondary=s.params,this.iconsetIdSecondary=s.iconset?s.iconset.id:void 0)}static parse(e,t){if(e.length<2)return t.error("Expected two or more arguments.");let n=1;const s=[];function c(){if(n<e.length){const f=t.parse(e[n],n++,Yt);return f?(s.push({image:f,options:{}}),!0):(t.error(s.length?"Secondary image variant is not a string.":"No image name provided."),!1)}return!0}function h(){if(n<e.length){const p=e[n];if((f=p)===null||typeof f!="object"||Array.isArray(f))return!0;const g=p.params,x=p.iconset,b=t.concat(n);if(!g&&!x)return n++,!0;if(g){if(typeof g!="object"||g.constructor!==Object)return b.error('Image options "params" should be an object'),!1;const w={},S=b.concat(void 0,"params");for(const E in g){if(!E)return S.error("Image parameter name should be non-empty"),!1;const A=S.concat(void 0,E).parse(g[E],void 0,Lr,void 0,{typeAnnotation:"coerce"});if(!A)return!1;w[E]=A}s[s.length-1].options.params=w}if(x){if(typeof x!="object"||x.constructor!==Object)return b.error('Image options "iconset" should be an object'),!1;if(!x.id)return b.error('Image options "iconset" should have an "id" property'),!1;s[s.length-1].options.iconset=x}return n++,!0}var f;return!0}for(let f=0;f<2;f++)if(!c()||!h())return;return new fl(s[0].image,s[1]?s[1].image:void 0,s[0].options,s[1]?s[1].options:void 0)}evaluateParams(e,t){const n={};if(t){for(const s in t)if(t[s])try{n[s]=t[s].evaluate(e)}catch{continue}if(Object.keys(n).length!==0)return{params:n}}}evaluate(e){const t={name:this.namePrimary.evaluate(e),iconsetId:this.iconsetIdPrimary},n=this.nameSecondary?{name:this.nameSecondary.evaluate(e),iconsetId:this.iconsetIdSecondary}:void 0,s=Zr.build(t,n,this.paramsPrimary?this.evaluateParams(e,this.paramsPrimary):void 0,this.paramsSecondary?this.evaluateParams(e,this.paramsSecondary):void 0);if(s&&e.availableImages){const c=s.getPrimary().id;if(s.available=e.availableImages.some(h=>nn.isEqual(h,c)),s.available){const h=s.getSecondary()?s.getSecondary().id:null;h&&(s.available=e.availableImages.some(f=>nn.isEqual(f,h)))}}return s}eachChild(e){if(e(this.namePrimary),this.paramsPrimary)for(const t in this.paramsPrimary)this.paramsPrimary[t]&&e(this.paramsPrimary[t]);if(this.nameSecondary&&(e(this.nameSecondary),this.paramsSecondary))for(const t in this.paramsSecondary)this.paramsSecondary[t]&&e(this.paramsSecondary[t])}outputDefined(){return!1}serializeOptions(e,t){const n={};if(t&&(n.iconset={id:t}),e){n.params={};for(const s in e)e[s]&&(n.params[s]=e[s].serialize())}return Object.keys(n).length>0?n:void 0}serialize(){const e=["image",this.namePrimary.serialize()];if(this.paramsPrimary||this.iconsetIdPrimary){const t=this.serializeOptions(this.paramsPrimary,this.iconsetIdPrimary);t&&e.push(t)}if(this.nameSecondary&&(e.push(this.nameSecondary.serialize()),this.paramsSecondary||this.iconsetIdSecondary)){const t=this.serializeOptions(this.paramsSecondary,this.iconsetIdSecondary);t&&e.push(t)}return e}}function ua(r){return Mc(r)?"string":Es(r)?"number":yf(r)?"boolean":Array.isArray(r)?"array":r===null?"null":sh(r)?"object":typeof r}function sh(r){return r!=null&&!Array.isArray(r)&&typeof r!="function"&&!(r instanceof String||r instanceof Number||r instanceof Boolean)&&typeof r=="object"}function Mc(r){return typeof r=="string"||r instanceof String}function Es(r){return typeof r=="number"||r instanceof Number}function yf(r){return typeof r=="boolean"||r instanceof Boolean}const ah={"to-boolean":Kt,"to-color":Lr,"to-number":at,"to-string":Yt};class Wr{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");const n=e[0],s=[];let c=aa;if(n==="to-array"){if(!Array.isArray(e[1]))return null;const h=e[1].length;if(t.expectedType){if(t.expectedType.kind!=="array")return t.error(`Expected ${t.expectedType.kind} but found array.`);c=Fr(t.expectedType.itemType,h)}else{if(!(h>0&&Rn(e[1][0])))return null;c=Fr(ct(e[1][0]),h)}for(let f=0;f<h;f++){const p=e[1][f];let g;if(Array.isArray(p))g=t.parse(p,void 0,c.itemType);else{const x=ua(p);if(x!==c.itemType.kind)return t.error(`Expected ${c.itemType.kind} but found ${x}.`);g=t.registry.literal.parse(["literal",p===void 0?null:p],t)}if(!g)return null;s.push(g)}}else{if((n==="to-boolean"||n==="to-string")&&e.length!==2)return t.error("Expected one argument.");c=ah[n];for(let h=1;h<e.length;h++){const f=t.parse(e[h],h,Ht);if(!f)return null;s.push(f)}}return new Wr(c,s)}evaluate(e){if(this.type.kind==="boolean")return!!this.args[0].evaluate(e);if(this.type.kind==="color"){let t,n;for(const s of this.args){if(t=s.evaluate(e),n=null,t instanceof jt)return t;if(typeof t=="string"){const c=e.parseColor(t);if(c)return c}else if(Array.isArray(t)&&(n=t.length<3||t.length>4?`Invalid rbga value ${JSON.stringify(t)}: expected an array containing either three or four numeric values.`:gf(t[0],t[1],t[2],t[3]),!n))return new jt(t[0]/255,t[1]/255,t[2]/255,t[3])}throw new st(n||`Could not parse color from value '${typeof t=="string"?t:String(JSON.stringify(t))}'`)}if(this.type.kind==="number"){let t=null;for(const n of this.args){if(t=n.evaluate(e),t===null)return 0;const s=Number(t);if(!isNaN(s))return s}throw new st(`Could not convert ${JSON.stringify(t)} to number.`)}return this.type.kind==="formatted"?Vr.fromString(rt(this.args[0].evaluate(e))):this.type.kind==="resolvedImage"?Zr.build(rt(this.args[0].evaluate(e))):this.type.kind==="array"?this.args.map(t=>t.evaluate(e)):rt(this.args[0].evaluate(e))}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}serialize(){if(this.type.kind==="formatted")return new pt([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if(this.type.kind==="resolvedImage")return new fl(this.args[0]).serialize();const e=this.type.kind==="array"?[]:[`to-${this.type.kind}`];return this.eachChild(t=>{e.push(t.serialize())}),e}}const lh=["Unknown","Point","LineString","Polygon"];class no{constructor(e,t,n){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null,this.featureTileCoord=null,this.featureDistanceData=null,this.scope=e,this.options=t,this.iconImageUseTheme=n}id(){return this.feature&&this.feature.id!==void 0?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?lh[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}measureLight(e){return this.globals.brightness||0}distanceFromCenter(){if(this.featureTileCoord&&this.featureDistanceData){const e=this.featureDistanceData.center,t=this.featureDistanceData.scale,{x:n,y:s}=this.featureTileCoord;return this.featureDistanceData.bearing[0]*(n*t-e[0])+this.featureDistanceData.bearing[1]*(s*t-e[1])}return 0}parseColor(e){let t=this._parseColorCache[e];return t||(t=this._parseColorCache[e]=jt.parse(e)),t}getConfig(e){return this.options?this.options.get(e):null}}class lr{constructor(e,t,n,s,c){this.name=e,this.type=t,this._evaluate=n,this.args=s,this._overloadIndex=c}evaluate(e){if(!this._evaluate){const t=lr.definitions[this.name];this._evaluate=Array.isArray(t)?t[2]:t.overloads[this._overloadIndex][1]}return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}serialize(){return[this.name].concat(this.args.map(e=>e.serialize()))}static parse(e,t){const n=e[0],s=lr.definitions[n];if(!s)return t.error(`Unknown expression "${n}". If you wanted a literal array, use ["literal", [...]].`,0);const c=Array.isArray(s)?s[0]:s.type,h=Array.isArray(s)?[[s[1],s[2]]]:s.overloads,f=[];let p=null,g=-1;for(const[x,b]of h){if(Array.isArray(x)&&x.length!==e.length-1)continue;f.push(x),g++,p=new Nc(t.registry,t.path,null,t.scope,void 0,t._scope,t.options,t.iconImageUseTheme);const w=[];let S=!1;for(let E=1;E<e.length;E++){const A=e[E],P=Array.isArray(x)?x[E-1]:x.type,R=p.parse(A,1+w.length,P);if(!R){S=!0;break}w.push(R)}if(!S)if(Array.isArray(x)&&x.length!==w.length)p.error(`Expected ${x.length} arguments, but found ${w.length} instead.`);else{for(let E=0;E<w.length;E++){const A=Array.isArray(x)?x[E]:x.type,P=w[E];p.concat(E+1).checkSubtype(A,P.type)}if(p.errors.length===0)return new lr(n,c,b,w,g)}}if(f.length===1)t.errors.push(...p.errors);else{const x=(f.length?f:h.map(([w])=>w)).map(Dm).join(" | "),b=[];for(let w=1;w<e.length;w++){const S=t.parse(e[w],1+b.length);if(!S)return null;b.push(tr(S.type))}t.error(`Expected arguments of type ${x}, but found (${b.join(", ")}) instead.`)}return null}static register(e,t){lr.definitions=t;for(const n in t)e[n]=lr}}function Dm(r){return Array.isArray(r)?`(${r.map(tr).join(", ")})`:`(${tr(r.type)}...)`}class Pc{constructor(e,t,n){this.type=Ic,this.locale=n,this.caseSensitive=e,this.diacriticSensitive=t}static parse(e,t){if(e.length!==2)return t.error("Expected one argument."),null;const n=e[1];if(typeof n!="object"||Array.isArray(n))return t.error("Collator options argument must be an object."),null;const s=n["case-sensitive"]===void 0?t.parse(!1,1,Kt):t.parseObjectValue(n["case-sensitive"],1,"case-sensitive",Kt);if(!s)return null;const c=n["diacritic-sensitive"]===void 0?t.parse(!1,1,Kt):t.parseObjectValue(n["diacritic-sensitive"],1,"diacritic-sensitive",Kt);if(!c)return null;let h=null;return n.locale&&(h=t.parseObjectValue(n.locale,1,"locale",Yt),!h)?null:new Pc(s,c,h)}evaluate(e){return new Cc(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 xf(r,e,t=0,n=r.length-1,s=vf){for(;n>t;){if(n-t>600){const p=n-t+1,g=e-t+1,x=Math.log(p),b=.5*Math.exp(2*x/3),w=.5*Math.sqrt(x*b*(p-b)/p)*(g-p/2<0?-1:1);xf(r,e,Math.max(t,Math.floor(e-g*b/p+w)),Math.min(n,Math.floor(e+(p-g)*b/p+w)),s)}const c=r[e];let h=t,f=n;for(Wo(r,t,e),s(r[n],c)>0&&Wo(r,t,n);h<f;){for(Wo(r,h,f),h++,f--;s(r[h],c)<0;)h++;for(;s(r[f],c)>0;)f--}s(r[t],c)===0?Wo(r,t,f):(f++,Wo(r,f,n)),f<=e&&(t=f+1),e<=f&&(n=f-1)}}function Wo(r,e,t){const n=r[e];r[e]=r[t],r[t]=n}function vf(r,e){return r<e?-1:r>e?1:0}function As(r){let e=0;for(let t,n,s=0,c=r.length,h=c-1;s<c;h=s++)t=r[s],n=r[h],e+=(n.x-t.x)*(t.y+n.y);return e}function pl(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 ml(r,e){return!(r[0]<=e[0]||r[2]>=e[2]||r[1]<=e[1]||r[3]>=e[3])}function ch(r,e,t){const n=r[0]-e[0],s=r[1]-e[1],c=r[0]-t[0],h=r[1]-t[1];return n*h-c*s===0&&n*c<=0&&s*h<=0}function Rm(r,e,t){return e[1]>r[1]!=t[1]>r[1]&&r[0]<(t[0]-e[0])*(r[1]-e[1])/(t[1]-e[1])+e[0]}function ha(r,e,t=!1){let n=!1;for(let s=0,c=e.length;s<c;s++){const h=e[s];for(let f=0,p=h.length,g=p-1;f<p;g=f++){const x=h[g],b=h[f];if(ch(r,x,b))return t;Rm(r,x,b)&&(n=!n)}}return n}function uh(r,e,t,n){const s=n[0]-t[0],c=n[1]-t[1],h=(r[0]-t[0])*c-s*(r[1]-t[1]),f=(e[0]-t[0])*c-s*(e[1]-t[1]);return h>0&&f<0||h<0&&f>0}function Dc(r,e,t,n){return(s=[n[0]-t[0],n[1]-t[1]])[0]*(c=[e[0]-r[0],e[1]-r[1]])[1]-s[1]*c[0]!==0&&!(!uh(r,e,t,n)||!uh(t,n,r,e));var s,c}function hh(r){const e=new Fe(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),t=new Fe(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);for(const n of r[0])e.x>n.x&&(e.x=n.x),e.y>n.y&&(e.y=n.y),t.x<n.x&&(t.x=n.x),t.y<n.y&&(t.y=n.y);return{min:e,max:t}}const Xo=8192;function Cs(r,e){const t=(180+r[0])/360,n=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r[1]*Math.PI/360)))/360,s=Math.pow(2,e.z);return[Math.round(t*s*Xo),Math.round(n*s*Xo)]}function zm(r,e){for(let t=0;t<e.length;t++)if(ha(r,e[t]))return!0;return!1}function Lm(r,e,t){for(const n of t)for(let s=0,c=n.length,h=c-1;s<c;
1h=s++)if(Dc(r,e,n[h],n[s]))return!0;return!1}function Rc(r,e){for(let t=0;t<r.length;++t)if(!ha(r[t],e))return!1;for(let t=0;t<r.length-1;++t)if(Lm(r[t],r[t+1],e))return!1;return!0}function bf(r,e){for(let t=0;t<e.length;t++)if(Rc(r,e[t]))return!0;return!1}function zc(r,e,t){const n=[];for(let s=0;s<r.length;s++){const c=[];for(let h=0;h<r[s].length;h++){const f=Cs(r[s][h],t);pl(e,f),c.push(f)}n.push(c)}return n}function zn(r,e,t){const n=[];for(let s=0;s<r.length;s++){const c=zc(r[s],e,t);n.push(c)}return n}function dh(r,e,t,n){if(r[0]<t[0]||r[0]>t[2]){const s=.5*n;let c=r[0]-t[0]>s?-n:t[0]-r[0]>s?n:0;c===0&&(c=r[0]-t[2]>s?-n:t[2]-r[0]>s?n:0),r[0]+=c}pl(e,r)}function fh(r,e,t,n){const s=Math.pow(2,n.z)*Xo,c=[n.x*Xo,n.y*Xo],h=[];if(!r)return h;for(const f of r)for(const p of f){const g=[p.x+c[0],p.y+c[1]];dh(g,e,t,s),h.push(g)}return h}function ph(r,e,t,n){const s=Math.pow(2,n.z)*Xo,c=[n.x*Xo,n.y*Xo],h=[];if(!r)return h;for(const p of r){const g=[];for(const x of p){const b=[x.x+c[0],x.y+c[1]];pl(e,b),g.push(b)}h.push(g)}if(e[2]-e[0]<=s/2){(f=e)[0]=f[1]=1/0,f[2]=f[3]=-1/0;for(const p of h)for(const g of p)dh(g,e,t,s)}var f;return h}class Yo{constructor(e,t){this.type=Kt,this.geojson=e,this.geometries=t}static parse(e,t){if(e.length!==2)return t.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(Rn(e[1])){const n=e[1];if(n.type==="FeatureCollection")for(let s=0;s<n.features.length;++s){const c=n.features[s].geometry.type;if(c==="Polygon"||c==="MultiPolygon")return new Yo(n,n.features[s].geometry)}else if(n.type==="Feature"){const s=n.geometry.type;if(s==="Polygon"||s==="MultiPolygon")return new Yo(n,n.geometry)}else if(n.type==="Polygon"||n.type==="MultiPolygon")return new Yo(n,n)}return t.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(t,n){const s=[1/0,1/0,-1/0,-1/0],c=[1/0,1/0,-1/0,-1/0],h=t.canonicalID();if(!h)return!1;if(n.type==="Polygon"){const f=zc(n.coordinates,c,h),p=fh(t.geometry(),s,c,h);if(!ml(s,c))return!1;for(const g of p)if(!ha(g,f))return!1}if(n.type==="MultiPolygon"){const f=zn(n.coordinates,c,h),p=fh(t.geometry(),s,c,h);if(!ml(s,c))return!1;for(const g of p)if(!zm(g,f))return!1}return!0}(e,this.geometries);if(e.geometryType()==="LineString")return function(t,n){const s=[1/0,1/0,-1/0,-1/0],c=[1/0,1/0,-1/0,-1/0],h=t.canonicalID();if(!h)return!1;if(n.type==="Polygon"){const f=zc(n.coordinates,c,h),p=ph(t.geometry(),s,c,h);if(!ml(s,c))return!1;for(const g of p)if(!Rc(g,f))return!1}if(n.type==="MultiPolygon"){const f=zn(n.coordinates,c,h),p=ph(t.geometry(),s,c,h);if(!ml(s,c))return!1;for(const g of p)if(!bf(g,f))return!1}return!0}(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}serialize(){return["within",this.geojson]}}const _l={kilometers:1,miles:1e3/1609.344,nauticalmiles:1e3/1852,meters:1e3,metres:1e3,yards:1e3/.9144,feet:1e3/.3048,inches:1e3/.0254},mh=1/298.257223563,_h=mh*(2-mh),da=Math.PI/180;class fa{static fromTile(e,t,n){const s=Math.PI*(1-2*(e+.5)/Math.pow(2,t)),c=Math.atan(.5*(Math.exp(s)-Math.exp(-s)))/da;return new fa(c,n)}static get units(){return _l}constructor(e,t){if(e===void 0)throw new Error("No latitude given.");if(t&&!_l[t])throw new Error(`Unknown unit ${t}. Use one of: ${Object.keys(_l).join(", ")}`);const n=6378.137*da*(t?_l[t]:1),s=Math.cos(e*da),c=1/(1-_h*(1-s*s)),h=Math.sqrt(c);this.kx=n*h*s,this.ky=n*h*c*(1-_h)}distance(e,t){const n=_n(e[0]-t[0])*this.kx,s=(e[1]-t[1])*this.ky;return Math.sqrt(n*n+s*s)}bearing(e,t){const n=_n(t[0]-e[0])*this.kx;return Math.atan2(n,(t[1]-e[1])*this.ky)/da}destination(e,t,n){const s=n*da;return this.offset(e,Math.sin(s)*t,Math.cos(s)*t)}offset(e,t,n){return[e[0]+t/this.kx,e[1]+n/this.ky]}lineDistance(e){let t=0;for(let n=0;n<e.length-1;n++)t+=this.distance(e[n],e[n+1]);return t}area(e){let t=0;for(let n=0;n<e.length;n++){const s=e[n];for(let c=0,h=s.length,f=h-1;c<h;f=c++)t+=_n(s[c][0]-s[f][0])*(s[c][1]+s[f][1])*(n?-1:1)}return Math.abs(t)/2*this.kx*this.ky}along(e,t){let n=0;if(t<=0)return e[0];for(let s=0;s<e.length-1;s++){const c=e[s],h=e[s+1],f=this.distance(c,h);if(n+=f,n>t)return Lc(c,h,(t-(n-f))/f)}return e[e.length-1]}pointToSegmentDistance(e,t,n){let[s,c]=t,h=_n(n[0]-s)*this.kx,f=(n[1]-c)*this.ky;if(h!==0||f!==0){const p=(_n(e[0]-s)*this.kx*h+(e[1]-c)*this.ky*f)/(h*h+f*f);p>1?(s=n[0],c=n[1]):p>0&&(s+=h/this.kx*p,c+=f/this.ky*p)}return h=_n(e[0]-s)*this.kx,f=(e[1]-c)*this.ky,Math.sqrt(h*h+f*f)}pointOnLine(e,t){let n=1/0,s=e[0][0],c=e[0][1],h=0,f=0;for(let p=0;p<e.length-1;p++){let g=e[p][0],x=e[p][1],b=_n(e[p+1][0]-g)*this.kx,w=(e[p+1][1]-x)*this.ky,S=0;b===0&&w===0||(S=(_n(t[0]-g)*this.kx*b+(t[1]-x)*this.ky*w)/(b*b+w*w),S>1?(g=e[p+1][0],x=e[p+1][1]):S>0&&(g+=b/this.kx*S,x+=w/this.ky*S)),b=_n(t[0]-g)*this.kx,w=(t[1]-x)*this.ky;const E=b*b+w*w;E<n&&(n=E,s=g,c=x,h=p,f=S)}return{point:[s,c],index:h,t:Math.max(0,Math.min(1,f))}}lineSlice(e,t,n){let s=this.pointOnLine(n,e),c=this.pointOnLine(n,t);if(s.index>c.index||s.index===c.index&&s.t>c.t){const g=s;s=c,c=g}const h=[s.point],f=s.index+1,p=c.index;!gh(n[f],h[0])&&f<=p&&h.push(n[f]);for(let g=f+1;g<=p;g++)h.push(n[g]);return gh(n[p],c.point)||h.push(c.point),h}lineSliceAlong(e,t,n){let s=0;const c=[];for(let h=0;h<n.length-1;h++){const f=n[h],p=n[h+1],g=this.distance(f,p);if(s+=g,s>
1e&&c.length===0&&c.push(Lc(f,p,(e-(s-g))/g)),s>=t)return c.push(Lc(f,p,(t-(s-g))/g)),c;s>e&&c.push(p)}return c}bufferPoint(e,t){const n=t/this.ky,s=t/this.kx;return[e[0]-s,e[1]-n,e[0]+s,e[1]+n]}bufferBBox(e,t){const n=t/this.ky,s=t/this.kx;return[e[0]-s,e[1]-n,e[2]+s,e[3]+n]}insideBBox(e,t){return _n(e[0]-t[0])>=0&&_n(e[0]-t[2])<=0&&e[1]>=t[1]&&e[1]<=t[3]}}function gh(r,e){return r[0]===e[0]&&r[1]===e[1]}function Lc(r,e,t){const n=_n(e[0]-r[0]);return[r[0]+n*t,r[1]+(e[1]-r[1])*t]}function _n(r){for(;r<-180;)r+=360;for(;r>180;)r-=360;return r}class gl{constructor(e=[],t=(n,s)=>n<s?-1:n>s?1:0){if(this.data=e,this.length=this.data.length,this.compare=t,this.length>0)for(let n=(this.length>>1)-1;n>=0;n--)this._down(n)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(this.length===0)return;const e=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:t,compare:n}=this,s=t[e];for(;e>0;){const c=e-1>>1,h=t[c];if(n(s,h)>=0)break;t[e]=h,e=c}t[e]=s}_down(e){const{data:t,compare:n}=this,s=this.length>>1,c=t[e];for(;e<s;){let h=1+(e<<1);const f=h+1;if(f<this.length&&n(t[f],t[h])<0&&(h=f),n(t[h],c)>=0)break;t[e]=t[h],e=h}t[e]=c}}var Ze=8192;function wf(r,e){return e.dist-r.dist}function yl(r){const e=[1/0,1/0,-1/0,-1/0];if(e.length!==r.length)return!1;for(let t=0;t<e.length;t++)if(e[t]!==r[t])return!1;return!0}function pa(r){return r[1]-r[0]+1}function Ln(r,e){const t=r[1]>=r[0]&&r[1]<e;return t||console.warn("Distance Expression: Index is out of range"),t}function Fc(r,e){if(r[0]>r[1])return[null,null];const t=pa(r);if(e){if(t===2)return[r,null];const n=Math.floor(t/2);return[[r[0],r[0]+n],[r[0]+n,r[1]]]}{if(t===1)return[r,null];const n=Math.floor(t/2)-1;return[[r[0],r[0]+n],[r[0]+n+1,r[1]]]}}function Ko(r,e){const t=[1/0,1/0,-1/0,-1/0];if(!Ln(e,r.length))return t;for(let n=e[0];n<=e[1];++n)pl(t,r[n]);return t}function Oc(r){const e=[1/0,1/0,-1/0,-1/0];for(let t=0;t<r.length;++t)for(let n=0;n<r[t].length;++n)pl(e,r[t][n]);return e}function ma(r,e,t){if(yl(r)||yl(e))return NaN;let n=0,s=0;return r[2]<e[0]&&(n=e[0]-r[2]),r[0]>e[2]&&(n=r[0]-e[2]),r[1]>e[3]&&(s=r[1]-e[3]),r[3]<e[1]&&(s=e[1]-r[3]),t.distance([0,0],[n,s])}function Tf(r){return 360*r-180}function _a(r){return 360/Math.PI*Math.atan(Math.exp((180-360*r)*Math.PI/180))-90}function xl(r,e,t=8192){const n=Math.pow(2,e.z),s=(r.y/t+e.y)/n;return[Tf((r.x/t+e.x)/n),_a(s)]}function Lt(r,e){const t=[];for(let n=0;n<r.length;++n)t.push(xl(r[n],e));return t}function Sf(r,e,t){const n=t.pointOnLine(e,r).point;return t.distance(r,n)}function If(r,e,t,n,s){const c=t.slice(n[0],n[1]+1);let h=1/0;for(let f=e[0];f<=e[1];++f)if((h=Math.min(h,Sf(r[f],c,s)))===0)return 0;return h}function yh(r,e,t,n,s){const c=Math.min(s.pointToSegmentDistance(r,t,n),s.pointToSegmentDistance(e,t,n)),h=Math.min(s.pointToSegmentDistance(t,r,e),s.pointToSegmentDistance(n,r,e));return Math.min(c,h)}function Ef(r,e,t,n,s){if(!Ln(e,r.length)||!Ln(n,t.length))return NaN;let c=1/0;for(let h=e[0];h<e[1];++h)for(let f=n[0];f<n[1];++f){if(Dc(r[h],r[h+1],t[f],t[f+1]))return 0;c=Math.min(c,yh(r[h],r[h+1],t[f],t[f+1],s))}return c}function Fm(r,e,t,n,s){if(!Ln(e,r.length)||!Ln(n,t.length))return NaN;let c=1/0;for(let h=e[0];h<=e[1];++h)for(let f=n[0];f<=n[1];++f)if((c=Math.min(c,s.distance(r[h],t[f])))===0)return c;return c}function Ai(r,e,t){if(ha(r,e,!0))return 0;let n=1/0;for(const s of e){const c=s.length;if(c<2)return console.warn("Distance Expression: Invalid polygon!"),NaN;if(s[0]!==s[c-1]&&(n=Math.min(n,t.pointToSegmentDistance(r,s[c-1],s[0])))===0||(n=Math.min(n,Sf(r,s,t)))===0)return n}return n}function Om(r,e,t,n){if(!Ln(e,r.length))return NaN;for(let c=e[0];c<=e[1];++c)if(ha(r[c],t,!0))return 0;let s=1/0;for(let c=e[0];c<e[1];++c)for(const h of t)for(let f=0,p=h.length,g=p-1;f<p;g=f++){if(Dc(r[c],r[c+1],h[g],h[f]))return 0;s=Math.min(s,yh(r[c],r[c+1],h[g],h[f],n))}return s}function Af(r,e){for(const t of r)for(let n=0;n<=t.length-1;++n)if(ha(t[n],e,!0))return!0;return!1}function Bm(r,e,t,n=1/0){const s=Oc(r),c=Oc(e);if(n!==1/0&&ma(s,c,t)>=n)return n;if(ml(s,c)){if(Af(r,e))return 0}else if(Af(e,r))return 0;let h=n;for(const f of r)for(let p=0,g=f.length,x=g-1;p<g;x=p++)for(const b of e)for(let w=0,S=b.length,E=S-1;w<S;E=w++){if(Dc(f[x],f[p],b[E],b[w]))return 0;h=Math.min(h,yh(f[x],f[p],b[E],b[w],t))}return h}function Bc(r,e,t,n,s,c,h){if(c===null||h===null)return;const f=ma(Ko(n,c),Ko(s,h),t);f<e&&r.push({dist:f,range1:c,range2:h})}function km(r,e,t,n,s=1/0){let c=Math.min(n.distance(r[0],t[0][0]),s);if(c===0)return c;const h=new gl([{dist:0,range1:[0,r.length-1],range2:[0,0]}],wf),f=e?50:100,p=Oc(t);for(;h.length;){const g=h.pop();if(g.dist>=c)continue;const x=g.range1;if(pa(x)<=f){if(!Ln(x,r.length))return NaN;if(e){const b=Om(r,x,t,n);if((c=Math.min(c,b))===0)return c}else for(let b=x[0];b<=x[1];++b){const w=Ai(r[b],t,n);if((c=Math.min(c,w))===0)return c}}else{const b=Fc(x,e);if(b[0]!==null){const w=ma(Ko(r,b[0]),p,n);w<c&&h.push({dist:w,range1:b[0],range2:[0,0]})}if(b[1]!==null){const w=ma(Ko(r,b[1]),p,n);w<c&&h.push({dist:w,range1:b[1],range2:[0,0]})}}}return c}function Cf(r,e,t,n,s,c=1/0){let h=Math.min(c,s.distance(r[0],t[0]));if(h===0)return h;const f=new gl([{dist:0,range1:[0,r.length-1],range2:[0,t.length-1]}],wf),p=e?50:100,g=n?50:100;for(;f.length;){const x=f.pop();if(x.dist>=h)continue;const b=x.range1,w=x.range2;if(pa(b)<=p&&pa(w)<=g){if(!Ln(b,r.length)||!Ln(w,t.length))return NaN;if(e&&n?h=Math.min(h,Ef(r,b,t,w,s)):e||n?e&&!n?h=Math.min(h,If(t,w,r,b,s)):!e&&n&&(h=Math.min(h,If(r,b,t,w,s))):h=Math.min(h,Fm(r,b,t,w,s)),h===0)return h}else{const S=Fc(b,e),E=Fc(w,n);Bc(f,h,s,r,t,S[0],E[0]),Bc(f,h,s,r,t,S[0],E[1]),Bc(f,h,s,r,t,S[1],E[0]),Bc(f,h,s,r,t,S[1],E[1])}}return h}function xh(r,e,t,n,s=1/0){let c=s;const h=Ko(r,[0,r.length-1]);for(const f of t)if(!(c!==1/0&&ma(h,Ko(f,[0,f.length-1]),n)>=c)&&(c=Math.min(c,Cf(r,e,f,!0,n,c)),c===0))return c;return c}function kc(r,e,t,n,s=1/0){let c=s;const h=Ko(r,[0,r.length-1]);for(const f of t){if(c!==1/0&&ma(h,Oc(f),n)>=c)continue;const p=km(r,e,f,n,c);if(isNaN(p))return p;if((c=Math.min(c,p))===0)return c}return c}function vh(r){return r==="Point"||r==="MultiPoint"||r==="LineString"||r==="MultiLineString"||r==="Polygon"||r==="MultiPolygon"}class Ms{constructor(e,t){this.type=at,this.geojson=e,this.geometries=t}static parse(e,t){if(e.length!==2)return t.error(`'distance' expression requires either one argument, but found ' ${e.length-1} instead.`);if(Rn(e[1])){const n=e[1];if(n.type==="FeatureCollection"){for(let s=0;s<n.features.length;++s)if(vh(n.features[s].geometry.type))return new Ms(n,n.features[s].geometry)}else if(n.type==="Feature"){if(vh(n.geometry.type))return new Ms(n,n.geometry)}else if(vh(n.type))return new Ms(n,n)}return t.error("'distance' expression needs to be an array with format ['Distance', GeoJSONObj].")}evaluate(e){const t=e.geometry(),n=e.canonicalID();if(t!=null&&n!=null){if(e.geometryType()==="Point")return function(s,c,h){const f=[];for(const g of s)for(const x of g)f.push(xl(x,c));const p=new fa(f[0][1],"meters");return h.type==="Point"||h.type==="MultiPoint"||h.type==="LineString"?Cf(f,!1,h.type==="Point"?[h.coordinates]:h.coordinates,h.type==="LineString",p):h.type==="MultiLineString"?xh(f,!1,h.coordinates,p):h.type==="Polygon"||h.type==="MultiPolygon"?kc(f,!1,h.type==="Polygon"?[h.coordinates]:h.coordinates,p):null}(t,n,this.geometries);if(e.geometryType()==="LineString")return function(s,c,h){const f=[];for(const g of s){const x=[];for(const b of g)x.push(xl(b,c));f.push(x)}const p=new fa(f[0][0][1],"meters");if(h.type==="Point"||h.type==="MultiPoint"||h.type==="LineString")return xh(h.type==="Point"?[h.coordinates]:h.coordinates,h.type==="LineString",f,p);if(h.type==="MultiLineString"){let g=1/0;for(let x=0;x<h.coordinates.length;x++){const b=xh(h.coordinates[x],!0,f,p,g);if(isNaN(b))return b;if((g=Math.min(g,b))===0)return g}return g}if(h.type==="Polygon"||h.type==="MultiPolygon"){let g=1/0;for(let x=0;x<f.length;x++){const b=kc(f[x],!0,h.type==="Polygon"?[h.coordinates]:h.coordinates,p,g);
1if(isNaN(b))return b;if((g=Math.min(g,b))===0)return g}return g}return null}(t,n,this.geometries);if(e.geometryType()==="Polygon")return function(s,c,h){const f=[];for(const g of function(x){const b=x.length;if(b<=1)return[x];const w=[];let S,E;for(let A=0;A<b;A++){const P=As(x[A]);P!==0&&(x[A].area=Math.abs(P),E===void 0&&(E=P<0),E===P<0?(S&&w.push(S),S=[x[A]]):S.push(x[A]))}return S&&w.push(S),w}(s)){const x=[];for(let b=0;b<g.length;++b)x.push(Lt(g[b],c));f.push(x)}const p=new fa(f[0][0][0][1],"meters");if(h.type==="Point"||h.type==="MultiPoint"||h.type==="LineString")return kc(h.type==="Point"?[h.coordinates]:h.coordinates,h.type==="LineString",f,p);if(h.type==="MultiLineString"){let g=1/0;for(let x=0;x<h.coordinates.length;x++){const b=kc(h.coordinates[x],!0,f,p,g);if(isNaN(b))return b;if((g=Math.min(g,b))===0)return g}return g}return h.type==="Polygon"||h.type==="MultiPolygon"?function(g,x,b){let w=1/0;for(const S of g)for(const E of x){const A=Bm(S,E,b,w);if(isNaN(A))return A;if((w=Math.min(w,A))===0)return w}return w}(h.type==="Polygon"?[h.coordinates]:h.coordinates,f,p):null}(t,n,this.geometries);console.warn("Distance Expression: currently only evaluates valid Point/LineString/Polygon geometries.")}else console.warn("Distance Expression: requires valid feature and canonical information.");return null}eachChild(){}outputDefined(){return!0}serialize(){return["distance",this.geojson]}}function Ps(r){if(r instanceof lr&&(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"||/^filter-/.test(r.name))||r instanceof Yo||r instanceof Ms)return!1;if(r instanceof ya)return r.featureConstant;let e=!0;return r.eachChild(t=>{e&&!Ps(t)&&(e=!1)}),e}function ga(r){if(r instanceof lr&&r.name==="feature-state")return!1;let e=!0;return r.eachChild(t=>{e&&!ga(t)&&(e=!1)}),e}function oo(r,e){if(r instanceof lr&&e.indexOf(r.name)>=0)return!1;let t=!0;return r.eachChild(n=>{t&&!oo(n,e)&&(t=!1)}),t}function Mf(r,e,t){return[r,e,t].filter(Boolean).join("�")}function bh(r,e){switch(r){case"string":return rt(e);case"number":return+e;case"boolean":return!!e;case"color":return jt.parse(e);case"formatted":return Vr.fromString(rt(e));case"resolvedImage":return Zr.build(rt(e))}return e}function Pf(r,e,t,n){return n!==void 0&&(r=n*Math.round(r/n)),e!==void 0&&r<e&&(r=e),t!==void 0&&r>t&&(r=t),r}class ya{constructor(e,t,n,s=!1){this.type=e,this.key=t,this.scope=n,this.featureConstant=s}static parse(e,t){let n=t.expectedType;if(n==null&&(n=Ht),e.length<2||e.length>3)return t.error("Invalid number of arguments for 'config' expression.");const s=t.parse(e[1],1);if(!(s instanceof Zn))return t.error("Key name of 'config' expression must be a string literal.");let c,h=!0;const f=rt(s.value);if(e.length>=3){const p=t.parse(e[2],2);if(!(p instanceof Zn))return t.error("Scope of 'config' expression must be a string literal.");c=rt(p.value)}if(t.options){const p=Mf(f,c,t._scope),g=t.options.get(p);g&&(h=Ps(g.value||g.default))}return new ya(n,f,c,h)}evaluate(e){const t=Mf(this.key,this.scope,e.scope),n=e.getConfig(t);if(!n)return null;const{type:s,value:c,values:h,minValue:f,maxValue:p,stepValue:g}=n,x=n.default.evaluate(e);let b=x;if(c){const w=e.scope;e.scope=(w||"").split("�").slice(1).join("�"),b=c.evaluate(e),e.scope=w}return s&&(b=bh(s,b)),b===void 0||f===void 0&&p===void 0&&g===void 0||(typeof b=="number"?b=Pf(b,f,p,g):Array.isArray(b)&&(b=b.map(w=>typeof w=="number"?Pf(w,f,p,g):w))),c!==void 0&&b!==void 0&&h&&!h.includes(b)&&(b=x,s&&(b=bh(s,b))),(s&&s!==this.type||b!==void 0&&!Ac(ct(b),this.type))&&(b=bh(this.type.kind,b)),b}eachChild(){}outputDefined(){return!1}serialize(){const e=["config",this.key];return this.scope&&e.concat(this.scope),e}}class Vc{constructor(e,t){this.type=t.type,this.name=e,this.boundExpression=t}static parse(e,t){if(e.length!==2||typeof e[1]!="string")return t.error("'var' expression requires exactly one string literal argument.");const n=e[1];return t.scope.has(n)?new Vc(n,t.scope.get(n)):t.error(`Unknown variable "${n}". Make sure "${n}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}serialize(){return["var",this.name]}}class Nc{constructor(e,t=[],n,s=new sa,c=[],h,f,p){this.registry=e,this.path=t,this.key=t.map(g=>typeof g=="string"?`['${g}']`:`[${g}]`).join(""),this.scope=s,this.errors=c,this.expectedType=n,this._scope=h,this.options=f,this.iconImageUseTheme=p}parse(e,t,n,s,c={}){return t||n?this.concat(t,null,n,s)._parse(e,c):this._parse(e,c)}parseObjectValue(e,t,n,s,c,h={}){return this.concat(t,n,s,c)._parse(e,h)}_parse(e,t){function n(s,c,h){return h==="assert"?new mn(c,[s]):h==="coerce"?new Wr(c,[s]):s}if(e!==null&&typeof e!="string"&&typeof e!="boolean"&&typeof e!="number"||(e=["literal",e]),Array.isArray(e)){if(e.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const s=typeof e[0]=="string"?this.registry[e[0]]:void 0;if(s){let c=s.parse(e,this);if(!c)return null;if(this.expectedType){const h=this.expectedType,f=c.type;if(h.kind!=="string"&&h.kind!=="number"&&h.kind!=="boolean"&&h.kind!=="object"&&h.kind!=="array"||f.kind!=="value")if(h.kind!=="color"&&h.kind!=="formatted"&&h.kind!=="resolvedImage"||f.kind!=="value"&&f.kind!=="string"){if(this.checkSubtype(h,f))return null}else c=n(c,h,t.typeAnnotation||"coerce");else c=n(c,h,t.typeAnnotation||"assert")}if(!(c instanceof Zn)&&c.type.kind!=="resolvedImage"&&wh(c)){const h=new no(this._scope,this.options,this.iconImageUseTheme);try{c=new Zn(c.type,c.evaluate(h))}catch(f){return this.error(f.message),null}}return c}return Wr.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,t,n,s){let c=typeof e=="number"?this.path.concat(e):this.path;c=typeof t=="string"?c.concat(t):c;const h=s?this.scope.concat(s):this.scope;return new Nc(this.registry,c,n||null,h,this.errors,this._scope,this.options,this.iconImageUseTheme)}error(e,...t){const n=`${this.key}${t.map(s=>`[${s}]`).join("")}`;this.errors.push(new Hr(n,e))}checkSubtype(e,t){const n=hl(e,t);return n&&this.error(n),n}}function wh(r){if(r instanceof Vc)return wh(r.boundExpression);if(r instanceof lr&&r.name==="error"||r instanceof Pc||r instanceof Yo||r instanceof Ms||r instanceof ya)return!1;const e=r instanceof Wr||r instanceof mn;let t=!0;return r.eachChild(n=>{t=e?t&&wh(n):t&&n instanceof Zn}),!!t&&Ps(r)&&oo(r,["zoom","heatmap-density","worldview","line-progress","raster-value","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center","measure-light","raster-particle-speed","is-active-floor"])}function Uc(r,e){const t=r.length-1;let n,s,c=0,h=t,f=0;for(;c<=h;)if(f=Math.floor((c+h)/2),n=r[f],s=r[f+1],n<=e){if(f===t||e<s)return f;c=f+1}else{if(!(n>e))throw new st("Input is not a number.");h=f-1}return 0}class vl{constructor(e,t,n){this.type=e,this.input=t,this.labels=[],this.outputs=[];for(const[s,c]of n)this.labels.push(s),this.outputs.push(c)}static parse(e,t){if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return t.error("Expected an even number of arguments.");const n=t.parse(e[1],1,at);if(!n)return null;const s=[];let c=null;t.expectedType&&t.expectedType.kind!=="value"&&(c=t.expectedType);for(let h=1;h<e.length;h+=2){const f=h===1?-1/0:e[h],p=e[h+1],g=h,x=h+1;if(typeof f!="number")return t.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not c
1omputed expressions) for the input values.',g);if(s.length&&s[s.length-1][0]>=f)return t.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',g);const b=t.parse(p,x,c);if(!b)return null;c=c||b.type,s.push([f,b])}return new vl(c,n,s)}evaluate(e){const t=this.labels,n=this.outputs;if(t.length===1)return n[0].evaluate(e);const s=this.input.evaluate(e);if(s<=t[0])return n[0].evaluate(e);const c=t.length;return s>=t[c-1]?n[c-1].evaluate(e):n[Uc(t,s)].evaluate(e)}eachChild(e){e(this.input);for(const t of this.outputs)e(t)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}serialize(){const e=["step",this.input.serialize()];for(let t=0;t<this.labels.length;t++)t>0&&e.push(this.labels[t]),e.push(this.outputs[t].serialize());return e}}const Df=.95047,Rf=1.08883,zf=4/29,xa=6/29,Lf=3*xa*xa,Vm=xa*xa*xa,Nm=Math.PI/180,Um=180/Math.PI;function Th(r){return r>Vm?Math.pow(r,1/3):r/Lf+zf}function bl(r){return r>xa?r*r*r:Lf*(r-zf)}function va(r){return 255*(r<=.0031308?12.92*r:1.055*Math.pow(r,1/2.4)-.055)}function jc(r){return(r/=255)<=.04045?r/12.92:Math.pow((r+.055)/1.055,2.4)}function Ff(r){const e=jc(r.r),t=jc(r.g),n=jc(r.b),s=Th((.4124564*e+.3575761*t+.1804375*n)/Df),c=Th((.2126729*e+.7151522*t+.072175*n)/1);return{l:116*c-16,a:500*(s-c),b:200*(c-Th((.0193339*e+.119192*t+.9503041*n)/Rf)),alpha:r.a}}function Of(r){let e=(r.l+16)/116,t=isNaN(r.a)?e:e+r.a/500,n=isNaN(r.b)?e:e-r.b/200;return e=1*bl(e),t=Df*bl(t),n=Rf*bl(n),new jt(va(3.2404542*t-1.5371385*e-.4985314*n),va(-.969266*t+1.8760108*e+.041556*n),va(.0556434*t-.2040259*e+1.0572252*n),r.alpha)}function jm(r,e,t){const n=e-r;return r+t*(n>180||n<-180?n-360*Math.round(n/360):n)}const ba={forward:Ff,reverse:Of,interpolate:function(r,e,t){return{l:dt(r.l,e.l,t),a:dt(r.a,e.a,t),b:dt(r.b,e.b,t),alpha:dt(r.alpha,e.alpha,t)}}},wa={forward:function(r){const{l:e,a:t,b:n}=Ff(r),s=Math.atan2(n,t)*Um;return{h:s<0?s+360:s,c:Math.sqrt(t*t+n*n),l:e,alpha:r.a}},reverse:function(r){const e=r.h*Nm,t=r.c;return Of({l:r.l,a:Math.cos(e)*t,b:Math.sin(e)*t,alpha:r.alpha})},interpolate:function(r,e,t){return{h:jm(r.h,e.h,t),c:dt(r.c,e.c,t),l:dt(r.l,e.l,t),alpha:dt(r.alpha,e.alpha,t)}}};var Ds=Object.freeze({__proto__:null,hcl:wa,lab:ba});class on{constructor(e,t,n,s,c){this.type=e,this.operator=t,this.interpolation=n,this.input=s,this.labels=[],this.outputs=[];for(const[h,f]of c)this.labels.push(h),this.outputs.push(f)}static interpolationFactor(e,t,n,s){let c=0;if(e.name==="exponential")c=Gc(t,e.base,n,s);else if(e.name==="linear")c=Gc(t,1,n,s);else if(e.name==="cubic-bezier"){const h=e.controlPoints;c=new Qa(h[0],h[1],h[2],h[3]).solve(Gc(t,1,n,s))}return c}static parse(e,t){let[n,s,c,...h]=e;if(!Array.isArray(s)||s.length===0)return t.error("Expected an interpolation type expression.",1);if(s[0]==="linear")s={name:"linear"};else if(s[0]==="exponential"){const g=s[1];if(typeof g!="number")return t.error("Exponential interpolation requires a numeric base.",1,1);s={name:"exponential",base:g}}else{if(s[0]!=="cubic-bezier")return t.error(`Unknown interpolation type ${String(s[0])}`,1,0);{const g=s.slice(1);if(g.length!==4||g.some(x=>typeof x!="number"||x<0||x>1))return t.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);s={name:"cubic-bezier",controlPoints:g}}}if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length-1>3&&(e.length-1)%2!=0)return t.error("Expected an even number of arguments.");if(c=t.parse(c,2,at),!c)return null;const f=[];let p=null;n==="interpolate-hcl"||n==="interpolate-lab"?p=Lr:t.expectedType&&t.expectedType.kind!=="value"&&(p=t.expectedType);for(let g=0;g<h.length;g+=2){const x=h[g],b=h[g+1],w=g+3,S=g+4;if(typeof x!="number")return t.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',w);if(f.length&&f[f.length-1][0]>=x)return t.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',w);const E=t.parse(b,S,p);if(!E)return null;p=p||E.type,f.push([x,E])}return p.kind==="number"||p.kind==="color"||p.kind==="array"&&p.itemType.kind==="number"&&typeof p.N=="number"?new on(p,n,s,c,f):t.error(`Type ${tr(p)} is not interpolatable.`)}evaluate(e){const t=this.labels,n=this.outputs;if(t.length===1)return n[0].evaluate(e);const s=this.input.evaluate(e);if(s<=t[0])return n[0].evaluate(e);const c=t.length;if(s>=t[c-1])return n[c-1].evaluate(e);const h=Uc(t,s),f=on.interpolationFactor(this.interpolation,s,t[h],t[h+1]),p=n[h].evaluate(e),g=n[h+1].evaluate(e);return this.operator==="interpolate"?ll[this.type.kind.toLowerCase()](p,g,f):this.operator==="interpolate-hcl"?wa.reverse(wa.interpolate(wa.forward(p),wa.forward(g),f)):ba.reverse(ba.interpolate(ba.forward(p),ba.forward(g),f))}eachChild(e){e(this.input);for(const t of this.outputs)e(t)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}serialize(){let e;e=this.interpolation.name==="linear"?["linear"]:this.interpolation.name==="exponential"?this.interpolation.base===1?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier",...this.interpolation.controlPoints];const t=[this.operator,e,this.input.serialize()];for(let n=0;n<this.labels.length;n++)t.push(this.labels[n],this.outputs[n].serialize());return t}}function Gc(r,e,t,n){const s=n-t,c=r-t;return s===0?0:e===1?c/s:(Math.pow(e,c)-1)/(Math.pow(e,s)-1)}class qc{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expectected at least one argument."),null;let n=null;const s=t.expectedType;s&&s.kind!=="value"&&(n=s);const c=[];for(const f of e.slice(1)){const p=t.parse(f,1+c.length,n,void 0,{typeAnnotation:"omit"});if(!p)return null;n=n||p.type,c.push(p)}const h=s&&c.some(f=>hl(s,f.type));return new qc(h?Ht:n,c)}
1evaluate(e){let t,n=null,s=0;for(const c of this.args){if(s++,n=c.evaluate(e),n&&n instanceof Zr&&!n.available&&(t||(t=n),n=null,s===this.args.length))return t;if(n!==null)break}return n}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}serialize(){const e=["coalesce"];return this.eachChild(t=>{e.push(t.serialize())}),e}}class Ta{constructor(e,t){this.type=t.type,this.bindings=[].concat(e),this.result=t}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const t of this.bindings)e(t[1]);e(this.result)}static parse(e,t){if(e.length<4)return t.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const n=[];for(let c=1;c<e.length-1;c+=2){const h=e[c];if(typeof h!="string")return t.error(`Expected string, but found ${typeof h} instead.`,c);if(/[^a-zA-Z0-9_]/.test(h))return t.error("Variable names must contain only alphanumeric characters or '_'.",c);const f=t.parse(e[c+1],c+1);if(!f)return null;n.push([h,f])}const s=t.parse(e[e.length-1],e.length-1,t.expectedType,n);return s?new Ta(n,s):null}outputDefined(){return this.result.outputDefined()}serialize(){const e=["let"];for(const[t,n]of this.bindings)e.push(t,n.serialize());return e.push(this.result.serialize()),e}}class wl{constructor(e,t,n){this.type=e,this.index=t,this.input=n}static parse(e,t){if(e.length!==3)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const n=t.parse(e[1],1,at),s=t.parse(e[2],2,Fr(t.expectedType||Ht));return n&&s?new wl(s.type.itemType,n,s):null}evaluate(e){const t=this.index.evaluate(e),n=this.input.evaluate(e);if(t<0)throw new st("Array index out of bounds: negative index");if(t>=n.length)throw new st("Array index out of bounds: index exceeds array size");if(t!==Math.floor(t))throw new st("Array index must be an integer. Use at-interpolated for fractional indices");return n[t]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}class Tl{constructor(e,t,n){this.type=e,this.index=t,this.input=n}static parse(e,t){if(e.length!==3)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const n=t.parse(e[1],1,at),s=t.parse(e[2],2,Fr(t.expectedType||Ht));return n&&s?new Tl(s.type.itemType,n,s):null}evaluate(e){const t=this.index.evaluate(e),n=this.input.evaluate(e);if(t<0)throw new st(`Array index out of bounds: ${t} < 0.`);if(t>n.length-1)throw new st(`Array index out of bounds: ${t} > ${n.length-1}.`);if(t===Math.floor(t))return n[t];const s=Math.floor(t),c=Math.ceil(t),h=n[s],f=n[c];if(typeof h!="number"||typeof f!="number")throw new st(`Cannot interpolate between non-number values at index ${t}.`);const p=t-s;return h*(1-p)+f*p}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}serialize(){return["at-interpolated",this.index.serialize(),this.input.serialize()]}}class Sh{constructor(e,t){this.type=Kt,this.needle=e,this.haystack=t}static parse(e,t){if(e.length!==3)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`),null;const n=t.parse(e[1],1,Ht),s=t.parse(e[2],2,Ht);return n&&s?Ec(n.type,[Kt,Yt,at,aa,Ht])?new Sh(n,s):(t.error(`Expected first argument to be of type boolean, string, number or null, but found ${tr(n.type)} instead`),null):null}evaluate(e){const t=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(n==null)return!1;if(!ro(t,["boolean","string","number","null"]))throw new st(`Expected first argument to be of type boolean, string, number or null, but found ${tr(ct(t))} instead.`);if(!ro(n,["string","array"]))throw new st(`Expected second argument to be of type array or string, but found ${tr(ct(n))} instead.`);return n.indexOf(t)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}}class $c{constructor(e,t,n){this.type=at,this.needle=e,this.haystack=t,this.fromIndex=n}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`),null;const n=t.parse(e[1],1,Ht),s=t.parse(e[2],2,Ht);if(!n||!s)return null;if(!Ec(n.type,[Kt,Yt,at,aa,Ht]))return t.error(`Expected first argument to be of type boolean, string, number or null, but found ${tr(n.type)} instead`),null;if(e.length===4){const c=t.parse(e[3],3,at);return c?new $c(n,s,c):null}return new $c(n,s)}evaluate(e){const t=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(!ro(t,["boolean","string","number","null"]))throw new st(`Expected first argument to be of type boolean, string, number or null, but found ${tr(ct(t))} instead.`);if(!ro(n,["string","array"]))throw new st(`Expected second argument to be of type array or string, but found ${tr(ct(n))} instead.`);if(this.fromIndex){const s=this.fromIndex.evaluate(e);return n.indexOf(t,s)}return n.indexOf(t)}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 Hc{constructor(e,t,n,s,c,h){this.inputType=e,this.type=t,this.input=n,this.cases=s,this.outputs=c,this.otherwise=h}static parse(e,t){if(e.length<5)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return t.error("Expected an even number of arguments.");let n,s;t.expectedType&&t.expectedType.kind!=="value"&&(s=t.expectedType);const c={},h=[];for(let g=2;g<e.length-1;g+=2){let x=e[g];const b=e[g+1];Array.isArray(x)||(x=[x]);const w=t.concat(g);if(x.length===0)return w.error("Expected at least one branch label.");
1for(const E of x){if(typeof E!="number"&&typeof E!="string")return w.error("Branch labels must be numbers or strings.");if(typeof E=="number"&&Math.abs(E)>Number.MAX_SAFE_INTEGER)return w.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof E=="number"&&Math.floor(E)!==E)return w.error("Numeric branch labels must be integer values.");if(n){if(w.checkSubtype(n,ct(E)))return null}else n=ct(E);if(c[String(E)]!==void 0)return w.error("Branch labels must be unique.");c[String(E)]=h.length}const S=t.parse(b,g,s);if(!S)return null;s=s||S.type,h.push(S)}const f=t.parse(e[1],1,Ht);if(!f)return null;const p=t.parse(e[e.length-1],e.length-1,s);return p?f.type.kind!=="value"&&t.concat(1).checkSubtype(n,f.type)?null:new Hc(n,s,f,c,h,p):null}evaluate(e){const t=this.input.evaluate(e);return(Ac(ct(t),this.inputType)&&this.outputs[this.cases[t]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every(e=>e.outputDefined())&&this.otherwise.outputDefined()}serialize(){const e=["match",this.input.serialize()],t=Object.keys(this.cases).sort(),n=[],s={};for(const h of t){const f=s[this.cases[h]];f===void 0?(s[this.cases[h]]=n.length,n.push([this.cases[h],[h]])):n[f][1].push(h)}const c=h=>this.inputType.kind==="number"?Number(h):h;for(const[h,f]of n)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 Zc{constructor(e,t,n){this.type=e,this.branches=t,this.otherwise=n}static parse(e,t){if(e.length<4)return t.error(`Expected at least 3 arguments, but found only ${e.length-1}.`),null;if(e.length%2!=0)return t.error("Expected an odd number of arguments."),null;let n;t.expectedType&&t.expectedType.kind!=="value"&&(n=t.expectedType);const s=[];for(let h=1;h<e.length-1;h+=2){const f=t.parse(e[h],h,Kt);if(!f)return null;const p=t.parse(e[h+1],h+1,n);if(!p)return null;s.push([f,p]),n=n||p.type}const c=t.parse(e[e.length-1],e.length-1,n);return c?new Zc(n,s,c):null}evaluate(e){for(const[t,n]of this.branches)if(t.evaluate(e))return n.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(const[t,n]of this.branches)e(t),e(n);e(this.otherwise)}outputDefined(){return this.branches.every(([e,t])=>t.outputDefined())&&this.otherwise.outputDefined()}serialize(){const e=["case"];return this.eachChild(t=>{e.push(t.serialize())}),e}}class Wc{constructor(e,t,n,s){this.type=e,this.input=t,this.beginIndex=n,this.endIndex=s}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`),null;const n=t.parse(e[1],1,Ht),s=t.parse(e[2],2,at);if(!n||!s)return null;if(!Ec(n.type,[Fr(Ht),Yt,Ht]))return t.error(`Expected first argument to be of type array or string, but found ${tr(n.type)} instead`),null;if(e.length===4){const c=t.parse(e[3],3,at);return c?new Wc(n.type,n,s,c):null}return new Wc(n.type,n,s)}evaluate(e){const t=this.input.evaluate(e),n=this.beginIndex.evaluate(e);if(!ro(t,["string","array"]))throw new st(`Expected first argument to be of type array or string, but found ${tr(ct(t))} instead.`);if(this.endIndex){const s=this.endIndex.evaluate(e);return t.slice(n,s)}return t.slice(n)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}serialize(){if(this.endIndex!=null&&this.endIndex!==void 0){const e=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),e]}return["slice",this.input.serialize(),this.beginIndex.serialize()]}}class Ih{constructor(e,t){this.type=Fr(Yt),this.str=e,this.delimiter=t}static parse(e,t){if(e.length!==3)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const n=t.parse(e[1],1,Yt),s=t.parse(e[2],2,Yt);return n&&s?new Ih(n,s):void 0}evaluate(e){const t=this.str.evaluate(e),n=this.delimiter.evaluate(e);return t.split(n)}eachChild(e){e(this.str),e(this.delimiter)}outputDefined(){return!1}serialize(){return["split",this.str.serialize(),this.delimiter.serialize()]}}function Bf(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 Eh(r,e,t,n){return n.compare(e,t)===0}function Rs(r,e,t){const n=r!=="=="&&r!=="!=";return class nb{constructor(c,h,f){this.type=Kt,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 p=h.parse(c[1],1,Ht);if(!p)return null;if(!Bf(f,p.type))return h.concat(1).error(`"${f}" comparisons are not supported for type '${tr(p.type)}'.`);let g=h.parse(c[2],2,Ht);if(!g)return null;if(!Bf(f,g.type))return h.concat(2).error(`"${f}" comparisons are not supported for type '${tr(g.type)}'.`);if(p.type.kind!==g.type.kind&&p.type.kind!=="value"&&g.type.kind!=="value")return h.error(`Cannot compare types '${tr(p.type)}' and '${tr(g.type)}'.`);n&&(p.type.kind==="value"&&g.type.kind!=="value"?p=new mn(g.type,[p]):p.type.kind!=="value"&&g.type.kind==="value"&&(g=ne
vendor: 14,479 bytes, line 1
1w mn(p.type,[g])));let x=null;if(c.length===4){if(p.type.kind!=="string"&&g.type.kind!=="string"&&p.type.kind!=="value"&&g.type.kind!=="value")return h.error("Cannot use collator to compare non-string types.");if(x=h.parse(c[3],3,Ic),!x)return null}return new nb(p,g,x)}evaluate(c){const h=this.lhs.evaluate(c),f=this.rhs.evaluate(c);if(n&&this.hasUntypedArgument){const p=ct(h),g=ct(f);if(p.kind!==g.kind||p.kind!=="string"&&p.kind!=="number")throw new st(`Expected arguments for "${r}" to be (string, string) or (number, number), but found (${p.kind}, ${g.kind}) instead.`)}if(this.collator&&!n&&this.hasUntypedArgument){const p=ct(h),g=ct(f);if(p.kind!=="string"||g.kind!=="string")return e(c,h,f)}return this.collator?t(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 Xc=Rs("==",function(r,e,t){return e===t},Eh),Gm=Rs("!=",function(r,e,t){return e!==t},function(r,e,t,n){return!Eh(0,e,t,n)}),kf=Rs("<",function(r,e,t){return e<t},function(r,e,t,n){return n.compare(e,t)<0}),qm=Rs(">",function(r,e,t){return e>t},function(r,e,t,n){return n.compare(e,t)>0}),$m=Rs("<=",function(r,e,t){return e<=t},function(r,e,t,n){return n.compare(e,t)<=0}),Vf=Rs(">=",function(r,e,t){return e>=t},function(r,e,t,n){return n.compare(e,t)>=0});class Yc{constructor(e,t,n,s,c,h){this.type=Yt,this.number=e,this.locale=t,this.currency=n,this.unit=s,this.minFractionDigits=c,this.maxFractionDigits=h}static parse(e,t){if(e.length!==3)return t.error("Expected two arguments.");const n=t.parse(e[1],1,at);if(!n)return null;const s=e[2];if(typeof s!="object"||Array.isArray(s))return t.error("NumberFormat options argument must be an object.");let c=null;if(s.locale&&(c=t.parseObjectValue(s.locale,2,"locale",Yt),!c))return null;let h=null;if(s.currency&&(h=t.parseObjectValue(s.currency,2,"currency",Yt),!h))return null;let f=null;if(s.unit&&(f=t.parseObjectValue(s.unit,2,"unit",Yt),!f))return null;let p=null;if(s["min-fraction-digits"]&&(p=t.parseObjectValue(s["min-fraction-digits"],2,"min-fraction-digits",at),!p))return null;let g=null;return s["max-fraction-digits"]&&(g=t.parseObjectValue(s["max-fraction-digits"],2,"max-fraction-digits",at),!g)?null:new Yc(n,c,h,f,p,g)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:(this.currency?"currency":this.unit&&"unit")||"decimal",currency:this.currency?this.currency.evaluate(e):void 0,unit:this.unit?this.unit.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.unit&&e(this.unit),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}serialize(){const e={};return this.locale&&(e.locale=this.locale.serialize()),this.currency&&(e.currency=this.currency.serialize()),this.unit&&(e.unit=this.unit.serialize()),this.minFractionDigits&&(e["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(e["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),e]}}class Ah{constructor(e){this.type=at,this.input=e}static parse(e,t){if(e.length!==2)return t.error(`Expected 1 argument, but found ${e.length-1} instead.`),null;const n=t.parse(e[1],1);return n?n.type.kind!=="array"&&n.type.kind!=="string"&&n.type.kind!=="value"?(t.error(`Expected argument of type string or array, but found ${tr(n.type)} instead.`),null):new Ah(n):null}evaluate(e){const t=this.input.evaluate(e);if(typeof t=="string"||Array.isArray(t))return t.length;throw new st(`Expected value to be of type string or array, but found ${tr(ct(t))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}serialize(){const e=["length"];return this.eachChild(t=>{e.push(t.serialize())}),e}}function Nf(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 Sa={"==":Xc,"!=":Gm,">":qm,"<":kf,">=":Vf,"<=":$m,array:mn,at:wl,"at-interpolated":Tl,boolean:mn,case:Zc,coalesce:qc,collator:Pc,format:pt,image:fl,in:Sh,"index-of":$c,interpolate:on,"interpolate-hcl":on,"interpolate-lab":on,length:Ah,let:Ta,literal:Zn,match:Hc,number:mn,"number-format":Yc,object:mn,slice:Wc,step:vl,string:mn,"to-boolean":Wr,"to-color":Wr,"to-number":Wr,"to-string":Wr,var:Vc,within:Yo,distance:Ms,config:ya,split:Ih};function Uf(r,[e,t,n,s]){e=e.evaluate(r),t=t.evaluate(r),n=n.evaluate(r);const c=s?s.evaluate(r):1,h=gf(e,t,n,c);if(h)throw new st(h);return new jt(e/255,t/255,n/255,c)}function Sl(r,[e,t,n,s]){e=e.evaluate(r),t=t.evaluate(r),n=n.evaluate(r);const c=s?s.evaluate(r):1,h=function(g,x,b,w){return typeof g=="number"&&g>=0&&g<=360?typeof x=="number"&&x>=0&&x<=100&&typeof b=="number"&&b>=0&&b<=100?w===void 0||typeof w=="number"&&w>=0&&w<=1?null:`Invalid hsla value [${[g,x,b,w].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid hsla value [${(typeof w=="number"?[g,x,b,w]:[g,x,b]).join(", ")}]: 's', and 'l' must be between 0 and 100.`:`Invalid hsla value [${(typeof w=="number"?[g,x,b,w]:[g,x,b]).join(", ")}]: 'h' must be between 0 and 360.`}(e,t,n,c);if(h)throw new st(h);const f=`hsla(${e}, ${t}%, ${n}%, ${c})`,p=jt.parse(f);if(!p)throw new st(`Failed to parse HSLA color: ${f}`);return p}function Ch(r,e){return r in e}function Mh(r,e){const t=e[r];return t===void 0?null:t}function Qo(r){return{type:r}}function Kc(r){if(r instanceof ya)return new Set([r.key]);let e=new Set;return r.eachChild(t=>{e=new Set([...e,...Kc(t)])}),e}function Qc(r){if(r instanceof lr&&r.name==="is-active-floor")return!0;let e=!1;return r.eachChild(t=>{!e&&Qc(t)&&(e=!0)}),e}function jf(r){return{result:"success",value:r}}function so(r){return{result:"error",value:r}}function Ph(r,e){return!!r&&!!r.parameters&&r.parameters.indexOf(e)>-1}function Jc(r){return r["property-type"]==="data-driven"}function Dh(r){return Ph(r.expression,"measure-light")}function Rh(r){return Ph(r.expression,"zoom")}function zh(r){return!!r.expression&&r.expression.interpolated}function eu(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)}function Hm(r){return r}function zs(r,e){const t=e.type==="color",n=r.stops&&typeof r.stops[0][0]=="object",s=n||!(n||r.property!==void 0),c=r.type||(zh(e)?"exponential":"interval");if(t&&((r=Object.assign({},r)).stops&&(r.stops=r.stops.map(g=>[g[0],jt.parse(g[1])])),r.default=jt.parse(r.default?r.default:e.default)),r.colorSpace&&r.colorSpace!=="rgb"&&!Ds[r.colorSpace])throw new Error(`Unknown color space: ${r.colorSpace}`);let h,f,p;if(c==="exponential")h=Lh;else if(c==="interval")h=Wm;else if(c==="categorical"){h=Zm,f=Object.create(null);for(const g of r.stops)f[g[0]]=g[1];p=typeof r.stops[0][0]}else{if(c!=="identity")throw new Error(`Unknown function type "${c}"`);h=Gf}if(n){const g={},x=[];for(let S=0;S<r.stops.length;S++){const E=r.stops[S],A=E[0].zoom;g[A]===void 0&&(g[A]={zoom:A,type:r.type,property:r.property,default:r.default,stops:[]},x.push(A)),g[A].stops.push([E[0].value,E[1]])}const b=[];for(const S of x)b.push([g[S].zoom,zs(g[S],e)]);const w={name:"linear"};return{kind:"composite",interpolationType:w,interpolationFactor:on.interpolationFactor.bind(void 0,w),zoomStops:b.map(S=>S[0]),evaluate:({zoom:S},E)=>Lh({stops:b,base:r.base},e,S).evaluate(S,E)}}if(s){const g=c==="exponential"?{name:"exponential",base:r.base!==void 0?r.base:1}:null;return{kind:"camera",interpolationType:g,interpolationFactor:on.interpolationFactor.bind(void 0,g),zoomStops:r.stops.map(x=>x[0]),evaluate:({zoom:x})=>h(r,e,x,f,p)}}return{kind:"source",evaluate(g,x){const b=x&&x.properties?x.properties[r.property]:void 0;return b===void 0?Il(r.default,e.default):h(r,e,b,f,p)}}}function Il(r,e,t){return r!==void 0?r:e!==void 0?e:t!==void 0?t:void 0}function Zm(r,e,t,n,s){return Il(typeof t===s?n[t]:void 0,r.default,e.default)}function Wm(r,e,t){if(!Es(t))return Il(r.default,e.default);const n=r.stops.length;if(n===1||t<=r.stops[0][0])return r.stops[0][1];if(t>=r.stops[n-1][0])return r.stops[n-1][1];const s=Uc(r.stops.map(c=>c[0]),t);return r.stops[s][1]}function Lh(r,e,t){const n=r.base!==void 0?r.base:1;if(!Es(t))return Il(r.default,e.default);const s=r.stops.length;if(s===1||t<=r.stops[0][0])return r.stops[0][1];if(t>=r.stops[s-1][0])return r.stops[s-1][1];const c=Uc(r.stops.map(x=>x[0]),t),h=function(x,b,w,S){const E=S-w,A=x-w;return E===0?0:b===1?A/E:(Math.pow(b,A)-1)/(Math.pow(b,E)-1)}(t,n,r.stops[c][0],r.stops[c+1][0]),f=r.stops[c][1],p=r.stops[c+1][1];let g=ll[e.type]||Hm;if(r.colorSpace&&r.colorSpace!=="rgb"){const x=Ds[r.colorSpace];g=(b,w)=>x.reverse(x.interpolate(x.forward(b),x.forward(w),h))}return typeof f.evaluate=="function"?{evaluate(...x){const b=f.evaluate.apply(void 0,x),w=p.evaluate.apply(void 0,x);if(b!==void 0&&w!==void 0)return g(b,w,h)}}:g(f,p,h)}function Gf(r,e,t){return e.type==="color"?t=jt.parse(t):e.type==="formatted"?t=Vr.fromString(t.toString()):e.type==="resolvedImage"?t=Zr.build(t.toString()):ua(t)===e.type||e.type==="enum"&&e.values[t]||(t=void 0),Il(t,r.default,e.default)}lr.register(Sa,{error:[{kind:"error"},[Yt],(r,[e])=>{throw new st(e.evaluate(r))}],typeof:[Yt,[Ht],(r,[e])=>tr(ct(e.evaluate(r)))],"to-rgba":[Fr(at,4),[Lr],(r,[e])=>e.evaluate(r).toNonPremultipliedRenderColor(null).toArray()],"to-hsla":[Fr(at,4),[Lr],(r,[e])=>e.evaluate(r).toNonPremultipliedRenderColor(null).toHslaArray()],rgb:[Lr,[at,at,at],Uf],rgba:[Lr,[at,at,at,at],Uf],hsl:[Lr,[at,at,at],Sl],hsla:[Lr,[at,at,at,at],Sl],has:{type:Kt,overloads:[[[Yt],(r,[e])=>Ch(e.evaluate(r),r.properties())],[[Yt,la],(r,[e,t])=>Ch(e.evaluate(r),t.evaluate(r))]]},get:{type:Ht,overloads:[[[Yt],(r,[e])=>Mh(e.evaluate(r),r.properties())],[[Yt,la],(r,[e,t])=>Mh(e.evaluate(r),t.evaluate(r))]]},"feature-state":[Ht,[Yt],(r,[e])=>Mh(e.evaluate(r),r.featureState||{})],properties:[la,[],r=>r.properties()],"geometry-type":[Yt,[],r=>r.geometryType()],worldview:[Yt,[],r=>r.globals.worldview||""],"is-active-floor":[Kt,Qo(Yt),(r,e)=>{if(!(r.globals&&r.globals.activeFloors&&r.globals.activeFloors.size>0))return!1;if(e.length===0)return!0;const t=r.globals.activeFloors;return e.some(n=>{const s=n.evaluate(r);return t.has(s)})}],id:[Ht,[],r=>r.id()],zoom:[at,[],r=>r.globals.zoom],pitch:[at,[],r=>r.globals.pitch||0],"distance-from-center":[at,[],r=>r.distanceFromCenter()],"measure-light":[at,[Yt],(r,[e])=>r.measureLight(e.evaluate(r))],"heatmap-density":[at,[],r=>r.globals.heatmapDensity||0],"line-progress":[at,[],r=>r.globals.lineProgress||0],"raster-value":[at,[],r=>r.globals.rasterValue||0],"raster-particle-speed":[at,[],r=>r.globals.rasterParticleSpeed||0],"sky-radial-progress":[at,[],r=>r.globals.skyRadialProgress||0],accumulated:[Ht,[],r=>r.globals.accumulated===void 0?null:r.globals.accumulated],"+":[at,Qo(at),(r,e)=>{let t=0;for(const n of e)t+=n.evaluate(r);return t}],"*":[at,Qo(at),(r,e)=>{let t=1;for(const n of e)t*=n.evaluate(r);return t}],"-":{type:at,overloads:[[[at,at],(r,[e,t])=>e.evaluate(r)-t.evaluate(r)],[[at],(r,[e])=>-e.evaluate(r)]]},"/":[at,[at,at],(r,[e,t])=>e.evaluate(r)/t.evaluate(r)],"%":[at,[at,at],(r,[e,t])=>e.evaluate(r)%t.evaluate(r)],ln2:[at,[],()=>Math.LN2],pi:[at,[],()=>Math.PI],e:[at,[],()=>Math.E],"^":[at,[at,at],(r,[e,t])=>Math.pow(e.evaluate(r),t.evaluate(r))],sqrt:[at,[at],(r,[e])=>Math.sqrt(e.evaluate(r))],log10:[at,[at],(r,[e])=>Math.log(e.evaluate(r))/Math.LN10],ln:[at,[at],(r,[e])=>Math.log(e.evaluate(r))],log2:[at,[at],(r,[e])=>Math.log2(e.evaluate(r))],sin:[at,[at],(r,[e])=>Math.sin(e.evaluate(r))],cos:[at,[at],(r,[e])=>Math.cos(e.evaluate(r))],tan:[at,[at],(r,[e])=>Math.tan(e.evaluate(r))],asin:[at,[at],(r,[e])=>Math.asin(e.evaluate(r))],acos:[at,[at],(r,[e])=>Math.acos(e.evaluate(r))],atan:[at,[at],(r,[e])=>Math.atan(e.evaluate(r))],min:[at,Qo(at),(r,e)=>Math.min(...e.map(t=>t.evaluate(r)))],max:[at,Qo(at),(r,e)=>Math.max(...e.map(t=>t.evaluate(r)))],abs:[at,[at],(r,[e])=>Math.abs(e.evaluate(r))],round:[at,[at],(r,[e])=>{const t=e.evaluate(r);return t<0?-Math.round(-t):Math.round(t)}],floor:[at,[at],(r,[e])=>Math.floor(e.evaluate(r))],ceil:[at,[at],(r,[e])=>Math.ceil(e.evaluate(r))],"filter-==":[Kt,[Yt,Ht],(r,[e,t])=>r.properties()[e.value]===t.value],"filter-id-==":[Kt,[Ht],(r,[e])=>r.id()===e.value],"filter-type-==":[Kt,[Yt],(r,[e])=>r.geometryType()===e.value],"filter-<":[Kt,[Yt,Ht],(r,[e,t])=>{const n=r.properties()[e.value],s=t.value;return typeof n==typeof s&&n<s}],"filter-id-<":[Kt,[Ht],(r,[e])=>{const t=r.id(),n=e.value;return typeof t==typeof n&&t<n}],"filter->":[Kt,[Yt,Ht],(r,[e,t])=>{const n=r.properties()[e.value],s=t.value;return typeof n==typeof s&&n>s}],"filter-id->":[Kt,[Ht],(r,[e])=>{const t=r.id(),n=e.value;return typeof t==typeof n&&t>n}],"filter-<=":[Kt,[Yt,Ht],(r,[e,t])=>{const n=r.properties()[e.value],s=t.value;return typeof n==typeof s&&n<=s}],"filter-id-<=":[Kt,[Ht],(r,[e])=>{const t=r.id(),n=e.value;return typeof t==typeof n&&t<=n}],"filter->=":[Kt,[Yt,Ht],(r,[e,t])=>{const n=r.properties()[e.value],s=t.value;return typeof n==typeof s&&n>=s}],"filter-id->=":[Kt,[Ht],(r,[e])=>{const t=r.id(),n=e.value;return typeof t==typeof n&&t>=n}],"filter-has":[Kt,[Ht],(r,[e])=>e.value in r.properties()],"filter-has-id":[Kt,[],r=>r.id()!==null&&r.id()!==void 0],"filter-type-in":[Kt,[Fr(Yt)],(r,[e])=>e.value.indexOf(r.geometryType())>=0],"filter-id-in":[Kt,[Fr(Ht)],(r,[e])=>e.value.indexOf(r.id())>=0],"filter-in-small":[Kt,[Yt,Fr(Ht)],(r,[e,t])=>t.value.indexOf(r.properties()[e.value])>=0],"filter-in-large":[Kt,[Yt,Fr(Ht)],(r,[e,t])=>function(n,s,c,h){for(;c<=h;){const f=c+h>>1;if(s[f]===n)return!0;s[f]>n?h=f-1:c=f+1}return!1}(r.properties()[e.value],t.value,0,t.value.length-1)],all:{type:Kt,overloads:[[[Kt,Kt],(r,[e,t])=>e.evaluate(r)&&t.evaluate(r)],[Qo(Kt),(r,e)=>{for(const t of e)if(!t.evaluate(r))return!1;return!0}]]},any:{type:Kt,overloads:[[[Kt,Kt],(r,[e,t])=>e.evaluate(r)||t.evaluate(r)],[Qo(Kt),(r,e)=>{for(const t of e)if(t.evaluate(r))return!0;return!1}]]},"!":[Kt,[Kt],(r,[e])=>!e.evaluate(r)],"is-supported-script":[Kt,[Yt],(r,[e])=>{const t=r.globals&&r.globals.isSupportedScript;return!t||t(e.evaluate(r))}],upcase:[Yt,[Yt],(r,[e])=>e.evaluate(r).toUpperCase()],downcase:[Yt,[Yt],(r,[e])=>
1e.evaluate(r).toLowerCase()],concat:[Yt,Qo(Ht),(r,e)=>e.map(t=>rt(t.evaluate(r))).join("")],"resolved-locale":[Yt,[Ic],(r,[e])=>e.evaluate(r).resolvedLocale()],random:[at,[at,at,Ht],(r,e)=>{const[t,n,s]=e.map(h=>h.evaluate(r));if(t>n||t===n)return t;let c;if(typeof s=="string")c=function(h){let f=0;if(h.length===0)return f;for(let p=0;p<h.length;p++)f=(f<<5)-f+h.charCodeAt(p),f&=f;return f}(s);else{if(typeof s!="number")throw new st(`Invalid seed input: ${s}`);c=s}return t+Nf(c)()*(n-t)}]});class tu{constructor(e,t,n,s,c){this.expression=e,this._warningHistory={},this._scope=n,this._options=s,this._iconImageUseTheme=c,this._evaluator=new no(n,s,c),this._defaultValue=t?function(h){return h.type==="color"&&(eu(h.default)||Array.isArray(h.default))?new jt(0,0,0,0):h.type==="color"?jt.parse(h.default)||null:h.default===void 0?null:h.default}(t):null,this._enumValues=t&&t.type==="enum"?t.values:null,this.configDependencies=Kc(e),this.isIndoorDependent=Qc(e)}evaluateWithoutErrorHandling(e,t,n,s,c,h,f,p){return this._evaluator.globals=e,this._evaluator.feature=t,this._evaluator.featureState=n,this._evaluator.canonical=s||null,this._evaluator.availableImages=c||null,this._evaluator.formattedSection=h,this._evaluator.featureTileCoord=f||null,this._evaluator.featureDistanceData=p||null,this.expression.evaluate(this._evaluator)}evaluate(e,t,n,s,c,h,f,p,g){this._evaluator||(this._evaluator=new no(this._scope,this._options,this._iconImageUseTheme)),this._evaluator.globals=e,this._evaluator.feature=t||null,this._evaluator.featureState=n||null,this._evaluator.canonical=s||null,this._evaluator.availableImages=c||null,this._evaluator.formattedSection=h||null,this._evaluator.featureTileCoord=f||null,this._evaluator.featureDistanceData=p||null,this._evaluator.iconImageUseTheme=g||null;try{const x=this.expression.evaluate(this._evaluator);if(x==null||typeof x=="number"&&x!=x)return this._defaultValue;if(this._enumValues&&!(x in this._enumValues))throw new st(`Expected value to be one of ${Object.keys(this._enumValues).map(b=>JSON.stringify(b)).join(", ")}, but found ${JSON.stringify(x)} instead.`);return x}catch(x){const b=x;return this._warningHistory[b.message]||(this._warningHistory[b.message]=!0,typeof console<"u"&&console.warn(`Failed to evaluate expression "${JSON.stringify(this.expression.serialize())}". ${b.message}`)),this._defaultValue}}}function El(r){return Array.isArray(r)&&r.length>0&&typeof r[0]=="string"&&r[0]in Sa}function Co(r,e,t,n,s){const c=new Nc(Sa,[],e?function(f){const p={color:Lr,string:Yt,number:at,enum:Yt,boolean:Kt,formatted:cl,resolvedImage:ul};return f.type==="array"?Fr(p[f.value]||Ht,f.length):p[f.type]}(e):void 0,void 0,void 0,t,n,s),h=c.parse(r,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return h?jf(new tu(h,e,t,n,s)):so(c.errors)}class Ia{constructor(e,t,n,s){this.kind=e,this._styleExpression=t,this.isLightConstant=n,this.isLineProgressConstant=s,this.isStateDependent=e!=="constant"&&!ga(t.expression),this.configDependencies=Kc(t.expression),this.isIndoorDependent=Qc(t.expression)}evaluateWithoutErrorHandling(e,t,n,s,c,h){return this._styleExpression.evaluateWithoutErrorHandling(e,t,n,s,c,h)}evaluate(e,t,n,s,c,h,f){return this._styleExpression.evaluate(e,t,n,s,c,h,void 0,void 0,f)}}class Ea{constructor(e,t,n,s,c,h){this.kind=e,this.zoomStops=n,this._styleExpression=t,this.isStateDependent=e!=="camera"&&!ga(t.expression),this.isIndoorDependent=Qc(t.expression),this.isLightConstant=c,this.isLineProgressConstant=h,this.configDependencies=Kc(t.expression),this.interpolationType=s}evaluateWithoutErrorHandling(e,t,n,s,c,h){return this._styleExpression.evaluateWithoutErrorHandling(e,t,n,s,c,h)}evaluate(e,t,n,s,c,h){return this._styleExpression.evaluate(e,t,n,s,c,h)}interpolationFactor(e,t,n){return this.interpolationType?on.interpolationFactor(this.interpolationType,e,t,n):0}}function qf(r,e,t,n,s){if((r=Co(r,e,t,n,s)).result==="error")return r;const c=r.value.expression,h=Ps(c);if(!h&&!Jc(e))return so([new Hr("","data expressions not supported")]);const f=oo(c,["zoom","pitch","distance-from-center"]);if(!f&&!Rh(e))return so([new Hr("","zoom expressions not supported")]);const p=oo(c,["measure-light"]);if(!p&&!Dh(e))return so([new Hr("","measure-light expression not supported")]);const g=oo(c,["line-progress"]);if(!g&&!function(w){return Ph(w.expression,"line-progress")}(e))return so([new Hr("","line-progress expression not supported")]);const x=e.expression&&e.expression.relaxZoomRestriction,b=iu(c);return b||f||x?b instanceof Hr?so([b]):b instanceof on&&!zh(e)?so([new Hr("",'"interpolate" expressions cannot be used with this property')]):jf(b?new Ea(h&&g?"camera":"composite",r.value,b.labels,b instanceof on?b.interpolation:void 0,p,g):new Ia(h&&g?"constant":"source",r.value,p,g)):so([new Hr("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression, or in the properties of atmosphere.')])}
1class Wn{constructor(e,t){this._parameters=e,this._specification=t,Object.assign(this,zs(this._parameters,this._specification))}static deserialize(e){return new Wn(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function iu(r){let e=null;if(r instanceof Ta)e=iu(r.result);else if(r instanceof qc){for(const t of r.args)if(e=iu(t),e)break}else(r instanceof vl||r instanceof on)&&r.input instanceof lr&&r.input.name==="zoom"&&(e=r);return e instanceof Hr||r.eachChild(t=>{const n=iu(t);n instanceof Hr?e=n:e&&n&&e!==n&&(e=new Hr("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}var Fh,Aa,Xm=function(){if(Aa)return Fh;Aa=1,Fh=e;var r=3;function e(t,n,s){var c=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;var h=new Int32Array(this.arrayBuffer);t=h[0],this.d=(n=h[1])+2*(s=h[2]);for(var f=0;f<this.d*this.d;f++){var p=h[r+f],g=h[r+f+1];c.push(p===g?null:h.subarray(p,g))}var x=h[r+c.length+1];this.keys=h.subarray(h[r+c.length],x),this.bboxes=h.subarray(x),this.insert=this._insertReadonly}else{this.d=n+2*s;for(var b=0;b<this.d*this.d;b++)c.push([]);this.keys=[],this.bboxes=[]}this.n=n,this.extent=t,this.padding=s,this.scale=n/t,this.uid=0;var w=s/n*t;this.min=-w,this.max=t+w}return e.prototype.insert=function(t,n,s,c,h){this._forEachCell(n,s,c,h,this._insertCell,this.uid++),this.keys.push(t),this.bboxes.push(n),this.bboxes.push(s),this.bboxes.push(c),this.bboxes.push(h)},e.prototype._insertReadonly=function(){throw"Cannot insert into a GridIndex created from an ArrayBuffer."},e.prototype._insertCell=function(t,n,s,c,h,f){this.cells[h].push(f)},e.prototype.query=function(t,n,s,c,h){var f=this.min,p=this.max;if(t<=f&&n<=f&&p<=s&&p<=c&&!h)return Array.prototype.slice.call(this.keys);var g=[];return this._forEachCell(t,n,s,c,this._queryCell,g,{},h),g},e.prototype._queryCell=function(t,n,s,c,h,f,p,g){var x=this.cells[h];if(x!==null)for(var b=this.keys,w=this.bboxes,S=0;S<x.length;S++){var E=x[S];if(p[E]===void 0){var A=4*E;(g?g(w[A+0],w[A+1],w[A+2],w[A+3]):t<=w[A+2]&&n<=w[A+3]&&s>=w[A+0]&&c>=w[A+1])?(p[E]=!0,f.push(b[E])):p[E]=!1}}},e.prototype._forEachCell=function(t,n,s,c,h,f,p,g){for(var x=this._convertToCellCoord(t),b=this._convertToCellCoord(n),w=this._convertToCellCoord(s),S=this._convertToCellCoord(c),E=x;E<=w;E++)for(var A=b;A<=S;A++){var P=this.d*A+E;if((!g||g(this._convertFromCellCoord(E),this._convertFromCellCoord(A),this._convertFromCellCoord(E+1),this._convertFromCellCoord(A+1)))&&h.call(this,t,n,s,c,P,f,p,g))return}},e.prototype._convertFromCellCoord=function(t){return(t-this.padding)/this.scale},e.prototype._convertToCellCoord=function(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))},e.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var t=this.cells,n=r+this.cells.length+1+1,s=0,c=0;c<this.cells.length;c++)s+=this.cells[c].length;var h=new Int32Array(n+s+this.keys.length+this.bboxes.length);h[0]=this.extent,h[1]=this.n,h[2]=this.padding;for(var f=n,p=0;p<t.length;p++){var g=t[p];h[r+p]=f,h.set(g,f),f+=g.length}return h[r+t.length]=f,h.set(this.keys,f),h[r+t.length+1]=f+=this.keys.length,h.set(this.bboxes,f),f+=this.bboxes.length,h.buffer},Fh}(),Mo=$o(Xm);const Al={};function Qe(r,e,t={}){Object.defineProperty(r,"_classRegistryKey",{value:e,writable:!1}),Al[e]={klass:r,omit:t.omit||[]}}Qe(Object,"Object"),Mo.serialize=function(r,e){const t=r.toArrayBuffer();return e&&e.add(t),{buffer:t}},Mo.deserialize=function(r){return new Mo(r.buffer)},Object.defineProperty(Mo,"name",{value:"Grid"}),Qe(Mo,"Grid"),delete Fe.prototype.constructor,Qe(jt,"Color"),Qe(Error,"Error"),Qe(Vr,"Formatted"),Qe(ca,"FormattedSection"),Qe(vc,"AJAXError"),Qe(Zr,"ResolvedImage"),Qe(Wn,"StylePropertyFunction"),Qe(tu,"StyleExpression",{omit:["_evaluator"]}),Qe(nn,"ImageId"),Qe(Dn,"ImageVariant"),Qe(Ea,"ZoomDependentExpression"),Qe(Ia,"ZoomConstantExpression"),Qe(lr,"CompoundExpression",{omit:["_evaluate"]});for(const r in Sa)Al[Sa[r]._classRegistryKey]||Qe(Sa[r],`Expression${r}`);function Oh(r){return r&&(r instanceof ArrayBuffer||r.constructor&&r.constructor.name==="ArrayBuffer")}function Jo(r,e){if(r==null||typeof r=="boolean"||typeof r=="number"||typeof r=="string"||r instanceof Boolean||r instanceof Number||r instanceof String||r instanceof Date||r instanceof RegExp)return r;if(Oh(r)||r instanceof ImageBitmap)return e&&e.add(r),r;if(ArrayBuffer.isView(r))return e&&e.add(r.buffer),r;if(r instanceof ImageData)return e&&e.add(r.data.buffer),r;if(Array.isArray(r)){const t=[];for(const n of r)t.push(Jo(n,e));return t}if(r instanceof Map){const t={$name:"Map",entries:[]};for(const[n,s]of r.entries())t.entries.push(Jo(n),Jo(s,e));return t}if(r instanceof Set){const t={$name:"Set"};let n=0;for(const s of r.values())t[++n]=Jo(s);return t}if(typeof r=="bigint")return{$name:"BigInt",value:r.toString()};if(typeof r=="object"){const t=r.constructor,n=t._classRegistryKey;if(!n)throw new Error(`Can't serialize object of unregistered class "${t.name}".`);const s=t.serialize?t.serialize(r,e):{};if(!t.serialize){for(const c in r)r.hasOwnProperty(c)&&(Al[n].omit.indexOf(c)>=0||(s[c]=Jo(r[c],e)));r instanceof Error&&(s.message=r.message)}if(s.$name)throw new Error("$name property is reserved for worker serialization logic.");return n!=="Object"&&(s.$name=n),s}throw new Error("can't serialize object of type "+typeof r)}function es(r){if(r==null||typeof r=="boolean"||typeof r=="number"||typeof r=="string"||r instanceof Boolean||r instanceof Number||r instanceof String||r instanceof Date||r instanceof RegExp||Oh(r)||r instanceof ImageBitmap||ArrayBuffer.isView(r)||r instanceof ImageData)return r;if(Array.isArray(r))return r.map(es);if(typeof r=="object"){const e=r.$name||"Object";if(e==="Map"){const s=r.entries||[],c=new Map;for(let h=0;h<s.length;h+=2)c.set(es(s[h]),es(s[h+1]));return c}if(e==="Set"){const s=new Set;for(const c of Object.keys(r))c!=="$name"&&s.add(es(r[c]));return s}if(e==="BigInt")return BigInt(r.value);const{klass:t}=Al[e];if(!t)throw new Error(`Can't deserialize unregistered class "${e}".`);if(t.deserialize)return t.deserialize(r);const n=Object.create(t.prototype);for(const s of Object.keys(r))s!=="$name"&&(n[s]=es(r[s]));return n}throw new Error("can't deserialize object of type "+typeof r)}const ru=r=>r>=1536&&r<=1791,nu=r=>r>=1872&&r<=1919,ou=r=>r>=2208&&r<=2303,Po=r=>r>=11904&&r<=12031,Bh=r=>r>=12032&&r<=12255,kh=r=>r>=12272&&r<=12287,Ca=r=>r>=12288&&r<=12351,Ma=r=>r>=12352&&r<=12447,Cl=r=>r>=12448&&r<=12543,su=r=>r>=12544&&r<=12591,ao=r=>r>=12704&&r<=12735,$f=r=>r>=12736&&r<=12783,Hf=r=>r>=12784&&r<=12799,Zf=r=>r>=12800&&r<=13055,Wf=r=>r>=13056&&r<=13311,au=r=>r>=13312&&r<=19903,Pa=r=>r>=19968&&r<=40959,Vh=r=>r>=40960&&r<=42127,Nh=r=>r>=42128&&r<=42191,lu=r=>r>=44032&&r<=55215,Xf=r=>r>=63744&&r<=64255,Uh=r=>r>=64336&&r<=65023,Yf=r=>r>=65040&&r<=65055,jh=r=>r>=65072&&r<=65103,Kf=r=>r>=65104&&r<=65135,Gh=r=>r>=65136&&r<=65279,qh=r=>r>=65280&&r<=65519;function $h(r){for(const e of r)if(cu(e.charCodeAt(0)))return!0;return!1}function Ym(r){for(const e of r)if(!Km(e.charCodeAt(0)))return!1;return!0}function Km(r){return!(ru(r)||nu(r)||ou(r)||Uh(r)||Gh(r))}function Qm(r){return!(r<11904||!(ao(r)||su(r)||jh(r)||Xf(r)||Wf(r)||Po(r)||$f(r)||Ca(r)||au(r)||Pa(r)||Zf(r)||qh(r)||Ma(r)||kh(r)||Bh(r)||Hf(r)||Cl(r)||Yf(r)||Nh(r)||Vh(r)))}function cu(r){return!(r!==746&&r!==747&&(r<4352||!(ao(r)||su(r)||jh(r)&&!(r>=65097&&r<=65103)||Xf(r)||Wf(r)||Po(r)||$f(r)||!(!Ca(r)||r>=12296&&r<=12305||r>=12308&&r<=12319||r===12336)||au(r)||Pa(r)||Zf(r)||(e=>e>=12592&&e<=12687)(r)||(e=>e>=43360&&e<=43391)(r)||(e=>e>=55216&&e<=55295)(r)||(e=>e>
vendor: 11,887 bytes, line 1
1=4352&&e<=4607)(r)||lu(r)||Ma(r)||kh(r)||(e=>e>=12688&&e<=12703)(r)||Bh(r)||Hf(r)||Cl(r)&&r!==12540||!(!qh(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)||!(!Kf(r)||r>=65112&&r<=65118||r>=65123&&r<=65126)||(e=>e>=5120&&e<=5759)(r)||(e=>e>=6320&&e<=6399)(r)||Yf(r)||(e=>e>=19904&&e<=19967)(r)||Vh(r)||Nh(r))))}function Da(r){return r===12312||r===12313||r===12316||r===12540||r===12448}function Hh(r){return!(cu(r)||function(e){return!!((t=>t>=128&&t<=255)(e)&&(e===167||e===169||e===174||e===177||e===188||e===189||e===190||e===215||e===247)||(t=>t>=8192&&t<=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)||(t=>t>=8448&&t<=8527)(e)||(t=>t>=8528&&t<=8591)(e)||(t=>t>=8960&&t<=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)||(t=>t>=9216&&t<=9279)(e)&&e!==9251||(t=>t>=9280&&t<=9311)(e)||(t=>t>=9312&&t<=9471)(e)||(t=>t>=9632&&t<=9727)(e)||(t=>t>=9728&&t<=9983)(e)&&!(e>=9754&&e<=9759)||(t=>t>=11008&&t<=11263)(e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||Ca(e)||Cl(e)||(t=>t>=57344&&t<=63743)(e)||jh(e)||Kf(e)||qh(e)||e===8734||e===8756||e===8757||e>=9984&&e<=10087||e>=10102&&e<=10131||e===65532||e===65533)}(r))}function Qf(r){return ru(r)||nu(r)||ou(r)||Uh(r)||Gh(r)}function Ml(r){return r>=1424&&r<=2303||Uh(r)||Gh(r)}function Jm(r,e){return!(!e&&Ml(r)||r>=2304&&r<=3583||r>=3840&&r<=4255||(t=>t>=6016&&t<=6143)(r))}function e_(r){for(const e of r)if(Ml(e.charCodeAt(0)))return!0;return!1}const fr={unavailable:"unavailable",deferred:"deferred",loading:"loading",parsing:"parsing",parsed:"parsed",loaded:"loaded",error:"error"};let uu=null,pr=fr.unavailable,ts=null;const Jf=function(r){r&&typeof r=="string"&&r.indexOf("NetworkError")>-1&&(pr=fr.error),uu&&uu(r)};function Zh(){Wh.fire(new Hn("pluginStateChange",{pluginStatus:pr,pluginURL:ts}))}const Wh=new na,Xh=function(){return pr},ep=function(){if(pr!==fr.deferred||!ts)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");pr=fr.loading,Zh(),ts&&nl({url:ts},r=>{r?Jf(r):(pr=fr.loaded,Zh())})},lo={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>pr===fr.loaded||lo.applyArabicShaping!=null,isLoading:()=>pr===fr.loading,setState(r){pr=r.pluginStatus,ts=r.pluginURL},isParsing:()=>pr===fr.parsing,isParsed:()=>pr===fr.parsed,getPluginURL:()=>ts},Yh=function(){lo.isLoading()||lo.isLoaded()||Xh()!=="deferred"||ep()};class Zt{constructor(e,t){this.zoom=e,t?(this.now=t.now,this.fadeDuration=t.fadeDuration,this.transition=t.transition,this.pitch=t.pitch,this.brightness=t.brightness,this.worldview=t.worldview,this.activeFloors=t.activeFloors):(this.now=0,this.fadeDuration=0,this.transition={},this.pitch=0,this.brightness=0)}isSupportedScript(e){return function(t,n){for(const s of t)if(!Jm(s.charCodeAt(0),n))return!1;return!0}(e,lo.isLoaded())}}class Pl{constructor(e,t,n,s,c){this.property=e,this.value=t,this.expression=function(h,f,p,g,x){if(eu(h))return new Wn(h,f);if(El(h)||Array.isArray(h)&&h.length>0){const b=qf(h,f,p,g,x);if(b.result==="error")throw new Error(b.value.map(w=>`${w.key}: ${w.message}`).join(", "));return b.value}{let b=h;return typeof h=="string"&&f.type==="color"&&(b=jt.parse(h)),{kind:"constant",configDependencies:new Set,isIndoorDependent:!1,evaluate:()=>b}}}(t===void 0?e.specification.default:t,e.specification,n,s,c)}isIndoorDependent(){return this.expression.isIndoorDependent}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(e,t,n,s){return this.property.possiblyEvaluate(this,e,t,n,s)}}class Dl{constructor(e,t,n,s){this.property=e,this.value=new Pl(e,void 0,t,n,s)}transitioned(e,t){return new Kh(this.property,this.value,t,Object.assign({},e.transition,this.transition),e.now)}untransitioned(){return new Kh(this.property,this.value,null,{},0)}}class Ra{constructor(e,t,n,s){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues),this._scope=t,this._options=n,this._iconImageUseTheme=s,this._isIndoorDependent=!1,this.configDependencies=new Set}getValue(e){return Xe(this._values[e].value.value)}setValue(e,t){this._values.hasOwnProperty(e)||(this._values[e]=new Dl(this._values[e].property,this._scope,this._options,this._iconImageUseTheme)),this._values[e].value=new Pl(this._values[e].property,t===null?void 0:Xe(t),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,t){t&&(this._options=t);const n=this._properties.properties;if(e)for(const s in e){const c=e[s];if(s.endsWith("-transition")){const h=s.slice(0,-11);n[h]&&this.setTransition(h,c)}else n.hasOwnProperty(s)&&this.setValue(s,c)}}getTransition(e){return Xe(this._values[e].transition)}setTransition(e,t){this._values.hasOwnProperty(e)||(this._values[e]=new Dl(this._values[e].property)),this._values[e].transition=Xe(t)||void 0}serialize(){const e={};for(const t of Object.keys(this._values)){const n=this.getValue(t);n!==void 0&&(e[t]=n);const s=this.getTransition(t);s!==void 0&&(e[`${t}-transition`]=s)}return e}transitioned(e,t){const n=new tp(this._properties);for(const s of Object.keys(this._values))n._values[s]=this._values[s].transitioned(e,t._values[s]);return n}untransitioned(){const e=new tp(this._properties);for(const t of Object.keys(this._values))e._values[t]=this._values[t].untransitioned();return e}isIndoorDependent(){return this._isIndoorDependent}}class Kh{constructor(e,t,n,s,c){const h=s.delay||0,f=s.duration||0;c=c||0,this.property=e,this.value=t,this.begin=c+h,this.end=this.begin+f,e.specification.transition&&(s.delay||s.duration)&&(this.prior=n)}possiblyEvaluate(e,t,n){const s=e.now||0,c=this.value.possiblyEvaluate(e,t,n),h=this.prior;if(h){if(s>this.end)return this.prior=null,c;if(this.value.isDataDriven())return this.prior=null,c;if(s<this.begin)return h.possiblyEvaluate(e,t,n);{const f=(s-this.begin)/(this.end-this.begin);return this.property.interpolate(h.possiblyEvaluate(e,t,n),c,el(f))}}return c}}class tp{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,t,n){const s=new rs(this._properties);for(const c of Object.keys(this._values))s._values[c]=this._values[c].possiblyEvaluate(e,t,n);return s}hasTransition(){for(const e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class Qh{constructor(e,t,n,s){this._properties=e,this._values=Object.create(e.defaultPropertyValues),this._scope=t,this._options=n,this._iconImageUseTheme=s,this._isIndoorDependent=!1,this.configDependencies=new Set}getValue(e){return Xe(this._values[e].value)}setValue(e,t){this._values[e]=new Pl(this._values[e].property,t===null?void 0:Xe(t),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 t of Object.keys(this._values)){const n=this.getValue(t);n!==void 0&&(e[t]=n)}return e}possiblyEvaluate(e,t,n,s){const c=new rs(this._properties);for(const h of Object.keys(this._values))c._values[h]=this._values[h].possiblyEvaluate(e,t,n,s);return c}isIndoorDependent(){return this._isIndoorDependent}}class is{constructor(e,t,n,s){this.property=e,this.value=t,this.parameters=n,this.iconImageUseTheme=s}isConstant(){return this.value.kind==="constant"}constantOr(e){return this.value.kind==="constant"?this.value.value:e}evaluate(e,t,n,s,c){return this.property.evaluate(this.value,this.parameters,e,t,n,s,this.iconImageUseTheme,c)}}class rs{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class ke{constructor(e){this.specification=e}possiblyEvaluate(e,t){return e.expression.evaluate(t)}interpolate(e,t,n){const s=ll[this.specification.type];return s?s(e,t,n):e}}class Ge{constructor(e,t){this.specification=e,this.overrides=t}possiblyEvaluate(e,t,n,s,c){return e.expression.kind==="constant"||e.expression.kind==="camera"?new is(this,{kind:"constant",value:e.expression.evaluate(t,null,{},n,s,void 0,c)},t):new is(this,e.expression,t,c)}interpolate(e,t,n){if(e.value.kind!=="constant"||t.value.kind!=="constant")return e;if(e.value.value===void 0||t.value.value===void 0)return new is(this,{kind:"constant",value:void 0},e.parameters);const s=ll[this.specification.type];return s?new is(this,{kind:"constant",value:s(e.value.value,t.value.value,n)},e.parameters):e}evaluate(e,t,n,s,c,h,f,p){return e.kind==="constant"?e.value:e.evaluate(t,n,s,c,h,p,f)}}class Ls{constructor(e){this.specification=e}possiblyEvaluate(e,t,n,s){return!!e.expression.evaluate(t,null,{},n,s)}interpolate(){return!1}}class Ci{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];const t=new Zt(0,{});for(const n in e){const s=e[n],c=s.specification;c&&c.overridable&&this.overridableProperties.push(n);const h=this.defaultPropertyValues[n]=new Pl(s,void 0),f=this.defaultTransitionablePropertyValues[n]=new Dl(s);this.defaultTransitioningPropertyValues[n]=f.untransitioned(),this.defaultPossiblyEvaluatedValues[n]=h.possiblyEvaluate(t)}}}Qe(Ge,"DataDrivenProperty"),Qe(ke,"DataConstantProperty"),Qe(Ls,"ColorRampProperty");var ue=JSON.parse('{"$version":8,"$root":{"version":{"type":"enum","values":[8]},"fragment":{"type":"boolean"},"name":{"type":"string"},"metadata":{"type":"*"},"center":{"type":"array","value":"number"},"zoom":{"type":"number"},"bearing":{"type":"number","default":0,"period":360},"pitch":{"type":"number","default":0},"light":{"type":"light"},"lights":{"type":"array","value":"light-3d"},"terrain":{"type":"terrain","optional":true},"fog":{"type":"fog"},"snow":{"type":"snow"},"rain":{"type":"rain"},"camera":{"type":"camera"},"color-theme":{"type":"colorTheme"},"indoor":{"type":"indoor"},"imports":{"type":"array","value":"import"},"iconsets":{"type":"iconsets"},"schema":{"type":"schema"},"sources":{"type":"sources"},"sprite":{"type":"string"},"glyphs":{"type":"string","default":"mapbox://fonts/mapbox/{fontstack}/{range}.pbf"},"transition":{"type":"transition"},"projection":{"type":"projection"},"layers":{"type":"array","value":"layer"},"models":{"type":"models"},"featuresets":{"type":"featuresets"}},"featuresets":{"*":{"type":"featureset"}},"featureset":{"metadata":{"type":"*"},"selectors":{"type":"array","value":"selector"}},"selector":{"layer":{"type":"string"},"properties":{"type":"selectorProperty"},"featureNamespace":{"type":"string"},"_uniqueFeatureID":{"type":"boolean"}},"selectorProperty":{"*":{"type":"*"}},"model":{"type":"string"},"import":{"id":{"type":"string"},"url":{"type":"string"},"config":{"type":"config"},"data":{"type":"$root"},"color-theme":{"type":"colorTheme","optional":true}},"config":{"*":{"type":"*"}},"schema":{"*":{"type":"option"}},"option":{"default":{"type":"*","expression":{}},"type":{"type":"enum","values":{"string":1,"number":1,"boolean":1,"color":1}},"array":{"type":"boolean"},"minValue":{"type":"number"},"maxValue":{"type":"number"},"stepValue":{"type":"number"},"values":{"type":"array","value":"*"},"metadata":{"type":"*"}},"models":{"*":{"type":"model"}}
1,"light-3d":{"id":{"type":"string"},"properties":{"type":"properties"},"type":{"type":"enum","values":{"ambient":{},"directional":{},"flat":{}}}},"properties":["properties_light_directional","properties_light_ambient","properties_light_flat"],"properties_light_directional":{"direction":{"type":"array","default":[210,30],"minimum":[0,0],"maximum":[360,90],"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"use-theme":true,"transition":true},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"cast-shadows":{"type":"boolean","default":false},"shadow-quality":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"parameters":["zoom"]}},"shadow-intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"shadow-draw-before-layer":{"type":"string"}},"properties_light_ambient":{"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"use-theme":true,"transition":true},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"properties_light_flat":{"anchor":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"use-theme":true,"transition":true},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"iconsets":{"*":{"type":"iconset"}},"iconset":["iconset_sprite","iconset_source"],"iconset_sprite":{"type":{"type":"enum","values":{"sprite":1}},"url":{"type":"string"}},"iconset_source":{"type":{"type":"enum","values":{"source":1}},"source":{"type":"string"}},"sources":{"*":{"type":"source"}},"source":["source_vector","source_raster","source_raster_dem","source_raster_array","source_geojson","source_video","source_image","source_model"],"source_vector":{"type":{"type":"enum","values":{"vector":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"extra_bounds":{"type":"array","value":{"type":"array","value":"number","length":4}},"scheme":{"type":"enum","values":{"xyz":1,"tms":1},"default":"xyz"},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"attribution":{"type":"string"},"promoteId":{"type":"promoteId"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster":{"type":{"type":"enum","values":{"raster":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"extra_bounds":{"type":"array","value":{"type":"array","value":"number","length":4}},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"scheme":{"type":"enum","values":{"xyz":1,"tms":1},"default":"xyz"},"attribution":{"type":"string"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster_dem":{"type":{"type":"enum","values":{"raster-dem":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"extra_bounds":{"type":"array","value":{"type":"array","value":"number","length":4}},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"attribution":{"type":"string"},"encoding":{"type":"enum","values":{"terrarium":1,"mapbox":1},"default":"mapbox"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster_array":{"type":{"type":"enum","values":{"raster-array":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"extra_bounds":{"type":"array","value":{"type":"array","value":"number","length":4}},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"attribution":{"type":"string"},"rasterLayers":{"type":"*"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_geojson":{"type":{"type":"enum","values":{"geojson":1}},"data":{"type":"*"},"maxzoom":{"type":"number","default":18},"minzoom":{"type":"number","default":0},"attribution":{"type":"string"},"buffer":{"type":"number","default":128,"maximum":512,"minimum":0},"filter":{"type":"*"},"tolerance":{"type":"number","default":0.375},"cluster":{"type":"boolean","default":false},"clusterRadius":{"type":"number","default":50,"minimum":0}
1,"clusterMaxZoom":{"type":"number"},"clusterMinPoints":{"type":"number"},"clusterProperties":{"type":"*"},"lineMetrics":{"type":"boolean","default":false},"generateId":{"type":"boolean","default":false},"promoteId":{"type":"promoteId"},"dynamic":{"type":"boolean","default":false}},"source_video":{"type":{"type":"enum","values":{"video":1}},"urls":{"type":"array","value":"string"},"coordinates":{"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"source_image":{"type":{"type":"enum","values":{"image":1}},"url":{"type":"string"},"coordinates":{"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"modelNodeOverride":{"orientation":{"type":"array","value":"number","length":3,"default":[0,0,0],"period":360}},"modelNodeOverrides":{"*":{"type":"modelNodeOverride"}},"modelMaterialOverride":{"model-color":{"type":"color"},"model-color-mix-intensity":{"type":"number"},"model-opacity":{"type":"number"},"model-emissive-strength":{"type":"number"}},"modelMaterialOverrides":{"*":{"type":"modelMaterialOverride"}},"modelSourceModel":{"uri":{"type":"string"},"position":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[-180,-90],"maximum":[180,90]},"orientation":{"type":"array","value":"number","length":3,"default":[0,0,0],"period":360},"nodeOverrides":{"type":"modelNodeOverrides"},"materialOverrides":{"type":"modelMaterialOverrides"},"nodeOverrideNames":{"type":"array","value":"string"},"materialOverrideNames":{"type":"array","value":"string"},"featureProperties":{"type":"*"}},"modelSourceModels":{"*":{"type":"modelSourceModel"}},"source_model":{"type":{"type":"enum","values":{"model":1,"batched-model":1}},"url":{"type":"string"},"maxzoom":{"type":"number","default":18},"minzoom":{"type":"number","default":0},"tiles":{"type":"array","value":"string"},"models":{"type":"modelSourceModels"}},"layer":{"id":{"type":"string"},"type":{"type":"enum","values":{"fill":{},"line":{},"symbol":{},"circle":{},"heatmap":{},"fill-extrusion":{},"building":{},"raster":{},"raster-particle":{},"hillshade":{},"model":{},"background":{},"sky":{},"slot":{},"clip":{}}},"metadata":{"type":"*"},"source":{"type":"string"},"source-layer":{"type":"string"},"slot":{"type":"string"},"minzoom":{"type":"number","minimum":0,"maximum":24},"maxzoom":{"type":"number","minimum":0,"maximum":24},"filter":{"type":"filter"},"layout":{"type":"layout"},"paint":{"type":"paint"},"appearances":{"type":"array","value":"appearance","supported-layer-types":["symbol"]}},"appearance":{"condition":{"type":"boolean","expression":{"interpolated":true,"parameters":["zoom","pitch","feature","feature-state","measure-light","distance-from-center"]},"property-type":"data-driven"},"name":{"type":"string"},"properties":{"type":"*"}},"layout":["layout_clip","layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_building","layout_symbol","layout_raster","layout_raster-particle","layout_hillshade","layout_background","layout_sky","layout_model"],"layout_background":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_sky":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_model":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}},"model-id":{"type":"string","default":"","property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"model-allow-density-reduction":{"type":"boolean","default":true}},"layout_clip":{"clip-layer-types":{"type":"array","value":"enum","values":{"model":1,"symbol":1},"default":[],"expression":{}},"clip-layer-scope":{"type":"array","value":"string","default":[],"expression":{}},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_fill":{"fill-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}},"fill-elevation-reference":{"type":"enum","values":{"none":1,"hd-road-base":1,"hd-road-markup":1},"default":"none","expression":{}},"fill-construct-bridge-guard-rail":{"type":"boolean","default":"true","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"}},"layout_circle":{"circle-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"circle-elevation-reference":{"type":"enum","values":{"none":1,"hd-road-markup":1},"default":"none","expression":{}},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_heatmap":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_fill-extrusion":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}},"fill-extrusion-edge-radius":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"source-max-zoom":{"type":"number","minimum":0,"maximum":24}},"layout_building":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}},"building-facade":{"type":"boolean","default":false,"expression":{"parameters":["feature"]},"property-type":"data-driven"},"building-facade-floors":{"type":"number","minimum":1,"maximum":200,"default":3,"property-type":"data-driven","expression":{"parameters":["feature"]}},"building-facade-unit-width":{"type":"number","minimum":1,"maximum":20,"default":3.1,"property-type":"data-driven","expression":{"parameters":["feature"]}},"building-facade-window":{"type":"array","length":2,"value":"number","minimum":0.1,"maximum":1,"default":[0.9,0.9],"property-type":"data-driven","expression":{"parameters":["feature"]}},"building-roof-shape":{"type":"enum","values":{"flat":1,"hipped":1,"gabled":1,"parapet":1,"mansard":1,"skillion":1,"pyramidal":1},"default":"flat","expression":{"parameters":["feature"]},"property-type":"data-driven"},"building-height":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{},"property-type":"data-driven"},"building-base":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{},"property-type":"data-driven"},"building-flood-light-wall-radius":{"property-type":"data-driven","type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"building-flood-light-ground-radius":{"property-type":"data-driven","type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"building-flip-roof-orientation":{"property-type":"data-driven","type":"boolean","default":false,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}}},"layout_line":{"line-cap":{"type":"enum","values":{"butt":1,"round":1,"square":1},"default":"butt","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-join":{"type":"enum","values":{"bevel":1,"round":1,"miter":1,"none":1},"default":"miter","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{"type":"number","default":2,"expression":{"interpolated":true,"parameters":["zoom"]}},"line-round-limit":{"type":"number","default":1.05,"expression":{"interpolated":true,"parameters":["zoom"]}},"line-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-z-offset":{"type":"number","default":0,"expression":{"parameters":["zoom","feature","line-progress"]},"property-type":"data-driven"},"line-elevation-reference":{"type":"enum","values":{"none":1,"sea":1,"ground":1,"hd-road-markup":1},"default":"none","expression":{}},"line-cross-slope":{"type":"number","expression":{}},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}},"line-width-unit":{"type":"enum","values":{"pixels":1,"meters":1},"default":"pixels","expression":{"parameters":["zoom"]}},"line-elevation-ground-scale":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","feature","line-progress"]},"transition":true,"property-type":"data-driven"}},"layout_symbol":{"symbol-placement":{"type":"enum","values":{"point":1,"line":1,"line-center":1},"default":"point","expression":{"parameters":["zoom"]}},"symbol-spacing":{"type":"number","default":250,"minimum":1,"expression":{"interpolated":true,"parameters":["zoom"]}},"symbol-avoid-edges":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"symbol-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{"type":"enum","values":{"auto":1,"viewport-y":1,"source":1},"default":"auto","expression":{"parameters":["zoom"]}},"symbol-z-elevate":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"symbol-elevation-reference":{"type":"enum","values":{"sea":1,"ground":1,"hd-road-markup":1},"default":"ground","expression":{"parameters":["zoom"]}},"icon-allow-overlap":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-ignore-placement":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-optional":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-rotation-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]}},"icon-size":{"type":"number","default":1,"minimum":0,"appearance":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-size-scale-range":{"type":"array","value":"number","length":2,"default":[0.8,2],"minimum":[0.1,0.1],"maximum":[10,10],"expression":{}},"icon-text-fit":{"type":"enum","values":{"none":1,"width":1,"height":1,"both":1},"default":"none","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit-padding":{"type":"array","value":"number","length":4,"default":[0,0,0,0],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-image":{"type":"resolvedImage","tokens":true,"appearance":true,"use-theme":true,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{"type":"number","default":0,"period":360,"appearance":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{"type":"number","default":2,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]}},"icon-keep-upright":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-offset":{"type":"array","value":"number","length":2,"default":[0,0],"appearance":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"}
1,"icon-anchor":{"type":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]}},"text-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]}},"text-rotation-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]}},"text-field":{"type":"formatted","default":"","tokens":true,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-font":{"type":"array","value":"string","default":["Open Sans Regular","Arial Unicode MS Regular"],"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-size":{"type":"number","default":16,"minimum":0,"appearance":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-size-scale-range":{"type":"array","value":"number","length":2,"default":[0.8,2],"minimum":[0.1,0.1],"maximum":[10,10],"expression":{}},"text-max-width":{"type":"number","default":10,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{"type":"number","default":1.2,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-letter-spacing":{"type":"number","default":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-justify":{"type":"enum","values":{"auto":1,"left":1,"center":1,"right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{"type":"number","default":0,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["zoom","feature"]}},"text-variable-anchor":{"type":"array","value":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"expression":{"parameters":["zoom"]}},"text-anchor":{"type":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{"type":"number","default":45,"expression":{"interpolated":true,"parameters":["zoom"]}},"text-writing-mode":{"type":"array","value":"enum","values":{"horizontal":1,"vertical":1},"expression":{"parameters":["zoom"]}},"text-rotate":{"type":"number","default":0,"period":360,"appearance":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-padding":{"type":"number","default":2,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]}},"text-keep-upright":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"text-transform":{"type":"enum","values":{"none":1,"uppercase":1,"lowercase":1},"default":"none","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-offset":{"type":"array","value":"number","length":2,"default":[0,0],"appearance":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"text-ignore-placement":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"text-optional":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_raster":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_raster-particle":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_hillshade":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"filter":{"type":"array","value":"*"},"filter_symbol":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature","pitch","distance-from-center"]}},"filter_fill":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_hillshade":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_raster":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_raster-particle":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_clip":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_model":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_line":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_circle":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_fill-extrusion":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_building":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_heatmap":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_operator":{"type":"enum","values":{"==":1,"!=":1,">":1,">=":1,"<":1,"<=":1,"in":1,"!in":1,"all":1,"any":1,"none":1,"has":1,"!has":1}},"geometry_type":{"type":"enum","values":{"Point":1,"LineString":1,"Polygon":1}},"function":{"expression":{"type":"expression"},"stops":{"type":"array","value":"function_stop"},"base":{"type":"number","default":1,"minimum":0},"property":{"type":"string","default":"$zoom"},"type":{"type":"enum","values":{"identity":1,"exponential":1,"interval":1,"categorical":1},"default":"exponential"},"colorSpace":{"type":"enum","values":{"rgb":1,"lab":1,"hcl":1},"default":"rgb"},"default":{"type":"*"}},"function_stop":{"type":"array","minimum":0,"maximum":24,"value":["number","color"],"length":2},"expression":{"type":"array","value":"*","minimum":1},"fog":{"range":{"type":"array","default":[0.5,10],"minimum":-20,"maximum":20,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"high-color":{"type":"color","default":"#245cdf","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"space-color":{"type":"color","default":["interpolate",["linear"],["zoom"],4,"#010b19",7,"#367ab9"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"horizon-blend":{"type":"number","default":["interpolate",["linear"],["zoom"],4,0.2,7,0.1],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"star-intensity":{"type":"number","default":["interpolate",["linear"],["zoom"],5,0.35,6,0],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vertical-range":{"type":"array","default":[0,0],"minimum":0,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}}},"snow":{"density":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.85],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.3],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette-color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"center-thinning":{"type":"number","default":0.4,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"direction":{"type":"array","default":[0,50],"minimum":0,"maximum":360,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"flake-size":{"type":"number","default":0.71,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true}},"rain":{"density":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.5],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"color":{"type":"color","default":["interpolate",["linear"],["measure-light","brightness"],0,"#03113d",0.3,"#a8adbc"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"opacity":{"type":"number","default":["interpolate",["linear"],["measure-light","brightness"],0,0.88,1,0.7],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,1],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette-color":{"type":"color","default":["interpolate",["linear"],["measure-light","brightness"],0,"#001736",0.3,"#464646"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"center-thinning":{"type":"number","default":0.57,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"direction":{"type":"array","default":[0,80],"minimum":0,"maximum":360,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"droplet-size":{"type":"array","default":[2.6,18.2],"minimum":0,"maximum":50,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"distortion-strength":{"type":"number","default":0.7,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true}},"camera":{"camera-projection":{"type":"enum","values":{"perspective":1,"orthographic":1},"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"default":"perspective"}},"colorTheme":{"data":{"type":"string","expression":{}}},"indoor_source":{"sourceId":{"type":"string"},"sourceLayers":{"type":"array","value":"string"}},"indoor":{"*":{"type":"indoor_source"}},"light":{"anchor":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"use-theme":true,"transition":true},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"projection":{"name":{"type":"enum","values":{"albers":1,"equalEarth":1,"equirectangular":1,"lambertConformalConic":1,"mercator":1,"naturalEarth":1,"winkelTripel":1,"globe":1},"default":"mercator"},"center":{"type":"array","length":2,"value":"number","minimum":[-180,-90],"maximum":[180,90]},"parallels":{"type":"array","length":2,"value":"number","minimum":[-90,-90],"maximum":[90,90]}},"terrain":{"source":{"type":"string"},"exaggeration":{"type":"number","default":1,"minimum":0,"maximum":1000,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"paint":["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_building","paint_symbol","paint_raster","paint_raster-particle","paint_hillshade","paint_background","paint_sky","paint_model"],"paint_fill":{"fill-antialias":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-outline-color":{"type":"color","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"fill-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-z-offset":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-bridge-guard-rail-color":{"type":"color","default":"rgba(241, 236, 225, 255)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature"]},"property-type":"data-driven"},"fill-tunnel-structure-color":{"type":"color","default":"rgba(241, 236, 225, 255)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature"]},"property-type":"data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","meas
1ure-light"]},"property-type":"data-driven"},"fill-extrusion-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"fill-extrusion-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-extrusion-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-height":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-height-alignment":{"type":"enum","values":{"terrain":1,"flat":1},"default":"flat"},"fill-extrusion-base-alignment":{"type":"enum","values":{"terrain":1,"flat":1},"default":"terrain"},"fill-extrusion-vertical-gradient":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-extrusion-ambient-occlusion-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-wall-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-ground-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-flood-light-color":{"type":"color","default":"#ffffff","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-flood-light-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-flood-light-wall-radius":{"property-type":"data-driven","type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"fill-extrusion-flood-light-ground-radius":{"property-type":"data-driven","type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"fill-extrusion-flood-light-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-vertical-scale":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-rounded-roof":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-extrusion-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"fill-extrusion-front-cutoff":{"type":"array","value":"number","expression":{"interpolated":true,"parameters":["zoom"]},"length":3,"default":[0,0,1],"minimum":[0,0,0],"maximum":[1,1,1]},"fill-extrusion-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"property-type":"data-driven"},"fill-extrusion-line-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-extrusion-cast-shadows":{"type":"boolean","default":true}},"paint_building":{"building-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"building-ambient-occlusion-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"parameters":[]},"transition":true},"building-ambient-occlusion-ground-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"building-ambient-occlusion-ground-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"building-ambient-occlusion-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"building-vertical-scale":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"building-cast-shadows":{"type":"boolean","default":true},"building-color":{"type":"color","default":"rgba(193, 154, 127, 1)","use-theme":true,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"property-type":"data-driven"},"building-emissive-strength":{"type":"number","default":0,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"property-type":"data-driven"},"building-facade-emissive-chance":{"type":"number","default":0.35,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["measure-light","zoom"]}},"building-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"building-front-cutoff":{"type":"array","value":"number","expression":{"interpolated":true,"parameters":["zoom"]},"length":3,"default":[0,0,1],"minimum":[0,0,0],"maximum":[1,1,1]},"building-flood-light-color":{"type":"color","default":"#ffffff","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"building-flood-light-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"building-flood-light-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_line":{"line-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"line-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"line-width":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light","line-progress"]},"property-type":"data-driven"},"line-gap-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-offset":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"}
1,"line-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-dasharray":{"type":"array","value":"number","minimum":0,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"line-gradient":{"type":"color","use-theme":true,"expression":{"interpolated":true,"parameters":["line-progress"]}},"line-trim-offset":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1]},"line-trim-fade-range":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1],"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"line-trim-color":{"type":"color","default":"transparent","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"line-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-driven"},"line-border-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-border-color":{"type":"color","default":"rgba(0, 0, 0, 0)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-occlusion-opacity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"line-blend-mode":{"type":"enum","values":{"default":1,"multiply":1,"additive":1},"default":"default","expression":{"parameters":["zoom"]}}},"paint_circle":{"circle-radius":{"type":"number","default":5,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-blur":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"circle-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"circle-pitch-scale":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"circle-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1},"default":"viewport","expression":{"parameters":["zoom"]}},"circle-stroke-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-stroke-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-stroke-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}}},"paint_heatmap":{"heatmap-radius":{"type":"number","default":30,"minimum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"heatmap-weight":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"heatmap-intensity":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"heatmap-color":{"type":"color","default":["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",0.1,"royalblue",0.3,"cyan",0.5,"lime",0.7,"yellow",1,"red"],"use-theme":true,"expression":{"interpolated":true,"parameters":["heatmap-density"]}},"heatmap-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_symbol":{"icon-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"appearance":true,"property-type":"data-driven"},"icon-occlusion-opacity":{"type":"number","minimum":0,"maximum":1,"default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"appearance":true,"property-type":"data-driven"},"icon-emissive-strength":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"appearance":true,"property-type":"data-driven"},"text-emissive-strength":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"appearance":true,"property-type":"data-driven"},"icon-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"appearance":true,"property-type":"data-driven"},"icon-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"appearance":true,"property-type":"data-driven"},"icon-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"appearance":true,"property-type":"data-driven"},"icon-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"appearance":true,"property-type":"data-driven"},"icon-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"appearance":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"icon-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"icon-image-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"text-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"appearance":true,"property-type":"data-driven"},"text-occlusion-opacity":{"type":"number","minimum":0,"maximum":1,"default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"appearance":true,"property-type":"data-driven"},"text-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"overridable":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"appearance":true,"property-type":"data-driven"},"text-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"appearance":true,"property-type":"data-driven"},"text-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"appearance":true,"property-type":"data-driven"},"text-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"appearance":true,"property-type":"data-driven"},"text-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"appearance":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"text-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"icon-color-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{}},"icon-color-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{}},"icon-color-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"icon-color-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{}},"symbol-z-offset":{"type":"number","default":0,"minimum":0,"transition":true,"appearance":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"}},"paint_raster":{"raster-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-color":{"type":"color","use-theme":true,"expression":{"interpolated":true,"parameters":["raster-value"]}},"raster-color-mix":{"type":"array","default":[0.2126,0.7152,0.0722,0],"length":4,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-color-range":{"type":"array","length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-hue-rotate":{"type":"number","default":0,"period":360,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-resampling":{"type":"enum","values":{"linear":1,"nearest":1},"default":"linear","expression":{"parameters":["zoom"]}},"raster-fade-duration":{"type":"number","default":300,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"raster-array-band":{"type":"string"},"raster-elevation":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-elevation-reference":{"type":"enum","values":{"sea":1,"ground":1},"default":"sea","expression":{}}},"paint_raster-particle":{"raster-particle-array-band":{"type":"string"},"raster-particle-count":{"type":"number","default":512,"minimum":1},"raster-particle-color":{"type":"color","use-theme":true,"expression":{"interpolated":true,"parameters":["raster-particle-speed"]}},"raster-particle-max-speed":{"type":"number","default":1,"minimum":1},"raster-particle-speed-factor":{"type":"number","default":0.2,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-particle-fade-opacity-factor":{"type":"number","default":0.98,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-particle-reset-rate-factor":{"type":"number","default":0.8,"minimum":0,"maximum":1},"raster-particle-elevation":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_hillshade":{"hillshade-illumination-direction":{"type":"number","default":335,"minimum":0,"maximum":359,"expression":{"interpolated":true,"parameters":["zoom"]}},"hillshade-illumination-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"viewport","expression":{"parameters":["zoom"]}},"hillshade-exaggeration":{"type":"number","default":0.5,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"hillshade-shadow-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"hillshade-highlight-color":{"type":"color","default":"#FFFFFF","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"hillshade-accent-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"hillshade-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}}},"paint_background":{"background-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":[]}},"background-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"background-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom"]}},"background-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"background-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}}},"paint_sky":{"sky-type":{"type":"enum","values":{"gradient":1,"atmosphere":1},"default":"atmosphere","expression":{"parameters":["zoom"]}},"sky-atmosphere-sun":{"type":"array","value":"number","length":2,"minimum":[0,0],"maximum":[360,180],"expression":{"parameters":["zoom"]}},"sky-atmosphere-sun-intensity":{"type":"number","default":10,"minimum":0,"maximum":100},"sky-gradient-center":{"type":"array","value":"number","default":[0,0],"length":2,"minimum":[0,0],"maximum":[360,180],"expression":{"parameters":["zoom"]}},"sky-gradient-radius":{"type":"number","default":90,"minimum":0,"maximum":180,"expression":{"parameters":["zoom"]}},"sky-gradient":{"type":"color","default":["interpolate",["linear"],["sky-radial-progress"],0.8,"#87ceeb",1,"white"],"use-theme":true,"expression":{"interpolated":true,"parameters":["sky-radial-progress"]}},"sky-atmosphere-halo-color":{"type":"color","default":"white","use-theme":true},"sky-atmosphere-color":{"type":"color","default":"white","use-theme":true},"sky-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_model":{"model-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"property-type":"data-driven"},"model-rotation":{"type":"array","value":"number","length":3,"default":[0,0,0],"period":360,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-scale":{"type":"array","value":"number","length":3,"default":[1,1,1],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","fe
1ature-state","zoom"]},"transition":true},"model-translation":{"type":"array","value":"number","length":3,"default":[0,0,0],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-color":{"type":"color","default":"#ffffff","property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light","zoom"]},"use-theme":true,"transition":true},"model-color-mix-intensity":{"type":"number","property-type":"data-driven","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-type":{"type":"enum","values":{"common-3d":1,"location-indicator":1},"default":"common-3d"},"model-cast-shadows":{"type":"boolean","default":true},"model-receive-shadows":{"type":"boolean","default":true},"model-ambient-occlusion-intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"model-emissive-strength":{"type":"number","property-type":"data-driven","default":0,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-roughness":{"type":"number","default":1,"minimum":0,"maximum":1,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state"]},"transition":true},"model-height-based-emissive-strength-multiplier":{"type":"array","default":[1,1,1,1,0],"length":5,"value":"number","property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"model-front-cutoff":{"type":"array","value":"number","expression":{"interpolated":true,"parameters":["zoom"]},"length":3,"default":[0,0,1],"minimum":[0,0,0],"maximum":[1,1,1]},"model-elevation-reference":{"type":"enum","values":{"sea":1,"ground":1,"hd-road-markup":1},"default":"ground","expression":{}},"model-ignore-line-cutout":{"type":"boolean","default":false,"expression":{}}},"transition":{"duration":{"type":"number","default":300,"minimum":0},"delay":{"type":"number","default":0,"minimum":0}},"promoteId":{"*":{"type":"*"}}}');function ip(r){return r instanceof Number||r instanceof String||r instanceof Boolean?r.valueOf():r}function hu(r){if(Array.isArray(r))return r.map(hu);if(r instanceof Object&&!(r instanceof Number||r instanceof String||r instanceof Boolean)){const e={};for(const t in r)e[t]=hu(r[t]);return e}return ip(r)}function Jh(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(!Jh(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}function du(r,e="",t=null,n="fill"){if(r==null)return{filter:()=>!0,needGeometry:!1,needFeature:!1};Jh(r)||(r=Rl(r));const s=r;let c=!0;try{c=function(x){if(!Fs(x))return x;let b=hu(x);return np(b),b=rp(b),b}(s)}catch{console.warn(`Failed to extract static filter. Filter will continue working, but at higher memory usage and slower framerate.
2This is most likely a bug, please report this via https://github.com/mapbox/mapbox-gl-js/issues/new?assignees=&labels=&template=Bug_report.md
3and paste the contents of this message in the report.
4Thank you!
5Filter Expression:
6${JSON.stringify(s,null,2)}
7        `)}let h=null,f=null;if(n!=="background"&&n!=="sky"&&n!=="slot"){f=ue[`filter_${n}`];const x=Co(c,f,e,t);if(x.result==="error")throw new Error(x.value.map(b=>`${b.key}: ${b.message}`).join(", "));h=(b,w,S)=>x.value.evaluate(b,w,{},S)}let p=null,g=null;if(c!==s){const x=Co(s,f,e,t);if(x.result==="error")throw new Error(x.value.map(b=>`${b.key}: ${b.message}`).join(", "));p=(b,w,S,E,A)=>x.value.evaluate(b,w,{},S,void 0,void 0,E,A),g=!Ps(x.value.expression)}return{filter:h,dynamicFilter:p||void 0,needGeometry:op(c),needFeature:!!g}}function rp(r){if(!Array.isArray(r))return r;const e=function(t){if(t_.has(t[0])){for(let n=1;n<t.length;n++)if(Fs(t[n]))return!0}return t}(r);return e===!0?e:e.map(t=>rp(t))}function np(r){let e=!1;const t=[];if(r[0]==="case"){for(let n=1;n<r.length-1;n+=2)e=e||Fs(r[n]),t.push(r[n+1]);t.push(r[r.length-1])}else if(r[0]==="match"){e=e||Fs(r[1]);for(let n=2;n<r.length-1;n+=2)t.push(r[n+1]);t.push(r[r.length-1])}else if(r[0]==="step"){e=e||Fs(r[1]);for(let n=1;n<r.length-1;n+=2)t.push(r[n+1])}e&&(r.length=0,r.push("any",...t));for(let n=1;n<r.length;n++)np(r[n])}function Fs(r){if(!Array.isArray(r))return!1;if((e=r[0])==="pitch"||e==="distance-from-center")return!0;var e;
7for(let t=1;t<r.length;t++)if(Fs(r[t]))return!0;return!1}const t_=new Set(["in","==","!=",">",">=","<","<=","to-boolean"]);function i_(r,e){return r<e?-1:r>e?1:0}function op(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(op(r[e]))return!0;return!1}function Rl(r){if(!r)return!0;const e=r[0];return r.length<=1?e!=="any":e==="=="?fu(r[1],r[2],"=="):e==="!="?pu(fu(r[1],r[2],"==")):e==="<"||e===">"||e==="<="||e===">="?fu(r[1],r[2],e):e==="any"?(t=r.slice(1),["any"].concat(t.map(Rl))):e==="all"?["all"].concat(r.slice(1).map(Rl)):e==="none"?["all"].concat(r.slice(1).map(Rl).map(pu)):e==="in"?Do(r[1],r.slice(2)):e==="!in"?pu(Do(r[1],r.slice(2))):e==="has"?ed(r[1]):e!=="!has"||pu(ed(r[1]));var t}function fu(r,e,t){switch(r){case"$type":return[`filter-type-${t}`,e];case"$id":return[`filter-id-${t}`,e];default:return[`filter-${t}`,r,e]}}function Do(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(t=>typeof t!=typeof e[0])?["filter-in-large",r,["literal",e.sort(i_)]]:["filter-in-small",r,["literal",e]]}}function ed(r){switch(r){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",r]}}function pu(r){return["!",r]}const zl="�";function Os(r,e){return e?`${r}${zl}${e}`:r}let sp;const td=()=>sp||(sp=new Ci({"icon-size":new Ge(ue.layout_symbol["icon-size"]),"icon-image":new Ge(ue.layout_symbol["icon-image"]),"icon-rotate":new Ge(ue.layout_symbol["icon-rotate"]),"icon-offset":new Ge(ue.layout_symbol["icon-offset"]),"text-size":new Ge(ue.layout_symbol["text-size"]),"text-rotate":new Ge(ue.layout_symbol["text-rotate"]),"text-offset":new Ge(ue.layout_symbol["text-offset"])}));let id;const rd=()=>id||(id=new Ci({"icon-opacity":new Ge(ue.paint_symbol["icon-opacity"]),"icon-occlusion-opacity":new Ge(ue.paint_symbol["icon-occlusion-opacity"]),"icon-emissive-strength":new Ge(ue.paint_symbol["icon-emissive-strength"]),"text-emissive-strength":new Ge(ue.paint_symbol["text-emissive-strength"]),"icon-color":new Ge(ue.paint_symbol["icon-color"]),"icon-halo-color":new Ge(ue.paint_symbol["icon-halo-color"]),"icon-halo-width":new Ge(ue.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Ge(ue.paint_symbol["icon-halo-blur"]),"icon-translate":new Ge(ue.paint_symbol["icon-translate"]),"text-opacity":new Ge(ue.paint_symbol["text-opacity"]),"text-occlusion-opacity":new Ge(ue.paint_symbol["text-occlusion-opacity"]),"text-color":new Ge(ue.paint_symbol["text-color"],{runtimeType:Lr,getOverride:r=>r.textColor,hasOverride:r=>!!r.textColor}),"text-halo-color":new Ge(ue.paint_symbol["text-halo-color"]),"text-halo-width":new Ge(ue.paint_symbol["text-halo-width"]),"text-halo-blur":new Ge(ue.paint_symbol["text-halo-blur"]),"text-translate":new Ge(ue.paint_symbol["text-translate"]),"symbol-z-offset":new Ge(ue.paint_symbol["symbol-z-offset"]),"icon-color-use-theme":new Ge({type:"string",default:"default","property-type":"data-driven"}),"icon-halo-color-use-theme":new Ge({type:"string",default:"default","property-type":"data-driven"}),"text-color-use-theme":new Ge({type:"string",default:"default","property-type":"data-driven"}),"text-halo-color-use-theme":new Ge({type:"string",default:"default","property-type":"data-driven"})}));class r_{constructor(e,t,n,s,c,h){this._conditionSpec=e,this._propertiesSpec=n;const f=Co(e,ue.appearance.condition);if(f.result==="success"&&(this.condition=f.value),this.name=t,n){this.layoutProperties=new rs(td()),this.unevaluatedLayout=new Qh(td(),s,c,h),this.paintProperties=new rs(rd()),this.unevaluatedPaint=new Qh(rd(),s,c,"");for(const p in n)p in this.unevaluatedLayout._values?this.unevaluatedLayout.setValue(p,n[p]):p in this.unevaluatedPaint._values&&this.unevaluatedPaint.setValue(p,n[p])}}isActive(e){return!(this.condition||!e.isHidden||this.name!=="hidden")||this.condition.evaluate(e.globals,e.feature,e.featureState,e.canonical)}getCondition(){return this.condition}getName(){return this.name}getLayoutProperty(e){return this.layoutProperties.get(e)}getPaintProperty(e){return this.paintProperties.get(e)}getUnevaluatedLayoutProperties(){return this.unevaluatedLayout}getUnevaluatedLayoutProperty(e){return this.unevaluatedLayout._values[e]}getUnevaluatedPaintProperty(e){return this.unevaluatedPaint._values[e]}recalculate(e,t,n){this.unevaluatedLayout&&(this.layoutProperties=this.unevaluatedLayout.possiblyEvaluate(e,void 0,t,n)),this.unevaluatedPaint&&(this.paintProperties=this.unevaluatedPaint.possiblyEvaluate(e,void 0,t,""))}serialize(){const e={};e.condition=this.condition.expression.serialize(),this.name&&(e.name=this.name);const t=this.unevaluatedLayout?this.unevaluatedLayout.serialize():{},n=this.unevaluatedPaint?this.unevaluatedPaint.serialize():{},s=Object.assign({},t,n);return Object.keys(s).length>0&&(e.properties=s),e}hasIconLayoutProperties(){const e=this.hasLayoutProperty("icon-image"),t=this.hasLayoutProperty("icon-size"),n=this.hasLayoutProperty("icon-offset"),s=this.hasLayoutProperty("icon-rotate");return e||t||n||s}hasTextLayoutProperties(){const e=this.hasLayoutProperty("text-size"),t=this.hasLayoutProperty("text-offset"),n=this.hasLayoutProperty("text-rotate");return e||t||n}hasIconPaintProperties(){return!!this.unevaluatedPaint&&Object.keys(this.unevaluatedPaint._values).filter(e=>!e.endsWith("-use-theme")).some(e=>(e.startsWith("icon-")||e==="symbol-z-offset")&&this.hasPaintProperty(e))}hasTextPaintProperties(){return!!this.unevaluatedPaint&&Object.keys(this.unevaluatedPaint._values).filter(e=>!e.endsWith("-use-theme")).some(e=>(e.startsWith("text-")||e==="symbol-z-offset")&&this.hasPaintProperty(e))}hasLayoutProperty(e){return this.unevaluatedLayout&&this.unevaluatedLayout._values[e].value!==void 0}hasPaintProperty(e){return this.unevaluatedPaint&&this.unevaluatedPaint._values[e].value!==void 0}}const nd="-transition",n_=new Set(["fill","line","background","hillshade","raster"]);class Or extends na{constructor(e,t,n,s,c,h){if(super(),this.id=e.id,this.fqid=Os(this.id,n),this.type=e.type,this.scope=n,this.lut=s,this.options=c,this.iconImageUseTheme=h,this.appearances=new Array,this.appearancesVersion=0,this._featureFilter={filter:()=>!0,needGeometry:!1,needFeature:!1},this._filterCompiled=!1,this.expressionDependencies={isIndoorDependent:!1,configDependencies:new Set},e.type!=="custom"){if(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,e.type&&e.type!=="background"&&e.type!=="sky"&&e.type!=="slot"){this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter;const f=Co(this.filter,ue[`filter_${e.type}`]);f.result!=="error"&&(this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...f.value.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||f.value.isIndoorDependent)}if(e.slot&&(this.slot=e.slot),e.appearances&&this.setAppearances(e.appearances),t.layout&&(this._unevaluatedLayout=new Qh(t.layout,this.scope,c,this.iconImageUseTheme),this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...this._unevaluatedLayout.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||this._unevaluatedLayout.isIndoorDependent()),t.paint){this._transitionablePaint=new Ra(t.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.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...this._transitionablePaint.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||this._transitionablePaint.isIndoorDependent(),this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new rs(t.paint)}}}onAdd(e){}onRemove(e){}isDraped(e){return!this.is3D(!0)&&n_.has(this.type)}getLayoutProperty(e){return e==="visibility"?this.visibility:this._unevaluatedLayout.getValue(e)}
7setLayoutProperty(e,t){if(this.type==="custom"&&e==="visibility")return void(this.visibility=t);const n=this._unevaluatedLayout;n._properties.properties[e]&&(n.setValue(e,t),this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...n.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||n.isIndoorDependent(),e==="visibility"&&this.possiblyEvaluateVisibility())}setAppearances(e){this.appearances=[],e.forEach(t=>{this.appearances.push(new r_(t.condition,t.name,t.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(nd)?this._transitionablePaint.getTransition(e.slice(0,-11)):this._transitionablePaint.getValue(e)}isPaintProperty(e){return!!this._transitionablePaint._properties.properties[e]}setPaintProperty(e,t){const n=this._transitionablePaint,s=n._properties.properties;if(e.endsWith(nd)){const b=e.slice(0,-11);return s[b]&&n.setTransition(b,t||void 0),!1}if(!s[e])return!1;const c=n._values[e],h=c.value.isDataDriven(),f=c.value;n.setValue(e,t),this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...n.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||n.isIndoorDependent(),this._handleSpecialPaintPropertyUpdate(e);const p=n._values[e].value,g=p.isDataDriven(),x=e.endsWith("pattern")||e==="line-dasharray";return g||h||x||this._handleOverridablePaintPropertyUpdate(e,f,p)}_handleSpecialPaintPropertyUpdate(e){}getProgramIds(){return null}getDefaultProgramParams(e,t,n){return null}_handleOverridablePaintPropertyUpdate(e,t,n){return!1}isHidden(e){return!!(this.minzoom&&e<this.minzoom)||!!(this.maxzoom&&e>=this.maxzoom)||this.visibility==="none"}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,t){this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,t,this.iconImageUseTheme)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,t)}
vendor: 11,187 bytes, line 7
7serialize(){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(t=>t.serialize())),ze(e,(t,n)=>!(t===void 0||n==="layout"&&!Object.keys(t).length||n==="paint"&&!Object.keys(t).length))}is3D(e){return!1}hasElevation(){return!1}isSky(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}hasShadowPass(){return!1}canCastShadows(){return!1}hasLightBeamPass(){return!1}cutoffRange(){return 0}tileCoverLift(){return 0}resize(){}_clear(){}isStateDependent(){for(const e in this.paint._values){const t=this.paint.get(e);if(t instanceof is&&Jc(t.property.specification)&&(t.value.kind==="source"||t.value.kind==="composite")&&t.value.isStateDependent)return!0}for(const e of this.appearances)if(!ga(e.condition.expression))return!0;return!1}compileFilter(e){this._filterCompiled||(this._featureFilter=du(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,t,n){return{}}queryRadius(e){}queryIntersectsFeature(e,t,n,s,c,h,f,p,g,x){}}const mu={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Ll{constructor(e,t){this._structArray=e,this._pos1=t*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}const o_=new ArrayBuffer(0);class hi{constructor(){this._reallocCount=0,this.capacity=0,this.length=0}static serialize(e,t){return e._trim(),t&&e.arrayBuffer&&t.add(e.arrayBuffer),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){const t=Object.create(this.prototype);return t.arrayBuffer=e.arrayBuffer,t.length=e.length,e.arrayBuffer?t.capacity=e.arrayBuffer.byteLength/t.bytesPerElement:(t.capacity=0,t.arrayBuffer=o_),t._refreshViews(),t}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(e){this.reserve(e),this.length=e}reserve(e){if(e>this.capacity){this._reallocCount++,this.capacity=Math.max(e,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const t=this.uint8;this._refreshViews(),t&&this.uint8.set(t)}}reserveForAdditional(e){this.reserve(this.length+e)}_refreshViews(){throw new Error("StructArray#_refreshViews() must be implemented by each concrete StructArray layout")}emplace(...e){throw new Error("StructArray#emplace() must be implemented by each concrete StructArray layout")}emplaceBack(...e){throw new Error("StructArray#emplaceBack() must be implemented by each concrete StructArray layout")}destroy(){this.int8=this.uint8=this.int16=this.uint16=this.int32=this.uint32=this.float32=null,this.arrayBuffer=null}}function zt(r,e=1){let t=0,n=0;return{members:r.map(s=>{const c=mu[s.type].BYTES_PER_ELEMENT,h=t=ap(t,Math.max(e,c)),f=s.components||1;return n=Math.max(n,c),t+=c*f,{name:s.name,type:s.type,components:f,offset:h}}),size:ap(t,Math.max(n,e)),alignment:e}}function ap(r,e){return Math.ceil(r/e)*e}class sn extends hi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t){const n=this.length;return this.resize(n+1),this.emplace(n,e,t)}emplace(e,t,n){const s=2*e;return this.int16[s+0]=t,this.int16[s+1]=n,e}}sn.prototype.bytesPerElement=4,Qe(sn,"StructArrayLayout2i4");class co extends hi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n){const s=this.length;return this.resize(s+1),this.emplace(s,e,t,n)}emplace(e,t,n,s){const c=3*e;return this.int16[c+0]=t,this.int16[c+1]=n,this.int16[c+2]=s,e}}co.prototype.bytesPerElement=6,Qe(co,"StructArrayLayout3i6");class Ir extends hi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,n,s){const c=this.length;return this.resize(c+1),this.emplace(c,e,t,n,s)}emplace(e,t,n,s,c){const h=4*e;return this.int16[h+0]=t,this.int16[h+1]=n,this.uint16[h+2]=s,this.uint16[h+3]=c,e}}Ir.prototype.bytesPerElement=8,Qe(Ir,"StructArrayLayout2i2ui8");class gn extends hi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){const t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.float32[1*e+0]=t,e}}gn.prototype.bytesPerElement=4,Qe(gn,"StructArrayLayout1f4");class od extends hi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,n){const s=this.length;return this.resize(s+1),this.emplace(s,e,t,n)}emplace(e,t,n,s){const c=4*e,h=2*e;return this.int16[c+0]=t,this.int16[c+1]=n,this.float32[h+1]=s,e}}od.prototype.bytesPerElement=8,Qe(od,"StructArrayLayout2i1f8");class sd extends hi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n){const s=this.length;return this.resize(s+1),this.emplace(s,e,t,n)}emplace(e,t,n,s){const c=4*e;return this.int16[c+0]=t,this.int16[c+1]=n,this.int16[c+2]=s,e}}sd.prototype.bytesPerElement=8,Qe(sd,"StructArrayLayout3i8");class ad extends hi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n,s){const c=this.length;return this.resize(c+1),this.emplace(c,e,t,n,s)}emplace(e,t,n,s,c){const h=4*e;return this.int16[h+0]=t,this.int16[h+1]=n,this.int16[h+2]=s,this.int16[h+3]=c,e}}ad.prototype.bytesPerElement=8,Qe(ad,"StructArrayLayout4i8");class ld extends hi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n,s,c){const h=this.length;return this.resize(h+1),this.emplace(h,e,t,n,s,c)}emplace(e,t,n,s,c,h){const f=5*e;return this.int16[f+0]=t,this.int16[f+1]=n,this.int16[f+2]=s,this.int16[f+3]=c,this.int16[f+4]=h,e}}ld.prototype.bytesPerElement=10,Qe(ld,"StructArrayLayout5i10");class Fl extends hi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,n,s,c,h,f){const p=this.length;return this.resize(p+1),this.emplace(p,e,t,n,s,c,h,f)}emplace(e,t,n,s,c,h,f,p){const g=6*e,x=12*e,b=3*e;return this.int16[g+0]=t,this.int16[g+1]=n,this.uint8[x+4]=s,this.uint8[x+5]=c,this.uint8[x+6]=h,this.uint8[x+7]=f,this.float32[b+2]=p,e}}Fl.prototype.bytesPerElement=12,Qe(Fl,"StructArrayLayout2i4ub1f12");class Fn extends hi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,n){const s=this.length;return this.resize(s+1),this.emplace(s,e,t,n)}emplace(e,t,n,s){const c=3*e;return this.float32[c+0]=t,this.float32[c+1]=n,this.float32[c+2]=s,e}}Fn.prototype.bytesPerElement=12,Qe(Fn,"StructArrayLayout3f12");class uo extends hi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,n,s,c){const h=this.length;return this.resize(h+1),this.emplace(h,e,t,n,s,c)}emplace(e,t,n,s,c,h){const f=6*e,p=3*e;return this.uint16[f+0]=t,this.uint16[f+1]=n,this.uint16[f+2]=s,this.uint16[f+3]=c,this.float32[p+2]=h,e}}uo.prototype.bytesPerElement=12,Qe(uo,"StructArrayLayout4ui1f12");class za extends hi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,n,s){const c=this.length;return this.resize(c+1),this.emplace(c,e,t,n,s)}emplace(e,t,n,s,c){const h=4*e;return this.uint16[h+0]=t,this.uint16[h+1]=n,this.uint16[h+2]=s,this.uint16[h+3]=c,e}}za.prototype.bytesPerElement=8,Qe(za,"StructArrayLayout4ui8");class _u extends hi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n,s,c,h){const f=this.length;return this.resize(f+1),this.emplace(f,e,t,n,s,c,h)}emplace(e,t,n,s,c,h,f){const p=6*e;return this.int16[p+0]=t,this.int16[p+1]=n,this.int16[p+2]=s,this.int16[p+3]=c,this.int16[p+4]=h,this.int16[p+5]=f,e}}_u.prototype.bytesPerElement=12,Qe(_u,"StructArrayLayout6i12");class cd extends hi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,n,s,c,h,f,p,g,x,b,w){const S=this.length;return this.resize(S+1),this.emplace(S,e,t,n,s,c,h,f,p,g,x,b,w)}emplace(e,t,n,s,c,h,f,p,g,x,b,w,S){const E=12*e;return this.int16[E+0]=t,this.int16[E+1]=n,this.int16[E+2]=s,this.int16[E+3]=c,this.uint16[E+4]=h,this.uint16[E+5]=f,this.uint16[E+6]=p,this.uint16[E+7]=g,this.int16[E+8]=x,this.int16[E+9]=b,this.int16[E+10]=w,this.int16[E+11]=S,e}}cd.prototype.bytesPerElement=24,Qe(cd,"StructArrayLayout4i4ui4i24");class ud extends hi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,n,s,c,h){const f=this.length;return this.resize(f+1),this.emplace(f,e,t,n,s,c,h)}emplace(e,t,n,s,c,h,f){const p=10*e,g=5*e;return this.int16[p+0]=t,this.int16[p+1]=n,this.int16[p+2]=s,this.float32[g+2]=c,this.float32[g+3]=h,this.float32[g+4]=f,e}}ud.prototype.bytesPerElement=20,Qe(ud,"StructArrayLayout3i3f20");class Ro extends hi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,n,s){const c=this.length;return this.resize(c+1),this.emplace(c,e,t,n,s)}emplace(e,t,n,s,c){const h=4*e;return this.float32[h+0]=t,this.float32[h+1]=n,this.float32[h+2]=s,this.float32[h+3]=c,e}}Ro.prototype.bytesPerElement=16,Qe(Ro,"StructArrayLayout4f16");class Ol extends hi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){const t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.uint32[1*e+0]=t,e}}Ol.prototype.bytesPerElement=4,Qe(Ol,"StructArrayLayout1ul4");class On extends hi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t){const n=this.length;return this.resize(n+1),this.emplace(n,e,t)}emplace(e,t,n){const s=2*e;return this.uint16[s+0]=t,this.uint16[s+1]=n,e}}
vendor: 11,827 bytes, line 7
7On.prototype.bytesPerElement=4,Qe(On,"StructArrayLayout2ui4");class gu extends hi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,n,s,c,h,f,p,g,x,b,w,S){const E=this.length;return this.resize(E+1),this.emplace(E,e,t,n,s,c,h,f,p,g,x,b,w,S)}emplace(e,t,n,s,c,h,f,p,g,x,b,w,S,E){const A=20*e,P=10*e;return this.int16[A+0]=t,this.int16[A+1]=n,this.int16[A+2]=s,this.int16[A+3]=c,this.int16[A+4]=h,this.float32[P+3]=f,this.float32[P+4]=p,this.float32[P+5]=g,this.float32[P+6]=x,this.int16[A+14]=b,this.uint32[P+8]=w,this.uint16[A+18]=S,this.uint16[A+19]=E,e}}gu.prototype.bytesPerElement=40,Qe(gu,"StructArrayLayout5i4f1i1ul2ui40");class Bl extends hi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n,s,c,h,f){const p=this.length;return this.resize(p+1),this.emplace(p,e,t,n,s,c,h,f)}emplace(e,t,n,s,c,h,f,p){const g=8*e;return this.int16[g+0]=t,this.int16[g+1]=n,this.int16[g+2]=s,this.int16[g+4]=c,this.int16[g+5]=h,this.int16[g+6]=f,this.int16[g+7]=p,e}}Bl.prototype.bytesPerElement=16,Qe(Bl,"StructArrayLayout3i2i2i16");class hd extends hi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,n,s,c){const h=this.length;return this.resize(h+1),this.emplace(h,e,t,n,s,c)}emplace(e,t,n,s,c,h){const f=4*e,p=8*e;return this.float32[f+0]=t,this.float32[f+1]=n,this.float32[f+2]=s,this.int16[p+6]=c,this.int16[p+7]=h,e}}hd.prototype.bytesPerElement=16,Qe(hd,"StructArrayLayout2f1f2i16");class kl extends hi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,n,s,c,h){const f=this.length;return this.resize(f+1),this.emplace(f,e,t,n,s,c,h)}emplace(e,t,n,s,c,h,f){const p=20*e,g=5*e;return this.uint8[p+0]=t,this.uint8[p+1]=n,this.float32[g+1]=s,this.float32[g+2]=c,this.float32[g+3]=h,this.float32[g+4]=f,e}}kl.prototype.bytesPerElement=20,Qe(kl,"StructArrayLayout2ub4f20");class Ni extends hi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,n){const s=this.length;return this.resize(s+1),this.emplace(s,e,t,n)}emplace(e,t,n,s){const c=3*e;return this.uint16[c+0]=t,this.uint16[c+1]=n,this.uint16[c+2]=s,e}}Ni.prototype.bytesPerElement=6,Qe(Ni,"StructArrayLayout3ui6");class yu extends hi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e,t,n,s,c,h,f,p,g,x,b,w,S,E,A,P,R,B,L,U,G){const q=this.length;return this.resize(q+1),this.emplace(q,e,t,n,s,c,h,f,p,g,x,b,w,S,E,A,P,R,B,L,U,G)}emplace(e,t,n,s,c,h,f,p,g,x,b,w,S,E,A,P,R,B,L,U,G,q){const ie=30*e,X=15*e,ee=60*e;return this.int16[ie+0]=t,this.int16[ie+1]=n,this.int16[ie+2]=s,this.float32[X+2]=c,this.float32[X+3]=h,this.uint16[ie+8]=f,this.uint16[ie+9]=p,this.uint32[X+5]=g,this.uint32[X+6]=x,this.uint32[X+7]=b,this.uint16[ie+16]=w,this.uint16[ie+17]=S,this.uint16[ie+18]=E,this.float32[X+10]=A,this.float32[X+11]=P,this.uint8[ee+48]=R,this.uint8[ee+49]=B,this.uint8[ee+50]=L,this.uint32[X+13]=U,this.int16[ie+28]=G,this.uint8[ee+58]=q,e}}yu.prototype.bytesPerElement=60,Qe(yu,"StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60");class dd extends hi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e,t,n,s,c,h,f,p,g,x,b,w,S,E,A,P,R,B,L,U,G,q,ie,X,ee,Q,J,ve,Te,Ie,Ce,Ee,Oe){const ye=this.length;return this.resize(ye+1),this.emplace(ye,e,t,n,s,c,h,f,p,g,x,b,w,S,E,A,P,R,B,L,U,G,q,ie,X,ee,Q,J,ve,Te,Ie,Ce,Ee,Oe)}emplace(e,t,n,s,c,h,f,p,g,x,b,w,S,E,A,P,R,B,L,U,G,q,ie,X,ee,Q,J,ve,Te,Ie,Ce,Ee,Oe,ye){const Ae=20*e,Pe=40*e,Be=80*e;return this.float32[Ae+0]=t,this.float32[Ae+1]=n,this.int16[Pe+4]=s,this.int16[Pe+5]=c,this.int16[Pe+6]=h,this.int16[Pe+7]=f,this.int16[Pe+8]=p,this.int16[Pe+9]=g,this.int16[Pe+10]=x,this.int16[Pe+11]=b,this.int16[Pe+12]=w,this.uint16[Pe+13]=S,this.uint16[Pe+14]=E,this.uint16[Pe+15]=A,this.uint16[Pe+16]=P,this.uint16[Pe+17]=R,this.uint16[Pe+18]=B,this.uint16[Pe+19]=L,this.uint16[Pe+20]=U,this.uint16[Pe+21]=G,this.uint16[Pe+22]=q,this.uint16[Pe+23]=ie,this.uint16[Pe+24]=X,this.uint16[Pe+25]=ee,this.uint16[Pe+26]=Q,this.uint16[Pe+27]=J,this.uint32[Ae+14]=ve,this.float32[Ae+15]=Te,this.float32[Ae+16]=Ie,this.float32[Ae+17]=Ce,this.float32[Ae+18]=Ee,this.uint8[Be+76]=Oe,this.uint16[Pe+39]=ye,e}}dd.prototype.bytesPerElement=80,Qe(dd,"StructArrayLayout2f9i15ui1ul4f1ub1ui80");class xu extends hi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,n,s,c,h){const f=this.length;return this.resize(f+1),this.emplace(f,e,t,n,s,c,h)}emplace(e,t,n,s,c,h,f){const p=6*e;return this.float32[p+0]=t,this.float32[p+1]=n,this.float32[p+2]=s,this.float32[p+3]=c,this.float32[p+4]=h,this.float32[p+5]=f,e}}xu.prototype.bytesPerElement=24,Qe(xu,"StructArrayLayout6f24");class Bs extends hi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,n,s,c){const h=this.length;return this.resize(h+1),this.emplace(h,e,t,n,s,c)}emplace(e,t,n,s,c,h){const f=5*e;return this.float32[f+0]=t,this.float32[f+1]=n,this.float32[f+2]=s,this.float32[f+3]=c,this.float32[f+4]=h,e}}Bs.prototype.bytesPerElement=20,Qe(Bs,"StructArrayLayout5f20");class Vl extends hi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,n,s,c,h,f){const p=this.length;return this.resize(p+1),this.emplace(p,e,t,n,s,c,h,f)}emplace(e,t,n,s,c,h,f,p){const g=7*e;return this.float32[g+0]=t,this.float32[g+1]=n,this.float32[g+2]=s,this.float32[g+3]=c,this.float32[g+4]=h,this.float32[g+5]=f,this.float32[g+6]=p,e}}Vl.prototype.bytesPerElement=28,Qe(Vl,"StructArrayLayout7f28");class fd extends hi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,n,s,c,h,f,p,g,x,b){const w=this.length;return this.resize(w+1),this.emplace(w,e,t,n,s,c,h,f,p,g,x,b)}emplace(e,t,n,s,c,h,f,p,g,x,b,w){const S=11*e;return this.float32[S+0]=t,this.float32[S+1]=n,this.float32[S+2]=s,this.float32[S+3]=c,this.float32[S+4]=h,this.float32[S+5]=f,this.float32[S+6]=p,this.float32[S+7]=g,this.float32[S+8]=x,this.float32[S+9]=b,this.float32[S+10]=w,e}}fd.prototype.bytesPerElement=44,Qe(fd,"StructArrayLayout11f44");class pd extends hi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,n,s,c,h,f,p,g){const x=this.length;return this.resize(x+1),this.emplace(x,e,t,n,s,c,h,f,p,g)}emplace(e,t,n,s,c,h,f,p,g,x){const b=9*e;return this.float32[b+0]=t,this.float32[b+1]=n,this.float32[b+2]=s,this.float32[b+3]=c,this.float32[b+4]=h,this.float32[b+5]=f,this.float32[b+6]=p,this.float32[b+7]=g,this.float32[b+8]=x,e}}pd.prototype.bytesPerElement=36,Qe(pd,"StructArrayLayout9f36");class ks extends hi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t){const n=this.length;return this.resize(n+1),this.emplace(n,e,t)}emplace(e,t,n){const s=2*e;return this.float32[s+0]=t,this.float32[s+1]=n,e}}ks.prototype.bytesPerElement=8,Qe(ks,"StructArrayLayout2f8");class md extends hi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,n,s){const c=this.length;return this.resize(c+1),this.emplace(c,e,t,n,s)}emplace(e,t,n,s,c){const h=6*e;return this.uint32[3*e+0]=t,this.uint16[h+2]=n,this.uint16[h+3]=s,this.uint16[h+4]=c,e}}md.prototype.bytesPerElement=12,Qe(md,"StructArrayLayout1ul3ui12");class Vs extends hi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){const t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.uint16[1*e+0]=t,e}}Vs.prototype.bytesPerElement=2,Qe(Vs,"StructArrayLayout1ui2");class _d extends hi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,n,s,c,h,f,p,g,x,b,w,S,E,A,P){const R=this.length;return this.resize(R+1),this.emplace(R,e,t,n,s,c,h,f,p,g,x,b,w,S,E,A,P)}emplace(e,t,n,s,c,h,f,p,g,x,b,w,S,E,A,P,R){const B=16*e;return this.float32[B+0]=t,this.float32[B+1]=n,this.float32[B+2]=s,this.float32[B+3]=c,this.float32[B+4]=h,this.float32[B+5]=f,this.float32[B+6]=p,this.float32[B+7]=g,this.float32[B+8]=x,this.float32[B+9]=b,this.float32[B+10]=w,this.float32[B+11]=S,this.float32[B+12]=E,this.float32[B+13]=A,this.float32[B+14]=P,this.float32[B+15]=R,e}}_d.prototype.bytesPerElement=64,Qe(_d,"StructArrayLayout16f64");class vu extends hi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,n,s,c,h,f){const p=this.length;return this.resize(p+1),this.emplace(p,e,t,n,s,c,h,f)}emplace(e,t,n,s,c,h,f,p){const g=10*e,x=5*e;return this.uint16[g+0]=t,this.uint16[g+1]=n,this.uint16[g+2]=s,this.uint16[g+3]=c,this.float32[x+2]=h,this.float32[x+3]=f,this.float32[x+4]=p,e}}vu.prototype.bytesPerElement=20,Qe(vu,"StructArrayLayout4ui3f20");class bu extends hi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e){const t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.int16[1*e+0]=t,e}}bu.prototype.bytesPerElement=2,Qe(bu,"StructArrayLayout1i2");class wu extends hi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer)}emplaceBack(e){const t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.uint8[1*e+0]=t,e}}wu.prototype.bytesPerElement=1,Qe(wu,"StructArrayLayout1ub1");class lp extends Ll{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]}}lp.prototype.size=40;class gd extends gu{get(e){return new lp(this,e)}}Qe(gd,"CollisionBoxArray");class cp extends Ll{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.float32[this._pos4+2]}get tileAnchorY(){return this._structArray.float32[this._pos4+3]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+8]}get numGlyphs(){return this._structArray.uint16[this._pos2+9]}
vendor: 28,704 bytes, line 7
7get vertexStartIndex(){return this._structArray.uint32[this._pos4+5]}get lineStartIndex(){return this._structArray.uint32[this._pos4+6]}get lineLength(){return this._structArray.uint32[this._pos4+7]}get segment(){return this._structArray.uint16[this._pos2+16]}get lowerSize(){return this._structArray.uint16[this._pos2+17]}get upperSize(){return this._structArray.uint16[this._pos2+18]}get lineOffsetX(){return this._structArray.float32[this._pos4+10]}get lineOffsetY(){return this._structArray.float32[this._pos4+11]}get writingMode(){return this._structArray.uint8[this._pos1+48]}get placedOrientation(){return this._structArray.uint8[this._pos1+49]}set placedOrientation(e){this._structArray.uint8[this._pos1+49]=e}get hidden(){return this._structArray.uint8[this._pos1+50]}set hidden(e){this._structArray.uint8[this._pos1+50]=e}get crossTileID(){return this._structArray.uint32[this._pos4+13]}set crossTileID(e){this._structArray.uint32[this._pos4+13]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+28]}get flipState(){return this._structArray.uint8[this._pos1+58]}set flipState(e){this._structArray.uint8[this._pos1+58]=e}}cp.prototype.size=60;class up extends yu{get(e){return new cp(this,e)}}Qe(up,"PlacedSymbolArray");class Nl extends Ll{get tileAnchorX(){return this._structArray.float32[this._pos4+0]}get tileAnchorY(){return this._structArray.float32[this._pos4+1]}get projectedAnchorX(){return this._structArray.int16[this._pos2+4]}get projectedAnchorY(){return this._structArray.int16[this._pos2+5]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+6]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+7]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+8]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+9]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+10]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+11]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+12]}get key(){return this._structArray.uint16[this._pos2+13]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+14]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+15]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+16]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+17]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+18]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+19]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+20]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+21]}get featureIndex(){return this._structArray.uint16[this._pos2+22]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+23]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+24]}get numIconVertices(){return this._structArray.uint16[this._pos2+25]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+26]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+27]}get crossTileID(){return this._structArray.uint32[this._pos4+14]}set crossTileID(e){this._structArray.uint32[this._pos4+14]=e}get textOffset0(){return this._structArray.float32[this._pos4+15]}get textOffset1(){return this._structArray.float32[this._pos4+16]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+17]}get zOffset(){return this._structArray.float32[this._pos4+18]}set zOffset(e){this._structArray.float32[this._pos4+18]=e}get hasIconTextFit(){return this._structArray.uint8[this._pos1+76]}get elevationFeatureIndex(){return this._structArray.uint16[this._pos2+39]}}Nl.prototype.size=80;class hp extends dd{get(e){return new Nl(this,e)}}Qe(hp,"SymbolInstanceArray");class dp extends gn{getoffsetX(e){return this.float32[1*e+0]}}Qe(dp,"GlyphOffsetArray");class Ul extends sn{getx(e){return this.int16[2*e+0]}gety(e){return this.int16[2*e+1]}}Qe(Ul,"SymbolLineVertexArray");class fp extends Ll{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]}}fp.prototype.size=12;class yd extends md{get(e){return new fp(this,e)}}Qe(yd,"FeatureIndexArray");class pp extends On{geta_centroid_pos0(e){return this.uint16[2*e+0]}geta_centroid_pos1(e){return this.uint16[2*e+1]}}Qe(pp,"FillExtrusionCentroidArray");class xd extends Ll{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]}}xd.prototype.size=6;class vd extends co{get(e){return new xd(this,e)}}Qe(vd,"FillExtrusionWallArray");const mp=zt([{name:"a_pos",components:2,type:"Int16"}],4),s_=zt([{name:"a_circle_z_offset",components:1,type:"Float32"}],4),a_=zt([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]);class oi{constructor(e=[]){this.segments=e}_prepareSegment(e,t,n,s,c){let h=this.segments[this.segments.length-1];return e>oi.MAX_VERTEX_ARRAY_LENGTH&&lt(`Max vertices per segment is ${oi.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!h||h.vertexLength+e>oi.MAX_VERTEX_ARRAY_LENGTH||h.sortKey!==s||c!==void 0&&h&&h.batchIndex!==void 0&&h.batchIndex!==c)&&(h={vertexOffset:t,primitiveOffset:n,vertexLength:0,primitiveLength:0},s!==void 0&&(h.sortKey=s),c!==void 0&&(h.batchIndex=c),this.segments.push(h)),h}prepareSegment(e,t,n,s,c){return this._prepareSegment(e,t.length,n.length,s,c)}get(){return this.segments}destroy(){for(const e of this.segments)for(const t in e.vaos)e.vaos[t].destroy()}static simpleSegment(e,t,n,s){return new oi([{vertexOffset:e,primitiveOffset:t,vertexLength:n,primitiveLength:s,vaos:{},sortKey:0}])}}function Tu(r,e){return 256*(r=k(Math.floor(r),0,255))+k(Math.floor(e),0,255)}oi.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Qe(oi,"SegmentVector");const l_=zt([{name:"a_pattern",components:4,type:"Uint16"},{name:"a_pixel_ratio",components:1,type:"Float32"}]),c_=zt([{name:"a_pattern_b",components:4,type:"Uint16"}]),u_=zt([{name:"a_dash",components:4,type:"Uint16"}]);class jl{constructor(){this.ids=[],this.uniqueIds=[],this.positions=[],this.indexed=!1}add(e,t,n,s){this.ids.push(bd(e)),this.positions.push(t,n,s)}eachPosition(e,t){const n=bd(e);let s=0,c=this.ids.length-1;for(;s<c;){const h=s+c>>1;this.ids[h]>=n?c=h:s=h+1}for(;this.ids[s]===n;)t(this.positions[3*s],this.positions[3*s+1],this.positions[3*s+2]),s++}static serialize(e,t){const n=new Float64Array(e.ids),s=new Uint32Array(e.positions);return Gl(n,s,0,n.length-1),t&&(t.add(n.buffer),t.add(s.buffer)),{ids:n,positions:s}}static deserialize(e){const t=new jl;let n;t.ids=e.ids,t.positions=e.positions;for(const s of t.ids)s!==n&&t.uniqueIds.push(s),n=s;return t.indexed=!0,t}}function bd(r){const e=+r;return Number.isSafeInteger(e)?e:ra(String(r))}function Gl(r,e,t,n){for(;t<n;){const s=r[t+n>>1];let c=t-1,h=n+1;for(;;){do c++;while(r[c]<s);do h--;while(r[h]>s);if(c>=h)break;yn(r,c,h),yn(e,3*c,3*h),yn(e,3*c+1,3*h+1),yn(e,3*c+2,3*h+2)}h-t<n-h?(Gl(r,e,t,h),t=h+1):(Gl(r,e,h+1,n),n=h)}}function yn(r,e,t){const n=r[e];r[e]=r[t],r[t]=n}Qe(jl,"FeaturePositionMap");class Bn{constructor(e){this.gl=e.gl,this.initialized=!1}fetchUniformLocation(e,t){return this.location||this.initialized||(this.location=this.gl.getUniformLocation(e,t),this.initialized=!0),!!this.location}set(e,t,n){throw new Error("Uniform#set() must be implemented by each concrete Uniform")}}class ql extends Bn{constructor(e){super(e),this.current=0}set(e,t,n){this.fetchUniformLocation(e,t)&&this.current!==n&&(this.current=n,this.gl.uniform1i(this.location,n))}}class ir extends Bn{constructor(e){super(e),this.current=0}set(e,t,n){this.fetchUniformLocation(e,t)&&this.current!==n&&(this.current=n,this.gl.uniform1f(this.location,n))}}class kn extends Bn{constructor(e){super(e),this.current=[0,0]}set(e,t,n){this.fetchUniformLocation(e,t)&&(n[0]===this.current[0]&&n[1]===this.current[1]||(this.current=n,this.gl.uniform2f(this.location,n[0],n[1])))}}class $l extends Bn{constructor(e){super(e),this.current=[0,0,0]}set(e,t,n){this.fetchUniformLocation(e,t)&&(n[0]===this.current[0]&&n[1]===this.current[1]&&n[2]===this.current[2]||(this.current=n,this.gl.uniform3f(this.location,n[0],n[1],n[2])))}}class h_ extends Bn{constructor(e){super(e),this.current=[0,0,0,0]}set(e,t,n){this.fetchUniformLocation(e,t)&&(n[0]===this.current[0]&&n[1]===this.current[1]&&n[2]===this.current[2]&&n[3]===this.current[3]||(this.current=n,this.gl.uniform4ui(this.location,n[0],n[1],n[2],n[3])))}}class Su extends Bn{constructor(e){super(e),this.current=[0,0,0,0]}set(e,t,n){this.fetchUniformLocation(e,t)&&(n[0]===this.current[0]&&n[1]===this.current[1]&&n[2]===this.current[2]&&n[3]===this.current[3]||(this.current=n,this.gl.uniform4f(this.location,n[0],n[1],n[2],n[3])))}}class d_ extends Bn{constructor(e){super(e),this.current=jt.transparent.toPremultipliedRenderColor(null)}set(e,t,n){this.fetchUniformLocation(e,t)&&(n.r===this.current.r&&n.g===this.current.g&&n.b===this.current.b&&n.a===this.current.a||(this.current=n,this.gl.uniform4f(this.location,n.r,n.g,n.b,n.a)))}}const l=new Float32Array(16);class i extends Bn{constructor(e){super(e),this.current=l}set(e,t,n){if(this.fetchUniformLocation(e,t)){if(n[12]!==this.current[12]||n[0]!==this.current[0])return this.current=n,void this.gl.uniformMatrix4fv(this.location,!1,n);for(let s=1;s<16;s++)if(n[s]!==this.current[s]){this.current=n,this.gl.uniformMatrix4fv(this.location,!1,n);break}}}}const o=new Float32Array(9),u=new Float32Array(4);class d extends Bn{constructor(e){super(e),this.current=u}set(e,t,n){if(this.fetchUniformLocation(e,t)){for(let s=0;s<4;s++)if(n[s]!==this.current[s]){this.current=n,this.gl.uniformMatrix2fv(this.location,!1,n);break}}}}function m(r){return[Tu(255*r.r,255*r.g),Tu(255*r.b,255*r.a)]}function _(r,e,t,n,s,c,h,f){return!!r&&(r.kind==="composite"||r.kind==="source"?r.evaluate(new Zt(0,{brightness:c,worldview:f}),e,t,s,n,h)==="none":r.value==="none")}class y{constructor(e,t,n,s){this.value=e,this.uniformNames=t.map(c=>`u_${c}`),this.type=n,this.context=s}setUniform(e,t,n,s,c){const h=s.constantOr(this.value);t.set(e,c,h instanceof jt?h.toPremultipliedRenderColor(this.lutExpression&&this.lutExpression.kind==="constant"&&this.lutExpression.value==="none"?null:this.context.lut):h)}getBinding(e,t){return this.type==="color"?new d_(e):new ir(e)}}class v{constructor(e,t){this.uniformNames=t.map(n=>`u_${n}`),this.pattern=null,this.patternTransition=null,this.pixelRatio=1}setConstantPatternPositions(e,t){this.pixelRatio=e.pixelRatio||1,this.pattern=e.tl.concat(e.br),this.patternTransition=t?t.tl.concat(t.br):this.pattern}setUniform(e,t,n,s,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&&t.set(e,c,h)}getBinding(e,t){return t==="u_pattern"||t==="u_pattern_b"||t==="u_dash"?new h_(e):new ir(e)}}class T{constructor(e,t,n,s){this.expression=e,this.type=n,this.maxValue=0,this.paintVertexAttributes=t.map(c=>({name:`a_${c}`,type:"Float32",components:n==="color"?2:1,offset:0})),this.paintVertexArray=new s}populatePaintArray(e,t,n,s,c,h,f,p){const g=this.paintVertexArray.length,x=this.expression.kind==="composite"||this.expression.kind==="source"?this.expression.evaluate(new Zt(0,{brightness:h,worldview:p}),t,{},c,s,f):this.expression.kind==="constant"&&this.expression.value,b=_(this.lutExpression,t,{},s,c,h,f,p);this.paintVertexArray.resize(e),this._setPaintValue(g,e,x,b?null:this.context.lut)}updatePaintArray(e,t,n,s,c,h,f,p){const g=this.expression.kind==="composite"||this.expression.kind==="source"?this.expression.evaluate({zoom:0,brightness:f,worldview:p},n,s,void 0,c):this.expression.kind==="constant"&&this.expression.value,x=_(this.lutExpression,n,s,c,void 0,f,void 0,p);this._setPaintValue(e,t,g,x?null:this.context.lut)}_setPaintValue(e,t,n,s){if(this.type==="color"){const c=m(n.toPremultipliedRenderColor(s));for(let h=e;h<t;h++)this.paintVertexArray.emplace(h,c[0],c[1])}else{for(let c=e;c<t;c++)this.paintVertexArray.emplace(c,n);this.maxValue=Math.max(this.maxValue,Math.abs(n))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.lutExpression&&this.lutExpression.kind!=="constant"&&(this.lutExpression.isStateDependent||!this.lutExpression.isLightConstant)||this.expression.kind!=="constant"&&(this.expression.isStateDependent||!this.expression.isLightConstant)))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class I{constructor(e,t,n,s,c,h){this.expression=e,this.uniformNames=t.map(f=>`u_${f}_t`),this.type=n,this.useIntegerZoom=s,this.context=c,this.maxValue=0,this.paintVertexAttributes=t.map(f=>({name:`a_${f}`,type:"Float32",components:n==="color"?4:2,offset:0})),this.paintVertexArray=new h}populatePaintArray(e,t,n,s,c,h,f,p){const g=this.expression.evaluate(new Zt(this.context.zoom,{brightness:h,worldview:p}),t,{},c,s,f),x=this.expression.evaluate(new Zt(this.context.zoom+1,{brightness:h,worldview:p}),t,{},c,s,f),b=_(this.lutExpression,t,{},s,c,h,f,p),w=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(w,e,g,x,b?null:this.context.lut)}updatePaintArray(e,t,n,s,c,h,f,p){const g=this.expression.evaluate({zoom:this.context.zoom,brightness:f,worldview:p},n,s,void 0,c),x=this.expression.evaluate({zoom:this.context.zoom+1,brightness:f,worldview:p},n,s,void 0,c),b=_(this.lutExpression,n,s,c,void 0,f,void 0,p);this._setPaintValue(e,t,g,x,b?null:this.context.lut)}_setPaintValue(e,t,n,s,c){if(this.type==="color"){const h=m(n.toPremultipliedRenderColor(c)),f=m(s.toPremultipliedRenderColor(c));for(let p=e;p<t;p++)this.paintVertexArray.emplace(p,h[0],h[1],f[0],f[1])}else{for(let h=e;h<t;h++)this.paintVertexArray.emplace(h,n,s);this.maxValue=Math.max(this.maxValue,Math.abs(n),Math.abs(s))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent||!this.expression.isLightConstant))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(e,t,n,s,c){const h=this.useIntegerZoom?Math.floor(n.zoom):n.zoom,f=k(this.expression.interpolationFactor(h,this.context.zoom,this.context.zoom+1),0,1);t.set(e,c,f)}getBinding(e,t){return new ir(e)}}class M{constructor(e,t,n,s,c){this.expression=e,this.layerId=c,this.paintVertexAttributes=(n==="array"?u_:l_).members;for(let h=0;h<t.length;++h);this.paintVertexArray=new s,this.paintTransitionVertexArray=new za}populatePaintArray(e,t,n,s){const c=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValues(c,e,t.patterns&&t.patterns[this.layerId],n)}updatePaintArray(e,t,n,s,c,h,f){this._setPaintValues(e,t,n.patterns&&n.patterns[this.layerId],h)}_setPaintValues(e,t,n,s){if(!s||!n)return;const c=s[n[0]],h=s[n[1]];if(c){if(c){const{tl:f,br:p,pixelRatio:g}=c;for(let x=e;x<t;x++)this.paintVertexArray.emplace(x,f[0],f[1],p[0],p[1],g)}if(h){this.paintTransitionVertexArray.resize(this.paintVertexArray.length);const{tl:f,br:p}=h;for(let g=e;g<t;g++)this.paintTransitionVertexArray.emplace(g,f[0],f[1],p[0],p[1])}}}upload(e){const t=this.expression.isStateDependent||!this.expression.isLightConstant;this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,t)),this.paintTransitionVertexArray&&this.paintTransitionVertexArray.length&&(this.paintTransitionVertexBuffer=e.createVertexBuffer(this.paintTransitionVertexArray,c_.members,t))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy(),this.paintTransitionVertexBuffer&&this.paintTransitionVertexBuffer.destroy()}}class C{constructor(e,t,n=()=>!0){this.binders={},this._buffers=[],this.context=t;const s=[],c=e;for(const h in e.paint._values){const f=c.paint.get(h);if(h.endsWith("-use-theme")||!n(h)||!(f instanceof is&&Jc(f.property.specification)))continue;const p=z(h,e.type),g=f.value,x=f.property.specification.type,b=!!f.property.useIntegerZoom,w=h==="line-dasharray"||h.endsWith("pattern"),S=c.paint.get(`${h}-use-theme`),E=h==="line-dasharray"&&c.layout.get("line-cap").value.kind!=="constant"||S&&S.value.kind!=="constant";if(g.kind!=="constant"||E)if(g.kind==="source"||E||w){const A=$(h,x,"source");this.binders[h]=w?new M(g,p,x,A,e.id):new T(g,p,x,A),s.push(`/a_${h}`)}else{const A=$(h,x,"composite");this.binders[h]=new I(g,p,x,b,t,A),s.push(`/z_${h}`)}else this.binders[h]=w?new v(g.value,p):new y(g.value,p,x,t),s.push(`/u_${h}`);S&&(this.binders[h].lutExpression=S.value)}this.cacheKey=s.sort().join("")}getMaxValue(e){const t=this.binders[e];return t instanceof T||t instanceof I?t.maxValue:0}populatePaintArrays(e,t,n,s,c,h,f,p){for(const g in this.binders){const x=this.binders[g];x.context=this.context,(x instanceof T||x instanceof I||x instanceof M)&&x.populatePaintArray(e,t,n,s,c,h,f,p)}}setConstantPatternPositions(e,t){for(const n in this.binders){const s=this.binders[n];s instanceof v&&s.setConstantPatternPositions(e,t)}}getPatternTransitionVertexBuffer(e){const t=this.binders[e];return t instanceof M?t.paintTransitionVertexBuffer:null}updatePaintArrays(e,t,n,s,c,h,f,p,g,x){let b=!1;const w=Object.keys(e),S=w.length!==0&&!p,E=S?w:t.uniqueIds;this.context.lut=c.lut;for(const A in this.binders){const P=this.binders[A];if(P.context=this.context,(P instanceof T||P instanceof I||P instanceof M)&&P.expression&&P.expression.kind&&P.expression.kind!=="constant"&&(P.expression.isStateDependent===!0||P.expression.isLightConstant===!1)){const R=c.paint.get(A);P.expression=R.value;for(const B of E){const L=e[B.toString()];t.eachPosition(B,(U,G,q)=>{const ie=s.feature(U);P.updatePaintArray(G,q,ie,L,h,f,g,x)})}if(!S)for(const B of n.uniqueIds){const L=e[B.toString()];n.eachPosition(B,(U,G,q)=>{const ie=s.feature(U);P.updatePaintArray(G,q,ie,L,h,f,g,x)})}b=!0}}return b}defines(){const e=[];for(const t in this.binders){const n=this.binders[t];(n instanceof y||n instanceof v)&&e.push(...n.uniformNames.map(s=>`#define HAS_UNIFORM_${s}`))}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e){const t=[];for(const n in this.binders){const s=this.binders[n];if(s instanceof y||s instanceof v||s instanceof I)for(const c of s.uniformNames)t.push({name:c,property:n,binding:s.getBinding(e,c)})}return t}setUniforms(e,t,n,s,c){for(const{name:h,property:f,binding:p}of n)this.binders[f].setUniform(e,p,c,s.get(f),h)}updatePaintBuffers(){this._buffers=[];for(const e in this.binders){const t=this.binders[e];(t instanceof T||t instanceof I||t instanceof M)&&t.paintVertexBuffer&&this._buffers.push(t.paintVertexBuffer),t instanceof M&&t.paintTransitionVertexBuffer&&this._buffers.push(t.paintTransitionVertexBuffer)}}upload(e){for(const t in this.binders){const n=this.binders[t];(n instanceof T||n instanceof I||n instanceof M)&&n.upload(e)}this.updatePaintBuffers()}destroy(){for(const e in this.binders){const t=this.binders[e];(t instanceof T||t instanceof I||t instanceof M)&&t.destroy()}}}class D{constructor(e,t,n=()=>!0){this.programConfigurations={};for(const s of e)this.programConfigurations[s.id]=new C(s,t,n);this.needsUpload=!1,this._featureMap=new jl,this._featureMapWithoutIds=new jl,this._bufferOffset=0,this._idlessCounter=0}populatePaintArrays(e,t,n,s,c,h,f,p,g){for(const x in this.programConfigurations)this.programConfigurations[x].populatePaintArrays(e,t,s,c,h,f,p,g);t.id!==void 0?this._featureMap.add(t.id,n,this._bufferOffset,e):(this._featureMapWithoutIds.add(this._idlessCounter,n,this._bufferOffset,e),this._idlessCounter+=1),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,t,n,s,c,h,f,p){for(const g of n)this.needsUpload=this.programConfigurations[g.id].updatePaintArrays(e,this._featureMap,this._featureMapWithoutIds,t,g,s,c,h,f||0,p)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(const t in this.programConfigurations)this.programConfigurations[t].upload(e);this.needsUpload=!1}}destroy(){for(const e in this.programConfigurations)this.programConfigurations[e].destroy()}}const F={"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-occlusion-opacity":["occlusion_opacity"],"icon-occlusion-opacity":["occlusion_opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-emissive-strength":["emissive_strength"],"icon-emissive-strength":["emissive_strength"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"symbol-z-offset":["z_offset"],"line-gap-width":["gapwidth"],"line-pattern":["pattern","pixel_ratio","pattern_b"],"fill-pattern":["pattern","pixel_ratio","pattern_b"],"fill-extrusion-pattern":["pattern","pixel_ratio","pattern_b"],"line-dasharray":["dash"],"fill-bridge-guard-rail-color":["structure_color"],"fill-tunnel-structure-color":["structure_color"]};function z(r,e){return F[r]||[r.replace(`${e}-`,"").replace(/-/g,"_")]}const V={"line-pattern":{source:uo,composite:uo},"fill-pattern":{source:uo,composite:uo},"fill-extrusion-pattern":{source:uo,composite:uo},"line-dasharray":{source:za,composite:za}},N={color:{source:ks,composite:Ro},number:{source:gn,composite:ks}};function $(r,e,t){const n=V[r];return n&&n[t]||N[e][t]}Qe(y,"ConstantBinder"),Qe(v,"PatternConstantBinder"),Qe(T,"SourceExpressionBinder"),Qe(M,"PatternCompositeBinder"),Qe(I,"CompositeExpressionBinder"),Qe(C,"ProgramConfiguration",{omit:["_buffers"]}),Qe(D,"ProgramConfigurationSet");const H=Ze/Math.PI/2,j=64,ne=[j,32,16],Y=-H,re=H;function Z(r,e,t,n=H){return t=Vt(t),[r*Math.sin(t)*n,-e*n,r*Math.cos(t)*n]}function K(r,e,t){return Z(Math.cos(Vt(r)),Math.sin(Vt(r)),e,t)}const te=63710088e-1,de=2*Math.PI*te;class se{constructor(e,t){if(isNaN(e)||isNaN(t))throw new Error(`Invalid LngLat object: (${e}, ${t})`);if(this.lng=+e,this.lat=+t,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new se(oe(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){const t=Math.PI/180,n=this.lat*t,s=e.lat*t,c=Math.sin(n)*Math.sin(s)+Math.cos(n)*Math.cos(s)*Math.cos((e.lng-this.lng)*t);return te*Math.acos(Math.min(c,1))}toBounds(e=0){const t=360*e/40075017,n=t/Math.cos(Math.PI/180*this.lat);return new be({lng:this.lng-n,lat:this.lat-t},{lng:this.lng+n,lat:this.lat+t})}toEcef(e){return K(this.lat,this.lng,H+e*H/te)}static convert(e){if(e instanceof se)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new se(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null)return new se(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 be{constructor(e,t){e&&(t?this.setSouthWest(e).setNorthEast(t):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 se?new se(e.lng,e.lat):se.convert(e),this}setSouthWest(e){return this._sw=e instanceof se?new se(e.lng,e.lat):se.convert(e),this}extend(e){const t=this._sw,n=this._ne;let s,c;if(e instanceof se)s=e,c=e;else{if(!(e instanceof be))return Array.isArray(e)?e.length===4||e.every(Array.isArray)?this.extend(be.convert(e)):this.extend(se.convert(e)):typeof e=="object"&&e!==null&&e.hasOwnProperty("lat")&&(e.hasOwnProperty("lon")||e.hasOwnProperty("lng"))?this.extend(se.convert(e)):this;if(s=e._sw,c=e._ne,!s||!c)return this}return t||n?(t.lng=Math.min(s.lng,t.lng),t.lat=Math.min(s.lat,t.lat),n.lng=Math.max(c.lng,n.lng),n.lat=Math.max(c.lat,n.lat)):(this._sw=new se(s.lng,s.lat),this._ne=new se(c.lng,c.lat)),this}getCenter(){return new se((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 se(this.getWest(),this.getNorth())}getSouthEast(){return new se(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(e){const{lng:t,lat:n}=se.convert(e);let s=this._sw.lng<=t&&t<=this._ne.lng;return this._sw.lng>this._ne.lng&&(s=this._sw.lng>=t&&t>=this._ne.lng),this._sw.lat<=n&&n<=this._ne.lat&&s}static convert(e){if(e)return e instanceof be?e:new be(e)}}function _e(r){return de*Math.cos(r*Math.PI/180)}function Me(r){return(180+r)/360}function Le(r){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r*Math.PI/360)))/360}function fe(r,e){return r/_e(e)}function le(r){return 360*r-180}function xe(r){return 360/Math.PI*Math.atan(Math.exp((180-360*r)*Math.PI/180))-90}function we(r,e){return r*_e(xe(e))}const Se=85.051129;function $e(r){return Math.cos(Vt(k(r,-85.051129,Se)))}function Ve(r,e){const t=k(e,0,25.5),n=Math.pow(2,t);return $e(r)*de/(512*n)}function Ne(r){return 1/Math.cos(r*Math.PI/180)}function De(r,e=0){const t=Math.exp(Math.PI*(1-(r.y+e/Ze)/(1<<r.z)*2));return 80150034*t/(t*t+1)/Ze/(1<<r.z)}class tt{constructor(e,t,n=0){this.x=+e,this.y=+t,this.z=+n}static fromLngLat(e,t=0){const n=se.convert(e);return new tt(Me(n.lng),Le(n.lat),fe(t,n.lat))}toLngLat(){return new se(le(this.x),xe(this.y))}toAltitude(){return we(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/de*Ne(xe(this.y))}}function ot(r,e,t,n,s,c,h,f,p){const g=(e+n)/2,x=(t+s)/2,b=new Fe(g,x);f(b),function(w,S,E,A,P,R){const B=E-P,L=A-R;return Math.abs((A-S)*B-(E-w)*L)/Math.hypot(B,L)}(b.x,b.y,c.x,c.y,h.x,h.y)>=p?(ot(r,e,t,g,x,c,b,f,p),ot(r,g,x,n,s,b,h,f,p)):r.push(h)}function Ke(r,e,t){let n=r[0],s=n.x,c=n.y;e(n);const h=[n];for(let f=1;f<r.length;f++){const p=r[f],{x:g,y:x}=p;e(p),ot(h,s,c,g,x,n,p,e,t),s=g,c=x,n=p}return h}function et(r,e,t,n){if(n(e,t)){const s=e.add(t)._mult(.5);et(r,e,s,n),et(r,s,t,n)}else r.push(t)}function _t(r,e){let t=r[0];const n=[t];for(let s=1;s<r.length;s++){const c=r[s];et(n,t,c,e),t=c}return n}const xt=Math.pow(2,14)-1,gt=-xt-1;function At(r,e){const t=Math.round(r.x*e),n=Math.round(r.y*e);return r.x=k(t,gt,xt),r.y=k(n,gt,xt),(t<r.x||t>r.x+1||n<r.y||n>r.y+1)&&lt("Geometry exceeds allowed extent, reduce your vector tile buffer size"),r}function ft(r,e,t){const n=r.loadGeometry(),s=r.extent,c=Ze/s;if(e&&t&&t.projection.isReprojectedInTileSpace){const h=1<<e.z,{scale:f,x:p,y:g,projection:x}=t,b=w=>{const S=le((e.x+w.x/s)/h),E=xe((e.y+w.y/s)/h),A=x.project(S,E);w.x=(A.x*f-p)*s,w.y=(A.y*f-g)*s};for(let w=0;w<n.length;w++)if(r.type!==1)n[w]=Ke(n[w],b,1);else{const S=[];for(const E of n[w])E.x<0||E.x>=s||E.y<0||E.y>=s||(b(E),S.push(E));n[w]=S}}for(const h of n)for(const f of h)At(f,c);return n}function Ct(r,e){return{type:r.type,id:r.id,properties:r.properties,geometry:e?ft(r):[]}}class yt{constructor(e,t,n,s,c){this.properties={},this.extent=n,this.type=0,this.id=void 0,this._pbf=e,this._geometry=-1,this._keys=s,this._values=c,e.readFields(kt,this,t)}loadGeometry(){const e=this._pbf;e.pos=this._geometry;const t=e.readVarint()+e.pos,n=[];let s,c=1,h=0,f=0,p=0;for(;e.pos<t;){if(h<=0){const g=e.readVarint();c=7&g,h=g>>3}if(h--,c===1||c===2)f+=e.readSVarint(),p+=e.readSVarint(),c===1&&(s&&n.push(s),s=[]),s&&s.push(new Fe(f,p));else{if(c!==7)throw new Error(`unknown command ${c}`);s&&s.push(s[0].clone())}}return s&&n.push(s),n}bbox(){const e=this._pbf;e.pos=this._geometry;const t=e.readVarint()+e.pos;let n=1,s=0,c=0,h=0,f=1/0,p=-1/0,g=1/0,x=-1/0;for(;e.pos<t;){if(s<=0){const b=e.readVarint();n=7&b,s=b>>3}if(s--,n===1||n===2)c+=e.readSVarint(),h+=e.readSVarint(),c<f&&(f=c),c>p&&(p=c),h<g&&(g=h),h>x&&(x=h);else if(n!==7)throw new Error(`unknown command ${n}`)}return[f,g,p,x]}
7toGeoJSON(e,t,n){const s=this.extent*Math.pow(2,n),c=this.extent*e,h=this.extent*t,f=this.loadGeometry();function p(w){return[360*(w.x+c)/s-180,360/Math.PI*Math.atan(Math.exp((1-2*(w.y+h)/s)*Math.PI))-90]}function g(w){return w.map(p)}let x;if(this.type===1){const w=[];for(const E of f)w.push(E[0]);const S=g(w);x=w.length===1?{type:"Point",coordinates:S[0]}:{type:"MultiPoint",coordinates:S}}else if(this.type===2){const w=f.map(g);x=w.length===1?{type:"LineString",coordinates:w[0]}:{type:"MultiLineString",coordinates:w}}else{if(this.type!==3)throw new Error("unknown feature type");{const w=function(E){const A=E.length;if(A<=1)return[E];const P=[];let R,B;for(let L=0;L<A;L++){const U=ti(E[L]);U!==0&&(B===void 0&&(B=U<0),B===U<0?(R&&P.push(R),R=[E[L]]):R&&R.push(E[L]))}return R&&P.push(R),P}(f),S=[];for(const E of w)S.push(E.map(g));x=S.length===1?{type:"Polygon",coordinates:S[0]}:{type:"MultiPolygon",coordinates:S}}}const b={type:"Feature",geometry:x,properties:this.properties};return this.id!=null&&(b.id=this.id),b}}function kt(r,e,t){r===1?e.id=t.readVarint():r===2?function(n,s){const c=n.readVarint()+n.pos;for(;n.pos<c;){const h=s._keys[n.readVarint()],f=s._values[n.readVarint()];s.properties[h]=f}}(t,e):r===3?e.type=t.readVarint():r===4&&(e._geometry=t.pos)}function ti(r){let e=0;for(let t,n,s=0,c=r.length,h=c-1;s<c;h=s++)t=r[s],n=r[h],e+=(n.x-t.x)*(t.y+n.y);return e}yt.types=["Unknown","Point","LineString","Polygon"];class wi{constructor(e,t){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],e.readFields(si,this,t),this.length=this._features.length}feature(e){if(e<0||e>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[e];const t=this._pbf.readVarint()+this._pbf.pos;return new yt(this._pbf,t,this.extent,this._keys,this._values)}}function si(r,e,t){r===15?e.version=t.readVarint():r===1?e.name=t.readString():r===5?e.extent=t.readVarint():r===2?e._features.push(t.pos):r===3?e._keys.push(t.readString()):r===4&&e._values.push(function(n){let s=null;const c=n.readVarint()+n.pos;for(;n.pos<c;){const h=n.readVarint()>>3;s=h===1?n.readString():h===2?n.readFloat():h===3?n.readDouble():h===4?n.readVarint64():h===5?n.readVarint():h===6?n.readSVarint():h===7?n.readBoolean():null}if(s==null)throw new Error("unknown feature value");return s}(t))}class Gt{constructor(e,t){this.layers=e.readFields(It,{},t)}}function It(r,e,t){if(r===3){const n=new wi(t,t.readVarint()+t.pos);n.length&&(e[n.name]=n)}}const Et="3d_elevation_id",ai="level";class Ii{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,t){return this._valid&&e(t(this._geometry)),this}require(e,t,n){return this.get(e,!0,t,n)}optional(e,t,n){return this.get(e,!1,t,n)}success(){return this._valid}get(e,t,n,s){const c=this.feature.properties.hasOwnProperty(e)?+this.feature.properties[e]:void 0;return this._valid&&c!==void 0&&!Number.isNaN(c)?n(s?s(c):c):t&&(this._valid=!1),this}}class qt{constructor(e,t){this.featureFunc=e,this.vertexFunc=t}parseFeature(e,t,n){return this.featureFunc(e,t,n)}parseVertex(e,t,n){return this.vertexFunc(e,t,n)}}const bt=new qt((r,e,t)=>r.reset(e).require(Et,n=>{t.id=n}).optional("fixed_height_relative",n=>{t.constantHeight=n},ii.decodeRelativeHeight).geometry(n=>{t.bounds=n},hh).success(),(r,e,t)=>r.reset(e).require(Et,n=>{t.id=n}).require("elevation_idx",n=>{t.idx=n}).require("extent",n=>{t.extent=n}).require("height_relative",n=>{t.height=n},ii.decodeRelativeHeight).geometry(n=>{t.position=n},ii.getPoint).success()),gi=new qt((r,e,t)=>r.reset(e).require(Et,n=>{t.id=n}).optional("fixed_height",n=>{t.constantHeight=n},ii.decodeMetricHeight).geometry(n=>{t.bounds=n},hh).success(),(r,e,t)=>r.reset(e).require(Et,n=>{t.id=n}).require("elevation_idx",n=>{t.idx=n}).require("extent",n=>{t.extent=n}).require("height",n=>{t.height=n},ii.decodeMetricHeight).geometry(n=>{t.position=n},ii.getPoint).success());class ii{static getPoint(e){return So(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"?gi:void 0:bt}static parse(e){const t=[],n=[],s=e.length,c=new Ii;for(let h=0;h<s;h++){const f=e.feature(h),p=f.properties.version,g=ii.getVersionSchema(p);if(g===void 0){lt(`Unknown elevation feature version number ${p||"(unknown)"}`);continue}const x=f.properties.type;if(!x)continue;const b=yt.types[f.type];if(b==="Point"&&x==="curve_point"){const w={};
vendor: 21,239 bytes, line 7
7g.parseVertex(c,f,w)&&t.push(w)}else if(b==="Polygon"&&x==="curve_meta"){const w={};g.parseFeature(c,f,w)&&n.push(w)}}return{vertices:t,features:n}}}class Wi{constructor(e,t){this.pos=e,this.dir=t}intersectsPlane(e,t,n){const s=qo(t,this.dir);if(Math.abs(s)<1e-6)return!1;const c=((e[0]-this.pos[0])*t[0]+(e[1]-this.pos[1])*t[1])/s;return n[0]=this.pos[0]+this.dir[0]*c,n[1]=this.pos[1]+this.dir[1]*c,!0}}class Rt{constructor(e,t){this.pos=e,this.dir=t}intersectsPlane(e,t,n){const s=ki(t,this.dir);if(Math.abs(s)<1e-6)return!1;const c=((e[0]-this.pos[0])*t[0]+(e[1]-this.pos[1])*t[1]+(e[2]-this.pos[2])*t[2])/s;return n[0]=this.pos[0]+this.dir[0]*c,n[1]=this.pos[1]+this.dir[1]*c,n[2]=this.pos[2]+this.dir[2]*c,!0}closestPointOnSphere(e,t,n){if(function(S,E){var A=S[0],P=S[1],R=S[2],B=E[0],L=E[1],U=E[2];return Math.abs(A-B)<=We*Math.max(1,Math.abs(A),Math.abs(B))&&Math.abs(P-L)<=We*Math.max(1,Math.abs(P),Math.abs(L))&&Math.abs(R-U)<=We*Math.max(1,Math.abs(R),Math.abs(U))}(this.pos,e)||t===0)return n[0]=n[1]=n[2]=0,!1;const[s,c,h]=this.dir,f=this.pos[0]-e[0],p=this.pos[1]-e[1],g=this.pos[2]-e[2],x=s*s+c*c+h*h,b=2*(f*s+p*c+g*h),w=b*b-4*x*(f*f+p*p+g*g-t*t);if(w<0){const S=Math.max(-b/2,0),E=f+s*S,A=p+c*S,P=g+h*S,R=Math.hypot(E,A,P);return n[0]=E*t/R,n[1]=A*t/R,n[2]=P*t/R,!1}{const S=(-b-Math.sqrt(w))/(2*x);if(S<0){const E=Math.hypot(f,p,g);return n[0]=f*t/E,n[1]=p*t/E,n[2]=g*t/E,!1}return n[0]=f+s*S,n[1]=p+c*S,n[2]=g+h*S,!0}}}class ni{constructor(e,t,n,s,c){this.TL=e,this.TR=t,this.BR=n,this.BL=s,this.horizon=c}static fromInvProjectionMatrix(e,t,n){const s=[-1,1,1],c=[1,1,1],h=[1,-1,1],f=[-1,-1,1],p=Vi(s,s,e),g=Vi(c,c,e),x=Vi(h,h,e),b=Vi(f,f,e);return new ni(p,g,x,b,t/n)}}function Qi(r,e,t){let n=1/0,s=-1/0;const c=[];for(const h of r){Xi(c,h,e);const f=ki(c,t);n=Math.min(n,f),s=Math.max(s,f)}return[n,s]}function Er(r,e){let t=!0;for(let n=0;n<r.planes.length;n++){const s=r.planes[n];let c=0;for(let h=0;h<e.length;h++)c+=+(ki(s,e[h])+s[3]>=0);if(c===0)return 0;c!==e.length&&(t=!1)}return t?2:1}function rr(r,e){for(const t of r.projections){const n=Qi(e,r.points[0],t.axis);if(t.projection[1]<n[0]||t.projection[0]>n[1])return 0}return 1}function mr(r,e){let t=0;const n=[0,0,0,0];for(let s=0;s<r.length;s++)n[0]=r[s][0],n[1]=r[s][1],n[2]=r[s][2],n[3]=1,xs(n,e)>=0&&t++;return t}class an{constructor(e,t){this.points=e||new Array(8).fill([0,0,0]),this.planes=t||new Array(6).fill([0,0,0,0]),this.bounds=Xt.fromPoints(this.points),this.projections=[],this.frustumEdges=[Xi([],this.points[2],this.points[3]),Xi([],this.points[0],this.points[3]),Xi([],this.points[4],this.points[0]),Xi([],this.points[5],this.points[1]),Xi([],this.points[6],this.points[2]),Xi([],this.points[7],this.points[3])];for(const n of this.frustumEdges){const s=[0,-n[2],n[1]],c=[n[2],0,-n[0]];this.projections.push({axis:s,projection:Qi(this.points,this.points[0],s)}),this.projections.push({axis:c,projection:Qi(this.points,this.points[0],c)})}}static fromInvProjectionMatrix(e,t,n,s){const c=Math.pow(2,n),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(g=>{const x=br([],g,e),b=1/x[3]/t*c;return(w=x)[0]=(S=x)[0]*(E=[b,b,s?1/x[3]:b,b])[0],w[1]=S[1]*E[1],w[2]=S[2]*E[2],w[3]=S[3]*E[3],w;var w,S,E}),f=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(g=>{const x=xi([],dr([],Xi([],h[g[0]],h[g[1]]),Xi([],h[g[2]],h[g[1]]))),b=-ki(x,h[g[1]]);return x.concat(b)}),p=[];for(let g=0;g<h.length;g++)p.push([h[g][0],h[g][1],h[g][2]]);return new an(p,f)}intersectsPrecise(e,t,n){for(let s=0;s<t.length;s++)if(!mr(e,t[s]))return 0;for(let s=0;s<this.planes.length;s++)if(!mr(e,this.planes[s]))return 0;for(const s of n)for(const c of this.frustumEdges){const h=dr([],s,c),f=Jr(h);if(f===0)continue;yi(h,h,1/f);const p=Qi(this.points,this.points[0],h),g=Qi(e,this.points[0],h);if(p[0]>g[1]||g[0]>p[1])return 0}return 1}containsPoint(e){for(const t of this.planes){const n=t[3];if(ki([t[0],t[1],t[2]],e)+n<0)return!1}return!0}}class Xt{static fromPoints(e){const t=[1/0,1/0,1/0],n=[-1/0,-1/0,-1/0];for(const s of e)Gn(t,t,s),Jn(n,n,s);return new Xt(t,n)}static fromTileIdAndHeight(e,t,n){const s=1<<e.canonical.z,c=e.canonical.x,h=e.canonical.y;return new Xt([c/s,h/s,t],[(c+1)/s,(h+1)/s,n])}static applyTransform(e,t){const n=e.getCorners();for(let s=0;s<n.length;++s)Vi(n[s],n[s],t);return Xt.fromPoints(n)}static applyTransformFast(e,t){const n=[t[12],t[13],t[14]],s=[...n];for(let c=0;c<3;c++)for(let h=0;h<3;h++){const f=t[4*h+c],p=f*e.min[h],g=f*e.max[h];n[c]+=Math.min(p,g),s[c]+=Math.max(p,g)}return new Xt(n,s)}static projectAabbCorners(e,t){const n=e.getCorners();for(let s=0;s<n.length;++s)Vi(n[s],n[s],t);return n}constructor(e,t){this.min=e,this.max=t,this.center=yi([],er([],this.min,this.max),.5)}quadrant(e){const t=[e%2==0,e<2],n=lc(this.min),s=lc(this.max);for(let c=0;c<t.length;c++)n[c]=t[c]?this.min[c]:this.center[c],s[c]=t[c]?this.center[c]:this.max[c];return s[2]=this.max[2],new Xt(n,s)}distanceX(e){return Math.max(Math.min(this.max[0],e[0]),this.min[0])-e[0]}distanceY(e){return Math.max(Math.min(this.max[1],e[1]),this.min[1])-e[1]}distanceZ(e){return Math.max(Math.min(this.max[2],e[2]),this.min[2])-e[2]}getCorners(){const e=this.min,t=this.max;return[[e[0],e[1],e[2]],[t[0],e[1],e[2]],[t[0],t[1],e[2]],[e[0],t[1],e[2]],[e[0],e[1],t[2]],[t[0],e[1],t[2]],[t[0],t[1],t[2]],[e[0],t[1],t[2]]]}intersects(e){return this.intersectsAabb(e.bounds)?Er(e,this.getCorners()):0}intersectsFlat(e){return this.intersectsAabb(e.bounds)?Er(e,[[this.min[0],this.min[1],0],[this.max[0],this.min[1],0],[this.max[0],this.max[1],0],[this.min[0],this.max[1],0]]):0}intersectsPrecise(e,t){return t||this.intersects(e)?rr(e,this.getCorners()):0}intersectsPreciseFlat(e,t){return t||this.intersectsFlat(e)?rr(e,[[this.min[0],this.min[1],0],[this.max[0],this.min[1],0],[this.max[0],this.max[1],0],[this.min[0],this.max[1],0]]):0}intersectsAabb(e){for(let t=0;t<3;++t)if(this.min[t]>e.max[t]||e.min[t]>this.max[t])return!1;return!0}intersectsAabbXY(e){return!(this.min[0]>e.max[0]||e.min[0]>this.max[0]||this.min[1]>e.max[1]||e.min[1]>this.max[1])}encapsulate(e){for(let t=0;t<3;t++)this.min[t]=Math.min(this.min[t],e.min[t]),this.max[t]=Math.max(this.max[t],e.max[t])}encapsulatePoint(e){for(let t=0;t<3;t++)this.min[t]=Math.min(this.min[t],e[t]),this.max[t]=Math.max(this.max[t],e[t])}closestPoint(e){return[Math.max(Math.min(this.max[0],e[0]),this.min[0]),Math.max(Math.min(this.max[1],e[1]),this.min[1]),Math.max(Math.min(this.max[2],e[2]),this.min[2])]}}Qe(Xt,"Aabb");class xn{constructor(e,t){this.feature=e,this.metersToTile=t,this.index=0}get(){const e=this.feature.vertices[this.index],t=this.feature.vertexProps[this.index].dir,n=t[1],s=-t[0],c=(e.extent+1)*this.metersToTile;return[new Fe(Math.trunc(e.position[0]+n*c),Math.trunc(e.position[1]+s*c)),new Fe(Math.trunc(e.position[0]-n*c),Math.trunc(e.position[1]-s*c))]}next(){this.index++}valid(){return this.index<this.feature.vertices.length}}class vn{constructor(e,t,n,s,c,h){if(this.vertices=new Array,this.vertexProps=new Array,this.edges=new Array,this.edgeProps=new Array,this._tmpVec2=[vr(),vr(),vr(),vr(),vr(),vr(),vr()],this.id=e,this.heightRange={min:n,max:n},this.safeArea=t,this.constantHeight=n,this.constantHeight==null&&(this.constantHeight!=null||s.length!==0)){this.vertices=s,this.edges=c,this.edges=this.edges.filter(f=>{return f.a<this.vertices.length&&f.b<this.vertices.length&&!((p=this.vertices[f.a].position)[0]===(g=this.vertices[f.b].position)[0]&&p[1]===g[1]);var p,g}),this.heightRange={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};for(const f of this.vertices)this.vertexProps.push({dir:So(0,0)}),this.heightRange.min=Math.min(this.heightRange.min,f.height),this.heightRange.max=Math.max(this.heightRange.max,f.height);for(const f of this.edges){const p=this.vertices[f.a].position,g=this.vertices[f.b].position,x=Io(vr(),g,p),b=ws(x),w=bs(vr(),x,1/b);this.edgeProps.push({vec:x,dir:w,len:b});const S=this.vertexProps[f.a].dir,E=this.vertexProps[f.b].dir;en(S,S,w),en(E,E,w)}for(const f of this.vertexProps)f.dir[0]===0&&f.dir[1]===0||to(f.dir,f.dir);this.tessellate(h)}}pointElevation(e){if(this.constantHeight!=null)return this.constantHeight;const t=this.getClosestEdge(e);if(t==null)return 0;const[n,s]=t;return dt(this.vertices[this.edges[n].a].height,this.vertices[this.edges[n].b].height,s)}computeSlopeNormal(e,t){const n=this.getClosestEdge(e);if(!n)return Bi(0,0,1);const s=n[0],c=this.edges[s],h=this.edgeProps[s].vec,f=Bi(h[0],h[1],(this.vertices[c.b].height-this.vertices[c.a].height)*t),p=Bi(f[1],-f[0],0);dr(p,p,f);const g=Jr(p);return g>0?yi(p,p,1/g):ri(p,0,0,1)}getSafeArea(){return this.safeArea}isTunnel(){return this.heightRange.max<=-5}getClosestEdge(e){if(this.edges.length===0)return;let t=0,n=Number.POSITIVE_INFINITY,s=0;const[c,h,f,p,g,x,b]=this._tmpVec2;vs(b,e.x,e.y);const w=new Wi(b,null);for(let S=0;S<this.edges.length;S++){const E=this.edges[S],A=this.edgeProps[S].dir;w.dir=A;const P=this.vertices[E.a].position,R=this.vertices[E.b].position,B=w.intersectsPlane(P,this.vertexProps[E.a].dir,c),L=w.intersectsPlane(R,this.vertexProps[E.b].dir,h);if(!B||!L)continue;Io(f,h,c),Io(p,b,c);const U=qo(f,f),G=U>0?qo(p,f)/U:0,q=k(G,0,1),ie=Math.abs((G-q)*this.edgeProps[S].len);Io(g,b,P),vs(x,A[1],-A[0]);const X=ie+Math.abs(qo(g,x));X<n&&(t=S,n=X,s=q)}return[t,s]}tessellate(e){const t=ei(),n=ei(),s=ei(),c=ei();for(let h=this.edges.length-1;h>=0;--h){const f=this.edges[h].a,p=this.edges[h].b,{position:g,height:x,extent:b}=this.vertices[f],{position:w,height:S,extent:E}=this.vertices[p],A=this.vertexProps[f].dir,P=this.vertexProps[p].dir;if(ri(t,g[0]/e,g[1]/e,x),ri(n,w[0]/e,w[1]/e,S),ri(s,A[1],-A[0],0),yi(s,s,b),ri(c,P[1],-P[0],0),yi(c,c,E),this.distSqLines(Bi(t[0]+.5*s[0],t[1]+.5*s[1],t[2]+.5*s[2]),Bi(n[0]-.5*c[0],n[1]-.5*c[1],n[2]-.5*c[2]),Bi(t[0]-.5*s[0],t[1]-.5*s[1],t[2]-.5*s[2]),Bi(n[0]+.5*c[0],n[1]+.5*c[1],n[2]+.5*c[2]))<=.0025000000000000005)continue;const R=this.vertices.length,B=en(vr(),g,w);this.vertices.push({position:bs(B,B,.5),height:.5*(x+S),extent:.5*(b+E)});const L=en(vr(),A,P);this.vertexProps.push({dir:to(L,L)}),this.edges.splice(h,1),this.edgeProps.splice(h,1),this.edges.push({a:f,b:R}),this.edges.push({a:R,b:p});const U=Io(vr(),this.vertices[R].position,g),G=ws(U),q={vec:U,dir:bs(vr(),U,1/G),len:G};this.edgeProps.push(q),this.edgeProps.push(q)}}distSqLines(e,t,n,s){const c=jn(ei(),t,e),h=jn(ei(),s,n),f=jn(ei(),e,n),p=ki(c,c),g=ki(c,h),x=ki(c,f),b=ki(h,h),w=ki(h,f),S=p*b-g*g;if(S===0)return Xa(ms(c,n,s,ki(f,h)/ki(h,h)),e);const E=(p*w-g*x)/S;return Xa(ms(c,e,t,(g*w-x*b)/S),ms(h,n,s,E))}}class ci{static parseFrom(e,t){const n=ii.parse(e);if(!n)return[];let{vertices:s,features:c}=n;const h=1/De(t);c.sort((x,b)=>x.id-b.id),s.sort((x,b)=>x.id-b.id||x.idx-b.idx),s=s.filter((x,b,w)=>b===w.findIndex(S=>S.id===x.id&&S.idx===x.idx));const f=new Array;let p=0;const g=s.length;for(const x of c){if(x.constantHeight){f.push(new vn(x.id,x.bounds,x.constantHeight));continue}for(;p!==g&&s[p].id<x.id;)p++;if(p===g||s[p].id!==x.id)continue;const b=new Array,w=new Array,S=p;for(;p!==g&&s[p].id===x.id;){const E=s[p];if(b.push({position:E.position,height:E.height,extent:E.extent}),p!==S&&s[p-1].idx===E.idx-1){const A=p-S;w.push({a:A-1,b:A})}p++}f.push(new vn(x.id,x.bounds,void 0,b,w,h))}return f}static getElevationFeature(e,t){if(!t)return;const n=+e.properties[Et];return Number.isNaN(n)?void 0:t.find(s=>s.id===n)}}class ui{constructor(e,t){this.zScale=1,this.xOffset=0,this.yOffset=0,e.equals(t)||(this.zScale=Math.pow(2,t.z-e.z),this.xOffset=(e.x*this.zScale-t.x)*Ze,this.yOffset=(e.y*this.zScale-t.y)*Ze)}constantElevation(e,t){if(e.constantHeight!=null)return this.computeBiasedHeight(e.constantHeight,t)}pointElevation(e,t,n){const s=this.constantElevation(t,n);return s??(e.x=e.x*this.zScale+this.xOffset,e.y=e.y*this.zScale+this.yOffset,this.computeBiasedHeight(t.pointElevation(e),n))}computeBiasedHeight(e,t){return t<=0?e:e+t*W(0,t,e>=0?e:Math.abs(.5*e))}}Qe(vn,"ElevationFeature");class Qt{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(t=>t.fqid),this.index=e.index,this.hasPattern=!1,this.projection=e.projection,this.layoutVertexArray=new sn,this.indexArray=new Ni,this.segments=new oi,this.programConfigurations=new D(e.layers,{zoom:e.zoom,lut:e.lut}),this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id),this.elevationMode=this.layers[0].layout.get("circle-elevation-reference"),this.hasElevation=!1,this.elevationMode!=="none"&&(this.elevatedLayoutVertexArray=new gn),this.worldview=e.worldview,this.hasAppearances=null}updateFootprints(e,t){}updateAppearances(e,t,n,s){return{hasLayoutChanges:!1,hasUboChanges:!1}}populate(e,t,n,s){const c=this.layers[0],h=[];let f=null;c.type==="circle"&&(f=c.layout.get("circle-sort-key"));for(const{feature:g,id:x,index:b,sourceLayerIndex:w}of e){const S=this.layers[0]._featureFilter.needGeometry,E=Ct(g,S);if(!this.layers[0]._featureFilter.filter(new Zt(this.zoom,{worldview:this.worldview,activeFloors:t.activeFloors}),E,n))continue;const A=f?f.evaluate(E,{},n):void 0,P={id:x,properties:g.properties,type:g.type,sourceLayerIndex:w,index:b,geometry:S?E.geometry:ft(g,n,s),patterns:{},sortKey:A};h.push(P)}f&&h.sort((g,x)=>g.sortKey-x.sortKey);let p=null;s.projection.name==="globe"&&(this.globeExtVertexArray=new _u,p=s.projection);for(const g of h){const{geometry:x,index:b,sourceLayerIndex:w}=g,S=e[b].feature;this.addFeature(g,x,b,t.availableImages,n,p,t.brightness,t.elevationFeatures),t.featureIndex.insert(S,x,b,w,this.index)}this.hasElevation||(this.elevatedLayoutVertexArray=void 0)}update(e,t,n,s,c,h,f){this.programConfigurations.updatePaintArrays(e,t,c,n,s,h,f,this.worldview)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,mp.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.globeExtVertexArray&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,a_.members)),this.elevatedLayoutVertexArray&&(this.elevatedLayoutVertexBuffer=e.createVertexBuffer(this.elevatedLayoutVertexArray,s_.members))),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy(),this.elevatedLayoutVertexBuffer&&this.elevatedLayoutVertexBuffer.destroy())}addFeature(e,t,n,s,c,h,f,p){let g;this.elevationMode!=="none"&&(g=ci.getElevationFeature(e,p));for(const x of t)for(const b of x){const w=b.x,S=b.y;if(w<0||w>=Ze||S<0||S>=Ze)continue;if(h){const P=h.projectTilePoint(w,S,c),R=h.upVector(c,w,S);this.addGlobeExtVertex(P,R),this.addGlobeExtVertex(P,R),this.addGlobeExtVertex(P,R),this.addGlobeExtVertex(P,R)}const E=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),A=E.vertexLength;if(this.addCircleVertex(w,S,-1,-1),this.addCircleVertex(w,S,1,-1),this.addCircleVertex(w,S,1,1),this.addCircleVertex(w,S,-1,1),this.elevationMode!=="none"){const P=g?g.pointElevation(new Fe(w,S)):0;this.hasElevation=this.hasElevation||P!==0;for(let R=0;R<4;R++)this.elevatedLayoutVertexArray.emplaceBack(P)}this.indexArray.emplaceBack(A,A+1,A+2),this.indexArray.emplaceBack(A,A+2,A+3),E.vertexLength+=4,E.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,{},s,c,f,void 0,this.worldview)}addCircleVertex(e,t,n,s){this.layoutVertexArray.emplaceBack(2*e+(n+1)/2,2*t+(s+1)/2)}addGlobeExtVertex(e,t){this.globeExtVertexArray.emplaceBack(e.x,e.y,e.z,t[0]*16384,t[1]*16384,t[2]*16384)}}function qi(r,e){for(let t=0;t<r.length;t++)if(Xr(e,r[t]))return!0;for(let t=0;t<e.length;t++)if(Xr(r,e[t]))return!0;return!!ns(r,e)}function Pr(r,e,t){return!!Xr(r,e)||!!zo(e,r,t)}function zi(r,e){if(r.length===1)return Fa(e,r[0]);for(let t=0;t<e.length;t++){const n=e[t];for(let s=0;s<n.length;s++)if(Xr(r,n[s]))return!0}for(let t=0;t<r.length;t++)if(Fa(e,r[t]))return!0;for(let t=0;t<e.length;t++)if(ns(r,e[t]))return!0;return!1}function ln(r,e,t){if(r.length>1){if(ns(r,e))return!0;for(let n=0;n<e.length;n++)if(zo(e[n],r,t))return!0}for(let n=0;n<r.length;n++)if(zo(r[n],e,t))return!0;return!1}function ns(r,e){if(r.length===0||e.length===0)return!1;for(let t=0;t<r.length-1;t++){const n=r[t],s=r[t+1];for(let c=0;c<e.length-1;c++)if(Ns(n,s,e[c],e[c+1]))return!0}return!1}function Ns(r,e,t,n){return St(r,t,n)!==St(e,t,n)&&St(r,e,t)!==St(r,e,n)}function Us(r,e,t){return(r.x-t.x)*(e.y-t.y)-(r.y-t.y)*(e.x-t.x)}function La(r,e,t,n){const s=Us(r,e,n),c=Us(r,e,t);if(Math.sign(s)===Math.sign(c))return;const h=Us(t,n,r),f=h+c-s;return Math.sign(h)!==Math.sign(f)?[h/(h-f),c/(c-s)]:void 0}function zo(r,e,t){const n=t*t;if(e.length===1)return r.distSqr(e[0])<n;for(let s=1;s<e.length;s++)if(ho(r,e[s-1],e[s])<n)return!0;return!1}function ho(r,e,t){const n=e.distSqr(t);if(n===0)return r.distSqr(e);const s=((r.x-e.x)*(t.x-e.x)+(r.y-e.y)*(t.y-e.y))/n;return r.distSqr(s<0?e:s>1?t:t.sub(e)._mult(s)._add(e))}function Fa(r,e){let t,n,s,c=!1;for(let h=0;h<r.length;h++){t=r[h];for(let f=0,p=t.length-1;f<t.length;p=f++)n=t[f],s=t[p],n.y>e.y!=s.y>e.y&&e.x<(s.x-n.x)*(e.y-n.y)/(s.y-n.y)+n.x&&(c=!c)}return c}function Xr(r,e){let t=!1;for(let n=0,s=r.length-1;n<r.length;s=n++){const c=r[n],h=r[s];c.y>e.y!=h.y>e.y&&e.x<(h.x-c.x)*(e.y-c.y)/(h.y-c.y)+c.x&&(t=!t)}return t}function os(r,e,t,n,s){for(const h of r)if(e<=h.x&&t<=h.y&&n>=h.x&&s>=h.y)return!0;const c=[new Fe(e,t),new Fe(e,s),new Fe(n,s),new Fe(n,t)];if(r.length>2){for(const h of c)if(Xr(r,h))return!0}for(let h=0;h<r.length-1;h++)if(ss(r[h],r[h+1],c))return!0;return!1}function ss(r,e,t){const n=t[0],s=t[2];if(r.x<n.x&&e.x<n.x||r.x>s.x&&e.x>s.x||r.y<n.y&&e.y<n.y||r.y>s.y&&e.y>s.y)return!1;const c=St(r,e,t[0]);return c!==St(r,e,t[1])||c!==St(r,e,t[2])||c!==St(r,e,t[3])}function as(r,e,t,n,s,c){let h=e.y-r.y,f=r.x-e.x;if(c=c||0){const p=h*h+f*f;if(p===0)return!0;const g=Math.sqrt(p);h/=g,f/=g}return!((t.x-r.x)*h+(t.y-r.y)*f-c<0||(n.x-r.x)*h+(n.y-r.y)*f-c<0||(s.x-r.x)*h+(s.y-r.y)*f-c<0)}function Iu(r,e,t,n,s,c,h){return!(as(r,e,n,s,c,h)||as(e,t,n,s,c,h)||as(t,r,n,s,c,h)||as(n,s,r,e,t,h)||as(s,c,r,e,t,h)||as(c,n,r,e,t,h))}function Oa(r,e,t){const n=e.paint.get(r).value;return n.kind==="constant"?n.value:t.programConfigurations.get(e.id).getMaxValue(r)}function _p(r){return Math.sqrt(r[0]*r[0]+r[1]*r[1])}function $g(r,e,t,n,s){if(!e[0]&&!e[1])return r;const c=Fe.convert(e)._mult(s);t==="viewport"&&c._rotate(-n);const h=[];for(let f=0;f<r.length;f++)h.push(r[f].sub(c));return h}function Hg(r,e,t,n){const s=Fe.convert(r)._mult(n);return e==="viewport"&&s._rotate(-t),s}let Zg,Wg;Qe(Qt,"CircleBucket",{omit:["layers"]});class Hl{constructor(e,t,n){this.z=e,this.x=t,this.y=n,this.key=Eu(0,e,e,t,n)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}isChildOf(e){const t=this.z-e.z;return e.z===0||e.z<this.z&&e.x===this.x>>t&&e.y===this.y>>t}url(e,t){const n=function(c,h,f){const p=2**f,g=2*Math.PI*6378137,x=g*(c/p-.5),b=g*(.5-(h+1)/p);return`${x},${b},${x+g/p},${b+g/p}`}(this.x,this.y,this.z),s=function(c,h,f){let p,g="";for(let x=c;x>0;x--)p=1<<x-1,g+=(h&p?1:0)+(f&p?2:0);return g}(this.z,this.x,this.y);return e[(this.x+this.y)%e.length].replace("{prefix}",(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String(t==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace("{quadkey}",s).replace("{bbox-epsg-3857}",n)}toString(){return`${this.z}/${this.x}/${this.y}`}}class Xg{constructor(e,t){this.wrap=e,this.canonical=t,this.key=Eu(e,t.z,t.z,t.x,t.y)}}class Nr{constructor(e,t,n,s,c){this.overscaledZ=e,this.wrap=t,this.canonical=new Hl(n,+s,+c),this.key=t===0&&e===n?this.canonical.key:Eu(t,e,n,s,c)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){const t=this.canonical.z-e;return e>this.canonical.z?new Nr(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Nr(e,this.wrap,e,this.canonical.x>>t,this.canonical.y>>t)}calculateScaledKey(e,t=!0){if(this.overscaledZ===e&&t)return this.key;if(e>this.canonical.z)return Eu(this.wrap*+t,e,this.canonical.z,this.canonical.x,this.canonical.y);{const n=this.canonical.z-e;return Eu(this.wrap*+t,e,e,this.canonical.x>>n,this.canonical.y>>n)}}isChildOf(e){if(e.wrap!==this.wrap)return!1;const t=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>>t&&e.canonical.y===this.canonical.y>>t}children(e){if(this.overscaledZ>=e)return[new Nr(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const t=this.canonical.z+1,n=2*this.canonical.x,s=2*this.canonical.y;return[new Nr(t,this.wrap,t,n,s),new Nr(t,this.wrap,t,n+1,s),new Nr(t,this.wrap,t,n,s+1),new Nr(t,this.wrap,t,n+1,s+1)]}isLessThan(e){return this.wrap<e.wrap||!(this.wrap>e.wrap)&&(this.overscaledZ<e.overscaledZ||!(this.overscaledZ>
vendor: 3,903 bytes, line 7
7e.overscaledZ)&&(this.canonical.x<e.canonical.x||!(this.canonical.x>e.canonical.x)&&this.canonical.y<e.canonical.y))}wrapped(){return new Nr(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new Nr(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 Xg(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}}function Eu(r,e,t,n,s){const c=1<<Math.min(t,22);let h=c*(s%c)+n%c;return r&&t<22&&(h+=c*c*((r<0?-2*r-1:2*r)%(1<<2*(22-t)))),16*(32*h+t)+(e-t)}const sb=[r=>{let e=r.canonical.x-1,t=r.wrap;return e<0&&(e=(1<<r.canonical.z)-1,t--),new Nr(r.overscaledZ,t,r.canonical.z,e,r.canonical.y)},r=>{let e=r.canonical.x+1,t=r.wrap;return e===1<<r.canonical.z&&(e=0,t++),new Nr(r.overscaledZ,t,r.canonical.z,e,r.canonical.y)},r=>new Nr(r.overscaledZ,r.wrap,r.canonical.z,r.canonical.x,(r.canonical.y===0?1<<r.canonical.z:r.canonical.y)-1),r=>new Nr(r.overscaledZ,r.wrap,r.canonical.z,r.canonical.x,r.canonical.y===(1<<r.canonical.z)-1?0:r.canonical.y+1)];Qe(Hl,"CanonicalTileID"),Qe(Nr,"OverscaledTileID",{omit:["projMatrix","expandedProjMatrix"]});const ab=zt([{type:"Float32",name:"a_globe_pos",components:3},{type:"Float32",name:"a_uv",components:2}]),{members:gp}=ab,Yg=zt([{name:"a_pos_3",components:3,type:"Int16"}]);var wd=zt([{name:"a_pos",type:"Int16",components:2}]);function yp(r){return r*H/te}const lb=[new Xt([Y,Y,Y],[re,re,re]),new Xt([Y,Y,Y],[0,0,re]),new Xt([0,Y,Y],[re,0,re]),new Xt([Y,0,Y],[0,re,re]),new Xt([0,0,Y],[re,re,re])];function Kg(r,e,t,n=!0){const s=yi([],r._camera.position,r.worldSize),c=[e,t,1,1];br(c,c,r.pixelMatrixInverse),Ks(c,c,1/c[3]);const h=xi([],Xi([],c,s)),f=r.globeMatrix,p=[f[12],f[13],f[14]],g=Xi([],p,s),x=Jr(g),b=xi([],g),w=r.worldSize/(2*Math.PI),S=ki(b,h),E=Math.asin(w/x);if(E<Math.acos(S)){if(!n)return null;const Q=[],J=[];yi(Q,h,x/S),xi(J,Xi(J,Q,g)),xi(h,er(h,g,yi(h,J,Math.tan(E)*x)))}const A=[];new Rt(s,h).closestPointOnSphere(p,w,A);const P=xi([],fi(f,0)),R=xi([],fi(f,1)),B=xi([],fi(f,2)),L=ki(P,A),U=ki(R,A),G=ki(B,A),q=Zi(Math.asin(-U/w));let ie=Zi(Math.atan2(L,G));ie=r.center.lng+function(Q,J){const ve=(J-Q+180)%360-180;return ve<-180?ve+360:ve}(r.center.lng,ie);const X=Me(ie),ee=k(Le(q),0,1);return new tt(X,ee)}class cb{constructor(e,t,n){this.a=Xi([],e,n),this.b=Xi([],t,n),this.center=n;const s=xi([],this.a),c=xi([],this.b);this.angle=Math.acos(ki(s,c))}}function f_(r,e){if(r.angle===0)return null;let t;return t=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)),t<0||t>1?null:function(n,s,c,h){const f=Math.sin(c);return n*(Math.sin((1-h)*c)/f)+s*(Math.sin(h*c)/f)}(r.a[e],r.b[e],r.angle,k(t,0,1))+r.center[e]}function ls(r){if(r.z<=1)return lb[r.z+2*r.y+r.x];const e=p_(xp(r));return Xt.fromPoints(e)}function js(r,e,t){return yi(r,r,1-t),un(r,r,e,t)}function Qg(r,e){const t=Gs(e.zoom);if(t===0)return ls(r);const n=xp(r),s=p_(n),c=Me(n.getWest())*e.worldSize,h=Me(n.getEast())*e.worldSize,f=Le(n.getNorth())*e.worldSize,p=Le(n.getSouth())*e.worldSize,g=[c,f,0],x=[h,f,0],b=[c,p,0],w=[h,p,0],S=An([],e.globeMatrix);return Vi(g,g,S),Vi(x,x,S),Vi(b,b,S),Vi(w,w,S),s[0]=js(s[0],b,t),s[1]=js(s[1],w,t),s[2]=js(s[2],x,t),s[3]=js(s[3],g,t),Xt.fromPoints(s)}function Jg(r,e,t){for(const n of r)Vi(n,n,e),yi(n,n,t)}function ey(r,e,t,n){const s=e/r.worldSize,c=r.globeMatrix;if(t.z<=1){const ee=ls(t).getCorners();return Jg(ee,c,s),Xt.fromPoints(ee)}const h=xp(t,n),f=p_(h,H+yp(r._tileCoverLift));Jg(f,c,s);const p=Number.MAX_VALUE,g=[-p,-p,-p],x=[p,p,p];if(h.contains(r.center)){for(const J of f)Gn(x,x,J),Jn(g,g,J);g[2]=0;const ee=r.point,Q=[ee.x*s,ee.y*s,0];return Gn(x,x,Q),Jn(g,g,Q),new Xt(x,g)}if(r._tileCoverLift>0){for(const ee of f)Gn(x,x,ee),Jn(g,g,ee);return new Xt(x,g)}
vendor: 4,296 bytes, line 7
7const b=[c[12]*s,c[13]*s,c[14]*s],w=h.getCenter(),S=k(r.center.lat,-85.051129,Se),E=k(w.lat,-85.051129,Se),A=Me(r.center.lng),P=Le(S);let R=A-Me(w.lng);const B=P-Le(E);R>.5?R-=1:R<-.5&&(R+=1);let L=0;Math.abs(R)>Math.abs(B)?L=R>=0?1:3:(L=B>=0?0:2,un(b,b,[c[4]*s,c[5]*s,c[6]*s],-Math.sin(Vt(B>=0?h.getSouth():h.getNorth()))*H));const U=f[L],G=f[(L+1)%4],q=new cb(U,G,b),ie=[f_(q,0)||U[0],f_(q,1)||U[1],f_(q,2)||U[2]],X=Gs(r.zoom);if(X>0){const ee=function({x:J,y:ve,z:Te},Ie,Ce,Ee,Oe){const ye=1/(1<<Te);let Ae=J*ye,Pe=Ae+ye,Be=ve*ye,Ue=Be+ye,Je=0;const He=(Ae+Pe)/2-Ee;return He>.5?Je=-1:He<-.5&&(Je=1),Ae=((Ae+Je)*Ie-(Ee*=Ie))*Ce+Ee,Pe=((Pe+Je)*Ie-Ee)*Ce+Ee,Be=(Be*Ie-(Oe*=Ie))*Ce+Oe,Ue=(Ue*Ie-Oe)*Ce+Oe,[[Ae,Ue,0],[Pe,Ue,0],[Pe,Be,0],[Ae,Be,0]]}(t,e,r._pixelsPerMercatorPixel,A,P);for(let J=0;J<f.length;J++)js(f[J],ee[J],X);const Q=er([],ee[L],ee[(L+1)%4]);yi(Q,Q,.5),js(ie,Q,X)}for(const ee of f)Gn(x,x,ee),Jn(g,g,ee);return x[2]=Math.min(U[2],G[2]),Gn(x,x,ie),Jn(g,g,ie),new Xt(x,g)}function xp({x:r,y:e,z:t},n=!1){const s=1/(1<<t),c=new se(le(r*s),e===(1<<t)-1&&n?-90:xe((e+1)*s)),h=new se(le((r+1)*s),e===0&&n?90:xe(e*s));return new be(c,h)}function p_(r,e=H){const t=Vt(r.getNorth()),n=Vt(r.getSouth()),s=Math.cos(t),c=Math.cos(n),h=Math.sin(t),f=Math.sin(n),p=r.getWest(),g=r.getEast();return[Z(c,f,p,e),Z(c,f,g,e),Z(s,h,g,e),Z(s,h,p,e)]}function Td(r,e,t,n){const s=1<<t.z,c=(r/Ze+t.x)/s;return K(xe((e/Ze+t.y)/s),le(c),n)}function vp({min:r,max:e}){return 16383/Math.max(e[0]-r[0],e[1]-r[1],e[2]-r[2])}const ty=new Float64Array(16);function Sd(r){const e=vp(r),t=Un(ty,[e,e,e]);return Qr(t,t,Uo([],r.min))}function m_(r){const e=function(n,s){return n[0]=1,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=1,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=1,n[11]=0,n[12]=s[0],n[13]=s[1],n[14]=s[2],n[15]=1,n}(ty,r.min),t=1/vp(r);return Mr(e,e,[t,t,t])}function __(r){const e=Ze/(2*Math.PI);return r/(2*Math.PI)/e}function iy(r,e){return Ze/(512*Math.pow(2,r))*vp(ls(e))}function ry(r,e,t,n,s){const c=__(t),h=[r,e,-t/(2*Math.PI)],f=Ei(new Float64Array(16));return Qr(f,f,h),Mr(f,f,[c,c,c]),xo(f,f,Vt(-s)),Nn(f,f,Vt(-n)),f}function Gs(r){return W(5,6,r)}function ny(r,e){const t=K(e.lat,e.lng),n=function(E){const A=K(E._center.lat,E._center.lng);let P=dr([],Bi(0,1,0),A);const R=bo([],-E.angle,A);P=Vi(P,P,R),bo(R,-E._pitch,P);const B=xi([],A);return yi(B,B,yp(E.cameraToCenterDistance/E.pixelsPerMeter)),Vi(B,B,R),er([],A,B)}(r);return h=(s=jn([],n,t))[0],f=s[1],p=s[2],g=(c=t)[0],x=c[1],b=c[2],S=(w=Math.sqrt((h*h+f*f+p*p)*(g*g+x*x+b*b)))&&ki(s,c)/w,Math.acos(Math.min(Math.max(S,-1),1));var s,c,h,f,p,g,x,b,w,S}function g_(r,e){return ny(r,e)>Math.PI/2*1.01}const oy=Vt(85),ub=Math.cos(oy),hb=Math.sin(oy),db=ps(),sy=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 ay(r,e,t,n,s,c,h,f,p){if(c&&r.queryGeometry.isAboveHorizon)return!1;c&&(p*=r.pixelToTileUnitsFactor);const g=r.tileID.canonical,x=t.projection.upVectorScale(g,t.center.lat,t.worldSize).metersToTile;for(const b of e)for(const w of b){const S=w.add(f),E=s&&t.elevation?t.elevation.exaggeration()*s.getElevationAt(S.x,S.y,!0):0,A=t.projection.projectTilePoint(S.x,S.y,g);if(E>0){const L=t.projection.upVector(g,S.x,S.y);A.x+=L[0]*x*E,A.y+=L[1]*x*E,A.z+=L[2]*x*E}const P=c?S:fb(A.x,A.y,A.z,n),R=c?r.tilespaceRays.map(L=>mb(L,E)):r.queryGeometry.screenGeometry,B=br([],[A.x,A.y,A.z,1],n);if(!h&&c?p*=B[3]/t.cameraToCenterDistance:h&&!c&&(p*=t.cameraToCenterDistance/B[3]),c){const L=xe((w.y/Ze+g.y)/(1<<g.z));p/=t.projection.pixelsPerMeter(L,1)/fe(1,L)}if(Pr(R,P,p))return!0}return!1}function fb(r,e,t,n){const s=br([],[r,e,t,1],n);return new Fe(s[0]/s[3],s[1]/s[3])}const ly=Bi(0,0,0),pb=Bi(0,0,1);function mb(r,e){const t=ei();return ly[2]=e,r.intersectsPlane(ly,pb,t),new Fe(t[0],t[1])}class cy extends Qt{}let uy,hy,dy,fy;function py(r,{width:e,height:t},n,s){if(s){if(s instanceof Uint8ClampedArray)s=new Uint8Array(s.buffer);else if(s.length!==e*t*n)throw new RangeError("mismatched image size")}else s=new Uint8Array(e*t*n);return r.width=e,r.height=t,r.data=s,r}function my(r,e,t){const{width:n,height:s}=e;n===r.width&&s===r.height||(y_(r,e,{x:0,y:0},{x:0,y:0},{width:Math.min(r.width,n),height:Math.min(r.height,s)}
7,t,null),r.width=n,r.height=s,r.data=e.data)}function y_(r,e,t,n,s,c,h,f){if(s.width===0||s.height===0)return e;if(s.width>r.width||s.height>r.height||t.x>r.width-s.width||t.y>r.height-s.height)throw new RangeError("out of range source coordinates for image copy");if(s.width>e.width||s.height>e.height||n.x>e.width-s.width||n.y>e.height-s.height)throw new RangeError("out of range destination coordinates for image copy");const p=r.data,g=e.data,x=c===4&&f;for(let b=0;b<s.height;b++){const w=((t.y+b)*r.width+t.x)*c,S=((n.y+b)*e.width+n.x)*c;if(x)for(let E=0;E<s.width;E++){const A=w+E*c+3,P=S+E*c;g[P+0]=255,g[P+1]=255,g[P+2]=255,g[P+3]=p[A]}else if(h)for(let E=0;E<s.width;E++){const A=w+E*c,P=S+E*c,R=new jt(p[A+0]/255,p[A+1]/255,p[A+2]/255,p[A+3]).toNonPremultipliedRenderColor(h).toArray();g[P+0]=R[0],g[P+1]=R[1],g[P+2]=R[2],g[P+3]=R[3]}else for(let E=0;E<s.width*c;E++)g[S+E]=p[w+E]}return e}Qe(cy,"HeatmapBucket",{omit:["layers"]});class Ba{constructor(e,t){py(this,e,1,t)}resize(e){my(this,new Ba(e),1)}clone(){return new Ba({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,t,n,s,c){y_(e,t,n,s,c,1,null)}}class Dr{constructor(e,t){py(this,e,4,t)}resize(e){my(this,new Dr(e),4)}replace(e,t){t?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new Dr({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,t,n,s,c,h,f){y_(e,t,n,s,c,4,h,f)}}class _y{constructor(e,t){this.width=e.width,this.height=e.height,this.data=t instanceof Uint8Array?new Float32Array(t.buffer):t}}function Id(r){const e={},t=r.resolution||256,n=r.clips?r.clips.length:1,s=r.image||new Dr({width:t,height:n}),c=(h,f,p)=>{e[r.evaluationKey]=p;const g=r.expression.evaluate(e),x=g?g.toNonPremultipliedRenderColor(null):null;x&&(s.data[h+f+0]=Math.floor(255*x.r),s.data[h+f+1]=Math.floor(255*x.g),s.data[h+f+2]=Math.floor(255*x.b),s.data[h+f+3]=Math.floor(255*x.a))};if(r.clips)for(let h=0,f=0;h<n;++h,f+=4*t)for(let p=0,g=0;p<t;p++,g+=4){const x=p/(t-1),{start:b,end:w}=r.clips[h];c(f,g,b*(1-x)+w*x)}else for(let h=0,f=0;h<t;h++,f+=4)c(0,f,h/(t-1));return s}Qe(Ba,"AlphaImage"),Qe(Dr,"RGBAImage");const _b=zt([{name:"a_pos",components:2,type:"Int16"}],4),gb=zt([{name:"a_road_z_offset",components:1,type:"Float32"}],4),yb=zt([{name:"a_pos",components:2,type:"Int16"},{name:"a_height",components:1,type:"Float32"}],4),xb=zt([{name:"a_pos_normal_3",components:3,type:"Int16"}],4);function Au(r,e,t=2){const n=e&&e.length,s=n?e[0]*t:r.length;let c=gy(r,0,s,t,!0);const h=[];if(!c||c.next===c.prev)return h;let f,p,g;if(n&&(c=function(x,b,w,S){const E=[];for(let A=0,P=b.length;A<P;A++){const R=gy(x,b[A]*S,A<P-1?b[A+1]*S:x.length,S,!1);R===R.next&&(R.steiner=!0),E.push(Ab(R))}E.sort(Sb);for(let A=0;A<E.length;A++)w=Ib(E[A],w);return w}(r,e,c,t)),r.length>80*t){f=r[0],p=r[1];let x=f,b=p;for(let w=t;w<s;w+=t){const S=r[w],E=r[w+1];S<f&&(f=S),E<p&&(p=E),S>x&&(x=S),E>b&&(b=E)}g=Math.max(x-f,b-p),g=g!==0?32767/g:0}return Ed(c,h,t,f,p,g,0),h}function gy(r,e,t,n,s){let c;if(s===function(h,f,p,g){let x=0;for(let b=f,w=p-g;b<p;b+=g)x+=(h[w]-h[b])*(h[b+1]+h[w+1]),w=b;return x}(r,e,t,n)>0)for(let h=e;h<t;h+=n)c=by(h/n|0,r[h],r[h+1],c);else for(let h=t-n;h>=e;h-=n)c=by(h/n|0,r[h],r[h+1],c);return c&&Cu(c,c.next)&&(Md(c),c=c.next),c}function Zl(r,e){if(!r)return r;e||(e=r);let t,n=r;do if(t=!1,n.steiner||!Cu(n,n.next)&&_r(n.prev,n,n.next)!==0)n=n.next;else{if(Md(n),n=e=n.prev,n===n.next)break;t=!0}while(t||n!==e);return e}function Ed(r,e,t,n,s,c,h){if(!r)return;!h&&c&&function(p,g,x,b){let w=p;do w.z===0&&(w.z=x_(w.x,w.y,g,x,b)),w.prevZ=w.prev,w.nextZ=w.next,w=w.next;while(w!==p);w.prevZ.nextZ=null,w.prevZ=null,function(S){let E,A=1;do{let P,R=S;S=null;let B=null;for(E=0;R;){E++;let L=R,U=0;for(let q=0;q<A&&(U++,L=L.nextZ,L);q++);let G=A;for(;U>0||G>0&&L;)U!==0&&(G===0||!L||R.z<=L.z)?(P=R,R=R.nextZ,U--):(P=L,L=L.nextZ,G--),B?B.nextZ=P:S=P,P.prevZ=B,B=P;R=L}B.nextZ=null,A*=2}while(E>1)}(w)}(r,n,s,c);let f=r;for(;r.prev!==r.next;){const p=r.prev,g=r.next;
vendor: 1,697 bytes, line 7
7if(c?bb(r,n,s,c):vb(r))e.push(p.i,r.i,g.i),Md(r),r=g.next,f=g.next;else if((r=g)===f){h?h===1?Ed(r=wb(Zl(r),e),e,t,n,s,c,2):h===2&&Tb(r,e,t,n,s,c):Ed(Zl(r),e,t,n,s,c,1);break}}}function vb(r){const e=r.prev,t=r,n=r.next;if(_r(e,t,n)>=0)return!1;const s=e.x,c=t.x,h=n.x,f=e.y,p=t.y,g=n.y,x=Math.min(s,c,h),b=Math.min(f,p,g),w=Math.max(s,c,h),S=Math.max(f,p,g);let E=n.next;for(;E!==e;){if(E.x>=x&&E.x<=w&&E.y>=b&&E.y<=S&&Ad(s,f,c,p,h,g,E.x,E.y)&&_r(E.prev,E,E.next)>=0)return!1;E=E.next}return!0}function bb(r,e,t,n){const s=r.prev,c=r,h=r.next;if(_r(s,c,h)>=0)return!1;const f=s.x,p=c.x,g=h.x,x=s.y,b=c.y,w=h.y,S=Math.min(f,p,g),E=Math.min(x,b,w),A=Math.max(f,p,g),P=Math.max(x,b,w),R=x_(S,E,e,t,n),B=x_(A,P,e,t,n);let L=r.prevZ,U=r.nextZ;for(;L&&L.z>=R&&U&&U.z<=B;){if(L.x>=S&&L.x<=A&&L.y>=E&&L.y<=P&&L!==s&&L!==h&&Ad(f,x,p,b,g,w,L.x,L.y)&&_r(L.prev,L,L.next)>=0||(L=L.prevZ,U.x>=S&&U.x<=A&&U.y>=E&&U.y<=P&&U!==s&&U!==h&&Ad(f,x,p,b,g,w,U.x,U.y)&&_r(U.prev,U,U.next)>=0))return!1;U=U.nextZ}for(;L&&L.z>=R;){if(L.x>=S&&L.x<=A&&L.y>=E&&L.y<=P&&L!==s&&L!==h&&Ad(f,x,p,b,g,w,L.x,L.y)&&_r(L.prev,L,L.next)>=0)return!1;L=L.prevZ}for(;U&&U.z<=B;){if(U.x>=S&&U.x<=A&&U.y>=E&&U.y<=P&&U!==s&&U!==h&&Ad(f,x,p,b,g,w,U.x,U.y)&&_r(U.prev,U,U.next)>=0)return!1;U=U.nextZ}return!0}function wb(r,e){let t=r;do{const n=t.prev,s=t.next.next;!Cu(n,s)&&xy(n,t,t.next,s)&&Cd(n,s)&&Cd(s,n)&&(e.push(n.i,t.i,s.i),Md(t),Md(t.next),t=r=s),t=t.next}while(t!==r);return Zl(t)}function Tb(r,e,t,n,s,c){let h=r;do{let f=h.next.next;for(;f!==h.prev;){if(h.i!==f.i&&Cb(h,f)){let p=vy(h,f);return h=Zl(h,h.next),p=Zl(p,p.next),Ed(h,e,t,n,s,c,0),void Ed(p,e,t,n,s,c,0)}f=f.next}h=h.next}while(h!==r)}function Sb(r,e){let t=r.x-e.x;
vendor: 30,271 bytes, line 7
7return t===0&&(t=r.y-e.y,t===0)&&(t=(r.next.y-r.y)/(r.next.x-r.x)-(e.next.y-e.y)/(e.next.x-e.x)),t}function Ib(r,e){const t=function(s,c){let h=c;const f=s.x,p=s.y;let g,x=-1/0;if(Cu(s,h))return h;do{if(Cu(s,h.next))return h.next;if(p<=h.y&&p>=h.next.y&&h.next.y!==h.y){const A=h.x+(p-h.y)*(h.next.x-h.x)/(h.next.y-h.y);if(A<=f&&A>x&&(x=A,g=h.x<h.next.x?h:h.next,A===f))return g}h=h.next}while(h!==c);if(!g)return null;const b=g,w=g.x,S=g.y;let E=1/0;h=g;do{if(f>=h.x&&h.x>=w&&f!==h.x&&yy(p<S?f:x,p,w,S,p<S?x:f,p,h.x,h.y)){const A=Math.abs(p-h.y)/(f-h.x);Cd(h,s)&&(A<E||A===E&&(h.x>g.x||h.x===g.x&&Eb(g,h)))&&(g=h,E=A)}h=h.next}while(h!==b);return g}(r,e);if(!t)return e;const n=vy(t,r);return Zl(n,n.next),Zl(t,t.next)}function Eb(r,e){return _r(r.prev,r,e.prev)<0&&_r(e.next,r,r.next)<0}function x_(r,e,t,n,s){return(r=1431655765&((r=858993459&((r=252645135&((r=16711935&((r=(r-t)*s|0)|r<<8))|r<<4))|r<<2))|r<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*s|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Ab(r){let e=r,t=r;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==r);return t}function yy(r,e,t,n,s,c,h,f){return(s-h)*(e-f)>=(r-h)*(c-f)&&(r-h)*(n-f)>=(t-h)*(e-f)&&(t-h)*(c-f)>=(s-h)*(n-f)}function Ad(r,e,t,n,s,c,h,f){return!(r===h&&e===f)&&yy(r,e,t,n,s,c,h,f)}function Cb(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!function(t,n){let s=t;do{if(s.i!==t.i&&s.next.i!==t.i&&s.i!==n.i&&s.next.i!==n.i&&xy(s,s.next,t,n))return!0;s=s.next}while(s!==t);return!1}(r,e)&&(Cd(r,e)&&Cd(e,r)&&function(t,n){let s=t,c=!1;const h=(t.x+n.x)/2,f=(t.y+n.y)/2;do s.y>f!=s.next.y>f&&s.next.y!==s.y&&h<(s.next.x-s.x)*(f-s.y)/(s.next.y-s.y)+s.x&&(c=!c),s=s.next;while(s!==t);return c}(r,e)&&(_r(r.prev,r,e.prev)||_r(r,e.prev,e))||Cu(r,e)&&_r(r.prev,r,r.next)>0&&_r(e.prev,e,e.next)>0)}function _r(r,e,t){return(e.y-r.y)*(t.x-e.x)-(e.x-r.x)*(t.y-e.y)}function Cu(r,e){return r.x===e.x&&r.y===e.y}function xy(r,e,t,n){const s=wp(_r(r,e,t)),c=wp(_r(r,e,n)),h=wp(_r(t,n,r)),f=wp(_r(t,n,e));return s!==c&&h!==f||!(s!==0||!bp(r,t,e))||!(c!==0||!bp(r,n,e))||!(h!==0||!bp(t,r,n))||!(f!==0||!bp(t,e,n))}function bp(r,e,t){return e.x<=Math.max(r.x,t.x)&&e.x>=Math.min(r.x,t.x)&&e.y<=Math.max(r.y,t.y)&&e.y>=Math.min(r.y,t.y)}function wp(r){return r>0?1:r<0?-1:0}function Cd(r,e){return _r(r.prev,r,r.next)<0?_r(r,e,r.next)>=0&&_r(r,r.prev,e)>=0:_r(r,e,r.prev)<0||_r(r,r.next,e)<0}function vy(r,e){const t=v_(r.i,r.x,r.y),n=v_(e.i,e.x,e.y),s=r.next,c=e.prev;return r.next=e,e.prev=r,t.next=s,s.prev=t,n.next=t,t.prev=n,c.next=n,n.prev=c,n}function by(r,e,t,n){const s=v_(r,e,t);return n?(s.next=n.next,s.prev=n,n.next.prev=s,n.next=s):(s.prev=s,s.next=s),s}function Md(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 v_(r,e,t){return{i:r,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function Pd(r,e){const t=r.length;if(t<=1)return[r];const n=[];let s,c;for(let h=0;h<t;h++){const f=vt(r[h]);f!==0&&(r[h].area=Math.abs(f),c===void 0&&(c=f<0),c===f<0?(s&&n.push(s),s=[r[h]]):s.push(r[h]))}if(s&&n.push(s),e>1)for(let h=0;h<n.length;h++)n[h].length<=e||(xf(n[h],e,1,n[h].length-1,Mb),n[h]=n[h].slice(0,e));return n}function Mb(r,e){return e.area-r.area}function wy(r,e,t=1){if(!r)return null;const n=typeof r=="string"?Zr.from(r).getPrimary():r.getPrimary(),s=typeof r=="string"?null:r.getSecondary();for(const c of[n,s]){if(!c)continue;const h=c.id.toString();e.has(h)||e.set(h,[]),c.scaleSelf(t),e.get(h).push(c)}return{primary:n.toString(),secondary:s?s.toString():null}}function b_(r,e,t,n){const s=n.patternDependencies;let c=!1;for(const h of e){const f=h.paint.get(`${r}-pattern`);f.isConstant()||(c=!0),wy(f.constantOr(null),s,t)&&(c=!0)}return c}function w_(r,e,t,n,s,c){const h=c.patternDependencies;for(const f of e){const p=f.paint.get(`${r}-pattern`).value;if(p.kind!=="constant"){const g=wy(p.evaluate({zoom:n},t,{},void 0,c.availableImages),h,s);if(!g)continue;const{primary:x,secondary:b}=g;x&&(t.patterns[f.id]=[x,b].filter(Boolean))}}return t}class qs{constructor(){this.portals=[]}static isOnBorder(e,t){return e<=0&&t<=0||e>=Ze&&t>=Ze}static evaluate(e){if(e.length===0)return new qs;let t=[];for(const p of e)t.push(...p.portals);if(t.length===0)return new qs;for(const p of t){const g=p.va,x=p.vb;(qs.isOnBorder(g.x,x.x)||qs.isOnBorder(g.y,x.y))&&(p.type="border")}const n=t.filter(p=>p.type!=="unevaluated"),s=t.filter(p=>p.type==="unevaluated");if(s.length===0)return new qs;s.sort((p,g)=>p.hash===g.hash?p.isTunnel===g.isTunnel?0:p.isTunnel?-1:1:p.hash<g.hash?1:-1),t=n.concat(s);let c=n.length,h=c,f=c;do if(h++,h===t.length||t[c].hash!==t[h].hash){if(h-c===2){f<c&&(t[f]=t[c],t[c]=null);const p=t[f],g=t[h-1];p.type=p.isTunnel!==g.isTunnel?"tunnel":"polygon",p.connection={a:p.connection.a,b:g.connection.a},f++}c=h}while(c!==t.length);return t.splice(f),t.sort((p,g)=>p.hash<g.hash?1:-1),{portals:t}}}Qe(qs,"ElevationPortalGraph");class Pb{constructor(e,t,n){this.outPositions=e,this.outNormals=t,this.outIndices=n,this.vertexLookup=new Map}addVertex(e,t,n){let s=e[2];n!=null&&(s*=n);const c=`${e[0]},${e[1]},${e[2]},${t[0]},${t[1]},${t[2]}`,h=this.vertexLookup.get(c);if(h!=null)return h;const f=this.outPositions.length;this.vertexLookup.set(c,f);const p=Math.trunc(16384*t[0]),g=Math.trunc(16384*t[1]),x=Math.trunc(16384*t[2]);return this.outPositions.emplaceBack(e[0],e[1],s),this.outNormals.emplaceBack(p,g,x),f}addTriangle(e,t,n){this.outIndices.emplaceBack(e,t,n)}addTriangles(e,t,n){if(e.length===0)return;const s=n.length===1,c=ei(),h=ei();for(let f=0;f<e.length;f+=3){const p=t[e[f+0]],g=t[e[f+1]],x=t[e[f+2]],b=s?n[0]:n[e[f+1]],w=s?n[0]:n[e[f+2]];ri(c,p.x,p.y,s?n[0]:n[e[f+0]]);const S=this.addVertex(c,h);ri(c,g.x,g.y,b);const E=this.addVertex(c,h);ri(c,x.x,x.y,w);const A=this.addVertex(c,h);this.outIndices.emplaceBack(S,E,A)}}addQuad(e,t,n,s,c,h){const f=this.addVertex(e,c,h),p=this.addVertex(t,c,h),g=this.addVertex(n,c,h),x=this.addVertex(s,c,h);this.addTriangle(f,p,g),this.addTriangle(g,x,f)}getVertexCount(){return this.outPositions.length}clearVertexLookup(){this.vertexLookup.clear()}}class bn{constructor(e,t,n,s){this.unevaluatedPortals=new qs,this.bridgeFeatureSections=[],this.tunnelFeatureSections=[],this.vertexHashLookup=new Map,this.unevalVertices=[],this.unevalHeights=[],this.unevalTriangles=[],this.unevalTunnelTriangles=[],this.unevalEdges=[],this.vertexPositions=new od,this.vertexNormals=new sd,this.indexArray=new Ni,this.tileToMeters=De(e),this.bridgeProgramConfigurations=new D(t,{zoom:n,lut:s},c=>c!=="fill-tunnel-structure-color"),this.tunnelProgramConfigurations=new D(t,{zoom:n,lut:s},c=>c!=="fill-bridge-guard-rail-color")}addVertices(e,t){const n=this.unevalVertices.length;for(let s=0;s<e.length;s++)this.unevalVertices.push(e[s]),this.unevalHeights.push(t[s]);return n}addTriangles(e,t,n){const s=n?this.unevalTunnelTriangles:this.unevalTriangles;for(const c of e)s.push(c+t)}addRenderableRing(e,t,n,s,c,h){const f=[new Fe(c.min.x,c.min.y),new Fe(c.max.x,c.min.y),new Fe(c.max.x,c.max.y),new Fe(c.min.x,c.max.y)];for(let p=0;p<n-1;p++){const g=t+p,x=g+1,b=this.unevalVertices[g],w=this.unevalVertices[x];if(!(b.x>=c.min.x&&b.x<=c.max.x&&b.y>=c.min.y&&b.y<=c.max.y||w.x>=c.min.x&&w.x<=c.max.x&&w.y>=c.min.y&&w.y<=c.max.y||ss(b,w,f))||this.isOnBorder(b.x,w.x)||this.isOnBorder(b.y,w.y))continue;const S=bn.computeEdgeHash(this.unevalVertices[g],this.unevalVertices[x]);let E,A=this.vertexHashLookup.get(bn.computePosHash(b));A!=null?E=A.next:(A=this.vertexHashLookup.get(bn.computePosHash(w)),E=A!=null?A.prev:S),this.unevalEdges.push({polygonIdx:e,a:g,b:x,hash:S,portalHash:E,isTunnel:s,type:"unevaluated",featureInfo:h})}}addPortalCandidates(e,t,n,s,c){if(t.length!==0){this.vertexHashLookup.clear();for(const h of t){if(h.length===0)continue;const f=h[0];let p=bn.computeEdgeHash(f[f.length-2],f[f.length-1]);for(let g=0;g<f.length-1;g++){const x=f[g+0],b=f[g+1],w=So(b.x-x.x,b.y-x.y),S=ws(w);if(S===0)continue;let E="unevaluated";const A=s.pointElevation(x),P=s.pointElevation(b);Math.abs(A)<.01&&Math.abs(P)<.01?E="entrance":(this.isOnBorder(x.x,b.x)||this.isOnBorder(x.y,b.y))&&(E="border");const R=bn.computeEdgeHash(x,b);this.unevaluatedPortals.portals.push({connection:{a:e,b:void 0},va:x,vb:b,vab:w,length:S,hash:R,isTunnel:n,type:E});const B=bn.computePosHash(x);this.vertexHashLookup.set(B,{prev:p,next:R}),p=R}}}}construct(e){if(this.unevalVertices.length===0)return;const t=()=>({vertexOffset:0,primitiveOffset:this.indexArray.length}),n=w=>{w.primitiveLength=this.indexArray.length-w.primitiveOffset},s=new Pb(this.vertexPositions,this.vertexNormals,this.indexArray);this.prepareEdges(e.portals,this.unevalEdges);const c=t(),h=t(),f=t(),p=(w,S)=>{w.sort((A,P)=>A.type===S&&P.type!==S?-1:A.type!==S&&P.type===S?1:0);const E=w.findIndex(A=>A.type!==S);return E>=0?E:w.length};let g=0;this.unevalEdges.length>0&&(g=p(this.unevalEdges,"none"),this.constructBridgeStructures(s,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:g},this.tileToMeters)),n(f);const x=t(),b=t();if(this.unevalEdges.length>0){const w=this.unevalEdges.splice(g),S=p(w,"tunnel")+g;this.unevalEdges.push(...w),this.constructTunnelStructures(s,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:g},{min:g,max:S})}n(x),s.addTriangles(this.unevalTriangles,this.unevalVertices,this.unevalHeights),n(b),s.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,this.unevalHeights),n(h),s.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,[-.1]),n(c),this.maskSegments=oi.simpleSegment(0,b.primitiveOffset,0,b.primitiveLength),this.depthSegments=oi.simpleSegment(0,h.primitiveOffset,0,h.primitiveLength),this.renderableBridgeSegments=oi.simpleSegment(0,f.primitiveOffset,0,f.primitiveLength),this.renderableTunnelSegments=oi.simpleSegment(0,x.primitiveOffset,0,x.primitiveLength),this.shadowCasterSegments=oi.simpleSegment(0,c.primitiveOffset,0,c.primitiveLength)}update(e,t,n,s,c,h,f,p){this.bridgeProgramConfigurations.updatePaintArrays(e,t,c,n,s,h,f,p),this.tunnelProgramConfigurations.updatePaintArrays(e,t,c,n,s,h,f,p)}upload(e){this.vertexBuffer||this.vertexPositions.length===0||this.vertexNormals.length===0||this.indexArray.length===0||(this.vertexBuffer=e.createVertexBuffer(this.vertexPositions,yb.members),this.vertexBufferNormal=e.createVertexBuffer(this.vertexNormals,xb.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.bridgeProgramConfigurations.upload(e),this.tunnelProgramConfigurations.upload(e))}destroy(){this.vertexBuffer&&(this.vertexBuffer.destroy(),this.vertexBufferNormal.destroy(),this.indexBuffer.destroy()),this.maskSegments&&(this.maskSegments.destroy(),this.depthSegments.destroy(),this.renderableBridgeSegments.destroy(),this.renderableTunnelSegments.destroy(),this.shadowCasterSegments.destroy()),this.bridgeProgramConfigurations.destroy(),this.tunnelProgramConfigurations.destroy()}populatePaintArrays(e,t,n,s,c){const h=(f,p)=>{for(let g=0;g<p.length-1;g++){const x=p[g].featureIndex,b=p[g+1].vertexStart,w=e.feature(x);f.populatePaintArrays(b,w,x,{},n,t,s,void 0,c)}};h(this.bridgeProgramConfigurations,this.bridgeFeatureSections),h(this.tunnelProgramConfigurations,this.tunnelFeatureSections)}computeVertexConnections(e,t,n,s,c){const h=new Map;for(let f=s;f<c;f++){const p=n[f],g=p.a,x=p.b,b=bn.computePosHash(e[g]),w=bn.computePosHash(e[x]);let S=h.get(b);S||(S={},h.set(b,S));let E=h.get(w);E||(E={},h.set(w,E)),t[g]<=0&&t[x]<=0||(S.to=x,E.from=g)}return h}isTerminalVertex(e,t){const n=bn.computePosHash(this.unevalVertices[e]),s=t.get(n);return!s||!s.from||!s.to}constructBridgeStructures(e,t,n,s,c,h){e.clearVertexLookup();const f=this.computeVertexConnections(t,n,s,c.min,c.max),p=1/h,g=.5*p,x=(Ce,Ee)=>ri(Ce,t[Ee].x,t[Ee].y,n[Ee]*p),b=ei(),w=ei(),S=ei(),E=ei(),A=ei(),P=(Ce,Ee)=>{const Oe=f.get(bn.computePosHash(t[Ee])),ye=Oe.from,Ae=Oe.to;if(!ye||!Ae)return;x(b,ye),x(w,Ee),x(S,Ae),To(E),eo(b,w)||(Xi(A,w,b),xi(E,A)),eo(S,w)||(Xi(A,S,w),er(E,E,xi(A,A)));const Pe=Rr(E);return Pe>0?yi(Ce,E,1/Pe):void 0};let R=Number.POSITIVE_INFINITY;this.sortSubarray(s,c.min,c.max,(Ce,Ee)=>Ce.featureInfo.featureIndex-Ee.featureInfo.featureIndex);const B=ei(),L=ei(),U=ei(),G=ei(),q=ei(),ie=ei(),X=ei(),ee=ei(),Q=ei(),J=[ei(),ei(),ei(),ei()],ve=[ei(),ei(),ei(),ei()],Te=[{coord:new Fe(0,0),height:0},{coord:new Fe(0,0),height:0}],Ie=(Ce,Ee)=>Ce>Ee;for(let Ce=c.min;Ce<c.max;Ce++){const Ee=s[Ce];if(!Ee.featureInfo.guardRailEnabled||!this.prepareEdgePoints(Te,t,n,Ee,Ie))continue;const[Oe,ye]=Te;if(ri(B,Oe.coord.x,Oe.coord.y,p*Oe.height),ri(L,ye.coord.x,ye.coord.y,p*ye.height),eo(B,L))continue;Xi(U,L,B),xi(U,U);const Ae=P(ee,Ee.a)||U,Pe=P(Q,Ee.b)||U;ri(G,Ae[1],-Ae[0],0),xi(G,G),ri(q,Pe[1],-Pe[0],0),xi(q,q),dr(ee,G,Ae),xi(ie,ee),dr(ee,q,Pe),xi(X,ee),er(J[0],B,yi(ee,Xi(ee,G,ie),g)),er(J[1],B,yi(ee,er(ee,G,ie),g)),er(J[2],B,yi(ee,ie,g)),J[3]=B,er(ve[0],L,yi(ee,Xi(ee,q,X),g)),er(ve[1],L,yi(ee,er(ee,q,X),g)),er(ve[2],L,yi(ee,X,g)),ve[3]=L,R=this.addFeatureSection(Ee.featureInfo.featureIndex,R,this.bridgeFeatureSections,e);const Be=e.addVertex(J[0],G,h),Ue=e.addVertex(J[1],G,h),Je=e.addVertex(ve[0],q,h),He=e.addVertex(ve[1],q,h);e.addTriangle(Be,Ue,Je),e.addTriangle(Ue,He,Je);const qe=e.addVertex(J[1],ie,h),je=e.addVertex(J[2],ie,h),Ye=e.addVertex(ve[1],X,h),it=e.addVertex(ve[2],X,h);e.addTriangle(qe,je,Ye),e.addTriangle(je,it,Ye),Uo(G,G),Uo(q,q);const ht=e.addVertex(J[2],G,h),nt=e.addVertex(J[3],G,h),wt=e.addVertex(ve[2],q,h),Ft=e.addVertex(ve[3],q,h);e.addTriangle(ht,nt,wt),e.addTriangle(nt,Ft,wt);const Tt=this.isTerminalVertex(Ee.a,f),Bt=this.isTerminalVertex(Ee.b,f);Oe.height<.01&&Tt&&e.addQuad(J[3],J[2],J[1],J[0],Uo(Ae,Ae),h),ye.height<.01&&Bt&&e.addQuad(ve[0],ve[1],ve[2],ve[3],Pe,h)}this.bridgeFeatureSections.push({featureIndex:Number.POSITIVE_INFINITY,vertexStart:e.getVertexCount()})}constructTunnelStructures(e,t,n,s,c,h){e.clearVertexLookup();let f=Number.POSITIVE_INFINITY;const p=(R,B)=>R.featureInfo.featureIndex-B.featureInfo.featureIndex;this.sortSubarray(s,c.min,c.max,p),this.sortSubarray(s,h.min,h.max,p);const g=R=>xi(R,R),x=[{coord:new Fe(0,0),height:0},{coord:new Fe(0,0),height:0}],b=(R,B)=>R<B,w=ei(),S=ei(),E=ei(),A=ei(),P=ei();for(let R=c.min;R<c.max;R++){if(!this.prepareEdgePoints(x,t,n,s[R],b))continue;const[B,L]=x,U=g(ri(P,-(L.coord.y-B.coord.y),L.coord.x-B.coord.x,0));f=this.addFeatureSection(s[R].featureInfo.featureIndex,f,this.tunnelFeatureSections,e),e.addQuad(ri(w,B.coord.x,B.coord.y,B.height),ri(S,L.coord.x,L.coord.y,L.height),ri(E,L.coord.x,L.coord.y,s[R].isTunnel?-.1:0),ri(A,B.coord.x,B.coord.y,s[R].isTunnel?-.1:0),U)}for(let R=h.min;R<h.max;R++){const B=s[R];B.isTunnel&&([B.a,B.b]=[B.b,B.a]);const L=t[B.a],U=t[B.b],G=g(ri(P,-(U.y-L.y),U.x-L.x,0));f=this.addFeatureSection(B.featureInfo.featureIndex,f,this.tunnelFeatureSections,e),e.addQuad(ri(w,U.x,U.y,0),ri(S,L.x,L.y,0),ri(E,L.x,L.y,n[B.a]+4),ri(A,U.x,U.y,n[B.b]+4),G),e.addQuad(ri(w,L.x,L.y,0),ri(S,U.x,U.y,0),ri(E,U.x,U.y,n[B.b]+4),ri(A,L.x,L.y,n[B.a]+4),G)}this.tunnelFeatureSections.push({featureIndex:Number.POSITIVE_INFINITY,vertexStart:e.getVertexCount()})}setElevatedPoint(e,t,n,s){e.coord.x=t,e.coord.y=n,e.height=s}prepareEdgePoints(e,t,n,s,c){let h=t[s.a].x,f=t[s.a].y,p=t[s.b].x,g=t[s.b].y,x=n[s.a],b=n[s.b];const w=c(x,0),S=c(b,0);if(w&&S)return this.setElevatedPoint(e[0],h,f,x),this.setElevatedPoint(e[1],p,g,b),!0;if(!w&&!S)return!1;if(w){if(!S){const E=b/(b-x);p=dt(p,h,E),g=dt(g,f,E),b=dt(b,x,E)}}else{const E=x/(x-b);h=dt(h,p,E),f=dt(f,g,E),x=dt(x,b,E)}return this.setElevatedPoint(e[0],h,f,x),this.setElevatedPoint(e[1],p,g,b),!0}prepareEdges(e,t){if(t.length===0)return;t.sort((f,p)=>f.hash===p.hash?p.polygonIdx-f.polygonIdx:p.hash>f.hash?1:-1);let n=0,s=0,c=0,h=t[n].polygonIdx;do s++,(s===t.length||t[n].hash!==t[s].hash)&&((s-n===1||t[s-1].polygonIdx!==h)&&(c<n&&(t[c]=t[n],t[n]=null),t[c].type="none",c++),n=s,n!==t.length&&(h=t[n].polygonIdx));while(n!==t.length);if(t.splice(c),t.length!==0&&e.length!==0){t.sort((g,x)=>g.portalHash<x.portalHash?1:-1);let f=0,p=0;for(;f!==t.length&&p!==e.length;){const g=t[f],x=e[p];g.portalHash>x.hash?f++:x.hash>g.portalHash?p++:(g.type=x.type,f++)}}}isOnBorder(e,t){return e<=0&&t<=0||e>=Ze&&t>=Ze}addFeatureSection(e,t,n,s){return e!==t&&(t=e,n.push({featureIndex:e,vertexStart:s.getVertexCount()}),s.clearVertexLookup()),t}sortSubarray(e,t,n,s){const c=e.slice(t,n);c.sort(s),e.splice(t,c.length,...c)}static computeEdgeHash(e,t){return(e.y===t.y&&e.x>t.x||e.y>t.y)&&([e,t]=[t,e]),BigInt(bn.computePosHash(e))<<32n|BigInt(bn.computePosHash(t))}static computePosHash(e){return((65535&e.x)<<16|65535&e.y)>>>0}}function Db(r,e){return r>e?1:r<e?-1:0}class T_{constructor(e=Db,t=!1){this._compare=e,this._root=null,this._size=0,this._noDuplicates=!!t}rotateLeft(e){var t=e.right;t&&(e.right=t.left,t.left&&(t.left.parent=e),t.parent=e.parent),e.parent?e===e.parent.left?e.parent.left=t:e.parent.right=t:this._root=t,t&&(t.left=e),e.parent=t}rotateRight(e){var t=e.left;t&&(e.left=t.right,t.right&&(t.right.parent=e),t.parent=e.parent),e.parent?e===e.parent.left?e.parent.left=t:e.parent.right=t:this._root=t,t&&(t.right=e),e.parent=t}_splay(e){for(;e.parent;){var t=e.parent;t.parent?t.left===e&&t.parent.left===t?(this.rotateRight(t.parent),this.rotateRight(t)):t.right===e&&t.parent.right===t?(this.rotateLeft(t.parent),this.rotateLeft(t)):t.left===e&&t.parent.right===t?(this.rotateRight(t),this.rotateLeft(t)):(this.rotateLeft(t),this.rotateRight(t)):t.left===e?this.rotateRight(t):this.rotateLeft(t)}}splay(e){for(var t,n,s,c,h;e.parent;)(n=(t=e.parent).parent)&&n.parent?((s=n.parent).left===n?s.left=e:s.right=e,e.parent=s):(e.parent=null,this._root=e),c=e.left,h=e.right,e===t.left?(n&&(n.left===t?(t.right?(n.left=t.right,n.left.parent=n):n.left=null,t.right=n,n.parent=t):(c?(n.right=c,c.parent=n):n.right=null,e.left=n,n.parent=e)),h?(t.left=h,h.parent=t):t.left=null,e.right=t,t.parent=e):(n&&(n.right===t?(t.left?(n.right=t.left,n.right.parent=n):n.right=null,t.left=n,n.parent=t):(h?(n.left=h,h.parent=n):n.left=null,e.right=n,n.parent=e)),c?(t.right=c,c.parent=t):t.right=null,e.left=t,t.parent=e)}replace(e,t){e.parent?e===e.parent.left?e.parent.left=t:e.parent.right=t:this._root=t,t&&(t.parent=e.parent)}minNode(e=this._root){if(e)for(;e.left;)e=e.left;return e}maxNode(e=this._root){if(e)for(;e.right;)e=e.right;return e}insert(e,t){var n=this._root,s=null,c=this._compare;if(this._noDuplicates)for(;n;){if(s=n,c(n.key,e)===0)return;n=c(n.key,e)<0?n.right:n.left}else for(;n;)s=n,n=c(n.key,e)<0?n.right:n.left;return n={key:e,data:t,left:null,right:null,parent:s},s?c(s.key,n.key)<0?s.right=n:s.left=n:this._root=n,this.splay(n),this._size++,n}find(e){for(var t=this._root,n=this._compare;t;){var s=n(t.key,e);if(s<0)t=t.right;else{if(!(s>0))return t;t=t.left}}return null}contains(e){for(var t=this._root,n=this._compare;t;){var s=n(e,t.key);if(s===0)return!0;t=s<0?t.left:t.right}return!1}remove(e){var t=this.find(e);if(!t)return!1;if(this.splay(t),t.left)if(t.right){var n=this.minNode(t.right);n.parent!==t&&(this.replace(n,n.right),n.right=t.right,n.right.parent=n),this.replace(t,n),n.left=t.left,n.left.parent=n}else this.replace(t,t.left);else this.replace(t,t.right);return this._size--,!0}removeNode(e){if(!e)return!1;if(this.splay(e),e.left)if(e.right){var t=this.minNode(e.right);t.parent!==e&&(this.replace(t,t.right),t.right=e.right,t.right.parent=t),this.replace(e,t),t.left=e.left,t.left.parent=t}else this.replace(e,e.left);else this.replace(e,e.right);return this._size--,!0}erase(e){var t=this.find(e);if(t){this.splay(t);var n=t.left,s=t.right,c=null;n&&(n.parent=null,c=this.maxNode(n),this.splay(c),this._root=c),s&&(n?c.right=s:this._root=s,s.parent=c),this._size--}}pop(){var e=this._root,t=null;if(e){for(;e.left;)e=e.left;t={key:e.key,data:e.data},this.remove(e.key)}return t}next(e){var t=e;if(t)if(t.right)for(t=t.right;t&&t.left;)t=t.left;else for(t=e.parent;t&&t.right===e;)e=t,t=t.parent;return t}prev(e){var t=e;if(t)if(t.left)for(t=t.left;t&&t.right;)t=t.right;else for(t=e.parent;t&&t.left===e;)e=t,t=t.parent;return t}forEach(e){for(var t=this._root,n=[],s=!1,c=0;!s;)t?(n.push(t),t=t.left):n.length>0?(e(t=n.pop(),c++),t=t.right):s=!0;return this}range(e,t,n,s){const c=[],h=this._compare;let f,p=this._root;for(;c.length!==0||p;)if(p)c.push(p),p=p.left;else{if(p=c.pop(),f=h(p.key,t),f>0)break;if(h(p.key,e)>=0&&n.call(s,p))return this;p=p.right}return this}keys(){for(var e=this._root,t=[],n=[],s=!1;!s;)e?(t.push(e),e=e.left):t.length>0?(e=t.pop(),n.push(e.key),e=e.right):s=!0;return n}values(){for(var e=this._root,t=[],n=[],s=!1;!s;)e?(t.push(e),e=e.left):t.length>0?(e=t.pop(),n.push(e.data),e=e.right):s=!0;return n}at(e){for(var t=this._root,n=[],s=!1,c=0;!s;)if(t)n.push(t),t=t.left;else if(n.length>0){if(t=n.pop(),c===e)return t;c++,t=t.right}else s=!0;return null}load(e=[],t=[],n=!1){if(this._size!==0)throw new Error("bulk-load: tree is not empty");const s=e.length;return n&&I_(e,t,0,s-1,this._compare),this._root=S_(null,e,t,0,s),this._size=s,this}min(){var e=this.minNode(this._root);return e?e.key:null}max(){var e=this.maxNode(this._root);return e?e.key:null}isEmpty(){return this._root===null}get size(){return this._size}static createTree(e,t,n,s,c){return new T_(n,c).load(e,t,s)}}function S_(r,e,t,n,s){const c=s-n;if(c>0){const h=n+Math.floor(c/2),f={key:e[h],data:t[h],parent:r};return f.left=S_(f,e,t,n,h),f.right=S_(f,e,t,h+1,s),f}return null}function I_(r,e,t,n,s){if(t>=n)return;const c=r[t+n>>1];let h=t-1,f=n+1;for(;;){do h++;while(s(r[h],c)<0);do f--;while(s(r[f],c)>0);if(h>=f)break;let p=r[h];r[h]=r[f],r[f]=p,p=e[h],e[h]=e[f],e[f]=p}I_(r,e,t,f,s),I_(r,e,f+1,n,s)}const Ty=11102230246251565e-32,cn=134217729,Rb=(3+8*Ty)*Ty;function E_(r,e,t,n,s){let c,h,f,p,g=e[0],x=n[0],b=0,w=0;x>g==x>-g?(c=g,g=e[++b]):(c=x,x=n[++w]);let S=0;if(b<r&&w<t)for(x>g==x>-g?(h=g+c,f=c-(h-g),g=e[++b]):(h=x+c,f=c-(h-x),x=n[++w]),c=h,f!==0&&(s[S++]=f);b<r&&w<t;)x>g==x>-g?(h=c+g,p=h-c,f=c-(h-p)+(g-p),g=e[++b]):(h=c+x,p=h-c,f=c-(h-p)+(x-p),x=n[++w]),c=h,f!==0&&(s[S++]=f);for(;b<r;)h=c+g,p=h-c,f=c-(h-p)+(g-p),g=e[++b],c=h,f!==0&&(s[S++]=f);for(;w<t;)h=c+x,p=h-c,f=c-(h-p)+(x-p),x=n[++w],c=h,f!==0&&(s[S++]=f);return c===0&&S!==0||(s[S++]=c),S}function Dd(r){return new Float64Array(r)}const Mu=Dd(4),Sy=Dd(8),Iy=Dd(12),Ey=Dd(16),wn=Dd(4);function Rd(r,e,t){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=!Ay(e,t)||e.isVertical()?e.prevInResult:e)),r.resultTransition=Ay(r,t)?function(n,s){let c,h=!n.inOut,f=!n.otherInOut;switch(s){case 0:c=h&&f;break;case 1:c=h||f;break;case 3:c=h!==f;break;case 2:c=n.isSubject?h&&!f:f&&!h}return c?1:-1}(r,t):0}function Ay(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 Pu{constructor(e,t,n,s,c){this.left=t,this.point=e,this.otherEvent=n,this.isSubject=s??!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 t=this.point,n=this.otherEvent.point;return this.left?(t[0]-e[0])*(n[1]-e[1])-(n[0]-e[0])*(t[1]-e[1])>0:(n[0]-e[0])*(t[1]-e[1])-(t[0]-e[0])*(n[1]-e[1])>0}isAbove(e){return!this.isBelow(e)}isVertical(){return this.point[0]===this.otherEvent.point[0]}get inResult(){return this.resultTransition!==0}clone(){const e=new Pu(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 cs(r,e){return r[0]===e[0]&&r[1]===e[1]}function A_(r,e,t){const n=function(s,c,h,f,p,g){const x=(c-g)*(h-p),b=(s-p)*(f-g),w=x-b;if(x===0||b===0||x>0!=b>0)return w;const S=Math.abs(x+b);return Math.abs(w)>=33306690738754716e-32*S?w:-function(E,A,P,R,B,L,U){let G,q,ie,X,ee,Q,J,ve,Te,Ie,Ce,Ee,Oe,ye,Ae,Pe,Be,Ue;const Je=E-B,He=P-B,qe=A-L,je=R-L;ye=Je*je,Q=cn*Je,J=Q-(Q-Je),ve=Je-J,Q=cn*je,Te=Q-(Q-je),Ie=je-Te,Ae=ve*Ie-(ye-J*Te-ve*Te-J*Ie),Pe=qe*He,Q=cn*qe,J=Q-(Q-qe),ve=qe-J,Q=cn*He,Te=Q-(Q-He),Ie=He-Te,Be=ve*Ie-(Pe-J*Te-ve*Te-J*Ie),Ce=Ae-Be,ee=Ae-Ce,Mu[0]=Ae-(Ce+ee)+(ee-Be),Ee=ye+Ce,ee=Ee-ye,Oe=ye-(Ee-ee)+(Ce-ee),Ce=Oe-Pe,ee=Oe-Ce,Mu[1]=Oe-(Ce+ee)+(ee-Pe),Ue=Ee+Ce,ee=Ue-Ee,Mu[2]=Ee-(Ue-ee)+(Ce-ee),Mu[3]=Ue;let Ye=function(Ft,Tt){let Bt=Tt[0];for(let Mt=1;Mt<4;Mt++)Bt+=Tt[Mt];return Bt}(0,Mu),it=22204460492503146e-32*U;if(Ye>=it||-Ye>=it||(ee=E-Je,G=E-(Je+ee)+(ee-B),ee=P-He,ie=P-(He+ee)+(ee-B),ee=A-qe,q=A-(qe+ee)+(ee-L),ee=R-je,X=R-(je+ee)+(ee-L),G===0&&q===0&&ie===0&&X===0)||(it=11093356479670487e-47*U+Rb*Math.abs(Ye),Ye+=Je*X+je*G-(qe*ie+He*q),Ye>=it||-Ye>=it))return Ye;ye=G*je,Q=cn*G,J=Q-(Q-G),ve=G-J,Q=cn*je,Te=Q-(Q-je),Ie=je-Te,Ae=ve*Ie-(ye-J*Te-ve*Te-J*Ie),Pe=q*He,Q=cn*q,J=Q-(Q-q),ve=q-J,Q=cn*He,Te=Q-(Q-He),Ie=He-Te,Be=ve*Ie-(Pe-J*Te-ve*Te-J*Ie),Ce=Ae-Be,ee=Ae-Ce,wn[0]=Ae-(Ce+ee)+(ee-Be),Ee=ye+Ce,ee=Ee-ye,Oe=ye-(Ee-ee)+(Ce-ee),Ce=Oe-Pe,ee=Oe-Ce,wn[1]=Oe-(Ce+ee)+(ee-Pe),Ue=Ee+Ce,ee=Ue-Ee,wn[2]=Ee-(Ue-ee)+(Ce-ee),wn[3]=Ue;const ht=E_(4,Mu,4,wn,Sy);ye=Je*X,Q=cn*Je,J=Q-(Q-Je),ve=Je-J,Q=cn*X,Te=Q-(Q-X),Ie=X-Te,Ae=ve*Ie-(ye-J*Te-ve*Te-J*Ie),Pe=qe*ie,Q=cn*qe,J=Q-(Q-qe),ve=qe-J,Q=cn*ie,Te=Q-(Q-ie),Ie=ie-Te,Be=ve*Ie-(Pe-J*Te-ve*Te-J*Ie),Ce=Ae-Be,ee=Ae-Ce,wn[0]=Ae-(Ce+ee)+(ee-Be),Ee=ye+Ce,ee=Ee-ye,Oe=ye-(Ee-ee)+(Ce-ee),Ce=Oe-Pe,ee=Oe-Ce,wn[1]=Oe-(Ce+ee)+(ee-Pe),Ue=Ee+Ce,ee=Ue-Ee,wn[2]=Ee-(Ue-ee)+(Ce-ee),wn[3]=Ue;const nt=E_(ht,Sy,4,wn,Iy);ye=G*X,Q=cn*G,J=Q-(Q-G),ve=G-J,Q=cn*X,Te=Q-(Q-X),Ie=X-Te,Ae=ve*Ie-(ye-J*Te-ve*Te-J*Ie),Pe=q*ie,Q=cn*q,J=Q-(Q-q),ve=q-J,Q=cn*ie,Te=Q-(Q-ie),Ie=ie-Te,Be=ve*Ie-(Pe-J*Te-ve*Te-J*Ie),Ce=Ae-Be,ee=Ae-Ce,wn[0]=Ae-(Ce+ee)+(ee-Be),Ee=ye+Ce,ee=Ee-ye,Oe=ye-(Ee-ee)+(Ce-ee),Ce=Oe-Pe,ee=Oe-Ce,wn[1]=Oe-(Ce+ee)+(ee-Pe),Ue=Ee+Ce,ee=Ue-Ee,wn[2]=Ee-(Ue-ee)+(Ce-ee),wn[3]=Ue;const wt=E_(nt,Iy,4,wn,Ey);return Ey[wt-1]}(s,c,h,f,p,g,S)}(r[0],r[1],e[0],e[1],t[0],t[1]);return n>0?-1:n<0?1:0}function ka(r,e){const t=r.point,n=e.point;return t[0]>n[0]?1:t[0]<n[0]?-1:t[1]!==n[1]?t[1]>n[1]?1:-1:function(s,c,h){return s.left!==c.left?s.left?1:-1:A_(h,s.otherEvent.point,c.otherEvent.point)!==0?s.isBelow(c.otherEvent.point)?-1:1:!s.isSubject&&c.isSubject?1:-1}(r,e,t)}function Va(r,e,t){const n=new Pu(e,!1,r,r.isSubject),s=new Pu(e,!0,r.otherEvent,r.isSubject);return cs(r.point,r.otherEvent.point)&&console.warn("what is that, a collapsed segment?",r),n.contourId=s.contourId=r.contourId,ka(s,r.otherEvent)>0&&(r.otherEvent.left=!0,s.left=!1),r.otherEvent.otherEvent=s,r.otherEvent=n,t.push(s),t.push(n),t}function Tp(r,e){return r[0]*e[1]-r[1]*e[0]}function C_(r,e){return r[0]*e[0]+r[1]*e[1]}function M_(r,e,t){const n=function(p,g,x,b){const w=[g[0]-p[0],g[1]-p[1]],S=[b[0]-x[0],b[1]-x[1]];function E(ie,X,ee){return[ie[0]+X*ee[0],ie[1]+X*ee[1]]}const A=[x[0]-p[0],x[1]-p[1]];let P=Tp(w,S),R=P*P;const B=C_(w,w);if(R>0){const ie=Tp(A,S)/P;if(ie<0||ie>1)return null;const X=Tp(A,w)/P;return X<0||X>1?null:ie===0||ie===1?[E(p,ie,w)]:X===0||X===1?[E(x,X,S)]:[E(p,ie,w)]}if(P=Tp(A,w),R=P*P,R>0)return null;const L=C_(w,A)/B,U=L+C_(w,S)/B,G=Math.min(L,U),q=Math.max(L,U);return G<=1&&q>=0?G===1?[E(p,G>0?G:0,w)]:q===0?[E(p,q<1?q:1,w)]:[E(p,G>0?G:0,w),E(p,q<1?q:1,w)]:null}(r.point,r.otherEvent.point,e.point,e.otherEvent.point),s=n?n.length:0;if(s===0||s===1&&(cs(r.point,e.point)||cs(r.otherEvent.point,e.otherEvent.point))||s===2&&r.isSubject===e.isSubject)return 0;if(s===1)return!cs(r.point,n[0])&&!cs(r.otherEvent.point,n[0])&&Va(r,n[0],t),!cs(e.point,n[0])&&!cs(e.otherEvent.point,n[0])&&Va(e,n[0],t),1;const c=[];let h=!1,f=!1;return cs(r.point,e.point)?h=!0:ka(r,e)===1?c.push(e,r):c.push(r,e),cs(r.otherEvent.point,e.otherEvent.point)?f=!0:ka(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&&Va(c[1].otherEvent,c[0].point,t),2):f?(Va(c[0],c[1].point,t),3):c[0]!==c[3].otherEvent?(Va(c[0],c[1].point,t),Va(c[1],c[2].point,t),3):(Va(c[0],c[1].point,t),Va(c[3].otherEvent,c[2].point,t),3)}function zb(r,e){if(r===e)return 0;if(A_(r.point,r.otherEvent.point,e.point)!==0||A_(r.point,r.otherEvent.point,e.otherEvent.point)!==0)return cs(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:ka(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 t=r.point,n=e.point;if(t[0]===n[0]&&t[1]===n[1])return t=r.otherEvent.point,n=e.otherEvent.point,t[0]===n[0]&&t[1]===n[1]?0:(r.contourId??0)>(e.contourId??0)?1:-1}return ka(r,e)===1?1:-1}class Lb{constructor(){this.points=[],this.holeIds=[],this.holeOf=null,this.depth=null}isExterior(){return this.holeOf==null}}function Fb(r,e,t,n){let s,c=r+1,h=e[r].point;const f=e.length;for(c<f&&(s=e[c].point);c<f&&s[0]===h[0]&&s[1]===h[1];){if(!t[c])return c;c++,c<f&&(s=e[c].point)}for(c=r-1;t[c]&&c>n;)c--;return c}function Ob(r,e,t){const n=new Lb;if(r.prevInResult!=null){const s=r.prevInResult,c=s.outputContourId;if(s.resultTransition>0){const h=e[c];if(h.holeOf!=null){const f=h.holeOf;e[f].holeIds.push(t),n.holeOf=f,n.depth=e[c].depth}else e[c].holeIds.push(t),n.holeOf=c,n.depth=e[c].depth+1}else n.holeOf=null,n.depth=e[c].depth}else n.holeOf=null,n.depth=0;return n}const Cy=Math.max,My=Math.min;let Sp=0;function Py(r,e,t,n,s,c){let h,f,p,g,x,b;for(h=0,f=r.length-1;h<f;h++){if(p=r[h],g=r[h+1],x=new Pu(p,!1,void 0,e),b=new Pu(g,!1,x,e),x.otherEvent=b,p[0]===g[0]&&p[1]===g[1])continue;x.contourId=b.contourId=t,c||(x.isExteriorRing=!1,b.isExteriorRing=!1),ka(x,b)>0?b.left=!0:x.left=!0;const w=p[0],S=p[1];s[0]=My(s[0],w),s[1]=My(s[1],S),s[2]=Cy(s[2],w),s[3]=Cy(s[3],S),n.push(x),n.push(b)}}const Ip=[];function Dy(r,e,t){let n=r,s=e;typeof r[0][0][0]=="number"&&(n=[r]),typeof e[0][0][0]=="number"&&(s=[e]);let c=function(w,S,E){let A=null;return w.length*S.length===0&&(E===0?A=Ip:E===2?A=w:(E===1||E===3)&&(A=w.length===0?S:w)),A}(n,s,t);
7if(c)return c===Ip?null:c;const h=[1/0,1/0,-1/0,-1/0],f=[1/0,1/0,-1/0,-1/0],p=function(w,S,E,A,P){const R=new gl(void 0,ka);let B,L,U,G,q,ie;for(U=0,G=w.length;U<G;U++)for(B=w[U],q=0,ie=B.length;q<ie;q++)L=q===0,L&&Sp++,Py(B[q],!0,Sp,R,E,L);for(U=0,G=S.length;U<G;U++)for(B=S[U],q=0,ie=B.length;q<ie;q++)L=q===0,P===2&&(L=!1),L&&Sp++,Py(B[q],!1,Sp,R,A,L);return R}(n,s,h,f,t);if(c=function(w,S,E,A,P){let R=null;return(E[0]>A[2]||A[0]>E[2]||E[1]>A[3]||A[1]>E[3])&&(P===0?R=Ip:P===2?R=w:(P===1||P===3)&&(R=w.concat(S))),R}(n,s,h,f,t),c)return c===Ip?null:c;const g=function(w,S,E,A,P,R){const B=new T_(zb),L=[],U=Math.min(A[2],P[2]);let G,q,ie;for(;w.length!==0;){let X=w.pop();if(L.push(X),R===0&&X.point[0]>U||R===2&&X.point[0]>A[2])break;if(X.left){q=G=B.insert(X),ie=B.minNode(),G=G!==ie?B.prev(G):null,q=B.next(q);const ee=G?G.key:null;let Q;if(Rd(X,ee,R),q&&M_(X,q.key,w)===2&&(Rd(X,ee,R),Rd(q.key,X,R)),G&&M_(G.key,X,w)===2){let J=G;J=J!==ie?B.prev(J):null,Q=J?J.key:null,Rd(ee,Q,R),Rd(X,ee,R)}}else X=X.otherEvent,q=G=B.find(X),G&&q&&(G=G!==ie?B.prev(G):null,q=B.next(q),B.remove(X),q&&G&&M_(G.key,q.key,w))}return L}(p,0,0,h,f,t),x=function(w){let S,E;const A=function(B){let L,U,G,q,ie;const X=[];for(U=0,G=B.length;U<G;U++)L=B[U],(L.left&&L.inResult||!L.left&&L.otherEvent.inResult)&&X.push(L);let ee=!1;for(;!ee;)for(ee=!0,U=0,G=X.length;U<G;U++)U+1<G&&ka(X[U],X[U+1])===1&&(q=X[U],X[U]=X[U+1],X[U+1]=q,ee=!1);for(U=0,G=X.length;U<G;U++)L=X[U],L.otherPos=U;for(U=0,G=X.length;U<G;U++)L=X[U],L.left||(ie=L.otherPos,L.otherPos=L.otherEvent.otherPos,L.otherEvent.otherPos=ie);return X}(w),P={},R=[];for(S=0,E=A.length;S<E;S++){if(P[S])continue;const B=R.length,L=Ob(A[S],R,B),U=ie=>{P[ie]=!0,ie<A.length&&A[ie]&&(A[ie].outputContourId=B)};let G=S,q=S;for(L.points.push(A[S].point);U(G),G=A[G].otherPos,U(G),L.points.push(A[G].point),G=Fb(G,A,P,q),!(G==q||G>=A.length)&&A[G];);R.push(L)}return R}(g),b=[];for(let w=0;w<x.length;w++){let S=x[w];if(S.isExterior()){let E=[S.points];for(let A=0;A<S.holeIds.length;A++)E.push(x[S.holeIds[A]].points);b.push(E)}}return b}function Ep(r,e,t,n){const s=[],c=n===0?(h,f,p,g,x,b)=>{h.push(new Fe(b,p+(b-f)/(g-f)*(x-p)))}:(h,f,p,g,x,b)=>{h.push(new Fe(f+(b-p)/(x-p)*(g-f),b))};for(const h of r){const f=[];for(const p of h){if(p.length<=2)continue;const g=[];for(let w=0;w<p.length-1;w++){const S=p[w].x,E=p[w].y,A=p[w+1].x,P=p[w+1].y,R=n===0?S:E,B=n===0?A:P;R<e?B>e&&c(g,S,E,A,P,e):R>t?B<t&&c(g,S,E,A,P,t):g.push(p[w]),B<e&&R>=e&&c(g,S,E,A,P,e),B>t&&R<=t&&c(g,S,E,A,P,t)}let x=p[p.length-1];const b=n===0?x.x:x.y;b>=e&&b<=t&&g.push(x),g.length&&(x=g[g.length-1],g[0].x===x.x&&g[0].y===x.y||g.push(g[0]),f.push(g))}f.length&&s.push(f)}return s}
7function Bb(r,e){const t=Dy(P_(r),P_([e]),0);return t==null?[]:Ry(t)}function kb(r,e,t=0){let s=P_(r,65536);const c=[];for(;e.valid();e.next()){const[h,f]=e.get();let p=h.x*65536,g=h.y*65536,x=f.x*65536,b=f.y*65536;const w=x-p,S=b-g,E=Math.hypot(w,S);if(E===0)continue;p-=w*t,g-=S*t,x+=w*t,b+=S*t;const A=Math.trunc(S/E*3),P=-Math.trunc(w/E*3);c.push([[[p,g],[x,b],[x+A,b+P],[p+A,g+P],[p,g]]])}return c.length>0&&(s=Dy(s,c,2)),Ry(s,1/65536,128)}function P_(r,e=1){return[r.map(t=>t.map(n=>[n.x*e,n.y*e]))]}function Ry(r,e=1,t){return r.map(n=>n.map((s,c)=>{const h=s.map(f=>{let p=f[0],g=f[1];return t&&(p=Math.round(p/t)*t,g=Math.round(g/t)*t),new Fe(p*e,g*e)._round()});return c>0&&h.reverse(),h}))}class D_{constructor(e,t){this.layoutVertexArray=new sn,this.indexArray=new Ni,this.lineIndexArray=new On,this.triangleSegments=new oi,this.lineSegments=new oi,this.programConfigurations=new D(e.layers,{zoom:e.zoom,lut:e.lut}),this.uploaded=!1,t&&(this.elevatedLayoutVertexArray=new gn)}update(e,t,n,s,c,h,f,p){this.programConfigurations.updatePaintArrays(e,t,c,n,s,h,f,p)}isEmpty(){return this.layoutVertexArray.length===0}needsUpload(){return this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,_b.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.lineIndexBuffer=e.createIndexBuffer(this.lineIndexArray),this.elevatedLayoutVertexArray&&this.elevatedLayoutVertexArray.length>0&&(this.elevatedLayoutVertexBuffer=e.createVertexBuffer(this.elevatedLayoutVertexArray,gb.members))),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.elevatedLayoutVertexBuffer&&this.elevatedLayoutVertexBuffer.destroy(),this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.lineIndexBuffer.destroy(),this.programConfigurations.destroy(),this.triangleSegments.destroy(),this.lineSegments.destroy())}populatePaintArrays(e,t,n,s,c,h,f){this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,t,n,s,c,h,void 0,f)}}class Ap{constructor(e){this.zoom=e.zoom,this.pixelRatio=e.pixelRatio,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(t=>t.fqid),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.lut=e.lut,this.bufferData=new D_(e,!1),this.elevationBufferData=new D_(e,!0),this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id),this.projection=e.projection,this.elevationMode=this.layers[0].layout.get("fill-elevation-reference"),this.sourceLayerIndex=e.sourceLayerIndex,this.worldview=e.worldview,this.hasAppearances=null}updateFootprints(e,t){}updateAppearances(e,t,n,s){return{hasLayoutChanges:!1,hasUboChanges:!1}}populate(e,t,n,s){this.hasPattern=b_("fill",this.layers,this.pixelRatio,t);const c=this.layers[0].layout.get("fill-sort-key"),h=[];for(const{feature:f,id:p,index:g,sourceLayerIndex:x}of e){const b=this.layers[0]._featureFilter.needGeometry,w=Ct(f,b);if(!this.layers[0]._featureFilter.filter(new Zt(this.zoom,{worldview:this.worldview,activeFloors:t.activeFloors}),w,n))continue;const S=c?c.evaluate(w,{},n,t.availableImages):void 0,E={id:p,properties:f.properties,type:f.type,sourceLayerIndex:x,index:g,geometry:b?w.geometry:ft(f,n,s),patterns:{},sortKey:S};h.push(E)}c&&h.sort((f,p)=>f.sortKey-p.sortKey);for(const f of h){const{geometry:p,index:g,sourceLayerIndex:x}=f;if(this.hasPattern){const b=w_("fill",this.layers,f,this.zoom,this.pixelRatio,t);this.patternFeatures.push(b)}else this.addFeature(f,p,g,n,{},t.availableImages,t.brightness,t.elevationFeatures);t.featureIndex.insert(e[g].feature,p,g,x,this.index)}}update(e,t,n,s,c,h,f){this.bufferData.update(e,t,n,s,c,h,f,this.worldview),this.elevationBufferData.update(e,t,n,s,c,h,f,this.worldview),this.elevatedStructures&&this.elevatedStructures.update(e,t,n,s,c,h,f,this.worldview)}addFeatures(e,t,n,s,c,h){for(const f of this.patternFeatures)this.addFeature(f,f.geometry,f.index,t,n,s,h,e.elevationFeatures)}isEmpty(){return this.bufferData.isEmpty()&&this.elevationBufferData.isEmpty()}uploadPending(){return!this.uploaded||this.bufferData.needsUpload()||this.elevationBufferData.needsUpload()}upload(e){this.bufferData.upload(e),this.elevationBufferData.upload(e),this.elevatedStructures&&this.elevatedStructures.upload(e)}destroy(){this.bufferData.destroy(),this.elevationBufferData.destroy(),this.elevatedStructures&&this.elevatedStructures.destroy()}
vendor: 54,223 bytes, line 7
7addFeature(e,t,n,s,c,h=[],f,p){const g=Pd(t,500);this.elevationMode!=="none"?this.addElevatedRoadFeature(e,g,s,n,p):this.addGeometry(g,this.bufferData),this.bufferData.populatePaintArrays(e,n,c,h,s,f,this.worldview),this.elevationBufferData.populatePaintArrays(e,n,c,h,s,f,this.worldview)}getUnevaluatedPortalGraph(){return this.elevatedStructures?this.elevatedStructures.unevaluatedPortals:void 0}setEvaluatedPortalGraph(e,t,n,s,c){this.elevatedStructures&&(this.elevatedStructures.construct(e),this.elevatedStructures.populatePaintArrays(t,n,s,c,this.worldview))}addElevatedRoadFeature(e,t,n,s,c){const h=new Array,f=ci.getElevationFeature(e,c);if(!f)return void this.addGeometry(t,this.bufferData);{const g=this.clipPolygonsToTile(t,1);g.length>0&&h.push({polygons:g,elevationFeature:f,elevationTileID:n})}const p={guardRailEnabled:this.layers[0].layout.get("fill-construct-bridge-guard-rail").evaluate(e,{},n),featureIndex:s};for(const g of h)if(g.elevationFeature){if(this.elevationMode==="hd-road-base"){this.elevatedStructures||(this.elevatedStructures=new bn(g.elevationTileID,this.layers,this.zoom,this.lut));const b=g.elevationFeature.isTunnel();let w=0;e.properties.hasOwnProperty(ai)&&(w=+e.properties[ai]),this.elevatedStructures.addPortalCandidates(g.elevationFeature.id,g.polygons,b,g.elevationFeature,w)}g.elevationFeature.constantHeight==null&&(g.polygons=this.prepareElevatedPolygons(g.polygons,g.elevationFeature,g.elevationTileID));const x=new ui(n,g.elevationTileID);this.addElevatedGeometry(g.polygons,x,g.elevationFeature,this.elevationMode==="hd-road-base"?0:.05,s,p)}}addElevatedGeometry(e,t,n,s,c,h){const f={elevation:n,elevationSampler:t,bias:s,index:c,featureInfo:h},[p,g]=this.addGeometry(e,this.elevationBufferData,f);this.elevationBufferData.heightRange==null?this.elevationBufferData.heightRange={min:p,max:g}:(this.elevationBufferData.heightRange.min=Math.min(this.elevationBufferData.heightRange.min,p),this.elevationBufferData.heightRange.max=Math.max(this.elevationBufferData.heightRange.max,g))}addGeometry(e,t,n){let s=Number.POSITIVE_INFINITY,c=Number.NEGATIVE_INFINITY,h=null;n&&(h=n.elevationSampler.constantElevation(n.elevation,n.bias),h!=null&&(s=h,c=h));const f=(p,g,x)=>{if(n!=null)if(g.push(p),h!=null)t.elevatedLayoutVertexArray.emplaceBack(h),x.push(h);else{const b=n.elevationSampler.pointElevation(p,n.elevation,n.bias);t.elevatedLayoutVertexArray.emplaceBack(b),x.push(b),s=Math.min(s,b),c=Math.max(c,b)}};for(const p of e){let g=0;for(const L of p)g+=L.length;const x=t.triangleSegments.prepareSegment(g,t.layoutVertexArray,t.indexArray),b=x.vertexLength,w=[],S=[],E=[],A=[],P=[],R=t.layoutVertexArray.length;for(const L of p){if(L.length===0)continue;L!==p[0]&&S.push(w.length/2);const U=t.lineSegments.prepareSegment(L.length,t.layoutVertexArray,t.lineIndexArray),G=U.vertexLength;n&&P.push(t.layoutVertexArray.length-R),f(L[0],E,A),t.layoutVertexArray.emplaceBack(L[0].x,L[0].y),t.lineIndexArray.emplaceBack(G+L.length-1,G),w.push(L[0].x),w.push(L[0].y);for(let q=1;q<L.length;q++)f(L[q],E,A),t.layoutVertexArray.emplaceBack(L[q].x,L[q].y),t.lineIndexArray.emplaceBack(G+q-1,G+q),w.push(L[q].x),w.push(L[q].y);U.vertexLength+=L.length,U.primitiveLength+=L.length}const B=Au(w,S);for(let L=0;L<B.length;L+=3)t.indexArray.emplaceBack(b+B[L],b+B[L+1],b+B[L+2]);if(B.length>0&&n&&this.elevationMode==="hd-road-base"){const L=n.elevation.isTunnel(),U=n.elevation.safeArea,G=this.elevatedStructures.addVertices(E,A);this.elevatedStructures.addTriangles(B,G,L);const q=P.length;if(q>0){for(let ie=0;ie<q-1;ie++)this.elevatedStructures.addRenderableRing(n.index,P[ie]+G,P[ie+1]-P[ie],L,U,n.featureInfo);this.elevatedStructures.addRenderableRing(n.index,P[q-1]+G,E.length-P[q-1],L,U,n.featureInfo)}}x.vertexLength+=g,x.primitiveLength+=B.length/3}return[s,c]}prepareElevatedPolygons(e,t,n){const s=1/De(n),c=[];for(const h of e){const f=kb(h,new xn(t,s),.1);c.push(...f)}return c}clipPolygonsToTile(e,t){const n=-t,s=-t,c=Ze+t,h=Ze+t;let f=0;const p=[],g=[];for(;f<e.length;f++){const w=e[f],S=hh(w);(S.min.x>=n&&S.max.x<=c&&S.min.y>=s&&S.max.y<=h?p:g).push(w)}if(p.length===e.length)return e;const x=[new Fe(n,s),new Fe(c,s),new Fe(c,h),new Fe(n,h),new Fe(n,s)],b=p;for(const w of g)b.push(...Bb(w,x));return b}}let zy,Ly,Fy,Oy;Qe(Ap,"FillBucket",{omit:["layers","patternFeatures"]}),Qe(D_,"FillBufferData"),Qe(bn,"ElevatedStructures");class Cp{constructor(e,t,n,s){if(this.triangleCount=t.length/3,this.min=new Fe(0,0),this.max=new Fe(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 w=e[b];c.x=Math.min(c.x,w.x),c.y=Math.min(c.y,w.y),h.x=Math.max(h.x,w.x),h.y=Math.max(h.y,w.y)}if(s){const b=Math.ceil(Math.max(h.x-c.x,h.y-c.y)/s);n=Math.max(n,b)}if(n===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 p=Math.max(f.x,f.y)/n;this.cellsX=Math.max(1,Math.ceil(f.x/p)),this.cellsY=Math.max(1,Math.ceil(f.y/p)),this.xScale=1/p,this.yScale=1/p;const g=[];for(let b=0;b<this.triangleCount;b++){const w=e[t[3*b+0]].sub(this.min),S=e[t[3*b+1]].sub(this.min),E=e[t[3*b+2]].sub(this.min),A=us(Math.floor(Math.min(w.x,S.x,E.x)),this.xScale,this.cellsX),P=us(Math.floor(Math.max(w.x,S.x,E.x)),this.xScale,this.cellsX),R=us(Math.floor(Math.min(w.y,S.y,E.y)),this.yScale,this.cellsY),B=us(Math.floor(Math.max(w.y,S.y,E.y)),this.yScale,this.cellsY),L=new Fe(0,0),U=new Fe(0,0),G=new Fe(0,0),q=new Fe(0,0);for(let ie=R;ie<=B;++ie){L.y=U.y=ie*p,G.y=q.y=(ie+1)*p;for(let X=A;X<=P;++X)L.x=G.x=X*p,U.x=q.x=(X+1)*p,(Iu(w,S,E,L,U,q)||Iu(w,S,E,L,q,G))&&g.push({cellIdx:ie*this.cellsX+X,triIdx:b})}}if(g.length===0)return;g.sort((b,w)=>b.cellIdx-w.cellIdx||b.triIdx-w.triIdx);let x=0;for(;x<g.length;){const b=g[x].cellIdx,w={start:this.payload.length,len:0};for(;x<g.length&&g[x].cellIdx===b;)++w.len,this.payload.push(g[x++].triIdx);this.cells[b]=w}}_lazyInitLookup(){this.lookup||(this.lookup=new Uint8Array(Math.ceil(this.triangleCount/8))),this.lookup.fill(0)}queryPoint(e,t){if(this.triangleCount===0||this.cells.length===0||e.x>this.max.x||this.min.x>e.x||e.y>this.max.y||this.min.y>e.y)return;const n=us(e.x-this.min.x,this.xScale,this.cellsX),s=us(e.y-this.min.y,this.yScale,this.cellsY),c=this.cells[s*this.cellsX+n];if(c){this._lazyInitLookup();for(let h=0;h<c.len;h++){const f=this.payload[c.start+h],p=Math.floor(f/8),g=1<<f%8;if(!(this.lookup[p]&g)&&(this.lookup[p]|=g,t.push(f),t.length===this.triangleCount))return}}}query(e,t,n){if(this.triangleCount===0||this.cells.length===0||e.x>this.max.x||this.min.x>t.x||e.y>this.max.y||this.min.y>t.y)return;this._lazyInitLookup();const s=us(e.x-this.min.x,this.xScale,this.cellsX),c=us(t.x-this.min.x,this.xScale,this.cellsX),h=us(e.y-this.min.y,this.yScale,this.cellsY),f=us(t.y-this.min.y,this.yScale,this.cellsY);for(let p=h;p<=f;p++)for(let g=s;g<=c;g++){const x=this.cells[p*this.cellsX+g];if(x)for(let b=0;b<x.len;b++){const w=this.payload[x.start+b],S=Math.floor(w/8),E=1<<w%8;if(!(this.lookup[S]&E)&&(this.lookup[S]|=E,n.push(w),n.length===this.triangleCount))return}}}}function us(r,e,t){return Math.max(0,Math.min(t-1,Math.floor(r*e)))}Qe(Cp,"TriangleGridIndex");class By{constructor(e){this.zoom=e.zoom,this.layers=e.layers,this.layerIds=this.layers.map(t=>t.fqid),this.index=e.index,this.hasPattern=!1,this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id),this.footprints=[],this.worldview=e.worldview,this.hasAppearances=null}updateFootprints(e,t){for(const n of this.footprints)t.push({footprint:n,id:e})}updateAppearances(e,t,n,s){return{hasLayoutChanges:!1,hasUboChanges:!1}}populate(e,t,n,s){const c=[];for(const{feature:h,id:f,index:p,sourceLayerIndex:g}of e){const x=this.layers[0]._featureFilter.needGeometry,b=Ct(h,x);if(!this.layers[0]._featureFilter.filter(new Zt(this.zoom,{worldview:this.worldview,activeFloors:t.activeFloors}),b,n))continue;const w={id:f,properties:h.properties,type:h.type,sourceLayerIndex:g,index:p,geometry:x?b.geometry:ft(h,n,s),patterns:{}};c.push(w)}for(const h of c){const{geometry:f,index:p,sourceLayerIndex:g}=h;this.addFeature(h,f,p,n,{},t.availableImages,t.brightness),t.featureIndex.insert(e[p].feature,f,p,g,this.index)}}isEmpty(){return this.footprints.length===0}uploadPending(){return!1}upload(e){}update(e,t,n,s,c,h,f){}destroy(){}addFeature(e,t,n,s,c,h=[],f){for(const p of Pd(t,2)){const g=[],x=[],b=[],w=new Fe(1/0,1/0),S=new Fe(-1/0,-1/0);for(const P of p)if(P.length!==0){P!==p[0]&&b.push(x.length/2);for(let R=0;R<P.length;R++)x.push(P[R].x),x.push(P[R].y),g.push(P[R]),w.x=Math.min(w.x,P[R].x),w.y=Math.min(w.y,P[R].y),S.x=Math.max(S.x,P[R].x),S.y=Math.max(S.y,P[R].y)}const E=Au(x,b),A=new Cp(g,E,8,256);this.footprints.push({vertices:g,indices:E,grid:A,min:w,max:S})}}}Qe(By,"ClipBucket",{omit:["layers"]});const Vb=zt([{name:"a_pos_normal_ed",components:4,type:"Int16"}]),Nb=zt([{name:"a_pos_end",components:4,type:"Int16"},{name:"a_angular_offset_factor",components:1,type:"Int16"}]),Ub=zt([{name:"a_flood_light_ground_radius",components:1,type:"Float32"}]),jb=zt([{name:"a_centroid_pos",components:2,type:"Uint16"}]),Gb=zt([{name:"a_join_normal_inside",components:3,type:"Int16"}]),qb=zt([{name:"a_hidden_by_landmark",components:1,type:"Uint8"}]),$b=zt([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]),{members:Hb}=Vb,zd=Number.MAX_SAFE_INTEGER,Zb=zd-1;function ky(r,e,t,n){return r.order<e||r.order===zd||!(r.clipMask&t)||function(s,c){return c.length!==0&&c.find(h=>h===s)===void 0}(n,r.clipScope)}function Mp(r,e){return r.x-e.x||r.y-e.y}function Vy(r,e){return Mp(r.min,e.min)===0&&Mp(r.max,e.max)===0}function R_(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 Pp(r,e){if(r.length!==e.length)return!1;for(let t=0;t<r.length;t++)if(r[t].sourceId!==e[t].sourceId||!Vy(r[t],e[t])||r[t].order!==e[t].order||r[t].clipMask!==e[t].clipMask||!di(r[t].clipScope,e[t].clipScope))return!1;return!0}function Ny(r,e,t){const n=1/Ze,s=1/(1<<t.canonical.z),c=(e.x*n+t.canonical.x)*s+t.wrap,h=(e.y*n+t.canonical.y)*s;return{min:new Fe((r.x*n+t.canonical.x)*s+t.wrap,(r.y*n+t.canonical.y)*s),max:new Fe(c,h)}}function Wb(r,e,t){const n=1<<t.canonical.z,s=((e.x-t.wrap)*n-t.canonical.x)*Ze,c=(e.y*n-t.canonical.y)*Ze;return{min:new Fe(((r.x-t.wrap)*n-t.canonical.x)*Ze,(r.y*n-t.canonical.y)*Ze),max:new Fe(s,c)}}function z_(r,e,t,n,s,c,h){const f=r.indices,p=r.vertices,g=[];for(let x=n;x<n+s;x+=3){const b=e[t[x+0]+c],w=e[t[x+1]+c],S=e[t[x+2]+c],E=Math.min(b.x,w.x,S.x),A=Math.max(b.x,w.x,S.x),P=Math.min(b.y,w.y,S.y),R=Math.max(b.y,w.y,S.y);g.length=0,r.grid.query(new Fe(E,P),new Fe(A,R),g);for(let B=0;B<g.length;B++){const L=g[B];if(Iu(p[f[3*L+0]],p[f[3*L+1]],p[f[3*L+2]],b,w,S,h))return!0}}return!1}function Uy(r,e,t,n){if(!r||!t)return!1;let s=r.vertices;if(!e.canonical.equals(n.canonical)||e.wrap!==n.wrap){if(t.vertices.length<r.vertices.length)return Uy(t,n,r,e);const c=e.canonical,h=n.canonical,f=Math.pow(2,h.z-c.z);s=r.vertices.map(p=>new Fe((p.x+c.x*Ze)*f-h.x*Ze,(p.y+c.y*Ze)*f-h.y*Ze))}return z_(t,s,r.indices,0,r.indices.length,0,0)}function jy(r,e,t,n){const s=Math.pow(2,n.z-t.z);return new Fe((r+t.x*Ze)*s-n.x*Ze,(e+t.y*Ze)*s-n.y*Ze)}function Gy(r,e){const t=[];e.grid.queryPoint(r,t);const n=e.indices,s=e.vertices;for(let c=0;c<t.length;c++){const h=t[c];if(Xr([s[n[3*h+0]],s[n[3*h+1]],s[n[3*h+2]]],r))return!0}return!1}const Dp={None:0,Model:1,Symbol:2,FillExtrusion:4},L_=[new Fe(0,0),new Fe(Ze,0),new Fe(Ze,Ze),new Fe(0,Ze)];function qy(r,e){const t=[];let n=[];if(!e||r.length<2)return[r];if(r.length===2)return ss(r[0],r[1],L_)?[r]:[];for(let s=0;s<r.length+2;s++){const c=r[s%r.length],h=r[(s+1)%r.length],f=ss(s===0?r[r.length-1]:r[(s-1)%r.length],c,L_),p=ss(c,h,L_),g=f||p;g&&n.push(c),g&&p||n.length>0&&(n.length>1&&t.push(n),n=[])}return n.length>1&&t.push(n),t}const F_=yt.types,Xb=["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"],Yb=["fill-extrusion-flood-light-ground-radius"],Kb=Math.pow(2,13),Qb=Math.pow(2,15)-1,Rp=new Fe(0,1),$s=2147483648,zp=1073741824;function Ld(r,e,t,n,s,c,h,f){r.emplaceBack((e<<1)+h,(t<<1)+c,(Math.floor(n*Kb)<<1)+s,Math.round(f))}function Fd(r,e,t){r.emplaceBack(e.x*Ze,e.y*Ze,t?1:0)}function Lp(r,e,t,n,s,c){r.emplaceBack(e.x,e.y,(t.x<<1)+n,(t.y<<1)+s,c)}function Od(r,e,t){r.emplaceBack(e.x,e.y,e.z,t[0]*16384,t[1]*16384,t[2]*16384)}class $y{constructor(){this.vertexOffset=0,this.vertexCount=0,this.indexOffset=0,this.indexCount=0}}class O_{constructor(){this.centroidXY=new Fe(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 Fe(Number.MAX_VALUE,Number.MAX_VALUE),this.max=new Fe(-Number.MAX_VALUE,-Number.MAX_VALUE),this.height=0,this.buildingId=0,this.groupCentroidPos=new Fe(0,0)}span(){return new Fe(this.max.x-this.min.x,this.max.y-this.min.y)}}class B_{constructor(){this.acc=new Fe(0,0),this.accCount=0,this.centroidDataIndex=0}startRing(e,t){e.min.x===Number.MAX_VALUE&&(e.min.x=e.max.x=t.x,e.min.y=e.max.y=t.y)}appendEdge(e,t,n){this.accCount++,this.acc._add(t);let s=!!this.borders;t.x<e.min.x?(e.min.x=t.x,s=!0):t.x>e.max.x&&(e.max.x=t.x,s=!0),t.y<e.min.y?(e.min.y=t.y,s=!0):t.y>e.max.y&&(e.max.y=t.y,s=!0),((t.x===0||t.x===Ze)&&t.x===n.x)!=((t.y===0||t.y===Ze)&&t.y===n.y)&&this.processBorderOverlap(t,n),s&&this.checkBorderIntersection(t,n)}checkBorderIntersection(e,t){t.x<0!=e.x<0&&this.addBorderIntersection(0,dt(t.y,e.y,(0-t.x)/(e.x-t.x))),t.x>Ze!=e.x>Ze&&this.addBorderIntersection(1,dt(t.y,e.y,(Ze-t.x)/(e.x-t.x))),t.y<0!=e.y<0&&this.addBorderIntersection(2,dt(t.x,e.x,(0-t.y)/(e.y-t.y))),t.y>Ze!=e.y>Ze&&this.addBorderIntersection(3,dt(t.x,e.x,(Ze-t.y)/(e.y-t.y)))}addBorderIntersection(e,t){this.borders||(this.borders=[[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE]]);const n=this.borders[e];t<n[0]&&(n[0]=t),t>n[1]&&(n[1]=t)}processBorderOverlap(e,t){if(e.x===t.x){if(e.y===t.y)return;const n=e.x===0?0:1;this.addBorderIntersection(n,t.y),this.addBorderIntersection(n,e.y)}else{const n=e.y===0?2:3;this.addBorderIntersection(n,t.x),this.addBorderIntersection(n,e.x)}}centroid(){return this.accCount===0?new Fe(0,0):new Fe(Math.floor(Math.max(0,this.acc.x)/this.accCount),Math.floor(Math.max(0,this.acc.y)/this.accCount))}intersectsCount(){return this.borders?this.borders.reduce((e,t)=>e+ +(t[0]!==Number.MAX_VALUE),0):0}}function Hy(r,e){const t=r.add(e)._unit(),n=k(r.x*t.x+r.y*t.y,-1,1);var s,c,h;return h=Math.acos(n),Math.min(4,Math.max(-4,Math.tan(h)))/4*Qb*((s=r).x*(c=e).y-s.y*c.x<0?-1:1)}const Jb=[r=>r.x<0,r=>r.x>Ze,r=>r.y<0,r=>r.y>Ze];function e1(r,e,t,n){const s=[4];if(n===0)return s;t._mult(n);const c=r.sub(t),h=e.sub(t),f=[r,e,c,h];for(let p=0;p<4;p++)for(const g of f)if(Jb[p](g)){s.push(p);break}return s}class k_{constructor(e){this.groundRadiusArray=null,this.groundRadiusBuffer=null,this.vertexArray=new ld,this.indexArray=new Ni,this.programConfigurations=new D(e.layers,{zoom:e.zoom,lut:e.lut},t=>Yb.includes(t)),this._segments=new oi,this.hiddenByLandmarkVertexArray=new wu,this._segmentToGroundQuads={},this._segmentToGroundQuads[0]=[],this._segmentToRegionTriCounts={},this._segmentToRegionTriCounts[0]=[0,0,0,0,0],this.regionSegments={},this.regionSegments[4]=new oi}getDefaultSegment(){return this.regionSegments[4]}hasData(){return this.vertexArray.length!==0}addData(e,t,n,s=!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 p;h!==this._segments.get().length-1&&(h++,this._segmentToGroundQuads[h]=[],this._segmentToRegionTriCounts[h]=[0,0,0,0,0]);{const g=e[0],x=e[1];p=Hy(g.sub(e[c-1])._perp()._unit(),x.sub(g)._perp()._unit())}for(let g=0;g<c;g++){const x=g===c-1?0:g+1,b=e[g],w=e[x],S=e[x===c-1?0:x+1],E=w.sub(b)._perp()._unit(),A=Hy(E,S.sub(w)._perp()._unit()),P=p,R=A;if(V_(b,w,t)||s&&Xy(b,t)&&Xy(w,t)){p=A;continue}const B=f.vertexLength;Lp(this.vertexArray,b,w,1,1,P),Lp(this.vertexArray,b,w,1,0,P),Lp(this.vertexArray,b,w,0,1,R),Lp(this.vertexArray,b,w,0,0,R),f.vertexLength+=4;const L=e1(b,w,E,n);for(const U of L)this._segmentToGroundQuads[h].push({id:B,region:U}),this._segmentToRegionTriCounts[h][U]+=2,f.primitiveLength+=2;p=A}}}prepareBorderSegments(){if(!this.hasData())return;const e=this._segments.get(),t=e.length;for(let n=0;n<t;n++)this._segmentToGroundQuads[n].sort((s,c)=>s.region-c.region);for(let n=0;n<t;n++){const s=this._segmentToGroundQuads[n],c=e[n],h=this._segmentToRegionTriCounts[n];h.reduce((p,g)=>p+g,0);let f=0;for(let p=0;p<=4;p++){const g=h[p];if(g!==0){let x=this.regionSegments[p];x||(x=this.regionSegments[p]=new oi);const b={vertexOffset:c.vertexOffset,primitiveOffset:c.primitiveOffset+f,vertexLength:c.vertexLength,primitiveLength:g};x.get().push(b)}f+=g}for(let p=0;p<s.length;p++){const g=s[p].id;this.indexArray.emplaceBack(g,g+1,g+3),this.indexArray.emplaceBack(g,g+3,g+2)}}this._segmentToGroundQuads=null,this._segmentToRegionTriCounts=null,this._segments.destroy(),this._segments=null}addPaintPropertiesData(e,t,n,s,c,h,f){this.hasData()&&this.programConfigurations.populatePaintArrays(this.vertexArray.length,e,t,n,s,c,h,void 0,f)}upload(e){this.hasData()&&(this.vertexBuffer=e.createVertexBuffer(this.vertexArray,Nb.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.groundRadiusArray!=null&&(this.groundRadiusBuffer=e.createVertexBuffer(this.groundRadiusArray,Ub.members)))}uploadPaintProperties(e){this.hasData()&&this.programConfigurations.upload(e)}update(e,t,n,s,c,h,f,p){this.hasData()&&this.programConfigurations.updatePaintArrays(e,t,n,s,c,h,f,p)}updateHiddenByLandmark(e){this.updateHiddenByLandmarkRange(e.groundVertexArrayOffset,e.groundVertexCount,!!(e.flags&$s||e.flags&zp))}updateHiddenByLandmarkRange(e,t,n){if(!this.hasData())return;const s=t+e;if(t!==0){for(let c=e;c<s;++c)this.hiddenByLandmarkVertexArray.emplace(c,n?1:0);this._needsHiddenByLandmarkUpdate=!0}}uploadHiddenByLandmark(e){this.hasData()&&this._needsHiddenByLandmarkUpdate&&(!this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexArray.length>0?this.hiddenByLandmarkVertexBuffer=e.createVertexBuffer(this.hiddenByLandmarkVertexArray,qb.members,!0):this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexBuffer.updateData(this.hiddenByLandmarkVertexArray),this._needsHiddenByLandmarkUpdate=!1)}destroy(){if(this.vertexBuffer){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexBuffer.destroy(),this.groundRadiusBuffer&&this.groundRadiusBuffer.destroy(),this._segments&&this._segments.destroy(),this.programConfigurations.destroy();for(let e=0;e<=4;e++){const t=this.regionSegments[e];t&&t.destroy()}}}}class Fp{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(t=>t.fqid),this.index=e.index,this.hasPattern=!1,this.edgeRadius=0,this.projection=e.projection,this.activeReplacements=[],this.replacementUpdateTime=0,this.centroidData=[],this.footprintIndices=new Ni,this.footprintVertices=new sn,this.footprintSegments=[],this.layoutVertexArray=new ad,this.centroidVertexArray=new pp,this.wallVertexArray=new vd,this.indexArray=new Ni,this.programConfigurations=new D(e.layers,{zoom:e.zoom,lut:e.lut},t=>Xb.includes(t)),this.segments=new oi,this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id),this.groundEffect=new k_(e),this.maxHeight=0,this.partLookup={},this.triangleSubSegments=[],this.polygonSegments=[],this.buildingGroups=new Map,this.worldview=e.worldview,this.hasAppearances=null}updateFootprints(e,t){}updateAppearances(e,t,n,s){return{hasLayoutChanges:!1,hasUboChanges:!1}}populate(e,t,n,s){this.features=[],this.hasPattern=b_("fill-extrusion",this.layers,this.pixelRatio,t),this.featuresOnBorder=[],this.borderFeatureIndices=[[],[],[],[]],this.borderDoneWithNeighborZ=[-1,-1,-1,-1],this.selfDEMTileTimestamp=Number.MAX_VALUE,this.borderDEMTileTimestamp=[Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE],this.tileToMeter=De(n),this.edgeRadius=this.layers[0].layout.get("fill-extrusion-edge-radius")/this.tileToMeter,this.wallMode=this.layers[0].paint.get("fill-extrusion-line-width").constantOr(1)!==0;for(const{feature:c,id:h,index:f,sourceLayerIndex:p}of e){const g=this.layers[0]._featureFilter.needGeometry,x=Ct(c,g);if(!this.layers[0]._featureFilter.filter(new Zt(this.zoom,{worldview:this.worldview,activeFloors:t.activeFloors}),x,n))continue;const b={id:h,sourceLayerIndex:p,index:f,geometry:g?x.geometry:ft(c,n,s),properties:c.properties,type:c.type,patterns:{}},w=this.layoutVertexArray.length,S=F_[b.type]==="Polygon";if(this.hasPattern)this.features.push({featureId:c.id,feature:w_("fill-extrusion",this.layers,b,this.zoom,this.pixelRatio,t)});else if(this.wallMode)for(const E of b.geometry)for(const A of qy(E,S))this.addFeature(c.id,b,[A],f,n,{},t.availableImages,s,t.brightness);else this.addFeature(c.id,b,b.geometry,f,n,{},t.availableImages,s,t.brightness);t.featureIndex.insert(c,b.geometry,f,p,this.index,w)}this._finalizeBuildingGroups(),this.sortBorders(),this.projection.name==="mercator"&&this.splitToSubtiles(),this.groundEffect.prepareBorderSegments(),this.polygonSegments.length=0}addFeatures(e,t,n,s,c,h){for(const{featureId:f,feature:p}of this.features){const g=F_[p.type]==="Polygon",{geometry:x}=p;if(this.wallMode)for(const b of x)for(const w of qy(b,g))this.addFeature(f,p,[w],p.index,t,n,s,c,h);else this.addFeature(f,p,x,p.index,t,n,s,c,h)}this._finalizeBuildingGroups(),this.sortBorders(),this.projection.name==="mercator"&&this.splitToSubtiles()}update(e,t,n,s,c,h,f){this.programConfigurations.updatePaintArrays(e,t,c,n,s,h,f,this.worldview),this.groundEffect.update(e,t,c,n,s,h,f,this.worldview)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload||this.groundEffect.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Hb),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.wallVertexBuffer=e.createVertexBuffer(this.wallVertexArray,Gb.members),this.layoutVertexExtArray&&(this.layoutVertexExtBuffer=e.createVertexBuffer(this.layoutVertexExtArray,$b.members,!0)),this.groundEffect.upload(e)),this.groundEffect.uploadPaintProperties(e),this.programConfigurations.upload(e),this.uploaded=!0}uploadCentroid(e){this.groundEffect.uploadHiddenByLandmark(e),this.needsCentroidUpdate&&(!this.centroidVertexBuffer&&this.centroidVertexArray.length>0?this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,jb.members,!0):this.centroidVertexBuffer&&this.centroidVertexBuffer.updateData(this.centroidVertexArray),this.needsCentroidUpdate=!1)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.centroidVertexBuffer&&this.centroidVertexBuffer.destroy(),this.layoutVertexExtBuffer&&this.layoutVertexExtBuffer.destroy(),this.groundEffect.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(e,t,n,s,c,h,f,p,g){const x=this.layers[0].paint.get("fill-extrusion-flood-light-ground-radius").evaluate(t,{})/this.tileToMeter,b=[new Fe(0,0),new Fe(Ze,Ze)],w=p.projection,S=w.name==="globe",E=this.wallMode||F_[t.type]==="Polygon",A=new B_;A.centroidDataIndex=this.centroidData.length;const P=new O_;P.buildingId=e,t.properties&&t.properties.hasOwnProperty("building_id")&&(P.buildingId=Number(t.properties.building_id)),A.buildingId=P.buildingId;const R=this.layers[0].paint.get("fill-extrusion-base").evaluate(t,{},c)<=0,B=this.layers[0].paint.get("fill-extrusion-height").evaluate(t,{},c);let L;if(P.height=B,P.vertexArrayOffset=this.layoutVertexArray.length,P.groundVertexArrayOffset=this.groundEffect.vertexArray.length,S&&!this.layoutVertexExtArray&&(this.layoutVertexExtArray=new _u),this.wallMode){if(S)return void lt("Non zero fill-extrusion-line-width is not yet supported on globe.");if(n.length!==1)return;L=function(Q){const J=Q[0].x===Q[Q.length-1].x&&Q[0].y===Q[Q.length-1].y;(function(qe){let je=0;const Ye=qe.length;for(let it=0;it<Ye;it++)je+=(qe[(it+1)%Ye].x-qe[it].x)*(qe[(it+1)%Ye].y+qe[it].y);return je>=0})(Q)||(Q=Q.reverse());const Te={geometry:[],joinNormals:[],indices:[]},Ie=[],Ce=[],Ee=[];let Oe=Q.length;for(;Oe>=2&&Q[Oe-1].equals(Q[Oe-2]);)Oe--;if(Oe<(J?3:2))return Te;let ye,Ae,Pe,Be,Ue,Je=0;for(;Je<Oe-1&&Q[Je].equals(Q[Je+1]);)Je++;J&&(ye=Q[Oe-2],Ue=Q[Je].sub(ye)._unit()._perp());for(let qe=Je;qe<Oe;qe++){if(Pe=qe===Oe-1?J?Q[Je+1]:void 0:Q[qe+1],Pe&&Q[qe].equals(Pe))continue;Ue&&(Be=Ue),ye&&(Ae=ye),ye=Q[qe],Ue=Pe?Pe.sub(ye)._unit()._perp():Be,Be=Be||Ue;let je=Be.add(Ue);je.x===0&&je.y===0||je._unit();const Ye=je.x*Ue.x+je.y*Ue.y,it=Ye!==0?1/Ye:1/0,ht=Be.x*Ue.y-Be.y*Ue.x>0;let nt="miter";const wt=2;nt==="miter"&&it>wt&&(nt="bevel"),nt==="bevel"&&(it>100&&(nt="flipbevel"),it<wt&&(nt="miter"));const Ft=(Tt,Bt,Mt,Li)=>{const Wt=new Fe(Tt.x,Tt.y),Ut=new Fe(Tt.x,Tt.y);Wt.x+=Bt.x*Li,Wt.y+=Bt.y*Li,Ut.x-=Bt.x*Math.max(Mt,1),Ut.y-=Bt.y*Math.max(Mt,1),Ee.push(Bt),Ie.push(Wt),Ce.push(Ut)};if(nt==="miter")je._mult(it),Ft(ye,je,0,0);else if(nt==="flipbevel")je=Ue.mult(-1),Ft(ye,je,0,0),Ft(ye,je.mult(-1),0,0);else{const Tt=-Math.sqrt(it*it-1),Bt=ht?Tt:0,Mt=ht?0:Tt;Ae&&Ft(ye,Be,Bt,Mt),Pe&&Ft(ye,Ue,Bt,Mt)}}Te.geometry=[...Ie,...Ce.reverse(),Ie[0]],Te.joinNormals=[...Ee,...Ee.reverse(),Ee[Ee.length-1]];const He=Te.geometry.length-1;for(let qe=0;qe<He/2;qe++)if(qe+1<He/2){let je=qe,Ye=qe+1,it=He-1-qe,ht=He-2-qe;je=je===0?He-1:je-1,Ye=Ye===0?He-1:Ye-1,it=it===0?He-1:it-1,ht=ht===0?He-1:ht-1,Te.indices.push(it),Te.indices.push(Ye),Te.indices.push(je),Te.indices.push(it),Te.indices.push(ht),Te.indices.push(Ye)}return Te}(n[0]),n=[L.geometry]}const U=(Q,J)=>Q<(J.length-1)/2||Q===J.length-1,G=this.wallMode?[n]:Pd(n,500);for(let Q=G.length-1;Q>=0;Q--){const J=G[Q];(J.length===0||i1(J[0]))&&G.splice(Q,1)}let q;if(S)q=Jy(G,b,c);else{q=[];for(const Q of G)q.push({polygon:Q,bounds:b})}const ie=E?this.edgeRadius:0,X=ie>0&&this.zoom<17,ee=(Q,J)=>{if(Q.length===0)return!1;const ve=Q[Q.length-1];return J.x===ve.x&&J.y===ve.y};for(const{polygon:Q,bounds:J}of q){let ve=0,Te=0;for(const Oe of Q)E&&!Oe[0].equals(Oe[Oe.length-1])&&Oe.push(Oe[0]),Te+=E?Oe.length-1:Oe.length;const Ie=this.segments.prepareSegment((E?5:4)*Te,this.layoutVertexArray,this.indexArray);P.footprintSegIdx<0&&(P.footprintSegIdx=this.footprintSegments.length),P.polygonSegIdx<0&&(P.polygonSegIdx=this.polygonSegments.length);const Ce={triangleArrayOffset:this.indexArray.length,triangleCount:0,triangleSegIdx:this.segments.segments.length-1},Ee=new $y;if(Ee.vertexOffset=this.footprintVertices.length,Ee.indexOffset=3*this.footprintIndices.length,Ee.ringIndices=[],E){const Oe=[],ye=[];ve=Ie.vertexLength;for(let Pe=0;Pe<Q.length;Pe++){const Be=Q[Pe];Be.length&&Pe!==0&&ye.push(Oe.length/2);const Ue=[];let Je,He;Je=Be[1].sub(Be[0])._perp()._unit(),Ee.ringIndices.push(Be.length-1);for(let qe=1;qe<Be.length;qe++){const je=Be[qe],Ye=Be[qe===Be.length-1?1:qe+1],it=je.clone();if(ie){He=Ye.sub(je)._perp()._unit();const ht=Je.add(He)._unit(),nt=ie*Math.min(4,1/(Je.x*ht.x+Je.y*ht.y));it.x+=nt*ht.x,it.y+=nt*ht.y,it.x=Math.round(it.x),it.y=Math.round(it.y),Je=He}if(!R||ie!==0&&!X||ee(Ue,it)||Ue.push(it),Ld(this.layoutVertexArray,it.x,it.y,0,0,1,1,0),this.wallMode){const ht=U(qe,Be);Fd(this.wallVertexArray,L.joinNormals[qe],!ht)}Ie.vertexLength++,this.footprintVertices.emplaceBack(je.x,je.y),Oe.push(je.x,je.y),S&&Od(this.layoutVertexExtArray,w.projectTilePoint(it.x,it.y,c),w.upVector(c,it.x,it.y))}R&&(ie===0||X)&&(Ue.length!==0&&ee(Ue,Ue[0])&&Ue.pop(),this.groundEffect.addData(Ue,J,x))}const Ae=this.wallMode?L.indices:Au(Oe,ye);for(let Pe=0;Pe<Ae.length;Pe+=3)this.footprintIndices.emplaceBack(Ee.vertexOffset+Ae[Pe+0],Ee.vertexOffset+Ae[Pe+1],Ee.vertexOffset+Ae[Pe+2]),this.indexArray.emplaceBack(ve+Ae[Pe],ve+Ae[Pe+2],ve+Ae[Pe+1]),Ie.primitiveLength++;Ee.indexCount+=Ae.length,Ee.vertexCount+=this.footprintVertices.length-Ee.vertexOffset}for(let Oe=0;Oe<Q.length;Oe++){const ye=Q[Oe];A.startRing(P,ye[0]);let Ae=ye.length>4&&Yy(ye[ye.length-2],ye[0],ye[1]),Pe=ie?t1(ye[ye.length-2],ye[0],ye[1],ie):0;const Be=[];let Ue,Je,He;Je=ye[1].sub(ye[0])._perp()._unit();let qe=!0;for(let je=1,Ye=0;je<ye.length;je++){let it=ye[je-1],ht=ye[je];const nt=ye[je===ye.length-1?1:je+1];if(A.appendEdge(P,ht,it),V_(ht,it,J)){ie&&(Je=nt.sub(ht)._perp()._unit(),qe=!qe);continue}const wt=ht.sub(it)._perp(),Ft=wt.x/(Math.abs(wt.x)+Math.abs(wt.y)),Tt=wt.y>0?1:0,Bt=it.dist(ht);if(Ye+Bt>32768&&(Ye=0),ie){He=nt.sub(ht)._perp()._unit();let Ut=Wy(it,ht,nt,Zy(Je,He),ie);isNaN(Ut)&&(Ut=0);const li=ht.sub(it)._unit();it=it.add(li.mult(Pe))._round(),ht=ht.add(li.mult(-Ut))._round(),Pe=Ut,Je=He,R&&this.zoom>=17&&(ee(Be,it)||Be.push(it),ee(Be,ht)||Be.push(ht))}const Mt=Ie.vertexLength,Li=ye.length>4&&Yy(it,ht,nt);let Wt=Ky(Ye,Ae,qe);if(Ld(this.layoutVertexArray,it.x,it.y,Ft,Tt,0,0,Wt),Ld(this.layoutVertexArray,it.x,it.y,Ft,Tt,0,1,Wt),this.wallMode){const Ut=U(je-1,ye),li=L.joinNormals[je-1];Fd(this.wallVertexArray,li,Ut),Fd(this.wallVertexArray,li,Ut)}if(Ye+=Bt,Wt=Ky(Ye,Li,!qe),Ae=Li,Ld(this.layoutVertexArray,ht.x,ht.y,Ft,Tt,0,0,Wt),Ld(this.layoutVertexArray,ht.x,ht.y,Ft,Tt,0,1,Wt),this.wallMode){const Ut=U(je,ye),li=L.joinNormals[je];Fd(this.wallVertexArray,li,Ut),Fd(this.wallVertexArray,li,Ut)}if(Ie.vertexLength+=4,this.indexArray.emplaceBack(Mt+0,Mt+1,Mt+2),this.indexArray.emplaceBack(Mt+1,Mt+3,Mt+2),Ie.primitiveLength+=2,ie){const Ut=ve+(je===1?ye.length-2:je-2),li=je===1?ve:Ut+1;if(this.indexArray.emplaceBack(Mt+1,Ut,Mt+3),this.indexArray.emplaceBack(Ut,li,Mt+3),Ie.primitiveLength+=2,Ue===void 0&&(Ue=Mt),!V_(nt,ye[je],J)){const Mi=je===ye.length-1?Ue:Ie.vertexLength;this.indexArray.emplaceBack(Mt+2,Mt+3,Mi),this.indexArray.emplaceBack(Mt+3,Mi+1,Mi),this.indexArray.emplaceBack(Mt+3,li,Mi+1),Ie.primitiveLength+=3}qe=!qe}if(S){const Ut=this.layoutVertexExtArray,li=w.projectTilePoint(it.x,it.y,c),Mi=w.projectTilePoint(ht.x,ht.y,c),ur=w.upVector(c,it.x,it.y),Pi=w.upVector(c,ht.x,ht.y);Od(Ut,li,ur),Od(Ut,li,ur),Od(Ut,Mi,Pi),Od(Ut,Mi,Pi)}}E&&(ve+=ye.length-1),R&&ie&&this.zoom>=17&&(Be.length!==0&&ee(Be,Be[0])&&Be.pop(),this.groundEffect.addData(Be,J,x,ie>0))}this.footprintSegments.push(Ee),Ce.triangleCount=this.indexArray.length-Ce.triangleArrayOffset,this.polygonSegments.push(Ce),++P.footprintSegLen,++P.polygonSegLen}if(P.vertexCount=this.layoutVertexArray.length-P.vertexArrayOffset,P.groundVertexCount=this.groundEffect.vertexArray.length-P.groundVertexArrayOffset,P.vertexCount!==0){if(P.centroidXY=A.borders?Rp:this.encodeCentroid(A,P),t.properties&&t.properties.hasOwnProperty("building_id")){const Q=P.buildingId;let J=this.buildingGroups.get(Q);J||(J={accX:0,accY:0,accCount:0,mergedMin:new Fe(Number.MAX_VALUE,Number.MAX_VALUE),mergedMax:new Fe(-Number.MAX_VALUE,-Number.MAX_VALUE),partIndices:[]},this.buildingGroups.set(Q,J)),J.accX+=A.acc.x,J.accY+=A.acc.y,J.accCount+=A.accCount,J.mergedMin.x=Math.min(J.mergedMin.x,P.min.x),J.mergedMin.y=Math.min(J.mergedMin.y,P.min.y),J.mergedMax.x=Math.max(J.mergedMax.x,P.max.x),J.mergedMax.y=Math.max(J.mergedMax.y,P.max.y),J.partIndices.push(this.centroidData.length)}if(this.centroidData.push(P),A.borders){this.featuresOnBorder.push(A);const Q=this.featuresOnBorder.length-1;for(let J=0;J<A.borders.length;J++)A.borders[J][0]!==Number.MAX_VALUE&&this.borderFeatureIndices[J].push(Q)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,s,h,f,c,g,void 0,this.worldview),this.groundEffect.addPaintPropertiesData(t,s,h,f,c,g,this.worldview),this.maxHeight=Math.max(this.maxHeight,B)}}_finalizeBuildingGroups(){for(const[,e]of this.buildingGroups){if(e.partIndices.length===0)continue;const t=new B_;t.acc=new Fe(e.accX,e.accY),t.accCount=e.accCount;const n=new O_;n.min=e.mergedMin,n.max=e.mergedMax;const s=this.encodeCentroid(t,n),c=t.centroid();for(const h of e.partIndices){const f=this.centroidData[h];f.centroidXY.x===Rp.x&&f.centroidXY.y===Rp.y||(f.centroidXY=s),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((t,n)=>this.featuresOnBorder[t].borders[e][0]-this.featuresOnBorder[n].borders[e][0])}splitToSubtiles(){const e=[];for(let f=0;f<this.centroidData.length;f++){const p=this.centroidData[f],g=+(p.min.y+p.max.y>Ze),x=2*g+(+(p.min.x+p.max.x>Ze)^g);for(let b=0;b<p.polygonSegLen;b++){const w=p.polygonSegIdx+b;e.push({centroidIdx:f,subtile:x,polygonSegmentIdx:w,triangleSegmentIdx:this.polygonSegments[w].triangleSegIdx})}}const t=new Ni;e.sort((f,p)=>f.triangleSegmentIdx===p.triangleSegmentIdx?f.subtile-p.subtile:f.triangleSegmentIdx-p.triangleSegmentIdx);let n=0,s=0,c=0;for(const f of e){if(f.triangleSegmentIdx!==n)break;c++}const h=e.length;for(;s!==e.length;){n=e[s].triangleSegmentIdx;let f=0,p=s,g=s;for(let x=p;x<c&&e[x].subtile===f;x++)g++;for(;p!==c;){const x=e[p];f=x.subtile;const b=this.centroidData[x.centroidIdx].min.clone(),w=this.centroidData[x.centroidIdx].max.clone(),S={vertexOffset:this.segments.segments[n].vertexOffset,primitiveOffset:t.length,vertexLength:this.segments.segments[n].vertexLength,primitiveLength:0,sortKey:void 0,vaos:{}};for(let E=p;E<g;E++){const A=e[E],P=this.polygonSegments[A.polygonSegmentIdx],R=this.centroidData[A.centroidIdx].min,B=this.centroidData[A.centroidIdx].max,L=this.indexArray.uint16;for(let U=P.triangleArrayOffset;U<P.triangleArrayOffset+P.triangleCount;U++)t.emplaceBack(L[3*U],L[3*U+1],L[3*U+2]);S.primitiveLength+=P.triangleCount,b.x=Math.min(b.x,R.x),b.y=Math.min(b.y,R.y),w.x=Math.max(w.x,B.x),w.y=Math.max(w.y,B.y)}S.primitiveLength>0&&this.triangleSubSegments.push({segment:S,min:b,max:w}),p=g;for(let E=p;E<c&&e[E].subtile===e[p].subtile;E++)g++}s=c;for(let x=s;x<h&&e[x].triangleSegmentIdx===e[s].triangleSegmentIdx;x++)c++}t._trim(),this.indexArray=t}getVisibleSegments(e,t,n){const s=new oi;if(this.wallMode){for(const A of this.triangleSubSegments)s.segments.push(A.segment);return s}let c=0,h=0;const f=1<<e.canonical.z;if(t){const A=t.getMinMaxForTile(e);A&&(c=A.min,h=A.max)}h+=this.maxHeight;const p=e.toUnwrapped();let g;const x=[p.canonical.x/f+p.wrap,p.canonical.y/f],b=[(p.canonical.x+1)/f+p.wrap,(p.canonical.y+1)/f],w=(A,P,R)=>[A[0]*(1-R[0])+P[0]*R[0],A[1]*(1-R[1])+P[1]*R[1]],S=[],E=[];for(const A of this.triangleSubSegments){S[0]=A.min.x/Ze,S[1]=A.min.y/Ze,E[0]=A.max.x/Ze,E[1]=A.max.y/Ze;const P=w(x,b,S),R=w(x,b,E);if(new Xt([P[0],P[1],c],[R[0],R[1],h]).intersectsPrecise(n)===0){g&&(s.segments.push(g),g=void 0);continue}const B=A.segment;g&&g.vertexOffset!==B.vertexOffset&&(s.segments.push(g),g=void 0),g?(g.vertexLength+=B.vertexLength,g.primitiveLength+=B.primitiveLength):g={vertexOffset:B.vertexOffset,primitiveLength:B.primitiveLength,vertexLength:B.vertexLength,primitiveOffset:B.primitiveOffset,sortKey:void 0,vaos:{}}}return g&&s.segments.push(g),s}encodeCentroid(e,t){const n=e.centroid(),s=t.span(),c=Math.min(7,Math.round(s.x*this.tileToMeter/10)),h=Math.min(6,Math.round(s.y*this.tileToMeter/10));return new Fe(k(n.x,1,8191)<<3|c,k(n.y,1,8191)<<3|h)}encodeBorderCentroid(e){if(!e.borders)return new Fe(0,0);const t=e.borders,n=Number.MAX_VALUE;if(t[0][0]!==n||t[1][0]!==n){const s=t[0][0]!==n?0:1;return new Fe(6|(t[0][0]!==n?0:65528),(t[s][0]+t[s][1])/2<<3|6)}{const s=t[2][0]!==n?2:3;return new Fe((t[s][0]+t[s][1])/2<<3|6,6|(t[2][0]!==n?0:65528))}}showCentroid(e){const t=this.centroidData[e.centroidDataIndex];if(t.flags&=$s,t.groupCentroidPos.x!==0||t.groupCentroidPos.y!==0){const n=t.span(),s=Math.min(7,Math.round(n.x*this.tileToMeter/10)),c=Math.min(6,Math.round(n.y*this.tileToMeter/10));t.centroidXY=new Fe(k(t.groupCentroidPos.x,1,8191)<<3|s,k(t.groupCentroidPos.y,1,8191)<<3|c)}else t.centroidXY=new Fe(0,0);this.writeCentroidToBuffer(t)}writeCentroidToBuffer(e){this.groundEffect.updateHiddenByLandmark(e);const t=e.vertexArrayOffset,n=e.vertexCount+e.vertexArrayOffset,s=-1073741824&e.flags?Rp:e.centroidXY,c=this.centroidVertexArray.geta_centroid_pos0(t);if(this.centroidVertexArray.geta_centroid_pos1(t)!==s.y||c!==s.x){for(let h=t;h<n;++h)this.centroidVertexArray.emplace(h,s.x,s.y);this.needsCentroidUpdate=!0}}createCentroidsBuffer(){this.centroidVertexArray.resize(this.layoutVertexArray.length),this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length);for(const e of this.centroidData)this.writeCentroidToBuffer(e)}updateReplacement(e,t,n){if(t.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=t.updateTime;const s=t.getReplacementRegionsForTile(e.toUnwrapped());if(Pp(this.activeReplacements,s))return;if(this.activeReplacements=s,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<n)continue;const f=Math.max(1,Math.pow(2,h.footprintTileId.canonical.z-e.canonical.z));if(h.footprint.buildingIds)for(const p of this.centroidData)p.flags&$s||p.flags&zp||h.min.x>p.max.x||p.min.x>h.max.x||h.min.y>p.max.y||p.min.y>h.max.y||h.footprint.buildingIds.has(p.buildingId)&&(p.flags|=h.clipMask!==Dp.None?-1073741824:$s);else for(const p of this.centroidData)if(!(p.flags&$s||p.flags&zp||h.min.x>p.max.x||p.min.x>h.max.x||h.min.y>p.max.y||p.min.y>h.max.y))for(let g=0;g<p.footprintSegLen;g++){const x=this.footprintSegments[p.footprintSegIdx+g];if(c.length=0,r1(this.footprintVertices,x.vertexOffset,x.vertexCount,h.footprintTileId.canonical,e.canonical,c),z_(h.footprint,c,this.footprintIndices.uint16,x.indexOffset,x.indexCount,-x.vertexOffset,-f)){p.flags|=h.clipMask!==Dp.None?-1073741824:$s;break}}}for(const h of this.centroidData)this.writeCentroidToBuffer(h);this.borderDoneWithNeighborZ=[-1,-1,-1,-1]}footprintContainsPoint(e,t,n){let s=!1;for(let c=0;c<n.footprintSegLen;c++){const h=this.footprintSegments[n.footprintSegIdx+c];let f=0;for(const p of h.ringIndices){for(let g=f,x=p+f-1;g<p+f;x=g++){const b=this.footprintVertices.int16[2*(g+h.vertexOffset)+0],w=this.footprintVertices.int16[2*(g+h.vertexOffset)+1],S=this.footprintVertices.int16[2*(x+h.vertexOffset)+1];w>t!=S>t&&e<(this.footprintVertices.int16[2*(x+h.vertexOffset)+0]-b)*(t-w)/(S-w)+b&&(s=!s)}f=p}}return s}getHeightAtTileCoord(e,t){let n=Number.NEGATIVE_INFINITY,s=!0;const c=4*(e+Ze)*Ze+(t+Ze);if(this.partLookup.hasOwnProperty(c)){const h=this.partLookup[c];return h?{height:h.height,hidden:!!(h.flags&$s)}:void 0}for(const h of this.centroidData)e>h.max.x||h.min.x>e||t>h.max.y||h.min.y>t||h.height<=n||this.footprintContainsPoint(e,t,h)&&(n=h.height,this.partLookup[c]=h,s=!!(h.flags&$s));if(n!==Number.NEGATIVE_INFINITY)return{height:n,hidden:s};this.partLookup[c]=void 0}}function Zy(r,e){const t=r.add(e)._unit();return r.x*t.x+r.y*t.y}function t1(r,e,t,n){const s=e.sub(r)._perp()._unit(),c=t.sub(e)._perp()._unit();return Wy(r,e,t,Zy(s,c),n)}function Wy(r,e,t,n,s){const c=Math.sqrt(1-n*n);return Math.min(r.dist(e)/3,e.dist(t)/3,s*c/n)}function V_(r,e,t){return r.x<t[0].x&&e.x<t[0].x||r.x>t[1].x&&e.x>t[1].x||r.y<t[0].y&&e.y<t[0].y||r.y>t[1].y&&e.y>t[1].y}function Xy(r,e){return r.x<e[0].x||r.x>e[1].x||r.y<e[0].y||r.y>e[1].y}function i1(r){return r.every(e=>e.x<=0)||r.every(e=>e.x>=Ze)||r.every(e=>e.y<=0)||r.every(e=>e.y>=Ze)}function Yy(r,e,t){if(r.x<0||r.x>=Ze||e.x<0||e.x>=Ze||t.x<0||t.x>=Ze)return!1;const n=t.sub(e),s=n.perp(),c=r.sub(e);return(n.x*c.x+n.y*c.y)/Math.sqrt((n.x*n.x+n.y*n.y)*(c.x*c.x+c.y*c.y))>-.866&&s.x*c.x+s.y*c.y<0}function Ky(r,e,t){const n=e?2|r:-3&r;return t?1|n:-2&n}function Qy(){const r=Math.PI/32,e=Math.tan(r),t=te;return t*Math.sqrt(1+2*e*e)-t}function Jy(r,e,t){const n=1<<t.z,s=le(t.x/n),c=le((t.x+1)/n),h=xe(t.y/n),f=xe((t.y+1)/n);return function(p,g,x,b,w=0,S){const E=[];if(!p.length||!x||!b)return E;const A=(q,ie)=>{for(const X of q)E.push({polygon:X,bounds:ie})},P=Math.ceil(Math.log2(x)),R=Math.ceil(Math.log2(b)),B=P-R,L=[];for(let q=0;q<Math.abs(B);q++)L.push(B>0?0:1);for(let q=0;q<Math.min(P,R);q++)L.push(0),L.push(1);let U=p;if(U=Ep(U,g[0].y-w,g[1].y+w,1),U=Ep(U,g[0].x-w,g[1].x+w,0),!U.length)return E;const G=[];for(L.length?G.push({polygons:U,bounds:g,depth:0}):A(U,g);G.length;){const q=G.pop(),ie=q.depth,X=L[ie],ee=q.bounds[0],Q=q.bounds[1],J=X===0?ee.x:ee.y,ve=X===0?Q.x:Q.y,Te=S?S(X,J,ve):.5*(J+ve),Ie=Ep(q.polygons,J-w,Te+w,X),Ce=Ep(q.polygons,Te-w,ve+w,X);if(Ie.length){const Ee=[ee,new Fe(X===0?Te:Q.x,X===1?Te:Q.y)];L.length>ie+1?G.push({polygons:Ie,bounds:Ee,depth:ie+1}):A(Ie,Ee)}if(Ce.length){const Ee=[new Fe(X===0?Te:ee.x,X===1?Te:ee.y),Q];L.length>ie+1?G.push({polygons:Ce,bounds:Ee,depth:ie+1}):A(Ce,Ee)}}return E}(r,e,Math.ceil((c-s)/11.25),Math.ceil((h-f)/11.25),1,(p,g,x)=>{if(p===0)return .5*(g+x);{const b=xe((t.y+g/Ze)/n);return(Le(.5*(xe((t.y+x/Ze)/n)+b))*n-t.y)*Ze}})}function r1(r,e,t,n,s,c){const h=Math.pow(2,n.z-s.z);for(let f=0;f<t;f++){let p=r.int16[2*(f+e)+0],g=r.int16[2*(f+e)+1];p=(p+s.x*Ze)*h-n.x*Ze,g=(g+s.y*Ze)*h-n.y*Ze,c.push(new Fe(p,g))}}let ex,tx;Qe(Fp,"FillExtrusionBucket",{omit:["layers","features"]}),Qe(O_,"PartData"),Qe($y,"FootprintSegment"),Qe(B_,"BorderCentroidData"),Qe(k_,"GroundEffect");class Wl extends Fe{constructor(e,t,n){super(e,t),this.z=n}}class ix extends Wl{constructor(e,t,n,s){super(e,t,n),this.w=s}}function rx(r,e,t,n){const s=t==="x"?"y":"x",c=(n-r[t])/(e[t]-r[t]);r[s]=Math.round(r[s]+(e[s]-r[s])*c),r[t]=n,r.hasOwnProperty("z")&&(r.z=dt(r.z,e.z,c)),r.hasOwnProperty("w")&&(r.w=dt(r.w,e.w,c))}function nx(r,e,t,n){const s=t,c=n;for(const h of["x","y"]){let f=r,p=e;f[h]>=p[h]&&(f=e,p=r),f[h]<s&&p[h]>s&&rx(f,p,h,s),f[h]<c&&p[h]>c&&rx(p,f,h,c)}}function Op(r,e,t,n,s,c){const h=[];for(let f=0;f<r.length;f++){const p=r[f];let g;const x=h.length;let b=0;for(let w=0;w<p.length-1;w++){let S=p[w],E=p[w+1],A=0;const P=b;let R,B;c&&(A=Math.hypot(E.x-S.x,E.y-S.y),b+=A,R=S,B=E),S.x<e&&E.x<e||(S.x<e?S=new Fe(e,S.y+(e-S.x)/(E.x-S.x)*(E.y-S.y))._round():E.x<e&&(E=new Fe(e,S.y+(e-S.x)/(E.x-S.x)*(E.y-S.y))._round()),S.y<t&&E.y<t||(S.y<t?S=new Fe(S.x+(t-S.y)/(E.y-S.y)*(E.x-S.x),t)._round():E.y<t&&(E=new Fe(S.x+(t-S.y)/(E.y-S.y)*(E.x-S.x),t)._round()),S.x>=n&&E.x>=n||(S.x>=n?S=new Fe(n,S.y+(n-S.x)/(E.x-S.x)*(E.y-S.y))._round():E.x>=n&&(E=new Fe(n,S.y+(n-S.x)/(E.x-S.x)*(E.y-S.y))._round()),S.y>=s&&E.y>=s||(S.y>=s?S=new Fe(S.x+(s-S.y)/(E.y-S.y)*(E.x-S.x),s)._round():E.y>=s&&(E=new Fe(S.x+(s-S.y)/(E.y-S.y)*(E.x-S.x),s)._round()),g&&S.equals(g[g.length-1])||(g=[S],h.push(g),c&&c.push({progress:{min:P+ox(R,B,S)*A,max:1},parentIndex:f,prevPoint:R,nextPoint:B})),g.push(E),c&&(c[c.length-1].progress.max=P+ox(R,B,E)*A,c[c.length-1].nextPoint=B)))))}if(c&&b>0)for(let w=x;w<h.length;w++)c[w].progress.min/=b,c[w].progress.max/=b}return h}function n1(r,e,t,n,s){if(r.length<2)return void n.push(r);const c=[];for(;e.valid();){const[g,x]=e.get();for(let b=0;b<r.length-1;b++){const w=r[b],S=r[b+1],E=La(w,S,g,x);if(E){const[A]=E,P=new Fe(dt(w.x,S.x,A),dt(w.y,S.y,A));c.push({t:b+A,distance:0,point:P})}}e.next()}if(c.length===0)return void n.push(r);c.sort((g,x)=>g.t-x.t);let h=0,f=0,p=[];for(n.push(p);h!==r.length;){if(f===c.length){for(;h!==r.length;)p.length!==0&&p[p.length-1].equals(r[h])||p.push(r[h]),h++;break}c[f].t<=h?(p.length!==0&&p[p.length-1].equals(c[f].point)||p.push(c[f].point),Math.trunc(c[f].t),f++):(p.length!==0&&p[p.length-1].equals(r[h])||p.push(r[h]),h++)}}function ox(r,e,t){return r.x!==e.x?(t.x-r.x)/(e.x-r.x):r.y!==e.y?(t.y-r.y)/(e.y-r.y):0}function Bd(r,e){return r.x*e.x+r.y*e.y}function sx(r,e){if(r.length===1){let t=0;const n=e[t++];let s;for(;!s||n.equals(s);)if(s=e[t++],!s)return 1/0;for(;t<e.length;t++){const c=e[t],h=r[0],f=s.sub(n),p=c.sub(n),g=h.sub(n),x=Bd(f,f),b=Bd(f,p),w=Bd(p,p),S=Bd(g,f),E=Bd(g,p),A=x*w-b*b,P=(w*S-b*E)/A,R=(x*E-b*S)/A,B=n.z*(1-P-R)+s.z*P+c.z*R;if(isFinite(B))return B}return 1/0}{let t=1/0;for(const n of e)t=Math.min(t,n.z);return t}}function ax(r,e,t){let n=1/0;zi(t,e)&&(n=sx(t,e[0]));for(let s=0;s<e.length;s++){const c=e[s],h=r[s];for(let f=0;f<c.length-1;f++){const p=c[f],g=[p,c[f+1],h[f+1],h[f],p];qi(t,g)&&(n=Math.min(n,sx(t,g)))}}return n!==1/0&&n}function lx(r,e,t,n,s,c,h,f,p,g,x){return r.projection.name==="globe"?function(b,w,S,E,A,P,R,B,L,U,G){const q=[],ie=[],X=b.projection.upVectorScale(G,b.center.lat,b.worldSize).metersToTile,ee=[0,0,0,1],Q=[0,0,0,1],J=(Te,Ie,Ce,Ee)=>{Te[0]=Ie,Te[1]=Ce,Te[2]=Ee,Te[3]=1},ve=Qy();S>0&&(S+=ve),E+=ve;for(const Te of w){const Ie=[],Ce=[];for(const Ee of Te){const Oe=Ee.x+A.x,ye=Ee.y+A.y,Ae=b.projection.projectTilePoint(Oe,ye,G),Pe=b.projection.upVector(G,Ee.x,Ee.y);let Be=S,Ue=E;if(R){const Je=cx(Oe,ye,S,E,R,B,L,U);Be+=Je.base,Ue+=Je.top}S!==0?J(ee,Ae.x+Pe[0]*X*Be,Ae.y+Pe[1]*X*Be,Ae.z+Pe[2]*X*Be):J(ee,Ae.x,Ae.y,Ae.z),J(Q,Ae.x+Pe[0]*X*Ue,Ae.y+Pe[1]*X*Ue,Ae.z+Pe[2]*X*Ue),Vi(ee,ee,P),Vi(Q,Q,P),Ie.push(new Wl(ee[0],ee[1],ee[2])),Ce.push(new Wl(Q[0],Q[1],Q[2]))}q.push(Ie),ie.push(Ce)}return[q,ie]}(r,e,t,n,s,c,h,f,p,g,x):h?function(b,w,S,E,A,P,R,B,L){const U=[],G=[],q=[0,0,0,1];for(const ie of b){const X=[],ee=[];for(const Q of ie){const J=Q.x+E.x,ve=Q.y+E.y,Te=cx(J,ve,w,S,P,R,B,L);q[0]=J,q[1]=ve,q[2]=Te.base,q[3]=1,br(q,q,A),q[3]=Math.max(q[3],1e-5);const Ie=new Wl(q[0]/q[3],q[1]/q[3],q[2]/q[3]);q[0]=J,q[1]=ve,q[2]=Te.top,q[3]=1,br(q,q,A),q[3]=Math.max(q[3],1e-5);const Ce=new Wl(q[0]/q[3],q[1]/q[3],q[2]/q[3]);X.push(Ie),ee.push(Ce)}U.push(X),G.push(ee)}return[U,G]}(e,t,n,s,c,h,f,p,g):function(b,w,S,E,A){const P=[],R=[],B=A[8]*w,L=A[9]*w,U=A[10]*w,G=A[11]*w,q=A[8]*S,ie=A[9]*S,X=A[10]*S,ee=A[11]*S;for(const Q of b){const J=[],ve=[];for(const Te of Q){const Ie=Te.x+E.x,Ce=Te.y+E.y,Ee=A[0]*Ie+A[4]*Ce+A[12],Oe=A[1]*Ie+A[5]*Ce+A[13],ye=A[2]*Ie+A[6]*Ce+A[14],Ae=A[3]*Ie+A[7]*Ce+A[15],Pe=Ee+B,Be=Oe+L,Ue=ye+U,Je=Math.max(Ae+G,1e-5),He=Ee+q,qe=Oe+ie,je=ye+X,Ye=Math.max(Ae+ee,1e-5);J.push(new Wl(Pe/Je,Be/Je,Ue/Je)),ve.push(new Wl(He/Ye,qe/Ye,je/Ye))}P.push(J),R.push(ve)}return[P,R]}(e,t,n,s,c)}function cx(r,e,t,n,s,c,h,f){const p=h*s.getElevationAt(r,e,!0,!0),g=c[0]!==0,x=g?c[1]===0?h*(c[0]/7-450):h*function(b,w,S){const E=Math.floor(w[0]/8),A=Math.floor(w[1]/8),P=10*(w[0]-8*E),R=10*(w[1]-8*A),B=b.getElevationAt(E,A,!0,!0),L=b.getMeterToDEM(S),U=Math.floor(.5*(P*L-1)),G=Math.floor(.5*(R*L-1)),q=b.tileCoordToPixel(E,A),ie=2*U+1,X=2*G+1,ee=function(Ce,Ee,Oe,ye,Ae){return[Ce.getElevationAtPixel(Ee,Oe,!0),Ce.getElevationAtPixel(Ee+Ae,Oe,!0),Ce.getElevationAtPixel(Ee,Oe+Ae,!0),Ce.getElevationAtPixel(Ee+ye,Oe+Ae,!0)]}(b,q.x-U,q.y-G,ie,X),Q=Math.abs(ee[0]-ee[1]),J=Math.abs(ee[2]-ee[3]),ve=Math.abs(ee[0]-ee[2])+Math.abs(ee[1]-ee[3]),Te=Math.min(.25,.5*L*(Q+J)/ie),Ie=Math.min(.25,.5*L*ve/X);return B+Math.max(Te*P,Ie*R)}(s,c,f):p;return{base:p+(t===0?-1:t),top:g?Math.max(x+n,p+t+2):p+n}}const N_=4096;class o1{constructor(e){this.module=e,this.memoryStack=this.module.malloc(N_),this.memoryStackNextFree=this.memoryStack}createIntArray(e){const t=this.memoryStackNextFree;return this.memoryStackNextFree+=e.length*Int32Array.BYTES_PER_ELEMENT,this.memoryStackNextFree-this.memoryStack>N_?-1:(new Int32Array(this.module.heap32.buffer,t,e.length).set(e),t)}createFloatArray(e){const t=this.memoryStackNextFree;return this.memoryStackNextFree+=e.length*Float32Array.BYTES_PER_ELEMENT,this.memoryStackNextFree-this.memoryStack>N_?-1:(new Float32Array(this.module.heapF32.buffer,t,e.length).set(e),t)}readStringBuffer(e){let t="";for(;this.module.heapU8[e]!==0;)t+=String.fromCharCode(this.module.heapU8[e]),++e;return t}setStyle(e){const t=e.normalScale;this.module.setStyle(t[0],t[1],t[2],e.tileToMeters)}setAOOptions(e,t){this.module.setAOOptions(e?1:0,t)}setMetricOptions(e,t){this.module.setMetricOptions(e?1:0,t)}setStructuralOptions(e){this.module.setStructuralOptions(e?1:0)}setFacadeOptions(e,t){this.module.setFacadeOptions(e,t?1:0)}setFauxFacadeOptions(e,t,n){this.module.setFauxFacadeOptions(e?1:0,t?1:0,n)}setFacadeClassifierOptions(e){this.module.setFacadeClassifierOptions(e)}generateMesh(e,t){this.memoryStackNextFree=this.memoryStack;for(const f of e){const p=this.createIntArray(f.ringIndices),g=this.createFloatArray(f.coordinates);if(p===-1||g===-1)return`building_gen: Out of stack memory: ${this.memoryStackNextFree-this.memoryStack}/4096`;this.module.addFeature(f.id,f.sourceId,f.minHeight,f.height,f.roofType,g,p,f.ringIndices.length-1)}for(const f of t){let p;p=f.entrances?JSON.parse(f.entrances):[];const g=this.createFloatArray(p),x=this.createFloatArray(f.coordinates);if(g===-1||x===-1)return`building_gen: Out of stack memory: ${this.memoryStackNextFree-this.memoryStack}/4096`;this.module.addFacade(f.sourceId,f.crossPerc,f.distanceToRoad,g,p.length,x,f.coordinates.length)}if(!this.module.generateMesh()){const f=this.module.getLastError();return this.readStringBuffer(f)}const n=this.module.getMeshCount(),s=new Array(n);for(let f=0;f<n;f++){const p=this.module.getPositionsPtr(f),g=this.module.getPositionsLength(f),x=new Float32Array(this.module.heapF32.buffer,p,g),b=this.module.getNormalsPtr(f),w=this.module.getNormalsLength(f),S=new Float32Array(this.module.heapF32.buffer,b,w),E=this.module.getAOPtr(f),A=this.module.getAOLength(f),P=new Float32Array(this.module.heapF32.buffer,E,A),R=this.module.getUVPtr(f),B=this.module.getUVLength(f),L=new Float32Array(this.module.heapF32.buffer,R,B),U=this.module.getFauxFacadePtr(f),G=this.module.getFauxFacadeLength(f),q=new Uint8Array(this.module.heapU8.buffer,U,G),ie=this.module.getIndicesPtr(f),X=this.module.getIndicesLength(f),ee=new Int16Array(this.module.heap16.buffer,ie,X),Q=this.module.getBuildingPart(f);s[f]={positions:x,normals:S,ao:P,uv:L,isFauxFacade:q,indices:ee,buildingPart:Q}}const c=this.module.getRingCount(),h=[];for(let f=0;f<c;f++){const p=this.module.getRingPtr(f),g=this.module.getRingLength(f),x=new Float32Array(this.module.heapF32.buffer,p,g);h.push(x)}return{meshes:s,outerRingLength:this.module.getOuterRingLength(),modifiedPolygonRings:h}}}let kd,Lo=null,U_=null,Bp=null,ux=null,Du=null;function s1(){return Bp}const hx=5120,dx=5121,fx=5122,px=5123,mx=5125,_x=5126,kp={[hx]:Int8Array,[dx]:Uint8Array,[fx]:Int16Array,[px]:Uint16Array,[mx]:Uint32Array,[_x]:Float32Array},a1={[hx]:"DT_INT8",[dx]:"DT_UINT8",[fx]:"DT_INT16",[px]:"DT_UINT16",[mx]:"DT_UINT32",[_x]:"DT_FLOAT32"},Vd={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16};function gx(r,e,t){const n=t.json.bufferViews.length,s=t.buffers.length;e.bufferView=n,t.json.bufferViews[n]={buffer:s,byteLength:r.byteLength},t.buffers[s]=r}const j_="KHR_draco_mesh_compression";function l1(r,e){const t=r.extensions&&r.extensions[j_];if(!t)return;const n=new Lo.Decoder,s=bx(e,t.bufferView),c=new Lo.Mesh;if(!n.DecodeArrayToMesh(s,s.byteLength,c))throw new Error("Failed to decode Draco mesh");const h=e.json.accessors[r.indices],f=kp[h.componentType],p=h.count*f.BYTES_PER_ELEMENT,g=Lo._malloc(p);f===Uint16Array?n.GetTrianglesUInt16Array(c,p,g):n.GetTrianglesUInt32Array(c,p,g),gx(Lo.memory.buffer.slice(g,g+p),h,e),Lo._free(g);for(const x of Object.keys(t.attributes)){const b=n.GetAttributeByUniqueId(c,t.attributes[x]),w=e.json.accessors[r.attributes[x]],S=a1[w.componentType],E=w.count*Vd[w.type]*kp[w.componentType].BYTES_PER_ELEMENT,A=Lo._malloc(E);n.GetAttributeDataArrayForAllPoints(c,b,Lo[S],E,A),gx(Lo.memory.buffer.slice(A,A+E),w,e),Lo._free(A)}n.destroy(),c.destroy(),delete r.extensions[j_]}const Vp="EXT_meshopt_compression";function c1(r,e){if(!r.extensions||!r.extensions[Vp])return;const t=r.extensions[Vp],n=new Uint8Array(e.buffers[t.buffer],t.byteOffset||0,t.byteLength||0),s=new Uint8Array(t.count*t.byteStride);U_.decodeGltfBuffer(s,t.count,t.byteStride,n,t.mode,t.filter),r.buffer=e.buffers.length,r.byteOffset=0,e.buffers[r.buffer]=s.buffer,delete r.extensions[Vp]}const yx=1179937895,xx=new TextDecoder("utf8");function vx(r,e){return new URL(r,e).href}async function u1(r,e,t,n,s){const c=await fetch(vx(r.uri,n),{signal:s}),h=await c.arrayBuffer();e.buffers[t]=h}function bx(r,e){const t=r.json.bufferViews[e];return new Uint8Array(r.buffers[t.buffer],t.byteOffset||0,t.byteLength)}async function h1(r,e,t,n,s){if(r.uri){const c=vx(r.uri,n),h=await fetch(c,{signal:s}),f=await h.blob(),p=await createImageBitmap(f);e.images[t]=p}else if(r.bufferView!==void 0){const c=bx(e,r.bufferView),h=new Blob([c],{type:r.mimeType}),f=await createImageBitmap(h);e.images[t]=f}}async function wx(r,e=0,t,n){const s={json:null,images:[],buffers:[]};if(new Uint32Array(r,e,1)[0]===yx){const S=new Uint32Array(r,e);let E=2;const A=(S[E++]>>2)-3,P=S[E++]>>2;if(E++,s.json=JSON.parse(xx.decode(S.subarray(E,E+P))),E+=P,E<A){const R=S[E++];E++;const B=e+(E<<2);s.buffers[0]=r.slice(B,B+R)}}else s.json=JSON.parse(xx.decode(new Uint8Array(r,e)));const{buffers:c,images:h,meshes:f,extensionsUsed:p,bufferViews:g}=s.json;if(c){const S=[];for(let E=0;E<c.length;E++){const A=c[E];A.uri?S.push(u1(A,s,E,t,n)):s.buffers[E]||(s.buffers[E]=null)}await Promise.all(S)}if(n&&n.aborted)throw new DOMException("Aborted","AbortError");const x=[],b=p&&p.includes(j_),w=p&&p.includes(Vp);if(b&&x.push(function(){if(!Lo)return kd??(kd=function(S){let E,A=null;function P(){E=new Uint8Array(A.buffer)}function R(){throw new Error("Unexpected Draco error.")}const B={a:{a:R,d:function(L,U,G){return E.copyWithin(L,U,U+G)},c:function(L){const U=E.length,G=Math.max(L>>>0,Math.ceil(1.2*U)),q=Math.ceil((G-U)/65536);try{return A.grow(q),P(),!0}catch{return!1}},b:R}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(S,B):S.then(L=>L.arrayBuffer()).then(L=>WebAssembly.instantiate(L,B))).then(L=>{const{Rb:U,Qb:G,P:q,T:ie,X,Ja:ee,La:Q,Qa:J,Va:ve,Wa:Te,eb:Ie,jb:Ce,f:Ee,e:Oe,yb:ye,zb:Ae,Ab:Pe,Bb:Be,Db:Ue,Gb
7:Je}=L.instance.exports;A=Oe;const He=(()=>{let qe=0,je=0,Ye=0,it=0;return ht=>{Ye&&(U(it),U(qe),je+=Ye,Ye=qe=0),qe||(je+=128,qe=G(je));const nt=ht.length+7&-8;let wt=qe;nt>=je&&(Ye=nt,wt=it=G(nt));for(let Ft=0;Ft<ht.length;Ft++)E[wt+Ft]=ht[Ft];return wt}})();return P(),Ee(),{memory:Oe,_free:U,_malloc:G,Mesh:class{constructor(){this.ptr=q()}destroy(){ie(this.ptr)}},Decoder:class{constructor(){this.ptr=ee()}destroy(){Ce(this.ptr)}DecodeArrayToMesh(qe,je,Ye){const it=He(qe),ht=Q(this.ptr,it,je,Ye.ptr);return!!X(ht)}GetAttributeByUniqueId(qe,je){return{ptr:J(this.ptr,qe.ptr,je)}}GetTrianglesUInt16Array(qe,je,Ye){ve(this.ptr,qe.ptr,je,Ye)}GetTrianglesUInt32Array(qe,je,Ye){Te(this.ptr,qe.ptr,je,Ye)}GetAttributeDataArrayForAllPoints(qe,je,Ye,it,ht){Ie(this.ptr,qe.ptr,je.ptr,Ye,it,ht)}},DT_INT8:ye(),DT_UINT8:Ae(),DT_INT16:Pe(),DT_UINT16:Be(),DT_UINT32:Ue(),DT_FLOAT32:Je()}})}(fetch(wr())),kd.then(S=>{Lo=S,kd=void 0}))}()),w&&x.push(function(){if(U_)return;const S=function(E){let A;const P=WebAssembly.instantiateStreaming(E,{}).then(L=>{A=L.instance,A.exports.__wasm_call_ctors()}),R={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},B={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};return{ready:P,supported:!0,decodeGltfBuffer(L,U,G,q,ie,X){(function(ee,Q,J,ve,Te,Ie,Ce){const Ee=ee.exports.sbrk,Oe=ve+3&-4,ye=Ee(Oe*Te),Ae=Ee(Ie.length),Pe=new Uint8Array(ee.exports.memory.buffer);Pe.set(Ie,Ae);const Be=Q(ye,ve,Te,Ae,Ie.length);if(Be===0&&Ce&&Ce(ye,Oe,Te),J.set(Pe.subarray(ye,ye+ve*Te)),Ee(ye-Ee(0)),Be!==0)throw new Error(`Malformed buffer data: ${Be}`)})(A,A.exports[B[ie]],L,U,G,q,A.exports[R[X]])}}}(fetch(Tr()));return S.ready.then(()=>{U_=S})}()),h)for(let S=0;S<h.length;S++)x.push(h1(h[S],s,S,t,n));if(x.length&&await Promise.all(x),n&&n.aborted)throw new DOMException("Aborted","AbortError");if(b&&f)for(const{primitives:S}of f)for(const E of S)l1(E,s);if(w&&f&&g)for(const S of g)c1(S,s);return s}async function Tx(r,e){const t=await async function(n,s){if(s&&s.aborted)throw new DOMException("Aborted","AbortError");return new Promise((c,h)=>{const f=ta(n,(p,g)=>{p?h(p):c(g)});s&&s.addEventListener("abort",()=>{f.cancel(),h(new DOMException("Aborted","AbortError"))},{once:!0})})}({url:r,type:"arrayBuffer"},e);return wx(t,0,r,e)}function G_(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 q_(r){switch(r){case WebGL2RenderingContext.RGBA8:return WebGL2RenderingContext.UNSIGNED_BYTE;case WebGL2RenderingContext.RGBA16F:return WebGL2RenderingContext.HALF_FLOAT;case WebGL2RenderingContext.DEPTH_COMPONENT16:return WebGL2RenderingContext.UNSIGNED_SHORT;case WebGL2RenderingContext.DEPTH24_STENCIL8:return WebGL2RenderingContext.UNSIGNED_INT_24_8;case WebGL2RenderingContext.R8:return WebGL2RenderingContext.UNSIGNED_BYTE;case WebGL2RenderingContext.R32F:return WebGL2RenderingContext.FLOAT}}class hs{constructor(e,t,n,s){this.context=e,this.format=n,this.useMipmap=s&&s.useMipmap,this.texture=e.gl.createTexture(),this.update(t,{premultiply:s&&s.premultiply})}update(e,t){const n=e&&e instanceof HTMLVideoElement&&e.width===0?e.videoWidth:e.width,s=e&&e instanceof HTMLVideoElement&&e.height===0?e.videoHeight:e.height,{context:c}=this,{gl:h}=c,{x:f,y:p}=t&&t.position?t.position:{x:0,y:0},g=f+n,x=p+s;this.size&&(this.size[0]!==g||this.size[1]!==x)&&(!t||t.recreateWhenResize===void 0||t.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&&(!t||t.premultiply!==!1));const b=e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||ImageBitmap&&e instanceof ImageBitmap;if(!this.size&&g>0&&x>0){const w=this.useMipmap?Math.floor(Math.log2(Math.max(g,x)))+1:1;h.texStorage2D(h.TEXTURE_2D,w,this.format,g,x),this.size=[g,x]}this.size&&(b?h.texSubImage2D(h.TEXTURE_2D,0,f,p,G_(this.format),q_(this.format),e):"data"in e&&e.data&&h.texSubImage2D(h.TEXTURE_2D,0,f,p,n,s,G_(this.format),q_(this.format),e.data)),this.useMipmap&&h.generateMipmap(h.TEXTURE_2D)}bind(e,t,n=!1){const{context:s}=this,{gl:c}=s;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&&!n?e===c.NEAREST?c.NEAREST_MIPMAP_NEAREST:c.LINEAR_MIPMAP_LINEAR:e),this.minFilter=e),t!==this.wrapS&&(c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,t),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,t),this.wrapS=t)}bindExtraParam(e,t,n,s,c){const{context:h}=this,{gl:f}=h;f.bindTexture(f.TEXTURE_2D,this.texture),t!==this.magFilter&&(f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MAG_FILTER,t),this.magFilter=t),e!==this.minFilter&&(f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MIN_FILTER,this.useMipmap?e===f.NEAREST?f.NEAREST_MIPMAP_NEAREST:f.LINEAR_MIPMAP_LINEAR:e),this.minFilter=e),n!==this.wrapS&&(f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_S,n),this.wrapS=n),s!==this.wrapT&&(f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_T,s),this.wrapT=s),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 Nd{constructor(e,t){this.context=e,this.texture=t}bind(e,t){const{context:n}=this,{gl:s}=n;s.bindTexture(s.TEXTURE_2D,this.texture),e!==this.minFilter&&(s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,e),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,e),this.minFilter=e),t!==this.wrapS&&(s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,t),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,t),this.wrapS=t)}}const d1=zt([{name:"a_pos_3f",components:3,type:"Float32"}]),f1=zt([{name:"a_color_3f",components:3,type:"Float32"}]),p1=zt([{name:"a_color_4f",components:4,type:"Float32"}]),m1=zt([{name:"a_uv_2f",components:2,type:"Float32"}]),_1=zt([{name:"a_normal_3f",components:3,type:"Float32"}]),g1=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"}]),y1=zt([{name:"a_pbr",components:4,type:"Uint16"},{name:"a_heightBasedEmissiveStrength",components:3,type:"Float32"}]);function Sx(r,e){const t=Np(r.projection,r.zoom,r.width,r.height),n=function(c,h,f,p,g){const x=new se(f.lng-180*Na,f.lat),b=new se(f.lng+180*Na,f.lat),w=c.project(x.lng,x.lat),S=c.project(b.lng,b.lat),E=-Math.atan2(S.y-w.y,S.x-w.x),A=tt.fromLngLat(f);A.y=k(A.y,-1+Na,1-Na);const P=A.toLngLat(),R=c.project(P.lng,P.lat),B=tt.fromLngLat(P);B.x+=Na;const L=B.toLngLat(),U=c.project(L.lng,L.lat),G=Ex(U.x-R.x,U.y-R.y,E),q=tt.fromLngLat(P);q.y+=Na;const ie=q.toLngLat(),X=c.project(ie.lng,ie.lat),ee=Ex(X.x-R.x,X.y-R.y,E),Q=Math.abs(G.x)/Math.abs(ee.y),J=Ei([]);vo(J,J,-E*(1-(g?0:p)));const ve=Ei([]);return Mr(ve,ve,[1,1-(1-Q)*p,1]),ve[4]=-ee.x/ee.y*p,vo(ve,ve,E),Ti(ve,J,ve),ve}
vendor: 6,979 bytes, line 7
7(r.projection,0,r.center,t,e),s=Ix(r);return Mr(n,n,[s,s,1]),n}function Ix(r){const e=r.projection,t=Np(r.projection,r.zoom,r.width,r.height),n=$_(e,r.center),s=$_(e,se.convert(e.center));return Math.pow(2,n*t+(1-t)*s)}function Np(r,e,t,n,s=1/0){const c=r.range;if(!c)return 0;const h=Math.min(s,Math.max(t,n)),f=Math.log2(h/1024);return W(c[0]+f,c[1]+f,e)}const Na=1/4e4;function $_(r,e){const t=k(e.lat,-85.051129,Se),n=new se(e.lng-180*Na,t),s=new se(e.lng+180*Na,t),c=r.project(n.lng,t),h=r.project(s.lng,t),f=tt.fromLngLat(n),p=tt.fromLngLat(s),g=h.x-c.x,x=h.y-c.y,b=p.x-f.x,w=p.y-f.y,S=Math.sqrt((b*b+w*w)/(g*g+x*x));return Math.log2(S)}function Ex(r,e,t){const n=Math.cos(t),s=Math.sin(t);return{x:r*n-e*s,y:r*s+e*n}}function Ax(r,e,t){Ei(r),vo(r,r,Vt(e[2])),xo(r,r,Vt(e[0])),Nn(r,r,Vt(e[1])),Mr(r,r,t),Ti(r,r,[1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,1])}function Up(r,e,t,n,s,c,h,f){const p=[t[0]-e[0],t[1]-e[1],0],g=[n[0]-e[0],n[1]-e[1],0];if(Jr(p)<1e-12||Jr(g)<1e-12)return jo(r);const x=dr([],p,g);xi(x,x),jn(g,n,e),p[2]=(c-s)*f,g[2]=(h-s)*f;const b=p;return dr(b,p,g),xi(b,b),Ka(r,x,b)}function jp(r,e,t=!1){const n=Gs(e.zoom),s=function(c,h,f){const p=h.worldSize,g=[c[12],c[13],c[14]],x=xe(g[1]/p),b=le(g[0]/p),w=Ei([]),S=fe(1,x)*p,E=fe(1,0)*p*Ve(x,h.zoom),A=1/__(p);let P=E*A;if(f){const U=Np(h.projection,h.zoom,h.width,h.height,1024);P=A*h.projection.pixelSpaceConversion(h.center.lat,p,U)}const R=K(x,b);er(R,R,yi([],xi([],R),S*P*g[2]));const B=function(U){const G=[U[0],U[1],U[2]];let q=[0,1,0];const ie=dr([],q,G);return dr(q,G,ie),uc(q)===0&&(q=[0,1,0],dr(ie,G,q)),xi(ie,ie),xi(q,q),xi(G,G),[ie[0],ie[1],ie[2],0,q[0],q[1],q[2],0,G[0],G[1],G[2],0,U[0],U[1],U[2],1]}(R);Mr(w,w,[P,P,P*S]),Qr(w,w,[-g[0],-g[1],-g[2]]);const L=Ti([],h.globeMatrix,B);return Ti(L,L,w),Ti(L,L,c),L}(r,e,t);if(n>0){const c=function(h,f){const p=f.worldSize,g=fe(1,0)*p*Ve(f.center.lat,f.zoom)/__(p),x=fe(1,f.center.lat)*p,b=Ei([]);Nn(b,b,Vt(f.center.lng)),xo(b,b,Vt(f.center.lat)),Qr(b,b,[0,0,H]),Mr(b,b,[g,g,g*x]);const w=f.point;return Qr(b,b,[-w.x,-w.y,0]),Ti(b,b,h),Ti(b,f.globeMatrix,b)}(r,e);return function(h,f,p){const g=(E,A,P)=>{const R=Jr(E),B=Jr(A),L=js(E,A,P);return yi(L,L,1/Jr(L)*dt(R,B,P))},x=g([h[0],h[1],h[2]],[f[0],f[1],f[2]],p),b=g([h[4],h[5],h[6]],[f[4],f[5],f[6]],p),w=g([h[8],h[9],h[10]],[f[8],f[9],f[10]],p),S=js([h[12],h[13],h[14]],[f[12],f[13],f[14]],p);return[x[0],x[1],x[2],0,b[0],b[1],b[2],0,w[0],w[1],w[2],0,S[0],S[1],S[2],1]}(s,c,n)}return s}function H_(r,e,t,n){const s=Xt.projectAabbCorners(n,t);let c=Number.MAX_VALUE;for(let f=0;f<s.length;++f){const p=s[f];p[0]=(.5*p[0]+.5)*e.width,p[1]=(.5-.5*p[1])*e.height,p[2]<c&&(c=p[2])}const h=function(f){const p=[];let g=0;for(let S=1;S<f.length;S++)(f[S][0]<f[g][0]||f[S][0]===f[g][0]&&f[S][1]<f[g][1])&&(g=S);let x,b=g;const w=new Uint8Array(f.length);do{if(w[b])break;p.push(new Fe(f[b][0],f[b][1])),w[b]=1,x=(b+1)%f.length;for(let S=0;S<f.length;S++){if(f[S][0]===f[x][0]&&f[S][1]===f[x][1]||f[S][0]===f[b][0]&&f[S][1]===f[b][1])continue;const E=[f[S][0]-f[b][0],f[S][1]-f[b][1]],A=[f[x][0]-f[b][0],f[x][1]-f[b][1]],P=E[0]*A[1]-E[1]*A[0];(P>0||P===0&&E[0]*A[0]+E[1]*A[1]>=0&&E[0]*E[0]+E[1]*E[1]>A[0]*A[0]+A[1]*A[1])&&(x=S)}b=x}while(b!==g);return p.length>0&&p.push(p[0]),p}(s);if(qi(r,h))return c}const Xl=64,Ru={CoordinateSpaceTile:1,HasMapboxMeshFeatures:4,HasMeshoptCompression:8};function Gp(r,e,t,n,s,c,h,f,p,g=!1){const x=t.zoom,b=t.project(n),w=Ve(n.lat,x),S=1/w;Ei(r),Qr(r,r,[b.x+h[0]*S,b.y+h[1]*S,h[2]]);let E=1,A=1;const P=t.worldSize;if(g){if(t.projection.name==="mercator"){let U=0;t.elevation&&(U=t.elevation.getAtPointOrZero(new tt(b.x/P,b.y/P),0));const G=br([],[b.x,b.y,U,1],t.projMatrix)[3]/t.cameraToCenterDistance;E=G,A=G*Ve(t.center.lat,x)}else if(t.projection.name==="globe"){const U=jp(r,t),G=[0,0,0,1];br(G,G,Ti([],t.projMatrix,U));const q=G[3]/t.cameraToCenterDistance,ie=Gs(x),X=t.projection.pixelsPerMeter(n.lat,P)*Ve(n.lat,x),ee=t.projection.pixelsPerMeter(t.center.lat,P)*Ve(t.center.lat,x);E=q/dt(X,$e(t.center.lat),ie),A=q*w/X,E*=ee,A*=ee}}else E=S;Mr(r,r,[E,E,A]);const R=[...r],B=e.orientation,L=[];if(Ax(L,[B[0]+(s?s[0]:0),B[1]+(s?s[1]:0),B[2]+(s?s[2]:0)],c),Ti(r,R,L),f&&t.elevation){let U=0;const G=[];if(p&&t.elevation){U=function(ie,X,ee,Q,J){const ve=X.elevation;if(!ve)return 0;const Te=Xt.projectAabbCorners(ee,Q),Ie=fe(1,J.lat)*X.worldSize,Ce=function(je,Ye){const it=[0,0,1],ht=[{corners:[0,1,3,2],dotProductWithUp:0},{corners:[1,5,2,6],dotProductWithUp:0},{corners:[0,4,1,5],dotProductWithUp:0},{corners:[2,6,3,7],dotProductWithUp:0},{corners:[4,7,5,6],dotProductWithUp:0},{corners:[0,3,4,7],dotProductWithUp:0}];for(const nt of ht){const wt=je[nt.corners[0]],Ft=je[nt.corners[1]],Tt=je[nt.corners[2]],Bt=[Ft[0]-wt[0],Ft[1]-wt[1],Ye*(Ft[2]-wt[2])],Mt=dr(Bt,Bt,[Tt[0]-wt[0],Tt[1]-wt[1],Ye*(Tt[2]-wt[2])]);xi(Mt,Mt),nt.dotProductWithUp=ki(Mt,it)}return ht.sort((nt,wt)=>nt.dotProductWithUp-wt.dotProductWithUp),ht[0].corners}(Te,Ie),Ee=Te[Ce[0]],Oe=Te[Ce[1]],ye=Te[Ce[2]],Ae=Te[Ce[3]],Pe=ve.getAtPointOrZero(new tt(Ee[0]/X.worldSize,Ee[1]/X.worldSize),0),Be=ve.getAtPointOrZero(new tt(Oe[0]/X.worldSize,Oe[1]/X.worldSize),0),Ue=ve.getAtPointOrZero(new tt(ye[0]/X.worldSize,ye[1]/X.worldSize),0),Je=ve.getAtPointOrZero(new tt(Ae[0]/X.worldSize,Ae[1]/X.worldSize),0),He=(Pe+Je)/2,qe=(Be+Ue)/2;return He>qe?Be<Ue?Up(ie,Oe,Ae,Ee,Be,Je,Pe,Ie):Up(ie,ye,Ee,Ae,Ue,Pe,Je,Ie):Pe<Je?Up(ie,Ee,Oe,ye,Pe,Be,Ue,Ie):Up(ie,Ae,ye,Oe,Je,Ue,Be,Ie),Math.max(He,qe)}(G,t,e.aabb,r,n);const q=Ti([],Za([],G),L);Ti(r,R,q)}else U=t.elevation.getAtPointOrZero(new tt(b.x/P,b.y/P),0);U!==0&&(r[14]+=U)}}class Cx{constructor(e,t,n,s,c){this.materialOverrides=new Map,this.nodeOverrides=new Map,this.materialOverrideNames=[],this.nodeOverrideNames=[],this.featureProperties={},this.id=e,this.uri=t,this.position=n!=null?new se(n[0],n[1]):new se(0,0),this.orientation=s??[0,0,0],this.nodes=c,this.uploaded=!1,this.aabb=new Xt([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),this.matrix=[]}_applyTransformations(e,t){Ti(e.globalMatrix,t,e.localMatrix);const n=this.nodeOverrides.get(e.name);if(n!==void 0){const h=[];c=n.orientation,Ei(s=h),Nn(s,s,Vt(c[1])),vo(s,s,Vt(c[2])),xo(s,s,Vt(c[0])),Ti(e.globalMatrix,e.globalMatrix,h)}var s,c;if(e.meshes)for(const h of e.meshes){const f=Xt.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=Ei([]);this.aabb=new Xt([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);for(const t of this.nodes)this._applyTransformations(t,e)}computeModelMatrix(e,t,n,s,c,h,f=!1){Gp(this.matrix,this,e.transform,this.position,t,n,s,c,h,f)}upload(e){if(!this.uploaded){for(const t of this.nodes)Z_(t,e);for(const t of this.nodes)qp(t);this.uploaded=!0}}destroy(){for(const e of this.nodes)W_(e)}}function Ud(r,e,t=!1){r.uploaded||(r.gfxTexture=new hs(e,r.image,t?e.gl.R8:e.gl.RGBA8,{useMipmap:r.sampler.minFilter>=e.gl.NEAREST_MIPMAP_NEAREST}),r.uploaded=!0,r.image=null)}
7function x1(r,e,t){r.indexBuffer=e.createIndexBuffer(r.indexArray,!1,!0),r.vertexBuffer=e.createVertexBuffer(r.vertexArray,d1.members,!1,!0),r.normalArray&&(r.normalBuffer=e.createVertexBuffer(r.normalArray,_1.members,!1,!0)),r.texcoordArray&&(r.texcoordBuffer=e.createVertexBuffer(r.texcoordArray,m1.members,!1,!0)),r.colorArray&&(r.colorBuffer=e.createVertexBuffer(r.colorArray,(r.colorArray.bytesPerElement===12?f1:p1).members,!1,!0)),r.featureArray&&(r.pbrBuffer=e.createVertexBuffer(r.featureArray,y1.members,!0)),r.segments=oi.simpleSegment(0,0,r.vertexArray.length,r.indexArray.length);const n=r.material;n.pbrMetallicRoughness.baseColorTexture&&Ud(n.pbrMetallicRoughness.baseColorTexture,e),n.pbrMetallicRoughness.metallicRoughnessTexture&&Ud(n.pbrMetallicRoughness.metallicRoughnessTexture,e),n.normalTexture&&Ud(n.normalTexture,e),n.occlusionTexture&&Ud(n.occlusionTexture,e,t),n.emissionTexture&&Ud(n.emissionTexture,e)}function Z_(r,e,t){if(r.meshes)for(const n of r.meshes)x1(n,e,t);if(r.children)for(const n of r.children)Z_(n,e,t)}function qp(r){if(r.meshes)for(const e of r.meshes)e.indexArray.destroy(),e.vertexArray.destroy(),e.colorArray&&e.colorArray.destroy(),e.normalArray&&e.normalArray.destroy(),e.texcoordArray&&e.texcoordArray.destroy(),e.featureArray&&e.featureArray.destroy();if(r.children)for(const e of r.children)qp(e)}function v1(r){r.pbrMetallicRoughness.baseColorTexture&&r.pbrMetallicRoughness.baseColorTexture.gfxTexture&&r.pbrMetallicRoughness.baseColorTexture.gfxTexture.destroy(),r.pbrMetallicRoughness.metallicRoughnessTexture&&r.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture&&r.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture.destroy(),r.normalTexture&&r.normalTexture.gfxTexture&&r.normalTexture.gfxTexture.destroy(),r.emissionTexture&&r.emissionTexture.gfxTexture&&r.emissionTexture.gfxTexture.destroy(),r.occlusionTexture&&r.occlusionTexture.gfxTexture&&r.occlusionTexture.gfxTexture.destroy()}function W_(r){if(r.meshes)for(const e of r.meshes)e.vertexBuffer&&(e.vertexBuffer.destroy(),e.indexBuffer.destroy(),e.normalBuffer&&e.normalBuffer.destroy(),e.texcoordBuffer&&e.texcoordBuffer.destroy(),e.colorBuffer&&e.colorBuffer.destroy(),e.pbrBuffer&&e.pbrBuffer.destroy(),e.segments.destroy(),e.material&&v1(e.material));if(r.footprintDebugMesh&&(r.footprintDebugMesh.vertexBuffer.destroy(),r.footprintDebugMesh.indexBuffer.destroy(),r.footprintDebugMesh.segments.destroy()),r.children)for(const e of r.children)W_(e)}function Yl(r,e){const t=r.json.bufferViews[e.bufferView],n=kp[e.componentType];return new n(r.buffers[t.buffer],(e.byteOffset||0)+(t.byteOffset||0),e.count*(t.byteStride&&t.byteStride!==Vd[e.type]*n.BYTES_PER_ELEMENT?t.byteStride/n.BYTES_PER_ELEMENT:Vd[e.type]))}function X_(r,e,t,n){const s=kp[e.componentType],c=function(x){switch(x){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:return 1}}(s),h=r.json.bufferViews[e.bufferView],f=h.byteStride?h.byteStride/s.BYTES_PER_ELEMENT:Vd[e.type],p=t.float32,g=p.length/t.capacity;for(let x=0,b=0;x<e.count*f;x+=f,b+=g)for(let w=0;w<g;w++)p[b+w]=n[x+w]*c;t._trim()}function b1(r,e,t){const n=r.indices,s=r.attributes,c={};c.indexArray=new Ni;const h=e.json.accessors[n],f=h.count/3;c.indexArray.reserve(f);const p=Yl(e,h);for(let w=0;w<f;w++)c.indexArray.emplaceBack(p[3*w],p[3*w+1],p[3*w+2]);c.indexArray._trim(),c.vertexArray=new Fn;const g=e.json.accessors[s.POSITION];c.vertexArray.reserve(g.count);const x=Yl(e,g);for(let w=0;w<g.count;w++)c.vertexArray.emplaceBack(x[3*w],x[3*w+1],x[3*w+2]);if(c.vertexArray._trim(),c.aabb=new Xt(g.min,g.max),c.centroid=function(w,S){const E=[0,0,0],A=w.length;if(A>0){for(let P=0;P<A;P++){const R=3*w[P];E[0]+=S[R],E[1]+=S[R+1],E[2]+=S[R+2]}E[0]/=A,E[1]/=A,E[2]/=A}return E}(p,x),s.COLOR_0!==void 0){const w=e.json.accessors[s.COLOR_0],S=Vd[w.type],E=Yl(e,w);c.colorArray=S===3?new Fn:new Ro,c.colorArray.resize(w.count),X_(e,w,c.colorArray,E)}if(s.NORMAL!==void 0){c.normalArray=new Fn;const w=e.json.accessors[s.NORMAL];c.normalArray.resize(w.count);const S=Yl(e,w);X_(e,w,c.normalArray,S)}if(s.TEXCOORD_0!==void 0&&t.length>0){c.texcoordArray=new ks;const w=e.json.accessors[s.TEXCOORD_0];c.texcoordArray.resize(w.count);const S=Yl(e,w);X_(e,w,c.texcoordArray,S)}if(s._FEATURE_ID_RGBA4444!==void 0){const w=e.json.accessors[s._FEATURE_ID_RGBA4444];e.json.extensionsUsed&&e.json.extensionsUsed.includes("EXT_meshopt_compression")&&(c.featureData=Yl(e,w))}s._FEATURE_RGBA4444!==void 0&&(c.featureData=new Uint32Array(Yl(e,e.json.accessors[s._FEATURE_RGBA4444]).buffer));const b=r.material;return c.material=function(w,S){const{emissiveFactor:E=[0,0,0],alphaMode:A="OPAQUE",alphaCutoff:P=.5,normalTexture:R,occlusionTexture:B,emissiveTexture:L,doubleSided:U,name:G}=w,{baseColorFactor:q=[1,1,1,1],metallicFactor:ie=1,roughnessFactor:X=1,baseColorTexture:ee,metallicRoughnessTexture:Q}=w.pbrMetallicRoughness||{},J=B?S[B.index]:void 0;if(B&&B.extensions&&B.extensions.KHR_texture_transform&&J){const ve=B.extensions.KHR_texture_transform;J.offsetScale=[ve.offset[0],ve.offset[1],ve.scale[0],ve.scale[1]]}return{name:G,pbrMetallicRoughness:{baseColorFactor:new jt(...q),metallicFactor:ie,roughnessFactor:X,baseColorTexture:ee?S[ee.
vendor: 54,765 bytes, line 7
7index]:void 0,metallicRoughnessTexture:Q?S[Q.index]:void 0},doubleSided:U,emissiveFactor:new jt(...E),alphaMode:A,alphaCutoff:P,normalTexture:R?S[R.index]:void 0,occlusionTexture:J,emissionTexture:L?S[L.index]:void 0,defined:w.defined===void 0}}(b!==void 0?e.json.materials[b]:{defined:!1},t),c}function Mx(r,e,t){const{matrix:n,rotation:s,translation:c,scale:h,mesh:f,extras:p,children:g,name:x}=r,b={};if(b.name=x,b.localMatrix=n||function(w,S,E,A){var P=S[0],R=S[1],B=S[2],L=S[3],U=P+P,G=R+R,q=B+B,ie=P*U,X=P*G,ee=P*q,Q=R*G,J=R*q,ve=B*q,Te=L*U,Ie=L*G,Ce=L*q,Ee=A[0],Oe=A[1],ye=A[2];return w[0]=(1-(Q+ve))*Ee,w[1]=(X+Ce)*Ee,w[2]=(ee-Ie)*Ee,w[3]=0,w[4]=(X-Ce)*Oe,w[5]=(1-(ie+ve))*Oe,w[6]=(J+Te)*Oe,w[7]=0,w[8]=(ee+Ie)*ye,w[9]=(J-Te)*ye,w[10]=(1-(ie+Q))*ye,w[11]=0,w[12]=E[0],w[13]=E[1],w[14]=E[2],w[15]=1,w}([],s||[0,0,0,1],c||[0,0,0],h||[1,1,1]),b.globalMatrix=Jt(b.localMatrix),f!==void 0){b.meshes=t[f];const w=b.anchor=[0,0];for(const S of b.meshes){const{min:E,max:A}=S.aabb;w[0]+=E[0]+A[0],w[1]+=E[1]+A[1]}w[0]=Math.floor(w[0]/b.meshes.length/2),w[1]=Math.floor(w[1]/b.meshes.length/2)}if(p&&(p.id&&(b.id=p.id),p.lights&&(b.lights=function(w){if(!w.length)return[];const S=function(B){const L=atob(B),U=new Uint8Array(L.length);for(let G=0;G<L.length;G++)U[G]=L.codePointAt(G);return U}(w),E=[],A=S.length/24,P=new Uint16Array(S.buffer),R=new Float32Array(S.buffer);for(let B=0;B<A;B++){const L=P[2*B*6]/30,U=P[2*B*6+1]/30,G=P[2*B*6+10]/100,q=R[6*B+1],ie=R[6*B+2],X=R[6*B+3],ee=R[6*B+4],Q=X-q,J=ee-ie,ve=Math.hypot(Q,J);E.push({pos:[q+.5*Q,ie+.5*J,U],normal:[J/ve,-Q/ve,0],width:ve,height:L,depth:G,points:[q,ie,X,ee]})}return E}(p.lights)),p.MAPBOX_geometry_bloom&&(b.isGeometryBloom=p.MAPBOX_geometry_bloom)),g){const w=[];for(const S of g)w.push(Mx(e.json.nodes[S],e,t));b.children=w}return b}function w1(r){if(r.vertices.length===0||r.indices.length===0)return null;const e=new Cp(r.vertices,r.indices,8,256),[t,n]=[e.min.clone(),e.max.clone()];return{vertices:r.vertices,indices:r.indices,grid:e,min:t,max:n}}function T1(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 t=e[0];if(!t||!Array.isArray(t)||t.length===0)return null;const n=[];for(const h of t){if(!Array.isArray(h)||h.length!==2)continue;const f=h[0],p=h[1];typeof f=="number"&&typeof p=="number"&&n.push(new Fe(f,p))}if(n.length<3)return null;n.length>1&&n[n.length-1].equals(n[0])&&n.pop();let s=0;for(let h=0;h<n.length;h++){const f=n[h],p=n[(h+1)%n.length],g=n[(h+2)%n.length];s+=(f.x-p.x)*(g.y-p.y)-(g.x-p.x)*(f.y-p.y)}s>0&&n.reverse();const c=Au(n.flatMap(h=>[h.x,h.y]),[]);return c.length===0?null:{vertices:n,indices:c}}function S1(r,e){const t=[],n=[];let s=0;const c=[];for(const h of r){s=t.length;const f=h.vertexArray.float32,p=h.indexArray.uint16;for(let g=0;g<h.vertexArray.length;g++)c[0]=f[3*g+0],c[1]=f[3*g+1],c[2]=f[3*g+2],Vi(c,c,e),t.push(new Fe(c[0],c[1]));for(let g=0;g<3*h.indexArray.length;g++)n.push(p[g]+s)}if(n.length%3!=0)return null;for(let h=0;h<n.length;h+=3){const f=t[n[h+0]],p=t[n[h+1]],g=t[n[h+2]];(f.x-p.x)*(g.y-p.y)-(g.x-p.x)*(f.y-p.y)>0&&([n[h+1],n[h+2]]=[n[h+2],n[h+1]])}return{vertices:t,indices:n}}function Y_(r){const e=function(p,g){const x=[],b=WebGL2RenderingContext;if(p.json.textures)for(const w of p.json.textures){const S={magFilter:b.LINEAR,minFilter:b.NEAREST,wrapS:b.REPEAT,wrapT:b.REPEAT};w.sampler!==void 0&&Object.assign(S,p.json.samplers[w.sampler]),x.push({image:g[w.source],sampler:S,uploaded:!1})}return x}(r,r.images),t=function(p,g){const x=[];for(const b of p.json.meshes){const w=[];for(const S of b.primitives)w.push(b1(S,p,g));x.push(w)}return x}(r,e),{scenes:n,scene:s,nodes:c}=r.json,h=n?n[s||0].nodes:[...c.keys()],f=[];for(const p of h)f.push(Mx(c[p],r,t));return function(p,g,x){const b={},w=new Set;for(let S=0;S<p.length;S++){const E=x[g[S]];if(!E.extras)continue;const A=E.extras["mapbox:footprint:version"],P=E.extras["mapbox:footprint:id"];(A||P)&&w.add(S),A==="1.0.0"&&P&&(b[P]=S)}for(let S=0;S<p.length;S++){if(w.has(S))continue;const E=p[S],A=x[g[S]];if(!A.extras)continue;let P=null;E.id in b&&(P=S1(p[b[E.id]].meshes,E.localMatrix)),P||(P=T1(A)),P&&(E.footprint=w1(P))}if(w.size>0){const S=Array.from(w.values()).sort((E,A)=>E-A);for(let E=S.length-1;E>=0;E--)p.splice(S[E],1)}}(f,h,r.json.nodes),f}function I1(r){r.heightmap=new Float32Array(4096),r.heightmap.fill(-1);const e=r.vertexArray.float32,t=r.aabb.min[0]-1,n=r.aabb.min[1]-1,s=Xl/(r.aabb.max[0]-t+2),c=Xl/(r.aabb.max[1]-n+2);for(let h=0;h<e.length;h+=3){const f=e[h+2],p=(e[h+0]-t)*s|0,g=(e[h+1]-n)*c|0;f>r.heightmap[g*Xl+p]&&(r.heightmap[g*Xl+p]=f)}}function Px(r,e,t,n,s){t.reserve(t.length+4*r.length),n.reserve(n.length+10*r.length),s.reserve(s.length+10*r.length);let c=n.length;for(const h of r){const f=Math.min(10,Math.max(4,1.3*h.height))*e,p=[-h.normal[1],h.normal[0],0],g=Math.min(.29,.1*h.width/h.depth),x=h.width-2*h.depth*e*(g+.01),b=un([],h.pos,p,x/2),w=un([],h.pos,p,-x/2),S=[b[0],b[1],b[2]+h.height],E=[w[0],w[1],w[2]+h.height],A=un([],h.normal,p,g);yi(A,A,f);const P=un([],h.normal,p,-g);yi(P,P,f),er(A,b,A),er(P,w,P),b[2]+=.1,w[2]+=.1,n.emplaceBack(A[0],A[1],A[2]),n.emplaceBack(P[0],P[1],P[2]),n.emplaceBack(b[0],b[1],b[2]),n.emplaceBack(w[0],w[1],w[2]),n.emplaceBack(S[0],S[1],S[2]),n.emplaceBack(E[0],E[1],E[2]),n.emplaceBack(b[0],b[1],b[2]),n.emplaceBack(w[0],w[1],w[2]),n.emplaceBack(A[0],A[1],A[2]),n.emplaceBack(P[0],P[1],P[2]);const R=x/f/2;s.emplaceBack(-R-g,-1,R,.8),s.emplaceBack(R+g,-1,R,.8),s.emplaceBack(-R,0,R,1.3),s.emplaceBack(R,0,R,1.3),s.emplaceBack(R+g,-.8,R,.7),s.emplaceBack(R+g,-.8,R,.7),s.emplaceBack(0,0,R,1.3),s.emplaceBack(0,0,R,1.3),s.emplaceBack(R+g,-1.2,R,.8),s.emplaceBack(R+g,-1.2,R,.8),t.emplaceBack(6+c,4+c,8+c),t.emplaceBack(7+c,9+c,5+c),t.emplaceBack(0+c,1+c,2+c),t.emplaceBack(1+c,3+c,2+c),c+=10}}function E1(r,e){const t={};t.indexArray=new Ni,t.vertexArray=new Fn,t.colorArray=new Ro,Px(r,e,t.indexArray,t.vertexArray,t.colorArray);const n={defined:!0};n.emissiveFactor=jt.black;const s={};return s.baseColorFactor=jt.white,n.pbrMetallicRoughness=s,t.material=n,t.aabb=new Xt([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),t}const Dx=zt([{name:"a_pos_3f",components:3,type:"Float32"}]),A1=zt([{name:"a_normal_3",components:3,type:"Int16"}]),C1=zt([{name:"a_centroid_3",components:3,type:"Int16"}]),Rx=zt([{name:"a_part_color_emissive",components:2,type:"Uint16"}]),M1=zt([{name:"a_faux_facade_color_emissive",components:2,type:"Uint16"}]),P1=zt([{name:"a_faux_facade_data",components:4,type:"Uint16"}]),D1=zt([{name:"a_faux_facade_vertical_range",components:2,type:"Uint16"}]),R1=zt([{name:"a_bloom_attenuation",components:4,type:"Float32"}]),z1=zt([{name:"a_flood_light_wall_radius_1i16",components:1,type:"Int16"}]),zx=yt.types,$p=32767;function L1(r,e){const t=Ze+e;for(const n of r)for(const s of n)if(s.x<-e||s.x>t||s.y<-e||s.y>t)return!1;return!0}function F1(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}`)}}class K_{constructor(){this.layoutVertexArray=new Fn,this.layoutAttenuationArray=new Ro,this.layoutColorArray=new On,this.indexArray=new Ni,this.indexArrayForConflation=new Ni,this.segmentsBucket=new oi}}class Q_{constructor(e){this.layoutFacadePaintArray=null,this.layoutFacadeDataArray=null,this.layoutFacadeVerticalRangeArray=null,this.segmentsBucket=new oi,this.entranceBloom=new K_;const t=66560;this.layoutVertexArray=new Fn,this.layoutVertexArray.reserve(t),this.layoutNormalArray=new co,this.layoutNormalArray.reserve(t),this.layoutCentroidArray=new co,this.layoutCentroidArray.reserve(t),this.layoutColorArray=new On,this.layoutColorArray.reserve(t),this.layoutFloodLightDataArray=new bu,this.layoutFloodLightDataArray.reserve(t),this.layoutAOArray=new wu,this.layoutAOArray.reserve(t),this.indexArray=new Ni,this.indexArray.reserve(66560),this.indexArrayForConflation=new Ni,this.segmentsBucket=new oi,this.entranceBloom=new K_,e&&(this.layoutFacadePaintArray=new On,this.layoutFacadeDataArray=new za,this.layoutFacadeVerticalRangeArray=new On)}reserve(e,t,n){this.layoutVertexArray.reserveForAdditional(e),this.layoutCentroidArray.reserveForAdditional(e),this.layoutFloodLightDataArray.reserveForAdditional(e),this.layoutNormalArray.reserveForAdditional(e),this.layoutAOArray.reserveForAdditional(e),this.layoutColorArray.reserveForAdditional(e),this.indexArray.reserveForAdditional(t),n&&(this.layoutFacadePaintArray.reserveForAdditional(e),this.layoutFacadeDataArray.reserveForAdditional(e),this.layoutFacadeVerticalRangeArray.reserveForAdditional(e))}}class Lx{constructor(e){this.colorBufferUploaded=!1,this.maxHeight=0,this.replacementUpdateTime=0,this.activeReplacements=[],this.footprints=[],this.footprintsVertices=new ks,this.footprintsIndices=new Vs,this.footprintsMin=new Fe(1/0,1/0),this.footprintsMax=new Fe(-1/0,-1/0),this.featuresOnBorder=[],this.buildingWithoutFacade=new Q_(!1),this.buildingWithFacade=new Q_(!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(t=>t.fqid),this.index=e.index,this.hasPattern=!1,this.worldview=e.worldview,this.lut=e.lut,this.programConfigurations=new D(e.layers,{zoom:e.zoom,lut:e.lut}),this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id),this.projection=e.projection,this.groundEffect=new k_(e),this.groundEffect.groundRadiusArray=new gn,this.hasAppearances=null}updateFootprints(e,t){const n=new Cp([],[],1),s={vertices:[],indices:new Uint32Array(0),grid:n,min:this.footprintsMin,max:this.footprintsMax,buildingIds:this.buildingIds};t.push({footprint:s,id:e})}updateAppearances(e,t,n,s){return{hasLayoutChanges:!1,hasUboChanges:!1}}prepare(){return function(){if(Bp!=null||ux!=null)return null;if(Du!=null)return Du;const e=fetch(Mn());return Du=function(t){let n,s,c,h,f;function p(){n=new Uint8Array(f.buffer),s=new Int16Array(f.buffer),c=new Int32Array(f.buffer),h=new Float32Array(f.buffer)}function g(){throw new Error("Unexpected BuildingGen error.")}const x=()=>{},b={a:{a:g,f:function(w){const S=n.length,E=Math.max(w>>>0,Math.ceil(1.2*S)),A=Math.ceil((E-S)/65536);try{return f.grow(A),p(),!0}catch{return!1}},g,b:x,c:x,d:x,e:x}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(t,b):t.then(w=>w.arrayBuffer()).then(w=>WebAssembly.instantiate(w,b))).then(w=>{const S=w.instance.exports;return(0,S.g)(),f=S.f,p(),new o1({setStyle:S.h,setAOOptions:S.i,setMetricOptions:S.j,setStructuralOptions:S.k,setFacadeOptions:S.l,setFauxFacadeOptions:S.m,setFacadeClassifierOptions:S.n,addFeature:S.o,addFacade:S.p,generateMesh:S.q,getLastError:S.r,getOuterRingLength:S.s,getMeshCount:S.t,getPositionsPtr:S.u,getPositionsLength:S.v,getNormalsPtr:S.w,getNormalsLength:S.x,getAOPtr:S.y,getAOLength:S.z,getUVPtr:S.A,getUVLength:S.B,getFauxFacadePtr:S.C,getFauxFacadeLength:S.D,getIndicesPtr:S.E,getIndicesLength:S.F,getBuildingPart:S.G,getRingCount:S.H,getRingPtr:S.I,getRingLength:S.J,malloc:S.K,free:S.L,heapU8:n,heap16:s,heap32:c,heapF32:h})})}(e).then(t=>(Du=null,Bp=t,Bp)).catch(t=>{lt("Could not load building-gen"),Du=null,ux=t instanceof Error?t:new Error("Unknown error")}),Du}()}populate(e,t,n,s){const c=s1();if(!c)return;const h=De(n);this.tileToMeter=h,this.brightness=t.brightness,c.setStyle({normalScale:[1,-1,h],tileToMeters:h}),c.setAOOptions(!1,.3),c.setMetricOptions(!1,16),c.setStructuralOptions(!0),c.setFacadeClassifierOptions(3);const f=new Map,p=new Map;let g=0;for(const{feature:R}of e){if(zx[R.type]!=="LineString"){f.set(R.id,R.properties.source_id);continue}const B=this.layers[0]._featureFilter.needGeometry;if(B&&!this.layers[0]._featureFilter.filter(new Zt(this.zoom),R,n))continue;const L=Ct(R,B);if(!B&&!this.layers[0]._featureFilter.filter(new Zt(this.zoom),L,n))continue;const U=B?L.geometry:ft(R,n,s),G=[];for(const ee of U)for(const Q of ee)G.push(Q.x),G.push(Q.y);const q={coordinates:G,crossPerc:R.properties.cross_perc,distanceToRoad:R.properties.distance_to_road,entrances:R.properties.entrances,sourceId:0},ie=R.properties.source_id;let X=p.get(ie);X||(X=[],p.set(ie,X)),X.push(q),++g}this.maxHeight=0;const x=new Array,b=new Set,w=R=>{R!=null&&b.add(R)},S=(R,B)=>{R!=null&&x.push({buildingId:R,footprintIndex:B})},E=64*(e.length-g),A=E/2;this.buildingWithFacade.reserve(E,A,!0),this.buildingWithoutFacade.reserve(2*E,2*A,!1),this.footprintsIndices.reserve(16*(e.length-g)),this.footprintsVertices.reserve(8*(e.length-g));for(const{feature:R,id:B,index:L,sourceLayerIndex:U}of e){if(zx[R.type]==="LineString")continue;const G=this.layers[0]._featureFilter.needGeometry;if(G&&!this.layers[0]._featureFilter.filter(new Zt(this.zoom),R,n))continue;let q=null;if(R.properties&&R.properties.hasOwnProperty("building_id")&&(q=Number(R.properties.building_id),b.has(q)))continue;const ie=Ct(R,G);if(!G&&!this.layers[0]._featureFilter.filter(new Zt(this.zoom),ie,n))continue;const X=G?ie.geometry:ft(R,n,s),ee=Pd(X,500);let Q=!1;for(const Dt of ee)if(Dt.length!==1){Q=!0;break}if(Q){w(q);continue}if(!L1(X,163)){w(q);continue}const J=this.layers[0],ve=F1(J.layout.get("building-roof-shape").evaluate(R,{},n)),Te=J.layout.get("building-base").evaluate(R,{},n),Ie=J.layout.get("building-height").evaluate(R,{},n),Ce=J.layout.get("building-flood-light-ground-radius").evaluate(R,{},n),Ee=J.paint.get("building-ambient-occlusion-intensity"),Oe=Ce/this.tileToMeter;R.properties["building-part"]="roof";const ye=J.paint.get("building-color").evaluate(R,{},this.canonical).toPremultipliedRenderColor(this.lut),Ae=J.paint.get("building-emissive-strength").evaluate(R,{},this.canonical);R.properties["building-part"]="wall";const Pe=J.paint.get("building-color").evaluate(R,{},this.canonical).toPremultipliedRenderColor(this.lut),Be=J.paint.get("building-emissive-strength").evaluate(R,{},this.canonical);R.properties["building-part"]="window";const Ue=J.paint.get("building-color").evaluate(R,{},this.canonical).toPremultipliedRenderColor(this.lut),Je=J.paint.get("building-emissive-strength").evaluate(R,{},this.canonical);R.properties["building-part"]="door";const He=J.paint.get("building-color").evaluate(R,{},this.canonical).toPremultipliedRenderColor(this.lut),qe=J.paint.get("building-emissive-strength").evaluate(R,{},this.canonical);let je=J.layout.get("building-flood-light-wall-radius").evaluate(R,{},n);je=k(je,0,2048);const Ye=je/2048*$p,it=f.get(B),ht=p.get(it)||[],nt=ht.length!==0&&J.layout.get("building-facade").evaluate(R,{},n);c.setFacadeOptions(4,!0),c.setFauxFacadeOptions(nt,!1,1);let wt=0,Ft=0,Tt=0,Bt=0,Mt=0,Li=0,Wt=0,Ut=0,li=0,Mi=0,ur=0;if(nt){let Dt=Math.round(J.layout.get("building-facade-floors").evaluate(R,{},n));if(Te===0){Dt=Math.max(1,Dt-(ht.length>0?1:0));let Gi=4;if(Ie>100){const sr=[10,13,15];Gi=sr[R.id?R.id%sr.length:0]}else Ie<=10&&(Gi=3);c.setFacadeOptions(Gi,!0),Mt=(Ie<15?1.3:1.61803)*Gi/h}else Mt=Te/h;Li=Ie/h,Mt=Math.min(Mt,Li),Tt=J.layout.get("building-facade-unit-width").evaluate(R,{},n)/h,Bt=(Li-Mt)/Dt,c.setFauxFacadeOptions(!0,!0,Tt);const xr=J.layout.get("building-facade-window").evaluate(R,{},n);wt=xr[0],Ft=xr[1],Wt=Math.floor(65535*Math.min(1,Mt/Ze)),Ut=Math.floor(65535*Math.min(1,Li/Ze)),li=Math.floor(255*wt)<<8|Math.floor(255*Ft),Mi=Math.floor(65535*Math.min(1,Tt/Ze)),ur=Math.floor(65535*Math.min(1,Bt/Ze))}const Pi=Array(ee.length),Ui={x:1/0,y:1/0},Ki={x:-1/0,y:-1/0},ji={x:0,y:0};let Ar=0;for(let Dt=0;Dt<ee.length;Dt++){const xr=ee[Dt];if(xr.length>0){const Gi=[],sr=Array(xr.length+1);sr[0]=0;for(let Qn=0;Qn<xr.length;Qn++){const Sn=xr[Qn];for(let In=0;In<Sn.length;In++){const En=Sn[Sn.length-In-1];Ui.x=Math.min(Ui.x,En.x),Ui.y=Math.min(Ui.y,En.y),Ki.x=Math.max(Ki.x,En.x),Ki.y=Math.max(Ki.y,En.y),ji.x+=En.x,ji.y+=En.y,Ar++,Gi.push(En.x),Gi.push(En.y)}sr[Qn+1]=Gi.length}Pi[Dt]={id:R.id?R.id:0,height:Ie,minHeight:Te,sourceId:0,roofType:ve,coordinates:Gi,ringIndices:sr}}}ji.x/=Ar||1,ji.y/=Ar||1;const hr=c.generateMesh(Pi,ht);if(typeof hr=="string"){lt(`Unable to generate building ${R.id}: ${hr}`),w(q);continue}if(hr.meshes.length===0||hr.modifiedPolygonRings.length===0){w(q);continue}const Pt=nt?this.buildingWithFacade:this.buildingWithoutFacade;let Ur=0;for(const Dt of hr.meshes)Ur+=Dt.positions.length/3;const $i=Pt.segmentsBucket.prepareSegment(Ur,Pt.layoutVertexArray,Pt.indexArray),gr=[];let jr=null,Cr=0,Fi=-1;const Br=Pt.layoutVertexArray.length,yr=Br+Ur;Pt.layoutVertexArray.resize(yr),Pt.layoutCentroidArray.resize(yr),Pt.layoutNormalArray.resize(yr),Pt.layoutAOArray.resize(yr),Pt.layoutColorArray.resize(yr),Pt.layoutFloodLightDataArray.resize(yr),nt&&(Pt.layoutFacadePaintArray.resize(yr),Pt.layoutFacadeDataArray.resize(yr),Pt.layoutFacadeVerticalRangeArray.resize(yr));const xm=Pt.indexArray.length;let qu=0,Yr=Br;for(const Dt of hr.meshes){let xr,Gi;if(Dt.buildingPart===1)xr=ye,Gi=Ae;else if(Dt.buildingPart===0)xr=Pe,Gi=Be;else if(Dt.buildingPart===2)xr=Ue,Gi=Je;else{if(Dt.buildingPart!==3)continue;xr=He,Gi=qe}if(Gi=k(Gi,0,1),Dt.buildingPart===3){const nr=new Array;for(let Hi=0;Hi<Dt.positions.length;Hi+=12){const Gr=Dt.positions[Hi+0],Kr=Dt.positions[Hi+1],go=Dt.positions[Hi+3],bm=Dt.positions[Hi+4],wm=Dt.positions[Hi+2],Gg=Dt.positions[Hi+8]-wm,Tm=1,No=go-Gr,cf=bm-Kr,Xu=Math.hypot(No,cf);nr.push({pos:[Gr+.5*No,Kr+.5*cf,wm],normal:[cf/Xu,-No/Xu,0],width:Xu,height:Gg,depth:Tm,points:[Gr,Kr,go,bm]})}const Ji=Pt.entranceBloom.segmentsBucket.prepareSegment(10*nr.length,Pt.entranceBloom.layoutVertexArray,Pt.entranceBloom.indexArray),ar=Pt.entranceBloom.layoutVertexArray.length;Cr=Pt.entranceBloom.indexArray.length,Px(nr,.5/this.tileToMeter,Pt.entranceBloom.indexArray,Pt.entranceBloom.layoutVertexArray,Pt.entranceBloom.layoutAttenuationArray);const _o=Pt.entranceBloom.layoutVertexArray.length-ar;Fi=Pt.entranceBloom.indexArray.length-Cr;for(let Hi=0;Hi<_o;Hi++)Pt.entranceBloom.layoutColorArray.emplaceBack(255*He.r<<8|255*He.g,255*He.b<<8|51*qe);Ji.vertexLength+=_o,Ji.primitiveLength+=Fi,jr={part:Dt.buildingPart,vertexOffset:ar,vertexLength:_o}}Pt.layoutVertexArray.float32.set(Dt.positions,3*Yr);const sr=Dt.positions.length/3;for(let nr=0;nr<sr;++nr){const Ji=3*nr;qu=Math.max(qu,Dt.positions[Ji+2]);const ar=Dt.normals[Ji+1]*$p,_o=Dt.normals[Ji+2]*$p,Hi=3*(Yr+nr);Pt.layoutNormalArray.int16[Hi]=Dt.normals[Ji]*$p,Pt.layoutNormalArray.int16[Hi+1]=ar,Pt.layoutNormalArray.int16[Hi+2]=_o;const Gr=Dt.ao[nr];Pt.layoutAOArray.uint8[Yr+nr]=255*Gr;const Kr=1+(Gr-1)*Ee,go=255*xr.b*Kr<<8|255*Gi;Pt.layoutColorArray.uint16[2*(Yr+nr)]=255*xr.r*Kr<<8|255*xr.g*Kr,Pt.layoutColorArray.uint16[2*(Yr+nr)+1]=go}const Qn=Math.min(8191,Math.max(0,Math.floor(ji.x))),Sn=Math.min(8191,Math.max(0,Math.floor(ji.y))),In=Math.floor(Ie),En=20,mo=4*Qn+Math.min(3,Math.round((Ki.x-Ui.x)*this.tileToMeter/En)),vm=4*Sn+Math.min(3,Math.round((Ki.y-Ui.y)*this.tileToMeter/En));for(let nr=0;nr<sr;++nr){const Ji=3*(Yr+nr);Pt.layoutCentroidArray.int16[Ji]=mo,Pt.layoutCentroidArray.int16[Ji+1]=vm,Pt.layoutCentroidArray.int16[Ji+2]=In}if(Pt.layoutFloodLightDataArray.int16.fill(Dt.buildingPart===0?Ye:0,Yr,Yr+sr),nt){const nr=255*Ue.r<<8|255*Ue.g,Ji=255*Ue.b<<8|255*Je;for(let ar=0;ar<sr;++ar){const _o=2*(Yr+ar);Pt.layoutFacadePaintArray.uint16[_o]=nr,Pt.layoutFacadePaintArray.uint16[_o+1]=Ji}for(let ar=0;ar<sr;++ar)if(Dt.isFauxFacade[ar]){const _o=Math.min(65535,Math.floor(Dt.uv[2*ar]*hr.outerRingLength));Pt.layoutFacadeDataArray.emplace(Yr+ar,1|_o,li,Mi,ur),Pt.layoutFacadeVerticalRangeArray.emplace(Yr+ar,Wt,Ut)}else Pt.layoutFacadeDataArray.emplace(Yr+ar,0,0,0,0),Pt.layoutFacadeVerticalRangeArray.emplace(Yr+ar,0,0)}const Vo=$i.vertexLength,Zu=Dt.indices.length/3,Wu=Pt.indexArray.length;Pt.indexArray.resize(Wu+Zu);for(let nr=0;nr<Zu;++nr){const Ji=3*nr,ar=3*Wu+Ji;Pt.indexArray.uint16[ar]=Vo+Dt.indices[Ji],Pt.indexArray.uint16[ar+1]=Vo+Dt.indices[Ji+1],Pt.indexArray.uint16[ar+2]=Vo+Dt.indices[Ji+2]}Dt.buildingPart!==1&&Dt.buildingPart!==0&&Dt.buildingPart!==2&&Dt.buildingPart!==3||gr.push({part:Dt.buildingPart,vertexOffset:Yr,vertexLength:Dt.positions.length/3}),Yr+=sr,$i.vertexLength+=sr,$i.primitiveLength+=Dt.indices.length/3}this.maxHeight=Math.max(this.maxHeight,qu);const jg=Pt.indexArray.length-xm,$u=this.footprintsIndices.length,Ws=this.footprintsVertices.length,Xs=[],Yn=new Fe(1/0,1/0),Kn=new Fe(-1/0,-1/0),nc=this.groundEffect.vertexArray.length;for(const Dt of hr.modifiedPolygonRings){const xr=[],Gi=new Fe(1/0,1/0),sr=new Fe(-1/0,-1/0);for(let Qn=0;Qn<Dt.length;Qn+=2){const Sn=Dt.length-Qn-2;Gi.x=Math.min(Gi.x,Dt[Sn]),Gi.y=Math.min(Gi.y,Dt[Sn+1]),sr.x=Math.max(sr.x,Dt[Sn]),sr.y=Math.max(sr.y,Dt[Sn+1]);const In=new Fe(Dt[Sn],Dt[Sn+1]);xr.push(In),Xs.push(In.x,In.y),this.footprintsVertices.emplaceBack(In.x,In.y)}Yn.x=Math.min(Yn.x,Gi.x),Yn.y=Math.min(Yn.y,Gi.y),Kn.x=Math.max(Kn.x,sr.x),Kn.y=Math.max(Kn.y,sr.y),this.groundEffect.addData(xr,[Gi,sr],Oe)}const Hu=this.groundEffect.vertexArray.length-nc;this.groundEffect.groundRadiusArray.reserveForAdditional(Hu);for(let Dt=0;Dt<Hu;Dt++)this.groundEffect.groundRadiusArray.emplaceBack(Ce);(Ui.x<0||Ki.x>Ze||Ui.y<0||Ki.y>Ze)&&this.featuresOnBorder.push({featureId:R.id,footprintIndex:this.footprints.length});{const Dt=Au(Xs,null,2);this.footprintsIndices.resize(this.footprintsIndices.length+Dt.length),this.footprintsIndices.uint16.set(Dt,$u),this.buildingIds.add(q??R.id),this.footprintsMin.x=Math.min(this.footprintsMin.x,Yn.x),this.footprintsMin.y=Math.min(this.footprintsMin.y,Yn.y),this.footprintsMax.x=Math.max(this.footprintsMax.x,Kn.x),this.footprintsMax.y=Math.max(this.footprintsMax.y,Kn.y);const xr={footprintVertexOffset:Ws,footprintVertexLength:this.footprintsVertices.length-Ws,footprintIndexOffset:$u,footprintIndexLength:this.footprintsIndices.length-$u,min:Yn,max:Kn,hiddenFlags:0,indicesOffset:xm,indicesLength:jg,bloomIndicesOffset:Cr,bloomIndicesLength:Fi,groundEffectVertexOffset:nc,groundEffectVertexLength:Hu,hasFauxFacade:nt,height:qu,promoteId:B,feature:ie,parts:gr,buildingBloom:jr},Gi=this.footprints.length;R.id!==void 0&&this.featureFootprintLookup.set(R.id,Gi),S(q,Gi),this.footprints.push(xr)}this.programConfigurations.populatePaintArrays(Pt.layoutVertexArray.length,R,L,{},t.availableImages,n,t.brightness),this.groundEffect.addPaintPropertiesData(R,L,{},t.availableImages,n,t.brightness),t.featureIndex.insert(R,X,L,U,this.index,Br)}x.forEach(({buildingId:R,footprintIndex:B})=>{b.has(R)&&(this.footprints[B].hiddenFlags|=4)});const P=new Set;this.buildingIds.forEach((R,B,L)=>{b.has(R)||P.add(R)}),this.buildingIds=P,this.groundEffect.prepareBorderSegments()}update(e,t,n,s,c,h,f){this.programConfigurations.updatePaintArrays(e,t,c,n,s,h,f),this.groundEffect.update(e,t,c,n,s,h,f),this.evaluate(this.layers[0],e),this.colorBufferUploaded=!1}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 t=n=>{n.layoutVertexBuffer=e.createVertexBuffer(n.layoutVertexArray,Dx.members),n.layoutNormalBuffer=e.createVertexBuffer(n.layoutNormalArray,A1.members),n.layoutCentroidBuffer=e.createVertexBuffer(n.layoutCentroidArray,C1.members),n.layoutFloodLightDataBuffer=e.createVertexBuffer(n.layoutFloodLightDataArray,z1.members),n.layoutFacadeDataArray&&n.layoutFacadeDataArray.length&&(n.layoutFacadeDataBuffer=e.createVertexBuffer(n.layoutFacadeDataArray,P1.members)),n.layoutFacadeVerticalRangeArray&&n.layoutFacadeVerticalRangeArray.length&&(n.layoutFacadeVerticalRangeBuffer=e.createVertexBuffer(n.layoutFacadeVerticalRangeArray,D1.members)),n.entranceBloom.layoutVertexArray.length&&(n.entranceBloom.layoutVertexBuffer=e.createVertexBuffer(n.entranceBloom.layoutVertexArray,Dx.members),n.entranceBloom.layoutAttenuationBuffer=e.createVertexBuffer(n.entranceBloom.layoutAttenuationArray,R1.members)),this.uploadUpdatedColorBuffer(e),this.uploadUpdatedIndexBuffer(e)};this.uploaded||(t(this.buildingWithoutFacade),t(this.buildingWithFacade),this.groundEffect.upload(e)),this.groundEffect.uploadPaintProperties(e),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){const e=t=>{t.layoutVertexBuffer&&(t.layoutVertexBuffer.destroy(),t.layoutNormalBuffer.destroy(),t.layoutColorBuffer.destroy(),t.segmentsBucket.destroy(),t.indexBuffer&&t.indexBuffer.destroy(),t.entranceBloom.layoutVertexBuffer&&(t.entranceBloom.layoutVertexBuffer.destroy(),t.entranceBloom.layoutColorBuffer.destroy(),t.entranceBloom.layoutAttenuationBuffer.destroy(),t.entranceBloom.indexBuffer.destroy(),t.entranceBloom.segmentsBucket.destroy()))};e(this.buildingWithoutFacade),e(this.buildingWithFacade),this.groundEffect.destroy(),this.programConfigurations.destroy()}updateFootprintHiddenFlags(e,t,n=!0){let s=!1;const c=n?t:0,h=0|(n?-1:~t);this.groundEffect.hiddenByLandmarkVertexArray.length===0&&this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length);for(const f of e){const p=this.footprints[f],g=p.hiddenFlags&h|c;p.hiddenFlags!==g&&(p.hiddenFlags=g,s=!0,this.groundEffect.updateHiddenByLandmarkRange(p.groundEffectVertexOffset,p.groundEffectVertexLength,p.hiddenFlags!==0))}return s&&(this.indexArrayForConflationUploaded=!1),s}uploadUpdatedIndexBuffer(e){if(this.groundEffect.uploadHiddenByLandmark(e),this.indexArrayForConflationUploaded)return;const t=s=>{s.indexArray.length!==0&&(s.indexArrayForConflation.resize(s.indexArray.length),s.indexArrayForConflation.uint16.set(s.indexArray.uint16),s.entranceBloom.indexArrayForConflation.resize(s.entranceBloom.indexArray.length),s.entranceBloom.indexArrayForConflation.uint16.set(s.entranceBloom.indexArray.uint16))};t(this.buildingWithoutFacade),t(this.buildingWithFacade);for(const s of this.footprints){const c=s.hasFauxFacade?this.buildingWithFacade:this.buildingWithoutFacade,h=s.indicesOffset+s.indicesLength;if(s.hiddenFlags!==0){for(let p=s.indicesOffset;p<h;p++)c.indexArrayForConflation.uint16[3*p+0]=0,c.indexArrayForConflation.uint16[3*p+1]=0,c.indexArrayForConflation.uint16[3*p+2]=0;const f=s.bloomIndicesOffset+s.bloomIndicesLength;for(let p=s.bloomIndicesOffset;p<f;p++)c.entranceBloom.indexArrayForConflation.uint16[3*p+0]=0,c.entranceBloom.indexArrayForConflation.uint16[3*p+1]=0,c.entranceBloom.indexArrayForConflation.uint16[3*p+2]=0}}const n=s=>{s.indexArray.length!==0&&(s.indexBuffer?s.indexBuffer.updateData(s.indexArrayForConflation):s.indexBuffer=e.createIndexBuffer(s.indexArrayForConflation,!0),s.entranceBloom.indexBuffer?s.entranceBloom.indexBuffer.updateData(s.entranceBloom.indexArrayForConflation):s.entranceBloom.indexBuffer=e.createIndexBuffer(s.entranceBloom.indexArrayForConflation,!0))};n(this.buildingWithoutFacade),n(this.buildingWithFacade),this.indexArrayForConflationUploaded=!0}uploadUpdatedColorBuffer(e){const t=n=>{n.layoutColorBuffer?n.layoutColorBuffer.updateData(n.layoutColorArray):n.layoutColorBuffer=e.createVertexBuffer(n.layoutColorArray,Rx.members,!0),n.layoutFacadePaintArray&&(n.layoutFacadePaintBuffer?n.layoutFacadePaintBuffer.updateData(n.layoutFacadePaintArray):n.layoutFacadePaintBuffer=e.createVertexBuffer(n.layoutFacadePaintArray,M1.members,!0)),n.entranceBloom.layoutColorBuffer?n.entranceBloom.layoutColorBuffer.updateData(n.entranceBloom.layoutColorArray):n.entranceBloom.layoutColorBuffer=e.createVertexBuffer(n.entranceBloom.layoutColorArray,Rx.members,!0)};t(this.buildingWithoutFacade),t(this.buildingWithFacade),this.colorBufferUploaded=!0}evaluate(e,t){const n=e.paint.get("building-ambient-occlusion-intensity");for(const s of this.footprints){if(4&s.hiddenFlags)continue;const c=t[s.promoteId],h=s.feature;h.properties["building-part"]="roof";const f=e.paint.get("building-color").evaluate(h,c,this.canonical).toPremultipliedRenderColor(this.lut),p=e.paint.get("building-emissive-strength").evaluate(h,c,this.canonical);h.properties["building-part"]="wall";const g=e.paint.get("building-color").evaluate(h,c,this.canonical).toPremultipliedRenderColor(this.lut),x=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),w=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),E=e.paint.get("building-emissive-strength").evaluate(h,c,this.canonical),A=s.hasFauxFacade?this.buildingWithFacade:this.buildingWithoutFacade;for(const R of s.parts){let B,L=f;R.part===1?(L=f,B=p):R.part===0?(L=g,B=x):R.part===2?(L=b,B=w):R.part===3&&(L=S,B=E),B=k(B,0,1);for(let U=0;U<R.vertexLength;U++){const G=R.vertexOffset+U,q=1+(A.layoutAOArray.uint8[G]/255-1)*n;A.layoutColorArray.emplace(G,L.r*q*255<<8|L.g*q*255,L.b*q*255<<8|255*B),s.hasFauxFacade&&A.layoutFacadePaintArray.emplace(G,255*b.r<<8|255*b.g,255*b.b<<8|255*w)}}const P=s.buildingBloom;if(P)for(let R=0;R<P.vertexLength;R++)A.entranceBloom.layoutColorArray.emplace(P.vertexOffset+R,255*S.r<<8|255*S.g,255*S.b<<8|51*E)}}needsEvaluation(){return!this.colorBufferUploaded}updateReplacement(e,t,n){if(t.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=t.updateTime;const s=t.getReplacementRegionsForTile(e.toUnwrapped());if(Pp(this.activeReplacements,s))return;this.activeReplacements=s;for(const h of this.footprints)h.hiddenFlags&=-2;const c=[];for(const h of this.activeReplacements){if(h.order<n)continue;const f=Math.max(1,Math.pow(2,h.footprintTileId.canonical.z-e.canonical.z));for(const p of this.footprints)p.min.x>h.max.x||p.max.x<h.min.x||p.min.y>h.max.y||p.max.y<h.min.y||(c.length=0,B1(this.footprintsVertices,p.footprintVertexOffset,p.footprintVertexLength,h.footprintTileId.canonical,e.canonical,c),z_(h.footprint,c,this.footprintsIndices.uint16,p.footprintIndexOffset,p.footprintIndexLength,0,-f)&&(p.hiddenFlags|=1))}this.groundEffect.hiddenByLandmarkVertexArray.length===0&&this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length);for(const 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 t=this.featureFootprintLookup.get(e.id);return this.footprints[t]}return null}getHeightAtTileCoord(e,t){let n=Number.NEGATIVE_INFINITY,s=!0;const c=4*(e+Ze)*Ze+(t+Ze);if(this.footprintLookup.hasOwnProperty(c)){const f=this.footprintLookup[c];return f?{height:f.height,hidden:f.hiddenFlags!==0}:void 0}const h=new Fe(e,t);for(const f of this.footprints)e>f.max.x||f.min.x>e||t>f.max.y||f.min.y>t||f.height<=n||O1(h,this.footprintsVertices.float32.subarray(2*f.footprintVertexOffset,2*(f.footprintVertexOffset+f.footprintVertexLength)),this.footprintsIndices.uint16.subarray(f.footprintIndexOffset,f.footprintIndexOffset+f.footprintIndexLength))&&(n=f.height,this.footprintLookup[c]=f,s=f.hiddenFlags!==0);if(n!==Number.NEGATIVE_INFINITY)return{height:n,hidden:s};this.footprintLookup[c]=void 0}}function O1(r,e,t){for(let n=0;n<t.length;n+=3){const s=t[n],c=t[n+1],h=t[n+2],f=e[2*s+0],p=e[2*s+1],g=e[2*c+0],x=e[2*c+1],b=e[2*h+0],w=e[2*h+1],S=(f-b)*(r.y-w)-(p-w)*(r.x-b),E=(g-f)*(r.y-p)-(x-p)*(r.x-f);if(S<0!=E<0&&S!==0&&E!==0)continue;const A=(b-g)*(r.y-x)-(w-x)*(r.x-g);if(A===0||A<0==S+E<=0)return!0}return!1}function B1(r,e,t,n,s,c){const h=Math.pow(2,n.z-s.z);for(let f=0;f<t;f++){let p=r.float32[2*(f+e)+0],g=r.float32[2*(f+e)+1];p=(p+s.x*Ze)*h-n.x*Ze,g=(g+s.y*Ze)*h-n.y*Ze,c.push(new Fe(p,g))}}let Fx,Ox;Qe(Lx,"BuildingBucket",{omit:["layers"]}),Qe(Q_,"BuildingGeometry"),Qe(K_,"BuildingBloomGeometry");const k1=zt([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"},{name:"a_linesofar",components:1,type:"Float32"}],4),V1=zt([{name:"a_z_offset_width",components:3,type:"Float32"}],4),N1=zt([{name:"a_elevation_ground_scale",components:1,type:"Float32"}],4),{members:U1}=k1,j1=zt([{name:"a_packed",components:3,type:"Float32"}]),{members:G1}=j1,q1=zt([{name:"a_pattern_data",components:3,type:"Float32"}]),{members:$1}=q1;class Bx{constructor(e,t){this.width=e,this.height=t,this.nextRow=0,this.image=new Ba({width:e,height:t}),this.positions={},this.uploaded=!1}getDash(e,t){const n=this.getKey(e,t);return this.positions[n]}trim(){const e=this.width,t=this.height=he(this.nextRow);this.image.resize({width:e,height:t})}getKey(e,t){return e.join(",")+t}getDashRanges(e,t,n){const s=[];let c=e.length%2==1?-e[e.length-1]*n:0,h=e[0]*n,f=!0;s.push({left:c,right:h,isDash:f,zeroLength:e[0]===0});let p=e[0];for(let g=1;g<e.length;g++){f=!f;const x=e[g];c=p*n,p+=x,h=p*n,s.push({left:c,right:h,isDash:f,zeroLength:x===0})}return s}addRoundDash(e,t,n){const s=t/2;for(let c=-n;c<=n;c++){const h=this.width*(this.nextRow+n+c);let f=0,p=e[f];for(let g=0;g<this.width;g++){g/p.right>1&&(p=e[++f]);const x=Math.abs(g-p.left),b=Math.abs(g-p.right),w=Math.min(x,b);let S;const E=c/n*(s+1);if(p.isDash){const A=s-Math.abs(E);S=Math.sqrt(w*w+A*A)}else S=s-Math.sqrt(w*w+E*E);this.image.data[h+g]=Math.max(0,Math.min(255,S+128))}}}addRegularDash(e,t){for(let p=e.length-1;p>=0;--p){const g=e[p],x=e[p+1];g.zeroLength?e.splice(p,1):x&&x.isDash===g.isDash&&(x.left=g.left,e.splice(p,1))}const n=e[0],s=e[e.length-1];n.isDash===s.isDash&&(n.left=s.left-this.width,s.right=n.right+this.width);const c=this.width*this.nextRow;let h=0,f=e[h];for(let p=0;p<this.width;p++){p/f.right>1&&(f=e[++h]);const g=Math.abs(p-f.left),x=Math.abs(p-f.right),b=Math.min(g,x);this.image.data[c+p]=Math.max(0,Math.min(255,(f.isDash?b:-b)+t+128))}}addDash(e,t){const n=this.getKey(e,t);if(this.positions[n])return this.positions[n];const s=t==="round",c=s?7:0,h=2*c+1;if(this.nextRow+h>this.height)return lt("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&&(lt("Negative value is found in line dasharray, replacing values with 0"),e[b]=0),f+=e[b];if(f!==0){const b=this.width/f,w=this.getDashRanges(e,this.width,b);s?this.addRoundDash(w,b,c):this.addRegularDash(w,t==="square"?.5*b:0)}const p=this.nextRow+c;this.nextRow+=h;const g=Math.floor(f),x={tl:[p,c],br:[g,Math.round(65535*(f-g))]};return this.positions[n]=x,x}}Qe(Bx,"LineAtlas");const H1=yt.types,Z1=Math.cos(Math.PI/180*37.5),W1=Math.cos(Math.PI/180*5);class Hp{constructor(e){this.evaluationGlobals={zoom:0,lineProgress:void 0},this.elevationType="none",this.isSeaLevelReference=!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(t=>t.fqid),this.index=e.index,this.projection=e.projection,this.hasPattern=!1,this.hasCrossSlope=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(t=>{this.gradients[t.id]={}}),this.layoutVertexArray=new Fl,this.layoutVertexArray2=new Fn,this.patternVertexArray=new Fn,this.indexArray=new Ni,this.programConfigurations=new D(e.layers,{zoom:e.zoom,lut:e.lut}),this.segments=new oi,this.maxLineLength=0,this.zOffsetVertexArray=new Fn,this.elevationGroundScaleVertexArray=new gn,this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id),this.tessellationStep=e.tessellationStep?e.tessellationStep:128,this.worldview=e.worldview,this.hasAppearances=null}updateFootprints(e,t){}updateAppearances(e,t,n,s){return{hasLayoutChanges:!1,hasUboChanges:!1}}populate(e,t,n,s){this.hasPattern=b_("line",this.layers,this.pixelRatio,t);const c=this.layers[0].layout.get("line-sort-key");this.tileToMeter=De(n);const h=this.layers[0].layout.get("line-elevation-reference");if(h==="hd-road-markup")this.elevationType="road";else{const w=this.layers[0].layout.get("line-z-offset"),S=w.isConstant()&&!w.constantOr(0);this.elevationType=h!=="sea"&&h!=="ground"&&S?"none":"offset",this.elevationType==="offset"&&h==="none"&&lt(`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 p=[];for(const{feature:w,id:S,index:E,sourceLayerIndex:A}of e){const P=this.layers[0]._featureFilter.needGeometry,R=Ct(w,P);if(!this.layers[0]._featureFilter.filter(new Zt(this.zoom,{worldview:this.worldview,activeFloors:t.activeFloors}),R,n))continue;const B=c?c.evaluate(R,{},n):void 0,L={id:S,properties:w.properties,type:w.type,sourceLayerIndex:A,index:E,geometry:P?R.geometry:ft(w,n,s),patterns:{},sortKey:B};p.push(L)}c&&p.sort((w,S)=>w.sortKey-S.sortKey);const{lineAtlas:g,featureIndex:x}=t,b=this.addConstantDashes(g);for(const w of p){const{geometry:S,index:E,sourceLayerIndex:A}=w;if(b&&this.addFeatureDashes(w,g),this.hasPattern){const P=w_("line",this.layers,w,this.zoom,this.pixelRatio,t);this.patternFeatures.push(P)}else this.addFeature(w,S,E,n,g.positions,t.availableImages,t.brightness,t.elevationFeatures);x.insert(e[E].feature,S,E,A,this.index)}}addConstantDashes(e){let t=!1;for(const n of this.layers){const s=n.paint.get("line-dasharray").value,c=n.layout.get("line-cap").value;if(s.kind!=="constant"||c.kind!=="constant")t=!0;else{const h=c.value,f=s.value;if(!f)continue;e.addDash(f,h)}}return t}addFeatureDashes(e,t){const n=this.zoom;for(const s of this.layers){const c=s.paint.get("line-dasharray").value,h=s.layout.get("line-cap").value;if(c.kind==="constant"&&h.kind==="constant")continue;let f,p;if(c.kind==="constant"){if(f=c.value,!f)continue}else f=c.evaluate({zoom:n},e);p=h.kind==="constant"?h.value:h.evaluate({zoom:n},e),t.addDash(f,p),e.patterns[s.id]=[t.getKey(f,p)]}}update(e,t,n,s,c,h,f,p,g){this.programConfigurations.updatePaintArrays(e,t,c,n,s,h,f,g)}addFeatures(e,t,n,s,c,h){for(const f of this.patternFeatures)this.addFeature(f,f.geometry,f.index,t,n,s,h,e.elevationFeatures)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,G1)),this.patternVertexArray.length!==0&&(this.patternVertexBuffer=e.createVertexBuffer(this.patternVertexArray,$1)),!this.zOffsetVertexBuffer&&this.zOffsetVertexArray.length>0&&(this.zOffsetVertexBuffer=e.createVertexBuffer(this.zOffsetVertexArray,V1.members,!0)),!this.elevationGroundScaleVertexBuffer&&this.elevationGroundScaleVertexArray.length>0&&(this.elevationGroundScaleVertexBuffer=e.createVertexBuffer(this.elevationGroundScaleVertexArray,N1.members,!0)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,U1),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.zOffsetVertexBuffer&&this.zOffsetVertexBuffer.destroy(),this.elevationGroundScaleVertexBuffer&&this.elevationGroundScaleVertexBuffer.destroy(),this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e,t){let n,s;if(t&&t>0?(n=`mapbox_clip_start_${t}`,s=`mapbox_clip_end_${t}`):(n="mapbox_clip_start",s="mapbox_clip_end"),e.properties&&e.properties.hasOwnProperty(n)&&e.properties.hasOwnProperty(s))return{start:+e.properties[n],end:+e.properties[s]}}addFeature(e,t,n,s,c,h,f,p){const g=this.layers[0].layout,x=g.get("line-join").evaluate(e,{}),b=g.get("line-cap").evaluate(e,{}),w=g.get("line-miter-limit"),S=g.get("line-round-limit");this.lineClips=this.lineFeatureClips(e),this.lineFeature=e;const E=!(!e.properties||!e.properties.hasOwnProperty("mapbox_line_metrics"))&&e.properties.mapbox_line_metrics;this.zOffsetValue=g.get("line-z-offset").value;const A=this.layers[0].paint.get("line-width").value;if(A.kind!=="constant"&&A.isLineProgressConstant===!1&&(this.variableWidthValue=A),this.isSeaLevelReference){const P=g.get("line-elevation-ground-scale").value;P.kind==="constant"&&P.value===0||(this.elevationGroundScaleValue=P)}if(this.elevationType==="road"){const P=this.layoutVertexArray.length;if(!this.addElevatedRoadFeature(e,t,s,p,x,b,w,S)){const[R,B]=this.clipRuntimeLinesToTile(t,1);for(let L=0;L<R.length;L++){const U=R[L],G=B[L],q={progress:{min:G.progress.min,max:G.progress.max},nextDir:this.computeSegNextDir(G,U),prevDir:this.computeSegPrevDir(G,U)};this.addLine(U,e,s,x,b,w,S,q,E&&G.parentIndex>0?G.parentIndex:null)}this.fillNonElevatedRoadSegment(P)}}else for(let P=0;P<t.length;P++)this.addLine(t[P],e,s,x,b,w,S,void 0,E&&P>0?P:null);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,c,h,s,f,void 0,this.worldview)}computeSegNextDir(e,t){return e.nextPoint.sub(t.at(-2)).unit()}computeSegPrevDir(e,t){return t[1].sub(e.prevPoint).unit()}clipLinesToTile(e,t){return Op(e,-t,-t,Ze+t,Ze+t)}clipRuntimeLinesToTile(e,t){const n=[];return[Op(e,-t,-t,Ze+t,Ze+t,n),n]}addElevatedRoadFeature(e,t,n,s,c,h,f,p){const g=[],x=ci.getElevationFeature(e,s);if(x){const b=this.clipLinesToTile(t,1),w=this.prepareElevatedLines(b,x,n);for(const S of w)g.push({geometry:S,elevation:x,elevationTileID:n,segment:{progress:{min:0,max:1},nextDir:void 0,prevDir:void 0}})}if(g.length===0)return!1;for(const b of g){const w=this.layoutVertexArray.length;this.addLine(b.geometry,e,n,c,h,f,p);const S=new ui(n,b.elevationTileID);if(b.elevation)for(let E=w;E<this.layoutVertexArray.length;E++){const A=new Fe(this.layoutVertexArray.int16[6*E]>>1,this.layoutVertexArray.int16[6*E+1]>>1),P=S.pointElevation(A,b.elevation,.05);this.updateHeightRange(P),this.zOffsetVertexArray.emplaceBack(P,0,0)}else this.fillNonElevatedRoadSegment(w)}return!0}prepareElevatedLines(e,t,n){if(t.constantHeight!=null)return e;const s=[],c=1/De(n);for(const h of e)n1(h,new xn(t,c),0,s);return s}fillNonElevatedRoadSegment(e){for(let t=e;t<this.layoutVertexArray.length;t++)this.zOffsetVertexArray.emplaceBack(0,0,0)}updateHeightRange(e){this.heightRange?(this.heightRange.min=Math.min(this.heightRange.min,e),this.heightRange.max=Math.max(this.heightRange.max,e)):this.heightRange={min:e,max:e}}addLine(e,t,n,s,c,h,f,p,g){this.distance=0,this.prevDistance=0,this.scaledDistance=0,this.totalDistance=0,this.totalFeatureLength=0,this.lineSoFar=0,this.currentVertex=void 0,this.lineClips=g?this.lineFeatureClips(t,g):this.lineClips;const x=s==="none";this.patternJoinNone=this.hasPattern&&x,this.currentLineJoinType=s,this.segmentStart=0,this.segmentStartf32=0,this.segmentPoints=[];const b=p&&p.progress.min>0,w=p&&p.progress.max<1;if(this.lineClips){let ee={min:this.lineClips.start,max:this.lineClips.end},Q=1;if(p){const Te=this.lineClips.end-this.lineClips.start;ee=function(Ie,Ce,Ee){return{min:mi(Ie.min,Ce,Ee),max:mi(Ie.max,Ce,Ee)}}(p.progress,{min:0,max:1},ee),Te>0&&(Q=(ee.max-ee.min)/Te)}const J=+t.properties.mapbox_clip_feature_len,ve=+t.properties.mapbox_clip_seg_len;if(Number.isNaN(J)||Number.isNaN(ve)){for(let Ie=0;Ie<e.length-1;Ie++)this.totalDistance+=e[Ie].dist(e[Ie+1]);const Te=this.totalDistance/(ee.max-ee.min);this.totalFeatureLength=Number.isFinite(Te)?Te:0,this.lineClips.start=ee.min,this.lineClips.end=ee.max,this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}else this.totalFeatureLength=J,this.distance=ve*Q,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=H1[t.type]==="Polygon";let E=e.length;for(;E>=2&&e[E-1].equals(e[E-2]);)E--;let A=0;for(;A<E-1&&e[A].equals(e[A+1]);)A++;if(E<(S?3:2))return;s==="bevel"&&(h=1.05);const P=this.segments.prepareSegment(10*E,this.layoutVertexArray,this.indexArray);let R,B,L,U,G,q,ie,X;p&&p.prevDir&&(q=p.prevDir.perp()),p&&p.nextDir&&(ie=p.nextDir.perp()),this.e1=this.e2=-1,S&&(R=e[E-2],G=e[A].sub(R)._unit()._perp());for(let ee=A;ee<E;ee++){if(L=ee===E-1?S?e[A+1]:void 0:e[ee+1],L&&e[ee].equals(L))continue;G&&(U=G),R&&(B=R),R=e[ee],X=this.evaluateLineProgressFeatures(B?B.dist(R):0),G=L?L.sub(R)._unit()._perp():U,U=U||G;const Q=B&&L;let J=Q?s:S||x?"butt":c;const ve=U.x*G.x+U.y*G.y;if(x){const Pe=function(Be){if(Be.patternJoinNone){const Ue=Be.segmentPoints.length/2,Je=Be.lineSoFar-Be.segmentStart;for(let He=0;He<Ue;++He){const qe=Be.segmentPoints[2*He+1],je=Math.round(Be.segmentPoints[2*He])+.5+.25*qe;Be.patternVertexArray.emplaceBack(je,Je,Be.segmentStart),Be.patternVertexArray.emplaceBack(je,Je,Be.segmentStart)}Be.segmentPoints.length=0}Be.e1=Be.e2=-1};if(Q&&ve<W1){this.updateDistance(B,R),this.addCurrentVertex(R,U,1,1,P,X),Pe(this),this.addCurrentVertex(R,G,-1,-1,P,X);continue}if(B){if(!L){this.updateDistance(B,R),this.addCurrentVertex(R,U,1,1,P,X),Pe(this);continue}J="miter"}}let Te=U.add(G);Te.x===0&&Te.y===0||Te._unit();const Ie=Te.x*G.x+Te.y*G.y,Ce=Ie!==0?1/Ie:1/0,Ee=2*Math.sqrt(2-2*Ie),Oe=Ie<Z1&&B&&L,ye=U.x*G.y-U.y*G.x>0,Ae=this.overscaling<=16?122880/(512*this.overscaling):0;if(Q&&J==="round"){if(Ce<f)J="miter";else if(Ce<=2){const Pe=J_(R,-10,8202);J=this.elevationType==="offset"&&(Pe||this.hasCrossSlope)?"miter":"fakeround"}}if(J==="miter"&&Ce>h&&(J="bevel"),J==="bevel"&&(Ce>2&&(J="flipbevel"),Ce<h&&(J="miter")),B&&!(J==="miter"&&Oe)&&this.updateDistance(B,R),J==="miter")if(Oe){const Pe=R.dist(B);if(Pe>2*Ae){const Ue=R.sub(R.sub(B)._mult(Ae/Pe)._round());this.updateDistance(B,Ue),this.addCurrentVertex(Ue,U,0,0,P,X),B=Ue}this.updateDistance(B,R),Te._mult(Ce),this.addCurrentVertex(R,Te,0,0,P,X);const Be=R.dist(L);if(Be>2*Ae){const Ue=R.add(L.sub(R)._mult(Ae/Be)._round());this.updateDistance(R,Ue),this.addCurrentVertex(Ue,G,0,0,P,X),R=Ue}}else Te._mult(Ce),this.addCurrentVertex(R,Te,0,0,P,X);else if(J==="flipbevel"){if(Ce>100)Te=G.mult(-1);else{const Pe=Ce*U.add(G).mag()/U.sub(G).mag();Te._perp()._mult(Pe*(ye?-1:1))}this.addCurrentVertex(R,Te,0,0,P,X),this.addCurrentVertex(R,Te.mult(-1),0,0,P,X)}else if(J==="bevel"||J==="fakeround"){const Pe=R.dist(B);let Be=1;if(this.elevationType==="offset"&&J==="bevel"&&this.currentLineJoinType!=="round"&&!this.patternJoinNone&&X!=null&&B&&L){const Ye=4*Ae;Pe<Ye&&(Be=Math.max(0,Pe/Ye))}X!=null&&B&&this.addCurrentVertex(R,ie||U,-Be,-Be,P,X);const Ue=Pe<=2*Ae&&J!=="bevel",Je=Te.mult(ye?1:-1);Je._mult(Ce);const He=G.mult(ye?-1:1),qe=U.mult(ye?-1:1),je=this.evaluateLineProgressFeatures(this.distance);if(X==null&&(this.addHalfVertex(R,Je.x,Je.y,!1,!ye,0,P,je),Ue||this.addHalfVertex(R,Je.x+2*qe.x,Je.y+2*qe.y,!1,ye,0,P,je)),J==="fakeround"){const Ye=Math.round(180*Ee/Math.PI/20);this.addHalfVertex(R,qe.x,qe.y,!1,ye,0,P,je);for(let it=0;it<Ye;it++){let ht=it/Ye;if(ht!==.5){const wt=ht-.5;ht+=ht*wt*(ht-1)*((1.0904+ve*(ve*(3.55645-1.43519*ve)-3.2452))*wt*wt+(.848013+ve*(.215638*ve-1.06021)))}const nt=He.sub(qe)._mult(ht)._add(qe)._unit();this.addHalfVertex(R,nt.x,nt.y,!1,ye,0,P,je)}this.addHalfVertex(R,He.x,He.y,!1,ye,0,P,je)}Ue||X!=null||this.addHalfVertex(R,Je.x+2*He.x,Je.y+2*He.y,!1,ye,0,P,je),X!=null&&L&&this.addCurrentVertex(R,q||G,Be,Be,P,X)}else if(J==="butt")this.addCurrentVertex(R,Te,0,0,P,X);else if(J==="square"){if(!B){const Pe=b?0:-1;this.addCurrentVertex(R,Te,Pe,Pe,P,X)}if(this.addCurrentVertex(R,Te,0,0,P,X),B){const Pe=w?0:1;this.addCurrentVertex(R,Te,Pe,Pe,P,X)}}else if(J==="round"){if(B){const Pe=!Q&&ie?ie:U;this.addCurrentVertex(R,Pe,0,0,P,X),!Q&&w||this.addCurrentVertex(R,Pe,1,1,P,X,!0)}if(L){const Pe=!Q&&q?q:G;!Q&&b||this.addCurrentVertex(R,Pe,-1,-1,P,X,!0),this.addCurrentVertex(R,Pe,0,0,P,X)}}}}addVerticesTo(e,t,n,s,c,h,f,p,g,x){const b=(t.w-e.w)/this.tessellationStep|0;let w=0;const S=this.scaledDistance;if(b>1){this.lineSoFar=e.w;const A=(t.x-e.x)/b,P=(t.y-e.y)/b,R=(t.z-e.z)/b,B=(t.w-e.w)/b,L=t.x-e.x,U=t.y-e.y,G=Math.sqrt(L*L+U*U);if(G===0)return;const q=-U/G,ie=L/G,X=q,ee=ie,Q=-q,J=-ie;for(let ve=1;ve<b;++ve){e.x+=A,e.y+=P,e.z+=R,this.lineSoFar+=B,w+=B;const Te=this.evaluateLineProgressFeatures(this.prevDistance+w);this.scaledDistance=(this.prevDistance+w)/this.totalDistance,this.addHalfVertex(e,X,ee,x,!1,0,g,Te),this.addHalfVertex(e,Q,J,x,!0,0,g,Te)}}this.lineSoFar=t.w,this.scaledDistance=S;const E=this.evaluateLineProgressFeatures(this.distance);this.addHalfVertex(t,n,s,x,!1,f,g,E),this.addHalfVertex(t,c,h,x,!0,-p,g,E)}evaluateLineProgressFeatures(e){if(!this.variableWidthValue&&this.elevationType!=="offset")return null;this.evaluationGlobals.lineProgress=0,this.lineClips?this.evaluationGlobals.lineProgress=Math.min(1,(this.totalFeatureLength*this.lineClips.start+e)/this.totalFeatureLength):lt(`line-progress evaluation for ${this.layerIds[0]} requires enabling 'lineMetrics' for the source.`);let t=0;this.variableWidthValue&&this.variableWidthValue.kind!=="constant"&&(t=this.variableWidthValue.evaluate(this.evaluationGlobals,this.lineFeature)||0);const n=this.evaluateElevationGroundScale();return this.elevationType!=="offset"?{zOffset:0,variableWidth:t,elevationGroundScale:n}:this.zOffsetValue.kind==="constant"?{zOffset:this.zOffsetValue.value,variableWidth:t,elevationGroundScale:n}:{zOffset:this.zOffsetValue.evaluate(this.evaluationGlobals,this.lineFeature)||0,variableWidth:t,elevationGroundScale:n}}evaluateElevationGroundScale(){return this.elevationGroundScaleValue?this.elevationGroundScaleValue.kind==="constant"?this.elevationGroundScaleValue.value:this.elevationGroundScaleValue.evaluate(this.evaluationGlobals,this.lineFeature)||0:0}addCurrentVertex(e,t,n,s,c,h,f=!1){const p=t.x+t.y*n,g=t.y-t.x*n,x=t.y*s-t.x,b=-t.y-t.x*s;if(h!=null){const w=this.elevationType==="offset",S=this.elevationType==="offset"?2:10,E=-S,A=Ze+S,P=h.zOffset,R=new ix(e.x,e.y,P,this.lineSoFar),B=!!w&&J_(e,E,A),L=this.lineSoFar,U=this.distance;if(this.currentVertex)if(B){const G=this.currentVertexIsOutside,q=this.currentVertex,ie=new ix(e.x,e.y,P,this.lineSoFar);if(nx(q,ie,E,A),!J_(ie,E,A)){if(G){this.e1=this.e2=-1,this.distance-=q.dist(R),this.lineSoFar=q.w;const X=this.evaluateLineProgressFeatures(q.w-this.totalFeatureLength*(this.lineClips?this.lineClips.start:0));this.addHalfVertex(q,p,g,f,!1,n,c,X),this.addHalfVertex(q,x,b,f,!0,-s,c,X),this.prevDistance=this.distance}this.distance=this.prevDistance+q.dist(ie),this.scaledDistance=this.distance/this.totalDistance,this.addVerticesTo(q,ie,p,g,x,b,n,s,c,f),this.distance=U,this.scaledDistance=this.distance/this.totalDistance}}else{const G=this.currentVertex;if(this.currentVertexIsOutside){nx(G,R,E,A),this.e1=this.e2=-1,this.distance-=G.dist(R),this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=G.w;const q=this.evaluateLineProgressFeatures(G.w-this.totalFeatureLength*(this.lineClips?this.lineClips.start:0));this.addHalfVertex(G,p,g,f,!1,n,c,q),this.addHalfVertex(G,x,b,f,!0,-s,c,q),this.prevDistance=this.distance,this.distance=U,this.scaledDistance=this.distance/this.totalDistance}this.addVerticesTo(G,R,p,g,x,b,n,s,c,f)}else B||(this.addHalfVertex(e,p,g,f,!1,n,c,h),this.addHalfVertex(e,x,b,f,!0,-s,c,h));this.currentVertex=R,this.currentVertexIsOutside=B,this.lineSoFar=L}else this.addHalfVertex(e,p,g,f,!1,n,c,h),this.addHalfVertex(e,x,b,f,!0,-s,c,h)}addHalfVertex({x:e,y:t},n,s,c,h,f,p,g){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),(t<<1)+(h?1:0),Math.round(63*n)+128,Math.round(63*s)+128,1+(f===0?0:f<0?-1:1),0,this.lineSoFar-this.segmentStartf32),this.lineClips){const b=dt(this.lineClips.start,this.lineClips.end,this.scaledDistance);this.layoutVertexArray2.emplaceBack(this.scaledDistance,this.lineClipsArray.length,b)}const x=p.vertexLength++;if(this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,x),p.primitiveLength++),h?this.e2=x:this.e1=x,g!=null&&this.zOffsetVertexArray.emplaceBack(g.zOffset,g.variableWidth,g.variableWidth),this.elevationGroundScaleValue){const b=g?g.elevationGroundScale:this.evaluateElevationGroundScale();this.elevationGroundScaleVertexArray.emplaceBack(b)}}updateScaledDistance(){this.lineClips?(this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=this.totalFeatureLength*this.lineClips.start+this.distance):this.lineSoFar=this.distance}updateDistance(e,t){this.prevDistance=this.distance,this.distance+=e.dist(t),this.updateScaledDistance()}}function J_(r,e,t){return r.x<e||r.x>t||r.y<e||r.y>t}let kx,Vx;function Nx(r,e,t){return e*(Ze/(r.tileSize*Math.pow(2,t-r.tileID.overscaledZ)))}Qe(Hp,"LineBucket",{omit:["layers","patternFeatures","currentVertex","currentVertexIsOutside"]});const Ux=(r,e,t)=>(1-t)*r+t*e;function jx(r,e){return 1/Nx(r,1,e.tileZoom)}function Gx(r,e,t,n){return r.translatePosMatrix(n||e.tileID.projMatrix,e,t.paint.get("line-translate"),t.paint.get("line-translate-anchor"))}const qx=r=>{const e=[];$x(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");const t=r.paint.get("line-trim-offset");t[0]===0&&t[1]===0||e.push("RENDER_LINE_TRIM_OFFSET"),r.paint.get("line-border-width").constantOr(1)!==0&&e.push("RENDER_LINE_BORDER");const n=r.layout.get("line-join").constantOr("miter")==="none",s=!!r.paint.get("line-pattern").constantOr(1);return n&&s&&e.push("LINE_JOIN_NONE"),e};function $x(r){const e=r.paint.get("line-dasharray").value;return e.kind!=="constant"||e.value}let eg;const Hx=()=>eg||(eg={layout:kx||(kx=new Ci({"line-cap":new Ge(ue.layout_line["line-cap"]),"line-join":new Ge(ue.layout_line["line-join"]),"line-miter-limit":new ke(ue.layout_line["line-miter-limit"]),"line-round-limit":new ke(ue.layout_line["line-round-limit"]),"line-sort-key":new Ge(ue.layout_line["line-sort-key"]),"line-z-offset":new Ge(ue.layout_line["line-z-offset"]),"line-elevation-reference":new ke(ue.layout_line["line-elevation-reference"]),"line-cross-slope":new ke(ue.layout_line["line-cross-slope"]),visibility:new ke(ue.layout_line.visibility),"line-width-unit":new ke(ue.layout_line["line-width-unit"]),"line-elevation-ground-scale":new Ge(ue.layout_line["line-elevation-ground-scale"])})),paint:Vx||(Vx=new Ci({"line-opacity":new Ge(ue.paint_line["line-opacity"]),"line-color":new Ge(ue.paint_line["line-color"]),"line-translate":new ke(ue.paint_line["line-translate"]),"line-translate-anchor":new ke(ue.paint_line["line-translate-anchor"]),"line-width":new Ge(ue.paint_line["line-width"]),"line-gap-width":new Ge(ue.paint_line["line-gap-width"]),"line-offset":new Ge(ue.paint_line["line-offset"]),"line-blur"
vendor: 5,469 bytes, line 7
7:new Ge(ue.paint_line["line-blur"]),"line-dasharray":new Ge(ue.paint_line["line-dasharray"]),"line-pattern":new Ge(ue.paint_line["line-pattern"]),"line-pattern-cross-fade":new ke(ue.paint_line["line-pattern-cross-fade"]),"line-gradient":new Ls(ue.paint_line["line-gradient"]),"line-trim-offset":new ke(ue.paint_line["line-trim-offset"]),"line-trim-fade-range":new ke(ue.paint_line["line-trim-fade-range"]),"line-trim-color":new ke(ue.paint_line["line-trim-color"]),"line-emissive-strength":new Ge(ue.paint_line["line-emissive-strength"]),"line-border-width":new Ge(ue.paint_line["line-border-width"]),"line-border-color":new Ge(ue.paint_line["line-border-color"]),"line-occlusion-opacity":new ke(ue.paint_line["line-occlusion-opacity"]),"line-blend-mode":new ke(ue.paint_line["line-blend-mode"]),"line-color-use-theme":new Ge({type:"string",default:"default","property-type":"data-driven"}),"line-gradient-use-theme":new Ge({type:"string",default:"default","property-type":"data-driven"}),"line-trim-color-use-theme":new Ge({type:"string",default:"default","property-type":"data-driven"}),"line-border-color-use-theme":new Ge({type:"string",default:"default","property-type":"data-driven"})}))},eg);class X1 extends Ge{possiblyEvaluate(e,t){return t=new Zt(Math.floor(t.zoom),{now:t.now,fadeDuration:t.fadeDuration,transition:t.transition,worldview:t.worldview}),super.possiblyEvaluate(e,t)}evaluate(e,t,n,s){return t=Object.assign({},t,{zoom:Math.floor(t.zoom)}),super.evaluate(e,t,n,s)}}let jd;function Zx(r,e){return e>0?e+2*r:r}const Y1=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),K1=zt([{name:"a_globe_anchor",components:3,type:"Int16"},{name:"a_globe_normal",components:3,type:"Float32"}],4),Q1=zt([{name:"a_projected_pos",components:4,type:"Float32"}],4);zt([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const J1=zt([{name:"a_auto_z_offset",components:1,type:"Float32"}],4),ew=zt([{name:"a_feature_index",components:1,type:"Float32"}],4),tw=zt([{name:"a_x_axis",components:3,type:"Float32"},{name:"a_y_axis",components:3,type:"Float32"}]),iw=zt([{name:"a_texb",components:2,type:"Uint16"}]),rw=zt([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_elevation_from_sea",components:2,type:"Float32"}]),nw=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 Wx=zt([{name:"a_pos",components:3,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),ow=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 tg=class Im{constructor(e=null,t=0,n=4096){this.batchIndex=t,this.headerBuffer=null,this.propertiesBuffer=null,this.blockIndicesBuffer=null,this.context=e||null,this.propsDwords=n,this.totalBytes=4*this.propsDwords,this.headerData=new Uint32Array(Im.HEADER_DWORDS),this.propertiesData=new Float32Array(this.propsDwords),this.blockIndicesData=new Uint32Array(this.propsDwords);for(let s=0;s<this.propsDwords;s++)this.blockIndicesData[s]=s;e&&this._initBuffers(e)}_initBuffers(e){const t=e.gl;if(this.totalBytes>e.maxUniformBlockSize)throw new Error(`UBO size ${this.totalBytes} exceeds device limit ${e.maxUniformBlockSize}`);if(this.headerBuffer=t.createBuffer(),!this.headerBuffer)throw new Error("Failed to create header UBO buffer");if(t.bindBuffer(t.UNIFORM_BUFFER,this.headerBuffer),t.bufferData(t.UNIFORM_BUFFER,Im.HEADER_BYTES,t.DYNAMIC_DRAW),this.propertiesBuffer=t.createBuffer(),!this.propertiesBuffer)throw new Error("Failed to create properties UBO buffer");if(t.bindBuffer(t.UNIFORM_BUFFER,this.propertiesBuffer),t.bufferData(t.UNIFORM_BUFFER,this.totalBytes,t.DYNAMIC_DRAW),this.blockIndicesBuffer=t.createBuffer(),!this.blockIndicesBuffer)throw new Error("Failed to create block-indices UBO buffer");t.bindBuffer(t.UNIFORM_BUFFER,this.blockIndicesBuffer),t.bufferData(t.UNIFORM_BUFFER,this.totalBytes,t.DYNAMIC_DRAW),t.bindBuffer(t.UNIFORM_BUFFER,null)}writeHeader(e){const t=this.headerData;t[0]=e.dataDrivenMask,t[1]=e.zoomDependentMask,t[2]=e.dataDrivenBlockSizeVec4,t[3]=e.offsets[0],t[4]=e.offsets[1],t[5]=e.offsets[2],t[6]=e.offsets[3],t[7]=e.offsets[4],t[8]=e.offsets[5],t[9]=e.offsets[6],t[10]=e.offsets[7],t[11]=e.offsets[8]}writeDataDrivenBlock(e,t,n){const s=4*n.dataDrivenBlockSizeVec4;if(s===0)return;const c=t*s;if(c+s>this.propertiesData.length)throw new Error(`UBO write out of bounds: feature index ${t} exceeds propertiesData capacity`);for(let h=0;h<9;h++)n.dataDrivenMask&1<<h&&e[h]!=null&&this._writeProperty(c+n.offsets[h],h,e[h],n.zoomDependentMask)}static getMaxFeatureCount(e,t=4096-Im.HEADER_DWORDS){const n=4*e.dataDrivenBlockSizeVec4;return n===0?1/0:Math.floor(t/n)}_writeProperty(e,t,n,s){const c=this.propertiesData,h=t===8,f=!!(s&1<<t);if(t<2){const p=n;c[e]=p[0],c[e+1]=p[1],c[e+2]=p[2],c[e+3]=p[3]}else if(h&&f){const p=n;c[e]=p[0],c[e+1]=p[1],c[e+2]=p[2],c[e+3]=p[3]}else if(h){const p=n;c[e]=p[0],c[e+1]=p[1]}else if(f){const p=n;c[e]=p[0],c[e+1]=p[1]}else c[e]=n}upload(e){this.context||(this.context=e);const t=e.gl;this.headerBuffer&&this.propertiesBuffer&&this.blockIndicesBuffer||this._initBuffers(e),t.bindBuffer(t.UNIFORM_BUFFER,this.headerBuffer),t.bufferSubData(t.UNIFORM_BUFFER,0,this.headerData),t.bindBuffer(t.UNIFORM_BUFFER,this.propertiesBuffer),t.bufferSubData(t.UNIFORM_BUFFER,0,this.propertiesData),t.bindBuffer(t.UNIFORM_BUFFER,this.blockIndicesBuffer),t.bufferSubData(t.UNIFORM_BUFFER,0,this.blockIndicesData),t.bindBuffer(t.UNIFORM_BUFFER,null)}bind(e,t){const n=e.gl,s=(h,f,p)=>{if(!f)return;const g=n.getUniformBlockIndex(t,h);g!==n.INVALID_INDEX&&(n.uniformBlockBinding(t,g,p),n.bindBufferBase(n.UNIFORM_BUFFER,p,f))},c=3*this.batchIndex;s("SymbolPaintPropertiesHeaderUniform",this.headerBuffer,c),s("SymbolPaintPropertiesUniform",this.propertiesBuffer,c+1),s("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)}}};tg.HEADER_DWORDS=12,tg.HEADER_BYTES=48;let ig=tg;function rg(r,e,t,n){return[Tu(255*r,255*e),Tu(255*t,255*n)]}function Xx(r,e,t,n,s,c,h,f){return!!r&&(r.kind==="constant"?r.value==="none":r.kind==="composite"||r.kind==="source"?r.evaluate({zoom:0,brightness:c,worldview:f},e,t,s,n,h)==="none":typeof r=="string"&&r==="none")}Qe(ig,"SymbolPropertiesUBO",{omit:["headerBuffer","propertiesBuffer","blockIndicesBuffer"]});
7class ng{constructor(e,t,n,s,c="",h,f){this.layer=e,this.zoom=t,this.lut=n,this.isText=s,this.propDefs=this._getPropDefs(),this.worldview=c,this.maxUniformBufferBindings=h||24,this.uboSizeDwords=f||4096,this.featureVertexRangesFromId=new Map,this.allFeatures=[],this.ubos=[],this.featureCount=0,this.cachedHeader=null,this.maxFeaturesPerBatch=0,this.propertyHashToUBOIndex=new Map,this.canDeduplicate=this._checkIfAllPropertiesAreConstant(e,s),this.cachedParams=null,this.cachedParamsNext=null,this.cachedBrightness=void 0,this.cachedConstantUniforms=null,this.cachedConstantRenderZoom=null,this.cachedConstantBrightness=void 0,this.activeAppearanceByVtIndex=new Map}_getPropDefs(){const e=this.isText?"text":"icon";return[{name:`${e}-color`,useThemeName:`${e}-color-use-theme`,isColor:!0},{name:`${e}-halo-color`,useThemeName:`${e}-halo-color-use-theme`,isColor:!0},{name:`${e}-opacity`,useThemeName:null,isColor:!1},{name:`${e}-halo-width`,useThemeName:null,isColor:!1},{name:`${e}-halo-blur`,useThemeName:null,isColor:!1},{name:`${e}-emissive-strength`,useThemeName:null,isColor:!1},{name:`${e}-occlusion-opacity`,useThemeName:null,isColor:!1},{name:"symbol-z-offset",useThemeName:null,isColor:!1},{name:`${e}-translate`,useThemeName:null,isColor:!1,isVec2:!0}]}buildHeader(){const e=this.layer.paint,t=this.propDefs;let n=0,s=0,c=0,h=0;const f=[0,0,0,0,0,0,0,0,0];for(let p=0;p<9;p++){const{name:g,isColor:x,isVec2:b}=t[p],w=e.get(g),S=!(!w||typeof w.isConstant!="function"||w.isConstant()),E=this._appearancesHavePaintProperties(g),A=S||E,P=!(!w||!w.value||w.value.kind!=="composite"),R=this.layer._transitionablePaint._values[g],B=!A&&(R&&R.value&&R.value.expression&&R.value.expression.kind)==="camera";A?(n|=1<<p,P&&(s|=1<<p),x?(h%4!=0&&(h=h+3&-4),f[p]=h,h+=4):b?P?(h%4!=0&&(h=h+3&-4),f[p]=h,h+=4):(h%4==3&&h++,f[p]=h,h+=2):(f[p]=h,h+=P?2:1)):B&&(c|=1<<p)}return{dataDrivenMask:n,zoomDependentMask:s,cameraMask:c,dataDrivenBlockSizeVec4:(h===0?0:h+3&-4)/4,offsets:f}}get hasCameraExpression(){return!(!this.cachedHeader||!this.cachedHeader.cameraMask)}evaluateAllProperties(e,t,n,s,c,h,f){const{params:p,paramsNext:g}=this._getCachedParams(c),x={feature:e,featureState:t,canonical:n,availableImages:s,params:p,paramsNext:g,formattedSection:h},b=this.cachedHeader,w=this.propDefs,S=new Array(9).fill(null);for(let E=0;E<9;E++){const{name:A,useThemeName:P,isColor:R,isVec2:B}=w[E],L=!!(b&&b.zoomDependentMask&1<<E);S[E]=R?this._evaluateColorValue(A,P,x,c,L,f):B?this._evaluateTranslateValue(A,L,x,f):this._evaluateFloatValue(A,L,x,f)}return S}_evaluateColorValue(e,t,n,s,c,h){const f=this.layer.paint,p=e,g=h&&h.hasPaintProperty(p)?h.paintProperties.get(p):f.get(e),x=t,b=t&&h&&h.hasPaintProperty(x)?h.paintProperties.get(x):t?f.get(t):void 0;if(!g)return[0,0,0,1];const w=Xx(b&&typeof b!="string"?b.value:void 0,n.feature,n.featureState,n.availableImages,n.canonical,s,n.formattedSection,this.worldview)?null:this.lut;let S,E;g.isConstant()?S=E=g.constantOr(jt.transparent):(S=g.property.evaluate(g.value,n.params,n.feature,n.featureState,n.canonical,n.availableImages,g.iconImageUseTheme,n.formattedSection),E=c?g.property.evaluate(g.value,n.paramsNext,n.feature,n.featureState,n.canonical,n.availableImages,g.iconImageUseTheme,n.formattedSection):S);const A=(S||jt.transparent).toNonPremultipliedRenderColor(w),P=(E||jt.transparent).toNonPremultipliedRenderColor(w);if(c){const[L,U]=rg(A.r,A.g,A.b,A.a),[G,q]=rg(P.r,P.g,P.b,P.a);return[L,U,G,q]}const[R,B]=rg(A.r,A.g,A.b,A.a);return[R,B,0,0]}_evaluateFloatValue(e,t,n,s){const c=this.layer.paint,h=e.endsWith("opacity")?1:0,f=e,p=s&&s.hasPaintProperty(f)?s.paintProperties.get(f):c.get(e);if(!p)return h;if(p.isConstant())return p.constantOr(h);const g=p.property.evaluate(p.value,n.params,n.feature,n.featureState,n.canonical,n.availableImages,p.iconImageUseTheme,n.formattedSection),x=g??h;if(t){const b=p.property.evaluate(p.value,n.paramsNext,n.feature,n.featureState,n.canonical,n.availableImages,p.iconImageUseTheme,n.formattedSection);return[x,b??h]}return x}_evaluateTranslateValue(e,t,n,s){const c=this.layer.paint,h=e,f=s&&s.hasPaintProperty(h)?s.paintProperties.get(h):c.get(e);if(!f)return[0,0];if(typeof f.isConstant!="function")return f||[0,0];if(f.isConstant())return f.constantOr([0,0]);const p=f.property.evaluate(f.value,n.params,n.feature,n.featureState,n.canonical,n.availableImages,f.iconImageUseTheme,n.formattedSection)||[0,0];if(t){const g=f.property.evaluate(f.value,n.paramsNext,n.feature,n.featureState,n.canonical,n.availableImages,f.iconImageUseTheme,n.formattedSection)||[0,0];return[p[0],p[1],g[0],g[1]]}return p}_getCachedParams(e){return this.cachedParams&&this.cachedParamsNext&&this.cachedBrightness===e||(this.cachedParams=new Zt(this.zoom,{brightness:e,worldview:this.worldview}),this.cachedParamsNext=new Zt(this.zoom+1,{brightness:e,worldview:this.worldview}),this.cachedBrightness=e),{params:this.cachedParams,paramsNext:this.cachedParamsNext}}_appearancesHavePaintProperties(e){return this.layer.getAppearances().some(e!==void 0?t=>t.hasPaintProperty(e):this.isText?t=>t.hasTextPaintProperties():t=>t.hasIconPaintProperties())}_checkIfAllPropertiesAreConstant(e,t){const n=e.paint,s=t?"text":"icon",c=[`${s}-color`,`${s}-halo-color`,`${s}-opacity`,`${s}-halo-width`,`${s}-halo-blur`,`${s}-emissive-strength`,`${s}-occlusion-opacity`,"symbol-z-offset",`${s}-translate`];
7for(const h of c){const f=n.get(h);if(f&&typeof f=="object"&&"isConstant"in f&&!f.isConstant())return!1}return!this._appearancesHavePaintProperties()}_hashDataDrivenValues(e,t){if(t.dataDrivenMask===0)return"";const n=[];for(let s=0;s<9;s++){if(!(t.dataDrivenMask&1<<s))continue;const c=e[s];c==null?n.push("null"):Array.isArray(c)?n.push(c.join(",")):n.push(String(c))}return n.join("|")}getCurrentBatchIndex(){return this.cachedHeader&&this.maxFeaturesPerBatch!==0?Math.floor(this.featureCount/this.maxFeaturesPerBatch):0}populateUBO(e,t,n,s,c,h,f){const p=e.id;if(!this.cachedHeader){this.cachedHeader=this.buildHeader();const P=ig.getMaxFeatureCount(this.cachedHeader,this.uboSizeDwords);this.maxFeaturesPerBatch=isFinite(P)?P:Number.MAX_SAFE_INTEGER}const g=this.cachedHeader,x=this.evaluateAllProperties(e,{},n,s,c,h);if(this.canDeduplicate){const P=this._hashDataDrivenValues(x,g),R=this.propertyHashToUBOIndex.get(P);if(R!==void 0){const B=isFinite(this.maxFeaturesPerBatch)?Math.floor(R/this.maxFeaturesPerBatch):0,L=isFinite(this.maxFeaturesPerBatch)?R%this.maxFeaturesPerBatch:R,U={batchIndex:B,localFeatureIndex:L,vtFeatureIndex:t,featureId:p};return this.allFeatures.push(U),p!=null&&(this.featureVertexRangesFromId.has(p)||this.featureVertexRangesFromId.set(p,[]),this.featureVertexRangesFromId.get(p).push(U)),L}this.propertyHashToUBOIndex.set(P,this.featureCount)}const b=this.featureCount++,w=isFinite(this.maxFeaturesPerBatch)?Math.floor(b/this.maxFeaturesPerBatch):0,S=isFinite(this.maxFeaturesPerBatch)?b%this.maxFeaturesPerBatch:b,E=f?f.maxUniformBufferBindings:this.maxUniformBufferBindings;if(3*w+2>=E){lt(`Too many symbol features: batch ${w} requires binding points up to ${3*w+2}, device limit ${E}. Some features will render incorrectly.`);const P={batchIndex:0,localFeatureIndex:0,vtFeatureIndex:t,featureId:p};return this.allFeatures.push(P),p!=null&&(this.featureVertexRangesFromId.has(p)||this.featureVertexRangesFromId.set(p,[]),this.featureVertexRangesFromId.get(p).push(P)),0}this.ubos[w]||(this.ubos[w]=new ig(f,w,this.uboSizeDwords),this.ubos[w].writeHeader(g)),this.ubos[w].writeDataDrivenBlock(x,S,g);const A={batchIndex:w,localFeatureIndex:S,vtFeatureIndex:t,featureId:p};return this.allFeatures.push(A),p!=null&&(this.featureVertexRangesFromId.has(p)||this.featureVertexRangesFromId.set(p,[]),this.featureVertexRangesFromId.get(p).push(A)),S}updateFeatures(e,t,n,s,c,h,f){if(this.layer=t,this.cachedConstantUniforms=null,!this.cachedHeader)return;const p=this.cachedHeader;for(const g of e){const x=this.featureVertexRangesFromId.get(g);if(!x)continue;const b=h[g]||{};for(const w of x){if(!n)continue;const S=n.feature(w.vtFeatureIndex);if(!S)continue;const E={type:S.type,id:g,properties:S.properties||{},geometry:[]},A=this.activeAppearanceByVtIndex?this.activeAppearanceByVtIndex.get(w.vtFeatureIndex):void 0,P=this.evaluateAllProperties(E,b,s,c,f,void 0,A);this.ubos[w.batchIndex]&&this.ubos[w.batchIndex].writeDataDrivenBlock(P,w.localFeatureIndex,p)}}}updateDynamicExpressions(e,t,n,s,c,h){if(this.layer=e,this.cachedConstantUniforms=null,!this.cachedHeader)return;const f=this.cachedHeader;for(const p of this.allFeatures){if(!t)continue;const g=t.feature(p.vtFeatureIndex);if(!g)continue;const x=p.featureId!=null&&c[p.featureId]||{},b={type:g.type,id:p.featureId,properties:g.properties||{},geometry:[]},w=this.activeAppearanceByVtIndex?this.activeAppearanceByVtIndex.get(p.vtFeatureIndex):void 0,S=this.evaluateAllProperties(b,x,n,s,h,void 0,w);this.ubos[p.batchIndex]&&this.ubos[p.batchIndex].writeDataDrivenBlock(S,p.localFeatureIndex,f)}}updateFeaturePaintForAppearance(e,t,n,s,c,h,f){if(!this.layer||(this.activeAppearanceByVtIndex||(this.activeAppearanceByVtIndex=new Map),this.activeAppearanceByVtIndex.set(e,f||null),!this.cachedHeader))return!1;const p=this.cachedHeader;if(p.dataDrivenMask===0)return!1;let g=!1;for(const x of this.allFeatures){if(x.vtFeatureIndex!==e)continue;const b=this.evaluateAllProperties(t,n,s,c,h,void 0,f);this.ubos[x.batchIndex]&&(this.ubos[x.batchIndex].writeDataDrivenBlock(b,x.localFeatureIndex,p),g=!0)}return g}getConstantUniformValues(e,t){const n=this.cachedHeader,s=!(!n||!n.cameraMask);if(this.cachedConstantUniforms&&this.cachedConstantBrightness===t&&(!s||this.cachedConstantRenderZoom===e))return this.cachedConstantUniforms;const c=this.layer.paint,h=this.propDefs,f=s?new Zt(e,{brightness:t,worldview:this.worldview}):null,p={type:1,id:void 0,properties:{},geometry:[]},g=w=>{const S=h[w],E=c.get(S.name);if(!E)return[0,0,0,1];const A=S.useThemeName?c.get(S.useThemeName):void 0,P=Xx(A&&typeof A!="string"?A.value:void 0,p,{},[],void 0,t,void 0,this.worldview)?null:this.lut;let R;R=n&&n.cameraMask&1<<w&&f?E.property.evaluate(E.value,f,p,{},void 0,[]):E.constantOr(jt.transparent);const B=(R||jt.transparent).toNonPremultipliedRenderColor(P);return[B.r,B.g,B.b,B.a]},x=(w,S)=>{const E=c.get(h[w].name);if(!E)return S;if(n&&n.cameraMask&1<<w&&f){const A=E.property.evaluate(E.value,f,p,{},void 0,[]);return A??S}return E.constantOr(S)},b={fill_np_color:g(0),halo_np_color:g(1),opacity:x(2,1),halo_width:x(3,0),halo_blur:x(4,0),emissive_strength:x(5,0),occlusion_opacity:x(6,1),z_offset:x(7,0)};return this.cachedConstantUniforms=b,this.cachedConstantRenderZoom=e,this.cachedConstantBrightness=t,b}upload(e){for(const t of this.ubos)t.upload(e)}bind(e,t,n=0){this.ubos[n]&&this.ubos[n].bind(e,t)}destroy(){for(const e of this.ubos)e.destroy();this.ubos=[],this.featureVertexRangesFromId.clear(),this.allFeatures=[],this.featureCount=0,this.cachedHeader=null,this.maxFeaturesPerBatch=0,this.propertyHashToUBOIndex&&this.propertyHashToUBOIndex.clear()}}Qe(ng,"SymbolPropertyBinderUBO",{omit:["layer","cachedParams","cachedParamsNext","cachedBrightness","propertyHashToUBOIndex","cachedConstantUniforms","cachedConstantRenderZoom","cachedConstantBrightness","activeAppearanceByVtIndex"]});var cr=24;function sw(r,e,t){return r.sections.forEach(n=>
vendor: 10,298 bytes, line 7
7{n.text=function(s,c,h){const f=c.layout.get("text-transform").evaluate(h,{});return f==="uppercase"?s=s.toLocaleUpperCase():f==="lowercase"&&(s=s.toLocaleLowerCase()),lo.applyArabicShaping&&(s=lo.applyArabicShaping(s)),s}(n.text,e,t)}),r}const Gd={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂","←":"↑","→":"↓"};function aw(r){return r==="︶"||r==="﹈"||r==="︸"||r==="﹄"||r==="﹂"||r==="︾"||r==="︼"||r==="︺"||r==="︘"||r==="﹀"||r==="︐"||r==="︓"||r==="︔"||r==="`"||r===" ̄"||r==="︑"||r==="︒"}function lw(r){return r==="︵"||r==="﹇"||r==="︷"||r==="﹃"||r==="﹁"||r==="︽"||r==="︻"||r==="︹"||r==="︗"||r==="︿"}const og=4294967296,Yx=1/og,Kx=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");let Zp=class{constructor(r=new Uint8Array(16)){this.buf=ArrayBuffer.isView(r)?r:new Uint8Array(r),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(r,e,t=this.length){for(;this.pos<t;){const n=this.readVarint(),s=n>>3,c=this.pos;this.type=7&n,r(s,e,this),this.pos===c&&this.skip(n)}return e}readMessage(r,e){return this.readFields(r,e,this.readVarint()+this.pos)}readFixed32(){const r=this.dataView.getUint32(this.pos,!0);return this.pos+=4,r}readSFixed32(){const r=this.dataView.getInt32(this.pos,!0);return this.pos+=4,r}readFixed64(){const r=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*og;return this.pos+=8,r}readSFixed64(){const r=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*og;return this.pos+=8,r}readFloat(){const r=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,r}readDouble(){const r=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,r}readVarint(r){const e=this.buf;let t,n;return n=e[this.pos++],t=127&n,n<128?t:(n=e[this.pos++],t|=(127&n)<<7,n<128?t:(n=e[this.pos++],t|=(127&n)<<14,n<128?t:(n=e[this.pos++],t|=(127&n)<<21,n<128?t:(n=e[this.pos],t|=(15&n)<<28,function(s,c,h){const f=h.buf;let p,g;if(g=f[h.pos++],p=(112&g)>>4,g<128||(g=f[h.pos++],p|=(127&g)<<3,g<128)||(g=f[h.pos++],p|=(127&g)<<10,g<128)||(g=f[h.pos++],p|=(127&g)<<17,g<128)||(g=f[h.pos++],p|=(127&g)<<24,g<128)||(g=f[h.pos++],p|=(1&g)<<31,g<128))return zu(s,p,c);throw new Error("Expected varint not more than 10 bytes")}(t,r,this)))))}readVarint64(){return this.readVarint(!0)}readSVarint(){const r=this.readVarint();return r%2==1?(r+1)/-2:r/2}readBoolean(){return!!this.readVarint()}readString(){const r=this.readVarint()+this.pos,e=this.pos;return this.pos=r,r-e>=12&&Kx?Kx.decode(this.buf.subarray(e,r)):function(t,n,s){let c="",h=n;for(;h<s;){const f=t[h];let p,g,x,b=null,w=f>239?4:f>223?3:f>191?2:1;if(h+w>s)break;w===1?f<128&&(b=f):w===2?(p=t[h+1],(192&p)==128&&(b=(31&f)<<6|63&p,b<=127&&(b=null))):w===3?(p=t[h+1],g=t[h+2],(192&p)==128&&(192&g)==128&&(b=(15&f)<<12|(63&p)<<6|63&g,(b<=2047||b>=55296&&b<=57343)&&(b=null))):w===4&&(p=t[h+1],g=t[h+2],x=t[h+3],(192&p)==128&&(192&g)==128&&(192&x)==128&&(b=(15&f)<<18|(63&p)<<12|(63&g)<<6|63&x,(b<=65535||b>=1114112)&&(b=null))),b===null?(b=65533,w=1):b>65535&&(b-=65536,c+=String.fromCharCode(b>>>10&1023|55296),b=56320|1023&b),c+=String.fromCharCode(b),h+=w}return c}(this.buf,e,r)}readBytes(){const r=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,r);return this.pos=r,e}readPackedVarint(r=[],e){const t=this.readPackedEnd();for(;this.pos<t;)r.push(this.readVarint(e));return r}readPackedSVarint(r=[]){const e=this.readPackedEnd();for(;this.pos<e;)r.push(this.readSVarint());return r}readPackedBoolean(r=[]){const e=this.readPackedEnd();for(;this.pos<e;)r.push(this.readBoolean());return r}readPackedFloat(r=[]){const e=this.readPackedEnd();for(;this.pos<e;)r.push(this.readFloat());return r}readPackedDouble(r=[]){const e=this.readPackedEnd();for(;this.pos<e;)r.push(this.readDouble());return r}readPackedFixed32(r=[]){const e=this.readPackedEnd();for(;this.pos<e;)r.push(this.readFixed32());return r}readPackedSFixed32(r=[]){const e=this.readPackedEnd();for(;this.pos<e;)r.push(this.readSFixed32());return r}readPackedFixed64(r=[]){const e=this.readPackedEnd();for(;this.pos<e;)r.push(this.readFixed64());return r}readPackedSFixed64(r=[]){const e=this.readPackedEnd();for(;this.pos<e;)r.push(this.readSFixed64());return r}readPackedEnd(){return this.type===2?this.readVarint()+this.pos:this.pos+1}skip(r){const e=7&r;if(e===0)for(;this.buf[this.pos++]>127;);else if(e===2)this.pos=this.readVarint()+this.pos;else if(e===5)this.pos+=4;else{if(e!==1)throw new Error(`Unimplemented type: ${e}`);this.pos+=8}}writeTag(r,e){this.writeVarint(r<<3|e)}realloc(r){let e=this.length||16;for(;e<this.pos+r;)e*=2;if(e!==this.length){const t=new Uint8Array(e);t.set(this.buf),this.buf=t,this.dataView=new DataView(t.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*Yx),!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*Yx),!0),this.pos+=8}writeVarint(r){(r=+r||0)>268435455||r<0?function(e,t){let n,s;if(e>=0?(n=e%4294967296|0,s=e/4294967296|0):(n=~(-e%4294967296),s=~(-e/4294967296),4294967295^n?n=n+1|0:(n=0,s=s+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");t.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)}(n,0,t),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)))))}(s,t)}(r,this):(this.realloc(4),this.buf[this.pos++]=127&r|(r>127?128:0),r<=127||(this.buf[this.pos++]=127&(r>>>=7)|(r>127?128:0),r<=127||(this.buf[this.pos++]=127&(r>>>=7)|(r>127?128:0),r<=127||(this.buf[this.pos++]=r>>>7&127))))}writeSVarint(r){this.writeVarint(r<0?2*-r-1:2*r)}writeBoolean(r){this.writeVarint(+r)}writeString(r){r=String(r),this.realloc(4*r.length),this.pos++;const e=this.pos;this.pos=function(n,s,c){for(let h,f,p=0;p<s.length;p++){if(h=s.charCodeAt(p),h>55295&&h<57344){if(!f){h>56319||p+1===s.length?(n[c++]=239,n[c++]=191,n[c++]=189):f=h;continue}if(h<56320){n[c++]=239,n[c++]=191,n[c++]=189,f=h;continue}h=f-55296<<10|h-56320|65536,f=null}else f&&(n[c++]=239,n[c++]=191,n[c++]=189,f=null);h<128?n[c++]=h:(h<2048?n[c++]=h>>6|192:(h<65536?n[c++]=h>>12|224:(n[c++]=h>>18|240,n[c++]=h>>12&63|128),n[c++]=h>>6&63|128),n[c++]=63&h|128)}return c}(this.buf,r,this.pos);const t=this.pos-e;t>=128&&Qx(e,t,this),this.pos=e-1,this.writeVarint(t),this.pos+=t}writeFloat(r){this.realloc(4),this.dataView.setFloat32(this.pos,r,!0),this.pos+=4}writeDouble(r){this.realloc(8),this.dataView.setFloat64(this.pos,r,!0),this.pos+=8}writeBytes(r){const e=r.length;this.writeVarint(e),this.realloc(e);for(let t=0;t<e;t++)this.buf[this.pos++]=r[t]}writeRawMessage(r,e){this.pos++;const t=this.pos;r(e,this);const n=this.pos-t;n>=128&&Qx(t,n,this),this.pos=t-1,this.writeVarint(n),this.pos+=n}writeMessage(r,e,t){this.writeTag(r,2),this.writeRawMessage(e,t)}writePackedVarint(r,e){e.length&&this.writeMessage(r,cw,e)}writePackedSVarint(r,e){e.length&&this.writeMessage(r,uw,e)}writePackedBoolean(r,e){e.length&&this.writeMessage(r,fw,e)}writePackedFloat(r,e){e.length&&this.writeMessage(r,hw,e)}writePackedDouble(r,e){e.length&&this.writeMessage(r,dw,e)}writePackedFixed32(r,e){e.length&&this.writeMessage(r,pw,e)}writePackedSFixed32(r,e){e.length&&this.writeMessage(r,mw,e)}writePackedFixed64(r,e){e.length&&this.writeMessage(r,_w,e)}writePackedSFixed64(r,e){e.length&&this.writeMessage(r,gw,e)}writeBytesField(r,e){this.writeTag(r,2),this.writeBytes(e)}writeFixed32Field(r,e){this.writeTag(r,5),this.writeFixed32(e)}writeSFixed32Field(r,e){this.writeTag(r,5),this.writeSFixed32(e)}writeFixed64Field(r,e){this.writeTag(r,1),this.writeFixed64(e)}writeSFixed64Field(r,e){this.writeTag(r,1),this.writeSFixed64(e)}writeVarintField(r,e){this.writeTag(r,0),this.writeVarint(e)}writeSVarintField(r,e){this.writeTag(r,0),this.writeSVarint(e)}writeStringField(r,e){this.writeTag(r,2),this.writeString(e)}writeFloatField(r,e){this.writeTag(r,5),this.writeFloat(e)}writeDoubleField(r,e){this.writeTag(r,1),this.writeDouble(e)}writeBooleanField(r,e){this.writeVarintField(r,+e)}};function zu(r,e,t){return t?4294967296*e+(r>>>0):4294967296*(e>>>0)+(r>>>0)}function Qx(r,e,t){const n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));t.realloc(n);for(let s=t.pos-1;s>=r;s--)t.buf[s+n]=t.buf[s]}function cw(r,e){for(let t=0;t<r.length;t++)e.writeVarint(r[t])}function uw(r,e){for(let t=0;t<r.length;t++)e.writeSVarint(r[t])}function hw(r,e){for(let t=0;t<r.length;t++)e.writeFloat(r[t])}function dw(r,e){for(let t=0;t<r.length;t++)e.writeDouble(r[t])}function fw(r,e){for(let t=0;t<r.length;t++)e.writeBoolean(r[t])}function pw(r,e){for(let t=0;t<r.length;t++)e.writeFixed32(r[t])}function mw(r,e){for(let t=0;t<r.length;t++)e.writeSFixed32(r[t])}function _w(r,e){for(let t=0;t<r.length;
7t++)e.writeFixed64(r[t])}function gw(r,e){for(let t=0;t<r.length;t++)e.writeSFixed64(r[t])}function yw(r,e,t){e.glyphs=[],r===1&&t.readMessage(xw,e)}function xw(r,e,t){if(r===3){const{id:n,bitmap:s,width:c,height:h,left:f,top:p,advance:g}=t.readMessage(vw,{});e.glyphs.push({id:n,bitmap:new Ba({width:c+6,height:h+6},s),metrics:{width:c,height:h,left:f,top:p,advance:g}})}else r===4?e.ascender=t.readSVarint():r===5&&(e.descender=t.readSVarint())}function vw(r,e,t){r===1?e.id=t.readVarint():r===2?e.bitmap=t.readBytes():r===3?e.width=t.readVarint():r===4?e.height=t.readVarint():r===5?e.left=t.readSVarint():r===6?e.top=t.readSVarint():r===7&&(e.advance=t.readVarint())}const Tn={horizontal:1,vertical:2,horizontalOnly:3};class qd{constructor(){this.scale=1,this.fontStack="",this.image=null}static forText(e,t){const n=new qd;return n.scale=e||1,n.fontStack=t,n}static forImage(e){const t=new qd;return t.image=e,t}}class Lu{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(e,t,n,s=1){const c=new Lu;for(let h=0;h<e.sections.length;h++){const f=e.sections[h];f.image?c.addImageSection(f,n,s):c.addTextSection(f,t)}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(t,n){let s="";for(let c=0;c<t.length;c++){const h=t.charCodeAt(c+1)||null,f=t.charCodeAt(c-1)||null;s+=!n&&(h&&Hh(h)&&!Gd[t[c+1]]||f&&Hh(f)&&!Gd[t[c-1]])||!Gd[t[c]]?t[c]:Gd[t[c]]}return s}(this.text,e)}trim(){let e=0;for(let n=0;n<this.text.length&&Wp[this.text.charCodeAt(n)];n++)e++;let t=this.text.length;for(let n=this.text.length-1;n>=0&&n>=e&&Wp[this.text.charCodeAt(n)];n--)t--;this.text=this.text.substring(e,t),this.sectionIndex=this.sectionIndex.slice(e,t)}substring(e,t){const n=new Lu;return n.text=this.text.substring(e,t),n.sectionIndex=this.sectionIndex.slice(e,t),n.sections=this.sections,n}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((e,t)=>Math.max(e,this.sections[t].scale),0)}addTextSection(e,t){this.text+=e.text,this.sections.push(qd.forText(e.scale,e.fontStack||t));const n=this.sections.length-1;for(let s=0;s<e.text.length;++s)this.sectionIndex.push(n)}addImageSection(e,t,n=1){const s=e.image?e.image.getPrimary():null;if(!s)return void lt("Can't add FormattedSection with an empty image.");s.scaleSelf(t*n);const c=this.getNextImageSectionCharCode();c?(this.text+=String.fromCodePoint(c),this.sections.push(qd.forImage(s)),this.sectionIndex.push(this.sections.length-1)):lt("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function sg(r,e,t,n,s,c,h,f,p,g,x,b,w,S,E,A=1,P=1){const R=Lu.fromFeature(r,s,A,P);b===Tn.vertical&&R.verticalizePunctuation(w);let B=[];const L=function(X,ee,Q,J,ve,Te,Ie=1){if(!X)return[];const Ce=[],Ee=function(Ae,Pe,Be,Ue,Je,He,qe=1){let je=0;for(let Ye=0;Ye<Ae.length();Ye++){const it=Ae.getSection(Ye);je+=Jx(Ae.getCodePoint(Ye),it,Ue,Je,Pe,He,qe)}return je/Math.max(1,Math.ceil(je/Be))}(X,ee,Q,J,ve,Te,Ie),Oe=X.text.indexOf("​")>=0;let ye=0;for(let Ae=0;Ae<X.length();Ae++){const Pe=X.getSection(Ae),Be=X.getCodePoint(Ae);if(Wp[Be]||(ye+=Jx(Be,Pe,J,ve,ee,Te,Ie)),Ae<X.length()-1){const Ue=Qm(Be);(bw[Be]||Ue||Pe.image)&&Ce.push(tv(Ae+1,ye,Ee,Ce,ww(Be,X.getCodePoint(Ae+1),Ue&&Oe),!1))}}return iv(tv(X.length(),ye,Ee,Ce,0,!0))}(R,g,c,e,n,S,P),{processBidirectionalText:U,processStyledBidirectionalText:G}=lo;if(U&&R.sections.length===1){const X=U(R.toString(),L);for(const ee of X){const Q=new Lu;Q.text=ee,Q.sections=R.sections;for(let J=0;J<ee.length;J++)Q.sectionIndex.push(0);B.push(Q)}}else if(G){const X=G(R.text,R.sectionIndex,L);for(const ee of X){const Q=new Lu;Q.text=ee[0],Q.sectionIndex=ee[1],Q.sections=R.sections,B.push(Q)}}else B=function(X,ee){const Q=[],J=X.text;let ve=0;for(const Te of ee)Q.push(X.substring(ve,Te)),ve=Te;return ve<J.length&&Q.push(X.substring(ve,J.length)),Q}(R,L);const q=[],ie={positionedLines:q,text:R.toString(),top:x[1],bottom:x[1],left:x[0],right:x[0],writingMode:b,iconsInText:!1,verticalizable:!1,hasBaseline:!1};if(function(X,ee,Q,J,ve,Te,Ie,Ce,Ee,Oe,ye,Ae,Pe=1){let Be=0,Ue=0,Je=0;const He=Ce==="right"?1:Ce==="left"?0:.5;let qe=!1;for(const nt of ve){const wt=nt.getSections();for(const Ft of wt){if(Ft.image)continue;const Tt=ee[Ft.fontStack];if(Tt&&(qe=Tt.ascender!==void 0&&Tt.descender!==void 0,!qe))break}if(!qe)break}let je=0;for(const nt of ve){nt.trim();const wt=nt.getMaxScale(),Ft=(wt-1)*cr,Tt={positionedGlyphs:[],lineOffset:0};X.positionedLines[je]=Tt;const Bt=Tt.positionedGlyphs;let Mt=0;if(!nt.length()){Ue+=Te,++je;continue}let Li=0,Wt=0;for(let li=0;li<nt.length();li++){const Mi=nt.getSection(li),ur=nt.getSectionIndex(li),Pi=nt.getCodePoint(li);let Ui=Mi.scale,Ki=null,ji=null,Ar=null,hr=cr,Pt=0,Ur=Ee;Ur===Tn.vertical&&Da(Pi)&&(Ur=Tn.horizontal);const $i=!(Ur===Tn.horizontal||!ye&&!cu(Pi)||ye&&(Wp[Pi]||Qf(Pi)));if(Mi.image){const gr=J.get(Mi.image.toString());if(!gr)continue;Ar=Mi.image,X.iconsInText=X.iconsInText||!0,ji=gr.paddedRect;const jr=gr.displaySize,Cr=jr[0]*Pe,Fi=jr[1]*Pe;Ui=Ui*cr/Ae,Ki={width:Cr,height:Fi,left:0,top:-3,advance:$i?Fi:Cr,localGlyph:!1},Pt=qe?-Ki.height*Ui:wt*cr-17-Fi*Ui,hr=Ki.advance;const Br=($i?Cr:Fi)*Ui-cr*wt;Br>0&&Br>Mt&&(Mt=Br)}else{const gr=Q[Mi.fontStack];if(!gr)continue;gr[Pi]&&(ji=gr[Pi]);const jr=ee[Mi.fontStack];if(!jr)continue;const Cr=jr.glyphs[Pi];if(!Cr)continue;if(Ki=Cr.metrics,hr=Pi!==8203?cr:0,qe){const Fi=jr.ascender!==void 0?Math.abs(jr.ascender):0,Br=jr.descender!==void 0?Math.abs(jr.descender):0,yr=(Fi+Br)*Ui;Li<yr&&(Li=yr,Wt=(Fi-Br)/2*Ui),Pt=-Fi*Ui}else Pt=(wt-Ui)*cr-17}$i?(X.verticalizable=!0,Bt.push({glyph:Pi,image:Ar,x:Be,y:Ue+Pt,vertical:$i,scale:Ui,localGlyph:Ki.localGlyph,fontStack:Mi.fontStack,sectionIndex:ur,metrics:Ki,rect:ji}),Be+=hr*Ui+Oe):(Bt.push({glyph:Pi,image:Ar,x:Be,y:Ue+Pt,vertical:$i,scale:Ui,localGlyph:Ki.localGlyph,fontStack:Mi.fontStack,sectionIndex:ur,metrics:Ki,rect:ji}),Be+=Ki.advance*Ui+Oe)}Bt.length!==0&&(Je=Math.max(Be-Oe,Je),qe?rv(Bt,He,Mt,Wt,Te*wt/2):rv(Bt,He,Mt,0,Te/2)),Be=0;const Ut=Te*wt+Mt;Tt.lineOffset=Math.max(Mt,Ft),Ue+=Ut,++je}const Ye=Ue,{horizontalAlign:it,verticalAlign:ht}=ag(Ie);(function(nt,wt,Ft,Tt,Bt,Mt){const Li=(wt-Ft)*Bt,Wt=-Mt*Tt;for(const Ut of nt)for(const li of Ut.positionedGlyphs)li.x+=Li,li.y+=Wt})(X.positionedLines,He,it,ht,Je,Ye),X.top+=-ht*Ye,X.bottom=X.top+Ye,X.left+=-it*Je,X.right=X.left+Je,X.hasBaseline=qe}(ie,e,t,n,B,h,f,p,b,g,w,E,P),!function(X){for(const ee of X)if(ee.positionedGlyphs.length!==0)return!1;return!0}(q))return ie}const Wp={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},bw={10:!0,32:!0,38:!0,40:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0};function Jx(r,e,t,n,s,c,h=1){if(e.image){const f=n.get(e.image.toString());return f?f.displaySize[0]*h*e.scale*cr/c+s:0}{const f=t[e.fontStack],p=f&&f.glyphs[r];return p?p.metrics.advance*e.scale+s:0}}function ev(r,e,t,n){const s=Math.pow(r-e,2);return n?r<e?s/2:2*s:s+Math.abs(t)*t}function ww(r,e,t){let n=0;return r===10&&(n-=1e4),t&&(n+=150),r!==40&&r!==65288||(n+=50),e!==41&&e!==65289||(n+=50),n}function tv(r,e,t,n,s,c){let h=null,f=ev(e,t,s,c);for(const p of n){const g=ev(e-p.x,t,s,c)+p.badness;g<=f&&(h=p,f=g)}return{index:r,x:e,priorBreak:h,badness:f}}function iv(r){return r?iv(r.priorBreak).concat(r.index):[]}function ag(r){let e=.5,t=.5;switch(r){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0}switch(r){case"bottom":case"bottom-right":case"bottom-left":t=1;break;case"top":case"top-right":case"top-left":t=0}return{horizontalAlign:e,verticalAlign:t}}function rv(r,e,t,n,s){if(!(e||t||n||s))return;const c=r.length-1,h=r[c],f=(h.x+h.metrics.advance*h.scale)*e;for(let p=0;p<=c;p++)r[p].x-=f,r[p].y+=t+n+s}function lg(r){return r.imagePrimary!==void 0&&r.top!==void 0&&r.bottom!==void 0&&r.left!==void 0&&r.right!==void 0}function Xp(r,e,t,n){const{horizontalAlign:s,verticalAlign:c}=ag(n),h=t[0]-r.displaySize[0]*s,f=t[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 cg(r,e,t,n,s,c){const h=r.imagePrimary;let f;if(h.content){const P=h.content,R=h.pixelRatio||1;f=[P[0]/R,P[1]/R,h.displaySize[0]-P[2]/R,h.displaySize[1]-P[3]/R]}const p=e.left*c,g=e.right*c;let x,b,w,S;
vendor: 18,122 bytes, line 7
7t==="width"||t==="both"?(S=s[0]+p-n[3],b=s[0]+g+n[1]):(S=s[0]+(p+g-h.displaySize[0])/2,b=S+h.displaySize[0]);const E=e.top*c,A=e.bottom*c;return t==="height"||t==="both"?(x=s[1]+E-n[0],w=s[1]+A+n[2]):(x=s[1]+(E+A-h.displaySize[1])/2,w=x+h.displaySize[1]),{imagePrimary:h,imageSecondary:void 0,top:x,right:b,bottom:w,left:S,collisionPadding:f}}function nv(r){return!r.imagePrimary.stretchX}function ov(r){return!r.imagePrimary.stretchY}function sv(r){return{width:r.right-r.left,height:r.bottom-r.top}}const Hs=128;function Kl(r,e,t,n){const{expression:s}=e;if(s.kind==="constant")return{kind:"constant",layoutSize:s.evaluate(new Zt(r+1,{worldview:t}),void 0,void 0,void 0,n)};if(s.kind==="source")return{kind:"source"};{const{zoomStops:c,interpolationType:h}=s;let f=0;for(;f<c.length&&c[f]<=r;)f++;f=Math.max(0,f-1);let p=f;for(;p<c.length&&c[p]<r+1;)p++;p=Math.min(c.length-1,p);const g=c[f],x=c[p];return s.kind==="composite"?{kind:"composite",minZoom:g,maxZoom:x,interpolationType:h}:{kind:"camera",minZoom:g,maxZoom:x,minSize:s.evaluate(new Zt(g,{worldview:t}),void 0,void 0,void 0,n),maxSize:s.evaluate(new Zt(x,{worldview:t}),void 0,void 0,void 0,n),interpolationType:h}}}function ug(r,{uSize:e,uSizeT:t},{lowerSize:n,upperSize:s}){return r.kind==="source"?n/Hs:r.kind==="composite"?dt(n/Hs,s/Hs,t):e}function Fu(r,e,t=1){let n=0,s=0;if(r.kind==="constant")s=r.layoutSize*t;else if(r.kind!=="source"){const{interpolationType:c,minZoom:h,maxZoom:f}=r,p=c?k(on.interpolationFactor(c,e,h,f),0,1):0;r.kind==="camera"?s=dt(r.minSize,r.maxSize,p)*t:n=p*t}return{uSizeT:n,uSize:s}}class Zs extends Fe{constructor(e,t,n,s,c){super(e,t),this.angle=s,this.z=n,c!==void 0&&(this.segment=c)}clone(){return new Zs(this.x,this.y,this.z,this.angle,this.segment)}}function av(r,e,t,n,s){if(e.segment===void 0)return!0;let c=e,h=e.segment+1,f=0;for(;f>-t/2;){if(h--,h<0)return!1;f-=r[h].dist(c),c=r[h]}f+=r[h].dist(r[h+1]),h++;const p=[];let g=0;for(;f<t/2;){const x=r[h],b=r[h+1];if(!b)return!1;let w=r[h-1].angleTo(x)-x.angleTo(b);for(w=Math.abs((w+3*Math.PI)%(2*Math.PI)-Math.PI),p.push({distance:f,angleDelta:w}),g+=w;f-p[0].distance>n;)g-=p.shift().angleDelta;if(g>s)return!1;h++,f+=x.dist(b)}return!0}function lv(r){let e=0;for(let t=0;t<r.length-1;t++)e+=r[t].dist(r[t+1]);return e}function cv(r,e,t){return r?.6*e*t:0}function uv(r,e){return Math.max(r?r.right-r.left:0,e?e.right-e.left:0)}function Tw(r,e,t,n,s,c){const h=cv(t,s,c),f=uv(t,n)*c;let p=0;const g=lv(r)/2;for(let x=0;x<r.length-1;x++){const b=r[x],w=r[x+1],S=b.dist(w);if(p+S>g){const E=(g-p)/S,A=dt(b.x,w.x,E),P=dt(b.y,w.y,E),R=new Zs(A,P,0,w.angleTo(b),x);return!h||av(r,R,f,h,e)?R:void 0}p+=S}}function Sw(r,e,t,n,s,c,h,f,p){const g=cv(n,c,h),x=uv(n,s),b=x*h,w=r[0].x===0||r[0].x===p||r[0].y===0||r[0].y===p;return e-b<e/4&&(e=b+e/4),hv(r,w?e/2*f%e:(x/2+2*c)*h*f%e,e,g,t,b,w,!1,p)}function hv(r,e,t,n,s,c,h,f,p){const g=c/2,x=lv(r);let b=0,w=e-t,S=[];for(let E=0;E<r.length-1;E++){const A=r[E],P=r[E+1],R=A.dist(P),B=P.angleTo(A);for(;w+t<b+R;){w+=t;const L=(w-b)/R,U=dt(A.x,P.x,L),G=dt(A.y,P.y,L);if(U>=0&&U<p&&G>=0&&G<p&&w-g>=0&&w+g<=x){const q=new Zs(U,G,0,B,E);n&&!av(r,q,c,n,s)||S.push(q)}}b+=R}return f||S.length||h||(S=hv(r,b/2,t,n,s,c,h,!0,p)),S}function dv(r){let e=0,t=0;for(const h of r)e+=h.w*h.h,t=Math.max(t,h.w);r.sort((h,f)=>f.h-h.h);const n=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),t),h:1/0}];let s=0,c=0;for(const h of r)for(let f=n.length-1;f>=0;f--){const p=n[f];if(!(h.w>p.w||h.h>p.h)){if(h.x=p.x,h.y=p.y,c=Math.max(c,h.y+h.h),s=Math.max(s,h.x+h.w),h.w===p.w&&h.h===p.h){const g=n.pop();g&&f<n.length&&(n[f]=g)}else h.h===p.h?(p.x+=h.w,p.w-=h.w):h.w===p.w?(p.y+=h.h,p.h-=h.h):(n.push({x:p.x+h.w,y:p.y,w:p.w-h.w,h:h.h}),p.y+=h.h,p.h-=h.h);break}}return{w:s,h:c,fill:e/(s*c)||0}}function Yp(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 hg(r){let e=0;for(let t=0;t<r.length;t++)e=(e<<5)-e+r.charCodeAt(t),e&=e;return e}function Fo(r,e){return(r<<5)-r+e}function fv(r,e,t,n){for(const[s]of r.entries()){const c=n&&n.get(s)||Dn.parse(s),h=c.id.toString(),f=e.get(h)||0;t.push({id:s,version:f,sx:c.sx,sy:c.sy})}}Qe(Zs,"Anchor");class dg{constructor(e,t,n,s,c){this.iconDescriptors=[],this.patternDescriptors=[],this.requiresMipMaps=t.size>0,fv(e,n,this.iconDescriptors,c),fv(t,n,this.patternDescriptors,c),this.iconDescriptors.sort(Yp),this.patternDescriptors.sort(Yp);let h=0;const f=s?s.data:"";f&&(h=Fo(h,hg(f))),h=Fo(h,1);for(const p of this.iconDescriptors)h=Fo(h,hg(p.id)),h=Fo(h,p.version),h=Fo(h,p.sx),h=Fo(h,p.sy);h=Fo(h,1);for(const p of this.patternDescriptors)h=Fo(h,hg(p.id)),h=Fo(h,p.version),h=Fo(h,p.sx),h=Fo(h,p.sy);this.hash=h}subsetOf(e){return this.isSubsetArray(this.iconDescriptors,e.iconDescriptors,Yp)&&this.isSubsetArray(this.patternDescriptors,e.patternDescriptors,Yp)}isSubsetArray(e,t,n){let s=0,c=0;if(e.length>t.length)return!1;for(;s<e.length&&c<t.length;){const h=n(e[s],t[c]);if(h===0)s++,c++;else{if(h<0)return!1;c++}}return s===e.length}}Qe(dg,"AtlasContentDescriptor");class $d{static getImagePositionScale(e,t,n){if(t&&e){const{sx:s,sy:c}=e;return{x:s,y:c}}return{x:n,y:n}}constructor(e,t,n,s){this.paddedRect=e;const{pixelRatio:c,version:h,stretchX:f,stretchY:p,content:g,sdf:x,usvg:b}=t;this.pixelRatio=c,this.stretchX=f,this.stretchY=p,this.content=g,this.version=h,this.padding=n,this.sdf=x,this.usvg=b,this.scale=$d.getImagePositionScale(s,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 fg(r,e,t){const n=Dn.parse(r),s=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,t,[n.sx,n.sy]);return{bin:s,imagePosition:new $d(s,e,t,n),imageVariant:n}}function pg(r,e){const t=[];for(const[s,c]of r.entries()){const h=Dn.parse(s);h&&(t.push({key:s,value:c,variant:h}),e&&e.set(s,h))}t.sort((s,c)=>{const h=s.variant.id.toString().localeCompare(c.variant.id.toString());return h!==0?h:s.variant.sx!==c.variant.sx?s.variant.sx-c.variant.sx:s.variant.sy!==c.variant.sy?s.variant.sy-c.variant.sy:0});const n=new Map;for(const s of t)n.set(s.key,s.value);return n}class pv{constructor(e){this.sourceAtlasHash=e}}class mv{constructor(e,t,n,s){const c=new Map,h=new Map;this.haveRenderCallbacks=[];const f=[],p=s!==void 0,g=p?new Map:void 0,x=p?pg(e,g):e,b=p?pg(t,g):t;this.addImages(x,c,1,f),this.addImages(b,h,2,f);const{w,h:S}=dv(f),E=new Dr({width:w||1,height:S||1});for(const[A,P]of x.entries()){const R=c.get(A).paddedRect;Dr.copy(P.data,E,{x:0,y:0},{x:R.x+1,y:R.y+1},P.data,null,P.sdf)}for(const[A,P]of b.entries()){const R=h.get(A),B=R.paddedRect;let L=R.padding;const U=B.x+L,G=B.y+L,q=P.data.width,ie=P.data.height;L=L>1?L-1:L,Dr.copy(P.data,E,{x:0,y:0},{x:U,y:G},P.data,n),Dr.copy(P.data,E,{x:0,y:ie-L},{x:U,y:G-L},{width:q,height:L},n),Dr.copy(P.data,E,{x:0,y:0},{x:U,y:G+ie},{width:q,height:L},n),Dr.copy(P.data,E,{x:q-L,y:0},{x:U-L,y:G},{width:L,height:ie},n),Dr.copy(P.data,E,{x:0,y:0},{x:U+q,y:G},{width:L,height:ie},n),Dr.copy(P.data,E,{x:q-L,y:ie-L},{x:U-L,y:G-L},{width:L,height:L},n),Dr.copy(P.data,E,{x:0,y:ie-L},{x:U+q,y:G-L},{width:L,height:L},n),Dr.copy(P.data,E,{x:0,y:0},{x:U+q,y:G+ie},{width:L,height:L},n),Dr.copy(P.data,E,{x:q-L,y:0},{x:U-L,y:G+ie},{width:L,height:L},n)}this.lut=n,this.image=E,this.iconPositions=c,this.patternPositions=h,p&&(this.contentDescriptor=new dg(x,b,s,n,g))}addImages(e,t,n,s){for(const[c,h]of e.entries()){const{bin:f,imagePosition:p,imageVariant:g}=fg(c,h,n);t.set(c,p),s.push(f),h.hasRenderCallback&&this.haveRenderCallbacks.push(g.id)}}patchUpdatedImages(e,t,n,s){this.haveRenderCallbacks=this.haveRenderCallbacks.filter(c=>e.hasImage(c,n)),e.dispatchRenderCallbacks(this.haveRenderCallbacks,n);for(const c of e.getUpdatedImages(n)){for(const h of this.iconPositions.keys()){const f=Dn.parse(h);if(nn.isEqual(f.id,c)){const p=e.getImage(c,n);this.patchUpdatedImage(this.iconPositions.get(h),p,t,null)}}for(const h of this.patternPositions.keys()){const f=Dn.parse(h);if(nn.isEqual(f.id,c)){const p=e.getImage(c,n);this.patchUpdatedImage(this.patternPositions.get(h),p,t,s||this.lut)}}}}patchUpdatedImage(e,t,n,s=null){if(!e||!t||e.version===t.version)return;e.version=t.version;const[c,h]=e.tl,f=e.sdf;if(this.lut||f){const p={width:t.data.width,height:t.data.height},g=new Dr(p);Dr.copy(t.data,g,{x:0,y:0},{x:0,y:0},p,s,f),n.update(g,{position:{x:c,y:h},recreateWhenResize:!1})}else n.update(t.data,{position:{x:c,y:h},recreateWhenResize:!1})}}Qe($d,"ImagePosition"),Qe(mv,"ImageAtlas",{omit:["lut"]}),Qe(pv,"ImageAtlasReference");const Hd=1e20;function _v(r,e,t,n,s,c,h,f,p){for(let g=e;g<e+n;g++)gv(r,t*c+g,c,s,h,f,p);for(let g=t;g<t+s;g++)gv(r,g*c+e,1,n,h,f,p)}function gv(r,e,t,n,s,c,h){c[0]=0,h[0]=-Hd,h[1]=Hd,s[0]=r[e];for(let f=1,p=0,g=0;f<n;f++){s[f]=r[e+f*t];const x=f*f;do{const b=c[p];g=(s[f]-s[b]+x-b*b)/(f-b)/2}while(g<=h[p]&&--p>-1);p++,c[p]=f,h[p]=g,h[p+1]=Hd}for(let f=0,p=0;f<n;f++){for(;h[p+1]<f;)p++;const g=c[p],x=f-g;r[e+f*t]=s[g]+x*x}}const mg={none:0,ideographs:1,all:2};class Ql{constructor(e,t,n){this.requestManager=e,this.localGlyphMode=t,this.localFontFamily=n,this.url="",this.entries={},this.localGlyphs={200:{},400:{},500:{},900:{}}}setURL(e){this.url=e}prefetchRange(e,t){const n=this.url||Nt.GLYPHS_URL;if(!n)return;let s=this.entries[e];s||(s=this.entries[e]={glyphs:{},requests:{},ranges:{}}),s.ranges[t]||s.requests[t]||(s.requests[t]=[],Ql.loadGlyphRange(e,t,n,this.requestManager,(c,h)=>{if(h){s.ascender=h.ascender,s.descender=h.descender;for(const f in h.glyphs)this._doesCharSupportLocalGlyph(+f)||(s.glyphs[+f]=h.glyphs[+f]);s.ranges[t]=!0}for(const f of s.requests[t]||[])f(c,h);delete s.requests[t]}))}getGlyphs(e,t){const n=[],s=this.url||Nt.GLYPHS_URL;for(const c in e)for(const h of e[c])n.push({stack:c,id:h});ae(n,({stack:c,id:h},f)=>{let p=this.entries[c];p||(p=this.entries[c]={glyphs:{},requests:{},ranges:{},ascender:void 0,descender:void 0});let g=p.glyphs[h];if(g!==void 0)return void f(null,{stack:c,id:h,glyph:g});if(g=this._tinySDF(p,c,h),g)return p.glyphs[h]=g,void f(null,{stack:c,id:h,glyph:g});const x=Math.floor(h/256);if(256*x>65535)return lt("glyphs > 65535 not supported"),void f(null,{stack:c,id:h,glyph:g});if(p.ranges[x])return void f(null,{stack:c,id:h,glyph:g});let b=p.requests[x];b||(b=p.requests[x]=[],Ql.loadGlyphRange(c,x,s,this.requestManager,(w,S)=>{if(S){p.ascender=S.ascender,p.descender=S.descender;for(const E in S.glyphs)this._doesCharSupportLocalGlyph(+E)||(p.glyphs[+E]=S.glyphs[+E]);p.ranges[x]=!0}for(const E of b)E(w,S);delete p.requests[x]})),b.push((w,S)=>{w?f(w):S&&f(null,{stack:c,id:h,glyph:S.glyphs[h]||null})})},(c,h)=>{if(c)t(c);else if(h){const f={};for(const{stack:p,id:g,glyph:x}of h)f[p]===void 0&&(f[p]={}),f[p].glyphs===void 0&&(f[p].glyphs={}),f[p].glyphs[g]=x&&{id:x.id,bitmap:x.bitmap.clone(),metrics:x.metrics},f[p].ascender=this.entries[p].ascender,f[p].descender=this.entries[p].descender;t(null,f)}})}_doesCharSupportLocalGlyph(e){return this.localGlyphMode!==mg.none&&(this.localGlyphMode===mg.all?!!this.localFontFamily:!!this.localFontFamily&&(Pa(e)||lu(e)||Ma(e)||Cl(e)||Ca(e)||au(e)||(t=e)>=131072&&t<=173791||(n=>n>=66736&&n<=66815)(e)));var t}_tinySDF(e,t,n){const s=this.localFontFamily;if(!s||!this._doesCharSupportLocalGlyph(n))return;let c=e.tinySDF;if(!c){let P="400";/bold/i.test(t)?P="900":/medium/i.test(t)?P="500":/light/i.test(t)&&(P="200"),c=e.tinySDF=new Ql.TinySDF({fontFamily:s,fontWeight:P,fontSize:48,buffer:6,radius:16}),c.fontWeight=P}const h=c.fontWeight;if(this.localGlyphs[h][n])return this.localGlyphs[h][n];const f=String.fromCodePoint(n),{data:p,width:g,height:x,glyphWidth:b,glyphHeight:w,glyphLeft:S,glyphTop:E,glyphAdvance:A}=c.draw(f);return this.localGlyphs[h][n]={id:n,bitmap:new Ba({width:g,height:x},p),metrics:{width:b/2,height:w/2,left:S/2,top:E/2-27,advance:A/2,localGlyph:!0}}}}function yv(r,e){return r+e[1]-e[0]}function _g(r,e,t,n,s=1){const c=[],h=r.imagePrimary,f=h.pixelRatio,p=h.paddedRect.w-2,g=h.paddedRect.h-2,x=(r.right-r.left)*s,b=(r.bottom-r.top)*s,w=h.stretchX||[[0,p]],S=h.stretchY||[[0,g]],E=w.reduce(yv,0),A=S.reduce(yv,0),P=p-E,R=g-A;let B=0,L=E,U=0,G=A,q=0,ie=P,X=0,ee=R;if(h.content&&n){const J=h.content;B=Kp(w,0,J[0]),U=Kp(S,0,J[1]),L=Kp(w,J[0],J[2]),G=Kp(S,J[1],J[3]),q=J[0]-B,X=J[1]-U,ie=J[2]-J[0]-L,ee=J[3]-J[1]-G}const Q=(J,ve,Te,Ie)=>{const Ce=Qp(J.stretch-B,L,x,r.left*s),Ee=Jp(J.fixed-q,ie,J.stretch,E),Oe=Qp(ve.stretch-U,G,b,r.top*s),ye=Jp(ve.fixed-X,ee,ve.stretch,A),Ae=Qp(Te.stretch-B,L,x,r.left*s),Pe=Jp(Te.fixed-q,ie,Te.stretch,E),Be=Qp(Ie.stretch-U,G,b,r.top*s),Ue=Jp(Ie.fixed-X,ee,Ie.stretch,A),Je=new Fe(Ce,Oe),He=new Fe(Ae,Oe),qe=new Fe(Ae,Be),je=new Fe(Ce,Be),Ye=new Fe(Ee/f,ye/f),it=new Fe(Pe/f,Ue/f),ht=e*Math.PI/180;if(ht){const Mt=Math.sin(ht),Li=Math.cos(ht),Wt=[Li,-Mt,Mt,Li];Je._matMult(Wt),He._matMult(Wt),je._matMult(Wt),qe._matMult(Wt)}const nt=J.stretch+J.fixed,wt=Te.stretch+Te.fixed,Ft=ve.stretch+ve.fixed,Tt=Ie.stretch+Ie.fixed,Bt=r.imageSecondary;return{tl:Je,tr:He,bl:je,br:qe,texPrimary:{x:h.paddedRect.x+1+nt,y:h.paddedRect.y+1+Ft,w:wt-nt,h:Tt-Ft},texSecondary:Bt?{x:Bt.paddedRect.x+1+nt,y:Bt.paddedRect.y+1+Ft,w:wt-nt,h:Tt-Ft}:void 0,writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Ye,pixelOffsetBR:it,minFontScaleX:ie/f/x,minFontScaleY:ee/f/b,isSDF:t}};if(h.stretchX||h.stretchY){const J=xv(w,P,E),ve=xv(S,R,A);for(let Te=0;Te<J.length-1;Te++){const Ie=J[Te],Ce=J[Te+1];for(let Ee=0;Ee<ve.length-1;Ee++)c.push(Q(Ie,ve[Ee],Ce,ve[Ee+1]))}}else c.push(Q({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:p+1},{fixed:0,stretch:g+1}));return c}function Iw(r,e){const t=r.stretchY||[[0,r.paddedRect.h-2]];return r.stretchX||r.stretchY?vv(r.stretchX||[[0,r.paddedRect.w-2]])*vv(t):1}function Kp(r,e,t){let n=0;for(const s of r)n+=Math.max(e,Math.min(t,s[1]))-Math.max(e,Math.min(t,s[0]));return n}function xv(r,e,t){const n=[{fixed:-1,stretch:0}];for(const[s,c]of r){const h=n[n.length-1];n.push({fixed:s-h.stretch,stretch:h.stretch}),n.push({fixed:s-h.stretch,stretch:h.stretch+(c-s)})}return n.push({fixed:e+1,stretch:t}),n}function vv(r){return 2*r.length+1}function Qp(r,e,t,n){return r/e*t+n}function Jp(r,e,t,n){return r-e*t/n}function Ew(r,e,t,n){const s=e+r.positionedLines[n].lineOffset;return n===0?t+s/2:t+(s+(e+r.positionedLines[n-1].lineOffset))/2}function bv(r,e,t,n,s,c,h,f,p,g=1){const x=[];if(e.positionedLines.length===0)return x;const b=(p!==void 0?p:n.layout.get("text-rotate").evaluate(c,{}))*Math.PI/180,w=function(R){const B=R[0],L=R[1],U=B*L;return U>0?[B,-L]:U<0?[-B,L]:B===0?[L,B]:[L,-B]}(t);let S=Math.abs(e.top-e.bottom);for(const R of e.positionedLines)S-=R.lineOffset;const E=e.positionedLines.length,A=S/E;let P=e.top-t[1];for(let R=0;R<E;++R){const B=e.positionedLines[R];P=Ew(e,A,P,R);for(const L of B.positionedGlyphs){if(!L.rect)continue;const U=L.rect||{};let G=4,q=!0,ie=1,X=0;if(L.image){const qe=h.get(L.image.toString());if(!qe)continue;if(qe.sdf){lt("SDF images are not supported in formatted text and will be ignored.");continue}q=!1,ie=qe.pixelRatio,G=1/ie,qe.usvg||(ie/=g)}const ee=(s||f)&&L.vertical,Q=L.metrics.advance*L.scale/2,J=L.metrics,ve=L.rect;if(ve===null)continue;f&&e.verticalizable&&(X=L.image?Q-L.metrics.width*L.scale/2:0);const Te=s?[L.x+Q,L.y]:[0,0];let Ie=[0,0],Ce=[0,0],Ee=!1;s||(ee?(Ce=[L.x+Q+w[0],L.y+w[1]-X],Ee=!0):Ie=[L.x+Q+t[0],L.y+t[1]-X]);const Oe=ve.w*L.scale/(ie*(L.localGlyph?2:1)),ye=ve.h*L.scale/(ie*(L.localGlyph?2:1));let Ae,Pe,Be,Ue;if(ee){const qe=L.y-P,je=new Fe(-Q,Q-qe),Ye=-Math.PI/2,it=new Fe(...Ce);Ae=new Fe(-Q+Ie[0],Ie[1]),Ae._rotateAround(Ye,je)._add(it),Ae.x+=-qe+Q,Ae.y-=(J.left-G)*L.scale;const ht=L.image?J.advance*L.scale:cr*L.scale,nt=String.fromCodePoint(L.glyph);aw(nt)?Ae.x+=(1-G)*L.scale:lw(nt)?Ae.x+=ht-J.height*L.scale+(-G-1)*L.scale:Ae.x+=L.image||J.width+2*G===ve.w&&J.height+2*G===ve.h?(ht-ye)/2:(ht-(J.height+2*G)*L.scale)/2,Pe=new Fe(Ae.x,Ae.y-Oe),Be=new Fe(Ae.x+ye,Ae.y),Ue=new Fe(Ae.x+ye,Ae.y-Oe)}else{const qe=(J.left-G)*L.scale-Q+Ie[0],je=(-J.top-G)*L.scale+Ie[1],Ye=qe+Oe,it=je+ye;Ae=new Fe(qe,je),Pe=new Fe(Ye,je),Be=new Fe(qe,it),Ue=new Fe(Ye,it)}if(b){let qe;qe=s?new Fe(0,0):Ee?new Fe(w[0],w[1]):new Fe(t[0],t[1]),Ae._rotateAround(b,qe),Pe._rotateAround(b,qe),Be._rotateAround(b,qe),Ue._rotateAround(b,qe)}const Je=new Fe(0,0),He=new Fe(0,0);x.push({tl:Ae,tr:Pe,bl:Be,br:Ue,texPrimary:U,texSecondary:void 0,writingMode:e.writingMode,glyphOffset:Te,sectionIndex:L.sectionIndex,isSDF:q,pixelOffsetTL:Je,pixelOffsetBR:He,minFontScaleX:0,minFontScaleY:0})}}return x}function Aw(r,e=1,t=!1){let n=1/0,s=1/0,c=-1/0,h=-1/0;const f=r[0];for(let S=0;S<f.length;S++){const E=f[S];(!S||E.x<n)&&(n=E.x),(!S||E.y<s)&&(s=E.y),(!S||E.x>c)&&(c=E.x),(!S||E.y>h)&&(h=E.y)}const p=Math.min(c-n,h-s);let g=p/2;const x=new gl([],Cw);if(p===0)return new Fe(n,s);for(let S=n;S<c;S+=p)for(let E=s;E<h;E+=p)x.push(new Ou(S+g,E+g,g,r));let b=function(S){let E=0,A=0,P=0;const R=S[0];for(let B=0,L=R.length,U=L-1;B<L;U=B++){const G=R[B],q=R[U],ie=G.x*q.y-q.x*G.y;A+=(G.x+q.x)*ie,P+=(G.y+q.y)*ie,E+=3*ie}return new Ou(A/E,P/E,0,S)}(r),w=x.length;for(;x.length;){const S=x.pop();(S.d>b.d||!b.d)&&(b=S,t&&console.log("found best %d after %d probes",Math.round(1e4*S.d)/1e4,w)),S.max-b.d<=e||(g=S.h/2,x.push(new Ou(S.p.x-g,S.p.y-g,g,r)),x.push(new Ou(S.p.x+g,S.p.y-g,g,r)),x.push(new Ou(S.p.x-g,S.p.y+g,g,r)),x.push(new Ou(S.p.x+g,S.p.y+g,g,r)),w+=4)}return t&&(console.log(`num probes: ${w}`),console.log(`best distance: ${b.d}`)),b.p}function Cw(r,e){return e.max-r.max}Ql.loadGlyphRange=function(r,e,t,n,s){const c=256*e,h=c+255,f=n.transformRequest(n.normalizeGlyphsURL(t).replace("{fontstack}",r).replace("{range}",`${c}-${h}`),rl.Glyphs);nl(f,(p,g)=>{if(p)s(p);else if(g){const x={},b=function(w){return new Zp(w).readFields(yw,{})}(g);for(const w of b.glyphs)x[w.id]=w;
7s(null,{glyphs:x,ascender:b.ascender,descender:b.descender})}})},Ql.TinySDF=class{constructor({fontSize:r=24,buffer:e=3,radius:t=8,cutoff:n=.25,fontFamily:s="sans-serif",fontWeight:c="normal",fontStyle:h="normal",lang:f=null}={}){this.buffer=e,this.cutoff=n,this.radius=t,this.lang=f;const p=this.size=r+4*e,g=this._createCanvas(p),x=this.ctx=g.getContext("2d",{willReadFrequently:!0});x.font=`${h} ${c} ${r}px ${s}`,x.textBaseline="alphabetic",x.textAlign="left",x.fillStyle="black",this.gridOuter=new Float64Array(p*p),this.gridInner=new Float64Array(p*p),this.f=new Float64Array(p),this.z=new Float64Array(p+1),this.v=new Uint16Array(p)}_createCanvas(r){const e=document.createElement("canvas");return e.width=e.height=r,e}draw(r){const{width:e,actualBoundingBoxAscent:t,actualBoundingBoxDescent:n,actualBoundingBoxLeft:s,actualBoundingBoxRight:c}=this.ctx.measureText(r),h=Math.ceil(t),f=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(c-s))),p=Math.min(this.size-this.buffer,h+Math.ceil(n)),g=f+2*this.buffer,x=p+2*this.buffer,b=Math.max(g*x,0),w=new Uint8ClampedArray(b),S={data:w,width:g,height:x,glyphWidth:f,glyphHeight:p,glyphTop:h,glyphLeft:0,glyphAdvance:e};if(f===0||p===0)return S;const{ctx:E,buffer:A,gridInner:P,gridOuter:R}=this;this.lang&&(E.lang=this.lang),E.clearRect(A,A,f,p),E.fillText(r,A,A+h);const B=E.getImageData(A,A,f,p);R.fill(Hd,0,b),P.fill(0,0,b);for(let L=0;L<p;L++)for(let U=0;U<f;U++){const G=B.data[4*(L*f+U)+3]/255;if(G===0)continue;const q=(L+A)*g+U+A;if(G===1)R[q]=0,P[q]=Hd;else{const ie=.5-G;R[q]=ie>0?ie*ie:0,P[q]=ie<0?ie*ie:0}}_v(R,0,0,g,x,g,this.f,this.v,this.z),_v(P,A,A,f,p,g,this.f,this.v,this.z);for(let L=0;L<b;L++){const U=Math.sqrt(R[L])-Math.sqrt(P[L]);w[L]=Math.round(255-255*(U/this.radius+this.cutoff))}return S}};class Ou{constructor(e,t,n,s){this.p=new Fe(e,t),this.h=n,this.d=function(c,h){let f=!1,p=1/0;for(let g=0;g<h.length;g++){const x=h[g];for(let b=0,w=x.length,S=w-1;b<w;S=b++){const E=x[b],A=x[S];E.y>c.y!=A.y>c.y&&c.x<(A.x-E.x)*(c.y-E.y)/(A.y-E.y)+E.x&&(f=!f),p=Math.min(p,ho(c,E,A))}}return(f?1:-1)*Math.sqrt(p)}(this.p,s),this.max=this.d+this.h*Math.SQRT2}}const Mw=Object.keys,gg=Number.POSITIVE_INFINITY,Pw=Math.sqrt(2);function Ua(r,e,t,n,s,c){const h=lg(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 n!==void 0&&function(p,g){p.top*=g,p.bottom*=g,p.left*=g,p.right*=g,p.scaled=!0}(f,n),c&&(f.left+=c[0],f.right+=c[0],f.top+=c[1],f.bottom+=c[1]),t&&function(p,g,x){if(!g)return;const b=Vt(g),w=new Fe(x?x[0]:0,x?x[1]:0),S=new Fe(p.left,p.top),E=new Fe(p.right,p.top),A=new Fe(p.left,p.bottom),P=new Fe(p.right,p.bottom);S._rotateAround(b,w),E._rotateAround(b,w),A._rotateAround(b,w),P._rotateAround(b,w),p.left=Math.min(S.x,E.x,A.x,P.x),p.right=Math.max(S.x,E.x,A.x,P.x),p.top=Math.min(S.y,E.y,A.y,P.y),p.bottom=Math.max(S.y,E.y,A.y,P.y)}(f,t,s),e?{top:Math.min(e.top,f.top),bottom:Math.max(e.bottom,f.bottom),left:Math.min(e.left,f.left),right:Math.max(e.right,f.right),scaled:e.scaled||f.scaled}:f}function wv(r,[e,t]){let n=0,s=0;if(t===gg){e<0&&(e=0);const c=e/Pw;switch(r){case"top-right":case"top-left":s=c-7;break;case"bottom-right":case"bottom-left":s=7-c;break;case"bottom":s=7-e;break;case"top":s=e-7}switch(r){case"top-right":case"bottom-right":n=-c;break;case"top-left":case"bottom-left":n=c;break;case"left":n=e;break;case"right":n=-e}}else{switch(e=Math.abs(e),t=Math.abs(t),r){case"top-right":case"top-left":case"top":s=t-7;break;case"bottom-right":case"bottom-left":case"bottom":s=7-t}switch(r){case"top-right":case"bottom-right":case"right":n=-e;break;case"top-left":case"bottom-left":case"left":n=e}}return[n,s]}function Dw(r,e,t,n,s,c,h,f,p,g,x,b,w,S,E){const A=r.layers[0],P=A.appearances;if(P.length===0)return{iconBBox:null,iconVerticalBBox:null,textBBox:null,textVerticalBBox:null};const R={iconBBox:null,iconVerticalBBox:null},B={textBBox:null,textVerticalBBox:null},{baseIconRotate:L,baseTextRotate:U,iconScaleFactor:G}=function(ie,X,ee){const Q=ie.get("icon-rotate").evaluate(X,{},ee),J=ie.get("text-rotate").evaluate(X,{},ee),[ve,Te]=ie.get("icon-size-scale-range");return{baseIconRotate:Q,baseTextRotate:J,iconScaleFactor:k(1,ve,Te)}}(n,s,c);e&&(R.iconBBox=Ua(e,R.iconBBox,L),t)&&(R.iconVerticalBBox=Ua(t,R.iconVerticalBBox,L+90));const q=tm(b.horizontal);q&&(B.textBBox=Ua(q,B.textBBox,U,1,S)),b.vertical&&(B.textVerticalBBox=Ua(b.vertical,B.textVerticalBBox,U+90,1,S));for(const ie of P)ie.hasIconLayoutProperties()&&Rw(R,r,A,ie,s,c,f,L,h,p,e,g,G,x,E),ie.hasTextLayoutProperties()&&zw(B,A,ie,s,c,S,U,w,q,b.vertical);return{iconBBox:R.iconBBox,iconVerticalBBox:R.iconVerticalBBox,textBBox:B.textBBox,textVerticalBBox:B.textVerticalBBox}}function Rw(r,e,t,n,s,c,h,f,p,g,x,b,w,S,E){const{appearanceIconOffset:A,appearanceIconRotate:P,appearanceIconSize:R}=Tv(n,t,s,c,h,f,p,g.iconScaleFactor);
7let B=null,L=null,U=null;n.hasLayoutProperty("icon-image")?U=function(q,ie,X,ee,Q,J,ve,Te){let Ie=null;const Ce=ie.getAppearanceValueAndResolveTokens(X,"icon-image",ee,Q,Te);if(Ce){const Ee=q.getResolvedImageFromTokens(Ce),Oe=X.hasLayoutProperty("icon-size")?X.getUnevaluatedLayoutProperty("icon-size"):ie._unevaluatedLayout._values["icon-size"],ye=Zd(Ee,Kl(q.zoom,Oe,q.worldview,Te),Oe,Q,q.zoom,ee,q.pixelRatio,ve,q.worldview,Te);Ie=J.get(ye.iconPrimary.toString())}return Ie}(e,t,n,s,c,b,w,E):x&&(U=x.imagePrimary),U&&(B=Xp(U,null,A,S),e.allowVerticalPlacement&&(L=Xp(U,null,A,S)));const G=p>0?R/p:1;B&&(r.iconBBox=Ua(B,r.iconBBox,P,G!==1?G:void 0)),L&&(r.iconVerticalBBox=Ua(L,r.iconVerticalBBox,P+90,G!==1?G:void 0))}function Tv(r,e,t,n,s,c,h,f){const p=r.hasLayoutProperty("icon-offset")?e.getAppearanceValueAndResolveTokens(r,"icon-offset",t,n,[]):null,g=p&&Array.isArray(p)?p:s,x=r.hasLayoutProperty("icon-rotate")?e.getAppearanceValueAndResolveTokens(r,"icon-rotate",t,n,[]):null,b=typeof x=="number"?x:c,w=r.hasLayoutProperty("icon-size")?e.getAppearanceValueAndResolveTokens(r,"icon-size",t,n,[]):null;return{appearanceIconOffset:g,appearanceIconRotate:b,appearanceIconSize:typeof w=="number"?w*f:h}}function zw(r,e,t,n,s,c,h,f,p,g){const{appearanceTextOffset:x,appearanceTextRotate:b,appearanceTextSize:w}=Sv(t,e,n,s,c,h,f),S=w/f,E=[(x[0]-c[0])*S,(x[1]-c[1])*S],A=E[0]!==0||E[1]!==0;p&&(r.textBBox=Ua(p,r.textBBox,b,S,x,A?E:void 0)),g&&(r.textVerticalBBox=Ua(g,r.textVerticalBBox,b+90,S,x,A?E:void 0))}function Sv(r,e,t,n,s,c,h){const f=r.hasLayoutProperty("text-offset")?e.getAppearanceValueAndResolveTokens(r,"text-offset",t,n,[]):null,p=f&&Array.isArray(f)?[f[0]*cr,f[1]*cr]:s,g=r.hasLayoutProperty("text-rotate")?e.getAppearanceValueAndResolveTokens(r,"text-rotate",t,n,[]):null,x=typeof g=="number"?g:c,b=r.hasLayoutProperty("text-size")?e.getAppearanceValueAndResolveTokens(r,"text-size",t,n,[]):null;return{appearanceTextOffset:p,appearanceTextRotate:x,appearanceTextSize:typeof b=="number"?b:h}}function em(r,e,t,n,s,c,h,f,p){if(!e||!e.usvg)return;const g=sv(n),x=sv(s),b=c!=="both"&&c!=="width"||!nv(n)?1:x.width/g.width,w=c!=="both"&&c!=="height"||!ov(n)?1:x.height/g.height;t.scaleSelf(b,w);const S=t.toString();h.set(S,t),f.set(S,e);const{imagePosition:E}=fg(S,e,1);p.set(S,E)}function Iv(r,e,t,n,s,c,h,f,p,g){if(!r)return;const x=function(b,w,S,E,A,P,R){if(b.kind==="camera")return b.maxSize;if(b.kind==="composite"){const B=w.possiblyEvaluate(new Zt(b.maxZoom,{worldview:P}),S,R).evaluate(A,{},S,R),L=w.possiblyEvaluate(new Zt(b.minZoom,{worldview:P}),S,R).evaluate(A,{},S,R);return Math.max(B,L)}return w.possiblyEvaluate(new Zt(E,{worldview:P}),S,R).evaluate(A,{},S,R)}(e,t,n,s,c,p,g);return r.scaleSelf(x*f*h)}function Zd(r,e,t,n,s,c,h,f,p,g){return{iconPrimary:Iv(r.getPrimary(),e,t,n,s,c,h,f,p,g),iconSecondary:Iv(r.getSecondary(),e,t,n,s,c,h,f,p,g)}}function Lw(r,e,t){if(!e)return;const n=t.get(r.toString()),s=t.get(e.toString());n&&s&&(n.paddedRect.w===s.paddedRect.w&&n.paddedRect.h===s.paddedRect.h||lt(`Mismatch in icon variant sizes: ${r.toString()} and ${e.toString()}`),n.usvg!==s.usvg&&lt(`Mismatch in icon variant image types: ${r.id} and ${e.id}`))}function Ev(r,e,t,n){if(!r)return;const s=e.get(t.toString());if(s&&(r.imagePrimary=s),n){const c=e.get(n.toString());r.imageSecondary=c}}function Fw(r,e){for(const t in r.horizontal)Av(r.horizontal[t],e);Av(r.vertical,e)}function Av(r,e){if(r){for(const t of r.positionedLines)for(const n of t.positionedGlyphs)if(n.image!==null){const s=n.image.toString();n.rect=e.get(s).paddedRect}}}function yg(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 Ow(r,e,t,n,s,c,h,f,p){const g=tm(c.horizontal)||c.vertical,x=t.get("icon-text-fit-padding").evaluate(n,{},s);let b,w=e;return e&&p!=="none"&&(r.allowVerticalPlacement&&c.vertical&&(b=cg(e,c.vertical,p,x,f,h)),g&&(w=cg(e,g,p,x,f,h))),{defaultShapedIcon:w,verticallyShapedIcon:b}}function Cv(r,e){return r*e/24}function Bw(r,e,t,n,s,c,h,f,p,g,x,b,w,S,E,A,P,R,B,L,U,G,q,ie){let X=h.textMaxSize.evaluate(e,{},w);X===void 0?X=f*h.textScaleFactor:X*=h.textScaleFactor;const ee=r.layers[0].layout,Q=Cv(f,h.textScaleFactor),J=tm(t.horizontal)||t.vertical,ve=r.hasAnyAppearanceLayoutProperty(["text-size","text-offset","text-rotate"]),Te=r.getAppearanceFeatureData(e.index);(P!=="none"||ve)&&Te&&(Te.textShaping=J,Te.iconTextFitPadding=ee.get("icon-text-fit-padding").evaluate(e,{},w),Te.fontScale=Q,Te.textScaleFactor=h.textScaleFactor);const Ie=S.name==="globe",Ce=r.tilePixelRatio*X/24,Ee=(Ue=r.overscaling,r.zoom>18&&Ue>2&&(Ue>>=1),Math.max(Ze/(512*Ue),1)*ee.get("symbol-spacing")),Oe=ee.get("text-padding")*r.tilePixelRatio,ye=ee.get("icon-padding")*r.tilePixelRatio,Ae=Vt(ee.get("text-max-angle")),Pe=ee.get("icon-rotation-alignment")==="map"&&L!=="point",Be=Ee/2;var Ue;r.hasAnyIconTextFit===!1&&P!=="none"&&(r.hasAnyIconTextFit=!0);const Je=e.properties?+e.properties[Et]:null,He=Je&&r.elevationFeatureIdToIndex?r.elevationFeatureIdToIndex.get(Je):65535,qe=(je,Ye,it)=>{if(Ye.x<0||Ye.x>=Ze||Ye.y<0||Ye.y>=Ze)return;let ht=null;if(Ie){const{x:nt,y:wt,z:Ft}=S.projectTilePoint(Ye.x,Ye.y,it);ht={anchor:new Zs(nt,wt,Ft,0,void 0),up:S.upVector(it,Ye.x,Ye.y)}}(function(nt,wt,Ft,Tt,Bt,Mt,Li,Wt,Ut,li,Mi,ur,Pi,Ui,Ki,ji,Ar,hr,Pt,Ur,$i,gr,jr,Cr,Fi,Br,yr,xm,qu,Yr,jg,$u){const Ws=nt.addToLineVertexArray(wt,Tt);let Xs,Yn,Kn,nc,Hu,Dt,xr,Gi=0,sr=0,Qn=0,Sn=0,In=-1,En=-1;const mo={};let vm=ra("");const Vo=Ft?Ft.anchor:wt,Zu=xm!=="none";let Wu=0,nr=0;if(Ut._unevaluatedLayout.getValue("text-radial-offset")===void 0){const Hi=Ut.layout.get("text-offset").evaluate($i,{},Fi);Wu=Hi[0]*cr,nr=Hi[1]*cr}else Wu=Ut.layout.get("text-radial-offset").evaluate($i,{},Fi)*cr,nr=gg;if(nt.allowVerticalPlacement&&Bt.vertical){const Hi=Bt.vertical;if(Ki)Dt=bg(Hi),Wt&&(xr=bg(Wt));else{const Gr=Ut.layout.get("text-rotate").evaluate($i,{},Fi)+90;Kn=im(li,Vo,wt,Mi,ur,Pi,Hi,Ui,Gr,ji,$u),Wt&&(nc=im(li,Vo,wt,Mi,ur,Pi,Wt,hr,Gr,null,jg))}}if(Mt){const Hi=Ut.layout.get("icon-rotate").evaluate($i,{},Fi),Gr=_g(Mt,Hi,jr,Zu,gr.iconScaleFactor),Kr=Wt?_g(Wt,Hi,jr,Zu,gr.iconScaleFactor):void 0;Yn=im(li,Vo,wt,Mi,ur,Pi,Mt,hr,Hi,null,Yr);const go=function(No,cf,Xu,QT,JT,X0,Y0,e2,l2,qg){const K0=No.layers[0],Q0=K0.appearances;let Yu=cf.length;if(Xu&&(Yu=Math.max(Yu,Xu.length)),Q0.length===0)return Yu;const[t2,i2]=QT.get("icon-size-scale-range"),r2=k(1,t2,i2);for(const Sm of Q0)if(Sm.hasLayoutProperty("icon-image")){const J0=K0.getAppearanceValueAndResolveTokens(Sm,"icon-image",X0,Y0,qg);if(J0){const eb=No.getResolvedImageFromTokens(J0);if(eb){const tb=Sm.hasLayoutProperty("icon-size")?Sm.getUnevaluatedLayoutProperty("icon-size"):JT._values["icon-size"],n2=Zd(eb,Kl(No.zoom,tb,No.worldview,qg),tb,Y0,No.zoom,X0,No.pixelRatio,r2,No.worldview,qg),ib=e2.get(n2.iconPrimary.toString());ib&&(Yu=Math.max(Yu,Iw(ib)))}}}return Yu}(nt,Gr,Kr,Ut.layout,Ut._unevaluatedLayout,$i,Fi,nt.iconAtlasPositions,0,Cr);Gi=4*go;const bm=Ut.layout.get("icon-size").evaluate($i,{},Fi,Cr),wm=gr.compositeIconSizes?gr.compositeIconSizes[0].evaluate($i,{},Fi,Cr):0,Gg=gr.compositeIconSizes?gr.compositeIconSizes[1].evaluate($i,{},Fi,Cr):0,Tm=vg(nt.layerIds[0],nt.iconSizeData,bm,gr.iconScaleFactor,wm,Gg);nt.addSymbols(nt.icon,Gr,Tm,Ur,Pt,$i,void 0,Ft,wt,Ws.lineStartIndex,Ws.lineLength,-1,Cr,Fi,Br,yr,nt.symbolInstances.length,go),In=nt.icon.placedSymbolArray.length-1,Kr&&(sr=4*go,nt.addSymbols(nt.icon,Kr,Tm,Ur,Pt,$i,Tn.vertical,Ft,wt,Ws.lineStartIndex,Ws.lineLength,-1,Cr,Fi,Br,yr,nt.symbolInstances.length,go),En=nt.icon.placedSymbolArray.length-1)}for(const Hi in Bt.horizontal){const Gr=Hi,Kr=Bt.horizontal[Gr];Xs||(vm=ra(Kr.text),Ki?Hu=bg(Kr):Xs=im(li,Vo,wt,Mi,ur,Pi,Kr,Ui,Ut.layout.get("text-rotate").evaluate($i,{},Fi),ji,$u));const go=Kr.positionedLines.length===1;if(Qn+=Mv(nt,Ft,wt,Kr,Li,Ut,Ki,$i,ji,Ws,Bt.vertical?Tn.horizontal:Tn.horizontalOnly,go?Mw(Bt.horizontal):[Gr],mo,In,gr,Cr,Fi,nt.symbolInstances.length,Br),go)break}Bt.vertical&&(Sn+=Mv(nt,Ft,wt,Bt.vertical,Li,Ut,Ki,$i,ji,Ws,Tn.vertical,["vertical"],mo,En,gr,Cr,Fi,nt.symbolInstances.length,Br));let Ji=-1;const ar=(Hi,Gr)=>Hi?Math.max(Hi,Gr):Gr;Ji=ar(Hu,Ji),Ji=ar(Dt,Ji),Ji=ar(xr,Ji);const _o=Ji>-1?1:0;nt.glyphOffsetArray.length>=65535&&lt("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),$i.sortKey!==void 0&&nt.addToSortKey
7Ranges(nt.symbolInstances.length,$i.sortKey),nt.symbolInstances.emplaceBack(wt.x,wt.y,Vo.x,Vo.y,Vo.z,mo.right>=0?mo.right:-1,mo.center>=0?mo.center:-1,mo.left>=0?mo.left:-1,mo.vertical>=0?mo.vertical:-1,In,En,vm,Xs!==void 0?Xs:nt.collisionBoxArray.length,Xs!==void 0?Xs+1:nt.collisionBoxArray.length,Kn!==void 0?Kn:nt.collisionBoxArray.length,Kn!==void 0?Kn+1:nt.collisionBoxArray.length,Yn!==void 0?Yn:nt.collisionBoxArray.length,Yn!==void 0?Yn+1:nt.collisionBoxArray.length,nc||nt.collisionBoxArray.length,nc?nc+1:nt.collisionBoxArray.length,Mi,Qn,Sn,Gi,sr,_o,0,Wu,nr,Ji,0,Zu?1:0,qu)})(r,Ye,ht,je,t,n,c,s,r.layers[0],r.collisionBoxArray,e.index,e.sourceLayerIndex,r.index,Oe,B,g,0,ye,Pe,R,e,h,x,b,w,E,A,P,He,U,G,q)};if(L==="line")for(const je of Op(e.geometry,0,0,Ze,Ze)){const Ye=Sw(je,Ee,Ae,t.vertical||J,n,24,Ce,r.overscaling,Ze);for(const it of Ye)J&&kw(r,J.text,Be,it)||qe(je,it,w)}else if(L==="line-center"){for(const je of e.geometry)if(je.length>1){const Ye=Tw(je,Ae,t.vertical||J,n,24,Ce);Ye&&qe(je,Ye,w)}}else if(e.type==="Polygon")for(const je of Pd(e.geometry,0)){const Ye=Aw(je,16);qe(je[0],new Zs(Ye.x,Ye.y,0,0,void 0),w)}else if(e.type==="LineString")for(const je of e.geometry)qe(je,new Zs(je[0].x,je[0].y,0,0,void 0),w);else if(e.type==="Point")for(const je of e.geometry)for(const Ye of je)qe([Ye],new Zs(Ye.x,Ye.y,0,0,void 0),w)}const xg=255,Jl=xg*Hs;function Mv(r,e,t,n,s,c,h,f,p,g,x,b,w,S,E,A,P,R,B){const L=bv(0,n,p,c,h,f,s,r.allowVerticalPlacement,void 0,E.textScaleFactor),U=c.layout.get("text-size").evaluate(f,{},P),G=E.compositeTextSizes?E.compositeTextSizes[0].evaluate(f,{},P):0,q=E.compositeTextSizes?E.compositeTextSizes[1].evaluate(f,{},P):0,ie=vg(r.layerIds[0],r.textSizeData,U,E.textScaleFactor,G,q);r.addSymbols(r.text,L,ie,p,h,f,x,e,t,g.lineStartIndex,g.lineLength,S,A,P,B,!1,R,L.length);for(const X of b)w[X]=r.text.placedSymbolArray.length-1;return 4*L.length}function vg(r,e,t,n,s,c){const h=e;let f=null;return h.kind==="source"?(f=[Hs*t*n],f[0]>Jl&&lt(`${r}: Value for "text-size" is >= ${xg}. Reduce your "text-size".`)):h.kind==="composite"&&(f=[Hs*s*n,Hs*c*n],(f[0]>Jl||f[1]>Jl)&&lt(`${r}: Value for "text-size" is >= ${xg}. Reduce your "text-size".`)),f}function tm(r){for(const e in r)return r[e];return null}function im(r,e,t,n,s,c,h,f,p,g,x){let b,w,S,E;if(b=x?x.top:h.top,w=x?x.bottom:h.bottom,S=x?x.left:h.left,E=x?x.right:h.right,lg(h)&&h.collisionPadding){const A=h.collisionPadding;S-=A[0],b-=A[1],E+=A[2],w+=A[3]}if(p){const A=new Fe(S,b),P=new Fe(E,b),R=new Fe(S,w),B=new Fe(E,w),L=Vt(p);let U=new Fe(0,0);g&&(U=new Fe(g[0],g[1])),A._rotateAround(L,U),P._rotateAround(L,U),R._rotateAround(L,U),B._rotateAround(L,U),S=Math.min(A.x,P.x,R.x,B.x),E=Math.max(A.x,P.x,R.x,B.x),b=Math.min(A.y,P.y,R.y,B.y),w=Math.max(A.y,P.y,R.y,B.y)}return r.emplaceBack(e.x,e.y,e.z,t.x,t.y,S,b,E,w,f,n,s,c),r.length-1}function bg(r){lg(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 kw(r,e,t,n){const s=r.compareText;if(e in s){const c=s[e];for(let h=c.length-1;h>=0;h--)if(n.dist(c[h])<t)return!0}else s[e]=[];return s[e].push(n),!1}function Pv(r,e){const t=r.fovAboveCenter,n=r.elevation?r.elevation.getMinElevationBelowMSL()*e:0,s=Math.min(n,r.isOrthographic?-10*e:0),c=(r._camera.position[2]*r.worldSize-s)/Math.cos(r._pitch),h=Math.sin(t)*c/Math.sin(Math.max(Math.PI/2-r._pitch-t,.01));let f=Math.sin(r._pitch)*h+c;const p=c*(1/r._horizonShift);if(!r.elevation||r.elevation.exaggeration()===0){let g=Math.max(r.zoom-17,0);r.isOrthographic&&(g/=10),f*=1+g}return Math.min(1.01*f,p)}function ec(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 t=Math.pow(2,-r.z),n=r.x*t,s=(r.x+1)*t,c=r.y*t,h=(r.y+1)*t,f=le(n),p=le(s),g=xe(c),x=xe(h),b=e.project(f,g),w=e.project(p,g),S=e.project(p,x),E=e.project(f,x);let A=Math.min(b.x,w.x,S.x,E.x),P=Math.min(b.y,w.y,S.y,E.y),R=Math.max(b.x,w.x,S.x,E.x),B=Math.max(b.y,w.y,S.y,E.y);const L=t/16;function U(q,ie,X,ee,Q,J){const ve=(X+Q)/2,Te=(ee+J)/2,Ie=e.project(le(ve),xe(Te)),Ce=Math.max(0,A-Ie.x,P-Ie.y,Ie.x-R,Ie.y-B);A=Math.min(A,Ie.x),R=Math.max(R,Ie.x),P=Math.min(P,Ie.y),B=Math.max(B,Ie.y),Ce>L&&(U(q,Ie,X,ee,ve,Te),U(Ie,ie,ve,Te,Q,J))}U(b,w,n,c,s,c),U(w,S,s,c,s,h),U(S,E,s,h,n,h),U(E,b,n,h,n,c),A-=L,P-=L,R+=L,B+=L;const G=1/Math.max(R-A,B-P);return{scale:G,x:A*G,y:P*G,x2:R*G,y2:B*G,projection:e}}function Dv(r,{x:e,y:t},n=0){return new Fe(((e-n)*r.scale-r.x)*Ze,(t*r.scale-r.y)*Ze)}const Vw=Ei(new Float32Array(16));
vendor: 8,730 bytes, line 7
7class ja{constructor(e){this.spec=e,this.name=e.name,this.wrap=!1,this.requiresDraping=!1,this.supportsWorldCopies=!1,this.supportsTerrain=!1,this.supportsFog=!1,this.supportsFreeCamera=!1,this.zAxisUnit="meters",this.isReprojectedInTileSpace=!0,this.unsupportedLayers=["custom"],this.center=[0,0],this.range=[3.5,7]}project(e,t){return{x:0,y:0,z:0}}unproject(e,t){return new se(0,0)}projectTilePoint(e,t,n){return{x:e,y:t,z:0}}locationPoint(e,t,n,s=!0){return e._coordinatePoint(e.locationCoordinate(t,n),s)}pixelsPerMeter(e,t){return fe(1,e)*t}pixelSpaceConversion(e,t,n){return 1}farthestPixelDistance(e){return Pv(e,e.pixelsPerMeter)}pointCoordinate(e,t,n,s){const c=e.horizonLineFromTop(!1),h=new Fe(t,Math.max(c,n));return e.rayIntersectionCoordinate(e.pointRayIntersection(h,s))}pointCoordinate3D(e,t,n){const s=new Fe(t,n);if(e.elevation)return e.elevation.pointCoordinate(s);{const c=this.pointCoordinate(e,s.x,s.y,0);return[c.x,c.y,c.z]}}isPointAboveHorizon(e,t){if(e.elevation&&e.elevation.visibleDemTiles.length)return!this.pointCoordinate3D(e,t.x,t.y);const n=e.horizonLineFromTop();return t.y<n}createInversionMatrix(e,t){return Vw}createTileMatrix(e,t,n){let s,c,h;const f=n.canonical,p=Ei(new Float64Array(16));if(this.isReprojectedInTileSpace){const g=ec(f,this);s=1,c=g.x+n.wrap*g.scale,h=g.y,Mr(p,p,[s/g.scale,s/g.scale,e.pixelsPerMeter/t])}else s=t/e.zoomScale(f.z),c=(f.x+Math.pow(2,f.z)*n.wrap)*s,h=f.y*s;return Qr(p,p,[c,h,0]),Mr(p,p,[s/Ze,s/Ze,1]),p}upVector(e,t,n){return[0,0,1]}upVectorScale(e,t,n){return{metersToTile:1}}}class Nw extends ja{constructor(e){super(e),this.range=[4,7],this.center=e.center||[-96,37.5];const[t,n]=this.parallels=e.parallels||[29.5,45.5],s=Math.sin(Vt(t));this.n=(s+Math.sin(Vt(n)))/2,this.c=1+s*(2*this.n-s),this.r0=Math.sqrt(this.c)/this.n}project(e,t){const{n,c:s,r0:c}=this,h=Vt(e-this.center[0]),f=Vt(t),p=Math.sqrt(s-2*n*Math.sin(f))/n;return{x:p*Math.sin(h*n),y:p*Math.cos(h*n)-c,z:0}}unproject(e,t){const{n,c:s,r0:c}=this,h=c+t;let f=Math.atan2(e,Math.abs(h))*Math.sign(h);h*n<0&&(f-=Math.PI*Math.sign(e)*Math.sign(h));const p=Vt(this.center[0])*n;f=oe(f,-Math.PI-p,Math.PI-p);const g=k(Zi(f/n)+this.center[0],-180,180),x=Math.asin(k((s-(e*e+h*h)*n*n)/(2*n),-1,1)),b=k(Zi(x),-85.051129,Se);return new se(g,b)}}const Wd=1.340264,Xd=-.081106,Yd=893e-6,Kd=.003796,rm=Math.sqrt(3)/2;class Uw extends ja{project(e,t){t=t/180*Math.PI,e=e/180*Math.PI;const n=Math.asin(rm*Math.sin(t)),s=n*n,c=s*s*s;return{x:.5*(e*Math.cos(n)/(rm*(Wd+3*Xd*s+c*(7*Yd+9*Kd*s)))/Math.PI+.5),y:1-.5*(n*(Wd+Xd*s+c*(Yd+Kd*s))/Math.PI+1),z:0}}unproject(e,t){e=(2*e-.5)*Math.PI;let n=t=(2*(1-t)-1)*Math.PI,s=n*n,c=s*s*s;for(let x,b,w,S=0;S<12&&(b=n*(Wd+Xd*s+c*(Yd+Kd*s))-t,w=Wd+3*Xd*s+c*(7*Yd+9*Kd*s),x=b/w,n=k(n-x,-Math.PI/3,Math.PI/3),s=n*n,c=s*s*s,!(Math.abs(x)<1e-12));++S);const h=rm*e*(Wd+3*Xd*s+c*(7*Yd+9*Kd*s))/Math.cos(n),f=Math.asin(Math.sin(n)/rm),p=k(180*h/Math.PI,-180,180),g=k(180*f/Math.PI,-85.051129,Se);return new se(p,g)}}class jw extends ja{constructor(e){super(e),this.wrap=!0,this.supportsWorldCopies=!0}project(e,t){return{x:.5+e/360,y:.5-t/360,z:0}}unproject(e,t){const n=360*(e-.5),s=k(360*(.5-t),-85.051129,Se);return new se(n,s)}}const Bu=Math.PI/2;function nm(r){return Math.tan((Bu+r)/2)}class Gw extends ja{constructor(e){super(e),this.center=e.center||[0,30];const[t,n]=this.parallels=e.parallels||[30,30];let s=Vt(t),c=Vt(n);this.southernCenter=s+c<0,this.southernCenter&&(s=-s,c=-c);const h=Math.cos(s),f=nm(s);this.n=s===c?Math.sin(s):Math.log(h/Math.cos(c))/Math.log(nm(c)/f),this.f=h*Math.pow(nm(s),this.n)/this.n}project(e,t){t=Vt(t),this.southernCenter&&(t=-t),e=Vt(e-this.center[0]);const n=1e-6,{n:s,f:c}=this;c>0?t<-Bu+n&&(t=-Bu+n):t>Bu-n&&(t=Bu-n);const h=c/Math.pow(nm(t),s);let f=h*Math.sin(s*e),p=c-h*Math.cos(s*e);return f=.5*(f/Math.PI+.5),p=.5*(p/Math.PI+.5),{x:f,y:this.southernCenter?p:1-p,z:0}}unproject(e,t){e=(2*e-.5)*Math.PI,this.southernCenter&&(t=1-t),t=(2*(1-t)-.5)*Math.PI;const{n,f:s}=this,c=s-t,h=Math.sign(c),f=Math.sign(n)*Math.sqrt(e*e+c*c);let p=Math.atan2(e,Math.abs(c))*h;c*n<0&&(p-=Math.PI*Math.sign(e)*h);const g=k(Zi(p/n)+this.center[0],-180,180),x=k(Zi(2*Math.atan(Math.pow(s/f,1/n))-Bu),-85.051129,Se);return new se(g,this.southernCenter?-x:x)}}class Rv extends ja{constructor(e){super(e),this.wrap=!0,this.supportsWorldCopies=!0,this.supportsTerrain=!0,this.supportsFog=!0,this.supportsFreeCamera=!0,this.isReprojectedInTileSpace=!1,this.unsupportedLayers=[],this.range=null}project(e,t){return{x:Me(e),y:Le(t),z:0}}unproject(e,t){const n=le(e),s=xe(t);return new se(n,s)}}const zv=Vt(Se);class qw extends ja{project(e,t){const n=(t=Vt(t))*t,s=n*n;return{x:.5*((e=Vt(e))*(.8707-.131979*n+s*(s*(.003971*n-.001529*s)-.013791))/Math.PI+.5),y:1-.5*(t*(1.007226+n*(.015085+s*(.028874*n-.044475-.005916*s)))/Math.PI+1),z:0}}unproject(e,t){e=(2*e-.5)*Math.PI;let n=t=(2*(1-t)-1)*Math.PI,s=25,c=0,h=n*n;do{h=n*n;const g=h*h;c=(n*(1.007226+h*(.015085+g*(.028874*h-.044475-.005916*g)))-t)/(1.007226+h*(.045255+g*(.259866*h-.311325-.005916*11*g))),n=k(n-c,-zv,zv)}while(Math.abs(c)>1e-6&&--s>0);h=n*n;const f=k(Zi(e/(.8707+h*(h*(h*h*h*(.003971-.001529*h)-.013791)-.131979))),-180,180),p=Zi(n);return new se(f,p)}}const Lv=Vt(Se);class $w extends ja{project(e,t){t=Vt(t),e=Vt(e);const n=Math.cos(t),s=2/Math.PI,c=Math.acos(n*Math.cos(e/2)),h=Math.sin(c)/c,f=.5*(e*s+2*n*Math.sin(e/2)/h)||0,p=.5*(t+Math.sin(t)/h)||0;return{x:.5*(f/Math.PI+.5),y:1-.5*(p/Math.PI+1),z:0}}unproject(e,t){let n=e=(2*e-.5)*Math.PI,s=t=(2*(1-t)-1)*Math.PI,c=25;const h=1e-6;let f=0,p=0;do{const g=Math.cos(s),x=Math.sin(s),b=2*x*g,w=x*x,S=g*g,E=Math.cos(n/2),A=Math.sin(n/2),P=2*E*A,R=A*A,B=1-S*E*E,L=B?1/B:0,U=B?Math.acos(g*E)*Math.sqrt(1/B):0,G=.5*(2*U*g*A+2*n/Math.PI)-e,q=.5*(U*x+s)-t,ie=.5*L*(S*R+U*g*E*w)+1/Math.PI,X=L*(P*b/4-U*x*A),ee=.125*L*(b*A-U*x*S*P),Q=.5*L*(w*E+U*R*g)+.5,J=X*ee-Q*ie;f=(q*X-G*Q)/J,p=(G*ee-q*ie)/J,n=k(n-f,-Math.PI,Math.PI),s=k(s-p,-Lv,Lv)}while((Math.abs(f)>h||Math.abs(p)>h)&&--c>0);return new se(Zi(n),Zi(s))}}class Fv extends ja{constructor(e){super(e),this.center=e.center||[0,0],this.parallels=e.parallels||[0,0],this.cosPhi=Math.max(.01,Math.cos(Vt(this.parallels[0]))),this.scale=1/(2*Math.max(Math.PI*this.cosPhi,1/this.cosPhi)),this.wrap=!0,this.supportsWorldCopies=!0}project(e,t){const{scale:n,cosPhi:s}=this;return{x:Vt(e)*s*n+.5,y:-Math.sin(Vt(t))/s*n+.5,z:0}}unproject(e,t){const{scale:n,cosPhi:s}=this,c=-(t-.5)/n,h=k(Zi((e-.5)/n)/s,-180,180),f=Math.asin(k(c*s,-1,1)),p=k(Zi(f),-85.051129,Se);return new se(h,p)}}class Hw extends Rv{constructor(e){super(e),this.requiresDraping=!0,this.supportsWorldCopies=!1,this.supportsFog=!0,this.zAxisUnit="pixels",this.unsupportedLayers=["debug"],this.range=[3,5]}projectTilePoint(e,t,n){const s=Td(e,t,n);return Vi(s,s,Sd(ls(n))),{x:s[0],y:s[1],z:s[2]}}locationPoint(e,t,n){const s=K(t.lat,t.lng),c=xi([],s),h=n?e._centerAltitude+n:e.elevation?e.elevation.getAtPointOrZero(e.locationCoordinate(t),e._centerAltitude):e._centerAltitude;un(s,s,c,fe(1,0)*Ze*h);const f=Ei(new Float64Array(16));return Ti(f,e.pixelMatrix,e.globeMatrix),Vi(s,s,f),new Fe(s[0],s[1])}pixelsPerMeter(e,t){return fe(1,0)*t}pixelSpaceConversion(e,t,n){const s=fe(1,e)*t,c=dt(fe(1,45)*t,s,n);return this.pixelsPerMeter(e,t)/c}createTileMatrix(e,t,n){const s=m_(ls(n.canonical));return Ti(new Float64Array(16),e.globeMatrix,s)}createInversionMatrix(e,t){const{center:n}=e,s=Sd(ls(t));return Nn(s,s,Vt(n.lng)),xo(s,s,Vt(n.lat)),Mr(s,s,[e._pixelsPerMercatorPixel,e._pixelsPerMercatorPixel,1]),Float32Array.from(s)}pointCoordinate(e,t,n,s){return Kg(e,t,n,!0)||new tt(0,0)}pointCoordinate3D(e,t,n){const s=this.pointCoordinate(e,t,n,0);return[s.x,s.y,s.z]}isPointAboveHorizon(e,t){return!Kg(e,t.x,t.y,!1)}farthestPixelDistance(e){const t=function(s,c){const h=s.cameraToCenterDistance,f=s._centerAltitude*c,p=s._camera,g=s._camera.forward(),x=er([],yi([],g,-h),[0,0,f]),b=s.worldSize/(2*Math.PI),w=[0,0,-b],S=s.width/s.height,E=Math.tan(s.fovAboveCenter),A=yi([],p.up(),E),P=yi([],p.right(),E*S),R=xi([],er([],er([],g,A),P)),B=[];let L;if(new Rt(x,R).closestPointOnSphere(w,b,B)){const U=er([],B,w),G=Xi([],U,x);L=Math.cos(s.fovAboveCenter)*Jr(G)}else{const U=Xi([],x,w),G=Xi([],w,x);xi(G,G);const q=Jr(U)-b;L=Math.sqrt(q*(q+2*b));const ie=Math.acos(L/(b+q))-Math.acos(ki(g,G));L*=Math.cos(ie)}return 1.01*L}(e,this.pixelsPerMeter(e.center.lat,e.worldSize)),n=Gs(e.zoom);if(n>0){const s=Pv(e,fe(1,e.center.lat)*e.worldSize),c=e.worldSize/(2*Math.PI),h=Math.max(e.width,e.height)/e.worldSize*Math.PI;return dt(t,s+c*(1-Math.cos(h)),Math.pow(n,10))}return t}upVector(e,t,n){return Td(t,n,e,1)}upVectorScale(e){return{metersToTile:yp(vp(ls(e)))}}}function Ov(r){const e=r.parallels,t=!!e&&Math.abs(e[0]+e[1])<.01;
vendor: 33,864 bytes, line 7
7switch(r.name){case"mercator":return new Rv(r);case"equirectangular":return new jw(r);case"naturalEarth":return new qw(r);case"equalEarth":return new Uw(r);case"winkelTripel":return new $w(r);case"albers":return t?new Fv(r):new Nw(r);case"lambertConformalConic":return t?new Fv(r):new Gw(r);case"globe":return new Hw(r)}throw new Error(`Invalid projection name: ${r.name}`)}class Zw{constructor(e,t){this.lastParams=null,this.lastAllFeaturesIndex=-2,this.appearancesVersion=t,this.appearances=e;const n=e.map(s=>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:!Ps(h),stateDependent:!ga(h),zoomDependent:!oo(h,["zoom"]),pitchDependent:!oo(h,["pitch"]),brightnessDependent:!oo(h,["brightness","measure-light"]),worldviewDependent:!oo(h,["worldview"])}}(s));this.anyFeatureDependent=n.some(s=>s.featureDependent),this.anyStateDependent=n.some(s=>s.stateDependent)}update(e,t){const n=this.lastParams,s=!n||n.zoom!==e.zoom||n.pitch!==(e.pitch||0)||n.brightness!==(e.brightness||0)||n.worldview!==e.worldview;this.lastParams={zoom:e.zoom,pitch:e.pitch||0,brightness:e.brightness||0,worldview:e.worldview};const c=t&&this.anyStateDependent;if(!s&&!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 t=0;t<this.appearances.length;t++){const n=this.appearances[t];if(n.condition&&n.condition.evaluate(e,void 0,void 0,void 0))return t}return-1}}const Ww=yt.types,Xw=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Qd(r,e,t,n,s,c,h,f,p,g,x,b,w){const S=f?Math.min(Jl,Math.round(f[0])):0,E=f?Math.min(Jl,Math.round(f[1])):0;r.emplaceBack(e,t,Math.round(32*n),Math.round(32*s),c,h,(S<<1)+(p?1:0),0+(E<<1),16*g,16*x,256*b,256*w)}function Jd(r,e,t){r.emplaceBack(e,t)}function ef(r,e,t,n,s,c,h){r.emplaceBack(e,t,n,s,c,h)}const om=(r,e,t,n)=>{for(let s=0;s<e;s++)r.emplaceBack(t[0],t[1],t[2],n[0],n[1],n[2])};function ku(r,e,t,n,s){r.emplaceBack(e,t,n,s),r.emplaceBack(e,t,n,s),r.emplaceBack(e,t,n,s),r.emplaceBack(e,t,n,s)}function Yw(r){for(const e of r.sections)if(e_(e.text))return!0;return!1}const Vu=12;class wg{constructor(e){this.layoutVertexArray=new cd,this.indexArray=new Ni,this.programConfigurations=e,this.segments=new oi,this.dynamicLayoutVertexArray=new Ro,this.opacityVertexArray=new Ol,this.placedSymbolArray=new up,this.iconTransitioningVertexArray=new On,this.globeExtVertexArray=new ud,this.zOffsetVertexArray=new gn,this.orientationVertexArray=new xu,this.symbolInstanceIndices=[],this.uboBinder=null,this.featureIdArray=new gn,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 t=e.get().length===this.segments.get().length;if(t&&this.cachedBatchIndices&&this.cachedBatchSegments)return{batchIndices:this.cachedBatchIndices,batchSegments:this.cachedBatchSegments};const n=new Map;for(const h of e.get()){const f=h.batchIndex!==void 0?h.batchIndex:0;n.has(f)||n.set(f,[]),n.get(f).push(h)}const s=Array.from(n.keys()).sort((h,f)=>h-f),c=new Map;for(const h of s){const f=n.get(h);c.set(h,new oi(f))}return t&&(this.cachedBatchIndices=s,this.cachedBatchSegments=c),{batchIndices:s,batchSegments:c}}snapshotSymbolVertexData(e,t){const n=e*Vu;return this.layoutVertexArray.uint16.slice(n,n+t*Vu)}restoreSymbolVertexData(e,t){this.layoutVertexArray.uint16.set(t,e*Vu)}updateSymbolVertexData(e,t,n,s,c,h,f,p,g,x,b,w,S){const E=this.layoutVertexArray.uint16,A=e*Vu;E[A]=t,E[A+1]=n,E[A+2]=s,E[A+3]=c,E[A+4]=h,E[A+5]=f,E[A+6]=p,E[A+7]=g,E[A+8]=x,E[A+9]=b,E[A+10]=w,E[A+11]=S}upload(e,t,n,s,c,h){this.isEmpty()||(n&&(this.cachedBatchIndices=null,this.cachedBatchSegments=null,this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Y1.members,!!h),this.indexBuffer=e.createIndexBuffer(this.indexArray,t),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,Q1.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,Xw,!0),this.iconTransitioningVertexArray.length>0&&(this.iconTransitioningVertexBuffer=e.createVertexBuffer(this.iconTransitioningVertexArray,iw.members,!0)),this.globeExtVertexArray.length>0&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,K1.members,!0)),!this.zOffsetVertexBuffer&&(this.zOffsetVertexArray.length>0||c)&&(this.zOffsetVertexBuffer=e.createVertexBuffer(this.zOffsetVertexArray,J1.members,!0)),!this.orientationVertexBuffer&&this.orientationVertexArray&&this.orientationVertexArray.length>0&&(this.orientationVertexBuffer=e.createVertexBuffer(this.orientationVertexArray,tw.members,!0)),this.opacityVertexBuffer.itemSize=1,this.featureIdArray&&this.featureIdArray.length>0&&(this.featureIdBuffer=e.createVertexBuffer(this.featureIdArray,ew.members,!1))),(n||s)&&(this.programConfigurations.upload(e),this.uboBinder&&this.uboBinder.upload(e)))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy(),this.iconTransitioningVertexBuffer&&this.iconTransitioningVertexBuffer.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy(),this.zOffsetVertexBuffer&&this.zOffsetVertexBuffer.destroy(),this.orientationVertexBuffer&&this.orientationVertexBuffer.destroy(),this.featureIdBuffer&&this.featureIdBuffer.destroy(),this.uboBinder&&this.uboBinder.destroy())}}Qe(wg,"SymbolBuffers",{omit:["cachedBatchIndices","cachedBatchSegments"]});class Tg{constructor(e,t,n){this.layoutVertexArray=new e,this.layoutAttributes=t,this.indexArray=new n,this.segments=new oi,this.collisionVertexArray=new kl,this.collisionVertexArrayExt=new Ro}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,rw.members,!0),this.collisionVertexBufferExt=e.createVertexBuffer(this.collisionVertexArrayExt,nw.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy(),this.collisionVertexBufferExt.destroy())}}Qe(Tg,"CollisionBuffers");class Oo{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=Ei([]),this.placementViewportMatrix=Ei([]);const t=this.layers[0]._unevaluatedLayout._values;this.worldview=e.worldview,this.localizable=e.localizable,this.maxUniformBufferBindings=e.maxUniformBufferBindings,this.maxUniformBlockSizeDwords=e.maxUniformBlockSizeDwords,this.disableSymbolUBO=e.disableSymbolUBO,this.textSizeData=Kl(this.zoom,t["text-size"],this.worldview,e.availableImages),this.iconSizeData=Kl(this.zoom,t["icon-size"],this.worldview,e.availableImages);const n=this.layers[0].layout,s=n.get("symbol-sort-key"),c=n.get("symbol-z-order");this.lut=e.lut,this.canOverlap=n.get("text-allow-overlap")||n.get("icon-allow-overlap")||n.get("text-ignore-placement")||n.get("icon-ignore-placement"),this.sortFeaturesByKey=c!=="viewport-y"&&s.constantOr(1)!==void 0,this.sortFeaturesByY=(c==="viewport-y"||c==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,this.writingModes=n.get("text-writing-mode").map(h=>Tn[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.elevationStateComplete=!1,this.activeReplacements=[],this.replacementUpdateTime=0,this.hasAnySecondaryIcon=!1,this.hasAppearances=null,this.featureAppearances=null,this.featureAppearanceData=new Map}hasAnyAppearanceLayoutProperty(e){const t=this.layers[0].getAppearances();if(!t||t.length===0)return!1;const n=Array.isArray(e)?e:[e];return t.some(s=>n.some(c=>s.hasLayoutProperty(c)))}getAppearanceFeatureData(e){return this.featureAppearanceData.get(e)}createArrays(){this.text=new wg(new D(this.layers,{zoom:this.zoom,lut:this.lut},e=>e.startsWith("text")||e.startsWith("symbol"))),this.icon=new wg(new D(this.layers,{zoom:this.zoom,lut:this.lut},e=>e.startsWith("icon")||e.startsWith("symbol"))),this.disableSymbolUBO||(this.text.uboBinder=new ng(this.layers[0],this.zoom,this.lut,!0,"",this.maxUniformBufferBindings,this.maxUniformBlockSizeDwords),this.icon.uboBinder=new ng(this.layers[0],this.zoom,this.lut,!1,"",this.maxUniformBufferBindings,this.maxUniformBlockSizeDwords)),this.glyphOffsetArray=new dp,this.lineVertexArray=new Ul,this.symbolInstances=new hp}calculateGlyphDependencies(e,t,n,s,c){for(const h of e){const f=h.codePointAt(0);if(f===void 0)break;if(t[f]=!0,s&&c&&f<=65535){const p=Gd[h];p&&(t[p.charCodeAt(0)]=!0)}}}calculateEffectiveAppearanceIconSize(e,t,n,s,c,h,f){if(!e.hasLayoutProperty("icon-size"))return f*h;let p=1;const g=e.getUnevaluatedLayoutProperty("icon-size"),x=Kl(this.zoom,g,this.worldview,c),b=Fu(x,t);if(x.kind!=="constant"&&x.kind!=="camera"||(p=b.uSize),x.kind==="composite"){const{minZoom:w,maxZoom:S}=x,E=g.possiblyEvaluate(new Zt(w,{worldview:this.worldview}),s),A=g.possiblyEvaluate(new Zt(S,{worldview:this.worldview}),s),P=E.evaluate(n,{},s,c);p=P+(A.evaluate(n,{},s,c)-P)*b.uSizeT}return x.kind==="source"&&(p=g.possiblyEvaluate(new Zt(this.zoom,{worldview:this.worldview}),s).evaluate(n,{},s,c)),p*h}updateFootprints(e,t){}updateReplacement(e,t){if(t.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=t.updateTime;const n=t.getReplacementRegionsForTile(e.toUnwrapped(),!0);return!Pp(this.activeReplacements,n)&&(this.activeReplacements=n,!0)}getResolvedImageFromTokens(e){return typeof e=="string"?Zr.build(e):e}populate(e,t,n,s){const c=this.layers[0],h=c.layout,f=this.projection.name==="globe",p=h.get("text-font"),g=h.get("text-field"),x=h.get("icon-image"),[b,w]=h.get("icon-size-scale-range"),S=k(t.scaleFactor||1,b,w),[E,A]=h.get("text-size-scale-range"),P=k(t.scaleFactor||1,E,A),R=(g.value.kind!=="constant"||g.value.value instanceof Vr&&!g.value.value.isEmpty()||g.value.value.toString().length>0)&&(p.value.kind!=="constant"||p.value.value.length>0),B=x.value.kind!=="constant"||!!x.value.value||Object.keys(x.parameters).length>0,L=this.hasAnyAppearanceLayoutProperty("icon-image"),U=h.get("symbol-sort-key");if(this.features=[],this.featureAppearanceData=new Map,!R&&!B&&!L)return;const G=t.iconDependencies,q=t.glyphDependencies,ie=t.availableImages,X=new Zt(this.zoom,{worldview:this.worldview,activeFloors:t.activeFloors}),ee=Q=>{const J=Q.id.toString();G.has(J)?G.get(J).push(Q):G.set(J,[Q])};for(const Q of e){const{feature:J,id:ve,index:Te,sourceLayerIndex:Ie}=Q,Ce=c._featureFilter.needGeometry,Ee=Ct(J,Ce);if(!c._featureFilter.filter(X,Ee,n))continue;if(Ce||(Ee.geometry=ft(J,n,s)),f&&J.type!==1&&n.z<=5){const He=Ee.geometry,qe=.98078528056,je=(Ye,it)=>ki(Td(Ye.x,Ye.y,n,1),Td(it.x,it.y,n,1))<qe;for(let Ye=0;Ye<He.length;Ye++)He[Ye]=_t(He[Ye],je)}let Oe,ye;if(R){const He=c.getValueAndResolveTokens("text-field",Ee,n,ie),qe=Vr.factory(He);Yw(qe)&&(this.hasRTLText=!0),(!this.hasRTLText||Xh()==="unavailable"||this.hasRTLText&&lo.isParsed())&&(Oe=sw(qe,c,Ee))}if(B){const He=c.getValueAndResolveTokens("icon-image",Ee,n,ie);ye=this.getResolvedImageFromTokens(He)}const Ae=this.layers[0];let Pe=!1;if(!ye&&L){const He=Ae.getAppearances();for(const qe of He)if(qe.getLayoutProperty("icon-image")){const je=Ae.getAppearanceValueAndResolveTokens(qe,"icon-image",Ee,n,ie);if(je){ye=this.getResolvedImageFromTokens(je),Pe=!0;break}}}if(!Oe&&!ye)continue;const Be=this.sortFeaturesByKey?U.evaluate(Ee,{},n):void 0,Ue={id:ve,text:Oe,icon:ye,index:Te,sourceLayerIndex:Ie,geometry:Ee.geometry,properties:J.properties,type:Ww[J.type],sortKey:Be};if(this.features.push(Ue),this.featureAppearanceData.set(Te,{id:ve,properties:J.properties,usesAppearanceIconAsPlaceholder:Pe,isUsingAppearanceIconVertexData:!1,isUsingAppearanceTextVertexData:!1,layoutBasedIconVertexData:new Uint16Array(0),layoutBasedTextVertexData:new Uint16Array(0),activeAppearanceIndex:-2}),ye){const He=Ae._unevaluatedLayout._values,{iconPrimary:qe,iconSecondary:je}=Zd(ye,this.iconSizeData,He["icon-size"],n,this.zoom,Ue,this.pixelRatio,S,this.worldview,ie);ee(qe),je&&(this.hasAnySecondaryIcon=!0,ee(je))}const Je=Ae.getAppearances();if(Je.length!==0&&Je.forEach(He=>{if(!He.getLayoutProperty("icon-image"))return;const qe=this.getCombinedIconPrimary(He,Ae,Ee,n,ie,Ue,S);qe&&ee(qe)}),Oe){const He=p.evaluate(Ee,{},n).join(","),qe=h.get("text-rotation-alignment")==="map"&&h.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(Tn.vertical)>=0;for(const je of Oe.sections)if(je.image){const Ye=je.image.getPrimary().scaleSelf(this.pixelRatio*P),it=Ye.id.toString(),ht=G.get(it)||[];ht.push(Ye),G.set(it,ht)}else{const Ye=$h(Oe.toString()),it=je.fontStack||He,ht=q[it]=q[it]||{};this.calculateGlyphDependencies(je.text,ht,qe,this.allowVerticalPlacement,Ye)}}}if(h.get("symbol-placement")==="line"&&(this.features=function(Q){const J={},ve={},Te=[];let Ie=0;function Ce(Ae){Te.push(Q[Ae]),Ie++}function Ee(Ae,Pe,Be){const Ue=ve[Ae];return delete ve[Ae],ve[Pe]=Ue,Te[Ue].geometry[0].pop(),Te[Ue].geometry[0]=Te[Ue].geometry[0].concat(Be[0]),Ue}function Oe(Ae,Pe,Be){const Ue=J[Pe];return delete J[Pe],J[Ae]=Ue,Te[Ue].geometry[0].shift(),Te[Ue].geometry[0]=Be[0].concat(Te[Ue].geometry[0]),Ue}function ye(Ae,Pe,Be){const Ue=Be?Pe[0][Pe[0].length-1]:Pe[0][0];return`${Ae}:${Ue.x}:${Ue.y}`}for(let Ae=0;Ae<Q.length;Ae++){const Pe=Q[Ae],Be=Pe.geometry,Ue=Pe.text?Pe.text.toString():null;if(!Ue){Ce(Ae);continue}const Je=ye(Ue,Be),He=ye(Ue,Be,!0);if(Je in ve&&He in J&&ve[Je]!==J[He]){const qe=Oe(Je,He,Be),je=Ee(Je,He,Te[qe].geometry);delete J[Je],delete ve[He],ve[ye(Ue,Te[je].geometry,!0)]=je,Te[qe].geometry=null}else Je in ve?Ee(Je,He,Be):He in J?Oe(Je,He,Be):(Ce(Ae),J[Je]=Ie-1,ve[He]=Ie-1)}return Te.filter(Ae=>Ae.geometry)}(this.features)),h.get("symbol-elevation-reference")==="hd-road-markup"){if(this.elevationType="road",t.elevationFeatures){!this.elevationFeatures&&t.elevationFeatures.length>0&&(this.elevationFeatures=[],this.elevationFeatureIdToIndex=new Map);for(const Q of t.elevationFeatures)this.elevationFeatureIdToIndex.set(Q.id,this.elevationFeatures.length),this.elevationFeatures.push(Q)}}else h.get("symbol-z-elevate")&&(this.elevationType="offset");this.elevationType!=="none"&&(this.zOffsetBuffersNeedUpload=!0),this.sortFeaturesByKey&&this.features.sort((Q,J)=>Q.sortKey-J.sortKey)}getCombinedIconPrimary(e,t,n,s,c,h,f){let p,g;if(e.hasLayoutProperty("icon-image")){const x=t.getAppearanceValueAndResolveTokens(e,"icon-image",n,s,c);p=this.getResolvedImageFromTokens(x)}else{const x=t.getValueAndResolveTokens("icon-image",n,s,c);p=this.getResolvedImageFromTokens(x)}if(p){const x=e.hasLayoutProperty("icon-size")?e.getUnevaluatedLayoutProperty("icon-size"):t._unevaluatedLayout._values["icon-size"];g=Zd(p,Kl(this.zoom,x,this.worldview,c),x,s,this.zoom,h,this.pixelRatio,f,this.worldview,c).iconPrimary}return g}updateSymbolInstanceIconVertices(e,t,n,s,c,h){const{canonical:f,availableImages:p,globalProperties:g,layer:x,iconScaleFactor:b,featureState:w,layoutIconOffset:S,layoutIconSize:E,layoutIconRotate:A}=h;if(e.placedIconSymbolIndex<0)return{vertexOffsetDelta:0,hasChanges:!1};if(t.activeAppearanceIndex===n)return{vertexOffsetDelta:e.numIconVertices,hasChanges:!1};const P=n>=0?x.appearances[n]:null;if(P){const R=this.getCombinedIconPrimary(P,x,s,f,p,{sortKey:void 0,text:void 0,icon:null,index:e.featureIndex,sourceLayerIndex:e.featureIndex,geometry:[],properties:t.properties,type:"Point",id:t.id},b);if(!R)return{vertexOffsetDelta:0,hasChanges:!1};const B=R.toString(),L=this.iconAtlasPositions&&this.iconAtlasPositions.get(B);if(L){const{appearanceIconOffset:U,appearanceIconRotate:G}=Tv(P,x,s,f,S,A,E,b);let q=Xp(L,void 0,U,x.layout.get("icon-anchor").evaluate(s,w,f));const ie=L.sdf,X=x.layout.get("icon-text-fit").constantOr("none");X!=="none"&&t.textShaping&&t.iconTextFitPadding&&t.fontScale&&(q=cg(q,t.textShaping,X,t.iconTextFitPadding,U,t.fontScale));const ee=this.calculateEffectiveAppearanceIconSize(P,g.zoom,s,f,p,b,E),Q=0,J=1+(Math.min(Jl,Math.round(ee*Hs))<<1),ve=_g(q,G,ie,X!=="none",b);t.isUsingAppearanceIconVertexData||(t.isUsingAppearanceIconVertexData=!0,t.layoutBasedIconVertexData=this.icon.snapshotSymbolVertexData(c,e.numIconVertices));const Te=Math.floor(e.numIconVertices/4),Ie=Math.min(ve.length,Te);let Ce=c;for(let Oe=0;Oe<Ie;++Oe){const ye=ve[Oe],Ae=t.layoutBasedIconVertexData[0]||e.tileAnchorX,Pe=t.layoutBasedIconVertexData[1]||e.tileAnchorY,Be=16*ye.pixelOffsetTL.x,Ue=16*ye.pixelOffsetTL.y,Je=16*ye.pixelOffsetBR.x,He=16*ye.pixelOffsetBR.y,qe=16*ye.minFontScaleX,je=16*ye.minFontScaleY;this.icon.updateSymbolVertexData(Ce,Ae,Pe,Math.round(32*ye.tl.x),Math.round(32*ye.tl.y),ye.texPrimary.x,ye.texPrimary.y,Q,J,Be,Ue,qe,je),this.icon.updateSymbolVertexData(Ce+1,Ae,Pe,Math.round(32*ye.tr.x),Math.round(32*ye.tr.y),ye.texPrimary.x+ye.texPrimary.w,ye.texPrimary.y,Q,J,Je,Ue,qe,je),this.icon.updateSymbolVertexData(Ce+2,Ae,Pe,Math.round(32*ye.bl.x),Math.round(32*ye.bl.y),ye.texPrimary.x,ye.texPrimary.y+ye.texPrimary.h,Q,J,Be,He,qe,je),this.icon.updateSymbolVertexData(Ce+3,Ae,Pe,Math.round(32*ye.br.x),Math.round(32*ye.br.y),ye.texPrimary.x+ye.texPrimary.w,ye.texPrimary.y+ye.texPrimary.h,Q,J,Je,He,qe,je),Ce+=4}const Ee=e.numIconVertices-4*Ie;for(let Oe=0;Oe<Ee;++Oe)this.icon.updateSymbolVertexData(Ce+Oe,0,0,0,0,0,0,0,0,0,0,0,0);return{vertexOffsetDelta:e.numIconVertices,hasChanges:!0}}}else{if(t.usesAppearanceIconAsPlaceholder)return this.icon.updateSymbolVertexData(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(t.isUsingAppearanceIconVertexData)return this.icon.restoreSymbolVertexData(c,t.layoutBasedIconVertexData),t.isUsingAppearanceIconVertexData=!1,{vertexOffsetDelta:t.layoutBasedIconVertexData.length/Vu,hasChanges:!0}}return{vertexOffsetDelta:e.numIconVertices,hasChanges:!1}}updateSymbolInstanceTextVertices(e,t,n,s,c,h){const{canonical:f,layer:p,textScaleFactor:g,imageMap:x,featureState:b,layoutTextOffset:w,layoutTextSize:S,layoutTextRotate:E,layoutMinZoomSize:A,layoutMaxZoomSize:P,layoutTextSizeMinZoom:R,layoutTextSizeMaxZoom:B,availableImages:L}=h,U=e.numHorizontalGlyphVertices>0||e.numVerticalGlyphVertices>0;if(!U)return{vertexOffsetDelta:U?e.numHorizontalGlyphVertices+e.numVerticalGlyphVertices:0,hasChanges:!1};if(t.activeAppearanceIndex===n)return{vertexOffsetDelta:e.numHorizontalGlyphVertices+e.numVerticalGlyphVertices,hasChanges:!1};const G=n>=0?p.appearances[n]:null;if(G&&t.textShaping){const{appearanceTextOffset:q,appearanceTextRotate:ie,appearanceTextSize:X}=Sv(G,p,s,f,w,E,S);t.fontScale=Cv(X,t.textScaleFactor);const ee=G.getUnevaluatedLayoutProperty("text-size");let Q=this.textSizeData,J=R,ve=B;G.hasLayoutProperty("text-size")&&(Q=Kl(this.zoom,ee,this.worldview,L),J=this.textSizeData.kind==="composite"?this.textSizeData.minZoom:0,ve=this.textSizeData.kind==="composite"?this.textSizeData.maxZoom:0);const Te=t.textShaping.bottom-w[1],Ie=t.textShaping.left-w[0],Ce=t.textShaping.right-w[0];t.textShaping.top=q[1]+(t.textShaping.top-w[1]),t.textShaping.bottom=q[1]+Te,t.textShaping.left=q[0]+Ie,t.textShaping.right=q[0]+Ce;const Ee=bv(0,t.textShaping,q,p,!1,s,x,this.allowVerticalPlacement,ie),Oe=X&&Q.kind==="composite"?ee.possiblyEvaluate(new Zt(J,{}),f).evaluate(s,b,f):A,ye=X&&Q.kind==="composite"?ee.possiblyEvaluate(new Zt(ve,{}),f).evaluate(s,b,f):P,Ae=vg(G.name,Q,X,g,Oe,ye),Pe=Array.isArray(Ae)?Ae[1]:X,Be=0,Ue=1+(Math.min(Jl,Math.round(Pe*Hs))<<1);t.isUsingAppearanceTextVertexData||(t.isUsingAppearanceTextVertexData=!0,t.layoutBasedTextVertexData=this.text.snapshotSymbolVertexData(c,e.numHorizontalGlyphVertices+e.numVerticalGlyphVertices));for(let Je=0;Je<Ee.length&&Je<(e.numHorizontalGlyphVertices+e.numVerticalGlyphVertices)/4;++Je){const He=Ee[Je],qe=He.glyphOffset[1],je=e.tileAnchorX,Ye=e.tileAnchorY,it=c+4*Je;this.text.updateSymbolVertexData(it,je,Ye,Math.round(32*He.tl.x),Math.round(32*(qe+He.tl.y)),He.texPrimary.x,He.texPrimary.y,Be,Ue,He.pixelOffsetTL.x,He.pixelOffsetTL.y,He.minFontScaleX,He.minFontScaleY),this.text.updateSymbolVertexData(it+1,je,Ye,Math.round(32*He.tr.x),Math.round(32*(qe+He.tr.y)),He.texPrimary.x+He.texPrimary.w,He.texPrimary.y,Be,Ue,He.pixelOffsetBR.x,He.pixelOffsetTL.y,He.minFontScaleX,He.minFontScaleY),this.text.updateSymbolVertexData(it+2,je,Ye,Math.round(32*He.bl.x),Math.round(32*(qe+He.bl.y)),He.texPrimary.x,He.texPrimary.y+He.texPrimary.h,Be,Ue,He.pixelOffsetTL.x,He.pixelOffsetBR.y,He.minFontScaleX,He.minFontScaleY),this.text.updateSymbolVertexData(it+3,je,Ye,Math.round(32*He.br.x),Math.round(32*(qe+He.br.y)),He.texPrimary.x+He.texPrimary.w,He.texPrimary.y+He.texPrimary.h,Be,Ue,He.pixelOffsetBR.x,He.pixelOffsetBR.y,He.minFontScaleX,He.minFontScaleY)}return{vertexOffsetDelta:e.numHorizontalGlyphVertices+e.numVerticalGlyphVertices,hasChanges:!0}}return t.isUsingAppearanceTextVertexData?(this.text.restoreSymbolVertexData(c,t.layoutBasedTextVertexData),t.isUsingAppearanceTextVertexData=!1,{vertexOffsetDelta:t.layoutBasedTextVertexData.length/Vu,hasChanges:!0}):{vertexOffsetDelta:e.numHorizontalGlyphVertices+e.numVerticalGlyphVertices,hasChanges:!1}}update(e,t,n,s,c,h,f,p){if(this.text.programConfigurations.updatePaintArrays(e,t,c,n,s,h,f,this.worldview),this.icon.programConfigurations.updatePaintArrays(e,t,c,n,s,h,f,this.worldview),p){if(h)this.text.uboBinder&&this.text.uboBinder.updateDynamicExpressions(c[0],t,p,n,e,f),this.icon.uboBinder&&this.icon.uboBinder.updateDynamicExpressions(c[0],t,p,n,e,f);else if(Object.keys(e).length>0){const g=new Set(Object.keys(e).map(x=>{const b=Number(x);return!isNaN(b)&&Number.isSafeInteger(b)&&String(b)===x?b:x}));this.text.uboBinder&&this.text.uboBinder.updateFeatures(g,c[0],t,p,n,e,f),this.icon.uboBinder&&this.icon.uboBinder.updateFeatures(g,c[0],t,p,n,e,f)}}}updateRoadElevation(e){if(this.elevationType!=="road"||!this.elevationFeatures||this.elevationStateComplete)return;this.elevationStateComplete=!0,this.hasAnyZOffset=!1;let t=!1;const n=De(e),s=1/n;let c=!1,h=!1;for(let f=0;f<this.symbolInstances.length;f++){const p=this.symbolInstances.get(f),g=Bi(1,0,0),x=Bi(0,1,0),{numHorizontalGlyphVertices:b,numVerticalGlyphVertices:w,numIconVertices:S,numVerticalIconVertices:E}=p,A=b>0||w>0,P=S>0,R=this.elevationFeatures[p.elevationFeatureIndex];if(R){const B=new Fe(p.tileAnchorX,p.tileAnchorY),L=.075+R.pointElevation(B);p.zOffset!==L&&(t=!0,p.zOffset=L),L!==0&&(this.hasAnyZOffset=!0);const U=R.computeSlopeNormal(B,s),G=Ka(qn(),Bi(0,0,1),U);gs(g,g,G),gs(x,x,G),g[2]*=n,x[2]*=n,g[0]===1&&g[1]===0&&g[2]===0&&x[0]===0&&x[1]===1&&x[2]===0||(c=c||A,h=h||P)}if(A&&(om(this.text.orientationVertexArray,b,g,x),om(this.text.orientationVertexArray,w,g,x)),P){const{placedIconSymbolIndex:B,verticalPlacedIconSymbolIndex:L}=p;B>=0&&om(this.icon.orientationVertexArray,S,g,x),L>=0&&om(this.icon.orientationVertexArray,E,g,x)}}c||(this.text.orientationVertexArray=void 0),h||(this.icon.orientationVertexArray=void 0),t&&(this.zOffsetBuffersNeedUpload=!0,this.zOffsetSortDirty=!0)}updateZOffset(){const e=(c,h,f)=>{n+=h,n>c.length&&c.resize(n);for(let p=-h;p<0;p++)c.emplace(p+n,f)},t=(c,h,f)=>{s+=h,s>c.length&&c.resize(s);for(let p=-h;p<0;p++)c.emplace(p+s,f)};if(!this.zOffsetBuffersNeedUpload)return;this.zOffsetBuffersNeedUpload=!1;let n=0,s=0;for(let c=0;c<this.symbolInstances.length;c++){const h=this.symbolInstances.get(c),{numHorizontalGlyphVertices:f,numVerticalGlyphVertices:p,numIconVertices:g}=h,x=h.zOffset,b=g>0;if((f>0||p>0)&&(e(this.text.zOffsetVertexArray,f,x),e(this.text.zOffsetVertexArray,p,x)),b){const{placedIconSymbolIndex:w,verticalPlacedIconSymbolIndex:S}=h;w>=0&&t(this.icon.zOffsetVertexArray,g,x),S>=0&&t(this.icon.zOffsetVertexArray,h.numVerticalIconVertices,x)}}this.text.zOffsetVertexBuffer&&this.text.zOffsetVertexBuffer.updateData(this.text.zOffsetVertexArray),this.icon.zOffsetVertexBuffer&&this.icon.zOffsetVertexBuffer.updateData(this.icon.zOffsetVertexArray)}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e,t,n,s,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,t,n,s,c,h=!1){const f={hasLayoutChanges:!1,hasUboChanges:!1};if(!e||!n||!this.featureAppearanceData)return f;const p=t||{},g=this.icon.layoutVertexArray&&this.icon.layoutVertexArray.length>0&&this.icon.layoutVertexArray.arrayBuffer,x=this.text.layoutVertexArray&&this.text.layoutVertexArray.length>0&&this.text.layoutVertexArray.arrayBuffer;if(!g&&!x)return f;const b=this.layers[0],w=b.layout;this.featureAppearances&&this.featureAppearances.appearancesVersion===b.appearancesVersion||(this.featureAppearances=new Zw(b.appearances,b.appearancesVersion));const S=this.featureAppearances.update(s,h);if(S.kind==="no-changes")return f;let E=1,A=0,P=!1,R=!1;if(g){const[q,ie]=w.get("icon-size-scale-range");E=k(1,q,ie)}let B=1,L=0,U=!1;if(x){const[q,ie]=w.get("text-size-scale-range");B=k(1,q,ie)}const G=new Map;if(c&&n)for(const q of n){const ie=c.getImage(q,b.scope);if(ie){const X=new Dn(q.toString());G.set(X.toString(),ie)}}for(let q=0;q<this.symbolInstances.length;q++){const ie=this.symbolInstances.get(q),X=this.getAppearanceFeatureData(ie.featureIndex);if(!X)continue;const ee=X.id,Q=ee!==void 0?p[String(ee)]:void 0,J={type:"Point",id:X.id,properties:X.properties,geometry:[]};let ve;if(S.kind==="all-features")ve=S.appearanceIndex;else{const Ie=b.appearances?b.appearances.findIndex(Ce=>Ce.isActive({globals:s,feature:J,canonical:e,featureState:Q})):-1;ve=Ie>=0?Ie:-1}const Te=X.activeAppearanceIndex!==ve;if(x){const Ie=w.get("text-size"),Ce=this.textSizeData.kind==="composite"?this.textSizeData.minZoom:0,Ee=this.textSizeData.kind==="composite"?this.textSizeData.maxZoom:0,Oe={canonical:e,layer:b,featureState:Q,availableImages:n,textScaleFactor:B,imageMap:G,layoutTextOffset:w.get("text-offset").evaluate(J,Q,e).map(Ae=>Ae*cr),layoutTextSize:Ie.evaluate(J,Q,e),layoutTextRotate:w.get("text-rotate").evaluate(J,Q,e),layoutMinZoomSize:Ie.evaluate(J,{zoom:Ce},e),layoutMaxZoomSize:Ie.evaluate(J,{zoom:Ee},e),layoutTextSizeMinZoom:Ce,layoutTextSizeMaxZoom:Ee},ye=this.updateSymbolInstanceTextVertices(ie,X,ve,J,L,Oe);L+=ye.vertexOffsetDelta,U=U||ye.hasChanges}if(g){const Ie={canonical:e,layer:b,featureState:Q,availableImages:n,globalProperties:s,iconScaleFactor:E,layoutIconOffset:w.get("icon-offset").evaluate(J,Q,e),layoutIconSize:w.get("icon-size").evaluate(J,Q,e,n),layoutIconRotate:w.get("icon-rotate").evaluate(J,Q,e)},Ce=this.updateSymbolInstanceIconVertices(ie,X,ve,J,A,Ie);A+=Ce.vertexOffsetDelta,P=P||Ce.hasChanges}if(Te){const Ie=ie.featureIndex,Ce=s?s.brightness:null,Ee=Q||{},Oe=ve>=0?b.appearances[ve]:null;this.text.uboBinder&&(this.text.uboBinder.layer=b,R=this.text.uboBinder.updateFeaturePaintForAppearance(Ie,J,Ee,e,n,Ce,Oe)||R),this.icon.uboBinder&&(this.icon.uboBinder.layer=b,R=this.icon.uboBinder.updateFeaturePaintForAppearance(Ie,J,Ee,e,n,Ce,Oe)||R)}X.activeAppearanceIndex=ve}return P&&this.icon.layoutVertexBuffer&&this.icon.layoutVertexArray.arrayBuffer!==null&&this.icon.layoutVertexArray.length===this.icon.layoutVertexBuffer.length&&this.icon.layoutVertexBuffer.updateData(this.icon.layoutVertexArray),U&&this.text.layoutVertexBuffer&&this.text.layoutVertexArray.arrayBuffer!==null&&this.text.layoutVertexArray.length===this.text.layoutVertexBuffer.length&&this.text.layoutVertexBuffer.updateData(this.text.layoutVertexArray),{hasLayoutChanges:P||U,hasUboChanges:R}}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}getProjection(){return this.projectionInstance||(this.projectionInstance=Ov(this.projection)),this.projectionInstance}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(e,t){const n=this.lineVertexArray.length;if(e.segment!==void 0)for(const{x:s,y:c}of t)this.lineVertexArray.emplaceBack(s,c);return{lineStartIndex:n,lineLength:this.lineVertexArray.length-n}}addSymbols(e,t,n,s,c,h,f,p,g,x,b,w,S,E,A,P,R,B){const L=e.indexArray,U=e.layoutVertexArray,G=e.globeExtVertexArray,q=B,ie=e.uboBinder?e.uboBinder.getCurrentBatchIndex():void 0,X=e.segments.prepareSegment(4*q,U,L,this.canOverlap?h.sortKey:void 0,ie),ee=this.glyphOffsetArray.length,Q=X.vertexLength,J=this.allowVerticalPlacement&&f===Tn.vertical?Math.PI/2:0,ve=h.text&&h.text.sections;let Te=U.length,Ie=-1;for(let Oe=0;Oe<t.length;Oe++){const{tl:ye,tr:Ae,bl:Pe,br:Be,texPrimary:Ue,texSecondary:Je,pixelOffsetTL:He,pixelOffsetBR:qe,minFontScaleX:je,minFontScaleY:Ye,glyphOffset:it,isSDF:ht,sectionIndex:nt}=t[Oe],wt=X.vertexLength,Ft=it[1];if(Qd(U,g.x,g.y,ye.x,Ft+ye.y,Ue.x,Ue.y,n,ht,He.x,He.y,je,Ye),Qd(U,g.x,g.y,Ae.x,Ft+Ae.y,Ue.x+Ue.w,Ue.y,n,ht,qe.x,He.y,je,Ye),Qd(U,g.x,g.y,Pe.x,Ft+Pe.y,Ue.x,Ue.y+Ue.h,n,ht,He.x,qe.y,je,Ye),Qd(U,g.x,g.y,Be.x,Ft+Be.y,Ue.x+Ue.w,Ue.y+Ue.h,n,ht,qe.x,qe.y,je,Ye),p){const{x:Tt,y:Bt,z:Mt}=p.anchor,[Li,Wt,Ut]=p.up;ef(G,Tt,Bt,Mt,Li,Wt,Ut),ef(G,Tt,Bt,Mt,Li,Wt,Ut),ef(G,Tt,Bt,Mt,Li,Wt,Ut),ef(G,Tt,Bt,Mt,Li,Wt,Ut),ku(e.dynamicLayoutVertexArray,Tt,Bt,Mt,J)}else ku(e.dynamicLayoutVertexArray,g.x,g.y,g.z,J);if(P){const Tt=Je||Ue;Jd(e.iconTransitioningVertexArray,Tt.x,Tt.y),Jd(e.iconTransitioningVertexArray,Tt.x+Tt.w,Tt.y),Jd(e.iconTransitioningVertexArray,Tt.x,Tt.y+Tt.h),Jd(e.iconTransitioningVertexArray,Tt.x+Tt.w,Tt.y+Tt.h)}if(L.emplaceBack(wt,wt+1,wt+2),L.emplaceBack(wt+1,wt+2,wt+3),X.vertexLength+=4,X.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(it[0]),(Oe===t.length-1||nt!==t[Oe+1].sectionIndex)&&(e.programConfigurations.populatePaintArrays(U.length,h,h.index,{},S,E,A,ve&&ve[nt],this.worldview),e.uboBinder&&e.featureIdArray)){const Tt=e.uboBinder.populateUBO(h,h.index,E,S,A,ve&&ve[nt],void 0);Ie=Tt;const Bt=U.length-Te;for(let Mt=0;Mt<Bt;Mt++)e.featureIdArray.emplaceBack(Tt);Te=U.length}}const Ce=B-t.length;if(Ce!==0&&(this._addNullVertices(Ce,U,n,p,G,e,P,X,L),e.uboBinder&&e.featureIdArray&&Ie>=0)){const Oe=4*Ce;for(let ye=0;ye<Oe;ye++)e.featureIdArray.emplaceBack(Ie)}const Ee=p?p.anchor:g;e.placedSymbolArray.emplaceBack(Ee.x,Ee.y,Ee.z,g.x,g.y,ee,this.glyphOffsetArray.length-ee,Q,x,b,g.segment,n?n[0]:0,n?n[1]:0,s[0],s[1],f,0,0,0,w,0),e.symbolInstanceIndices.push(R)}_addNullVertices(e,t,n,s,c,h,f,p,g){for(let x=0;x<e;x++){for(let w=0;w<4;w++)Qd(t,0,0,0,0,0,0,n,!1,0,0,0,0),s&&ef(c,0,0,0,0,0,0),ku(h.dynamicLayoutVertexArray,0,0,0,0),f&&Jd(h.iconTransitioningVertexArray,0,0);const b=p.vertexLength;g.emplaceBack(b,b+1,b+2),g.emplaceBack(b+1,b+2,b+3),p.vertexLength+=4,p.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(0)}}_commitLayoutVertex(e,t,n,s,c,h,f){e.emplaceBack(t,n,s,c,h,Math.round(f.x),Math.round(f.y))}_addCollisionDebugVertices(e,t,n,s,c,h,f){const p=n.segments.prepareSegment(4,n.layoutVertexArray,n.indexArray),g=p.vertexLength,x=f.tileAnchorX,b=f.tileAnchorY;for(let S=0;S<4;S++)n.collisionVertexArray.emplaceBack(0,0,0,0,0,0);this._commitDebugCollisionVertexUpdate(n.collisionVertexArrayExt,t,e.padding,f.zOffset),this._commitLayoutVertex(n.layoutVertexArray,s,c,h,x,b,new Fe(e.x1,e.y1)),this._commitLayoutVertex(n.layoutVertexArray,s,c,h,x,b,new Fe(e.x2,e.y1)),this._commitLayoutVertex(n.layoutVertexArray,s,c,h,x,b,new Fe(e.x2,e.y2)),this._commitLayoutVertex(n.layoutVertexArray,s,c,h,x,b,new Fe(e.x1,e.y2)),p.vertexLength+=4;const w=n.indexArray;w.emplaceBack(g,g+1),w.emplaceBack(g+1,g+2),w.emplaceBack(g+2,g+3),w.emplaceBack(g+3,g),p.primitiveLength+=4}_addTextDebugCollisionBoxes(e,t,n,s,c,h){for(let f=s;f<c;f++){const p=n.get(f),g=this.getSymbolInstanceTextSize(e,h,t,f);this._addCollisionDebugVertices(p,g,this.textCollisionBox,p.projectedAnchorX,p.projectedAnchorY,p.projectedAnchorZ,h)}}_addIconDebugCollisionBoxes(e,t,n,s,c,h){for(let f=s;f<c;f++){const p=n.get(f),g=this.getSymbolInstanceIconSize(e,t,h.placedIconSymbolIndex);this._addCollisionDebugVertices(p,g,this.iconCollisionBox,p.projectedAnchorX,p.projectedAnchorY,p.projectedAnchorZ,h)}}generateCollisionDebugBuffers(e,t,n){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new Tg(Bl,Wx.members,On),this.iconCollisionBox=new Tg(Bl,Wx.members,On);
vendor: 5,135 bytes, line 7
7const s=Fu(this.iconSizeData,e),c=Fu(this.textSizeData,e,n);for(let h=0;h<this.symbolInstances.length;h++){const f=this.symbolInstances.get(h);this._addTextDebugCollisionBoxes(c,e,t,f.textBoxStartIndex,f.textBoxEndIndex,f),this._addTextDebugCollisionBoxes(c,e,t,f.verticalTextBoxStartIndex,f.verticalTextBoxEndIndex,f),this._addIconDebugCollisionBoxes(s,e,t,f.iconBoxStartIndex,f.iconBoxEndIndex,f),this._addIconDebugCollisionBoxes(s,e,t,f.verticalIconBoxStartIndex,f.verticalIconBoxEndIndex,f)}}getSymbolInstanceTextSize(e,t,n,s){const c=this.text.placedSymbolArray.get(t.rightJustifiedTextSymbolIndex>=0?t.rightJustifiedTextSymbolIndex:t.centerJustifiedTextSymbolIndex>=0?t.centerJustifiedTextSymbolIndex:t.leftJustifiedTextSymbolIndex>=0?t.leftJustifiedTextSymbolIndex:t.verticalPlacedTextSymbolIndex>=0?t.verticalPlacedTextSymbolIndex:s),h=ug(this.textSizeData,e,c)/cr;return this.tilePixelRatio*h}getSymbolInstanceIconSize(e,t,n){const s=this.icon.placedSymbolArray.get(n),c=ug(this.iconSizeData,e,s);return this.tilePixelRatio*c}_commitDebugCollisionVertexUpdate(e,t,n,s){e.emplaceBack(t,-n,-n,s),e.emplaceBack(t,n,-n,s),e.emplaceBack(t,n,n,s),e.emplaceBack(t,-n,n,s)}_updateTextDebugCollisionBoxes(e,t,n,s,c,h,f){for(let p=s;p<c;p++){const g=n.get(p),x=this.getSymbolInstanceTextSize(e,h,t,p);this._commitDebugCollisionVertexUpdate(this.textCollisionBox.collisionVertexArrayExt,x,g.padding,h.zOffset)}}_updateIconDebugCollisionBoxes(e,t,n,s,c,h,f){for(let p=s;p<c;p++){const g=n.get(p),x=this.getSymbolInstanceIconSize(e,t,h.placedIconSymbolIndex);this._commitDebugCollisionVertexUpdate(this.iconCollisionBox.collisionVertexArrayExt,x,g.padding,h.zOffset)}}updateCollisionDebugBuffers(e,t,n,s){if(!this.hasDebugData())return;this.hasTextCollisionBoxData()&&this.textCollisionBox.collisionVertexArrayExt.clear(),this.hasIconCollisionBoxData()&&this.iconCollisionBox.collisionVertexArrayExt.clear();const c=Fu(this.iconSizeData,e,s),h=Fu(this.textSizeData,e,n);for(let f=0;f<this.symbolInstances.length;f++){const p=this.symbolInstances.get(f);this._updateTextDebugCollisionBoxes(h,e,t,p.textBoxStartIndex,p.textBoxEndIndex,p,n),this._updateTextDebugCollisionBoxes(h,e,t,p.verticalTextBoxStartIndex,p.verticalTextBoxEndIndex,p,n),this._updateIconDebugCollisionBoxes(c,e,t,p.iconBoxStartIndex,p.iconBoxEndIndex,p,s),this._updateIconDebugCollisionBoxes(c,e,t,p.verticalIconBoxStartIndex,p.verticalIconBoxEndIndex,p,s)}this.hasTextCollisionBoxData()&&this.textCollisionBox.collisionVertexBufferExt&&this.textCollisionBox.collisionVertexBufferExt.updateData(this.textCollisionBox.collisionVertexArrayExt),this.hasIconCollisionBoxData()&&this.iconCollisionBox.collisionVertexBufferExt&&this.iconCollisionBox.collisionVertexBufferExt.updateData(this.iconCollisionBox.collisionVertexArrayExt)}_deserializeCollisionBoxesForSymbol(e,t,n,s,c,h,f,p,g){const x={};if(t<n){const{x1:b,y1:w,x2:S,y2:E,padding:A,projectedAnchorX:P,projectedAnchorY:R,projectedAnchorZ:B,tileAnchorX:L,tileAnchorY:U,featureIndex:G}=e.get(t);x.textBox={x1:b,y1:w,x2:S,y2:E,padding:A,projectedAnchorX:P,projectedAnchorY:R,projectedAnchorZ:B,tileAnchorX:L,tileAnchorY:U},x.textFeatureIndex=G}if(s<c){const{x1:b,y1:w,x2:S,y2:E,padding:A,projectedAnchorX:P,projectedAnchorY:R,projectedAnchorZ:B,tileAnchorX:L,tileAnchorY:U,featureIndex:G}=e.get(s);x.verticalTextBox={x1:b,y1:w,x2:S,y2:E,padding:A,projectedAnchorX:P,projectedAnchorY:R,projectedAnchorZ:B,tileAnchorX:L,tileAnchorY:U},x.verticalTextFeatureIndex=G}if(h<f){const{x1:b,y1:w,x2:S,y2:E,padding:A,projectedAnchorX:P,projectedAnchorY:R,projectedAnchorZ:B,tileAnchorX:L,tileAnchorY:U,featureIndex:G}=e.get(h);x.iconBox={x1:b,y1:w,x2:S,y2:E,padding:A,projectedAnchorX:P,projectedAnchorY:R,projectedAnchorZ:B,tileAnchorX:L,tileAnchorY:U},x.iconFeatureIndex=G}if(p<g){const{x1:b,y1:w,x2:S,y2:E,padding:A,projectedAnchorX:P,projectedAnchorY:R,projectedAnchorZ:B,tileAnchorX:L,tileAnchorY:U,featureIndex:G}=e.get(p);x.verticalIconBox={x1:b,y1:w,x2:S,y2:E,padding:A,projectedAnchorX:P,projectedAnchorY:R,projectedAnchorZ:B,tileAnchorX:L,tileAnchorY:U},x.verticalIconFeatureIndex=G}return x}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let t=0;t<this.symbolInstances.length;t++){const n=this.symbolInstances.get(t);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,n.textBoxStartIndex,n.textBoxEndIndex,n.verticalTextBoxStartIndex,n.verticalTextBoxEndIndex,n.iconBoxStartIndex,n.iconBoxEndIndex,n.verticalIconBoxStartIndex,n.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}hasIconTextFit(){return this.hasAnyIconTextFit}addIndicesForPlacedSymbol(e,t){const n=e.placedSymbolArray.get(t),s=n.vertexStartIndex+4*n.numGlyphs;for(let c=n.vertexStartIndex;c<s;c+=4)e.indexArray.emplaceBack(c,c+1,c+2),e.indexArray.emplaceBack(c+1,c+2,c+3)}
7getSortedSymbolIndexes(e){if(this.sortedAngle===e&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const t=Math.sin(e),n=Math.cos(e),s=[],c=[],h=[];for(let f=0;f<this.symbolInstances.length;++f){h.push(f);const p=this.symbolInstances.get(f);s.push(0|Math.round(t*p.tileAnchorX+n*p.tileAnchorY)),c.push(p.featureIndex)}return h.sort((f,p)=>s[f]-s[p]||c[p]-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,t)=>this.symbolInstances.get(t).zOffset-this.symbolInstances.get(e).zOffset)}addToSortKeyRanges(e,t){const n=this.sortKeyRanges[this.sortKeyRanges.length-1];n&&n.sortKey===t?n.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:t,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e)if(this.text.segments.get().length>1||this.icon.segments.get().length>1)this.sortFeaturesWithinSegments();else{this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const t of this.symbolInstanceIndexes){const n=this.symbolInstances.get(t);this.featureSortOrder.push(n.featureIndex);const{rightJustifiedTextSymbolIndex:s,centerJustifiedTextSymbolIndex:c,leftJustifiedTextSymbolIndex:h,verticalPlacedTextSymbolIndex:f,placedIconSymbolIndex:p,verticalPlacedIconSymbolIndex:g}=n;s>=0&&this.addIndicesForPlacedSymbol(this.text,s),c>=0&&c!==s&&this.addIndicesForPlacedSymbol(this.text,c),h>=0&&h!==c&&h!==s&&this.addIndicesForPlacedSymbol(this.text,h),f>=0&&this.addIndicesForPlacedSymbol(this.text,f),p>=0&&this.addIndicesForPlacedSymbol(this.icon,p),g>=0&&this.addIndicesForPlacedSymbol(this.icon,g)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}getOrCreateSortedSymbolsByBatch(e,t){const n=(this.text.uboBinder&&this.text.uboBinder.maxFeaturesPerBatch>0?this.text.uboBinder:this.icon.uboBinder&&this.icon.uboBinder.maxFeaturesPerBatch>0?this.icon.uboBinder:null).maxFeaturesPerBatch;if(this.symbolsByBatch)for(const s of this.symbolsByBatch.values())for(const c of s){const h=this.symbolInstances.get(c.index);c.rotatedY=0|Math.round(e*h.tileAnchorX+t*h.tileAnchorY)}else{this.symbolsByBatch=new Map;for(let s=0;s<this.symbolInstances.length;s++){const c=this.symbolInstances.get(s),h=Math.floor(s/n),f=0|Math.round(e*c.tileAnchorX+t*c.tileAnchorY);this.symbolsByBatch.has(h)||this.symbolsByBatch.set(h,[]),this.symbolsByBatch.get(h).push({index:s,rotatedY:f,featureIndex:c.featureIndex})}}for(const s of this.symbolsByBatch.values())s.sort((c,h)=>c.rotatedY-h.rotatedY||h.featureIndex-c.featureIndex);return this.symbolsByBatch}rebuildTextSegmentIndices(e,t){for(const n of e){const s=n.batchIndex;if(s===void 0)continue;const c=t.get(s);if(!c){n.primitiveOffset=this.text.indexArray.length,n.primitiveLength=0;continue}n.primitiveOffset=this.text.indexArray.length;const h=this.text.indexArray.length;for(const{index:f}of c){const p=this.symbolInstances.get(f),{rightJustifiedTextSymbolIndex:g,centerJustifiedTextSymbolIndex:x,leftJustifiedTextSymbolIndex:b,verticalPlacedTextSymbolIndex:w}=p;g>=0&&this.addIndicesForPlacedSymbol(this.text,g),x>=0&&x!==g&&this.addIndicesForPlacedSymbol(this.text,x),b>=0&&b!==x&&b!==g&&this.addIndicesForPlacedSymbol(this.text,b),w>=0&&this.addIndicesForPlacedSymbol(this.text,w)}n.primitiveLength=this.text.indexArray.length-h}}rebuildIconSegmentIndices(e,t){for(const n of e){const s=n.batchIndex;if(s===void 0)continue;const c=t.get(s);if(!c){n.primitiveOffset=this.icon.indexArray.length,n.primitiveLength=0;continue}n.primitiveOffset=this.icon.indexArray.length;const h=this.icon.indexArray.length;for(const{index:f}of c){const p=this.symbolInstances.get(f),{placedIconSymbolIndex:g,verticalPlacedIconSymbolIndex:x}=p;g>=0&&this.addIndicesForPlacedSymbol(this.icon,g),x>=0&&this.addIndicesForPlacedSymbol(this.icon,x)}n.primitiveLength=this.icon.indexArray.length-h}}sortFeaturesWithinSegments(){this.featureSortOrder=[];const e=Math.sin(this.sortedAngle),t=Math.cos(this.sortedAngle),n=this.getOrCreateSortedSymbolsByBatch(e,t),s=Array.from(n.keys()).sort((c,h)=>c-h);for(const c of s){const h=n.get(c);for(const{index:f}of h){const p=this.symbolInstances.get(f);this.featureSortOrder.push(p.featureIndex)}}this.text.indexArray.clear(),this.icon.indexArray.clear(),this.rebuildTextSegmentIndices(this.text.segments.get(),n),this.rebuildIconSegmentIndices(this.icon.segments.get(),n),this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}getElevationFeatureForText(e){const t=this.symbolInstances.get(this.text.symbolInstanceIndices[e]).elevationFeatureIndex;let n;return this.elevationFeatures&&t<this.elevationFeatures.length&&(n=this.elevationFeatures[t]),n}}function Bv(r,e){return e.replace(/{([^{}]+)}/g,(t,n)=>n in r?String(r[n]):"")}let kv,Vv,Sg;Qe(Oo,"SymbolBucket",{omit:["layers","collisionBoxArray","compareText","features"]}),Oo.addDynamicAttributes=ku;class Nv{constructor(e){this.type=e.property.overrides?e.property.overrides.runtimeType:aa,this.defaultValue=e}evaluate(e){if(e.formattedSection){const t=this.defaultValue.property.overrides;if(t&&t.hasOverride(e.formattedSection))return t.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}eachChild(e){this.defaultValue.isConstant()||e(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}Qe(Nv,"FormatSectionOverride",{omit:["defaultValue"]});const Ig=()=>Sg||(Sg={layout:kv||(kv=new Ci({"symbol-placement":new ke(ue.layout_symbol["symbol-placement"]),"symbol-spacing":new ke(ue.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new ke(ue.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Ge(ue.layout_symbol["symbol-sort-key"]),"symbol-z-order":new ke(ue.layout_symbol["symbol-z-order"]),"symbol-z-elevate":new ke(ue.layout_symbol["symbol-z-elevate"]),"symbol-elevation-reference":new ke(ue.layout_symbol["symbol-elevation-reference"]),"icon-allow-overlap":new ke(ue.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new ke(ue.layout_symbol["icon-ignore-placement"]),"icon-optional":new ke(ue.layout_symbol["icon-optional"]),"icon-rotation-alignment":new ke(ue.layout_symbol["icon-rotation-alignment"]),"icon-size":new Ge(ue.layout_symbol["icon-size"]),"icon-size-scale-range":new ke(ue.layout_symbol["icon-size-scale-range"]),"icon-text-fit":new Ge(ue.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Ge(ue.layout_symbol["icon-text-fit-padding"]),"icon-image":new Ge(ue.layout_symbol["icon-image"]),"icon-image-use-theme":new ke({type:"string",default:"default","property-type":"data-constant"}),"icon-rotate":new Ge(ue.layout_symbol["icon-rotate"]),"icon-padding":new ke(ue.layout_symbol["icon-padding"]),"icon-keep-upright":new ke(ue.layout_symbol["icon-keep-upright"]),"icon-offset":new Ge(ue.layout_symbol["icon-offset"]),"icon-anchor":new Ge(ue.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new ke(ue.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new ke(ue.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new ke(ue.layout_symbol["text-rotation-alignment"]),"text-field":new Ge(ue.layout_symbol["text-field"]),"text-font":new Ge(ue.layout_symbol["text-font"]),"text-size":new Ge(ue.layout_symbol["text-size"]),"text-size-scale-range":new ke(ue.layout_symbol["text-size-scale-range"]),"text-max-width":new Ge(ue.layout_symbol["text-max-width"]),"text-line-height":new Ge(ue.layout_symbol["text-line-height"]),"text-letter-spacing":new Ge(ue.layout_symbol["text-letter-spacing"]),"text-justify":new Ge(ue.layout_symbol["text-justify"]),"text-radial-offset":new Ge(ue.layout_symbol["text-radial-offset"]),"text-variable-anchor":new ke(ue.layout_symbol["text-variable-anchor"]),"text-anchor":new Ge(ue.layout_symbol["text-anchor"]),"text-max-angle":new ke(ue.layout_symbol["text-max-angle"]),"text-writing-mode":new ke(ue.layout_symbol["text-writing-mode"]),"text-rotate":new Ge(ue.layout_symbol["text-rotate"]),"text-padding":new ke(ue.layout_symbol["text-padding"]),"text-keep-upright":new ke(ue.layout_symbol["text-keep-upright"]),"text-transform":new Ge(ue.layout_symbol["text-transform"]),"text-offset":new Ge(ue.layout_symbol["text-offset"]),"text-allow-overlap":new ke(ue.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new ke(ue.layout_symbol["text-ignore-placement"]),"text-optional":new ke(ue.layout_symbol["text-optional"]),visibility:new ke(ue.layout_symbol.visibility)}
vendor: 4,267 bytes, line 7
7)),paint:Vv||(Vv=new Ci({"icon-opacity":new Ge(ue.paint_symbol["icon-opacity"]),"icon-occlusion-opacity":new Ge(ue.paint_symbol["icon-occlusion-opacity"]),"icon-emissive-strength":new Ge(ue.paint_symbol["icon-emissive-strength"]),"text-emissive-strength":new Ge(ue.paint_symbol["text-emissive-strength"]),"icon-color":new Ge(ue.paint_symbol["icon-color"]),"icon-halo-color":new Ge(ue.paint_symbol["icon-halo-color"]),"icon-halo-width":new Ge(ue.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Ge(ue.paint_symbol["icon-halo-blur"]),"icon-translate":new ke(ue.paint_symbol["icon-translate"]),"icon-translate-anchor":new ke(ue.paint_symbol["icon-translate-anchor"]),"icon-image-cross-fade":new ke(ue.paint_symbol["icon-image-cross-fade"]),"text-opacity":new Ge(ue.paint_symbol["text-opacity"]),"text-occlusion-opacity":new Ge(ue.paint_symbol["text-occlusion-opacity"]),"text-color":new Ge(ue.paint_symbol["text-color"],{runtimeType:Lr,getOverride:r=>r.textColor,hasOverride:r=>!!r.textColor}),"text-halo-color":new Ge(ue.paint_symbol["text-halo-color"]),"text-halo-width":new Ge(ue.paint_symbol["text-halo-width"]),"text-halo-blur":new Ge(ue.paint_symbol["text-halo-blur"]),"text-translate":new ke(ue.paint_symbol["text-translate"]),"text-translate-anchor":new ke(ue.paint_symbol["text-translate-anchor"]),"icon-color-saturation":new ke(ue.paint_symbol["icon-color-saturation"]),"icon-color-contrast":new ke(ue.paint_symbol["icon-color-contrast"]),"icon-color-brightness-min":new ke(ue.paint_symbol["icon-color-brightness-min"]),"icon-color-brightness-max":new ke(ue.paint_symbol["icon-color-brightness-max"]),"symbol-z-offset":new Ge(ue.paint_symbol["symbol-z-offset"]),"icon-color-use-theme":new Ge({type:"string",default:"default","property-type":"data-driven"}),"icon-halo-color-use-theme":new Ge({type:"string",default:"default","property-type":"data-driven"}),"text-color-use-theme":new Ge({type:"string",default:"default","property-type":"data-driven"}),"text-halo-color-use-theme":new Ge({type:"string",default:"default","property-type":"data-driven"})}))},Sg);class sm extends Or{constructor(e,t,n,s){super(e,Ig(),t,n,s,e.layout?e.layout["icon-image-use-theme"]:null),this._colorAdjustmentMatrix=Ei([]),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,t){super.recalculate(e,t),this.appearances&&this.appearances.forEach(s=>{s.recalculate(e,t,this.iconImageUseTheme)}),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout._values["icon-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout._values["text-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment"));const n=this.layout.get("text-writing-mode");if(n){const s=[];for(const c of n)s.indexOf(c)<0&&s.push(c);this.layout._values["text-writing-mode"]=s}else this.layout._values["text-writing-mode"]=this.layout.get("symbol-placement")==="point"?["horizontal"]:["horizontal","vertical"];this._setPaintOverrides()}getColorAdjustmentMatrix(e,t,n,s){return this._saturation===e&&this._contrast===t&&this._brightnessMin===n&&this._brightnessMax===s||(this._colorAdjustmentMatrix=function(c,h,f,p){c=_i(c),h=pi(h);const g=ps(),x=c/3,b=1-2*x,w=[b,x,x,0,x,b,x,0,x,x,b,0,0,0,0,1],S=.5-.5*h,E=p-f;return Ti(g,[E,0,0,0,0,E,0,0,0,0,E,0,f,f,f,1],[h,0,0,0,0,h,0,0,0,0,h,0,S,S,S,1]),Ti(g,g,w),g}(e,t,n,s),this._saturation=e,this._contrast=t,this._brightnessMin=n,this._brightnessMax=s),this._colorAdjustmentMatrix}getValueAndResolveTokens(e,t,n,s){const c=this.layout.get(e).evaluate(t,{},n,s),h=this._unevaluatedLayout._values[e];return h.isDataDriven()||El(h.value)||!c?c:Bv(t.properties,c)}getAppearanceValueAndResolveTokens(e,t,n,s,c){const h=e.getLayoutProperty(t);
vendor: 8,262 bytes, line 7
7if(!h)return;const f=h.evaluate(n,{},s,c),p=e.getUnevaluatedLayoutProperties()._values[t];return p.isDataDriven()||El(p.value)||!f||typeof f!="string"?f:Bv(n.properties,f)}createBucket(e){return new Oo(e)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(const e of Ig().paint.overridableProperties){if(!sm.hasPaintOverride(this.layout,e))continue;const t=this.paint.get(e),n=new Nv(t),s=new tu(n,t.property.specification,this.scope,this.options,this.layout.get("icon-image-use-theme"));let c=null;c=t.value.kind==="constant"||t.value.kind==="source"?new Ia("source",s):new Ea("composite",s,t.value.zoomStops,t.value.interpolationType),this.paint._values[e]=new is(t.property,c,t.parameters)}}_handleOverridablePaintPropertyUpdate(e,t,n){return!(!this.layout||t.isDataDriven()||n.isDataDriven())&&sm.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,t){const n=e.get("text-field"),s=Ig().paint.properties[t];let c=!1;const h=f=>{for(const p of f)if(s.overrides&&s.overrides.hasOverride(p))return void(c=!0)};if(n.value.kind==="constant"&&n.value.value instanceof Vr)h(n.value.value.sections);else if(n.value.kind==="source"){const f=g=>{c||(g instanceof Zn&&ct(g.value)===cl?h(g.value.sections):g instanceof pt?h(g.sections):g.eachChild(f))},p=n.value;p._styleExpression&&f(p._styleExpression.expression)}return c}getProgramIds(){return["symbol"]}getDefaultProgramParams(e,t,n){return{config:new C(this,{zoom:t,lut:n}),overrideFog:!1}}hasElevation(){return this.layout&&this.layout.get("symbol-elevation-reference")==="hd-road-markup"}}let Uv,jv,Gv,qv;var am=zt([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Uint16",components:2}]);function lm(r,e,t,n,s,c,h,f){const p=[r,e,1,t,n,1,s,c,1],g=[h,f,1],x=Ys([],p),[b,w,S]=_s(g,g,x);return yo(p,p,[b,0,0,0,w,0,0,0,S])}function $v(r,e,t,n,s,c,h,f){const p=function(g,x,b,w,S,E,A,P){const R=lm(0,0,1,0,1,1,0,1),B=lm(g,x,b,w,S,E,A,P);return yo(B,B,Ys([],R))}(r,e,t,n,s,c,h,f);return[p[2]/p[8]/Ze,p[5]/p[8]/Ze]}function cm(r){return[r[0],Math.min(Math.max(r[1],-85.051129),Se)]}class Hv extends na{constructor(e,t,n,s){super(),this.id=e,this.dispatcher=n,this.coordinates=t.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.onNorthPole=!1,this.onSouthPole=!1,this.setEventedParent(s),this.options=t,this._dirty=!1}load(e,t){if(this._loaded=t||!1,this.fire(new Hn("dataloading",{dataType:"source"})),this.url=this.options.url,!this.url)return e&&(this.coordinates=e),this._loaded=!0,void this._finishLoading();this._imageRequest=ia(this.map._requestManager.transformRequest(this.url,rl.Image),(n,s)=>{this._imageRequest=null,this._loaded=!0,n?this.fire(new rn(n)):s&&(this.image=s,this._dirty=!0,this.width=this.image.width,this.height=this.image.height,e&&(this.coordinates=e),this._finishLoading())})}loaded(){return this._loaded}updateImage(e){return e.url?(this._imageRequest&&e.url!==this.options.url&&(this._imageRequest.cancel(),this._imageRequest=null),this.options.url=e.url,this.load(e.coordinates,this._loaded),this):this}setTexture(e){if(!(e.handle instanceof WebGLTexture))throw new Error("The provided handle is not a WebGLTexture instance");return this.texture=new Nd(this.map.painter.context,e.handle),this.width=e.dimensions[0],this.height=e.dimensions[1],this._dirty=!1,this._loaded=!0,this._finishLoading(),this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new Hn("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(e){this.map=e,this.load()}onRemove(e){this._imageRequest&&(this._imageRequest.cancel(),this._imageRequest=null),!this.texture||this.texture instanceof Nd||this.texture.destroy(),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy())}setCoordinates(e){if(this.coordinates=e,this._boundsArray=void 0,this._unsupportedCoords=!1,!e.length)return this;this.onNorthPole=!1,this.onSouthPole=!1;let t=e[0][1],n=e[0][1];for(const c of e)c[1]>n&&(n=c[1]),c[1]<t&&(t=c[1]);const s=(n+t)/2;if(s>Se?this.onNorthPole=!0:s<-85.051129&&(this.onSouthPole=!0),!this.onNorthPole&&!this.onSouthPole){const c=e.map(tt.fromLngLat);this.tileID=function(h){let f=1/0,p=1/0,g=-1/0,x=-1/0;for(const A of h)f=Math.min(f,A.x),p=Math.min(p,A.y),g=Math.max(g,A.x),x=Math.max(x,A.y);const b=Math.max(g-f,x-p),w=Math.max(0,Math.floor(-Math.log2(b))),S=Math.pow(2,w);let E=Math.floor((f+g)/2*S);return E>1&&(E-=1),new Hl(w,E,Math.floor((p+x)/2*S))}(c),this.minzoom=this.maxzoom=this.tileID.z}return this.fire(new Hn("data",{dataType:"source",sourceDataType:"content"})),this}_clear(){!this.texture||this.texture instanceof Nd||(this.texture.destroy(),this._dirty=!0),this.texture=null,this._boundsArray=void 0,this._unsupportedCoords=!1}_prepareData(e){for(const P in this.tiles){const R=this.tiles[P];R.state!=="loaded"&&(R.state="loaded",R.texture=this.texture)}if(this._boundsArray||this.onNorthPole||this.onSouthPole||this._unsupportedCoords)return;const t=ec(new Hl(0,0,0),this.map.transform.projection),n=[t.projection.project(this.coordinates[0][0],this.coordinates[0][1]),t.projection.project(this.coordinates[1][0],this.coordinates[1][1]),t.projection.project(this.coordinates[2][0],this.coordinates[2][1]),t.projection.project(this.coordinates[3][0],this.coordinates[3][1])];if(!function(P){const R=P[1].x-P[0].x,B=P[1].y-P[0].y,L=P[2].x-P[1].x,U=P[2].y-P[1].y,G=P[3].x-P[2].x,q=P[3].y-P[2].y,ie=P[0].x-P[3].x,X=P[0].y-P[3].y,ee=R*U-L*B,Q=L*q-G*U,J=G*X-ie*q,ve=ie*B-R*X;return ee>0&&Q>0&&J>0&&ve>0||ee<0&&Q<0&&J<0&&ve<0}(n))return console.warn("Image source coordinates are defining non-convex area in the Mercator projection"),void(this._unsupportedCoords=!0);const s=ec(this.tileID,this.map.transform.projection),[c,h,f,p]=this.coordinates.map(P=>{const R=s.projection.project(P[0],P[1]);return Dv(s,R)._round()});this.perspectiveTransform=$v(c.x,c.y,h.x,h.y,f.x,f.y,p.x,p.y);const g=this._boundsArray=new Ir;g.emplaceBack(c.x,c.y,0,0),g.emplaceBack(h.x,h.y,Ze,0),g.emplaceBack(p.x,p.y,0,Ze),g.emplaceBack(f.x,f.y,Ze,Ze),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy()),this.boundsBuffer=e.createVertexBuffer(g,am.members),this.boundsSegments=oi.simpleSegment(0,0,4,2);const x=[],b=function(P){return[cm(P[0]),cm(P[1]),cm(P[2]),cm(P[3])]}(this.coordinates),[w,S,E,A]=function(P){let R=P[0][0],B=R,L=P[0][1],U=L;for(let G=1;G<P.length;G++)P[G][0]<R?R=P[G][0]:P[G][0]>B&&(B=P[G][0]),P[G][1]<L?L=P[G][1]:P[G][1]>U&&(U=P[G][1]);return[R,L,B-R,U-L]}(b);{const P=new Ir,[R,B,L,U]=function(Ee){let Oe=Ee[0].x,ye=Oe,Ae=Ee[0].y,Pe=Ae;for(let Be=1;Be<Ee.length;Be++)Ee[Be].x<Oe?Oe=Ee[Be].x:Ee[Be].x>ye&&(ye=Ee[Be].x),Ee[Be].y<Ae?Ae=Ee[Be].y:Ee[Be].y>Pe&&(Pe=Ee[Be].y);return[Oe,Ae,ye-Oe,Pe-Ae]}(n),G=Ee=>[(Ee.x-R)/L,(Ee.y-B)/U],[q,ie,X,ee]=n.map(G),Q=function(Ee,Oe,ye,Ae,Pe,Be,Ue,Je){const He=lm(0,0,1,0,1,1,0,1);return yo(He,He,Ys([],lm(Ee,Oe,ye,Ae,Pe,Be,Ue,Je)))}(q[0],q[1],ie[0],ie[1],X[0],X[1],ee[0],ee[1]);this.elevatedGlobePerspectiveTransform=$v(q[0],q[1],ie[0],ie[1],X[0],X[1],ee[0],ee[1]);const J=(Ee,Oe)=>{x.push(Ee.lng);const ye=Math.round((Ee.lng-w)/E*Ze),Ae=Math.round((Ee.lat-S)/A*Ze),Pe=G(Oe),Be=_s([],[Pe[0],Pe[1],1],Q),Ue=Math.round(Be[0]/Be[2]*Ze),Je=Math.round(Be[1]/Be[2]*Ze);P.emplaceBack(ye,Ae,Ue,Je)},ve=n[3].x-n[0].x,Te=n[3].y-n[0].y,Ie=n[2].x-n[1].x,Ce=n[2].y-n[1].y;for(let Ee=0;Ee<65;Ee++){const Oe=Ee/64,ye=[n[0].x+Oe*ve,n[0].y+Oe*Te],Ae=[n[1].x+Oe*Ie,n[1].y+Oe*Ce],Pe=Ae[0]-ye[0],Be=Ae[1]-ye[1];for(let Ue=0;Ue<65;Ue++){const Je=Ue/64,He={x:ye[0]+Pe*Je,y:ye[1]+Be*Je};J(t.projection.unproject(He.x,He.y),He)}}this.elevatedGlobeVertexBuffer=e.createVertexBuffer(P,am.members)}{this.maxLongitudeTriangleSize=0;let P=[],R=new Ni;const B=(L,U,G)=>{R.emplaceBack(L,U,G);const q=x[L],ie=x[U],X=x[G],ee=Math.min(Math.min(q,ie),X),Q=Math.max(Math.max(q,ie),X)-ee;Q>this.maxLongitudeTriangleSize&&(this.maxLongitudeTriangleSize=Q),P.push(ee+Q/2)};for(let L=0;L<64;L++)for(let U=0;U<64;U++){const G=65*L+U,q=G+1,ie=G+65,X=ie+1;B(G,ie,q),B(q,ie,X)}
7[P,R]=function(L,U){const G=Array.from({length:L.length},(X,ee)=>ee);G.sort((X,ee)=>L[X]-L[ee]);const q=[],ie=new Ni;for(let X=0;X<G.length;X++){const ee=G[X];q.push(L[ee]);const Q=3*ee,J=Q+1;ie.emplaceBack(U.uint16[Q],U.uint16[J],U.uint16[J+1])}return[q,ie]}(P,R),this.elevatedGlobeTrianglesCenterLongitudes=P,this.elevatedGlobeIndexBuffer=e.createIndexBuffer(R)}this.elevatedGlobeSegments=oi.simpleSegment(0,0,4225,8192),this.elevatedGlobeGridMatrix=new Float32Array([0,E/Ze,0,A/Ze,0,0,S,w,0])}prepare(){const e=Object.keys(this.tiles).length!==0;if(this.tileID&&!e)return;const t=this.map.painter.context,n=t.gl;!this._dirty||this.texture instanceof Nd||(this.texture?this.texture.update(this.image):(this.texture=new hs(t,this.image,n.RGBA8),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE)),this._dirty=!1),e&&this._prepareData(t)}loadTile(e,t){this.tileID&&this.tileID.equals(e.tileID.canonical)?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={},t(null)):(e.state="errored",t(null))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}getSegmentsForLongitude(e){const t=this.elevatedGlobeSegments;if(!this.elevatedGlobeTrianglesCenterLongitudes||!t)return null;const n=this.elevatedGlobeTrianglesCenterLongitudes;let s=(c=e+180)+360*Math.round((n[0]-c)/360);var c;const h=new oi,f=(b,w)=>{h.segments.push({vertexOffset:0,primitiveOffset:b,vertexLength:t.segments[0].vertexLength,primitiveLength:w,sortKey:void 0,vaos:{}})},p=.51*this.maxLongitudeTriangleSize;if(Math.abs(n[0]-s)<=p){const b=bi(n,0,n.length,s+p);return b===n.length||f(b,Ri(n,b+1,n.length,s+360-p)-b),h}s<n[0]&&(s+=360);const g=Ri(n,0,n.length,s-p);if(g===n.length)return f(0,n.length),h;f(0,g-0);const x=bi(n,g+1,n.length,s+p);return x!==n.length&&f(x,n.length-x),h}}const Eg=1024,Kw=(Math.pow(Eg,2)-1)/268170240;class Zv extends Or{constructor(e,t,n,s){super(e,{layout:Gv||(Gv=new Ci({visibility:new ke(ue.layout_raster.visibility)})),paint:qv||(qv=new Ci({"raster-opacity":new ke(ue.paint_raster["raster-opacity"]),"raster-color":new Ls(ue.paint_raster["raster-color"]),"raster-color-mix":new ke(ue.paint_raster["raster-color-mix"]),"raster-color-range":new ke(ue.paint_raster["raster-color-range"]),"raster-hue-rotate":new ke(ue.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new ke(ue.paint_raster["raster-brightness-min"]),"raster-brightness-max":new ke(ue.paint_raster["raster-brightness-max"]),"raster-saturation":new ke(ue.paint_raster["raster-saturation"]),"raster-contrast":new ke(ue.paint_raster["raster-contrast"]),"raster-resampling":new ke(ue.paint_raster["raster-resampling"]),"raster-fade-duration":new ke(ue.paint_raster["raster-fade-duration"]),"raster-emissive-strength":new ke(ue.paint_raster["raster-emissive-strength"]),"raster-array-band":new ke(ue.paint_raster["raster-array-band"]),"raster-elevation":new ke(ue.paint_raster["raster-elevation"]),"raster-elevation-reference":new ke(ue.paint_raster["raster-elevation-reference"]),"raster-color-use-theme":new Ge({type:"string",default:"default","property-type":"data-driven"})}))},t,n,s),this.updateColorRamp(),this._curRampRange=[NaN,NaN]}getProgramIds(){return["raster"]}hasColorMap(){return!!this._transitionablePaint._values["raster-color"].value.value}tileCoverLift(){return this.paint.get("raster-elevation")}isDraped(e){return!(e&&e._source instanceof Hv&&(e._source.onNorthPole||e._source.onSouthPole))&&this.paint.get("raster-elevation")===0}_handleSpecialPaintPropertyUpdate(e){e!=="raster-color"&&e!=="raster-color-range"||(this._curRampRange=[NaN,NaN],this.updateColorRamp())}_clear(){this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null)}updateColorRamp(e){if(!this.hasColorMap()||!this._curRampRange)return;const t=this._transitionablePaint._values["raster-color"].value.expression,[n,s]=e||this._transitionablePaint._values["raster-color-range"].value.expression.evaluate({zoom:0})||[NaN,NaN];isNaN(n)&&isNaN(s)||n===this._curRampRange[0]&&s===this._curRampRange[1]||(this.colorRamp=Id({expression:t,evaluationKey:"rasterValue",image:this.colorRamp,clips:[{start:n,end:s}],resolution:Eg}),this.colorRampTexture=null,this._curRampRange=[n,s])}is3D(e){return this.paint.get("raster-elevation")>0}}let Wv,Xv,Yv,Kv,Qv,Jv,e0;class t0 extends Or{constructor(e,t,n,s){super(e,{layout:Wv||(Wv=new Ci({visibility:new ke(ue["layout_raster-particle"].visibility)})),paint:Xv||(Xv=new Ci({"raster-particle-array-band":new ke(ue["paint_raster-particle"]["raster-particle-array-band"]),"raster-particle-count":new ke(ue["paint_raster-particle"]["raster-particle-count"]),"raster-particle-color":new Ls(ue["paint_raster-particle"]["raster-particle-color"]),"raster-particle-max-speed":new ke(ue["paint_raster-particle"]["raster-particle-max-speed"]),"raster-particle-speed-factor":new ke(ue["paint_raster-particle"]["raster-particle-speed-factor"]),"raster-particle-fade-opacity-factor":new ke(ue["paint_raster-particle"]["raster-particle-fade-opacity-factor"]),"raster-particle-reset-rate-factor":new ke(ue["paint_raster-particle"]["raster-particle-reset-rate-factor"]),"raster-particle-elevation":new ke(ue["paint_raster-particle"]["raster-particle-elevation"]),"raster-particle-color-use-theme":new Ge({type:"string",default:"default","property-type":"data-driven"})}))},t,n,s),this._updateColorRamp(),this.lastInvalidatedAt=fn.now()}_clear(){this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null),this.tileFramebuffer&&(this.tileFramebuffer.destroy(),this.tileFramebuffer=null),this.particleFramebuffer&&(this.particleFramebuffer.destroy(),this.particleFramebuffer=null)}onRemove(e){this.colorRampTexture&&this.colorRampTexture.destroy(),this.tileFramebuffer&&this.tileFramebuffer.destroy(),this.particleFramebuffer&&this.particleFramebuffer.destroy()}hasColorMap(){return!!this._transitionablePaint._values["raster-particle-color"].value.value}getProgramIds(){return["rasterParticle"]}hasOffscreenPass(){return this.visibility!=="none"}isDraped(e){return!1}_handleSpecialPaintPropertyUpdate(e){e!=="raster-particle-color"&&e!=="raster-particle-max-speed"||(this._updateColorRamp(),this._invalidateAnimationState()),e==="raster-particle-count"&&this._invalidateAnimationState()}_updateColorRamp(){if(!this.hasColorMap())return;const e=this._transitionablePaint._values["raster-particle-color"].value.expression,t=this._transitionablePaint._values["raster-particle-max-speed"].value.expression.evaluate({zoom:0});this.colorRamp=Id({expression:e,evaluationKey:"rasterParticleSpeed",image:this.colorRamp,clips:[{start:0,end:t}],resolution:256}),this.colorRampTexture=null}
vendor: 17,810 bytes, line 7
7_invalidateAnimationState(){this.lastInvalidatedAt=fn.now()}tileCoverLift(){return this.paint.get("raster-particle-elevation")}}class Qw extends Or{constructor(e,t){super(e,{},t,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 Ag(r,e,t){const n=[0,0,1],s=jo([]);return Go(s,s,t?-Vt(r)+Math.PI:Vt(r)),Ya(s,s,-Vt(e)),gs(n,n,s),xi(n,n)}class um{constructor(e,t,n,s){this.message=(e?`${e}: `:"")+n,s&&(this.identifier=s),t!=null&&t.__line__&&(this.line=t.__line__)}}function Cg(r,e){const t=r.indexOf("://")===-1;try{return new URL(r,t&&e?"http://example.com":void 0),!0}catch{return!1}}class i0{constructor(e,t){this.feature=e,this.instancedDataOffset=t,this.instancedDataCount=0,this.rotation=[0,0,0],this.scale=[1,1,1],this.translation=[0,0,0]}}class r0{constructor(){this.maxScale=1,this.maxXYTranslationDistance=0,this.instancedDataArray=new _d,this.instancesEvaluatedElevation=[],this.features=[],this.idToFeaturesIndex={}}colorForInstance(e){const t=16*e,n=this.instancedDataArray.float32;let s=Math.floor(n[t+2]);const c=1.05*(n[t+2]-s);return s/=100,[n[t]%1*1.05,n[t+1]%1*1.05,c,s]}tileCoordinatesForInstance(e){const t=16*e,n=this.instancedDataArray.float32;let s=n[t+0];return s=s>Ze?s-Ze:s,new Fe(Math.trunc(s),Math.trunc(n[t+1]))}translationForInstance(e){const t=16*e,n=this.instancedDataArray.float32;return[n[t+4],n[t+5],n[t+6]]}rotationScaleForInstance(e){const t=16*e,n=this.instancedDataArray.float32;return[n[t+7],n[t+8],n[t+9],n[t+10],n[t+11],n[t+12],n[t+13],n[t+14],n[t+15]]}transformForInstance(e){const t=16*e,n=this.instancedDataArray.float32;return[n[t+7],n[t+8],n[t+9],n[t+4],n[t+10],n[t+11],n[t+12],n[t+5],n[t+13],n[t+14],n[t+15],n[t+6],0,0,0,1]}}class Mg{constructor(e){this.zoom=e.zoom,this.canonical=e.canonical,this.overscaledZ=this.canonical.z+Math.log2(e.overscaling),this.layers=e.layers,this.layerIds=this.layers.map(t=>t.fqid),this.projection=e.projection,this.index=e.index,this.worldview=e.worldview,this.hasZoomDependentProperties=this.layers[0].isZoomDependent(),this.stateDependentLayerIds=this.layers.filter(t=>t.isStateDependent()).map(t=>t.id),this.hasPattern=!1,this.instancesPerModel={},this.validForExaggeration=0,this.maxVerticalOffset=0,this.maxScale=0,this.maxHeight=0,this.lookupDim=this.zoom>this.canonical.z+1?0:this.zoom>this.canonical.z?256:this.zoom>15?75:100,this.instanceCount=0,this.terrainElevationMin=0,this.terrainElevationMax=0,this.validForDEMTile={id:null,timestamp:0},this.modelUris=[],this.modelsRequested=!1,this.activeReplacements=[],this.replacementUpdateTime=0,this.styleDefinedModelURLs=e.styleDefinedModelURLs,this.hasAppearances=null}updateFootprints(e,t){}updateAppearances(e,t,n,s){return{hasLayoutChanges:!1,hasUboChanges:!1}}populate(e,t,n,s){this.tileToMeter=De(n);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"?t.elevationFeatures:void 0;for(const{feature:f,id:p,index:g,sourceLayerIndex:x}of e){const b=p??(f.properties&&f.properties.hasOwnProperty("id")?f.properties.id:void 0),w=Ct(f,c);if(!this.layers[0]._featureFilter.filter(new Zt(this.zoom,{worldview:this.worldview,activeFloors:t.activeFloors}),w,n))continue;const S={id:b,sourceLayerIndex:x,index:g,geometry:c?w.geometry:ft(f,n,s),properties:f.properties,type:f.type,patterns:{}},E=this.addFeature(S,S.geometry,w,h,n);E&&t.featureIndex.insert(f,S.geometry,g,x,this.index,this.instancesPerModel[E].instancedDataArray.length,256)}this.lookup=null}evaluateQueryRenderedFeaturePadding(){const e=this.layers[0].modelManager,t=this.layers[0].scope;let n=0;for(const s of this.modelUris){const c=e.getModel(s,t);if(!c)continue;const h=this.instancesPerModel[s];if(h){const f=.5*cc(c.aabb.max,c.aabb.min)*h.maxScale+h.maxXYTranslationDistance,p=Math.min(Ze,Math.max(f/this.tileToMeter,256));n=Math.max(p,n)}}return n}update(e,t,n,s){for(const c in this.instancesPerModel){const h=this.instancesPerModel[c];for(const f in e)h.idToFeaturesIndex.hasOwnProperty(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 t in this.instancesPerModel){const n=this.instancesPerModel[t];for(const s of n.features){const c=this.layers[0],h=s.feature,f=this.canonical,p=c.paint.get("model-rotation").evaluate(h,{},f),g=c.paint.get("model-scale").evaluate(h,{},f),x=c.paint.get("model-translation").evaluate(h,{},f);eo(s.rotation,p)&&eo(s.scale,g)&&eo(s.translation,x)||(this.evaluate(s,s.featureStates,n,!0),e=!0)}}return e}updateReplacement(e,t,n,s){if(t.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=t.updateTime;const c=t.getReplacementRegionsForTile(e.toUnwrapped(),!0);if(Pp(this.activeReplacements,c))return!1;this.activeReplacements=c;let h=!1;for(const f in this.instancesPerModel){const p=this.instancesPerModel[f],g=p.instancedDataArray;for(const x of p.features){const b=x.instancedDataOffset,w=x.instancedDataCount;for(let S=0;S<w;S++){const E=16*(S+b);let A=g.float32[E+0];const P=A>Ze;A=P?A-Ze:A;const R=Math.floor(A),B=Math.floor(g.float32[E+1]);let L=!1;for(const U of this.activeReplacements)if(!ky(U,n,Dp.Model,s)&&!(U.min.x>R||R>U.max.x||U.min.y>B||B>U.max.y)&&(L=Gy(jy(R,B,e.canonical,U.footprintTileId.canonical),U.footprint),L))break;g.float32[E]=L?A+Ze:A,h=h||L!==P}}}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 t in this.instancesPerModel){const n=this.instancesPerModel[t];n.instancedDataArray.length<0||n.instancedDataArray.length===0||(n.instancedDataBuffer?n.instancedDataBuffer.updateData(n.instancedDataArray):n.instancedDataBuffer=e.createVertexBuffer(n.instancedDataArray,g1.members,!0,void 0,this.instanceCount))}this.uploaded=!0}destroy(e){for(const n in this.instancesPerModel){const s=this.instancesPerModel[n];s.instancedDataArray.length!==0&&s.instancedDataBuffer&&s.instancedDataBuffer.destroy()}const t=this.layers[0].modelManager;if(e&&t&&this.modelUris&&this.modelsRequested)for(const n of this.modelUris)t.removeModel(n,"",!0)}addFeature(e,t,n,s,c){const h=this.layers[0],f=h.layout.get("model-id"),p=h.layout.get("model-allow-density-reduction"),g=f.evaluate(n,{},this.canonical);if(!g)return lt(`modelId is not evaluated for layer ${h.id} and it is not going to get rendered.`),g;(Cg(g,!1)||this.styleDefinedModelURLs[g]!==void 0)&&(this.modelUris.includes(g)||this.modelUris.push(g)),this.instancesPerModel[g]||(this.instancesPerModel[g]=new r0);const x=this.instancesPerModel[g],b=x.instancedDataArray,w=new i0(n,b.length);let S;s&&(S=ci.getElevationFeature(e,s));for(const E of t)for(const A of E){if(A.x<0||A.x>=Ze||A.y<0||A.y>=Ze)continue;if(this.lookupDim!==0&&p){const R=(this.lookupDim-1)/Ze,B=this.lookupDim*(A.y*R|0)+A.x*R|0;if(this.lookup){if(this.lookup[B]!==0)continue;this.lookup[B]=1}}this.instanceCount++;const P=b.length;if(b.resize(P+1),s){x.instancesRoadElevation||(x.instancesRoadElevation=[]);const R=S?S.pointElevation(new Fe(A.x,A.y)):0;x.instancesRoadElevation.push(R)}x.instancesEvaluatedElevation.push(0),b.float32[16*P]=A.x,b.float32[16*P+1]=A.y}return w.instancedDataCount=x.instancedDataArray.length-w.instancedDataOffset,w.instancedDataCount>0&&(e.id&&(x.idToFeaturesIndex[e.id]=x.features.length),x.features.push(w),this.evaluate(w,{},x,!1)),g}getModelUris(){return this.modelUris}evaluate(e,t,n,s){const c=this.layers[0],h=e.feature,f=this.canonical,p=e.rotation=c.paint.get("model-rotation").evaluate(h,t,f),g=e.scale=c.paint.get("model-scale").evaluate(h,t,f),x=e.translation=c.paint.get("model-translation").evaluate(h,t,f),b=Object.assign({},c.paint.get("model-color").evaluate(h,t,f));b.a=c.paint.get("model-color-mix-intensity").evaluate(h,t,f);const w=[];this.maxVerticalOffset<x[2]&&(this.maxVerticalOffset=x[2]);const S=x[0]*x[0]+x[1]*x[1],E=S>0?Math.sqrt(S):0;n.maxScale=Math.max(Math.max(n.maxScale,g[0]),Math.max(g[1],g[2])),n.maxXYTranslationDistance=Math.max(n.maxXYTranslationDistance,E),this.maxScale=Math.max(Math.max(this.maxScale,g[0]),Math.max(g[1],g[2])),Ax(w,p,g);const A=Math.round(100*b.a)+b.b/1.05;for(let P=0;P<e.instancedDataCount;++P){const R=e.instancedDataOffset+P,B=16*R,L=n.instancedDataArray.float32;let U=0;s&&(U=L[B+6]-n.instancesEvaluatedElevation[R]);const G=0|L[B+1];L[B]=(0|L[B])+b.r/1.05,L[B+1]=G+b.g/1.05,L[B+2]=A,L[B+3]=1/(f.z>10?this.tileToMeter:De(f,G)),L[B+4]=x[0],L[B+5]=x[1],L[B+6]=x[2]+(n.instancesRoadElevation?n.instancesRoadElevation[R]:0)+U,L[B+7]=w[0],L[B+8]=w[1],L[B+9]=w[2],L[B+10]=w[4],L[B+11]=w[5],L[B+12]=w[6],L[B+13]=w[8],L[B+14]=w[9],L[B+15]=w[10],n.instancesEvaluatedElevation[R]=x[2]}}}Qe(Mg,"ModelBucket",{omit:["layers"]}),Qe(r0,"PerModelAttributes"),Qe(i0,"ModelFeature");class Nu{constructor(e,t,n){this._demTile=e,this._dem=this._demTile.dem,this._scale=t,this._offset=n}static create(e,t,n){const s=n||e.findDEMTileFor(t);if(!s||!s.dem)return;const c=s.dem,h=s.tileID,f=1<<t.canonical.z-h.canonical.z;return new Nu(s,c.dim/Ze/f,[(t.canonical.x/f-h.canonical.x)*c.dim,(t.canonical.y/f-h.canonical.y)*c.dim])}tileCoordToPixel(e,t){const n=t*this._scale+this._offset[1];return new Fe(Math.floor(e*this._scale+this._offset[0]),Math.floor(n))}getElevationAt(e,t,n,s){const c=e*this._scale+this._offset[0],h=t*this._scale+this._offset[1],f=Math.floor(c),p=Math.floor(h),g=this._dem;return s=!!s,n?dt(dt(g.get(f,p,s),g.get(f,p+1,s),h-p),dt(g.get(f+1,p,s),g.get(f+1,p+1,s),h-p),c-f):g.get(f,p,s)}getElevationAtPixel(e,t,n){return this._dem.get(e,t,!!n)}getMeterToDEM(e){return(1<<this._demTile.tileID.canonical.z)*fe(1,e)*this._dem.stride}}const Pg=new Float32Array(262144),tc=new Uint8Array(262144);function n0(r){let e=0;if(r.meshes)for(const t of r.meshes)e=Math.max(e,t.aabb.max[2]);if(r.children)for(const t of r.children)e=Math.max(e,n0(t));return e}function o0(r,e,t){if(r.meshes)for(const n of r.meshes){if(n.aabb.min[0]===1/0)continue;const s=Xt.applyTransform(n.aabb,r.globalMatrix);t.insert(e,s.min[0],s.min[1],s.max[0],s.max[1])}if(r.children)for(const n of r.children)o0(n,e,t)}const s0=["","wall","door","roof","window","lamp","logo"];class a0{constructor(e){this.node=e,this.evaluatedRMEA=[[1,0,0,1],[1,0,0,1],[1,0,0,1],[1,0,0,1],[.4,1,0,1],[1,0,0,1],[1,0,0,1]],this.hiddenByReplacement=!1,this.evaluatedTranslation=[0,0,0],this.evaluatedScale=[1,1,1],this.evaluatedColor=[],this.emissionHeightBasedParams=[],this.cameraCollisionOpacity=1,this.feature={type:"Point",id:e.id,geometry:[],properties:{height:n0(e)}},this.aabb=this._getLocalBounds(),this.state=null}_getLocalBounds(){if(!this.node.meshes)return new Xt([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);if(!this.aabb){let e=0;const t=new Xt([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);for(const n of this.node.meshes)this.node.lightMeshIndex!==e&&(n.transformedAabb=Xt.applyTransformFast(n.aabb,this.node.globalMatrix),t.encapsulate(n.transformedAabb)),e++;this.aabb=t}return this.aabb}}class hm{constructor(e,t,n,s,c,h,f,p){this.id=n,this.layers=e,this.layerIds=this.layers.map(g=>g.fqid),this.stateDependentLayerIds=this.layers.filter(g=>g.isStateDependent()).map(g=>g.id),this.modelTraits|=Ru.CoordinateSpaceTile,this.uploaded=!1,this.hasPattern=!1,s&&(this.modelTraits|=Ru.HasMapboxMeshFeatures),c&&(this.modelTraits|=Ru.HasMeshoptCompression),this.zoom=-1,this.terrainExaggeration=1,this.projection={name:"mercator"},this.replacementUpdateTime=0,this.elevationReadFromZ=255,this.brightness=h,this.worldview=p,this.dirty=!0,this.needsUpload=!1,this.filter=null,this.nodesInfo=[];for(const g of t)this.nodesInfo.push(new a0(g)),o0(g,f.featureIndexArray.length,f.grid),f.featureIndexArray.emplaceBack(this.nodesInfo.length-1,0,f.bucketLayerIDs.length-1,0);this.states={},this.hasAppearances=null}updateFootprints(e,t){for(const n of this.getNodesInfo()){const s=n.node;s.footprint&&t.push({footprint:s.footprint,id:e})}}updateAppearances(e,t,n,s){return{hasLayoutChanges:!1,hasUboChanges:!1}}update(e){const t=Object.keys(e).length!==0;if(t&&!this.stateDependentLayers.length)return;const n=t?this.stateDependentLayers:this.layers;if(!di(e,this.states))for(const s of n)this.evaluate(s,e);this.states=structuredClone(e)}populate(){console.log("populate 3D model bucket")}uploadPending(){return!this.uploaded||this.needsUpload}upload(e){if(!this.needsUpload)return;const t=this.getNodesInfo();for(const n of t){const s=n.node;this.uploaded?this.updatePbrBuffer(s):Z_(s,e,!0)}for(const n of t)qp(n.node);this.uploaded=!0,this.needsUpload=!1}updatePbrBuffer(e){let t=!1;if(!e.meshes)return t;for(const n of e.meshes)n.pbrBuffer&&(n.pbrBuffer.updateData(n.featureArray),t=!0);return t}needsReEvaluation(e,t,n){const s=e.transform.projectionOptions,c=e.style.getBrightness(),h=this.brightness!==c;if(!this.uploaded||this.dirty||s.name!==this.projection.name||tf(n.paint.get("model-color").value,h)||tf(n.paint.get("model-color-mix-intensity").value,h)||tf(n.paint.get("model-roughness").value,h)||tf(n.paint.get("model-emissive-strength").value,h)||tf(n.paint.get("model-height-based-emissive-strength-multiplier").value,h)){this.projection=s,this.brightness=c;const f=this.getNodesInfo();for(const p of f)p.state=null;return!0}return!1}evaluateTransform(e,t){if(e.transform.zoom===this.zoom)return;this.zoom=e.transform.zoom;const n=this.getNodesInfo(),s=this.id.canonical;for(const c of n){const h=c.feature;c.evaluatedTranslation=t.paint.get("model-translation").evaluate(h,{},s),c.evaluatedScale=t.paint.get("model-scale").evaluate(h,{},s)}}evaluate(e,t){const n=this.getNodesInfo();for(const s of n){if(!s.node.meshes)continue;const c=s.feature,h=t&&t[c.id];if(di(h,s.state))continue;s.state=structuredClone(h);const f=s.node.meshes&&s.node.meshes[0].featureData,p=s.evaluatedColor[2],g=s.evaluatedRMEA[2],x=this.id.canonical;if(s.hasTranslucentParts=!1,f){for(let b=0;b<s0.length;b++){const w=s0[b];w.length&&(c.properties.part=w);const S=e.paint.get("model-color").evaluate(c,h,x).toPremultipliedRenderColor(null),E=e.paint.get("model-color-mix-intensity").evaluate(c,h,x);s.evaluatedColor[b]=[S.r,S.g,S.b,E],s.evaluatedRMEA[b][0]=e.paint.get("model-roughness").evaluate(c,h,x),s.evaluatedRMEA[b][2]=e.paint.get("model-emissive-strength").evaluate(c,h,x),s.evaluatedRMEA[b][3]=S.a,s.emissionHeightBasedParams[b]=e.paint.get("model-height-based-emissive-strength-multiplier").evaluate(c,h,x),!s.hasTranslucentParts&&S.a<1&&(s.hasTranslucentParts=!0)}delete c.properties.part,eT(s,p!==s.evaluatedColor[2]||g!==s.evaluatedRMEA[2],this.modelTraits)}else s.evaluatedRMEA[0][2]=e.paint.get("model-emissive-strength").evaluate(c,h,x);s.evaluatedTranslation=e.paint.get("model-translation").evaluate(c,h,x),s.evaluatedScale=e.paint.get("model-scale").evaluate(c,h,x),this.updatePbrBuffer(s.node)||(this.needsUpload=!0)}this.dirty=!1}elevationUpdate(e,t,n,s){const c=e.findDEMTileFor(n);if(c&&(c.tileID.canonical!==this.terrainTile||t!==this.terrainExaggeration)){if(c.dem&&c.tileID.overscaledZ!==this.elevationReadFromZ){this.elevationReadFromZ=c.tileID.overscaledZ;const h=Nu.create(e,n,c);if(!h)return;this.modelTraits&Ru.HasMapboxMeshFeatures&&this.updateDEM(e,h,n,s);for(const f of this.getNodesInfo()){const p=f.node;if(!p.footprint||!p.footprint.vertices||!p.footprint.vertices.length)continue;const g=p.footprint.vertices;let x=h.getElevationAt(g[0].x,g[0].y,!0,!0);for(let b=1;b<g.length;b++)x=Math.min(x,h.getElevationAt(g[b].x,g[b].y,!0,!0));p.elevation=x}}this.terrainTile=c.tileID.canonical,this.terrainExaggeration=t}}updateDEM(e,t,n,s){let c=t._dem._modifiedForSources[s];if(c===void 0&&(t._dem._modifiedForSources[s]=[],c=t._dem._modifiedForSources[s]),c.includes(n.canonical))return;const h=t._dem.dim;c.push(n.canonical);let f=!1;for(const p of this.getNodesInfo()){const g=p.node;if(!g.footprint||!g.footprint.grid)continue;const x=g.footprint.grid,b=t.tileCoordToPixel(x.min.x,x.min.y),w=t.tileCoordToPixel(x.max.x,x.max.y),S=Math.min(Math.min(h-w.y,b.x),Math.min(b.y,h-w.x));if(S<0)continue;const E=k(S,2,5);let A=Math.max(0,b.x-E),P=Math.max(0,b.y-E),R=Math.min(w.x+E,h-1),B=Math.min(w.y+E,h-1);for(let q=P;q<=B;++q)for(let ie=A;ie<=R;++ie)tc[q*h+ie]=255;let L=0,U=0;for(let q=0;q<x.cellsY;++q)for(let ie=0;ie<x.cellsX;++ie){if(!x.cells[q*x.cellsX+ie])continue;const X=t.tileCoordToPixel(x.min.x+ie/x.xScale,x.min.y+q/x.yScale),ee=t.tileCoordToPixel(x.min.x+(ie+1)/x.xScale,x.min.y+(q+1)/x.yScale);for(let Q=X.y;Q<=Math.min(ee.y+1,h-1);++Q)for(let J=X.x;J<=Math.min(ee.x+1,h-1);++J)tc[Q*h+J]===255&&(tc[Q*h+J]=0,L+=t.getElevationAtPixel(J,Q),U++)}const G=L/U;A=Math.max(1,b.x-E),P=Math.max(1,b.y-E),R=Math.min(w.x+E,h-2),B=Math.min(w.y+E,h-2),f=!0;for(let q=P;q<=B;++q)for(let ie=A;ie<=R;++ie)tc[q*h+ie]===0&&(Pg[q*h+ie]=t._dem.set(ie,q,G));for(let q=1;q<E;++q){A=Math.max(1,b.x-q),P=Math.max(1,b.y-q),R=Math.min(w.x+q,h-2),B=Math.min(w.y+q,h-2);for(let ie=P;ie<=B;++ie)for(let X=A;X<=R;++X){const ee=ie*h+X;if(tc[ee]===255){let Q=0,J=0,ve=-1,Te=-1;for(let Ie=-1;Ie<=1;++Ie)for(let Ce=-1;Ce<=1;++Ce){const Ee=(ie+Ie)*h+X+Ce;if(tc[Ee]>=q)continue;const Oe=Pg[Ee],ye=Math.abs(Oe);ye>J&&(Q=Oe,J=ye,ve=Ce,Te=Ie)}if(J>.1){const Ie=1-(q+.5*Math.abs(ve*Te))/E;
7let Ce=t._dem.get(X,ie)+Q*Ie;const Ee=t._dem.get(X+ve,ie+Te),Oe=t._dem.get(X-ve,ie-Te,!0);(Ce-Ee)*(Ce-Oe)>0&&(Ce=(Ee+Oe)/2),Pg[ee]=t._dem.set(X,ie,Ce),tc[ee]=q}}}}}f&&(t._demTile.needsDEMTextureUpload=!0,t._dem._timestamp=fn.now())}setFilter(e){this.filter=e?du(e):null}getNodesInfo(){return this.filter?this.nodesInfo.filter(e=>this.filter.filter(new Zt(this.id.overscaledZ,{worldview:this.worldview}),e.feature,this.id.canonical)):this.nodesInfo}destroy(){const e=this.getNodesInfo();for(const t of e)qp(t.node),W_(t.node)}isEmpty(){return!this.nodesInfo.length}updateReplacement(e,t){if(t.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=t.updateTime;const n=t.getReplacementRegionsForTile(e.toUnwrapped());for(const s of this.getNodesInfo()){const c=s.node.footprint;s.hiddenByReplacement=!!c&&!n.find(h=>h.footprint===c)}}getHeightAtTileCoord(e,t){const n=[],s=[0,0,0],c=Ei([]);for(const h of this.getNodesInfo()){const f=h.node.meshes[0],p=f.transformedAabb;if(e<p.min[0]||t<p.min[1]||e>p.max[0]||t>p.max[1])continue;if(h.node.hidden===!0)return{height:1/0,maxHeight:h.feature.properties.height,hidden:!1,verticalScale:h.evaluatedScale[2]};An(c,h.node.globalMatrix),s[0]=e,s[1]=t,Vi(s,s,c);const g=(s[0]-f.aabb.min[0])/(f.aabb.max[0]-f.aabb.min[0])*Xl|0,x=Math.min(63,(s[1]-f.aabb.min[1])/(f.aabb.max[1]-f.aabb.min[1])*Xl|0)*Xl+Math.min(63,g),b=f.heightmap[x];if(!(b<0&&h.node.footprint))return h.hiddenByReplacement?void 0:{height:b,maxHeight:h.feature.properties.height,hidden:!1,verticalScale:h.evaluatedScale[2]};if(h.node.footprint.grid.query(new Fe(e,t),new Fe(e,t),n),n.length>0)return{height:void 0,maxHeight:h.feature.properties.height,hidden:h.hiddenByReplacement,verticalScale:h.evaluatedScale[2]}}}}
7function tf(r,e){return r instanceof Ia&&!r.isLightConstant&&e}function Jw(r,e,t,n,s,c,h,f){let p=(61440&e|(61440&e)>>4)>>8,g=(3840&e|(3840&e)>>4)>>4,x=240&e|(240&e)>>4;t[3]>0&&(p=dt(p,255*t[0],t[3]),g=dt(g,255*t[1],t[3]),x=dt(x,255*t[2],t[3]));const b=p<<8|g,w=x<<8|Math.floor(255*n[3]),S=function(q){const ie=k(q,0,2);return Math.min(Math.round(.5*ie*255),255)}(n[2])<<8|15*n[0]<<4|15*n[1],E=k(s[0],0,1),A=k(s[1],0,1),P=k(s[2],0,1),R=k(s[3],0,1);let B,L,U,G;if(E!==A&&h!==c&&A!==E){const q=h-c;L=1/(q*(A-E)),U=-(c+q*E)/(q*(A-E));const ie=k(s[4],-1,1);G=Math.pow(10,ie),B=255*P<<8|255*R}else B=65535,L=0,U=1,G=1;if(r.emplaceBack(b,w,S,B,L,U,G),f){const q=f.length;f.clear();for(let ie=0;ie<q;ie++)f.emplaceBack(b,w,S,B,L,U,G)}}function eT(r,e,t){const n=r.node;let s=0;const c=t&Ru.HasMeshoptCompression;for(const h of n.meshes){if(n.lights&&n.lightMeshIndex===s||!h.featureData)continue;h.featureArray=new vu,h.featureArray.reserve(h.featureData.length);let f=e;for(const p of h.featureData){const g=c?65535&p:p>>16&65535,x=c?p>>16&65535:65535&p,b=(15&x)<8?15&x:0,w=r.evaluatedRMEA[b],S=r.evaluatedColor[b],E=r.emissionHeightBasedParams[b];let A;if(f&&b===2&&n.lights&&(A=new vu,A.resize(10*n.lights.length)),Jw(h.featureArray,g,S,w,E,h.aabb.min[2],h.aabb.max[2],A),A&&f){f=!1;const P=n.meshes[n.lightMeshIndex];P.featureArray=A,P.featureArray._trim()}}h.featureArray._trim(),s++}}Qe(hm,"Tiled3dModelBucket",{omit:["layers"]}),Qe(a0,"Tiled3dModelFeature");const tT=["id","tile","layer","source","sourceLayer","state"];class ic{constructor(e,t,n,s,c){this.type="Feature",this._vectorTileFeature=e,this._z=t,this._x=n,this._y=s,this.properties=e?e.properties:{},this.id=c}clone(){const e=new ic(this._vectorTileFeature,this._z,this._x,this._y,this.id);return this.state&&(e.state=Object.assign({},this.state)),this.layer&&(e.layer=Object.assign({},this.layer)),this.source&&(e.source=this.source),this.sourceLayer&&(e.sourceLayer=this.sourceLayer),e}get geometry(){return this._geometry===void 0&&this._vectorTileFeature&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._x,this._y,this._z).geometry),this._geometry}set geometry(e){this._geometry=e}toJSON(){const e={type:"Feature",state:void 0,geometry:this.geometry,properties:this.properties};for(const t of tT)this[t]!==void 0&&(e[t]=this[t]);return e}}class rc extends na{constructor(e,t,n,s){super(),this.id=e,this.type="model",this.models=[],this._options=t,this._modelsInfo=new Map,this._abortController=null}cancelModelRequests(){this._abortController&&(this._abortController.abort(),this._abortController=null)}loadGLTFFromURI(e,t){return Tx(this.map._requestManager.transformRequest(e,rl.Model).url,t)}async loadModel(e,t,n){try{const s=await this.loadGLTFFromURI(t.uri,n);if(n.aborted)return;const c=this._modelsInfo.get(e);if(!c)return;const h=Y_(s),f=c.modelSpec,p=new Cx(e,f.uri,f.position,f.orientation,h);rc.applyModelSpecification(p,f),p.computeBoundsAndApplyParent(),this.models.push(p),c.model=p}catch(s){if(s instanceof Error&&s.name==="AbortError")return;const c=s instanceof Error?s.message:"Unknown error";this.fire(new rn(new Error(`Could not load model ${e} from ${t.uri}: ${c}`)))}}async load(){this._abortController||(this._abortController=new AbortController);const e=this._abortController.signal,t=[];for(const n in this._options.models){const s=this._options.models[n],c=this._modelsInfo.get(n);if(c&&c.model){c.modelSpec=s;const h=c.model;h.position=s.position!=null?new se(s.position[0],s.position[1]):new se(0,0),h.orientation=s.orientation!=null?s.orientation:[0,0,0],rc.applyModelSpecification(h,s),h.computeBoundsAndApplyParent(),this.models.push(h)}else c?c.modelSpec=s:(this._modelsInfo.set(n,{modelSpec:s,model:null}),t.push(this.loadModel(n,s,e)))}t.length!==0?(await Promise.allSettled(t),e.aborted||this.fire(new Hn("data",{dataType:"source",sourceDataType:"metadata"}))):this.loaded()&&this.fire(new Hn("data",{dataType:"source",sourceDataType:"metadata"}))}static applyModelSpecification(e,t){t.nodeOverrides&&rc.convertNodeOverrides(e,t.nodeOverrides),t.materialOverrides&&rc.convertMaterialOverrides(e,t.materialOverrides),t.nodeOverrideNames&&(e.nodeOverrideNames=[...t.n
vendor: 24,522 bytes, line 7
7odeOverrideNames]),t.materialOverrideNames&&(e.materialOverrideNames=[...t.materialOverrideNames]),t.featureProperties&&(e.featureProperties=t.featureProperties)}static convertNodeOverrides(e,t){if(Array.isArray(t)&&t.every(n=>typeof n=="string")){e.nodeOverrideNames=[];for(const n of t)e.nodeOverrideNames.push(n)}else Object.entries(t).forEach(([n,s])=>{const c={orientation:[0,0,0]};if(s.hasOwnProperty("orientation")){const h=s.orientation;h&&(c.orientation=h)}e.nodeOverrides.set(n,c)})}static convertMaterialOverrides(e,t){if(Array.isArray(t)&&t.every(n=>typeof n=="string")){e.materialOverrideNames=[];for(const n of t)e.materialOverrideNames.push(n)}else Object.entries(t).forEach(([n,s])=>{const c={color:new jt(1,1,1),colorMix:0,emissionStrength:0,opacity:1},h=s["model-color"];h!==void 0&&(c.color.r=h[0],c.color.g=h[1],c.color.b=h[2]);const f=s["model-color-mix-intensity"];f!==void 0&&(c.colorMix=f);const p=s["model-emissive-strength"];p!==void 0&&(c.emissionStrength=p);const g=s["model-opacity"];g!==void 0&&(c.opacity=g),e.materialOverrides.set(n,c)})}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,t){}serialize(){return this._options}setProperty(e,t){return!1}reload(){this.cancelModelRequests();const e=Os(this.id,this.scope);this.map.style.clearSource(e),this.models=[],this._modelsInfo.clear(),this.load()}onRemove(e){this.cancelModelRequests()}setModels(e){this.models=[];const t=new Map;for(const n in e){const s=e[n],c=this._modelsInfo.get(n);c&&c.modelSpec.uri===s.uri&&t.set(n,c)}if(this._modelsInfo.size!==t.size){this.cancelModelRequests();for(const[n,s]of t)s.model||t.delete(n)}this._modelsInfo=t,this._options.models=e,this.load()}}function Dg(r,e,t,n){const s=1<<r.z;e.lat=xe((n/Ze+r.y)/s),e.lng=le((t/Ze+r.x)/s)}function iT(r,e,t,n){const s=r.getNodesInfo()[e];if(!s||s.hiddenByReplacement||!s.node.meshes)return;let c=Number.MAX_VALUE;const h=s.node,f=t.tile,p=n.calculatePosMatrix(f.tileID.toUnwrapped(),n.worldSize),g=s.evaluatedScale;let x=0;n.elevation&&h.elevation&&(x=h.elevation*n.elevation.exaggeration()),Qr(p,p,[(h.anchor?h.anchor[0]:0)*(g[0]-1),(h.anchor?h.anchor[1]:0)*(g[1]-1),x]),Mr(p,p,g);const b=t.queryGeometry,w=b.isPointQuery()?b.screenBounds:b.screenGeometry,S=function(A){const P=Ti([],p,A.globalMatrix);Ti(P,n.expandedFarZProjMatrix,P);for(let R=0;R<A.meshes.length;++R){const B=A.meshes[R];if(R===A.lightMeshIndex)continue;const L=H_(w,n,P,B.aabb);L!=null&&(c=Math.min(L,c))}if(A.children)for(const R of A.children)S(R)};if(S(h),c===Number.MAX_VALUE)return;const E=new se(0,0);return Dg(f.tileID.canonical,E,s.node.anchor[0],s.node.anchor[1]),{intersectionZ:c,position:E,feature:s.feature}}const rT={circle:class extends Or{constructor(r,e,t,n){super(r,{layout:Zg||(Zg=new Ci({"circle-sort-key":new Ge(ue.layout_circle["circle-sort-key"]),"circle-elevation-reference":new ke(ue.layout_circle["circle-elevation-reference"]),visibility:new ke(ue.layout_circle.visibility)})),paint:Wg||(Wg=new Ci({"circle-radius":new Ge(ue.paint_circle["circle-radius"]),"circle-color":new Ge(ue.paint_circle["circle-color"]),"circle-blur":new Ge(ue.paint_circle["circle-blur"]),"circle-opacity":new Ge(ue.paint_circle["circle-opacity"]),"circle-translate":new ke(ue.paint_circle["circle-translate"]),"circle-translate-anchor":new ke(ue.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new ke(ue.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new ke(ue.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new Ge(ue.paint_circle["circle-stroke-width"]),"circle-stroke-color":new Ge(ue.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new Ge(ue.paint_circle["circle-stroke-opacity"]),"circle-emissive-strength":new ke(ue.paint_circle["circle-emissive-strength"]),"circle-color-use-theme":new Ge({type:"string",default:"default","property-type":"data-driven"}),"circle-stroke-color-use-theme":new Ge({type:"string",default:"default","property-type":"data-driven"})}))},e,t,n)}createBucket(r){return new Qt(r)}queryRadius(r){const e=r;return Oa("circle-radius",this,e)+Oa("circle-stroke-width",this,e)+_p(this.paint.get("circle-translate"))}queryIntersectsFeature(r,e,t,n,s,c,h,f){const p=Hg(this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),c.angle,r.pixelToTileUnitsFactor),g=this.paint.get("circle-radius").evaluate(e,t)+this.paint.get("circle-stroke-width").evaluate(e,t);return ay(r,n,c,h,f,this.paint.get("circle-pitch-alignment")==="map",this.paint.get("circle-pitch-scale")==="map",p,g)}getProgramIds(){return["circle"]}getDefaultProgramParams(r,e,t){const n=sy(this);return{config:new C(this,{zoom:e,lut:t}),defines:n,overrideFog:!1}}is3D(r){return!r&&!!this.layout&&this.layout.get("circle-elevation-reference")!=="none"}hasElevation(){return this.layout&&this.layout.get("circle-elevation-reference")!=="none"}},heatmap:class extends Or{createBucket(r){return new cy(r)}constructor(r,e,t,n){super(r,{layout:uy||(uy=new Ci({visibility:new ke(ue.layout_heatmap.visibility)})),paint:hy||(hy=new Ci({"heatmap-radius":new Ge(ue.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Ge(ue.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new ke(ue.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Ls(ue.paint_heatmap["heatmap-color"]),"heatmap-opacity":new ke(ue.paint_heatmap["heatmap-opacity"]),"heatmap-color-use-theme":new Ge({type:"string",default:"default","property-type":"data-driven"})}))},e,t,n),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(r){r==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=Id({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 Oa("heatmap-radius",this,r)}queryIntersectsFeature(r,e,t,n,s,c,h,f){const p=this.paint.get("heatmap-radius").evaluate(e,t);return ay(r,n,c,h,f,!0,!0,new Fe(0,0),p)}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}getProgramIds(){return["heatmap","heatmapTexture"]}getDefaultProgramParams(r,e,t){return r==="heatmap"?{config:new C(this,{zoom:e,lut:t}),overrideFog:!1}:{}}},hillshade:class extends Or{constructor(r,e,t,n){super(r,{layout:dy||(dy=new Ci({visibility:new ke(ue.layout_hillshade.visibility)})),paint:fy||(fy=new Ci({"hillshade-illumination-direction":new ke(ue.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new ke(ue.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new ke(ue.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new ke(ue.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new ke(ue.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new ke(ue.paint_hillshade["hillshade-accent-color"]),"hillshade-emissive-strength":new ke(ue.paint_hillshade["hillshade-emissive-strength"]),"hillshade-shadow-color-use-theme":new Ge({type:"string",default:"default","property-type":"data-driven"}),"hillshade-highlight-color-use-theme":new Ge({type:"string",default:"default","property-type":"data-driven"}),"hillshade-accent-color-use-theme":new Ge({type:"string",default:"default","property-type":"data-driven"})}))},e,t,n)}shouldRedrape(){return this.hasOffscreenPass()&&this.paint.get("hillshade-illumination-anchor")==="viewport"}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}getProgramIds(){return["hillshade","hillshadePrepare"]}getDefaultProgramParams(r,e,t){return{overrideFog:!1}}},fill:class extends Or{constructor(r,e,t,n){super(r,{layout:zy||(zy=new Ci({"fill-sort-key":new Ge(ue.layout_fill["fill-sort-key"]),visibility:new ke(ue.layout_fill.visibility),"fill-elevation-reference":new ke(ue.layout_fill["fill-elevation-reference"]),"fill-construct-bridge-guard-rail":new Ge(ue.layout_fill["fill-construct-bridge-guard-rail"])})),paint:Ly||(Ly=new Ci({"fill-antialias":new ke(ue.paint_fill["fill-antialias"]),"fill-opacity":new Ge(ue.paint_fill["fill-opacity"]),"fill-color":new Ge(ue.paint_fill["fill-color"]),"fill-outline-color":new Ge(ue.paint_fill["fill-outline-color"]),"fill-translate":new ke(ue.paint_fill["fill-translate"]),"fill-translate-anchor":new ke(ue.paint_fill["fill-translate-anchor"]),"fill-pattern":new Ge(ue.paint_fill["fill-pattern"]),"fill-pattern-cross-fade":new ke(ue.paint_fill["fill-pattern-cross-fade"]),"fill-emissive-strength":new ke(ue.paint_fill["fill-emissive-strength"]),"fill-z-offset":new Ge(ue.paint_fill["fill-z-offset"]),"fill-bridge-guard-rail-color":new Ge(ue.paint_fill["fill-bridge-guard-rail-color"]),"fill-tunnel-structure-color":new Ge(ue.paint_fill["fill-tunnel-structure-color"]),"fill-color-use-theme":new Ge({type:"string",default:"default","property-type":"data-driven"}),"fill-outline-color-use-theme":new Ge({type:"string",default:"default","property-type":"data-driven"}),"fill-bridge-guard-rail-color-use-theme":new Ge({type:"string",default:"default","property-type":"data-driven"}),"fill-tunnel-structure-color-use-theme":new Ge({type:"string",default:"default","property-type":"data-driven"})}))},e,t,n)}getProgramIds(){const r=this.paint.get("fill-pattern"),e=r&&r.constantOr(1),t=[e?"fillPattern":"fill"];return this.paint.get("fill-antialias")&&t.push(e&&!this.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline"),t}getDefaultProgramParams(r,e,t){return{config:new C(this,{zoom:e,lut:t}),overrideFog:!1}}recalculate(r,e){super.recalculate(r,e);const t=this.paint._values["fill-outline-color"];t.value.kind==="constant"&&t.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(r){return new Ap(r)}queryRadius(){return _p(this.paint.get("fill-translate"))}queryIntersectsFeature(r,e,t,n,s,c){return!r.queryGeometry.isAboveHorizon&&zi($g(r.tilespaceGeometry,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),c.angle,r.pixelToTileUnitsFactor),n)}isTileClipped(){return this.paint.get("fill-z-offset").constantOr(1)===0}is3D(r){if(this.paint.get("fill-z-offset").constantOr(1)!==0)return!0;const e=this.layout&&this.layout.get("fill-elevation-reference")!=="none";return r!=null?e&&!r:e}hasElevation(){return this.layout&&this.layout.get("fill-elevation-reference")!=="none"}hasShadowPass(){return this.layout&&this.layout.get("fill-elevation-reference")!=="none"}},"fill-extrusion":class extends Or{constructor(r,e,t,n){super(r,{layout:ex||(ex=new Ci({visibility:new ke(ue["layout_fill-extrusion"].visibility),"fill-extrusion-edge-radius":new ke(ue["layout_fill-extrusion"]["fill-extrusion-edge-radius"]),"source-max-zoom":new ke(ue["layout_fill-extrusion"]["source-max-zoom"])})),paint:tx||(tx=new Ci({"fill-extrusion-opacity":new ke(ue["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Ge(ue["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new ke(ue["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new ke(ue["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Ge(ue["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-pattern-cross-fade":new ke(ue["paint_fill-extrusion"]["fill-extrusion-pattern-cross-fade"]),"fill-extrusion-height":new Ge(ue["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Ge(ue["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-height-alignment":new ke(ue["paint_fill-extrusion"]["fill-extrusion-height-alignment"]),"fill-extrusion-base-alignment":new ke(ue["paint_fill-extrusion"]["fill-extrusion-base-alignment"]),"fill-extrusion-vertical-gradient":new ke(ue["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"]),"fill-extrusion-ambient-occlusion-intensity":new ke(ue["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-intensity"]),"fill-extrusion-ambient-occlusion-radius":new ke(ue["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-radius"]),"fill-extrusion-ambient-occlusion-wall-radius":new ke(ue["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-wall-radius"]),"fill-extrusion-ambient-occlusion-ground-radius":new ke(ue["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-ground-radius"]),"fill-extrusion-ambient-occlusion-ground-attenuation":new ke(ue["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-ground-attenuation"]),"fill-extrusion-flood-light-color":new ke(ue["paint_fill-extrusion"]["fill-extrusion-flood-light-color"]),"fill-extrusion-flood-light-intensity":new ke(ue["paint_fill-extrusion"]["fill-extrusion-flood-light-intensity"]),"fill-extrusion-flood-light-wall-radius":new Ge(ue["paint_fill-extrusion"]["fill-extrusion-flood-light-wall-radius"]),"fill-extrusion-flood-light-ground-radius":new Ge(ue["paint_fill-extrusion"]["fill-extrusion-flood-light-ground-radius"]),"fill-extrusion-flood-light-ground-attenuation":new ke(ue["paint_fill-extrusion"]["fill-extrusion-flood-light-ground-attenuation"]),"fill-extrusion-vertical-scale":new ke(ue["paint_fill-extrusion"]["fill-extrusion-vertical-scale"]),"fill-extrusion-rounded-roof":new ke(ue["paint_fill-extrusion"]["fill-extrusion-rounded-roof"]),"fill-extrusion-cutoff-fade-range":new ke(ue["paint_fill-extrusion"]["fill-extrusion-cutoff-fade-range"]),"fill-extrusion-front-cutoff":new ke(ue["paint_fill-extrusion"]["fill-extrusion-front-cutoff"]),"fill-extrusion-emissive-strength":new Ge(ue["paint_fill-extrusion"]["fill-extrusion-emissive-strength"]),"fill-extrusion-line-width":new Ge(ue["paint_fill-extrusion"]["fill-extrusion-line-width"]),"fill-extrusion-cast-shadows":new ke(ue["paint_fill-extrusion"]["fill-extrusion-cast-shadows"]),"fill-extrusion-color-use-theme":new Ge({type:"string",default:"default","property-type":"data-driven"}),"fill-extrusion-flood-light-color-use-theme":new Ge({type:"string",default:"default","property-type":"data-driven"})}))},e,t,n),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(r){return new Fp(r)}queryRadius(){return _p(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,t,n,s,c,h,f,p){const g=Hg(this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),c.angle,r.pixelToTileUnitsFactor),x=this.paint.get("fill-extrusion-height").evaluate(e,t),b=this.paint.get("fill-extrusion-base").evaluate(e,t),w=[0,0],S=f&&c.elevation,E=c.elevation?c.elevation.exaggeration():1,A=r.tile.getBucket(this);if(A instanceof Fp){const U=A.centroidData.find(G=>p>=G.vertexArrayOffset&&p<G.vertexArrayOffset+G.vertexCount);if(U&&U.flags&zp)return!1;if(S){const G=A.centroidVertexArray,q=p+1;q<G.length&&(w[0]=G.geta_centroid_pos0(q),w[1]=G.geta_centroid_pos1(q))}}if(w[0]===0&&w[1]===1)return!1;c.projection.name==="globe"&&(n=Jy([n],[new Fe(0,0),new Fe(Ze,Ze)],r.tileID.canonical).map(U=>U.polygon).flat());const P=S?f:null,[R,B]=lx(c,n,b,x,g,h,P,w,E,c.center.lat,r.tileID.canonical),L=r.queryGeometry;return ax(R,B,L.isPointQuery()?L.screenBounds:L.screenGeometry)}},building:class extends Or{constructor(r,e,t,n){super(r,{layout:Fx||(Fx=new Ci({visibility:new ke(ue.layout_building.visibility),"building-facade":new Ge(ue.layout_building["building-facade"]),"building-facade-floors":new Ge(ue.layout_building["building-facade-floors"]),"building-facade-unit-width":new Ge(ue.layout_building["building-facade-unit-width"]),"building-facade-window":new Ge(ue.layout_building["building-facade-window"]),"building-roof-shape":new Ge(ue.layout_building["building-roof-shape"]),"building-height":new Ge(ue.layout_building["building-height"]),"building-base":new Ge(ue.layout_building["building-base"]),"building-flood-light-wall-radius":new Ge(ue.layout_building["building-flood-light-wall-radius"]),"building-flood-light-ground-radius":new Ge(ue.layout_building["building-flood-light-ground-radius"]),"building-flip-roof-orientation":new Ge(ue.layout_building["building-flip-roof-orientation"])})),paint:Ox||(Ox=new Ci({"building-opacity":new ke(ue.paint_building["building-opacity"]),"building-ambient-occlusion-intensity":new ke(ue.paint_building["building-ambient-occlusion-intensity"]),"building-ambient-occlusion-ground-intensity":new ke(ue.paint_building["building-ambient-occlusion-ground-intensity"]),"building-ambient-occlusion-ground-radius":new ke(ue.paint_building["building-ambient-occlusion-ground-radius"]),"building-ambient-occlusion-ground-attenuation":new ke(ue.paint_building["building-ambient-occlusion-ground-attenuation"]),"building-vertical-scale":new ke(ue.paint_building["building-vertical-scale"]),"building-cast-shadows":new ke(ue.paint_building["building-cast-shadows"]),"building-color":new Ge(ue.paint_building["building-color"]),"building-emissive-strength":new Ge(ue.paint_building["building-emissive-strength"]),"building-facade-emissive-chance":new ke(ue.paint_building["building-facade-emissive-chance"]),"building-cutoff-fade-range":new ke(ue.paint_building["building-cutoff-fade-range"]),"building-front-cutoff":new ke(ue.paint_building["building-front-cutoff"]),"building-flood-light-color":new ke(ue.paint_building["building-flood-light-color"]),"building-flood-light-intensity":new ke(ue.paint_building["building-flood-light-intensity"]),"building-flood-light-ground-attenuation":new ke(ue.paint_building["building-flood-light-ground-attenuation"]),"building-color-use-theme":new Ge({type:"string",default:"default","property-type":"data-driven"}),"building-flood-light-color-use-theme":new Ge({type:"string",default:"default","property-type":"data-driven"})}))},e,t,n),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(r){return new Lx(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,t,n,s,c,h,f,p,g){let x=this.layout.get("building-height").evaluate(e,t);const b=this.layout.get("building-base").evaluate(e,t),w=r.tile.getBucket(this).getFootprint(e);if(w){if(w.hiddenFlags!==0)return!1;x=w.height}const[S,E]=lx(c,n,b,x,new Fe(0,0),h,null,[0,0],1,c.center.lat,r.tileID.canonical),A=r.queryGeometry;return ax(S,E,A.isPointQuery()?A.screenBounds:A.screenGeometry)}},line:class extends Or{constructor(r,e,t,n){const s=Hx();super(r,s,e,t,n),s.layout&&(this.layout=new rs(s.layout)),this.gradientVersion=0,this.hasElevatedBuckets=!1,this.hasNonElevatedBuckets=!1}_handleSpecialPaintPropertyUpdate(r){if(r==="line-gradient"){const e=this._transitionablePaint._values["line-gradient"].value.expression;this.stepInterpolant=e._styleExpression&&e._styleExpression.expression instanceof vl,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(jd)return jd;const t=Hx();return jd=new X1(t.paint.properties["line-width"].specification),jd.useIntegerZoom=!0,jd})().possiblyEvaluate(this._transitioningPaint._values["line-width"].value,r)}createBucket(r){return new Hp(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,t){if(r==="lineBlendComposite")return{};const n=qx(this);return{config:new C(this,{zoom:e,lut:t}),defines:n,overrideFog:!1}}queryRadius(r){const e=r,t=Zx(Oa("line-width",this,e),Oa("line-gap-width",this,e)),n=Oa("line-offset",this,e);return t/2+Math.abs(n)+_p(this.paint.get("line-translate"))}queryIntersectsFeature(r,e,t,n,s,c){if(r.queryGeometry.isAboveHorizon)return!1;const h=$g(r.tilespaceGeometry,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),c.angle,r.pixelToTileUnitsFactor),f=r.pixelToTileUnitsFactor/2*Zx(this.paint.get("line-width").evaluate(e,t),this.paint.get("line-gap-width").evaluate(e,t)),p=this.paint.get("line-offset").evaluate(e,t);return p&&(n=function(g,x){const b=[],w=new Fe(0,0);for(let S=0;S<g.length;S++){const E=g[S],A=[];for(let P=0;P<E.length;P++){const R=E[P],B=E[P+1],L=P===0?w:R.sub(E[P-1])._unit()._perp(),U=P===E.length-1?w:B.sub(R)._unit()._perp(),G=L._add(U)._unit();G._mult(1/(G.x*U.x+G.y*U.y)),A.push(G._mult(x)._add(R))}b.push(A)}return b}(n,p*r.pixelToTileUnitsFactor)),function(g,x,b){for(let w=0;w<x.length;w++){const S=x[w];if(g.length>=3){for(let E=0;E<S.length;E++)if(Xr(g,S[E]))return!0}if(ln(g,S,b))return!0}return!1}(h,n,f)}isTileClipped(){return this.hasNonElevatedBuckets}isDraped(r){return!this.hasElevatedBuckets||this.layout&&this.layout.get("line-elevation-reference")==="hd-road-markup"}hasElevation(){return this.layout&&this.layout.get("line-elevation-reference")!=="none"}hasOffscreenPass(){return this.paint.get("line-blend-mode")!=="default"&&this.paint.get("line-opacity").constantOr(1)!==0&&this.paint.get("line-width").constantOr(1)!==0&&this.visibility!=="none"}resize(){this._destroyLineBlendFbo()}_clear(){this._destroyLineBlendFbo()}_destroyLineBlendFbo(){this.lineBlendFbo&&(this.lineBlendFbo.destroy(),this.lineBlendFbo=null),this.lineBlendStencil=null,this.lineBlendDrapeFbo&&(this.lineBlendDrapeFbo.destroy(),this.lineBlendDrapeFbo=null),this.lineBlendDrapeStencil=null}},symbol:sm,background:class extends Or{constructor(r,e,t,n){super(r,{layout:Uv||(Uv=new Ci({visibility:new ke(ue.layout_background.visibility)})),paint:jv||(jv=new Ci({"background-pitch-alignment":new ke(ue.paint_background["background-pitch-alignment"]),"background-color":new ke(ue.paint_background["background-color"]),"background-pattern":new ke(ue.paint_background["background-pattern"]),"background-opacity":new ke(ue.paint_background["background-opacity"]),"background-emissive-strength":new ke(ue.paint_background["background-emissive-strength"]),"background-color-use-theme":new Ge({type:"string",default:"default","property-type":"data-driven"})}))},e,t,n)}getProgramIds(){return[this.paint.get("background-pattern")?"backgroundPattern":"background"]}getDefaultProgramParams(r,e,t){return{overrideFog:!1}}is3D(r){return this.paint.get("background-pitch-alignment")==="viewport"}},raster:Zv,"raster-particle":t0,sky:class extends Or{constructor(r,e,t,n){super(r,{layout:Yv||(Yv=new Ci({visibility:new ke(ue.layout_sky.visibility)})),paint:Kv||(Kv=new Ci({"sky-type":new ke(ue.paint_sky["sky-type"]),"sky-atmosphere-sun":new ke(ue.paint_sky["sky-atmosphere-sun"]),"sky-atmosphere-sun-intensity":new ke(ue.paint_sky["sky-atmosphere-sun-intensity"]),"sky-gradient-center":new ke(ue.paint_sky["sky-gradient-center"]),"sky-gradient-radius":new ke(ue.paint_sky["sky-gradient-radius"]),"sky-gradient":new Ls(ue.paint_sky["sky-gradient"]),"sky-atmosphere-halo-color":new ke(ue.paint_sky["sky-atmosphere-halo-color"]),"sky-atmosphere-color":new ke(ue.paint_sky["sky-atmosphere-color"]),"sky-opacity":new ke(ue.paint_sky["sky-opacity"]),"sky-gradient-use-theme":new Ge({type:"string",default:"default","property-type":"data-driven"}),"sky-atmosphere-halo-color-use-theme":new Ge({type:"string",default:"default","property-type":"data-driven"}),"sky-atmosphere-color-use-theme":new Ge({type:"string",default:"default","property-type":"data-driven"})}))},e,t,n),this._updateColorRamp()}_clear(){this.skyboxFbo&&(this.skyboxFbo.destroy(),this.skyboxFbo=null),this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null),this._skyboxInvali
7dated=!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=Id({expression:this._transitionablePaint._values["sky-gradient"].value.expression,evaluationKey:"skyRadialProgress"}),this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null)}needsSkyboxCapture(r){if(this._skyboxInvalidated||!this.skyboxTexture||!this.skyboxGeometry)return!0;if(!this.paint.get("sky-atmosphere-sun")){const e=r.style.light.properties.get("position");return this._lightPosition.azimuthal!==e.azimuthal||this._lightPosition.polar!==e.polar}return!1}getCenter(r,e){if(this.paint.get("sky-type")==="atmosphere"){const n=this.paint.get("sky-atmosphere-sun"),s=!n,c=r.style.light,h=c.properties.get("position");return s&&c.properties.get("anchor")==="viewport"&&lt("The sun direction is attached to a light with viewport anchor, lighting may behave unexpectedly."),s?Ag(h.azimuthal,90-h.polar,e):Ag(n[0],90-n[1],e)}const t=this.paint.get("sky-gradient-center");return Ag(t[0],90-t[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 Or{constructor(r,e,t,n){super(r,{paint:Qv||(Qv=new Ci({}))},e,null)}},model:class extends Or{constructor(r,e,t,n){super(r,{layout:Jv||(Jv=new Ci({visibility:new ke(ue.layout_model.visibility),"model-id":new Ge(ue.layout_model["model-id"]),"model-allow-density-reduction":new ke(ue.layout_model["model-allow-density-reduction"])})),paint:e0||(e0=new Ci({"model-opacity":new Ge(ue.paint_model["model-opacity"]),"model-rotation":new Ge(ue.paint_model["model-rotation"]),"model-scale":new Ge(ue.paint_model["model-scale"]),"model-translation":new Ge(ue.paint_model["model-translation"]),"model-color":new Ge(ue.paint_model["model-color"]),"model-color-mix-intensity":new Ge(ue.paint_model["model-color-mix-intensity"]),"model-type":new ke(ue.paint_model["model-type"]),"model-cast-shadows":new ke(ue.paint_model["model-cast-shadows"]),"model-receive-shadows":new ke(ue.paint_model["model-receive-shadows"]),"model-ambient-occlusion-intensity":new ke(ue.paint_model["model-ambient-occlusion-intensity"]),"model-emissive-strength":new Ge(ue.paint_model["model-emissive-strength"]),"model-roughness":new Ge(ue.paint_model["model-roughness"]),"model-height-based-emissive-strength-multiplier":new Ge(ue.paint_model["model-height-based-emissive-strength-multiplier"]),"model-cutoff-fade-range":new ke(ue.paint_model["model-cutoff-fade-range"]),"model-front-cutoff":new ke(ue.paint_model["model-front-cutoff"]),"model-elevation-reference":new ke(ue.paint_model["model-elevation-reference"]),"model-ignore-line-cutout":new ke(ue.paint_model["model-ignore-line-cutout"]),"model-color-use-theme":new Ge({type:"string",default:"default","property-type":"data-driven"})}))},e,t,n),this.layer=r,this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(r){return new Mg(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 hm?8191:0}queryRenderedFeatures(r,e,t){const n=e.getSource();if(!(n&&n instanceof rc))return{};const s=n,c={};c[this.id]=[];const h=c[this.id];let f=0;for(const p of s.models){const g=e.getFeatureState(this.sourceLayer,p.id),x={type:"Unknown",id:p.id,properties:p.featureProperties},b=this.paint.get("model-rotation").evaluate(x,g),w=this.paint.get("model-scale").evaluate(x,g),S=this.paint.get("model-translation").evaluate(x,g),E=this.paint.get("model-elevation-reference");let A=[];Gp(A,p,t,p.position,b,w,S,E==="ground",E==="ground",!1),t.projection.name==="globe"&&(A=jp(A,t));const P=Ti([],t.projMatrix,A),R=H_(r.isPointQuery()?r.screenBounds:r.screenGeometry,t,P,p.aabb);if(R!=null){const B=new ic(void 0,0,0,0,p.id);B.layer=this.layer,B.properties=structuredClone(p.featureProperties),B.properties.layer=this.id,B.properties.uri=p.uri,B.properties.orientation=p.orientation,B.sourceLayer=this.sourceLayer,B.geometry={type:"Point",coordinates:[p.position.lng,p.position.lat]},B.state=g,B.source=this.source,h.push({featureIndex:f,feature:B,intersectionZ:R})}++f}return c}queryIntersectsFeature(r,e,t,n,s,c,h,f,p,g){if(!this.modelManager)return!1;const x=this.modelManager,b=r.tile.getBucket(this);if(!(b&&b instanceof Mg))return!1;for(const w in b.instancesPerModel){const S=b.instancesPerModel[w],E=e.id!==void 0?e.id:e.properties&&e.properties.hasOwnProperty("id")?e.properties.id:void 0;if(S.idToFeaturesIndex.hasOwnProperty(E)){const A=S.features[S.idToFeaturesIndex[E]],P=x.getModel(w,g||this.scope);if(!P)return!1;let R=[];const B=new se(0,0),L=b.canonical;let U=Number.MAX_VALUE;for(let G=0;G<A.instancedDataCount;++G){const q=16*(A.instancedDataOffset+G),ie=S.instancedDataArray.float32,X=[ie[q+4],ie[q+5],ie[q+6]];Dg(L,B,Math.floor(ie[q]),Math.floor(ie[q+1])),Gp(R,P,c,B,A.rotation,A.scale,X,!1,!1,
vendor: 8,426 bytes, line 7
7!1),c.projection.name==="globe"&&(R=jp(R,c));const ee=Ti([],c.projMatrix,R),Q=r.queryGeometry,J=H_(Q.isPointQuery()?Q.screenBounds:Q.screenGeometry,c,ee,P.aabb);J!=null&&(U=Math.min(J,U))}return U!==Number.MAX_VALUE&&U}}return!1}_handleOverridablePaintPropertyUpdate(r,e,t){return!(!this.layout||e.isDataDriven()||t.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 Ea}isZoomDependent(){return this._isPropertyZoomDependent("model-scale")||this._isPropertyZoomDependent("model-rotation")||this._isPropertyZoomDependent("model-translation")}},clip:class extends Or{constructor(r,e,t,n){super(r,{layout:Fy||(Fy=new Ci({"clip-layer-types":new ke(ue.layout_clip["clip-layer-types"]),"clip-layer-scope":new ke(ue.layout_clip["clip-layer-scope"]),visibility:new ke(ue.layout_clip.visibility)})),paint:Oy||(Oy=new Ci({}))},e,t,n)}recalculate(r,e){super.recalculate(r,e)}createBucket(r){return new By(r)}is3D(r){return!0}}};class nT{constructor(e){this._callback=e,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._callback()},0))}remove(){this._channel=void 0,this._callback=()=>{}}}class l0{constructor(e){this._stringToNumber={},this._numberToString=[];for(let t=0;t<e.length;t++){const n=e[t];this._stringToNumber[n]=t,this._numberToString[t]=n}}encode(e){return this._stringToNumber[e]}decode(e){return this._numberToString[e]}}class c0{constructor(e,t){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new Mo(Ze,16,0),this.featureIndexArray=new yd,this.promoteId=t,this.is3DTile=!1,this.serializedLayersCache=new Map}insert(e,t,n,s,c,h=0,f=0){const p=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(n,s,c,h);const g=this.grid;for(let x=0;x<t.length;x++){const b=t[x],w=[1/0,1/0,-1/0,-1/0];for(let S=0;S<b.length;S++){const E=b[S];w[0]=Math.min(w[0],E.x),w[1]=Math.min(w[1],E.y),w[2]=Math.max(w[2],E.x),w[3]=Math.max(w[3],E.y)}f!==0&&(w[0]-=f,w[1]-=f,w[2]+=f,w[3]+=f),w[0]<Ze&&w[1]<Ze&&w[2]>=0&&w[3]>=0&&g.insert(p,w[0],w[1],w[2],w[3])}}loadVTLayers(){if(!this.vtLayers){this.vtLayers=new Gt(new Zp(this.rawTileData)).layers,this.sourceLayerCoder=new l0(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"]),this.vtFeatures={};for(const e in this.vtLayers)this.vtFeatures[e]=[]}return this.vtLayers}query(e,t){const{tilespaceGeometry:n,transform:s,tileTransform:c,pixelPosMatrix:h,availableImages:f,worldview:p}=t;this.loadVTLayers(),this.serializedLayersCache.clear();const g=t.queryRadius?t.queryRadius:0,x=n.bufferedTilespaceBounds,b=this.grid.query(x.min.x,x.min.y,x.max.x,x.max.y,(A,P,R,B)=>os(n.bufferedTilespaceGeometry,A-g,P-g,R+g,B+g));b.sort(oT);let w=null;s.elevation&&b.length>0&&(w=Nu.create(s.elevation,this.tileID));const S={};let E;for(let A=0;A<b.length;A++){const P=b[A];if(P===E)continue;E=P;const R=this.featureIndexArray.get(P);let B=null;this.is3DTile?this.loadMatchingModelFeature(S,R,e,n,s,p):this.loadMatchingFeature(S,R,e,f,p,(L,U,G,q=0)=>(B||(B=ft(L,this.tileID.canonical,c)),U.queryIntersectsFeature(n,L,G,B,this.z,s,h,w,q,t.scope)))}return S}loadMatchingFeature(e,t,n,s,c,h){const{featureIndex:f,bucketIndex:p,sourceLayerIndex:g,layoutVertexArrayOffset:x}=t,b=this.bucketLayerIDs[p],w=n.layers,S=Object.keys(w);if(S.length&&!ut(S,b))return;const E=n.sourceCache,A=this.sourceLayerCoder.decode(g),P=this.vtLayers[A].feature(f),R=this.getId(P,A);for(let B=0;B<b.length;B++){const L=b[B];if(!w[L])continue;const{styleLayer:U,targets:G}=w[L];let q={};R!==void 0&&(q=E.getFeatureState(U.sourceLayer,R));const ie=!h||h(P,U,q,x);if(!ie)continue;const X=new ic(P,this.z,this.x,this.y,R);X.tile=this.tileID.canonical,X.state=q;let ee=this.serializedLayersCache.get(L);ee||(ee=U.serialize(),ee.id=L,this.serializedLayersCache.set(L,ee)),X.source=ee.source,X.sourceLayer=ee["source-layer"],X.layer=Object.assign({},ee),X.layer.paint=u0(ee.paint,U.paint,P,q,s),X.layer.layout=u0(ee.layout,U.layout,P,q,s);let Q=!1;for(const J of G){this.updateFeatureProperties(X,J);const{filter:ve}=J;if(ve){if(P.properties=X.properties,ve.needGeometry){const Te=Ct(P,!0);if(!ve.filter(new Zt(this.tileID.overscaledZ,{worldview:c}),Te,this.tileID.canonical))continue}else if(!ve.filter(new Zt(this.tileID.overscaledZ,{worldview:c}),P))continue}Q=!0,J.targetId&&this.addFeatureVariant(X,J)}Q&&this.appendToResult(e,L,f,X,ie)}}loadMatchingModelFeature(e,t,n,s,c,h){const{featureIndex:f,bucketIndex:p}=t,g=this.bucketLayerIDs[p],x=n.layers,b=Object.keys(x);if(!b.length||ut(b,g))for(let w=0;w<g.length;w++){const S=g[w],{styleLayer:E,targets:A}=x[S];if(E.type!=="model")continue;const P=s.tile,R=P.getBucket(E);if(!(R&&R instanceof hm))continue;const B=iT(R,f,s,c);if(!B)continue;const{z:L,x:U,y:G}=P.tileID.canonical,{feature:q,intersectionZ:ie,position:X}=B;let ee={};q.id!==void 0&&(ee=n.sourceCache.getFeatureState(E.sourceLayer,q.id));const Q=new ic({},L,U,G,q.id);Q.tile=this.tileID.canonical,Q.state=ee,Q.properties=q.properties,Q.geometry={type:"Point",coordinates:[X.lng,X.lat]};let J=this.serializedLayersCache.get(S);J||(J=E.serialize(),J.id=S,this.serializedLayersCache.set(S,J)),Q.source=J.source,Q.sourceLayer=J["source-layer"],Q.layer=Object.assign({},J);let ve=!1;for(const Te of A){this.updateFeatureProperties(Q,Te);const{filter:Ie}=Te;if(Ie){if(q.properties=Q.properties,Ie.needGeometry){if(!Ie.filter(new Zt(this.tileID.overscaledZ,{worldview:h}),q,this.tileID.canonical))continue}else if(!Ie.filter(new Zt(this.tileID.overscaledZ,{worldview:h}),q))continue}ve=!0,Te.targetId&&this.addFeatureVariant(Q,Te)}ve&&this.appendToResult(e,S,f,Q,ie)}}updateFeatureProperties(e,t,n){if(t.properties){const s={};for(const c in t.properties){const h=t.properties[c].evaluate({zoom:this.z},e._vectorTileFeature,e.state,e.tile,n);h!=null&&(s[c]=h)}e.properties=s}}addFeatureVariant(e,t,n){const s={target:t.target,namespace:t.namespace,uniqueFeatureID:t.uniqueFeatureID};t.properties&&(s.properties=e.properties),e.variants=e.variants||{},e.variants[t.targetId]=e.variants[t.targetId]||[],e.variants[t.targetId].push(s)}appendToResult(e,t,n,s,c){let h=e[t];h===void 0&&(h=e[t]=[]),h.push({featureIndex:n,feature:s,intersectionZ:c})}lookupSymbolFeatures(e,t,n,s,c,h){const f={};this.loadVTLayers();for(const p of e)this.loadMatchingFeature(f,{bucketIndex:t,sourceLayerIndex:n,featureIndex:p,layoutVertexArrayOffset:0},s,c,h);return f}loadFeature(e){const{featureIndex:t,sourceLayerIndex:n}=e;this.loadVTLayers();const s=this.sourceLayerCoder.decode(n),c=this.vtFeatures[s];if(c[t])return c[t];const h=this.vtLayers[s].feature(t);return c[t]=h,h}hasLayer(e){for(const t of this.bucketLayerIDs)for(const n of t)if(e===n)return!0;return!1}getId(e,t){let n=e.id;if(this.promoteId){const s=Array.isArray(this.promoteId)||typeof this.promoteId!="object"?this.promoteId:this.promoteId[t];if(s!=null)if(Array.isArray(s)){if(!this.promoteIdExpression){const c=Co(s);if(c.result!=="success"){const h=c.value.map(f=>`${f.key}: ${f.message}`).join(", ");return void lt(`Failed to create expression for promoteId: ${h}`)}this.promoteIdExpression=c.value}n=this.promoteIdExpression.evaluate({zoom:0},e)}else n=e.properties[s];typeof n=="boolean"&&(n=Number(n))}return n}}function u0(r,e,t,n,s){return Re(r,(c,h)=>{const f=e instanceof rs?e.get(h):null;return f&&f.evaluate?f.evaluate(t,n,void 0,s):f})}function oT(r,e){return e-r}function h0(r,e){const t={};if(!e)return t;for(const n of r){const s=n.layerIds.map(c=>e.getLayer(c)).filter(Boolean);if(s.length!==0){n.layers=s,n.stateDependentLayerIds&&(n.stateDependentLayers=n.stateDependentLayerIds.map(c=>s.filter(h=>h.id===c)[0]));for(const c of s)t[c.fqid]=n}}return t}Qe(c0,"FeatureIndex",{omit:["rawTileData","sourceLayerCoder"]});const fo=32,ds=33,Ga=new Uint16Array(8184);for(let r=0;r<2046;r++){let e=r+2,t=0,n=0,s=0,c=0,h=0,f=0;for(1&e?s=c=h=fo:t=n=f=fo;(e>>=1)>1;){const g=t+s>>1,x=n+c>>1;1&e?(s=t,c=n,t=h,n=f):(t=s,n=c,s=h,c=f),h=g,f=x}const p=4*r;Ga[p+0]=t,Ga[p+1]=n,Ga[p+2]=s,Ga[p+3]=c}
7const fs=new Uint16Array(2178),qa=new Uint8Array(1089),dm=new Uint16Array(1089);function d0(r){return r===0?-.03125:r===32?.03125:0}const f0={Other:0,Symbol:1,FillExtrusion:2},p0={type:2,extent:Ze,loadGeometry:()=>[[new Fe(0,0),new Fe(8193,0),new Fe(8193,8193),new Fe(0,8193),new Fe(0,0)]]};class sT{constructor(){this.tasks={},this.taskQueue=[],ge(["process"],this),this.invoker=new nT(this.process),this.nextId=0}add(e,t){const n=this.nextId++,s=function({type:c,renderSourceType:h,zoom:f}){f=f||0;const p=h===f0.Symbol;return c==="message"?0:c!=="maybePrepare"||p?c!=="parseTile"||p?c==="parseTile"&&p?300-f:c==="maybePrepare"&&p?400-f:500:200-f:100-f}(t);if(s===0){try{e()}finally{}return null}return this.tasks[n]={fn:e,metadata:t,priority:s,id:n},this.taskQueue.push(n),this.invoker.trigger(),{cancel:()=>{delete this.tasks[n]}}}process(){try{if(this.taskQueue=this.taskQueue.filter(n=>!!this.tasks[n]),!this.taskQueue.length)return;const e=this.pick();if(e===null)return;const t=this.tasks[e];if(delete this.tasks[e],this.taskQueue.length&&this.invoker.trigger(),!t)return;t.fn()}finally{}}pick(){let e=null,t=1/0;for(let s=0;s<this.taskQueue.length;s++){const c=this.tasks[this.taskQueue[s]];c.priority<t&&(t=c.priority,e=s)}if(e===null)return null;const n=this.taskQueue[e];return this.taskQueue.splice(e,1),n}remove(){this.invoker.remove()}}const Rg=new jt(0,0,0);function aT(r,e,t){r===1&&e.icons.push(function(n,s){return function(c){if(c.usvg_tree.height||(c.usvg_tree.height=c.usvg_tree.width),!c.metadata)return c;const{metadata:h}=c;if(h.content_area){const{content_area:f}=h;f.left==null&&(f.left=0),f.top==null&&(f.top=f.left),f.width==null&&(f.width=c.usvg_tree.width),f.height==null&&(f.height=f.width)}if(h.text_placeholder){const{text_placeholder:f}=h;f.top==null&&(f.top=f.left),f.height==null&&(f.height=f.width)}return h.stretch_x&&h.stretch_x.length&&m0(h,"x"),h.stretch_y&&h.stretch_y.length&&m0(h,"y"),c}(n.readFields(lT,{name:void 0},s))}(t,t.readVarint()+t.pos))}function m0(r,e){const t=[],n=r[`stretch_${e}`];let s=null;for(let c=0;c<n.length;c++)s===null?s=t.length===0?n[0]:t[t.length-1][1]+n[c]:(t.push([s,s+n[c]]),s=null);r[`stretch_${e}_areas`]=t}function lT(r,e,t){r===1?e.name=t.readString():r===2?e.metadata=function(n,s){return n.readFields(cT,{stretch_x:null,stretch_y:null,stretch_x_areas:null,stretch_y_areas:null,variables:[]},s)}(t,t.readVarint()+t.pos):r===3&&(e.usvg_tree=function(n,s){return n.readFields(dT,{width:20,children:[],linear_gradients:[],radial_gradients:[],clip_paths:[],masks:[]},s)}(t,t.readVarint()+t.pos),e.data="usvg_tree")}function cT(r,e,t){r===1?e.stretch_x=t.readPackedVarint():r===2?e.stretch_y=t.readPackedVarint():r===3?e.content_area=_0(t,t.readVarint()+t.pos):r===4?e.variables.push(function(n,s){return n.readFields(hT,{name:void 0},s)}(t,t.readVarint()+t.pos)):r===5&&(e.text_placeholder=_0(t,t.readVarint()+t.pos))}function _0(r,e){return r.readFields(uT,{},e)}function uT(r,e,t){r===1?e.left=t.readVarint():r===2?e.width=t.readVarint():r===3?e.top=t.readVarint():r===4&&(e.height=t.readVarint())}function hT(r,e,t){r===1?e.name=t.readString():r===2&&(e.rgb_color=mm(t.readVarint()),e.value="rgb_color")}function dT(r,e,t){r===1?e.width=e.height=t.readVarint():r===2?e.height=t.readVarint():r===3?e.children.push(fm(t,t.readVarint()+t.pos)):r===4?e.linear_gradients.push(function(n,s){return n.readFields(xT,{spread_method:1,stops:[],x1:0,y1:0,x2:1,y2:0},s)}(t,t.readVarint()+t.pos)):r===5?e.radial_gradients.push(function(n,s){return n.readFields(bT,{spread_method:1,stops:[],cx:.5,cy:.5,r:.5,fx:.5,fy:.5,fr:0},s)}(t,t.readVarint()+t.pos)):r===7?e.clip_paths.push(function(n,s){return n.readFields(wT,{children:[]},s)}(t,t.readVarint()+t.pos)):r===8&&e.masks.push(function(n,s){const c=n.readFields(TT,{left:0,width:20,mask_type:1,children:[]},s);return c.height==null&&(c.height=c.width),c.top==null&&(c.top=c.left),c}(t,t.readVarint()+t.pos))}function fm(r,e){return r.readFields(fT,{},e)}function fT(r,e,t){r===1?(e.group=function(n,s){return n.readFields(pT,{opacity:255,children:[]},s)}(t,t.readVarint()+t.pos),e.node="group"):r===2&&(e.path=function(n,s){return n.readFields(_T,{paint_order:1,commands:[],step:1,diffs:[],rule:1},s)}(t,t.readVarint()+t.pos),e.node="path")}function pT(r,e,t){r===1?e.transform=pm(t,t.readVarint()+t.pos):r===2?e.opacity=t.readVarint():r===5?e.clip_path_idx=t.readVarint():r===6?e.mask_idx=t.readVarint():r===7&&e.children.push(fm(t,t.readVarint()+t.pos))}function pm(r,e){return r.readFields(mT,{sx:1,ky:0,kx:0,sy:1,tx:0,ty:0},e)}function mT(r,e,t){r===1?e.sx=t.readFloat():r===2?e.ky=t.readFloat():r===3?e.kx=t.readFloat():r===4?e.sy=t.readFloat():r===5?e.tx=t.readFloat():r===6&&(e.ty=t.readFloat())}function _T(r,e,t){r===1?e.fill=function(n,s){return n.readFields(gT,{rgb_color:Rg,paint:"rgb_color",opacity:255},s)}(t,t.readVarint()+t.pos):r===2?e.stroke=function(n,s){return n.readFields(yT,{rgb_color:Rg,paint:"rgb_color",dasharray:[],dashoffset:0,miterlimit:4,opacity:255,width:1,linecap:1,linejoin:1},s)}(t,t.readVarint()+t.pos):r===3?e.paint_order=t.readVarint():r===5?t.readPackedVarint(e.commands):r===6?e.
7step=t.readFloat():r===7?t.readPackedSVarint(e.diffs):r===8&&(e.rule=t.readVarint())}function gT(r,e,t){r===1?(e.rgb_color=mm(t.readVarint()),e.paint="rgb_color"):r===2?(e.linear_gradient_idx=t.readVarint(),e.paint="linear_gradient_idx"):r===3?(e.radial_gradient_idx=t.readVarint(),e.paint="radial_gradient_idx"):r===5&&(e.opacity=t.readVarint())}function mm(r){return new jt((r>>16&255)/255,(r>>8&255)/255,(255&r)/255,1)}function yT(r,e,t){r===1?(e.rgb_color=mm(t.readVarint()),e.paint="rgb_color"):r===2?(e.linear_gradient_idx=t.readVarint(),e.paint="linear_gradient_idx"):r===3?(e.radial_gradient_idx=t.readVarint(),e.paint="radial_gradient_idx"):r===5?t.readPackedFloat(e.dasharray):r===6?e.dashoffset=t.readFloat():r===7?e.miterlimit=t.readFloat():r===8?e.opacity=t.readVarint():r===9?e.width=t.readFloat():r===10?e.linecap=t.readVarint():r===11&&(e.linejoin=t.readVarint())}function xT(r,e,t){r===1?e.transform=pm(t,t.readVarint()+t.pos):r===2?e.spread_method=t.readVarint():r===3?e.stops.push(g0(t,t.readVarint()+t.pos)):r===4?e.x1=t.readFloat():r===5?e.y1=t.readFloat():r===6?e.x2=t.readFloat():r===7&&(e.y2=t.readFloat())}function g0(r,e){return r.readFields(vT,{offset:0,opacity:255,rgb_color:Rg},e)}function vT(r,e,t){r===1?e.offset=t.readFloat():r===2?e.opacity=t.readVarint():r===3&&(e.rgb_color=mm(t.readVarint()))}function bT(r,e,t){r===1?e.transform=pm(t,t.readVarint()+t.pos):r===2?e.spread_method=t.readVarint():r===3?e.stops.push(g0(t,t.readVarint()+t.pos)):r===4?e.cx=t.readFloat():r===5?e.cy=t.readFloat():r===6?e.r=t.readFloat():r===7?e.fx=t.readFloat():r===8?e.fy=t.readFloat():r===9&&(e.fr=t.readFloat())}function wT(r,e,t){r===1?e.transform=pm(t,t.readVarint()+t.pos):r===2?e.clip_path_idx=t.readVarint():r===3&&e.children.push(fm(t,t.readVarint()+t.pos))}function TT(r,e,t){r===1?e.left=e.top=t.readFloat():r===2?e.width=e.height=t.readFloat():r===3?e.top=t.readFloat():r===4?e.height=t.readFloat():r===5?e.mask_type=t.readVarint():r===6?e.mask_idx=t.readVarint():r===7&&e.children.push(fm(t,t.readVarint()+t.pos))}class ST{static calculate(e={},t=[]){const n=new Map,s=new Map;if(Object.keys(e).length===0)return n;t.forEach(c=>{s.set(c.name,c.rgb_color||new jt(0,0,0))});for(const[c,h]of Object.entries(e))s.has(c)?n.set(s.get(c).toString(),h):console.warn(`Ignoring unknown image variable "${c}"`);return n}}function Uu(r,e=255,t){const n=e/255,s=r.toString(),c=t.has(s)?t.get(s).clone():r.clone();return c.a*=n,c.toString()}function rf(r,e){if(!Ss()){const t=document.createElement("canvas");return t.width=r,t.height=e,t}return new OffscreenCanvas(r,e)}let zg,nf=null;function Lg(r,e,t,n,s){for(const c of n.children)y0(r,e,t,c,s)}function y0(r,e,t,n,s){n.group?(r.save(),function(c,h,f,p,g){const x=p.mask_idx!=null?f.masks[p.mask_idx]:null,b=p.clip_path_idx!=null?f.clip_paths[p.clip_path_idx]:null;if(p.transform&&(h=ju(p.transform).preMultiplySelf(h)),!function(E,A,P){return E.opacity!==255||A||P}(p,b!=null,x!=null))return void Lg(c,h,f,p,g);const w=rf(c.canvas.width,c.canvas.height),S=w.getContext("2d");Lg(S,h,f,p,g),b&&I0(S,h,f,b),x&&E0(S,h,f,x,g),c.globalAlpha=p.opacity/255,c.drawImage(w,0,0)}(r,e,t,n.group,s),r.restore()):n.path&&(r.save(),function(c,h,f,p,g){c.setTransform(h),p.paint_order===1?(x0(c,f,p,g),b0(c,f,p,g)):(b0(c,f,p,g),x0(c,f,p,g))}(r,e,t,n.path,s),r.restore())}function x0(r,e,t,n){const s=t.fill;if(!s)return;const c=s.opacity/255;switch(r.save(),r.beginPath(),A0(t,r),s.paint){case"rgb_color":r.fillStyle=Uu(s.rgb_color,s.opacity,n);break;case"linear_gradient_idx":{const h=e.linear_gradients[s.linear_gradient_idx];h.transform&&r.setTransform(ju(h.transform).preMultiplySelf(r.getTransform())),r.fillStyle=w0(r,h,c,n);break}case"radial_gradient_idx":{const h=e.radial_gradients[s.radial_gradient_idx];h.transform&&r.setTransform(ju(h.transform).preMultiplySelf(r.getTransform())),r.fillStyle=T0(r,h,c,n)}}r.fill(v0(t)),r.restore()}function v0(r){return r.rule===1?"nonzero":r.rule===2?"evenodd":void 0}function b0(r,e,t,n){const s=t.stroke;if(!s)return;const c=C0(t);r.lineWidth=s.width,r.miterLimit=s.miterlimit,r.setLineDash(s.dasharray),r.lineDashOffset=s.dashoffset;const h=s.opacity/255;switch(s.paint){case"rgb_color":r.strokeStyle=Uu(s.rgb_color,s.opacity,n);break;case"linear_gradient_idx":r.strokeStyle=w0(r,e.linear_gradients[s.linear_gradient_idx],h,n,!0);break;case"radial_gradient_idx":r.strokeStyle=T0(r,e.radial_gradients[s.radial_gradient_idx],h,n,!0)}switch(s.linejoin){case 2:case 1:r.lineJoin="miter";break;case 3:r.lineJoin="round";break;case 4:r.lineJoin="bevel"}switch(s.linecap){case 1:r.lineCap="butt";break;case 2:r.lineCap="round";break;case 3:r.lineCap="square"}r.stroke(c)}function w0(r,e,t,n,s=!1){if(e.stops.length===1){const w=e.stops[0];return Uu(w.rgb_color,w.opacity*t,n)}const{x1:c,y1:h,x2:f,y2:p}=e;let g=new DOMPoint(c,h),x=new DOMPoint(f,p);if(s){const w=ju(e.transform);g=w.transformPoint(g),x=w.transformPoint(x)}const b=r.createLinearGradient(g.x,g.y,x.x,x.y);for(const w of e.stops)b.addColorStop(w.offset,Uu(w.rgb_color,w.opacity*t,n));return b}function T0(r,e,t,n,s=!1){if(e.stops.length===1){const R=e.stops[0];return Uu(R.rgb_color,R.opacity*t,n)}const c=ju(e.transform),{fx:h,fy:f,fr:p,cx:g,cy:x,r:b}=e;let w=new DOMPoint(h,f),S=new DOMPoint(g,x),E=p,A=b;if(s){w=c.transformPoint(w),S=c.transformPoint(S);const R=(c.a+c.d)/2;E=p*R,A=e.r*R}const P=r.createRadialGradient(w.x,w.y,E,S.x,S.y,A);for(const R of e.stops)P.addColorStop(R.offset,Uu(R.rgb_color,R.opacity*t,n));return P}function S0(r,e,t,n){const s=n.transform?ju(n.transform).preMultiplySelf(e):e,c=rf(r.canvas.width,r.canvas.height),h=c.getContext("2d");for(const p of n.children)if(p.group)S0(h,s,t,p.group);else if(p.path){const g=p.path,x=new Path2D;x.addPath(C0(g),s),h.fill(x,v0(g))}const f=n.clip_path_idx!=null?t.clip_paths[n.clip_path_idx]:null;f&&I0(h,s,t,f),r.globalCompositeOperation="source-over",r.drawImage(c,0,0)}function I0(r,e,t,n){const s=rf(r.canvas.width,r.canvas.height);S0(s.getContext("2d"),e,t,n),r.globalCompositeOperation="destination-in",r.drawImage(s,0,0)}function E0(r,e,t,n,s){if(n.children.length===0)return;const c=n.mask_idx!=null?t.masks[n.mask_idx]:null;c&&E0(r,e,t,c,s);const h=r.canvas.width,f=r.canvas.height,p=rf(h,f),g=p.getContext("2d"),x=n.width,b=n.height,w=n.left,S=n.top,E=new Path2D,A=new Path2D;A.rect(w,S,x,b),E.addPath(A,e),g.clip(E);for(const B of n.children)y0(g,e,t,B,s);const P=g.getImageData(0,0,h,f),R=P.data;if(n.mask_type===1)for(let B=0;B<R.length;B+=4)R[B+3]=R[B+3]/255*(.2126*R[B]+.7152*R[B+1]+.0722*R[B+2]);
vendor: 4,923 bytes, line 7
7g.putImageData(P,0,0),r.globalCompositeOperation="destination-in",r.drawImage(p,0,0)}function ju(r){return r?new DOMMatrix([r.sx,r.ky,r.kx,r.sy,r.tx,r.ty]):new DOMMatrix}function A0(r,e){const t=r.step;let n=r.diffs[0]*t,s=r.diffs[1]*t;e.moveTo(n,s);for(let c=0,h=2;c<r.commands.length;c++)switch(r.commands[c]){case 1:n+=r.diffs[h++]*t,s+=r.diffs[h++]*t,e.moveTo(n,s);break;case 2:n+=r.diffs[h++]*t,s+=r.diffs[h++]*t,e.lineTo(n,s);break;case 3:{const f=n+r.diffs[h++]*t,p=s+r.diffs[h++]*t;n=f+r.diffs[h++]*t,s=p+r.diffs[h++]*t,e.quadraticCurveTo(f,p,n,s);break}case 4:{const f=n+r.diffs[h++]*t,p=s+r.diffs[h++]*t,g=f+r.diffs[h++]*t,x=p+r.diffs[h++]*t;n=g+r.diffs[h++]*t,s=x+r.diffs[h++]*t,e.bezierCurveTo(f,p,g,x,n,s);break}case 5:e.closePath();break}return e}function C0(r){return A0(r,new Path2D)}class _m{constructor(e){this.capacity=e,this.cache=new Map}get(e){if(!this.cache.has(e))return;const t=this.cache.get(e);return this.cache.delete(e),this.cache.set(e,t),t}put(e,t){this.cache.has(e)?this.cache.delete(e):this.cache.size===this.capacity&&this.cache.delete(this.cache.keys().next().value),this.cache.set(e,t)}delete(e){this.cache.delete(e)}}Qe(_m,"LRUCache");class Fg{constructor(){this.cacheMap=new Map,this.cacheDependenciesMap=new Map}static _getImage(e){return new Dr(e,e.data)}getFromCache(e,t,n){return this.cacheMap.has(n)||this.cacheMap.set(n,new _m(150)),this.cacheMap.get(n).get(Os(e.toString(),t))}setInCache(e,t,n,s){this.cacheDependenciesMap.has(s)||this.cacheDependenciesMap.set(s,new Map),this.cacheMap.has(s)||this.cacheMap.set(s,new _m(150));const c=this.cacheDependenciesMap.get(s),h=Os(e.id.toString(),n);c.get(h)||c.set(h,new Set);const f=this.cacheMap.get(s),p=e.toString();c.get(h).add(p),f.put(Os(e.toString(),n),t)}removeImagesFromCacheByIds(e,t,n=0){if(!this.cacheMap.has(n)||!this.cacheDependenciesMap.has(n))return;const s=this.cacheMap.get(n),c=this.cacheDependenciesMap.get(n);for(const h of e){const f=Os(h.toString(),t);if(c.has(f)){for(const p of c.get(f))s.delete(p);c.delete(f)}}}rasterize(e,t,n,s){const c=this.getFromCache(e,n,s);if(c)return c.clone();const h=function(p,g){const x=ST.calculate(g.params,p.metadata?p.metadata.variables:[]),b=p.usvg_tree,w=b.width,S=b.height,E=Math.max(1,Math.round(w*g.sx)),A=Math.max(1,Math.round(S*g.sy)),P=new DOMMatrix([E/w,0,0,A/S,0,0]);return nf===null&&(nf=rf(10,10),zg=nf.getContext("2d",{willReadFrequently:!0})),nf.width=E,nf.height=A,Lg(zg,P,b,b,x),zg.getImageData(0,0,E,A)}(t.icon,e),f=Fg._getImage(h);return this.setInCache(e,f,n,s),f.clone()}}class M0{constructor(e){this.size=e,this.minimums=[],this.maximums=[],this.leaves=[]}getElevation(e,t){const n=this.toIdx(e,t);return{min:this.minimums[n],max:this.maximums[n]}}isLeaf(e,t){return this.leaves[this.toIdx(e,t)]}toIdx(e,t){return t*this.size+e}}function P0(r,e,t,n){let s=0,c=Number.MAX_VALUE;for(let h=0;h<3;h++)if(Math.abs(n[h])<1e-15){if(t[h]<r[h]||t[h]>e[h])return null}else{const f=1/n[h];let p=(r[h]-t[h])*f,g=(e[h]-t[h])*f;if(p>g){const x=p;p=g,g=x}if(p>s&&(s=p),g<c&&(c=g),s>c)return null}return s}function D0(r,e,t,n,s,c,h,f,p,g,x){const b=n-r,w=s-e,S=c-t,E=h-r,A=f-e,P=p-t,R=x[1]*P-x[2]*A,B=x[2]*E-x[0]*P,L=x[0]*A-x[1]*E,U=b*R+w*B+S*L;if(Math.abs(U)<1e-15)return null;const G=1/U,q=g[0]-r,ie=g[1]-e,X=g[2]-t,ee=(q*R+ie*B+X*L)*G;if(ee<0||ee>1)return null;const Q=ie*S-X*w,J=X*b-q*S,ve=q*w-ie*b,Te=(x[0]*Q+x[1]*J+x[2]*ve)*G;return Te<0||ee+Te>1?null:(E*Q+A*J+P*ve)*G}function R0(r,e,t){return(r-e)/(t-e)}function z0(r,e,t,n,s,c,h,f,p){const g=1<<t,x=c-n,b=h-s,w=(r+1)/g*x+n,S=(e+0)/g*b+s,E=(e+1)/g*b+s;f[0]=(r+0)/g*x+n,f[1]=S,p[0]=w,p[1]=E}class L0{constructor(e){if(this.maximums=[],this.minimums=[],this.leaves=[],this.childOffsets=[],this.nodeCount=0,this.dem=e,this._siblingOffset=[[0,0],[1,0],[0,1],[1,1]],!this.dem)return;const t=function(c){const h=Math.ceil(Math.log2(c.dim/8)),f=[];let p=Math.ceil(Math.pow(2,h));const g=1/p,x=(S,E,A,P,R)=>{const B=P?1:0,L=(S+1)*A-B,U=E*A,G=(E+1)*A-B;R[0]=S*A,R[1]=U,R[2]=L,R[3]=G};let b=new M0(p);const w=[];for(let S=0;S<p*p;S++){x(S%p,Math.floor(S/p),g,!1,w);const E=$a(w[0],w[1],c),A=$a(w[2],w[1],c),P=$a(w[2],w[3],c),R=$a(w[0],w[3],c);b.minimums.push(Math.min(E,A,P,R)),b.maximums.push(Math.max(E,A,P,R)),b.leaves.push(1)}for(f.push(b),p/=2;p>=1;p/=2){const S=f[f.length-1];b=new M0(p);for(let E=0;E<p*p;E++){x(E%p,Math.floor(E/p),2,!0,w);const A=S.getElevation(w[0],w[1]),P=S.getElevation(w[2],w[1]),R=S.getElevation(w[2],w[3]),B=S.getElevation(w[0],w[3]),L=S.isLeaf(w[0],w[1]),U=S.isLeaf(w[2],w[1]),G=S.isLeaf(w[2],w[3]),q=S.isLeaf(w[0],w[3]),ie=Math.min(A.min,P.min,R.min,B.min),X=Math.max(A.max,P.max,R.max,B.max),ee=L&&U&&G&&q;b.maximums.push(X),b.minimums.push(ie),b.leaves.push(X-ie<=5&&ee?1:0)}f.push(b)}return f}(this.dem),n=t.length-1,s=t[n];this._addNode(s.minimums[0],s.maximums[0],s.leaves[0]),this._construct(t,0,0,n,0)}raycastRoot(e,t,n,s,c,h,f=1){return P0([e,t,-100],[n,s,this.maximums[0]*f],c,h)}
vendor: 14,528 bytes, line 7
7raycast(e,t,n,s,c,h,f=1){if(!this.nodeCount)return null;const p=this.raycastRoot(e,t,n,s,c,h,f);if(p==null)return null;const g=[],x=[],b=[],w=[],S=[{idx:0,t:p,nodex:0,nodey:0,depth:0}];for(;S.length>0;){const{idx:E,t:A,nodex:P,nodey:R,depth:B}=S.pop();if(this.leaves[E]){z0(P,R,B,e,t,n,s,b,w);const U=1<<B,G=(P+0)/U,q=(P+1)/U,ie=(R+0)/U,X=(R+1)/U,ee=$a(G,ie,this.dem)*f,Q=$a(q,ie,this.dem)*f,J=$a(q,X,this.dem)*f,ve=$a(G,X,this.dem)*f,Te=D0(b[0],b[1],ee,w[0],b[1],Q,w[0],w[1],J,c,h),Ie=D0(w[0],w[1],J,b[0],w[1],ve,b[0],b[1],ee,c,h),Ce=Math.min(Te!==null?Te:Number.MAX_VALUE,Ie!==null?Ie:Number.MAX_VALUE);if(Ce!==Number.MAX_VALUE)return Ce;{const Ee=un([],c,h,A);if(F0(ee,Q,ve,J,R0(Ee[0],b[0],w[0]),R0(Ee[1],b[1],w[1]))>=Ee[2])return A}continue}let L=0;for(let U=0;U<this._siblingOffset.length;U++){z0((P<<1)+this._siblingOffset[U][0],(R<<1)+this._siblingOffset[U][1],B+1,e,t,n,s,b,w),b[2]=-100,w[2]=this.maximums[this.childOffsets[E]+U]*f;const G=P0(b,w,c,h);if(G!=null){const q=G;g[U]=q;let ie=!1;for(let X=0;X<L&&!ie;X++)q>=g[x[X]]&&(x.splice(X,0,U),ie=!0);ie||(x[L]=U),L++}}for(let U=0;U<L;U++){const G=x[U];S.push({idx:this.childOffsets[E]+G,t:g[G],nodex:(P<<1)+this._siblingOffset[G][0],nodey:(R<<1)+this._siblingOffset[G][1],depth:B+1})}}return null}_addNode(e,t,n){return this.minimums.push(e),this.maximums.push(t),this.leaves.push(n),this.childOffsets.push(0),this.nodeCount++}_construct(e,t,n,s,c){if(e[s].isLeaf(t,n)===1)return;this.childOffsets[c]||(this.childOffsets[c]=this.nodeCount);const h=s-1,f=e[h];let p=0,g=0;for(let x=0;x<this._siblingOffset.length;x++){const b=2*t+this._siblingOffset[x][0],w=2*n+this._siblingOffset[x][1],S=f.getElevation(b,w),E=f.isLeaf(b,w),A=this._addNode(S.min,S.max,E);E&&(p|=1<<x),g||(g=A)}for(let x=0;x<this._siblingOffset.length;x++)p&1<<x||this._construct(e,2*t+this._siblingOffset[x][0],2*n+this._siblingOffset[x][1],h,g+x)}}function F0(r,e,t,n,s,c){return dt(dt(r,t,c),dt(e,n,c),s)}function $a(r,e,t){const n=t.dim,s=k(r*n-.5,0,n-1),c=k(e*n-.5,0,n-1),h=Math.floor(s),f=Math.floor(c),p=Math.min(h+1,n-1),g=Math.min(f+1,n-1);return F0(t.get(h,f),t.get(p,f),t.get(h,g),t.get(p,g),s-h,c-f)}const IT={mapbox:[6553.6,25.6,.1,1e4],terrarium:[256,1,1/256,32768]};function ET(r,e,t){return(256*r*256+256*e+t)/10-1e4}function AT(r,e,t){return 256*r+e+t/256-32768}class gm{get tree(){return this._tree||this._buildQuadTree(),this._tree}constructor(e,t,n,s=!1){if(this.uid=e,t.height!==t.width)throw new RangeError("DEM tiles must be square");if(n&&n!=="mapbox"&&n!=="terrarium")return void lt(`"${n}" is not a valid encoding type. Valid types include "mapbox" and "terrarium".`);this.stride=t.height;const c=this.dim=t.height-2,h=new Uint32Array(t.data.buffer);if(this.pixels=new Uint8Array(t.data.buffer),this.floatView=new Float32Array(t.data.buffer),this.borderReady=s,this._modifiedForSources={},!s){for(let p=0;p<c;p++)h[this._idx(-1,p)]=h[this._idx(0,p)],h[this._idx(c,p)]=h[this._idx(c-1,p)],h[this._idx(p,-1)]=h[this._idx(p,0)],h[this._idx(p,c)]=h[this._idx(p,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=n==="terrarium"?AT:ET;for(let p=0;p<h.length;++p){const g=4*p;this.floatView[p]=f(this.pixels[g],this.pixels[g+1],this.pixels[g+2])}this._timestamp=fn.now()}_buildQuadTree(){this._tree=new L0(this)}get(e,t,n=!1){n&&(e=k(e,-1,this.dim),t=k(t,-1,this.dim));const s=this._idx(e,t);return this.floatView[s]}set(e,t,n){const s=this._idx(e,t),c=this.floatView[s];return this.floatView[s]=n,n-c}static getUnpackVector(e){return IT[e]}_idx(e,t){if(e<-1||e>=this.dim+1||t<-1||t>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(t+1)*this.stride+(e+1)}static pack(e,t){const n=[0,0,0,0],s=gm.getUnpackVector(t);let c=Math.floor((e+s[3])/s[2]);return n[2]=c%256,c=Math.floor(c/256),n[1]=c%256,c=Math.floor(c/256),n[0]=c,n}getPixels(){return new _y({width:this.stride,height:this.stride},this.pixels)}backfillBorder(e,t,n){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let s=t*this.dim,c=t*this.dim+this.dim,h=n*this.dim,f=n*this.dim+this.dim;switch(t){case-1:s=c-1;break;case 1:c=s+1}switch(n){case-1:h=f-1;break;case 1:f=h+1}const p=-t*this.dim,g=-n*this.dim;for(let x=h;x<f;x++)for(let b=s;b<c;b++){const w=4*this._idx(b,x),S=4*this._idx(b+p,x+g);this.pixels[w+0]=e.pixels[S+0],this.pixels[w+1]=e.pixels[S+1],this.pixels[w+2]=e.pixels[S+2],this.pixels[w+3]=e.pixels[S+3]}}onDeserialize(){this._tree&&(this._tree.dem=this)}}function CT(r,e,t){r===1?e.headerLength=t.readFixed32():r===2?e.x=t.readVarint():r===3?e.y=t.readVarint():r===4?e.z=t.readVarint():r===5&&e.layers.push(function(n,s){return n.readFields(zT,{version:0,name:"",units:"",tileSize:0,buffer:0,pixelFormat:0,dataIndex:[]},s)}(t,t.readVarint()+t.pos))}function MT(r,e,t){r===1?(e.delta_filter=function(n,s){return n.readFields(PT,{blockSize:0},s)}(t,t.readVarint()+t.pos),e.filter="delta_filter"):r===2?(t.readVarint(),e.filter="zigzag_filter"):r===3?(t.readVarint(),e.filter="bitshuffle_filter"):r===4&&(t.readVarint(),e.filter="byteshuffle_filter")}function PT(r,e,t){r===1&&(e.blockSize=t.readVarint())}function DT(r,e,t){r===1?(t.readVarint(),e.codec="gzip_data"):r===2?(t.readVarint(),e.codec="jpeg_image"):r===3?(t.readVarint(),e.codec="webp_image"):r===4&&(t.readVarint(),e.codec="png_image")}function RT(r,e,t){let n=0,s=0;r===1?e.firstByte=t.readFixed64():r===2?e.lastByte=t.readFixed64():r===3?e.filters.push(function(c,h){return c.readFields(MT,{},h)}(t,t.readVarint()+t.pos)):r===4?e.codec=function(c,h){return c.readFields(DT,{},h)}(t,t.readVarint()+t.pos):r===5?s=t.readFloat():r===6?n=t.readFloat():r===7?e.bands.push(t.readString()):r===8?e.offset=t.readDouble():r===9&&(e.scale=t.readDouble()),e.offset===0&&(e.offset=s),e.scale===0&&(e.scale=n)}function zT(r,e,t){r===1?e.version=t.readVarint():r===2?e.name=t.readString():r===3?e.units=t.readString():r===4?e.tileSize=t.readVarint():r===5?e.buffer=t.readVarint():r===6?e.pixelFormat=t.readVarint():r===7&&e.dataIndex.push(function(n,s){return n.readFields(RT,{firstByte:0,lastByte:0,filters:[],codec:null,offset:0,scale:0,bands:[]},s)}(t,t.readVarint()+t.pos))}function LT(r,e,t){if(r===2)(function(n,s,c){n.readFields(FT,c,s)})(t,t.readVarint()+t.pos,e);else if(r===3)throw new Error("Not implemented")}function FT(r,e,t){if(r===1){let n=0;const s=t.readVarint()+t.pos;for(;t.pos<s;)e[n++]=t.readVarint()}}function OT(r,e){if(e.length!==4)throw new Error(`Expected data of dimension 4 but got ${e.length}.`);let t=e[3];for(let n=2;n>=1;n--){const s=n===1?1:0,c=n===2?1:0;for(let h=0;h<e[0];h++){const f=e[1]*h;for(let p=s;p<e[1];p++){const g=e[2]*(p+f);for(let x=c;x<e[2];x++){const b=e[3]*(x+g);for(let w=0;w<e[3];w++){const S=b+w;r[S]+=r[S-t]}}}}t*=e[n]}return r}function BT(r){for(let e=0,t=r.length;e<t;e++)r[e]=r[e]>>>1^-(1&r[e]);return r}function kT(r,e){switch(e){case"uint32":return r;case"uint16":for(let t=0;t<r.length;t+=2){const n=r[t],s=r[t+1];r[t]=(240&n)>>4|(61440&n)>>8|(240&s)<<4|61440&s,r[t+1]=15&n|(3840&n)>>4|(15&s)<<8|(3840&s)<<4}return r;case"uint8":for(let t=0;t<r.length;t+=4){const n=r[t],s=r[t+1],c=r[t+2],h=r[t+3];r[t+0]=(192&n)>>6|(192&s)>>4|(192&c)>>2|192&h,r[t+1]=(48&n)>>4|(48&s)>>2|48&c|(48&h)<<2,r[t+2]=(12&n)>>2|12&s|(12&c)<<2|(12&h)<<4,r[t+3]=3&n|(3&s)<<2|(3&c)<<4|(3&h)<<6}return r;default:throw new Error(`Invalid pixel format, "${e}"`)}}Qe(gm,"DEMData"),Qe(L0,"DemMinMaxQuadTree",{omit:["dem"]});var Xn=Uint8Array,of=Uint16Array,VT=Int32Array,O0=new Xn([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]),B0=new Xn([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]),NT=new Xn([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),k0=function(r,e){for(var t=new of(31),n=0;n<31;++n)t[n]=e+=1<<r[n-1];var s=new VT(t[30]);for(n=1;n<30;++n)for(var c=t[n];c<t[n+1];++c)s[c]=c-t[n]<<5|n;return{b:t,r:s}},V0=k0(O0,2),N0=V0.b,UT=V0.r;N0[28]=258,UT[258]=28;for(var jT=k0(B0,0).b,U0=new of(32768),or=0;or<32768;++or){var Gu=(43690&or)>>1|(21845&or)<<1;U0[or]=((65280&(Gu=(61680&(Gu=(52428&Gu)>>2|(13107&Gu)<<2))>>4|(3855&Gu)<<4))>>8|(255&Gu)<<8)>>1}var sf=function(r,e,t){for(var n=r.length,s=0,c=new of(e);s<n;++s)r[s]&&++c[r[s]-1];var h,f=new of(e);for(s=1;s<e;++s)f[s]=f[s-1]+c[s-1]<<1;h=new of(1<<e);var p=15-e;for(s=0;s<n;++s)if(r[s])for(var g=s<<4|r[s],x=e-r[s],b=f[r[s]-1]++<<x,w=b|(1<<x)-1;b<=w;++b)h[U0[b]>>p]=g;return h},af=new Xn(288);for(or=0;or<144;++or)af[or]=8;for(or=144;or<256;++or)af[or]=9;for(or=256;or<280;++or)af[or]=7;for(or=280;or<288;++or)af[or]=8;var j0=new Xn(32);for(or=0;or<32;++or)j0[or]=5;var GT=sf(af,9),qT=sf(j0,5),Og=function(r){for(var e=r[0],t=1;t<r.length;++t)r[t]>e&&(e=r[t]);return e},Bo=function(r,e,t){var n=e/8|0;return(r[n]|r[n+1]<<8)>>(7&e)&t},Bg=function(r,e){var t=e/8|0;return(r[t]|r[t+1]<<8|r[t+2]<<16)>>(7&e)},$T=function(r){return(r+7)/8|0},HT=["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"],ko=function(r,e,t){var n=new Error(e||HT[r]);if(n.code=r,Error.captureStackTrace&&Error.captureStackTrace(n,ko),!t)throw n;return n},ZT=new Xn(0),WT=typeof TextDecoder<"u"&&new TextDecoder;try{WT.decode(ZT,{stream:!0})}catch{}const XT={gzip_data:"gzip"};class po extends Error{constructor(e){super(e),this.name="MRTError"}}const YT={0:"uint32",1:"uint32",2:"uint16",3:"uint8"},G0={uint32:1,uint16:2,uint8:4},KT={uint32:Uint32Array,uint16:Uint16Array,uint8:Uint8Array};let kg;class ym{constructor(e=5){this.x=NaN,this.y=NaN,this.z=NaN,this.layers={},this._cacheSize=e}getLayer(e){const t=this.layers[e];if(!t)throw new po(`Layer '${e}' not found`);return t}getHeaderLength(e){const t=new Uint8Array(e),n=new DataView(e);if(t[0]!==13)throw new po("File is not a valid MRT.");return n.getUint32(1,!0)}parseHeader(e){const t=new Uint8Array(e),n=this.getHeaderLength(e);if(t.length<n)throw new po(`Expected header with length >= ${n} but got buffer of length ${t.length}`);const s=new kg(t.subarray(0,n)).readFields(CT,{headerLength:0,x:0,y:0,z:0,layers:[]},void 0);if(!isNaN(this.x)&&(this.x!==s.x||this.y!==s.y||this.z!==s.z))throw new po(`Invalid attempt to parse header ${s.z}/${s.x}/${s.y} for tile ${this.z}/${this.x}/${this.y}`);this.x=s.x,this.y=s.y,this.z=s.z;for(const c of s.layers)this.layers[c.name]=new q0(c,{cacheSize:this._cacheSize});return this}createDecodingTask(e){const t=[],n=this.getLayer(e.layerName);for(let s of e.blockIndices){const c=n.dataIndex[s],h=c.firstByte-e.firstByte,f=c.lastByte-e.firstByte;if(n._blocksInProgress.has(s))continue;const p={layerName:n.name,firstByte:h,lastByte:f,pixelFormat:n.pixelFormat,blockIndex:s,blockShape:[c.bands.length].concat(n.bandShape),buffer:n.buffer,codec:c.codec.codec,filters:c.filters.map(g=>g.filter)};n._blocksInProgress.add(s),t.push(p)}return new $0(t,()=>{t.forEach(s=>n._blocksInProgress.delete(s.blockIndex))},(s,c)=>{if(t.forEach(h=>n._blocksInProgress.delete(h.blockIndex)),s)throw s;c.forEach(h=>{this.getLayer(h.layerName).processDecodedData(h)})})}}class q0{constructor({version:e,name:t,units:n,tileSize:s,pixelFormat:c,buffer:h,dataIndex:f},p){if(this.version=e,this.version!==1)throw new po(`Cannot parse raster layer encoded with MRT version ${e}`);this.name=t,this.units=n,this.tileSize=s,this.buffer=h,this.pixelFormat=YT[c],this.dataIndex=f,this.bandShape=[s+2*h,s+2*h,G0[this.pixelFormat]],this._decodedBlocks=new _m(p?p.cacheSize:5),this._blocksInProgress=new Set}get dimension(){return G0[this.pixelFormat]}get cacheSize(){return this._decodedBlocks.capacity}getBandList(){return this.dataIndex.map(({bands:e})=>e).flat()}processDecodedData(e){const t=e.blockIndex.toString();this._decodedBlocks.get(t)||this._decodedBlocks.put(t,e.data)}getBlockForBand(e){let t=0;switch(typeof e){case"string":for(const[n,s]of this.dataIndex.entries()){for(const[c,h]of s.bands.entries())if(h===e)return{bandIndex:t+c,blockIndex:n,blockBandIndex:c};t+=s.bands.length}break;case"number":for(const[n,s]of this.dataIndex.entries()){if(e>=t&&e<t+s.bands.length)return{bandIndex:e,blockIndex:n,blockBandIndex:e-t};t+=s.bands.length}break;default:throw new po(`Invalid band \`${JSON.stringify(e)}\`. Expected string or integer.`)}return{blockIndex:-1,blockBandIndex:-1}}getDataRange(e){let t=1/0,n=-1/0;const s=[],c=new Set;for(const h of e){const{blockIndex:f}=this.getBlockForBand(h);if(f<0)throw new po(`Invalid band: ${JSON.stringify(h)}`);const p=this.dataIndex[f];s.includes(f)||s.push(f),c.add(f),t=Math.min(t,p.firstByte),n=Math.max(n,p.lastByte)}if(c.size>this.cacheSize)throw new po(`Number of blocks to decode (${c.size}) exceeds cache size (${this.cacheSize}).`);return{layerName:this.name,firstByte:t,lastByte:n,blockIndices:s}}hasBand(e){const{blockIndex:t}=this.getBlockForBand(e);return t>=0}hasDataForBand(e){const{blockIndex:t}=this.getBlockForBand(e);return t>=0&&!!this._decodedBlocks.get(t.toString())}getBandView(e){const{blockIndex:t,blockBandIndex:n}=this.getBlockForBand(e);if(t<0)throw new po(`Band not found: ${JSON.stringify(e)}`);const s=this._decodedBlocks.get(t.toString());if(!s)throw new po(`Data for band ${JSON.stringify(e)} of layer "${this.name}" not decoded.`);const c=this.dataIndex[t],h=this.bandShape.reduce((g,x)=>g*x,1),f=n*h,p=s.subarray(f,f+h);return{data:p,bytes:new Uint8Array(p.buffer).subarray(p.byteOffset,p.byteOffset+p.byteLength),tileSize:this.tileSize,buffer:this.buffer,pixelFormat:this.pixelFormat,dimension:this.dimension,offset:c.offset,scale:c.scale}}}ym.setPbf=function(r){kg=r};class $0{constructor(e,t,n){this.tasks=e,this._onCancel=t,this._onComplete=n,this._finalized=!1}cancel(){this._finalized||(this._onCancel(),this._finalized=!0)}complete(e,t){this._finalized||(this._onComplete(e,t),this._finalized=!0)}}ym.performDecoding=function(r,e){const t=new Uint8Array(r);return Promise.all(e.tasks.map(n=>{const{layerName:s,firstByte:c,lastByte:h,pixelFormat:f,blockShape:p,blockIndex:g,filters:x,codec:b}=n,w=t.subarray(c,h+1),S=new Uint32Array(p[0]*p[1]*p[2]);let E;if(b!=="gzip_data")throw new po(`Unhandled codec: ${b}`);return E=function(A,P){if(!globalThis.DecompressionStream&&P==="gzip_data")return Promise.resolve((G=function(X){X[0]==31&&X[1]==139&&X[2]==8||ko(6,"invalid gzip data");var ee=X[3],Q=10;4&ee&&(Q+=2+(X[10]|X[11]<<8));for(var J=(ee>>3&1)+(ee>>4&1);J>0;J-=!X[Q++]);return Q+(2&ee)}(R=A),G+8>
7R.length&&ko(6,"invalid gzip data"),function(X,ee,Q,J){var ve=X.length;if(!ve||ee.f&&!ee.l)return Q||new Xn(0);var Te=!Q,Ie=Te||ee.i!=2,Ce=ee.i;Te&&(Q=new Xn(3*ve));var Ee=function(Fi){var Br=Q.length;if(Fi>Br){var yr=new Xn(Math.max(2*Br,Fi));yr.set(Q),Q=yr}},Oe=ee.f||0,ye=ee.p||0,Ae=ee.b||0,Pe=ee.l,Be=ee.d,Ue=ee.m,Je=ee.n,He=8*ve;do{if(!Pe){Oe=Bo(X,ye,1);var qe=Bo(X,ye+1,3);if(ye+=3,!qe){var je=X[(Wt=$T(ye)+4)-4]|X[Wt-3]<<8,Ye=Wt+je;if(Ye>ve){Ce&&ko(0);break}Ie&&Ee(Ae+je),Q.set(X.subarray(Wt,Ye),Ae),ee.b=Ae+=je,ee.p=ye=8*Ye,ee.f=Oe;continue}if(qe==1)Pe=GT,Be=qT,Ue=9,Je=5;else if(qe==2){var it=Bo(X,ye,31)+257,ht=Bo(X,ye+10,15)+4,nt=it+Bo(X,ye+5,31)+1;ye+=14;for(var wt=new Xn(nt),Ft=new Xn(19),Tt=0;Tt<ht;++Tt)Ft[NT[Tt]]=Bo(X,ye+3*Tt,7);ye+=3*ht;var Bt=Og(Ft),Mt=(1<<Bt)-1,Li=sf(Ft,Bt);for(Tt=0;Tt<nt;){var Wt,Ut=Li[Bo(X,ye,Mt)];if(ye+=15&Ut,(Wt=Ut>>4)<16)wt[Tt++]=Wt;else{var li=0,Mi=0;for(Wt==16?(Mi=3+Bo(X,ye,3),ye+=2,li=wt[Tt-1]):Wt==17?(Mi=3+Bo(X,ye,7),ye+=3):Wt==18&&(Mi=11+Bo(X,ye,127),ye+=7);Mi--;)wt[Tt++]=li}}var ur=wt.subarray(0,it),Pi=wt.subarray(it);Ue=Og(ur),Je=Og(Pi),Pe=sf(ur,Ue),Be=sf(Pi,Je)}else ko(1);if(ye>He){Ce&&ko(0);break}}Ie&&Ee(Ae+131072);for(var Ui=(1<<Ue)-1,Ki=(1<<Je)-1,ji=ye;;ji=ye){var Ar=(li=Pe[Bg(X,ye)&Ui])>>4;if((ye+=15&li)>He){Ce&&ko(0);break}if(li||ko(2),Ar<256)Q[Ae++]=Ar;else{if(Ar==256){ji=ye,Pe=null;break}var hr=Ar-254;Ar>264&&(hr=Bo(X,ye,(1<<($i=O0[Tt=Ar-257]))-1)+N0[Tt],ye+=$i);var Pt=Be[Bg(X,ye)&Ki],Ur=Pt>>4;if(Pt||ko(3),ye+=15&Pt,Pi=jT[Ur],Ur>3){var $i=B0[Ur];Pi+=Bg(X,ye)&(1<<$i)-1,ye+=$i}if(ye>He){Ce&&ko(0);break}Ie&&Ee(Ae+131072);var gr=Ae+hr;if(Ae<Pi){var jr=0-Pi,Cr=Math.min(Pi,gr);for(jr+Ae<0&&ko(3);Ae<Cr;++Ae)Q[Ae]=J[jr+Ae]}for(;Ae<gr;++Ae)Q[Ae]=Q[Ae-Pi]}}ee.l=Pe,ee.p=ji,ee.b=Ae,ee.f=Oe,Pe&&(Oe=1,ee.m=Ue,ee.d=Be,ee.n=Je)}while(!Oe);return Ae!=Q.length&&Te?function(Fi,Br,yr){return(yr==null||yr>Fi.length)&&(yr=Fi.length),new Xn(Fi.subarray(0,yr))}(Q,0,Ae):Q.subarray(0,Ae)}(R.subarray(G,-8),{i:2},new Xn(((L=R)[(U=L.length)-4]|L[U-3]<<8|L[U-2]<<16|L[U-1]<<24)>>>0),B)));var R,B,L,U,G;const q=XT[P];if(!q)throw new Error(`Unhandled codec: ${P}`);const ie=new globalThis.DecompressionStream(q);return new Response(new Blob([A]).stream().pipeThrough(ie)).arrayBuffer().then(X=>new Uint8Array(X))}(w,b).then(A=>(function(P,R){P.readFields(LT,R)}(new kg(A),S),new KT[f](S.buffer))),E.then(A=>{for(let P=x.length-1;P>=0;P--)switch(x[P]){case"delta_filter":OT(A,p);break;case"zigzag_filter":BT(A);break;case"bitshuffle_filter":kT(A,f);break;default:throw new po(`Unhandled filter "${x[P]}"`)}return{layerName:s,blockIndex:g,data:A}}).catch(A=>{throw A})}))},Qe($0,"MRTDecodingBatch",{omit:["_onCancel","_onComplete"]}),Qe(ym,"MapboxRasterTile"),Qe(q0,"MapboxRasterLayer",{omit:["_blocksInProgress"]});const H0=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class Vg{static from(e){if(!(e instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[t,n]=new Uint8Array(e,0,2);if(t!==219)throw new Error("Data does not appear to be in a KDBush format.");const s=n>>4;if(s!==1)throw new Error(`Got v${s} data when expected v1.`);const c=H0[15&n];if(!c)throw new Error("Unrecognized array type.");const[h]=new Uint16Array(e,2,1),[f]=new Uint32Array(e,4,1);return new Vg(f,h,c,e)}constructor(e,t=64,n=Float64Array,s){if(isNaN(e)||e<0)throw new Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+t,2),65535),this.ArrayType=n,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;const c=H0.indexOf(this.ArrayType),h=2*e*this.ArrayType.BYTES_PER_ELEMENT,f=e*this.IndexArrayType.BYTES_PER_ELEMENT,p=(8-f%8)%8;if(c<0)throw new Error(`Unexpected typed array class: ${n}.`);s&&s instanceof ArrayBuffer?(this.data=s,this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+f+p,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+h+f+p),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+f+p,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+c]),new Uint16Array(this.data,2,1)[0]=t,new Uint32Array(this.data,4,1)[0]=e)}add(e,t){const n=this._pos>>1;return this.ids[n]=n,this.coords[this._pos++]=e,this.coords[this._pos++]=t,n}finish(){const e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return Ng(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,t,n,s){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:c,coords:h,nodeSize:f}=this,p=[0,c.length-1,0],g=[];for(;p.length;){const x=p.pop()||0,b=p.pop()||0,w=p.pop()||0;if(b-w<=f){for(let P=w;P<=b;P++){const R=h[2*P],B=h[2*P+1];R>=e&&R<=n&&B>=t&&B<=s&&g.push(c[P])}continue}const S=w+b>>1,E=h[2*S],A=h[2*S+1];E>=e&&E<=n&&A>=t&&A<=s&&g.push(c[S]),(x===0?e<=E:t<=A)&&(p.push(w),p.push(S-1),p.push(1-x)),(x===0?n>=E:s>
7=A)&&(p.push(S+1),p.push(b),p.push(1-x))}return g}within(e,t,n){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:s,coords:c,nodeSize:h}=this,f=[0,s.length-1,0],p=[],g=n*n;for(;f.length;){const x=f.pop()||0,b=f.pop()||0,w=f.pop()||0;if(b-w<=h){for(let P=w;P<=b;P++)W0(c[2*P],c[2*P+1],e,t)<=g&&p.push(s[P]);continue}const S=w+b>>1,E=c[2*S],A=c[2*S+1];W0(E,A,e,t)<=g&&p.push(s[S]),(x===0?e-n<=E:t-n<=A)&&(f.push(w),f.push(S-1),f.push(1-x)),(x===0?e+n>=E:t+n>=A)&&(f.push(S+1),f.push(b),f.push(1-x))}return p}}function Ng(r,e,t,n,s,c){if(s-n<=t)return;const h=n+s>>1;Z0(r,e,h,n,s,c),Ng(r,e,t,n,h-1,1-c),Ng(r,e,t,h+1,s,1-c)}function Z0(r,e,t,n,s,c){for(;s>n;){if(s-n>600){const g=s-n+1,x=t-n+1,b=Math.log(g),w=.5*Math.exp(2*b/3),S=.5*Math.sqrt(b*w*(g-w)/g)*(x-g/2<0?-1:1);Z0(r,e,t,Math.max(n,Math.floor(t-x*w/g+S)),Math.min(s,Math.floor(t+(g-x)*w/g+S)),c)}const h=e[2*t+c];let f=n,p=s;for(lf(r,e,n,t),e[2*s+c]>h&&lf(r,e,n,s);f<p;){for(lf(r,e,f,p),f++,p--;e[2*f+c]<h;)f++;for(;e[2*p+c]>h;)p--}e[2*n+c]===h?lf(r,e,n,p):(p++,lf(r,e,p,s)),p<=t&&(n=p+1),t<=p&&(s=p-1)}}function lf(r,e,t,n){Ug(r,t,n),Ug(e,2*t,2*n),Ug(e,2*t+1,2*n+1)}function Ug(r,e,t){const n=r[e];r[e]=r[t],r[t]=n}function W0(r,e,t,n){const s=r-t,c=e-n;return s*s+c*c}a.$=ga,a.A=class{constructor(r,e,t){this.target=r,this.parent=e,this.mapId=t,this.callbacks={},this.cancelCallbacks={},ge(["receive"],this),this.target.addEventListener("message",this.receive,!1),this.scheduler=new sT}send(r,e,t,n,s=!1,c){const h=Math.round(1e18*Math.random()).toString(36).substring(0,10);t&&(t.metadata=c,this.callbacks[h]=t);const f=new Set;return this.target.postMessage({id:h,type:r,hasCallback:!!t,targetMapId:n,mustQueue:s,sourceMapId:this.mapId,data:Jo(e,f)},f),{cancel:()=>{t&&delete this.callbacks[h],this.target.postMessage({id:h,type:"<cancel>",targetMapId:n,sourceMapId:this.mapId})}}}receive(r){const e=r.data;if(!e)return;const t=e.id;if(t&&(!e.targetMapId||this.mapId===e.targetMapId))if(e.type==="<cancel>"){const n=this.cancelCallbacks[t];delete this.cancelCallbacks[t],n&&n.cancel()}else if(e.mustQueue||Si(self)){const n=this.callbacks[t],s=this.scheduler.add(()=>this.processTask(t,e),n&&n.metadata||{type:"message"});s&&(this.cancelCallbacks[t]=s)}else this.processTask(t,e)}processTask(r,e){if(delete this.cancelCallbacks[r],e.type==="<response>"){const t=this.callbacks[r];delete this.callbacks[r],t&&(e.error?t(es(e.error)):t(null,es(e.data)))}else{const t=new Set,n=e.hasCallback?(c,h)=>{this.target.postMessage({id:r,type:"<response>",sourceMapId:this.mapId,error:c?Jo(c):null,data:Jo(h,t)},t)}:()=>{},s=es(e.data);if(this.parent[e.type])this.parent[e.type](e.sourceMapId,s,n);else if(this.parent.getWorkerSource){const c=e.type.split("."),{source:h,scope:f}=s;this.parent.getWorkerSource(e.sourceMapId,{type:c[0],source:h,scope:f,uid:0})[c[1]](s,n)}else n(new Error(`Could not find function ${e.type}`))}}remove(){this.scheduler.remove(),this.target.removeEventListener("message",this.receive,!1)}},a.B=rn,a.C=Hn,a.D=Dn,a.E=na,a.F=Os,a.G=2,a.H=$d,a.I=nn,a.J=dv,a.K=sh,a.L=ip,a.M=ua,a.N=Es,a.O=zh,a.P=Fe,a.Q=Jc,a.R=rl,a.S=Rh,a.T=hs,a.U=El,a.V=um,a.W=hu,a.X=Co,a.Y=qf,a.Z=oo,a._=Ps,a.a=function(r){return Nt.API_CDN_URL_REGEX.test(r)},a.a$=ym,a.a0=lr,a.a1=yf,a.a2=Mc,a.a3=oh,a.a4=Jh,a.a5=class extends um{},a.a6=eu,a.a7=Dh,a.a8=ue,a.a9=function(r){const e=r.value;return e?Mc(e)?Cg(e,!0)?[]:[new um(r.key,e,`invalid url "${e}"`)]:[new um(r.key,e,`string expected, "${ua(e)}" found`)]:[]},a.aA=Nx,a.aB=function(r){let e=1/0,t=1/0,n=-1/0,s=-1/0;for(const c of r)e=Math.min(e,c.x),t=Math.min(t,c.y),n=Math.max(n,c.x),s=Math.max(s,c.y);return{min:new Fe(e,t),max:new Fe(n,s)}},a.aC=k,a.aD=Ti,a.aE=br,a.aF=H,a.aG=Xr,a.aH=Me,a.aI=Ke,a.aJ=function(r,e){const t={};for(let n=0;n<e.length;n++){const s=e[n];s in r&&(t[s]=r[s])}return t},a.aK=be,a.aL=Le,a.aM=function(r){try{const e=new URL(r).pathname.split("/").pop()||"",t=e.lastIndexOf(".");return t>=0?e.slice(t+1):""}catch{return""}},a.aN=class{constructor(r){this.entries={},this.scheduler=r}request(r,e,t,n){const s=this.entries[r]=this.entries[r]||{callbacks:[]};if(s.result){const[c,h]=s.result;return this.scheduler?this.scheduler.add(()=>{n(c,h)},e):n(c,h),()=>{}}return s.callbacks.push(n),s.cancel||(s.cancel=t((c,h)=>{s.result=[c,h];for(const f of s.callbacks)this.scheduler?this.scheduler.add(()=>{f(c,h)},e):f(c,h);setTimeout(()=>delete this.entries[r],3e3)})),()=>{s.result||(s.callbacks=s.callbacks.filter(c=>c!==n),s.callbacks.length||(s.cancel(),delete this.entries[r]))}}},a.aO=function(r,e,t){const n=JSON.stringify(r.request);return r.data&&(this.deduped.entries[n]={result:[null,r.data]}),this.deduped.request(n,{type:"parseTile",renderSourceType:r.render
7SourceType,zoom:r.tileZoom},s=>{const c=nl(r.request,(h,f,p)=>{h?$t(h)?s(null,null):s(h):f&&s(null,{rawData:f,vectorTile:t?void 0:new Gt(new Zp(f)),responseHeaders:new Map(p.entries())})});return()=>{c.cancel(),s(null,null)}},e)},a.aP=function(r){return r?{cacheControl:r.get("cache-control"),expires:r.get("expires")}:{cacheControl:void 0,expires:void 0}},a.aQ=function(r){xc++,xc>Qu&&(r.getActor().send("enforceCacheSizeLimit",gc),xc=0)},a.aR=function(r){return r<=1?1:Math.pow(2,Math.floor(Math.log2(r)))},a.aS=Nr,a.aT=Zv,a.aU=t0,a.aV=se,a.aW=Hv,a.aX=function(r,e){const t=document.createElement("video");t.muted=!0,t.onloadstart=function(){e(null,t)};for(let n=0;n<r.length;n++){const s=document.createElement("source");Mm(r[n])||(t.crossOrigin="Anonymous"),s.src=r[n],t.appendChild(s)}return{cancel:()=>{}}},a.aY=Nd,a.aZ=rc,a.a_=ge,a.aa=Ra,a.ab=Ci,a.ac=ke,a.ad=class{constructor(r){this.specification=r}possiblyEvaluate(r,e){return Ot(r.expression.evaluate(e))}interpolate(r,e,t){return{x:dt(r.x,e.x,t),y:dt(r.y,e.y,t),z:dt(r.z,e.z,t),azimuthal:dt(r.azimuthal,e.azimuthal,t),polar:dt(r.polar,e.polar,t)}}},a.ae=Zt,a.af=Ea,a.ag=tt,a.ah=Vi,a.ai=Jr,a.aj=W,a.ak=rs,a.al=Gs,a.am=dt,a.an=Ze,a.ao=_f,a.ap=Vt,a.aq=jt,a.ar=class{constructor(r){this.specification=r}possiblyEvaluate(r,e){return function([t,n]){const s=Ot([1,t,n]);return{x:s.x,y:s.y,z:s.z}}(r.expression.evaluate(e))}interpolate(r,e,t){return{x:dt(r.x,e.x,t),y:dt(r.y,e.y,t),z:dt(r.z,e.z,t)}}},a.as=function(r,e,t=0,n=!0){const s=new Fe(t,t),c=r.sub(s),h=e.add(s),f=[c,new Fe(h.x,c.y),h,new Fe(c.x,h.y)];return n&&f.push(c.clone()),f},a.at=function(r,e){const t=[];for(let n=0;n<r.length;n++){const s=oe(n-1,-1,r.length-1),c=oe(n+1,-1,r.length-1),h=r[n],f=r[c],p=r[s].sub(h).unit(),g=f.sub(h).unit(),x=g.angleWithSep(p.x,p.y),b=p.add(g).unit().mult(-1*e/Math.sin(x/2));t.push(h.add(b))}return t},a.au=Dv,a.av=os,a.aw=function(r,e,t=0){return Bi(((e.x-t)*r.scale-r.x)*Ze,(e.y*r.scale-r.y)*Ze,we(e.z,e.y))},a.ax=Xi,a.ay=xi,a.az=Rt,a.b=function(r){return Nt.API_FONTS_REGEX.test(r)},a.b$=kn,a.b0=Zp,a.b1=class{constructor(r,e,t,n,s,c){this.tileID=r,this.uid=me(),this.uses=0,this.tileSize=e,this.tileZoom=t,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.isRaster=s,n&&n.style&&(this._lastUpdatedBrightness=n.style.getBrightness()),this._lastAvailableImagesCount=0,this._firstPrepareComplete=!1,this.expiredRequestCount=0,this.state="loading",n&&n.transform&&(this.projection=n.transform.projection),this.worldview=c,this._hasAppearances=null}registerFadeDuration(r){const e=r+this.timeAdded;e<fn.now()||this.fadeEndTime!==void 0&&e<this.fadeEndTime||(this.fadeEndTime=e)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}get tileTransform(){return this._tileTransform||(this._tileTransform=ec(this.tileID.canonical,this.projection)),this._tileTransform}loadVectorData(r,e,t){if(this.unloadVectorData(),this.state="loaded",r){r.featureIndex&&(this.latestFeatureIndex=r.featureIndex,r.rawTileData?(this.latestRawTileData=r.rawTileData,this.latestFeatureIndex.rawTileData=r.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=r.collisionBoxArray,this.buckets=h0(r.buckets,e.style),this.hasSymbolBuckets=!1;for(const n in this.buckets){const s=this.buckets[n];if(s instanceof Oo){if(this.hasSymbolBuckets=!0,!t)break;s.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const n in this.buckets){const s=this.buckets[n];if(s instanceof Oo&&s.hasRTLText){this.hasRTLText=!0,Yh();break}}this.queryPadding=0;for(const n in this.buckets){const s=this.buckets[n],c=e.style.getOwnLayer(n);if(!c)continue;const h=c.queryRadius(s);this.queryPadding=Math.max(this.queryPadding,h)}r.imageAtlas&&(this.imageAtlas=e.style.imageManager.imageAtlasCache.getOrCache(r.imageAtlas)),r.glyphAtlasImage&&(this.glyphAtlasImage=r.glyphAtlasImage),r.lineAtlas&&(this.lineAtlas=r.lineAtlas),this._lastUpdatedBrightness=r.brightness}else this.collisionBoxArray=new gd}unloadVectorData(){if(this.hasData()){for(const r in this.buckets)this.buckets[r].destroy();this.buckets={},this.imageAtlas&&(this.imageAtlas=null),this.lineAtlas&&(this.lineAtlas=null),this.imageAtlasTexture&&(this.imageAtlasTexture=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.lineAtlasTexture&&this.lineAtlasTexture.destroy(),this._tileBoundsBuffer&&(this._tileBoundsBuffer.destroy(),this._tileBoundsIndexBuffer.destroy(),this._tileBoundsSegments.destroy(),this._tileBoundsBuffer=null),this._tileDebugBuffer&&(this._tileDebugBuffer.destroy(),this._tileDebugSegments.destroy(),this._tileDebugBuffer=null),this._tileDebugIndexBuffer&&(this._tileDebugIndexBuffer.destroy(),this._tileDebugIndexBuffer=null),this._globeTileDebugBorderBuffer&&(this._globeTileDebugBorderBuffer.destroy(),this._globeTileDebugBorderBuffer=null),this._tileDebugTextBuffer&&(this._tileDebugTextBuffer.destroy(),this._tileDebugTextSegments.destroy(),this._tileDebugTextIndexBuffer.destroy(),this._tileDebugTextBuffer=null),this._globeTileDebugTextBuffer&&(this._globeTileDebugTextBuffer.destroy(),this._globeTileDebugTextBuffer=null),this.latestFeatureIndex=null,this.state="unloaded"}}loadModelData(r,e,t){r&&(r.resourceTiming&&(this.resourceTiming=r.resourceTiming),this.buckets=Object.assign({},this.buckets,h0(r.buckets,e.style)),r.featureIndex&&(this.latestFeatureIndex=r.featureIndex))}getBucket(r){return this.buckets[r.fqid]}upload(r,e){for(const s in this.buckets){const c=this.buckets[s];if(c.uploadPending()){let h={},f=[],p={zoom:0,pitch:0,brightness:0,worldview:""};if(e){if(e.style){f=e.style.listImages();const g=c.layers[0],x=g.sourceLayer||"_geojsonTileLayer",b=e.style.getLayerSourceCache(g);b&&(h=b._state.getState(x,void 0))}p={zoom:e.transform.zoom||0,pitch:e.transform.pitch||0,brightness:e.style.getBrightness()||0,worldview:e.worldview||""}}c.upload(r,this.tileID.canonical,h,f,p)}}const t=r.gl,n=this.imageAtlas;!n||this.imageAtlasTexture&&n.uploaded||(this.imageAtlasTexture=null,this.imageAtlasTexture=e.style.imageManager.imageAtlasCache.getTextureForAtlas(n,r,t.RGBA8),n.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new hs(r,this.glyphAtlasImage,t.R8),this.glyphAtlasImage=null),this.lineAtlas&&!this.lineAtlas.uploaded&&(this.lineAtlasTexture=new hs(r,this.lineAtlas.image,t.R8),this.lineAtlas.uploaded=!0)}prepare(r,e,t){if(this.imageAtlas&&this.imageAtlasTexture&&e){const b=e.style.getLut(t);this.imageAtlas.patchUpdatedImages(r,this.imageAtlasTexture,t,b)}if(!e||!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData)return;const n=e.style.getBrightness(),s=e.style.listImages(),c=s.length,h=e.style._changes.getUpd
vendor: 1,978 bytes, line 7
7atedPaintProperties(),f=Object.keys(this.buckets).some(b=>this.buckets[b].layers.some(w=>h.has(w.fqid))),p=Object.keys(this.buckets).some(b=>this.buckets[b].layers.some(w=>w.hasTransition&&w.hasTransition())),g=this._firstPrepareComplete&&c!==this._lastAvailableImagesCount;this._hasAppearances===null&&(this._hasAppearances=this.hasAppearances(e));const x=this._lastUpdatedBrightness!==n;this._lastAvailableImagesCount=c,this._firstPrepareComplete=!0,(this._lastUpdatedBrightness||n||this._hasAppearances||f||p||g)&&(!(this._hasAppearances||f||p||g)&&this._lastUpdatedBrightness&&n&&Math.abs(this._lastUpdatedBrightness-n)<.001||(this.updateBuckets(e,x,void 0,g||f||p,h,s),this._lastUpdatedBrightness=n))}evaluateQueryRenderedFeaturePadding(){let r=0;for(const e in this.buckets){const t=this.buckets[e];t.evaluateQueryRenderedFeaturePadding&&(r=Math.max(r,t.evaluateQueryRenderedFeaturePadding()))}return r}queryRenderedFeatures(r,e,t,n,s,c,h){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData&&!this.latestFeatureIndex.is3DTile)return{};const f=this.evaluateQueryRenderedFeaturePadding(),p=function(g,x){const b=Un([],[.5*g.width,.5*-g.height,1]);return Qr(b,b,[1,-1,0]),Ti(b,b,g.calculateProjMatrix(x.toUnwrapped())),Float32Array.from(b)}(s,this.tileID);return this.latestFeatureIndex.query(r,{tilespaceGeometry:e,pixelPosMatrix:p,transform:n,availableImages:t,tileTransform:this.tileTransform,worldview:this.worldview,queryRadius:f,scope:h})}querySourceFeatures(r,e){const t=this.latestFeatureIndex;if(!t||!t.rawTileData)return;const n=t.loadVTLayers(),s=e?e.sourceLayer:"",c=n._geojsonTileLayer||n[s];if(!c)return;const h=du(e&&e.filter),{z:f,x:p,y:g}=this.tileID.canonical,x={z:f,x:p,y:g};for(let b=0;b<c.length;b++){const w=c.feature(b);if(h.needGeometry){const A=Ct(w,!0);if(!h.filter(new Zt(this.tileID.overscaledZ,{worldview:this.worldview}),A,this.tileID.canonical))continue}else if(!h.filter(new Zt(this.tileID.overscaledZ,{worldview:this.worldview}
7),w))continue;const S=t.getId(w,s),E=new ic(w,f,p,g,S);E.tile=x,r.push(E)}}loaded(){return this.state==="loaded"||this.state==="errored"}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return!!this.imageAtlas&&!!this.imageAtlas.patternPositions.size}setExpiryData(r){const e=this.expirationTime;if(r.cacheControl){const t=Yi(r.cacheControl);t["max-age"]&&(this.expirationTime=Date.now()+1e3*t["max-age"])}else r.expires&&(this.expirationTime=new Date(r.expires).getTime());if(this.expirationTime){const t=Date.now();let n=!1;if(this.expirationTime>t)n=!1;else if(e)if(this.expirationTime<e)n=!0;else{const s=this.expirationTime-e;s?this.expirationTime=t+Math.max(s,3e4):n=!0}else n=!0;n?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-new Date().getTime(),Math.pow(2,31)-1)}refreshFeatureState(r,e){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData&&!this.latestFeatureIndex.is3DTile||!r)return;const t=r.style.listImages();this.updateBuckets(r,!1,e,void 0,void 0,t)}hasAppearances(r){for(const e in this.buckets)if(r.style.hasLayer(e)&&this.buckets[e].layers.some(t=>t.appearances&&t.appearances.length>0))return!0;return!1}updateBuckets(r,e,t,n,s,c){if(!this.latestFeatureIndex||!r.style)return;const h=c||r.style.listImages(),f=r.style.getBrightness(),p=s||new Set;for(const g in this.buckets){if(!r.style.hasLayer(g))continue;const x=this.buckets[g],b=x.layers[0],w=b.sourceLayer||"_geojsonTileLayer",S=r.style.getLayerSourceCache(b),E=x.layers.some(G=>p.has(G.fqid)),A=(n||E)&&x instanceof Oo?r.style.getOwnLayer(g):void 0;let P=t&&t[w]||{};S&&!t&&(P=S._state.getState(w,void 0));const R=this.imageAtlas?Object.fromEntries(this.imageAtlas.patternPositions):{},B=Object.keys(P).length>0&&!e;x.hasAppearances=x.layers.some(G=>G.appearances&&G.appearances.length>0);const L=B?x.stateDependentLayers:x.layers;if(B&&x.stateDependentLayers.length!==0||e||E||n){const G=this.latestFeatureIndex.loadVTLayers()[w];if(x.update(P,G,h,R,L,e,f,this.tileID.canonical),(n||E)&&!e&&x instanceof Oo&&A&&A.type==="symbol"){const q=x;q.text&&q.text.uboBinder&&q.text.uboBinder.updateDynamicExpressions(A,G,this.tileID.canonical,h,P,f),q.icon&&q.icon.uboBinder&&q.icon.uboBinder.updateDynamicExpressions(A,G,this.tileID.canonical,h,P,f)}if(x instanceof Oo){const q=x,ie=r.context;q.text&&q.text.uboBinder&&q.text.uboBinder.upload(ie),q.icon&&q.icon.uboBinder&&q.icon.uboBinder.upload(ie)}}if(B&&x.stateDependentLayers.length!==0||e||x.hasAppearances){const G={zoom:r.transform.zoom,pitch:r.transform.pitch,brightness:r.style.getBrightness()||0,worldview:r.worldview},q=x.updateAppearances(this.tileID.canonical,P,h,G,r.imageManager,B&&x.stateDependentLayers.length!==0);if(q&&q.hasUboChanges){const ie=r.context;x instanceof Oo&&x.text&&x.text.uboBinder&&x.text.uboBinder.upload(ie),x instanceof Oo&&x.icon&&x.icon.uboBinder&&x.icon.uboBinder.upload(ie)}}(x instanceof Hp||x instanceof Ap)&&r._terrain&&r._terrain.enabled&&S&&x.uploadPending()&&r._terrain._clearRenderCacheForTile(S.id,this.tileID);const U=r&&r.style&&r.style.getOwnLayer(g);U&&(this.queryPadding=Math.max(this.queryPadding,U.queryRadius(x)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<fn.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(r){this.symbolFadeHoldUntil=fn.now()+r}setTexture(r,e){const t=e.context,n=t.gl;this.texture=this.texture||e.getTileTexture(r.width),this.texture&&this.texture instanceof hs?this.texture.update(r):(this.texture=new hs(t,r,n.RGBA8,{useMipmap:!0}),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE))}setDependencies(r,e){const t={};for(const n of e)t[n]=!0;this.dependencies[r]=t}hasDependency(r,e){for(const t of r){const n=this.dependencies[t];if(n){for(const s of e)if(n[s])return!0}}return!1}clearQueryDebugViz(){}_makeDebugTileBoundsBuffers(r,e){if(!e||e.name==="mercator"||this._tileDebugBuffer)return;const t=ft(p0,this.tileID.canonical,this.tileTransform)[0],n=new sn,s=new Vs;for(let c=0;c<t.length;c++){const{x:h,y:f}=t[c];n.emplaceBack(h,f),s.emplaceBack(c)}s.emplaceBack(0),this._tileDebugIndexBuffer=r.createIndexBuffer(s),this._tileDebugBuffer=r.createVertexBuffer(n,wd.members),this._tileDebugSegments=oi.simpleSegment(0,0,n.length,s.length)}_makeTileBoundsBuffers(r,e){if(this._tileBoundsBuffer||!e||e.name==="mercator")return;const t=ft(p0,this.tileID.canonical,this.tileTransform)[0];let n,s;if(this.isRaster){const c=function(h,f){const p=ec(h,f),g=Math.pow(2,h.z);for(let A=0;A<ds;A++)for(let P=0;P<ds;P++){const R=le((h.x+(P+d0(P))/fo)/g),B=xe((h.y+(A+d0(A))/fo)/g),L=f.project(R,B),U=A*ds+P;fs[2*U+0]=Math.round((L.x*p.scale-p.x)*Ze),fs[2*U+1]=Math.round((L.y*p.scale-p.y)*Ze)}qa.fill(0),dm.fill(0);for(let A=2045;A>=0;A--){const P=4*A,R=Ga[P+0],B=Ga[P+1],L=Ga[P+2],U=Ga[P+3],G=R+L>>1,q=B+U>>1,ie=G+q-B,X=q+R-G,ee=B*ds+R,Q=U*ds+L,J=q*ds+G,ve=Math.hypot((fs[2*ee+0]+fs[2*Q+0])/2-fs[2*J+0
vendor: 7,227 bytes, line 7
7],(fs[2*ee+1]+fs[2*Q+1])/2-fs[2*J+1])>=16;qa[J]=qa[J]||(ve?1:0),A<1022&&(qa[J]=qa[J]||qa[(B+X>>1)*ds+(R+ie>>1)]||qa[(U+X>>1)*ds+(L+ie>>1)])}const x=new Ir,b=new Ni;let w=0;function S(A,P){const R=P*ds+A;return dm[R]===0&&(x.emplaceBack(fs[2*R+0],fs[2*R+1],A*Ze/fo,P*Ze/fo),dm[R]=++w),dm[R]-1}function E(A,P,R,B,L,U){const G=A+R>>1,q=P+B>>1;if(Math.abs(A-L)+Math.abs(P-U)>1&&qa[q*ds+G])E(L,U,A,P,G,q),E(R,B,L,U,G,q);else{const ie=S(A,P),X=S(R,B),ee=S(L,U);b.emplaceBack(ie,X,ee)}}return E(0,0,fo,fo,fo,0),E(fo,fo,0,0,0,fo),{vertices:x,indices:b}}(this.tileID.canonical,e);n=c.vertices,s=c.indices}else{n=new Ir,s=new Ni;for(const{x:h,y:f}of t)n.emplaceBack(h,f,0,0);const c=Au(n.int16.subarray(0,4*n.length),void 0,4);for(let h=0;h<c.length;h+=3)s.emplaceBack(c[h],c[h+1],c[h+2])}this._tileBoundsBuffer=r.createVertexBuffer(n,am.members),this._tileBoundsIndexBuffer=r.createIndexBuffer(s),this._tileBoundsSegments=oi.simpleSegment(0,0,n.length,s.length)}_makeGlobeTileDebugBuffers(r,e){const t=e.projection;if(!t||t.name!=="globe"||e.freezeTileCoverage)return;const n=this.tileID.canonical,s=Sd(Qg(n,e)),c=Gs(e.zoom);let h;c>0&&(h=An(new Float64Array(16),e.globeMatrix)),this._makeGlobeTileDebugBorderBuffer(r,n,e,s,h,c),this._makeGlobeTileDebugTextBuffer(r,n,e,s,h,c)}_globePoint(r,e,t,n,s,c,h){let f=Td(r,e,t);if(c){const p=1<<t.z,g=Me(n.center.lng),x=Le(n.center.lat),b=(t.x+.5)/p-g;let w=0;b>.5?w=-1:b<-.5&&(w=1);let S=(r/Ze+t.x)/p+w,E=(e/Ze+t.y)/p;S=(S-g)*n._pixelsPerMercatorPixel+g,E=(E-x)*n._pixelsPerMercatorPixel+x;const A=[S*n.worldSize,E*n.worldSize,0];Vi(A,A,c),f=js(f,A,h)}return Vi(f,f,s)}_makeGlobeTileDebugBorderBuffer(r,e,t,n,s,c){const h=new sn,f=new Vs,p=new co,g=(b,w,S,E,A)=>{const P=(S-b)/(A-1),R=(E-w)/(A-1),B=h.length;for(let L=0;L<A;L++){const U=b+L*P,G=w+L*R;h.emplaceBack(U,G);const q=this._globePoint(U,G,e,t,n,s,c);p.emplaceBack(q[0],q[1],q[2]),f.emplaceBack(B+L)}},x=Ze;g(0,0,x,0,16),g(x,0,x,x,16),g(x,x,0,x,16),g(0,x,0,0,16),this._tileDebugIndexBuffer=r.createIndexBuffer(f),this._tileDebugBuffer=r.createVertexBuffer(h,wd.members),this._globeTileDebugBorderBuffer=r.createVertexBuffer(p,Yg.members),this._tileDebugSegments=oi.simpleSegment(0,0,h.length,f.length)}_makeGlobeTileDebugTextBuffer(r,e,t,n,s,c){const h=new sn,f=new Ni,p=new co,g=25;f.reserve(32),h.reserve(g),p.reserve(g);const x=(b,w)=>g*b+w;for(let b=0;b<g;b++){const w=2048*b;for(let S=0;S<g;S++){const E=2048*S;h.emplaceBack(E,w);const A=this._globePoint(E,w,e,t,n,s,c);p.emplaceBack(A[0],A[1],A[2])}}for(let b=0;b<4;b++)for(let w=0;w<4;w++){const S=x(b,w),E=x(b,w+1),A=x(b+1,w),P=x(b+1,w+1);f.emplaceBack(S,E,A),f.emplaceBack(A,E,P)}this._tileDebugTextIndexBuffer=r.createIndexBuffer(f),this._tileDebugTextBuffer=r.createVertexBuffer(h,wd.members),this._globeTileDebugTextBuffer=r.createVertexBuffer(p,Yg.members),this._tileDebugTextSegments=oi.simpleSegment(0,0,g,32)}destroy(r=!0){for(const e in this.buckets)this.buckets[e].destroy(r);this.buckets={},this.imageAtlas&&(this.imageAtlas=null),this.lineAtlas&&(this.lineAtlas=null),this.imageAtlasTexture&&delete this.imageAtlasTexture,this.glyphAtlasTexture&&(this.glyphAtlasTexture.destroy(),delete this.glyphAtlasTexture),this.lineAtlasTexture&&(this.lineAtlasTexture.destroy(),delete this.lineAtlasTexture),this._tileBoundsBuffer&&(this._tileBoundsBuffer.destroy(),this._tileBoundsIndexBuffer.destroy(),this._tileBoundsSegments.destroy(),this._tileBoundsBuffer=null),this._tileDebugBuffer&&(this._tileDebugBuffer.destroy(),this._tileDebugSegments.destroy(),this._tileDebugBuffer=null),this._tileDebugIndexBuffer&&(this._tileDebugIndexBuffer.destroy(),this._tileDebugIndexBuffer=null),this._globeTileDebugBorderBuffer&&(this._globeTileDebugBorderBuffer.destroy(),this._globeTileDebugBorderBuffer=null),this._tileDebugTextBuffer&&(this._tileDebugTextBuffer.destroy(),this._tileDebugTextSegments.destroy(),this._tileDebugTextIndexBuffer.destroy(),this._tileDebugTextBuffer=null),this._globeTileDebugTextBuffer&&(this._globeTileDebugTextBuffer.destroy(),this._globeTileDebugTextBuffer=null),r&&this.texture&&this.texture instanceof hs&&(this.texture.destroy(),delete this.texture),this.emissiveTexture&&this.emissiveTexture instanceof hs&&(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"}},a.b2=nl,a.b3=$t,a.b4=function(r,e){const t=[];for(const n in r)n in e||t.push(n);return t},a.b5=f0,a.b6=["type","source","source-layer","minzoom","maxzoom","filter","layout"],a.b7=di,a.b8=An,a.b9=Jt,a.bA=ky,a.bB=Dp,a.bC=jy,a.bD=Gy,a.bE=Ct,a.bF=ys,a.bG=ag,a.bH=wv,a.bI=yg,a.bJ=Vg,a.bK=yi,a.bL=Rr,a.bM=jo,a.bN=function(r,e,t){t*=.5;var n=e[0],s=e[1],c=e[2],h=e[3],f=Math.sin(t),p=Math.cos(t);return r[0]=n*p+s*f,r[1]=s*p-n*f,r[2]=c*p+h*f,r[3]=h*p-c*f,r},a.bO=Ya,a.bP=fi,a.bQ=Un,a.bR=function(r,e){return r[0]=-e[0],r[1]=-e[1],r[2]=-e[2],r[3]=e[3],r},a.bS=Za,a.bT=function(r,e,t,n,s){var c=1/Math.tan(e/2);if(r[0]=c/t,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,s!=null&&s!==1/0){var h=1/(n-s);r[10]=(s+n)*h,r[14]=2*s*n*h}else r[10]=-1,r[14]=-2*n;return r},a.bU=function(r,e,t,n,s,c,h){var f=1/(e-t),p=1/(n-s),g=1/(c-h);return r[0]=-2*f,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=-2*p,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=2*g,r[11]=0,r[12]=(e+t)*f,r[13]=(s+n)*p,r[14]=(h+c)*g,r[15]=1,r},a.bV=fe,a.bW=xe,a.bX=function(r,e,t){r[4*e+0]=t[0],r[4*e+1]=t[1],r[4*e+2]=t[2],r[4*e+3]=t[3]},a.bY=ql,a.bZ=$l,a.b_=ir,a.ba=Ei,a.bb=vo,a.bc=ps,a.bd=function(r,e){const{x:t,y:n}=r.point,s=ry(t,n,r.worldSize/r._pixelsPerMercatorPixel,0,0);return Ti(s,s,m_(ls(e)))},a.be=Vn,a.bf=To,a.bg=cc,a.bh=un,a.bi=dr,a.bj=ki,a.bk=Fu,a.bl=Tn,a.bm=ug,a.bn=function(r,e,t,n,s){const c=5*e+2;r.float32[c+0]=t,r.float32[c+1]=n,r.float32[c+2]=s},a.bo=ku,a.bp=So,a.bq=bs,a.br=en,a.bs=fc,a.bt=oe,a.bu=function(r,e,t,n){var s=new Oi(4);return s[0]=r,s[1]=e,s[2]=t,s[3]=n,s},a.bv=class{isDataAvailableAtPoint(r){const e=this._source();if(this.isUsingMockSource()||!e||r.y<0||r.y>1)return!1;const t=e.getSource().maxzoom,n=1<<t,s=Math.floor(r.x),c=Math.floor((r.x-s)*n),h=Math.floor(r.y*n),f=this.findDEMTileFor(new Nr(t,s,t,c,h));return!(!f||!f.dem)}getAtPointOrZero(r,e=0){return this.getAtPoint(r,e)||0}getAtPoint(r,e,t=!0){if(this.isUsingMockSource())return null;e==null&&(e=null);const n=this._source();if(!n||r.y<0||r.y>1)return e;const s=n.getSource().maxzoom,c=1<<s,h=Math.floor(r.x),f=r.x-h,p=new Nr(s,h,s,Math.floor(f*c),Math.floor(r.y*c)),g=this.findDEMTileFor(p);if(!g||!g.dem)return e;const x=g.dem,b=1<<g.tileID.canonical.z,w=(f*b-g.tileID.canonical.x)*x.dim,S=(r.y*b-g.tileID.canonical.y)*x.dim,E=Math.floor(w),A=Math.floor(S);return(t?this.exaggeration():1)*dt(dt(x.get(E,A),x.get(E,A+1),S-A),dt(x.get(E+1,A),x.get(E+1,A+1),S-A),w-E)}static getAtTileOffset(r,e,t,n){const s=1<<r.canonical.z;return n?n.pointElevation(e):t?t.getAtPointOrZero(new tt(r.wrap+(r.canonical.x+e.x/Ze)/s,(r.canonical.y+e.
7y/Ze)/s)):0}static getAtTileOffsetFunc(r,e,t,n){return(s,c,h)=>{const f=this.getAtTileOffset(r,s,c,h),p=n.upVector(r.canonical,s.x,s.y);return yi(p,p,f*n.upVectorScale(r.canonical,e,t).metersToTile),p}}getForTilePoints(r,e,t,n){if(this.isUsingMockSource())return!1;const s=Nu.create(this,r,n);return!!s&&(e.forEach(c=>{c[2]=this.exaggeration()*s.getElevationAt(c[0],c[1],t)}),!0)}getMinMaxForTile(r){if(this.isUsingMockSource())return null;const e=this.findDEMTileFor(r);if(!e||!e.dem)return null;const t=e.dem.tree,n=e.tileID,s=1<<r.canonical.z-n.canonical.z;let c=r.canonical.x/s-n.canonical.x,h=r.canonical.y/s-n.canonical.y,f=0;for(let p=0;p<r.canonical.z-n.canonical.z&&!t.leaves[f];p++){c*=2,h*=2;const g=2*Math.floor(h)+Math.floor(c);f=t.childOffsets[f]+g,c%=1,h%=1}return{min:this.exaggeration()*t.minimums[f],max:this.exaggeration()*t.maximums[f]}}getMinElevationBelowMSL(){throw new Error("Pure virtual method called.")}raycast(r,e,t){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,t=Number.MAX_VALUE,n=Number.MIN_VALUE;for(const s of r){const c=this.getMinMaxForTile(s.tileID);c&&(t=Math.min(t,c.min),n=Math.max(n,c.max),e=!0)}return e?{min:t,max:n}:null}},a.bw=Op,a.bx=qi,a.by=Qr,a.bz=cr,a.c=$n,a.c$=mg,a.c0=i,a.c1=Ov,a.c2=function(){var r=new Oi(4);return Oi!=Float32Array&&(r[1]=0,r[2]=0),r[0]=1,r[3]=1,r},a.c3=function(r,e,t){var n=e[0],s=e[1],c=e[2],h=e[3],f=Math.sin(t),p=Math.cos(t);return r[0]=n*p+c*f,r[1]=s*p+h*f,r[2]=n*-f+c*p,r[3]=s*-f+h*p,r},a.c4=function(r,e){return r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]&&r[3]===e[3]},a.c5=eo,a.c6=function(r){var e=r[0],t=r[1],n=r[2],s=r[3];return Math.sqrt(e*e+t*t+n*n+s*s)},a.c7=dn,a.c8=gs,a.c9=Xg,a.cA=function(r){const{x:e,y:t}=r.point,{lng:n,lat:s}=r._center;return ry(e,t,r.worldSize,n,s)},a.cB=wo,a.cC=Zi,a.cD=Eu,a.cE=ss,a.cF=5,a.cG=function(r,e,t){let n=0;for(let s=0;s<2;++s)r[s]>0&&(n+=(r[s]-0)*(r[s]-0)),e[s]<0&&(n+=(0-e[s])*(0-e[s]));return n},a.cH=function(r){return r*r*r*r*r},a.cI=_e,a.cJ=45,a.cK=Su,a.cL=function(r,e,t){const n=Math.sqrt(r*r+e*e+t*t),s=n>0?Math.acos(t/n)*Ja:0;let c=r!==0||e!==0?Math.atan2(-e,-r)*Ja+90:0;return c<0&&(c+=360),[n,c,s]},a.cM=Bi,a.cN=Ot,a.cO=De,a.cP=er,a.cQ=Xt,a.cR=jn,a.cS=function(r){return[Math.pow(r[0],1/2.2),Math.pow(r[1],1/2.2),Math.pow(r[2],1/2.2)]},a.cT=Tx,a.cU=Y_,a.cV=Cx,a.cW=Cg,a.cX=function(r,e){return r.readFields(aT,{icons:[]},e)},a.cY=zi,a.cZ=class{static calculate(r,e,t){const n=new Set,s=new Map,c=new Set,h=new Set;for(const p of Object.values(r))for(const[g,x]of Object.entries(p.floors)){c.add(g),x.isDefault&&h.add(g),x.conflicts&&s.set(g,x.conflicts);const b=g===e,w=x.connections&&e&&x.connections.has(e);(b||w)&&n.add(g)}const f=p=>{const g=s.get(p)||new Set;for(const x of n)if((s.get(x)||new Set).has(p)||g.has(x))return!0;return!1};if(t)for(const p of t)c.has(p)&&(f(p)||n.add(p));for(const p of h)n.has(p)||f(p)||n.add(p);return n}},a.c_=Ql,a.ca=3,a.cb=2,a.cc=7,a.cd=6,a.ce=ms,a.cf=ei,a.cg=an,a.ch=Ix,a.ci=Hl,a.cj=ey,a.ck=function(r,e,t,n,s,c,h,f,p){if(p.name==="globe")return ey(r,e,new Hl(t,n,s),!1);const g=ec({z:t,x:n,y:s},p);return new Xt([(c+g.x/g.scale)*e,e*(g.y/g.scale),h],[(c+g.x2/g.scale)*e,e*(g.y2/g.scale),f])},a.cl=function(r,e,t){return r[0]=Math.min(e[0],t[0]),r[1]=Math.min(e[1],t[1]),r[2]=Math.min(e[2],t[2]),r[3]=Math.min(e[3],t[3]),r},a.cm=function(r,e,t){return r[0]=Math.max(e[0],t[0]),r[1]=Math.max(e[1],t[1]),r[2]=Math.max(e[2],t[2]),r[3]=Math.max(e[3],t[3]),r},a.cn=function(r){const e=Math.round((r+45+360)%360/90)%4;return mc[e]},a.co=Se,a.cp=Ks,a.cq=6,a.cr=function(r){const e=Ei(new Float64Array(16));Ti(e,r.pixelMatrix,r.globeMatrix);const t=[0,Y,0],n=[0,re,0];return Vi(t,t,e),Vi(n,n,e),[t[0]>0&&t[0]<=r.width&&t[1]>0&&t[1]<=r.height&&!g_(r,new se(r.center.lat,90)),n[0]>0&&n[0]<=r.width&&n[1]>0&&n[1]<=r.height&&!g_(r,new se(r.center.lat,-90))]},a.cs=function(r,e){const{scale:t}=r.tileTransform,n=t*Ze/(r.tileSize*Math.pow(2,e.zoom-r.tileID.overscaledZ+r.tileID.canonical.z));return function(s,c,h){var f=c[1],p=c[2],g=c[3],x=h[0],b=h[1];
7return s[0]=c[0]*x,s[1]=f*x,s[2]=p*b,s[3]=g*b,s}(new Float32Array(4),e.inverseAdjustmentMatrix,[n,n])},a.ct=Np,a.cu=Wa,a.cv=Sx,a.cw=function(r){const e=Sx(r,!0);return Vn([],[e[0],e[1],e[4],e[5]])},a.cx=Mr,a.cy=ni,a.cz=xo,a.d=function(r){return Nt.API_TILEJSON_REGEX.test(r)},a.d$=$s,a.d0=bc,a.d1=function(){return{API_URL:Nt.API_URL,DRACO_URL:Nt.DRACO_URL,MESHOPT_URL:Nt.MESHOPT_URL,MESHOPT_SIMD_URL:Nt.MESHOPT_SIMD_URL,BUILDING_GEN_URL:Nt.BUILDING_GEN_URL}},a.d2=Jf,a.d3=Ho,a.d4=ra,a.d5=Xe,a.d6=function(r){const e=r.indexOf(zl);return e>=0?r.slice(0,e):r},a.d7=function(r){return r.indexOf(zl)>=0},a.d8=function(r){const e=r.lastIndexOf(zl);return e>=0?r.slice(e+1):""},a.d9=function(r){const e=[],t=r.id;return t===void 0&&e.push({message:`layers.${t}: missing required property "id"`}),r.render===void 0&&e.push({message:`layers.${t}: missing required method "render"`}),r.renderingMode&&r.renderingMode!=="2d"&&r.renderingMode!=="3d"&&e.push({message:`layers.${t}: property "renderingMode" must be either "2d" or "3d"`}),e},a.dA=ac,a.dB=function(r,e){var t=Math.sin(e),n=Math.cos(e);return r[0]=n,r[1]=t,r[2]=0,r[3]=-t,r[4]=n,r[5]=0,r[6]=0,r[7]=0,r[8]=1,r},a.dC=_s,a.dD=iy,a.dE=pi,a.dF=_i,a.dG=Eg,a.dH=function(r,e){const t=[0,0,0];return Vi(t,t,Sd(ls(e.canonical))),Vi(t,t,r),t},a.dI=r=>({u_matrix:new i(r),u_texsize:new kn(r),u_pixels_to_tile_units:new d(r),u_device_pixel_ratio:new ir(r),u_width_scale:new ir(r),u_floor_width_scale:new ir(r),u_image:new ql(r),u_units_to_pixels:new kn(r),u_tile_units_to_pixels:new ir(r),u_alpha_discard_threshold:new ir(r),u_trim_offset:new kn(r),u_trim_fade_range:new kn(r),u_trim_gradient_mix_range:new kn(r),u_trim_color:new Su(r),u_zbias_factor:new ir(r),u_tile_to_meter:new ir(r),u_ground_shadow_factor:new $l(r),u_pattern_transition:new ir(r)}),a.dJ=r=>({u_matrix:new i(r),u_pixels_to_tile_units:new d(r),u_device_pixel_ratio:new ir(r),u_width_scale:new ir(r),u_floor_width_scale:new ir(r),u_units_to_pixels:new kn(r),u_dash_image:new ql(r),u_gradient_image:new ql(r),u_image_height:new ir(r),u_texsize:new kn(r),u_tile_units_to_pixels:new ir(r),u_alpha_discard_threshold:new ir(r),u_trim_offset:new kn(r),u_trim_fade_range:new kn(r),u_trim_gradient_mix_range:new kn(r),u_trim_color:new Su(r),u_zbias_factor:new ir(r),u_tile_to_meter:new ir(r),u_ground_shadow_factor:new $l(r)}),a.dK=r=>({u_camera_to_center_distance:new ir(r),u_extrude_scale:new d(r),u_device_pixel_ratio:new ir(r),u_matrix:new i(r),u_inv_rot_matrix:new i(r),u_merc_center:new kn(r),u_tile_id:new $l(r),u_zoom_transition:new ir(r),u_up_dir:new $l(r),u_emissive_strength:new ir(r)}),a.dL=hd,a.dM=ow,a.dN=class{constructor(r,e,t,n){this.context=r,this.format=n,this.size=t,this.texture=r.gl.createTexture();const[s,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,s,c,h,0,G_(this.format),q_(this.format),e.data)}bind(r,e){const{context:t}=this,{gl:n}=t;n.bindTexture(n.TEXTURE_3D,this.texture),r!==this.minFilter&&(n.texParameteri(n.TEXTURE_3D,n.TEXTURE_MAG_FILTER,r),n.texParameteri(n.TEXTURE_3D,n.TEXTURE_MIN_FILTER,r),this.minFilter=r),e!==this.wrapS&&(n.texParameteri(n.TEXTURE_3D,n.TEXTURE_WRAP_S,e),n.texParameteri(n.TEXTURE_3D,n.TEXTURE_WRAP_T,e),this.wrapS=e)}destroy(){const{gl:r}=this.context;r.deleteTexture(this.texture),this.texture=null}},a.dO=sy,a.dP=(r,e,t,n,s,c)=>{const h=r.transform,f=h.projection.name==="globe";let p;if(c.paint.get("circle-pitch-alignment")==="map")if(f){const x=iy(h.zoom,e.canonical)*h._pixelsPerMercatorPixel;p=Float32Array.from([x,0,0,x])}else p=h.calculatePixelsToTileUnitsMatrix(t);else p=new Float32Array([h.pixelsToGLUnits[0],0,0,h.pixelsToGLUnits[1]]);const g={u_camera_to_center_distance:r.transform.getCameraToCenterDistance(h.projection),u_matrix:r.translatePosMatrix(e.projMatrix,t,c.paint.get("circle-translate"),c.paint.get("circle-translate-anchor")),u_device_pixel_ratio:fn.devicePixelRatio,u_extrude_scale:p,u_inv_rot_matrix:db,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){g.u_inv_rot_matrix=n,g.u_merc_center=s,g.u_tile_id=[e.canonical.x,e.canonical.y,1<<e.canonical.z],g.u_zoom_transition=Gs(h.zoom);const x=s[0]*Ze,b=s[1]*Ze;g.u_up_dir=h.projection.upVector(new Hl(0,0,0),x,b)}return g},a.dQ=qx,a.dR=Zr,a.dS=(r,e,t,n,s,c,h,f,p,g)=>{const x=r.transform,b=x.pitch<15?Ux(.07,.7,k((14-x.zoom)/5,0,1)):.07,w=t.paint.get("line-trim-color-use-theme").
vendor: 12,252 bytes, line 7
7constantOr("default")==="none";return{u_matrix:Gx(r,e,t,n),u_texsize:e.imageAtlasTexture?e.imageAtlasTexture.size:[0,0],u_pixels_to_tile_units:x.calculatePixelsToTileUnitsMatrix(e),u_device_pixel_ratio:s,u_width_scale:c,u_floor_width_scale:h,u_image:0,u_tile_units_to_pixels:jx(e,x),u_units_to_pixels:[1/x.pixelsToGLUnits[0],1/x.pixelsToGLUnits[1]],u_alpha_discard_threshold:0,u_trim_offset:f,u_trim_fade_range:t.paint.get("line-trim-fade-range"),u_trim_gradient_mix_range:[1,1],u_trim_color:t.paint.get("line-trim-color").toPremultipliedRenderColor(w?null:t.lut).toArray01(),u_zbias_factor:b,u_tile_to_meter:De(e.tileID.canonical,0),u_ground_shadow_factor:p,u_pattern_transition:g}},a.dT=(r,e,t,n,s,c,h,f,p,g)=>{const x=r.transform,b=x.calculatePixelsToTileUnitsMatrix(e),w=t.paint.get("line-trim-color-use-theme").constantOr("default")==="none",S=x.pitch<15?Ux(.07,.7,k((14-x.zoom)/5,0,1)):.07;return{u_matrix:Gx(r,e,t,n),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/x.pixelsToGLUnits[0],1/x.pixelsToGLUnits[1]],u_dash_image:0,u_gradient_image:1,u_image_height:s,u_texsize:$x(t)&&e.lineAtlasTexture?e.lineAtlasTexture.size:[0,0],u_tile_units_to_pixels:jx(e,r.transform),u_alpha_discard_threshold:0,u_trim_offset:p,u_trim_fade_range:t.paint.get("line-trim-fade-range"),u_trim_gradient_mix_range:[1,1],u_trim_color:t.paint.get("line-trim-color").toPremultipliedRenderColor(w?null:t.lut).toArray01(),u_zbias_factor:S,u_tile_to_meter:De(e.tileID.canonical,0),u_ground_shadow_factor:g}},a.dU=he,a.dV=Id,a.dW=we,a.dX=sb,a.dY=Fp,a.dZ=Qy,a.d_=Ve,a.da=function(r,e,t,n){return r.type==="custom"?new Qw(r,e):new rT[r.type](r,e,t,n)},a.db=ze,a.dc=du,a.dd=function(r){const e=r.indexOf(zl);return e>=0?r.slice(e+1):""},a.de=class extends ic{constructor(r,e){super(r._vectorTileFeature,r._z,r._x,r._y,r.id),r.state&&(this.state=Object.assign({},r.state)),this.target=e.target,this.namespace=e.namespace,e.properties&&(this.properties=e.properties),this.target&&("featuresetId"in this.target&&!this.target.importId||"layerId"in this.target)&&(this.source=r.source,this.sourceLayer=r.sourceLayer,this.layer=r.layer)}toJSON(){const r=super.toJSON();return r.target=this.target,r.namespace=this.namespace,r}},a.df=Wh,a.dg=function(r){return r({pluginStatus:pr,pluginURL:ts}),Wh.on("pluginStateChange",r),r},a.dh=d_,a.di=class extends Bn{constructor(r){super(r),this.current=o}set(r,e,t){if(this.fetchUniformLocation(r,e)){for(let n=0;n<9;n++)if(t[n]!==this.current[n]){this.current=t,this.gl.uniformMatrix3fv(this.location,!1,t);break}}}},a.dj=el,a.dk=function(r,e,t){const n=Gs(t.zoom),s=r.style.map._antialias,c=r.terrain&&r.terrain.exaggeration()>0;return n===0&&!s&&!c},a.dl=function(r){const e=r.pixelsPerMeter,t=e/fe(1,r.center.lat),n=Ei(new Float64Array(16));return Qr(n,n,[r.point.x,r.point.y,0]),Mr(n,n,[t,t,e]),Float32Array.from(n)},a.dm=xp,a.dn=function(r){const e=80.051129;r=k(r,-80.051129,e)/e*90;const t=Math.pow(Math.abs(Math.sin(Vt(r))),3);return Math.round(t*(ne.length-1))},a.dp=function(r,e,t,n){const s=e.getNorth(),c=e.getSouth(),h=e.getWest(),f=e.getEast(),p=1<<r.z,g=f-h,x=s-c,b=g/j,w=-x/ne[t],S=[0,b,0,w,0,0,s,h,0];if(r.z>0){const E=180/n;yo(S,S,[E/g+1,0,0,0,E/x+1,0,-.5*E/b,.5*E/w,1])}return S[2]=p,S[5]=r.x,S[8]=r.y,S},a.dq=Sd,a.dr=ls,a.ds=function(r,e,t){const n=Ei(new Float64Array(16)),s=(e/(1<<r)-.5)*Math.PI*2;return Nn(n,t.globeMatrix,s),Float32Array.from(n)},a.dt=wd,a.du=oi,a.dv=_y,a.dw=yp,a.dx=sn,a.dy=Ni,a.dz=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]},a.e=Nt,a.e$=function(r,e,t=!1){if(pr===fr.deferred||pr===fr.loading||pr===fr.loaded)throw new Error("setRTLTextPlugin cannot be called multiple times.");ts=fn.resolveURL(r),pr=fr.deferred,uu=e,Zh(),t||ep()},a.e0=450,a.e1=7,a.e2=function(r,e){if(r===e){var t=e[1],n=e[2],s=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]=t,r[6]=e[9],r[7]=e[13],r[8]=n,r[9]=c,r[11]=e[14],r[12]=s,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},a.e3=Kw,a.e4=zt,a.e5=bu,a.e6=256,a.e7=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},a.e8=Qg,a.e9=m_,a.eA=pd,a.eB=fd,a.eC=class{constructor(){this._updateTime=0,this._sourceIds=[],this._activeRegions=[],this._prevRegions=[],this._globalClipBounds={min:new Fe(1/0,1/0),max:new Fe(-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 t=Ny(new Fe(0,0),new Fe(Ze,Ze),r),n=[];if(e&&!R_(t,this._globalClipBounds))return n;for(const s of this._activeRegions){if(s.hiddenByOverlap||!R_(t,s))continue;const c=Wb(s.min,s.max,r);n.push({min:c.min,max:c.max,sourceId:this._sourceIds[s.priority],footprint:s.footprint,footprintTileId:s.tileId,order:s.order,clipMask:s.clipMask,clipScope:s.clipScope})}return n}setSources(r){this._setSources(r.map(e=>({getSourceId:()=>e.cache.id,getFootprints:()=>{const t=[];for(const n of e.cache.getVisibleCoordinates()){const s=e.cache.getTile(n).buckets[e.layer];s&&s.updateFootprints(n.toUnwrapped(),t)}return t},getOrder:()=>e.order,getClipMask:()=>e.clipMask,getClipScope:()=>e.clipScope})))}_addSource(r){const e=r.getFootprints();if(e.length===0)return;const t=r.getOrder(),n=r.getClipMask(),s=r.getClipScope();for(const c of e){if(!c.footprint)continue;const h=Ny(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:t,clipMask:n,clipScope:s})}this._sourceIds.push(r.getSourceId())}_computeReplacement(){this._activeRegions.sort((e,t)=>e.priority-t.priority||Mp(e.min,t.min)||Mp(e.max,t.max)||e.order-t.order||e.clipMask-t.clipMask||function(n,s){const c=(h,f)=>h+f;return n.length-s.length||n.reduce(c,"").localeCompare(s.reduce(c,""))}(e.clipScope,t.clipScope));let r=this._activeRegions.length!==this._prevRegions.length;if(!r){let e=0;for(;!r&&e!==this._activeRegions.length;){const t=this._activeRegions[e],n=this._prevRegions[e];r=t.priority!==n.priority||!Vy(t,n)||t.order!==n.order||t.clipMask!==n.clipMask||!di(t.clipScope,n.clipScope),this._activeRegions[e].hiddenByOverlap=n.hiddenByOverlap,++e}}if(r){++this._updateTime;for(const t of this._activeRegions)t.order!==zd&&(this._globalClipBounds.min.x=Math.min(this._globalClipBounds.min.x,t.min.x),this._globalClipBounds.min.y=Math.min(this._globalClipBounds.min.y,t.min.y),this._globalClipBounds.max.x=Math.max(this._globalClipBounds.max.x,t.max.x),this._globalClipBounds.max.y=Math.max(this._globalClipBounds.max.y,t.max.y));const e=t=>{const n=this._activeRegions;if(t>=n.length)return t;const s=n[t].priority;for(;t<n.length&&n[t].priority===s;)++t;return t};if(this._sourceIds.length>1){let t=0,n=e(t);for(;t!==n;){let s=t;const c=t;for(;s!==n;){const h=this._activeRegions[s];h.hiddenByOverlap=!1;for(let f=0;f<c;f++){const p=this._activeRegions[f];if(!p.hiddenByOverlap&&h.order===zd&&R_(h,p)&&(h.hiddenByOverlap=Uy(h.footprint,h.tileId,p.footprint,p.tileId),h.hiddenByOverlap))break}++s}t=n,n=e(t)}}}}_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()}},a.eD=Ir,a.eE=am,a.eF=Vs,a.eG=zd,a.eH=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 t=new sn,n=new Ni,s=[],c=r+1+2,h=e[0]+1,f=e[0]+1+(1+e.length),p=(g,x,b)=>{let w=g===c-1?g-2:g===0?g:g-1;return w+=b?24575:0,[w,x]};for(let g=0;g<c;++g)t.emplaceBack(...p(g,0,!0));for(let g=0;g<h;++g)for(let x=0;x<c;++x)t.emplaceBack(...p(x,g,(x===0||x===c-1)&&!0));for(let g=0;g<e.length;++g){const x=e[g];for(let b=0;b<c;++b)t.emplaceBack(...p(b,x,!0))}for(let g=0;g<e.length;++g){const x=n.length,b=e[g]+1+2,w=new Ni;for(let A=0;A<b-1;A++){const P=A===b-2,R=P?c*(f-e.length+g-A):c;for(let B=0;B<c-1;B++){const L=A*c+B;A===0||P||B===0||B===c-2?(w.emplaceBack(L+1,L,L+R),w.emplaceBack(L+R,L+R+1,L+1)):(n.emplaceBack(L+1,L,L+R),n.emplaceBack(L+R,L+R+1,L+1))}}const S=oi.simpleSegment(0,x,t.length,n.length-x);for(let A=0;A<w.uint16.length;A+=3)n.emplaceBack(w.uint16[A],w.uint16[A+1],w.uint16[A+2]);const E=oi.simpleSegment(0,x,t.length,n.length-x);s.push({withoutSkirts:S,withSkirts:E})}return{vertices:t,indices:n,segments:s}}_createGrid(r){const e=this._fillGridMeshWithLods(j,ne);this._gridSegments=e.segments,this._gridBuffer=r.createVertexBuffer(e.vertices,wd.members),this._gridIndexBuffer=r.createIndexBuffer(e.indices,!0)}_createPoles(r){const e=new Ni;for(let h=0;h<=j;h++)e.emplaceBack(0,h+1,h+2);this._poleIndexBuffer=r.createIndexBuffer(e,!0);const t=new Bs,n=new Bs,s=new Bs,c=new Bs;this._poleSegments=[];for(let h=0,f=0;h<6;h++){const p=360/(1<<h);t.emplaceBack(0,-H,0,.5,0),n.emplaceBack(0,-H,0,.5,1),s.emplaceBack(0,-H,0,.5,.5),c.emplaceBack(0,-H,0,.5,.5);for(let g=0;g<=j;g++){let x=g/j,b=0;const w=dt(0,p,x),[S,E,A]=Z(ub,hb,w,H);t.emplaceBack(S,E,A,x,b),n.emplaceBack(S,E,A,x,1-b);const P=Vt(w);x=.5+.5*Math.sin(P),b=.5+.5*Math.cos(P),s.emplaceBack(S,E,A,x,b),c.emplaceBack(S,E,A,x,1-b)}this._poleSegments.push(oi.simpleSegment(f,0,66,64)),f+=66}this._poleNorthVertexBuffer=r.createVertexBuffer(t,gp,!1),this._poleSouthVertexBuffer=r.createVertexBuffer(n,gp,!1),this._texturedPoleNorthVertexBuffer=r.createVertexBuffer(s,gp,!1),this._texturedPoleSouthVertexBuffer=r.createVertexBuffer(c,gp,!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]]}},a.eI=Zb,a.eJ=pe,a.eK=function(){return!!document.fullscreenElement||!!document.webkitFullscreenElement},a.eL=O,a.eM=Ne,a.eN=function(r,e,t){return r[0]=e[0]/t[0],r[1]=e[1]/t[1],r[2]=e[2]/t[2],r},a.eO=hc,a.eP=K,a.eQ=uc,a.eR=ri,a.eS=function([r,e,t]){const n=Math.hypot(r,e,t),s=Math.atan2(r,t),c=.5*Math.PI-Math.acos(-e/n);return new se(Zi(s),Zi(c))},a.eT=hn,a.eU=$_,a.eV=function(r){const e=r.navigator?r.navigator.userAgent:null;return!!function(t){if(vi==null){const n=t.navigator?t.navigator.userAgent:null;vi=!!t.safari||!(!n||!(/\b(iPad|iPhone|iPod)\b/.test(n)||n.match("Safari")&&!n.match("Chrome")))}return vi}(r)&&!(!e||!(e.match("Version/15.4")||e.match("Version/15.5")||e.match(/CPU (OS|iPhone OS) (15_4|15_5) like Mac OS X/)))},a.eW=function(r,e){gc=r,Qu=e},a.eX=g_,a.eY=ny,a.eZ=function(r){const e=[0,0,0],t=Ei(new Float64Array(16));return Ti(t,r.pixelMatrix,r.globeMatrix),Vi(e,e,t),new Fe(e[0],e[1])},a.e_=Xh,a.ea=Fn,a.eb=Nn,a.ec=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},a.ed=Bs,a.ee=Vl,a.ef=function(r,e,t,n,s){return k((r-e)/(t-e)*(s-n)+n,n,s)},a.eg=Go,a.eh=function(r,e){var t=e[0],n=e[1],s=e[2],c=e[3],h=e[4],f=e[5],p=e[6],g=e[7],x=e[8],b=x*h-f*g,w=-x*c+f*p,S=g*c-h*p,E=t*b+n*w+s*S;return E?(r[0]=b*(E=1/E),r[1]=(-x*n+s*g)*E,r[2]=(f*n-s*h)*E,r[3]=w*E,r[4]=(x*t-s*p)*E,r[5]=(-f*t+s*c)*E,r[6]=S*E,r[7]=(-g*t+n*p)*E,r[8]=(h*t-n*c)*E,r):null},a.ei=Nf,a.ej=2,a.ek=Uo,a.el=qn,a.em=Ha,a.en=function(r,e){var t=new Oi(3);Ha(t,e);var n=1/t[0],s=1/t[1],c=1/t[2],h=e[0]*n,f=e[1]*s,p=e[2]*c,g=e[4]*n,x=e[5]*s,b=e[6]*c,w=e[8]*n,S=e[9]*s,E=e[10]*c,A=h+x+E,P=0;return A>0?(P=2*Math.sqrt(A+1),r[3]=.25*P,r[0]=(b-S)/P,r[1]=(w-p)/P,r[2]=(f-g)/P):h>x&&h>E?(P=2*Math.sqrt(1+h-x-E),r[3]=(b-S)/P,r[0]=.25*P,r[1]=(f+g)/P,r[2]=(w+p)/P):x>E?(P=2*Math.sqrt(1+x-h-E),r[3]=(w-p)/P,r[0]=(f+g)/P,r[1]=.25*P,r[2]=(b+S)/P):(P=2*Math.sqrt(1+E-h-x),r[3]=(f-g)/P,r[0]=(w+p
7)/P,r[1]=(b+S)/P,r[2]=.25*P),r},a.eo=function(r,e){var t=2*Math.acos(e[3]),n=Math.sin(t/2);return n>We?(r[0]=e[0]/n,r[1]=e[1]/n,r[2]=e[2]/n):(r[0]=1,r[1]=0,r[2]=0),t},a.ep=Dg,a.eq=Gp,a.er=jp,a.es=[1,1,1],a.et=Nu,a.eu=function(r,e,t,n){var s=e[0],c=e[1],h=e[2],f=e[3];return r[0]=s+n*(t[0]-s),r[1]=c+n*(t[1]-c),r[2]=h+n*(t[2]-h),r[3]=f+n*(t[3]-f),r},a.ev=Ru,a.ew=On,a.ex=ks,a.ey=function(r,e,t,n,s,c,h,f,p,g,x,b,w,S,E,A){var P=new Oi(16);return P[0]=r,P[1]=e,P[2]=t,P[3]=n,P[4]=s,P[5]=c,P[6]=h,P[7]=f,P[8]=p,P[9]=g,P[10]=x,P[11]=b,P[12]=w,P[13]=S,P[14]=E,P[15]=A,P},a.ez=te,a.f=function(r){return btoa(encodeURIComponent(r).replace(/%([0-9A-F]{2})/g,(e,t)=>String.fromCharCode(+("0x"+t))))},a.f0=Mn,a.f1=Tr,a.f2=wr,a.f3=function(r){const e=hf();if(!e)return;const t=e.delete(_c);r&&t.then(()=>r()).catch(r)},a.f4=Qe,a.f5=Ba,a.f6=2,a.f7=xl,a.f8=ec,a.f9=gd,a.fA=lo,a.fB=fr,a.fC=function(r){yc(),Ao!=null&&Ao.then(e=>{e.keys().then(t=>{for(let n=0;n<t.length-r;n++)e.delete(t[n]).catch(s=>lt(s.message))}).catch(t=>lt(t.message))}).catch(e=>lt(e.message))},a.fa=l0,a.fb=c0,a.fc=Bx,a.fd=Et,a.fe="hd_road_elevation",a.ff=ci,a.fg=Re,a.fh=Ap,a.fi=qs,a.fj=fg,a.fk=1,a.fl=Oo,a.fm=function(r,e,t,n,s,c,h,f=1,p,g,x,b){r.createArrays(),r.tilePixelRatio=Ze/(512*r.overscaling),r.compareText={},r.iconsNeedLinear=!1;const w=r.layers[0].layout,S=r.layers[0]._unevaluatedLayout._values,E={};E.scaleFactor=f,E.textSizeScaleRange=w.get("text-size-scale-range"),E.iconSizeScaleRange=w.get("icon-size-scale-range");const[A,P]=E.textSizeScaleRange,[R,B]=E.iconSizeScaleRange;E.textScaleFactor=k(E.scaleFactor,A,P),E.iconScaleFactor=k(E.scaleFactor,R,B);const L=S["text-size"],U=S["icon-size"];if(r.textSizeData.kind==="composite"){const{minZoom:Q,maxZoom:J}=r.textSizeData;E.compositeTextSizes=[L.possiblyEvaluate(new Zt(Q,{worldview:x}),c),L.possiblyEvaluate(new Zt(J,{worldview:x}),c)]}if(r.iconSizeData.kind==="composite"){const{minZoom:Q,maxZoom:J}=r.iconSizeData;E.compositeIconSizes=[U.possiblyEvaluate(new Zt(Q,{worldview:x}),c,b),U.possiblyEvaluate(new Zt(J,{worldview:x}),c,b)]}E.layoutTextSize=L.possiblyEvaluate(new Zt(h+1,{worldview:x}),c),E.layoutIconSize=U.possiblyEvaluate(new Zt(h+1,{worldview:x}),c,b),E.textMaxSize=L.possiblyEvaluate(new Zt(18,{worldview:x}),c);const G=w.get("symbol-placement"),q=w.get("text-rotation-alignment")==="map"&&G!=="point",ie=w.get("text-size");let X=!1;const ee=[];for(const Q of r.features){const J=w.get("text-font").evaluate(Q,{},c).join(","),ve=ie.evaluate(Q,{},c)*E.textScaleFactor,Te=E.layoutTextSize.evaluate(Q,{},c)*E.textScaleFactor,Ie=E.layoutIconSize.evaluate(Q,{},c,b)*E.iconScaleFactor,Ce={horizontal:{},vertical:void 0},Ee=Q.text;let Oe,ye=[0,0];if(Ee){const Mt=Ee.toString(),Li=w.get("text-letter-spacing").evaluate(Q,{},c)*cr,Wt=w.get("text-line-height").evaluate(Q,{},c)*cr,Ut=Ym(Mt)?Li:0,li=w.get("text-anchor").evaluate(Q,{},c),Mi=w.get("text-variable-anchor");if(!Mi){const ji=w.get("text-radial-offset").evaluate(Q,{},c);if(ji)ye=wv(li,[ji*cr,gg]);else{const Ar=w.get("text-offset").evaluate(Q,{},c);ye=[Ar[0]*cr,Ar[1]*cr]}}let ur=q?"center":w.get("text-justify").evaluate(Q,{},c);const Pi=G==="point",Ui=Pi?w.get("text-max-width").evaluate(Q,{},c)*cr:1/0,Ki=ji=>{r.allowVerticalPlacement&&$h(Mt)&&(Ce.vertical=sg(Ee,e,t,s,J,Ui,Wt,li,ji,Ut,ye,Tn.vertical,!0,Te,ve,p,E.textScaleFactor))};if(!q&&Mi){const ji=ur==="auto"?Mi.map(hr=>yg(hr)):[ur];let Ar=!1;for(let hr=0;hr<ji.length;hr++){const Pt=ji[hr];if(!Ce.horizontal[Pt])if(Ar)Ce.horizontal[Pt]=Ce.horizontal[0];else{const Ur=sg(Ee,e,t,s,J,Ui,Wt,"center",Pt,Ut,ye,Tn.horizontal,!1,Te,ve,p,E.textScaleFactor);Ur&&(Ce.horizontal[Pt]=Ur,Ar=Ur.positionedLines.length===1)}}Ki("left")}else{if(ur==="auto"&&(ur=yg(li)),Pi||w.get("text-writing-mode").indexOf("horizontal")>=0||!$h(Mt)){const ji=sg(Ee,e,t,s,J,Ui,Wt,li,ur,Ut,ye,Tn.horizontal,!1,Te,ve,p,E.textScaleFactor);ji&&(Ce.horizontal[ur]=ji)}Ki(Pi?"left":ur)}}let Ae,Pe,Be,Ue,Je,He,qe=!1;const je=w.get("icon-text-fit").evaluate(Q,{},c);if(Q.icon&&Q.icon.hasPrimary()){const Mt=Zd(Q.icon,r.iconSizeData,S["icon-size"],c,r.zoom,Q,p,E.iconScaleFactor,x,b);Ae=Mt.iconPrimary,Be=Mt.iconSecondary;const Li=Ae.toString();if(Pe=n.get(Li),Pe&&(Je=w.get("icon-offset").evaluate(Q,{},c),He=w.get("icon-anchor").evaluate(Q,{},c),Oe=Xp(s.get(Li),Be?s.get(Be.toString()):void 0,Je,He),qe=Pe.s
7df,r.sdfIcons===void 0?r.sdfIcons=Pe.sdf:r.sdfIcons!==Pe.sdf&&lt("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(Pe.pixelRatio!==r.pixelRatio||w.get("icon-rotate").constantOr(1)!==0)&&(r.iconsNeedLinear=!0)),Be){const Wt=Be.toString();Ue=n.get(Wt)}}X=X||!(!Q.icon||!Q.icon.hasSecondary());const Ye=tm(Ce.horizontal)||Ce.vertical;r.iconsInText||(r.iconsInText=!!Ye&&Ye.iconsInText);const it=Te*E.textScaleFactor/cr,{defaultShapedIcon:ht,verticallyShapedIcon:nt}=Ow(r,Oe,w,Q,c,Ce,it,Je,je);je!=="none"&&Oe&&(nv(Oe)||ov(Oe))&&(em(0,Pe,Ae,Oe,ht,je,g,n,s),em(0,Ue,Be,Oe,ht,je,g,n,s),nt&&(em(0,Pe,Ae,Oe,nt,je,g,n,s),em(0,Ue,Be,Oe,nt,je,g,n,s))),Oe=ht;const{iconBBox:wt,iconVerticalBBox:Ft,textBBox:Tt,textVerticalBBox:Bt}=Dw(r,Oe,nt,w,Q,c,Ie,Je,E,s,He,Ce,Te,ye,b);ee.push({feature:Q,shapedTextOrientations:Ce,shapedText:Ye,shapedIcon:Oe,iconPrimary:Ae,iconSecondary:Be,iconOffset:Je,iconAnchor:He,verticallyShapedIcon:nt,layoutTextSize:Te,layoutIconSize:Ie,textOffset:ye,isSDFIcon:qe,iconTextFit:je,iconCollisionBounds:wt,iconVerticalCollisionBounds:Ft,textCollisionBounds:Tt,textVerticalCollisionBounds:Bt})}return{featureData:ee,sizes:E,hasAnySecondaryIcon:X,textAlongLine:q,symbolPlacement:G}},a.fn=pg,a.fo=dg,a.fp=pv,a.fq=mv,a.fr=function(r,e,t,n,s,c,h,f,p,g){r.iconAtlasPositions=g.iconPositions;const{featureData:x,hasAnySecondaryIcon:b,sizes:w,textAlongLine:S,symbolPlacement:E}=e;for(const A of x){const{shapedIcon:P,verticallyShapedIcon:R,feature:B,shapedTextOrientations:L,shapedText:U,layoutTextSize:G,textOffset:q,isSDFIcon:ie,iconPrimary:X,iconSecondary:ee,iconTextFit:Q,iconOffset:J,iconCollisionBounds:ve,iconVerticalCollisionBounds:Te,textCollisionBounds:Ie}=A;Ev(P,g.iconPositions,X,ee),Ev(R,g.iconPositions,X,ee),Fw(L,g.iconPositions),Lw(X,ee,g.iconPositions),(U||P)&&Bw(r,B,L,P,R,p,w,G,0,q,ie,n,s,h,f,b,Q,J,S,E,ve,Te,Ie)}t&&r.generateCollisionDebugBuffers(c,r.collisionBoxArray,w.textScaleFactor)},a.fs=Hp,a.ft=Gt,a.fu=gm,a.fv=yt,a.fw=function(r){let e=0;if(new Uint32Array(r,0,1)[0]!==yx){const t=new Uint32Array(r,0,7),[,,n,s,c,h]=t;e=t.byteLength+s+c+h+c,(n!==r.byteLength||e>=r.byteLength)&&lt("Invalid b3dm header information.")}return wx(r,e)},a.fx=function(r,e){const t=Y_(r);for(const n of t){for(const s of n.meshes)I1(s);n.lights&&(n.lightMeshIndex=n.meshes.length,n.meshes.push(E1(n.lights,e)))}return t},a.fy=hm,a.fz=Si,a.g=function(r,e){return ta(Object.assign(r,{method:"GET"}),e)},a.h=function(r){return r.indexOf("mapbox:")===0},a.i=function(r){return Nt.API_STYLE_REGEX.test(r)&&!$n(r)},a.j=Sr,a.k=tl,a.l=function(r){return decodeURIComponent(atob(r).split("").map(e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)).join(""))},a.m=function(r,e){return ta(Object.assign(r,{type:"json"}),e)},a.n=ia,a.o=fn,a.p=function(r,e){return ta(Object.assign(r,{method:"POST"}),e)},a.q=Dr,a.r=me,a.s=function(r){try{const e=self[r];return e.setItem("_mapbox_test_",1),e.removeItem("_mapbox_test_"),!0}catch{return!1}},a.t=ae,a.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)}()},a.v=function(r){return!!r&&/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(r)},a.w=lt,a.x=class{constructor(r){this.cache=new Map,this.textures=new Map,this.textureAccessTimes=new Map,this.textureMemoryUsed=0,this.maxTextureMemory=1024*(r&&r.maxTextureMemoryMB?r.maxTextureMemoryMB:256)*1024,this.finalizationRegistry=new FinalizationRegistry(e=>{this.cache.delete(e),this.clearExpiredTextures()})}calculateTextureMemory(r){return r.image?Math.ceil(r.image.width*r.image.height*4*(r.patternPositions.size>0?1.33:1)):0}evictTexture(r){const e=this.textures.get(r);if(e){const t=this.calculateTextureMemory(r);e.destroy(),this.textures.delete(r),this.textureAccessTimes.delete(r),this.textureMemoryUsed-=t}}evictTexturesIfNeeded(r){for(;this.textureMemoryUsed+r>this.maxTextureMemory&&this.textures.size>0;){let e=null,t=1/0;for(const[n]of this.textures.entries()){const s=this.textureAccessTimes.get(n)||0;s<t&&(t=s,e=n)}if(!e)break;this.evictTexture(e)}}findCachedAtlas(r){const e=this.cache.get(r.hash);if(e){const t=e.deref();if(t&&t.contentDescriptor&&this.isMipmapCompatible(r,t.contentDescriptor))return t}for(const[,t]of this.cache.entries()){const n=t.deref();
vendor: 6,360 bytes, line 7
7if(n&&n.contentDescriptor){const s=r.subsetOf(n.contentDescriptor),c=this.isMipmapCompatible(r,n.contentDescriptor);if(s&&c)return n}}}getTextureForAtlas(r,e,t){this.textureAccessTimes.set(r,performance.now());let n=this.textures.get(r);if(n)return n;if(r.image){const s=this.calculateTextureMemory(r);return this.evictTexturesIfNeeded(s),n=new hs(e,r.image,t,{useMipmap:!!r.patternPositions.size}),this.textures.set(r,n),this.textureMemoryUsed+=s,n}return null}clearExpiredTextures(){for(const[r]of this.textures.entries())if(!this.isAtlasCached(r)){const e=this.textures.get(r);if(e){const t=this.calculateTextureMemory(r);e.destroy(),this.textureMemoryUsed-=t}this.textures.delete(r),this.textureAccessTimes.delete(r)}}isAtlasCached(r){if(!r.contentDescriptor)return!1;const e=this.cache.get(r.contentDescriptor.hash);return!!e&&e.deref()===r}getOrCache(r){if(!("image"in r)){const s=this.cache.get(r.sourceAtlasHash);if(s){const c=s.deref();if(c)return c}return lt("ImageAtlasReference points to GC'd atlas - atlas may have been evicted"),null}if(!r.contentDescriptor)return r;const e=r.contentDescriptor,t=e.hash,n=this.cache.get(t);if(n){const s=n.deref();if(s&&s.contentDescriptor&&this.isMipmapCompatible(e,s.contentDescriptor))return s}return this.cache.set(t,new WeakRef(r)),this.finalizationRegistry.register(r,t,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}},a.y=Ss,a.z=Fg}),Cm(["require","./shared"],function(a,We){function Oi(pe){const O=pe?pe.url.toString():void 0;return O?performance.getEntriesByName(O):[]}function Vn(pe){if(typeof pe=="number"||typeof pe=="boolean"||typeof pe=="string"||pe==null)return JSON.stringify(pe);if(Array.isArray(pe)){let k="[";for(const W of pe)k+=`${Vn(W)},`;return`${k}]`}let O="{";for(const k of Object.keys(pe).sort())O+=`${k}:${Vn(pe[k])},`;return`${O}}`}function ac(pe){let O="";for(const k of We.b6)O+=`/${Vn(pe[k])}`;return O}function Ys(pe,O){return function k(W){return typeof W=="string"&&W===O||(Array.isArray(W)?W.some(k):!(!W||typeof W!="object")&&Object.values(W).some(k))}(pe)}class yo{constructor(O){this.keyCache=Object.create(null),this._layers=Object.create(null),this._layerConfigs=Object.create(null),O&&this.replace(O)}replace(O,k){this._layerConfigs=Object.create(null),this._layers=Object.create(null),this.update(O,[],k)}update(O,k,W){this._options=W;for(const ae of O)this._layerConfigs[ae.id]=ae,(this._layers[ae.id]=We.da(ae,this.scope,null,this._options)).compileFilter(W),this.keyCache[ae.id]&&delete this.keyCache[ae.id];for(const ae of k)delete this.keyCache[ae],delete this._layerConfigs[ae],delete this._layers[ae];this.familiesBySource=Object.create(null);const oe=function(ae,ce){const me=Object.create(null);for(let ge=0;ge<ae.length;ge++){const Re=ae[ge];let ze=ce&&ce[Re.id];ze||(Re.type==="symbol"?ze=Re.id:(ze=ac(Re),Re.type==="line"&&Re.paint&&Ys(Re.paint["line-width"],"line-progress")&&(ze+=`/${Vn(Re.paint["line-width"])}`))),ce&&(ce[Re.id]=ze);let Xe=me[ze];Xe||(Xe=me[ze]=[]),Xe.push(Re)}const he=[];for(const ge in me)he.push(me[ge]);return he}(Object.values(this._layerConfigs),this.keyCache);for(const ae of oe){const ce=ae.map(Xe=>this._layers[Xe.id]),me=ce[0];if(me.visibility==="none")continue;const he=me.source||"";let ge=this.familiesBySource[he];ge||(ge=this.familiesBySource[he]=Object.create(null));const Re=me.sourceLayer||"_geojsonTileLayer";let ze=ge[Re];ze||(ze=ge[Re]=[]),ze.push(ce)}}}const ps=1*We.f6;class Jt{constructor(O){const k={},W=[];for(const me in O){const he=O[me],ge=k[me]={};for(const Re in he.glyphs){const ze=he.glyphs[+Re];if(!ze||ze.bitmap.width===0||ze.bitmap.height===0)continue;const Xe=ze.metrics.localGlyph?ps:1,ut={x:0,y:0,w:ze.bitmap.width+2*Xe,h:ze.bitmap.height+2*Xe};W.push(ut),ge[Re]=ut}}const{w:oe,h:ae}=We.J(W),ce=new We.f5({width:oe||1,height:ae||1});for(const me in O){const he=O[me];for(const ge in he.glyphs){const Re=he.glyphs[+ge];if(!Re||Re.bitmap.width===0||Re.bitmap.height===0)continue;const ze=k[me][ge],Xe=Re.metrics.localGlyph?ps:1;We.f5.copy(Re.bitmap,ce,{x:0,y:0},{x:ze.x+Xe,y:ze.y+Xe},Re.bitmap)}}this.image=ce,this.positions=k}}function Ei(pe,O,k){pe[O]?k&&(pe[O].center=k):pe[O]={floorIds:new Set,center:k||[0,0],floors:{}}}function An(pe,O,k,W){for(const oe of O)Ei(pe,oe),pe[oe].floors[k]=W,pe[oe].floorIds.add(k)}function Ti(pe){return{id:pe.properties.id.toString(),center:[pe.properties.center_lon||0,pe.properties.center_lat||0]}}function Qr(pe,O){const k=pe.properties.id.toString(),W=!!pe.properties.is_default&&pe.properties.is_default,oe=pe.properties.connected_floor_ids?new Set(pe.properties.connected_floor_ids.toString().split(";")):new Set,ae=pe.properties.conflicted_floor_ids?new Set(pe.properties.conflicted_floor_ids.toString().split(";")):new Set,ce=pe.properties.structure_ids?new Set(pe.properties.structure_ids.toString().split(";")):new Set,me=pe.properties.name.toString(),he=pe.properties.z_index,ge=function(Re,ze){const Xe=Re.loadGeometry();if(!Xe||Xe.length===0)return;const ut=Xe.map(mt=>mt.map(lt=>We.f7(lt,ze,Re.extent)));return ut.length===0?void 0:{type:"Polygon",coordinates:[ut[0]]}}(pe,O);return{id:k,isDefault:W,connections:oe,conflicts:ae,buildings:ce,name:me,zIndex:he,geometry:ge}}function Mr(pe,O){return O.every(k=>pe.properties&&pe.properties[k]!=null)}function xo(pe){return Mr(pe,["type","id","name"])&&pe.properties.type==="structure"}function Nn(pe){return Mr(pe,["type","id","name","z_index"])&&pe.properties.type==="floor"}We.f4(Jt,"GlyphAtlas");class vo{constructor(O){this.tileID=new We.aS(O.tileID.overscaledZ,O.tileID.wrap,O.tileID.canonical.z,O.tileID.canonical.x,O.tileID.canonical.y),this.tileZoom=O.tileZoom,this.uid=O.uid,this.zoom=O.zoom,this.lut=O.lut,this.canonical=O.tileID.canonical,this.pixelRatio=O.pixelRatio,this.tileSize=O.tileSize,this.source=O.source,this.scope=O.scope,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=O.showCollisionBoxes,this.collectResourceTiming=!!O.request&&O.request.collectResourceTiming,this.promoteId=O.promoteId,this.renderSourceType=O.render
7SourceType,this.tileTransform=We.f8(O.tileID.canonical,O.projection),this.projection=O.projection,this.worldview=O.worldview,this.localizableLayerIds=O.localizableLayerIds,this.brightness=O.brightness,this.extraShadowCaster=!!O.extraShadowCaster,this.tessellationStep=O.tessellationStep,this.scaleFactor=O.scaleFactor,this.worldview=O.worldview,this.indoor=O.indoor}parse(O,k,W,oe,ae,ce){this.status="parsing",this.data=O,this.collisionBoxArray=new We.f9;const me=new We.fa(Object.keys(O.layers).sort()),he=new We.fb(this.tileID,this.promoteId);he.bucketLayerIDs=[];const ge={},Re=new We.fc(256,256),ze={featureIndex:he,iconDependencies:new Map,patternDependencies:new Map,glyphDependencies:{},lineAtlas:Re,availableImages:W,brightness:this.brightness,scaleFactor:this.scaleFactor,elevationFeatures:void 0,activeFloors:void 0};this.indoor&&(ze.activeFloors=function(lt,St,vt,Ot){const Si=St.indoorState.activeFloorsVisible;if(!St.sourceLayers)return Si?St.indoorState.activeFloors:void 0;const Yi=function(fi,Ri){if(!fi)return We.w("No source layers defined in indoor specification"),Ri;if(fi.size===0)return Ri;const bi=fi.difference(Ri);for(const pi of bi)We.w(`Missing source layer required in indoor specification: ${pi}`);return Ri.intersection(Ri)}(St.sourceLayers,new Set(Object.keys(lt.layers))),Di=St.indoorState,vi=function(fi,Ri,bi,pi,_i){const mi={};for(const Nt of Ri){const wr=fi.layers[Nt];if(wr)for(let Tr=0;Tr<wr.length;Tr++){const Mn=wr.feature(Tr);if(xo(Mn)){const{id:Sr,center:$n}=Ti(Mn);Ei(mi,Sr,$n);continue}if(Nn(Mn)){const Sr=Qr(Mn,_i);An(mi,Sr.buildings,Sr.id,Sr)}}else We.w(`indoor source layer not found: ${Nt}`)}return{buildings:mi,activeFloors:We.cZ.calculate(mi,pi,bi)}}(lt,Yi,Di.activeFloors,Di.selectedFloorId,Ot);return vt.send("setIndoorData",vi),Si?vi.activeFloors:void 0}(O,this.indoor,ae,this.canonical));const Xe=[],ut=k.familiesBySource[this.source];for(const lt in ut){const St=O.layers[lt];if(!St)continue;let vt=!1,Ot=!1,Si=!1,Yi=!1;for(const bi of ut[lt])bi[0].type==="symbol"?vt=!0:bi[0].type==="fill-extrusion"?Ot=!0:Si=!0,bi[0].is3D()&&bi[0].type!=="model"&&(Yi=!0);if(this.extraShadowCaster&&!Yi||this.renderSourceType===We.b5.Symbol&&!vt||this.renderSourceType===We.b5.FillExtrusion&&!Ot||this.renderSourceType===We.b5.Other&&!Si)continue;St.version===1&&We.w(`Vector tile source "${this.source}" layer "${lt}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const Di=me.encode(lt),vi=[],fi=this.localizableLayerIds&&this.localizableLayerIds.has(lt);let Ri=!1;for(let bi=0,pi=0;bi<St.length;bi++){const _i=St.feature(bi),mi=he.getId(_i,lt),Nt=_i.properties?_i.properties.worldview:null;if(fi&&this.worldview&&typeof Nt=="string")if(Nt==="all")_i.properties.$localized=!0;else{if(!Nt.split(",").includes(this.worldview))continue;_i.properties.$localized=!0,_i.properties.worldview=this.worldview}!Ri&&_i.properties&&_i.properties.hasOwnProperty(We.fd)&&(Ri=!0),vi.push({feature:_i,id:mi,index:pi,sourceLayerIndex:Di}),pi++}Ri&&!ze.elevationFeatures&&O.layers.hasOwnProperty(We.fe)&&(ze.elevationFeatures=We.ff.parseFrom(O.layers[We.fe],this.canonical));for(const bi of ut[lt]){const pi=bi[0];if(this.extraShadowCaster&&(!pi.is3D()||pi.type==="model")||this.renderSourceType===We.b5.Symbol&&pi.type!=="symbol"||this.renderSourceType===We.b5.FillExtrusion&&pi.type!=="fill-extrusion"||this.renderSourceType===We.b5.Other&&(pi.type==="symbol"||pi.type==="fill-extrusion")||pi.minzoom&&this.zoom<Math.floor(pi.minzoom)||pi.maxzoom&&this.zoom>=pi.maxzoom||pi.visibility==="none")continue;Un(bi,this.zoom,ze.brightness,W,this.worldview,ze.activeFloors);const _i=ge[pi.id]=pi.createBucket({index:he.bucketLayerIDs.length,layers:bi,zoom:this.zoom,lut:this.lut,canonical:this.canonical,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:Di,sourceID:this.source,projection:this.projection.spec,tessellationStep:this.tessellationStep,styleDefinedModelURLs:oe,worldview:this.worldview,localizable:fi,availableImages:W,maxUniformBufferBindings:this.maxUniformBufferBindings,maxUniformBlockSizeDwords:this.maxUniformBlockSizeDwords,disableSymbolUBO:this.disableSymbolUBO});he.bucketLayerIDs.push(bi.map(Nt=>We.F(Nt.id,Nt.scope)));let mi=_i.prepare?_i.prepare():null;mi!=null?(mi=mi.then(()=>_i.populate(vi,ze,this.tileID.canonical,this.tileTransform)),Xe.push(mi)):_i.populate(vi,ze,this.tileID.canonical,this.tileTransform)}}const mt=()=>{let lt,St,vt,Ot,Si,Yi,Di;Re.trim();const vi={type:"maybePrepare",renderSourceType:this.renderSourceType,zoom:this.zoom},fi=()=>
7{if(lt)return this.status="done",ce(lt);if(this.extraShadowCaster)this.status="done",ce(null,{buckets:Object.values(ge).filter(bi=>!bi.isEmpty()),featureIndex:he,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:ze.brightness,glyphMap:null,iconMap:null,glyphPositions:null});else if(St&&vt&&Ot&&Di){const pi=new Jt(St),_i=new Map;for(const[wr,Tr]of vt.entries()){const{imagePosition:Mn}=We.fj(wr,Tr,We.fk);_i.set(wr,Mn)}const mi={};for(const wr in ge){const Tr=ge[wr];Tr instanceof We.fl&&(Un(Tr.layers,this.zoom,ze.brightness,W,this.worldview,ze.activeFloors),mi[wr]=We.fm(Tr,St,pi.positions,vt,_i,this.tileID.canonical,this.tileZoom,this.scaleFactor,this.pixelRatio,Si,this.worldview,W))}const Nt={iconsPending:!0,patternsPending:!0};this.rasterizeIfNeeded(ae,vt,Si,()=>{Nt.iconsPending=!1,Ri(mi,pi,Nt,void 0,Di)}),this.rasterizeIfNeeded(ae,Ot,Yi,()=>{Nt.patternsPending=!1,Ri(mi,pi,Nt,void 0,Di)})}},Ri=(bi,pi,_i,mi,Nt)=>{if(_i.iconsPending||_i.patternsPending)return;const wr=vt.size>0||Ot.size>0,Tr=Object.keys(bi).length>0;if(!wr&&!Tr)return this.status="done",void ce(null,{buckets:Object.values(ge).filter(Sr=>!Sr.isEmpty()),featureIndex:he,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:pi.image,lineAtlas:Re,imageAtlas:null,brightness:ze.brightness});const Mn=(Sr,$n)=>{for(const qr in ge){const $r=ge[qr];if(qr in bi)We.fr($r,bi[qr],this.showCollisionBoxes,W,this.tileID.canonical,this.tileZoom,this.projection,this.brightness,vt,$n);else if($r.hasPattern&&($r instanceof We.fs||$r instanceof We.fh||$r instanceof We.dY)){Un($r.layers,this.zoom,ze.brightness,W,this.worldview,ze.activeFloors);const Eo=Object.fromEntries($n.patternPositions);$r.addFeatures(ze,this.tileID.canonical,Eo,W,this.tileTransform,this.brightness)}}this.status="done",ce(null,{buckets:Object.values(ge).filter(qr=>!qr.isEmpty()),featureIndex:he,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:pi.image,lineAtlas:Re,imageAtlas:Sr,brightness:ze.brightness})};if(wr){const Sr=new Map,$n=We.fn(vt,Sr),qr=We.fn(Ot,Sr),$r=new We.fo($n,qr,Nt,this.lut,
7Sr);ae.send("checkAtlasCache",{descriptor:$r,scope:this.scope},(Eo,io)=>{let Pn,tn;if(Eo&&We.w(`[Worker] Error checking atlas cache: ${Eo.message}`),io)Pn=new We.fp(io.sourceHash),tn=io;else{const Ss=new We.fq(vt,Ot,this.lut,Nt);Pn=Ss,tn=Ss}Mn(Pn,tn)})}else Mn(null,{iconPositions:new Map,patternPositions:new Map})};if(!this.extraShadowCaster){const bi=We.fg(ze.glyphDependencies,mi=>Object.keys(mi).map(Number));Object.keys(bi).length?ae.send("getGlyphs",{uid:this.uid,stacks:bi},(mi,Nt)=>{lt||(lt=mi,St=Nt,fi())},void 0,!1,vi):St={},Di=new Map;const pi=Array.from(ze.iconDependencies.keys()).map(mi=>We.I.parse(mi));pi.length?ae.send("getImages",{images:pi,source:this.source,scope:this.scope,tileID:this.tileID,type:"icons"},(mi,Nt)=>{if(!lt){lt=mi,vt=new Map,Si=this.updateImageMapAndGetImageTaskQueue(vt,Nt.images,ze.iconDependencies);for(const[wr,Tr]of Nt.versions.entries())Di.set(wr,Tr);fi()}},void 0,!1,vi):(vt=new Map,Si=new Map);const _i=Array.from(ze.patternDependencies.keys()).map(mi=>We.I.parse(mi));_i.length?ae.send("getImages",{images:_i,source:this.source,scope:this.scope,tileID:this.tileID,type:"patterns"},(mi,Nt)=>{if(!lt){lt=mi,Ot=new Map,Yi=this.updateImageMapAndGetImageTaskQueue(Ot,Nt.images,ze.patternDependencies);for(const[wr,Tr]of Nt.versions.entries())Di.set(wr,Tr);fi()}},void 0,!1,vi):(Ot=new Map,Yi=new Map)}if(ze.elevationFeatures&&ze.elevationFeatures.length>0){const bi=[];for(const _i of Object.values(ge))if(_i instanceof We.fh){const mi=_i.getUnevaluatedPortalGraph();mi&&bi.push(mi)}const pi=We.fi.evaluate(bi);for(const _i of Object.values(ge))if(_i instanceof We.fh){const mi=O.layers[me.decode(_i.sourceLayerIndex)];_i.setEvaluatedPortalGraph(pi,mi,this.tileID.canonical,ze.availableImages,ze.brightness)}}fi()};Xe.length>0?Promise.allSettled(Xe).then(mt).catch(ce):mt()}updateParameters(O){this.scaleFactor=O.scaleFactor,this.showCollisionBoxes=O.showCollisionBoxes,this.projection=O.projection,this.brightness=O.brightness,this.tileTransform=We.f8(O.tileID.canonical,O.projection),this.extraShadowCaster=O.extraShadowCaster,this.lut=O.lut,this.worldview=O.worldview,this.indoor=O.indoor}rasterizeIfNeeded(O,k,W,oe){Array.from(k.values()).some(ae=>ae.usvg)?this.rasterize(O,k,W,oe):oe()}updateImageMapAndGetImageTaskQueue(O,k,W){const oe=new Map;for(const ae of k.keys()){const ce=W.get(ae)||[];for(const me of ce){const he=me.toString(),ge=k.get(me.id.toString());ge.usvg?oe.has(he)||(oe.set(he,me),O.set(he,Object.assign({},ge))):O.set(he,ge)}}return oe}rasterize(O,k,W,oe){this.rasterizeTask=O.send("rasterizeImages",{scope:this.scope,tasks:W},(ae,ce)=>{if(!ae)for(const[me,he]of ce.entries()){const ge=Object.assign(k.get(me),{data:he});k.set(me,ge)}oe()})}cancelRasterize(){this.rasterizeTask&&this.rasterizeTask.cancel()}}function Un(pe,O,k,W,oe,ae){const ce=new We.ae(O,{brightness:k,worldview:oe,activeFloors:ae});for(const me of pe)me.recalculate(ce,W)}class bo extends We.E{constructor({actor:O,layerIndex:k,availableImages:W,availableModels:oe,isSpriteLoaded:ae,tileProvider:ce,brightness:me,maxUniformBufferBindings:he,maxUniformBlockSizeDwords:ge,disableSymbolUBO:Re}){super(),this.actor=O,this.layerIndex=k,this.availableImages=W,this.availableModels=oe,this.loadVectorData=We.aO,this.tileProvider=ce,this.loading={},this.loaded={},this.deduped=new We.aN(O.scheduler),this.isSpriteLoaded=ae,this.scheduler=O.scheduler,this.brightness=me,this.maxUniformBufferBindings=he,this.maxUniformBlockSizeDwords=ge,this.disableSymbolUBO=Re}loadTileData(O,k){if(!this.tileProvider)return this.loadVectorData(O,k);const W=new AbortController,{z:oe,x:ae,y:ce}=O.tileID.canonical;return this.tileProvider.loadTile({z:oe,x:ae,y:ce},{request:O.request,signal:W.signal}).then(me=>{if(W.signal.aborted)return;if(me==null){const ge=new Error("Tile not found");return ge.status=404,k(ge)}if(me.data===null)return k(null,null);const he=new Map;me.expires&&he.set("expires",me.expires),me.cacheControl&&he.set("cache-control",me.cacheControl),k(null,{rawData:me.data,responseHeaders:he})}).catch(me=>{W.signal.aborted||k(me instanceof Error?me:new Error(String(me)))}),()=>W.abort()}loadTile(O,k){const W=O.uid,oe=O&&O.request,ae=oe&&oe.collectResourceTiming,ce=this.loading[W]=new vo(O);ce.maxUniformBufferBindings=this.maxUniformBufferBindings,ce.maxUniformBlockSizeDwords=this.maxUniformBlockSizeDwords,ce.disableSymbolUBO=this.disableSymbolUBO,ce.abort=this.loadTileData(O,(me,he)=>{const ge=!this.loading[W];if(delete this.loading[W],ce.cancelRasterize(),ge||me||!he)return ce.status="done",ge||(this.loaded[W]=ce),k(me);const Re=he.rawData,ze={},Xe=We.aP(he.responseHeaders);Xe&&Xe.expires&&(ze.expires=Xe.expires),Xe&&Xe.cacheControl&&(ze.cacheControl=Xe.cacheControl),ce.vectorTile=he.vectorTile||new We.ft(new We.b0(Re));const ut=()=>{ce.parse(ce.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,(mt,lt)=>{if(mt||!lt)return k(mt);const St={};if(ae){const vt=Oi(oe);vt.length>0&&(St.resourceTiming=JSON.parse(JSON.stringify(vt)))}k(null,Object.assign({rawTileData:Re.slice(0),responseHeaders:he.responseHeaders},lt,ze,St))})};this.isSpriteLoaded?ut():this.once("isSpriteLoaded",()=>{this.scheduler?this.scheduler.add(ut,{type:"parseTile",renderSourceType:O.render
7SourceType,zoom:O.tileZoom}):ut()}),this.loaded=this.loaded||{},this.loaded[W]=ce})}reloadTile(O,k){const W=this.loaded,oe=O.uid;if(W&&W[oe]){const ae=W[oe];ae.updateParameters(O);const ce=(me,he)=>{const ge=ae.reloadCallback;ge&&(delete ae.reloadCallback,ae.parse(ae.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,ge)),k(me,he)};ae.status==="parsing"?ae.reloadCallback=ce:ae.status==="done"&&(ae.vectorTile?ae.parse(ae.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,ce):ce())}else k(null,void 0)}abortTile(O,k){const W=O.uid,oe=this.loading[W];oe&&(oe.abort&&oe.abort(),delete this.loading[W]),k()}removeTile(O,k){const W=this.loaded,oe=O.uid;W&&W[oe]&&delete W[oe],k()}}class Ha{loadTile(O,k){const{uid:W,encoding:oe,rawImageData:ae,padding:ce}=O,me=ImageBitmap&&ae instanceof ImageBitmap?this.getImageData(ae,ce):ae;k(null,new We.fu(W,me,oe,ce<1))}reloadTile(O,k){k(null,null)}abortTile(O,k){k()}removeTile(O,k){k()}getImageData(O,k){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(O.width,O.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d",{willReadFrequently:!0})),this.offscreenCanvas.width=O.width,this.offscreenCanvas.height=O.height,this.offscreenCanvasContext.drawImage(O,0,0,O.width,O.height);const W=this.offscreenCanvasContext.getImageData(-k,-k,O.width+2*k,O.height+2*k);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),W}}We.a$.setPbf(We.b0);class Za{constructor(O){this._mrt=new We.a$(O.partial?30:1/0),this._isHeaderLoaded=!1,this.uid=O.uid,this.tileID=O.tileID,this.source=O.source}parse(O,k){const W=this._mrt;this.status="parsing",this._entireBuffer=O;try{W.parseHeader(O),this._isHeaderLoaded=!0;const oe=[];for(const ae in W.layers){const ce=W.getLayer(ae),me=ce.getDataRange(ce.getBandList()),he=W.createDecodingTask(me),ge=O.slice(me.firstByte,me.lastByte+1),Re=We.a$.performDecoding(ge,he).then(ze=>he.complete(null,ze)).catch(ze=>he.complete(ze,null));oe.push(Re)}Promise.allSettled(oe).then(()=>k(null,W)).catch(ae=>k(ae))}catch(oe){k(oe)}}}class Wa{constructor({actor:O}){this.actor=O,this.loading={},this.loaded={}}loadTile(O,k){const W=O.uid,oe=O.request,ae=this.loading[W]=new Za(O),{cancel:ce}=We.b2(oe,(me,he,ge)=>{const Re=!this.loading[W];if(delete this.loading[W],Re||me||!he)return ae.status="done",Re||(this.loaded[W]=ae),k(me);ae.parse(he,(ze,Xe)=>{if(ze||!Xe)return k(ze);k(null,Xe,ge)}),this.loaded[W]=ae});ae.abort=ce}reloadTile(O,k){k(null,void 0)}abortTile(O,k){const W=O.uid,oe=this.loading[W];oe&&(oe.abort&&oe.abort(),delete this.loading[W]),k()}removeTile(O,k){const W=O.uid;this.loaded[W]&&delete this.loaded[W],k()}decodeRasterArray(O,k){We.a$.performDecoding(O.buffer,O.task).then(W=>k(null,W)).catch(W=>k(W))}}const ei=We.fv.prototype.toGeoJSON;class lc{constructor(O){this._feature=O,this.extent=We.an,this.type=O.type,this.properties=O.tags,"id"in O&&!isNaN(O.id)&&(this.id=parseInt(O.id,10))}loadGeometry(){if(this._feature.type===1){const O=[];for(const k of this._feature.geometry)O.push([new We.P(k[0],k[1])]);return O}{const O=[];for(const k of this._feature.geometry){const W=[];for(const oe of k)W.push(new We.P(oe[0],oe[1]));O.push(W)}return O}}toGeoJSON(O,k,W){return ei.call(this,O,k,W)}}class Jr{constructor(O,k){this.name=O,this.extent=We.an,this.length=k.length,this._jsonFeatures=k}feature(O){return new lc(this._jsonFeatures[O])}}class Bi{constructor(O){this.layers={},this.extent=We.an;for(const k of Object.keys(O))this.layers[k]=new Jr(k,O[k])}}const ri=64/4096;class er{constructor(){this.features=new Map}clear(){this.features.clear()}load(O=[],k){for(const W of O){const oe=W.id;if(oe==null)continue;let ae=this.features.get(oe);ae&&this.updateCache(ae,k),W.geometry?(ae=wo(W),this.updateCache(ae,k),this.features.set(oe,ae)):this.features.delete(oe),this.updateCache(ae,k)}}updateCache(O,k){for(const{canonical:W,uid:oe}of Object.values(k)){const{z:ae,x:ce,y:me}=W;jn(O,Math.pow(2,ae),ce,me)&&delete k[oe]}}getTile(O,k,W){const oe=Math.pow(2,O),ae=[];for(const ce of this.features.values())jn(ce,oe,k,W)&&ae.push(un(ce,oe,k,W));return{features:ae}}getFeatures(){return[...this.features.values()]}}function jn({minX:pe,minY:O,maxX:k,maxY:W},oe,ae,ce){return pe<(ae+1+ri)/oe&&O<(ce+1+ri)/oe&&k>(ae-ri)/oe&&W>(ce-ri)/oe}function wo(pe){const{id:O,geometry:k,properties:W}=pe;if(!k)return;if(k.type==="GeometryCollection")throw new Error("GeometryCollection not supported in dynamic mode.");const{type:oe,coordinates:ae}=k,ce={id:O,type:1,geometry:[],tags:W,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0},me=ce.geometry;if(oe==="Point")Gn(ae,me,ce);else if(oe==="MultiPoint")for(const he of ae)Gn(he,me,ce);else if(oe==="LineString")ce.type=2,Jn(ae,me,ce);else if(oe==="MultiLineString")ce.type=2,yi(ae,me,ce);else if(oe==="Polygon")ce.type=3,yi(ae,me,ce,!0);else{if(oe!=="MultiPolygon")throw new Error("Input data is not a valid GeoJSON object.");ce.type=3;for(const he of ae)yi(he,me,ce,!0)}return ce}function Gn([pe,O],k,W){const oe=We.aH(pe);let ae=We.aL(O);
7ae=ae<0?0:ae>1?1:ae,k.push(oe,ae),W.minX=Math.min(W.minX,oe),W.minY=Math.min(W.minY,ae),W.maxX=Math.max(W.maxX,oe),W.maxY=Math.max(W.maxY,ae)}function Jn(pe,O,k,W=!1,oe=!1){const ae=[];for(const ce of pe)Gn(ce,ae,k);O.push(ae),W&&function(ce,me){let he=0;for(let ge=0,Re=ce.length,ze=Re-2;ge<Re;ze=ge,ge+=2)he+=(ce[ge]-ce[ze])*(ce[ge+1]+ce[ze+1]);if(he>0===me)for(let ge=0,Re=ce.length;ge<Re/2;ge+=2){const ze=ce[ge],Xe=ce[ge+1];ce[ge]=ce[Re-2-ge],ce[ge+1]=ce[Re-1-ge],ce[Re-2-ge]=ze,ce[Re-1-ge]=Xe}}(ae,oe)}function yi(pe,O,k,W=!1){for(let oe=0;oe<pe.length;oe++)Jn(pe[oe],O,k,W,oe===0)}function un(pe,O,k,W){const{id:oe,type:ae,geometry:ce,tags:me}=pe,he=[];if(ae===1)(function(ge,Re,ze,Xe,ut){for(let mt=0;mt<ge.length;mt+=2){const lt=Math.round(We.an*(ge[mt+0]*Re-ze)),St=Math.round(We.an*(ge[mt+1]*Re-Xe));ut.push([lt,St])}})(ce,O,k,W,he);else if(ae===2)for(const ge of ce)cc(ge,O,k,W,he);else if(ae===3)for(const ge of ce)Xa(ge,O,k,W,he);return{id:oe,type:ae,geometry:he,tags:me}}function cc(pe,O,k,W,oe){const ce=We.an+128;let me;for(let he=0;he<pe.length-2;he+=2){let ge=Math.round(We.an*(pe[he+0]*O-k)),Re=Math.round(We.an*(pe[he+1]*O-W)),ze=Math.round(We.an*(pe[he+2]*O-k)),Xe=Math.round(We.an*(pe[he+3]*O-W));const ut=ze-ge,mt=Xe-Re;ge<-128&&ze<-128||(ge<-128?(Re+=Math.round(mt*((-128-ge)/ut)),ge=-128):ze<-128&&(Xe=Re+Math.round(mt*((-128-ge)/ut)),ze=-128),Re<-128&&Xe<-128||(Re<-128?(ge+=Math.round(ut*((-128-Re)/mt)),Re=-128):Xe<-128&&(ze=ge+Math.round(ut*((-128-Re)/mt)),Xe=-128),ge>=ce&&ze>=ce||(ge>=ce?(Re+=Math.round(mt*((ce-ge)/ut)),ge=ce):ze>=ce&&(Xe=Re+Math.round(mt*((ce-ge)/ut)),ze=ce),Re>=ce&&Xe>=ce||(Re>=ce?(ge+=Math.round(ut*((ce-Re)/mt)),Re=ce):Xe>=ce&&(ze=ge+Math.round(ut*((ce-Re)/mt)),Xe=ce),me&&ge===me[me.length-1][0]&&Re===me[me.length-1][1]||(me=[[ge,Re]],oe.push(me)),me.push([ze,Xe])))))}}function Xa(pe,O,k,W,oe){const ae=(k-ri)/O,ce=(W-ri)/O,me=(k+1+ri)/O,he=(W+1+ri)/O;function ge(Xe,ut){let mt=0;return Xe<ae?mt|=1:Xe>me&&(mt|=2),ut<ce?mt|=4:ut>he&&(mt|=8),mt}let Re=[];for(let Xe=1;Xe<=8;Xe*=2){let ut=pe[pe.length-2],mt=pe[pe.length-1],lt=!(ge(ut,mt)&Xe);for(let St=0;St<pe.length;St+=2){const vt=pe[St],Ot=pe[St+1],Si=!(ge(vt,Ot)&Xe);Si!==lt&&(8&Xe?Re.push(ut+(vt-ut)*(he-mt)/(Ot-mt),he):4&Xe?Re.push(ut+(vt-ut)*(ce-mt)/(Ot-mt),ce):2&Xe?Re.push(me,mt+(Ot-mt)*(me-ut)/(vt-ut)):1&Xe&&Re.push(ae,mt+(Ot-mt)*(ae-ut)/(vt-ut))),Si&&Re.push(vt,Ot),ut=vt,mt=Ot,lt=Si}if(!(pe=Re).length||Xe===8)break;Re=[]}const ze=[];for(let Xe=0;Xe<Re.length;Xe+=2)ze.push([Math.round(We.an*(Re[Xe]*O-k)),Math.round(We.an*(Re[Xe+1]*O-W))]);ze.length&&oe.push(ze)}function uc({name:pe,features:O},k){k.writeStringField(1,pe),k.writeVarintField(5,We.an);const W=new Map,oe=new Map,ae={keys:W,values:oe,feature:null};for(const ce of O)ae.feature=ce,k.writeMessage(2,Uo,ae);for(const ce of W.keys())k.writeStringField(3,ce);for(const ce of oe.keys())k.writeMessage(4,Vi,ce)}function Uo(pe,O){const k=pe.feature;k.id!==void 0&&Number.isSafeInteger(+k.id)&&O.writeVarintField(1,+k.id),k.tags&&O.writeMessage(2,xi,pe),O.writeVarintField(3,k.type),O.writeMessage(4,ms,k)}function xi({keys:pe,values:O,feature:k},W){for(const oe of Object.keys(k.tags)){let ae=k.tags[oe];if(ae===null)continue;let ce=pe.get(oe);ce===void 0&&(ce=pe.size,pe.set(oe,ce)),W.writeVarint(ce);const me=typeof ae;me!=="string"&&me!=="boolean"&&me!=="number"&&(ae=JSON.stringify(ae));let he=O.get(ae);he===void 0&&(he=O.size,O.set(ae,he)),W.writeVarint(he)}}function ki(pe,O){return(O<<3)+(7&pe)}function dr(pe){return pe<<1^pe>>31}function ms(pe,O){const{geometry:k,type:W}=pe;let oe=0,ae=0;if(W===1){O.writeVarint(ki(1,k.length));for(const ce of k){const me=ce[0]-oe,he=ce[1]-ae;O.writeVarint(dr(me)),O.writeVarint(dr(he)),oe+=me,ae+=he}}else for(const ce of k){if(ce.length===0)continue;O.writeVarint(ki(1,1));const me=ce.length-(W===3?1:0);for(let he=0;he<me;he++){he===1&&O.writeVarint(ki(2,me-1));const ge=ce[he][0]-oe,Re=ce[he][1]-ae;O.writeVarint(dr(ge)),O.writeVarint(dr(Re)),oe+=ge,ae+=Re}W===3&&O.writeVarint(ki(7,1))}}function Vi(pe,O){const k=typeof pe;
vendor: 15,401 bytes, line 7
7k==="string"?O.writeStringField(1,pe):k==="boolean"?O.writeBooleanField(7,pe):k==="number"&&(pe%1!=0?O.writeDoubleField(3,pe):pe<0?O.writeSVarintField(6,pe):O.writeVarintField(5,pe))}const _s={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:pe=>pe},gs=Math.fround||(To=new Float32Array(1),pe=>(To[0]=+pe,To[0]));var To;class eo{constructor(O){this.options=Object.assign(Object.create(_s),O),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(O){const{log:k,minZoom:W,maxZoom:oe}=this.options;k&&console.time("total time");const ae=`prepare ${O.length} points`;k&&console.time(ae),this.points=O;const ce=[];for(let he=0;he<O.length;he++){const ge=O[he];if(!ge.geometry)continue;const[Re,ze]=ge.geometry.coordinates,Xe=gs(Rr(Re)),ut=gs(ys(ze));ce.push(Xe,ut,1/0,he,-1,1),this.options.reduce&&ce.push(0)}let me=this.trees[oe+1]=this._createTree(ce);k&&console.timeEnd(ae);for(let he=oe;he>=W;he--){const ge=+Date.now();me=this.trees[he]=this._createTree(this._cluster(me,he)),k&&console.log("z%d: %d clusters in %dms",he,me.numItems,+Date.now()-ge)}return k&&console.timeEnd("total time"),this}getClusters(O,k){let W=((O[0]+180)%360+360)%360-180;const oe=Math.max(-90,Math.min(90,O[1]));let ae=O[2]===180?180:((O[2]+180)%360+360)%360-180;const ce=Math.max(-90,Math.min(90,O[3]));if(O[2]-O[0]>=360)W=-180,ae=180;else if(W>ae){const ze=this.getClusters([W,oe,180,ce],k),Xe=this.getClusters([-180,oe,ae,ce],k);return ze.concat(Xe)}const me=this.trees[this._limitZoom(k)],he=me.range(Rr(W),ys(ce),Rr(ae),ys(oe)),ge=me.data,Re=[];for(const ze of he){const Xe=this.stride*ze;Re.push(ge[Xe+5]>1?Xi(ge,Xe,this.clusterProps):this.points[ge[Xe+3]])}return Re}getChildren(O){const k=this._getOriginId(O),W=this._getOriginZoom(O),oe="No cluster with the specified id.",ae=this.trees[W];if(!ae)throw new Error(oe);const ce=ae.data;if(k*this.stride>=ce.length)throw new Error(oe);const me=this.options.radius/(this.options.extent*Math.pow(2,W-1)),he=ae.within(ce[k*this.stride],ce[k*this.stride+1],me),ge=[];for(const Re of he){const ze=Re*this.stride;ce[ze+4]===O&&ge.push(ce[ze+5]>1?Xi(ce,ze,this.clusterProps):this.points[ce[ze+3]])}if(ge.length===0)throw new Error(oe);return ge}getLeaves(O,k,W){const oe=[];return this._appendLeaves(oe,O,k=k||10,W=W||0,0),oe}getTile(O,k,W){const oe=this.trees[this._limitZoom(O)],ae=Math.pow(2,O),{extent:ce,radius:me}=this.options,he=me/ce,ge=(W-he)/ae,Re=(W+1+he)/ae,ze={features:[]};return this._addTileFeatures(oe.range((k-he)/ae,ge,(k+1+he)/ae,Re),oe.data,k,W,ae,ze),k===0&&this._addTileFeatures(oe.range(1-he/ae,ge,1,Re),oe.data,ae,W,ae,ze),k===ae-1&&this._addTileFeatures(oe.range(0,ge,he/ae,Re),oe.data,-1,W,ae,ze),ze.features.length?ze:null}getClusterExpansionZoom(O){let k=this._getOriginZoom(O)-1;for(;k<=this.options.maxZoom;){const W=this.getChildren(O);if(k++,W.length!==1)break;O=W[0].properties.cluster_id}return k}_appendLeaves(O,k,W,oe,ae){const ce=this.getChildren(k);for(const me of ce){const he=me.properties;if(he&&he.cluster?ae+he.point_count<=oe?ae+=he.point_count:ae=this._appendLeaves(O,he.cluster_id,W,oe,ae):ae<oe?ae++:O.push(me),O.length===W)break}return ae}_createTree(O){const k=new We.bJ(O.length/this.stride|0,this.options.nodeSize,Float32Array);for(let W=0;W<O.length;W+=this.stride)k.add(O[W],O[W+1]);return k.finish(),k.data=O,k}_addTileFeatures(O,k,W,oe,ae,ce){for(const me of O){const he=me*this.stride,ge=k[he+5]>1;let Re,ze,Xe;if(ge)Re=hc(k,he,this.clusterProps),ze=k[he],Xe=k[he+1];else{const lt=this.points[k[he+3]];Re=lt.properties;const[St,vt]=lt.geometry.coordinates;ze=Rr(St),Xe=ys(vt)}const ut={type:1,geometry:[[Math.round(this.options.extent*(ze*ae-W)),Math.round(this.options.extent*(Xe*ae-oe))]],tags:Re};let mt;mt=ge||this.options.generateId?k[he+3]:this.points[k[he+3]].id,mt!==void 0&&(ut.id=mt),ce.features.push(ut)}}_limitZoom(O){return Math.max(this.options.minZoom,Math.min(Math.floor(+O),this.options.maxZoom+1))}_cluster(O,k){const{radius:W,extent:oe,reduce:ae,minPoints:ce}=this.options,me=W/(oe*Math.pow(2,k)),he=O.data,ge=[],Re=this.stride;for(let ze=0;ze<he.length;ze+=Re){if(he[ze+2]<=k)continue;he[ze+2]=k;const Xe=he[ze],ut=he[ze+1],mt=O.within(he[ze],he[ze+1],me),lt=he[ze+5];let St=lt;for(const vt of mt){const Ot=vt*Re;he[Ot+2]>k&&(St+=he[Ot+5])}if(St>lt&&St>=ce){let vt,Ot=Xe*lt,Si=ut*lt,Yi=-1;const Di=(ze/Re<<5)+(k+1)+this.points.length;for(const vi of mt){const fi=vi*Re;if(he[fi+2]<=k)continue;he[fi+2]=k;const Ri=he[fi+5];Ot+=he[fi]*Ri,Si+=he[fi+1]*Ri,he[fi+4]=Di,ae&&(vt||(vt=this._map(he,ze,!0),Yi=this.clusterProps.length,this.clusterProps.push(vt)),ae(vt,this._map(he,fi)))}he[ze+4]=Di,ge.push(Ot/St,Si/St,1/0,Di,-1,St),ae&&ge.push(Yi)}else{for(let vt=0;vt<Re;vt++)ge.push(he[ze+vt]);if(St>1)for(const vt of mt){const Ot=vt*Re;if(!(he[Ot+2]<=k)){he[Ot+2]=k;for(let Si=0;Si<Re;Si++)ge.push(he[Ot+Si])}}}}return ge}_getOriginId(O){return O-this.points.length>>5}_getOriginZoom(O){return(O-this.points.length)%32}_map(O,k,W){if(O[k+5]>1){const ce=this.clusterProps[O[k+6]];return W?Object.assign({},ce):ce}const oe=this.points[O[k+3]].properties,ae=this.options.map(oe);return W&&ae===oe?Object.assign({},ae):ae}}function Xi(pe,O,k){return{type:"Feature",id:pe[O+3],properties:hc(pe,O,k),geometry:{type:"Point",coordinates:[(W=pe[O],360*(W-.5)),Ks(pe[O+1])]}};var W}function hc(pe,O,k){const W=pe[O+5],oe=W>=1e4?`${Math.round(W/1e3)}k`:W>=1e3?Math.round(W/100)/10+"k":W,ae=pe[O+6],ce=ae===-1?{}:Object.assign({},k[ae]);return Object.assign(ce,{cluster:!0,cluster_id:pe[O+3],point_count:W,point_count_abbreviated:oe})}function Rr(pe){return pe/360+.5}function ys(pe){const O=Math.sin(pe*Math.PI/180),k=.5-.25*Math.log((1+O)/(1-O))/Math.PI;return k<0?0:k>1?1:k}function Ks(pe){const O=(180-360*pe)*Math.PI/180;return 360*Math.atan(Math.exp(O))/Math.PI-90}function hn(pe,O,k,W){let oe=W;const ae=O+(k-O>>1);let ce,me=k-O;const he=pe[O],ge=pe[O+1],Re=pe[k],ze=pe[k+1];for(let Xe=O+3;Xe<k;Xe+=3){const ut=xs(pe[Xe],pe[Xe+1],he,ge,Re,ze);if(ut>oe)ce=Xe,oe=ut;else if(ut===oe){const mt=Math.abs(Xe-ae);mt<me&&(ce=Xe,me=mt)}}oe>W&&(ce-O>3&&hn(pe,O,ce,W),pe[ce+2]=oe,k-ce>3&&hn(pe,ce,k,W))}function xs(pe,O,k,W,oe,ae){let ce=oe-k,me=ae-W;if(ce!==0||me!==0){const he=((pe-k)*ce+(O-W)*me)/(ce*ce+me*me);he>1?(k=oe,W=ae):he>0&&(k+=ce*he,W+=me*he)}return ce=pe-k,me=O-W,ce*ce+me*me}function br(pe,O,k,W){const oe={id:pe??null,type:O,geometry:k,tags:W,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(O==="Point"||O==="MultiPoint"||O==="LineString")qn(oe,k);else if(O==="Polygon")qn(oe,k[0]);else if(O==="MultiLineString")for(const ae of k)qn(oe,ae);else if(O==="MultiPolygon")for(const ae of k)qn(oe,ae[0]);return oe}function qn(pe,O){for(let k=0;k<O.length;k+=3)pe.minX=Math.min(pe.minX,O[k]),pe.minY=Math.min(pe.minY,O[k+1]),pe.maxX=Math.max(pe.maxX,O[k]),pe.maxY=Math.max(pe.maxY,O[k+1])}function jo(pe,O,k,W){if(!O.geometry)return;const oe=O.geometry.coordinates;if(oe&&oe.length===0)return;const ae=O.geometry.type,ce=Math.pow(k.tolerance/((1<<k.maxZoom)*k.extent),2);let me=[],he=O.id;if(k.promoteId?he=O.properties[k.promoteId]:k.generateId&&(he=W||0),ae==="Point")Ya(oe,me);else if(ae==="MultiPoint")for(const ge of oe)Ya(ge,me);else if(ae==="LineString")Go(oe,me,ce,!1);else if(ae==="MultiLineString"){if(k.lineMetrics){for(const ge of oe)me=[],Go(ge,me,ce,!1),pe.push(br(he,"LineString",me,O.properties));return}kr(oe,me,ce,!1)}else if(ae==="Polygon")kr(oe,me,ce,!0);else{if(ae!=="MultiPolygon"){if(ae==="GeometryCollection"){for(const ge of O.geometry.geometries)jo(pe,{id:he,geometry:ge,properties:O.properties},k,W);return}throw new Error("Input data is not a valid GeoJSON object.")}for(const ge of oe){const Re=[];kr(ge,Re,ce,!0),me.push(Re)}}pe.push(br(he,ae,me,O.properties))}function Ya(pe,O){O.push(Qs(pe[0]),Cn(pe[1]),0)}function Go(pe,O,k,W){let oe,ae,ce=0;for(let he=0;he<pe.length;he++){const ge=Qs(pe[he][0]),Re=Cn(pe[he][1]);O.push(ge,Re,0),he>0&&(ce+=W?(oe*Re-ge*ae)/2:Math.sqrt(Math.pow(ge-oe,2)+Math.pow(Re-ae,2))),oe=ge,ae=Re}const me=O.length-3;O[2]=1,hn(O,0,me,k),O[me+2]=1,O.size=Math.abs(ce),O.start=0,O.end=O.size}function kr(pe,O,k,W){for(let oe=0;oe<pe.length;oe++){const ae=[];Go(pe[oe],ae,k,W),O.push(ae)}}function Qs(pe){return pe/360+.5}function Cn(pe){const O=Math.sin(pe*Math.PI/180),k=.5-.25*Math.log((1+O)/(1-O))/Math.PI;return k<0?0:k>1?1:k}function dn(pe,O,k,W,oe,ae,ce,me){if(W/=O,ae>=(k/=O)&&ce<W)return pe;if(ce<k||ae>=W)return null;const he=[];for(const ge of pe){const Re=ge.geometry;let ze=ge.type;const Xe=oe===0?ge.minX:ge.minY,ut=oe===0?ge.maxX:ge.maxY;if(Xe>=k&&ut<W){he.push(ge);continue}if(ut<k||Xe>=W)continue;let mt=[];if(ze==="Point"||ze==="MultiPoint")Ka(Re,mt,k,W,oe);else if(ze==="LineString")vr(Re,mt,k,W,oe,!1,me.lineMetrics);else if(ze==="MultiLineString")vs(Re,mt,k,W,oe,!1);else if(ze==="Polygon")vs(Re,mt,k,W,oe,!0);else if(ze==="MultiPolygon")for(const lt of Re){const St=[];vs(lt,St,k,W,oe,!0),St.length&&mt.push(St)}if(mt.length){if(me.lineMetrics&&ze==="LineString"){for(const lt of mt)he.push(br(ge.id,ze,lt,ge.tags));continue}ze!=="LineString"&&ze!=="MultiLineString"||(mt.length===1?(ze="LineString",mt=mt[0]):ze="MultiLineString"),ze!=="Point"&&ze!=="MultiPoint"||(ze=mt.length===3?"Point":"MultiPoint"),he.push(br(ge.id,ze,mt,ge.tags))}}return he.length?he:null}function Ka(pe,O,k,W,oe){for(let ae=0;ae<pe.length;ae+=3){const ce=pe[ae+oe];ce>=k&&ce<=W&&en(O,pe[ae],pe[ae+1],pe[ae+2])}}function vr(pe,O,k,W,oe,ae,ce){let me=So(pe);const he=oe===0?Io:bs;let ge,Re,ze=pe.start;for(let St=0;St<pe.length-3;St+=3){const vt=pe[St],Ot=pe[St+1],Si=pe[St+2],Yi=pe[St+3],Di=pe[St+4],vi=oe===0?vt:Ot,fi=oe===0?Yi:Di;let Ri=!1;ce&&(ge=Math.sqrt(Math.pow(vt-Yi,2)+Math.pow(Ot-Di,2))),vi<k?fi>k&&(Re=he(me,vt,Ot,Yi,Di,k),ce&&(me.start=ze+ge*Re)):vi>W?fi<W&&(Re=he(me,vt,Ot,Yi,Di,W),ce&&(me.start=ze+ge*Re)):en(me,vt,Ot,Si),fi<k&&vi>=k&&(Re=he(me,vt,Ot,Yi,Di,k),Ri=!0),fi>W&&vi<=W&&(Re=he(me,vt,Ot,Yi,Di,W),Ri=!0),!ae&&Ri&&(ce&&(me.end=ze+ge*Re),O.push(me),me=So(pe)),ce&&(ze+=ge)}let Xe=pe.length-3;const ut=pe[Xe],mt=pe[Xe+1],lt=oe===0?ut:mt;lt>=k&&lt<=W&&en(me,ut,mt,pe[Xe+2]),Xe=me.length-3,ae&&Xe>=3&&(me[Xe]!==me[0]||me[Xe+1]!==me[1])&&en(me,me[0],me[1],me[2]),me.length&&O.push(me)}function So(pe){const O=[];return O.size=pe.size,O.start=pe.start,O.end=pe.end,O}function vs(pe,O,k,W,oe,ae){for(const ce of pe)vr(ce,O,k,W,oe,ae,!1)}function en(pe,O,k,W){pe.push(O,k,W)}function Io(pe,O,k,W,oe,ae){const ce=(ae-O)/(W-O);return en(pe,ae,k+(oe-k)*ce,1),ce}function bs(pe,O,k,W,oe,ae){const ce=(ae-k)/(oe-k);return en(pe,O+(W-O)*ce,ae,1),ce}function ws(pe,O){const k=[];for(let W=0;W<pe.length;W++){const oe=pe[W],ae=oe.type;let ce;if(ae==="Point"||ae==="MultiPoint"||ae==="LineString")ce=to(oe.geometry,O);else if(ae==="MultiLineString"||ae==="Polygon"){ce=[];for(const me of oe.geometry)ce.push(to(me,O))}else if(ae==="MultiPolygon"){ce=[];for(const me of oe.geometry){const he=[];for(const ge of me)he.push(to(ge,O));ce.push(he)}}k.push(br(oe.id,ae,ce,oe.tags))}return k}function to(pe,O){const k=[];k.size=pe.size,pe.start!==void 0&&(k.start=pe.start,k.end=pe.end);for(let W=0;W<pe.length;W+=3)k.push(pe[W]+O,pe[W+1],pe[W+2]);return k}function qo(pe,O){if(pe.transformed)return pe;const k=1<<pe.z,W=pe.x,oe=pe.y;for(const ae of pe.features){const ce=ae.geometry,me=ae.type;if(ae.geometry=[],me===1)for(let he=0;he<ce.length;he+=2)ae.geometry.push(Ts(ce[he],ce[he+1],O,k,W,oe));else for(let he=0;he<ce.length;he++){const ge=[];for(let Re=0;Re<ce[he].length;Re+=2)ge.push(Ts(ce[he][Re],ce[he][Re+1],O,k,W,oe));ae.geometry.push(ge)}}return pe.transformed=!0,pe}function Ts(pe,O,k,W,oe,ae){return[Math.round(k*(pe*W-oe)),Math.round(k*(O*W-ae))]}function dc(pe,O,k,W,oe){const ae=O===oe.maxZoom?0:oe.tolerance/((1<<O)*oe.extent),ce={features:[],numPoints:0,numSimplified:0,numFeatures:pe.length,source:null,x:k,y:W,z:O,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const me of pe)fc(ce,me,ae,oe);return ce}function fc(pe,O,k,W){const oe=O.geometry,ae=O.type,ce=[];if(pe.minX=Math.min(pe.minX,O.minX),pe.minY=Math.min(pe.minY,O.minY),pe.maxX=Math.max(pe.maxX,O.maxX),pe.maxY=Math.max(pe.maxY,O.maxY),ae==="Point"||ae==="MultiPoint")for(let me=0;me<oe.length;me+=3)ce.push(oe[me],oe[me+1]),pe.numPoints++,pe.numSimplified++;else if(ae==="LineString")$o(ce,oe,pe,k,!1,!1);else if(ae==="MultiLineString"||ae==="Polygon")for(let me=0;me<oe.length;me++)$o(ce,oe[me],pe,k,ae==="Polygon",me===0);else if(ae==="MultiPolygon")for(let me=0;me<oe.length;me++){const he=oe[me];for(let ge=0;ge<he.length;ge++)$o(ce,he[ge],pe,k,!0,ge===0)}if(ce.length){let me=O.tags||null;if(ae==="LineString"&&W.lineMetrics){me={};for(const ge in O.tags)me[ge]=O.tags[ge];me.mapbox_clip_start=oe.start/oe.size,me.mapbox_clip_end=oe.end/oe.size}const he={geometry:ce,type:ae==="Polygon"||ae==="MultiPolygon"?3:ae==="LineString"||ae==="MultiLineString"?2:1,tags:me};O.id!==null&&(he.id=O.id),pe.features.push(he)}}function $o(pe,O,k,W,oe,ae){const ce=W*W;if(W>0&&O.size<(oe?ce:W))return void(k.numPoints+=O.length/3);const me=[];for(let he=0;he<O.length;he+=3)(W===0||O[he+2]>ce)&&(k.numSimplified++,me.push(O[he],O[he+1])),k.numPoints++;oe&&function(he,ge){let Re=0;for(let ze=0,Xe=he.length,ut=Xe-2;ze<Xe;ut=ze,ze+=2)Re+=(he[ze]-he[ut])*(he[ze+1]+he[ut+1]);if(Re>0===ge)for(let ze=0,Xe=he.length;ze<Xe/2;ze+=2){const ut=he[ze],mt=he[ze+1];he[ze]=he[Xe-2-ze],he[ze+1]=he[Xe-1-ze],he[Xe-2-ze]=ut,he[Xe-1-ze]=mt}}(me,ae),pe.push(me)}const pc={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class Qa{constructor(O,k){const W=(k=this.options=function(ae,ce){for(const me in ce)ae[me]=ce[me];return ae}(Object.create(pc),k)).debug;if(W&&console.time("preprocess data"),k.maxZoom<0||k.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(k.promoteId&&k.generateId)throw new Error("promoteId and generateId cannot be used together.");let oe=function(ae,ce){const me=[];if(ae.type==="FeatureCollection")for(let he=0;he<ae.features.length;he++)jo(me,ae.features[he],ce,he);else jo(me,ae.type==="Feature"?ae:{geometry:ae},ce);return me}(O,k);this.tiles={},this.tileCoords=[],W&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",k.indexMaxZoom,k.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),oe=function(ae,ce){const me=ce.buffer/ce.extent;let he=ae;const ge=dn(ae,1,-1-me,me,0,-1,2,ce),Re=dn(ae,1,1-me,2+me,0,-1,2,ce);return(ge||Re)&&(he=dn(ae,1,-me,1+me,0,-1,2,ce)||[],ge&&(he=ws(ge,1).concat(he)),Re&&(he=he.concat(ws(Re,-1)))),he}(oe,k),oe.length&&this.splitTile(oe,0,0,0),W&&(oe.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(O,k,W,oe,ae,ce,me){const he=[O,k,W,oe],ge=this.options,Re=ge.debug;for(;he.length;){oe=he.pop(),W=he.pop(),k=he.pop(),O=he.pop();const ze=1<<k,Xe=Fe(k,W,oe);let ut=this.tiles[Xe];if(!ut&&(Re>1&&console.time("creation"),ut=this.tiles[Xe]=dc(O,k,W,oe,ge),this.tileCoords.push({z:k,x:W,y:oe}),Re)){Re>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",k,W,oe,ut.numFeatures,ut.numPoints,ut.numSimplified),console.timeEnd("creation"));const Ri=`z${k}`;this.stats[Ri]=(this.stats[Ri]||0)+1,this.total++}
7if(ut.source=O,ae==null){if(k===ge.indexMaxZoom||ut.numPoints<=ge.indexMaxPoints)continue}else{if(k===ge.maxZoom||k===ae)continue;if(ae!=null){const Ri=ae-k;if(W!==ce>>Ri||oe!==me>>Ri)continue}}if(ut.source=null,O.length===0)continue;Re>1&&console.time("clipping");const mt=.5*ge.buffer/ge.extent,lt=.5-mt,St=.5+mt,vt=1+mt;let Ot=null,Si=null,Yi=null,Di=null,vi=dn(O,ze,W-mt,W+St,0,ut.minX,ut.maxX,ge),fi=dn(O,ze,W+lt,W+vt,0,ut.minX,ut.maxX,ge);O=null,vi&&(Ot=dn(vi,ze,oe-mt,oe+St,1,ut.minY,ut.maxY,ge),Si=dn(vi,ze,oe+lt,oe+vt,1,ut.minY,ut.maxY,ge),vi=null),fi&&(Yi=dn(fi,ze,oe-mt,oe+St,1,ut.minY,ut.maxY,ge),Di=dn(fi,ze,oe+lt,oe+vt,1,ut.minY,ut.maxY,ge),fi=null),Re>1&&console.timeEnd("clipping"),he.push(Ot||[],k+1,2*W,2*oe),he.push(Si||[],k+1,2*W,2*oe+1),he.push(Yi||[],k+1,2*W+1,2*oe),he.push(Di||[],k+1,2*W+1,2*oe+1)}}getTile(O,k,W){O=+O,k=+k,W=+W;const oe=this.options,{extent:ae,debug:ce}=oe;if(O<0||O>24)return null;const me=1<<O,he=Fe(O,k=k+me&me-1,W);if(this.tiles[he])return qo(this.tiles[he],ae);ce>1&&console.log("drilling down to z%d-%d-%d",O,k,W);let ge,Re=O,ze=k,Xe=W;for(;!ge&&Re>0;)Re--,ze>>=1,Xe>>=1,ge=this.tiles[Fe(Re,ze,Xe)];return ge&&ge.source?(ce>1&&(console.log("found parent tile z%d-%d-%d",Re,ze,Xe),console.time("drilling down")),this.splitTile(ge.source,Re,ze,Xe,O,k,W),ce>1&&console.timeEnd("drilling down"),this.tiles[he]?qo(this.tiles[he],ae):null):null}}function Fe(pe,O,k){return 32*((1<<pe)*k+O)+pe}function di(pe,O){const k=pe.tileID.canonical;if(!this._geoJSONIndex)return void O(null,null);const W=this._geoJSONIndex.getTile(k.z,k.x,k.y);if(!W)return void O(null,null);const oe=ge=>ge.tags&&"3d_elevation_id"in ge.tags&&"source"in ge.tags&&ge.tags.source==="elevation",ae=W.features.filter(ge=>oe(ge));let ce={_geojsonTileLayer:W.features};ae.length>0&&(ce={_geojsonTileLayer:W.features.filter(ge=>!oe(ge)),hd_road_elevation:ae});const me=new Bi(ce),he=function(ge){const Re=new We.b0;for(const ze of Object.keys(ge))Re.writeMessage(3,uc,{name:ze,features:ge[ze]});return Re.finish()}(ce).buffer;O(null,{vectorTile:me,rawData:he})}class zr extends bo{constructor(O){super(O),this.loadVectorData=di,this._dynamicIndex=new er}loadData(O,k){const W=O&&O.request,oe=W&&W.collectResourceTiming;this._geoJSONIndex=null,this.loadGeoJSON(O,(ae,ce)=>{if(ae||!ce)return k(ae);if(typeof ce!="object")return k(new Error(`Input data given to '${O.source}' is not a valid GeoJSON object.`));{try{if(O.filter){const he=We.X(O.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(he.result==="error")throw new Error(he.value.map(ge=>`${ge.key}: ${ge.message}`).join(", "));ce.features=ce.features.filter(ge=>he.value.evaluate({zoom:0},ge))}O.dynamic?(ce.type==="Feature"&&(ce={type:"FeatureCollection",features:[ce]}),O.append||(this._dynamicIndex.clear(),this.loaded={}),this._dynamicIndex.load(ce.features,this.loaded),O.cluster&&(ce.features=this._dynamicIndex.getFeatures())):this.loaded={},this._geoJSONIndex=O.cluster?new eo(function({superclusterOptions:he,clusterProperties:ge}){if(!ge||!he)return he;const Re={},ze={},Xe={accumulated:null,zoom:0},ut={properties:null},mt=Object.keys(ge);for(const lt of mt){const[St,vt]=ge[lt],Ot=We.X(vt),Si=We.X(typeof St=="string"?[St,["accumulated"],["get",lt]]:St);Re[lt]=Ot.value,ze[lt]=Si.value}return he.map=lt=>{ut.properties=lt;const St={};for(const vt of mt)St[vt]=Re[vt].evaluate(Xe,ut);return St},he.reduce=(lt,St)=>{ut.properties=St;for(const vt of mt)Xe.accumulated=lt[vt],lt[vt]=ze[vt].evaluate(Xe,ut)},he}(O)).load(ce.features):O.dynamic?this._dynamicIndex:function(he,ge){return new Qa(he,ge)}(ce,O.geojsonVtOptions)}catch(he){return k(he)}const me={};if(oe){const he=Oi(W);he&&(me.resourceTiming={},me.resourceTiming[O.source]=JSON.parse(JSON.stringify(he)))}k(null,me)}})}reloadTile(O,k){const W=this.loaded;return W&&W[O.uid]?O.partial?k(null,void 0):super.reloadTile(O,k):this.loadTile(O,k)}loadGeoJSON(O,k){if(O.request)We.m(O.request,k);else{if(typeof O.data!="string")return k(new Error(`Input data given to '${O.source}' is not a valid GeoJSON object.`));setTimeout(()=>{try{return k(null,JSON.parse(O.data))}catch{return k(new Error(`Input data given to '${O.source}' is not a valid GeoJSON object.`))}},0)}}getClusterExpansionZoom(O,k){try{k(null,this._geoJSONIndex.getClusterExpansionZoom(O.clusterId))}catch(W){k(W)}}getClusterChildren(O,k){try{k(null,this._geoJSONIndex.getChildren(O.clusterId))}catch(W){k(W)}}getClusterLeaves(O,k){try{k(null,this._geoJSONIndex.getLeaves(O.clusterId,O.limit,O.offset))}catch(W){k(W)}}}class Ja{constructor(O,k,W){this.tileID=new We.aS(O.tileID.overscaledZ,O.tileID.wrap,O.tileID.canonical.z,O.tileID.canonical.x,O.tileID.canonical.y),this.tileZoom=O.tileZoom,this.uid=O.uid,this.zoom=O.zoom,this.canonical=O.tileID.canonical,this.pixelRatio=O.pixelRatio,this.tileSize=O.tileSize,this.source=O.source,this.overscaling=this.tileID.overscaleFactor(),this.projection=O.projection,this.brightness=k,this.worldview=W}parse(O,k,W,oe){this.status="parsing";const ae=new We.aS(W.tileID.overscaledZ,W.tileID.wrap,W.tileID.canonical.z,W.tileID.canonical.x,W.tileID.canonical.y),ce=[],me=k.familiesBySource[W.source],he=new We.fb(ae,W.promoteId);he.bucketLayerIDs=[],he.is3DTile=!0,We.fw(O).then(ge=>{const Re=ge.json.extensionsUsed&&ge.json.extensionsUsed.includes("MAPBOX_mesh_features")||ge.json.asset.extras&&ge.json.asset.extras.MAPBOX_mesh_features,ze=ge.json.extensionsUsed&&ge.json.extensionsUsed.includes("EXT_meshopt_compression"),Xe=new We.ae(this.zoom,{brightness:this.brightness,worldview:this.worldview});for(const ut in me)for(const mt of me[ut]){const lt=mt[0];he.bucketLayerIDs.push(mt.map(Ot=>We.F(Ot.id,Ot.scope))),lt.recalculate(Xe,[]);const St=We.fx(ge,1/We.cO(W.tileID.canonical)),vt=new We.fy(mt,St,ae,Re,ze,this.brightness,he,this.worldview);Re||(vt.needsUpload=!0),ce.push(vt),vt.evaluate(lt)}this.status="done",oe(null,{buckets:ce,featureIndex:he,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:null})}).catch(ge=>oe(new Error(ge.message)))}}class Vt{constructor({actor:O,layerIndex:k,availableImages:W,availableModels:oe,brightness:ae,worldview:ce}){this.actor=O,this.layerIndex=k,this.availableImages=W,this.availableModels=oe,this.brightness=ae,this.loading={},this.loaded={},this.worldview=ce}loadTile(O,k){const W=O.uid,oe=this.loading[W]=new Ja(O,this.brightness,this.worldview);We.b2(O.request,(ae,ce)=>{const me=!this.loading[W];return delete this.loading[W],me||ae?(oe.status="done",me||(this.loaded[W]=oe),k(ae)):ce&&ce.byteLength!==0?void oe.parse(ce,this.layerIndex,O,(he,ge)=>{oe.status="done",this.loaded=this.loaded||{},this.loaded[W]=oe,he||!ge?k(he):k(null,ge)}):(oe.status="done",this.loaded[W]=oe,k())})}reloadTile(O,k){const W=this.loaded,oe=O.uid;if(W&&W[oe]){const ae=W[oe];ae.projection=O.projection,ae.brightness=O.brightness;const ce=(me,he)=>{ae.reloadCallback&&(delete ae.reloadCallback,this.loadTile(O,k)),k(me,he)};ae.status==="parsing"?ae.reloadCallback=ce:ae.status==="done"&&this.loadTile(O,k)}}abortTile(O,k){const W=O.uid;this.loading[W]&&delete this.loading[W],k()}removeTile(O,k){const W=this.loaded,oe=O.uid;W&&W[oe]&&delete W[oe],k()}}const Zi=new Map,mc=new Map;
7class el{constructor(O){this.self=O,this.actor=new We.A(O,this),this.layerIndexes={},this.availableImages={},this.availableModels={},this.isSpriteLoaded={},this.imageRasterizer=new We.z,this.rtlPluginParsingListeners=[],this.projections={},this.defaultProjection=We.c1({name:"mercator"}),this.workerSourceTypes={vector:bo,geojson:zr,"raster-dem":Ha,"raster-array":Wa,"batched-model":Vt},this.workerSources={},this.self.registerWorkerSource=(k,W)=>{if(this.workerSourceTypes[k])throw new Error(`Worker source with name "${k}" already registered.`);this.workerSourceTypes[k]=W},this.self.registerRTLTextPlugin=k=>{if(We.fA.isParsed())throw new Error("RTL text plugin already registered.");We.fA.setState({pluginStatus:We.fB.parsed,pluginURL:We.fA.getPluginURL()}),We.fA.applyArabicShaping=k.applyArabicShaping,We.fA.processBidirectionalText=k.processBidirectionalText,We.fA.processStyledBidirectionalText=k.processStyledBidirectionalText;for(const W of this.rtlPluginParsingListeners)W(null,!0);this.rtlPluginParsingListeners=[]}}clearCaches(O,k,W){delete this.layerIndexes[O],delete this.availableImages[O],delete this.availableModels[O],delete this.workerSources[O],W()}checkIfReady(O,k,W){W()}setReferrer(O,k){this.referrer=k}spriteLoaded(O,k){this.isSpriteLoaded[O]||(this.isSpriteLoaded[O]={});const{scope:W,isLoaded:oe}=k;if(this.isSpriteLoaded[O][W]=oe,this.workerSources[O]&&this.workerSources[O][W])for(const ae in this.workerSources[O][W]){const ce=this.workerSources[O][W][ae];for(const me in ce){const he=ce[me];he instanceof bo&&(he.isSpriteLoaded=oe,he.fire(new We.C("isSpriteLoaded")))}}}setImages(O,k,W){this.availableImages[O]||(this.availableImages[O]={});const{scope:oe,images:ae}=k;if(this.availableImages[O][oe]=ae,this.workerSources[O]&&this.workerSources[O][oe]){for(const ce in this.workerSources[O][oe]){const me=this.workerSources[O][oe][ce];for(const he in me)me[he].availableImages=ae}W()}else W()}setModels(O,{scope:k,models:W},oe){if(this.availableModels[O]||(this.availableModels[O]={}),this.availableModels[O][k]=W,this.workerSources[O]&&this.workerSources[O][k]){for(const ae in this.workerSources[O][k]){const ce=this.workerSources[O][k][ae];for(const me in ce)ce[me].availableModels=W}oe()}else oe()}setProjection(O,k){this.projections[O]=We.c1(k)}setBrightness(O,k,W){this.brightness=k,W()}setContextParams(O,k,W){this.maxUniformBufferBindings=k.maxBindingPoints,this.maxUniformBlockSizeDwords=k.maxUniformBlockSizeDwords,this.disableSymbolUBO=k.disableSymbolUBO,W()}setWorldview(O,k,W){this.worldview=k,W()}setLayers(O,k,W){this.getLayerIndex(O,k.scope).replace(k.layers,k.options),W()}updateLayers(O,k,W){this.getLayerIndex(O,k.scope).update(k.layers,k.removedIds,k.options),W()}loadTile(O,k,W){k.projection=this.projections[O]||this.defaultProjection,this.getWorkerSource(O,k).loadTile(k,W)}decodeRasterArray(O,k,W){this.getWorkerSource(O,k).decodeRasterArray(k,W)}reloadTile(O,k,W){k.projection=this.projections[O]||this.defaultProjection,this.getWorkerSource(O,k).reloadTile(k,W)}abortTile(O,k,W){this.getWorkerSource(O,k).abortTile(k,W)}removeTile(O,k,W){this.getWorkerSource(O,k).removeTile(k,W)}removeSource(O,k,W){if(!(this.workerSources[O]&&this.workerSources[O][k.scope]&&this.workerSources[O][k.scope][k.type]&&this.workerSources[O][k.scope][k.type][k.source]))return;const oe=this.workerSources[O][k.scope][k.type][k.source];delete this.workerSources[O][k.scope][k.type][k.source],oe.removeSource!==void 0?oe.removeSource(k,W):W()}loadTileProvider(O,k,W){(async function(oe,ae){const ce=mc.get(oe);if(ce)return ce;const me=Zi.get(oe);if(me!==void 0)return me;const he=import(ae).then(ge=>{const Re=ge.default;if(typeof Re!="function")throw new Error(`TileProvider "${oe}" module must default-export a class`);if(typeof Re.prototype.loadTile!="function")throw new Error(`TileProvider "${oe}" class must have a loadTile method`);return mc.set(oe,Re),Re}).finally(()=>{Zi.delete(oe)});return Zi.set(oe,he),he})(k.name,k.url).then(oe=>{const ae=new oe(k.options);return this.getWorkerSource(O,{type:k.type,source:k.source,scope:k.scope},ae),ae.load&&k.request?ae.load({request:k.request}):null}).then(oe=>W(null,oe)).catch(oe=>W(oe instanceof Error?oe:new Error(typeof oe=="string"?oe:"Unknown error")))}loadWorkerSource(O,k,W){try{this.self.importScripts(k.url),W()}catch(oe){W(oe)}}syncRTLPluginState(O,k,W){if(We.fA.isParsed())W(null,!0);else if(We.fA.isParsing())this.rtlPluginParsingListeners.push(W);else try{We.fA.setState(k);const oe=We.fA.getPluginURL();!We.fA.isLoaded()||We.fA.isParsed()||We.fA.isParsing()||oe==null||(We.fA.setState({pluginStatus:We.fB.parsing,pluginURL:We.fA.getPluginURL()}),this.self.importScripts(oe),We.fA.isParsed()?W(null,!0):this.rtlPluginParsingListeners.push(W))}catch(oe){W(oe)}}setConfig(O,k){Object.assign(We.e,k)}getAvailableImages(O,k){this.availableImages[O]||(this.availableImages[O]={});let W=this.availableImages[O][k];return W||(W=[]),W}getAvailableModels(O,k){this.availableModels[O]||(this.availableModels[O]={});let W=this.availableModels[O][k];return W||(W={}),W}getLayerIndex(O,k){this.layerIndexes[O]||(this.layerIndexes[O]={});let W=this.layerIndexes[O][k];return W||(W=this.layerIndexes[O][k]=new yo,W.scope=k),W}getWorkerSource(O,k,W){const{type:oe,source:ae,scope:ce}=k,me=this.workerSources;if(me[O]||(me[O]={}),me[O][ce]||(me[O][ce]={}),me[O][ce][oe]||(me[O][ce][oe]={}),this.isSpriteLoaded[O]||(this.isSpriteLoaded[O]={}),!me[O][ce][oe][ae]){const he={send:(Re,ze,Xe,ut,mt,lt)=>this.actor.send(Re,ze,Xe,O,mt,lt),scheduler:this.actor.scheduler},ge=this.workerSourceTypes[oe];if(!ge)throw new Error(`Unknown worker source type "${oe}".`);me[O][ce][oe][ae]=new ge({actor:he,layerIndex:this.getLayerIndex(O,ce),availableImages:this.getAvailableImages(O,ce),availableModels:this.getAvailableModels(O,ce),isSpriteLoaded:this.isSpriteLoaded[O][ce],tileProvider:W,brightness:this.brightness,worldview:this.worldview,maxUniformBufferBindings:this.maxUniformBufferBindings,maxUniformBlockSizeDwords:this.maxUniformBlockSizeDwords,disableSymbolUBO:this.disableSymbolUBO})}return me[O][ce][oe][ae]}rasterizeImagesWorker(O,k,W){const oe=new Map;for(const[ae,{image:ce,imageVariant:me}]of k.tasks.entries()){const he=this.imageRasterizer.rasterize(me,ce,k.scope,O);oe.set(ae,he)}W(void 0,oe)}removeRasterizedImages(O,k,W){this.imageRasterizer.removeImagesFromCacheByIds(k.imageIds,k.scope,O),W()}enforceCacheSizeLimit(O,k){We.fC(k)}getWorkerPerformanceMetrics(O,k,W){W(void 0,void 0)}}return We.fz(self)&&(self.worker=new el(self)),el}),Cm(["./shared"],function(a){var We="3.21.0";const Oi={create:"create",load:"load",fullLoad:"fullLoad"},Vn={mark(l){performance.mark(l)},measure(l,i,o){performance.measure(l,i,o)}};function ac(l){const i=l.name.split("?")[0];return a.a(i)&&i.includes("mapbox-gl.js")?"javascript":a.a(i)&&i.includes("mapbox-gl.css")?"css":a.b(i)?"fontRange":a.c(i)?"sprite":a.i(i)?"style":a.d(i)?"tilejson":"other"}var Ys,yo={},ps=function(){if(Ys)return yo;function l(u){return!i(u)}function i(u){return typeof window>"u"||typeof document>"u"?"not a browser":function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var m,_,y=new Blob([""],{type:"text/javascript"}),v=URL.createObjectURL(y);try{_=new Worker(v),m=!0}catch{m=!1}return _&&_.terminate(),URL.revokeObjectURL(v),m}()?function(){var m=document.createElement("canvas");m.width=m.height=1;var _=m.getContext("2d");if(!_)return!1;var y=_.getImageData(0,0,1,1);return y&&y.width===m.width}()?(o[d=u&&u.failIfMajorPerformanceCaveat]===void 0&&(o[d]=function(m){var _,y=function(v){var T=document.createElement("canvas"),I=Object.create(l.webGLContextAttributes);return I.failIfMajorPerformanceCaveat=v,T.getContext("webgl2",I)}(m);if(!y)return!1;try{_=y.createShader(y.VERTEX_SHADER)}catch{return!1}return!(!_||y.isContextLost())&&(y.shaderSource(_,"void main() {}"),y.compileShader(_),y.getShaderParameter(_,y.COMPILE_STATUS)===!0)}(d)),o[d]?document.documentMode?"insufficient ECMAScript 6 support":void 0:"insufficient WebGL2 support"):"insufficient Canvas/getImageData support":"insufficient worker support";var d}Ys=1,yo.supported=l,yo.notSupportedReason=i;var o={};return l.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0},yo}();function Jt(l,i,o){const u=document.createElement(l);return i!=null&&(u.className=i),o&&o.appendChild(u),u}function Ei(l,i,o){const u=document.createElementNS("http://www.w3.org/2000/svg",l);for(const d of Object.keys(i))u.setAttributeNS(null,d,String(i[d]));return o&&o.appendChild(u),u}const An=typeof document<"u"?document.documentElement&&document.documentElement.style:null,Ti=An&&An.userSelect!==void 0?"userSelect":"WebkitUserSelect";let Qr;function Mr(){An&&Ti&&(Qr=An[Ti],An[Ti]="none")}function xo(){An&&Ti&&(An[Ti]=Qr)}function Nn(l){l.preventDefault(),l.stopPropagation(),window.removeEventListener("click",Nn,!0)}function vo(){window.addEventListener("click",Nn,!0),window.setTimeout(()=>{window.removeEventListener("click",Nn,!0)},0)}function Un(l,i){const o=l.getBoundingClientRect();return Za(l,o,i)}function bo(l,i){const o=l.getBoundingClientRect(),u=[];for(let d=0;d<i.length;d++)u.push(Za(l,o,i[d]));return u}function Ha(l){return/firefox/i.test(navigator.userAgent)&&/macintosh/i.test(navigator.userAgent)&&l.button===2&&l.ctrlKey?0:l.button}function Za(l,i,o){const u=l.offsetWidth===i.width?1:l.offsetWidth/i.width;return new a.P((o.clientX-i.left)*u,(o.clientY-i.top)*u)}const Wa="01",ei="NO_ACCESS_TOKEN";class lc{constructor(i,o,u){this._transformRequestFn=i,this._customAccessToken=o,this._silenceAuthErrors=!!u,this._createSkuToken()}_createSkuToken(){const i=function(){let o="";for(let u=0;u<10;u++)o+="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[Math.floor(62*Math.random())];return{token:["1",Wa,o].join(""),tokenExpiresAt:Date.now()+432e5}}();this._skuToken=i.token,this._skuTokenExpiresAt=i.tokenExpiresAt}_isSkuTokenExpired(){return Date.now()>this._skuTokenExpiresAt}transformRequest(i,o){return this._transformRequestFn&&this._transformRequestFn(i,o)||{url:i}}normalizeStyleURL(i,o){if(!a.h(i))return i;const u=Bi(i);return u.params.push(`sdk=js-${We}`),u.path=`/styles/v1${u.path}`,this._makeAPIURL(u,this._customAccessToken||o)}normalizeGlyphsURL(i,o){if(!a.h(i))return i;const u=Bi(i);return u.path=`/fonts/v1${u.path}`,this._makeAPIURL(u,this._customAccessToken||o)}normalizeModelURL(i,o){if(!a.h(i))return i;const u=Bi(i);return u.path=`/models/v1${u.path}`,this._makeAPIURL(u,this._customAccessToken||o)}normalizeSourceURL(i,o,u,d){if(!a.h(i))return i;
7const m=Bi(i);return m.path=`/v4/${m.authority}.json`,m.params.push("secure"),u&&m.params.push(`language=${u}`),d&&m.params.push(`worldview=${d}`),this._makeAPIURL(m,this._customAccessToken||o)}normalizeIconsetURL(i,o){const u=Bi(i);return a.h(i)?(u.path=`/styles/v1${u.path}/iconset.pbf`,this._makeAPIURL(u,this._customAccessToken||o)):ri(u)}normalizeSpriteURL(i,o,u,d){const m=Bi(i);return a.h(i)?(m.path=`/styles/v1${m.path}/sprite${o}${u}`,this._makeAPIURL(m,this._customAccessToken||d)):(m.path+=`${o}${u}`,ri(m))}normalizeTileURL(i,o,u){if(this._isSkuTokenExpired()&&this._createSkuToken(),i&&!a.h(i))return i;const d=Bi(i);d.path=d.path.replace(/(\.(png|jpg)\d*)(?=$)/,`${o||u&&d.authority!=="raster"&&u===512?"@2x":""}${a.k.supported?".webp":"$1"}`),d.authority==="raster"?d.path=`/${a.e.RASTER_URL_PREFIX}${d.path}`:d.authority==="rasterarrays"?d.path=`/${a.e.RASTERARRAYS_URL_PREFIX}${d.path}`:d.authority==="3dtiles"?d.path=`/${a.e.TILES3D_URL_PREFIX}${d.path}`:(d.path=d.path.replace(/^.+\/v4\//,"/"),d.path=`/${a.e.TILE_URL_VERSION}${d.path}`);const m=this._customAccessToken||function(_){for(const y of _){const v=y.match(/^access_token=(.*)$/);if(v)return v[1]}return null}(d.params)||a.e.ACCESS_TOKEN;return a.e.REQUIRE_ACCESS_TOKEN&&m&&this._skuToken&&d.params.push(`sku=${this._skuToken}`),this._makeAPIURL(d,m)}canonicalizeTileURL(i,o){const u=Bi(i);if(!u.path.match(/^(\/v4\/|\/(raster|rasterarrays)\/v1\/)/)||!u.path.match(/\.[\w]+$/))return i;let d="mapbox://";u.path.match(/^\/raster\/v1\//)?d+=`raster/${u.path.replace(`/${a.e.RASTER_URL_PREFIX}/`,"")}`:u.path.match(/^\/rasterarrays\/v1\//)?d+=`rasterarrays/${u.path.replace(`/${a.e.RASTERARRAYS_URL_PREFIX}/`,"")}`:d+=`tiles/${u.path.replace(`/${a.e.TILE_URL_VERSION}/`,"")}`;let m=u.params;return o&&(m=m.filter(_=>!_.match(/^access_token=/))),m.length&&(d+=`?${m.join("&")}`),d}canonicalizeTileset(i,o){const u=!!o&&a.h(o),d=[];for(const m of i.tiles||[])a.j(m)?d.push(this.canonicalizeTileURL(m,u)):d.push(m);return d}_makeAPIURL(i,o){const u="See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes",d=Bi(a.e.API_URL);if(i.protocol=d.protocol,i.authority=d.authority,i.protocol==="http"){const m=i.params.indexOf("secure");m>=0&&i.params.splice(m,1)}if(d.path!=="/"&&(i.path=`${d.path}${i.path}`),!a.e.REQUIRE_ACCESS_TOKEN)return ri(i);if(o=o||a.e.ACCESS_TOKEN,!this._silenceAuthErrors){if(!o)throw new Error(`An API access token is required to use Mapbox GL. ${u}`);if(o[0]==="s")throw new Error(`Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). ${u}`)}return i.params=i.params.filter(m=>m.indexOf("access_token")===-1),i.params.push(`access_token=${o||""}`),ri(i)}}const Jr=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function Bi(l){const i=l.match(Jr);if(!i)throw new Error("Unable to parse URL object");return{protocol:i[1],authority:i[2],path:i[3]||"/",params:i[4]?i[4].split("&"):[]}}function ri(l){const i=l.params.length?`?${l.params.join("&")}`:"";return`${l.protocol}://${l.authority}${l.path}${i}`}const er="mapbox.eventData";function jn(l){if(!l)return null;const i=l.split(".");if(!i||i.length!==3)return null;try{return JSON.parse(a.l(i[1]))}catch{return null}}class wo{constructor(i){this.type=i,this.anonId=null,this.anonIdTimestamp=null,this.eventData={},this.queue=[],this.pendingRequest=null}getStorageKey(i){const o=jn(a.e.ACCESS_TOKEN);let u="";return u=o&&o.u?a.f(o.u):a.e.ACCESS_TOKEN||"",i?`${er}.${i}:${u}`:`${er}:${u}`}fetchEventData(){const i=a.s("localStorage"),o=this.getStorageKey(),u=this.getStorageKey("uuid"),d=this.getStorageKey("uuidTimestamp");if(i)try{const m=localStorage.getItem(o);m&&(this.eventData=JSON.parse(m));const _=localStorage.getItem(u);_&&(this.anonId=_);const y=localStorage.getItem(d);y&&(this.anonIdTimestamp=Number(y));const v=Date.now()-864e5;(!this.anonIdTimestamp||this.anonIdTimestamp<v)&&this.refreshUUID()}catch{a.w("Unable to read from LocalStorage")}}refreshUUID(){this.anonId=a.u(),this.anonIdTimestamp=Date.now()}saveEventData(){const i=a.s("localStorage"),o=this.getStorageKey(),u=this.getStorageKey("uuid"),d=this.getStorageKey("uuidTimestamp"),m=this.anonId,_=this.anonIdTimestamp;if(i&&m)try{localStorage.setItem(u,m),Object.keys(this.eventData).length>=1&&localStorage.setItem(o,JSON.stringify(this.eventData)),_&&localStorage.setItem(d,_.toString())}catch{a.w("Unable to write to LocalStorage")}}processRequests(i){}postEvent(i,o,u,d){if(!a.e.EVENTS_URL)return;
7const m=Bi(a.e.EVENTS_URL);m.params.push(`access_token=${d||a.e.ACCESS_TOKEN||""}`);const _={event:this.type,created:new Date(i).toISOString()},y=o?Object.assign(_,o):_,v={url:ri(m),headers:{"Content-Type":"text/plain"},body:JSON.stringify([y])};this.pendingRequest=a.p(v,T=>{this.pendingRequest=null,u(T),this.saveEventData(),this.processRequests(d)})}queueRequest(i,o){this.queue.push(i),this.processRequests(o)}}class Gn extends wo{constructor(i){super("metrics"),i&&(this.data=i)}postMetricsEvent(i){if(!a.e.EVENTS_URL||!i&&!a.e.ACCESS_TOKEN)return;this.anonId||this.fetchEventData(),a.v(this.anonId)||this.refreshUUID();const o=Object.assign({},this.data,{sessionId:this.anonId});this.queueRequest({timestamp:Date.now(),payload:o},i)}processRequests(i){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:o,payload:u}=this.queue.shift();this.postEvent(o,u,()=>{},i)}}const Jn=new class extends wo{constructor(l){super("appUserTurnstile"),this._customAccessToken=l}postTurnstileEvent(l,i){a.e.EVENTS_URL&&a.e.ACCESS_TOKEN&&Array.isArray(l)&&l.some(o=>a.h(o)||a.j(o))&&this.queueRequest(Date.now(),i)}processRequests(l){if(this.pendingRequest||this.queue.length===0)return;this.anonId&&this.anonIdTimestamp&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();const i=jn(a.e.ACCESS_TOKEN),o=i?i.u:a.e.ACCESS_TOKEN;let u=o!==this.eventData.tokenU;a.v(this.anonId)||(this.refreshUUID(),u=!0);const d=this.queue.shift();if(this.eventData.lastSuccess){const m=new Date(this.eventData.lastSuccess),_=new Date(d),y=(d-this.eventData.lastSuccess)/864e5;u=u||y>=1||y<-1||m.getDate()!==_.getDate()}else u=!0;u?this.postEvent(d,{sdkIdentifier:"mapbox-gl-js",sdkVersion:We,skuId:Wa,"enabled.telemetry":!1,userId:this.anonId},m=>{m||(this.eventData.lastSuccess=d,this.eventData.tokenU=o)},l):this.processRequests()}},yi=Jn.postTurnstileEvent.bind(Jn),un=new class extends wo{constructor(){super("map.load"),this.success={},this.skuToken=""}postMapLoadEvent(l,i,o,u){this.skuToken=i,this.errorCb=u,a.e.EVENTS_URL&&(o||a.e.ACCESS_TOKEN?this.queueRequest({id:l,timestamp:Date.now()},o):this.errorCb(new Error(ei)))}processRequests(l){if(this.pendingRequest||this.queue.length===0)return;const{id:i,timestamp:o}=this.queue.shift();i&&this.success[i]||(this.anonId&&this.anonIdTimestamp||this.fetchEventData(),a.v(this.anonId)||this.refreshUUID(),this.postEvent(o,{sdkIdentifier:"mapbox-gl-js",sdkVersion:We,skuId:Wa,skuToken:this.skuToken,userId:this.anonId},u=>{u?this.errorCb(u):i&&(this.success[i]=!0)},l))}remove(){this.errorCb=null}},cc=un.postMapLoadEvent.bind(un),Xa=new class extends wo{constructor(){super("style.load"),this.eventIdPerMapInstanceMap=new Map,this.mapInstanceIdMap=new WeakMap}getMapInstanceId(l){let i=this.mapInstanceIdMap.get(l);return i||(i=a.u(),this.mapInstanceIdMap.set(l,i)),i}getEventId(l){const i=this.eventIdPerMapInstanceMap.get(l)||0;return this.eventIdPerMapInstanceMap.set(l,i+1),i}postStyleLoadEvent(l,i){const{map:o,style:u,importedStyles:d}=i;if(!a.e.EVENTS_URL||!l&&!a.e.ACCESS_TOKEN)return;const m=this.getMapInstanceId(o),_={mapInstanceId:m,eventId:this.getEventId(m),style:u};d.length&&(_.importedStyles=d),this.queueRequest({timestamp:Date.now(),payload:_},l)}processRequests(l){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:i,payload:o}=this.queue.shift();this.postEvent(i,o,()=>{},l)}},uc=Xa.postStyleLoadEvent.bind(Xa),Uo=new Gn({attributes:[{name:"maps/js/layer-animations/style-with-appearances"}]}),xi=Uo.postMetricsEvent.bind(Uo),ki=new Gn({attributes:[{name:"maps/js/layer-animations/runtime-appearances"}]}),dr=ki.postMetricsEvent.bind(ki),ms=new class extends wo{constructor(){super("gljs.performance")}postPerformanceEvent(l,i){a.e.EVENTS_URL&&(l||a.e.ACCESS_TOKEN)&&this.queueRequest({timestamp:Date.now(),performanceData:i},l)}processRequests(l){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:i,performanceData:o}=this.queue.shift(),u=function(d){const m=performance.getEntriesByType("resource"),_=performance.getEntriesByType("mark"),y=function(D){const F={};if(D){for(const z in D)if(z!=="other")for(const V of D[z]){const N=`${z}ResolveRangeMin`,$=`${z}ResolveRangeMax`,H=`${z}RequestCount`,j=`${z}RequestCachedCount`;F[N]=Math.min(F[N]||1/0,V.startTime),F[$]=Math.max(F[$]||-1/0,V.responseEnd);const ne=Y=>{F[Y]===void 0&&(F[Y]=0),++F[Y]};V.transferSize!==void 0&&V.transferSize===0&&ne(j),ne(H)}}return F}(function(D,F){const z={};if(D)for(const V of D){const N=F(V);z[N]===void 0&&(z[N]=[]),z[N].push(V)}return z}(m,ac)),v=window.devicePixelRatio,T=navigator.connection||navigator.mozConnection||navigator.webkitConnection,I=T?T.effectiveType:void 0,M={counters:[],metadata:[],attributes:[]},C=(D,F,z)=>{z!=null&&D.push({name:F,value:z.toString()})};for(const D in y)C(M.counters,D,y[D]);if(d.interactionRange[0]!==1/0&&d.interactionRange[1]!==-1/0&&(C(M.counters,"interactionRangeMin",d.interactionRange[0]),C(M.counters,"interactionRangeMax",d.interactionRange[1])),_)for(const D of Object.values(Oi)){const F=_.find(z=>z.name===D);F&&C(M.counters,D,F.startTime)}
7return C(M.counters,"visibilityHidden",d.visibilityHidden),C(M.attributes,"style",function(D){if(D)for(const F of D){const z=F.name.split("?")[0];if(a.i(z)){const V=z.split("/").slice(-2);if(V.length===2)return`mapbox://styles/${V[0]}/${V[1]}`}}}(m)),C(M.attributes,"terrainEnabled",d.terrainEnabled?"true":"false"),C(M.attributes,"fogEnabled",d.fogEnabled?"true":"false"),C(M.attributes,"projection",d.projection),C(M.attributes,"zoom",d.zoom),C(M.metadata,"devicePixelRatio",v),C(M.metadata,"connectionEffectiveType",I),C(M.metadata,"navigatorUserAgent",navigator.userAgent),C(M.metadata,"screenWidth",window.screen.width),C(M.metadata,"screenHeight",window.screen.height),C(M.metadata,"windowWidth",window.innerWidth),C(M.metadata,"windowHeight",window.innerHeight),C(M.metadata,"mapWidth",d.width/v),C(M.metadata,"mapHeight",d.height/v),C(M.metadata,"webglRenderer",d.renderer),C(M.metadata,"webglVendor",d.vendor),C(M.metadata,"sdkVersion",We),C(M.metadata,"sdkIdentifier","mapbox-gl-js"),M}(o);for(const d of u.metadata);for(const d of u.counters);for(const d of u.attributes);this.postEvent(i,u,()=>{},l)}},Vi=ms.postPerformanceEvent.bind(ms),_s=new class extends wo{constructor(){super("map.auth"),this.success={},this.skuToken=""}getSession(l,i,o,u){if(!a.e.API_URL||!a.e.SESSION_PATH)return;const d=Bi(a.e.API_URL+a.e.SESSION_PATH);d.params.push(`sku=${i||""}`),d.params.push(`access_token=${u||a.e.ACCESS_TOKEN||""}`);const m={url:ri(d),headers:{"Content-Type":"text/plain"}};this.pendingRequest=a.g(m,_=>{this.pendingRequest=null,o(_),this.saveEventData(),this.processRequests(u)})}getSessionAPI(l,i,o,u){this.skuToken=i,this.errorCb=u,a.e.SESSION_PATH&&a.e.API_URL&&(o||a.e.ACCESS_TOKEN?this.queueRequest({id:l,timestamp:Date.now()},o):this.errorCb(new Error(ei)))}processRequests(l){if(this.pendingRequest||this.queue.length===0)return;const{id:i,timestamp:o}=this.queue.shift();i&&this.success[i]||this.getSession(o,this.skuToken,u=>{u?this.errorCb(u):i&&(this.success[i]=!0)},l)}remove(){this.errorCb=null}},gs=_s.getSessionAPI.bind(_s),To=new Set;function eo(l,i){i?To.add(l):To.delete(l)}class Xi{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(i,o){this._updatedSourceCaches[i]=o,this.setDirty()}discardSourceCacheUpdate(i){delete this._updatedSourceCaches[i]}updateLayer(i){const o=i.scope;this._updatedLayers[o]=this._updatedLayers[o]||new Set,this._updatedLayers[o].add(i.id),this.setDirty()}removeLayer(i){const o=i.scope;this._removedLayers[o]=this._removedLayers[o]||{},this._updatedLayers[o]=this._updatedLayers[o]||new Set,this._removedLayers[o][i.id]=i,this._updatedLayers[o].delete(i.id),this._updatedPaintProps.delete(i.fqid),this.setDirty()}getRemovedLayer(i){return this._removedLayers[i.scope]?this._removedLayers[i.scope][i.id]:null}discardLayerRemoval(i){this._removedLayers[i.scope]&&delete this._removedLayers[i.scope][i.id]}getLayerUpdatesByScope(){const i={};for(const o in this._updatedLayers)i[o]=i[o]||{},i[o].updatedIds=Array.from(this._updatedLayers[o].values());for(const o in this._removedLayers)i[o]=i[o]||{},i[o].removedIds=Object.keys(this._removedLayers[o]);return i}getUpdatedPaintProperties(){return this._updatedPaintProps}updatePaintProperties(i){this._updatedPaintProps.add(i.fqid),this.setDirty()}getUpdatedImages(i){return this._updatedImages[i]?Array.from(this._updatedImages[i].values()):[]}updateImage(i,o){this._updatedImages[o]=this._updatedImages[o]||new Set,this._updatedImages[o].add(a.I.toString(i)),this.setDirty()}resetUpdatedImages(i){this._updatedImages[i]&&this._updatedImages[i].clear()}reset(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSourceCaches={},this._updatedPaintProps.clear(),this._updatedImages={}}}function hc(l){const{userImage:i}=l;return!!(i&&i.render&&i.render())&&(l.data.replace(new Uint8Array(i.data.buffer)),!0)}const Rr={workerUrl:"",workerClass:null,workerParams:void 0};function ys(l){return Rr.workerClass!=null?new Rr.workerClass:new self.Worker(Rr.workerUrl,Object.assign({name:l},Rr.workerParams))}const Ks="mapboxgl_preloaded_worker_pool";class hn{constructor(i){this.active={},this.name=i}acquire(i,o=hn.workerCount){if(!this.workers)for(this.workers=[];this.workers.length<o;){const u=ys(`${this.name||""}WorkerPool: ${i}-${this.workers.length}`);this.workers.push(u)}return this.active[i]=!0,this.workers.slice()}release(i){delete this.active[i],this.workers&&this.numActive()===0&&(this.workers.forEac
vendor: 8,928 bytes, line 7
7h(o=>{o.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[Ks]}numActive(){return Object.keys(this.active).length}}hn.workerCount=2;class xs{constructor(i,o,u="Worker",d=hn.workerCount){this.workerPool=i,this.actors=[],this.currentActor=0,this.id=a.r();const m=this.workerPool.acquire(this.id,d);for(let _=0;_<m.length;_++){const y=new xs.Actor(m[_],o,this.id);y.name=`${u} ${_}`,this.actors.push(y)}this.ready=!1,this.broadcast("checkIfReady",null,()=>{this.ready=!0})}broadcast(i,o,u){a.t(this.actors,(d,m)=>{d.send(i,o,m)},u=u||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(){this.actors.forEach(i=>{i.remove()}),this.actors=[],this.workerPool.release(this.id)}}let br,qn;function jo(){return br||(br=new hn),br}xs.Actor=a.A;class Ya extends a.E{constructor(i){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 a.x,this.dirty=!0,this.spriteFormat=i,i!=="raster"&&a.y()&&(this.imageRasterizerDispatcher=new xs((qn||(qn=new hn("ImageRasterizer")),qn),this,"Image Rasterizer Worker",1))}addScope(i){this.loaded.set(i,!1),this.imageProviders.set(i,new Map),this.images.set(i,new Map),this.updatedImages.set(i,new Set),this.callbackDispatchedThisFrame.set(i,new Set),this.imageVersions.set(i,new Map),this.patterns.set(i,new Map),this.atlasImage.set(i,new a.q({width:1,height:1}))}removeScope(i){this.loaded.delete(i),this.imageProviders.delete(i),this.images.delete(i),this.updatedImages.delete(i),this.callbackDispatchedThisFrame.delete(i),this.imageVersions.delete(i),this.patterns.delete(i),this.atlasImage.delete(i);const o=this.atlasTexture.get(i);o&&(o.destroy(),this.atlasTexture.delete(i))}addImageProvider(i,o){this.imageProviders.has(o)||this.imageProviders.set(o,new Map),this.imageProviders.get(o).set(i.id,i)}removeImageProvider(i,o){this.imageProviders.has(o)&&this.imageProviders.get(o).delete(i)}getPendingImageProviders(){const i=[];for(const o of this.imageProviders.values())for(const u of o.values())u.hasPendingRequests()&&i.push(u);return i}get imageRasterizer(){return this._imageRasterizer||(this._imageRasterizer=new a.z),this._imageRasterizer}isLoaded(){for(const i of this.loaded.keys())if(!this.loaded.get(i))return!1;return!0}setLoaded(i,o){if(this.loaded.get(o)!==i&&(this.loaded.set(o,i),i)){for(const{ids:u,callback:d}of this.requestors)this._notify(u,o,d);this.requestors=[]}}hasImage(i,o){return!!this.getImage(i,o)}getImage(i,o){return this.images.get(o).get(i.toString())}addImage(i,o,u){if(this._validate(i,u)){this.images.get(o).set(i.toString(),u);const d=this.imageVersions.get(o),m=d.get(i.toString())||0;d.set(i.toString(),m+1)}}_validate(i,o){let u=!0;return this._validateStretch(o.stretchX,o.data&&o.data.width)||(this.fire(new a.B(new Error(`Image "${i.name}" has invalid "stretchX" value`))),u=!1),this._validateStretch(o.stretchY,o.data&&o.data.height)||(this.fire(new a.B(new Error(`Image "${i.name}" has invalid "stretchY" value`))),u=!1),this._validateContent(o.content,o)||(this.fire(new a.B(new Error(`Image "${i.name}" has invalid "content" value`))),u=!1),u}_validateStretch(i,o){if(!i)return!0;let u=0;for(const d of i){if(d[0]<u||d[1]<d[0]||o<d[1])return!1;u=d[1]}return!0}_validateContent(i,o){return i?i.length!==4||!o.usvg&&(i[0]<0||o.data.width<i[0]||i[1]<0||o.data.height<i[1]||i[2]<0||o.data.width<i[2]||i[3]<0||o.data.height<i[3])?!1:!(i[2]<i[0]||i[3]<i[1]):!0}updateImage(i,o,u){const d=this.images.get(o).get(i.toString());u.version=d.version+1,this.images.get(o).set(i.toString(),u),this.updatedImages.get(o).add(i);const m=this.imageVersions.get(o),_=m.get(i.toString())||0;m.set(i.toString(),_+1),this.removeFromImageRasterizerCache(i,o)}clearUpdatedImages(i){this.updatedImages.get(i).clear()}removeFromImageRasterizerCache(i,o){this.spriteFormat!=="raster"&&(a.y()?this.imageRasterizerDispatcher.getActor().send("removeRasterizedImages",{imageIds:[i],scope:o}):this.imageRasterizer.removeImagesFromCacheByIds([i],o))}removeImage(i,o){const u=this.images.get(o),d=u.get(i.toString());u.delete(i.toString());const m=this.imageVersions.get(o),_=m.get(i.toString())||0;m.set(i.toString(),_+1),this.patterns.get(o).delete(i.toString()),this.removeFromImageRasterizerCache(i,o),d.userImage&&d.userImage.onRemove&&d.userImage.onRemove()}listImages(i){return Array.from(this.images.get(i).keys()).map(o=>a.I.from(o))}getImageVersions(i){const o=this.imageVersions.get(i);if(o)return o}getImages(i,o,u){const d=[],m=[],_=this.imageProviders.get(o);for(const I of i){if(!I.iconsetId){d.push(I);continue}const M=_.get(I.iconsetId);M&&(this.getImage(I,o)?m.push(I):M.addPendingRequest(I))}if(d.length===0)return void this._notify(m,o,u);let y=!0;const v=!!this.loaded.get(o),T=this.images.get(o);if(!v)for(const I of d)T.has(I.toString())||(y=!1);v||y?this._notify(d,o,u):this.requestors.push({ids:d,scope:o,callback:u})}rasterizeImages(i,o){const u=new Map,{tasks:d,scope:m}=i;for(const[_,y]of d.entries()){const v=this.getImage(y.id,m);v&&u.set(_,{image:v,imageVariant:y})}this._rasterizeImages(m,u,o)}_rasterizeImages(i,o,u){if(a.y())this.imageRasterizerDispatcher.getActor().send("rasterizeImagesWorker",{tasks:o,scope:i},u);else{const d=new Map;for(const[m,{image:_,imageVariant:y}]of o.entries())d.set(m,this.imageRasterizer.rasterize(y,_,i,0));u(void 0,d)}}getUpdatedImages(i){return this.updatedImages.get(i)||new Set}_notify(i,o,u){const d=this.images.get(o),m=new Map;for(const _ of i){if(!d.get(_.toString())){if(_.iconsetId)continue;this.fire(new a.C("styleimagemissing",{id:_.name}))}const y=d.get(_.toString());if(!y){a.w(`Image "${_.name}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`);continue}const v={data:y.usvg?null:y.data.clone(),pixelRatio:y.pixelRatio,sdf:y.sdf,usvg:y.usvg,stretchX:y.stretchX,stretchY:y.stretchY,content:y.content,hasRenderCallback:!!(y.userImage&&y.userImage.render)};y.usvg&&Object.assign(v,{width:y.icon.usvg_tree.width,height:y.icon.usvg_tree.height}),m.set(a.I.toString(_),v)}u(null,{images:m,versions:this.getImageVersions(o)})}getPixelSize(i){const{width:o,height:u}=this.atlasImage.get(i);return{width:o,height:u}}getPattern(i,o,u){const d=i.toString(),m=this.patterns.get(o),_=m.get(d),y=this.getImage(i,o);if(!y)return null;if(_){if(_.position.version===y.version)return _.position;_.position.version=y.version}else{if(y.usvg&&!y.data){const v=this.getPatternInFlightId(d,o);if(this.patternsInFlight.has(v))return null;this.patternsInFlight.add(v);const T=new a.D(i).scaleSelf(a.o.devicePixelRatio),I=new Map([[T.toString(),{image:y,imageVariant:T}]]);return this._rasterizeImages(o,I,(M,C)=>this.storePatternImage(T,o,y,u,C)),null}this.storePattern(i,o,y)}return this._updatePatternAtlas(o,u),m.get(d).position}getPatternInFlightId(i,o){return a.F(i,o)}hasPatternsInFlight(){return this.patternsInFlight.size!==0}storePatternImage(i,o,u,d,m){const _=i.toString(),y=m?m.get(_):void 0;y&&(u.data=y,this.storePattern(i.id,o,u),this._updatePatternAtlas(o,d),this.patternsInFlight.delete(this.getPatternInFlightId(i.id.toString(),o)))}storePattern(i,o,u){const d={w:u.data.width+2*a.G,h:u.data.height+2*a.G,x:0,y:0},m=new a.H(d,u,a.G);this.patterns.get(o).set(i.toString(),{bin:d,position:m})}destroyAtlasTextures(){for(const i of this.atlasTexture.values())i&&i.destroy();this.atlasTexture.clear()}bind(i,o){const u=i.gl;let d=this.atlasTexture.get(o);d?this.dirty&&(d.update(this.atlasImage.get(o)),this.dirty=!1):(d=new a.T(i,this.atlasImage.get(o),u.RGBA8),this.atlasTexture.set(o,d)),d.bind(u.LINEAR,u.CLAMP_TO_EDGE)}_updatePatternAtlas(i,o){const u=this.patterns.get(i),d=Array.from(u.values()).map(({bin:T})=>T),{w:m,h:_}=a.J(d),y=this.atlasImage.get(i);y.resize({width:m||1,height:_||1});const v=this.images.get(i);for(const[T,{bin:I,position:M}]of u.entries()){let C=M.padding;const D=I.x+C,F=I.y+C,z=v.get(T).data,V=z.width,N=z.height;C=C>1?C-1:C,a.q.copy(z,y,{x:0,y:0},{x:D,y:F},{width:V,height:N},o),a.q.copy(z,y,{x:0,y:N-C},{x:D,y:F-C},{width:V,height:C},o),a.q.copy(z,y,{x:0,y:0},{x:D,y:F+N},{width:V,height:C},o),a.q.copy(z,y,{x:V-C,y:0},{x:D-C,y:F},{width:C,height:N},o),a.q.copy(z,y,{x:0,y:0},{x:D+V,y:F},{width:C,height:N},o),a.q.copy(z,y,{x:V-C,y:N-C},{x:D-C,y:F-C},{width:C,height:C},o),a.q.copy(z,y,{x:0,y:N-C},{x:D+V,y:F-C},{width:C,height:C},o),a.q.copy(z,y,{x:0,y:0},{x:D+V,y:F+N},{width:C,height:C},o),a.q.copy(z,y,{x:V-C,y:0},{x:D-C,y:F+N},{width:C,height:C},o)}this.dirty=!0}beginFrame(){for(const i of this.images.keys())this.callbackDispatchedThisFrame.set(i,new Set)}
7dispatchRenderCallbacks(i,o){const u=this.images.get(o);for(const d of i){if(this.callbackDispatchedThisFrame.get(o).has(d.toString()))continue;this.callbackDispatchedThisFrame.get(o).add(d.toString());const m=u.get(d.toString());hc(m)&&this.updateImage(d,o,m)}}destroy(){this.imageRasterizerDispatcher&&this.imageRasterizerDispatcher.remove()}}function Go(l){const i=l.value,o=l.valueSpec,u=l.style,d=l.styleSpec,m=l.key,_=l.arrayElementValidator||di;if(!Array.isArray(i))return[new a.V(m,i,`array expected, ${a.M(i)} found`)];if(o.length&&i.length!==o.length)return[new a.V(m,i,`array length ${o.length} expected, length ${i.length} found`)];if(o["min-length"]&&i.length<o["min-length"])return[new a.V(m,i,`array length at least ${o["min-length"]} expected, length ${i.length} found`)];let y={type:o.value,values:o.values,minimum:o.minimum,maximum:o.maximum,function:void 0};d.$version<7&&(y.function=o.function),a.K(o.value)&&(y=o.value);let v=[];for(let T=0;T<i.length;T++)v=v.concat(_({array:i,arrayIndex:T,value:i[T],valueSpec:y,style:u,styleSpec:d,key:`${m}[${T}]`},!0));return v}function kr(l){const i=l.key,o=l.value,u=l.valueSpec;if(!a.N(o))return[new a.V(i,o,`number expected, ${a.M(o)} found`)];if(o!=o)return[new a.V(i,o,"number expected, NaN found")];if("minimum"in u){let d=u.minimum;if(Array.isArray(u.minimum)&&(d=u.minimum[l.arrayIndex]),o<d)return[new a.V(i,o,`${o} is less than the minimum value ${d}`)]}if("maximum"in u){let d=u.maximum;if(Array.isArray(u.maximum)&&(d=u.maximum[l.arrayIndex]),o>d)return[new a.V(i,o,`${o} is greater than the maximum value ${d}`)]}return[]}function Qs(l){const i=l.key,o=l.value;if(!a.K(o))return[new a.V(i,o,`object expected, ${a.M(o)} found`)];const u=l.valueSpec,d=a.L(o.type);let m,_,y,v={};const T=d!=="categorical"&&o.property===void 0,I=!T,M=function(z){const V=z.stops;return Array.isArray(V)&&Array.isArray(V[0])&&a.K(V[0][0])}(o),C=zr({key:l.key,value:l.value,valueSpec:l.styleSpec.function,style:l.style,styleSpec:l.styleSpec,objectElementValidators:{stops:function(z){if(d==="identity")return[new a.V(z.key,z.value,'identity function may not have a "stops" property')];let V=[];const N=z.value;return V=V.concat(Go({key:z.key,value:N,valueSpec:z.valueSpec,style:z.style,styleSpec:z.styleSpec,arrayElementValidator:D})),Array.isArray(N)&&N.length===0&&V.push(new a.V(z.key,N,"array must have at least one stop")),V},default:function(z){return di({key:z.key,value:z.value,valueSpec:u,style:z.style,styleSpec:z.styleSpec})}}});return d==="identity"&&T&&C.push(new a.V(l.key,l.value,'missing required property "property"')),d==="identity"||o.stops||C.push(new a.V(l.key,l.value,'missing required property "stops"')),d==="exponential"&&u.expression&&!a.O(u)&&C.push(new a.V(l.key,l.value,"exponential functions not supported")),l.styleSpec.$version>=8&&(I&&!a.Q(u)?C.push(new a.V(l.key,l.value,"property functions not supported")):T&&!a.S(u)&&C.push(new a.V(l.key,l.value,"zoom functions not supported"))),d!=="categorical"&&!M||o.property!==void 0||C.push(new a.V(l.key,l.value,'"property" property is required')),C;function D(z){let V=[];const N=z.value,$=z.key;if(!Array.isArray(N))return[new a.V($,N,`array expected, ${a.M(N)} found`)];if(N.length!==2)return[new a.V($,N,`array length 2 expected, length ${N.length} found`)];if(M){if(!a.K(N[0]))return[new a.V($,N,`object expected, ${a.M(N[0])} found`)];const H=N[0];if(H.zoom===void 0)return[new a.V($,N,"object stop key must have zoom")];if(H.value===void 0)return[new a.V($,N,"object stop key must have value")];const j=a.L(H.zoom);if(typeof j!="number")return[new a.V($,H.zoom,"stop zoom values must be numbers")];if(y&&y>j)return[new a.V($,H.zoom,"stop zoom values must appear in ascending order")];j!==y&&(y=j,_=void 0,v={}),V=V.concat(zr({key:`${$}[0]`,value:N[0],valueSpec:{zoom:{}},style:z.style,styleSpec:z.styleSpec,objectElementValidators:{zoom:kr,value:F}}))}else V=V.concat(F({key:`${$}[0]`,value:N[0],style:z.style,styleSpec:z.styleSpec},N));return a.U(a.W(N[1]))?V.concat([new a.V(`${$}[1]`,N[1],"expressions are not allowed in function stops.")]):V.concat(di({key:`${$}[1]`,value:N[1],valueSpec:u,style:z.style,styleSpec:z.styleSpec}))}function F(z,V){const N=a.M(z.value),$=a.L(z.value),H=z.value!==null?z.value:V;if(m){if(N!==m)return[new a.V(z.key,H,`${N} stop domain type must match previous stop domain type ${m}`)]}else m=N;if(N!=="number"&&N!=="string"&&N!=="boolean"&&typeof $!="number"&&typeof $!="string"&&typeof $!="boolean")return[new a.V(z.key,H,"stop domain value must be a number, string, or boolean")];if(N!=="number"&&d!=="categorical"){let j=`number expected, ${N} found`;return a.Q(u)&&d===void 0&&(j+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new a.V(z.key,H,j)]}return d!=="categorical"||N!=="number"||typeof $=="number"&&isFinite($)&&Math.floor($)===$?d!=="categorical"&&N==="number"&&typeof $=="number"&&typeof _=="number"&&_!==void 0&&$<_?[new a.V(z.key,H,"stop domain values must appear in ascending order")]:(_=$,d==="categorical"&&$ in v?[new a.V(z.key,H,"stop domain values must be unique")]:(v[$]=!0,[])):[new a.V(z.key,H,`integer expected, found ${String($)}`)]}}function Cn(l){const i=(l.expressionContext==="property"?a.Y:a.X)(a.W(l.value),l.valueSpec);if(i.result==="error")return i.value.map(u=>
7new a.V(`${l.key}${u.key}`,l.value,u.message));const o=i.value.expression||i.value._styleExpression.expression;if(l.expressionContext==="property"&&l.propertyKey==="text-font"&&!o.outputDefined())return[new a.V(l.key,l.value,`Invalid data expression for "${l.propertyKey}". Output values must be contained as literals within the expression.`)];if(l.expressionContext==="property"&&l.propertyType==="layout"&&!a.$(o))return[new a.V(l.key,l.value,'"feature-state" data expressions are not supported with layout properties.')];if(l.expressionContext==="filter")return dn(o,l);if(l.expressionContext==="appearance")return Ka(o,l);if(l.expressionContext&&l.expressionContext.indexOf("cluster")===0){if(!a.Z(o,["zoom","feature-state"]))return[new a.V(l.key,l.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(l.expressionContext==="cluster-initial"&&!a._(o))return[new a.V(l.key,l.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function dn(l,i){const o=new Set(["zoom","feature-state","pitch","distance-from-center"]);if(i.valueSpec&&i.valueSpec.expression)for(const d of i.valueSpec.expression.parameters)o.delete(d);if(o.size===0)return[];const u=[];return l instanceof a.a0&&o.has(l.name)?[new a.V(i.key,i.value,`["${l.name}"] expression is not supported in a filter for a ${i.object.type} layer with id: ${i.object.id}`)]:(l.eachChild(d=>{u.push(...dn(d,i))}),u)}function Ka(l,i){const o=new Set;if(i.valueSpec&&i.valueSpec.expression)for(const d of i.valueSpec.expression.parameters)o.add(d);if(o.size===0)return[];const u=[];return l instanceof a.a0&&!o.has(l.name)?[new a.V(i.key,i.value,`["${l.name}"] is not an allowed parameter`)]:(l.eachChild(d=>{u.push(...Ka(d,i))}),u)}function vr(l){const i=l.key,o=l.value,u=l.valueSpec,d=[];return Array.isArray(u.values)?u.values.indexOf(a.L(o))===-1&&d.push(new a.V(i,o,`expected one of [${u.values.join(", ")}], ${JSON.stringify(o)} found`)):Object.keys(u.values).indexOf(a.L(o))===-1&&d.push(new a.V(i,o,`expected one of [${Object.keys(u.values).join(", ")}], ${JSON.stringify(o)} found`)),d}function So(l){return a.a4(a.W(l.value))?Cn(Object.assign({},l,{expressionContext:"filter",valueSpec:l.styleSpec[`filter_${l.layerType||"fill"}`]})):vs(l)}function vs(l){const i=l.value,o=l.key;if(!Array.isArray(i))return[new a.V(o,i,`array expected, ${a.M(i)} found`)];if(i.length<1)return[new a.V(o,i,"filter array must have at least 1 element")];const u=l.styleSpec;let d=vr({key:`${o}[0]`,value:i[0],valueSpec:u.filter_operator});const m=()=>{i.length>=2&&(a.a2(i[1])||d.push(new a.V(`${o}[1]`,i[1],`string expected, ${a.M(i[1])} found`)));for(let _=2;_<i.length;_++)a.L(i[1])==="$type"?d=d.concat(vr({key:`${o}[${_}]`,value:i[_],valueSpec:u.geometry_type})):a.a2(i[_])||a.N(i[_])||a.a1(i[_])||d.push(new a.V(`${o}[${_}]`,i[_],`string, number, or boolean expected, ${a.M(i[_])} found.`))};switch(a.L(i[0])){case"<":case"<=":case">":case">=":i.length>=2&&a.L(i[1])==="$type"&&d.push(new a.V(o,i,`"$type" cannot be use with operator "${i[0]}"`)),i.length!==3&&d.push(new a.V(o,i,`filter array for operator "${i[0]}" must have 3 elements`)),m();break;case"==":case"!=":i.length!==3&&d.push(new a.V(o,i,`filter array for operator "${i[0]}" must have 3 elements`)),m();break;case"in":case"!in":m();break;case"any":case"all":case"none":for(let _=1;_<i.length;_++)d=d.concat(vs({key:`${o}[${_}]`,value:i[_],style:l.style,styleSpec:l.styleSpec}));break;case"has":case"!has":i.length!==2?d.push(new a.V(o,i,`filter array for "${i[0]}" operator must have 2 elements`)):a.a2(i[1])||d.push(new a.V(`${o}[1]`,i[1],`string expected, ${a.M(i[1])} found`))}return d}function en(l,i){const o=l.key,u=l.style,d=l.layer,m=l.styleSpec,_=l.value,y=l.objectKey,v=m[`${i}_${l.layerType}`];if(!v)return[];const T=y.match(/^(.*)-use-theme$/);if(T&&v[T[1]])return a.U(a.W(_))?[].concat(di({key:o,value:_,valueSpec:{type:"string",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},style:u,styleSpec:m,expressionContext:"property",propertyType:i,propertyKey:y})):di({key:o,value:_,valueSpec:{type:"string"},style:u,styleSpec:m});const I=y.match(/^(.*)-transition$/);if(i==="paint"&&I&&v[I[1]]&&v[I[1]].transition)return di({key:o,value:_,valueSpec:m.transition,style:u,styleSpec:m});const M=l.valueSpec||v[y];if(!M)return[new a.a5(o,_,`unknown property "${y}"`)];let C;if(a.a2(_)&&a.Q(M)&&!M.tokens&&(C=/^{([^}]+)}$/.exec(_))){const F=`\`{ "type": "identity", "property": ${C?JSON.stringify(C[1]):'"_"'} }\``;return[new a.V(o,_,`"${y}" does not support interpolation syntax
8Use an identity property function instead: ${F}.`)]}const D=[];if(l.layerType==="symbol")y!=="text-field"||!u||u.glyphs||u.imports||D.push(new a.V(o,_,'use of "text-field" requires a style "glyphs" property')),y==="text-font"&&a.a6(a.W(_))&&a.L(_.type)==="identity"&&D.push(new a.V(o,_,'"text-font" does not support identity functions'));else if(l.layerType==="model"&&i==="paint"&&d&&d.layout&&d.layout.hasOwnProperty("model-id")&&a.Q(M)&&(a.a7(M)||a.S(M))){const F=a.Y(a.W(_),M).value,z="expression"in F&&F.expression||"_styleExpression"in F&&F._styleExpression&&F._styleExpression.expression;z&&!a.Z(z,["measure-light"])&&(y==="model-emissive-strength"&&a._(z)&&a.$(z)||D.push(new a.V(o,_,`${y} does not support measure-light expressions when the model layer source is vector tile or GeoJSON.`)))}return D.concat(di({key:l.key,value:_,valueSpec:M,style:u,styleSpec:m,expressionContext:"property",propertyType:i,propertyKey:y}))}function Io(l){return en(l,"paint")}function bs(l){return en(l,"layout")}function ws(l){let i=[];const o=l.value,u=l.key,d=l.style,m=l.styleSpec;if(!a.K(o))return[new a.V(u,o,"object expected")];o.type||o.ref||i.push(new a.V(u,o,'either "type" or "ref" is required'));let _=a.L(o.type);const y=a.L(o.ref);
8if(o.id){const v=a.L(o.id);for(let T=0;T<l.arrayIndex;T++){const I=d.layers[T];a.L(I.id)===v&&i.push(new a.V(u,o.id,`duplicate layer id "${v}", previously used at line ${I.id.__line__}`))}}if("ref"in o){let v;["type","source","source-layer","filter","layout"].forEach(T=>{T in o&&i.push(new a.V(u,o[T],`"${T}" is prohibited for ref layers`))}),d.layers.forEach(T=>{a.L(T.id)===y&&(v=T)}),v?v.ref?i.push(new a.V(u,o.ref,"ref cannot reference another ref layer")):_=a.L(v.type):typeof y=="string"&&i.push(new a.V(u,o.ref,`ref layer "${y}" not found`))}else if(_!=="background"&&_!=="sky"&&_!=="slot")if(o.source)if(a.a2(o.source)){const v=d.sources&&d.sources[o.source],T=v&&a.L(v.type);v?T==="vector"&&_==="raster"?i.push(new a.V(u,o.source,`layer "${o.id}" requires a raster source`)):T==="raster"&&_!=="raster"?i.push(new a.V(u,o.source,`layer "${o.id}" requires a vector source`)):T!=="vector"||o["source-layer"]?T==="raster-dem"&&_!=="hillshade"?i.push(new a.V(u,o.source,"raster-dem source can only be used with layer type 'hillshade'.")):T!=="raster-array"||["raster","raster-particle"].includes(_)?_==="line"&&o.paint&&(o.paint["line-gradient"]||o.paint["line-trim-offset"])&&T==="geojson"&&!v.lineMetrics?i.push(new a.V(u,o,`layer "${o.id}" specifies a line-gradient, which requires the GeoJSON source to have \`lineMetrics\` enabled.`)):_==="raster-particle"&&T!=="raster-array"&&i.push(new a.V(u,o.source,`layer "${o.id}" requires a 'raster-array' source.`)):i.push(new a.V(u,o.source,"raster-array source can only be used with layer type 'raster'.")):i.push(new a.V(u,o,`layer "${o.id}" must specify a "source-layer"`)):i.push(new a.V(u,o.source,`source "${o.source}" not found`))}else i.push(new a.V(`${u}.source`,o.source,'"source" must be a string'));else i.push(new a.V(u,o,'missing required property "source"'));return i=i.concat(zr({key:u,value:o,valueSpec:m.layer,style:l.style,styleSpec:l.styleSpec,objectElementValidators:{"*":()=>[],type:()=>di({key:`${u}.type`,value:o.type,valueSpec:m.layer.type,style:l.style,styleSpec:l.styleSpec,object:o,objectKey:"type"}),filter:v=>So(Object.assign({layerType:_},v)),layout:v=>zr({layer:o,key:v.key,value:v.value,valueSpec:{},style:v.style,styleSpec:v.styleSpec,objectElementValidators:{"*":T=>bs(Object.assign({layerType:_},T))}}),paint:v=>zr({layer:o,key:v.key,value:v.value,valueSpec:{},style:v.style,styleSpec:v.styleSpec,objectElementValidators:{"*":T=>Io(Object.assign({layerType:_,layer:o},T))}}),appearances(v){const T=Go({key:v.key,value:v.value,valueSpec:v.valueSpec,style:v.style,styleSpec:v.styleSpec,arrayElementValidator:C=>function(D){const{key:F,layer:z,layerType:V}=D,N=a.L(D.value),$=a.L(N.name),H=a.L(N.condition),j=zr({key:F,value:N,valueSpec:D.styleSpec.appearance,style:D.style,styleSpec:D.styleSpec,objectElementValidators:{condition:ne=>function(Y){const re=[];return re.push(...Cn({key:Y.key,value:Y.object.condition,valueSpec:a.a8.appearance.condition,expressionContext:"appearance"})),re}(Object.assign({layer:z,layerType:V},ne)),properties:ne=>function(Y){const re=[],{styleSpec:Z,layer:K,layerType:te}=Y,de=Z[`paint_${te}`],se=Z[`layout_${te}`],be=Y.object[Y.objectKey];for(const _e in be){const Me=_e in de?"paint":_e in se?"layout":void 0;if(!Me){re.push(new a.V(Y.key,_e,`unknown property "${_e}" for layer type "${te}"`));continue}const Le=Object.assign({},Y,{key:`${Y.key}.${_e}`,object:be,objectKey:_e,layer:K,layerType:te,value:be[_e],valueSpec:Me==="paint"?de[_e]:se[_e]});re.push(...en(Le,Me))}return re}(Object.assign({layer:z,layerType:V},ne))}});return $!=="hidden"&&H===void 0&&j.push(new a.V(D.key,"name",'Appearance with name different than "hidden" must have a condition')),j}(Object.assign({layerType:_,layer:o},C))}),I=Array.isArray(v.value)?v.value:[],M=new Set;return I.forEach((C,D)=>{const F=a.L(C.name);if(F)if(M.has(F)){const z=a.L(o.id);T.push(new a.V(v.key,F,`Duplicated appearance name "${F}" for layer "${z}"`))}else M.add(F)}),T}}})),i}function to({key:l,value:i}){return a.a2(i)?[]:[new a.V(l,i,`string expected, ${a.M(i)} found`)]}const qo={promoteId:function l({key:i,value:o}){if(a.a2(o))return to({key:i,value:o});if(Array.isArray(o)){const d=[],m=a.W(o),_=a.X(m);return _.result==="error"?(_.value.forEach(y=>{d.push(new a.V(`${i}${y.key}`,null,`${y.message}`))}),d):(a.Z(_.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 a.V(`${i}`,null,"promoteId expression should be only feature dependent")),d)}if(!a.K(o))return[new a.V(i,o,`string, expression or object expected, "${a.M(o)}" found`)];const u=[];for(const d in o)u.push(...l({key:`${i}.${d}`,value:o[d]}));return u}};function Ts(l){const i=l.value,o=l.key,u=l.styleSpec,d=l.style;if(!a.K(i))return[new a.V(o,i,`object expected, ${a.M(i)} found`)];if(!("type"in i))return[new a.V(o,i,'"type" is required')];
8const m=a.L(i.type);let _=[];switch(["vector","raster","raster-dem","raster-array"].includes(m)&&("url"in i||"tiles"in i||_.push(new a.a5(o,i,'Either "url" or "tiles" is required.'))),m){case"vector":case"raster":case"raster-dem":case"raster-array":return _=_.concat(zr({key:o,value:i,valueSpec:u[`source_${m.replace("-","_")}`],style:l.style,styleSpec:u,objectElementValidators:qo})),_;case"geojson":if(_=zr({key:o,value:i,valueSpec:u.source_geojson,style:d,styleSpec:u,objectElementValidators:qo}),"cluster"in i&&"clusterProperties"in i){if(!a.K(i.clusterProperties))return[new a.V(`${o}.clusterProperties`,i,`object expected, ${a.M(i)} found`)];for(const y in i.clusterProperties){const v=i.clusterProperties[y];if(!Array.isArray(v))return[new a.V(`${o}.clusterProperties.${y}`,v,"array expected")];const[T,I]=v,M=typeof T=="string"?[T,["accumulated"],["get",y]]:T;_.push(...Cn({key:`${o}.${y}.map`,value:I,expressionContext:"cluster-map"})),_.push(...Cn({key:`${o}.${y}.reduce`,value:M,expressionContext:"cluster-reduce"}))}}return _;case"video":return zr({key:o,value:i,valueSpec:u.source_video,style:d,styleSpec:u});case"image":return zr({key:o,value:i,valueSpec:u.source_image,style:d,styleSpec:u});case"canvas":return[new a.V(o,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return vr({key:`${o}.type`,value:i.type,valueSpec:{values:dc(u)}})}}function dc(l){return l.source.reduce((i,o)=>{const u=l[o];return u.type.type==="enum"&&(i=i.concat(Object.keys(u.type.values||{}))),i},[])}function fc(l){const i=l.value,o=l.styleSpec,u=o.light,d=l.style;if(i===void 0)return[];if(!a.K(i))return[new a.V("light",i,`object expected, ${a.M(i)} found`)];let m=[];for(const _ in i){const y=_.match(/^(.*)-transition$/),v=_.match(/^(.*)-use-theme$/);m=m.concat(v&&u[v[1]]?di({key:_,value:i[_],valueSpec:{type:"string"},style:d,styleSpec:o}):y&&u[y[1]]&&u[y[1]].transition?di({key:_,value:i[_],valueSpec:o.transition,style:d,styleSpec:o}):u[_]?di({key:_,value:i[_],valueSpec:u[_],style:d,styleSpec:o}):[new a.V(_,i[_],`unknown property "${_}"`)])}return m}function $o(l){const i=l.value;if(!i)return[];const o=l.key;if(!a.K(i))return[new a.V(o,i,`object expected, ${a.M(i)} found`)];let u=[];const d=l.styleSpec,m=d["light-3d"],_=l.style,y=l.style.lights;for(const I of["type","id"])if(!(I in i))return u=u.concat([new a.V(o,i,`missing property "${I}"`)]),u;if(!a.a2(i.type))return u=u.concat([new a.V(`${o}.type`,i.type,"string expected")]),u;if(y)for(let I=0;I<l.arrayIndex;I++){const M=a.L(i.type),C=y[I];a.L(C.type)===M&&u.push(new a.V(o,i.id,`duplicate light type "${i.type}", previously defined at line ${C.id.__line__}`))}const v=`properties_light_${i.type}`;if(!(v in d))return u=u.concat([new a.V(`${o}.type`,i,`Invalid light type ${i.type}`)]),u;const T=d[v];for(const I in i)if(I==="properties"){const M=i[I];if(!a.K(M))return u=u.concat([new a.V("properties",M,`object expected, ${a.M(M)} found`)]),u;for(const C in M){const D=C.match(/^(.*)-transition$/),F=C.match(/^(.*)-use-theme$/);u=u.concat(F&&T[F[1]]?di({key:I,value:M[C],valueSpec:{type:"string"},style:_,styleSpec:d}):D&&T[D[1]]&&T[D[1]].transition?di({key:I,value:i[I],valueSpec:d.transition,style:_,styleSpec:d}):T[C]?di({key:C,value:M[C],valueSpec:T[C],style:_,styleSpec:d}):[new a.a5(l.key,M[C],`unknown property "${C}"`)])}}else u=u.concat(m[I]?di({key:I,value:i[I],valueSpec:m[I],style:_,styleSpec:d}):[new a.a5(I,i[I],`unknown property "${I}"`)]);return u}function pc(l){const i=l.value,o=l.key,u=l.style,d=l.styleSpec,m=d.terrain;if(i==null)return[];if(!a.K(i))return[new a.V("terrain",i,`object expected, ${a.M(i)} found`)];let _=[];for(const y in i){const v=y.match(/^(.*)-transition$/),T=y.match(/^(.*)-use-theme$/);_=_.concat(T&&m[T[1]]?di({key:y,value:i[y],valueSpec:{type:"string"},style:u,styleSpec:d}):v&&m[v[1]]&&m[v[1]].transition?di({key:y,value:i[y],valueSpec:d.transition,style:u,styleSpec:d}):m[y]?di({key:y,value:i[y],valueSpec:m[y],style:u,styleSpec:d}):[new a.a5(y,i[y],`unknown property "${y}"`)])}if(i.source)if(a.a2(i.source)){const y=u.sources&&u.sources[i.source],v=y&&a.L(y.type);y?v!=="raster-dem"&&_.push(new a.V(`${o}.source`,i.source,`terrain cannot be used with a source of type ${v}, it only be used with a "raster-dem" source type`)):_.push(new a.V(`${o}.source`,i.source,`source "${i.source}" not found`))}else _.push(new a.V(`${o}.source`,i.source,"source must be a string"));else _.push(new a.V(o,i,'terrain is missing required property "source"'));return _}function Qa(l){const i=l.value,o=l.style,u=l.styleSpec,d=u.fog;if(i===void 0)return[];if(!a.K(i))return[new a.V("fog",i,`object expected, ${a.M(i)} found`)];let m=[];for(const _ in i){const y=_.match(/^(.*)-transition$/),v=_.match(/^(.*)-use-theme$/);m=m.concat(v&&d[v[1]]?di({key:_,value:i[_],valueSpec:{type:"string"},style:o,styleSpec:u}):y&&d[y[1]]&&d[y[1]].transition?di({key:_,value:i[_],valueSpec:u.transition,style:o,styleSpec:u}):d[_]?di({key:_,value:i[_],valueSpec:d[_],style:o,styleSpec:u}):[new a.a5(_,i[_],`unknown property "${_}"`)])}return m}const Fe={"*":()=>[],array:Go,boolean:function(l){const i=l.value,o=l.key;return a.a1(i)?[]:[new a.V(o,i,`boolean expected, ${a.M(i)} found`)]},number:kr,color:function({key:l,value:i}){return a.a2(i)?a.a3.parseCSSColor(i)===null?[new a.V(l,i,`color expected, "${i}" found`)]:[]:[new a.V(l,i,`color expected, ${a.M(i)} found`)]},enum:vr,filter:So,function:Qs,layer:ws,object:zr,source:Ts,model:a.a9,light:fc,"light-3d":$o,terrain:pc,fog:Qa,string:to,formatted:function(l){return to(l).length===0?[]:Cn(l)},resolvedImage:function(l){return to(l).length===0?[]:Cn(l)},projection:function(l){const i=l.value,o=l.styleSpec,u=o.projection,d=l.style;if(a.K(i)){let m=[];for(const _ in i)m=m.concat(di({key:_,value:i[_],valueSpec:u[_],style:d,styleSpec:o}));return m}return a.a2(i)?[]:[new a.V("projection",i,`object or string expected, ${a.M(i)} found`)]},import:function(l){const i=l.key,{value:o,styleSpec:u}=l;if(!a.K(o))return[new a.V(i,o,"import must be an object")];const{data:d,...m}=o;Object.defineProperty(m,"__line__",{value:o.__line__,enumerable:!1});let _=zr(Object.assign({},l,{value:m,valueSpec:u.import}));return a.L(m.id)===""&&_.push(new a.V(`${l.key}.id`,m,"import id can't be an empty string")),d&&(_=_.concat(Vt(d,u,{key:`${l.key}.data`}))),_},iconset:function(l){const i=l.value,o=l.key,u=l.styleSpec,d=l.style;if(!a.K(i))return[new a.V(o,i,"object expected")];if(!i.type)return[new a.V(o,i,'"type" is required')];
8const m=a.L(i.type);let _=[];if(_=_.concat(zr({key:o,value:i,valueSpec:u[`iconset_${m}`],style:d,styleSpec:u})),function(y,v){return!(y!=="source"||!v.source)}(m,i)){const y=d.sources&&d.sources[i.source],v=y&&a.L(y.type);y?v!=="raster-array"&&_.push(new a.V(o,i.source,`iconset cannot be used with a source of type ${String(v)}, it only be used with a "raster-array" source type`)):_.push(new a.V(o,i.source,`source "${i.source}" not found`))}return _}};function di(l,i=!1){const o=l.value,u=l.valueSpec,d=l.styleSpec;if(u.expression){if(a.a6(a.L(o)))return Qs(l);if(a.U(a.W(o)))return Cn(l)}if(u.type&&Fe[u.type]){const m=Fe[u.type](l);return i===!0&&m.length>0&&Array.isArray(l.value)?Cn(l):m}return zr(Object.assign({},l,{valueSpec:u.type?d[u.type]:u}))}function zr(l){const i=l.key,o=l.value,u=l.valueSpec||{},d=l.objectElementValidators||{},m=l.style,_=l.styleSpec;if(!a.K(o))return[new a.V(i,o,`object expected, ${a.M(o)} found`)];let y=[];for(const v in o){const T=v.split(".")[0];let I;d[T]?I=d[T]:u[T]?I=di:d["*"]?I=d["*"]:u["*"]&&(I=di),I?y=y.concat(I({key:(i&&`${i}.`)+v,value:o[v],valueSpec:u[T]||u["*"],style:m,styleSpec:_,object:o,objectKey:v},o)):y.push(new a.a5(i,o[v],`unknown property "${v}"`))}for(const v in u){if(d[v])continue;const T=u[v];T.required&&T.default===void 0&&o[v]===void 0&&y.push(new a.V(i,o,`missing required property "${v}"`))}return y}function Ja({key:l,value:i}){const o=to({key:l,value:i});if(o.length)return o;const u=i;return u.indexOf("{fontstack}")===-1&&o.push(new a.V(l,i,'"glyphs" url must include a "{fontstack}" token')),u.indexOf("{range}")===-1&&o.push(new a.V(l,i,'"glyphs" url must include a "{range}" token')),o}function Vt(l,i=a.a8,o={}){return zr({key:o.key||"",value:l,valueSpec:Object.assign(i.$root,{"*":{type:"*"}}),styleSpec:i,style:l,objectElementValidators:{glyphs:Ja}})}function Zi(l,i=a.a8){return Re(Vt(l,i))}const mc=l=>Re(Ts(l)),el=l=>Re(fc(l)),pe=l=>Re($o(l)),O=l=>Re(pc(l)),k=l=>Re(Qa(l)),W=l=>Re(function(i){const o=i.value,u=i.style,d=i.styleSpec,m=d.snow;if(o===void 0)return[];if(!a.K(o))return[new a.V("snow",o,`object expected, ${a.M(o)} found`)];let _=[];for(const y in o){const v=y.match(/^(.*)-transition$/);_=_.concat(v&&m[v[1]]&&m[v[1]].transition?di({key:y,value:o[y],valueSpec:d.transition,style:u,styleSpec:d}):m[y]?di({key:y,value:o[y],valueSpec:m[y],style:u,styleSpec:d}):[new a.a5(y,o[y],`unknown property "${y}"`)])}return _}(l)),oe=l=>Re(function(i){const o=i.value,u=i.style,d=i.styleSpec,m=d.rain;if(o===void 0)return[];if(!a.K(o))return[new a.V("rain",o,`object expected, ${a.M(o)} found`)];let _=[];for(const y in o){const v=y.match(/^(.*)-transition$/);_=_.concat(v&&m[v[1]]&&m[v[1]].transition?di({key:y,value:o[y],valueSpec:d.transition,style:u,styleSpec:d}):m[y]?di({key:y,value:o[y],valueSpec:m[y],style:u,styleSpec:d}):[new a.a5(y,o[y],`unknown property "${y}"`)])}return _}(l)),ae=l=>Re(ws(l)),ce=l=>Re(So(l)),me=l=>Re(Io(l)),he=l=>Re(bs(l)),ge=l=>Re(a.a9(l));function Re(l){return l.slice().sort((i,o)=>i.line&&o.line?i.line-o.line:0)}function ze(l,i){let o=!1;if(i&&i.length)for(const u of i)u instanceof a.a5?a.w(u.message):(l.fire(new a.B(new Error(u.message))),o=!0);return o}const Xe=a.a8.light;let ut;class mt extends a.E{constructor(i,o="flat"){super(),this._transitionable=new a.aa(ut||(ut=new a.ab({anchor:new a.ac(Xe.anchor),position:new a.ad(Xe.position),color:new a.ac(Xe.color),intensity:new a.ac(Xe.intensity)}))),this.setLight(i,o),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(i,o,u={}){this._validate(el,i,u)||(this._transitionable.setTransitionOrValue(i),this.id=o)}updateTransitions(i){this._transitioning=this._transitionable.transitioned(i,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(i){this.properties=this._transitioning.possiblyEvaluate(i)}_validate(i,o,u){return(!u||u.validate!==!1)&&ze(this,i.call(Zi,Object.assign({value:o,style:{glyphs:!0,sprite:!0},styleSpec:a.a8})))}}const lt=a.a8.terrain;let St=class extends a.E{constructor(l,i,o,u,d){super(),this.scope=o,this._transitionable=new a.aa(new a.ab({source:new a.ac(lt.source),exaggeration:new a.ac(lt.exaggeration)}),o,u),this._transitionable.setTransitionOrValue(l,u),this._transitioning=this._transitionable.untransitioned(),this.drapeRenderMode=i,this.worldview=d}get(){return this._transitionable.serialize()}set(l,i){this._transitionable.setTransitionOrValue(l,i)}updateTransitions(l){this._transitioning=this._transitionable.transitioned(l,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(l){this.properties=this._transitioning.possiblyEvaluate(l)}getExaggeration(l){return this._transitioning.possiblyEvaluate(new a.ae(l,{worldview:this.worldview})).get("exaggeration")}getAttenuationRange(){if(!this.isZoomDependent())return null;const l=this._transitionable._values.exaggeration;if(!l)return null;const i=l.value.expression;if(!i)return null;let o=-1,u=-1,d=1;for(const m of i.zoomStops)d=i.evaluate(new a.ae(m,{worldview:this.worldview})),d>.01?(o=m,u=-1):u=m;return d<.01&&o>0&&u>o?[o,u]:null}isZoomDependent(){const l=this._transitionable._values.exaggeration;return l!=null&&l.value!=null&&l.value.expression!=null&&l.value.expression instanceof a.af}};const vt=.05;function Ot(l,i,o,u){const d=a.aj(45,65,o),[m,_]=Si(l,u);let y=1-Math.min(1,Math.exp((i-m)/(_-m)*-6));return y*=y*y,y=Math.min(1,1.00747*y),y*d*l.alpha}function Si(l,i){const o=.5/Math.tan(.5*i);return[l.range[0]+o,l.range[1]+o]}function Yi(l,i,o,u,d){const m=a.ah([],[i,o,u],d.mercatorFogMatrix);return Ot(l,a.ai(m),d.pitch,d._fov)}function Di(l,i,o,u,d,m,_){const y=[[o,u,0],[d,u,0],[d,m,0],[o,m,0]];let v=Number.MAX_VALUE,T=-Number.MAX_VALUE;for(const I of y){const M=a.ah([],I,i),C=a.ai(M);v=Math.min(v,C),T=Math.max(T,C)}return[Ot(l,v,_.pitch,_._fov),Ot(l,T,_.pitch,_._fov)]}const vi=a.a8.fog;class fi extends a.E{constructor(i,o,u,d){super();const m=new a.ab({range:new a.ac(vi.range),color:new a.ac(vi.color),"color-use-theme":new a.ac({type:"string","property-type":"data-constant",default:"default"}),"high-color":new a.ac(vi["high-color"]),"high-color-use-theme":new a.ac({type:"string","property-type":"data-constant",default:"default"}),"space-color":new a.ac(vi["space-color"]),"space-color-use-theme":new a.ac({type:"string","property-type":"data-constant",default:"default"}
8),"horizon-blend":new a.ac(vi["horizon-blend"]),"star-intensity":new a.ac(vi["star-intensity"]),"vertical-range":new a.ac(vi["vertical-range"])});this._transitionable=new a.aa(m,u,new Map(d)),this.set(i,d),this._transitioning=this._transitionable.untransitioned(),this._transform=o,this.properties=new a.ak(m),this.scope=u}get state(){const i=this._transform,o=i.projection.name==="globe",u=a.al(i.zoom),d=this.properties.get("range"),m=[.5,3];return{range:o?[a.am(m[0],d[0],u),a.am(m[1],d[1],u)]:d,horizonBlend:this.properties.get("horizon-blend"),alpha:this.properties.get("color").a}}get(){return this._transitionable.serialize()}set(i,o,u={}){if(this._validate(k,i,u))return;const d=Object.assign({},i);for(const m of Object.keys(vi))d[m]===void 0&&(d[m]=vi[m].default);this._options=d,this._transitionable.setTransitionOrValue(this._options,o)}getOpacity(i){if(!this._transform.projection.supportsFog)return 0;const o=this.properties&&this.properties.get("color")||1;return(this._transform.projection.name==="globe"?1:a.aj(45,65,i))*o.a}getOpacityAtLatLng(i,o){return this._transform.projection.supportsFog?function(u,d,m){const _=a.ag.fromLngLat(d),y=m.elevation?m.elevation.getAtPointOrZero(_):0;return Yi(u,_.x,_.y,y,m)}(this.state,i,o):0}getOpacityForTile(i){if(!this._transform.projection.supportsFog)return[1,1];const o=this._transform.calculateFogTileMatrix(i.toUnwrapped());return Di(this.state,o,0,0,a.an,a.an,this._transform)}getOpacityForBounds(i,o,u,d,m){return this._transform.projection.supportsFog?Di(this.state,i,o,u,d,m,this._transform):[1,1]}getFovAdjustedRange(i){return this._transform.projection.supportsFog?Si(this.state,i):[0,1]}isVisibleOnFrustum(i){if(!this._transform.projection.supportsFog)return!1;const o=[4,5,6,7];for(const u of o){const d=i.points[u];let m;if(d[2]>=0)m=d;else{const _=i.points[u-4];m=a.ao(_,d,_[2]/(_[2]-d[2]))}if(Yi(this.state,m[0],m[1],0,this._transform)>=vt)return!0}return!1}updateConfig(i){this._transitionable.setTransitionOrValue(this._options,new Map(i))}updateTransitions(i){this._transitioning=this._transitionable.transitioned(i,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(i){this.properties=this._transitioning.possiblyEvaluate(i)}_validate(i,o,u){return(!u||u.validate!==!1)&&ze(this,i.call(Zi,Object.assign({value:o,style:{glyphs:!0,sprite:!0},styleSpec:a.a8})))}}let Ri,bi,pi,_i=class extends a.E{constructor(l,i,o,u){super();const d=Ri||(Ri=new a.ab({density:new a.ac(a.a8.snow.density),intensity:new a.ac(a.a8.snow.intensity),color:new a.ac(a.a8.snow.color),opacity:new a.ac(a.a8.snow.opacity),vignette:new a.ac(a.a8.snow.vignette),"vignette-color":new a.ac(a.a8.snow["vignette-color"]),"center-thinning":new a.ac(a.a8.snow["center-thinning"]),direction:new a.ac(a.a8.snow.direction),"flake-size":new a.ac(a.a8.snow["flake-size"])}));this._transitionable=new a.aa(d,o,new Map(u)),this.set(l,u),this._transitioning=this._transitionable.untransitioned(),this.properties=new a.ak(d),this.scope=o}get state(){const l=this.properties.get("opacity"),i=this.properties.get("color"),o=this.properties.get("direction"),u=a.ap(o[0]),d=-Math.max(a.ap(o[1]),.01),m=[Math.cos(u)*Math.cos(d),Math.sin(u)*Math.cos(d),Math.sin(d)],_=this.properties.get("vignette"),y=this.properties.get("vignette-color");return y.a=_,{density:this.properties.get("density"),intensity:this.properties.get("intensity"),color:new a.aq(i.r,i.g,i.b,i.a*l),direction:m,centerThinning:this.properties.get("center-thinning"),flakeSize:this.properties.get("flake-size"),vignetteColor:y}}get(){return this._transitionable.serialize()}set(l,i,o={}){if(this._validate(W,l,o))return;const u=Object.assign({},l),d=a.a8.snow;for(const m of Object.keys(d))u[m]===void 0&&(u[m]=d[m].default);this._options=u,this._transitionable.setTransitionOrValue(this._options,i)}updateConfig(l){this._transitionable.setTransitionOrValue(this._options,new Map(l))}updateTransitions(l){this._transitioning=this._transitionable.transitioned(l,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(l){this.properties=this._transitioning.possiblyEvaluate(l)}_validate(l,i,o){return(!o||o.validate!==!1)&&ze(this,l.call(Zi,Object.assign({value:i,style:{glyphs:!0,sprite:!0},styleSpec:a.a8})))}},mi=class extends a.E{constructor(l,i,o,u){super();const d=bi||(bi=new a.ab({density:new a.ac(a.a8.rain.density),intensity:new a.ac(a.a8.rain.intensity),color:new a.ac(a.a8.rain.color),opacity:new a.ac(a.a8.rain.opacity),vignette:new a.ac(a.a8.rain.vignette),"vignette-color":new a.ac(a.a8.rain["vignette-color"]),"center-thinning":new a.ac(a.a8.rain["center-thinning"]),direction:new a.ac(a.a8.rain.direction),"droplet-size":new a.ac(a.a8.rain["droplet-size"]),"distortion-strength":new a.ac(a.a8.rain["distortion-strength"])}));this._transitionable=new a.aa(d,o,new Map(u)),this.set(l,u),this._transitioning=this._transitionable.untransitioned(),this.properties=new a.ak(d),this.scope=o}get state(){const l=this.properties.get("opacity"),i=this.properties.get("color"),o=this.properties.get("direction"),u=a.ap(o[0]),d=-Math.max(a.ap(o[1]),.01),m=[Math.cos(u)*Math.cos(d),Math.sin(u)*Math.cos(d),Math.sin(d)],_=this.properties.get("vignette-color");return _.a=this.properties.get("vignette"),{density:this.properties.get("density"),intensity:this.properties.get("intensity"),color:new a.aq(i.r,i.g,i.b,i.a*l),direction:m,centerThinning:this.properties.get("center-thinning"),droplet
vendor: 4,832 bytes, line 8
8Size:this.properties.get("droplet-size"),distortionStrength:this.properties.get("distortion-strength"),vignetteColor:_}}get(){return this._transitionable.serialize()}set(l,i,o={}){if(this._validate(oe,l,o))return;const u=Object.assign({},l),d=a.a8.rain;for(const m of Object.keys(d))u[m]===void 0&&(u[m]=d[m].default);this._options=u,this._transitionable.setTransitionOrValue(this._options,i)}updateConfig(l){this._transitionable.setTransitionOrValue(this._options,new Map(l))}updateTransitions(l){this._transitioning=this._transitionable.transitioned(l,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(l){this.properties=this._transitioning.possiblyEvaluate(l)}_validate(l,i,o){return(!o||o.validate!==!1)&&ze(this,l.call(Zi,Object.assign({value:i,style:{glyphs:!0,sprite:!0},styleSpec:a.a8})))}};class Nt extends a.E{constructor(i,o,u,d){super(),this.scope=u,this._options=i,this.properties=new a.ak(o),this._transitionable=new a.aa(o,u,new Map(d)),this._transitionable.setTransitionOrValue(i.properties),this._transitioning=this._transitionable.untransitioned()}updateConfig(i){this._transitionable.setTransitionOrValue(this._options.properties,new Map(i))}updateTransitions(i){this._transitioning=this._transitionable.transitioned(i,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(i){this.properties=this._transitioning.possiblyEvaluate(i)}get(){return this._options.properties=this._transitionable.serialize(),this._options}set(i,o){this._options=i,this._transitionable.setTransitionOrValue(i.properties,o)}shadowsEnabled(){return!!this.properties&&this.properties.get("cast-shadows")===!0}}const wr=()=>pi||(pi=new a.ab({color:new a.ac(a.a8.properties_light_ambient.color),"color-use-theme":new a.ac({type:"string",default:"default","property-type":"data-constant"}),intensity:new a.ac(a.a8.properties_light_ambient.intensity)}));let Tr;const Mn=()=>Tr||(Tr=new a.ab({direction:new a.ar(a.a8.properties_light_directional.direction),color:new a.ac(a.a8.properties_light_directional.color),"color-use-theme":new a.ac({type:"string",default:"default","property-type":"data-constant"}),intensity:new a.ac(a.a8.properties_light_directional.intensity),"cast-shadows":new a.ac(a.a8.properties_light_directional["cast-shadows"]),"shadow-quality":new a.ac(a.a8.properties_light_directional["shadow-quality"]),"shadow-intensity":new a.ac(a.a8.properties_light_directional["shadow-intensity"]),"shadow-draw-before-layer":new a.ac(a.a8.properties_light_directional["shadow-draw-before-layer"])}));class Sr{constructor(i,o,u){this.screenBounds=i,this.cameraPoint=u.getCameraPoint(),this._screenRaycastCache={},this._cameraRaycastCache={},this.isAboveHorizon=o,this.screenGeometry=this.bufferedScreenGeometry(0),this.screenGeometryMercator=this._bufferedScreenMercator(0,u)}static createFromScreenPoints(i,o){let u,d;if(i instanceof a.P||typeof i[0]=="number"){const m=a.P.convert(i);u=[m],d=o.isPointAboveHorizon(m)}else{const m=a.P.convert(i[0]),_=a.P.convert(i[1]),y=m.add(_)._div(2);u=[m,_],d=a.as(m,_).every(v=>o.isPointAboveHorizon(v))&&o.isPointAboveHorizon(y)}return new Sr(u,d,o)}isPointQuery(){return this.screenBounds.length===1}bufferedScreenGeometry(i){return a.as(this.screenBounds[0],this.screenBounds.length===1?this.screenBounds[0]:this.screenBounds[1],i)}bufferedCameraGeometry(i){const o=this.screenBounds[0],u=this.screenBounds.length===1?this.screenBounds[0].add(new a.P(1,1)):this.screenBounds[1],d=a.as(o,u,0,!1);return this.cameraPoint.y>u.y&&(this.cameraPoint.x>o.x&&this.cameraPoint.x<u.x?d.splice(3,0,this.cameraPoint):this.cameraPoint.x>=u.x?d[2]=this.cameraPoint:this.cameraPoint.x<=o.x&&(d[3]=this.cameraPoint)),a.at(d,i)}bufferedCameraGeometryGlobe(i){const o=this.screenBounds[0],u=this.screenBounds.length===1?this.screenBounds[0].add(new a.P(1,1)):this.screenBounds[1],d=a.as(o,u,i),m=this.cameraPoint.clone(),_=+(m.x>o.x)+ +(m.x>u.x);switch(3*(+(m.y>o.y)+ +(m.y>u.y))+_){case 0:d[0]=m,d[4]=m.clone();break;case 1:d.splice(1,0,m);break;case 2:d[1]=m;break;case 3:d.splice(4,0,m);break;case 5:d.splice(2,0,m);break;case 6:d[3]=m;break;case 7:d.splice(3,0,m);break;case 8:d[2]=m}return d}containsTile(i,o,u,d=0){const m=Math.max(i.queryPadding,i.evaluateQueryRenderedFeaturePadding())/o._pixelsPerMercatorPixel+1,_=u?this._bufferedCameraMercator(m,o):this._bufferedScreenMercator(m,o);let y=i.tileID.wrap+(_.unwrapped?d:0);const v=_.polygon.map(V=>a.au(i.tileTransform,V,y));if(!a.av(v,0,0,a.an,a.an))return;y=i.tileID.wrap+(this.screenGeometryMercator.unwrapped?d:0);const T=this.screenGeometryMercator.polygon.map(V=>a.aw(i.tileTransform,V,y)),I=T.map(V=>new a.P(V[0],V[1])),M=o.getFreeCameraOptions().position||new a.ag(0,0,0),C=a.aw(i.tileTransform,M,y),D=T.map(V=>{const N=a.ax(V,V,C);return a.ay(N,N),new a.az(C,N)}
8),F=a.aA(i,1,o.zoom)*o._pixelsPerMercatorPixel;return{queryGeometry:this,tilespaceGeometry:I,tilespaceRays:D,bufferedTilespaceGeometry:v,bufferedTilespaceBounds:(z=a.aB(v),z.min.x=a.aC(z.min.x,0,a.an),z.min.y=a.aC(z.min.y,0,a.an),z.max.x=a.aC(z.max.x,0,a.an),z.max.y=a.aC(z.max.y,0,a.an),z),tile:i,tileID:i.tileID,pixelToTileUnitsFactor:F};var z}_bufferedScreenMercator(i,o){const u=$r(i);if(this._screenRaycastCache[u])return this._screenRaycastCache[u];{let d;return d=o.projection.name==="globe"?this._projectAndResample(this.bufferedScreenGeometry(i),o):{polygon:this.bufferedScreenGeometry(i).map(m=>o.pointCoordinate3D(m)),unwrapped:!0},this._screenRaycastCache[u]=d,d}}_bufferedCameraMercator(i,o){const u=$r(i);if(this._cameraRaycastCache[u])return this._cameraRaycastCache[u];{let d;return d=o.projection.name==="globe"?this._projectAndResample(this.bufferedCameraGeometryGlobe(i),o):{polygon:this.bufferedCameraGeometry(i).map(m=>o.pointCoordinate3D(m)),unwrapped:!0},this._cameraRaycastCache[u]=d,d}}_projectAndResample(i,o){const u=function(m,_){const y=a.aD([],_.pixelMatrix,_.globeMatrix),v=[0,-a.aF,0,1],T=[0,a.aF,0,1],I=[0,0,0,1];a.aE(v,v,y),a.aE(T,T,y),a.aE(I,I,y);const M=new a.P(v[0]/v[3],v[1]/v[3]),C=new a.P(T[0]/T[3],T[1]/T[3]),D=a.aG(m,M)&&v[3]<I[3],F=a.aG(m,C)&&T[3]<I[3];if(!D&&!F)return null;const z=function(re,Z,K){for(let te=1;te<re.length;te++){const de=qr(Z.pointCoordinate3D(re[te-1]).x),se=qr(Z.pointCoordinate3D(re[te]).x);if(K<0){if(de<se)return{idx:te,t:-de/(se-1-de)}}else if(se<de)return{idx:te,t:(1-de)/(se+1-de)}}return null}(m,_,D?-1:1);if(!z)return null;const{idx:V,t:N}=z;let $=V>1?$n(m.slice(0,V),_):[],H=V<m.length?$n(m.slice(V),_):[];$=$.map(re=>new a.P(qr(re.x),re.y)),H=H.map(re=>new a.P(qr(re.x),re.y));const j=[...$];j.length===0&&j.push(H[H.length-1]);const ne=a.am(j[j.length-1].y,(H.length===0?$[0]:H[0]).y,N);let Y;return Y=D?[new a.P(0,ne),new a.P(0,0),new a.P(1,0),new a.P(1,ne)]:[new a.P(1,ne),new a.P(1,1),new a.P(0,1),new a.P(0,ne)],j.push(...Y),H.length===0?j.push($[0]):j.push(...H),{polygon:j.map(re=>new a.ag(re.x,re.y)),unwrapped:!1}}(i,o);if(u)return u;const d=function(m,_){let y=!1,v=-1/0,T=0;for(let M=0;M<m.length-1;M++)m[M].x>v&&(v=m[M].x,T=M);for(let M=0;M<m.length-1;M++){const C=(T+M)%(m.length-1),D=m[C],F=m[C+1];Math.abs(D.x-F.x)>.5&&(D.x<F.x?(D.x+=1,C===0&&(m[m.length-1].x+=1)):(F.x+=1,C+1===m.length-1&&(m[0].x+=1)),y=!0)}const I=a.aH(_.center.lng);return y&&I<Math.abs(I-1)&&m.forEach(M=>{M.x-=1}),{polygon:m,unwrapped:y}}($n(i,o).map(m=>new a.P(qr(m.x),m.y)),o);return{polygon:d.polygon.map(m=>new a.ag(m.x,m.y)),unwrapped:d.unwrapped}}}function $n(l,i){return a.aI(l,o=>{const u=i.pointCoordinate3D(o);o.x=u.x,o.y=u.y},1/256)}function qr(l){return l<0?1+l%1:l%1}function $r(l){return 100*l|0}function Eo(l,i,o){try{i=function(d){if(!d.variants)return d;if(!Array.isArray(d.variants))throw new Error("variants must be an array");for(const m of d.variants){if(m==null||typeof m!="object"||m.constructor!==Object)throw new Error("variant must be an object");if(!Array.isArray(m.capabilities))throw new Error("capabilities must be an array");if(m.capabilities.length===1&&m.capabilities[0]==="meshopt")return Object.assign(d,m)}return d}(i)}catch(d){return new Error("Failed to process TileJSON variants",{cause:d})}const u=a.aJ(Object.assign({},i,l),["tilejson","tiles","minzoom","maxzoom","attribution","mapbox_logo","bounds","extra_bounds","scheme","tileSize","encoding","vector_layers","raster_layers","worldview_options","worldview_default","worldview"]);return l.url&&i.tiles&&l.tiles&&(u.tiles=i.tiles),u.tiles=o.canonicalizeTileset(u,l.url),u}function io(l,i,o,u,d){const m=function(y,v){if(y)return d(y);if(v){l.url&&v.tiles&&l.tiles&&delete l.tiles;const T=Eo(l,v,i);if(T instanceof Error)return d(T);d(null,T)}},_=function(y,v,T){if(!y)return null;if(!v&&!T)return y;T=T||y.worldview_default;const I=Object.values(y.language||{});if(I.length===0)return null;const M=Object.values(y.worldview||{});if(M.length===0)return null;const C=I.every(F=>F===v),D=M.every(F=>F===T);return C&&D?y:v in(y.language_options||{})||T in(y.worldview_options||{})?null:y.language_options&&y.worldview_options?y:null}(l.data,o,u);return _?a.o.frame(()=>m(null,_)):l.url?a.m(i.transformRequest(i.normalizeSourceURL(l.url,null,o,u),a.R.Source),m):a.o.frame(()=>{const{data:y,...v}=l;m(null,v)})}function Pn(l,i){const o=Math.pow(2,i.z),u=Math.floor(a.aH(l.getWest())*o),d=Math.floor(a.aL(l.getNorth())*o),m=Math.ceil(a.aH(l.getEast())*o),_=Math.ceil(a.aL(l.getSouth())*o);return i.x>=u&&i.x<m&&i.y>=d&&i.y<_}class tn{constructor(i,o,u){this.bounds=i?a.aK.convert(this.validateBounds(i)):null,this.minzoom=o||0,this.maxzoom=u||24}
8validateBounds(i){return Array.isArray(i)&&i.length===4?[Math.max(-180,i[0]),Math.max(-90,i[1]),Math.min(180,i[2]),Math.min(90,i[3])]:[-180,-90,180,90]}addExtraBounds(i){if(i){this.extraBounds||(this.extraBounds=[]);for(const o of i)this.extraBounds.push(a.aK.convert(this.validateBounds(o)))}}contains(i){if(i.z>this.maxzoom||i.z<this.minzoom||this.bounds&&!Pn(this.bounds,i))return!1;if(!this.extraBounds)return!0;for(const o of this.extraBounds)if(Pn(o,i))return!0;return!1}static fromTileJSON(i){if(!i.bounds&&!i.extra_bounds)return null;const o=new tn(i.bounds,i.minzoom,i.maxzoom);return o.addExtraBounds(i.extra_bounds),o}}class Ss extends a.E{constructor(i,o,u,d){if(super(),this.id=i,this.dispatcher=u,this.type="vector",this.provider=o.provider,this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,Object.assign(this,a.aJ(o,["url","scheme","tileSize","promoteId"])),this._options=Object.assign({type:"vector"},o),this._collectResourceTiming=!!o.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(d),this._tileWorkers={},this._deduped=new a.aN}load(i){this._loaded=!1,this.fire(new a.C("dataloading",{dataType:"source"}));const o=Array.isArray(this.map._language)?this.map._language.join():this.map._language,u=this.map.getWorldview(),d=(_,y)=>{this._tileJSONRequest=null,this._loaded=!0,_?(o&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${o}`),u&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${u}`),this.fire(new a.B(_))):y&&(this._setTileJSON(y),yi(y.tiles,this.map._requestManager._customAccessToken),this.fire(new a.C("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new a.C("data",{dataType:"source",sourceDataType:"content"}))),i&&i(_)};this.provider=this._options.provider;const m=function(_){if("provider"in _&&!_.provider)return null;let y=_.provider;if(!y&&"url"in _&&_.url&&(y=a.aM(_.url)),!y)return null;const v=a.e.TILE_PROVIDER_URLS[y];if(!v)return null;let T;try{T=new URL(v,a.e.API_URL).href}catch{return a.w(`TileProvider "${y}" has an invalid URL: "${v}"`),null}return{name:y,url:T}}(this._options);if(this.provider&&!m)return this._loaded=!0,this.fire(new a.B(new Error(`TileProvider "${this.provider}" is not registered`))),void(i&&i());this._tileJSONRequest=m?this._loadWithProvider(m,d):io(this._options,this.map._requestManager,o,u,d)}_loadWithProvider(i,o){this.provider=i.name;const u=new AbortController,d=this._options.url&&!this._options.tiles?this.map._requestManager.transformRequest(this._options.url,a.R.Source):void 0,m=d?Object.assign({},this._options,{url:d.url}):this._options;return this.dispatcher.broadcast("loadTileProvider",{name:i.name,url:i.url,source:this.id,scope:this.scope,type:this.type,options:m,request:d},(_,y)=>{if(u.signal.aborted)return;if(_)return void o(_);const v=y?y.find(T=>T!=null):null;if(v){const T=Eo(this._options,v,this.map._requestManager);T instanceof Error?o(T):o(null,T)}else o(null,{tiles:this._options.tiles})}),{cancel:()=>{u.abort()}}}_setTileJSON(i){if(Object.assign(this,i),this.hasWorldviews=!!i.worldview_options,i.worldview_default&&(this.worldviewDefault=i.worldview_default),i.vector_layers){this.vectorLayers=i.vector_layers,this.vectorLayerIds=[],this.localizableLayerIds=new Set;for(const o of i.vector_layers)this.vectorLayerIds.push(o.id),i.worldview&&i.worldview[o.source]&&this.localizableLayerIds.add(o.id)}this.tileBounds=tn.fromTileJSON(i)}loaded(){return this._loaded}hasTile(i){return!this.tileBounds||this.tileBounds.contains(i.canonical)}onAdd(i){this.map=i,this.load()}reload(){this.cancelTileJSONRequest();const i=a.F(this.id,this.scope);this.load(()=>this.map.style.clearSource(i))}setTiles(i){return this._options.tiles=i,this.reload(),this}setUrl(i){return this.url=i,this._options.url=i,this.reload(),this}onRemove(i){this.cancelTileJSONRequest()}serialize(){return Object.assign({},this._options)}loadTile(i,o){const u=i.tileID.canonical.url(this.tiles,this.scheme),d=this.map._requestManager.normalizeTileURL(u),m=this.map._requestManager.transformRequest(d,a.R.Tile),_=this.map.style?this.map.style.getLut(this.scope):null,y=_?{image:_.image.clone()}:null,v={request:m,data:void 0,uid:i.uid,tileID:i.tileID,tileZoom:i.tileZoom,zoom:i.tileID.overscaledZ,maxZoom:this.maxzoom,lut:y,tileSize:this.tileSize*i.tileID.overscaleFactor(),type:this.t
8ype,source:this.id,scope:this.scope,pixelRatio:a.o.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,renderSourceType:i.renderSourceType,brightness:this.map.style&&this.map.style.getBrightness()||0,extraShadowCaster:i.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&&a.h(u)&&(v.localizableLayerIds=this.localizableLayerIds),v.request.collectResourceTiming=this._collectResourceTiming,i.actor&&i.state!=="expired")i.state==="loading"?i.reloadCallback=o:i.request=i.actor.send("reloadTile",v,T.bind(this));else if(i.actor=this._tileWorkers[d]=this._tileWorkers[d]||this.dispatcher.getActor(),this.dispatcher.ready||this.provider)i.request=i.actor.send("loadTile",v,T.bind(this),void 0,!0);else{const I=a.aO.call({deduped:this._deduped},v,(M,C)=>{if(M||!C)T.call(this,M);else{const D=a.aP(C.responseHeaders);v.data={rawData:C.rawData.slice(0),expires:D.expires,cacheControl:D.cacheControl},i.actor&&i.actor.send("loadTile",v,T.bind(this),void 0,!0)}},!0);i.request={cancel:I}}function T(I,M){return delete i.request,i.aborted?o(null):I?o(I):(M&&M.resourceTiming&&(i.resourceTiming=M.resourceTiming),this.map._refreshExpiredTiles&&M&&i.setExpiryData(M),i.loadVectorData(M,this.map.painter),a.aQ(this.dispatcher),o(null,M),void(i.reloadCallback&&(this.loadTile(i,i.reloadCallback),i.reloadCallback=null)))}}abortTile(i){i.request&&(i.request.cancel(),delete i.request),i.actor&&i.actor.send("abortTile",{uid:i.uid,type:this.t
8ype,source:this.id,scope:this.scope})}unloadTile(i,o){i.actor&&i.actor.send("removeTile",{uid:i.uid,type:this.type,source:this.id,scope:this.scope}),i.destroy()}hasTransition(){return!1}afterUpdate(){this._tileWorkers={}}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}class fn extends a.E{constructor(i,o,u,d){super(),this.id=i,this.dispatcher=u,this.setEventedParent(d),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=Object.assign({type:"raster"},o),Object.assign(this,a.aJ(o,["url","scheme","tileSize"]))}load(i){this._loaded=!1,this.fire(new a.C("dataloading",{dataType:"source"}));const o=this.map.getWorldview();this._tileJSONRequest=io(this._options,this.map._requestManager,null,o,(u,d)=>{this._tileJSONRequest=null,this._loaded=!0,u?this.fire(new a.B(u)):d&&(Object.assign(this,d),d.raster_layers&&(this.rasterLayers=d.raster_layers,this.rasterLayerIds=this.rasterLayers.map(m=>m.id)),this.tileBounds=tn.fromTileJSON(d),yi(d.tiles),this.fire(new a.C("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new a.C("data",{dataType:"source",sourceDataType:"content"}))),i&&i(u)})}loaded(){return this._loaded}onAdd(i){this.map=i,this.load()}reload(){this.cancelTileJSONRequest();const i=a.F(this.id,this.scope);this.load(()=>this.map.style.clearSource(i))}setTiles(i){return this._options.tiles=i,this.reload(),this}setUrl(i){return this.url=i,this._options.url=i,this.reload(),this}onRemove(i){this.cancelTileJSONRequest()}serialize(){return Object.assign({},this._options)}hasTile(i){return!this.tileBounds||this.tileBounds.contains(i.canonical)}loadTile(i,o){const u=a.o.devicePixelRatio>=2,d=this.map._requestManager.normalizeTileURL(i.tileID.canonical.url(this.tiles,this.scheme),u,this.tileSize);i.request=a.n(this.map._requestManager.transformRequest(d,a.R.Tile),(m,_,y)=>{if(delete i.request,i.aborted)return i.state="unloaded",o(null);if(m)return i.state="errored",o(m);if(!_)return o(null);const v=a.aP(y);this.map._refreshExpiredTiles&&i.setExpiryData(v),i.setTexture(_,this.map.painter),i.state="loaded",a.aQ(this.dispatcher),o(null)})}abortTile(i,o){i.request&&(i.request.cancel(),delete i.request),o&&o()}unloadTile(i,o){i.texture&&i.texture instanceof a.T?(i.destroy(!1),i.texture&&i.texture instanceof a.T&&this.map.painter.saveTileTexture(i.texture)):i.destroy(),o&&o()}hasTransition(){return!1}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}function uf([l,i],o,u,{scaled:d=!0}={}){const{tileSize:m,buffer:_}=u,{x:y,y:v,z:T}=o;if(!isFinite(y)||!isFinite(v)||!isFinite(T))throw new Error("Invalid MRT header");const I=2**T,M=I*a.aH(l),C=I*a.aL(i);return function([D,F],z,{scaled:V=!0}={}){if(!z)throw new Error("bandView is undefined");const{data:N,tileSize:$,buffer:H,offset:j,scale:ne,dimension:Y}=z;if(D<-H||D>$+H||F<-H||F>$+H)throw new Error(`Point (${D}, ${F}) out of bounds for tileSize=${$}, buffer=${H}`);const re=(F+H)*($+2*H)+(D+H);if(new Uint32Array(N.buffer)[re]===4294967295)return null;let Z=[];Z=V?[]:new z.data.constructor(Y);for(let K=0;K<Y;K++)Z[K]=Math.round(1e12*(N[Y*re+K]*ne+j))/1e12;return Z}([Math.min(Math.max(-_,Math.floor((M-y)*m)),m-1+_),Math.min(Math.max(-_,Math.floor((C-v)*m)),m-1+_)],u,{scaled:d})}class Ho extends fn{constructor(i,o,u,d){super(i,o,u,d),this.type="raster-array",this.maxzoom=22,this.partial=!0,this._loadTilePending={},this._loadTileLoaded={},this._options=Object.assign({type:"raster-array"},o)}triggerRepaint(i){const o=this.map.painter._terrain,u=this.map.style.getSourceCache(this.id);o&&o.enabled&&u&&o._clearRenderCacheForTile(u.id,i.tileID),this.map.triggerRepaint()}loadTile(i,o){const u=this.map._requestManager.normalizeTileURL(i.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize),d=this.map._requestManager.transformRequest(u,a.R.Tile),m={request:d,uid:i.uid,tileID:i.tileID,type:this.t
8ype,source:this.id,scope:this.scope,partial:this.partial};i.source=this.id,i.scope=this.scope,i.requestParams=d,i.actor||(i.actor=this.dispatcher.getActor());const _=(y,v,T)=>{if(delete i.request,i.aborted)return i.state="unloaded",o(null);if(y)return y.name==="AbortError"?void 0:(i.state="errored",o(y));if(this.map._refreshExpiredTiles&&v){const I=a.aP(T);i.setExpiryData(I)}if(this.partial&&i.state!=="expired")i.state="empty";else if(!this.partial){if(!v)return o(null);i.state="loaded",i._isHeaderLoaded=!0,i._mrt=v}o(null)};i.request=this.partial?i.fetchHeader(void 0,_.bind(this)):i.actor.send("loadTile",m,_.bind(this),void 0,!0)}abortTile(i){i.request&&(i.request.cancel(),delete i.request),i.actor&&i.actor.send("abortTile",{uid:i.uid,type:this.type,source:this.id,scope:this.scope})}unloadTile(i,o){const u=i.texturePerLayer;if(i.flushAllQueues(),u.size){i.destroy(!1);for(const d of u.values())this.map.painter.saveTileTexture(d)}else i.destroy()}prepareTile(i,o,u,d){i._isHeaderLoaded&&(i.state!=="empty"&&(i.state="reloading"),i.fetchBandForRender(o,u,d,(m,_)=>{m?(i.state="errored",this.fire(new a.B(m))):_&&(i._isHeaderLoaded=!0,i.setTexturePerLayer(u,_,this.map.painter),i.state="loaded"),this.triggerRepaint(i)}))}getInitialBand(i){if(!this.rasterLayers)return 0;const o=this.rasterLayers.find(({id:m})=>m===i),u=o&&o.fields,d=u&&u.bands&&u.bands;return d?d[0]:0}getTextureDescriptor(i,o,u){if(!i)return;const d=o.sourceLayer||this.rasterLayerIds&&this.rasterLayerIds[0];if(!d)return;let m=null;o instanceof a.aT?m=o.paint.get("raster-array-band"):o instanceof a.aU&&(m=o.paint.get("raster-particle-array-band"));const _=m||this.getInitialBand(d);if(_==null)return;if(!i.textureDescriptorPerLayer.get(o.id))return void this.prepareTile(i,d,o.id,_);if(i.updateNeeded(o.id,_)&&!u)return;const y=i.textureDescriptorPerLayer.get(o.id);return Object.assign({},y,{texture:i.texturePerLayer.get(o.id)})}getImages(i,o){const u=new Map;for(const d of i)for(const m of o){const[_,y]=m.split("/"),v=d.getLayer(_);if(!v||!v.hasBand(y)||!v.hasDataForBand(y))continue;const{bytes:T,tileSize:I,buffer:M}=v.getBandView(y),C=I+2*M,D={data:new a.q({width:C,height:C},T),pixelRatio:2,sdf:!1,usvg:!1,version:0};u.set(m,D)}return u}queryRasterArrayValueByBandId(i,o,u){const d=o._mrt;return new Promise(m=>{const _={},y=new Set;for(const[v,T]of Object.entries(d.layers)){if(u.layerName&&v!==u.layerName)continue;const I={};_[v]=I;for(const{bands:M}of T.dataIndex)for(const C of M)u.bands&&!u.bands.includes(C)||(y.add(a.F(v,C)),o.fetchBand(v,null,C,D=>{a.o.frame(()=>{I[C]=D?null:uf([i.lng,i.lat],d,T.getBandView(C)),y.delete(a.F(v,C)),y.size===0&&m(_)})},!1))}y.size===0&&m(_)})}_loadTileForQuery(i,o){if(this._loadTileLoaded[i.uid])return void o(null,i._mrt);if(this._loadTilePending[i.uid])return void this._loadTilePending[i.uid].push(o);this._loadTilePending[i.uid]=[o];const u=this.map._requestManager.normalizeTileURL(i.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize),d=this.map._requestManager.transformRequest(u,a.R.Tile);i.actor.send("loadTile",{request:d,uid:i.uid,tileID:i.tileID,type:this.t
8ype,source:this.id,scope:this.scope,partial:!1},(m,_,y)=>{if(m)return this._loadTilePending[i.uid].forEach(v=>v(m,null)),void delete this._loadTilePending[i.uid];if(!_)return this._loadTilePending[i.uid].forEach(v=>v(null,null)),void delete this._loadTilePending[i.uid];if(this.map._refreshExpiredTiles&&_){const v=a.aP(y);i.setExpiryData(v)}i._mrt=_,i._isHeaderLoaded=!0,i.state="loaded",this._loadTilePending[i.uid].forEach(v=>v(null,_)),this._loadTileLoaded[i.uid]=!0,delete this._loadTilePending[i.uid]},void 0,!0)}queryRasterArrayValueByAllBands(i,o,u){return new Promise((d,m)=>{this._loadTileForQuery(o,(_,y)=>{_?m(_):d(y?this.queryRasterArrayValueByBandId(i,o,u):null)})})}queryRasterArrayValue(i,o){const u=a.aV.convert(i),d=this.findLoadedParent(u);return d&&d._mrt?o.bands||!this.partial?this.queryRasterArrayValueByBandId(u,d,o):this.queryRasterArrayValueByAllBands(u,d,o):Promise.resolve(null)}findLoadedParent(i){const o=a.ag.fromLngLat(i,this.map.transform.tileSize),u=this.maxzoom+1,d=1<<u,m=Math.floor(o.x),_=Math.floor((o.x-m)*d),y=Math.floor(o.y*d),v=this.map.style.getSourceCache(this.id),T=new a.aS(u,m,u,_,y);return v.findLoadedParent(T,this.minzoom)}}const _c={vector:Ss,raster:fn,"raster-dem":class extends fn{constructor(l,i,o,u){super(l,i,o,u),this.type="raster-dem",this.maxzoom=22,this._options=Object.assign({type:"raster-dem"},i),this.encoding=i.encoding||"mapbox"}loadTile(l,i){const o=this.map._requestManager.normalizeTileURL(l.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize);function u(d,m){d&&(l.state="errored",i(d)),m&&(l.dem=m,l.dem.onDeserialize(),l.needsHillshadePrepare=!0,l.needsDEMTextureUpload=!0,l.state="loaded",i(null))}l.request=a.n(this.map._requestManager.transformRequest(o,a.R.Tile),(function(d,m,_){if(delete l.request,l.aborted)l.state="unloaded",i(null);else if(d)l.state="errored",i(d);else if(m){const y=a.aP(_);this.map._refreshExpiredTiles&&l.setExpiryData(y);const v=a.y(),T=1-(m.width-a.aR(m.width))/2;T<1||l.neighboringTiles||(l.neighboringTiles=this._getNeighboringTiles(l.tileID));const I=v?m:a.o.getImageData(m,T),M={uid:l.uid,tileID:l.tileID,source:this.id,type:this.t
8ype,scope:this.scope,rawImageData:I,encoding:this.encoding,padding:T};l.actor&&l.state!=="expired"||(l.actor=this.dispatcher.getActor(),l.actor.send("loadTile",M,u.bind(this),void 0,!0))}}).bind(this))}_getNeighboringTiles(l){const i=l.canonical,o=Math.pow(2,i.z),u=(i.x-1+o)%o,d=i.x===0?l.wrap-1:l.wrap,m=(i.x+1+o)%o,_=i.x+1===o?l.wrap+1:l.wrap,y={};return y[new a.aS(l.overscaledZ,d,i.z,u,i.y).key]={backfilled:!1},y[new a.aS(l.overscaledZ,_,i.z,m,i.y).key]={backfilled:!1},i.y>0&&(y[new a.aS(l.overscaledZ,d,i.z,u,i.y-1).key]={backfilled:!1},y[new a.aS(l.overscaledZ,l.wrap,i.z,i.x,i.y-1).key]={backfilled:!1},y[new a.aS(l.overscaledZ,_,i.z,m,i.y-1).key]={backfilled:!1}),i.y+1<o&&(y[new a.aS(l.overscaledZ,d,i.z,u,i.y+1).key]={backfilled:!1},y[new a.aS(l.overscaledZ,l.wrap,i.z,i.x,i.y+1).key]={backfilled:!1},y[new a.aS(l.overscaledZ,_,i.z,m,i.y+1).key]={backfilled:!1}),y}},"raster-array":Ho,geojson:class extends a.E{constructor(l,i,o,u){super(),this.id=l,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._loaded=!1,this.actor=o.getActor(),this.setEventedParent(u),this._data=i.data,this._options=Object.assign({},i),this._collectResourceTiming=i.collectResourceTiming,i.maxzoom!==void 0&&(this.maxzoom=i.maxzoom),i.minzoom!==void 0&&(this.minzoom=i.minzoom),i.type&&(this.type=i.type),i.attribution&&(this.attribution=i.attribution),this.promoteId=i.promoteId;const d=a.an/this.tileSize;this.workerOptions=Object.assign({source:this.id,scope:this.scope,cluster:i.cluster||!1,geojsonVtOptions:{buffer:(i.buffer!==void 0?i.buffer:128)*d,tolerance:(i.tolerance!==void 0?i.tolerance:.375)*d,extent:a.an,maxZoom:this.maxzoom,lineMetrics:i.lineMetrics||!1,generateId:i.generateId||!1},superclusterOptions:{maxZoom:i.clusterMaxZoom!==void 0?i.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,i.clusterMinPoints||2),extent:a.an,radius:(i.clusterRadius!==void 0?i.clusterRadius:50)*d,log:!1,generateId:i.generateId||!1},clusterProperties:i.clusterProperties,filter:i.filter,dynamic:i.dynamic},i.workerOptions)}onAdd(l){this.map=l,this.setData(this._data)}setData(l){return this._data=l,this._updateWorkerData(),this}updateData(l){if(!this._options.dynamic)return this.fire(new a.B(new Error("Can't call updateData on a GeoJSON source with dynamic set to false.")));if(typeof l!="string"&&(l.type==="Feature"&&(l={type:"FeatureCollection",features:[l]}),l.type!=="FeatureCollection"))return this.fire(new a.B(new Error("Data to update should be a feature or a feature collection.")));if(this._coalesce&&typeof l!="string"&&typeof this._data!="string"&&this._data.type==="FeatureCollection"){const i=new Map;for(const o of this._data.features)i.set(o.id,o);for(const o of l.features)i.set(o.id,o);this._data.features=[...i.values()]}else this._data=l;return this._updateWorkerData(!0),this}getClusterExpansionZoom(l,i){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:l,source:this.id,scope:this.scope},i),this}getClusterChildren(l,i){return this.actor.send("geojson.getClusterChildren",{clusterId:l,source:this.id,scope:this.scope},i),this}getClusterLeaves(l,i,o,u){return this.actor.send("geojson.getClusterLeaves",{source:this.id,scope:this.scope,clusterId:l,limit:i,offset:o},u),this}_updateWorkerData(l=!1){if(this._pendingLoad)return void(this._coalesce=!0);this.fire(new a.C("dataloading",{dataType:"source"})),this._loaded=!1;const i=Object.assign({append:l},this.workerOptions);i.scope=this.scope;const o=this._data;typeof o=="string"?(i.request=this.map._requestManager.transformRequest(a.o.resolveURL(o),a.R.Source),i.request.collectResourceTiming=this._collectResourceTiming):i.data=JSON.stringify(o),this._pendingLoad=this.actor.send(`${this.type}.loadData`,i,(u,d)=>{if(this._loaded=!0,this._pendingLoad=null,u)this.fire(new a.B(u));else{const m={dataType:"source",sourceDataType:this._metadataFired?"content":"metadata"};this._collectResourceTiming&&d&&d.resourceTiming&&d.resourceTiming[this.id]&&(m.resourceTiming=d.resourceTiming[this.id]),l&&(this._partialReload=!0),this.fire(new a.C("data",m)),this._partialReload=!1,this._metadataFired=!0}this._coalesce&&(this._updateWorkerData(l),this._coalesce=!1)})}loaded(){return this._loaded}reload(){const l=a.F(this.id,this.scope);this.map.style.clearSource(l),this._updateWorkerData()}loadTile(l,i){const o=l.actor?"reloadTile":"loadTile";l.actor=this.actor;const u=this.map.style?this.map.style.getLut(this.scope):null,d=u?{image:u.image.clone()}
8:null,m=this._partialReload,_={type:this.type,uid:l.uid,tileID:l.tileID,tileZoom:l.tileZoom,zoom:l.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,lut:d,scope:this.scope,pixelRatio:a.o.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,brightness:this.map.style&&this.map.style.getBrightness()||0,extraShadowCaster:l.isExtraShadowCaster,scaleFactor:this.map.getScaleFactor(),partial:m,worldview:this.map.getWorldview(),indoor:this.map.getIndoorTileOptions(this.id,this.scope)};l.request=this.actor.send(o,_,(y,v)=>m&&!v?(l.state="loaded",i(null)):(delete l.request,l.destroy(!1),l.aborted?i(null):y?i(y):(l.loadVectorData(v,this.map.painter,o==="reloadTile"),i(null))),void 0,o==="loadTile")}abortTile(l){l.request&&(l.request.cancel(),delete l.request),l.aborted=!0}unloadTile(l,i){this.actor.send("removeTile",{uid:l.uid,type:this.type,source:this.id,scope:this.scope}),l.destroy()}onRemove(l){this._pendingLoad&&this._pendingLoad.cancel()}serialize(){return Object.assign({}
8,this._options,{type:this.type,data:this._data})}hasTransition(){return!1}},video:class extends a.aW{constructor(l,i,o,u){super(l,i,o,u),this.roundZoom=!0,this.type="video",this.options=i}load(){this._loaded=!1;const l=this.options;this.urls=[];for(const i of l.urls)this.urls.push(this.map._requestManager.transformRequest(i,a.R.Source).url);a.aX(this.urls,(i,o)=>{this._loaded=!0,i?this.fire(new a.B(i)):o&&(this.video=o,this.video.loop=!0,this.video.setAttribute("playsinline",""),this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading())})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(l){if(this.video){const i=this.video.seekable;l<i.start(0)||l>i.end(0)?this.fire(new a.B(new a.V(`sources.${this.id}`,null,`Playback for this video can be set only between the ${i.start(0)} and ${i.end(0)}-second mark.`))):this.video.currentTime=l}}getVideo(){return this.video}onAdd(l){this.map||(this.map=l,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 l=this.map.painter.context,i=l.gl;this.texture?this.video.paused||(this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE),i.texSubImage2D(i.TEXTURE_2D,0,0,0,i.RGBA,i.UNSIGNED_BYTE,this.video)):(this.texture=new a.T(l,this.video,i.RGBA8),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE),this.width=this.video.videoWidth,this.height=this.video.videoHeight),this._prepareData(l)}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}},image:a.aW,model:a.aZ,"batched-model":class extends a.E{constructor(l,i,o,u){super(),this.type="batched-model",this.id=l,this.tileSize=512,this._options=i,this.tiles=this._options.tiles,this.maxzoom=i.maxzoom||19,this.minzoom=i.minzoom||0,this.roundZoom=!0,this.usedInConflation=!0,this.dispatcher=o,this.reparseOverscaled=!1,this.scheme="xyz",this._loaded=!1,this.setEventedParent(u)}onAdd(l){this.map=l,this.load()}reload(){this.cancelTileJSONRequest();const l=a.F(this.id,this.scope);this.load(()=>this.map.style.clearSource(l))}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}load(l){this._loaded=!1,this.fire(new a.C("dataloading",{dataType:"source"}));const i=Array.isArray(this.map._language)?this.map._language.join():this.map._language,o=this.map.getWorldview();this._tileJSONRequest=io(this._options,this.map._requestManager,i,o,(u,d)=>{this._tileJSONRequest=null,this._loaded=!0,u?(i&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${i}`),o&&o.length!==2&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${o}`),this.fire(new a.B(u))):d&&(Object.assign(this,d),d.bounds&&(this.tileBounds=new tn(d.bounds,this.minzoom,this.maxzoom)),yi(d.tiles,this.map._requestManager._customAccessToken),this.fire(new a.C("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new a.C("data",{dataType:"source",sourceDataType:"content"}))),l&&l(u)})}hasTransition(){return!1}hasTile(l){return!this.tileBounds||this.tileBounds.contains(l.canonical)}loaded(){return this._loaded}loadTile(l,i){const o=this.map._requestManager.normalizeTileURL(l.tileID.canonical.url(this.tiles,this.scheme)),u={request:this.map._requestManager.transformRequest(o,a.R.Tile),data:void 0,uid:l.uid,tileID:l.tileID,tileZoom:l.tileZoom,zoom:l.tileID.overscaledZ,tileSize:this.tileSize*l.tileID.overscaleFactor(),type:this.t
8ype,source:this.id,scope:this.scope,showCollisionBoxes:this.map.showCollisionBoxes,renderSourceType:l.renderSourceType,brightness:this.map.style&&this.map.style.getBrightness()||0,pixelRatio:a.o.devicePixelRatio,promoteId:this.promoteId};if(l.actor&&l.state!=="expired")if(l.state==="loading")l.reloadCallback=i;else{if(l.buckets){const m=Object.values(l.buckets);for(const _ of m)_.dirty=!0;return void(l.state="loaded")}l.request=l.actor.send("reloadTile",u,d.bind(this))}else l.actor=this.dispatcher.getActor(),l.request=l.actor.send("loadTile",u,d.bind(this),void 0,!0);function d(m,_){return l.aborted?i(null):m&&m.status!==404?i(m):(this.map._refreshExpiredTiles&&_&&l.setExpiryData(_),l.loadModelData(_,this.map.painter),l.state="loaded",void i(null))}}serialize(){return Object.assign({},this._options)}},canvas:class extends a.aW{constructor(l,i,o,u){super(l,i,o,u),i.coordinates?Array.isArray(i.coordinates)&&i.coordinates.length===4&&!i.coordinates.some(d=>!Array.isArray(d)||d.length!==2||d.some(m=>typeof m!="number"))||this.fire(new a.B(new a.V(`sources.${l}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new a.B(new a.V(`sources.${l}`,null,'missing required property "coordinates"'))),i.animate&&typeof i.animate!="boolean"&&this.fire(new a.B(new a.V(`sources.${l}`,null,'optional "animate" property must be a boolean value'))),i.canvas?typeof i.canvas=="string"||i.canvas instanceof HTMLCanvasElement||this.fire(new a.B(new a.V(`sources.${l}`,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 a.B(new a.V(`sources.${l}`,null,'missing required property "canvas"'))),this.options=i,this.animate=i.animate===void 0||i.animate}load(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new a.B(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(l){this.map=l,this.load(),this.canvas&&this.animate&&this.play()}onRemove(l){this.pause()}prepare(){let l=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,l=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,l=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const i=this.map.painter.context;this.texture?!l&&!this._playing||this.texture instanceof a.aY||this.texture.update(this.canvas,{premultiply:!0}):this.texture=new a.T(i,this.canvas,i.gl.RGBA8,{premultiply:!0}),this._prepareData(i)}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const l of[this.canvas.width,this.canvas.height])if(isNaN(l)||l<=0)return!0;return!1}},custom:class extends a.E{constructor(l,i,o,u){super(),this.id=l,this.type="custom",this._dataType="raster",this._dispatcher=o,this._implementation=i,this.setEventedParent(u),this.scheme="xyz",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this._loaded=!1,this.roundZoom=!0,this._implementation||this.fire(new a.B(new Error(`Missing implementation for ${this.id} custom source`))),this._implementation.loadTile||this.fire(new a.B(new Error(`Missing loadTile implementation for ${this.id} custom source`))),this._implementation.bounds&&(this.tileBounds=new tn(this._implementation.bounds,this.minzoom,this.maxzoom));const d=i;d.update=this._update.bind(this),d.clearTiles=this._clearTiles.bind(this),d.coveringTiles=this._coveringTiles.bind(this),Object.assign(this,a.aJ(i,["dataType","scheme","minzoom","maxzoom","tileSize","attribution","minTileCacheSize","maxTileCacheSize"]))}serialize(){return a.aJ(this,["type","scheme","minzoom","maxzoom","tileSize","attribution"])}load(){this._loaded=!0,this.fire(new a.C("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new a.C("data",{dataType:"source",sourceDataType:"content"}))}loaded(){return this._loaded}onAdd(l){this.map=l,this._loaded=!1,this.fire(new a.C("dataloading",{dataType:"source"})),this._implementation.onAdd&&this._implementation.onAdd(l),this.load()}onRemove(l){this._implementation.onRemove&&this._implementation.onRemove(l)}hasTile(l){if(this._implementation.hasTile){const{x:i,y:o,z:u}=l.canonical;return this._implementation.hasTile({x:i,y:o,z:u})}return!this.tileBounds||this.tileBounds.contains(l.canonical)}loadTile(l,i){const{x:o,y:u,z:d}
8=l.tileID.canonical,m=new AbortController,_=Promise.resolve(this._implementation.loadTile({x:o,y:u,z:d},{signal:m.signal})).then((function(y){return delete l.request,l.aborted?(l.state="unloaded",i(null)):y===void 0?(l.state="errored",i(null)):y===null?(this.loadTileData(l,{width:this.tileSize,height:this.tileSize,data:null}),l.state="loaded",i(null)):function(v){return v instanceof ImageData||v instanceof HTMLCanvasElement||v instanceof ImageBitmap||v instanceof HTMLImageElement}(y)?(this.loadTileData(l,y),l.state="loaded",void i(null)):(l.state="errored",i(new Error(`Can't infer data type for ${this.id}, only raster data supported at the moment`)))}).bind(this)).catch(y=>{y.name!=="AbortError"&&(l.state="errored",i(y))});_.cancel=()=>m.abort(),l.request=_}loadTileData(l,i){l.setTexture(i,this.map.painter)}unloadTile(l,i){if(l.texture&&l.texture instanceof a.T?(l.destroy(!1),l.texture&&l.texture instanceof a.T&&this.map.painter.saveTileTexture(l.texture)):l.destroy(),this._implementation.unloadTile){const{x:o,y:u,z:d}=l.tileID.canonical;this._implementation.unloadTile({x:o,y:u,z:d})}i&&i()}abortTile(l,i){l.request&&l.request.cancel&&(l.request.cancel(),delete l.request),i&&i()}hasTransition(){return!1}_coveringTiles(){return this.map.transform.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,roundZoom:this.roundZoom}).map(l=>({x:l.canonical.x,y:l.canonical.y,z:l.canonical.z}))}_clearTiles(){const l=a.F(this.id,this.scope);this.map.style.clearSource(l)}_update(){this.fire(new a.C("data",{dataType:"source",sourceDataType:"content"}))}}},gc=function(l,i,o,u){const d=new _c[i.type](l,i,o,u);if(d.id!==l)throw new Error(`Expected Source id to be ${l} instead of ${d.id}`);return a.a_(["load","abort","unload","serialize","prepare"],d),d};function Qu(l,i,o=""){return`${o}:${i.id||""}:${i.layer.id}:${function(u){if("layerId"in u)return`layer:${u.layerId}`;{const{featuresetId:d,importId:m}=u;return`featureset:${d}${m?`:import:${m}`:""}`}}(l.target)}`}function Ju(l,i,o,u=""){if(l.uniqueFeatureID){const d=Qu(l,i,u);if(o.has(d))return!0;o.add(d)}return!1}function Ao(l,i,o,u,d=!1,m=void 0){const _=i.sourceCache.transform,y=i.sourceCache.tilesIn(l,i.has3DLayers,d);y.sort(xc);const v=[];for(const T of y){const I=T.tile.queryRenderedFeatures(i,T,o,u,_,d,m);Object.keys(I).length&&v.push({wrappedTileID:T.tile.tileID.wrapped().key,queryResults:I})}for(const T in i.layers){const I=i.layers[T];if(I.styleLayer){const M=I.styleLayer.queryRenderedFeatures(l,i.sourceCache,u);Object.keys(M).length&&v.push({wrappedTileID:0,queryResults:M})}}return v.length===0?{}:function(T){const I={},M={};for(const C of T){const D=C.queryResults,F=C.wrappedTileID,z=M[F]=M[F]||{};for(const V in D){const N=D[V],$=z[V]=z[V]||{},H=I[V]=I[V]||[];for(const j of N)$[j.featureIndex]||($[j.featureIndex]=!0,H.push(j))}}return I}(v)}function hf(l,i,o,u,d,m){const _={},y=u.queryRenderedSymbols(l),v=[];for(const T of Object.keys(y).map(Number))v.push(d[T]);v.sort(xc);for(const T of v){const I=T.featureIndex.lookupSymbolFeatures(y[T.bucketInstanceId],T.bucketIndex,T.sourceLayerIndex,i,o,m);for(const M in I){const C=_[M]=_[M]||[],D=I[M];D.sort((F,z)=>{const V=T.featureSortOrder;if(V){const N=V.indexOf(F.featureIndex);return V.indexOf(z.featureIndex)-N}return z.featureIndex-F.featureIndex});for(const F of D)C.push(F)}}return _}function yc(l,i){const o=l.getRenderableIds().map(m=>l.getTileByID(m)),u=[],d={};for(let m=0;m<o.length;m++){const _=o[m],y=_.tileID.canonical.key;d[y]||(d[y]=!0,_.querySourceFeatures(u,i))}return u}function xc(l,i){const o=l.tileID,u=i.tileID;return o.overscaledZ-u.overscaledZ||o.canonical.y-u.canonical.y||o.wrap-u.wrap||o.canonical.x-u.canonical.x}a.a$.setPbf(a.b0);class tl extends a.b1{constructor(i,o,u,d,m){super(i,o,u,d,m),this._workQueuePerLayer=new Map,this._fetchQueuePerLayer=new Map,this._taskQueue=new Map,this._isHeaderLoaded=!1,this.textureDescriptorPerLayer=new Map,this.texturePerLayer=new Map}getLayers(){return this._mrt?Object.values(this._mrt.layers):[]}getLayer(i){return this._mrt&&this._mrt.getLayer(i)}setTexturePerLayer(i,o,u){const d=u.context,m=d.gl;let _=this.texturePerLayer.get(i)||u.getTileTexture(o.width);_&&_ instanceof a.T?_.update(o,{premultiply:!1}):_=new a.T(d,o,m.RGBA8,{premultiply:!1}),this.texturePerLayer.has(i)||this.texturePerLayer.set(i,_)}flushQueues(i){const o=this._workQueuePerLayer.get(i)||[],u=this._fetchQueuePerLayer.get(i)||[];for(;o.length;)o.pop()();for(;u.length;)u.pop()()}flushAllQueues(){for(const i of this._workQueuePerLayer.keys()){const o=this._workQueuePerLayer.get(i)||[];for(;o.length;)o.pop()()}for(const i of this._fetchQueuePerLayer.keys()){const o=this._fetchQueuePerLayer.get(i)||[];for(;o.length;)o.pop()()}}fetchHeader(i=16384,o){const u=this._mrt=new a.a$(30),d=Object.assign({}
8,this.requestParams,{headers:{Range:"bytes=0-"+(i-1)}});return this.entireBuffer=null,this.request=a.b2(d,(m,_,y)=>{if(m)o(m);else try{const v=u.getHeaderLength(_);if(v>i)return void(this.request=this.fetchHeader(v,o));u.parseHeader(_),this._isHeaderLoaded=!0;let T=0;for(const I of Object.values(u.layers))T=Math.max(T,I.dataIndex[I.dataIndex.length-1].lastByte);_.byteLength>=T&&(this.entireBuffer=_),o(null,this.entireBuffer||_,y)}catch(v){o(v)}}),this.request}fetchBandForRender(i,o,u,d){this.fetchBand(i,o,u,m=>{if(m)return void d(m);this.updateTextureDescriptor(i,o,u);const _=this.textureDescriptorPerLayer.get(o);d(null,_?_.img:null)})}fetchBand(i,o,u,d,m=!0){const _=this._mrt;if(!this._isHeaderLoaded||!_)return void d(new Error("Tile header is not ready"));const y=this.actor;if(!y)return void d(new Error("Can't fetch tile band without an actor"));let v;const T=a.F(String(u),a.F(this.tileID.key,i));let I=this._taskQueue.get(T);I?I.add(d):(I=new Set,I.add(d),this._taskQueue.set(T,I));const M=(z,V)=>{v.complete(z,V),z?d(z):(I.forEach(N=>N(null,V)),this._taskQueue.delete(T))},C=(z,V)=>{if(z)return d(z);const N=y.send("decodeRasterArray",{type:"raster-array",source:this.source,scope:this.scope,tileID:this.tileID,uid:this.uid,buffer:V,task:v},M,void 0,!0);if(o!==null){const $=this._workQueuePerLayer.get(o)||[];$.push(()=>{N&&N.cancel(),v.cancel()}),this._workQueuePerLayer.has(o)||this._workQueuePerLayer.set(o,$)}};let D;try{D=_.getLayer(i)}catch(z){if(this.state==="reloading")return;throw z}if(!D)return void d(new Error(`Unknown sourceLayer "${i}"`));if(D.hasDataForBand(u))return I.forEach(z=>z(null,null)),void this._taskQueue.delete(T);const F=D.getDataRange([u]);if(v=_.createDecodingTask(F),!v||v.tasks.length)if(o!==null&&this.flushQueues(o),this.entireBuffer)C(null,this.entireBuffer.slice(F.firstByte,F.lastByte+1));else{const z=Object.assign({},this.requestParams,{headers:{Range:`bytes=${F.firstByte}-${F.lastByte}`}}),V=a.b2(z,C);if(o!==null){const N=this._fetchQueuePerLayer.get(o)||[];N.push(()=>{V.cancel(),v.cancel()}),this._fetchQueuePerLayer.has(o)||this._fetchQueuePerLayer.set(o,N)}}}updateNeeded(i,o){return(!this.textureDescriptorPerLayer.get(i)||this.textureDescriptorPerLayer.get(i).band!==o||this.refreshedUponExpiration)&&this.state!=="errored"}updateTextureDescriptor(i,o,u){if(!this._mrt)return;const d=this._mrt.getLayer(i);if(!d||!d.hasBand(u)||!d.hasDataForBand(u))return;const{bytes:m,tileSize:_,buffer:y,offset:v,scale:T}=d.getBandView(u),I=_+2*y,M=new a.q({width:I,height:I},m),C=this.texturePerLayer.get(o);C&&C instanceof a.T&&C.update(M,{premultiply:!1}),this.textureDescriptorPerLayer.set(o,{layer:i,band:u,img:M,buffer:y,offset:v,tileSize:_,format:d.pixelFormat,mix:[T,256*T,65536*T,16777216*T]})}destroy(i=!1){if(super.destroy(i),delete this._mrt,!i)for(const o of this.texturePerLayer.values())o&&o instanceof a.T&&o.destroy();this.texturePerLayer.clear(),this.textureDescriptorPerLayer.clear(),this.fbo&&(this.fbo.destroy(),delete this.fbo),delete this.request,delete this.requestParams,this._isHeaderLoaded=!1}}class il{constructor(i,o){this.max=i,this.onRemove=o,this.reset()}reset(){for(const i in this.data)for(const o of this.data[i])o.timeout&&clearTimeout(o.timeout),this.onRemove(o.value);return this.data={},this.order=[],this}add(i,o,u){const d=i.wrapped().key;this.data[d]===void 0&&(this.data[d]=[]);const m={value:o,timeout:void 0};if(u!==void 0&&(m.timeout=setTimeout(()=>{this.remove(i,m)},u)),this.data[d].push(m),this.order.push(d),this.order.length>this.max){const _=this._getAndRemoveByKey(this.order[0]);_&&this.onRemove(_)}return this}has(i){return i.wrapped().key in this.data}getAndRemove(i){return this.has(i)?this._getAndRemoveByKey(i.wrapped().key):null}_getAndRemoveByKey(i){const o=this.data[i].shift();return o.timeout&&clearTimeout(o.timeout),this.data[i].length===0&&delete this.data[i],this.order.splice(this.order.indexOf(i),1),o.value}getByKey(i){const o=this.data[i];return o?o[0].value:null}get(i){return this.has(i)?this.data[i.wrapped().key][0].value:null}remove(i,o){if(!this.has(i))return this;const u=i.wrapped().key,d=o===void 0?0:this.data[u].indexOf(o),m=this.data[u][d];return this.data[u].splice(d,1),m.timeout&&clearTimeout(m.timeout),this.data[u].length===0&&delete this.data[u],this.onRemove(m.value),this.order.splice(this.order.indexOf(u),1),this}setMaxSize(i){for(this.max=i;this.order.length>this.max;){const o=this._getAndRemoveByKey(this.order[0]);o&&this.onRemove(o)}return this}filter(i){const o=[];for(const u in this.data)for(const d of this.data[u])i(d.value)||o.push(d);for(const u of o)this.remove(u.value.tileID,u)}}class Js{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(i,o,u){const d=String(o);if(this.stateChanges[i]=this.stateChanges[i]||{},this.stateChanges[i][d]=this.stateChanges[i][d]||{},Object.assign(this.stateChanges[i][d],u),this.deletedStates[i]===null){this.deletedStates[i]={};for(const m in this.state[i])m!==d&&(this.deletedStates[i][m]=null)}else if(this.deletedStates[i]&&this.deletedStates[i][d]===null){this.deletedStates[i][d]={};for(const m in this.state[i][d])u[m]||(this.deletedStates[i][d][m]=null)}else for(const m in u)this.deletedStates[i]&&this.deletedStates[i][d]&&this.deletedStates[i][d][m]===null&&delete this.deletedStates[i][d][m]}removeFeatureState(i,o,u){if(this.deletedStates[i]===null)return;const d=String(o);if(this.deletedStates[i]=this.deletedStates[i]||{},u&&o!==void 0)this.deletedStates[i][d]!==null&&(this.deletedStates[i][d]=this.deletedStates[i][d]||{},this.deletedStates[i][d][u]=null);else if(o!==void 0)if(this.stateChanges[i]&&this.stateChanges[i][d])for(u in this.deletedStates[i][d]={},this.stateChanges[i][d])this.deletedStates[i][d][u]=null;else this.deletedStates[i][d]=null;else this.deletedStates[i]=null}getState(i,o){const u=this.state[i]||{},d=this.stateChanges[i]||{},m=this.deletedStates[i];if(m===null)return{};if(o!==void 0){const y=String(o),v=Object.assign({},u[y],d[y]);if(m){const T=m[o];if(T===null)return{};for(const I in T)delete v[I]}return v}const _=Object.assign({},u,d);if(m)for(const y in m)delete _[y];return _}
8initializeTileState(i,o){i.refreshFeatureState(o)}coalesceChanges(i,o){const u={};for(const d in this.stateChanges){this.state[d]=this.state[d]||{};const m={};for(const _ in this.stateChanges[d])this.state[d][_]||(this.state[d][_]={}),Object.assign(this.state[d][_],this.stateChanges[d][_]),m[_]=this.state[d][_];u[d]=m}for(const d in this.deletedStates){this.state[d]=this.state[d]||{};const m={};if(this.deletedStates[d]===null)for(const _ in this.state[d])m[_]={},this.state[d][_]={};else for(const _ in this.deletedStates[d]){if(this.deletedStates[d][_]===null)this.state[d][_]={};else if(this.state[d][_])for(const y of Object.keys(this.deletedStates[d][_]))delete this.state[d][_][y];m[_]=this.state[d][_]}u[d]=u[d]||{},Object.assign(u[d],m)}if(this.stateChanges={},this.deletedStates={},Object.keys(u).length!==0)for(const d in i)i[d].refreshFeatureState(o,u)}}class pn extends a.E{constructor(i,o,u){super(),this.id=i,this._renderSourceType=u,this._maxzoomOverride=null,o.on("data",d=>{d.dataType==="source"&&d.sourceDataType==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&d.dataType==="source"&&d.sourceDataType==="content"&&(this.reload(),this.transform&&this.update(this.transform))}),o.on("error",()=>{this._sourceErrored=!0}),this._source=o,this._tiles={},this._cache=new il(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._minTileCacheSize=o.minTileCacheSize,this._maxTileCacheSize=o.maxTileCacheSize,this._loadedParentTiles={},this.castsShadows=!1,this.tileCoverLift=0,this._coveredTiles={},this._shadowCasterTiles={},this._state=new Js,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(i){this.map=i,this._minTileCacheSize=this._minTileCacheSize===void 0&&i?i._minTileCacheSize:this._minTileCacheSize,this._maxTileCacheSize=this._maxTileCacheSize===void 0&&i?i._maxTileC
vendor: 18,047 bytes, line 8
8acheSize:this._maxTileCacheSize}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;for(const i in this._tiles)if(!this._tiles[i].loaded())return!1;return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const i=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,i&&this.reload(),this.transform&&this.update(this.transform)}setMaxzoomOverride(i){this._maxzoomOverride=i}_loadTile(i,o){return i.renderSourceType=this._renderSourceType,i.isExtraShadowCaster=this._shadowCasterTiles[i.tileID.key],this._source.loadTile(i,o)}_unloadTile(i){if(this._source.unloadTile)return this._source.unloadTile(i)}_abortTile(i){if(this._source.abortTile)return this._source.abortTile(i)}serialize(){return this._source.serialize()}prepare(i){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const o in this._tiles){const u=this._tiles[o];u.upload(i,this.map?this.map.painter:void 0),u.prepare(this.map.style.imageManager,this.map?this.map.painter:null,this._source.scope)}}getIds(){return Object.values(this._tiles).map(i=>i.tileID).sort(eh).map(i=>i.key)}getRenderableIds(i,o){const u=[];for(const d in this._tiles)this._isIdRenderable(+d,i,o)&&u.push(this._tiles[d]);return i?u.sort((d,m)=>{const _=d.tileID,y=m.tileID,v=new a.P(_.canonical.x,_.canonical.y)._rotate(this.transform.angle),T=new a.P(y.canonical.x,y.canonical.y)._rotate(this.transform.angle);return _.overscaledZ-y.overscaledZ||T.y-v.y||T.x-v.x}).map(d=>d.tileID.key):u.map(d=>d.tileID).sort(eh).map(d=>d.key)}hasRenderableParent(i){const o=this.findLoadedParent(i,0);return!!o&&this._isIdRenderable(o.tileID.key)}_isIdRenderable(i,o,u){return this._tiles[i]&&this._tiles[i].hasData()&&!this._coveredTiles[i]&&(o||!this._tiles[i].holdingForFade())&&(u||!this._shadowCasterTiles[i])}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const i in this._tiles)this._tiles[i].state!=="errored"&&this._reloadTile(+i,"reloading")}}_reloadTile(i,o){const u=this._tiles[i];u&&(u.state!=="loading"&&(u.state=o),this._loadTile(u,this._tileLoaded.bind(this,u,i,o)))}_tileLoaded(i,o,u,d,m){if(d){if(i.state="errored",a.b3(d)){if(this._source.fire(new a.C("data",{dataType:"source",sourceDataType:"error",sourceId:this._source.id,tile:i})),!(i.tileID.key in this._loadedParentTiles))return;if(this._source.type==="raster-dem"&&this.usedForTerrain&&this.map.painter.terrain){const y=this.map.painter.terrain;this.update(this.transform,y.getScaledDemTileSize(),!0),y.resetTileLookupCache(this.id)}else this.update(this.transform)}else this._source.fire(new a.B(d,{tile:i}));return}i.timeAdded=a.o.now(),u==="expired"&&(i.refreshedUponExpiration=!0),this._setTileReloadTimer(o,i),this._source.type==="raster-dem"&&i.dem&&this._backfillDEM(i),this._state.initializeTileState(i,this.map?this.map.painter:null);let _=new Map;m&&m.responseHeaders&&(_=m.responseHeaders),this._source.fire(new a.C("data",{dataType:"source",tile:i,coord:i.tileID,sourceCacheId:this.id,responseHeaders:_}))}_backfillDEM(i){const o=this.getRenderableIds();for(let d=0;d<o.length;d++){const m=o[d];if(i.neighboringTiles&&i.neighboringTiles[m]){const _=this.getTileByID(m);u(i,_),u(_,i)}}function u(d,m){if(!d.dem||d.dem.borderReady)return;d.needsHillshadePrepare=!0,d.needsDEMTextureUpload=!0;let _=m.tileID.canonical.x-d.tileID.canonical.x;const y=m.tileID.canonical.y-d.tileID.canonical.y,v=Math.pow(2,d.tileID.canonical.z),T=m.tileID.key;_===0&&y===0||Math.abs(y)>1||(Math.abs(_)>1&&(Math.abs(_+v)===1?_+=v:Math.abs(_-v)===1&&(_-=v)),m.dem&&d.dem&&(d.dem.backfillBorder(m.dem,_,y),d.neighboringTiles&&d.neighboringTiles[T]&&(d.neighboringTiles[T].backfilled=!0)))}}getTile(i){return this.getTileByID(i.key)}getTileByID(i){return this._tiles[i]}_retainLoadedChildren(i,o,u,d){for(const m in this._tiles){let _=this._tiles[m];if(d[m]||!_.hasData()||_.tileID.overscaledZ<=o||_.tileID.overscaledZ>u)continue;let y=_.tileID;for(;_&&_.tileID.overscaledZ>o+1;){const T=_.tileID.scaledTo(_.tileID.overscaledZ-1);_=this._tiles[T.key],_&&_.hasData()&&(y=T)}let v=y;for(;v.overscaledZ>o;)if(v=v.scaledTo(v.overscaledZ-1),i[v.key]){d[y.key]=y;break}}}findLoadedParent(i,o){if(i.key in this._loadedParentTiles){const u=this._loadedParentTiles[i.key];return u&&u.tileID.overscaledZ>=o?u:null}for(let u=i.overscaledZ-1;u>=o;u--){const d=i.scaledTo(u),m=this._getLoadedTile(d);if(m)return m}}_getLoadedTile(i){const o=this._tiles[i.key];return o&&o.hasData()?o:this._cache.getByKey(this._source.reparseOverscaled?i.wrapped().key:i.canonical.key)}updateCacheSize(i,o){o=o||this._source.tileSize;const u=Math.ceil(i.width/o)+1,d=Math.ceil(i.height/o)+1,m=Math.floor(u*d*5),_=typeof this._minTileCacheSize=="number"?Math.max(this._minTileCacheSize,m):m,y=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,_):_;this._cache.setMaxSize(y)}handleWrapJump(i){const o=Math.round((i-(this._prevLng===void 0?i:this._prevLng))/360);if(this._prevLng=i,o){const u={};for(const d in this._tiles){const m=this._tiles[d];m.tileID=m.tileID.unwrapTo(m.tileID.wrap+o),u[m.tileID.key]=m}this._tiles=u;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(i,o,u,d,m){if(this.transform=i,!this._sourceLoaded||this._paused||this.transform.freezeTileCoverage||this.usedForTerrain&&!u)return;this.updateCacheSize(i,o),this.transform.projection.name!=="globe"&&this.handleWrapJump(this.transform.center.lng),this._shadowCasterTiles={},this._coveredTiles={};const _=this._source.type==="batched-model";let y,v=this._source.maxzoom;this._maxzoomOverride!==null&&(v=Math.min(v,this._maxzoomOverride));const T=this.map&&this.map.painter?this.map.painter._terrain:null;if(T&&T.sourceCache===this&&T.attenuationRange()){const D=T.attenuationRange()[0],F=Math.floor(D)-Math.log2(T.getDemUpscale());v>F&&(v=F)}const I=this._maxzoomOverride===null&&this._source.reparseOverscaled;if(this.used||this.usedForTerrain){if(this._source.tileID)y=i.getVisibleUnwrappedCoordinates(this._source.tileID).map(D=>new a.aS(D.canonical.z,D.wrap,D.canonical.z,D.canonical.x,D.canonical.y));else if(this.tileCoverLift!==0){const D=i.clone();D.tileCoverLift=this.tileCoverLift,y=D.coveringTiles({tileSize:o||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:v,roundZoom:this._source.roundZoom&&!u,reparseOverscaled:I,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:_}),this._source.minzoom<=1&&i.projection.name==="globe"&&(y.push(new a.aS(1,0,1,0,0)),y.push(new a.aS(1,0,1,1,0)),y.push(new a.aS(1,0,1,0,1)),y.push(new a.aS(1,0,1,1,1)))}else if(y=i.coveringTiles({tileSize:o||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:v,roundZoom:this._source.roundZoom&&!u,reparseOverscaled:I,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:_}),this._source.hasTile){const D=this._source.hasTile.bind(this._source);y=y.filter(F=>D(F))}}else y=[];if(y.length>0&&this.transform.projection.name!=="globe"&&!this.usedForTerrain&&!this._supportsFading){const D=i.coveringZoomLevel({tileSize:o||this._source.tileSize,roundZoom:this._source.roundZoom&&!u}),F=Math.min(D,v);if(_){const z=i.extendTileCover(y,F);for(const V of z)y.push(V)}else if(m){const z=i.extendTileCoverToNearPlane(y,this.transform.getFrustum(F),F);for(const V of z)y.push(V)}else if(this.castsShadows&&d){const z=i.extendTileCover(y,F,d,16);for(const V of z)this._shadowCasterTiles[V.key]=!0,y.push(V)}}const M=this._updateRetainedTiles(y);if(this._supportsFading&&y.length!==0){const D={},F={},z=a.o.now(),V=Object.keys(M);for(const $ of V){const H=M[$],j=this._tiles[$];if(!j||j.fadeEndTime!==void 0&&j.fadeEndTime<=z)continue;const ne=this.findLoadedParent(H,Math.max(H.overscaledZ-pn.maxOverzooming,this._source.minzoom));ne&&(this._addTile(ne.tileID),D[ne.tileID.key]=ne.tileID),F[$]=H}const N=y[y.length-1].overscaledZ;for(const $ in this._tiles){const H=this._tiles[$];if(M[$]||!H.hasData())continue;let j=H.tileID;for(;j.overscaledZ>N;){j=j.scaledTo(j.overscaledZ-1);const ne=this._tiles[j.key];if(ne&&ne.hasData()&&F[j.key]){M[$]=H.tileID;break}}}for(const $ in D)M[$]||(this._coveredTiles[$]=!0,M[$]=D[$])}for(const D in M)this._tiles[D].clearFadeHold();const C=a.b4(this._tiles,M);for(const D of C){const F=this._tiles[D];F.hasSymbolBuckets&&!F.holdingForFade()?F.setHoldDuration(this.map._fadeDuration):F.hasSymbolBuckets&&!F.symbolFadeFinished()||this._removeTile(+D)}this._updateLoadedParentTileCache(),this._renderSourceType===a.b5.Symbol&&this._source.afterUpdate&&this._source.afterUpdate()}releaseSymbolFadeTiles(){for(const i in this._tiles)this._tiles[i].holdingForFade()&&this._removeTile(+i)}_updateRetainedTiles(i){const o={};if(i.length===0)return o;const u={},d=i.reduce((T,I)=>Math.min(T,I.overscaledZ),1/0),m=i[0].overscaledZ,_=Math.max(m-pn.maxOverzooming,this._source.minzoom),y=Math.max(m+pn.maxUnderzooming,this._source.minzoom),v={};for(const T of i){const I=this._addTile(T);o[T.key]=T,I.hasData()||d<this._source.maxzoom&&(v[T.key]=T)}this._retainLoadedChildren(v,d,y,o);for(const T of i){let I=this._tiles[T.key];if(I.hasData())continue;if(T.canonical.z>=this._source.maxzoom){const C=T.children(this._source.maxzoom)[0],D=this.getTile(C);if(D&&D.hasData()){o[C.key]=C;continue}}else{const C=T.children(this._source.maxzoom);if(o[C[0].key]&&o[C[1].key]&&o[C[2].key]&&o[C[3].key])continue}let M=I.wasRequested();for(let C=T.overscaledZ-1;C>=_;--C){const D=T.scaledTo(C);if(u[D.key]||(u[D.key]=!0,I=this.getTile(D),!I&&M&&(I=this._addTile(D)),I&&(o[D.key]=D,M=I.wasRequested(),I.hasData())))break}}return o}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const i in this._tiles){const o=[];let u,d=this._tiles[i].tileID;for(;d.overscaledZ>0;){if(d.key in this._loadedParentTiles){u=this._loadedParentTiles[d.key];break}o.push(d.key);const m=d.scaledTo(d.overscaledZ-1);if(u=this._getLoadedTile(m),u)break;d=m}for(const m of o)this._loadedParentTiles[m]=u}}_addTile(i){let o=this._tiles[i.key];if(o)return o.isExtraShadowCaster!==!0||this._shadowCasterTiles[i.key]||this._reloadTile(i.key,"reloading"),o;o=this._cache.getAndRemove(i),o&&(this._setTileReloadTimer(i.key,o),o.tileID=i,this._state.initializeTileState(o,this.map?this.map.painter:null),this._cacheTimers[i.key]&&(clearTimeout(this._cacheTimers[i.key]),delete this._cacheTimers[i.key],this._setTileReloadTimer(i.key,o)));const u=!!o;if(!u){const d=this.map?this.map.painter:null,m=this._source.tileSize*i.overscaleFactor();o=this._source.type==="raster-array"?new tl(i,m,this.transform.tileZoom,d,this._isRaster):new a.b1(i,m,this.transform.tileZoom,d,this._isRaster,this._source.worldview),this._loadTile(o,this._tileLoaded.bind(this,o,i.key,o.state))}return o.uses++,this._tiles[i.key]=o,u||this._source.fire(new a.C("dataloading",{tile:o,coord:o.tileID,dataType:"source"})),o}_setTileReloadTimer(i,o){i in this._timers&&(clearTimeout(this._timers[i]),delete this._timers[i]);const u=o.getExpiryTimeout();u&&(this._timers[i]=setTimeout(()=>{this._reloadTile(i,"expired"),delete this._timers[i]},u))}_removeTile(i){const o=this._tiles[i];o&&(o.uses--,delete this._tiles[i],this._timers[i]&&(clearTimeout(this._timers[i]),delete this._timers[i]),o.uses>0||(o.hasData()&&o.state!=="reloading"||o.state==="empty"?this._cache.add(o.tileID,o,o.getExpiryTimeout()):(o.aborted=!0,this._abortTile(o),this._unloadTile(o))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const i in this._tiles)this._removeTile(+i);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(i,o,u){const d=[],m=this.transform;if(!m)return d;const _=m.projection.name==="globe",y=a.aH(m.center.lng);for(const v in this._tiles){const T=this._tiles[v];if(u&&T.clearQueryDebugViz(),T.holdingForFade())continue;let I;if(_){const M=T.tileID.canonical;if(M.z===0){const C=[Math.abs(a.aC(y,...ea(M,-1))-y),Math.abs(a.aC(y,...ea(M,1))-y)];I=[0,2*C.indexOf(Math.min(...C))-1]}else{const C=[Math.abs(a.aC(y,...ea(M,-1))-y),Math.abs(a.aC(y,...ea(M,0))-y),Math.abs(a.aC(y,...ea(M,1))-y)];I=[C.indexOf(Math.min(...C))-1]}}else I=[0];for(const M of I){const C=i.containsTile(T,m,o,M);C&&d.push(C)}}return d}getShadowCasterCoordinates(){return this._getRenderableCoordinates(!1,!0)}getVisibleCoordinates(i){return this._getRenderableCoordinates(i)}_getRenderableCoordinates(i,o){const u=this.getRenderableIds(i,o).map(m=>this._tiles[m].tileID),d=this.transform.projection.name==="globe";for(const m of u)m.projMatrix=this.transform.calculateProjMatrix(m.toUnwrapped()),m.expandedProjMatrix=d?this.transform.calculateProjMatrix(m.toUnwrapped(),!1,!0):m.projMatrix;return u}sortCoordinatesByDistance(i){const o=i.slice(),u=this.transform._camera.position,d=this.transform._camera.forward(),m={};for(const _ of o){const y=1/(1<<_.canonical.z);m[_.key]=((_.canonical.x+.5)*y+_.wrap-u[0])*d[0]+((_.canonical.y+.5)*y-u[1])*d[1]-u[2]*d[2]}return o.sort((_,y)=>m[_.key]-m[y.key]),o}hasTransition(){if(this._source.hasTransition())return!0;if(this._supportsFading){const i=a.o.now();for(const o in this._tiles){const u=this._tiles[o];if(u.fadeEndTime!==void 0&&u.fadeEndTime>=i)return!0}}return!1}setFeatureState(i,o,u){this._state.updateState(i=i||"_geojsonTileLayer",o,u)}removeFeatureState(i,o,u){this._state.removeFeatureState(i=i||"_geojsonTileLayer",o,u)}getFeatureState(i,o){return this._state.getState(i=i||"_geojsonTileLayer",o)}setDependencies(i,o,u){const d=this._tiles[i];d&&d.setDependencies(o,u)}reloadTilesForDependencies(i,o){for(const u in this._tiles)this._tiles[u].hasDependency(i,o)&&this._reloadTile(+u,"reloading");this._cache.filter(u=>!u.hasDependency(i,o))}_preloadTiles(i,o){if(!this._sourceLoaded){const v=()=>{this._sourceLoaded&&(this._source.off("data",v),this._preloadTiles(i,o))};return void this._source.on("data",v)}const u=new Map,d=Array.isArray(i)?i:[i],m=this.map.painter.terrain,_=this.usedForTerrain&&m?m.getScaledDemTileSize():this._source.tileSize;for(const v of d){const T=v.coveringTiles({tileSize:_,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!this.usedForTerrain,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain});for(const I of T)u.set(I.key,I);this.usedForTerrain&&v.updateElevation(!1)}const y=Array.from(u.values());a.t(y,(v,T)=>{const I=new a.b1(v,this._source.tileSize*v.overscaleFactor(),this.transform.tileZoom,this.map.painter,this._isRaster,this._source.worldview);this._loadTile(I,M=>{this._source.type==="raster-dem"&&I.dem&&this._backfillDEM(I),T(M,I)})},o)}}function eh(l,i){const o=Math.abs(2*l.wrap)-+(l.wrap<0),u=Math.abs(2*i.wrap)-+(i.wrap<0);return l.overscaledZ-i.overscaledZ||u-o||i.canonical.y-l.canonical.y||i.canonical.x-l.canonical.x}function ea(l,i){const o=1<<l.z;return[l.x/o+i,(l.x+1)/o+i]}pn.maxOverzooming=10,pn.maxUnderzooming=3;class df{constructor(i){this.style=i,this.layersGotHidden=!1,this.layers=[]}processLayersChanged(){this.layers=[];const i=!1,o=!1;for(const u in this.style._mergedLayers){const d=this.style._mergedLayers[u];if(d.type==="fill-extrusion"||d.type==="building")this.layers.push({layer:d,visible:i,visibilityChanged:o});else if(d.type==="model"){const m=this.style.getLayerSource(d);m&&m.type==="batched-model"&&this.layers.push({layer:d,visible:i,visibilityChanged:o})}}}onNewFrame(i){this.layersGotHidden=!1;for(const o of this.layers){const u=o.layer;let d=!1;u.type==="fill-extrusion"?d=!u.isHidden(i)&&u.paint.get("fill-extrusion-opacity")>0:u.type==="building"?d=!u.isHidden(i)&&u.paint.get("building-opacity")>0:u.type==="model"&&(d=!u.isHidden(i)&&u.paint.get("model-opacity").constantOr(1)>0),this.layersGotHidden=this.layersGotHidden||!d&&o.visible,o.visible=d}}updateZOffset(i,o){this.currentBuildingBuckets=[];for(const d of this.layers){const m=d.layer,_=this.style.getLayerSourceCache(m);let y=1;m.type==="fill-extrusion"?y=d.visible?m.paint.get("fill-extrusion-vertical-scale"):0:m.type==="building"&&(y=d.visible?m.paint.get("building-vertical-scale"):0);let v=_?_.getTile(o):null;if(!v&&_)for(const T in _._tiles){const I=_._tiles[T];if(o.canonical.isChildOf(I.tileID.canonical)){v=I;break}}this.currentBuildingBuckets.push({bucket:v?v.getBucket(m):null,tileID:v?v.tileID:o,verticalScale:y})}i.hasAnyZOffset=!1;let u=!1;for(let d=0;d<i.symbolInstances.length;d++){const m=i.symbolInstances.get(d),_=m.zOffset,y=this._getHeightAtTileOffset(o,m.tileAnchorX,m.tileAnchorY);m.zOffset=y!==Number.NEGATIVE_INFINITY?y:_,u||_===m.zOffset||(u=!0),i.hasAnyZOffset||m.zOffset===0||(i.hasAnyZOffset=!0)}u&&(i.zOffsetBuffersNeedUpload=!0,i.zOffsetSortDirty=!0)}_mapCoordToOverlappingTile(i,o,u,d){let m=o,_=u;if(i.canonical.z!==d.canonical.z){const y=d.canonical,v=1/(1<<i.canonical.z-y.z);m=(o+i.canonical.x*a.an)*v-y.x*a.an|0,_=(u+i.canonical.y*a.an)*v-y.y*a.an|0}return{tileX:m,tileY:_}}_getHeightAtTileOffset(i,o,u){let d,m;for(let _=0;_<this.layers.length;++_){const y=this.layers[_].layer;if(y.type!=="fill-extrusion"&&y.type!=="building")continue;const{bucket:v,tileID:T,verticalScale:I}=this.currentBuildingBuckets[_];if(!v)continue;const{tileX:M,tileY:C}=this._mapCoordToOverlappingTile(i,o,u,T),D=v.getHeightAtTileCoord(M,C);D&&D.height!==void 0&&(D.hidden?d=D.height:m=Math.max(D.height*I,m||0))}if(m!==void 0)return m;for(let _=0;_<this.layers.length;++_){const y=this.layers[_];if(y.layer.type!=="model"||!y.visible)continue;const{bucket:v,tileID:T}=this.currentBuildingBuckets[_];if(!v)continue;const{tileX:I,tileY:M}=this._mapCoordToOverlappingTile(i,o,u,T),C=v.getHeightAtTileCoord(I,M);if(C&&!C.hidden)return C.height===void 0&&d!==void 0?Math.min(C.maxHeight,d)*C.verticalScale:C.height?C.height*C.verticalScale:Number.NEGATIVE_INFINITY}return this.layersGotHidden?0:Number.NEGATIVE_INFINITY}}function rl(l,i){const o={};for(const u in l)u!=="ref"&&(o[u]=l[u]);
vendor: 4,183 bytes, line 8
8return a.b6.forEach(u=>{u in i&&(o[u]=i[u])}),o}function vc(l){l=l.slice();const i=Object.create(null);for(let o=0;o<l.length;o++)i[l[o].id]=l[o];for(let o=0;o<l.length;o++)"ref"in l[o]&&(l[o]=rl(l[o],i[l[o].ref]));return l}const $t={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 bc(l,i,o){o.push({command:$t.addSource,args:[l,i[l]]})}function ta(l,i,o){i.push({command:$t.removeSource,args:[l]}),o[l]=!0}function nl(l,i,o,u){ta(l,o,u),bc(l,i,o)}function Mm(l,i,o){let u;for(u in l[o])if(l[o].hasOwnProperty(u)&&u!=="data"&&!a.b7(l[o][u],i[o][u]))return!1;for(u in i[o])if(i[o].hasOwnProperty(u)&&u!=="data"&&!a.b7(l[o][u],i[o][u]))return!1;return!0}function Is(l,i,o,u,d,m){let _;for(_ in i=i||{},l=l||{})l.hasOwnProperty(_)&&(a.b7(l[_],i[_])||o.push({command:m,args:[u,_,i[_],d]}));for(_ in i)i.hasOwnProperty(_)&&!l.hasOwnProperty(_)&&(a.b7(l[_],i[_])||o.push({command:m,args:[u,_,i[_],d]}))}function Zo(l){return l.id}function ia(l,i){return l[i.id]=i,l}function wc(l,i,o){const u=i.createTileMatrix(l,l.worldSize,o.toUnwrapped());return a.aD(new Float32Array(16),l.projMatrix,u)}function ff(l,i,o){if(i.projection.name===o.projection.name)return l.projMatrix;const u=o.clone();return u.setProjection(i.projection),wc(u,i.getProjection(),l)}function Tc(l,i,o){return i.name===o.projection.name?l.projMatrix:wc(o,i,l)}class ol{constructor(i,o){this.reset(i,o)}reset(i,o){this.points=i||[],this._distances=[0];for(let u=1;u<this.points.length;u++)this._distances[u]=this._distances[u-1]+this.points[u].dist(this.points[u-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(o||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(i){if(this.points.length===1)return this.points[0];i=a.aC(i,0,1);let o=1,u=this._distances[o];const d=i*this.paddedLength+this.padding;for(;u<d&&o<this._distances.length;)u=this._distances[++o];const m=o-1,_=this._distances[m],y=u-_,v=y>0?(d-_)/y:0;return this.points[m].mult(1-v).add(this.points[o].mult(v))}}class th{constructor(i,o,u){const d=this.boxCells=[],m=this.circleCells=[];this.xCellCount=Math.ceil(i/u),this.yCellCount=Math.ceil(o/u);for(let _=0;_<this.xCellCount*this.yCellCount;_++)d.push([]),m.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=i,this.height=o,this.xScale=this.xCellCount/i,this.yScale=this.yCellCount/o,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(i,o,u,d,m){this._forEachCell(o,u,d,m,this._insertBoxCell,this.boxUid++),this.boxKeys.push(i),this.bboxes.push(o),this.bboxes.push(u),this.bboxes.push(d),this.bboxes.push(m)}insertCircle(i,o,u,d){this._forEachCell(o-d,u-d,o+d,u+d,this._insertCircleCell,this.circleUid++),this.circleKeys.push(i),this.circles.push(o),this.circles.push(u),this.circles.push(d)}_insertBoxCell(i,o,u,d,m,_){this.boxCells[m].push(_)}_insertCircleCell(i,o,u,d,m,_){this.circleCells[m].push(_)}_query(i,o,u,d,m,_){if(u<0||i>this.width||d<0||o>this.height)return!m&&[];const y=[];if(i<=0&&o<=0&&this.width<=u&&this.height<=d){if(m)return!0;for(let v=0;v<this.boxKeys.length;v++)y.push({key:this.boxKeys[v],x1:this.bboxes[4*v],y1:this.bboxes[4*v+1],x2:this.bboxes[4*v+2],y2:this.bboxes[4*v+3]});for(let v=0;v<this.circleKeys.length;v++){const T=this.circles[3*v],I=this.circles[3*v+1],M=this.circles[3*v+2];y.push({key:this.circleKeys[v],x1:T-M,y1:I-M,x2:T+M,y2:I+M})}return _?y.filter(_):y}
8return this._forEachCell(i,o,u,d,this._queryCell,y,{hitTest:m,seenUids:{box:{},circle:{}}},_),m?y.length>0:y}_queryCircle(i,o,u,d,m){const _=i-u,y=i+u,v=o-u,T=o+u;if(y<0||_>this.width||T<0||v>this.height)return!d&&[];const I=[];return this._forEachCell(_,v,y,T,this._queryCellCircle,I,{hitTest:d,circle:{x:i,y:o,radius:u},seenUids:{box:{},circle:{}}},m),d?I.length>0:I}query(i,o,u,d,m){return this._query(i,o,u,d,!1,m)}hitTest(i,o,u,d,m){return this._query(i,o,u,d,!0,m)}hitTestCircle(i,o,u,d){return this._queryCircle(i,o,u,!0,d)}_queryCell(i,o,u,d,m,_,y,v){const T=y.seenUids,I=this.boxCells[m];if(I!==null){const C=this.bboxes;for(const D of I)if(!T.box[D]){T.box[D]=!0;const F=4*D;if(i<=C[F+2]&&o<=C[F+3]&&u>=C[F+0]&&d>=C[F+1]&&(!v||v(this.boxKeys[D]))){if(y.hitTest)return _.push(!0),!0;_.push({key:this.boxKeys[D],x1:C[F],y1:C[F+1],x2:C[F+2],y2:C[F+3]})}}}const M=this.circleCells[m];if(M!==null){const C=this.circles;for(const D of M)if(!T.circle[D]){T.circle[D]=!0;const F=3*D;if(this._circleAndRectCollide(C[F],C[F+1],C[F+2],i,o,u,d)&&(!v||v(this.circleKeys[D]))){if(y.hitTest)return _.push(!0),!0;{const z=C[F],V=C[F+1],N=C[F+2];_.push({key:this.circleKeys[D],x1:z-N,y1:V-N,x2:z+N,y2:V+N})}}}}}_queryCellCircle(i,o,u,d,m,_,y,v){const T=y.circle,I=y.seenUids,M=this.boxCells[m];if(M!==null){const D=this.bboxes;for(const F of M)if(!I.box[F]){I.box[F]=!0;const z=4*F;if(this._circleAndRectCollide(T.x,T.y,T.radius,D[z+0],D[z+1],D[z+2],D[z+3])&&(!v||v(this.boxKeys[F])))return _.push(!0),!0}}const C=this.circleCells[m];if(C!==null){const D=this.circles;for(const F of C)if(!I.circle[F]){I.circle[F]=!0;const z=3*F;if(this._circlesCollide(D[z],D[z+1],D[z+2],T.x,T.y,T.radius)&&(!v||v(this.circleKeys[F])))return _.push(!0),!0}}}_forEachCell(i,o,u,d,m,_,y,v){const T=this._convertToXCellCoord(i),I=this._convertToYCellCoord(o),M=this._convertToXCellCoord(u),C=this._convertToYCellCoord(d);for(let D=T;D<=M;D++)for(let F=I;F<=C;F++)if(m.call(this,i,o,u,d,this.xCellCount*F+D,_,y,v))return}_convertToXCellCoord(i){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(i*this.xScale)))}_convertToYCellCoord(i){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(i*this.yScale)))}_circlesCollide(i,o,u,d,m,_){const y=d-i,v=m-o,T=u+_;return T*T>y*y+v*v}_circleAndRectCollide(i,o,u,d,m,_,y){const v=(_-d)/2,T=Math.abs(i-(d+v));if(T>v+u)return!1;const I=(y-m)/2,M=Math.abs(o-(m+I));if(M>I+u)return!1;if(T<=v||M<=I)return!0;const C=T-v,D=M-I;return C*C+D*D<=u*u}}const pf=Math.tan(85*Math.PI/180);function sl(l,i,o,u,d,m,_){const y=a.bc();if(o)if(m.name==="globe"){const v=a.bd(d,i);a.aD(y,y,v)}else{const v=a.be([],_);y[0]=v[0],y[1]=v[1],y[4]=v[2],y[5]=v[3],u||a.bb(y,y,d.angle)}else a.aD(y,d.labelPlaneMatrix,l);return y}function ra(l,i,o,u,d,m,_){const y=sl(l,i,o,u,d,m,_);return m.name==="globe"&&o||(y[2]=y[6]=y[10]=y[14]=0),y}function Hn(l,i,o,u,d,m,_){if(o){if(m.name==="globe"){const y=sl(l,i,o,u,d,m,_);return a.b8(y,y),a.aD(y,l,y),y}{const y=a.b9(l),v=a.ba([]);return v[0]=_[0],v[1]=_[1],v[4]=_[2],v[5]=_[3],a.aD(y,y,v),u||a.bb(y,y,-d.angle),y}}return d.glCoordMatrix}function rn(l,i,o,u){const d=[l,i,o,1];o?a.aE(d,d,u):mf(d,d,u);const m=d[3];return d[0]/=m,d[1]/=m,d[2]/=m,d}function ih(l,i){return Math.min(.5+l/i*.5,1.5)}function rh(l,i){const o=l[0]/l[3],u=l[1]/l[3];return o>=-i[0]&&o<=i[0]&&u>=-i[1]&&u<=i[1]}function na(l,i,o,u,d,m,_,y,v,T,I=1){const M=o.transform,C=u?l.textSizeData:l.iconSizeData,D=a.bk(C,o.transform.zoom,I),F=M.projection.name==="globe",z=[256/o.width*2+1,256/o.height*2+1],V=u?l.text.dynamicLayoutVertexArray:l.icon.dynamicLayoutVertexArray;V.clear();let N=null;F&&(N=u?l.text.globeExtVertexArray:l.icon.globeExtVertexArray);const $=l.lineVertexArray,H=u?l.text.placedSymbolArray:l.icon.placedSymbolArray,j=o.transform.width/o.transform.height;let ne,Y=!1;for(let re=0;re<H.length;re++){const Z=H.get(re),{numGlyphs:K,writingMode:te}=Z;if(te!==a.bl.vertical||Y||ne===a.bl.horizontal||(Y=!0),ne=te,(Z.hidden||te===a.bl.vertical)&&!Y){oa(K,V);continue}Y=!1;const de=new a.P(Z.tileAnchorX,Z.tileAnchorY),se=l.elevationType==="road",be=!!M.elevation||se;let{x:_e,y:Me,z:Le}=M.projection.projectTilePoint(de.x,de.y,T.canonical),fe=null;if(be){const et=se?l.getElevationFeatureForText(re):null;fe={getElevation:v,elevation:M.elevation,elevationFeature:et};const[_t,xt,gt]=v(de,M.elevation,et);_e+=_t,Me+=xt,Le+=gt}const le=[_e,Me,Le,1];if(a.aE(le,le,i),!rh(le,z)){oa(K,V);continue}const xe=le[3],we=ih(o.transform.getCameraToCenterDistance(M.projection),xe),Se=a.bm(C,D,Z),$e=_?Se/we:Se*we,Ve=rn(_e,Me,Le,d);if(Ve[3]<=0){oa(K,V);continue}let Ne={};const De=a.ap(l.layers[0].layout.get("text-max-angle")),tt=Math.cos(De),ot=_?null:fe,Ke=Sc(Z,$e,!1,y,i,d,m,l.glyphOffsetArray,$,V,N,Ve,de,Ne,j,ot,M.projection,T,_,tt);Y=Ke.useVertical,ot&&Ke.needsFlipping&&(Ne={}),(Ke.notEnoughRoom||Y||Ke.needsFlipping&&Sc(Z,$e,!0,y,i,d,m,l.glyphOffsetArray,$,V,N,Ve,de,Ne,j,ot,M.projection,T,_,tt).notEnoughRoom)&&oa(K,V)}u?(l.text.dynamicLayoutVertexBuffer.updateData(V),N&&l.text.globeExtVertexBuffer&&l.text.globeExtVertexBuffer.updateData(N)):(l.icon.dynamicLayoutVertexBuffer.updateData(V),N&&l.icon.globeExtVertexBuffer&&l.icon.globeExtVertexBuffer.updateData(N))}function nn(l,i,o,u,d,m,_,y,v,T,I,M,C,D,F,z,V){const{lineStartIndex:N,glyphStartIndex:$,segment:H}=y,j=$+y.numGlyphs,ne=N+y.lineLength,Y=i.getoffsetX($),re=i.getoffsetX(j-1),Z=al(l*Y,o,u,d,m,_,H,N,ne,v,T,I,M,C,!0,D,F,z,V);if(!Z)return null;const K=al(l*re,o,u,d,m,_,H,N,ne,v,T,I,M,C,!0,D,F,z,V);return K?{first:Z,last:K}:null}function nh(l,i,o,u){return l===a.bl.horizontal&&Math.abs(u)>Math.abs(o)?{useVertical:!0}:l===a.bl.vertical?u>0?{needsFlipping:!0}:null:i!==0&&function(d,m){return d===0||Math.abs(m/d)>pf}(o,u)?i===1?{needsFlipping:!0}:null:o<0?{needsFlipping:!0}:null}function Sc(l,i,o,u,d,m,_,y,v,T,I,M,C,D,F,z,V,N,$,H){const j=i/24,ne=l.lineOffsetX*j,Y=l.lineOffsetY*j,{lineStartIndex:re,glyphStartIndex:Z,numGlyphs:K,segment:te,writingMode:de,flipState:se}=l,be=re+l.lineLength,_e=Me=>{if(I){const[xe,we,Se]=Me.up,$e=T.length;a.bn(I,$e+0,xe,we,Se),a.bn(I,$e+1,xe,we,Se),a.bn(I,$e+2,xe,we,Se),a.bn(I,$e+3,xe,we,Se)}const[Le,fe,le]=Me.point;a.bo(T,Le,fe,le,Me.angle)};if(K>
81){const Me=nn(j,y,ne,Y,o,M,C,l,v,m,D,z,!1,V,N,$,H);if(!Me)return{notEnoughRoom:!0};if(u&&!o){let[Le,fe,le]=Me.first.point,[xe,we,Se]=Me.last.point;[Le,fe]=rn(Le,fe,le,_),[xe,we]=rn(xe,we,Se,_);const $e=nh(de,se,(xe-Le)*F,we-fe);if(l.flipState=$e&&$e.needsFlipping?1:2,$e)return $e}_e(Me.first);for(let Le=Z+1;Le<Z+K-1;Le++){const fe=al(j*y.getoffsetX(Le),ne,Y,o,M,C,te,re,be,v,m,D,z,!1,!1,V,N,$,H);if(!fe)return T.length-=4*(Le-Z),{notEnoughRoom:!0};_e(fe)}_e(Me.last)}else{if(u&&!o){const Le=rn(C.x,C.y,0,d),fe=re+te+1,le=new a.P(v.getx(fe),v.gety(fe)),xe=rn(le.x,le.y,0,d),we=xe[3]>0?xe:jt(C,le,Le,1,d,void 0,V,N.canonical),Se=nh(de,se,(we[0]-Le[0])*F,we[1]-Le[1]);if(l.flipState=Se&&Se.needsFlipping?1:2,Se)return Se}const Me=al(j*y.getoffsetX(Z),ne,Y,o,M,C,te,re,be,v,m,D,z,!1,!1,V,N,$,H);if(!Me)return{notEnoughRoom:!0};_e(Me)}return{}}function oh(l,i,o,u,d){const{x:m,y:_,z:y}=u.projectTilePoint(l.x,l.y,i);if(!d)return rn(m,_,y,o);const[v,T,I]=d.getElevation(l,d.elevation,d.elevationFeature);return rn(m+v,_+T,y+I,o)}function jt(l,i,o,u,d,m,_,y){const v=oh(l.sub(i)._unit()._add(l),y,d,_,m);return a.ax(v,o,v),a.ay(v,v),a.bh(v,o,v,u)}function al(l,i,o,u,d,m,_,y,v,T,I,M,C,D,F,z,V,N,$){const H=u?l-i:l+i;let j=H>0?1:-1,ne=0;u&&(j*=-1,ne=Math.PI),j<0&&(ne+=Math.PI);let Y=y+_+(j>0?0:1)|0,re=d,Z=d,K=0,te=0;const de=Math.abs(H),se=[],be=[];let _e=m,Me=_e,Le=a.bf([]);const fe=()=>jt(Me,_e,Z,de-K+1,I,C,z,V.canonical);for(;K+te<=de;){if(Y+=j,Y<y||Y>=v)return null;if(Z=re,Me=_e,se.push(Z),D&&be.push(Me),_e=new a.P(T.getx(Y),T.gety(Y)),re=M[Y],!re){const ot=oh(_e,V.canonical,I,z,C);re=ot[3]>0?M[Y]=ot:fe()}K+=te;const De=a.ax([],re,Z),tt=a.bg(Z,re);if(o&&tt>0&&te>0&&a.bj(Le,De)/(te*tt)<$)return null;te=tt,Le=De}F&&C&&(M[Y]&&(re=fe(),te=a.bg(Z,re),Le=a.ax([],re,Z)),M[Y]=re);const le=(de-K)/te,xe=_e.sub(Me)._mult(le)._add(Me),we=a.bh([],Z,Le,le);let Se=[0,0,1],$e=Le[0],Ve=Le[1];if(N&&(Se=z.upVector(V.canonical,xe.x,xe.y),Se[0]!==0||Se[1]!==0||Se[2]!==1)){const De=[Se[2],0,-Se[0]],tt=a.bi([],Se,De);a.ay(De,De),a.ay(tt,tt),$e=a.bj(Le,De),Ve=a.bj(Le,tt)}if(o){const De=a.bi([],Se,Le);a.ay(De,De),a.bh(we,we,De,o*j)}const Ne=ne+Math.atan2(Ve,$e);return se.push(we),D&&be.push(xe),{point:we,angle:Ne,path:se,tilePath:be,up:Se}}function oa(l,i){const o=i.length,u=o+4*l;i.resize(u),i.float32.fill(-1/0,4*o,4*u)}function mf(l,i,o){const u=i[0],d=i[1];return l[0]=o[0]*u+o[4]*d+o[12],l[1]=o[1]*u+o[5]*d+o[13],l[3]=o[3]*u+o[7]*d+o[15],l}const dt=100;class _f{constructor(i,o,u=new th(i.width+200,i.height+200,25),d=new th(i.width+200,i.height+200,25)){this.transform=i,this.grid=u,this.ignoredGrid=d,this.pitchfactor=Math.cos(i._pitch)*i.cameraToCenterDistance,this.screenRightBoundary=i.width+dt,this.screenBottomBoundary=i.height+dt,this.gridRightBoundary=i.width+200,this.gridBottomBoundary=i.height+200,this.fogState=o,this.clippedSymbols=new Map}clearClippedSymbolsForBucket(i){this.clippedSymbols.delete(i)}markSymbolAsClipped(i,o){let u=this.clippedSymbols.get(i);u||(u=new Set,this.clippedSymbols.set(i,u)),u.add(o)}placeCollisionBox(i,o,u,d,m,_,y,v,T,I,M){let C=u.projectedAnchorX,D=u.projectedAnchorY,F=u.projectedAnchorZ;const z=u.tileAnchorX,V=u.tileAnchorY,N=u.elevation,$=u.tileID,H=i.getProjection();if(N&&$){const[be,_e,Me]=H.upVector($.canonical,u.tileAnchorX,u.tileAnchorY),Le=H.upVectorScale($.canonical,this.transform.center.lat,this.transform.worldSize).metersToTile;C+=be*N*Le,D+=_e*N*Le,F+=Me*N*Le}const j=i.projection.name==="globe",ne=i.projection.name==="globe"?a.al(this.transform.zoom):0;if($&&j&&ne<1&&!_){const be=1<<$.canonical.z,_e=a.bp(z,V);a.bq(_e,_e,1/a.an),a.br(_e,_e,a.bp($.canonical.x,$.canonical.y)),a.bq(_e,_e,1/be),a.bs(_e,_e,a.bp(d[0],d[1])),_e[0]=a.bt(_e[0],-.5,.5),a.bq(_e,_e,a.an);const Me=a.bu(_e[0],_e[1],a.an/(2*Math.PI),1);a.aE(Me,Me,m),C=a.am(C,Me[0],ne),D=a.am(D,Me[1],ne),F=a.am(F,Me[2],ne)}const Y=this.projectAndGetPerspectiveRatio(I,C,D,F,u.tileID,H.name==="globe"||!!N||this.transform.pitch>0,H),re=T*Y.perspectiveRatio,Z=(u.x1*o+y.x-u.padding)*re+Y.point.x,K=(u.y1*o+y.y-u.padding)*re+Y.point.y,te=(u.x2*o+y.x+u.padding)*re+Y.point.x,de=(u.y2*o+y.y+u.padding)*re+Y.point.y,se=Y.perspectiveRatio<=.55||Y.occluded;return!this.isInsideGrid(Z,K,te,de)||!v&&this.grid.hitTest(Z,K,te,de,M)||se?{box:[],offscreen:!1,occluded:Y.occluded}:{box:[Z,K,te,de],offscreen:this.isOffscreen(Z,K,te,de),occluded:!1}}placeCollisionCircles(i,o,u,d,m,_,y,v,T,I,M,C,D,F,z,V){const N=[],$=this.transform.elevation,H=i.getProjection(),j=i.elevationType==="road",ne=!!$||j,Y=a.bv.getAtTileOffsetFunc(V,this.transform.center.lat,this.transform.worldSize,H),re=new a.P(u.tileAnchorX,u.tileAnchorY),Z=new a.P(u.tileAnchorX,u.tileAnchorY);let{x:K,y:te,z:de}=H.projectTilePoint(Z.x,Z.y,V.canonical),se=null;if(ne){const tt=j?i.getElevationFeatureForText(d):null;se={getElevation:Y,elevation:$,elevationFeature:tt};const[ot,Ke,et]=Y(re,$,tt);K+=ot,te+=Ke,de+=et}const be=H.name==="globe",_e=this.projectAndGetPerspectiveRatio(v,K,te,de,V,be||!!$||this.transform.pitch>0,H),{perspectiveRatio:Me}=_e,Le=(C?y/Me:y*Me)/a.bz,fe=rn(K,te,de,T),le=u.lineOffsetX*Le,xe=u.lineOffsetY*Le,we=a.ap(i.layers[0].layout.get("text-max-angle")),Se=Math.cos(we),$e=_e.signedDistanceFromCamera>0?nn(Le,_,le,xe,j&&u.flipState===1,fe,Z,u,m,T,{},ne&&!C?se:null,C&&ne,H,V,C,Se):null;let Ve=!1,Ne=!1,De=!0;
vendor: 30,441 bytes, line 8
8if($e&&!_e.occluded){const tt=.5*F*Me+z,ot=new a.P(-100,-100),Ke=new a.P(this.screenRightBoundary,this.screenBottomBoundary),et=new ol,{first:_t,last:xt}=$e,gt=_t.path.length;let At=[];for(let yt=gt-1;yt>=1;yt--)At.push(_t.path[yt]);for(let yt=1;yt<xt.path.length;yt++)At.push(xt.path[yt]);const ft=2.5*tt;I&&(At=At.map(([yt,kt,ti],wi)=>(ne&&!be&&(ti=Y(wi<gt-1?_t.tilePath[gt-1-wi]:xt.tilePath[wi-gt+2],$,se.elevationFeature)[2]),rn(yt,kt,ti,I))),At.some(yt=>yt[3]<=0)&&(At=[]));let Ct=[];if(At.length>0){let yt=1/0,kt=-1/0,ti=1/0,wi=-1/0;for(const si of At)yt=Math.min(yt,si[0]),ti=Math.min(ti,si[1]),kt=Math.max(kt,si[0]),wi=Math.max(wi,si[1]);kt>=ot.x&&yt<=Ke.x&&wi>=ot.y&&ti<=Ke.y&&(Ct=[At.map(si=>new a.P(si[0],si[1]))],(yt<ot.x||kt>Ke.x||ti<ot.y||wi>Ke.y)&&(Ct=a.bw(Ct,ot.x,ot.y,Ke.x,Ke.y)))}for(const yt of Ct){et.reset(yt,.25*tt);let kt=0;kt=et.length<=.5*tt?1:Math.ceil(et.paddedLength/ft)+1;for(let ti=0;ti<kt;ti++){const wi=ti/Math.max(kt-1,1),si=et.lerp(wi),Gt=si.x+dt,It=si.y+dt;N.push(Gt,It,tt,0);const Et=Gt-tt,ai=It-tt,Ii=Gt+tt,qt=It+tt;if(De=De&&this.isOffscreen(Et,ai,Ii,qt),Ne=Ne||this.isInsideGrid(Et,ai,Ii,qt),!o&&this.grid.hitTestCircle(Gt,It,tt,D)&&(Ve=!0,!M))return{circles:[],offscreen:!1,collisionDetected:Ve,occluded:!1}}}}return{circles:!M&&Ve||!Ne?[]:N,offscreen:De,collisionDetected:Ve,occluded:_e.occluded}}queryRenderedSymbols(i){if(i.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const o=[];let u=1/0,d=1/0,m=-1/0,_=-1/0;for(const I of i){const M=new a.P(I.x+dt,I.y+dt);u=Math.min(u,M.x),d=Math.min(d,M.y),m=Math.max(m,M.x),_=Math.max(_,M.y),o.push(M)}const y=this.grid.query(u,d,m,_).concat(this.ignoredGrid.query(u,d,m,_)),v={},T={};for(const I of y){const M=I.key;if(v[M.bucketInstanceId]===void 0&&(v[M.bucketInstanceId]={}),v[M.bucketInstanceId][M.featureIndex])continue;const C=this.clippedSymbols.get(M.bucketInstanceId);if(C&&C.has(M.featureIndex))continue;const D=[new a.P(I.x1,I.y1),new a.P(I.x2,I.y1),new a.P(I.x2,I.y2),new a.P(I.x1,I.y2)];a.bx(o,D)&&(v[M.bucketInstanceId][M.featureIndex]=!0,T[M.bucketInstanceId]===void 0&&(T[M.bucketInstanceId]=[]),T[M.bucketInstanceId].push(M.featureIndex))}return T}insertCollisionBox(i,o,u,d,m){(o?this.ignoredGrid:this.grid).insert({bucketInstanceId:u,featureIndex:d,collisionGroupID:m},i[0],i[1],i[2],i[3])}insertCollisionCircles(i,o,u,d,m){const _=o?this.ignoredGrid:this.grid,y={bucketInstanceId:u,featureIndex:d,collisionGroupID:m};for(let v=0;v<i.length;v+=4)_.insertCircle(y,i[v],i[v+1],i[v+2])}projectAndGetPerspectiveRatio(i,o,u,d,m,_,y){const v=[o,u,d,1];let T=!1;d||this.transform.pitch>0?(a.aE(v,v,i),this.fogState&&m&&y.name!=="globe"&&(T=function(C,D,F,z,V,N){const $=N.calculateFogTileMatrix(V),H=[D,F,z];return a.ah(H,H,$),Ot(C,a.ai(H),N.pitch,N._fov)}(this.fogState,o,u,d,m.toUnwrapped(),this.transform)>.9)):mf(v,v,i);const I=v[3];return{point:new a.P((v[0]/I+1)/2*this.transform.width+dt,(-v[1]/I+1)/2*this.transform.height+dt),perspectiveRatio:Math.min(.5+this.transform.getCameraToCenterDistance(y)/I*.5,1.5),signedDistanceFromCamera:I,occluded:_&&v[2]>I||T}}isOffscreen(i,o,u,d){return u<dt||i>=this.screenRightBoundary||d<dt||o>this.screenBottomBoundary}isInsideGrid(i,o,u,d){return u>=0&&i<this.gridRightBoundary&&d>=0&&o<this.gridBottomBoundary}getViewportMatrix(){const i=a.ba([]);return a.by(i,i,[-100,-100,0]),i}}class ll{constructor(i,o,u,d){this.opacity=i?Math.max(0,Math.min(1,i.opacity+(i.placed?o:-o))):d&&u?1:0,this.placed=u}isHidden(){return this.opacity===0&&!this.placed}}class Hr{constructor(i,o,u,d,m,_=!1){this.text=new ll(i?i.text:null,o,u,m),this.icon=new ll(i?i.icon:null,o,d,m),this.clipped=_}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class sa{constructor(i,o,u,d=!1){this.text=i,this.icon=o,this.skipFade=u,this.clipped=d}}class aa{constructor(){this.invProjMatrix=a.bc(),this.viewportMatrix=a.bc(),this.circles=[]}}class at{constructor(i,o,u,d,m){this.bucketInstanceId=i,this.featureIndex=o,this.sourceLayerIndex=u,this.bucketIndex=d,this.tileID=m}}class Yt{constructor(i){this.crossSourceCollisions=i,this.maxGroupID=0,this.collisionGroups={}}get(i){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[i]){const o=++this.maxGroupID;this.collisionGroups[i]={ID:o,predicate:u=>u.collisionGroupID===o}}return this.collisionGroups[i]}}function Kt(l,i,o,u,d){const{horizontalAlign:m,verticalAlign:_}=a.bG(l),y=-(m-.5)*i,v=-(_-.5)*o,T=a.bH(l,u);return new a.P(y+T[0]*d,v+T[1]*d)}function Lr(l,i,o,u,d){const m=new a.P(l,i);return o&&m._rotate(u?d:-d),m}class la{constructor(i,o,u,d,m,_){this.transform=i.clone(),this.projection=i.projection.name,this.collisionIndex=new _f(this.transform,m),this.buildingIndex=_,this.frontCutoffStart=0,this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=o,this.retainedQueryData={},this.collisionGroups=new Yt(u),this.collisionCircleArrays={},this.prevPlacement=d,d&&(d.prevPlacement=void 0),this.placedOrientations={},this.lastReplacementSourceUpdateTime=0}getBucketParts(i,o,u,d,m=1){const _=u.getBucket(o),y=u.latestFeatureIndex;if(!_||!y||o.fqid!==_.layerIds[0])return;const v=_.layers[0].layout,T=_.layers[0].paint,I=u.collisionBoxArray,M=Math.pow(2,this.transform.zoom-u.tileID.overscaledZ),C=u.tileSize/a.an,D=u.tileID.toUnwrapped();this.transform.setProjection(_.projection);const F=(z=u.tileID,V=_.getProjection(),N=this.transform,V.name===this.projection?N.calculateProjMatrix(z.toUnwrapped()):wc(N,V,z));var z,V,N;const $=v.get("text-pitch-alignment")==="map",H=v.get("text-rotation-alignment")==="map";o.compileFilter(o.options);const j=o.dynamicFilter(),ne=o.dynamicFilterNeedsFeature(),Y=o.dynamicFilterNeedsGeometry(),re=this.transform.calculatePixelsToTileUnitsMatrix(u),Z=ra(F,u.tileID.canonical,$,H,this.transform,_.getProjection(),re);let K=null;const te=_.getProjection().createInversionMatrix(this.transform,u.tileID.canonical);if($){const xe=Hn(F,u.tileID.canonical,$,H,this.transform,_.getProjection(),re);K=a.aD([],this.transform.labelPlaneMatrix,xe)}let de=null;j&&u.latestFeatureIndex&&(de={unwrappedTileID:D,dynamicFilter:j,dynamicFilterNeedsFeature:ne,needGeometry:Y}),this.retainedQueryData[_.bucketInstanceId]=new at(_.bucketInstanceId,y,_.sourceLayerIndex,_.index,u.tileID);const[se,be]=_.layers[0].layout.get("text-size-scale-range"),_e=a.aC(m,se,be),[Me,Le]=v.get("icon-size-scale-range"),fe=a.aC(m,Me,Le),le={bucket:_,layout:v,paint:T,posMatrix:F,invMatrix:te,mercatorCenter:[a.aH(this.transform.center.lng),a.aL(this.transform.center.lat)],textLabelPlaneMatrix:Z,labelToScreenMatrix:K,clippingData:de,scale:M,textPixelRatio:C,holdingForFade:u.holdingForFade(),collisionBoxArray:I,partiallyEvaluatedTextSize:a.bk(_.textSizeData,this.transform.zoom,_e),partiallyEvaluatedIconSize:a.bk(_.iconSizeData,this.transform.zoom,fe),collisionGroup:this.collisionGroups.get(_.sourceID),latestFeatureIndex:u.latestFeatureIndex};if(d)for(const xe of _.sortKeyRanges){const{sortKey:we,symbolInstanceStart:Se,symbolInstanceEnd:$e}=xe;i.push({sortKey:we,symbolInstanceStart:Se,symbolInstanceEnd:$e,parameters:le})}else i.push({symbolInstanceStart:0,symbolInstanceEnd:_.symbolInstances.length,parameters:le})}attemptAnchorPlacement(i,o,u,d,m,_,y,v,T,I,M,C,D,F,z,V,N,$,H,j,ne){const{textOffset0:Y,textOffset1:re,crossTileID:Z}=z,K=[Y,re],te=Kt(i,_,y,K,v),de=this.collisionIndex.placeCollisionBox(N,v,o,u,d,m,Lr(te.x,te.y,T,I,this.transform.angle),F,M,C,D.predicate);if(H){const se=N.getSymbolInstanceIconSize(ne,this.transform.zoom,z.placedIconSymbolIndex);if(this.collisionIndex.placeCollisionBox(N,se,H,u,d,m,Lr(te.x,te.y,T,I,this.transform.angle),F,M,C,D.predicate).box.length===0)return}if(de.box.length>0){let se;return this.prevPlacement&&this.prevPlacement.variableOffsets[Z]&&this.prevPlacement.placements[Z]&&this.prevPlacement.placements[Z].text&&(se=this.prevPlacement.variableOffsets[Z].anchor),this.variableOffsets[Z]={textOffset:K,width:_,height:y,anchor:i,textScale:v,prevAnchor:se},this.markUsedJustification(N,i,z,$),N.allowVerticalPlacement&&(this.markUsedOrientation(N,$,z),this.placedOrientations[Z]=$),{shift:te,placedGlyphBoxes:de}}}placeLayerBucketPart(i,o,u,d,m=1){const{bucket:_,layout:y,paint:v,posMatrix:T,textLabelPlaneMatrix:I,labelToScreenMatrix:M,clippingData:C,textPixelRatio:D,mercatorCenter:F,invMatrix:z,holdingForFade:V,collisionBoxArray:N,partiallyEvaluatedTextSize:$,partiallyEvaluatedIconSize:H,collisionGroup:j,latestFeatureIndex:ne}=i.parameters,Y=y.get("text-optional"),re=y.get("icon-optional"),Z=y.get("text-allow-overlap"),K=y.get("icon-allow-overlap"),te=y.get("text-rotation-alignment")==="map",de=y.get("icon-rotation-alignment")==="map",se=y.get("text-pitch-alignment")==="map",be=v.get("symbol-z-offset"),_e=y.get("symbol-elevation-reference")==="sea",Me=y.get("symbol-placement"),[Le,fe]=y.get("text-size-scale-range"),[le,xe]=y.get("icon-size-scale-range"),we=a.aC(m,Le,fe),Se=a.aC(m,le,xe),$e=y.get("text-variable-anchor"),Ve=te&&Me!=="point",Ne=de&&Me!=="point",De=$e&&_.hasTextData(),tt=_.hasIconTextFit()&&De&&_.hasIconData();this.transform.setProjection(_.projection);const ot=De||Ve,Ke=Ne||tt;let et=Z&&(K||!_.hasIconData()||re),_t=K&&(Z||!_.hasTextData()||Y);const xt=!be.isConstant();!_.collisionArrays&&N&&_.deserializeCollisionBoxes(N),u&&d&&_.updateCollisionDebugBuffers(this.transform.zoom,N,we,Se);const gt=(ft,Ct,yt)=>{const{crossTileID:kt,numVerticalGlyphVertices:ti}=ft;let wi=null;if(C&&C.dynamicFilterNeedsFeature||xt){const ci=this.retainedQueryData[_.bucketInstanceId],ui=ne.loadFeature({featureIndex:ft.featureIndex,bucketIndex:ci.bucketIndex,sourceLayerIndex:ci.sourceLayerIndex,layoutVertexArrayOffset:0}),Qt=ui.properties?ui.properties.worldview:null;if(_.localizable&&_.worldview&&typeof Qt=="string")if(Qt==="all")ui.properties.$localized=!0;else{if(!Qt.split(",").includes(_.worldview))return;ui.properties.$localized=!0,ui.properties.worldview=_.worldview}wi=C&&C.needGeometry?a.bE(ui,!0):ui}if(C&&!(0,C.dynamicFilter)({zoom:this.transform.zoom,pitch:this.transform.pitch,worldview:_.worldview},wi,this.retainedQueryData[_.bucketInstanceId].tileID.canonical,new a.P(ft.tileAnchorX,ft.tileAnchorY),this.transform.calculateDistanceTileData(C.unwrappedTileID)))return this.placements[kt]=new sa(!1,!1,!1,!0),void o.add(kt);const si=be.evaluate(wi,{});if((ft.zOffset||0)+(si||0)>0&&this.frontCutoffStart>0){const ci=2*this.frontCutoffStart-1,ui=[ft.tileAnchorX,ft.tileAnchorY,0,1],Qt=a.aE(a.bF(),ui,T);if(Qt[1]/Qt[3]<ci)return this.placements[kt]=new sa(!1,!1,!1,!0),void o.add(kt)}if(o.has(kt))return;if(V)return void(this.placements[kt]=new sa(!1,!1,!1));let Gt=!1,It=!1,Et=!0,ai=!1,Ii=!1,qt=null,bt={box:null,offscreen:null,occluded:null},gi={box:null},ii=null,Wi=null,Rt=null,ni=0,Qi=0,Er=0;yt.textFeatureIndex?ni=yt.textFeatureIndex:ft.useRuntimeCollisionCircles&&(ni=ft.featureIndex),yt.verticalTextFeatureIndex&&(Qi=yt.verticalTextFeatureIndex);const rr=_.elevationFeatures?_.elevationFeatures[ft.elevationFeatureIndex]:void 0,mr=ci=>{ci.tileID=this.retainedQueryData[_.bucketInstanceId].tileID;const ui=this.transform.elevation;ci.elevation=_e?si:si+a.bv.getAtTileOffset(ci.tileID,new a.P(ci.tileAnchorX,ci.tileAnchorY),ui,rr),ci.elevation+=ft.zOffset},an=yt.textBox;if(an){mr(an);const ci=Qt=>{let qi=a.bl.horizontal;if(_.allowVerticalPlacement&&!Qt&&this.prevPlacement){const Pr=this.prevPlacement.placedOrientations[kt];Pr&&(this.placedOrientations[kt]=Pr,qi=Pr,this.markUsedOrientation(_,qi,ft))}return qi},ui=(Qt,qi)=>{if(_.allowVerticalPlacement&&ti>0&&yt.verticalTextBox){for(const Pr of _.writingModes)if(Pr===a.bl.vertical?(bt=qi(),gi=bt):bt=Qt(),bt&&bt.box&&bt.box.length)break}else bt=Qt()};if($e){let Qt=$e;if(this.prevPlacement&&this.prevPlacement.variableOffsets[kt]){const zi=this.prevPlacement.variableOffsets[kt];Qt.indexOf(zi.anchor)>0&&(Qt=Qt.filter(ln=>ln!==zi.anchor),Qt.unshift(zi.anchor))}const qi=(zi,ln,ns)=>{const Ns=_.getSymbolInstanceTextSize($,ft,this.transform.zoom,Ct),Us=(zi.x2-zi.x1)*Ns+2*zi.padding,La=(zi.y2-zi.y1)*Ns+2*zi.padding,zo=ft.hasIconTextFit&&!K?ln:null;zo&&mr(zo);let ho={box:[],offscreen:!1,occluded:!1};const Fa=Z?2*Qt.length:Qt.length;for(let Xr=0;Xr<Fa;++Xr){const os=this.attemptAnchorPlacement(Qt[Xr%Qt.length],zi,F,z,ot,Us,La,Ns,te,se,D,T,j,Xr>=Qt.length,ft,Ct,_,ns,zo,$,H);if(os&&(ho=os.placedGlyphBoxes,ho&&ho.box&&ho.box.length)){Gt=!0,qt=os.shift;break}}return ho};ui(()=>qi(an,yt.iconBox,a.bl.horizontal),()=>{const zi=yt.verticalTextBox;return zi&&mr(zi),_.allowVerticalPlacement&&!(bt&&bt.box&&bt.box.length)&&ti>0&&zi?qi(zi,yt.verticalIconBox,a.bl.vertical):{box:null,offscreen:null,occluded:null}}),bt&&(Gt=bt.box,Et=bt.offscreen,ai=bt.occluded);const Pr=ci(!(!bt||!bt.box));if(!Gt&&this.prevPlacement){const zi=this.prevPlacement.variableOffsets[kt];zi&&(this.variableOffsets[kt]=zi,this.markUsedJustification(_,zi.anchor,ft,Pr))}}else{const Qt=(qi,Pr)=>{const zi=_.getSymbolInstanceTextSize($,ft,this.transform.zoom,Ct),ln=this.collisionIndex.placeCollisionBox(_,zi,qi,F,z,ot,new a.P(0,0),Z,D,T,j.predicate);return ln&&ln.box&&ln.box.length&&(this.markUsedOrientation(_,Pr,ft),this.placedOrientations[kt]=Pr),ln};ui(()=>Qt(an,a.bl.horizontal),()=>{const qi=yt.verticalTextBox;return _.allowVerticalPlacement&&ti>0&&qi?(mr(qi),Qt(qi,a.bl.vertical)):{box:null,offscreen:null,occluded:null}}),ci(!!(bt&&bt.box&&bt.box.length))}}if(ii=bt,Gt=ii&&ii.box&&ii.box.length>0,Et=ii&&ii.offscreen,ai=ii&&ii.occluded,ft.useRuntimeCollisionCircles){const ci=ft.centerJustifiedTextSymbolIndex>=0?ft.centerJustifiedTextSymbolIndex:ft.verticalPlacedTextSymbolIndex,ui=_.text.placedSymbolArray.get(ci),Qt=a.bm(_.textSizeData,$,ui),qi=y.get("text-padding");Wi=this.collisionIndex.placeCollisionCircles(_,Z,ui,ci,_.lineVertexArray,_.glyphOffsetArray,Qt,T,I,M,u,se,j.predicate,ft.collisionCircleDiameter*Qt/a.bz,qi,this.retainedQueryData[_.bucketInstanceId].tileID),Gt=Z||Wi.circles.length>0&&!Wi.collisionDetected,Et=Et&&Wi.offscreen,ai=Wi.occluded}if(yt.iconFeatureIndex&&(Er=yt.iconFeatureIndex),yt.iconBox){const ci=ui=>{mr(ui);const Qt=ft.hasIconTextFit&&qt?Lr(qt.x,qt.y,te,se,this.transform.angle):new a.P(0,0),qi=_.getSymbolInstanceIconSize(H,this.transform.zoom,ft.placedIconSymbolIndex);return this.collisionIndex.placeCollisionBox(_,qi,ui,F,z,Ke,Qt,K,D,T,j.predicate)};gi&&gi.box&&gi.box.length&&yt.verticalIconBox?(Rt=ci(yt.verticalIconBox),It=Rt.box.length>0):(Rt=ci(yt.iconBox),It=Rt.box.length>0),Et=Et&&Rt.offscreen,Ii=Rt.occluded}const Xt=Y||ft.numHorizontalGlyphVertices===0&&ti===0,xn=re||ft.numIconVertices===0;if(Xt||xn?xn?Xt||(It=It&&Gt):Gt=It&&Gt:It=Gt=It&&Gt,Gt&&ii&&ii.box&&this.collisionIndex.insertCollisionBox(ii.box,y.get("text-ignore-placement"),_.bucketInstanceId,gi&&gi.box&&Qi?Qi:ni,j.ID),It&&Rt&&this.collisionIndex.insertCollisionBox(Rt.box,y.get("icon-ignore-placement"),_.bucketInstanceId,Er,j.ID),Wi&&(Gt&&this.collisionIndex.insertCollisionCircles(Wi.circles,y.get("text-ignore-placement"),_.bucketInstanceId,ni,j.ID),u)){const ci=_.bucketInstanceId;let ui=this.collisionCircleArrays[ci];ui===void 0&&(ui=this.collisionCircleArrays[ci]=new aa);for(let Qt=0;Qt<Wi.circles.length;Qt+=4)ui.circles.push(Wi.circles[Qt+0]),ui.circles.push(Wi.circles[Qt+1]),ui.circles.push(Wi.circles[Qt+2]),ui.circles.push(Wi.collisionDetected?1:0)}const vn=_.projection.name!=="globe";et=et&&(vn||!ai),_t=_t&&(vn||!Ii),this.placements[kt]=new sa(Gt||et,It||_t,Et||_.justReloaded),o.add(kt)},At=this.retainedQueryData[_.bucketInstanceId].tileID;if(_.elevationType==="offset"&&this.buildingIndex&&this.buildingIndex.updateZOffset(_,At),_.elevationType==="road"&&_.updateRoadElevation(At.canonical),_.updateZOffset(),_.sortFeaturesByY){const ft=_.getSortedSymbolIndexes(this.transform.angle);for(let Ct=ft.length-1;Ct>=0;--Ct){const yt=ft[Ct];gt(_.symbolInstances.get(yt),yt,_.collisionArrays[yt])}_.hasAnyZOffset&&a.w(`${_.layerIds[0]} layer symbol-z-elevate: symbols are not sorted by elevation if symbol-z-order is evaluated to viewport-y`)}else if(_.hasAnyZOffset){const ft=_.getSortedIndexesByZOffset();for(let Ct=0;Ct<ft.length;++Ct){const yt=ft[Ct];gt(_.symbolInstances.get(yt),yt,_.collisionArrays[yt])}}else for(let ft=i.symbolInstanceStart;ft<i.symbolInstanceEnd;ft++)gt(_.symbolInstances.get(ft),ft,_.collisionArrays[ft]);if(u&&_.bucketInstanceId in this.collisionCircleArrays){const ft=this.collisionCircleArrays[_.bucketInstanceId];a.b8(ft.invProjMatrix,T),ft.viewportMatrix=this.collisionIndex.getViewportMatrix()}_.justReloaded=!1}markUsedJustification(i,o,u,d){const{leftJustifiedTextSymbolIndex:m,centerJustifiedTextSymbolIndex:_,rightJustifiedTextSymbolIndex:y,verticalPlacedTextSymbolIndex:v,crossTileID:T}=u,I=a.bI(o),M=d===a.bl.vertical?v:I==="left"?m:I==="center"?_:I==="right"?y:-1;m>=0&&(i.text.placedSymbolArray.get(m).crossTileID=M>=0&&m!==M?0:T),_>=0&&(i.text.placedSymbolArray.get(_).crossTileID=M>=0&&_!==M?0:T),y>=0&&(i.text.placedSymbolArray.get(y).crossTileID=M>=0&&y!==M?0:T),v>=0&&(i.text.placedSymbolArray.get(v).crossTileID=M>=0&&v!==M?0:T)}markUsedOrientation(i,o,u){const d=o===a.bl.horizontal||o===a.bl.horizontalOnly?o:0,m=o===a.bl.vertical?o:0,{leftJustifiedTextSymbolIndex:_,centerJustifiedTextSymbolIndex:y,rightJustifiedTextSymbolIndex:v,verticalPlacedTextSymbolIndex:T}=u,I=i.text.placedSymbolArray;_>=0&&(I.get(_).placedOrientation=d),y>=0&&(I.get(y).placedOrientation=d),v>=0&&(I.get(v).placedOrientation=d),T>=0&&(I.get(T).placedOrientation=m)}commit(i){this.commitTime=i,this.zoomAtLastRecencyCheck=this.transform.zoom;const o=this.prevPlacement;let u=!1;this.prevZoomAdjustment=o?o.zoomAdjustment(this.transform.zoom):0;const d=o?o.symbolFadeChange(i):1,m=o?o.opacities:{},_=o?o.variableOffsets:{},y=o?o.placedOrientations:{};for(const v in this.placements){const T=this.placements[v],I=m[v];I?(this.opacities[v]=new Hr(I,d,T.text,T.icon,null,T.clipped),u=u||T.text!==I.text.placed||T.icon!==I.icon.placed):(this.opacities[v]=new Hr(null,d,T.text,T.icon,T.skipFade,T.clipped),u=u||T.text||T.icon)}for(const v in m){const T=m[v];if(!this.opacities[v]){const I=new Hr(T,d,!1,!1);I.isHidden()||(this.opacities[v]=I,u=u||T.text.placed||T.icon.placed)}}for(const v in _)this.variableOffsets[v]||!this.opacities[v]||this.opacities[v].isHidden()||(this.variableOffsets[v]=_[v]);for(const v in y)this.placedOrientations[v]||!this.opacities[v]||this.opacities[v].isHidden()||(this.placedOrientations[v]=y[v]);u?this.lastPlacementChangeTime=i:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=o?o.lastPlacementChangeTime:i)}updateLayerOpacities(i,o,u,d){d&&(this.lastReplacementSourceUpdateTime=d.updateTime);const m=new Set;for(const _ of o){const y=_.getBucket(i);y&&_.latestFeatureIndex&&i.fqid===y.layerIds[0]&&(this.updateBucketOpacities(y,m,_,_.collisionBoxArray,u,d,_.tileID,i.scope),y.elevationType==="offset"&&this.buildingIndex&&this.buildingIndex.updateZOffset(y,_.tileID),y.elevationType==="road"&&y.updateRoadElevation(_.tileID.canonical),y.updateZOffset())}}updateBucketOpacities(i,o,u,d,m,_,y,v){i.hasTextData()&&i.text.opacityVertexArray.clear(),i.hasIconData()&&i.icon.opacityVertexArray.clear(),i.hasIconCollisionBoxData()&&i.iconCollisionBox.collisionVertexArray.clear(),i.hasTextCollisionBoxData()&&i.textCollisionBox.collisionVertexArray.clear();const T=i.layers[0].layout,I=i.layers[0].paint,M=!!i.layers[0].dynamicFilter(),C=new Hr(null,0,!1,!1,!0),D=T.get("text-allow-overlap"),F=T.get("icon-allow-overlap"),z=T.get("text-variable-anchor"),V=T.get("text-rotation-alignment")==="map",N=T.get("text-pitch-alignment")==="map",$=I.get("symbol-z-offset"),H=T.get("symbol-elevation-reference")==="sea",j=!$.isConstant(),ne=new Hr(null,0,D&&(F||!i.hasIconData()||T.get("icon-optional")),F&&(D||!i.hasTextData()||T.get("text-optional")),!0);!i.collisionArrays&&d&&(i.hasIconCollisionBoxData()||i.hasTextCollisionBoxData())&&i.deserializeCollisionBoxes(d);const Y=(Z,K,te)=>{for(let de=0;de<K/4;de++)Z.opacityVertexArray.emplaceBack(te)};let re=0;_&&i.updateReplacement(y,_),this.collisionIndex.clearClippedSymbolsForBucket(i.bucketInstanceId);for(let Z=0;Z<i.symbolInstances.length;Z++){const K=i.symbolInstances.get(Z),{numHorizontalGlyphVertices:te,numVerticalGlyphVertices:de,crossTileID:se,numIconVertices:be,tileAnchorX:_e,tileAnchorY:Me}=K;let Le=null;const fe=this.retainedQueryData[i.bucketInstanceId];j&&K&&fe&&(Le=u.latestFeatureIndex.loadFeature({featureIndex:K.featureIndex,bucketIndex:fe.bucketIndex,sourceLayerIndex:fe.sourceLayerIndex,layoutVertexArrayOffset:0}));const le=$.evaluate(Le,{}),xe=o.has(se);let we=this.opacities[se];xe?we=C:we||(we=ne,this.opacities[se]=we),o.add(se);const Se=te>0||de>0,$e=be>0,Ve=this.placedOrientations[se],Ne=Ve===a.bl.vertical,De=Ve===a.bl.horizontal||Ve===a.bl.horizontalOnly;!Se&&!$e||we.isHidden()||re++;let tt=!1;if((Se||$e)&&_)for(const ot of i.activeReplacements){if(a.bA(ot,m,a.bB.Symbol,v)||ot.min.x>_e||_e>ot.max.x||ot.min.y>Me||Me>ot.max.y)continue;const Ke=a.bC(_e,Me,y.canonical,ot.footprintTileId.canonical);if(tt=a.bD(Ke,ot.footprint),tt)break}if(tt&&this.collisionIndex.markSymbolAsClipped(i.bucketInstanceId,K.featureIndex),Se){const ot=tt?ro:Ec(we.text);Y(i.text,te,Ne?ro:ot),Y(i.text,de,De?ro:ot);const Ke=we.text.isHidden(),{leftJustifiedTextSymbolIndex:et,centerJustifiedTextSymbolIndex:_t,rightJustifiedTextSymbolIndex:xt,verticalPlacedTextSymbolIndex:gt}=K,At=i.text.placedSymbolArray,ft=Ke||Ne?1:0;et>=0&&(At.get(et).hidden=ft),_t>=0&&(At.get(_t).hidden=ft),xt>=0&&(At.get(xt).hidden=ft),gt>=0&&(At.get(gt).hidden=Ke||De?1:0);const Ct=this.variableOffsets[se];Ct&&this.markUsedJustification(i,Ct.anchor,K,Ve);const yt=this.placedOrientations[se];yt&&(this.markUsedJustification(i,"left",K,yt),this.markUsedOrientation(i,yt,K))}if($e){const ot=tt?ro:Ec(we.icon),{placedIconSymbolIndex:Ke,verticalPlacedIconSymbolIndex:et}=K,_t=i.icon.placedSymbolArray,xt=we.icon.isHidden()?1:0;Ke>=0&&(Y(i.icon,be,Ne?ro:ot),_t.get(Ke).hidden=xt),et>=0&&(Y(i.icon,K.numVerticalIconVertices,De?ro:ot),_t.get(et).hidden=xt)}if(i.hasIconCollisionBoxData()||i.hasTextCollisionBoxData()){const ot=i.collisionArrays[Z];if(ot){let Ke=new a.P(0,0),et=!0;if(ot.textBox||ot.verticalTextBox){if(z){const xt=this.variableOffsets[se];xt?(Ke=Kt(xt.anchor,xt.width,xt.height,xt.textOffset,xt.textScale),V&&Ke._rotate(N?this.transform.angle:-this.transform.angle)):et=!1}M&&(et=!we.clipped),ot.textBox&&Ht(i.textCollisionBox.collisionVertexArray,we.text.placed,!et||Ne,le,H,Ke.x,Ke.y),ot.verticalTextBox&&Ht(i.textCollisionBox.collisionVertexArray,we.text.placed,!et||De,le,H,Ke.x,Ke.y)}const _t=et&&!!(!De&&ot.verticalIconBox);ot.iconBox&&Ht(i.iconCollisionBox.collisionVertexArray,we.icon.placed,_t,le,H,K.hasIconTextFit?Ke.x:0,K.hasIconTextFit?Ke.y:0),ot.verticalIconBox&&Ht(i.iconCollisionBox.collisionVertexArray,we.icon.placed,!_t,le,H,K.hasIconTextFit?Ke.x:0,K.hasIconTextFit?Ke.y:0)}}}if(i.fullyClipped=re===0,i.sortFeatures(this.transform.angle),this.retainedQueryData[i.bucketInstanceId]&&(this.retainedQueryData[i.bucketInstanceId].featureSortOrder=i.featureSortOrder),i.hasTextData()&&i.text.opacityVertexBuffer&&i.text.opacityVertexBuffer.updateData(i.text.opacityVertexArray),i.hasIconData()&&i.icon.opacityVertexBuffer&&i.icon.opacityVertexBuffer.updateData(i.icon.opacityVertexArray),i.hasIconCollisionBoxData()&&i.iconCollisionBox.collisionVertexBuffer&&i.iconCollisionBox.collisionVertexBuffer.updateData(i.iconCollisionBox.collisionVertexArray),i.hasTextCollisionBoxData()&&i.textCollisionBox.collisionVertexBuffer&&i.textCollisionBox.collisionVertexBuffer.updateData(i.textCollisionBox.collisionVertexArray),i.bucketInstanceId in this.collisionCircleArrays){const Z=this.collisionCircleArrays[i.bucketInstanceId];i.placementInvProjMatrix=Z.invProjMatrix,i.placementViewportMatrix=Z.viewportMatrix,i.collisionCircleArray=Z.circles,delete this.collisionCircleArrays[i.bucketInstanceId]}}symbolFadeChange(i){return this.fadeDuration===0?1:(i-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(i){return Math.max(0,(this.transform.zoom-i)/1.5)}hasTransitions(i){return i-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(i,o){const u=this.zoomAtLastRecencyCheck===o?1-this.zoomAdjustment(o):1;return this.zoomAtLastRecencyCheck=o,this.commitTime+this.fadeDuration*u>i}isStale(){return this.stale}setStale(){this.stale=!0}}function Ht(l,i,o,u,d,m,_){l.emplaceBack(i?1:0,o?1:0,m||0,_||0,u,d?1:0),l.emplaceBack(i?1:0,o?1:0,m||0,_||0,u,d?1:0),l.emplaceBack(i?1:0,o?1:0,m||0,_||0,u,d?1:0),l.emplaceBack(i?1:0,o?1:0,m||0,_||0,u,d?1:0)}const Ic=Math.pow(2,25),cl=Math.pow(2,24),ul=Math.pow(2,17),Fr=Math.pow(2,16),tr=Math.pow(2,9),Pm=Math.pow(2,8),hl=Math.pow(2,1);function Ec(l){if(l.opacity===0&&!l.placed)return 0;if(l.opacity===1&&l.placed)return 4294967295;const i=l.placed?1:0,o=Math.floor(127*l.opacity);return o*Ic+i*cl+o*ul+i*Fr+o*tr+i*Pm+o*hl+i}const ro=0;class Ac{constructor(i){this._sortAcrossTiles=i.layout.get("symbol-z-order")!=="viewport-y"&&i.layout.get("symbol-sort-key").constantOr(1)!==void 0,this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs=new Set,this._bucketParts=[]}continuePlacement(i,o,u,d,m,_){const y=this._bucketParts;for(;this._currentTileIndex<i.length;)if(o.getBucketParts(y,d,i[this._currentTileIndex],this._sortAcrossTiles,_),this._currentTileIndex++,m())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,y.sort((v,T)=>v.sortKey-T.sortKey));this._currentPartIndex<y.length;){const v=y[this._currentPartIndex];if(o.placeLayerBucketPart(v,this._seenCrossTileIDs,u,v.symbolInstanceStart===0,_),this._currentPartIndex++,m())return!0}return!1}}class Cc{startNewPlacement(i,o,u,d,m,_,y,v){return this.placement=new la(i,d,m,_,y,v),this._currentPlacementIndex=o.length-1,this._forceFullPlacement=!1,this._showCollisionBoxes=u,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(i,o,u,d,m){const _=a.o.now(),y=()=>{const v=a.o.now()-_;return!this.isFullPlacementRequested()&&this._fadeDuration!==0&&v>2};for(;this._currentPlacementIndex>=0;){const v=o[i[this._currentPlacementIndex]],T=this.placement.collisionIndex.transform.zoom;if(v.type==="symbol"&&v.visibility!=="none"&&(!v.minzoom||v.minzoom<=T)&&(!v.maxzoom||v.maxzoom>T)){const I=v,M=I.layout.get("symbol-z-elevate"),C=I.layout.get("symbol-sort-key").constantOr(1)!==void 0,D=I.layout.get("symbol-z-order"),F=D==="viewport-y"||D==="auto"&&!(D!=="viewport-y"&&C),z=I.layout.get("text-allow-overlap")||I.layout.get("icon-allow-overlap")||I.layout.get("text-ignore-placement")||I.layout.get("icon-ignore-placement"),V=F&&z,N=this._inProgressLayer=this._inProgressLayer||new Ac(I),$=a.F(v.source,v.scope);if(N.continuePlacement(M||V?d[$]:u[$],this.placement,this._showCollisionBoxes,v,y,m))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._forceFullPlacement=!1,this._done=!0}commit(i){return this.placement.commit(i),this.placement}}const ca=512/a.an/2;class Vr{constructor(i,o,u){this.tileID=i,this.bucketInstanceId=u,this.index=new a.bJ(o.length,16,Int32Array),this.keys=[],this.crossTileIDs=[];const d=i.canonical.x*a.an,m=i.canonical.y*a.an;for(let _=0;_<o.length;_++){const{key:y,crossTileID:v,tileAnchorX:T,tileAnchorY:I}=o.get(_),M=Math.floor((d+T)*ca),C=Math.floor((m+I)*ca);this.index.add(M,C),this.keys.push(y),this.crossTileIDs.push(v)}this.index.finish()}findMatches(i,o,u){const d=this.tileID.canonical.z<o.canonical.z?1:Math.pow(2,this.tileID.canonical.z-o.canonical.z),m=ca/Math.pow(2,o.canonical.z-this.tileID.canonical.z),_=o.canonical.x*a.an,y=o.canonical.y*a.an;for(let v=0;v<i.length;v++){const T=i.get(v);if(T.crossTileID)continue;const{key:I,tileAnchorX:M,tileAnchorY:C}=T,D=Math.floor((_+M)*m),F=Math.floor((y+C)*m),z=this.index.range(D-d,F-d,D+d,F+d).sort((V,N)=>V-N);for(const V of z){const N=this.crossTileIDs[V];if(this.keys[V]===I&&!u.has(N)){u.add(N),T.crossTileID=N;break}}}}}class Dn{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Zr{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(i){const o=Math.round((i-this.lng)/360);if(o!==0)for(const u in this.indexes){const d=this.indexes[u],m={};for(const _ in d){const y=d[_];y.tileID=y.tileID.unwrapTo(y.tileID.wrap+o),m[y.tileID.key]=y}this.indexes[u]=m}this.lng=i}addBucket(i,o,u){if(this.indexes[i.overscaledZ]&&this.indexes[i.overscaledZ][i.key]){if(this.indexes[i.overscaledZ][i.key].bucketInstanceId===o.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(i.overscaledZ,this.indexes[i.overscaledZ][i.key])}for(let m=0;m<o.symbolInstances.length;m++)o.symbolInstances.get(m).crossTileID=0;this.usedCrossTileIDs[i.overscaledZ]||(this.usedCrossTileIDs[i.overscaledZ]=new Set);const d=this.usedCrossTileIDs[i.overscaledZ];for(const m in this.indexes){const _=this.indexes[m];if(Number(m)>i.overscaledZ)for(const y in _){const v=_[y];v.tileID.isChildOf(i)&&v.findMatches(o.symbolInstances,i,d)}else{const y=_[i.scaledTo(Number(m)).key];y&&y.findMatches(o.symbolInstances,i,d)}}for(let m=0;m<o.symbolInstances.length;m++){const _=o.symbolInstances.get(m);_.crossTileID||(_.crossTileID=u.generate(),d.add(_.crossTileID))}return this.indexes[i.overscaledZ]===void 0&&(this.indexes[i.overscaledZ]={}),this.indexes[i.overscaledZ][i.key]=new Vr(i,o.symbolInstances,o.bucketInstanceId),!0}removeBucketCrossTileIDs(i,o){for(const u of o.crossTileIDs)this.usedCrossTileIDs[i].delete(u)}removeStaleBuckets(i){let o=!1;for(const u in this.indexes){const d=this.indexes[u];for(const m in d)i[d[m].bucketInstanceId]||(this.removeBucketCrossTileIDs(u,d[m]),delete d[m],o=!0)}return o}}class gf{constructor(){this.layerIndexes={},this.crossTileIDs=new Dn,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(i,o,u,d){let m=this.layerIndexes[i.fqid];m===void 0&&(m=this.layerIndexes[i.fqid]=new Zr);let _=!1;const y={};d.name!=="globe"&&m.handleWrapJump(u);for(const v of o){const T=v.getBucket(i);T&&i.fqid===T.layerIds[0]&&(T.bucketInstanceId||(T.bucketInstanceId=++this.maxBucketInstanceId),m.addBucket(v.tileID,T,this.crossTileIDs)&&(_=!0),y[T.bucketInstanceId]=!0)}return m.removeStaleBuckets(y)&&(_=!0),_}pruneUnusedLayers(i){const o={};
8i.forEach(u=>{o[u]=!0});for(const u in this.layerIndexes)o[u]||delete this.layerIndexes[u]}}const Rn=771;class ct{constructor(i,o,u,d){this.blendFunction=i,this.blendColor=o.toNonPremultipliedRenderColor(null),this.mask=u,this.blendEquation=d}}ct.Replace=[1,0,1,0],ct.disabled=new ct(ct.Replace,a.aq.transparent,[!1,!1,!1,!1]),ct.unblended=new ct(ct.Replace,a.aq.transparent,[!0,!0,!0,!0]),ct.alphaBlended=new ct([1,Rn,1,Rn],a.aq.transparent,[!0,!0,!0,!0]),ct.alphaBlendedNonPremultiplied=new ct([770,Rn,770,Rn],a.aq.transparent,[!0,!0,!0,!0]),ct.multiply=new ct([774,0,774,0],a.aq.transparent,[!0,!0,!0,!0]),ct.multiplyAccumulateAlpha=new ct([774,0,1,Rn],a.aq.transparent,[!0,!0,!0,!0]),ct.additive=new ct([1,1,1,1],a.aq.transparent,[!0,!0,!0,!0]);class rt{constructor(i,o,u){this.func=i,this.mask=o,this.range=u}}rt.ReadOnly=!1,rt.ReadWrite=!0,rt.disabled=new rt(519,rt.ReadOnly,[0,1]);const Zn=7680;class st{constructor(i,o,u,d,m,_){this.test=i,this.ref=o,this.mask=u,this.fail=d,this.depthFail=m,this.pass=_}}st.disabled=new st({func:519,mask:0},0,0,Zn,Zn,Zn);const dl=1029,mn=2305;class pt{constructor(i,o,u){this.enable=i,this.mode=o,this.frontFace=u}}function fl(l,i){const o=a.bP(l,3);a.bS(l,i),a.bX(l,3,o)}function ua(l,i){const o=a.bM([]);return a.bN(o,o,-i),a.bO(o,o,-l),o}function sh(l,i){const o=[l[0],l[1],0],u=[i[0],i[1],0];if(a.ai(o)>=1e-15){const _=a.ay([],o);a.bK(u,_,a.bj(u,_)),i[0]=u[0],i[1]=u[1]}const d=a.bi([],i,l);if(a.bL(d)<1e-15)return null;const m=Math.atan2(-d[1],d[0]);return ua(Math.atan2(Math.sqrt(l[0]*l[0]+l[1]*l[1]),-l[2]),m)}pt.disabled=new pt(!1,dl,mn),pt.backCCW=new pt(!0,dl,mn),pt.backCW=new pt(!0,dl,2304),pt.frontCW=new pt(!0,1028,2304),pt.frontCCW=new pt(!0,1028,mn);class Mc{constructor(i,o){this.position=i,this.orientation=o}get position(){return this._position}set position(i){if(i){const o=i instanceof a.ag?i:new a.ag(i[0],i[1],i[2]);
8this._renderWorldCopies&&(o.x=a.bt(o.x,0,1)),this._position=o}else this._position=null}lookAtPoint(i,o,u){if(this.orientation=null,!this.position)return;const d=this.position,m=u||(this._elevation?this._elevation.getAtPointOrZero(a.ag.fromLngLat(i)):0),_=a.ag.fromLngLat(i,m),y=[_.x-d.x,_.y-d.y,_.z-d.z];o||(o=[0,0,1]),o[2]=Math.abs(o[2]),this.orientation=sh(y,o)}setPitchBearing(i,o){this.orientation=ua(a.ap(i),a.ap(-o))}}class Es{constructor(i,o){this._transform=a.ba([]),this.orientation=o,this.position=i}get mercatorPosition(){const i=this.position;return new a.ag(i[0],i[1],i[2])}get position(){const i=a.bP(this._transform,3);return[i[0],i[1],i[2]]}set position(i){var o;i&&a.bX(this._transform,3,[(o=i)[0],o[1],o[2],1])}get orientation(){return this._orientation}set orientation(i){this._orientation=i||a.bM([]),i&&fl(this._transform,this._orientation)}getPitchBearing(){const i=this.forward(),o=this.right();return{bearing:Math.atan2(-o[1],o[0]),pitch:Math.atan2(Math.sqrt(i[0]*i[0]+i[1]*i[1]),-i[2])}}setPitchBearing(i,o){this._orientation=ua(i,o),fl(this._transform,this._orientation)}forward(){const i=a.bP(this._transform,2);return[-i[0],-i[1],-i[2]]}up(){const i=a.bP(this._transform,1);return[-i[0],-i[1],-i[2]]}right(){const i=a.bP(this._transform,0);return[i[0],i[1],i[2]]}getCameraToWorld(i,o){const u=new Float64Array(16);return a.b8(u,this.getWorldToCamera(i,o)),u}getCameraToWorldMercator(){return this._transform}getWorldToCameraPosition(i,o,u){const d=this.position;a.bK(d,d,-i);const m=new Float64Array(16);return a.bQ(m,[u,u,u]),a.by(m,m,d),m[10]*=o,m}getWorldToCamera(i,o){const u=new Float64Array(16),d=new Float64Array(4),m=this.position;return a.bR(d,this._orientation),a.bK(m,m,-i),a.bS(u,d),a.by(u,u,m),u[1]*=-1,u[5]*=-1,u[9]*=-1,u[13]*=-1,u[8]*=o,u[9]*=o,u[10]*=o,u[11]*=o,u}getCameraToClipPerspective(i,o,u,d){const m=new Float64Array(16);return a.bT(m,i,o,u,d),m}getCameraToClipOrthographic(i,o,u,d,m,_){const y=new Float64Array(16);return a.bU(y,i,o,u,d,m,_),y}getDistanceToElevation(i,o=!1){const u=i===0?0:a.bV(i,o?a.bW(this.position[1]):this.position[1]),d=this.forward();return(u-this.position[2])/d[2]}clone(){return new Es([...this.position],[...this.orientation])}}const yf=(l,i)=>({u_matrix:l,u_ground_shadow_factor:i});class ah{constructor(i=0,o=0,u=0,d=0){if(isNaN(i)||i<0||isNaN(o)||o<0||isNaN(u)||u<0||isNaN(d)||d<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=i,this.bottom=o,this.left=u,this.right=d}interpolate(i,o,u){return o.top!=null&&i.top!=null&&(this.top=a.am(i.top,o.top,u)),o.bottom!=null&&i.bottom!=null&&(this.bottom=a.am(i.bottom,o.bottom,u)),o.left!=null&&i.left!=null&&(this.left=a.am(i.left,o.left,u)),o.right!=null&&i.right!=null&&(this.right=a.am(i.right,o.right,u)),this}getCenter(i,o){const u=a.aC((this.left+i-this.right)/2,0,i),d=a.aC((this.top+o-this.bottom)/2,0,o);return new a.P(u,d)}equals(i){return this.top===i.top&&this.bottom===i.bottom&&this.left===i.left&&this.right===i.right}clone(){return new ah(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const Wr=15;class lh{constructor(i,o,u,d,m,_,y){this.tileSize=512,this._renderWorldCopies=m===void 0||m,this._minZoom=i||0,this._maxZoom=o||22,this._minPitch=u??0,this._maxPitch=d??60,this.setProjection(_),this.setMaxBounds(y),this.width=0,this.height=0,this._center=new a.aV(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 ah,this._projMatrixCache={},this._alignedProjMatrixCache={},this._fogTileMatrixCache={},this._expandedProjMatrixCache={},this._distanceTileDataCache={},this._camera=new Es,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}clone(){const i=new lh(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies,this.getProjection(),this.maxBounds);return i._elevation=this._elevation,i._centerAltitude=this._centerAltitude,i._centerAltitudeValidForE
vendor: 1,403 bytes, line 8
8xaggeration=this._centerAltitudeValidForExaggeration,i.tileSize=this.tileSize,i.mercatorFromTransition=this.mercatorFromTransition,i.width=this.width,i.height=this.height,i.cameraElevationReference=this.cameraElevationReference,i._center=this._center,i._setZoom(this.zoom),i._seaLevelZoom=this._seaLevelZoom,i.angle=this.angle,i._fov=this._fov,i._pitch=this._pitch,i._nearZ=this._nearZ,i._farZ=this._farZ,i._nearClipOffset=this._nearClipOffset,i._averageElevation=this._averageElevation,i._orthographicProjectionAtLowPitch=this._orthographicProjectionAtLowPitch,i._unmodified=this._unmodified,i._edgeInsets=this._edgeInsets.clone(),i._camera=this._camera.clone(),i._calcMatrices(),i.freezeTileCoverage=this.freezeTileCoverage,i.frustumCorners=this.frustumCorners,i._allowWorldUnderZoom=this._allowWorldUnderZoom,i}get isOrthographic(){return this.projection.name!=="globe"&&this._orthographicProjectionAtLowPitch&&this.pitch<Wr}get elevation(){return this._elevation}set elevation(i){this._elevation!==i&&(this._elevation=i,this._updateCameraOnTerrain(),this._calcMatrices())}get nearClipOffset(){return this._nearClipOffset}set nearClipOffset(i){this._nearClipOffset=i,this._calcMatrices()}get depthOcclusionForSymbolsAndCircles(){return this.projection.name!=="globe"&&!this.isOrthographic}updateElevation(i,o=!1){const u=this._elevation&&this._elevation.exaggeration()!==this._centerAltitudeValidForE
8xaggeration;(this._seaLevelZoom==null||u)&&this._updateCameraOnTerrain(),(i||u)&&this._constrainCamera(o),this._calcMatrices()}getProjection(){return a.aJ(this.projection,["name","center","parallels"])}setProjection(i){this.projectionOptions=i||{name:"mercator"};const o=this.projection?this.getProjection():void 0;this.projection=a.c1(this.projectionOptions);const u=this.getProjection(),d=!a.b7(o,u);return d&&this._calcMatrices(),this.mercatorFromTransition=!1,d}setOrthographicProjectionAtLowPitch(i){return this._orthographicProjectionAtLowPitch!==i&&(this._orthographicProjectionAtLowPitch=i,this._calcMatrices(),!0)}setMercatorFromTransition(){const i=this.projection.name;this.mercatorFromTransition=!0,this.projectionOptions={name:"mercator"},this.projection=a.c1({name:"mercator"});const o=i!==this.projection.name;return o&&this._calcMatrices(),o}get minZoom(){return this._minZoom}set minZoom(i){this._minZoom!==i&&(this._minZoom=i,this.zoom=Math.max(this.zoom,i))}get maxZoom(){return this._maxZoom}set maxZoom(i){this._maxZoom!==i&&(this._maxZoom=i,this.zoom=Math.min(this.zoom,i))}get minPitch(){return this._minPitch}set minPitch(i){this._minPitch!==i&&(this._minPitch=i,this.pitch=Math.max(this.pitch,i))}get maxPitch(){return this._maxPitch}set maxPitch(i){this._maxPitch!==i&&(this._maxPitch=i,this.pitch=Math.min(this.pitch,i))}get renderWorldCopies(){return this._renderWorldCopies&&this.projection.supportsWorldCopies===!0}set renderWorldCopies(i){i===void 0?i=!0:i===null&&(i=!1),this._renderWorldCopies=i}get worldSize(){return this.tileSize*this.scale}get cameraWorldSizeForFog(){const i=Math.max(this._camera.getDistanceToElevation(this._averageElevation),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(i))}get cameraWorldSize(){const i=Math.max(this._camera.getDistanceToElevation(this._averageElevation,!0),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(i))}get pixelsPerMeter(){return this.projection.pixelsPerMeter(this.center.lat,this.worldSize)}get cameraPixelsPerMeter(){return a.bV(1,this.center.lat)*this.cameraWorldSizeForFog}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new a.P(this.width,this.height)}get bearing(){return a.bt(this.rotation,-180,180)}set bearing(i){this.rotation=i}get rotation(){return-this.angle/Math.PI*180}set rotation(i){const o=-i*Math.PI/180;this.angle!==o&&(this._unmodified=!1,this.angle=o,this._calcMatrices(),this.rotationMatrix=a.c2(),a.c3(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(i){const o=a.aC(i,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==o&&(this._unmodified=!1,this._pitch=o,this._calcMatrices())}get aspect(){return this.width/this.height}get fov(){return this._fov/Math.PI*180}set fov(i){i=Math.max(.01,Math.min(60,i)),this._fov!==i&&(this._unmodified=!1,this._fov=a.ap(i),this._calcMatrices())}get fovX(){return this._fov}get fovY(){const i=1/Math.tan(.5*this.fovX);return 2*Math.atan(1/this.aspect/i)}get averageElevation(){return this._averageElevation}set averageElevation(i){this._averageElevation=i,this._calcFogMatrices(),this._distanceTileDataCache={}}get zoom(){return this._zoom}set zoom(i){const o=Math.min(Math.max(i,this.minZoom),this.maxZoom);this._zoom!==o&&(this._unmodified=!1,this._setZoom(o),this._updateSeaLevelZoom(),this._constrain(),this._calcMatrices())}_setZoom(i){this._zoom=i,this.scale=this.zoomScale(i),this.tileZoom=Math.floor(i),this.zoomFraction=i-this.tileZoom}get tileCoverLift(){return this._tileCoverLift}set tileCoverLift(i){this._tileCoverLift!==i&&(this._tileCoverLift=i)}_updateCameraOnTerrain(){const i=this.elevation?this.elevation.getAtPoint(this.locationCoordinate(this.center),Number.NEGATIVE_INFINITY):Number.NEGATIVE_INFINITY,o=this.elevation&&i===Number.NEGATIVE_INFINITY&&this.elevation.visibleDemTiles.length>0&&this.elevation.exaggeration()>
80&&this._centerAltitudeValidForExaggeration;if(!this._elevation||i===Number.NEGATIVE_INFINITY&&(!o||!this._centerAltitude))return this._centerAltitude=0,this._seaLevelZoom=null,void(this._centerAltitudeValidForExaggeration=void 0);const u=this._elevation;o||this._centerAltitude&&this._centerAltitudeValidForExaggeration&&u.exaggeration()&&this._centerAltitudeValidForExaggeration!==u.exaggeration()?(this._centerAltitude=this._centerAltitude/this._centerAltitudeValidForExaggeration*u.exaggeration(),this._centerAltitudeValidForExaggeration=u.exaggeration()):(this._centerAltitude=i||0,this._centerAltitudeValidForExaggeration=u.exaggeration()),this._updateSeaLevelZoom()}_updateSeaLevelZoom(){if(this._centerAltitudeValidForExaggeration===void 0)return;const i=Math.max(0,(this.pixelsPerMeter*this._centerAltitude+this.cameraToCenterDistance)/this.worldSize);this._seaLevelZoom=this._zoomFromMercatorZ(i)}sampleAverageElevation(){if(!this._elevation)return 0;const i=this._elevation,o=[[.5,.2],[.3,.5],[.5,.5],[.7,.5],[.5,.8]],u=this.horizonLineFromTop();let d=0,m=0;for(let _=0;_<o.length;_++){const y=new a.P(o[_][0]*this.width,u+o[_][1]*(this.height-u)),v=i.pointCoordinate(y);if(!v)continue;const T=1/Math.hypot(v[0]-this._camera.position[0],v[1]-this._camera.position[1]);d+=v[3]*T,m+=T}return m===0?NaN:d/m}get center(){return this._center}set center(i){i.lat===this._center.lat&&i.lng===this._center.lng||(this._unmodified=!1,this._center=i,this._terrainEnabled()&&(this.cameraElevationReference==="ground"?this._updateCameraOnTerrain():this._updateZoomFromElevation()),this._constrain(),this._calcMatrices())}_updateZoomFromElevation(){if(this._seaLevelZoom==null||!this._elevation)return;const i=this._seaLevelZoom,o=this._elevation.getAtPointOrZero(this.locationCoordinate(this.center)),u=this.pixelsPerMeter/this.worldSize*o,d=this._mercatorZfromZoom(i),m=this._mercatorZfromZoom(this._maxZoom),_=Math.max(d-u,m);this._setZoom(this._zoomFromMercatorZ(_))}get padding(){return this._edgeInsets.toJSON()}set padding(i){this._edgeInsets.equals(i)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,i,1),this._calcMatrices())}equals(i){const o=this.elevation,u=i.elevation,d=o!=null!=(u!=null)||o&&u&&o.exaggeration()!==u.exaggeration();return this.width===i.width&&this.height===i.height&&this.center.lng===i.center.lng&&this.center.lat===i.center.lat&&this.zoom===i.zoom&&this.bearing===i.bearing&&this.pitch===i.pitch&&this.fov===i.fov&&this.projection.name===i.projection.name&&this._edgeInsets.equals(i.padding)&&!d}computeZoomRelativeTo(i){const o=this.rayIntersectionCoordinate(this.pointRayIntersection(this.centerPoint,i.toAltitude()));let u;u=i.z<this._camera.position[2]?[o.x,o.y,o.z]:[i.x,i.y,i.z];const d=a.ai(a.ax([],this._camera.position,u));return a.aC(this._zoomFromMercatorZ(d),this._minZoom,this._maxZoom)}setFreeCameraOptions(i){if(!this.height||!i.position&&!i.orientation)return;this._updateCameraState();let o=!1;if(i.orientation&&!a.c4(i.orientation,this._camera.orientation)&&(o=this._setCameraOrientation(i.orientation)),i.position){const u=[i.position.x,i.position.y,i.position.z];a.c5(u,this._camera.position)||(this._setCameraPosition(u),o=!0)}o&&(this._updateStateFromCamera(),this.recenterOnTerrain())}getFreeCameraOptions(){this._updateCameraState();const i=this._camera.position,o=new Mc;return o.position=new a.ag(i[0],i[1],i[2]),o.orientation=this._camera.orientation,o._elevation=this.elevation,o._renderWorldCopies=this.renderWorldCopies,o}_setCameraOrientation(i){if(!a.c6(i))return!1;a.c7(i,i);const o=a.c8([],[0,0,-1],i),u=a.c8([],[0,-1,0],i);if(u[2]<0)return!1;const d=sh(o,u);return!!d&&(this._camera.orientation=d,!0)}_setCameraPosition(i){const o=this.zoomScale(this.minZoom)*this.tileSize,u=this.zoomScale(this.maxZoom)*this.tileSize,d=this.cameraToCenterDistance;i[2]=a.aC(i[2],d/u,d/o),this._camera.position=i}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}get fovAboveCenter(){return this._fov*(.5+this.centerOffset.y/this.height)}isPaddingEqual(i){return this._edgeInsets.equals(i)}interpolatePadding(i,o,u){this._unmodified=!1,this._edgeInsets.interpolate(i,o,u),this._constrain(),this._calcMatrices()}coveringZoomLevel(i){const o=(i.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/i.tileSize));return Math.max(0,o)}getVisibleUnwrappedCoordinates(i){const o=[new a.c9(0,i)];if(this.renderWorldCopies){const u=this.pointCoordinate(new a.P(0,0)),d=this.pointCoordinate(new a.P(this.width,0)),m=this.pointCoordinate(new a.P(this.width,this.height)),_=this.pointCoordinate(new a.P(0,this.height)),y=Math.floor(Math.min(u.x,d.x,m.x,_.x)),v=Math.floor(Math.max(u.x,d.x,m.x,_.x)),T=1;for(let I=y-T;I<=v+T;I++)I!==0&&o.push(new a.c9(I,i))}return o}isLODDisabled(i){return(!i||this.pitch<=60)&&this._edgeInsets.top<=this._edgeInsets.bottom&&!this._elevation&&!this.projection.isReprojectedInTileSpace}extendTileCover(i,o,u,d){let m=[];const _=u!=null,y=!_;if(y&&this.zoom<o||_&&u[0]===0&&u[1]===0)return m;const v=new Set,T=(M,C,D,F,z)=>{const V=a.cD(C,M,D,F,z);v.has(V)||(m.push(new a.aS(M,C,D,F,z)),v.add(V))};for(let M=0;M<i.length;M++){const C=i[M];if(y&&C.canonical.z!==o||_&&d!==void 0&&d>C.canonical.z)continue;const D=C.canonical,F=C.overscaledZ,z=C.wrap,V=1<<D.z,N=D.x+1<V,$=D.x>0,H=D.y+1<V,j=D.y>0,ne=C.wrap-($?0:1),Y=C.wrap+(N?0:1),re=$?D.x-1:V-1,Z=N?D.x+1:0;if(_)u[0]<0?(T(F,Y,D.z,Z,D.y),u[1]<0&&H&&(T(F,z,D.z,D.x,D.y+1),T(F,Y,D.z,Z,D.y+1)),u[1]>0&&j&&(T(F,z,D.z,D.x,D.y-1),T(F,Y,D.z,Z,D.y-1))):u[0]>0?(T(F,ne,D.z,re,D.y),u[1]<0&&H&&(T(F,z,D.z,D.x,D.y+1),T(F,ne,D.z,re,D.y+1)),u[1]>0&&j&&(T(F,z,D.z,D.x,D.y-1),T(F,ne,D.z,re,D.y-1))):u[1]<0&&H?T(F,z,D.z,D.x,D.y+1):j&&T(F,z,D.z,D.x,D.y-1);else{const K=C.visibleQuadrants;
vendor: 16,050 bytes, line 8
81&K&&(T(F,ne,D.z,re,D.y),j&&(T(F,z,D.z,D.x,D.y-1),T(F,ne,D.z,re,D.y-1))),2&K&&(T(F,Y,D.z,Z,D.y),j&&(T(F,z,D.z,D.x,D.y-1),T(F,Y,D.z,Z,D.y-1))),4&K&&(T(F,ne,D.z,re,D.y),H&&(T(F,z,D.z,D.x,D.y+1),T(F,ne,D.z,re,D.y+1))),8&K&&(T(F,Y,D.z,Z,D.y),H&&(T(F,z,D.z,D.x,D.y+1),T(F,Y,D.z,Z,D.y+1)))}}const I=[];for(const M of m)m.some(C=>M.isChildOf(C))||I.push(M);if(m=I.filter(M=>!i.some(C=>!!(M.overscaledZ<o&&C.isChildOf(M))||M.equals(C)||M.isChildOf(C))),y){const M=1<<o,C=this.projection.name==="globe"?this._camera.mercatorPosition:this.pointCoordinate(this.getCameraPoint()),D=[M*C.x,M*C.y],F=4,z=F*F;m=m.filter(V=>{const N=V.canonical.x+.5-D[0],$=V.canonical.y+.5-D[1];return N*N+$*$<z})}return m}extendTileCoverToNearPlane(i,o,u){const d=[],m=new Set;for(const $ of i)m.add($.key);const _=($,H,j,ne,Y)=>{const re=a.cD(H,$,j,ne,Y);m.has(re)||(d.push(new a.aS($,H,j,ne,Y)),m.add(re))},y=i.reduce(($,H)=>Math.max($,H.overscaledZ),u),v=1<<u,T=[new a.P(0,0),new a.P(a.an,0),new a.P(a.an,a.an),new a.P(0,a.an)],I=new a.P(0,0),M=new a.P(0,0),C=($,H)=>{const j=Math.floor($[0]),ne=Math.floor($[1]),Y=($[0]-j)*a.an,re=($[1]-ne)*a.an,Z=Math.floor(H[0]),K=Math.floor(H[1]),te=(H[0]-Z)*a.an,de=(H[1]-K)*a.an;for(let se=-1;se<=1;se++){const be=j+se;if(!(be<0||be>=v)){I.x=Y-se*a.an,M.x=te-(be-Z)*a.an;for(let _e=-1;_e<=1;_e++){const Me=ne+_e;I.y=re-_e*a.an,M.y=de-(Me-K)*a.an,a.cE(I,M,T)&&_(y,0,u,be,Me)}}}},D=o.points,F=D[a.ca],z=D[a.cb],V=this._projectToGround(F,D[a.cc]),N=this._projectToGround(z,D[a.cd]);return C(F,V),C(z,N),d}_projectToGround(i,o){return a.ce(a.cf(),i,o,i[2]/(i[2]-o[2]))}coveringTiles(i){let o=this.coveringZoomLevel(i);const u=o,d=this.elevation&&this.elevation.exaggeration(),m=d&&!i.isTerrainDEM,_=this.projection.name==="mercator";if(i.minzoom!==void 0&&o<i.minzoom)return[];i.maxzoom!==void 0&&o>i.maxzoom&&(o=i.maxzoom);const y=this.locationCoordinate(this.center),v=this.center.lat,T=1<<o,I=[T*y.x,T*y.y,0],M=this.projection.name==="globe",C=!M,D=a.cg.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,o,C),F=M?this._camera.mercatorPosition:this.pointCoordinate(this.getCameraPoint()),z=T*a.bV(1,this.center.lat),V=this._camera.position[2]/a.bV(1,this.center.lat),N=[T*F.x,T*F.y,V*(C?1:z)],$=M||d,H=this.cameraToCenterDistance/i.tileSize*(i.roundZoom?1:.502),j=this.isLODDisabled(!0)?o:0;let ne;if(this._elevation&&i.isTerrainDEM)ne=1e4*this._elevation.exaggeration();else if(this._elevation){const le=this._elevation.getMinMaxForVisibleTiles();ne=le?le.max:this._centerAltitude}else ne=this._centerAltitude;const Y=i.isTerrainDEM?-ne:this._elevation?this._elevation.getMinElevationBelowMSL():0,re=this.projection.isReprojectedInTileSpace?a.ch(this):1,Z=le=>{const we=new a.ag(le.x+25e-6,le.y,le.z),Se=new a.ag(le.x,le.y+25e-6,le.z),$e=le.toLngLat(),Ve=we.toLngLat(),Ne=Se.toLngLat(),De=this.locationCoordinate($e),tt=this.locationCoordinate(Ve),ot=this.locationCoordinate(Ne),Ke=Math.hypot(tt.x-De.x,tt.y-De.y),et=Math.hypot(ot.x-De.x,ot.y-De.y);return Math.sqrt(Ke*et)*re/25e-6},K=le=>{const xe=ne,we=Y;return{aabb:a.ck(this,T,0,0,0,le,we,xe,this.projection),zoom:0,x:0,y:0,minZ:we,maxZ:xe,wrap:le,fullyVisible:!1}},te=[];let de=[];const se=o,be=i.reparseOverscaled?u:o,_e=(V-this._centerAltitude)*z,Me=le=>{if(!this._elevation||!le.tileID||!_)return;const xe=this._elevation.getMinMaxForTile(le.tileID),we=le.aabb;xe?(we.min[2]=xe.min,we.max[2]=xe.max,we.center[2]=(we.min[2]+we.max[2])/2):(le.shouldSplit=fe(le),le.shouldSplit||(we.min[2]=we.max[2]=we.center[2]=this._centerAltitude))},Le=(le,xe)=>{if(.707*xe<le)return 1;const we=xe/le;return we/(1.4144271570014144+(Math.pow(1.1,we-1.4144271570014144+1)-1)/(1.1-1)-1)},fe=le=>{if(le.zoom<j)return!0;if(le.zoom===se)return!1;if(le.shouldSplit!=null)return le.shouldSplit;const xe=le.aabb.distanceX(N),we=le.aabb.distanceY(N);let Se=_e,$e=1;if(M){Se=le.aabb.distanceZ(N);const et=Math.pow(2,le.zoom),_t=a.bW((le.y+1)/et),xt=a.bW(le.y/et),gt=Math.min(Math.max(v,_t),xt),At=a.cI(gt)/a.cI(v);if($e=gt===v?1/Math.max(1,this._mercatorScaleRatio-.3):Math.min(1,At/this._mercatorScaleRatio),this.zoom<=a.cF&&le.zoom===se-1&&At>=.9)return!0}else if(m&&(Se=le.aabb.distanceZ(N)*z),this.projection.isReprojectedInTileSpace&&u<=5){const et=Math.pow(2,le.zoom),_t=Z(new a.ag((le.x+.5)/et,(le.y+.5)/et));$e=_t>.85?1:_t}if(!_&&!M){const et=Math.sqrt(xe*xe+we*we+Se*Se);let _t=(1<<se-le.zoom)*H*$e;return _t*=Le(Math.max(Se,_e),et),et<_t}let Ve=Number.MAX_VALUE,Ne=0;const De=le.aabb.getCorners(),tt=[];for(const et of De){a.ax(tt,et,N),M||(m?tt[2]*=z:tt[2]=_e);const _t=a.bj(tt,this._camera.forward());_t<Ve&&(Ve=_t,Ne=Math.abs(tt[2]))}let ot=(1<<se-le.zoom)*H*$e;if(ot*=Le(Math.max(Ne,_e),Ve),Ve<ot)return!0;const Ke=le.aabb.closestPoint(I);return Ke[0]===I[0]&&Ke[1]===I[1]};if(this.renderWorldCopies)for(let le=1;le<=3;le++)te.push(K(-le)),te.push(K(le));for(te.push(K(0));te.length>0;){const le=te.pop(),xe=le.x,we=le.y;let Se=le.fullyVisible;const $e=()=>this.projection.name==="globe"&&(le.y===0||le.y===(1<<le.zoom)-1);if(!Se){let Ve=$?le.aabb.intersects(D):le.aabb.intersectsFlat(D);if(Ve===0&&$e()){const Ne=new a.ci(le.zoom,xe,we);Ve=a.cj(this,T,Ne,!0).intersects(D)}if(Ve===0)continue;Se=Ve===2}if(le.zoom===se||!fe(le)){const Ve=le.zoom===se?be:le.zoom;if(i.minzoom&&i.minzoom>Ve)continue;let Ne=0;if(!Se){let Ke=$?le.aabb.intersectsPrecise(D):le.aabb.intersectsPreciseFlat(D);if(Ke===0&&$e()){const et=new a.ci(le.zoom,xe,we);Ke=a.cj(this,T,et,!0).intersectsPrecise(D)}if(Ke===0)continue;if(i.calculateQuadrantVisibility)if(D.containsPoint(le.aabb.center))Ne=15;else for(let et=0;et<4;et++)le.aabb.quadrant(et).intersects(D)!==0&&(Ne|=1<<et)}const De=I[0]-(.5+xe+(le.wrap<<le.zoom))*(1<<o-le.zoom),tt=I[1]-.5-we,ot=le.tileID?le.tileID:new a.aS(Ve,le.wrap,le.zoom,xe,we);i.calculateQuadrantVisibility&&(ot.visibleQuadrants=Ne),de.push({tileID:ot,distanceSq:De*De+tt*tt});continue}for(let Ve=0;Ve<4;Ve++){const Ne=(xe<<1)+Ve%2,De=(we<<1)+(Ve>>1),tt={aabb:_?le.aabb.quadrant(Ve):a.ck(this,T,le.zoom+1,Ne,De,le.wrap,le.minZ,le.maxZ,this.projection),zoom:le.zoom+1,x:Ne,y:De,wrap:le.wrap,fullyVisible:Se,tileID:void 0,shouldSplit:void 0,minZ:le.minZ,maxZ:le.maxZ};m&&!M&&(tt.tileID=new a.aS(le.zoom+1===se?be:le.zoom+1,le.wrap,le.zoom+1,Ne,De),Me(tt)),te.push(tt)}}if(this.fogCullDistSq){const le=this.fogCullDistSq,xe=this.horizonLineFromTop();de=de.filter(we=>{const Se=[0,0,0,1],$e=[a.an,a.an,0,1],Ve=this.calculateFogTileMatrix(we.tileID.toUnwrapped());a.aE(Se,Se,Ve),a.aE($e,$e,Ve);const Ne=a.cl([],Se,$e),De=a.cm([],Se,$e),tt=a.cG(Ne,De);if(tt===0)return!0;let ot=!1;const Ke=this._elevation;if(Ke&&tt>le&&xe!==0){const et=this.calculateProjMatrix(we.tileID.toUnwrapped());let _t;i.isTerrainDEM||(_t=Ke.getMinMaxForTile(we.tileID)),_t||(_t={min:Y,max:ne});const xt=a.cn(this.rotation),gt=[xt[0]*a.an,xt[1]*a.an,_t.max];a.ah(gt,gt,et),ot=(1-gt[1])*this.height*.5<xe}return tt<le||ot})}return de.sort((le,xe)=>le.distanceSq-xe.distanceSq).map(le=>le.tileID)}resize(i,o){this.width=i,this.height=o,this.pixelsToGLUnits=[2/i,-2/o],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(i){return Math.pow(2,i)}scaleZoom(i){return Math.log2(i)}project(i){const o=a.aC(i.lat,-a.co,a.co),u=this.projection.project(i.lng,o);return new a.P(u.x*this.worldSize,u.y*this.worldSize)}unproject(i){return this.projection.unproject(i.x/this.worldSize,i.y/this.worldSize)}get point(){return this.project(this.center)}get pointMerc(){return this.point._div(this.worldSize)}get pixelsPerMeterRatio(){return this.pixelsPerMeter/a.bV(1,this.center.lat)/this.worldSize}setLocationAtPoint(i,o){let u,d;const m=this.centerPoint;if(this.projection.name==="globe"){const y=this.worldSize;u=(o.x-m.x)/y,d=(o.y-m.y)/y}else{const y=this.pointCoordinate(o),v=this.pointCoordinate(m);u=y.x-v.x,d=y.y-v.y}const _=this.locationCoordinate(i);this.setLocation(new a.ag(_.x-u,_.y-d))}setLocation(i){this.center=this.coordinateLocation(i),this.projection.wrap&&(this.center=this.center.wrap())}locationPoint(i,o){return this.projection.locationPoint(this,i,o)}locationPoint3D(i,o){return this.projection.locationPoint(this,i,o,!0)}pointLocation(i){return this.coordinateLocation(this.pointCoordinate(i))}pointLocation3D(i,o){return this.coordinateLocation(this.pointCoordinate3D(i,o))}locationCoordinate(i,o){const u=o?a.bV(o,i.lat):void 0,d=this.projection.project(i.lng,i.lat);return new a.ag(d.x,d.y,u)}coordinateLocation(i){return this.projection.unproject(i.x,i.y)}pointRayIntersection(i,o){const u=o??this._centerAltitude,d=[i.x,i.y,0,1],m=[i.x,i.y,1,1];a.aE(d,d,this.pixelMatrixInverse),a.aE(m,m,this.pixelMatrixInverse);const _=m[3];a.cp(d,d,1/d[3]),a.cp(m,m,1/_);const y=d[2],v=m[2];return{p0:d,p1:m,t:y===v?0:(u-y)/(v-y)}}screenPointToMercatorRay(i){const o=[i.x,i.y,0,1],u=[i.x,i.y,1,1];return a.aE(o,o,this.pixelMatrixInverse),a.aE(u,u,this.pixelMatrixInverse),a.cp(o,o,1/o[3]),a.cp(u,u,1/u[3]),o[2]=a.bV(o[2],this._center.lat)*this.worldSize,u[2]=a.bV(u[2],this._center.lat)*this.worldSize,a.cp(o,o,1/this.worldSize),a.cp(u,u,1/this.worldSize),new a.az([o[0],o[1],o[2]],a.ay([],a.ax([],u,o)))}rayIntersectionCoordinate(i){const{p0:o,p1:u,t:d}=i,m=a.bV(o[2],this._center.lat),_=a.bV(u[2],this._center.lat);return new a.ag(a.am(o[0],u[0],d)/this.worldSize,a.am(o[1],u[1],d)/this.worldSize,a.am(m,_,d))}pointCoordinate(i,o=this._centerAltitude){return this.projection.pointCoordinate(this,i.x,i.y,o)}pointCoordinate3D(i,o){if(!this.elevation)return this.pointCoordinate(i,o);let u=this.projection.pointCoordinate3D(this,i.x,i.y);if(u)return new a.ag(u[0],u[1],u[2]);let d=0,m=this.horizonLineFromTop();if(i.y>m)return this.pointCoordinate(i,o);const _=.02*m,y=i.clone();for(let v=0;v<10&&m-d>_;v++){y.y=a.am(d,m,.66);const T=this.projection.pointCoordinate3D(this,y.x,y.y);T?(m=y.y,u=T):d=y.y}return u?new a.ag(u[0],u[1],u[2]):this.pointCoordinate(i)}isPointAboveHorizon(i){return this.projection.isPointAboveHorizon(this,i)}isPointOnSurface(i){if(i.y<0||i.y>this.height||i.x<0||i.x>this.width)return!1;if(this.elevation||this.zoom>=a.cq)return!this.isPointAboveHorizon(i);const o=this.pointCoordinate(i);return o.y>=0&&o.y<=1}_coordinatePoint(i,o){const u=o&&this.elevation?this.elevation.getAtPointOrZero(i,this._centerAltitude):this._centerAltitude,d=[i.x*this.worldSize,i.y*this.worldSize,u+i.toAltitude(),1];return a.aE(d,d,this.pixelMatrix),d[3]>0?new a.P(d[0]/d[3],d[1]/d[3]):new a.P(Number.MAX_VALUE,Number.MAX_VALUE)}_getBoundsNonRectangular(){const{top:i,left:o}=this._edgeInsets,u=this.height-this._edgeInsets.bottom,d=this.width-this._edgeInsets.right,m=this.pointLocation3D(new a.P(o,i)),_=this.pointLocation3D(new a.P(d,i)),y=this.pointLocation3D(new a.P(d,u)),v=this.pointLocation3D(new a.P(o,u));let T=Math.min(m.lng,_.lng,y.lng,v.lng),I=Math.max(m.lng,_.lng,y.lng,v.lng),M=Math.min(m.lat,_.lat,y.lat,v.lat),C=Math.max(m.lat,_.lat,y.lat,v.lat);const D=Math.pow(2,-this.zoom)/16*270,F=this.projection.name==="globe"?1:4,z=(V,N,$,H,j)=>{const ne=(V+$)/2,Y=(N+H)/2,re=new a.P(ne,Y),{lng:Z,lat:K}=this.pointLocation3D(re),te=Math.max(0,T-Z,M-K,Z-I,K-C);T=Math.min(T,Z),I=Math.max(I,Z),M=Math.min(M,K),C=Math.max(C,K),(j<F||te>D)&&(z(V,N,ne,Y,j+1),z(ne,Y,$,H,j+1))};if(z(o,i,d,i,1),z(d,i,d,u,1),z(d,u,o,u,1),z(o,u,o,i,1),this.projection.name==="globe"){const[V,N]=a.cr(this);V?(C=90,I=180,T=-180):N&&(M=-90,I=180,T=-180)}return new a.aK(new a.aV(T,M),new a.aV(I,C))}_getBoundsRectangular(i,o){const{top:u,left:d}=this._edgeInsets,m=this.height-this._edgeInsets.bottom,_=this.width-this._edgeInsets.right,y=new a.P(d,u),v=new a.P(_,u),T=new a.P(_,m),I=new a.P(d,m);let M=this.pointCoordinate(y,i),C=this.pointCoordinate(v,i);const D=this.pointCoordinate(T,o),F=this.pointCoordinate(I,o),z=(V,N)=>(N.y-V.y)/(N.x-V.x);return M.y>1&&C.y>=0?M=new a.ag((1-F.y)/z(F,M)+F.x,1):M.y<0&&C.y<=1&&(M=new a.ag(-F.y/z(F,M)+F.x,0)),C.y>1&&M.y>=0?C=new a.ag((1-D.y)/z(D,C)+D.x,1):C.y<0&&M.y<=1&&(C=new a.ag(-D.y/z(D,C)+D.x,0)),new a.aK().extend(this.coordinateLocation(M)).extend(this.coordinateLocation(C)).extend(this.coordinateLocation(F)).extend(this.coordinateLocation(D))}_getBoundsRectangularTerrain(){const i=this.elevation;if(!i.visibleDemTiles.length||i.isUsingMockSource())return this._getBoundsRectangular(0,0);const o=i.visibleDemTiles.reduce((u,d)=>{if(d.dem){const m=d.dem.tree;u.min=Math.min(u.min,m.minimums[0]),u.max=Math.max(u.max,m.maximums[0])}return u},{min:Number.MAX_VALUE,max:0});return this._getBoundsRectangular(o.min*i.exaggeration(),o.max*i.exaggeration())}getBounds(){return this.projection.name==="mercator"||this.projection.name==="equirectangular"?this._terrainEnabled()?this._getBoundsRectangularTerrain():this._getBoundsRectangular(0,0):this._getBoundsNonRectangular()}horizonLineFromTop(i=!0){const o=this.height/2/Math.tan(this._fov/2)/Math.tan(Math.max(this._pitch,.1))-this.centerOffset.y,u=this.height/2-o*(1-this._horizonShift);return i?Math.max(0,u):u}getMaxBounds(){return this.maxBounds}setMaxBounds(i){this.maxBounds=i,this.minLat=-a.co,this.maxLat=a.co,this.minLng=-180,this.maxLng=180,i&&(this.minLat=i.getSouth(),this.maxLat=i.getNorth(),this.minLng=i.getWest(),this.maxLng=i.getEast(),this.maxLng<this.minLng&&(this.maxLng+=360)),this.worldMinX=a.aH(this.minLng)*this.tileSize,this.worldMaxX=a.aH(this.maxLng)*this.tileSize,this.worldMinY=a.aL(this.maxLat)*this.tileSize,this.worldMaxY=a.aL(this.minLat)*this.tileSize,this._constrain()}calculatePosMatrix(i,o){return this.projection.createTileMatrix(this,o,i)}calculateDistanceTileData(i){const o=i.key,u=this._distanceTileDataCache;if(u[o])return u[o];const d=i.canonical,m=1/this.height,_=this.cameraWorldSize,y=_/this.zoomScale(d.z),v=(d.x+Math.pow(2,d.z)*i.wrap)*y,T=d.y*y,I=this.point;I.x*=_/this.worldSize,I.y*=_/this.worldSize;const M=this.angle,C=Math.sin(-M),D=-Math.cos(-M);return u[o]={bearing:[C,D],center:[(I.x-v)*m,(I.y-T)*m],scale:y/a.an*m},u[o]}calculateFogTileMatrix(i){const o=i.key,u=this._fogTileMatrixCache;if(u[o])return u[o];const d=this.projection.createTileMatrix(this,this.cameraWorldSizeForFog,i);return a.aD(d,this.worldToFogMatrix,d),u[o]=new Float32Array(d),u[o]}calculateProjMatrix(i,o=!1,u=!1){const d=i.key;let m;if(m=u?this._expandedProjMatrixCache:o?this._alignedProjMatrixCache:this._projMatrixCache,m[d])return m[d];const _=this.calculatePosMatrix(i,this.worldSize);let y;return y=this.projection.isReprojectedInTileSpace?this.mercatorMatrix:u?this.expandedFarZProjMatrix:o?this.alignedProjMatrix:this.projMatrix,a.aD(_,y,_),m[d]=new Float32Array(_),m[d]}calculatePixelsToTileUnitsMatrix(i){const o=i.tileID.key,u=this._pixelsToTileUnitsCache;if(u[o])return u[o];const d=a.cs(i,this);return u[o]=d,u[o]}customLayerMatrix(){return this.mercatorMatrix.slice()}globeToMercatorMatrix(){if(this.projection.name==="globe"){const i=1/this.worldSize,o=a.bQ([],[i,i,i]);return a.aD(o,o,this.globeMatrix),o}}recenterOnTerrain(){if(!this._elevation||this.projection.name==="globe")return;const i=this._elevation;this._updateCameraState();const o=a.bV(1,this._center.lat)*this.worldSize,u=this._computeCameraPosition(o),d=this._camera.forward(),m=a.bV(1,this._center.lat);u[2]/=m,d[2]/=m,a.ay(d,d);const _=i.raycast(u,d,i.exaggeration());if(_){const y=a.bh([],u,d,_),v=new a.ag(y[0],y[1],a.bV(y[2],a.bW(y[1]))),T=(v.z+a.ai([v.x-u[0],v.y-u[1],v.z-u[2]*m]))*this._pixelsPerMercatorPixel;this._seaLevelZoom=this._zoomFromMercatorZ(T),this._centerAltitude=v.toAltitude(),this._center=this.coordinateLocation(v),this._updateZoomFromElevation(),this._constrain(),this._calcMatrices()}}_constrainCamera(i=!1){if(!this._elevation)return;const o=this._elevation,u=a.bV(1,this._center.lat)*this.worldSize,d=this._computeCameraPosition(u),m=o.getAtPointOrZero(new a.ag(...d)),_=this.pixelsPerMeter/this.worldSize*m,y=this._minimumHeightOverTerrain(),v=d[2]-_;if(v<=y)if(v<0||i){const T=this.locationCoordinate(this._center,this._centerAltitude),I=[d[0],d[1],T.z-d[2]],M=a.ai(I);I[2]-=(y-v)/this._pixelsPerMercatorPixel;const C=a.ai(I);if(C===0)return;a.bK(I,I,M/C*this._pixelsPerMercatorPixel),this._camera.position=[d[0],d[1],T.z*this._pixelsPerMercatorPixel-
8I[2]],this._updateStateFromCamera()}else this._isCameraConstrained=!0}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;const i=this.projection.name==="globe"||this.mercatorFromTransition;if(this.projection.isReprojectedInTileSpace||i){const C=this.center;return C.lat=a.aC(C.lat,this.minLat,this.maxLat),(this.maxBounds||!this.renderWorldCopies&&!i)&&(C.lng=a.aC(C.lng,this.minLng,this.maxLng)),this.center=C,void(this._constraining=!1)}const o=this._unmodified,{x:u,y:d}=this.point;let m=0,_=u,y=d;const v=this.width/2,T=this.height/2,I=this.worldMinY*this.scale,M=this.worldMaxY*this.scale;if(d-T<I&&(y=I+T),d+T>M&&(y=M-T),M-I<this.height&&(m=Math.max(m,this.height/(M-I)),y=(M+I)/2),this.maxBounds||!this._renderWorldCopies||!this.projection.wrap){const C=this.worldMinX*this.scale,D=this.worldMaxX*this.scale,F=this.worldSize/2-(C+D)/2;_=(u+F+this.worldSize)%this.worldSize-F,_-v<C&&(_=C+v),_+v>D&&(_=D-v),D-C<this.width&&(m=Math.max(m,this.width/(D-C)),_=(D+C)/2)}_===u&&y===d||this._allowWorldUnderZoom||(this.center=this.unproject(new a.P(_,y))),m&&!this._allowWorldUnderZoom&&(this.zoom+=this.scaleZoom(m)),this._constrainCamera(),this._unmodified=o,this._constraining=!1}_minZoomForBounds(){let i=Math.max(0,this.scaleZoom(Math.max(0,this.height)/(this.worldMaxY-this.worldMinY)));return this.maxBounds&&(i=Math.max(i,this.scaleZoom(this.width/(this.worldMaxX-this.worldMinX)))),i}_maxCameraBoundsDistance(){return this._mercatorZfromZoom(this._minZoomForBounds())}_calcMatrices(){if(!this.height)return;const i=this.centerOffset,o=this.projection.name==="globe",u=this.pixelsPerMeter;this.projection.name==="globe"&&(this._mercatorScaleRatio=a.bV(1,this.center.lat)/a.bV(1,a.cJ));const d=a.ct(this.projection,this.zoom,this.width,this.height,1024);this._pixelsPerMercatorPixel=this.projection.pixelSpaceConversion(this.center.lat,this.worldSize,d),this.cameraToCenterDistance=.5/Math.tan(.5*this._fov)*this.height*this._pixelsPerMercatorPixel,this._updateCameraState(),this._farZ=this.projection.farthestPixelDistance(this),this._nearZ=this.height/50;const m=this.projection.zAxisUnit==="meters"?u:1,_=this._camera.getWorldToCamera(this.worldSize,m);let y;const v=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,this._farZ);if(v[8]=2*-i.x/this.width,v[9]=2*i.y/this.height,this.isOrthographic){let K=.5*this.height/Math.tan(this._fov/2)*1*Math.tan(.5*this._fov),te=K*this.aspect,de=-te,se=-K;te-=i.x,de-=i.x,K+=i.y,se+=i.y,y=this._camera.getCameraToClipOrthographic(de,te,se,K,this._nearZ+this._nearClipOffset,this._farZ),((be,_e,Me,Le)=>{for(let fe=0;fe<16;fe++)be[fe]=a.am(_e[fe],Me[fe],Le)})(y,y,v,a.cH(this.pitch>=Wr?1:this.pitch/Wr))}else y=v;const T=a.cu([],v,_);let I=a.cu([],y,_);if(this.projection.isReprojectedInTileSpace){const K=this.locationCoordinate(this.center),te=a.ba([]);a.by(te,te,[K.x*this.worldSize,K.y*this.worldSize,0]),a.aD(te,te,a.cv(this)),a.by(te,te,[-K.x*this.worldSize,-K.y*this.worldSize,0]),a.aD(I,I,te),a.aD(T,T,te),this.inverseAdjustmentMatrix=a.cw(this)}else this.inverseAdjustmentMatrix=[1,0,0,1];if(this.mercatorMatrix=a.cx([],I,[this.worldSize,this.worldSize,this.worldSize/m,1]),this.projMatrix=I,this.invProjMatrix=a.b8(new Float64Array(16),this.projMatrix),o){const K=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,1/0);K[8]=2*-i.x/this.width,K[9]=2*i.y/this.height,this.expandedFarZProjMatrix=a.cu([],K,_)}else this.expandedFarZProjMatrix=this.projMatrix;const M=a.b8([],y);this.frustumCorners=a.cy.fromInvProjectionMatrix(M,this.horizonLineFromTop(),this.height),this.cameraFrustum=a.cg.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,0,!o);const C=new Float32Array(16);a.ba(C),a.cx(C,C,[1,-1,1]),a.cz(C,C,this._pitch),a.bb(C,C,this.angle);const D=a.bT(new Float32Array(16),this._fov,this.width/this.height,this._nearZ,this._farZ);this.starsProjMatrix=a.b9(D);const F=(Math.PI/2-this._pitch)*(this.height/this._fov)*this._horizonShift;D[8]=2*-i.x/this.width,D[9]=2*(i.y+F)/this.height,this.skyboxMatrix=a.aD(C,D,C);const z=this.point,V=z.x,N=z.y,$=this.width%2/2,H=this.height%2/2,j=Math.cos(this.angle),ne=Math.sin(this.angle),Y=V-Math.round(V)+j*$+ne*H,re=N-Math.round(N)+j*H+ne*$,Z=new Float64Array(I);if(a.by(Z,Z,[Y>.5?Y-1:Y,re>.5?re-1:re,0]),this.alignedProjMatrix=Z,I=a.bc(),a.cx(I,I,[this.width/2,-this.height/2,1]),a.by(I,I,[1,-1,0]),this.labelPlaneMatr
8ix=I,I=a.bc(),a.cx(I,I,[1,-1,1]),a.by(I,I,[-1,-1,0]),a.cx(I,I,[2/this.width,2/this.height,1]),this.glCoordMatrix=I,this.pixelMatrix=a.aD(new Float64Array(16),this.labelPlaneMatrix,T),this._calcFogMatrices(),this._distanceTileDataCache={},I=a.b8(new Float64Array(16),this.pixelMatrix),!I)throw new Error("failed to invert matrix");if(this.pixelMatrixInverse=I,this.projection.name==="globe"||this.mercatorFromTransition){this.globeMatrix=a.cA(this);const K=[this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]];this.globeCenterInViewSpace=a.ah(K,K,_),this.globeRadius=this.worldSize/2/Math.PI-1}else this.globeMatrix=I;this._projMatrixCache={},this._alignedProjMatrixCache={},this._pixelsToTileUnitsCache={},this._expandedProjMatrixCache={}}_calcFogMatrices(){this._fogTileMatrixCache={};const i=this.cameraWorldSizeForFog,o=this.cameraPixelsPerMeter,u=this._camera.position,d=1/this.height/this._pixelsPerMercatorPixel,m=[i,i,o];a.bK(m,m,d),a.bK(u,u,-1),a.cB(u,u,m);const _=a.bc();a.by(_,_,u),a.cx(_,_,m),this.mercatorFogMatrix=_,this.worldToFogMatrix=this._camera.getWorldToCameraPosition(i,o,d)}_computeCameraPosition(i){const o=(i=i||this.pixelsPerMeter)/this.pixelsPerMeter,u=this._camera.forward(),d=this.point,m=this._mercatorZfromZoom(this._seaLevelZoom?this._seaLevelZoom:this._zoom)*o-i/this.worldSize*this._centerAltitude;return[d.x/this.worldSize-u[0]*m,d.y/this.worldSize-u[1]*m,i/this.worldSize*this._centerAltitude-u[2]*m]}_updateCameraState(){this.height&&(this._camera.setPitchBearing(this._pitch,this.angle),this._camera.position=this._computeCameraPosition())}_translateCameraConstrained(i){const o=this._maxCameraBoundsDistance()*Math.cos(this._pitch),u=this._camera.position[2],d=i[2];let m=1;this.projection.wrap&&(this.center=this.center.wrap()),d>0&&(m=Math.min((o-u)/d,1)),this._camera.position=a.bh([],this._camera.position,i,m),this._updateStateFromCamera()}_updateStateFromCamera(){const i=this._camera.position,o=this._camera.forward(),{pitch:u,bearing:d}=this._camera.getPitchBearing(),m=a.bV(this._centerAltitude,this.center.lat)*this._pixelsPerMercatorPixel,_=this._mercatorZfromZoom(this._maxZoom)*Math.cos(a.ap(this._maxPitch)),y=Math.max((i[2]-m)/Math.cos(u),_),v=this._zoomFromMercatorZ(y);a.bh(i,i,o,y),this._pitch=a.aC(u,a.ap(this.minPitch),a.ap(this.maxPitch)),this.angle=a.bt(d,-Math.PI,Math.PI),this._setZoom(a.aC(v,this._minZoom,this._maxZoom)),this._updateSeaLevelZoom(),this._center=this.coordinateLocation(new a.ag(i[0],i[1],i[2])),this._unmodified=!1,this._constrain(),this._calcMatrices()}_worldSizeFromZoom(i){return Math.pow(2,i)*this.tileSize}_mercatorZfromZoom(i){return this.cameraToCenterDistance/this._worldSizeFromZoom(i)}_minimumHeightOverTerrain(){const i=Math.min(this._seaLevelZoom!=null?this._seaLevelZoom:this._zoom,this._maxZoom)+4;return this._mercatorZfromZoom(i)}_zoomFromMercatorZ(i){return this.scaleZoom(this.cameraToCenterDistance/(Math.max(0,i)*this.tileSize))}zoomFromMercatorZAdjusted(i){let o=0,u=a.cq,d=0,m=1/0;for(;u-o>1e-6&&u>o;){const _=o+.5*(u-o),y=this.tileSize*Math.pow(2,_),v=this.getCameraToCenterDistance(this.projection,_,y),T=this.scaleZoom(v/(Math.max(0,i)*this.tileSize)),I=Math.abs(_-T);I<m&&(m=I,d=_),_<T?o=_:u=_}return d}_terrainEnabled(){return!(!this._elevation||!this.projection.supportsTerrain&&(a.w("Terrain is not yet supported with alternate projections. Use mercator or globe to enable terrain."),1))}anyCornerOffEdge(i,o){const u=Math.min(i.x,o.x),d=Math.max(i.x,o.x),m=Math.min(i.y,o.y),_=Math.max(i.y,o.y);if(m<this.horizonLineFromTop(!1))return!0;if(this.projection.name!=="mercator")return!1;const y=[new a.P(u,m),new a.P(d,_),new a.P(u,_),new a.P(d,m)],v=this.renderWorldCopies?-3:0,T=this.renderWorldCopies?4:1;for(const I of y){const M=this.pointRayIntersection(I);if(M.t<0)return!0;const C=this.rayIntersectionCoordinate(M);if(C.x<v||C.y<0||C.x>T||C.y>1)return!0}return!1}isHorizonVisible(){return this.pitch+a.cC(this.fovAboveCenter)>88||this.anyCornerOffEdge(new a.P(0,0),new a.P(this.width,this.height))}zoomDeltaToMovement(i,o){const u=a.ai(a.ax([],this._camera.position,i)),d=this._zoomFromMercatorZ(u)+o;return u-this._mercatorZfromZoom(d)}getCameraPoint(){if(this.projection.name==="globe"){const i=function([o,u,d],m){const _=[o,u,d,1];a.aE(_,_,m);const y=_[3]=Math.max(_[3],1e-6);return _[0]/=y,_[1]/=y,_[2]/=y,_}([this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]],this.pixelMatrix);return new a.P(i[0],i[1])}{const i=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new a.P(0,i))}}getCameraToCenterDistance(i,o=this.zoom,u=this.worldSize){const d=a.ct(i,o,this.width,this.height,1024),m=i.pixelSpaceConversion(this.center.lat,u,d);let _=.5/Math.tan(.5*this._fov)*this.height*m;return this.isOrthographic&&(_=a.am(1,_,a.cH(this.pitch>=Wr?1:this.pitch/Wr))),_}getWorldToCameraMatrix(){const i=this._camera.getWorldToCamera(this.worldSize,this.projection.zAxisUnit==="meters"?this.pixelsPerMeter:1);return this.projection.name==="globe"&&a.aD(i,i,this.globeMatrix),i}getFrustum(i){return a.cg.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,i,this.projection.zAxisUnit==="meters")}}const no=(l,i)=>{if(i>0&&l.terrain&&a.w("Cutoff is currently disabled on terrain"),i<=0||l.terrain)return{shouldRenderCutoff:!1,uniformValues:{u_cutoff_params:[0,0,0,1]}};const o=l.transform,u=o.pitch,d=o.isLODDisabled(!1)?60:30;if(u<d-15)return{shouldRenderCutoff:!1,uniformValues:{u_cutoff_params:[0,0,0,1]}};const m=o._farZ-o._nearZ,_=i*o.height*1.3,y=Math.pow(2,.85*Math.max(o._zoom-l.minCutoffZoom,0)),v=1.4*o.cameraToCenterDistance*y,T=a.aj(d-15,d,u),I=(1-(M=T))*(o._farZ+_)+M*v;var M;const C=Math.min(_,I-o._nearZ);return{shouldRenderCutoff:T>0,uniformValues:{u_cutoff_params:[o._nearZ,o._farZ,(I-o._nearZ)/m,(I-C-o._nearZ)/m]}}},lr=2048;class Dm{constructor(i,o){this.aabb=i,this.lastCascade=o}}class Pc{add(i,o){const u=this.receivers[i.key];u!==void 0?(u.aabb.min[0]=Math.min(u.aabb.min[0],o.min[0]),u.aabb.min[1]=Math.min(u.aabb.min[1],o.min[1]),u.aabb.min[2]=Math.min(u.aabb.min[2],o.min[2]),u.aabb.max[0]=Math.max(u.aabb.max[0],o.max[0]),u.aabb.max[1]=Math.max(u.aabb.max[1],o.max[1]),u.aabb.max[2]=Math.max(u.aabb.max[2],o.max[2])):this.receivers[i.key]=new Dm(o,null)}clear(){this.receivers={}}get(i){return this.receivers[i.key]}computeRequiredCascades(i,o,u){const d=a.cQ.fromPoints(i.points);let m=0;for(const _ in this.receivers){const y=this.receivers[_];if(!y||!d.intersectsAabb(y.aabb))continue;y.aabb.min=d.closestPoint(y.aabb.min),y.aabb.max=d.closestPoint(y.aabb.max);const v=y.aabb.getCorners();for(let T=0;T<u.length;T++){let I=!0;for(const M of v){const C=[M[0]*o,M[1]*o,M[2]];
vendor: 5,043 bytes, line 8
8if(a.ah(C,C,u[T].matrix),C[0]<-1||C[0]>1||C[1]<-1||C[1]>1){I=!1;break}}if(y.lastCascade=T,m=Math.max(m,T),I)break}}return m+1}}class xf{constructor(i){this.painter=i,this._enabled=!1,this._drawShadowAfterLayer=-1,this._numCascadesToRender=0,this._cascades=[],this._groundShadowTiles=[],this._receivers=new Pc,this._depthMode=new rt(i.context.gl.LEQUAL,rt.ReadWrite,[0,1]),this._uniformValues={u_light_matrix_0:new Float32Array(16),u_light_matrix_1:new Float32Array(16),u_shadow_intensity:0,u_fade_range:[0,0],u_shadow_normal_offset:[1,1,1],u_shadow_texel_size:1,u_shadow_map_resolution:1,u_shadow_direction:[0,0,1],u_shadow_bias:[36e-5,.0012,.012],u_shadowmap_0:0,u_shadowmap_1:0},this._forceDisable=!1,this.useNormalOffset=!1}destroy(){for(const i of this._cascades)i.texture.destroy(),i.framebuffer.destroy();this._cascades=[]}updateShadowParameters(i,o){const u=this.painter;if(this._enabled=!1,this._drawShadowAfterLayer=-1,this._receivers.clear(),!o||!o.properties)return;const d=o.properties.get("shadow-intensity"),m=o.properties.get("shadow-draw-before-layer");if(!o.shadowsEnabled()||d<=0)return;let _=-1,y=0;for(const N of u.style.order){const $=u.style._mergedLayers[N];$.hasShadowPass()&&!$.isHidden(i.zoom)&&(_=y),!m||m!==N&&m!==$.slot||(this._drawShadowAfterLayer=y>0?y-1:0),y+=1}if(this._enabled=_>=0,!this.enabled)return;this._drawShadowAfterLayer<0&&(this._drawShadowAfterLayer=_);const v=u.context,T=lr,I=lr;if(this._cascades.length===0||lr!==this._cascades[0].texture.size[0]){this._cascades=[];for(let N=0;N<2;++N){const $=v.gl,H=v.createFramebuffer(T,I,0,"texture"),j=new a.T(v,{width:T,height:I,data:null},$.DEPTH_COMPONENT16);H.depthAttachment.set(j.texture),this._cascades.push({framebuffer:H,texture:j,matrix:[],far:0,boundingSphereRadius:0,frustum:new a.cg,scale:0})}}this.shadowDirection=vf(o);let M=0;if(i.elevation){const N=i.elevation,$=[1e4,-1e4];N.visibleDemTiles.filter(H=>H.dem).forEach(H=>{const j=H.dem.tree;$[0]=Math.min($[0],j.minimums[0]),$[1]=Math.max($[1],j.maximums[0])}),$[0]!==1e4&&(M=($[1]-$[0])*N.exaggeration())}const C=1.5*i.cameraToCenterDistance,D=3*C,F=new Float64Array(16);for(let N=0;N<this._cascades.length;++N){const $=this._cascades[N];let H=i.height/50,j=1;N===0?j=C:(H=C,j=D);const[ne,Y]=pl(i,this.shadowDirection,H,j,lr,M);$.scale=i.scale,$.matrix=ne,$.boundingSphereRadius=Y,a.b8(F,$.matrix),$.frustum=a.cg.fromInvProjectionMatrix(F,1,0,!0),$.far=j}const z=this._cascades.length-1;this._uniformValues.u_fade_range=[.75*this._cascades[z].far,this._cascades[z].far],this._uniformValues.u_shadow_intensity=d,this._uniformValues.u_shadow_direction=[this.shadowDirection[0],this.shadowDirection[1],this.shadowDirection[2]],this._uniformValues.u_shadow_texel_size=.00048828125,this._uniformValues.u_shadow_map_resolution=lr,this._uniformValues.u_shadowmap_0=11,this._uniformValues.u_shadowmap_1=12,this._groundShadowTiles=u.transform.coveringTiles({tileSize:512,renderWorldCopies:!0});const V=u.transform.elevation;for(const N of this._groundShadowTiles){let $={min:0,max:0};if(V){const H=V.getMinMaxForTile(N);H&&($=H)}this.addShadowReceiver(N.toUnwrapped(),$.min,$.max)}}get enabled(){return this._enabled&&!this._forceDisable}set enabled(i){this._enabled=i}drawShadowPass(i,o){if(!this.enabled)return;const u=this.painter,d=u.context;this._numCascadesToRender=this._receivers.computeRequiredCascades(u.transform.getFrustum(0),u.transform.worldSize,this._cascades),d.viewport.set([0,0,lr,lr]);for(let m=0;m<this._numCascadesToRender;++m){u.currentShadowCascade=m,d.bindFramebuffer.set(this._cascades[m].framebuffer.framebuffer),d.clear({color:a.aq.white,depth:1});for(const _ of i.order){const y=i._mergedLayers[_];if(!y.hasShadowPass()||y.isHidden(u.transform.zoom))continue;const v=i.getLayerSourceCache(y),T=v?o[v.id]:void 0;(y.type==="model"||T&&T.length)&&u.renderLayer(u,v,y,T)}}u.currentShadowCascade=0}drawGroundShadows(){if(!this.enabled)return;const i=this.painter,o=i.style,u=i.context,d=u.gl,m=o.directionalLight,_=o.ambientLight;if(!m||!_)return;const y=[],v=no(i,i.longestCutoffRange);v.shouldRenderCutoff&&y.push("RENDER_CUTOFF"),y.push("RENDER_SHADOWS"),this.useNormalOffset&&y.push("NORMAL_OFFSET");const T=As(o,m,_),I=new rt(d.LEQUAL,rt.ReadOnly,i.depthRangeFor3D),M=new st({func:d.EQUAL,mask:255},0,255,d.KEEP,d.KEEP,d.KEEP);for(const C of this._groundShadowTiles){const D=C.toUnwrapped(),F=i.isTileAffectedByFog(C),z=i.getOrCreateProgram("groundShadow",{defines:y,overrideFog:F});this.setupShadows(D,z),i.uploadCommonUniforms(u,z,D,null,v);const V=yf(i.transform.calculateProjMatrix(D),T);z.draw(i,d.TRIANGLES,I,M,ct.multiply,pt.disabled,V,"ground_shadow",i.tileExtentBuffer,i.quadTriangleIndexBuffer,i.tileExtentSegments,null,i.transform.zoom,null,null)}}getShadowPassDepthMode(){return this._depthMode}getGroundShadowLayerIndex(){return this._drawShadowAfterLayer}calculateShadowPassMatrixFromTile(i){const o=this.painter.transform,u=o.calculatePosMatrix(i,o.worldSize);return a.aD(u,this._cascades[this.painter.currentShadowCascade].matrix,u),Float32Array.from(u)}
8calculateShadowPassMatrixFromMatrix(i){const o=a.b9(i);return a.aD(o,this._cascades[this.painter.currentShadowCascade].matrix,i),o}setupShadows(i,o,u){if(!this.enabled)return;const d=this.painter.transform,m=this.painter.context,_=m.gl,y=this._uniformValues,v=new Float64Array(16),T=d.calculatePosMatrix(i,d.worldSize);for(let I=0;I<this._cascades.length;I++)a.aD(v,this._cascades[I].matrix,T),y[I===0?"u_light_matrix_0":"u_light_matrix_1"]=Float32Array.from(v),m.activeTexture.set(_.TEXTURE0+11+I),this._cascades[I].texture.bindExtraParam(_.LINEAR,_.LINEAR,_.CLAMP_TO_EDGE,_.CLAMP_TO_EDGE,_.GREATER);if(this.useNormalOffset=!!u,this.useNormalOffset){const I=a.cO(i.canonical),M=2/d.tileSize*a.an/lr,C=M*this._cascades[0].boundingSphereRadius,D=M*this._cascades[this._cascades.length-1].boundingSphereRadius,F=(u==="vector-tile"?1:3)*function(z){const V=a.aC((z-22)/-22,0,1);return .125*(1-V)+4*V}(d.zoom);y.u_shadow_normal_offset=[I,C*F,D*F],y.u_shadow_bias=[1e-4,.0012,.012]}else y.u_shadow_bias=[36e-5,.0012,.012];o.setShadowUniformValues(m,y)}setupShadowsFromMatrix(i,o,u=!1){if(!this.enabled)return;const d=this.painter.context,m=d.gl,_=this._uniformValues,y=new Float64Array(16);for(let v=0;v<2;v++)a.aD(y,this._cascades[v].matrix,i),_[v===0?"u_light_matrix_0":"u_light_matrix_1"]=Float32Array.from(y),d.activeTexture.set(m.TEXTURE0+11+v),this._cascades[v].texture.bindExtraParam(m.LINEAR,m.LINEAR,m.CLAMP_TO_EDGE,m.CLAMP_TO_EDGE,m.GREATER);this.useNormalOffset=u,u?(_.u_shadow_normal_offset=[1,3,3],_.u_shadow_bias=[6e-5,.0012,.012]):_.u_shadow_bias=[36e-5,.0012,.012],o.setShadowUniformValues(d,_)}getShadowUniformValues(){return this._uniformValues}getCurrentCascadeFrustum(){return this._cascades[this.painter.currentShadowCascade].frustum}computeSimplifiedTileShadowVolume(i,o,u,d){if(d[2]>=0)return{};const m=function(v,T,I){const M=I/(1<<v.canonical.z);return new a.cQ([v.canonical.x*M+v.wrap*I,v.canonical.y*M+v.wrap*I,0],[(v.canonical.x+1)*M+v.wrap*I,(v.canonical.y+1)*M+v.wrap*I,T])}(i,o,u).getCorners(),_=o/-d[2];d[0]<0?(a.cP(m[0],m[0],[d[0]*_,0,0]),a.cP(m[3],m[3],[d[0]*_,0,0])):d[0]>0&&(a.cP(m[1],m[1],[d[0]*_,0,0]),a.cP(m[2],m[2],[d[0]*_,0,0])),d[1]<0?(a.cP(m[0],m[0],[0,d[1]*_,0]),a.cP(m[1],m[1],[0,d[1]*_,0])):d[1]>0&&(a.cP(m[2],m[2],[0,d[1]*_,0]),a.cP(m[3],m[3],[0,d[1]*_,0]));const y={};return y.vertices=m,y.planes=[Wo(m[1],m[0],m[4]),Wo(m[2],m[1],m[5]),Wo(m[3],m[2],m[6]),Wo(m[0],m[3],m[7])],y}addShadowReceiver(i,o,u){this._receivers.add(i,a.cQ.fromTileIdAndHeight(i,o,u))}getMaxCascadeForTile(i){const o=this._receivers.get(i);return o&&o.lastCascade?o.lastCascade:0}}function Wo(l,i,o){const u=a.ax([],o,i),d=a.ax([],l,i),m=a.bi([],u,d),_=a.ai(m);return _===0?[0,0,1,0]:(a.bK(m,m,1/_),[m[0],m[1],m[2],-a.bj(m,i)])}function vf(l){const i=l.properties.get("direction"),o=a.cL(i.x,i.y,i.z);o[2]=a.aC(o[2],0,75);const u=a.cN([o[0],o[1],o[2]]);return a.cM(u.x,u.y,u.z)}function As(l,i,o){const u=i.properties.get("color-use-theme")==="none",d=i.properties.get("color"),m=i.properties.get("intensity"),_=i.properties.get("direction"),y=[_.x,_.y,_.z],v=o.properties.get("color-use-theme")==="none",T=o.properties.get("color"),I=o.properties.get("intensity"),M=Math.max(a.bj([0,0,1],y),0),C=[0,0,0];a.bK(C,T.toPremultipliedRenderColor(v?null:l.getLut(i.scope)).toArray01Linear().slice(0,3),I);const D=[0,0,0];return a.bK(D,d.toPremultipliedRenderColor(u?null:l.getLut(o.scope)).toArray01Linear().slice(0,3),M*m),a.cS([C[0]>0?C[0]/(C[0]+D[0]):0,C[1]>0?C[1]/(C[1]+D[1]):0,C[2]>0?C[2]/(C[2]+D[2]):0])}function pl(l,i,o,u,d,m){const _=l.zoom,y=l.scale,v=l.worldSize,T=1/v,I=l.aspect,M=Math.sqrt(1+I*I)*Math.tan(.5*l.fovX),C=M*M,D=u-o,F=u+o;let z,V;C>D/F?(z=u,V=u*M):(z=.5*F*(1+C),V=.5*Math.sqrt(D*D+2*(u*u+o*o)*C+F*F*C*C));const N=l.projection.pixelsPerMeter(l.center.lat,v),$=l._camera.getCameraToWorldMercator(),H=[0,0,-z*T];a.ah(H,H,$);let j=V*T;const ne=function(Se){return Se[0]/=y,Se[1]/=y,Se[2]=a.bV(Se[2],l._center.lat),Se},Y=l._edgeInsets;if(!(Y.left===0&&Y.top===0&&Y.right===0&&Y.bottom===0||Y.left===Y.right&&Y.top===Y.bottom)){const Se=l._camera.getWorldToCamera(l.worldSize,l.projection.zAxisUnit==="meters"?N:1),$e=l._camera.getCameraToClipPerspective(l._fov,l.width/l.height,o,u);$e[8]=2*-l.centerOffset.x/l.width,$e[9]=2*l.centerOffset.y/l.height;const Ve=new Float64Array(16);a.cu(Ve,$e,Se);const Ne=new Float64Array(16);a.b8(Ne,Ve);const De=a.cg.fromInvProjectionMatrix(Ne,v,_,!0);for(const tt of De.points){const ot=ne(tt);j=Math.max(j,a.bL(a.cR([],H,ot)))}}j*=d/(d-1);const re=Math.acos(i[2]),Z=Math.atan2(-i[0],-i[1]),K=new Es;K.position=H,K.setPitchBearing(re,Z);const te=K.getWorldToCamera(v,N),de=j*v,se=Math.min(l._mercatorZfromZoom(17)*v*-2,-2*de),be=K.getCameraToClipOrthographic(-de,de,-de,de,se,(de+m*N)/i[2]),_e=new Float64Array(16);a.aD(_e,be,te);const Me=a.cM(Math.floor(1e6*H[0])/1e6*v,Math.floor(1e6*H[1])/1e6*v,0),Le=.5*d,fe=[0,0,0];a.ah(fe,Me,_e),a.bK(fe,fe,Le);const le=[Math.floor(fe[0]),Math.floor(fe[1]),Math.floor(fe[2])],xe=[
80,0,0];a.ax(xe,fe,le),a.bK(xe,xe,-1/Le);const we=new Float64Array(16);return a.ba(we),a.by(we,we,xe),a.aD(_e,we,_e),[_e,de]}class ml extends a.E{constructor(i){super(),this.requestManager=i,this.models={"":{}},this.modelUris={"":{}},this.modelByURL={},this.numModelsLoading={}}loadModel(i,o){return a.cT(this.requestManager.transformRequest(o,a.R.Model).url).then(u=>{const d=a.cU(u),m=new a.cV(i,o,void 0,void 0,d);return m.computeBoundsAndApplyParent(),m}).catch(u=>{if(u&&u.status===404)return null;this.fire(new a.B(new Error(`Could not load model ${i} from ${o}: ${u.message}`)))})}load(i,o,u={forceReload:!1}){this.models[o]||(this.models[o]={});const d=Object.keys(i),m=[],_=[];for(const y of d){const v=i[y];this.hasURLBeenRequested(v)&&!u.forceReload||(this.modelByURL[v]={modelId:y,scope:o},m.push(this.loadModel(y,v)),_.push(y)),this.models[o][y]||(this.models[o][y]={model:null,numReferences:1})}this.numModelsLoading[o]=(this.numModelsLoading[o]||0)+_.length,Promise.allSettled(m).then(y=>{for(let v=0;v<y.length;v++){const{status:T}=y[v];if(T==="rejected")continue;const{value:I}=y[v];this.models[o][_[v]]||(this.models[o][_[v]]={model:null,numReferences:1}),this.models[o][_[v]].model=I}this.numModelsLoading[o]-=_.length,this.fire(new a.C("data",{dataType:"style"}))}).catch(y=>{this.fire(new a.B(new Error(`Could not load models: ${y.message}`)))})}isLoaded(){for(const i in this.numModelsLoading)if(this.numModelsLoading[i]>0)return!1;return!0}hasModel(i,o,u={exactIdMatch:!1}){return!!(u.exactIdMatch?this.getModel(i,o):this.getModelByURL(this.modelUris[o][i]))}getModel(i,o){return this.models[o]||(this.models[o]={}),this.models[o][i]?this.models[o][i].model:void 0}getModelByURL(i){if(!i)return null;const o=this.modelByURL[i];return o?this.models[o.scope][o.modelId].model:null}hasModelBeenAdded(i,o){return this.models[o]&&this.models[o][i]!==void 0}getModelURIs(i){return this.modelUris[i]||{}}addModel(i,o,u){this.models[u]||(this.models[u]={}),this.modelUris[u]||(this.modelUris[u]={});const d=this.requestManager.normalizeModelURL(o);if((this.hasModel(i,u,{exactIdMatch:!0})||this.hasModelBeenAdded(i,u))&&this.modelUris[u][i]===d)this.models[u][i].numReferences++;else if(this.hasURLBeenRequested(d)){const{scope:m,modelId:_}=this.modelByURL[d];this.models[m][_].numReferences++}else this.modelUris[u][i]=d,this.load({[i]:this.modelUris[u][i]},u)}addModelURLs(i,o){this.models[o]||(this.models[o]={}),this.modelUris[o]||(this.modelUris[o]={});const u=this.modelUris[o];for(const d in i)u[d]=this.requestManager.normalizeModelURL(i[d])}reloadModels(i){this.load(this.modelUris[i],i,{forceReload:!0})}addModelsFromBucket(i,o){this.models[o]||(this.models[o]={}),this.modelUris[o]||(this.modelUris[o]={});const u={};for(const d of i)this.hasModel(d,o,{exactIdMatch:!0})||this.hasURLBeenRequested(d)?this.models[o][d].numReferences++:this.modelUris[o][d]&&!this.hasURLBeenRequested(d)?u[d]=this.modelUris[o][d]:!this.hasURLBeenRequested(d)&&a.cW(d,!1)&&(this.modelUris[o][d]=this.requestManager.normalizeModelURL(d),u[d]=this.modelUris[o][d]);this.load(u,o)}hasURLBeenRequested(i){return this.modelByURL[i]!==void 0}removeModel(i,o,u=!1,d=!1){if(this.models[o]&&this.models[o][i]&&(this.models[o][i].numReferences--,this.models[o][i].numReferences===0||d)){const m=this.modelUris[o][i];u||delete this.modelUris[o][i],delete this.modelByURL[m];const _=this.models[o][i].model;if(!_)return;delete this.models[o][i],_.destroy()}}destroy(){for(const i of Object.keys(this.models))for(const o of Object.keys(this.models[i])){const u=this.models[i][o].model;delete this.models[i][o],u&&u.destroy()}this.models={"":{}},this.modelUris={"":{}},this.modelByURL={},this.numModelsLoading={}}listModels(i){return this.models[i]||(this.models[i]={}),Object.keys(this.models[i])}upload(i,o){this.models[o]||(this.models[o]={});for(const u in this.models[o])this.models[o][u].model&&this.models[o][u].model.upload(i.context)}}const ch=a.a8.colorTheme,Rm=new a.ab({data:new a.ac(ch.data)});function ha(l){if(!l.metadata||!l.metadata.content_area)return;const i=a.o.devicePixelRatio,{left:o,top:u,width:d,height:m}=l.metadata.content_area,_=o*i,y=u*i;return[_,y,_+d*i,y+m*i]}function uh(l){if(l)return l.map(([i,o])=>[i*a.o.devicePixelRatio,o*a.o.devicePixelRatio])}class Dc{constructor(i,o,u){this.id=i,this.scope=o,this.sourceCache=u,this.pendingRequests=new Set,this.missingRequests=new Set}addPendingRequest(i){this.missingRequests.has(i.name)||this.pendingRequests.has(i.name)||this.pendingRequests.add(i.name)}hasPendingRequests(){return this.pendingRequests.size>0}resolvePendingRequests(){const i=new Map;if(!this.sourceCache.loaded())return i;const o=this.sourceCache.getVisibleCoordinates();if(o.length===0)return i;const u=this.sourceCache.getSource();if(!(u instanceof Ho))return i;const d=o.map(_=>this.sourceCache.getTile(_)),m=u.getImages(d,Array.from(this.pendingRequests));for(const[_,y]of m)i.set(a.I.from({name:_,iconsetId:this.id}),y),this.pendingRequests.delete(_);for(const _ of this.pendingRequests)this.missingRequests.add(_);return this.pendingRequests.clear(),i}}class hh{constructor(){this._previousClosestBuildingId=null,this._hysteresisRatio=.8,this._indo
vendor: 4,172 bytes, line 8
8orMinimumZoom=16}findClosestBuilding(i,o,u,d,m){if(u<this._indoorMinimumZoom)return this._previousClosestBuildingId=null,null;let _=null,y=Number.MAX_VALUE,v=Number.MAX_VALUE,T=!1;const I=this._previousClosestBuildingId?i[this._previousClosestBuildingId]:null;this._previousClosestBuildingId&&I&&this._isBuildingVisible(I,d,m)&&(T=!0,v=this._calculateDistance(o,I));for(const[M,C]of Object.entries(i)){if(!this._isBuildingVisible(C,d,m))continue;const D=this._calculateDistance(o,C);D<y&&(y=D,_=M)}return T&&_&&this._previousClosestBuildingId&&_!==this._previousClosestBuildingId?y>v*this._hysteresisRatio&&(_=this._previousClosestBuildingId):T&&!_&&(_=this._previousClosestBuildingId),this._previousClosestBuildingId=_,_}_calculateDistance(i,o){if(!o.center)return Number.MAX_VALUE;const u=i.lat-o.center[1],d=i.lng-o.center[0];return u*u+d*d}_isBuildingVisible(i,o,u){if(!u)return!1;for(const d of i.floorIds){const m=i.floors[d];if(!m.geometry)continue;const _=m.geometry;if(_.type==="Polygon"){const y=this._convertRingToPoints(_.coordinates[0]);if(a.bx(y,u))return!0}else if(_.type==="MultiPolygon"){const y=this._convertMultiPolygonToPoints(_.coordinates);if(a.cY(u,y))return!0}}return!1}_convertRingToPoints(i){return i.map(o=>new a.P(o[0],o[1]))}_convertMultiPolygonToPoints(i){return i.map(o=>o.length===0?[]:o[0].map(u=>new a.P(u[0],u[1])))}}class Xo extends a.E{constructor(i){super(),this._style=i,this._buildings={},this._activeFloors=new Set,this._closestBuildingId=null,this._indoorState={selectedFloorId:null,activeFloorsVisible:!0,activeFloors:this._activeFloors},this._buildingDetectionStrategy=new hh,this._initialLoadDone=!1,a.a_(["_updateUI"],this),this._style.on("style.load",()=>{this._style.isIndoorEnabled()&&(this._style.map.on("load",()=>{this._initialLoadDone=!0,this._indoorState&&this._indoorState.needsUpdate&&(this._indoorState.needsUpdate=!1,this._style.updateIndoorDependentLayers()),this._updateUI()}),this._style.map.on("move",this._updateUI),this._style.map.on("idle",this._updateUI))})}destroy(){this._buildings={},this._activeFloors=new Set,this._indoorState=null}selectFloor(i){i===this._selectedFloorId&&this._indoorState&&this._indoorState.activeFloorsVisible||(this._selectedFloorId=i,this._recalculateActiveFloors())}setActiveFloorsVisibility(i){this._updateActiveFloors(i),this._updateIndoorSelector()}setIndoorData(i){let o=!1;for(const[u,d]of Object.entries(i.buildings))if(this._buildings[u])for(const m of d.floorIds)this._buildings[u].floorIds.add(m),this._buildings[u].floors[m]?this._mergeFloors(this._buildings[u].floors[m],d.floors[m]):(this._buildings[u].floors[m]=d.floors[m],this._buildings[u].floorIds.add(m),o=!0);else this._buildings[u]=d,o=!0;o&&this._recalculateActiveFloors()}getIndoorTileOptions(i,o){return this._indoorState?{sourceLayers:this._style.getIndoorSourceLayers(i,o),indoorState:this._indoorState}:null}getControlState(){const i=this._buildings,o=this._closestBuildingId,u=o&&i?i[o]:void 0;if(!u)return{selectedFloorId:null,activeFloorsVisible:!!this._indoorState&&this._indoorState.activeFloorsVisible,floors:[]};let d=null;for(const _ of u.floorIds)if(this._activeFloors&&this._activeFloors.has(_)){d=_;break}const m=Array.from(u.floorIds).map(_=>({id:_,name:u.floors[_].name,zIndex:u.floors[_].zIndex})).sort((_,y)=>y.zIndex-_.zIndex).filter((_,y,v)=>y===0||_.zIndex!==v[y-1].zIndex);return{selectedFloorId:d,activeFloorsVisible:!!this._indoorState&&this._indoorState.activeFloorsVisible,floors:m}}_updateUI(){this._initialLoadDone=!0;const i=this._style.map.transform,o=this._buildingDetectionStrategy.findClosestBuilding(this._buildings,i.center,i.zoom,i.getBounds(),this._makeViewportPolygon());if(o!==this._closestBuildingId){const u=this._closestBuildingId;this._closestBuildingId=o,this._onBuildingTransition(u,o),this._updateIndoorSelector()}}_onBuildingTransition(i,o){if(!this._indoorState)return;!o&&i?(this._indoorState.activeFloors=new Set,this._indoorState.activeFloorsVisible=!1,this._style.updateIndoorDependentLayers()):!!o&&!i&&(this._recalculateActiveFloors(),this._updateActiveFloors(!0))}_updateIndoorSelector(){this.fire(new a.C("selector-update",this.getControlState()))}
8_updateActiveFloors(i){this._indoorState={selectedFloorId:this._selectedFloorId,activeFloorsVisible:i,activeFloors:this._activeFloors},this._initialLoadDone?this._style.updateIndoorDependentLayers():this._indoorState.needsUpdate=!0}_recalculateActiveFloors(){if(!this._buildings)return;const i=a.cZ.calculate(this._buildings,this._selectedFloorId,this._activeFloors);(function(o,u){if(o===u)return!0;if(!o||!u||o.size!==u.size)return!1;for(const d of o)if(!u.has(d))return!1;return!0})(i,this._activeFloors)||(this._activeFloors=i,this._updateActiveFloors(!!this._indoorState&&this._indoorState.activeFloorsVisible),this._updateIndoorSelector())}_mergeFloors(i,o){o.geometry&&(i.geometry?(i.geometry.type==="Polygon"&&(i.geometry={type:"MultiPolygon",coordinates:[i.geometry.coordinates]}),o.geometry.type==="Polygon"?i.geometry.coordinates.push(o.geometry.coordinates):o.geometry.type==="MultiPolygon"&&i.geometry.coordinates.push(...o.geometry.coordinates)):i.geometry=o.geometry)}_makeViewportPolygon(){const i=this._style.map.transform,o=i.width,u=i.height;return[i.pointLocation(new a.P(0,0)),i.pointLocation(new a.P(o,0)),i.pointLocation(new a.P(o,u)),i.pointLocation(new a.P(0,u))].map(d=>new a.P(d.lng,d.lat))}}const Cs=(l,i)=>ze(l,i&&i.filter(o=>o.identifier!=="source.canvas")),zm=a.aJ($t,["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"]),Lm=a.aJ($t,["setCenter","setZoom","setBearing","setPitch"]),Rc=new Set(["background","sky","slot","custom"]),bf={version:8,layers:[],sources:{}},zc={duration:300,delay:0};class zn extends a.E{constructor(i,o={}){if(super(),this.map=i,this.scope=o.scope||"",this.globalId=null,this.fragments=[],this.importDepth=o.importDepth||0,this.importsCache=o.importsCache||new Map,this.resolvedImports=o.resolvedImports||new Set,this.transition=Object.assign({},zc),this._buildingIndex=new df(this),this.crossTileSymbolIndex=new gf,this._mergedOrder=[],this._drapedFirstOrder=[],this._mergedLayers={},this._mergedIndoor={},this._mergedSourceCaches={},this._mergedOtherSourceCaches={},this._mergedSymbolSourceCaches={},this._mergedFillExtrusionSourceCaches={},this._clipLayerPresent=!1,this._hasAppearances=!1,this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this._importedAsBasemap=!1,this._changes=o.styleChanges||new Xi,this._hasDataDrivenEmissive=!1,this.indoorManager=new Xo(this),this.dispatcher=o.dispatcher?o.dispatcher:new xs(jo(),this),this.map.painter&&this.map.painter.context){const d=this.map.painter.context.maxUniformBufferBindings,m=Math.floor(this.map.painter.context.maxUniformBlockSize/4);this.dispatcher.broadcast("setContextParams",{maxBindingPoints:d,maxUniformBlockSizeDwords:m,disableSymbolUBO:this.map.painter.context.disableSymbolUBO})}o.imageManager?this.imageManager=o.imageManager:(this.imageManager=new Ya(this.map._spriteFormat),this.imageManager.setEventedParent(this)),this.imageManager.addScope(this.scope),this.glyphManager=o.glyphManager?o.glyphManager:new a.c_(i._requestManager,o.localFontFamily?a.c$.all:o.localIdeographFontFamily?a.c$.ideographs:a.c$.none,o.localFontFamily||o.localIdeographFontFamily),o.modelManager?this.modelManager=o.modelManager:(this.modelManager=new ml(i._requestManager),this.modelManager.setEventedParent(this)),this._layers={},this._sourceCaches={},this._otherSourceCaches={},this._symbolSourceCaches={},this._fillExtrusionSourceCaches={},this._loaded=!1,this._precompileDone=!1,this._shouldPrecompile=!1,this._availableImages=[],this._availableModels={},this._order=[],this._markersNeedUpdate=!1,this.options=o.configOptions?o.configOptions:new Map,this._configDependentLayers=o.configDependentLayers?o.configDependentLayers:new Set,this._indoorDependentLayers=o.indoorDependentLayers?o.indoorDependentLayers:new Set,this._config=o.config,this._styleColorTheme={lut:null,lutLoading:!1,lutLoadingCorrelationID:0,colorTheme:null,colorThemeOverride:o.colorThemeOverride},this._styleColorThemeForScope={},this._initialConfig=o.initialConfig,this.dispatcher.broadcast("setReferrer",a.d0()),this.dispatcher.broadcast("setConfig",a.d1());const u=this;this._rtlTextPluginCallback=zn.registerForPluginStateChange(d=>{u.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:d.pluginStatus,pluginURL:d.pluginURL},(m,_)=>{if(a.d2(m),_&&_.every(y=>y))for(const y in u._sourceCaches){const v=u._sourceCaches[y],T=v.getSource().type;T!=="vector"&&T!=="geojson"||v.reload()}})}),this.on("data",d=>{if(d.dataType!=="source"||d.sourceDataType!=="metadata")return;const m=this.getOwnSource(d.sourceId);if(m&&m.vectorLayerIds)for(const _ in this._layers){const y=this._layers[_];
8y.source===m.id&&this._validateLayer(y)}})}load(i){return i?(typeof i=="string"?this.loadURL(i):this.loadJSON(i),this):this}_getGlobalId(i){if(!i)return null;if(typeof i=="string"){if(a.h(i))return i;const o=a.d3(i);if(!o.startsWith("http"))try{return new URL(o,location.href).toString()}catch{return o}return o}return`json://${a.d4(JSON.stringify(i))}`}_diffStyle(i,o,u){this.globalId=this._getGlobalId(i);const d=(m,_)=>{try{_(null,this.setState(m,u))}catch(y){_(y,!1)}};if(typeof i=="string"){const m=this.map._requestManager.normalizeStyleURL(i),_=this.map._requestManager.transformRequest(m,a.R.Style);a.m(_,(y,v)=>{y?this.fire(new a.B(y)):v&&d(v,o)})}else typeof i=="object"&&d(i,o)}loadURL(i,o={}){this.fire(new a.C("dataloading",{dataType:"style"}));const u=typeof o.validate=="boolean"?o.validate:!a.h(i);this.globalId=this._getGlobalId(i),i=this.map._requestManager.normalizeStyleURL(i,o.accessToken),this.resolvedImports.add(i);const d=this.importsCache.get(i);if(d)return this._load(d,u);const m=this.map._requestManager.transformRequest(i,a.R.Style);this._request=a.m(m,(_,y)=>{if(this._request=null,_)this.fire(new a.B(_));else if(y)return this.importsCache.set(i,y),this._load(y,u)})}loadJSON(i,o={}){this.fire(new a.C("dataloading",{dataType:"style"})),this.globalId=this._getGlobalId(i),this._request=a.o.frame(()=>{this._request=null,this._load(i,o.validate!==!1)})}loadEmpty(){this.fire(new a.C("dataloading",{dataType:"style"})),this._load(bf,!1)}_loadImports(i,o,u){if(this.importDepth>=4)return a.w("Style doesn't support nesting deeper than 5"),Promise.resolve();const d=[];for(const m of i){const _=this._createFragmentStyle(m),y=new Promise(I=>{_.once("style.import.load",I),_.once("error",I)}).then(()=>{this.mergeAll(),this.fire(new a.C("data",{dataType:"style"}))});if(d.push(y),this.resolvedImports.has(m.url)){_.loadEmpty();continue}const v=m.data||this.importsCache.get(m.url);v?(m.data?(_.fire(new a.C("dataloading",{dataType:"style"})),_.globalId=_._getGlobalId(v),queueMicrotask(()=>_._load(v,o))):_.loadJSON(v,{validate:o}),this._isInternalStyle(v)&&(_.globalId=null)):m.url?_.loadURL(m.url,{validate:o}):_.loadEmpty();const T={style:_,id:m.id,config:m.config};if(u){const I=this.fragments.findIndex(({id:M})=>M===u);this.fragments=this.fragments.slice(0,I).concat(T).concat(this.fragments.slice(I))}else this.fragments.push(T)}return Promise.allSettled(d)}getImportGlobalIds(i=this,o=new Set){for(const u of i.fragments)u.style.globalId&&o.add(u.style.globalId),this.getImportGlobalIds(u.style,o);return[...o.values()]}_createFragmentStyle(i){const o=this.scope?a.F(i.id,this.scope):i.id;let u;const d=this._initialConfig&&this._initialConfig[o];(i.config||d)&&(u=Object.assign({},i.config,d));const m=new zn(this.map,{scope:o,styleChanges:this._changes,importDepth:this.importDepth+1,importsCache:this.importsCache,resolvedImports:new Set(this.resolvedImports),dispatcher:this.dispatcher,imageManager:this.imageManager,glyphManager:this.glyphManager,modelManager:this.modelManager,config:u,configOptions:this.options,colorThemeOverride:i["color-theme"],configDependentLayers:this._configDependentLayers,indoorDependentLayers:this._indoorDependentLayers});return m.setEventedParent(this.map,{style:m}),m}_reloadImports(){this.mergeAll(),this._updateMapProjection(),this.updateConfigDependencies(),this._updateLayers(this._indoorDependentLayers),this.map._triggerCameraUpdate(this.camera),this.dispatcher.broadcast("setLayers",{layers:this._serializeLayers(this._order),scope:this.scope,options:this.options}),this._shouldPrecompile=this.map._precompilePrograms&&this.isRootStyle()}_isInternalStyle(i){return this.isRootStyle()&&(i.fragment||!!i.schema&&i.fragment!==!1)}_load(i,o){if(this._isInternalStyle(i)){const m=Object.assign({},bf,{imports:[{id:"basemap",data:i,url:""}]},i.center?{center:i.center}:{},i.bearing?{bearing:i.bearing}:{},i.pitch?{pitch:i.pitch}:{},i.zoom?{zoom:i.zoom}:{},i.light?{light:i.light}:{});return this._importedAsBasemap=!0,void this._load(m,o)}if(this.updateConfig(this._config,i.schema),o&&Cs(this,Zi(i)))return;this._loaded=!0;for(const m in i.sources)this.addSource(m,i.sources[m],{validate:!1,isInitialLoad:!0});this.stylesheet=a.d5(i);const u=()=>{if(i.iconsets)for(const v in i.iconsets)this.addIconset(v,i.iconsets[v]);i.sprite?this._loadIconset(i.sprite):(this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0})),!this.glyphManager.url&&i.glyphs&&this.glyphManager.setURL(i.glyphs);
8const m=vc(this.stylesheet.layers);if(this._order=m.map(v=>v.id),this.stylesheet.light&&a.w("The `light` root property is deprecated, prefer using `lights` with `flat` light type instead."),this.stylesheet.lights)if(this.stylesheet.lights.length===1&&this.stylesheet.lights[0].type==="flat"){const v=this.stylesheet.lights[0];this.light=new mt(v.properties,v.id)}else this.setLights(this.stylesheet.lights);this.light||(this.light=new mt(this.stylesheet.light)),this._layers={};for(const v of m){const T=a.da(v,this.scope,this._styleColorTheme.lut,this.options);T.expressionDependencies.configDependencies.size!==0&&this._configDependentLayers.add(T.fqid),T.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(T.fqid),this._hasAppearances=this._hasAppearances||T.getAppearances().length!==0,T.setEventedParent(this,{layer:{id:T.id}}),this._layers[T.id]=T;const I=this.getOwnLayerSourceCache(T),M=!!this.directionalLight&&this.directionalLight.shadowsEnabled();I&&T.canCastShadows()&&M&&(I.castsShadows=!0)}if(this.glyphManager.url){const v=new Set;for(const T in this._layers){const I=this._layers[T];if(I.type==="symbol"&&I.layout){const M=I.layout.get("text-font");M&&M.value&&M.value.kind==="constant"&&v.add(M.value.value.join(","))}}for(const T of v)this.glyphManager.prefetchRange(T,0)}this.stylesheet.featuresets&&this.setFeaturesetSelectors(this.stylesheet.featuresets),this.stylesheet.models&&this.addModelURLs(this.stylesheet.models);const _=this.stylesheet.terrain;_&&(this.checkCanvasFingerprintNoise(),this.disableElevatedTerrain||this.terrainSetForDrapingOnly()||this._createTerrain(_,1)),this.stylesheet.fog&&this._createFog(this.stylesheet.fog),this.stylesheet.snow&&this._createSnow(this.stylesheet.snow),this.stylesheet.rain&&this._createRain(this.stylesheet.rain),this.stylesheet.transition&&this.setTransition(this.stylesheet.transition),this.fire(new a.C("data",{dataType:"style"}));const y=this.isRootStyle();i.imports?this._loadImports(i.imports,o).then(()=>{this._reloadImports(),this.fire(new a.C(y?"style.load":"style.import.load"))}).catch(v=>{this.fire(new a.B(new Error("Failed to load imports",v))),this.fire(new a.C(y?"style.load":"style.import.load"))}):(this._reloadImports(),this.fire(new a.C(y?"style.load":"style.import.load")))};this._styleColorTheme.colorTheme=this.stylesheet["color-theme"];const d=this._styleColorTheme.colorThemeOverride?this._styleColorTheme.colorThemeOverride:this._styleColorTheme.colorTheme;if(d){const m=this._evaluateColorThemeData(d);this._loadColorTheme(m).then(()=>{u()}).catch(_=>{a.w(`Couldn't load color theme from the stylesheet: ${_}`),u()})}else this._styleColorTheme.lut=null,u()}isRootStyle(){return this.importDepth===0}hasAppearances(){return this._hasAppearances||this.fragments.some(i=>i.style.hasAppearances())}mergeAll(){let i,o,u,d,m,_,y,v,T,I;const M={};this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle(C=>{if(C.stylesheet){if(C.light!=null&&(i=C.light),C.stylesheet.lights)for(const D of C.stylesheet.lights)D.type==="ambient"&&C.ambientLight!=null&&(o=C.ambientLight),D.type==="directional"&&C.directionalLight!=null&&(u=C.directionalLight);d=this._prioritizeTerrain(d,C.terrain,C.stylesheet.terrain),C.stylesheet.fog&&C.fog!=null&&(m=C.fog),C.stylesheet.snow&&C.snow!=null&&(_=C.snow),C.stylesheet.rain&&C.rain!=null&&(y=C.rain),C.stylesheet.camera!=null&&(I=C.stylesheet.camera),C.stylesheet.projection!=null&&(v=C.stylesheet.projection),C.stylesheet.transition!=null&&(T=C.stylesheet.transition),M[C.scope]=C._styleColorTheme}}),this.light=i,this.ambientLight=o,this.directionalLight=u,this.fog=m,this.snow=_,this.rain=y,this._styleColorThemeForScope=M,d===null?delete this.terrain:this.terrain=d,this.camera=I||{"camera-projection":"perspective"},this.projection=v||{name:"mercator"},this.transition=Object.assign({},zc,T),this.mergeSources(),this.mergeLayers(),this.mergeIndoor()}forEachFragmentStyle(i){const o=u=>{for(const d of u.fragments)o(d.style);i(u)};o(this)}_prioritizeTerrain(i,o,u){const d=i&&i.drapeRenderMode===0;return u===null?o&&o.drapeRenderMode===0?o:d?i:null:o!=null&&(!i||d||o&&o.drapeRenderMode===1)?o:i}mergeTerrain(){let i;this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle(o=>{i=this._prioritizeTerrain(i,o.terrain,o.stylesheet.terrain)}),i===null?delete this.terrain:this.terrain=i}mergeProjection(){let i;this.forEachFragmentStyle(o=>{o.stylesheet.projection!=null&&(i=o.stylesheet.projection)}),this.projection=i||{name:"mercator"}}mergeSources(){const i={},o={},u={},d={};this.forEachFragmentStyle(m=>{for(const _ in m._sourceCaches){const y=a.F(_,m.scope);i[y]=m._sourceCaches[_]}for(const _ in m._otherSourceCaches){const y=a.F(_,m.scope);o[y]=m._otherSourceCaches[_]}for(const _ in m._symbolSourceCaches){const y=a.F(_,m.scope);u[y]=m._symbolSourceCaches[_]}for(const _ in m._fillExtrusionSourceCaches){const y=a.F(_,m.scope);d[y]=m._fillExtrusionSourceCaches[_]}}),this._mergedSourceCaches=i,this._mergedOtherSourceCaches=o,this._mergedSymbolSourceCaches=u,this._mergedFillExtrusionSourceCaches=d}mergeIndoor(){this.forEachFragmentStyle(i=>{if(i.stylesheet&&i.stylesheet.indoor)for(const o of Object.values(i.stylesheet.indoor)){const u=o,d=a.F(u.sourceId,i.scope);this._mergedIndoor[d]=new Set(u.sourceLayers||[])}})}mergeLayers(){const i={},o=[],u={};this._mergedSlots=[],this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this.forEachFragmentStyle(_=>{for(const y of _._order){const v=_._layers[y];if(v.type==="slot"){const T=a.d6(y);if(i[T])continue;i[T]=[]}v.slot&&i[v.slot]?i[v.slot].push(v):o.push(v)}}),this._mergedOrder=[];let d=-1;const m=(_=[])=>{for(const y of _)if(y.type==="slot"){const v=a.d6(y.id);i[v]&&m(i[v]),this._mergedSlots.push(v)}else{const v=a.F(y.id,y.scope);this._mergedOrder.push(v),u[v]=y,y.is3D(!!this.terrain)&&(this._has3DLayers=!0,d=this._mergedOrder.length-1),y.type==="circle"&&(this._hasCircleLayers=!0),y.type==="symbol"&&(this._hasSymbolLayers=!0),y.type==="clip"&&(this._clipLayerPresent=!0)}};if(m(o),this._has3DLayers){const _={};for(let y=0;y<this._mergedOrder.length;++y){const v=this._mergedOrder[y];_[v]=y===d?1:y<d?u[v].hasOcclusionOpacityProperties?2:0:4}this._mergedOrder.sort((y,v)=>_[y]-_[v])}this._mergedLayers=u,this.updateDrapeFirstLayers(),this._buildingIndex.processLayersChanged(),this._updateDataDrivenEmissiveStrength()}terrainSetForDrapingOnly(){return!!this.terrain&&this.terrain.drapeRenderMode===0}getCamera(){return this.stylesheet.camera}setCamera(i){return this.stylesheet.camera=Object.assign({},this.stylesheet.camera,i),this.camera=this.stylesheet.camera,this}_evaluateColorThemeData(i){return i.data?function(o,u,d){const m=Object.assign({},u);for(const y of Object.keys(ch))m[y]===void 0&&(m[y]=ch[y].default);const _=new a.aa(Rm,o,new Map(d));return _.setTransitionOrValue(m,d),_.untransitioned().possiblyEvaluate(new a.ae(0,{worldview:void 0}))}(this.scope,i,this.options).get("data"):null}_loadColorTheme(i){this._styleColorTheme.lutLoading=!0,this._styleColorTheme.lutLoadingCorrelationID+=1;const o=this._styleColorTheme.lutLoadingCorrelationID;return new Promise((u,d)=>{const m="data:image/png;base64,";if(!i||i.length===0)return this._styleColorTheme.lut=null,this._styleColorTheme.lutLoading=!1,void u();let _=i;
8_.startsWith(m)||(_=m+_);const y=a.I.from("mapbox-reserved-lut"),v=new Image;v.src=_,v.onerror=()=>{this._styleColorTheme.lutLoading=!1,d(new Error("Failed to load image data"))},v.onload=()=>{if(this._styleColorTheme.lutLoadingCorrelationID!==o)return void u();this._styleColorTheme.lutLoading=!1;const{width:T,height:I,data:M}=a.o.getImageData(v);if(I>32)return void d(new Error("The height of the image must be less than or equal to 32 pixels."));if(T!==I*I)return void d(new Error("The width of the image must be equal to the height squared."));this.getImage(y)&&this.removeImage(y),this.addImage(y,{data:new a.q({width:T,height:I},M),pixelRatio:1,sdf:!1,usvg:!1,version:0});const C=this.imageManager.getImage(y,this.scope);C?(this._styleColorTheme.lut={image:C.data,data:i},u()):d(new Error("Missing LUT image."))}})}getLut(i){const o=this._styleColorThemeForScope[i];return o?o.lut:null}setProjection(i){i?this.stylesheet.projection=i:delete this.stylesheet.projection,this.mergeProjection(),this._updateMapProjection()}applyProjectionUpdate(){this._loaded&&(this.dispatcher.broadcast("setProjection",this.map.transform.projectionOptions),this.map.transform.projection.requiresDraping?(this.getTerrain()||this.stylesheet.terrain)&&!this.disableElevatedTerrain||this.setTerrainForDraping():this.terrainSetForDrapingOnly()&&this.setTerrain(null,0))}_updateMapProjection(){this.isRootStyle()&&(this.map._useExplicitProjection?this.applyProjectionUpdate():this.map._prioritizeAndUpdateProjection(null,this.projection))}_loadSprite(i){this._spriteRequest=function(o,u,d){let m,_,y;const v=a.o.devicePixelRatio>1?"@2x":"";let T=a.m(u.transformRequest(u.normalizeSpriteURL(o,v,".json"),a.R.SpriteJSON),(C,D)=>{T=null,y||(y=C,m=D,M())}),I=a.n(u.transformRequest(u.normalizeSpriteURL(o,v,".png"),a.R.SpriteImage),(C,D)=>{I=null,y||(y=C,_=D,M())});function M(){if(y)d(y);else if(m&&_){const C=a.o.getImageData(_),D={};for(const F in m){const{width:z,height:V,x:N,y:$,sdf:H,pixelRatio:j,stretchX:ne,stretchY:Y,content:re}=m[F],Z=new a.q({width:z,height:V});a.q.copy(C,Z,{x:N,y:$},{x:0,y:0},{width:z,height:V},null),D[F]={data:Z,pixelRatio:j!==void 0?j:1,sdf:H!==void 0&&H,stretchX:ne,stretchY:Y,content:re,usvg:!1,version:0}}d(null,D)}}return{cancel(){T&&(T.cancel(),T=null),I&&(I.cancel(),I=null)}}}(i,this.map._requestManager,(o,u)=>{if(this._spriteRequest=null,o)this.fire(new a.B(o));else if(u){const d=new Map;for(const m in u)d.set(a.I.from(m),u[m]);this.addImages(d)}this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0}),this.fire(new a.C("data",{dataType:"style"}))})}addIconset(i,o){if(o.type==="sprite")return void this._loadSprite(o.url);const u=this.getOwnSourceCache(o.source);if(!u)return void this.fire(new a.B(new Error(`Source "${o.source}" as specified by iconset "${i}" does not exist and cannot be used as an iconset source`)));const d=u.getSource();if(d.type!=="raster-array")return void this.fire(new a.B(new Error(`Source "${o.source}" as specified by iconset "${i}" is not a "raster-array" source and cannot be used as an iconset source`)));d.partial=!1;const m=new Dc(i,this.scope,u);this.imageManager.addImageProvider(m,this.scope)}removeIconset(i){this.imageManager.removeImageProvider(i,this.scope)}_loadIconset(i){if(!a.h(i)&&this.map._spriteFormat!=="icon_set"||this.map._spriteFormat==="raster")return void this._loadSprite(i);const o=this.map._spriteFormat==="auto";var u,d;this._spriteRequest=(d=(m,_)=>{if(this._spriteRequest=null,m)o?this._loadSprite(i):this.fire(new a.B(m));else if(_){const y=new Map;for(const v in _)y.set(a.I.from(v),_[v]);this.addImages(y)}this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0}),this.fire(new a.C("data",{dataType:"style"}))},a.b2((u=this.map._requestManager).transformRequest(u.normalizeIconsetURL(i),a.R.Iconset),(m,_)=>{if(m)return void d(m);const y={},v=a.cX(new a.b0(_));for(const T of v.icons){const I={version:1,pixelRatio:a.o.devicePixelRatio,content:ha(T),stretchX:T.metadata?uh(T.metadata.stretch_x_areas):void 0,stretchY:T.metadata?uh(T.metadata.stretch_y_areas):void 0,sdf:!1,usvg:!0,icon:T};y[T.name]=I}d(null,y)}))}_validateLayer(i){const o=this.getOwnSource(i.source);if(!o)return;const u=i.sourceLayer;u&&(o.type==="geojson"||o.vectorLayerIds&&o.vectorLayerIds.indexOf(u)===-1)&&this.fire(new a.B(new Error(`Source layer "${u}" does not exist on source "${o.id}" as specified by style layer "${i.id}"`)))}
8loaded(){if(!this._loaded||Object.keys(this._changes.getUpdatedSourceCaches()).length)return!1;for(const i in this._sourceCaches)if(!this._sourceCaches[i].loaded())return!1;if(!this.imageManager.isLoaded()||this.imageManager.hasPatternsInFlight()||!this.modelManager.isLoaded()||this._styleColorTheme.lutLoading)return!1;for(const{style:i}of this.fragments)if(!i.loaded())return!1;return!0}_serializeImports(){if(this.stylesheet.imports)return this.stylesheet.imports.map((i,o)=>{const u=this.fragments[o];return u&&u.style&&(i.data=u.style.serialize()),i})}_serializeSources(){const i={};for(const o in this._sourceCaches){const u=this._sourceCaches[o].getSource();i[u.id]||(i[u.id]=u.serialize())}return i}_serializeLayers(i){const o=[];for(const u of i){const d=this._layers[u];d&&d.type!=="custom"&&o.push(d.serialize())}return o}hasLightTransitions(){return!(!this.light||!this.light.hasTransition())||!(!this.ambientLight||!this.ambientLight.hasTransition())||!(!this.directionalLight||!this.directionalLight.hasTransition())}hasFogTransition(){return!!this.fog&&this.fog.hasTransition()}hasSnowTransition(){return!!this.snow&&this.snow.hasTransition()}hasRainTransition(){return!!this.rain&&this.rain.hasTransition()}hasTransitions(){if(this.hasLightTransitions()||this.hasFogTransition()||this.hasSnowTransition()||this.hasRainTransition())return!0;for(const i in this._sourceCaches)if(this._sourceCaches[i].hasTransition())return!0;for(const i in this._layers)if(this._layers[i].hasTransition())return!0;return!1}_updateDataDrivenEmissiveStrength(){for(const i in this._mergedLayers){const o=this._mergedLayers[i];if(o._transitionablePaint&&o._transitionablePaint._values){const u=o._transitionablePaint._values["line-emissive-strength"];if(u&&u.value&&u.value.isDataDriven())return void(this._hasDataDrivenEmissive=!0)}}this._hasDataDrivenEmissive=!1}hasDataDrivenEmissiveStrength(){return this._hasDataDrivenEmissive}get order(){return this.terrain?this._drapedFirstOrder:this._mergedOrder}_getOrder(i){return i?this.order:this._mergedOrder}isLayerDraped(i){return!!this.terrain&&i.isDraped(this.getLayerSourceCache(i))}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading")}_checkLayer(i){const o=this.getOwnLayer(i);if(o)return o;this.fire(new a.B(new Error(`The layer '${i}' does not exist in the map's style.`)))}_checkSource(i){const o=this.getOwnSource(i);if(o)return o;this.fire(new a.B(new Error(`The source '${i}' does not exist in the map's style.`)))}precompilePrograms(i,o){const u=this.map.painter;if(u)for(let d=i.minzoom||0;d<(i.maxzoom||25.5);d++){const m=i.getProgramIds();if(m)for(const _ of m){const y=i.getDefaultProgramParams(_,o.zoom,this._styleColorTheme.lut);y&&(u.style=this,this.fog&&(u._fogVisible=!0,y.overrideFog=!0,u.getOrCreateProgram(_,y)),u._fogVisible=!1,y.overrideFog=!1,u.getOrCreateProgram(_,y),(this.stylesheet.terrain||this.stylesheet.projection&&this.stylesheet.projection.name==="globe")&&(y.overrideRtt=!0,u.getOrCreateProgram(_,y)))}}}update(i){if(!this._loaded)return;this.ambientLight&&this.ambientLight.recalculate(i),this.directionalLight&&this.directionalLight.recalculate(i);const o=this.calculateLightsBrightness();i.brightness=o||0,o!==this._brightness&&(this._brightness=o,this.dispatcher.broadcast("setBrightness",o)),i.worldview!==this._worldview&&(this._worldview=i.worldview,this.dispatcher.broadcast("setWorldview",this._worldview));const u=this._changes.isDirty();let d=!1;if(this._changes.isDirty()){const v=this._changes.getLayerUpdatesByScope();for(const T in v){const{updatedIds:I,removedIds:M}=v[T];(I||M)&&(this._updateWorkerLayers(T,I,M),d=!0)}this.updateSourceCaches(),this._updateTilesForChangedImages(),this.updateLayers(i),this.light&&this.light.updateTransitions(i),this.ambientLight&&this.ambientLight.updateTransitions(i),this.directionalLight&&this.directionalLight.updateTransitions(i),this.fog&&this.fog.updateTransitions(i),this.snow&&this.snow.updateTransitions(i),this.rain&&this.rain.updateTransitions(i),this._changes.reset()}const m={};for(const v in this._mergedSourceCaches){const T=this._mergedSourceCaches[v];
8m[v]=T.used,T.used=!1,T.tileCoverLift=0}const _={};for(const v of this._mergedOrder){const T=this._mergedLayers[v];if((T.visibility!=="none"||T.hasTransition())&&T.recalculate(i,this._availableImages),!T.isHidden(i.zoom)){const I=this.getLayerSourceCache(T);I&&(I.used=!0,I.tileCoverLift=Math.max(I.tileCoverLift,T.tileCoverLift()))}if(T.type==="fill-extrusion"){const I=a.F(T.source,T.scope);if(I in this._mergedFillExtrusionSourceCaches){const M=T.layout&&T.layout.get("source-max-zoom");if(M!=null){const C=_[I];_[I]=C==null?M:Math.min(C,M)}}}!this._precompileDone&&this._shouldPrecompile&&("requestIdleCallback"in window?requestIdleCallback(()=>{this.precompilePrograms(T,i)}):this.precompilePrograms(T,i))}this._shouldPrecompile&&(this._precompileDone=!0);for(const v in this._mergedFillExtrusionSourceCaches)this._mergedFillExtrusionSourceCaches[v].setMaxzoomOverride(_[v]!=null?_[v]:null);this.terrain&&d&&this.mergeLayers();const y=this.imageManager.getPendingImageProviders();for(const v of y)v.sourceCache.used=!0;for(const v in m){const T=this._mergedSourceCaches[v];m[v]!==T.used&&T.getSource().fire(new a.C("data",{sourceDataType:"visibility",dataType:"source",sourceId:T.getSource().id}))}this.light&&this.light.recalculate(i),this.terrain&&this.terrain.recalculate(i),this.fog&&this.fog.recalculate(i),this.snow&&this.snow.recalculate(i),this.rain&&this.rain.recalculate(i),this.z=i.zoom,this._markersNeedUpdate&&(this._updateMarkersOpacity(),this._markersNeedUpdate=!1),this.imageManager.clearUpdatedImages(this.scope),u&&this.fire(new a.C("data",{dataType:"style"}))}updateImageProviders(){const i=this.imageManager.getPendingImageProviders();for(const o of i){const u=o.resolvePendingRequests(),d=this.getFragmentStyle(o.scope);d&&d.addImages(u)}}_updateTilesForChangedImages(){const i={};for(const o in this._mergedSourceCaches){const u=this._mergedSourceCaches[o].getSource().scope;i[u]=i[u]||this._changes.getUpdatedImages(u),i[u].length!==0&&this._mergedSourceCaches[o].reloadTilesForDependencies(["icons","patterns"],i[u])}for(const o in i)this._changes.resetUpdatedImages(o)}_updateWorkerLayers(i,o,u){const d=this.getFragmentStyle(i);d&&this.dispatcher.broadcast("updateLayers",{layers:o?d._serializeLayers(o):[],scope:i,removedIds:u||[],options:d.options})}setState(i,o){if(this._checkLoaded(),Cs(this,Zi(i)))return!1;(i=a.d5(i)).layers=vc(i.layers);const u=function(_,y){if(!_)return[{command:$t.setStyle,args:[y]}];let v=[];try{if(!a.b7(_.version,y.version))return[{command:$t.setStyle,args:[y]}];if(a.b7(_.center,y.center)||v.push({command:$t.setCenter,args:[y.center]}),a.b7(_.zoom,y.zoom)||v.push({command:$t.setZoom,args:[y.zoom]}),a.b7(_.bearing,y.bearing)||v.push({command:$t.setBearing,args:[y.bearing]}),a.b7(_.pitch,y.pitch)||v.push({command:$t.setPitch,args:[y.pitch]}),a.b7(_.sprite,y.sprite)||v.push({command:$t.setSprite,args:[y.sprite]}),a.b7(_.glyphs,y.glyphs)||v.push({command:$t.setGlyphs,args:[y.glyphs]}),a.b7(_.imports,y.imports)||function(D=[],F=[],z){F=F||[];const V=(D=D||[]).map(Zo),N=F.map(Zo),$=D.reduce(ia,{}),H=F.reduce(ia,{}),j=V.slice();let ne,Y,re,Z;for(ne=0,Y=0;ne<V.length;ne++)re=V[ne],H.hasOwnProperty(re)?Y++:(z.push({command:$t.removeImport,args:[re]}),j.splice(j.indexOf(re,Y),1));for(ne=0,Y=0;ne<N.length;ne++)re=N[N.length-1-ne],j[j.length-1-ne]!==re&&($.hasOwnProperty(re)?(z.push({command:$t.removeImport,args:[re]}),j.splice(j.lastIndexOf(re,j.length-Y),1)):Y++,Z=j[j.length-ne],z.push({command:$t.addImport,args:[H[re],Z]}),j.splice(j.length-ne,0,re));for(const K of F){const te=$[K.id];te&&(delete te.data,a.b7(te,K)||z.push({command:$t.updateImport,args:[K.id,K]}))}}(_.imports,y.imports,v),a.b7(_.transition,y.transition)||v.push({command:$t.setTransition,args:[y.transition]}),a.b7(_.light,y.light)||v.push({command:$t.setLight,args:[y.light]}),a.b7(_.fog,y.fog)||v.push({command:$t.setFog,args:[y.fog]}),a.b7(_.snow,y.snow)||v.push({command:$t.setSnow,args:[y.snow]}),a.b7(_.rain,y.rain)||v.push({command:$t.setRain,args:[y.rain]}),a.b7(_.projection,y.projection)||v.push({command:$t.setProjection,args:[y.projection]}),a.b7(_.lights,y.lights)||v.push({command:$t.setLights,args:[y.lights]}),a.b7(_.camera,y.camera)||v.push({command:$t.setCamera,args:[y.camera]}),a.b7(_.iconsets,y.iconsets)||function(D,F,z){let V;for(V in F=F||{},D=D||{})D.hasOwnProperty(V)&&(F.hasOwnProperty(V)||z.push({command:$t.removeIconset,args:[V]}));for(V in F){if(!F.hasOwnProperty(V))continue;const N=F[V];D.hasOwnProperty(V)?a.b7(D[V],N)||(z.push({command:$t.removeIconset,args:[V]}),z.push({command:$t.addIconset,args:[V,N]})):z.push({command:$t.addIconset,args:[V,N]})}}(_.iconsets,y.iconsets,v),!a.b7(_["color-theme"],y["color-theme"]))return[{command:$t.setStyle,args:[y]}];const T={},I=[];(function(D,F,z,V){let N;for(N in F=F||{},D=D||{})D.hasOwnProperty(N)&&(F.hasOwnProperty(N)||ta(N,z,V));for(N in F){if(!F.hasOwnProperty(N))continue;const $=F[N];D.hasOwnProperty(N)?a.b7(D[N],$)||(D[N].type==="geojson"&&$.type==="geojson"&&Mm(D,F,N)?z.push({command:$t.setGeoJSONSourceData,args:[N,$.data]}):nl(N,F,z,V)):bc(N,F,z)}})(_.sources,y.sources,I,T);const M=[];
8_.layers&&_.layers.forEach(D=>{D.source&&T[D.source]?v.push({command:$t.removeLayer,args:[D.id]}):M.push(D)});let C=_.terrain;C&&T[C.source]&&(v.push({command:$t.setTerrain,args:[void 0]}),C=void 0),v=v.concat(I),a.b7(C,y.terrain)||v.push({command:$t.setTerrain,args:[y.terrain]}),function(D,F,z){F=F||[];const V=(D=D||[]).map(Zo),N=F.map(Zo),$=D.reduce(ia,{}),H=F.reduce(ia,{}),j=V.slice(),ne=Object.create(null);let Y,re,Z,K,te,de,se;for(Y=0,re=0;Y<V.length;Y++)Z=V[Y],H.hasOwnProperty(Z)?re++:(z.push({command:$t.removeLayer,args:[Z]}),j.splice(j.indexOf(Z,re),1));for(Y=0,re=0;Y<N.length;Y++)Z=N[N.length-1-Y],j[j.length-1-Y]!==Z&&($.hasOwnProperty(Z)?(z.push({command:$t.removeLayer,args:[Z]}),j.splice(j.lastIndexOf(Z,j.length-re),1)):re++,de=j[j.length-Y],z.push({command:$t.addLayer,args:[H[Z],de]}),j.splice(j.length-Y,0,Z),ne[Z]=!0);for(Y=0;Y<N.length;Y++)if(Z=N[Y],K=$[Z],te=H[Z],!ne[Z]&&!a.b7(K,te))if(a.b7(K.source,te.source)&&a.b7(K["source-layer"],te["source-layer"])&&a.b7(K.type,te.type)){for(se in Is(K.layout,te.layout,z,Z,null,$t.setLayoutProperty),Is(K.paint,te.paint,z,Z,null,$t.setPaintProperty),a.b7(K.slot,te.slot)||z.push({command:$t.setSlot,args:[Z,te.slot]}),a.b7(K.filter,te.filter)||z.push({command:$t.setFilter,args:[Z,te.filter]}),a.b7(K.minzoom,te.minzoom)&&a.b7(K.maxzoom,te.maxzoom)||z.push({command:$t.setLayerZoomRange,args:[Z,te.minzoom,te.maxzoom]}),K)K.hasOwnProperty(se)&&se!=="layout"&&se!=="paint"&&se!=="filter"&&se!=="metadata"&&se!=="minzoom"&&se!=="maxzoom"&&se!=="slot"&&(se.indexOf("paint.")===0?Is(K[se],te[se],z,Z,se.slice(6),$t.setPaintProperty):a.b7(K[se],te[se])||z.push({command:$t.setLayerProperty,args:[Z,se,te[se]]}));for(se in te)te.hasOwnProperty(se)&&!K.hasOwnProperty(se)&&se!=="layout"&&se!=="paint"&&se!=="filter"&&se!=="metadata"&&se!=="minzoom"&&se!=="maxzoom"&&se!=="slot"&&(se.indexOf("paint.")===0?Is(K[se],te[se],z,Z,se.slice(6),$t.setPaintProperty):a.b7(K[se],te[se])||z.push({command:$t.setLayerProperty,args:[Z,se,te[se]]}))}else z.push({command:$t.removeLayer,args:[Z]}),de=j[j.lastIndexOf(Z)+1],z.push({command:$t.addLayer,args:[te,de]})}(M,y.layers,v)}catch(T){console.warn("Unable to compute style diff:",T),v=[{command:$t.setStyle,args:[y]}]}return v}(this.serialize(),i).filter(_=>!(_.command in Lm));if(u.length===0)return!1;const d=u.filter(_=>!(_.command in zm));if(d.length>0)throw new Error(`Unimplemented: ${d.map(_=>_.command).join(", ")}.`);const m=[];return u.forEach(_=>{m.push(this[_.command](..._.args))}),o&&Promise.all(m).then(o).catch(o),this.stylesheet=i,this.mergeAll(),this.dispatcher.broadcast("setLayers",{layers:this._serializeLayers(this._order),scope:this.scope,options:this.options}),!0}_updateWorkerImages(){this._availableImages=this.imageManager.listImages(this.scope),this.dispatcher.broadcast("setImages",{scope:this.scope,images:this._availableImages})}_updateWorkerModels(){this._availableModels=this.modelManager.getModelURIs(this.scope),this.dispatcher.broadcast("setModels",{scope:this.scope,models:this._availableModels})}
vendor: 10,390 bytes, line 8
8addImages(i){if(i.size===0)return this;for(const[o,u]of i.entries()){if(this.getImage(o))return this.fire(new a.B(new Error(`An image with the name "${o.name}" already exists.`)));this.imageManager.addImage(o,this.scope,u),this._changes.updateImage(o,this.scope)}return this._updateWorkerImages(),this.fire(new a.C("data",{dataType:"style"})),this}addImage(i,o){return this.getImage(i)?this.fire(new a.B(new Error(`An image with the name "${i.name}" already exists.`))):(this.imageManager.addImage(i,this.scope,o),this._changes.updateImage(i,this.scope),this._updateWorkerImages(),this.fire(new a.C("data",{dataType:"style"})),this)}updateImage(i,o,u=!1){this.imageManager.updateImage(i,this.scope,o),u&&(this._changes.updateImage(i,this.scope),this._updateWorkerImages(),this.fire(new a.C("data",{dataType:"style"})))}getImage(i){return this.imageManager.getImage(i,this.scope)}removeImage(i){return this.getImage(i)?(this.imageManager.removeImage(i,this.scope),this._changes.updateImage(i,this.scope),this._updateWorkerImages(),this.fire(new a.C("data",{dataType:"style"})),this):this.fire(new a.B(new Error("No image with this name exists.")))}listImages(){return this._checkLoaded(),this._availableImages.slice()}getActualScope(){return this._importedAsBasemap?"basemap":this.scope}addModelURLs(i){return this.modelManager.addModelURLs(i,this.getActualScope()),this._updateWorkerModels(),this.fire(new a.C("data",{dataType:"style"})),this}addModel(i,o,u={}){return this._checkLoaded(),this._validate(ge,`models.${i}`,o,null,u)||(this.modelManager.addModel(i,o,this.getActualScope()),this.fire(new a.C("data",{dataType:"style"}))),this}hasModel(i){return this.modelManager.hasModel(i,this.getActualScope())}removeModel(i){return this.hasModel(i)?(this.modelManager.removeModel(i,this.getActualScope(),!1,!0),this.fire(new a.C("data",{dataType:"style"})),this):this.fire(new a.B(new Error("No model with this ID exists.")))}listModels(){return this._checkLoaded(),this.modelManager.listModels(this.getActualScope())}addSource(i,o,u={}){if(this._checkLoaded(),this.getOwnSource(i)!==void 0)throw new Error(`There is already a source with ID "${i}".`);if(!o.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(o).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(o.type)>=0&&this._validate(mc,`sources.${i}`,o,null,u))return;this.map&&this.map._collectResourceTiming&&(o.collectResourceTiming=!0);const d=gc(i,o,this.dispatcher,this);d.scope=this.scope,d.setEventedParent(this,()=>({isSourceLoaded:this._isSourceCacheLoaded(d.id),source:d.serialize(),sourceId:d.id}));const m=_=>{const y=(_===a.b5.Symbol?"symbol:":_===a.b5.FillExtrusion?"fill-extrusion:":"other:")+d.id,v=a.F(y,this.scope),T=this._sourceCaches[y]=new pn(v,d,_);_===a.b5.Symbol?this._symbolSourceCaches[d.id]=T:_===a.b5.FillExtrusion?this._fillExtrusionSourceCaches[d.id]=T:this._otherSourceCaches[d.id]=T,T.onAdd(this.map)};m(a.b5.Other),o.type!=="vector"&&o.type!=="geojson"||(m(a.b5.Symbol),o.type==="vector"&&m(a.b5.FillExtrusion)),d.onAdd&&d.onAdd(this.map),u.isInitialLoad||(this.mergeSources(),this._changes.setDirty())}removeSource(i){this._checkLoaded();const o=this.getOwnSource(i);if(!o)throw new Error("There is no source with this ID");for(const d in this._layers)if(this._layers[d].source===i)return this.fire(new a.B(new Error(`Source "${i}" cannot be removed while layer "${d}" is using it.`)));if(this.terrain&&this.terrain.scope===this.scope&&this.terrain.get().source===i)return this.fire(new a.B(new Error(`Source "${i}" cannot be removed while terrain is using it.`)));if(this.stylesheet.iconsets){const d=Object.entries(this.stylesheet.iconsets).find(([m,_])=>_.type==="source"&&_.source===i);if(d)return this.fire(new a.B(new Error(`Source "${i}" cannot be removed while iconset "${d[0]}" is using it.`)))}const u=this.getOwnSourceCaches(i);for(const d of u){const m=a.d6(d.id);delete this._sourceCaches[m],this._changes.discardSourceCacheUpdate(d.id),d.fire(new a.C("data",{sourceDataType:"metadata",dataType:"source",sourceId:d.getSource().id})),d.setEventedParent(null),d.clearTiles()}return delete this._otherSourceCaches[i],delete this._symbolSourceCaches[i],delete this._fillExtrusionSourceCaches[i],this.mergeSources(),o.setEventedParent(null),o.onRemove&&o.onRemove(this.map),this._changes.setDirty(),this}setGeoJSONSourceData(i,o){this._checkLoaded(),this.getOwnSource(i).setData(o),this._changes.setDirty()}getOwnSource(i){const o=this.getOwnSourceCache(i);return o&&o.getSource()}getOwnSources(){const i=[];for(const o in this._otherSourceCaches){const u=this.getOwnSourceCache(o);u&&i.push(u.getSource())}return i}areTilesLoaded(){const i=this._mergedSourceCaches;for(const o in i){const u=i[o]._tiles;for(const d in u){const m=u[d];if(m.state!=="loaded"&&m.state!=="errored")return!1}}return!0}setLights(i){if(this._checkLoaded(),!i)return delete this.ambientLight,void delete this.directionalLight;const o=this._getTransitionParameters();for(const m of i){if(this._validate(pe,"lights",m))return;switch(m.type){case"ambient":if(this.ambientLight){const _=this.ambientLight;_.set(m),_.updateTransitions(o)}else this.ambientLight=new Nt(m,wr(),this.scope,this.options);break;case"directional":if(this.directionalLight){const _=this.directionalLight;_.set(m),_.updateTransitions(o)}else this.directionalLight=new Nt(m,Mn(),this.scope,this.options)}}const u=Object.assign(o,{worldview:this.map.getWorldview()}),d=new a.ae(this.z||0,u);this.ambientLight&&this.ambientLight.recalculate(d),this.directionalLight&&this.directionalLight.recalculate(d),this._brightness=this.calculateLightsBrightness(),this.dispatcher.broadcast("setBrightness",this._brightness)}calculateLightsBrightness(){const i=this.directionalLight,o=this.ambientLight;if(!i||!o)return;const u=C=>.2126*(C[0]<=.03928?C[0]/12.92:Math.pow((C[0]+.055)/1.055,2.4))+.7152*(C[1]<=.03928?C[1]/12.92:Math.pow((C[1]+.055)/1.055,2.4))+.0722*(C[2]<=.03928?C[2]/12.92:Math.pow((C[2]+.055)/1.055,2.4)),d=i.properties.get("color").toNonPremultipliedRenderColor(null).toArray01(),m=i.properties.get("intensity"),_=i.properties.get("direction"),y=1-a.cL(_.x,_.y,_.z)[2]/90,v=u(d)*m*y,T=o.properties.get("color").toNonPremultipliedRenderColor(null).toArray01(),I=o.properties.get("intensity"),M=u(T)*I;return Number(((v+M)/2).toFixed(6))}getBrightness(){return this._brightness}getLights(){if(!this.enable3dLights())return null;const i=[];return this.directionalLight&&i.push(this.directionalLight.get()),this.ambientLight&&i.push(this.ambientLight.get()),i}enable3dLights(){return!!this.ambientLight&&!!this.directionalLight}getFragmentStyle(i){if(i==null||i===""&&this.isRootStyle())return this;if(a.d7(i)){const o=a.d8(i),u=this.fragments.find(({id:m})=>m===o);if(!u)return;const d=a.d6(i);return u.style.getFragmentStyle(d)}{const o=this.fragments.find(({id:u})=>u===i);return o?o.style:void 0}}setFeaturesetSelectors(i){if(!i)return;const o=(u,d="")=>`${u}::${d}`;this._featuresetSelectors={};for(const u in i){const d={},m=this._featuresetSelectors[u]=[];for(const _ of i[u].selectors){if(_.featureNamespace){const v=this.getOwnLayer(_.layer);if(!v){a.w(`Layer is undefined for selector: ${_.layer}`);continue}const T=o(v.source,v.sourceLayer);if(T in d&&d[T]!==_.featureNamespace){a.w(`"featureNamespace ${_.featureNamespace} of featureset ${u}'s selector is not associated to the same source, skip this selector`);continue}d[T]=_.featureNamespace}let y;if(_.properties)for(const v in _.properties){const T=a.X(_.properties[v]);T.result==="success"&&(y=y||{},y[v]=T.value)}m.push({layerId:_.layer,namespace:_.featureNamespace,properties:y,uniqueFeatureID:_._uniqueFeatureID})}}}getFeaturesetDescriptors(i){const o=this.getFragmentStyle(i);if(!o||!o.stylesheet.featuresets)return[];const u=[];for(const d in o.stylesheet.featuresets)u.push({featuresetId:d,importId:o.scope?o.scope:void 0});return u}getFeaturesetLayers(i,o){const u=this.getFragmentStyle(o),d=u.stylesheet.featuresets;if(!d||!d[i])return this.fire(new a.B(new Error(`The featureset '${i}' does not exist in the map's style and cannot be queried.`))),[];const m=[];for(const _ of d[i].selectors){const y=u.getOwnLayer(_.layer);y&&m.push(y)}return m}getConfigProperty(i,o){const u=this.getFragmentStyle(i);if(!u)return null;const d=a.F(o,u.scope),m=u.options.get(d),_=m?m.value||m.default:null;return _?_.serialize():null}isIndoorEnabled(){return Object.keys(this._mergedIndoor).length>0}getIndoorSourceLayers(i,o){const u=a.F(i,o);return this._mergedIndoor[u]}setIndoorData(i,o){this.indoorManager.setIndoorData(o)}updateIndoorDependentLayers(){this._updateLayers(this._indoorDependentLayers),this.map._styleDirty=!0,this.map.triggerRepaint()}setConfigProperty(i,o,u){const d=this.getFragmentStyle(i);if(!d)return;const m=d.stylesheet.schema;if(!m||!m[o])return;const _=a.X(u);if(_.result!=="success")return void Cs(this,_.value);const y=_.value.expression,v=a.F(o,d.scope),T=d.options.get(v);if(!T)return;let I;const{minValue:M,maxValue:C,stepValue:D,type:F,values:z}=m[o],V=a.X(m[o].default);V.result==="success"&&(I=V.value.expression),I?(this.options.set(v,Object.assign({},T,{value:y,default:I,minValue:M,maxValue:C,stepValue:D,type:F,values:z})),this.updateConfigDependencies(o)):this.fire(new a.B(new Error(`No schema defined for the config option "${o}" in the "${i}" fragment.`)))}getConfig(i){const o=this.getFragmentStyle(i);if(!o)return null;const u=o.stylesheet.schema;if(!u)return null;const d={};for(const m in u){const _=a.F(m,o.scope),y=o.options.get(_),v=y?y.value||y.default:null;d[m]=v?v.serialize():null}return d}setConfig(i,o){const u=this.getFragmentStyle(i);u&&(u.updateConfig(o,u.stylesheet.schema),this.updateConfigDependencies())}getSchema(i){const o=this.getFragmentStyle(i);return o?o.stylesheet.schema:null}setSchema(i,o){const u=this.getFragmentStyle(i);u&&(u.stylesheet.schema=o,u.updateConfig(u._config,o),this.updateConfigDependencies())}updateConfig(i,o){if(this._config=i,i||o)if(o)for(const u in o){let d,m;const _=a.X(o[u].default);if(_.result==="success"&&(d=_.value.expression),i&&i[u]!==void 0){const C=a.X(i[u]);C.result==="success"&&(m=C.value.expression)}const{minValue:y,maxValue:v,stepValue:T,type:I,values:M}=o[u];if(d){const C=a.F(u,this.scope);this.options.set(C,{default:d,value:m,minValue:y,maxValue:v,stepValue:T,type:I,values:M})}
8else this.fire(new a.B(new Error(`No schema defined for config option "${u}".`)))}else this.fire(new a.B(new Error("Attempting to set config for a style without schema.")))}_updateLayers(i,o=()=>!0){for(const u of i){const d=this.getLayer(u);d&&o(d)&&(d.possiblyEvaluateVisibility(),this._updateLayer(d),this._changes.setDirty())}}updateConfigDependencies(i){this._updateLayers(this._configDependentLayers,o=>!i||o.expressionDependencies.configDependencies.has(i)),this.ambientLight&&this.ambientLight.updateConfig(this.options),this.directionalLight&&this.directionalLight.updateConfig(this.options),this.fog&&this.fog.updateConfig(this.options),this.snow&&this.snow.updateConfig(this.options),this.rain&&this.rain.updateConfig(this.options),this.forEachFragmentStyle(o=>{const u=o._styleColorTheme.colorThemeOverride?o._styleColorTheme.colorThemeOverride:o._styleColorTheme.colorTheme;if(u){const d=o._evaluateColorThemeData(u);(!o._styleColorTheme.lut&&d!==""||o._styleColorTheme.lut&&d!==o._styleColorTheme.lut.data)&&o.setColorTheme(u)}}),this._changes.setDirty()}addLayer(i,o,u={}){this._checkLoaded();const d=i.id;if(this._layers[d])return void this.fire(new a.B(new Error(`Layer with i
8d "${d}" already exists on this map`)));let m;if(i.type==="custom"){if(Cs(this,a.d9(i)))return;m=a.da(i,this.scope,this._styleColorTheme.lut,this.options)}else{if(typeof i.source=="object"&&(this.addSource(d,i.source),i=a.d5(i),i=Object.assign(i,{source:d})),this._validate(ae,`layers.${d}`,i,{arrayIndex:-1},u))return;m=a.da(i,this.scope,this._styleColorTheme.lut,this.options),this._validateLayer(m),m.setEventedParent(this,{layer:{id:d}})}const _=a.F(m.source,m.scope);m.expressionDependencies.configDependencies.size!==0&&this._configDependentLayers.add(_),m.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(_);let y=this._order.length;if(o){const M=this._order.indexOf(o);if(M===-1)return void this.fire(new a.B(new Error(`Layer with id "${o}" does not exist on this map.`)));m.slot&&m.slot!==this._layers[o].slot?a.w(`Layer with id "${o}" has a different slot. Layers can only be rearranged within the same slot.`):y=M}this._order.splice(y,0,d),this._handleLayerOrderChange(),this._layers[d]=m;const v=this.getOwnLayerSourceCache(m),T=!!this.directionalLight&&this.directionalLight.shadowsEnabled();v&&m.canCastShadows()&&T&&(v.castsShadows=!0);const I=this._changes.getRemovedLayer(m);if(I&&m.source&&v&&m.type!=="custom"){this._changes.discardLayerRemoval(m);const M=a.F(m.source,m.scope);I.type!==m.type?this._changes.updateSourceCache(M,"clear"):(this._changes.updateSourceCache(M,"reload"),v.pause())}this._updateLayer(m),m.onAdd&&m.onAdd(this.map),m.scope=this.scope,this.mergeLayers()}moveLayer(i,o){this._checkLoaded();const u=this._checkLayer(i);if(!u||i===o)return;const d=this._order.indexOf(i);this._order.splice(d,1);let m=this._order.length;if(o){const _=this._order.indexOf(o);
8if(_===-1)return void this.fire(new a.B(new Error(`Layer with id "${o}" does not exist on this map.`)));u.slot&&u.slot!==this._layers[o].slot?a.w(`Layer with id "${o}" has a different slot. Layers can only be rearranged within the same slot.`):m=_}this._order.splice(m,0,i),this._changes.setDirty(),this._handleLayerOrderChange(),this.mergeLayers()}removeLayer(i){this._checkLoaded();const o=this._checkLayer(i);if(!o)return;o.setEventedParent(null);const u=this._order.indexOf(i);this._order.splice(u,1),delete this._layers[i],this._changes.setDirty(),this._handleLayerOrderChange(),this._configDependentLayers.delete(o.fqid),this._indoorDependentLayers.delete(o.fqid),this._changes.removeLayer(o);const d=this.getOwnLayerSourceCache(o);if(d&&d.castsShadows){let m=!1;for(const _ in this._layers)if(this._layers[_].source===o.source&&this._layers[_].canCastShadows()){m=!0;break}d.castsShadows=m}o.onRemove&&o.onRemove(this.map),this.mergeLayers()}getOwnLayer(i){return this._layers[i]}hasLayer(i){return i in this._mergedLayers}hasLayerType(i){for(const o in this._layers)if(this._layers[o].type===i)return!0;return!1}setLayerZoomRange(i,o,u){this._checkLoaded();const d=this._checkLayer(i);d&&(d.minzoom===o&&d.maxzoom===u||(o!=null&&(d.minzoom=o),u!=null&&(d.maxzoom=u),this._updateLayer(d)))}getSlots(){return this._checkLoaded(),this._mergedSlots}setSlot(i,o){this._checkLoaded();const u=this._checkLayer(i);u&&u.slot!==o&&(u.slot=o,this._updateLayer(u))}setFilter(i,o,u={}){this._checkLoaded();const d=this._checkLayer(i);if(d&&!a.b7(d.filter,o))return o==null?(d.filter=void 0,void this._updateLayer(d)):void(this._validate(ce,`layers.${d.id}.filter`,o,{layerType:d.type},u)||(d.filter=a.d5(o),this._updateLayer(d)))}getFilter(i){const o=this._checkLayer(i);if(o)return a.d5(o.filter)}setLayoutProperty(i,o,u,d={}){this._checkLoaded();const m=this._checkLayer(i);if(m&&!a.b7(m.getLayoutProperty(o),u)){if(u!=null&&(!d||d.validate!==!1)&&Cs(m,he.call(Zi,{key:`layers.${i}.layout.${o}`,layerType:m.type,objectKey:o,value:u,styleSpec:a.a8,style:{glyphs:!0,sprite:!0}})))return;m.setLayoutProperty(o,u),m.expressionDependencies.configDependencies.size!==0&&this._configDependentLayers.add(m.fqid),m.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(m.fqid),this._updateLayer(m)}}setLayerProperty(i,o,u,d={}){this._checkLoaded();const m=this._checkLayer(i);m&&(o==="appearances"?(m.setAppearances(u),this._updateLayer(m)):m.isPaintProperty(o)?this.setPaintProperty(i,o,u,d):this.setLayoutProperty(i,o,u,d))}getLayoutProperty(i,o){const u=this._checkLayer(i);if(u)return u.getLayoutProperty(o)}setPaintProperty(i,o,u,d={}){this._checkLoaded();const m=this._checkLayer(i);if(!m||a.b7(m.getPaintProperty(o),u)||u!=null&&(!d||d.validate!==!1)&&Cs(m,me.call(Zi,{key:`layers.${i}.paint.${o}`,layerType:m.type,objectKey:o,value:u,styleSpec:a.a8})))return;const _=m.setPaintProperty(o,u);m.expressionDependencies.configDependencies.size!==0&&this._configDependentLayers.add(m.fqid),m.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(m.fqid),_&&this._updateLayer(m),this._changes.updatePaintProperties(m)}getPaintProperty(i,o){const u=this._checkLayer(i);if(u)return u.getPaintProperty(o)}setFeatureState(i,o){if(this._checkLoaded(),"target"in i){if("featuresetId"in i.target){const{featuresetId:v,importId:T}=i.target,I=this.getFragmentStyle(T),M=I.getFeaturesetLayers(v);for(const{source:C,sourceLayer:D}of M)I.setFeatureState({id:i.id,source:C,sourceLayer:D},o)}else if("layerId"in i.target){const{layerId:v}=i.target,T=this.getLayer(v);this.setFeatureState({id:i.id,source:T.source,sourceLayer:T.sourceLayer},o)}return}const u=i.source,d=i.sourceLayer,m=this._checkSource(u);if(!m)return;const _=m.type;if(_==="geojson"&&d)return void this.fire(new a.B(new Error("GeoJSON sources cannot have a sourceLayer parameter.")));if(_==="vector"&&!d)return void this.fire(new a.B(new Error("The sourceLayer parameter must be provided for vector source types.")));i.id===void 0&&this.fire(new a.B(new Error("The feature id parameter must be provided.")));const y=this.getOwnSourceCaches(u);for(const v of y)v.setFeatureState(d,i.id,o)}removeFeatureState(i,o){if(this._checkLoaded(),"target"in i){if("featuresetId"in i.target){const{featuresetId:v,importId:T}=i.target,I=this.getFragmentStyle(T),M=I.getFeaturesetLayers(v);for(const{source:C,sourceLayer:D}of M)I.removeFeatureState({id:i.id,source:C,sourceLayer:D},o)}else if("layerId"in i.target){const{layerId:v}=i.target,T=this.getLayer(v);this.removeFeatureState({id:i.id,source:T.source,sourceLayer:T.sourceLayer},o)}return}const u=i.source,d=this._checkSource(u);if(!d)return;const m=d.type,_=m==="vector"?i.sourceLayer:void 0;if(m==="vector"&&!_)return void this.fire(new a.B(new Error("The sourceLayer parameter must be provided for vector source types.")));if(o&&typeof i.id!="string"&&typeof i.id!="number")return void this.fire(new a.B(new Error("A feature id is required to remove its specific state property.")));const y=this.getOwnSourceCaches(u);for(const v of y)v.removeFeatureState(_,i.id,o)}getFeatureState(i){if(this._checkLoaded(),"target"in i){let m;if("featuresetId"in i.target){const{featuresetId:_,importId:y}=i.target,v=this.getFragmentStyle(y),T=v.getFeaturesetLayers(_);for(const{source:I,sourceLayer:M}of T){const C=v.getFeatureState({id:i.id,source:I,sourceLayer:M});if(C&&!m)m=C;else if(!a.b7(m,C))return void this.fire(new a.B(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 i.target){const{layerId:_}=i.target,y=this.getLayer(_);m=this.getFeatureState({id:i.id,source:y.source,sourceLayer:y.sourceLayer})}return m}const o=i.source,u=i.sourceLayer,d=this._checkSource(o);if(d){if(d.type!=="vector"||u)return i.id===void 0&&this.fire(new a.B(new Error("The feature id parameter must be provided."))),this.getOwnSourceCaches(o)[0].getFeatureState(u,i.id);this.fire(new a.B(new Error("The sourceLayer parameter must be provided for vector source types.")))}}setTransition(i){return this.stylesheet.transition=Object.assign({},this.stylesheet.transition,i),this.transition=this.stylesheet.transition,this}getTransition(){return Object.assign({},this.stylesheet.transition)}setWorldview(i){i!==this._worldview&&(this._worldview=i,this.dispatcher.broadcast("setWorldview",this._worldview),this.reloadSources())}serialize(){this._checkLoaded();const i=this.getTerrain(),o=i&&this.terrain&&this.terrain.scope===this.scope?i:this.stylesheet.terrain;return a.db({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,fragment:this.stylesheet.fragment,iconsets:this.stylesheet.iconsets,featuresets:this.stylesheet.featuresets,imports:this._serializeImports(),schema:this.stylesheet.schema,camera:this.stylesheet.camera,light:this.stylesheet.light,lights:this.stylesheet.lights,terrain:o,fog:this.stylesheet.fog,snow:this.stylesheet.snow,rain:this.stylesheet.rain,indoor:this.stylesheet.indoor,center:this.stylesheet.center,"color-theme":this.stylesheet["color-theme"],zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,projection:this.stylesheet.projection,sources:this._serializeSources(),layers:this._serializeLayers(this._order)},u=>u!==void 0)}_updateFilteredLayers(i){for(const o of Object.values(this._mergedLayers))i(o)&&this._updateLayer(o)}_updateLayer(i){this._changes.updateLayer(i);const o=this.getLayerSourceCache(i),u=a.F(i.source,i.scope),d=this._changes.getUpd
vendor: 4,255 bytes, line 8
8atedSourceCaches();i.source&&!d[u]&&o&&o.getSource().type!=="raster"&&(this._changes.updateSourceCache(u,"reload"),o.pause()),i.invalidateCompiledFilter()}_flattenAndSortRenderedFeatures(i){const o=y=>this._mergedLayers[y].is3D(!!this.terrain),u=this.order,d={},m=[];for(let y=u.length-1;y>=0;y--){const v=u[y];if(o(v)){d[v]=y;for(const T of i){const I=T[v];if(I)for(const M of I)m.push(M)}}}m.sort((y,v)=>v.intersectionZ-y.intersectionZ);const _=[];for(let y=u.length-1;y>=0;y--){const v=u[y];if(o(v))for(let T=m.length-1;T>=0;T--){const I=m[T].feature;if(I.layer&&d[I.layer.id]<y)break;_.push(I),m.pop()}else for(const T of i){const I=T[v];if(I)for(const M of I)_.push(M.feature)}}return _}queryRasterValue(i,o,u){const d=this.getOwnSource(i);return d?d.type!=="raster-array"?(this.fire(new a.B(new Error('queryRasterValue support only "raster-array" sources.'))),Promise.resolve(null)):d.queryRasterArrayValue(o,u):(this.fire(new a.B(new Error(`Source with id "${i}" does not exist in the style.`))),Promise.resolve(null))}queryRenderedFeatures(i,o,u){let d;o&&!Array.isArray(o)&&o.filter&&(this._validate(ce,"queryRenderedFeatures.filter",o.filter,null,o),d=a.dc(o.filter));const m={},_=I=>{if(Rc.has(I.type))return;const M=this.getOwnLayerSourceCache(I),C=m[M.id]=m[M.id]||{sourceCache:M,layers:{},has3DLayers:!1};I.is3D(!!this.terrain)&&(C.has3DLayers=!0),C.layers[I.fqid]=C.layers[I.fqid]||{styleLayer:I,targets:[]},C.layers[I.fqid].targets.push({filter:d})};if(o&&o.layers){if(!Array.isArray(o.layers))return this.fire(new a.B(new Error("parameters.layers must be an Array."))),[];for(const I of o.layers){const M=this._layers[I];if(!M)return this.fire(new a.B(new Error(`The layer '${I}' does not exist in the map's style and cannot be queried for features.`))),[];_(M)}}else for(const I in this._layers)_(this._layers[I]);const y=this._queryRenderedFeatures(i,m,u),v=this._flattenAndSortRenderedFeatures(y),T=[];for(const I of v)a.dd(I.layer.id)===this.scope&&T.push(I);return T}queryRenderedFeatureset(i,o,u){let d;o&&!Array.isArray(o)&&o.filter&&(this._validate(ce,"queryRenderedFeatures.filter",o.filter,null,o),d=a.dc(o.filter));const m="mock",_=[];if(o&&o.target)_.push(Object.assign({},o,{targetId:m,filter:d}));else{const I=this.getFeaturesetDescriptors();for(const M of I)_.push({targetId:m,filter:d,target:M});for(const{style:M}of this.fragments){const C=M.getFeaturesetDescriptors();for(const D of C)_.push({targetId:m,filter:d,target:D})}}const y=this.queryRenderedTargets(i,_,u),v=[],T=new Set;for(const I of y)for(const M of I.variants[m])Ju(M,I,T)||v.push(new a.de(I,M));return v}queryRenderedTargets(i,o,u){const d={},m=(y,v,T,I)=>{const M=d[v.id]=d[v.id]||{sourceCache:v,layers:{},has3DLayers:!1};if(M.layers[y.fqid]=M.layers[y.fqid]||{styleLayer:y,targets:[]},y.is3D(!!this.terrain)&&(M.has3DLayers=!0),!I)return T.uniqueFeatureID=!1,void M.layers[y.fqid].targets.push(T);M.layers[y.fqid].targets.push(Object.assign({},T,{namespace:I.namespace,properties:I.properties,uniqueFeatureID:I.uniqueFeatureID}))};for(const y of o)if("featuresetId"in y.target){const{featuresetId:v,importId:T}=y.target,I=this.getFragmentStyle(T);if(!I||!I._featuresetSelectors)continue;const M=I._featuresetSelectors[v];if(!M){this.fire(new a.B(new Error(`The featureset '${v}' does not exist in the map's style and cannot be queried for features.`)));continue}for(const C of M){const D=I.getOwnLayer(C.layerId);D&&!Rc.has(D.type)&&m(D,I.getOwnLayerSourceCache(D),y,C)}}else if("layerId"in y.target){const{layerId:v}=y.target,T=this.getLayer(v);if(!T||Rc.has(T.type))continue;m(T,this.getLayerSourceCache(T),y)}const _=this._queryRenderedFeatures(i,d,u);return this._flattenAndSortRenderedFeatures(_)}_queryRenderedFeatures(i,o,u){const d=[],m=!!this.map._showQueryGeometry,_=Sr.createFromScreenPoints(i,u);for(const y in o){const v=Ao(_,o[y],this._availableImages,u,m,this.getActualScope());Object.keys(v).length&&d.push(v)}if(this.placement)for(const y in o){if(o[y].sourceCache._renderSourceType!==a.b5.Symbol)continue;const v=hf(_.screenGeometry,o[y],this._availableImages,this.placement.collisionIndex,this.placement.retainedQueryData,this.map.getWorldview());Object.keys(v).length&&d.push(v)}return d}querySourceFeatures(i,o){const u=o&&o.filter;
8u&&this._validate(ce,"querySourceFeatures.filter",u,null,o);let d=[];const m=this.getOwnSourceCaches(i);for(const _ of m)d=d.concat(yc(_,o));return d}addSourceType(i,o,u){return zn.getSourceType(i)?u(new Error(`A source type called "${i}" already exists.`)):(zn.setSourceType(i,o),o.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:i,url:o.workerSourceURL},u):u(null,null))}getFlatLight(){return this.light.getLight()}setFlatLight(i,o,u={}){this._checkLoaded();const d=this.light.getLight();let m=!1;for(const y in i)if(!a.b7(i[y],d[y])){m=!0;break}if(!m)return;const _=this._getTransitionParameters();this.light.setLight(i,o,u),this.light.updateTransitions(_)}getTerrain(){return this.terrain&&this.terrain.drapeRenderMode===1?this.terrain.get():null}setTerrainForDraping(){this.setTerrain({source:"",exaggeration:0},0)}checkCanvasFingerprintNoise(){this.disableElevatedTerrain===void 0&&(this.disableElevatedTerrain=a.o.hasCanvasFingerprintNoise(),this.disableElevatedTerrain&&a.w("Terrain and hillshade are disabled because of Canvas2D limitations when fingerprinting protection is enabled (e.g. in private browsing mode)."))}setTerrain(i,o=1){if(this._checkLoaded(),!i)return this.terrainSetForDrapingOnly()||(delete this.terrain,this.map.transform.projection.requiresDraping&&this.setTerrainForDraping()),o===0&&delete this.terrain,i===null?this.stylesheet.terrain=null:delete this.stylesheet.terrain,this._force3DLayerUpdate(),void(this._markersNeedUpdate=!0);this.checkCanvasFingerprintNoise();let u=i;const d=!("source"in i)||i.source==null;if(o===1){if(this.disableElevatedTerrain)return;if("source"in u&&typeof u.source=="object"){const y="terrain-dem-src";this.addSource(y,u.source),u=a.d5(u),u=Object.assign(u,{source:y})}const m=Object.assign({},u),_={};if(this.terrain&&d){m.source=this.terrain.get().source;const y=this.terrain?this.getFragmentStyle(this.terrain.scope):null;y&&(_.style=y.serialize())}if(this._validate(O,"terrain",m,_))return}if(!this.terrain||this.terrain.scope!==this.scope&&!d||this.terrain&&o!==this.terrain.drapeRenderMode){if(!u)return;this._createTerrain(u,o),this.fire(new a.C("data",{dataType:"style"}))}else{const m=this.terrain,_=m.get();for(const y of Object.keys(a.a8.terrain))!u.hasOwnProperty(y)&&a.a8.terrain[y].default&&(u[y]=a.a8.terrain[y].default);for(const y in i)if(!a.b7(i[y],_[y])){m.set(i,this.options),this.stylesheet.terrain=i;const v=this._getTransitionParameters({duration:0});m.updateTransitions(v),this.fire(new a.C("data",{dataType:"style"}));break}}this.mergeTerrain(),this.updateDrapeFirstLayers(),this._markersNeedUpdate=!0}_createFog(i){const o=this.fog=new fi(i,this.map.transform,this.scope,this.options);this.stylesheet.fog=o.get();const u=this._getTransitionParameters({duration:0});o.updateTransitions(u)}_createSnow(i){const o=this.snow=new _i(i,this.map.transform,this.scope,this.options);this.stylesheet.snow=o.get();const u=this._getTransitionParameters({duration:0});o.updateTransitions(u)}_createRain(i){const o=this.rain=new mi(i,this.map.transform,this.scope,this.options);this.stylesheet.rain=o.get();const u=this._getTransitionParameters({duration:0});o.updateTransitions(u)}_updateMarkersOpacity(){this.map._markers.length!==0&&this.map._requestDomTask(()=>{for(const i of this.map._markers)i._evaluateOpacity()})}getFog(){return this.fog?this.fog.get():null}setFog(i){if(this._checkLoaded(),!i)return delete this.fog,delete this.stylesheet.fog,void(this._markersNeedUpdate=!0);if(this.fog){const o=this.fog;if(!a.b7(o.get(),i)){o.set(i,this.options),this.stylesheet.fog=o.get();const u=this._getTransitionParameters({duration:0});o.updateTransitions(u)}}else this._createFog(i);this._markersNeedUpdate=!0}getSnow(){return this.snow?this.snow.get():null}setSnow(i){if(this._checkLoaded(),!i)return delete this.snow,void delete this.stylesheet.snow;if(this.snow){const o=this.snow;if(!a.b7(o.get(),i)){o.set(i,this.options),this.stylesheet.snow=o.get();const u=this._getTransitionParameters({duration:0});o.updateTransitions(u)}}else this._createSnow(i);this._markersNeedUpdate=!0}getRain(){return this.rain?this.rain.get():null}setRain(i){if(this._checkLoaded(),!i)return delete this.rain,void delete this.stylesheet.rain;if(this.rain){const o=this.rain;
8if(!a.b7(o.get(),i)){o.set(i,this.options),this.stylesheet.rain=o.get();const u=this._getTransitionParameters({duration:0});o.updateTransitions(u)}}else this._createRain(i);this._markersNeedUpdate=!0}_reloadColorTheme(){const i=()=>{for(const d in this._layers)this._layers[d].lut=this._styleColorTheme.lut;for(const d in this._sourceCaches)this._sourceCaches[d].clearTiles()},o=this._styleColorTheme.colorThemeOverride?this._styleColorTheme.colorThemeOverride:this._styleColorTheme.colorTheme;if(!o)return this._styleColorTheme.lut=null,void i();const u=this._evaluateColorThemeData(o);this._loadColorTheme(u).then(()=>{this.fire(new a.C("colorthemeset")),i()}).catch(d=>{a.w(`Couldn't set color theme: ${d}`)})}setColorTheme(i){this._checkLoaded(),this._styleColorTheme.colorThemeOverride&&a.w("Note: setColorTheme is called on a style with a color-theme override, the passed color-theme won't be visible."),this._styleColorTheme.colorTheme=i,this._reloadColorTheme()}setImportColorTheme(i,o){const u=this.getFragmentStyle(i);u&&(u._styleColorTheme.colorThemeOverride=o,u._reloadColorTheme())}_getTransitionParameters(i){return{now:a.o.now(),transition:Object.assign(this.transition,i)}}updateDrapeFirstLayers(){if(!this.terrain)return;const i=[],o=[];for(const u of this._mergedOrder)this.isLayerDraped(this._mergedLayers[u])?i.push(u):o.push(u);this._drapedFirstOrder=[],this._drapedFirstOrder.push(...i),this._drapedFirstOrder.push(...o)}_createTerrain(i,o){const u=this.terrain=new St(i,o,this.scope,this.options,this.map.getWorldview());o===1&&(this.stylesheet.terrain=i),this.mergeTerrain(),this.updateDrapeFirstLayers(),this._force3DLayerUpdate();const d=this._getTransitionParameters({duration:0});u.updateTransitions(d)}_force3DLayerUpdate(){for(const i in this._layers){const o=this._layers[i];o.type==="fill-extrusion"&&this._updateLayer(o)}}_forceSymbolLayerUpdate(){for(const i in this._layers){const o=this._layers[i];o.type==="symbol"&&this._updateLayer(o)}}_validate(i,o,u,d,m={}){if(m&&m.validate===!1)return!1;const _=Object.assign({},this.serialize());return Cs(this,i.call(Zi,Object.assign({key:o,style:_,value:u,styleSpec:a.a8},d)))}_remove(){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),a.df.off("pluginStateChange",this._rtlTextPluginCallback);for(const i in this._mergedLayers)this._mergedLayers[i].setEventedParent(null);for(const i in this._mergedSourceCaches)this._mergedSourceCaches[i].clearTiles(),this._mergedSourceCaches[i].setEventedParent(null);this.imageManager.removeScope(this.scope),this.imageManager.imageAtlasCache.clear(),this.setEventedParent(null),delete this.fog,delete this.snow,delete this.rain,delete this.terrain,delete this.ambientLight,delete this.directionalLight,this.indoorManager.destroy(),this.isRootStyle()&&(this.imageManager.setEventedParent(null),this.imageManager.destroy(),this.modelManager.setEventedParent(null),this.modelManager.destroy(),this.dispatcher.remove())}clearSource(i){const o=this.getSourceCaches(i);for(const u of o)u.clearTiles()}clearSources(){for(const i in this._mergedSourceCaches)this._mergedSourceCaches[i].clearTiles()}clearLayers(){for(const i in this._mergedLayers){const o=this._mergedLayers[i];o._clear&&o._clear()}}reloadSource(i){const o=this.getSourceCaches(i);for(const u of o)u.resume(),u.reload()}
vendor: 4,159 bytes, line 8
8reloadSources(){for(const i of this.getSources())i.reload&&i.reload()}reloadModels(){this.modelManager.reloadModels(""),this.forEachFragmentStyle(i=>{i.modelManager.reloadModels(i.scope)})}updateSources(i){let o;this.directionalLight&&(o=vf(this.directionalLight));const u=new Set,d=new Set,m=new Set;for(const _ in this._mergedLayers){const y=this._mergedLayers[_];y.type==="building"?u.add(y.source):y.type==="raster"&&y.paint&&y.paint.get("raster-elevation-reference")==="ground"&&m.add(y.source),y.hasElevation()&&!d.has(y.source)&&d.add(y.source)}for(const _ in this._mergedSourceCaches){const y=this._mergedSourceCaches[_],v=d.has(y._source.id);y._isRasterElevatedOverTerrain=m.has(y._source.id),u.has(y._source.id)&&(y._source.reparseOverscaled=!1),y.update(i,void 0,void 0,o,v)}}_generateCollisionBoxes(){for(const i in this._sourceCaches){const o=this._sourceCaches[i];o.resume(),o.reload()}}_handleLayerOrderChange(){this._requestFullLabelPlacement(),this.fire(new a.C("neworder"))}_requestFullLabelPlacement(){this.pauseablePlacement||(this.pauseablePlacement=new Cc),this.pauseablePlacement.requestFullPlacement()}_setLabelPlacementStale(){this.placement&&this.placement.setStale()}_updatePlacement(i,o,u,d,m){this.pauseablePlacement||(this.pauseablePlacement=new Cc);let _=!1,y=!1;const v={},T={};for(const z of this._mergedOrder){const V=this._mergedLayers[z];if(V.type!=="symbol")continue;const N=a.F(V.source,V.scope);let $=v[N];if(!$){const j=this.getLayerSourceCache(V);if(!j)continue;const ne=j.getRenderableIds(!0).map(Y=>j.getTileByID(Y));T[N]=ne.slice(),$=v[N]=ne.sort((Y,re)=>re.tileID.overscaledZ-Y.tileID.overscaledZ||(Y.tileID.isLessThan(re.tileID)?-1:1))}const H=this.crossTileSymbolIndex.addLayer(V,$,i.center.lng,i.projection);_=_||H}this.crossTileSymbolIndex.pruneUnusedLayers(this._mergedOrder);const I=!!(this.placement&&!i.equals(this.placement.transform)),M=!!(this.placement&&(this.placement.lastReplacementSourceUpdateTime!==0&&!m||this.placement.lastReplacementSourceUpdateTime!==m.updateTime)),C=I||M||_,D=(C||this.pauseablePlacement.isStale())&&u===0,F=this.pauseablePlacement.isDone()&&!this.placement.stillRecent(a.o.now(),i.zoom)&&u!==0;if((this.pauseablePlacement.isFullPlacementRequested()||!this.pauseablePlacement.placement||D||F)&&(this.pauseablePlacement=this.pauseablePlacement.startNewPlacement(i,this._mergedOrder,o,u,d,this.placement,this.fog&&i.projection.supportsFog?this.fog.state:null,this._buildingIndex),this.map.painter)){const z=this.map.painter.maxFrontCutoffRawStart;if(z>0){const V=180*i.pitch/Math.PI;if(V>=15){const N=Math.min(1,Math.max(0,(V-15)/5)),$=N*N*(3-2*N);this.pauseablePlacement.placement.frontCutoffStart=-.5*(1-$)+z*$}}}if(this.pauseablePlacement.isDone()?C&&u!==0&&this.pauseablePlacement.setStale():(this.pauseablePlacement.continuePlacement(this._mergedOrder,this._mergedLayers,v,T,this.map.painter.scaleFactor),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(a.o.now()),y=!0),_&&this.pauseablePlacement.setStale()),y||_){this._buildingIndex.onNewFrame(i.zoom);for(let z=0;z<this._mergedOrder.length;z++){const V=this._mergedLayers[this._mergedOrder[z]];if(V.type!=="symbol"||V.visibility==="none")continue;const N=this.isLayerClipped(V);this.placement.updateLayerOpacities(V,v[a.F(V.source,V.scope)],z,N?m:null)}}return!this.pauseablePlacement.isDone()||this.placement.isStale()||this.placement.hasTransitions(a.o.now())}_releaseSymbolFadeTiles(){for(const i in this._sourceCaches)this._sourceCaches[i].releaseSymbolFadeTiles()}addImport(i,o){this._checkLoaded();const u=this.stylesheet.imports=this.stylesheet.imports||[];if(u.findIndex(({id:m})=>m===i.id)!==-1)return void this.fire(new a.B(new Error(`Import with id '${i.id}' already exists in the map's style.`)));if(!o)return u.push(i),this._loadImports([i],!0);const d=u.findIndex(({id:m})=>m===o);return d===-1&&this.fire(new a.B(new Error(`Import with id "${o}" does not exist on this map.`))),this.stylesheet.imports=u.slice(0,d).concat(i).concat(u.slice(d)),this._loadImports([i],!0,o)}updateImport(i,o){this._checkLoaded();const u=this.stylesheet.imports||[],d=this.getImportIndex(i);
8return d===-1?this:typeof o=="string"?(this.setImportUrl(i,o),this):(o.url&&o.url!==u[d].url&&this.setImportUrl(i,o.url),a.b7(o.config,u[d].config)||this.setImportConfig(i,o.config,o.data.schema),a.b7(o.data,u[d].data)||this.setImportData(i,o.data),this)}moveImport(i,o){this._checkLoaded();let u=this.stylesheet.imports||[];const d=this.getImportIndex(i);if(d===-1)return this;const m=this.getImportIndex(o);if(m===-1)return this;const _=u[d],y=this.fragments[d];return u=u.filter(({id:v})=>v!==i),this.fragments=this.fragments.filter(({id:v})=>v!==i),this.stylesheet.imports=u.slice(0,m).concat(_).concat(u.slice(m)),this.fragments=this.fragments.slice(0,m).concat(y).concat(this.fragments.slice(m)),this.mergeLayers(),this}setImportUrl(i,o){this._checkLoaded();const u=this.stylesheet.imports||[],d=this.getImportIndex(i);if(d===-1)return this;u[d].url=o;const m=this.fragments[d];return m.style=this._createFragmentStyle(u[d]),m.style.on("style.import.load",()=>this.mergeAll()),m.style.loadURL(o),this}setImportData(i,o){this._checkLoaded();const u=this.getImportIndex(i),d=this.stylesheet.imports||[];return u===-1?this:o?(this.fragments[u].style.setState(o),this._reloadImports(),this):(delete d[u].data,this.setImportUrl(i,d[u].url))}setImportConfig(i,o,u){this._checkLoaded();const d=this.getImportIndex(i),m=this.stylesheet.imports||[];if(d===-1)return this;o?m[d].config=o:delete m[d].config;const _=this.fragments[d];u&&_.style.stylesheet&&(_.style.stylesheet.schema=u);const y=_.style.stylesheet&&_.style.stylesheet.schema;return _.config=o,_.style.updateConfig(o,y),this.updateConfigDependencies(),this}removeImport(i){this._checkLoaded();const o=this.stylesheet.imports||[],u=this.getImportIndex(i);u!==-1&&(o.splice(u,1),this.fragments[u].style._remove(),this.fragments.splice(u,1),this._reloadImports())}getImportIndex(i){const o=(this.stylesheet.imports||[]).findIndex(u=>u.id===i);return o===-1&&this.fire(new a.B(new Error(`Import '${i}' does not exist in the map's style and cannot be updated.`))),o}getLayer(i){return this._mergedLayers[i]}getSources(){const i=[];for(const o in this._mergedOtherSourceCaches){const u=this._mergedOtherSourceCaches[o];u&&i.push(u.getSource())}return i}getSource(i,o){const u=this.getSourceCache(i,o);return u&&u.getSource()}getLayerSource(i){const o=this.getLayerSourceCache(i);return o&&o.getSource()}getSourceCache(i,o){const u=a.F(i,o);return this._mergedOtherSourceCaches[u]}getLayerSourceCache(i){const o=a.F(i.source,i.scope);return i.type==="symbol"?this._mergedSymbolSourceCaches[o]:i.type==="fill-extrusion"&&this._mergedFillExtrusionSourceCaches[o]||this._mergedOtherSourceCaches[o]}getSourceCaches(i){if(i==null)return Object.values(this._mergedSourceCaches);const o=[];return this._mergedOtherSourceCaches[i]&&o.push(this._mergedOtherSourceCaches[i]),this._mergedSymbolSourceCaches[i]&&o.push(this._mergedSymbolSourceCaches[i]),this._mergedFillExtrusionSourceCaches[i]&&o.push(this._mergedFillExtrusionSourceCaches[i]),o}updateSourceCaches(){const i=this._changes.getUpdatedSourceCaches();for(const o in i){const u=i[o];u==="reload"?this.reloadSource(o):u==="clear"&&this.clearSource(o)}}updateLayers(i){const o=this._changes.getUpdatedPaintProperties();for(const u of o){const d=this.getLayer(u);d&&d.updateTransitions(i)}}getGlyphsUrl(){return this.stylesheet.glyphs}setGlyphsUrl(i){this.stylesheet.glyphs=i,this.glyphManager.setURL(i)}getImages(i,o,u){this.imageManager.getImages(o.images,o.scope,u),this._updateTilesForChangedImages();const d=_=>{if(_){const y=o.images.map(v=>a.I.toString(v));_.setDependencies(o.tileID.key,o.type,y)}},m=a.F(o.source,o.scope);d(this._mergedOtherSourceCaches[m]),d(this._mergedSymbolSourceCaches[m]),o.images.some(_=>_.iconsetId)&&this.fire(new a.C("data",{dataType:"style"}))}rasterizeImages(i,o,u){this.imageManager.rasterizeImages(o,u)}checkAtlasCache(i,o,u){const d=this.imageManager.imageAtlasCache.findCachedAtlas(o.descriptor);u(null,d&&d.contentDescriptor?{iconPositions:d.iconPositions,patternPositions:d.patternPositions,sourceHash:d.contentDescriptor.hash}:null)}getGlyphs(i,o,u){this.glyphManager.getGlyphs(o.stacks,u)}getOwnSourceCache(i){return this._otherSourceCaches[i]}getOwnLayerSourceCache(i){return i.type==="symbol"?this._symbolSourceCaches[i.source]:i.type==="fill-extrusion"&&this._fillExtrusionSourceCaches[i.source]||this._otherSourceCaches[i.source]}getOwnSourceCaches(i){const o=[];return this._otherSourceCaches[i]&&o.push(this._otherSourceCaches[i]),this._symbolSourceCaches[i]&&o.push(this._symbolSourceCaches[i]),this._fillExtrusionSourceCaches[i]&&o.push(this._fillExtrusionSourceCaches[i]),o}_isSourceCacheLoaded(i){const o=this.getOwnSourceCaches(i);return o.length===0?(this.fire(new a.B(new Error(`There is no source with ID '${i}'`))),!1):o.every(u=>u.loaded())}has3DLayers(){return this._has3DLayers}hasSymbolLayers(){return this._hasSymbolLayers}hasCircleLayers(){return this._hasCircleLayers}isLayerClipped(i,o){if(!this._clipLayerPresent&&i.type!=="fill-extrusion"&&i.type!=="building")return!1;const u=i.type==="fill-extrusion"&&(i.sourceLayer==="building"||i.sourceLayer==="procedural_buildings"),d=i.type==="building";if(i.is3D(!!this.terrain)){if(u||d||o&&o.type==="batched-model"||i.type==="model")return!0}else if(i.type==="symbol")return!0;return!1}_clearWorkerCaches(){this.dispatcher.broadcast("clearCaches")}getBOMObject(){}destroy(){this._clearWorkerCaches(),this.imageManager.imageAtlasCache.clear(),this.fragments.forEac
8h(i=>{i.style._remove()}),this.terrainSetForDrapingOnly()&&(delete this.terrain,delete this.stylesheet.terrain)}}zn.getSourceType=function(l){return _c[l]},zn.setSourceType=function(l,i){_c[l]=i},zn.registerForPluginStateChange=a.dg;var dh=`
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`,fh=`
14#ifdef DUAL_SOURCE_BLENDING
15layout(location=0,index=0) out vec4 glFragColor;layout(location=0,index=1) out vec4 glFragColorSrc1;
16#else
17layout(location=0) out vec4 glFragColor;
18#endif
19#ifdef USE_MRT1
20layout(location=1) out vec4 out_Target1;
21#endif
22highp float unpack_depth(highp vec4 rgba_depth)
23{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;}
24#ifdef INDICATOR_CUTOUT
25uniform vec3 u_indicator_cutout_centers;uniform vec4 u_indicator_cutout_params;
26#endif
27const float DITHER_THRESHOLDS[16]=float[16](
281.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/17.0, 8.0/17.0,14.0/17.0, 6.0/17.0
29);vec4 applyCutout(vec4 color,float height) {
30#ifdef INDICATOR_CUTOUT
31float 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);
32#else
33return color;
34#endif
35}float cutoutGroundRoofOpacity(vec4 groundRoof) {
36#ifdef INDICATOR_CUTOUT
37float 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);
38#else
39return 1.0;
40#endif
41}
42#ifdef DEBUG_WIREFRAME
43#define HANDLE_WIREFRAME_DEBUG \\
44glFragColor=vec4(0.7,0.0,0.0,0.7); \\
45gl_FragDepth=gl_FragCoord.z-0.0001;
46#else
47#define HANDLE_WIREFRAME_DEBUG
48#endif
49#ifdef RENDER_CUTOFF
50uniform highp vec4 u_cutoff_params;in float v_cutoff_opacity;
51#endif
52vec4 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 applyLUT(highp sampler3D lut,vec4 col) {vec3 size=vec3(textureSize(lut,0));vec3 uvw=(col.rbg*float(size-1.0)+0.5)/size;return vec4(texture(lut,uvw).rgb*col.a,col.a);}vec3 applyLUT(highp sampler3D lut,vec3 col) {return applyLUT(lut,vec4(col,1.0)).rgb;}`,ph=`
53#define EXTENT 8192.0
54#define RAD_TO_DEG 180.0/PI
55#define DEG_TO_RAD PI/180.0
56#define GLOBE_RADIUS EXTENT/PI/2.0
57float 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;}
58#ifdef PROJECTION_GLOBE_VIEW
59vec3 mercator_tile_position(mat4 matrix,vec2 tile_anchor,vec3 tile_id,vec2 mercator_center) {
60#ifndef PROJECTED_POS_ON_VIEWPORT
61float 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;
62#else
63return vec3(0.0);
64#endif
65}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);}
66#endif
67vec2 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(
68unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0
69);}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);
69return (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);}
70#ifdef RENDER_CUTOFF
71uniform vec4 u_cutoff_params;out float v_cutoff_opacity;
72#endif
73const vec4 AWAY=vec4(-1000.0,-1000.0,-1000.0,1);const float skirtOffset=24575.0;vec3 decomposeToPosAndSkirt(ivec2 posWithComposedSkirt)
74{float skirt=float(float(posWithComposedSkirt.x) >=skirtOffset);vec2 pos=vec2(posWithComposedSkirt)-vec2(skirt*skirtOffset,0.0);return vec3(pos,skirt);}
75#ifndef HAS_SHADER_STORAGE_BLOCK_material_buffer
76#define GET_ATTRIBUTE_float(attrib,matInfo,attrib_id) attrib
77#define GET_ATTRIBUTE_vec4(attrib,matInfo,attrib_id) attrib
78#define GET_ATTRIBUTE_vec2(attrib,matInfo,attrib_id) attrib
79#define DECLARE_MATERIAL_TABLE_INFO
80#endif`,Yo="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;}",_l=`
81#define ELEVATION_SCALE 7.0
82#define ELEVATION_OFFSET 450.0
83#ifdef PROJECTION_GLOBE_VIEW
84uniform 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(
85mix(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;}
86#else
87vec3 elevationVector(vec2 pos) { return vec3(0,0,1); }
88#endif
89#ifdef TERRAIN
90uniform 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) {
91#ifdef TERRAIN_DEM_FLOAT_FORMAT
92vec2 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;
93#else
94float 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);
95#endif
96}float prevElevation(vec2 apos) {
97#ifdef TERRAIN_DEM_FLOAT_FORMAT
98vec2 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;
99#else
100float 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);
101#endif
102}
103#ifdef TERRAIN_VERTEX_MORPHING
104float elevation(vec2 apos) {
105#ifdef ZERO_EXAGGERATION
106return 0.0;
107#endif
108float nextElevation=currentElevation(apos);float prevElevation=prevElevation(apos);return mix(prevElevation,nextElevation,u_dem_lerp);}
109#else
110float elevation(vec2 apos) {
111#ifdef ZERO_EXAGGERATION
112return 0.0;
113#endif
114return currentElevation(apos);}
115#endif
116vec4 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);}
117#else
118float elevation(vec2 pos) { return 0.0; }
119#endif
120#ifdef DEPTH_OCCLUSION
121uniform 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;
122#ifdef DEPTH_D24
123float 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);}
124#else
125highp float unpack_depth_rgba(vec4 rgba_depth)
126{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;}
127#endif
128bool isOccluded(vec4 frag) {vec3 coord=frag.xyz/frag.w;
129#ifdef CLIP_ZERO_TO_ONE
130coord.z=-1.0+2.0*coord.z; 
131#endif
132#ifdef DEPTH_D24
133float depth=unpack_depth(texture(u_depth,(coord.xy+1.0)*0.5).r);
134#else
135float depth=unpack_depth_rgba(texture(u_depth,(coord.xy+1.0)*0.5));
136#endif
137return coord.z+u_occlusion_depth_offset > depth;}highp vec4 getCornerDepths(vec2 coord) {highp vec3 df=vec3(u_occluder_half_size*u_depth_
137size_inv,0.0);highp vec2 uv=0.5*coord.xy+0.5;
138#ifdef DEPTH_D24
139highp vec4 depth=vec4(
140texture(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
141);depth=unpack_depth4(depth);
142#else
143highp vec4 depth=vec4(
144unpack_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))
145);
146#endif
147return depth;}highp float occlusionFadeMultiSample(vec4 frag) {highp vec3 coord=frag.xyz/frag.w;highp vec2 uv=0.5*coord.xy+0.5;
148#ifdef CLIP_ZERO_TO_ONE
149coord.z=-1.0+2.0*coord.z; 
150#endif
151int 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) {
152#ifdef DEPTH_D24
153highp float depth=unpack_depth(texture(u_depth,uv-df+vec2(float(x)*oneStep.x,float(y)*oneStep.y)).r);
154#else
155highp float depth=unpack_depth_rgba(texture(u_depth,uv-df+vec2(float(x)*oneStep.x,float(y)*oneStep.y)));
156#endif
157res+=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;
158#ifdef CLIP_ZERO_TO_ONE
159coord.z=-1.0+2.0*coord.z; 
160#endif
161highp 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));}
162#else
163bool isOccluded(vec4 frag) { return false; }highp float occlusionFade(vec4 frag) { return 1.0; }highp float occlusionFadeMultiSample(vec4 frag) { return 1.0; }
164#endif`,mh=`#ifdef FOG
165uniform 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);}
166#endif`,_h=`#ifdef FOG
167uniform 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;
168#ifdef FLIP_Y
169uv.y=1.0-uv.y;
170#endif
171highp vec3 ray_dir=mix(
172mix(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;}
172vec3 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);}
173#endif`,da=`#ifdef RASTER_ARRAY
174uniform 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);}vec2 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)
175);}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)
176);}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);}
177#endif`,fa=`#ifdef RASTER_ARRAY
178uniform 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;}
179#endif
180uniform 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;}`,gh=`#ifdef RENDER_SHADOWS
181uniform 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];}
182#endif`,Lc=`#ifdef RENDER_SHADOWS
183precision 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,high
183p float bias) {
184#ifdef CLIP_ZERO_TO_ONE
185highp vec3 coord=vec3(pos.xy*0.5+0.5,pos.z-bias);
186#else
187highp vec3 coord=vec3(pos.xy*0.5+0.5,pos.z*0.5+0.5-bias);
188#endif
189return 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;
190#ifdef SHADOWS_SINGLE_CASCADE
191vec2 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);
192#else
193light_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);
194#endif
195}highp float calculate_shadow_bias(float NDotL) {
196#ifdef NORMAL_OFFSET
197return 0.5*u_shadow_bias.x;
198#else
199return 0.5*(u_shadow_bias.x+clamp(u_shadow_bias.y*tan(acos(NDotL)),0.0,u_shadow_bias.z));
200#endif
201}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)
202{highp vec2 biasUV=vec2(
203pos_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);}
204#endif`;const _n=/#include\s+"([^"]+)"/g,gl=/#pragma mapbox: ([\w\-]+) ([\w]+) ([\w]+) ([\w]+)/g,Ze=/\b[A-Za-z_][A-Za-z0-9_]*\b/g,wf=new Set(["ifdef","ifndef","elif","if","defined"]),yl=new Set;_a(dh,yl),_a(ph,yl),_a(fh,yl);const pa={"_prelude_fog.vertex.glsl":mh,"_prelude_terrain.vertex.glsl":_l,"_prelude_shadow.vertex.glsl":gh,"_prelude_material_table.vertex.glsl":`#ifdef HAS_SHADER_STORAGE_BLOCK_material_buffer
205#define MATERIAL_TABLE_DEBUG 0
206uniform int u_material_offset;uniform int u_vertex_offset;layout(std140,binding=0)readonly buffer material_buffer{uvec4 material_data[];};struct MaterialInfo{uint dataOffset;
207#if MATERIAL_TABLE_DEBUG
208vec4 colorDebug;
209#endif
210};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);}
210float 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++) { 
211if (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; 
212}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 { 
213iRange=findRangeBinarySearch(vertexId,numRanges,dwordOffset);}return iRange;}MaterialInfo read_material_info(uint vertex_id) {MaterialInfo info;
214#if MATERIAL_TABLE_DEBUG
215const 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;
216#endif
217uint offset=0u;
218#if MATERIAL_TABLE_DEBUG
219bool keepFinding=true;uint magic=read_buf(offset);if(magic !=0xCAFEBABEu) {info.colorDebug=red;keepFinding=false;return info;}
220#endif
221offset++;
222#if MATERIAL_TABLE_DEBUG
223uint nrMaterials=read_buf(offset);uint nrVertices=read_buf(offset+1u);if(keepFinding && vertex_id >=nrVertices) {info.colorDebug=red;keepFinding=false;}
224#endif
225offset+=2u;uint nrMaterialLookupEntries=read_buf(offset++);uint perMaterialEntrySizeDwords=read_buf(offset++);
226#if MATERIAL_TABLE_DEBUG
227if(keepFinding && perMaterialEntrySizeDwords !=1u) {info.colorDebug=red;keepFinding=false;}
228#endif
229uint iMaterialLookup=findRange(vertex_id,nrMaterialLookupEntries,offset);
230#if MATERIAL_TABLE_DEBUG
231if(keepFinding)
232{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;}}}
233#endif
234offset+=nrDwordsForVertexIdEntries(nrMaterialLookupEntries);uint materialId=iMaterialLookup;
235#if MATERIAL_TABLE_DEBUG
236if(keepFinding) {if(materialId >=nrMaterialLookupEntries) {info.colorDebug=red;}}
237#endif
238info.dataOffset=offset+materialId*perMaterialEntrySizeDwords;return info;}uint get_data_location(const MaterialInfo matInfo,uint attribOffsetBytes)
239{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);}
240#define GET_ATTRIBUTE_float(attrib,matInfo,attrib_offset) read_material_float(matInfo,attrib_offset)
241#define GET_ATTRIBUTE_vec4(attrib,matInfo,attrib_offset) read_material_vec4(matInfo,attrib_offset)
242#define GET_ATTRIBUTE_vec2(attrib,matInfo,attrib_offset) read_material_vec2(matInfo,attrib_offset)
243#define DECLARE_MATERIAL_TABLE_INFO MaterialInfo materialInfo=read_material_info(uint(gl_VertexID));
244#define DECLARE_MATERIAL_TABLE_INFO_DEBUG(dbgColor) MaterialInfo materialInfo=read_material_info(uint(gl_VertexID)); dbgColor=materialInfo.colorDebug;
245#endif`,"_prelude_fog.fragment.glsl":_h,"_prelude_shadow.fragment.glsl":Lc,"_prelude_lighting.glsl":`
246#ifdef LIGHTING_3D_MODE
247uniform 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
247));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);}
248#endif`,"_prelude_raster_array.glsl":da,"_prelude_raster_particle.glsl":fa},Ln={};Lt("",_l),Lt(_h,mh),Lt(Lc,gh),Lt(da,""),Lt(fa,"");const Fc=Lt(fh,ph),Ko=dh,Oc=[`
249#if defined(GL_EXT_blend_func_extended) && defined(DUAL_SOURCE_BLENDING)
250#extension GL_EXT_blend_func_extended : require
251#endif`,"precision mediump float;",Ko,Fc.fragmentSource].join(`
252`),ma=["precision highp float;",Ko,Fc.vertexSource].join(`
253`);var Tf={background:Lt(`#include "_prelude_fog.fragment.glsl"
254#include "_prelude_lighting.glsl"
255uniform vec4 u_color;uniform float u_opacity;uniform mediump float u_emissive_strength;
256#ifdef LIGHTING_3D_MODE
257in vec4 v_color;
258#endif
259void main() {vec4 out_color;
260#ifdef FEATURE_CUTOUT
261vec2 uv=gl_FragCoord.xy*u_inv_viewport_size.xy;
262#ifdef FLIP_Y
263uv.y=1.0-uv.y;
264#endif
265float 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);
266#else
267#ifdef LIGHTING_3D_MODE
268out_color=v_color;
269#else
270out_color=u_color;
271#endif
272#ifdef FOG
273out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
274#endif
275#endif
276glFragColor=out_color*u_opacity;
277#ifdef USE_MRT1
278out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);
279#endif
280#ifdef OVERDRAW_INSPECTOR
281glFragColor=vec4(1.0);
282#endif
283HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
284#include "_prelude_lighting.glsl"
285in ivec2 a_pos;uniform mat4 u_matrix;uniform mediump float u_emissive_strength;
286#ifdef LIGHTING_3D_MODE
287uniform mediump vec4 u_color;out vec4 v_color;
288#endif
289void main() {gl_Position=u_matrix*vec4(a_pos,0,1);
290#ifndef FEATURE_CUTOUT
291#ifdef LIGHTING_3D_MODE
292v_color=apply_lighting_with_emission_ground(u_color,u_emissive_strength);
293#endif
294#ifdef FOG
295v_fog_pos=fog_position(vec2(a_pos));
296#endif
297#endif
298}`),backgroundPattern:Lt(`#include "_prelude_fog.fragment.glsl"
299#include "_prelude_lighting.glsl"
300uniform 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);
301#ifdef LIGHTING_3D_MODE
302out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);
303#endif
304#ifdef FOG
305out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
306#endif
307glFragColor=out_color*u_opacity;
308#ifdef USE_MRT1
309out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);
310#endif
311#ifdef OVERDRAW_INSPECTOR
312glFragColor=vec4(1.0);
313#endif
314HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
315uniform 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);
316#ifdef FOG
317v_fog_pos=fog_position(pos);
318#endif
319}`),building:Lt(`#include "_prelude_fog.fragment.glsl"
320#include "_prelude_shadow.fragment.glsl"
321#include "_prelude_lighting.glsl"
322const 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;
323#ifdef RENDER_FRONT_CUTOFF
324in float v_front_cutoff_opacity;
325#endif
326#ifdef INDICATOR_CUTOUT
327#ifdef FEATURE_CUTOUT
328in vec4 v_ground_roof;
329#endif
330#endif
331#ifdef BUILDING_FAUX_FACADE
332in 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;
333#endif
334#ifdef RENDER_SHADOWS
335in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;
336#endif
337#ifdef FLOOD_LIGHT
338in highp float v_flood_radius;in float v_has_flood_light;
339#endif
340uniform 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));}
341#ifdef BUILDING_FAUX_FACADE
342highp 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;
343#if 0
344if (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;
345#else
346if (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;
347#endif
348return out_color;}
349#endif
350vec3 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;
351#ifdef BUILDING_FAUX_FACADE
352if (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);}
353#endif
354vec4 color=vec4(base_color,1.0);vec3 xy_flipped_normal=vec3(-normal.xy,normal.z);float shadowed_lighting_factor=0.0;
355#ifdef RENDER_SHADOWS
356#ifdef RENDER_CUTOFF
357shadowed_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;}
358#else
359shadowed_lighting_factor=shadowed_light_factor_normal(xy_flipped_normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);
360#endif
361#else
362shadowed_lighting_factor=max(0.0,dot(xy_flipped_normal,u_lighting_directional_dir));
363#endif
364color.rgb=apply_lighting_linear(color.rgb,xy_flipped_normal,shadowed_lighting_factor);color.rgb=linearTosRGB(color.rgb);
365#ifdef FLOOD_LIGHT
366float 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);
367#endif
368color.rgb=mix(color.rgb,linearTosRGB(base_color.rgb),emissive);
369#ifdef FOG
370color=fog_dither(fog_apply_premultiplied(color,v_fog_pos,v_pos.z));
371#endif
372color*=u_opacity;
373#ifdef INDICATOR_CUTOUT
374#ifdef FEATURE_CUTOUT
375{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;}}}
376#else
377color=applyCutout(color,v_pos.z);
378#endif
379#endif
380#ifdef RENDER_FRONT_CUTOFF
381if (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;}}
382#endif
383#ifdef FEATURE_CUTOUT
384color=apply_feature_cutout(color,gl_FragCoord,get_cutout_factors(gl_FragCoord).x);
385#endif
386glFragColor=color;
387#ifdef DEBUG_SHOW_NORMALS
388color.rgb=xy_flipped_normal*0.5+vec3(0.5,0.5,0.5);color.a=1.0;glFragColor=color;
389#endif
390#ifdef OVERDRAW_INSPECTOR
391glFragColor=vec4(1.0);
392#endif
393HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
394#include "_prelude_shadow.vertex.glsl"
395in vec3 a_pos_3f;in ivec4 a_normal_3;in ivec4 a_centroid_3;
396#ifdef FLOOD_LIGHT
397in int a_flood_light_wall_radius_1i16;
398#endif
399#ifdef BUILDING_FAUX_FACADE
400in uvec4 a_faux_facade_data;in uvec2 a_faux_facade_vertical_range;
401#endif
402uniform mat4 u_matrix;uniform mat4 u_normal_matrix;uniform highp float u_tile_to_meter;
403#ifdef RENDER_FRONT_CUTOFF
404uniform vec3 u_front_cutoff_params;out float v_front_cutoff_opacity;
405#endif
406#ifdef INDICATOR_CUTOUT
407#ifdef FEATURE_CUTOUT
408out vec4 v_ground_roof;
409#endif
410#endif
411out vec4 v_color;out vec3 v_normal;out highp vec3 v_pos;
412#ifdef BUILDING_FAUX_FACADE
413out 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;
414#endif
415#ifdef RENDER_SHADOWS
416uniform 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;
417#endif
418#ifdef FLOOD_LIGHT
419out highp float v_flood_radius;out float v_has_flood_light;
420#endif
421const 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));}
422#ifdef BUILDING_FAUX_FACADE
423mat3 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);}
424#endif
425#pragma mapbox: define-attribute-vertex-shader-only highp uvec2 part_color_emissive
426#pragma mapbox: define-attribute-vertex-shader-only highp uvec2 faux_facade_color_emissive
427void main() {
428#pragma mapbox: initialize-attribute-custom highp uvec2 part_color_emissive
429#pragma mapbox: initialize-attribute-custom highp uvec2 faux_facade_color_emissive
430#ifdef FLOOD_LIGHT
431v_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);
432#endif
433vec4 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);
434#ifdef BUILDING_FAUX_FACADE
435vec4 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;}
436#endif
437v_pos=a_pos_3f;
438#if defined(RENDER_CUTOFF) || defined(RENDER_FRONT_CUTOFF)
439float halfSpanX=spanBits.x*10.0/u_tile_to_meter;float halfSpanY=spanBits.y*10.0/u_tile_to_meter;
439vec2 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;
440#endif
441#if defined(RENDER_CUTOFF) || defined(RENDER_FRONT_CUTOFF)
442vec4 ground=u_matrix*vec4(centroid_xy,0.0,1.0);
443#endif
444#ifdef RENDER_CUTOFF
445v_cutoff_opacity=cutoff_opacity(u_cutoff_params,ground.z);hidden=float(v_cutoff_opacity==0.0);v_pos.z*=v_cutoff_opacity;
446#endif
447#ifdef RENDER_SHADOWS
448vec3 shadow_pos=v_pos;
449#ifdef NORMAL_OFFSET
450vec3 offset=shadow_normal_offset_model(v_normal);shadow_pos+=offset*shadow_normal_offset_multiplier0();
451#endif
452v_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);
453#endif
454#ifdef FOG
455v_fog_pos=fog_position(v_pos);
456#endif
457#ifdef RENDER_FRONT_CUTOFF
458v_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);}
459#endif
460gl_Position=mix(u_matrix*vec4(v_pos,1),AWAY,hidden);gl_Position.z-=depth_offset*gl_Position.w;
461#ifdef INDICATOR_CUTOUT
462#ifdef FEATURE_CUTOUT
463vec4 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);
464#endif
465#endif
466}`),buildingBloom:Lt(`in vec4 v_color_emissive;
467#pragma mapbox: define-attribute highp vec4 bloom_attenuation
468#pragma mapbox: initialize-attribute highp vec4 bloom_attenuation
469float saturate(float val) {return clamp(val,0.0,1.0);}void main() {float emission=v_color_emissive.a;float opacity=1.0;
470#ifdef HAS_ATTRIBUTE_a_bloom_attenuation
471float 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);
472#endif
473#ifdef RENDER_CUTOFF
474opacity*=v_cutoff_opacity;
475#endif
476glFragColor=vec4(v_color_emissive.rgb,1.0)*opacity;}`,`in vec3 a_pos_3f;
477#pragma mapbox: define-attribute-vertex-shader-only highp uvec2 part_color_emissive
478#pragma mapbox: define-attribute highp vec4 bloom_attenuation
479out vec4 v_color_emissive;uniform mat4 u_matrix;vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}void main() {
480#pragma mapbox: initialize-attribute-custom highp uvec2 part_color_emissive
481#pragma mapbox: initialize-attribute highp vec4 bloom_attenuation
482#ifdef HAS_ATTRIBUTE_a_part_color_emissive
483vec4 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);
484#else
485v_color_emissive=vec4(1.0);
486#endif
487gl_Position=u_matrix*vec4(a_pos_3f,1.0);
488#ifdef RENDER_CUTOFF
489v_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z);
490#endif
491}`),buildingDepth:Lt("void main() {}","in vec3 a_pos_3f;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos_3f,1.0);}"),circle:Lt
vendor: 7,212 bytes, lines 491-617
491(`#include "_prelude_fog.fragment.glsl"
492#include "_prelude_lighting.glsl"
493in vec3 v_data;in float v_visibility;
494#pragma mapbox: define highp vec4 color
495#pragma mapbox: define mediump float radius
496#pragma mapbox: define lowp float blur
497#pragma mapbox: define lowp float opacity
498#pragma mapbox: define highp vec4 stroke_color
499#pragma mapbox: define mediump float stroke_width
500#pragma mapbox: define lowp float stroke_opacity
501uniform float u_emissive_strength;void main() {
502#pragma mapbox: initialize highp vec4 color
503#pragma mapbox: initialize mediump float radius
504#pragma mapbox: initialize lowp float blur
505#pragma mapbox: initialize lowp float opacity
506#pragma mapbox: initialize highp vec4 stroke_color
507#pragma mapbox: initialize mediump float stroke_width
508#pragma mapbox: initialize lowp float stroke_opacity
509vec2 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 ? 
510smoothstep(0.0,-antialiased_blur,1.0-extrude_length) : 
511smoothstep(antialiased_blur,0.0,extrude_length-1.0)-antialiase_blur_opacity;float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(
512antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width)
513);vec4 out_color=mix(color*opacity,stroke_color*stroke_opacity,color_t);
514#ifdef LIGHTING_3D_MODE
515out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);
516#endif
517#ifdef FOG
518out_color=fog_apply_premultiplied(out_color,v_fog_pos);
519#endif
520glFragColor=out_color*(v_visibility*opacity_t);
521#ifdef OVERDRAW_INSPECTOR
522glFragColor=vec4(1.0);
523#endif
524}`,`#include "_prelude_fog.vertex.glsl"
525#include "_prelude_terrain.vertex.glsl"
526#define NUM_VISIBILITY_RINGS 2
527#define INV_SQRT2 0.70710678
528#define ELEVATION_BIAS 0.0001
529#define NUM_SAMPLES_PER_RING 16
530uniform 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;
531#ifdef PROJECTION_GLOBE_VIEW
532in 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;
533#endif
534#ifdef ELEVATED_ROADS
535in float a_circle_z_offset;
536#endif
537out vec3 v_data;out float v_visibility;
538#pragma mapbox: define highp vec4 color
539#pragma mapbox: define mediump float radius
540#pragma mapbox: define lowp float blur
541#pragma mapbox: define lowp float opacity
542#pragma mapbox: define highp vec4 stroke_color
543#pragma mapbox: define mediump float stroke_width
544#pragma mapbox: define lowp float stroke_opacity
545vec2 calc_offset(vec2 extrusion,float radius,float stroke_width, float view_scale) {return extrusion*(radius+stroke_width)*u_extrude_scale*view_scale;}float cantilevered_elevation(vec2 pos,float radius,float stroke_width,float view_scale) {vec2 c1=pos+calc_offset(vec2(-1.0,-1.0),radius,stroke_width,view_scale);vec2 c2=pos+calc_offset(vec2(1.0,-1.0),radius,stroke_width,view_scale);vec2 c3=pos+calc_offset(vec2(1.0,1.0),radius,stroke_width,view_scale);vec2 c4=pos+calc_offset(vec2(-1.0,1.0),radius,stroke_width,view_scale);float h1=elevation(c1)+ELEVATION_BIAS;float h2=elevation(c2)+ELEVATION_BIAS;float h3=elevation(c3)+ELEVATION_BIAS;float h4=elevation(c4)+ELEVATION_BIAS;return max(h4,max(h3,max(h1,h2)));}float circle_elevation(vec2 pos) {
546#if defined(TERRAIN)
547return elevation(pos)+ELEVATION_BIAS;
548#else
549return 0.0;
550#endif
551}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);
552#ifdef PITCH_WITH_MAP
553#ifdef PROJECTION_GLOBE_VIEW
554return u_matrix*( world_center+vec4(sample_offset.x*surface_vectors[0]+sample_offset.y*surface_vectors[1],0) );
555#else
556return u_matrix*( world_center+vec4(sample_offset,0,0) );
557#endif
558#else
559return projected_center+vec4(sample_offset,0,0);
560#endif
561}float get_sample_step() {
562#ifdef PITCH_WITH_MAP
563return 2.0*PI/float(NUM_SAMPLES_PER_RING);
564#else
565return PI/float(NUM_SAMPLES_PER_RING);
566#endif
567}void main() {
568#pragma mapbox: initialize highp vec4 color
569#pragma mapbox: initialize mediump float radius
570#pragma mapbox: initialize lowp float blur
571#pragma mapbox: initialize lowp float opacity
572#pragma mapbox: initialize highp vec4 stroke_color
573#pragma mapbox: initialize mediump float stroke_width
574#pragma mapbox: initialize lowp float stroke_opacity
575vec2 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;
576#ifdef PROJECTION_GLOBE_VIEW
577surface_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);
578#else 
579surface_vectors=mat3(1.0);world_center=vec4(circle_center,height,1);
580#endif
581#ifdef ELEVATED_ROADS
582world_center.z+=a_circle_z_offset+ELEVATION_BIAS;
583#endif
584vec4 projected_center=u_matrix*world_center;float view_scale=0.0;
585#ifdef PITCH_WITH_MAP
586#ifdef SCALE_WITH_MAP
587view_scale=1.0;
588#else
589view_scale=projected_center.w/u_camera_to_center_distance;
590#endif
591#else
592#ifdef SCALE_WITH_MAP
593view_scale=u_camera_to_center_distance;
594#else
595view_scale=projected_center.w;
596#endif
597#endif
598gl_Position=project_vertex(extrude,world_center,projected_center,radius,stroke_width,view_scale,surface_vectors);float visibility=0.0;
599#ifdef TERRAIN
600float step=get_sample_step();vec4 occlusion_world_center;vec4 occlusion_projected_center;
601#ifdef PITCH_WITH_MAP
602float 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;
603#else
604occlusion_world_center=world_center;occlusion_projected_center=projected_center;
605#endif
606for(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);
607#else
608visibility=1.0;
609#endif
610#ifdef PROJECTION_GLOBE_VIEW
611visibility=1.0;
612#endif
613v_visibility=visibility;lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);
614#ifdef FOG
615v_fog_pos=fog_position(world_center.xyz);
616#endif
617}`),clippingMask:
617Lt("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:Lt(`#include "_prelude_fog.fragment.glsl"
618uniform highp float u_intensity;in vec2 v_extrude;
619#pragma mapbox: define highp float weight
620#define GAUSS_COEF 0.3989422804014327
621void main() {
622#pragma mapbox: initialize highp float weight
623float 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);
624#ifdef FOG
625if (u_is_globe==0) {glFragColor.r*=pow(1.0-fog_opacity(v_fog_pos),2.0);}
626#endif
627#ifdef OVERDRAW_INSPECTOR
628glFragColor=vec4(1.0);
629#endif
630HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_terrain.vertex.glsl"
631#include "_prelude_fog.vertex.glsl"
632uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;in ivec2 a_pos;
633#ifdef PROJECTION_GLOBE_VIEW
634in 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;
635#endif
636out vec2 v_extrude;
637#pragma mapbox: define highp float weight
638#pragma mapbox: define mediump float radius
639const highp float ZERO=1.0/255.0/16.0;
640#define GAUSS_COEF 0.3989422804014327
641void main() {
642#pragma mapbox: initialize highp float weight
643#pragma mapbox: initialize mediump float radius
644vec2 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;
645#ifdef PROJECTION_GLOBE_VIEW
646vec3 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);
647#else
648pos=vec3(tilePos+extrude,elevation(tilePos));
649#endif
650gl_Position=u_matrix*vec4(pos,1);
651#ifdef FOG
652v_fog_pos=fog_position(pos);
653#endif
654}`),heatmapTexture:Lt(`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;
655#ifdef OVERDRAW_INSPECTOR
656glFragColor=vec4(0.0);
657#endif
658HANDLE_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:Lt("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"
659in 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;
660#ifdef PROJECTION_GLOBE_VIEW
661uniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform float u_zoom_transition;
662#endif
663out 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);
664#ifdef PROJECTION_GLOBE_VIEW
665#ifndef PROJECTED_POS_ON_VIEWPORT
666vec3 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);
667#endif
668#endif
669vec4 projectedPoint=u_matrix*vec4(proj_pos,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(
6700.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:Lt("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(
671mix(-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(
6720.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:Lt("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"
673in ivec2 a_pos;
674#ifdef PROJECTION_GLOBE_VIEW
675in ivec4 a_pos_3;
676#endif
677out 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;
678#ifdef PROJECTION_GLOBE_VIEW
679gl_Position=u_matrix*vec4(vec3(a_pos_3)+elevationVector(pos)*h,1);
680#else
681gl_Position=u_matrix*vec4(pos*u_overlay_scale,h,1);
682#endif
683}`),elevatedStructuresDepth:Lt("void main() {}","in ivec2 a_pos;in float a_height;uniform mat4 u_matrix;uniform float u_depth_bias;void main() {gl_Position=u_matrix*vec4(a_pos,a_height,1);gl_Position.z=gl_Position.z+u_depth_bias;}"),elevatedStructuresDepthReconstruct:Lt(`#ifdef DEPTH_RECONSTRUCTION
684in float v_height;
685#endif
686void main() {
687#ifdef DEPTH_RECONSTRUCTION
688if (v_height >=0.0)
689discard;
690#else
691#ifdef FEATURE_CUTOUT
692apply_feature_cutout(vec4(0.0,0.0,0.0,1.0),gl_FragCoord,get_cutout_factors(gl_FragCoord).x);
693#endif
694#endif
695glFragColor=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;
696#ifdef DEPTH_RECONSTRUCTION
697out float v_height;
698#endif
699void main() {vec3 vpos=vec3(a_pos,a_height*u_height_scale);
700#ifdef DEPTH_RECONSTRUCTION
701if (u_camera_pos.z > vpos.z) {vpos-=(u_camera_pos-vpos)*(vpos.z/(u_camera_pos.z-vpos.z));}v_height=a_height;
702#endif
703gl_Position=u_matrix*vec4(vpos,1);gl_Position.z=u_reset_depth==1.0 ? gl_Position.w : gl_Position.z+u_depth_bias;}`),elevatedStructures:Lt(`#include "_prelude_fog.fragment.glsl"
704#include "_prelude_lighting.glsl"
705#include "_prelude_shadow.fragment.glsl"
706in vec3 v_normal;in float v_height;
707#ifdef RENDER_SHADOWS
708in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in float v_depth;
709#endif
710vec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}
710vec3 compute_view_dependent_emissive_color(float ndotl,float emissive_strength,vec3 color)
711{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;
712#pragma mapbox: define highp vec4 structure_color
713void main() {
714#pragma mapbox: initialize highp vec4 structure_color
715vec3 color=structure_color.xyz;vec2 cutout_factors=vec2(0.0);
716#ifdef FEATURE_CUTOUT
717cutout_factors=get_cutout_factors(gl_FragCoord);
718#endif
719#ifdef LIGHTING_3D_MODE
720vec3 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);
721#ifdef RENDER_SHADOWS
722float 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);
723#else
724color=apply_lighting(color,transformed_normal);
725#endif
726color=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);}
727#endif
728#ifdef FOG
729color=fog_apply(color,v_fog_pos);
730#endif
731vec4 out_color=vec4(color,1.0);
732#ifdef INDICATOR_CUTOUT
733out_color=applyCutout(out_color,v_height);
734#endif
735#ifdef FEATURE_CUTOUT
736out_color=apply_feature_cutout(out_color,gl_FragCoord,cutout_factors.x);
737#endif
738glFragColor=out_color;HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
739#include "_prelude_shadow.vertex.glsl"
740in 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;
741#ifdef RENDER_SHADOWS
742uniform 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;
743#endif
744#pragma mapbox: define highp vec4 structure_color
745void main() {
746#pragma mapbox: initialize highp vec4 structure_color
747v_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);
748#ifdef RENDER_SHADOWS
749vec3 shd_pos0=pos;vec3 shd_pos1=pos;
750#ifdef NORMAL_OFFSET
751vec3 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();
752#endif
753v_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;
754#endif
755#ifdef FOG
756v_fog_pos=fog_position(vec2(a_pos));
757#endif
758}`),fill:Lt(`#include "_prelude_fog.fragment.glsl"
759#include "_prelude_lighting.glsl"
760#include "_prelude_shadow.fragment.glsl"
761#pragma mapbox: define highp vec4 color
762#pragma mapbox: define lowp float opacity
763uniform float u_emissive_strength;
764#ifdef RENDER_SHADOWS
765uniform 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;
766#endif
767#ifdef ELEVATED_ROADS
768in highp float v_road_z_offset;
769#endif
770#ifdef INDICATOR_CUTOUT
771in highp float v_z_offset;
772#endif
773void main() {
774#pragma mapbox: initialize highp vec4 color
775#pragma mapbox: initialize lowp float opacity
776vec2 cutout_factors=vec2(0.0);
777#ifdef FEATURE_CUTOUT
778cutout_factors=get_cutout_factors(gl_FragCoord);
779#endif
780vec4 out_color=color;
781#ifdef LIGHTING_3D_MODE
782out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);
783#ifdef RENDER_SHADOWS
784float 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);
785#endif
786#endif
787#ifdef FOG
788out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
789#endif
790out_color*=opacity;
791#ifdef INDICATOR_CUTOUT
792if (v_z_offset >=0.0) {out_color=applyCutout(out_color,v_z_offset);}
793#endif
794#ifdef FEATURE_CUTOUT
795out_color=apply_feature_cutout(out_color,gl_FragCoord,cutout_factors.x);
796#endif
797glFragColor=out_color;
798#ifdef USE_MRT1
799out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);
800#endif
801#ifdef OVERDRAW_INSPECTOR
802glFragColor=vec4(1.0);
803#endif
804HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
805#include "_prelude_shadow.vertex.glsl"
806in ivec2 a_pos;
807#ifdef ELEVATED_ROADS
808in float a_road_z_offset;out highp float v_road_z_offset;
809#endif
810#ifdef RENDER_SHADOWS
811uniform 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;
812#endif
813#ifdef INDICATOR_CUTOUT
814out highp float v_z_offset;
815#endif
816uniform mat4 u_matrix;
817#pragma mapbox: define highp vec4 color
818#pragma mapbox: define lowp float opacity
819#pragma mapbox: define highp float z_offset
820void main() {
821#pragma mapbox: initialize highp vec4 color
822#pragma mapbox: initialize lowp float opacity
823#pragma mapbox: initialize highp float z_offset
824#ifdef ELEVATED_ROADS
825z_offset+=a_road_z_offset;v_road_z_offset=z_offset;
826#endif
827float hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);
828#ifdef RENDER_SHADOWS
829vec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset);
830#ifdef NORMAL_OFFSET
831vec3 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();
832#endif
833v_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;
834#endif
835#ifdef FOG
836v_fog_pos=fog_position(vec2(a_pos));
837#endif
838#ifdef INDICATOR_CUTOUT
839v_z_offset=z_offset;
840#endif
841}`),fillOutline:Lt(`#include "_prelude_fog.fragment.glsl"
842#include "_prelude_lighting.glsl"
843#include "_prelude_shadow.fragment.glsl"
844in highp vec2 v_pos;uniform float u_emissive_strength;
845#ifdef RENDER_SHADOWS
846uniform 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;
847#endif
848#pragma mapbox: define highp vec4 outline_color
849#pragma mapbox: define lowp float opacity
850void main() {
851#pragma mapbox: initialize highp vec4 outline_color
852#pragma mapbox: initialize lowp float opacity
853float 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);
854#ifdef FEATURE_CUTOUT
855cutout_factors=get_cutout_factors(gl_FragCoord);
856#endif
857#ifdef LIGHTING_3D_MODE
858out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);
859#ifdef RENDER_SHADOWS
860float 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);
861#endif
862#endif
863#ifdef FOG
864out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
865#endif
866#ifdef FEATURE_CUTOUT
867out_color=apply_feature_cutout(out_color,gl_FragCoord,cutout_factors.x);
868#endif
869glFragColor=out_color*(alpha*opacity);
870#ifdef USE_MRT1
871out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);
872#endif
873#ifdef OVERDRAW_INSPECTOR
874glFragColor=vec4(1.0);
875#endif
876HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
877#include "_prelude_shadow.vertex.glsl"
878in ivec2 a_pos;
879#ifdef ELEVATED_ROADS
880in float a_road_z_offset;
881#endif
882#ifdef RENDER_SHADOWS
883uniform 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;
884#endif
885uniform mat4 u_matrix;uniform vec2 u_world;out highp vec2 v_pos;
886#pragma mapbox: define highp vec4 outline_color
887#pragma mapbox: define lowp float opacity
888#pragma mapbox: define highp float z_offset
889void main() {
890#pragma mapbox: initialize highp vec4 outline_color
891#pragma mapbox: initialize lowp float opacity
892#pragma mapbox: initialize highp float z_offset
893#ifdef ELEVATED_ROADS
894z_offset+=a_road_z_offset;
895#endif
896float hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);
897#ifdef FLIP_Y
898v_pos=(vec2(gl_Position.x,-gl_Position.y)/gl_Position.w+1.0)/2.0*u_world;
899#else
900v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;
901#endif
902#ifdef RENDER_SHADOWS
903vec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset);
904#ifdef NORMAL_OFFSET
905vec3 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();
906#endif
907v_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;
908#endif
909#ifdef FOG
910v_fog_pos=fog_position(vec2(a_pos));
911#endif
912}`),fillOutlinePattern:Lt(`#include "_prelude_fog.fragment.glsl"
913#include "_prelude_lighting.glsl"
914#include "_prelude_shadow.fragment.glsl"
915uniform vec2 u_texsize;uniform sampler2D u_image;
916#ifdef FILL_PATTERN_TRANSITION
917uniform float u_pattern_transition;
918#endif
919uniform float u_emissive_strength;
920#ifdef APPLY_LUT_ON_GPU
921uniform highp sampler3D u_lutTexture;
922#endif
923#ifdef RENDER_SHADOWS
924uniform 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;
925#endif
926in highp vec2 v_pos;in highp vec2 v_pos_world;
927#pragma mapbox: define lowp float opacity
928#pragma mapbox: define lowp uvec4 pattern
929#ifdef FILL_PATTERN_TRANSITION
930#pragma mapbox: define mediump uvec4 pattern_b
931#endif
932void main() {
933#pragma mapbox: initialize lowp float opacity
934#pragma mapbox: initialize mediump uvec4 pattern
935#ifdef FILL_PATTERN_TRANSITION
936#pragma mapbox: initialize mediump uvec4 pattern_b
937#endif
938vec2 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);
939#ifdef APPLY_LUT_ON_GPU
940out_color=applyLUT(u_lutTexture,out_color);
941#endif
942#ifdef FILL_PATTERN_TRANSITION
943vec2 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;
944#endif
945vec2 cutout_factors=vec2(0.0);
946#ifdef FEATURE_CUTOUT
947cutout_factors=get_cutout_factors(gl_FragCoord);
948#endif
949#ifdef LIGHTING_3D_MODE
950out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);
951#ifdef RENDER_SHADOWS
952float 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);
953#endif
954#endif
955#ifdef FEATURE_CUTOUT
956out_color=apply_feature_cutout(out_color,gl_FragCoord,cutout_factors.x);
957#endif
958#ifdef FOG
959out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
960#endif
961glFragColor=out_color*(alpha*opacity);
962#ifdef USE_MRT1
963out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);
964#endif
965#ifdef OVERDRAW_INSPECTOR
966glFragColor=vec4(1.0);
967#endif
968HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
969#include "_prelude_shadow.vertex.glsl"
970uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in ivec2 a_pos;
971#ifdef ELEVATED_ROADS
972in float a_road_z_offset;
973#endif
974#ifdef RENDER_SHADOWS
975uniform 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;
976#endif
977out highp vec2 v_pos;out highp vec2 v_pos_world;
978#pragma mapbox: define lowp float opacity
979#pragma mapbox: define lowp uvec4 pattern
980#ifdef FILL_PATTERN_TRANSITION
981#pragma mapbox: define mediump uvec4 pattern_b
982#endif
983#pragma mapbox: define lowp float pixel_ratio
984#pragma mapbox: define highp float z_offset
985void main() {
986#pragma mapbox: initialize lowp float opacity
987#pragma mapbox: initialize mediump uvec4 pattern
988#ifdef FILL_PATTERN_TRANSITION
989#pragma mapbox: initialize mediump uvec4 pattern_b
990#endif
991#pragma mapbox: initialize lowp float pixel_ratio
992#pragma mapbox: initialize highp float z_offset
993vec2 pattern_tl=vec2(pattern.xy);vec2 pattern_br=vec2(pattern.zw);
994#ifdef ELEVATED_ROADS
995z_offset+=a_road_z_offset;
996#endif
997float 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);
998#ifdef FLIP_Y
999v_pos_world=(vec2(gl_Position.x,-gl_Position.y)/gl_Position.w+1.0)/2.0*u_world;
1000#else
1001v_pos_world=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;
1002#endif
1003#ifdef RENDER_SHADOWS
1004vec3 shd_pos0=vec3(pos,z_offset);vec3 shd_pos1=vec3(pos,z_offset);
1005#ifdef NORMAL_OFFSET
1006vec3 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();
1007#endif
1008v_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;
1009#endif
1010#ifdef FOG
1011v_fog_pos=fog_position(pos);
1012#endif
1013}`),fillPattern:Lt(`#include "_prelude_fog.fragment.glsl"
1014#include "_prelude_lighting.glsl"
1015#include "_prelude_shadow.fragment.glsl"
1016uniform vec2 u_texsize;uniform sampler2D u_image;
1017#ifdef FILL_PATTERN_TRANSITION
1018uniform float u_pattern_transition;
1019#endif
1020in highp vec2 v_pos;uniform float u_emissive_strength;
1021#ifdef RENDER_SHADOWS
1022uniform 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;
1023#endif
1024#ifdef ELEVATED_ROADS
1025in highp float v_road_z_offset;
1026#endif
1027#ifdef APPLY_LUT_ON_GPU
1028uniform highp sampler3D u_lutTexture;
1029#endif
1030#pragma mapbox: define lowp float opacity
1031#pragma mapbox: define lowp uvec4 pattern
1032#ifdef FILL_PATTERN_TRANSITION
1033#pragma mapbox: define mediump uvec4 pattern_b
1034#endif
1035void main() {
1036#pragma mapbox: initialize lowp float opacity
1037#pragma mapbox: initialize mediump uvec4 pattern
1038#ifdef FILL_PATTERN_TRANSITION
1039#pragma mapbox: initialize mediump uvec4 pattern_b
1040#endif
1041vec2 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);
1042#ifdef APPLY_LUT_ON_GPU
1043out_color=applyLUT(u_lutTexture,out_color);
1044#endif
1045#ifdef FILL_PATTERN_TRANSITION
1046vec2 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;
1047#endif
1048vec2 cutout_factors=vec2(0.0);
1049#ifdef FEATURE_CUTOUT
1050cutout_factors=get_cutout_factors(gl_FragCoord);
1051#endif
1052#ifdef LIGHTING_3D_MODE
1053out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);
1054#ifdef RENDER_SHADOWS
1055float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);light=mix(light,1.0,cutout_factors.y);
1056#ifdef ELEVATED_ROADS
1057out_color.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light);
1058#else
1059out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);
1060#endif
1061#endif
1062#endif
1063#ifdef FEATURE_CUTOUT
1064out_color=apply_feature_cutout(out_color,gl_FragCoord,cutout_factors.x);
1065#endif
1066#ifdef FOG
1067out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
1068#endif
1069glFragColor=out_color*opacity;
1070#ifdef USE_MRT1
1071out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);
1072#endif
1073#ifdef OVERDRAW_INSPECTOR
1074glFragColor=vec4(1.0);
1075#endif
1076HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
1077#include "_prelude_shadow.vertex.glsl"
1078uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in ivec2 a_pos;
1079#ifdef ELEVATED_ROADS
1080in float a_road_z_offset;out highp float v_road_z_offset;
1081#endif
1082#ifdef RENDER_SHADOWS
1083uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp floa
1083t v_depth;
1084#endif
1085out highp vec2 v_pos;
1086#pragma mapbox: define lowp float opacity
1087#pragma mapbox: define lowp uvec4 pattern
1088#ifdef FILL_PATTERN_TRANSITION
1089#pragma mapbox: define mediump uvec4 pattern_b
1090#endif
1091#pragma mapbox: define lowp float pixel_ratio
1092#pragma mapbox: define highp float z_offset
1093void main() {
1094#pragma mapbox: initialize lowp float opacity
1095#pragma mapbox: initialize mediump uvec4 pattern
1096#pragma mapbox: initialize lowp float pixel_ratio
1097#pragma mapbox: initialize highp float z_offset
1098#ifdef FILL_PATTERN_TRANSITION
1099#pragma mapbox: initialize mediump uvec4 pattern_b
1100#endif
1101vec2 pattern_tl=vec2(pattern.xy);vec2 pattern_br=vec2(pattern.zw);vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;
1102#ifdef ELEVATED_ROADS
1103z_offset+=a_road_z_offset;v_road_z_offset=z_offset;
1104#endif
1105float 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);
1106#ifdef RENDER_SHADOWS
1107vec3 shd_pos0=vec3(pos,z_offset);vec3 shd_pos1=vec3(pos,z_offset);
1108#ifdef NORMAL_OFFSET
1109vec3 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();
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);v_depth=gl_Position.w;
1112#endif
1113#ifdef FOG
1114v_fog_pos=fog_position(pos);
1115#endif
1116}`),lineBlendComposite:Lt(`uniform sampler2D u_image;uniform float u_opacity;uniform int u_blend_mode;in vec2 v_pos;
1117#define ADDITIVE 1
1118void main() {vec4 color=texture(u_image,v_pos);if (u_blend_mode==ADDITIVE) {if (color.a <=0.0) {discard;}float density=color.a;vec3 avgColor=color.rgb/max(density,0.001);float t=density/(1.0+density);glFragColor=vec4(avgColor*t*u_opacity,t*u_opacity);} else {vec3 multiplyFactor=color.rgb*u_opacity+(1.0-u_opacity);glFragColor=vec4(multiplyFactor,1.0);}
1119#ifdef OVERDRAW_INSPECTOR
1120glFragColor=vec4(0.0);
1121#endif
1122HANDLE_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;}"),fillExtrusion:Lt(`#include "_prelude_fog.fragment.glsl"
1123#include "_prelude_shadow.fragment.glsl"
1124#include "_prelude_lighting.glsl"
1125in vec4 v_color;in vec4 v_flat;
1126#ifdef RENDER_SHADOWS
1127in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;
1128#endif
1129uniform lowp float u_opacity;
1130#ifdef RENDER_FRONT_CUTOFF
1131in float v_front_cutoff_opacity;
1132#endif
1133#ifdef INDICATOR_CUTOUT
1134#ifdef FEATURE_CUTOUT
1135in vec4 v_ground_roof;
1136#endif
1137#endif
1138#ifdef FAUX_AO
1139uniform lowp vec2 u_ao;in vec2 v_ao;
1140#endif
1141#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)
1142in vec4 v_roof_color;
1143#endif
1144#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)
1145in highp vec3 v_normal;
1146#endif
1147uniform vec3 u_flood_light_color;uniform highp float u_vertical_scale;uniform float u_flood_light_intensity;uniform vec3 u_ground_shadow_factor;
1148#if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT)
1149in float v_flood_radius;in float v_has_floodlight;
1150#endif
1151in float v_height;
1152#pragma mapbox: define highp float emissive_strength
1153void main() {
1154#pragma mapbox: initialize highp float emissive_strength
1155#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)
1156vec3 normal=normalize(v_normal);
1157#endif
1158float z;vec4 color=v_color;
1159#ifdef ZERO_ROOF_RADIUS
1160z=float(normal.z > 0.00001);
1161#ifdef LIGHTING_3D_MODE
1162normal=mix(normal,vec3(0.0,0.0,1.0),z);
1163#else
1164color=mix(v_color,v_roof_color,z);
1165#endif
1166#endif
1167float h=max(0.0,v_height);float ao_shade=1.0;
1168#ifdef FAUX_AO
1169float 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;
1170#ifdef ZERO_ROOF_RADIUS
1171concave*=(1.0-z);
1172#endif
1173float 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);
1174#ifdef LIGHTING_3D_MODE
1175#ifdef FLOOD_LIGHT
1176color.rgb*=mix(ao_shade,1.0,v_has_floodlight);
1177#else
1178color.rgb*=ao_shade;
1179#endif
1180#else
1181color.rgb*=ao_shade;
1182#endif
1183#endif
1184#ifdef LIGHTING_3D_MODE
1185float flood_radiance=0.0;
1186#ifdef FLOOD_LIGHT
1187flood_radiance=(1.0-min(h/v_flood_radius,1.0))*u_flood_light_intensity*v_has_floodlight;
1188#endif
1189#ifdef RENDER_SHADOWS
1190#ifdef FLOOD_LIGHT
1191float 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);
1192#else
1193float shadowed_lighting_factor;
1194#ifdef RENDER_CUTOFF
1195shadowed_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;}
1196#else
1197shadowed_lighting_factor=shadowed_light_factor_normal(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);
1198#endif
1199color.rgb=apply_lighting(color.rgb,normal,shadowed_lighting_factor);
1200#endif
1201#else
1202color.rgb=apply_lighting(color.rgb,normal);
1203#ifdef FLOOD_LIGHT
1204color.rgb=mix(color.rgb,u_flood_light_color*u_opacity,flood_radiance);
1205#endif
1206#endif
1207color.rgb=mix(color.rgb,v_flat.rgb,emissive_strength);color*=u_opacity;
1208#endif
1209#ifdef FOG
1210color=fog_dither(fog_apply_premultiplied(color,v_fog_pos,h));
1211#endif
1212#ifdef INDICATOR_CUTOUT
1213#ifdef FEATURE_CUTOUT
1214{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;}}}
1215#else
1216color=applyCutout(color,h);
1217#endif
1218#endif
1219#ifdef RENDER_FRONT_CUTOFF
1220if (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;}}
1221#endif
1222#ifdef FEATURE_CUTOUT
1223color=apply_feature_cutout(color,gl_FragCoord,get_cutout_factors(gl_FragCoord).x);
1224#endif
1225glFragColor=color;
1226#ifdef OVERDRAW_INSPECTOR
1227glFragColor=vec4(1.0);
1228#endif
1229HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
1230#include "_prelude_terrain.vertex.glsl"
1231#include "_prelude_shadow.vertex.glsl"
1232#include "_prelude_lighting.glsl"
1233#include "_prelude_material_table.vertex.glsl"
1234uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform float u_edge_radius;uniform float u_width_scale;in ivec4 a_pos_normal_ed;
1235#if defined(HAS_CENTROID) || defined(TERRAIN)
1236in uvec2 a_centroid_pos;
1237#endif
1238#ifdef RENDER_WALL_MODE
1239in ivec4 a_join_normal_inside;
1240#endif
1241#ifdef PROJECTION_GLOBE_VIEW
1242in 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;
1243#endif
1244#ifdef TERRAIN
1245uniform int u_height_type;uniform int u_base_type;
1246#endif
1247uniform highp float u_vertical_scale;
1248#ifdef RENDER_FRONT_CUTOFF
1249uniform vec3 u_front_cutoff_params;out float v_front_cutoff_opacity;
1250#endif
1251out vec4 v_color;out vec4 v_flat;
1252#ifdef RENDER_SHADOWS
1253uniform 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;
1254#endif
1255#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)
1256out vec4 v_roof_color;
1257#endif
1258#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)
1259out highp vec3 v_normal;
1260#endif
1261#ifdef FAUX_AO
1262uniform lowp vec2 u_ao;out vec2 v_ao;
1263#endif
1264#if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT)
1265out float v_flood_radius;out float v_has_floodlight;
1266#endif
1267out float v_height;
1268#ifdef INDICATOR_CUTOUT
1269#ifdef FEATURE_CUTOUT
1270out vec4 v_ground_roof;
1271#endif
1272#endif
1273vec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}
1274#pragma mapbox: define highp float base
1275#pragma mapbox: define highp float height
1276#pragma mapbox: define highp vec4 color
1277#pragma mapbox: define highp float flood_light_wall_radius
1278#pragma mapbox: define highp float line_width
1279#pragma mapbox: define highp float emissive_strength
1280void main() {DECLARE_MATERIAL_TABLE_INFO
1281#pragma mapbox: initialize highp float base
1282#pragma mapbox: initialize highp float height
1283#pragma mapbox: initialize highp vec4 color
1284#pragma mapbox: initialize highp float flood_light_wall_radius
1285#pragma mapbox: initialize highp float line_width
1286#pragma mapbox: initialize highp float emissive_strength
1287base*=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));
1288#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)
1289v_normal=normal;
1290#endif
1291base=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);
1292#if defined(HAS_CENTROID) || defined(TERRAIN)
1293centroid_pos=vec2(a_centroid_pos);
1294#endif
1295float ele=0.0;float h=0.0;float c_ele=0.0;vec3 pos;
1296#ifdef TERRAIN
1297bool 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;
1297float 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;
1298#else
1299h=t > 0.0 ? height : base;
1300#endif
1301pos=vec3(pos_nx.xy,h);
1302#ifdef PROJECTION_GLOBE_VIEW
1303float 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);
1304#endif
1305float cutoff=1.0;vec3 scaled_pos=pos;
1306#if defined(RENDER_CUTOFF) || defined(RENDER_FRONT_CUTOFF)
1307vec2 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);}}
1308#endif
1309#if defined(RENDER_CUTOFF) || defined(RENDER_FRONT_CUTOFF)
1310vec4 ground=u_matrix*vec4(centroid_decoded,ele,1.0);
1311#endif
1312#ifdef RENDER_CUTOFF
1313#ifdef CLIP_ZERO_TO_ONE
1314cutoff=cutoff_opacity(u_cutoff_params,ground.z*2.0-ground.w);
1315#else
1316cutoff=cutoff_opacity(u_cutoff_params,ground.z);
1317#endif
1318if (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);
1319#endif
1320float hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (cutoff==0.0 && centroid_pos.x !=0.0) || (color.a==0.0));
1321#ifdef RENDER_FRONT_CUTOFF
1322v_front_cutoff_opacity=1.0;if (centroid_pos.x > 0.0 && centroid_pos.y > 0.0) {hidden=max(hidden,float(ground.w <=0.0));
1322float 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);}
1323#endif
1324#ifdef RENDER_WALL_MODE
1325vec3 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;
1326#endif
1327gl_Position=mix(u_matrix*vec4(scaled_pos,1),AWAY,hidden);h=h-ele;v_height=h;
1328#ifdef RENDER_SHADOWS
1329vec3 shd_pos0=pos;vec3 shd_pos1=pos;
1330#ifdef NORMAL_OFFSET
1331vec3 offset=shadow_normal_offset(normal);shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();
1332#endif
1333v_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);
1334#endif
1335float NdotL=0.0;float colorvalue=0.0;
1336#ifndef LIGHTING_3D_MODE
1337colorvalue=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*=(
1338(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));}
1339#endif
1340#ifdef FAUX_AO
1341float 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;
1342#ifdef TERRAIN
1343top_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(ce
1343ntroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height);
1344#endif
1345v_ao=vec2(mix(concave,-concave,start),y_ground);NdotL*=(1.0+0.05*(1.0-top_up_ny_start.y)*u_ao[0]);
1346#ifdef PROJECTION_GLOBE_VIEW
1347top_height+=u_height_lift;
1348#endif
1349gl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w;
1350#endif
1351#ifdef LIGHTING_3D_MODE
1352#ifdef FLOOD_LIGHT
1353float 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;
1354#endif
1355v_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);
1356#else
1357v_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;
1358#endif
1359#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)
1360float 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;
1361#endif
1362#ifdef FOG
1363v_fog_pos=fog_position(pos);
1364#endif
1365#ifdef INDICATOR_CUTOUT
1366#ifdef FEATURE_CUTOUT
1367vec4 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);
1368#endif
1369#endif
1370}`),fillExtrusionDepth:Lt("void main() {}",`#include "_prelude_terrain.vertex.glsl"
1371#include "_prelude_material_table.vertex.glsl"
1372uniform mat4 u_matrix;uniform float u_edge_radius;uniform float u_width_scale;uniform float u_vertical_scale;
1373#ifdef TERRAIN
1374uniform int u_height_type;uniform int u_base_type;
1375#endif
1376in ivec4 a_pos_normal_ed;
1377#if defined(HAS_CENTROID) || defined(TERRAIN)
1378in uvec2 a_centroid_pos;
1379#endif
1380#ifdef RENDER_WALL_MODE
1381in ivec4 a_join_normal_inside;
1382#endif
1383#pragma mapbox: define highp float base
1384#pragma mapbox: define highp float height
1385#pragma mapbox: define highp float line_width
1386#pragma mapbox: define highp vec4 color
1387void main() {DECLARE_MATERIAL_TABLE_INFO
1388#pragma mapbox: initialize highp float base
1389#pragma mapbox: initialize highp float height
1390#pragma mapbox: initialize highp float line_width
1391#pragma mapbox: initialize highp vec4 color
1392base*=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);
1393#if defined(HAS_CENTROID) || defined(TERRAIN)
1394centroid_pos=vec2(a_centroid_pos);
1395#endif
1396vec3 pos;
1397#ifdef TERRAIN
1398bool 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);
1399#else
1400pos=vec3(pos_nx.xy,t > 0.0 ? height : base);
1401#endif
1402#ifdef RENDER_WALL_MODE
1403vec3 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;
1404#endif
1405float hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (color.a==0.0));gl_Position=mix(u_matrix*vec4(pos,1),AWAY,hidden);}`),fillExtrusionPattern:Lt(`#include "_prelude_fog.fragment.glsl"
1406#include "_prelude_lighting.glsl"
1407uniform vec2 u_texsize;uniform sampler2D u_image;
1408#ifdef FILL_EXTRUSION_PATTERN_TRANSITION
1409uniform float u_pattern_transition;
1410#endif
1411#ifdef FAUX_AO
1412uniform lowp vec2 u_ao;in vec3 v_ao;
1413#endif
1414#ifdef LIGHTING_3D_MODE
1415in vec3 v_normal;
1416#endif
1417#ifdef APPLY_LUT_ON_GPU
1418uniform highp sampler3D u_lutTexture;
1419#endif
1420in highp vec2 v_pos;in vec4 v_lighting;uniform lowp float u_opacity;
1421#pragma mapbox: define highp float base
1422#pragma mapbox: define highp float height
1423#pragma mapbox: define mediump uvec4 pattern
1424#ifdef FILL_EXTRUSION_PATTERN_TRANSITION
1425#pragma mapbox: define mediump uvec4 pattern_b
1426#endif
1427#pragma mapbox: define highp float pixel_ratio
1428void main() {
1429#pragma mapbox: initialize highp float base
1430#pragma mapbox: initialize highp float height
1431#pragma mapbox: initialize mediump uvec4 pattern
1432#ifdef FILL_EXTRUSION_PATTERN_TRANSITION
1433#pragma mapbox: initialize mediump uvec4 pattern_b
1434#endif
1435#pragma mapbox: initialize highp float pixel_ratio
1436vec2 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);
1437#ifdef APPLY_LUT_ON_GPU
1438out_color=applyLUT(u_lutTexture,out_color);
1439#endif
1440#ifdef FILL_EXTRUSION_PATTERN_TRANSITION
1441vec2 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;
1442#endif
1443#ifdef LIGHTING_3D_MODE
1444out_color=apply_lighting(out_color,normalize(v_normal))*u_opacity;
1445#else
1446out_color=out_color*v_lighting;
1447#endif
1448#ifdef FAUX_AO
1449float 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
1449),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;
1450#endif
1451#ifdef FOG
1452out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
1453#endif
1454#ifdef INDICATOR_CUTOUT
1455out_color=applyCutout(out_color,height);
1456#endif
1457glFragColor=out_color;
1458#ifdef OVERDRAW_INSPECTOR
1459glFragColor=vec4(1.0);
1460#endif
1461HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
1462#include "_prelude_terrain.vertex.glsl"
1463#include "_prelude_lighting.glsl"
1464#include "_prelude_material_table.vertex.glsl"
1465uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform float u_tile_units_to_pixels;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform float u_width_scale;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;in ivec4 a_pos_normal_ed;
1466#if defined(HAS_CENTROID) || defined(TERRAIN)
1467in uvec2 a_centroid_pos;
1468#endif
1469#ifdef RENDER_WALL_MODE
1470in ivec4 a_join_normal_inside;
1471#endif
1472#ifdef PROJECTION_GLOBE_VIEW
1473in 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;
1474#endif
1475#ifdef TERRAIN
1476uniform int u_height_type;uniform int u_base_type;
1477#endif
1478out highp vec2 v_pos;out vec4 v_lighting;
1479#ifdef FAUX_AO
1480uniform lowp vec2 u_ao;out vec3 v_ao;
1481#endif
1482#ifdef LIGHTING_3D_MODE
1483out vec3 v_normal;
1484#endif
1485#pragma mapbox: define highp float base
1486#pragma mapbox: define highp float height
1487#pragma mapbox: define highp vec4 color
1488#pragma mapbox: define mediump uvec4 pattern
1489#ifdef FILL_EXTRUSION_PATTERN_TRANSITION
1490#pragma mapbox: define mediump uvec4 pattern_b
1491#endif
1492#pragma mapbox: define highp float pixel_ratio
1493#pragma mapbox: define highp float line_width
1494void main() {DECLARE_MATERIAL_TABLE_INFO
1495#pragma mapbox: initialize highp float base
1496#pragma mapbox: initialize highp float height
1497#pragma mapbox: initialize highp vec4 color
1498#pragma mapbox: initialize mediump uvec4 pattern
1499#ifdef FILL_EXTRUSION_PATTERN_TRANSITION
1500#pragma mapbox: initialize mediump uvec4 pattern_b
1501#endif
1502#pragma mapbox: initialize highp float pixel_ratio
1503#pragma mapbox: initialize highp float line_width
1504vec2 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);
1505#if defined(HAS_CENTROID) || defined(TERRAIN)
1506centroid_pos=vec2(a_centroid_pos);
1507#endif
1508float ele=0.0;float h=z;vec3 p;float c_ele;
1509#ifdef TERRAIN
1510bool 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);
1511#else
1512p=vec3(pos_nx.xy,z);
1513#endif
1514#ifdef PROJECTION_GLOBE_VIEW
1515float 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);
1516#endif
1517#ifdef RENDER_WALL_MODE
1518vec3 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;
1519#endif
1520float 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
1521? pos_nx.xy
1522: 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;
1523#ifdef LIGHTING_3D_MODE
1524NdotL=calculate_NdotL(normal);
1525#else
1526NdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),NdotL);
1527#endif
1528if (normal.y !=0.0) {float r=0.84;
1529#ifndef LIGHTING_3D_MODE
1530r=mix(0.7,0.98,1.0-u_lightintensity);
1531#endif
1532NdotL*=(
1533(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));}
1534#ifdef FAUX_AO
1535float 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;
1536#ifdef TERRAIN
1537top_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);
1538#endif
1539v_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]);
1540#ifdef PROJECTION_GLOBE_VIEW
1541top_height+=u_height_lift;
1542#endif
1543gl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w;
1544#endif
1545#ifdef LIGHTING_3D_MODE
1546v_normal=normal;
1547#else
1548v_lighting.rgb+=clamp(NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;
1549#endif
1550#ifdef FOG
1551v_fog_pos=fog_position(p);
1552#endif
1553}`),groundShadow:Lt(`#include "_prelude_shadow.fragment.glsl"
1554precision highp float;uniform vec3 u_ground_shadow_factor;in vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1;
1555#ifdef FOG
1556in float v_fog_opacity;
1557#endif
1558void 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);
1559#ifdef RENDER_CUTOFF
1560shadow=mix(vec3(1.0),shadow,cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w));
1561#endif
1562#ifdef FOG
1563shadow=mix(shadow,vec3(1.0),v_fog_opacity);
1564#endif
1565#ifdef INDICATOR_CUTOUT
1566shadow=mix(shadow,vec3(1.0),1.0-applyCutout(vec4(1.0),0.0).r);
1567#endif
1568#ifdef FEATURE_CUTOUT
1569shadow=mix(shadow,vec3(1.0),get_cutout_factors(gl_FragCoord).y);
1570#endif
1571glFragColor=vec4(shadow,1.0);}`,`#include "_prelude_fog.vertex.glsl"
1572uniform 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;
1573#ifdef FOG
1574out float v_fog_opacity;
1575#endif
1576void 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);
1577#ifdef FOG
1578v_fog_pos=fog_position(vec2(a_pos));v_fog_opacity=fog(v_fog_pos);
1579#endif
1580}`),fillExtrusionGroundEffect:Lt(`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;
1581#ifdef SDF_SUBPASS
1582in 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);}
1583#ifdef FOG
1584in highp float v_fog;
1585#endif
1586#endif
1587void main() {
1588#ifdef CLEAR_SUBPASS
1589vec4 color=vec4(1.0);
1590#ifdef CLEAR_FROM_TEXTURE
1591color=texture(u_fb,gl_FragCoord.xy/vec2(u_fb_size));
1592#endif
1593glFragColor=color;
1594#else
1595#ifdef SDF_SUBPASS
1596highp 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;
1597#ifdef FOG
1598fog=v_fog;
1599#endif
1600#ifdef RENDER_CUTOFF
1601fog*=v_cutoff_opacity;
1602#endif
1603glFragColor=vec4(vec3(0.0),mix(1.0,d,effect_intensity*u_opacity*fog));
1604#else
1605#ifdef USE_MRT1
1606out_Target1=vec4(1.0-texture(u_fb,gl_FragCoord.xy/vec2(u_fb_size)).a,0.0,0.0,0.0);
1607#else
1608vec4 color=mix(vec4(u_flood_light_color,1.0),vec4(vec3(0.0),1.0),u_ao_pass);
1609#ifdef OVERDRAW_INSPECTOR
1610color=vec4(1.0);
1611#endif
1612glFragColor=color;
1613#endif
1614#endif
1615HANDLE_WIREFRAME_DEBUG;
1616#endif
1617}`,`#include "_prelude_fog.vertex.glsl"
1618in highp ivec4 a_pos_end;in highp int a_angular_offset_factor;in highp uint a_hidden_by_landmark;
1619#ifdef SDF_SUBPASS
1620out highp vec2 v_pos;out highp vec4 v_line_segment;out highp float v_flood_light_radius_tile;out highp vec2 v_ao;
1621#ifdef FOG
1622out highp float v_fog;
1623#endif
1624#endif
1625uniform 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;
1626#pragma mapbox: define highp float flood_light_ground_radius
1627const float TANGENT_CUTOFF=4.0;const float NORM=32767.0;void main() {
1628#pragma mapbox: initialize highp float flood_light_ground_radius
1629vec4 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;
1630#ifdef SDF_SUBPASS
1631v_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);
1632#ifdef FOG
1633v_fog_pos=fog_position(pos);v_fog=1.0-fog(v_fog_pos);
1634#endif
1635#endif
1636float hidden_by_landmark=0.0;
1637#ifdef HAS_CENTROID
1638hidden_by_landmark=float(a_hidden_by_landmark);
1639#endif
1640float 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));
1641#ifdef RENDER_CUTOFF
1642v_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z);
1643#endif
1644}`),hillshadePrepare:Lt(`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(
1645(c+e+e+h)-(a+d+d+f),(f+g+g+h)-(a+b+b+c)
1646)/pow(2.0,exaggeration+(19.2562-u_zoom));glFragColor=clamp(vec4(
1647deriv.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:Lt(`#include "_prelude_fog.fragment.glsl"
1648#include "_prelude_lighting.glsl"
1649uniform 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;
1650#ifdef LIGHTING_3D_MODE
1651glFragColor=apply_lighting_with_emission_ground(glFragColor,u_emissive_strength);
1652#endif
1653#ifdef FOG
1654glFragColor=fog_dither(fog_apply_premultiplied(glFragColor,v_fog_pos));
1655#endif
1656#ifdef USE_MRT1
1657out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);
1658#endif
1659#ifdef OVERDRAW_INSPECTOR
1660glFragColor=vec4(1.0);
1661#endif
1662HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
1663uniform 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;
1664#ifdef FOG
1665v_fog_pos=fog_position(vec2(a_pos));
1666#endif
1667}`),line:Lt(`#include "_prelude_fog.fragment.glsl"
1668#include "_prelude_lighting.glsl"
1669#include "_prelude_shadow.fragment.glsl"
1670uniform lowp float u_device_pixel_ratio;uniform highp float u_width_scale;uniform highp float u_floor_width_scale;
1670uniform float u_alpha_discard_threshold;uniform highp vec2 u_trim_offset;uniform highp vec2 u_trim_fade_range;uniform highp vec2 u_trim_gradient_mix_range;uniform lowp vec4 u_trim_color;uniform bool u_emissive_in_shadows;in vec4 v_width2_dilute;in vec2 v_normal;in float v_gamma_scale;in highp vec3 v_uv;
1671#ifdef ELEVATED_ROADS
1672in highp float v_road_z_offset;
1673#endif
1674#ifdef VARIABLE_LINE_WIDTH
1675in float stub_side;
1676#endif
1677#ifdef RENDER_LINE_DASH
1678uniform sampler2D u_dash_image;in vec2 v_tex;
1679#endif
1680#ifdef RENDER_LINE_GRADIENT
1681uniform sampler2D u_gradient_image;
1682#endif
1683#ifdef INDICATOR_CUTOUT
1684in highp float v_z_offset;
1685#endif
1686#ifdef RENDER_SHADOWS
1687uniform 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;
1688#endif
1689float luminance(vec3 c) {return (c.r+c.r+c.b+c.g+c.g+c.g)*0.1667;}
1690#pragma mapbox: define highp vec4 color
1691#pragma mapbox: define lowp float floorwidth
1692#pragma mapbox: define mediump uvec4 dash
1693#pragma mapbox: define lowp float blur
1694#pragma mapbox: define lowp float opacity
1695#pragma mapbox: define mediump float side_z_offset
1696#pragma mapbox: define lowp float border_width
1697#pragma mapbox: define lowp vec4 border_color
1698#pragma mapbox: define lowp float emissive_strength
1699float linearstep(float edge0,float edge1,float x) {return  clamp((x-edge0)/(edge1-edge0),0.0,1.0);}void main() {
1700#pragma mapbox: initialize highp vec4 color
1701#pragma mapbox: initialize lowp float floorwidth
1702#pragma mapbox: initialize mediump uvec4 dash
1703#pragma mapbox: initialize lowp float blur
1704#pragma mapbox: initialize lowp float opacity
1705#pragma mapbox: initialize mediump float side_z_offset
1706#pragma mapbox: initialize lowp float border_width
1707#pragma mapbox: initialize lowp vec4 border_color
1708#pragma mapbox: initialize lowp float emissive_strength
1709float dist=length(v_normal)*v_width2_dilute.x;
1710#ifdef VARIABLE_LINE_WIDTH
1711blur=mix(blur,0.0,stub_side);
1712#endif
1713float 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);
1714#ifdef VARIABLE_LINE_WIDTH
1715alpha=mix(alpha,1.0,stub_side);
1716#endif
1717alpha=side_z_offset > 0.0 ? 1.0-alpha : alpha;
1718#ifdef RENDER_LINE_DASH
1719float sdfdist=texture(u_dash_image,v_tex).r;
1719float sdfgamma=1.0/(2.0*u_device_pixel_ratio)/float(dash.z);float scaled_floorwidth=(floorwidth*u_floor_width_scale);alpha*=linearstep(0.5-sdfgamma/scaled_floorwidth,0.5+sdfgamma/scaled_floorwidth,sdfdist);
1720#endif
1721highp vec4 out_color;
1722#ifdef RENDER_LINE_GRADIENT
1723out_color=texture(u_gradient_image,v_uv.xy);
1724#else
1725out_color=color;
1726#endif
1727float trim_alpha=1.0;
1728#ifdef RENDER_LINE_TRIM_OFFSET
1729highp 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;
1730#ifdef RENDER_LINE_GRADIENT
1731gradient_trim_color_mix_factor=smoothstep(u_trim_gradient_mix_range.x,u_trim_gradient_mix_range.y,line_progress);
1732#endif
1733highp 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;}
1734#endif
1735if (u_alpha_discard_threshold !=0.0) {if (alpha < u_alpha_discard_threshold) {discard;}}
1736#ifdef RENDER_LINE_BORDER
1737#ifndef VARIABLE_LINE_WIDTH
1738float edgeBlur=((border_width*u_width_scale)+1.0/u_device_pixel_ratio);float alpha2=clamp(min(dist-(v_width2_dilute.y-edgeBlur),v_width2_dilute.x-dist)/edgeBlur,0.0,1.0);if (alpha2 < 1.) {float smoothAlpha=smoothstep(0.6,1.0,alpha2);if (border_color.a==0.0) {float Y=(out_color.a > 0.01) ? luminance(out_color.rgb/out_color.a) : 1.;float adjustment=(Y > 0.) ? 0.5/Y : 0.45;if (out_color.a > 0.25 && Y < 0.25) {vec3 borderColor=(Y > 0.) ? out_color.rgb : vec3(1,1,1)*out_color.a;out_color.rgb=out_color.rgb+borderColor*(adjustment*(1.0-smoothAlpha));} else {out_color.rgb*=(0.6 +0.4*smoothAlpha);}} else {out_color=mix(border_color*trim_alpha,out_color,smoothAlpha);}out_color*=v_width2_dilute.w;}
1739#endif
1740#endif
1741vec2 cutout_factors=vec2(0.0);
1742#ifdef FEATURE_CUTOUT
1743cutout_factors=get_cutout_factors(gl_FragCoord);
1744#endif
1745#ifdef LIGHTING_3D_MODE
1746out_color=apply_lighting_with_emission_ground(out_color,emissive_strength);
1747#ifdef RENDER_SHADOWS
1748float 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;
1749#ifdef ELEVATED_ROADS
1750out_color.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light);
1751#else
1752out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);
1753#endif
1754#endif
1755#endif
1756#ifdef FOG
1757out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
1758#endif
1759out_color*=(alpha*diluted_opacity);
1760#ifdef LINE_BLEND_MULTIPLY
1761glFragColor=vec4(out_color.rgb+(1.0-out_color.a),1.0);HANDLE_WIREFRAME_DEBUG;return;
1762#endif
1763#ifdef INDICATOR_CUTOUT
1764out_color=applyCutout(out_color,v_z_offset);
1765#endif
1766#ifdef FEATURE_CUTOUT
1767out_color=apply_feature_cutout(out_color,gl_FragCoord,cutout_factors.x);
1768#endif
1769glFragColor=out_color;
1770#ifdef DUAL_SOURCE_BLENDING
1771glFragColorSrc1=vec4(vec3(0.0),emissive_strength);
1772#else
1773#ifdef USE_MRT1
1774out_Target1=vec4(emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);
1775#endif
1776#endif
1777#ifdef OVERDRAW_INSPECTOR
1778glFragColor=vec4(1.0);
1779#endif
1780HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
1781#include "_prelude_shadow.vertex.glsl"
1782#include "_prelude_terrain.vertex.glsl"
1783#define EXTRUDE_SCALE 0.015873016
1784in ivec2 a_pos_normal;in uvec4 a_data;
1785#if defined(ELEVATED) || defined(ELEVATED_ROADS) || defined(VARIABLE_LINE_WIDTH)
1786in vec3 a_z_offset_width;
1787#endif
1788#ifdef ELEVATION_GROUND_SCALE
1789in float a_elevation_ground_scale;
1790#endif
1791#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET) || defined(RENDER_LINE_CURVE)
1792in highp vec3 a_packed;
1793#endif
1794#ifdef RENDER_LINE_DASH
1795in float a_linesofar;
1796#endif
1797uniform 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 highp float u_floor_width_scale;
1798#ifdef RENDER_LINE_CURVE
1799uniform mat3 u_curve_points_x;uniform mat3 u_curve_points_y;uniform mat3 u_curve_points_z;uniform float u_curve_point_count;
1800#endif
1801#ifdef ELEVATED
1802uniform lowp float u_zbias_factor;uniform lowp float u_tile_to_meter;float sample_elevation(vec2 apos) {
1803#ifdef ELEVATION_REFERENCE_SEA
1804return 0.0;
1805#else
1806return elevation(apos);
1807#endif
1808}
1809#endif
1810out vec2 v_normal;out vec4 v_width2_dilute;out float v_gamma_scale;out highp vec3 v_uv;
1811#ifdef ELEVATED_ROADS
1812out highp float v_road_z_offset;
1813#endif
1814#ifdef VARIABLE_LINE_WIDTH
1815out float stub_side;
1816#endif
1817#ifdef RENDER_LINE_DASH
1818uniform vec2 u_texsize;uniform float u_tile_units_to_pixels;out vec2 v_tex;
1819#endif
1820#ifdef RENDER_LINE_GRADIENT
1821uniform float u_image_height;
1822#endif
1823#ifdef INDICATOR_CUTOUT
1824out highp float v_z_offset;
1825#endif
1826#ifdef RENDER_SHADOWS
1827uniform 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;
1828#endif
1829#pragma mapbox: define highp vec4 color
1830#pragma mapbox: define lowp float floorwidth
1831#pragma mapbox: define mediump uvec4 dash
1832#pragma mapbox: define lowp float blur
1833#pragma mapbox: define lowp float opacity
1834#pragma mapbox: define mediump float gapwidth
1835#pragma mapbox: define lowp float offset
1836#pragma mapbox: define mediump float width
1837#pragma mapbox: define mediump float side_z_offset
1838#pragma mapbox: define lowp float border_width
1839#pragma mapbox: define lowp vec4 border_color
1840#pragma mapbox: define lowp float emissive_strength
1841#ifdef RENDER_LINE_CURVE
1842vec3 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
1842=t*t;float t3=t2*t;return 0.5*(
18432.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
1844);}vec2 catmullRomTangent(vec2 p0,vec2 p1,vec2 p2,vec2 p3,float t) {float t2=t*t;return 0.5*(
1845(-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
1846);}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;}
1847#endif
1848void main() {
1849#pragma mapbox: initialize highp vec4 color
1850#pragma mapbox: initialize lowp float floorwidth
1851#pragma mapbox: initialize mediump uvec4 dash
1852#pragma mapbox: initialize lowp float blur
1853#pragma mapbox: initialize lowp float opacity
1854#pragma mapbox: initialize mediump float gapwidth
1855#pragma mapbox: initialize lowp float offset
1856#pragma mapbox: initialize mediump float width
1857#pragma mapbox: initialize mediump float side_z_offset
1858#pragma mapbox: initialize lowp float border_width
1859#pragma mapbox: initialize lowp vec4 border_color
1860#pragma mapbox: initialize lowp float emissive_strength
1861float a_z_offset;
1862#if defined(ELEVATED) || defined(ELEVATED_ROADS)
1863a_z_offset=a_z_offset_width.x;
1864#endif
1865highp float line_progress=0.0;
1866#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET) || defined(RENDER_LINE_CURVE)
1867line_progress=a_packed[2];
1868#endif
1869float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=vec2(a_data.xy)-128.0;float a_direction=float(a_data.z & 3u)-1.0;vec2 pos_normal=vec2(a_pos_normal);vec2 pos=floor(pos_normal*0.5);mediump vec2 normal=pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;offset=-1.0*offset*u_width_scale;bool left=normal.y==1.0;
1870#ifdef RENDER_LINE_CURVE
1871CurveResult 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;
1872#endif
1873gapwidth=gapwidth/2.0;float halfwidth;float dilute_scale=1.0;float dilute_border_scale=1.0;
1874#ifdef VARIABLE_LINE_WIDTH
1875float left_width=a_z_offset_width.y;float right_width=a_z_offset_width.z;halfwidth=(u_width_scale*(left ? left_width : right_width))/2.0;if (side_z_offset !=0.0) {float left_f=step(1.0,normal.y);float is_negative=step(side_z_offset,0.0);float apply=mix(1.0-left_f,left_f,is_negative);a_extrude*=apply;a_z_offset+=abs(side_z_offset)*apply;v_normal*=left_f;}offset=border_width > 0.0 ? (left_width+right_width)*u_width_scale*0.5 : offset;halfwidth=border_width > 0.0 ? border_width*u_width_scale*0.5 : halfwidth;bool zero_right_width=border_width==0.0 && right_width==0.0;stub_side=zero_right_width ?-normal.y : 0.0;v_normal=!left && zero_right_width ? vec2(0.0) : v_normal;ANTIALIASING=!left && zero_right_width ? 0.0 : ANTIALIASING;
1876#else
1877halfwidth=(u_width_scale*width)/2.0;
1878#endif
1879float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*EXTRUDE_SCALE;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*EXTRUDE_SCALE*normal.y*mat2(t,-u,u,t);float hidden=float(opacity==0.0);vec2 extrude=dist*u_pixels_to_tile_units;
1879vec4 projected_extrude=u_matrix*vec4(extrude,0.0,0.0);vec2 projected_extrude_xy=projected_extrude.xy;
1880#ifdef ELEVATED_ROADS
1881v_road_z_offset=a_z_offset;gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,a_z_offset,1.0);
1882#else
1883#ifdef ELEVATED
1884vec2 offsetTile=offset2*u_pixels_to_tile_units;vec2 offset_pos=pos+offsetTile;float ele=0.0;float scaled_z_offset=a_z_offset;
1885#ifdef ELEVATION_GROUND_SCALE
1886scaled_z_offset=a_z_offset*mix(1.0,u_exaggeration,a_elevation_ground_scale);
1887#endif
1888#ifdef CROSS_SLOPE_VERTICAL
1889float 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);
1890#else
1891#ifdef CROSS_SLOPE_HORIZONTAL
1892float 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;
1893#else
1894float 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;
1895#endif
1896#endif
1897gl_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);
1898#else
1899gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0);
1900#endif
1901#endif
1902#ifndef ELEVATED
1903#ifndef VARIABLE_LINE_WIDTH
1904#ifndef RENDER_TO_TEXTURE
1905float 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 (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
1906{
1907#ifdef RENDER_LINE_BORDER
1908float 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);
1909#endif
1910}}
1911#endif
1912#endif
1913#ifdef ELEVATED_ROADS
1914gl_Position=gl_Position+projected_extrude;
1915#else
1916gl_Position=mix(gl_Position+projected_extrude,AWAY,hidden);
1917#endif
1918#endif
1919#ifdef ELEVATED_ROADS
1920#ifdef RENDER_SHADOWS
1921vec3 shd_pos=vec3(pos+(offset2+dist)*u_pixels_to_tile_units,a_z_offset);vec3 shd_pos0=shd_pos;vec3 shd_pos1=shd_pos;
1922#ifdef NORMAL_OFFSET
1923vec3 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();
1924#endif
1925v_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;
1926#endif
1927#endif
1928#ifndef RENDER_TO_TEXTURE
1929float 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));
1930#else
1931v_gamma_scale=1.0;
1932#endif
1933#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)
1934highp float a_uv_x=a_packed[0];float a_split_index=a_packed[1];
1935#ifdef RENDER_LINE_GRADIENT
1936highp 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);
1937#else
1938v_uv=vec3(a_uv_x,0.0,line_progress);
1939#endif
1940#endif
1941#ifdef RENDER_LINE_DASH
1942vec4 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);
1943#endif
1944v_width2_dilute=vec4(outset,inset,dilute_scale,dilute_border_scale);
1945#ifdef FOG
1946v_fog_pos=fog_position(pos);
1947#endif
1948#ifdef INDICATOR_CUTOUT
1949v_z_offset=a_z_offset;
1950#endif
1951}`),linePattern:Lt(`#include "_prelude_fog.fragment.glsl"
1952#include "_prelude_lighting.glsl"
1953#include "_prelude_shadow.fragment.glsl"
1954uniform highp float u_device_pixel_ratio;uniform highp float u_width_scale;
1954uniform highp float u_alpha_discard_threshold;uniform highp vec2 u_texsize;uniform highp float u_tile_units_to_pixels;uniform highp vec2 u_trim_offset;uniform highp vec2 u_trim_fade_range;uniform lowp vec4 u_trim_color;uniform sampler2D u_image;
1955#ifdef APPLY_LUT_ON_GPU
1956uniform highp sampler3D u_lutTexture;
1957#endif
1958#ifdef LINE_PATTERN_TRANSITION
1959uniform float u_pattern_transition;
1960#endif
1961in vec2 v_normal;in vec2 v_width2;in highp float v_linesofar;in float v_gamma_scale;in float v_width;
1962#ifdef RENDER_LINE_TRIM_OFFSET
1963in highp vec3 v_uv;
1964#endif
1965#ifdef ELEVATED_ROADS
1966in highp float v_road_z_offset;
1967#endif
1968#ifdef LINE_JOIN_NONE
1969in vec2 v_pattern_data;
1970#endif
1971#ifdef INDICATOR_CUTOUT
1972in highp float v_z_offset;
1973#endif
1974#ifdef RENDER_SHADOWS
1975uniform 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;
1976#endif
1977#pragma mapbox: define mediump uvec4 pattern
1978#ifdef LINE_PATTERN_TRANSITION
1979#pragma mapbox: define mediump uvec4 pattern_b
1980#endif
1981#pragma mapbox: define mediump float pixel_ratio
1982#pragma mapbox: define mediump float blur
1983#pragma mapbox: define mediump float opacity
1984#pragma mapbox: define lowp float emissive_strength
1985void main() {
1986#pragma mapbox: initialize mediump uvec4 pattern
1987#ifdef LINE_PATTERN_TRANSITION
1988#pragma mapbox: initialize mediump uvec4 pattern_b
1989#endif
1990#pragma mapbox: initialize mediump float pixel_ratio
1991#pragma mapbox: initialize mediump float blur
1992#pragma mapbox: initialize mediump float opacity
1993#pragma mapbox: initialize lowp float emissive_strength
1994vec2 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);
1995#ifdef APPLY_LUT_ON_GPU
1996color=applyLUT(u_lutTexture,color);
1997#endif
1998#ifdef LINE_PATTERN_TRANSITION
1999vec2 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;
2000#endif
2001#ifdef RENDER_LINE_TRIM_OFFSET
2002highp 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);}
2003#endif
2004#ifdef LINE_JOIN_NONE
2005highp 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);}
2006#endif
2007#ifdef LIGHTING_3D_MODE
2008color=apply_lighting_with_emission_ground(color,emissive_strength);
2009#ifdef RENDER_SHADOWS
2010float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);
2011#ifdef ELEVATED_ROADS
2012color.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light);
2013#else
2014color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);
2015#endif
2016#endif
2017#endif
2018#ifdef FOG
2019color=fog_dither(fog_apply_premultiplied(color,v_fog_pos));
2020#endif
2021color*=(alpha*opacity);if (u_alpha_discard_threshold !=0.0) {if (color.a < u_alpha_discard_threshold) {discard;}}
2022#ifdef INDICATOR_CUTOUT
2023color=applyCutout(color,v_z_offset);
2024#endif
2025glFragColor=color;
2026#ifdef DUAL_SOURCE_BLENDING
2027glFragColorSrc1=vec4(vec3(0.0),emissive_strength);
2028#else
2029#ifdef USE_MRT1
2030out_Target1=vec4(emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);
2031#endif
2032#endif
2033#ifdef OVERDRAW_INSPECTOR
2034glFragColor=vec4(1.0);
2035#endif
2036HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
2037#include "_prelude_shadow.vertex.glsl"
2038#include "_prelude_terrain.vertex.glsl"
2039#define scale 0.015873016
2040in ivec2 a_pos_normal;in uvec4 a_data;
2041#if defined(ELEVATED) || defined(ELEVATED_ROADS)
2042in vec3 a_z_offset_width;
2043#endif
2044#ifdef ELEVATION_GROUND_SCALE
2045in float a_elevation_ground_scale;
2046#endif
2047#ifdef RENDER_LINE_TRIM_OFFSET
2048in highp vec3 a_packed;
2049#endif
2050in highp float a_linesofar;
2051#ifdef LINE_JOIN_NONE
2052in highp vec3 a_pattern_data;out vec2 v_pattern_data;
2053#endif
2054#ifdef INDICATOR_CUTOUT
2055out highp float v_z_offset;
2056#endif
2057uniform 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;
2058#ifdef ELEVATED
2059uniform lowp float u_zbias_factor;uniform lowp float u_tile_to_meter;float sample_elevation(vec2 apos) {
2060#ifdef ELEVATION_REFERENCE_SEA
2061return 0.0;
2062#else
2063return elevation(apos);
2064#endif
2065}
2066#endif
2067out vec2 v_normal;out vec2 v_width2;out highp float v_linesofar;out float v_gamma_scale;out float v_width;
2068#ifdef RENDER_LINE_TRIM_OFFSET
2069out highp vec3 v_uv;
2070#endif
2071#ifdef ELEVATED_ROADS
2072out highp float v_road_z_offset;
2073#endif
2074#ifdef RENDER_SHADOWS
2075uniform 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;
2076#endif
2077#pragma mapbox: define mediump float blur
2078#pragma mapbox: define mediump float opacity
2079#pragma mapbox: define mediump float offset
2080#pragma mapbox: define mediump float gapwidth
2081#pragma mapbox: define mediump float width
2082#pragma mapbox: define mediump float floorwidth
2083#pragma mapbox: define mediump uvec4 pattern
2084#ifdef LINE_PATTERN_TRANSITION
2085#pragma mapbox: define mediump uvec4 pattern_b
2086#endif
2087#pragma mapbox: define mediump float pixel_ratio
2088#pragma mapbox: define lowp float emissive_strength
2089void main() {
2090#pragma mapbox: initialize mediump float blur
2091#pragma mapbox: initialize mediump float opacity
2092#pragma mapbox: initialize mediump float offset
2093#pragma mapbox: initialize mediump float gapwidth
2094#pragma mapbox: initialize mediump float width
2095#pragma mapbox: initialize mediump float floorwidth
2096#pragma mapbox: initialize mediump uvec4 pattern
2097#ifdef LINE_PATTERN_TRANSITION
2098#pragma mapbox: initialize mediump uvec4 pattern_b
2099#endif
2100#pragma mapbox: initialize mediump float pixel_ratio
2101#pragma mapbox: initialize lowp float emissive_strength
2102float a_z_offset;
2103#if defined(ELEVATED) || defined(ELEVATED_ROADS)
2104a_z_offset=a_z_offset_width.x;
2105#endif
2106float 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;
2106vec4 projected_extrude=u_matrix*vec4(extrude,0.0,0.0);vec2 projected_extrude_xy=projected_extrude.xy;
2107#ifdef ELEVATED_ROADS
2108v_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;
2109#else
2110#ifdef ELEVATED
2111vec2 offsetTile=offset2*u_pixels_to_tile_units;vec2 offset_pos=pos+offsetTile;float ele=0.0;float scaled_z_offset=a_z_offset;
2112#ifdef ELEVATION_GROUND_SCALE
2113scaled_z_offset=a_z_offset*mix(1.0,u_exaggeration,a_elevation_ground_scale);
2114#endif
2115#ifdef CROSS_SLOPE_VERTICAL
2116float 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);
2117#else
2118#ifdef CROSS_SLOPE_HORIZONTAL
2119float 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;
2120#else
2121float 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;
2122#endif
2123#endif
2124gl_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);
2125#else
2126gl_Position=mix(u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude,AWAY,hidden);
2127#endif
2128#endif
2129#ifdef ELEVATED_ROADS
2130#ifdef RENDER_SHADOWS
2131vec3 shd_pos=vec3(pos+(offset2+dist)*u_pixels_to_tile_units,a_z_offset);vec3 shd_pos0=shd_pos;vec3 shd_pos1=shd_pos;
2132#ifdef NORMAL_OFFSET
2133vec3 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();
2134#endif
2135v_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;
2136#endif
2137#endif
2138#ifndef RENDER_TO_TEXTURE
2139float 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));
2140#else
2141v_gamma_scale=1.0;
2142#endif
2143#ifdef RENDER_LINE_TRIM_OFFSET
2144highp float a_uv_x=a_packed[0];highp float line_progress=a_packed[2];v_uv=vec3(a_uv_x,0.0,line_progress);
2145#endif
2146v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=(floorwidth*u_floor_width_scale);
2147#ifdef LINE_JOIN_NONE
2148v_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);
2149#endif
2150#ifdef FOG
2151v_fog_pos=fog_position(pos);
2152#endif
2153#ifdef INDICATOR_CUTOUT
2154v_z_offset=a_z_offset;
2155#endif
2156}`),raster:Lt(`#include "_prelude_fog.fragment.glsl"
2157#include "_prelude_lighting.glsl"
2158#include "_prelude_raster_array.glsl"
2159uniform 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;
2160#ifdef PROJECTION_GLOBE_VIEW
2161in float v_split_fade;
2162#endif
2163uniform 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;
2164#ifndef RASTER_ARRAY
2165uniform highp sampler2D u_image0;uniform sampler2D u_image1;
2166#endif
2167#ifdef RASTER_COLOR
2168uniform sampler2D u_color_ramp;uniform highp vec4 u_colorization_mix;uniform highp float u_colorization_offset;uniform vec2 u_texture_res;
2169#endif
2170void main() {vec4 color0,color1,color;vec2 value;
2171#ifdef RASTER_COLOR
2172#ifdef RASTER_ARRAY
2173#ifdef RASTER_ARRAY_LINEAR
2174value=mix(
2175raTexture2D_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
2176);
2177#else
2178value=mix(
2179raTexture2D_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
2180);
2181#endif
2182if (value.y > 0.0) value.x/=value.y;
2183#else
2184color=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);
2185#endif
2186color=texture(u_color_ramp,vec2(value.x,0.5));if (color.a > 0.0) color.rgb/=color.a;color.a*=value.y;
2187#else
2188color0=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);
2189#endif
2190color.a*=u_opacity;
2191#ifdef GLOBE_POLES
2192color.a*=1.0-smoothstep(0.0,0.05,u_zoom_transition);
2193#endif
2194vec3 rgb=color.rgb;rgb=vec3(
2195dot(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);
2196#ifdef LIGHTING_3D_MODE
2197out_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),u_emissive_strength).rgb;
2198#endif
2199#ifdef FOG
2200highp 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));
2201#endif
2202glFragColor=vec4(out_color*color.a,color.a);
2203#ifdef PROJECTION_GLOBE_VIEW
2204glFragColor*=mix(1.0,1.0-smoothstep(0.0,0.05,u_zoom_transition),smoothstep(0.8,0.9,v_split_fade));
2205#endif
2206#ifdef RENDER_CUTOFF
2207glFragColor=glFragColor*cutoff_opacity(u_cutoff_params,v_depth);
2208#endif
2209#ifdef OVERDRAW_INSPECTOR
2210glFragColor=vec4(1.0);
2211#endif
2212#ifdef USE_MRT1
2213out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);
2214#endif
2215HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
2216#include "_prelude_terrain.vertex.glsl"
2217uniform 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;
2218#ifdef ELEVATED
2219uniform lowp float u_zbias_factor;
2220#endif
2221#define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8
2222#ifdef GLOBE_POLES
2223in vec3 a_globe_pos;in vec2 a_uv;
2224#else
2225in ivec2 a_pos;in uvec2 a_texture_pos;
2226#endif
2227out vec2 v_pos0;out vec2 v_pos1;out float v_depth;
2228#ifdef PROJECTION_GLOBE_VIEW
2229out float v_split_fade;
2230#endif
2231void main() {vec2 uv;
2232#ifdef GLOBE_POLES
2233vec3 globe_pos=a_globe_pos;uv=a_uv;float ele=u_raster_elevation;
2234#ifdef ELEVATION_REFERENCE_GROUND
2235ele+=elevation(uv*EXTENT);
2236#endif
2237globe_pos+=normalize(globe_pos)*ele*GLOBE_UPSCALE;gl_Position=u_matrix*u_globe_matrix*vec4(globe_pos,1.0);
2238#ifdef FOG
2239v_fog_pos=fog_position((u_normalize_matrix*vec4(a_globe_pos,1.0)).xyz);
2240#endif
2241#else
2242vec4 world_pos;
2243#ifdef PROJECTION_GLOBE_VIEW
2244vec2 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]);  
2245float tiles=u_grid_matrix[0][2];
2245if (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;
2246#ifdef ELEVATION_REFERENCE_GROUND
2247ele+=elevation(uv*EXTENT)-decomposed_pos_and_skirt.z;
2248#endif
2249vec4 merc_world_pos=vec4(0.0);   
2250v_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);
2251#ifdef FOG
2252v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);
2253#endif
2254#else
2255float ele=0.0;vec2 decodedPos=vec2(a_pos);
2256#ifdef ELEVATION_REFERENCE_GROUND
2257vec3 decomposedPosAndSkirt=decomposeToPosAndSkirt(a_pos);float skirt=decomposedPosAndSkirt.z;decodedPos=decomposedPosAndSkirt.xy;uv=decodedPos/8192.0;ele=elevation(decodedPos)-skirt;
2258#else
2259uv=vec2(a_texture_pos)/8192.0;
2260#endif
2261world_pos=vec4(decodedPos,(u_raster_elevation+ele),1.0);
2262#ifdef FOG
2263v_fog_pos=fog_position(decodedPos);
2264#endif
2265#endif
2266float w=1.0+dot(uv*EXTENT,u_perspective_transform);gl_Position=u_matrix*world_pos*w;
2267#endif
2268v_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;
2269#ifdef ELEVATED
2270float 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);
2271#endif
2272#ifdef RENDER_CUTOFF
2273v_depth=gl_Position.z;
2274#endif
2275}`),rasterParticle:Lt(`#include "_prelude_fog.fragment.glsl"
2276#include "_prelude_lighting.glsl"
2277uniform 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;
2278#ifdef LIGHTING_3D_MODE
2279out_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),1.0).rgb;
2280#endif
2281#ifdef FOG
2282highp 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));
2283#endif
2284glFragColor=vec4(out_color*color.a,color.a);
2285#ifdef OVERDRAW_INSPECTOR
2286glFragColor=vec4(1.0);
2287#endif
2288HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
2289uniform 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;
2290#define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8
2291in ivec2 a_pos;in uvec2 a_texture_pos;out vec2 v_pos0;out vec2 v_pos1;void main() {float w=1.0;vec2 uv;
2292#ifdef PROJECTION_GLOBE_VIEW
2293vec3 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;
2294#ifdef FOG
2295v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);
2296#endif
2297#else
2298uv=vec2(a_texture_pos)/8192.0;
2298gl_Position=u_matrix*vec4(vec2(a_pos)*w,u_raster_elevation*w,w);
2299#ifdef FOG
2300v_fog_pos=fog_position(vec2(a_pos));
2301#endif
2302#endif
2303v_pos0=uv;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}`),rasterParticleDraw:Lt("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"
2304in 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(
2305mod(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:Lt("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:Lt(`#include "_prelude_raster_particle.glsl"
2306uniform 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(
2307linearstep(vec2(-u_particle_pos_offset),vec2(0),pos)*linearstep(vec2(1.0+u_particle_pos_offset),vec2(1),pos),vec2(4)
2308);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);}"),symbol:Lt(`#include "_prelude_lighting.glsl"
2309#include "_prelude_shadow.fragment.glsl"
2310#define SDF_PX 8.0
2311#define SDF 1.0
2312#define ICON 0.0
2313uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;uniform bool u_is_halo;uniform lowp float u_scale_factor;
2314#ifdef ICON_TRANSITION
2315uniform float u_icon_transition;
2316#endif
2317#ifdef COLOR_ADJUSTMENT
2318uniform mat4 u_color_adj_mat;
2319#endif
2320#ifdef INDICATOR_CUTOUT
2321in highp float v_z_offset;
2322#else
2323#ifdef RENDER_SHADOWS
2324in highp float v_z_offset;
2325#endif
2326#endif
2327in vec2 v_tex_a;
2328#ifdef ICON_TRANSITION
2329in vec2 v_tex_b;
2330#endif
2331in float v_draw_halo;in vec3 v_gamma_scale_size_fade_opacity;
2332#ifdef RENDER_TEXT_AND_SYMBOL
2333in float is_sdf;in vec2 v_tex_a_icon;
2334#endif
2335#ifdef RENDER_SHADOWS
2336uniform 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;
2337#endif
2338#ifdef APPLY_LUT_ON_GPU
2339uniform highp sampler3D u_lutTexture;
2340#endif
2341#ifdef USE_PAINT_PROPERTIES_UBO
2342in lowp float opacity;
2343#ifdef RENDER_SDF
2344in lowp vec4 fill_np_color;in lowp vec4 halo_np_color;in lowp float halo_width;in lowp float halo_blur;
2345#endif
2346#ifdef LIGHTING_3D_MODE
2347in lowp float emissive_strength;
2348#endif
2349#else
2350#pragma mapbox: define highp vec4 fill_color
2351#pragma mapbox: define highp vec4 halo_color
2352#pragma mapbox: define lowp float opacity
2353#pragma mapbox: define lowp float halo_width
2354#pragma mapbox: define lowp float halo_blur
2355#pragma mapbox: define lowp float emissive_strength
2356#endif
2357void main() {
2358#ifdef USE_PAINT_PROPERTIES_UBO
2359vec4 fill_color;vec4 halo_color;
2360#ifdef RENDER_SDF
2361fill_color=vec4(fill_np_color.rgb*fill_np_color.a,fill_np_color.a);halo_color=vec4(halo_np_color.rgb*halo_np_color.a,halo_np_color.a);
2362#endif
2363#else
2364#pragma mapbox: initialize highp vec4 fill_color
2365#pragma mapbox: initialize highp vec4 halo_color
2366#pragma mapbox: initialize lowp float opacity
2367#pragma mapbox: initialize lowp float halo_width
2368#pragma mapbox: initialize lowp float halo_blur
2369#pragma mapbox: initialize lowp float emissive_strength
2370#endif
2371vec4 out_color;float fade_opacity=v_gamma_scale_size_fade_opacity[2];
2372#ifdef RENDER_TEXT_AND_SYMBOL
2373if (is_sdf==ICON) {vec2 tex_icon=v_tex_a_icon;lowp float alpha=opacity*fade_opacity;
2373glFragColor=texture(u_texture_icon,tex_icon)*alpha;
2374#ifdef OVERDRAW_INSPECTOR
2375glFragColor=vec4(1.0);
2376#endif
2377return;}
2378#endif
2379vec2 cutout_factors=vec2(0.0);
2380#ifdef FEATURE_CUTOUT
2381cutout_factors=get_cutout_factors(gl_FragCoord);
2382#endif
2383#ifdef RENDER_SDF
2384float 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;
2385#else
2386#ifdef ICON_TRANSITION
2387vec4 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);
2388#else
2389out_color=texture(u_texture,v_tex_a);
2390#endif
2391#ifdef APPLY_LUT_ON_GPU
2392out_color=applyLUT(u_lutTexture,out_color);
2393#endif
2394#ifdef COLOR_ADJUSTMENT
2395out_color=u_color_adj_mat*out_color;
2396#endif
2397#endif
2398out_color*=opacity*fade_opacity;
2399#ifdef LIGHTING_3D_MODE
2400out_color=apply_lighting_with_emission_ground(out_color,emissive_strength);
2401#ifdef RENDER_SHADOWS
2402float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);light=mix(light,1.0,cutout_factors.y);
2403#ifdef TERRAIN
2404out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);
2405#else
2406out_color.rgb*=mix(v_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light);
2407#endif
2408#endif
2409#endif
2410#ifdef INDICATOR_CUTOUT
2411out_color=applyCutout(out_color,v_z_offset);
2412#endif
2413#ifdef FEATURE_CUTOUT
2414out_color=apply_feature_cutout(out_color,gl_FragCoord,cutout_factors.x);
2415#endif
2416glFragColor=out_color;
2417#ifdef OVERDRAW_INSPECTOR
2418glFragColor=vec4(1.0);
2419#endif
2420HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_terrain.vertex.glsl"
2421#include "_prelude_shadow.vertex.glsl"
2422#define USING_APPEARANCE 1.0
2423in ivec4 a_pos_offset;in uvec4 a_tex_size;in ivec4 a_pixeloffset;in vec4 a_projected_pos;in uint a_fade_opacity;
2424#ifdef Z_OFFSET
2425in float a_auto_z_offset;
2426#endif
2427#ifdef PROJECTION_GLOBE_VIEW
2428in ivec4 a_globe_anchor;in vec3 a_globe_normal;
2429#endif
2430#ifdef ICON_TRANSITION
2431in uvec2 a_texb;
2432#endif
2433#ifdef OCCLUSION_QUERIES
2434in float a_occlusion_query_opacity;
2435#endif
2436#ifdef ELEVATED_ROADS
2437in vec3 a_x_axis;in vec3 a_y_axis;uniform float u_normal_scale;
2438#endif
2439#ifdef INDICATOR_CUTOUT
2440out highp float v_z_offset;
2441#else
2442#ifdef RENDER_SHADOWS
2443out highp float v_z_offset;
2444#endif
2445#endif
2446uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_elevation_from_sea;uniform bool u_pitch_with_map;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec3 u_up_vector;uniform vec2 u_texsize_icon;uniform bool u_is_halo;
2447#ifdef PROJECTION_GLOBE_VIEW
2448uniform 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;
2449#endif
2450out vec2 v_tex_a;
2451#ifdef ICON_TRANSITION
2452out vec2 v_tex_b;
2453#endif
2454out float v_draw_halo;out vec3 v_gamma_scale_size_fade_opacity;
2455#ifdef RENDER_TEXT_AND_SYMBOL
2456out float is_sdf;out vec2 v_tex_a_icon;
2457#endif
2458#ifdef RENDER_SHADOWS
2459uniform 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;
2460#endif
2461#ifdef USE_PAINT_PROPERTIES_UBO
2462#ifndef MAX_UBO_SIZE_VEC4
2463#define MAX_UBO_SIZE_VEC4 1024u
2464#endif
2465#define SPP_HEADER_SIZE_VEC4 3u
2466#define DWORDS_PER_VEC4 4u
2467struct SymbolPaintProperties {vec4 fill_np_color;vec4 halo_np_color;float opacity;float halo_width;float halo_blur;float emissive_strength;float occlusion_opacity;float z_offset;vec2 translate;};struct PropertyType {bool isDataDriven;bool isZoomDependent;uint offsetDwords;};struct SymbolPropertyHeader {uint dataDrivenBlockSizeVec4;PropertyType fill_np_color;PropertyType halo_np_color;PropertyType opacity;PropertyType halo_width;PropertyType halo_blur;PropertyType emissive_strength;PropertyType occlusion_opacity;PropertyType z_offset;PropertyType translate;};uniform float u_zoom;uniform lowp vec4 u_spp_fill_np_color;uniform lowp vec4 u_spp_halo_np_color;uniform lowp float u_spp_opacity;uniform lowp float u_spp_halo_width;uniform lowp float u_spp_halo_blur;uniform lowp float u_spp_emissive_strength;uniform lowp float u_spp_occlusion_opacity;uniform lowp float u_spp_z_offset;uniform lowp vec2 u_spp_translate_rotation;in float a_feature_index;layout(std140) uniform SymbolPaintPropertiesHeaderUniform {uvec4 header[SPP_HEADER_SIZE_VEC4];} u_spp_header;layout(std140) uniform SymbolPaintPropertiesUniform {vec4 properties[MAX_UBO_SIZE_VEC4];} u_spp_properties;layout(std140) uniform SymbolPaintPropertiesIndexUniform {uvec4 block_indices[MAX_UBO_SIZE_VEC4];} u_spp_index;out lowp float opacity;
2468#ifdef RENDER_SDF
2469out lowp vec4 fill_np_color;out lowp vec4 halo_np_color;out lowp float halo_width;out lowp float halo_blur;
2470#endif
2471#ifdef LIGHTING_3D_MODE
2472out lowp float emissive_strength;
2473#endif
2474PropertyType getPropertyType(uint propertyIndex,uint dataDrivenMask,uint zoomDependentMask,uint offsetDwords) {PropertyType type;type.isDataDriven=(dataDrivenMask & (1u << propertyIndex)) !=0u;type.isZoomDependent=(zoomDependentMask & (1u << propertyIndex)) !=0u;type.offsetDwords=offsetDwords;return type;}SymbolPropertyHeader readSymbolPropertiesHeader() {SymbolPropertyHeader header;uint dataDrivenMask=u_spp_header.header[0][0];uint zoomDependentMask=u_spp_header.header[0][1];header.dataDrivenBlockSizeVec4=u_spp_header.header[0][2];header.fill_np_color       =getPropertyType(0u,dataDrivenMask,zoomDependentMask,u_spp_header.header[0][3]);header.halo_np_color       =getPropertyType(1u,dataDrivenMask,zoomDependentMask,u_spp_header.header[1][0]);header.opacity             =getPropertyType(2u,dataDrivenMask,zoomDependentMask,u_spp_header.header[1][1]);header.halo_width          =getPropertyType(3u,dataDrivenMask,zoomDependentMask,u_spp_header.header[1][2]);header.halo_blur           =getPropertyType(4u,dataDrivenMask,zoomDependentMask,u_spp_header.header[1][3]);header.emissive_strength   =getPropertyType(5u,dataDrivenMask,zoomDependentMask,u_spp_header.header[2][0]);header.occlusion_opacity   =getPropertyType(6u,dataDrivenMask,zoomDependentMask,u_spp_header.header[2][1]);header.z_offset            =getPropertyType(7u,dataDrivenMask,zoomDependentMask,u_spp_header.header[2][2]);header.translate           =getPropertyType(8u,dataDrivenMask,zoomDependentMask,u_spp_header.header[2][3]);return header;}uint uvec4At(uvec4 v,uint index) {return (index==0u) ? v.x :
2475(index==1u) ? v.y :
2476(index==2u) ? v.z : v.w;}float vec4At(vec4 v,uint index) {return (index==0u) ? v.x :
2477(index==1u) ? v.y :
2478(index==2u) ? v.z : v.w;}vec4 readVec4(uint baseOffsetVec4,uint propertyOffsetDwords) {return u_spp_properties.properties[baseOffsetVec4+propertyOffsetDwords/DWORDS_PER_VEC4];}float readFloat(vec4 slot,uint propertyOffsetDwords) {return slot[propertyOffsetDwords % DWORDS_PER_VEC4];}uint readUint(uvec4 slot,uint offset) {return slot[offset % DWORDS_PER_VEC4];}vec2 readVec2(vec4 slot,uint propertyOffsetDwords) {float x=vec4At(slot,propertyOffsetDwords % DWORDS_PER_VEC4);float y=vec4At(slot,propertyOffsetDwords % DWORDS_PER_VEC4+1u);return vec2(x,y);}uint getDataDrivenBlockOffsetVec4(uint dataDrivenBlockSizeVec4) {uint featureIndex=uint(a_feature_index);uvec4 slot=u_spp_index.block_indices[featureIndex/DWORDS_PER_VEC4];uint blockIndex=uvec4At(slot,featureIndex % DWORDS_PER_VEC4);return blockIndex*dataDrivenBlockSizeVec4;}vec4 readColorProperty(PropertyType propertyType,uint dataDrivenBlockSizeVec4) {uint blockOffsetVec4=getDataDrivenBlockOffsetVec4(dataDrivenBlockSizeVec4);vec4 color=readVec4(blockOffsetVec4,propertyType.offsetDwords);if (propertyType.isZoomDependent) {color=unpack_mix_color(color,u_zoom);} else {vec2 packedColor=readVec2(color,propertyType.offsetDwords);color=decode_color(packedColor);}return color;}vec2 readVec2Property(PropertyType propertyType,uint dataDrivenBlockSizeVec4) {uint blockOffsetVec4=getDataDrivenBlockOffsetVec4(dataDrivenBlockSizeVec4);vec4 slot=readVec4(blockOffsetVec4,propertyType.offsetDwords);if (propertyType.isZoomDependent) {vec2 minVal=slot.xy;vec2 maxVal=slot.zw;return mix(minVal,maxVal,u_zoom);}return readVec2(slot,propertyType.offsetDwords);}float readFloatProperty(PropertyType propertyType,uint dataDrivenBlockSizeVec4) {uint blockOffsetVec4=getDataDrivenBlockOffsetVec4(dataDrivenBlockSizeVec4);vec4 slot=readVec4(blockOffsetVec4,propertyType.offsetDwords);float value;if (propertyType.isZoomDependent) {vec2 packedValues=readVec2(slot,propertyType.offsetDwords);value=unpack_mix_vec2(packedValues,u_zoom);} else {value=readFloat(slot,propertyType.offsetDwords);}return value;}SymbolPaintProperties readSymbolPaintProperties() {SymbolPropertyHeader header=readSymbolPropertiesHeader();uint sizeVec4=header.dataDrivenBlockSizeVec4;SymbolPaintProperties props;props.fill_np_color       =header.fill_np_color.isDataDriven     ? readColorProperty(header.fill_np_color,sizeVec4)     : u_spp_fill_np_color;props.halo_np_color       =header.halo_np_color.isDataDriven     ? readColorProperty(header.halo_np_color,sizeVec4)     : u_spp_halo_np_color;props.opacity             =header.opacity.isDataDriven           ? readFloatProperty(header.opacity,sizeVec4)           : u_spp_opacity;props.halo_width          =header.halo_width.isDataDriven        ? readFloatProperty(header.halo_width,sizeVec4)        : u_spp_halo_width;props.halo_blur           =header.halo_blur.isDataDriven         ? readFloatProperty(header.halo_blur,sizeVec4)         : u_spp_halo_blur;props.emissive_strength   =header.emissive_strength.isDataDriven ? readFloatProperty(header.emissive_strength,sizeVec4) : u_spp_emissive_strength;props.occlusion_opacity   =header.occlusion_opacity.isDataDriven ? readFloatProperty(header.occlusion_opacity,sizeVec4) : u_spp_occlusion_opacity;props.z_offset            =header.z_offset.isDataDriven          ? readFloatProperty(header.z_offset,sizeVec4)          : u_spp_z_offset;props.translate           =header.translate.isDataDriven          ? readVec2Property(header.translate,sizeVec4)           : vec2(0.0);return props;}
2479#else
2480#pragma mapbox: define highp vec4 fill_color
2481#pragma mapbox: define highp vec4 halo_color
2482#pragma mapbox: define lowp float opacity
2483#pragma mapbox: define lowp float halo_width
2484#pragma mapbox: define lowp float halo_blur
2485#pragma mapbox: define lowp float emissive_strength
2486#pragma mapbox: define lowp float occlusion_opacity
2487#pragma mapbox: define lowp float z_offset
2488#endif
2489vec2 unpack_opacity(uint packedOpacity) {return vec2(float(packedOpacity/2u)/127.0,float(packedOpacity & 1u));}void main() {
2490#ifdef USE_PAINT_PROPERTIES_UBO
2491SymbolPaintProperties paint_properties=readSymbolPaintProperties();opacity=paint_properties.opacity;
2492#ifdef RENDER_SDF
2493fill_np_color=paint_properties.fill_np_color;halo_np_color=paint_properties.halo_np_color;halo_width=paint_properties.halo_width;halo_blur=paint_properties.halo_blur;
2494#endif
2495#ifdef LIGHTING_3D_MODE
2496emissive_strength=paint_properties.emissive_strength;
2497#endif
2498lowp float occlusion_opacity=paint_properties.occlusion_opacity;lowp float z_offset=paint_properties.z_offset;
2499#else
2500#pragma mapbox: initialize highp vec4 fill_color
2501#pragma mapbox: initialize highp vec4 halo_color
2502#pragma mapbox: initialize lowp float opacity
2503#pragma mapbox: initialize lowp float halo_width
2504#pragma mapbox: initialize lowp float halo_blur
2505#pragma mapbox: initialize lowp float emissive_strength
2506#pragma mapbox: initialize lowp float occlusion_opacity
2507#pragma mapbox: initialize lowp float z_offset
2508#endif
2509vec2 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);
2510#ifdef Z_OFFSET
2511e+=a_auto_z_offset;
2512#endif
2513vec3 h=elevationVector(tile_anchor)*e;float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;vec3 world_pos_globe;
2514#ifdef PROJECTION_GLOBE_VIEW
2515mercator_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;
2516#else
2517world_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0;
2518#endif
2519vec4 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 ?
2520camera_to_anchor_distance/u_camera_to_center_distance :
2521u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(
25220.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;
2523#ifdef PROJECTION_GLOBE_VIEW
2524vec3 displacement=vec3(a_globe_normal.z,0,-a_globe_normal.x);
2524offsetprojected_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;
2525#else
2526offsetprojected_point=u_matrix*vec4(tile_anchor+vec2(1,0),0,1);a=projected_point.xy/projected_point.w;
2527#endif
2528vec2 b=offsetprojected_point.xy/offsetprojected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos;
2529#ifdef PROJECTION_GLOBE_VIEW
2530#ifdef PROJECTED_POS_ON_VIEWPORT
2531projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xyz+h,1.0);
2532#else
2533vec3 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);    
2534#endif
2535#else
2536projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0);
2537#endif
2538highp 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);
2539#ifdef TERRAIN
2540#ifdef PITCH_WITH_MAP_TERRAIN
2541vec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);
2542#endif
2543#endif
2544#ifdef Z_OFFSET
2545z+=u_pitch_with_map ? a_auto_z_offset+z_offset : 0.0;
2546#else
2547z+=u_pitch_with_map ? z_offset : 0.0;
2548#endif
2549float 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));
2550#ifdef DEPTH_OCCLUSION
2551float depth_occlusion=occlusionFadeMultiSample(projected_point);float depth_occlusion_multplier=mix(occlusion_opacity,1.0,depth_occlusion);out_fade_opacity*=depth_occlusion_multplier;
2552#endif
2553#ifdef OCCLUSION_QUERIES
2554float occludedFadeMultiplier=mix(occlusion_opacity,1.0,a_occlusion_query_opacity);out_fade_opacity*=occludedFadeMultiplier;
2555#endif
2556#ifdef Z_TEST_OCCLUSION
2557out_fade_opacity*=occlusion_opacity;
2558#endif
2559float alpha=opacity*out_fade_opacity;float hidden=float(alpha==0.0 || projected_point.w <=0.0 || occlusion_fade==0.0);vec3 pos;
2560#ifdef PROJECTION_GLOBE_VIEW
2561vec3 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;
2562#else
2563#ifdef ELEVATED_ROADS
2564vec3 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;
2565#else
2566pos=vec3(projected_pos.xy/projected_pos.w+offset,z);
2567#endif
2568#endif
2569gl_Position=mix(u_coord_matrix*vec4(pos,1.0),AWAY,hidden);
2570#ifdef USE_PAINT_PROPERTIES_UBO
2571{vec2 tr=paint_properties.translate;vec2 rotated_tr=vec2(
2572u_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
2573);gl_Position.xy+=(u_coord_matrix*vec4(rotated_tr,0.0,0.0)).xy;}
2574#endif
2575float 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;
2576#ifdef RENDER_TEXT_AND_SYMBOL
2577is_sdf=a_size[0]-2.0*a_size_min;v_tex_a_icon=a_tex/u_texsize_icon;
2578#endif
2579#ifdef ICON_TRANSITION
2580v_tex_b=vec2(a_texb)/u_texsize;
2581#endif
2582#ifdef RENDER_SHADOWS
2583vec4 shd_pos=u_inv_matrix*vec4(pos,1.0);vec3 shd_pos0=shd_pos.xyz;vec3 shd_pos1=shd_pos.xyz;
2584#ifdef NORMAL_OFFSET
2585vec3 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();
2586#endif
2587v_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;
2588#endif
2589#ifdef INDICATOR_CUTOUT
2590v_z_offset=e;
2591#else
2592#ifdef RENDER_SHADOWS
2593v_z_offset=e;
2594#endif
2595#endif
2596}`),terrainRaster:Lt(`#include "_prelude_fog.fragment.glsl"
2597#include "_prelude_shadow.fragment.glsl"
2598#include "_prelude_lighting.glsl"
2599uniform sampler2D u_image0;
2600#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS
2601uniform sampler2D u_image1;uniform float u_emissive_texture_available;
2602#endif
2603in vec2 v_pos0;
2604#ifdef FOG
2605in float v_fog_opacity;
2606#endif
2607#ifdef RENDER_SHADOWS
2608in vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1;
2609#endif
2610uniform vec3 u_ground_shadow_factor;void main() {vec4 image_color=texture(u_image0,v_pos0);vec4 color;
2611#ifdef LIGHTING_3D_MODE
2612const vec3 normal=vec3(0.0,0.0,1.0);
2613#ifdef RENDER_SHADOWS
2614float cutoffOpacity=1.0;
2615#ifdef RENDER_CUTOFF
2616cutoffOpacity=cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w);
2617#endif
2618#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS
2619float 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;
2620#else
2621float 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));
2622#endif
2623#else
2624float lighting_factor=u_lighting_directional_dir.z;color=apply_lighting(image_color,normal,lighting_factor);
2625#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS
2626float 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;
2627#endif
2628#endif
2629#else
2630color=image_color;
2631#endif
2632#ifdef FOG
2633#ifdef ZERO_EXAGGERATION
2634color=fog_dither(fog_apply_premultiplied(color,v_fog_pos));
2635#else
2636color=fog_dither(fog_apply_from_vert(color,v_fog_opacity));
2637#endif
2638#endif
2639glFragColor=color;
2640#ifdef OVERDRAW_INSPECTOR
2641glFragColor=vec4(1.0);
2642#endif
2643HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
2644#include "_prelude_terrain.vertex.glsl"
2645uniform mat4 u_matrix;uniform float u_skirt_height;in ivec2 a_pos;out vec2 v_pos0;
2646#ifdef FOG
2647out float v_fog_opacity;
2648#endif
2649#ifdef RENDER_SHADOWS
2650uniform 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;
2651#endif
2652void 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);
2653#ifdef FOG
2654#ifdef ZERO_EXAGGERATION
2655v_fog_pos=fog_position(decodedPos);
2656#else
2657v_fog_opacity=fog(fog_position(vec3(decodedPos,elevation)));
2658#endif
2659#endif
2660#ifdef RENDER_SHADOWS
2661vec3 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.);
2662#endif
2663}`),terrainDepth:Lt("precision highp float;in float v_depth;void main() {glFragColor=pack_depth(v_depth);}",`#include "_prelude_terrain.vertex.glsl"
2664uniform 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:Lt(`#include "_prelude_fog.fragment.glsl"
2665in 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(
2666cos_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
2666nd-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;
2667#ifdef FOG
2668sky_color=fog_apply_sky_gradient(v_uv.xzy,sky_color);
2669#endif
2670sky_color+=0.1*sun_disk(v_uv,u_sun_direction);glFragColor=vec4(sky_color*u_opacity,u_opacity);
2671#ifdef OVERDRAW_INSPECTOR
2672glFragColor=vec4(1.0);
2673#endif
2674}`,Yo),skyboxGradient:Lt(`#include "_prelude_fog.fragment.glsl"
2675in 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));
2676#ifdef FOG
2677color.rgb=fog_apply_sky_gradient(v_uv.xzy,color.rgb/color.a)*color.a;
2678#endif
2679color*=u_opacity;glFragColor=color;
2680#ifdef OVERDRAW_INSPECTOR
2681glFragColor=vec4(1.0);
2682#endif
2683}`,Yo),skyboxCapture:Lt
vendor: 3,792 bytes, lines 2683-2694
2683(`
2684in 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;
2685#define BETA_R                  vec3(5.5e-6,13.0e-6,22.4e-6)
2686#define BETA_M                  vec3(21e-6,21e-6,21e-6)
2687#define MIE_G                   0.76
2688#define DENSITY_HEIGHT_SCALE_R  8000.0
2689#define DENSITY_HEIGHT_SCALE_M  1200.0
2690#define PLANET_RADIUS           6360e3
2691#define ATMOSPHERE_RADIUS       6420e3
2692#define SAMPLE_STEPS            10
2693#define DENSITY_STEPS           4
2694float 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
2694Raster:Lt(`#include "_prelude_fog.fragment.glsl"
2695#include "_prelude_lighting.glsl"
2696uniform sampler2D u_image0;
2697#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS
2698uniform sampler2D u_image1;uniform float u_emissive_texture_available;
2699#endif
2700uniform float u_far_z_cutoff;in vec2 v_pos0;
2701#ifndef FOG
2702uniform 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;
2703#endif
2704void main() {vec4 color;
2705#ifdef CUSTOM_ANTIALIASING
2706highp vec2 uv=gl_FragCoord.xy/u_viewport;
2707#ifdef FLIP_Y
2708uv.y=1.0-uv.y;
2709#endif
2710highp vec3 ray_dir=mix(
2711mix(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);
2712#ifdef LIGHTING_3D_MODE
2713#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS
2714float 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);
2715#else
2716raster=apply_lighting_ground(raster);color=vec4(raster.rgb*antialias,raster.a*antialias);
2717#endif
2718#else
2719color=vec4(raster.rgb*antialias,raster.a*antialias);
2720#endif
2721#else
2722color=texture(u_image0,v_pos0);
2723#ifdef LIGHTING_3D_MODE
2724#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS
2725float 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;
2726#else
2727color=apply_lighting_ground(color);
2728#endif
2729#endif
2730#endif
2731#ifdef FOG
2732color=fog_dither(fog_apply_premultiplied(color,v_fog_pos));
2733#endif
2734color*=1.0-step(u_far_z_cutoff,1.0/gl_FragCoord.w);glFragColor=color;
2735#ifdef OVERDRAW_INSPECTOR
2736glFragColor=vec4(1.0);
2737#endif
2738HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
2739#include "_prelude_terrain.vertex.glsl"
2740uniform 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;
2741#ifdef GLOBE_POLES
2742in vec3 a_globe_pos;in vec2 a_uv;
2743#else
2744in ivec2 a_pos;
2745#endif
2746out vec2 v_pos0;void main() {
2747#ifdef GLOBE_POLES
2748vec3 globe_pos=a_globe_pos;vec2 uv=a_uv;
2749#else
2750float 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);
2751#endif
2752v_pos0=uv;vec2 tile_pos=uv*EXTENT;vec3 globe_derived_up_vector=normalize(globe_pos)*u_tile_up_scale;
2753#ifdef GLOBE_POLES
2754vec3 up_vector=globe_derived_up_vector;
2755#else
2756vec3 up_vector=elevationVector(tile_pos);
2757#endif
2758float height=elevation(tile_pos);globe_pos+=up_vector*height;
2759#ifndef GLOBE_POLES
2760globe_pos-=globe_derived_up_vector*u_skirt_height*decomposed_pos_and_skirt.z;
2761#endif
2762#ifdef GLOBE_POLES
2763vec4 interpolated_pos=u_globe_matrix*vec4(globe_pos,1.0);
2764#else
2765vec4 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);
2766#endif
2767gl_Position=u_proj_matrix*interpolated_pos;
2768#ifdef FOG
2769v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);
2770#endif
2771}`),globeAtmosphere:Lt(`#include "_prelude_fog.fragment.glsl"
2772uniform 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;
2773#ifdef PROJECTION_GLOBE_VIEW
2774globe_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) {
2775#ifdef ALPHA_PASS
2776glFragColor=vec4(0,0,0,0);return;
2777#else
2778#ifdef NATIVE
2779glFragColor=vec4(1,1,1,1);
2780#else
2781glFragColor=vec4(0,0,0,1);
2782#endif
2783return;
2784#endif
2785}
2786#endif
2787highp vec3 horizon_dir=normalize(v_horizon_dir);float horizon_angle_mercator=dir.y < horizon_dir.y ?
27880.0 : max(acos(clamp(dot(dir,horizon_dir),-1.0,1.0)),0.0);float horizon_angle;
2789#ifdef PROJECTION_GLOBE_VIEW
2790highp 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 ?
2791PI-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);
2792#else
2793horizon_angle=horizon_angle_mercator;
2794#endif
2795horizon_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;
2795vec3 color_stop_2=u_space_color.rgb;
2796#ifdef ALPHA_PASS
2797float 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);
2798#else
2799vec3 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);
2800#endif
2801}`,`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(
2802mix(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(
2803mix(u_frustum_tl,u_frustum_bl,u_horizon),mix(u_frustum_tr,u_frustum_br,u_horizon),a_uv.x);gl_Position=vec4(a_pos,1.0);}`),model:Lt(`#include "_prelude_fog.fragment.glsl"
2804#include "_prelude_shadow.fragment.glsl"
2805#include "_prelude_lighting.glsl"
2806uniform float u_opacity;
2807#ifdef DITHERED_DISCARD
2808uniform float u_dithered_discard_threshold;
2809#endif
2810uniform vec3 u_lightcolor;uniform vec3 u_lightpos;uniform float u_lightintensity;uniform vec4 u_baseColorFactor;uniform vec4 u_emissiveFactor;uniform float u_metallicFactor;uniform float u_roughnessFactor;uniform float u_emissive_strength;in highp vec4 v_position_height;in lowp vec4 v_color_mix;
2811#ifdef RENDER_SHADOWS
2812in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in float v_depth_shadows;
2813#endif
2814#ifdef OCCLUSION_TEXTURE_TRANSFORM
2815uniform vec4 u_occlusionTextureTransform;
2816#endif
2817#pragma mapbox: define-attribute highp vec3 normal_3f
2818#pragma mapbox: define-attribute highp vec3 color_3f
2819#pragma mapbox: define-attribute highp vec4 color_4f
2820#pragma mapbox: define-attribute highp vec2 uv_2f
2821#pragma mapbox: initialize-attribute highp vec3 normal_3f
2822#pragma mapbox: initialize-attribute highp vec3 color_3f
2823#pragma mapbox: initialize-attribute highp vec4 color_4f
2824#pragma mapbox: initialize-attribute highp vec2 uv_2f
2825#ifdef HAS_ATTRIBUTE_a_pbr
2826in lowp vec4 v_roughness_metallic_emissive_alpha;in mediump vec4 v_height_based_emission_params;
2827#endif
2828#ifdef HAS_TEXTURE_u_baseColorTexture
2829uniform sampler2D u_baseColorTexture;uniform bool u_baseTextureIsAlpha;uniform bool u_alphaMask;uniform float u_alphaCutoff;
2830#endif
2831#ifdef HAS_TEXTURE_u_metallicRoughnessTexture
2832uniform sampler2D u_metallicRoughnessTexture;
2833#endif
2834#ifdef HAS_TEXTURE_u_occlusionTexture
2835uniform sampler2D u_occlusionTexture;uniform float u_aoIntensity;
2836#endif
2837#ifdef HAS_TEXTURE_u_normalTexture
2838uniform sampler2D u_normalTexture;
2839#endif
2840#ifdef HAS_TEXTURE_u_emissionTexture
2841uniform sampler2D u_emissionTexture;
2842#endif
2843#ifdef APPLY_LUT_ON_GPU
2844uniform highp sampler3D u_lutTexture;
2845#endif
2846#ifdef TERRAIN_FRAGMENT_OCCLUSION
2847in highp float v_depth;uniform highp sampler2D u_depthTexture;uniform highp vec2 u_inv_depth_size;uniform highp vec2 u_depth_range_unpack;
2848#ifdef DEPTH_D24
2849highp float unpack_depth(highp float depth) {return  depth*u_depth_range_unpack.x+u_depth_range_unpack.y;}
2850#else
2851highp float unpack_depth_rgba(highp vec4 rgba_depth)
2852{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;}
2853#endif
2854bool isOccluded() {highp vec2 coord=gl_FragCoord.xy*u_inv_depth_size;
2855#ifdef FLIP_Y
2856coord.y=1.0-coord.y;
2857#endif
2858#ifdef DEPTH_D24
2859highp float depth=unpack_depth(texture(u_depthTexture,coord).r);
2860#else
2861highp float depth=unpack_depth_rgba(texture(u_depthTexture,coord));
2862#endif
2863return v_depth > depth+0.0005;}
2864#endif
2865#define saturate(_x) clamp(_x,0.,1.)
2866vec3 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)
2867{
2868#ifdef LIGHTING_3D_MODE
2869vec3 transformed_normal=vec3(-normal.xy,normal.z);float lighting_factor;
2870#ifdef RENDER_SHADOWS
2871lighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows);
2872#else
2873lighting_factor=saturate(dot(transformed_normal,u_lighting_directional_dir));
2874#endif
2875return apply_lighting(albedo,transformed_normal,lighting_factor);
2876#else
2877vec3 n=normal;float colorvalue=((albedo.x*0.2126)+(albedo.y*0.7152))+(albedo.z*0.0722);vec3 c=vec3(0.03,0.03,0.03);float directional=clamp(dot(n,vec3(lightDir)),0.0,1.0);directional=mix(1.0-u_lightintensity,max((1.0-colorvalue)+u_lightintensity,1.0),directional);vec3 c3=c+clamp((albedo*directional)*lightColor,mix(vec3(0.0),vec3(0.3),vec3(1.0)-light
2877Color),vec3(1.0));return c3;
2878#endif
2879}vec4 getBaseColor() {vec4 albedo=u_baseColorFactor;
2880#ifdef HAS_ATTRIBUTE_a_color_3f
2881albedo*=vec4(color_3f,1.0);
2882#endif
2883#ifdef HAS_ATTRIBUTE_a_pbr
2884#else
2885#ifdef HAS_ATTRIBUTE_a_color_4f
2886albedo*=color_4f;
2887#endif
2888#endif
2889#if defined (HAS_TEXTURE_u_baseColorTexture) && defined (HAS_ATTRIBUTE_a_uv_2f)
2890vec4 texColor=texture(u_baseColorTexture,uv_2f);if(u_alphaMask) {if (texColor.w < u_alphaCutoff) {discard;}}
2891#ifdef UNPREMULT_TEXTURE_IN_SHADER
2892if(texColor.w > 0.0) {texColor.rgb/=texColor.w;}texColor.w=1.0;
2893#endif
2894if(u_baseTextureIsAlpha) {if (texColor.r < 0.5) {discard;}} else {texColor.rgb=sRGBToLinear(texColor.rgb);albedo*=texColor;}
2895#endif
2896vec4 color=vec4(mix(albedo.rgb,v_color_mix.rgb,v_color_mix.a),albedo.a);
2897#ifdef APPLY_LUT_ON_GPU
2898color=applyLUT(u_lutTexture,color);
2899#endif
2900return color;}highp mat3 cotangentFrame(highp vec3 N,highp vec3 p,highp vec2 uv ) {
2901#ifdef HAS_TEXTURE_u_normalTexture
2902highp 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;
2903#ifdef FLIP_Y
2904T=-T;B=-B;
2905#endif
2906highp 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;
2907#else
2908return mat3(1.0);
2909#endif
2910}highp vec3 getNormal(){highp vec3 n;
2911#ifdef HAS_ATTRIBUTE_a_normal_3f
2912n=normalize(normal_3f);
2913#else
2914highp 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));
2915#ifdef FLIP_Y
2916n=normalize(cross(fdx,fdy));
2917#else
2918n=normalize(cross(fdx,fdy))*-1.0;
2919#endif
2920#endif
2921#if defined(HAS_TEXTURE_u_normalTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)
2922vec3 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);
2923#endif
2924return 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;
2925#ifdef HAS_ATTRIBUTE_a_pbr
2926mat.perceptualRoughness=v_roughness_metallic_emissive_alpha.x;mat.metallic=v_roughness_metallic_emissive_alpha.y;mat.baseColor.w*=v_roughness_metallic_emissive_alpha.w;
2927#endif
2928#if defined(HAS_TEXTURE_u_metallicRoughnessTexture) && defined(HAS_ATTRIBUTE_a_uv_2f) 
2929vec4 mrSample=texture(u_metallicRoughnessTexture,uv_2f);mat.perceptualRoughness*=mrSample.g;mat.metallic*=mrSample.b;
2930#endif
2931const 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)
2932{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)
2933{return specularColor+(f90-specularColor)*pow(clamp(1.0-VdotH,0.0,1.0),5.0);}vec3 F_SchlickFast(vec3 specularColor,float VdotH)
2934{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)
2935{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)
2936{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)
2937{
2938#ifdef LIGHTING_3D_MODE
2939return mat.diffuseColor;
2940#else
2941return mat.diffuseColor/PI;
2942#endif
2943}vec3 EnvBRDFApprox(vec3 specularColor,float roughness,highp float NdotV)
2944{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)
2945{vec3 env_light=vec3(0.65,0.65,0.65);
2946#ifdef LIGHTING_3D_MODE
2947float ambient_factor=calculate_ambient_directional_factor(normal);env_light=u_lighting_ambient_color*ambient_factor;
2948#endif
2949vec3 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)
2950{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;
2951#ifdef RENDER_SHADOWS
2952lighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows);
2953#else
2954lighting_factor=NdotL;
2955#endif
2956vec3 directLightColor=(specularTerm+diffuseTerm)*lighting_factor*light
2956Color;vec3 indirectLightColor=computeIndirectLightContribution(mat,NdotV,transformed_normal);vec3 color=(saturate(directLightColor)+indirectLightColor);float intensityFactor=1.0;
2957#if !defined(LIGHTING_3D_MODE)
2958const 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);
2959#endif
2960color*=intensityFactor;return color;}void main() {
2961#ifdef TERRAIN_FRAGMENT_OCCLUSION
2962if (isOccluded()) {discard;}
2963#endif
2964vec3 lightDir=u_lightpos;vec3 lightColor=u_lightcolor;
2965#ifdef LIGHTING_3D_MODE
2966lightDir=u_lighting_directional_dir;lightDir.xy=-lightDir.xy;lightColor=u_lighting_directional_color;
2967#endif
2968vec4 finalColor;
2969#ifdef DIFFUSE_SHADED
2970vec3 N=getNormal();vec3 baseColor=getBaseColor().rgb;vec3 diffuse=getDiffuseShadedColor(baseColor,N,lightDir,lightColor);
2971#ifdef HAS_TEXTURE_u_occlusionTexture
2972float ao=(texture(u_occlusionTexture,uv_2f).r-1.0)*u_aoIntensity+1.0;diffuse*=ao;
2973#endif
2974finalColor=vec4(mix(diffuse,baseColor,u_emissive_strength),1.0)*u_opacity;
2975#else
2976Material mat=getPBRMaterial();vec3 color=computeLightContribution(mat,lightDir,lightColor);float ao=1.0;
2977#if defined (HAS_TEXTURE_u_occlusionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)
2978#ifdef OCCLUSION_TEXTURE_TRANSFORM
2979vec2 uv=uv_2f.xy*u_occlusionTextureTransform.zw+u_occlusionTextureTransform.xy;
2980#else
2981vec2 uv=uv_2f;
2982#endif
2983ao=(texture(u_occlusionTexture,uv).x-1.0)*u_aoIntensity+1.0;color*=ao;
2984#endif
2985vec4 emissive=u_emissiveFactor;
2986#if defined(HAS_TEXTURE_u_emissionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)
2987emissive.rgb*=sRGBToLinear(texture(u_emissionTexture,uv_2f).rgb);
2988#endif
2989#ifdef APPLY_LUT_ON_GPU
2990float emissiveFactorLength=max(length(u_emissiveFactor.rgb),0.001);emissive.rgb=sRGBToLinear(applyLUT(u_lutTexture,linearTosRGB(emissive.rgb/emissiveFactorLength).rbg))*emissiveFactorLength;
2991#endif
2992color+=emissive.rgb;float opacity=mat.baseColor.w*u_opacity;
2993#ifdef HAS_ATTRIBUTE_a_pbr
2994float 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;
2995#ifdef APPLY_LUT_ON_GPU
2996color_mix=applyLUT(u_lutTexture,color_mix);
2997#endif
2998color=mix(color,color_mix,min(1.0,resEmission));
2999#ifdef HAS_ATTRIBUTE_a_color_4f
3000float distance=length(vec2(1.3*max(0.0,abs(color_4f.x)-color_4f.z),color_4f.
3000y));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);
3001#endif
3002#endif
3003vec3 unlitColor=mat.baseColor.rgb*ao+emissive.rgb;color=mix(color,unlitColor,u_emissive_strength);color=linearTosRGB(color);color*=opacity;finalColor=vec4(color,opacity);
3004#endif
3005#ifdef DITHERED_DISCARD
3006if (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;}}
3007#endif
3008#ifdef FOG
3009finalColor=fog_dither(fog_apply_premultiplied(finalColor,v_fog_pos,v_position_height.w));
3010#endif
3011#ifdef RENDER_CUTOFF
3012finalColor*=v_cutoff_opacity;
3013#endif
3014#ifdef INDICATOR_CUTOUT
3015finalColor=applyCutout(finalColor,v_position_height.w);
3016#endif
3017#ifdef FEATURE_CUTOUT
3018finalColor=apply_feature_cutout(finalColor,gl_FragCoord,get_cutout_factors(gl_FragCoord).x);
3019#endif
3020glFragColor=finalColor;
3021#ifdef OVERDRAW_INSPECTOR
3022glFragColor=vec4(1.0);
3023#endif
3024HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
3025#include "_prelude_shadow.vertex.glsl"
3026in vec3 a_pos_3f;
3027#pragma mapbox: define-attribute highp vec3 normal_3f
3028#pragma mapbox: define-attribute highp vec2 uv_2f
3029#pragma mapbox: define-attribute highp vec3 color_3f
3030#pragma mapbox: define-attribute highp vec4 color_4f
3031#pragma mapbox: define-attribute-vertex-shader-only highp uvec4 pbr
3032#pragma mapbox: define-attribute-vertex-shader-only highp vec3 heightBasedEmissiveStrength
3033uniform mat4 u_matrix;uniform mat4 u_node_matrix;uniform mat4 u_lighting_matrix;uniform vec3 u_camera_pos;uniform vec4 u_color_mix;
3034#ifdef INSTANCED_ARRAYS
3035in vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3;
3036#else
3037uniform highp mat4 u_normal_matrix;
3038#endif
3039#ifdef RENDER_SHADOWS
3040uniform 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;
3041#endif
3042out vec4 v_position_height;out lowp vec4 v_color_mix;
3043#ifdef TERRAIN_FRAGMENT_OCCLUSION
3044out highp float v_depth;
3045#endif
3046#ifdef HAS_ATTRIBUTE_a_pbr
3047out lowp vec4 v_roughness_metallic_emissive_alpha;out mediump vec4 v_height_based_emission_params;
3048#endif
3049vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}void main() {
3050#pragma mapbox: initialize-attribute highp vec3 normal_3f
3051#pragma mapbox: initialize-attribute highp vec2 uv_2f
3052#pragma mapbox: initialize-attribute highp vec3 color_3f
3053#pragma mapbox: initialize-attribute highp vec4 color_4f
3054#pragma mapbox: initialize-attribute-custom highp uvec4 pbr
3055#pragma mapbox: initialize-attribute-custom highp vec3 heightBasedEmissiveStrength
3056highp mat4 normal_matrix;
3057#ifdef INSTANCED_ARRAYS
3058normal_matrix=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3);
3059#else
3060normal_matrix=u_normal_matrix;
3061#endif
3062vec3 local_pos;mat3 rs;
3063#ifdef MODEL_POSITION_ON_GPU
3064vec3 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;
3065#else
3066local_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);
3067#endif
3068v_position_height.w=a_pos_3f.z;
3069#ifdef HAS_ATTRIBUTE_a_pbr
3070vec4 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;
3071#endif
3072#ifdef FOG
3073v_fog_pos=fog_position(local_pos);
3074#endif
3075#ifdef RENDER_CUTOFF
3076v_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z);
3077#endif
3078#ifdef TERRAIN_FRAGMENT_OCCLUSION
3079v_depth=gl_Position.z/gl_Position.w;
3080#ifdef CLIP_ZERO_TO_ONE
3081v_depth=-1.0+2.0*v_depth; 
3082#endif
3083#endif
3084#ifdef HAS_ATTRIBUTE_a_normal_3f
3085#ifdef MODEL_POSITION_ON_GPU
3086float 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);
3087#else
3088normal_3f=vec3(normal_matrix*vec4(normal_3f,0));
3089#endif
3090#endif
3091#ifdef HAS_ATTRIBUTE_a_pbr
3092#ifdef HAS_ATTRIBUTE_a_color_4f
3093v_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);
3094#endif
3095#endif
3096#ifdef RENDER_SHADOWS
3097vec4 shadow_pos=u_node_matrix*vec4(local_pos,1.0);
3098#ifdef NORMAL_OFFSET
3099#ifdef HAS_ATTRIBUTE_a_normal_3f
3100#ifdef MODEL_POSITION_ON_GPU
3101vec3 offset=shadow_normal_offset(vec3(-normal_3f.xy,normal_3f.z));shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0();
3102#else
3103vec3 offset=shadow_normal_offset_model(normal_3f);shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0();
3104#endif
3105#endif
3106#endif
3107v_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;
3108#endif
3109}`),modelDepth:Lt("void main() {}",`in vec3 a_pos_3f;uniform mat4 u_matrix;
3110#ifdef MODEL_POSITION_ON_GPU
3111#ifdef INSTANCED_ARRAYS
3112in vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3;
3113#else
3114uniform highp mat4 u_instance;
3115#endif
3116uniform highp mat4 u_node_matrix;
3117#endif
3118void main() {
3119#ifdef MODEL_POSITION_ON_GPU
3120highp mat4 instance;
3121#ifdef INSTANCED_ARRAYS
3122instance=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3);
3123#else
3124instance=u_instance;
3125#endif
3126vec3 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;
3126rs[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);
3127#else
3128gl_Position=u_matrix*vec4(a_pos_3f,1);
3129#endif
3130}`),stars:Lt(`in highp vec2 v_uv;in mediump float v_intensity;float shapeCircle(in vec2 uv)
3131{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;}`,`
3132in 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);}`),snowParticle:Lt("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;}",`
3133in 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; 
3134uniform float u_velocity;uniform vec3 u_direction;uniform float u_horizontalOscillationRadius; 
3135uniform float u_horizontalOscillationRate; 
3136uniform 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);simPosLocal.xy+=horizontalOscillationRadius*vec2(cos(horizontalOscillationAngle),sin(horizontalOscillationAngle));vec3 simPos=localX*simPosLocal.x+
3137localY*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:Lt("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;}",`
3138in 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; 
3139uniform float u_velocity; 
3140uniform 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;
3140pos*=halfBoxSize; 
3141pos+=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+
3142localY*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:Lt("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);}"),occlusion:Lt("uniform vec4 u_color;void main() {glFragColor=u_color;}",`#include "_prelude_terrain.vertex.glsl"
3143in 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;
3144#ifdef TERRAIN
3145float e=elevation(world_pos.xy);world_pos.z+=e;
3146#endif
3147vec4 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 _a(l,i){const o=l.split(`
3148`);for(let u of o){if(u=u.trimStart(),u[0]!=="#"||!u.includes("if")||u.startsWith("#endif"))continue;const d=u.match(Ze);if(d)for(const m of d)wf.has(m)||i.add(m)}}function xl(l){return new Set(["uint","int","uvec2","ivec2","uvec3","ivec3","uvec4","ivec4"]).has(l)}function Lt(l,i){const o=new Set,u=[],d=[];l=l.replace(_n,(_,y)=>(d.push(y),"")),i=i.replace(_n,(_,y)=>(u.push(y),""));let m=new Set(yl);_a(l,m),_a(i,m);for(const _ of[...u,...d])Ln[_]||(Ln[_]=new Set,_a(pa[_],Ln[_])),m=new Set([...m,...Ln[_]]);return{fragmentSource:l=l.replace(gl,(_,y,v,T,I)=>(o.add(I),y==="define"?`
3149#ifndef HAS_UNIFORM_u_${I}
3150${xl(T)?"flat ":""}in ${v} ${T} ${I};
3151#else
3152uniform ${v} ${T} u_${I};
3153#endif
3154`:y==="initialize"?`
3155#ifdef HAS_UNIFORM_u_${I}
3156    ${v} ${T} ${I} = u_${I};
3157#endif
3158`:y==="define-attribute"?`
3159#ifdef HAS_ATTRIBUTE_a_${I}
3160    in ${v} ${T} ${I};
3161#endif
3162`:y==="initialize-attribute"?"":void 0)),vertexSource:i=i.replace(gl,(_,y,v,T,I)=>{const M=`MATERIAL_ATTRIBUTE_OFFSET_${I}`,C=T==="float"?"vec2":T,D=`GET_ATTRIBUTE_${C}(a_${I}, materialInfo, ${M})`,F=I.match(/color/)?"color":C;return y==="define-attribute-vertex-shader-only"?`
3163#ifdef HAS_ATTRIBUTE_a_${I}
3164in ${v} ${T} a_${I};
3165#endif
3166`:o.has(I)?y==="define"?`
3167#ifndef HAS_UNIFORM_u_${I}
3168uniform lowp float u_${I}_t;
3169    #if !defined(${M})
3170        in ${v} ${C} a_${I};
3171    #endif
3172${xl(T)?"flat ":""}out ${v} ${T} ${I};
3173#else
3174uniform ${v} ${T} u_${I};
3175#endif
3176`:y==="initialize"?F==="vec4"||F==="uvec4"?`
3177#ifndef HAS_UNIFORM_u_${I}
3178    ${I} = a_${I};
3179#else
3180    ${v} ${T} ${I} = u_${I};
3181#endif
3182`:`
3183#if !defined(HAS_UNIFORM_u_${I})
3184    #ifdef ${M}
3185        ${I} = unpack_mix_${F}(${D}, u_${I}_t);
3186    #else
3187        ${I} = unpack_mix_${F}(a_${I}, u_${I}_t);
3188    #endif
3189#else
3190    ${v} ${T} ${I} = u_${I};
3191#endif
3192`:y==="define-attribute"?`
3193#ifdef HAS_ATTRIBUTE_a_${I}
3194    in ${v} ${T} a_${I};
3195    out ${v} ${T} ${I};
3196#endif
3197`:y==="initialize-attribute"?`
3198#ifdef HAS_ATTRIBUTE_a_${I}
3199    ${I} = a_${I};
3200#endif
3201`:void 0:y==="define"?`
3202#ifndef HAS_UNIFORM_u_${I}
3203uniform lowp float u_${I}_t;
3204    #if !defined(${M})
3205        in ${v} ${C} a_${I};
3206    #endif
3207#else
3208uniform ${v} ${T} u_${I};
3209#endif
3210`:y==="define-instanced"?F==="mat4"?`
3211#ifdef INSTANCED_ARRAYS
3212in vec4 a_${I}0;
3213in vec4 a_${I}1;
3214in vec4 a_${I}2;
3215in vec4 a_${I}3;
3216#else
3217uniform ${v} ${T} u_${I};
3218#endif
3219`:`
3220#ifdef INSTANCED_ARRAYS
3221in ${v} ${C} a_${I};
3222#else
3223uniform ${v} ${T} u_${I};
3224#endif
3225`:y==="initialize-attribute-custom"?`
3226#ifdef HAS_ATTRIBUTE_a_${I}
3227    ${v} ${T} ${I} = a_${I};
3228#endif
3229`:F==="vec4"||F==="uvec4"?`
3230#ifndef HAS_UNIFORM_u_${I}
3231    #ifdef ${M}
3232        ${v} ${T} ${I} = ${D};
3233    #else
3234        ${v} ${T} ${I} = a_${I};
3235    #endif
3236#else
3237    ${v} ${T} ${I} = u_${I};
3238#endif
3239`:`
3240#ifndef HAS_UNIFORM_u_${I}
3241    #ifdef ${M}
3242        ${v} ${T} ${I} = unpack_mix_${F}(${D}, u_${I}_t);
3243    #else
3244        ${v} ${T} ${I} = unpack_mix_${F}(a_${I}, u_${I}_t);
3245    #endif
3246#else
3247    ${v} ${T} ${I} = u_${I};
3248#endif
3249`}),usedDefines:m,vertexIncludes:u,fragmentIncludes:d}}class Sf{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffers=[],this.vao=null}bind(i,o,u,d,m,_,y,v){this.context=i;let T=this.boundPaintVertexBuffers.length!==d.length;for(let M=0;!T&&M<d.length;M++)this.boundPaintVertexBuffers[M]!==d[M]&&(T=!0);let I=this.boundDynamicVertexBuffers.length!==y.length;for(let M=0;!I&&M<y.length;M++)this.boundDynamicVertexBuffers[M]!==y[M]&&(I=!0);if(!this.vao||this.boundProgram!==o||this.boundLayoutVertexBuffer!==u||T||I||this.boundIndexBuffer!==m||this.boundVertexOffset!==_)this.freshBind(o,u,d,m,_,y,v);else{i.bindVertexArrayOES.set(this.vao);for(const M of y)M&&(M.bind(),v&&M.instanceCount&&M.setVertexAttribDivisor(i.gl,o,v));m&&m.dynamicDraw&&m.bind()}}freshBind(i,o,u,d,m,_,y){const v=this.context,T=v.gl;this.vao&&this.destroy(),this.vao=v.gl.createVertexArray(),v.bindVertexArrayOES.set(this.vao),this.boundProgram=i,this.boundLayoutVertexBuffer=o,this.boundPaintVertexBuffers=u,this.boundIndexBuffer=d,this.boundVertexOffset=m,this.boundDynamicVertexBuffers=_,o.enableAttributes(T,i),o.bind(),o.setVertexAttribPointers(T,i,m);for(const I of u)I.enableAttributes(T,i),I.bind(),I.setVertexAttribPointers(T,i,m);for(const I of _)I&&(I.enableAttributes(T,i),I.bind(),I.setVertexAttribPointers(T,i,m),y&&I.instanceCount&&I.setVertexAttribDivisor(T,i,y));d&&d.bind()}destroy(){this.vao&&(this.context.gl.deleteVertexArray(this.vao),this.vao=null)}}function If(l,i){const o=Math.pow(2,i.canonical.z),u=i.canonical.y;return[new a.ag(0,u/o).toLngLat().lat,new a.ag(0,(u+1)/o).toLngLat().lat]}function yh(l,i,o,u,d,m,_){const y=l.context,v=y.gl,T=o.hillshadeFBO;if(!T)return;l.prepareDrawTile();const I=l.isTileAffectedByFog(i),M=[];l.terrain&&l.terrain.renderingToTexture&&l.emissiveMode==="mrt-fallback"&&M.push("USE_MRT1");const C=l.getOrCreateProgram("hillshade",{overrideFog:I,defines:M});y.activeTexture.set(v.TEXTURE0),v.bindTexture(v.TEXTURE_2D,T.colorAttachment0.get());const D=((N,$,H,j)=>{const ne=H.paint.get("hillshade-shadow-color"),Y=H.paint.get("hillshade-shadow-color-use-theme").
vendor: 40,870 bytes, lines 3249-3250
3249constantOr("default")==="none",re=H.paint.get("hillshade-highlight-color"),Z=H.paint.get("hillshade-highlight-color-use-theme").constantOr("default")==="none",K=H.paint.get("hillshade-accent-color"),te=H.paint.get("hillshade-accent-color-use-theme").constantOr("default")==="none",de=H.paint.get("hillshade-emissive-strength");let se=a.ap(H.paint.get("hillshade-illumination-direction"));if(H.paint.get("hillshade-illumination-anchor")==="viewport")se-=N.transform.angle;else if(N.style&&N.style.enable3dLights()&&N.style.directionalLight){const _e=N.style.directionalLight.properties.get("direction"),Me=a.cL(_e.x,_e.y,_e.z);se=a.ap(Me[1])}const be=!N.options.moving;return{u_matrix:j||N.transform.calculateProjMatrix($.tileID.toUnwrapped(),be),u_image:0,u_latrange:If(0,$.tileID),u_light:[H.paint.get("hillshade-exaggeration"),se],u_shadow:ne.toPremultipliedRenderColor(Y?null:H.lut),u_highlight:re.toPremultipliedRenderColor(Z?null:H.lut),u_emissive_strength:de,u_accent:K.toPremultipliedRenderColor(te?null:H.lut)}})(l,o,u,l.terrain?i.projMatrix:null);l.uploadCommonUniforms(y,C,i.toUnwrapped());const{tileBoundsBuffer:F,tileBoundsIndexBuffer:z,tileBoundsSegments:V}=l.getTileBoundsBuffers(o);C.draw(l,v.TRIANGLES,d,m,_,pt.disabled,D,u.id,F,z,V)}function Ef(l,i,o){if(!i.needsDEMTextureUpload)return;const u=l.context,d=u.gl;u.pixelStoreUnpackPremultiplyAlpha.set(!1),i.demTexture=i.demTexture||l.getTileTexture(o.stride);const m=o.getPixels();i.demTexture?i.demTexture.update(m,{premultiply:!1}):i.demTexture=new a.T(u,m,d.R32F,{premultiply:!1}),i.needsDEMTextureUpload=!1}function Fm(l,i,o){const u=l.context,d=u.gl;if(!i.dem)return;const m=i.dem;if(u.activeTexture.set(d.TEXTURE1),Ef(l,i,m),!i.demTexture)return;i.demTexture.bind(d.NEAREST,d.CLAMP_TO_EDGE);const _=m.dim;u.activeTexture.set(d.TEXTURE0);let y=i.hillshadeFBO;if(!y){const C=new a.T(u,{width:_,height:_,data:null},d.RGBA8);C.bind(d.LINEAR,d.CLAMP_TO_EDGE),y=i.hillshadeFBO=u.createFramebuffer(_,_,1,"renderbuffer"),y.colorAttachment0.set(C.texture)}u.bindFramebuffer.set(y.framebuffer),u.viewport.set([0,0,_,_]);const{tileBoundsBuffer:v,tileBoundsIndexBuffer:T,tileBoundsSegments:I}=l.getMercatorTileBoundsBuffers(),M=[];l.linearFloatFilteringSupported()&&M.push("TERRAIN_DEM_FLOAT_FORMAT"),l.terrain&&l.terrain.renderingToTexture&&l.emissiveMode==="mrt-fallback"&&M.push("USE_MRT1"),l.getOrCreateProgram("hillshadePrepare",{defines:M}).draw(l,d.TRIANGLES,rt.disabled,st.disabled,ct.unblended,pt.disabled,((C,D)=>{const F=D.stride,z=a.bc();return a.bU(z,0,a.an,-a.an,0,0,1),a.by(z,z,[0,-a.an,0]),{u_matrix:z,u_image:1,u_dimension:[F,F],u_zoom:C.overscaledZ}})(i.tileID,m),o.id,v,T,I),i.needsHillshadePrepare=!1}class Ai{constructor(i){this.gl=i.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(i){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class Om extends Ai{getDefault(){return a.aq.transparent.toNonPremultipliedRenderColor(null)}set(i){const o=this.current;(i.r!==o.r||i.g!==o.g||i.b!==o.b||i.a!==o.a||this.dirty)&&(this.gl.clearColor(i.r,i.g,i.b,i.a),this.current=i,this.dirty=!1)}}class Af extends Ai{getDefault(){return 1}set(i){(i!==this.current||this.dirty)&&(this.gl.clearDepth(i),this.current=i,this.dirty=!1)}}class Bm extends Ai{getDefault(){return 0}set(i){(i!==this.current||this.dirty)&&(this.gl.clearStencil(i),this.current=i,this.dirty=!1)}}class Bc extends Ai{getDefault(){return[!0,!0,!0,!0]}set(i){const o=this.current;(i[0]!==o[0]||i[1]!==o[1]||i[2]!==o[2]||i[3]!==o[3]||this.dirty)&&(this.gl.colorMask(i[0],i[1],i[2],i[3]),this.current=i,this.dirty=!1)}}class km extends Ai{getDefault(){return!0}set(i){(i!==this.current||this.dirty)&&(this.gl.depthMask(i),this.current=i,this.dirty=!1)}}class Cf extends Ai{getDefault(){return 255}set(i){(i!==this.current||this.dirty)&&(this.gl.stencilMask(i),this.current=i,this.dirty=!1)}}class xh extends Ai{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(i){const o=this.current;(i.func!==o.func||i.ref!==o.ref||i.mask!==o.mask||this.dirty)&&(this.gl.stencilFunc(i.func,i.ref,i.mask),this.current=i,this.dirty=!1)}}class kc extends Ai{getDefault(){const i=this.gl;return[i.KEEP,i.KEEP,i.KEEP]}set(i){const o=this.current;(i[0]!==o[0]||i[1]!==o[1]||i[2]!==o[2]||this.dirty)&&(this.gl.stencilOp(i[0],i[1],i[2]),this.current=i,this.dirty=!1)}}class vh extends Ai{getDefault(){return!1}set(i){if(i===this.current&&!this.dirty)return;const o=this.gl;i?o.enable(o.STENCIL_TEST):o.disable(o.STENCIL_TEST),this.current=i,this.dirty=!1}}class Ms extends Ai{getDefault(){return[0,1]}set(i){const o=this.current;(i[0]!==o[0]||i[1]!==o[1]||this.dirty)&&(this.gl.depthRange(i[0],i[1]),this.current=i,this.dirty=!1)}}class Ps extends Ai{getDefault(){return!1}set(i){if(i===this.current&&!this.dirty)return;const o=this.gl;i?o.enable(o.DEPTH_TEST):o.disable(o.DEPTH_TEST),this.current=i,this.dirty=!1}}class ga extends Ai{getDefault(){return this.gl.LESS}set(i){(i!==this.current||this.dirty)&&(this.gl.depthFunc(i),this.current=i,this.dirty=!1)}}class oo extends Ai{getDefault(){return!1}set(i){if(i===this.current&&!this.dirty)return;const o=this.gl;i?o.enable(o.BLEND):o.disable(o.BLEND),this.current=i,this.dirty=!1}}class Mf extends Ai{getDefault(){const i=this.gl;return[i.ONE,i.ZERO,i.ONE,i.ZERO]}set(i){const o=this.current;(i[0]!==o[0]||i[1]!==o[1]||i[2]!==o[2]||i[3]!==o[3]||this.dirty)&&(this.gl.blendFuncSeparate(i[0],i[1],i[2],i[3]),this.current=i,this.dirty=!1)}}class bh extends Ai{getDefault(){return a.aq.transparent.toNonPremultipliedRenderColor(null)}set(i){const o=this.current;(i.r!==o.r||i.g!==o.g||i.b!==o.b||i.a!==o.a||this.dirty)&&(this.gl.blendColor(i.r,i.g,i.b,i.a),this.current=i,this.dirty=!1)}}class Pf extends Ai{getDefault(){return this.gl.FUNC_ADD}set(i){(i!==this.current||this.dirty)&&(this.gl.blendEquationSeparate(i,i),this.current=i,this.dirty=!1)}}class ya extends Ai{getDefault(){return!1}set(i){if(i===this.current&&!this.dirty)return;const o=this.gl;i?o.enable(o.CULL_FACE):o.disable(o.CULL_FACE),this.current=i,this.dirty=!1}}class Vc extends Ai{getDefault(){return this.gl.BACK}set(i){(i!==this.current||this.dirty)&&(this.gl.cullFace(i),this.current=i,this.dirty=!1)}}class Nc extends Ai{getDefault(){return this.gl.CCW}set(i){(i!==this.current||this.dirty)&&(this.gl.frontFace(i),this.current=i,this.dirty=!1)}}let wh=class extends Ai{getDefault(){return null}set(l){(l!==this.current||this.dirty)&&(this.gl.useProgram(l),this.current=l,this.dirty=!1)}};class Uc extends Ai{getDefault(){return this.gl.TEXTURE0}set(i){(i!==this.current||this.dirty)&&(this.gl.activeTexture(i),this.current=i,this.dirty=!1)}}class vl extends Ai{getDefault(){const i=this.gl;return[0,0,i.drawingBufferWidth,i.drawingBufferHeight]}set(i){const o=this.current;(i[0]!==o[0]||i[1]!==o[1]||i[2]!==o[2]||i[3]!==o[3]||this.dirty)&&(this.gl.viewport(i[0],i[1],i[2],i[3]),this.current=i,this.dirty=!1)}}class Df extends Ai{getDefault(){return null}set(i){if(i===this.current&&!this.dirty)return;const o=this.gl;o.bindFramebuffer(o.FRAMEBUFFER,i),this.current=i,this.dirty=!1}}class Rf extends Ai{getDefault(){return null}set(i){if(i===this.current&&!this.dirty)return;const o=this.gl;o.bindRenderbuffer(o.RENDERBUFFER,i),this.current=i,this.dirty=!1}}class zf extends Ai{getDefault(){return null}set(i){if(i===this.current&&!this.dirty)return;const o=this.gl;o.bindTexture(o.TEXTURE_2D,i),this.current=i,this.dirty=!1}}class xa extends Ai{getDefault(){return null}set(i){if(i===this.current&&!this.dirty)return;const o=this.gl;o.bindBuffer(o.ARRAY_BUFFER,i),this.current=i,this.dirty=!1}}class Lf extends Ai{getDefault(){return null}set(i){const o=this.gl;o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,i),this.current=i,this.dirty=!1}}class Vm extends Ai{getDefault(){return null}set(i){this.gl&&(i!==this.current||this.dirty)&&(this.gl.bindVertexArray(i),this.current=i,this.dirty=!1)}}class Nm extends Ai{getDefault(){return 4}set(i){if(i===this.current&&!this.dirty)return;const o=this.gl;o.pixelStorei(o.UNPACK_ALIGNMENT,i),this.current=i,this.dirty=!1}}class Um extends Ai{getDefault(){return!1}set(i){if(i===this.current&&!this.dirty)return;const o=this.gl;o.pixelStorei(o.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i),this.current=i,this.dirty=!1}}class Th extends Ai{getDefault(){return!1}set(i){if(i===this.current&&!this.dirty)return;const o=this.gl;o.pixelStorei(o.UNPACK_FLIP_Y_WEBGL,i),this.current=i,this.dirty=!1}}class bl extends Ai{constructor(i,o){super(i),this.context=i,this.parent=o}getDefault(){return null}}class va extends bl{constructor(i,o,u=0){super(i,o),this.attachmentPoint=i.gl.COLOR_ATTACHMENT0+u}setDirty(){this.dirty=!0}set(i){if(i===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const o=this.gl;o.framebufferTexture2D(o.FRAMEBUFFER,this.attachmentPoint,o.TEXTURE_2D,i,0),this.current=i,this.dirty=!1}}class jc extends bl{attachment(){return this.gl.DEPTH_ATTACHMENT}set(i){if(i===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const o=this.gl;o.framebufferRenderbuffer(o.FRAMEBUFFER,this.attachment(),o.RENDERBUFFER,i),this.current=i,this.dirty=!1}}class Ff extends bl{attachment(){return this.gl.DEPTH_ATTACHMENT}set(i){if(i===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const o=this.gl;o.framebufferTexture2D(o.FRAMEBUFFER,this.attachment(),o.TEXTURE_2D,i,0),this.current=i,this.dirty=!1}}class Of extends jc{attachment(){return this.gl.DEPTH_STENCIL_ATTACHMENT}}const jm=(l,i,o,u)=>({u_matrix:l,u_image0:0,u_image1:1,u_skirt_height:i,u_ground_shadow_factor:o,u_emissive_texture_available:u}),ba=(l,i,o,u,d,m,_,y,v,T,I,M,C,D,F,z,V)=>({u_proj_matrix:Float32Array.from(l),u_globe_matrix:i,u_normalize_matrix:Float32Array.from(u),u_merc_matrix:o,u_zoom_transition:d,u_merc_center:m,u_image0:0,u_image1:1,u_frustum_tl:_,u_frustum_tr:y,u_frustum_br:v,u_frustum_bl:T,u_globe_pos:I,u_globe_radius:M,u_viewport:C,u_grid_matrix:V?Float32Array.from(V):new Float32Array(9),u_skirt_height:D,u_far_z_cutoff:F,u_emissive_texture_available:z});function wa(l,i){return l!=null&&i!=null&&!(!l.hasData()||!i.hasData())&&l.demTexture!=null&&i.demTexture!=null&&l.tileID.key!==i.tileID.key}const Ds=new class{constructor(){this.operations={}}newMorphing(l,i,o,u,d){if(l in this.operations){const m=this.operations[l];m.to.tileID.key!==o.tileID.key&&(m.queued=o)}else this.operations[l]={startTime:u,phase:0,duration:d,from:i,to:o,queued:null}}getMorphValuesForProxy(l){if(!(l in this.operations))return null;const i=this.operations[l];return{from:i.from,to:i.to,phase:i.phase}}update(l){for(const i in this.operations){const o=this.operations[i];for(o.phase=(l-o.startTime)/o.duration;o.phase>=1||!this._validOp(o);)if(!this._nextOp(o,l)){delete this.operations[i];break}}}_nextOp(l,i){return!!l.queued&&(l.from=l.to,l.to=l.queued,l.queued=null,l.phase=0,l.startTime=i,!0)}_validOp(l){return l.from.hasData()&&l.to.hasData()}},on={0:null,1:"TERRAIN_VERTEX_MORPHING"};function Gc(l,i,o){if(i===0)return 0;const u=i<1&&o===514?.25/i:1;return 6*Math.pow(1.5,22-l)*Math.max(i,1)*u}function qc(l,i){const o=1<<l.z;return!i&&(l.x===0||l.x===o-1)||l.y===0||l.y===o-1}function Ta(l,i){if(!l.style||!l.style.enable3dLights())return;const o=l.context,u=o.gl;o.activeTexture.set(u.TEXTURE1),i?i.bind(u.LINEAR,u.CLAMP_TO_EDGE):l.emptyTexture.bind(u.LINEAR,u.CLAMP_TO_EDGE)}const wl=l=>({u_matrix:l});function Tl(l,i,o,u,d){if(d>0){const m=a.o.now(),_=(m-l.timeAdded)/d,y=i?(m-i.timeAdded)/d:-1,v=o.getSource(),T=u.coveringZoomLevel({tileSize:v.tileSize,roundZoom:v.roundZoom}),I=!i||Math.abs(i.tileID.overscaledZ-T)>Math.abs(l.tileID.overscaledZ-T),M=I&&l.refreshedUponExpiration?1:a.aC(I?_:1-y,0,1);return i?{opacity:1,mix:1-M,isFading:_<1}:{opacity:M,mix:0,isFading:_<1}}return{opacity:1,mix:0,isFading:!1}}class Sh extends pn{constructor(i){const o={type:"raster-dem",maxzoom:Math.ceil(i.transform.maxZoom)},u=gc("mock-dem",o,i.style.dispatcher,i.style);super("mock-dem",u,null),u.setEventedParent(this),this._sourceLoaded=!0}_loadTile(i,o){i.state="loaded",o(null)}}class $c extends pn{constructor(i){const o=gc("proxy",{type:"geojson",maxzoom:Math.ceil(i.transform.maxZoom)},i.style.dispatcher,i.style);super("proxy",o,null),o.setEventedParent(this),this.map=this.getSource().map=i,this.used=this._sourceLoaded=!0,this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}update(i,o,u){if(i.freezeTileCoverage)return;this.transform=i;const d=i.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}).reduce((m,_)=>{if(m[_.key]="",!this._tiles[_.key]){const y=new a.b1(_,this._source.tileSize*_.overscaleFactor(),i.tileZoom,void 0,void 0,this._source.worldview);y.state="loaded",this._tiles[_.key]=y}return m},{});for(const m in this._tiles)m in d||(this.freeFBO(m),this._tiles[m].unloadVectorData(),delete this._tiles[m])}freeFBO(i){const o=this.proxyCachedFBO[i];if(o!==void 0){const u=Object.values(o);this.renderCachePool.push(...u),delete this.proxyCachedFBO[i]}}deallocRenderCache(){this.renderCache.forEach(i=>i.fb.destroy()),this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}}class Hc extends a.aS{constructor(i,o,u){super(i.overscaledZ,i.wrap,i.canonical.z,i.canonical.x,i.canonical.y),this.proxyTileKey=o,this.projMatrix=u}}class Zc extends a.bv{constructor(i,o){super(),this._debugParams={sortTilesHiZFirst:!0,disableRenderCache:!1},this.painter=i,this.terrainTileForTile={},this.prevTerrainTileForTile={};const[u,d,m]=function(){const v=new a.dx,T=new a.dy,I=131;v.reserve(17161),T.reserve(33800);const M=a.an/128,C=a.an+M/2,D=C+M;for(let z=-M;z<D;z+=M)for(let V=-M;V<D;V+=M){const N=V<0||V>C||z<0||z>C?24575:0,$=a.aC(Math.round(V),0,a.an),H=a.aC(Math.round(z),0,a.an);v.emplaceBack($+N,H)}const F=(z,V)=>{const N=V*I+z;T.emplaceBack(N+1,N,N+I),T.emplaceBack(N+I,N+I+1,N+1)};for(let z=1;z<129;z++)for(let V=1;V<129;V++)F(V,z);return[0,129].forEach(z=>{for(let V=0;V<130;V++)F(V,z),F(z,V)}),[v,T,32768]}(),_=i.context;this.gridBuffer=_.createVertexBuffer(u,a.dt.members),this.gridIndexBuffer=_.createIndexBuffer(d),this.gridSegments=a.du.simpleSegment(0,0,u.length,d.length),this.gridNoSkirtSegments=a.du.simpleSegment(0,0,u.length,m),this.proxyCoords=[],this.proxiedCoords={},this._visibleDemTiles=[],this._drapedRenderBatches=[],this._sourceTilesOverlap={},this.proxySourceCache=new $c(o.map),this.orthoMatrix=a.bc(),a.bU(this.orthoMatrix,this.painter.transform.projection.name==="globe"?.015:0,a.an,0,a.an,0,1);const y=_.gl;this._overlapStencilMode=new st({func:y.GEQUAL,mask:255},0,255,y.KEEP,y.KEEP,y.REPLACE),this._previousZoom=i.transform.zoom,this.pool=[],this._findCoveringTileCache={},this._tilesDirty={},this.style=o,this._useVertexMorphing=!0,this._exaggeration=1,this._mockSourceCache=new Sh(o.map),this._pendingGroundEffectLayers=[],this._emissiveTexture=!1}set style(i){i.on("data",this._onStyleDataEvent.bind(this)),this._style=i,this._style.map.on("moveend",()=>{this._clearLineLayersFromRenderCache()})}update(i,o,u){if(i&&i.terrain){this._style!==i&&(this.style=i,this._evaluationZoom=void 0);const d=i.terrain.properties,m=i.terrain.drapeRenderMode===0,_=i.terrain.isZoomDependent();this._previousUpdateTimestamp=this.enabled?this._updateTimestamp:void 0,this._updateTimestamp=a.o.now();const y=i.terrain&&i.terrain.scope,v=d.get("source"),T=m?this._mockSourceCache:i.getSourceCache(v,y);if(!T)return void a.w(`Couldn't find terrain source "${v}".`);if(this.sourceCache=T,this._attenuationRange=i.terrain.getAttenuationRange(),this._exaggeration=_?this.calculateExaggeration(o):d.get("exaggeration"),!o.projection.requiresDraping&&_&&this._exaggeration===0)return void this._disable();this.enabled=!0;const I=()=>{this.sourceCache.used&&a.w(`Raster DEM source '${this.sourceCache.id}' is used both for terrain and as layer source.
3250This leads to lower resolution of hillshade. For full hillshade resolution but higher memory consumption, define another raster DEM source.`);const M=this.getScaledDemTileSize();this.sourceCache.update(o,M,!0),this.resetTileLookupCache(this.sourceCache.id)};this.sourceCache.usedForTerrain||(this.resetTileLookupCache(this.sourceCache.id),this.sourceCache.usedForTerrain=!0,I(),this._initializing=!0),I(),o.updateElevation(!0,u),this.resetTileLookupCache(this.proxySourceCache.id),this.proxySourceCache.update(o),this._emptyDEMTextureDirty=!0,this._previousZoom=o.zoom}else this._disable()}calculateExaggeration(i){if(this._attenuationRange&&i.zoom>=Math.ceil(this._attenuationRange[1]))return this._style.terrain.getExaggeration(i.zoom);const o=this._previousCameraAltitude,u=i.getFreeCameraOptions().position.z/i.pixelsPerMeter*i.worldSize;this._previousCameraAltitude=u;const d=o!=null?u-o:Number.MAX_VALUE;if(Math.abs(d)<2)return this._exaggeration;const m=i.zoom,_=this._style.terrain;if(!this._previousUpdateTimestamp)return _.getExaggeration(m);let y=m-this._previousZoom;const v=this._previousUpdateTimestamp;let T=m;this._evaluationZoom!=null&&(T=this._evaluationZoom,Math.abs(m-T)>.5&&(y=.5*(m-T+y)),y*d<0&&(T+=y)),this._evaluationZoom=T;const I=_.getExaggeration(T),M=I===_.getExaggeration(Math.max(0,T-.1));if(M&&Math.abs(I-this._exaggeration)<.01)return I;let C=Math.min(.1,.00375*(this._updateTimestamp-v));return(M||I<.1||Math.abs(y)<1e-4)&&(C=Math.min(.2,4*C)),a.am(this._exaggeration,I,C)}resetTileLookupCache(i){this._findCoveringTileCache[i]={}}attenuationRange(){return this._attenuationRange}getDemUpscale(){return this.proxySourceCache.getSource().tileSize/128}getScaledDemTileSize(){return this.sourceCache.getSource().tileSize/128*this.proxySourceCache.getSource().tileSize}_onStyleDataEvent(i){i.dataType==="source"&&i.coord?this._clearRenderCacheForTile(i.sourceCacheId,i.coord):i.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 i in this._style._mergedSourceCaches)this._style._mergedSourceCaches[i].usedForTerrain=!1}destroy(){this._disable(),this._emptyDEMTexture&&this._emptyDEMTexture.destroy(),this.pool.forEach(i=>i.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 i=2*this.proxySourceCache.getSource().tileSize;return[i,i]}set useVertexMorphing(i){this._useVertexMorphing=i}updateTileBinding(i){if(!this.enabled)return;this.prevTerrainTileForTile=this.terrainTileForTile;const o=this.proxySourceCache,u=this.painter.transform;this._initializing&&(this._initializing=u._centerAltitude===0&&this.getAtPointOrZero(a.ag.fromLngLat(u.center),-1)===-1,this._emptyDEMTextureDirty=!this._initializing);const d=this.proxyCoords=o.getIds().map(v=>{const T=o.getTileByID(v).tileID;return T.projMatrix=u.calculateProjMatrix(T.toUnwrapped()),T});(function(v,T){const I=T.transform.pointCoordinate(T.transform.getCameraPoint()),M=new a.P(I.x,I.y);v.sort((C,D)=>{if(D.overscaledZ-C.overscaledZ)return D.overscaledZ-C.overscaledZ;const F=new a.P(C.canonical.x+(1<<C.canonical.z)*C.wrap,C.canonical.y),z=new a.P(D.canonical.x+(1<<D.canonical.z)*D.wrap,D.canonical.y),V=M.mult(1<<C.canonical.z);return V.x-=.5,V.y-=.5,V.distSqr(F)-V.distSqr(z)})})(d,this.painter);const m=this.proxyToSource||{};this.proxyToSource={},d.forEach(v=>{this.proxyToSource[v.key]={}}),this.terrainTileForTile={};const _=this._style._mergedSourceCaches;for(const v in _){const T=_[v];if(!T.used||(T!==this.sourceCache&&this.resetTileLookupCache(T.id),this._setupProxiedCoordsForOrtho(T,i[v],m),T.usedForTerrain))continue;const I=i[v];(T.getSource().reparseOverscaled||T._isRasterElevatedOverTerrain)&&this._assignTerrainTiles(I)}this.proxiedCoords[o.id]=d.map(v=>new Hc(v,v.key,this.orthoMatrix)),this._assignTerrainTiles(d),this._prepareDEMTextures(),this._setupDrapedRenderBatches(),this._initFBOPool(),this._setupRenderCache(m),this.renderingToTexture=!1;const y={};this._visibleDemTiles=[];for(const v of this.proxyCoords){const T=this.terrainTileForTile[v.key];if(!T)continue;const I=T.tileID.key;I in y||(this._visibleDemTiles.push(T),y[I]=I)}}_assignTerrainTiles(i){this._initializing||i.forEach(o=>{if(this.terrainTileForTile[o.key])return;const u=this._findTileCoveringTileID(o,this.sourceCache);u&&(this.terrainTileForTile[o.key]=u)})}_prepareDEMTextures(){const i=this.painter.context,o=i.gl;for(const u in this.terrainTileForTile){const d=this.terrainTileForTile[u],m=d.dem;!m||d.demTexture&&!d.needsDEMTextureUpload||(i.activeTexture.set(o.TEXTURE1),Ef(this.painter,d,m))}}_prepareDemTileUniforms(i,o,u,d){if(!o||o.demTexture==null)return!1;const m=i.tileID.canonical,_=Math.pow(2,o.tileID.canonical.z-m.z),y=d||"";return u[`u_dem_tl${y}`]=[m.x*_%1,m.y*_%1],u[`u_dem_scale${y}`]=_,!0}get emptyDEMTexture(){return!this._emptyDEMTextureDirty&&this._emptyDEMTexture?this._emptyDEMTexture:this._updateEmptyDEMTexture()}_getLoadedAreaMinimum(){if(!this.enabled)return 0;let i=0;const o=this._visibleDemTiles.reduce((u,d)=>{if(!d.dem)return u;const m=d.dem.tree.minimums[0];return m>0&&i++,u+m},0);return i?o/i:0}_updateEmptyDEMTexture(){const i=this.painter.context,o=i.gl;i.activeTexture.set(o.TEXTURE2);const u=this._getLoadedAreaMinimum(),d=new a.dv({width:1,height:1},new Float32Array([u]));this._emptyDEMTextureDirty=!1;let m=this._emptyDEMTexture;return m?m.update(d,{premultiply:!1}):m=this._emptyDEMTexture=new a.T(i,d,o.R32F,{premultiply:!1}),m}setupElevationDraw(i,o,u){const d=this.painter.context,m=d.gl,_={u_dem:2,u_dem_prev:4,u_dem_tl:[0,0],u_dem_tl_prev:[0,0],u_dem_scale:0,u_dem_scale_prev:0,u_dem_size:0,u_dem_lerp:1,u_depth:3,u_depth_size_inv:[0,0],u_depth_range_unpack:[0,1],u_occluder_half_size:16,u_occlusion_depth_offset:-1e-4,u_exaggeration:0};_.u_exaggeration=this.exaggeration();let y=null,v=null,T=1;if(u&&u.morphing&&this._useVertexMorphing){const D=u.morphing.srcDemTile,F=u.morphing.dstDemTile;T=u.morphing.phase,D&&F&&(this._prepareDemTileUniforms(i,D,_,"_prev")&&(v=D),this._prepareDemTileUniforms(i,F,_)&&(y=F))}const I=D=>D&&D.demTexture&&this.painter.linearFloatFilteringSupported()?m.LINEAR:m.NEAREST;let M=null;var C;if(this.enabled?v&&y?(M=y.demTexture,d.activeTexture.set(m.TEXTURE4),v.demTexture.bind(I(v),m.CLAMP_TO_EDGE),_.u_dem_lerp=T):(y=this.terrainTileForTile[i.tileID.key],M=this._prepareDemTileUniforms(i,y,_)?y.demTexture:this.emptyDEMTexture):M=this.emptyDEMTexture,d.activeTexture.set(m.TEXTURE2),M&&(_.u_dem_size=(C=M).size[0]===1?1:C.size[0]-2,M.bind(I(y),m.CLAMP_TO_EDGE)),this.painter.setupDepthForOcclusion(u&&u.useDepthForOcclusion,o,_),u&&u.useMeterToDem&&y){const D=(1<<y.tileID.canonical.z)*a.bV(1,this.painter.transform.center.lat)*this.sourceCache.getSource().tileSize;_.u_meter_to_dem=D}if(u&&u.labelPlaneMatrixInv&&(_.u_label_plane_matrix_inv=u.labelPlaneMatrixInv),o.setTerrainUniformValues(d,_),this.painter.transform.projection.name==="globe"){const D=this.globeUniformValues(this.painter.transform,i.tileID.canonical,u&&u.useDenormalizedUpVectorScale);o.setGlobeUniformValues(d,D)}}globeUniformValues(i,o,u){const d=i.projection;return{u_tile_tl_up:d.upVector(o,0,0),u_tile_tr_up:d.upVector(o,a.an,0),u_tile_br_up:d.upVector(o,a.an,a.an),u_tile_bl_up:d.upVector(o,0,a.an),u_tile_up_scale:u?a.dw(1):d.upVectorScale(o,i.center.lat,i.worldSize).metersToTile}}renderToBackBuffer(i){const o=this.painter,u=this.painter.context;i.length!==0&&(u.bindFramebuffer.set(null),u.viewport.set([0,0,o.width,o.height]),o.gpuTimingDeferredRenderStart(),this.renderingToTexture=!1,function(d,m,_,y,v){if(d.transform.projection.name==="globe")(function(T,I,M,C,D){const F=T.context,z=F.gl;let V,N;const $=T.transform,H=a.dk(T,F,$),j=(be,_e)=>{if(N===_e)return;const Me=[on[_e],"PROJECTION_GLOBE_VIEW"];H&&Me.push("CUSTOM_ANTIALIASING");const Le=T.isTileAffectedByFog(be);V=T.getOrCreateProgram("globeRaster",{defines:Me,overrideFog:Le}),N=_e},ne=T.colorModeForRenderPass(),Y=new rt(z.LEQUAL,rt.ReadWrite,T.depthRangeFor3D);Ds.update(D);const re=a.dl($),Z=[a.aH($.center.lng),a.aL($.center.lat)],K=T.globeSharedBuffers,te=[$.width*a.o.devicePixelRatio,$.height*a.o.devicePixelRatio],de=Float32Array.from($.globeMatrix),se={useDenormalizedUpVectorScale:!0};{const be=T.transform,_e=Gc(be.zoom,I.exaggeration(),I.sourceCache._source.tileSize);N=-1;const Me=z.TRIANGLES;for(const Le of C){const fe=M.getTile(Le),le=st.disabled,xe=I.prevTerrainTileForTile[Le.key],we=I.terrainTileForTile[Le.key];wa(xe,we)&&Ds.newMorphing(Le.key,xe,we,D,250),Ta(T,fe.emissiveTexture),F.activeTexture.set(z.TEXTURE0),fe.texture&&fe.texture.bind(z.LINEAR,z.CLAMP_TO_EDGE);const Se=Ds.getMorphValuesForProxy(Le.key),$e=Se?1:0;Se&&Object.assign(se,{morphing:{srcDemTile:Se.from,dstDemTile:Se.to,phase:a.dj(Se.phase)}});const Ve=a.dm(Le.canonical),Ne=a.dn(Ve.getCenter().lat),De=a.dp(Le.canonical,Ve,Ne,be.worldSize/be._pixelsPerMercatorPixel),tt=a.dq(a.dr(Le.canonical)),ot=T.emissiveMode==="mrt-fallback"?1:0,Ke=ba(be.expandedFarZProjMatrix,de,re,tt,a.al(be.zoom),Z,be.frustumCorners.TL,be.frustumCorners.TR,be.frustumCorners.BR,be.frustumCorners.BL,be.globeCenterInViewSpace,be.globeRadius,te,_e,be._farZ,ot,De);if(j(Le,$e),V&&(I.setupElevationDraw(fe,V,se),T.uploadCommonUniforms(F,V,Le.toUnwrapped()),K)){const[et,_t,xt]=K.getGridBuffers(Ne,_e!==0);V.draw(T,Me,Y,le,ne,pt.backCCW,Ke,"globe_raster",et,_t,xt)}}}if(K&&(T.renderDefaultNorthPole||T.renderDefaultSouthPole)){const be=["GLOBE_POLES","PROJECTION_GLOBE_VIEW"];H&&be.push("CUSTOM_ANTIALIASING"),V=T.getOrCreateProgram("globeRaster",{defines:be});for(const _e of C){const{x:Me,y:Le,z:fe}=_e.canonical,le=Le===0,xe=Le===(1<<fe)-1,[we,Se,$e,Ve]=K.getPoleBuffers(fe,!1);if(Ve&&(le||xe)){const Ne=M.getTile(_e);Ta(T,Ne.emissiveTexture),F.activeTexture.set(z.TEXTURE0),Ne.texture&&Ne.texture.bind(z.LINEAR,z.CLAMP_TO_EDGE);let De=a.ds(fe,Me,$);const tt=a.dq(a.dr(_e.canonical)),ot=T.emissiveMode==="mrt-fallback"?1:0,Ke=(et,_t)=>et.draw(T,z.TRIANGLES,Y,st.disabled,ne,pt.disabled,ba($.expandedFarZProjMatrix,De,De,tt,0,Z,$.frustumCorners.TL,$.frustumCorners.TR,$.frustumCorners.BR,$.frustumCorners.BL,$.globeCenterInViewSpace,$.globeRadius,te,0,$._farZ,ot),"globe_pole_raster",_t,$e,Ve);I.setupElevationDraw(Ne,V,se),T.uploadCommonUniforms(F,V,_e.toUnwrapped()),le&&T.renderDefaultNorthPole&&Ke(V,we),xe&&T.renderDefaultSouthPole&&(De=a.cx(a.bc(),De,[1,-1,1]),Ke(V,Se))}}}})(d,m,_,y,v);else{const T=d.context,I=T.gl;let M,C;const D=d.shadowRenderer,F=no(d,d.longestCutoffRange),z=ne=>{if(C===ne)return;const Y=[];Y.push(on[ne]),F.shouldRenderCutoff&&Y.push("RENDER_CUTOFF"),D&&(Y.push("RENDER_SHADOWS"),D.useNormalOffset&&Y.push("NORMAL_OFFSET")),M=d.getOrCreateProgram("terrainRaster",{defines:Y}),C=ne},V=d.colorModeForRenderPass(),N=new rt(I.LEQUAL,rt.ReadWrite,d.depthRangeFor3D);Ds.update(v);const $=d.transform,H=Gc($.zoom,m.exaggeration(),m.sourceCache._source.tileSize);let j=[0,0,0];if(D){const ne=d.style.directionalLight,Y=d.style.ambientLight;ne&&Y&&(j=As(d.style,ne,Y))}{C=-1;const ne=I.TRIANGLES,[Y,re]=[m.gridIndexBuffer,m.gridSegments];for(const Z of y){const K=_.getTile(Z),te=st.disabled,de=m.prevTerrainTileForTile[Z.key],se=m.terrainTileForTile[Z.key];wa(de,se)&&Ds.newMorphing(Z.key,de,se,v,250),Ta(d,K.emissiveTexture),T.activeTexture.set(I.TEXTURE0),K.texture&&K.texture.bind(I.LINEAR,I.CLAMP_TO_EDGE);const be=Ds.getMorphValuesForProxy(Z.key),_e=be?1:0;let Me;be&&(Me={morphing:{srcDemTile:be.from,dstDemTile:be.to,phase:a.dj(be.phase)}});const Le=d.emissiveMode==="mrt-fallback"?1:0,fe=jm(Z.projMatrix,qc(Z.canonical,$.renderWorldCopies)?H/10:H,j,Le);if(z(_e),!M)continue;m.setupElevationDraw(K,M,Me);const le=Z.toUnwrapped();D&&D.setupShadows(le,M),d.uploadCommonUniforms(T,M,le,null,F),M.draw(d,ne,N,te,V,pt.backCCW,fe,"terrain_raster",m.gridBuffer,Y,re)}}}}(o,this,this.proxySourceCache,i,this._updateTimestamp),this.renderingToTexture=!0,o.gpuTimingDeferredRenderEnd(),i.splice(0,i.length))}renderBatch(i){if(this._drapedRenderBatches.length===0)return i+1;this.renderingToTexture=!0;const o=this.painter,u=this.painter.context,d=this.proxySourceCache,m=this.proxiedCoords[d.id],_=this._drapedRenderBatches.shift(),y=o.style.order,v=[];this._updateFBOs(o.emissiveMode==="mrt-fallback");let T=0;for(const I of m){const M=d.getTileByID(I.proxyTileKey),C=d.proxyCachedFBO[I.key]?d.proxyCachedFBO[I.key][i]:void 0,D=C!==void 0?d.renderCache[C]:this.pool[T++],F=C!==void 0;if(M.texture=D.tex,M.emissiveTexture=D.emissiveTex,F&&!D.dirty){v.push(M.tileID);continue}u.bindFramebuffer.set(D.fb.framebuffer);const z=u.gl;let V;z.drawBuffers(o.emissiveMode==="mrt-fallback"?[z.COLOR_ATTACHMENT0,z.COLOR_ATTACHMENT1]:[z.COLOR_ATTACHMENT0]),this.renderedToTile=!1,D.dirty&&(u.clear({color:a.aq.transparent,stencil:0}),D.dirty=!1);for(let N=_.start;N<=_.end;++N){const $=o.style._mergedLayers[y[N]];if($.isHidden(o.transform.zoom))continue;const H=o.style.getLayerSourceCache($),j=H?this.proxyToSource[I.key][H.id]:[I];if(!j)continue;const ne=j;u.viewport.set([0,0,D.fb.width,D.fb.height]),V!==(H?H.id:null)&&(this._setupStencil(D,j,$,H),V=H?H.id:null),o.renderLayer(o,H,$,ne)}if(z.drawBuffers([z.COLOR_ATTACHMENT0]),this._drapedRenderBatches.length===0)for(const N of this._pendingGroundEffectLayers){const $=o.style._mergedLayers[y[N]];if($.isHidden(o.transform.zoom))continue;const H=o.style.getLayerSourceCache($),j=H?this.proxyToSource[I.key][H.id]:[I];if(!j)continue;const ne=j;u.viewport.set([0,0,D.fb.width,D.fb.height]),V!==(H?H.id:null)&&(this._setupStencil(D,j,$,H),V=H?H.id:null),o.renderLayer(o,H,$,ne)}this.renderedToTile?(D.dirty=!0,v.push(M.tileID)):F||--T,T===5&&(T=0,this.renderToBackBuffer(v))}return this.renderToBackBuffer(v),this.renderingToTexture=!1,u.bindFramebuffer.set(null),u.viewport.set([0,0,o.width,o.height]),_.end+1}postRender(){}isLayerOrderingCorrect(i){const o=i.order.length;let u=-1,d=o;for(let m=0;m<o;++m)this._style.isLayerDraped(i._mergedLayers[i.order[m]])?u=Math.max(u,m):d=Math.min(d,m);return d>u}getMinElevationBelowMSL(){let i=0;return this._visibleDemTiles.filter(o=>o.dem).forEach(o=>{i=Math.min(i,o.dem.tree.minimums[0])}),i===0?i:(i-30)*this._exaggeration}raycast(i,o,u){if(!this._visibleDemTiles)return null;const d=this._visibleDemTiles.filter(m=>m.dem).map(m=>{const _=m.tileID,y=1<<_.overscaledZ,{x:v,y:T}=_.canonical,I=v/y,M=(v+1)/y,C=T/y,D=(T+1)/y;return{minx:I,miny:C,maxx:M,maxy:D,t:m.dem.tree.raycastRoot(I,C,M,D,i,o,u),tile:m}});d.sort((m,_)=>(m.t!==null?m.t:Number.MAX_VALUE)-(_.t!==null?_.t:Number.MAX_VALUE));for(const m of d){if(m.t==null)return null;const _=m.tile.dem.tree.raycast(m.minx,m.miny,m.maxx,m.maxy,i,o,u);if(_!=null)return _}return null}_createFBO(){const i=this.painter.context,o=i.gl,u=this.drapeBufferSize;i.activeTexture.set(o.TEXTURE0);const d=new a.T(i,{width:u[0],height:u[1],data:null},o.RGBA8);d.bind(o.LINEAR,o.CLAMP_TO_EDGE);const m=i.createFramebuffer(u[0],u[1],1,null);let _;return m.colorAttachment0.set(d.texture),this._emissiveTexture&&(_=new a.T(i,{width:u[0],height:u[1],data:null},o.R8),_.bind(o.LINEAR,o.CLAMP_TO_EDGE),m.createColorAttachment(i,1),m.colorAttachment1.set(_.texture)),m.depthAttachment=new Of(i,m.framebuffer),this._sharedDepthStencil===void 0?(this._sharedDepthStencil=i.createRenderbuffer(i.gl.DEPTH_STENCIL,u[0],u[1]),this._stencilRef=0,m.depthAttachment.set(this._sharedDepthStencil),i.clear({stencil:0})):m.depthAttachment.set(this._sharedDepthStencil),i.extTextureFilterAnisotropic&&o.texParameterf(o.TEXTURE_2D,i.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,i.extTextureFilterAnisotropicMax),{fb:m,tex:d,emissiveTex:_,dirty:!1}}_updateFBOs(i){if(this._emissiveTexture!==i){for(const o of this.pool)this._updateFBO(o,i);for(const o of this.proxySourceCache.renderCache)this._updateFBO(o,i);this._emissiveTexture=i}}_updateFBO(i,o){const u=i.fb,d=this.painter.context,m=d.gl,_=this.drapeBufferSize;if(o){const y=new a.T(d,{width:_[0],height:_[1],data:null},m.R8);y.bind(m.LINEAR,m.CLAMP_TO_EDGE),i.emissiveTex=y,u.createColorAttachment(d,1),u.colorAttachment1.set(y.texture)}else i.emissiveTex=void 0,u.removeColorAttachment(d,1);i.dirty=!0}_initFBOPool(){for(;this.pool.length<Math.min(5,this.proxyCoords.length);)this.pool.push(this._createFBO())}_shouldDisableRenderCache(){if(this._debugParams.disableRenderCache||this._style.hasLightTransitions())return!0;for(const i in this._style._mergedSourceCaches)if(this._style._mergedSourceCaches[i].hasTransition())return!0;return this._style.order.some(i=>{const o=this._style._mergedLayers[i],u=o.isHidden(this.painter.transform.zoom);return o.type==="hillshade"||o.type==="custom"?!u&&o.shouldRedrape():!u&&o.hasTransition()})}_clearLineLayersFromRenderCache(){let i=!1;for(const u of this._style.getSources())if(u instanceof Ss){i=!0;break}if(!i)return;const o={};for(let u=0;u<this._style.order.length;++u){const d=this._style._mergedLayers[this._style.order[u]],m=this._style.getLayerSourceCache(d);if(!m||o[m.id]||d.isHidden(this.painter.transform.zoom)||d.type!=="line")continue;const _=d.widthExpression(),y=d.emissiveStrengthExpression();if(_ instanceof a.af||y instanceof a.af){o[m.id]=!0;for(const v of this.proxyCoords){const T=this.proxyToSource[v.key][m.id];if(T)for(const I of T)this._clearRenderCacheForTile(m.id,I)}}}}_clearRasterLayersFromRenderCache(){let i=!1;for(const u in this._style._mergedSourceCaches)if(this._style._mergedSourceCaches[u]._source instanceof fn){i=!0;break}if(!i)return;const o={};for(let u=0;u<this._style.order.length;++u){const d=this._style._mergedLayers[this._style.order[u]],m=this._style.getLayerSourceCache(d);if(!m||o[m.id]||d.isHidden(this.painter.transform.zoom)||d.type!=="raster")continue;const _=d.paint.get("raster-fade-duration");for(const y of this.proxyCoords){const v=this.proxyToSource[y.key][m.id];if(v)for(const T of v){const I=Tl(m.getTile(T),m.findLoadedParent(T,0),m,this.painter.transform,_);(I.opacity!==1||I.mix!==0)&&this._clearRenderCacheForTile(m.id,T)}}}}_setupDrapedRenderBatches(){this._style.updateDrapeFirstLayers();const i=this._style.order,o=i.length;if(o===0)return;const u=[];this._pendingGroundEffectLayers=[];let d,m=0,_=this._style._mergedLayers[i[m]];for(;!this._style.isLayerDraped(_)&&_.isHidden(this.painter.transform.zoom)&&++m<o;)_=this._style._mergedLayers[i[m]];for(;m<o;++m){const y=this._style._mergedLayers[i[m]];y.isHidden(this.painter.transform.zoom)||(this._style.isLayerDraped(y)?d===void 0&&(d=m):(y.type==="fill-extrusion"&&this._pendingGroundEffectLayers.push(m),d!==void 0&&(u.push({start:d,end:m-1}),d=void 0)))}if(d!==void 0&&u.push({start:d,end:m-1}),u.length!==0){const y=u[u.length-1];this._pendingGroundEffectLayers.every(v=>v>y.end)||a.w("fill-extrusion with flood lighting and/or ground ambient occlusion should be moved to be on top of all draped layers.")}this._drapedRenderBatches=u}_setupRenderCache(i){const o=this.proxySourceCache;if(this._shouldDisableRenderCache()||this.invalidateRenderCache){if(this.invalidateRenderCache=!1,o.renderCache.length>o.renderCachePool.length){const _=Object.values(o.proxyCachedFBO);o.proxyCachedFBO={};for(let y=0;y<_.length;++y){const v=Object.values(_[y]);o.renderCachePool.push(...v)}}return}this._clearRasterLayersFromRenderCache();const u=this.proxyCoords,d=this._tilesDirty;for(let _=u.length-1;_>=0;_--){const y=u[_];if(o.getTileByID(y.key),o.proxyCachedFBO[y.key]!==void 0){const v=i[y.key],T=this.proxyToSource[y.key];let I=0;for(const M in T){const C=T[M],D=v[M];if(!D||D.length!==C.length||C.some((F,z)=>F!==D[z]||d[M]&&d[M].hasOwnProperty(F.key))){I=-1;break}++I}for(const M in o.proxyCachedFBO[y.key])o.renderCache[o.proxyCachedFBO[y.key][M]].dirty=I<0||I!==Object.values(v).length}}const m=[...this._drapedRenderBatches];m.sort((_,y)=>y.end-y.start-(_.end-_.start));for(const _ of m)for(const y of u){if(o.proxyCachedFBO[y.key])continue;let v=o.renderCachePool.pop();v===void 0&&o.renderCache.length<50&&(v=o.renderCache.length,o.renderCache.push(this._createFBO())),v!==void 0&&(o.proxyCachedFBO[y.key]={},o.proxyCachedFBO[y.key][_.start]=v,o.renderCache[v].dirty=!0)}this._tilesDirty={}}_setupStencil(i,o,u,d){if(!d||!this._sourceTilesOverlap[d.id])return void(this._overlapStencilType&&(this._overlapStencilType=!1));const m=this.painter.context,_=m.gl;if(o.length<=1)return void(this._overlapStencilType=!1);let y;if(u.isTileClipped())y=o.length,this._overlapStencilMode.test={func:_.EQUAL,mask:255},this._overlapStencilType="Clip";else{if(!(o[0].overscaledZ>o[o.length-1].overscaledZ))return void(this._overlapStencilType=!1);y=1,this._overlapStencilMode.test={func:_.GREATER,mask:255},this._overlapStencilType="Mask"}this._stencilRef+y>255&&(m.clear({stencil:0}),this._stencilRef=0),this._stencilRef+=y,this._overlapStencilMode.ref=this._stencilRef,u.isTileClipped()&&this._renderTileClippingMasks(o,this._overlapStencilMode.ref)}clipOrMaskOverlapStencilType(){return this._overlapStencilType==="Clip"||this._overlapStencilType==="Mask"}stencilModeForRTTOverlap(i){return this.renderingToTexture&&this._overlapStencilType?(this._overlapStencilType==="Clip"&&(this._overlapStencilMode.ref=this.painter._tileClippingMaskIDs[i.key]),this._overlapStencilMode):st.disabled}_renderTileClippingMasks(i,o){const u=this.painter,d=this.painter.context,m=d.gl;u._tileClippingMaskIDs={},d.setColorMode(ct.disabled),d.setDepthMode(rt.disabled);const _=u.getOrCreateProgram("clippingMask");for(const y of i){const v=u._tileClippingMaskIDs[y.key]=--o;_.draw(u,m.TRIANGLES,rt.disabled,new st({func:m.ALWAYS,mask:0},v,255,m.KEEP,m.KEEP,m.REPLACE),ct.disabled,pt.disabled,wl(y.projMatrix),"$clipping",u.tileExtentBuffer,u.quadTriangleIndexBuffer,u.tileExtentSegments)}}pointCoordinate(i){const o=this.painter.transform;if(i.x<0||i.x>o.width||i.y<0||i.y>o.height)return null;const u=[i.x,i.y,1,1];a.aE(u,u,o.pixelMatrixInverse),a.cp(u,u,1/u[3]),u[0]/=o.worldSize,u[1]/=o.worldSize;const d=o._camera.position,m=a.bV(1,o.center.lat),_=[d[0],d[1],d[2]/m,0],y=a.cR([],u.slice(0,3),_);a.ay(y,y);const v=this.raycast(_,y,this._exaggeration);return v!==null&&v?(a.bh(_,_,y,v),_[3]=_[2],_[2]*=m,_):null}_setupProxiedCoordsForOrtho(i,o,u){if(i.getSource()instanceof a.aW)return this._setupProxiedCoordsForImageSource(i,o,u);this._findCoveringTileCache[i.id]=this._findCoveringTileCache[i.id]||{};const d=this.proxiedCoords[i.id]=[],m=this.proxyCoords;for(let v=0;v<m.length;v++){const T=m[v],I=this._findTileCoveringTileID(T,i);if(I){const M=this._createProxiedId(T,I,u[T.key]&&u[T.key][i.id]);d.push(M),this.proxyToSource[T.key][i.id]=[M]}}let _=!1;const y=new Set;for(let v=0;v<o.length;v++){const T=i.getTile(o[v]);if(!T||!T.hasData())continue;const I=this._findTileCoveringTileID(T.tileID,this.proxySourceCache);if(I&&I.tileID.canonical.z!==T.tileID.canonical.z){const M=this.proxyToSource[I.tileID.key][i.id],C=this._createProxiedId(I.tileID,T,u[I.tileID.key]&&u[I.tileID.key][i.id]);M?M.splice(M.length-1,0,C):this.proxyToSource[I.tileID.key][i.id]=[C];const D=this.proxyToSource[I.tileID.key][i.id];y.has(D)||y.add(D),d.push(C),_=!0}}if(this._sourceTilesOverlap[i.id]=_,_&&this._debugParams.sortTilesHiZFirst)for(const v of y)v.sort((T,I)=>I.overscaledZ-T.overscaledZ)}_setupProxiedCoordsForImageSource(i,o,u){if(!i.getSource().loaded())return;const d=this.proxiedCoords[i.id]=[],m=this.proxyCoords,_=i.getSource(),y=_.tileID;if(!y)return;const v=new a.P(y.x,y.y)._div(1<<y.z),T=_.coordinates.map(a.ag.fromLngLat).reduce((M,C)=>(M.min.x=Math.min(M.min.x,C.x-v.x),M.min.y=Math.min(M.min.y,C.y-v.y),M.max.x=Math.max(M.max.x,C.x-v.x),M.max.y=Math.max(M.max.y,C.y-v.y),M),{min:new a.P(Number.MAX_VALUE,Number.MAX_VALUE),max:new a.P(-Number.MAX_VALUE,-Number.MAX_VALUE)}),I=(M,C)=>{const D=M.wrap+M.canonical.x/(1<<M.canonical.z),F=M.canonical.y/(1<<M.canonical.z),z=a.an/(1<<M.canonical.z),V=C.wrap+C.canonical.x/(1<<C.canonical.z),N=C.canonical.y/(1<<C.canonical.z);return D+z<V+T.min.x||D>V+T.max.x||F+z<N+T.min.y||F>N+T.max.y};for(let M=0;M<m.length;M++){const C=m[M];for(let D=0;D<o.length;D++){const F=i.getTile(o[D]);if(!F||!F.hasData()||I(C,F.tileID))continue;const z=this._createProxiedId(C,F,u[C.key]&&u[C.key][i.id]),V=this.proxyToSource[C.key][i.id];V?V.push(z):this.proxyToSource[C.key][i.id]=[z],d.push(z)}}}_createProxiedId(i,o,u){let d=this.orthoMatrix;if(u){const m=u.find(_=>_.key===o.tileID.key);if(m)return m}if(o.tileID.key!==i.key){const m=i.canonical.z-o.tileID.canonical.z;let _,y,v;d=a.bc();const T=o.tileID.wrap-i.wrap<<i.overscaledZ;m>0?(_=a.an>>
3250m,y=_*((o.tileID.canonical.x<<m)-i.canonical.x+T),v=_*((o.tileID.canonical.y<<m)-i.canonical.y)):(_=a.an<<-m,y=a.an*(o.tileID.canonical.x-(i.canonical.x+T<<-m)),v=a.an*(o.tileID.canonical.y-(i.canonical.y<<-m))),a.bU(d,0,_,0,_,0,1),a.by(d,d,[y,v,0])}return new Hc(o.tileID,i.key,d)}_findTileCoveringTileID(i,o){let u=o.getTile(i);if(u&&u.hasData())return u;const d=this._findCoveringTileCache[o.id],m=d[i.key];if(u=m?o.getTileByID(m):null,u&&u.hasData()||m===null)return u;let _=u?u.tileID:i,y=_.overscaledZ;const v=o.getSource().minzoom,T=[];if(!m){const M=o.getSource().maxzoom;if(i.canonical.z>=M){const C=i.canonical.z-M;o.getSource().reparseOverscaled?(y=Math.max(i.canonical.z+2,o.transform.tileZoom),_=new a.aS(y,i.wrap,M,i.canonical.x>>C,i.canonical.y>>C)):C!==0&&(y=M,_=new a.aS(y,i.wrap,M,i.canonical.x>>C,i.canonical.y>>C))}_.key!==i.key&&(T.push(_.key),u=o.getTile(_))}const I=M=>{T.forEach(C=>{d[C]=M}),T.length=0};for(y-=1;y>=v&&(!u||!u.hasData());y--){u&&I(u.tileID.key);const M=_.calculateScaledKey(y);if(u=o.getTileByID(M),u&&u.hasData())break;const C=d[M];if(C===null)break;C===void 0?T.push(M):u=o.getTileByID(C)}return I(u?u.tileID.key:null),u&&u.hasData()?u:null}findDEMTileFor(i){return this.enabled?this._findTileCoveringTileID(i,this.sourceCache):null}prepareDrawTile(){this.renderedToTile=!0}_clearRenderCacheForTile(i,o){let u=this._tilesDirty[i];u||(u=this._tilesDirty[i]={}),u[o.key]=!0}}function Wc(l,i,o){const u=function(y,v,T){const I=a.bj(v,y),M=a.bj(T,[.2126,.7152,.0722]),C=(F,z,V)=>(1-V)*F+V*z,D=C(1-.3*Math.min(M,1),1,Math.min(I+1,1));return C(.92,1,Math.asin(a.aC(v[2],-1,1))/Math.PI+.5)*D}(l,[0,0,1],i),d=[0,0,0];a.bK(d,o.slice(0,3),u);const m=[0,0,0];a.bK(m,i.slice(0,3),l[2]);const _=[0,0,0];return a.cP(_,d,m),a.cS(_)}const Ih=["fill","fillOutline","fillPattern","line","linePattern","background","backgroundPattern","hillshade","raster"],Bf=["stars","rainParticle","snowParticle","fillExtrusion","fillExtrusionGroundEffect","building","buildingBloom","elevatedStructures","model","symbol"];class Eh{static cacheKey(i,o,u,d){const m=[o];d&&m.push(d.cacheKey);for(const _ of u)(typeof _=="string"&&_.includes(" ")||i.usedDefines.has(_))&&m.push(_);return m.join("/")}constructor(i,o,u,d,m,_){const y=i.gl;this.program=y.createProgram(),this.configuration=d,this.name=o,this.fixedDefines=[..._];const v=`#version 300 es
3251${(d?d.defines():[]).concat(_.map(z=>`#define ${z}`)).join(`
3252`)}`,T=[v,Oc];for(const z of u.fragmentIncludes)T.push(pa[z]);T.push(u.fragmentSource);const I=T.join(`
3253`),M=[v,ma];for(const z of u.vertexIncludes)M.push(pa[z]);this.forceManualRenderingForInstanceIDShaders=i.forceManualRenderingForInstanceIDShaders&&u.vertexSource.includes("gl_InstanceID"),this.forceManualRenderingForInstanceIDShaders&&M.push("uniform int u_instanceID;"),M.push(u.vertexSource);let C=M.join(`
3254`);this.forceManualRenderingForInstanceIDShaders&&(C=C.replaceAll("gl_InstanceID","u_instanceID"));const D=y.createShader(y.FRAGMENT_SHADER);if(y.isContextLost())return void(this.failedToCreate=!0);y.shaderSource(D,I),y.compileShader(D),y.attachShader(this.program,D);const F=y.createShader(y.VERTEX_SHADER);y.isContextLost()?this.failedToCreate=!0:(y.shaderSource(F,C),y.compileShader(F),y.attachShader(this.program,F),this.attributes={},y.linkProgram(this.program),y.deleteShader(F),y.deleteShader(D),this.fixedUniforms=m(i),this.fixedUniformsEntries=Object.entries(this.fixedUniforms),this.binderUniforms=d?d.getUniforms(i):[],this.forceManualRenderingForInstanceIDShaders&&(this.instancingUniforms=(z=>({u_instanceID:new a.bY(z)}))(i)),(_.includes("TERRAIN")||_.includes("ELEVATED")||o.includes("symbol")||o.includes("circle"))&&(this.terrainUniforms=(z=>({u_dem:new a.bY(z),u_dem_prev:new a.bY(z),u_dem_tl:new a.b$(z),u_dem_scale:new a.b_(z),u_dem_tl_prev:new a.b$(z),u_dem_scale_prev:new a.b_(z),u_dem_size:new a.b_(z),u_dem_lerp:new a.b_(z),u_exaggeration:new a.b_(z),u_depth:new a.bY(z),u_depth_size_inv:new a.b$(z),u_depth_range_unpack:new a.b$(z),u_occluder_half_size:new a.b_(z),u_occlusion_depth_offset:new a.b_(z),u_meter_to_dem:new a.b_(z),u_label_plane_matrix_inv:new a.c0(z)}))(i)),_.includes("GLOBE")&&(this.globeUniforms=(z=>({u_tile_tl_up:new a.bZ(z),u_tile_tr_up:new a.bZ(z),u_tile_br_up:new a.bZ(z),u_tile_bl_up:new a.bZ(z),u_tile_up_scale:new a.b_(z)}))(i)),_.includes("FOG")&&(this.fogUniforms=(z=>({u_fog_matrix:new a.c0(z),u_fog_range:new a.b$(z),u_fog_color:new a.cK(z),u_fog_horizon_blend:new a.b_(z),u_fog_vertical_limit:new a.b$(z),u_fog_temporal_offset:new a.b_(z),u_frustum_tl:new a.bZ(z),u_frustum_tr:new a.bZ(z),u_frustum_br:new a.bZ(z),u_frustum_bl:new a.bZ(z),u_globe_pos:new a.bZ(z),u_globe_radius:new a.b_(z),u_globe_transition:new a.b_(z),u_is_globe:new a.bY(z),u_viewport:new a.b$(z)}))(i)),_.includes("RENDER_CUTOFF")&&(this.cutoffUniforms=(z=>({u_cutoff_params:new a.cK(z)}))(i)),_.includes("LIGHTING_3D_MODE")&&(this.lightsUniforms=(z=>({u_lighting_ambient_color:new a.bZ(z),u_lighting_directional_dir:new a.bZ(z),u_lighting_directional_color:new a.bZ(z),u_ground_radiance:new a.bZ(z)}))(i)),_.includes("RENDER_SHADOWS")&&(this.shadowUniforms=(z=>({u_light_matrix_0:new a.c0(z),u_light_matrix_1:new a.c0(z),u_fade_range:new a.b$(z),u_shadow_normal_offset:new a.bZ(z),u_shadow_intensity:new a.b_(z),u_shadow_texel_size:new a.b_(z),u_shadow_map_resolution:new a.b_(z),u_shadow_direction:new a.bZ(z),u_shadow_bias:new a.bZ(z),u_shadowmap_0:new a.bY(z),u_shadowmap_1:new a.bY(z)}))(i)))}getAttributeLocation(i,o){let u=this.attributes[o];return u===void 0&&(u=this.attributes[o]=i.getAttribLocation(this.program,o)),u}setTerrainUniformValues(i,o){if(!this.terrainUniforms)return;const u=this.terrainUniforms;if(!this.failedToCreate){i.program.set(this.program);for(const d in o)u[d]&&u[d].set(this.program,d,o[d])}}setGlobeUniformValues(i,o){if(!this.globeUniforms)return;const u=this.globeUniforms;if(!this.failedToCreate){i.program.set(this.program);for(const d in o)u[d]&&u[d].set(this.program,d,o[d])}}setFogUniformValues(i,o){if(!this.fogUniforms)return;const u=this.fogUniforms;if(!this.failedToCreate){i.program.set(this.program);for(const d in o)u[d].set(this.program,d,o[d])}}setCutoffUniformValues(i,o){if(!this.cutoffUniforms)return;const u=this.cutoffUniforms;if(!this.failedToCreate){i.program.set(this.program);for(const d in o)u[d].set(this.program,d,o[d])}}setLightsUniformValues(i,o){if(!this.lightsUniforms)return;const u=this.lightsUniforms;if(!this.failedToCreate){i.program.set(this.program);for(const d in o)u[d].set(this.program,d,o[d])}}setShadowUniformValues(i,o){if(this.failedToCreate||!this.shadowUniforms)return;const u=this.shadowUniforms;i.program.set(this.program);for(const d in o)u[d].set(this.program,d,o[d])}_drawDebugWireframe(i,o,u,d,m,_,y,v,T,I){const M=i.options.wireframe;if(M.terrain===!1&&M.layers2D===!1&&M.layers3D===!1)return;const C=i.context;if(!(!(!M.terrain||this.name!=="terrainRaster"&&this.name!=="globeRaster")||!(!M.layers2D||i._terrain&&i._terrain.renderingToTexture||!Ih.includes(this.name))||!(!M.layers3D||!Bf.includes(this.name))))return;const D=C.gl,F=i.wireframeDebugCache.getLinesFromTrianglesBuffer(i.frameCounter,m,C);if(!F)return;
3254const z=[...this.fixedDefines,"DEBUG_WIREFRAME"],V=i.getOrCreateProgram(this.name,{config:this.configuration,defines:z});C.program.set(V.program);const N=(j,ne,Y)=>{if(ne[j]&&Y[j])for(const re in ne[j])Y[j][re]&&Y[j][re].set(Y.program,re,ne[j][re].current)};T&&T.setUniforms(V.program,C,V.binderUniforms,y,{zoom:v}),N("fixedUniforms",this,V),N("terrainUniforms",this,V),N("globeUniforms",this,V),N("fogUniforms",this,V),N("lightsUniforms",this,V),N("shadowUniforms",this,V),F.bind(),C.setColorMode(new ct([D.ONE,D.ONE_MINUS_SRC_ALPHA,D.ZERO,D.ONE],a.aq.transparent,[!0,!0,!0,!1])),C.setDepthMode(new rt(o.func===D.LESS?D.LEQUAL:o.func,rt.ReadOnly,o.range)),C.setStencilMode(st.disabled);const $=3*_.primitiveLength*2,H=3*_.primitiveOffset*2*2;if(this.forceManualRenderingForInstanceIDShaders){const j=I||1;for(let ne=0;ne<j;++ne)V.instancingUniforms.u_instanceID.set(this.program,"u_instanceID",ne),D.drawElements(D.LINES,$,D.UNSIGNED_SHORT,H)}else I&&I>1?D.drawElementsInstanced(D.LINES,$,D.UNSIGNED_SHORT,H,I):D.drawElements(D.LINES,$,D.UNSIGNED_SHORT,H);m.bind(),C.program.set(this.program),C.setDepthMode(o),C.setStencilMode(u),C.setColorMode(d)}checkUniforms(i,o,u){if(this.fixedDefines.includes(o)){for(const d of Object.keys(u))if(!u[d].initialized)throw new Error(`Program '${this.name}', from draw '${i}': uniform ${d} not set but required by ${o} being defined`)}}draw(i,o,u,d,m,_,y,v,T,I,M,C,D,F,z,V){const N=i.context,$=N.gl;if(this.failedToCreate)return;N.program.set(this.program),N.setDepthMode(u),N.setStencilMode(d),N.setColorMode(m),N.setCullFace(_);for(const[Z,K]of this.fixedUniformsEntries)K.set(this.program,Z,y[Z]);F&&F.setUniforms(this.program,N,this.binderUniforms,C,{zoom:D});const H={[$.POINTS]:1,[$.LINES]:2,[$.TRIANGLES]:3,[$.LINE_STRIP]:1}[o];this.checkUniforms(v,"RENDER_SHADOWS",this.shadowUniforms);const j=z||[],ne=F?F.getPaintVertexBuffers():[],Y=o===$.TRIANGLES&&I,re=V&&V>0?1:void 0;for(const Z of M.get()){const K=Z.vaos||(Z.vaos={});if((K[v]||(K[v]=new Sf)).bind(N,this,T,ne,I,Z.vertexOffset,j,re),this.forceManualRenderingForInstanceIDShaders){const te=V||1;for(let de=0;de<te;++de)this.instancingUniforms.u_instanceID.set(this.program,"u_instanceID",de),I?$.drawElements(o,Z.primitiveLength*H,$.UNSIGNED_SHORT,Z.primitiveOffset*H*2):$.drawArrays(o,Z.vertexOffset,Z.vertexLength)}else V&&V>1?$.drawElementsInstanced(o,Z.primitiveLength*H,$.UNSIGNED_SHORT,Z.primitiveOffset*H*2,V):I?$.drawElements(o,Z.primitiveLength*H,$.UNSIGNED_SHORT,Z.primitiveOffset*H*2):$.drawArrays(o,Z.vertexOffset,Z.vertexLength);Y&&this._drawDebugWireframe(i,u,d,m,I,Z,C,D,F,V)}}}function Rs(l,i,o=0){const u=Math.pow(2,i.tileID.overscaledZ),d=i.tileSize*Math.pow(2,l.transform.tileZoom)/u,m=d*(i.tileID.canonical.x+i.tileID.wrap*u),_=d*i.tileID.canonical.y;return{u_image:0,u_texsize:i.imageAtlasTexture?i.imageAtlasTexture.size:[0,0],u_tile_units_to_pixels:1/a.aA(i,1,l.transform.tileZoom),u_pixel_coord_upper:[m>>16,_>>16],u_pixel_coord_lower:[65535&m,65535&_],u_pattern_transition:o}}const Xc={terrain:0,flat:1},Gm=a.bc(),kf=(l,i,o,u,d,m,_,y,v,T,I,M,C,D,F,z,V,N,$=[0,0,1])=>{const H=i.style.light,j=H.properties.get("position"),ne=[j.x,j.y,j.z],Y=a.dA();H.properties.get("anchor")==="viewport"&&(a.dB(Y,-i.transform.angle),a.dC(ne,ne,Y));const re=H.properties.get("color").toPremultipliedRenderColor(null),Z=i.transform,K={u_matrix:l,u_lightpos:ne,u_lightintensity:H.properties.get("intensity"),u_lightcolor:[re.r,re.g,re.b],u_vertical_gradient:+o,u_opacity:u,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:Gm,u_merc_center:[0,0],u_up_dir:[0,0,0],u_height_lift:0,u_height_type:Xc[T],u_base_type:Xc[I],u_ao:d,u_edge_radius:m,u_width_scale:_,u_flood_light_color:F,u_vertical_scale:z,u_flood_light_intensity:V,u_ground_shadow_factor:N,u_front_cutoff_params:$};return Z.projection.name==="globe"&&(K.u_tile_id=[y.canonical.x,y.canonical.y,1<<y.canonical.z],K.u_zoom_transition=M,K.u_inv_rot_matrix=D,K.u_merc_center=C,K.u_up_dir=Z.projection.upVector(new a.ci(0,0,0),C[0]*a.an,C[1]*a.an),K.u_height_lift=v),K},qm=(l,i,o,u,d,m)=>({u_matrix:l,u_edge_radius:i,u_width_scale:o,u_vertical_scale:u,u_height_type:Xc[d],u_base_type:Xc[m]}),$m=(l,i,o,u,d,m,_,y,v,T,I,M,C,D,F,z,V,N)=>{const $=kf(l,i,o,u,d,m,_,y,T,I,M,C,D,F,z,V,1,[0,0,0]),H={u_height_factor:-Math.pow(2,y.overscaledZ
3254)/v.tileSize/8};return Object.assign($,Rs(i,v,N),H)},Vf=(l,i,o)=>({u_matrix:l,u_emissive_strength:i,u_ground_shadow_factor:o}),Yc=(l,i,o,u,d,m=0)=>Object.assign(Vf(l,i,d),Rs(o,u,m)),Ah=(l,i,o,u)=>({u_matrix:l,u_world:o,u_emissive_strength:i,u_ground_shadow_factor:u}),Nf=(l,i,o,u,d,m,_=0)=>Object.assign(Yc(l,i,o,u,m,_),{u_world:d}),Sa=(l,i)=>({u_matrix:l,u_depth_bias:i}),Uf=(l,i)=>({u_matrix:l,u_ground_shadow_factor:i}),Sl=(l,i,o,u,d)=>({u_matrix:l,u_camera_pos:[i[0],i[1],i[2]],u_depth_bias:o,u_height_scale:u,u_reset_depth:d}),Ch=(l,i,o)=>({u_image:l,u_opacity:i,u_blend_mode:o}),Mh=(l,i,o,u,d,m,_,y,v,T=[0,0,1])=>({u_matrix:l,u_normal_matrix:i,u_opacity:o,u_faux_facade_ao_intensity:u,u_camera_pos:d,u_tile_to_meter:m,u_facade_emissive_chance:_,u_flood_light_color:y,u_flood_light_intensity:v,u_front_cutoff_params:T}),Qo=l=>({u_matrix:l}),Kc=l=>({u_matrix:l}),Qc=(l,i,o,u,d,m,_,y)=>{const v=a.an/m.tileSize;return{u_matrix:l,u_inv_rot_matrix:i,u_camera_to_center_distance:o.getCameraToCenterDistance(y),u_extrude_scale:[o.pixelsToGLUnits[0]/v,o.pixelsToGLUnits[1]/v],u_zoom_transition:u,u_tile_id:_,u_merc_center:d}},jf=(l,i,o,u)=>({u_matrix:l,u_inv_matrix:i,u_camera_to_center_distance:o.getCameraToCenterDistance(u),u_viewport_size:[o.width,o.height]}),so=(l,i,o=1)=>({u_matrix:l,u_color:i,u_overlay:0,u_overlay_scale:o}),Ph=a.bc(),Jc=(l,i,o,u,d,m,_)=>{const y=l.transform,v=y.projection.name==="globe",T=v?a.dD(y.zoom,i.canonical)*y._pixelsPerMercatorPixel:a.aA(o,1,m),I={u_matrix:i.projMatrix,u_extrude_scale:T,u_intensity:_,u_inv_rot_matrix:Ph,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0]};if(v){I.u_inv_rot_matrix=u,I.u_merc_center=d,I.u_tile_id=[i.canonical.x,i.canonical.y,1<<i.canonical.z],I.u_zoom_transition=a.al(y.zoom);const M=d[0]*a.an,C=d[1]*a.an;I.u_up_dir=y.projection.upVector(new a.ci(0,0,0),M,C)}return I};function Dh(l,[i,o,u,d],[m,_]){if(m===_)return[0,0,0,0];const y=255*(l-1)/(l*(_-m));return[i*y,o*y,u*y,d*y]}function Rh(l,i,[o,u]){return o===u?0:.5/l+(i-o)*(l-1)/(l*(u-o))}function zh(l){const i=l.terrain?l.terrain.exaggeration():1;var o;return(l.transform.pitch<15?.07*(1-(o=a.aC((14-l.transform.zoom)/5,0,1)))+.7*o:.07)*i}const eu=(l,i,o,u,d,m,_,y,v,T,I,M,C,D,F,z,V,N,$,H,j,ne)=>({u_matrix:i,u_normalize_matrix:o,u_globe_matrix:u,u_merc_matrix:d,u_grid_matrix:m,u_tl_parent:_,u_scale_parent:I,u_fade_t:M.mix,u_opacity:M.opacity*C.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:C.paint.get("raster-brightness-min"),u_brightness_high:C.paint.get("raster-brightness-max"),u_saturation_factor:a.dF(C.paint.get("raster-saturation")),u_contrast_factor:a.dE(C.paint.get("raster-contrast")),u_spin_weights:Hm(C.paint.get("raster-hue-rotate")),u_perspective_transform:D,u_raster_elevation:F,u_zoom_transition:y,u_merc_center:v,u_cutoff_params:T,u_colorization_mix:Dh(a.dG,V,$),u_colorization_offset:Rh(a.dG,N,$),u_color_ramp:z,u_texture_offset:[j/(H+2*j),H/(H+2*j)],u_texture_res:[H+2*j,H+2*j],u_emissive_strength:ne,u_zbias_factor:zh(l)});function Hm(l){l*=Math.PI/180;const i=Math.sin(l),o=Math.cos(l);return[(2*o+1)/3,(-Math.sqrt(3)*i-o+1)/3,(Math.sqrt(3)*i-o+1)/3]}const zs=.05,Il=(l,i,o,u,d,m,_,y,v,T,I,M)=>({u_matrix:l,u_normalize_matrix:i,u_globe_matrix:o,u_merc_matrix:u,u_grid_matrix:d,u_tl_parent:m,u_scale_parent:T,u_fade_t:I.mix,u_opacity:I.opacity,u_image0:0,u_image1:1,u_raster_elevation:M,u_zoom_transition:_,u_merc_center:y,u_cutoff_params:v}),Zm=(l,i,o,u,d,m,_,y,v,T)=>({u_particle_texture:l,u_particle_texture_side_len:i,u_tile_offset:o,u_velocity:u,u_color_ramp:m,u_velocity_res:d,u_max_speed:_,u_uv_offset:y,u_data_scale:[255*v[0],255*v[1]],u_data_offset:T,u_particle_pos_scale:1.1,u_particle_pos_offset:[zs,zs]}),Wm=(l,i,o,u,d,m,_,y,v,T)=>({u_particle_texture:l,u_particle_texture_side_len:i,u_velocity:o,u_velocity_res:u,u_max_speed:d,u_speed_factor:m,u_reset_rate:_,u_rand_seed:Math.random(),u_uv_offset:y,u_data_scale:[255*v[0],255*v[1]],u_data_offset:T,u_particle_pos_scale:1.1,u_particle_pos_offset:[zs,zs]}),Lh=a.bc(),Gf=(l,i,o,u,d,m,_,y,v,T,I,M,C,D,F,z,V,N,$,H,j,ne,Y,re)=>{const Z=d.transform,K={u_is_size_zoom_constant:+(l==="constant"||l==="source"),u_is_size_feature_constant:+(l==="constant"||l==="camera"),u_size_t:i?i.uSizeT:0,u_size:i?i.uSize:0,u_camera_to_center_distance:Z.getCameraToCenterDistance($),u_rotate_symbol:+o,u_aspect_ratio:Z.width/Z.height,u_fade_change:d.options.fadeDuration?d.symbolFadeChange:1,u_matrix:m,u_label_plane_matrix:_,u_coord_matrix:y,u_is_text:+T,u_elevation_from_sea:v?1:0,u_pitch_with_map:+u,u_texsize:I,u_texsize_icon:M,u_texture:0,u_texture_icon:1,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:Lh,u_merc_center:[0,0],u_camera_forward:[0,0,0],u_ecef_origin:[0,0,0],u_tile_matrix:Lh,u_up_vector:[0,-1,0],u_color_adj_mat:ne,u_icon_transition:Y||0,u_gamma_scale:u?d.transform.getCameraToCenterDistance($)*Math.cos(d.terrain?0:d.transform._pitch):1,u_device_pixel_ratio:a.o.devicePixelRatio,u_is_halo:1,u_scale_factor:re||1,u_ground_shadow_factor:H,u_inv_matrix:a.b8(a.bc(),_),u_normal_scale:j,u_lutTexture:10,u_zoom:Z.zoom-Math.floor(Z.zoom),u_spp_fill_np_color:[0,0,0,1],u_spp_halo_np_color:[0,0,0,0],u_spp_opacity:1,u_spp_halo_width:0,u_spp_halo_blur:0,u_spp_emissive_strength:0,u_spp_occlusion_opacity:1,u_spp_z_offset:0,u_spp_translate_rotation:[1,0]};return $.name==="globe"&&(K.u_tile_id=[D.canonical.x,D.canonical.y,1<<D.canonical.z],K.u_zoom_transition=F,K.u_inv_rot_matrix=V,K.u_merc_center=z,K.u_camera_forward=Z._c
3254amera.forward(),K.u_ecef_origin=a.dH(Z.globeMatrix,D.toUnwrapped()),K.u_tile_matrix=Float32Array.from(Z.globeMatrix),K.u_up_vector=N),K},tu=(l,i,o,u)=>({u_matrix:l,u_emissive_strength:i,u_opacity:o,u_color:u}),El=(l,i,o,u,d,m,_,y,v)=>Object.assign(function(T,I,M,C,D,F){const{width:z,height:V}=C.imageManager.getPixelSize(I),N=Math.pow(2,F.tileID.overscaledZ),$=F.tileSize*Math.pow(2,C.transform.tileZoom)/N,H=$*(F.tileID.canonical.x+F.tileID.wrap*N),j=$*F.tileID.canonical.y;return{u_image:0,u_pattern_tl:M.tl,u_pattern_br:M.br,u_texsize:[z,V],u_pattern_size:M.displaySize,u_pattern_units_to_pixels:D?[C.transform.width,-1*C.transform.height]:[1/a.aA(F,1,C.transform.tileZoom),1/a.aA(F,1,C.transform.tileZoom)],u_pixel_coord_upper:[H>>16,j>>16],u_pixel_coord_lower:[65535&H,65535&j]}}(0,m,_,u,y,v),{u_matrix:l,u_emissive_strength:i,u_opacity:o}),Co=new Float32Array(a.ba([])),Ia=(l,i,o,u,d,m,_,y,v,T,I,M,C,D=[0,0,0],F,z,V)=>{const N=d.style.light,$=N.properties.get("position"),H=[-$.x,-$.y,$.z],j=a.dA();N.properties.get("anchor")==="viewport"&&(a.dB(j,-d.transform.angle),a.dC(H,H,j));const ne=I.alphaMode==="MASK",Y=N.properties.get("color").toNonPremultipliedRenderColor(null),re=C.paint.get("model-ambient-occlusion-intensity"),Z=C.paint.get("model-color").constantOr(a.aq.white).toNonPremultipliedRenderColor(null);return Z.a=C.paint.get("model-color-mix-intensity").constantOr(0),V&&(Z.r=V[0],Z.g=V[1],Z.b=V[2],Z.a=V[3]),z&&(Z.r=z.color.r,Z.g=z.color.g,Z.b=z.color.b,Z.a=z.colorMix,M=z.emissionStrength,m*=z.opacity),{u_matrix:l,u_lighting_matrix:i,u_normal_matrix:o,u_node_matrix:u||Co,u_lightpos:H,u_lightintensity:N.properties.get("intensity"),u_lightcolor:[Y.r,Y.g,Y.b],u_camera_pos:D,u_opacity:m,u_baseTextureIsAlpha:0,u_alphaMask:+ne,u_alphaCutoff:I.alphaCutoff,u_baseColorFactor:_.toNonPremultipliedRenderColor(null).toArray01(),u_emissiveFactor:y.toNonPremultipliedRenderColor(null).toArray01(),u_metallicFactor:v,u_roughnessFactor:T,u_baseColorTexture:5,u_metallicRoughnessTexture:6,u_normalTexture:7,u_occlusionTexture:8,u_emissionTexture:9,u_lutTexture:10,u_color_mix:Z.toArray01(),u_aoIntensity:re,u_emissive_strength:M,u_occlusionTextureTransform:F||[0,0,0,0]}},Ea=(l,i=Co,o=Co)=>({u_matrix:l,u_instance:i,u_node_matrix:o}),qf={fillExtrusion:l=>({u_matrix:new a.c0(l),u_lightpos:new a.bZ(l),u_lightintensity:new a.b_(l),u_lightcolor:new a.bZ(l),u_vertical_gradient:new a.b_(l),u_opacity:new a.b_(l),u_edge_radius:new a.b_(l),u_width_scale:new a.b_(l),u_ao:new a.b$(l),u_height_type:new a.bY(l),u_base_type:new a.bY(l),u_tile_id:new a.bZ(l),u_zoom_transition:new a.b_(l),u_inv_rot_matrix:new a.c0(l),u_merc_center:new a.b$(l),u_up_dir:new a.bZ(l),u_height_lift:new a.b_(l),u_flood_light_color:new a.bZ(l),u_vertical_scale:new a.b_(l),u_flood_light_intensity:new a.b_(l),u_ground_shadow_factor:new a.bZ(l),u_front_cutoff_params:new a.bZ(l)}),fillExtrusionDepth:l=>({u_matrix:new a.c0(l),u_edge_radius:new a.b_(l),u_width_scale:new a.b_(l),u_vertical_scale:new a.b_(l),u_height_type:new a.bY(l),u_base_type:new a.bY(l)}),fillExtrusionPattern:l=>({u_matrix:new a.c0(l),u_lightpos:new a.bZ(l),u_lightintensity:new a.b_(l),u_lightcolor:new a.bZ(l),u_vertical_gradient:new a.b_(l),u_height_factor:new a.b_(l),u_edge_radius:new a.b_(l),u_width_scale:new a.b_(l),u_ao:new a.b$(l),u_height_type:new a.bY(l),u_base_type:new a.bY(l),u_tile_id:new a.bZ(l),u_zoom_transition:new a.b_(l),u_inv_rot_matrix:new a.c0(l),u_merc_center:new a.b$(l),u_up_dir:new a.bZ(l),u_height_lift:new a.b_(l),u_image:new a.bY(l),u_texsize:new a.b$(l),u_pixel_coord_upper:new a.b$(l),u_pixel_coord_lower:new a.b$(l),u_tile_units_to_pixels:new a.b_(l),u_opacity:new a.b_(l),u_pattern_transition:new a.b_(l)}),fillExtrusionGroundEffect:l=>({u_matrix:new a.c0(l),u_opacity:new a.b_(l),u_ao_pass:new a.b_(l),u_meter_to_tile:new a.b_(l),u_ao:new a.b$(l),u_flood_light_intensity:new a.b_(l),u_flood_light_color:new a.bZ(l),u_attenuation:new a.b_(l),u_edge_radius:new a.b_(l),u_fb:new a.bY(l),u_fb_size:new a.b_(l),u_dynamic_offset:new a.b_(l)}),fill:l=>({u_matrix:new a.c0(l),u_emissive_strength:new a.b_(l),u_ground_shadow_factor:new a.bZ(l)}),fillPattern:l=>({u_matrix:new a.c0(l),u_emissive_strength:new a.b_(l),u_image:new a.bY(l),u_texsize:new a.b$(l),u_pixel_coord_upper:new a.b$(l),u_pixel_coord_lower:new a.b$(l),u_tile_units_to_pixels:new a.b_(l),u_ground_shadow_factor:new a.bZ(l),u_pattern_transition:new a.b_(l)}),fillOutline:l=>({u_matrix:new a.c0(l),u_emissive_strength:new a.b_(l),u_world:new a.b$(l),u_ground_shadow_factor:new a.bZ(l)}),fillOutlinePattern:l=>({u_matrix:new a.c0(l),u_emissive_strength:new a.b_(l),u_world:new a.b$(l),u_image:new a.bY(l),u_texsize:new a.b$(l),u_pixel_coord_upper:new a.b$(l),u_pixel_coord_lower:new a.b$(l),u_tile_units_to_pixels:new a.b_(l),u_ground_shadow_factor:new a.bZ(l),u_pattern_transition:new a.b_(l)}),lineBlendComposite:l=>({u_image:new a.bY(l),u_opacity:new a.b_(l),u_blend_mode:new a.bY(l)}),building:l=>({u_matrix:new a.c0(l),u_normal_matrix:new a.c0(l),u_opacity:new a.b_(l),u_faux_facade_ao_intensity:new a.b_(l),u_camera_pos:new a.bZ(l),u_tile_to_meter:new a.b_(l),u_facade_emissive_chance:new a.b_(l),u_flood_light_color:new a.bZ(l),u_flood_light_intensity:new a.b_(l),u_front_cutoff_params:new a.bZ(l)}),buildingBloom:l=>({u_matrix:new a.c0(l)}),buildingDepth:l=>({u_matrix:new a.c0(l)}),elevatedStructuresDepth:l=>({u_matrix:new a.c0(l),u_depth_bias:new a.b_(l)}),elevatedStructures:l=>({u_matrix:new a.c0(l),u_ground_shadow_factor:new a.bZ(l)}),elevatedStructuresDepthReconstruct:l=>({u_matrix:new a.c0(l),u_camera_pos:new a.bZ(l),u_depth_bias:new a.b_(l),u_height_scale:new a.b_(l),u_reset_depth:new a.b_(l)}),circle:a.dK,collisionBox:l=>({u_matrix:new a.c0(l),u_inv_rot_matrix:new a.c0(l),u_camera_to_center_distance:new a.b_(l),u_extrude_scale:new a.b$(l),u_zoom_transition:new a.b_(l),u_merc_center:new a.b$(l),u_tile_id:new a.bZ(l)}),collisionCircle:l=>({u_matrix:new a.c0(l),u_inv_matrix:new a.c0(l),u_camera_to_center_distance:new a.b_(l),u_viewport_size:new a.b$(l)}),debug:l=>({u_color:new a.dh(l),u_matrix:new a.c0(l),u_overlay:new a.bY(l),u_overlay_scale:new a.b_(l)}),clippingMask:l=>({u_matrix:new a.c0(l)}),heatmap:l=>({u_extrude_scale:new a.b_(l),u_intensity:new a.b_(l),u_matrix:new a.c0(l),u_inv_rot_matrix:new a.c0(l),u_merc_center:new a.b$(l),u_tile_id:new a.bZ(l),u_zoom_transition:new a.b_(l),u_up_dir:new a.bZ(l)}),heatmapTexture:l=>({u_image:new a.bY(l),u_color_ramp:new a.bY(l),u_opacity:new a.b_(l)}),hillshade:l=>({u_matrix:new a.c0(l),u_image:new a.bY(l),u_latrange:new a.b$(l),u_light:new a.b$(l),u_shadow:new a.dh(l),u_highlight:new a.dh(l),u_emissive_strength:new a.b_(l),u_accent:new a.dh(l)}),hillshadePrepare:l=>({u_matrix:new a.c0(l),u_image:new a.bY(l),u_dimension:new a.b$(l),u_zoom:new a.b_(l)}),line:a.dJ,linePattern:a.dI,raster:l=>({u_matrix:new a.c0(l),u_normalize_matrix:new a.c0(l),u_globe_matrix:new a.c0(l),u_merc_matrix:new a.c0(l),u_grid_matrix:new a.di(l),u_tl_parent:new a.b$(l),u_scale_parent:new a.b_(l),u_fade_t:new a.b_(l),u_opacity:new a.b_(l),u_image0:new a.bY(l),u_image1:new a.bY(l),u_brightness_low:new a.b_(l),u_brightness_high:new a.b_(l),u_saturation_factor:new a.b_(l),u_contrast_factor:new a.b_(l),u_spin_weights:new a.bZ(l),u_perspective_transform:new a.b$(l),u_raster_elevation:new a.b_(l),u_zoom_transition:new a.b_(l),u_merc_center:new a.b$(l),u_cutoff_params:new a.cK(l),u_colorization_mix:new a.cK(l),u_colorization_offset:new a.b_(l),u_color_ramp:new a.bY(l),u_texture_offset:new a.b$(l),u_texture_res:new a.b$(l),u_emissive_strength:new a.b_(l),u_zbias_factor:new a.b_(l)}),rasterParticle:l=>({u_matrix:new a.c0(l),u_normalize_matrix:new a.c0(l),u_globe_matrix:new a.c0(l),u_merc_matrix:new a.c0(l),u_grid_matrix:new a.di(l),u_tl_parent:new a.b$(l),u_scale_parent:new a.b_(l),u_fade_t:new a.b_(l),u_opacity:new a.b_(l),u_image0:new a.bY(l),u_image1:new a.bY(l),u_raster_elevation:new a.b_(l),u_zoom_transition:new a.b_(l),u_merc_center:new a.b$(l),u_cutoff_params:new a.cK(l)}),rasterParticleTexture:l=>({u_texture:new a.bY(l),u_opacity:new a.b_(l)}),rasterParticleDraw:l=>({u_particle_texture:new a.bY(l),u_particle_texture_side_len:new a.b_(l),u_tile_offset:new a.b$(l),u_velocity:new a.bY(l),u_color_ramp:new a.bY(l),u_velocity_res:new a.b$(l),u_max_speed:new a.b_(l),u_uv_offset:new a.b$(l),u_data_scale:new a.b$(l),u_data_offset:new a.b_(l),u_particle_pos_scale:new a.b_(l),u_particle_pos_offset:new a.b$(l)}),rasterParticleUpdate:l=>({u_particle_texture:new a.bY(l),u_particle_texture_side_len:new a.b_(l),u_velocity:new a.bY(l),u_velocity_res:new a.b$(l),u_max_speed:new a.b_(l),u_speed_factor:new a.b_(l),u_reset_rate:new a.b_(l),u_rand_seed:new a.b_(l),u_uv_offset:new a.b$(l),u_data_scale:new a.b$(l),u_data_offset:new a.b_(l),u_particle_pos_scale:new a.b_(l),u_particle_pos_offset:new a.b$(l)}),symbol:l=>({u_is_size_zoom_constant:new a.bY(l),u_is_size_feature_constant:new a.bY(l),u_size_t:new a.b_(l),u_size:new a.b_(l),u_camera_to_center_distance:new a.b_(l),u_rotate_symbol:new a.bY(l),u_aspect_ratio:new a.b_(l),u_fade_change:new a.b_(l),u_matrix:new a.c0(l),u_label_plane_matrix:new a.c0(l),u_coord_matrix:new a.c0(l),u_is_text:new a.bY(l),u_elevation_from_sea:new a.bY(l),u_pitch_with_map:new a.bY(l),u_texsize:new a.b$(l),u_texsize_icon:new a.b$(l),u_texture:new a.bY(l),u_texture_icon:new a.bY(l),u_gamma_scale:new a.b_(l),u_device_pixel_ratio:new a.b_(l),u_tile_id:new a.bZ(l),u_zoom_transition:new a.b_(l),u_inv_rot_matrix:new a.c0(l),u_merc_center:new a.b$(l),u_camera_forward:new a.bZ(l),u_tile_matrix:new a.c0(l),u_up_vector:new a.bZ(l),u_ecef_origin:new a.bZ(l),u_is_halo:new a.bY(l),u_icon_transition:new a.b_(l),u_color_adj_mat:new a.c0(l),u_scale_factor:new a.b_(l),u_ground_shadow_factor:new a.bZ(l),u_inv_matrix:new a.c0(l),u_normal_scale:new a.b_(l),u_lutTexture:new a.bY(l),u_zoom:new a.b_(l),u_spp_fill_np_color:new a.cK(l),u_spp_halo_np_color:new a.cK(l),u_spp_opacity:new a.b_(l),u_spp_halo_width:new a.b_(l),u_spp_halo_blur:new a.b_(l),u_spp_emissive_strength:new a.b_(l),u_spp_occlusion_opacity:new a.b_(l),u_spp_z_offset:new a.b_(l),u_spp_translate_rotation:new a.b$(l)}),background:l=>({u_matrix:new a.c0(l),u_emissive_strength:new a.b_(l),u_opacity:new a.b_(l),u_color:new a.dh(l)}),backgroundPattern:l=>({u_matrix:new a.c0(l),u_emissive_strength:new a.b_(l),u_opacity:new a.b_(l),u_image:new a.bY(l),u_pattern_tl:new a.b$(l),u_pattern_br:new a.b$(l),u_texsize:new a.b$(l),u_pattern_size:new a.b$(l),u_pixel_coord_upper:new a.b$(l),u_pixel_coord_lower:new a.b$(l),u_pattern_units_to_pixels:new a.b$(l)}),terrainRaster:l=>({u_matrix:new a.c0(l),u_image0:new a.bY(l),u_image1:new a.bY(l),u_skirt_height:new a.b_(l),u_ground_shadow_factor:new a.bZ(l),u_emissive_texture_available:new a.b_(l)}),skybox:l=>({u_matrix:new a.c0(l),u_sun_direction:new a.bZ(l),u_cubemap:new a.bY(l),u_opacity:new a.b_(l),u_temporal_offset:new a.b_(l)}),skyboxGradient:l=>({u_matrix:new a.c0(l),u_color_ramp:new a.bY(l),u_center_direction:new a.bZ(l),u_radius:new a.b_(l),u_opacity:new a.b_(l),u_temporal_offset:new a.b_(l)}),skyboxCapture:l=>({u_matrix_3f:new a.di(l),u_sun_direction:new a.bZ(l),u_sun_intensity:new a.b_(l),u_color_tint_r:new a.cK(l),u_color_tint_m:new a.cK(l),u_luminance:new a.b_(l)}),globeRaster:l=>({u_proj_matrix:new a.c0(l),u_globe_matrix:new a.c0(l),u_normalize_matrix:new a.c0(l),u_merc_matrix:new a.c0(l),u_zoom_transition:new a.b_(l),u_merc_center:new a.b$(l),u_image0:new a.bY(l),u_image1:new a.bY(l),u_grid_matrix:new a.di(l),u_skirt_height:new a.b_(l),u_far_z_cutoff:new a.b_(l),u_frustum_tl:new a.bZ(l),u_frustum_tr:new a.bZ(l),u_frustum_br:new a.bZ(l),u_frustum_bl:new a.bZ(l),u_globe_pos:new a.bZ(l),u_globe_radius:new a.b_(l),u_viewport:new a.b$(l),u_emissive_texture_available:new a.b_(l)}),globeAtmosphere:l=>({u_frustum_tl:new a.bZ(l),u_frustum_tr:new a.bZ(l),u_frustum_br:new a.bZ(l),u_frustum_bl:new a.bZ(l),u_horizon:new a.b_(l),u_transition:new a.b_(l),u_fadeout_range:new a.b_(l),u_atmosphere_fog_color:new a.cK(l),u_high_color:new a.cK(l),u_space_color:new a.cK(l),u_temporal_offset:new a.b_(l),u_horizon_angle:new a.b_(l)}),model:l=>({u_matrix:new a.c0(l),u_lighting_matrix:new a.c0(l),u_normal_matrix:new a.c0(l),u_node_matrix:new a.c0(l),u_lightpos:new a.bZ(l),u_lightintensity:new a.b_(l),u_lightcolor:new a.bZ(l),u_camera_pos:new a.bZ(l),u_opacity:new a.b_(l),u_baseColorFactor:new a.cK(l),u_emissiveFactor:new a.cK(l),u_metallicFactor:new a.b_(l),u_roughnessFactor:new a.b_(l),u_baseTextureIsAlpha:new a.bY(l),u_alphaMask:new a.bY(l),u_alphaCutoff:new a.b_(l),u_baseColorTexture:new a.bY(l),u_metallicRoughnessTexture:new a.bY(l),u_normalTexture:new a.bY(l),u_occlusionTexture:new a.bY(l),u_emissionTexture:new a.bY(l),u_lutTexture:new a.bY(l),u_color_mix:new a.cK(l),u_aoIntensity:new a.b_(l),u_emissive_strength:new a.b_(l),u_occlusionTextureTransform:new a.cK(l)}),modelDepth:l=>({u_matrix:new a.c0(l),u_instance:new a.c0(l),u_node_matrix:new a.c0(l)}),groundShadow:l=>({u_matrix:new a.c0(l),u_ground_shadow_factor:new a.bZ(l)}),stars:l=>({u_matrix:new a.c0(l),u_up:new a.bZ(l),u_right:new a.bZ(l),u_intensity_multiplier:new a.b_(l)}),snowParticle:l=>({u_modelview:new a.c0(l),u_projection:new a.c0(l),u_time:new a.b_(l),u_cam_pos:new a.bZ(l),u_velocityConeAperture:new a.b_(l),u_velocity:new a.b_(l),u_horizontalOscillationRadius:new a.b_(l),u_horizontalOscillationRate:new a.b_(l),u_boxSize:new a.b_(l),u_billboardSize:new a.b_(l),u_simpleShapeParameters:new a.b$(l),u_screenSize:new a.b$(l),u_thinningCenterPos:new a.b$(l),u_thinningShape:new a.bZ(l),u_thinningAffectedRatio:new a.b_(l),u_thinningParticleOffset:new a.b_(l),u_particleColor:new a.cK(l),u_direction:new a.bZ(l)}),rainParticle:l=>({u_modelview:new a.c0(l),u_projection:new a.c0(l),u_time:new a.b_(l),u_cam_pos:new a.bZ(l),u_texScreen:new a.bY(l),u_velocityConeAperture:new a.b_(l),u_velocity:new a.b_(l),u_boxSize:new a.b_(l),u_rainDropletSize:new a.b$(l),u_distortionStrength:new a.b_(l),u_rainDirection:new a.bZ(l),u_color:new a.cK(l),u_screenSize:new a.b$(l),u_thinningCenterPos:new a.b$(l),u_thinningShape:new a.bZ(l),u_thinningAffectedRatio:new a.b_(l),u_thinningParticleOffset:new a.b_(l),u_shapeDirectionalPower:new a.b_(l),u_shapeNormalPower:new a.b_(l),u_mode:new a.b_(l)}),vignette:l=>({u_vignetteShape:new a.bZ(l),u_vignetteColor:new a.cK(l)}),occlusion:l=>({u_matrix:new a.c0(l),u_anchorPos:new a.bZ(l),u_screenSizePx:new a.b$(l),u_occluderSizePx:new a.b$(l),u_color:new a.cK(l)})};class Wn{constructor(i,o,u,d){this.id=Wn.uniqueIdxCounter,Wn.uniqueIdxCounter++,this.context=i;const m=i.gl;this.buffer=m.createBuffer(),this.dynamicDraw=!!u,this.context.unbindVAO(),i.bindElementBuffer.set(this.buffer),m.bufferData(m.ELEMENT_ARRAY_BUFFER,o.arrayBuffer,this.dynamicDraw?m.DYNAMIC_DRAW:m.STATIC_DRAW),this.dynamicDraw||d||o.destroy()}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(i){this.id=Wn.uniqueIdxCounter,Wn.uniqueIdxCounter++;const o=this.context.gl;this.context.unbindVAO(),this.bind(),o.bufferSubData(o.ELEMENT_ARRAY_BUFFER,0,i.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}Wn.uniqueIdxCounter=0;const iu={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class Fh{constructor(i,o,u,d,m,_){this.length=o.length,this.attributes=u,this.itemSize=o.bytesPerElement,this.dynamicDraw=d,this.instanceCount=_,this.context=i;const y=i.gl;this.buffer=y.createBuffer(),i.bindVertexBuffer.set(this.buffer),y.bufferData(y.ARRAY_BUFFER,o.arrayBuffer,this.dynamicDraw?y.DYNAMIC_DRAW:y.STATIC_DRAW),this.dynamicDraw||m||o.destroy()}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(i){const o=this.context.gl;this.bind(),o.bufferSubData(o.ARRAY_BUFFER,0,i.arrayBuffer)}
vendor: 9,317 bytes, line 3254
3254enableAttributes(i,o){for(const u of this.attributes){const d=o.getAttributeLocation(i,u.name);d!==-1&&i.enableVertexAttribArray(d)}}setVertexAttribPointers(i,o,u){for(const d of this.attributes){const m=o.getAttributeLocation(i,d.name);if(m!==-1){const _=d.offset+this.itemSize*(u||0);d.type==="Float32"?i.vertexAttribPointer(m,d.components,i.FLOAT,!1,this.itemSize,_):i.vertexAttribIPointer(m,d.components,i[iu[d.type]],this.itemSize,_)}}}setVertexAttribDivisor(i,o,u){for(let d=0;d<this.attributes.length;d++){const m=o.getAttributeLocation(i,this.attributes[d].name);m!==-1&&this.instanceCount&&this.instanceCount>0&&i.vertexAttribDivisor(m,u)}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class Aa{constructor(i,o,u,d,m){this.context=i,this.width=o,this.height=u;const _=this.framebuffer=i.gl.createFramebuffer();d>0&&(this.colorAttachment0=new va(i,_,0)),d>1&&(this.colorAttachment1=new va(i,_,1)),m&&(this.depthAttachmentType=m,this.depthAttachment=m==="renderbuffer"?new jc(i,_):new Ff(i,_))}static createWithTexture(i,o,u,d,m){const _=i.gl;if(i.activeTexture.set(_.TEXTURE1),i.viewport.set([0,0,u,d]),o&&o.width===u&&o.height===d)return _.bindTexture(_.TEXTURE_2D,o.colorAttachment0.get()),i.bindFramebuffer.set(o.framebuffer),o;o&&o.destroy();const y=new a.T(i,{width:u,height:d,data:null},i.extRenderToTextureHalfFloat?i.gl.RGBA16F:i.gl.RGBA8);y.bind(_.LINEAR,_.CLAMP_TO_EDGE);const v=i.createFramebuffer(u,d,1,null);if(v.colorAttachment0.set(y.texture),m){const T=i.createRenderbuffer(_.DEPTH24_STENCIL8,u,d);i.bindFramebuffer.set(v.framebuffer),_.framebufferRenderbuffer(_.FRAMEBUFFER,_.DEPTH_STENCIL_ATTACHMENT,_.RENDERBUFFER,T),v._stencilRbo=T}return v}createColorAttachment(i,o){o===0?this.colorAttachment0=new va(i,this.framebuffer,0):o===1&&(this.colorAttachment1=new va(i,this.framebuffer,1))}removeColorAttachment(i,o){const u=this.context.gl;let d;o===0?(d=this.colorAttachment0.get(),this.colorAttachment0=void 0):o===1&&(d=this.colorAttachment1.get(),this.colorAttachment1=void 0),d&&u.deleteTexture(d)}destroy(){const i=this.context.gl;if(this.colorAttachment0){const o=this.colorAttachment0.get();o&&i.deleteTexture(o)}if(this.colorAttachment1){const o=this.colorAttachment1.get();o&&i.deleteTexture(o)}if(this.depthAttachment&&this.depthAttachmentType)if(this.depthAttachmentType==="renderbuffer"){const o=this.depthAttachment.get();o&&i.deleteRenderbuffer(o)}else{const o=this.depthAttachment.get();o&&i.deleteTexture(o)}this._stencilRbo&&(i.deleteRenderbuffer(this._stencilRbo),this._stencilRbo=null),i.deleteFramebuffer(this.framebuffer)}}class Xm{constructor(i,o){this.gl=i,this.clearColor=new Om(this),this.clearDepth=new Af(this),this.clearStencil=new Bm(this),this.colorMask=new Bc(this),this.depthMask=new km(this),this.stencilMask=new Cf(this),this.stencilFunc=new xh(this),this.stencilOp=new kc(this),this.stencilTest=new vh(this),this.depthRange=new Ms(this),this.depthTest=new Ps(this),this.depthFunc=new ga(this),this.blend=new oo(this),this.blendFunc=new Mf(this),this.blendColor=new bh(this),this.blendEquation=new Pf(this),this.cullFace=new ya(this),this.cullFaceSide=new Vc(this),this.frontFace=new Nc(this),this.program=new wh(this),this.activeTexture=new Uc(this),this.viewport=new vl(this),this.bindFramebuffer=new Df(this),this.bindRenderbuffer=new Rf(this),this.bindTexture=new zf(this),this.bindVertexBuffer=new xa(this),this.bindElementBuffer=new Lf(this),this.bindVertexArrayOES=new Vm(this),this.pixelStoreUnpack=new Nm(this),this.pixelStoreUnpackPremultiplyAlpha=new Um(this),this.pixelStoreUnpackFlipY=new Th(this),this.options=o?Object.assign({},o):{},this.options.extTextureFilterAnisotropicForceOff||(this.extTextureFilterAnisotropic=i.getExtension("EXT_texture_filter_anisotropic")||i.getExtension("MOZ_EXT_texture_filter_anisotropic")||i.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=i.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT))),this.extDebugRendererInfo=i.getExtension("WEBGL_debug_renderer_info"),this.extDebugRendererInfo&&(this.renderer=i.getParameter(this.extDebugRendererInfo.UNMASKED_RENDERER_WEBGL),this.vendor=i.getParameter(this.extDebugRendererInfo.UNMASKED_VENDOR_WEBGL)),this.forceManualRenderingForInstanceIDShaders=o&&!!o.forceManualRenderingForInstanceIDShaders||this.renderer&&this.renderer.indexOf("PowerVR")!==-1,this.disableSymbolUBO=o&&!!o.forceDisableSymbolUBO||this.renderer&&this.renderer.indexOf("PowerVR")!==-1,this.options.extTextureFloatLinearForceOff||(this.extTextureFloatLinear=i.getExtension("OES_texture_float_linear")),this.extRenderToTextureHalfFloat=i.getExtension("EXT_color_buffer_half_float"),this.extTimerQuery=i.getExtension("EXT_disjoint_timer_query_webgl2"),this.maxTextureSize=i.getParameter(i.MAX_TEXTURE_SIZE),this.maxUniformBlockSize=i.getParameter(i.MAX_UNIFORM_BLOCK_SIZE),this.maxUniformBufferBindings=i.getParameter(i.MAX_UNIFORM_BUFFER_BINDINGS),this.extBlendFuncExtended=i.getExtension("WEBGL_blend_func_extended")}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(i,o,u){return new Wn(this,i,o,u)}createVertexBuffer(i,o,u,d,m){return new Fh(this,i,o,u,d,m)}createRenderbuffer(i,o,u){const d=this.gl,m=d.createRenderbuffer();return this.bindRenderbuffer.set(m),d.renderbufferStorage(d.RENDERBUFFER,i,o,u),this.bindRenderbuffer.set(null),m}createFramebuffer(i,o,u,d){return new Aa(this,i,o,u,d)}clear({color:i,depth:o,stencil:u,colorMask:d}){const m=this.gl;let _=0;i&&(_|=m.COLOR_BUFFER_BIT,this.clearColor.set(i.toNonPremultipliedRenderColor(null)),this.colorMask.set(d||[!0,!0,!0,!0])),o!==void 0&&(_|=m.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(o),this.depthMask.set(!0)),u!==void 0&&(_|=m.STENCIL_BUFFER_BIT,this.clearStencil.set(u),this.stencilMask.set(255)),m.clear(_)}setCullFace(i){i.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(i.mode),this.frontFace.set(i.frontFace))}setDepthMode(i){i.func!==this.gl.ALWAYS||i.mask?(this.depthTest.set(!0),this.depthFunc.set(i.func),this.depthMask.set(i.mask),this.depthRange.set(i.range)):this.depthTest.set(!1)}setStencilMode(i){i.test.func!==this.gl.ALWAYS||i.mask?(this.stencilTest.set(!0),this.stencilMask.set(i.mask),this.stencilOp.set([i.fail,i.depthFail,i.pass]),this.stencilFunc.set({func:i.test.func,ref:i.ref,mask:i.test.mask})):this.stencilTest.set(!1)}setColorMode(i){a.b7(i.blendFunction,ct.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(i.blendFunction),this.blendColor.set(i.blendColor),i.blendEquation?this.blendEquation.set(i.blendEquation):this.blendEquation.setDefault()),this.colorMask.set(i.mask)}unbindVAO(){this.bindVertexArrayOES.set(null)}}let Mo;function Al(l,i,o,u,d,m,_){const y=l.context,v=y.gl,T=l.transform,I=[a.aH(T.center.lng),a.aL(T.center.lat)],M=o.layout.get("symbol-placement"),C=o.layout.get("text-variable-anchor"),D=o.layout.get("icon-rotation-alignment")==="map",F=o.layout.get("text-rotation-alignment")==="map",z=M!=="point",V=[];let N=0,$=0;for(let Z=0;Z<u.length;Z++){const K=u[Z],te=i.getTile(K),de=te.getBucket(o);if(!de)continue;const se=de.getProjection().createInversionMatrix(T,K.canonical),be=[],_e=ff(K,de,T),Me=!_&&D&&z,Le=_&&F&&z,fe=C&&de.hasTextData(),le=de.hasIconTextFit()&&fe&&de.hasIconData(),xe=Me||Le||_&&fe||le,we=de.projection.name==="globe",Se=we?a.al(T.zoom):0;we&&(be.push("PROJECTION_GLOBE_VIEW"),xe&&be.push("PROJECTED_POS_ON_VIEWPORT"));const $e=l.getOrCreateProgram("collisionBox",{defines:be});let Ve=_e;d[0]===0&&d[1]===0||(Ve=l.translatePosMatrix(_e,te,d,m));const Ne=_?de.textCollisionBox:de.iconCollisionBox,De=de.collisionCircleArray;
3254if(De.length>0){const ot=a.bc(),Ke=Ve;a.cu(ot,de.placementInvProjMatrix,T.glCoordMatrix),a.cu(ot,ot,de.placementViewportMatrix),V.push({circleArray:De,circleOffset:$,transform:Ke,invTransform:ot,projection:de.getProjection()}),N+=De.length/4,$=N}if(!Ne)continue;l.terrain&&l.terrain.setupElevationDraw(te,$e);const tt=we?[K.canonical.x,K.canonical.y,1<<K.canonical.z]:[0,0,0];$e.draw(l,v.LINES,rt.disabled,st.disabled,l.colorModeForRenderPass(),pt.disabled,Qc(Ve,se,T,Se,I,te,tt,de.getProjection()),o.id,Ne.layoutVertexBuffer,Ne.indexBuffer,Ne.segments,null,T.zoom,null,[Ne.collisionVertexBuffer,Ne.collisionVertexBufferExt])}if(!_||!V.length)return;const H=l.getOrCreateProgram("collisionCircle"),j=new a.dL;j.resize(4*N),j._trim();let ne=0;for(const Z of V)for(let K=0;K<Z.circleArray.length/4;K++){const te=4*K,de=Z.circleArray[te+0],se=Z.circleArray[te+1],be=Z.circleArray[te+2],_e=Z.circleArray[te+3];j.emplace(ne++,de,se,be,_e,0),j.emplace(ne++,de,se,be,_e,1),j.emplace(ne++,de,se,be,_e,2),j.emplace(ne++,de,se,be,_e,3)}(!Mo||Mo.length<2*N)&&(Mo=function(Z){const K=2*Z,te=new a.dy;te.resize(K),te._trim();for(let de=0;de<K;de++){const se=6*de;te.uint16[se+0]=4*de+0,te.uint16[se+1]=4*de+1,te.uint16[se+2]=4*de+2,te.uint16[se+3]=4*de+2,te.uint16[se+4]=4*de+3,te.uint16[se+5]=4*de+0}return te}(N));const Y=y.createIndexBuffer(Mo,!0),re=y.createVertexBuffer(j,a.dM.members,!0);for(const Z of V){const K=jf(Z.transform,Z.invTransform,T,Z.projection);H.draw(l,v.TRIANGLES,rt.disabled,st.disabled,l.colorModeForRenderPass(),pt.disabled,K,o.id,re,Y,a.du.simpleSegment(0,2*Z.circleOffset,Z.circleArray.length,Z.circleArray.length/2),null,T.zoom)}re.destroy(),Y.destroy()}const Qe=a.bc();function Oh(l){const i=l._camera.getWorldToCamera(l.worldSize,1),o=a.aD([],i,l.globeMatrix);a.b8(o,o);const u=[0,0,0],d=[0,1,0,0];return a.aE(d,d,o),u[0]=d[0],u[1]=d[1],u[2]=d[2],a.ay(u,u),u}function Jo({width:l,height:i,anchor:o,textOffset:u,textScale:d},m){const{horizontalAlign:_,verticalAlign:y}=a.bG(o),v=-(_-.5)*l,T=-(y-.5)*i,I=a.bH(o,u);return new a.P((v/d+I[0])*m,(T/d+I[1])*m)}function es(l,i,o,u,d,m,_,y,v,T){const I=l.text.placedSymbolArray,M=l.text.dynamicLayoutVertexArray,C=l.icon.dynamicLayoutVertexArray,D={},F=l.getProjection(),z=Tc(_,F,d),V=d.elevation,N=F.upVectorScale(_.canonical,d.center.lat,d.worldSize).metersToTile;M.clear();for(let $=0;$<I.length;$++){const H=I.get($),{tileAnchorX:j,tileAnchorY:ne,numGlyphs:Y}=H,re=H.hidden||!H.crossTileID||l.allowVerticalPlacement&&!H.placedOrientation?null:u[H.crossTileID];if(re){let Z=0,K=0,te=0;const de=l.elevationType==="road";if(V||de){const we=de?l.getElevationFeatureForText($):null,Se=a.bv.getAtTileOffset(_,new a.P(j,ne),V,we),[$e,Ve,Ne]=F.upVector(_.canonical,j,ne);Z=Se*$e*N,K=Se*Ve*N,te=Se*Ne*N}let[se,be,_e,Me]=rn(H.projectedAnchorX+Z,H.projectedAnchorY+K,H.projectedAnchorZ+te,o?z:m);const Le=ih(d.getCameraToCenterDistance(F),Me);let fe=a.bm(l.textSizeData,v,H)*Le/a.bz;o&&(fe*=l.tilePixelRatio/y);const le=Jo(re,fe);o?({x:se,y:be,z:_e}=F.projectTilePoint(j+le.x,ne+le.y,_.canonical),[se,be,_e]=rn(se+Z,be+K,_e+te,m)):(i&&le._rotate(-d.angle),se+=le.x,be+=le.y,_e=0);const xe=l.allowVerticalPlacement&&H.placedOrientation===a.bl.vertical?Math.PI/2:0;for(let we=0;we<Y;we++)a.bo(M,se,be,_e,xe);T&&H.associatedIconIndex>=0&&(D[H.associatedIconIndex]={x:se,y:be,z:_e,angle:xe})}else oa(Y,M)}if(T){C.clear();const $=l.icon.placedSymbolArray;for(let H=0;H<$.length;H++){const j=$.get(H),{numGlyphs:ne}=j,Y=D[H];if(j.hidden||!Y)oa(ne,C);else{const{x:re,y:Z,z:K,angle:te}=Y;for(let de=0;de<ne;de++)a.bo(C,re,Z,K,te)}}l.icon.dynamicLayoutVertexBuffer.updateData(C)}l.text.dynamicLayoutVertexBuffer.updateData(M)}function ru(l,i,o,u,d,m,_={}){const y=o.paint.get("icon-translate"),v=o.paint.get("text-translate"),T=o.paint.get("icon-translate-anchor"),I=o.paint.get("text-translate-anchor"),M=o.layout.get("icon-rotation-alignment"),C=o.layout.get("text-rotation-alignment"),D=o.layout.get("icon-pitch-alignment"),F=o.layout.get("text-pitch-alignment"),z=o.layout.get("icon-keep-upright"),V=o.layout.get("text-keep-upright"),N=o.paint.get("icon-color-saturation"),$=o.paint.get("icon-color-contrast"),H=o.paint.get("icon-color-brightness-min"),j=o.paint.get("icon-color-brightness-max"),ne=o.layout.get("symbol-elevation-reference")==="sea",Y=o.layout.get("icon-image-use-theme")==="none",re=l.context,Z=re.gl,K=l.transform,te=M==="map",de=C==="map",se=D==="map",be=F==="map",_e=o.layout.get("symbol-sort-key").constantOr(1)!==void 0;let Me=!1;const Le=l.depthModeForSublayer(0,rt.ReadOnly),fe=new rt(l.context.gl.LEQUAL,rt.ReadOnly,l.depthRangeFor3D),le=[a.aH(K.center.lng),a.aL(K.center.lat)],xe=o.layout.get("text-variable-anchor"),we=K.projection.name==="globe",Se=[],$e=[0,-1,0];for(const Ve of u){const Ne=i.getTile(Ve),De=Ne.getBucket(o);if(!De||De.projection.name==="mercator"&&we||De.fullyClipped)continue;const tt=De.projection.name==="globe",ot=tt?a.al(K.zoom):0,Ke=Tc(Ve,De.getProjection(),K),et=K.calculatePixelsToTileUnitsMatrix(Ne),_t=xe&&De.hasTextData(),xt=De.hasIconTextFit()&&_t&&De.hasIconData(),gt
3254=De.getProjection().createInversionMatrix(K,Ve.canonical),At=(1<<Ne.tileID.canonical.z)*a.an/l.transform.worldSize,ft=qt=>{let bt=[0,0,0];if(qt){const gi=l.style.directionalLight,ii=l.style.ambientLight;gi&&ii&&(bt=As(l.style,gi,ii))}return bt},Ct=qt=>{if(l.context.disableSymbolUBO)return;qt.push("USE_PAINT_PROPERTIES_UBO");const bt=Math.floor(l.context.maxUniformBlockSize/4),gi=Math.floor(bt/4);qt.push(`MAX_UBO_SIZE_VEC4 ${gi}u`)},yt=qt=>{K.depthOcclusionForSymbolsAndCircles&&(o.hasOcclusionOpacityProperties||l.terrain)&&(qt.push("DEPTH_D24"),qt.push("DEPTH_OCCLUSION"))},kt=qt=>{o.lut&&!Y&&(o.lut.texture||(o.lut.texture=new a.dN(l.context,o.lut.image,[o.lut.image.height,o.lut.image.height,o.lut.image.height],re.gl.RGBA8)),re.activeTexture.set(re.gl.TEXTURE0+10),o.lut.texture&&o.lut.texture.bind(re.gl.LINEAR,re.gl.CLAMP_TO_EDGE),qt.push("APPLY_LUT_ON_GPU"))},ti=()=>{const qt=te&&o.layout.get("symbol-placement")!=="point",bt=[];yt(bt),kt(bt);const gi=qt||xt,ii=De.elevationType==="road",Wi=l.shadowRenderer,Rt=ii&&se&&!!Wi&&Wi.enabled,ni=ft(Rt),Qi=ii&&se&&!l.terrain?fe:Le,Er=o.paint.get("icon-image-cross-fade");l.terrainRenderModeElevated()&&se&&bt.push("PITCH_WITH_MAP_TERRAIN"),tt&&(bt.push("PROJECTION_GLOBE_VIEW"),gi&&bt.push("PROJECTED_POS_ON_VIEWPORT")),Er>0&&De.hasAnySecondaryIcon&&bt.push("ICON_TRANSITION"),!De.icon.zOffsetVertexBuffer||ii&&l.terrain||bt.push("Z_OFFSET"),N===0&&$===0&&H===0&&j===1||bt.push("COLOR_ADJUSTMENT"),De.sdfIcons&&bt.push("RENDER_SDF"),Rt&&bt.push("RENDER_SHADOWS","NORMAL_OFFSET"),ii&&se&&!l.terrain&&De.icon.orientationVertexBuffer&&bt.push("ELEVATED_ROADS"),Ct(bt);const rr=re.disableSymbolUBO?De.icon.programConfigurations.get(o.id):null,mr=l.getOrCreateProgram("symbol",{config:rr,defines:bt}),an=Ne.imageAtlasTexture?Ne.imageAtlasTexture.size:[0,0],Xt=De.iconSizeData,xn=a.bk(Xt,K.zoom),vn=se||!K.isOrthographic,ci=sl(Ke,Ne.tileID.canonical,se,te,K,De.getProjection(),et),ui=Hn(Ke,Ne.tileID.canonical,se,te,K,De.getProjection(),et),Qt=De.icon.uboBinder&&De.icon.uboBinder.cachedHeader&&256&De.icon.uboBinder.cachedHeader.dataDrivenMask?[0,0]:y,qi=l.translatePosMatrix(ui,Ne,Qt,T,!0),Pr=l.translatePosMatrix(Ke,Ne,Qt,T),zi=gi?Qe:ci,ln=te&&!se&&!qt;let ns=$e;!we&&!K.mercatorFromTransition||te||(ns=Oh(K));const Ns=tt?ns:$e,Us=o.getColorAdjustmentMatrix(N,$,H,j),La=Gf(Xt.kind,xn,ln,se,l,Pr,zi,qi,ne,!1,an,[0,0],0,Ve,ot,le,gt,Ns,De.getProjection(),ni,At,Us,Er,null),zo=Ne.imageAtlasTexture?Ne.imageAtlasTexture:null,ho=o.layout.get("icon-size").constantOr(0)!==1||De.iconsNeedLinear,Fa=De.sdfIcons||l.options.rotating||l.options.zooming||ho||vn?Z.LINEAR:Z.NEAREST,Xr=De.sdfIcons&&o.paint.get("icon-halo-width").constantOr(1)!==0,os=l.terrain&&se&&qt?a.b8(a.bc(),ci):Qe;if(qt&&De.icon){const ss=a.bv.getAtTileOffsetFunc(Ve,K.center.lat,K.worldSize,De.getProjection()),as=ra(Ke,Ne.tileID.canonical,se,te,K,De.getProjection(),et),Iu=o.layout.get("icon-size-scale-range"),Oa=a.aC(l.scaleFactor,Iu[0],Iu[1]);na(De,Ke,l,!1,as,ui,se,z,ss,Ve,Oa)}return{program:mr,buffers:De.icon,uniformValues:La,atlasTexture:zo,atlasTextureIcon:null,atlasInterpolation:Fa,atlasInterpolationIcon:null,isSDF:De.sdfIcons,hasHalo:Xr,depthMode:Qi,tile:Ne,renderWithShadows:Rt,labelPlaneMatrixInv:os}},wi=()=>{const qt=de&&o.layout.get("symbol-placement")!=="point",bt=[],gi=qt||xe||xt,ii=De.elevationType==="road",Wi=l.shadowRenderer,Rt=ii&&be&&!!Wi&&Wi.enabled,ni=ft(Rt),Qi=ii&&be&&!l.terrain?fe:Le;l.terrainRenderModeElevated()&&be&&bt.push("PITCH_WITH_MAP_TERRAIN"),tt&&(bt.push("PROJECTION_GLOBE_VIEW"),gi&&bt.push("PROJECTED_POS_ON_VIEWPORT")),!De.text.zOffsetVertexBuffer||ii&&l.terrain||bt.push("Z_OFFSET"),De.iconsInText&&bt.push("RENDER_TEXT_AND_SYMBOL"),bt.push("RENDER_SDF"),Rt&&bt.push("RENDER_SHADOWS","NORMAL_OFFSET"),ii&&be&&!l.terrain&&De.text.orientationVertexBuffer&&bt.push("ELEVATED_ROADS"),yt(bt),Ct(bt);const Er=re.disableSymbolUBO?De.text.programConfigurations.get(o.id):null,rr=l.getOrCreateProgram("symbol",{config:Er,defines:bt});let mr,an=[0,0],Xt=null;const xn=De.textSizeData;De.iconsInText&&(an=Ne.imageAtlasTexture?Ne.imageAtlasTexture.size:[0,0],Xt=Ne.imageAtlasTexture?Ne.imageAtlasTexture:null,mr=be||!K.isOrthographic||l.options.rotating||l.options.zooming||xn.kind==="composite"||xn.kind==="camera"?Z.LINEAR:Z.NEAREST);const vn=Ne.glyphAtlasTexture?Ne.glyphAtlasTexture.size:[0,0],ci=o.layout.get("text-size-scale-range"),ui=a.aC(l.scaleFactor,ci[0],ci[1]),Qt=a.bk(xn,K.zoom,ui),qi=sl(Ke,Ne.tileID.canonical,be,de,K,De.getProjection(),et),Pr=Hn(Ke,Ne.tileID.canonical,be,de,K,De.getProjection(),et),zi=De.text.uboBinder&&De.text.uboBinder.cachedHeader&&256&De.text.uboBinder.cachedHeader.dataDrivenMask?[0,0]:v,ln=l.translatePosMatrix(Pr,Ne,zi,I,!0),ns=l.translatePosMatrix(Ke,Ne,zi,I),Ns=gi?Qe:qi,Us=de&&!be&&!qt;let La=$e;!we&&!K.mercatorFromTransition||de||(La=Oh(K));const zo=Gf(xn.kind,Qt,Us,be,l,ns,Ns,ln,ne,!0,vn,an,0,Ve,ot,le,gt,tt?La:$e,De.getProjection(),ni,At,null,null,ui),ho=Ne.glyphAtlasTexture?Ne.glyphAtlasTexture:null,Fa=Z.LINEAR,Xr=o.paint.get("text-halo-width").constantOr(1)!==0,os=l.terrain&&be&&qt?a.b8(a.bc(),qi):Qe;if(qt&&De.text){const ss=a.bv.getAtTileOffsetFunc(Ve,K.center.lat,K.worldSize,De.getProjection()),as=ra(Ke,Ne.tileID.canonical,be,de,K,De.getProjection(),et);na(De,Ke,l,!0,as,Pr,be,V,ss,Ve,ui)}return{program:rr,buffers:De.text,uniformValues:zo,atlasTexture:ho,atlasTextureIcon:Xt,atlasInterpolation:Fa,atlasInterpolationIcon:mr,isSDF:!0,hasHalo:Xr,depthMode:Qi,tile:Ne,renderWithShadows:Rt,labelPlaneMatr
vendor: 3,414 bytes, line 3254
3254ixInv:os}},si=De.icon.segments.get().length,Gt=De.text.segments.get().length,It=si&&!_.onlyText?ti():null,Et=Gt&&!_.onlyIcons?wi():null,ai=o.paint.get("icon-opacity").constantOr(1),Ii=o.paint.get("text-opacity").constantOr(1);if(_e&&De.canOverlap){Me=!0;const qt=ai&&!_.onlyText?De.icon.segments.get():[],bt=Ii&&!_.onlyIcons?De.text.segments.get():[];for(const gi of qt)Se.push({segments:new a.du([gi]),sortKey:gi.sortKey,state:It});for(const gi of bt)Se.push({segments:new a.du([gi]),sortKey:gi.sortKey,state:Et})}else _.onlyText||Se.push({segments:ai?De.icon.segments:new a.du([]),sortKey:0,state:It}),_.onlyIcons||Se.push({segments:Ii?De.text.segments:new a.du([]),sortKey:0,state:Et})}Me&&Se.sort((Ve,Ne)=>Ve.sortKey-Ne.sortKey);for(const Ve of Se){const Ne=Ve.state;if(Ne)if(l.terrain?l.terrain.setupElevationDraw(Ne.tile,Ne.program,{useDepthForOcclusion:K.depthOcclusionForSymbolsAndCircles,labelPlaneMatrixInv:Ne.labelPlaneMatrixInv}):l.setupDepthForOcclusion(K.depthOcclusionForSymbolsAndCircles,Ne.program),re.activeTexture.set(Z.TEXTURE0),Ne.atlasTexture&&Ne.atlasTexture.bind(Ne.atlasInterpolation,Z.CLAMP_TO_EDGE,!0),Ne.atlasTextureIcon&&(re.activeTexture.set(Z.TEXTURE1),Ne.atlasTextureIcon&&Ne.atlasTextureIcon.bind(Ne.atlasInterpolationIcon,Z.CLAMP_TO_EDGE,!0)),Ne.renderWithShadows&&l.shadowRenderer.setupShadows(Ne.tile.tileID.toUnwrapped(),Ne.program,"vector-tile"),l.uploadCommonLightUniforms(l.context,Ne.program),Ne.hasHalo){const De=Ne.uniformValues;De.u_is_halo=1,nu(Ne.buffers,Ve.segments,o,l,Ne.program,Ne.depthMode,d,m,De,2),De.u_is_halo=0}else{if(Ne.isSDF){const De=Ne.uniformValues;Ne.hasHalo&&(De.u_is_halo=1,nu(Ne.buffers,Ve.segments,o,l,Ne.program,Ne.depthMode,d,m,De,1)),De.u_is_halo=0}nu(Ne.buffers,Ve.segments,o,l,Ne.program,Ne.depthMode,d,m,Ne.uniformValues,1)}}}function nu(l,i,o,u,d,m,_,y,v,T){const I=u.context,M=I.gl,C=[l.dynamicLayoutVertexBuffer,l.opacityVertexBuffer,l.iconTransitioningVertexBuffer,l.globeExtVertexBuffer,l.zOffsetVertexBuffer,l.orientationVertexBuffer];l.featureIdBuffer&&C.push(l.featureIdBuffer);const D=l.uboBinder?null:l.programConfigurations.get(o.id);if(l.uboBinder){l.uboBinder.layer=o;const V=u.transform.zoom,N=u.style.getBrightness?u.style.getBrightness():null,$=l.uboBinder.getConstantUniformValues(V,N);v.u_spp_fill_np_color=$.fill_np_color,v.u_spp_halo_np_color=$.halo_np_color,v.u_spp_opacity=$.opacity,v.u_spp_halo_width=$.halo_width,v.u_spp_halo_blur=$.halo_blur,v.u_spp_emissive_strength=$.emissive_strength,v.u_spp_occlusion_opacity=$.occlusion_opacity,v.u_spp_z_offset=$.z_offset;const H=o.paint.get(l.uboBinder.isText?"text-translate-anchor":"icon-translate-anchor"),j=l.uboBinder.cachedHeader&&256&l.uboBinder.cachedHeader.dataDrivenMask&&H==="map"?u.transform.angle:0;v.u_spp_translate_rotation=[Math.cos(j),Math.sin(j)]}const{batchIndices:F,batchSegments:z}=l.getBatchGrouping(i);for(const V of F){const N=z.get(V);l.uboBinder&&l.uboBinder.bind(I,d.program,V),d.draw(u,M.TRIANGLES,m,_,y,pt.disabled,v,o.id,l.layoutVertexBuffer,l.indexBuffer,N,o.paint,u.transform.zoom,D,C,T)}}function ou(l,i,o,u,d,m){const _=o.paint.get("line-width"),y=o.paint.get("line-emissive-strength").isConstant(),v=o.paint.get("line-emissive-strength").constantOr(0),T=o.paint.get("line-occlusion-opacity"),I=o.layout.get("line-elevation-reference"),M=o.layout.get("line-width-unit")==="meters",C=I==="sea",D=!(!l.terrain||!l.terrain.enabled),F=l.context,z
3254=F.gl;if(o.hasElevatedBuckets&&l.transform.projection.name==="globe")return;const V=o.layout.get("line-cross-slope"),N=V!==void 0,$=V<1,H=d||l.colorModeForDrapableLayerRenderPass(y?v:null),j=l.terrain&&l.terrain.renderingToTexture||m,ne=j?1:a.o.devicePixelRatio,Y=o.paint.get("line-dasharray"),re=Y.constantOr(1),Z=o.layout.get("line-cap"),K=Y.constantOr(null),te=Z.constantOr(null),de=o.paint.get("line-pattern"),se=de.constantOr(1),be=o.paint.get("line-pattern-cross-fade"),_e=de.constantOr(null),Me=o.paint.get("line-opacity").constantOr(1);let Le=!se&&Me!==1||l.depthOcclusion&&T>0&&T<1;const fe=o.paint.get("line-gradient"),le=se?"linePattern":"line",xe=a.dQ(o);let we;if(j&&l.terrain&&l.terrain.clipOrMaskOverlapStencilType()&&(Le=!1),T!==0&&l.depthOcclusion){const De=o.paint._values["line-opacity"];De&&De.value&&De.value.kind==="constant"?we=De.value:a.w(`Occlusion opacity for layer ${o.id} is supported only when line-opacity isn't data-driven.`)}_.value.kind!=="constant"&&_.value.isLineProgressConstant===!1&&xe.push("VARIABLE_LINE_WIDTH"),j&&(l.emissiveMode!=="dual-source-blending"||y?l.emissiveMode==="mrt-fallback"&&xe.push("USE_MRT1"):xe.push("DUAL_SOURCE_BLENDING"));const Se={},$e=(De,tt,ot,Ke,et,_t)=>{for(const xt of De){const gt=i.getTile(xt);if(se&&!gt.patternsLoaded())continue;const At=gt.getBucket(o);if(!At||At.elevationType!=="none"&&!et||At.elevationType==="none"&&et)continue;l.prepareDrawTile();const ft=[...tt],Ct=l.shadowRenderer,yt=At.elevationType==="road"&&!!Ct&&Ct.enabled;let kt=[0,0,0];if(yt){const Rt=l.style.directionalLight,ni=l.style.ambientLight;Rt&&ni&&(kt=As(l.style,Rt,ni)),ft.push("RENDER_SHADOWS","NORMAL_OFFSET")}const ti=At.programConfigurations.get(o.id);let wi=!1;if(_e&&gt.imageAtlas){const Rt=a.dR.from(_e),ni=Rt.getPrimary().scaleSelf(ne).toString(),Qi=gt.imageAtlas.patternPositions.get(ni),Er=Rt.getSecondary(),rr=Er?gt.imageAtlas.patternPositions.get(Er.scaleSelf(ne).toString()):null;wi=!!Qi&&!!rr,Qi&&ti.setConstantPatternPositions(Qi,rr)}be>0&&(wi||ti.getPatternTransitionVertexBuffer("line-pattern"))&&ft.push("LINE_PATTERN_TRANSITION"),At.elevationGroundScaleVertexBuffer&&ft.push("ELEVATION_GROUND_SCALE");const si=l.isTileAffectedByFog(xt),Gt=l.getOrCreateProgram(le,{config:ti,defines:ft,overrideFog:si});if(!se&&K&&te&&gt.lineAtlas){const Rt=gt.lineAtlas.getDash(K,te);Rt&&ti.setConstantPatternPositions(Rt)}yt&&Ct.setupShadows(gt.tileID.toUnwrapped(),Gt,"vector-tile");let[It,Et]=o.paint.get("line-trim-offset");(te==="round"||te==="square")&&It!==Et&&(It===0&&(It-=1),Et===1&&(Et+=1));const ai=j?xt.projMatrix:null,Ii=M?1/At.tileToMeter/a.aA(gt,1,l.transform.zoom):1,qt=M?1/At.tileToMeter/a.aA(gt,1,Math.floor(l.transform.zoom)):1,bt=re?o.paint._values["line-floorwidth"]:null;let gi;if(bt&&bt.value.kind==="constant"){const Rt=At.zoom;Rt in Se||(Se[Rt]=Math.max(.01,o.widthExpression().evaluate({zoom:Rt}))),gi=bt.value.value;const ni=Math.floor(l.transform.zoom);bt.value.value=Se[Rt]*Math.pow(2,ni-gt.tileID.overscaledZ)}const ii=se?a.dS(l,gt,o,ai,ne,Ii,qt,[It,Et],kt,be):a.dT(l,gt,o,ai,At.lineClipsArray.length,ne,Ii,qt,[It,Et],kt);if(fe){const Rt=At.gradients[o.id];let ni=Rt.texture;if(o.gradientVersion!==Rt.version){let Qi=256;if(o.stepInterpolant){const Er=i.getSource().maxzoom,rr=xt.canonical.z===Er?Math.ceil(1<<l.transform.maxZoom-xt.canonical.z):1;Qi=a.aC(a.dU(At.maxLineLength/a.an*1024*rr),256,F.maxTextureSize)}Rt.gradient=a.dV({expression:o.gradientExpression(),evaluationKey:"lineProgress",resolution:Qi,image:Rt.gradient||void 0,clips:At.lineClipsArray}),Rt.texture?Rt.texture.update(Rt.gradient):Rt.texture=new a.T(F,Rt.gradient,z.RGBA8),Rt.version=o.gradientVersion,ni=Rt.texture}F.activeTexture.set(z.TEXTURE1),ni.bind(o.stepInterpolant?z.NEAREST:z.LINEAR,z.CLAMP_TO_EDGE)}re&&(F.activeTexture.set(z.TEXTURE0),gt.lineAtlasTexture&&gt.lineAtlasTexture.bind(z.LINEAR,z.REPEAT),ti.updatePaintBuffers()),se&&(F.activeTexture.set(z.TEXTURE0),gt.imageAtlasTexture&&gt.imageAtlasTexture.bind(z.LINEAR,z.CLAMP_TO_EDGE),ti.updatePaintBuffers()),et&&l.terrain.setupElevationDraw(gt,Gt),l.uploadCommonUniforms(F,Gt,xt.toUnwrapped());const Wi=Rt=>{we!=null&&(we.value=Me*T),Gt.draw(l,z.TRIANGLES,ot,Rt,H,pt.disabled,ii,o.id,At.layoutVertexBuffer,At.indexBuffer,At.segments,o.paint,l.transform.zoom,ti,[At.layoutVertexBuffer2,At.patternVertexBuffer,At.zOffsetVertexBuffer,At.elevationGroundScaleVertexBuffer]),we!=null&&(we.value=Me)};if(Le&&!et){const Rt=l.stencilModeForClipping(xt).ref;Rt===0&&j&&F.clear({stencil:0});const ni={func:z.EQUAL,mask:255};
3254ii.u_alpha_discard_threshold=.8,Wi(new st(ni,Rt,255,z.KEEP,z.KEEP,z.INVERT)),ii.u_alpha_discard_threshold=0,Wi(new st(ni,Rt,255,z.KEEP,z.KEEP,z.KEEP))}else ii.u_alpha_discard_threshold=Le&&et&&_t?.8:0,Wi(et?Ke:l.stencilModeForClipping(xt));gi!==void 0&&(bt.value.value=gi)}};let Ve=l.depthModeForSublayer(0,rt.ReadOnly);const Ne=new rt(l.depthOcclusion?z.GREATER:z.LEQUAL,rt.ReadOnly,l.depthRangeFor3D);if(o.hasNonElevatedBuckets){const De=!j&&l.terrain;T!==0&&De?a.w(`Occlusion opacity for layer ${o.id} is supported on terrain only if the layer has line-z-offset enabled.`):De?a.w(`Cannot render non-elevated lines in immediate mode when terrain is enabled. Layer: ${o.id}.`):$e(u,xe,Ve,st.disabled,!1,!0)}if(o.hasElevatedBuckets){I==="hd-road-markup"?D||(Ve=Ne,xe.push("ELEVATED_ROADS")):(xe.push("ELEVATED"),Ve=Ne,N&&xe.push($?"CROSS_SLOPE_HORIZONTAL":"CROSS_SLOPE_VERTICAL"),C&&xe.push("ELEVATION_REFERENCE_SEA"));const De=Le?l.stencilModeFor3D():st.disabled;l.forceTerrainMode=!0,$e(u,xe,Ve,De,!0,!0),Le&&$e(u,xe,Ve,De,!0,!1),l.forceTerrainMode=!1}Le&&(l.resetStencilClippingMasks(),j&&F.clear({stencil:0})),T===0||l.depthOcclusion||j||l.layersWithOcclusionOpacity.push(l.currentLayer)}const Po={additive:{clearColor:new a.aq(0,0,0,0),colorMode:ct.additive,compositeUniformValue:1},multiply:{clearColor:new a.aq(1,1,1,1),colorMode:ct.multiply,compositeUniformValue:0}};function Bh(l,i){const o=1<<l.canonical.z,u=(i.x*o-l.canonical.x-l.wrap*o)*a.an,d=(i.y*o-l.canonical.y)*a.an,m=a.dW(i.z,i.y);return a.cM(u,d,m)}function kh(l,i,o,u,d){if(!o.layout||o.layout.get("fill-elevation-reference")==="none"||o.paint.get("fill-opacity").constantOr(1)===0)return;const m=l.context.gl,_=new rt(l.context.gl.LEQUAL,rt.ReadWrite,l.depthRangeFor3D),y=new rt(l.context.gl.GREATER,rt.ReadWrite,l.depthRangeFor3D),v=function(D){let F=.01;return D.isOrthographic&&(F=a.am(1e-4,F,a.cH(D.pitch>=Wr?1:D.pitch/Wr))),2*F}(l.transform),T=l.transform.getFreeCameraOptions().position,I="elevatedStructuresDepthReconstruct",M=l.getOrCreateProgram(I,{defines:["DEPTH_RECONSTRUCTION"]}),C=l.getOrCreateProgram(I);for(const D of u){const F=i.getTile(D),z=F.getBucket(o);if(!z)continue;const V=z.elevatedStructures;if(!V)continue;const N=z.elevationBufferData.heightRange,$=Bh(D.toUnwrapped(),T),H=l.translatePosMatrix(D.projMatrix,F,o.paint.get("fill-translate"),o.paint.get("fill-translate-anchor"));let j,ne,Y,re;if(d==="initialize"){if(!N||N.min>=1||V.depthSegments.segments[0].primitiveLength===0)continue;j=Sl(H,$,v,1,0),ne=_,Y=V.depthSegments,re=M}else if(d==="reset"){if(!N||N.min>=0||V.maskSegments.segments[0].primitiveLength===0)continue;j=Sl(H,$,0,0,1),ne=y,Y=V.maskSegments,re=M}else if(d==="geometry"){if(V.depthSegments.segments[0].primitiveLength===0)continue;j=Sl(H,$,v,1,0),ne=_,Y=V.depthSegments,re=C}re.draw(l,m.TRIANGLES,ne,st.disabled,ct.disabled,pt.disabled,j,o.id,V.vertexBuffer,V.indexBuffer,Y,o.paint,l.transform.zoom)}}function Ca(l,i,o,u){const{painter:d,sourceCache:m,layer:_,coords:y,colorMode:v,elevationType:T,terrainEnabled:I,pass:M}=l,C=d.context.gl,D=_.paint.get("fill-pattern"),F=_.paint.get("fill-pattern-cross-fade"),z=D.constantOr(null);let V=T;T!=="road"||i&&!I||(V="none");const N=V==="road",$=l.painter.shadowRenderer,H=N&&!!$&&$.enabled,j=new rt(d.context.gl.LEQUAL,rt.ReadOnly,d.depthRangeFor3D);let ne=[0,0,0];if(H){const K=d.style.directionalLight,te=d.style.ambientLight;K&&te&&(ne=As(d.style,K,te))}const Y=D&&D.constantOr(1),re=d.terrain&&d.terrain.renderingToTexture,Z=(K,te)=>{let de,se,be,_e,Me;te?(de=Y&&!_.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",be=C.LINES):(de=Y?"fillPattern":"fill",be=C.TRIANGLES);for(const Le of y){const fe=m.getTile(Le);if(Y&&!fe.patternsLoaded())continue;const le=fe.getBucket(_);if(!le)continue;const xe=i?le.elevationBufferData:le.bufferData;if(xe.isEmpty())continue;d.prepareDrawTile();const we=xe.programConfigurations.get(_.id),Se=d.isTileAffectedByFog(Le),$e=[],Ve=[];N&&($e.push("ELEVATED_ROADS"),Ve.push(xe.elevatedLayoutVertexBuffer)),H&&$e.push("RENDER_SHADOWS","NORMAL_OFFSET"),re&&o&&$e.push("USE_MRT1"),Y&&(d.context.activeTexture.set(C.TEXTURE0),fe.imageAtlasTexture&&fe.imageAtlasTexture.bind(C.LINEAR,C.CLAMP_TO_EDGE),we.updatePaintBuffers());let Ne=!1;if(z&&fe.imageAtlas){const et=fe.imageAtlas,_t=a.dR.from(z),xt=_t.getPrimary().scaleSelf(a.o.devicePixelRatio).toString(),gt=_t.getSecondary(),At=et.patternPositions.get(xt),ft=gt?et.patternPositions.get(gt.scaleSelf(a.o.devicePixelRatio).toString()):null;Ne=!!At&&!!ft,At&&we.setConstantPatternPositions(At,ft)}F>0&&(Ne||we.getPatternTransitionVertexBuffer("fill-pattern"))&&$e.push("FILL_PATTERN_TRANSITION");const De=d.getOrCreateProgram(de,{config:we,overrideFog:Se,defines:$e}),tt=d.translatePosMatrix(Le.projMatrix,fe,_.paint.get("fill-translate"),_.paint.get("fill-translate-anchor"));H&&$.setupShadows(fe.tileID.toUnwrapped(),De,"vector-tile");const ot=_.paint.get("fill-emissive-strength");if(te){_e=xe.lineIndexBuffer,Me=xe.lineSegments;const et=d.terrain&&d.terrain.renderingToTexture?d.terrain.drapeBufferSize:[C.drawingBufferWidth,C.drawingBufferHeight];se=de==="fillOutlinePattern"&&Y?Nf(tt,ot,d,fe,et,ne,F):Ah(tt,ot,et,ne)}else _e=xe.indexBuffer,Me=xe.triangleSegments,se=Y?Yc(tt,ot,d,fe,ne,F):Vf(tt,ot,ne);d.uploadCommonUniforms(d.context,De,Le.toUnwrapped());let Ke=K;(T==="road"&&!I||T==="offset")&&(Ke=j),De.draw(d,be,Ke,u||d.stencilModeForClipping(Le),v,pt.disabled,se,_.id,xe.layoutVertexBuffer,_e,Me,_.paint,d.transform.zoom,we,Ve)}};d.renderPass===M&&Z(d.depthModeForSublayer(1,d.renderPass==="opaque"?rt.ReadWrite:rt.ReadOnly),!1),V==="none"&&d.renderPass==="translucent"&&_.paint.get("fill-antialias")&&Z(d.depthModeForSublayer(_.getPaintProperty("fill-outline-color")?2:0,rt.ReadOnly),!0)}function Ma(l,i,o,u,d,m,_,y){o.resetLayerRenderingStats(l);const v=l.context,T=v.gl,I=l.transform,M=o.paint.get("fill-extrusion-pattern"),C=o.paint.get("fill-extrusion-pattern-cross-fade"),D=M.c
vendor: 9,284 bytes, line 3254
3254onstantOr(null),F=M.constantOr(1),z=o.paint.get("fill-extrusion-opacity"),V=l.style.enable3dLights(),N=o.paint.get(V&&!F?"fill-extrusion-ambient-occlusion-wall-radius":"fill-extrusion-ambient-occlusion-radius"),$=[o.paint.get("fill-extrusion-ambient-occlusion-intensity"),N],H=o.layout.get("fill-extrusion-edge-radius"),j=H>0&&!o.paint.get("fill-extrusion-rounded-roof"),ne=j?0:H,Y=I.projection.name==="globe"?a.dZ():0,re=I.projection.name==="globe",Z=re?a.al(I.zoom):0,K=[a.aH(I.center.lng),a.aL(I.center.lat)],te=o.paint.get("fill-extrusion-flood-light-color-use-theme").constantOr("default")==="none",de=o.paint.get("fill-extrusion-flood-light-color").toNonPremultipliedRenderColor(te?null:o.lut).toArray01().slice(0,3),se=o.paint.get("fill-extrusion-flood-light-intensity"),be=o.paint.get("fill-extrusion-vertical-scale"),_e=o.paint.get("fill-extrusion-line-width").constantOr(1)!==0,Me=o.paint.get("fill-extrusion-height-alignment"),Le=o.paint.get("fill-extrusion-base-alignment"),fe=no(l,o.paint.get("fill-extrusion-cutoff-fade-range")),le=o.paint.get("fill-extrusion-front-cutoff"),xe=su(I.pitch,le,!!l.terrain),we=xe[2]<1;we&&(l.maxFrontCutoffRawStart=Math.max(l.maxFrontCutoffRawStart,le[0]));const Se=[];let $e;re&&Se.push("PROJECTION_GLOBE_VIEW"),$[0]>0&&Se.push("FAUX_AO"),j&&Se.push("ZERO_ROOF_RADIUS"),y&&Se.push("HAS_CENTROID"),se>0&&Se.push("FLOOD_LIGHT"),fe.shouldRenderCutoff&&Se.push("RENDER_CUTOFF"),we&&Se.push("RENDER_FRONT_CUTOFF"),_e&&Se.push("RENDER_WALL_MODE");const Ve=l.renderPass==="shadow",Ne=l.shadowRenderer,De=Ve&&!!Ne,tt=Ve?pt.disabled:pt.backCCW;l.shadowRenderer&&(l.shadowRenderer.useNormalOffset=!0);let ot=[0,0,0];if(Ne){const _t=l.style.directionalLight,xt=l.style.ambientLight;_t&&xt&&(ot=As(l.style,_t,xt)),Ve||(Se.push("RENDER_SHADOWS"),Ne.useNormalOffset&&Se.push("NORMAL_OFFSET")),$e=Se.concat(["SHADOWS_SINGLE_CASCADE"])}const Ke=De?"fillExtrusionDepth":F?"fillExtrusionPattern":"fillExtrusion",et=o.getLayerRenderingStats();for(const _t of u){const xt=i.getTile(_t),gt=xt.getBucket(o);if(!gt||gt.projection.name!==I.projection.name)continue;let At=!1;Ne&&(At=Ne.getMaxCascadeForTile(_t.toUnwrapped())===0);const ft=l.isTileAffectedByFog(_t),Ct=gt.programConfigurations.get(o.id);let yt=!1;if(D&&xt.imageAtlas){const Et=xt.imageAtlas,ai=a.dR.from(D),Ii=ai.getPrimary().scaleSelf(a.o.devicePixelRatio).toString(),qt=ai.getSecondary(),bt=Et.patternPositions.get(Ii),gi=qt?Et.patternPositions.get(qt.scaleSelf(a.o.devicePixelRatio).toString()):null;yt=!!bt&&!!gi,bt&&Ct.setConstantPatternPositions(bt,gi)}C>0&&(yt||Ct.getPatternTransitionVertexBuffer("fill-extrusion-pattern"))&&Se.push("FILL_EXTRUSION_PATTERN_TRANSITION");const kt=l.getOrCreateProgram(Ke,{config:Ct,defines:At?$e:Se,overrideFog:ft});if(l.terrain&&l.terrain.setupElevationDraw(xt,kt,{useMeterToDem:!0}),!gt.centroidVertexBuffer){const Et=kt.getAttributeLocation(T,"a_centroid_pos");Et!==-1&&T.vertexAttribI4ui(Et,0,0,0,0)}!Ve&&Ne&&Ne.setupShadows(xt.tileID.toUnwrapped(),kt,"vector-tile"),F&&(l.context.activeTexture.set(T.TEXTURE0),xt.imageAtlasTexture&&xt.imageAtlasTexture.bind(T.LINEAR,T.CLAMP_TO_EDGE),Ct.updatePaintBuffers());const ti=o.paint.get("fill-extrusion-vertical-gradient"),wi=1/gt.tileToMeter;let si;if(Ve&&Ne){if(au(xt.tileID,gt.maxHeight,l))continue;const Et=Ne.calculateShadowPassMatrixFromTile(xt.tileID.toUnwrapped());si=qm(Et,ne,wi,be,Me,Le)}else{const Et=l.translatePosMatrix(_t.expandedProjMatrix,xt,o.paint.get("fill-extrusion-translate"),o.paint.get("fill-extrusion-translate-anchor")),ai=I.projection.createInversionMatrix(I,_t.canonical);si=F?$m(Et,l,ti,z,$,ne,wi,_t,xt,Y,Me,Le,Z,K,ai,de,be,C):kf(Et,l,ti,z,$,ne,wi,_t,Y,Me,Le,Z,K,ai,de,be,se,ot,xe)}l.uploadCommonUniforms(v,kt,_t.toUnwrapped(),null,fe);let Gt=gt.segments;if(I.projection.name==="mercator"&&!Ve&&(Gt=gt.getVisibleSegments(xt.tileID,l.terrain,l.transform.getFrustum(0)),!Gt.get().length))continue;if(et)if(Ve)for(const Et of Gt.get())et.numRenderedVerticesInShadowPass+=Et.primitiveLength;else for(const Et of Gt.get())et.numRenderedVerticesInTransparentPass+=Et.primitiveLength;const It=[];(l.terrain||y)&&It.push(gt.centroidVertexBuffer),re&&It.push(gt.layoutVertexExtBuffer),_e&&It.push(gt.wallVertexBuffer),kt.draw(l,v.gl.TRIANGLES,d,m,_,tt,si,o.id,gt.layoutVertexBuffer,gt.indexBuffer,Gt,o.paint,l.transform.zoom,Ct,It)}l.shadowRenderer&&(l.shadowRenderer.useNormalOffset=!1)}class Cl{constructor(){this.translate=[0,0],this.translateAnchor="map",this.edgeRadius=0,this.cutoffFadeRange=0}}function su(l,i,o){if(!(i[2]<1)||o)return[0,0,1];const u=180*l/Math.PI;if(u<15)return[-.5,i[1],i[2]];const d=Math.min(1,Math.max(0,(u-15)/5)),m=d*d*(3-2*d);return[-.5*(1-m)+i[0]*m,i[1],i[2]]}function ao(l,i,o,u,d,m,_,y,v,T,I,M,C,D,F,z,V,N,$,H,j){const ne=i.context,Y=ne.gl,re=i.transform,Z=i.transform.zoom,K=[],te=l.translate,de=l.translateAnchor,se=l.edgeRadius,be=no(i,l.cutoffFadeRange);I==="clear"?(K.push("CLEAR_SUBPASS"),H&&(K.push("CLEAR_FROM_TEXTURE"),ne.activeTexture.set(Y.TEXTURE0),H.bind(Y.LINEAR,Y.CLAMP_TO_EDGE))):I==="sdf"?K.push("SDF_SUBPASS"):I==="emissive"&&(K.push("USE_MRT1"),ne.activeTexture.set(Y.TEXTURE0),H.bind(Y.LINEAR,Y.CLAMP_TO_EDGE)),N&&K.push("HAS_CENTROID"),be.shouldRenderCutoff&&K.push("RENDER_CUTOFF");const _e=(Me,Le,fe,le,xe)=>{let we=K;Le.groundRadiusBuffer!=null&&(we=K.concat("HAS_ATTRIBUTE_a_flood_light_ground_radius"));const Se=Le.programConfigurations.get(u.id),$e=i.isTileAffectedByFog(Me),Ve=i.getOrCreateProgram("fillExtrusionGroundEffect",{config:Se,defines:we,overrideFog:$e}),Ne=((tt,ot,Ke,et,_t,xt,gt,At,ft,Ct,yt)=>({u_matrix:ot,u_opacity:Ke,u_ao_pass:et?1:0,u_meter_to_tile:_t,u_ao:xt,u_flood_light_intensity:gt,u_flood_light_color:At,u_attenuation:ft,u_edge_radius:Ct,u_fb:0,u_fb_size:yt,u_dynamic_offset:1}))(0,le,M,T,xe,[C,D*xe],F,z,V,Z>=17?0:se*xe,H?H.size[0]:0),De=[];N&&De.push(Le.hiddenByLandmarkVertexBuffer),Le.groundRadiusBuffer!=null&&De.push(Le.groundRadiusBuffer),i.uploadCommonUniforms(ne,Ve,Me.toUnwrapped(),null,be),Ve.draw(i,ne.gl.TRIANGLES,m,_,y,v,Ne,u.id,Le.vertexBuffer,Le.indexBuffer,fe,u.paint,Z,Se,De)};for(const Me of d){const Le=o.getTile(Me),fe=Le.getBucket(u);if(!fe||fe.projection.name!==re.projection.name||!fe.groundEffect||fe.groundEffect&&!fe.groundEffect.hasData())continue;const le=fe.groundEffect,xe=1/fe.tileToMeter;{const we=i.translatePosMatrix(Me.projMatrix,Le,te,de),Se=le.getDefaultSegment();_e(Me,le,Se,we,xe)}if($)for(let we=0;we<4;we++){const Se=a.dX[we](Me),$e=o.getTile(Se);if(!$e)continue;const Ve=$e.getBucket(u);if(!Ve||Ve.projection.name!==re.projection.name||!Ve.groundEffect||Ve.groundEffect&&!Ve.groundEffect.hasData())continue;const Ne=Ve.groundEffect;let De,tt;we===0?(De=[-a.an,0,0],tt=1):we===1?(De=[a.an,0,0],tt=0):we===2?(De=[0,-a.an,0],tt=3):(De=[0,a.an,0],tt=2);const ot=Ne.regionSegments[tt];if(!ot)continue;const Ke=new Float32Array(16);a.by(Ke,Me.projMatrix,De),_e(Me,Ne,ot,i.translatePosMatrix(Ke,Le,te,de),xe)}}}function $f(l,i,o,u,d,m,_){u.centroidVertexArray.length===0&&u.createCentroidsBuffer();const y=m?m.findDEMTileFor(o):null;if(!(y&&y.dem||_))return;m&&y&&y.dem&&u.selfDEMTileTimestamp!==y.dem._timestamp&&(u.borderDoneWithNeighborZ=[-1,-1,-1,-1],u.selfDEMTileTimestamp=y.dem._timestamp);const v=(N,$)=>{(N.flags|$.flags)&a.d$?(N.flags|=a.d$,$.flags|=a.d$):(N.flags&=~a.d$,$.flags&=~a.d$)},T=N=>new a.P(Math.ceil((N+a.e0)*a.e1),0),I=(N,$,H)=>{const j=Math.ceil((N+a.e0)*a.e1),ne=Math.floor(Math.max(0,Math.min(a.an-1,H))/4);return new a.P(j,ne<<5|(3&$)<<3|7)},M=N=>{const $=i.getSource().minzoom,H=ne=>{const Y=i.getTileByID(ne);if(Y&&Y.hasData())return Y.getBucket(d)},j=[0,-1,1];for(const ne of j){if(N.overscaledZ+ne<$)continue;const Y=H(N.calculateScaledKey(N.overscaledZ+ne));if(Y)return Y}},C=[0,0,0],D=(N,$)=>(C[0]=Math.min(N.min.y,$.min.y),C[1]=Math.max(N.max.y,$.max.y),C[2]=a.an-$.min.x>N.max.x?$.min.x-a.an:N.max.x,C),F=(N,$)=>(C[0]=Math.min(N.min.x,$.min.x),C[1]=Math.max(N.max.x,$.max.x),C[2]=a.an-$.min.y>N.max.y?$.min.y-a.an:N.max.y,C),z=[(N,$)=>D(N,$),(N,$)=>D($,N),(N,$)=>F(N,$),(N,$)=>F($,N)],V=(N,$,H,j,ne,Y,re)=>{if(!m)return 0;const Z=[[Y?H:N,Y?N:H,0],[Y?H:$,Y?$:H,0]],K=re<0?a.an+re:re,te=[Y?K:(N+$)/2,Y?(N+$)/2:K,0];return H===0&&re<0||H!==0&&re>0?m.getForTilePoints(ne,[te],!0,j):Z.push(te),m.getForTilePoints(o,Z,!0,y),Math.max(Z[0][2],Z[1][2],te[2])/m.exaggeration()};for(let N=0;N<4;N++){const $=u.borderFeatureIndices[N];if($.length===0)continue;const H=a.dX[N](o),j=M(H);if(!(j&&j instanceof a.dY))continue;const ne=m?m.findDEMTileFor(H):null;if(!(ne&&ne.dem||_)||(m&&ne&&ne.dem&&u.borderDEMTileTimestamp[N]!==ne.dem._timestamp&&(u.borderDoneWithNeighborZ[N]=-1,u.borderDEMTileTimestamp[N]=ne.dem._timestamp),u.borderDoneWithNeighborZ[N]===j.canonical.z))continue;j.centroidVertexArray.length===0&&j.createCentroidsBuffer();const Y=(N<2?1:5)-N,re=j.borderDoneWithNeighborZ[Y]!==u.canonical.z,Z=j.borderFeatureIndices[Y];let K=0;if(u.canonical.z!==j.canonical.z){for(const be of $)u.showCentroid(u.featuresOnBorder[be]);if(re)for(const be of Z)j.showCentroid(j.featuresOnBorder[be]);u.borderDoneWithNeighborZ[N]=j.canonical.z,j.borderDoneWithNeighborZ[Y]=u.canonical.z;continue}const te=new Map,de=new Set,se=new Set;for(let be=0;be<Z.length;be++){const _e=j.featuresOnBorder[Z[be]];_e.buildingId!==void 0&&te.set(_e.buildingId,be)}
3254for(const be of $){const _e=u.featuresOnBorder[be],Me=u.centroidData[_e.centroidDataIndex];if(_e.buildingId===void 0)continue;const Le=te.get(_e.buildingId);if(Le===void 0)continue;const fe=j.featuresOnBorder[Z[Le]],le=j.centroidData[fe.centroidDataIndex];de.add(be),se.add(Le),_&&v(Me,le);const xe=Me.groupCentroidPos.x!==0||Me.groupCentroidPos.y!==0?Me.groupCentroidPos:_e.centroid(),we=le.groupCentroidPos.x!==0||le.groupCentroidPos.y!==0?le.groupCentroidPos:fe.centroid(),Se=N<2?Math.round((xe.y+we.y)/2):Math.round((xe.x+we.x)/2),$e=_e.intersectsCount()>1||fe.intersectsCount()>1;{let Ve=0;if(ne&&ne.dem&&!$e){const Ne=z[N](Me,le),De=N%2?a.an-1:0;Ve=V(Ne[0],Math.min(a.an-1,Ne[1]),De,ne,H,N<2,Ne[2])}Me.centroidXY=I(Ve,N,Se),le.centroidXY=I(Ve,Y,Se)}if(u.writeCentroidToBuffer(Me),j.writeCentroidToBuffer(le),_e.buildingId!==void 0){for(const Ve of u.centroidData)Ve.buildingId===_e.buildingId&&Ve!==Me&&(Ve.centroidXY=Me.centroidXY,u.writeCentroidToBuffer(Ve));for(const Ve of j.centroidData)Ve.buildingId===_e.buildingId&&Ve!==le&&(Ve.centroidXY=le.centroidXY,j.writeCentroidToBuffer(Ve))}}for(const be of $){if(de.has(be))continue;const _e=u.featuresOnBorder[be],Me=u.centroidData[_e.centroidDataIndex],Le=_e.borders[N];let fe;for(;K<Z.length;){if(se.has(K)){K++;continue}fe=j.featuresOnBorder[Z[K]];const le=fe.borders[Y];if(le[1]>Le[0]+3||le[0]>Le[0]-3)break;j.showCentroid(fe),K++}if(fe&&K<Z.length){let le=K,xe=0;for(;;)if(se.has(K)){if(++K===Z.length)break;fe=j.featuresOnBorder[Z[K]]}else{if(fe.borders[Y][0]>Le[1]-3||(xe++,++K===Z.length))break;fe=j.featuresOnBorder[Z[K]]}for(;le<Z.length&&se.has(le);)le++;if(le>=Z.length){u.showCentroid(_e);continue}fe=j.featuresOnBorder[Z[le]];let we=!1;if(xe>=1){const Ve=fe.borders[Y];Math.abs(Le[0]-Ve[0])<3&&Math.abs(Le[1]-Ve[1])<3&&(xe=1,we=!0,K=le+1)}else if(xe===0){u.showCentroid(_e);continue}const Se=j.centroidData[fe.centroidDataIndex];_&&we&&v(Me,Se);const $e=_e.intersectsCount()>1||fe.intersectsCount()>1;if(xe>1)K=le,Me.centroidXY=Se.centroidXY=new a.P(0,0);else if(ne&&ne.dem&&!$e){const Ve=z[N](Me,Se),Ne=N%2?a.an-1:0,De=V(Ve[0],Math.min(a.an-1,Ve[1]),Ne,ne,H,N<2,Ve[2]);Me.centroidXY=Se.centroidXY=T(De)}else $e?Me.centroidXY=Se.centroidXY=new a.P(0,0):(Me.centroidXY=u.encodeBorderCentroid(_e),Se.centroidXY=j.encodeBorderCentroid(fe));u.writeCentroidToBuffer(Me),j.writeCentroidToBuffer(Se)}else u.showCentroid(_e)}u.borderDoneWithNeighborZ[N]=j.canonical.z,j.borderDoneWithNeighborZ[Y]=u.canonical.z}(u.needsCentroidUpdate||!u.centroidVertexBuffer&&u.centroidVertexArray.length!==0)&&u.uploadCentroid(l)}const Hf=[1,0,0],Zf=[0,1,0],Wf=[0,0,1];function au(l,i,o){const u=o.transform,d=o.shadowRenderer;if(!d)return!0;const m=l.toUnwrapped(),_=u.tileSize*d._cascades[o.currentShadowCascade].scale;let y=i;if(u.elevation){const F=u.elevation.getMinMaxForTile(l);F&&(y+=F.max)}const v=u.scaleZoom(_);y/=a.d_(u.center.lat,v);const T=[...d.shadowDirection];T[2]=-T[2];const I=d.computeSimplifiedTileShadowVolume(m,y,_,T);if(!I)return!1;const M=[Hf,Zf,Wf,T,[T[0],0,T[2]],[0,T[1],T[2]]],C=a.cg.fromInvProjectionMatrix(u.invProjMatrix,u.worldSize,v,u.projection.name!=="globe"),D=d.getCurrentCascadeFrustum();return C.intersectsPrecise(I.vertices,I.planes,M)===0||D.intersectsPrecise(I.vertices,I.planes,M)===0}function Pa(l){const{painter:i,source:o,layer:u,coords:d}=l;let m=l.defines;const _=i.context,y=i.renderPass==="shadow",v=i.renderPass==="light-beam",T=i.shadowRenderer,I=a.d_(i.transform.center.lat,i.transform.zoom),M=no(i,u.paint.get("building-cutoff-fade-range"));M.shouldRenderCutoff&&(m=m.concat("RENDER_CUTOFF"));const C=u.paint.get("building-front-cutoff"),D=C[2]<1&&!i.terrain,F=su(i.transform.pitch,C,!!i.terrain);D&&(m=m.concat("RENDER_FRONT_CUTOFF"),i.maxFrontCutoffRawStart=Math.max(i.maxFrontCutoffRawStart,C[0])),l.floodLightIntensity>0&&(m=m.concat("FLOOD_LIGHT"));for(const z of d){const V=o.getTile(z),N=V.getBucket(u);if(!N)continue;T&&T.getMaxCascadeForTile(z.toUnwrapped())===0&&(m=m.concat("SHADOWS_SINGLE_CASCADE"));const $=N.programConfigurations.get(u.id);let H,j,ne,Y=i.translatePosMatrix(z.expandedProjMatrix,V,[0,0],"map");if(Y=a.cx(a.bc(),Y,[1,1,l.verticalScale]),y&&T){if(au(V.tileID,N.maxHeight*I,i))continue;let Z=T.calculateShadowPassMatrixFromTile(V.tileID.toUnwrapped());Z=a.cx(a.bc(),Z,[1,1,l.verticalScale]),ne=Kc(Z),H=j=i.getOrCreateProgram("buildingDepth",{config:$,defines:m,overrideFog:!1})}else if(v)H=j=i.getOrCreateProgram("buildingBloom",{config:$,defines:m,overrideFog:!1}),ne=Qo(Y);else{const Z=i.transform.calculatePosMatrix(z.toUnwrapped(),i.transform.worldSize);a.cx(Z,Z,[1,1,l.verticalScale]);const K=a.bc();a.cx(K,Z,[1,-1,1/I]),a.b8(K,K),a.e2(K,K);const te=i.transform.getFreeCameraOptions().position,de=1<<z.canonical.z;if(ne=Mh(Y,K,l.opacity,l.facadeAOIntensity,[((te.x-z.wrap)*de-z.canonical.x)*a.an,(te.y*de-z.canonical.y)*a.an,te.z*de*a.an],N.tileToMeter,l.facadeEmissiveChance,l.floodLightColor,l.floodLightIntensity,F),j=i.getOrCreateProgram("building",{config:$,defines:m,overrideFog:!1}),l.depthOnly===!0)H=j;else{const se=m.concat(["BUILDING_FAUX_FACADE","HAS_ATTRIBUTE_a_faux_facade_color_emissive"]);H=i.getOrCreateProgram("building",{config:$,defines:se,overrideFog:!1})}
3254T&&(T.setupShadowsFromMatrix(Z,j,!0),H!==j&&T.setupShadowsFromMatrix(Z,H,!0))}const re=(Z,K)=>{if(v){const te=Z.entranceBloom;K.draw(i,_.gl.TRIANGLES,l.depthMode,st.disabled,l.blendMode,pt.disabled,ne,u.id,te.layoutVertexBuffer,te.indexBuffer,te.segmentsBucket,u.paint,i.transform.zoom,$,[te.layoutAttenuationBuffer,te.layoutColorBuffer])}else{const te=Z.segmentsBucket;let de=[Z.layoutNormalBuffer,Z.layoutCentroidBuffer,Z.layoutColorBuffer,Z.layoutFloodLightDataBuffer];Z.layoutFacadePaintBuffer&&(de=de.concat([Z.layoutFacadeDataBuffer,Z.layoutFacadeVerticalRangeBuffer,Z.layoutFacadePaintBuffer])),K.draw(i,_.gl.TRIANGLES,l.depthMode,st.disabled,l.blendMode,y?pt.disabled:pt.backCW,ne,u.id,Z.layoutVertexBuffer,Z.indexBuffer,te,u.paint,i.transform.zoom,$,de)}};i.uploadCommonUniforms(_,j,z.toUnwrapped(),null,M),N.buildingWithoutFacade&&re(N.buildingWithoutFacade,j),N.buildingWithFacade&&(H!==j&&i.uploadCommonUniforms(_,H,z.toUnwrapped(),null,M),re(N.buildingWithFacade,H))}}function Vh(l,i,o,u,d,m,_,y,v,T,I,M,C,D){const F=l.context.gl,z=l.depthModeForSublayer(1,rt.ReadOnly,F.LEQUAL,!0),V=.1*(1-(N=I))+3*N;var N;const $=l._showOverdrawInspector,H=M,j=new Cl;$||ao(j,l,i,o,u,z,new st({func:F.ALWAYS,mask:255},255,255,F.KEEP,F.KEEP,F.REPLACE),new ct([F.ONE,F.ONE,F.ONE,F.ONE],a.aq.transparent,[!1,!1,!1,!0],F.MIN),pt.disabled,d,"sdf",m,_,y,v,T,V,H,!1,void 0);{const ne=$?st.disabled:new st({func:F.EQUAL,mask:255},255,255,F.KEEP,F.DECR,F.DECR),Y=$?l.colorModeForRenderPass():new ct([F.ONE_MINUS_DST_ALPHA,F.DST_ALPHA,F.ONE,F.ONE],a.aq.transparent,[!0,!0,!0,!0]);ao(j,l,i,o,u,z,ne,Y,pt.disabled,d,"color",m,_,y,v,T,V,H,!1,void 0)}}function Nh(l){return[l[0]*a.e3,l[1]*a.e3,l[2]*a.e3,0]}function lu(l,i,o,u,d,m,_,y,v){const T=u.getSource(),I=o.globeSharedBuffers;if(!I)return;let M,C,D;if(i&&(M=u.getTile(i)),T instanceof a.aW?(C=T.texture,D=a.ds(0,0,o.transform)):M&&i&&(C=M.texture,D=a.ds(i.canonical.z,i.canonical.x,o.transform)),!C||!D)return;l||(D=a.cx(a.bc(),D,[1,-1,1]));const F=o.context,z=F.gl,V=d.paint.get("raster-resampling")==="nearest"?z.NEAREST:z.LINEAR,N=o.colorModeForDrapableLayerRenderPass(m),$=_.defines;$.push("GLOBE_POLES");const H=new rt(z.LEQUAL,rt.ReadWrite,o.depthRangeFor3D),j=Float32Array.from(o.transform.expandedFarZProjMatrix),ne=Float32Array.from(a.dq(a.dr(new a.ci(0,0,0))));o.terrain&&o.terrain.prepareDrawTile(),F.activeTexture.set(z.TEXTURE0),C.bind(V,z.CLAMP_TO_EDGE),F.activeTexture.set(z.TEXTURE1),C.bind(V,z.CLAMP_TO_EDGE),"useMipmap"in C&&F.extTextureFilterAnisotropic&&o.transform.pitch>20&&z.texParameterf(z.TEXTURE_2D,F.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,F.extTextureFilterAnisotropicMax);const[Y,re,Z,K]=i?I.getPoleBuffers(i.canonical.z,!1):I.getPoleBuffers(0,!0),te=d.paint.get("raster-elevation");let de;l?(de=Y,o.renderDefaultNorthPole=te!==0):(de=re,o.renderDefaultSouthPole=te!==0);const se=Nh(_.mix),be=((Me,Le,fe,le,xe,we,Se,$e,Ve,Ne,De,tt,ot,Ke)=>eu(Me,Le,fe,le,new Float32Array(16),new Float32Array(9),[0,0],xe,[0,0],[0,0,0,0],1,{opacity:1,mix:0},Se,[0,0],Ve,2,De,tt,ot,1,0,Ke))(o,j,ne,D,a.al(o.transform.zoom),0,d,0,te,0,se,_.offset,_.range,m),_e=o.getOrCreateProgram("raster",{defines:$});o.uploadCommonUniforms(F,_e,null),_e.draw(o,z.TRIANGLES,H,v,N,y,be,d.id,de,Z,K)}function Xf(l){if(l.isOrthographic)return[0,0,0,0];const i=l._nearZ,o=l.projection.farthestPixelDistance(l),u=o-i,d=.2*l.height,m=i+d;return[i,o,(m-d-i)/u,(m-i)/u]}function Uh(l,i,o,u){if(l)return i instanceof Ho&&l instanceof tl?i.getTextureDescriptor(l,o,!0):{texture:l.texture,mix:Nh(u.mix),offset:u.offset,buffer:0,tileSize:1}}var Yf=a.e4([{name:"a_index",type:"Int16",components:1}]);class jh{constructor(i,o,u,d){const m={width:u[0],height:u[1],data:null},_=i.gl;this.targetColorTexture=new a.T(i,m,_.RGBA8,{useMipmap:!1}),this.backgroundColorTexture=new a.T(i,m,_.RGBA8,{useMipmap:!1}),this.context=i,this.updateParticleTexture(o,d),this.lastInvalidatedAt=0}updateParticleTexture(i,o){if(this.particleTextureDimension===o.width)return;(this.particleTexture0||this.particleTexture1||this.particleIndexBuffer||this.particleSegment)&&(this.particleTexture0.destroy(),this.particleTexture1.destroy(),this.particleIndexBuffer.destroy(),this.particleSegment.destroy());const u=this.context.gl,d=o.width*o.height;this.particleTexture0=new a.T(this.context,o,u.RGBA8,{premultiply:!1,useMipmap:!1}),this.particleTexture1=new a.T(this.context,o,u.RGBA8,{premultiply:!1,useMipmap:!1});const m=new a.e5;m.reserve(d);for(let _=0;_<d;_++)m.emplaceBack(_);this.particleIndexBuffer=this.context.createVertexBuffer(m,Yf.members,!0),this.particleSegment=a.du.simpleSegment(0,0,this.particleIndexBuffer.length,0),this.particleTextureDimension=o.width}update(i){return!(this.lastInvalidatedAt<i&&(this.lastInvalidatedAt=a.o.now(),1))}destroy(){this.targetColorTexture.destroy(),this.backgroundColorTexture.destroy(),this.particleIndexBuffer.destroy(),this.particleTexture0.destroy(),this.particleTexture1.destroy(),this.particleSegment.destroy()}}function Kf(l,i,o){if(!l)return null;const u=i.getTextureDescriptor(l,o,!0);if(!u)return null;let{texture:d,mix:m,offset:_,tileSize:y,buffer:v,format:T}=u;
vendor: 9,639 bytes, line 3254
3254if(!d||!T)return null;let I=!1;return T==="uint32"&&(I=!0,m[3]=0,m=Dh(a.e6,m,[0,o.paint.get("raster-particle-max-speed")]),_=Rh(a.e6,_,[0,o.paint.get("raster-particle-max-speed")])),{texture:d,textureOffset:[v/(y+2*v),y/(y+2*v)],tileSize:y,scalarData:I,scale:m,offset:_,defines:["RASTER_ARRAY",{uint8:"DATA_FORMAT_UINT8",uint16:"DATA_FORMAT_UINT16",uint32:"DATA_FORMAT_UINT32"}[T]]}}function Gh(l){const i=l._nearZ,o=l.projection.farthestPixelDistance(l),u=o-i,d=.2*l.height,m=i+d;return[i,o,(m-d-i)/u,(m-i)/u]}const qh=new a.aq(1,0,0,1),$h=new a.aq(0,1,0,1),Ym=new a.aq(0,0,1,1),Km=new a.aq(1,0,1,1),Qm=new a.aq(0,1,1,1);function cu(l,i,o,u,d,m){for(let _=0;_<o.length;_++)if(d){const T=new a.aq(u.r*.8,u.g*.8,u.b*.8,1);Da(l,i,o[_],u,-1,-1,m),Da(l,i,o[_],u,-1,1,m),Da(l,i,o[_],u,1,1,m),Da(l,i,o[_],u,1,-1,m),Da(l,i,o[_],T,0,0,m)}else Da(l,i,o[_],u,0,0,m)}function Da(l,i,o,u,d,m,_){const y=l.context,v=l.transform,T=y.gl,I=v.projection.name==="globe",M=I?["PROJECTION_GLOBE_VIEW"]:[];let C=a.b9(o.projMatrix);if(I&&a.al(v.zoom)>0){const se=a.e8(o.canonical,v),be=a.e9(se);C=a.aD(new Float32Array(16),v.globeMatrix,be),a.aD(C,v.projMatrix,C)}const D=a.bc();D[12]+=2*d/(a.o.devicePixelRatio*v.width),D[13]+=2*m/(a.o.devicePixelRatio*v.height),a.aD(C,D,C);const F=l.getOrCreateProgram("debug",{defines:M}),z=i.getTileByID(o.key);l.terrain&&l.terrain.setupElevationDraw(z,F);const V=rt.disabled,N=st.disabled,$=l.colorModeForRenderPass(),H="$debug";y.activeTexture.set(T.TEXTURE0),l.emptyTexture.bind(T.LINEAR,T.CLAMP_TO_EDGE),I?z._makeGlobeTileDebugBuffers(l.context,v):z._makeDebugTileBoundsBuffers(l.context,v.projection);const j=z._tileDebugBuffer||l.debugBuffer,ne=z._tileDebugIndexBuffer||l.debugIndexBuffer,Y=z._tileDebugSegments||l.debugSegments;if(F.draw(l,T.LINE_STRIP,V,N,$,pt.disabled,so(C,u.toPremultipliedRenderColor(null)),H,j,ne,Y,null,null,null,[z._globeTileDebugBorderBuffer]),_){const se=z.latestRawTileData,be=Math.floor((se&&se.byteLength||0)/1024);let _e=o.canonical.toString();o.overscaledZ!==o.canonical.z&&(_e+=` => ${o.overscaledZ}`),_e+=` ${z.state}`,_e+=` ${be}kb`,function(Me,Le){Me.initDebugOverlayCanvas();const fe=Me.debugOverlayCanvas,le=Me.context.gl,xe=Me.debugOverlayCanvas.getContext("2d");xe.clearRect(0,0,fe.width,fe.height),xe.shadowColor="white",xe.shadowBlur=2,xe.lineWidth=1.5,xe.strokeStyle="white",xe.textBaseline="top",xe.font="bold 36px Open Sans, sans-serif",xe.fillText(Le,5,5),xe.strokeText(Le,5,5),Me.debugOverlayTexture.update(fe),Me.debugOverlayTexture.bind(le.LINEAR,le.CLAMP_TO_EDGE)}(l,_e)}const re=i.getTile(o).tileSize,Z=512/Math.min(re,512)*(o.overscaledZ/v.zoom)*.5,K=z._tileDebugTextBuffer||l.debugBuffer,te=z._tileDebugTextIndexBuffer||l.quadTriangleIndexBuffer,de=z._tileDebugTextSegments||l.debugSegments;F.draw(l,T.TRIANGLES,V,N,ct.alphaBlended,pt.disabled,so(C,a.aq.transparent.toPremultipliedRenderColor(null),Z),H,K,te,de,null,null,null,[z._globeTileDebugTextBuffer])}function Hh(l,i,o,u){Ml(l,0,i+o/2,l.transform.width,o,u)}function Qf(l,i,o,u){Ml(l,i-o/2,0,o,l.transform.height,u)}function Ml(l,i,o,u,d,m){const _=l.context,y=_.gl;y.enable(y.SCISSOR_TEST),y.scissor(i*a.o.devicePixelRatio,o*a.o.devicePixelRatio,u*a.o.devicePixelRatio,d*a.o.devicePixelRatio),_.clear({color:m}),y.disable(y.SCISSOR_TEST)}const Jm=a.e4([{name:"a_pos_3f",components:3,type:"Float32"}]),{members:e_}=Jm;function fr(l,i,o,u){l.emplaceBack(i,o,u)}class uu{constructor(i){this.vertexArray=new a.ea,this.indices=new a.dy,fr(this.vertexArray,-1,-1,1),fr(this.vertexArray,1,-1,1),fr(this.vertexArray,-1,1,1),fr(this.vertexArray,1,1,1),fr(this.vertexArray,-1,-1,-1),fr(this.vertexArray,1,-1,-1),fr(this.vertexArray,-1,1,-1),fr(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=i.createVertexBuffer(this.vertexArray,e_),this.indexBuffer=i.createIndexBuffer(this.indices),this.segment=a.du.simpleSegment(0,0,36,12)}}function pr(l,i,o,u,d,m){const _=l.context.gl,y=i.paint.get("sky-atmosphere-color"),v=i.paint.get("sky-atmosphere-halo-color"),T=i.paint.get("sky-atmosphere-sun-intensity"),I=((M,C,D,F,z)=>({u_matrix_3f:M,u_sun_direction:C,u_sun_intensity:D,u_color_tint_r:[F.r,F.g,F.b,F.a],u_color_tint_m:[z.r,z.g,z.b,z.a],u_luminance:5e-5}))(a.ec(a.dA(),u),d,T,y.toPremultipliedRenderColor(null),v.toPremultipliedRenderColor(null));_.framebufferTexture2D(_.FRAMEBUFFER,_.COLOR_ATTACHMENT0,_.TEXTURE_CUBE_MAP_POSITIVE_X+m,i.skyboxTexture,0),o.draw(l,_.TRIANGLES,rt.disabled,st.disabled,ct.unblended,pt.frontCW,I,"skyboxCapture",i.skyboxGeometry.vertexBuffer,i.skyboxGeometry.indexBuffer,i.skyboxGeometry.segment)}const ts=a.e4([{type:"Float32",name:"a_pos",components:3},{type:"Float32",name:"a_uv",components:2}]);class Jf{constructor(i){const o=new a.ed;o.emplaceBack(-1,1,1,0,0),o.emplaceBack(1,1,1,1,0),o.emplaceBack(1,-1,1,1,1),o.emplaceBack(-1,-1,1,0,1);const u=new a.dy;u.emplaceBack(0,1,2),u.emplaceBack(2,3,0),this.vertexBuffer=i.createVertexBuffer(o,ts.members),this.indexBuffer=i.createIndexBuffer(u),this.segments=a.du.simpleSegment(0,0,4,2)}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy()}}const Zh=a.e4([{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 Wh{constructor(){this.starsCount=16e3,this.sizeMultiplier=.15,this.sizeRange=100,this.intensityRange=200}}class Xh{constructor(i){this.colorModeAlphaBlendedWriteRGB=new ct([1,Rn,1,Rn],a.aq.transparent,[!0,!0,!0,!1]),this.colorModeWriteAlpha=new ct([1,0,1,0],a.aq.transparent,[!1,!1,!1,!0]),this.params=new Wh,this.updateNeeded=!0}update(i){const o=i.context;if(!this.atmosphereBuffer||this.updateNeeded){this.updateNeeded=!1,this.atmosphereBuffer=new Jf(o);const u=this.params.sizeRange,d=this.params.intensityRange,m=function(I){const M=a.ei(30),C=[];for(let D=0;D<I;++D){const F=2*Math.PI*M(),z=Math.acos(1-2*M())-.5*Math.PI;C.push(a.cM(Math.cos(z)*Math.cos(F),Math.cos(z)*Math.sin(F),Math.sin(z)))}return C}(this.params.starsCount),_=a.ei(300),y=new a.ee,v=new a.dy;let T=0;for(let I=0;I<m.length;++I){const M=a.bK([],m[I],200),C=Math.max(0,1+.01*u*(1*_()-.5)),D=Math.max(0,1+.01*d*(1*_()-.5));y.emplaceBack(M[0],M[1],M[2],-1,-1,C,D),y.emplaceBack(M[0],M[1],M[2],1,-1,C,D),y.emplaceBack(M[0],M[1],M[2],1,1,C,D),y.emplaceBack(M[0],M[1],M[2],-1,1,C,D),v.emplaceBack(T+0,T+1,T+2),v.emplaceBack(T+0,T+2,T+3),T+=4}this.starsVx=o.createVertexBuffer(y,Zh.members),this.starsIdx=o.createIndexBuffer(v),this.starsSegments=a.du.simpleSegment(0,0,y.length,v.length)}}destroy(){this.atmosphereBuffer&&this.atmosphereBuffer.destroy(),this.starsVx&&this.starsVx.destroy(),this.starsIdx&&this.starsIdx.destroy()}drawAtmosphereGlow(i,o){const u=i.context,d=u.gl,m=i.transform,_=new rt(d.LEQUAL,rt.ReadOnly,[0,1]),y=a.al(m.zoom),v=i.style.getLut(o.scope),T=o.properties.get("color-use-theme")==="none",I=o.properties.get("color").toNonPremultipliedRenderColor(T?null:v),M=o.properties.get("high-color-use-theme")==="none",C=o.properties.get("high-color").toNonPremultipliedRenderColor(M?null:v),D=o.properties.get("space-color-use-theme")==="none",F=o.properties.get("space-color").toNonPremultipliedRenderColor(D?null:v),z=5e-4,V=a.ef(o.properties.get("horizon-blend"),0,1,z,.25),N=a.dk(i,u,m)&&V===z?m.worldSize/(2*Math.PI*1.025)-1:m.globeRadius,$=i.frameCounter/1e3%1,H=a.ai(m.globeCenterInViewSpace),j=Math.sqrt(Math.pow(H,2)-Math.pow(N,2)),ne=Math.acos(j/H),Y=re=>{const Z=m.projection.name==="globe"?["PROJECTION_GLOBE_VIEW","FOG"]:["FOG"];re&&Z.push("ALPHA_PASS");const K=i.getOrCreateProgram("globeAtmosphere",{defines:Z}),te=((se,be,_e,Me,Le,fe,le,xe,we,Se,$e,Ve)=>({u_frustum_tl:se,u_frustum_tr:be,u_frustum_br:_e,u_frustum_bl:Me,u_horizon:Le,u_transition:fe,u_fadeout_range:le,u_atmosphere_fog_color:xe.toArray01(),u_high_color:we.toArray01(),u_space_color:Se.toArray01(),u_temporal_offset:$e,u_horizon_angle:Ve}))(m.frustumCorners.TL,m.frustumCorners.TR,m.frustumCorners.BR,m.frustumCorners.BL,m.frustumCorners.horizon,y,V,I,C,F,$,ne);i.uploadCommonUniforms(u,K);const de=this.atmosphereBuffer;de&&K.draw(i,d.TRIANGLES,_,st.disabled,re?this.colorModeWriteAlpha:this.colorModeAlphaBlendedWriteRGB,pt.backCW,te,re?"atmosphere_glow_alpha":"atmosphere_glow",de.vertexBuffer,de.indexBuffer,de.segments)};Y(!1),Y(!0)}drawStars(i,o){const u=a.aC(o.properties.get("star-intensity"),0,1);if(u===0)return;const d=i.context,m=d.gl,_=i.transform,y=i.getOrCreateProgram("stars"),v=a.bM([]);a.bO(v,v,-_._pitch),a.bN(v,v,-_.angle),a.bO(v,v,a.ap(_._center.lat)),a.eg(v,v,-a.ap(_._center.lng));const T=a.bS(new Float32Array(16),v),I=a.aD([],_.starsProjMatrix,T),M=a.ec([],T),C=a.eh([],M),D=[0,1,0];a.dC(D,D,C),a.bK(D,D,this.params.sizeMultiplier);const F=[1,0,0];a.dC(F,F,C),a.bK(F,F,this.params.sizeMultiplier);const z=(V=D,N=F,$=u,{u_matrix:Float32Array.from(I),u_up:V,u_right:N,u_intensity_multiplier:$});var V,N,$;i.uploadCommonUniforms(d,y),this.starsVx&&this.starsIdx&&y.draw(i,m.TRIANGLES,rt.disabled,st.disabled,this.colorModeAlphaBlendedWriteRGB,pt.disabled,z,"atmosphere_stars",this.starsVx,this.starsIdx,this.starsSegments)}}class ep{constructor(){this.visibleTiles=[]}updateBorders(i,o){const u=[],d=[],m=i._getRenderableCoordinates(!1,!0);for(const v of m){const T=i.getTile(v);
3254if(!T.hasData())continue;const I=T.getBucket(o);I&&(I.isEmpty()||(u.push(v.key),d.push({bucket:I,tileID:v.canonical})))}let _=u.length!==this.visibleTiles.length;if(!_){u.sort();for(let v=0;v<u.length;v++)if(u[v]!==this.visibleTiles[v]){_=!0;break}}if(!_)return;const y=new Set;this.visibleTiles=u,d.sort((v,T)=>v.tileID.z-T.tileID.z||v.tileID.x-T.tileID.x||v.tileID.y-T.tileID.y);for(const v of d){const T=new Array,I=new Array,M=v.bucket;for(const C of M.featuresOnBorder)y.has(C.featureId)?I.push(C.footprintIndex):(y.add(C.featureId),T.push(C.footprintIndex));M.updateFootprintHiddenFlags(T,a.ej,!1),M.updateFootprintHiddenFlags(I,a.ej,!0)}}}function lo(l,i){const o=[...l],u=i.cameraWorldSizeForFog/i.worldSize,d=a.ba([]);return a.cx(d,d,[u,u,1]),a.aD(o,d,o),a.aD(o,i.worldToFogMatrix,o),o}function Yh(l,i,o,u,d){const m=o.material,_=u.context,{baseColorTexture:y,metallicRoughnessTexture:v}=m.pbrMetallicRoughness,{normalTexture:T,occlusionTexture:I,emissionTexture:M}=m;function C(F,z,V){if(F&&(l.push(z),_.activeTexture.set(_.gl.TEXTURE0+V),F.gfxTexture)){const{minFilter:N,magFilter:$,wrapS:H,wrapT:j}=F.sampler;F.gfxTexture.bindExtraParam(N,$,H,j)}}C(y,"HAS_TEXTURE_u_baseColorTexture",5),C(v,"HAS_TEXTURE_u_metallicRoughnessTexture",6),C(T,"HAS_TEXTURE_u_normalTexture",7),C(I,"HAS_TEXTURE_u_occlusionTexture",8),C(M,"HAS_TEXTURE_u_emissionTexture",9),d&&(d.texture||(d.texture=new a.dN(u.context,d.image,[d.image.height,d.image.height,d.image.height],_.gl.RGBA8)),_.activeTexture.set(_.gl.TEXTURE0+10),d.texture&&d.texture.bind(_.gl.LINEAR,_.gl.CLAMP_TO_EDGE),l.push("APPLY_LUT_ON_GPU")),o.texcoordBuffer&&(l.push("HAS_ATTRIBUTE_a_uv_2f"),i.push(o.texcoordBuffer)),o.colorBuffer&&(l.push(o.colorBuffer.itemSize===12?"HAS_ATTRIBUTE_a_color_3f":"HAS_ATTRIBUTE_a_color_4f"),i.push(o.colorBuffer)),o.normalBuffer&&(l.push("HAS_ATTRIBUTE_a_normal_3f"),i.push(o.normalBuffer)),o.pbrBuffer&&(l.push("HAS_ATTRIBUTE_a_pbr"),l.push("HAS_ATTRIBUTE_a_heightBasedEmissiveStrength"),i.push(o.pbrBuffer)),m.alphaMode!=="OPAQUE"&&m.alphaMode!=="MASK"||l.push("UNPREMULT_TEXTURE_IN_SHADER"),m.defined||l.push("DIFFUSE_SHADED");const D=u.shadowRenderer;D&&(l.push("RENDER_SHADOWS"),D.useNormalOffset&&l.push("NORMAL_OFFSET"))}function Zt(l,i,o,u,d,m){const _=l.modelOpacity,y=i.context,v=new rt(i.context.gl.LEQUAL,l.isLightMesh?rt.ReadOnly:rt.ReadWrite,i.depthRangeFor3D),T=i.transform,I=l.mesh,M=I.material,C=M.pbrMetallicRoughness,D=i.style.fog;let F;F=i.transform.projection.zAxisUnit==="pixels"?[...l.nodeModelMatrix]:a.aD([],u.zScaleMatrix,l.nodeModelMatrix),a.aD(F,u.negCameraPosMatrix,F);const z=a.b8([],F);a.e2(z,z);const V=o.paint.get("model-color-use-theme").constantOr("default")==="none",N=o.paint.get("model-emissive-strength").constantOr(0),$=Ia(new Float32Array(l.worldViewProjection),new Float32Array(F),new Float32Array(z),null,i,_,C.baseColorFactor,M.emissiveFactor,C.metallicFactor,C.roughnessFactor,M,N,o,void 0,void 0,l.materialOverride,l.modelColor),H={defines:[]},j=[],ne=i.shadowRenderer;ne&&(ne.useNormalOffset=!1),Yh(H.defines,j,I,i,V?null:o.lut);let Y=null;if(D){const K=lo(l.nodeModelMatrix,i.transform);if(Y=new Float32Array(K),T.projection.name!=="globe"){const te=I.aabb.min,de=I.aabb.max,[se,be]=D.getOpacityForBounds(K,te[0],te[1],de[0],de[1]);H.overrideFog=se>=vt||be>=vt}}const re=no(i,o.paint.get("model-cutoff-fade-range"));re.shouldRenderCutoff&&H.defines.push("RENDER_CUTOFF");const Z=i.getOrCreateProgram("model",H);i.uploadCommonUniforms(y,Z,null,Y,re),i.renderPass!=="shadow"&&ne&&ne.setupShadowsFromMatrix(l.nodeModelMatrix,Z),Z.draw(i,y.gl.TRIANGLES,v,d,m,I.material.doubleSided?pt.disabled:pt.backCCW,$,o.id,I.vertexBuffer,I.indexBuffer,I.segments,o.paint,i.transform.zoom,void 0,j)}function Pl(l,i){return l.style._importedAsBasemap?"basemap":i.scope}function Dl(l,i,o,u,d,m,_,y,v,T){const I=l.transform,M=!!i.isGeometryBloom&&i.isGeometryBloom;if(M&&l.renderPass==="shadow")return;const C=I.projection.name==="globe"?a.er(o,I):[...o];a.aD(C,C,i.globalMatrix);const D=a.aD([],u,C);if(i.meshes)for(const F of i.meshes){const z=y.get(F.material.name);if(z&&z.opacity<=0)continue;if(F.material.alphaMode!=="BLEND"){_.push({mesh:F,depth:0,modelIndex:d,worldViewProjection:D,nodeModelMatrix:C,isLightMesh:M,materialOverride:z,modelOpacity:v,modelColor:T,node:i,modelMatrix:o});continue}const V=a.ah([],F.centroid,D);!I.isOrthographic&&V[2]<=0||m.push({mesh:F,depth:V[2],modelIndex:d,worldViewProjection:D,nodeModelMatrix:C,isLightMesh:M,materialOverride:z,modelOpacity:v,modelColor:T,node:i,modelMatrix:o})}if(i.children)for(const F of i.children)Dl(l,F,o,u,d,m,_,y,v,T)}function Ra(l,i,o,u){const d=o.shadowRenderer;if(!d)return;const m=d.getShadowPassDepthMode(),_=d.calculateShadowPassMatrixFromMatr
3254ix(i),y=Ea(_);o.getOrCreateProgram("modelDepth").draw(o,o.context.gl.TRIANGLES,m,st.disabled,ct.disabled,pt.disabled,y,u.id,l.vertexBuffer,l.indexBuffer,l.segments,u.paint,o.transform.zoom,void 0,void 0)}function Kh(l,i,o,u){const d=function(I,M){if(M.footprintDebugMesh)return M.footprintDebugMesh;if(!M.footprint)return null;const C=I.context,D=M.footprint.vertices,F=M.footprint.indices,z=new a.dx;z.reserve(D.length);for(const te of D)z.emplaceBack(te.x,te.y);const V=new a.dy;V.reserve(F.length);for(let te=0;te<F.length;te+=3)V.emplaceBack(F[te],F[te+1],F[te+2]);const N=C.createVertexBuffer(z,a.dt.members),$=C.createIndexBuffer(V),H=a.du.simpleSegment(0,0,D.length,F.length),j=M.id||M.name||"footprint";let ne;const Y=parseInt(j,10);ne=isNaN(Y)?function(te){let de=0;for(let se=0;se<te.length;se++)de=(de<<5)-de+te.charCodeAt(se)|0;return de}(j):Y;const re=a.e7(ne),Z=a.e7(ne+1),K=a.e7(ne+2);return M.footprintDebugMesh={vertexBuffer:N,indexBuffer:$,segments:H,color:new a.aq(re,Z,K,.5)},M.footprintDebugMesh}(l,o);if(!d)return;const m=l.context,_=m.gl,y=l.getOrCreateProgram("debug"),v=d.color,T=rt.disabled;m.activeTexture.set(_.TEXTURE0),l.emptyTexture.bind(_.LINEAR,_.CLAMP_TO_EDGE),y.draw(l,_.TRIANGLES,T,st.disabled,ct.alphaBlended,pt.disabled,so(u,v.toPremultipliedRenderColor(null)),"$debug",d.vertexBuffer,d.indexBuffer,d.segments)}function tp(l,i,o,u,d,m){for(const _ of d){const y=Object.assign({},u);y.part=_;const v={type:"Unknown",id:i,properties:y},T={orientation:l.paint.get("model-rotation").evaluate(v,o)};m.set(_,T)}}function Qh(l,i,o,u,d,m){for(const _ of d){const y=Object.assign({},u);y.part=_;const v={type:"Unknown",id:i,properties:y},T={color:l.paint.get("model-color").evaluate(v,o),colorMix:l.paint.get("model-color-mix-intensity").evaluate(v,o),opacity:l.paint.get("model-opacity").evaluate(v,o),emissionStrength:l.paint.get("model-emissive-strength").evaluate(v,o)};m.set(_,T)}}function is(l,i,o,u,d){let m=!1;for(const y of u)y.modelOpacity!==1&&(Zt(y,l,i,d[y.modelIndex],st.disabled,ct.disabled),m=!0);for(const y of u)Zt(y,l,i,d[y.modelIndex],y.modelOpacity!==1?l.stencilModeFor3D():st.disabled,l.colorModeForRenderPass());m&&l.resetStencilClippingMasks();const _=ct.additive;for(const y of o)Zt(y,l,i,d[y.modelIndex],st.disabled,y.isLightMesh?_:l.colorModeForRenderPass())}function rs(l,i,o){const u=i.updateZoomBasedPaintProperties(),d=function(m,_,y){let v,T,I,M=m.terrain?m.terrain.exaggeration():0;if(m.terrain&&M>0){const C=m.terrain,D=C.findDEMTileFor(y);D&&D.dem?v=a.et.create(C,y,D):M=0}if(M===0&&(_.terrainElevationMin=0,_.terrainElevationMax=0),M===_.validForExaggeration&&(M===0||v&&v._demTile&&v._demTile.tileID===_.validForDEMTile.id&&v._dem._timestamp===_.validForDEMTile.timestamp))return!1;for(const C in _.instancesPerModel){const D=_.instancesPerModel[C];for(let F=0;F<D.instancedDataArray.length;++F){const z=(v?M*v.getElevationAt(0|D.instancedDataArray.float32[16*F],0|D.instancedDataArray.float32[16*F+1],!0,!0):0)+D.instancesEvaluatedElevation[F];D.instancedDataArray.float32[16*F+6]=z,T=T?Math.min(_.terrainElevationMin,z):z,I=I?Math.max(_.terrainElevationMax,z):z}}return _.terrainElevationMin=T||0,_.terrainElevationMax=I||0,_.validForExaggeration=M,_.validForDEMTile=v&&v._demTile?{id:v._demTile.tileID,timestamp:v._dem._timestamp}:{id:void 0,timestamp:0},!0}(l,i,o);(u||d)&&(i.uploaded=!1,i.upload(l.context))}const ke={shadowUniformsInitialized:!1,useSingleShadowCascade:!1,tileMatrix:new Float64Array(16),shadowTileMatrix:new Float32Array(16),aabb:new a.cQ([0,0,0],[a.an,a.an,0])};function Ge(l,i){const o=1<<l.canonical.z,u=i.getFreeCameraOptions().position,d=i.elevation,m=l.canonical.x/o,_=(l.canonical.x+1)/o,y=l.canonical.y/o,v=(l.canonical.y+1)/o;let T=i._centerAltitude;if(d){const D=d.getMinMaxForTile(l);D&&D.max>T&&(T=D.max)}
3254const I=a.aC(u.x,m,_)-u.x,M=a.aC(u.y,y,v)-u.y,C=a.bV(T,i.center.lat)-u.z;return i._zoomFromMercatorZ(Math.sqrt(I*I+M*M+C*C))}function Ls(l,i,o,u,d,m,_){const y=l.context,v=l.renderPass==="shadow",T=l.shadowRenderer,I=v&&T?T.getShadowPassDepthMode():new rt(y.gl.LEQUAL,rt.ReadWrite,l.depthRangeFor3D),M=l.isTileAffectedByFog(m),C=l.transform.projection.name==="globe";if(o.meshes)for(const D of o.meshes){const F=C?[]:["MODEL_POSITION_ON_GPU"],z=[];let V,N,$;const H=!C&&u.instancedDataArray.length>20;H&&F.push("INSTANCED_ARRAYS");const j=no(l,i.paint.get("model-cutoff-fade-range"));if(j.shouldRenderCutoff&&F.push("RENDER_CUTOFF"),v&&T)V=l.getOrCreateProgram("modelDepth",{defines:F}),N=Ea(_.shadowTileMatrix,_.shadowTileMatrix,Float32Array.from(o.globalMatrix)),$=ct.disabled;else{Yh(F,z,D,l,i.paint.get("model-color-use-theme").constantOr("default")==="none"?null:i.lut),V=l.getOrCreateProgram("model",{defines:F,overrideFog:M});const Y=D.material,re=Y.pbrMetallicRoughness,Z=i.paint.get("model-opacity").constantOr(1),K=i.paint.get("model-emissive-strength").constantOr(0);N=Ia(m.expandedProjMatrix,Float32Array.from(o.globalMatrix),new Float32Array(16),null,l,Z,re.baseColorFactor,Y.emissiveFactor,re.metallicFactor,re.roughnessFactor,Y,K,i,d),T&&(_.shadowUniformsInitialized?V.setShadowUniformValues(y,T.getShadowUniformValues()):(T.setupShadows(m.toUnwrapped(),V,"model-tile"),_.shadowUniformsInitialized=!0)),$=j.shouldRenderCutoff||Z<1||Y.alphaMode!=="OPAQUE"?ct.alphaBlended:ct.unblended}l.uploadCommonUniforms(y,V,m.toUnwrapped(),null,j);const ne=D.material.doubleSided?pt.disabled:pt.backCCW;if(H)z.push(u.instancedDataBuffer),V.draw(l,y.gl.TRIANGLES,I,st.disabled,$,ne,N,i.id,D.vertexBuffer,D.indexBuffer,D.segments,i.paint,l.transform.zoom,void 0,z,u.instancedDataArray.length);else{const Y=v?"u_instance":"u_normal_matrix";for(let re=0;re<u.instancedDataArray.length;++re)N[Y]=new Float32Array(u.instancedDataArray.arrayBuffer,64*re,16),V.draw(l,y.gl.TRIANGLES,I,st.disabled,$,ne,N,i.id,D.vertexBuffer,D.indexBuffer,D.segments,i.paint,l.transform.zoom,void 0,z)}}if(o.children)for(const D of o.children)Ls(l,i,D,u,d,m,_)}const Ci=[1,-1,1];function ue(l,i,o,u){if(!o.modelManager)return!0;const d=o.modelManager;if(!o.shadowRenderer)return!0;const m=o.shadowRenderer,_=i.aabb;let y=!0,v=l.maxHeight;if(v===0){let I=0;for(const M in l.instancesPerModel){const C=d.getModel(M,u);C?I=Math.max(I,Math.max(Math.max(C.aabb.max[0],C.aabb.max[1]),C.aabb.max[2])):y=!1}v=l.maxScale*I*1.41+l.maxVerticalOffset,y&&(l.maxHeight=v)}_.max[2]=v,_.min[2]+=l.terrainElevationMin,_.max[2]+=l.terrainElevationMax,a.ah(_.min,_.min,i.tileMatrix),a.ah(_.max,_.max,i.tileMatrix);const T=_.intersects(m.getCurrentCascadeFrustum());return o.currentShadowCascade===0&&(l.isInsideFirstShadowMapFrustum=T===2),T===0}function ip(l,i){const o=l.uniformValues.u_cutoff_params[0],u=l.uniformValues.u_cutoff_params[1],d=l.uniformValues.u_cutoff_params[2],m=l.uniformValues.u_cutoff_params[3];return u===o||m===d?1:a.aC(((i-o)/(u-o)-d)/(m-d),0,1)}function hu(l,i,o,u){if(i.pitch<20)return 1;const d=i.getWorldToCameraMatrix();a.aD(d,d,l);const m=a.bu(o.min[0],o.min[1],o.min[2],1);let _=a.aE(a.bF(),m,d),y=_,v=_;m[1]=o.max[1],_=a.aE(a.bF(),m,d),y=_[1]<y[1]?_:y,v=_[1]>v[1]?_:v,m[0]=o.max[0],_=a.aE(a.bF(),m,d),y=_[1]<y[1]?_:y,v=_[1]>v[1]?_:v,m[1]=o.min[1],_=a.aE(a.bF(),m,d),y=_[1]<y[1]?_:y,v=_[1]>v[1]?_:v;const T=a.aC(u[0],0,1),I=100*i.pixelsPerMeter*a.aC(u[1],0,1),M=a.aC(u[2],0,1),C=a.eu(a.bF(),y,v,T),D=Math.tan(.5*i.fovX),F=-C[2]*D;if(I===0)return C[1]<-Math.abs(F)?M:1;const z=(-Math.abs(F)-C[1])/I,V=($,H,j)=>(1-j)*$+j*H,N=a.aC(V(1,M,z),M,1);return V(1,N,a.aC((i.pitch-20)/20,0,1))}class Jh{}class du{constructor(){this._storage=new Map}getLinesFromTrianglesBuffer(i,o,u){{const M=this._storage.get(o.id);if(M)return M.lastUsedFrameIdx=i,M.buf}const d=u.gl,m=d.getBufferParameter(d.ELEMENT_ARRAY_BUFFER,d.BUFFER_SIZE),_=new ArrayBuffer(m),y=new Int16Array(_);d.getBufferSubData(d.ELEMENT_ARRAY_BUFFER,0,new Int16Array(_));const v=new a.ew;for(let M=0;M<m/2;M+=3){const C=y[M],D=y[M+1],F=y[M+2];v.emplaceBack(C,D),v.emplaceBack(D,F),v.emplaceBack(F,C)}const T=u.bindVertexArrayOES.current,I=new Jh;return I.buf=new Wn(u,v),I.lastUsedFrameIdx=i,this._storage.set(o.id,I),u.bindVertexArrayOES.set(T),I.buf}update(i){for(const[o,u]of this._storage)i-u.lastUsedFrameIdx>30&&(u.buf.destroy(),this._storage.delete(o))}destroy(){for(const[i,o]of this._storage)o.buf.destroy(),this._storage.delete(i)}}class rp{constructor(){this.occluderSize=30,this.depthOffset=-1e-4}}const np=a.e4([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_rainParticleData",components:4}]);class Fs{constructor(i){this.revealStart=11,this.revealRange=2}}const t_=a.e4([{type:"Float32",name:"a_pos_2f",components:2}]);class i_{destroy(){this.vignetteVx&&this.vignetteVx.destroy(),this.vignetteIdx&&this.vignetteIdx.destroy()}draw(i,o){const u=i.getOrCreateProgram("vignette");
3254if(!this.vignetteVx||!this.vignetteIdx){const _=new a.ex,y=new a.dy;_.emplaceBack(-1,-1),_.emplaceBack(1,-1),_.emplaceBack(1,1),_.emplaceBack(-1,1),y.emplaceBack(0,1,2),y.emplaceBack(0,2,3),this.vignetteVx=i.context.createVertexBuffer(_,t_.members),this.vignetteIdx=i.context.createIndexBuffer(y)}const d=a.du.simpleSegment(0,0,4,6);if(this.vignetteVx&&this.vignetteIdx){i.uploadCommonUniforms(i.context,u);const _={u_vignetteShape:(m={vignetteShape:[o.start,o.range,Math.pow(10,o.fadePower)],vignetteColor:[o.color.r,o.color.g,o.color.b,o.color.a*o.strength]}).vignetteShape,u_vignetteColor:m.vignetteColor};u.draw(i,i.context.gl.TRIANGLES,rt.disabled,st.disabled,ct.alphaBlended,pt.disabled,_,"vignette",this.vignetteVx,this.vignetteIdx,d)}var m}}class op{constructor(){this._accumulatedOffsetX=0,this._accumulatedOffsetY=0,this._accumulatedElevation=0}update(i,o){const u=i.getFreeCameraOptions().position,d=u.toAltitude(),m=u.toLngLat(),_=a.ap(m.lng),y=a.ap(m.lat),v=i.pixelsPerMeter/o,T=_*a.ez,I=a.ez*Math.log(Math.tan(Math.PI/4+y/2));if(this._offsetXPrev===void 0)this._offsetXPrev=0,this._offsetYPrev=0,this._elevationPrev=0,this._accumulatedOffsetX=0,this._accumulatedOffsetY=0,this._accumulatedElevation=0;else{const M=-this._offsetYPrev+I,C=-this._elevationPrev+d;this._accumulatedOffsetX+=(-this._offsetXPrev+T)*v,this._accumulatedOffsetY+=M*v,this._accumulatedElevation+=C*v,this._offsetXPrev=T,this._offsetYPrev=I,this._elevationPrev=d}}getPosition(){return[this._accumulatedOffsetX,this._accumulatedOffsetY,this._accumulatedElevation]}}function Rl(l,i){return[-(l[0]-Math.floor(l[0]/i)*i),-(l[1]-Math.floor(l[1]/i)*i),-(l[2]-Math.floor(l[2]/i)*i)]}function fu(l){const i=a.ei(1323123451230),o=[];for(let u=0;u<l;++u){const d=2*i()-1,m=2*i()-1,_=2*i()-1;o.push(a.cM(d,m,_))}return o}function Do(l,i,o,u,d){const m=a.aC((d-o)/(u-o),0,1);return(1-m)*l+m*i}class ed{constructor(i){this._movement=new op,this._accumulatedTimeFromStart=0,this._prevTime=Date.now()/1e3,this._vignette=new i_,this._ppmScaleFactor=i}destroy(){this.particlesVx&&this.particlesVx.destroy(),this.particlesIdx&&this.particlesIdx.destroy(),this._vignette&&this._vignette.destroy()}updateOnRender(i,o){const u=i.transform;this._movement.update(u,this._ppmScaleFactor);const d=u.starsProjMatrix,m=a.bM([]);a.bO(m,m,a.ap(90)-u._pitch),a.bN(m,m,-u.angle);const _=a.bS(new Float32Array(16),m),y=a.ey(1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1),v=a.e2([],y),T=a.aD([],v,_),I=Date.now()/1e3;return this._accumulatedTimeFromStart+=(I-this._prevTime)*o,this._prevTime=I,{projectionMatrix:d,modelviewMatrix:T}}}class pu extends ed{constructor(i){super(4.25),this._params={overrideStyleParameters:!1,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._revealParams=new Fs("Precipitation > Rain"),this._vignetteParams={strength:1,start:.7,range:1,fadePower:.4,color:{r:.27,g:.27,b:.27,a:1}},this.particlesCount=16e3}update(i){const o=i.context;if(!this.particlesVx){const u=fu(this.particlesCount),d=new a.eA,m=new a.dy;let _=0;const y=a.ei(1323123451230);for(let v=0;v<u.length;++v){const T=u[v],I=[2*y()-1,y(),y(),y()];d.emplaceBack(T[0],T[1],T[2],-1,-1,...I),d.emplaceBack(T[0],T[1],T[2],1,-1,...I),d.emplaceBack(T[0],T[1],T[2],1,1,...I),d.emplaceBack(T[0],T[1],T[2],-1,1,...I),m.emplaceBack(_+0,_+1,_+2),m.emplaceBack(_+0,_+2,_+3),_+=4}this.particlesVx=o.createVertexBuffer(d,np.members),this.particlesIdx=o.createIndexBuffer(m)}}draw(i){if(!this._params.overrideStyleParameters&&!i.style.rain)return;const o=this._params.overrideStyleParameters?this._revealParams:{revealStart:0,revealRange:.01},u=i.transform.zoom;if(o.revealStart>u)return;const d=Do(0,1,o.revealStart,o.revealStart+o.revealRange,u);if(!this.particlesVx||!this.particlesIdx)return;const m=structuredClone(this._params);let _=[-m.direction.x,m.direction.y,-100];a.ay(_,_);
3254const y=structuredClone(this._vignetteParams);y.strength*=d,m.overrideStyleParameters||(m.intensity=i.style.rain.state.density,m.timeFactor=i.style.rain.state.intensity,m.color=structuredClone(i.style.rain.state.color),_=structuredClone(i.style.rain.state.direction),m.screenThinning.intensity=i.style.rain.state.centerThinning,m.dropletSizeX=i.style.rain.state.dropletSize[0],m.dropletSizeYScale=i.style.rain.state.dropletSize[1]/i.style.rain.state.dropletSize[0],m.distortionStrength=100*i.style.rain.state.distortionStrength,y.strength=1,y.color=structuredClone(i.style.rain.state.vignetteColor));const v=this.updateOnRender(i,m.timeFactor),T=i.context,I=T.gl,M=i.transform;this.screenTexture&&this.screenTexture.size[0]===i.width&&this.screenTexture.size[1]===i.height||(this.screenTexture=new a.T(T,{width:i.width,height:i.height,data:null},I.RGBA8)),m.distortionStrength>0&&(T.activeTexture.set(I.TEXTURE0),this.screenTexture.bind(I.LINEAR,I.CLAMP_TO_EDGE),I.copyTexSubImage2D(I.TEXTURE_2D,0,0,0,0,0,i.width,i.height));const C=i.getOrCreateProgram("rainParticle");i.uploadCommonUniforms(T,C),T.activeTexture.set(I.TEXTURE0),this.screenTexture.bind(I.LINEAR,I.CLAMP_TO_EDGE);const D=[m.color.r,m.color.g,m.color.b,m.color.a],F=(z,V)=>{const N=Rl(this._movement.getPosition(),z),$=m.dropletSizeX,H=m.dropletSizeX*m.dropletSizeYScale,j=i.width/2,ne=i.height/2,Y=Do(0,m.screenThinning.start,0,1,m.screenThinning.intensity),re=Do(.001,m.screenThinning.range,0,1,m.screenThinning.intensity),Z=Do(0,m.screenThinning.particleOffset,0,1,m.screenThinning.intensity),K=(te={modelview:v.modelviewMatrix,projection:v.projectionMatrix,time:this._accumulatedTimeFromStart,camPos:N,velocityConeAperture:m.velocityConeAperture,velocity:m.velocity,boxSize:z,rainDropletSize:[$,H],distortionStrength:m.distortionStrength,rainDirection:_,color:D,screenSize:[M.width,M.height],thinningCenterPos:[j,ne],thinningShape:[Y,re,Math.pow(10,m.screenThinning.fadePower)],thinningAffectedRatio:m.screenThinning.affectedRatio,thinningParticleOffset:Z,shapeDirectionalPower:m.shapeDirPower,shapeNormalPower:m.shapeNormalPower,mode:V?0:1},{u_modelview:Float32Array.from(te.modelview),u_projection:Float32Array.from(te.projection),u_time:te.time,u_cam_pos:te.camPos,u_texScreen:0,u_velocityConeAperture:te.velocityConeAperture,u_velocity:te.velocity,u_boxSize:te.boxSize,u_rainDropletSize:te.rainDropletSize,u_distortionStrength:te.distortionStrength,u_rainDirection:te.rainDirection,u_color:te.color,u_screenSize:te.screenSize,u_thinningCenterPos:te.thinningCenterPos,u_thinningShape:te.thinningShape,u_thinningAffectedRatio:te.thinningAffectedRatio,u_thinningParticleOffset:te.thinningParticleOffset,u_shapeDirectionalPower:te.shapeDirectionalPower,u_shapeNormalPower:te.shapeNormalPower,u_mode:te.mode});var te;const de=Math.round(m.intensity*this.particlesCount),se=a.du.simpleSegment(0,0,4*de,2*de);C.draw(i,I.TRIANGLES,rt.disabled,st.disabled,ct.alphaBlended,pt.disabled,K,"rain_particles",this.particlesVx,this.particlesIdx,se)};m.distortionStrength>0&&F(m.boxSize,!0),F(m.boxSize,!1),this._vignette.draw(i,y)}}const zl=a.e4([{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}]);class Os extends ed{constructor(i){super(2.25),this._params={overrideStyleParameters:!1,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._revealParams=new Fs("Precipitation > Snow"),this._vignetteParams={strength:.3,start:.78,range:.46,fadePower:.2,color:{r:1,g:1,b:1,a:1}},this.particlesCount=16e3}update(i){const o=i.context;if(!this.particlesVx){const u=fu(this.particlesCount),d=new a.eB,m=new a.dy;let _=0;const y=a.ei(1323123451230);for(let v=0;v<u.length;++v){const T=u[v],I=y(),M=y(),C=y(),D=[v/u.length,I,M,C],F=[y(),y()];d.emplaceBack(T[0],T[1],T[2],-1,-1,...D,...F),d.emplaceBack(T[0],T[1],T[2],1,-1,...D,...F),d.emplaceBack(T[0],T[1],T[2],1,1,...D,...F),d.emplaceBack(T[0],T[1],T[2],-1,1,...D,...F),m.emplaceBack(_+0,_+1,_+2),m.emplaceBack(_+0,_+2,_+3),_+=4}this.particlesVx=o.createVertexBuffer(d,zl.members),this.particlesIdx=o.createIndexBuffer(m)}}draw(i){if(!this._params.overrideStyleParameters&&!i.style.snow)return;const o=structuredClone(this._params);let u=[-o.direction.x,o.direction.y,-100];a.ay(u,u);
3254const d=structuredClone(this._vignetteParams),m=o.overrideStyleParameters?this._revealParams:{revealStart:0,revealRange:.01},_=i.transform.zoom;if(m.revealStart>_)return;const y=Do(0,1,m.revealStart,m.revealStart+m.revealRange,_);d.strength*=y,o.overrideStyleParameters||(o.intensity=i.style.snow.state.density,o.timeFactor=i.style.snow.state.intensity,o.color=structuredClone(i.style.snow.state.color),u=structuredClone(i.style.snow.state.direction),o.screenThinning.intensity=i.style.snow.state.centerThinning,o.billboardSize=2.79*i.style.snow.state.flakeSize,d.strength=1,d.color=structuredClone(i.style.snow.state.vignetteColor));const v=this.updateOnRender(i,o.timeFactor);if(!this.particlesVx||!this.particlesIdx)return;const T=i.context,I=T.gl,M=i.transform,C=i.getOrCreateProgram("snowParticle");i.uploadCommonUniforms(T,C),((D,F,z)=>{const V=Rl(this._movement.getPosition(),D),N=M.width/2,$=M.height/2,H=Do(0,z.screenThinning.start,0,1,z.screenThinning.intensity),j=Do(.001,z.screenThinning.range,0,1,z.screenThinning.intensity),ne=Do(0,z.screenThinning.particleOffset,0,1,z.screenThinning.intensity),Y=(re={modelview:v.modelviewMatrix,projection:v.projectionMatrix,time:this._accumulatedTimeFromStart,camPos:V,velocityConeAperture:z.velocityConeAperture,velocity:z.velocity,horizontalOscillationRadius:z.horizontalOscillationRadius,horizontalOscillationRate:z.horizontalOscillationRate,boxSize:D,billboardSize:1*z.billboardSize,simpleShapeParameters:[z.shapeFadeStart,z.shapeFadePower],screenSize:[M.width,M.height],thinningCenterPos:[N,$],thinningShape:[H,j,Math.pow(10,z.screenThinning.fadePower)],thinningAffectedRatio:z.screenThinning.affectedRatio,thinningParticleOffset:ne,color:[z.color.r,z.color.g,z.color.b,z.color.a],direction:u},{u_modelview:Float32Array.from(re.modelview),u_projection:Float32Array.from(re.projection),u_time:re.time,u_cam_pos:re.camPos,u_velocityConeAperture:re.velocityConeAperture,u_velocity:re.velocity,u_horizontalOscillationRadius:re.horizontalOscillationRadius,u_horizontalOscillationRate:re.horizontalOscillationRate,u_boxSize:re.boxSize,u_billboardSize:re.billboardSize,u_simpleShapeParameters:re.simpleShapeParameters,u_screenSize:re.screenSize,u_thinningCenterPos:re.thinningCenterPos,u_thinningShape:re.thinningShape,u_thinningAffectedRatio:re.thinningAffectedRatio,u_thinningParticleOffset:re.thinningParticleOffset,u_particleColor:re.color,u_direction:re.direction});var re;const Z=Math.round(z.intensity*this.particlesCount),K=a.du.simpleSegment(0,0,4*Z,2*Z);this.particlesVx&&this.particlesIdx&&C.draw(i,I.TRIANGLES,rt.disabled,st.disabled,ct.alphaBlended,pt.disabled,Y,"snow_particles",this.particlesVx,this.particlesIdx,K)})(o.boxSize,0,o),this._vignette.draw(i,d)}}const sp={symbol:function(l,i,o,u,d){if(l.renderPass!=="translucent")return;const m=st.disabled,_=l.colorModeForRenderPass(),y=o.layout.get("text-variable-anchor"),v=o.layout.get("text-size-scale-range"),T=a.aC(l.scaleFactor,v[0],v[1]);y&&function(C,D,F,z,V,N,$,H){const j=D.transform,ne=V==="map",Y=N==="map";for(const re of C){const Z=z.getTile(re),K=Z.getBucket(F);if(!K||!K.text||!K.text.segments.get().length)continue;const te=a.bk(K.textSizeData,j.zoom,H),de=Tc(re,K.getProjection(),j),se=j.calculatePixelsToTileUnitsMatrix(Z),be=sl(de,Z.tileID.canonical,Y,ne,j,K.getProjection(),se),_e=K.hasIconTextFit()&&K.hasIconData();te&&es(K,ne,Y,$,j,be,re,Math.pow(2,j.zoom-Z.tileID.overscaledZ),te,_e)}}(u,l,o,i,o.layout.get("text-rotation-alignment"),o.layout.get("text-pitch-alignment"),d,T);const I=o.paint.get("icon-opacity").constantOr(1)!==0,M=o.paint.get("text-opacity").constantOr(1)!==0;o.layout.get("symbol-sort-key").constantOr(1)!==void 0&&(I||M)?ru(l,i,o,u,m,_):(I&&ru(l,i,o,u,m,_,{onlyIcons:!0}),M&&ru(l,i,o,u,m,_,{onlyText:!0})),i.map.showCollisionBoxes&&(Al(l,i,o,u,o.paint.get("text-translate"),o.paint.get("text-translate-anchor"),!0),Al(l,i,o,u,o.paint.get("icon-translate"),o.paint.get("icon-translate-anchor"),!1))},circle:function(l,i,o,u){if(l.renderPass!=="translucent")return;const d=o.paint.get("circle-opacity"),m=o.paint.get("circle-stroke-width"),_=o.paint.get("circle-stroke-opacity"),y=o.layout.get("
3254circle-sort-key").constantOr(1)!==void 0,v=o.paint.get("circle-emissive-strength");if(d.constantOr(1)===0&&(m.constantOr(1)===0||_.constantOr(1)===0))return;const T=l.context,I=T.gl,M=l.transform,C=!(!l.terrain||!l.terrain.enabled),D=o.layout.get("circle-elevation-reference"),F=l.depthModeForSublayer(0,rt.ReadOnly),z=new rt(l.context.gl.LEQUAL,rt.ReadOnly,l.depthRangeFor3D),V=D==="none"||C?F:z,N=st.disabled,$=l.colorModeForDrapableLayerRenderPass(v),H=M.projection.name==="globe",j=[a.aH(M.center.lng),a.aL(M.center.lat)],ne=[];for(let re=0;re<u.length;re++){const Z=u[re],K=i.getTile(Z),te=K.getBucket(o);if(!te||te.projection.name!==M.projection.name)continue;const de=te.programConfigurations.get(o.id),se=te.layoutVertexBuffer,be=te.globeExtVertexBuffer,_e=te.indexBuffer,Me=a.dO(o),Le=[be],fe=l.isTileAffectedByFog(Z);H&&Me.push("PROJECTION_GLOBE_VIEW"),Me.push("DEPTH_D24"),l.terrain&&M.depthOcclusionForSymbolsAndCircles&&Me.push("DEPTH_OCCLUSION"),te.hasElevation&&!l.terrain&&(Me.push("ELEVATED_ROADS"),Le.push(te.elevatedLayoutVertexBuffer));const le=l.getOrCreateProgram("circle",{config:de,defines:Me,overrideFog:fe}),xe=M.projection.createInversionMatrix(M,Z.canonical),we={programConfiguration:de,program:le,layoutVertexBuffer:se,dynamicBuffers:Le,indexBuffer:_e,uniformValues:a.dP(l,Z,K,xe,j,o),tile:K};if(y){const Se=te.segments.get();for(const $e of Se)ne.push({segments:new a.du([$e]),sortKey:$e.sortKey,state:we})}else ne.push({segments:te.segments,sortKey:0,state:we})}y&&ne.sort((re,Z)=>re.sortKey-Z.sortKey);const Y={useDepthForOcclusion:M.depthOcclusionForSymbolsAndCircles};for(const re of ne){const{programConfiguration:Z,program:K,layoutVertexBuffer:te,dynamicBuffers:de,indexBuffer:se,uniformValues:be,tile:_e}=re.state,Me=re.segments;l.terrain&&l.terrain.setupElevationDraw(_e,K,Y),l.uploadCommonUniforms(T,K,_e.tileID.toUnwrapped()),K.draw(l,I.TRIANGLES,V,N,$,pt.disabled,be,o.id,te,se,Me,o.paint,M.zoom,Z,de)}},heatmap:function(l,i,o,u){if(o.paint.get("heatmap-opacity")!==0)if(l.renderPass==="offscreen"){const d=l.context,m=d.gl,_=st.disabled,y=new ct([m.ONE,m.ONE,m.ONE,m.ONE],a.aq.transparent,[!0,!0,!0,!0]),v=l.transform.projection.name==="globe"?.5:.25;o.heatmapFbo=Aa.createWithTexture(d,o.heatmapFbo,l.width*v,l.height*v),d.clear({color:a.aq.transparent});const T=l.transform,I=T.projection.name==="globe",M=I?["PROJECTION_GLOBE_VIEW"]:[],C=I?pt.frontCCW:pt.disabled,D=[a.aH(T.center.lng),a.aL(T.center.lat)];for(let F=0;F<u.length;F++){const z=u[F];if(i.hasRenderableParent(z))continue;const V=i.getTile(z),N=V.getBucket(o);if(!N||N.projection.name!==T.projection.name)continue;const $=l.isTileAffectedByFog(z),H=N.programConfigurations.get(o.id),j=l.getOrCreateProgram("heatmap",{config:H,defines:M,overrideFog:$}),{zoom:ne}=l.transform;l.terrain&&l.terrain.setupElevationDraw(V,j),l.uploadCommonUniforms(d,j,z.toUnwrapped());const Y=T.projection.createInversionMatrix(T,z.canonical);j.draw(l,m.TRIANGLES,rt.disabled,_,y,C,Jc(l,z,V,Y,D,ne,o.paint.get("heatmap-intensity")),o.id,N.layoutVertexBuffer,N.indexBuffer,N.segments,o.paint,l.transform.zoom,H,I?[N.globeExtVertexBuffer]:null)}d.viewport.set([0,0,l.width,l.height])}else l.renderPass==="translucent"&&(l.context.setColorMode(l.colorModeForRenderPass()),function(d,m){const _=d.context,y=_.gl,v=m.heatmapFbo;if(!v)return;_.activeTexture.set(y.TEXTURE0),y.bindTexture(y.TEXTURE_2D,v.colorAttachment0.get()),_.activeTexture.set(y.TEXTURE1);let T=m.colorRampTexture;T||(T=m.colorRampTexture=new a.T(_,m.colorRamp,y.RGBA8)),T.bind(y.LINEAR,y.CLAMP_TO_EDGE),d.getOrCreateProgram("heatmapTexture").draw(d,y.TRIANGLES,rt.disabled,st.disabled,d.colorModeForRenderPass(),pt.disabled,((I,M)=>({u_image:0,u_color_ramp:1,u_opacity:M.paint.get("heatmap-opacity")}))(0,m),m.id,d.viewportBuffer,d.quadTriangleIndexBuffer,d.viewportSegments,m.paint,d.transform.zoom)}(l,o))},line:function(l,i,o,u){const d=o.paint.get("line-opacity"),m=o.paint.get("line-width");if(d.constantOr(1)===0||m.constantOr(1)===0)return;const _=o.paint.get("line-blend-mode");if(_!=="default"&&l.transform.projection.name!=="globe")return l.terrain&&l.terrain.renderingToTexture?void function(y,v,T,I,M){if(y.renderPass!=="translucent")return;const C=y.context,D=C.gl,F=y.terrain;if(!F)return;const z=C.bindFramebuffer.current,V=y.emissiveMode==="mrt-fallback";T.lineBlendDrapeFbo=Aa.createWithTexture(C,T.lineBlendDrapeFbo,F.drapeBufferSize[0],F.drapeBufferSize[1],!0),T.lineBlendDrapeStencil=T.lineBlendDrapeFbo._stencilRbo,V&&D.drawBuffers([D.COLOR_ATTACHMENT0]),C.clear({color:Po[M].clearColor,depth:1,stencil:0});const N=y.currentStencilSource,$=y._tileClippingMaskIDs,H=y.nextStencilID;y.currentStencilSource=void 0,y._tileClippingMaskIDs={},y.nextStencilID=1;const j=y._terrain;y._terrain=null,y._renderTileClippingMasks(T,v,I),ou(y,v,T,I,Po[M].colorMode,!0),y._terrain=j,y.currentStencilSource=N,y._tileClippingMaskIDs=$,y.nextStencilID=H,C.bindFramebuffer.set(z),V&&D.drawBuffers([D.COLOR_ATTACHMENT0,D.COLOR_ATTACHMENT1]);const ne=F.drapeBufferSize;C.viewport.set([0,0,ne[0],ne[1]]);const Y=T.lineBlendDrapeFbo;if(!Y)return;C.activeTexture.set(D.TEXTURE0),D.bindTexture(D.TEXTURE_2D,Y.colorAttachment0.get());const re=M==="additive"?1:T.paint.get("line-opacity").constantOr(1),Z=T.paint.get("line-emissive-strength").constantOr(0),K=M==="additive"?y.colorModeForDrapableLayerRenderPass(Z):Po[M].colorMode;y.getOrCreateProgram("lineBlendComposite").draw(y,D.TRIANGLES,rt.disabled,st.disabled,K,pt.disabled,Ch(0,re,Po[M].compositeUniformValue),T.id,y.viewportBuffer,y.quadTriangleIndexBuffer,y.viewportSegments,T.paint,y.transform.zoom)}(l,i,o,u,_):l.renderPass==="offscreen"?void function(y,v,T,I,M){const C=y.context,D=Math.ceil(y.width),F=Math.ceil(y.height);T.lineBlendFbo=Aa.createWithTexture(C,T.lineBlendFbo,D,F,!0),T.lineBlendStencil=T.lineBlendFbo._stencilRbo,C.clear({color:Po[M].clearColor,depth:1,stencil:0});const z=y.currentStencilSource,V=y._tileClippingMaskIDs,N=y.nextStencilID;y.currentStencilSource=void 0,y._tileClippingMaskIDs={},y.nextStencilID=1,y._renderTileClippingMasks(T,v,I);const $=y.renderPass;y.renderPass="translucent",ou(y,v,T,I,Po[M].colorMode),y.renderPass=$,y.currentStencilSource=z,y._tileClippingMaskIDs=V,y.nextStencilID=N,C.viewport.set([0,0,y.width,y.height])}(l,i,o,u,_):l.renderPass==="translucent"?void function(y,v,T){const I=y.context,M=I.gl,C=v.lineBlendFbo;if(!C)return;I.activeTexture.set(M.TEXTURE0),M.bindTexture(M.TEXTURE_2D,C.colorAttachment0.get());const D=T==="additive"?1:v.paint.get("line-opacity").constantOr(1),F=T==="additive"?y.colorModeForDrapableLayerRenderPass(v.paint.get("line-emissive-strength").constantOr(0)):Po[T].colorMode;y.getOrCreateProgram("lineBlendComposite").draw(y,M.TRIANGLES,rt.disabled,st.disabled,F,pt.disabled,Ch(0,D,Po[T].compositeUniformValue),v.id,y.viewportBuffer,y.quadTriangleIndexBuffer,y.viewportSegments,v.paint,y.transform.zoom)}(l,o,_):void 0;l.renderPass==="translucent"&&ou(l,i,o,u)},fill:function(l,i,o,u){const d=o.paint.get("fill-color"),m=o.paint.get("fill-opacity");if(m.constantOr(1)===0)return;const _=o.paint.get("fill-emissive-strength"),y=l.colorModeForDrapableLayerRenderPass(_),v=o.paint.get("fill-pattern"),T=l.opaquePassEnabledForLayer()&&!v.constantOr(1)&&d.constantOr(a.aq.transparent).a===1&&m.constantOr(0)===1?"opaque":"translucent";let I="none";o.layout.get("fill-elevation-reference")!=="none"?I="road":o.paint.get("fill-z-offset").constantOr(1)!==0&&(I="offset");const M=!(!l.terrain||!l.terrain.enabled),C={painter:l,sourceCache:i,layer:o,coords:u,colorMode:y,elevationType:I,terrainEnabled:M,pass:T};
3254if(l.renderPass==="shadow")return void(l.shadowRenderer&&I==="road"&&!M&&function(F){const{painter:z,sourceCache:V,layer:N,coords:$}=F,H=z.context.gl,j=F.painter.shadowRenderer;for(const ne of $){const Y=V.getTile(ne),re=Y.getBucket(N);if(!re)continue;const Z=re.elevatedStructures;if(!Z||!Z.shadowCasterSegments||Z.shadowCasterSegments.segments[0].primitiveLength===0)continue;z.prepareDrawTile();const K=re.bufferData.programConfigurations.get(N.id),te=z.isTileAffectedByFog(ne),de=z.getOrCreateProgram("elevatedStructuresDepth",{config:K,overrideFog:te}),se=j.calculateShadowPassMatrixFromTile(Y.tileID.toUnwrapped());z.uploadCommonUniforms(z.context,de,ne.toUnwrapped());const be=Sa(se,0);de.draw(z,H.TRIANGLES,j.getShadowPassDepthMode(),st.disabled,ct.disabled,pt.disabled,be,N.id,Z.vertexBuffer,Z.indexBuffer,Z.shadowCasterSegments,N.paint,z.transform.zoom,K)}}(C));const D=l.emissiveMode==="mrt-fallback";if(I!=="offset"){if(Ca(C,!1,D),I==="road"){const F=!M&&l.renderPass==="translucent";F&&kh(l,i,o,u,"geometry"),Ca(C,!0,D,st.disabled),F&&function(z){const{painter:V,sourceCache:N,layer:$,coords:H,colorMode:j}=z,ne=V.context.gl,Y=z.painter.shadowRenderer,re=!!Y&&Y.enabled,Z=new rt(V.context.gl.LEQUAL,rt.ReadOnly,V.depthRangeFor3D);let K=[0,0,0];if(re){const de=V.style.directionalLight,se=V.style.ambientLight;de&&se&&(K=As(V.style,de,se))}const te=de=>{for(const se of H){const be=N.getTile(se),_e=be.getBucket($);if(!_e)continue;const Me=_e.elevatedStructures;if(!Me)continue;let Le,fe;if(de?(Le=Me.renderableBridgeSegments,fe=Me.bridgeProgramConfigurations.get($.id)):(Le=Me.renderableTunnelSegments,fe=Me.tunnelProgramConfigurations.get($.id)),!Le||Le.segments[0].primitiveLength===0)continue;fe.updatePaintBuffers(),V.prepareDrawTile();const le=V.isTileAffectedByFog(se),xe=[];re&&xe.push("RENDER_SHADOWS","NORMAL_OFFSET");const we=V.getOrCreateProgram("elevatedStructures",{config:fe,overrideFog:le,defines:xe}),Se=V.translatePosMatrix(se.projMatrix,be,$.paint.get("fill-translate"),$.paint.get("fill-translate-anchor"));re&&Y.setupShadows(be.tileID.toUnwrapped(),we,"vector-tile");const $e=Uf(Se,K);V.uploadCommonUniforms(V.context,we,se.toUnwrapped()),we.draw(V,ne.TRIANGLES,Z,st.disabled,j,pt.backCCW,$e,$.id,Me.vertexBuffer,Me.indexBuffer,Le,$.paint,V.transform.zoom,fe,[Me.vertexBufferNormal])}};te(!0),te(!1)}(C)}}else Ca(C,!1,D,l.stencilModeFor3D())},"fill-extrusion":function(l,i,o,u){const d=o.paint.get("fill-extrusion-opacity"),m=l.context,_=m.gl,y=l.terrain,v=y&&y.renderingToTexture;if(d===0)return;const T=l.emissiveMode==="mrt-fallback",I=l.conflationActive&&l.style.isLayerClipped(o,i.getSource()),M=l.style.order.indexOf(o.fqid);if(I&&function(C,D,F,z,V){for(const N of z){const $=D.getTile(N).getBucket(F);$&&($.updateReplacement(N,C.replacementSource,V),$.uploadCentroid(C.context))}}(l,i,o,u,M),y||I)for(const C of u){const D=i.getTile(C).getBucket(o);D&&$f(l.context,i,C,D,o,y,I)}if(l.renderPass==="shadow"&&l.shadowRenderer){if(y&&d<.65&&o._transitionablePaint._values["fill-extrusion-opacity"].value.expression instanceof a.af)return;const C=l.shadowRenderer.getShadowPassDepthMode();Ma(l,i,o,u,C,st.disabled,ct.disabled,I)}else if(l.renderPass==="translucent"){const C=!o.paint.get("fill-extrusion-pattern").constantOr(1),D=o.paint.get("fill-extrusion-color").constantOr(a.aq.white);if(!v&&D.a!==0){const F=new rt(l.context.gl.LEQUAL,rt.ReadWrite,l.depthRangeFor3D);d===1&&C?Ma(l,i,o,u,F,st.disabled,ct.unblended,I):(Ma(l,i,o,u,F,st.disabled,ct.disabled,I),Ma(l,i,o,u,F,l.stencilModeFor3D(),l.colorModeForRenderPass(),I),l.resetStencilClippingMasks())}if(l.style.enable3dLights()&&C&&(!y&&l.transform.projection.name!=="globe"||v)){const F=o.paint.get("fill-extrusion-opacity"),z=o.paint.get("fill-extrusion-ambient-occlusion-intensity"),V=o.paint.get("fill-extrusion-ambient-occlusion-ground-radius"),N=o.paint.get("fill-extrusion-flood-light-intensity"),$=o.paint.get("fill-extrusion-flood-light-color-use-theme").constantOr("default")==="none",H=o.paint.get("fill-extrusion-flood-light-color").toNonPremultipliedRenderColor($?null:o.lut).toArray01().slice(0,3),j=z>0&&V>0,ne=N>0,Y=(K,te,de)=>(1-de)*K+de*te,re=new Cl;re.translate=o.paint.get("fill-extrusion-translate"),re.translateAnchor=o.paint.get("fill-extrusion-translate-anchor"),re.edgeRadius=o.layout.get("fill-extrusion-edge-radius"),re.cutoffFadeRange=o.paint.get("fill-extrusion-cutoff-fade-range");const Z=K=>{const te=l.depthModeForSublayer(1,rt.ReadOnly,_.LEQUAL,!0),de=o.paint.get(K?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),se=Y(.1,3,de),be=l._showOverdrawInspector;if(!be){const _e=new st({func:_.ALWAYS,mask:255},255,255,_.KEEP,_.KEEP,_.REPLACE),Me=new ct([_.ONE,_.ONE,_.ONE,_.ONE],a.aq.transparent,[!1,!1,!1,!0],_.MIN);
3254ao(re,l,i,o,u,te,_e,Me,pt.disabled,K,"sdf",F,z,V,N,H,se,I,!1)}{const _e=be?st.disabled:new st({func:_.EQUAL,mask:255},255,255,_.KEEP,_.DECR,_.DECR),Me=be?l.colorModeForRenderPass():new ct([_.ONE_MINUS_DST_ALPHA,_.DST_ALPHA,_.ONE,_.ONE],a.aq.transparent,[!0,!0,!0,!0]);ao(re,l,i,o,u,te,_e,Me,pt.disabled,K,"color",F,z,V,N,H,se,I,!1)}};if(v){const K=()=>{const de=y.drapeBufferSize[0],se=y.drapeBufferSize[1];let be=y.framebufferCopyTexture;return be&&(!be||be.size[0]===de&&be.size[1]===se)||(be&&be.destroy(),be=y.framebufferCopyTexture=new a.T(m,new a.q({width:de,height:se}),_.RGBA8)),be.bind(_.LINEAR,_.CLAMP_TO_EDGE),_.copyTexSubImage2D(_.TEXTURE_2D,0,0,0,0,0,de,se),be},te=(de,se,be)=>{const _e=l.depthModeForSublayer(1,rt.ReadOnly,_.LEQUAL,!1),Me=o.paint.get(de?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),Le=Y(.1,3,Me);{const fe=new ct([_.ONE,_.ONE,_.ONE,_.ONE],a.aq.transparent,[!1,!1,!1,!0]);ao(re,l,i,o,u,_e,st.disabled,fe,pt.disabled,de,"clear",F,z,V,N,H,Le,I,se)}{const fe=new st({func:_.ALWAYS,mask:255},255,255,_.KEEP,_.KEEP,_.REPLACE),le=new ct([_.ONE,_.ONE,_.ONE,_.ONE],a.aq.transparent,[!1,!1,!1,!0],_.MIN);ao(re,l,i,o,u,_e,fe,le,pt.disabled,de,"sdf",F,z,V,N,H,Le,I,se)}T&&!de&&(be=K());{const fe=de?_.ZERO:_.ONE_MINUS_DST_ALPHA,le=new st({func:_.EQUAL,mask:255},255,255,_.KEEP,_.DECR,_.DECR),xe=new ct([fe,_.DST_ALPHA,_.ONE_MINUS_DST_ALPHA,_.ZERO],a.aq.transparent,[!0,!0,!0,!0]);ao(re,l,i,o,u,_e,le,xe,pt.disabled,de,"color",F,z,V,N,H,Le,I,se)}if(!T||de){const fe=new ct([_.ONE,_.ONE,_.ONE,de?_.ZERO:_.ONE],a.aq.transparent,[!1,!1,!1,!0],de?_.FUNC_ADD:_.MAX);ao(re,l,i,o,u,_e,st.disabled,fe,pt.disabled,de,"clear",F,z,V,N,H,Le,I,se,be)}else{_.drawBuffers([_.NONE,_.COLOR_ATTACHMENT1]);const fe=new st({func:_.EQUAL,mask:255},254,255,_.KEEP,_.DECR,_.DECR),le=new ct([_.ONE,_.ONE,_.ONE,_.ONE],a.aq.transparent,[!0,!1,!1,!1],_.MAX);ao(re,l,i,o,u,_e,fe,le,pt.disabled,de,"emissive",F,z,V,N,H,Le,I,se,be),_.drawBuffers([_.COLOR_ATTACHMENT0])}};if(j||ne){let de;l.prepareDrawTile(),T&&!j||(de=K()),j&&te(!0,!1,de),ne&&te(!1,!0,de)}}else j&&Z(!0),ne&&Z(!1),(j||ne)&&l.resetStencilClippingMasks()}}},building:function(l,i,o,u){l.currentLayer<l.firstLightBeamLayer&&(l.firstLightBeamLayer=l.currentLayer);const d=o.paint.get("building-ambient-occlusion-ground-intensity"),m=o.paint.get("building-ambient-occlusion-ground-radius"),_=o.paint.get("building-ambient-occlusion-ground-attenuation"),y=o.paint.get("building-opacity");if(y<=0)return;let v=d>0&&m>0,T=!0;const I=o.paint.get("building-vertical-scale");if(I<=0)return;l.shadowRenderer||(T=!1);const M=l.conflationActive&&l.style.isLayerClipped(o,i.getSource()),C=l.style.order.indexOf(o.fqid);if(function(D,F,z,V,N,$){for(const H of $){const j=F.getTile(H).getBucket(z);j&&(N&&j.updateReplacement(H,D.replacementSource,V),j.uploadUpdatedIndexBuffer(D.context))}}(l,i,o,C,M,u),function(D,F,z,V){for(const N of V){const $=F.getTile(N).getBucket(z);$&&$.needsEvaluation()&&$.uploadUpdatedColorBuffer(D.context)}}(l,i,o,u),o.resetLayerRenderingStats(l),l.shadowRenderer&&(l.shadowRenderer.useNormalOffset=!0),l.renderPass==="shadow"&&l.shadowRenderer){const D=[],F=l.shadowRenderer.getShadowPassDepthMode();Pa({painter:l,source:i,layer:o,coords:u,defines:D,blendMode:ct.disabled,depthMode:F,opacity:y,verticalScale:I,facadeEmissiveChance:0,facadeAOIntensity:0,floodLightIntensity:0,floodLightColor:[0,0,0]})}else if(l.renderPass==="translucent"){let D=["HAS_ATTRIBUTE_a_part_color_emissive","LIGHTING_3D_MODE"];T&&(D=D.concat("RENDER_SHADOWS")),l.shadowRenderer&&l.shadowRenderer.useNormalOffset&&(D=D.concat("NORMAL_OFFSET"));const F=o.paint.get("building-facade-emissive-chance"),z=o.paint.get("building-ambient-occlusion-intensity"),V=o.paint.get("building-flood-light-intensity"),N=o.paint.get("building-flood-light-color-use-theme").constantOr("default")==="none",$=o.paint.get("building-flood-light-color").toNonPremultipliedRenderColor(N?null:o.lut).toArray01().slice(0,3),H=o.paint.get("building-flood-light-ground-attenuation"),j=V>0,ne=new rt(l.context.gl.LEQUAL,rt.ReadWrite,l.depthRangeFor3D);y<1&&Pa({painter:l,source:i,layer:o,coords:u,defines:D,blendMode:ct.disabled,depthMode:ne,opacity:y,verticalScale:I,facadeEmissiveChance:F,facadeAOIntensity:z,floodLightIntensity:V,floodLightColor:$,depthOnly:!0});const Y=l.colorModeForRenderPass();Pa({painter:l,source:i,layer:o,coords:u,defines:D,blendMode:Y,depthMode:ne,opacity:y,verticalScale:I,facadeEmissiveChance:F,facadeAOIntensity:z,floodLightIntensity:V,floodLightColor:$});const re=o.paint.get("building-front-cutoff");su(l.transform.pitch,re,!!l.terrain),v&&Vh(l,i,o,u,!0,y,d,m,V,$,_,M),j&&Vh(l,i,o,u,!1,y,d,m,V,$,H,M)}else if(l.renderPass==="light-beam"){const D=["HAS_ATTRIBUTE_a_part_color_emissive","HAS_ATTRIBUTE_a_bloom_attenuation"],F=new rt(l.context.gl.LEQUAL,rt.ReadOnly,l.depthRangeFor3D);Pa({painter:l,source:i,layer:o,coords:u,defines:D,blendMode:ct.alphaBlended,depthMode:F,opacity:y,verticalScale:I,facadeEmissiveChance:0,facadeAOIntensity:0,floodLightIntensity:0,floodLightColor:[0,0,0]})}l.shadowRenderer&&(l.shadowRenderer.useNormalOffset=!1),l.resetStencilClippingMasks()},hillshade:function(l,i,o,u){if(l.renderPass!=="offscreen"&&l.renderPass!=="translucent"||l.style.disableElevatedTerrain)return;const d=l.context,m=l.terrain&&l.terrain.renderingToTexture,[_,y]=l.renderPass!=="translucent"||m?[{},u]:l.stencilConfigForOverlap(u);for(const v of y){const T=i.getTile(v);
3254if(T.needsHillshadePrepare&&l.renderPass==="offscreen")Fm(l,T,o);else if(l.renderPass==="translucent"){const I=l.depthModeForSublayer(0,rt.ReadOnly),M=o.paint.get("hillshade-emissive-strength"),C=l.colorModeForDrapableLayerRenderPass(M),D=m&&l.terrain?l.terrain.stencilModeForRTTOverlap(v):_[v.overscaledZ];yh(l,v,T,o,I,D,C)}}d.viewport.set([0,0,l.width,l.height]),l.resetStencilClippingMasks()},raster:function(l,i,o,u,d,m){if(l.renderPass!=="translucent")return;const _=o.paint.get("raster-opacity");if(_===0)return;const y=l.transform.projection.name==="globe",v=o.paint.get("raster-elevation")!==0,T=v&&y,I=l.terrain&&l.terrain.exaggeration()>0&&v&&o.paint.get("raster-elevation-reference")==="ground",M=!y&&I;if(l.renderElevatedRasterBackface&&!T)return;const C=l.context,D=C.gl,F=i.getSource(),z=function(K,te,de,se,be){const _e=te.paint.get("raster-color"),Me=K.type==="raster-array",Le=[],fe=te.paint.get("raster-resampling"),le=te.paint.get("raster-color-mix");let xe=te.paint.get("raster-color-range");const we=[le[0],le[1],le[2],0],Se=le[3];let $e=fe==="nearest"?se.NEAREST:se.LINEAR;if(Me&&(Le.push("RASTER_ARRAY"),_e||Le.push("RASTER_COLOR"),fe==="linear"&&Le.push("RASTER_ARRAY_LINEAR"),$e=se.NEAREST,!xe&&K.rasterLayers)){const Ve=K.rasterLayers.find(({id:Ne})=>Ne===te.sourceLayer);Ve&&Ve.fields&&Ve.fields.range&&(xe=Ve.fields.range)}if(xe=xe||[0,1],_e){Le.push("RASTER_COLOR"),de.activeTexture.set(se.TEXTURE2),te.updateColorRamp(xe);let Ve=te.colorRampTexture;Ve||(Ve=te.colorRampTexture=new a.T(de,te.colorRamp,se.RGBA8)),Ve.bind($e,se.CLAMP_TO_EDGE)}return be&&Le.push("USE_MRT1"),{mix:we,range:xe,offset:Se,defines:Le,resampling:$e}}(F,o,C,D,l.terrain&&l.terrain.renderingToTexture&&l.emissiveMode==="mrt-fallback");if(F instanceof a.aW&&!u.length&&!y)return;const V=o.paint.get("raster-emissive-strength"),N=l.colorModeForDrapableLayerRenderPass(V),$=l.terrain&&l.terrain.renderingToTexture,H=!l.options.moving,j=o.paint.get("raster-resampling")==="nearest"?D.NEAREST:D.LINEAR;if(F instanceof a.aW&&!u.length&&(F.onNorthPole||F.onSouthPole)){const K=v?l.stencilModeFor3D():st.disabled;return void lu(!!F.onNorthPole,null,l,i,o,V,z,pt.disabled,K)}if(!u.length)return;const[ne,Y]=F instanceof a.aW||$?[{},u]:l.stencilConfigForOverlap(u),re=Y[Y.length-1].overscaledZ;T&&z.defines.push("PROJECTION_GLOBE_VIEW"),v&&z.defines.push("RENDER_CUTOFF","ELEVATED"),I&&z.defines.push("ELEVATION_REFERENCE_GROUND");const Z=(K,te,de)=>{for(const se of K){const be=se.toUnwrapped(),_e=i.getTile(se);if($&&(!_e||!_e.hasData()))continue;C.activeTexture.set(D.TEXTURE0);const Me=Uh(_e,F,o,z);if(!Me||!Me.texture)continue;const{texture:Le,mix:fe,offset:le,tileSize:xe,buffer:we}=Me;let Se,$e;$?(Se=rt.disabled,$e=se.projMatrix):v?(Se=new rt(D.LEQUAL,rt.ReadWrite,l.depthRangeFor3D),$e=y?Float32Array.from(l.transform.expandedFarZProjMatrix):l.transform.calculateProjMatrix(be,H)):(Se=l.depthModeForSublayer(se.overscaledZ-re,_===1?rt.ReadWrite:rt.ReadOnly,D.LESS),$e=l.transform.calculateProjMatrix(be,H));const Ve=l.terrain&&$?l.terrain.stencilModeForRTTOverlap(se):ne[se.overscaledZ],Ne=m?0:o.paint.get("raster-fade-duration");_e.registerFadeDuration(Ne);const De=i.findLoadedParent(se,0),tt=Tl(_e,De,i,l.transform,Ne);let ot,Ke;!tt.isFading&&_e.refreshedUponExpiration&&(_e.refreshedUponExpiration=!1),l.terrain&&l.terrain.prepareDrawTile(),C.activeTexture.set(D.TEXTURE0),Le.bind(j,D.CLAMP_TO_EDGE),C.activeTexture.set(D.TEXTURE1),De?(De.texture&&De.texture.bind(j,D.CLAMP_TO_EDGE),ot=Math.pow(2,De.tileID.overscaledZ-_e.tileID.overscaledZ),Ke=[_e.tileID.canonical.x*ot%1,_e.tileID.canonical.y*ot%1]):Le.bind(j,D.CLAMP_TO_EDGE),"useMipmap"in Le&&C.extTextureFilterAnisotropic&&l.transform.pitch>20&&D.texParameterf(D.TEXTURE_2D,C.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,C.extTextureFilterAnisotropicMax);const et=l.transform;let _t;const xt=v?Xf(et):[0,0,0,0];let gt,At,ft,Ct,yt,kt=0;if(T&&F instanceof a.aW&&F.coordinates.length>3)gt=Float32Array.from(a.dq(a.dr(new a.ci(0,0,0)))),At=Float32Array.from(et.globeMatrix),ft=Float32Array.from(a.dl(et)),Ct=[a.aH(et.center.lng),a.aL(et.center.lat)],_t=F.elevatedGlobePerspectiveTransform,yt=F.elevatedGlobeGridMatrix||new Float32Array(9);else if(T){const Gt=a.dm(se.canonical);kt=a.dn(Gt.getCenter().lat),gt=Float32Array.from(a.dq(a.dr(se.canonical))),At=Float32Array.from(et.globeMatrix),ft=Float32Array.from(a.dl(et)),Ct=[a.aH(et.center.lng),a.aL(et.center.lat)],_t=[0,0],yt=Float32Array.from(a.dp(se.canonical,Gt,kt,et.worldSize/et._pixelsPerMercatorPixel))}else _t=F instanceof a.aW?F.perspectiveTransform:[0,0],gt=new Float32Array(16),At=new Float32Array(9),ft=new Float32Array(16),Ct=[0,0],yt=new Float32Array(9);const ti=eu(l,$e,gt,At,ft,yt,Ke||[0,0],a.al(l.transform.zoom),Ct,xt,ot||1,tt,o,_t,v?o.paint.get("raster-elevation"):0,2,fe,le,z.range,xe,we,V),wi=l.isTileAffectedByFog(se),si=l.getOrCreateProgram("raster",{defines:z.defines,overrideFog:wi});if(l.uploadCommonUniforms(C,si,be),F instanceof a.aW){const Gt=F.elevatedGlobeVertexBuffer,It=F.elevatedGlobeIndexBuffer;if($||!y)F.boundsBuffer&&F.boundsSegments&&si.draw(l,D.TRIANGLES,Se,st.disabled,N,pt.disabled,ti,o.id,F.boundsBuffer,l.quadTriangleIndexBuffer,F.boundsSegments);else if(Gt&&It){const Et=et.zoom<=a.cF?F.elevatedGlobeSegments:F.getSegmentsForLongitude(et.center.lng);Et&&si.draw(l,D.TRIANGLES,Se,st.disabled,N,te,ti,o.id,Gt,It,Et)}}else if(T){Se=new rt(D.LEQUAL,rt.ReadOnly,l.depthRangeFor3D);const Gt=l.globeSharedBuffers;if(Gt){I&&(l.terrain.setupElevationDraw(_e,si),l.uploadCommonUniforms(C,si,_e.tileID.toUnwrapped()));const[It,Et,ai]=Gt.getGridBuffers(kt,!1),Ii=si.getAttributeLocation(D,"a_texture_pos");Ii!==-1&&D.vertexAttribI4ui(Ii,0,0,0,0),si.draw(l,D.TRIANGLES,Se,de||Ve,l.colorModeForRenderPass(),te,ti,o.id,It,Et,ai)}}else if(M)Se=new rt(D.LEQUAL,rt.ReadWrite,l.depthRangeFor3D),l.terrain.setupElevationDraw(_e,si),l.uploadCommonUniforms(C,si,_e.tileID.toUnwrapped()),et.pitch>20&&si.draw(l,D.TRIANGLES,Se,st.disabled,ct.disabled,pt.frontCCW,ti,o.id,l.terrain.gridBuffer,l.terrain.gridIndexBuffer,l.terrain.gridSegments),si.draw(l,D.TRIANGLES,Se,Ve,N,pt.backCCW,ti,o.id,l.terrain.gridBuffer,l.terrain.gridIndexBuffer,l.terrain.gridSegments);else{const{tileBoundsBuffer:Gt,tileBoundsIndexBuffer:It,tileBoundsSegments:Et}=l.getTileBoundsBuffers(_e);si.draw(l,D.TRIANGLES,Se,Ve,N,pt.disabled,ti,o.id,Gt,It,Et)}}if(!(F instanceof a.aW)&&T)for(const se of K){const be=se.canonical.y===(1<<se.canonical.z)-1;se.canonical.y===0&&lu(!0,se,l,i,o,V,z,te,de||st.disabled),be&&lu(!1,se,l,i,o,V,z,te===pt.frontCW?pt.backCW:pt.frontCW,de||st.disabled)}};T?Z(Y,l.renderElevatedRasterBackface?pt.backCW:pt.frontCW,l.stencilModeFor3D()):Z(Y,pt.disabled,void 0),l.resetStencilClippingMasks()},"raster-particle":function(l,i,o,u,d,m){l.renderPass==="offscreen"&&function(_,y,v,T){if(!T.length)return;const I=_.context,M=I.gl,C=y.getSource();if(!(C instanceof Ho))return;const D=Math.ceil(Math.sqrt(v.paint.get("raster-particle-count")));let F=v.particlePositionRGBAImage;if(!F||F.width!==D){const H=function(j){const ne=j*j,Y=new Uint8Array(4*ne),re=.9090909090909091;for(let Z=0;Z<ne;Z++){const K=re*(a.e7(2*Z+0)+zs),te=re*(a.e7(2*Z+1)+zs),de=255*K%1,se=255*te%1,be=de,_e=te-se/255,Me=se;Y[4*Z+0]=255*(K-de/255),Y[4*Z+1]=255*be,Y[4*Z+2]=255*_e,Y[4*Z+3]=255*Me}return Y}(D);F=v.particlePositionRGBAImage=new a.q({width:D,height:D},H)}let z=v.particleFramebuffer;z?z.width!==D&&(z.destroy(),z=v.particleFramebuffer=I.createFramebuffer(D,D,1,null)):z=v.particleFramebuffer=I.createFramebuffer(D,D,1,null);const V=[];for(const H of T){const j=y.getTile(H);if(!(j instanceof tl))continue;const ne=Kf(j,C,v);if(!ne)continue;const Y=[j.tileSize,j.tileSize];let re=v.tileFramebuffer;re||(re=v.tileFramebuffer=I.createFramebuffer(Y[0],Y[1],1,null));let Z=j.rasterParticleState;Z||(Z=j.rasterParticleState=new jh(I,H,Y,F));const K=Z.update(v.lastInvalidatedAt);Z.particleTextureDimension!==D&&Z.updateParticleTexture(H,F);const te=Z.targetColorTexture;Z.targetColorTexture=Z.backgroundColorTexture,Z.backgroundColorTexture=te;const de=Z.particleTexture0;Z.particleTexture0=Z.particleTexture1,Z.particleTexture1=de,V.push([H,ne,Z,K])}if(V.length===0)return;const N=a.o.now(),$=v.previousDrawTimestamp?.001*(N-v.previousDrawTimestamp):.0167;if(v.previousDrawTimestamp=N,v.hasColorMap()){I.activeTexture.set(M.TEXTURE0+2);let H=v.colorRampTexture;H||(H=v.colorRampTexture=new a.T(I,v.colorRamp,M.RGBA8)),H.bind(M.LINEAR,M.CLAMP_TO_EDGE)}I.bindFramebuffer.set(v.tileFramebuffer.framebuffer),function(H,j,ne){const Y=H.context,re=Y.gl,Z=j.tileFramebuffer;Y.activeTexture.set(re.TEXTURE0);const K={u_texture:0,u_opacity:1.05*(de=j.paint.get("raster-particle-fade-opacity-factor"))/(de+.05)},te=H.getOrCreateProgram("rasterParticleTexture",{defines:[],overrideFog:!1});var de;for(const se of ne){const[,,be,_e]=se;Z.colorAttachment0.set(be.targetColorTexture.texture),Y.viewport.set([0,0,Z.width,Z.height]),Y.clear({color:a.aq.transparent}),_e&&(be.backgroundColorTexture.bind(re.NEAREST,re.CLAMP_TO_EDGE),te.draw(H,re.TRIANGLES,rt.disabled,st.disabled,ct.alphaBlended,pt.disabled,K,j.id,H.viewportBuffer,H.quadTriangleIndexBuffer,H.viewportSegments))}}(_,v,V),function(H,j,ne,Y){const re=H.context,Z=re.gl,K=ne.tileFramebuffer,te=H.transform.projection.name==="globe",de=ne.paint.get("raster-particle-max-speed");for(const se of Y){const[be,_e,Me]=se;re.activeTexture.set(Z.TEXTURE0+0),_e.texture.bind(Z.LINEAR,Z.CLAMP_TO_EDGE),K.colorAttachment0.set(Me.targetColorTexture.texture);const Le=H.getOrCreateProgram("rasterParticleDraw",{defines:_e.defines,overrideFog:!1});re.activeTexture.set(Z.TEXTURE0+1);const fe=_e.scalarData?[]:[0,1,2,3].map(we=>a.dX[we](be));fe.push(be);const le=be.canonical.x,xe=be.canonical.y;for(const we of fe){const Se=j.getTile(te?we.wrapped():we);if(!Se)continue;const $e=Se.rasterParticleState;if(!$e)continue;const Ve=we.canonical.x+(1<<we.canonical.z)*(we.wrap-be.wrap),Ne=we.canonical.y;$e.particleTexture0.bind(Z.NEAREST,Z.CLAMP_TO_EDGE);const De=Zm(1,$e.particleTexture0.size[0],[Ve-le,Ne-xe],0,_e.texture.size,2,de,_e.textureOffset,_e.scale,_e.offset);Le.draw(H,Z.POINTS,rt.disabled,st.disabled,ct.alphaBlended,pt.disabled,De,ne.id,$e.particleIndexBuffer,void 0,$e.particleSegment)}}}(_,y,v,V),I.bindFramebuffer.set(v.particleFramebuffer.framebuffer),function(H,j,ne,Y){const re=H.context,Z=re.gl,K=j.paint.get("raster-particle-max-speed"),te=Y*j.paint.get("raster-particle-speed-factor")*.15,de=function(be){return Math.pow(be,6)}(.01+1*j.paint.get("raster-particle-reset-rate-factor")),se=j.particleFramebuffer;re.viewport.set([0,0,se.width,se.height]);for(const be of ne){const[,_e,Me]=be;re.activeTexture.set(Z.TEXTURE0+0),_e.texture.bind(Z.LINEAR,Z.CLAMP_TO_EDGE),re.activeTexture.set(Z.TEXTURE0+1);const Le=Me.particleTexture0;Le.bind(Z.NEAREST,Z.CLAMP_TO_EDGE);const fe=Wm(1,Le.size[0],0,_e.texture.size,K,te,de,_e.textureOffset,_e.scale,_e.offset);se.colorAttachment0.set(Me.particleTexture1.texture),re.clear({color:a.aq.transparent}),H.getOrCreateProgram("rasterParticleUpdate",{defines:_e.defines}).draw(H,Z.TRIANGLES,rt.disabled,st.disabled,ct.unblended,pt.disabled,fe,j.id,H.viewportBuffer,H.quadTriangleIndexBuffer,H.viewportSegments)}}(_,v,V,$)}(l,i,o,u),l.renderPass==="translucent"&&(function(_,y,v,T){const I=_.context,M=I.gl,C=y.getSource().tileSize,D=5*(1-a.aj(a.cq,a.cq+1,_.transform.zoom))*C+v.paint.get("raster-particle-elevation"),F=!_.options.moving,z=_.transform.projection.name==="globe";if(!T.length)return;const[V,N]=_.stencilConfigForOverlap(T),$=[];z&&$.push("PROJECTION_GLOBE_VIEW");const H=_.stencilModeFor3D();for(const j of N){const ne=j.toUnwrapped(),Y=y.getTile(j);if(!Y.rasterParticleState)continue;const re=Y.rasterParticleState,Z=100;Y.registerFadeDuration(Z);const K=y.findLoadedParent(j,0),te=Tl(Y,K,y,_.transform,Z);let de,se;_.terrain&&_.terrain.prepareDrawTile(),I.activeTexture.set(M.TEXTURE0),re.targetColorTexture.bind(M.LINEAR,M.CLAMP_TO_EDGE),I.activeTexture.set(M.TEXTURE1),K&&K.rasterParticleState?(K.rasterParticleState.targetColorTexture.bind(M.LINEAR,M.CLAMP_TO_EDGE),de=Math.pow(2,K.tileID.overscaledZ-Y.tileID.overscaledZ
3254),se=[Y.tileID.canonical.x*de%1,Y.tileID.canonical.y*de%1]):re.targetColorTexture.bind(M.LINEAR,M.CLAMP_TO_EDGE);const be=z?Float32Array.from(_.transform.expandedFarZProjMatrix):_.transform.calculateProjMatrix(ne,F),_e=_.transform,Me=Gh(_e),Le=a.dm(j.canonical),fe=a.dn(Le.getCenter().lat);let le,xe,we,Se,$e;z?(le=Float32Array.from(a.dq(a.dr(j.canonical))),xe=Float32Array.from(_e.globeMatrix),we=Float32Array.from(a.dl(_e)),Se=[a.aH(_e.center.lng),a.aL(_e.center.lat)],$e=Float32Array.from(a.dp(j.canonical,Le,fe,_e.worldSize/_e._pixelsPerMercatorPixel))):(le=new Float32Array(16),xe=new Float32Array(9),we=new Float32Array(16),Se=[0,0],$e=new Float32Array(9));const Ve=Il(be,le,xe,we,$e,se||[0,0],a.al(_.transform.zoom),Se,Me,de||1,te,D),Ne=_.isTileAffectedByFog(j),De=_.getOrCreateProgram("rasterParticle",{defines:$,overrideFog:Ne});if(_.uploadCommonUniforms(I,De,ne),z){const tt=new rt(M.LEQUAL,rt.ReadOnly,_.depthRangeFor3D),ot=0,Ke=_.globeSharedBuffers;if(Ke){const[et,_t,xt]=Ke.getGridBuffers(fe,ot!==0);De.draw(_,M.TRIANGLES,tt,H,ct.alphaBlended,_.renderElevatedRasterBackface?pt.frontCCW:pt.backCCW,Ve,v.id,et,_t,xt)}}else{const tt=_.depthModeForSublayer(0,rt.ReadOnly),ot=V[j.overscaledZ],{tileBoundsBuffer:Ke,tileBoundsIndexBuffer:et,tileBoundsSegments:_t}=_.getTileBoundsBuffers(Y);De.draw(_,M.TRIANGLES,tt,ot,ct.alphaBlended,pt.disabled,Ve,v.id,Ke,et,_t)}}_.resetStencilClippingMasks()}(l,i,o,u),l.style.map.triggerRepaint())},background:function(l,i,o,u){const d=o.paint.get("background-color"),m=o.paint.get("background-color-use-theme").constantOr("default")==="none",_=o.paint.get("background-opacity"),y=o.paint.get("background-emissive-strength"),v=o.paint.get("background-pitch-alignment")==="viewport";if(_===0)return;const T=l.context,I=T.gl,M=l.transform,C=M.tileSize,D=o.paint.get("background-pattern");let F;if(D!==void 0&&(D===null||(F=l.imageManager.getPattern(a.I.from(D.toString()),o.scope,l.style.getLut(o.scope)),!F)))return;const z=!D&&d.a===1&&_===1&&l.opaquePassEnabledForLayer()?"opaque":"translucent";if(l.renderPass!==z)return;const V=st.disabled,N=l.depthModeForSublayer(0,z==="opaque"?rt.ReadWrite:rt.ReadOnly),$=l.colorModeForDrapableLayerRenderPass(y),H=D?"backgroundPattern":"background";let j,ne=u;ne||(j=l.getBackgroundTiles(),ne=Object.values(j).map(re=>re.tileID)),D&&(T.activeTexture.set(I.TEXTURE0),l.imageManager.bind(l.context,o.scope));const Y=[];if(l.terrain&&l.terrain.renderingToTexture&&l.emissiveMode==="mrt-fallback"&&Y.push("USE_MRT1"),v){const re=l.getOrCreateProgram(H,{overrideFog:!1,overrideRtt:!0,defines:Y}),Z=new Float32Array(a.ba([])),K=new a.aS(0,0,0,0,0),te=D?El(Z,y,_,l,0,o.scope,F,v,{tileID:K,tileSize:C}):tu(Z,y,_,d.toPremultipliedRenderColor(m?null:o.lut));return void re.draw(l,I.TRIANGLES,N,V,$,pt.disabled,te,o.id,l.viewportBuffer,l.quadTriangleIndexBuffer,l.viewportSegments)}for(const re of ne){const Z=l.isTileAffectedByFog(re),K=l.getOrCreateProgram(H,{overrideFog:Z,defines:Y}),te=re.toUnwrapped(),de=u?re.projMatrix:l.transform.calculateProjMatrix(te);l.prepareDrawTile();const se=i?i.getTile(re):j?j[re.key]:new a.b1(re,C,M.zoom,l),be=D?El(de,y,_,l,0,o.scope,F,v,{tileID:re,tileSize:C}):tu(de,y,_,d.toPremultipliedRenderColor(m?null:o.lut));l.uploadCommonUniforms(T,K,te);const{tileBoundsBuffer:_e,tileBoundsIndexBuffer:Me,tileBoundsSegments:Le}=l.getTileBoundsBuffers(se);K.draw(l,I.TRIANGLES,N,V,$,pt.disabled,be,o.id,_e,Me,Le)}},sky:function(l,i,o){const u=l._atmosphere?a.al(l.transform.zoom):1,d=o.paint.get("sky-opacity")*u;if(d===0)return;const m=l.context,_=o.paint.get("sky-type"),y=new rt(m.gl.LEQUAL,rt.ReadOnly,[0,1]),v=l.frameCounter/1e3%1;_==="atmosphere"?l.renderPass==="offscreen"?o.needsSkyboxCapture(l)&&(function(T,I){const M=T.context,C=M.gl;let D=I.skyboxFbo;if(!D){D=I.skyboxFbo=M.createFramebuffer(32,32,1,null),I.skyboxGeometry=new uu(M),I.skyboxTexture=M.gl.createTexture(),C.bindTexture(C.TEXTURE_CUBE_MAP,I.skyboxTexture),C.texParameteri(C.TEXTURE_CUBE_MAP,C.TEXTURE_WRAP_S,C.CLAMP_TO_EDGE),C.texParameteri(C.TEXTURE_CUBE_MAP,C.TEXTURE_WRAP_T,C.CLAMP_TO_EDGE),C.texParameteri(C.TEXTURE_CUBE_MAP,C.TEXTURE_MIN_FILTER,C.LINEAR),C.texParameteri(C.TEXTURE_CUBE_MAP,C.TEXTURE_MAG_FILTER,C.LINEAR);for(let N=0;N<6;++N)C.texImage2D(C.TEXTURE_CUBE_MAP_POSITIVE_X+N,0,C.RGBA,32,32,0,C.RGBA,C.UNSIGNED_BYTE,null)}M.bindFramebuffer.set(D.framebuffer),M.viewport.set([0,0,32,32]);const F=I.getCenter(T,!0),z=T.getOrCreateProgram("skyboxCapture"),V=new Float64Array(16);a.ba(V),a.eb(V,V,.5*-Math.PI),pr(T,I,z,V,F,0),a.ba(V),a.eb(V,V,.5*Math.PI),pr(T,I,z,V,F,1),a.ba(V),a.cz(V,V,.5*-Math.PI),pr(T,I,z,V,F,2),a.ba(V),a.cz(V,V,.5*Math.PI),pr(T,I,z,V,F,3),a.ba(V),pr(T,I,z,V,F,4),a.ba(V),a.eb(V,V,Math.PI),pr(T,I,z,V,F,5),M.viewport.set([0,0,T.width,T.height])}(l,o),o.markSkyboxValid(l)):l.renderPass==="sky"&&function(T,I,M,C,D){const F=T.context,z
3254=F.gl,V=T.transform,N=T.getOrCreateProgram("skybox");F.activeTexture.set(z.TEXTURE0),z.bindTexture(z.TEXTURE_CUBE_MAP,I.skyboxTexture);const $=((H,j,ne,Y,re)=>({u_matrix:H,u_sun_direction:j,u_cubemap:0,u_opacity:Y,u_temporal_offset:re}))(V.skyboxMatrix,I.getCenter(T,!1),0,C,D);T.uploadCommonUniforms(F,N),N.draw(T,z.TRIANGLES,M,st.disabled,T.colorModeForRenderPass(),pt.backCW,$,"skybox",I.skyboxGeometry.vertexBuffer,I.skyboxGeometry.indexBuffer,I.skyboxGeometry.segment)}(l,o,y,d,v):_==="gradient"&&l.renderPass==="sky"&&function(T,I,M,C,D){const F=T.context,z=F.gl,V=T.transform,N=T.getOrCreateProgram("skyboxGradient");I.skyboxGeometry||(I.skyboxGeometry=new uu(F)),F.activeTexture.set(z.TEXTURE0);let $=I.colorRampTexture;$||($=I.colorRampTexture=new a.T(F,I.colorRamp,z.RGBA8)),$.bind(z.LINEAR,z.CLAMP_TO_EDGE);const H=((j,ne,Y,re,Z)=>({u_matrix:j,u_color_ramp:0,u_center_direction:ne,u_radius:a.ap(Y),u_opacity:re,u_temporal_offset:Z}))(V.skyboxMatrix,I.getCenter(T,!1),I.paint.get("sky-gradient-radius"),C,D);T.uploadCommonUniforms(F,N),N.draw(T,z.TRIANGLES,M,st.disabled,T.colorModeForRenderPass(),pt.backCW,H,"skyboxGradient",I.skyboxGeometry.vertexBuffer,I.skyboxGeometry.indexBuffer,I.skyboxGeometry.segment)}(l,o,y,d,v)},custom:function(l,i,o,u){const d=l.context,m=o.implementation;if(!l.transform.projection.unsupportedLayers||!l.transform.projection.unsupportedLayers.includes("custom")||l.terrain&&(l.terrain.renderingToTexture||l.renderPass==="offscreen")&&o.isDraped(i)){if(l.renderPass==="offscreen"){const _=m.prerender;if(_){if(l.setCustomLayerDefaults(),d.setColorMode(l.colorModeForRenderPass()),l.transform.projection.name==="globe"){const y=l.transform.pointMerc;_.call(m,d.gl,l.transform.customLayerMatrix(),l.transform.getProjection(),l.transform.globeToMercatorMatrix(),a.al(l.transform.zoom),[y.x,y.y],l.transform.pixelsPerMeterRatio)}else _.call(m,d.gl,l.transform.customLayerMatrix());d.setDirty(),l.setBaseState()}}else if(l.renderPass==="translucent"){if(l.terrain&&l.terrain.renderingToTexture){const y=m.renderToTile;if(y){const v=u[0].canonical,T={x:v.x+u[0].wrap*(m.wrapTileId?0:1<<v.z),y:v.y,z:v.z};d.setDepthMode(rt.disabled),d.setStencilMode(st.disabled),d.setColorMode(l.colorModeForRenderPass()),l.setCustomLayerDefaults(),y.call(m,d.gl,T),d.setDirty(),l.setBaseState()}return}l.setCustomLayerDefaults(),d.setColorMode(l.colorModeForRenderPass()),d.setStencilMode(st.disabled);const _=m.renderingMode==="3d"?new rt(l.context.gl.LEQUAL,rt.ReadWrite,l.depthRangeFor3D):l.depthModeForSublayer(0,rt.ReadOnly);if(d.setDepthMode(_),l.transform.projection.name==="globe"){const y=l.transform.pointMerc;m.render(d.gl,l.transform.customLayerMatrix(),l.transform.getProjection(),l.transform.globeToMercatorMatrix(),a.al(l.transform.zoom),[y.x,y.y],l.transform.pixelsPerMeterRatio)}else m.render(d.gl,l.transform.customLayerMatrix());d.setDirty(),l.setBaseState(),d.bindFramebuffer.set(null)}}else a.w("Custom layers are not yet supported with this projection. Use mercator or globe to enable usage of custom layers.")},model:function(l,i,o,u){if(l.renderPass==="opaque")return;const d=o.paint.get("model-opacity").constantOr(1),m=o.paint.get("model-elevation-reference"),_=m==="ground",y=m==="ground";if(d===0)return;const v=o.paint.get("model-cast-shadows");if(l.renderPass==="shadow"&&(!v||l.terrain&&d<.65&&o._transitionablePaint._values["model-opacity"].value.expression instanceof a.af))return;const T=l.shadowRenderer,I=o.paint.get("model-receive-shadows");T&&(T.useNormalOffset=!0,I||(T.enabled=!1));const M=()=>{T&&(T.useNormalOffset=!0,I||(T.enabled=!0))},C=i.getSource();if(l.renderPass==="light-beam"&&C.type!=="batched-model")return;if(C.type==="vector"||C.type==="geojson")return function(j,ne,Y,re,Z){const K=j.transform,te=K.projection.name==="globe",de=K.getFreeCameraOptions().position;if(!j.modelManager)return;const se=j.modelManager;Y.modelManager=se;const be=j.shadowRenderer;if(!Y._unevaluatedLayout._values.hasOwnProperty("model-id"))return;const _e=Y._unevaluatedLayout._values["model-id"],Me=Object.assign({},Y.layout.get("model-id").parameters),Le=j.style.order.indexOf(Y.fqid),fe=Y.paint.get("model-opacity").constantOr(1);for(const le of re){const xe=ne.getTile(le).getBucket(Y);if(!xe||xe.projection.name!==K.projection.name)continue;const we=xe.getModelUris();if(we&&!xe.modelsRequested&&(se.addModelsFromBucket(we,Z),xe.modelsRequested=!0),te)Me.zoom=le.overscaledZ;else{const Ke=Ge(le,K);Me.zoom=Ke}const Se=_e.possiblyEvaluate(Me);if(rs(j,xe,le),ke.shadowUniformsInitialized=!1,ke.useSingleShadowCascade=!!be&&be.getMaxCascadeForTile(le.toUnwrapped())===0,j.renderPass==="shadow"&&be){if(j.currentShadowCascade===1&&xe.isInsideFirstShadowMapFrustum)continue;const Ke=K.calculatePosMatrix(le.toUnwrapped(),K.worldSize);if(ke.tileMatrix.set(Ke),ke.shadowTileMatrix=Float32Array.from(be.calculateShadowPassMatrixFromMatr
3254ix(Ke)),ke.aabb.min=[0,0,0],ke.aabb.max[0]=ke.aabb.max[1]=a.an,ke.aabb.max[2]=0,ue(xe,ke,j,Y.scope))continue}const $e=1<<le.canonical.z,Ve=[((de.x-le.wrap)*$e-le.canonical.x)*a.an,(de.y*$e-le.canonical.y)*a.an,de.z*$e*a.an];j.conflationActive&&Object.keys(xe.instancesPerModel).length>0&&j.style.isLayerClipped(Y,ne.getSource())&&xe.updateReplacement(le,j.replacementSource,Le,Y.scope)&&(xe.uploaded=!1,xe.upload(j.context));let Ne=0;const De=new Array,tt=new Array,ot=new Array;for(let Ke in xe.instancesPerModel){const et=xe.instancesPerModel[Ke];et.features.length>0&&!te&&(Ke=Se.evaluate(et.features[0].feature,{}));const _t=se.getModel(Ke,Z);if(_t||se.hasURLBeenRequested(Ke)||xe.modelUris.includes(Ke)||(xe.modelUris.push(Ke),xe.modelsRequested=!1),_t&&_t.uploaded)if(te){const xt=a.bK([],[de.x,de.y,de.z],j.transform.worldSize);a.ek(xt,xt);for(let gt=0;gt<et.instancedDataArray.length;++gt){const At=[0,0,0],ft=[1,1,1],Ct=a.el(),yt=et.tileCoordinatesForInstance(gt),kt=et.transformForInstance(gt);a.em(ft,kt),a.en(Ct,kt),a.eo(At,Ct);const ti=et.translationForInstance(gt),wi=new a.aV(0,0);a.ep(xe.canonical,wi,yt.x,yt.y);const si=a.bc();a.eq(si,_t,j.transform,wi,At,ft,ti,!0,!1,!1);const Gt=et.colorForInstance(gt),It=a.ba([]),Et=a.d_(wi.lat,j.transform.zoom),ai=a.bQ([],[1,1,1/Et]);a.by(It,It,xt),ot.push({zScaleMatrix:ai,negCameraPosMatrix:It});for(const Ii of _t.nodes)Dl(j,Ii,si,j.transform.expandedFarZProjMatrix,Ne,De,tt,_t.materialOverrides,fe,Gt);++Ne}}else for(const xt of _t.nodes)Ls(j,Y,xt,et,Ve,le,ke)}if(te)if(j.renderPass==="shadow"){for(const Ke of tt)Ra(Ke.mesh,Ke.nodeModelMatrix,j,Y);for(const Ke of De)Ra(Ke.mesh,Ke.nodeModelMatrix,j,Y)}else is(j,Y,De,tt,ot)}}(l,i,o,u,Pl(l,o)),void M();if(!C.loaded())return;if(C.type==="batched-model")return function(j,ne,Y,re){Y.resetLayerRenderingStats(j);const Z=j.context,K=j.transform,te=j.style.fog,de=j.shadowRenderer;if(K.projection.name!=="mercator")return void a.w(`Drawing 3D landmark models for ${K.projection.name} projection is not yet implemented`);const se=j.transform.getFreeCameraOptions().position,be=a.bK([],[se.x,se.y,se.z],j.transform.worldSize),_e=a.ek([],be),Me=a.ba([]),Le=a.d_(K.center.lat,K.zoom),fe=a.bQ([],[1,1,1/Le]);a.by(Me,Me,_e);const le=Y.paint.get("model-opacity").constantOr(1),xe=new rt(Z.gl.LEQUAL,rt.ReadWrite,j.depthRangeFor3D),we=new rt(Z.gl.LEQUAL,rt.ReadOnly,j.depthRangeFor3D),Se=new a.cQ([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),$e=j.renderPass==="shadow",Ve=$e&&de?de.getCurrentCascadeFrustum():K.getFrustum(K.scaleZoom(K.worldSize)),Ne=Y.paint.get("model-front-cutoff"),De=Ne[2]<1,tt=no(j,Y.paint.get("model-cutoff-fade-range")),ot=Y.getLayerRenderingStats();(function(Ke,et,_t,xt){const gt=Ke.terrain?Ke.terrain.exaggeration():0,At=Ke.transform.zoom;for(const ft of xt){const Ct=et.getTile(ft).getBucket(_t);Ct&&(Ct.setFilter(_t.filter),Ke.conflationActive&&Ct.updateReplacement(ft,Ke.replacementSource),Ct.evaluateTransform(Ke,_t),Ke.terrain&&gt>0&&Ct.elevationUpdate(Ke.terrain,gt,ft,_t.source),Ct.needsReEvaluation(Ke,At,_t)&&Ct.evaluate(_t))}})(j,ne,Y,re),function(){const Ke=new Map;let et,_t,xt;De?(et=re.length-1,_t=-1,xt=-1):(et=0,_t=re.length,xt=1);const gt=new Float64Array(16),At=a.cf(),ft=new a.P(0,0);for(let Ct=et;Ct!==_t;Ct+=xt){const yt=re[Ct],kt=ne.getTile(yt).getBucket(Y);if(!kt||!kt.uploaded)continue;let ti=!1;de&&(ti=de.getMaxCascadeForTile(yt.toUnwrapped())===0);const wi=K.calculatePosMatrix(yt.toUnwrapped(),K.worldSize),si=kt.modelTraits;!$e&&De&&(a.b8(gt,wi),a.ah(At,be,gt),ft.x=At[0],ft.y=At[1]);const Gt=[];kt.setFilter(Y.filter);for(const It of kt.getNodesInfo()){if(It.hiddenByReplacement||!It.node.meshes)continue;const Et=It.node;let ai=0;j.terrain&&Et.elevation&&(ai=Et.elevation*j.terrain.exaggeration());const Ii=(()=>{const mr=It.aabb;return Se.min=[...mr.min],Se.max=[...mr.max],Se.min[2]+=ai,Se.max[2]+=ai,a.ah(Se.min,Se.min,wi),a.ah(Se.max,Se.max,wi),Se})(),qt=It.evaluatedScale;if(qt[0]<=1&&qt[1]<=1&&qt[2]<=1&&Ii.intersects(Ve)===0)continue;if(!$e&&De){const mr=.16666666666666666;It.cameraCollisionOpacity=be[0]>Ii.min[0]&&be[0]<Ii.max[0]&&be[1]>Ii.min[1]&&be[1]<Ii.max[1]&&be[2]*Le<Ii.max[2]&&Et.footprint&&a.bD(ft,Et.footprint)?Math.max(It.cameraCollisionOpacity-mr,0):Math.min(1,It.cameraCollisionOpacity+mr)}const bt=[...wi],gi=1/a.cO(yt.canonical),ii=Et.anchor?Et.anchor[0]:0,Wi=Et.anchor?Et.anchor[1]:0;a.by(bt,bt,[ii*(qt[0]-1)+It.evaluatedTranslation[0]*gi,Wi*(qt[1]-1)+It.evaluatedTranslation[1]*gi,ai+It.evaluatedTranslation[2]]),a.c5(qt,a.es)||a.cx(bt,bt,qt);const Rt=a.aD([],bt,Et.globalMatrix),ni=a.aD([],K.expandedFarZProjMatrix,Rt),Qi=a.aD([],K.expandedFarZProjMatrix,bt),Er=a.aE([],[ii,Wi,ai,1],ni)[2];Et.hidden=!1;let rr=le;$e||(De&&(rr*=It.cameraCollisionOpacity,rr*=hu(bt,K,It.aabb,Ne)),rr*=ip(tt,Er)),rr!==0?Gt.push({nodeInfo:It,depth:Er,o
3254pacity:rr,wvpForNode:ni,wvpForTile:Qi,nodeModelMatrix:Rt,tileModelMatrix:bt}):Et.hidden=!0}$e||Gt.sort((It,Et)=>!De||It.opacity===1&&Et.opacity===1?It.depth<Et.depth?-1:1:It.opacity===1?-1:Et.opacity===1?1:It.depth>Et.depth?-1:1);for(const It of Gt){const Et=It.nodeInfo,ai=Et.node;if(j._debugParams.show3DModelFootprints&&ai.footprint){const Rt=ai.id||ai.name||"footprint";Ke.has(Rt)||Ke.set(Rt,{node:ai,mvp:It.wvpForTile})}let Ii=a.aD([],fe,It.tileModelMatrix);a.aD(Ii,Me,Ii);const qt=a.b8([],Ii);a.e2(qt,qt),a.cx(qt,qt,Ci),Ii=a.aD(Ii,Ii,ai.globalMatrix);const bt=j.renderPass==="light-beam",gi=Y.paint.get("model-color-use-theme").constantOr("default")==="none",ii=si&a.ev.HasMapboxMeshFeatures,Wi=ii?0:Et.evaluatedRMEA[0][2];for(let Rt=0;Rt<ai.meshes.length;++Rt){const ni=ai.meshes[Rt],Qi=Rt===ai.lightMeshIndex;let Er=It.wvpForNode;if(Qi){if(!bt&&!j.terrain&&j.shadowRenderer){j.currentLayer<j.firstLightBeamLayer&&(j.firstLightBeamLayer=j.currentLayer);continue}Er=It.wvpForTile}else if(bt)continue;const rr={defines:[]},mr=[];if(!$e&&de&&(de.useNormalOffset=!!ni.normalBuffer),Yh(rr.defines,mr,ni,j,gi?null:Y.lut),ii||rr.defines.push("DIFFUSE_SHADED"),ti&&rr.defines.push("SHADOWS_SINGLE_CASCADE"),ot&&($e?ot.numRenderedVerticesInShadowPass+=ni.vertexArray.length:ot.numRenderedVerticesInTransparentPass+=ni.vertexArray.length),$e){Ra(ni,It.nodeModelMatrix,j,Y);continue}let an=null;if(te){const Qt=lo(It.nodeModelMatrix,j.transform);if(an=new Float32Array(Qt),K.projection.name!=="globe"){const qi=ni.aabb.min,Pr=ni.aabb.max,[zi,ln]=te.getOpacityForBounds(Qt,qi[0],qi[1],Pr[0],Pr[1]);rr.overrideFog=zi>=vt||ln>=vt}}const Xt=ni.material;let xn;Xt.occlusionTexture&&Xt.occlusionTexture.offsetScale&&(xn=Xt.occlusionTexture.offsetScale,rr.defines.push("OCCLUSION_TEXTURE_TRANSFORM"));const vn=j.getOrCreateProgram("model",rr);!$e&&de&&de.setupShadowsFromMatrix(It.tileModelMatrix,vn,de.useNormalOffset),j.uploadCommonUniforms(Z,vn,null,an);const ci=Xt.pbrMetallicRoughness;ci.metallicFactor=.9,ci.roughnessFactor=.5;const ui=Ia(new Float32Array(Er),new Float32Array(Ii),new Float32Array(qt),new Float32Array(ai.globalMatrix),j,It.opacity,ci.baseColorFactor,Xt.emissiveFactor,ci.metallicFactor,ci.roughnessFactor,Xt,Wi,Y,[0,0,0],xn);!Qi&&(Et.hasTranslucentParts||It.opacity<1)&&vn.draw(j,Z.gl.TRIANGLES,xe,st.disabled,ct.disabled,pt.backCCW,ui,Y.id,ni.vertexBuffer,ni.indexBuffer,ni.segments,Y.paint,j.transform.zoom,void 0,mr),vn.draw(j,Z.gl.TRIANGLES,Qi?we:xe,st.disabled,Qi||It.opacity<1||Et.hasTranslucentParts?ct.alphaBlended:ct.unblended,pt.backCCW,ui,Y.id,ni.vertexBuffer,ni.indexBuffer,ni.segments,Y.paint,j.transform.zoom,void 0,mr)}}}if(j._debugParams.show3DModelFootprints&&Ke.size>0){const Ct=Array.from(Ke.keys()).sort();for(const yt of Ct){const{node:kt,mvp:ti}=Ke.get(yt);Kh(j,0,kt,ti)}}}()}(l,i,o,u),void M();if(C.type!=="model")return;const D=C.getModels(),F=[],z=l.transform.getFreeCameraOptions().position,V=a.bK([],[z.x,z.y,z.z],l.transform.worldSize);a.ek(V,V);const N=[],$=[];let H=0;for(const j of D){const ne=i.getFeatureState("",j.id),Y={type:"Unknown",id:j.id,properties:j.featureProperties},re=o.paint.get("model-rotation").evaluate(Y,ne),Z=o.paint.get("model-scale").evaluate(Y,ne),K=o.paint.get("model-translation").evaluate(Y,ne),te=o.paint.get("model-opacity").evaluate(Y,ne);tp(o,j.id,ne,j.featureProperties,j.nodeOverrideNames,j.nodeOverrides),Qh(o,j.id,ne,j.featureProperties,j.materialOverrideNames,j.materialOverrides),j.nodeOverrides.size>0&&j.computeBoundsAndApplyParent(),j.computeModelMatrix(l,re,Z,K,y,_,!1);const de=a.ba([]),se=a.d_(j.position.lat,l.transform.zoom),be=a.bQ([],[1,1,1/se]);a.by(de,de,V),F.push({zScaleMatrix:be,negCameraPosMatrix:de});for(const _e of j.nodes)Dl(l,_e,j.matrix,l.transform.expandedFarZProjMatrix,H,N,$,j.materialOverrides,te);H++}if(N.sort((j,ne)=>ne.depth-j.depth),l.renderPass!=="shadow"){if(l._debugParams.show3DModelFootprints){const j=l.transform.projMatrix,ne=new Map,Y=(Z,K)=>{if(Z.footprint){const te=Z.id||Z.name||"footprint";if(!ne.has(te)){const de=a.aD([],j,K);ne.set(te,{node:Z,mvp:de})}}};for(const Z of $)Y(Z.node,Z.modelMatrix);for(const Z of N)Y(Z.node,Z.modelMatrix);const re=Array.from(ne.keys()).sort();for(const Z of re){const{node:K,mvp:te}=ne.get(Z);Kh(l,0,K,te)}}is(l,o,N,$,F),M()}else{for(const j of $)Ra(j.mesh,j.nodeModelMatrix,l,o);for(const j of N)Ra(j.mesh,j.nodeModelMatrix,l,o);M()}}},td={line:function(l,i,o){if(l.hasElevatedBuckets=!1,l.hasNonElevatedBuckets=!1,l._unevaluatedLayout.getValue("line-elevation-reference")!==void 0||l._unevaluatedLayout.getValue("line-z-offset")!==void 0){if(i){const u=i.getVisibleCoordinates();for(const d of u){const m=i.getTile(d).getBucket(l);if(m&&(m.elevationType!=="none"?l.hasElevatedBuckets=!0:l.hasNonElevatedBuckets=!0,l.hasElevatedBuckets&&l.hasNonElevatedBuckets))break}}}else l.hasNonElevatedBuckets=!0},model:function(l,i,o){const u=i.getSource();if(!u.loaded())return;if(u.type==="vector"||u.type==="geojson")return void(o.modelManager&&o.modelManager.upload(o,Pl(o,l)));if(u.type==="batched-model"||u.type!=="model")return;const d=u.getModels();for(const m of d)m.upload(o.context)},raster:function(l,i,o){const u=i.getSource();if(!(u instanceof Ho&&u.loaded()))return;const d=l.sourceLayer||u.rasterLayerIds&&u.rasterLayerIds[0];if(!d)return;const m=l.paint.get("raster-array-band")||u.getInitialBand(d);if(m==null)return;const _=i.getIds().map(y=>i.getTileByID(y));for(const y of _)y.updateNeeded(l.id,m)&&u.prepareTile(y,d,l.id,m)},"raster-particle":function(l,i,o){const u=i.getSource();if(!(u instanceof Ho&&u.loaded()))return;const d=l.sourceLayer||u.rasterLayerIds&&u.rasterLayerIds[0];if(!d)return;const m=l.paint.get("raster-particle-array-band")||u.getInitialBand(d);if(m==null)return;const _=i.getIds().map(y=>i.getTileByID(y));for(const y of _)y.updateNeeded(l.id,m)&&u.prepareTile(y,d,l.id,m)}},id={fill:kh},rd={fill:function(l,i,o,u){if(!o.layout||o.layout.get("fill-elevation-reference")==="none"||o.paint.get("fill-opacity").constantOr(1)===0)return;const d=l.context.gl,m=new rt(d.LEQUAL,rt.ReadOnly,l.depthRangeFor3D),_=new st({func:d.ALWAYS,mask:255},255,255,d.KEEP,d.KEEP,d.REPLACE),y=l.transform.getFreeCameraOptions().position,v=l.getOrCreateProgram("elevatedStructuresDepthReconstruct");for(const T of u){const I=i.getTile(T),M=I.getBucket(o);if(!M)continue;const C=M.elevatedStructures;if(!C||C.depthSegments.segments[0].primitiveLength===0)continue;const D=Bh(T.toUnwrapped(),y),F=l.translatePosMatrix(T.projMatrix,I,o.paint.get("fill-translate"),o.paint.get("fill-translate-anchor")),z=Sl(F,D,0,1,0);v.draw(l,d.TRIANGLES,m,_,ct.disabled,pt.disabled,z,o.id,C.vertexBuffer,C.indexBuffer,C.depthSegments,o.paint,l.transform.zoom)}}};class r_{constructor(i,o,u,d,m){this.context=new Xm(i,o),this.transform=u,this._tileTextures={},this.frameCopies=[],this.loadTimeStamps=[],this._timeStamp=a.o.now(),this._averageFPS=0,this._fpsHistory=[],this._dt=0,this._debugParams={forceEnablePrecipitation:!1,showTerrainProxyTiles:!1,fpsWindow:30,continousRedraw:!1,show3DModelFootprints:!1,enabledLayers:{}};const _=["fill","line","symbol","circle","heatmap","fill-extrusion","building","raster","raster-particle","hillshade","model","background","sky"];for(const v of _)this._debugParams.enabledLayers[v]=!0;for(const v of _);this.occlusionParams=new rp,this.setup(),this.numSublayers=pn.maxUnderzooming+pn.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.deferredRenderGpuTimeQueries=[],this.gpuTimers={},this.frameCounter=0,this._backgroundTiles={},this.conflationActive=!1,this.replacementSource=new a.eC,this.longestCutoffRange=0,this.minCutoffZoom=0,this._fogVisible=!1,this._cachedTileFogOpacities={},this._shadowRenderer=new xf(this),this._wireframeDebugCache=new du,this.renderDefaultNorthPole=!0,this.renderDefaultSouthPole=!0,this.layersWithOcclusionOpacity=[];const y=new a.q({width:1,height:1},Uint8Array.of(0,0,0,0));
3254this.emptyDepthTexture=new a.T(this.context,y,i.RGBA8),this._clippingActiveLastFrame=!1,this.scaleFactor=d,this.maxFrontCutoffRawStart=0,this.worldview=m,this._forceEmissiveMode=!1,this.emissiveMode="constant"}updateTerrain(i,o){const u=!!i&&!!i.terrain&&this.transform.projection.supportsTerrain;if(!(u||this._terrain&&this._terrain.enabled))return;this._terrain||(this._terrain=new Zc(this,i));const d=this._terrain;this.transform.elevation=u?d:null,d.update(i,this.transform,o),this.transform.elevation&&!d.enabled&&(this.transform.elevation=null)}_updateFog(i){const o=i.fog;if(!o||this.transform.projection.name==="globe"||o.getOpacity(this.transform.pitch)<1||o.properties.get("horizon-blend")<.03)return void(this.transform.fogCullDistSq=null);const[u,d]=o.getFovAdjustedRange(this.transform._fov);if(u>d)return void(this.transform.fogCullDistSq=null);const m=u+.78*(d-u);this.transform.fogCullDistSq=m*m}get terrain(){return this.transform._terrainEnabled()&&this._terrain&&this._terrain.enabled||this._forceTerrainMode?this._terrain:null}get forceTerrainMode(){return this._forceTerrainMode}set forceTerrainMode(i){i&&!this._terrain&&(this._terrain=new Zc(this,this.style)),this._forceTerrainMode=i}get shadowRenderer(){return this._shadowRenderer&&this._shadowRenderer.enabled?this._shadowRenderer:null}get wireframeDebugCache(){return this._wireframeDebugCache}resize(i,o){if(this.width=i*a.o.devicePixelRatio,this.height=o*a.o.devicePixelRatio,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const u of this.style.order)this.style._mergedLayers[u].resize()}setup(){const i=this.context,o=new a.dx;o.emplaceBack(0,0),o.emplaceBack(a.an,0),o.emplaceBack(0,a.an),o.emplaceBack(a.an,a.an),this.tileExtentBuffer=i.createVertexBuffer(o,a.dt.members),this.tileExtentSegments=a.du.simpleSegment(0,0,4,2);const u=new a.dx;u.emplaceBack(0,0),u.emplaceBack(a.an,0),u.emplaceBack(0,a.an),u.emplaceBack(a.an,a.an),this.debugBuffer=i.createVertexBuffer(u,a.dt.members),this.debugSegments=a.du.simpleSegment(0,0,4,5);const d=new a.dx;d.emplaceBack(-1,-1),d.emplaceBack(1,-1),d.emplaceBack(-1,1),d.emplaceBack(1,1),this.viewportBuffer=i.createVertexBuffer(d,a.dt.members),this.viewportSegments=a.du.simpleSegment(0,0,4,2);const m=new a.eD;m.emplaceBack(0,0,0,0),m.emplaceBack(a.an,0,a.an,0),m.emplaceBack(0,a.an,0,a.an),m.emplaceBack(a.an,a.an,a.an,a.an),this.mercatorBoundsBuffer=i.createVertexBuffer(m,a.eE.members),this.mercatorBoundsSegments=a.du.simpleSegment(0,0,4,2);const _=new a.dy;_.emplaceBack(0,1,2),_.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=i.createIndexBuffer(_);const y=new a.eF;for(const T of[0,1,3,2,0])y.emplaceBack(T);this.debugIndexBuffer=i.createIndexBuffer(y),this.emptyTexture=new a.T(i,new a.q({width:1,height:1},Uint8Array.of(0,0,0,0)),i.gl.RGBA8),this.identityMat=a.bc();const v=this.context.gl;this.stencilClearMode=new st({func:v.ALWAYS,mask:0},0,255,v.ZERO,v.ZERO,v.ZERO),this.loadTimeStamps.push(performance.now())}getMercatorTileBoundsBuffers(){return{tileBoundsBuffer:this.mercatorBoundsBuffer,tileBoundsIndexBuffer:this.quadTriangleIndexBuffer,tileBoundsSegments:this.mercatorBoundsSegments}}getTileBoundsBuffers(i){return i._makeTileBoundsBuffers(this.context,this.transform.projection),i._tileBoundsBuffer?{tileBoundsBuffer:i._tileBoundsBuffer,tileBoundsIndexBuffer:i._tileBoundsIndexBuffer,tileBoundsSegments:i._tileBoundsSegments}:this.getMercatorTileBoundsBuffers()}clearStencil(){const i=this.context.gl;this.nextStencilID=1,this.currentStencilSource=void 0,this._tileClippingMaskIDs={},this.getOrCreateProgram("clippingMask").draw(this,i.TRIANGLES,rt.disabled,this.stencilClearMode,ct.disabled,pt.disabled,wl(this.identityMat),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}resetStencilClippingMasks(){this.terrain||(this.currentStencilSource=void 0,this._tileClippingMaskIDs={})}_renderTileClippingMasks(i,o,u){if(!o||this.currentStencilSource===o.id||!i.isTileClipped()||!u||u.length===0)return;if(this._tileClippingMaskIDs&&!this.terrain){let y=!1;for(const v of u)if(this._tileClippingMaskIDs[v.key]===void 0){y=!0;break}if(!y)return}this.currentStencilSource=o.id;const d=this.context,m=d.gl;this.nextStencilID+u.length>256&&this.clearStencil(),d.setColorMode(ct.disabled),d.setDepthMode(rt.disabled);const _=this.getOrCreateProgram("clippingMask");this._tileClippingMaskIDs={};for(const y of u){const v=o.getTile(y),T=this._tileClippingMaskIDs[y.key]=this.nextStencilID++,{tileBoundsBuffer:I,tileBoundsIndexBuffer:M,tileBoundsSegments:C}=this.getTileBoundsBuffers(v);_.draw(this,m.TRIANGLES,rt.disabled,new st({func:m.ALWAYS,mask:0},T,255,m.KEEP,m.KEEP,m.REPLACE),ct.disabled,pt.disabled,wl(y.projMatrix),"$clipping",I,M,C)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const i=this.nextStencilID++,o=this.context.gl;return new st({func:o.NOTEQUAL,mask:255},i,255,o.KEEP,o.KEEP,o.REPLACE)}stencilModeForClipping(i){if(this.terrain)return this.terrain.stencilModeForRTTOverlap(i);const o=this.context.gl;return new st({func:o.EQUAL,mask:255},this._tileClippingMaskIDs[i.key],0,o.KEEP,o.KEEP,o.REPLACE)}stencilConfigForOverlap(i){const o=this.context.gl,u=i.sort((_,y)=>
3254y.overscaledZ-_.overscaledZ),d=u[u.length-1].overscaledZ,m=u[0].overscaledZ-d+1;if(m>1){this.currentStencilSource=void 0,this.nextStencilID+m>256&&this.clearStencil();const _={};for(let y=0;y<m;y++)_[y+d]=new st({func:o.GEQUAL,mask:255},y+this.nextStencilID,255,o.KEEP,o.KEEP,o.REPLACE);return this.nextStencilID+=m,[_,u]}return[{[d]:st.disabled},u]}colorModeForRenderPass(){const i=this.context.gl;return this._showOverdrawInspector?new ct([i.CONSTANT_COLOR,i.ONE,i.CONSTANT_COLOR,i.ONE],new a.aq(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?ct.unblended:ct.alphaBlended}colorModeForDrapableLayerRenderPass(i){const o=this.context.gl;return this.style&&this.style.enable3dLights()&&this.terrain&&this.terrain.renderingToTexture&&this.renderPass==="translucent"?i!=null&&this.emissiveMode!=="mrt-fallback"||this.emissiveMode==="constant"?new ct([o.ONE,o.ONE_MINUS_SRC_ALPHA,o.CONSTANT_ALPHA,o.ONE_MINUS_SRC_ALPHA],new a.aq(0,0,0,i??0),[!0,!0,!0,!0]):this.emissiveMode==="dual-source-blending"?new ct([o.ONE,o.ONE_MINUS_SRC_ALPHA,this.context.extBlendFuncExtended.SRC1_ALPHA_WEBGL,o.ONE_MINUS_SRC_ALPHA],a.aq.transparent,[!0,!0,!0,!0]):this.colorModeForRenderPass():this.colorModeForRenderPass()}depthModeForSublayer(i,o,u,d=!1){if(this.depthOcclusion)return new rt(this.context.gl.GREATER,rt.ReadOnly,this.depthRangeFor3D);if(!this.opaquePassEnabledForLayer()&&!d)return rt.disabled;const m=1-((1+this.currentLayer)*this.numSublayers+i)*this.depthEpsilon;return new rt(u||this.context.gl.LEQUAL,o,[m,m])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}blitDepth(){const i=this.context.gl,o=Math.ceil(this.width),u=Math.ceil(this.height),d=this.context.bindFramebuffer.get(),m=i.getParameter(i.TEXTURE_BINDING_2D);this.depthFBO&&this.depthFBO.width===o&&this.depthFBO.height===u||(this.depthFBO&&(this.depthFBO.destroy(),this.depthFBO=void 0,this.depthTexture=void 0),o!==0&&u!==0&&(this.depthFBO=new Aa(this.context,o,u,0,"texture"),this.depthTexture=new a.T(this.context,{width:o,height:u,data:null},i.DEPTH24_STENCIL8),this.depthFBO.depthAttachment.set(this.depthTexture.texture))),this.context.bindFramebuffer.set(d),i.bindTexture(i.TEXTURE_2D,m),this.depthFBO&&(i.bindFramebuffer(i.READ_FRAMEBUFFER,null),i.bindFramebuffer(i.DRAW_FRAMEBUFFER,this.depthFBO.framebuffer),i.blitFramebuffer(0,0,o,u,0,0,o,u,i.DEPTH_BUFFER_BIT,i.NEAREST),i.bindFramebuffer(i.FRAMEBUFFER,this.context.bindFramebuffer.current))}updateAverageFPS(){this._fpsHistory.push(this._dt===0?0:1e3/this._dt),this._fpsHistory.length>this._debugParams.fpsWindow&&this._fpsHistory.splice(0,this._fpsHistory.length-this._debugParams.fpsWindow),this._averageFPS=Math.round(this._fpsHistory.reduce((i,o)=>i+o/this._fpsHistory.length,0))}render(i,o){const u=a.o.now();this._dt=u-this._timeStamp,this._timeStamp=u,this._wireframeDebugCache.update(this.frameCounter),this._debugParams.continousRedraw=i.map.repaint,this.style=i,this.options=o;const d=this.style._mergedLayers,m=!(!this.terrain||!this.terrain.enabled),_=()=>this.style._getOrder(m).filter(fe=>{const le=d[fe];return!(le.type in this._debugParams.enabledLayers)||this._debugParams.enabledLayers[le.type]});let y=_(),v=!1,T=!1,I=null,M=0,C=!1;for(const fe of y){const le=d[fe];le.visibility!=="none"&&(le.type==="circle"?v=!0:le.type==="building"?(I=le,++M):le.type==="symbol"&&(le.hasOcclusionOpacityProperties?T=!0:v=!0))}this.updateEmissiveMode();let D=y.map(fe=>d[fe]);const F=this.style._mergedSourceCaches;this.imageManager=i.imageManager,this.modelManager=i.modelManager,this.symbolFadeChange=i.placement.symbolFadeChange(a.o.now()),this.imageManager.beginFrame();for(const fe in F){const le=F[fe];le.used&&(le.prepare(this.context),le.getSource().usedInConflation&&++M)}let z=!1;for(const fe of D)fe.isHidden(this.transform.zoom)||(fe.type==="clip"&&(z=!0),this.prepareLayer(fe));const V={},N={},$={},H={},j={};for(const fe in F){const le=F[fe];V[fe]=le.getVisibleCoordinates(),N[fe]=V[fe].slice().reverse(),$[fe]=le.getVisibleCoordinates(!0).reverse(),H[fe]=le.getShadowCasterCoordinates(),j[fe]=le.sortCoordinatesByDistance(V[fe])}const ne=fe=>{const le=this.style.getLayerSourceCache(fe);return le&&le.used?le.getSource():null};if(M||z||this._clippingActiveLastFrame){const fe=[],le=[];let xe=0;for(const we of D)this.isSourceForClippingOrConflation(we,ne(we))&&(fe.push(we),le.push(xe)),xe++;if(fe&&(z||fe.length>1)||this._clippingActiveLastFrame){z=!1;const we=[];for(let Se=0;Se<fe.length;Se++){const $e=fe[Se],Ve=le[Se],Ne=this.style.getLayerSourceCache($e);if(!Ne||!Ne.used||!Ne.getSource().usedInConflation&&$e.type!=="clip"&&$e.type!=="building")continue;let De=a.eG,tt=a.bB.None;const ot=[];let Ke=!0;if($e.type==="building")De=a.eI;else if($e.type==="clip")if(De=Ve,$e.isHidden(this.transform.zoom))Ke=!1;else{if(!$e.layout){Ke=!1;continue}
vendor: 9,145 bytes, line 3254
3254for(const et of $e.layout.get("clip-layer-types"))tt|=et==="model"?a.bB.Model:et==="symbol"?a.bB.Symbol:a.bB.FillExtrusion;for(const et of $e.layout.get("clip-layer-scope"))ot.push(et);z=!0}Ke&&we.push({layer:$e.fqid,cache:Ne,order:De,clipMask:tt,clipScope:ot})}this.replacementSource.setSources(we),C=!0}}this._clippingActiveLastFrame=z,C||this.replacementSource.clear(),this.conflationActive=C,this.minCutoffZoom=0,this.longestCutoffRange=0,this.maxFrontCutoffRawStart=0,this.opaquePassCutoff=1/0,this._lastOcclusionLayer=-1,this.layersWithOcclusionOpacity=[];for(let fe=0;fe<D.length;fe++){const le=D[fe];if(le.visibility==="none")continue;const xe=le.cutoffRange();if(this.longestCutoffRange=Math.max(xe,this.longestCutoffRange),xe>0){const we=ne(le);we&&(this.minCutoffZoom=Math.max(we.minzoom,this.minCutoffZoom)),le.minzoom&&(this.minCutoffZoom=Math.max(le.minzoom,this.minCutoffZoom))}le.is3D(m)&&(this.opaquePassCutoff===1/0&&(this.opaquePassCutoff=fe),this._lastOcclusionLayer=fe)}const Y=this.style&&this.style.fog;Y?(this._fogVisible=Y.getOpacity(this.transform.pitch)!==0,this._fogVisible&&this.transform.projection.name!=="globe"&&(this._fogVisible=Y.isVisibleOnFrustum(this.transform.cameraFrustum))):this._fogVisible=!1,this._cachedTileFogOpacities={},this.terrain&&(this.terrain.updateTileBinding($),this.opaquePassCutoff=0,y=_(),D=y.map(fe=>d[fe]));const re=this._shadowRenderer;if(re){re.updateShadowParameters(this.transform,this.style.directionalLight);for(const fe in F)for(const le of V[fe]){let xe={min:0,max:0};this.terrain&&(xe=this.terrain.getMinMaxForTile(le)||xe),re.addShadowReceiver(le.toUnwrapped(),xe.min,xe.max)}}this.transform.projection.name!=="globe"||this.globeSharedBuffers||(this.globeSharedBuffers=new a.eH(this.context)),this.style.fog&&this.transform.projection.supportsFog?(this._atmosphere||(this._atmosphere=new Xh(this)),this._atmosphere.update(this)):this._atmosphere&&(this._atmosphere.destroy(),this._atmosphere=void 0);const Z=this._debugParams.forceEnablePrecipitation||!(!this.style||!this.style.snow),K=this._debugParams.forceEnablePrecipitation||!(!this.style||!this.style.rain);if(Z&&!this._snow&&(this._snow=new Os(this)),!Z&&this._snow&&(this._snow.destroy(),delete this._snow),K&&!this._rain&&(this._rain=new pu(this)),!K&&this._rain&&(this._rain.destroy(),delete this._rain),this._snow&&this._snow.update(this),this._rain&&this._rain.update(this),I){this.buildingTileBorderManager||(this.buildingTileBorderManager=new ep);const fe=this.style.getLayerSourceCache(I);this.buildingTileBorderManager.updateBorders(fe,I)}if(!To.has(this.context.gl))return;this.renderPass="offscreen";for(const fe of D){const le=i.getLayerSourceCache(fe);if(!fe.hasOffscreenPass()||fe.isHidden(this.transform.zoom))continue;const xe=le?N[le.id]:void 0;(fe.type==="custom"||fe.type==="raster"||fe.type==="raster-particle"||fe.isSky()||xe&&xe.length)&&this.renderLayer(this,le,fe,xe)}this.depthRangeFor3D=[0,1-(D.length+2)*this.numSublayers*this.depthEpsilon],this._shadowRenderer&&(this.renderPass="shadow",this._shadowRenderer.drawShadowPass(this.style,H)),this.context.bindFramebuffer.set(null),this.context.viewport.set([0,0,this.width,this.height]);const te=this.transform.projection.name==="globe"||this.transform.isHorizonVisible(),de=(()=>{if(o.showOverdrawInspector)return a.aq.black;const fe=this.style.fog;if(fe&&this.transform.projection.supportsFog){const le=this.style.getLut(fe.scope);if(!te){const xe=fe.properties.get("color-use-theme")==="none",we=fe.properties.get("color").toNonPremultipliedRenderColor(xe?null:le).toArray01();return new a.aq(...we)}if(te){const xe=fe.properties.get("space-color-use-theme")==="none",we=fe.properties.get("space-color").toNonPremultipliedRenderColor(xe?null:le).toArray01();return new a.aq(...we)}}return a.aq.transparent})();if(this.context.clear({color:de,depth:1}),this.clearStencil(),this._showOverdrawInspector=o.showOverdrawInspector,this.renderPass="opaque",this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&te&&this._atmosphere.drawStars(this,this.style.fog),!this.terrain)for(this.currentLayer=y.length-1;this.currentLayer>=0;this.currentLayer--){const fe=D[this.currentLayer],le=i.getLayerSourceCache(fe);if(fe.isSky())continue;const xe=le?(fe.is3D(m)?j:N)[le.id]:void 0;this._renderTileClippingMasks(fe,le,xe),this.renderLayer(this,le,fe,xe)}if(this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&te&&this._atmosphere.drawAtmosphereGlow(this,this.style.fog),this.renderPass="sky",(!this._atmosphere||a.al(this.transform.zoom)>0)&&(this.transform.projection.name==="globe"||this.transform.isHorizonVisible()))for(this.currentLayer=0;this.currentLayer<y.length;this.currentLayer++){const fe=D[this.currentLayer],le=i.getLayerSourceCache(fe);fe.isSky()&&this.renderLayer(this,le,fe,le?N[le.id]:void 0)}function se(fe,le){let xe;return le&&(xe=(fe.type==="symbol"?$:fe.is3D(m)?j:N)[le.id]),xe}if(this.renderPass="translucent",this.transform.projection.name==="globe"){for(this.renderElevatedRasterBackface=!0,this.currentLayer=0;this.currentLayer<y.length;){const fe=D[this.currentLayer];if(fe.type==="raster"||fe.type==="raster-particle"){const le=i.getLayerSourceCache(fe);this.renderLayer(this,le,fe,se(fe,le))}++this.currentLayer}this.renderElevatedRasterBackface=!1}this.currentLayer=0,this.firstLightBeamLayer=Number.MAX_SAFE_INTEGER;const be=re?re.getGroundShadowLayerIndex():-1;let _e=!1,Me=-1;for(let fe=0;fe<y.length;++fe){const le=D[fe];le.isHidden(this.transform.zoom)||le.is3D(m)&&(Me=fe)}T&&Me===-1&&(v=!0);let Le=!1;for(;this.currentLayer<y.length;){const fe=D[this.currentLayer],le=i.getLayerSourceCache(fe);if(fe.isSky())++this.currentLayer;else if(this.terrain&&this.style.isLayerDraped(fe)){if(fe.isHidden(this.transform.zoom)){++this.currentLayer;continue}this.currentLayer=this.terrain.renderBatch(this.currentLayer),this._lastOcclusionLayer=Math.max(this.currentLayer,this._lastOcclusionLayer)}else{if(!Le&&fe.is3D(m)&&!m){const xe=this.currentLayer,we=Se=>{for(this.currentLayer=0;this.currentLayer<D.length;this.currentLayer++){const $e=D[this.currentLayer];if(id[$e.type]){const Ve=this.style.getLayerSourceCache($e);id[$e.type](this,Ve,$e,se($e,Ve),Se)}}};we("initialize"),we("reset"),this.currentLayer=xe,Le=!0}if(v&&!_e&&this.terrain&&!this.transform.isOrthographic&&(_e=!0,this.blitDepth()),T&&Me!==-1&&this.currentLayer===Me+1&&!this.transform.isOrthographic&&this.blitDepth(),this.terrain||this._renderTileClippingMasks(fe,le,le?V[le.id]:void 0),this.renderLayer(this,le,fe,se(fe,le)),!this.terrain&&re&&this.currentLayer===be){{this.clearStencil(),this.resetStencilClippingMasks();const xe=this.currentLayer;for(this.currentLayer=0;this.currentLayer<D.length;this.currentLayer++){const we=D[this.currentLayer];if(rd[we.type]){const Se=this.style.getLayerSourceCache(we);rd[we.type](this,Se,we,se(we,Se))}}this.currentLayer=xe}if(re.drawGroundShadows(),this.firstLightBeamLayer<=this.currentLayer){const xe=this.currentLayer;for(this.renderPass="light-beam",this.currentLayer=this.firstLightBeamLayer;this.currentLayer<=xe;this.currentLayer++){const we=D[this.currentLayer];if(!we.hasLightBeamPass())continue;const Se=i.getLayerSourceCache(we);this.renderLayer(this,Se,we,Se?N[Se.id]:void 0)}this.currentLayer=xe,this.renderPass="translucent"}}if(this.currentLayer>=this._lastOcclusionLayer&&this.layersWithOcclusionOpacity.length>0){const xe=this.currentLayer;this.depthOcclusion=!0;for(const we of this.layersWithOcclusionOpacity){this.currentLayer=we;const Se=D[this.currentLayer],$e=i.getLayerSourceCache(Se),Ve=$e?N[$e.id]:void 0;this.terrain||this._renderTileClippingMasks(Se,$e,$e?V[$e.id]:void 0),this.renderLayer(this,$e,Se,Ve)}this.depthOcclusion=!1,this.currentLayer=xe,this.renderPass="translucent",this.layersWithOcclusionOpacity=[]}++this.currentLayer}}if(this.terrain&&this.terrain.postRender(),this._snow&&this._snow.draw(this),this._rain&&this._rain.draw(this),this.options.showTileBoundaries||this.options.showQueryGeometry||this.options.showTileAABBs){let fe=null;D.forEach(le=>{const xe=i.getLayerSourceCache(le);xe&&!le.isHidden(this.transform.zoom)&&xe.getVisibleCoordinates().length&&(!fe||fe.getSource().maxzoom<xe.getSource().maxzoom)&&(fe=xe)}),fe&&this.options.showTileBoundaries&&cu(this,fe,fe.getVisibleCoordinates(),a.aq.red,!1,this.options.showParseStatus)}this.terrain&&this._debugParams.showTerrainProxyTiles&&cu(this,this.terrain.proxySourceCache,this.terrain.proxyCoords,new a.aq(1,.8,.1,1),!0,this.options.showParseStatus),this.options.showPadding&&function(fe){const le=fe.transform.padding;Hh(fe,fe.transform.height-(le.top||0),3,qh),Hh(fe,le.bottom||0,3,$h),Qf(fe,le.left||0,3,Ym),Qf(fe,fe.transform.width-(le.right||0),3,Km);const xe=fe.transform.centerPoint;(function(we,Se,$e,Ve){Ml(we,Se-1,$e-10,2,20,Ve),Ml(we,Se-10,$e-1,20,2,Ve)})(fe,xe.x,fe.transform.height-xe.y,Qm)}(this),this.context.setDefault(),this.frameCounter=(this.frameCounter+1)%Number.MAX_SAFE_INTEGER,this.tileLoaded&&this.options.speedIndexTiming&&(this.loadTimeStamps.push(performance.now()),this.saveC
3254anvasCopy()),C||(this.conflationActive=!1)}prepareLayer(i){this.gpuTimingStart(i);const{unsupportedLayers:o}=this.transform.projection,u=!o||!o.includes(i.type);if(td[i.type]&&(u||this.terrain&&i.type==="custom")){const d=this.style.getLayerSourceCache(i);td[i.type](i,d,this)}this.gpuTimingEnd()}renderLayer(i,o,u,d){u.isHidden(this.transform.zoom)||(u.type==="background"||u.type==="sky"||u.type==="custom"||u.type==="model"||u.type==="raster"||u.type==="raster-particle"||d&&d.length)&&(this.id=u.id,this.gpuTimingStart(u),i.transform.projection.unsupportedLayers&&i.transform.projection.unsupportedLayers.includes(u.type)&&(!i.terrain||u.type!=="custom")||u.type==="clip"||sp[u.type](i,o,u,d,this.style.placement.variableOffsets,this.options.isInitialLoad),this.gpuTimingEnd())}gpuTimingStart(i){if(!this.options.gpuTiming)return;const o=this.context.extTimerQuery,u=this.context.gl;let d=this.gpuTimers[i.id];d||(d=this.gpuTimers[i.id]={calls:0,cpuTime:0,query:u.createQuery()}),d.calls++,u.beginQuery(o.TIME_ELAPSED_EXT,d.query)}gpuTimingDeferredRenderStart(){if(this.options.gpuTimingDeferredRender){const i=this.context.extTimerQuery,o=this.context.gl,u=o.createQuery();this.deferredRenderGpuTimeQueries.push(u),o.beginQuery(i.TIME_ELAPSED_EXT,u)}}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 i=this.gpuTimers;return this.gpuTimers={},i}collectDeferredRenderGpuQueries(){const i=this.deferredRenderGpuTimeQueries;return this.deferredRenderGpuTimeQueries=[],i}queryGpuTimers(i){const o={};for(const u in i){const d=i[u],m=this.context.extTimerQuery,_=m.getQueryParameter(d.query,this.context.gl.QUERY_RESULT)/1e6;
3254m.deleteQueryEXT(d.query),o[u]=_}return o}queryGpuTimeDeferredRender(i){if(!this.options.gpuTimingDeferredRender)return 0;const o=this.context.gl;let u=0;for(const d of i)u+=o.getQueryParameter(d,o.QUERY_RESULT)/1e6,o.deleteQuery(d);return u}translatePosMatrix(i,o,u,d,m){if(!u[0]&&!u[1])return i;const _=m?d==="map"?this.transform.angle:0:d==="viewport"?-this.transform.angle:0;if(_){const T=Math.sin(_),I=Math.cos(_);u=[u[0]*I-u[1]*T,u[0]*T+u[1]*I]}const y=[m?u[0]:a.aA(o,u[0],this.transform.zoom),m?u[1]:a.aA(o,u[1],this.transform.zoom),0],v=new Float32Array(16);return a.by(v,i,y),v}saveTileTexture(i){if(i.context!==this.context)return;const o=i.size[0],u=this._tileTextures[o];u?u.push(i):this._tileTextures[o]=[i]}getTileTexture(i){const o=this._tileTextures[i];return o&&o.length>0?o.pop():null}terrainRenderModeElevated(){return this.style&&!!this.style.getTerrain()&&!!this.terrain&&!this.terrain.renderingToTexture||this.forceTerrainMode}linearFloatFilteringSupported(){return this.context.extTextureFloatLinear!=null}currentGlobalDefines(i,o,u){const d=u===void 0?this.terrain&&this.terrain.renderingToTexture:u,m=[];return this.style&&this.style.enable3dLights()&&(i==="globeRaster"||i==="terrainRaster"?(m.push("LIGHTING_3D_MODE"),m.push("LIGHTING_3D_ALPHA_EMISSIVENESS")):d||m.push("LIGHTING_3D_MODE")),this.terrainRenderModeElevated()&&(m.push("TERRAIN"),this.linearFloatFilteringSupported()&&m.push("TERRAIN_DEM_FLOAT_FORMAT")),this.transform.projection.name==="globe"&&m.push("GLOBE"),!this._fogVisible||d||o!==void 0&&!o||m.push("FOG"),d&&m.push("RENDER_TO_TEXTURE"),this._showOverdrawInspector&&m.push("OVERDRAW_INSPECTOR"),m}getOrCreateProgram(i,o){this.cache=this.cache||{};const u=o&&o.defines||[],d=o&&o.config,m=this.currentGlobalDefines(i,o&&o.overrideFog,o&&o.overrideRtt).concat(u),_=Eh.cacheKey(Tf[i],i,m,d);return this.cache[_]||(this.cache[_]=new Eh(this.context,i,Tf[i],d,qf[i],m)),this.cache[_]}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 i=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(i.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new a.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(i,o){if(this.style.enable3dLights()){const u=this.style.directionalLight,d=this.style.ambientLight;if(u&&d){const m=((_,y,v)=>{const T=_.properties.get("direction"),I=_.properties.get("color-use-theme")==="none",M=_.properties.get("color").toNonPremultipliedRenderColor(I?null:v.getLut(_.scope)).toArray01(),C=_.properties.get("intensity"),D=y.properties.get("color-use-theme")==="none",F=y.properties.get("color").toNonPremultipliedRenderColor(D?null:v.getLut(y.scope)).toArray01(),z=y.properties.get("intensity"),V=[T.x,T.y,T.z],N=a.dz(F,z),$=a.dz(M,C);return{u_lighting_ambient_color:N,u_lighting_directional_dir:V,u_lighting_directional_color:$,u_ground_radiance:Wc(V,$,N)}})(u,d,this.style);o.setLightsUniformValues(i,m)}}}uploadCommonUniforms(i,o,u,d,m){if(this.uploadCommonLightUniforms(i,o),this.terrain&&this.terrain.renderingToTexture)return;const _=this.style.fog;if(_){const y=_.getOpacity(this.transform.pitch),v=((T,I,M,C,D,F,z,V,N,$,H,j)=>{const ne=T.transform,Y=I.properties.get("color-use-theme")==="none",re=I.properties.get("color").toNonPremultipliedRenderColor(Y?null:T.style.getLut(I.scope)).toArray01();re[3]=C;const Z=T.frameCounter/1e3%1,[K,te]=I.properties.get("vertical-range");return{u_fog_matrix:M?ne.calculateFogTileMatrix(M):j||T.identityMat,u_fog_range:I.getFovAdjustedRange(ne._fov),u_fog_color:re,u_fog_horizon_blend:I.properties.get("horizon-blend"),u_fog_vertical_limit:[Math.min(K,te),te],u_fog_temporal_offset:Z,u_frustum_tl:D,u_frustum_tr:F,u_frustum_br:z,u_frustum_bl:V,u_globe_pos:N,u_globe_radius:$,u_viewport:H,u_globe_transition:a.al(ne.zoom),u_is_globe:+(ne.projection.name==="globe")}})(this,_,u,y,this.transform.frustumCorners.TL,this.transform.frustumCorners.TR,this.transform.frustumCorners.BR,this.transform.frustumCorners.BL,this.transform.globeCenterInViewSpace,this.transform.globeRadius,[this.transform.width*a.o.devicePixelRatio,this.transform.height*a.o.devicePixelRatio],d);o.setFogUniformValues(i,v)}m&&o.setCutoffUniformValues(i,m.uniformValues)}setTileLoadedFlag(i){this.tileLoaded=i}saveCanvasCopy(){const i=this.canvasCopy();i&&(this.frameCopies.push(i),this.tileLoaded=!1)}canvasCopy(){const i=this.context.gl,o=i.createTexture();return i.bindTexture(i.TEXTURE_2D,o),i.copyTexImage2D(i.TEXTURE_2D,0,i.RGBA,0,0,i.drawingBufferWidth,i.drawingBufferHeight,0),o}getCanvasCopiesAndTimestamps(){return{canvasCopies:this.frameCopies,timeStamps:this.loadTimeStamps}}averageElevationNeedsEasing(){if(!this.transform._elevation)return!1;const i=this.style&&this.style.fog;return!!i&&i.getOpacity(this.transform.pitch)!==0}
vendor: 79,199 bytes, lines 3254-3259
3254getBackgroundTiles(){const i=this._backgroundTiles,o=this._backgroundTiles={},u=this.transform.coveringTiles({tileSize:512});for(const d of u)o[d.key]=i[d.key]||new a.b1(d,512,this.transform.tileZoom,this,void 0,this.worldview);return o}clearBackgroundTiles(){this._backgroundTiles={}}isSourceForClippingOrConflation(i,o){return!(!i.is3D(!(!this.terrain||!this.terrain.enabled))||i.type!=="clip"&&i.type!=="building"&&(i.minzoom&&i.minzoom>this.transform.zoom||(this.style._clipLayerPresent||i.sourceLayer!=="building"&&i.sourceLayer!=="procedural_buildings")&&(!o||o.type!=="batched-model")))}isTileAffectedByFog(i){if(!this.style||!this.style.fog)return!1;if(this.transform.projection.name==="globe")return!0;let o=this._cachedTileFogOpacities[i.key];return o||(this._cachedTileFogOpacities[i.key]=o=this.style.fog.getOpacityForTile(i)),o[0]>=vt||o[1]>=vt}setupDepthForOcclusion(i,o,u){const d=this.context,m=d.gl,_=!!u;var y;u||(u={u_dem:2,u_dem_prev:4,u_dem_tl:[0,0],u_dem_tl_prev:[0,0],u_dem_scale:0,u_dem_scale_prev:0,u_dem_size:0,u_dem_lerp:1,u_depth:3,u_depth_size_inv:[0,0],u_depth_range_unpack:[0,1],u_occluder_half_size:16,u_occlusion_depth_offset:-1e-4,u_exaggeration:0}),d.activeTexture.set(m.TEXTURE3),i&&this.depthFBO&&this.depthTexture?(this.depthTexture.bind(m.NEAREST,m.CLAMP_TO_EDGE),u.u_depth_size_inv=[1/this.depthFBO.width,1/this.depthFBO.height],u.u_depth_range_unpack=[2/((y=this.depthRangeFor3D)[1]-y[0]),-1-2*y[0]/(y[1]-y[0])],u.u_occluder_half_size=.5*this.occlusionParams.occluderSize,u.u_occlusion_depth_offset=this.occlusionParams.depthOffset):this.emptyDepthTexture.bind(m.NEAREST,m.CLAMP_TO_EDGE),d.activeTexture.set(m.TEXTURE0),_||o.setTerrainUniformValues(d,u)}updateEmissiveMode(){if(this._forceEmissiveMode)return;const i=this.style.hasDataDrivenEmissiveStrength();this.emissiveMode=i?this.context.extBlendFuncExtended?"dual-source-blending":"mrt-fallback":"constant"}}function nd(l,i){let o=!1,u=null;const d=()=>{u=null,o&&(l(),u=setTimeout(d,i),o=!1)};return()=>(o=!0,u||d(),u)}class n_{constructor(i){this._hashName=i&&encodeURIComponent(i),a.a_(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=nd(this._updateHashUnthrottled.bind(this),300)}addTo(i){return this._map=i,window.addEventListener("hashchange",this._onHashChange,!1),i.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 i=this._map;if(!i)return"";const o=Or(i);if(this._hashName){const u=this._hashName;let d=!1;const m=location.hash.slice(1).split("&").map(_=>{const y=_.split("=")[0];return y===u?(d=!0,`${y}=${o}`):_}).filter(_=>_);return d||m.push(`${u}=${o}`),`#${m.join("&")}`}return`#${o}`}_getCurrentHash(){const i=location.hash.replace("#","");if(this._hashName){let o;return i.split("&").map(u=>u.split("=")).forEach(u=>{u[0]===this._hashName&&(o=u)}),(o&&o[1]||"").split("/")}return i.split("/")}_onHashChange(){const i=this._map;if(!i)return!1;const o=this._getCurrentHash();if(o.length>=3&&!o.some(u=>isNaN(Number(u)))){const u=i.dragRotate.isEnabled()&&i.touchZoomRotate.isEnabled()?+(o[3]||0):i.getBearing();return i.jumpTo({center:[+o[2],+o[1]],zoom:+o[0],bearing:u,pitch:+(o[4]||0)}),!0}return!1}_updateHashUnthrottled(){history.replaceState(history.state,"",location.href.replace(/(#.+)?$/,this.getHashString()))}}function Or(l,i){const o=l.getCenter(),u=Math.round(100*l.getZoom())/100,d=Math.ceil((u*Math.LN2+Math.log(512/360/.5))/Math.LN10),m=Math.pow(10,d),_=Math.round(o.lng*m)/m,y=Math.round(o.lat*m)/m,v=l.getBearing(),T=l.getPitch();let I=i?`/${_}/${y}/${u}`:`${u}/${y}/${_}`;return(v||T)&&(I+="/"+Math.round(10*v)/10),T&&(I+=`/${Math.round(T)}`),I}const mu={linearity:.3,easing:a.eJ(0,0,.3,1)},Ll=Object.assign({deceleration:2500,maxSpeed:1400},mu),o_=Object.assign({deceleration:20,maxSpeed:1400},mu),hi=Object.assign({deceleration:1e3,maxSpeed:360},mu),zt=Object.assign({deceleration:1e3,maxSpeed:90},mu);class ap{constructor(i){this._map=i,this.clear()}clear(){this._inertiaBuffer=[]}record(i){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:a.o.now(),settings:i})}_drainInertiaBuffer(){const i=this._inertiaBuffer,o=a.o.now();for(;i.length>0&&o-i[0].time>160;)i.shift()}_onMoveEnd(i){if(this._map._prefersReducedMotion()||(this._drainInertiaBuffer(),this._inertiaBuffer.length<2))return;const o={zoom:0,bearing:0,pitch:0,pan:new a.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:m}of this._inertiaBuffer)o.zoom+=m.zoomDelta||0,o.bearing+=m.bearingDelta||0,o.pitch+=m.pitchDelta||0,m.panDelta&&o.pan._add(m.panDelta),m.around&&(o.around=m.around),m.pinchAround&&(o.pinchAround=m.pinchAround);const u=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,d={};if(o.pan.mag()){const m=co(o.pan.mag(),u,Object.assign({},Ll,i||{}));d.offset=o.pan.mult(m.amount/o.pan.mag()),d.center=this._map.transform.center,sn(d,m)}if(o.zoom){const m=co(o.zoom,u,o_);d.zoom=this._map.transform.zoom+m.amount,sn(d,m)}if(o.bearing){const m=co(o.bearing,u,hi);d.bearing=this._map.transform.bearing+a.aC(m.amount,-179,179),sn(d,m)}if(o.pitch){const m=co(o.pitch,u,zt);d.pitch=this._map.transform.pitch+m.amount,sn(d,m)}if(d.zoom||d.bearing){const m=o.pinchAround===void 0?o.around:o.pinchAround;d.around=m?this._map.unproject(m):this._map.getCenter()}return this.clear(),d.noMoveStart=!0,d}}function sn(l,i){(!l.duration||l.duration<i.duration)&&(l.duration=i.duration,l.easing=i.easing)}function co(l,i,o){const{maxSpeed:u,linearity:d,deceleration:m}=o,_=a.aC(l*d/(i/1e3),-u,u),y=Math.abs(_)/(m*d);return{easing:o.easing,duration:1e3*y,amount:_*(y/2)}}class Ir extends a.C{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(i,o,u,d={}){const m=Un(o.getCanvasContainer(),u),_=o.unproject(m);super(i,Object.assign({point:m,lngLat:_,originalEvent:u},d)),this._defaultPrevented=!1,this.target=o}}class gn extends a.C{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(i,o,u){const d=i==="touchend"?u.changedTouches:u.touches,m=bo(o.getCanvasContainer(),d),_=m.map(v=>o.unproject(v)),y=m.reduce((v,T,I,M)=>v.add(T.div(M.length)),new a.P(0,0));super(i,{points:m,point:y,lngLats:_,lngLat:o.unproject(y),originalEvent:u}),this._defaultPrevented=!1}}class od extends a.C{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(i,o){super("wheel",{originalEvent:o}),this._defaultPrevented=!1}}class sd{constructor(i,o){this._map=i,this._clickTolerance=o.clickTolerance}reset(){this._mousedownPos=void 0}wheel(i){return this._firePreventable(new od(this._map,i))}mousedown(i,o){return this._mousedownPos=o,this._firePreventable(new Ir(i.type,this._map,i))}mouseup(i){this._map.fire(new Ir(i.type,this._map,i))}preclick(i){const o=new MouseEvent("preclick",i);this._map.fire(new Ir(o.type,this._map,o))}click(i,o){this._mousedownPos&&this._mousedownPos.dist(o)>=this._clickTolerance||(this.preclick(i),this._map.fire(new Ir(i.type,this._map,i)))}dblclick(i){return this._firePreventable(new Ir(i.type,this._map,i))}mouseover(i){this._map.fire(new Ir(i.type,this._map,i))}mouseout(i){this._map.fire(new Ir(i.type,this._map,i))}touchstart(i){return this._firePreventable(new gn(i.type,this._map,i))}touchmove(i){this._map.fire(new gn(i.type,this._map,i))}touchend(i){this._map.fire(new gn(i.type,this._map,i))}touchcancel(i){this._map.fire(new gn(i.type,this._map,i))}_firePreventable(i){if(this._map.fire(i),i.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class ad{constructor(i){this._map=i}reset(){this._delayContextMenu=!1,this._contextMenuEvent=void 0}mousemove(i){this._map.fire(new Ir(i.type,this._map,i))}mousedown(){this._delayContextMenu=!0}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Ir("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(i){this._delayContextMenu?this._contextMenuEvent=i:this._map.fire(new Ir(i.type,this._map,i)),this._map.listens("contextmenu")&&i.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class ld{constructor(i,o){this._map=i,this._el=i.getCanvasContainer(),this._container=i.getContainer(),this._clickTolerance=o.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(i,o){this.isEnabled()&&i.shiftKey&&i.button===0&&(Mr(),this._startPos=this._lastPos=o,this._active=!0)}mousemoveWindow(i,o){if(!this._active)return;const u=o,d=this._startPos,m=this._lastPos;if(!d||!m||m.equals(u)||!this._box&&u.dist(d)<this._clickTolerance)return;this._lastPos=u,this._box||(this._box=Jt("div","mapboxgl-boxzoom",this._container),this._container.classList.add("mapboxgl-crosshair"),this._fireEvent("boxzoomstart",i));const _=Math.min(d.x,u.x),y=Math.max(d.x,u.x),v=Math.min(d.y,u.y),T=Math.max(d.y,u.y);this._map._requestDomTask(()=>{this._box&&(this._box.style.transform=`translate(${_}px,${v}px)`,this._box.style.width=y-_+"px",this._box.style.height=T-v+"px")})}mouseupWindow(i,o){if(!this._active)return;const u=this._startPos,d=o;if(u&&i.button===0){if(this.reset(),vo(),u.x!==d.x||u.y!==d.y)return this._map.fire(new a.C("boxzoomend",{originalEvent:i})),{cameraAnimation:m=>m.fitScreenCoordinates(u,d,this._map.getBearing(),{linear:!1})};this._fireEvent("boxzoomcancel",i)}}keydown(i){this._active&&i.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",i))}blur(){this.reset()}reset(){this._active=!1,this._container.classList.remove("mapboxgl-crosshair"),this._box&&(this._box.remove(),this._box=null),xo(),delete this._startPos,delete this._lastPos}_fireEvent(i,o){return this._map.fire(new a.C(i,{originalEvent:o}))}}function Fl(l,i){const o={};for(let u=0;u<l.length;u++)o[l[u].identifier]=i[u];return o}class Fn{constructor(i){this.reset(),this.numTouches=i.numTouches}reset(){this.centroid=void 0,this.startTime=0,this.touches={},this.aborted=!1}touchstart(i,o,u){(this.centroid||u.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===0&&(this.startTime=i.timeStamp),u.length===this.numTouches&&(this.centroid=function(d){const m=new a.P(0,0);for(const _ of d)m._add(_);return m.div(d.length)}(o),this.touches=Fl(u,o)))}touchmove(i,o,u){if(this.aborted||!this.centroid)return;const d=Fl(u,o);for(const m in this.touches){const _=d[m];(!_||_.dist(this.touches[m])>30)&&(this.aborted=!0)}}touchend(i,o,u){if((!this.centroid||i.timeStamp-this.startTime>500)&&(this.aborted=!0),u.length===0){const d=!this.aborted&&this.centroid;if(this.reset(),d)return d}}}class uo{constructor(i){this.singleTap=new Fn(i),this.numTaps=i.numTaps,this.reset()}reset(){this.lastTime=1/0,this.lastTap=void 0,this.count=0,this.singleTap.reset()}touchstart(i,o,u){this.singleTap.touchstart(i,o,u)}touchmove(i,o,u){this.singleTap.touchmove(i,o,u)}touchend(i,o,u){const d=this.singleTap.touchend(i,o,u);if(d){const m=i.timeStamp-this.lastTime<500,_=!this.lastTap||this.lastTap.dist(d)<30;if(m&&_||this.reset(),this.count++,this.lastTime=i.timeStamp,this.lastTap=d,this.count===this.numTaps)return this.reset(),d}}}class za{constructor(){this._zoomIn=new uo({numTouches:1,numTaps:2}),this._zoomOut=new uo({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(i,o,u){this._zoomIn.touchstart(i,o,u),this._zoomOut.touchstart(i,o,u)}touchmove(i,o,u){this._zoomIn.touchmove(i,o,u),this._zoomOut.touchmove(i,o,u)}touchend(i,o,u){const d=this._zoomIn.touchend(i,o,u),m=this._zoomOut.touchend(i,o,u);return d?(this._active=!0,i.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:_=>_.easeTo({duration:300,zoom:_.getZoom()+1,around:_.unproject(d)},{originalEvent:i})}):m?(this._active=!0,i.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:_=>_.easeTo({duration:300,zoom:_.getZoom()-1,around:_.unproject(m)},{originalEvent:i})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}const _u=0,cd=2,ud={[_u]:1,[cd]:2},Ro={Control:"ctrlKey",Alt:"altKey",Shift:"shiftKey",Meta:"metaKey"};class Ol{constructor(i){this.reset(),this._clickTolerance=i.clickTolerance||1}blur(){this.reset()}reset(){this._active=!1,this._moved=!1,this._lastPoint=void 0,this._eventButton=void 0}_correctButton(i,o){return!1}_move(i,o){return{}}mousedown(i,o){if(this._lastPoint)return;const u=Ha(i);this._correctButton(i,u)&&(this._lastPoint=o,this._eventButton=u)}mousemoveWindow(i,o){const u=this._lastPoint;if(u){if(i.preventDefault(),this._eventButton!=null&&function(d,m){const _=ud[m];return d.buttons===void 0||(d.buttons&_)!==_}(i,this._eventButton))this.reset();else if(this._moved||!(o.dist(u)<this._clickTolerance))return this._moved=!0,this._lastPoint=o,this._move(u,o)}}mouseupWindow(i){this._lastPoint&&Ha(i)===this._eventButton&&(this._moved&&vo(),this.reset())}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class On extends Ol{mousedown(i,o){super.mousedown(i,o),this._lastPoint&&(this._active=!0)}_correctButton(i,o){return o===0&&!i.ctrlKey}_move(i,o){return{around:o,panDelta:o.sub(i)}}}class gu extends Ol{constructor(i){super(i),this._pitchRotateKey=i.pitchRotateKey?Ro[i.pitchRotateKey]:void 0}_correctButton(i,o){return this._pitchRotateKey?o===0&&i[this._pitchRotateKey]:o===0&&i.ctrlKey||o===2}_move(i,o){const u=.8*(o.x-i.x);if(u)return this._active=!0,{bearingDelta:u}}contextmenu(i){this._pitchRotateKey||i.preventDefault()}}class Bl extends Ol{constructor(i){super(i),this._pitchRotateKey=i.pitchRotateKey?Ro[i.pitchRotateKey]:void 0}_correctButton(i,o){return this._pitchRotateKey?o===0&&i[this._pitchRotateKey]:o===0&&i.ctrlKey||o===2}_move(i,o){const u=-.5*(o.y-i.y);if(u)return this._active=!0,{pitchDelta:u}}contextmenu(i){this._pitchRotateKey||i.preventDefault()}}class hd{constructor(i,o){this._map=i,this._el=i.getCanvasContainer(),this._minTouches=1,this._clickTolerance=o.clickTolerance||1,this.reset(),a.a_(["_addTouchPanBlocker","_showTouchPanBlockerAlert"],this)}reset(){this._active=!1,this._touches={},this._sum=new a.P(0,0)}touchstart(i,o,u){return this._calculateTransform(i,o,u)}touchmove(i,o,u){if(this._active&&!(u.length<this._minTouches)){if(this._map._cooperativeGestures&&!this._map.isMoving()){if(u.length===1&&!a.eK())return void this._showTouchPanBlockerAlert();this._alertContainer.style.visibility!=="hidden"&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}return i.cancelable&&i.preventDefault(),this._calculateTransform(i,o,u)}}touchend(i,o,u){this._calculateTransform(i,o,u),this._active&&u.length<this._minTouches&&this.reset()}touchcancel(){this.reset()}_calculateTransform(i,o,u){u.length>0&&(this._active=!0);const d=Fl(u,o),m=new a.P(0,0),_=new a.P(0,0);let y=0;for(const T in d){const I=d[T],M=this._touches[T];M&&(m._add(I),_._add(I.sub(M)),y++,d[T]=I)}if(this._touches=d,y<this._minTouches||!_.mag())return;const v=_.div(y);return this._sum._add(v),this._sum.mag()<this._clickTolerance?void 0:{around:m.div(y),panDelta:v}}enable(){this._enabled=!0,this._map._cooperativeGestures&&(this._addTouchPanBlocker(),this._el.classList.add("mapboxgl-touch-pan-blocker-override","mapboxgl-scrollable-page"))}disable(){this._enabled=!1,this._map._cooperativeGestures&&(clearTimeout(this._alertTimer),this._alertContainer.remove(),this._el.classList.remove("mapboxgl-touch-pan-blocker-override","mapboxgl-scrollable-page")),this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}_addTouchPanBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=Jt("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 kl{constructor(){this.reset()}reset(){this._active=!1,this._firstTwoTouches=void 0}_start(i){}_move(i,o,u){return{}}touchstart(i,o,u){this._firstTwoTouches||u.length<2||(this._firstTwoTouches=[u[0].identifier,u[1].identifier],this._start([o[0],o[1]]))}touchmove(i,o,u){const d=this._firstTwoTouches;if(!d)return;i.preventDefault();const[m,_]=d,y=Ni(u,o,m),v=Ni(u,o,_);if(!y||!v)return;const T=this._aroundCenter?null:y.add(v).div(2);return this._move([y,v],T,i)}touchend(i,o,u){if(!this._firstTwoTouches)return;const[d,m]=this._firstTwoTouches,_=Ni(u,o,d),y=Ni(u,o,m);_&&y||(this._active&&vo(),this.reset())}touchcancel(){this.reset()}enable(i){this._enabled=!0,this._aroundCenter=!!i&&i.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}function Ni(l,i,o){for(let u=0;u<l.length;u++)if(l[u].identifier===o)return i[u]}function yu(l,i){return Math.log2(l/i)}class dd extends kl{reset(){super.reset(),this._distance=0,this._startDistance=0}_start(i){this._startDistance=this._distance=i[0].dist(i[1])}_move(i,o){const u=this._distance;if(this._distance=i[0].dist(i[1]),this._active||!(Math.abs(yu(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:yu(this._distance,u),pinchAround:o}}}function xu(l,i){return 180*l.angleWith(i)/Math.PI}class Bs extends kl{reset(){super.reset(),this._minDiameter=0,this._startVector=void 0,this._vector=void 0}_start(i){this._startVector=this._vector=i[0].sub(i[1]),this._minDiameter=i[0].dist(i[1])}_move(i,o){const u=this._vector;if(this._vector=i[0].sub(i[1]),u&&(this._active||!this._isBelowThreshold(this._vector)))return this._active=!0,{bearingDelta:xu(this._vector,u),pinchAround:o}}_isBelowThreshold(i){this._minDiameter=Math.min(this._minDiameter,i.mag());const o=25/(Math.PI*this._minDiameter)*360,u=this._startVector;if(!u)return!1;const d=xu(i,u);return Math.abs(d)<o}}function Vl(l){return Math.abs(l.y)>Math.abs(l.x)}class fd extends kl{constructor(i){super(),this._map=i}reset(){super.reset(),this._valid=void 0,this._firstMove=void 0,this._lastPoints=void 0}_start(i){this._lastPoints=i,Vl(i[0].sub(i[1]))&&(this._valid=!1)}_move(i,o,u){const d=this._lastPoints;if(!d)return;const m=i[0].sub(d[0]),_=i[1].sub(d[1]);return this._map._cooperativeGestures&&!a.eK()&&u.touches.length<3||(this._valid=this.gestureBeginsVertically(m,_,u.timeStamp),!this._valid)?void 0:(this._lastPoints=i,this._active=!0,{pitchDelta:(m.y+_.y)/2*-.5})}gestureBeginsVertically(i,o,u){if(this._valid!==void 0)return this._valid;const d=i.mag()>=2,m=o.mag()>=2;if(!d&&!m)return;if(!d||!m)return this._firstMove==null&&(this._firstMove=u),u-this._firstMove<100&&void 0;const _=i.y>0==o.y>0;return Vl(i)&&Vl(o)&&_}}const pd={panStep:100,bearingStep:15,pitchStep:10};class ks{constructor(){const i=pd;this._panStep=i.panStep,this._bearingStep=i.bearingStep,this._pitchStep=i.pitchStep,this._rotationDisabled=!1}blur(){this.reset()}reset(){this._active=!1}keydown(i){if(i.altKey||i.ctrlKey||i.metaKey)return;let o=0,u=0,d=0,m=0,_=0;switch(i.keyCode){case 61:case 107:case 171:case 187:o=1;break;case 189:case 109:case 173:o=-1;break;case 37:i.shiftKey?u=-1:(i.preventDefault(),m=-1);break;case 39:i.shiftKey?u=1:(i.preventDefault(),m=1);break;case 38:i.shiftKey?d=1:(i.preventDefault(),_=-1);break;case 40:i.shiftKey?d=-1:(i.preventDefault(),_=1);break;default:return}return this._rotationDisabled&&(u=0,d=0),{cameraAnimation:y=>{const v=y.getZoom();y.easeTo({duration:300,easeId:"keyboardHandler",easing:md,zoom:o?Math.round(v)+o*(i.shiftKey?2:1):v,bearing:y.getBearing()+u*this._bearingStep,pitch:y.getPitch()+d*this._pitchStep,offset:[-m*this._panStep,-_*this._panStep],center:y.getCenter()},{originalEvent:i})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function md(l){return l*(2-l)}const Vs=4.000244140625,_d=1/450;class vu{constructor(i,o){this._map=i,this._el=i.getCanvasContainer(),this._handler=o,this._delta=0,this._lastDelta=0,this._defaultZoomRate=.01,this._wheelZoomRate=_d,a.a_(["_onTimeout","_addScrollZoomBlocker","_showBlockerAlert"],this)}setZoomRate(i){this._defaultZoomRate=i}setWheelZoomRate(i){this._wheelZoomRate=i}isEnabled(){return!!this._enabled}isActive(){return this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(i){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!i&&i.around==="center",this._map._cooperativeGestures&&this._addScrollZoomBlocker())}disable(){this.isEnabled()&&(this._enabled=!1,this._map._cooperativeGestures&&(clearTimeout(this._alertTimer),this._alertContainer.remove()))}wheel(i){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!(i.ctrlKey||i.metaKey||this.isZooming()||a.eK()))return void this._showBlockerAlert();this._alertContainer.style.visibility!=="hidden"&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}let o=i.deltaMode===WheelEvent.DOM_DELTA_LINE?40*i.deltaY:i.deltaY;const u=a.o.now(),d=u-(this._lastWheelEventTime||0);this._lastWheelEventTime=u,o!==0&&o%Vs===0?this._type="wheel":o!==0&&Math.abs(o)<4?this._type="trackpad":d>400?(this._type=null,this._lastValue=o,this._timeout=window.setTimeout(this._onTimeout,40,i)):this._type||(this._type=Math.abs(d*o)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,o+=this._lastValue)),i.shiftKey&&o&&(o/=4),this._type&&(this._lastWheelEvent=i,this._delta-=o,this._active||this._start(i)),i.preventDefault()}_onTimeout(i){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(i)}_start(i){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const o=Un(this._el,i);this._aroundPoint=this._aroundCenter?this._map.transform.centerPoint:o,this._aroundCoord=this._map.transform.pointCoordinate3D(this._aroundPoint),this._targetZoom=void 0,this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const i=this._map.transform;this._type==="wheel"&&i.projection.wrap&&(i._center.lng>=180||i._center.lng<=-180)&&(this._prevEase=null,this._easing=null,this._lastWheelEvent=null,this._lastWheelEventTime=0);const o=()=>i._terrainEnabled()&&this._aroundCoord?i.computeZoomRelativeTo(this._aroundCoord):i.zoom;if(this._delta!==0){const T=this._type==="wheel"&&Math.abs(this._delta)>Vs?this._wheelZoomRate:this._defaultZoomRate;let I=2/(1+Math.exp(-Math.abs(this._delta*T)));this._delta<0&&I!==0&&(I=1/I);const M=o(),C=Math.pow(2,M),D=typeof this._targetZoom=="number"?i.zoomScale(this._targetZoom):C;this._targetZoom=Math.min(i.maxZoom,Math.max(i.minZoom,i.scaleZoom(D*I))),this._type==="wheel"&&(this._startZoom=M,this._easing=this._smoothOutEasing(200)),this._lastDelta=this._delta,this._delta=0}const u=typeof this._targetZoom=="number"?this._targetZoom:o(),d=this._startZoom,m=this._easing;let _,y=!1;if(this._type==="wheel"&&d&&m){const T=Math.min((a.o.now()-this._lastWheelEventTime)/200,1),I=m(T);_=a.am(d,u,I),T<1?this._frameId||(this._frameId=!0):y=!0}else _=u,y=!0;this._active=!0,y&&(this._active=!1,this._finishTimeout=window.setTimeout(()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200));let v=_-o();return v*this._lastDelta<0&&(v=0),{noInertia:!0,needsRenderFrame:!y,zoomDelta:v,around:this._aroundPoint,aroundCoord:this._aroundCoord,originalEvent:this._lastWheelEvent}}_smoothOutEasing(i){let o=a.eL;if(this._prevEase){const u=this._prevEase,d=(a.o.now()-u.start)/u.duration,m=u.easing(d+.01)-u.easing(d),_=.27/Math.sqrt(m*m+1e-4)*.01,y=Math.sqrt(.0729-_*_);o=a.eJ(_,y,.25,1)}return this._prevEase={start:a.o.now(),duration:i,easing:o},o}blur(){this.reset()}reset(){this._active=!1}_addScrollZoomBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=Jt("div","mapboxgl-scroll-zoom-blocker",this._map._container),this._alertContainer.textContent=/(Mac|iPad)/i.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 bu{constructor(i,o){this._clickZoom=i,this._tapZoom=o}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class wu{constructor(){this.reset()}reset(){this._active=!1}blur(){this.reset()}dblclick(i,o){return i.preventDefault(),{cameraAnimation:u=>{u.easeTo({duration:300,zoom:u.getZoom()+(i.shiftKey?-1:1),around:u.unproject(o)},{originalEvent:i})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class lp{constructor(){this._tap=new uo({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,this._swipePoint=void 0,this._swipeTouch=0,this._tapTime=0,this._tap.reset()}touchstart(i,o,u){this._swipePoint||(this._tapTime&&i.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?u.length>0&&(this._swipePoint=o[0],this._swipeTouch=u[0].identifier):this._tap.touchstart(i,o,u))}touchmove(i,o,u){if(this._tapTime){if(this._swipePoint){if(u[0].identifier!==this._swipeTouch)return;const d=o[0],m=d.y-this._swipePoint.y;return this._swipePoint=d,i.preventDefault(),this._active=!0,{zoomDelta:m/128}}}else this._tap.touchmove(i,o,u)}touchend(i,o,u){this._tapTime?this._swipePoint&&u.length===0&&this.reset():this._tap.touchend(i,o,u)&&(this._tapTime=i.timeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class gd{constructor(i,o,u){this._el=i,this._mousePan=o,this._touchPan=u}enable(i){this._inertiaOptions=i||{},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 cp{constructor(i,o,u){this._pitchWithRotate=i.pitchWithRotate,this._mouseRotate=o,this._mousePitch=u}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class up{constructor(i,o,u,d){this._el=i,this._touchZoom=o,this._touchRotate=u,this._tapDragZoom=d,this._rotationDisabled=!1,this._enabled=!0}enable(i){this._touchZoom.enable(i),this._rotationDisabled||this._touchRotate.enable(i),this._tapDragZoom.enable(),this._el.classList.add("mapboxgl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("mapboxgl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}const Nl=l=>l.zoom||l.drag||l.pitch||l.rotate;class hp extends a.C{}class dp{constructor(){this.constants=[1,1,.01],this.radius=0}setup(i,o){const u=a.ax([],o,i);this.radius=a.ai(u[2]<0?a.eN([],u,this.constants):[u[0],u[1],0])}projectRay(i){a.eN(i,i,this.constants),a.ay(i,i),a.eO(i,i,this.constants);const o=a.bK([],i,this.radius);if(o[2]>0){const u=a.bK([],[0,0,1],a.bj(o,[0,0,1])),d=a.bK([],a.ay([],[o[0],o[1],0]),this.radius),m=a.cP([],o,a.bK([],a.ax([],a.cP([],d,u),o),2));o[0]=m[0],o[1]=m[1]}return o}}function Ul(l){return l.panDelta&&l.panDelta.mag()||l.zoomDelta||l.bearingDelta||l.pitchDelta}class fp{constructor(i,o){this._map=i,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new ap(i),this._bearingSnap=o.bearingSnap,this._previousActiveHandlers={},this._trackingEllipsoid=new dp,this._dragOrigin=null,this._eventsInProgress={},this._addDefaultHandlers(o),a.a_(["handleEvent","handleWindowEvent"],this);const u=this._el;this._listeners=[[u,"touchstart",{passive:!0}],[u,"touchmove",{passive:!1}],[u,"touchend",void 0],[u,"touchcancel",void 0],[u,"mousedown",void 0],[u,"mousemove",void 0],[u,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[u,"mouseover",void 0],[u,"mouseout",void 0],[u,"dblclick",void 0],[u,"click",void 0],[u,"keydown",{capture:!1}],[u,"keyup",void 0],[u,"wheel",{passive:!1}],[u,"contextmenu",void 0],[window,"blur",void 0]];for(const[d,m,_]of this._listeners){const y=d===document?this.handleWindowEvent:this.handleEvent;d.addEventListener(m,y,_)}}destroy(){for(const[i,o,u]of this._listeners){const d=i===document?this.handleWindowEvent:this.handleEvent;i.removeEventListener(o,d,u)}}_addDefaultHandlers(i){const o=this._map,u=o.getCanvasContainer();this._add("mapEvent",new sd(o,i));const d=o.boxZoom=new ld(o,i);this._add("boxZoom",d);const m=new za,_=new wu;o.doubleClickZoom=new bu(_,m),this._add("tapZoom",m),this._add("clickZoom",_);const y=new lp;this._add("tapDragZoom",y);const v=o.touchPitch=new fd(o);this._add("touchPitch",v);const T=new gu(i),I=new Bl(i);o.dragRotate=new cp(i,T,I),this._add("mouseRotate",T,["mousePitch"]),this._add("mousePitch",I,["mouseRotate"]);const M=new On(i),C=new hd(o,i);o.dragPan=new gd(u,M,C),this._add("mousePan",M),this._add("touchPan",C,["touchZoom","touchRotate"]);const D=new Bs,F=new dd;o.touchZoomRotate=new up(u,F,D,y),this._add("touchRotate",D,["touchPan","touchZoom"]),this._add("touchZoom",F,["touchPan","touchRotate"]),this._add("blockableMapEvent",new ad(o));const z=o.scrollZoom=new vu(o,this);this._add("scrollZoom",z,["mousePan"]);const V=o.keyboard=new ks;this._add("keyboard",V);for(const N of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])i.interactive&&i[N]&&o[N].enable(i[N])}_add(i,o,u){this._handlers.push({handlerName:i,handler:o,allowed:u}),this._handlersById[i]=o}stop(i){if(!this._updatingCamera){for(const{handler:o}of this._handlers)o.reset();this._inertia.clear(),this._fireEvents({},{},i),this._changes=[],this._originalZoom=void 0}}isActive(){for(const{handler:i}of this._handlers)if(i.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!Nl(this._eventsInProgress)||this.isZooming()}_isDragging(){return!!this._eventsInProgress.drag}_blockedByActive(i,o,u){for(const d in i)if(d!==u&&(!o||o.indexOf(d)<0))return!0;return!1}handleWindowEvent(i){this.handleEvent(i,`${i.type}Window`)}_getMapTouches(i){const o=[];for(const u of i)this._el.contains(u.target)&&o.push(u);return o}handleEvent(i,o){this._updatingCamera=!0;const u=i.type==="renderFrame",d=u?void 0:i,m={needsRenderFrame:!1},_={},y={},v=i.touches?this._getMapTouches(i.touches):void 0,T=v?bo(this._el,v):u?void 0:Un(this._el,i);for(const{handlerName:C,handler:D,allowed:F}of this._handlers){if(!D.isEnabled())continue;let z;this._blockedByActive(y,F,C)?D.reset():D[o||i.type]&&(z=D[o||i.type](i,T,v),this.mergeHandlerResult(m,_,z,C,d),z&&z.needsRenderFrame&&this._triggerRenderFrame()),(z||D.isActive())&&(y[C]=D)}const I={};for(const C in this._previousActiveHandlers)y[C]||(I[C]=d);this._previousActiveHandlers=y,(Object.keys(I).length||Ul(m))&&(this._changes.push([m,_,I]),this._triggerRenderFrame()),(Object.keys(y).length||Ul(m))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:M}=m;M&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],M(this._map))}mergeHandlerResult(i,o,u,d,m){if(!u)return;Object.assign(i,u);const _={handlerName:d,originalEvent:u.originalEvent||m};u.zoomDelta!==void 0&&(o.zoom=_),u.panDelta!==void 0&&(o.drag=_),u.pitchDelta!==void 0&&(o.pitch=_),u.bearingDelta!==void 0&&(o.rotate=_)}_applyChanges(){const i={},o={},u={};for(const[d,m,_]of this._changes)d.panDelta&&(i.panDelta=(i.panDelta||new a.P(0,0))._add(d.panDelta)),d.zoomDelta&&(i.zoomDelta=(i.zoomDelta||0)+d.zoomDelta),d.bearingDelta&&(i.bearingDelta=(i.bearingDelta||0)+d.bearingDelta),d.pitchDelta&&(i.pitchDelta=(i.pitchDelta||0)+d.pitchDelta),d.around!==void 0&&(i.around=d.around),d.aroundCoord!==void 0&&(i.aroundCoord=d.aroundCoord),d.pinchAround!==void 0&&(i.pinchAround=d.pinchAround),d.noInertia&&(i.noInertia=d.noInertia),Object.assign(o,m),Object.assign(u,_);this._updateMapTransform(i,o,u),this._changes=[]}_updateMapTransform(i,o,u){const d=this._map,m=d.transform,_=$=>[$.x,$.y,$.z];if((()=>{const $=this._eventsInProgress.drag;return $&&!this._handlersById[$.handlerName].isActive()})()&&!Ul(i)){const $=m.zoom;m.cameraElevationReference="sea",this._originalZoom!=null&&m._orthographicProjectionAtLowPitch&&m.projection.name!=="globe"&&m.pitch===0?(m.cameraElevationReference="ground",m.zoom=this._originalZoom):(m.recenterOnTerrain(),m.cameraElevationReference="ground"),$!==m.zoom&&this._map._update(!0)}if(m._isCameraConstrained&&d._stop(!0),!Ul(i))return void this._fireEvents(o,u,!0);let{panDelta:y,zoomDelta:v,bearingDelta:T,pitchDelta:I,around:M,aroundCoord:C,pinchAround:D}=i;m._isCameraConstrained&&(v>0&&(v=0),m._isCameraConstrained=!1),D!==void 0&&(M=D),(v||($=>o[$]&&!this._eventsInProgress[$])("drag"))&&M&&(this._dragOrigin=_(m.pointCoordinate3D(M)),this._originalZoom=m.zoom,this._trackingEllipsoid.setup(m._camera.position,this._dragOrigin)),m.cameraElevationReference="sea",d._stop(!0),M=M||d.transform.centerPoint,T&&(m.bearing+=T),I&&(m.pitch+=I),m._updateCameraState();const F=[0,0,0];if(y)if(m.projection.name==="mercator"){const $=this._trackingEllipsoid.projectRay(m.screenPointToMercatorRay(M).dir),H=this._trackingEllipsoid.projectRay(m.screenPointToMercatorRay(M.sub(y)).dir);F[0]=H[0]-$[0],F[1]=H[1]-$[1]}else{const $=m.pointCoordinate(M);if(m.projection.name==="globe"){y=y.rotate(-m.angle);const H=m._pixelsPerMercatorPixel/m.worldSize;F[0]=-y.x*a.eM(a.bW($.y))*H,F[1]=-y.y*a.eM(m.center.lat)*H}else{const H=m.pointCoordinate(M.sub(y));$&&H&&(F[0]=H.x-$.x,F[1]=H.y-$.y)}}const z=m.zoom,V=[0,0,0];if(v){const $=_(C||m.pointCoordinate3D(M)),H={dir:a.ay([],a.ax([],$,m._camera.position))};if(H.dir[2]<0){const j=m.zoomDeltaToMovement($,v);a.bK(V,H.dir,j)}}const N=a.cP(F,F,V);m._translateCameraConstrained(N),v&&Math.abs(m.zoom-z)>1e-4&&m.recenterOnTerrain(),m.cameraElevationReference="ground",this._map._update(),i.noInertia||this._inertia.record(i),this._fireEvents(o,u,!0)}_fireEvents(i,o,u){const d=Nl(this._eventsInProgress),m=Nl(i),_={};for(const I in i){const{originalEvent:M}=i[I];this._eventsInProgress[I]||(_[`${I}start`]=M),this._eventsInProgress[I]=i[I]}!d&&m&&this._fireEvent("movestart",m.originalEvent);for(const I in _)this._fireEvent(I,_[I]);m&&this._fireEvent("move",m.originalEvent);for(const I in i){const{originalEvent:M}=i[I];this._fireEvent(I,M)}const y={};let v;for(const I in this._eventsInProgress){const{handlerName:M,originalEvent:C}=this._eventsInProgress[I];this._handlersById[M].isActive()||(delete this._eventsInProgress[I],v=o[M]||C,y[`${I}end`]=v)}for(const I in y)this._fireEvent(I,y[I]);const T=Nl(this._eventsInProgress);if(u&&(d||m)&&!T){this._updatingCamera=!0;const I=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),M=C=>C!==0&&-this._bearingSnap<C&&C<this._bearingSnap;I?(M(I.bearing||this._map.getBearing())&&(I.bearing=0),this._map.easeTo(I,{originalEvent:v})):(this._map.fire(new a.C("moveend",{originalEvent:v})),M(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(i,o){this._map.fire(new a.C(i,o?{originalEvent:o}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(i=>{this._frameId=void 0,this.handleEvent(new hp("renderFrame",{timeStamp:i})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}const yd="map.setFreeCameraOptions(...) and map.getFreeCameraOptions() are not yet supported for non-mercator projections.";class pp extends a.E{constructor(i,o){super(),this._moving=!1,this._zooming=!1,this.transform=i,this._bearingSnap=o.bearingSnap,this._respectPrefersReducedMotion=o.respectPrefersReducedMotion!==!1,a.a_(["_renderFrameCallback"],this)}getCenter(){return new a.aV(this.transform.center.lng,this.transform.center.lat)}setCenter(i,o){return this.jumpTo({center:i},o)}panBy(i,o,u){return i=a.P.convert(i).mult(-1),this.panTo(this.transform.center,Object.assign({offset:i},o),u)}panTo(i,o,u){return this.easeTo(Object.assign({center:i},o),u)}getZoom(){return this.transform.zoom}setZoom(i,o){return this.jumpTo({zoom:i},o),this}zoomTo(i,o,u){return this.easeTo(Object.assign({zoom:i},o),u)}zoomIn(i,o){return this.zoomTo(this.getZoom()+1,i,o),this}zoomOut(i,o){return this.zoomTo(this.getZoom()-1,i,o),this}getBearing(){return this.transform.bearing}setBearing(i,o){return this.jumpTo({bearing:i},o),this}getPadding(){return this.transform.padding}setPadding(i,o){return this.jumpTo({padding:i},o),this}rotateTo(i,o,u){return this.easeTo(Object.assign({bearing:i},o),u)}resetNorth(i,o){return this.rotateTo(0,Object.assign({duration:1e3},i),o),this}resetNorthPitch(i,o){return this.easeTo(Object.assign({bearing:0,pitch:0,duration:1e3},i),o),this}snapToNorth(i,o){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(i,o):this}getPitch(){return this.transform.pitch}setPitch(i,o){return this.jumpTo({pitch:i},o),this}cameraForBounds(i,o){i=a.aK.convert(i);const u=o&&o.bearing||0,d=o&&o.pitch||0,m=i.getNorthWest(),_=i.getSouthEast();return this._cameraForBounds(this.transform,m,_,u,d,o)}_extendPadding(i){const o={top:0,right:0,bottom:0,left:0};return i==null?Object.assign({},o,this.transform.padding):typeof i=="number"?{top:i,bottom:i,right:i,left:i}:Object.assign({},o,i)}_extendCameraOptions(i){return(i=Object.assign({offset:[0,0],maxZoom:this.transform.maxZoom},i)).padding=this._extendPadding(i.padding),i}_minimumAABBFrustumDistance(i,o){const u=o.max[0]-o.min[0],d=o.max[1]-o.min[1];return u/d>i.aspect?u/(2*Math.tan(.5*i.fovX)*i.aspect):d/(2*Math.tan(.5*i.fovY)*i.aspect)}_cameraForBoundsOnGlobe(i,o,u,d,m,_){const y=i.clone(),v=this._extendCameraOptions(_);y.bearing=d,y.pitch=m;const T=a.aV.convert(o),I=a.aV.convert(u),M=.5*(T.lat+I.lat),C=.5*(T.lng+I.lng),D=a.eP(M,C),F=a.ay([],D),z=a.ay([],a.bi([],F,[0,1,0])),V=a.bi([],z,F),N=[z[0],z[1],z[2],0,V[0],V[1],V[2],0,F[0],F[1],F[2],0,0,0,0,1],$=[D,a.eP(T.lat,T.lng),a.eP(I.lat,T.lng),a.eP(I.lat,I.lng),a.eP(T.lat,I.lng),a.eP(M,T.lng),a.eP(M,I.lng),a.eP(T.lat,C),a.eP(I.lat,C)];let H=a.cQ.fromPoints($.map(we=>[a.bj(z,we),a.bj(V,we),a.bj(F,we)]));const j=a.ah([],H.center,N);a.eQ(j)===0&&a.eR(j,0,0,1),a.ay(j,j),a.bK(j,j,a.aF),y.center=a.eS(j);const ne=y.getWorldToCameraMatrix(),Y=a.b8(new Float64Array(16),ne);H=a.cQ.applyTransform(H,a.aD([],ne,N));const re=this._extendAABB(H,y,v,d);if(!re)return void a.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");H=re,a.ah(j,j,ne);const Z=.5*(H.max[2]-H.min[2]),K=this._minimumAABBFrustumDistance(y,H),te=a.bK([],[0,0,1],Z),de=a.cP(te,j,te),se=K+(y.pitch===0?0:a.bg(j,de)),be=y.globeCenterInViewSpace,_e=a.ax([],j,[be[0],be[1],be[2]]);a.ay(_e,_e),a.bK(_e,_e,se);const Me=a.cP([],j,_e);a.ah(Me,Me,Y);const Le=a.ez/a.aF,fe=a.ai(Me),le=a.bV(Math.max(fe*Le-a.ez,Number.EPSILON),0),xe=Math.min(y.zoomFromMercatorZAdjusted(le),v.maxZoom);return xe>.5*(a.cF+a.cq)?(y.setProjection({name:"mercator"}),y.zoom=xe,this._cameraForBounds(y,o,u,d,m,_)):{center:y.center,zoom:xe,bearing:d,pitch:m}}_extendAABB(i,o,u,d){const m=.5*((u.padding.left||0)+(u.padding.right||0)),_=.5*((u.padding.top||0)+(u.padding.bottom||0)),y=_,v=m,T=m,I=_,M=o.width-(v+T),C=o.height-(y+I),D=a.ax([],i.max,i.min),F=Math.min(M/D[0],C/D[1]),z=Math.min(o.scaleZoom(o.scale*F),u.maxZoom);if(isNaN(z))return null;const V=o.scale/o.zoomScale(z),N=new a.cQ([i.min[0]-v*V,i.min[1]-I*V,i.min[2]],[i.max[0]+T*V,i.max[1]+y*V,i.max[2]]),$=(typeof u.offset.x=="number"&&typeof u.offset.y=="number"?new a.P(u.offset.x,u.offset.y):a.P.convert(u.offset)).rotate(-a.ap(d));return N.center[0]-=$.x*V,N.center[1]+=$.y*V,N}queryTerrainElevation(i,o){const u=this.transform.elevation;return u?(o=Object.assign({},{exaggerated:!0},o),u.getAtPoint(a.ag.fromLngLat(i),null,o.exaggerated)):null}_cameraForBounds(i,o,u,d,m,_){if(i.projection.name==="globe")return this._cameraForBoundsOnGlobe(i,o,u,d,m,_);const y=i.clone(),v=this._extendCameraOptions(_);y.bearing=d,y.pitch=m;const T=a.aV.convert(o),I=a.aV.convert(u),M=new a.aV(T.lng,I.lat),C=new a.aV(I.lng,T.lat),D=y.project(T),F=y.project(I),z=this.queryTerrainElevation(T),V=this.queryTerrainElevation(I),N=this.queryTerrainElevation(M),$=this.queryTerrainElevation(C),H=[[D.x,D.y,Math.min(z||0,V||0,N||0,$||0)],[F.x,F.y,Math.max(z||0,V||0,N||0,$||0)]];let j=a.cQ.fromPoints(H);const ne=y.getWorldToCameraMatrix(),Y=a.b8(new Float64Array(16),ne);j=a.cQ.applyTransform(j,ne);const re=this._extendAABB(j,y,v,d);if(!re)return void a.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");j=re;const Z=.5*a.ax([],j.max,j.min)[2],K=this._minimumAABBFrustumDistance(y,j),te=[0,0,1,0];a.aE(te,te,ne),a.eT(te,te);const de=a.bK([],te,K+Z),se=a.cP([],j.center,de);a.ah(j.center,j.center,Y),a.ah(se,se,Y);const be=y.unproject(new a.P(j.center[0],j.center[1])),_e=a.eU(y.projection,be),Me=Math.pow(2,_e),Le=Math.min(y._zoomFromMercatorZ(se[2]*y.pixelsPerMeter*Me/y.worldSize),v.maxZoom);return y.mercatorFromTransition&&Le<.5*(a.cF+a.cq)?(y.setProjection({name:"globe"}),y.zoom=Le,this._cameraForBounds(y,o,u,d,m,_)):{center:be,zoom:Le,bearing:d,pitch:m}}fitBounds(i,o,u){const d=this.cameraForBounds(i,o);return this._fitInternal(d,o,u)}fitScreenCoordinates(i,o,u,d,m){const _=a.P.convert(i),y=a.P.convert(o),v=new a.P(Math.min(_.x,y.x),Math.min(_.y,y.y)),T=new a.P(Math.max(_.x,y.x),Math.max(_.y,y.y));if(this.transform.projection.name==="mercator"&&this.transform.anyCornerOffEdge(_,y))return this;const I=this.transform.pointLocation3D(v),M=this.transform.pointLocation3D(T),C=this.transform.pointLocation3D(new a.P(v.x,T.y)),D=this.transform.pointLocation3D(new a.P(T.x,v.y)),F=[Math.min(I.lng,M.lng,C.lng,D.lng),Math.min(I.lat,M.lat,C.lat,D.lat)],z=[Math.max(I.lng,M.lng,C.lng,D.lng),Math.max(I.lat,M.lat,C.lat,D.lat)],V=d&&d.pitch?d.pitch:this.getPitch(),N=this._cameraForBounds(this.transform,F,z,u,V,d);return this._fitInternal(N,d,m)}_fitInternal(i,o,u){return i?(o=Object.assign(i,o)).linear?this.easeTo(o,u):this.flyTo(o,u):this}jumpTo(i,o){this.stop();const u=i.preloadOnly?this.transform.clone():this.transform;let d=!1,m=!1,_=!1;"zoom"in i&&u.zoom!==+i.zoom&&(d=!0,u.zoom=+i.zoom),i.center!==void 0&&(u.center=a.aV.convert(i.center)),"bearing"in i&&u.bearing!==+i.bearing&&(m=!0,u.bearing=+i.bearing),"pitch"in i&&u.pitch!==+i.pitch&&(_=!0,u.pitch=+i.pitch);const y=typeof i.padding=="number"?this._extendPadding(i.padding):i.padding;if(i.padding!=null&&!u.isPaddingEqual(y))if(i.retainPadding===!1){const v=u.clone();v.padding=y,u.setLocationAtPoint(u.center,v.centerPoint)}else u.padding=y;return i.preloadOnly?(this._preloadTiles(u),this):(this.fire(new a.C("movestart",o)).fire(new a.C("move",o)),d&&this.fire(new a.C("zoomstart",o)).fire(new a.C("zoom",o)).fire(new a.C("zoomend",o)),m&&this.fire(new a.C("rotatestart",o)).fire(new a.C("rotate",o)).fire(new a.C("rotateend",o)),_&&this.fire(new a.C("pitchstart",o)).fire(new a.C("pitch",o)).fire(new a.C("pitchend",o)),this.fire(new a.C("moveend",o)))}getFreeCameraOptions(){return this.transform.projection.supportsFreeCamera||a.w(yd),this.transform.getFreeCameraOptions()}setFreeCameraOptions(i,o){const u=this.transform;if(!u.projection.supportsFreeCamera)return a.w(yd),this;this.stop();const d=u.zoom,m=u.pitch,_=u.bearing;u.setFreeCameraOptions(i);const y=d!==u.zoom,v=m!==u.pitch,T=_!==u.bearing;return this.fire(new a.C("movestart",o)).fire(new a.C("move",o)),y&&this.fire(new a.C("zoomstart",o)).fire(new a.C("zoom",o)).fire(new a.C("zoomend",o)),T&&this.fire(new a.C("rotatestart",o)).fire(new a.C("rotate",o)).fire(new a.C("rotateend",o)),v&&this.fire(new a.C("pitchstart",o)).fire(new a.C("pitch",o)).fire(new a.C("pitchend",o)),this.fire(new a.C("moveend",o)),this}easeTo(i,o){this._stop(!1,i.easeId),((i=Object.assign({offset:[0,0],duration:500,easing:a.eL},i)).animate===!1||this._prefersReducedMotion(i))&&(i.duration=0);const u=this.transform,d=this.getZoom(),m=this.getBearing(),_=this.getPitch(),y=this.getPadding(),v="zoom"in i?+i.zoom:d,T="bearing"in i?this._normalizeBearing(i.bearing,m):m,I="pitch"in i?+i.pitch:_,M=this._extendPadding(i.padding),C=a.P.convert(i.offset);let D,F,z;if(u.projection.name==="globe"){const te=a.ag.fromLngLat(u.center),de=C.rotate(-u.angle);te.x+=de.x/u.worldSize,te.y+=de.y/u.worldSize;const se=te.toLngLat(),be=a.aV.convert(i.center||se);this._normalizeCenter(be),D=u.centerPoint.add(de),F=new a.P(te.x,te.y).mult(u.worldSize),z=new a.P(a.aH(be.lng),a.aL(be.lat)).mult(u.worldSize).sub(F)}else{D=u.centerPoint.add(C);const te=u.pointLocation(D),de=a.aV.convert(i.center||te);this._normalizeCenter(de),F=u.project(te),z=u.project(de).sub(F)}const V=u.zoomScale(v-d);let N,$;i.around&&(N=a.aV.convert(i.around),$=u.locationPoint(N));const H=this._zooming||v!==d,j=this._rotating||m!==T,ne=this._pitching||I!==_,Y=!u.isPaddingEqual(M),re=i.retainPadding===!1?u.clone():u,Z=te=>de=>{if(H&&(te.zoom=a.am(d,v,de)),j&&(te.bearing=a.am(m,T,de)),ne&&(te.pitch=a.am(_,I,de)),Y&&(re.interpolatePadding(y,M,de),D=re.centerPoint.add(C)),N)te.setLocationAtPoint(N,$);else{const se=te.zoomScale(te.zoom-d),be=v>d?Math.min(2,V):Math.max(.5,V),_e=Math.pow(be,1-de),Me=te.unproject(F.add(z.mult(de*_e)).mult(se));te.setLocationAtPoint(te.renderWorldCopies?Me.wrap():Me,D)}return i.preloadOnly||this._fireMoveEvents(o),te};if(i.preloadOnly){const te=this._emulate(Z,i.duration,u);return this._preloadTiles(te),this}const K={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=H,this._rotating=j,this._pitching=ne,this._padding=Y,this._easeId=i.easeId,this._prepareEase(o,i.noMoveStart,K),this._ease(Z(u),te=>{u.cameraElevationReference==="sea"&&u.recenterOnTerrain(),this._afterEase(o,te)},i),this}_prepareEase(i,o,u={}){this._moving=!0,this.transform.cameraElevationReference="sea",this.transform._orthographicProjectionAtLowPitch&&this.transform.pitch===0&&this.transform.projection.name!=="globe"&&(this.transform.cameraElevationReference="ground"),o||u.moving||this.fire(new a.C("movestart",i)),this._zooming&&!u.zooming&&this.fire(new a.C("zoomstart",i)),this._rotating&&!u.rotating&&this.fire(new a.C("rotatestart",i)),this._pitching&&!u.pitching&&this.fire(new a.C("pitchstart",i))}_fireMoveEvents(i){this.fire(new a.C("move",i)),this._zooming&&this.fire(new a.C("zoom",i)),this._rotating&&this.fire(new a.C("rotate",i)),this._pitching&&this.fire(new a.C("pitch",i))}_afterEase(i,o){if(this._easeId&&o&&this._easeId===o)return;this._easeId=void 0,this.transform.cameraElevationReference="ground";const u=this._zooming,d=this._rotating,m=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,u&&this.fire(new a.C("zoomend",i)),d&&this.fire(new a.C("rotateend",i)),m&&this.fire(new a.C("pitchend",i)),this.fire(new a.C("moveend",i))}flyTo(i,o){if(this._prefersReducedMotion(i)){const we=a.aJ(i,["center","zoom","bearing","pitch","around","padding","retainPadding"]);return this.jumpTo(we,o)}this.stop(),i=Object.assign({offset:[0,0],speed:1.2,curve:1.42,easing:a.eL},i);const u=this.transform,d=this.getZoom(),m=this.getBearing(),_=this.getPitch(),y=this.getPadding(),v="zoom"in i?a.aC(+i.zoom,u.minZoom,u.maxZoom):d,T="bearing"in i?this._normalizeBearing(i.bearing,m):m,I="pitch"in i?+i.pitch:_,M=this._extendPadding(i.padding),C=u.zoomScale(v-d),D=a.P.convert(i.offset);let F=u.centerPoint.add(D);const z=u.pointLocation(F),V=a.aV.convert(i.center||z);this._normalizeCenter(V);const N=u.project(z),$=u.project(V).sub(N);let H=i.curve;const j=Math.max(u.width,u.height),ne=j/C,Y=$.mag();if("minZoom"in i){const we=a.aC(Math.min(i.minZoom,d,v),u.minZoom,u.maxZoom),Se=j/u.zoomScale(we-d);H=Math.sqrt(Se/Y*2)}const re=H*H;function Z(we){const Se=(ne*ne-j*j+(we?-1:1)*re*re*Y*Y)/(2*(we?ne:j)*re*Y);return Math.log(Math.sqrt(Se*Se+1)-Se)}function K(we){return(Math.exp(we)-Math.exp(-we))/2}function te(we){return(Math.exp(we)+Math.exp(-we))/2}const de=Z(0);let se=function(we){return te(de)/te(de+H*we)},be=function(we){return j*((te(de)*(K(Se=de+H*we)/te(Se))-K(de))/re)/Y;var Se},_e=(Z(1)-de)/H;if(Math.abs(Y)<1e-6||!isFinite(_e)){if(Math.abs(j-ne)<1e-6)return this.easeTo(i,o);const we=ne<j?-1:1;_e=Math.abs(Math.log(ne/j))/H,be=function(){return 0},se=function(Se){return Math.exp(we*H*Se)}}i.duration="duration"in i?+i.duration:1e3*_e/("screenSpeed"in i?+i.screenSpeed/H:+i.speed),i.maxDuration&&i.duration>i.maxDuration&&(i.duration=0);const Me=m!==T,Le=I!==_,fe=!u.isPaddingEqual(M),le=i.retainPadding===!1?u.clone():u,xe=we=>Se=>{const $e=Se*_e,Ve=1/se($e);we.zoom=Se===1?v:d+we.scaleZoom(Ve),Me&&(we.bearing=a.am(m,T,Se)),Le&&(we.pitch=a.am(_,I,Se)),fe&&(le.interpolatePadding(y,M,Se),F=le.centerPoint.add(D));const Ne=Se===1?V:we.unproject(N.add($.mult(be($e))).mult(Ve));return we.setLocationAtPoint(we.renderWorldCopies?Ne.wrap():Ne,F),we._updateCameraOnTerrain(),i.preloadOnly||this._fireMoveEvents(o),we};if(i.preloadOnly){const we=this._emulate(xe,i.duration,u);return this._preloadTiles(we),this}return this._zooming=!0,this._rotating=Me,this._pitching=Le,this._padding=fe,this._prepareEase(o,!1),this._ease(xe(u),()=>this._afterEase(o),i),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_requestRenderFrame(i){}_cancelRenderFrame(i){}_stop(i,o){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),this._easeFrameId=void 0,this._onEaseFrame=void 0),this._onEaseEnd){const u=this._onEaseEnd;this._onEaseEnd=void 0,u.call(this,o)}if(!i){const u=this.handlers;u&&u.stop(!1)}return this}_ease(i,o,u){u.animate===!1||u.duration===0?(i(1),o()):(this._easeStart=a.o.now(),this._easeOptions=u,this._onEaseFrame=i,this._onEaseEnd=o,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const i=Math.min((a.o.now()-this._easeStart)/this._easeOptions.duration,1),o=this._onEaseFrame;o&&o(this._easeOptions.easing(i)),i<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(i,o){i=a.bt(i,-180,180);const u=Math.abs(i-o);return Math.abs(i-360-o)<u&&(i-=360),Math.abs(i+360-o)<u&&(i+=360),i}_normalizeCenter(i){const o=this.transform;if(o.maxBounds||o.projection.name!=="globe"&&!o.renderWorldCopies)return;const u=i.lng-o.center.lng;i.lng+=u>180?-360:u<-180?360:0}_prefersReducedMotion(i){return this._respectPrefersReducedMotion&&a.o.prefersReducedMotion&&!(i&&i.essential)}_emulate(i,o,u){const d=Math.ceil(15*o/1e3),m=[],_=i(u.clone());for(let y=0;y<=d;y++){const v=_(y/d);m.push(v.clone())}return m}_preloadTiles(i,o){}}class xd{constructor(i={}){this.options=i,a.a_(["_toggleAttribution","_updateEditLink","_updateData","_updateCompact"],this)}getDefaultPosition(){return"bottom-right"}onAdd(i){const o=this.options&&this.options.compact,u=i._getUIString("AttributionControl.ToggleAttribution");this._map=i,this._container=Jt("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=Jt("button","mapboxgl-ctrl-attrib-button",this._container),this._compactButton.type="button",this._compactButton.addEventListener("click",this._toggleAttribution),this._compactButton.setAttribute("aria-label",u);const d=Jt("span","mapboxgl-ctrl-icon",this._compactButton);return d.setAttribute("aria-hidden","true"),d.setAttribute("title",u),this._innerContainer=Jt("div","mapboxgl-ctrl-attrib-inner",this._container),o&&this._container.classList.add("mapboxgl-compact"),this._updateAttributions(),this._updateEditLink(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("moveend",this._updateEditLink),o===void 0&&(this._map.on("resize",this._updateCompact),this._updateCompact()),this._container}onRemove(){this._container.remove(),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("moveend",this._updateEditLink),this._map.off("resize",this._updateCompact),this._map=void 0,this._attribHTML=void 0}_toggleAttribution(){this._container.classList.contains("mapboxgl-compact-show")?(this._container.classList.remove("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","false")):(this._container.classList.add("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","true"))}_updateEditLink(){let i=this._editLink;i||(i=this._editLink=this._container.querySelector(".mapbox-improve-map"));const o=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:this._map._requestManager._customAccessToken||a.e.ACCESS_TOKEN}];if(i){const u=o.reduce((d,m,_)=>(m.value&&(d+=`${m.key}=${m.value}${_<o.length-1?"&":""}`),d),"?");i.href=`${a.e.FEEDBACK_URL}/${u}#${Or(this._map,!0)}`,i.rel="noopener nofollow"}}_updateData(i){!i||(i.dataType!=="source"||i.sourceDataType!=="metadata"&&i.sourceDataType!=="visibility")&&i.dataType!=="style"||(this._updateAttributions(),this._updateEditLink())}_updateAttributions(){if(!this._map.style)return;let i=[];if(this._map.style.stylesheet){const d=this._map.style.stylesheet;this.styleOwner=d.owner,this.styleId=d.id}const o=this._map.style._mergedSourceCaches;for(const d in o){const m=o[d];if(m.used){const _=m.getSource();_.attribution&&i.indexOf(_.attribution)<0&&i.push(_.attribution)}}i.sort((d,m)=>d.length-m.length),i=i.filter((d,m)=>{for(let _=m+1;_<i.length;_++)if(i[_].indexOf(d)>=0)return!1;return!0}),this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?i=[...this.options.customAttribution,...i]:i.unshift(this.options.customAttribution));const u=i.map(d=>function(m){const _=new DOMParser().parseFromString(m,"text/html");return Array.from(_.body.querySelectorAll("*")).reverse().forEach(y=>{const v=y.textContent||"";if(y.tagName!=="A")return void y.replaceWith(...y.childNodes);const T=y.getAttribute("href");if(!T||!/^(https?:|mailto:)/i.test(T))return void y.replaceWith(_.createTextNode(v));const I=_.createElement("a");I.href=T,I.textContent=v,I.rel="noopener nofollow";const M=y.getAttribute("class");M&&(I.className=M),y.replaceWith(I)}),_.body.innerHTML}(d)).join(" | ");u!==this._attribHTML&&(this._attribHTML=u,i.length?(this._innerContainer.innerHTML=u,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 vd{constructor(){a.a_(["_updateLogo","_updateCompact"],this)}onAdd(i){this._map=i,this._container=Jt("div","mapboxgl-ctrl");const o=Jt("a","mapboxgl-ctrl-logo");return o.target="_blank",o.rel="noopener nofollow",o.href="https://www.mapbox.com/",o.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),o.setAttribute("rel","noopener nofollow"),this._container.appendChild(o),this._container.style.display="none",this._map.on("sourcedata",this._updateLogo),this._updateLogo(),this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){this._container.remove(),this._map.off("sourcedata",this._updateLogo),this._map.off("resize",this._updateCompact)}getDefaultPosition(){return"bottom-left"}_updateLogo(i){i&&i.sourceDataType!=="metadata"||(this._container.style.display=this._logoRequired()?"block":"none")}_logoRequired(){if(!this._map.style)return!0;const i=this._map.style._sourceCaches;if(Object.entries(i).length===0)return!0;for(const o in i){const u=i[o].getSource();if(u.hasOwnProperty("mapbox_logo")&&!u.mapbox_logo)return!1}return!0}_updateCompact(){const i=this._container.children;if(i.length){const o=i[0];this._map.getCanvasContainer().offsetWidth<250?o.classList.add("mapboxgl-compact"):o.classList.remove("mapboxgl-compact")}}}class mp{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(i){const o=++this._id;return this._queue.push({callback:i,id:o,cancelled:!1}),o}remove(i){const o=this._currentlyRunning,u=o?this._queue.concat(o):this._queue;for(const d of u)if(d.id===i)return void(d.cancelled=!0)}run(i=0){const o=this._currentlyRunning=this._queue;this._queue=[];for(const u of o)if(!u.cancelled&&(u.callback(i),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}class s_{constructor(i){this.jumpTo(i)}getValue(i){if(i<=this._startTime)return this._start;if(i>=this._endTime)return this._end;const o=a.dj((i-this._startTime)/(this._endTime-this._startTime));return this._start*(1-o)+this._end*o}isEasing(i){return i>=this._startTime&&i<=this._endTime}jumpTo(i){this._startTime=-1/0,this._endTime=-1/0,this._start=i,this._end=i}easeTo(i,o,u){this._start=this.getValue(o),this._end=i,this._startTime=o,this._endTime=o+u}}const a_={"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 oi extends a.C{constructor(i,o,u,d){const{point:m,lngLat:_,originalEvent:y,target:v}=i;super(i.type,{point:m,lngLat:_,originalEvent:y,target:v}),this.preventDefault=()=>{i.preventDefault()},this.id=o,this.interaction=u,this.feature=d}}class Tu{constructor(i){this.map=i,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(i,o){if(this.typeById.has(i))throw new Error(`Interaction id "${i}" already exists.`);const u=o.filter;let d=o.type;u&&this.filters.set(i,a.dc(u)),d==="mouseover"&&(d="mouseenter"),d==="mouseout"&&(d="mouseleave");const m=this.interactionsByType.get(d)||new Map;d==="mouseenter"||d==="mouseleave"?(this.delegatedInteractions.size===0&&(this.map.on("mousemove",this.handleMove),this.map.on("mouseout",this.handleOut)),this.delegatedInteractions.set(i,o)):m.size===0&&this.map.on(d,this.handleType),m.size===0&&this.interactionsByType.set(d,m),m.set(i,o),this.typeById.set(i,d)}get(i){const o=this.typeById.get(i);if(!o)return;const u=this.interactionsByType.get(o);return u?u.get(i):void 0}remove(i){const o=this.typeById.get(i);if(!o)return;this.typeById.delete(i),this.filters.delete(i);const u=this.interactionsByType.get(o);u&&(u.delete(i),o==="mouseenter"||o==="mouseleave"?(this.delegatedInteractions.delete(i),this.delegatedInteractions.size===0&&(this.map.off("mousemove",this.handleMove),this.map.off("mouseout",this.handleOut))):u.size===0&&this.map.off(o,this.handleType))}queryTargets(i,o){const u=[];for(const[d,m]of o)m.target&&u.push({targetId:d,target:m.target,filter:this.filters.get(d)});return this.map.style.queryRenderedTargets(i,u,this.map.transform)}handleMove(i){this.prevHoveredFeatures=this.hoveredFeatures,this.hoveredFeatures=new Map;const o=this.queryTargets(i.point,Array.from(this.delegatedInteractions).reverse());o.length&&(i.type="mouseenter",this.handleType(i,o));const u=new Map;for(const[d,{feature:m}]of this.prevHoveredFeatures)this.hoveredFeatures.has(d)||u.set(m.id,m);u.size&&(i.type="mouseleave",this.handleType(i,Array.from(u.values())))}handleOut(i){const o=Array.from(this.hoveredFeatures.values()).map(({feature:u})=>u);o.length&&(i.type="mouseleave",this.handleType(i,o)),this.hoveredFeatures.clear()}handleType(i,o){const u=i.type==="mouseenter";if(u&&!this.interactionsByType.has(i.type))return void a.w("mouseenter interaction required for mouseleave to work.");const d=Array.from(this.interactionsByType.get(i.type)).reverse(),m=!!o;o=o||this.queryTargets(i.point,d);let _=!1;const y=new Set;for(const v of o){for(const[T,I]of d){if(!I.target)continue;const M=v.variants?v.variants[T]:null;if(M){for(const C of M){if(Ju(C,v,y,T))continue;const D=new a.de(v,C),F=Qu(C,v,T);m&&D.id!==void 0&&(D.state=this.map.getFeatureState(D));const z=u?this.prevHoveredFeatures.get(F):null,V=new oi(i,T,I,D),N=z?z.stop:I.handler(V);if(u&&this.hoveredFeatures.set(F,{feature:v,stop:N}),N!==!1){_=!0;break}}if(_)break}}if(_)break}if(!_)for(const[v,T]of d){const{handler:I,target:M}=T;if(!M&&I(new oi(i,v,T,null))!==!1)break}}}function l_(l,i){if(Array.isArray(l)&&Array.isArray(i)){const o=new Set(l),u=new Set(i);return o.size===u.size&&l.every(d=>u.has(d))}return a.b7(l,i)}const c_={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,transformRequest:null,accessToken:null,fadeDuration:300,respectPrefersReducedMotion:!0,crossSourceCollisions:!0,collectResourceTiming:!1,testMode:!1,precompilePrograms:!0,scaleFactor:1,spriteFormat:"auto"},u_={showCompass:!0,showZoom:!0,visualizePitch:!1};class jl{constructor(i,o,u=!1){this._clickTolerance=10,this.element=o,this.mouseRotate=new gu({clickTolerance:i.dragRotate._mouseRotate._clickTolerance}),this.map=i,u&&(this.mousePitch=new Bl({clickTolerance:i.dragRotate._mousePitch._clickTolerance})),a.a_(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),o.addEventListener("mousedown",this.mousedown),o.addEventListener("touchstart",this.touchstart,{passive:!1}),o.addEventListener("touchmove",this.touchmove),o.addEventListener("touchend",this.touchend),o.addEventListener("touchcancel",this.reset)}down(i,o){this.mouseRotate.mousedown(i,o),this.mousePitch&&this.mousePitch.mousedown(i,o),Mr()}move(i,o){const u=this.map,d=this.mouseRotate.mousemoveWindow(i,o),m=d&&d.bearingDelta;if(m&&u.setBearing(u.getBearing()+m),this.mousePitch){const _=this.mousePitch.mousemoveWindow(i,o),y=_&&_.pitchDelta;y&&u.setPitch(u.getPitch()+y)}}off(){const i=this.element;i.removeEventListener("mousedown",this.mousedown),i.removeEventListener("touchstart",this.touchstart),i.removeEventListener("touchmove",this.touchmove),i.removeEventListener("touchend",this.touchend),i.removeEventListener("touchcancel",this.reset),this.offTemp()}offTemp(){xo(),window.removeEventListener("mousemove",this.mousemove),window.removeEventListener("mouseup",this.mouseup)}mousedown(i){this.down(Object.assign({},i,{button:i.button,type:i.type,ctrlKey:!0,preventDefault:()=>i.preventDefault()}),Un(this.element,i)),window.addEventListener("mousemove",this.mousemove),window.addEventListener("mouseup",this.mouseup)}mousemove(i){this.move(i,Un(this.element,i))}mouseup(i){this.mouseRotate.mouseupWindow(i),this.mousePitch&&this.mousePitch.mouseupWindow(i),this.offTemp()}touchstart(i){i.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=bo(this.element,i.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:()=>i.preventDefault()},this._startPos))}touchmove(i){i.targetTouches.length!==1?this.reset():(this._lastPos=bo(this.element,i.targetTouches)[0],this.move({buttons:1,preventDefault:()=>i.preventDefault()},this._lastPos))}touchend(i){i.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 bd(l,i,o){if(l=new a.aV(l.lng,l.lat),i){const u=new a.aV(l.lng-360,l.lat),d=new a.aV(l.lng+360,l.lat),m=360*Math.ceil(Math.abs(l.lng-o.center.lng)/360),_=o.locationPoint3D(l).distSqr(i),y=i.x<0||i.y<0||i.x>o.width||i.y>o.height;o.locationPoint3D(u).distSqr(i)<_&&(y||Math.abs(u.lng-o.center.lng)<m)?l=u:o.locationPoint3D(d).distSqr(i)<_&&(y||Math.abs(d.lng-o.center.lng)<m)&&(l=d)}for(;Math.abs(l.lng-o.center.lng)>180;){const u=o.locationPoint3D(l);if(u.x>=0&&u.y>=0&&u.x<=o.width&&u.y<=o.height)break;l.lng>o.center.lng?l.lng-=360:l.lng+=360}return l}const Gl={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%)"},yn={rotation:0,rotationAlignment:"auto",pitchAlignment:"auto",occludedOpacity:.2,altitude:0};class Bn extends a.E{constructor(i,o){super(),(i instanceof HTMLElement||o)&&(i=Object.assign({element:i},o)),a.a_(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress","_clearFadeTimer"],this);const{anchor:u="center",color:d="#3FB1CE",scale:m=1,draggable:_=!1,clickTolerance:y=0,rotation:v=yn.rotation,rotationAlignment:T=yn.rotationAlignment,pitchAlignment:I=yn.pitchAlignment,occludedOpacity:M=yn.occludedOpacity,altitude:C=yn.altitude}=i||{};this._anchor=u,this._color=d,this._scale=m,this._draggable=_,this._clickTolerance=y,this._rotation=v,this._rotationAlignment=T,this._pitchAlignment=I,this._occludedOpacity=M,this._altitude=C,this._state="inactive",this._isDragging=!1,this._updateMoving=()=>this._update(!0),i&&i.element?(this._element=i.element,this._offset=a.P.convert(i&&i.offset||[0,0])):(this._defaultMarker=!0,this._element=this._createDefaultMarker(),this._offset=a.P.convert(i&&i.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",z=>{z.preventDefault()}),this._element.addEventListener("mousedown",z=>{z.preventDefault()});const D=this._element.classList;for(const z in Gl)D.remove(`mapboxgl-marker-anchor-${z}`);D.add(`mapboxgl-marker-anchor-${this._anchor}`);const F=i&&i.className?i.className.trim().split(/\s+/):[];D.add(...F),this._popup=null}_createDefaultMarker(){const i=Jt("div"),o=Ei("svg",{display:"block",height:41*this._scale+"px",width:27*this._scale+"px",viewBox:"0 0 27 41"},i);if(this._altitude===0){const u=Ei("radialGradient",{id:"shadowGradient"},Ei("defs",{},o));Ei("stop",{offset:"10%","stop-opacity":.4},u),Ei("stop",{offset:"100%","stop-opacity":.05},u),Ei("ellipse",{cx:13.5,cy:34.8,rx:10.5,ry:5.25,fill:"url(#shadowGradient)"},o)}return Ei("path",{fill:this._color,d:"M27,13.5C27,19.07 20.25,27 14.75,34.5C14.02,35.5 12.98,35.5 12.25,34.5C6.75,27 0,19.22 0,13.5C0,6.04 6.04,0 13.5,0C20.96,0 27,6.04 27,13.5Z"},o),Ei("path",{opacity:.25,d:"M13.5,0C6.04,0 0,6.04 0,13.5C0,19.22 6.75,27 12.25,34.5C13,35.52 14.02,35.5 14.75,34.5C20.25,27 27,19.07 27,13.5C27,6.04 20.96,0 13.5,0ZM13.5,1C20.42,1 26,6.58 26,13.5C26,15.9 24.5,19.18 22.22,22.74C19.95,26.3 16.71,30.14 13.94,33.91C13.74,34.18 13.61,34.32 13.5,34.44C13.39,34.32 13.26,34.18 13.06,33.91C10.28,30.13 7.41,26.31 5.02,22.77C2.62,19.23 1,15.95 1,13.5C1,6.58 6.58,1 13.5,1Z"},o),Ei("circle",{fill:"white",cx:13.5,cy:13.5,r:5.5},o),i}addTo(i){return i===this._map||(this.remove(),this._map=i,i.getCanvasContainer().appendChild(this._element),i.on("move",this._updateMoving),i.on("moveend",this._update),i.on("remove",this._clearFadeTimer),i._addMarker(this),this.setDraggable(this._draggable),this._update(),i.on("click",this._onMapClick)),this}remove(){const i=this._map;return i&&(i.off("click",this._onMapClick),i.off("move",this._updateMoving),i.off("moveend",this._update),i.off("mousedown",this._addDragHandler),i.off("touchstart",this._addDragHandler),i.off("mouseup",this._onUp),i.off("touchend",this._onUp),i.off("mousemove",this._onMove),i.off("touchmove",this._onMove),i.off("remove",this._clearFadeTimer),i._removeMarker(this),this._map=void 0),this._clearFadeTimer(),this._element.remove(),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(i){return this._lngLat=a.aV.convert(i),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(!0),this}setAltitude(i){return i===this._altitude||(this._defaultMarker&&(this._altitude===0&&i!==0||this._altitude!==0&&i===0)&&(this._element=this._createDefaultMarker()),this._altitude=i||yn.altitude,this._update()),this}getAltitude(){return this._altitude}getElement(){return this._element}setPopup(i){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")),i){if(!("offset"in i.options)){const d=Math.sqrt(Math.pow(13.5,2)/2);i.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=i,i._marker=this,i._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(i){const o=i.code,u=i.charCode||i.keyCode;o!=="Space"&&o!=="Enter"&&u!==32&&u!==13||this.togglePopup()}_onMapClick(i){const o=i.originalEvent.target,u=this._element;this._popup&&(o===u||u.contains(o))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){const i=this._popup;return i?(i.isOpen()?(i.remove(),this._element.setAttribute("aria-expanded","false")):this._map&&(i.addTo(this._map),this._element.setAttribute("aria-expanded","true")),this):this}_behindTerrain(){const i=this._map,o=this._pos;if(!i||!o)return!1;const u=i.unproject(o,this._altitude),d=i.getFreeCameraOptions();if(!d.position)return!1;const m=d.position.toLngLat();return m.distanceTo(u)<.9*m.distanceTo(this._lngLat)}_evaluateOpacity(){const i=this._map;if(!i)return;const o=this._pos;if(!o||o.x<0||o.x>i.transform.width||o.y<0||o.y>i.transform.height)return void this._clearFadeTimer();const u=i.unproject(o,this._altitude);let d;i._showingGlobe()&&a.eX(i.transform,this._lngLat)?d=0:(d=1-i._queryFogOpacity(u),i.transform._terrainEnabled()&&i.getTerrain()&&this._behindTerrain()&&(d*=this._occludedOpacity)),this._element.style.opacity=`${d}`,this._element.style.pointerEvents=d>0?"auto":"none",this._popup&&this._popup._setOpacity(d),this._fadeTimer=null}_clearFadeTimer(){this._fadeTimer&&(clearTimeout(this._fadeTimer),this._fadeTimer=null)}_updateDOM(){const i=this._pos;if(!i||!this._map)return;const o=this._offset.mult(this._scale);this._element.style.transform=`
3255            translate(${i.x}px,${i.y}px)
3256            ${Gl[this._anchor]}
3257            ${this._calculateXYTransform()} ${this._calculateZTransform()}
3258            translate(${o.x}px,${o.y}px)
3259        `}_calculateXYTransform(){const i=this._pos,o=this._map,u=this.getPitchAlignment();if(!o||!i||u!=="map")return"";if(!o._showingGlobe()){const v=o.getPitch();return v?`rotateX(${v}deg)`:""}const d=a.cC(a.eY(o.transform,this._lngLat)),m=i.sub(a.eZ(o.transform)),_=Math.abs(m.x)+Math.abs(m.y);if(_===0)return"";const y=d/_;return`rotateX(${-m.y*y}deg) rotateY(${m.x*y}deg)`}_calculateZTransform(){const i=this._pos,o=this._map;if(!o||!i)return"";let u=0;const d=this.getRotationAlignment();if(d==="map")if(o._showingGlobe()){const m=o.project(new a.aV(this._lngLat.lng,this._lngLat.lat+.001),this._altitude),_=o.project(new a.aV(this._lngLat.lng,this._lngLat.lat-.001),this._altitude).sub(m);u=a.cC(Math.atan2(_.y,_.x))-90}else u=-o.getBearing();else if(d==="horizon"){const m=a.aj(4,6,o.getZoom()),_=a.eZ(o.transform);_.y+=m*o.transform.height;const y=i.sub(_),v=a.cC(Math.atan2(y.y,y.x));u=(v>90?v-270:v+90)*(1-m)}return u+=this._rotation,u?`rotateZ(${u}deg)`:""}_update(i){cancelAnimationFrame(this._updateFrameId);const o=this._map;o&&(o.transform.renderWorldCopies&&(this._lngLat=bd(this._lngLat,this._pos,o.transform)),this._pos=o.project(this._lngLat,this._altitude),i===!0?this._updateFrameId=requestAnimationFrame(()=>{this._element&&this._pos&&this._anchor&&(this._pos=this._pos.round(),this._updateDOM())}):this._pos=this._pos.round(),o._requestDomTask(()=>{this._map&&(this._element&&this._pos&&this._anchor&&this._updateDOM(),(o._showingGlobe()||o.getTerrain()||o.getFog())&&!this._fadeTimer&&(this._fadeTimer=window.setTimeout(this._evaluateOpacity.bind(this),60)))}))}getOffset(){return this._offset}setOffset(i){return this._offset=a.P.convert(i),this._update(),this}addClassName(i){return this._element.classList.add(i),this}removeClassName(i){return this._element.classList.remove(i),this}toggleClassName(i){return this._element.classList.toggle(i)}_onMove(i){const o=this._map;if(!o)return;const u=this._pointerdownPos,d=this._positionDelta;if(u&&d){if(!this._isDragging){const m=this._clickTolerance||o._clickTolerance;if(i.point.dist(u)<m)return;this._isDragging=!0}this._pos=i.point.sub(d),this._lngLat=o.unproject(this._pos,this._altitude),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new a.C("dragstart"))),this.fire(new a.C("drag"))}}_onUp(){this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1;const i=this._map;i&&(i.off("mousemove",this._onMove),i.off("touchmove",this._onMove)),this._state==="active"&&this.fire(new a.C("dragend")),this._state="inactive"}_addDragHandler(i){const o=this._map,u=this._pos;o&&u&&this._element.contains(i.originalEvent.target)&&(i.preventDefault(),this._positionDelta=i.point.sub(u),this._pointerdownPos=i.point,this._state="pending",o.on("mousemove",this._onMove),o.on("touchmove",this._onMove),o.once("mouseup",this._onUp),o.once("touchend",this._onUp))}setDraggable(i){this._draggable=!!i;const o=this._map;return o&&(i?(o.on("mousedown",this._addDragHandler),o.on("touchstart",this._addDragHandler)):(o.off("mousedown",this._addDragHandler),o.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(i){return this._rotation=i||yn.rotation,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(i){return this._rotationAlignment=i||yn.rotationAlignment,this._update(),this}getRotationAlignment(){return this._rotationAlignment==="auto"||this._rotationAlignment==="horizon"&&this._map&&!this._map._showingGlobe()?"viewport":this._rotationAlignment}setPitchAlignment(i){return this._pitchAlignment=i||yn.pitchAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment==="auto"?this.getRotationAlignment():this._pitchAlignment}setOccludedOpacity(i){return this._occludedOpacity=i||yn.occludedOpacity,this._update(),this}getOccludedOpacity(){return this._occludedOpacity}}const ql={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0,showUserHeading:!1,showButton:!0,followUserLocation:!0},ir={maxWidth:100,unit:"metric"},kn={kilometer:"km",meter:"m",mile:"mi",foot:"ft","nautical-mile":"nm"},$l={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",altitude:0},h_=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Su(l=new a.P(0,0),i="bottom"){if(typeof l=="number"){const o=Math.round(Math.sqrt(.5*Math.pow(l,2)));switch(i){case"top":return new a.P(0,l);case"top-left":return new a.P(o,o);case"top-right":return new a.P(-o,o);case"bottom":return new a.P(0,-l);case"bottom-left":return new a.P(o,-o);case"bottom-right":return new a.P(-o,-o);case"left":return new a.P(l,0);case"right":return new a.P(-l,0)}return new a.P(0,0)}return l instanceof a.P||Array.isArray(l)?a.P.convert(l):a.P.convert(l[i]||[0,0])}return{version:We,supported:ps.supported,setRTLTextPlugin:a.e$,getRTLTextPluginStatus:a.e_,addTileProvider:function(l,i){if(!l||!i)throw new Error("TileProvider name and URL are required");a.e.TILE_PROVIDER_URLS[l]=a.o.resolveURL(i)},Map:class extends pp{constructor(l){Vn.mark(Oi.create);const i=l;if((l=Object.assign({}
3259,c_,l)).minZoom!=null&&l.maxZoom!=null&&l.minZoom>l.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(l.minPitch!=null&&l.maxPitch!=null&&l.minPitch>l.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(l.minPitch!=null&&l.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(l.maxPitch!=null&&l.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(l.antialias&&a.eV(window)&&(l.antialias=!1,a.w("Antialiasing is disabled for this WebGL context to avoid browser bug: https://github.com/mapbox/mapbox-gl-js/issues/11609")),super(new lh(l.minZoom,l.maxZoom,l.minPitch,l.maxPitch,l.renderWorldCopies,null,null),l),this._repaint=!!l.repaint,this._interactive=l.interactive,this._minTileCacheSize=l.minTileCacheSize,this._maxTileCacheSize=l.maxTileCacheSize,this._failIfMajorPerformanceCaveat=l.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=l.preserveDrawingBuffer,this._antialias=l.antialias,this._trackResize=l.trackResize,this._bearingSnap=l.bearingSnap,this._refreshExpiredTiles=l.refreshExpiredTiles,this._fadeDuration=l.fadeDuration,this._isInitialLoad=!0,this._crossSourceCollisions=l.crossSourceCollisions,this._collectResourceTiming=l.collectResourceTiming,this._language=this._parseLanguage(l.language),this._worldview=l.worldview,this._renderTaskQueue=new mp,this._domRenderTaskQueue=new mp,this._controls=[],this._markers=[],this._popups=[],this._mapId=a.r(),this._locale=Object.assign({},a_,l.locale),this._clickTolerance=l.clickTolerance,this._cooperativeGestures=l.cooperativeGestures,this._performanceMetricsCollection=l.performanceMetricsCollection,this._tessellationStep=l.tessellationStep,this._containerWidth=0,this._containerHeight=0,this._showParseStatus=!0,this._precompilePrograms=l.precompilePrograms,this._averageElevationLastSampledAt=-1/0,this._averageElevationExaggeration=0,this._averageElevation=new s_(0),this._interactionRange=[1/0,-1/0],this._visibilityHidden=0,this._useExplicitProjection=!1,this._frameId=0,this._scaleFactor=l.scaleFactor,this._requestManager=new lc(l.transformRequest,l.accessToken,l.testMode),this._silenceAuthErrors=!!l.testMode,this._contextCreateOptions=l.contextCreateOptions?Object.assign({},l.contextCreateOptions):{},typeof l.container=="string"){const o=document.getElementById(l.container);if(!o)throw new Error(`Container '${l.container.toString()}' not found.`);this._container=o}else{if(!(l.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=l.container}if(this._container.childNodes.length>0&&a.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."),l.maxBounds&&this.setMaxBounds(l.maxBounds),this._spriteFormat=l.spriteFormat,a.a_(["_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 fp(this,l),this._localFontFamily=l.localFontFamily,this._localIdeographFontFamily=l.localIdeographFontFamily,(l.style||!l.testMode)&&this.setStyle(l.style||a.e.DEFAULT_STYLE,{config:l.config,localFontFamily:this._localFontFamily,localIdeographFontFamily:this._localIdeographFontFamily}),l.projection&&this.setProjection(l.projection),l.hash&&(this._hash=new n_(typeof l.hash=="string"&&l.hash||void 0).addTo(this)),!this._hash||!this._hash._onHashChange()){i.center==null&&i.zoom==null||(this.transform._unmodified=!1),this.jumpTo({center:l.center,zoom:l.zoom,bearing:l.bearing,pitch:l.pitch});const o=l.bounds;o&&(this.resize(),this.fitBounds(o,Object.assign({},l.fitBoundsOptions,{duration:0})))}this.resize(),l.attributionControl&&this.addControl(new xd({customAttribution:l.customAttribution}
vendor: 9,360 bytes, line 3259
3259)),this._logoControl=new vd,this.addControl(this._logoControl,l.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet),this._postStyleLoadEvent(),this._postStyleWithAppearanceEvent()}),this.on("data",o=>{this._update(o.dataType==="style"),this.fire(new a.C(`${o.dataType}data`,o))}),this.on("dataloading",o=>{this.fire(new a.C(`${o.dataType}dataloading`,o))}),this._interactions=new Tu(this)}_getMapId(){return this._mapId}addControl(l,i){if(i===void 0&&(i=l.getDefaultPosition?l.getDefaultPosition():"top-right"),!l||!l.onAdd)return this.fire(new a.B(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const o=l.onAdd(this);this._controls.push(l);const u=this._controlPositions[i];return i.indexOf("bottom")!==-1?u.insertBefore(o,u.firstChild):u.appendChild(o),this}removeControl(l){if(!l||!l.onRemove)return this.fire(new a.B(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const i=this._controls.indexOf(l);return i>-1&&this._controls.splice(i,1),l.onRemove(this),this}hasControl(l){return this._controls.indexOf(l)>-1}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}resize(l){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 i=!this._moving;return i&&this.fire(new a.C("movestart",l)).fire(new a.C("move",l)),this.fire(new a.C("resize",l)),i&&this.fire(new a.C("moveend",l)),this}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()||null}setMaxBounds(l){return this.transform.setMaxBounds(a.aK.convert(l)),this._update()}setMinZoom(l){if((l=l??-2)>=-2&&l<=this.transform.maxZoom)return this.transform.minZoom=l,this._update(),this.getZoom()<l?this.setZoom(l):this.fire(new a.C("zoomstart")).fire(new a.C("zoom")).fire(new a.C("zoomend")),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(l){if((l=l??22)>=this.transform.minZoom)return this.transform.maxZoom=l,this._update(),this.getZoom()>l?this.setZoom(l):this.fire(new a.C("zoomstart")).fire(new a.C("zoom")).fire(new a.C("zoomend")),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(l){if((l=l??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(l>=0&&l<=this.transform.maxPitch)return this.transform.minPitch=l,this._update(),this.getPitch()<l?this.setPitch(l):this.fire(new a.C("pitchstart")).fire(new a.C("pitch")).fire(new a.C("pitchend")),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(l){if((l=l??85)>85)throw new Error("maxPitch must be less than or equal to 85");if(l>=this.transform.minPitch)return this.transform.maxPitch=l,this._update(),this.getPitch()>l?this.setPitch(l):this.fire(new a.C("pitchstart")).fire(new a.C("pitch")).fire(new a.C("pitchend")),this;throw new Error("maxPitch must be greater than or equal to minPitch")}getMaxPitch(){return this.transform.maxPitch}getScaleFactor(){return this._scaleFactor}setScaleFactor(l){return this._scaleFactor=l,this.painter.scaleFactor=l,this.style&&this.style._setLabelPlacementStale(),this.style._updateFilteredLayers(i=>i.type==="symbol"),this._update(!0),this}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(l){return this.transform.renderWorldCopies=l,this.transform.renderWorldCopies||this._forceMarkerAndPopupUpdate(!0),this._update()}getLanguage(){return this._language}_parseLanguage(l){return l==="auto"?navigator.language:Array.isArray(l)?l.length===0?void 0:l.map(i=>i==="auto"?navigator.language:i):l}setLanguage(l){const i=this._parseLanguage(l);if(!this.style||i===this._language)return this;this._language=i,this.style.reloadSources();for(const o of this._controls)o._setLanguage&&o._setLanguage(this._language);return this}getWorldview(){return this._worldview}setWorldview(l){return this.style&&l!==this._worldview?(this._worldview=l,this._styleDirty=!0,this.style.setWorldview(l),this):this}getProjection(){return this.transform.mercatorFromTransition?{name:"globe",center:[0,0]}:this.transform.getProjection()}_showingGlobe(){return this.transform.projection.name==="globe"}setProjection(l){return this._lazyInitEmptyStyle(),l?typeof l=="string"&&(l={name:l}):l=null,this._useExplicitProjection=!!l,this._prioritizeAndUpdateProjection(l,this.style.projection)}_updateProjectionTransition(){if(this.getProjection().name!=="globe")return;const l=this.transform,i=l.projection.name;let o;i==="globe"&&l.zoom>=a.cq?(l.setMercatorFromTransition(),o=!0):i==="mercator"&&l.zoom<a.cq&&(l.setProjection({name:"globe"}),o=!0),o&&(this.style.applyProjectionUpdate(),this.style._forceSymbolLayerUpdate(),this._update(!0))}_prioritizeAndUpdateProjection(l,i){return this._updateProjection(l||i||{name:"mercator"})}_updateProjection(l){let i;const o=this.transform.mercatorFromTransition;i=l.name==="globe"&&this.transform.zoom>=a.cq?this.transform.setMercatorFromTransition():this.transform.setProjection(l),this.style.applyProjectionUpdate();const u=this.transform.getProjection().name==="mercator"&&o!==this.transform.mercatorFromTransition;return(i||u)&&(this.painter.clearBackgroundTiles(),this.style.clearSources(),this._update(!0),this._forceMarkerAndPopupUpdate(!0)),this}project(l,i){return this.transform.locationPoint3D(a.aV.convert(l),i)}unproject(l,i){return this.transform.pointLocation3D(a.P.convert(l),i)}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(l,i,o){const u=d=>{let m=[];if(Array.isArray(i)){const _=i.filter(y=>this.getLayer(y));m=_.length?this.queryRenderedFeatures(d,{layers:_}):[]}else m=this.queryRenderedFeatures(d,{target:i});return m};if(l==="mouseenter"||l==="mouseover"){let d=!1;return{listener:o,targets:i,delegates:{mousemove:_=>{const y=u(_.point);y.length?d||(d=!0,o.call(this,new Ir(l,this,_.originalEvent,{features:y}))):d=!1},mouseout:()=>{d=!1}}}}if(l==="mouseleave"||l==="mouseout"){let d=!1;return{listener:o,targets:i,delegates:{mousemove:y=>{u(y.point).length?d=!0:d&&(d=!1,o.call(this,new Ir(l,this,y.originalEvent)))},mouseout:y=>{d&&(d=!1,o.call(this,new Ir(l,this,y.originalEvent)))}}}}{const d=m=>{const _=u(m.point);_.length&&(m.features=_,o.call(this,m),delete m.features)};return{listener:o,targets:i,delegates:{[l]:d}}}}on(l,i,o){if(typeof i=="function"||o===void 0)return super.on(l,i);if(typeof i=="string"&&(i=[i]),!this._areTargetsValid(i))return this;const u=this._createDelegatedListener(l,i,o);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[l]=this._delegatedListeners[l]||[],this._delegatedListeners[l].push(u);for(const d in u.delegates)this.on(d,u.delegates[d]);return this}once(l,i,o){if(typeof i=="function"||o===void 0)return super.once(l,i);if(typeof i=="string"&&(i=[i]),!this._areTargetsValid(i))return this;const u=this._createDelegatedListener(l,i,o);for(const d in u.delegates)this.once(d,u.delegates[d]);return this}off(l,i,o){if(typeof i=="function"||o===void 0)return super.off(l,i);if(typeof i=="string"&&(i=[i]),!this._areTargetsValid(i))return this;const u=this._delegatedListeners?this._delegatedListeners[l]:void 0;return u&&(d=>{for(let m=0;m<d.length;m++){const _=d[m];if(_.listener===o&&l_(_.targets,i)){for(const y in _.delegates)this.off(y,_.delegates[y]);return d.splice(m,1),this}}})(u),this}queryRenderedFeatures(l,i){if(!this.style)return[];if(l===void 0||l instanceof a.P||Array.isArray(l)||i!==void 0||(i=l,l=void 0),l=l||[[0,0],[this.transform.width,this.transform.height]],!i){const m=this.style.queryRenderedFeatures(l,void 0,this.transform),_=this.style.queryRenderedFeatureset(l,void 0,this.transform);return m.concat(_)}let o=!0;if(i.target&&(o=this._isTargetValid(i.target),o&&!i.layers))return this.style.queryRenderedFeatureset(l,i,this.transform);let u=!0;if(i.layers&&Array.isArray(i.layers)){for(const m of i.layers)if(!this._isValidId(m)){u=!1;break}if(u&&!i.target)return this.style.queryRenderedFeatures(l,i,this.transform)}let d=[];return u&&(d=d.concat(this.style.queryRenderedFeatures(l,i,this.transform))),o&&(d=d.concat(this.style.queryRenderedFeatureset(l,i,this.transform))),d}querySourceFeatures(l,i){return!l||typeof l=="string"&&!this._isValidId(l)?[]:this.style.querySourceFeatures(l,i)}queryRasterValue(l,i,o){return this._isValidId(l)?this.style.queryRasterValue(l,i,o):Promise.resolve(null)}isPointOnSurface(l){const{name:i}=this.transform.projection;return i!=="globe"&&i!=="mercator"&&a.w(`${i} projection does not support isPointOnSurface, this API may behave unex
3259pectedly.`),this.transform.isPointOnSurface(a.P.convert(l))}addInteraction(l,i){return this._interactions.add(l,i),this}removeInteraction(l){return this._interactions.remove(l),this}getCooperativeGestures(){return this._cooperativeGestures}setCooperativeGestures(l){return this._cooperativeGestures=l,this}setStyle(l,i){return i=Object.assign({},{localIdeographFontFamily:this._localIdeographFontFamily,localFontFamily:this._localFontFamily},i),this.style&&l&&i.diff!==!1&&i.localFontFamily===this._localFontFamily&&i.localIdeographFontFamily===this._localIdeographFontFamily&&!i.config?(this.style._diffStyle(l,(o,u)=>{if(o){const d=typeof o=="string"?o:o instanceof Error?o.message:o.error;a.w(`Unable to perform style diff: ${d}. Rebuilding the style from scratch.`),this._updateStyle(l,i)}else u&&this._update(!0)},()=>this._postStyleLoadEvent()),this):(this._localIdeographFontFamily=i.localIdeographFontFamily,this._localFontFamily=i.localFontFamily,this._updateStyle(l,i))}_getUIString(l){const i=this._locale[l];if(i==null)throw new Error(`Missing UI string '${l}'`);return i}_updateStyle(l,i){if(this.style&&(this.style.setEventedParent(null),this.style._remove(),this.style=void 0),l){const o=Object.assign({},i);i&&i.config&&(o.initialConfig=i.config,delete o.config),this.style=new zn(this,o).load(l),this.style.setEventedParent(this,{style:this.style})}return this._updateTerrain(),this}_lazyInitEmptyStyle(){this.style||(this.style=new zn(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():(a.w("There is no style added to the map."),!1)}_isValidId(l){return l==null?(this.fire(new a.B(new Error("IDs can't be empty."))),!1):!a.d7(l)||(this.fire(new a.B(new Error(`IDs can't contain special symbols: "${l}".`))),!1)}_isTargetValid(l){return"featuresetId"in l?this._isValidId("importId"in l?l.importId:l.featuresetId):"layerId"in l&&this._isValidId(l.layerId)}_areTargetsValid(l){if(Array.isArray(l)){for(const i of l)if(!this._isValidId(i))return!1;return!0}return this._isTargetValid(l)}addSource(l,i){return this._isValidId(l)?(this._lazyInitEmptyStyle(),this.style.addSource(l,i),this._update(!0)):this}isSourceLoaded(l){return!!this._isValidId(l)&&!!this.style&&this.style._isSourceCacheLoaded(l)}areTilesLoaded(){return this.style.areTilesLoaded()}addSourceType(l,i,o){this._lazyInitEmptyStyle(),this.style.addSourceType(l,i,o)}removeSource(l){return this._isValidId(l)?(this.style.removeSource(l),this._updateTerrain(),this._update(!0)):this}getSource(l){return this._isValidId(l)?this.style.getOwnSource(l):null}addImage(l,i,{pixelRatio:o=1,sdf:u=!1,stretchX:d,stretchY:m,content:_}={}){this._lazyInitEmptyStyle();const y=a.I.from(l);if(i instanceof HTMLImageElement||ImageBitmap&&i instanceof ImageBitmap){const{width:v,height:T,data:I}=a.o.getImageData(i);this.style.addImage(y,{data:new a.q({width:v,height:T},I),pixelRatio:o,stretchX:d,stretchY:m,content:_,sdf:u,version:0,usvg:!1})}else if(i.width===void 0||i.height===void 0)this.fire(new a.B(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));else{const{width:v,height:T}=i,I=i;this.style.addImage(y,{data:new a.q({width:v,height:T},new Uint8Array(I.data)),pixelRatio:o,stretchX:d,stretchY:m,content:_,sdf:u,usvg:!1,version:0,userImage:I}),I.onAdd&&I.onAdd(this,l)}}updateImage(l,i){this._lazyInitEmptyStyle();const o=a.I.from(l),u=this.style.getImage(o);if(!u)return void this.fire(new a.B(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const d=i instanceof HTMLImageElement||ImageBitmap&&i instanceof ImageBitmap?a.o.getImageData(i):i,{width:m,height:_,data:y}=d;if(m===void 0||_===void 0)return void this.fire(new a.B(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(m!==(u.usvg?u.icon.usvg_tree.width:u.data.width)||_!==(u.usvg?u.icon.usvg_tree.height:u.data.height))return void this.fire(new a.B(new Error(`The width and height of the updated image (${m}, ${_})
3260                must be that same as the previous version of the image
3261                (${u.data.width}, ${u.data.height})`)));const v=!(i instanceof HTMLImageElement||ImageBitmap&&i instanceof ImageBitmap);let T=!1;u.usvg?(u.data=new a.q({width:m,height:_},new Uint8Array(y)),u.usvg=!1,u.icon=void 0,T=!0):u.data.replace(y,v),this.style.updateImage(o,u,T)}hasImage(l){return l?!!this.style&&!!this.style.getImage(a.I.from(l)):(this.fire(new a.B(new Error("Missing required image id"))),!1)}removeImage(l){this.style.removeImage(a.I.from(l))}loadImage(l,i){a.n(this._requestManager.transformRequest(l,a.R.Image),(o,u)=>{i(o,u)})}
vendor: 26,548 bytes, line 3261
3261listImages(){return this.style.listImages().map(l=>l.name)}addModel(l,i){this._lazyInitEmptyStyle(),this.style.addModel(l,i)}hasModel(l){return l?this.style.hasModel(l):(this.fire(new a.B(new Error("Missing required model id"))),!1)}removeModel(l){this.style.removeModel(l)}listModels(){return this.style.listModels()}addLayer(l,i){return this._isValidId(l.id)?(this._lazyInitEmptyStyle(),this.style.addLayer(l,i),this._update(!0)):this}getSlot(l){const i=this.getLayer(l);return i&&i.slot||null}setSlot(l,i){return this.style.setSlot(l,i),this.style.mergeLayers(),this._update(!0)}addImport(l,i){return this.style.addImport(l,i).catch(o=>this.fire(new a.B(new Error("Failed to add import",o)))),this}updateImport(l,i){return typeof i!="string"&&i.id!==l?(this.removeImport(l),this.addImport(i)):(this.style.updateImport(l,i),this._update(!0))}removeImport(l){return this.style.removeImport(l),this}moveImport(l,i){return this.style.moveImport(l,i),this._update(!0)}moveLayer(l,i){return this._isValidId(l)?(this.style.moveLayer(l,i),this._update(!0)):this}removeLayer(l){return this._isValidId(l)?(this.style.removeLayer(l),this._update(!0)):this}getLayer(l){if(!this._isValidId(l))return null;const i=this.style.getOwnLayer(l);return i?i.type==="custom"?i.implementation:i.serialize():void 0}getSlots(){return this.style.getSlots()}setLayerZoomRange(l,i,o){return this._isValidId(l)?(this.style.setLayerZoomRange(l,i,o),this._update(!0)):this}setFilter(l,i,o={}){return this._isValidId(l)?(this.style.setFilter(l,i,o),this._update(!0)):this}getFilter(l){return this._isValidId(l)?this.style.getFilter(l):null}setPaintProperty(l,i,o,u={}){return this._isValidId(l)?(this.style.setPaintProperty(l,i,o,u),this._update(!0)):this}getPaintProperty(l,i){return this._isValidId(l)?this.style.getPaintProperty(l,i):null}setLayoutProperty(l,i,o,u={}){return this._isValidId(l)?(this.style.setLayoutProperty(l,i,o,u),this._update(!0)):this}getLayoutProperty(l,i){return this._isValidId(l)?this.style.getLayoutProperty(l,i):null}setLayerProperty(l,i,o,u={}){return this._isValidId(l)?(i==="appearances"&&this._postAddingAppearancesToStyleEvent(),this.style.setLayerProperty(l,i,o,u),this._update(!0)):this}getGlyphsUrl(){return this.style.getGlyphsUrl()}setGlyphsUrl(l){return this.style.setGlyphsUrl(l),this._update(!0)}getSchema(l){return this.style.getSchema(l)}setSchema(l,i){return this.style.setSchema(l,i),this._update(!0)}getConfig(l){return this.style.getConfig(l)}setConfig(l,i){return this.style.setConfig(l,i),this._update(!0)}getConfigProperty(l,i){return this.style.getConfigProperty(l,i)}setConfigProperty(l,i,o){return this.style.setConfigProperty(l,i,o),this._update(!0)}getFeaturesetDescriptors(l){return this.style.getFeaturesetDescriptors(l)}setLights(l){if(this._lazyInitEmptyStyle(),l&&l.length===1&&l[0].type==="flat"){const i=l[0];i.properties?this.style.setFlatLight(i.properties,i.id,{}):this.style.setFlatLight({},"flat")}else this.style.setLights(l),this.painter.terrain&&(this.painter.terrain.invalidateRenderCache=!0);return this._update(!0)}getLights(){const l=this.style.getLights()||[];return l.length===0&&l.push({id:this.style.light.id,type:"flat",properties:this.style.getFlatLight()}),l}setLight(l,i={}){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:l}])}getLight(){return console.log("The `map.getLight` function is deprecated, prefer using `map.getLights` instead."),this.style.getFlatLight()}setTerrain(l){return this._lazyInitEmptyStyle(),!l&&this.transform.projection.requiresDraping?this.style.setTerrainForDraping():this.style.setTerrain(l),this._averageElevationLastSampledAt=-1/0,this._update(!0)}getTerrain(){return this.style?this.style.getTerrain():null}setFog(l){return this._lazyInitEmptyStyle(),this.style.setFog(l),this._update(!0)}getFog(){return this.style?this.style.getFog():null}setSnow(l){return this._lazyInitEmptyStyle(),this.style.setSnow(l),this._update(!0)}getSnow(){return this.style?this.style.getSnow():null}setRain(l){return this._lazyInitEmptyStyle(),this.style.setRain(l),this._update(!0)}getRain(){return this.style?this.style.getRain():null}setColorTheme(l){return this._lazyInitEmptyStyle(),this.style.setColorTheme(l),this._update(!0)}setImportColorTheme(l,i){return this._lazyInitEmptyStyle(),this.style.setImportColorTheme(l,i),this._update(!0)}setCamera(l){return this.style.setCamera(l),this._triggerCameraUpdate(l)}getNearClipOffset(){return this.transform.nearClipOffset}setNearClipOffset(l){const i=this.transform.nearClipOffset!==l;return this.transform.nearClipOffset=l,this._update(i)}_triggerCameraUpdate(l){return this._update(this.transform.setOrthographicProjectionAtLowPitch(l["camera-projection"]==="orthographic"))}getCamera(){return this.style.camera}_queryFogOpacity(l){return this.style&&this.style.fog?this.style.fog.getOpacityAtLatLng(a.aV.convert(l),this.transform):0}setFeatureState(l,i){return l.source&&!this._isValidId(l.source)?this:(this.style.setFeatureState(l,i),this._update())}removeFeatureState(l,i){return l.source&&!this._isValidId(l.source)?this:(this.style.removeFeatureState(l,i),this._update())}getFeatureState(l){return l.source&&!this._isValidId(l.source)?null:this.style.getFeatureState(l)}_selectIndoorFloor(l){this.style.indoorManager.selectFloor(l)}_setIndoorActiveFloorsVisibility(l){this.style.indoorManager.setActiveFloorsVisibility(l)}getIndoorTileOptions(l,i){return this.style.isIndoorEnabled()?this.style.indoorManager.getIndoorTileOptions(l,i):null}_updateContainerDimensions(){if(!this._container)return;const l=this._container.getBoundingClientRect().width||400,i=this._container.getBoundingClientRect().height||300;let o,u,d,m=this._container;for(;m&&(!u||!d);){const _=window.getComputedStyle(m).transform;_&&_!=="none"&&(o=_.match(/matrix.*\((.+)\)/)[1].split(", "),o[0]&&o[0]!=="0"&&o[0]!=="1"&&(u=o[0]),o[3]&&o[3]!=="0"&&o[3]!=="1"&&(d=o[3])),m=m.parentElement}this._containerWidth=u?Math.abs(l/u):l,this._containerHeight=d?Math.abs(i/d):i}_detectMissingCSS(){window.getComputedStyle(this._missingCSSCanary).getPropertyValue("background-color")!=="rgb(250, 128, 114)"&&a.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 l=this._container;l.classList.add("mapboxgl-map"),(this._missingCSSCanary=Jt("div","mapboxgl-canary",l)).style.visibility="hidden",this._detectMissingCSS();const i=this._canvasContainer=Jt("div","mapboxgl-canvas-container",l);this._canvas=Jt("canvas","mapboxgl-canvas",i),this._interactive&&(i.classList.add("mapboxgl-interactive"),this._canvas.setAttribute("tabindex","0")),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region"),this._updateContainerDimensions(),this._resizeCanvas(this._containerWidth,this._containerHeight);const o=this._controlContainer=Jt("div","mapboxgl-control-container",l),u=this._controlPositions={};["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"].forEach(d=>{u[d]=Jt("div",`mapboxgl-ctrl-${d}`,o)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(l,i){const o=a.o.devicePixelRatio||1;this._canvas.width=o*Math.ceil(l),this._canvas.height=o*Math.ceil(i),this._canvas.style.width=`${l}px`,this._canvas.style.height=`${i}px`}_addMarker(l){this._markers.push(l)}_removeMarker(l){const i=this._markers.indexOf(l);i!==-1&&this._markers.splice(i,1)}_addPopup(l){this._popups.push(l)}_removePopup(l){const i=this._popups.indexOf(l);i!==-1&&this._popups.splice(i,1)}_setupPainter(){const l=Object.assign({},ps.supported.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),i=this._canvas.getContext("webgl2",l);i?(eo(i,!0),this.painter=new r_(i,this._contextCreateOptions,this.transform,this._scaleFactor,this._worldview),this.on("data",o=>{if(o.dataType==="source"){const u=this.transform.elevation?this.transform.elevation._source():null;u&&o.sourceCacheId===u.id&&this.style&&this.style._setLabelPlacementStale(),this.painter.setTileLoadedFlag(!0)}}),a.k.testSupport(i)):this.fire(new a.B(new Error("Failed to initialize WebGL")))}_contextLost(l){l.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new a.C("webglcontextlost",{originalEvent:l}))}_contextRestored(l){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 a.C("webglcontextrestored",{originalEvent:l}))}_onMapScroll(l){if(l.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(l){return this.style?(this._styleDirty=this._styleDirty||l,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(l){return this._update(),this._renderTaskQueue.add(l)}_cancelRenderFrame(l){this._renderTaskQueue.remove(l)}_requestDomTask(l){!this.loaded()||this.loaded()&&!this.isMoving()?l():this._domRenderTaskQueue.add(l)}_render(l){let i;this.fire(new a.C("renderstart")),++this._frameId;const o=this.painter.context.extTimerQuery,u=a.o.now(),d=this.painter.context.gl;if(this.listens("gpu-timing-frame")&&(i=d.createQuery(),d.beginQuery(o.TIME_ELAPSED_EXT,i)),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(l),this._domRenderTaskQueue.run(l),this._removed)return;this._updateProjectionTransition();const m=this._isInitialLoad?0:this._fadeDuration;if(this.style&&this._styleDirty){this._styleDirty=!1;const v=this.transform.zoom,T=this.transform.pitch,I=a.o.now(),M=new a.ae(v,{now:I,fadeDuration:m,pitch:T,transition:this.style.transition,worldview:this._worldview});this.style.update(M)}this.style&&this.style.hasFogTransition()&&(this.style._markersNeedUpdate=!0,this._sourcesDirty=!0);let _=!1;if(this.style&&this._sourcesDirty?(this._sourcesDirty=!1,this.painter._updateFog(this.style),this._updateTerrain(),_=this._updateAverageElevation(u),this.style.updateSources(this.transform),this.style.updateImageProviders(),this.isMoving()||this._forceMarkerAndPopupUpdate()):_=this._updateAverageElevation(u),this.style&&(this._placementDirty=this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,m,this._crossSourceCollisions,this.painter.replacementSource)),this.style&&this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showParseStatus:this.showParseStatus,wireframe:{terrain:this.showTerrainWireframe,layers2D:this.showLayers2DWireframe,layers3D:this.showLayers3DWireframe},showOverdrawInspector:this._showOverdrawInspector,showQueryGeometry:!!this._showQueryGeometry,showTileAABBs:this.showTileAABBs,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:m,isInitialLoad:this._isInitialLoad,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer"),gpuTimingDeferredRender:!!this.listens("gpu-timing-deferred-render"),speedIndexTiming:this.speedIndexTiming}),this.fire(new a.C("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,Vn.mark(Oi.load),this.fire(new a.C("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(),i){const v=a.o.now()-u;d.endQuery(o.TIME_ELAPSED_EXT),setTimeout(()=>{const T=d.getQueryParameter(i,d.QUERY_RESULT)/1e6;d.deleteQuery(i),this.fire(new a.C("gpu-timing-frame",{cpuTime:v,gpuTime:T}))},50)}if(this.listens("gpu-timing-layer")){const v=this.painter.collectGpuTimers();setTimeout(()=>{const T=this.painter.queryGpuTimers(v);this.fire(new a.C("gpu-timing-layer",{layerTimes:T}))},50)}if(this.listens("gpu-timing-deferred-render")){const v=this.painter.collectDeferredRenderGpuQueries();setTimeout(()=>{const T=this.painter.queryGpuTimeDeferredRender(v);this.fire(new a.C("gpu-timing-deferred-render",{gpuTime:T}))},50)}const y=this._sourcesDirty||this._styleDirty||this._placementDirty||_;if(y||this._repaint)this.triggerRepaint();else{const v=this.idle();if(v&&(_=this._updateAverageElevation(u,!0)),_)this.triggerRepaint();else if(this._triggerFrame(!1),v&&(this.fire(new a.C("idle")),this._isInitialLoad=!1,this.speedIndexTiming)){const T=this._calculateSpeedIndex();this.fire(new a.C("speedindexcompleted",{speedIndex:T})),this.speedIndexTiming=!1}}!this._loaded||this._fullyLoaded||y||(this._fullyLoaded=!0,Vn.mark(Oi.fullLoad),this._performanceMetricsCollection&&Vi(this._requestManager._customAccessToken,{width:this.painter.width,height:this.painter.height,interactionRange:this._interactionRange,visibilityHidden:this._visibilityHidden,terrainEnabled:!!this.painter.style.getTerrain(),fogEnabled:!!this.painter.style.getFog(),projection:this.getProjection().name,zoom:this.transform.zoom,renderer:this.painter.context.renderer,vendor:this.painter.context.vendor}),this._authenticate())}_forceMarkerAndPopupUpdate(l){for(const i of this._markers)l&&!this.getRenderWorldCopies()&&(i._lngLat=i._lngLat.wrap()),i._update();for(const i of this._popups)!l||this.getRenderWorldCopies()||i._trackPointer||(i._lngLat=i._lngLat.wrap()),i._update()}_updateAverageElevation(l,i=!1){const o=d=>(this.transform.averageElevation=d,this._update(!1),!0);if(!this.painter.averageElevationNeedsEasing())return this.transform.averageElevation!==0&&o(0);const u=this.transform.elevation&&this.transform.elevation.exaggeration()!==this._averageElevationExaggeration;if(u||(i||l-this._averageElevationLastSampledAt>500)&&!this._averageElevation.isEasing(l)){const d=this.transform.averageElevation;let m=this.transform.sampleAverageElevation();this.transform.elevation!=null&&(this._averageElevationExaggeration=this.transform.elevation.exaggeration()),isNaN(m)?m=0:this._averageElevationLastSampledAt=l;const _=Math.abs(d-m);if(_>1){if(this._isInitialLoad||u)return this._averageElevation.jumpTo(m),o(m);this._averageElevation.easeTo(m,l,300)}else if(_>1e-4)return this._averageElevation.jumpTo(m),o(m)}return!!this._averageElevation.isEasing(l)&&o(this._averageElevation.getValue(l))}_authenticate(){gs(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,l=>{if(l&&(l.message===ei||l.status===401)){const i=this.painter.context.gl;eo(i,!1),this._logoControl instanceof vd&&this._logoControl._updateLogo(),i&&i.clear(i.DEPTH_BUFFER_BIT|i.COLOR_BUFFER_BIT|i.STENCIL_BUFFER_BIT),this._silenceAuthErrors||this.fire(new a.B(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/")))}}),cc(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,()=>{})}_postStyleLoadEvent(){this.style.globalId&&uc(this._requestManager._customAccessToken,{map:this,style:this.style.globalId,importedStyles:this.style.getImportGlobalIds()})}_postStyleWithAppearanceEvent(){this.style.globalId&&this.style.hasAppearances()&&xi(this._requestManager._customAccessToken)}_postAddingAppearancesToStyleEvent(){dr(this._requestManager._customAccessToken)}_updateTerrain(){const l=this._isDragging();this.painter.updateTerrain(this.style,l)}_calculateSpeedIndex(){const l=this.painter.canvasCopy(),i=this.painter.getCanvasCopiesAndTimestamps();i.timeStamps.push(performance.now());const o=this.painter.context.gl,u=o.createFramebuffer();function d(m){o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,o.TEXTURE_2D,m,0);const _=new Uint8Array(o.drawingBufferWidth*o.drawingBufferHeight*4);return o.readPixels(0,0,o.drawingBufferWidth,o.drawingBufferHeight,o.RGBA,o.UNSIGNED_BYTE,_),_}return o.bindFramebuffer(o.FRAMEBUFFER,u),this._canvasPixelComparison(d(l),i.canvasCopies.map(d),i.timeStamps)}_canvasPixelComparison(l,i,o){let u=o[1]-o[0];const d=l.length/4;for(let m=0;m<i.length;m++){const _=i[m];let y=0;for(let v=0;v<_.length;v+=4)_[v]===l[v]&&_[v+1]===l[v+1]&&_[v+2]===l[v+2]&&_[v+3]===l[v+3]&&(y+=1);u+=(o[m+2]-o[m+1])*(1-y/d)}return u}remove(){this._hash&&this._hash.remove();for(const i of this._controls)i.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 l=this.painter.context.gl.getExtension("WEBGL_lose_context");l&&l.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),To.delete(this.painter.context.gl),_s.remove(),un.remove(),this._removed=!0,this.fire(new a.C("remove"))}triggerRepaint(){this._triggerFrame(!0)}_triggerFrame(l){this._renderNextFrame=this._renderNextFrame||l,this.style&&!this._frame&&(this._frame=a.o.frame(i=>{const o=!!this._renderNextFrame;this._frame=null,this._renderNextFrame=null,o&&this._render(i)}))}_preloadTiles(l){const i=this.style?this.style.getSourceCaches():[];return a.t(i,(o,u)=>o._preloadTiles(l,u),()=>{this.triggerRepaint()}),this}_onWindowOnline(){this._update()}_onWindowResize(l){this._trackResize&&this.resize({originalEvent:l})._update()}_onVisibilityChange(){document.visibilityState==="hidden"&&this._visibilityHidden++}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(l){this._showTileBoundaries!==l&&(this._showTileBoundaries=l,this._update())}get showParseStatus(){return!!this._showParseStatus}set showParseStatus(l){this._showParseStatus!==l&&(this._showParseStatus=l,this._update())}get showTerrainWireframe(){return!!this._showTerrainWireframe}set showTerrainWireframe(l){this._showTerrainWireframe!==l&&(this._showTerrainWireframe=l,this._update())}get showLayers2DWireframe(){return!!this._showLayers2DWireframe}set showLayers2DWireframe(l){this._showLayers2DWireframe!==l&&(this._showLayers2DWireframe=l,this._update())}get showLayers3DWireframe(){return!!this._showLayers3DWireframe}set showLayers3DWireframe(l){this._showLayers3DWireframe!==l&&(this._showLayers3DWireframe=l,this._update())}get speedIndexTiming(){return!!this._speedIndexTiming}set speedIndexTiming(l){this._speedIndexTiming!==l&&(this._speedIndexTiming=l,this._update())}get showPadding(){return!!this._showPadding}set showPadding(l){this._showPadding!==l&&(this._showPadding=l,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(l){this._showCollisionBoxes!==l&&(this._showCollisionBoxes=l,this.style&&l?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(l){this._showOverdrawInspector!==l&&(this._showOverdrawInspector=l,this._update())}get repaint(){return!!this._repaint}set repaint(l){this._repaint!==l&&(this._repaint=l,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(l){this._vertices=l,this._update()}get showTileAABBs(){return!!this._showTileAABBs}set showTileAABBs(l){this._showTileAABBs!==l&&(this._showTileAABBs=l,l&&this._update())}_setCacheLimits(l,i){a.eW(l,i)}get version(){return We}},NavigationControl:class{constructor(l={}){this.options=Object.assign({},u_,l),this._container=Jt("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",i=>i.preventDefault()),this.options.showZoom&&(a.a_(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("mapboxgl-ctrl-zoom-in",i=>{this._map&&this._map.zoomIn({},{originalEvent:i})}),Jt("span","mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("mapboxgl-ctrl-zoom-out",i=>{this._map&&this._map.zoomOut({},{originalEvent:i})}),Jt("span","mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(a.a_(["_rotateCompassArrow"],this),this._compass=this._createButton("mapboxgl-ctrl-compass",i=>{const o=this._map;o&&(this.options.visualizePitch?o.resetNorthPitch({},{originalEvent:i}):o.resetNorth({},{originalEvent:i}))}),this._compassIcon=Jt("span","mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){const l=this._map;if(!l)return;const i=l.getZoom(),o=i===l.getMaxZoom(),u=i===l.getMinZoom();this._zoomInButton.disabled=o,this._zoomOutButton.disabled=u,this._zoomInButton.setAttribute("aria-disabled",o.toString()),this._zoomOutButton.setAttribute("aria-disabled",u.toString())}_rotateCompassArrow(){const l=this._map;if(!l)return;const i=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(l.transform.pitch*(Math.PI/180)),.5)}) rotateX(${l.transform.pitch}deg) rotateZ(${l.transform.angle*(180/Math.PI)}deg)`:`rotate(${l.transform.angle*(180/Math.PI)}deg)`;l._requestDomTask(()=>{this._compassIcon&&(this._compassIcon.style.transform=i)})}onAdd(l){return this._map=l,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),l.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&l.on("pitch",this._rotateCompassArrow),l.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new jl(l,this._compass,this.options.visualizePitch)),this._container}onRemove(){const l=this._map;l&&(this._container.remove(),this.options.showZoom&&l.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&l.off("pitch",this._rotateCompassArrow),l.off("rotate",this._rotateCompassArrow),this._handler&&this._handler.off(),this._handler=void 0),this._map=void 0)}_createButton(l,i){const o=Jt("button",l,this._container);return o.type="button",o.addEventListener("click",i),o}_setButtonTitle(l,i){if(!this._map)return;const o=this._map._getUIString(`NavigationControl.${i}`);l.setAttribute("aria-label",o),l.firstElementChild&&l.firstElementChild.setAttribute("title",o)}},GeolocateControl:class extends a.E{constructor(l={}){super();const i=navigator.geolocation;this.options=Object.assign({geolocation:i},ql,l),a.a_(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker","_updateMarkerRotation","_onDeviceOrientation"],this),this._updateMarkerRotationThrottled=nd(this._updateMarkerRotation,20),this._numberOfWatches=0}onAdd(l){return this._map=l,this._container=Jt("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(l){const i=(o=!!this.options.geolocation)=>{this._supportsGeolocation=o,l(o)};this._supportsGeolocation!==void 0?l(this._supportsGeolocation):navigator.permissions!==void 0?navigator.permissions.query({name:"geolocation"}).then(o=>i(o.state!=="denied")).catch(()=>i()):i()}_isOutOfMapMaxBounds(l){const i=this._map.getMaxBounds(),o=l.coords;return!!i&&(o.longitude<i.getWest()||o.longitude>i.getEast()||o.latitude<i.getSouth()||o.latitude>i.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting")}}_onSuccess(l){if(this._map){if(this._clearRequestTimeout(),this._isOutOfMapMaxBounds(l))return this._setErrorState(),this.fire(new a.C("outofmaxbounds",l)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=l,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_E
3261RROR":this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this.options.followUserLocation?(this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active")):(this._watchState="BACKGROUND",this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"));break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background")}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(l),this.options.followUserLocation&&(!this.options.trackUserLocation||this._watchState==="ACTIVE_LOCK")&&this._updateCamera(l),this.options.showUserLocation&&this._userLocationDotMarker.removeClassName("mapboxgl-user-location-dot-stale"),this.fire(new a.C("geolocate",Object.assign({coords:l.coords,timestamp:l.timestamp},l.toJSON?{toJSON:l.toJSON.bind(l)}:{}))),this._finish()}}_updateCamera(l){const i=new a.aV(l.coords.longitude,l.coords.latitude),o=l.coords.accuracy,u=this._map.getBearing(),d=Object.assign({bearing:u},this.options.fitBoundsOptions);this._map.fitBounds(i.toBounds(o),d,{geolocateSource:!0})}_updateMarker(l){if(l){const i=new a.aV(l.coords.longitude,l.coords.latitude);this._accuracyCircleMarker.setLngLat(i).addTo(this._map),this._userLocationDotMarker.setLngLat(i).addTo(this._map),this._accuracy=l.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){const l=this._map.transform,i=a.bV(1,l._center.lat)*l.worldSize,o=Math.ceil(2*this._accuracy*i);this._circleElement.style.width=`${o}px`,this._circleElement.style.height=`${o}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}_updateMarkerRotation(){this._userLocationDotMarker&&typeof this._heading=="number"?(this._userLocationDotMarker.setRotation(this._heading),this._userLocationDotMarker.addClassName("mapboxgl-user-location-show-heading")):(this._userLocationDotMarker.removeClassName("mapboxgl-user-location-show-heading"),this._userLocationDotMarker.setRotation(0))}_onError(l){if(this._map){if(this._clearRequestTimeout(),this.options.trackUserLocation)if(l.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const i=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.setAttribute("aria-label",i),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",i),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(l.code===3&&this._noTimeout)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._userLocationDotMarker.addClassName("mapboxgl-user-location-dot-stale"),this.fire(new a.C("error",{code:l.code,message:l.message,PERMISSION_DENIED:l.PERMISSION_DENIED,POSITION_UNAVAILABLE:l.POSITION_UNAVAILABLE,TIMEOUT:l.TIMEOUT})),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_startRequestTimeout(){this._clearRequestTimeout();const l=this.options.positionOptions.timeout;l&&(this._requestTimeoutId=window.setTimeout(()=>{this._onError({code:3,message:"Geolocation request timed out"})},l))}_clearRequestTimeout(){this._requestTimeoutId!==void 0&&(clearTimeout(this._requestTimeoutId),this._requestTimeoutId=void 0)}_setupUI(l){if(this._map!==void 0){if(this._container.addEventListener("contextmenu",i=>i.preventDefault()),this._geolocateButton=Jt("button","mapboxgl-ctrl-geolocate",this._container),Jt("span","mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",l===!1){a.w("Geolocation support is not available so the GeolocateControl will be disabled.");const i=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.setAttribute("aria-label",i),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",i)}else{const i=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.setAttribute("aria-label",i),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",i)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","fal
3261se"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=Jt("div","mapboxgl-user-location"),this._dotElement.appendChild(Jt("div","mapboxgl-user-location-dot")),this._dotElement.appendChild(Jt("div","mapboxgl-user-location-heading")),this._userLocationDotMarker=new Bn({element:this._dotElement,rotationAlignment:"map",pitchAlignment:"map"}),this._circleElement=Jt("div","mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Bn({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.showButton||(this._container.style.display="none"),this.options.trackUserLocation&&this._map.on("movestart",i=>{i.geolocateSource||this._watchState!=="ACTIVE_LOCK"||i.originalEvent&&i.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this.fire(new a.C("trackuserlocationend")))})}}_onDeviceOrientation(l){this._userLocationDotMarker&&(l.webkitCompassHeading?this._heading=l.webkitCompassHeading:l.absolute===!0&&(this._heading=-1*l.alpha),this._updateMarkerRotationThrottled())}trigger(){if(!this._setup)return a.w("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new a.C("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":this._numberOfWatches--,this._noTimeout=!1,this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this.fire(new a.C("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new a.C("trackuserlocationstart"))}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"BACKGROUND":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background");break;case"BACKGROUND_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error")}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let l;this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),this._numberOfWatches++,this._numberOfWatches>1?(l={maximumAge:6e5,timeout:0},this._noTimeout=!0):(l=this.options.positionOptions,this._noTimeout=!1),this._geolocationWatchID=this.options.geolocation.watchPosition(this._onSuccess,this._onError,l),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(l){return this.options.followUserLocation=l??ql.followUserLocation,this.options.trackUserLocation&&this._watchState!=="OFF"&&(this.options.followUserLocation?this._watchState!=="BACKGROUND"&&this._watchState!=="BACKGROUND_ERROR"||(this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new a.C("trackuserlocationstart"))):this._watchState!=="ACTIVE_LOCK"&&this._watchState!=="ACTIVE_E
3261RROR"||(this._watchState="BACKGROUND",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"),this.fire(new a.C("trackuserlocationend")))),this}_addDeviceOrientationListener(){const l=()=>{const i="ondeviceorientationabsolute"in window?"deviceorientationabsolute":"deviceorientation";window.addEventListener(i,this._onDeviceOrientation)};typeof DeviceOrientationEvent.requestPermission=="function"?DeviceOrientationEvent.requestPermission().then(i=>{i==="granted"&&l()}).catch(console.error):l()}_clearWatch(){this._clearRequestTimeout(),this.options.geolocation.clearWatch(this._geolocationWatchID),window.removeEventListener("deviceorientation",this._onDeviceOrientation),window.removeEventListener("deviceorientationabsolute",this._onDeviceOrientation),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},AttributionControl:xd,ScaleControl:class{constructor(l={}){this.options=Object.assign({},ir,l),a.a_(["_update","_setScale","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_update(){const l=this.options.maxWidth||100,i=this._map,o=i._containerHeight/2,u=i._containerWidth/2-l/2,d=i.unproject([u,o]),m=i.unproject([u+l,o]),_=d.distanceTo(m);if(this.options.unit==="imperial"){const y=3.2808*_;y>5280?this._setScale(l,y/5280,"mile"):this._setScale(l,y,"foot")}else this.options.unit==="nautical"?this._setScale(l,_/1852,"nautical-mile"):_>=1e3?this._setScale(l,_/1e3,"kilometer"):this._setScale(l,_,"meter")}_setScale(l,i,o){this._map._requestDomTask(()=>{const u=function(m){const _=Math.pow(10,`${Math.floor(m)}`.length-1);let y=m/_;return y=y>=10?10:y>=5?5:y>=3?3:y>=2?2:y>=1?1:function(v){const T=Math.pow(10,Math.ceil(-Math.log(v)/Math.LN10));return Math.round(v*T)/T}(y),_*y}(i),d=u/i;this._container.innerHTML=o!=="nautical-mile"?new Intl.NumberFormat(this._language,{style:"unit",unitDisplay:"short",unit:o}).format(u):`${u}&nbsp;${kn[o]}`,this._container.style.width=l*d+"px"})}onAdd(l){return this._map=l,this._language=l.getLanguage(),this._container=Jt("div","mapboxgl-ctrl mapboxgl-ctrl-scale",l.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(l){this._language=l,this._update()}setUnit(l){this.options.unit=l,this._update()}},FullscreenControl:class{constructor(l={}){this._fullscreen=!1,l&&l.container&&(l.container instanceof HTMLElement?this._container=l.container:a.w("Full screen control 'container' must be a DOM element.")),a.a_(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onwebkitfullscreenchange"in document&&(this._fullscreenchange="webkitfullscreenchange")}onAdd(l){return this._map=l,this._container||(this._container=this._map.getContainer()),this._controlContainer=Jt("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",a.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 l=this._fullscreenButton=Jt("button","mapboxgl-ctrl-fullscreen",this._controlContainer);Jt("span","mapboxgl-ctrl-icon",l).setAttribute("aria-hidden","true"),l.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){const l=this._getTitle();this._fullscreenButton.setAttribute("aria-label",l),this._fullscreenButton.firstElementChild&&this._fullscreenButton.firstElementChild.setAttribute("title",l)}_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(){a.a_(["_onIndoorUpdate","_onStyleData","_scrollUp","_scrollDown","_toggleIndoor"],this),this._visibleFloorStart=0,this._lastSelectedFloorId=null}onAdd(l){return this._map=l,this._container=Jt("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.style.display="none",this._map.on("styledata",this._onStyleData),this._updateConnection(),this._container}_onStyleData(){this._updateConnection()}_updateConnection(){if(this._map&&this._map.style&&this._map.style.indoorManager){const l=this._map.style.indoorManager;l.off("selector-update",this._onIndoorUpdate),l.on("selector-update",this._onIndoorUpdate),this._onIndoorUpdate(l.getControlState())}}_createButton(l,i){const o=Jt("button",l,this._container);return o.type="button",o.addEventListener("click",i),o}_setButtonTitle(l,i){l.setAttribute("aria-label",i),l.textContent=i}onRemove(){this._container&&this._container.remove(),this._map&&(this._map.off("styledata",this._onStyleData),this._map.style&&this._map.style.indoorManager.off("selector-update",this._onIndoorUpdate),this._map=null)}getDefaultPosition(){return"top-right"}_onIndoorUpdate(l){if(!l||!l.floors||l.floors.length===0)return this._model=l,void(this._container.style.display="none");const i=this._model;this._model=l,this._container.style.display="inline-block";const o=!i||i.floors.length!==l.floors.length||i.floors.some((u,d)=>u.id!==l.floors[d].id);if(o&&(this._visibleFloorStart=0,this._lastSelectedFloorId=null),l.selectedFloorId){if(l.selectedFloorId!==this._lastSelectedFloorId||o){const u=l.floors.findIndex(d=>d.id===l.selectedFloorId);if(u!==-1){const d=l.floors.length;let m,_;d<=5?(m=0,_=d-1):this._visibleFloorStart===0?(m=0,_=3):this._visibleFloorStart>=d-3?(m=d-3-1,_=d-1):(m=this._visibleFloorStart,_=this._visibleFloorStart+3-1),u<m?this._visibleFloorStart=u:u>_&&(this._visibleFloorStart=u-2)}}this._lastSelectedFloorId=l.selectedFloorId}this._render()}
vendor: 9,200 bytes, line 3261
3261_render(){if(!this._container||!this._model||!this._model.floors)return;this._container.innerHTML="";const l=this._createButton("mapboxgl-ctrl-indoor-toggle",this._toggleIndoor);Jt("span","mapboxgl-ctrl-icon",l).setAttribute("aria-hidden","true"),this._model.activeFloorsVisible||l.classList.add("mapboxgl-ctrl-level-button-selected"),this._container.appendChild(l);const i=this._model.floors,o=i.length;if(o<=5)return void i.forEach(_=>this._createFloorButton(_));const u=this._visibleFloorStart===0,d=this._visibleFloorStart>=o-3;if(u)this._createFloorButton(i[0]);else{const _=this._createButton("mapboxgl-ctrl-arrow-up",this._scrollUp);Jt("span","mapboxgl-ctrl-icon",_).setAttribute("aria-hidden","true"),this._container.appendChild(_)}let m=[];if(m=u?i.slice(1,4):d?i.slice(this._visibleFloorStart-1,this._visibleFloorStart+3-1):i.slice(this._visibleFloorStart,this._visibleFloorStart+3),m.forEach(_=>this._createFloorButton(_)),d)this._createFloorButton(i[o-1]);else{const _=this._createButton("mapboxgl-ctrl-arrow-down",this._scrollDown);Jt("span","mapboxgl-ctrl-icon",_).setAttribute("aria-hidden","true"),this._container.appendChild(_)}}_createFloorButton(l){const i=this._createButton("mapboxgl-ctrl-level-button",()=>{const m=l.id;this._model&&this._model.selectedFloorId===m&&this._model.activeFloorsVisible||this._map&&(this._model&&!this._model.activeFloorsVisible&&this._map.style&&this._map.style.indoorManager&&this._map.style.indoorManager.setActiveFloorsVisibility(!0),this._map._selectIndoorFloor(m))}),o=(l.name||"").trim(),u=l.zIndex.toString(),d=o?Array.from(o).slice(0,3).join(""):u;this._setButtonTitle(i,d),this._model&&this._model.activeFloorsVisible&&l.id===this._model.selectedFloorId&&i.classList.add("mapboxgl-ctrl-level-button-selected"),this._container&&this._container.appendChild(i)}_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 l=this._model&&this._model.floors||[];if(l.length>3){const i=l.length-3;this._visibleFloorStart===i-1&&(this._visibleFloorStart=i-2)}this._render()}}_scrollDown(){if(this._model&&this._model.floors){const l=this._model.floors.length-3;this._visibleFloorStart<l&&(this._visibleFloorStart++,this._visibleFloorStart===1&&(this._visibleFloorStart=2),this._visibleFloorStart===l-1&&(this._visibleFloorStart=l),this._visibleFloorStart>l&&(this._visibleFloorStart=l),this._render())}}},Popup:class extends a.E{constructor(l){super(),this.options=Object.assign(Object.create($l),l),this._altitude=this.options.altitude,a.a_(["_update","_onClose","remove","_onMouseEvent"],this),this._classList=new Set(l&&l.className?l.className.trim().split(/\s+/):[])}addTo(l){return this._map&&this.remove(),this._map=l,this.options.closeOnClick&&l.on("preclick",this._onClose),this.options.closeOnMove&&l.on("move",this._onClose),l.on("remove",this.remove),this._update(),l._addPopup(this),this._focusFirstElement(),this._trackPointer?(l.on("mousemove",this._onMouseEvent),l.on("mouseup",this._onMouseEvent),l._canvasContainer.classList.add("mapboxgl-track-pointer")):l.on("move",this._update),this.fire(new a.C("open")),this}isOpen(){return!!this._map}remove(){this._content&&this._content.remove(),this._container&&(this._container.remove(),this._container=void 0);const l=this._map;return l&&(l.off("move",this._update),l.off("move",this._onClose),l.off("preclick",this._onClose),l.off("click",this._onClose),l.off("remove",this.remove),l.off("mousemove",this._onMouseEvent),l.off("mouseup",this._onMouseEvent),l.off("drag",this._onMouseEvent),l._canvasContainer&&l._canvasContainer.classList.remove("mapboxgl-track-pointer"),l._removePopup(this),this._map=void 0),this.fire(new a.C("close")),this}getLngLat(){return this._lngLat}setLngLat(l){this._lngLat=a.aV.convert(l),this._pos=null,this._trackPointer=!1,this._update();const i=this._map;return i&&(i.on("move",this._update),i.off("mousemove",this._onMouseEvent),i._canvasContainer.classList.remove("mapboxgl-track-pointer")),this}getAltitude(){return this._altitude}setAltitude(l){return this._altitude=l,this._update(),this}trackPointer(){this._trackPointer=!0,this._pos=null,this._update();const l=this._map;return l&&(l.off("move",this._update),l.on("mousemove",this._onMouseEvent),l.on("drag",this._onMouseEvent),l._canvasContainer.classList.add("mapboxgl-track-pointer")),this}getElement(){return this._container}setText(l){return this.setDOMContent(document.createTextNode(l))}setHTML(l){const i=document.createDocumentFragment(),o=document.createElement("body");let u;for(o.innerHTML=l;u=o.firstChild,u;)i.appendChild(u);return this.setDOMContent(i)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(l){return this.options.maxWidth=l,this._update(),this}setDOMContent(l){let i=this._content;if(i)for(;i.hasChildNodes();)i.firstChild&&i.removeChild(i.firstChild);else i=this._content=Jt("div","mapboxgl-popup-content",this._container||void 0);if(i.appendChild(l),this.options.closeButton){const o=this._closeButton=Jt("button","mapboxgl-popup-close-button",i);o.type="button",o.setAttribute("aria-label","Close popup"),o.innerHTML='<span aria-hidden="true">&#215;</span>',o.addEventListener("click",this._onClose)}return this._update(),this._focusFirstElement(),this}addClassName(l){return this._classList.add(l),this._updateClassList(),this}removeClassName(l){return this._classList.delete(l),this._updateClassList(),this}setOffset(l){return this.options.offset=l,this._update(),this}toggleClassName(l){let i;return this._classList.delete(l)?i=!1:(this._classList.add(l),i=!0),this._updateClassList(),i}_onMouseEvent(l){this._update(l.point)}_getAnchor(l){if(this.options.anchor)return this.options.anchor;const i=this._map,o=this._container,u=this._pos;if(!i||!o||!u)return"bottom";const d=o.offsetWidth,m=o.offsetHeight,_=u.x<d/2,y=u.x>i.transform.width-d/2;if(u.y+l<m)return _?"top-left":y?"top-right":"top";if(u.y>i.transform.height-m){if(_)return"bottom-left";if(y)return"bottom-right"}return _?"left":y?"right":"bottom"}_updateClassList(){const l=this._container;if(!l)return;const i=[...this._classList];i.push("mapboxgl-popup"),this._anchor&&i.push(`mapboxgl-popup-anchor-${this._anchor}`),this._trackPointer&&i.push("mapboxgl-popup-track-pointer"),l.className=i.join(" ")}_update(l){const i=this._map,o=this._content;if(!i||!this._lngLat&&!this._trackPointer||!o)return;let u=this._container;if(u||(u=this._container=Jt("div","mapboxgl-popup",i.getContainer()),this._tip=Jt("div","mapboxgl-popup-tip",u),u.appendChild(o)),this.options.maxWidth&&u.style.maxWidth!==this.options.maxWidth&&(u.style.maxWidth=this.options.maxWidth),i.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=bd(this._lngLat,this._pos,i.transform)),!this._trackPointer||l){const d=this._pos=this._trackPointer&&l instanceof a.P?l:i.project(this._lngLat,this._altitude),m=Su(this.options.offset),_=this._anchor=this._getAnchor(m.y),y=Su(this.options.offset,_),v=d.add(y).round();i._requestDomTask(()=>{this._container&&_&&(this._container.style.transform=`${Gl[_]} translate(${v.x}px,${v.y}px)`)})}if(!this._marker&&i._showingGlobe()){const d=a.eX(i.transform,this._lngLat)?0:1;this._setOpacity(d)}this._updateClassList()}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const l=this._container.querySelector(h_);l&&l.focus()}_onClose(){this.remove()}_setOpacity(l){this._container&&(this._container.style.opacity=`${l}`),this._content&&(this._content.style.pointerEvents=l?"auto":"none")}},Marker:Bn,Style:zn,LngLat:a.aV,LngLatBounds:a.aK,Point:a.P,MercatorCoordinate:a.ag,FreeCameraOptions:Mc,Evented:a.E,config:a.e,prewarm:function(){jo().acquire(Ks)},clearPrewarmedResources:function(){const l=br;l&&(l.isPreloaded()&&l.numActive()===1?(l.release(Ks),br=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 a.e.ACCESS_TOKEN},set accessToken(l){a.e.ACCESS_TOKEN=l},get baseApiUrl(){return a.e.API_URL},set baseApiUrl(l){a.e.API_URL=l},get workerCount(){return hn.workerCount},set workerCount(l){hn.workerCount=l},get maxParallelImageRequests(){return a.e.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(l){a.e.MAX_PARALLEL_IMAGE_REQUESTS=l},clearStorage(l){a.f3(l)},get workerUrl(){return Rr.workerUrl},set workerUrl(l){Rr.workerUrl=l},get workerClass(){return Rr.workerClass},set workerClass(l){Rr.workerClass=l},get workerParams(){return Rr.workerParams},set workerParams(l){Rr.workerParams=l},get dracoUrl(){return a.f2()},set dracoUrl(l){a.e.DRACO_URL=a.o.resolveURL(l)},get meshoptUrl(){return a.f1()},set meshoptUrl(l){const i=a.o.resolveURL(l);a.e.MESHOPT_URL=i,a.e.MESHOPT_SIMD_URL=i},get buildingGenUrl(){return a.f0()},set buildingGenUrl(l){a.e.BUILDING_GEN_URL=a.o.resolveURL(l)},setNow:a.o.setNow,restoreNow:a.o.restoreNow}});var ob=Am;return ob})})(rb);
3261var a2=rb.exports;const u2=o2(a2);export{u2 as m};
3262//# sourceMappingURL=mapbox-DL6ddhkj.js.map

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.