vendor: 7,661 bytes, line 1
1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[240],{7856:function(i){i.exports=function(){"use strict";let i,r,a;function n(n,o){if(i)if(r){let n={};i(void 0,n),a=o(n);let s="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 = {}; ("+i+")(undefined, sharedChunk); ("+r+")(undefined, sharedChunk); self.onerror = null;";"u">typeof window&&window&&window.URL&&window.URL.createObjectURL&&(a.workerUrl=window.URL.createObjectURL(new Blob([s],{type:"text/javascript"})))}else r=o;else i=o}return n(["require","exports"],function(i,r){let a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w,T,S,E,I,A,M,C,P,D,R,z,L,F,O,B,k,N,U,V,j,G,H,$,q,Z;var W="undefined"!=typeof Float32Array?Float32Array:Array;function X(i,r){var a=r[0],n=r[1],o=r[2],s=r[3],l=a*s-o*n;return l?(i[0]=s*(l=1/l),i[1]=-n*l,i[2]=-o*l,i[3]=a*l,i):null}function Y(){var i=new W(9);return W!=Float32Array&&(i[1]=0,i[2]=0,i[3]=0,i[5]=0,i[6]=0,i[7]=0),i[0]=1,i[4]=1,i[8]=1,i}function J(i,r){var a=r[0],n=r[1],o=r[2],s=r[3],l=r[4],h=r[5],u=r[6],c=r[7],d=r[8];return i[0]=l*d-h*c,i[1]=o*c-n*d,i[2]=n*h-o*l,i[3]=h*u-s*d,i[4]=a*d-o*u,i[5]=o*s-a*h,i[6]=s*c-l*u,i[7]=n*u-a*c,i[8]=a*l-n*s,i}function K(i,r,a){var n=r[0],o=r[1],s=r[2],l=r[3],h=r[4],u=r[5],c=r[6],d=r[7],p=r[8],f=a[0],m=a[1],_=a[2],g=a[3],y=a[4],x=a[5],v=a[6],b=a[7],w=a[8];return i[0]=f*n+m*l+_*c,i[1]=f*o+m*h+_*d,i[2]=f*s+m*u+_*p,i[3]=g*n+y*l+x*c,i[4]=g*o+y*h+x*d,i[5]=g*s+y*u+x*p,i[6]=v*n+b*l+w*c,i[7]=v*o+b*h+w*d,i[8]=v*s+b*u+w*p,i}function Q(){var i=new W(16);return W!=Float32Array&&(i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[11]=0,i[12]=0,i[13]=0,i[14]=0),i[0]=1,i[5]=1,i[10]=1,i[15]=1,i}function ee(i){var r=new W(16);return r[0]=i[0],r[1]=i[1],r[2]=i[2],r[3]=i[3],r[4]=i[4],r[5]=i[5],r[6]=i[6],r[7]=i[7],r[8]=i[8],r[9]=i[9],r[10]=i[10],r[11]=i[11],r[12]=i[12],r[13]=i[13],r[14]=i[14],r[15]=i[15],r}function et(i){return i[0]=1,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=1,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=1,i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i}function ei(i,r){var a=r[0],n=r[1],o=r[2],s=r[3],l=r[4],h=r[5],u=r[6],c=r[7],d=r[8],p=r[9],f=r[10],m=r[11],_=r[12],g=r[13],y=r[14],x=r[15],v=a*h-n*l,b=a*u-o*l,w=a*c-s*l,T=n*u-o*h,S=n*c-s*h,E=o*c-s*u,I=d*g-p*_,A=d*y-f*_,M=d*x-m*_,C=p*y-f*g,P=p*x-m*g,D=f*x-m*y,R=v*D-b*P+w*C+T*M-S*A+E*I;return R?(i[0]=(h*D-u*P+c*C)*(R=1/R),i[1]=(o*P-n*D-s*C)*R,i[2]=(g*E-y*S+x*T)*R,i[3]=(f*S-p*E-m*T)*R,i[4]=(u*M-l*D-c*A)*R,i[5]=(a*D-o*M+s*A)*R,i[6]=(y*w-_*E-x*b)*R,i[7]=(d*E-f*w+m*b)*R,i[8]=(l*P-h*M+c*I)*R,i[9]=(n*M-a*P-s*I)*R,i[10]=(_*S-g*w+x*v)*R,i[11]=(p*w-d*S-m*v)*R,i[12]=(h*A-l*C-u*I)*R,i[13]=(a*C-n*A+o*I)*R,i[14]=(g*b-_*T-y*v)*R,i[15]=(d*T-p*b+f*v)*R,i):null}function er(i,r,a){var n=r[0],o=r[1],s=r[2],l=r[3],h=r[4],u=r[5],c=r[6],d=r[7],p=r[8],f=r[9],m=r[10],_=r[11],g=r[12],y=r[13],x=r[14],v=r[15],b=a[0],w=a[1],T=a[2],S=a[3];return i[0]=b*n+w*h+T*p+S*g,i[1]=b*o+w*u+T*f+S*y,i[2]=b*s+w*c+T*m+S*x,i[3]=b*l+w*d+T*_+S*v,i[4]=(b=a[4])*n+(w=a[5])*h+(T=a[6])*p+(S=a[7])*g,i[5]=b*o+w*u+T*f+S*y,i[6]=b*s+w*c+T*m+S*x,i[7]=b*l+w*d+T*_+S*v,i[8]=(b=a[8])*n+(w=a[9])*h+(T=a[10])*p+(S=a[11])*g,i[9]=b*o+w*u+T*f+S*y,i[10]=b*s+w*c+T*m+S*x,i[11]=b*l+w*d+T*_+S*v,i[12]=(b=a[12])*n+(w=a[13])*h+(T=a[14])*p+(S=a[15])*g,i[13]=b*o+w*u+T*f+S*y,i[14]=b*s+w*c+T*m+S*x,i[15]=b*l+w*d+T*_+S*v,i}function ea(i,r,a){var n,o,s,l,h,u,c,d,p,f,m,_,g=a[0],y=a[1],x=a[2];return r===i?(i[12]=r[0]*g+r[4]*y+r[8]*x+r[12],i[13]=r[1]*g+r[5]*y+r[9]*x+r[13],i[14]=r[2]*g+r[6]*y+r[10]*x+r[14],i[15]=r[3]*g+r[7]*y+r[11]*x+r[15]):(o=r[1],s=r[2],l=r[3],h=r[4],u=r[5],c=r[6],d=r[7],p=r[8],f=r[9],m=r[10],_=r[11],i[0]=n=r[0],i[1]=o,i[2]=s,i[3]=l,i[4]=h,i[5]=u,i[6]=c,i[7]=d,i[8]=p,i[9]=f,i[10]=m,i[11]=_,i[12]=n*g+h*y+p*x+r[12],i[13]=o*g+u*y+f*x+r[13],i[14]=s*g+c*y+m*x+r[14],i[15]=l*g+d*y+_*x+r[15]),i}function en(i,r,a){var n=a[0],o=a[1],s=a[2];return i[0]=r[0]*n,i[1]=r[1]*n,i[2]=r[2]*n,i[3]=r[3]*n,i[4]=r[4]*o,i[5]=r[5]*o,i[6]=r[6]*o,i[7]=r[7]*o,i[8]=r[8]*s,i[9]=r[9]*s,i[10]=r[10]*s,i[11]=r[11]*s,i[12]=r[12],i[13]=r[13],i[14]=r[14],i[15]=r[15],i}function eo(i,r,a){var n=Math.sin(a),o=Math.cos(a),s=r[4],l=r[5],h=r[6],u=r[7],c=r[8],d=r[9],p=r[10],f=r[11];return r!==i&&(i[0]=r[0],i[1]=r[1],i[2]=r[2],i[3]=r[3],i[12]=r[12],i[13]=r[13],i[14]=r[14],i[15]=r[15]),i[4]=s*o+c*n,i[5]=l*o+d*n,i[6]=h*o+p*n,i[7]=u*o+f*n,i[8]=c*o-s*n,i[9]=d*o-l*n,i[10]=p*o-h*n,i[11]=f*o-u*n,i}function es(i,r,a){var n=Math.sin(a),o=Math.cos(a),s=r[0],l=r[1],h=r[2],u=r[3],c=r[8],d=r[9],p=r[10],f=r[11];return r!==i&&(i[4]=r[4],i[5]=r[5],i[6]=r[6],i[7]=r[7],i[12]=r[12],i[13]=r[13],i[14]=r[14],i[15]=r[15]),i[0]=s*o-c*n,i[1]=l*o-d*n,i[2]=h*o-p*n,i[3]=u*o-f*n,i[8]=s*n+c*o,i[9]=l*n+d*o,i[10]=h*n+p*o,i[11]=u*n+f*o,i}function el(i,r,a){var n=Math.sin(a),o=Math.cos(a),s=r[0],l=r[1],h=r[2],u=r[3],c=r[4],d=r[5],p=r[6],f=r[7];return r!==i&&(i[8]=r[8],i[9]=r[9],i[10]=r[10],i[11]=r[11],i[12]=r[12],i[13]=r[13],i[14]=r[14],i[15]=r[15]),i[0]=s*o+c*n,i[1]=l*o+d*n,i[2]=h*o+p*n,i[3]=u*o+f*n,i[4]=c*o-s*n,i[5]=d*o-l*n,i[6]=p*o-h*n,i[7]=f*o-u*n,i}function eh(i,r){return i[0]=1,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=1,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=1,i[11]=0,i[12]=r[0],i[13]=r[1],i[14]=r[2],i[15]=1,i}function eu(i,r){return i[0]=r[0],i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=r[1],i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=r[2],i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i}function ec(i,r,a){var n,o,s,l=a[0],h=a[1],u=a[2],c=Math.sqrt(l*l+h*h+u*u);return c<1e-6?null:(l*=c=1/c,h*=c,u*=c,n=Math.sin(r),o=Math.cos(r),i[0]=l*l*(s=1-o)+o,i[1]=h*l*s+u*n,i[2]=u*l*s-h*n,i[3]=0,i[4]=l*h*s-u*n,i[5]=h*h*s+o,i[6]=u*h*s+l*n,i[7]=0,i[8]=l*u*s+h*n,i[9]=h*u*s-l*n,i[10]=u*u*s+o,i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i)}function ed(i,r){var a=r[0],n=r[1],o=r[2],s=r[4],l=r[5],h=r[6],u=r[8],c=r[9],d=r[10];return i[0]=Math.sqrt(a*a+n*n+o*o),i[1]=Math.sqrt(s*s+l*l+h*h),i[2]=Math.sqrt(u*u+c*c+d*d),i}function ep(i,r){var a=r[0],n=r[1],o=r[2],s=r[3],l=a+a,h=n+n,u=o+o,c=a*l,d=n*l,p=n*h,f=o*l,m=o*h,_=o*u,g=s*l,y=s*h,x=s*u;return i[0]=1-p-_,i[1]=d+x,i[2]=f-y,i[3]=0,i[4]=d-x,i[5]=1-c-_,i[6]=m+g,i[7]=0,i[8]=f+y,i[9]=m-g,i[10]=1-c-p,i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i}function ef(){var i=new W(3);return W!=Float32Array&&(i[0]=0,i[1]=0,i[2]=0),i}function em(i){var r=new W(3);return r[0]=i[0],r[1]=i[1],r[2]=i[2],r}function e_(i){var r=i[0],a=i[1],n=i[2];return Math.sqrt(r*r+a*a+n*n)}function eg(i,r,a){var n=new W(3);return n[0]=i,n[1]=r,n[2]=a,n}function ey(i,r,a,n){return i[0]=r,i[1]=a,i[2]=n,i}function ex(i,r,a){return i[0]=r[0]+a[0],i[1]=r[1]+a[1],i[2]=r[2]+a[2],i}function ev(i,r,a){return i[0]=r[0]-a[0],i[1]=r[1]-a[1],i[2]=r[2]-a[2],i}function eb(i,r,a){return i[0]=r[0]*a[0],i[1]=r[1]*a[1],i[2]=r[2]*a[2],i}function ew(i,r,a){return i[0]=Math.min(r[0],a[0]),i[1]=Math.min(r[1],a[1]),i[2]=Math.min(r[2],a[2]),i}function eT(i,r,a){return i[0]=Math.max(r[0],a[0]),i[1]=Math.max(r[1],a[1]),i[2]=Math.max(r[2],a[2]),i}function eS(i,r,a){return i[0]=r[0]*a,i[1]=r[1]*a,i[2]=r[2]*a,i}function eE(i,r,a,n){return i[0]=r[0]+a[0]*n,i[1]=r[1]+a[1]*n,i[2]=r[2]+a[2]*n,i}function eI(i,r){var a=r[0]-i[0],n=r[1]-i[1],o=r[2]-i[2];return Math.sqrt(a*a+n*n+o*o)}function eA(i,r){var a=r[0]-i[0],n=r[1]-i[1],o=r[2]-i[2];return a*a+n*n+o*o}function eM(i){var r=i[0],a=i[1],n=i[2];return r*r+a*a+n*n}function eC(i,r){return i[0]=-r[0],i[1]=-r[1],i[2]=-r[2],i}function eP(i,r){var a=r[0],n=r[1],o=r[2],s=a*a+n*n+o*o;return s>0&&(s=1/Math.sqrt(s)),i[0]=r[0]*s,i[1]=r[1]*s,i[2]=r[2]*s,i}function eD(i,r){return i[0]*r[0]+i[1]*r[1]+i[2]*r[2]}function eR(i,r,a){var n=r[0],o=r[1],s=r[2],l=a[0],h=a[1],u=a[2];
1return i[0]=o*u-s*h,i[1]=s*l-n*u,i[2]=n*h-o*l,i}function ez(i,r,a,n){var o=r[0],s=r[1],l=r[2];return i[0]=o+n*(a[0]-o),i[1]=s+n*(a[1]-s),i[2]=l+n*(a[2]-l),i}function eL(i,r,a){var n=r[0],o=r[1],s=r[2],l=a[3]*n+a[7]*o+a[11]*s+a[15];return i[0]=(a[0]*n+a[4]*o+a[8]*s+a[12])/(l=l||1),i[1]=(a[1]*n+a[5]*o+a[9]*s+a[13])/l,i[2]=(a[2]*n+a[6]*o+a[10]*s+a[14])/l,i}function eF(i,r,a){var n=r[0],o=r[1],s=r[2];return i[0]=n*a[0]+o*a[3]+s*a[6],i[1]=n*a[1]+o*a[4]+s*a[7],i[2]=n*a[2]+o*a[5]+s*a[8],i}function eO(i,r,a){var n=a[0],o=a[1],s=a[2],l=a[3],h=r[0],u=r[1],c=r[2],d=o*c-s*u,p=s*h-n*c,f=n*u-o*h;return i[0]=h+l*(d+=d)+o*(f+=f)-s*(p+=p),i[1]=u+l*p+s*d-n*f,i[2]=c+l*f+n*p-o*d,i}function eB(i){return i[0]=0,i[1]=0,i[2]=0,i}function ek(i,r){return i[0]===r[0]&&i[1]===r[1]&&i[2]===r[2]}function eN(){var i=new W(4);return W!=Float32Array&&(i[0]=0,i[1]=0,i[2]=0,i[3]=0),i}function eU(i,r,a){return i[0]=r[0]*a,i[1]=r[1]*a,i[2]=r[2]*a,i[3]=r[3]*a,i}function eV(i,r){var a=r[0],n=r[1],o=r[2],s=r[3],l=a*a+n*n+o*o+s*s;return l>0&&(l=1/Math.sqrt(l)),i[0]=a*l,i[1]=n*l,i[2]=o*l,i[3]=s*l,i}function ej(i,r,a){var n=r[0],o=r[1],s=r[2],l=r[3];return i[0]=a[0]*n+a[4]*o+a[8]*s+a[12]*l,i[1]=a[1]*n+a[5]*o+a[9]*s+a[13]*l,i[2]=a[2]*n+a[6]*o+a[10]*s+a[14]*l,i[3]=a[3]*n+a[7]*o+a[11]*s+a[15]*l,i}function eG(){var i=new W(4);return W!=Float32Array&&(i[0]=0,i[1]=0,i[2]=0),i[3]=1,i}function eH(i){return i[0]=0,i[1]=0,i[2]=0,i[3]=1,i}function e$(i,r,a){a*=.5;var n=r[0],o=r[1],s=r[2],l=r[3],h=Math.sin(a),u=Math.cos(a);return i[0]=n*u+l*h,i[1]=o*u+s*h,i[2]=s*u-o*h,i[3]=l*u-n*h,i}function eq(i,r,a){a*=.5;var n=r[0],o=r[1],s=r[2],l=r[3],h=Math.sin(a),u=Math.cos(a);return i[0]=n*u-s*h,i[1]=o*u+l*h,i[2]=s*u+n*h,i[3]=l*u-o*h,i}ef(),eN();var eZ,eW,eX,eY=(eZ=ef(),eW=eg(1,0,0),eX=eg(0,1,0),function(i,r,a){var n,o,s=eD(r,a);return s<-.999999?(eR(eZ,eW,r),1e-6>e_(eZ)&&eR(eZ,eX,r),eP(eZ,eZ),o=Math.sin(n=.5*Math.PI),i[0]=o*eZ[0],i[1]=o*eZ[1],i[2]=o*eZ[2],i[3]=Math.cos(n),i):s>.999999?(i[0]=0,i[1]=0,i[2]=0,i[3]=1,i):(eR(eZ,r,a),i[0]=eZ[0],i[1]=eZ[1],i[2]=eZ[2],i[3]=1+s,eV(i,i))});function eJ(){var i=new W(2);return W!=Float32Array&&(i[0]=0,i[1]=0),i}function eK(i,r){var a=new W(2);return a[0]=i,a[1]=r,a}function eQ(i,r,a){return i[0]=r[0]+a[0],i[1]=r[1]+a[1],i}function e0(i,r,a){return i[0]=r[0]-a[0],i[1]=r[1]-a[1],i}function e1(i,r,a){return i[0]=r[0]*a,i[1]=r[1]*a,i}function e2(i){var r=i[0],a=i[1];return Math.sqrt(r*r+a*a)}function e3(i,r){var a=r[0],n=r[1],o=a*a+n*n;return o>0&&(o=1/Math.sqrt(o)),i[0]=r[0]*o,i[1]=r[1]*o,i}function e5(i,r){return i[0]*r[0]+i[1]*r[1]}function e4(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}eG(),eG(),Y(),eJ();var e6=e4(function(){if(is)return io;function i(i,r,a,n){this.cx=3*i,this.bx=3*(a-i)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*r,this.by=3*(n-r)-this.cy,this.ay=1-this.cy-this.by,this.p1x=i,this.p1y=r,this.p2x=a,this.p2y=n}return is=1,io=i,i.prototype={sampleCurveX:function(i){return((this.ax*i+this.bx)*i+this.cx)*i},sampleCurveY:function(i){return((this.ay*i+this.by)*i+this.cy)*i},sampleCurveDerivativeX:function(i){return(3*this.ax*i+2*this.bx)*i+this.cx},solveCurveX:function(i,r){if(void 0===r&&(r=1e-6),i<0)return 0;if(i>1)return 1;for(var a=i,n=0;n<8;n++){var o=this.sampleCurveX(a)-i;if(Math.abs(o)<r)return a;var s=this.sampleCurveDerivativeX(a);if(1e-6>Math.abs(s))break;a-=o/s}var l=0,h=1;for(a=i,n=0;n<20&&!(Math.abs((o=this.sampleCurveX(a))-i)<r);n++)i>o?l=a:h=a,a=.5*(h-l)+l;return a},solve:function(i,r){return this.sampleCurveY(this.solveCurveX(i,r))}},io}());function e8(i,r){this.x=i,this.y=r}function e9(i,r){if(Array.isArray(i)){if(!Array.isArray(r)||i.length!==r.length)return!1;for(let a=0;a<i.length;a++)if(!e9(i[a],r[a]))return!1;return!0}if("object"==typeof i&&null!==i&&null!==r){if("object"!=typeof r||Object.keys(i).length!==Object.keys(r).length)return!1;for(let a in i)if(!e9(i[a],r[a]))return!1;return!0}return i===r}e8.prototype={clone(){return new e8(this.x,this.y)},add(i){return this.clone()._add(i)},sub(i){return this.clone()._sub(i)},multByPoint(i){return this.clone()._multByPoint(i)},divByPoint(i){return this.clone()._divByPoint(i)},mult(i){return this.clone()._mult(i)},div(i){return this.clone()._div(i)},rotate(i){return this.clone()._rotate(i)}
1,rotateAround(i,r){return this.clone()._rotateAround(i,r)},matMult(i){return this.clone()._matMult(i)},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(i){return this.x===i.x&&this.y===i.y},dist(i){return Math.sqrt(this.distSqr(i))},distSqr(i){let r=i.x-this.x,a=i.y-this.y;return r*r+a*a},angle(){return Math.atan2(this.y,this.x)},angleTo(i){return Math.atan2(this.y-i.y,this.x-i.x)},angleWith(i){return this.angleWithSep(i.x,i.y)},angleWithSep(i,r){return Math.atan2(this.x*r-this.y*i,this.x*i+this.y*r)},_matMult(i){let r=i[2]*this.x+i[3]*this.y;return this.x=i[0]*this.x+i[1]*this.y,this.y=r,this},_add(i){return this.x+=i.x,this.y+=i.y,this},_sub(i){return this.x-=i.x,this.y-=i.y,this},_mult(i){return this.x*=i,this.y*=i,this},_div(i){return this.x/=i,this.y/=i,this},_multByPoint(i){return this.x*=i.x,this.y*=i.y,this},_divByPoint(i){return this.x/=i.x,this.y/=i.y,this},_unit(){return this._div(this.mag()),this},_perp(){let i=this.y;return this.y=this.x,this.x=-i,this},_rotate(i){let r=Math.cos(i),a=Math.sin(i),n=a*this.x+r*this.y;return this.x=r*this.x-a*this.y,this.y=n,this},_rotateAround(i,r){let a=Math.cos(i),n=Math.sin(i),o=r.y+n*(this.x-r.x)+a*(this.y-r.y);return this.x=r.x+a*(this.x-r.x)-n*(this.y-r.y),this.y=o,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:e8},e8.convert=function(i){if(i instanceof e8)return i;if(Array.isArray(i))return new e8(+i[0],+i[1]);if(void 0!==i.x&&void 0!==i.y)return new e8(+i.x,+i.y);throw Error("Expected [x, y] or {x, y} point format")};let e7=Math.PI/180,te=180/Math.PI,tt=/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,ti=/\b(iPad|iPhone|iPod)\b/,tr=/CPU (OS|iPhone OS) (15_4|15_5) like Mac OS X/,ta=[[0,0],[1,0],[1,1],[0,1]];function tn(i){if(i<=0)return 0;if(i>=1)return 1;let r=i*i,a=r*i;return 4*(i<.5?a:3*(i-r)+a-.75)}function to(i,r,a,n){let o=new e6(i,r,a,n);return function(i){return o.solve(i)}}let ts=to(.25,.1,.25,1);function tl(i,r,a){return Math.min(a,Math.max(r,i))}function th(i,r,a){return(a=tl((a-i)/(r-i),0,1))*a*(3-2*a)}function tu(i,r,a){let n=a-r,o=((i-r)%n+n)%n+r;return o===r?a:o}function tc(i,r,a){if(!i.length)return a(null,[]);let n=i.length,o=Array(i.length),s=null;i.forEach((i,l)=>{r(i,(i,r)=>{i&&(s=i),o[l]=r,0==--n&&a(s,o)})})}function td(i,r){let a={};for(let n=0;n<r.length;n++){let o=r[n];o in i&&(a[o]=i[o])}return a}let tp=1;function tf(){return tp++}function tm(i){return i<=1?1:Math.pow(2,Math.ceil(Math.log2(i)))}function t_(i,r){i.forEach(i=>{r[i]&&(r[i]=r[i].bind(r))})}function tg(i,r,a){let n={};for(let a in i)n[a]=r.call(this,i[a],a,i);return n}function ty(i,r,a){let n={};for(let a in i)r.call(this,i[a],a,i)&&(n[a]=i[a]);return n}function tx(i){return Array.isArray(i)?i.map(tx):"object"==typeof i&&i?tg(i,tx):i}function tv(i,r){for(let a=0;a<i.length;a++)if(r.includes(i[a]))return!0;return!1}let tb={};function tw(i){tb[i]||("undefined"!=typeof console&&console.warn(i),tb[i]=!0)}function tT(i,r,a){return(a.y-i.y)*(r.x-i.x)>(r.y-i.y)*(a.x-i.x)}function tS([i,r,a]){let n=(r+90)*e7,o=a*e7;return{x:i*Math.cos(n)*Math.sin(o),y:i*Math.sin(n)*Math.sin(o),z:i*Math.cos(o),azimuthal:r,polar:a}}function tE(i){return("undefined"!=typeof self||void 0!==i)&&"undefined"!=typeof WorkerGlobalScope&&(void 0!==i?i:self)instanceof WorkerGlobalScope}function tI(i){let r={};if(i.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(i,a,n,o)=>{let s=n||o;return r[a]=!s||s.toLowerCase(),""}),r["max-age"]){let i=parseInt(r["max-age"],10);isNaN(i)?delete r["max-age"]:r["max-age"]=i}return r}let tA,tM=null;function tC(i,r){return[i[4*r],i[4*r+1],i[4*r+2],i[4*r+3]]}function tP(i,r,a,n){for(;r<a;){let o=r+a>>1;i[o]<n?r=o+1:a=o}return r}function tD(i,r,a,n){for(;r<a;){let o=r+a>>1;i[o]<=n?r=o+1:a=o}return r}function tR(i){return i>0?1/(1.001-i):1+i}function tz(i){return i>0?1-1/(1.001-i):-i}function tL(i,r,a){return(i-r.min)*(a.max-a.min)/(r.max-r.min)+a.min}let tF={API_URL:"https://api.mapbox.com",API_URL_REGEX:/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/|\?|$)/i,API_TILEJSON_REGEX:/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/v[0-9]*\/.*\.json.*$)/i,API_SPRITE_REGEX:/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*\/sprite.*\..*$)/i,API_FONTS_REGEX:/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/fonts\/v[0-9]*\/)(.*\.pbf.*$)/i,API_STYLE_REGEX:/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*$)/i,API_CDN_URL_REGEX:/^((https?:)?\/\/)?api\.mapbox\.c(n|om)(\/mapbox-gl-js\/)(.*$)/i,get EVENTS_URL(){if(!tF.API_URL)return null;try{let i=new URL(tF.API_URL);return"api.mapbox.cn"===i.hostname?"https://events.mapbox.cn/events/v2":"api.mapbox.com"===i.hostname?"https://events.mapbox.com/events/v2":null}catch(i){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",MES
1HOPT_URL:"/mapbox-gl-js/meshopt_base_v0.20.wasm",MESHOPT_SIMD_URL:"/mapbox-gl-js/meshopt_simd_v0.20.wasm",BUILDING_GEN_URL:"/mapbox-gl-js/building-gen/building_gen_v1.2.4.wasm",GLYPHS_URL:"mapbox://fonts/mapbox/{fontstack}/{range}.pbf",TILES3D_URL_PREFIX:"3dtiles/v1",TILE_PROVIDER_URLS:Object.assign(Object.create(null),{pmtiles:"/mapbox-gl-js/plugins/mapbox-gl-pmtiles-provider/v0.0.2/mapbox-gl-pmtiles-provider.js"})};function tO(){return new URL(tF.DRACO_URL,tF.API_URL).href}function tB(){if("object"!=typeof WebAssembly)throw Error("WebAssembly not supported, cannot instantiate meshoptimizer");return new URL(!function(){if(void 0===tA){if("object"!=typeof WebAssembly)return!1;let i=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]);tA=WebAssembly.validate(i)}return tA}()?tF.MESHOPT_URL:tF.MESHOPT_SIMD_URL,tF.API_URL).href}function tk(){return new URL(tF.BUILDING_GEN_URL,tF.API_URL).href}function tN(i){return tF.API_URL_REGEX.test(i)}function tU(i){return tF.API_SPRITE_REGEX.test(i)}function tV(){return null==a&&(a=self.OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof self.createImageBitmap),a}let tj={requestIdleCallback:i=>{if("undefined"!=typeof requestIdleCallback)return requestIdleCallback(i);setTimeout(()=>i({didTimeout:!1,timeRemaining:()=>50}),0)},now:()=>void 0!==s?s:performance.now(),setNow(i){s=i},restoreNow(){s=void 0},frame(i){let r=requestAnimationFrame(i);return{cancel:()=>cancelAnimationFrame(r)}},getImageData(i,r=0){let{width:a,height:n}=i;l||(l=document.createElement("canvas"));let o=l.getContext("2d",{willReadFrequently:!0});if(!o)throw Error("failed to create canvas 2d context");return(a>l.width||n>l.height)&&(l.width=a,l.height=n),o.clearRect(-r,-r,a+2*r,n+2*r),o.drawImage(i,0,0,a,n),o.getImageData(-r,-r,a+2*r,n+2*r)},resolveURL:i=>(n||(n=document.createElement("a")),n.href=i,n.href),get devicePixelRatio(){return window.devicePixelRatio},get prefersReducedMotion(){return!!window.matchMedia&&(null==o&&(o=window.matchMedia("(prefers-reduced-motion: reduce)")),o.matches)},hasCanvasFingerprintNoise(){if(void 0!==h)return h;if(!tV())return h=!1,!1;let i=new OffscreenCanvas(85,1),r=i.getContext("2d",{willReadFrequently:!0}),a=0;for(let n=0;n<i.width;++n)r.fillStyle=`rgba(${a++},${a++},${a++}, 255)`,r.fillRect(n,0,1,1);let n=r.getImageData(0,0,i.width,i.height);a=0;for(let i=0;i<n.data.length;++i)if(i%4!=3&&a++!==n.data[i])return h=!0,!0;return h=!1,!1}};function tG(i,r){let a=i.indexOf("?");if(a<0)return`${i}?${new URLSearchParams(r).toString()}`;let n=new URLSearchParams(i.slice(a));for(let i in r)n.set(i,r[i]);return`${i.slice(0,a)}?${n.toString()}`}
1function tH(i,r={persistentParams:[]}){let a=i.indexOf("?");if(a<0)return i;let n=new URLSearchParams,o=new URLSearchParams(i.slice(a));for(let i of r.persistentParams){let r=o.get(i);r&&n.set(i,r)}let s=n.toString();return`${i.slice(0,a)}${s.length>0?`?${s}`:""}`}let t$="mapbox-tiles",tq=500,tZ=50,tW=["language","worldview","jobid"];function tX(){try{return caches}catch(i){}}function tY(){let i=tX();i&&null==u&&(u=i.open(t$))}let tJ=1/0,tK={supported:!1,testSupport:function(i){!t1&&t0&&(t2?t5(i):tQ=i)}},tQ,t0,t1=!1,t2=!1,t3="undefined"!=typeof self?self:{};function t5(i){let r=i.createTexture();i.bindTexture(i.TEXTURE_2D,r);try{if(i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,t0),i.isContextLost())return;tK.supported=!0}catch(i){}i.deleteTexture(r),t1=!0}t3.document&&((t0=t3.document.createElement("img")).onload=function(){tQ&&t5(tQ),tQ=null,t2=!0},t0.onerror=function(){t1=!0,tQ=null},t0.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");let t4={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Iconset:"Iconset",Image:"Image",Model:"Model"};Object.freeze(t4);class t6 extends Error{constructor(i,r,a){401===r&&tN(a)&&(i+=": you may have provided an invalid Mapbox access token. See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes"),super(i),this.status=r,this.url=a}toString(){return`${this.name}: ${this.message} (${this.status}): ${this.url}`}}function t8(i){return"object"==typeof i&&null!==i&&"status"in i&&404===i.status}let t9=tE()?()=>self.worker.referrer:()=>("blob:"===location.protocol?parent:self).location.href,t7=/^\w+:/,ie=/[\r\n]+/,it=function(i,r){var a;return(a=i.url).startsWith("file:")||t9().startsWith("file:")&&!t7.test(a)?function(i,r){let a=new XMLHttpRequest;for(let r in a.open(i.method||"GET",i.url,!0),"arrayBuffer"===i.type&&(a.responseType="arraybuffer"),i.headers)a.setRequestHeader(r,i.headers[r]);return"json"===i.type&&(a.responseType="text",a.setRequestHeader("Accept","application/json")),a.withCredentials="include"===i.credentials,a.onerror=()=>{r(Error(a.statusText))},a.onload=()=>{if((a.status>=200&&a.status<300||0===a.status)&&null!==a.response){let n=a.response;if("json"===i.type)try{n=JSON.parse(a.response)}catch(i){return r(i)}let o=new Headers;a.getAllResponseHeaders().trim().split(ie).forEach(i=>{let r=i.split(": "),a=r.shift(),n=r.join(": ");o.append(a,n)}),r(null,n,o)}else r(new t6(a.statusText,a.status,i.url))},a.send(i.body),{cancel:()=>a.abort()}}(i,r):function(i,r){var a;let n=new AbortController,o=new Request(i.url,{method:i.method||"GET",body:i.body,credentials:i.credentials,headers:i.headers,referrer:t9(),referrerPolicy:i.referrerPolicy,signal:n.signal}),s=!1,l=!1,h=(a=o.url).indexOf("sku=")>0&&tN(a);"json"===i.type&&o.headers.set("Accept","application/json");let c=(a,n,s)=>{if(l)return;if(a&&"SecurityError"!==a.message&&tw(a.toString()),n&&s)return d(n);let u=Date.now();fetch(o).then(a=>{if(a.ok){let i=h?a.clone():null;return d(a,i,u)}return r(new t6(a.statusText,a.status,i.url))}).catch(a=>{"AbortError"!==a.name&&r(Error(`${a.message} ${i.url}`))})},d=(a,n,h)=>{("arrayBuffer"===i.type?a.arrayBuffer():"json"===i.type?a.json():a.text()).then(i=>{l||(n&&h&&function(i,r,a){var n;if(tY(),null==u)return;let o=tI(r.headers.get("cache-control")||"");if(o["no-store"])return;let s={status:r.status,statusText:r.statusText,headers:new Headers};r.headers.forEach((i,r)=>s.headers.set(r,i)),o["max-age"]&&s.headers.set("Expires",new Date(a+1e3*o["max-age"]).toUTCString());let l=s.headers.get("expires");if(!l||new Date(l).getTime()-a<42e4)return;
1let h=tH(i.url,{persistentParams:tW});if(206===r.status){let r=i.headers.get("Range");if(!r)return;s.status=200,h=tG(h,{range:r})}let c=new Response(200!==(n=r.status)&&404!==n&&[101,103,204,205,304].includes(n)?null:r.body,s);tY(),null!=u&&u.then(i=>i.put(h,c)).catch(i=>tw(i.message))}(o,n,h),s=!0,r(null,i,a.headers))}).catch(i=>{l||r(Error(i.message))})};return h?function(i,r){if(tY(),null==u)return r(null);u.then(a=>{let n=tH(i.url,{persistentParams:tW}),o=i.headers.get("Range");o&&(n=tG(n,{range:o})),a.match(n).then(i=>{let o=function(i){if(!i)return!1;let r=new Date(i.headers.get("expires")||0),a=tI(i.headers.get("cache-control")||"");return Number(r)>Date.now()&&!a["no-cache"]}(i);a.delete(n).catch(r),o&&a.put(n,i.clone()).catch(r),r(null,i,o)}).catch(r)}).catch(r)}(o,c):c(null,null),{cancel:()=>{l=!0,s||n.abort()}}}(i,r)},ii=function(i,r){return it(Object.assign(i,{type:"json"}),r)},ir=function(i,r){return it(Object.assign(i,{type:"arrayBuffer"}),r)};c=[],d=0;let ia=function(i,r){if(tK.supported&&(i.headers||(i.headers={}),i.headers.accept="image/webp,*/*"),d>=tF.MAX_PARALLEL_IMAGE_REQUESTS){let a={requestParameters:i,callback:r,cancelled:!1,cancel(){this.cancelled=!0}};return c.push(a),a}d++;let a=!1,n=()=>{if(!a)for(a=!0,d--;c.length&&d<tF.MAX_PARALLEL_IMAGE_REQUESTS;){let i=c.shift(),{requestParameters:r,callback:a,cancelled:n}=i;n||(i.cancel=ia(r,a).cancel)}},o=ir(i,(i,a,o)=>{var s;n(),i?r(i):a&&(s=(i,a)=>r(i,a,o),createImageBitmap(new Blob([new Uint8Array(a)],{type:"image/png"})).then(i=>{s(null,i)}).catch(i=>{s(Error(`Could not load image because of ${i.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))}))});return{cancel:()=>{o.cancel(),n()}}};var io,is,il,ih,iu,ic={exports:{}},id={exports:{}},ip={exports:{}},im=e4(function(){if(iu)return ic.exports;iu=1;var i=(il||(il=1,id.exports=function(i,r){var a,n,o,s,l,h;for(n=i.length-(a=3&i.length),o=r,h=0;h<n;)l=255&i.charCodeAt(h)|(255&i.charCodeAt(++h))<<8|(255&i.charCodeAt(++h))<<16|(255&i.charCodeAt(++h))<<24,++h,o=27492+(65535&(s=5*(65535&(o=(o^=l=(65535&(l=(l=(65535&l)*0xcc9e2d51+(((l>>>16)*0xcc9e2d51&65535)<<16)|0)<<15|l>>>17))*0x1b873593+(((l>>>16)*0x1b873593&65535)<<16)|0)<<13|o>>>19))+((5*(o>>>16)&65535)<<16)|0))+(((s>>>16)+58964&65535)<<16);switch(l=0,a){case 3:l^=(255&i.charCodeAt(h+2))<<16;case 2:l^=(255&i.charCodeAt(h+1))<<8;case 1:o^=l=(65535&(l=(l=(65535&(l^=255&i.charCodeAt(h)))*0xcc9e2d51+(((l>>>16)*0xcc9e2d51&65535)<<16)|0)<<15|l>>>17))*0x1b873593+(((l>>>16)*0x1b873593&65535)<<16)|0}return o^=i.length,o=0x85ebca6b*(65535&(o^=o>>>16))+((0x85ebca6b*(o>>>16)&65535)<<16)|0,o=0xc2b2ae35*(65535&(o^=o>>>13))+((0xc2b2ae35*(o>>>16)&65535)<<16)|0,(o^=o>>>16)>>>0}),id.exports),r=(ih||(ih=1,ip.exports=function(i,r){for(var a,n=i.length,o=r^n,s=0;n>=4;)a=0x5bd1e995*(65535&(a=255&i.charCodeAt(s)|(255&i.charCodeAt(++s))<<8|(255&i.charCodeAt(++s))<<16|(255&i.charCodeAt(++s))<<24))+((0x5bd1e995*(a>>>16)&65535)<<16),o=0x5bd1e995*(65535&o)+((0x5bd1e995*(o>>>16)&65535)<<16)^(a=0x5bd1e995*(65535&(a^=a>>>24))+((0x5bd1e995*(a>>>16)&65535)<<16)),n-=4,++s;switch(n){case 3:o^=(255&i.charCodeAt(s+2))<<16;case 2:o^=(255&i.charCodeAt(s+1))<<8;case 1:o=0x5bd1e995*(65535&(o^=255&i.charCodeAt(s)))+((0x5bd1e995*(o>>>16)&65535)<<16)}return o=0x5bd1e995*(65535&(o^=o>>>13))+((0x5bd1e995*(o>>>16)&65535)<<16),(o^=o>>>15)>>>0}),ip.exports);return ic.exports=i,ic.exports.murmur3=i,ic.exports.murmur2=r,ic.exports}());class i_{constructor(i,...r){Object.assign(this,r[0]||{}),this.type=i}}class ig extends i_{constructor(i,r={}){super("error",Object.assign({error:i},r))}}function iy(i,r,a){a[i]&&a[i].includes(r)||(a[i]=a[i]||[],a[i].push(r))}function ix(i,r,a){if(a&&a[i]){let n=a[i].indexOf(r);-1!==n&&a[i].splice(n,1)}}class iv{on(i,r){return this._listeners=this._listeners||{},iy(i,r,this._listeners),this}off(i,r){return ix(i,r,this._listeners),ix(i,r,this._oneTimeListeners),this}once(i,r){return r?(this._oneTimeListeners=this._oneTimeListeners||{},iy(i,r,this._oneTimeListeners),this):new Promise(r=>{this.once(i,r)})}fire(i,r){let a="string"==typeof i?new i_(i,r):i,n=a.type;if(this.listens(n)){for(let i of(a.target=this,this._listeners&&this._listeners[n]?this._listeners[n].slice():[]))i.call(this,a);for(let i of this._oneTimeListeners&&this._oneTimeListeners[n]?this._oneTimeListeners[n].slice():[])ix(n,i,this._oneTimeListeners),i.call(this,a);let i=this._eventedParent;i&&(Object.assign(a,"function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData),i.fire(a))}else a instanceof ig&&console.error(a.error);return this}listens(i){return!!(this._listeners&&this._listeners[i]&&this._listeners[i].length>0||this._oneTimeListeners&&this._oneTimeListeners[i]&&this._oneTimeListeners[i].length>0||this._eventedParent&&this._eventedParent.listens(i))}setEventedParent(i,r){return this._eventedParent=i,this._eventedParentData=r,this}}class ib{constructor(i){"string"==typeof i?this.name=i:(this.name=i.name,this.iconsetId=i.iconsetId)}static from(i){return new ib(i)}static toString(i){return i.iconsetId?`${i.name}�${i.iconsetId}`:i.name}static parse(i){let[r,a]=i.split("\x1f");return new ib({name:r,iconsetId:a})}static isEqual(i,r){return i.name===r.name&&i.iconsetId===r.iconsetId}toString(){return ib.toString(this)}serialize(){return{name:this.name,iconsetId:this.iconsetId}}}var iw,iT={},iS=function(){if(iw)return iT;iw=1;var i={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 r(i){return(i=Math.round(i))<0?0:i>255?255:i}function a(i){return r("%"===i[i.length-1]?parseFloat(i)/100*255:parseInt(i))}function n(i){var r;return(r="%"===i[i.length-1]?parseFloat(i)/100:parseFloat(i))<0?0:r>1?1:r}function o(i,r,a){return a<0?a+=1:a>1&&(a-=1),6*a<1?i+(r-i)*a*6:2*a<1?r:3*a<2?i+(r-i)*(2/3-a)*6:i}try{iT.parseCSSColor=function(s){var l,h=s.replace(/ /g,"").toLowerCase();if(h in i)return i[h].slice();if("#"===h[0])return 4===h.length?(l=parseInt(h.substr(1),16))>=0&&l<=4095?[(3840&l)>>4|(3840&l)>>8,240&l|(240&l)>>4,15&l|(15&l)<<4,1]:null:7===h.length&&(l=parseInt(h.substr(1),16))>=0&&l<=0xffffff?[(0xff0000&l)>>16,(65280&l)>>8,255&l,1]:null;var u=h.indexOf("("),c=h.indexOf(")");if(-1!==u&&c+1===h.length){var d=h.substr(0,u),p=h.substr(u+1,c-(u+1)).split(","),f=1;switch(d){case"rgba":if(4!==p.length)break;f=n(p.pop());case"rgb":return 3!==p.length?null:[a(p[0]),a(p[1]),a(p[2]),f];case"hsla":if(4!==p.length)break;f=n(p.pop());case"hsl":if(3!==p.length)break;
1var m=(parseFloat(p[0])%360+360)%360/360,_=n(p[1]),g=n(p[2]),y=g<=.5?g*(_+1):g+_-g*_,x=2*g-y;return[r(255*o(x,y,m+1/3)),r(255*o(x,y,m)),r(255*o(x,y,m-1/3)),f]}}return null}}catch(i){}return iT}();function iE(i,r,a){return i*(1-a)+r*a}class iI{constructor(i,r,a,n=1){this.r=i,this.g=r,this.b=a,this.a=n}static parse(i){if(!i)return;if(i instanceof iI)return i;if("string"!=typeof i)return;let r=iS.parseCSSColor(i);return r?new iI(r[0]/255,r[1]/255,r[2]/255,r[3]):void 0}toString(){let{r:i,g:r,b:a,a:n}=this;return`rgba(${Math.round(255*i)},${Math.round(255*r)},${Math.round(255*a)},${n})`}toNonPremultipliedRenderColor(i){let{r:r,g:a,b:n,a:o}=this;return new iM(i,r,a,n,o)}toPremultipliedRenderColor(i){let{r:r,g:a,b:n,a:o}=this;return new iC(i,r*o,a*o,n*o,o)}clone(){return new iI(this.r,this.g,this.b,this.a)}}class iA{constructor(i,r,a,n,o,s=!1){if(this.premultiplied=!1,this.premultiplied=s,i){let s=i.image.height,l=s*s;this.premultiplied?(r=0===o?0:r/o*(s-1),a=0===o?0:a/o*(s-1),n=0===o?0:n/o*(s-1)):(r*=s-1,a*=s-1,n*=s-1),r=Math.max(0,Math.min(s-1,r)),a=Math.max(0,Math.min(s-1,a)),n=Math.max(0,Math.min(s-1,n));let h=Math.floor(r),u=Math.floor(a),c=Math.floor(n),d=Math.ceil(r),p=Math.ceil(a),f=Math.ceil(n),m=r-h,_=a-u,g=n-c,y=i.image.data,x=4*(h+u*l+c*s),v=4*(h+u*l+f*s),b=4*(h+p*l+c*s),w=4*(h+p*l+f*s),T=4*(d+u*l+c*s),S=4*(d+u*l+f*s),E=4*(d+p*l+c*s),I=4*(d+p*l+f*s);this.r=iE(iE(iE(y[x],y[v],g),iE(y[b],y[w],g),_),iE(iE(y[T],y[S],g),iE(y[E],y[I],g),_),m)/255*(this.premultiplied?o:1),this.g=iE(iE(iE(y[x+1],y[v+1],g),iE(y[b+1],y[w+1],g),_),iE(iE(y[T+1],y[S+1],g),iE(y[E+1],y[I+1],g),_),m)/255*(this.premultiplied?o:1),this.b=iE(iE(iE(y[x+2],y[v+2],g),iE(y[b+2],y[w+2],g),_),iE(iE(y[T+2],y[S+2],g),iE(y[E+2],y[I+2],g),_),m)/255*(this.premultiplied?o:1),this.a=o}else this.r=r,this.g=a,this.b=n,this.a=o}toArray(){let{r:i,g:r,b:a,a:n}=this;return[255*i,255*r,255*a,n]}toHslaArray(){let i,{r:r,g:a,b:n,a:o}=this;if(this.premultiplied){if(0===o)return[0,0,0,0];let i=1/o;r*=i,a*=i,n*=i}let s=Math.min(Math.max(r,0),1),l=Math.min(Math.max(a,0),1),h=Math.min(Math.max(n,0),1),u=Math.min(s,l,h),c=Math.max(s,l,h),d=c-u,p=.5*(u+c);if(0===d)return[0,0,100*p,o];switch(c){case s:i=60*((l-h)/d+6*(l<h));break;case l:i=60*((h-s)/d+2);break;default:i=60*((s-l)/d+4)}return[i,100*(p>.5?d/(2-c-u):d/(c+u)),100*p,o]}toArray01(){let{r:i,g:r,b:a,a:n}=this;return[i,r,a,n]}toArray01Scaled(i){let{r:r,g:a,b:n}=this;return[r*i,a*i,n*i]}toArray01Linear(){let{r:i,g:r,b:a,a:n}=this;return[Math.pow(i,2.2),Math.pow(r,2.2),Math.pow(a,2.2),n]}}class iM extends iA{constructor(i,r,a,n,o){super(i,r,a,n,o,!1)}}class iC extends iA{constructor(i,r,a,n,o){super(i,r,a,n,o,!0)}}function iP(i,r,a){return i.map((i,n)=>iE(i,r[n],a))}iI.black=new iI(0,0,0,1),iI.white=new iI(1,1,1,1),iI.transparent=new iI(0,0,0,0),iI.red=new iI(1,0,0,1),iI.blue=new iI(0,0,1,1);var iD=Object.freeze({__proto__:null,array:iP,color:function(i,r,a){return new iI(iE(i.r,r.r,a),iE(i.g,r.g,a),iE(i.b,r.b,a),iE(i.a,r.a,a))},number:iE});class iR extends Error{constructor(i,r){super(r),this.message=r,this.key=i}}class iz{constructor(i,r=[]){for(let[a,n]of(this.parent=i,this.bindings={},r))this.bindings[a]=n}concat(i){return new iz(this,i)}get(i){if(this.bindings[i])return this.bindings[i];if(this.parent)return this.parent.get(i);throw Error(`${i} not found in scope.`)}has(i){return!!this.bindings[i]||!!this.parent&&this.parent.has(i)}}let iL={kind:"null"},iF={kind:"number"},iO={kind:"string"},iB={kind:"boolean"},ik={kind:"color"},iN={kind:"object"},iU={kind:"value"},iV={kind:"collator"},ij={kind:"formatted"},iG={kind:"resolvedImage"};function iH(i,r){return{kind:"array",itemType:i,N:r}}function i$(i){if("array"===i.kind){let r=i$(i.itemType);return"number"==typeof i.N?`array<${r}, ${i.N}>`:"value"===i.itemType.kind?"array":`array<${r}>`}return i.kind}let iq=[iL,iF,iO,iB,ik,ij,iN,iH(iU),iG];function iZ(i,r){if("error"===r.kind)return null;if("array"===i.kind){if("array"===r.kind&&(0===r.N&&"value"===r.itemType.kind||!iZ(i.itemType,r.itemType))&&("number"!=typeof i.N||i.N===r.N))return null}else{if(i.kind===r.kind)return null;if("value"===i.kind){for(let i of iq)if(!iZ(i,r))return null}}return`Expected ${i$(i)} but found ${i$(r)} instead.`}function iW(i,r){return r.some(r=>r.kind===i.kind)}function iX(i,r){return r.some(r=>"null"===r?null===i:"array"===r?Array.isArray(i):"object"===r?i&&!Array.isArray(i)&&"object"==typeof i:r===typeof i)}function iY(i,r){return"array"===i.kind&&"array"===r.kind?i.N===r.N&&iY(i.itemType,r.itemType):i.kind===r.kind}class iJ{constructor(i,r,a){this.sensitivity=i?r?"variant":"case":r?"accent":"base",this.locale=a,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(i,r){return this.collator.compare(i,r)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class iK{constructor(i,r,a,n,o){this.text=i.normalize?i.normalize():i,this.image=r,this.scale=a,this.fontStack=n,this.textColor=o}}class iQ{constructor(i){this.sections=i}static fromString(i){return new iQ([new iK(i,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some(i=>0!==i.text.length||!!i.image&&i.image.hasPrimary())}static factory(i){return i instanceof iQ?i:iQ.fromString(i)}toString(){return 0===this.sections.length?"":this.sections.map(i=>i.text).join("")}serialize(){let i=["format"];for(let r of this.sections){if(r.image){let a=r.image.getPrimary().id.toString();i.push(["image",a]);continue}i.push(r.text);let a={};r.fontStack&&(a["text-font"]=["literal",r.fontStack.split(",")]),r.scale&&(a["font-scale"]=r.scale),r.textColor&&(a["text-color"]=["rgba"].concat(r.textColor.toNonPremultipliedRenderColor(null).toArray())),i.push(a)}return i}}class i0{constructor(i,r={}){this.id=ib.from(i),this.params=r.params,this.sx=r.sx||1,this.sy=r.sy||1}toString(){return JSON.stringify(this)}static parse(i){let r,a,n,o;try{({id:r,params:a,sx:n,sy:o}=JSON.parse(i)||{})}catch(i){return null}return r?new i0(r,{params:a,sx:n,sy:o}):null}scaleSelf(i,r=i){return this.sx*=i,this.sy*=r,this}}class i1{constructor(i,r,a,n,o=!1){this.primaryId=ib.from(i),this.primaryOptions=r,a&&(this.secondaryId=ib.from(a)),this.secondaryOptions=n,this.available=o}toString(){return this.primaryId&&this.secondaryId?`[${this.primaryId.name},${this.secondaryId.name}]`:this.primaryId.name}hasPrimary(){return!!this.primaryId}getPrimary(){return new i0(this.primaryId,this.primaryOptions)}hasSecondary(){return!!this.secondaryId}getSecondary(){return this.secondaryId?new i0(this.secondaryId,this.secondaryOptions):null}static from(i){return"string"==typeof i?i1.build({name:i}):i}static build(i,r,a,n){return i&&("object"!=typeof i||"name"in i)?new i1(i,a,r,n):null}}function i2(i,r,a,n){return"number"==typeof i&&i>=0&&i<=255&&"number"==typeof r&&r>=0&&r<=255&&"number"==typeof a&&a>=0&&a<=255?void 0===n||"number"==typeof n&&n>=0&&n<=1?null:`Invalid rgba value [${[i,r,a,n].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof n?[i,r,a,n]:[i,r,a]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function i3(i){if(null===i||"string"==typeof i||"boolean"==typeof i||"number"==typeof i||i instanceof iI||i instanceof iJ||i instanceof iQ||i instanceof i1)return!0;
1if(Array.isArray(i)){for(let r of i)if(!i3(r))return!1;return!0}if("object"==typeof i){for(let r in i)if(!i3(i[r]))return!1;return!0}return!1}function i5(i){if(null===i)return iL;if("string"==typeof i)return iO;if("boolean"==typeof i)return iB;if("number"==typeof i)return iF;if(i instanceof iI)return ik;if(i instanceof iJ)return iV;if(i instanceof iQ)return ij;if(i instanceof i1)return iG;if(Array.isArray(i)){let r,a=i.length;for(let a of i){let i=i5(a);if(r){if(r===i)continue;r=iU;break}r=i}return iH(r||iU,a)}return iN}function i4(i){let r=typeof i;return null===i?"":"string"===r||"number"===r||"boolean"===r?String(i):i instanceof iQ||i instanceof i1||i instanceof iI?i.toString():JSON.stringify(i)}class i6{constructor(i,r){this.type=i,this.value=r}static parse(i,r){if(2!==i.length)return r.error(`'literal' expression requires exactly one argument, but found ${i.length-1} instead.`);if(!i3(i[1]))return r.error("invalid value");let a=i[1],n=i5(a),o=r.expectedType;return"array"===n.kind&&0===n.N&&o&&"array"===o.kind&&("number"!=typeof o.N||0===o.N)&&(n=o),new i6(n,a)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}serialize(){return"array"===this.type.kind||"object"===this.type.kind?["literal",this.value]:this.value instanceof iI?["rgba"].concat(this.value.toNonPremultipliedRenderColor(null).toArray()):this.value instanceof iQ?this.value.serialize():this.value}}class i8{constructor(i){this.name="ExpressionEvaluationError",this.message=i}toJSON(){return this.message}}let i9={string:iO,number:iF,boolean:iB,object:iN};class i7{constructor(i,r){this.type=i,this.args=r}static parse(i,r){if(i.length<2)return r.error("Expected at least one argument.");let a,n=1,o=i[0];if("array"===o){let o,s;if(i.length>2){let a=i[1];if("string"!=typeof a||!(a in i9)||"object"===a)return r.error('The item type argument of "array" must be one of string, number, boolean',1);o=i9[a],n++}else o=iU;if(i.length>3){if(null!==i[2]&&("number"!=typeof i[2]||i[2]<0||i[2]!==Math.floor(i[2])))return r.error('The length argument to "array" must be a positive integer literal',2);s=i[2],n++}a=iH(o,s)}else a=i9[o];let s=[];for(;n<i.length;n++){let a=r.parse(i[n],n,iU);if(!a)return null;s.push(a)}return new i7(a,s)}evaluate(i){for(let r=0;r<this.args.length;r++){let a=this.args[r].evaluate(i);if(!iZ(this.type,i5(a)))return a;if(r===this.args.length-1)throw new i8(`The expression ${JSON.stringify(this.args[r].serialize())} evaluated to ${i$(i5(a))} but was expected to be of type ${i$(this.type)}.`)}return null}eachChild(i){this.args.forEach(i)}outputDefined(){return this.args.every(i=>i.outputDefined())}serialize(){let i=this.type,r=[i.kind];if("array"===i.kind){let a=i.itemType;if("string"===a.kind||"number"===a.kind||"boolean"===a.kind){r.push(a.kind);let n=i.N;("number"==typeof n||this.args.length>1)&&r.push(n)}}return r.concat(this.args.map(i=>i.serialize()))}}class re{constructor(i){this.type=ij,this.sections=i}static parse(i,r){if(i.length<2)return r.error("Expected at least one argument.");let a=i[1];if(!Array.isArray(a)&&"object"==typeof a)return r.error("First argument must be an image or text section.");let n=[],o=!1;for(let a=1;a<=i.length-1;++a){let s=i[a];if(o&&"object"==typeof s&&!Array.isArray(s)){o=!1;let i=null;if(s["font-scale"]&&!(i=r.parseObjectValue(s["font-scale"],a,"font-scale",iF)))return null;let l=null;if(s["text-font"]&&!(l=r.parseObjectValue(s["text-font"],a,"text-font",iH(iO))))return null;let h=null;if(s["text-color"]&&!(h=r.parseObjectValue(s["text-color"],a,"text-color",ik)))return null;let u=n.at(-1);u.scale=i,u.font=l,u.textColor=h}else{let s=r.parse(i[a],a,iU);if(!s)return null;let l=s.type.kind;if("string"!==l&&"value"!==l&&"null"!==l&&"resolvedImage"!==l)return r.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");o=!0,n.push({content:s,scale:null,font:null,textColor:null})}}return new re(n)}evaluate(i){return new iQ(this.sections.map(r=>{let a=r.content.evaluate(i);return iY(i5(a),iG)?new iK("",a,null,null,null):new iK(i4(a),null,r.scale?r.scale.evaluate(i):null,r.font?r.font.evaluate(i).join(","):null,r.textColor?r.textColor.evaluate(i):null)}))}eachChild(i){for(let r of this.sections)i(r.content),r.scale&&i(r.scale),r.font&&i(r.font),r.textColor&&i(r.textColor)}outputDefined(){return!1}serialize(){let i=["format"];for(let r of this.sections){i.push(r.content.serialize());let a={};r.scale&&(a["font-scale"]=r.scale.serialize()),r.font&&(a["text-font"]=r.font.serialize()),r.textColor&&(a["text-color"]=r.textColor.serialize()),i.push(a)}return i}}class rt{constructor(i,r,a,n){this._imageWarnHistory={},this.type=iG,this.namePrimary=i,this.nameSecondary=r,a&&(this.paramsPrimary=a.params,this.iconsetIdPrimary=a.iconset?a.iconset.id:void 0),n&&(this.paramsSecondary=n.params,this.iconsetIdSecondary=n.iconset?n.iconset.id:void 0)}static parse(i,r){if(i.length<2)return r.error("Expected two or more arguments.");let a=1,n=[];for(let o=0;o<2;o++)if(!function(){if(a<i.length){let o=r.parse(i[a],a++,iO);return o?(n.push({image:o,options:{}}),!0):(r.error(n.length?"Secondary image variant is not a string.":"No image name provided."),!1)}return!0}()||!function(){if(a<i.length){let o=i[a];if(null===o||"object"!=typeof o||Array.isArray(o))return!0;let s=o.params,l=o.iconset,h=r.concat(a);if(!s&&!l)return a++,!0;if(s){if("object"!=typeof s||s.constructor!==Object)return h.error('Image options "params" should be an object'),!1;let i={},r=h.concat(void 0,"params");for(let a in s){if(!a)return r.error("Image parameter name should be non-empty"),!1;let n=r.concat(void 0,a).parse(s[a],void 0,ik,void 0,{typeAnnotation:"coerce"});if(!n)return!1;i[a]=n}n.at(-1).options.params=i}if(l){if("object"!=typeof l||l.constructor!==Object)return h.error('Image options "iconset" should be an object'),!1;if(!l.id)return h.error('Image options "iconset" should have an "i
1d" property'),!1;n.at(-1).options.iconset=l}return a++,!0}return!0}())return;return new rt(n[0].image,n[1]?n[1].image:void 0,n[0].options,n[1]?n[1].options:void 0)}evaluateParams(i,r){let a={};if(r){for(let n in r)if(r[n])try{a[n]=r[n].evaluate(i)}catch(i){continue}if(0!==Object.keys(a).length)return{params:a}}}evaluate(i){let r={name:this.namePrimary.evaluate(i),iconsetId:this.iconsetIdPrimary},a=this.nameSecondary?{name:this.nameSecondary.evaluate(i),iconsetId:this.iconsetIdSecondary}:void 0,n=i1.build(r,a,this.paramsPrimary?this.evaluateParams(i,this.paramsPrimary):void 0,this.paramsSecondary?this.evaluateParams(i,this.paramsSecondary):void 0);if(n&&i.availableImages){let r=n.getPrimary().id;if(n.available=i.availableImages.some(i=>ib.isEqual(i,r)),n.available){let r=n.getSecondary()?n.getSecondary().id:null;r&&(n.available=i.availableImages.some(i=>ib.isEqual(i,r)))}}return n}eachChild(i){if(i(this.namePrimary),this.paramsPrimary)for(let r in this.paramsPrimary)this.paramsPrimary[r]&&i(this.paramsPrimary[r]);if(this.nameSecondary&&(i(this.nameSecondary),this.paramsSecondary))for(let r in this.paramsSecondary)this.paramsSecondary[r]&&i(this.paramsSecondary[r])}outputDefined(){return!1}serializeOptions(i,r){let a={};if(r&&(a.iconset={id:r}),i)for(let r in a.params={},i)i[r]&&(a.params[r]=i[r].serialize());return Object.keys(a).length>0?a:void 0}serialize(){let i=["image",this.namePrimary.serialize()];if(this.paramsPrimary||this.iconsetIdPrimary){let r=this.serializeOptions(this.paramsPrimary,this.iconsetIdPrimary);r&&i.push(r)}if(this.nameSecondary&&(i.push(this.nameSecondary.serialize()),this.paramsSecondary||this.iconsetIdSecondary)){let r=this.serializeOptions(this.paramsSecondary,this.iconsetIdSecondary);r&&i.push(r)}return i}}function ri(i){return ra(i)?"string":rn(i)?"number":ro(i)?"boolean":Array.isArray(i)?"array":null===i?"null":rr(i)?"object":typeof i}function rr(i){return null!=i&&!Array.isArray(i)&&"function"!=typeof i&&!(i instanceof String||i instanceof Number||i instanceof Boolean)&&"object"==typeof i}function ra(i){return"string"==typeof i||i instanceof String}function rn(i){return"number"==typeof i||i instanceof Number}function ro(i){return"boolean"==typeof i||i instanceof Boolean}let rs={"to-boolean":iB,"to-color":ik,"to-number":iF,"to-string":iO};class rl{constructor(i,r){this.type=i,this.args=r}static parse(i,r){if(i.length<2)return r.error("Expected at least one argument.");let a=i[0],n=[],o=iL;if("to-array"===a){if(!Array.isArray(i[1]))return null;let a=i[1].length;if(r.expectedType){if("array"!==r.expectedType.kind)return r.error(`Expected ${r.expectedType.kind} but found array.`);o=iH(r.expectedType.itemType,a)}else{if(!(a>0&&i3(i[1][0])))return null;o=iH(i5(i[1][0]),a)}for(let s=0;s<a;s++){let a,l=i[1][s];if(Array.isArray(l))a=r.parse(l,void 0,o.itemType);else{let i=ri(l);if(i!==o.itemType.kind)return r.error(`Expected ${o.itemType.kind} but found ${i}.`);a=r.registry.literal.parse(["literal",void 0===l?null:l],r)}if(!a)return null;n.push(a)}}else{if(("to-boolean"===a||"to-string"===a)&&2!==i.length)return r.error("Expected one argument.");o=rs[a];for(let a=1;a<i.length;a++){let o=r.parse(i[a],a,iU);if(!o)return null;n.push(o)}}return new rl(o,n)}evaluate(i){if("boolean"===this.type.kind)return!!this.args[0].evaluate(i);if("color"===this.type.kind){let r,a;for(let n of this.args){if(r=n.evaluate(i),a=null,r instanceof iI)return r;if("string"==typeof r){let a=i.parseColor(r);if(a)return a}else if(Array.isArray(r)&&!(a=r.length<3||r.length>4?`Invalid rbga value ${JSON.stringify(r)}: expected an array containing either three or four numeric values.`:i2(r[0],r[1],r[2],r[3])))return new iI(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new i8(a||`Could not parse color from value '${"string"==typeof r?r:String(JSON.stringify(r))}'`)}if("number"===this.type.kind){let r=null;for(let a of this.args){if(null===(r=a.evaluate(i)))return 0;let n=Number(r);if(!isNaN(n))return n}throw new i8(`Could not convert ${JSON.stringify(r)} to number.`)}return"formatted"===this.type.kind?iQ.fromString(i4(this.args[0].evaluate(i))):"resolvedImage"===this.type.kind?i1.build(i4(this.args[0].evaluate(i))):"array"===this.type.kind?this.args.map(r=>r.evaluate(i)):i4(this.args[0].evaluate(i))}
1eachChild(i){this.args.forEach(i)}outputDefined(){return this.args.every(i=>i.outputDefined())}serialize(){if("formatted"===this.type.kind)return new re([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if("resolvedImage"===this.type.kind)return new rt(this.args[0]).serialize();let i="array"===this.type.kind?[]:[`to-${this.type.kind}`];return this.eachChild(r=>{i.push(r.serialize())}),i}}let rh=["Unknown","Point","LineString","Polygon"];class ru{constructor(i,r,a){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=i,this.options=r,this.iconImageUseTheme=a}id(){return this.feature&&void 0!==this.feature.id?this.feature.id:null}geometryType(){return this.feature?"number"==typeof this.feature.type?rh[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(i){return this.globals.brightness||0}distanceFromCenter(){if(this.featureTileCoord&&this.featureDistanceData){let i=this.featureDistanceData.center,r=this.featureDistanceData.scale,{x:a,y:n}=this.featureTileCoord;return this.featureDistanceData.bearing[0]*(a*r-i[0])+this.featureDistanceData.bearing[1]*(n*r-i[1])}return 0}parseColor(i){let r=this._parseColorCache[i];return r||(r=this._parseColorCache[i]=iI.parse(i)),r}getConfig(i){return this.options?this.options.get(i):null}}class rc{constructor(i,r,a,n,o){this.name=i,this.type=r,this._evaluate=a,this.args=n,this._overloadIndex=o}evaluate(i){if(!this._evaluate){let i=rc.definitions[this.name];this._evaluate=Array.isArray(i)?i[2]:i.overloads[this._overloadIndex][1]}return this._evaluate(i,this.args)}eachChild(i){this.args.forEach(i)}outputDefined(){return!1}serialize(){return[this.name].concat(this.args.map(i=>i.serialize()))}static parse(i,r){let a=i[0],n=rc.definitions[a];if(!n)return r.error(`Unknown expression "${a}". If you wanted a literal array, use ["literal", [...]].`,0);let o=Array.isArray(n)?n[0]:n.type,s=Array.isArray(n)?[[n[1],n[2]]]:n.overloads,l=[],h=null,u=-1;for(let[n,c]of s){if(Array.isArray(n)&&n.length!==i.length-1)continue;l.push(n),u++,null===h?h=new r7(r.registry,r.path,null,r.scope,[],r._scope,r.options,r.iconImageUseTheme):h.errors.length=0;let s=[],d=!1;for(let r=1;r<i.length;r++){let a=i[r],o=Array.isArray(n)?n[r-1]:n.type,l=h.parse(a,1+s.length,o);if(!l){d=!0;break}s.push(l)}if(!d)if(Array.isArray(n)&&n.length!==s.length)h.error(`Expected ${n.length} arguments, but found ${s.length} instead.`);else{for(let i=0;i<s.length;i++){let r=Array.isArray(n)?n[i]:n.type;h.checkSubtype(r,s[i].type,i+1)}if(0===h.errors.length)return new rc(a,o,c,s,u)}}if(1===l.length)r.errors.push(...h.errors);else{let a=(l.length?l:s.map(([i])=>i)).map(rd).join(" | "),n=[];for(let a=1;a<i.length;a++){let o=r.parse(i[a],1+n.length);if(!o)return null;n.push(i$(o.type))}r.error(`Expected arguments of type ${a}, but found (${n.join(", ")}) instead.`)}return null}static register(i,r){for(let a in rc.definitions=r,r)i[a]=rc}}function rd(i){return Array.isArray(i)?`(${i.map(i$).join(", ")})`:`(${i$(i.type)}...)`}class rp{constructor(i,r,a){this.type=iV,this.locale=a,this.caseSensitive=i,this.diacriticSensitive=r}static parse(i,r){if(2!==i.length)return r.error("Expected one argument."),null;let a=i[1];if("object"!=typeof a||Array.isArray(a))return r.error("Collator options argument must be an object."),null;let n=void 0===a["case-sensitive"]?r.parse(!1,1,iB):r.parseObjectValue(a["case-sensitive"],1,"case-sensitive",iB);if(!n)return null;let o=void 0===a["diacritic-sensitive"]?r.parse(!1,1,iB):r.parseObjectValue(a["diacritic-sensitive"],1,"diacritic-sensitive",iB);if(!o)return null;let s=null;return!a.locale||(s=r.parseObjectValue(a.locale,1,"locale",iO))?new rp(n,o,s):null}evaluate(i){return new iJ(this.caseSensitive.evaluate(i),this.diacriticSensitive.evaluate(i),this.locale?this.locale.evaluate(i):null)}eachChild(i){i(this.caseSensitive),i(this.diacriticSensitive),this.locale&&i(this.locale)}outputDefined(){return!1}serialize(){let i={};return i["case-sensitive"]=this.caseSensitive.serialize(),i["diacritic-sensitive"]=this.diacriticSensitive.serialize(),this.locale&&(i.locale=this.locale.serialize()),["collator",i]}}function rf(i,r,a){let n=i[r];i[r]=i[a],i[a]=n}function rm(i,r){i[0]=Math.min(i[0],r[0]),i[1]=Math.min(i[1],r[1]),i[2]=Math.max(i[2],r[0]),i[3]=Math.max(i[3],r[1])}function r_(i,r){return!(i[0]<=r[0]||i[2]>=r[2]||i[1]<=r[1]||i[3]>=r[3])}function rg(i,r,a=!1){let n=!1;for(let o=0,s=r.length;o<s;o++){let s=r[o];for(let r=0,o=s.length,l=o-1;r<o;
1l=r++){let o=s[l],h=s[r];if(function(i,r,a){let n=i[0]-r[0],o=i[1]-r[1],s=i[0]-a[0],l=i[1]-a[1];return n*l-s*o==0&&n*s<=0&&o*l<=0}(i,o,h))return a;o[1]>i[1]!=h[1]>i[1]&&i[0]<(h[0]-o[0])*(i[1]-o[1])/(h[1]-o[1])+o[0]&&(n=!n)}}return n}function ry(i,r,a,n){let o=n[0]-a[0],s=n[1]-a[1],l=(i[0]-a[0])*s-o*(i[1]-a[1]),h=(r[0]-a[0])*s-o*(r[1]-a[1]);return l>0&&h<0||l<0&&h>0}function rx(i,r,a,n){var o,s;return 0!=(o=[n[0]-a[0],n[1]-a[1]])[0]*(s=[r[0]-i[0],r[1]-i[1]])[1]-o[1]*s[0]&&!(!ry(i,r,a,n)||!ry(a,n,i,r))}function rv(i){let r=new e8(1/0,1/0),a=new e8(-1/0,-1/0);for(let n of i[0])r.x>n.x&&(r.x=n.x),r.y>n.y&&(r.y=n.y),a.x<n.x&&(a.x=n.x),a.y<n.y&&(a.y=n.y);return{min:r,max:a}}function rb(i,r){for(let a=0;a<i.length;++a)if(!rg(i[a],r))return!1;for(let a=0;a<i.length-1;++a)if(function(i,r,a){for(let n of a)for(let a=0,o=n.length,s=o-1;a<o;s=a++)if(rx(i,r,n[s],n[a]))return!0;return!1}(i[a],i[a+1],r))return!1;return!0}function rw(i,r,a){let n=[];for(let o=0;o<i.length;o++){let s=[];for(let n=0;n<i[o].length;n++){let l=function(i,r){let a=(180+i[0])/360,n=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i[1]*Math.PI/360)))/360,o=Math.pow(2,r.z);return[Math.round(a*o*8192),Math.round(n*o*8192)]}(i[o][n],a);rm(r,l),s.push(l)}n.push(s)}return n}function rT(i,r,a){let n=[];for(let o=0;o<i.length;o++){let s=rw(i[o],r,a);n.push(s)}return n}function rS(i,r,a,n){if(i[0]<a[0]||i[0]>a[2]){let r=.5*n,o=i[0]-a[0]>r?-n:a[0]-i[0]>r?n:0;0===o&&(o=i[0]-a[2]>r?-n:a[2]-i[0]>r?n:0),i[0]+=o}rm(r,i)}function rE(i,r,a,n){let o=8192*Math.pow(2,n.z),s=[8192*n.x,8192*n.y],l=[];if(!i)return l;for(let n of i)for(let i of n){let n=[i.x+s[0],i.y+s[1]];rS(n,r,a,o),l.push(n)}return l}function rI(i,r,a,n){let o=8192*Math.pow(2,n.z),s=[8192*n.x,8192*n.y],l=[];if(!i)return l;for(let a of i){let i=[];for(let n of a){let a=[n.x+s[0],n.y+s[1]];rm(r,a),i.push(a)}l.push(i)}if(r[2]-r[0]<=o/2)for(let i of(r[0]=r[1]=1/0,r[2]=r[3]=-1/0,l))for(let n of i)rS(n,r,a,o);return l}class rA{constructor(i,r){this.type=iB,this.geojson=i,this.geometries=r}static parse(i,r){if(2!==i.length)return r.error(`'within' expression requires exactly one argument, but found ${i.length-1} instead.`);if(i3(i[1])){let r=i[1];if("FeatureCollection"===r.type)for(let i=0;i<r.features.length;++i){let a=r.features[i].geometry.type;if("Polygon"===a||"MultiPolygon"===a)return new rA(r,r.features[i].geometry)}else if("Feature"===r.type){let i=r.geometry.type;if("Polygon"===i||"MultiPolygon"===i)return new rA(r,r.geometry)}else if("Polygon"===r.type||"MultiPolygon"===r.type)return new rA(r,r)}return r.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(i){if(null!=i.geometry()&&null!=i.canonicalID()){if("Point"===i.geometryType())return function(i,r){let a=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],o=i.canonicalID();if(!o)return!1;if("Polygon"===r.type){let s=rw(r.coordinates,n,o),l=rE(i.geometry(),a,n,o);if(!r_(a,n))return!1;for(let i of l)if(!rg(i,s))return!1}if("MultiPolygon"===r.type){let s=rT(r.coordinates,n,o),l=rE(i.geometry(),a,n,o);if(!r_(a,n))return!1;for(let i of l)if(!function(i,r){for(let a=0;a<r.length;a++)if(rg(i,r[a]))return!0;return!1}(i,s))return!1}return!0}(i,this.geometries);if("LineString"===i.geometryType())return function(i,r){let a=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],o=i.canonicalID();if(!o)return!1;if("Polygon"===r.type){let s=rw(r.coordinates,n,o),l=rI(i.geometry(),a,n,o);if(!r_(a,n))return!1;for(let i of l)if(!rb(i,s))return!1}if("MultiPolygon"===r.type){let s=rT(r.coordinates,n,o),l=rI(i.geometry(),a,n,o);if(!r_(a,n))return!1;for(let i of l)if(!function(i,r){for(let a=0;a<r.length;a++)if(rb(i,r[a]))return!0;return!1}(i,s))return!1}return!0}(i,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}serialize(){return["within",this.geojson]}}let rM={kilometers:1,miles:1e3/1609.344,nauticalmiles:1e3/1852,meters:1e3,metres:1e3,yards:1e3/.9144,feet:1e3/.3048,inches:1e3/.0254},rC=1/298.257223563*(2-1/298.257223563),rP=Math.PI/180;class rD{static fromTile(i,r,a){let n=Math.PI*(1-2*(i+.5)/Math.pow(2,r));
1return new rD(Math.atan(.5*(Math.exp(n)-Math.exp(-n)))/rP,a)}static get units(){return rM}constructor(i,r){if(void 0===i)throw Error("No latitude given.");if(r&&!rM[r])throw Error(`Unknown unit ${r}. Use one of: ${Object.keys(rM).join(", ")}`);let a=6378.137*rP*(r?rM[r]:1),n=Math.cos(i*rP),o=1/(1-rC*(1-n*n)),s=Math.sqrt(o);this.kx=a*s*n,this.ky=a*s*o*(1-rC)}distance(i,r){let a=rL(i[0]-r[0])*this.kx,n=(i[1]-r[1])*this.ky;return Math.sqrt(a*a+n*n)}bearing(i,r){return Math.atan2(rL(r[0]-i[0])*this.kx,(r[1]-i[1])*this.ky)/rP}destination(i,r,a){let n=a*rP;return this.offset(i,Math.sin(n)*r,Math.cos(n)*r)}offset(i,r,a){return[i[0]+r/this.kx,i[1]+a/this.ky]}lineDistance(i){let r=0;for(let a=0;a<i.length-1;a++)r+=this.distance(i[a],i[a+1]);return r}area(i){let r=0;for(let a=0;a<i.length;a++){let n=i[a];for(let i=0,o=n.length,s=o-1;i<o;s=i++)r+=rL(n[i][0]-n[s][0])*(n[i][1]+n[s][1])*(a?-1:1)}return Math.abs(r)/2*this.kx*this.ky}along(i,r){let a=0;if(r<=0)return i[0];for(let n=0;n<i.length-1;n++){let o=i[n],s=i[n+1],l=this.distance(o,s);if((a+=l)>r)return rz(o,s,(r-(a-l))/l)}return i[i.length-1]}pointToSegmentDistance(i,r,a){let[n,o]=r,s=rL(a[0]-n)*this.kx,l=(a[1]-o)*this.ky;if(0!==s||0!==l){let r=(rL(i[0]-n)*this.kx*s+(i[1]-o)*this.ky*l)/(s*s+l*l);r>1?(n=a[0],o=a[1]):r>0&&(n+=s/this.kx*r,o+=l/this.ky*r)}return Math.sqrt((s=rL(i[0]-n)*this.kx)*s+(l=(i[1]-o)*this.ky)*l)}pointOnLine(i,r){let a=1/0,n=i[0][0],o=i[0][1],s=0,l=0;for(let h=0;h<i.length-1;h++){let u=i[h][0],c=i[h][1],d=rL(i[h+1][0]-u)*this.kx,p=(i[h+1][1]-c)*this.ky,f=0;0===d&&0===p||((f=(rL(r[0]-u)*this.kx*d+(r[1]-c)*this.ky*p)/(d*d+p*p))>1?(u=i[h+1][0],c=i[h+1][1]):f>0&&(u+=d/this.kx*f,c+=p/this.ky*f));let m=(d=rL(r[0]-u)*this.kx)*d+(p=(r[1]-c)*this.ky)*p;m<a&&(a=m,n=u,o=c,s=h,l=f)}return{point:[n,o],index:s,t:Math.max(0,Math.min(1,l))}}lineSlice(i,r,a){let n=this.pointOnLine(a,i),o=this.pointOnLine(a,r);if(n.index>o.index||n.index===o.index&&n.t>o.t){let i=n;n=o,o=i}let s=[n.point],l=n.index+1,h=o.index;!rR(a[l],s[0])&&l<=h&&s.push(a[l]);for(let i=l+1;i<=h;i++)s.push(a[i]);return rR(a[h],o.point)||s.push(o.point),s}lineSliceAlong(i,r,a){let n=0,o=[];for(let s=0;s<a.length-1;s++){let l=a[s],h=a[s+1],u=this.distance(l,h);if((n+=u)>i&&0===o.length&&o.push(rz(l,h,(i-(n-u))/u)),n>=r)return o.push(rz(l,h,(r-(n-u))/u)),o;n>i&&o.push(h)}return o}bufferPoint(i,r){let a=r/this.ky,n=r/this.kx;return[i[0]-n,i[1]-a,i[0]+n,i[1]+a]}bufferBBox(i,r){let a=r/this.ky,n=r/this.kx;return[i[0]-n,i[1]-a,i[2]+n,i[3]+a]}insideBBox(i,r){return rL(i[0]-r[0])>=0&&0>=rL(i[0]-r[2])&&i[1]>=r[1]&&i[1]<=r[3]}}function rR(i,r){return i[0]===r[0]&&i[1]===r[1]}function rz(i,r,a){let n=rL(r[0]-i[0]);return[i[0]+n*a,i[1]+(r[1]-i[1])*a]}function rL(i){for(;i<-180;)i+=360;for(;i>180;)i-=360;return i}class rF{constructor(i=[],r=(i,r)=>i<r?-1:+(i>r)){if(this.data=i,this.length=this.data.length,this.compare=r,this.length>0)for(let i=(this.length>>1)-1;i>=0;i--)this._down(i)}push(i){this.data.push(i),this._up(this.length++)}pop(){if(0===this.length)return;let i=this.data[0],r=this.data.pop();return--this.length>0&&(this.data[0]=r,this._down(0)),i}peek(){return this.data[0]}_up(i){let{data:r,compare:a}=this,n=r[i];for(;i>0;){let o=i-1>>1,s=r[o];if(a(n,s)>=0)break;r[i]=s,i=o}r[i]=n}_down(i){let{data:r,compare:a}=this,n=this.length>>1,o=r[i];for(;i<n;){let n=1+(i<<1),s=n+1;if(s<this.length&&0>a(r[s],r[n])&&(n=s),a(r[n],o)>=0)break;r[i]=r[n],i=n}r[i]=o}}function rO(i,r){return r.dist-i.dist}function rB(i){let r=[1/0,1/0,-1/0,-1/0];if(r.length!==i.length)return!1;for(let a=0;a<r.length;a++)if(r[a]!==i[a])return!1;return!0}function rk(i){return i[1]-i[0]+1}function rN(i,r){let a=i[1]>=i[0]&&i[1]<r;return a||console.warn("Distance Expression: Index is out of range"),a}function rU(i,r){if(i[0]>i[1])return[null,null];let a=rk(i);if(r){if(2===a)return[i,null];let r=Math.floor(a/2);return[[i[0],i[0]+r],[i[0]+r,i[1]]]}{if(1===a)return[i,null];let r=Math.floor(a/2)-1;return[[i[0],i[0]+r],[i[0]+r+1,i[1]]]}}function rV(i,r){let a=[1/0,1/0,-1/0,-1/0];if(!rN(r,i.length))return a;for(let n=r[0];n<=r[1];++n)rm(a,i[n]);return a}function rj(i){let r=[1/0,1/0,-1/0,-1/0];for(let a=0;a<i.length;++a)for(let n=0;n<i[a].length;++n)rm(r,i[a][n]);return r}function rG(i,r,a){if(rB(i)||rB(r))return NaN;let n=0,o=0;return i[2]<r[0]&&(n=r[0]-i[2]),i[0]>r[2]&&(n=i[0]-r[2]),i[1]>r[3]&&(o=i[1]-r[3]),i[3]<r[1]&&(o=r[1]-i[3]),a.distance([0,0],[n,o])}function rH(i,r,a=8192){let n=Math.pow(2,r.z),o=(i.y/a+r.y)/n;return[360*((i.x/a+r.x)/n)-180,360/Math.PI*Math.atan(Math.exp((180-360*o)*Math.PI/180)
1)-90]}function r$(i,r,a){let n=a.pointOnLine(r,i).point;return a.distance(i,n)}function rq(i,r,a,n,o){let s=a.slice(n[0],n[1]+1),l=1/0;for(let a=r[0];a<=r[1];++a)if(0===(l=Math.min(l,r$(i[a],s,o))))return 0;return l}function rZ(i,r,a,n,o){return Math.min(Math.min(o.pointToSegmentDistance(i,a,n),o.pointToSegmentDistance(r,a,n)),Math.min(o.pointToSegmentDistance(a,i,r),o.pointToSegmentDistance(n,i,r)))}function rW(i,r){for(let a of i)for(let i=0;i<=a.length-1;++i)if(rg(a[i],r,!0))return!0;return!1}function rX(i,r,a,n,o,s,l){if(null===s||null===l)return;let h=rG(rV(n,s),rV(o,l),a);h<r&&i.push({dist:h,range1:s,range2:l})}function rY(i,r,a,n,o,s=1/0){let l=Math.min(s,o.distance(i[0],a[0]));if(0===l)return l;let h=new rF([{dist:0,range1:[0,i.length-1],range2:[0,a.length-1]}],rO),u=r?50:100,c=n?50:100;for(;h.length;){let s=h.pop();if(s.dist>=l)continue;let d=s.range1,p=s.range2;if(rk(d)<=u&&rk(p)<=c){if(!rN(d,i.length)||!rN(p,a.length))return NaN;if(r&&n?l=Math.min(l,function(i,r,a,n,o){if(!rN(r,i.length)||!rN(n,a.length))return NaN;let s=1/0;for(let l=r[0];l<r[1];++l)for(let r=n[0];r<n[1];++r){if(rx(i[l],i[l+1],a[r],a[r+1]))return 0;s=Math.min(s,rZ(i[l],i[l+1],a[r],a[r+1],o))}return s}(i,d,a,p,o)):r||n?r&&!n?l=Math.min(l,rq(a,p,i,d,o)):!r&&n&&(l=Math.min(l,rq(i,d,a,p,o))):l=Math.min(l,function(i,r,a,n,o){if(!rN(r,i.length)||!rN(n,a.length))return NaN;let s=1/0;for(let l=r[0];l<=r[1];++l)for(let r=n[0];r<=n[1];++r)if(0===(s=Math.min(s,o.distance(i[l],a[r]))))return s;return s}(i,d,a,p,o)),0===l)break}else{let s=rU(d,r),u=rU(p,n);rX(h,l,o,i,a,s[0],u[0]),rX(h,l,o,i,a,s[0],u[1]),rX(h,l,o,i,a,s[1],u[0]),rX(h,l,o,i,a,s[1],u[1])}}return l}function rJ(i,r,a,n,o=1/0){let s=o,l=rV(i,[0,i.length-1]);for(let o of a)if(!(s!==1/0&&rG(l,rV(o,[0,o.length-1]),n)>=s)&&0===(s=Math.min(s,rY(i,r,o,!0,n,s))))break;return s}function rK(i,r,a,n,o=1/0){let s=o,l=rV(i,[0,i.length-1]);for(let o of a){if(s!==1/0&&rG(l,rj(o),n)>=s)continue;let a=function(i,r,a,n,o=1/0){let s=Math.min(n.distance(i[0],a[0][0]),o);if(0===s)return s;let l=new rF([{dist:0,range1:[0,i.length-1],range2:[0,0]}],rO),h=r?50:100,u=rj(a);for(;l.length;){let o=l.pop();if(o.dist>=s)continue;let c=o.range1;if(rk(c)<=h){if(!rN(c,i.length))return NaN;if(r){if(0===(s=Math.min(s,function(i,r,a,n){if(!rN(r,i.length))return NaN;for(let n=r[0];n<=r[1];++n)if(rg(i[n],a,!0))return 0;let o=1/0;for(let s=r[0];s<r[1];++s)for(let r of a)for(let a=0,l=r.length,h=l-1;a<l;h=a++){if(rx(i[s],i[s+1],r[h],r[a]))return 0;o=Math.min(o,rZ(i[s],i[s+1],r[h],r[a],n))}return o}(i,c,a,n))))break}else for(let r=c[0];r<=c[1];++r)if(0===(s=Math.min(s,function(i,r,a){if(rg(i,r,!0))return 0;let n=1/0;for(let o of r){let r=o.length;if(r<2)return console.warn("Distance Expression: Invalid polygon!"),NaN;if(o[0]!==o[r-1]&&0===(n=Math.min(n,a.pointToSegmentDistance(i,o[r-1],o[0])))||0===(n=Math.min(n,r$(i,o,a))))break}return n}(i[r],a,n))))return s}else{let a=rU(c,r);if(null!==a[0]){let r=rG(rV(i,a[0]),u,n);r<s&&l.push({dist:r,range1:a[0],range2:[0,0]})}if(null!==a[1]){let r=rG(rV(i,a[1]),u,n);r<s&&l.push({dist:r,range1:a[1],range2:[0,0]})}}}return s}(i,r,o,n,s);if(isNaN(a))return a;if(0===(s=Math.min(s,a)))break}return s}function rQ(i){return"Point"===i||"MultiPoint"===i||"LineString"===i||"MultiLineString"===i||"Polygon"===i||"MultiPolygon"===i}class r0{constructor(i,r){this.type=iF,this.geojson=i,this.geometries=r}static parse(i,r){if(2!==i.length)return r.error(`'distance' expression requires either one argument, but found ' ${i.length-1} instead.`);if(i3(i[1])){let r=i[1];if("FeatureCollection"===r.type){for(let i=0;i<r.features.length;++i)if(rQ(r.features[i].geometry.type))return new r0(r,r.features[i].geometry)}else if("Feature"===r.type){if(rQ(r.geometry.type))return new r0(r,r.geometry)}else if(rQ(r.type))return new r0(r,r)}return r.error("'distance' expression needs to be an array with format ['Distance', GeoJSONObj].")}evaluate(i){let r=i.geometry(),a=i.canonicalID();if(null!=r&&null!=a){if("Point"===i.geometryType()){var n=this.geometries;let i=[];for(let n of r)for(let r of n)i.push(rH(r,a));let o=new rD(i[0][1],"meters");return"Point"===n.type||"MultiPoint"===n.type||"LineString"===n.type?rY(i,!1,"Point"===n.type?[n.coordinates]:n.coordinates,"LineString"===n.type,o):"MultiLineString"===n.type?rJ(i,!1,n.coordinates,o):"Polygon"===n.type||"MultiPolygon"===n.type?rK(i,!1,"Polygon"===n.type?[n.coordinates]:n.coordinates,o):null}if("LineString"===i.geometryType())return function(i,r,a){let n=[];for(let a of i){let i=[];for(let n of a)i.push(rH(n,r));n.push(i)}let o=new rD(n[0][0][1],"meters");if("Point"===a.type||"MultiPoint"===a.type||"LineString"===a.type)return rJ("Point"===a.type?[a.coordinates]:a.coordinates,"LineString"===a.type,n,o);if("MultiLineString"===a.type){let i=1/0;for(let r=0;r<a.coordinates.length;r++){let s=rJ(a.coordinates[r],!0,n,o,i);if(isNaN(s))return s;if(0===(i=Math.min(i,s)))break}return i}if("Polygon"===a.type||"MultiPolygon"===a.type){let i=1/0;for(let r=0;r<n.length;r++){let s=rK(n[r],!0,"Polygon"===a.type?[a.coordinates]:a.coordinates,o,i);if(isNaN(s))return s;if(0===(i=Math.min(i,s)))break}return i}return null}(r,a,this.geometries);if("Polygon"===i.geometryType())return function(i,r,a){let n=[];for(let a of function(i){let r,a,n=i.length;if(n<=1)return[i];let o=[];for(let s=0;s<n;s++){let n=function(i){let r=0;for(let a,n,o=0,s=i.length,l=s-1;o<s;l=o++)a=i[o],r+=((n=i[l]).x-a.x)*(a.y+n.y);return r}(i[s]);0!==n&&(i[s].area=Math.abs(n),void 0===a&&(a=n<0),a===n<0?(r&&o.push(r),r=[i[s]]):r.push(i[s]))}return r&&o.push(r),o}(i)){let i=[];for(let n=0;n<a.length;++n)i.push(function(i,r){let a=[];for(let n=0;n<i.length;++n)a.push(rH(i[n],r));return a}(a[n],r));n.push(i)}let o=new rD(n[0][0][0][1],"meters");if("Point"===a.type||"MultiPoint"===a.type||"LineString"===a.type)return rK("Point"===a.type?[a.coordinates]:a.coordinates,"LineString"===a.type,n,o);if("MultiLineString"===a.type){let i=1/0;for(let r=0;r<a.coordinates.length;r++){let s=rK(a.coordinates[r],!0,n,o,i);if(isNaN(s))return s;if(0===(i=Math.min(i,s)))break}return i}return"Polygon"===a.type||"MultiPolygon"===a.type?function(i,r,a){let n=1/0;for(let o of i)for(let i of r){let r=function(i,r,a,n=1/0){let o=rj(i),s=rj(r);if(n!==1/0&&rG(o,s,a)>=n)return n;if(r_(o,s)){if(rW(i,r))return 0}else if(rW(r,i))return 0;let l=n;for(let n of i)for(let i=0,o=n.length,s=o-1;i<o;s=i++)for(let o of r)for(let r=0,h=o.length,u=h-1;r<h;u=r++){if(rx(n[s],n[i],o[u],o[r]))return 0;l=Math.min(l,rZ(n[s],n[i],o[u],o[r],a))}return l}(o,i,a,n);if(isNaN(r))return r;if(0===(n=Math.min(n,r)))return n}return n}("Polygon"===a.type?[a.coordinates]:a.coordinates,n,o):null}(r,a,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 r1(i){if(i instanceof rc&&("get"===i.name&&1===i.args.length||"feature-state"===i.name||"has"===i.name&&1===i.args.length||"properties"===i.name||"geometry-type"===i.name||"id"===i.name||i.name.startsWith("filter-"))||i instanceof rA||i instanceof r0)return!1;if(i instanceof r8)return i.featureConstant;let r=!0;return i.eachChild(i=>{r&&!r1(i)&&(r=!1)}),r}function r2(i){if(i instanceof rc&&"feature-state"===i.name)return!1;let r=!0;return i.eachChild(i=>{r&&!r2(i)&&(r=!1)}),r}function r3(i,r){if(i instanceof rc&&r.includes(i.name))return!1;let a=!0;return i.eachChild(i=>{a&&!r3(i,r)&&(a=!1)}),a}
1function r5(i,r,a){return[i,r,a].filter(Boolean).join("\x1f")}function r4(i,r){switch(i){case"string":return i4(r);case"number":return+r;case"boolean":return!!r;case"color":return iI.parse(r);case"formatted":return iQ.fromString(i4(r));case"resolvedImage":return i1.build(i4(r))}return r}function r6(i,r,a,n){return void 0!==n&&(i=n*Math.round(i/n)),void 0!==r&&i<r&&(i=r),void 0!==a&&i>a&&(i=a),i}class r8{constructor(i,r,a,n=!1){this.type=i,this.key=r,this.scope=a,this.featureConstant=n}static parse(i,r){let a=r.expectedType;if(null==a&&(a=iU),i.length<2||i.length>3)return r.error("Invalid number of arguments for 'config' expression.");let n=r.parse(i[1],1);if(!(n instanceof i6))return r.error("Key name of 'config' expression must be a string literal.");let o,s=!0,l=i4(n.value);if(i.length>=3){let a=r.parse(i[2],2);if(!(a instanceof i6))return r.error("Scope of 'config' expression must be a string literal.");o=i4(a.value)}if(r.options){let i=r5(l,o,r._scope),a=r.options.get(i);a&&(s=r1(a.value||a.default))}return new r8(a,l,o,s)}evaluate(i){let r=r5(this.key,this.scope,i.scope),a=i.getConfig(r);if(!a)return null;let{type:n,value:o,values:s,minValue:l,maxValue:h,stepValue:u}=a,c=a.default.evaluate(i),d=c;if(o){let r=i.scope;i.scope=(r||"").split("\x1f").slice(1).join("\x1f"),d=o.evaluate(i),i.scope=r}return n&&(d=r4(n,d)),void 0===d||void 0===l&&void 0===h&&void 0===u||("number"==typeof d?d=r6(d,l,h,u):Array.isArray(d)&&(d=d.map(i=>"number"==typeof i?r6(i,l,h,u):i))),void 0!==o&&void 0!==d&&s&&!s.includes(d)&&(d=c,n&&(d=r4(n,d))),(n&&n!==this.type||void 0!==d&&!iY(i5(d),this.type))&&(d=r4(this.type.kind,d)),d}eachChild(){}outputDefined(){return!1}serialize(){let i=["config",this.key];return this.scope&&i.concat(this.scope),i}}class r9{constructor(i,r){this.type=r.type,this.name=i,this.boundExpression=r}static parse(i,r){if(2!==i.length||"string"!=typeof i[1])return r.error("'var' expression requires exactly one string literal argument.");let a=i[1];return r.scope.has(a)?new r9(a,r.scope.get(a)):r.error(`Unknown variable "${a}". Make sure "${a}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(i){return this.boundExpression.evaluate(i)}eachChild(){}outputDefined(){return!1}serialize(){return["var",this.name]}}class r7{constructor(i,r=[],a,n=new iz,o=[],s,l,h){this.registry=i,this.path=r,this.scope=n,this.errors=o,this.expectedType=a,this._scope=s,this.options=l,this.iconImageUseTheme=h}get key(){if(void 0===this._key){let i=this.path,r="";for(let a=0;a<i.length;a++){let n=i[a];r+="string"==typeof n?`['${n}']`:`[${n}]`}this._key=r}return this._key}parse(i,r,a,n,o={}){return r||a?this.concat(r,null,a,n)._parse(i,o):this._parse(i,o)}parseObjectValue(i,r,a,n,o,s={}){return this.concat(r,a,n,o)._parse(i,s)}_parse(i,r){function a(i,r,a){return"assert"===a?new i7(r,[i]):"coerce"===a?new rl(r,[i]):i}if(null!==i&&"string"!=typeof i&&"boolean"!=typeof i&&"number"!=typeof i||(i=["literal",i]),Array.isArray(i)){if(0===i.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');let n="string"==typeof i[0]?this.registry[i[0]]:void 0;if(n){let o=n.parse(i,this);if(!o)return null;if(this.expectedType){let i=this.expectedType,n=o.type;if("string"!==i.kind&&"number"!==i.kind&&"boolean"!==i.kind&&"object"!==i.kind&&"array"!==i.kind||"value"!==n.kind)if("color"!==i.kind&&"formatted"!==i.kind&&"resolvedImage"!==i.kind||"value"!==n.kind&&"string"!==n.kind){if(this.checkSubtype(i,n))return null}else o=a(o,i,r.typeAnnotation||"coerce");else o=a(o,i,r.typeAnnotation||"assert")}if(!(o instanceof i6)&&"resolvedImage"!==o.type.kind&&function i(r){if(r instanceof r9)return i(r.boundExpression);if(r instanceof rc&&"error"===r.name||r instanceof rp||r instanceof rA||r instanceof r0||r instanceof r8)return!1;let a=r instanceof rl||r instanceof i7,n=!0;return r.eachChild(r=>{n=a?n&&i(r):n&&r instanceof i6}),!!n&&r1(r)&&r3(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"])}(o)){let i=new ru(this._scope,this.options,this.iconImageUseTheme);try{o=new i6(o.type,o.evaluate(i))}catch(i){return this.error(i.message),null}}return o}return rl.parse(["to-array",i],this)}return this.error(void 0===i?"'undefined' value invalid. Use null instead.":"object"==typeof i?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof i} instead.`)}concat(i,r,a,n){let o="number"==typeof i?this.path.concat(i):this.path;o="string"==typeof r?o.concat(r):o;let s=n?this.scope.concat(n):this.scope;return new r7(this.registry,o,a||null,s,this.errors,this._scope,this.options,this.iconImageUseTheme)}error(i,...r){let a=`${this.key}${r.map(i=>`[${i}]`).join("")}`;this.errors.push(new iR(a,i))}checkSubtype(i,r,a){let n=iZ(i,r);return n&&this.error(n,..."number"==typeof a?[a]:[]),n}}function ae(i,r){let a=i.length-1,n,o,s=0,l=a,h=0;for(;s<=l;)if(n=i[h=Math.floor((s+l)/2)],o=i[h+1],n<=r){if(h===a||r<o)return h;s=h+1}else{if(!(n>r))throw new i8("Input is not a number.");l=h-1}return 0}
1class at{constructor(i,r,a){for(let[n,o]of(this.type=i,this.input=r,this.labels=[],this.outputs=[],a))this.labels.push(n),this.outputs.push(o)}static parse(i,r){if(i.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${i.length-1}.`);if((i.length-1)%2!=0)return r.error("Expected an even number of arguments.");let a=r.parse(i[1],1,iF);if(!a)return null;let n=[],o=null;r.expectedType&&"value"!==r.expectedType.kind&&(o=r.expectedType);for(let a=1;a<i.length;a+=2){let s=1===a?-1/0:i[a],l=i[a+1],h=a,u=a+1;if("number"!=typeof s)return r.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',h);if(n.length&&n.at(-1)[0]>=s)return r.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',h);let c=r.parse(l,u,o);if(!c)return null;o=o||c.type,n.push([s,c])}return new at(o,a,n)}evaluate(i){let r=this.labels,a=this.outputs;if(1===r.length)return a[0].evaluate(i);let n=this.input.evaluate(i);if(n<=r[0])return a[0].evaluate(i);let o=r.length;return n>=r[o-1]?a[o-1].evaluate(i):a[ae(r,n)].evaluate(i)}eachChild(i){for(let r of(i(this.input),this.outputs))i(r)}outputDefined(){return this.outputs.every(i=>i.outputDefined())}serialize(){let i=["step",this.input.serialize()];for(let r=0;r<this.labels.length;r++)r>0&&i.push(this.labels[r]),i.push(this.outputs[r].serialize());return i}}let ai=4/29,ar=6/29,aa=6/29*3*(6/29),an=6/29*(6/29)*(6/29),ao=Math.PI/180,as=180/Math.PI;function al(i){return i>an?Math.pow(i,1/3):i/aa+ai}function ah(i){return i>ar?i*i*i:aa*(i-ai)}function au(i){return 255*(i<=.0031308?12.92*i:1.055*Math.pow(i,1/2.4)-.055)}function ac(i){return(i/=255)<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4)}function ad(i){let r=ac(i.r),a=ac(i.g),n=ac(i.b),o=al((.4124564*r+.3575761*a+.1804375*n)/.95047),s=al((.2126729*r+.7151522*a+.072175*n)/1);return{l:116*s-16,a:500*(o-s),b:200*(s-al((.0193339*r+.119192*a+.9503041*n)/1.08883)),alpha:i.a}}function ap(i){let r=(i.l+16)/116,a=isNaN(i.a)?r:r+i.a/500,n=isNaN(i.b)?r:r-i.b/200;return r=+ah(r),new iI(au(3.2404542*(a=.95047*ah(a))-1.5371385*r-.4985314*(n=1.08883*ah(n))),au(-.969266*a+1.8760108*r+.041556*n),au(.0556434*a-.2040259*r+1.0572252*n),i.alpha)}let af={forward:ad,reverse:ap,interpolate:function(i,r,a){return{l:iE(i.l,r.l,a),a:iE(i.a,r.a,a),b:iE(i.b,r.b,a),alpha:iE(i.alpha,r.alpha,a)}}},am={forward:function(i){let{l:r,a:a,b:n}=ad(i),o=Math.atan2(n,a)*as;return{h:o<0?o+360:o,c:Math.sqrt(a*a+n*n),l:r,alpha:i.a}},reverse:function(i){let r=i.h*ao,a=i.c;return ap({l:i.l,a:Math.cos(r)*a,b:Math.sin(r)*a,alpha:i.alpha})},interpolate:function(i,r,a){return{h:function(i,r,a){let n=r-i;return i+a*(n>180||n<-180?n-360*Math.round(n/360):n)}(i.h,r.h,a),c:iE(i.c,r.c,a),l:iE(i.l,r.l,a),alpha:iE(i.alpha,r.alpha,a)}}};var a_=Object.freeze({__proto__:null,hcl:am,lab:af});class ag{constructor(i,r,a,n,o){for(let[s,l]of(this.type=i,this.operator=r,this.interpolation=a,this.input=n,this.labels=[],this.outputs=[],o))this.labels.push(s),this.outputs.push(l)}static interpolationFactor(i,r,a,n){let o=0;if("exponential"===i.name)o=ay(r,i.base,a,n);else if("linear"===i.name)o=ay(r,1,a,n);else if("cubic-bezier"===i.name){let s=i.controlPoints;o=new e6(s[0],s[1],s[2],s[3]).solve(ay(r,1,a,n))}return o}static parse(i,r){let[a,n,o,...s]=i;if(!Array.isArray(n)||0===n.length)return r.error("Expected an interpolation type expression.",1);if("linear"===n[0])n={name:"linear"};else if("exponential"===n[0]){let i=n[1];if("number"!=typeof i)return r.error("Exponential interpolation requires a numeric base.",1,1);n={name:"exponential",base:i}}else{if("cubic-bezier"!==n[0])return r.error(`Unknown interpolation type ${String(n[0])}`,1,0);{let i=n.slice(1);if(4!==i.length||i.some(i=>"number"!=typeof i||i<0||i>1))return r.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);n={name:"cubic-bezier",controlPoints:i}}}if(i.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${i.length-1}.`);if(i.length-1>3&&(i.length-1)%2!=0)return r.error("Expected an even number of arguments.");if(!(o=r.parse(o,2,iF)))return null;let l=[],h=null;"interpolate-hcl"===a||"interpolate-lab"===a?h=ik:r.expectedType&&"value"!==r.expectedType.kind&&(h=r.expectedType);for(let i=0;i<s.length;i+=2){let a=s[i],n=s[i+1],o=i+3,u=i+4;if("number"!=typeof a)return r.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not c
1omputed expressions) for the input values.',o);if(l.length&&l.at(-1)[0]>=a)return r.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',o);let c=r.parse(n,u,h);if(!c)return null;h=h||c.type,l.push([a,c])}return"number"===h.kind||"color"===h.kind||"array"===h.kind&&"number"===h.itemType.kind&&"number"==typeof h.N?new ag(h,a,n,o,l):r.error(`Type ${i$(h)} is not interpolatable.`)}evaluate(i){let r=this.labels,a=this.outputs;if(1===r.length)return a[0].evaluate(i);let n=this.input.evaluate(i);if(n<=r[0])return a[0].evaluate(i);let o=r.length;if(n>=r[o-1])return a[o-1].evaluate(i);let s=ae(r,n),l=ag.interpolationFactor(this.interpolation,n,r[s],r[s+1]),h=a[s].evaluate(i),u=a[s+1].evaluate(i);return"interpolate"===this.operator?iD[this.type.kind.toLowerCase()](h,u,l):"interpolate-hcl"===this.operator?am.reverse(am.interpolate(am.forward(h),am.forward(u),l)):af.reverse(af.interpolate(af.forward(h),af.forward(u),l))}eachChild(i){for(let r of(i(this.input),this.outputs))i(r)}outputDefined(){return this.outputs.every(i=>i.outputDefined())}serialize(){let i;i="linear"===this.interpolation.name?["linear"]:"exponential"===this.interpolation.name?1===this.interpolation.base?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier",...this.interpolation.controlPoints];let r=[this.operator,i,this.input.serialize()];for(let i=0;i<this.labels.length;i++)r.push(this.labels[i],this.outputs[i].serialize());return r}}function ay(i,r,a,n){let o=n-a,s=i-a;return 0===o?0:1===r?s/o:(Math.pow(r,s)-1)/(Math.pow(r,o)-1)}class ax{constructor(i,r){this.type=i,this.args=r}static parse(i,r){if(i.length<2)return r.error("Expectected at least one argument."),null;let a=null,n=r.expectedType;n&&"value"!==n.kind&&(a=n);let o=[];for(let n of i.slice(1)){let i=r.parse(n,1+o.length,a,void 0,{typeAnnotation:"omit"});if(!i)return null;a=a||i.type,o.push(i)}return new ax(n&&o.some(i=>iZ(n,i.type))?iU:a,o)}evaluate(i){let r,a=null,n=0;for(let o of this.args){if(n++,(a=o.evaluate(i))&&a instanceof i1&&!a.available&&(r||(r=a),a=null,n===this.args.length))return r;if(null!==a)break}return a}eachChild(i){this.args.forEach(i)}outputDefined(){return this.args.every(i=>i.outputDefined())}serialize(){let i=["coalesce"];return this.eachChild(r=>{i.push(r.serialize())}),i}}let av=/[^a-zA-Z0-9_]/;class ab{constructor(i,r){this.type=r.type,this.bindings=[].concat(i),this.result=r}evaluate(i){return this.result.evaluate(i)}eachChild(i){for(let r of this.bindings)i(r[1]);i(this.result)}static parse(i,r){if(i.length<4)return r.error(`Expected at least 3 arguments, but found ${i.length-1} instead.`);let a=[];for(let n=1;n<i.length-1;n+=2){let o=i[n];if("string"!=typeof o)return r.error(`Expected string, but found ${typeof o} instead.`,n);if(av.test(o))return r.error("Variable names must contain only alphanumeric characters or '_'.",n);let s=r.parse(i[n+1],n+1);if(!s)return null;a.push([o,s])}let n=r.parse(i.at(-1),i.length-1,r.expectedType,a);return n?new ab(a,n):null}outputDefined(){return this.result.outputDefined()}serialize(){let i=["let"];for(let[r,a]of this.bindings)i.push(r,a.serialize());return i.push(this.result.serialize()),i}}class aw{constructor(i,r,a){this.type=i,this.index=r,this.input=a}static parse(i,r){if(3!==i.length)return r.error(`Expected 2 arguments, but found ${i.length-1} instead.`);let a=r.parse(i[1],1,iF),n=r.parse(i[2],2,iH(r.expectedType||iU));return a&&n?new aw(n.type.itemType,a,n):null}evaluate(i){let r=this.index.evaluate(i),a=this.input.evaluate(i);if(r<0)throw new i8("Array index out of bounds: negative index");if(r>=a.length)throw new i8("Array index out of bounds: index exceeds array size");if(r!==Math.floor(r))throw new i8("Array index must be an integer. Use at-interpolated for fractional indices");return a[r]}eachChild(i){i(this.index),i(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}class aT{constructor(i,r,a){this.type=i,this.index=r,this.input=a}static parse(i,r){if(3!==i.length)return r.error(`Expected 2 arguments, but found ${i.length-1} instead.`);let a=r.parse(i[1],1,iF),n=r.parse(i[2],2,iH(r.expectedType||iU));return a&&n?new aT(n.type.itemType,a,n):null}evaluate(i){let r=this.index.evaluate(i),a=this.input.evaluate(i);if(r<0)throw new i8(`Array index out of bounds: ${r} < 0.`);if(r>a.length-1)throw new i8(`Array index out of bounds: ${r} > ${a.length-1}.`);if(r===Math.floor(r))return a[r];let n=Math.floor(r),o=Math.ceil(r),s=a[n],l=a[o];if("number"!=typeof s||"number"!=typeof l)throw new i8(`Cannot interpolate between non-number values at index ${r}.`);let h=r-n;return s*(1-h)+l*h}eachChild(i){i(this.index),i(this.input)}outputDefined(){return!1}serialize(){return["at-interpolated",this.index.serialize(),this.input.serialize()]}}class aS{constructor(i,r){this.type=iB,this.needle=i,this.haystack=r}static parse(i,r){if(3!==i.length)return r.error(`Expected 2 arguments, but found ${i.length-1} instead.`),null;let a=r.parse(i[1],1,iU),n=r.parse(i[2],2,iU);return a&&n?iW(a.type,[iB,iO,iF,iL,iU])?new aS(a,n):(r.error(`Expected first argument to be of type boolean, string, number or null, but found ${i$(a.type)} instead`),null):null}evaluate(i){let r=this.needle.evaluate(i),a=this.haystack.evaluate(i);if(null==a)return!1;if(!iX(r,["boolean","string","number","null"]))throw new i8(`Expected first argument to be of type boolean, string, number or null, but found ${i$(i5(r))} instead.`);if(!iX(a,["string","array"]))throw new i8(`Expected second argument to be of type array or string, but found ${i$(i5(a))} instead.`);return a.includes(r)}eachChild(i){i(this.needle),i(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}}class aE{constructor(i,r,a){this.type=iF,this.needle=i,this.haystack=r,this.fromIndex=a}static parse(i,r){if(i.length<=2||i.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${i.length-1} instead.`),null;let a=r.parse(i[1],1,iU),n=r.parse(i[2],2,iU);if(!a||!n)return null;if(!iW(a.type,[iB,iO,iF,iL,iU]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${i$(a.type)} instead`),null;if(4===i.length){let o=r.parse(i[3],3,iF);return o?new aE(a,n,o):null}return new aE(a,n)}evaluate(i){let r=this.needle.evaluate(i),a=this.haystack.evaluate(i);if(!iX(r,["boolean","string","number","null"]))throw new i8(`Expected first argument to be of type boolean, string, number or null, but found ${i$(i5(r))} instead.`);if(!iX(a,["string","array"]))throw new i8(`Expected second argument to be of type array or string, but found ${i$(i5(a))} instead.`);if(this.fromIndex){let n=this.fromIndex.evaluate(i);return a.indexOf(r,n)}return a.indexOf(r)}eachChild(i){i(this.needle),i(this.haystack),this.fromIndex&&i(this.fromIndex)}outputDefined(){return!1}serialize(){if(null!=this.fromIndex&&void 0!==this.fromIndex){let i=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),i]}return["index-of",this.needle.serialize(),this.haystack.serialize()]}}class aI{constructor(i,r,a,n,o,s){this.inputType=i,this.type=r,this.input=a,this.cases=n,this.outputs=o,this.otherwise=s}static parse(i,r){let a,n;if(i.length<5)return r.error(`Expected at least 4 arguments, but found only ${i.length-1}.`);if(i.length%2!=1)return r.error("Expected an even number of arguments.");r.expectedType&&"value"!==r.expectedType.kind&&(n=r.expectedType);let o={},s=[];for(let l=2;l<i.length-1;l+=2){let h=i[l],u=i[l+1];Array.isArray(h)||(h=[h]);let c=r.concat(l);
1if(0===h.length)return c.error("Expected at least one branch label.");for(let i of h){if("number"!=typeof i&&"string"!=typeof i)return c.error("Branch labels must be numbers or strings.");if("number"==typeof i&&Math.abs(i)>Number.MAX_SAFE_INTEGER)return c.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if("number"==typeof i&&Math.floor(i)!==i)return c.error("Numeric branch labels must be integer values.");if(a){if(c.checkSubtype(a,i5(i)))return null}else a=i5(i);if(void 0!==o[String(i)])return c.error("Branch labels must be unique.");o[String(i)]=s.length}let d=r.parse(u,l,n);if(!d)return null;n=n||d.type,s.push(d)}let l=r.parse(i[1],1,iU);if(!l)return null;let h=r.parse(i.at(-1),i.length-1,n);return h?"value"!==l.type.kind&&r.concat(1).checkSubtype(a,l.type)?null:new aI(a,n,l,o,s,h):null}evaluate(i){let r=this.input.evaluate(i);return(iY(i5(r),this.inputType)&&this.outputs[this.cases[r]]||this.otherwise).evaluate(i)}eachChild(i){i(this.input),this.outputs.forEach(i),i(this.otherwise)}outputDefined(){return this.outputs.every(i=>i.outputDefined())&&this.otherwise.outputDefined()}serialize(){let i=["match",this.input.serialize()],r=Object.keys(this.cases).sort(),a=[],n={};for(let i of r){let r=n[this.cases[i]];void 0===r?(n[this.cases[i]]=a.length,a.push([this.cases[i],[i]])):a[r][1].push(i)}let o=i=>"number"===this.inputType.kind?Number(i):i;for(let[r,n]of a)i.push(1===n.length?o(n[0]):n.map(o)),i.push(this.outputs[r].serialize());return i.push(this.otherwise.serialize()),i}}class aA{constructor(i,r,a){this.type=i,this.branches=r,this.otherwise=a}static parse(i,r){let a;if(i.length<4)return r.error(`Expected at least 3 arguments, but found only ${i.length-1}.`),null;if(i.length%2!=0)return r.error("Expected an odd number of arguments."),null;r.expectedType&&"value"!==r.expectedType.kind&&(a=r.expectedType);let n=[];for(let o=1;o<i.length-1;o+=2){let s=r.parse(i[o],o,iB);if(!s)return null;let l=r.parse(i[o+1],o+1,a);if(!l)return null;n.push([s,l]),a=a||l.type}let o=r.parse(i.at(-1),i.length-1,a);return o?new aA(a,n,o):null}evaluate(i){for(let[r,a]of this.branches)if(r.evaluate(i))return a.evaluate(i);return this.otherwise.evaluate(i)}eachChild(i){for(let[r,a]of this.branches)i(r),i(a);i(this.otherwise)}outputDefined(){return this.branches.every(([i,r])=>r.outputDefined())&&this.otherwise.outputDefined()}serialize(){let i=["case"];return this.eachChild(r=>{i.push(r.serialize())}),i}}class aM{constructor(i,r,a,n){this.type=i,this.input=r,this.beginIndex=a,this.endIndex=n}static parse(i,r){if(i.length<=2||i.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${i.length-1} instead.`),null;let a=r.parse(i[1],1,iU),n=r.parse(i[2],2,iF);if(!a||!n)return null;if(!iW(a.type,[iH(iU),iO,iU]))return r.error(`Expected first argument to be of type array or string, but found ${i$(a.type)} instead`),null;if(4===i.length){let o=r.parse(i[3],3,iF);return o?new aM(a.type,a,n,o):null}return new aM(a.type,a,n)}evaluate(i){let r=this.input.evaluate(i),a=this.beginIndex.evaluate(i);if(!iX(r,["string","array"]))throw new i8(`Expected first argument to be of type array or string, but found ${i$(i5(r))} instead.`);if(this.endIndex){let n=this.endIndex.evaluate(i);return r.slice(a,n)}return r.slice(a)}eachChild(i){i(this.input),i(this.beginIndex),this.endIndex&&i(this.endIndex)}outputDefined(){return!1}serialize(){if(null!=this.endIndex&&void 0!==this.endIndex){let i=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),i]}return["slice",this.input.serialize(),this.beginIndex.serialize()]}}class aC{constructor(i,r){this.type=iH(iO),this.str=i,this.delimiter=r}static parse(i,r){if(3!==i.length)return r.error(`Expected 2 arguments, but found ${i.length-1} instead.`);let a=r.parse(i[1],1,iO),n=r.parse(i[2],2,iO);return a&&n?new aC(a,n):void 0}evaluate(i){let r=this.str.evaluate(i),a=this.delimiter.evaluate(i);return r.split(a)}eachChild(i){i(this.str),i(this.delimiter)}outputDefined(){return!1}serialize(){return["split",this.str.serialize(),this.delimiter.serialize()]}}function aP(i,r){return"=="===i||"!="===i?"boolean"===r.kind||"string"===r.kind||"number"===r.kind||"null"===r.kind||"value"===r.kind:"string"===r.kind||"number"===r.kind||"value"===r.kind}function aD(i,r,a,n){return 0===n.compare(r,a)}function aR(i,r,a){let n="=="!==i&&"!="!==i;return class o{constructor(i,r,a){this.type=iB,this.lhs=i,this.rhs=r,this.collator=a,this.hasUntypedArgument="value"===i.type.kind||"value"===r.type.kind}static parse(i,r){if(3!==i.length&&4!==i.length)return r.error("Expected two or three arguments.");let a=i[0],s=r.parse(i[1],1,iU);if(!s)return null;if(!aP(a,s.type))return r.concat(1).error(`"${a}" comparisons are not supported for type '${i$(s.type)}'.`);let l=r.parse(i[2],2,iU);if(!l)return null;if(!aP(a,l.type))return r.concat(2).error(`"${a}" comparisons are not supported for type '${i$(l.type)}'.`);if(s.type.kind!==l.type.kind&&"value"!==s.type.kind&&"value"!==l.type.kind)return r.error(`Cannot compare types '${i$(s.type)}' and '${i$(l.type)}'.`);n&&("value"===s.type.kind&&"value"!==l.type.kind?s=new i7(l.type,[s]):"value"!==s.type.kind&&"value"===l.type.kind&&(l=new i7(s.type,[l])));let h=null;if(4===i.length){if("string"!==s.type.kind&&"string"!==l.type.kind&&"value"!==s.type.kind&&"value"!==l.type.kind)return r.error("Cannot use collator to compare non-string types.");if(!(h=r.parse(i[3],3,iV)))return null}return new o(s,l,h)}evaluate(o){let s=this.lhs.evaluate(o),l=this.rhs.evaluate(o);if(n&&this.hasUntypedArgument){let r=i5(s),a=i5(l);if(r.kind!==a.kind||"string"!==r.kind&&"number"!==r.kind)throw new i8(`Expected arguments for "${i}" to be (string, string) or (number, number), but found (${r.kind}, ${a.kind}) instead.`)}if(this.collator&&!n&&this.hasUntypedArgument){let i=i5(s),a=i5(l);if("string"!==i.kind||"string"!==a.kind)return r(o,s,l)}return this.collator?a(o,s,l,this.collator.evaluate(o)):r(o,s,l)}eachChild(i){i(this.lhs),i(this.rhs),this.collator&&i(this.collator)}outputDefined(){return!0}serialize(){let r=[i];return this.eachChild(i=>{r.push(i.serialize())}),r}}}let az=aR("==",function(i,r,a){return r===a},aD),aL=aR("!=",function(i,r,a){return r!==a},function(i,r,a,n){return!aD(0,r,a,n)}),aF=aR("<",function(i,r,a){return r<a},function(i,r,a,n){return 0>n.compare(r,a)}),aO=aR(">",function(i,r,a){return r>a},function(i,r,a,n){return n.compare(r,a)>0}),aB=aR("<=",function(i,r,a){return r<=a},function(i,r,a,n){return 0>=n.compare(r,a)}),ak=aR(">=",function(i,r,a){return r>=a},function(i,r,a,n){return n.compare(r,a)>=0});class aN{constructor(i,r,a,n,o,s){this.type=iO,this.number=i,this.locale=r,this.currency=a,this.unit=n,this.minFractionDigits=o,this.maxFractionDigits=s}static parse(i,r){if(3!==i.length)return r.error("Expected two arguments.");let a=r.parse(i[1],1,iF);if(!a)return null;let n=i[2];if("object"!=typeof n||Array.isArray(n))return r.error("NumberFormat options argument must be an object.");let o=null;if(n.locale&&!(o=r.parseObjectValue(n.locale,2,"locale",iO)))return null;let s=null;if(n.currency&&!(s=r.parseObjectValue(n.currency,2,"currency",iO)))return null;let l=null;if(n.unit&&!(l=r.parseObjectValue(n.unit,2,"unit",iO)))return null;let h=null;if(n["min-fraction-digits"]&&!(h=r.parseObjectValue(n["min-fraction-digits"],2,"min-fraction-digits",iF)))return null;let u=null;return!n["max-fraction-digits"]||(u=r.parseObjectValue(n["max-fraction-digits"],2,"max-fraction-digits",iF))?new aN(a,o,s,l,h,u):null}evaluate(i){return new Intl.NumberFormat(this.locale?this.locale.evaluate(i):[],{style:(this.currency?"currency":this.unit&&"unit")||"decimal",currency:this.currency?this.currency.evaluate(i):void 0,unit:this.unit?this.unit.evaluate(i):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(i):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(i):void 0}).format(this.number.evaluate(i))}eachChild(i){i(this.number),this.locale&&i(this.locale),this.currency&&i(this.currency),this.unit&&i(this.unit),this.minFractionDigits&&i(this.minFractionDigits),this.maxFractionDigits&&i(this.maxFractionDigits)}outputDefined(){return!1}serialize(){let i={};return this.locale&&(i.locale=this.locale.serialize()),this.currency&&(i.currency=this.currency.serialize()),this.unit&&(i.unit=this.unit.serialize()),this.minFractionDigits&&(i["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(i["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),i]}}class aU{constructor(i){this.type=iF,this.input=i}static parse(i,r){if(2!==i.length)return r.error(`Expected 1 argument, but found ${i.length-1} instead.`),null;let a=r.parse(i[1],1);return a?"array"!==a.type.kind&&"string"!==a.type.kind&&"value"!==a.type.kind?(r.error(`Expected argument of type string or array, but found ${i$(a.type)} instead.`),null):new aU(a):null}evaluate(i){let r=this.input.evaluate(i);if("string"==typeof r||Array.isArray(r))return r.length;throw new i8(`Expected value to be of type string or array, but found ${i$(i5(r))} instead.`)}eachChild(i){i(this.input)}outputDefined(){return!1}serialize(){let i=["length"];return this.eachChild(r=>{i.push(r.serialize())}),i}}function aV(i){return function(){let r=Math.imul((i=0x6d2b79f5+(i|=0)|0)^i>>>15,1|i);return(((r=r+Math.imul(r^r>>>7,61|r)^r)^r>>>14)>>>0)/0x100000000}}let aj={"==":az,"!=":aL,">":aO,"<":aF,">=":ak,"<=":aB,array:i7,at:aw,"at-interpolated":aT,boolean:i7,case:aA,coalesce:ax,c
1ollator:rp,format:re,image:rt,in:aS,"index-of":aE,interpolate:ag,"interpolate-hcl":ag,"interpolate-lab":ag,length:aU,let:ab,literal:i6,match:aI,number:i7,"number-format":aN,object:i7,slice:aM,step:at,string:i7,"to-boolean":rl,"to-color":rl,"to-number":rl,"to-string":rl,var:r9,within:rA,distance:r0,config:r8,split:aC};function aG(i,[r,a,n,o]){r=r.evaluate(i),a=a.evaluate(i),n=n.evaluate(i);let s=o?o.evaluate(i):1,l=i2(r,a,n,s);if(l)throw new i8(l);return new iI(r/255,a/255,n/255,s)}function aH(i,[r,a,n,o]){var s,l,h;r=r.evaluate(i),a=a.evaluate(i),n=n.evaluate(i);let u=o?o.evaluate(i):1,c=(s=r,l=a,h=n,"number"==typeof s&&s>=0&&s<=360?"number"==typeof l&&l>=0&&l<=100&&"number"==typeof h&&h>=0&&h<=100?void 0===u||"number"==typeof u&&u>=0&&u<=1?null:`Invalid hsla value [${[s,l,h,u].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid hsla value [${("number"==typeof u?[s,l,h,u]:[s,l,h]).join(", ")}]: 's', and 'l' must be between 0 and 100.`:`Invalid hsla value [${("number"==typeof u?[s,l,h,u]:[s,l,h]).join(", ")}]: 'h' must be between 0 and 360.`);if(c)throw new i8(c);let d=`hsla(${r}, ${a}%, ${n}%, ${u})`,p=iI.parse(d);if(!p)throw new i8(`Failed to parse HSLA color: ${d}`);return p}function a$(i,r){let a=r[i];return void 0===a?null:a}function aq(i){return{type:i}}function aZ(i){if(i instanceof r8)return new Set([i.key]);let r=new Set;return i.eachChild(i=>{r=new Set([...r,...aZ(i)])}),r}function aW(i){if(i instanceof rc&&"is-active-floor"===i.name)return!0;let r=!1;return i.eachChild(i=>{!r&&aW(i)&&(r=!0)}),r}function aX(i){return{result:"success",value:i}}function aY(i){return{result:"error",value:i}}function aJ(i,r){return!!i&&!!i.parameters&&i.parameters.includes(r)}function aK(i){return"data-driven"===i["property-type"]}function aQ(i){return aJ(i.expression,"measure-light")}function a0(i){return aJ(i.expression,"zoom")}function a1(i){return!!i.expression&&i.expression.interpolated}function a2(i){return"object"==typeof i&&null!==i&&!Array.isArray(i)}function a3(i){return i}function a5(i,r,a){return void 0!==i?i:void 0!==r?r:void 0!==a?a:void 0}function a4(i,r,a,n,o){return a5(typeof a===o?n[a]:void 0,i.default,r.default)}function a6(i,r,a){if(!rn(a))return a5(i.default,r.default);let n=i.stops.length;if(1===n||a<=i.stops[0][0])return i.stops[0][1];if(a>=i.stops[n-1][0])return i.stops[n-1][1];let o=ae(i.stops.map(i=>i[0]),a);return i.stops[o][1]}function a8(i,r,a){let n=void 0!==i.base?i.base:1;if(!rn(a))return a5(i.default,r.default);let o=i.stops.length;if(1===o||a<=i.stops[0][0])return i.stops[0][1];if(a>=i.stops[o-1][0])return i.stops[o-1][1];let s=ae(i.stops.map(i=>i[0]),a),l=function(i,r,a,n){let o=n-a,s=i-a;return 0===o?0:1===r?s/o:(Math.pow(r,s)-1)/(Math.pow(r,o)-1)}(a,n,i.stops[s][0],i.stops[s+1][0]),h=i.stops[s][1],u=i.stops[s+1][1],c=iD[r.type]||a3;if(i.colorSpace&&"rgb"!==i.colorSpace){let r=a_[i.colorSpace];c=(i,a)=>r.reverse(r.interpolate(r.forward(i),r.forward(a),l))}return"function"==typeof h.evaluate?{evaluate(...i){let r=h.evaluate.apply(void 0,i),a=u.evaluate.apply(void 0,i);if(void 0!==r&&void 0!==a)return c(r,a,l)}}:c(h,u,l)}function a9(i,r,a){return"color"===r.type?a=iI.parse(a):"formatted"===r.type?a=iQ.fromString(a.toString()):"resolvedImage"===r.type?a=i1.build(a.toString()):ri(a)===r.type||"enum"===r.type&&r.values[a]||(a=void 0),a5(a,i.default,r.default)}rc.register(aj,{error:[{kind:"error"},[iO],(i,[r])=>{throw new i8(r.evaluate(i))}],typeof:[iO,[iU],(i,[r])=>i$(i5(r.evaluate(i)))],"to-rgba":[iH(iF,4),[ik],(i,[r])=>r.evaluate(i).toNonPremultipliedRenderColor(null).toArray()],"to-hsla":[iH(iF,4),[ik],(i,[r])=>r.evaluate(i).toNonPremultipliedRenderColor(null).toHslaArray()],rgb:[ik,[iF,iF,iF],aG],rgba:[ik,[iF,iF,iF,iF],aG],hsl:[ik,[iF,iF,iF],aH],hsla:[ik,[iF,iF,iF,iF],aH],has:{type:iB,overloads:[[[iO],(i,[r])=>r.evaluate(i)in i.properties()],[[iO,iN],(i,[r,a])=>r.evaluate(i)in a.evaluate(i)]]},get:{type:iU,overloads:[[[iO],(i,[r])=>a$(r.evaluate(i),i.properties())],[[iO,iN],(i,[r,a])=>a$(r.evaluate(i),a.evaluate(i))]]},"feature-state":[iU,[iO],(i,[r])=>a$(r.evaluate(i),i.featureState||{})],properties:[iN,[],i=>i.properties()],"geometry-type":[iO,[],i=>i.geometryType()],worldview:[iO,[],i=>i.globals.worldview||""],"is-active-floor":[iB,aq(iO),(i,r)=>{if(!(i.globals&&i.globals.activeFloors&&i.globals.activeFloors.size>0))return!1;if(0===r.length)return!0;let a=i.globals.activeFloors;return r.some(r=>{let n=r.evaluate(i);return a.has(n)})}],id:[iU,[],i=>i.id()],zoom:[iF,[],i=>i.globals.zoom],pitch:[iF,[],i=>i.globals.pitch||0],"distance-from-center":[iF,[],i=>i.distanceFromCenter()],"measure-light":[iF,[iO],(i,[r])=>i.measureLight(r.evaluate(i))],"heatmap-density":[iF,[],i=>i.globals.heatmapDensity||0],"line-progress":[iF,[],i=>i.globals.lineProgress||0],"raster-value":[iF,[],i=>i.globals.rasterValue||0],"raster-particle-speed":[iF,[],i=>i.globals.rasterParticleSpeed||0],"sky-radial-progress":[iF,[],i=>i.globals.skyRadialProgress||0],accumulated:[iU,[],i=>void 0===i.globals.accumulated?null:i.globals.accumulated],"+":[iF,aq(iF),(i,r)=>{let a=0;for(let n of r)a+=n.evaluate(i);return a}],"*":[iF,aq(iF),(i,r)=>{let a=1;for(let n of r)a*=n.evaluate(i);return a}],"-":{type:iF,overloads:[[[iF,iF],(i,[r,a])=>r.evaluate(i)-a.evaluate(i)],[[iF],(i,[r])=>-r.evaluate(i)]]},"/":[iF,[iF,iF],(i,[r,a])=>r.evaluate(i)/a.evaluate(i)],"%":[iF,[iF,iF],(i,[r,a])=>r.evaluate(i)%a.evaluate(i)],ln2:[iF,[],()=>Math.LN2],pi:[iF,[],()=>Math.PI],e:[iF,[],()=>Math.E],"^":[iF,[iF,iF],(i,[r,a])=>Math.pow(r.evaluate(i),a.evaluate(i))],sqrt:[iF,[iF],(i,[r])=>Math.sqrt(r.evaluate(i))],log10:[iF,[iF],(i,[r])=>Math.log(r.evaluate(i))/Math.LN10],ln:[iF,[iF],(i,[r])=>Math.log(r.evaluate(i))],log2:[iF,[iF],(i,[r])=>Math.log2(r.evaluate(i))],sin:[iF,[iF],(i,[r])=>Math.sin(r.evaluate(i))],cos:[iF,[iF],(i,[r])=>Math.cos(r.evaluate(i))],tan:[iF,[iF],(i,[r])=>Math.tan(r.evaluate(i))],asin:[iF,[iF],(i,[r])=>Math.asin(r.evaluate(i))],acos:[iF,[iF],(i,[r])=>Math.acos(r.evaluate(i))],atan:[iF,[iF],(i,[r])=>Math.atan(r.evaluate(i))],min:[iF,aq(iF),(i,r)=>Math.min(...r.map(r=>r.evaluate(i)))],max:[iF,aq(iF),(i,r)=>Math.max(...r.map(r=>r.evaluate(i)))],abs:[iF,[iF],(i,[r])=>Math.abs(r.evaluate(i))],round:[iF,[iF],(i,[r])=>{let a=r.evaluate(i);return a<0?-Math.round(-a):Math.round(a)}],floor:[iF,[iF],(i,[r])=>Math.floor(r.evaluate(i))],ceil:[iF,[iF],(i,[r])=>Math.ceil(r.evaluate(i))],"filter-==":[iB,[iO,iU],(i,[r,a])=>i.properties()[r.value]===a.value],"filter-id-==":[iB,[iU],(i,[r])=>i.id()===r.value],"filter-type-==":[iB,[iO],(i,[r])=>i.geometryType()===r.value],"filter-<":[iB,[iO,iU],(i,[r,a])=>{let n=i.properties()[r.value],o=a.value;return typeof n==typeof o&&n<o}],"filter-id-<":[iB,[iU],(i,[r])=>{let a=i.id(),n=r.value;return typeof a==typeof n&&a<n}],"filter->":[iB,[iO,iU],(i,[r,a])=>{let n=i.properties()[r.value],o=a.value;return typeof n==typeof o&&n>o}],"filter-id->":[iB,[iU],(i,[r])=>{let a=i.id(),n=r.value;return typeof a==typeof n&&a>n}],"filter-<=":[iB,[iO,iU],(i,[r,a])=>{let n=i.properties()[r.value],o=a.value;return typeof n==typeof o&&n<=o}],"filter-id-<=":[iB,[iU],(i,[r])=>{let a=i.id(),n=r.value;return typeof a==typeof n&&a<=n}],"filter->=":[iB,[iO,iU],(i,[r,a])=>{let n=i.properties()[r.value],o=a.value;return typeof n==typeof o&&n>=o}],"filter-id->=":[iB,[iU],(i,[r])=>{let a=i.id(),n=r.value;return typeof a==typeof n&&a>=n}],"filter-has":[iB,[iU],(i,[r])=>r.value in i.properties()],"filter-has-id":[iB,[],i=>null!==i.id()&&void 0!==i.id()],"filter-type-in":[iB,[iH(iO)],(i,[r])=>r.value.includes(i.geometryType())],"filter-id-in":[iB,[iH(iU)],(i,[r])=>r.value.includes(i.id())],"filter-in-small":[iB,[iO,iH(iU)],(i,[r,a])=>a.value.includes(i.properties()[r.value])],"filter-in-large":[iB,[iO,iH(iU)],(i,[r,a])=>(function(i,r,a,n){for(;a<=n;){let o=a+n>>1;
1if(r[o]===i)return!0;r[o]>i?n=o-1:a=o+1}return!1})(i.properties()[r.value],a.value,0,a.value.length-1)],all:{type:iB,overloads:[[[iB,iB],(i,[r,a])=>r.evaluate(i)&&a.evaluate(i)],[aq(iB),(i,r)=>{for(let a of r)if(!a.evaluate(i))return!1;return!0}]]},any:{type:iB,overloads:[[[iB,iB],(i,[r,a])=>r.evaluate(i)||a.evaluate(i)],[aq(iB),(i,r)=>{for(let a of r)if(a.evaluate(i))return!0;return!1}]]},"!":[iB,[iB],(i,[r])=>!r.evaluate(i)],"is-supported-script":[iB,[iO],(i,[r])=>{let a=i.globals&&i.globals.isSupportedScript;return!a||a(r.evaluate(i))}],upcase:[iO,[iO],(i,[r])=>r.evaluate(i).toUpperCase()],downcase:[iO,[iO],(i,[r])=>r.evaluate(i).toLowerCase()],concat:[iO,aq(iU),(i,r)=>r.map(r=>i4(r.evaluate(i))).join("")],"resolved-locale":[iO,[iV],(i,[r])=>r.evaluate(i).resolvedLocale()],random:[iF,[iF,iF,iU],(i,r)=>{let a,[n,o,s]=r.map(r=>r.evaluate(i));if(n>o||n===o)return n;if("string"==typeof s)a=function(i){let r=0;if(0===i.length)return r;for(let a=0;a<i.length;a++)r=(r<<5)-r+i.charCodeAt(a),r&=r;return r}(s);else{if("number"!=typeof s)throw new i8(`Invalid seed input: ${s}`);a=s}return n+aV(a)()*(o-n)}]});class a7{constructor(i,r,a,n,o){this.expression=i,this._warningHistory={},this._scope=a,this._options=n,this._iconImageUseTheme=o,this._evaluator=new ru(a,n,o),this._defaultValue=r?function(i){return"color"===i.type&&(a2(i.default)||Array.isArray(i.default))?new iI(0,0,0,0):"color"===i.type?iI.parse(i.default)||null:void 0===i.default?null:i.default}(r):null,this._enumValues=r&&"enum"===r.type?r.values:null,this.configDependencies=aZ(i),this.isIndoorDependent=aW(i)}evaluateWithoutErrorHandling(i,r,a,n,o,s,l,h){return this._evaluator.globals=i,this._evaluator.feature=r,this._evaluator.featureState=a,this._evaluator.canonical=n||null,this._evaluator.availableImages=o||null,this._evaluator.formattedSection=s,this._evaluator.featureTileCoord=l||null,this._evaluator.featureDistanceData=h||null,this.expression.evaluate(this._evaluator)}evaluate(i,r,a,n,o,s,l,h,u){this._evaluator||(this._evaluator=new ru(this._scope,this._options,this._iconImageUseTheme)),this._evaluator.globals=i,this._evaluator.feature=r||null,this._evaluator.featureState=a||null,this._evaluator.canonical=n||null,this._evaluator.availableImages=o||null,this._evaluator.formattedSection=s||null,this._evaluator.featureTileCoord=l||null,this._evaluator.featureDistanceData=h||null,this._evaluator.iconImageUseTheme=u||null;try{let i=this.expression.evaluate(this._evaluator);if(null==i||"number"==typeof i&&i!=i)return this._defaultValue;if(this._enumValues&&!(i in this._enumValues))throw new i8(`Expected value to be one of ${Object.keys(this._enumValues).map(i=>JSON.stringify(i)).join(", ")}, but found ${JSON.stringify(i)} instead.`);return i}catch(i){return this._warningHistory[i.message]||(this._warningHistory[i.message]=!0,"undefined"!=typeof console&&console.warn(`Failed to evaluate expression "${JSON.stringify(this.expression.serialize())}". ${i.message}`)),this._defaultValue}}}function ne(i){return Array.isArray(i)&&i.length>0&&"string"==typeof i[0]&&i[0]in aj}function nt(i,r,a,n,o){let s=new r7(aj,[],r?function(i){let r={color:ik,string:iO,number:iF,enum:iO,boolean:iB,formatted:ij,resolvedImage:iG};return"array"===i.type?iH(r[i.value]||iU,i.length):r[i.type]}(r):void 0,void 0,void 0,a,n,o),l=s.parse(i,void 0,void 0,void 0,r&&"string"===r.type?{typeAnnotation:"coerce"}:void 0);return l?aX(new a7(l,r,a,n,o)):aY(s.errors)}class ni{constructor(i,r,a,n){this.kind=i,this._styleExpression=r,this.isLightConstant=a,this.isLineProgressConstant=n,this.isStateDependent="constant"!==i&&!r2(r.expression),this.configDependencies=aZ(r.expression),this.isIndoorDependent=aW(r.expression)}evaluateWithoutErrorHandling(i,r,a,n,o,s){return this._styleExpression.evaluateWithoutErrorHandling(i,r,a,n,o,s)}evaluate(i,r,a,n,o,s,l){return this._styleExpression.evaluate(i,r,a,n,o,s,void 0,void 0,l)}}class nr{constructor(i,r,a,n,o,s){this.kind=i,this.zoomStops=a,this._styleExpression=r,this.isStateDependent="camera"!==i&&!r2(r.expression),this.isIndoorDependent=aW(r.expression),this.isLightConstant=o,this.isLineProgressConstant=s,this.configDependencies=aZ(r.expression),this.interpolationType=n}evaluateWithoutErrorHandling(i,r,a,n,o,s){return this._styleExpression.evaluateWithoutErrorHandling(i,r,a,n,o,s)}evaluate(i,r,a,n,o,s){return this._styleExpression.evaluate(i,r,a,n,o,s)}interpolationFactor(i,r,a){return this.interpolationType?ag.interpolationFactor(this.interpolationType,i,r,a):0}}function na(i,r,a,n,o){if("error"===(i=nt(i,r,a,n,o)).result)return i;let s=i.value.expression,l=r1(s);if(!l&&!aK(r))return aY([new iR("","data expressions not supported")]);let h=r3(s,["zoom","pitch","distance-from-center"]);if(!h&&!a0(r))return aY([new iR("","zoom expressions not supported")]);let u=r3(s,["measure-light"]);if(!u&&!aQ(r))return aY([new iR("","measure-light expression not supported")]);let c=r3(s,["line-progress"]);if(!c&&!aJ(r.expression,"line-progress"))return aY([new iR("","line-progress expression not supported")]);let d=r.expression&&r.expression.relaxZoomRestriction,p=function i(r){let a=null;if(r instanceof ab)a=i(r.result);else if(r instanceof ax){for(let n of r.args)if(a=i(n))break}else(r instanceof at||r instanceof ag)&&r.input instanceof rc&&"zoom"===r.input.name&&(a=r);return a instanceof iR||r.eachChild(r=>{let n=i(r);n instanceof iR?a=n:a&&n&&a!==n&&(a=new iR("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),a}(s);return p||h||d?p instanceof iR?aY([p]):p instanceof ag&&!a1(r)?aY([new iR("",'"interpolate" expressions cannot be used with this property')]):aX(p?new nr(l&&c?"camera":"composite",i.value,p.labels,p instanceof ag?p.interpolation:void 0,u,c):new ni(l&&c?"constant":"source",i.value,u,c)):aY([new iR("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression, or in the properties of atmosphere.')])}class nn{constructor(i,r){this._parameters=i,this._specification=r,Object.assign(this,function i(r,a){let n,o,s,l="color"===a.type,h=r.stops&&"object"==typeof r.stops[0][0],u=h||
1!(h||void 0!==r.property),c=r.type||(a1(a)?"exponential":"interval");if(l&&((r=Object.assign({},r)).stops&&(r.stops=r.stops.map(i=>[i[0],iI.parse(i[1])])),r.default=iI.parse(r.default?r.default:a.default)),r.colorSpace&&"rgb"!==r.colorSpace&&!a_[r.colorSpace])throw Error(`Unknown color space: ${r.colorSpace}`);if("exponential"===c)n=a8;else if("interval"===c)n=a6;else if("categorical"===c){for(let i of(n=a4,o=Object.create(null),r.stops))o[i[0]]=i[1];s=typeof r.stops[0][0]}else{if("identity"!==c)throw Error(`Unknown function type "${c}"`);n=a9}if(h){let n={},o=[];for(let i=0;i<r.stops.length;i++){let a=r.stops[i],s=a[0].zoom;void 0===n[s]&&(n[s]={zoom:s,type:r.type,property:r.property,default:r.default,stops:[]},o.push(s)),n[s].stops.push([a[0].value,a[1]])}let s=[];for(let r of o)s.push([n[r].zoom,i(n[r],a)]);let l={name:"linear"};return{kind:"composite",interpolationType:l,interpolationFactor:ag.interpolationFactor.bind(void 0,l),zoomStops:s.map(i=>i[0]),evaluate:({zoom:i},n)=>a8({stops:s,base:r.base},a,i).evaluate(i,n)}}if(u){let i="exponential"===c?{name:"exponential",base:void 0!==r.base?r.base:1}:null;return{kind:"camera",interpolationType:i,interpolationFactor:ag.interpolationFactor.bind(void 0,i),zoomStops:r.stops.map(i=>i[0]),evaluate:({zoom:i})=>n(r,a,i,o,s)}}return{kind:"source",evaluate(i,l){let h=l&&l.properties?l.properties[r.property]:void 0;return void 0===h?a5(r.default,a.default):n(r,a,h,o,s)}}}(this._parameters,this._specification))}static deserialize(i){return new nn(i._parameters,i._specification)}static serialize(i){return{_parameters:i._parameters,_specification:i._specification}}}class no{constructor(i,r,a){if(this.boxSeen=new Uint32Array(0),this.circleSeen=new Uint32Array(0),this.generation=0,i instanceof ArrayBuffer){let r=new Int32Array(i);this.width=r[0],this.height=r[1],this.xCellCount=r[2],this.yCellCount=r[3],this.boxUid=r[4],this.circleUid=r[5];let a=this.xCellCount*this.yCellCount,n=[];for(let i=0;i<a;i++){let a=r[6+i],o=r[6+i+1];n.push(a===o?null:r.subarray(a,o))}let o=r[6+a],s=[];for(let i=0;i<a;i++){let a=r[o+i],n=r[o+i+1];s.push(a===n?null:r.subarray(a,n))}let l=r[o+a];this.boxCells=n,this.circleCells=s,this.boxKeys=r.subarray(l,l+this.boxUid),l+=this.boxUid,this.circleKeys=r.subarray(l,l+this.circleUid),l+=this.circleUid,this.bboxes=r.subarray(l,l+4*this.boxUid),l+=4*this.boxUid,this.circles=r.subarray(l,l+3*this.circleUid)}else{this.width=i,this.height=r,this.xCellCount=Math.ceil(i/a),this.yCellCount=Math.ceil(r/a);let n=this.xCellCount*this.yCellCount,o=[],s=[];for(let i=0;i<n;i++)o.push([]),s.push([]);this.boxCells=o,this.circleCells=s,this.boxKeys=[],this.circleKeys=[],this.bboxes=[],this.circles=[],this.boxUid=0,this.circleUid=0}this.xScale=this.xCellCount/this.width,this.yScale=this.yCellCount/this.height}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(i,r,a,n,o){let s=this.boxUid++,l=this._xCell(r),h=this._yCell(a),u=this._xCell(n),c=this._yCell(o);for(let i=l;i<=u;i++)for(let r=h;r<=c;r++)this.boxCells[this.xCellCount*r+i].push(s);this.boxKeys.push(i),this.bboxes.push(r,a,n,o)}insertCircle(i,r,a,n){let o=this.circleUid++,s=this._xCell(r-n),l=this._yCell(a-n),h=this._xCell(r+n),u=this._yCell(a+n);for(let i=s;i<=h;i++)for(let r=l;r<=u;r++)this.circleCells[this.xCellCount*r+i].push(o);this.circleKeys.push(i),this.circles.push(r,a,n)}query(i,r,a,n,o){let s=[];if(a<0||i>this.width||n<0||r>this.height)return s;let l=this._nextGen(),{boxCells:h,circleCells:u,boxKeys:c,circleKeys:d,bboxes:p,circles:f,boxSeen:m,circleSeen:_,xCellCount:g}=this,y=this._xCell(i),x=this._yCell(r),v=this._xCell(a),b=this._yCell(n);for(let w=y;w<=v;w++)for(let y=x;y<=b;y++){let x=g*y+w,v=h[x];if(v)for(let h=0;h<v.length;h++){let u=v[h];if(m[u]===l)continue;m[u]=l;let d=4*u,f=p[d],_=p[d+1],g=p[d+2],y=p[d+3];i<=g&&r<=y&&a>=f&&n>=_&&(!o||o(c[u]))&&s.push({key:c[u],x1:f,y1:_,x2:g,y2:y})}let b=u[x];if(b)for(let h=0;h<b.length;h++){let u=b[h];if(_[u]===l)continue;_[u]=l;let c=3*u,p=f[c],m=f[c+1],g=f[c+2];this._circleAndRectCollide(p,m,g,i,r,a,n)&&(!o||o(d[u]))&&s.push({key:d[u],x1:p-g,y1:m-g,x2:p+g,y2:m+g})}}return s}queryKeys(i,r,a,n,o){let s=[];if(a<0||i>this.width||n<0||r>this.height)return s;let l=this._nextGen(),{boxCells:h,boxKeys:u,bboxes:c,boxSeen:d,xCellCount:p,xScale:f,yScale:m}=this,_=this._xCell(i),g=this._yCell(r),y=this._xCell(a),x=this._yCell(n);for(let v=_;v<=y;v++)for(let _=g;_<=x;_++){if(o&&!o(v/f,_/m,(v+1)/f,(_+1)/m))continue;let g=h[p*_+v];if(g)for(let h=0;h<g.length;h++){let p=g[h];if(d[p]===l)continue;d[p]=l;let f=4*p,m=c[f],_=c[f+1],y=c[f+2],x=c[f+3];(o?o(m,_,y,x):i<=y&&r<=x&&a>=m&&n>=_)&&s.push(u[p])}}return s}
1hitTest(i,r,a,n,o){if(a<0||i>this.width||n<0||r>this.height)return!1;let s=this._nextGen(),{boxCells:l,circleCells:h,boxKeys:u,circleKeys:c,bboxes:d,circles:p,boxSeen:f,circleSeen:m,xCellCount:_}=this,g=this._xCell(i),y=this._yCell(r),x=this._xCell(a),v=this._yCell(n);for(let b=g;b<=x;b++)for(let g=y;g<=v;g++){let y=_*g+b,x=l[y];if(x)for(let l=0;l<x.length;l++){let h=x[l];if(f[h]===s)continue;f[h]=s;let c=4*h;if(i<=d[c+2]&&r<=d[c+3]&&a>=d[c]&&n>=d[c+1]&&(!o||o(u[h])))return!0}let v=h[y];if(v)for(let l=0;l<v.length;l++){let h=v[l];if(m[h]===s)continue;m[h]=s;let u=3*h;if(this._circleAndRectCollide(p[u],p[u+1],p[u+2],i,r,a,n)&&(!o||o(c[h])))return!0}}return!1}hitTestCircle(i,r,a,n){let o=i-a,s=r-a,l=i+a,h=r+a;if(l<0||o>this.width||h<0||s>this.height)return!1;let u=this._nextGen(),{boxCells:c,circleCells:d,boxKeys:p,circleKeys:f,bboxes:m,circles:_,boxSeen:g,circleSeen:y,xCellCount:x}=this,v=this._xCell(o),b=this._yCell(s),w=this._xCell(l),T=this._yCell(h);for(let o=v;o<=w;o++)for(let s=b;s<=T;s++){let l=x*s+o,h=c[l];if(h)for(let o=0;o<h.length;o++){let s=h[o];if(g[s]===u)continue;g[s]=u;let l=4*s;if(this._circleAndRectCollide(i,r,a,m[l],m[l+1],m[l+2],m[l+3])&&(!n||n(p[s])))return!0}let v=d[l];if(v)for(let o=0;o<v.length;o++){let s=v[o];if(y[s]===u)continue;y[s]=u;let l=3*s;if(this._circlesCollide(_[l],_[l+1],_[l+2],i,r,a)&&(!n||n(f[s])))return!0}}return!1}static serialize(i,r){let a=i.toArrayBuffer();return r&&r.add(a),{buffer:a}}static deserialize(i){return new no(i.buffer)}toArrayBuffer(){let i=this.xCellCount*this.yCellCount,r=0,a=0;for(let n=0;n<i;n++)r+=this.boxCells[n].length,a+=this.circleCells[n].length;let n=new Int32Array(6+(i+1)+r+(i+1)+a+this.boxUid+this.circleUid+4*this.boxUid+3*this.circleUid);n[0]=this.width,n[1]=this.height,n[2]=this.xCellCount,n[3]=this.yCellCount,n[4]=this.boxUid,n[5]=this.circleUid;let o=6+(i+1);for(let r=0;r<i;r++){n[6+r]=o;let i=this.boxCells[r];n.set(i,o),o+=i.length}n[6+i]=o;let s=o;o+=i+1;for(let r=0;r<i;r++){n[s+r]=o;let i=this.circleCells[r];n.set(i,o),o+=i.length}return n[s+i]=o,n.set(this.boxKeys,o),o+=this.boxUid,n.set(this.circleKeys,o),o+=this.circleUid,n.set(this.bboxes,o),o+=4*this.boxUid,n.set(this.circles,o),n.buffer}_xCell(i){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(i*this.xScale)))}_yCell(i){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(i*this.yScale)))}_nextGen(){return this.boxSeen.length<this.boxUid&&(this.boxSeen=new Uint32Array(this.boxUid)),this.circleSeen.length<this.circleUid&&(this.circleSeen=new Uint32Array(this.circleUid)),this.generation=this.generation+1>>>0,0===this.generation&&(this.boxSeen.fill(0),this.circleSeen.fill(0),this.generation=1),this.generation}_circlesCollide(i,r,a,n,o,s){let l=n-i,h=o-r,u=a+s;return u*u>l*l+h*h}_circleAndRectCollide(i,r,a,n,o,s,l){let h=(s-n)/2,u=Math.abs(i-(n+h));if(u>h+a)return!1;let c=(l-o)/2,d=Math.abs(r-(o+c));if(d>c+a)return!1;if(u<=h||d<=c)return!0;let p=u-h,f=d-c;return p*p+f*f<=a*a}}let ns={};function nl(i,r,a={}){Object.defineProperty(i,"_classRegistryKey",{value:r,writable:!1}),ns[r]={klass:i,omit:a.omit||[]}}for(let i in nl(Object,"Object"),nl(no,"Grid"),delete e8.prototype.constructor,nl(iI,"Color"),nl(Error,"Error"),nl(iQ,"Formatted"),nl(iK,"FormattedSection"),nl(t6,"AJAXError"),nl(i1,"ResolvedImage"),nl(nn,"StylePropertyFunction"),nl(a7,"StyleExpression",{omit:["_evaluator"]}),nl(ib,"ImageId"),nl(i0,"ImageVariant"),nl(nr,"ZoomDependentExpression"),nl(ni,"ZoomConstantExpression"),nl(rc,"CompoundExpression",{omit:["_evaluate"]}),aj)ns[aj[i]._classRegistryKey]||nl(aj[i],`Expression${i}`);function nh(i){return i&&(i instanceof ArrayBuffer||i.constructor&&"ArrayBuffer"===i.constructor.name)}function nu(i,r){if(null===i)return null;let a=typeof i;if("object"!==a)return"bigint"===a?{$name:"BigInt",value:i.toString()}:i;if(Array.isArray(i)){let a=i.length,n=[];n.length=a;for(let o=0;o<a;o++)n[o]=nu(i[o],r);return n}if(ArrayBuffer.isView(i))return r&&r.add(i.buffer),i;if(nh(i)||i instanceof ImageBitmap)return r&&r.add(i),i;if(i instanceof ImageData)return r&&r.add(i.data.buffer),i;if(i instanceof Map){let a={$name:"Map",entries:[]};
1for(let[n,o]of i.entries())a.entries.push(nu(n),nu(o,r));return a}if(i instanceof Set){let r={$name:"Set"},a=0;for(let n of i.values())r[++a]=nu(n);return r}if(i instanceof Date||i instanceof RegExp||i instanceof Boolean||i instanceof Number||i instanceof String)return i;let n=i.constructor,o=n._classRegistryKey;if(!o)throw Error(`Can't serialize object of unregistered class "${n.name}".`);let s=n.serialize?n.serialize(i,r):{};if(!n.serialize){let a=ns[o].omit;for(let n in i)Object.hasOwn(i,n)&&(a.includes(n)||(s[n]=nu(i[n],r)));i instanceof Error&&(s.message=i.message)}if(s.$name)throw Error("$name property is reserved for worker serialization logic.");return"Object"!==o&&(s.$name=o),s}function nc(i){if(null===i||"object"!=typeof i)return i;if(Array.isArray(i)){for(let r=0;r<i.length;r++)i[r]=nc(i[r]);return i}if(ArrayBuffer.isView(i)||nh(i)||i instanceof ImageBitmap||i instanceof ImageData||i instanceof Date||i instanceof RegExp||i instanceof Boolean||i instanceof Number||i instanceof String)return i;let r=i.$name||"Object";if("Map"===r){let r=i.entries||[],a=new Map;for(let i=0;i<r.length;i+=2)a.set(nc(r[i]),nc(r[i+1]));return a}if("Set"===r){let r=new Set;for(let a in i)"$name"!==a&&r.add(nc(i[a]));return r}if("BigInt"===r)return BigInt(i.value);let{klass:a}=ns[r];if(!a)throw Error(`Can't deserialize unregistered class "${r}".`);if(a.deserialize)return a.deserialize(i);let n=Object.create(a.prototype);for(let r in i)"$name"!==r&&(n[r]=nc(i[r]));return n}let nd=i=>i>=1536&&i<=1791,np=i=>i>=1872&&i<=1919,nf=i=>i>=2208&&i<=2303,nm=i=>i>=11904&&i<=12031,n_=i=>i>=12032&&i<=12255,ng=i=>i>=12272&&i<=12287,ny=i=>i>=12288&&i<=12351,nx=i=>i>=12352&&i<=12447,nv=i=>i>=12448&&i<=12543,nb=i=>i>=12544&&i<=12591,nw=i=>i>=12704&&i<=12735,nT=i=>i>=12736&&i<=12783,nS=i=>i>=12784&&i<=12799,nE=i=>i>=12800&&i<=13055,nI=i=>i>=13056&&i<=13311,nA=i=>i>=13312&&i<=19903,nM=i=>i>=19968&&i<=40959,nC=i=>i>=40960&&i<=42127,nP=i=>i>=42128&&i<=42191,nD=i=>i>=44032&&i<=55215,nR=i=>i>=63744&&i<=64255,nz=i=>i>=64336&&i<=65023,nL=i=>i>=65040&&i<=65055,nF=i=>i>=65072&&i<=65103,nO=i=>i>=65104&&i<=65135,nB=i=>i>=65136&&i<=65279,nk=i=>i>=65280&&i<=65519;function nN(i){for(let r of i)if(nU(r.charCodeAt(0)))return!0;return!1}function nU(i){return!(746!==i&&747!==i&&(i<4352||!(nw(i)||nb(i)||nF(i)&&!(i>=65097&&i<=65103)||nR(i)||nI(i)||nm(i)||nT(i)||!(!ny(i)||i>=12296&&i<=12305||i>=12308&&i<=12319||12336===i)||nA(i)||nM(i)||nE(i)||i>=12592&&i<=12687||i>=43360&&i<=43391||i>=55216&&i<=55295||i>=4352&&i<=4607||nD(i)||nx(i)||ng(i)||i>=12688&&i<=12703||n_(i)||nS(i)||nv(i)&&12540!==i||!(!nk(i)||65288===i||65289===i||65293===i||i>=65306&&i<=65310||65339===i||65341===i||65343===i||i>=65371&&i<=65503||65507===i||i>=65512&&i<=65519)||!(!nO(i)||i>=65112&&i<=65118||i>=65123&&i<=65126)||i>=5120&&i<=5759||i>=6320&&i<=6399||nL(i)||i>=19904&&i<=19967||nC(i)||nP(i))))}function nV(i){return!(nU(i)||i>=128&&i<=255&&(167===i||169===i||174===i||177===i||188===i||189===i||190===i||215===i||247===i)||i>=8192&&i<=8303&&(8214===i||8224===i||8225===i||8240===i||8241===i||8251===i||8252===i||8258===i||8263===i||8264===i||8265===i||8273===i)||i>=8448&&i<=8527||i>=8528&&i<=8591||i>=8960&&i<=9215&&(i>=8960&&i<=8967||i>=8972&&i<=8991||i>=8996&&i<=9e3||9003===i||i>=9085&&i<=9114||i>=9150&&i<=9165||9167===i||i>=9169&&i<=9179||i>=9186&&i<=9215)||i>=9216&&i<=9279&&9251!==i||i>=9280&&i<=9311||i>=9312&&i<=9471||i>=9632&&i<=9727||i>=9728&&i<=9983&&!(i>=9754&&i<=9759)||i>=11008&&i<=11263&&(i>=11026&&i<=11055||i>=11088&&i<=11097||i>=11192&&i<=11243)||ny(i)||nv(i)||i>=57344&&i<=63743||nF(i)||nO(i)||nk(i)||8734===i||8756===i||8757===i||i>=9984&&i<=10087||i>=10102&&i<=10131||65532===i||65533===i)}function nj(i){return i>=1424&&i<=2303||nz(i)||nB(i)}let nG={unavailable:"unavailable",deferred:"deferred",loading:"loading",parsing:"parsing",parsed:"parsed",loaded:"loaded",error:"error"},nH=null,n$=nG.unavailable,nq=null,nZ=function(i){i&&(n$=nG.error),nH&&nH(i)};function nW(){nX.fire(new i_("pluginStateChange",{pluginStatus:n$,pluginURL:nq}))}let nX=new iv,nY=function(){return n$},nJ=function(){if(n$!==nG.deferred||!nq)throw Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");n$=nG.loading,nW(),nq&&ir({url:nq},i=>{i?nZ(i):(n$=nG.loaded,nW())})},nK={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>n$===nG.loaded||null!=nK.applyArabicShaping,isLoading:()=>n$===nG.loading,setState(i){n$=i.pluginStatus,nq=i.pluginURL},isParsing:()=>n$===nG.parsing,isParsed:()=>n$===nG.parsed,getPluginURL:()=>nq},nQ=function(){nK.isLoading()||nK.isLoaded()||"deferred"!==nY()||nJ()};
1class n0{constructor(i,r){this.zoom=i,r?(this.now=r.now,this.fadeDuration=r.fadeDuration,this.transition=r.transition,this.pitch=r.pitch,this.brightness=r.brightness,this.worldview=r.worldview,this.activeFloors=r.activeFloors):(this.now=0,this.fadeDuration=0,this.transition={},this.pitch=0,this.brightness=0)}isSupportedScript(i){var r=nK.isLoaded();for(let a of i)if(!function(i,r){return!(!r&&nj(i)||i>=2304&&i<=3583||i>=3840&&i<=4255||i>=6016&&i<=6143)}(a.charCodeAt(0),r))return!1;return!0}}class n1{constructor(i,r,a,n,o){this.property=i,this.value=r,this.expression=function(i,r,a,n,o){if(a2(i))return new nn(i,r);if(ne(i)||Array.isArray(i)&&i.length>0){let s=na(i,r,a,n,o);if("error"===s.result)throw Error(s.value.map(i=>`${i.key}: ${i.message}`).join(", "));return s.value}{let a=i;return"string"==typeof i&&"color"===r.type&&(a=iI.parse(i)),{kind:"constant",configDependencies:new Set,isIndoorDependent:!1,evaluate:()=>a}}}(void 0===r?i.specification.default:r,i.specification,a,n,o)}isIndoorDependent(){return this.expression.isIndoorDependent}isDataDriven(){return"source"===this.expression.kind||"composite"===this.expression.kind}possiblyEvaluate(i,r,a,n){return this.property.possiblyEvaluate(this,i,r,a,n)}}class n2{constructor(i,r,a,n){this.property=i,this.value=new n1(i,void 0,r,a,n)}transitioned(i,r){return new n5(this.property,this.value,r,Object.assign({},i.transition,this.transition),i.now)}untransitioned(){return new n5(this.property,this.value,null,{},0)}}class n3{constructor(i,r,a,n){this._properties=i,this._values=Object.create(i.defaultTransitionablePropertyValues),this._scope=r,this._options=a,this._iconImageUseTheme=n,this._isIndoorDependent=!1,this.configDependencies=new Set}getValue(i){return tx(this._values[i].value.value)}setValue(i,r){Object.hasOwn(this._values,i)||(this._values[i]=new n2(this._values[i].property,this._scope,this._options,this._iconImageUseTheme)),this._values[i].value=new n1(this._values[i].property,null===r?void 0:tx(r),this._scope,this._options,this._iconImageUseTheme),this._values[i].value.expression.configDependencies&&(this.configDependencies=new Set([...this.configDependencies,...this._values[i].value.expression.configDependencies]),this._isIndoorDependent=this._isIndoorDependent||this._values[i].value.isIndoorDependent())}setTransitionOrValue(i,r){r&&(this._options=r);let a=this._properties.properties;if(i)for(let r in i){let n=i[r];if(r.endsWith("-transition")){let i=r.slice(0,-11);a[i]&&this.setTransition(i,n)}else Object.hasOwn(a,r)&&this.setValue(r,n)}}getTransition(i){return tx(this._values[i].transition)}setTransition(i,r){Object.hasOwn(this._values,i)||(this._values[i]=new n2(this._values[i].property)),this._values[i].transition=tx(r)||void 0}serialize(){let i={};for(let r of Object.keys(this._values)){let a=this.getValue(r);void 0!==a&&(i[r]=a);let n=this.getTransition(r);void 0!==n&&(i[`${r}-transition`]=n)}return i}transitioned(i,r){let a=new n4(this._properties);for(let n of Object.keys(this._values))a._values[n]=this._values[n].transitioned(i,r._values[n]);return a}untransitioned(){let i=new n4(this._properties);for(let r of Object.keys(this._values))i._values[r]=this._values[r].untransitioned();return i}isIndoorDependent(){return this._isIndoorDependent}}class n5{constructor(i,r,a,n,o){let s=n.delay||0,l=n.duration||0;o=o||0,this.property=i,this.value=r,this.begin=o+s,this.end=this.begin+l,i.specification.transition&&(n.delay||n.duration)&&(this.prior=a)}possiblyEvaluate(i,r,a){let n=i.now||0,o=this.value.possiblyEvaluate(i,r,a),s=this.prior;if(s){if(n>this.end||this.value.isDataDriven())return this.prior=null,o;if(n<this.begin)return s.possiblyEvaluate(i,r,a);{let l=(n-this.begin)/(this.end-this.begin);return this.property.interpolate(s.possiblyEvaluate(i,r,a),o,tn(l))}}return o}}class n4{constructor(i){this._properties=i,this._values=Object.create(i.defaultTransitioningPropertyValues)}possiblyEvaluate(i,r,a){let n=new n9(this._properties);for(let o of Object.keys(this._values))n._values[o]=this._values[o].possiblyEvaluate(i,r,a);return n}hasTransition(){for(let i of Object.keys(this._values))if(this._values[i].prior)return!0;return!1}}class n6{constructor(i,r,a,n){this._properties=i,this._values=Object.create(i.defaultPropertyValues),this._scope=r,this._options=a,this._iconImageUseTheme=n,this._isIndoorDependent=!1,this.configDependencies=new Set}getValue(i){return tx(this._values[i].value)}setValue(i,r){this._values[i]=new n1(this._values[i].property,null===r?void 0:tx(r),this._scope,this._options,this._iconImageUseTheme),this._values[i].expression.configDependencies&&(this.configDependencies=new Set([...this.configDependencies,...this._values[i].expression.configDependencies]),this._isIndoorDependent=this._isIndoorDependent||this._values[i].isIndoorDependent())}serialize(){let i={};for(let r of Object.keys(this._values)){let a=this.getValue(r);void 0!==a&&(i[r]=a)}return i}possiblyEvaluate(i,r,a,n){let o=new n9(this._properties);for(let s of Object.keys(this._values))o._values[s]=this._values[s].possiblyEvaluate(i,r,a,n);return o}isIndoorDependent(){return this._isIndoorDependent}}class n8{constructor(i,r,a,n){this.property=i,this.value=r,this.parameters=a,this.iconImageUseTheme=n}isConstant(){return"constant"===this.value.kind}constantOr(i){return"constant"===this.value.kind?this.value.value:i}evaluate(i,r,a,n,o){return this.property.evaluate(this.value,this.parameters,i,r,a,n,this.iconImageUseTheme,o)}}class n9{constructor(i){this._properties=i,this._values=Object.create(i.defaultPossiblyEvaluatedValues)}get(i){return this._values[i]}}class n7{constructor(i){this.specification=i}possiblyEvaluate(i,r){return i.expression.evaluate(r)}interpolate(i,r,a){let n=iD[this.specification.type];return n?n(i,r,a):i}}class oe{constructor(i,r){this.specification=i,this.overrides=r}possiblyEvaluate(i,r,a,n,o){return"constant"===i.expression.kind||"camera"===i.expression.kind?new n8(this,{kind:"constant",value:i.expression.evaluate(r,null,{},a,n,void 0,o)},r):new n8(this,i.expression,r,o)}interpolate(i,r,a){if("constant"!==i.value.kind||"constant"!==r.value.kind)return i;if(void 0===i.value.value||void 0===r.value.value)return new n8(this,{kind:"constant",value:void 0},i.parameters);let n=iD[this.specification.type];return n?new n8(this,{kind:"constant",value:n(i.value.value,r.value.value,a)},i.parameters):i}evaluate(i,r,a,n,o,s,l,h){return"constant"===i.kind?i.value:i.evaluate(r,a,n,o,s,h,l)}}
1class ot{constructor(i){this.specification=i}possiblyEvaluate(i,r,a,n){return!!i.expression.evaluate(r,null,{},a,n)}interpolate(){return!1}}class oi{constructor(i){this.properties=i,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];let r=new n0(0,{});for(let a in i){let n=i[a],o=n.specification;o&&o.overridable&&this.overridableProperties.push(a);let s=this.defaultPropertyValues[a]=new n1(n,void 0),l=this.defaultTransitionablePropertyValues[a]=new n2(n);this.defaultTransitioningPropertyValues[a]=l.untransitioned(),this.defaultPossiblyEvaluatedValues[a]=s.possiblyEvaluate(r)}}}nl(oe,"DataDrivenProperty"),nl(n7,"DataConstantProperty"),nl(ot,"ColorRampProperty");var or=JSON.parse('{"$version":8,"$root":{"version":{"type":"enum","values":[8]},"fragment":{"type":"boolean"},"name":{"type":"string"},"metadata":{"type":"*"},"center":{"type":"array","value":"number"},"zoom":{"type":"number"},"bearing":{"type":"number","default":0,"period":360},"pitch":{"type":"number","default":0},"light":{"type":"light"},"lights":{"type":"array","value":"light-3d"},"terrain":{"type":"terrain","optional":true},"fog":{"type":"fog"},"snow":{"type":"snow"},"rain":{"type":"rain"},"camera":{"type":"camera"},"color-theme":{"type":"colorTheme"},"indoor":{"type":"indoor"},"imports":{"type":"array","value":"import"},"iconsets":{"type":"iconsets"},"schema":{"type":"schema"},"sources":{"type":"sources"},"sprite":{"type":"string"},"glyphs":{"type":"string","default":"mapbox://fonts/mapbox/{fontstack}/{range}.pbf"},"transition":{"type":"transition"},"projection":{"type":"projection"},"layers":{"type":"array","value":"layer"},"models":{"type":"models"},"featuresets":{"type":"featuresets"}},"featuresets":{"*":{"type":"featureset"}},"featureset":{"metadata":{"type":"*"},"selectors":{"type":"array","value":"selector"}},"selector":{"layer":{"type":"string"},"properties":{"type":"selectorProperty"},"featureNamespace":{"type":"string"},"_uniqueFeatureID":{"type":"boolean"}},"selectorProperty":{"*":{"type":"*"}},"model":{"type":"string"},"import":{"id":{"type":"string"},"url":{"type":"string"},"config":{"type":"config"},"data":{"type":"$root"},"color-theme":{"type":"colorTheme","optional":true}},"config":{"*":{"type":"*"}},"schema":{"*":{"type":"option"}},"option":{"default":{"type":"*","expression":{}},"type":{"type":"enum","values":{"string":1,"number":1,"boolean":1,"color":1}},"array":{"type":"boolean"},"minValue":{"type":"number"},"maxValue":{"type":"number"},"stepValue":{"type":"number"},"values":{"type":"array","value":"*"},"metadata":{"type":"*"}},"models":{"*":{"type":"model"}},"light-3d":{"id":{"type":"string"},"properties":{"type":"properties"},"type":{"type":"enum","values":{"ambient":{},"directional":{},"flat":{}}}},"properties":["properties_light_directional","properties_light_ambient","properties_light_flat"],"properties_light_directional":{"direction":{"type":"array","default":[210,30],"minimum":[0,0],"maximum":[360,90],"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"use-theme":true,"transition":true},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"cast-shadows":{"type":"boolean","default":false},"shadow-quality":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"parameters":["zoom"]}},"shadow-intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"shadow-draw-before-layer":{"type":"string"}},"properties_light_ambient":{"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"use-theme":true,"transition":true},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"properties_light_flat":{"anchor":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"use-theme":true,"transition":true},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"iconsets":{"*":{"type":"iconset"}},"iconset":["iconset_sprite","iconset_source"],"iconset_sprite":{"type":{"type":"enum","values":{"sprite":1}},"url":{"type":"string"}},"iconset_source":{"type":{"type":"enum","values":{"source":1}}
1,"source":{"type":"string"}},"sources":{"*":{"type":"source"}},"source":["source_vector","source_raster","source_raster_dem","source_raster_array","source_geojson","source_video","source_image","source_model"],"source_vector":{"type":{"type":"enum","values":{"vector":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"extra_bounds":{"type":"array","value":{"type":"array","value":"number","length":4}},"scheme":{"type":"enum","values":{"xyz":1,"tms":1},"default":"xyz"},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"attribution":{"type":"string"},"promoteId":{"type":"promoteId"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster":{"type":{"type":"enum","values":{"raster":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"extra_bounds":{"type":"array","value":{"type":"array","value":"number","length":4}},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"scheme":{"type":"enum","values":{"xyz":1,"tms":1},"default":"xyz"},"attribution":{"type":"string"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster_dem":{"type":{"type":"enum","values":{"raster-dem":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"extra_bounds":{"type":"array","value":{"type":"array","value":"number","length":4}},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"attribution":{"type":"string"},"encoding":{"type":"enum","values":{"terrarium":1,"mapbox":1},"default":"mapbox"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster_array":{"type":{"type":"enum","values":{"raster-array":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"extra_bounds":{"type":"array","value":{"type":"array","value":"number","length":4}},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"attribution":{"type":"string"},"rasterLayers":{"type":"*"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_geojson":{"type":{"type":"enum","values":{"geojson":1}},"data":{"type":"*"},"maxzoom":{"type":"number","default":18},"minzoom":{"type":"number","default":0},"attribution":{"type":"string"},"buffer":{"type":"number","default":128,"maximum":512,"minimum":0},"filter":{"type":"*"},"tolerance":{"type":"number","default":0.375},"cluster":{"type":"boolean","default":false},"clusterRadius":{"type":"number","default":50,"minimum":0},"clusterMaxZoom":{"type":"number"},"clusterMinPoints":{"type":"number"},"clusterProperties":{"type":"*"},"lineMetrics":{"type":"boolean","default":false},"generateId":{"type":"boolean","default":false},"promoteId":{"type":"promoteId"},"dynamic":{"type":"boolean","default":false}},"source_video":{"type":{"type":"enum","values":{"video":1}},"urls":{"type":"array","value":"string"},"coordinates":{"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"source_image":{"type":{"type":"enum","values":{"image":1}},"url":{"type":"string"},"coordinates":{"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"modelNodeOverride":{"orientation":{"type":"array","value":"number","length":3,"default":[0,0,0],"period":360}},"modelNodeOverrides":{"*":{"type":"modelNodeOverride"}},"modelMaterialOverride":{"model-color":{"type":"color"},"model-color-mix-intensity":{"type":"number"},"model-opacity":{"type":"number"},"model-emissive-strength":{"type":"number"}},"modelMaterialOverrides":{"*":{"type":"modelMaterialOverride"}},"modelSourceModel":{"uri":{"type":"string"},"position":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[-180,-90],"maximum":[180,90]},"orientation":{"type":"array","value":"number","length":3,"default":[0,0,0],"period":360},"nodeOverrides":{"type":"modelNodeOverrides"},"materialOverrides":{"type":"modelMaterialOverrides"},"nodeOverrideNames":{"type":"array","value":"string"},"materialOverrideNames":{"type":"array","value":"string"},"featureProperties":{"type":"*"}},"modelSourceModels":{"*":{"type":"modelSourceModel"}},"source_model":{"type":{"type":"enum","values":{"model":1,"batched-model":1}},"url":{"type":"string"},"maxzoom":{"type":"number","default":18},"minzoom":{"type":"number","default":0},"tiles":{"type":"array","value":"string"},"models":{"type":"modelSourceModels"}},"layer":{"id":{"type":"string"},"type":{"type":"enum","values":{"fill":{},"line":{},"symbol":{},"circle":{},"heatmap":{},"fill-extrusion":{},"building":{},"raster":{},"raster-particle":{},"hillshade":{},"model":{},"background":{},"sky":{},"slot":{},"clip":{}}},"metadata":{"type":"*"},"source":{"type":"string"},"source-layer":{"type":"string"},"slot":{"type":"string"},"minzoom":{"type":"number","minimum":0,"maximum":24},"maxzoom":{"type":"number","minimum":0,"maximum":24},"filter":{"type":"filter"},"layout":{"type":"layout"},"paint":{"type":"paint"},"appearances":{"type":"array","value":"appearance","supported-layer-types":["symbol"]}},"appearance":{"condition":{"type":"boolean","expression":{"interpolated":true,"parameters":["zoom","pitch","feature","feature-state","measure-light","distance-from-center"]},"property-type":"data-driven"},"name":{"type":"string"},"properties":{"type":"*"}},"layout":["layout_clip","layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_building","layout_symbol","layout_raster","layout_raster-particle","layout_hillshade","layout_background","layout_sky","layout_model"],"layout_background":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_sky":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_model":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}},"model-id":{"type":"string","default":"","property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"model-allow-density-reduction":{"type":"boolean","default":true}},"layout_clip":{"clip-layer-types":{"type":"array","value":"enum","values":{"model":1,"symbol":1},"default":[],"expression":{}},"clip-layer-scope":{"type":"array","value":"string","default":[],"expression":{}},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_fill":{"fill-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}},"fill-elevation-reference":{"type":"enum","values":{"none":1,"hd-road-base":1,"hd-road-markup":1},"default":"none","expression":{}},"fill-construct-bridge-guard-rail":{"type":"boolean","default":"true","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"}},"layout_circle":{"circle-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"circle-elevation-reference":{"type":"enum","values":{"none":1,"hd-road-markup":1},"default":"none","expression":{}},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_heatmap":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_fill-extrusion":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}},"fill-extrusion-edge-radius":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"source-max-zoom":{"type":"number","minimum":0,"maximum":24}},"layout_building":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}},"building-facade":{"type":"boolean","default":false,"expression":{"parameters":["feature"]},"property-type":"data-driven"},"building-facade-floors":{"type":"number","minimum":1,"maximum":200,"default":3,"property-type":"data-driven","expression":{"parameters":["feature"]}},"building-facade-unit-width":{"type":"number","minimum":1,"maximum":20,"default":3.1,"property-type":"data-driven","expression":{"parameters":["feature"]}},"building-facade-window":{"type":"array","length":2,"value":"number","minimum":0.1,"maximum":1,"default":[0.9,0.9],"property-type":"data-driven","expression":{"parameters":["feature"]}},"building-roof-shape":{"type":"enum","values":{"flat":1,"hipped":1,"gabled":1,"parapet":1,"mansard":1,"skillion":1,"pyramidal":1},"default":"flat","expression":{"parameters":["feature"]},"property-type":"data-driven"},"building-height":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{},"property-type":"data-driven"},"building-base":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{},"property-type":"data-driven"},"building-flood-light-wall-radius":{"property-type":"data-driven","type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"building-flood-light-ground-radius":{"property-type":"data-driven","type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"building-flip-roof-orientation":{"property-type":"data-driven","type":"boolean","default":false,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}}},"layout_line":{"line-cap":{"type":"enum","values":{"butt":1,"round":1,"square":1},"default":"butt","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-join":{"type":"enum","values":{"bevel":1,"round":1,"miter":1,"none":1},"default":"miter","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{"type":"number","default":2,"expression":{"interpolated":true,"parameters":["zoom"]}},"line-round-limit":{"type":"number","default":1.05,"expression":{"interpolated":true,"parameters":["zoom"]}},"line-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-z-offset":{"type":"number","default":0,"expression":{"parameters":["zoom","feature","line-progress"]},"property-type":"data-driven"},"line-elevation-reference":{"type":"enum","values":{"none":1,"sea":1,"ground":1,"hd-road-markup":1},"default":"none","expression":{}},"line-cross-slope":{"type":"number","expression":{}},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}},"line-width-unit":{"type":"enum","values":{"pixels":1,"meters":1},"default":"pixels","expression":{"parameters":["zoom"]}},"line-elevation-ground-scale":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","feature","line-progress"]},"transition":true,"property-type":"data-driven"}},"layout_symbol":{"symbol-placement":{"type":"enum","values":{"point":1,"line":1,"line-center":1},"default":"point","expression":{"parameters":["zoom"]}},"symbol-spacing":{"type":"number","default":250,"minimum":1,"expression":{"interpolated":true,"parameters":["zoom"]}},"symbol-avoid-edges":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"symbol-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{"type":"enum","values":{"auto":1,"viewport-y":1,"source":1},"default":"auto","expression":{"parameters":["zoom"]}},"symbol-z-elevate":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"symbol-elevation-reference":{"type":"enum","values":{"sea":1,"ground":1,"hd-road-markup":1},"default":"ground","expression":{"parameters":["zoom"]}},"icon-allow-overlap":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-ignore-placement":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-optional":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-rotation-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]}},"icon-size":{"type":"number","default":1,"minimum":0,"appearance":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-size-scale-range":{"type":"array","value":"number","length":2,"default":[0.8,2],"minimum":[0.1,0.1],"maximum":[10,10],"expression":{}},"icon-text-fit":{"type":"enum","values":{"none":1,"width":1,"height":1,"both":1},"default":"none","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit-padding":{"type":"array","value":"number","length":4,"default":[0,0,0,0],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-image":{"type":"resolvedImage","tokens":true,"appearance":true,"use-theme":true,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{"type":"number","default":0,"period":360,"appearance":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{"type":"number","default":2,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]}},"icon-keep-upright":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-offset":{"type":"array","value":"number","length":2,"default":[0,0],"appearance":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"}
1,"icon-anchor":{"type":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]}},"text-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]}},"text-rotation-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]}},"text-field":{"type":"formatted","default":"","tokens":true,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-font":{"type":"array","value":"string","default":["Open Sans Regular","Arial Unicode MS Regular"],"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-size":{"type":"number","default":16,"minimum":0,"appearance":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-size-scale-range":{"type":"array","value":"number","length":2,"default":[0.8,2],"minimum":[0.1,0.1],"maximum":[10,10],"expression":{}},"text-max-width":{"type":"number","default":10,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{"type":"number","default":1.2,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-letter-spacing":{"type":"number","default":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-justify":{"type":"enum","values":{"auto":1,"left":1,"center":1,"right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{"type":"number","default":0,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["zoom","feature"]}},"text-variable-anchor":{"type":"array","value":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"expression":{"parameters":["zoom"]}},"text-anchor":{"type":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{"type":"number","default":45,"expression":{"interpolated":true,"parameters":["zoom"]}},"text-writing-mode":{"type":"array","value":"enum","values":{"horizontal":1,"vertical":1},"expression":{"parameters":["zoom"]}},"text-rotate":{"type":"number","default":0,"period":360,"appearance":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-padding":{"type":"number","default":2,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]}},"text-keep-upright":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"text-transform":{"type":"enum","values":{"none":1,"uppercase":1,"lowercase":1},"default":"none","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-offset":{"type":"array","value":"number","length":2,"default":[0,0],"appearance":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"text-ignore-placement":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"text-optional":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_raster":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_raster-particle":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_hillshade":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"filter":{"type":"array","value":"*"},"filter_symbol":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature","pitch","distance-from-center"]}},"filter_fill":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_hillshade":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_raster":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_raster-particle":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_clip":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_model":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_line":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_circle":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_fill-extrusion":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_building":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_heatmap":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_operator":{"type":"enum","values":{"==":1,"!=":1,">":1,">=":1,"<":1,"<=":1,"in":1,"!in":1,"all":1,"any":1,"none":1,"has":1,"!has":1}},"geometry_type":{"type":"enum","values":{"Point":1,"LineString":1,"Polygon":1}},"function":{"expression":{"type":"expression"},"stops":{"type":"array","value":"function_stop"},"base":{"type":"number","default":1,"minimum":0},"property":{"type":"string","default":"$zoom"},"type":{"type":"enum","values":{"identity":1,"exponential":1,"interval":1,"categorical":1},"default":"exponential"},"colorSpace":{"type":"enum","values":{"rgb":1,"lab":1,"hcl":1},"default":"rgb"},"default":{"type":"*"}},"function_stop":{"type":"array","minimum":0,"maximum":24,"value":["number","color"],"length":2},"expression":{"type":"array","value":"*","minimum":1},"fog":{"range":{"type":"array","default":[0.5,10],"minimum":-20,"maximum":20,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"high-color":{"type":"color","default":"#245cdf","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"space-color":{"type":"color","default":["interpolate",["linear"],["zoom"],4,"#010b19",7,"#367ab9"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"horizon-blend":{"type":"number","default":["interpolate",["linear"],["zoom"],4,0.2,7,0.1],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"star-intensity":{"type":"number","default":["interpolate",["linear"],["zoom"],5,0.35,6,0],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vertical-range":{"type":"array","default":[0,0],"minimum":0,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}}},"snow":{"density":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.85],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.3],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette-color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"center-thinning":{"type":"number","default":0.4,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"direction":{"type":"array","default":[0,50],"minimum":0,"maximum":360,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"flake-size":{"type":"number","default":0.71,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true}},"rain":{"density":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.5],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"color":{"type":"color","default":["interpolate",["linear"],["measure-light","brightness"],0,"#03113d",0.3,"#a8adbc"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"opacity":{"type":"number","default":["interpolate",["linear"],["measure-light","brightness"],0,0.88,1,0.7],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,1],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette-color":{"type":"color","default":["interpolate",["linear"],["measure-light","brightness"],0,"#001736",0.3,"#464646"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"center-thinning":{"type":"number","default":0.57,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"direction":{"type":"array","default":[0,80],"minimum":0,"maximum":360,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"droplet-size":{"type":"array","default":[2.6,18.2],"minimum":0,"maximum":50,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"distortion-strength":{"type":"number","default":0.7,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true}},"camera":{"camera-projection":{"type":"enum","values":{"perspective":1,"orthographic":1},"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"default":"perspective"}},"colorTheme":{"data":{"type":"string","expression":{}}},"indoor_source":{"sourceId":{"type":"string"},"sourceLayers":{"type":"array","value":"string"}},"indoor":{"*":{"type":"indoor_source"}},"light":{"anchor":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"use-theme":true,"transition":true},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"projection":{"name":{"type":"enum","values":{"albers":1,"equalEarth":1,"equirectangular":1,"lambertConformalConic":1,"mercator":1,"naturalEarth":1,"winkelTripel":1,"globe":1},"default":"mercator"},"center":{"type":"array","length":2,"value":"number","minimum":[-180,-90],"maximum":[180,90]},"parallels":{"type":"array","length":2,"value":"number","minimum":[-90,-90],"maximum":[90,90]}},"terrain":{"source":{"type":"string"},"exaggeration":{"type":"number","default":1,"minimum":0,"maximum":1000,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"paint":["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_building","paint_symbol","paint_raster","paint_raster-particle","paint_hillshade","paint_background","paint_sky","paint_model"],"paint_fill":{"fill-antialias":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-outline-color":{"type":"color","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"fill-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-z-offset":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-bridge-guard-rail-color":{"type":"color","default":"rgba(241, 236, 225, 255)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature"]},"property-type":"data-driven"},"fill-tunnel-structure-color":{"type":"color","default":"rgba(241, 236, 225, 255)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature"]},"property-type":"data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","meas
1ure-light"]},"property-type":"data-driven"},"fill-extrusion-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"fill-extrusion-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-extrusion-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-height":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-height-alignment":{"type":"enum","values":{"terrain":1,"flat":1},"default":"flat"},"fill-extrusion-base-alignment":{"type":"enum","values":{"terrain":1,"flat":1},"default":"terrain"},"fill-extrusion-vertical-gradient":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-extrusion-ambient-occlusion-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-wall-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-ground-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-flood-light-color":{"type":"color","default":"#ffffff","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-flood-light-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-flood-light-wall-radius":{"property-type":"data-driven","type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"fill-extrusion-flood-light-ground-radius":{"property-type":"data-driven","type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"fill-extrusion-flood-light-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-vertical-scale":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-rounded-roof":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-extrusion-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"fill-extrusion-front-cutoff":{"type":"array","value":"number","expression":{"interpolated":true,"parameters":["zoom"]},"length":3,"default":[0,0,1],"minimum":[0,0,0],"maximum":[1,1,1]},"fill-extrusion-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"property-type":"data-driven"},"fill-extrusion-line-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-extrusion-cast-shadows":{"type":"boolean","default":true}},"paint_building":{"building-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"building-ambient-occlusion-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"parameters":[]},"transition":true},"building-ambient-occlusion-ground-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"building-ambient-occlusion-ground-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"building-ambient-occlusion-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"building-vertical-scale":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"building-cast-shadows":{"type":"boolean","default":true},"building-color":{"type":"color","default":"rgba(193, 154, 127, 1)","use-theme":true,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"property-type":"data-driven"},"building-emissive-strength":{"type":"number","default":0,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"property-type":"data-driven"},"building-facade-emissive-chance":{"type":"number","default":0.35,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["measure-light","zoom"]}},"building-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"building-front-cutoff":{"type":"array","value":"number","expression":{"interpolated":true,"parameters":["zoom"]},"length":3,"default":[0,0,1],"minimum":[0,0,0],"maximum":[1,1,1]},"building-flood-light-color":{"type":"color","default":"#ffffff","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"building-flood-light-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"building-flood-light-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_line":{"line-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"line-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"line-width":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light","line-progress"]},"property-type":"data-driven"},"line-gap-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-offset":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"}
1,"line-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-dasharray":{"type":"array","value":"number","minimum":0,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"line-gradient":{"type":"color","use-theme":true,"expression":{"interpolated":true,"parameters":["line-progress"]}},"line-trim-offset":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1]},"line-trim-fade-range":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1],"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"line-trim-color":{"type":"color","default":"transparent","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"line-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-driven"},"line-border-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-border-color":{"type":"color","default":"rgba(0, 0, 0, 0)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-occlusion-opacity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"line-blend-mode":{"type":"enum","values":{"default":1,"multiply":1,"additive":1},"default":"default","expression":{"parameters":["zoom"]}},"line-blend-additive-clamp":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_circle":{"circle-radius":{"type":"number","default":5,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-blur":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"circle-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"circle-pitch-scale":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"circle-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1},"default":"viewport","expression":{"parameters":["zoom"]}},"circle-stroke-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-stroke-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-stroke-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}}},"paint_heatmap":{"heatmap-radius":{"type":"number","default":30,"minimum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"heatmap-weight":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"heatmap-intensity":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"heatmap-color":{"type":"color","default":["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",0.1,"royalblue",0.3,"cyan",0.5,"lime",0.7,"yellow",1,"red"],"use-theme":true,"expression":{"interpolated":true,"parameters":["heatmap-density"]}},"heatmap-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_symbol":{"icon-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"appearance":true,"property-type":"data-driven"},"icon-occlusion-opacity":{"type":"number","minimum":0,"maximum":1,"default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"appearance":true,"property-type":"data-driven"},"icon-emissive-strength":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"appearance":true,"property-type":"data-driven"},"text-emissive-strength":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"appearance":true,"property-type":"data-driven"},"icon-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"appearance":true,"property-type":"data-driven"},"icon-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"appearance":true,"property-type":"data-driven"},"icon-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"appearance":true,"property-type":"data-driven"},"icon-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"appearance":true,"property-type":"data-driven"},"icon-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"appearance":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"icon-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"icon-image-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"text-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"appearance":true,"property-type":"data-driven"},"text-occlusion-opacity":{"type":"number","minimum":0,"maximum":1,"default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"appearance":true,"property-type":"data-driven"},"text-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"overridable":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"appearance":true,"property-type":"data-driven"},"text-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"appearance":true,"property-type":"data-driven"},"text-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"appearance":true,"property-type":"data-driven"},"text-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"appearance":true,"property-type":"data-driven"},"text-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"appearance":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"text-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"icon-color-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{}},"icon-color-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{}},"icon-color-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"icon-color-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{}},"symbol-z-offset":{"type":"number","default":0,"minimum":0,"transition":true,"appearance":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"}},"paint_raster":{"raster-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-color":{"type":"color","use-theme":true,"expression":{"interpolated":true,"parameters":["raster-value"]}},"raster-color-mix":{"type":"array","default":[0.2126,0.7152,0.0722,0],"length":4,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-color-range":{"type":"array","length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-hue-rotate":{"type":"number","default":0,"period":360,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-resampling":{"type":"enum","values":{"linear":1,"nearest":1},"default":"linear","expression":{"parameters":["zoom"]}},"raster-fade-duration":{"type":"number","default":300,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"raster-array-band":{"type":"string"},"raster-elevation":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-elevation-reference":{"type":"enum","values":{"sea":1,"ground":1},"default":"sea","expression":{}}},"paint_raster-particle":{"raster-particle-array-band":{"type":"string"},"raster-particle-count":{"type":"number","default":512,"minimum":1},"raster-particle-color":{"type":"color","use-theme":true,"expression":{"interpolated":true,"parameters":["raster-particle-speed"]}},"raster-particle-max-speed":{"type":"number","default":1,"minimum":1},"raster-particle-speed-factor":{"type":"number","default":0.2,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-particle-fade-opacity-factor":{"type":"number","default":0.98,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-particle-reset-rate-factor":{"type":"number","default":0.8,"minimum":0,"maximum":1},"raster-particle-elevation":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_hillshade":{"hillshade-illumination-direction":{"type":"number","default":335,"minimum":0,"maximum":359,"expression":{"interpolated":true,"parameters":["zoom"]}},"hillshade-illumination-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"viewport","expression":{"parameters":["zoom"]}},"hillshade-exaggeration":{"type":"number","default":0.5,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"hillshade-shadow-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"hillshade-highlight-color":{"type":"color","default":"#FFFFFF","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"hillshade-accent-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"hillshade-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}}},"paint_background":{"background-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":[]}},"background-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"background-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom"]}},"background-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"background-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}}},"paint_sky":{"sky-type":{"type":"enum","values":{"gradient":1,"atmosphere":1},"default":"atmosphere","expression":{"parameters":["zoom"]}},"sky-atmosphere-sun":{"type":"array","value":"number","length":2,"minimum":[0,0],"maximum":[360,180],"expression":{"parameters":["zoom"]}},"sky-atmosphere-sun-intensity":{"type":"number","default":10,"minimum":0,"maximum":100},"sky-gradient-center":{"type":"array","value":"number","default":[0,0],"length":2,"minimum":[0,0],"maximum":[360,180],"expression":{"parameters":["zoom"]}},"sky-gradient-radius":{"type":"number","default":90,"minimum":0,"maximum":180,"expression":{"parameters":["zoom"]}},"sky-gradient":{"type":"color","default":["interpolate",["linear"],["sky-radial-progress"],0.8,"#87ceeb",1,"white"],"use-theme":true,"expression":{"interpolated":true,"parameters":["sky-radial-progress"]}},"sky-atmosphere-halo-color":{"type":"color","default":"white","use-theme":true},"sky-atmosphere-color":{"type":"color","default":"white","use-theme":true},"sky-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_model":{"model-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"property-type":"data-driven"},"model-rotation":{"type":"array","value":"number","length":3,"default":[0,0,0],"period":360,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-scale":{"type":"array","value":"n
1umber","length":3,"default":[1,1,1],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-translation":{"type":"array","value":"number","length":3,"default":[0,0,0],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-color":{"type":"color","default":"#ffffff","property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light","zoom"]},"use-theme":true,"transition":true},"model-color-mix-intensity":{"type":"number","property-type":"data-driven","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-type":{"type":"enum","values":{"common-3d":1,"location-indicator":1},"default":"common-3d"},"model-cast-shadows":{"type":"boolean","default":true},"model-receive-shadows":{"type":"boolean","default":true},"model-ambient-occlusion-intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"model-emissive-strength":{"type":"number","property-type":"data-driven","default":0,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-roughness":{"type":"number","default":1,"minimum":0,"maximum":1,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state"]},"transition":true},"model-height-based-emissive-strength-multiplier":{"type":"array","default":[1,1,1,1,0],"length":5,"value":"number","property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"model-front-cutoff":{"type":"array","value":"number","expression":{"interpolated":true,"parameters":["zoom"]},"length":3,"default":[0,0,1],"minimum":[0,0,0],"maximum":[1,1,1]},"model-elevation-reference":{"type":"enum","values":{"sea":1,"ground":1,"hd-road-markup":1},"default":"ground","expression":{}},"model-ignore-line-cutout":{"type":"boolean","default":false,"expression":{}}},"transition":{"duration":{"type":"number","default":300,"minimum":0},"delay":{"type":"number","default":0,"minimum":0}},"promoteId":{"*":{"type":"*"}}}');function oa(i){return i instanceof Number||i instanceof String||i instanceof Boolean?i.valueOf():i}function on(i){if(Array.isArray(i))return i.map(on);if(i instanceof Object&&!(i instanceof Number||i instanceof String||i instanceof Boolean)){let r={};for(let a in i)r[a]=on(i[a]);return r}return oa(i)}function oo(i){if(!0===i||!1===i)return!0;if(!Array.isArray(i)||0===i.length)return!1;switch(i[0]){case"has":return i.length>=2&&"$id"!==i[1]&&"$type"!==i[1];case"in":return i.length>=3&&("string"!=typeof i[1]||Array.isArray(i[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==i.length||Array.isArray(i[1])||Array.isArray(i[2]);case"any":case"all":for(let r of i.slice(1))if(!oo(r)&&"boolean"!=typeof r)return!1;return!0;default:return!0}}function os(i,r="",a=null,n="fill"){if(null==i)return{filter:()=>!0,needGeometry:!1,needFeature:!1};oo(i)||(i=function i(r){if(!r)return!0;let a=r[0];return r.length<=1?"any"!==a:"=="===a?oc(r[1],r[2],"=="):"!="===a?of(oc(r[1],r[2],"==")):"<"===a||">"===a||"<="===a||">="===a?oc(r[1],r[2],a):"any"===a?["any"].concat(r.slice(1).map(i)):"all"===a?["all"].concat(r.slice(1).map(i)):"none"===a?["all"].concat(r.slice(1).map(i).map(of)):"in"===a?od(r[1],r.slice(2)):"!in"===a?of(od(r[1],r.slice(2))):"has"===a?op(r[1]):"!has"!==a||of(op(r[1]))}(i));let o=i,s=!0;try{s=function(i){if(!ol(i))return i;let r=on(i);return function i(r){let a=!1,n=[];if("case"===r[0]){for(let i=1;i<r.length-1;i+=2)a=a||ol(r[i]),n.push(r[i+1]);n.push(r.at(-1))}else if("match"===r[0]){a=a||ol(r[1]);for(let i=2;i<r.length-1;i+=2)n.push(r[i+1]);n.push(r.at(-1))}else if("step"===r[0]){a=a||ol(r[1]);for(let i=1;i<r.length-1;i+=2)n.push(r[i+1])}a&&(r.length=0,r.push("any",...n));for(let a=1;a<r.length;a++)i(r[a])}(r),r=function i(r){if(!Array.isArray(r))return r;let a=function(i){if(oh.has(i[0])){for(let r=1;r<i.length;r++)if(ol(i[r]))return!0}return i}(r);return!0===a?a:a.map(r=>i(r))}(r)}(o)}catch(i){console.warn(`Failed to extract static filter. Filter will c
1ontinue 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(o,null,2)} 7 `)}let l=null,h=null;if("background"!==n&&"sky"!==n&&"slot"!==n){let i=nt(s,h=or[`filter_${n}`],r,a);if("error"===i.result)throw Error(i.value.map(i=>`${i.key}: ${i.message}`).join(", "));l=(r,a,n)=>i.value.evaluate(r,a,{},n)}let u=null,c=null;if(s!==o){let i=nt(o,h,r,a);if("error"===i.result)throw Error(i.value.map(i=>`${i.key}: ${i.message}`).join(", "));u=(r,a,n,o,s)=>i.value.evaluate(r,a,{},n,void 0,void 0,o,s),c=!r1(i.value.expression)}return{filter:l,dynamicFilter:u||void 0,needGeometry:function i(r){if(!Array.isArray(r))return!1;if("within"===r[0]||"distance"===r[0])return!0;for(let a=1;a<r.length;a++)if(i(r[a]))return!0;return!1}(s),needFeature:!!c}}function ol(i){var r;if(!Array.isArray(i))return!1;if("pitch"===(r=i[0])||"distance-from-center"===r)return!0;for(let r=1;r<i.length;r++)if(ol(i[r]))return!0;return!1}let oh=new Set(["in","==","!=",">",">=","<","<=","to-boolean"]);function ou(i,r){return i<r?-1:+(i>r)}function oc(i,r,a){switch(i){case"$type":return[`filter-type-${a}`,r];case"$id":return[`filter-id-${a}`,r];default:return[`filter-${a}`,i,r]}}function od(i,r){if(0===r.length)return!1;switch(i){case"$type":return["filter-type-in",["literal",r]];case"$id":return["filter-id-in",["literal",r]];default:return r.length>200&&!r.some(i=>typeof i!=typeof r[0])?["filter-in-large",i,["literal",r.sort(ou)]]:["filter-in-small",i,["literal",r]]}}function op(i){switch(i){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",i]}}function of(i){return["!",i]}function om(i,r){return r?`${i}�${r}`:i}function o_(i){let r=i.indexOf("\x1f");return r>=0?i.slice(r+1):""}let og=()=>p||(p=new oi({"icon-size":new oe(or.layout_symbol["icon-size"]),"icon-image":new oe(or.layout_symbol["icon-image"]),"icon-rotate":new oe(or.layout_symbol["icon-rotate"]),"icon-offset":new oe(or.layout_symbol["icon-offset"]),"text-size":new oe(or.layout_symbol["text-size"]),"text-rotate":new oe(or.layout_symbol["text-rotate"]),"text-offset":new oe(or.layout_symbol["text-offset"])})),oy=()=>f||(f=new oi({"icon-opacity":new oe(or.paint_symbol["icon-opacity"]),"icon-occlusion-opacity":new oe(or.paint_symbol["icon-occlusion-opacity"]),"icon-emissive-strength":new oe(or.paint_symbol["icon-emissive-strength"]),"text-emissive-strength":new oe(or.paint_symbol["text-emissive-strength"]),"icon-color":new oe(or.paint_symbol["icon-color"]),"icon-halo-color":new oe(or.paint_symbol["icon-halo-color"]),"icon-halo-width":new oe(or.paint_symbol["icon-halo-width"]),"icon-halo-blur":new oe(or.paint_symbol["icon-halo-blur"]),"icon-translate":new oe(or.paint_symbol["icon-translate"]),"text-opacity":new oe(or.paint_symbol["text-opacity"]),"text-occlusion-opacity":new oe(or.paint_symbol["text-occlusion-opacity"]),"text-color":new oe(or.paint_symbol["text-color"],{runtimeType:ik,getOverride:i=>i.textColor,hasOverride:i=>!!i.textColor}),"text-halo-color":new oe(or.paint_symbol["text-halo-color"]),"text-halo-width":new oe(or.paint_symbol["text-halo-width"]),"text-halo-blur":new oe(or.paint_symbol["text-halo-blur"]),"text-translate":new oe(or.paint_symbol["text-translate"]),"symbol-z-offset":new oe(or.paint_symbol["symbol-z-offset"]),"icon-color-use-theme":new oe({type:"string",default:"default","property-type":"data-driven"}),"icon-halo-color-use-theme":new oe({type:"string",default:"default","property-type":"data-driven"}),"text-color-use-theme":new oe({type:"string",default:"default","property-type":"data-driven"}),"text-halo-color-use-theme":new oe({type:"string",default:"default","property-type":"data-driven"})}));class ox{constructor(i,r,a,n,o,s){this._conditionSpec=i,this._propertiesSpec=a;let l=nt(i,or.appearance.condition);if("success"===l.result&&(this.condition=l.value),this.name=r,a)for(let i in this.layoutProperties=new n9(og()),this.unevaluatedLayout=new n6(og(),n,o,s),this.paintProperties=new n9(oy()),this.unevaluatedPaint=new n6(oy(),n,o,""),a)i in this.unevaluatedLayout._values?this.unevaluatedLayout.setValue(i,a[i]):i in this.unevaluatedPaint._values&&this.unevaluatedPaint.setValue(i,a[i])}
7isActive(i){return!(this.condition||!i.isHidden||"hidden"!==this.name)||this.condition.evaluate(i.globals,i.feature,i.featureState,i.canonical)}getCondition(){return this.condition}getName(){return this.name}getLayoutProperty(i){return this.layoutProperties.get(i)}getPaintProperty(i){return this.paintProperties.get(i)}getUnevaluatedLayoutProperties(){return this.unevaluatedLayout}getUnevaluatedLayoutProperty(i){return this.unevaluatedLayout._values[i]}getUnevaluatedPaintProperty(i){return this.unevaluatedPaint._values[i]}recalculate(i,r,a){this.unevaluatedLayout&&(this.layoutProperties=this.unevaluatedLayout.possiblyEvaluate(i,void 0,r,a)),this.unevaluatedPaint&&(this.paintProperties=this.unevaluatedPaint.possiblyEvaluate(i,void 0,r,""))}serialize(){let i={};i.condition=this.condition.expression.serialize(),this.name&&(i.name=this.name);let r=Object.assign({},this.unevaluatedLayout?this.unevaluatedLayout.serialize():{},this.unevaluatedPaint?this.unevaluatedPaint.serialize():{});return Object.keys(r).length>0&&(i.properties=r),i}hasIconLayoutProperties(){let i=this.hasLayoutProperty("icon-image"),r=this.hasLayoutProperty("icon-size"),a=this.hasLayoutProperty("icon-offset"),n=this.hasLayoutProperty("icon-rotate");return i||r||a||n}hasTextLayoutProperties(){let i=this.hasLayoutProperty("text-size"),r=this.hasLayoutProperty("text-offset"),a=this.hasLayoutProperty("text-rotate");return i||r||a}hasIconPaintProperties(){return!!this.unevaluatedPaint&&Object.keys(this.unevaluatedPaint._values).filter(i=>!i.endsWith("-use-theme")).some(i=>(i.startsWith("icon-")||"symbol-z-offset"===i)&&this.hasPaintProperty(i))}hasTextPaintProperties(){return!!this.unevaluatedPaint&&Object.keys(this.unevaluatedPaint._values).filter(i=>!i.endsWith("-use-theme")).some(i=>(i.startsWith("text-")||"symbol-z-offset"===i)&&this.hasPaintProperty(i))}hasLayoutProperty(i){return this.unevaluatedLayout&&void 0!==this.unevaluatedLayout._values[i].value}hasPaintProperty(i){return this.unevaluatedPaint&&void 0!==this.unevaluatedPaint._values[i].value}}let ov="-transition",ob=new Set(["fill","line","background","hillshade","raster"]);class ow extends iv{constructor(i,r,a,n,o,s){if(super(),this.id=i.id,this.fqid=om(this.id,a),this.type=i.type,this.scope=a,this.lut=n,this.options=o,this.iconImageUseTheme=s,this.appearances=[],this.appearancesVersion=0,this._featureFilter={filter:()=>!0,needGeometry:!1,needFeature:!1},this._filterCompiled=!1,this.expressionDependencies={isIndoorDependent:!1,configDependencies:new Set},"custom"!==i.type){if(this.metadata=i.metadata,this.minzoom=i.minzoom,this.maxzoom=i.maxzoom,i.type&&"background"!==i.type&&"sky"!==i.type&&"slot"!==i.type){this.source=i.source,this.sourceLayer=i["source-layer"],this.filter=i.filter;let r=nt(this.filter,or[`filter_${i.type}`]);"error"!==r.result&&(this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...r.value.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||r.value.isIndoorDependent)}if(i.slot&&(this.slot=i.slot),i.appearances&&this.setAppearances(i.appearances),r.layout&&(this._unevaluatedLayout=new n6(r.layout,this.scope,o,this.iconImageUseTheme),this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...this._unevaluatedLayout.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||this._unevaluatedLayout.isIndoorDependent()),r.paint){for(let a in this._transitionablePaint=new n3(r.paint,this.scope,o),i.paint)this.setPaintProperty(a,i.paint[a]);for(let r in i.layout)this.setLayoutProperty(r,i.layout[r]);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 n9(r.paint)}}}onAdd(i){}onRemove(i){}isDraped(i){return!this.is3D(!0)&&ob.has(this.type)}getLayoutProperty(i){return"visibility"===i?this.visibility:this._unevaluatedLayout.getValue(i)}setLayoutProperty(i,r){if("custom"===this.type&&"visibility"===i)return void(this.visibility=r);let a=this._unevaluatedLayout;a._properties.properties[i]&&(a.setValue(i,r),this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...a.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||a.isIndo
7orDependent(),"visibility"===i&&this.possiblyEvaluateVisibility())}setAppearances(i){this.appearances=[],i.forEach(i=>{this.appearances.push(new ox(i.condition,i.name,i.properties,this.scope,this.options,this.iconImageUseTheme))}),this.appearancesVersion++}possiblyEvaluateVisibility(){this._unevaluatedLayout._values.visibility&&(this.visibility=this._unevaluatedLayout._values.visibility.possiblyEvaluate({zoom:0}))}getPaintProperty(i){return i.endsWith(ov)?this._transitionablePaint.getTransition(i.slice(0,-11)):this._transitionablePaint.getValue(i)}isPaintProperty(i){return!!this._transitionablePaint._properties.properties[i]}setPaintProperty(i,r){let a=this._transitionablePaint,n=a._properties.properties;if(i.endsWith(ov)){let o=i.slice(0,-11);return n[o]&&a.setTransition(o,r||void 0),!1}if(!n[i])return!1;let o=a._values[i],s=o.value.isDataDriven(),l=o.value;a.setValue(i,r),this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...a.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||a.isIndoorDependent(),this._handleSpecialPaintPropertyUpdate(i);let h=a._values[i].value,u=h.isDataDriven(),c=i.endsWith("pattern")||"line-dasharray"===i;return u||s||c||this._handleOverridablePaintPropertyUpdate(i,l,h)}_handleSpecialPaintPropertyUpdate(i){}getProgramIds(){return null}getDefaultProgramParams(i,r,a){return null}_handleOverridablePaintPropertyUpdate(i,r,a){return!1}isHidden(i){return!!(this.minzoom&&i<this.minzoom)||!!(this.maxzoom&&i>=this.maxzoom)||"none"===this.visibility}updateTransitions(i){this._transitioningPaint=this._transitionablePaint.transitioned(i,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(i,r){this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(i,void 0,r,this.iconImageUseTheme)),this.paint=this._transitioningPaint.possiblyEvaluate(i,void 0,r)}
7serialize(){let i={id:this.id,type:this.type,slot:this.slot,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return 0!==this.appearances.length&&(i.appearances=this.appearances.map(i=>i.serialize())),ty(i,(i,r)=>!(void 0===i||"layout"===r&&!Object.keys(i).length||"paint"===r&&!Object.keys(i).length))}is3D(i){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(let i in this.paint._values){let r=this.paint.get(i);if(r instanceof n8&&aK(r.property.specification)&&("source"===r.value.kind||"composite"===r.value.kind)&&r.value.isStateDependent)return!0}for(let i of this.appearances)if(!r2(i.condition.expression))return!0;return!1}compileFilter(i){this._filterCompiled||(this._featureFilter=os(this.filter,this.scope,i),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(i){this._stats&&("shadow"===i.renderPass?this._stats.numRenderedVerticesInShadowPass=0:this._stats.numRenderedVerticesInTransparentPass=0)}getAppearances(){return this.appearances}queryRenderedFeatures(i,r,a){return{}}queryRadius(i){}queryIntersectsFeature(i,r,a,n,o,s,l,h,u,c){}}let oT={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class oS{constructor(i,r){this._structArray=i,this._pos1=r*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}let oE=new ArrayBuffer(0);class oI{constructor(){this._reallocCount=0,this.capacity=0,this.length=0}static serialize(i,r){return i._trim(),r&&i.arrayBuffer&&r.add(i.arrayBuffer),{length:i.length,arrayBuffer:i.arrayBuffer}}static deserialize(i){let r=Object.create(this.prototype);return r.arrayBuffer=i.arrayBuffer,r.length=i.length,i.arrayBuffer?r.capacity=i.arrayBuffer.byteLength/r.bytesPerElement:(r.capacity=0,r.arrayBuffer=oE),r._refreshViews(),r}_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(i){this.reserve(i),this.length=i}reserve(i){if(i>this.capacity){this._reallocCount++,this.capacity=Math.max(i,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);let r=this.uint8;this._refreshViews(),r&&this.uint8.set(r)}}reserveForAdditional(i){this.reserve(this.length+i)}_refreshViews(){throw Error("StructArray#_refreshViews() must be implemented by each concrete StructArray layout")}emplace(){throw Error("StructArray#emplace() must be implemented by each concrete StructArray layout")}emplaceBack(){throw 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 oA(i,r=1){let a=0,n=0;return{members:i.map(i=>{let o=oT[i.type].BYTES_PER_ELEMENT,s=a=oM(a,Math.max(r,o)),l=i.components||1;return n=Math.max(n,o),a+=o*l,{name:i.name,type:i.type,components:l,offset:s}}),size:oM(a,Math.max(n,r)),alignment:r}}function oM(i,r){return Math.ceil(i/r)*r}class oC extends oI{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,r){let a=this.length;return this.resize(a+1),this.emplace(a,i,r)}emplace(i,r,a){let n=2*i;return this.int16[n+0]=r,this.int16[n+1]=a,i}}oC.prototype.bytesPerElement=4,nl(oC,"StructArrayLayout2i4");class oP extends oI{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,r,a){let n=this.length;return this.resize(n+1),this.emplace(n,i,r,a)}emplace(i,r,a,n){let o=3*i;return this.int16[o+0]=r,this.int16[o+1]=a,this.int16[o+2]=n,i}}oP.prototype.bytesPerElement=6,nl(oP,"StructArrayLayout3i6");class oD extends oI{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i,r,a,n){let o=this.length;return this.resize(o+1),this.emplace(o,i,r,a,n)}emplace(i,r,a,n,o){let s=4*i;return this.int16[s+0]=r,this.int16[s+1]=a,this.uint16[s+2]=n,this.uint16[s+3]=o,i}}oD.prototype.bytesPerElement=8,nl(oD,"StructArrayLayout2i2ui8");class oR extends oI{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i){let r=this.length;return this.resize(r+1),this.emplace(r,i)}emplace(i,r){return this.float32[+i+0]=r,i}}
7oR.prototype.bytesPerElement=4,nl(oR,"StructArrayLayout1f4");class oz extends oI{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,r,a){let n=this.length;return this.resize(n+1),this.emplace(n,i,r,a)}emplace(i,r,a,n){let o=4*i;return this.int16[o+0]=r,this.int16[o+1]=a,this.float32[2*i+1]=n,i}}oz.prototype.bytesPerElement=8,nl(oz,"StructArrayLayout2i1f8");class oL extends oI{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,r,a){let n=this.length;return this.resize(n+1),this.emplace(n,i,r,a)}emplace(i,r,a,n){let o=4*i;return this.int16[o+0]=r,this.int16[o+1]=a,this.int16[o+2]=n,i}}oL.prototype.bytesPerElement=8,nl(oL,"StructArrayLayout3i8");class oF extends oI{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,r,a,n){let o=this.length;return this.resize(o+1),this.emplace(o,i,r,a,n)}emplace(i,r,a,n,o){let s=4*i;return this.int16[s+0]=r,this.int16[s+1]=a,this.int16[s+2]=n,this.int16[s+3]=o,i}}oF.prototype.bytesPerElement=8,nl(oF,"StructArrayLayout4i8");class oO extends oI{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,r,a,n,o){let s=this.length;return this.resize(s+1),this.emplace(s,i,r,a,n,o)}emplace(i,r,a,n,o,s){let l=5*i;return this.int16[l+0]=r,this.int16[l+1]=a,this.int16[l+2]=n,this.int16[l+3]=o,this.int16[l+4]=s,i}}oO.prototype.bytesPerElement=10,nl(oO,"StructArrayLayout5i10");class oB extends oI{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,r,a,n,o,s,l){let h=this.length;return this.resize(h+1),this.emplace(h,i,r,a,n,o,s,l)}emplace(i,r,a,n,o,s,l,h){let u=6*i,c=12*i;return this.int16[u+0]=r,this.int16[u+1]=a,this.uint8[c+4]=n,this.uint8[c+5]=o,this.uint8[c+6]=s,this.uint8[c+7]=l,this.float32[3*i+2]=h,i}}oB.prototype.bytesPerElement=12,nl(oB,"StructArrayLayout2i4ub1f12");class ok extends oI{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,r,a){let n=this.length;return this.resize(n+1),this.emplace(n,i,r,a)}emplace(i,r,a,n){let o=3*i;return this.float32[o+0]=r,this.float32[o+1]=a,this.float32[o+2]=n,i}}ok.prototype.bytesPerElement=12,nl(ok,"StructArrayLayout3f12");class oN extends oI{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,r,a,n,o){let s=this.length;return this.resize(s+1),this.emplace(s,i,r,a,n,o)}emplace(i,r,a,n,o,s){let l=6*i;return this.uint16[l+0]=r,this.uint16[l+1]=a,this.uint16[l+2]=n,this.uint16[l+3]=o,this.float32[3*i+2]=s,i}}oN.prototype.bytesPerElement=12,nl(oN,"StructArrayLayout4ui1f12");class oU extends oI{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i,r,a,n){let o=this.length;return this.resize(o+1),this.emplace(o,i,r,a,n)}emplace(i,r,a,n,o){let s=4*i;return this.uint16[s+0]=r,this.uint16[s+1]=a,this.uint16[s+2]=n,this.uint16[s+3]=o,i}}oU.prototype.bytesPerElement=8,nl(oU,"StructArrayLayout4ui8");class oV extends oI{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,r,a,n,o,s){let l=this.length;return this.resize(l+1),this.emplace(l,i,r,a,n,o,s)}emplace(i,r,a,n,o,s,l){let h=6*i;return this.int16[h+0]=r,this.int16[h+1]=a,this.int16[h+2]=n,this.int16[h+3]=o,this.int16[h+4]=s,this.int16[h+5]=l,i}}oV.prototype.bytesPerElement=12,nl(oV,"StructArrayLayout6i12");class oj extends oI{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i,r,a,n,o,s,l,h,u,c,d,p){let f=this.length;return this.resize(f+1),this.emplace(f,i,r,a,n,o,s,l,h,u,c,d,p)}emplace(i,r,a,n,o,s,l,h,u,c,d,p,f){let m=12*i;return this.int16[m+0]=r,this.int16[m+1]=a,this.int16[m+2]=n,this.int16[m+3]=o,this.uint16[m+4]=s,this.uint16[m+5]=l,this.uint16[m+6]=h,this.uint16[m+7]=u,this.int16[m+8]=c,this.int16[m+9]=d,this.int16[m+10]=p,this.int16[m+11]=f,i}}oj.prototype.bytesPerElement=24,nl(oj,"StructArrayLayout4i4ui4i24");class oG extends oI{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,r,a,n,o,s){let l=this.length;return this.resize(l+1),this.emplace(l,i,r,a,n,o,s)}emplace(i,r,a,n,o,s,l){let h=10*i,u=5*i;return this.int16[h+0]=r,this.int16[h+1]=a,this.int16[h+2]=n,this.float32[u+2]=o,this.float32[u+3]=s,this.float32[u+4]=l,i}}oG.prototype.bytesPerElement=20,nl(oG,"StructArrayLayout3i3f20");class oH extends oI{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,r,a,n){let o=this.length;return this.resize(o+1),this.emplace(o,i,r,a,n)}emplace(i,r,a,n,o){let s=4*i;return this.float32[s+0]=r,this.float32[s+1]=a,this.float32[s+2]=n,this.float32[s+3]=o,i}}oH.prototype.bytesPerElement=16,nl(oH,"StructArrayLayout4f16");class o$ extends oI{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(i){let r=this.length;return this.resize(r+1),this.emplace(r,i)}emplace(i,r){return this.uint32[+i+0]=r,i}}
7o$.prototype.bytesPerElement=4,nl(o$,"StructArrayLayout1ul4");class oq extends oI{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i,r){let a=this.length;return this.resize(a+1),this.emplace(a,i,r)}emplace(i,r,a){let n=2*i;return this.uint16[n+0]=r,this.uint16[n+1]=a,i}}oq.prototype.bytesPerElement=4,nl(oq,"StructArrayLayout2ui4");class oZ extends oI{_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(i,r,a,n,o,s,l,h,u,c,d,p,f){let m=this.length;return this.resize(m+1),this.emplace(m,i,r,a,n,o,s,l,h,u,c,d,p,f)}emplace(i,r,a,n,o,s,l,h,u,c,d,p,f,m){let _=20*i,g=10*i;return this.int16[_+0]=r,this.int16[_+1]=a,this.int16[_+2]=n,this.int16[_+3]=o,this.int16[_+4]=s,this.float32[g+3]=l,this.float32[g+4]=h,this.float32[g+5]=u,this.float32[g+6]=c,this.int16[_+14]=d,this.uint32[g+8]=p,this.uint16[_+18]=f,this.uint16[_+19]=m,i}}oZ.prototype.bytesPerElement=40,nl(oZ,"StructArrayLayout5i4f1i1ul2ui40");class oW extends oI{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,r,a,n,o,s,l){let h=this.length;return this.resize(h+1),this.emplace(h,i,r,a,n,o,s,l)}emplace(i,r,a,n,o,s,l,h){let u=8*i;return this.int16[u+0]=r,this.int16[u+1]=a,this.int16[u+2]=n,this.int16[u+4]=o,this.int16[u+5]=s,this.int16[u+6]=l,this.int16[u+7]=h,i}}oW.prototype.bytesPerElement=16,nl(oW,"StructArrayLayout3i2i2i16");class oX extends oI{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i,r,a,n,o){let s=this.length;return this.resize(s+1),this.emplace(s,i,r,a,n,o)}emplace(i,r,a,n,o,s){let l=4*i,h=8*i;return this.float32[l+0]=r,this.float32[l+1]=a,this.float32[l+2]=n,this.int16[h+6]=o,this.int16[h+7]=s,i}}oX.prototype.bytesPerElement=16,nl(oX,"StructArrayLayout2f1f2i16");class oY extends oI{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,r,a,n,o,s){let l=this.length;return this.resize(l+1),this.emplace(l,i,r,a,n,o,s)}emplace(i,r,a,n,o,s,l){let h=20*i,u=5*i;return this.uint8[h+0]=r,this.uint8[h+1]=a,this.float32[u+1]=n,this.float32[u+2]=o,this.float32[u+3]=s,this.float32[u+4]=l,i}}oY.prototype.bytesPerElement=20,nl(oY,"StructArrayLayout2ub4f20");class oJ extends oI{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i,r,a){let n=this.length;return this.resize(n+1),this.emplace(n,i,r,a)}emplace(i,r,a,n){let o=3*i;return this.uint16[o+0]=r,this.uint16[o+1]=a,this.uint16[o+2]=n,i}}oJ.prototype.bytesPerElement=6,nl(oJ,"StructArrayLayout3ui6");class oK extends oI{_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(i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w){let T=this.length;return this.resize(T+1),this.emplace(T,i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w)}emplace(i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w,T){let S=30*i,E=15*i,I=60*i;return this.int16[S+0]=r,this.int16[S+1]=a,this.int16[S+2]=n,this.float32[E+2]=o,this.float32[E+3]=s,this.uint16[S+8]=l,this.uint16[S+9]=h,this.uint32[E+5]=u,this.uint32[E+6]=c,this.uint32[E+7]=d,this.uint16[S+16]=p,this.uint16[S+17]=f,this.uint16[S+18]=m,this.float32[E+10]=_,this.float32[E+11]=g,this.uint8[I+48]=y,this.uint8[I+49]=x,this.uint8[I+50]=v,this.uint32[E+13]=b,this.int16[S+28]=w,this.uint8[I+58]=T,i}}oK.prototype.bytesPerElement=60,nl(oK,"StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60");class oQ extends oI{_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(i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w,T,S,E,I,A,M,C,P,D,R,z,L){let F=this.length;return this.resize(F+1),this.emplace(F,i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w,T,S,E,I,A,M,C,P,D,R,z,L)}emplace(i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w,T,S,E,I,A,M,C,P,D,R,z,L,F){let O=20*i,B=40*i;return this.float32[O+0]=r,this.float32[O+1]=a,this.int16[B+4]=n,this.int16[B+5]=o,this.int16[B+6]=s,this.int16[B+7]=l,this.int16[B+8]=h,this.int16[B+9]=u,this.int16[B+10]=c,this.int16[B+11]=d,this.int16[B+12]=p,this.uint16[B+13]=f,this.uint16[B+14]=m,this.uint16[B+15]=_,this.uint16[B+16]=g,this.uint16[B+17]=y,this.uint16[B+18]=x,this.uint16[B+19]=v,this.uint16[B+20]=b,this.uint16[B+21]=w,this.uint16[B+22]=T,this.uint16[B+23]=S,this.uint16[B+24]=E,this.uint16[B+25]=I,this.uint16[B+26]=A,this.uint16[B+27]=M,this.uint32[O+14]=C,this.float32[O+15]=P,this.float32[O+16]=D,this.float32[O+17]=R,this.float32[O+18]=z,this.uint8[80*i+76]=L,this.uint16[B+39]=F,i}}oQ.prototype.bytesPerElement=80,nl(oQ,"StructArrayLayout2f9i15ui1ul4f1ub1ui80");class o0 extends oI{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,r,a,n,o,s){let l=this.length;return this.resize(l+1),this.emplace(l,i,r,a,n,o,s)}emplace(i,r,a,n,o,s,l){let h=6*i;return this.float32[h+0]=r,this.float32[h+1]=a,this.float32[h+2]=n,this.float32[h+3]=o,this.float32[h+4]=s,this.float32[h+5]=l,i}}o0.prototype.bytesPerElement=24,nl(o0,"StructArrayLayout6f24");class o1 extends oI{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,r,a,n,o){let s=this.length;return this.resize(s+1),this.emplace(s,i,r,a,n,o)}emplace(i,r,a,n,o,s){let l=5*i;return this.float32[l+0]=r,this.float32[l+1]=a,this.float32[l+2]=n,this.float32[l+3]=o,this.float32[l+4]=s,i}}o1.prototype.bytesPerElement=20,nl(o1,"StructArrayLayout5f20");class o2 extends oI{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,r,a,n,o,s,l){let h=this.length;return this.resize(h+1),this.emplace(h,i,r,a,n,o,s,l)}emplace(i,r,a,n,o,s,l,h){let u=7*i;return this.float32[u+0]=r,this.float32[u+1]=a,this.float32[u+2]=n,this.float32[u+3]=o,this.float32[u+4]=s,this.float32[u+5]=l,this.float32[u+6]=h,i}}o2.prototype.bytesPerElement=28,nl(o2,"StructArrayLayout7f28");class o3 extends oI{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,r,a,n,o,s,l,h,u,c,d){let p=this.length;return this.resize(p+1),this.emplace(p,i,r,a,n,o,s,l,h,u,c,d)}emplace(i,r,a,n,o,s,l,h,u,c,d,p){let f=11*i;return this.float32[f+0]=r,this.float32[f+1]=a,this.float32[f+2]=n,this.float32[f+3]=o,this.float32[f+4]=s,this.float32[f+5]=l,this.float32[f+6]=h,this.float32[f+7]=u,this.float32[f+8]=c,this.float32[f+9]=d,this.float32[f+10]=p,i}}o3.prototype.bytesPerElement=44,nl(o3,"StructArrayLayout11f44");class o5 extends oI{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,r,a,n,o,s,l,h,u){let c=this.length;return this.resize(c+1),this.emplace(c,i,r,a,n,o,s,l,h,u)}emplace(i,r,a,n,o,s,l,h,u,c){let d=9*i;return this.float32[d+0]=r,this.float32[d+1]=a,this.float32[d+2]=n,this.float32[d+3]=o,this.float32[d+4]=s,this.float32[d+5]=l,this.float32[d+6]=h,this.float32[d+7]=u,this.float32[d+8]=c,i}}
7o5.prototype.bytesPerElement=36,nl(o5,"StructArrayLayout9f36");class o4 extends oI{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,r){let a=this.length;return this.resize(a+1),this.emplace(a,i,r)}emplace(i,r,a){let n=2*i;return this.float32[n+0]=r,this.float32[n+1]=a,i}}o4.prototype.bytesPerElement=8,nl(o4,"StructArrayLayout2f8");class o6 extends oI{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i,r,a,n){let o=this.length;return this.resize(o+1),this.emplace(o,i,r,a,n)}emplace(i,r,a,n,o){let s=6*i;return this.uint32[3*i+0]=r,this.uint16[s+2]=a,this.uint16[s+3]=n,this.uint16[s+4]=o,i}}o6.prototype.bytesPerElement=12,nl(o6,"StructArrayLayout1ul3ui12");class o8 extends oI{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(i){let r=this.length;return this.resize(r+1),this.emplace(r,i)}emplace(i,r){return this.uint16[+i+0]=r,i}}o8.prototype.bytesPerElement=2,nl(o8,"StructArrayLayout1ui2");class o9 extends oI{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g){let y=this.length;return this.resize(y+1),this.emplace(y,i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g)}emplace(i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y){let x=16*i;return this.float32[x+0]=r,this.float32[x+1]=a,this.float32[x+2]=n,this.float32[x+3]=o,this.float32[x+4]=s,this.float32[x+5]=l,this.float32[x+6]=h,this.float32[x+7]=u,this.float32[x+8]=c,this.float32[x+9]=d,this.float32[x+10]=p,this.float32[x+11]=f,this.float32[x+12]=m,this.float32[x+13]=_,this.float32[x+14]=g,this.float32[x+15]=y,i}}o9.prototype.bytesPerElement=64,nl(o9,"StructArrayLayout16f64");class o7 extends oI{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(i,r,a,n,o,s,l){let h=this.length;return this.resize(h+1),this.emplace(h,i,r,a,n,o,s,l)}emplace(i,r,a,n,o,s,l,h){let u=10*i,c=5*i;return this.uint16[u+0]=r,this.uint16[u+1]=a,this.uint16[u+2]=n,this.uint16[u+3]=o,this.float32[c+2]=s,this.float32[c+3]=l,this.float32[c+4]=h,i}}o7.prototype.bytesPerElement=20,nl(o7,"StructArrayLayout4ui3f20");class se extends oI{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(i){let r=this.length;return this.resize(r+1),this.emplace(r,i)}emplace(i,r){return this.int16[+i+0]=r,i}}se.prototype.bytesPerElement=2,nl(se,"StructArrayLayout1i2");class st extends oI{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer)}emplaceBack(i){let r=this.length;return this.resize(r+1),this.emplace(r,i)}emplace(i,r){return this.uint8[+i+0]=r,i}}st.prototype.bytesPerElement=1,nl(st,"StructArrayLayout1ub1");class si extends oS{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]}}si.prototype.size=40;class sr extends oZ{get(i){return new si(this,i)}}nl(sr,"CollisionBoxArray");class sa extends oS{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: 6,452 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(i){this._structArray.uint8[this._pos1+49]=i}get hidden(){return this._structArray.uint8[this._pos1+50]}set hidden(i){this._structArray.uint8[this._pos1+50]=i}get crossTileID(){return this._structArray.uint32[this._pos4+13]}set crossTileID(i){this._structArray.uint32[this._pos4+13]=i}get associatedIconIndex(){return this._structArray.int16[this._pos2+28]}get flipState(){return this._structArray.uint8[this._pos1+58]}set flipState(i){this._structArray.uint8[this._pos1+58]=i}}sa.prototype.size=60;class sn extends oK{get(i){return new sa(this,i)}}nl(sn,"PlacedSymbolArray");class so extends oS{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(i){this._structArray.uint32[this._pos4+14]=i}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(i){this._structArray.float32[this._pos4+18]=i}get hasIconTextFit(){return this._structArray.uint8[this._pos1+76]}get elevationFeatureIndex(){return this._structArray.uint16[this._pos2+39]}}so.prototype.size=80;class ss extends oQ{get(i){return new so(this,i)}}nl(ss,"SymbolInstanceArray");class sl extends oR{getoffsetX(i){return this.float32[+i+0]}}nl(sl,"GlyphOffsetArray");class sh extends oC{getx(i){return this.int16[2*i+0]}gety(i){return this.int16[2*i+1]}}nl(sh,"SymbolLineVertexArray");class su extends oS{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]}}su.prototype.size=12;class sc extends o6{get(i){return new su(this,i)}}nl(sc,"FeatureIndexArray");class sd extends oq{geta_centroid_pos0(i){return this.uint16[2*i+0]}geta_centroid_pos1(i){return this.uint16[2*i+1]}}nl(sd,"FillExtrusionCentroidArray");class sp extends oS{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]}}sp.prototype.size=6;class sf extends oP{get(i){return new sp(this,i)}}nl(sf,"FillExtrusionWallArray");let sm=oA([{name:"a_pos",components:2,type:"Int16"}],4),s_=oA([{name:"a_circle_z_offset",components:1,type:"Float32"}],4),sg=oA([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]);class sy{constructor(i=[]){this.segments=i}_prepareSegment(i,r,a,n,o){let s=this.segments.at(-1);return i>sy.MAX_VERTEX_ARRAY_LENGTH&&tw(`Max vertices per segment is ${sy.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${i}`),(!s||s.vertexLength+i>sy.MAX_VERTEX_ARRAY_LENGTH||s.sortKey!==n||void 0!==o&&s&&void 0!==s.batchIndex&&s.batchIndex!==o)&&(s={vertexOffset:r,primitiveOffset:a,vertexLength:0,primitiveLength:0},void 0!==n&&(s.sortKey=n),void 0!==o&&(s.batchIndex=o),this.segments.push(s)),s}prepareSegment(i,r,a,n,o){return this._prepareSegment(i,r.length,a.length,n,o)}get(){return this.segments}destroy(){for(let i of this.segments)for(let r in i.vaos)i.vaos[r].destroy()}static simpleSegment(i,r,a,n){return new sy([{vertexOffset:i,primitiveOffset:r,vertexLength:a,primitiveLength:n,vaos:{},sortKey:0}])}}function sx(i,r){return 256*(i=tl(Math.floor(i),0,255))+tl(Math.floor(r),0,255)}sy.MAX_VERTEX_ARRAY_LENGTH=65535,nl(sy,"SegmentVector");let sv=oA([{name:"a_pattern",components:4,type:"Uint16"},{name:"a_pixel_ratio",components:1,type:"Float32"}]),sb=oA([{name:"a_pattern_b",components:4,type:"Uint16"}]),sw=oA([{name:"a_dash",components:4,type:"Uint16"}]);class sT{constructor(){this.ids=[],this.uniqueIds=[],this.positions=[],this.indexed=!1}
7add(i,r,a,n){this.ids.push(sS(i)),this.positions.push(r,a,n)}eachPosition(i,r){let a=sS(i),n=0,o=this.ids.length-1;for(;n<o;){let i=n+o>>1;this.ids[i]>=a?o=i:n=i+1}for(;this.ids[n]===a;)r(this.positions[3*n],this.positions[3*n+1],this.positions[3*n+2]),n++}static serialize(i,r){let a=new Float64Array(i.ids),n=new Uint32Array(i.positions);return function i(r,a,n,o){for(;n<o;){let s=r[n+o>>1],l=n-1,h=o+1;for(;;){do l++;while(r[l]<s);do h--;while(r[h]>s);if(l>=h)break;sE(r,l,h),sE(a,3*l,3*h),sE(a,3*l+1,3*h+1),sE(a,3*l+2,3*h+2)}h-n<o-h?(i(r,a,n,h),n=h+1):(i(r,a,h+1,o),o=h)}}(a,n,0,a.length-1),r&&(r.add(a.buffer),r.add(n.buffer)),{ids:a,positions:n}}static deserialize(i){let r,a=new sT;for(let n of(a.ids=i.ids,a.positions=i.positions,a.ids))n!==r&&a.uniqueIds.push(n),r=n;return a.indexed=!0,a}}function sS(i){let r=+i;return Number.isSafeInteger(r)?r:im(String(i))}function sE(i,r,a){let n=i[r];i[r]=i[a],i[a]=n}nl(sT,"FeaturePositionMap");class sI{constructor(i){this.gl=i.gl,this.initialized=!1}fetchUniformLocation(i,r){return this.location||this.initialized||(this.location=this.gl.getUniformLocation(i,r),this.initialized=!0),!!this.location}set(i,r,a){throw Error("Uniform#set() must be implemented by each concrete Uniform")}}class sA extends sI{constructor(i){super(i),this.current=0}set(i,r,a){this.fetchUniformLocation(i,r)&&this.current!==a&&(this.current=a,this.gl.uniform1i(this.location,a))}}class sM extends sI{constructor(i){super(i),this.current=0}set(i,r,a){this.fetchUniformLocation(i,r)&&this.current!==a&&(this.current=a,this.gl.uniform1f(this.location,a))}}class sC extends sI{constructor(i){super(i),this.current=[0,0]}set(i,r,a){this.fetchUniformLocation(i,r)&&(a[0]===this.current[0]&&a[1]===this.current[1]||(this.current=a,this.gl.uniform2f(this.location,a[0],a[1])))}}class sP extends sI{constructor(i){super(i),this.current=[0,0,0]}set(i,r,a){this.fetchUniformLocation(i,r)&&(a[0]===this.current[0]&&a[1]===this.current[1]&&a[2]===this.current[2]||(this.current=a,this.gl.uniform3f(this.location,a[0],a[1],a[2])))}}class sD extends sI{constructor(i){super(i),this.current=[0,0,0,0]}set(i,r,a){this.fetchUniformLocation(i,r)&&(a[0]===this.current[0]&&a[1]===this.current[1]&&a[2]===this.current[2]&&a[3]===this.current[3]||(this.current=a,this.gl.uniform4ui(this.location,a[0],a[1],a[2],a[3])))}}class sR extends sI{constructor(i){super(i),this.current=[0,0,0,0]}set(i,r,a){this.fetchUniformLocation(i,r)&&(a[0]===this.current[0]&&a[1]===this.current[1]&&a[2]===this.current[2]&&a[3]===this.current[3]||(this.current=a,this.gl.uniform4f(this.location,a[0],a[1],a[2],a[3])))}}class sz extends sI{constructor(i){super(i),this.current=iI.transparent.toPremultipliedRenderColor(null)}set(i,r,a){this.fetchUniformLocation(i,r)&&(a.r===this.current.r&&a.g===this.current.g&&a.b===this.current.b&&a.a===this.current.a||(this.current=a,this.gl.uniform4f(this.location,a.r,a.g,a.b,a.a)))}}class sL extends sI{constructor(i){super(i),this.current=new Float32Array(16)}set(i,r,a){if(!this.fetchUniformLocation(i,r))return;let n=this.current;if(a[12]!==n[12]||a[0]!==n[0])return n.set(a),void this.gl.uniformMatrix4fv(this.location,!1,n);for(let i=1;i<16;i++)if(a[i]!==n[i]){n.set(a),this.gl.uniformMatrix4fv(this.location,!1,n);break}}}class sF extends sI{constructor(i){super(i),this.current=new Float32Array(4)}set(i,r,a){if(!this.fetchUniformLocation(i,r))return;let n=this.current;for(let i=0;i<4;i++)if(a[i]!==n[i]){n.set(a),this.gl.uniformMatrix2fv(this.location,!1,n);break}}}function sO(i){return[sx(255*i.r,255*i.g),sx(255*i.b,255*i.a)]}function sB(i,r,a,n,o,s,l,h){return!!i&&("composite"===i.kind||"source"===i.kind?"none"===i.evaluate(new n0(0,{brightness:s,worldview:h}),r,a,o,n,l):"none"===i.value)}class sk{constructor(i,r,a,n){this.value=i,this.uniformNames=r.map(i=>`u_${i}`),this.type=a,this.context=n}setUniform(i,r,a,n,o){let s=n.constantOr(this.value);r.set(i,o,s instanceof iI?s.toPremultipliedRenderColor(this.lutExpression&&"constant"===this.lutExpression.kind&&"none"===this.lutExpression.value?null:this.context.lut):s)}getBinding(i,r){return"color"===this.type?new sz(i):new sM(i)}}class sN{constructor(i,r){this.uniformNames=r.map(i=>`u_${i}`),this.pattern=null,this.patternTransition=null,this.pixelRatio=1}setConstantPatternPositions(i,r){this.pixelRatio=i.pixelRatio||1,this.pattern=i.tl.concat(i.br),this.patternTransition=r?r.tl.concat(r.br):this.pattern}setUniform(i,r,a,n,o){let s=null;"u_pattern"!==o&&"u_dash"!==o||(s=this.pattern),"u_pattern_b"===o&&(s=this.patternTransition),"u_pixel_ratio"===o&&(s=this.pixelRatio),s&&r.set(i,o,s)}getBinding(i,r){return"u_pattern"===r||"u_pattern_b"===r||"u_dash"===r?new sD(i):new sM(i)}}class sU{constructor(i,r,a,n){this.expression=i,this.type=a,this.maxValue=0,this.paintVertexAttributes=r.map(i=>({name:`a_${i}`,type:"Float32",components:"color"===a?2:1,offset:0})),this.paintVertexArray=new n}populatePaintArray(i,r,a,n,o,s,l,h){let u=this.paintVertexArray.length,c="composite"===this.expression.kind||"source"===this.expression.kind?this.expression.evaluate(new n0(0,{brightness:s,worldview:h}),r,{},o,n,l):"constant"===this.expression.kind&&this.expression.value,d=sB(this.lutExpression,r,{},n,o,s,l,h);this.paintVertexArray.resize(i),this._setPaintValue(u,i,c,d?null:this.context.lut)}updatePaintArray(i,r,a,n,o,s,l,h){let u="composite"===this.expression.kind||"source"===this.expression.kind?this.expression.evaluate({zoom:0,brightness:l,worldview:h},a,n,void 0,o):"constant"===this.expression.kind&&this.expression.value,c=sB(this.lutExpression,a,n,o,void 0,l,void 0,h);this._setPaintValue(i,r,u,c?null:this.context.lut)}_setPaintValue(i,r,a,n){if("color"===this.type){let o=sO(a.toPremultipliedRenderColor(n));for(let a=i;a<r;a++)this.paintVertexArray.emplace(a,o[0],o[1])}else{for(let n=i;n<r;n++)this.paintVertexArray.emplace(n,a);
7this.maxValue=Math.max(this.maxValue,Math.abs(a))}}upload(i){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=i.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.lutExpression&&"constant"!==this.lutExpression.kind&&(this.lutExpression.isStateDependent||!this.lutExpression.isLightConstant)||"constant"!==this.expression.kind&&(this.expression.isStateDependent||!this.expression.isLightConstant)))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class sV{constructor(i,r,a,n,o,s){this.expression=i,this.uniformNames=r.map(i=>`u_${i}_t`),this.type=a,this.useIntegerZoom=n,this.context=o,this.maxValue=0,this.paintVertexAttributes=r.map(i=>({name:`a_${i}`,type:"Float32",components:"color"===a?4:2,offset:0})),this.paintVertexArray=new s}populatePaintArray(i,r,a,n,o,s,l,h){let u=this.expression.evaluate(new n0(this.context.zoom,{brightness:s,worldview:h}),r,{},o,n,l),c=this.expression.evaluate(new n0(this.context.zoom+1,{brightness:s,worldview:h}),r,{},o,n,l),d=sB(this.lutExpression,r,{},n,o,s,l,h),p=this.paintVertexArray.length;this.paintVertexArray.resize(i),this._setPaintValue(p,i,u,c,d?null:this.context.lut)}updatePaintArray(i,r,a,n,o,s,l,h){let u=this.expression.evaluate({zoom:this.context.zoom,brightness:l,worldview:h},a,n,void 0,o),c=this.expression.evaluate({zoom:this.context.zoom+1,brightness:l,worldview:h},a,n,void 0,o),d=sB(this.lutExpression,a,n,o,void 0,l,void 0,h);this._setPaintValue(i,r,u,c,d?null:this.context.lut)}_setPaintValue(i,r,a,n,o){if("color"===this.type){let s=sO(a.toPremultipliedRenderColor(o)),l=sO(n.toPremultipliedRenderColor(o));for(let a=i;a<r;a++)this.paintVertexArray.emplace(a,s[0],s[1],l[0],l[1])}else{for(let o=i;o<r;o++)this.paintVertexArray.emplace(o,a,n);this.maxValue=Math.max(this.maxValue,Math.abs(a),Math.abs(n))}}upload(i){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=i.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent||!this.expression.isLightConstant))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(i,r,a,n,o){let s=this.useIntegerZoom?Math.floor(a.zoom):a.zoom,l=tl(this.expression.interpolationFactor(s,this.context.zoom,this.context.zoom+1),0,1);r.set(i,o,l)}getBinding(i,r){return new sM(i)}}class sj{constructor(i,r,a,n,o){this.expression=i,this.layerId=o,this.paintVertexAttributes=("array"===a?sw:sv).members;for(let i=0;i<r.length;++i);this.paintVertexArray=new n,this.paintTransitionVertexArray=new oU}populatePaintArray(i,r,a,n){let o=this.paintVertexArray.length;this.paintVertexArray.resize(i),this._setPaintValues(o,i,r.patterns&&r.patterns[this.layerId],a)}updatePaintArray(i,r,a,n,o,s,l){this._setPaintValues(i,r,a.patterns&&a.patterns[this.layerId],s)}_setPaintValues(i,r,a,n){if(!n||!a)return;let o=n[a[0]],s=n[a[1]];if(o){if(o){let{tl:a,br:n,pixelRatio:s}=o;for(let o=i;o<r;o++)this.paintVertexArray.emplace(o,a[0],a[1],n[0],n[1],s)}if(s){this.paintTransitionVertexArray.resize(this.paintVertexArray.length);let{tl:a,br:n}=s;for(let o=i;o<r;o++)this.paintTransitionVertexArray.emplace(o,a[0],a[1],n[0],n[1])}}}upload(i){let r=this.expression.isStateDependent||!this.expression.isLightConstant;this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer=i.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,r)),this.paintTransitionVertexArray&&this.paintTransitionVertexArray.length&&(this.paintTransitionVertexBuffer=i.createVertexBuffer(this.paintTransitionVertexArray,sb.members,r))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy(),this.paintTransitionVertexBuffer&&this.paintTransitionVertexBuffer.destroy()}}class sG{constructor(i,r,a=()=>!0){this.binders={},this._buffers=[],this.context=r;let n=[];for(let o in i.paint._values){let s=i.paint.get(o);if(o.endsWith("-use-theme")||!a(o)||!(s instanceof n8&&aK(s.property.specification)))continue;let l=function(i,r){return s$[i]||[i.replace(`${r}
7-`,"").replace(/-/g,"_")]}(o,i.type),h=s.value,u=s.property.specification.type,c=!!s.property.useIntegerZoom,d="line-dasharray"===o||o.endsWith("pattern"),p=i.paint.get(`${o}-use-theme`),f="line-dasharray"===o&&"constant"!==i.layout.get("line-cap").value.kind||p&&"constant"!==p.value.kind;if("constant"!==h.kind||f)if("source"===h.kind||f||d){let r=sW(o,u,"source");this.binders[o]=d?new sj(h,l,u,r,i.id):new sU(h,l,u,r),n.push(`/a_${o}`)}else{let i=sW(o,u,"composite");this.binders[o]=new sV(h,l,u,c,r,i),n.push(`/z_${o}`)}else this.binders[o]=d?new sN(h.value,l):new sk(h.value,l,u,r),n.push(`/u_${o}`);p&&(this.binders[o].lutExpression=p.value)}this.cacheKey=n.sort().join("")}updateExpressions(i){for(let r in this.binders){let a=this.binders[r];(a instanceof sU||a instanceof sV||a instanceof sj)&&(a.expression=i.paint.get(r).value)}}getMaxValue(i){let r=this.binders[i];return r instanceof sU||r instanceof sV?r.maxValue:0}populatePaintArrays(i,r,a,n,o,s,l,h){for(let u in this.binders){let c=this.binders[u];c.context=this.context,(c instanceof sU||c instanceof sV||c instanceof sj)&&c.populatePaintArray(i,r,a,n,o,s,l,h)}}setConstantPatternPositions(i,r){for(let a in this.binders){let n=this.binders[a];n instanceof sN&&n.setConstantPatternPositions(i,r)}}getPatternTransitionVertexBuffer(i){let r=this.binders[i];return r instanceof sj?r.paintTransitionVertexBuffer:null}updatePaintArrays(i,r,a,n,o,s,l,h,u,c){let d=!1,p=Object.keys(i),f=0!==p.length&&!h,m=f?p:r.uniqueIds;for(let h in this.context.lut=o.lut,this.binders){let p=this.binders[h];if(p.context=this.context,(p instanceof sU||p instanceof sV||p instanceof sj)&&p.expression&&p.expression.kind&&"constant"!==p.expression.kind&&(!0===p.expression.isStateDependent||!1===p.expression.isLightConstant)){for(let a of(p.expression=o.paint.get(h).value,m)){let o=i[a.toString()];r.eachPosition(a,(i,r,a)=>{let h=n.feature(i);p.updatePaintArray(r,a,h,o,s,l,u,c)})}if(!f)for(let r of a.uniqueIds){let o=i[r.toString()];a.eachPosition(r,(i,r,a)=>{let h=n.feature(i);p.updatePaintArray(r,a,h,o,s,l,u,c)})}d=!0}}return d}defines(){let i=[];for(let r in this.binders){let a=this.binders[r];(a instanceof sk||a instanceof sN)&&i.push(...a.uniformNames.map(i=>`#define HAS_UNIFORM_${i}`))}return i}getPaintVertexBuffers(){return this._buffers}getUniforms(i){let r=[];for(let a in this.binders){let n=this.binders[a];if(n instanceof sk||n instanceof sN||n instanceof sV)for(let o of n.uniformNames)r.push({name:o,property:a,binding:n.getBinding(i,o)})}return r}setUniforms(i,r,a,n,o){for(let{name:r,property:s,binding:l}of a)this.binders[s].setUniform(i,l,o,n.get(s),r)}updatePaintBuffers(){for(let i in this._buffers=[],this.binders){let r=this.binders[i];(r instanceof sU||r instanceof sV||r instanceof sj)&&r.paintVertexBuffer&&this._buffers.push(r.paintVertexBuffer),r instanceof sj&&r.paintTransitionVertexBuffer&&this._buffers.push(r.paintTransitionVertexBuffer)}}upload(i){for(let r in this.binders){let a=this.binders[r];(a instanceof sU||a instanceof sV||a instanceof sj)&&a.upload(i)}this.updatePaintBuffers()}destroy(){for(let i in this.binders){let r=this.binders[i];(r instanceof sU||r instanceof sV||r instanceof sj)&&r.destroy()}}}class sH{constructor(i,r,a=()=>!0){for(let n of(this.programConfigurations={},i))this.programConfigurations[n.id]=new sG(n,r,a);this.needsUpload=!1,this._featureMap=new sT,this._featureMapWithoutIds=new sT,this._bufferOffset=0,this._idlessCounter=0}populatePaintArrays(i,r,a,n,o,s,l,h,u){for(let a in this.programConfigurations)this.programConfigurations[a].populatePaintArrays(i,r,n,o,s,l,h,u);void 0!==r.id?this._featureMap.add(r.id,a,this._bufferOffset,i):(this._featureMapWithoutIds.add(this._idlessCounter,a,this._bufferOffset,i),this._idlessCounter+=1),this._bufferOffset=i,this.needsUpload=!0}updatePaintArrays(i,r,a,n,o,s,l,h){for(let u of a)this.needsUpload=this.programConfigurations[u.id].updatePaintArrays(i,this._featureMap,this._featureMapWithoutIds,r,u,n,o,s,l||0,h)||this.needsUpload}get(i){return this.programConfigurations[i]}upload(i){if(this.needsUpload){for(let r in this.programConfigurations)this.programConfigurations[r].upload(i);this.needsUpload=!1}}destroy(){for(let i in this.programConfigurations)this.programConfigurations[i].destroy()}updateExpressions(i){let r=new Set;for(let a of i){let i=this.programConfigurations[a.id];i&&(i.updateExpressions(a),r.add(a.id))}for(let i in this.programConfigurations)r.has(i)||delete this.programConfigurations[i]}}let s$={"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-occlusion-opacity":["occlusion_opacity"],"icon-occlusion-opacity":["occlusion_opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-emissive-strength":["emissive_strength"],"icon-emissive-strength":["emissive_strength"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"symbol-z-offset":["z_offset"],"line-gap-width":["ga
7pwidth"],"line-pattern":["pattern","pixel_ratio","pattern_b"],"fill-pattern":["pattern","pixel_ratio","pattern_b"],"fill-extrusion-pattern":["pattern","pixel_ratio","pattern_b"],"line-dasharray":["dash"],"fill-bridge-guard-rail-color":["structure_color"],"fill-tunnel-structure-color":["structure_color"]},sq={"line-pattern":{source:oN,composite:oN},"fill-pattern":{source:oN,composite:oN},"fill-extrusion-pattern":{source:oN,composite:oN},"line-dasharray":{source:oU,composite:oU}},sZ={color:{source:o4,composite:oH},number:{source:oR,composite:o4}};function sW(i,r,a){let n=sq[i];return n&&n[a]||sZ[r][a]}nl(sk,"ConstantBinder"),nl(sN,"PatternConstantBinder"),nl(sU,"SourceExpressionBinder",{omit:["expression"]}),nl(sj,"PatternCompositeBinder",{omit:["expression"]}),nl(sV,"CompositeExpressionBinder",{omit:["expression"]}),nl(sG,"ProgramConfiguration",{omit:["_buffers"]}),nl(sH,"ProgramConfigurationSet");let sX=8192/Math.PI/2,sY=[64,32,16],sJ=-sX;function sK(i,r,a,n=sX){return[i*Math.sin(a*=e7)*n,-r*n,i*Math.cos(a)*n]}function sQ(i,r,a){return sK(Math.cos(i*e7),Math.sin(i*e7),r,a)}let s0=2*Math.PI*6371008.8;class s1{constructor(i,r){if(isNaN(i)||isNaN(r))throw Error(`Invalid LngLat object: (${i}, ${r})`);if(this.lng=+i,this.lat=+r,this.lat>90||this.lat<-90)throw Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new s1(tu(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(i){let r=Math.PI/180,a=this.lat*r,n=i.lat*r;return 6371008.8*Math.acos(Math.min(Math.sin(a)*Math.sin(n)+Math.cos(a)*Math.cos(n)*Math.cos((i.lng-this.lng)*r),1))}toBounds(i=0){let r=360*i/0x2637f09,a=r/Math.cos(Math.PI/180*this.lat);return new s2({lng:this.lng-a,lat:this.lat-r},{lng:this.lng+a,lat:this.lat+r})}toEcef(i){return sQ(this.lat,this.lng,sX+i*sX/6371008.8)}static convert(i){if(i instanceof s1)return i;if(Array.isArray(i)&&(2===i.length||3===i.length))return new s1(Number(i[0]),Number(i[1]));if(!Array.isArray(i)&&"object"==typeof i&&null!==i)return new s1(Number("lng"in i?i.lng:i.lon),Number(i.lat));throw 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 s2{constructor(i,r){i&&(r?this.setSouthWest(i).setNorthEast(r):Array.isArray(i)&&4===i.length?this.setSouthWest([i[0],i[1]]).setNorthEast([i[2],i[3]]):this.setSouthWest(i[0]).setNorthEast(i[1]))}setNorthEast(i){return this._ne=i instanceof s1?new s1(i.lng,i.lat):s1.convert(i),this}setSouthWest(i){return this._sw=i instanceof s1?new s1(i.lng,i.lat):s1.convert(i),this}extend(i){let r,a,n=this._sw,o=this._ne;if(i instanceof s1)r=i,a=i;else{if(!(i instanceof s2))return Array.isArray(i)?4===i.length||i.every(Array.isArray)?this.extend(s2.convert(i)):this.extend(s1.convert(i)):"object"==typeof i&&null!==i&&Object.hasOwn(i,"lat")&&(Object.hasOwn(i,"lon")||Object.hasOwn(i,"lng"))?this.extend(s1.convert(i)):this;if(r=i._sw,a=i._ne,!r||!a)return this}return n||o?(n.lng=Math.min(r.lng,n.lng),n.lat=Math.min(r.lat,n.lat),o.lng=Math.max(a.lng,o.lng),o.lat=Math.max(a.lat,o.lat)):(this._sw=new s1(r.lng,r.lat),this._ne=new s1(a.lng,a.lat)),this}getCenter(){return new s1((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 s1(this.getWest(),this.getNorth())}getSouthEast(){return new s1(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(i){let{lng:r,lat:a}=s1.convert(i),n=this._sw.lng<=r&&r<=this._ne.lng;return this._sw.lng>this._ne.lng&&(n=this._sw.lng>=r&&r>=this._ne.lng),this._sw.lat<=a&&a<=this._ne.lat&&n}static convert(i){if(i)return i instanceof s2?i:new s2(i)}}function s3(i){return s0*Math.cos(i*Math.PI/180)}function s5(i){return(180+i)/360}function s4(i){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i*Math.PI/360)))/360}function s6(i){return 360*i-180}function s8(i){return 360/Math.PI*Math.atan(Math.exp((180-360*i)*Math.PI/180)
7)-90}function s9(i,r){return i*s3(s8(r))}function s7(i){return Math.cos(tl(i,-85.051129,85.051129)*e7)}function le(i,r){let a=Math.pow(2,tl(r,0,25.5));return s7(i)*s0/(512*a)}function lt(i){return 1/Math.cos(i*Math.PI/180)}function li(i,r=0){let a=Math.exp(Math.PI*(1-(i.y+r/8192)/(1<<i.z)*2));return 0x4c6fe12*a/(a*a+1)/8192/(1<<i.z)}class lr{constructor(i,r,a=0){this.x=+i,this.y=+r,this.z=+a}static fromLngLat(i,r=0){let a=s1.convert(i);return new lr(s5(a.lng),s4(a.lat),r/s3(a.lat))}toLngLat(){return new s1(s6(this.x),s8(this.y))}toAltitude(){return s9(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/s0*lt(s8(this.y))}}function la(i,r,a){let n=i[0],o=n.x,s=n.y;r(n);let l=[n];for(let h=1;h<i.length;h++){let u=i[h],{x:c,y:d}=u;r(u),function i(r,a,n,o,s,l,h,u,c){let d=(a+o)/2,p=(n+s)/2,f=new e8(d,p);u(f),function(i,r,a,n,o,s){let l=a-o,h=n-s;return Math.abs((n-r)*l-(a-i)*h)/Math.hypot(l,h)}(f.x,f.y,l.x,l.y,h.x,h.y)>=c?(i(r,a,n,d,p,l,f,u,c),i(r,d,p,o,s,f,h,u,c)):r.push(h)}(l,o,s,c,d,n,u,r,a),o=c,s=d,n=u}return l}let ln=-16383-1;function lo(i,r,a){let n=i.loadGeometry(),o=i.extent,s=8192/o;if(r&&a&&a.projection.isReprojectedInTileSpace){let s=1<<r.z,{scale:l,x:h,y:u,projection:c}=a,d=i=>{let a=s6((r.x+i.x/o)/s),n=s8((r.y+i.y/o)/s),d=c.project(a,n);i.x=(d.x*l-h)*o,i.y=(d.y*l-u)*o};for(let r=0;r<n.length;r++)if(1!==i.type)n[r]=la(n[r],d,1);else{let i=[];for(let a of n[r])a.x<0||a.x>=o||a.y<0||a.y>=o||(d(a),i.push(a));n[r]=i}}for(let i of n)for(let r of i){var l=r,h=s;let i=Math.round(l.x*h),a=Math.round(l.y*h);l.x=tl(i,ln,16383),l.y=tl(a,ln,16383),(i<l.x||i>l.x+1||a<l.y||a>l.y+1)&&tw("Geometry exceeds allowed extent, reduce your vector tile buffer size")}return n}function ls(i,r){return{type:i.type,id:i.id,properties:i.properties,geometry:r?lo(i):[]}}class ll{constructor(i,r,a,n,o){this.properties={},this.extent=a,this.type=0,this.id=void 0,this._pbf=i,this._geometry=-1,this._keys=n,this._values=o,i.readFields(lh,this,r)}loadGeometry(){let i=this._pbf;i.pos=this._geometry;let r=i.readVarint()+i.pos,a=[],n,o=1,s=0,l=0,h=0;for(;i.pos<r;){if(s<=0){let r=i.readVarint();o=7&r,s=r>>3}if(s--,1===o||2===o)l+=i.readSVarint(),h+=i.readSVarint(),1===o&&(n&&a.push(n),n=[]),n&&n.push(new e8(l,h));else{if(7!==o)throw Error(`unknown command ${o}`);n&&n.push(n[0].clone())}}return n&&a.push(n),a}bbox(){let i=this._pbf;i.pos=this._geometry;let r=i.readVarint()+i.pos,a=1,n=0,o=0,s=0,l=1/0,h=-1/0,u=1/0,c=-1/0;for(;i.pos<r;){if(n<=0){let r=i.readVarint();a=7&r,n=r>>3}if(n--,1===a||2===a)o+=i.readSVarint(),s+=i.readSVarint(),o<l&&(l=o),o>h&&(h=o),s<u&&(u=s),s>c&&(c=s);else if(7!==a)throw Error(`unknown command ${a}`)}return[l,u,h,c]}toGeoJSON(i,r,a){let n,o=this.extent*Math.pow(2,a),s=this.extent*i,l=this.extent*r,h=this.loadGeometry();function u(i){return[360*(i.x+s)/o-180,360/Math.PI*Math.atan(Math.exp((1-2*(i.y+l)/o)*Math.PI))-90]}function c(i){return i.map(u)}if(1===this.type){let i=[];for(let r of h)i.push(r[0]);let r=c(i);n=1===i.length?{type:"Point",coordinates:r[0]}:{type:"MultiPoint",coordinates:r}}else if(2===this.type){let i=h.map(c);n=1===i.length?{type:"LineString",coordinates:i[0]}:{type:"MultiLineString",coordinates:i}}else{if(3!==this.type)throw Error("unknown feature type");{let i=function(i){let r,a,n=i.length;if(n<=1)return[i];let o=[];for(let s=0;s<n;s++){let n=function(i){let r=0;for(let a,n,o=0,s=i.length,l=s-1;o<s;l=o++)a=i[o],r+=((n=i[l]).x-a.x)*(a.y+n.y);return r}(i[s]);0!==n&&(void 0===a&&(a=n<0),a===n<0?(r&&o.push(r),r=[i[s]]):r&&r.push(i[s]))}return r&&o.push(r),o}(h),r=[];for(let a of i)r.push(a.map(c));n=1===r.length?{type:"Polygon",coordinates:r[0]}:{type:"MultiPolygon",coordinates:r}}}let d={type:"Feature",geometry:n,properties:this.properties};return null!=this.id&&(d.id=this.id),d}}function lh(i,r,a){1===i?r.id=a.readVarint():2===i?function(i,r){let a=i.readVarint()+i.pos;for(;i.pos<a;){let a=r._keys[i.readVarint()],n=r._values[i.readVarint()];r.properties[a]=n}}(a,r):3===i?r.type=a.readVarint():4===i&&(r._geometry=a.pos)}ll.types=["Unknown","Point","LineString","Polygon"];class lu{constructor(i,r){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=i,this._keys=[],this._values=[],this._features=[],i.readFields(lc,this,r),this.length=this._features.length}feature(i){if(i<0||i>=this._features.length)throw Error("feature index out of bounds");this._pbf.pos=this._features[i];let r=this._pbf.readVarint()+this._pbf.pos;return new ll(this._pbf,r,this.extent,this._keys,this._values)}}function lc(i,r,a){15===i?r.version=a.readVarint():1===i?r.name=a.readString():5===i?r.extent=a.readVarint():2===i?r._features.push(a.pos):3===i?r._keys.push(a.readString()):4===i&&r._values.push(function(i){let r=null,a=i.readVarint()+i.pos;for(;i.pos<a;){let a=i.readVarint()>>3;r=1===a?i.readString():2===a?i.readFloat():3===a?i.readDouble():4===a?i.readVarint64():5===a?i.readVarint():6===a?i.readSVarint():7===a?i.readBoolean():null}if(null==r)throw Error("unknown feature value");return r}(a))}class ld{constructor(i,r){this.layers=i.readFields(lp,{},r)}}function lp(i,r,a){if(3===i){let i=new lu(a,a.readVarint()+a.pos);i.length&&(r[i.name]=i)}}let lf="3d_elevation_id",lm="level";
7class l_{constructor(){this._valid=!1}reset(i){return this.feature=i,this._valid=!0,this._geometry=i.loadGeometry(),0!==this._geometry.length&&0!==this._geometry[0].length||(this._valid=!1),this}geometry(i,r){return this._valid&&i(r(this._geometry)),this}require(i,r,a){return this.get(i,!0,r,a)}optional(i,r,a){return this.get(i,!1,r,a)}success(){return this._valid}get(i,r,a,n){let o=Object.hasOwn(this.feature.properties,i)?+this.feature.properties[i]:void 0;return this._valid&&void 0!==o&&!Number.isNaN(o)?a(n?n(o):o):r&&(this._valid=!1),this}}class lg{constructor(i,r){this.featureFunc=i,this.vertexFunc=r}parseFeature(i,r,a){return this.featureFunc(i,r,a)}parseVertex(i,r,a){return this.vertexFunc(i,r,a)}}let ly=new lg((i,r,a)=>i.reset(r).require(lf,i=>{a.id=i}).optional("fixed_height_relative",i=>{a.constantHeight=i},lv.decodeRelativeHeight).geometry(i=>{a.bounds=i},rv).success(),(i,r,a)=>i.reset(r).require(lf,i=>{a.id=i}).require("elevation_idx",i=>{a.idx=i}).require("extent",i=>{a.extent=i}).require("height_relative",i=>{a.height=i},lv.decodeRelativeHeight).geometry(i=>{a.position=i},lv.getPoint).success()),lx=new lg((i,r,a)=>i.reset(r).require(lf,i=>{a.id=i}).optional("fixed_height",i=>{a.constantHeight=i},lv.decodeMetricHeight).geometry(i=>{a.bounds=i},rv).success(),(i,r,a)=>i.reset(r).require(lf,i=>{a.id=i}).require("elevation_idx",i=>{a.idx=i}).require("extent",i=>{a.extent=i}).require("height",i=>{a.height=i},lv.decodeMetricHeight).geometry(i=>{a.position=i},lv.getPoint).success());class lv{static getPoint(i){return eK(i[0][0].x,i[0][0].y)}static decodeRelativeHeight(i){return 1e-4*i*5}static decodeMetricHeight(i){return 1e-4*i}static getVersionSchema(i){return i?"1.0.1"===i?lx:void 0:ly}static parse(i){let r=[],a=[],n=i.length,o=new l_;for(let s=0;s<n;s++){let n=i.feature(s),l=n.properties.version,h=lv.getVersionSchema(l);if(void 0===h){tw(`Unknown elevation feature version number ${l||"(unknown)"}`);continue}let u=n.properties.type;if(!u)continue;let c=ll.types[n.type];if("Point"===c&&"curve_point"===u){let i={};h.parseVertex(o,n,i)&&r.push(i)}else if("Polygon"===c&&"curve_meta"===u){let i={};h.parseFeature(o,n,i)&&a.push(i)}}return{vertices:r,features:a}}}class lb{constructor(i,r){this.pos=i,this.dir=r}intersectsPlane(i,r,a){let n=e5(r,this.dir);if(1e-6>Math.abs(n))return!1;let o=((i[0]-this.pos[0])*r[0]+(i[1]-this.pos[1])*r[1])/n;return a[0]=this.pos[0]+this.dir[0]*o,a[1]=this.pos[1]+this.dir[1]*o,!0}}class lw{constructor(i,r){this.pos=i,this.dir=r}intersectsPlane(i,r,a){let n=eD(r,this.dir);if(1e-6>Math.abs(n))return!1;let o=((i[0]-this.pos[0])*r[0]+(i[1]-this.pos[1])*r[1]+(i[2]-this.pos[2])*r[2])/n;return a[0]=this.pos[0]+this.dir[0]*o,a[1]=this.pos[1]+this.dir[1]*o,a[2]=this.pos[2]+this.dir[2]*o,!0}closestPointOnSphere(i,r,a){var n,o,s,l,h,u,c;if(n=this.pos,o=n[0],s=n[1],l=n[2],h=i[0],u=i[1],c=i[2],Math.abs(o-h)<=1e-6*Math.max(1,Math.abs(o),Math.abs(h))&&Math.abs(s-u)<=1e-6*Math.max(1,Math.abs(s),Math.abs(u))&&Math.abs(l-c)<=1e-6*Math.max(1,Math.abs(l),Math.abs(c))||0===r)return a[0]=a[1]=a[2]=0,!1;let[d,p,f]=this.dir,m=this.pos[0]-i[0],_=this.pos[1]-i[1],g=this.pos[2]-i[2],y=d*d+p*p+f*f,x=2*(m*d+_*p+g*f),v=x*x-4*y*(m*m+_*_+g*g-r*r);if(v<0){let i=Math.max(-x/2,0),n=m+d*i,o=_+p*i,s=g+f*i,l=Math.hypot(n,o,s);return a[0]=n*r/l,a[1]=o*r/l,a[2]=s*r/l,!1}{let i=(-x-Math.sqrt(v))/(2*y);if(i<0){let i=Math.hypot(m,_,g);return a[0]=m*r/i,a[1]=_*r/i,a[2]=g*r/i,!1}return a[0]=m+d*i,a[1]=_+p*i,a[2]=g+f*i,!0}}}class lT{constructor(i,r,a,n,o){this.TL=i,this.TR=r,this.BR=a,this.BL=n,this.horizon=o}static fromInvProjectionMatrix(i,r,a){let n=[-1,1,1],o=[1,1,1],s=[1,-1,1],l=[-1,-1,1],h=eL(n,n,i),u=eL(o,o,i);return new lT(h,u,eL(s,s,i),eL(l,l,i),r/a)}}function lS(i,r,a,n){let o=r[0],s=r[1],l=r[2],h=a[0],u=a[1],c=a[2],d=1/0,p=-1/0;for(let r=0;r<i.length;r++){let a=i[r],n=(a[0]-o)*h+(a[1]-s)*u+(a[2]-l)*c;n<d&&(d=n),n>p&&(p=n)}return n[0]=d,n[1]=p,n}function lE(i,r){let a=!0;for(let n=0;n<i.planes.length;n++){let o=i.planes[n],s=0;for(let i=0;i<r.length;i++)s+=+(eD(o,r[i])+o[3]>=0);if(0===s)return 0;s!==r.length&&(a=!1)}return a?2:1}let lI=[0,0];function lA(i,r){for(let a of i.projections){let n=lS(r,i.points[0],a.axis,lI);if(a.projection[1]<n[0]||a.projection[0]>n[1])return 0}return 1}function lM(i,r){let a=r[0],n=r[1],o=r[2],s=r[3];for(let r=0;r<i.length;r++){let l=i[r];if(a*l[0]+n*l[1]+o*l[2]+s>=0)return!0}return!1}class lC{constructor(i,r){for(let a of(this.points=i||Array(8).fill([0,0,0]),this.planes=r||Array(6).fill([
70,0,0,0]),this.bounds=lP.fromPoints(this.points),this.projections=[],this.frustumEdges=[ev([],this.points[2],this.points[3]),ev([],this.points[0],this.points[3]),ev([],this.points[4],this.points[0]),ev([],this.points[5],this.points[1]),ev([],this.points[6],this.points[2]),ev([],this.points[7],this.points[3])],this.frustumEdges)){let i=[0,-a[2],a[1]],r=[a[2],0,-a[0]];this.projections.push({axis:i,projection:lS(this.points,this.points[0],i,[0,0])}),this.projections.push({axis:r,projection:lS(this.points,this.points[0],r,[0,0])})}}static fromInvProjectionMatrix(i,r,a,n){let o=Math.pow(2,a),s=[[-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(a=>{var s;let l=ej([],a,i),h=1/l[3]/r*o;return l[0]=l[0]*(s=[h,h,n?1/l[3]:h,h])[0],l[1]=l[1]*s[1],l[2]=l[2]*s[2],l[3]=l[3]*s[3],l}),l=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(i=>{let r=eP([],eR([],ev([],s[i[0]],s[i[1]]),ev([],s[i[2]],s[i[1]]))),a=-eD(r,s[i[1]]);return r.concat(a)}),h=[];for(let i=0;i<s.length;i++)h.push([s[i][0],s[i][1],s[i][2]]);return new lC(h,l)}intersectsPrecise(i,r,a){for(let a=0;a<r.length;a++)if(!lM(i,r[a]))return 0;for(let r=0;r<this.planes.length;r++)if(!lM(i,this.planes[r]))return 0;let n=this.points,o=n[0][0],s=n[0][1],l=n[0][2];for(let r of a)for(let a of this.frustumEdges){let h=r[1]*a[2]-r[2]*a[1],u=r[2]*a[0]-r[0]*a[2],c=r[0]*a[1]-r[1]*a[0];if(0===h&&0===u&&0===c)continue;let d=1/0,p=-1/0;for(let i=0;i<n.length;i++){let r=n[i],a=(r[0]-o)*h+(r[1]-s)*u+(r[2]-l)*c;a<d&&(d=a),a>p&&(p=a)}let f=1/0,m=-1/0;for(let r=0;r<i.length;r++){let a=i[r],n=(a[0]-o)*h+(a[1]-s)*u+(a[2]-l)*c;n<f&&(f=n),n>m&&(m=n)}if(d>m||f>p)return 0}return 1}containsPoint(i){for(let r of this.planes){let a=r[3];if(eD([r[0],r[1],r[2]],i)+a<0)return!1}return!0}}class lP{static fromPoints(i){let r=[1/0,1/0,1/0],a=[-1/0,-1/0,-1/0];for(let n of i)ew(r,r,n),eT(a,a,n);return new lP(r,a)}static fromTileIdAndHeight(i,r,a){let n=1<<i.canonical.z,o=i.canonical.x,s=i.canonical.y;return new lP([o/n,s/n,r],[(o+1)/n,(s+1)/n,a])}static applyTransform(i,r){let a=i.getCorners();for(let i=0;i<a.length;++i)eL(a[i],a[i],r);return lP.fromPoints(a)}static applyTransformFast(i,r){let a=[r[12],r[13],r[14]],n=[...a];for(let o=0;o<3;o++)for(let s=0;s<3;s++){let l=r[4*s+o],h=l*i.min[s],u=l*i.max[s];a[o]+=Math.min(h,u),n[o]+=Math.max(h,u)}return new lP(a,n)}static projectAabbCorners(i,r){let a=i.getCorners();for(let i=0;i<a.length;++i)eL(a[i],a[i],r);return a}constructor(i,r){this.min=i,this.max=r,this.center=eS([],ex([],this.min,this.max),.5)}quadrant(i){let r=[i%2==0,i<2],a=em(this.min),n=em(this.max);for(let i=0;i<r.length;i++)a[i]=r[i]?this.min[i]:this.center[i],n[i]=r[i]?this.center[i]:this.max[i];return n[2]=this.max[2],new lP(a,n)}distanceX(i){return Math.max(Math.min(this.max[0],i[0]),this.min[0])-i[0]}distanceY(i){return Math.max(Math.min(this.max[1],i[1]),this.min[1])-i[1]}distanceZ(i){return Math.max(Math.min(this.max[2],i[2]),this.min[2])-i[2]}getCorners(){let i=this.min,r=this.max;return[[i[0],i[1],i[2]],[r[0],i[1],i[2]],[r[0],r[1],i[2]],[i[0],r[1],i[2]],[i[0],i[1],r[2]],[r[0],i[1],r[2]],[r[0],r[1],r[2]],[i[0],r[1],r[2]]]}intersects(i){return this.intersectsAabb(i.bounds)?lE(i,this.getCorners()):0}intersectsFlat(i){return this.intersectsAabb(i.bounds)?lE(i,[[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(i,r){return r||this.intersects(i)?lA(i,this.getCorners()):0}intersectsPreciseFlat(i,r){return r||this.intersectsFlat(i)?lA(i,[[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(i){for(let r=0;r<3;++r)if(this.min[r]>i.max[r]||i.min[r]>this.max[r])return!1;return!0}intersectsAabbXY(i){return!(this.min[0]>i.max[0]||i.min[0]>this.max[0]||this.min[1]>i.max[1]||i.min[1]>this.max[1])}encapsulate(i){for(let r=0;r<3;r++)this.min[r]=Math.min(this.min[r],i.min[r]),this.max[r]=Math.max(this.max[r],i.max[r])}encapsulatePoint(i){for(let r=0;r<3;r++)this.min[r]=Math.min(this.min[r],i[r]),this.max[r]=Math.max(this.max[r],i[r])}closestPoint(i){return[Math.max(Math.min(this.max[0],i[0]),this.min[0]),Math.max(Math.min(this.max[1],i[1]),this.min[1]),Math.max(Math.min(this.max[2],i[2]),this.min[2])]}}nl(lP,"Aabb");class lD{constructor(i,r){this.feature=i,this.metersToTile=r,this.index=0}get(){let i=this.feature.vertices[this.index],r=this.feature.vertexProps[this.index].dir,a=r[1],n=-r[0],o=(i.extent+1)*this.metersToTile;return[new e8(Math.trunc(i.position[0]+a*o),Math.trunc(i.position[1]+n*o)),new e8(Math.trunc(i.position[0]-a
7*o),Math.trunc(i.position[1]-n*o))]}next(){this.index++}valid(){return this.index<this.feature.vertices.length}}class lR{constructor(i,r,a,n,o,s){if(this.vertices=[],this.vertexProps=[],this.edges=[],this.edgeProps=[],this._tmpVec2=[eJ(),eJ(),eJ(),eJ(),eJ(),eJ(),eJ()],this.id=i,this.heightRange={min:a,max:a},this.safeArea=r,this.constantHeight=a,null==this.constantHeight&&(null!=this.constantHeight||0!==n.length)){for(let i of(this.vertices=n,this.edges=o,this.edges=this.edges.filter(i=>{var r,a;return i.a<this.vertices.length&&i.b<this.vertices.length&&((r=this.vertices[i.a].position)[0]!==(a=this.vertices[i.b].position)[0]||r[1]!==a[1])}),this.heightRange={min:1/0,max:-1/0},this.vertices))this.vertexProps.push({dir:eK(0,0)}),this.heightRange.min=Math.min(this.heightRange.min,i.height),this.heightRange.max=Math.max(this.heightRange.max,i.height);for(let i of this.edges){let r=this.vertices[i.a].position,a=this.vertices[i.b].position,n=e0(eJ(),a,r),o=e2(n),s=e1(eJ(),n,1/o);this.edgeProps.push({vec:n,dir:s,len:o});let l=this.vertexProps[i.a].dir,h=this.vertexProps[i.b].dir;eQ(l,l,s),eQ(h,h,s)}for(let i of this.vertexProps)0===i.dir[0]&&0===i.dir[1]||e3(i.dir,i.dir);this.tessellate(s)}}pointElevation(i){if(null!=this.constantHeight)return this.constantHeight;let r=this.getClosestEdge(i);if(null==r)return 0;let[a,n]=r;return iE(this.vertices[this.edges[a].a].height,this.vertices[this.edges[a].b].height,n)}computeSlopeNormal(i,r){let a=this.getClosestEdge(i);if(!a)return eg(0,0,1);let n=a[0],o=this.edges[n],s=this.edgeProps[n].vec,l=eg(s[0],s[1],(this.vertices[o.b].height-this.vertices[o.a].height)*r),h=eg(l[1],-l[0],0);eR(h,h,l);let u=e_(h);return u>0?eS(h,h,1/u):ey(h,0,0,1)}getSafeArea(){return this.safeArea}isTunnel(){return this.heightRange.max<=-5}getClosestEdge(i){var r,a,n,o;if(0===this.edges.length)return;let s=0,l=1/0,h=0,[u,c,d,p,f,m,_]=this._tmpVec2;r=i.x,a=i.y,_[0]=r,_[1]=a;let g=new lb(_,null);for(let i=0;i<this.edges.length;i++){let r=this.edges[i],a=this.edgeProps[i].dir;g.dir=a;let y=this.vertices[r.a].position,x=this.vertices[r.b].position,v=g.intersectsPlane(y,this.vertexProps[r.a].dir,u),b=g.intersectsPlane(x,this.vertexProps[r.b].dir,c);if(!v||!b)continue;e0(d,c,u),e0(p,_,u);let w=e5(d,d),T=w>0?e5(p,d)/w:0,S=tl(T,0,1),E=Math.abs((T-S)*this.edgeProps[i].len);e0(f,_,y),n=a[1],o=-a[0],m[0]=n,m[1]=o;let I=E+Math.abs(e5(f,m));I<l&&(s=i,l=I,h=S)}return[s,h]}tessellate(i){let r=ef(),a=ef(),n=ef(),o=ef();for(let s=this.edges.length-1;s>=0;--s){let l=this.edges[s].a,h=this.edges[s].b,{position:u,height:c,extent:d}=this.vertices[l],{position:p,height:f,extent:m}=this.vertices[h],_=this.vertexProps[l].dir,g=this.vertexProps[h].dir;if(ey(r,u[0]/i,u[1]/i,c),ey(a,p[0]/i,p[1]/i,f),ey(n,_[1],-_[0],0),eS(n,n,d),ey(o,g[1],-g[0],0),eS(o,o,m),.0025000000000000005>=this.distSqLines(eg(r[0]+.5*n[0],r[1]+.5*n[1],r[2]+.5*n[2]),eg(a[0]-.5*o[0],a[1]-.5*o[1],a[2]-.5*o[2]),eg(r[0]-.5*n[0],r[1]-.5*n[1],r[2]-.5*n[2]),eg(a[0]+.5*o[0],a[1]+.5*o[1],a[2]+.5*o[2])))continue;let y=this.vertices.length,x=eQ(eJ(),u,p);this.vertices.push({position:e1(x,x,.5),height:.5*(c+f),extent:.5*(d+m)});let v=eQ(eJ(),_,g);this.vertexProps.push({dir:e3(v,v)}),this.edges.splice(s,1),this.edgeProps.splice(s,1),this.edges.push({a:l,b:y}),this.edges.push({a:y,b:h});let b=e0(eJ(),this.vertices[y].position,u),w=e2(b),T={vec:b,dir:e1(eJ(),b,1/w),len:w};this.edgeProps.push(T),this.edgeProps.push(T)}}distSqLines(i,r,a,n){let o=ev(ef(),r,i),s=ev(ef(),n,a),l=ev(ef(),i,a),h=eD(o,o),u=eD(o,s),c=eD(o,l),d=eD(s,s),p=eD(s,l),f=h*d-u*u;return 0===f?eA(ez(o,a,n,eD(l,s)/eD(s,s)),i):eA(ez(o,i,r,(u*p-c*d)/f),ez(s,a,n,(h*p-u*c)/f))}}class lz{static parseFrom(i,r){let a=lv.parse(i);if(!a)return[];let{vertices:n,features:o}=a,s=1/li(r);o.sort((i,r)=>i.id-r.id),n.sort((i,r)=>i.id-r.id||i.idx-r.idx);let l=[],h=0,u=(n=n.filter((i,r,a)=>r===a.findIndex(r=>
7r.id===i.id&&r.idx===i.idx))).length;for(let i of o){if(i.constantHeight){l.push(new lR(i.id,i.bounds,i.constantHeight));continue}for(;h!==u&&n[h].id<i.id;)h++;if(h===u||n[h].id!==i.id)continue;let r=[],a=[],o=h;for(;h!==u&&n[h].id===i.id;){let i=n[h];if(r.push({position:i.position,height:i.height,extent:i.extent}),h!==o&&n[h-1].idx===i.idx-1){let i=h-o;a.push({a:i-1,b:i})}h++}l.push(new lR(i.id,i.bounds,void 0,r,a,s))}return l}static getElevationFeature(i,r){if(!r)return;let a=+i.properties[lf];return Number.isNaN(a)?void 0:r.find(i=>i.id===a)}}class lL{constructor(i,r){this.zScale=1,this.xOffset=0,this.yOffset=0,i.equals(r)||(this.zScale=Math.pow(2,r.z-i.z),this.xOffset=(i.x*this.zScale-r.x)*8192,this.yOffset=(i.y*this.zScale-r.y)*8192)}constantElevation(i,r){if(null!=i.constantHeight)return this.computeBiasedHeight(i.constantHeight,r)}pointElevation(i,r,a){let n=this.constantElevation(r,a);return null!=n?n:(i.x=i.x*this.zScale+this.xOffset,i.y=i.y*this.zScale+this.yOffset,this.computeBiasedHeight(r.pointElevation(i),a))}computeBiasedHeight(i,r){return r<=0?i:i+r*th(0,r,i>=0?i:Math.abs(.5*i))}}nl(lR,"ElevationFeature");class lF{constructor(i){this.zoom=i.zoom,this.overscaling=i.overscaling,this.layers=i.layers,this.layerIds=this.layers.map(i=>i.fqid),this.index=i.index,this.hasPattern=!1,this.projection=i.projection,this.layoutVertexArray=new oC,this.indexArray=new oJ,this.segments=new sy,this.programConfigurations=new sH(i.layers,{zoom:i.zoom,lut:i.lut}),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.elevationMode=this.layers[0].layout.get("circle-elevation-reference"),this.hasElevation=!1,"none"!==this.elevationMode&&(this.elevatedLayoutVertexArray=new oR),this.worldview=i.worldview,this.hasAppearances=null}updateFootprints(i,r){}updateAppearances(i,r,a,n){return{hasLayoutChanges:!1,hasUboChanges:!1}}populate(i,r,a,n){let o=this.layers[0],s=[],l=null;for(let{feature:h,id:u,index:c,sourceLayerIndex:d}of("circle"===o.type&&(l=o.layout.get("circle-sort-key")),i)){let i=this.layers[0]._featureFilter.needGeometry,o=ls(h,i);if(!this.layers[0]._featureFilter.filter(new n0(this.zoom,{worldview:this.worldview,activeFloors:r.activeFloors}),o,a))continue;let p=l?l.evaluate(o,{},a):void 0,f={id:u,properties:h.properties,type:h.type,sourceLayerIndex:d,index:c,geometry:i?o.geometry:lo(h,a,n),patterns:{},sortKey:p};s.push(f)}l&&s.sort((i,r)=>i.sortKey-r.sortKey);let h=null;for(let o of("globe"===n.projection.name&&(this.globeExtVertexArray=new oV,h=n.projection),s)){let{geometry:n,index:s,sourceLayerIndex:l}=o,u=i[s].feature;this.addFeature(o,n,s,r.availableImages,a,h,r.brightness,r.elevationFeatures),r.featureIndex.insert(u,n,s,l,this.index)}this.hasElevation||(this.elevatedLayoutVertexArray=void 0)}update(i,r,a,n,o,s,l){this.programConfigurations.updatePaintArrays(i,r,o,a,n,s,l,this.worldview)}updateExpressions(i){this.programConfigurations.updateExpressions(i)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(i){this.uploaded||(this.layoutVertexBuffer=i.createVertexBuffer(this.layoutVertexArray,sm.members),this.indexBuffer=i.createIndexBuffer(this.indexArray),this.globeExtVertexArray&&(this.globeExtVertexBuffer=i.createVertexBuffer(this.globeExtVertexArray,sg.members)),this.elevatedLayoutVertexArray&&(this.elevatedLayoutVertexBuffer=i.createVertexBuffer(this.elevatedLayoutVertexArray,s_.members))),this.programConfigurations.upload(i),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(i,r,a,n,o,s,l,h){let u;for(let a of("none"!==this.elevationMode&&(u=lz.getElevationFeature(i,h)),r))for(let r of a){let a=r.x,n=r.y;if(a<0||a>=8192||n<0||n>=8192)continue;if(s){let i=s.projectTilePoint(a,n,o),r=s.upVector(o,a,n);this.addGlobeExtVertex(i,r),this.addGlobeExtVertex(i,r),this.addGlobeExtVertex(i,r),this.addGlobeExtVertex(i,r)}let l=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,i.sortKey),h=l.vertexLength;if(this.addCircleVertex(a,n,-1,-1),this.addCircleVertex(a,n,1,-1),this.addCircleVertex(a,n,1,1),this.addCircleVertex(a,n,-1,1),"none"!==this.elevationMode){let i=u?u.pointElevation(new e8(a,n)):0;this.hasElevation=this.hasElevation||0!==i;for(let r=0;r<4;r++)this.elevatedLayoutVertexArray.emplaceBack(i)}this.indexArray.emplaceBack(h,h+1,h+2),this.indexArray.emplaceBack(h,h+2,h+3),l.vertexLength+=4,l.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,i,a,{},n,o,l,void 0,this.worldview)}addCircleVertex(i,r,a,n){this.layoutVertexArray.emplaceBack(2*i+(a+1)/2,2*r+(n+1)/2)}addGlobeExtVertex(i,r){this.globeExtVertexArray.emplaceBack(i.x,i.y,i.z,16384*r[0],16384*r[1],16384*r[2])}}function lO(i,r){for(let a=0;a<i.length;a++)if(lG(r,i[a]))return!0;for(let a=0;a<r.length;a++)if(lG(i,r[a]))return!0;return!!lk(i,r)}function lB(i,r){if(1===i.length)return lj(r,i[0]);for(let a=0;a<r.length;a++){let n=r[a];for(let r=0;r<n.length;r++)if(lG(i,n[r]))return!0}for(let a=0;a<i.length;a++)if(lj(r,i[a]))return!0;for(let a=0;a<r.length;a++)if(lk(i,r[a]))return!0;return!1}function lk(i,r){if(0===i.length||0===r.length)return!1;for(let l=0;l<i.length-1;l++){let h=i[l],u=i[l+1];for(let i=0;i<r.length-1;i++){var a,n,o,s;
7if(a=h,n=u,o=r[i],tT(a,o,s=r[i+1])!==tT(n,o,s)&&tT(a,n,o)!==tT(a,n,s))return!0}}return!1}function lN(i,r,a){return(i.x-a.x)*(r.y-a.y)-(i.y-a.y)*(r.x-a.x)}function lU(i,r,a){let n=a*a;if(1===r.length)return i.distSqr(r[0])<n;for(let a=1;a<r.length;a++)if(lV(i,r[a-1],r[a])<n)return!0;return!1}function lV(i,r,a){let n=r.distSqr(a);if(0===n)return i.distSqr(r);let o=((i.x-r.x)*(a.x-r.x)+(i.y-r.y)*(a.y-r.y))/n;return i.distSqr(o<0?r:o>1?a:a.sub(r)._mult(o)._add(r))}function lj(i,r){let a,n,o,s=!1;for(let l=0;l<i.length;l++){a=i[l];for(let i=0,l=a.length-1;i<a.length;l=i++)n=a[i],o=a[l],n.y>r.y!=o.y>r.y&&r.x<(o.x-n.x)*(r.y-n.y)/(o.y-n.y)+n.x&&(s=!s)}return s}function lG(i,r){let a=!1;for(let n=0,o=i.length-1;n<i.length;o=n++){let s=i[n],l=i[o];s.y>r.y!=l.y>r.y&&r.x<(l.x-s.x)*(r.y-s.y)/(l.y-s.y)+s.x&&(a=!a)}return a}function lH(i,r,a,n,o){for(let s of i)if(r<=s.x&&a<=s.y&&n>=s.x&&o>=s.y)return!0;let s=[new e8(r,a),new e8(r,o),new e8(n,o),new e8(n,a)];if(i.length>2){for(let r of s)if(lG(i,r))return!0}for(let r=0;r<i.length-1;r++)if(l$(i[r],i[r+1],s))return!0;return!1}function l$(i,r,a){let n=a[0],o=a[2];if(i.x<n.x&&r.x<n.x||i.x>o.x&&r.x>o.x||i.y<n.y&&r.y<n.y||i.y>o.y&&r.y>o.y)return!1;let s=tT(i,r,a[0]);return s!==tT(i,r,a[1])||s!==tT(i,r,a[2])||s!==tT(i,r,a[3])}function lq(i,r,a,n,o,s){let l=r.y-i.y,h=i.x-r.x;if(s=s||0){let i=l*l+h*h;if(0===i)return!0;let r=Math.sqrt(i);l/=r,h/=r}return!((a.x-i.x)*l+(a.y-i.y)*h-s<0||(n.x-i.x)*l+(n.y-i.y)*h-s<0||(o.x-i.x)*l+(o.y-i.y)*h-s<0)}function lZ(i,r,a,n,o,s,l){return!(lq(i,r,n,o,s,l)||lq(r,a,n,o,s,l)||lq(a,i,n,o,s,l)||lq(n,o,i,r,a,l)||lq(o,s,i,r,a,l)||lq(s,n,i,r,a,l))}function lW(i,r,a){let n=r.paint.get(i).value;return"constant"===n.kind?n.value:a.programConfigurations.get(r.id).getMaxValue(i)}function lX(i){return Math.sqrt(i[0]*i[0]+i[1]*i[1])}function lY(i,r,a,n,o){if(!r[0]&&!r[1])return i;let s=e8.convert(r)._mult(o);"viewport"===a&&s._rotate(-n);let l=[];for(let r=0;r<i.length;r++)l.push(i[r].sub(s));return l}function lJ(i,r,a,n){let o=e8.convert(i)._mult(n);return"viewport"===r&&o._rotate(-a),o}nl(lF,"CircleBucket",{omit:["layers"]});class lK{constructor(i,r,a){this.z=i,this.x=r,this.y=a,this.key=l1(0,i,i,r,a)}equals(i){return this.z===i.z&&this.x===i.x&&this.y===i.y}isChildOf(i){let r=this.z-i.z;return 0===i.z||i.z<this.z&&i.x===this.x>>r&&i.y===this.y>>r}url(i,r){let a=function(i,r,a){let n=2**a,o=2*Math.PI*6378137,s=o*(i/n-.5),l=o*(.5-(r+1)/n);return`${s},${l},${s+o/n},${l+o/n}`}(this.x,this.y,this.z),n=function(i,r,a){let n,o="";for(let s=i;s>0;s--)o+=(r&(n=1<<s-1)?1:0)+(a&n?2:0);return o}(this.z,this.x,this.y);return i[(this.x+this.y)%i.length].replace("{prefix}",(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String("tms"===r?Math.pow(2,this.z)-this.y-1:this.y)).replace("{quadkey}",n).replace("{bbox-epsg-3857}",a)}toString(){return`${this.z}/${this.x}/${this.y}`}}class lQ{constructor(i,r){this.wrap=i,this.canonical=r,this.key=l1(i,r.z,r.z,r.x,r.y)}}class l0{constructor(i,r,a,n,o){this.overscaledZ=i,this.wrap=r,this.canonical=new lK(a,+n,+o),this.key=0===r&&i===a?this.canonical.key:l1(r,i,a,n,o)}equals(i){return this.overscaledZ===i.overscaledZ&&this.wrap===i.wrap&&this.canonical.equals(i.canonical)}scaledTo(i){let r=this.canonical.z-i;return i>this.canonical.z?new l0(i,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new l0(i,this.wrap,i,this.canonical.x>>r,this.canonical.y>>r)}calculateScaledKey(i,r=!0){if(this.overscaledZ===i&&r)return this.key;if(i>this.canonical.z)return l1(this.wrap*r,i,this.canonical.z,this.canonical.x,this.canonical.y);{let a=this.canonical.z-i;return l1(this.wrap*r,i,i,this.canonical.x>>a,this.canonical.y>>a)}}isChildOf(i){if(i.wrap!==this.wrap)return!1;let r=this.canonical.z-i.canonical.z;return 0===i.overscaledZ||i.overscaledZ<this.overscaledZ&&i.canonical.z<this.canonical.z&&i.canonical.x===this.canonical.x>>r&&i.canonical.y===this.canonical.y>>r}children(i){if(this.overscaledZ>=i)return[new l0(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];let r=this.canonical.z+1,a=2*this.canonical.x,n=2*this.canonical.y;return[new l0(r,this.wrap,r,a,n),new l0(r,this.wrap,r,a+1,n),new l0(r,this.wrap,r,a,n+1),new l0(r,this.wrap,r,a+1,n+1)]}isLessThan(i){return this.wrap<i.wrap||!(this.wrap>i.wrap)&&(this.overscaledZ<i.overscaledZ||!(this.overscaledZ>
7i.overscaledZ)&&(this.canonical.x<i.canonical.x||!(this.canonical.x>i.canonical.x)&&this.canonical.y<i.canonical.y))}wrapped(){return new l0(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(i){return new l0(this.overscaledZ,i,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new lQ(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}}function l1(i,r,a,n,o){let s=1<<Math.min(a,22),l=o%s*s+n%s;return i&&a<22&&(l+=s*s*((i<0?-2*i-1:2*i)%(1<<2*(22-a)))),16*(32*l+a)+(r-a)}let l2=[i=>{let r=i.canonical.x-1,a=i.wrap;return r<0&&(r=(1<<i.canonical.z)-1,a--),new l0(i.overscaledZ,a,i.canonical.z,r,i.canonical.y)},i=>{let r=i.canonical.x+1,a=i.wrap;return r===1<<i.canonical.z&&(r=0,a++),new l0(i.overscaledZ,a,i.canonical.z,r,i.canonical.y)},i=>new l0(i.overscaledZ,i.wrap,i.canonical.z,i.canonical.x,(0===i.canonical.y?1<<i.canonical.z:i.canonical.y)-1),i=>new l0(i.overscaledZ,i.wrap,i.canonical.z,i.canonical.x,i.canonical.y===(1<<i.canonical.z)-1?0:i.canonical.y+1)];nl(lK,"CanonicalTileID"),nl(l0,"OverscaledTileID",{omit:["projMatrix","expandedProjMatrix"]});let{members:l3}=oA([{type:"Float32",name:"a_globe_pos",components:3},{type:"Float32",name:"a_uv",components:2}]),l5=oA([{name:"a_pos_3",components:3,type:"Int16"}]);var l4=oA([{name:"a_pos",type:"Int16",components:2}]);function l6(i){return i*sX/6371008.8}let l8=[new lP([sJ,sJ,sJ],[sX,sX,sX]),new lP([sJ,sJ,sJ],[0,0,sX]),new lP([0,sJ,sJ],[sX,0,sX]),new lP([sJ,0,sJ],[0,sX,sX]),new lP([0,0,sJ],[sX,sX,sX])];function l9(i,r,a,n=!0){let o=eS([],i._camera.position,i.worldSize),s=[r,a,1,1];ej(s,s,i.pixelMatrixInverse),eU(s,s,1/s[3]);let l=eP([],ev([],s,o)),h=i.globeMatrix,u=[h[12],h[13],h[14]],c=ev([],u,o),d=e_(c),p=eP([],c),f=i.worldSize/(2*Math.PI),m=eD(p,l),_=Math.asin(f/d);if(_<Math.acos(m)){if(!n)return null;let i=[],r=[];eS(i,l,d/m),eP(r,ev(r,i,c)),eP(l,ex(l,c,eS(l,r,Math.tan(_)*d)))}let g=[];new lw(o,l).closestPointOnSphere(u,f,g);let y=eP([],tC(h,0)),x=eP([],tC(h,1)),v=eP([],tC(h,2)),b=eD(y,g),w=eD(x,g),T=eD(v,g),S=Math.asin(-w/f)*te,E=Math.atan2(b,T)*te;return new lr(s5(E=i.center.lng+function(i,r){let a=(r-i+180)%360-180;return a<-180?a+360:a}(i.center.lng,E)),tl(s4(S),0,1))}class l7{constructor(i,r,a){this.a=ev([],i,a),this.b=ev([],r,a),this.center=a;let n=eP([],this.a),o=eP([],this.b);this.angle=Math.acos(eD(n,o))}}function he(i,r){let a;return 0===i.angle||(a=0===i.a[r]?1/i.angle*.5*Math.PI:1/i.angle*Math.atan(i.b[r]/i.a[r]/Math.sin(i.angle)-1/Math.tan(i.angle)))<0||a>1?null:function(i,r,a,n){let o=Math.sin(a);return Math.sin((1-n)*a)/o*i+Math.sin(n*a)/o*r}(i.a[r],i.b[r],i.angle,tl(a,0,1))+i.center[r]}function ht(i){if(i.z<=1)return l8[i.z+2*i.y+i.x];let r=hs(ho(i));return lP.fromPoints(r)}function hi(i,r,a){return eS(i,i,1-a),eE(i,i,r,a)}function hr(i,r){let a=h_(r.zoom);if(0===a)return ht(i);let n=ho(i),o=hs(n),s=s5(n.getWest())*r.worldSize,l=s5(n.getEast())*r.worldSize,h=s4(n.getNorth())*r.worldSize,u=s4(n.getSouth())*r.worldSize,c=[s,h,0],d=[l,h,0],p=[s,u,0],f=[l,u,0],m=ei([],r.globeMatrix);return eL(c,c,m),eL(d,d,m),eL(p,p,m),eL(f,f,m),o[0]=hi(o[0],p,a),o[1]=hi(o[1],f,a),o[2]=hi(o[2],d,a),o[3]=hi(o[3],c,a),lP.fromPoints(o)}function ha(i,r,a){for(let n of i)eL(n,n,r),eS(n,n,a)}function hn(i,r,a,n){let o=r/i.worldSize,s=i.globeMatrix;if(a.z<=1){let i=ht(a).getCorners();return ha(i,s,o),lP.fromPoints(i)}let l=ho(a,n),h=hs(l,sX+l6(i._tileCoverLift));ha(h,s,o);let u=Number.MAX_VALUE,c=[-u,-u,-u],d=[u,u,u];if(l.contains(i.center)){for(let i of h)ew(d,d,i),eT(c,c,i);c[2]=0;let r=i.point,a=[r.x*o,r.y*o,0];return ew(d,d,a),eT(c,c,a),new lP(d,c)}if(i._tileCoverLift>0){for(let i of h)ew(d,d,i),eT(c,c,i);return new lP(d,c)}let p=[s[12]*o,s[13]*o,s[14]*o],f=l.getCenter(),m=tl(i.center.lat,-85.051129,85.051129),_=tl(f.lat,-85.051129,85.051129),g=s5(i.center.lng),y=s4(m),x=g-s5(f.lng),v=y-s4(_);x>.5?x-=1:x<-.5&&(x+=1);let b=0;Math.abs(x)>Math.abs(v)?b=x>=0?1:3:(b=v>=0?0:2,eE(p,p,[s[4]*o,s[5]*o,s[6]*o],-Math.sin((v>=0?l.getSouth():l.getNorth())*e7)*sX));let w=h[b],T=h[(b+1)%4],S=new l7(w,T,p),E=[he(S,0)||w[0],he(S,1)||w[1],he(S,2)||w[2]],I=h_(i.zoom);if(I>0){let n=function({x:i,y:r,z:a},n,o,s,l){let h=1/(1<<a),u=i*h,c=u+h,d=r*h,p=d+h,f=0,m=(u+c)/2-s;return m>.5?f=-1:m<-.5&&(f=1),u=((u+f)*n-(s*=n))*o+s,c=((c+f)*n-s)*o+s,d=(d*n-(l*=n))*o+l,[[u,p=(p*n-l)*o+l,0],[c,p,0],[c,d,0],[u,d,0]]}(a,r,i._pixelsPerMercatorPixel,g,y);for(let i=0;i<h.length;i++)hi(h[i],n[i],I);let o=ex([],n[b],n[(b+1)%4]);eS(o,o,.5),hi(E,o,I)}for(let i of h)ew(d,d,i),eT(c,c,i);return d[2]=Math.min(w[2],T[2]),ew(d,d,E),eT(c,c,E),new lP(d,c)}function ho({x:i,y:r,z:a},n=!1){let o=1/(1<<a);return new s2(new s1(s6(i*o),r===(1<<a)-1&&n?-90:s8((r+1)*o)),new s1(s6((i+1)*o),0===r&&n?90:s8(r*o)))}function hs(i,r=sX){let a=i.getNorth()*e7,n=i.getSouth()*e7,o=Math.cos(a),s=Math.cos(n),l=Math.sin(a),h=Math.sin(n),u=i.getWest(),c=i.getEast();
7return[sK(s,h,u,r),sK(s,h,c,r),sK(o,l,c,r),sK(o,l,u,r)]}function hl(i,r,a,n){let o=1<<a.z,s=(i/8192+a.x)/o;return sQ(s8((r/8192+a.y)/o),s6(s),n)}function hh({min:i,max:r}){return 16383/Math.max(r[0]-i[0],r[1]-i[1],r[2]-i[2])}let hu=new Float64Array(16);function hc(i){let r=hh(i),a=eu(hu,[r,r,r]);return ea(a,a,eC([],i.min))}function hd(i){let r=1/hh(i);return eh(hu,i.min),en(hu,hu,[r,r,r])}function hp(i){return i/(2*Math.PI)/(8192/(2*Math.PI))}function hf(i,r){return 8192/(512*Math.pow(2,i))*hh(ht(r))}function hm(i,r,a,n,o){let s=hp(a),l=[i,r,-a/(2*Math.PI)],h=et(new Float64Array(16));return ea(h,h,l),en(h,h,[s,s,s]),eo(h,h,-o*e7),es(h,h,-n*e7),h}function h_(i){return th(5,6,i)}function hg(i,r){var a,n,o,s,l,h,u,c;let d=sQ(r.lat,r.lng);return n=(a=ev([],function(i){let r=sQ(i._center.lat,i._center.lng),a=eR([],eg(0,1,0),r),n=ec([],-i.angle,r);a=eL(a,a,n),ec(n,-i._pitch,a);let o=eP([],r);return eS(o,o,l6(i.cameraToCenterDistance/i.pixelsPerMeter)),eL(o,o,n),ex([],r,o)}(i),d))[0],o=a[1],s=a[2],l=d[0],Math.acos(Math.min(Math.max((c=Math.sqrt((n*n+o*o+s*s)*(l*l+(h=d[1])*h+(u=d[2])*u)))&&eD(a,d)/c,-1),1))}function hy(i,r){return hg(i,r)>Math.PI/2*1.01}let hx=85*e7,hv=Math.cos(hx),hb=Math.sin(hx),hw=Q(),hT=i=>{let r=[];return"map"===i.paint.get("circle-pitch-alignment")&&r.push("PITCH_WITH_MAP"),"map"===i.paint.get("circle-pitch-scale")&&r.push("SCALE_WITH_MAP"),r};function hS(i,r,a,n,o,s,l,h,u){if(s&&i.queryGeometry.isAboveHorizon)return!1;s&&(u*=i.pixelToTileUnitsFactor);let c=i.tileID.canonical,d=a.projection.upVectorScale(c,a.center.lat,a.worldSize).metersToTile;for(let f of r)for(let r of f){var p;let f=r.add(h),m=o&&a.elevation?a.elevation.exaggeration()*o.getElevationAt(f.x,f.y,!0):0,_=a.projection.projectTilePoint(f.x,f.y,c);if(m>0){let i=a.projection.upVector(c,f.x,f.y);_.x+=i[0]*d*m,_.y+=i[1]*d*m,_.z+=i[2]*d*m}let g=s?f:function(i,r,a,n){let o=ej([],[i,r,a,1],n);return new e8(o[0]/o[3],o[1]/o[3])}(_.x,_.y,_.z,n),y=s?i.tilespaceRays.map(i=>(function(i,r){let a=ef();return hE[2]=r,i.intersectsPlane(hE,hI,a),new e8(a[0],a[1])})(i,m)):i.queryGeometry.screenGeometry,x=ej([],[_.x,_.y,_.z,1],n);if(!l&&s?u*=x[3]/a.cameraToCenterDistance:l&&!s&&(u*=a.cameraToCenterDistance/x[3]),s){let i=s8((r.y/8192+c.y)/(1<<c.z));u/=a.projection.pixelsPerMeter(i,1)/(1/s3(i))}if(p=u,lG(y,g)||lU(g,y,p))return!0}return!1}let hE=eg(0,0,0),hI=eg(0,0,1);class hA extends lF{}function hM(i,{width:r,height:a},n,o){if(o){if(o instanceof Uint8ClampedArray)o=new Uint8Array(o.buffer);else if(o.length!==r*a*n)throw RangeError("mismatched image size")}else o=new Uint8Array(r*a*n);return i.width=r,i.height=a,i.data=o,i}function hC(i,r,a){let{width:n,height:o}=r;n===i.width&&o===i.height||(hP(i,r,{x:0,y:0},{x:0,y:0},{width:Math.min(i.width,n),height:Math.min(i.height,o)},a,null),i.width=n,i.height=o,i.data=r.data)}function hP(i,r,a,n,o,s,l,h){if(0===o.width||0===o.height)return r;if(o.width>i.width||o.height>i.height||a.x>i.width-o.width||a.y>i.height-o.height)throw RangeError("out of range source coordinates for image copy");if(o.width>r.width||o.height>r.height||n.x>r.width-o.width||n.y>r.height-o.height)throw RangeError("out of range destination coordinates for image copy");let u=i.data,c=r.data,d=4===s&&h;for(let h=0;h<o.height;h++){let p=((a.y+h)*i.width+a.x)*s,f=((n.y+h)*r.width+n.x)*s;if(d)for(let i=0;i<o.width;i++){let r=p+i*s+3,a=f+i*s;c[a+0]=255,c[a+1]=255,c[a+2]=255,c[a+3]=u[r]}else if(l)for(let i=0;i<o.width;i++){let r=p+i*s,a=f+i*s,n=new iI(u[r+0]/255,u[r+1]/255,u[r+2]/255,u[r+3]).toNonPremultipliedRenderColor(l).toArray();c[a+0]=n[0],c[a+1]=n[1],c[a+2]=n[2],c[a+3]=n[3]}else for(let i=0;i<o.width*s;i++)c[f+i]=u[p+i]}return r}nl(hA,"HeatmapBucket",{omit:["layers"]});class hD{constructor(i,r){hM(this,i,1,r)}resize(i){hC(this,new hD(i),1)}clone(){return new hD({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(i,r,a,n,o){hP(i,r,a,n,o,1,null)}}class hR{constructor(i,r){hM(this,i,4,r)}resize(i){hC(this,new hR(i),4)}replace(i,r){r?this.data.set(i):this.data=i instanceof Uint8ClampedArray?new Uint8Array(i.buffer):i}clone(){return new hR({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(i,r,a,n,o,s,l){hP(i,r,a,n,o,4,s,l)}}class hz{constructor(i,r){this.width=i.width,this.height=i.height,this.data=r instanceof Uint8Array?new Float32Array(r.buffer):r}}function hL(i){let r={},a=i.resolution||256,n=i.clips?i.clips.length:1,o=i.image||new hR({width:a,height:n}),s=(a,n,s)=>{r[i.evaluationKey]=s;let l=i.expression.evaluate(r),h=l?l.toNonPremultipliedRenderColor(null):null;h&&(o.data[a+n+0]=Math.floor(255*h.r),o.data[a+n+1]=Math.floor(255*h.g),o.data[a+n+2]=Math.floor(255*h.b),o.data[a+n+3]=Math.floor(255*h.a))};if(i.clips)for(let r=0,o=0;r<n;++r,o+=4*a)for(let n=0,l=0;n<a;n++,l+=4){let h=n/(a-1),{start:u,end:c}=i.clips[r];s(o,l,u*(1-h)+c*h)}else for(let i=0,r=0;i<a;i++,r+=4)s(0,r,i/(a-1));return o}nl(hD,"AlphaImage"),nl(hR,"RGBAImage");let hF=oA([{name:"a_pos",components:2,type:"Int16"}],4),hO=oA([{name:"a_road_z_offset",components:1,type:"Float32"}],4),hB=oA([{name:"a_pos",components:2,type:"Int16"},{name:"a_height",components:1,type:"Float32"}],4),hk=oA([{name:"a_pos_normal_3",components:3,type:"Int16"}],4);function hN(i,r,a=2){let n,o,s,l=r&&r.length,h=l?r[0]*a:i.length,u=hU(i,0,h,a,!0),c=[];if(!u||u.next===u.prev)return c;if(l&&(u=function(i,r,a,n){let o=[];for(let a=0,s=r.length;a<s;a++){let l=hU(i,r[a]*n,a<s-1?r[a+1]*n:i.length,n,!1);l===l.next&&(l.steiner=!0),o.push(function(i){let r=i,a=i;do(r.x<a.x||r.x===a.x&&r.y<a.y)&&(a=r),r=r.next;while(r!==i);return a}(l))}o.sort(hj);for(let i=0;i<o.length;i++)a=function(i,r){let a=function(i,r){let a=r,n=i.x,o=i.y,s,l=-1/0;if(hZ(i,a))return a;do{if(hZ(i,a.next))return a.next;if(o<=a.y&&o>=a.next.y&&a.next.y!==a.y){let i=a.x+(o-a.y)*(a.next.x-a.x)/(a.next.y-a.y);if(i<=n&&i>l&&(l=i,s=a.x<a.next.x?a:a.next,i===n))return s}a=a.next}while(a!==r);if(!s)return null;let h=s,u=s.x,c=s.y,d=1/0;a=s;do{if(n>=a.x&&a.x>=u&&n!==a.x&&hH(o<c?n:l,o,u,c,o<c?l:n,o,a.x,a.y)){var p,f;let r=Math.abs(o-a.y)/(n-a.x);hJ(a,i)&&(r<d||r===d&&(a.x>s.x||a.x===s.x&&(p=s,f=a,0>hq(p.prev,p,f.prev)&&0>hq(f.next,p,p.next))))&&(s=a,d=r)}a=a.next}while(a!==h);return s}(i,r);if(!a)return r;let n=hK(a,i);return hV(n,n.next),hV(a,a.next)}(o[i],a);return a}(i,r,u,a)),i.length>80*a){n=i[0],o=i[1];let r=n,l=o;for(let s=a;
7s<h;s+=a){let a=i[s],h=i[s+1];a<n&&(n=a),h<o&&(o=h),a>r&&(r=a),h>l&&(l=h)}s=0!==(s=Math.max(r-n,l-o))?32767/s:0}return function i(r,a,n,o,s,l,h){if(!r)return;!h&&l&&function(i,r,a,n){let o=i;do 0===o.z&&(o.z=hG(o.x,o.y,r,a,n)),o.prevZ=o.prev,o.nextZ=o.next,o=o.next;while(o!==i);o.prevZ.nextZ=null,o.prevZ=null,function(i){let r,a=1;do{let n,o=i;i=null;let s=null;for(r=0;o;){r++;let l=o,h=0;for(let i=0;i<a&&(h++,l=l.nextZ);i++);let u=a;for(;h>0||u>0&&l;)0!==h&&(0===u||!l||o.z<=l.z)?(n=o,o=o.nextZ,h--):(n=l,l=l.nextZ,u--),s?s.nextZ=n:i=n,n.prevZ=s,s=n;o=l}s.nextZ=null,a*=2}while(r>1)}(o)}(r,o,s,l);let u=r;for(;r.prev!==r.next;){let c=r.prev,d=r.next;if(l?function(i,r,a,n){let o=i.prev,s=i.next;if(hq(o,i,s)>=0)return!1;let l=o.x,h=i.x,u=s.x,c=o.y,d=i.y,p=s.y,f=Math.min(l,h,u),m=Math.min(c,d,p),_=Math.max(l,h,u),g=Math.max(c,d,p),y=hG(f,m,r,a,n),x=hG(_,g,r,a,n),v=i.prevZ,b=i.nextZ;for(;v&&v.z>=y&&b&&b.z<=x;){if(v.x>=f&&v.x<=_&&v.y>=m&&v.y<=g&&v!==o&&v!==s&&h$(l,c,h,d,u,p,v.x,v.y)&&hq(v.prev,v,v.next)>=0||(v=v.prevZ,b.x>=f&&b.x<=_&&b.y>=m&&b.y<=g&&b!==o&&b!==s&&h$(l,c,h,d,u,p,b.x,b.y)&&hq(b.prev,b,b.next)>=0))return!1;b=b.nextZ}for(;v&&v.z>=y;){if(v.x>=f&&v.x<=_&&v.y>=m&&v.y<=g&&v!==o&&v!==s&&h$(l,c,h,d,u,p,v.x,v.y)&&hq(v.prev,v,v.next)>=0)return!1;v=v.prevZ}for(;b&&b.z<=x;){if(b.x>=f&&b.x<=_&&b.y>=m&&b.y<=g&&b!==o&&b!==s&&h$(l,c,h,d,u,p,b.x,b.y)&&hq(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}(r,o,s,l):function(i){let r=i.prev,a=i.next;if(hq(r,i,a)>=0)return!1;let n=r.x,o=i.x,s=a.x,l=r.y,h=i.y,u=a.y,c=Math.min(n,o,s),d=Math.min(l,h,u),p=Math.max(n,o,s),f=Math.max(l,h,u),m=a.next;for(;m!==r;){if(m.x>=c&&m.x<=p&&m.y>=d&&m.y<=f&&h$(n,l,o,h,s,u,m.x,m.y)&&hq(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}(r))a.push(c.i,r.i,d.i),h0(r),r=d.next,u=d.next;else if((r=d)===u){h?1===h?i(r=function(i,r){let a=i;do{let n=a.prev,o=a.next.next;!hZ(n,o)&&hW(n,a,a.next,o)&&hJ(n,o)&&hJ(o,n)&&(r.push(n.i,a.i,o.i),h0(a),h0(a.next),a=i=o),a=a.next}while(a!==i);return hV(a)}(hV(r),a),a,n,o,s,l,2):2===h&&function(r,a,n,o,s,l){let h=r;do{let r=h.next.next;for(;r!==h.prev;){var u,c;if(h.i!==r.i&&(u=h,c=r,u.next.i!==c.i&&u.prev.i!==c.i&&!function(i,r){let a=i;do{if(a.i!==i.i&&a.next.i!==i.i&&a.i!==r.i&&a.next.i!==r.i&&hW(a,a.next,i,r))return!0;a=a.next}while(a!==i);return!1}(u,c)&&(hJ(u,c)&&hJ(c,u)&&function(i,r){let a=i,n=!1,o=(i.x+r.x)/2,s=(i.y+r.y)/2;do a.y>s!=a.next.y>s&&a.next.y!==a.y&&o<(a.next.x-a.x)*(s-a.y)/(a.next.y-a.y)+a.x&&(n=!n),a=a.next;while(a!==i);return n}(u,c)&&(hq(u.prev,u,c.prev)||hq(u,c.prev,c))||hZ(u,c)&&hq(u.prev,u,u.next)>0&&hq(c.prev,c,c.next)>0))){let u=hK(h,r);return h=hV(h,h.next),u=hV(u,u.next),i(h,a,n,o,s,l,0),void i(u,a,n,o,s,l,0)}r=r.next}h=h.next}while(h!==r)}(r,a,n,o,s,l):i(hV(r),a,n,o,s,l,1);break}}}(u,c,a,n,o,s,0),c}function hU(i,r,a,n,o){let s;if(o===function(i,r,a,n){let o=0;for(let s=r,l=a-n;s<a;s+=n)o+=(i[l]-i[s])*(i[s+1]+i[l+1]),l=s;return o}(i,r,a,n)>0)for(let o=r;o<a;o+=n)s=hQ(o/n|0,i[o],i[o+1],s);else for(let o=a-n;o>=r;o-=n)s=hQ(o/n|0,i[o],i[o+1],s);return s&&hZ(s,s.next)&&(h0(s),s=s.next),s}function hV(i,r){if(!i)return i;r||(r=i);let a,n=i;do if(a=!1,n.steiner||!hZ(n,n.next)&&0!==hq(n.prev,n,n.next))n=n.next;else{if(h0(n),(n=r=n.prev)===n.next)break;a=!0}while(a||n!==r);return r}function hj(i,r){let a=i.x-r.x;return 0===a&&0==(a=i.y-r.y)&&(a=(i.next.y-i.y)/(i.next.x-i.x)-(r.next.y-r.y
7)/(r.next.x-r.x)),a}function hG(i,r,a,n,o){return(i=0x55555555&((i=0x33333333&((i=0xf0f0f0f&((i=0xff00ff&((i=(i-a)*o|0)|i<<8))|i<<4))|i<<2))|i<<1))|(r=0x55555555&((r=0x33333333&((r=0xf0f0f0f&((r=0xff00ff&((r=(r-n)*o|0)|r<<8))|r<<4))|r<<2))|r<<1))<<1}function hH(i,r,a,n,o,s,l,h){return(o-l)*(r-h)>=(i-l)*(s-h)&&(i-l)*(n-h)>=(a-l)*(r-h)&&(a-l)*(s-h)>=(o-l)*(n-h)}function h$(i,r,a,n,o,s,l,h){return(i!==l||r!==h)&&hH(i,r,a,n,o,s,l,h)}function hq(i,r,a){return(r.y-i.y)*(a.x-r.x)-(r.x-i.x)*(a.y-r.y)}function hZ(i,r){return i.x===r.x&&i.y===r.y}function hW(i,r,a,n){let o=hY(hq(i,r,a)),s=hY(hq(i,r,n)),l=hY(hq(a,n,i)),h=hY(hq(a,n,r));return o!==s&&l!==h||!(0!==o||!hX(i,a,r))||!(0!==s||!hX(i,n,r))||!(0!==l||!hX(a,i,n))||!(0!==h||!hX(a,r,n))}function hX(i,r,a){return r.x<=Math.max(i.x,a.x)&&r.x>=Math.min(i.x,a.x)&&r.y<=Math.max(i.y,a.y)&&r.y>=Math.min(i.y,a.y)}function hY(i){return i>0?1:i<0?-1:0}function hJ(i,r){return 0>hq(i.prev,i,i.next)?hq(i,r,i.next)>=0&&hq(i,i.prev,r)>=0:0>hq(i,r,i.prev)||0>hq(i,i.next,r)}function hK(i,r){let a=h1(i.i,i.x,i.y),n=h1(r.i,r.x,r.y),o=i.next,s=r.prev;return i.next=r,r.prev=i,a.next=o,o.prev=a,n.next=a,a.prev=n,s.next=n,n.prev=s,n}function hQ(i,r,a,n){let o=h1(i,r,a);return n?(o.next=n.next,o.prev=n,n.next.prev=o,n.next=o):(o.prev=o,o.next=o),o}function h0(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function h1(i,r,a){return{i:i,x:r,y:a,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function h2(i,r){let a,n,o=i.length;if(o<=1)return[i];let s=[];for(let r=0;r<o;r++){let o=function(i){let r=0;for(let a,n,o=0,s=i.length,l=s-1;o<s;l=o++)a=i[o],r+=((n=i[l]).x-a.x)*(a.y+n.y);return r}(i[r]);0!==o&&(i[r].area=Math.abs(o),void 0===n&&(n=o<0),n===o<0?(a&&s.push(a),a=[i[r]]):a.push(i[r]))}if(a&&s.push(a),r>1)for(let i=0;i<s.length;i++)s[i].length<=r||(function i(r,a,n=0,o=r.length-1,s=function(i,r){return i<r?-1:+(i>r)}){for(;o>n;){if(o-n>600){let l=o-n+1,h=a-n+1,u=Math.log(l),c=.5*Math.exp(2*u/3),d=.5*Math.sqrt(u*c*(l-c)/l)*(h-l/2<0?-1:1);i(r,a,Math.max(n,Math.floor(a-h*c/l+d)),Math.min(o,Math.floor(a+(l-h)*c/l+d)),s)}let l=r[a],h=n,u=o;for(rf(r,n,a),s(r[o],l)>0&&rf(r,n,o);h<u;){for(rf(r,h,u),h++,u--;0>s(r[h],l);)h++;for(;s(r[u],l)>0;)u--}0===s(r[n],l)?rf(r,n,u):rf(r,++u,o),u<=a&&(n=u+1),a<=u&&(o=u-1)}}(s[i],r,1,s[i].length-1,h3),s[i]=s[i].slice(0,r));return s}function h3(i,r){return r.area-i.area}function h5(i,r,a=1){if(!i)return null;let n="string"==typeof i?i1.from(i).getPrimary():i.getPrimary(),o="string"==typeof i?null:i.getSecondary();for(let i of[n,o]){if(!i)continue;let n=i.id.toString();r.has(n)||r.set(n,[]),i.scaleSelf(a),r.get(n).push(i)}return{primary:n.toString(),secondary:o?o.toString():null}}function h4(i,r,a,n){let o=n.patternDependencies,s=!1;for(let n of r){let r=n.paint.get(`${i}-pattern`);r.isConstant()||(s=!0),h5(r.constantOr(null),o,a)&&(s=!0)}return s}function h6(i,r,a,n,o,s){let l=s.patternDependencies;for(let h of r){let r=h.paint.get(`${i}-pattern`).value;if("constant"!==r.kind){let i=h5(r.evaluate({zoom:n},a,{},void 0,s.availableImages),l,o);if(!i)continue;let{primary:u,secondary:c}=i;u&&(a.patterns[h.id]=[u,c].filter(Boolean))}}return a}class h8{constructor(){this.portals=[]}static isOnBorder(i,r){return i<=0&&r<=0||i>=8192&&r>=8192}static evaluate(i){if(0===i.length)return new h8;let r=[];for(let a of i)r.push(...a.portals);if(0===r.length)return new h8;for(let i of r){let r=i.va,a=i.vb;(h8.isOnBorder(r.x,a.x)||h8.isOnBorder(r.y,a.y))&&(i.type="border")}let a=r.filter(i=>"unevaluated"!==i.type),n=r.filter(i=>
7"unevaluated"===i.type);if(0===n.length)return new h8;n.sort((i,r)=>i.hash===r.hash?i.isTunnel===r.isTunnel?0:i.isTunnel?-1:1:i.hash<r.hash?1:-1),r=a.concat(n);let o=a.length,s=o,l=o;do if(++s===r.length||r[o].hash!==r[s].hash){if(s-o==2){l<o&&(r[l]=r[o],r[o]=null);let i=r[l],a=r[s-1];i.type=i.isTunnel!==a.isTunnel?"tunnel":"polygon",i.connection={a:i.connection.a,b:a.connection.a},l++}o=s}while(o!==r.length);return r.splice(l),r.sort((i,r)=>i.hash<r.hash?1:-1),{portals:r}}}nl(h8,"ElevationPortalGraph");class h9{constructor(i,r,a){this.outPositions=i,this.outNormals=r,this.outIndices=a,this.vertexLookup=new Map}addVertex(i,r,a){let n=i[2];null!=a&&(n*=a);let o=`${i[0]},${i[1]},${i[2]},${r[0]},${r[1]},${r[2]}`,s=this.vertexLookup.get(o);if(null!=s)return s;let l=this.outPositions.length;this.vertexLookup.set(o,l);let h=Math.trunc(16384*r[0]),u=Math.trunc(16384*r[1]),c=Math.trunc(16384*r[2]);return this.outPositions.emplaceBack(i[0],i[1],n),this.outNormals.emplaceBack(h,u,c),l}addTriangle(i,r,a){this.outIndices.emplaceBack(i,r,a)}addTriangles(i,r,a){if(0===i.length)return;let n=1===a.length,o=ef(),s=ef();for(let l=0;l<i.length;l+=3){let h=r[i[l+0]],u=r[i[l+1]],c=r[i[l+2]],d=n?a[0]:a[i[l+1]],p=n?a[0]:a[i[l+2]];ey(o,h.x,h.y,n?a[0]:a[i[l+0]]);let f=this.addVertex(o,s);ey(o,u.x,u.y,d);let m=this.addVertex(o,s);ey(o,c.x,c.y,p);let _=this.addVertex(o,s);this.outIndices.emplaceBack(f,m,_)}}addQuad(i,r,a,n,o,s){let l=this.addVertex(i,o,s),h=this.addVertex(r,o,s),u=this.addVertex(a,o,s),c=this.addVertex(n,o,s);this.addTriangle(l,h,u),this.addTriangle(u,c,l)}getVertexCount(){return this.outPositions.length}clearVertexLookup(){this.vertexLookup.clear()}}class h7{constructor(i,r,a,n){this.unevaluatedPortals=new h8,this.bridgeFeatureSections=[],this.tunnelFeatureSections=[],this.vertexHashLookup=new Map,this.unevalVertices=[],this.unevalHeights=[],this.unevalTriangles=[],this.unevalTunnelTriangles=[],this.unevalEdges=[],this.vertexPositions=new oz,this.vertexNormals=new oL,this.indexArray=new oJ,this.tileToMeters=li(i),this.bridgeProgramConfigurations=new sH(r,{zoom:a,lut:n},i=>"fill-tunnel-structure-color"!==i),this.tunnelProgramConfigurations=new sH(r,{zoom:a,lut:n},i=>"fill-bridge-guard-rail-color"!==i)}addVertices(i,r){let a=this.unevalVertices.length;for(let a=0;a<i.length;a++)this.unevalVertices.push(i[a]),this.unevalHeights.push(r[a]);return a}addTriangles(i,r,a){let n=a?this.unevalTunnelTriangles:this.unevalTriangles;for(let a of i)n.push(a+r)}addRenderableRing(i,r,a,n,o,s){let l=[new e8(o.min.x,o.min.y),new e8(o.max.x,o.min.y),new e8(o.max.x,o.max.y),new e8(o.min.x,o.max.y)];for(let h=0;h<a-1;h++){let a=r+h,u=a+1,c=this.unevalVertices[a],d=this.unevalVertices[u];if(!(c.x>=o.min.x&&c.x<=o.max.x&&c.y>=o.min.y&&c.y<=o.max.y||d.x>=o.min.x&&d.x<=o.max.x&&d.y>=o.min.y&&d.y<=o.max.y||l$(c,d,l))||this.isOnBorder(c.x,d.x)||this.isOnBorder(c.y,d.y))continue;let p=h7.computeEdgeHash(this.unevalVertices[a],this.unevalVertices[u]),f,m=this.vertexHashLookup.get(h7.computePosHash(c));f=null!=m?m.next:null!=(m=this.vertexHashLookup.get(h7.computePosHash(d)))?m.prev:p,this.unevalEdges.push({polygonIdx:i,a:a,b:u,hash:p,portalHash:f,isTunnel:n,type:"unevaluated",featureInfo:s})}}addPortalCandidates(i,r,a,n,o){if(0!==r.length)for(let o of(this.vertexHashLookup.clear(),r)){if(0===o.length)continue;let r=o[0],s=h7.computeEdgeHash(r[r.length-2],r.at(-1));for(let o=0;o<r.length-1;o++){let l=r[o+0],h=r[o+1],u=eK(h.x-l.x,h.y-l.y),c=e2(u);if(0===c)continue;let d="unevaluated",p=n.pointElevation(l),f=n.pointElevation(h);.01>Math.abs(p)&&.01>Math.abs(f)?d="entrance":(this.isOnBorder(l.x,h.x)||this.isOnBorder(l.y,h.y))&&(d="border");let m=h7.computeEdgeHash(l,h);this.unevaluatedPortals.portals.push({connection:{a:i,b:void 0},va:l,vb:h,vab:u,length:c,hash:m,isTunnel:a,type:d});let _=h7.computePosHash(l);this.vertexHashLookup.set(_,{prev:s,next:m}),s=m}}}construct(i){if(0===this.unevalVertices.length)return;let r=()=>({vertexOffset:0,primitiveOffset:this.indexArray.length}),a=i=>{i.primitiveLength=this.indexArray.length-i.primitiveOffset},n=new h9(this.vertexPositions,this.vertexNormals,this.indexArray);this.prepareEdges(i.portals,this.unevalEdges);
7let o=r(),s=r(),l=r(),h=(i,r)=>{i.sort((i,a)=>i.type===r&&a.type!==r?-1:+(i.type!==r&&a.type===r));let a=i.findIndex(i=>i.type!==r);return a>=0?a:i.length},u=0;this.unevalEdges.length>0&&(u=h(this.unevalEdges,"none"),this.constructBridgeStructures(n,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:u},this.tileToMeters)),a(l);let c=r(),d=r();if(this.unevalEdges.length>0){let i=this.unevalEdges.splice(u),r=h(i,"tunnel")+u;this.unevalEdges.push(...i),this.constructTunnelStructures(n,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:u},{min:u,max:r})}a(c),n.addTriangles(this.unevalTriangles,this.unevalVertices,this.unevalHeights),a(d),n.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,this.unevalHeights),a(s),n.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,[-.1]),a(o),this.maskSegments=sy.simpleSegment(0,d.primitiveOffset,0,d.primitiveLength),this.depthSegments=sy.simpleSegment(0,s.primitiveOffset,0,s.primitiveLength),this.renderableBridgeSegments=sy.simpleSegment(0,l.primitiveOffset,0,l.primitiveLength),this.renderableTunnelSegments=sy.simpleSegment(0,c.primitiveOffset,0,c.primitiveLength),this.shadowCasterSegments=sy.simpleSegment(0,o.primitiveOffset,0,o.primitiveLength)}update(i,r,a,n,o,s,l,h){this.bridgeProgramConfigurations.updatePaintArrays(i,r,o,a,n,s,l,h),this.tunnelProgramConfigurations.updatePaintArrays(i,r,o,a,n,s,l,h)}upload(i){this.vertexBuffer||0===this.vertexPositions.length||0===this.vertexNormals.length||0===this.indexArray.length||(this.vertexBuffer=i.createVertexBuffer(this.vertexPositions,hB.members),this.vertexBufferNormal=i.createVertexBuffer(this.vertexNormals,hk.members),this.indexBuffer=i.createIndexBuffer(this.indexArray),this.bridgeProgramConfigurations.upload(i),this.tunnelProgramConfigurations.upload(i))}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(i,r,a,n,o){let s=(s,l)=>{for(let h=0;h<l.length-1;h++){let u=l[h].featureIndex,c=l[h+1].vertexStart,d=i.feature(u);s.populatePaintArrays(c,d,u,{},a,r,n,void 0,o)}};s(this.bridgeProgramConfigurations,this.bridgeFeatureSections),s(this.tunnelProgramConfigurations,this.tunnelFeatureSections)}computeVertexConnections(i,r,a,n,o){let s=new Map;for(let l=n;l<o;l++){let n=a[l],o=n.a,h=n.b,u=h7.computePosHash(i[o]),c=h7.computePosHash(i[h]),d=s.get(u);d||(d={},s.set(u,d));let p=s.get(c);p||(p={},s.set(c,p)),r[o]<=0&&r[h]<=0||(d.to=h,p.from=o)}return s}isTerminalVertex(i,r){let a=h7.computePosHash(this.unevalVertices[i]),n=r.get(a);return!n||!n.from||!n.to}constructBridgeStructures(i,r,a,n,o,s){i.clearVertexLookup();let l=this.computeVertexConnections(r,a,n,o.min,o.max),h=1/s,u=.5*h,c=(i,n)=>ey(i,r[n].x,r[n].y,a[n]*h),d=ef(),p=ef(),f=ef(),m=ef(),_=ef(),g=(i,a)=>{let n=l.get(h7.computePosHash(r[a])),o=n.from,s=n.to;if(!o||!s)return;c(d,o),c(p,a),c(f,s),eB(m),ek(d,p)||(ev(_,p,d),eP(m,_)),ek(f,p)||(ev(_,f,p),ex(m,m,eP(_,_)));let h=e_(m);return h>0?eS(i,m,1/h):void 0},y=1/0;this.sortSubarray(n,o.min,o.max,(i,r)=>i.featureInfo.featureIndex-r.featureInfo.featureIndex);let x=ef(),v=ef(),b=ef(),w=ef(),T=ef(),S=ef(),E=ef(),I=ef(),A=ef(),M=[ef(),ef(),ef(),ef()],C=[ef(),ef(),ef(),ef()],P=[{coord:new e8(0,0),height:0},{coord:new e8(0,0),height:0}],D=(i,r)=>i>r;for(let c=o.min;c<o.max;c++){let o=n[c];if(!o.featureInfo.guardRailEnabled||!this.prepareEdgePoints(P,r,a,o,D))continue;let[d,p]=P;if(ey(x,d.coord.x,d.coord.y,h*d.height),ey(v,p.coord.x,p.coord.y,h*p.height),ek(x,v))continue;ev(b,v,x),eP(b,b);let f=g(I,o.a)||b,m=g(A,o.b)||b;ey(w,f[1],-f[0],0),eP(w,w),ey(T,m[1],-m[0],0),eP(T,T),eR(I,w,f),eP(S,I),eR(I,T,m),eP(E,I),ex(M[0],x,eS(I,ev(I,w,S),u)),ex(M[1],x,eS(I,ex(I,w,S),u)),ex(M[2],x,eS(I,S,u)),M[3]=x,ex(C[0],v,eS(I,ev(I,T,E),u)),ex(C[1],v,eS(I,ex(I,T,E),u)),ex(C[2],v,eS(I,E,u)),C[3]=v,y=this.addFeatureSection(o.featureInfo.featureIndex,y,this.bridgeFeatureSections,i);let _=i.addVertex(M[0],w,s),R=i.addVertex(M[1],w,s),z=i.addVertex(C[0],T,s),L=i.addVertex(C[1],T,s);i.addTriangle(_,R,z),i.addTriangle(R,L,z);let F=i.addVertex(M[1],S,s),O=i.addVertex(M[2],S,s),B=i.addVertex(C[1],E,s),k=i.addVertex(C[2],E,s);i.addTriangle(F,O,B),i.addTriangle(O,k,B),eC(w,w),eC(T,T);let N=i.addVertex(M[2],w,s),U=i.addVertex(M[3],w,s),V=i.addVertex(C[2],T,s),j=i.addVertex(C[3],T,s);i.addTriangle(N,U,V),i.addTriangle(U,j,V);let G=this.isTerminalVertex(o.a,l),H=this.isTerminalVertex(o.b,l);d.height<.01&&G&&i.addQuad(M[3],M[2],M[1],M[0],eC(f,f),s),p.height<.01&&H&&i.addQuad(C[0],C[1],C[2],C[3],m,s)}this.bridgeFeatureSections.push({featureIndex:1/0,vertexStart:i.getVertexCount()})}constructTunnelStructures(i,r,a,n,o,s){i.clearVertexLookup();let l=1/0,h=(i,r)=>i.featureInfo.featureIndex-r.featureInfo.featureIndex;this.sortSubarray(n,o.min,o.max,h),this.sortSubarray(n,s.min,s.max,h);let u=i=>eP(i,i),c=[{coord:new e8(0,0),height:0},{coord:new e8(0,0),height:0}],d=(i,r)=>i<r,p=ef(),f=ef(),m=ef(),_=ef(),g=ef();for(let s=o.min;s<o.max;s++){if(!this.prepareEdgePoints(c,r,a,n[s],d))continue;let[o,h]=c,y=u(ey(g,-(h.coord.y-o.coord.y),h.coord.x-o.coord.x,0));l=this.addFeatureSection(n[s].featureInfo.featureIndex,l,this.tunnelFeatureSections,i),i.addQuad(ey(p,o.coord.x,o.coord.y,o.height),ey(f,h.coord.x,h.coord.y,h.height),ey(m,h.coord.x,h.coord.y,n[s].isTunnel?-.1:0),ey(_,o.coord.x,o.coord.y,n[s].isTunnel?-.1:0),y)}for(let o=s.min;o<s.max;o++){let s=n[o];s.isTunnel&&([s.a,s.b]=[s.b,s.a]);let h=r[s.a],c=r[s.b],d=u(ey(g,-(c.y-h.y),c.x-h.x,0));l=this.addFeatureSection(s.featureInfo.featureIndex,l,this.tunnelFeatureSections,i),i.addQuad(ey(p,c.x,c.y,0),ey(f,h.x,h.y,0),ey(m,h.x,h.y,a[s.a]+4),ey(_,c.x,c.y,a[s.b]+4),d),i.addQuad(ey(p,h.x,h.y,0),ey(f,c.x,c.y,0),ey(m,c.x,c.y,a[s.b]+4),ey(_,h.x,h.y,a[s.a]+4),d)}this.tunnelFeatureSections.push({featureIndex:1/0,vertexStart:i.getVertexCount()})}setElevatedPoint(i,r,a,n){i.coord.x=r,i.coord.y=a,i.height=n}prepareEdgePoints(i,r,a,n,o){let s=r[n.a].x,l=r[n.a].y,h=r[n.b].x,u=r[n.b].y,c=a[n.a],d=a[n.b],p=o(c,0),f=o(d,0);if(p&&f)return this.setElevatedPoint(i[0],s,l,c),this.setElevatedPoint(i[1],h,u,d),!0;if(!p&&!f)return!1;if(p){if(!f){let i=d/(d-c);h=iE(h,s,i),u=iE(u,l,i),d=iE(d,c,i)}}else{let i=c/(c-d);s=iE(s,h,i),l=iE(l,u,i),c=iE(c,d,i)}return this.setElevatedPoint(i[0],s,l,c),this.setElevatedPoint(i[1],h,u,d),!0}prepareEdges(i,r){if(0===r.length)return;r.sort((i,r)=>i.hash===r.hash?r.polygonIdx-i.polygonIdx:r.hash>i.hash?1:-1);let a=0,n=0,o=0,s=r[0].polygonIdx;do(++n===r.length||r[a].hash!==r[n].hash)&&((1==n-a||r[n-1].polygonIdx!==s)&&(o<a&&(r[o]=r[a],r[a]=null),r[o].type="none",o++),(a=n)!==r.length&&(s=r[a].polygonIdx));while(a!==r.length);if(r.splice(o),0!==r.length&&0!==i.length){r.sort((i,r)=>i.portalHash<r.portalHash?1:-1);let a=0,n=0;for(;a!==r.length&&n!==i.length;){let o=r[a],s=i[n];o.portalHash>s.hash?a++:s.hash>o.portalHash?n++:(o.type=s.type,a++)}}}isOnBorder(i,r){return i<=0&&r<=0||i>=8192&&r>=8192}addFeatureSection(i,r,a,n){return i!==r&&(r=i,a.push({featureIndex:i,vertexStart:n.getVertexCount()}),n.clearVertexLookup()),r}sortSubarray(i,r,a,n){let o=i.slice(r,a);o.sort(n),i.splice(r,o.length,...o)}static computeEdgeHash(i,r){return(i.y===r.y&&i.x>r.x||i.y>r.y)&&([i,r]=[r,i]),BigInt(h7.computePosHash(i))<<32n|BigInt(h7.computePosHash(r))}static computePosHash(i){return((65535&i.x)<<16|65535&i.y)>>>0}}function ue(i,r){return i>r?1:i<r?-1:0}class ut{constructor(i=ue,r=!1){this._compare=i,this._root=null,this._size=0,this._noDuplicates=!!r}rotateLeft(i){var r=i.right;r&&(i.right=r.left,r.left&&(r.left.parent=i),r.parent=i.parent),i.parent?i===i.parent.left?i.parent.left=r:i.parent.right=r:this._root=r,r&&(r.left=i),i.parent=r}rotateRight(i){var r=i.left;
7r&&(i.left=r.right,r.right&&(r.right.parent=i),r.parent=i.parent),i.parent?i===i.parent.left?i.parent.left=r:i.parent.right=r:this._root=r,r&&(r.right=i),i.parent=r}_splay(i){for(;i.parent;){var r=i.parent;r.parent?r.left===i&&r.parent.left===r?(this.rotateRight(r.parent),this.rotateRight(r)):r.right===i&&r.parent.right===r?(this.rotateLeft(r.parent),this.rotateLeft(r)):r.left===i&&r.parent.right===r?(this.rotateRight(r),this.rotateLeft(r)):(this.rotateLeft(r),this.rotateRight(r)):r.left===i?this.rotateRight(r):this.rotateLeft(r)}}splay(i){for(var r,a,n,o,s;i.parent;)(a=(r=i.parent).parent)&&a.parent?((n=a.parent).left===a?n.left=i:n.right=i,i.parent=n):(i.parent=null,this._root=i),o=i.left,s=i.right,i===r.left?(a&&(a.left===r?(r.right?(a.left=r.right,a.left.parent=a):a.left=null,r.right=a,a.parent=r):(o?(a.right=o,o.parent=a):a.right=null,i.left=a,a.parent=i)),s?(r.left=s,s.parent=r):r.left=null,i.right=r):(a&&(a.right===r?(r.left?(a.right=r.left,a.right.parent=a):a.right=null,r.left=a,a.parent=r):(s?(a.left=s,s.parent=a):a.left=null,i.right=a,a.parent=i)),o?(r.right=o,o.parent=r):r.right=null,i.left=r),r.parent=i}replace(i,r){i.parent?i===i.parent.left?i.parent.left=r:i.parent.right=r:this._root=r,r&&(r.parent=i.parent)}minNode(i=this._root){if(i)for(;i.left;)i=i.left;return i}maxNode(i=this._root){if(i)for(;i.right;)i=i.right;return i}insert(i,r){var a=this._root,n=null,o=this._compare;if(this._noDuplicates)for(;a;){if(n=a,0===o(a.key,i))return;a=0>o(a.key,i)?a.right:a.left}else for(;a;)n=a,a=0>o(a.key,i)?a.right:a.left;return a={key:i,data:r,left:null,right:null,parent:n},n?0>o(n.key,a.key)?n.right=a:n.left=a:this._root=a,this.splay(a),this._size++,a}find(i){for(var r=this._root,a=this._compare;r;){var n=a(r.key,i);if(n<0)r=r.right;else{if(!(n>0))return r;r=r.left}}return null}contains(i){for(var r=this._root,a=this._compare;r;){var n=a(i,r.key);if(0===n)return!0;r=n<0?r.left:r.right}return!1}remove(i){var r=this.find(i);if(!r)return!1;if(this.splay(r),r.left)if(r.right){var a=this.minNode(r.right);a.parent!==r&&(this.replace(a,a.right),a.right=r.right,a.right.parent=a),this.replace(r,a),a.left=r.left,a.left.parent=a}else this.replace(r,r.left);else this.replace(r,r.right);return this._size--,!0}removeNode(i){if(!i)return!1;if(this.splay(i),i.left)if(i.right){var r=this.minNode(i.right);r.parent!==i&&(this.replace(r,r.right),r.right=i.right,r.right.parent=r),this.replace(i,r),r.left=i.left,r.left.parent=r}else this.replace(i,i.left);else this.replace(i,i.right);return this._size--,!0}erase(i){var r=this.find(i);if(r){this.splay(r);var a=r.left,n=r.right,o=null;a&&(a.parent=null,o=this.maxNode(a),this.splay(o),this._root=o),n&&(a?o.right=n:this._root=n,n.parent=o),this._size--}}pop(){var i=this._root,r=null;if(i){for(;i.left;)i=i.left;r={key:i.key,data:i.data},this.remove(i.key)}return r}next(i){var r=i;if(r)if(r.right)for(r=r.right;r&&r.left;)r=r.left;else for(r=i.parent;r&&r.right===i;)i=r,r=r.parent;return r}prev(i){var r=i;if(r)if(r.left)for(r=r.left;r&&r.right;)r=r.right;else for(r=i.parent;r&&r.left===i;)i=r,r=r.parent;return r}forEach(i){for(var r=this._root,a=[],n=!1,o=0;!n;)r?(a.push(r),r=r.left):a.length>0?(i(r=a.pop(),o++),r=r.right):n=!0;return this}range(i,r,a,n){let o=[],s=this._compare,l=this._root;for(;0!==o.length||l;)if(l)o.push(l),l=l.left;else{if(s((l=o.pop()).key,r)>0)break;if(s(l.key,i)>=0&&a.call(n,l))return this;l=l.right}return this}keys(){for(var i=this._root,r=[],a=[],n=!1;!n;)i?(r.push(i),i=i.left):r.length>0?(a.push((i=r.pop()).key),i=i.right):n=!0;return a}values(){for(var i=this._root,r=[],a=[],n=!1;!n;)i?(r.push(i),i=i.left):r.length>0?(a.push((i=r.pop()).data),i=i.right):n=!0;return a}at(i){for(var r=this._root,a=[],n=!1,o=0;!n;)if(r)a.push(r),r=r.left;else if(a.length>0){if(r=a.pop(),o===i)return r;o++,r=r.right}else n=!0;return null}load(i=[],r=[],a=!1){if(0!==this._size)throw Error("bulk-load: tree is not empty");let n=i.length;return a&&function i(r,a,n,o,s){if(n>=o)return;let l=r[n+o>>1],h=n-1,u=o+1;for(;;){do h++;while(0>s(r[h],l));do u--;while(s(r[u],l)>0);if(h>=u)break;let i=r[h];r[h]=r[u],r[u]=i,i=a[h],a[h]=a[u],a[u]=i}i(r,a,n,u,s),i(r,a,u+1,o,s)}(i,r,0,n-1,this._compare),this._root=function i(r,a,n,o,s){let l=s-o;if(l>0){let h=o+Math.floor(l/2),u={key:a[h],data:n[h],parent:r};return u.left=i(u,a,n,o,h),u.right=i(u,a,n,h+1,s),u}return null}(null,i,r,0,n),this._size=n,this}min(){var i=this.minNode(this._root);return i?i.key:null}max(){var i=this.maxNode(this._root);return i?i.key:null}isEmpty(){return null===this._root}get size(){return this._size}static createTree(i,r,a,n,o){return new ut(a,o).load(i,r,n)}}let ui=(3+8881784197001252e-31)*11102230246251565e-32;function ur(i,r,a,n,o){let s,l,h,u,c=r[0],d=n[0],p=0,f=0;d>
7c==d>-c?(s=c,c=r[++p]):(s=d,d=n[++f]);let m=0;if(p<i&&f<a)for(d>c==d>-c?(l=c+s,h=s-(l-c),c=r[++p]):(l=d+s,h=s-(l-d),d=n[++f]),s=l,0!==h&&(o[m++]=h);p<i&&f<a;)d>c==d>-c?(u=(l=s+c)-s,h=s-(l-u)+(c-u),c=r[++p]):(u=(l=s+d)-s,h=s-(l-u)+(d-u),d=n[++f]),s=l,0!==h&&(o[m++]=h);for(;p<i;)u=(l=s+c)-s,h=s-(l-u)+(c-u),c=r[++p],s=l,0!==h&&(o[m++]=h);for(;f<a;)u=(l=s+d)-s,h=s-(l-u)+(d-u),d=n[++f],s=l,0!==h&&(o[m++]=h);return 0===s&&0!==m||(o[m++]=s),m}function ua(i){return new Float64Array(i)}let un=ua(4),uo=ua(8),us=ua(12),ul=ua(16),uh=ua(4);function uu(i,r,a){null===r?(i.inOut=!1,i.otherInOut=!0):(i.isSubject===r.isSubject?(i.inOut=!r.inOut,i.otherInOut=r.otherInOut):(i.inOut=!r.otherInOut,i.otherInOut=r.isVertical()?!r.inOut:r.inOut),r&&(i.prevInResult=!uc(r,a)||r.isVertical()?r.prevInResult:r)),i.resultTransition=uc(i,a)?function(i,r){let a,n=!i.inOut,o=!i.otherInOut;switch(r){case 0:a=n&&o;break;case 1:a=n||o;break;case 3:a=n!==o;break;case 2:a=i.isSubject?n&&!o:o&&!n}return a?1:-1}(i,a):0}function uc(i,r){switch(i.type){case 0:switch(r){case 0:return!i.otherInOut;case 1:return i.otherInOut;case 2:return i.isSubject&&i.otherInOut||!i.isSubject&&!i.otherInOut;case 3:return!0}break;case 2:return 0===r||1===r;case 3:return 2===r}return!1}class ud{constructor(i,r,a,n,o){this.left=r,this.point=i,this.otherEvent=a,this.isSubject=n??!1,this.type=o||0,this.inOut=!1,this.otherInOut=!1,this.prevInResult=null,this.resultTransition=0,this.otherPos=-1,this.outputContourId=-1,this.isExteriorRing=!0}isBelow(i){let r=this.point,a=this.otherEvent.point;return this.left?(r[0]-i[0])*(a[1]-i[1])-(a[0]-i[0])*(r[1]-i[1])>0:(a[0]-i[0])*(r[1]-i[1])-(r[0]-i[0])*(a[1]-i[1])>0}isAbove(i){return!this.isBelow(i)}isVertical(){return this.point[0]===this.otherEvent.point[0]}get inResult(){return 0!==this.resultTransition}clone(){let i=new ud(this.point,this.left,this.otherEvent,this.isSubject,this.type);return i.contourId=this.contourId,i.resultTransition=this.resultTransition,i.prevInResult=this.prevInResult,i.isExteriorRing=this.isExteriorRing,i.inOut=this.inOut,i.otherInOut=this.otherInOut,i}}function up(i,r){return i[0]===r[0]&&i[1]===r[1]}function uf(i,r,a){let n=function(i,r,a,n,o,s){let l=(r-s)*(a-o),h=(i-o)*(n-s),u=l-h;if(0===l||0===h||l>0!=h>0)return u;let c=Math.abs(l+h);return Math.abs(u)>=33306690738754716e-32*c?u:-function(i,r,a,n,o,s,l){let h,u,c,d,p,f,m,_,g,y,x,v,b,w,T,S,E,I,A=i-o,M=a-o,C=r-s,P=n-s;w=A*P,m=(f=0x8000001*A)-(f-A),_=A-m,g=(f=0x8000001*P)-(f-P),T=_*(y=P-g)-(w-m*g-_*g-m*y),S=C*M,m=(f=0x8000001*C)-(f-C),_=C-m,g=(f=0x8000001*M)-(f-M),x=T-(E=_*(y=M-g)-(S-m*g-_*g-m*y)),p=T-x,un[0]=T-(x+p)+(p-E),p=(v=w+x)-w,x=(b=w-(v-p)+(x-p))-S,p=b-x,un[1]=b-(x+p)+(p-S),p=(I=v+x)-v,un[2]=v-(I-p)+(x-p),un[3]=I;let D=function(i,r){let a=r[0];for(let i=1;i<4;i++)a+=r[i];return a}(0,un),R=22204460492503146e-32*l;if(D>=R||-D>=R||(p=i-A,h=i-(A+p)+(p-o),p=a-M,c=a-(M+p)+(p-o),p=r-C,u=r-(C+p)+(p-s),p=n-P,d=n-(P+p)+(p-s),0===h&&0===u&&0===c&&0===d)||(R=11093356479670487e-47*l+ui*Math.abs(D),(D+=A*d+P*h-(C*c+M*u))>=R||-D>=R))return D;w=h*P,m=(f=0x8000001*h)-(f-h),_=h-m,g=(f=0x8000001*P)-(f-P),T=_*(y=P-g)-(w-m*g-_*g-m*y),S=u*M,m=(f=0x8000001*u)-(f-u),_=u-m,g=(f=0x8000001*M)-(f-M),x=T-(E=_*(y=M-g)-(S-m*g-_*g-m*y)),p=T-x,uh[0]=T-(x+p)+(p-E),p=(v=w+x)-w,x=(b=w-(v-p)+(x-p))-S,p=b-x,uh[1]=b-(x+p)+(p-S),p=(I=v+x)-v,uh[2]=v-(I-p)+(x-p),uh[3]=I;let z=ur(4,un,4,uh,uo);w=A*d,m=(f=0x8000001*A)-(f-A),_=A-m,g=(f=0x8000001*d)-(f-d),T=_*(y=d-g)-(w-m*g-_*g-m*y),S=C*c,m=(f=0x8000001*C)-(f-C),_=C-m,g=(f=0x8000001*c)-(f-c),x=T-(E=_*(y=c-g)-(S-m*g-_*g-m*y)),p=T-x,uh[0]=T-(x+p)+(p-E),p=(v=w+x)-w,x=(b=w-(v-p)+(x-p))-S,p=b-x,uh[1]=b-(x+p)+(p-S),p=(I=v+x)-v,uh[2]=v-(I-p)+(x-p),uh[3]=I;let L=ur(z,uo,4,uh,us);w=h*d,m=(f=0x8000001*h)-(f-h),_=h-m,g=(f=0x8000001*d)-(f-d),T=_*(y=d-g)-(w-m*g-_*g-m*y),S=u*c,m=(f=0x8000001*u)-(f-u),_=u-m,g=(f=0x8000001*c)-(f-c),x=T-(E=_*(y=c-g)-(S-m*g-_*g-m*y)),p=T-x,uh[0]=T-(x+p)+(p-E),p=(v=w+x)-w,x=(b=w-(v-p)+(x-p))-S,p=b-x,uh[1]=b-(x+p)+(p-S),p=(I=v+x)-v,uh[2]=v-(I-p)+(x-p),uh[3]=I;let F=ur(L,us,4,uh,ul);return ul[F-1]}(i,r,a,n,o,s,c)}(i[0],i[1],r[0],r[1],a[0],a[1]);return n>0?-1:+(n<0)}
7function um(i,r){let a=i.point,n=r.point;return a[0]>n[0]?1:a[0]<n[0]?-1:a[1]!==n[1]?a[1]>n[1]?1:-1:i.left!==r.left?i.left?1:-1:0!==uf(a,i.otherEvent.point,r.otherEvent.point)?i.isBelow(r.otherEvent.point)?-1:1:!i.isSubject&&r.isSubject?1:-1}function u_(i,r,a){let n=new ud(r,!1,i,i.isSubject),o=new ud(r,!0,i.otherEvent,i.isSubject);return up(i.point,i.otherEvent.point)&&console.warn("what is that, a collapsed segment?",i),n.contourId=o.contourId=i.contourId,um(o,i.otherEvent)>0&&(i.otherEvent.left=!0,o.left=!1),i.otherEvent.otherEvent=o,i.otherEvent=n,a.push(o),a.push(n),a}function ug(i,r){return i[0]*r[1]-i[1]*r[0]}function uy(i,r){return i[0]*r[0]+i[1]*r[1]}function ux(i,r,a){let n=function(i,r,a,n){let o=[r[0]-i[0],r[1]-i[1]],s=[n[0]-a[0],n[1]-a[1]];function l(i,r,a){return[i[0]+r*a[0],i[1]+r*a[1]]}let h=[a[0]-i[0],a[1]-i[1]],u=ug(o,s),c=u*u,d=uy(o,o);if(c>0){let r=ug(h,s)/u;if(r<0||r>1)return null;let n=ug(h,o)/u;return n<0||n>1?null:0===r||1===r?[l(i,r,o)]:0===n||1===n?[l(a,n,s)]:[l(i,r,o)]}if((c=(u=ug(h,o))*u)>0)return null;let p=uy(o,h)/d,f=p+uy(o,s)/d,m=Math.min(p,f),_=Math.max(p,f);return m<=1&&_>=0?1===m?[l(i,m>0?m:0,o)]:0===_?[l(i,_<1?_:1,o)]:[l(i,m>0?m:0,o),l(i,_<1?_:1,o)]:null}(i.point,i.otherEvent.point,r.point,r.otherEvent.point),o=n?n.length:0;if(0===o||1===o&&(up(i.point,r.point)||up(i.otherEvent.point,r.otherEvent.point))||2===o&&i.isSubject===r.isSubject)return 0;if(1===o)return up(i.point,n[0])||up(i.otherEvent.point,n[0])||u_(i,n[0],a),up(r.point,n[0])||up(r.otherEvent.point,n[0])||u_(r,n[0],a),1;let s=[],l=!1,h=!1;return up(i.point,r.point)?l=!0:1===um(i,r)?s.push(r,i):s.push(i,r),up(i.otherEvent.point,r.otherEvent.point)?h=!0:1===um(i.otherEvent,r.otherEvent)?s.push(r.otherEvent,i.otherEvent):s.push(i.otherEvent,r.otherEvent),l&&h||l?(r.type=1,i.type=r.inOut===i.inOut?2:3,l&&!h&&u_(s[1].otherEvent,s[0].point,a),2):(h?u_(s[0],s[1].point,a):s[0]!==s[3].otherEvent?(u_(s[0],s[1].point,a),u_(s[1],s[2].point,a)):(u_(s[0],s[1].point,a),u_(s[3].otherEvent,s[2].point,a)),3)}function uv(i,r){if(i===r)return 0;if(0!==uf(i.point,i.otherEvent.point,r.point)||0!==uf(i.point,i.otherEvent.point,r.otherEvent.point))return up(i.point,r.point)?i.isBelow(r.otherEvent.point)?-1:1:i.point[0]===r.point[0]?i.point[1]<r.point[1]?-1:1:1===um(i,r)?r.isAbove(i.point)?-1:1:i.isBelow(r.point)?-1:1;if(i.isSubject!==r.isSubject)return i.isSubject?-1:1;{let a=i.point,n=r.point;if(a[0]===n[0]&&a[1]===n[1])return a=i.otherEvent.point,n=r.otherEvent.point,a[0]===n[0]&&a[1]===n[1]?0:(i.contourId??0)>(r.contourId??0)?1:-1}return 1===um(i,r)?1:-1}
7class ub{constructor(){this.points=[],this.holeIds=[],this.holeOf=null,this.depth=null}isExterior(){return null==this.holeOf}}let uw=Math.max,uT=Math.min,uS=0;function uE(i,r,a,n,o,s){let l,h,u,c,d,p;for(l=0,h=i.length-1;l<h;l++){if(u=i[l],c=i[l+1],d=new ud(u,!1,void 0,r),p=new ud(c,!1,d,r),d.otherEvent=p,u[0]===c[0]&&u[1]===c[1])continue;d.contourId=p.contourId=a,s||(d.isExteriorRing=!1,p.isExteriorRing=!1),um(d,p)>0?p.left=!0:d.left=!0;let h=u[0],f=u[1];o[0]=uT(o[0],h),o[1]=uT(o[1],f),o[2]=uw(o[2],h),o[3]=uw(o[3],f),n.push(d),n.push(p)}}let uI=[];function uA(i,r,a){var n,o,s,l;let h,u,c=i,d=r;"number"==typeof i[0][0][0]&&(c=[i]),"number"==typeof r[0][0][0]&&(d=[r]);let p=(n=c,o=d,h=null,n.length*o.length==0&&(0===a?h=uI:2===a?h=n:(1===a||3===a)&&(h=0===n.length?o:n)),h);if(p)return p===uI?null:p;let f=[1/0,1/0,-1/0,-1/0],m=[1/0,1/0,-1/0,-1/0],_=function(i,r,a,n,o){let s,l,h,u,c,d,p=new rF(void 0,um);for(h=0,u=i.length;h<u;h++)for(s=i[h],c=0,d=s.length;c<d;c++)(l=0===c)&&uS++,uE(s[c],!0,uS,p,a,l);for(h=0,u=r.length;h<u;h++)for(s=r[h],c=0,d=s.length;c<d;c++)l=0===c,2===o&&(l=!1),l&&uS++,uE(s[c],!1,uS,p,n,l);return p}(c,d,f,m,a);if(s=c,l=d,u=null,(f[0]>m[2]||m[0]>f[2]||f[1]>m[3]||m[1]>f[3])&&(0===a?u=uI:2===a?u=s:(1===a||3===a)&&(u=s.concat(l))),p=u)return p===uI?null:p;let g=function(i){let r,a,n=function(i){let r,a,n,o,s,l=[];for(a=0,n=i.length;a<n;a++)((r=i[a]).left&&r.inResult||!r.left&&r.otherEvent.inResult)&&l.push(r);let h=!1;for(;!h;)for(h=!0,a=0,n=l.length;a<n;a++)a+1<n&&1===um(l[a],l[a+1])&&(o=l[a],l[a]=l[a+1],l[a+1]=o,h=!1);for(a=0,n=l.length;a<n;a++)(r=l[a]).otherPos=a;for(a=0,n=l.length;a<n;a++)(r=l[a]).left||(s=r.otherPos,r.otherPos=r.otherEvent.otherPos,r.otherEvent.otherPos=s);return l}(i),o={},s=[];for(r=0,a=n.length;r<a;r++){if(o[r])continue;let i=s.length,a=function(i,r,a){let n=new ub;if(null!=i.prevInResult){let o=i.prevInResult,s=o.outputContourId;if(o.resultTransition>0){let i=r[s];if(null!=i.holeOf){let o=i.holeOf;r[o].holeIds.push(a),n.holeOf=o,n.depth=r[s].depth}else r[s].holeIds.push(a),n.holeOf=s,n.depth=r[s].depth+1}else n.holeOf=null,n.depth=r[s].depth}else n.holeOf=null,n.depth=0;return n}(n[r],s,i),l=r=>{o[r]=!0,r<n.length&&n[r]&&(n[r].outputContourId=i)},h=r,u=r;for(a.points.push(n[r].point);l(h),l(h=n[h].otherPos),a.points.push(n[h].point),!((h=function(i,r,a,n){let o,s=i+1,l=r[i].point,h=r.length;for(s<h&&(o=r[s].point);s<h&&o[0]===l[0]&&o[1]===l[1];){if(!a[s])return s;++s<h&&(o=r[s].point)}for(s=i-1;a[s]&&s>n;)s--;return s}(h,n,o,u))==u||h>=n.length)&&n[h];);s.push(a)}return s}(function(i,r,a,n,o,s){let l,h,u,c=new ut(uv),d=[],p=Math.min(n[2],o[2]);for(;0!==i.length;){let r=i.pop();if(d.push(r),0===s&&r.point[0]>p||2===s&&r.point[0]>n[2])break;if(r.left){h=l=c.insert(r),l=l!==(u=c.minNode())?c.prev(l):null,h=c.next(h);let a=l?l.key:null;if(uu(r,a,s),h&&2===ux(r,h.key,i)&&(uu(r,a,s),uu(h.key,r,s)),l&&2===ux(l.key,r,i)){let i=l;uu(a,(i=i!==u?c.prev(i):null)?i.key:null,s),uu(r,a,s)}}else r=r.otherEvent,h=l=c.find(r),l&&h&&(l=l!==u?c.prev(l):null,h=c.next(h),c.remove(r),h&&l&&ux(l.key,h.key,i))}return d}(_,0,0,f,m,a)),y=[];for(let i=0;i<g.length;i++){let r=g[i];if(r.isExterior()){let i=[r.points];for(let a=0;a<r.holeIds.length;a++)i.push(g[r.holeIds[a]].points);y.push(i)}}return y}function uM(i,r,a,n){let o=[],s=0===n?(i,r,a,n,o,s)=>{i.push(new e8(s,a+(s-r)/(n-r)*(o-a)))}:(i,r,a,n,o,s)=>{i.push(new e8(r+(s-a)/(o-a)*(n-r),s))};for(let l of i){let i=[];for(let o of l){if(o.length<=2)continue;let l=[];for(let i=0;i<o.length-1;i++){let h=o[i].x,u=o[i].y,c=o[i+1].x,d=o[i+1].y,p=0===n?h:u,f=0===n?c:d;p<r?f>r&&s(l,h,u,c,d,r):p>a?f<a&&s(l,h,u,c,d,a):l.push(o[i]),f<r&&p>=r&&s(l,h,u,c,d,r),f>a&&p<=a&&s(l,h,u,c,d,a)}let h=o.at(-1),u=0===n?h.x:h.y;u>=r&&u<=a&&l.push(h),l.length&&(h=l.at(-1),l[0].x===h.x&&l[0].y===h.y||l.push(l[0]),i.push(l))}i.length&&o.push(i)}return o}function uC(i,r=1){return[i.map(i=>i.map(i=>[i.x*r,i.y*r]))]}function uP(i,r=1,a){return i.map(i=>i.map((i,n)=>{let o=i.map(i=>{let n=i[0],o=i[1];return a&&(n=Math.round(n/a)*a,o=Math.round(o/a)*a),new e8(n*r,o*r)._round()});return n>0&&o.reverse(),o}))}class uD{constructor(i,r){this.layoutVertexArray=new oC,this.indexArray=new oJ,this.lineIndexArray=new oq,this.triangleSegments=new sy,this.lineSegments=new sy,this.programConfigurations=new sH(i.layers,{zoom:i.zoom,lut:i.lut}),this.uploaded=!1,r&&(this.elevatedLayoutVertexArray=new oR)}update(i,r,a,n,o,s,l,h){this.programConfigurations.updatePaintArrays(i,r,o,a,n,s,l,h)}isEmpty(){return 0===this.layoutVertexArray.length}needsUpload(){return this.programConfigurations.needsUpload}upload(i){this.uploaded||(this.layoutVertexBuffer=i.createVertexBuffer(this.layoutVertexArray,hF.members),this.indexBuffer=i.createIndexBuffer(this.indexArray),this.lineIndexBuffer=i.createIndexBuffer(this.lineIndexArray),this.elevatedLayoutVertexArray&&this.elevatedLayoutVertexArray.length>0&&(this.elevatedLayoutVertexBuffer=i.createVertexBuffer(this.elevatedLayoutVertexArray,hO.members))),this.programConfigurations.upload(i),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(i,r,a,n,o,s,l){this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,i,r,a,n,o,s,void 0,l)}}class uR{constructor(i){this.zoom=i.zoom,this.pixelRatio=i.pixelRatio,this.overscaling=i.overscaling,this.layers=i.layers,this.layerIds=this.layers.map(i=>i.fqid),this.index=i.index,this.hasPattern=!1,this.patternFeatures=[],this.lut=i.lut,this.bufferData=new uD(i,!1),this.elevationBufferData=new uD(i,!0),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.projection=i.projection,this.elevationMode=this.layers[0].layout.get("fill-elevation-reference"),this.sourceLayerIndex=i.sourceLayerIndex,this.worldview=i.worldview,this.hasAppearances=null}updateFootprints(i,r){}updateAppearances(i,r,a,n){return{hasLayoutChanges:!1,hasUboChanges:!1}}populate(i,r,a,n){this.hasPattern=h4("fill",this.layers,this.pixelRatio,r);let o=this.layers[0].layout.get("fill-sort-key"),s=[];for(let{feature:l,id:h,index:u,sourceLayerIndex:c}of i){let i=this.layers[0]._featureFilter.needGeometry,d=ls(l,i);if(!this.layers[0]._featureFilter.filter(new n0(this.zoom,{worldview:this.worldview,activeFloors:r.activeFloors}),d,a))continue;let p=o?o.evaluate(d,{},a,r.availableImages):void 0,f={id:h,properties:l.properties,type:l.type,sourceLayerIndex:c,index:u,geometry:i?d.geometry:lo(l,a,n),patterns:{},sortKey:p};s.push(f)}for(let n of(o&&s.sort((i,r)=>i.sortKey-r.sortKey),s)){let{geometry:o,index:s,sourceLayerIndex:l}=n;if(this.hasPattern){let i=h6("fill",this.layers,n,this.zoom,this.pixelRatio,r);this.patternFeatures.push(i)}else this.addFeature(n,o,s,a,{},r.availableImages,r.brightness,r.elevationFeatures);r.featureIndex.insert(i[s].feature,o,s,l,this.index)}}update(i,r,a,n,o,s,l){this.bufferData.update(i,r,a,n,o,s,l,this.worldview),this.elevationBufferData.update(i,r,a,n,o,s,l,this.worldview),this.elevatedStructures&&this.elevatedStructures.update(i,r,a,n,o,s,l,this.worldview)}updateExpressions(i){this.bufferData.programConfigurations.updateExpressions(i),this.elevationBufferData.programConfigurations.updateExpressions(i),this.elevatedStructures&&(this.elevatedStructures.bridgeProgramConfigurations.updateExpressions(i),this.elevatedStructures.tunnelProgramConfigurations.updateExpressions(i))}addFeatures(i,r,a,n,o,s){for(let o of this.patternFeatures)this.addFeature(o,o.geometry,o.index,r,a,n,s,i.elevationFeatures)}isEmpty(){return this.bufferData.isEmpty()&&this.elevationBufferData.isEmpty()}uploadPending(){return!this.uploaded||this.bufferData.needsUpload()||this.elevationBufferData.needsUpload()}upload(i){this.bufferData.upload(i),this.elevationBufferData.upload(i),this.elevatedStructures&&this.elevatedStructures.upload(i)}destroy(){this.bufferData.destroy(),this.elevationBufferData.destroy(),this.elevatedStructures&&this.elevatedStructures.destroy()}
7addFeature(i,r,a,n,o,s=[],l,h){let u=h2(r,500);"none"!==this.elevationMode?this.addElevatedRoadFeature(i,u,n,a,h):this.addGeometry(u,this.bufferData),this.bufferData.populatePaintArrays(i,a,o,s,n,l,this.worldview),this.elevationBufferData.populatePaintArrays(i,a,o,s,n,l,this.worldview)}getUnevaluatedPortalGraph(){return this.elevatedStructures?this.elevatedStructures.unevaluatedPortals:void 0}setEvaluatedPortalGraph(i,r,a,n,o){this.elevatedStructures&&(this.elevatedStructures.construct(i),this.elevatedStructures.populatePaintArrays(r,a,n,o,this.worldview))}addElevatedRoadFeature(i,r,a,n,o){let s=[],l=lz.getElevationFeature(i,o);if(!l)return void this.addGeometry(r,this.bufferData);{let i=this.clipPolygonsToTile(r,1);i.length>0&&s.push({polygons:i,elevationFeature:l,elevationTileID:a})}let h={guardRailEnabled:this.layers[0].layout.get("fill-construct-bridge-guard-rail").evaluate(i,{},a),featureIndex:n};for(let r of s)if(r.elevationFeature){if("hd-road-base"===this.elevationMode){this.elevatedStructures||(this.elevatedStructures=new h7(r.elevationTileID,this.layers,this.zoom,this.lut));let a=r.elevationFeature.isTunnel(),n=0;Object.hasOwn(i.properties,lm)&&(n=+i.properties[lm]),this.elevatedStructures.addPortalCandidates(r.elevationFeature.id,r.polygons,a,r.elevationFeature,n)}null==r.elevationFeature.constantHeight&&(r.polygons=this.prepareElevatedPolygons(r.polygons,r.elevationFeature,r.elevationTileID));let o=new lL(a,r.elevationTileID);this.addElevatedGeometry(r.polygons,o,r.elevationFeature,.05*("hd-road-base"!==this.elevationMode),n,h)}}addElevatedGeometry(i,r,a,n,o,s){let[l,h]=this.addGeometry(i,this.elevationBufferData,{elevation:a,elevationSampler:r,bias:n,index:o,featureInfo:s});null==this.elevationBufferData.heightRange?this.elevationBufferData.heightRange={min:l,max:h}:(this.elevationBufferData.heightRange.min=Math.min(this.elevationBufferData.heightRange.min,l),this.elevationBufferData.heightRange.max=Math.max(this.elevationBufferData.heightRange.max,h))}addGeometry(i,r,a){let n=1/0,o=-1/0,s=null;a&&null!=(s=a.elevationSampler.constantElevation(a.elevation,a.bias))&&(n=s,o=s);let l=(i,l,h)=>{if(null!=a)if(l.push(i),null!=s)r.elevatedLayoutVertexArray.emplaceBack(s),h.push(s);else{let s=a.elevationSampler.pointElevation(i,a.elevation,a.bias);r.elevatedLayoutVertexArray.emplaceBack(s),h.push(s),n=Math.min(n,s),o=Math.max(o,s)}};for(let n of i){let i=0;for(let r of n)i+=r.length;let o=r.triangleSegments.prepareSegment(i,r.layoutVertexArray,r.indexArray),s=o.vertexLength,h=[],u=[],c=[],d=[],p=[],f=r.layoutVertexArray.length;for(let i of n){if(0===i.length)continue;i!==n[0]&&u.push(h.length/2);let o=r.lineSegments.prepareSegment(i.length,r.layoutVertexArray,r.lineIndexArray),s=o.vertexLength;a&&p.push(r.layoutVertexArray.length-f),l(i[0],c,d),r.layoutVertexArray.emplaceBack(i[0].x,i[0].y),r.lineIndexArray.emplaceBack(s+i.length-1,s),h.push(i[0].x),h.push(i[0].y);for(let a=1;a<i.length;a++)l(i[a],c,d),r.layoutVertexArray.emplaceBack(i[a].x,i[a].y),r.lineIndexArray.emplaceBack(s+a-1,s+a),h.push(i[a].x),h.push(i[a].y);o.vertexLength+=i.length,o.primitiveLength+=i.length}let m=hN(h,u);for(let i=0;i<m.length;i+=3)r.indexArray.emplaceBack(s+m[i],s+m[i+1],s+m[i+2]);if(m.length>0&&a&&"hd-road-base"===this.elevationMode){let i=a.elevation.isTunnel(),r=a.elevation.safeArea,n=this.elevatedStructures.addVertices(c,d);this.elevatedStructures.addTriangles(m,n,i);let o=p.length;if(o>0){for(let s=0;s<o-1;s++)this.elevatedStructures.addRenderableRing(a.index,p[s]+n,p[s+1]-p[s],i,r,a.featureInfo);this.elevatedStructures.addRenderableRing(a.index,p[o-1]+n,c.length-p[o-1],i,r,a.featureInfo)}}o.vertexLength+=i,o.primitiveLength+=m.length/3}return[n,o]}prepareElevatedPolygons(i,r,a){let n=1/li(a),o=[];for(let a of i){let i=function(i,r,a=0){let n=uC(i,65536),o=[];for(;r.valid();r.next()){let[i,n]=r.get(),s=65536*i.x,l=65536*i.y,h=65536*n.x,u=65536*n.y,c=h-s,d=u-l,p=Math.hypot(c,d);if(0===p)continue;s-=c*a,l-=d*a,h+=c*a,u+=d*a;let f=Math.trunc(d/p*3),m=-Math.trunc(c/p*3);o.push([[[s,l],[h,u],[h+f,u+m],[s+f,l+m],[s,l]]])}return o.length>0&&(n=uA(n,o,2)),uP(n,152587890625e-16,128)}(a,new lD(r,n),.1);o.push(...i)}return o}clipPolygonsToTile(i,r){let a=-r,n=-r,o=8192+r,s=8192+r,l=0,h=[],u=[];for(;l<i.length;l++){let r=i[l],c=rv(r);(c.min.x>=a&&c.max.x<=o&&c.min.y>=n&&c.max.y<=s?h:u).push(r)}if(h.length===i.length)return i;let c=[new e8(a,n),new e8(o,n),new e8(o,s),new e8(a,s),new e8(a,n)];for(let i of u)h.push(...function(i,r){let a=uA(uC(i),uC([r]),0);return null==a?[]:uP(a)}(i,c));return h}}nl(uR,"FillBucket",{omit:["layers","patternFeatures"]}),nl(uD,"FillBufferData"),nl(h7,"ElevatedStructures");class uz{constructor(i,r,a,n){if(this.triangleCount=r.length/3,this.min=new e8(0,0),this.max=new e8(0,0),this.xScale=0,this.yScale=0,this.cellsX=0,this.cellsY=0,this.cells=[],this.payload=[],0===this.triangleCount||0===i.length)return;let[o,s]=[i[0].clone(),i[0].clone()];for(let r=1;r<i.length;++r){let a=i[r];o.x=Math.min(o.x,a.x),o.y=Math.min(o.y,a.y),s.x=Math.max(s.x,a.x),s.y=Math.max(s.y,a.y)}if(n&&(a=Math.max(a,Math.ceil(Math.max(s.x-o.x,s.y-o.y)/n))),0===a)return;this.min=o,this.max=s;let l=this.max.sub(this.min);l.x=Math.max(l.x,1),l.y=Math.max(l.y,1);let h=Math.max(l.x,l.y)/a;this.cellsX=Math.max(1,Math.ceil(l.x/h)),this.cellsY=Math.max(1,Math.ceil(l.y/h)),this.xScale=1/h,this.yScale=1/h;let u=[];for(let a=0;a<this.triangleCount;a++){let n=i[r[3*a+0]].sub(this.min),o=i[r[3*a+1]].sub(this.min),s=i[r[3*a+2]].sub(this.min),l=uL(Math.floor(Math.min(n.x,o.x,s.x)),this.xScale,this.cellsX),c=uL(Math.floor(Math.max(n.x,o.x,s.x)),this.xScale,this.cellsX),d=uL(Math.floor(Math.min(n.y,o.y,s.y)),this.yScale,this.cellsY),p=uL(Math.floor(Math.max(n.y,o.y,s.y)),this.yScale,this.cellsY),f=new e8(0,0),m=new e8(0,0),_=new e8(0,0),g=new e8(0,0);for(let i=d;i<=p;++i){f.y=m.y=i*h,_.y=g.y=(i+1)*h;for(let r=l;r<=c;++r)f.x=_.x=r*h,m.x=g.x=(r+1)*h,(lZ(n,o,s,f,m,g)||lZ(n,o,s,f,g,_))&&u.push({cellIdx:i*this.cellsX+r,triIdx:a})}}if(0===u.length)return;u.sort((i,r)=>i.cellIdx-r.cellIdx||i.triIdx-r.triIdx);let c=0;for(;c<u.length;){let i=u[c].cellIdx,r={start:this.payload.length,len:0};for(;c<u.length&&u[c].cellIdx===i;)++r.len,this.payload.push(u[c++].triIdx);this.cells[i]=r}}_lazyInitLookup(){this.lookup||(this.lookup=new Uint8Array(Math.ceil(this.triangleCount/8))),this.lookup.fill(0)}queryPoint(i,r){if(0===this.triangleCount||0===this.cells.length||i.x>this.max.x||this.min.x>i.x||i.y>this.max.y||this.min.y>i.y)return;let a=uL(i.x-this.min.x,this.xScale,this.cellsX),n=uL(i.y-this.min.y,this.yScale,this.cellsY),o=this.cells[n*this.cellsX+a];if(o){this._lazyInitLookup();for(let i=0;i<o.len;i++){let a=this.payload[o.start+i],n=Math.floor(a/8),s=1<<a%8;if(!(this.lookup[n]&s)&&(this.lookup[n]|=s,r.push(a),r.length===this.triangleCount))return}}}query(i,r,a){if(0===this.triangleCount||0===this.cells.length||i.x>this.max.x||this.min.x>r.x||i.y>this.max.y||this.min.y>r.y)return;this._lazyInitLookup();let n=uL(i.x-this.min.x,this.xScale,this.cellsX),o=uL(r.x-this.min.x,this.xScale,this.cellsX),s=uL(i.y-this.min.y,this.yScale,this.cellsY),l=uL(r.y-this.min.y,this.yScale,this.cellsY);for(let i=s;i<=l;i++)for(let r=n;r<=o;r++){let n=this.cells[i*this.cellsX+r];if(n)for(let i=0;i<n.len;i++){let r=this.payload[n.start+i],o=Math.floor(r/8),s=1<<r%8;if(!(this.lookup[o]&s)&&(this.lookup[o]|=s,a.push(r),a.length===this.triangleCount))return}}}}function uL(i,r,a){return Math.max(0,Math.min(a-1,Math.floor(i*r)))}nl(uz,"TriangleGridIndex");class uF{constructor(i){this.zoom=i.zoom,this.layers=i.layers,this.layerIds=this.layers.map(i=>i.fqid),this.index=i.index,this.hasPattern=!1,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.footprints=[],this.worldview=i.worldview,this.hasAppearances=null}updateFootprints(i,r){for(let a of this.footprints)r.push({footprint:a,id:i})}updateAppearances(i,r,a,n){return{hasLayoutChanges:!1,hasUboChanges:!1}}populate(i,r,a,n){let o=[];for(let{feature:s,id:l,index:h,sourceLayerIndex:u}of i){let i=this.layers[0]._featureFilter.needGeometry,c=ls(s,i);if(!this.layers[0]._featureFilter.filter(new n0(this.zoom,{worldview:this.worldview,activeFloors:r.activeFloors}),c,a))continue;let d={id:l,properties:s.properties,type:s.type,sourceLayerIndex:u,index:h,geometry:i?c.geometry:lo(s,a,n),patterns:{}};o.push(d)}for(let n of o){let{geometry:o,index:s,sourceLayerIndex:l}=n;this.addFeature(n,o,s,a,{},r.availableImages,r.brightness),r.featureIndex.insert(i[s].feature,o,s,l,this.index)}}isEmpty(){return 0===this.footprints.length}uploadPending(){return!1}upload(i){}update(i,r,a,n,o,s,l){}destroy(){}addFeature(i,r,a,n,o,s=[],l){for(let i of h2(r,2)){let r=[],a=[],n=[],o=new e8(1/0,1/0),s=new e8(-1/0,-1/0);for(let l of i)if(0!==l.length){l!==i[0]&&n.push(a.length/2);for(let i=0;i<l.length;i++)a.push(l[i].x),a.push(l[i].y),r.push(l[i]),o.x=Math.min(o.x,l[i].x),o.y=Math.min(o.y,l[i].y),s.x=Math.max(s.x,l[i].x),s.y=Math.max(s.y,l[i].y)}let l=hN(a,n),h=new uz(r,l,8,256);this.footprints.push({vertices:r,indices:l,grid:h,min:o,max:s})}}}nl(uF,"ClipBucket",{omit:["layers"]});let uO=oA([{name:"a_pos_normal_ed",components:4,type:"Int16"}]),uB=oA([{name:"a_pos_end",components:4,type:"Int16"},{name:"a_angular_offset_factor",components:1,type:"Int16"}
7]),uk=oA([{name:"a_flood_light_ground_radius",components:1,type:"Float32"}]),uN=oA([{name:"a_centroid_pos",components:2,type:"Uint16"}]),uU=oA([{name:"a_join_normal_inside",components:3,type:"Int16"}]),uV=oA([{name:"a_hidden_by_landmark",components:1,type:"Uint8"}]),uj=oA([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]),{members:uG}=uO,uH=Number.MAX_SAFE_INTEGER,u$=uH-1;function uq(i,r,a,n){return i.order<r||i.order===uH||!(i.clipMask&a)||function(i,r){if(0===r.length)return!1;let a=i;for(;""!==a;){if(r.includes(a))return!1;a=o_(a)}return!0}(n,i.clipScope)}function uZ(i,r){return i.x-r.x||i.y-r.y}function uW(i,r){return 0===uZ(i.min,r.min)&&0===uZ(i.max,r.max)}function uX(i,r){return!(i.min.x>r.max.x||i.max.x<r.min.x||i.min.y>r.max.y||i.max.y<r.min.y)}function uY(i,r){if(i.length!==r.length)return!1;for(let a=0;a<i.length;a++)if(i[a].sourceId!==r[a].sourceId||!uW(i[a],r[a])||i[a].order!==r[a].order||i[a].clipMask!==r[a].clipMask||!e9(i[a].clipScope,r[a].clipScope))return!1;return!0}function uJ(i,r,a){let n=1/(1<<a.canonical.z),o=(1220703125e-13*r.x+a.canonical.x)*n+a.wrap,s=(1220703125e-13*r.y+a.canonical.y)*n;return{min:new e8((1220703125e-13*i.x+a.canonical.x)*n+a.wrap,(1220703125e-13*i.y+a.canonical.y)*n),max:new e8(o,s)}}function uK(i,r,a,n,o,s,l){let h=i.indices,u=i.vertices,c=[];for(let d=n;d<n+o;d+=3){let n=r[a[d+0]+s],o=r[a[d+1]+s],p=r[a[d+2]+s],f=Math.min(n.x,o.x,p.x),m=Math.max(n.x,o.x,p.x),_=Math.min(n.y,o.y,p.y),g=Math.max(n.y,o.y,p.y);c.length=0,i.grid.query(new e8(f,_),new e8(m,g),c);for(let i=0;i<c.length;i++){let r=c[i];if(lZ(u[h[3*r+0]],u[h[3*r+1]],u[h[3*r+2]],n,o,p,l))return!0}}return!1}function uQ(i,r,a,n){let o=Math.pow(2,n.z-a.z);return new e8((i+8192*a.x)*o-8192*n.x,(r+8192*a.y)*o-8192*n.y)}function u0(i,r){let a=[];r.grid.queryPoint(i,a);let n=r.indices,o=r.vertices;for(let r=0;r<a.length;r++){let s=a[r];if(lG([o[n[3*s+0]],o[n[3*s+1]],o[n[3*s+2]]],i))return!0}return!1}let u1={None:0,Model:1,Symbol:2,FillExtrusion:4},u2=[new e8(0,0),new e8(8192,0),new e8(8192,8192),new e8(0,8192)];function u3(i,r){let a=[],n=[];if(!r||i.length<2)return[i];if(2===i.length)return l$(i[0],i[1],u2)?[i]:[];for(let r=0;r<i.length+2;r++){let o=0===r?i.at(-1):i[(r-1)%i.length],s=i[r%i.length],l=i[(r+1)%i.length],h=l$(o,s,u2),u=l$(s,l,u2),c=h||u;c&&n.push(s),c&&u||n.length>0&&(n.length>1&&a.push(n),n=[])}return n.length>1&&a.push(n),a}let u5=ll.types,u4=["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"],u6=["fill-extrusion-flood-light-ground-radius"],u8=new e8(0,1);function u9(i,r,a,n,o,s,l,h){i.emplaceBack((r<<1)+l,(a<<1)+s,(Math.floor(8192*n)<<1)+o,Math.round(h))}function u7(i,r,a){i.emplaceBack(8192*r.x,8192*r.y,+!!a)}function ce(i,r,a,n,o,s){i.emplaceBack(r.x,r.y,(a.x<<1)+n,(a.y<<1)+o,s)}function ct(i,r,a){i.emplaceBack(r.x,r.y,r.z,16384*a[0],16384*a[1],16384*a[2])}class ci{constructor(){this.vertexOffset=0,this.vertexCount=0,this.indexOffset=0,this.indexCount=0}}class cr{constructor(){this.data=[]}get length(){return this.data.length}push(i){this.data.push(i)}get(i){return this.data[i]}static serialize(i,r){let a=i.data.length,n=new Uint32Array(4*a),o=[];o.length=a;for(let r=0;r<a;r++){let a=i.data[r],s=4*r;n[s]=a.vertexOffset,n[s+1]=a.vertexCount,n[s+2]=a.indexOffset,n[s+3]=a.indexCount,o[r]=a.ringIndices}return r&&r.add(n.buffer),{scalars:n,rings:o}}static deserialize(i){let{scalars:r,rings:a}=i,n=r.length/4,o=new cr,s=[];s.length=n,o.data=s;for(let i=0;i<n;i++){let n=4*i,s=new ci;s.vertexOffset=r[n],s.vertexCount=r[n+1],s.indexOffset=r[n+2],s.indexCount=r[n+3],s.ringIndices=a[i],o.data[i]=s}return o}}class ca{constructor(){this.centroidXY=new e8(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 e8(Number.MAX_VALUE,Number.MAX_VALUE),this.max=new e8(-Number.MAX_VALUE,-Number.MAX_VALUE),this.height=0,this.buildingId=0,this.groupCentroidPos=new e8(0,0)}span(){return new e8(this.max.x-this.min.x,this.max.y-this.min.y)}}class cn{constructor(){this.data=[],this.buffer=null}get length(){return this.data.length}push(i){this.data.push(i)}get(i){return this.data[i]}find(i){return this.data.find(i)}[Symbol.iterator](){return this.data[Symbol.iterator]()}static serialize(i,r){let a=i.data.length,n=new Float64Array(15*a);for(let r=0;r<a;
7r++){let a=i.data[r],o=15*r;n[o]=a.centroidXY.x,n[o+1]=a.centroidXY.y,n[o+2]=a.min.x,n[o+3]=a.min.y,n[o+4]=a.max.x,n[o+5]=a.max.y,n[o+6]=a.groupCentroidPos.x,n[o+7]=a.groupCentroidPos.y,n[o+8]=a.vertexArrayOffset,n[o+9]=a.vertexCount,n[o+10]=a.groundVertexArrayOffset,n[o+11]=a.groundVertexCount,n[o+12]=a.footprintSegLen,n[o+13]=a.height,n[o+14]=a.buildingId}return r&&r.add(n.buffer),{buffer:n}}static deserialize(i){let r=i.buffer,a=r.length/15,n=new cn;n.buffer=r;let o=[];o.length=a,n.data=o;let s=0;for(let i=0;i<a;i++){let a=15*i,o=new ca;o.centroidXY=new e8(r[a],r[a+1]),o.min=new e8(r[a+2],r[a+3]),o.max=new e8(r[a+4],r[a+5]),o.groupCentroidPos=new e8(r[a+6],r[a+7]),o.vertexArrayOffset=r[a+8],o.vertexCount=r[a+9],o.groundVertexArrayOffset=r[a+10],o.groundVertexCount=r[a+11],o.footprintSegLen=r[a+12],o.height=r[a+13],o.buildingId=r[a+14],o.footprintSegIdx=s,s+=o.footprintSegLen,n.data[i]=o}return n}}class co{constructor(){this.acc=new e8(0,0),this.accCount=0,this.centroidDataIndex=0}startRing(i,r){i.min.x===Number.MAX_VALUE&&(i.min.x=i.max.x=r.x,i.min.y=i.max.y=r.y)}appendEdge(i,r,a){this.accCount++,this.acc._add(r);let n=!!this.borders;r.x<i.min.x?(i.min.x=r.x,n=!0):r.x>i.max.x&&(i.max.x=r.x,n=!0),r.y<i.min.y?(i.min.y=r.y,n=!0):r.y>i.max.y&&(i.max.y=r.y,n=!0),((0===r.x||8192===r.x)&&r.x===a.x)!=((0===r.y||8192===r.y)&&r.y===a.y)&&this.processBorderOverlap(r,a),n&&this.checkBorderIntersection(r,a)}checkBorderIntersection(i,r){r.x<0!=i.x<0&&this.addBorderIntersection(0,iE(r.y,i.y,(0-r.x)/(i.x-r.x))),r.x>8192!=i.x>8192&&this.addBorderIntersection(1,iE(r.y,i.y,(8192-r.x)/(i.x-r.x))),r.y<0!=i.y<0&&this.addBorderIntersection(2,iE(r.x,i.x,(0-r.y)/(i.y-r.y))),r.y>8192!=i.y>8192&&this.addBorderIntersection(3,iE(r.x,i.x,(8192-r.y)/(i.y-r.y)))}addBorderIntersection(i,r){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]]);let a=this.borders[i];r<a[0]&&(a[0]=r),r>a[1]&&(a[1]=r)}processBorderOverlap(i,r){if(i.x===r.x){if(i.y===r.y)return;let a=+(0!==i.x);this.addBorderIntersection(a,r.y),this.addBorderIntersection(a,i.y)}else{let a=0===i.y?2:3;this.addBorderIntersection(a,r.x),this.addBorderIntersection(a,i.x)}}centroid(){return 0===this.accCount?new e8(0,0):new e8(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((i,r)=>i+ +(r[0]!==Number.MAX_VALUE),0):0}}function cs(i,r){let a=i.add(r)._unit();return Math.min(4,Math.max(-4,Math.tan(Math.acos(tl(i.x*a.x+i.y*a.y,-1,1)))))/4*32767*(i.x*r.y-i.y*r.x<0?-1:1)}let cl=[i=>i.x<0,i=>i.x>8192,i=>i.y<0,i=>i.y>8192];class ch{constructor(i){this.groundRadiusArray=null,this.groundRadiusBuffer=null,this.vertexArray=new oO,this.indexArray=new oJ,this.programConfigurations=new sH(i.layers,{zoom:i.zoom,lut:i.lut},i=>u6.includes(i)),this._segments=new sy,this.hiddenByLandmarkVertexArray=new st,this._segmentToGroundQuads={},this._segmentToGroundQuads[0]=[],this._segmentToRegionTriCounts={},this._segmentToRegionTriCounts[0]=[0,0,0,0,0],this.regionSegments={},this.regionSegments[4]=new sy}getDefaultSegment(){return this.regionSegments[4]}hasData(){return 0!==this.vertexArray.length}addData(i,r,a,n=!1){let o=i.length;if(o>2){let s,l=Math.max(0,this._segments.get().length-1),h=this._segments._prepareSegment(4*o,this.vertexArray.length,2*this._segmentToGroundQuads[l].length);l!==this._segments.get().length-1&&(l++,this._segmentToGroundQuads[l]=[],this._segmentToRegionTriCounts[l]=[0,0,0,0,0]);{let r=i[0],a=i[1];s=cs(r.sub(i[o-1])._perp()._unit(),a.sub(r)._perp()._unit())}for(let u=0;u<o;u++){let c=u===o-1?0:u+1,d=i[u],p=i[c],f=i[c===o-1?0:c+1],m=p.sub(d)._perp()._unit(),_=cs(m,f.sub(p)._perp()._unit()),g=s;if(cp(d,p,r)||n&&cf(d,r)&&cf(p,r)){s=_;continue}let y=h.vertexLength;for(let i of(ce(this.vertexArray,d,p,1,1,g),ce(this.vertexArray,d,p,1,0,g),ce(this.vertexArray,d,p,0,1,_),ce(this.vertexArray,d,p,0,0,_),h.vertexLength+=4,function(i,r,a,n){let o=[4];if(0===n)return o;a._mult(n);let s=i.sub(a),l=r.sub(a),h=[i,r,s,l];for(let i=0;i<4;i++)for(let r of h)if(cl[i](r)){o.push(i);break}return o}(d,p,m,a)))this._segmentToGroundQuads[l].push({id:y,region:i}),this._segmentToRegionTriCounts[l][i]+=2,h.primitiveLength+=2;s=_}}}prepareBorderSegments(){if(!this.hasData())return;let i=this._segments.get(),r=i.length;for(let i=0;i<r;i++)this._segmentToGroundQuads[i].sort((i,r)=>i.region-r.region);for(let a=0;a<r;a++){let r=this._segmentToGroundQuads[a],n=i[a],o=this._segmentToRegionTriCounts[a];o.reduce((i,r)=>i+r,0);let s=0;for(let i=0;i<=4;i++){let r=o[i];if(0!==r){let a=this.regionSegments[i];a||(a=this.regionSegments[i]=new sy);let o={vertexOffset:n.vertexOffset,primitiveOffset:n.primitiveOffset+s,vertexLength:n.vertexLength,primitiveLength:r};a.get().push(o)}s+=r}for(let i=0;i<r.length;i++){let a=r[i].id;this.indexArray.emplaceBack(a,a+1,a+3),this.indexArray.emplaceBack(a,a+3,a+2)}}this._segmentToGroundQuads=null,this._segmentToRegionTriCounts=null,this._segments.destroy(),this._segments=null}addPaintPropertiesData(i,r,a,n,o,s,l){this.hasData()&&this.programConfigurations.populatePaintArrays(this.vertexArray.length,i,r,a,n,o,s,void 0,l)}upload(i){this.hasData()&&(this.vertexBuffer=i.createVertexBuffer(this.vertexArray,uB.members),this.indexBuffer=i.createIndexBuffer(this.indexArray),null!=this.groundRadiusArray&&(this.groundRadiusBuffer=i.createVertexBuffer(this.groundRadiusArray,uk.members)))}uploadPaintProperties(i){this.hasData()&&this.programConfigurations.upload(i)}update(i,r,a,n,o,s,l,h){this.hasData()&&this.programConfigurations.updatePaintArrays(i,r,a,n,o,s,l,h)}updateHiddenByLandmark(i){this.updateHiddenByLandmarkRange(i.groundVertexArrayOffset,i.groundVertexCount,!!(0x80000000&i.flags||0x40000000&i.flags))}updateHiddenByLandmarkRange(i,r,a){if(!this.hasData())return;let n=r+i;if(0!==r){for(let r=i;r<n;++r)this.hiddenByLandmarkVertexArray.emplace(r,+!!a);this._needsHiddenByLandmarkUpdate=!0}}uploadHiddenByLandmark(i){this.hasData()&&this._needsHiddenByLandmarkUpdate&&(!this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexArray.length>0?this.hiddenByLandmarkVertexBuffer=i.createVertexBuffer(this.hiddenByLandmarkVertexArray,uV.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 i=0;i<=4;i++){let r=this.regionSegments[i];r&&r.destroy()}}}}class cu{constructor(i){this.zoom=i.zoom,this.canonical=i.canonical,this.overscaling=i.overscaling,this.layers=i.layers,this.pixelRatio=i.pixelRatio,this.layerIds=this.layers.map(i=>i.fqid),this.index=i.index,this.hasPattern=!1,this.edgeRadius=0,this.projection=i.projection,this.activeReplacements=[],this.replacementUpdateTime=0,this.centroidData=new cn,this.footprintIndices=new oJ,this.footprintVertices=new oC,this.footprintSegments=new cr,this.layoutVertexArray=new oF,this.centroidVertexArray=new sd,this.wallVertexArray=new sf,this.indexArray=new oJ,this.programConfigurations=new sH(i.layers,{zoom:i.zoom,lut:i.lut},i=>u4.includes(i)),this.segments=new sy,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.groundEffect=new ch(i),this.maxHeight=0,this.partLookup={},this.triangleSubSegments=[],this.polygonSegments=[],this.buildingGroups=new Map,this.worldview=i.worldview,this.hasAppearances=null}updateFootprints(i,r){}updateAppearances(i,r,a,n){return{hasLayoutChanges:!1,hasUboChanges:!1}}populate(i,r,a,n){for(let{feature:o,id:s,index:l,sourceLayerIndex:h}of(this.features=[],this.hasPattern=h4("fill-extrusion",this.layers,this.pixelRatio,r),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=li(a),this.edgeRadius=this.layers[0].layout.get("fill-extrusion-edge-radius")/this.tileToMeter,this.wallMode=0!==this.layers[0].paint.get("fill-extrusion-line-width").constantOr(1),i)){let i=this.layers[0]._featureFilter.needGeometry,u=ls(o,i);if(!this.layers[0]._featureFilter.filter(new n0(this.zoom,{worldview:this.worldview,activeFloors:r.activeFloors}),u,a))continue;let c={id:s,sourceLayerIndex:h,index:l,geometry:i?u.geometry:lo(o,a,n),properties:o.properties,type:o.type,patterns:{}},d=this.layoutVertexArray.length,p="Polygon"===u5[c.type];if(this.hasPattern)this.features.push({featureId:o.id,feature:h6("fill-extrusion",this.layers,c,this.zoom,this.pixelRatio,r)});else if(this.wallMode)for(let i of c.geometry)for(let s of u3(i,p))this.addFeature(o.id,c,[s],l,a,{},r.availableImages,n,r.brightness);else this.addFeature(o.id,c,c.geometry,l,a,{},r.availableImages,n,r.brightness);r.featureIndex.insert(o,c.geometry,l,h,this.index,d)}this._finalizeBuildingGroups(),this.sortBorders(),"mercator"===this.projection.name&&this.splitToSubtiles(),this.groundEffect.prepareBorderSegments(),this.polygonSegments.length=0}addFeatures(i,r,a,n,o,s){for(let{featureId:i,feature:l}of this.features){let h="Polygon"===u5[l.type],{geometry:u}=l;if(this.wallMode)for(let c of u)for(let u of u3(c,h))this.addFeature(i,l,[u],l.index,r,a,n,o,s);else this.addFeature(i,l,u,l.index,r,a,n,o,s)}this._finalizeBuildingGroups(),this.sortBorders(),"mercator"===this.projection.name&&this.splitToSubtiles()}update(i,r,a,n,o,s,l){this.programConfigurations.updatePaintArrays(i,r,o,a,n,s,l,this.worldview),this.groundEffect.update(i,r,o,a,n,s,l,this.worldview)}updateExpressions(i){this.programConfigurations.updateExpressions(i),this.groundEffect.programConfigurations.updateExpressions(i)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload||this.groundEffect.programConfigurations.needsUpload}upload(i){this.uploaded||(this.layoutVertexBuffer=i.createVertexBuffer(this.layoutVertexArray,uG),this.indexBuffer=i.createIndexBuffer(this.indexArray),this.wallVertexBuffer=i.createVertexBuffer(this.wallVertexArray,uU.members),this.layoutVertexExtArray&&(this.layoutVertexExtBuffer=i.createVertexBuffer(this.layoutVertexExtArray,uj.members,!0)),this.groundEffect.upload(i)),this.groundEffect.uploadPaintProperties(i),this.programConfigurations.upload(i),this.uploaded=!0}uploadCentroid(i){this.groundEffect.uploadHiddenByLandmark(i),this.needsCentroidUpdate&&(!this.centroidVertexBuffer&&this.centroidVertexArray.length>0?this.centroidVertexBuffer=i.createVertexBuffer(this.centroidVertexArray,uN.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(i,r,a,n,o,s,l,h,u){let c,d,p=this.layers[0].paint.get("fill-extrusion-flood-light-ground-radius").evaluate(r,{})/this.tileToMeter,f=[new e8(0,0),new e8(8192,8192)],m=h.projection,_="globe"===m.name,g=this.wallMode||"Polygon"===u5[r.type],y=new co;y.centroidDataIndex=this.centroidData.length;let x=new ca;x.buildingId=i,r.properties&&Object.hasOwn(r.properties,"building_id")&&(x.buildingId=Number(r.properties.building_id)),y.buildingId=x.buildingId;let v=0>=this.layers[0].paint.get("fill-extrusion-base").evaluate(r,{},o),b=this.layers[0].paint.get("fill-extrusion-height").evaluate(r,{},o);if(x.height=b,x.vertexArrayOffset=this.layoutVertexArray.length,x.groundVertexArrayOffset=this.groundEffect.vertexArray.length,_&&!this.layoutVertexExtArray&&(this.layoutVertexExtArray=new oV),this.wallMode){if(_)return void tw("Non zero fill-extrusion-line-width is not yet supported on globe.");if(1!==a.length)return;a=[(c=function(i){let r=i[0].x===i.at(-1).x&&i[0].y===i.at(-1).y;(function(i){let r=0,a=i.length;for(let n=0;n<a;
7n++)r+=(i[(n+1)%a].x-i[n].x)*(i[(n+1)%a].y+i[n].y);return r>=0})(i)||(i=i.reverse());let a={geometry:[],joinNormals:[],indices:[]},n=[],o=[],s=[],l=i.length;for(;l>=2&&i[l-1].equals(i[l-2]);)l--;if(l<(r?3:2))return a;let h,u,c,d,p,f=0;for(;f<l-1&&i[f].equals(i[f+1]);)f++;r&&(h=i[l-2],p=i[f].sub(h)._unit()._perp());for(let a=f;a<l;a++){if((c=a===l-1?r?i[f+1]:void 0:i[a+1])&&i[a].equals(c))continue;p&&(d=p),h&&(u=h),h=i[a],p=c?c.sub(h)._unit()._perp():d;let m=(d=d||p).add(p);0===m.x&&0===m.y||m._unit();let _=m.x*p.x+m.y*p.y,g=0!==_?1/_:1/0,y=d.x*p.y-d.y*p.x>0,x="miter";"miter"===x&&g>2&&(x="bevel"),"bevel"===x&&(g>100&&(x="flipbevel"),g<2&&(x="miter"));let v=(i,r,a,l)=>{let h=new e8(i.x,i.y),u=new e8(i.x,i.y);h.x+=r.x*l,h.y+=r.y*l,u.x-=r.x*Math.max(a,1),u.y-=r.y*Math.max(a,1),s.push(r),n.push(h),o.push(u)};if("miter"===x)m._mult(g),v(h,m,0,0);else if("flipbevel"===x)v(h,m=p.mult(-1),0,0),v(h,m.mult(-1),0,0);else{let i=-Math.sqrt(g*g-1),r=y?i:0,a=y?0:i;u&&v(h,d,r,a),c&&v(h,p,r,a)}}a.geometry=[...n,...o.reverse(),n[0]],a.joinNormals=[...s,...s.reverse(),s.at(-1)];let m=a.geometry.length-1;for(let i=0;i<m/2;i++)if(i+1<m/2){let r=i,n=i+1,o=m-1-i,s=m-2-i;r=0===r?m-1:r-1,n=0===n?m-1:n-1,o=0===o?m-1:o-1,s=0===s?m-1:s-1,a.indices.push(o),a.indices.push(n),a.indices.push(r),a.indices.push(o),a.indices.push(s),a.indices.push(n)}return a}(a[0])).geometry]}let w=(i,r)=>i<(r.length-1)/2||i===r.length-1,T=this.wallMode?[a]:h2(a,500);for(let i=T.length-1;i>=0;i--){var S;let r=T[i];(0===r.length||(S=r[0]).every(i=>i.x<=0)||S.every(i=>i.x>=8192)||S.every(i=>i.y<=0)||S.every(i=>i.y>=8192))&&T.splice(i,1)}if(_)d=cy(T,f,o);else for(let i of(d=[],T))d.push({polygon:i,bounds:f});let E=g?this.edgeRadius:0,I=E>0&&this.zoom<17,A=(i,r)=>{if(0===i.length)return!1;let a=i.at(-1);return r.x===a.x&&r.y===a.y};for(let{polygon:i,bounds:r}of d){let a=0,n=0;for(let r of i)g&&!r[0].equals(r.at(-1))&&r.push(r[0]),n+=g?r.length-1:r.length;let s=this.segments.prepareSegment((g?5:4)*n,this.layoutVertexArray,this.indexArray);x.footprintSegIdx<0&&(x.footprintSegIdx=this.footprintSegments.length),x.polygonSegIdx<0&&(x.polygonSegIdx=this.polygonSegments.length);let l={triangleArrayOffset:this.indexArray.length,triangleCount:0,triangleSegIdx:this.segments.segments.length-1},h=new ci;if(h.vertexOffset=this.footprintVertices.length,h.indexOffset=3*this.footprintIndices.length,h.ringIndices=[],g){let n=[],l=[];a=s.vertexLength;for(let a=0;a<i.length;a++){let u,d,f=i[a];f.length&&0!==a&&l.push(n.length/2);let g=[];u=f[1].sub(f[0])._perp()._unit(),h.ringIndices.push(f.length-1);for(let i=1;i<f.length;i++){let r=f[i],a=f[i===f.length-1?1:i+1],l=r.clone();if(E){d=a.sub(r)._perp()._unit();let i=u.add(d)._unit(),n=E*Math.min(4,1/(u.x*i.x+u.y*i.y));l.x+=n*i.x,l.y+=n*i.y,l.x=Math.round(l.x),l.y=Math.round(l.y),u=d}if(!v||0!==E&&!I||A(g,l)||g.push(l),u9(this.layoutVertexArray,l.x,l.y,0,0,1,1,0),this.wallMode){let r=w(i,f);u7(this.wallVertexArray,c.joinNormals[i],!r)}s.vertexLength++,this.footprintVertices.emplaceBack(r.x,r.y),n.push(r.x,r.y),_&&ct(this.layoutVertexExtArray,m.projectTilePoint(l.x,l.y,o),m.upVector(o,l.x,l.y))}v&&(0===E||I)&&(0!==g.length&&A(g,g[0])&&g.pop(),this.groundEffect.addData(g,r,p))}let u=this.wallMode?c.indices:hN(n,l);for(let i=0;i<u.length;i+=3)this.footprintIndices.emplaceBack(h.vertexOffset+u[i+0],h.vertexOffset+u[i+1],h.vertexOffset+u[i+2]),this.indexArray.emplaceBack(a+u[i],a+u[i+2],a+u[i+1]),s.primitiveLength++;h.indexCount+=u.length,h.vertexCount+=this.footprintVertices.length-h.vertexOffset}for(let n=0;n<i.length;n++){let l,h,u,d=i[n];y.startRing(x,d[0]);let f=d.length>4&&cm(d[d.length-2],d[0],d[1]),b=E?function(i,r,a,n){let o=r.sub(i)._perp()._unit(),s=a.sub(r)._perp()._unit();return cd(i,r,a,cc(o,s),n)}(d[d.length-2],d[0],d[1],E):0,T=[];h=d[1].sub(d[0])._perp()._unit();let S=!0;for(let i=1,n=0;i<d.length;i++){let p=d[i-1],g=d[i],I=d[i===d.length-1?1:i+1];if(y.appendEdge(x,g,p),cp(g,p,r)){E&&(h=I.sub(g)._perp()._unit(),S=!S);continue}let M=g.sub(p)._perp(),C=M.x/(Math.abs(M.x)+Math.abs(M.y)),P=+(M.y>0),D=p.dist(g);if(n+D>32768&&(n=0),E){u=I.sub(g)._perp()._unit();let i=cd(p,g,I,cc(h,u),E);isNaN(i)&&(i=0);let r=g.sub(p)._unit();p=p.add(r.mult(b))._round(),g=g.add(r.mult(-i))._round(),b=i,h=u,v&&this.zoom>=17&&(A(T,p)||T.push(p),A(T,g)||T.push(g))}let R=s.vertexLength,z=d.length>4&&cm(p,g,I),L=c_(n,f,S);if(u9(this.layoutVertexArray,p.x,p.y,C,P,0,0,L),u9(this.layoutVertexArray,p.x,p.y,C,P,0,1,L),this.wallMode){let r=w(i-1,d),a=c.joinNormals[i-1];u7(this.wallVertexArray,a,r),u7(this.wallVertexArray,a,r)}if(n+=D,L=c_(n,z,!S),f=z,u9(this.layoutVertexArray,g.x,g.y,C,P,0,0,L),u9(this.layoutVertexArray,g.x,g.y,C,P,0,1,L),this.wallMode){let r=w(i,d),a=c.joinNormals[i];u7(this.wallVertexArray,a,r),u7(this.wallVertexArray,a,r)}if(s.vertexLength+=4,this.indexArray.emplaceBack(R+0,R+1,R+2),this.indexArray.emplaceBack(R+1,R+3,R+2),s.primitiveLength+=2,E){let n=a+(1===i?d.length-2:i-2),o=1===i?a:n+1;if(this.indexArray.emplaceBack(R+1,n,R+3),this.indexArray.emplaceBack(n,o,R+3),s.primitiveLength+=2,void 0===l&&(l=R),!cp(I,d[i],r)){let r=i===d.length-1?l:s.vertexLength;this.indexArray.emplaceBack(R+2,R+3,r),this.indexArray.emplaceBack(R+3,r+1,r),this.indexArray.emplaceBack(R+3,o,r+1),s.primitiveLength+=3}S=!S}if(_){let i=this.layoutVertexExtArray,r=m.projectTilePoint(p.x,p.y,o),a=m.projectTilePoint(g.x,g.y,o),n=m.upVector(o,p.x,p.y),s=m.upVector(o,g.x,g.y);ct(i,r,n),ct(i,r,n),ct(i,a,s),ct(i,a,s)}}g&&(a+=d.length-1),v&&E&&this.zoom>=17&&(0!==T.length&&A(T,T[0])&&T.pop(),this.groundEffect.addData(T,r,p,E>0))}this.footprintSegments.push(h),l.triangleCount=this.indexArray.length-l.triangleArrayOffset,this.polygonSegments.push(l),++x.footprintSegLen,++x.polygonSegLen}if(x.vertexCount=this.layoutVertexArray.length-x.vertexArrayOffset,x.groundVertexCount=this.groundEffect.vertexArray.length-x.groundVertexArrayOffset,0!==x.vertexCount){if(x.centroidXY=y.borders?u8:this.encodeCentroid(y,x),r.properties&&Object.hasOwn(r.properties,"building_id")){let i=x.buildingId,r=this.buildingGroups.get(i);r||(r={accX:0,accY:0,accCount:0,mergedMin:new e8(Number.MAX_VALUE,Number.MAX_VALUE),mergedMax:new e8(-Number.MAX_VALUE,-Number.MAX_VALUE),partIndices:[]},this.buildingGroups.set(i,r)),r.accX+=y.acc.x,r.accY+=y.acc.y,r.accCount+=y.accCount,r.mergedMin.x=Math.min(r.mergedMin.x,x.min.x),r.mergedMin.y=Math.min(r.mergedMin.y,x.min.y),r.mergedMax.x=Math.max(r.mergedMax.x,x.max.x),r.mergedMax.y=Math.max(r.mergedMax.y,x.max.y),r.partIndices.push(this.centroidData.length)}if(this.centroidData.push(x),y.borders){this.featuresOnBorder.push(y);let i=this.featuresOnBorder.length-1;for(let r=0;r<y.borders.length;r++)y.borders[r][0]!==Number.MAX_VALUE&&this.borderFeatureIndices[r].push(i)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,r,n,s,l,o,u,void 0,this.worldview),this.groundEffect.addPaintPropertiesData(r,n,s,l,o,u,this.worldview),this.maxHeight=Math.max(this.maxHeight,b)}}_finalizeBuildingGroups(){for(let[,i]of this.buildingGroups){if(0===i.partIndices.length)continue;let r=new co;r.acc=new e8(i.accX,i.accY),r.accCount=i.accCount;let a=new ca;a.min=i.mergedMin,a.max=i.mergedMax;let n=this.encodeCentroid(r,a),o=r.centroid();for(let r of i.partIndices){let a=this.centroidData.get(r);a.centroidXY.x===u8.x&&a.centroidXY.y===u8.y||(a.centroidXY=n),a.min=i.mergedMin,a.max=i.mergedMax,a.groupCentroidPos=o}}this.buildingGroups.clear()}sortBorders(){for(let i=0;i<this.borderFeatureIndices.length;i++)this.borderFeatureIndices[i].sort((r,a)=>this.featuresOnBorder[r].borders[i][0]-this.featuresOnBorder[a].borders[i][0])}splitToSubtiles(){let i=[];for(let r=0;r<this.centroidData.length;r++){let a=this.centroidData.get(r),n=+(a.min.y+a.max.y>8192),o=2*n+(a.min.x+a.max.x>8192^n);for(let n=0;n<a.polygonSegLen;n++){let s=a.polygonSegIdx+n;
7i.push({centroidIdx:r,subtile:o,polygonSegmentIdx:s,triangleSegmentIdx:this.polygonSegments[s].triangleSegIdx})}}let r=new oJ;i.sort((i,r)=>i.triangleSegmentIdx===r.triangleSegmentIdx?i.subtile-r.subtile:i.triangleSegmentIdx-r.triangleSegmentIdx);let a=0,n=0,o=0;for(let r of i){if(r.triangleSegmentIdx!==a)break;o++}let s=i.length;for(;n!==i.length;){a=i[n].triangleSegmentIdx;let l=0,h=n,u=n;for(let r=h;r<o&&i[r].subtile===l;r++)u++;for(;h!==o;){let n=i[h];l=n.subtile;let s=this.centroidData.get(n.centroidIdx).min.clone(),c=this.centroidData.get(n.centroidIdx).max.clone(),d={vertexOffset:this.segments.segments[a].vertexOffset,primitiveOffset:r.length,vertexLength:this.segments.segments[a].vertexLength,primitiveLength:0,sortKey:void 0,vaos:{}};for(let a=h;a<u;a++){let n=i[a],o=this.polygonSegments[n.polygonSegmentIdx],l=this.centroidData.get(n.centroidIdx).min,h=this.centroidData.get(n.centroidIdx).max,u=this.indexArray.uint16;for(let i=o.triangleArrayOffset;i<o.triangleArrayOffset+o.triangleCount;i++)r.emplaceBack(u[3*i],u[3*i+1],u[3*i+2]);d.primitiveLength+=o.triangleCount,s.x=Math.min(s.x,l.x),s.y=Math.min(s.y,l.y),c.x=Math.max(c.x,h.x),c.y=Math.max(c.y,h.y)}d.primitiveLength>0&&this.triangleSubSegments.push({segment:d,min:s,max:c}),h=u;for(let r=h;r<o&&i[r].subtile===i[h].subtile;r++)u++}n=o;for(let r=n;r<s&&i[r].triangleSegmentIdx===i[n].triangleSegmentIdx;r++)o++}r._trim(),this.indexArray=r}getVisibleSegments(i,r,a){let n,o=new sy;if(this.wallMode){for(let i of this.triangleSubSegments)o.segments.push(i.segment);return o}let s=0,l=0,h=1<<i.canonical.z;if(r){let a=r.getMinMaxForTile(i);a&&(s=a.min,l=a.max)}l+=this.maxHeight;let u=i.toUnwrapped(),c=[u.canonical.x/h+u.wrap,u.canonical.y/h],d=[(u.canonical.x+1)/h+u.wrap,(u.canonical.y+1)/h],p=(i,r,a)=>[i[0]*(1-a[0])+r[0]*a[0],i[1]*(1-a[1])+r[1]*a[1]],f=[],m=[];for(let i of this.triangleSubSegments){f[0]=i.min.x/8192,f[1]=i.min.y/8192,m[0]=i.max.x/8192,m[1]=i.max.y/8192;let r=p(c,d,f),h=p(c,d,m);if(0===new lP([r[0],r[1],s],[h[0],h[1],l]).intersectsPrecise(a)){n&&(o.segments.push(n),n=void 0);continue}let u=i.segment;n&&n.vertexOffset!==u.vertexOffset&&(o.segments.push(n),n=void 0),n?(n.vertexLength+=u.vertexLength,n.primitiveLength+=u.primitiveLength):n={vertexOffset:u.vertexOffset,primitiveLength:u.primitiveLength,vertexLength:u.vertexLength,primitiveOffset:u.primitiveOffset,sortKey:void 0,vaos:{}}}return n&&o.segments.push(n),o}encodeCentroid(i,r){let a=i.centroid(),n=r.span(),o=Math.min(7,Math.round(n.x*this.tileToMeter/10)),s=Math.min(6,Math.round(n.y*this.tileToMeter/10));return new e8(tl(a.x,1,8191)<<3|o,tl(a.y,1,8191)<<3|s)}encodeBorderCentroid(i){if(!i.borders)return new e8(0,0);let r=i.borders,a=Number.MAX_VALUE;if(r[0][0]!==a||r[1][0]!==a){let i=+(r[0][0]===a);return new e8(6|65528*(r[0][0]===a),(r[i][0]+r[i][1])/2<<3|6)}{let i=r[2][0]!==a?2:3;return new e8((r[i][0]+r[i][1])/2<<3|6,6|65528*(r[2][0]===a))}}showCentroid(i){let r=this.centroidData.get(i.centroidDataIndex);if(r.flags&=0x80000000,0!==r.groupCentroidPos.x||0!==r.groupCentroidPos.y){let i=r.span(),a=Math.min(7,Math.round(i.x*this.tileToMeter/10)),n=Math.min(6,Math.round(i.y*this.tileToMeter/10));r.centroidXY=new e8(tl(r.groupCentroidPos.x,1,8191)<<3|a,tl(r.groupCentroidPos.y,1,8191)<<3|n)}else r.centroidXY=new e8(0,0);this.writeCentroidToBuffer(r)}writeCentroidToBuffer(i){this.groundEffect.updateHiddenByLandmark(i);let r=i.vertexArrayOffset,a=i.vertexCount+i.vertexArrayOffset,n=-0x40000000&i.flags?u8:i.centroidXY,o=this.centroidVertexArray.geta_centroid_pos0(r);if(this.centroidVertexArray.geta_centroid_pos1(r)!==n.y||o!==n.x){for(let i=r;i<a;++i)this.centroidVertexArray.emplace(i,n.x,n.y);this.needsCentroidUpdate=!0}}createCentroidsBuffer(){for(let i of(this.centroidVertexArray.resize(this.layoutVertexArray.length),this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length),this.centroidData))this.writeCentroidToBuffer(i)}updateReplacement(i,r,a){if(r.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=r.updateTime;let n=r.getReplacementRegionsForTile(i.toUnwrapped());if(uY(this.activeReplacements,n))return;if(this.activeReplacements=n,0===this.centroidVertexArray.length)this.createCentroidsBuffer();else for(let i of this.centroidData)i.flags&=0x3fffffff;let o=[];for(let r of this.activeReplacements){if(r.order<a)continue;let n=Math.max(1,Math.pow(2,r.footprintTileId.canonical.z-i.canonical.z));if(r.footprint.buildingIds)for(let i of this.centroidData)0x80000000&i.flags||0x40000000&i.flags||r.min.x>i.max.x||i.min.x>r.max.x||r.min.y>i.max.y||i.min.y>r.max.y||r.footprint.buildingIds.has(i.buildingId)&&(i.flags|=r.clipMask!==u1.None?-0x40000000:0x80000000);else for(let a of this.centroidData)if(!(0x80000000&a.flags||0x40000000&a.flags||r.min.x>a.max.x||a.min.x>r.max.x||r.min.y>a.max.y||a.min.y>r.max.y))for(let s=0;s<a.footprintSegLen;s++){let l=this.footprintSegments.get(a.footprintSegIdx+s);if(o.length=0,function(i,r,a,n,o,s){let l=Math.pow(2,n.z-o.z);for(let h=0;h<a;h++){let a=i.int16[2*(h+r)+0],u=i.int16[2*(h+r)+1];a=(a+8192*o.x)*l-8192*n.x,u=(u+8192*o.y)*l-8192*n.y,s.push(new e8(a,u))}}(this.footprintVertices,l.vertexOffset,l.vertexCount,r.footprintTileId.canonical,i.canonical,o),uK(r.footprint,o,this.footprintIndices.uint16,l.indexOffset,l.indexCount,-l.vertexOffset,
7-n)){a.flags|=r.clipMask!==u1.None?-0x40000000:0x80000000;break}}}for(let i of this.centroidData)this.writeCentroidToBuffer(i);this.borderDoneWithNeighborZ=[-1,-1,-1,-1]}footprintContainsPoint(i,r,a){let n=!1;for(let o=0;o<a.footprintSegLen;o++){let s=this.footprintSegments.get(a.footprintSegIdx+o),l=0;for(let a of s.ringIndices){for(let o=l,h=a+l-1;o<a+l;h=o++){let a=this.footprintVertices.int16[2*(o+s.vertexOffset)+0],l=this.footprintVertices.int16[2*(o+s.vertexOffset)+1],u=this.footprintVertices.int16[2*(h+s.vertexOffset)+1];l>r!=u>r&&i<(this.footprintVertices.int16[2*(h+s.vertexOffset)+0]-a)*(r-l)/(u-l)+a&&(n=!n)}l=a}}return n}getHeightAtTileCoord(i,r){let a=-1/0,n=!0,o=4*(i+8192)*8192+(r+8192);if(Object.hasOwn(this.partLookup,o)){let i=this.partLookup[o];return i?{height:i.height,hidden:!!(0x80000000&i.flags)}:void 0}let s=this.centroidData.buffer,l=this.centroidData.length;for(let h=0;h<l;h++){let l=15*h;if(i>s[l+4]||s[l+2]>i||r>s[l+5]||s[l+3]>r)continue;let u=s[l+13];if(u<=a)continue;let c=this.centroidData.get(h);this.footprintContainsPoint(i,r,c)&&(a=u,this.partLookup[o]=c,n=!!(0x80000000&c.flags))}if(a!==-1/0)return{height:a,hidden:n};this.partLookup[o]=void 0}}function cc(i,r){let a=i.add(r)._unit();return i.x*a.x+i.y*a.y}function cd(i,r,a,n,o){let s=Math.sqrt(1-n*n);return Math.min(i.dist(r)/3,r.dist(a)/3,o*s/n)}function cp(i,r,a){return i.x<a[0].x&&r.x<a[0].x||i.x>a[1].x&&r.x>a[1].x||i.y<a[0].y&&r.y<a[0].y||i.y>a[1].y&&r.y>a[1].y}function cf(i,r){return i.x<r[0].x||i.x>r[1].x||i.y<r[0].y||i.y>r[1].y}function cm(i,r,a){if(i.x<0||i.x>=8192||r.x<0||r.x>=8192||a.x<0||a.x>=8192)return!1;let n=a.sub(r),o=n.perp(),s=i.sub(r);return(n.x*s.x+n.y*s.y)/Math.sqrt((n.x*n.x+n.y*n.y)*(s.x*s.x+s.y*s.y))>-.866&&o.x*s.x+o.y*s.y<0}function c_(i,r,a){let n=r?2|i:-3&i;return a?1|n:-2&n}function cg(){let i=Math.tan(Math.PI/32);return 6371008.8*Math.sqrt(1+2*i*i)-6371008.8}function cy(i,r,a){let n=1<<a.z,o=s6(a.x/n),s=s6((a.x+1)/n);return function(i,r,a,n,o=0,s){let l=[];if(!i.length||!a||!n)return l;let h=(i,r)=>{for(let a of i)l.push({polygon:a,bounds:r})},u=Math.ceil(Math.log2(a)),c=Math.ceil(Math.log2(n)),d=u-c,p=[];for(let i=0;i<Math.abs(d);i++)p.push(d>0?0:1);for(let i=0;i<Math.min(u,c);i++)p.push(0),p.push(1);let f=i;if(f=uM(f,r[0].y-o,r[1].y+o,1),!(f=uM(f,r[0].x-o,r[1].x+o,0)).length)return l;let m=[];for(p.length?m.push({polygons:f,bounds:r,depth:0}):h(f,r);m.length;){let i=m.pop(),r=i.depth,a=p[r],n=i.bounds[0],l=i.bounds[1],u=0===a?n.x:n.y,c=0===a?l.x:l.y,d=s?s(a,u,c):.5*(u+c),f=uM(i.polygons,u-o,d+o,a),_=uM(i.polygons,d-o,c+o,a);if(f.length){let i=[n,new e8(0===a?d:l.x,1===a?d:l.y)];p.length>r+1?m.push({polygons:f,bounds:i,depth:r+1}):h(f,i)}if(_.length){let i=[new e8(0===a?d:n.x,1===a?d:n.y),l];p.length>r+1?m.push({polygons:_,bounds:i,depth:r+1}):h(_,i)}}return l}(i,r,Math.ceil((s-o)/11.25),Math.ceil((s8(a.y/n)-s8((a.y+1)/n))/11.25),1,(i,r,o)=>{if(0===i)return .5*(r+o);{let i=s8((a.y+r/8192)/n);return(s4(.5*(s8((a.y+o/8192)/n)+i))*n-a.y)*8192}})}nl(cu,"FillExtrusionBucket",{omit:["layers","features"]}),nl(ca,"PartData"),nl(cn,"PartDataArray"),nl(cr,"FootprintSegmentArray"),nl(co,"BorderCentroidData"),nl(ch,"GroundEffect");class cx extends e8{constructor(i,r,a){super(i,r),this.z=a}}class cv extends cx{constructor(i,r,a,n){super(i,r,a),this.w=n}}function cb(i,r,a,n){let o="x"===a?"y":"x",s=(n-i[a])/(r[a]-i[a]);i[o]=Math.round(i[o]+(r[o]-i[o])*s),i[a]=n,Object.hasOwn(i,"z")&&(i.z=iE(i.z,r.z,s)),Object.hasOwn(i,"w")&&(i.w=iE(i.w,r.w,s))}function cw(i,r,a,n){for(let o of["x","y"]){let s=i,l=r;s[o]>=l[o]&&(s=r,l=i),s[o]<a&&l[o]>a&&cb(s,l,o,a),s[o]<n&&l[o]>n&&cb(l,s,o,n)}}function cT(i,r,a,n,o,s){let l=[];for(let h=0;h<i.length;h++){let u,c=i[h],d=l.length,p=0;for(let i=0;i<c.length-1;i++){let d,f,m=c[i],_=c[i+1],g=0,y=p;s&&(p+=g=Math.hypot(_.x-m.x,_.y-m.y),d=m,f=_),m.x<r&&_.x<r||(m.x<r?m=new e8(r,m.y+(r-m.x)/(_.x-m.x)*(_.y-m.y))._round():_.x<r&&(_=new e8(r,m.y+(r-m.x)/(_.x-m.x)*(_.y-m.y))._round()),m.y<a&&_.y<a||(m.y<a?m=new e8(m.x+(a-m.y)/(_.y-m.
7y)*(_.x-m.x),a)._round():_.y<a&&(_=new e8(m.x+(a-m.y)/(_.y-m.y)*(_.x-m.x),a)._round()),m.x>=n&&_.x>=n||(m.x>=n?m=new e8(n,m.y+(n-m.x)/(_.x-m.x)*(_.y-m.y))._round():_.x>=n&&(_=new e8(n,m.y+(n-m.x)/(_.x-m.x)*(_.y-m.y))._round()),m.y>=o&&_.y>=o||(m.y>=o?m=new e8(m.x+(o-m.y)/(_.y-m.y)*(_.x-m.x),o)._round():_.y>=o&&(_=new e8(m.x+(o-m.y)/(_.y-m.y)*(_.x-m.x),o)._round()),u&&m.equals(u.at(-1))||(u=[m],l.push(u),s&&s.push({progress:{min:y+cS(d,f,m)*g,max:1},parentIndex:h,prevPoint:d,nextPoint:f})),u.push(_),s&&(s.at(-1).progress.max=y+cS(d,f,_)*g,s.at(-1).nextPoint=f)))))}if(s&&p>0)for(let i=d;i<l.length;i++)s[i].progress.min/=p,s[i].progress.max/=p}return l}function cS(i,r,a){return i.x!==r.x?(a.x-i.x)/(r.x-i.x):i.y!==r.y?(a.y-i.y)/(r.y-i.y):0}function cE(i,r){return i.x*r.x+i.y*r.y}function cI(i,r){if(1===i.length){let a,n=0,o=r[n++];for(;!a||o.equals(a);)if(!(a=r[n++]))return 1/0;for(;n<r.length;n++){let s=r[n],l=i[0],h=a.sub(o),u=s.sub(o),c=l.sub(o),d=cE(h,h),p=cE(h,u),f=cE(u,u),m=cE(c,h),_=cE(c,u),g=d*f-p*p,y=(f*m-p*_)/g,x=(d*_-p*m)/g,v=o.z*(1-y-x)+a.z*y+s.z*x;if(isFinite(v))return v}return 1/0}{let i=1/0;for(let a of r)i=Math.min(i,a.z);return i}}function cA(i,r,a){let n=1/0;lB(a,r)&&(n=cI(a,r[0]));for(let o=0;o<r.length;o++){let s=r[o],l=i[o];for(let i=0;i<s.length-1;i++){let r=s[i],o=[r,s[i+1],l[i+1],l[i],r];lO(a,o)&&(n=Math.min(n,cI(a,o)))}}return n!==1/0&&n}function cM(i,r,a,n,o,s,l,h,u,c,d){return"globe"===i.projection.name?function(i,r,a,n,o,s,l,h,u,c,d){let p=[],f=[],m=i.projection.upVectorScale(d,i.center.lat,i.worldSize).metersToTile,_=[0,0,0,1],g=[0,0,0,1],y=(i,r,a,n)=>{i[0]=r,i[1]=a,i[2]=n,i[3]=1},x=cg();for(let v of(a>0&&(a+=x),n+=x,r)){let r=[],x=[];for(let p of v){let f=p.x+o.x,v=p.y+o.y,b=i.projection.projectTilePoint(f,v,d),w=i.projection.upVector(d,p.x,p.y),T=a,S=n;if(l){let i=cC(f,v,a,n,l,h,u,c);T+=i.base,S+=i.top}0!==a?y(_,b.x+w[0]*m*T,b.y+w[1]*m*T,b.z+w[2]*m*T):y(_,b.x,b.y,b.z),y(g,b.x+w[0]*m*S,b.y+w[1]*m*S,b.z+w[2]*m*S),eL(_,_,s),eL(g,g,s),r.push(new cx(_[0],_[1],_[2])),x.push(new cx(g[0],g[1],g[2]))}p.push(r),f.push(x)}return[p,f]}(i,r,a,n,o,s,l,h,u,c,d):l?function(i,r,a,n,o,s,l,h,u){let c=[],d=[],p=[0,0,0,1];for(let f of i){let i=[],m=[];for(let c of f){let d=c.x+n.x,f=c.y+n.y,_=cC(d,f,r,a,s,l,h,u);p[0]=d,p[1]=f,p[2]=_.base,p[3]=1,ej(p,p,o),p[3]=Math.max(p[3],1e-5);let g=new cx(p[0]/p[3],p[1]/p[3],p[2]/p[3]);p[0]=d,p[1]=f,p[2]=_.top,p[3]=1,ej(p,p,o),p[3]=Math.max(p[3],1e-5);let y=new cx(p[0]/p[3],p[1]/p[3],p[2]/p[3]);i.push(g),m.push(y)}c.push(i),d.push(m)}return[c,d]}(r,a,n,o,s,l,h,u,c):function(i,r,a,n,o){let s=[],l=[],h=o[8]*r,u=o[9]*r,c=o[10]*r,d=o[11]*r,p=o[8]*a,f=o[9]*a,m=o[10]*a,_=o[11]*a;for(let r of i){let i=[],a=[];for(let s of r){let r=s.x+n.x,l=s.y+n.y,g=o[0]*r+o[4]*l+o[12],y=o[1]*r+o[5]*l+o[13],x=o[2]*r+o[6]*l+o[14],v=o[3]*r+o[7]*l+o[15],b=g+h,w=y+u,T=x+c,S=Math.max(v+d,1e-5),E=g+p,I=y+f,A=x+m,M=Math.max(v+_,1e-5);i.push(new cx(b/S,w/S,T/S)),a.push(new cx(E/M,I/M,A/M))}s.push(i),l.push(a)}return[s,l]}(r,a,n,o,s)}function cC(i,r,a,n,o,s,l,h){let u=l*o.getElevationAt(i,r,!0,!0),c=0!==s[0],d=c?0===s[1]?l*(s[0]/7-450):l*function(i,r,a){var n,o;let s=Math.floor(r[0]/8),l=Math.floor(r[1]/8),h=10*(r[0]-8*s),u=10*(r[1]-8*l),c=i.getElevationAt(s,l,!0,!0),d=i.getMeterToDEM(a),p=Math.floor(.5*(h*d-1)),f=Math.floor(.5*(u*d-1)),m=i.tileCoordToPixel(s,l),_=2*p+1,g=2*f+1,y=(n=m.x-p,o=m.y-f,[i.getElevationAtPixel(n,o,!0),i.getElevationAtPixel(n+g,o,!0),i.getElevationAtPixel(n,o+g,!0),i.getElevationAtPixel(n+_,o+g,!0)]),x=Math.abs(y[0]-y[1]),v=Math.abs(y[2]-y[3]);return c+Math.max(Math.min(.25,.5*d*(x+v)/_)*h,Math.min(.25,.5*d*(Math.abs(y[0]-y[2])+Math.abs(y[1]-y[3]))/g)*u)}(o,s,h):u;return{base:u+(0===a?-1:a),top:c?Math.max(d+n,u+a+2):u+n}}let cP=null,cD=null,cR=null,cz=null,cL={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},cF={5120:"DT_INT8",5121:"DT_UINT8",5122:"DT_INT16",5123:"DT_UINT16",5125:"DT_UINT32",5126:"DT_FLOAT32"},cO={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16};function cB(i,r,a){let n=a.json.bufferViews.length,o=a.buffers.length;r.bufferView=n,a.json.bufferViews[n]={buffer:o,byteLength:i.byteLength},a.buffers[o]=i}let ck="KHR_draco_mesh_compression",cN="EXT_meshopt_compression",cU=new TextDecoder("utf8");function cV(i,r){return new URL(i,r).href}async function cj(i,r,a,n,o){let s=await fetch(cV(i.uri,n),{signal:o}),l=await s.arrayBuffer();r.buffers[a]=l}function cG(i,r){let a=i.json.bufferViews[r];return new Uint8Array(i.buffers[a.buffer],a.byteOffset||0,a.byteLength)}async function cH(i,r,a,n,o){if(i.uri){let s=cV(i.uri,n),l=await fetch(s,{signal:o}),h=await l.blob(),u=await createImageBitmap(h);r.images[a]=u}else if(void 0!==i.bufferView){let n=new Blob([cG(r,i.bufferView)],{type:i.mimeType}),o=await createImageBitmap(n);r.images[a]=o}}async function c$(i,r=0,a,n){let o={json:null,images:[],buffers:[]};if(0x46546c67===new Uint32Array(i,r,1)[0]){let a=new Uint32Array(i,r),n=2,s=(a[n++]>>2)-3,l=a[n++]>>2;if(n++,o.json=JSON.parse(cU.decode(a.subarray(n,n+l))),(n+=l)<s){let s=a[n++],l=r+(++n<<2);o.buffers[0]=i.slice(l,l+s)}}else o.json=JSON.parse(cU.decode(new Uint8Array(i,r)));let{buffers:s,images:l,meshes:h,extensionsUsed:u,bufferViews:c}=o.json;
7if(s){let i=[];for(let r=0;r<s.length;r++){let l=s[r];l.uri?i.push(cj(l,o,r,a,n)):o.buffers[r]||(o.buffers[r]=null)}await Promise.all(i)}if(n&&n.aborted)throw new DOMException("Aborted","AbortError");let d=[],p=u&&u.includes(ck),f=u&&u.includes(cN);if(p&&d.push(function(){if(!cP)return null!=cD||(cD=(function(i){let r,a=null;function n(){r=new Uint8Array(a.buffer)}function o(){throw Error("Unexpected Draco error.")}return WebAssembly.instantiateStreaming(i,{a:{a:o,d:function(i,a,n){return r.copyWithin(i,a,a+n)},c:function(i){let o=r.length,s=Math.ceil((Math.max(i>>>0,Math.ceil(1.2*o))-o)/65536);try{return a.grow(s),n(),!0}catch(i){return!1}},b:o}}).then(i=>{let o,s,l,h,{Rb:u,Qb:c,P:d,T:p,X:f,Ja:m,La:_,Qa:g,Va:y,Wa:x,eb:v,jb:b,f:w,e:T,yb:S,zb:E,Ab:I,Bb:A,Db:M,Gb:C}=i.instance.exports;a=T;let P=(o=0,s=0,l=0,h=0,i=>{l&&(u(h),u(o),s+=l,l=o=0),o||(s+=128,o=c(s));let a=i.length+7&-8,n=o;a>=s&&(l=a,n=h=c(a));for(let a=0;a<i.length;a++)r[n+a]=i[a];return n});return n(),w(),{memory:T,_free:u,_malloc:c,Mesh:class{constructor(){this.ptr=d()}destroy(){p(this.ptr)}},Decoder:class{constructor(){this.ptr=m()}destroy(){b(this.ptr)}DecodeArrayToMesh(i,r,a){let n=P(i);return!!f(_(this.ptr,n,r,a.ptr))}GetAttributeByUniqueId(i,r){return{ptr:g(this.ptr,i.ptr,r)}}GetTrianglesUInt16Array(i,r,a){y(this.ptr,i.ptr,r,a)}GetTrianglesUInt32Array(i,r,a){x(this.ptr,i.ptr,r,a)}GetAttributeDataArrayForAllPoints(i,r,a,n,o){v(this.ptr,i.ptr,r.ptr,a,n,o)}},DT_INT8:S(),DT_UINT8:E(),DT_INT16:I(),DT_UINT16:A(),DT_UINT32:M(),DT_FLOAT32:C()}})})(fetch(tO())).then(i=>{cP=i,cD=null})),cD}()),f&&d.push(function(){var i;if(!cR)return null!=cz||(cz=(i=fetch(tB()),WebAssembly.instantiateStreaming(i,{}).then(i=>{let{sbrk:r,memory:a,meshopt_decodeVertexBuffer:n,meshopt_decodeIndexBuffer:o,meshopt_decodeIndexSequence:s,meshopt_decodeFilterOct:l,meshopt_decodeFilterQuat:h,meshopt_decodeFilterExp:u}=i.instance.exports,c={ATTRIBUTES:n,TRIANGLES:o,INDICES:s},d={OCTAHEDRAL:l,QUATERNION:h,EXPONENTIAL:u};return i.instance.exports.__wasm_call_ctors(),{decodeGltfBuffer(i,n,o,s,l,h){let u=n+3&-4,p=r(u*o),f=r(s.length),m=new Uint8Array(a.buffer);m.set(s,f);let _=c[l](p,n,o,f,s.length);if(0===_&&d[h]&&d[h](p,u,o),i.set(m.subarray(p,p+n*o)),r(p-r(0)),0!==_)throw Error(`Malformed buffer data: ${_}`)}}})).then(i=>{cR=i,cz=null})),cz}()),l)for(let i=0;i<l.length;i++)d.push(cH(l[i],o,i,a,n));if(d.length&&await Promise.all(d),n&&n.aborted)throw new DOMException("Aborted","AbortError");if(p&&h)for(let{primitives:i}of h)for(let r of i)!function(i,r){let a=i.extensions&&i.extensions[ck];if(!a)return;let n=new cP.Decoder,o=cG(r,a.bufferView),s=new cP.Mesh;if(!n.DecodeArrayToMesh(o,o.byteLength,s))throw Error("Failed to decode Draco mesh");let l=r.json.accessors[i.indices],h=cL[l.componentType],u=l.count*h.BYTES_PER_ELEMENT,c=cP._malloc(u);for(let o of(h===Uint16Array?n.GetTrianglesUInt16Array(s,u,c):n.GetTrianglesUInt32Array(s,u,c),cB(cP.memory.buffer.slice(c,c+u),l,r),cP._free(c),Object.keys(a.attributes))){let l=n.GetAttributeByUniqueId(s,a.attributes[o]),h=r.json.accessors[i.attributes[o]],u=cF[h.componentType],c=h.count*cO[h.type]*cL[h.componentType].BYTES_PER_ELEMENT,d=cP._malloc(c);n.GetAttributeDataArrayForAllPoints(s,l,cP[u],c,d),cB(cP.memory.buffer.slice(d,d+c),h,r),cP._free(d)}n.destroy(),s.destroy(),delete i.extensions[ck]}(r,o);if(f&&h&&c)for(let i of c)!function(i,r){if(!i.extensions||!i.extensions[cN])return;let a=i.extensions[cN],n=new Uint8Array(r.buffers[a.buffer],a.byteOffset||0,a.byteLength||0),o=new Uint8Array(a.count*a.byteStride);cR.decodeGltfBuffer(o,a.count,a.byteStride,n,a.mode,a.filter),i.buffer=r.buffers.length,i.byteOffset=0,r.buffers[i.buffer]=o.buffer,delete i.extensions[cN]}(i,o);return o}async function cq(i,r){return c$(await async function(i,r){if(r&&r.aborted)throw new DOMException("Aborted","AbortError");return new Promise((a,n)=>{let o=it(i,(i,r)=>{i?n(i):a(r)});r&&r.addEventListener("abort",()=>{o.cancel(),n(new DOMException("Aborted","AbortError"))},{once:!0})})}({url:i,type:"arrayBuffer"},r),0,i,r)}function cZ(i){switch(i){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 cW(i){switch(i){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 cX{constructor(i,r,a,n){this.context=i,this.format=a,this.useMipmap=n&&n.useMipmap,this.texture=i.gl.createTexture(),this.update(r,{premultiply:n&&n.premultiply})}update(i,r){let a=i&&i instanceof HTMLVideoElement&&0===i.width?i.videoWidth:i.width,n=i&&i instanceof HTMLVideoElement&&0===i.height?i.videoHeight:i.height,{context:o}=this,{gl:s}=o,{x:l,y:h}=r&&r.position?r.position:{x:0,y:0},u=l+a,c=h+n;this.size&&(this.size[0]!==u||this.size[1]!==c)&&(!r||void 0===r.recreateWhenResize||r.recreateWhenResize)&&(s.bindTexture(s.TEXTURE_2D,null),s.deleteTexture(this.texture),this.texture=s.createTexture(),this.size=null),s.bindTexture(s.TEXTURE_2D,this.texture),o.pixelStoreUnpackFlipY.set(!1),o.pixelStoreUnpack.set(1),o.pixelStoreUnpackPremultiplyAlpha.set(this.format===s.RGBA8&&(!r||!1!==r.premultiply));let d=i instanceof HTMLImageElement||i instanceof HTMLCanvasElement||i instanceof HTMLVideoElement||i instanceof ImageData||ImageBitmap&&i instanceof ImageBitmap;if(!this.size&&u>0&&c>0){let i=this.useMipmap?Math.floor(Math.log2(Math.max(u,c)))+1:1;s.texStorage2D(s.TEXTURE_2D,i,this.format,u,c),this.size=[u,c]}this.size&&(d?s.texSubImage2D(s.TEXTURE_2D,0,l,h,cZ(this.format),cW(this.format),i):"data"in i&&i.data&&s.texSubImage2D(s.TEXTURE_2D,0,l,h,a,n,cZ(this.format),cW(this.format),i.data)),this.useMipmap&&s.generateMipmap(s.TEXTURE_2D)}bind(i,r,a=!1){let{context:n}=this,{gl:o}=n;
7o.bindTexture(o.TEXTURE_2D,this.texture),i!==this.minFilter&&(o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,i),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,this.useMipmap&&!a?i===o.NEAREST?o.NEAREST_MIPMAP_NEAREST:o.LINEAR_MIPMAP_LINEAR:i),this.minFilter=i),r!==this.wrapS&&(o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,r),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,r),this.wrapS=r)}bindExtraParam(i,r,a,n,o){let{context:s}=this,{gl:l}=s;l.bindTexture(l.TEXTURE_2D,this.texture),r!==this.magFilter&&(l.texParameteri(l.TEXTURE_2D,l.TEXTURE_MAG_FILTER,r),this.magFilter=r),i!==this.minFilter&&(l.texParameteri(l.TEXTURE_2D,l.TEXTURE_MIN_FILTER,this.useMipmap?i===l.NEAREST?l.NEAREST_MIPMAP_NEAREST:l.LINEAR_MIPMAP_LINEAR:i),this.minFilter=i),a!==this.wrapS&&(l.texParameteri(l.TEXTURE_2D,l.TEXTURE_WRAP_S,a),this.wrapS=a),n!==this.wrapT&&(l.texParameteri(l.TEXTURE_2D,l.TEXTURE_WRAP_T,n),this.wrapT=n),o!==this.compareMode&&(o?(l.texParameteri(l.TEXTURE_2D,l.TEXTURE_COMPARE_MODE,l.COMPARE_REF_TO_TEXTURE),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_COMPARE_FUNC,o)):l.texParameteri(l.TEXTURE_2D,l.TEXTURE_COMPARE_MODE,l.NONE),this.compareMode=o)}destroy(){let{gl:i}=this.context;i.deleteTexture(this.texture),this.texture=null}}class cY{constructor(i,r){this.context=i,this.texture=r}bind(i,r){let{context:a}=this,{gl:n}=a;n.bindTexture(n.TEXTURE_2D,this.texture),i!==this.minFilter&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,i),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,i),this.minFilter=i),r!==this.wrapS&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,r),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,r),this.wrapS=r)}}let cJ=oA([{name:"a_pos_3f",components:3,type:"Float32"}]),cK=oA([{name:"a_color_3f",components:3,type:"Float32"}]),cQ=oA([{name:"a_color_4f",components:4,type:"Float32"}]),c0=oA([{name:"a_uv_2f",components:2,type:"Float32"}]),c1=oA([{name:"a_normal_3f",components:3,type:"Float32"}]),c2=oA([{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"}]),c3=oA([{name:"a_pbr",components:4,type:"Uint16"},{name:"a_heightBasedEmissiveStrength",components:3,type:"Float32"}]);function c5(i,r){let a=c6(i.projection,i.zoom,i.width,i.height),n=function(i,r,a,n,o){let s=new s1(a.lng-180*c8,a.lat),l=new s1(a.lng+180*c8,a.lat),h=i.project(s.lng,s.lat),u=i.project(l.lng,l.lat),c=-Math.atan2(u.y-h.y,u.x-h.x),d=lr.fromLngLat(a);d.y=tl(d.y,-1+c8,1-c8);let p=d.toLngLat(),f=i.project(p.lng,p.lat),m=lr.fromLngLat(p);m.x+=c8;let _=m.toLngLat(),g=i.project(_.lng,_.lat),y=c7(g.x-f.x,g.y-f.y,c),x=lr.fromLngLat(p);x.y+=c8;let v=x.toLngLat(),b=i.project(v.lng,v.lat),w=c7(b.x-f.x,b.y-f.y,c),T=Math.abs(y.x)/Math.abs(w.y),S=et([]);el(S,S,-c*(1-(o?0:n)));let E=et([]);return en(E,E,[1,1-(1-T)*n,1]),E[4]=-w.x/w.y*n,el(E,E,c),er(E,S,E),E}(i.projection,0,i.center,a,r),o=c4(i);return en(n,n,[o,o,1]),n}function c4(i){let r=i.projection,a=c6(i.projection,i.zoom,i.width,i.height);return Math.pow(2,c9(r,i.center)*a+(1-a)*c9(r,s1.convert(r.center)))}function c6(i,r,a,n,o=1/0){let s=i.range;if(!s)return 0;let l=Math.log2(Math.min(o,Math.max(a,n))/1024);return th(s[0]+l,s[1]+l,r)}let c8=1/4e4;function c9(i,r){let a=tl(r.lat,-85.051129,85.051129),n=new s1(r.lng-180*c8,a),o=new s1(r.lng+180*c8,a),s=i.project(n.lng,a),l=i.project(o.lng,a),h=lr.fromLngLat(n),u=lr.fromLngLat(o),c=l.x-s.x,d=l.y-s.y,p=u.x-h.x,f=u.y-h.y;return Math.log2(Math.sqrt((p*p+f*f)/(c*c+d*d)))}function c7(i,r,a){let n=Math.cos(a),o=Math.sin(a);return{x:i*n-r*o,y:i*o+r*n}}let de=new Float64Array([1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,1]);function dt(i,r,a){et(i),el(i,i,r[2]*e7),eo(i,i,r[0]*e7),es(i,i,r[1]*e7),en(i,i,a),er(i,i,de)}function di(i,r,a,n,o,s,l,h){let u=[a[0]-r[0],a[1]-r[1],0],c=[n[0]-r[0],n[1]-r[1],0];if(1e-12>e_(u)||1e-12>e_(c))return eH(i);let d=eR([],u,c);return eP(d,d),ev(c,n,r),u[2]=(s-o)*h,c[2]=(l-o)*h,eR(u,u,c),eP(u,u),eY(i,d,u)}function dr(i,r,a=!1){let n=h_(r.zoom),o=function(i,r,a){let n=r.worldSize,o=[i[12],i[13],i[14]],s=s8(o[1]/n),l=s6(o[0]/n),h=et([]),u=1/s3(s)*n,c=1/s3(0)*n*le(s,r.zoom),d=1/hp(n),p=c*d;if(a){let i=c6(r.projection,r.zoom,r.width,r.height,1024);p=d*r.projection.pixelSpaceConversion(r.center.lat,n,i)}let f=sQ(s,l);ex(f,f,eS([],eP([],f),u*p*o[2]));let m=function(i){let r=[i[0],i[1],i[2]],a=[0,1,0],n=eR([],a,r);return eR(a,r,n),0===eM(a)&&eR(n,r,a=[0,1,0]),eP(n,n),eP(a,a),eP(r,r),[n[0],n[1],n[2],0,a[0],a[1],a[2],0,r[0],r[1],r[2],0,i[0],i[1],i[2],1]}(f);en(h,h,[p,p,p*u]),ea(h,h,[-o[0],-o[1],-o[2]]);let _=er([],r.globeMatrix,m);return er(_,_,h),er(_,_,i),_}(i,r,a);return n>0?function(i,r,a){let n=(i,r,a)=>{let n=e_(i),o=e_(r),s=hi(i,r,a);return eS(s,s,1/e_(s)*iE(n,o,a))},o=n([i[0],i[1],i[2]],[r[0],r[1],r[2]],a),s=n([i[4],i[5],i[6]],[r[4],r[5],r[6]],a),l=n([i[8],i[9],i[10]],[r[8],r[9],r[10]],a),h=hi([i[12],i[13],i[14]],[r[12],r[13],r[14]],a);return[o[0],o[1],o[2],0,s[0],s[1],s[2],0,l[0],l[1],l[2],0,h[0],h[1],h[2],1]}(o,function(i,r){let a=r.worldSize,n=1/s3(0)*a*le(r.center.lat,r.zoom)/hp(a),o=1/s3(r.center.lat)*a,s=et([]);es(s,s,r.center.lng*e7),eo(s,s,r.center.lat*e7),ea(s,s,[0,0,sX]),en(s,s,[n,n,n*o]);let l=r.point;return ea(s,s,[-l.x,-l.y,0]),er(s,s,i),er(s,r.globeMatrix,s)}(i,r),n):o}function da(i,r,a,n){let o=lP.projectAabbCorners(n,a),s=Number.MAX_VALUE;for(let i=0;i<o.length;++i){let a=o[i];a[0]=(.5*a[0]+.5)*r.width,a[1]=(.5-.5*a[1])*r.height,a[2]<s&&(s=a[2])}if(lO(i,function(i){let r=[],a=0;for(let r=1;r<i.length;r++)(i[r][0]<i[a][0]||i[r][0]===i[a][0]&&i[r][1]<i[a][1])&&(a=r);let n,o=a,s=new Uint8Array(i.length);do{if(s[o])break;r.push(new e8(i[o][0],i[o][1])),s[o]=1,n=(o+1)%i.length;for(let r=0;r<i.length;r++){if(i[r][0]===i[n][0]&&i[r][1]===i[n][1]||i[r][0]===i[o][0]&&i[r][1]===i[o][1])continue;let a=[i[r][0]-i[o][0],i[r][1]-i[o][1]],s=[i[n][0]-i[o][0],i[n][1]-i[o][1]],l=a[0]*s[1]-a[1]*s[0];(l>0||0===l&&a[0]*s[0]+a[1]*s[1]>=0&&a[0]*a[0]+a[1]*a[1]>s[0]*s[0]+s[1]*s[1])&&(n=r)}o=n}while(o!==a);return r.length>0&&r.push(r[0]),r}(o)))return s}
7let dn={CoordinateSpaceTile:1,HasMapboxMeshFeatures:4,HasMeshoptCompression:8};function ds(i,r,a,n,o,s,l,h,u,c=!1){let d=a.zoom,p=a.project(n),f=le(n.lat,d),m=1/f;et(i),ea(i,i,[p.x+l[0]*m,p.y+l[1]*m,l[2]]);let _=1,g=1,y=a.worldSize;if(c){if("mercator"===a.projection.name){let i=0;a.elevation&&(i=a.elevation.getAtPointOrZero(new lr(p.x/y,p.y/y),0));let r=ej([],[p.x,p.y,i,1],a.projMatrix)[3]/a.cameraToCenterDistance;_=r,g=r*le(a.center.lat,d)}else if("globe"===a.projection.name){let r=dr(i,a),o=[0,0,0,1];ej(o,o,er([],a.projMatrix,r));let s=o[3]/a.cameraToCenterDistance,l=h_(d),h=a.projection.pixelsPerMeter(n.lat,y)*le(n.lat,d),u=a.projection.pixelsPerMeter(a.center.lat,y)*le(a.center.lat,d);_=s/iE(h,s7(a.center.lat),l),g=s*f/h,_*=u,g*=u}}else _=m;en(i,i,[_,_,g]);let x=[...i],v=r.orientation,b=[];if(dt(b,[v[0]+(o?o[0]:0),v[1]+(o?o[1]:0),v[2]+(o?o[2]:0)],s),er(i,x,b),h&&a.elevation){let o=0,s=[];if(u&&a.elevation){o=function(i,r,a,n,o){let s=r.elevation;if(!s)return 0;let l=lP.projectAabbCorners(a,n),h=1/s3(o.lat)*r.worldSize,u=function(i,r){let a=[0,0,1],n=[{corners:[0,1,3,2],dotProductWithUp:0},{corners:[1,5,2,6],dotProductWithUp:0},{corners:[0,4,1,5],dotProductWithUp:0},{corners:[2,6,3,7],dotProductWithUp:0},{corners:[4,7,5,6],dotProductWithUp:0},{corners:[0,3,4,7],dotProductWithUp:0}];for(let o of n){let n=i[o.corners[0]],s=i[o.corners[1]],l=i[o.corners[2]],h=[s[0]-n[0],s[1]-n[1],r*(s[2]-n[2])],u=eR(h,h,[l[0]-n[0],l[1]-n[1],r*(l[2]-n[2])]);eP(u,u),o.dotProductWithUp=eD(u,a)}return n.sort((i,r)=>i.dotProductWithUp-r.dotProductWithUp),n[0].corners}(l,h),c=l[u[0]],d=l[u[1]],p=l[u[2]],f=l[u[3]],m=s.getAtPointOrZero(new lr(c[0]/r.worldSize,c[1]/r.worldSize),0),_=s.getAtPointOrZero(new lr(d[0]/r.worldSize,d[1]/r.worldSize),0),g=s.getAtPointOrZero(new lr(p[0]/r.worldSize,p[1]/r.worldSize),0),y=s.getAtPointOrZero(new lr(f[0]/r.worldSize,f[1]/r.worldSize),0),x=(m+y)/2,v=(_+g)/2;return x>v?_<g?di(i,d,f,c,_,y,m,h):di(i,p,c,f,g,m,y,h):m<y?di(i,c,d,p,m,_,g,h):di(i,f,p,d,y,g,_,h),Math.max(x,v)}(s,a,r.aabb,i,n);let l=er([],ep([],s),b);er(i,x,l)}else o=a.elevation.getAtPointOrZero(new lr(p.x/y,p.y/y),0);0!==o&&(i[14]+=o)}}class dl{constructor(i,r,a,n,o){this.materialOverrides=new Map,this.nodeOverrides=new Map,this.materialOverrideNames=[],this.nodeOverrideNames=[],this.featureProperties={},this.id=i,this.uri=r,this.position=null!=a?new s1(a[0],a[1]):new s1(0,0),this.orientation=null!=n?n:[0,0,0],this.nodes=o,this.uploaded=!1,this.aabb=new lP([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),this.matrix=[]}_applyTransformations(i,r){var a;er(i.globalMatrix,r,i.localMatrix);let n=this.nodeOverrides.get(i.name);if(void 0!==n){let r=[];a=n.orientation,et(r),es(r,r,a[1]*e7),el(r,r,a[2]*e7),eo(r,r,a[0]*e7),er(i.globalMatrix,i.globalMatrix,r)}if(i.meshes)for(let r of i.meshes){let a=lP.applyTransformFast(r.aabb,i.globalMatrix);this.aabb.encapsulate(a)}if(i.children)for(let r of i.children)this._applyTransformations(r,i.globalMatrix)}computeBoundsAndApplyParent(){let i=et([]);for(let r of(this.aabb=new lP([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),this.nodes))this._applyTransformations(r,i)}computeModelMatrix(i,r,a,n,o,s,l=!1){ds(this.matrix,this,i.transform,this.position,r,a,n,o,s,l)}upload(i){if(!this.uploaded){for(let r of this.nodes)dc(r,i);for(let i of this.nodes)dp(i);this.uploaded=!0}}destroy(){for(let i of this.nodes)dm(i)}}function dh(i,r,a=!1){i.uploaded||(i.gfxTexture=new cX(r,i.image,a?r.gl.R8:r.gl.RGBA8,{useMipmap:i.sampler.minFilter>=r.gl.NEAREST_MIPMAP_NEAREST}),i.uploaded=!0,i.image=null)}function du(i,r,a){i.indexBuffer=r.createIndexBuffer(i.indexArray,!1,!0),i.vertexBuffer=r.createVertexBuffer(i.vertexArray,cJ.members,!1,!0),i.normalArray&&(i.normalBuffer=r.createVertexBuffer(i.normalArray,c1.members,!1,!0)),i.texcoordArray&&(i.texcoordBuffer=r.createVertexBuffer(i.texcoordArray,c0.members,!1,!0)),i.colorArray&&(i.colorBuffer=r.createVertexBuffer(i.colorArray,(12===i.colorArray.bytesPerElement?cK:cQ).members,!1,!0)),i.featureArray&&(i.pbrBuffer=r.createVertexBuffer(i.featureArray,c3.members,!0)),i.segments=sy.simpleSegment(0,0,i.vertexArray.length,i.indexArray.length);let n=i.material;n.pbrMetallicRoughness.baseColorTexture&&dh(n.pbrMetallicRoughness.baseColorTexture,r),n.pbrMetallicRoughness.metallicRoughnessTexture&&dh(n.pbrMetallicRoughness.metallicRoughnessTexture,r),n.normalTexture&&dh(n.normalTexture,r),n.occlusionTexture&&dh(n.occlusionTexture,r,a),n.emissionTexture&&dh(n.emissionTexture,r)}function dc(i,r,a){if(i.meshes)for(let n of i.meshes)du(n,r,a);if(i.lodMeshes)for(let n of i.lodMeshes)du(n,r,a);if(i.children)for(let n of i.children)dc(n,r,a)}
7function dd(i){i.indexArray.destroy(),i.vertexArray.destroy(),i.colorArray&&i.colorArray.destroy(),i.normalArray&&i.normalArray.destroy(),i.texcoordArray&&i.texcoordArray.destroy(),i.featureArray&&i.featureArray.destroy()}function dp(i){if(i.meshes)for(let r of i.meshes)dd(r);if(i.lodMeshes)for(let r of i.lodMeshes)dd(r);if(i.children)for(let r of i.children)dp(r)}function df(i){var r;i.vertexBuffer&&(i.vertexBuffer.destroy(),i.indexBuffer.destroy(),i.normalBuffer&&i.normalBuffer.destroy(),i.texcoordBuffer&&i.texcoordBuffer.destroy(),i.colorBuffer&&i.colorBuffer.destroy(),i.pbrBuffer&&i.pbrBuffer.destroy(),i.segments.destroy(),i.material&&((r=i.material).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 dm(i){if(i.meshes)for(let r of i.meshes)df(r);if(i.lodMeshes)for(let r of i.lodMeshes)df(r);if(i.footprintDebugMesh&&(i.footprintDebugMesh.vertexBuffer.destroy(),i.footprintDebugMesh.indexBuffer.destroy(),i.footprintDebugMesh.segments.destroy()),i.children)for(let r of i.children)dm(r)}function d_(i,r,a,n){return i[0]<=n[0]&&r[0]>=a[0]&&i[1]<=n[1]&&r[1]>=a[1]&&i[2]<=n[2]&&r[2]>=a[2]}let dg=[];class dy{serializeFromGltf(i,r,a,n){if(i.length<7)return;let o=0;if(109!==i[o++]||98!==i[o++]||120!==i[o++]||98!==i[o++]||118!==i[o++]||104!==i[o++]||43!==i[o++])return;let s=new DataView(i.buffer,i.byteOffset),l=s.getUint16(o,!0);if(o+=2,0===l)return;this._nodes=[];let h=0;for(let i=0;i<l;i++){let i=[r[3*h],r[3*h+1],r[3*h+2]],n=[a[3*h],a[3*h+1],a[3*h+2]];h++;let l=s.getUint16(o,!0);o+=2;let u=0,c=0;65535===l&&(u=s.getUint16(o,!0),o+=2,c=s.getUint32(o,!0),o+=4),this._nodes.push({aabbMin:i,aabbMax:n,backChild:l,indexCount:u,indexOffset:c})}let u=s.getUint32(o,!0);this._indices=n.slice(0,u)}setVertices(i){this._vertices=i}findHighestPoint(i,r){if(!this._nodes||0===this._nodes.length||!d_(this._nodes[0].aabbMin,this._nodes[0].aabbMax,i,r))return null;dg.length=0,dg.push(0);let a=-1/0;for(;dg.length>0;){let n=dg.pop(),o=this._nodes[n];if(o.aabbMax[2]<=a)continue;if(65535===o.backChild){for(let n=0;n<o.indexCount;n+=3){let s=3*this._indices[o.indexOffset+n],l=3*this._indices[o.indexOffset+n+1],h=3*this._indices[o.indexOffset+n+2];(function(i,r,a,n,o,s,l,h,u,c,d){let p,f,m,_,g,y,x=.5*(c[0]+d[0]),v=.5*(c[1]+d[1]),b=.5*(c[2]+d[2]),w=.5*(d[0]-c[0]),T=.5*(d[1]-c[1]),S=.5*(d[2]-c[2]),E=i-x,I=r-v,A=a-b,M=n-x,C=o-v,P=s-b,D=l-x,R=h-v,z=u-b,L=M-E,F=C-I,O=P-A,B=D-M,k=R-C,N=z-P,U=E-D,V=I-R,j=A-z;if(_=Math.min(p=A*F-I*O,f=P*F-C*O,m=z*F-R*O),g=Math.max(p,f,m),_>(y=Math.abs(O)*T+Math.abs(F)*S)||g<-y||(_=Math.min(p=A*k-I*N,f=P*k-C*N,m=z*k-R*N),g=Math.max(p,f,m),_>(y=Math.abs(N)*T+Math.abs(k)*S)||g<-y)||(_=Math.min(p=A*V-I*j,f=P*V-C*j,m=z*V-R*j),g=Math.max(p,f,m),_>(y=Math.abs(j)*T+Math.abs(V)*S)||g<-y)||(_=Math.min(p=E*O-A*L,f=M*O-P*L,m=D*O-z*L),g=Math.max(p,f,m),_>(y=Math.abs(O)*w+Math.abs(L)*S)||g<-y)||(_=Math.min(p=E*N-A*B,f=M*N-P*B,m=D*N-z*B),g=Math.max(p,f,m),_>(y=Math.abs(N)*w+Math.abs(B)*S)||g<-y)||(_=Math.min(p=E*j-A*U,f=M*j-P*U,m=D*j-z*U),g=Math.max(p,f,m),_>(y=Math.abs(j)*w+Math.abs(U)*S)||g<-y)||(_=Math.min(p=I*L-E*F,f=C*L-M*F,m=R*L-D*F),g=Math.max(p,f,m),_>(y=Math.abs(F)*w+Math.abs(L)*T)||g<-y)||(_=Math.min(p=I*B-E*k,f=C*B-M*k,m=R*B-D*k),g=Math.max(p,f,m),_>(y=Math.abs(k)*w+Math.abs(B)*T)||g<-y)||(_=Math.min(p=I*U-E*V,f=C*U-M*V,m=R*U-D*V),g=Math.max(p,f,m),_>(y=Math.abs(V)*w+Math.abs(U)*T)||g<-y)||(_=Math.min(E,M,D),g=Math.max(E,M,D),_>w||g<-w)||(_=Math.min(I,C,R),g=Math.max(I,C,R),_>T||g<-T)||(_=Math.min(A,P,z),g=Math.max(A,P,z),_>S||g<-S))return!1;let G=F*N-O*k,H=O*B-L*N,$=L*k-F*B;return y=w*Math.abs(G)+T*Math.abs(H)+S*Math.abs($),!(Math.abs(-(G*E+H*I+$*A))>y)})(this._vertices[s],this._vertices[s+1],this._vertices[s+2],this._vertices[l],this._vertices[l+1],this._vertices[l+2],this._vertices[h],this._vertices[h+1],this._vertices[h+2],i,r)&&(a=Math.max(a,this._vertices[s+2],this._vertices[l+2],this._vertices[h+2]))}continue}let s=n+1,l=o.backChild,h=this._nodes[s],u=this._nodes[l],c=d_(h.aabbMin,h.aabbMax,i,r),d=d_(u.aabbMin,u.aabbMax,i,r);c&&d?h.aabbMax[2]<u.aabbMax[2]?(dg.push(s),dg.push(l)):(dg.push(l),dg.push(s)):c?dg.push(s):d&&dg.push(l)}return a>=0?a:null}}function dx(i,r){let a=i.json.bufferViews[r.bufferView],n=cL[r.componentType];return new n(i.buffers[a.buffer],(r.byteOffset||0)+(a.byteOffset||0),r.count*(a.byteStride&&a.byteStride!==cO[r.type]*n.BYTES_PER_ELEMENT?a.byteStride/n.BYTES_PER_ELEMENT:cO[r.type]))}function dv(i,r,a,n){let o=cL[r.componentType],s=function(i){switch(i){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:return 1}}(o),l=i.json.bufferViews[r.bufferView],h=l.byteStride?l.byteStride/o.BYTES_PER_ELEMENT:cO[r.type],u=a.float32,c=u.length/a.capacity;for(let i=0,a=0;i<r.count*h;i+=h,a+=c)for(let r=0;r<c;r++)u[a+r]=n[i+r]*s;a._trim()}function db(i,r,a){var n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w,T,S,E,I,A;let{matrix:M,rotation:C,translation:P,scale:D,mesh:R,extras:z,children:L,name:F}=i,O={};if(O.name=F,O.localMatrix=M||(n=[],o=C||[0,0,0,1],s=P||[0,0,0],l=D||[1,1,1],h=o[0],u=o[1],c=o[2],d=o[3],p=h+h,f=u+u,m=c+c,_=h*p,g=h*f,y=h*m,x=u*f,v=u*m,b=c*m,w=d*p,T=d*f,S=d*m,E=l[0],I=l[1],A=l[2],n[0]=(1-(x+b))*E,n[1]=(g+S)*E,n[2]=(y-T)*E,n[3]=0,n[4]=(g-S)*I,n[5]=(1-(_+b))*I,n[6]=(v+w)*I,n[7]=0,n[8]=(y+T)*A,n[9]=(v-w)
7*A,n[10]=(1-(_+x))*A,n[11]=0,n[12]=s[0],n[13]=s[1],n[14]=s[2],n[15]=1,n),O.globalMatrix=ee(O.localMatrix),void 0!==R){O.meshes=a[R];let i=O.anchor=[0,0];for(let r of O.meshes){let{min:a,max:n}=r.aabb;i[0]+=a[0]+n[0],i[1]+=a[1]+n[1]}i[0]=Math.floor(i[0]/O.meshes.length/2),i[1]=Math.floor(i[1]/O.meshes.length/2)}if(z&&(z.id&&(O.id=z.id),z.lights&&(O.lights=function(i){if(!i.length)return[];let r=function(i){let r=atob(i),a=new Uint8Array(r.length);for(let i=0;i<r.length;i++)a[i]=r.codePointAt(i);return a}(i),a=[],n=r.length/24,o=new Uint16Array(r.buffer),s=new Float32Array(r.buffer);for(let i=0;i<n;i++){let r=o[2*i*6]/30,n=o[2*i*6+1]/30,l=o[2*i*6+10]/100,h=s[6*i+1],u=s[6*i+2],c=s[6*i+3],d=s[6*i+4],p=c-h,f=d-u,m=Math.hypot(p,f);a.push({pos:[h+.5*p,u+.5*f,n],normal:[f/m,-p/m,0],width:m,height:r,depth:l,points:[h,u,c,d]})}return a}(z.lights)),z.MAPBOX_geometry_bloom&&(O.isGeometryBloom=z.MAPBOX_geometry_bloom)),L){let i=[];for(let n of L)i.push(db(r.json.nodes[n],r,a));O.children=i}if(i.extensions&&i.extensions.mbx_bvh&&(O.meshBVH=function(i,r,a){let n=r.binaryAccessor,o=r.positionMinAccessor,s=r.positionMaxAccessor,l=r.indexAccessor;if(!(Number.isInteger(n)&&Number.isInteger(o)&&Number.isInteger(s)&&Number.isInteger(l)))return null;let h=i.json.accessors;if(n>=h.length||o>=h.length||s>=h.length||l>=h.length)return null;let u=h[n],c=h[o],d=h[s],p=h[l];if(void 0===u.bufferView||void 0===c.bufferView||void 0===d.bufferView||void 0===p.bufferView)return null;let f=i.json.bufferViews;if(u.bufferView>=f.length||c.bufferView>=f.length||d.bufferView>=f.length||p.bufferView>=f.length)return null;let m=f[u.bufferView],_=f[c.bufferView],g=f[d.bufferView],y=f[p.bufferView];if(m.buffer>=i.buffers.length||_.buffer>=i.buffers.length||g.buffer>=i.buffers.length||y.buffer>=i.buffers.length)return null;let x=(i,r,a)=>i>=0&&i<=a&&r<=a-i,v=u.byteOffset||0,b=c.byteOffset||0,w=d.byteOffset||0,T=p.byteOffset||0;if(!(x(v,0,m.byteLength)&&x(b,3*c.count*4,_.byteLength)&&x(w,3*d.count*4,g.byteLength)&&x(T,4*p.count,y.byteLength)))return null;let S=new Uint8Array(i.buffers[m.buffer],(m.byteOffset||0)+v,m.byteLength-v),E=new Float32Array(i.buffers[_.buffer],(_.byteOffset||0)+b,3*c.count),I=new Float32Array(i.buffers[g.buffer],(g.byteOffset||0)+w,3*d.count),A=new Uint32Array(i.buffers[y.buffer],(y.byteOffset||0)+T,p.count),M=new dy;if(M.serializeFromGltf(S,E,I,A),void 0!==a&&i.json.meshes&&i.json.meshes[a]){let r=i.json.meshes[a].primitives[0];if(r&&void 0!==r.attributes.POSITION&&r.attributes.POSITION<h.length){let a=h[r.attributes.POSITION];if(void 0!==a.bufferView&&a.bufferView<f.length){let r=f[a.bufferView];if(r.buffer<i.buffers.length){let n=a.byteOffset||0,o=r.byteStride?r.byteStride/4:3;if(x(n,a.count*o*4,r.byteLength)){let s=(r.byteOffset||0)+n;if(3===o)M.setVertices(new Float32Array(i.buffers[r.buffer],s,3*a.count));else{let n=new Float32Array(i.buffers[r.buffer],s,a.count*o),l=new Float32Array(3*a.count);for(let i=0;i<a.count;i++)l[3*i]=n[i*o],l[3*i+1]=n[i*o+1],l[3*i+2]=n[i*o+2];M.setVertices(l)}}}}}}return M}(r,i.extensions.mbx_bvh,R)),!O.meshBVH&&O.children){for(let i of O.children)if(i.meshBVH){O.meshBVH=i.meshBVH;break}}return O}function dw(i,r){for(let a=0;a<i.length;a++)if(i[a].name===r)return a;return -1}function dT(i){let r=function(i,r){let a=[],n=WebGL2RenderingContext;if(i.json.textures)for(let o of i.json.textures){let s={magFilter:n.LINEAR,minFilter:n.NEAREST,wrapS:n.REPEAT,wrapT:n.REPEAT};void 0!==o.sampler&&Object.assign(s,i.json.samplers[o.sampler]),a.push({image:r[o.source],sampler:s,uploaded:!1})}return a}(i,i.images),a=function(i,r){let a=[];for(let n of i.json.meshes){let o=[];for(let a of n.primitives)o.push(function(i,r,a){let n=i.indices,o=i.attributes,s={};s.indexArray=new oJ;let l=r.json.accessors[n],h=l.count/3;s.indexArray.reserve(h);let u=dx(r,l);for(let i=0;i<h;i++)s.indexArray.emplaceBack(u[3*i],u[3*i+1],u[3*i+2]);s.indexArray._trim(),s.vertexArray=new ok;let c=r.json.accessors[o.POSITION];s.vertexArray.reserve(c.count);let d=dx(r,c);for(let i=0;i<c.count;i++)s.vertexArray.emplaceBack(d[3*i],d[3*i+1],d[3*i+2]);if(s.vertexArray._trim(),s.aabb=new lP(c.min,c.max),s.centroid=function(i,r){let a=[0,0,0],n=i.length;if(n>0){for(let o=0;o<n;o++){let n=3*i[o];a[0]+=r[n],a[1]+=r[n+1],a[2]+=r[n+2]}a[0]/=n,a[1]/=n,a[2]/=n}return a}(u,d),void 0!==o.COLOR_0){let i=r.json.accessors[o.COLOR_0],a=cO[i.type],n=dx(r,i);s.colorArray=3===a?new ok:new oH,s.colorArray.resize(i.count),dv(r,i,s.colorArray,n)}if(void 0!==o.NORMAL){s.normalArray=new ok;let i=r.json.accessors[o.NORMAL];s.normalArray.resize(i.count);let a=dx(r,i);dv(r,i,s.normalArray,a)}if(void 0!==o.TEXCOORD_0&&a.length>0){s.texcoordArray=new o4;let i=r.json.accessors[o.TEXCOORD_0];s.texcoordArray.resize(i.count);let a=dx(r,i);dv(r,i,s.texcoordArray,a)}if(void 0!==o._FEATURE_ID_RGBA4444){let i=r.json.accessors[o._FEATURE_ID_RGBA4444];r.json.extensionsUsed&&r.json.extensionsUsed.includes("EXT_meshopt_compression")&&(s.featureData=dx(r,i))}void 0!==o._FEATURE_RGBA4444&&(s.featureData=new Uint32Array(dx(r,r.json.accessors[o._FEATURE_RGBA4444]).buffer));let p=i.material;return s.material=function(i,r){let{emissiveFactor:a=[0,0,0],alphaMode:n="OPAQUE",alphaCutoff:o=.5,normalTexture:s,occlusionTexture:l,emissiveTexture:h,doubleSided:u,name:c}=i,{baseColorFactor:d=[1,1,1,1],metallicFactor:p=1,roughnessFactor:f=1,baseColorTexture:m,metallicRoughnessTexture:_}=i.pbrMetallicRoughness||{},g=l?r[l.index]:void 0;if(l&&l.extensions&&l.extensions.KHR_texture_transform&&g){let i=l.extensions.KHR_texture_transform;g.offsetScale=[i.offset[0],i.offset[1],i.scale[0],i.scale[1]]}return{name:c,pbrMetallicRoughness:{baseColorFactor:new iI(...d),metallicFactor:p,roughnessFactor:f,baseColorTexture:m?r[m.index]:void 0,metallicRoughnessTexture:_?r[_.index]:void 0}
7,doubleSided:u,emissiveFactor:new iI(...a),alphaMode:n,alphaCutoff:o,normalTexture:s?r[s.index]:void 0,occlusionTexture:g,emissionTexture:h?r[h.index]:void 0,defined:void 0===i.defined}}(void 0!==p?r.json.materials[p]:{defined:!1},a),s}(a,i,r));a.push(o)}return a}(i,r),{scenes:n,scene:o,nodes:s}=i.json,l=n?dw(n,"Default Scene"):-1;l<0&&(l=o||0);let h=n?n[l].nodes:[...s.keys()],u=[];for(let r of h)u.push(db(s[r],i,a));!function(i,r,a){let n={},o=new Set;for(let s=0;s<i.length;s++){let i=a[r[s]];if(!i.extras)continue;let l=i.extras["mapbox:footprint:version"],h=i.extras["mapbox:footprint:id"];(l||h)&&o.add(s),"1.0.0"===l&&h&&(n[h]=s)}for(let s=0;s<i.length;s++){if(o.has(s))continue;let l=i[s],h=a[r[s]];if(!h.extras)continue;let u=null;l.id in n&&(u=function(i,r){let a=[],n=[],o=0,s=[];for(let l of i){o=a.length;let i=l.vertexArray.float32,h=l.indexArray.uint16;for(let n=0;n<l.vertexArray.length;n++)s[0]=i[3*n+0],s[1]=i[3*n+1],s[2]=i[3*n+2],eL(s,s,r),a.push(new e8(s[0],s[1]));for(let i=0;i<3*l.indexArray.length;i++)n.push(h[i]+o)}if(n.length%3!=0)return null;for(let i=0;i<n.length;i+=3){let r=a[n[i+0]],o=a[n[i+1]],s=a[n[i+2]];(r.x-o.x)*(s.y-o.y)-(s.x-o.x)*(r.y-o.y)>0&&([n[i+1],n[i+2]]=[n[i+2],n[i+1]])}return{vertices:a,indices:n}}(i[n[l.id]].meshes,l.localMatrix)),u||(u=function(i){if(!i.extras||!i.extras.ground)return null;let r=i.extras.ground;if(!r||!Array.isArray(r)||0===r.length)return null;let a=r[0];if(!a||!Array.isArray(a)||0===a.length)return null;let n=[];for(let i of a){if(!Array.isArray(i)||2!==i.length)continue;let r=i[0],a=i[1];"number"==typeof r&&"number"==typeof a&&n.push(new e8(r,a))}if(n.length<3)return null;n.length>1&&n.at(-1).equals(n[0])&&n.pop();let o=0;for(let i=0;i<n.length;i++){let r=n[i],a=n[(i+1)%n.length],s=n[(i+2)%n.length];o+=(r.x-a.x)*(s.y-a.y)-(s.x-a.x)*(r.y-a.y)}o>0&&n.reverse();let s=hN(n.flatMap(i=>[i.x,i.y]),[]);return 0===s.length?null:{vertices:n,indices:s}}(h)),u&&(l.footprint=function(i){if(0===i.vertices.length||0===i.indices.length)return null;let r=new uz(i.vertices,i.indices,8,256),[a,n]=[r.min.clone(),r.max.clone()];return{vertices:i.vertices,indices:i.indices,grid:r,min:a,max:n}}(u))}if(o.size>0){let r=Array.from(o.values()).sort((i,r)=>i-r);for(let a=r.length-1;a>=0;a--)i.splice(r[a],1)}}(u,h,i.json.nodes);let c=n?dw(n,"LOD"):-1;if(c>=0){let r=n[c].nodes,o=new Map;for(let n of r){let r=db(s[n],i,a);r.id&&o.set(r.id,r)}for(let i of u)if(i.id){let r=o.get(i.id);r&&r.meshes&&(i.lodMeshes=r.meshes,r.meshBVH&&(i.meshBVH=r.meshBVH))}}return u}function dS(i,r,a,n,o){a.reserve(a.length+4*i.length),n.reserve(n.length+10*i.length),o.reserve(o.length+10*i.length);let s=n.length;for(let l of i){let i=Math.min(10,Math.max(4,1.3*l.height))*r,h=[-l.normal[1],l.normal[0],0],u=Math.min(.29,.1*l.width/l.depth),c=l.width-2*l.depth*r*(u+.01),d=eE([],l.pos,h,c/2),p=eE([],l.pos,h,-c/2),f=[d[0],d[1],d[2]+l.height],m=[p[0],p[1],p[2]+l.height],_=eE([],l.normal,h,u);eS(_,_,i);let g=eE([],l.normal,h,-u);eS(g,g,i),ex(_,d,_),ex(g,p,g),d[2]+=.1,p[2]+=.1,n.emplaceBack(_[0],_[1],_[2]),n.emplaceBack(g[0],g[1],g[2]),n.emplaceBack(d[0],d[1],d[2]),n.emplaceBack(p[0],p[1],p[2]),n.emplaceBack(f[0],f[1],f[2]),n.emplaceBack(m[0],m[1],m[2]),n.emplaceBack(d[0],d[1],d[2]),n.emplaceBack(p[0],p[1],p[2]),n.emplaceBack(_[0],_[1],_[2]),n.emplaceBack(g[0],g[1],g[2]);let y=c/i/2;o.emplaceBack(-y-u,-1,y,.8),o.emplaceBack(y+u,-1,y,.8),o.emplaceBack(-y,0,y,1.3),o.emplaceBack(y,0,y,1.3),o.emplaceBack(y+u,-.8,y,.7),o.emplaceBack(y+u,-.8,y,.7),o.emplaceBack(0,0,y,1.3),o.emplaceBack(0,0,y,1.3),o.emplaceBack(y+u,-1.2,y,.8),o.emplaceBack(y+u,-1.2,y,.8),a.emplaceBack(6+s,4+s,8+s),a.emplaceBack(7+s,9+s,5+s),a.emplaceBack(0+s,1+s,2+s),a.emplaceBack(1+s,3+s,2+s),s+=10}}nl(dy,"ModelBVH");let dE=oA([{name:"a_pos_3f",components:3,type:"Float32"}]),dI=oA([{name:"a_normal_3",components:3,type:"Int16"}]),dA=oA([{name:"a_centroid_3",components:3,type:"Int16"}]),dM=oA([{name:"a_part_color_emissive",components:2,type:"Uint16"}]),dC=oA([{name:"a_faux_facade_color_emissive",components:2,type:"Uint16"}]),dP=oA([{name:"a_faux_facade_data",components:4,type:"Uint16"}]),dD=oA([{name:"a_faux_facade_vertical_range",components:2,type:"Uint16"}]),dR=oA([{name:"a_bloom_attenuation",components:4,type:"Float32"}]),dz=oA([{name:"a_flood_light_wall_radius_1i16",components:1,type:"Int16"}]);class dL{constructor(i){this.module=i,this.memoryStack=this.module.malloc(4096),this.memoryStackNextFree=this.memoryStack}createIntArray(i){let r=this.memoryStackNextFree;return this.memoryStackNextFree+=i.length*Int32Array.BYTES_PER_ELEMENT,this.memoryStackNextFree-this.memoryStack>4096?-1:(new Int32Array(this.module.heap32.buffer,r,i.length).set(i),r)}createFloatArray(i){let r=this.memoryStackNextFree;return this.memoryStackNextFree+=i.length*Float32Array.BYTES_PER_ELEMENT,this.memoryStackNextFree-this.memoryStack>4096?-1:(new Float32Array(this.module.heapF32.buffer,r,i.length).set(i),r)}readStringBuffer(i){let r="";for(;0!==this.module.heapU8[i];)r+=String.fromCharCode(this.module.heapU8[i]),++i;return r}setStyle(i){let r=i.normalScale;this.module.setStyle(r[0],r[1],r[2],i.tileToMeters)}setAOOptions(i,r){this.module.setAOOptions(+!!i,r)}setMetricOptions(i,r){this.module.setMetricOptions(+!!i,r)}setStructuralOptions(i){this.module.setStructuralOptions(+!!i)}setFacadeOptions(i,r){this.module.setFacadeOptions(i,+!!r)}setFauxFacadeOptions(i,r,a){this.module.setFauxFacadeOptions(+!!i,+!!r,a)}setFacadeClassifierOptions(i){this.module.setFacadeClassifierOptions(i)}generateMesh(i,r){for(let r of(this.memoryStackNextFree=this.memoryStack,i)){let i=this.createIntArray(r.ringIndices),a=this.createFloatArray(r.coordinates);if(-1===i||-1===a)return`building_gen: Out of stack memory: ${this.memoryStackNextFree-this.memoryStack}/4096`;this.module.addFeature(r.id,r.sourceId,r.minHeight,r.height,r.roofType,a,i,r.ringIndices.length-1)}for(let i of r){let r;r=i.entrances?JSON.parse(i.entrances):[];let a=this.createFloatArray(r),n=this.createFloatArray(i.coordinates);if(-1===a||-1===n)return`building_gen: Out of stack memory: ${this.memoryStackNextFree-this.memoryStack}/4096`;this.module.addFacade(i.sourceId,i.crossPerc,i.distanceToRoad,a,r.length,n,i.coordinates.length)}if(!this.module.generateMesh()){let i=this.module.getLastError();return this.readStringBuffer(i)}
7let a=this.module.getMeshCount(),n=Array(a);for(let i=0;i<a;i++){let r=this.module.getPositionsPtr(i),a=this.module.getPositionsLength(i),o=new Float32Array(this.module.heapF32.buffer,r,a),s=this.module.getNormalsPtr(i),l=this.module.getNormalsLength(i),h=new Float32Array(this.module.heapF32.buffer,s,l),u=this.module.getAOPtr(i),c=this.module.getAOLength(i),d=new Float32Array(this.module.heapF32.buffer,u,c),p=this.module.getUVPtr(i),f=this.module.getUVLength(i),m=new Float32Array(this.module.heapF32.buffer,p,f),_=this.module.getFauxFacadePtr(i),g=this.module.getFauxFacadeLength(i),y=new Uint8Array(this.module.heapU8.buffer,_,g),x=this.module.getIndicesPtr(i),v=this.module.getIndicesLength(i),b=new Int16Array(this.module.heap16.buffer,x,v),w=this.module.getBuildingPart(i);n[i]={positions:o,normals:h,ao:d,uv:m,isFauxFacade:y,indices:b,buildingPart:w}}let o=this.module.getRingCount(),s=[];for(let i=0;i<o;i++){let r=this.module.getRingPtr(i),a=this.module.getRingLength(i),n=new Float32Array(this.module.heapF32.buffer,r,a);s.push(n)}return{meshes:n,outerRingLength:this.module.getOuterRingLength(),modifiedPolygonRings:s}}}let dF=ll.types,dO=null,dB=null,dk=null;class dN{constructor(){this.layoutVertexArray=new ok,this.layoutAttenuationArray=new oH,this.layoutColorArray=new oq,this.indexArray=new oJ,this.indexArrayForConflation=new oJ,this.segmentsBucket=new sy}}class dU{constructor(i){this.layoutFacadePaintArray=null,this.layoutFacadeDataArray=null,this.layoutFacadeVerticalRangeArray=null,this.segmentsBucket=new sy,this.entranceBloom=new dN,this.layoutVertexArray=new ok,this.layoutVertexArray.reserve(66560),this.layoutNormalArray=new oP,this.layoutNormalArray.reserve(66560),this.layoutCentroidArray=new oP,this.layoutCentroidArray.reserve(66560),this.layoutColorArray=new oq,this.layoutColorArray.reserve(66560),this.layoutFloodLightDataArray=new se,this.layoutFloodLightDataArray.reserve(66560),this.layoutAOArray=new st,this.layoutAOArray.reserve(66560),this.indexArray=new oJ,this.indexArray.reserve(66560),this.indexArrayForConflation=new oJ,this.segmentsBucket=new sy,this.entranceBloom=new dN,i&&(this.layoutFacadePaintArray=new oq,this.layoutFacadeDataArray=new oU,this.layoutFacadeVerticalRangeArray=new oq)}reserve(i,r,a){this.layoutVertexArray.reserveForAdditional(i),this.layoutCentroidArray.reserveForAdditional(i),this.layoutFloodLightDataArray.reserveForAdditional(i),this.layoutNormalArray.reserveForAdditional(i),this.layoutAOArray.reserveForAdditional(i),this.layoutColorArray.reserveForAdditional(i),this.indexArray.reserveForAdditional(r),a&&(this.layoutFacadePaintArray.reserveForAdditional(i),this.layoutFacadeDataArray.reserveForAdditional(i),this.layoutFacadeVerticalRangeArray.reserveForAdditional(i))}}class dV{constructor(i){this.colorBufferUploaded=!1,this.maxHeight=0,this.replacementUpdateTime=0,this.activeReplacements=[],this.footprints=[],this.footprintsVertices=new o4,this.footprintsIndices=new o8,this.footprintsMin=new e8(1/0,1/0),this.footprintsMax=new e8(-1/0,-1/0),this.featuresOnBorder=[],this.buildingWithoutFacade=new dU(!1),this.buildingWithFacade=new dU(!0),this.indexArrayForConflationUploaded=!1,this.featureFootprintLookup=new Map,this.buildingIds=new Set,this.footprintLookup={},this.zoom=i.zoom,this.canonical=i.canonical,this.layers=i.layers,this.layerIds=this.layers.map(i=>i.fqid),this.index=i.index,this.hasPattern=!1,this.worldview=i.worldview,this.lut=i.lut,this.programConfigurations=new sH(i.layers,{zoom:i.zoom,lut:i.lut}),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.projection=i.projection,this.groundEffect=new ch(i),this.groundEffect.groundRadiusArray=new oR,this.hasAppearances=null}updateFootprints(i,r){let a=new uz([],[],1),n={vertices:[],indices:new Uint32Array(0),grid:a,min:this.footprintsMin,max:this.footprintsMax,buildingIds:this.buildingIds};r.push({footprint:n,id:i})}updateAppearances(i,r,a,n){return{hasLayoutChanges:!1,hasUboChanges:!1}}populate(i,r,a,n){if(!dk)return;let o=li(a);this.tileToMeter=o,this.brightness=r.brightness,dk.setStyle({normalScale:[1,-1,o],tileToMeters:o}),dk.setAOOptions(!1,.3),dk.setMetricOptions(!1,16),dk.setStructuralOptions(!0),dk.setFacadeClassifierOptions(3);let s=new Map,l=new Map,h=0;for(let{feature:r}of i){if("LineString"!==dF[r.type]){s.set(r.id,r.properties.source_id);continue}let i=this.layers[0]._featureFilter.needGeometry;if(i&&!this.layers[0]._featureFilter.filter(new n0(this.zoom),r,a))continue;let o=ls(r,i);if(!i&&!this.layers[0]._featureFilter.filter(new n0(this.zoom),o,a))continue;let u=i?o.geometry:lo(r,a,n),c=[];for(let i of u)for(let r of i)c.push(r.x),c.push(r.y);let d={coordinates:c,crossPerc:r.properties.cross_perc,distanceToRoad:r.properties.distance_to_road,entrances:r.properties.entrances,sourceId:0},p=r.properties.source_id,f=l.get(p);f||(f=[],l.set(p,f)),f.push(d),++h}this.maxHeight=0;let u=[],c=new Set,d=i=>{null!=i&&c.add(i)},p=(i,r)=>{null!=i&&u.push({buildingId:i,footprintIndex:r})},f=64*(i.length-h),m=f/2;for(let{feature:u,id:_,index:g,sourceLayerIndex:y}of(this.buildingWithFacade.reserve(f,m,!0),this.buildingWithoutFacade.reserve(2*f,2*m,!1),this.footprintsIndices.reserve(16*(i.length-h)),this.footprintsVertices.reserve(8*(i.length-h)),i)){if("LineString"===dF[u.type])continue;let i=this.layers[0]._featureFilter.needGeometry;if(i&&!this.layers[0]._featureFilter.filter(new n0(this.zoom),u,a))continue;let h=null;if(u.properties&&Object.hasOwn(u.properties,"building_id")&&(h=Number(u.properties.building_id),c.has(h)))continue;let f=ls(u,i);if(!i&&!this.layers[0]._featureFilter.filter(new n0(this.zoom),f,a))continue;let m=i?f.geometry:lo(u,a,n),x=h2(m,500),v=!1;for(let i of x)if(1!==i.length){v=!0;break}if(v||!function(i,r){for(let a of i)for(let i of a)if(i.x<-163||i.x>8355||i.y<-r||i.y>8355)return!1;return!0}(m,163)){d(h);continue}let b=this.layers[0],w=function(i){switch(i){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 Error(`Unknown roof shape: ${i}`)}}(b.layout.get("building-roof-shape").evaluate(u,{},a)),T=b.layout.get("building-base").evaluate(u,{},a),S=b.layout.get("building-height").evaluate(u,{},a),E=b.layout.get("building-flood-light-ground-radius").evaluate(u,{},a),I=b.paint.get("building-ambient-occlusion-intensity"),A=E/this.tileToMeter;u.properties["building-part"]="roof";let M=b.paint.get("building-color").evaluate(u,{},this.canonical).toPremultipliedRenderColor(this.lut),C=b.paint.get("building-emissive-strength").evaluate(u,{},this.canonical);u.properties["building-part"]="wall";let P=b.paint.get("building-color").evaluate(u,{},this.canonical).toPremultipliedRenderColor(this.lut),D=b.paint.get("building-emissive-strength").evaluate(u,{},this.canonical);u.properties["building-part"]="window";let R=b.paint.get("building-color").evaluate(u,{},this.canonical).toPremultipliedRenderColor(this.lut),z=b.paint.get("building-emissive-strength").evaluate(u,{},this.canonical);u.properties["building-part"]="door";let L=b.paint.get("building-color").evaluate(u,{},this.canonical).toPremultipliedRenderColor(this.lut),F=b.paint.get("building-emissive-strength").evaluate(u,{},this.canonical),O=b.layout.get("building-flood-light-wall-radius").evaluate(u,{},a),B=(O=tl(O,0,2048))/2048*32767,k=s.get(_),N=l.get(k)||[],U=0!==N.length&&b.layout.get("building-facade").evaluate(u,{},a);dk.setFacadeOptions(4,!0),dk.setFauxFacadeOptions(U,!1,1);let V=0,j=0,G=0,H=0,$=0,q=0,Z=0,W=0,X=0,Y=0,J=0;if(U){let i=Math.round(b.layout.get("building-facade-floors").evaluate(u,{},a));if(0===T){i=Math.max(1,i-(N.length>0));let r=4;if(S>100){let i=[10,13,15];r=i[u.id?u.id%i.length:0]}else S<=10&&(r=3);dk.setFacadeOptions(r,!0),$=(S<15?1.3:1.61803)*r/o}else $=T/o;$=Math.min($,q=S/o),G=b.layout.get("building-facade-unit-width").evaluate(u,{},a)/o,H=(q-$)/i,dk.setFauxFacadeOptions(!0,!0,G);let r=b.layout.get("building-facade-window").evaluate(u,{},a);V=r[0],j=r[1],Z=Math.floor(65535*Math.min(1,$/8192)),W=Math.floor(65535*Math.min(1,q/8192)),X=Math.floor(255*V)<<8|Math.floor(255*j),Y=Math.floor(65535*Math.min(1,G/8192)),J=Math.floor(65535*Math.min(1,H/8192))}let K=Array(x.length),Q={x:1/0,y:1/0},ee={x:-1/0,y:-1/0},et={x:0,y:0},ei=0;for(let i=0;i<x.length;i++){let r=x[i];if(r.length>0){let a=[],n=Array(r.length+1);n[0]=0;for(let i=0;i<r.length;i++){let o=r[i];for(let i=0;i<o.length;i++){let r=o[o.length-i-1];Q.x=Math.min(Q.x,r.x),Q.y=Math.min(Q.y,r.y),ee.x=Math.max(ee.x,r.x),ee.y=Math.max(ee.y,r.y),et.x+=r.x,et.y+=r.y,ei++,a.push(r.x),a.push(r.y)}n[i+1]=a.length}K[i]={id:u.id?u.id:0,height:S,minHeight:T,sourceId:0,roofType:w,coordinates:a,ringIndices:n}}}et.x/=ei||1,et.y/=ei||1;let er=dk.generateMesh(K,N);if("string"==typeof er){tw(`Unable to generate building ${u.id}: ${er}`),d(h);continue}if(0===er.meshes.length||0===er.modifiedPolygonRings.length){d(h);continue}let ea=U?this.buildingWithFacade:this.buildingWithoutFacade,en=0;for(let i of er.meshes)en+=i.positions.length/3;let eo=ea.segmentsBucket.prepareSegment(en,ea.layoutVertexArray,ea.indexArray),es=[],el=null,eh=0,eu=-1,ec=ea.layoutVertexArray.length,ed=ec+en;ea.layoutVertexArray.resize(ed),ea.layoutCentroidArray.resize(ed),ea.layoutNormalArray.resize(ed),ea.layoutAOArray.resize(ed),ea.layoutColorArray.resize(ed),ea.layoutFloodLightDataArray.resize(ed),U&&(ea.layoutFacadePaintArray.resize(ed),ea.layoutFacadeDataArray.resize(ed),ea.layoutFacadeVerticalRangeArray.resize(ed));let ep=ea.indexArray.length,ef=0,em=ec;for(let i of er.meshes){let r,a;
7if(1===i.buildingPart)r=M,a=C;else if(0===i.buildingPart)r=P,a=D;else if(2===i.buildingPart)r=R,a=z;else{if(3!==i.buildingPart)continue;r=L,a=F}if(a=tl(a,0,1),3===i.buildingPart){let r=[];for(let a=0;a<i.positions.length;a+=12){let n=i.positions[a+0],o=i.positions[a+1],s=i.positions[a+3],l=i.positions[a+4],h=i.positions[a+2],u=i.positions[a+8]-h,c=s-n,d=l-o,p=Math.hypot(c,d);r.push({pos:[n+.5*c,o+.5*d,h],normal:[d/p,-c/p,0],width:p,height:u,depth:1,points:[n,o,s,l]})}let a=ea.entranceBloom.segmentsBucket.prepareSegment(10*r.length,ea.entranceBloom.layoutVertexArray,ea.entranceBloom.indexArray),n=ea.entranceBloom.layoutVertexArray.length;eh=ea.entranceBloom.indexArray.length,dS(r,.5/this.tileToMeter,ea.entranceBloom.indexArray,ea.entranceBloom.layoutVertexArray,ea.entranceBloom.layoutAttenuationArray);let o=ea.entranceBloom.layoutVertexArray.length-n;eu=ea.entranceBloom.indexArray.length-eh;for(let i=0;i<o;i++)ea.entranceBloom.layoutColorArray.emplaceBack(255*L.r<<8|255*L.g,255*L.b<<8|51*F);a.vertexLength+=o,a.primitiveLength+=eu,el={part:i.buildingPart,vertexOffset:n,vertexLength:o}}ea.layoutVertexArray.float32.set(i.positions,3*em);let n=i.positions.length/3;for(let o=0;o<n;++o){let n=3*o;ef=Math.max(ef,i.positions[n+2]);let s=32767*i.normals[n+1],l=32767*i.normals[n+2],h=3*(em+o);ea.layoutNormalArray.int16[h]=32767*i.normals[n],ea.layoutNormalArray.int16[h+1]=s,ea.layoutNormalArray.int16[h+2]=l;let u=i.ao[o];ea.layoutAOArray.uint8[em+o]=255*u;let c=1+(u-1)*I,d=255*r.b*c<<8|255*a;ea.layoutColorArray.uint16[2*(em+o)]=255*r.r*c<<8|255*r.g*c,ea.layoutColorArray.uint16[2*(em+o)+1]=d}let o=Math.min(8191,Math.max(0,Math.floor(et.x))),s=Math.min(8191,Math.max(0,Math.floor(et.y))),l=Math.floor(S),h=4*o+Math.min(3,Math.round((ee.x-Q.x)*this.tileToMeter/20)),u=4*s+Math.min(3,Math.round((ee.y-Q.y)*this.tileToMeter/20));for(let i=0;i<n;++i){let r=3*(em+i);ea.layoutCentroidArray.int16[r]=h,ea.layoutCentroidArray.int16[r+1]=u,ea.layoutCentroidArray.int16[r+2]=l}if(ea.layoutFloodLightDataArray.int16.fill(0===i.buildingPart?B:0,em,em+n),U){let r=255*R.r<<8|255*R.g,a=255*R.b<<8|255*z;for(let i=0;i<n;++i){let n=2*(em+i);ea.layoutFacadePaintArray.uint16[n]=r,ea.layoutFacadePaintArray.uint16[n+1]=a}for(let r=0;r<n;++r)if(i.isFauxFacade[r]){let a=Math.min(65535,Math.floor(i.uv[2*r]*er.outerRingLength));ea.layoutFacadeDataArray.emplace(em+r,1|a,X,Y,J),ea.layoutFacadeVerticalRangeArray.emplace(em+r,Z,W)}else ea.layoutFacadeDataArray.emplace(em+r,0,0,0,0),ea.layoutFacadeVerticalRangeArray.emplace(em+r,0,0)}let c=eo.vertexLength,d=i.indices.length/3,p=ea.indexArray.length;ea.indexArray.resize(p+d);for(let r=0;r<d;++r){let a=3*r,n=3*p+a;ea.indexArray.uint16[n]=c+i.indices[a],ea.indexArray.uint16[n+1]=c+i.indices[a+1],ea.indexArray.uint16[n+2]=c+i.indices[a+2]}1!==i.buildingPart&&0!==i.buildingPart&&2!==i.buildingPart&&3!==i.buildingPart||es.push({part:i.buildingPart,vertexOffset:em,vertexLength:i.positions.length/3}),em+=n,eo.vertexLength+=n,eo.primitiveLength+=i.indices.length/3}this.maxHeight=Math.max(this.maxHeight,ef);let e_=ea.indexArray.length-ep,eg=this.footprintsIndices.length,ey=this.footprintsVertices.length,ex=[],ev=new e8(1/0,1/0),eb=new e8(-1/0,-1/0),ew=this.groundEffect.vertexArray.length;for(let i of er.modifiedPolygonRings){let r=[],a=new e8(1/0,1/0),n=new e8(-1/0,-1/0);for(let o=0;o<i.length;o+=2){let s=i.length-o-2;a.x=Math.min(a.x,i[s]),a.y=Math.min(a.y,i[s+1]),n.x=Math.max(n.x,i[s]),n.y=Math.max(n.y,i[s+1]);let l=new e8(i[s],i[s+1]);r.push(l),ex.push(l.x,l.y),this.footprintsVertices.emplaceBack(l.x,l.y)}ev.x=Math.min(ev.x,a.x),ev.y=Math.min(ev.y,a.y),eb.x=Math.max(eb.x,n.x),eb.y=Math.max(eb.y,n.y),this.groundEffect.addData(r,[a,n],A)}let eT=this.groundEffect.vertexArray.length-ew;this.groundEffect.groundRadiusArray.reserveForAdditional(eT);for(let i=0;i<eT;i++)this.groundEffect.groundRadiusArray.emplaceBack(E);(Q.x<0||ee.x>8192||Q.y<0||ee.y>8192)&&this.featuresOnBorder.push({featureId:u.id,footprintIndex:this.footprints.length});{let i=hN(ex,null,2);this.footprintsIndices.resize(this.footprintsIndices.length+i.length),this.footprintsIndices.uint16.set(i,eg),this.buildingIds.add(null!=h?h:u.id),this.footprintsMin.x=Math.min(this.footprintsMin.x,ev.x),this.footprintsMin.y=Math.min(this.footprintsMin.y,ev.y),this.footprintsMax.x=Math.max(this.footprintsMax.x,eb.x),this.footprintsMax.y=Math.max(this.footprintsMax.y,eb.y);let r={footprintVertexOffset:ey,footprintVertexLength:this.footprintsVertices.length-ey,footprintIndexOffset:eg,footprintIndexLength:this.footprintsIndices.length-eg,min:ev,max:eb,hiddenFlags:0,indicesOffset:ep,indicesLength:e_,bloomIndicesOffset:eh,bloomIndicesLength:eu,groundEffectVertexOffset:ew,groundEffectVertexLength:eT,hasFauxFacade:U,height:ef,promoteId:_,feature:f,parts:es,buildingBloom:el},a=this.footprints.length;void 0!==u.id&&this.featureFootprintLookup.set(u.id,a),p(h,a),this.footprints.push(r)}this.programConfigurations.populatePaintArrays(ea.layoutVertexArray.length,u,g,{},r.availableImages,a,r.brightness),this.groundEffect.addPaintPropertiesData(u,g,{},r.availableImages,a,r.brightness),r.featureIndex.insert(u,m,g,y,this.index,ec)}u.forEach(({buildingId:i,footprintIndex:r})=>{c.has(i)&&(this.footprints[r].hiddenFlags|=4)});let _=new Set;this.buildingIds.forEach((i,r,a)=>{c.has(i)||_.add(i)}),this.buildingIds=_,this.groundEffect.prepareBorderSegments()}update(i,r,a,n,o,s,l){this.programConfigurations.updatePaintArrays(i,r,o,a,n,s,l),this.groundEffect.update(i,r,o,a,n,s,l),this.evaluate(this.layers[0],i),this.colorBufferUploaded=!1}updateExpressions(i){this.programConfigurations.updateExpressions(i),this.groundEffect.programConfigurations.updateExpressions(i)}isEmpty(){return 0===this.buildingWithoutFacade.layoutVertexArray.length&&0===this.buildingWithFacade.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload||this.groundEffect.programConfigurations.needsUpload}upload(i){let r=r=>{r.layoutVertexBuffer=i.createVertexBuffer(r.layoutVertexArray,dE.members),r.layoutNormalBuffer=i.createVertexBuffer(r.layoutNormalArray,dI.members),r.layoutCentroidBuffer=i.createVertexBuffer(r.layoutCentroidArray,dA.members),r.layoutFloodLightDataBuffer=i.createVertexBuffer(r.layoutFloodLightDataArray,dz.members),r.layoutFacadeDataArray&&r.layoutFacadeDataArray.length&&(r.layoutFacadeDataBuffer=i.createVertexBuffer(r.layoutFacadeDataArray,dP.members)),r.layoutFacadeVerticalRangeArray&&r.layoutFacadeVerticalRangeArray.length&&(r.layoutFacadeVerticalRangeBuffer=i.createVertexBuffer(r.layoutFacadeVerticalRangeArray,dD.members)),r.entranceBloom.layoutVertexArray.length&&(r.entranceBloom.layoutVertexBuffer=i.createVertexBuffer(r.entranceBloom.layoutVertexArray,dE.members),r.entranceBloom.layoutAttenuationBuffer=i.createVertexBuffer(r.entranceBloom.layoutAttenuationArray,dR.members)),this.uploadUpdatedColorBuffer(i),this.uploadUpdatedIndexBuffer(i)};this.uploaded||(r(this.buildingWithoutFacade),r(this.buildingWithFacade),this.groundEffect.upload(i)),this.groundEffect.uploadPaintProperties(i),this.programConfigurations.upload(i),this.uploaded=!0}destroy(){let i=i=>{i.layoutVertexBuffer&&(i.layoutVertexBuffer.destroy(),i.layoutNormalBuffer.destroy(),i.layoutColorBuffer.destroy(),i.segmentsBucket.destroy(),i.indexBuffer&&i.indexBuffer.destroy(),i.entranceBloom.layoutVertexBuffer&&(i.entranceBloom.layoutVertexBuffer.destroy(),i.entranceBloom.layoutColorBuffer.destroy(),i.entranceBloom.layoutAttenuationBuffer.destroy(),i.entranceBloom.indexBuffer.destroy(),i.entranceBloom.segmentsBucket.destroy()))};i(this.buildingWithoutFacade),i(this.buildingWithFacade),this.groundEffect.destroy(),this.programConfigurations.destroy()}
7updateFootprintHiddenFlags(i,r,a=!0){let n=!1,o=a?r:0,s=0|(a?-1:~r);for(let r of(0===this.groundEffect.hiddenByLandmarkVertexArray.length&&this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length),i)){let i=this.footprints[r],a=i.hiddenFlags&s|o;i.hiddenFlags!==a&&(i.hiddenFlags=a,n=!0,this.groundEffect.updateHiddenByLandmarkRange(i.groundEffectVertexOffset,i.groundEffectVertexLength,0!==i.hiddenFlags))}return n&&(this.indexArrayForConflationUploaded=!1),n}uploadUpdatedIndexBuffer(i){if(this.groundEffect.uploadHiddenByLandmark(i),this.indexArrayForConflationUploaded)return;let r=i=>{0!==i.indexArray.length&&(i.indexArrayForConflation.resize(i.indexArray.length),i.indexArrayForConflation.uint16.set(i.indexArray.uint16),i.entranceBloom.indexArrayForConflation.resize(i.entranceBloom.indexArray.length),i.entranceBloom.indexArrayForConflation.uint16.set(i.entranceBloom.indexArray.uint16))};for(let i of(r(this.buildingWithoutFacade),r(this.buildingWithFacade),this.footprints)){let r=i.hasFauxFacade?this.buildingWithFacade:this.buildingWithoutFacade,a=i.indicesOffset+i.indicesLength;if(0!==i.hiddenFlags){for(let n=i.indicesOffset;n<a;n++)r.indexArrayForConflation.uint16[3*n+0]=0,r.indexArrayForConflation.uint16[3*n+1]=0,r.indexArrayForConflation.uint16[3*n+2]=0;let n=i.bloomIndicesOffset+i.bloomIndicesLength;for(let a=i.bloomIndicesOffset;a<n;a++)r.entranceBloom.indexArrayForConflation.uint16[3*a+0]=0,r.entranceBloom.indexArrayForConflation.uint16[3*a+1]=0,r.entranceBloom.indexArrayForConflation.uint16[3*a+2]=0}}let a=r=>{0!==r.indexArray.length&&(r.indexBuffer?r.indexBuffer.updateData(r.indexArrayForConflation):r.indexBuffer=i.createIndexBuffer(r.
7indexArrayForConflation,!0),r.entranceBloom.indexBuffer?r.entranceBloom.indexBuffer.updateData(r.entranceBloom.indexArrayForConflation):r.entranceBloom.indexBuffer=i.createIndexBuffer(r.entranceBloom.indexArrayForConflation,!0))};a(this.buildingWithoutFacade),a(this.buildingWithFacade),this.indexArrayForConflationUploaded=!0}uploadUpdatedColorBuffer(i){let r=r=>{r.layoutColorBuffer?r.layoutColorBuffer.updateData(r.layoutColorArray):r.layoutColorBuffer=i.createVertexBuffer(r.layoutColorArray,dM.members,!0),r.layoutFacadePaintArray&&(r.layoutFacadePaintBuffer?r.layoutFacadePaintBuffer.updateData(r.layoutFacadePaintArray):r.layoutFacadePaintBuffer=i.createVertexBuffer(r.layoutFacadePaintArray,dC.members,!0)),r.entranceBloom.layoutColorBuffer?r.entranceBloom.layoutColorBuffer.updateData(r.entranceBloom.layoutColorArray):r.entranceBloom.layoutColorBuffer=i.createVertexBuffer(r.entranceBloom.layoutColorArray,dM.members,!0)};r(this.buildingWithoutFacade),r(this.buildingWithFacade),this.colorBufferUploaded=!0}evaluate(i,r){let a=i.paint.get("building-ambient-occlusion-intensity");for(let n of this.footprints){if(4&n.hiddenFlags)continue;let o=r[n.promoteId],s=n.feature;s.properties["building-part"]="roof";let l=i.paint.get("building-color").evaluate(s,o,this.canonical).toPremultipliedRenderColor(this.lut),h=i.paint.get("building-emissive-strength").evaluate(s,o,this.canonical);s.properties["building-part"]="wall";let u=i.paint.get("building-color").evaluate(s,o,this.canonical).toPremultipliedRenderColor(this.lut),c=i.paint.get("building-emissive-strength").evaluate(s,o,this.canonical);s.properties["building-part"]="window";let d=i.paint.get("building-color").evaluate(s,o,this.canonical).toPremultipliedRenderColor(this.lut),p=i.paint.get("building-emissive-strength").evaluate(s,o,this.canonical);s.properties["building-part"]="door";let f=i.paint.get("building-color").evaluate(s,o,this.canonical).toPremultipliedRenderColor(this.lut),m=i.paint.get("building-emissive-strength").evaluate(s,o,this.canonical),_=n.hasFauxFacade?this.buildingWithFacade:this.buildingWithoutFacade;for(let i of n.parts){let r,o=l;1===i.part?(o=l,r=h):0===i.part?(o=u,r=c):2===i.part?(o=d,r=p):3===i.part&&(o=f,r=m),r=tl(r,0,1);for(let s=0;s<i.vertexLength;s++){let l=i.vertexOffset+s,h=1+(_.layoutAOArray.uint8[l]/255-1)*a;_.layoutColorArray.emplace(l,o.r*h*255<<8|o.g*h*255,o.b*h*255<<8|255*r),n.hasFauxFacade&&_.layoutFacadePaintArray.emplace(l,255*d.r<<8|255*d.g,255*d.b<<8|255*p)}}let g=n.buildingBloom;if(g)for(let i=0;i<g.vertexLength;i++)_.entranceBloom.layoutColorArray.emplace(g.vertexOffset+i,255*f.r<<8|255*f.g,255*f.b<<8|51*m)}}needsEvaluation(){return!this.colorBufferUploaded}updateReplacement(i,r,a){if(r.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=r.updateTime;let n=r.getReplacementRegionsForTile(i.toUnwrapped());if(uY(this.activeReplacements,n))return;for(let i of(this.activeReplacements=n,this.footprints))i.hiddenFlags&=-2;let o=[];for(let r of this.activeReplacements){if(r.order<a)continue;let n=Math.max(1,Math.pow(2,r.footprintTileId.canonical.z-i.canonical.z));for(let a of this.footprints)a.min.x>r.max.x||a.max.x<r.min.x||a.min.y>r.max.y||a.max.y<r.min.y||(o.length=0,function(i,r,a,n,o,s){let l=Math.pow(2,n.z-o.z);for(let h=0;h<a;h++){let a=i.float32[2*(h+r)+0],u=i.float32[2*(h+r)+1];a=(a+8192*o.x)*l-8192*n.x,u=(u+8192*o.y)*l-8192*n.y,s.push(new e8(a,u))}}(this.footprintsVertices,a.footprintVertexOffset,a.footprintVertexLength,r.footprintTileId.canonical,i.canonical,o),uK(r.footprint,o,this.footprintsIndices.uint16,a.footprintIndexOffset,a.footprintIndexLength,0,-n)&&(a.hiddenFlags|=1))}for(let i of(0===this.groundEffect.hiddenByLandmarkVertexArray.length&&this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length),this.footprints))this.groundEffect.updateHiddenByLandmarkRange(i.groundEffectVertexOffset,i.groundEffectVertexLength,0!==i.hiddenFlags);this.indexArrayForConflationUploaded=!1}getFootprint(i){if(void 0!==i.id){let r=this.featureFootprintLookup.get(i.id);return this.footprints[r]}return null}getHeightAtTileCoord(i,r){let a=-1/0,n=!0,o=4*(i+8192)*8192+(r+8192);if(Object.hasOwn(this.footprintLookup,o)){let i=this.footprintLookup[o];return i?{height:i.height,hidden:0!==i.hiddenFlags}:void 0}let s=new e8(i,r);for(let l of this.footprints)i>l.max.x||l.min.x>i||r>l.max.y||l.min.y>r||l.height<=a||function(i,r,a){for(let n=0;n<a.length;n+=3){let o=a[n],s=a[n+1],l=a[n+2],h=r[2*o+0],u=r[2*o+1],c=r[2*s+0],d=r[2*s+1],p=r[2*l+0],f=r[2*l+1],m=(h-p)*(i.y-f)-(u-f)*(i.x-p),_=(c-h)*(i.y-u)-(d-u)*(i.x-h);if(m<0!=_<0&&0!==m&&0!==_)continue;
7let g=(p-c)*(i.y-d)-(f-d)*(i.x-c);if(0===g||g<0==m+_<=0)return!0}return!1}(s,this.footprintsVertices.float32.subarray(2*l.footprintVertexOffset,2*(l.footprintVertexOffset+l.footprintVertexLength)),this.footprintsIndices.uint16.subarray(l.footprintIndexOffset,l.footprintIndexOffset+l.footprintIndexLength))&&(a=l.height,this.footprintLookup[o]=l,n=0!==l.hiddenFlags);if(a!==-1/0)return{height:a,hidden:n};this.footprintLookup[o]=void 0}}async function dj(){return tE(self)&&null==dk&&null==dB?null!=dO?dO:dO=(function(i){let r,a,n,o,s;function l(){r=new Uint8Array(s.buffer),a=new Int16Array(s.buffer),n=new Int32Array(s.buffer),o=new Float32Array(s.buffer)}function h(){throw Error("Unexpected BuildingGen error.")}let u=()=>{},c={a:{a:h,f:function(i){let a=r.length,n=Math.ceil((Math.max(i>>>0,Math.ceil(1.2*a))-a)/65536);try{return s.grow(n),l(),!0}catch(i){return!1}},g:h,b:u,c:u,d:u,e:u}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(i,c):i.then(i=>i.arrayBuffer()).then(i=>WebAssembly.instantiate(i,c))).then(i=>{let h=i.instance.exports;return(0,h.g)(),s=h.f,l(),new dL({setStyle:h.h,setAOOptions:h.i,setMetricOptions:h.j,setStructuralOptions:h.k,setFacadeOptions:h.l,setFauxFacadeOptions:h.m,setFacadeClassifierOptions:h.n,addFeature:h.o,addFacade:h.p,generateMesh:h.q,getLastError:h.r,getOuterRingLength:h.s,getMeshCount:h.t,getPositionsPtr:h.u,getPositionsLength:h.v,getNormalsPtr:h.w,getNormalsLength:h.x,getAOPtr:h.y,getAOLength:h.z,getUVPtr:h.A,getUVLength:h.B,getFauxFacadePtr:h.C,getFauxFacadeLength:h.D,getIndicesPtr:h.E,getIndicesLength:h.F,getBuildingPart:h.G,getRingCount:h.H,getRingPtr:h.I,getRingLength:h.J,malloc:h.K,free:h.L,heapU8:r,heap16:a,heap32:n,heapF32:o})})})(fetch(tk())).then(i=>{dO=null,dk=i}).catch(i=>{tw("Could not load building-gen"),dO=null,dB=i}):null}nl(dV,"BuildingBucket",{omit:["layers"]}),nl(dU,"BuildingGeometry"),nl(dN,"BuildingBloomGeometry");let dG=oA([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"},{name:"a_linesofar",components:1,type:"Float32"}],4),dH=oA([{name:"a_z_offset_width",components:3,type:"Float32"}],4),d$=oA([{name:"a_elevation_id_col",components:3,type:"Float32"}],4),dq=oA([{name:"a_elevation_ground_scale",components:1,type:"Float32"}],4),{members:dZ}=dG,{members:dW}=oA([{name:"a_packed",components:3,type:"Float32"}]),{members:dX}=oA([{name:"a_pattern_data",components:3,type:"Float32"}]);
7class dY{constructor(i,r){this.width=i,this.height=r,this.nextRow=0,this.image=new hD({width:i,height:r}),this.positions={},this.uploaded=!1}getDash(i,r){let a=this.getKey(i,r);return this.positions[a]}trim(){let i=this.width,r=this.height=tm(this.nextRow);this.image.resize({width:i,height:r})}getKey(i,r){return i.join(",")+r}getDashRanges(i,r,a){let n=[],o=i.length%2==1?-i.at(-1)*a:0,s=i[0]*a,l=!0;n.push({left:o,right:s,isDash:l,zeroLength:0===i[0]});let h=i[0];for(let r=1;r<i.length;r++){l=!l;let u=i[r];o=h*a,h+=u,s=h*a,n.push({left:o,right:s,isDash:l,zeroLength:0===u})}return n}addRoundDash(i,r,a){let n=r/2;for(let r=-a;r<=a;r++){let o=this.width*(this.nextRow+a+r),s=0,l=i[0];for(let h=0;h<this.width;h++){let u;h/l.right>1&&(l=i[++s]);let c=Math.min(Math.abs(h-l.left),Math.abs(h-l.right)),d=r/a*(n+1);if(l.isDash){let i=n-Math.abs(d);u=Math.sqrt(c*c+i*i)}else u=n-Math.sqrt(c*c+d*d);this.image.data[o+h]=Math.max(0,Math.min(255,u+128))}}}addRegularDash(i,r){for(let r=i.length-1;r>=0;--r){let a=i[r],n=i[r+1];a.zeroLength?i.splice(r,1):n&&n.isDash===a.isDash&&(n.left=a.left,i.splice(r,1))}let a=i[0],n=i.at(-1);a.isDash===n.isDash&&(a.left=n.left-this.width,n.right=a.right+this.width);let o=this.width*this.nextRow,s=0,l=i[0];for(let a=0;a<this.width;a++){a/l.right>1&&(l=i[++s]);let n=Math.min(Math.abs(a-l.left),Math.abs(a-l.right));this.image.data[o+a]=Math.max(0,Math.min(255,(l.isDash?n:-n)+r+128))}}addDash(i,r){let a=this.getKey(i,r);if(this.positions[a])return this.positions[a];let n="round"===r,o=7*!!n,s=2*o+1;if(this.nextRow+s>this.height)return tw("LineAtlas out of space"),null;0===i.length&&i.push(1);let l=0;for(let r=0;r<i.length;r++)i[r]<0&&(tw("Negative value is found in line dasharray, replacing values with 0"),i[r]=0),l+=i[r];if(0!==l){let a=this.width/l,s=this.getDashRanges(i,this.width,a);n?this.addRoundDash(s,a,o):this.addRegularDash(s,"square"===r?.5*a:0)}let h=this.nextRow+o;this.nextRow+=s;let u=Math.floor(l),c={tl:[h,o],br:[u,Math.round(65535*(l-u))]};return this.positions[a]=c,c}}nl(dY,"LineAtlas");let dJ=ll.types,dK=Math.cos(Math.PI/180*37.5),dQ=Math.cos(Math.PI/180*5);class d0{constructor(i){this.evaluationGlobals={zoom:0,lineProgress:void 0},this.elevationType="none",this.isSeaLevelReference=!1,this.showElevationIdDebug=!1,this.zoom=i.zoom,this.evaluationGlobals.zoom=this.zoom,this.overscaling=i.overscaling,this.pixelRatio=i.pixelRatio,this.layers=i.layers,this.layerIds=this.layers.map(i=>i.fqid),this.index=i.index,this.projection=i.projection,this.hasPattern=!1,this.hasCrossSlope=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(i=>{this.gradients[i.id]={}}),this.layoutVertexArray=new oB,this.layoutVertexArray2=new ok,this.patternVertexArray=new ok,this.indexArray=new oJ,this.programConfigurations=new sH(i.layers,{zoom:i.zoom,lut:i.lut}),this.segments=new sy,this.maxLineLength=0,this.zOffsetVertexArray=new ok,this.elevationIdColVertexArray=new ok,this.elevationGroundScaleVertexArray=new oR,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.tessellationStep=i.tessellationStep?i.tessellationStep:128,this.worldview=i.worldview,this.hasAppearances=null}updateFootprints(i,r){}updateAppearances(i,r,a,n){return{hasLayoutChanges:!1,hasUboChanges:!1}}populate(i,r,a,n){this.showElevationIdDebug=r.showElevationIdDebug,this.hasPattern=h4("line",this.layers,this.pixelRatio,r);let o=this.layers[0].layout.get("line-sort-key");this.tileToMeter=li(a);let s=this.layers[0].layout.get("line-elevation-reference");if("hd-road-markup"===s)this.elevationType="road";else{let i=this.layers[0].layout.get("line-z-offset"),r=i.isConstant()&&!i.constantOr(0);this.elevationType="sea"!==s&&"ground"!==s&&r?"none":"offset","offset"===this.elevationType&&"none"===s&&tw(`line-elevation-reference: ground is used for the layer ${this.layerIds[0]} because non-zero line-z-offset value was found.`),this.isSeaLevelReference="sea"===s}let l=this.layers[0].layout.get("line-cross-slope");this.hasCrossSlope="offset"===this.elevationType&&void 0!==l;let h=[];for(let{feature:s,id:l,index:u,sourceLayerIndex:c}of i){let i=this.layers[0]._featureFilter.needGeometry,d=ls(s,i);if(!this.layers[0]._featureFilter.filter(new n0(this.zoom,{worldview:this.worldview,activeFloors:r.activeFloors}),d,a))continue;let p=o?o.evaluate(d,{},a):void 0,f={id:l,properties:s.properties,type:s.type,sourceLayerIndex:c,index:u,geometry:i?d.geometry:lo(s,a,n),patterns:{},sortKey:p};h.push(f)}o&&h.sort((i,r)=>i.sortKey-r.sortKey);let{lineAtlas:u,featureIndex:c}=r,d=this.addConstantDashes(u);for(let n of h){let{geometry:o,index:s,sourceLayerIndex:l}=n;if(d&&this.addFeatureDashes(n,u),this.hasPattern){let i=h6("line",this.layers,n,this.zoom,this.pixelRatio,r);this.patternFeatures.push(i)}else this.addFeature(n,o,s,a,u.positions,r.availableImages,r.brightness,r.elevationFeatures);c.insert(i[s].feature,o,s,l,this.index)}}addConstantDashes(i){let r=!1;for(let a of this.layers){let n=a.paint.get("line-dasharray").value,o=a.layout.get("line-cap").value;if("constant"!==n.kind||"constant"!==o.kind)r=!0;else{let r=o.value,a=n.value;if(!a)continue;i.addDash(a,r)}}return r}addFeatureDashes(i,r){let a=this.zoom;for(let n of this.layers){let o,s,l=n.paint.get("line-dasharray").value,h=n.layout.get("line-cap").value;if("constant"!==l.kind||"constant"!==h.kind){if("constant"===l.kind){if(!(o=l.value))continue}else o=l.evaluate({zoom:a},i);s="constant"===h.kind?h.value:h.evaluate({zoom:a},i),r.addDash(o,s),i.patterns[n.id]=[r.getKey(o,s)]}}}update(i,r,a,n,o,s,l,h,u){this.programConfigurations.updatePaintArrays(i,r,o,a,n,s,l,u)}updateExpressions(i){this.programConfigurations.updateExpressions(i)}addFeatures(i,r,a,n,o,s){for(let o of this.patternFeatures)this.addFeature(o,o.geometry,o.index,r,a,n,s,i.elevationFeatures)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(i){this.uploaded||(0!==this.layoutVertexArray2.length&&(this.layoutVertexBuffer2=i.createVertexBuffer(this.layoutVertexArray2,dW)),0!==this.patternVertexArray.length&&(this.patternVertexBuffer=i.createVertexBuffer(this.patternVertexArray,dX)),!this.zOffsetVertexBuffer&&this.zOffsetVertexArray.length>0&&(this.zOffsetVertexBuffer=i.createVertexBuffer(this.zOffsetVertexArray,dH.members,!0)),!this.elevationIdColVertexBuffer&&this.elevationIdColVertexArray.length>0&&(this.elevationIdColVertexBuffer=i.createVertexBuffer(this.elevationIdColVertexArray,d$.members,!0)),!this.elevationGroundScaleVertexBuffer&&this.elevationGroundScaleVertexArray.length>0&&(this.elevationGroundScaleVertexBuffer=i.createVertexBuffer(this.elevationGroundScaleVertexArray,dq.members,!0)),this.layoutVertexBuffer=i.createVertexBuffer(this.layoutVertexArray,dZ),this.indexBuffer=i.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(i),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.zOffsetVertexBuffer&&this.zOffsetVertexBuffer.destroy(),this.elevationIdColVertexBuffer&&this.elevationIdColVertexBuffer.destroy(),this.elevationGroundScaleVertexBuffer&&this.elevationGroundScaleVertexBuffer.destroy(),this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(i,r){let a,n;if(r&&r>0?(a=`mapbox_clip_start_${r}`,n=`mapbox_clip_end_${r}`):(a="mapbox_clip_start",n="mapbox_clip_end"),i.properties&&Object.hasOwn(i.properties,a)&&Object.hasOwn(i.properties,n))return{start:+i.properties[a],end:+i.properties[n]}}addFeature(i,r,a,n,o,s,l,h){let u=this.layers[0].layout,c=u.get("line-join").evaluate(i,{}),d=u.get("line-cap").evaluate(i,{}),p=u.get("line-miter-limit"),f=u.get("line-round-limit");this.lineClips=this.lineFeatureClips(i),this.lineFeature=i;let m=!(!i.properties||!Object.hasOwn(i.properties,"mapbox_line_metrics"))&&i.properties.mapbox_line_metrics;this.zOffsetValue=u.get("line-z-offset").value;let _=this.layers[0].paint.get("line-width").value;if("constant"!==_.kind&&!1===_.isLineProgressConstant&&(this.variableWidthValue=_),this.isSeaLevelReference){let i=u.get("line-elevation-ground-scale").value;"constant"===i.kind&&0===i.value||(this.elevationGroundScaleValue=i)}if("road"===this.elevationType){let a=this.layoutVertexArray.length;if(!this.addElevatedRoadFeature(i,r,n,h,c,d,p,f)){let[o,s]=this.clipRuntimeLinesToTile(r,1);for(let r=0;r<o.length;r++){let a=o[r],l=s[r],h={progress:{min:l.progress.min,max:l.progress.max},nextDir:this.computeSegNextDir(l,a),prevDir:this.computeSegPrevDir(l,a)};this.addLine(a,i,n,c,d,p,f,h,m&&l.parentIndex>0?l.parentIndex:null)}this.fillNonElevatedRoadSegment(a)}}else for(let a=0;a<r.length;a++)this.addLine(r[a],i,n,c,d,p,f,void 0,m&&a>0?a:null);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,i,a,o,s,n,l,void 0,this.worldview)}computeSegNextDir(i,r){return i.nextPoint.sub(r.at(-2)).unit()}computeSegPrevDir(i,r){return r[1].sub(i.prevPoint).unit()}clipLinesToTile(i,r){return cT(i,-r,-r,8192+r,8192+r)}clipRuntimeLinesToTile(i,r){let a=[];return[cT(i,-r,-r,8192+r,8192+r,a),a]}addElevatedRoadFeature(i,r,a,n,o,s,l,h){let u=[],c=lz.getElevationFeature(i,n);if(c){let i=this.clipLinesToTile(r,1);for(let r of this.prepareElevatedLines(i,c,a))u.push({geometry:r,elevation:c,elevationTileID:a,segment:{progress:{min:0,max:1},nextDir:void 0,prevDir:void 0}})}if(0===u.length)return!1;for(let r of u){let n=this.layoutVertexArray.length;this.addLine(r.geometry,i,a,o,s,l,h);let u=new lL(a,r.elevationTileID);if(r.elevation){let i=this.showElevationIdDebug?function(i){if(0===i)return[0,0,0];let r=aV(i);return[r(),r(),r()]}(r.elevation.id):null;for(let a=n;a<this.layoutVertexArray.length;a++){let n=new e8(this.layoutVertexArray.int16[6*a]>>1,this.layoutVertexArray.int16[6*a+1]>>1),o=u.pointElevation(n,r.elevation,.05);this.updateHeightRange(o),this.zOffsetVertexArray.emplaceBack(o,0,0),i?this.elevationIdColVertexArray.emplaceBack(i[0],i[1],i[2]):this.showElevationIdDebug&&this.elevationIdColVertexArray.emplaceBack(0,0,0)}}else this.fillNonElevatedRoadSegment(n)}return!0}prepareElevatedLines(i,r,a){if(null!=r.constantHeight)return i;let n=[],o=1/li(a);for(let a of i)!function(i,r,a,n,o){if(i.length<2)return n.push(i);let s=[];for(;r.valid();){let[a,n]=r.get();for(let r=0;r<i.length-1;r++){let o=i[r],l=i[r+1],h=function(i,r,a,n){let o=lN(i,r,n),s=lN(i,r,a);
7if(Math.sign(o)===Math.sign(s))return;let l=lN(a,n,i),h=l+s-o;return Math.sign(l)!==Math.sign(h)?[l/(l-h),s/(s-o)]:void 0}(o,l,a,n);if(h){let[i]=h,a=new e8(iE(o.x,l.x,i),iE(o.y,l.y,i));s.push({t:r+i,distance:0,point:a})}}r.next()}if(0===s.length)return n.push(i);s.sort((i,r)=>i.t-r.t);let l=0,h=0,u=[];for(n.push(u);l!==i.length;){if(h===s.length){for(;l!==i.length;)0!==u.length&&u.at(-1).equals(i[l])||u.push(i[l]),l++;break}s[h].t<=l?(0!==u.length&&u.at(-1).equals(s[h].point)||u.push(s[h].point),s[h].t,h++):(0!==u.length&&u.at(-1).equals(i[l])||u.push(i[l]),l++)}}(a,new lD(r,o),0,n);return n}fillNonElevatedRoadSegment(i){for(let r=i;r<this.layoutVertexArray.length;r++)this.zOffsetVertexArray.emplaceBack(0,0,0),this.showElevationIdDebug&&this.elevationIdColVertexArray.emplaceBack(0,0,0)}updateHeightRange(i){this.heightRange?(this.heightRange.min=Math.min(this.heightRange.min,i),this.heightRange.max=Math.max(this.heightRange.max,i)):this.heightRange={min:i,max:i}}addLine(i,r,a,n,o,s,l,h,u){let c,d,p,f,m,_,g,y;this.distance=0,this.prevDistance=0,this.scaledDistance=0,this.totalDistance=0,this.totalFeatureLength=0,this.lineSoFar=0,this.currentVertex=void 0,this.lineClips=u?this.lineFeatureClips(r,u):this.lineClips;let x="none"===n;this.patternJoinNone=this.hasPattern&&x,this.currentLineJoinType=n,this.segmentStart=0,this.segmentStartf32=0,this.segmentPoints=[];let v=h&&h.progress.min>0,b=h&&h.progress.max<1;if(this.lineClips){let a={min:this.lineClips.start,max:this.lineClips.end},n=1;if(h){var w,T,S;let i=this.lineClips.end-this.lineClips.start;w=h.progress,T={min:0,max:1},S=a,a={min:tL(w.min,T,S),max:tL(w.max,T,S)},i>0&&(n=(a.max-a.min)/i)}let o=+r.properties.mapbox_clip_feature_len,s=+r.properties.mapbox_clip_seg_len;if(Number.isNaN(o)||Number.isNaN(s)){for(let r=0;r<i.length-1;r++)this.totalDistance+=i[r].dist(i[r+1]);let r=this.totalDistance/(a.max-a.min);this.totalFeatureLength=Number.isFinite(r)?r:0,this.lineClips.start=a.min,this.lineClips.end=a.max,this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}else this.totalFeatureLength=o,this.distance=s*n,this.lineClips.start=a.min,this.lineClips.end=a.max,this.maxLineLength=Math.max(this.maxLineLength,this.distance);this.lineClipsArray.push(this.lineClips),this.updateScaledDistance()}let E="Polygon"===dJ[r.type],I=i.length;for(;I>=2&&i[I-1].equals(i[I-2]);)I--;let A=0;for(;A<I-1&&i[A].equals(i[A+1]);)A++;if(I<(E?3:2))return;"bevel"===n&&(s=1.05);let M=this.segments.prepareSegment(10*I,this.layoutVertexArray,this.indexArray);h&&h.prevDir&&(_=h.prevDir.perp()),h&&h.nextDir&&(g=h.nextDir.perp()),this.e1=this.e2=-1,E&&(c=i[I-2],m=i[A].sub(c)._unit()._perp());for(let r=A;r<I;r++){if((p=r===I-1?E?i[A+1]:void 0:i[r+1])&&i[r].equals(p))continue;m&&(f=m),c&&(d=c),c=i[r],y=this.evaluateLineProgressFeatures(d?d.dist(c):0),m=p?p.sub(c)._unit()._perp():f,f=f||m;let a=d&&p,h=a?n:E||x?"butt":o,u=f.x*m.x+f.y*m.y;if(x){let i=function(i){if(i.patternJoinNone){let r=i.segmentPoints.length/2,a=i.lineSoFar-i.segmentStart;for(let n=0;n<r;++n){let r=i.segmentPoints[2*n+1],o=Math.round(i.segmentPoints[2*n])+.5+.25*r;i.patternVertexArray.emplaceBack(o,a,i.segmentStart),i.patternVertexArray.emplaceBack(o,a,i.segmentStart)}i.segmentPoints.length=0}i.e1=i.e2=-1};if(a&&u<dQ){this.updateDistance(d,c),this.addCurrentVertex(c,f,1,1,M,y),i(this),this.addCurrentVertex(c,m,-1,-1,M,y);continue}if(d){if(!p){this.updateDistance(d,c),this.addCurrentVertex(c,f,1,1,M,y),i(this);continue}h="miter"}}let w=f.add(m);0===w.x&&0===w.y||w._unit();let T=w.x*m.x+w.y*m.y,S=0!==T?1/T:1/0,C=2*Math.sqrt(2-2*T),P=T<dK&&d&&p,D=f.x*m.y-f.y*m.x>0,R=this.overscaling<=16?122880/(512*this.overscaling):0;if(a&&"round"===h){if(S<l)h="miter";else if(S<=2){let i=d1(c,-10,8202);h="offset"===this.elevationType&&(i||this.hasCrossSlope)?"miter":"fakeround"}}if("miter"===h&&S>s&&(h="bevel"),"bevel"===h&&(S>2&&(h="flipbevel"),S<s&&(h="miter")),d&&!("miter"===h&&P)&&this.updateDistance(d,c),"miter"
7===h)if(P){let i=c.dist(d);if(i>2*R){let r=c.sub(c.sub(d)._mult(R/i)._round());this.updateDistance(d,r),this.addCurrentVertex(r,f,0,0,M,y),d=r}this.updateDistance(d,c),w._mult(S),this.addCurrentVertex(c,w,0,0,M,y);let r=c.dist(p);if(r>2*R){let i=c.add(p.sub(c)._mult(R/r)._round());this.updateDistance(c,i),this.addCurrentVertex(i,m,0,0,M,y),c=i}}else w._mult(S),this.addCurrentVertex(c,w,0,0,M,y);else if("flipbevel"===h){if(S>100)w=m.mult(-1);else{let i=S*f.add(m).mag()/f.sub(m).mag();w._perp()._mult(i*(D?-1:1))}this.addCurrentVertex(c,w,0,0,M,y),this.addCurrentVertex(c,w.mult(-1),0,0,M,y)}else if("bevel"===h||"fakeround"===h){let i=c.dist(d),r=1;if("offset"===this.elevationType&&"bevel"===h&&"round"!==this.currentLineJoinType&&!this.patternJoinNone&&null!=y&&d&&p){let a=4*R;i<a&&(r=Math.max(0,i/a))}null!=y&&d&&this.addCurrentVertex(c,g||f,-r,-r,M,y);let a=i<=2*R&&"bevel"!==h,n=w.mult(D?1:-1);n._mult(S);let o=m.mult(D?-1:1),s=f.mult(D?-1:1),l=this.evaluateLineProgressFeatures(this.distance);if(null==y&&(this.addHalfVertex(c,n.x,n.y,!1,!D,0,M,l),a||this.addHalfVertex(c,n.x+2*s.x,n.y+2*s.y,!1,D,0,M,l)),"fakeround"===h){let i=Math.round(180*C/Math.PI/20);this.addHalfVertex(c,s.x,s.y,!1,D,0,M,l);for(let r=0;r<i;r++){let a=r/i;if(.5!==a){let i=a-.5;a+=a*i*(a-1)*((1.0904+u*(u*(3.55645-1.43519*u)-3.2452))*i*i+(.848013+u*(.215638*u-1.06021)))}let n=o.sub(s)._mult(a)._add(s)._unit();this.addHalfVertex(c,n.x,n.y,!1,D,0,M,l)}this.addHalfVertex(c,o.x,o.y,!1,D,0,M,l)}a||null!=y||this.addHalfVertex(c,n.x+2*o.x,n.y+2*o.y,!1,D,0,M,l),null!=y&&p&&this.addCurrentVertex(c,_||m,r,r,M,y)}else if("butt"===h)this.addCurrentVertex(c,w,0,0,M,y);else if("square"===h){if(!d){let i=v?0:-1;this.addCurrentVertex(c,w,i,i,M,y)}if(this.addCurrentVertex(c,w,0,0,M,y),d){let i=+!b;this.addCurrentVertex(c,w,i,i,M,y)}}else if("round"===h){if(d){let i=!a&&g?g:f;this.addCurrentVertex(c,i,0,0,M,y),!a&&b||this.addCurrentVertex(c,i,1,1,M,y,!0)}if(p){let i=!a&&_?_:m;!a&&v||this.addCurrentVertex(c,i,-1,-1,M,y,!0),this.addCurrentVertex(c,i,0,0,M,y)}}}}addVerticesTo(i,r,a,n,o,s,l,h,u,c){let d=(r.w-i.w)/this.tessellationStep|0,p=0,f=this.scaledDistance;if(d>1){this.lineSoFar=i.w;let a=(r.x-i.x)/d,n=(r.y-i.y)/d,o=(r.z-i.z)/d,s=(r.w-i.w)/d,l=r.x-i.x,h=r.y-i.y,f=Math.sqrt(l*l+h*h);if(0===f)return;let m=-h/f,_=l/f,g=-m,y=-_;for(let r=1;r<d;++r){i.x+=a,i.y+=n,i.z+=o,this.lineSoFar+=s,p+=s;let r=this.evaluateLineProgressFeatures(this.prevDistance+p);this.scaledDistance=(this.prevDistance+p)/this.totalDistance,this.addHalfVertex(i,m,_,c,!1,0,u,r),this.addHalfVertex(i,g,y,c,!0,0,u,r)}}this.lineSoFar=r.w,this.scaledDistance=f;let m=this.evaluateLineProgressFeatures(this.distance);this.addHalfVertex(r,a,n,c,!1,l,u,m),this.addHalfVertex(r,o,s,c,!0,-h,u,m)}evaluateLineProgressFeatures(i){if(!this.variableWidthValue&&"offset"!==this.elevationType)return null;this.evaluationGlobals.lineProgress=0,this.lineClips?this.evaluationGlobals.lineProgress=Math.min(1,(this.totalFeatureLength*this.lineClips.start+i)/this.totalFeatureLength):tw(`line-progress evaluation for ${this.layerIds[0]} requires enabling 'lineMetrics' for the source.`);let r=0;this.variableWidthValue&&"constant"!==this.variableWidthValue.kind&&(r=this.variableWidthValue.evaluate(this.evaluationGlobals,this.lineFeature)||0);let a=this.evaluateElevationGroundScale();return"offset"!==this.elevationType?{zOffset:0,variableWidth:r,elevationGroundScale:a}:"constant"===this.zOffsetValue.kind?{zOffset:this.zOffsetValue.value,variableWidth:r,elevationGroundScale:a}:{zOffset:this.zOffsetValue.evaluate(this.evaluationGlobals,this.lineFeature)||0,variableWidth:r,elevationGroundScale:a}}evaluateElevationGroundScale(){return this.elevationGroundScaleValue?"constant"===this.elevationGroundScaleValue.kind?this.elevationGroundScaleValue.value:this.elevationGroundScaleValue.evaluate(this.evaluationGlobals,this.lineFeature)||0:0}addCurrentVertex(i,r,a,n,o,s,l=!1){let h=r.x+r.y*a,u=r.y-r.x*a,c=r.y*n-r.x,d=-r.y-r.x*n;if(null!=s){let r="offset"===this.elevationType,p="offset"===this.elevationType?2:10,f=-p,m=8192+p,_=s.zOffset,g=new cv(i.x,i.y,_,this.lineS
7oFar),y=!!r&&d1(i,f,m),x=this.lineSoFar,v=this.distance;if(this.currentVertex)if(y){let r=this.currentVertexIsOutside,s=this.currentVertex,p=new cv(i.x,i.y,_,this.lineSoFar);if(cw(s,p,f,m),!d1(p,f,m)){if(r){this.e1=this.e2=-1,this.distance-=s.dist(g),this.lineSoFar=s.w;let i=this.evaluateLineProgressFeatures(s.w-this.totalFeatureLength*(this.lineClips?this.lineClips.start:0));this.addHalfVertex(s,h,u,l,!1,a,o,i),this.addHalfVertex(s,c,d,l,!0,-n,o,i),this.prevDistance=this.distance}this.distance=this.prevDistance+s.dist(p),this.scaledDistance=this.distance/this.totalDistance,this.addVerticesTo(s,p,h,u,c,d,a,n,o,l),this.distance=v,this.scaledDistance=this.distance/this.totalDistance}}else{let i=this.currentVertex;if(this.currentVertexIsOutside){cw(i,g,f,m),this.e1=this.e2=-1,this.distance-=i.dist(g),this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=i.w;let r=this.evaluateLineProgressFeatures(i.w-this.totalFeatureLength*(this.lineClips?this.lineClips.start:0));this.addHalfVertex(i,h,u,l,!1,a,o,r),this.addHalfVertex(i,c,d,l,!0,-n,o,r),this.prevDistance=this.distance,this.distance=v,this.scaledDistance=this.distance/this.totalDistance}this.addVerticesTo(i,g,h,u,c,d,a,n,o,l)}else y||(this.addHalfVertex(i,h,u,l,!1,a,o,s),this.addHalfVertex(i,c,d,l,!0,-n,o,s));this.currentVertex=g,this.currentVertexIsOutside=y,this.lineSoFar=x}else this.addHalfVertex(i,h,u,l,!1,a,o,s),this.addHalfVertex(i,c,d,l,!0,-n,o,s)}addHalfVertex({x:i,y:r},a,n,o,s,l,h,u){if(this.patternJoinNone&&(0===this.segmentPoints.length&&(this.segmentStart=this.lineSoFar,this.segmentStartf32=Math.fround(this.lineSoFar)),s||this.segmentPoints.push(this.lineSoFar-this.segmentStart,l)),this.layoutVertexArray.emplaceBack((i<<1)+ +!!o,(r<<1)+ +!!s,Math.round(63*a)+128,Math.round(63*n)+128,1+(0===l?0:l<0?-1:1),0,this.lineSoFar-this.segmentStartf32),this.lineClips){let i=iE(this.lineClips.start,this.lineClips.end,this.scaledDistance);this.layoutVertexArray2.emplaceBack(this.scaledDistance,this.lineClipsArray.length,i)}let c=h.vertexLength++;if(this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,c),h.primitiveLength++),s?this.e2=c:this.e1=c,null!=u&&(this.zOffsetVertexArray.emplaceBack(u.zOffset,u.variableWidth,u.variableWidth),this.showElevationIdDebug&&this.elevationIdColVertexArray.emplaceBack(0,0,0)),this.elevationGroundScaleValue){let i=u?u.elevationGroundScale:this.evaluateElevationGroundScale();this.elevationGroundScaleVertexArray.emplaceBack(i)}}updateScaledDistance(){this.lineClips?(this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=this.totalFeatureLength*this.lineClips.start+this.distance):this.lineSoFar=this.distance}updateDistance(i,r){this.prevDistance=this.distance,this.distance+=i.dist(r),this.updateScaledDistance()}}function d1(i,r,a){return i.x<r||i.x>a||i.y<r||i.y>a}function d2(i,r,a){return r*(8192/(i.tileSize*Math.pow(2,a-i.tileID.overscaledZ)))}nl(d0,"LineBucket",{omit:["layers","patternFeatures","currentVertex","currentVertexIsOutside"]});let d3=(i,r,a)=>(1-a)*i+a*r;function d5(i,r){return 1/d2(i,1,r.tileZoom)}function d4(i,r,a,n){return i.translatePosMatrix(n||r.tileID.projMatrix,r,a.paint.get("line-translate"),a.paint.get("line-translate-anchor"))}let d6=i=>{let r=[];d8(i)&&r.push("RENDER_LINE_DASH"),i.paint.get("line-gradient")&&r.push("RENDER_LINE_GRADIENT"),"multiply"===i.paint.get("line-blend-mode")&&r.push("LINE_BLEND_MULTIPLY"),"additive"===i.paint.get("line-blend-mode")&&r.push("LINE_BLEND_ADDITIVE");let a=i.paint.get("line-trim-offset");0===a[0]&&0===a[1]||r.push("RENDER_LINE_TRIM_OFFSET"),0!==i.paint.get("line-border-width").constantOr(1)&&r.push("RENDER_LINE_BORDER");let n="none"===i.layout.get("line-join").constantOr("miter"),o=!!i.paint.get("line-pattern").constantOr(1);return n&&o&&r.push("LINE_JOIN_NONE"),r};function d8(i){let r=i.paint.get("line-dasharray").value;return"constant"!==r.kind||r.value}let d9=()=>D||(D={layout:C||(C=new oi({"line-cap":new oe(or.layout_line["line-cap"]),"line-join":new oe(or.layout_line["line-join"]),"line-miter-limit":new n7(or.layout_line["line-miter-limit"]),"line-round-limit":new n7(or.layout_line["line-round-limit"]),"line-sort-key":new oe(or.layout_line["line-sort-key"]),"line-z-offset":new oe(or.layout_line["line-z-offset"]),"line-elevation-reference":new n7(or.layout_line["line-elevation-reference"]),"line-cross-slope":new n7(or.layout_line["line-cross-slope"]),visibility:new n7(or.layout_line.visibility),"line-width-unit":new n7(or.layout_line["line-width-unit"]),"line-elevation-ground-scale":new oe(or.layout_line["line-elevation-ground-scale"])})),paint:P||(P=new oi({"line-opacity":new oe(or.paint_line["line-opacity"]),"line-color":new oe(or.paint_line["line-color"]),"line-translate":new n7(or.paint_line["line-translate"]),"line-translate-anchor":new n7(or.paint_line["line-translate-anchor"]),"line-width":new oe(or.paint_line["line-width"]),"line-gap-width":new oe(or.paint_line["line-gap-width"]),"line-offset":new oe(or.paint_line["line-offset"]),"line-blur"
7:new oe(or.paint_line["line-blur"]),"line-dasharray":new oe(or.paint_line["line-dasharray"]),"line-pattern":new oe(or.paint_line["line-pattern"]),"line-pattern-cross-fade":new n7(or.paint_line["line-pattern-cross-fade"]),"line-gradient":new ot(or.paint_line["line-gradient"]),"line-trim-offset":new n7(or.paint_line["line-trim-offset"]),"line-trim-fade-range":new n7(or.paint_line["line-trim-fade-range"]),"line-trim-color":new n7(or.paint_line["line-trim-color"]),"line-emissive-strength":new oe(or.paint_line["line-emissive-strength"]),"line-border-width":new oe(or.paint_line["line-border-width"]),"line-border-color":new oe(or.paint_line["line-border-color"]),"line-occlusion-opacity":new n7(or.paint_line["line-occlusion-opacity"]),"line-blend-mode":new n7(or.paint_line["line-blend-mode"]),"line-blend-additive-clamp":new n7(or.paint_line["line-blend-additive-clamp"]),"line-color-use-theme":new oe({type:"string",default:"default","property-type":"data-driven"}),"line-gradient-use-theme":new oe({type:"string",default:"default","property-type":"data-driven"}),"line-trim-color-use-theme":new oe({type:"string",default:"default","property-type":"data-driven"}),"line-border-color-use-theme":new oe({type:"string",default:"default","property-type":"data-driven"})}))});class d7 extends oe{possiblyEvaluate(i,r){return r=new n0(Math.floor(r.zoom),{now:r.now,fadeDuration:r.fadeDuration,transition:r.transition,worldview:r.worldview}),super.possiblyEvaluate(i,r)}evaluate(i,r,a,n){return r=Object.assign({},r,{zoom:Math.floor(r.zoom)}),super.evaluate(i,r,a,n)}}let pe=oA([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_tex_size",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),pt=oA([{name:"a_globe_anchor",components:3,type:"Int16"},{name:"a_globe_normal",components:3,type:"Float32"}],4),pi=oA([{name:"a_projected_pos",components:4,type:"Float32"}],4);oA([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);let pr=oA([{name:"a_auto_z_offset",components:1,type:"Float32"}],4),pa=oA([{name:"a_feature_index",components:1,type:"Float32"}],4),pn=oA([{name:"a_x_axis",components:3,type:"Float32"},{name:"a_y_axis",components:3,type:"Float32"}]),po=oA([{name:"a_texb",components:2,type:"Uint16"}]),ps=oA([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_elevation_from_sea",components:2,type:"Float32"}]),pl=oA([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"},{name:"a_auto_z_offset",components:1,type:"Float32"}]);oA([{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"}]);let ph=oA([{name:"a_pos",components:3,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),pu=oA([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);oA([{name:"triangle",components:3,type:"Uint16"}]),oA([{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"}]),oA([{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]),oA([{type:"Float32",name:"offsetX"}]),oA([{type:"Int16",name:"x"},{type:"Int16",name:"y"}]);let pc=class i{constructor(r=null,a=0,n=4096){if(this.batchIndex=a,this.headerBuffer=null,this.propertiesBuffer=null,this.blockIndicesBuffer=null,this.context=r||null,this.propsDwords=n,this.totalBytes=4*this.propsDwords,this.headerData=new Uint32Array(i.HEADER_DWORDS),this.propertiesData=new Float32Array(this.propsDwords),!i._blockIndicesTemplate){i._blockIndicesTemplate=new Uint32Array(this.propsDwords);for(let r=0;r<this.propsDwords;r++)i._blockIndicesTemplate[r]=r}this.blockIndicesData=new Uint32Array(i._blockIndicesTemplate),r&&this._initBuffers(r)}_initBuffers(r){let a=r.gl;if(this.totalBytes>r.maxUniformBlockSize)throw Error(`UBO size ${this.totalBytes} exceeds device limit ${r.maxUniformBlockSize}`);if(this.headerBuffer=a.createBuffer(),!this.headerBuffer)throw Error("Failed to create header UBO buffer");if(a.bindBuffer(a.UNIFORM_BUFFER,this.headerBuffer),a.bufferData(a.UNIFORM_BUFFER,i.HEADER_BYTES,a.DYNAMIC_DRAW),this.propertiesBuffer=a.createBuffer(),!this.propertiesBuffer)throw Error("Failed to create properties UBO buffer");if(a.bindBuffer(a.UNIFORM_BUFFER,this.propertiesBuffer),a.bufferData(a.UNIFORM_BUFFER,this.totalBytes,a.DYNAMIC_DRAW),this.blockIndicesBuffer=a.createBuffer(),!this.blockIndicesBuffer)throw Error("Failed to create block-indices UBO buffer");a.bindBuffer(a.UNIFORM_BUFFER,this.blockIndicesBuffer),a.bufferData(a.UNIFORM_BUFFER,this.totalBytes,a.DYNAMIC_DRAW),a.bindBuffer(a.UNIFORM_BUFFER,null)}writeHeader(i){let r=this.headerData;r[0]=i.dataDrivenMask,r[1]=i.zoomDependentMask,r[2]=i.dataDrivenBlockSizeVec4,r[3]=i.offsets[0],r[4]=i.offsets[1],r[5]=i.offsets[2],r[6]=i.offsets[3],r[7]=i.offsets[4],r[8]=i.offsets[5],r[9]=i.offsets[6],r[10]=i.offsets[7],r[11]=i.offsets[8]}writeDataDrivenBlock(r,a,n){let o=4*n.dataDrivenBlockSizeVec4;if(0===o)return;let s=a*o;if(s+o>this.propertiesData.length)throw Error(`UBO write out of bounds: feature index ${a} exceeds propertiesData capacity`);for(let a=0;a<9;a++)n.dataDrivenMask&1<<a&&this._copyFromFlat(s+n.offsets[a],a,r,i.EVAL_FLAT_OFFSETS[a],n.zoomDependentMask)}static getMaxFeatureCount(i,r=4096){let a=4*i.dataDrivenBlockSizeVec4;return 0===a?1/0:Math.floor(r/a)}_copyFromFlat(i,r,a,n,o){let s=this.propertiesData,l=8===r,h=!!(o&1<<r);r<2||l&&h?(s[i]=a[n],s[i+1]=a[n+1],s[i+2]=a[n+2],s[i+3]=a[n+3]):l||h?(s[i]=a[n],s[i+1]=a[n+1]):s[i]=a[n]}upload(i){this.context||(this.context=i);let r=i.gl;this.headerBuffer&&this.propertiesBuffer&&this.blockIndicesBuffer||this._initBuffers(i),r.bindBuffer(r.UNIFORM_BUFFER,this.headerBuffer),r.bufferSubData(r.UNIFORM_BUFFER,0,this.headerData),r.bindBuffer(r.UNIFORM_BUFFER,this.propertiesBuffer),r.bufferSubData(r.UNIFORM_BUFFER,0,this.propertiesData),r.bindBuffer(r.UNIFORM_BUFFER,this.blockIndicesBuffer),r.bufferSubData(r.UNIFORM_BUFFER,0,this.blockIndicesData),r.bindBuffer(r.UNIFORM_BUFFER,null)}bind(i,r){let a=i.gl,n=(i,n,o)=>{if(!n)return;let s=a.getUniformBlockIndex(r,i);s!==a.INVALID_INDEX&&(a.uniformBlockBinding(r,s,o),a.bindBufferBase(a.UNIFORM_BUFFER,o,n))},o=3*this.batchIndex;n("SymbolPaintPropertiesHeaderUniform",this.headerBuffer,o),n("SymbolPaintPropertiesUniform",this.propertiesBuffer,o+1),n("SymbolPaintPropertiesIndexUniform",this.blockIndicesBuffer,o+2)}destroy(){if(this.context){let i=this.context.gl;this.headerBuffer&&(i.deleteBuffer(this.headerBuffer),this.headerBuffer=null),this.propertiesBuffer&&(i.deleteBuffer(this.propertiesBuffer),this.propertiesBuffer=null),this.blockIndicesBuffer&&(i.deleteBuffer(this.blockIndicesBuffer),this.blockIndicesBuffer=null)}}};function pd(i,r,a,n,o,s,l,h){return!!i&&("constant"===i.kind?"none"===i.value:"composite"===i.kind||"source"===i.kind?"none"===i.evaluate({zoom:0,brightness:s,worldview:h},r,a,o,n,l):"string"==typeof i&&"none"===i)}pc.HEADER_DWORDS=12,pc.HEADER_BYTES=48,pc.EVAL_FLAT_OFFSETS=[0,4,8,10,12,14,16,18,20],pc.EVAL_FLAT_SIZES=[4,4,2,2,2,2,2,2,4],pc.EVAL_FLAT_TOTAL=24,pc._blockIndicesTemplate=null,nl(pc,"SymbolPropertiesUBO",{omit:["headerBuffer","propertiesBuffer","blockIndicesBuffer"]});class pp{constructor(i,r,a,n,o="",s,l){this.layer=i,this.zoom=r,this.lut=a,this.isText=n,this.propDefs=this._getPropDefs(),this.worldview=o,this.maxUniformBufferBindings=s||24,this.uboSizeDwords=l||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(i,n),this.cachedParams=null,this.cachedParamsNext=null,this.cachedBrightness=void 0,this.cachedConstantUniforms=null,this.cachedConstantRenderZoom=null,this.cachedConstantBrightness=void 0,this.activeAppearanceByVtIndex=new Map,this.isLightConstant=!0,this._evalFlat=new Float32Array(pc.EVAL_FLAT_TOTAL)}_getPropDefs(){let i=this.isText?"text":"icon";return[{name:`${i}-color`,useThemeName:`${i}-color-use-theme`,isColor:!0},{name:`${i}-halo-color`,useThemeName:`${i}-halo-color-use-theme`,isColor:!0},{name:`${i}-opacity`,useThemeName:null,isColor:!1},{name:`${i}-halo-width`,useThemeName:null,isColor:!1},{name:`${i}-halo-blur`,useThemeName:null,isColor:!1},{name:`${i}-emissive-strength`,useThemeName:null,isColor:!1},{name:`${i}-occlusion-opacity`,useThemeName:null,isColor:!1},{name:"symbol-z-offset",useThemeName:null,isColor:!1},{name:`${i}-translate`,useThemeName:null,isColor:!1,isVec2:!0}]}buildHeader(){let i=this.layer.paint,r=this.propDefs,a=0,n=0,o=0,s=0,l=!0,h=[0,0,0,0,0,0,0,0,0];for(let u=0;u<9;u++){let{name:c,isColor:d,isVec2:p}=r[u],f=i.get(c),m=!(!f||"function"!=typeof f.isConstant||f.isConstant()),_=this._appearancesHavePaintProperties(c),g=m||_,y=!(!f||!f.value||"composite"!==f.value.kind),x=this.layer._transitionablePaint._values[c],v=!g&&"camera"===(x&&x.value&&x.value.expression&&x.value.expression.kind);
7if(g){a|=1<<u,y&&(n|=1<<u);let i=f&&f.value;i&&!1===i.isLightConstant&&(l=!1),d?(s%4!=0&&(s=s+3&-4),h[u]=s,s+=4):p?y?(s%4!=0&&(s=s+3&-4),h[u]=s,s+=4):(s%4==3&&s++,h[u]=s,s+=2):(h[u]=s,s+=y?2:1)}else v&&(o|=1<<u)}let u=(0===s?0:s+3&-4)/4;return this.isLightConstant=l,{dataDrivenMask:a,zoomDependentMask:n,cameraMask:o,dataDrivenBlockSizeVec4:u,offsets:h}}get hasCameraExpression(){return!(!this.cachedHeader||!this.cachedHeader.cameraMask)}evaluateAllProperties(i,r,a,n,o,s,l){let{params:h,paramsNext:u}=this._getCachedParams(o),c={feature:i,featureState:r,canonical:a,availableImages:n,params:h,paramsNext:u,formattedSection:s},d=this.cachedHeader,p=this.propDefs;this._evalFlat||(this._evalFlat=new Float32Array(pc.EVAL_FLAT_TOTAL));let f=this._evalFlat;for(let i=0;i<9;i++){let{name:r,useThemeName:a,isColor:n,isVec2:s}=p[i],h=!!(d&&d.zoomDependentMask&1<<i),u=pc.EVAL_FLAT_OFFSETS[i];n?this._evaluateColorValue(r,a,c,o,h,l,f,u):s?this._evaluateTranslateValue(r,h,c,l,f,u):this._evaluateFloatValue(r,h,c,l,f,u)}return f}_evaluateColorValue(i,r,a,n,o,s,l,h){let u,c,d=this.layer.paint,p=s&&s.hasPaintProperty(i)?s.paintProperties.get(i):d.get(i),f=r&&s&&s.hasPaintProperty(r)?s.paintProperties.get(r):r?d.get(r):void 0;if(!p)return l[h]=0,l[h+1]=0,l[h+2]=0,void(l[h+3]=1);let m=pd(f&&"string"!=typeof f?f.value:void 0,a.feature,a.featureState,a.availableImages,a.canonical,n,a.formattedSection,this.worldview)?null:this.lut;p.isConstant()?u=c=p.constantOr(iI.transparent):(u=p.property.evaluate(p.value,a.params,a.feature,a.featureState,a.canonical,a.availableImages,p.iconImageUseTheme,a.formattedSection),c=o?p.property.evaluate(p.value,a.paramsNext,a.feature,a.featureState,a.canonical,a.availableImages,p.iconImageUseTheme,a.formattedSection):u);let _=(u||iI.transparent).toNonPremultipliedRenderColor(m);if(l[h]=sx(255*_.r,255*_.g),l[h+1]=sx(255*_.b,255*_.a),o){let i=(c||iI.transparent).toNonPremultipliedRenderColor(m);l[h+2]=sx(255*i.r,255*i.g),l[h+3]=sx(255*i.b,255*i.a)}else l[h+2]=0,l[h+3]=0}_evaluateFloatValue(i,r,a,n,o,s){let l=this.layer.paint,h=+!!i.endsWith("opacity"),u=n&&n.hasPaintProperty(i)?n.paintProperties.get(i):l.get(i);if(!u)return o[s]=h,void(o[s+1]=0);if(u.isConstant())return o[s]=u.constantOr(h),void(o[s+1]=0);let c=u.property.evaluate(u.value,a.params,a.feature,a.featureState,a.canonical,a.availableImages,u.iconImageUseTheme,a.formattedSection);if(o[s]=null!=c?c:h,r){let i=u.property.evaluate(u.value,a.paramsNext,a.feature,a.featureState,a.canonical,a.availableImages,u.iconImageUseTheme,a.formattedSection);o[s+1]=null!=i?i:h}else o[s+1]=0}_evaluateTranslateValue(i,r,a,n,o,s){let l=this.layer.paint,h=n&&n.hasPaintProperty(i)?n.paintProperties.get(i):l.get(i);if(!h)return o[s]=0,o[s+1]=0,o[s+2]=0,void(o[s+3]=0);if("function"!=typeof h.isConstant){let i=h||[0,0];return o[s]=i[0],o[s+1]=i[1],o[s+2]=0,void(o[s+3]=0)}if(h.isConstant()){let i=h.constantOr([0,0]);return o[s]=i[0],o[s+1]=i[1],o[s+2]=0,void(o[s+3]=0)}let u=h.property.evaluate(h.value,a.params,a.feature,a.featureState,a.canonical,a.availableImages,h.iconImageUseTheme,a.formattedSection)||[0,0];if(o[s]=u[0],o[s+1]=u[1],r){let i=h.property.evaluate(h.value,a.paramsNext,a.feature,a.featureState,a.canonical,a.availableImages,h.iconImageUseTheme,a.formattedSection)||[0,0];o[s+2]=i[0],o[s+3]=i[1]}else o[s+2]=0,o[s+3]=0}_getCachedParams(i){return this.cachedParams&&this.cachedParamsNext&&this.cachedBrightness===i||(this.cachedParams=new n0(this.zoom,{brightness:i,worldview:this.worldview}),this.cachedParamsNext=new n0(this.zoom+1,{brightness:i,worldview:this.worldview}),this.cachedBrightness=i),{params:this.cachedParams,paramsNext:this.cachedParamsNext}}_appearancesHavePaintProperties(i){return this.layer.getAppearances().some(void 0!==i?r=>r.hasPaintProperty(i):this.isText?i=>i.hasTextPaintProperties():i=>i.hasIconPaintProperties())}_checkIfAllPropertiesAreConstant(i,r){let a=i.paint,n=r?"text":"icon";for(let i of[`${n}-color`,`${n}-halo-color`,`${n}-opacity`,`${n}-halo-width`,`${n}-halo-blur`,`${n}-emissive-strength`,`${n}-occlusion-opacity`,"symbol-z-offset",`${n}-translate`]){let r=a.get(i);if(r&&"object"==typeof r&&"isConstant"in r&&!r.isConstant())return!1}return!this._appearancesHavePaintProperties()}_hashDataDrivenValues(i,r){if(0===r.dataDrivenMask)return"";let a=[];for(let n=0;n<this.propDefs.length;n++){if(!(r.dataDrivenMask&1<<n))continue;let o=pc.EVAL_FLAT_OFFSETS[n],s=pc.EVAL_FLAT_SIZES[n],l=String(i[o]);for(let r=1;r<s;r++)l+=`,${String(i[o+r])}`;a.push(l)}return a.join("|")}getCurrentBatchIndex(){return this.cachedHeader&&0!==this.maxFeaturesPerBatch?Math.floor(this.featureCount/this.maxFeaturesPerBatch):0}populateUBO(i,r,a,n,o,s,l){let h=i.id;if(!this.cachedHeader){this.cachedHeader=this.buildHeader();let i=pc.getMaxFeatureCount(this.cachedHeader,this.uboSizeDwords);this.maxFeaturesPerBatch=isFinite(i)?i:Number.MAX_SAFE_INTEGER}let u=this.cachedHeader,c=this.evaluateAllProperties(i,{},a,n,o,s);if(this.canDeduplicate){let i=this._hashDataDrivenValues(c,u),a=this.propertyHashToUBOIndex.get(i);if(void 0!==a){let i=isFinite(this.maxFeaturesPerBatch)?Math.floor(a/this.maxFeaturesPerBatch):0,n=isFinite(this.maxFeaturesPerBatch)?a%this.maxFeaturesPerBatch:a,o={batchIndex:i,localFeatureIndex:n,vtFeatureIndex:r,featureId:h};return this.allFeatures.push(o),null!=h&&(this.featureVertexRangesFromId.has(h)||this.featureVertexRangesFromId.set(h,[]),this.featureVertexRangesFromId.get(h).push(o)),n}this.propertyHashToUBOIndex.set(i,this.featureCount)}
7let d=this.featureCount++,p=isFinite(this.maxFeaturesPerBatch)?Math.floor(d/this.maxFeaturesPerBatch):0,f=isFinite(this.maxFeaturesPerBatch)?d%this.maxFeaturesPerBatch:d,m=l?l.maxUniformBufferBindings:this.maxUniformBufferBindings;if(3*p+2>=m){tw(`Too many symbol features: batch ${p} requires binding points up to ${3*p+2}, device limit ${m}. Some features will render incorrectly.`);let i={batchIndex:0,localFeatureIndex:0,vtFeatureIndex:r,featureId:h};return this.allFeatures.push(i),null!=h&&(this.featureVertexRangesFromId.has(h)||this.featureVertexRangesFromId.set(h,[]),this.featureVertexRangesFromId.get(h).push(i)),0}this.ubos[p]||(this.ubos[p]=new pc(l,p,this.uboSizeDwords),this.ubos[p].writeHeader(u)),this.ubos[p].writeDataDrivenBlock(c,f,u);let _={batchIndex:p,localFeatureIndex:f,vtFeatureIndex:r,featureId:h};return this.allFeatures.push(_),null!=h&&(this.featureVertexRangesFromId.has(h)||this.featureVertexRangesFromId.set(h,[]),this.featureVertexRangesFromId.get(h).push(_)),f}updateFeatures(i,r,a,n,o,s,l){if(this.layer=r,this.cachedConstantUniforms=null,!this.cachedHeader)return;let h=this.cachedHeader;for(let r of i){let i=this.featureVertexRangesFromId.get(r);if(!i)continue;let u=s[r]||{};for(let s of i){if(!a)continue;let i=a.feature(s.vtFeatureIndex);if(!i)continue;let c={type:i.type,id:r,properties:i.properties||{},geometry:[]},d=this.activeAppearanceByVtIndex?this.activeAppearanceByVtIndex.get(s.vtFeatureIndex):void 0,p=this.evaluateAllProperties(c,u,n,o,l,void 0,d);this.ubos[s.batchIndex]&&this.ubos[s.batchIndex].writeDataDrivenBlock(p,s.localFeatureIndex,h)}}}updateDynamicExpressions(i,r,a,n,o,s){if(this.layer=i,this.cachedConstantUniforms=null,!this.cachedHeader||0===this.cachedHeader.dataDrivenMask)return;let l=this.cachedHeader;for(let i of this.allFeatures){if(!r)continue;let h=r.feature(i.vtFeatureIndex);if(!h)continue;let u=null!=i.featureId&&o[i.featureId]||{},c={type:h.type,id:i.featureId,properties:h.properties||{},geometry:[]},d=this.activeAppearanceByVtIndex?this.activeAppearanceByVtIndex.get(i.vtFeatureIndex):void 0,p=this.evaluateAllProperties(c,u,a,n,s,void 0,d);this.ubos[i.batchIndex]&&this.ubos[i.batchIndex].writeDataDrivenBlock(p,i.localFeatureIndex,l)}}updateFeaturePaintForAppearance(i,r,a,n,o,s,l){if(!this.layer||(this.activeAppearanceByVtIndex||(this.activeAppearanceByVtIndex=new Map),this.activeAppearanceByVtIndex.set(i,l||null),!this.cachedHeader))return!1;let h=this.cachedHeader;if(0===h.dataDrivenMask)return!1;let u=!1;for(let c of this.allFeatures){if(c.vtFeatureIndex!==i)continue;let d=this.evaluateAllProperties(r,a,n,o,s,void 0,l);this.ubos[c.batchIndex]&&(this.ubos[c.batchIndex].writeDataDrivenBlock(d,c.localFeatureIndex,h),u=!0)}return u}getConstantUniformValues(i,r){let a=this.cachedHeader,n=!(!a||!a.cameraMask);if(this.cachedConstantUniforms&&this.cachedConstantBrightness===r&&(!n||this.cachedConstantRenderZoom===i))return this.cachedConstantUniforms;let o=this.layer.paint,s=this.propDefs,l=n?new n0(i,{brightness:r,worldview:this.worldview}):null,h={type:1,id:void 0,properties:{},geometry:[]},u=i=>{let n=s[i],u=o.get(n.name);if(!u)return[0,0,0,1];let c=n.useThemeName?o.get(n.useThemeName):void 0,d=pd(c&&"string"!=typeof c?c.value:void 0,h,{},[],void 0,r,void 0,this.worldview)?null:this.lut,p=((a&&a.cameraMask&1<<i&&l?u.property.evaluate(u.value,l,h,{},void 0,[]):u.constantOr(iI.transparent))||iI.transparent).toNonPremultipliedRenderColor(d);return[p.r,p.g,p.b,p.a]},c=(i,r)=>{let n=o.get(s[i].name);if(!n)return r;if(a&&a.cameraMask&1<<i&&l){let i=n.property.evaluate(n.value,l,h,{},void 0,[]);return null!=i?i:r}return n.constantOr(r)},d={fill_np_color:u(0),halo_np_color:u(1),opacity:c(2,1),halo_width:c(3,0),halo_blur:c(4,0),emissive_strength:c(5,0),occlusion_opacity:c(6,1),z_offset:c(7,0)};return this.cachedConstantUniforms=d,this.cachedConstantRenderZoom=i,this.cachedConstantBrightness=r,d}upload(i){for(let r of this.ubos)r.upload(i)}bind(i,r,a=0){this.ubos[a]&&this.ubos[a].bind(i,r)}destroy(){for(let i of this.ubos)i.destroy();this.ubos=[],this.featureVertexRangesFromId.clear(),this.allFeatures=[],this.featureCount=0,this.cachedHeader=null,this.maxFeaturesPerBatch=0,this.propertyHashToUBOIndex&&this.propertyHashToUBOIndex.clear()}}nl(pp,"SymbolPropertyBinderUBO",{omit:["layer","cachedParams","cachedParamsNext","cachedBrightness","propertyHashToUBOIndex","cachedConstantUniforms","cachedConstantRenderZoom","cachedConstantBrightness","activeAppearanceByVtIndex","_evalFlat"]});let pf={"!":"ï¸","#":"ï¼",$:"ï¼","%":"ï¼
","&":"ï¼","(":"︵",")":"︶","*":"ï¼","+":"ï¼",",":"ï¸","-":"︲",".":"ã»","/":"ï¼",":":"ï¸",";":"ï¸","<":"︿","=":"ï¼",">":"ï¹","?":"ï¸","@":"ï¼ ","[":"ï¹","\\":"ï¼¼","]":"ï¹","^":"ï¼¾",_:"︳","`":"ï½","{":"︷","|":"â","}":"︸","~":"ï½","\xa2":"ï¿ ","\xa3":"ï¿¡","\xa5":"ï¿¥","\xa6":"¦","\xac":"ï¿¢","\xaf":"ï¿£","â":"︲","â":"︱","â":"ï¹","â":"ï¹","â":"ï¹","â":"ï¹","â¦":"ï¸","â§":"ã»","â©":"₩","ã":"ï¸","ã":"ï¸","ã":"︿","ã":"ï¹","ã":"︽","ã":"︾","ã":"ï¹","ã":"ï¹","ã":"ï¹","ã":"ï¹","ã":"︻","ã":"︼","ã":"︹","ã":"︺","ã":"ï¸","ã":"ï¸","ï¼":"ï¸","ï¼":"︵","ï¼":"︶","ï¼":"ï¸","ï¼":"︲","ï¼":"ã»","ï¼":"ï¸","ï¼":"ï¸","ï¼":"︿","ï¼":"ï¹","ï¼":"ï¸","ï¼»":"ï¹","ï¼½":"ï¹","_":"︳","ï½":"︷","ï½":"â","ï½":"︸","ï½":"︵","ï½ ":"︶","。":"ï¸","ï½¢":"ï¹","ï½£":"ï¹","â":"â","â":"â"},pm="undefined"==typeof TextDecoder?null:new TextDecoder("utf-8"),p_=class{constructor(i=new Uint8Array(16)){this.buf=ArrayBuffer.isView(i)?i:new Uint8Array(i),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(i,r,a=this.length){for(;this.pos<a;){let a=this.readVarint(),n=a>>3,o=this.pos;this.type=7&a,i(n,r,this),this.pos===o&&this.skip(a)}return r}readMessage(i,r){return this.readFields(i,r,this.readVarint()+this.pos)}readFixed32(){let i=this.dataView.getUint32(this.pos,!0);return this.pos+=4,i}readSFixed32(){let i=this.dataView.getInt32(this.pos,!0);return this.pos+=4,i}readFixed64(){let i=this.dataView.getUint32(this.pos,!0)+0x100000000*this.dataView.getUint32(this.pos+4,!0);return this.pos+=8,i}readSFixed64(){let i=this.dataView.getUint32(this.pos,!0)+0x100000000*this.dataView.getInt32(this.pos+4,!0);return this.pos+=8,i}readFloat(){let i=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,i}readDouble(){let i=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,i}readVarint(i){let r,a,n=this.buf;return r=127&(a=n[this.pos++]),a<128?r:(r|=(127&(a=n[this.pos++]))<<7,a<128?r:(r|=(127&(a=n[this.pos++]))<<14,a<128?r:(r|=(127&(a=n[this.pos++]))<<21,a<128?r:function(i,r,a){let n,o,s=a.buf;if(n=(112&(o=s[a.pos++]))>>4,o<128||(n|=(127&(o=s[a.pos++]))<<3,o<128)||(n|=(127&(o=s[a.pos++]))<<10,o<128)||(n|=(127&(o=s[a.pos++]))<<17,o<128)||(n|=(127&(o=s[a.pos++]))<<24,o<128)||(n|=(1&(o=s[a.pos++]))<<31,o<128))return function(i,r,a){return a?0x100000000*r+(i>>>0):0x100000000*(r>>>0)+(i>>>0)}(i,n,r);throw Error("Expected varint not more than 10 bytes")}(r|=(15&(a=n[this.pos]))<<28,i,this))))}readVarint64(){return this.readVarint(!0)}readSVarint(){let i=this.readVarint();return i%2==1?-((i+1)/2):i/2}readBoolean(){return!!this.readVarint()}readString(){let i=this.readVarint()+this.pos,r=this.pos;return this.pos=i,i-r>=12&&pm?pm.decode(this.buf.subarray(r,i)):function(i,r,a){let n="",o=r;for(;o<a;){let r=i[o],s,l,h,u=null,c=r>239?4:r>223?3:r>191?2:1;if(o+c>a)break;1===c?r<128&&(u=r):2===c?128==(192&(s=i[o+1]))&&(u=(31&r)<<6|63&s)<=127&&(u=null):3===c?(s=i[o+1],l=i[o+2],128==(192&s)&&128==(192&l)&&((u=(15&r)<<12|(63&s)<<6|63&l)<=2047||u>=55296&&u<=57343)&&(u=null)):4===c&&(s=i[o+1],l=i[o+2],h=i[o+3],128==(192&s)&&128==(192&l)&&128==(192&h)&&((u=(15&r)<<18|(63&s)<<12|(63&l)<<6|63&h)<=65535||u>=1114112)&&(u=null)),null===u?(u=65533,c=1):u>65535&&(u-=65536,n+=String.fromCharCode(u>>>10&1023|55296),u=56320|1023&u),n+=String.fromCharCode(u),o+=c}return n}(this.buf,r,i)}readBytes(){let i=this.readVarint()+this.pos,r=this.buf.subarray(this.pos,i);return this.pos=i,r}readPackedVarint(i=[],r){let a=this.readPackedEnd();for(;this.pos<a;)i.push(this.readVarint(r));return i}readPackedSVarint(i=[]){let r=this.readPackedEnd();for(;this.pos<r;)i.push(this.readSVarint());return i}readPackedBoolean(i=[]){let r=this.readPackedEnd();for(;this.pos<r;)i.push(this.readBoolean());return i}readPackedFloat(i=[]){let r=this.readPackedEnd();for(;this.pos<r;)i.push(this.readFloat());return i}readPackedDouble(i=[]){let r=this.readPackedEnd();for(;this.pos<r;)i.push(this.readDouble());return i}readPackedFixed32(i=[]){let r=this.readPackedEnd();for(;this.pos<r;)i.push(this.readFixed32());return i}readPackedSFixed32(i=[]){let r=this.readPackedEnd();for(;this.pos<r;)i.push(this.readSFixed32());return i}readPackedFixed64(i=[]){let r=this.readPackedEnd();for(;this.pos<r;)i.push(this.readFixed64());return i}readPackedSFixed64(i=[]){let r=this.readPackedEnd();for(;this.pos<r;)i.push(this.readSFixed64());return i}readPackedEnd(){return 2===this.type?this.readVarint()+this.pos:this.pos+1}skip(i){let r=7&i;if(0===r)for(;this.buf[this.pos++]>127;);else if(2===r)this.pos=this.readVarint()+this.pos;else if(5===r)this.pos+=4;else{if(1!==r)throw Error(`Unimplemented type: ${r}`);this.pos+=8}}writeTag(i,r){this.writeVarint(i<<3|r)}realloc(i){let r=this.length||16;for(;r<this.pos+i;)r*=2;if(r!==this.length){let i=new Uint8Array(r);i.set(this.buf),this.buf=i,this.dataView=new DataView(i.buffer),this.length=r}}finish(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)}writeFixed32(i){this.realloc(4),this.dataView.setInt32(this.pos,i,!0),this.pos+=4}writeSFixed32(i){this.realloc(4),this.dataView.setInt32(this.pos,i,!0),this.pos+=4}
7writeFixed64(i){this.realloc(8),this.dataView.setInt32(this.pos,-1&i,!0),this.dataView.setInt32(this.pos+4,Math.floor(23283064365386963e-26*i),!0),this.pos+=8}writeSFixed64(i){this.realloc(8),this.dataView.setInt32(this.pos,-1&i,!0),this.dataView.setInt32(this.pos+4,Math.floor(23283064365386963e-26*i),!0),this.pos+=8}writeVarint(i){(i=+i||0)>0xfffffff||i<0?function(i,r){var a;let n,o;if(i>=0?(n=i%0x100000000|0,o=i/0x100000000|0):(n=~(-i%0x100000000),o=~(-i/0x100000000),0xffffffff^n?n=n+1|0:(n=0,o=o+1|0)),i>=0xffffffffffffffff||i<-0xffffffffffffffff)throw Error("Given varint doesn't fit into 10 bytes");r.realloc(10),a=n,r.buf[r.pos++]=127&a|128,a>>>=7,r.buf[r.pos++]=127&a|128,a>>>=7,r.buf[r.pos++]=127&a|128,a>>>=7,r.buf[r.pos++]=127&a|128,r.buf[r.pos]=127&(a>>>=7),function(i,r){let a=(7&i)<<4;r.buf[r.pos++]|=a|128*!!(i>>>=3),i&&(r.buf[r.pos++]=127&i|128*!!(i>>>=7),i&&(r.buf[r.pos++]=127&i|128*!!(i>>>=7),i&&(r.buf[r.pos++]=127&i|128*!!(i>>>=7),i&&(r.buf[r.pos++]=127&i|128*!!(i>>>=7),i&&(r.buf[r.pos++]=127&i)))))}(o,r)}(i,this):(this.realloc(4),this.buf[this.pos++]=127&i|128*(i>127),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|128*(i>127),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|128*(i>127),i<=127||(this.buf[this.pos++]=i>>>7&127))))}writeSVarint(i){this.writeVarint(i<0?-(2*i)-1:2*i)}writeBoolean(i){this.writeVarint(+i)}writeString(i){i=String(i),this.realloc(4*i.length),this.pos++;let r=this.pos;this.pos=function(i,r,a){for(let n,o,s=0;s<r.length;s++){if((n=r.charCodeAt(s))>55295&&n<57344){if(!o){n>56319||s+1===r.length?(i[a++]=239,i[a++]=191,i[a++]=189):o=n;continue}if(n<56320){i[a++]=239,i[a++]=191,i[a++]=189,o=n;continue}n=o-55296<<10|n-56320|65536,o=null}else o&&(i[a++]=239,i[a++]=191,i[a++]=189,o=null);n<128?i[a++]=n:(n<2048?i[a++]=n>>6|192:(n<65536?i[a++]=n>>12|224:(i[a++]=n>>18|240,i[a++]=n>>12&63|128),i[a++]=n>>6&63|128),i[a++]=63&n|128)}return a}(this.buf,i,this.pos);let a=this.pos-r;a>=128&&pg(r,a,this),this.pos=r-1,this.writeVarint(a),this.pos+=a}writeFloat(i){this.realloc(4),this.dataView.setFloat32(this.pos,i,!0),this.pos+=4}writeDouble(i){this.realloc(8),this.dataView.setFloat64(this.pos,i,!0),this.pos+=8}writeBytes(i){let r=i.length;this.writeVarint(r),this.realloc(r);for(let a=0;a<r;a++)this.buf[this.pos++]=i[a]}writeRawMessage(i,r){this.pos++;let a=this.pos;i(r,this);let n=this.pos-a;n>=128&&pg(a,n,this),this.pos=a-1,this.writeVarint(n),this.pos+=n}writeMessage(i,r,a){this.writeTag(i,2),this.writeRawMessage(r,a)}writePackedVarint(i,r){r.length&&this.writeMessage(i,py,r)}writePackedSVarint(i,r){r.length&&this.writeMessage(i,px,r)}writePackedBoolean(i,r){r.length&&this.writeMessage(i,pw,r)}writePackedFloat(i,r){r.length&&this.writeMessage(i,pv,r)}writePackedDouble(i,r){r.length&&this.writeMessage(i,pb,r)}writePackedFixed32(i,r){r.length&&this.writeMessage(i,pT,r)}writePackedSFixed32(i,r){r.length&&this.writeMessage(i,pS,r)}writePackedFixed64(i,r){r.length&&this.writeMessage(i,pE,r)}writePackedSFixed64(i,r){r.length&&this.writeMessage(i,pI,r)}writeBytesField(i,r){this.writeTag(i,2),this.writeBytes(r)}writeFixed32Field(i,r){this.writeTag(i,5),this.writeFixed32(r)}writeSFixed32Field(i,r){this.writeTag(i,5),this.writeSFixed32(r)}writeFixed64Field(i,r){this.writeTag(i,1),this.writeFixed64(r)}writeSFixed64Field(i,r){this.writeTag(i,1),this.writeSFixed64(r)}writeVarintField(i,r){this.writeTag(i,0),this.writeVarint(r)}writeSVarintField(i,r){this.writeTag(i,0),this.writeSVarint(r)}writeStringField(i,r){this.writeTag(i,2),this.writeString(r)}writeFloatField(i,r){this.writeTag(i,5),this.writeFloat(r)}writeDoubleField(i,r){this.writeTag(i,1),this.writeDouble(r)}writeBooleanField(i,r){this.writeVarintField(i,+r)}};function pg(i,r,a){let n=r<=16383?1:r<=2097151?2:r<=0xfffffff?3:Math.floor(Math.log(r)/(7*Math.LN2));a.realloc(n);for(let r=a.pos-1;r>=i;r--)a.buf[r+n]=a.buf[r]}function py(i,r){for(let a=0;a<i.length;a++)r.writeVarint(i[a])}function px(i,r){for(let a=0;a<i.length;a++)r.writeSVarint(i[a])}function pv(i,r){for(let a=0;a<i.length;a++)r.writeFloat(i[a])}function pb(i,r){for(let a=0;a<i.length;
7a++)r.writeDouble(i[a])}function pw(i,r){for(let a=0;a<i.length;a++)r.writeBoolean(i[a])}function pT(i,r){for(let a=0;a<i.length;a++)r.writeFixed32(i[a])}function pS(i,r){for(let a=0;a<i.length;a++)r.writeSFixed32(i[a])}function pE(i,r){for(let a=0;a<i.length;a++)r.writeFixed64(i[a])}function pI(i,r){for(let a=0;a<i.length;a++)r.writeSFixed64(i[a])}function pA(i,r,a){r.glyphs=[],1===i&&a.readMessage(pM,r)}function pM(i,r,a){if(3===i){let{id:i,bitmap:n,width:o,height:s,left:l,top:h,advance:u}=a.readMessage(pC,{});r.glyphs.push({id:i,bitmap:new hD({width:o+6,height:s+6},n),metrics:{width:o,height:s,left:l,top:h,advance:u}})}else 4===i?r.ascender=a.readSVarint():5===i&&(r.descender=a.readSVarint())}function pC(i,r,a){1===i?r.id=a.readVarint():2===i?r.bitmap=a.readBytes():3===i?r.width=a.readVarint():4===i?r.height=a.readVarint():5===i?r.left=a.readSVarint():6===i?r.top=a.readSVarint():7===i&&(r.advance=a.readVarint())}let pP={horizontal:1,vertical:2,horizontalOnly:3};class pD{constructor(){this.scale=1,this.fontStack="",this.image=null}static forText(i,r){let a=new pD;return a.scale=i||1,a.fontStack=r,a}static forImage(i){let r=new pD;return r.image=i,r}}class pR{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(i,r,a,n=1){let o=new pR;for(let s=0;s<i.sections.length;s++){let l=i.sections[s];l.image?o.addImageSection(l,a,n):o.addTextSection(l,r)}return o}length(){return this.text.length}getSection(i){return this.sections[this.sectionIndex[i]]}getSections(){return this.sections}getSectionIndex(i){return this.sectionIndex[i]}getCodePoint(i){return this.text.codePointAt(i)}verticalizePunctuation(i){this.text=function(i,r){let a="";for(let n=0;n<i.length;n++){let o=i.charCodeAt(n+1)||null,s=i.charCodeAt(n-1)||null;a+=!r&&(o&&nV(o)&&!pf[i[n+1]]||s&&nV(s)&&!pf[i[n-1]])||!pf[i[n]]?i[n]:pf[i[n]]}return a}(this.text,i)}trim(){let i=0;for(let r=0;r<this.text.length&&pL[this.text.charCodeAt(r)];r++)i++;let r=this.text.length;for(let a=this.text.length-1;a>=0&&a>=i&&pL[this.text.charCodeAt(a)];a--)r--;this.text=this.text.substring(i,r),this.sectionIndex=this.sectionIndex.slice(i,r)}substring(i,r){let a=new pR;return a.text=this.text.substring(i,r),a.sectionIndex=this.sectionIndex.slice(i,r),a.sections=this.sections,a}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((i,r)=>Math.max(i,this.sections[r].scale),0)}addTextSection(i,r){this.text+=i.text,this.sections.push(pD.forText(i.scale,i.fontStack||r));let a=this.sections.length-1;for(let r=0;r<i.text.length;++r)this.sectionIndex.push(a)}addImageSection(i,r,a=1){let n=i.image?i.image.getPrimary():null;if(!n)return void tw("Can't add FormattedSection with an empty image.");n.scaleSelf(r*a);let o=this.getNextImageSectionCharCode();o?(this.text+=String.fromCodePoint(o),this.sections.push(pD.forImage(n)),this.sectionIndex.push(this.sections.length-1)):tw("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function pz(i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g=1,y=1){let x=pR.fromFeature(i,o,g,y);p===pP.vertical&&x.verticalizePunctuation(f);let v=[],b=function(i,r,a,n,o,s,l=1){if(!i)return[];let h=[],u=function(i,r,a,n,o,s,l=1){let h=0;for(let a=0;a<i.length();a++){let u=i.getSection(a);h+=pO(i.getCodePoint(a),u,n,o,r,s,l)}return h/Math.max(1,Math.ceil(h/a))}(i,r,a,n,o,s,l),c=i.text.includes("â"),d=0;for(let a=0;a<i.length();a++){let p=i.getSection(a),f=i.getCodePoint(a);if(pL[f]||(d+=pO(f,p,n,o,r,s,l)),a<i.length()-1){let r=!(f<11904||!(nw(f)||nb(f)||nF(f)||nR(f)||nI(f)||nm(f)||nT(f)||ny(f)||nA(f)||nM(f)||nE(f)||nk(f)||nx(f)||ng(f)||n_(f)||nS(f)||nv(f)||nL(f)||nP(f)||nC(f)));(pF[f]||r||p.image)&&h.push(pk(a+1,d,u,h,function(i,r,a){let n=0;return 10===i&&(n-=1e4),a&&(n+=150),40!==i&&65288!==i||(n+=50),41!==r&&65289!==r||(n+=50),n}(f,i.getCodePoint(a+1),r&&c),!1))}}return function i(r){return r?i(r.priorBreak).concat(r.index):[]}(pk(i.length(),d,u,h,0,!0))}(x,c,s,r,n,m,y),{processBidirectionalText:w,processStyledBidirectionalText:T}=nK;
7if(w&&1===x.sections.length)for(let i of w(x.toString(),b)){let r=new pR;r.text=i,r.sections=x.sections;for(let a=0;a<i.length;a++)r.sectionIndex.push(0);v.push(r)}else if(T)for(let i of T(x.text,x.sectionIndex,b)){let r=new pR;r.text=i[0],r.sectionIndex=i[1],r.sections=x.sections,v.push(r)}else v=function(i,r){let a=[],n=i.text,o=0;for(let n of r)a.push(i.substring(o,n)),o=n;return o<n.length&&a.push(i.substring(o,n.length)),a}(x,b);let S=[],E={positionedLines:S,text:x.toString(),top:d[1],bottom:d[1],left:d[0],right:d[0],writingMode:p,iconsInText:!1,verticalizable:!1,hasBaseline:!1};if(function(i,r,a,n,o,s,l,h,u,c,d,p,f=1){let m=0,_=0,g=0,y="right"===h?1:.5*("left"!==h),x=!1;for(let i of o){for(let a of i.getSections()){if(a.image)continue;let i=r[a.fontStack];if(i&&!(x=void 0!==i.ascender&&void 0!==i.descender))break}if(!x)break}let v=0;for(let l of o){l.trim();let o=l.getMaxScale(),h=(o-1)*24,w={positionedGlyphs:[],lineOffset:0};i.positionedLines[v]=w;let T=w.positionedGlyphs,S=0;if(!l.length()){_+=s,++v;continue}let E=0,I=0;for(let s=0;s<l.length();s++){var b;let h=l.getSection(s),g=l.getSectionIndex(s),y=l.getCodePoint(s),v=h.scale,w=null,A=null,M=null,C=24,P=0,D=u;D===pP.vertical&&(12312===y||12313===y||12316===y||12540===y||12448===y)&&(D=pP.horizontal);let R=!(D===pP.horizontal||!d&&!nU(y)||d&&(pL[y]||nd(b=y)||np(b)||nf(b)||nz(b)||nB(b)));if(h.image){let r=n.get(h.image.toString());if(!r)continue;M=h.image,i.iconsInText=i.iconsInText||!0,A=r.paddedRect;let a=r.displaySize,s=a[0]*f,l=a[1]*f;v=24*v/p,w={width:s,height:l,left:0,top:-3,advance:R?l:s,localGlyph:!1},P=x?-w.height*v:24*o-17-l*v,C=w.advance;let u=(R?s:l)*v-24*o;u>0&&u>S&&(S=u)}else{let i=a[h.fontStack];if(!i)continue;i[y]&&(A=i[y]);let n=r[h.fontStack];if(!n)continue;let s=n.glyphs[y];if(!s)continue;if(w=s.metrics,C=24*(8203!==y),x){let i=void 0!==n.ascender?Math.abs(n.ascender):0,r=void 0!==n.descender?Math.abs(n.descender):0,a=(i+r)*v;E<a&&(E=a,I=(i-r)/2*v),P=-i*v}else P=(o-v)*24-17}R?(i.verticalizable=!0,T.push({glyph:y,image:M,x:m,y:_+P,vertical:R,scale:v,localGlyph:w.localGlyph,fontStack:h.fontStack,sectionIndex:g,metrics:w,rect:A}),m+=C*v+c):(T.push({glyph:y,image:M,x:m,y:_+P,vertical:R,scale:v,localGlyph:w.localGlyph,fontStack:h.fontStack,sectionIndex:g,metrics:w,rect:A}),m+=w.advance*v+c)}0!==T.length&&(g=Math.max(m-c,g),x?pU(T,y,S,I,s*o/2):pU(T,y,S,0,s/2)),m=0;let A=s*o+S;w.lineOffset=Math.max(S,h),_+=A,++v}let w=_,{horizontalAlign:T,verticalAlign:S}=pN(l);(function(i,r,a,n,o,s){let l=(r-a)*o,h=-s*n;for(let r of i)for(let i of r.positionedGlyphs)i.x+=l,i.y+=h}
7)(i.positionedLines,y,T,S,g,w),i.top+=-S*w,i.bottom=i.top+w,i.left+=-T*g,i.right=i.left+g,i.hasBaseline=x}(E,r,a,n,v,l,h,u,p,c,f,_,y),!function(i){for(let r of i)if(0!==r.positionedGlyphs.length)return!1;return!0}(S))return E}let pL={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},pF={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 pO(i,r,a,n,o,s,l=1){if(r.image){let i=n.get(r.image.toString());return i?i.displaySize[0]*l*r.scale*24/s+o:0}{let n=a[r.fontStack],s=n&&n.glyphs[i];return s?s.metrics.advance*r.scale+o:0}}function pB(i,r,a,n){let o=Math.pow(i-r,2);return n?i<r?o/2:2*o:o+Math.abs(a)*a}function pk(i,r,a,n,o,s){let l=null,h=pB(r,a,o,s);for(let i of n){let n=pB(r-i.x,a,o,s)+i.badness;n<=h&&(l=i,h=n)}return{index:i,x:r,priorBreak:l,badness:h}}function pN(i){let r=.5,a=.5;switch(i){case"right":case"top-right":case"bottom-right":r=1;break;case"left":case"top-left":case"bottom-left":r=0}switch(i){case"bottom":case"bottom-right":case"bottom-left":a=1;break;case"top":case"top-right":case"top-left":a=0}return{horizontalAlign:r,verticalAlign:a}}function pU(i,r,a,n,o){if(!(r||a||n||o))return;let s=i.length-1,l=i[s],h=(l.x+l.metrics.advance*l.scale)*r;for(let r=0;r<=s;r++)i[r].x-=h,i[r].y+=a+n+o}function pV(i){return void 0!==i.imagePrimary&&void 0!==i.top&&void 0!==i.bottom&&void 0!==i.left&&void 0!==i.right}function pj(i,r,a,n){let{horizontalAlign:o,verticalAlign:s}=pN(n),l=a[0]-i.displaySize[0]*o,h=a[1]-i.displaySize[1]*s;return{imagePrimary:i,imageSecondary:r,top:h,bottom:h+i.displaySize[1],left:l,right:l+i.displaySize[0]}}function pG(i,r,a,n,o,s){let l,h,u,c,d,p=i.imagePrimary;if(p.content){let i=p.content,r=p.pixelRatio||1;l=[i[0]/r,i[1]/r,p.displaySize[0]-i[2]/r,p.displaySize[1]-i[3]/r]}let f=r.left*s,m=r.right*s;"width"===a||"both"===a?(d=o[0]+f-n[3],u=o[0]+m+n[1]):u=(d=o[0]+(f+m-p.displaySize[0])/2)+p.displaySize[0];let _=r.top*s,g=r.bottom*s;return"height"===a||"both"===a?(h=o[1]+_-n[0],c=o[1]+g+n[2]):c=(h=o[1]+(_+g-p.displaySize[1])/2)+p.displaySize[1],{imagePrimary:p,imageSecondary:void 0,top:h,right:u,bottom:c,left:d,collisionPadding:l}}function pH(i){return!i.imagePrimary.stretchX}function p$(i){return!i.imagePrimary.stretchY}function pq(i){return{width:i.right-i.left,height:i.bottom-i.top}}function pZ(i,r,a,n){let{expression:o}=r;if("constant"===o.kind)return{kind:"constant",layoutSize:o.evaluate(new n0(i+1,{worldview:a}),void 0,void 0,void 0,n)};if("source"===o.kind)return{kind:"source"};{let{zoomStops:r,interpolationType:s}=o,l=0;for(;l<r.length&&r[l]<=i;)l++;let h=l=Math.max(0,l-1);for(;h<r.length&&r[h]<i+1;)h++;h=Math.min(r.length-1,h);let u=r[l],c=r[h];return"composite"===o.kind?{kind:"composite",minZoom:u,maxZoom:c,interpolationType:s}:{kind:"camera",minZoom:u,maxZoom:c,minSize:o.evaluate(new n0(u,{worldview:a}),void 0,void 0,void 0,n),maxSize:o.evaluate(new n0(c,{worldview:a}),void 0,void 0,void 0,n),interpolationType:s}}}function pW(i,{uSize:r,uSizeT:a},{lowerSize:n,upperSize:o}){return"source"===i.kind?n/128:"composite"===i.kind?iE(n/128,o/128,a):r}function pX(i,r,a=1){let n=0,o=0;if("constant"===i.kind)o=i.layoutSize*a;else if("source"!==i.kind){let{interpolationType:s,minZoom:l,maxZoom:h}=i,u=s?tl(ag.interpolationFactor(s,r,l,h),0,1):0;"camera"===i.kind?o=iE(i.minSize,i.maxSize,u)*a:n=u*a}return{uSizeT:n,uSize:o}}class pY extends e8{constructor(i,r,a,n,o){super(i,r),this.angle=n,this.z=a,void 0!==o&&(this.segment=o)}clone(){return new pY(this.x,this.y,this.z,this.angle,this.segment)}}function pJ(i,r,a,n,o){if(void 0===r.segment)return!0;let s=r,l=r.segment+1,h=0;for(;h>-a/2;){if(--l<0)return!1;h-=i[l].dist(s),s=i[l]}h+=i[l].dist(i[l+1]),l++;let u=[],c=0;for(;h<a/2;){let r=i[l],a=i[l+1];if(!a)return!1;let s=i[l-1].angleTo(r)-r.angleTo(a);for(s=Math.abs((s+3*Math.PI)%(2*Math.PI)-Math.PI),u.push({distance:h,angleDelta:s}),c+=s;h-u[0].distance>n;)c-=u.shift().angleDelta;if(c>o)return!1;l++,h+=r.dist(a)}return!0}function pK(i){let r=0;for(let a=0;a<i.length-1;a++)r+=i[a].dist(i[a+1]);return r}function pQ(i,r){return Math.max(i?i.right-i.left:0,r?r.right-r.left:0)}function p0(i){let r=0,a=0;for(let n of i)r+=n.w*n.h,a=Math.max(a,n.w);i.sort((i,r)=>r.h-i.h);let n=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(r/.95)),a),h:1/0}],o=0,s=0;for(let r of i)for(let i=n.length-1;i>=0;i--){let a=n[i];if(!(r.w>a.w||r.h>a.h)){if(r.x=a.x,r.y=a.y,s=Math.max(s,r.y+r.h),o=Math.max(o,r.x+r.w),r.w===a.w&&r.h===a.h){let r=n.pop();r&&i<n.length&&(n[i]=r)}else r.h===a.h?(a.x+=r.w,a.w-=r.w):(r.w===a.w||n.push({x:a.x+r.w,y:a.y,w:a.w-r.w,h:r.h}),a.y+=r.h,a.h-=r.h);break}}return{w:o,h:s,fill:r/(o*s)||0}}function p1(i,r){return i.id<r.id?-1:i.id>r.id?1:i.version<r.version?-1:i.version>r.version?1:i.sx<r.sx?-1:i.sx>r.sx?1:i.sy<r.sy?-1:+(i.sy>r.sy)}function p2(i){let r=0;for(let a=0;a<i.length;a++)r=(r<<5)-r+i.charCodeAt(a),r&=r;return r}function p3(i,r){return(i<<5)-i+r}function p5(i,r,a,n){for(let[o]of i.entries()){let i=n&&n.get(o)||i0.parse(o),s=i.id.toString(),l=r.get(s)||0;a.push({id:o,version:l,sx:i.sx,sy:i.sy})}}nl(pY,"Anchor");class p4{constructor(i,r,a,n,o){this.iconDescriptors=[],this.patternDescriptors=[],this.requiresMipMaps=r.size>0,p5(i,a,this.iconDescriptors,o),p5(r,a,this.patternDescriptors,o),this.iconDescriptors.sort(p1),this.patternDescriptors.sort(p1);let s=0,l=n?n.data:"";for(let i of(l&&(s=p3(s,p2(l))),s=p3(s,1),this.iconDescriptors))s=p3(s,p2(i.id)),s=p3(s,i.version),s=p3(s,i.sx),s=p3(s,i.sy);for(let i of(s=p3(s,1),this.patternDescriptors))s=p3(s,p2(i.id)),s=p3(s,i.version),s=p3(s,i.sx),s=p3(s,i.sy);this.hash=s}subsetOf(i){return this.isSubsetArray(this.iconDescriptors,i.iconDescriptors,p1)&&this.isSubsetArray(this.patternDescriptors,i.patternDescriptors,p1)}isSubsetArray(i,r,a){let n=0,o=0;if(i.length>r.length)return!1;for(;n<i.length&&o<r.length;){let s=a(i[n],r[o]);if(0===s)n++,o++;else{if(s<0)return!1;o++}}return n===i.length}}nl(p4,"AtlasContentDescriptor");class p6{static getImagePositionScale(i,r,a){if(r&&i){let{sx:r,sy:a}=i;return{x:r,y:a}}return{x:a,y:a}}constructor(i,r,a,n){this.paddedRect=i;let{pixelRatio:o,version:s,stretchX:l,stretchY:h,content:u,sdf:c,usvg:d}=r;this.pixelRatio=o,this.stretchX=l,this.stretchY=h,this.content=u,this.version=s,this.padding=a,this.sdf=c,this.usvg=d,this.scale=p6.getImagePositionScale(n,d,o)}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 p8(i,r,a){let n=i0.parse(i),o=function(i,r,a=[1,1]){return{x:0,y:0,w:(i.data?i.data.width:i.width*a[0])+2*r,h:(i.data?i.data.height:i.height*a[1])+2*r}}(r,a,[n.sx,n.sy]);return{bin:o,imagePosition:new p6(o,r,a,n),imageVariant:n}}function p9(i,r){let a=[];for(let[n,o]of i.entries()){let i=i0.parse(n);i&&(a.push({key:n,value:o,variant:i}),r&&r.set(n,i))}a.sort((i,r)=>{let a=i.variant.id.toString().localeCompare(r.variant.id.toString());return 0!==a?a:i.variant.sx!==r.variant.sx?i.variant.sx-r.variant.sx:i.variant.sy!==r.variant.sy?i.variant.sy-r.variant.sy:0});let n=new Map;for(let i of a)n.set(i.key,i.value);return n}class p7{constructor(i){this.sourceAtlasHash=i}}class fe{constructor(i,r,a,n){let o=new Map,s=new Map;this.haveRenderCallbacks=[];let l=[],h=void 0!==n,u=h?new Map:void 0,c=h?p9(i,u):i,d=h?p9(r,u):r;this.addImages(c,o,1,l),this.addImages(d,s,2,l);let{w:p,h:f}=p0(l),m=new hR({width:p||1,height:f||1});for(let[i,r]of c.entries()){let a=o.get(i).paddedRect;hR.copy(r.data,m,{x:0,y:0},{x:a.x+1,y:a.y+1},r.data,null,r.sdf)}for(let[i,r]of d.entries()){let n=s.get(i),o=n.paddedRect,l=n.padding,h=o.x+l,u=o.y+l,c=r.data.width,d=r.data.height;l=l>1?l-1:l,hR.copy(r.data,m,{x:0,y:0},{x:h,y:u},r.data,a),hR.copy(r.data,m,{x:0,y:d-l},{x:h,y:u-l},{width:c,height:l},a),hR.copy(r.data,m,{x:0,y:0},{x:h,y:u+d},{width:c,height:l},a),hR.copy(r.data,m,{x:c-l,y:0},{x:h-l,y:u},{width:l,height:d},a),hR.copy(r.data,m,{x:0,y:0},{x:h+c,y:u},{width:l,height:d},a),hR.copy(r.data,m,{x:c-l,y:d-l},{x:h-l,y:u-l},{width:l,height:l},a),hR.copy(r.data,m,{x:0,y:d-l},{x:h+c,y:u-l},{width:l,height:l},a),hR.copy(r.data,m,{x:0,y:0},{x:h+c,y:u+d},{width:l,height:l},a),hR.copy(r.data,m,{x:c-l,y:0},{x:h-l,y:u+d},{width:l,height:l},a)}this.lut=a,this.image=m,this.iconPositions=o,this.patternPositions=s,h&&(this.contentDescriptor=new p4(c,d,n,a,u))}
7addImages(i,r,a,n){for(let[o,s]of i.entries()){let{bin:i,imagePosition:l,imageVariant:h}=p8(o,s,a);r.set(o,l),n.push(i),s.hasRenderCallback&&this.haveRenderCallbacks.push(h.id)}}patchUpdatedImages(i,r,a,n){for(let o of(this.haveRenderCallbacks=this.haveRenderCallbacks.filter(r=>i.hasImage(r,a)),i.dispatchRenderCallbacks(this.haveRenderCallbacks,a),i.getUpdatedImages(a))){for(let n of this.iconPositions.keys()){let s=i0.parse(n);if(ib.isEqual(s.id,o)){let s=i.getImage(o,a);this.patchUpdatedImage(this.iconPositions.get(n),s,r,null)}}for(let s of this.patternPositions.keys()){let l=i0.parse(s);if(ib.isEqual(l.id,o)){let l=i.getImage(o,a);this.patchUpdatedImage(this.patternPositions.get(s),l,r,n||this.lut)}}}}patchUpdatedImage(i,r,a,n=null){if(!i||!r||i.version===r.version)return;i.version=r.version;let[o,s]=i.tl,l=i.sdf;if(this.lut||l){let i={width:r.data.width,height:r.data.height},h=new hR(i);hR.copy(r.data,h,{x:0,y:0},{x:0,y:0},i,n,l),a.update(h,{position:{x:o,y:s},recreateWhenResize:!1})}else a.update(r.data,{position:{x:o,y:s},recreateWhenResize:!1})}}nl(p6,"ImagePosition"),nl(fe,"ImageAtlas",{omit:["lut"]}),nl(p7,"ImageAtlasReference");class ft{constructor(i){this.pendingRequests=new Map,this.cachedRanges=new Map,this.fontstackCompositing=i&&i.fontstackCompositing||"client"}loadGlyphRange(i,r,a,n,o){if("server"===this.fontstackCompositing)return void ft.loadGlyphRange(i,r,a,n,o);let s=i.split(",").map(i=>i.trim()).filter(i=>i.length>0);0!==s.length?1!==s.length?this._loadMultipleFonts(s,r,a,n,o):this._loadFont(s[0],r,a,n,o):o(Error("Empty fontstack"))}_loadMultipleFonts(i,r,a,n,o){let s=i.map(()=>null),l={completed:0,firstError:null,callbackCalled:!1},h=(r,a,n)=>{if(!l.callbackCalled&&(a&&!l.firstError&&(l.firstError=a),n&&(s[r]=n),l.completed++,l.completed===i.length)){l.callbackCalled=!0;let i=s.filter(i=>null!==i);if(0===i.length)return void o(l.firstError||Error("All fonts failed to load"));o(null,this._composeGlyphs(i))}};for(let o=0;o<i.length;o++)this._loadFont(i[o],r,a,n,(i,r)=>{h(o,i,r)})}_loadFont(i,r,a,n,o){let s=`${i}:${r}`;if(this.cachedRanges.has(s)){let i=this.cachedRanges.get(s);return void tj.frame(()=>o(null,i))}let l=this.pendingRequests.get(s);l?l.push(o):(this.pendingRequests.set(s,[o]),ft.loadGlyphRange(i,r,a,n,(i,r)=>{i||this.cachedRanges.set(s,r||null);let a=this.pendingRequests.get(s);if(this.pendingRequests.delete(s),a)for(let n of a)n(i,r)}))}_composeGlyphs(i){let r,a,n={};for(let o of i)if(void 0===r&&void 0!==o.ascender&&(r=o.ascender),void 0===a&&void 0!==o.descender&&(a=o.descender),o.glyphs)for(let i in o.glyphs)void 0===n[i]&&(n[i]=o.glyphs[i]);return{glyphs:n,ascender:r,descender:a}}}ft.loadGlyphRange=function(i,r,a,n,o){let s=256*r;ir(n.transformRequest(n.normalizeGlyphsURL(a).replace("{fontstack}",i).replace("{range}",`${s}-${s+255}`),t4.Glyphs),(i,r)=>{if(i)o(i);else if(r){let i={},a=new p_(r).readFields(pA,{});for(let r of a.glyphs)i[r.id]=r;o(null,{glyphs:i,ascender:a.ascender,descender:a.descender})}})};let fi=new Float64Array(256);for(let i=0;i<256;i++){let r=.5-Math.pow(i/255,1/2.2);fi[i]=r*Math.abs(r)}function fr(i,r,a,n,o,s,l,h,u){for(let c=r;c<r+n;c++)fa(i,a*s+c,s,o,l,h,u);for(let c=a;c<a+o;c++)fa(i,c*s+r,1,n,l,h,u)}function fa(i,r,a,n,o,s,l){s[0]=0,l[0]=-1e20,l[1]=1e20,o[0]=i[r];for(let h=1,u=0,c=0;h<n;h++){o[h]=i[r+h*a];let n=h*h;do{let i=s[u];c=(o[h]-o[i]+n-i*i)/(h-i)/2}while(c<=l[u]&&--u>-1);s[++u]=h,l[u]=c,l[u+1]=1e20}for(let h=0,u=0;h<n;h++){for(;l[u+1]<h;)u++;let n=s[u],c=h-n;i[r+h*a]=o[n]+c*c}}fi[255]=-1e20;let fn=/bold/i,fo=/medium/i,fs=/light/i,fl={none:0,ideographs:1,all:2};class fh{constructor(i,r,a,n){this.requestManager=i,this.localGlyphMode=r,this.localFontFamily=a,this.url="",this.entries={},this.localGlyphs={200:{},400:{},500:{},900:{}},this.glyphLoader=new ft({fontstackCompositing:n})}setURL(i){this.url=i}prefetchRange(i,r){let a=this.url||tF.GLYPHS_URL;if(!a)return;let n=this.entries[i];n||(n=this.entries[i]={glyphs:{},requests:{},ranges:{}}),n.ranges[r]||n.requests[r]||(n.requests[r]=[],this.glyphLoader.loadGlyphRange(i,r,a,this.requestManager,(i,a)=>
7{if(a){for(let i in n.ascender=a.ascender,n.descender=a.descender,a.glyphs)this._doesCharSupportLocalGlyph(+i)||(n.glyphs[+i]=a.glyphs[+i]);n.ranges[r]=!0}for(let o of n.requests[r]||[])o(i,a);delete n.requests[r]}))}getGlyphs(i,r){let a=[],n=this.url||tF.GLYPHS_URL;for(let r in i)for(let n of i[r])a.push({stack:r,id:n});tc(a,({stack:i,id:r},a)=>{let o=this.entries[i];o||(o=this.entries[i]={glyphs:{},requests:{},ranges:{},ascender:void 0,descender:void 0});let s=o.glyphs[r];if(void 0!==s)return void a(null,{stack:i,id:r,glyph:s});if(s=this._tinySDF(o,i,r))return o.glyphs[r]=s,void a(null,{stack:i,id:r,glyph:s});let l=Math.floor(r/256);if(256*l>65535)return tw("glyphs > 65535 not supported"),void a(null,{stack:i,id:r,glyph:s});if(o.ranges[l])return void a(null,{stack:i,id:r,glyph:s});let h=o.requests[l];h||(h=o.requests[l]=[],this.glyphLoader.loadGlyphRange(i,l,n,this.requestManager,(i,r)=>{if(r){for(let i in o.ascender=r.ascender,o.descender=r.descender,r.glyphs)this._doesCharSupportLocalGlyph(+i)||(o.glyphs[+i]=r.glyphs[+i]);o.ranges[l]=!0}for(let a of h)a(i,r);delete o.requests[l]})),h.push((n,o)=>{n?a(n):o&&a(null,{stack:i,id:r,glyph:o.glyphs[r]||null})})},(i,a)=>{if(i)r(i);else if(a){let i={};for(let{stack:r,id:n,glyph:o}of a)void 0===i[r]&&(i[r]={}),void 0===i[r].glyphs&&(i[r].glyphs={}),i[r].glyphs[n]=o&&{id:o.id,bitmap:o.bitmap.clone(),metrics:o.metrics},i[r].ascender=this.entries[r].ascender,i[r].descender=this.entries[r].descender;r(null,i)}})}_doesCharSupportLocalGlyph(i){return this.localGlyphMode!==fl.none&&(this.localGlyphMode===fl.all?!!this.localFontFamily:!!this.localFontFamily&&(nM(i)||nD(i)||nx(i)||nv(i)||ny(i)||nA(i)||i>=131072&&i<=173791||i>=66736&&i<=66815))}_tinySDF(i,r,a){let n=this.localFontFamily;if(!n||!this._doesCharSupportLocalGlyph(a))return;let o=i.tinySDF;if(!o){let a="400";fn.test(r)?a="900":fo.test(r)?a="500":fs.test(r)&&(a="200"),(o=i.tinySDF=new fh.TinySDF({fontFamily:n,fontWeight:a,fontSize:48,buffer:6,radius:16})).fontWeight=a}let s=o.fontWeight;if(this.localGlyphs[s][a])return this.localGlyphs[s][a];let l=String.fromCodePoint(a),{data:h,width:u,height:c,glyphWidth:d,glyphHeight:p,glyphLeft:f,glyphTop:m,glyphAdvance:_}=o.draw(l);return this.localGlyphs[s][a]={id:a,bitmap:new hD({width:u,height:c},h),metrics:{width:d/2,height:p/2,left:f/2,top:m/2-27,advance:_/2,localGlyph:!0}}}}function fu(i,r){return i+r[1]-r[0]}function fc(i,r,a,n,o=1){let s=[],l=i.imagePrimary,h=l.pixelRatio,u=l.paddedRect.w-2,c=l.paddedRect.h-2,d=(i.right-i.left)*o,p=(i.bottom-i.top)*o,f=l.stretchX||[[0,u]],m=l.stretchY||[[0,c]],_=f.reduce(fu,0),g=m.reduce(fu,0),y=u-_,x=c-g,v=0,b=_,w=0,T=g,S=0,E=y,I=0,A=x;if(l.content&&n){let i=l.content;v=fd(f,0,i[0]),w=fd(m,0,i[1]),b=fd(f,i[0],i[2]),T=fd(m,i[1],i[3]),S=i[0]-v,I=i[1]-w,E=i[2]-i[0]-b,A=i[3]-i[1]-T}let M=(n,s,u,c)=>{var f,m,y,x,M,C,P,D,R,z,L,F,O,B,k,N;let U=(f=n.stretch-v,f/b*d+i.left*o),V=(m=n.fixed-S,y=E,x=n.stretch,m-y*x/_),j=(M=s.stretch-w,M/T*p+i.top*o),G=(C=s.fixed-I,P=A,D=s.stretch,C-P*D/g),H=(R=u.stretch-v,R/b*d+i.left*o),$=(z=u.fixed-S,L=E,F=u.stretch,z-L*F/_),q=(O=c.stretch-w,O/T*p+i.top*
7o),Z=(B=c.fixed-I,k=A,N=c.stretch,B-k*N/g),W=new e8(U,j),X=new e8(H,j),Y=new e8(H,q),J=new e8(U,q),K=new e8(V/h,G/h),Q=new e8($/h,Z/h),ee=r*Math.PI/180;if(ee){let i=Math.sin(ee),r=Math.cos(ee),a=[r,-i,i,r];W._matMult(a),X._matMult(a),J._matMult(a),Y._matMult(a)}let et=n.stretch+n.fixed,ei=u.stretch+u.fixed,er=s.stretch+s.fixed,ea=c.stretch+c.fixed,en=i.imageSecondary;return{tl:W,tr:X,bl:J,br:Y,texPrimary:{x:l.paddedRect.x+1+et,y:l.paddedRect.y+1+er,w:ei-et,h:ea-er},texSecondary:en?{x:en.paddedRect.x+1+et,y:en.paddedRect.y+1+er,w:ei-et,h:ea-er}:void 0,writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:K,pixelOffsetBR:Q,minFontScaleX:E/h/d,minFontScaleY:A/h/p,isSDF:a}};if(l.stretchX||l.stretchY){let i=fp(f,y,_),r=fp(m,x,g);for(let a=0;a<i.length-1;a++){let n=i[a],o=i[a+1];for(let i=0;i<r.length-1;i++)s.push(M(n,r[i],o,r[i+1]))}}else s.push(M({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:u+1},{fixed:0,stretch:c+1}));return s}function fd(i,r,a){let n=0;for(let o of i)n+=Math.max(r,Math.min(a,o[1]))-Math.max(r,Math.min(a,o[0]));return n}function fp(i,r,a){let n=[{fixed:-1,stretch:0}];for(let[r,a]of i){let i=n.at(-1);n.push({fixed:r-i.stretch,stretch:i.stretch}),n.push({fixed:r-i.stretch,stretch:i.stretch+(a-r)})}return n.push({fixed:r+1,stretch:a}),n}function ff(i){return 2*i.length+1}function fm(i,r,a,n,o,s,l,h,u,c=1){let d=[];if(0===r.positionedLines.length)return d;let p=(void 0!==u?u:n.layout.get("text-rotate").evaluate(s,{}))*Math.PI/180,f=function(i){let r=i[0],a=i[1],n=r*a;return n>0?[r,-a]:n<0?[-r,a]:0===r?[a,r]:[a,-r]}(a),m=Math.abs(r.top-r.bottom);for(let i of r.positionedLines)m-=i.lineOffset;let _=r.positionedLines.length,g=m/_,y=r.top-a[1];for(let i=0;i<_;++i){let n=r.positionedLines[i];for(let s of(y=function(i,r,a,n){let o=r+i.positionedLines[n].lineOffset;return 0===n?a+o/2:a+(o+(r+i.positionedLines[n-1].lineOffset))/2}(r,g,y,i),n.positionedGlyphs)){let i,n,u,m;if(!s.rect)continue;let _=s.rect||{},g=4,x=!0,v=1,b=0;if(s.image){let i=l.get(s.image.toString());if(!i)continue;if(i.sdf){tw("SDF images are not supported in formatted text and will be ignored.");continue}x=!1,g=1/(v=i.pixelRatio),i.usvg||(v/=c)}let w=(o||h)&&s.vertical,T=s.metrics.advance*s.scale/2,S=s.metrics,E=s.rect;if(null===E)continue;h&&r.verticalizable&&(b=s.image?T-s.metrics.width*s.scale/2:0);let I=o?[s.x+T,s.y]:[0,0],A=[0,0],M=[0,0],C=!1;o||(w?(M=[s.x+T+f[0],s.y+f[1]-b],C=!0):A=[s.x+T+a[0],s.y+a[1]-b]);let P=E.w*s.scale/(v*(s.localGlyph?2:1)),D=E.h*s.scale/(v*(s.localGlyph?2:1));if(w){let r=s.y-y,a=new e8(-T,T-r),o=-Math.PI/2,l=new e8(...M);(i=new e8(-T+A[0],A[1]))._rotateAround(o,a)._add(l),i.x+=-r+T,i.y-=(S.left-g)*s.scale;let h=s.image?S.advance*s.scale:24*s.scale,c=String.fromCodePoint(s.glyph);"︶"===c||"ï¹"===c||"︸"===c||"ï¹"===c||"ï¹"===c||"︾"===c||"︼"===c||"︺"===c||"ï¸"===c||"ï¹"===c||"ï¸"===c||"ï¸"===c||"ï¸"===c||"ï½"===c||"ï¿£"===c||"ï¸"===c||"ï¸"===c?i.x+=(1-g)*s.scale:"︵"===c||"ï¹"===c||"︷"===c||"ï¹"===c||"ï¹"===c||"︽"===c||"︻"===c||"︹"===c||"ï¸"===c||"︿"===c?i.x+=h-S.height*s.scale+(-g-1)*s.scale:i.x+=s.image||S.width+2*g===E.w&&S.height+2*g===E.h?(h-D)/2:(h-(S.height+2*g)*s.scale)/2,n=new e8(i.x,i.y-P),u=new e8(i.x+D,i.y),m=new e8(i.x+D,i.y-P)}else{let r=(S.left-g)*s.scale-T+A[0],a=(-S.top-g)*s.scale+A[1],o=r+P,l=a+D;i=new e8(r,a),n=new e8(o,a),u=new e8(r,l),m=new e8(o,l)}if(p){let r;r=o?new e8(0,0):C?new e8(f[0],f[1]):new e8(a[0],a[1]),i._rotateAround(p,r),n._rotateAround(p,r),u._rotateAround(p,r),m._rotateAround(p,r)}let R=new e8(0,0),z=new e8(0,0);d.push({tl:i,tr:n,bl:u,br:m,texPrimary:_,texSecondary:void 0,writingMode:r.writingMode,glyphOffset:I,sectionIndex:s.sectionIndex,isSDF:x,pixelOffsetTL:R,pixelOffsetBR:z,minFontScaleX:0,minFontScaleY:0})}}return d}function f_(i,r){return r.max-i.max}fh.TinySDF=class{constructor({fontSize:i=24,buffer:r=3,radius:a=8,cutoff:n=.25,fontFamily:o="sans-serif",fontWeight:s="normal",fontStyle:l="normal",lang:h=null}={}){this.buffer=r,this.radius=a,this.cutoff=n,this.lang=h;let u=this.size=i+4*r,c=this._createCanvas(u),d=this.ctx=c.getContext("2d",{willReadFrequently:!0});d.font=`${l} ${s} ${i}px ${o}`,d.textBaseline="alphabetic",d.textAlign="left",d.fillStyle="black",this.gridOuter=new Float64Array(u*u),this.gridInner=new Float64Array(u*u),this.f=new Float64Array(u),this.z=new Float64Array(u+1),this.v=new Uint16Array(u)}_createCanvas(i){if("undefined"!=typeof OffscreenCanvas)return new OffscreenCanvas(i,i);let r=document.createElement("canvas");return r.width=r.height=i,r}draw(i){let{width:r,actualBoundingBoxAscent:a,actualBoundingBoxDescent:n,actualBoundingBoxLeft:o,actualBoundingBoxRight:s}=this.ctx.measureText(i),l=Math.ceil(a),h=Math.floor(o),u=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(s)-h)),c=Math.max(0,Math.min(this.size-this.buffer,l+Math.ceil(n))),d=u+2*this.buffer,p=c+2*this.buffer,f=Math.max(d*p,0),m=new Uint8ClampedArray(f),_={data:m,width:d,height:p,glyphWidth:u,glyphHeight:c,glyphTop:l,glyphLeft:h,glyphAdvance:r};if(0===u||0===c)return _;let{ctx:g,buffer:y,gridInner:x,gridOuter:v}=this;this.lang&&(g.lang=this.lang),g.clearRect(y,y,u,c),g.fillText(i,y-h,y+l);let b=g.getImageData(y,y,u,c);v.fill(1e20,0,f),x.fill(0,0,f);let w=3;for(let i=0;i<c;i++){let r=(i+y)*d+y;for(let i=0;i<u;i++,w+=4,r++){let i=b.data[w];if(0===i)continue;let a=fi[i];v[r]=Math.max(0,a),x[r]=Math.max(0,-a)}}fr(v,0,0,d,p,d,this.f,this.v,this.z),fr(x,y,y,u,c,d,this.f,this.v,this.z);let T=255/this.radius,S=255*(1-this.cutoff);for(let i=0;i<f;i++){let r=Math.sqrt(v[i])-Math.sqrt(x[i]);m[i]=Math.round(S-T*r)}return _}};class fg{constructor(i,r,a,n){this.p=new e8(i,r),this.h=a,this.d=function(i,r){let a=!1,n=1/0;for(let o=0;o<r.length;o++){let s=r[o];for(let r=0,o=s.length,l=o-1;r<o;
7l=r++){let o=s[r],h=s[l];o.y>i.y!=h.y>i.y&&i.x<(h.x-o.x)*(i.y-o.y)/(h.y-o.y)+o.x&&(a=!a),n=Math.min(n,lV(i,o,h))}}return(a?1:-1)*Math.sqrt(n)}(this.p,n),this.max=this.d+this.h*Math.SQRT2}}let fy=Object.keys,fx=1/0,fv=Math.sqrt(2);function fb(i,r,a,n,o,s){let l=pV(i)&&i.collisionPadding?i.collisionPadding:[0,0,0,0],h={top:i.top-l[1],bottom:i.bottom+l[3],left:i.left-l[0],right:i.right+l[2],scaled:!1};return void 0!==n&&(h.top*=n,h.bottom*=n,h.left*=n,h.right*=n,h.scaled=!0),s&&(h.left+=s[0],h.right+=s[0],h.top+=s[1],h.bottom+=s[1]),a&&function(i,r,a){if(!r)return;let n=r*e7,o=new e8(a?a[0]:0,a?a[1]:0),s=new e8(i.left,i.top),l=new e8(i.right,i.top),h=new e8(i.left,i.bottom),u=new e8(i.right,i.bottom);s._rotateAround(n,o),l._rotateAround(n,o),h._rotateAround(n,o),u._rotateAround(n,o),i.left=Math.min(s.x,l.x,h.x,u.x),i.right=Math.max(s.x,l.x,h.x,u.x),i.top=Math.min(s.y,l.y,h.y,u.y),i.bottom=Math.max(s.y,l.y,h.y,u.y)}(h,a,o),r?{top:Math.min(r.top,h.top),bottom:Math.max(r.bottom,h.bottom),left:Math.min(r.left,h.left),right:Math.max(r.right,h.right),scaled:r.scaled||h.scaled}:h}function fw(i,[r,a]){let n=0,o=0;if(a===fx){r<0&&(r=0);let a=r/fv;switch(i){case"top-right":case"top-left":o=a-7;break;case"bottom-right":case"bottom-left":o=7-a;break;case"bottom":o=7-r;break;case"top":o=r-7}switch(i){case"top-right":case"bottom-right":n=-a;break;case"top-left":case"bottom-left":n=a;break;case"left":n=r;break;case"right":n=-r}}else{switch(r=Math.abs(r),a=Math.abs(a),i){case"top-right":case"top-left":case"top":o=a-7;break;case"bottom-right":case"bottom-left":case"bottom":o=7-a}switch(i){case"top-right":case"bottom-right":case"right":n=-r;break;case"top-left":case"bottom-left":case"left":n=r}}return[n,o]}function fT(i,r,a,n,o,s,l,h){let u=i.hasLayoutProperty("icon-offset")?r.getAppearanceValueAndResolveTokens(i,"icon-offset",a,n,[]):null,c=u&&Array.isArray(u)?u:o,d=i.hasLayoutProperty("icon-rotate")?r.getAppearanceValueAndResolveTokens(i,"icon-rotate",a,n,[]):null,p=i.hasLayoutProperty("icon-size")?r.getAppearanceValueAndResolveTokens(i,"icon-size",a,n,[]):null;return{appearanceIconOffset:c,appearanceIconRotate:"number"==typeof d?d:s,appearanceIconSize:"number"==typeof p?p*h:l}}function fS(i,r,a,n,o,s,l){let h=i.hasLayoutProperty("text-offset")?r.getAppearanceValueAndResolveTokens(i,"text-offset",a,n,[]):null,u=h&&Array.isArray(h)?[24*h[0],24*h[1]]:o,c=i.hasLayoutProperty("text-rotate")?r.getAppearanceValueAndResolveTokens(i,"text-rotate",a,n,[]):null,d=i.hasLayoutProperty("text-size")?r.getAppearanceValueAndResolveTokens(i,"text-size",a,n,[]):null;return{appearanceTextOffset:u,appearanceTextRotate:"number"==typeof c?c:s,appearanceTextSize:"number"==typeof d?d:l}}function fE(i,r,a,n,o,s,l,h,u){if(!r||!r.usvg)return;let c=pq(n),d=pq(o),p=("both"===s||"width"===s)&&pH(n)?d.width/c.width:1,f=("both"===s||"height"===s)&&p$(n)?d.height/c.height:1;a.scaleSelf(p,f);let m=a.toString();l.set(m,a),h.set(m,r);let{imagePosition:_}=p8(m,r,1);u.set(m,_)}function fI(i,r,a,n,o,s,l,h,u,c){var d,p,f,m,_,g,y;if(!i)return;let x=(d=r,p=a,f=n,m=o,_=s,g=u,y=c,"camera"===d.kind?d.maxSize:"composite"===d.kind?Math.max(p.possiblyEvaluate(new n0(d.maxZoom,{worldview:g}),f,y).evaluate(_,{},f,y),p.possiblyEvaluate(new n0(d.minZoom,{worldview:g}),f,y).evaluate(_,{},f,y)):p.possiblyEvaluate(new n0(m,{worldview:g}),f,y).evaluate(_,{},f,y));return i.scaleSelf(x*h*l)}function fA(i,r,a,n,o,s,l,h,u,c){return{iconPrimary:fI(i.getPrimary(),r,a,n,o,s,l,h,u,c),iconSecondary:fI(i.getSecondary(),r,a,n,o,s,l,h,u,c)}}function fM(i,r,a,n){if(!i)return;let o=r.get(a.toString());o&&(i.imagePrimary=o),n&&(i.imageSecondary=r.get(n.toString()))}function fC(i,r){if(i){for(let a of i.positionedLines)for(let i of a.positionedGlyphs)if(null!==i.image){let a=i.image.toString();i.rect=r.get(a).paddedRect}}}function fP(i){switch(i){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function fD(i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v){let b=fm(0,n,u,s,l,h,o,i.allowVerticalPlacement,void 0,_.textScaleFactor),w=s.layout.get("text-size").evaluate(h,{},y),T=_.compositeTextSizes?_.compositeTextSizes[0].evaluate(h,{},y):0,S=_.compositeTextSizes?_.compositeTextSizes[1].evaluate(h,{},y):0,E=fR(i.layerIds[0],i.textSizeData,w,_.textScaleFactor,T,S);for(let n of(i.addSymbols(i.text,b,E,u,l,h,d,r,a,c.lineStartIndex,c.lineLength,m,g,y,v,!1,x,b.length),p))f[n]=i.text.placedSymbolArray.length-1;return 4*b.length}function fR(i,r,a,n,o,s){let l=null;return"source"===r.kind?(l=[128*a*n])[0]>32640&&tw(`${i}: Value for "text-size" or "icon-size" is >= 255. Reduce your "text-size" or "icon-size".`):"composite"===r.kind&&((l=[128*o*n,128*s*n])[0]>32640||l[1]>32640)&&tw(`${i}: Value for "text-size" or "icon-size" is >= 255. Reduce your "text-size" or "icon-size".`),l}function fz(i){for(let r in i)return i[r];return null}function fL(i,r,a,n,o,s,l,h,u,c,d){let p,f,m,_;if(p=d?d.top:l.top,f=d?d.bottom:l.bottom,m=d?d.left:l.left,_=d?d.right:l.right,pV(l)&&l.collisionPadding){let i=l.collisionPadding;m-=i[0],p-=i[1],_+=i[2],f+=i[3]}if(u){let i=new e8(m,p),r=new e8(_,p),a=new e8(m,f),n=new e8(_,f),o=u*e7,s=new e8(0,0);
7c&&(s=new e8(c[0],c[1])),i._rotateAround(o,s),r._rotateAround(o,s),a._rotateAround(o,s),n._rotateAround(o,s),m=Math.min(i.x,r.x,a.x,n.x),_=Math.max(i.x,r.x,a.x,n.x),p=Math.min(i.y,r.y,a.y,n.y),f=Math.max(i.y,r.y,a.y,n.y)}return i.emplaceBack(r.x,r.y,r.z,a.x,a.y,m,p,_,f,h,n,o,s),i.length-1}function fF(i){pV(i)&&i.collisionPadding&&(i.top-=i.collisionPadding[1],i.bottom+=i.collisionPadding[3]);let r=i.bottom-i.top;return r>0?Math.max(10,r):null}function fO(i,r){let a=i.fovAboveCenter,n=Math.min(i.elevation?i.elevation.getMinElevationBelowMSL()*r:0,i.isOrthographic?-10*r:0),o=(i._camera.position[2]*i.worldSize-n)/Math.cos(i._pitch),s=Math.sin(a)*o/Math.sin(Math.max(Math.PI/2-i._pitch-a,.01)),l=Math.sin(i._pitch)*s+o,h=o*(1/i._horizonShift);if(!i.elevation||0===i.elevation.exaggeration()){let r=Math.max(i.zoom-17,0);i.isOrthographic&&(r/=10),l*=1+r}return Math.min(1.01*l,h)}function fB(i,r){if(!r.isReprojectedInTileSpace)return{scale:1<<i.z,x:i.x,y:i.y,x2:i.x+1,y2:i.y+1,projection:r};let a=Math.pow(2,-i.z),n=i.x*a,o=(i.x+1)*a,s=i.y*a,l=(i.y+1)*a,h=s6(n),u=s6(o),c=s8(s),d=s8(l),p=r.project(h,c),f=r.project(u,c),m=r.project(u,d),_=r.project(h,d),g=Math.min(p.x,f.x,m.x,_.x),y=Math.min(p.y,f.y,m.y,_.y),x=Math.max(p.x,f.x,m.x,_.x),v=Math.max(p.y,f.y,m.y,_.y),b=a/16;function w(i,a,n,o,s,l){let h=(n+s)/2,u=(o+l)/2,c=r.project(s6(h),s8(u)),d=Math.max(0,g-c.x,y-c.y,c.x-x,c.y-v);g=Math.min(g,c.x),x=Math.max(x,c.x),y=Math.min(y,c.y),v=Math.max(v,c.y),d>b&&(w(i,c,n,o,h,u),w(c,a,h,u,s,l))}w(p,f,n,s,o,s),w(f,m,o,s,o,l),w(m,_,o,l,n,l),w(_,p,n,l,n,s),g-=b,y-=b,x+=b,v+=b;let T=1/Math.max(x-g,v-y);return{scale:T,x:g*T,y:y*T,x2:x*T,y2:v*T,projection:r}}function fk(i,{x:r,y:a},n=0){return new e8(((r-n)*i.scale-i.x)*8192,(a*i.scale-i.y)*8192)}let fN=et(new Float32Array(16));class fU{constructor(i){this.spec=i,this.name=i.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(i,r){return{x:0,y:0,z:0}}unproject(i,r){return new s1(0,0)}projectTilePoint(i,r,a){return{x:i,y:r,z:0}}locationPoint(i,r,a,n=!0){return i._coordinatePoint(i.locationCoordinate(r,a),n)}pixelsPerMeter(i,r){return 1/s3(i)*r}pixelSpaceConversion(i,r,a){return 1}farthestPixelDistance(i){return fO(i,i.pixelsPerMeter)}pointCoordinate(i,r,a,n){let o=new e8(r,Math.max(i.horizonLineFromTop(!1),a));return i.rayIntersectionCoordinate(i.pointRayIntersection(o,n))}pointCoordinate3D(i,r,a){let n=new e8(r,a);if(i.elevation)return i.elevation.pointCoordinate(n);{let r=this.pointCoordinate(i,n.x,n.y,0);return[r.x,r.y,r.z]}}isPointAboveHorizon(i,r){if(i.elevation&&i.elevation.visibleDemTiles.length)return!this.pointCoordinate3D(i,r.x,r.y);let a=i.horizonLineFromTop();return r.y<a}createInversionMatrix(i,r){return fN}createTileMatrix(i,r,a){let n,o,s,l=a.canonical,h=et(new Float64Array(16));if(this.isReprojectedInTileSpace){let u=fB(l,this);n=1,o=u.x+a.wrap*u.scale,s=u.y,en(h,h,[n/u.scale,n/u.scale,i.pixelsPerMeter/r])}else n=r/i.zoomScale(l.z),o=(l.x+Math.pow(2,l.z)*a.wrap)*n,s=l.y*n;return ea(h,h,[o,s,0]),en(h,h,[n/8192,n/8192,1]),h}upVector(i,r,a){return[0,0,1]}upVectorScale(i,r,a){return{metersToTile:1}}}class fV extends fU{constructor(i){super(i),this.range=[4,7],this.center=i.center||[-96,37.5];let[r,a]=this.parallels=i.parallels||[29.5,45.5],n=Math.sin(r*e7);this.n=(n+Math.sin(a*e7))/2,this.c=1+n*(2*this.n-n),this.r0=Math.sqrt(this.c)/this.n}project(i,r){let{n:a,c:n,r0:o}=this,s=(i-this.center[0])*e7,l=Math.sqrt(n-2*a*Math.sin(r*e7))/a;return{x:l*Math.sin(s*a),y:l*Math.cos(s*a)-o,z:0}}unproject(i,r){let{n:a,c:n,r0:o}=this,s=o+r,l=Math.atan2(i,Math.abs(s))*Math.sign(s);s*a<0&&(l-=Math.PI*Math.sign(i)*Math.sign(s));let h=this.center[0]*e7*a,u=tl((l=tu(l,-Math.PI-h,Math.PI-h))/a*te+this.center[0],-180,180),c=Math.asin(tl((n-(i*i+s*s)*a*a)/(2*a),-1,1));return new s1(u,tl(c*te,-85.051129,85.051129))}}let fj=Math.sqrt(3)/2;class fG extends fU{project(i,r){r=r/180*Math.PI,i=i/180*Math.PI;let a=Math.asin(fj*Math.sin(r)),n=a*a,o=n*n*n;return{x:.5*(i*Math.cos(a)/(fj*(1.340264+-.24331799999999998*n+o*(.0062510000000000005+.034164*n))
7)/Math.PI+.5),y:1-.5*(a*(1.340264+-.081106*n+o*(893e-6+.003796*n))/Math.PI+1),z:0}}unproject(i,r){i=(2*i-.5)*Math.PI;let a=r=(2*(1-r)-1)*Math.PI,n=a*a,o=n*n*n;for(let i,s,l=0;l<12&&(s=a*(1.340264+-.081106*n+o*(893e-6+.003796*n))-r,o=(n=(a=tl(a-(i=s/(1.340264+-.24331799999999998*n+o*(.0062510000000000005+.034164*n))),-Math.PI/3,Math.PI/3))*a)*n*n,!(1e-12>Math.abs(i)));++l);let s=fj*i*(1.340264+-.24331799999999998*n+o*(.0062510000000000005+.034164*n))/Math.cos(a),l=Math.asin(Math.sin(a)/fj);return new s1(tl(180*s/Math.PI,-180,180),tl(180*l/Math.PI,-85.051129,85.051129))}}class fH extends fU{constructor(i){super(i),this.wrap=!0,this.supportsWorldCopies=!0}project(i,r){return{x:.5+i/360,y:.5-r/360,z:0}}unproject(i,r){return new s1(360*(i-.5),tl(360*(.5-r),-85.051129,85.051129))}}let f$=Math.PI/2;function fq(i){return Math.tan((f$+i)/2)}class fZ extends fU{constructor(i){super(i),this.center=i.center||[0,30];let[r,a]=this.parallels=i.parallels||[30,30],n=r*e7,o=a*e7;this.southernCenter=n+o<0,this.southernCenter&&(n=-n,o=-o);let s=Math.cos(n),l=fq(n);this.n=n===o?Math.sin(n):Math.log(s/Math.cos(o))/Math.log(fq(o)/l),this.f=s*Math.pow(fq(n),this.n)/this.n}project(i,r){r*=e7,this.southernCenter&&(r=-r),i=(i-this.center[0])*e7;let{n:a,f:n}=this;n>0?r<-f$+1e-6&&(r=-f$+1e-6):r>f$-1e-6&&(r=f$-1e-6);let o=n/Math.pow(fq(r),a),s=o*Math.sin(a*i),l=n-o*Math.cos(a*i);return s=.5*(s/Math.PI+.5),l=.5*(l/Math.PI+.5),{x:s,y:this.southernCenter?l:1-l,z:0}}unproject(i,r){i=(2*i-.5)*Math.PI,this.southernCenter&&(r=1-r);let{n:a,f:n}=this,o=n-(r=(2*(1-r)-.5)*Math.PI),s=Math.sign(o),l=Math.sign(a)*Math.sqrt(i*i+o*o),h=Math.atan2(i,Math.abs(o))*s;o*a<0&&(h-=Math.PI*Math.sign(i)*s);let u=tl(h/a*te+this.center[0],-180,180),c=tl((2*Math.atan(Math.pow(n/l,1/a))-f$)*te,-85.051129,85.051129);return new s1(u,this.southernCenter?-c:c)}}class fW extends fU{constructor(i){super(i),this.wrap=!0,this.supportsWorldCopies=!0,this.supportsTerrain=!0,this.supportsFog=!0,this.supportsFreeCamera=!0,this.isReprojectedInTileSpace=!1,this.unsupportedLayers=[],this.range=null}project(i,r){return{x:s5(i),y:s4(r),z:0}}unproject(i,r){return new s1(s6(i),s8(r))}}let fX=85.051129*e7;class fY extends fU{project(i,r){let a=(r*=e7)*r,n=a*a;return{x:.5*((i*=e7)*(.8707-.131979*a+n*(n*(.003971*a-.001529*n)-.013791))/Math.PI+.5),y:1-.5*(r*(1.007226+a*(.015085+n*(.028874*a-.044475-.005916*n)))/Math.PI+1),z:0}}unproject(i,r){i=(2*i-.5)*Math.PI;let a=r=(2*(1-r)-1)*Math.PI,n=25,o=0,s=a*a;do{let i=(s=a*a)*s;o=(a*(1.007226+s*(.015085+i*(.028874*s-.044475-.005916*i)))-r)/(1.007226+s*(.045255+i*(.259866*s-.311325-.005916*11*i))),a=tl(a-o,-fX,fX)}while(Math.abs(o)>1e-6&&--n>0);return new s1(tl(i/(.8707+(s=a*a)*(s*(s*s*s*(.003971-.001529*s)-.013791)-.131979))*te,-180,180),a*te)}}let fJ=85.051129*e7;class fK extends fU{project(i,r){r*=e7,i*=e7;let a=Math.cos(r),n=Math.acos(a*Math.cos(i/2)),o=Math.sin(n)/n;return{x:.5*((.5*(2/Math.PI*i+2*a*Math.sin(i/2)/o)||0)/Math.PI+.5),y:1-.5*((.5*(r+Math.sin(r)/o)||0)/Math.PI+1),z:0}}unproject(i,r){let a=i=(2*i-.5)*Math.PI,n=r=(2*(1-r)-1)*Math.PI,o=25,s=0,l=0;do{let o=Math.cos(n),h=Math.sin(n),u=2*h*o,c=h*h,d=o*o,p=Math.cos(a/2),f=Math.sin(a/2),m=2*p*f,_=f*f,g=1-d*p*p,y=g?1/g:0,x=g?Math.acos(o*p)*Math.sqrt(1/g):0,v=.5*(2*x*o*f+2*a/Math.PI)-i,b=.5*(x*h+n)-r,w=.5*y*(d*_+x*o*p*c)+1/Math.PI,T=y*(m*u/4-x*h*f),S=.125*y*(u*f-x*h*d*m),E=.5*y*(c*p+x*_*o)+.5,I=T*S-E*w;s=(b*T-v*E)/I,l=(v*S-b*w)/I,a=tl(a-s,-Math.PI,Math.PI),n=tl(n-l,-fJ,fJ)}while((Math.abs(s)>1e-6||Math.abs(l)>1e-6)&&--o>0);return new s1(a*te,n*te)}}class fQ extends fU{constructor(i){super(i),this.center=i.center||[0,0],this.parallels=i.parallels||[0,0],this.cosPhi=Math.max(.01,Math.cos(this.parallels[0]*e7)),this.scale=1/(2*Math.max(Math.PI*this.cosPhi,1/this.cosPhi)),this.wrap=!0,this.supportsWorldCopies=!0}project(i,r){let{scale:a,cosPhi:n}=this;return{x:i*e7*n*a+.5,y:-Math.sin(r*e7)/n*a+.5,z:0}}unproject(i,r){let{scale:a,cosPhi:n}=this,o=tl((i-.5)/a*te/n,-180,180),s=Math.asin(tl(-(r-.5)/a*n,-1,1));return new s1(o,tl(s*te,-85.051129,85.051129))}}class f0 extends fW{constructor(i){super(i),this.requiresDraping=!0,this.supportsWorldCopies=!1,this.supportsFog=!0,this.zAxisUnit="pixels",this.unsupportedLayers=["debug"],this.range=[3,5]}projectTilePoint(i,r,a){let n=hl(i,r,a);return eL(n,n,hc(ht(a))),{x:n[0],y:n[1],z:n[2]}}locationPoint(i,r,a){let n=sQ(r.lat,r.lng),o=eP([],n),s=a?i._centerAltitude+a:i.elevation?i.elevation.getAtPointOrZero(i.locationCoordinate(r),i._centerAltitude):i._centerAltitude;
7eE(n,n,o,1/s3(0)*8192*s);let l=et(new Float64Array(16));return er(l,i.pixelMatrix,i.globeMatrix),eL(n,n,l),new e8(n[0],n[1])}pixelsPerMeter(i,r){return 1/s3(0)*r}pixelSpaceConversion(i,r,a){let n=1/s3(i)*r,o=iE(1/s3(45)*r,n,a);return this.pixelsPerMeter(i,r)/o}createTileMatrix(i,r,a){let n=hd(ht(a.canonical));return er(new Float64Array(16),i.globeMatrix,n)}createInversionMatrix(i,r){let{center:a}=i,n=hc(ht(r));return es(n,n,a.lng*e7),eo(n,n,a.lat*e7),en(n,n,[i._pixelsPerMercatorPixel,i._pixelsPerMercatorPixel,1]),Float32Array.from(n)}pointCoordinate(i,r,a,n){return l9(i,r,a,!0)||new lr(0,0)}pointCoordinate3D(i,r,a){let n=this.pointCoordinate(i,r,a,0);return[n.x,n.y,n.z]}isPointAboveHorizon(i,r){return!l9(i,r.x,r.y,!1)}farthestPixelDistance(i){let r=function(i,r){let a,n=i.cameraToCenterDistance,o=i._centerAltitude*r,s=i._camera,l=i._camera.forward(),h=ex([],eS([],l,-n),[0,0,o]),u=i.worldSize/(2*Math.PI),c=[0,0,-u],d=i.width/i.height,p=Math.tan(i.fovAboveCenter),f=eS([],s.up(),p),m=eS([],s.right(),p*d),_=eP([],ex([],ex([],l,f),m)),g=[];if(new lw(h,_).closestPointOnSphere(c,u,g)){let r=ev([],ex([],g,c),h);a=Math.cos(i.fovAboveCenter)*e_(r)}else{let i=ev([],h,c),r=ev([],c,h);eP(r,r);let n=e_(i)-u,o=Math.acos((a=Math.sqrt(n*(n+2*u)))/(u+n))-Math.acos(eD(l,r));a*=Math.cos(o)}return 1.01*a}(i,this.pixelsPerMeter(i.center.lat,i.worldSize)),a=h_(i.zoom);if(a>0){let n=fO(i,1/s3(i.center.lat)*i.worldSize);return iE(r,n+i.worldSize/(2*Math.PI)*(1-Math.cos(Math.max(i.width,i.height)/i.worldSize*Math.PI)),Math.pow(a,10))}return r}upVector(i,r,a){return hl(r,a,i,1)}upVectorScale(i){return{metersToTile:l6(hh(ht(i)))}}}function f1(i){let r=i.parallels,a=!!r&&.01>Math.abs(r[0]+r[1]);switch(i.name){case"mercator":return new fW(i);case"equirectangular":return new fH(i);case"naturalEarth":return new fY(i);case"equalEarth":return new fG(i);case"winkelTripel":return new fK(i);case"albers":return a?new fQ(i):new fV(i);case"lambertConformalConic":return a?new fQ(i):new fZ(i);case"globe":return new f0(i)}throw Error(`Invalid projection name: ${i.name}`)}class f2{constructor(i,r){this.lastParams=null,this.lastAllFeaturesIndex=-2,this.appearancesVersion=r,this.appearances=i;let a=i.map(i=>(function(i){if(!i.condition)return{featureDependent:!1,stateDependent:!1,zoomDependent:!1,pitchDependent:!1,brightnessDependent:!1,worldviewDependent:!1};let r=i.condition.expression;return{featureDependent:!r1(r),stateDependent:!r2(r),zoomDependent:!r3(r,["zoom"]),pitchDependent:!r3(r,["pitch"]),brightnessDependent:!r3(r,["brightness","measure-light"]),worldviewDependent:!r3(r,["worldview"])}})(i));this.anyFeatureDependent=a.some(i=>i.featureDependent),this.anyStateDependent=a.some(i=>i.stateDependent)}update(i,r){let a=this.lastParams,n=!a||a.zoom!==i.zoom||a.pitch!==(i.pitch||0)||a.brightness!==(i.brightness||0)||a.worldview!==i.worldview;this.lastParams={zoom:i.zoom,pitch:i.pitch||0,brightness:i.brightness||0,worldview:i.worldview};let o=r&&this.anyStateDependent;if(!n&&!o&&-2!==this.lastAllFeaturesIndex)return{kind:"no-changes"};if(!this.anyFeatureDependent&&!o){let r=this.evaluateAllFeatures(i);return r===this.lastAllFeaturesIndex?{kind:"no-changes"}:(this.lastAllFeaturesIndex=r,{kind:"all-features",appearanceIndex:r})}return{kind:"per-feature"}}evaluateAllFeatures(i){for(let r=0;r<this.appearances.length;r++){let a=this.appearances[r];if(a.condition&&a.condition.evaluate(i,void 0,void 0,void 0))return r}return -1}}let f3=ll.types,f5=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function f4(i,r,a,n,o,s,l,h,u,c,d,p,f){let m=h?Math.min(32640,Math.round(h[0])):0,_=h?Math.min(32640,Math.round(h[1])):0;i.emplaceBack(r,a,Math.round(32*n),Math.round(32*o),s,l,(m<<1)+ +!!u,0+(_<<1),16*c,16*d,256*p,256*f)}function f6(i,r,a){i.emplaceBack(r,a)}function f8(i,r,a,n,o,s,l){i.emplaceBack(r,a,n,o,s,l)}let f9=(i,r,a,n)=>{for(let o=0;o<r;o++)i.emplaceBack(a[0],a[1],a[2],n[0],n[1],n[2])};function f7(i,r,a,n,o){i.emplaceBack(r,a,n,o),i.emplaceBack(r,a,n,o),i.emplaceBack(r,a,n,o),i.emplaceBack(r,a,n,o)}class me{constructor(i){this.layoutVertexArray=new oj,this.indexArray=new oJ,this.programConfigurations=i,this.segments=new sy,this.dynamicLayoutVertexArray=new oH,this.opacityVertexArray=new o$,this.placedSymbolArray=new sn,this.iconTransitioningVertexArray=new oq,this.globeExtVertexArray=new oG,this.zOffsetVertexArray=new oR,this.orientationVertexArray=new o0,this.symbolInstanceIndices=[],this.uboBinder=null,this.featureIdArray=new oR,this.featureIdBuffer=null,this.cachedBatchIndices=null,this.cachedBatchSegments=null}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.indexArray.length&&0===this.dynamicLayoutVertexArray.length&&0===this.opacityVertexArray.length&&0===this.iconTransitioningVertexArray.length}getBatchGrouping(i){let r=i.get().length===this.segments.get().length;if(r&&this.cachedBatchIndices&&this.cachedBatchSegments)return{batchIndices:this.cachedBatchIndices,batchSegments:this.cachedBatchSegments};let a=new Map;for(let r of i.get()){let i=void 0!==r.batchIndex?r.batchIndex:0;a.has(i)||a.set(i,[]),a.get(i).push(r)}let n=Array.from(a.keys()).sort((i,r)=>i-r),o=new Map;for(let i of n){let r=a.get(i);o.set(i,new sy(r))}return r&&(this.cachedBatchIndices=n,this.cachedBatchSegments=o),{batchIndices:n,batchSegments:o}}
7snapshotSymbolVertexData(i,r){let a=12*i;return this.layoutVertexArray.uint16.slice(a,a+12*r)}restoreSymbolVertexData(i,r){this.layoutVertexArray.uint16.set(r,12*i)}updateSymbolVertexData(i,r,a,n,o,s,l,h,u,c,d,p,f){let m=this.layoutVertexArray.uint16,_=12*i;m[_]=r,m[_+1]=a,m[_+2]=n,m[_+3]=o,m[_+4]=s,m[_+5]=l,m[_+6]=h,m[_+7]=u,m[_+8]=c,m[_+9]=d,m[_+10]=p,m[_+11]=f}upload(i,r,a,n,o,s){this.isEmpty()||(a&&(this.cachedBatchIndices=null,this.cachedBatchSegments=null,this.layoutVertexBuffer=i.createVertexBuffer(this.layoutVertexArray,pe.members,!!s),this.indexBuffer=i.createIndexBuffer(this.indexArray,r),this.dynamicLayoutVertexBuffer=i.createVertexBuffer(this.dynamicLayoutVertexArray,pi.members,!0),this.opacityVertexBuffer=i.createVertexBuffer(this.opacityVertexArray,f5,!0),this.iconTransitioningVertexArray.length>0&&(this.iconTransitioningVertexBuffer=i.createVertexBuffer(this.iconTransitioningVertexArray,po.members,!0)),this.globeExtVertexArray.length>0&&(this.globeExtVertexBuffer=i.createVertexBuffer(this.globeExtVertexArray,pt.members,!0)),!this.zOffsetVertexBuffer&&(this.zOffsetVertexArray.length>0||o)&&(this.zOffsetVertexBuffer=i.createVertexBuffer(this.zOffsetVertexArray,pr.members,!0)),!this.orientationVertexBuffer&&this.orientationVertexArray&&this.orientationVertexArray.length>0&&(this.orientationVertexBuffer=i.createVertexBuffer(this.orientationVertexArray,pn.members,!0)),this.opacityVertexBuffer.itemSize=1,this.featureIdArray&&this.featureIdArray.length>0&&(this.featureIdBuffer=i.createVertexBuffer(this.featureIdArray,pa.members,!1))),(a||n)&&(this.programConfigurations.upload(i),this.uboBinder&&this.uboBinder.upload(i)))}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())}}nl(me,"SymbolBuffers",{omit:["cachedBatchIndices","cachedBatchSegments"]});class mt{constructor(i,r,a){this.layoutVertexArray=new i,this.layoutAttributes=r,this.indexArray=new a,this.segments=new sy,this.collisionVertexArray=new oY,this.collisionVertexArrayExt=new oH}upload(i){this.layoutVertexBuffer=i.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=i.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=i.createVertexBuffer(this.collisionVertexArray,ps.members,!0),this.collisionVertexBufferExt=i.createVertexBuffer(this.collisionVertexArrayExt,pl.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy(),this.collisionVertexBufferExt.de
7stroy())}}nl(mt,"CollisionBuffers");class mi{constructor(i){this.collisionBoxArray=i.collisionBoxArray,this.zoom=i.zoom,this.overscaling=i.overscaling,this.layers=i.layers,this.layerIds=this.layers.map(i=>i.fqid),this.index=i.index,this.pixelRatio=i.pixelRatio,this.sourceLayerIndex=i.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.fullyClipped=!1,this.hasAnyIconTextFit=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=et([]),this.placementViewportMatrix=et([]);let r=this.layers[0]._unevaluatedLayout._values;this.worldview=i.worldview,this.localizable=i.localizable,this.maxUniformBufferBindings=i.maxUniformBufferBindings,this.maxUniformBlockSizeDwords=i.maxUniformBlockSizeDwords,this.disableSymbolUBO=i.disableSymbolUBO,this.textSizeData=pZ(this.zoom,r["text-size"],this.worldview,i.availableImages),this.iconSizeData=pZ(this.zoom,r["icon-size"],this.worldview,i.availableImages);let a=this.layers[0].layout,n=a.get("symbol-sort-key"),o=a.get("symbol-z-order");this.lut=i.lut,this.canOverlap=a.get("text-allow-overlap")||a.get("icon-allow-overlap")||a.get("text-ignore-placement")||a.get("icon-ignore-placement"),this.sortFeaturesByKey="viewport-y"!==o&&void 0!==n.constantOr(1),this.sortFeaturesByY=("viewport-y"===o||"auto"===o&&!this.sortFeaturesByKey)&&this.canOverlap,this.writingModes=a.get("text-writing-mode").map(i=>pP[i]),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.sourceID=i.sourceID,this.projection=i.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(i){let r=this.layers[0].getAppearances();if(!r||0===r.length)return!1;let a=Array.isArray(i)?i:[i];return r.some(i=>a.some(r=>i.hasLayoutProperty(r)))}getAppearanceFeatureData(i){return this.featureAppearanceData.get(i)}createArrays(){this.text=new me(new sH(this.layers,{zoom:this.zoom,lut:this.lut},i=>i.startsWith("text")||i.startsWith("symbol"))),this.icon=new me(new sH(this.layers,{zoom:this.zoom,lut:this.lut},i=>i.startsWith("icon")||i.startsWith("symbol"))),this.disableSymbolUBO||(this.text.uboBinder=new pp(this.layers[0],this.zoom,this.lut,!0,"",this.maxUniformBufferBindings,this.maxUniformBlockSizeDwords),this.icon.uboBinder=new pp(this.layers[0],this.zoom,this.lut,!1,"",this.maxUniformBufferBindings,this.maxUniformBlockSizeDwords)),this.glyphOffsetArray=new sl,this.lineVertexArray=new sh,this.symbolInstances=new ss}calculateGlyphDependencies(i,r,a,n,o){for(let a of i){let i=a.codePointAt(0);if(void 0===i)break;if(r[i]=!0,n&&o&&i<=65535){let i=pf[a];i&&(r[i.charCodeAt(0)]=!0)}}}calculateEffectiveAppearanceIconSize(i,r,a,n,o,s,l){if(!i.hasLayoutProperty("icon-size"))return l*s;let h=1,u=i.getUnevaluatedLayoutProperty("icon-size"),c=pZ(this.zoom,u,this.worldview,o),d=pX(c,r);if("constant"!==c.kind&&"camera"!==c.kind||(h=d.uSize),"composite"===c.kind){let{minZoom:i,maxZoom:r}=c,s=u.possiblyEvaluate(new n0(i,{worldview:this.worldview}),n),l=u.possiblyEvaluate(new n0(r,{worldview:this.worldview}),n),p=s.evaluate(a,{},n,o);h=p+(l.evaluate(a,{},n,o)-p)*d.uSizeT}return"source"===c.kind&&(h=u.possiblyEvaluate(new n0(this.zoom,{worldview:this.worldview}),n).evaluate(a,{},n,o)),h*s}updateFootprints(i,r){}updateReplacement(i,r){if(r.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=r.updateTime;let a=r.getReplacementRegionsForTile(i.toUnwrapped(),!0);return!uY(this.activeReplacements,a)&&(this.activeReplacements=a,!0)}getResolvedImageFromTokens(i){return"string"==typeof i?i1.build(i):i}populate(i,r,a,n){let o=this.layers[0],s=o.layout,l="globe"===this.projection.name,h=s.get("text-font"),u=s.get("text-field"),c=s.get("icon-image"),[d,p]=s.get("icon-size-scale-range"),f=tl(r.scaleFactor||1,d,p),[m,_]=s.get("text-size-scale-range"),g=tl(r.scaleFactor||1,m,_),y=("constant"!==u.value.kind||u.value.value instanceof iQ&&
7!u.value.value.isEmpty()||u.value.value.toString().length>0)&&("constant"!==h.value.kind||h.value.value.length>0),x="constant"!==c.value.kind||!!c.value.value||Object.keys(c.parameters).length>0,v=this.hasAnyAppearanceLayoutProperty("icon-image"),b=s.get("symbol-sort-key");if(this.features=[],this.featureAppearanceData=new Map,!y&&!x&&!v)return;let w=r.iconDependencies,T=r.glyphDependencies,S=r.availableImages,E=new n0(this.zoom,{worldview:this.worldview,activeFloors:r.activeFloors}),I=i=>{let r=i.id.toString();w.has(r)?w.get(r).push(i):w.set(r,[i])};for(let r of i){let i,u,{feature:c,id:d,index:p,sourceLayerIndex:m}=r,_=o._featureFilter.needGeometry,A=ls(c,_);if(!o._featureFilter.filter(E,A,a))continue;if(_||(A.geometry=lo(c,a,n)),l&&1!==c.type&&a.z<=5){let i=A.geometry,r=(i,r)=>.98078528056>eD(hl(i.x,i.y,a,1),hl(r.x,r.y,a,1));for(let a=0;a<i.length;a++)i[a]=function(i,r){let a=i[0],n=[a];for(let o=1;o<i.length;o++){let s=i[o];(function i(r,a,n,o){if(o(a,n)){let s=a.add(n)._mult(.5);i(r,a,s,o),i(r,s,n,o)}else r.push(n)})(n,a,s,r),a=s}return n}(i[a],r)}if(y){let r=o.getValueAndResolveTokens("text-field",A,a,S),n=iQ.factory(r);(function(i){for(let r of i.sections)if(function(i){for(let r of i)if(nj(r.charCodeAt(0)))return!0;return!1}(r.text))return!0;return!1})(n)&&(this.hasRTLText=!0),(!this.hasRTLText||"unavailable"===nY()||this.hasRTLText&&nK.isParsed())&&(i=function(i,r,a){return i.sections.forEach(i=>{i.text=function(i,r,a){let n=r.layout.get("text-transform").evaluate(a,{});return"uppercase"===n?i=i.toLocaleUpperCase():"lowercase"===n&&(i=i.toLocaleLowerCase()),nK.applyArabicShaping&&(i=nK.applyArabicShaping(i)),i}(i.text,r,a)}),i}(n,o,A))}if(x){let i=o.getValueAndResolveTokens("icon-image",A,a,S);u=this.getResolvedImageFromTokens(i)}let M=this.layers[0],C=!1;if(!u&&v){for(let i of M.getAppearances())if(i.getLayoutProperty("icon-image")){let r=M.getAppearanceValueAndResolveTokens(i,"icon-image",A,a,S);if(r){u=this.getResolvedImageFromTokens(r),C=!0;break}}}if(!i&&!u)continue;let P=this.sortFeaturesByKey?b.evaluate(A,{},a):void 0,D={id:d,text:i,icon:u,index:p,sourceLayerIndex:m,geometry:A.geometry,properties:c.properties,type:f3[c.type],sortKey:P};if(this.features.push(D),this.featureAppearanceData.set(p,{id:d,properties:c.properties,usesAppearanceIconAsPlaceholder:C}),u){let i=M._unevaluatedLayout._values,{iconPrimary:r,iconSecondary:n}=fA(u,this.iconSizeData,i["icon-size"],a,this.zoom,D,this.pixelRatio,f,this.worldview,S);I(r),n&&(this.hasAnySecondaryIcon=!0,I(n))}let R=M.getAppearances();if(0!==R.length&&R.forEach(i=>{if(!i.getLayoutProperty("icon-image"))return;let r=this.getCombinedIconPrimary(i,M,A,a,S,D,f);r&&I(r)}),i){let r=h.evaluate(A,{},a).join(","),n="map"===s.get("text-rotation-alignment")&&"point"!==s.get("symbol-placement");for(let a of(this.allowVerticalPlacement=this.writingModes&&this.writingModes.includes(pP.vertical),i.sections))if(a.image){let i=a.image.getPrimary().scaleSelf(this.pixelRatio*g),r=i.id.toString(),n=w.get(r)||[];n.push(i),w.set(r,n)}else{let o=nN(i.toString()),s=a.fontStack||r,l=T[s]=T[s]||{};this.calculateGlyphDependencies(a.text,l,n,this.allowVerticalPlacement,o)}}}if("line"===s.get("symbol-placement")&&(this.features=function(i){let r={},a={},n=[],o=0;function s(r){n.push(i[r]),o++}function l(i,r,o){let s=a[i];return delete a[i],a[r]=s,n[s].geometry[0].pop(),n[s].geometry[0]=n[s].geometry[0].concat(o[0]),s}function h(i,a,o){let s=r[a];return delete r[a],r[i]=s,n[s].geometry[0].shift(),n[s].geometry[0]=o[0].concat(n[s].geometry[0]),s}function u(i,r,a){let n=a?r[0].at(-1):r[0][0];return`${i}:${n.x}:${n.y}`}for(let c=0;c<i.length;c++){let d=i[c],p=d.geometry,f=d.text?d.text.toString():null;if(!f){s(c);continue}let m=u(f,p),_=u(f,p,!0);if(m in a&&_ in r&&a[m]!==r[_]){let i=h(m,_,p),o=l(m,_,n[i].geometry);delete r[m],delete a[_],a[u(f,n[o].geometry,!0)]=o,n[i].geometry=null}else m in a?l(m,_,p):_ in r?h(m,_,p):(s(c),r[m]=o-1,a[_]=o-1)}return n.filter(i=>i.geometry)}(this.features)),"hd-road-markup"===s.get("symbol-elevation-reference")){if(this.elevationType="road",r.elevationFeatures)for(let i of(!this.elevationFeatures&&r.elevationFeatures.length>0&&(this.elevationFeatures=[],this.elevationFeatureIdToIndex=new Map),r.elevationFeatures))this.elevationFeatureIdToIndex.set(i.id,this.elevationFeatures.length),this.elevationFeatures.push(i)}else s.get("symbol-z-elevate")&&(this.elevationType="offset");"none"!==this.elevationType&&(this.zOffsetBuffersNeedUpload=!0),this.sortFeaturesByKey&&this.features.sort((i,r)=>i.sortKey-r.sortKey)}getCombinedIconPrimary(i,r,a,n,o,s,l){let h,u;if(i.hasLayoutProperty("icon-image")){let s=r.getAppearanceValueAndResolveTokens(i,"icon-image",a,n,o);h=this.getResolvedImageFromTokens(s)}else{let i=r.getValueAndResolveTokens("icon-image",a,n,o);h=this.getResolvedImageFromTokens(i)}if(h){let a=i.hasLayoutProperty("icon-size")?i.getUnevaluatedLayoutProperty("icon-size"):r._unevaluatedLayout._values["icon-size"];u=fA(h,pZ(this.zoom,a,this.worldview,o),a,n,this.zoom,s,this.pixelRatio,l,this.worldview,o).iconPrimary}return u}updateSymbolInstanceIconVertices(i,r,a,n,o,s){let{canonical:l,availableImages:h,globalProperties:u,layer:c,iconScaleFactor:d,featureState:p,layoutIconOffset:f,layoutIconSize:m,layoutIconRotate:_}=s;if(i.placedIconSymbolIndex<0)return{vertexOffsetDelta:0,hasChanges:!1};if(r.activeAppearanceIndex===a)return{vertexOffsetDelta:i.numIconVertices,hasChanges:!1};let g=a>=0?c.appearances[a]:null;if(g){let a=this.getCombinedIconPrimary(g,c,n,l,h,{sortKey:void 0,text:void 0,icon:null,index:i.featureIndex,sourceLayerIndex:i.featureIndex,geometry:[],properties:r.properties,type:"Point",id:r.id},d);if(!a)return{vertexOffsetDelta:0,hasChanges:!1};let s=a.toString(),y=this.iconAtlasPositions&&this.iconAtlasPositions.get(s);if(y){let{appearanceIconOffset:a,appearanceIconRotate:s}=fT(g,c,n,l,f,_,m,d),x=pj(y,void 0,a,c.layout.get("icon-anchor").evaluate(n,p,l)),v=y.sdf,b=c.layout.get("icon-text-fit").constantOr("none");"none"!==b&&r.textShaping&&r.iconTextFitPadding&&r.fontScale&&(x=pG(x,r.textShaping,b,r.iconTextFitPadding,a,r.fontScale));
7let w=1+(Math.min(32640,Math.round(128*this.calculateEffectiveAppearanceIconSize(g,u.zoom,n,l,h,d,m)))<<1),T=fc(x,s,v,"none"!==b,d);r.isUsingAppearanceIconVertexData||(r.isUsingAppearanceIconVertexData=!0,r.layoutBasedIconVertexData=this.icon.snapshotSymbolVertexData(o,i.numIconVertices));let S=Math.floor(i.numIconVertices/4),E=Math.min(T.length,S),I=o;for(let a=0;a<E;++a){let n=T[a],o=r.layoutBasedIconVertexData[0]||i.tileAnchorX,s=r.layoutBasedIconVertexData[1]||i.tileAnchorY,l=16*n.pixelOffsetTL.x,h=16*n.pixelOffsetTL.y,u=16*n.pixelOffsetBR.x,c=16*n.pixelOffsetBR.y,d=16*n.minFontScaleX,p=16*n.minFontScaleY;this.icon.updateSymbolVertexData(I,o,s,Math.round(32*n.tl.x),Math.round(32*n.tl.y),n.texPrimary.x,n.texPrimary.y,0,w,l,h,d,p),this.icon.updateSymbolVertexData(I+1,o,s,Math.round(32*n.tr.x),Math.round(32*n.tr.y),n.texPrimary.x+n.texPrimary.w,n.texPrimary.y,0,w,u,h,d,p),this.icon.updateSymbolVertexData(I+2,o,s,Math.round(32*n.bl.x),Math.round(32*n.bl.y),n.texPrimary.x,n.texPrimary.y+n.texPrimary.h,0,w,l,c,d,p),this.icon.updateSymbolVertexData(I+3,o,s,Math.round(32*n.br.x),Math.round(32*n.br.y),n.texPrimary.x+n.texPrimary.w,n.texPrimary.y+n.texPrimary.h,0,w,u,c,d,p),I+=4}let A=i.numIconVertices-4*E;for(let i=0;i<A;++i)this.icon.updateSymbolVertexData(I+i,0,0,0,0,0,0,0,0,0,0,0,0);return{vertexOffsetDelta:i.numIconVertices,hasChanges:!0}}}else{if(r.usesAppearanceIconAsPlaceholder)return this.icon.updateSymbolVertexData(o,0,0,0,0,0,0,0,0,0,0,0,0),this.icon.updateSymbolVertexData(o+1,0,0,0,0,0,0,0,0,0,0,0,0),this.icon.updateSymbolVertexData(o+2,0,0,0,0,0,0,0,0,0,0,0,0),this.icon.updateSymbolVertexData(o+3,0,0,0,0,0,0,0,0,0,0,0,0),{vertexOffsetDelta:i.numIconVertices,hasChanges:!0};if(r.isUsingAppearanceIconVertexData)return this.icon.restoreSymbolVertexData(o,r.layoutBasedIconVertexData),r.isUsingAppearanceIconVertexData=!1,{vertexOffsetDelta:r.layoutBasedIconVertexData.length/12,hasChanges:!0}}return{vertexOffsetDelta:i.numIconVertices,hasChanges:!1}}updateSymbolInstanceTextVertices(i,r,a,n,o,s){let{canonical:l,layer:h,textScaleFactor:u,imageMap:c,featureState:d,layoutTextOffset:p,layoutTextSize:f,layoutTextRotate:m,layoutMinZoomSize:_,layoutMaxZoomSize:g,layoutTextSizeMinZoom:y,layoutTextSizeMaxZoom:x,availableImages:v}=s,b=i.numHorizontalGlyphVertices>0||i.numVerticalGlyphVertices>0;if(!b)return{vertexOffsetDelta:b?i.numHorizontalGlyphVertices+i.numVerticalGlyphVertices:0,hasChanges:!1};if(r.activeAppearanceIndex===a)return{vertexOffsetDelta:i.numHorizontalGlyphVertices+i.numVerticalGlyphVertices,hasChanges:!1};let w=a>=0?h.appearances[a]:null;if(w&&r.textShaping){let{appearanceTextOffset:a,appearanceTextRotate:s,appearanceTextSize:b}=fS(w,h,n,l,p,m,f);r.fontScale=b*r.textScaleFactor/24;let T=w.getUnevaluatedLayoutProperty("text-size"),S=this.textSizeData,E=y,I=x;w.hasLayoutProperty("text-size")&&(S=pZ(this.zoom,T,this.worldview,v),E="composite"===this.textSizeData.kind?this.textSizeData.minZoom:0,I="composite"===this.textSizeData.kind?this.textSizeData.maxZoom:0);let A=r.textShaping.bottom-p[1],M=r.textShaping.left-p[0],C=r.textShaping.right-p[0];r.textShaping.top=a[1]+(r.textShaping.top-p[1]),r.textShaping.bottom=a[1]+A,r.textShaping.left=a[0]+M,r.textShaping.right=a[0]+C;let P=fm(0,r.textShaping,a,h,!1,n,c,this.allowVerticalPlacement,s),D=b&&"composite"===S.kind?T.possiblyEvaluate(new n0(E,{}),l).evaluate(n,d,l):_,R=b&&"composite"===S.kind?T.possiblyEvaluate(new n0(I,{}),l).evaluate(n,d,l):g,z=fR(w.name,S,b,u,D,R),L=1+(Math.min(32640,Math.round((Array.isArray(z)?z[1]:b)*128))<<1);r.isUsingAppearanceTextVertexData||(r.isUsingAppearanceTextVertexData=!0,r.layoutBasedTextVertexData=this.text.snapshotSymbolVertexData(o,i.numHorizontalGlyphVertices+i.numVerticalGlyphVertices));for(let r=0;r<P.length&&r<(i.numHorizontalGlyphVertices+i.numVerticalGlyphVertices)/4;++r){let a=P[r],n=a.glyphOffset[1],s=i.tileAnchorX,l=i.tileAnchorY,h=o+4*r;this.text.updateSymbolVertexData(h,s,l,Math.round(32*a.tl.x),Math.round(32*(n+a.tl.y)),a.texPrimary.x,a.texPrimary.y,0,L,a.pixelOffsetTL.x,a.pixelOffsetTL.y,a.minFontScaleX,a.minFontScaleY),this.text.updateSymbolVertexData(h+1,s,l,Math.round(32*a.tr.x),Math.round(32*(n+a.tr.y)),a.texPrimary.x+a.texPrimary.w,a.texPrimary.y,0,L,a.pixelOffsetBR.x,a.pixelOffsetTL.y,a.minFontScaleX,a.minFontScaleY),this.text.updateSymbolVertexData(h+2,s,l,Math.round(32*a.bl.x),Math.round(32*(n+a.bl.y)),a.texPrimary.x,a.texPrimary.y+a.texPrimary.h,0,L,a.pixelOffsetTL.x,a.pixelOffsetBR.y,a.minFontScaleX,a.minFontScaleY),this.text.updateSymbolVertexData(h+3,s,l,Math.round(32*a.br.x),Math.round(32*(n+a.br.y)),a.texPrimary.x+a.texPrimary.w,a.texPrimary.y+a.texPrimary.h,0,L,a.pixelOffsetBR.x,a.pixelOffsetBR.y,a.minFontScaleX,a.minFontScaleY)}return{vertexOffsetDelta:i.numHorizontalGlyphVertices+i.numVerticalGlyphVertices,hasChanges:!0}}return r.isUsingAppearanceTextVertexData?(this.text.restoreSymbolVertexData(o,r.layoutBasedTextVertexData),r.isUsingAppearanceTextVertexData=!1,{vertexOffsetDelta:r.layoutBasedTextVertexData.length/12,hasChanges:!0}):{vertexOffsetDelta:i.numHorizontalGlyphVertices+i.numVerticalGlyphVertices,hasChanges:!1}}updateExpressions(i){this.text&&this.text.programConfigurations.updateExpressions(i),this.icon&&this.icon.programConfigurations.updateExpressions(i)}update(i,r,a,n,o,s,l,h){if(this.text.uboBinder||this.text.programConfigurations.updatePaintArrays(i,r,o,a,n,s,l,this.worldview),this.icon.uboBinder||this.icon.programConfigurations.updatePaintArrays(i,r,o,a,n,s,l,this.worldview),h){if(s)this.text.uboBinder&&!this.text.uboBinder.isLightConstant&&this.text.uboBinder.updateDynamicExpressions(o[0],r,h,a,i,l),this.icon.uboBinder&&!this.icon.uboBinder.isLightConstant&&this.icon.uboBinder.updateDynamicExpressions(o[0],r,h,a,i,l);else if(Object.keys(i).length>0){let n=new Set(Object.keys(i).map(i=>{let r=Number(i);return!isNaN(r)&&Number.isSafeInteger(r)&&String(r)===i?r:i}));this.text.uboBinder&&this.text.uboBinder.updateFeatures(n,o[0],r,h,a,i,l),this.icon.uboBinder&&this.icon.uboBinder.updateFeatures(n,o[0],r,h,a,i,l)}}}updateRoadElevation(i){if("road"!==this.elevationType||!this.elevationFeatures||this.elevationStateComplete)return;this.elevationStateComplete=!0,this.hasAnyZOffset=!1;let r=!1,a=li(i),n=1/a,o=!1,s=!1;for(let i=0;i<this.symbolInstances.length;i++){let l=this.symbolInstances.get(i),h=eg(1,0,0),u=eg(0,1,0),{numHorizontalGlyphVertices:c,numVerticalGlyphVertices:d,numIconVertices:p,numVerticalIconVertices:f}=l,m=c>0||d>0,_=p>0,g=this.elevationFeatures[l.elevationFeatureIndex];if(g){let i=new e8(l.tileAnchorX,l.tileAnchorY),c=.075+g.pointElevation(i);l.zOffset!==c&&(r=!0,l.zOffset=c),0!==c&&(this.hasAnyZOffset=!0);let d=g.computeSlopeNormal(i,n),p=eY(eG(),eg(0,0,1),d);eO(h,h,p),eO(u,u,p),h[2]*=a,u[2]*=a,1===h[0]&&0===h[1]&&0===h[2]&&0===u[0]&&1===u[1]&&0===u[2]||(o=o||m,s=s||_)}if(m&&(f9(this.text.orientationVertexArray,c,h,u),f9(this.text.orientationVertexArray,d,h,u)),_){let{placedIconSymbolIndex:i,verticalPlacedIconSymbolIndex:r}=l;i>=0&&f9(this.icon.orientationVertexArray,p,h,u),r>=0&&f9(this.icon.orientationVertexArray,f,h,u)}}o||(this.text.orientationVertexArray=void 0),s||(this.icon.orientationVertexArray=void 0),r&&(this.zOffsetBuffersNeedUpload=!0,this.zOffsetSortDirty=!0)}updateZOffset(){let i=(i,r,n)=>{(a+=r)>i.length&&i.resize(a);for(let o=-r;o<0;o++)i.emplace(o+a,n)},r=(i,r,a)=>{(n+=r)>i.length&&i.resize(n);for(let o=-r;o<0;o++)i.emplace(o+n,a)};if(!this.zOffsetBuffersNeedUpload)return;this.zOffsetBuffersNeedUpload=!1;let a=0,n=0;for(let a=0;a<this.symbolInstances.length;a++){let n=this.symbolInstances.get(a),{numHorizontalGlyphVertices:o,numVerticalGlyphVertices:s,numIconVertices:l}=n,h=n.zOffset,u=l>0;if((o>0||s>0)&&(i(this.text.zOffsetVertexArray,o,h),i(this.text.zOffsetVertexArray,s,h)),u){let{placedIconSymbolIndex:i,verticalPlacedIconSymbolIndex:a}=n;i>=0&&r(this.icon.zOffsetVertexArray,l,h),a>=0&&r(this.icon.zOffsetVertexArray,n.numVerticalIconVertices,h)}}this.text.zOffsetVertexBuffer&&this.text.zOffsetVertexBuffer.updateData(this.text.zOffsetVertexArray),this.icon.zOffsetVertexBuffer&&this.icon.zOffsetVertexBuffer.updateData(this.icon.zOffsetVertexArray)}isEmpty(){return 0===this.symbolInstances.length&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(i,r,a,n,o){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(i),this.iconCollisionBox.upload(i)),this.text.upload(i,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload,this.hasAppearances),null===this.hasAppearances&&(this.hasAppearances=this.layers.some(i=>i.appearances&&i.appearances.length>0)),this.icon.upload(i,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload,this.hasAppearances),this.uploaded=!0}updateAppearances(i,r,a,n,o,s=!1){let l={hasLayoutChanges:!1,hasUboChanges:!1};if(!i||!a||!this.featureAppearanceData)return l;let h=r||{},u=this.icon.layoutVertexArray&&this.icon.layoutVertexArray.length>0&&this.icon.layoutVertexArray.arrayBuffer,c=this.text.layoutVertexArray&&this.text.layoutVertexArray.length>0&&this.text.layoutVertexArray.arrayBuffer;if(!u&&!c)return l;let d=this.layers[0],p=d.layout;this.featureAppearances&&this.featureAppearances.appearancesVersion===d.appearancesVersion||(this.featureAppearances=new f2(d.appearances,d.appearancesVersion));let f=this.featureAppearances.update(n,s);if("no-changes"===f.kind)return l;let m=1,_=0,g=!1,y=!1;if(u){let[i,r]=p.get("icon-size-scale-range");m=tl(1,i,r)}let x=1,v=0,b=!1;
7if(c){let[i,r]=p.get("text-size-scale-range");x=tl(1,i,r)}let w=new Map;if(o&&a)for(let i of a){let r=o.getImage(i,d.scope);if(r){let a=new i0(i.toString());w.set(a.toString(),r)}}for(let r=0;r<this.symbolInstances.length;r++){let o,s=this.symbolInstances.get(r),l=this.getAppearanceFeatureData(s.featureIndex);if(!l)continue;let T=l.id,S=void 0!==T?h[String(T)]:void 0,E={type:"Point",id:l.id,properties:l.properties,geometry:[]};if("all-features"===f.kind)o=f.appearanceIndex;else{let r=d.appearances?d.appearances.findIndex(r=>r.isActive({globals:n,feature:E,canonical:i,featureState:S})):-1;o=r>=0?r:-1}let I=l.activeAppearanceIndex!==o;if(c){let r=p.get("text-size"),n="composite"===this.textSizeData.kind?this.textSizeData.minZoom:0,h="composite"===this.textSizeData.kind?this.textSizeData.maxZoom:0,u={canonical:i,layer:d,featureState:S,availableImages:a,textScaleFactor:x,imageMap:w,layoutTextOffset:p.get("text-offset").evaluate(E,S,i).map(i=>24*i),layoutTextSize:r.evaluate(E,S,i),layoutTextRotate:p.get("text-rotate").evaluate(E,S,i),layoutMinZoomSize:r.evaluate(E,{zoom:n},i),layoutMaxZoomSize:r.evaluate(E,{zoom:h},i),layoutTextSizeMinZoom:n,layoutTextSizeMaxZoom:h},c=this.updateSymbolInstanceTextVertices(s,l,o,E,v,u);v+=c.vertexOffsetDelta,b=b||c.hasChanges}if(u){let r={canonical:i,layer:d,featureState:S,availableImages:a,globalProperties:n,iconScaleFactor:m,layoutIconOffset:p.get("icon-offset").evaluate(E,S,i),layoutIconSize:p.get("icon-size").evaluate(E,S,i,a),layoutIconRotate:p.get("icon-rotate").evaluate(E,S,i)},h=this.updateSymbolInstanceIconVertices(s,l,o,E,_,r);_+=h.vertexOffsetDelta,g=g||h.hasChanges}if(I){let r=s.featureIndex,l=n?n.brightness:null,h=S||{},u=o>=0?d.appearances[o]:null;this.text.uboBinder&&(this.text.uboBinder.layer=d,y=this.text.uboBinder.updateFeaturePaintForAppearance(r,E,h,i,a,l,u)||y),this.icon.uboBinder&&(this.icon.uboBinder.layer=d,y=this.icon.uboBinder.updateFeaturePaintForAppearance(r,E,h,i,a,l,u)||y)}l.activeAppearanceIndex=o}return g&&this.icon.layoutVertexBuffer&&null!==this.icon.layoutVertexArray.arrayBuffer&&this.icon.layoutVertexArray.length===this.icon.layoutVertexBuffer.length&&this.icon.layoutVertexBuffer.updateData(this.icon.layoutVertexArray),b&&this.text.layoutVertexBuffer&&null!==this.text.layoutVertexArray.arrayBuffer&&this.text.layoutVertexArray.length===this.text.layoutVertexBuffer.length&&this.text.layoutVertexBuffer.updateData(this.text.layoutVertexArray),{hasLayoutChanges:g||b,hasUboChanges:y}}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}getProjection(){return this.projectionInstance||(this.projectionInstance=f1(this.projection)),this.projectionInstance}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(i,r){let a=this.lineVertexArray.length;if(void 0!==i.segment)for(let{x:i,y:a}of r)this.lineVertexArray.emplaceBack(i,a);return{lineStartIndex:a,lineLength:this.lineVertexArray.length-a}}addSymbols(i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x){let v=i.indexArray,b=i.layoutVertexArray,w=i.globeExtVertexArray,T=i.uboBinder?i.uboBinder.getCurrentBatchIndex():void 0,S=i.segments.prepareSegment(4*x,b,v,this.canOverlap?s.sortKey:void 0,T),E=this.glyphOffsetArray.length,I=S.vertexLength,A=this.allowVerticalPlacement&&l===pP.vertical?Math.PI/2:0,M=s.text&&s.text.sections,C=b.length,P=-1;for(let n=0;n<r.length;n++){let{tl:o,tr:l,bl:c,br:d,texPrimary:p,texSecondary:y,pixelOffsetTL:x,pixelOffsetBR:T,minFontScaleX:E,minFontScaleY:I,glyphOffset:D,isSDF:R,sectionIndex:z}=r[n],L=S.vertexLength,F=D[1];if(f4(b,u.x,u.y,o.x,F+o.y,p.x,p.y,a,R,x.x,x.y,E,I),f4(b,u.x,u.y,l.x,F+l.y,p.x+p.w,p.y,a,R,T.x,x.y,E,I),f4(b,u.x,u.y,c.x,F+c.y,p.x,p.y+p.h,a,R,x.x,T.y,E,I),f4(b,u.x,u.y,d.x,F+d.y,p.x+p.w,p.y+p.h,a,R,T.x,T.y,E,I),h){let{x:r,y:a,z:n}=h.anchor,[o,s,l]=h.up;f8(w,r,a,n,o,s,l),f8(w,r,a,n,o,s,l),f8(w,r,a,n,o,s,l),f8(w,r,a,n,o,s,l),f7(i.dynamicLayoutVertexArray,r,a,n,A)}else f7(i.dynamicLayoutVertexArray,u.x,u.y,u.z,A);if(g){let r=y||p;f6(i.iconTransitioningVertexArray,r.x,r.y),f6(i.iconTransitioningVertexArray,r.x+r.w,r.y),f6(i.iconTransitioningVertexArray,r.x,r.y+r.h),f6(i.iconTransitioningVertexArray,r.x+r.w,r.y+r.h)}if(v.emplaceBack(L,L+1,L+2),v.emplaceBack(L+1,L+2,L+3),S.vertexLength+=4,S.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(D[0]),(n===r.length-1||z!==r[n+1].sectionIndex)&&(i.uboBinder||i.programConfigurations.populatePaintArrays(b.length,s,s.index,{},f,m,_,M&&M[z],this.worldview),i.uboBinder&&i.featureIdArray)){let r=i.uboBinder.populateUBO(s,s.index,m,f,_,M&&M[z],void 0);P=r;let a=b.length-C;for(let n=0;n<a;n++)i.featureIdArray.emplaceBack(r);C=b.length}}let D=x-r.length;if(0!==D&&(this._addNullVertices(D,b,a,h,w,i,g,S,v),i.uboBinder&&i.featureIdArray&&P>=0)){let r=4*D;for(let a=0;a<r;a++)i.featureIdArray.emplaceBack(P)}
7let R=h?h.anchor:u;i.placedSymbolArray.emplaceBack(R.x,R.y,R.z,u.x,u.y,E,this.glyphOffsetArray.length-E,I,c,d,u.segment,a?a[0]:0,a?a[1]:0,n[0],n[1],l,0,0,0,p,0),i.symbolInstanceIndices.push(y)}_addNullVertices(i,r,a,n,o,s,l,h,u){for(let c=0;c<i;c++){for(let i=0;i<4;i++)f4(r,0,0,0,0,0,0,a,!1,0,0,0,0),n&&f8(o,0,0,0,0,0,0),f7(s.dynamicLayoutVertexArray,0,0,0,0),l&&f6(s.iconTransitioningVertexArray,0,0);let i=h.vertexLength;u.emplaceBack(i,i+1,i+2),u.emplaceBack(i+1,i+2,i+3),h.vertexLength+=4,h.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(0)}}_commitLayoutVertex(i,r,a,n,o,s,l){i.emplaceBack(r,a,n,o,s,Math.round(l.x),Math.round(l.y))}_addCollisionDebugVertices(i,r,a,n,o,s,l){let h=a.segments.prepareSegment(4,a.layoutVertexArray,a.indexArray),u=h.vertexLength,c=l.tileAnchorX,d=l.tileAnchorY;for(let i=0;i<4;i++)a.collisionVertexArray.emplaceBack(0,0,0,0,0,0);this._commitDebugCollisionVertexUpdate(a.collisionVertexArrayExt,r,i.padding,l.zOffset),this._commitLayoutVertex(a.layoutVertexArray,n,o,s,c,d,new e8(i.x1,i.y1)),this._commitLayoutVertex(a.layoutVertexArray,n,o,s,c,d,new e8(i.x2,i.y1)),this._commitLayoutVertex(a.layoutVertexArray,n,o,s,c,d,new e8(i.x2,i.y2)),this._commitLayoutVertex(a.layoutVertexArray,n,o,s,c,d,new e8(i.x1,i.y2)),h.vertexLength+=4;let p=a.indexArray;p.emplaceBack(u,u+1),p.emplaceBack(u+1,u+2),p.emplaceBack(u+2,u+3),p.emplaceBack(u+3,u),h.primitiveLength+=4}_addTextDebugCollisionBoxes(i,r,a,n,o,s){for(let l=n;l<o;l++){let n=a.get(l),o=this.getSymbolInstanceTextSize(i,s,r,l);this._addCollisionDebugVertices(n,o,this.textCollisionBox,n.projectedAnchorX,n.projectedAnchorY,n.projectedAnchorZ,s)}}_addIconDebugCollisionBoxes(i,r,a,n,o,s){for(let l=n;l<o;l++){let n=a.get(l),o=this.getSymbolInstanceIconSize(i,r,s.placedIconSymbolIndex);this._addCollisionDebugVertices(n,o,this.iconCollisionBox,n.projectedAnchorX,n.projectedAnchorY,n.projectedAnchorZ,s)}}generateCollisionDebugBuffers(i,r,a){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new mt(oW,ph.members,oq),this.iconCollisionBox=new mt(oW,ph.members,oq);let n=pX(this.iconSizeData,i),o=pX(this.textSizeData,i,a);for(let a=0;a<this.symbolInstances.length;a++){let s=this.symbolInstances.get(a);this._addTextDebugCollisionBoxes(o,i,r,s.textBoxStartIndex,s.textBoxEndIndex,s),this._addTextDebugCollisionBoxes(o,i,r,s.verticalTextBoxStartIndex,s.verticalTextBoxEndIndex,s),this._addIconDebugCollisionBoxes(n,i,r,s.iconBoxStartIndex,s.iconBoxEndIndex,s),this._addIconDebugCollisionBoxes(n,i,r,s.verticalIconBoxStartIndex,s.verticalIconBoxEndIndex,s)}}getSymbolInstanceTextSize(i,r,a,n){let o=this.text.placedSymbolArray.get(r.rightJustifiedTextSymbolIndex>=0?r.rightJustifiedTextSymbolIndex:r.centerJustifiedTextSymbolIndex>=0?r.centerJustifiedTextSymbolIndex:r.leftJustifiedTextSymbolIndex>=0?r.leftJustifiedTextSymbolIndex:r.verticalPlacedTextSymbolIndex>=0?r.verticalPlacedTextSymbolIndex:n),s=pW(this.textSizeData,i,o)/24;return this.tilePixelRatio*s}getSymbolInstanceIconSize(i,r,a){let n=this.icon.placedSymbolArray.get(a),o=pW(this.iconSizeData,i,n);return this.tilePixelRatio*o}_commitDebugCollisionVertexUpdate(i,r,a,n){i.emplaceBack(r,-a,-a,n),i.emplaceBack(r,a,-a,n),i.emplaceBack(r,a,a,n),i.emplaceBack(r,-a,a,n)}_updateTextDebugCollisionBoxes(i,r,a,n,o,s,l){for(let l=n;l<o;l++){let n=a.get(l),o=this.getSymbolInstanceTextSize(i,s,r,l);this._commitDebugCollisionVertexUpdate(this.textCollisionBox.collisionVertexArrayExt,o,n.padding,s.zOffset)}}_updateIconDebugCollisionBoxes(i,r,a,n,o,s,l){for(let l=n;l<o;l++){let n=a.get(l),o=this.getSymbolInstanceIconSize(i,r,s.placedIconSymbolIndex);this._commitDebugCollisionVertexUpdate(this.iconCollisionBox.collisionVertexArrayExt,o,n.padding,s.zOffset)}}updateCollisionDebugBuffers(i,r,a,n){if(!this.hasDebugData())return;this.hasTextCollisionBoxData()&&this.textCollisionBox.collisionVertexArrayExt.clear(),this.hasIconCollisionBoxData()&&this.iconCollisionBox.collisionVertexArrayExt.clear();let o=pX(this.iconSizeData,i,n),s=pX(this.textSizeData,i,a);for(let l=0;l<this.symbolInstances.length;l++){let h=this.symbolInstances.get(l);this._updateTextDebugCollisionBoxes(s,i,r,h.textBoxStartIndex,h.textBoxEndIndex,h,a),this._updateTextDebugCollisionBoxes(s,i,r,h.verticalTextBoxStartIndex,h.verticalTextBoxEndIndex,h,a),this._updateIconDebugCollisionBoxes(o,i,r,h.iconBoxStartIndex,h.iconBoxEndIndex,h,n),this._updateIconDebugCollisionBoxes(o,i,r,h.verticalIconBoxStartIndex,h.verticalIconBoxEndIndex,h,n)}this.hasTextCollisionBoxData()&&this.textCollisionBox.collisionVertexBufferExt&&this.textCollisionBox.collisionVertexBufferExt.updateData(this.textCollisionBox.collisionVertexArrayExt),this.hasIconCollisionBoxData()&&this.iconCollisionBox.collisionVertexBufferExt&&this.iconCollisionBox.collisionVertexBufferExt.updateData(this.iconCollisionBox.collisionVertexArrayExt)}_deserializeCollisionBoxesForSymbol(i,r,a,n,o,s,l,h,u){let c={};if(r<a){let{x1:a,y1:n,x2:o,y2:s,padding:l,projectedAnchorX:h,projectedAnchorY:u,projectedAnchorZ:d,tileAnchorX:p,tileAnchorY:f,featureIndex:m}=i.get(r);c.textBox={x1:a,y1:n,x2:o,y2:s,padding:l,projectedAnchorX:h,projectedAnchorY:u,projectedAnchorZ:d,tileAnchorX:p,tileAnchorY:f},c.textFeatureIndex=m}if(n<o){let{x1:r,y1:a,x2:o,y2:s,padding:l,projectedAnchorX:h,projectedAnchorY:u,projectedAnchorZ:d,tileAnchorX:p,tileAnchorY:f,featureIndex:m}=i.get(n);c.verticalTextBox={x1:r,y1:a,x2:o,y2:s,padding:l,projectedAnchorX:h,projectedAnchorY:u,projectedAnchorZ:d,tileAnchorX:p,tileAnchorY:f},c.verticalTextFeatureIndex=m}if(s<l){let{x1:r,y1:a,x2:n,y2:o,padding:l,projectedAnchorX:h,projectedAnchorY:u,projectedAnchorZ:d,tileAnchorX:p,tileAnchorY:f,featureIndex:m}=i.get(s);c.iconBox={x1:r,y1:a,x2:n,y2:o,padding:l,projectedAnchorX:h,projectedAnchorY:u,projectedAnchorZ:d,tileAnchorX:p,tileAnchorY:f},c.iconFeatureIndex=m}if(h<u){let{x1:r,y1:a,x2:n,y2:o,padding:s,projectedAnchorX:l,projectedAnchorY:u,projectedAnchorZ:d,tileAnchorX:p,tileAnchorY:f,featureIndex:m}=i.get(h);c.verticalIconBox={x1:r,y1:a,x2:n,y2:o,padding:s,projectedAnchorX:l,projectedAnchorY:u,projectedAnchorZ:d,tileAnchorX:p,tileAnchorY:f},c.verticalIconFeatureIndex=m}return c}deserializeCollisionBoxes(i){this.collisionArrays=[];for(let r=0;r<this.symbolInstances.length;r++){let a=this.symbolInstances.get(r);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(i,a.textBoxStartIndex,a.textBoxEndIndex,a.verticalTextBoxStartIndex,a.verticalTextBoxEndIndex,a.iconBoxStartIndex,a.iconBoxEndIndex,a.verticalIconBoxStartIndex,a.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(i,r){let a=i.placedSymbolArray.get(r),n=a.vertexStartIndex+4*a.numGlyphs;for(let r=a.vertexStartIndex;r<n;r+=4)i.indexArray.emplaceBack(r,r+1,r+2),i.indexArray.emplaceBack(r+1,r+2,r+3)}
7getSortedSymbolIndexes(i){if(this.sortedAngle===i&&void 0!==this.symbolInstanceIndexes)return this.symbolInstanceIndexes;let r=Math.sin(i),a=Math.cos(i),n=[],o=[],s=[];for(let i=0;i<this.symbolInstances.length;++i){s.push(i);let l=this.symbolInstances.get(i);n.push(0|Math.round(r*l.tileAnchorX+a*l.tileAnchorY)),o.push(l.featureIndex)}return s.sort((i,r)=>n[i]-n[r]||o[r]-o[i]),s}getSortedIndexesByZOffset(){if(!this.zOffsetSortDirty)return this.symbolInstanceIndexesSortedZOffset;if(!this.symbolInstanceIndexesSortedZOffset){this.symbolInstanceIndexesSortedZOffset=[];for(let i=0;i<this.symbolInstances.length;++i)this.symbolInstanceIndexesSortedZOffset.push(i)}return this.zOffsetSortDirty=!1,this.symbolInstanceIndexesSortedZOffset.sort((i,r)=>this.symbolInstances.get(r).zOffset-this.symbolInstances.get(i).zOffset)}addToSortKeyRanges(i,r){let a=this.sortKeyRanges.at(-1);a&&a.sortKey===r?a.symbolInstanceEnd=i+1:this.sortKeyRanges.push({sortKey:r,symbolInstanceStart:i,symbolInstanceEnd:i+1})}sortFeatures(i){if(this.sortFeaturesByY&&this.sortedAngle!==i)if(this.text.segments.get().length>1||this.icon.segments.get().length>1)this.sortFeaturesWithinSegments();else{for(let r of(this.symbolInstanceIndexes=this.getSortedSymbolIndexes(i),this.sortedAngle=i,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[],this.symbolInstanceIndexes)){let i=this.symbolInstances.get(r);this.featureSortOrder.push(i.featureIndex);let{rightJustifiedTextSymbolIndex:a,centerJustifiedTextSymbolIndex:n,leftJustifiedTextSymbolIndex:o,verticalPlacedTextSymbolIndex:s,placedIconSymbolIndex:l,verticalPlacedIconSymbolIndex:h}=i;a>=0&&this.addIndicesForPlacedSymbol(this.text,a),n>=0&&n!==a&&this.addIndicesForPlacedSymbol(this.text,n),o>=0&&o!==n&&o!==a&&this.addIndicesForPlacedSymbol(this.text,o),s>=0&&this.addIndicesForPlacedSymbol(this.text,s),l>=0&&this.addIndicesForPlacedSymbol(this.icon,l),h>=0&&this.addIndicesForPlacedSymbol(this.icon,h)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}getOrCreateSortedSymbolsByBatch(i,r){let a=(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(let a of this.symbolsByBatch.values())for(let n of a){let a=this.symbolInstances.get(n.index);n.rotatedY=0|Math.round(i*a.tileAnchorX+r*a.tileAnchorY)}else{this.symbolsByBatch=new Map;for(let n=0;n<this.symbolInstances.length;n++){let o=this.symbolInstances.get(n),s=Math.floor(n/a),l=0|Math.round(i*o.tileAnchorX+r*o.tileAnchorY);this.symbolsByBatch.has(s)||this.symbolsByBatch.set(s,[]),this.symbolsByBatch.get(s).push({index:n,rotatedY:l,featureIndex:o.featureIndex})}}for(let i of this.symbolsByBatch.values())i.sort((i,r)=>i.rotatedY-r.rotatedY||r.featureIndex-i.featureIndex);return this.symbolsByBatch}rebuildTextSegmentIndices(i,r){for(let a of i){let i=a.batchIndex;if(void 0===i)continue;let n=r.get(i);if(!n){a.primitiveOffset=this.text.indexArray.length,a.primitiveLength=0;continue}a.primitiveOffset=this.text.indexArray.length;let o=this.text.indexArray.length;for(let{index:i}of n){let{rightJustifiedTextSymbolIndex:r,centerJustifiedTextSymbolIndex:a,leftJustifiedTextSymbolIndex:n,verticalPlacedTextSymbolIndex:o}=this.symbolInstances.get(i);r>=0&&this.addIndicesForPlacedSymbol(this.text,r),a>=0&&a!==r&&this.addIndicesForPlacedSymbol(this.text,a),n>=0&&n!==a&&n!==r&&this.addIndicesForPlacedSymbol(this.text,n),o>=0&&this.addIndicesForPlacedSymbol(this.text,o)}a.primitiveLength=this.text.indexArray.length-o}}rebuildIconSegmentIndices(i,r){for(let a of i){let i=a.batchIndex;if(void 0===i)continue;let n=r.get(i);if(!n){a.primitiveOffset=this.icon.indexArray.length,a.primitiveLength=0;continue}a.primitiveOffset=this.icon.indexArray.length;let o=this.icon.indexArray.length;for(let{index:i}of n){let{placedIconSymbolIndex:r,verticalPlacedIconSymbolIndex:a}=this.symbolInstances.get(i);r>=0&&this.addIndicesForPlacedSymbol(this.icon,r),a>=0&&this.addIndicesForPlacedSymbol(this.icon,a)}a.primitiveLength=this.icon.indexArray.length-o}}sortFeaturesWithinSegments(){this.featureSortOrder=[];let i=Math.sin(this.sortedAngle),r=Math.cos(this.sortedAngle),a=this.getOrCreateSortedSymbolsByBatch(i,r);for(let i of Array.from(a.keys()).sort((i,r)=>i-r))for(let{index:r}of a.get(i)){let i=this.symbolInstances.get(r);this.featureSortOrder.push(i.featureIndex)}this.text.indexArray.clear(),this.icon.indexArray.clear(),this.rebuildTextSegmentIndices(this.text.segments.get(),a),this.rebuildIconSegmentIndices(this.icon.segments.get(),a),this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}getElevationFeatureForText(i){let r,a=this.symbolInstances.get(this.text.symbolInstanceIndices[i]).elevationFeatureIndex;return this.elevationFeatures&&a<this.elevationFeatures.length&&(r=this.elevationFeatures[a]),r}}function mr(i,r){return r.replace(/{([^{}]+)}/g,(r,a)=>
vendor: 6,323 bytes, line 7
7a in i?String(i[a]):"")}nl(mi,"SymbolBucket",{omit:["layers","collisionBoxArray","compareText","features"]}),mi.addDynamicAttributes=f7;class ma{constructor(i){this.type=i.property.overrides?i.property.overrides.runtimeType:iL,this.defaultValue=i}evaluate(i){if(i.formattedSection){let r=this.defaultValue.property.overrides;if(r&&r.hasOverride(i.formattedSection))return r.getOverride(i.formattedSection)}return i.feature&&i.featureState?this.defaultValue.evaluate(i.feature,i.featureState):this.defaultValue.property.specification.default}eachChild(i){this.defaultValue.isConstant()||i(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}nl(ma,"FormatSectionOverride",{omit:["defaultValue"]});let mn=()=>F||(F={layout:z||(z=new oi({"symbol-placement":new n7(or.layout_symbol["symbol-placement"]),"symbol-spacing":new n7(or.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new n7(or.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new oe(or.layout_symbol["symbol-sort-key"]),"symbol-z-order":new n7(or.layout_symbol["symbol-z-order"]),"symbol-z-elevate":new n7(or.layout_symbol["symbol-z-elevate"]),"symbol-elevation-reference":new n7(or.layout_symbol["symbol-elevation-reference"]),"icon-allow-overlap":new n7(or.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new n7(or.layout_symbol["icon-ignore-placement"]),"icon-optional":new n7(or.layout_symbol["icon-optional"]),"icon-rotation-alignment":new n7(or.layout_symbol["icon-rotation-alignment"]),"icon-size":new oe(or.layout_symbol["icon-size"]),"icon-size-scale-range":new n7(or.layout_symbol["icon-size-scale-range"]),"icon-text-fit":new oe(or.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new oe(or.layout_symbol["icon-text-fit-padding"]),"icon-image":new oe(or.layout_symbol["icon-image"]),"icon-image-use-theme":new n7({type:"string",default:"default","property-type":"data-constant"}),"icon-rotate":new oe(or.layout_symbol["icon-rotate"]),"icon-padding":new n7(or.layout_symbol["icon-padding"]),"icon-keep-upright":new n7(or.layout_symbol["icon-keep-upright"]),"icon-offset":new oe(or.layout_symbol["icon-offset"]),"icon-anchor":new oe(or.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new n7(or.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new n7(or.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new n7(or.layout_symbol["text-rotation-alignment"]),"text-field":new oe(or.layout_symbol["text-field"]),"text-font":new oe(or.layout_symbol["text-font"]),"text-size":new oe(or.layout_symbol["text-size"]),"text-size-scale-range":new n7(or.layout_symbol["text-size-scale-range"]),"text-max-width":new oe(or.layout_symbol["text-max-width"]),"text-line-height":new oe(or.layout_symbol["text-line-height"]),"text-letter-spacing":new oe(or.layout_symbol["text-letter-spacing"]),"text-justify":new oe(or.layout_symbol["text-justify"]),"text-radial-offset":new oe(or.layout_symbol["text-radial-offset"]),"text-variable-anchor":new n7(or.layout_symbol["text-variable-anchor"]),"text-anchor":new oe(or.layout_symbol["text-anchor"]),"text-max-angle":new n7(or.layout_symbol["text-max-angle"]),"text-writing-mode":new n7(or.layout_symbol["text-writing-mode"]),"text-rotate":new oe(or.layout_symbol["text-rotate"]),"text-padding":new n7(or.layout_symbol["text-padding"]),"text-keep-upright":new n7(or.layout_symbol["text-keep-upright"]),"text-transform":new oe(or.layout_symbol["text-transform"]),"text-offset":new oe(or.layout_symbol["text-offset"]),"text-allow-overlap":new n7(or.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new n7(or.layout_symbol["text-ignore-placement"]),"text-optional":new n7(or.layout_symbol["text-optional"]),visibility:new n7(or.layout_symbol.visibility)})),paint:L||(L=new oi({"icon-opacity":new oe(or.paint_symbol["icon-opacity"]),"icon-occlusion-opacity":new oe(or.paint_symbol["icon-occlusion-opacity"]),"icon-emissive-strength":new oe(or.paint_symbol["icon-emissive-strength"]),"text-emissive-strength":new oe(or.paint_symbol["text-emissive-strength"]),"icon-color":new oe(or.paint_symbol["icon-color"]),"icon-halo-color":new oe(or.paint_symbol["icon-halo-color"]),"icon-halo-width":new oe(or.paint_symbol["icon-halo-width"]),"icon-halo-blur":new oe(or.paint_symbol["icon-halo-blur"]),"icon-translate":new n7(or.paint_symbol["icon-translate"]),"icon-translate-anchor":new n7(or.paint_symbol["icon-translate-anchor"]),"icon-image-cross-fade":new n7(or.paint_symbol["icon-image-cross-fade"]),"text-opacity":new oe(or.paint_symbol["text-opacity"]),"text-occlusion-opacity":new oe(or.paint_symbol["text-occlusion-opacity"]),"text-color":new oe(or.paint_symbol["text-color"],{runtimeType:ik,getOverride:i=>i.textColor,hasOverride:i=>!!i.textColor}),"text-halo-color":new oe(or.paint_symbol["text-halo-color"]),"text-halo-width":new oe(or.paint_symbol["text-halo-width"]),"text-halo-blur":new oe(or.paint_symbol["text-halo-blur"]),"text-translate":new n7(or.paint_symbol["text-translate"]),"text-translate-anchor":new n7(or.paint_symbol["text-translate-anchor"]),"icon-color-saturation":new n7(or.paint_symbol["icon-color-saturation"]),"icon-color-contrast":new n7(or.paint_symbol["icon-color-contrast"]),"icon-color-brightness-min":new n7(or.paint_symbol["icon-color-brightness-min"]),"icon-color-brightness-max":new n7(or.paint_symbol["icon-color-brightness-max"]),"symbol-z-offset":new oe(or.paint_symbol["symbol-z-offset"]),"icon-color-use-theme":new oe({type:"string",default:"default","property-type":"data-driven"}),"icon-halo-color-use-theme":new oe({type:"string",default:"default","property-type":"data-driven"}),"text-color-use-theme":new oe({type:"string",default:"default","property-type":"data-driven"}),"text-halo-color-use-theme":new oe({type:"string",default:"default","property-type":"data-driven"})}))});class mo extends ow{constructor(i,r,a,n){super(i,mn(),r,a,n,i.layout?i.layout["icon-image-use-theme"]:null),this._colorAdjustmentMatrix=et([]),this.hasOcclusionOpacityProperties=void 0!==i.paint&&("icon-occlusion-opacity"in i.paint||"text-occlusion-opacity"in i.paint)}_handleSpecialPaintPropertyUpdate(i){"icon-occlusion-opacity"!==i&&"text-occlusion-opacity"!==i||(this.hasOcclusionOpacityProperties=!0)}recalculate(i,r){super.recalculate(i,r),this.appearances&&this.appearances.forEac
7h(a=>{a.recalculate(i,r,this.iconImageUseTheme)}),"auto"===this.layout.get("icon-rotation-alignment")&&(this.layout._values["icon-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-rotation-alignment")&&(this.layout._values["text-rotation-alignment"]="point"!==this.layout.get("symbol-placement")?"map":"viewport"),"auto"===this.layout.get("text-pitch-alignment")&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")),"auto"===this.layout.get("icon-pitch-alignment")&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment"));let a=this.layout.get("text-writing-mode");if(a){let i=[];for(let r of a)i.includes(r)||i.push(r);this.layout._values["text-writing-mode"]=i}else this.layout._values["text-writing-mode"]="point"===this.layout.get("symbol-placement")?["horizontal"]:["horizontal","vertical"];this._setPaintOverrides()}getColorAdjustmentMatrix(i,r,a,n){return this._saturation===i&&this._contrast===r&&this._brightnessMin===a&&this._brightnessMax===n||(this._colorAdjustmentMatrix=function(i,r,a,n){i=tz(i),r=tR(r);let o=Q(),s=i/3,l=1-2*s,h=.5-.5*r,u=n-a;return er(o,[u,0,0,0,0,u,0,0,0,0,u,0,a,a,a,1],[r,0,0,0,0,r,0,0,0,0,r,0,h,h,h,1]),er(o,o,[l,s,s,0,s,l,s,0,s,s,l,0,0,0,0,1]),o}(i,r,a,n),this._saturation=i,this._contrast=r,this._brightnessMin=a,this._brightnessMax=n),this._colorAdjustmentMatrix}getValueAndResolveTokens(i,r,a,n){let o=this.layout.get(i).evaluate(r,{},a,n),s=this._unevaluatedLayout._values[i];return s.isDataDriven()||ne(s.value)||!o?o:mr(r.properties,o)}getAppearanceValueAndResolveTokens(i,r,a,n,o){let s=i.getLayoutProperty(r);if(!s)return;let l=s.evaluate(a,{},n,o),h=i.getUnevaluatedLayoutProperties()._values[r];return h.isDataDriven()||ne(h.value)||!l||"string"!=typeof l?l:mr(a.properties,l)}createBucket(i){return new mi(i)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(let i of mn().paint.overridableProperties){if(!mo.hasPaintOverride(this.layout,i))continue;let r=this.paint.get(i),a=new a7(new ma(r),r.property.specification,this.scope,this.options,this.layout.get("icon-image-use-theme")),n=null;n="constant"===r.value.kind||"source"===r.value.kind?new ni("source",a):new nr("composite",a,r.value.zoomStops,r.value.interpolationType),this.paint._values[i]=new n8(r.property,n,r.parameters)}}_handleOverridablePaintPropertyUpdate(i,r,a){return!(!this.layout||r.isDataDriven()||a.isDataDriven())&&mo.hasPaintOverride(this.layout,i)}static hasPaintOverride(i,r){let a=i.get("text-field"),n=mn().paint.properties[r],o=!1,s=i=>{for(let r of i)if(n.overrides&&n.overrides.hasOverride(r))return void(o=!0)};if("constant"===a.value.kind&&a.value.value instanceof iQ)s(a.value.value.sections);else if("source"===a.value.kind){let i=r=>{o||(r instanceof i6&&i5(r.value)===ij?s(r.value.sections):r instanceof re?s(r.sections):r.eachChild(i))},r=a.value;r._styleExpression&&i(r._styleExpression.expression)}return o}getProgramIds(){return["symbol"]}getDefaultProgramParams(i,r,a){return{config:new sG(this,{zoom:r,lut:a}),overrideFog:!1}}hasElevation(){return this.layout&&"hd-road-markup"===this.layout.get("symbol-elevation-reference")}}var ms=oA([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Uint16",components:2}]);function ml(i,r,a,n,o,s,l,h){let u=[i,r,1,a,n,1,o,s,1],c=[l,h,1],[d,p,f]=eF(c,c,J([],u));return K(u,u,[d,0,0,0,p,0,0,0,f])}function mh(i,r,a,n,o,s,l,h){let u=function(i,r,a,n,o,s,l,h){let u=ml(0,0,1,0,1,1,0,1),c=ml(i,r,a,n,o,s,l,h);return K(c,c,J([],u))}(i,r,a,n,o,s,l,h);return[u[2]/u[8]/8192,u[5]/u[8]/8192]}function mu(i){return[i[0],Math.min(Math.max(i[1],-85.051129),85.051129)]}class mc extends iv{constructor(i,r,a,n){super(),this.id=i,this.dispatcher=a,this.coordinates=r.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.onNorthPole=!1,this.onSouthPole=!1,this.setEventedParent(n),this.options=r,this._dirty=!1}load(i,r){if(this._loaded=r||!1,this.fire(new i_("dataloading",{dataType:"source"})),this.url=this.options.url,!this.url)return i&&(this.coordinates=i),this._loaded=!0,void this._finishLoading();this._imageRequest=ia(this.map._requestManager.transformRequest(this.url,t4.Image),(r,a)=>{this._imageRequest=null,this._loaded=!0,r?this.fire(new ig(r)):a&&(this.image=a,this._dirty=!0,this.width=this.image.width,this.height=this.image.height,i&&(this.coordinates=i),this._finishLoading())})}loaded(){return this._loaded}updateImage(i){return i.url&&(this._imageRequest&&i.url!==this.options.url&&(this._imageRequest.cancel(),this._imageRequest=null),this.options.url=i.url,this.load(i.coordinates,this._loaded)),this}setTexture(i){if(!(i.handle instanceof WebGLTexture))throw Error("The provided handle is not a WebGLTexture instance");return this.texture=new cY(this.map.painter.context,i.handle),this.width=i.dimensions[0],this.height=i.dimensions[1],this._dirty=!1,this._loaded=!0,this._finishLoading(),this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new i_("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(i){this.map=i,this.load()}onRemove(i){this._imageRequest&&(this._imageRequest.cancel(),this._imageRequest=null),!this.texture||this.texture instanceof cY||this.texture.destroy(),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy())}setCoordinates(i){if(this.coordinates=i,this._boundsArray=void 0,this._unsupportedCoords=!1,!i.length)return this;this.onNorthPole=!1,this.onSouthPole=!1;let r=i[0][1],a=i[0][1];for(let n of i)n[1]>a&&(a=n[1]),n[1]<r&&(r=n[1]);let n=(a+r)/2;if(n>85.051129?this.onNorthPole=!0:n<-85.051129&&(this.onSouthPole=!0),!this.onNorthPole&&!this.onSouthPole){let r=i.map(lr.fromLngLat);this.tileID=function(i){let r=1/0,a=1/0,n=-1/0,o=-1/0;for(let s of i)r=Math.min(r,s.x),a=Math.min(a,s.y),n=Math.max(n,s.x),o=Math.max(o,s.y);let s=Math.max(0,Math.floor(-Math.log2(Math.max(n-r,o-a)))),l=Math.pow(2,s),h=Math.floor((r+n)/2*l);return h>1&&(h-=1),new lK(s,h,Math.floor((a+o)/2*l))}(r),this.minzoom=this.maxzoom=this.tileID.z}return this.fire(new i_("data",{dataType:"source",sourceDataType:"content"})),this}_clear(){!this.texture||this.texture instanceof cY||(this.texture.destroy(),this._dirty=!0),this.texture=null,this._boundsArray=void 0,this._unsupportedCoords=!1}_prepareData(i){var r;for(let i in this.tiles){let r=this.tiles[i];"loaded"!==r.state&&(r.state="loaded",r.texture=this.texture)}if(this._boundsArray||this.onNorthPole||this.onSouthPole||this._unsupportedCoords)return;let a=fB(new lK(0,0,0),this.map.transform.projection),n=[a.projection.project(this.coordinates[0][0],this.coordinates[0][1]),a.projection.project(this.coordinates[1][0],this.coordinates[1][1]),a.projection.project(this.coordinates[2][0],this.coordinates[2][1]),a.projection.project(this.coordinates[3][0],this.coordinates[3][1])];if(!function(i){let r=i[1].x-i[0].x,a=i[1].y-i[0].y,n=i[2].x-i[1].x,o=i[2].y-i[1].y,s=i[3].x-i[2].x,l=i[3].y-i[2].y,h=i[0].x-i[3].x,u=i[0].y-i[3].y,c=r*o-n*a,d=n*l-s*o,p=s*u-h*l,f=h*a-r*u;return c>0&&d>0&&p>0&&f>0||c<0&&d<0&&p<0&&f<0}(n))return console.warn("Image source coordinates are defining non-convex area in the Mercator projection"),void(this._unsupportedCoords=!0);let o=fB(this.tileID,this.map.transform.projection),[s,l,h,u]=this.coordinates.map(i=>{let r=o.projection.project(i[0],i[1]);return fk(o,r)._round()});this.perspectiveTransform=mh(s.x,s.y,l.x,l.y,h.x,h.y,u.x,u.y);let c=this._boundsArray=new oD;c.emplaceBack(s.x,s.y,0,0),c.emplaceBack(l.x,l.y,8192,0),c.emplaceBack(u.x,u.y,0,8192),c.emplaceBack(h.x,h.y,8192,8192),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy()),this.boundsBuffer=i.createVertexBuffer(c,ms.members),this.boundsSegments=sy.simpleSegment(0,0,4,2);let d=[],[p,f,m,_]=function(i){let r=i[0][0],a=r,n=i[0][1],o=n;for(let s=1;s<i.length;s++)i[s][0]<r?r=i[s][0]:i[s][0]>a&&(a=i[s][0]),i[s][1]<n?n=i[s][1]:i[s][1]>o&&(o=i[s][1]);return[r,n,a-r,o-n]}([mu((r=this.coordinates)[0]),mu(r[1]),mu(r[2]),mu(r[3])]);{let r=new oD,[o,s,l,h]=function(i){let r=i[0].x,a=r,n=i[0].y,o=n;for(let s=1;s<i.length;s++)i[s].x<r?r=i[s].x:i[s].x>a&&(a=i[s].x),i[s].y<n?n=i[s].y:i[s].y>o&&(o=i[s].y);return[r,n,a-r,o-n]}(n),u=i=>[(i.x-o)/l,(i.y-s)/h],[c,g,y,x]=n.map(u),v=function(i,r,a,n,o,s,l,h){let u=ml(0,0,1,0,1,1,0,1);return K(u,u,J([],ml(i,r,a,n,o,s,l,h)))}(c[0],c[1],g[0],g[1],y[0],y[1],x[0],x[1]);this.elevatedGlobePerspectiveTransform=mh(c[0],c[1],g[0],g[1],y[0],y[1],x[0],x[1]);let b=(i,a)=>{d.push(i.lng);let n=Math.round((i.lng-p)/m*8192),o=Math.round((i.lat-f)/_*8192),s=u(a),l=eF([],[s[0],s[1],1],v),h=Math.round(l[0]/l[2]*8192),c=Math.round(l[1]/l[2]*8192);r.emplaceBack(n,o,h,c)},w=n[3].x-n[0].x,T=n[3].y-n[0].y,S=n[2].x-n[1].x,E=n[2].y-n[1].y;for(let i=0;i<65;i++){let r=i/64,o=[n[0].x+r*w,n[0].y+r*T],s=[n[1].x+r*S,n[1].y+r*E],l=s[0]-o[0],h=s[1]-o[1];for(let i=0;i<65;i++){let r=i/64,n={x:o[0]+l*r,y:o[1]+h*r};b(a.projection.unproject(n.x,n.y),n)}}this.elevatedGlobeVertexBuffer=i.createVertexBuffer(r,ms.members)}{this.maxLongitudeTriangleSize=0;let r=[],a=new oJ,n=(i,n,o)=>{a.emplaceBack(i,n,o);let s=d[i],l=d[n],h=d[o],u=Math.min(Math.min(s,l),h),c=Math.max(Math.max(s,l),h)-u;c>this.maxLongitudeTriangleSize&&(this.maxLongitudeTriangleSize=c),r.push(u+c/2)};for(let i=0;i<64;i++)for(let r=0;r<64;r++){let a=65*i+r,o=a+1,s=a+65,l=s+1;n(a,s,o),n(o,s,l)}[r,a]=function(i,r){let a=Array.from({length:i.length},(i,r)=>r);a.sort((r,a)=>i[r]-i[a]);let n=[],o=new oJ;for(let s=0;s<a.length;s++){let l=a[s];n.push(i[l]);let h=3*l,u=h+1;o.emplaceBack(r.uint16[h],r.uint16[u],r.uint16[u+1])}return[n,o]}(r,a),this.elevatedGlobeTrianglesCenterLongitudes=r,this.elevatedGlobeIndexBuffer=i.createIndexBuffer(a)}this.elevatedGlobeSegments=sy.simpleSegment(0,0,4225,8192),this.elevatedGlobeGridMatrix=new Float32Array([0,m/8192,0,_/8192,0,0,f,p,0])}prepare(){let i=0!==Object.keys(this.tiles).length;if(this.tileID&&!i)return;let r=this.map.painter.context,a=r.gl;!this._dirty||this.texture instanceof cY||(this.texture?this.texture.update(this.image):(this.texture=new cX(r,this.image,a.RGBA8),this.texture.bind(a.LINEAR,a.CLAMP_TO_EDGE)),this._dirty=!1),i&&this._prepareData(r)}loadTile(i,r){this.tileID&&this.tileID.equals(i.tileID.canonical)?(this.tiles[String(i.tileID.wrap)]=i,i.buckets={}):i.state="errored",r(null)}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}getSegmentsForLongitude(i){var r;let a=this.elevatedGlobeSegments;if(!this.elevatedGlobeTrianglesCenterLongitudes||!a)return null;let n=this.elevatedGlobeTrianglesCenterLongitudes,o=(r=i+180)+360*Math.round((n[0]-r)/360),s=new sy,l=(i,r)=>{s.segments.push({vertexOffset:0,primitiveOffset:i,vertexLength:a.segments[0].vertexLength,primitiveLength:r,sortKey:void 0,vaos:{}})},h=.51*this.maxLongitudeTriangleSize;if(Math.abs(n[0]-o)<=h){let i=tD(n,0,n.length,o+h);return i===n.length||l(i,tP(n,i+1,n.length,o+360-h)-i),s}o<n[0]&&(o+=360);let u=tP(n,0,n.length,o-h);if(u===n.length)return l(0,n.length),s;l(0,u-0);let c=tD(n,u+1,n.length,o+h);return c!==n.length&&l(c,n.length-c),s}}class md extends ow{constructor(i,r,a,n){super(i,{layout:k||(k=new oi({visibility:new n7(or.layout_raster.visibility)})),paint:N||(N=new oi({"raster-opacity":new n7(or.paint_raster["raster-opacity"]),"raster-color":new ot(or.paint_raster["raster-color"]),"raster-color-mix":ne
7w n7(or.paint_raster["raster-color-mix"]),"raster-color-range":new n7(or.paint_raster["raster-color-range"]),"raster-hue-rotate":new n7(or.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new n7(or.paint_raster["raster-brightness-min"]),"raster-brightness-max":new n7(or.paint_raster["raster-brightness-max"]),"raster-saturation":new n7(or.paint_raster["raster-saturation"]),"raster-contrast":new n7(or.paint_raster["raster-contrast"]),"raster-resampling":new n7(or.paint_raster["raster-resampling"]),"raster-fade-duration":new n7(or.paint_raster["raster-fade-duration"]),"raster-emissive-strength":new n7(or.paint_raster["raster-emissive-strength"]),"raster-array-band":new n7(or.paint_raster["raster-array-band"]),"raster-elevation":new n7(or.paint_raster["raster-elevation"]),"raster-elevation-reference":new n7(or.paint_raster["raster-elevation-reference"]),"raster-color-use-theme":new oe({type:"string",default:"default","property-type":"data-driven"})}))},r,a,n),this.updateColorRamp(),this._curRampRange=[NaN,NaN]}getProgramIds(){return["raster"]}hasColorMap(){return!!this._transitionablePaint._values["raster-color"].value.value}tileCoverLift(){return this.paint.get("raster-elevation")}isDraped(i){return!(i&&i._source instanceof mc&&(i._source.onNorthPole||i._source.onSouthPole))&&0===this.paint.get("raster-elevation")}_handleSpecialPaintPropertyUpdate(i){"raster-color"!==i&&"raster-color-range"!==i||(this._curRampRange=[NaN,NaN],this.updateColorRamp())}_clear(){this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null)}updateColorRamp(i){if(!this.hasColorMap()||!this._curRampRange)return;let r=this._transitionablePaint._values["raster-color"].value.expression,[a,n]=i||this._transitionablePaint._values["raster-color-range"].value.expression.evaluate({zoom:0})||[NaN,NaN];isNaN(a)&&isNaN(n)||a===this._curRampRange[0]&&n===this._curRampRange[1]||(this.colorRamp=hL({expression:r,evaluationKey:"rasterValue",image:this.colorRamp,clips:[{start:a,end:n}],resolution:1024}),this.colorRampTexture=null,this._curRampRange=[a,n])}is3D(i){return this.paint.get("raster-elevation")>0}}class mp extends ow{constructor(i,r,a,n){super(i,{layout:U||(U=new oi({visibility:new n7(or["layout_raster-particle"].visibility)})),paint:V||(V=new oi({"raster-particle-array-band":new n7(or["paint_raster-particle"]["raster-particle-array-band"]),"raster-particle-count":new n7(or["paint_raster-particle"]["raster-particle-count"]),"raster-particle-color":new ot(or["paint_raster-particle"]["raster-particle-color"]),"raster-particle-max-speed":new n7(or["paint_raster-particle"]["raster-particle-max-speed"]),"raster-particle-speed-factor":new n7(or["paint_raster-particle"]["raster-particle-speed-factor"]),"raster-particle-fade-opacity-factor":new n7(or["paint_raster-particle"]["raster-particle-fade-opacity-factor"]),"raster-particle-reset-rate-factor":new n7(or["paint_raster-particle"]["raster-particle-reset-rate-factor"]),"raster-particle-elevation":new n7(or["paint_raster-particle"]["raster-particle-elevation"]),"raster-particle-color-use-theme":new oe({type:"string",default:"default","property-type":"data-driven"})}))},r,a,n),this._updateColorRamp(),this.lastInvalidatedAt=tj.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(i){this.colorRampTexture&&this.colorRampTexture.destroy(),this.tileFramebuffer&&this.tileFramebuffer.destroy(),this.particleFramebuffer&&this.particleFramebuffer.destroy()}hasColorMap(){return!!this._transitionablePaint._values["raster-particle-color"].value.value}getProgramIds(){return["rasterParticle"]}hasOffscreenPass(){return"none"!==this.visibility}isDraped(i){return!1}_handleSpecialPaintPropertyUpdate(i){"raster-particle-color"!==i&&"raster-particle-max-speed"!==i||(this._updateColorRamp(),this._invalidateAnimationState()),"raster-particle-count"===i&&this._invalidateAnimationState()}_updateColorRamp(){if(!this.hasColorMap())return;let i=this._transitionablePaint._values["raster-particle-color"].value.expression,r=this._transitionablePaint._values["raster-particle-max-speed"].value.expression.evaluate({zoom:0});this.colorRamp=hL({expression:i,evaluationKey:"rasterParticleSpeed",image:this.colorRamp,clips:[{start:0,end:r}],resolution:256}),this.colorRampTexture=null}
7_invalidateAnimationState(){this.lastInvalidatedAt=tj.now()}tileCoverLift(){return this.paint.get("raster-particle-elevation")}}class mf extends ow{constructor(i,r){super(i,{},r,null),this.implementation=i,i.slot&&(this.slot=i.slot)}is3D(i){return"3d"===this.implementation.renderingMode}hasOffscreenPass(){return void 0!==this.implementation.prerender}isDraped(i){return void 0!==this.implementation.renderToTile}shouldRedrape(){return!!this.implementation.shouldRerenderTiles&&this.implementation.shouldRerenderTiles()}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){}onAdd(i){this.implementation.onAdd&&this.implementation.onAdd(i,i.painter.context.gl)}onRemove(i){this.implementation.onRemove&&this.implementation.onRemove(i,i.painter.context.gl)}}function mm(i,r,a){let n=[0,0,1],o=eH([]);return eq(o,o,a?-(i*e7)+Math.PI:i*e7),e$(o,o,-(r*e7)),eO(n,n,o),eP(n,n)}class m_{constructor(i,r){this.feature=i,this.instancedDataOffset=r,this.instancedDataCount=0,this.rotation=[0,0,0],this.scale=[1,1,1],this.translation=[0,0,0]}}class mg{constructor(){this.maxScale=1,this.maxXYTranslationDistance=0,this.instancedDataArray=new o9,this.instancesEvaluatedElevation=[],this.features=[],this.idToFeaturesIndex={}}colorForInstance(i){let r=16*i,a=this.instancedDataArray.float32,n=Math.floor(a[r+2]),o=1.05*(a[r+2]-n);return n/=100,[a[r]%1*1.05,a[r+1]%1*1.05,o,n]}tileCoordinatesForInstance(i){let r=16*i,a=this.instancedDataArray.float32,n=a[r+0];return new e8(Math.trunc(n=n>8192?n-8192:n),Math.trunc(a[r+1]))}translationForInstance(i){let r=16*i,a=this.instancedDataArray.float32;return[a[r+4],a[r+5],a[r+6]]}rotationScaleForInstance(i){let r=16*i,a=this.instancedDataArray.float32;return[a[r+7],a[r+8],a[r+9],a[r+10],a[r+11],a[r+12],a[r+13],a[r+14],a[r+15]]}transformForInstance(i){let r=16*i,a=this.instancedDataArray.float32;return[a[r+7],a[r+8],a[r+9],a[r+4],a[r+10],a[r+11],a[r+12],a[r+5],a[r+13],a[r+14],a[r+15],a[r+6],0,0,0,1]}}class my{constructor(i){this.zoom=i.zoom,this.canonical=i.canonical,this.overscaledZ=this.canonical.z+Math.log2(i.overscaling),this.layers=i.layers,this.layerIds=this.layers.map(i=>i.fqid),this.projection=i.projection,this.index=i.index,this.worldview=i.worldview,this.hasZoomDependentProperties=this.layers[0].isZoomDependent(),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.hasPattern=!1,this.instancesPerModel={},this.validForExaggeration=0,this.maxVerticalOffset=0,this.maxScale=0,this.maxHeight=0,this.lookupDim=this.zoom>this.canonical.z+1?0:this.zoom>this.canonical.z?256:this.zoom>15?75:100,this.instanceCount=0,this.terrainElevationMin=0,this.terrainElevationMax=0,this.validForDEMTile={id:null,timestamp:0},this.modelUris=[],this.modelsRequested=!1,this.activeReplacements=[],this.replacementUpdateTime=0,this.styleDefinedModelURLs=i.styleDefinedModelURLs,this.hasAppearances=null}updateFootprints(i,r){}updateAppearances(i,r,a,n){return{hasLayoutChanges:!1,hasUboChanges:!1}}populate(i,r,a,n){this.tileToMeter=li(a);let o=this.layers[0]._featureFilter.needGeometry;this.lookup=new Uint8Array(this.lookupDim*this.lookupDim);let s="hd-road-markup"===this.layers[0].paint.get("model-elevation-reference")?r.elevationFeatures:void 0;for(let{feature:l,id:h,index:u,sourceLayerIndex:c}of i){let i=null!=h?h:l.properties&&Object.hasOwn(l.properties,"id")?l.properties.id:void 0,d=ls(l,o);if(!this.layers[0]._featureFilter.filter(new n0(this.zoom,{worldview:this.worldview,activeFloors:r.activeFloors}),d,a))continue;let p={id:i,sourceLayerIndex:c,index:u,geometry:o?d.geometry:lo(l,a,n),properties:l.properties,type:l.type,patterns:{}},f=this.addFeature(p,p.geometry,d,s,a);f&&r.featureIndex.insert(l,p.geometry,u,c,this.index,this.instancesPerModel[f].instancedDataArray.length,256)}this.lookup=null}evaluateQueryRenderedFeaturePadding(){let i=this.layers[0].modelManager,r=this.layers[0].scope,a=0;for(let n of this.modelUris){let o=i.getModel(n,r);if(!o)continue;let s=this.instancesPerModel[n];s&&(a=Math.max(Math.min(8192,Math.max((.5*eI(o.aabb.max,o.aabb.min)*s.maxScale+s.maxXYTranslationDistance)/this.tileToMeter,256)),a))}return a}update(i,r,a,n){for(let r in this.instancesPerModel){let a=this.instancesPerModel[r];for(let r in i)Object.hasOwn(a.idToFeaturesIndex,r)&&(this.evaluate(a.features[a.idToFeaturesIndex[r]],i[r],a,!0),this.uploaded=!1)}this.maxHeight=0}updateZoomBasedPaintProperties(){if(!this.hasZoomDependentProperties)return!1;let i=!1;for(let r in this.instancesPerModel){let a=this.instancesPerModel[r];for(let r of a.features){let n=this.layers[0],o=r.feature,s=this.canonical,l=n.paint.get("model-rotation").evaluate(o,{},s),h=n.paint.get("model-scale").evaluate(o,{},s),u=n.paint.get("model-translation").evaluate(o,{},s);ek(r.rotation,l)&&ek(r.scale,h)&&ek(r.translation,u)||(this.evaluate(r,r.featureStates,a,!0),i=!0)}}return i}updateReplacement(i,r,a,n){if(r.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=r.updateTime;let o=r.getReplacementRegionsForTile(i.toUnwrapped(),!0);if(uY(this.activeReplacements,o))return!1;this.activeReplacements=o;let s=!1;for(let r in this.instancesPerModel){let o=this.instancesPerModel[r],l=o.instancedDataArray;for(let r of o.features){let o=r.instancedDataOffset,h=r.instancedDataCount;for(let r=0;r<h;r++){let h=16*(r+o),u=l.float32[h+0],c=u>8192,d=Math.floor(u=c?u-8192:u),p=Math.floor(l.float32[h+1]),f=!1;for(let r of this.activeReplacements)if(!uq(r,a,u1.Model,n)&&!(r.min.x>d||d>r.max.x||r.min.y>p||p>r.max.y)&&(f=u0(uQ(d,p,i.canonical,r.footprintTileId.canonical),r.footprint)))break;l.float32[h]=f?u+8192:u,s=s||f!==c}}}return s}isEmpty(){for(let i in this.instancesPerModel)if(0!==this.instancesPerModel[i].instancedDataArray.length)return!1;return!0}uploadPending(){return!this.uploaded}upload(i){if(!this.uploaded)for(let r in this.instancesPerModel){let a=this.instancesPerModel[r];a.instancedDataArray.length<0||0===a.instancedDataArray.length||(a.instancedDataBuffer?a.instancedDataBuffer.updateData(a.instancedDataArray):a.instancedDataBuffer=i.createVertexBuffer(a.instancedDataArray,c2.members,!0,void 0,this.instanceCount))}this.uploaded=!0}destroy(i){for(let i in this.instancesPerModel){let r=this.instancesPerModel[i];0!==r.instancedDataArray.length&&r.instancedDataBuffer&&r.instancedDataBuffer.destroy()}let r=this.layers[0].modelManager;if(i&&r&&this.modelUris&&this.modelsRequested)for(let i of this.modelUris)r.removeModel(i,"",!0)}addFeature(i,r,a,n,o){let s,l=this.layers[0],h=l.layout.get("model-id"),u=l.layout.get("model-allow-density-reduction"),c=h.evaluate(a,{},this.canonical);if(!c)return tw(`modelId is not evaluated for layer ${l.id} and it is not going to get rendered.`),c;!c.includes("://")&&!this.styleDefinedModelURLs[c]||this.modelUris.includes(c)||this.modelUris.push(c),this.instancesPerModel[c]||(this.instancesPerModel[c]=new mg);let d=this.instancesPerModel[c],p=d.instancedDataArray,f=new m_(a,p.length);for(let a of(n&&(s=lz.getElevationFeature(i,n)),r))for(let i of a){if(i.x<0||i.x>=8192||i.y<0||i.y>=8192)continue;if(0!==this.lookupDim&&u){let r=(this.lookupDim-1)/8192,a=this.lookupDim*(i.y*r|0)+i.x*r|0;if(this.lookup){if(0!==this.lookup[a])continue;this.lookup[a]=1}}this.instanceCount++;let r=p.length;if(p.resize(r+1),n){d.instancesRoadElevation||(d.instancesRoadElevation=[]);let r=s?s.pointElevation(new e8(i.x,i.y)):0;d.instancesRoadElevation.push(r)}d.instancesEvaluatedElevation.push(0),p.float32[16*r]=i.x,p.float32[16*r+1]=i.y}return f.instancedDataCount=d.instancedDataArray.length-f.instancedDataOffset,f.instancedDataCount>0&&(i.id&&(d.idToFeaturesIndex[i.id]=d.features.length),d.features.push(f),this.evaluate(f,{},d,!1)),c}getModelUris(){return this.modelUris}evaluate(i,r,a,n){let o=this.layers[0],s=i.feature,l=this.canonical,h=i.rotation=o.paint.get("model-rotation").evaluate(s,r,l),u=i.scale=o.paint.get("model-scale").evaluate(s,r,l),c=i.translation=o.paint.get("model-translation").evaluate(s,r,l),d=Object.assign({},o.paint.get("model-color").evaluate(s,r,l));d.a=o.paint.get("model-color-mix-intensity").evaluate(s,r,l);let p=[];this.maxVerticalOffset<c[2]&&(this.maxVerticalOffset=c[2]);let f=c[0]*c[0]+c[1]*c[1],m=f>0?Math.sqrt(f):0;a.maxScale=Math.max(Math.max(a.maxScale,u[0]),Math.max(u[1],u[2])),a.maxXYTranslationDistance=Math.max(a.maxXYTranslationDistance,m),this.maxScale=Math.max(Math.max(this.maxScale,u[0]),Math.max(u[1],u[2])),dt(p,h,u);let _=Math.round(100*d.a)+d.b/1.05;for(let r=0;r<i.instancedDataCount;++r){let o=i.instancedDataOffset+r,s=16*o,h=a.instancedDataArray.float32,u=0;n&&(u=h[s+6]-a.instancesEvaluatedElevation[o]);let f=0|h[s+1];h[s]=(0|h[s])+d.r/1.05,h[s+1]=f+d.g/1.05,h[s+2]=_,h[s+3]=1/(l.z>10?this.tileToMeter:li(l,f)),h[s+4]=c[0],h[s+5]=c[1],h[s+6]=c[2]+(a.instancesRoadElevation?a.instancesRoadElevation[o]:0)+u,h[s+7]=p[0],h[s+8]=p[1],h[s+9]=p[2],h[s+10]=p[4],h[s+11]=p[5],h[s+12]=p[6],h[s+13]=p[8],h[s+14]=p[9],h[s+15]=p[10],a.instancesEvaluatedElevation[o]=c[2]}}}nl(my,"ModelBucket",{omit:["layers"]}),nl(mg,"PerModelAttributes"),nl(m_,"ModelFeature");class mx{constructor(i,r,a){this._demTile=i,this._dem=this._demTile.dem,this._scale=r,this._offset=a}static create(i,r,a){let n=a||i.findDEMTileFor(r);if(!n||!n.dem)return;let o=n.dem,s=n.tileID,l=1<<r.canonical.z-s.canonical.z;return new mx(n,o.dim/8192/l,[(r.canonical.x/l-s.canonical.x)*o.dim,(r.canonical.y/l-s.canonical.y)*o.dim])}tileCoordToPixel(i,r){let a=r*this._scale+this._offset[1];return new e8(Math.floor(i*this._scale+this._offset[0]),Math.floor(a))}getElevationAt(i,r,a,n){let o=i*this._scale+this._offset[0],s=r*this._scale+this._offset[1],l=Math.floor(o),h=Math.floor(s),u=this._dem;return n=!!n,a?iE(iE(u.get(l,h,n),u.get(l,h+1,n),s-h),iE(u.get(l+1,h,n),u.get(l+1,h+1,n),s-h),o-l):u.get(l,h,n)}getElevationAtPixel(i,r,a){return this._dem.get(i,r,!!a)}getMeterToDEM(i){return(1<<this._demTile.tileID.canonical.z)*(1/s3(i))*this._dem.stride}}let mv=new Float32Array(262144),mb=new Uint8Array(262144),mw=[0,0,0],mT=[0,0,0],mS=["","wall","door","roof","window","lamp","logo"];class mE{constructor(i){this.node=i,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.targetL
7od=-1,this.feature={type:"Point",id:i.id,geometry:[],properties:{height:function i(r){let a=0;if(r.meshes)for(let i of r.meshes)a=Math.max(a,i.aabb.max[2]);if(r.children)for(let n of r.children)a=Math.max(a,i(n));return a}(i)}},this.aabb=this._getLocalBounds(),this.state=null}_getLocalBounds(){if(!this.node.meshes)return new lP([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);if(!this.aabb){let i=0,r=new lP([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);for(let a of this.node.meshes)this.node.lightMeshIndex!==i&&(a.transformedAabb=lP.applyTransformFast(a.aabb,this.node.globalMatrix),r.encapsulate(a.transformedAabb)),i++;this.aabb=r}return this.aabb}}class mI{constructor(i,r,a,n,o,s,l,h){for(let u of(this.id=a,this.layers=i,this.layerIds=this.layers.map(i=>i.fqid),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.modelTraits|=dn.CoordinateSpaceTile,this.uploaded=!1,this.hasPattern=!1,n&&(this.modelTraits|=dn.HasMapboxMeshFeatures),o&&(this.modelTraits|=dn.HasMeshoptCompression),this.zoom=-1,this.terrainExaggeration=1,this.projection={name:"mercator"},this.replacementUpdateTime=0,this.elevationReadFromZ=255,this.brightness=s,this.worldview=h,this.dirty=!0,this.needsUpload=!1,this.filter=null,this.nodesInfo=[],r))this.nodesInfo.push(new mE(u)),function i(r,a,n){if(r.meshes)for(let i of r.meshes){if(i.aabb.min[0]===1/0)continue;let o=lP.applyTransform(i.aabb,r.globalMatrix);n.insert(a,o.min[0],o.min[1],o.max[0],o.max[1])}if(r.children)for(let o of r.children)i(o,a,n)}(u,l.featureIndexArray.length,l.grid),l.featureIndexArray.emplaceBack(this.nodesInfo.length-1,0,l.bucketLayerIDs.length-1,0);this.states={},this.hasAppearances=null}updateFootprints(i,r){for(let a of this.getNodesInfo()){let n=a.node;n.footprint&&r.push({footprint:n.footprint,id:i})}}updateAppearances(i,r,a,n){return{hasLayoutChanges:!1,hasUboChanges:!1}}update(i){let r=0!==Object.keys(i).length;if(r&&!this.stateDependentLayers.length)return;let a=r?this.stateDependentLayers:this.layers;if(!e9(i,this.states))for(let r of a)this.evaluate(r,i);this.states=structuredClone(i)}populate(){console.log("populate 3D model bucket")}uploadPending(){return!this.uploaded||this.needsUpload}upload(i){if(!this.needsUpload)return;let r=this.getNodesInfo();for(let a of r){let r=a.node;this.uploaded?this.updatePbrBuffer(r):dc(r,i,!0)}for(let i of r)dp(i.node);this.uploaded=!0,this.needsUpload=!1}updatePbrBuffer(i){let r=!1;if(!i.meshes)return r;for(let a of i.meshes)a.pbrBuffer&&(a.pbrBuffer.updateData(a.featureArray),r=!0);if(i.lodMeshes)for(let a of i.lodMeshes)a.pbrBuffer&&(a.pbrBuffer.updateData(a.featureArray),r=!0);return r}needsReEvaluation(i,r,a){let n=i.transform.projectionOptions,o=i.style.getBrightness(),s=this.brightness!==o;if(!this.uploaded||this.dirty||n.name!==this.projection.name||mA(a.paint.get("model-color").value,s)||mA(a.paint.get("model-color-mix-intensity").value,s)||mA(a.paint.get("model-roughness").value,s)||mA(a.paint.get("model-emissive-strength").value,s)||mA(a.paint.get("model-height-based-emissive-strength-multiplier").value,s)){for(let i of(this.projection=n,this.brightness=o,this.getNodesInfo()))i.state=null;return!0}return!1}evaluateTransform(i,r){if(i.transform.zoom===this.zoom)return;this.zoom=i.transform.zoom;let a=this.getNodesInfo(),n=this.id.canonical;for(let i of a){let a=i.feature;i.evaluatedTranslation=r.paint.get("model-translation").evaluate(a,{},n),i.evaluatedScale=r.paint.get("model-scale").evaluate(a,{},n)}}evaluate(i,r){for(let a of this.getNodesInfo()){if(!a.node.meshes)continue;let n=a.feature,o=r&&r[n.id];if(e9(o,a.state))continue;a.state=structuredClone(o);let s=a.node.meshes&&a.node.meshes[0].featureData,l=a.evaluatedColor[2],h=a.evaluatedRMEA[2],u=this.id.canonical;if(a.hasTranslucentParts=!1,s){for(let r=0;r<mS.length;r++){let s=mS[r];s.length&&(n.properties.part=s);let l=i.paint.get("model-color").evaluate(n,o,u).toPremultipliedRenderColor(null),h=i.paint.get("model-color-mix-intensity").evaluate(n,o,u);a.evaluatedColor[r]=[l.r,l.g,l.b,h],a.evaluatedRMEA[r][0]=i.paint.get("model-roughness").evaluate(n,o,u),a.evaluatedRMEA[r][2]=i.paint.get("model-emissive-strength").evaluate(n,o,u),a.evaluatedRMEA[r][3]=l.a,a.emissionHeightBasedParams[r]=i.paint.get("model-height-based-emissive-strength-multiplier").evaluate(n,o,u),!a.hasTranslucentParts&&l.a<1&&(a.hasTranslucentParts=!0)}delete n.properties.part,function(i,r,a){let n=i.node,o=0,s=a&dn.HasMeshoptCompression;for(let a of n.meshes){if(n.lights&&n.lightMeshIndex===o||!a.featureData)continue;a.featureArray=new o7,a.featureArray.reserve(a.featureData.length);let l=r;
7for(let r of a.featureData){let o,h=s?65535&r:r>>16&65535,u=s?r>>16&65535:65535&r,c=(15&u)<8?15&u:0,d=i.evaluatedRMEA[c],p=i.evaluatedColor[c],f=i.emissionHeightBasedParams[c];if(l&&2===c&&n.lights&&(o=new o7).resize(10*n.lights.length),mM(a.featureArray,h,p,d,f,a.aabb.min[2],a.aabb.max[2],o),o&&l){l=!1;let i=n.meshes[n.lightMeshIndex];i.featureArray=o,i.featureArray._trim()}}a.featureArray._trim(),o++}if(n.lodMeshes){for(let r of n.lodMeshes)if(r.featureData){for(let a of(r.featureArray=new o7,r.featureArray.reserve(r.featureData.length),r.featureData)){let n=s?a>>16&65535:65535&a,o=(15&n)<8?15&n:0;mM(r.featureArray,s?65535&a:a>>16&65535,i.evaluatedColor[o],i.evaluatedRMEA[o],i.emissionHeightBasedParams[o],r.aabb.min[2],r.aabb.max[2],null)}r.featureArray._trim()}}}(a,l!==a.evaluatedColor[2]||h!==a.evaluatedRMEA[2],this.modelTraits)}else a.evaluatedRMEA[0][2]=i.paint.get("model-emissive-strength").evaluate(n,o,u);a.evaluatedTranslation=i.paint.get("model-translation").evaluate(n,o,u),a.evaluatedScale=i.paint.get("model-scale").evaluate(n,o,u),this.updatePbrBuffer(a.node)||(this.needsUpload=!0)}this.dirty=!1}elevationUpdate(i,r,a,n){let o=i.findDEMTileFor(a);if(o&&(o.tileID.canonical!==this.terrainTile||r!==this.terrainExaggeration)){if(o.dem&&o.tileID.overscaledZ!==this.elevationReadFromZ){this.elevationReadFromZ=o.tileID.overscaledZ;let r=mx.create(i,a,o);if(!r)return;for(let o of(this.modelTraits&dn.HasMapboxMeshFeatures&&this.updateDEM(i,r,a,n),this.getNodesInfo())){let i=o.node;if(!i.footprint||!i.footprint.vertices||!i.footprint.vertices.length)continue;let a=i.footprint.vertices,n=r.getElevationAt(a[0].x,a[0].y,!0,!0);for(let i=1;i<a.length;i++)n=Math.min(n,r.getElevationAt(a[i].x,a[i].y,!0,!0));i.elevation=n}}this.terrainTile=o.tileID.canonical,this.terrainExaggeration=r}}updateDEM(i,r,a,n){let o=r._dem._modifiedForSources[n];if(void 0===o&&(r._dem._modifiedForSources[n]=[],o=r._dem._modifiedForSources[n]),o.includes(a.canonical))return;let s=r._dem.dim;o.push(a.canonical);let l=!1;for(let i of this.getNodesInfo()){let a=i.node;if(!a.footprint||!a.footprint.grid)continue;let n=a.footprint.grid,o=r.tileCoordToPixel(n.min.x,n.min.y),h=r.tileCoordToPixel(n.max.x,n.max.y),u=Math.min(Math.min(s-h.y,o.x),Math.min(o.y,s-h.x));if(u<0)continue;let c=tl(u,2,5),d=Math.max(0,o.x-c),p=Math.max(0,o.y-c),f=Math.min(h.x+c,s-1),m=Math.min(h.y+c,s-1);for(let i=p;i<=m;++i)for(let r=d;r<=f;++r)mb[i*s+r]=255;let _=0,g=0;for(let i=0;i<n.cellsY;++i)for(let a=0;a<n.cellsX;++a){if(!n.cells[i*n.cellsX+a])continue;let o=r.tileCoordToPixel(n.min.x+a/n.xScale,n.min.y+i/n.yScale),l=r.tileCoordToPixel(n.min.x+(a+1)/n.xScale,n.min.y+(i+1)/n.yScale);for(let i=o.y;i<=Math.min(l.y+1,s-1);++i)for(let a=o.x;a<=Math.min(l.x+1,s-1);++a)255===mb[i*s+a]&&(mb[i*s+a]=0,_+=r.getElevationAtPixel(a,i),g++)}let y=_/g;d=Math.max(1,o.x-c),p=Math.max(1,o.y-c),f=Math.min(h.x+c,s-2),m=Math.min(h.y+c,s-2),l=!0;for(let i=p;i<=m;++i)for(let a=d;a<=f;++a)0===mb[i*s+a]&&(mv[i*s+a]=r._dem.set(a,i,y));for(let i=1;i<c;++i){d=Math.max(1,o.x-i),p=Math.max(1,o.y-i),f=Math.min(h.x+i,s-2),m=Math.min(h.y+i,s-2);for(let a=p;a<=m;++a)for(let n=d;n<=f;++n){let o=a*s+n;if(255===mb[o]){let l=0,h=0,u=-1,d=-1;for(let r=-1;r<=1;++r)for(let o=-1;o<=1;++o){let c=(a+r)*s+n+o;if(mb[c]>=i)continue;let p=mv[c],f=Math.abs(p);f>h&&(l=p,h=f,u=o,d=r)}if(h>.1){let s=1-(i+.5*Math.abs(u*d))/c,h=r._dem.get(n,a)+l*s,p=r._dem.get(n+u,a+d),f=r._dem.get(n-u,a-d,!0);(h-p)*(h-f)>0&&(h=(p+f)/2),mv[o]=r._dem.set(n,a,h),mb[o]=i}}}}}l&&(r._demTile.needsDEMTextureUpload=!0,r._dem._timestamp=tj.now())}setFilter(i){this.filter=i?os(i):null}getNodesInfo(){return this.filter?this.nodesInfo.filter(i=>this.filter.filter(new n0(this.id.overscaledZ,{worldview:this.worldview}),i.feature,this.id.canonical)):this.nodesInfo}destroy(){for(let i of this.getNodesInfo())dp(i.node),dm(i.node)}isEmpty(){return!this.nodesInfo.length}updateReplacement(i,r){if(r.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=r.updateTime;let a=r.getReplacementRegionsForTile(i.toUnwrapped());for(let i of this.getNodesInfo()){let r=i.node.footprint;i.hiddenByReplacement=!!r&&!a.some(i=>i.footprint===r)}}getHeightAtTileCoord(i,r){let a=[0,0,0],n=et([]);for(let o of this.getNodesInfo()){let s=o.node.meshes[0],l=s.transformedAabb;if(i<l.min[0]||r<l.min[1]||i>l.max[0]||r>l.max[1])continue;if(!0===o.node.hidden)return{height:1/0,maxHeight:o.feature.properties.height,hidden:!1,verticalScale:o.evaluatedScale[2]};if(ei(n,o.node.globalMatrix),a[0]=i,a[1]=r,a[2]=0,eL(a,a,n),o.node.meshBVH){let i=a[0],r=a[1];mw[0]=i-1,mw[1]=r-1,mw[2]=-1e3,mT[0]=i+1,mT[1]=r+1,mT[2]=1e3;let n=o.node.meshBVH.findHighestPoint(mw,mT);if(null!==n)return{height:n,maxHeight:o.feature.properties.height,hidden:o.hiddenByReplacement,verticalScale:o.evaluatedScale[2]};continue}let h=(a[0]-s.aabb.min[0])/(s.aabb.max[0]-s.aabb.min[0])*64|0,u=64*Math.min(63,(a[1]-s.aabb.min[1])/(s.aabb.max[1]-s.aabb.min[1])*64|0)+Math.min(63,h),c=s.heightmap[u];if(c<0&&o.node.footprint){let a=[];if(o.node.footprint.grid.query(new e8(i,r),new e8(i,r),a),a.length>0)return{height:void 0,maxHeight:o.feature.properties.height,hidden:o.hiddenByReplacement,verticalScale:o.evaluatedScale[2]};continue}if(o.hiddenByReplacement)return;return{height:c,maxHeight:o.feature.properties.height,hidden:!1,verticalScale:o.evaluatedScale[2]}}}}function mA(i,r){return i instanceof ni&&!i.isLightConstant&&r}function mM(i,r,a,n,o,s,l,h){let u,c,d,p,f=(61440&r|(61440&r)>>4)>>8,m=(3840&r|(3840&r)>>4)>>4,_=240&r|(240&r)>>4;a[3]>0&&(f=iE(f,255*a[0],a[3]),m=iE(m,255*a[1],a[3]),_=iE(_,255*a[2],a[3]));let g=(15&r|(15&r)<<4)/255;f*=g,m*=g,_*=g;let y=f<<8|m,x=_<<8|Math.floor(255*n[3]),v=Math.min(Math.round(.5*tl(n[2],0,2)*255),255)<<8|15*n[0]<<4|15*n[1],b=tl(o[0],0,1),w=tl(o[1],0,1),T=tl(o[2],0,1),S=tl(
7o[3],0,1);if(b!==w&&l!==s&&w!==b){let i=l-s;c=1/(i*(w-b)),d=-(s+i*b)/(i*(w-b)),p=Math.pow(10,tl(o[4],-1,1)),u=255*T<<8|255*S}else u=65535,c=0,d=1,p=1;if(i.emplaceBack(y,x,v,u,c,d,p),h){let i=h.length;h.clear();for(let r=0;r<i;r++)h.emplaceBack(y,x,v,u,c,d,p)}}nl(mI,"Tiled3dModelBucket",{omit:["layers"]}),nl(mE,"Tiled3dModelFeature");let mC=["id","tile","layer","source","sourceLayer","state"];class mP{constructor(i,r,a,n,o){this.type="Feature",this._vectorTileFeature=i,this._z=r,this._x=a,this._y=n,this.properties=i?i.properties:{},this.id=o}clone(){let i=new mP(this._vectorTileFeature,this._z,this._x,this._y,this.id);return this.state&&(i.state=Object.assign({},this.state)),this.layer&&(i.layer=Object.assign({},this.layer)),this.source&&(i.source=this.source),this.sourceLayer&&(i.sourceLayer=this.sourceLayer),i}get geometry(){return void 0===this._geometry&&this._vectorTileFeature&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._x,this._y,this._z).geometry),this._geometry}set geometry(i){this._geometry=i}toJSON(){let i={type:"Feature",state:void 0,geometry:this.geometry,properties:this.properties};for(let r of mC)void 0!==this[r]&&(i[r]=this[r]);return i}}class mD extends iv{constructor(i,r,a,n){super(),this.id=i,this.type="model",this.models=[],this._options=r,this._modelsInfo=new Map,this._abortController=null}cancelModelRequests(){this._abortController&&(this._abortController.abort(),this._abortController=null)}loadGLTFFromURI(i,r){return cq(this.map._requestManager.transformRequest(i,t4.Model).url,r)}async loadModel(i,r,a){try{let n=await this.loadGLTFFromURI(r.uri,a);if(a.aborted)return;let o=this._modelsInfo.get(i);if(!o)return;let s=dT(n),l=o.modelSpec,h=new dl(i,l.uri,l.position,l.orientation,s);mD.applyModelSpecification(h,l),h.computeBoundsAndApplyParent(),this.models.push(h),o.model=h}catch(n){if(n instanceof Error&&"AbortError"===n.name)return;let a=n instanceof Error?n.message:"Unknown error";this.fire(new ig(Error(`Could not load model ${i} from ${r.uri}: ${a}`)))}}async load(){this._abortController||(this._abortController=new AbortController);let i=this._abortController.signal,r=[];for(let a in this._options.models){let n=this._options.models[a],o=this._modelsInfo.get(a);if(o&&o.model){o.modelSpec=n;let i=o.model;i.position=null!=n.position?new s1(n.position[0],n.position[1]):new s1(0,0),i.orientation=null!=n.orientation?n.orientation:[0,0,0],mD.applyModelSpecification(i,n),i.computeBoundsAndApplyParent(),this.models.push(i)}else o?o.modelSpec=n:(this._modelsInfo.set(a,{modelSpec:n,model:null}),r.push(this.loadModel(a,n,i)))}0!==r.length?(await Promise.allSettled(r),i.aborted||this.fire(new i_("data",{dataType:"source",sourceDataType:"metadata"}))):this.loaded()&&this.fire(new i_("data",{dataType:"source",sourceDataType:"metadata"}))}static applyModelSpecification(i,r){r.nodeOverrides&&mD.convertNodeOverrides(i,r.nodeOverrides),r.materialOverrides&&mD.convertMaterialOverrides(i,r.materialOverrides),r.nodeOverrideNames&&(i.nodeOverrideNames=[...r.nodeOverrideNames]),r.materialOverrideNames&&(i.materialOverrideNames=[...r.materialOverrideNames]),r.featureProperties&&(i.featureProperties=r.featureProperties)}static convertNodeOverrides(i,r){if(Array.isArray(r)&&r.every(i=>"string"==typeof i))for(let a of(i.nodeOverrideNames=[],r))i.nodeOverrideNames.push(a);else Object.entries(r).forEach(([r,a])=>{let n={orientation:[0,0,0]};if(Object.hasOwn(a,"orientation")){let i=a.orientation;i&&(n.orientation=i)}i.nodeOverrides.set(r,n)})}static convertMaterialOverrides(i,r){if(Array.isArray(r)&&r.every(i=>"string"==typeof i))for(let a of(i.materialOverrideNames=[],r))i.materialOverrideNames.push(a);else Object.entries(r).forEach(([r,a])=>{let n={color:new iI(1,1,1),colorMix:0,emissionStrength:0,opacity:1},o=a["model-color"];void 0!==o&&(n.color.r=o[0],n.color.g=o[1],n.color.b=o[2]);let s=a["model-color-mix-intensity"];void 0!==s&&(n.colorMix=s);let l=a["model-emissive-strength"];void 0!==l&&(n.emissionStrength=l);let h=a["model-opacity"];void 0!==h&&(n.opacity=h),i.materialOverrides.set(r,n)})}onAdd(i){this.map=i,this.load()}hasTransition(){return!1}loaded(){if(0===this._modelsInfo.size)return!0;for(let i of this._modelsInfo.values())if(null==i.model)return!1;return!0}getModels(){return this.models}loadTile(i,r){}serialize(){return this._options}setProperty(i,r){return!1}reload(){this.cancelModelRequests();let i=om(this.id,this.scope);this.map.style.clearSource(i),this.models=[],this._modelsInfo.clear(),this.load()}onRemove(i){this.cancelModelRequests()}setModels(i){this.models=[];let r=new Map;for(let a in i){let n=i[a],o=this._modelsInfo.get(a);o&&o.modelSpec.uri===n.uri&&r.set(a,o)}if(this._modelsInfo.size!==r.size)for(let[i,a]of(this.cancelModelRequests(),r))a.model||r.delete(i);this._modelsInfo=r,this._options.models=i,this.load()}}function mR(i,r,a,n){let o=1<<i.z;r.lat=s8((n/8192+i.y)/o),r.lng=s6((a/8192+i.x)/o)}let mz={circle:class extends ow{constructor(i,r,a,n){super(i,{layout:m||(m=new oi({"circle-sort-key":new oe(or.layout_circle["circle-sort-key"]),"circle-elevation-reference":new n7(or.layout_circle["circle-elevation-reference"]),visibility:new n7(or.layout_circle.visibility)})),paint:_||(_=new oi({"circle-radius":new oe(or.paint_circle["circle-radius"]),"circle-color":new oe(or.paint_circle["circle-color"]),"circle-blur":new oe(or.paint_circle["circle-blur"]),"circle-opacity":new oe(or.paint_circle["circle-opacity"]),"circle-translate":new n7(or.paint_circle["circle-translate"]),"circle-translate-anchor":new n7(or.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new n7(or.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new n7(or.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new oe(or.paint_circle["circle-stroke-width"]),"circle-stroke-color":new oe(or.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new oe(or.paint_circle["circle-stroke-opacity"]),"circle-emissive-strength":new n7(or.paint_circle["circle-emissive-strength"]),"circle-color-use-theme":new oe({type:"string",default:"default","property-type":"data-driven"}),"circle-stroke-color-use-theme":new oe({type:"string",default:"default","property-type":"data-driven"})}))},r,a,n)}createBucket(i){return new lF(i)}queryRadius(i){return lW("circle-radius",this,i)+lW("circle-stroke-width",this,i)+lX(this.paint.get("circle-translate"))}queryIntersectsFeature(i,r,a,n,o,s,l,h){let u=lJ(this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),s.angle,i.pixelToTileUnitsFactor),c=this.paint.get("circle-radius").evaluate(r,a)+this.paint.get("circle-stroke-width").evaluate(r,a);return hS(i,n,s,l,h,"map"===this.paint.get("circle-pitch-alignment"),"map"===this.paint.get("circle-pitch-scale"),u,c)}getProgramIds(){return["circle"]}getDefaultProgramParams(i,r,a){let n=hT(this);return{config:new sG(this,{zoom:r,lut:a}),defines:n,overrideFog:!1}}
vendor: 5,707 bytes, line 7
7is3D(i){return!i&&!!this.layout&&"none"!==this.layout.get("circle-elevation-reference")}hasElevation(){return this.layout&&"none"!==this.layout.get("circle-elevation-reference")}},heatmap:class extends ow{createBucket(i){return new hA(i)}constructor(i,r,a,n){super(i,{layout:g||(g=new oi({visibility:new n7(or.layout_heatmap.visibility)})),paint:y||(y=new oi({"heatmap-radius":new oe(or.paint_heatmap["heatmap-radius"]),"heatmap-weight":new oe(or.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new n7(or.paint_heatmap["heatmap-intensity"]),"heatmap-color":new ot(or.paint_heatmap["heatmap-color"]),"heatmap-opacity":new n7(or.paint_heatmap["heatmap-opacity"]),"heatmap-color-use-theme":new oe({type:"string",default:"default","property-type":"data-driven"})}))},r,a,n),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(i){"heatmap-color"===i&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=hL({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(i){return lW("heatmap-radius",this,i)}queryIntersectsFeature(i,r,a,n,o,s,l,h){let u=this.paint.get("heatmap-radius").evaluate(r,a);return hS(i,n,s,l,h,!0,!0,new e8(0,0),u)}hasOffscreenPass(){return 0!==this.paint.get("heatmap-opacity")&&"none"!==this.visibility}getProgramIds(){return["heatmap","heatmapTexture"]}getDefaultProgramParams(i,r,a){return"heatmap"===i?{config:new sG(this,{zoom:r,lut:a}),overrideFog:!1}:{}}},hillshade:class extends ow{constructor(i,r,a,n){super(i,{layout:x||(x=new oi({visibility:new n7(or.layout_hillshade.visibility)})),paint:v||(v=new oi({"hillshade-illumination-direction":new n7(or.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new n7(or.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new n7(or.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new n7(or.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new n7(or.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new n7(or.paint_hillshade["hillshade-accent-color"]),"hillshade-emissive-strength":new n7(or.paint_hillshade["hillshade-emissive-strength"]),"hillshade-shadow-color-use-theme":new oe({type:"string",default:"default","property-type":"data-driven"}),"hillshade-highlight-color-use-theme":new oe({type:"string",default:"default","property-type":"data-driven"}),"hillshade-accent-color-use-theme":new oe({type:"string",default:"default","property-type":"data-driven"})}))},r,a,n)}shouldRedrape(){return this.hasOffscreenPass()&&"viewport"===this.paint.get("hillshade-illumination-anchor")}hasOffscreenPass(){return 0!==this.paint.get("hillshade-exaggeration")&&"none"!==this.visibility}getProgramIds(){return["hillshade","hillshadePrepare"]}getDefaultProgramParams(i,r,a){return{overrideFog:!1}}},fill:class extends ow{constructor(i,r,a,n){super(i,{layout:b||(b=new oi({"fill-sort-key":new oe(or.layout_fill["fill-sort-key"]),visibility:new n7(or.layout_fill.visibility),"fill-elevation-reference":new n7(or.layout_fill["fill-elevation-reference"]),"fill-construct-bridge-guard-rail":new oe(or.layout_fill["fill-construct-bridge-guard-rail"])})),paint:w||(w=new oi({"fill-antialias":new n7(or.paint_fill["fill-antialias"]),"fill-opacity":new oe(or.paint_fill["fill-opacity"]),"fill-color":new oe(or.paint_fill["fill-color"]),"fill-outline-color":new oe(or.paint_fill["fill-outline-color"]),"fill-translate":new n7(or.paint_fill["fill-translate"]),"fill-translate-anchor":new n7(or.paint_fill["fill-translate-anchor"]),"fill-pattern":new oe(or.paint_fill["fill-pattern"]),"fill-pattern-cross-fade":new n7(or.paint_fill["fill-pattern-cross-fade"]),"fill-emissive-strength":new n7(or.paint_fill["fill-emissive-strength"]),"fill-z-offset":new oe(or.paint_fill["fill-z-offset"]),"fill-bridge-guard-rail-color":new oe(or.paint_fill["fill-bridge-guard-rail-color"]),"fill-tunnel-structure-color":new oe(or.paint_fill["fill-tunnel-structure-color"]),"fill-color-use-theme":new oe({type:"string",default:"default","property-type":"data-driven"}),"fill-outline-color-use-theme":new oe({type:"string",default:"default","property-type":"data-driven"}),"fill-bridge-guard-rail-color-use-theme":new oe({type:"string",default:"default","property-type":"data-driven"}),"fill-tunnel-structure-color-use-theme":new oe({type:"string",default:"default","property-type":"data-driven"})}))},r,a,n)}getProgramIds(){let i=this.paint.get("fill-pattern"),r=i&&i.constantOr(1),a=[r?"fillPattern":"fill"];return this.paint.get("fill-antialias")&&a.push(r&&!this.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline"),a}getDefaultProgramParams(i,r,a){return{config:new sG(this,{zoom:r,lut:a}),overrideFog:!1}}recalculate(i,r){super.recalculate(i,r);let a=this.paint._values["fill-outline-color"];"constant"===a.value.kind&&void 0===a.value.value&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(i){return new uR(i)}queryRadius(){return lX(this.paint.get("fill-translate"))}queryIntersectsFeature(i,r,a,n,o,s){return!i.queryGeometry.isAboveHorizon&&lB(lY(i.tilespaceGeometry,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),s.angle,i.pixelToTileUnitsFactor),n)}isTileClipped(){return 0===this.paint.get("fill-z-offset").constantOr(1)}is3D(i){if(0!==this.paint.get("fill-z-offset").constantOr(1))return!0;
7let r=this.layout&&"none"!==this.layout.get("fill-elevation-reference");return null!=i?r&&!i:r}hasElevation(){return this.layout&&"none"!==this.layout.get("fill-elevation-reference")}hasShadowPass(){return this.layout&&"none"!==this.layout.get("fill-elevation-reference")}},"fill-extrusion":class extends ow{constructor(i,r,a,n){super(i,{layout:E||(E=new oi({visibility:new n7(or["layout_fill-extrusion"].visibility),"fill-extrusion-edge-radius":new n7(or["layout_fill-extrusion"]["fill-extrusion-edge-radius"]),"source-max-zoom":new n7(or["layout_fill-extrusion"]["source-max-zoom"])})),paint:I||(I=new oi({"fill-extrusion-opacity":new n7(or["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new oe(or["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new n7(or["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new n7(or["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new oe(or["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-pattern-cross-fade":new n7(or["paint_fill-extrusion"]["fill-extrusion-pattern-cross-fade"]),"fill-extrusion-height":new oe(or["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new oe(or["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-height-alignment":new n7(or["paint_fill-extrusion"]["fill-extrusion-height-alignment"]),"fill-extrusion-base-alignment":new n7(or["paint_fill-extrusion"]["fill-extrusion-base-alignment"]),"fill-extrusion-vertical-gradient":new n7(or["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"]),"fill-extrusion-ambient-occlusion-intensity":new n7(or["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-intensity"]),"fill-extrusion-ambient-occlusion-radius":new n7(or["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-radius"]),"fill-extrusion-ambient-occlusion-wall-radius":new n7(or["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-wall-radius"]),"fill-extrusion-ambient-occlusion-ground-radius":new n7(or["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-ground-radius"]),"fill-extrusion-ambient-occlusion-ground-attenuation":new n7(or["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-ground-attenuation"]),"fill-extrusion-flood-light-color":new n7(or["paint_fill-extrusion"]["fill-extrusion-flood-light-color"]),"fill-extrusion-flood-light-intensity":new n7(or["paint_fill-extrusion"]["fill-extrusion-flood-light-intensity"]),"fill-extrusion-flood-light-wall-radius":new oe(or["paint_fill-extrusion"]["fill-extrusion-flood-light-wall-radius"]),"fill-extrusion-flood-light-ground-radius":new oe(or["paint_fill-extrusion"]["fill-extrusion-flood-light-ground-radius"]),"fill-extrusion-flood-light-ground-attenuation":new n7(or["paint_fill-extrusion"]["fill-extrusion-flood-light-ground-attenuation"]),"fill-extrusion-vertical-scale":new n7(or["paint_fill-extrusion"]["fill-extrusion-vertical-scale"]),"fill-extrusion-rounded-roof":new n7(or["paint_fill-extrusion"]["fill-extrusion-rounded-roof"]),"fill-extrusion-cutoff-fade-range":new n7(or["paint_fill-extrusion"]["fill-extrusion-cutoff-fade-range"]),"fill-extrusion-front-cutoff":new n7(or["paint_fill-extrusion"]["fill-extrusion-front-cutoff"]),"fill-extrusion-emissive-strength":new oe(or["paint_fill-extrusion"]["fill-extrusion-emissive-strength"]),"fill-extrusion-line-width":new oe(or["paint_fill-extrusion"]["fill-extrusion-line-width"]),"fill-extrusion-cast-shadows":new n7(or["paint_fill-extrusion"]["fill-extrusion-cast-shadows"]),"fill-extrusion-color-use-theme":new oe({type:"string",default:"default","property-type":"data-driven"}),"fill-extrusion-flood-light-color-use-theme":new oe({type:"string",default:"default","property-type":"data-driven"})}))},r,a,n),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(i){return new cu(i)}queryRadius(){return lX(this.paint.get("fill-extrusion-translate"))}is3D(i){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(i,r,a,n,o,s,l,h,u){let c=lJ(this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),s.angle,i.pixelToTileUnitsFactor),d=this.paint.get("fill-extrusion-height").evaluate(r,a),p=this.paint.get("fill-extrusion-base").evaluate(r,a),f=[0,0],m=h&&s.elevation,_=s.elevation?s.elevation.exaggeration():1,g=i.tile.getBucket(this);if(g instanceof cu){let i=g.centroidData.find(i=>u>=i.vertexArrayOffset&&u<i.vertexArrayOffset+i.vertexCount);if(i&&0x40000000&i.flags)return!1;if(m){let i=g.centroidVertexArray,r=u+1;r<i.length&&(f[0]=i.geta_centroid_pos0(r),f[1]=i.geta_centroid_pos1(r))}}if(0===f[0]&&1===f[1])return!1;"globe"===s.projection.name&&(n=cy([n],[new e8(0,0),new e8(8192,8192)],i.tileID.canonical).map(i=>i.polygon).flat());let[y,x]=cM(s,n,p,d,c,l,m?h:null,f,_,s.center.lat,i.tileID.canonical),v=i.queryGeometry;return cA(y,x,v.isPointQuery()?v.screenBounds:v.screenGeometry)}},building:class extends ow{constructor(i,r,a,n){super(i,{layout:A||(A=new oi({visibility:new n7(or.layout_building.visibility),"building-facade":new oe(or.layout_building["building-facade"]),"building-facade-floors":new oe(or.layout_building["building-facade-floors"]),"building-facade-unit-width":new oe(or.layout_building["building-facade-unit-width"]),"building-facade-window":new oe(or.layout_building["building-facade-window"]),"building-roof-shape":new oe(or.layout_building["building-roof-shape"]),"building-height":new oe(or.layout_building["building-height"]),"building-base":new oe(or.layout_building["building-base"]),"building-flood-light-wall-radius":new oe(or.layout_building["building-flood-light-wall-radius"]),"building-flood-light-ground-radius":new oe(or.layout_building["building-flood-light-ground-radius"]),"building-flip-roof-orientation":new oe(or.layout_building["building-flip-roof-orientation"])})),paint:M||(M=new oi({"building-opacity":new n7(or.paint_building["building-opacity"]),"building-ambient-occlusion-intensity":new n7(or.paint_building["building-ambient-occlusion-intensity"]),"building-ambient-occlusion-ground-intensity":new n7(or.paint_building["building-ambient-occlusion-ground-intensity"]),"building-ambient-occlusion-ground-radius":new n7(or.paint_building["building-ambient-occlusion-ground-radius"]),"building-ambient-occlusion-ground-attenuation":new n7(or.paint_building["building-ambient-occlusion-ground-attenuation"]),"building-vertical-scale":new n7(or.paint_building["building-vertical-scale"]),"building-cast-shadows":new n7(or.paint_building["building-cast-shadows"]),"building-color":new oe(or.paint_building["building-color"]),"building-emissive-strength":new oe(or.paint_building["building-emissive-strength"]),"building-facade-emissive-chance":new n7(or.paint_building["building-facade-emissive-chance"]),"building-cutoff-fade-range":new n7(or.paint_building["building-cutoff-fade-range"]),"building-front-cutoff":new n7(or.paint_building["building-front-cutoff"]),"building-flood-light-color":new n7(or.paint_building["building-flood-light-color"]),"building-flood-light-intensity":new n7(or.paint_building["building-flood-light-intensity"]),"building-flood-light-ground-attenuation":new n7(or.paint_building["building-flood-light-ground-attenuation"]),"building-color-use-theme":new oe({type:"string",default:"default","property-type":"data-driven"}),"building-flood-light-color-use-theme":new oe({type:"string",default:"default","property-type":"data-driven"})}))},r,a,n),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}prepare(){return dj()}createBucket(i){return new dV(i)}cutoffRange(){return this.paint.get("building-cutoff-fade-range")}hasShadowPass(){return this.paint.get("building-cast-shadows")}hasLightBeamPass(){return!0}canCastShadows(){return!0}is3D(i){return!0}queryRadius(i){return 0}queryIntersectsFeature(i,r,a,n,o,s,l,h,u,c){let d=this.layout.get("building-height").evaluate(r,a),p=this.layout.get("building-base").evaluate(r,a),f=i.tile.getBucket(this).getFootprint(r);if(f){if(0!==f.hiddenFlags)return!1;d=f.height}let[m,_]=cM(s,n,p,d,new e8(0,0),l,null,[0,0],1,s.center.lat,i.tileID.canonical),g=i.queryGeometry;return cA(m,_,g.isPointQuery()?g.screenBounds:g.screenGeometry)}},line:class extends ow{constructor(i,r,a,n){let o=d9();super(i,o,r,a,n),o.layout&&(this.layout=new n9(o.layout)),this.gradientVersion=0,this.hasElevatedBuckets=!1,this.hasNonElevatedBuckets=!1,this.lineBlendFbos=null,this.lineBlendDensityReadback=null}_handleSpecialPaintPropertyUpdate(i){if("line-gradient"===i){let i=this._transitionablePaint._values["line-gradient"].value.expression;this.stepInterpolant=i._styleExpression&&i._styleExpression.expression instanceof at,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(i,r){super.recalculate(i,r),this.paint._values["line-floorwidth"]=(R||((R=new d7(d9().paint.properties["line-width"].specification)).useIntegerZoom=!0),R).possiblyEvaluate(this._transitioningPaint._values["line-width"].value,i)}createBucket(i){return new d0(i)}getProgramIds(){let i=[this.paint.get("line-pattern").constantOr(1)?"linePattern":"line"];return"default"!==this.paint.get("line-blend-mode")&&i.push("lineBlendComposite"),i}getDefaultProgramParams(i,r,a){if("lineBlendComposite"===i)return{};let n=d6(this);return{config:new sG(this,{zoom:r,lut:a}),defines:n,overrideFog:!1}}queryRadius(i){var r,a;return r=lW("line-width",this,i),((a=lW("line-gap-width",this,i))>0?a+2*r:r)/2+Math.abs(lW("line-offset",this,i))+lX(this.paint.get("line-translate"))}queryIntersectsFeature(i,r,a,n,o,s){var l,h;if(i.queryGeometry.isAboveHorizon)return!1;let u=lY(i.tilespaceGeometry,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),s.angle,i.pixelToTileUnitsFactor),c=i.pixelToTileUnitsFactor/2*(l=this.paint.get("line-width").evaluate(r,a),(h=this.paint.get("line-gap-width").evaluate(r,a))>0?h+2*l:l),d=this.paint.get("line-offset").evaluate(r,a);return d&&(n=function(i,r){let a=[],n=new e8(0,0);for(let o=0;o<i.length;o++){let s=i[o],l=[];for(let i=0;i<s.length;
vendor: 4,119 bytes, line 7
7i++){let a=s[i],o=s[i+1],h=0===i?n:a.sub(s[i-1])._unit()._perp(),u=i===s.length-1?n:o.sub(a)._unit()._perp(),c=h._add(u)._unit();c._mult(1/(c.x*u.x+c.y*u.y)),l.push(c._mult(r)._add(a))}a.push(l)}return a}(n,d*i.pixelToTileUnitsFactor)),function(i,r,a){for(let n=0;n<r.length;n++){let o=r[n];if(i.length>=3){for(let r=0;r<o.length;r++)if(lG(i,o[r]))return!0}if(function(i,r,a){if(i.length>1){if(lk(i,r))return!0;for(let n=0;n<r.length;n++)if(lU(r[n],i,a))return!0}for(let n=0;n<i.length;n++)if(lU(i[n],r,a))return!0;return!1}(i,o,a))return!0}return!1}(u,n,c)}isTileClipped(){return this.hasNonElevatedBuckets}isDraped(i){return!this.hasElevatedBuckets||this.layout&&"hd-road-markup"===this.layout.get("line-elevation-reference")}hasElevation(){return this.layout&&"none"!==this.layout.get("line-elevation-reference")}hasOffscreenPass(){return"default"!==this.paint.get("line-blend-mode")&&0!==this.paint.get("line-opacity").constantOr(1)&&0!==this.paint.get("line-width").constantOr(1)&&"none"!==this.visibility}resize(){this._destroyLineBlendFbo()}onRemove(i){this._destroyLineBlendFbo(i.painter&&i.painter.context&&i.painter.context.gl||void 0)}_clear(){this._destroyLineBlendFbo()}_destroyLineBlendFbo(i){this.lineBlendFbos&&(this.lineBlendFbos.destroy(),this.lineBlendFbos=null),i&&this.lineBlendDensityReadback&&this.lineBlendDensityReadback.destroy(i),this.lineBlendDensityReadback=null}},symbol:mo,background:class extends ow{constructor(i,r,a,n){super(i,{layout:O||(O=new oi({visibility:new n7(or.layout_background.visibility)})),paint:B||(B=new oi({"background-pitch-alignment":new n7(or.paint_background["background-pitch-alignment"]),"background-color":new n7(or.paint_background["background-color"]),"background-pattern":new n7(or.paint_background["background-pattern"]),"background-opacity":new n7(or.paint_background["background-opacity"]),"background-emissive-strength":new n7(or.paint_background["background-emissive-strength"]),"background-color-use-theme":new oe({type:"string",default:"default","property-type":"data-driven"})}))},r,a,n)}getProgramIds(){return[this.paint.get("background-pattern")?"backgroundPattern":"background"]}getDefaultProgramParams(i,r,a){return{overrideFog:!1}}is3D(i){return"viewport"===this.paint.get("background-pitch-alignment")}},raster:md,"raster-particle":mp,sky:class extends ow{constructor(i,r,a,n){super(i,{layout:j||(j=new oi({visibility:new n7(or.layout_sky.visibility)})),paint:G||(G=new oi({"sky-type":new n7(or.paint_sky["sky-type"]),"sky-atmosphere-sun":new n7(or.paint_sky["sky-atmosphere-sun"]),"sky-atmosphere-sun-intensity":new n7(or.paint_sky["sky-atmosphere-sun-intensity"]),"sky-gradient-center":new n7(or.paint_sky["sky-gradient-center"]),"sky-gradient-radius":new n7(or.paint_sky["sky-gradient-radius"]),"sky-gradient":new ot(or.paint_sky["sky-gradient"]),"sky-atmosphere-halo-color":new n7(or.paint_sky["sky-atmosphere-halo-color"]),"sky-atmosphere-color":new n7(or.paint_sky["sky-atmosphere-color"]),"sky-opacity":new n7(or.paint_sky["sky-opacity"]),"sky-gradient-use-theme":new oe({type:"string",default:"default","property-type":"data-driven"}),"sky-atmosphere-halo-color-use-theme":new oe({type:"string",default:"default","property-type":"data-driven"}),"sky-atmosphere-color-use-theme":new oe({type:"string",default:"default","property-type":"data-driven"})}))},r,a,n),this._updateColorRamp()}_clear(){this.skyboxFbo&&(this.skyboxFbo.destroy(),this.skyboxFbo=null),this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null),this._skyboxInvalidated=!0}_handleSpecialPaintPropertyUpdate(i){"sky-gradient"===i?this._updateColorRamp():"sky-atmosphere-sun"!==i&&"sky-atmosphere-halo-color"!==i&&"sky-atmosphere-color"!==i&&"sky-atmosphere-sun-intensity"!==i||(this._skyboxInvalidated=!0)}_updateColorRamp(){this.colorRamp=hL({expression:this._transitionablePaint._values["sky-gradient"].value.expression,evaluationKey:"skyRadialProgress"}),this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null)}needsSkyboxCapture(i){if(this._skyboxInvalidated||!this.skyboxTexture||!this.skyboxGeometry)return!0;
7if(!this.paint.get("sky-atmosphere-sun")){let r=i.style.light.properties.get("position");return this._lightPosition.azimuthal!==r.azimuthal||this._lightPosition.polar!==r.polar}return!1}getCenter(i,r){if("atmosphere"===this.paint.get("sky-type")){let a=this.paint.get("sky-atmosphere-sun"),n=!a,o=i.style.light,s=o.properties.get("position");return n&&"viewport"===o.properties.get("anchor")&&tw("The sun direction is attached to a light with viewport anchor, lighting may behave unexpectedly."),n?mm(s.azimuthal,90-s.polar,r):mm(a[0],90-a[1],r)}let a=this.paint.get("sky-gradient-center");return mm(a[0],90-a[1],r)}isSky(){return!0}markSkyboxValid(i){this._skyboxInvalidated=!1,this._lightPosition=i.style.light.properties.get("position")}hasOffscreenPass(){return!0}getProgramIds(){let i=this.paint.get("sky-type");return"atmosphere"===i?["skyboxCapture","skybox"]:"gradient"===i?["skyboxGradient"]:null}},slot:class extends ow{constructor(i,r,a,n){super(i,{paint:H||(H=new oi({}))},r,null)}},model:class extends ow{constructor(i,r,a,n){super(i,{layout:$||($=new oi({visibility:new n7(or.layout_model.visibility),"model-id":new oe(or.layout_model["model-id"]),"model-allow-density-reduction":new n7(or.layout_model["model-allow-density-reduction"])})),paint:q||(q=new oi({"model-opacity":new oe(or.paint_model["model-opacity"]),"model-rotation":new oe(or.paint_model["model-rotation"]),"model-scale":new oe(or.paint_model["model-scale"]),"model-translation":new oe(or.paint_model["model-translation"]),"model-color":new oe(or.paint_model["model-color"]),"model-color-mix-intensity":new oe(or.paint_model["model-color-mix-intensity"]),"model-type":new n7(or.paint_model["model-type"]),"model-cast-shadows":new n7(or.paint_model["model-cast-shadows"]),"model-receive-shadows":new n7(or.paint_model["model-receive-shadows"]),"model-ambient-occlusion-intensity":new n7(or.paint_model["model-ambient-occlusion-intensity"]),"model-emissive-strength":new oe(or.paint_model["model-emissive-strength"]),"model-roughness":new oe(or.paint_model["model-roughness"]),"model-height-based-emissive-strength-multiplier":new oe(or.paint_model["model-height-based-emissive-strength-multiplier"]),"model-cutoff-fade-range":new n7(or.paint_model["model-cutoff-fade-range"]),"model-front-cutoff":new n7(or.paint_model["model-front-cutoff"]),"model-elevation-reference":new n7(or.paint_model["model-elevation-reference"]),"model-ignore-line-cutout":new n7(or.paint_model["model-ignore-line-cutout"]),"model-color-use-theme":new oe({type:"string",default:"default","property-type":"data-driven"})}))},r,a,n),this.layer=i,this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(i){return new my(i)}getProgramIds(){return["model"]}is3D(i){return!0}hasShadowPass(){return!0}canCastShadows(){return!0}hasLightBeamPass(){return!0}cutoffRange(){return this.paint.get("model-cutoff-fade-range")}queryRadius(i){return 8191*(i instanceof mI)}queryRenderedFeatures(i,r,a){let n=r.getSource();if(!(n&&n instanceof mD))return{};let o={};o[this.id]=[];let s=o[this.id],l=0;for(let o of n.models){let n=r.getFeatureState(this.sourceLayer,o.id),h={type:"Unknown",id:o.id,properties:o.featureProperties},u=this.paint.get("model-rotation").evaluate(h,n),c=this.paint.get("model-scale").evaluate(h,n),d=this.paint.get("model-translation").evaluate(h,n),p=this.paint.get("model-elevation-reference"),f=[];ds(f,o,a,o.position,u,c,d,"ground"===p,"ground"===p,!1),"globe"===a.projection.name&&(f=dr(f,a));let m=er([],a.projMatrix,f),_=da(i.isPointQuery()?i.screenBounds:i.screenGeometry,a,m,o.aabb);if(null!=_){let i=new mP(void 0,0,0,0,o.id);i.layer=this.layer,i.properties=structuredClone(o.featureProperties),i.properties.layer=this.id,i.properties.uri=o.uri,i.properties.orientation=o.orientation,i.sourceLayer=this.sourceLayer,i.geometry={type:"Point",coordinates:[o.position.lng,o.position.lat]},i.state=n,i.source=this.source,s.push({featureIndex:l,feature:i,intersectionZ:_})}++l}return o}queryIntersectsFeature(i,r,a,n,o,s,l,h,u,c){if(!this.modelManager)return!1;let d=this.modelManager,p=i.tile.getBucket(this);if(!(p&&p instanceof my))return!1;for(let a in p.instancesPerModel){let n=p.instancesPerModel[a],o=void 0!==r.id?r.id:r.properties&&Object.hasOwn(r.properties,"id")?r.properties.id:void 0;if(Object.hasOwn(n.idToFeaturesIndex,o)){let r=n.features[n.idToFeaturesIndex[o]],l=d.getModel(a,c||this.scope);if(!l)return!1;let h=[],u=new s1(0,0),f=p.canonical,m=Number.MAX_VALUE;for(let a=0;a<r.instancedDataCount;++a){let o=16*(r.instancedDataOffset+a),c=n.instancedDataArray.float32,d=[c[o+4],c[o+5],c[o+6]];mR(f,u,Math.floor(c[o]),Math.floor(c[o+1])),ds(h,l,s,u,r.rotation,r.scale,d,!1,!1,!1),"globe"===s.projection.name&&(h=dr(h,s));let p=er([],s.projMatrix,h),_=i.queryGeometry,g=da(_.isPointQuery()?_.screenBounds:_.screenGeometry,s,p,l.aabb);null!=g&&(m=Math.min(g,m))}return m!==Number.MAX_VALUE&&m}}return!1}_handleOverridablePaintPropertyUpdate(i,r,a){return!(!this.layout||r.isDataDriven()||a.isDataDriven()||"model-color"!==i&&"model-color-mix-intensity"!==i&&"model-rotation"!==i&&"model-scale"!==i&&"model-translation"!==i&&"model-emissive-strength"!==i)}_isPropertyZoomDependent(i){let r=this._transitionablePaint._values[i];return null!=r&&null!=r.value&&null!=r.value.expression&&r.value.expression instanceof nr}isZoomDependent(){return this._isPropertyZoomDependent("model-scale")||this._isPropertyZoomDependent("model-rotation")||this._isPropertyZoomDependent("model-translation")}},clip:class extends ow{constructor(i,r,a,n){super(i,{layout:T||(T=new oi({"clip-layer-types":ne
7w n7(or.layout_clip["clip-layer-types"]),"clip-layer-scope":new n7(or.layout_clip["clip-layer-scope"]),visibility:new n7(or.layout_clip.visibility)})),paint:S||(S=new oi({}))},r,a,n)}recalculate(i,r){super.recalculate(i,r)}createBucket(i){return new uF(i)}is3D(i){return!0}}};class mL{constructor(i){this.capacity=i,this.cache=new Map}get(i){if(!this.cache.has(i))return;let r=this.cache.get(i);return this.cache.delete(i),this.cache.set(i,r),r}put(i,r){this.cache.has(i)?this.cache.delete(i):this.cache.size===this.capacity&&this.cache.delete(this.cache.keys().next().value),this.cache.set(i,r)}delete(i){this.cache.delete(i)}}nl(mL,"LRUCache");class mF{constructor(i){this._callback=i,this._triggered=!1,"undefined"!=typeof MessageChannel&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._callback()},0))}remove(){this._channel=void 0,this._callback=()=>{}}}class mO{constructor(i){this._stringToNumber={},this._numberToString=[];for(let r=0;r<i.length;r++){let a=i[r];this._stringToNumber[a]=r,this._numberToString[r]=a}}encode(i){return this._stringToNumber[i]}decode(i){return this._numberToString[i]}}class mB{constructor(i,r){this.tileID=i,this.x=i.canonical.x,this.y=i.canonical.y,this.z=i.canonical.z,this.grid=new no(8192,8192,512),this.featureIndexArray=new sc,this.promoteId=r,this.is3DTile=!1,this.serializedLayersCache=new Map}insert(i,r,a,n,o,s=0,l=0){let h=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(a,n,o,s);let u=this.grid;for(let i=0;i<r.length;i++){let a=r[i],n=[1/0,1/0,-1/0,-1/0];for(let i=0;i<a.length;i++){let r=a[i];n[0]=Math.min(n[0],r.x),n[1]=Math.min(n[1],r.y),n[2]=Math.max(n[2],r.x),n[3]=Math.max(n[3],r.y)}0!==l&&(n[0]-=l,n[1]-=l,n[2]+=l,n[3]+=l),n[0]<8192&&n[1]<8192&&n[2]>=0&&n[3]>
7=0&&u.insert(h,n[0],n[1],n[2],n[3])}}loadVTLayers(){if(!this.vtLayers)for(let i in this.vtLayers=new ld(new p_(this.rawTileData)).layers,this.sourceLayerCoder=new mO(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"]),this.vtFeatures={},this.vtLayers)this.vtFeatures[i]=[];return this.vtLayers}query(i,r){let a,{tilespaceGeometry:n,transform:o,tileTransform:s,pixelPosMatrix:l,availableImages:h,worldview:u}=r;this.loadVTLayers(),this.serializedLayersCache.clear();let c=r.queryRadius?r.queryRadius:0,d=n.bufferedTilespaceBounds,p=this.grid.queryKeys(d.min.x,d.min.y,d.max.x,d.max.y,(i,r,a,o)=>lH(n.bufferedTilespaceGeometry,i-c,r-c,a+c,o+c));p.sort(mN);let f=null;o.elevation&&p.length>0&&(f=mx.create(o.elevation,this.tileID));let m={};for(let c=0;c<p.length;c++){let d=p[c];if(d===a)continue;a=d;let _=this.featureIndexArray.get(d),g=null;this.is3DTile?this.loadMatchingModelFeature(m,_,i,n,o,u):this.loadMatchingFeature(m,_,i,h,u,(i,a,h,u=0)=>(g||(g=lo(i,this.tileID.canonical,s)),a.queryIntersectsFeature(n,i,h,g,this.z,o,l,f,u,r.scope)))}return m}loadMatchingFeature(i,r,a,n,o,s){let{featureIndex:l,bucketIndex:h,sourceLayerIndex:u,layoutVertexArrayOffset:c}=r,d=this.bucketLayerIDs[h],p=a.layers,f=Object.keys(p);if(f.length&&!tv(f,d))return;let m=a.sourceCache,_=this.sourceLayerCoder.decode(u),g=this.vtLayers[_].feature(l),y=this.getId(g,_);for(let r=0;r<d.length;r++){let a=d[r];if(!p[a])continue;let{styleLayer:h,targets:u}=p[a],f={};void 0!==y&&(f=m.getFeatureState(h.sourceLayer,y));let _=!s||s(g,h,f,c);if(!_)continue;let x=new mP(g,this.z,this.x,this.y,y);x.tile=this.tileID.canonical,x.state=f;let v=this.serializedLayersCache.get(a);v||((v=h.serialize()).id=a,this.serializedLayersCache.set(a,v)),x.source=v.source,x.sourceLayer=v["source-layer"],x.layer=Object.assign({},v),x.layer.paint=mk(v.paint,h.paint,g,f,n),x.layer.layout=mk(v.layout,h.layout,g,f,n);let b=!1;for(let i of u){this.updateFeatureProperties(x,i);let{filter:r}=i;if(r){if(g.properties=x.properties,r.needGeometry){let i=ls(g,!0);if(!r.filter(new n0(this.tileID.overscaledZ,{worldview:o}),i,this.tileID.canonical))continue}else if(!r.filter(new n0(this.tileID.overscaledZ,{worldview:o}),g))continue}b=!0,i.targetId&&this.addFeatureVariant(x,i)}b&&this.appendToResult(i,a,l,x,_)}}loadMatchingModelFeature(i,r,a,n,o,s){let{featureIndex:l,bucketIndex:h}=r,u=this.bucketLayerIDs[h],c=a.layers,d=Object.keys(c);if(!d.length||tv(d,u))for(let r=0;r<u.length;r++){let h=u[r],{styleLayer:d,targets:p}=c[h];if("model"!==d.type)continue;let f=n.tile,m=f.getBucket(d);if(!(m&&m instanceof mI))continue;let _=function(i,r,a,n){let o=i.getNodesInfo()[r];if(!o||o.hiddenByReplacement||!o.node.meshes)return;let s=Number.MAX_VALUE,l=o.node,h=a.tile,u=n.calculatePosMatrix(h.tileID.toUnwrapped(),n.worldSize),c=o.evaluatedScale,d=0;n.elevation&&l.elevation&&(d=l.elevation*n.elevation.exaggeration()),ea(u,u,[(l.anchor?l.anchor[0]:0)*(c[0]-1),(l.anchor?l.anchor[1]:0)*(c[1]-1),d]),en(u,u,c);let p=a.queryGeometry,f=p.isPointQuery()?p.screenBounds:p.screenGeometry,m=function(i){let r=er([],u,i.globalMatrix);er(r,n.expandedFarZProjMatrix,r);for(let a=0;a<i.meshes.length;++a){let o=i.meshes[a];if(a===i.lightMeshIndex)continue;let l=da(f,n,r,o.aabb);null!=l&&(s=Math.min(l,s))}if(i.children)for(let r of i.children)m(r)};if(m(l),s===Number.MAX_VALUE)return;let _=new s1(0,0);return mR(h.tileID.canonical,_,o.node.anchor[0],o.node.anchor[1]),{intersectionZ:s,position:_,feature:o.feature}}(m,l,n,o);if(!_)continue;let{z:g,x:y,y:x}=f.tileID.canonical,{feature:v,intersectionZ:b,position:w}=_,T={};void 0!==v.id&&(T=a.sourceCache.getFeatureState(d.sourceLayer,v.id));let S=new mP({},g,y,x,v.id);S.tile=this.tileID.canonical,S.state=T,S.properties=v.properties,S.geometry={type:"Point",coordinates:[w.lng,w.lat]};let E=this.serializedLayersCache.get(h);E||((E=d.serialize()).id=h,this.serializedLayersCache.set(h,E)),S.source=E.source,S.sourceLayer=E["source-layer"],S.layer=Object.assign({},E);let I=!1;for(let i of p){this.updateFeatureProperties(S,i);let{filter:r}=i;if(r){if(v.properties=S.properties,r.needGeometry){if(!r.filter(new n0(this.tileID.overscaledZ,{worldview:s}),v,this.tileID.canonical))continue}else if(!r.filter(new n0(this.tileID.overscaledZ,{worldview:s}),v))continue}I=!0,i.targetId&&this.addFeatureVariant(S,i)}I&&this.appendToResult(i,h,l,S,b)}}updateFeatureProperties(i,r,a){if(r.properties){let n={};for(let o in r.properties){let s=r.properties[o].evaluate({zoom:this.z},i._vectorTileFeature,i.state,i.tile,a);null!=s&&(n[o]=s)}i.properties=n}}addFeatureVariant(i,r,a){let n={target:r.target,namespace:r.namespace,uniqueFeatureID:r.uniqueFeatureID};r.properties&&(n.properties=i.properties),i.variants=i.variants||{},i.variants[r.targetId]=i.variants[r.targetId]||[],i.variants[r.targetId].push(n)}appendToResult(i,r,a,n,o){let s=i[r];void 0===s&&(s=i[r]=[]),s.push({featureIndex:a,feature:n,intersectionZ:o})}lookupSymbolFeatures(i,r,a,n,o,s){let l={};
7for(let h of(this.loadVTLayers(),i))this.loadMatchingFeature(l,{bucketIndex:r,sourceLayerIndex:a,featureIndex:h,layoutVertexArrayOffset:0},n,o,s);return l}loadFeature(i){let{featureIndex:r,sourceLayerIndex:a}=i;this.loadVTLayers();let n=this.sourceLayerCoder.decode(a),o=this.vtFeatures[n];if(o[r])return o[r];let s=this.vtLayers[n].feature(r);return o[r]=s,s}hasLayer(i){for(let r of this.bucketLayerIDs)for(let a of r)if(i===a)return!0;return!1}getId(i,r){let a=i.id;if(this.promoteId){let n=Array.isArray(this.promoteId)||"object"!=typeof this.promoteId?this.promoteId:this.promoteId[r];if(null!=n)if(Array.isArray(n)){if(!this.promoteIdExpression){let i=nt(n);if("success"!==i.result){let r=i.value.map(i=>`${i.key}: ${i.message}`).join(", ");return void tw(`Failed to create expression for promoteId: ${r}`)}this.promoteIdExpression=i.value}a=this.promoteIdExpression.evaluate({zoom:0},i)}else a=i.properties[n];"boolean"==typeof a&&(a=Number(a))}return a}}function mk(i,r,a,n,o){return tg(i,(i,s)=>{let l=r instanceof n9?r.get(s):null;return l&&l.evaluate?l.evaluate(a,n,void 0,o):l})}function mN(i,r){return r-i}function mU(i,r){let a={};if(!r)return a;for(let n of i){let i=n.layerIds.map(i=>r.getLayer(i)).filter(Boolean);if(0!==i.length)for(let r of(n.layers=i,n.stateDependentLayerIds&&(n.stateDependentLayers=n.stateDependentLayerIds.map(r=>i.filter(i=>i.id===r)[0])),n.updateExpressions&&n.updateExpressions(i),i))a[r.fqid]=n}return a}nl(mB,"FeatureIndex",{omit:["rawTileData","sourceLayerCoder"]});let mV=new Uint16Array(8184);for(let i=0;i<2046;i++){let r=i+2,a=0,n=0,o=0,s=0,l=0,h=0;for(1&r?o=s=l=32:a=n=h=32;(r>>=1)>1;){let i=a+o>>1,u=n+s>>1;1&r?(o=a,s=n,a=l,n=h):(a=o,n=s,o=l,s=h),l=i,h=u}let u=4*i;mV[u+0]=a,mV[u+1]=n,mV[u+2]=o,mV[u+3]=s}let mj=new Uint16Array(2178),mG=new Uint8Array(1089),mH=new Uint16Array(1089);function m$(i){return 0===i?-.03125:.03125*(32===i)}let mq={Other:0,Symbol:1,FillExtrusion:2},mZ={type:2,extent:8192,loadGeometry:()=>[[new e8(0,0),new e8(8193,0),new e8(8193,8193),new e8(0,8193),new e8(0,0)]]};class mW{constructor(){this.tasks={},this.taskQueue=[],t_(["process"],this),this.invoker=new mF(this.process),this.nextId=0}add(i,r){let a=this.nextId++,n=function({type:i,renderSourceType:r,zoom:a}){a=a||0;let n=r===mq.Symbol;return"message"===i?0:"maybePrepare"!==i||n?"parseTile"!==i||n?"parseTile"===i&&n?300-a:"maybePrepare"===i&&n?400-a:500:200-a:100-a}(r);return 0===n?(i(),null):(this.tasks[a]={fn:i,metadata:r,priority:n,id:a},this.taskQueue.push(a),this.invoker.trigger(),{cancel:()=>{delete this.tasks[a]}})}process(){{if(this.taskQueue=this.taskQueue.filter(i=>!!this.tasks[i]),!this.taskQueue.length)return;let i=this.pick();if(null===i)return;let r=this.tasks[i];if(delete this.tasks[i],this.taskQueue.length&&this.invoker.trigger(),!r)return;r.fn()}}pick(){let i=null,r=1/0;for(let a=0;a<this.taskQueue.length;a++){let n=this.tasks[this.taskQueue[a]];n.priority<r&&(r=n.priority,i=a)}if(null===i)return null;let a=this.taskQueue[i];return this.taskQueue.splice(i,1),a}remove(){this.invoker.remove()}}function mX(i,r,a){try{r=function(i){if(!i.variants)return i;if(!Array.isArray(i.variants))throw Error("variants must be an array");for(let r of i.variants){if(null==r||"object"!=typeof r||r.constructor!==Object)throw Error("variant must be an object");if(!Array.isArray(r.capabilities))throw Error("capabilities must be an array");if(1===r.capabilities.length&&"meshopt"===r.capabilities[0])return Object.assign(i,r)}return i}(r)}catch(i){return Error("Failed to process TileJSON variants",{cause:i})}let n=td(Object.assign({},r,i),["tilejson","tiles","minzoom","maxzoom","attribution","mapbox_logo","bounds","extra_bounds","scheme","tileSize","encoding","vector_layers","raster_layers","worldview_options","worldview_default","worldview"]);return i.url&&r.tiles&&i.tiles&&(n.tiles=r.tiles),n.tiles=a.canonicalizeTileset(n,i.url),n}let mY=new Map,mJ=new Map;class mK{constructor(i){this.size=i,this.minimums=[],this.maximums=[],this.leaves=[]}getElevation(i,r){let a=this.toIdx(i,r);return{min:this.minimums[a],max:this.maximums[a]}}isLeaf(i,r){return this.leaves[this.toIdx(i,r)]}toIdx(i,r){return r*this.size+i}}function mQ(i,r,a,n){let o=0,s=Number.MAX_VALUE;for(let l=0;l<3;l++)if(1e-15>Math.abs(n[l])){if(a[l]<i[l]||a[l]>r[l])return null}else{let h=1/n[l],u=(i[l]-a[l])*h,c=(r[l]-a[l])*h;if(u>c){let i=u;u=c,c=i}if(u>o&&(o=u),c<s&&(s=c),o>s)return null}return o}function m0(i,r,a,n,o,s,l,h,u,c,d){let p=n-i,f=o-r,m=s-a,_=l-i,g=h-r,y=u-a,x=d[1]*y-d[2]*g,v=d[2]*_-d[0]*y,b=d[0]*g-d[1]*_,w=p*x+f*v+m*b;if(1e-15>Math.abs(w))return null;let T=1/w,S=c[0]-i,E=c[1]-r,I=c[2]-a,A=(S*x+E*v+I*b)*T;if(A<0||A>1)return null;let M=E*m-I*f,C=I*p-S*m,P=S*f-E*p,D=(d[0]*M+d[1]*C+d[2]*P)*T;return D<0||A+D>1?null:(_*M+g*C+y*P)*T}function m1(i,r,a,n,o,s,l,h,u){let c=1<<a,d=s-n,p=l-o;h[0]=(i+0)/c*d+n,h[1]=(r+0)/c*p+o,u[0]=(i+1)/c*d+n,u[1]=(r+1)/c*p+o}class m2{constructor(i){if(this.maximums=[],this.minimums=[],this.leaves=[],this.childOffsets=[],this.nodeCount=0,this.dem=i,this._siblingOffset=[[0,0],[1,0],[0,1],[1,1]],!this.dem)return;let r=function(i){let r=Math.ceil(Math.log2(i.dim/8)),a=[],n=Math.ceil(Math.pow(2,r)),o=1/n,s=(i,r,a,n,o)=>{let s=+!!n;o[0]=i*a,o[1]=r*a,o[2]=(i+1)*a-s,o[3]=(r+1)*a-s},l=new mK(n),h=[];for(let r=0;r<n*n;r++){s(r%n,Math.floor(r/n),o,!1,h);let a=m5(h[0],h[1],i),u=m5(h[2],h[1],i),c=m5(h[2],h[3],i),d=m5(h[0],h[3],i);l.minimums.push(Math.min(a,u,c,d)),l.maximums.push(Math.max(a,u,c,d)),l.leaves.push(1)}for(a.push(l),n/=2;n>=1;n/=2){let i=a.at(-1);l=new mK(n);for(let r=0;r<n*n;r++){s(r%n,Math.floor(r/n),2,!0,h);let a=i.getElevation(h[0],h[1]),o=i.getElevation(h[2],h[1]),u=i.getElevation(h[2],h[3]),c=i.getElevation(h[0],h[3]),d=i.isLeaf(h[0],h[1]),p=i.isLeaf(h[2],h[1]),f=i.isLeaf(h[2],h[3]),m=i.isLeaf(h[0],h[3]),_=Math.min(a.min,o.min,u.min,c.min),g=Math.max(a.max,o.max,u.max,c.max),y=d&&p&&f&&m;l.maximums.push(g),l.minimums.push(_),l.leaves.push(g-_<=5&&y?1:0)}a.push(l)}return a}(this.dem),a=r.length-1,n=r[a];this._addNode(n.minimums[0],n.maximums[0],n.leaves[0]),this._construct(r,0,0,a,0)}
7raycastRoot(i,r,a,n,o,s,l=1){return mQ([i,r,-100],[a,n,this.maximums[0]*l],o,s)}raycast(i,r,a,n,o,s,l=1){if(!this.nodeCount)return null;let h=this.raycastRoot(i,r,a,n,o,s,l);if(null==h)return null;let u=[],c=[],d=[],p=[],f=[{idx:0,t:h,nodex:0,nodey:0,depth:0}];for(;f.length>0;){let{idx:h,t:x,nodex:v,nodey:b,depth:w}=f.pop();if(this.leaves[h]){m1(v,b,w,i,r,a,n,d,p);let h=1<<w,u=(v+0)/h,c=(v+1)/h,f=(b+0)/h,T=(b+1)/h,S=m5(u,f,this.dem)*l,E=m5(c,f,this.dem)*l,I=m5(c,T,this.dem)*l,A=m5(u,T,this.dem)*l,M=m0(d[0],d[1],S,p[0],d[1],E,p[0],p[1],I,o,s),C=m0(p[0],p[1],I,d[0],p[1],A,d[0],d[1],S,o,s),P=Math.min(null!==M?M:Number.MAX_VALUE,null!==C?C:Number.MAX_VALUE);if(P!==Number.MAX_VALUE)return P;{var m,_,g,y;let i=eE([],o,s,x);if(m3(S,E,A,I,(m=i[0],(m-(_=d[0]))/(p[0]-_)),(g=i[1],(g-(y=d[1]))/(p[1]-y)))>=i[2])return x}continue}let T=0;for(let f=0;f<this._siblingOffset.length;f++){m1((v<<1)+this._siblingOffset[f][0],(b<<1)+this._siblingOffset[f][1],w+1,i,r,a,n,d,p),d[2]=-100,p[2]=this.maximums[this.childOffsets[h]+f]*l;let m=mQ(d,p,o,s);if(null!=m){u[f]=m;let i=!1;for(let r=0;r<T&&!i;r++)m>=u[c[r]]&&(c.splice(r,0,f),i=!0);i||(c[T]=f),T++}}for(let i=0;i<T;i++){let r=c[i];f.push({idx:this.childOffsets[h]+r,t:u[r],nodex:(v<<1)+this._siblingOffset[r][0],nodey:(b<<1)+this._siblingOffset[r][1],depth:w+1})}}return null}_addNode(i,r,a){return this.minimums.push(i),this.maximums.push(r),this.leaves.push(a),this.childOffsets.push(0),this.nodeCount++}_construct(i,r,a,n,o){if(1===i[n].isLeaf(r,a))return;this.childOffsets[o]||(this.childOffsets[o]=this.nodeCount);let s=n-1,l=i[s],h=0,u=0;for(let i=0;i<this._siblingOffset.length;i++){let n=2*r+this._siblingOffset[i][0],o=2*a+this._siblingOffset[i][1],s=l.getElevation(n,o),c=l.isLeaf(n,o),d=this._addNode(s.min,s.max,c);c&&(h|=1<<i),u||(u=d)}for(let n=0;n<this._siblingOffset.length;n++)h&1<<n||this._construct(i,2*r+this._siblingOffset[n][0],2*a+this._siblingOffset[n][1],s,u+n)}}function m3(i,r,a,n,o,s){return iE(iE(i,a,s),iE(r,n,s),o)}function m5(i,r,a){let n=a.dim,o=tl(i*n-.5,0,n-1),s=tl(r*n-.5,0,n-1),l=Math.floor(o),h=Math.floor(s),u=Math.min(l+1,n-1),c=Math.min(h+1,n-1);return m3(a.get(l,h),a.get(u,h),a.get(l,c),a.get(u,c),o-l,s-h)}let m4={mapbox:[6553.6,25.6,.1,1e4],terrarium:[256,1,1/256,32768]};function m6(i,r,a){return(256*i*256+256*r+a)/10-1e4}function m8(i,r,a){return 256*i+r+a/256-32768}class m9{get tree(){return this._tree||this._buildQuadTree(),this._tree}constructor(i,r,a,n=!1){if(this.uid=i,r.height!==r.width)throw RangeError("DEM tiles must be square");if(a&&"mapbox"!==a&&"terrarium"!==a)return void tw(`"${a}" is not a valid encoding type. Valid types include "mapbox" and "terrarium".`);this.stride=r.height;let o=this.dim=r.height-2,s=new Uint32Array(r.data.buffer);if(this.pixels=new Uint8Array(r.data.buffer),this.floatView=new Float32Array(r.data.buffer),this.borderReady=n,this._modifiedForSources={},!n){for(let i=0;i<o;i++)s[this._idx(-1,i)]=s[this._idx(0,i)],s[this._idx(o,i)]=s[this._idx(o-1,i)],s[this._idx(i,-1)]=s[this._idx(i,0)],s[this._idx(i,o)]=s[this._idx(i,o-1)];s[this._idx(-1,-1)]=s[this._idx(0,0)],s[this._idx(o,-1)]=s[this._idx(o-1,0)],s[this._idx(-1,o)]=s[this._idx(0,o-1)],s[this._idx(o,o)]=s[this._idx(o-1,o-1)]}let l="terrarium"===a?m8:m6;for(let i=0;i<s.length;++i){let r=4*i;this.floatView[i]=l(this.pixels[r],this.pixels[r+1],this.pixels[r+2])}this._timestamp=tj.now()}_buildQuadTree(){this._tree=new m2(this)}get(i,r,a=!1){a&&(i=tl(i,-1,this.dim),r=tl(r,-1,this.dim));let n=this._idx(i,r);return this.floatView[n]}set(i,r,a){let n=this._idx(i,r),o=this.floatView[n];return this.floatView[n]=a,a-o}static getUnpackVector(i){return m4[i]}_idx(i,r){if(i<-1||i>=this.dim+1||r<-1||r>=this.dim+1)throw RangeError("out of range source coordinates for DEM data");return(r+1)*this.stride+(i+1)}static pack(i,r){let a=[0,0,0,0],n=m9.getUnpackVector(r),o=Math.floor((i+n[3])/n[2]);return a[2]=o%256,o=Math.floor(o/256),a[1]=o%256,o=Math.floor(o/256),a[0]=o,a}getPixels(){return new hz({width:this.stride,height:this.stride},this.pixels)}backfillBorder(i,r,a){if(this.dim!==i.dim)throw Error("dem dimension mismatch");let n=r*this.dim,o=r*this.dim+this.dim,s=a*this.dim,l=a*this.dim+this.dim;switch(r){case -1:n=o-1;break;case 1:o=n+1}switch(a){case -1:s=l-1;break;case 1:l=s+1}let h=-r*this.dim,u=-a*this.dim;for(let r=s;r<l;r++)for(let a=n;a<o;a++){let n=4*this._idx(a,r),o=4*this._idx(a+h,r+u);this.pixels[n+0]=i.pixels[o+0],this.pixels[n+1]=i.pixels[o+1],this.pixels[n+2]=i.pixels[o+2],this.pixels[n+3]=i.pixels[o+3]}}onDeserialize(){this._tree&&(this._tree.dem=this)}}function m7(i,r,a){var n;1===i?r.headerLength=a.readFixed32():2===i?r.x=a.readVarint():3===i?r.y=a.readVarint():4===i?r.z=a.readVarint():5===i&&r.layers.push((n=a.readVarint()+a.pos,a.readFields(_a,{version:0,name:"",units:"",tileSize:0,buffer:0,pixelFormat:0,dataIndex:[]},n)))}function _e(i,r,a){var n;1===i?(n=a.readVarint()+a.pos,r.delta_filter=a.readFields(_t,{blockSize:0},n),r.filter="delta_filter"):2===i?(a.readVarint(),r.filter="zigzag_filter"):3===i?(a.readVarint(),r.filter="bitshuffle_filter"):4===i&&(a.readVarint(),r.filter="byteshuffle_filter")}function _t(i,r,a){1===i&&(r.blockSize=a.readVarint())}function _i(i,r,a){1===i?(a.readVarint(),r.codec="gzip_data"):2===i?(a.readVarint(),r.codec="jpeg_image"):3===i?(a.readVarint(),r.codec="webp_image"):4===i&&(a.readVarint(),r.codec="png_image")}function _r(i,r,a){var n,o;let s=0,l=0;1===i?r.firstByte=a.readFixed64():2===i?r.lastByte=a.readFixed64():3===i?r.filters.push((n=a.readVarint()+a.pos,a.readFields(_e,{},n))):4===i?(o=a.readVarint()+a.pos,r.codec=a.readFields(_i,{},o)):5===i?l=a.readFloat():6===i?s=a.readFloat():7===i?r.bands.push(a.readString()):8===i?r.offset=a.readDouble():9===i&&(r.scale=a.readDouble()),0===r.offset&&(r.offset=l),0===r.scale&&(r.scale=s)}function _a(i,r,a){var n;1===i?r.version=a.readVarint():2===i?r.name=a.readString():3===i?r.units=a.readString():4===i?r.tileSize=a.readVarint():5===i?r.buffer=a.readVarint():6===i?r.pixelFormat=a.readVarint():7===i&&r.dataIndex.push((n=a.readVarint()+a.pos,a.readFields(_r,{firstByte:0,lastByte:0,filters:[],codec:null,offset:0,scale:0,bands:[]},n)))}function _n(i,r,a){if(2===i){var n;n=a.readVarint()+a.pos,a.readFields(_o,r,n)}else if(3===i)throw Error("Not implemented")}function _o(i,r,a){if(1===i){let i=0,n=a.readVarint()+a.pos;for(;a.pos<n;)r[i++]=a.readVarint()}}nl(m9,"DEMData"),nl(m2,"DemMinMaxQuadTree",{omit:["dem"]});var _s=Uint8Array,_l=Uint16Array,_h=Int32Array,_u=new _s([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]),_c=new _s([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]),_d=new _s([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),_p=function(i,r){for(var a=new _l(31),n=0;n<31;++n)a[n]=r+=1<<i[n-1];var o=new _h(a[30]);for(n=1;n<30;++n)for(var s=a[n];s<a[n+1];++s)o[s]=s-a[n]<<5|n;return{b:a,r:o}},_f=_p(_u,2),_m=_f.b,__=_f.r;_m[28]=258,__[258]=28;for(var _g=_p(_c,0).b,_y=new _l(32768),_x=0;_x<32768;++_x){var _v=(43690&_x)>>1|(21845&_x)<<1;_y[_x]=((65280&(_v=(61680&(_v=(52428&_v)>>2|(13107&_v)<<2))>>4|(3855&_v)<<4))>>8|(255&_v)<<8)>>1}var _b=function(i,r,a){for(var n=i.length,o=0,s=new _l(r);o<n;++o)i[o]&&++s[i[o]-1];var l,h=new _l(r);for(o=1;o<r;++o)h[o]=h[o-1]+s[o-1]<<1;
7l=new _l(1<<r);var u=15-r;for(o=0;o<n;++o)if(i[o])for(var c=o<<4|i[o],d=r-i[o],p=h[i[o]-1]++<<d,f=p|(1<<d)-1;p<=f;++p)l[_y[p]>>u]=c;return l},_w=new _s(288);for(_x=0;_x<144;++_x)_w[_x]=8;for(_x=144;_x<256;++_x)_w[_x]=9;for(_x=256;_x<280;++_x)_w[_x]=7;for(_x=280;_x<288;++_x)_w[_x]=8;var _T=new _s(32);for(_x=0;_x<32;++_x)_T[_x]=5;var _S=_b(_w,9),_E=_b(_T,5),_I=function(i){for(var r=i[0],a=1;a<i.length;++a)i[a]>r&&(r=i[a]);return r},_A=function(i,r,a){var n=r/8|0;return(i[n]|i[n+1]<<8)>>(7&r)&a},_M=function(i,r){var a=r/8|0;return(i[a]|i[a+1]<<8|i[a+2]<<16)>>(7&r)},_C=["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"],_P=function(i,r,a){var n=Error(r||_C[i]);if(n.code=i,Error.captureStackTrace&&Error.captureStackTrace(n,_P),!a)throw n;return n},_D=new _s(0),_R="undefined"!=typeof TextDecoder&&new TextDecoder;try{_R.decode(_D,{stream:!0})}catch(i){}let _z={gzip_data:"gzip"};class _L extends Error{constructor(i){super(i),this.name="MRTError"}}let _F={0:"uint32",1:"uint32",2:"uint16",3:"uint8"},_O={uint32:1,uint16:2,uint8:4},_B={uint32:Uint32Array,uint16:Uint16Array,uint8:Uint8Array};class _k{constructor(i=5){this.x=NaN,this.y=NaN,this.z=NaN,this.layers={},this._cacheSize=i}getLayer(i){let r=this.layers[i];if(!r)throw new _L(`Layer '${i}' not found`);return r}getHeaderLength(i){let r=new Uint8Array(i),a=new DataView(i);if(13!==r[0])throw new _L("File is not a valid MRT.");return a.getUint32(1,!0)}parseHeader(i){let r=new Uint8Array(i),a=this.getHeaderLength(i);if(r.length<a)throw new _L(`Expected header with length >= ${a} but got buffer of length ${r.length}`);let n=new Z(r.subarray(0,a)).readFields(m7,{headerLength:0,x:0,y:0,z:0,layers:[]},void 0);if(!isNaN(this.x)&&(this.x!==n.x||this.y!==n.y||this.z!==n.z))throw new _L(`Invalid attempt to parse header ${n.z}/${n.x}/${n.y} for tile ${this.z}/${this.x}/${this.y}`);for(let i of(this.x=n.x,this.y=n.y,this.z=n.z,n.layers))this.layers[i.name]=new _N(i,{cacheSize:this._cacheSize});return this}createDecodingTask(i){let r=[],a=this.getLayer(i.layerName);for(let n of i.blockIndices){let o=a.dataIndex[n],s=o.firstByte-i.firstByte,l=o.lastByte-i.firstByte;if(a._blocksInProgress.has(n))continue;let h={layerName:a.name,firstByte:s,lastByte:l,pixelFormat:a.pixelFormat,blockIndex:n,blockShape:[o.bands.length].concat(a.bandShape),buffer:a.buffer,codec:o.codec.codec,filters:o.filters.map(i=>i.filter)};a._blocksInProgress.add(n),r.push(h)}return new _U(r,()=>{r.forEach(i=>a._blocksInProgress.delete(i.blockIndex))},(i,n)=>{if(r.forEach(i=>a._blocksInProgress.delete(i.blockIndex)),i)throw i;n.forEach(i=>{this.getLayer(i.layerName).processDecodedData(i)})})}}class _N{constructor({version:i,name:r,units:a,tileSize:n,pixelFormat:o,buffer:s,dataIndex:l},h){if(this.version=i,1!==this.version)throw new _L(`Cannot parse raster layer encoded with MRT version ${i}`);this.name=r,this.units=a,this.tileSize=n,this.buffer=s,this.pixelFormat=_F[o],this.dataIndex=l,this.bandShape=[n+2*s,n+2*s,_O[this.pixelFormat]],this._decodedBlocks=new mL(h?h.cacheSize:5),this._blocksInProgress=new Set}get dimension(){return _O[this.pixelFormat]}get cacheSize(){return this._decodedBlocks.capacity}getBandList(){return this.dataIndex.map(({bands:i})=>i).flat()}processDecodedData(i){let r=i.blockIndex.toString();this._decodedBlocks.get(r)||this._decodedBlocks.put(r,i.data)}getBlockForBand(i){let r=0;switch(typeof i){case"string":for(let[a,n]of this.dataIndex.entries()){for(let[o,s]of n.bands.entries())if(s===i)return{bandIndex:r+o,blockIndex:a,blockBandIndex:o};r+=n.bands.length}break;case"number":for(let[a,n]of this.dataIndex.entries()){if(i>=r&&i<r+n.bands.length)return{bandIndex:i,blockIndex:a,blockBandIndex:i-r};r+=n.bands.length}break;default:throw new _L(`Invalid band \`${JSON.stringify(i)}\`. Expected string or integer.`)}return{blockIndex:-1,blockBandIndex:-1}}getDataRange(i){let r=1/0,a=-1/0,n=[],o=new Set;for(let s of i){let{blockIndex:i}=this.getBlockForBand(s);if(i<0)throw new _L(`Invalid band: ${JSON.stringify(s)}`);let l=this.dataIndex[i];n.includes(i)||n.push(i),o.add(i),r=Math.min(r,l.firstByte),a=Math.max(a,l.lastByte)}if(o.size>this.cacheSize)throw new _L(`Number of blocks to decode (${o.size}) exceeds cache size (${this.cacheSize}).`);return{layerName:this.name,firstByte:r,lastByte:a,blockIndices:n}}hasBand(i){let{blockIndex:r}=this.getBlockForBand(i);return r>=0}hasDataForBand(i){let{blockIndex:r}=this.getBlockForBand(i);return r>=0&&!!this._decodedBlocks.get(r.toString())}getBandView(i){let{blockIndex:r,blockBandIndex:a}=this.getBlockForBand(i);if(r<0)throw new _L(`Band not found: ${JSON.stringify(i)}`);let n=this._decodedBlocks.get(r.toString());if(!n)throw new _L(`Data for band ${JSON.stringify(i)} of layer "${this.name}" not decoded.`);let o=this.dataIndex[r],s=this.bandShape.reduce((i,r)=>i*r,1),l=a*s,h=n.subarray(l,l+s);return{data:h,bytes:new Uint8Array(h.buffer).subarray(h.byteOffset,h.byteOffset+h.byteLength),tileSize:this.tileSize,buffer:this.buffer,pixelFormat:this.pixelFormat,dimension:this.dimension,offset:o.offset,scale:o.scale}}}_k.setPbf=function(i){Z=i};class _U{constructor(i,r,a){this.tasks=i,this._onCancel=r,this._onComplete=a,this._finalized=!1}cancel(){this._finalized||(this._onCancel(),this._finalized=!0)}complete(i,r){this._finalized||(this._onComplete(i,r),this._finalized=!0)}}_k.performDecoding=function(i,r){let a=new Uint8Array(i);return Promise.all(r.tasks.map(i=>{let{layerName:r,firstByte:n,lastByte:o,pixelFormat:s,blockShape:l,blockIndex:h,filters:u,codec:c}=i,d=a.subarray(n,o+1),p=new Uint32Array(l[0]*l[1]*l[2]);if("gzip_data"!==c)throw new _L(`Unhandled codec: ${c}`);return(function(i,r){var a,n,o;
7if(!globalThis.DecompressionStream&&"gzip_data"===r)return Promise.resolve(((o=function(i){31==i[0]&&139==i[1]&&8==i[2]||_P(6,"invalid gzip data");var r=i[3],a=10;4&r&&(a+=2+(i[10]|i[11]<<8));for(var n=(r>>3&1)+(r>>4&1);n>0;n-=!i[a++]);return a+(2&r)}(i))+8>i.length&&_P(6,"invalid gzip data"),function(i,r,a,n){var o,s,l=i.length;if(!l||r.f&&!r.l)return a||new _s(0);var h=!a,u=h||2!=r.i,c=r.i;h&&(a=new _s(3*l));var d=function(i){var r=a.length;if(i>r){var n=new _s(Math.max(2*r,i));n.set(a),a=n}},p=r.f||0,f=r.p||0,m=r.b||0,_=r.l,g=r.d,y=r.m,x=r.n,v=8*l;do{if(!_){p=_A(i,f,1);var b=_A(i,f+1,3);if(f+=3,!b){var w=i[(z=((f+7)/8|0)+4)-4]|i[z-3]<<8,T=z+w;if(T>l){c&&_P(0);break}u&&d(m+w),a.set(i.subarray(z,T),m),r.b=m+=w,r.p=f=8*T,r.f=p;continue}if(1==b)_=_S,g=_E,y=9,x=5;else if(2==b){var S=_A(i,f,31)+257,E=_A(i,f+10,15)+4,I=S+_A(i,f+5,31)+1;f+=14;for(var A=new _s(I),M=new _s(19),C=0;C<E;++C)M[_d[C]]=_A(i,f+3*C,7);f+=3*E;var P=_I(M),D=(1<<P)-1,R=_b(M,P);for(C=0;C<I;){var z,L=R[_A(i,f,D)];if(f+=15&L,(z=L>>4)<16)A[C++]=z;else{var F=0,O=0;for(16==z?(O=3+_A(i,f,3),f+=2,F=A[C-1]):17==z?(O=3+_A(i,f,7),f+=3):18==z&&(O=11+_A(i,f,127),f+=7);O--;)A[C++]=F}}var B=A.subarray(0,S),k=A.subarray(S);y=_I(B),x=_I(k),_=_b(B,y),g=_b(k,x)}else _P(1);if(f>v){c&&_P(0);break}}u&&d(m+131072);for(var N=(1<<y)-1,U=(1<<x)-1,V=f;;V=f){var j=(F=_[_M(i,f)&N])>>4;if((f+=15&F)>v){c&&_P(0);break}if(F||_P(2),j<256)a[m++]=j;else{if(256==j){V=f,_=null;break}var G=j-254;j>264&&(G=_A(i,f,(1<<(q=_u[C=j-257]))-1)+_m[C],f+=q);var H=g[_M(i,f)&U],$=H>>4;if(H||_P(3),f+=15&H,k=_g[$],$>3){var q=_c[$];k+=_M(i,f)&(1<<q)-1,f+=q}if(f>v){c&&_P(0);break}u&&d(m+131072);var Z=m+G;if(m<k){var W=0-k,X=Math.min(k,Z);for(W+m<0&&_P(3);m<X;++m)a[m]=n[W+m]}for(;m<Z;++m)a[m]=a[m-k]}}r.l=_,r.p=V,r.b=m,r.f=p,_&&(p=1,r.m=y,r.d=g,r.n=x)}while(!p);return m!=a.length&&h?(o=a,(null==(s=m)||s>o.length)&&(s=o.length),new _s(o.subarray(0,s))):a.subarray(0,m)}(i.subarray(o,-8),{i:2},new _s((i[(n=i.length)-4]|i[n-3]<<8|i[n-2]<<16|i[n-1]<<24)>>>0),a)));let s=_z[r];if(!s)throw Error(`Unhandled codec: ${r}`);let l=new globalThis.DecompressionStream(s);return new Response(new Blob([i]).stream().pipeThrough(l)).arrayBuffer().then(i=>new Uint8Array(i))})(d,c).then(i=>{var r;return r=new Z(i),r.readFields(_n,p),new(0,_B[s])(p.buffer)}).then(i=>{for(let r=u.length-1;r>=0;r--)switch(u[r]){case"delta_filter":!function(i,r){if(4!==r.length)throw Error(`Expected data of dimension 4 but got ${r.length}.`);let a=r[3];for(let n=2;n>=1;n--){let o=+(1===n),s=+(2===n);for(let n=0;n<r[0];n++){let l=r[1]*n;for(let n=o;n<r[1];n++){let o=r[2]*(n+l);for(let n=s;n<r[2];n++){let s=r[3]*(n+o);for(let n=0;n<r[3];n++){let r=s+n;i[r]+=i[r-a]}}}}a*=r[n]}}(i,l);break;case"zigzag_filter":var a=i;for(let i=0,r=a.length;i<r;i++)a[i]=a[i]>>>1^-(1&a[i]);break;case"bitshuffle_filter":!function(i,r){switch(r){case"uint32":return;case"uint16":for(let r=0;r<i.length;r+=2){let a=i[r],n=i[r+1];i[r]=(240&a)>>4|(61440&a)>>8|(240&n)<<4|61440&n,i[r+1]=15&a|(3840&a)>>4|(15&n)<<8|(3840&n)<<4}return;case"uint8":for(let r=0;r<i.length;r+=4){let a=i[r],n=i[r+1],o=i[r+2],s=i[r+3];i[r+0]=(192&a)>>6|(192&n)>>4|(192&o)>>2|192&s,i[r+1]=(48&a)>>4|(48&n)>>2|48&o|(48&s)<<2,i[r+2]=(12&a)>>2|12&n|(12&o)<<2|(12&s)<<4,i[r+3]=3&a|(3&n)<<2|(3&o)<<4|(3&s)<<6}return;default:throw Error(`Invalid pixel format, "${r}"`)}}(i,s);break;default:throw new _L(`Unhandled filter "${u[r]}"`)}return{layerName:r,blockIndex:h,data:i}}).catch(i=>{throw i})}))},nl(_U,"MRTDecodingBatch",{omit:["_onCancel","_onComplete"]}),nl(_k,"MapboxRasterTile"),nl(_N,"MapboxRasterLayer",{omit:["_blocksInProgress"]});let _V=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class _j{static from(i){if(!(i instanceof ArrayBuffer))throw Error("Data must be an instance of ArrayBuffer.");let[r,a]=new Uint8Array(i,0,2);if(219!==r)throw Error("Data does not appear to be in a KDBush format.");let n=a>>4;if(1!==n)throw Error(`Got v${n} data when expected v1.`);let o=_V[15&a];if(!o)throw Error("Unrecognized array type.");let[s]=new Uint16Array(i,2,1),[l]=new Uint32Array(i,4,1);return new _j(l,s,o,i)}constructor(i,r=64,a=Float64Array,n){if(isNaN(i)||i<0)throw Error(`Unpexpected numItems value: ${i}.`);this.numItems=+i,this.nodeSize=Math.min(Math.max(+r,2),65535),this.ArrayType=a,this.IndexArrayType=i<65536?Uint16Array:Uint32Array;let o=_V.indexOf(this.ArrayType),s=2*i*this.ArrayType.BYTES_PER_ELEMENT,l=i*this.IndexArrayType.BYTES_PER_ELEMENT,h=(8-l%8)%8;if(o<0)throw Error(`Unexpected typed array class: ${a}.`);n&&n instanceof ArrayBuffer?(this.data=n,this.ids=new this.IndexArrayType(this.data,8,i),this.coords=new this.ArrayType(this.data,8+l+h,2*i),this._pos=2*i,this._finished=!0):(this.data=new ArrayBuffer(8+s+l+h),this.ids=new this.IndexArrayType(this.data,8,i),this.coords=new this.ArrayType(this.data,8+l+h,2*i),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+o]),new Uint16Array(this.data,2,1)[0]=r,new Uint32Array(this.data,4,1)[0]=i)}add(i,r){let a=this._pos>>1;return this.ids[a]=a,this.coords[this._pos++]=i,this.coords[this._pos++]=r,a}finish(){let i=this._pos>>1;if(i!==this.numItems)throw Error(`Added ${i} items when expected ${this.numItems}.`);return function i(r,a,n,o,s,l){if(s-o<=n)return;let h=o+s>>1;(function i(r,a,n,o,s,l){for(;s>o;){if(s-o>600){let h=s-o+1,u=n-o+1,c=Math.log(h),d=.5*Math.exp(2*c/3),p=.5*Math.sqrt(c*d*(h-d)/h)*(u-h/2<0?-1:1);i(r,a,n,Math.max(o,Math.floor(n-u*d/h+p)),Math.min(s,Math.floor(n+(h-u)*d/h+p)),l)}let h=a[2*n+l],u=o,c=s;for(_G(r,a,o,n),a[2*s+l]>h&&_G(r,a,o,s);u<c;){for(_G(r,a,u,c),u++,c--;a[2*u+l]<h;)u++;for(;a[2*c+l]>h;)c--}a[2*o+l]===h?_G(r,a,o,c):_G(r,a,++c,s),c<=n&&(o=c+1),n<=c&&(s=c-1)}})(r,a,h,o,s,l),i(r,a,n,o,h-1,1-l),i(r,a,n,h+1,s,1-l)}(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(i,r,a,n){if(!this._finished)throw Error("Data not yet indexed - call index.finish().");let{ids:o,coords:s,nodeSize:l}=this,h=[0,o.length-1,0],u=[];for(;h.length;){let c=h.pop()||0,d=h.pop()||0,p=h.pop()||0;if(d-p<=l){for(let l=p;l<=d;l++){let h=s[2*l],c=s[2*l+1];h>=i&&h<=a&&c>=r&&c<=n&&u.push(o[l])}continue}let f=p+d>>1,m=s[2*f],_=s[2*f+1];m>=i&&m<=a&&_>=r&&_<=n&&u.push(o[f]),(0===c?i<=m:r<=_)&&(h.push(p),h.push(f-1),h.push(1-c)),(0===c?a>=m:n>=_)&&(h.push(f+1),h.push(d),h.push(1-c))}return u}within(i,r,a){if(!this._finished)throw Error("Data not yet indexed - call index.finish().");let{ids:n,coords:o,nodeSize:s}=this,l=[0,n.length-1,0],h=[],u=a*a;for(;l.length;){let c=l.pop()||0,d=l.pop()||0,p=l.pop()||0;if(d-p<=s){for(let a=p;a<=d;a++)_$(o[2*a],o[2*a+1],i,r)<=u&&h.push(n[a]);continue}let f=p+d>>1,m=o[2*f],_=o[2*f+1];_$(m,_,i,r)<=u&&h.push(n[f]),(0===c?i-a<=m:r-a<=_)&&(l.push(p),l.push(f-1),l.push(1-c)),(0===c?i+a>=m:r+a>=_)&&(l.push(f+1),l.push(d),l.push(1-c))}return h}}function _G(i,r,a,n){_H(i,a,n),_H(r,2*a,2*n),_H(r,2*a+1,2*n+1)}function _H(i,r,a){let n=i[r];i[r]=i[a],i[a]=n}function _$(i,r,a,n){let o=i-a,s=r-n;return o*o+s*s}r.$=ra,r.A=i0,r.B=2,r.C=iI,r.D=p6,r.E=iv,r.F=p0,r.G=rr,r.H=oa,r.I=ib,r.J=ri,r.K=rn,r.L=m
7L,r.M=a1,r.N=aK,r.O=a0,r.P=e8,r.Q=ne,r.R=t4,r.S=on,r.T=cX,r.U=nt,r.V=na,r.W=r3,r.X=r1,r.Y=r2,r.Z=rc,r._=ro,r.a=function(i){return tF.API_CDN_URL_REGEX.test(i)},r.a$=mD,r.a0=iS,r.a1=oo,r.a2=/^(.*)-use-theme$/,r.a3=/^(.*)-transition$/,r.a4=a2,r.a5=aQ,r.a6=or,r.a7=n3,r.a8=oi,r.a9=n7,r.aA=function(i){let r=1/0,a=1/0,n=-1/0,o=-1/0;for(let s of i)r=Math.min(r,s.x),a=Math.min(a,s.y),n=Math.max(n,s.x),o=Math.max(o,s.y);return{min:new e8(r,a),max:new e8(n,o)}},r.aB=tl,r.aC=er,r.aD=ej,r.aE=sX,r.aF=lG,r.aG=s5,r.aH=la,r.aI=s2,r.aJ=s4,r.aK=td,r.aL=class{constructor(i){this.entries={},this.scheduler=i}request(i,r,a,n){let o=this.entries[i]=this.entries[i]||{callbacks:[]};if(o.result){let[i,a]=o.result;return this.scheduler?this.scheduler.add(()=>{n(i,a)},r):n(i,a),()=>{}}return o.callbacks.push(n),o.cancel||(o.cancel=a((a,n)=>{for(let i of(o.result=[a,n],o.callbacks))this.scheduler?this.scheduler.add(()=>{i(a,n)},r):i(a,n);setTimeout(()=>delete this.entries[i],3e3)})),()=>{o.result||(o.callbacks=o.callbacks.filter(i=>i!==n),o.callbacks.length||(o.cancel(),delete this.entries[i]))}}},r.aM=function(i){let r;if("provider"in i&&!i.provider)return null;let a=i.provider;if(!a&&"url"in i&&i.url&&(a=function(i){try{let r=new URL(i).pathname.split("/").pop()||"",a=r.lastIndexOf(".");return a>=0?r.slice(a+1):""}catch{return""}}(i.url)),!a)return null;let n=tF.TILE_PROVIDER_URLS[a];if(!n)return null;try{r=new URL(n,tF.API_URL).href}catch(i){return Error(`TileProvider "${a}" has an invalid URL: "${n}"`)}return{name:a,url:r}},r.aN=function(i,r,a,n,o){let s=function(a,n){if(a)return o(a);if(n){i.url&&n.tiles&&i.tiles&&delete i.tiles;let a=mX(i,n,r);if(a instanceof Error)return o(a);o(null,a)}},l=function(i,r,a){if(!i)return null;if(!r&&!a)return i;a=a||i.worldview_default;let n=Object.values(i.language||{});if(0===n.length)return null;let o=Object.values(i.worldview||{});if(0===o.length)return null;let s=n.every(i=>i===r),l=o.every(i=>i===a);return s&&l?i:r in(i.language_options||{})||a in(i.worldview_options||{})?null:i.language_options&&i.worldview_options?i:null}(i.data,a,n);return l?tj.frame(()=>s(null,l)):i.url?ii(r.transformRequest(r.normalizeSourceURL(i.url,null,a,n),t4.Source),s):tj.frame(()=>{let{data:r,...a}=i;s(null,a)})},r.aO=function(i,r){let a=i.url&&!i.tiles?r.transformRequest(i.url,t4.Source):void 0;return{request:a,options:a?Object.assign({},i,{url:a.url}):i}},r.aP=function(i,r,a){return r?mX(i,r,a):i.tiles&&i.tiles.length>0?{tiles:i.tiles}:Error('TileJSON is missing required "tiles" property')},r.aQ=function(i,r,a){let n=JSON.stringify(i.request);return i.data&&(this.deduped.entries[n]={result:[null,i.data]}),this.deduped.request(n,{type:"parseTile",renderSourceType:i.renderSourceType,zoom:i.tileZoom},r=>{let n=ir(i.request,(i,n,o)=>{i?t8(i)?r(null,null):r(i):n&&r(null,{rawData:n,vectorTile:a?void 0:new ld(new p_(n)),responseHeaders:new Map(o.entries())})});return()=>{n.cancel(),r(null,null)}},r)},r.aR=function(i){return i?{cacheControl:i.get("cache-control"),expires:i.get("expires")}:{cacheControl:void 0,expires:void 0}},r.aS=function(i){++tJ>tZ&&(i.getActor().send("enforceCacheSizeLimit",tq),tJ=0)},r.aT=async function(i,r){let a=mJ.get(i);if(a)return a;let n=mY.get(i);if(void 0!==n)return n;let o=import(r).catch(r=>{throw Error(`TileProvider "${i}" failed to load: ${r instanceof Error?r.message:String(r)}`)}).then(r=>{let a=r.default;if("function"!=typeof a)throw Error(`TileProvider "${i}" module must default-export a class`);if("function"!=typeof a.prototype.loadTile)throw Error(`TileProvider "${i}" class must have a loadTile method`);return mJ.set(i,a),a}).finally(()=>{mY.delete(i)});return mY.set(i,o),o},r.aU=l0,r.aV=md,r.aW=mp,r.aX=s1,r.aY=mc,r.aZ=function(i,r){let a=document.createElement("video");a.muted=!0,a.onloadstart=function(){r(null,a)};for(let r=0;r<i.length;r++){let n=document.createElement("source");(function(i){let r=document.createElement("a");return r.href=i,r.protocol===location.protocol&&r.host===location.host})(i[r])||(a.crossOrigin="Anonymous"),n.src=i[r],a.appendChild(n)}return{cancel:()=>{}}},r.a_=cY,r.aa=class{constructor(i){this.specification=i}possiblyEvaluate(i,r){return tS(i.expression.evaluate(r))}interpolate(i,r,a){return{x:iE(i.x,r.x,a),y:iE(i.y,r.y,a),z:iE(i.z,r.z,a),azimuthal:iE(i.azimuthal,r.azimuthal,a),polar:iE(i.polar,r.polar,a)}}},r.ab=n0,r.ac=nr,r.ad=lr,r.ae=eL,r.af=e_,r.ag=th,r.ah=n9,r.ai=h_,r.aj=iE,r.ak=8192,r.al=iP,r.am=function(i){return i*e7},r.an=tf,r.ao=tc,r.ap=class{constructor(i,r,a){this.target=i,this.parent=r,this.mapId=a,this.callbacks={},this.cancelCallbacks={},t_(["receive"],this),this.target.addEventListener("message",this.receive,!1),this.scheduler
7=new mW}send(i,r,a,n,o=!1,s){let l=Math.round(1e18*Math.random()).toString(36).substring(0,10);a&&(a.metadata=s,this.callbacks[l]=a);let h=new Set;return this.target.postMessage({id:l,type:i,hasCallback:!!a,targetMapId:n,mustQueue:o,sourceMapId:this.mapId,data:nu(r,h)},h),{cancel:()=>{a&&delete this.callbacks[l],this.target.postMessage({id:l,type:"<cancel>",targetMapId:n,sourceMapId:this.mapId})}}}receive(i){let r=i.data;if(!r)return;let a=r.id;if(a&&(!r.targetMapId||this.mapId===r.targetMapId))if("<cancel>"===r.type){let i=this.cancelCallbacks[a];delete this.cancelCallbacks[a],i&&i.cancel()}else if(r.mustQueue||tE(self)){let i=this.callbacks[a],n=this.scheduler.add(()=>this.processTask(a,r),i&&i.metadata||{type:"message"});n&&(this.cancelCallbacks[a]=n)}else this.processTask(a,r)}processTask(i,r){if(delete this.cancelCallbacks[i],"<response>"===r.type){let a=this.callbacks[i];delete this.callbacks[i],a&&(r.error?a(nc(r.error)):a(null,nc(r.data)))}else{let a=new Set,n=r.hasCallback?(r,n)=>{this.target.postMessage({id:i,type:"<response>",sourceMapId:this.mapId,error:r?nu(r):null,data:nu(n,a)},a)}:()=>{},o=nc(r.data);if(this.parent[r.type])this.parent[r.type](r.sourceMapId,o,n);else if(this.parent.getWorkerSource){let i=r.type.split("."),{source:a,scope:s}=o;this.parent.getWorkerSource(r.sourceMapId,{type:i[0],source:a,scope:s,uid:0})[i[1]](o,n)}else n(Error(`Could not find function ${r.type}`))}}remove(){this.scheduler.remove(),this.target.removeEventListener("message",this.receive,!1)}},r.aq=class{constructor(i){this.specification=i}possiblyEvaluate(i,r){return function([i,r]){let a=tS([1,i,r]);return{x:a.x,y:a.y,z:a.z}}(i.expression.evaluate(r))}interpolate(i,r,a){return{x:iE(i.x,r.x,a),y:iE(i.y,r.y,a),z:iE(i.z,r.z,a)}}},r.ar=function(i,r,a=0,n=!0){let o=new e8(a,a),s=i.sub(o),l=r.add(o),h=[s,new e8(l.x,s.y),l,new e8(s.x,l.y)];return n&&h.push(s.clone()),h},r.as=function(i,r){let a=[];for(let n=0;n<i.length;n++){let o=tu(n-1,-1,i.length-1),s=tu(n+1,-1,i.length-1),l=i[n],h=i[s],u=i[o].sub(l).unit(),c=h.sub(l).unit(),d=c.angleWithSep(u.x,u.y),p=u.add(c).unit().mult(-1*r/Math.sin(d/2));a.push(l.add(p))}return a},r.at=fk,r.au=lH,r.av=function(i,r,a=0){return eg(((r.x-a)*i.scale-i.x)*8192,(r.y*i.scale-i.y)*8192,s9(r.z,r.y))},r.aw=ev,r.ax=eP,r.ay=lw,r.az=d2,r.b=function(i){return tF.API_FONTS_REGEX.test(i)},r.b$=sA,r.b0=t_,r.b1=_k,r.b2=p_,r.b3=class{constructor(i,r,a,n,o,s){this.tileID=i,this.uid=tf(),this.uses=0,this.tileSize=r,this.tileZoom=a,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasTunnelGeometry=!1,this.hasRTLText=!1,this.dependencies={},this.isRaster=o,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=s,this._hasAppearances=null}registerFadeDuration(i){let r=i+this.timeAdded;r<tj.now()||void 0!==this.fadeEndTime&&r<this.fadeEndTime||(this.fadeEndTime=r)}wasRequested(){return"errored"===this.state||"loaded"===this.state||"reloading"===this.state}get tileTransform(){return this._tileTransform||(this._tileTransform=fB(this.tileID.canonical,this.projection)),this._tileTransform}loadVectorData(i,r,a){if(this.unloadVectorData(),this.state="loaded",i){for(let n in i.featureIndex&&(this.latestFeatureIndex=i.featureIndex,i.rawTileData?(this.latestRawTileData=i.rawTileData,this.latestFeatureIndex.rawTileData=i.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=i.collisionBoxArray,this.buckets=mU(i.buckets,r.style),this.hasSymbolBuckets=!1,this.hasTunnelGeometry=!!i.hasTunnelGeometry,this.buckets){let i=this.buckets[n];if(i instanceof mi){if(this.hasSymbolBuckets=!0,!a)break;i.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(let i in this.buckets){let r=this.buckets[i];if(r instanceof mi&&r.hasRTLText){this.hasRTLText=!0,nQ();break}}for(let i in this.queryPadding=0,this.buckets){let a=this.buckets[i],n=r.style.getOwnLayer(i);if(!n)continue;let o=n.queryRadius(a)||0;this.queryPadding=Math.max(this.queryPadding,o)}i.imageAtlas&&(this.imageAtlas=r.style.imageManager.imageAtlasCache.getOrCache(i.imageAtlas)),i.glyphAtlasImage&&(this.glyphAtlasImage=i.glyphAtlasImage),i.lineAtlas&&(this.lineAtlas=i.lineAtlas),this._lastUpdatedBrightness=i.brightness}else this.collisionBoxArray=new sr}unloadVectorData(){if(this.hasData()){for(let i in this.buckets)this.buckets[i].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(i,r,a){i&&(i.resourceTiming&&(this.resourceTiming=i.resourceTiming),this.buckets=Object.assign({},this.buckets,mU(i.buckets,r.style)),i.featureIndex&&(this.latestFeatureIndex=i.featureIndex))}getBucket(i){return this.buckets[i.fqid]}upload(i,r){for(let a in this.buckets){let n=this.buckets[a];if(n.uploadPending()){let a={},o=[],s={zoom:0,pitch:0,brightness:0,worldview:""};if(r){if(r.style){o=r.style.listImages();let i=n.layers[0],s=i.sourceLayer||"_geojsonTileLayer",l=r.style.getLayerSourceCache(i);l&&(a=l._state.getState(s,void 0))}s={zoom:r.transform.zoom||0,pitch:r.transform.pitch||0,brightness:r.style.getBrightness()||0,worldview:r.worldview||""}}n.upload(i,this.tileID.canonical,a,o,s)}}let a=i.gl,n=this.imageAtlas;!n||this.imageAtlasTexture&&n.uploaded||(this.imageAtlasTexture=null,this.imageAtlasTexture=r.style.imageManager.imageAtlasCache.getTextureForAtlas(n,i,a.RGBA8),n.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new cX(i,this.glyphAtlasImage,a.R8),this.glyphAtlasImage=null),this.lineAtlas&&!this.lineAtlas.uploaded&&(this.lineAtlasTexture=new cX(i,this.lineAtlas.image,a.R8),this.lineAtlas.uploaded=!0)}prepare(i,r,a){if(this.imageAtlas&&this.imageAtlasTexture&&r){let n=r.style.getLut(a);this.imageAtlas.patchUpdatedImages(i,this.imageAtlasTexture,a,n)}if(!r||!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData)return;let n=r.style.getBrightness(),o=r.style.listImages(),s=o.length,l=r.style._changes.getUpd
7atedPaintProperties(),h=Object.keys(this.buckets).some(i=>this.buckets[i].layers.some(i=>l.has(i.fqid))),u=Object.keys(this.buckets).some(i=>this.buckets[i].layers.some(i=>i.hasTransition&&i.hasTransition())),c=this._firstPrepareComplete&&s!==this._lastAvailableImagesCount;null===this._hasAppearances&&(this._hasAppearances=this.hasAppearances(r));let d=this._lastUpdatedBrightness!==n;this._lastAvailableImagesCount=s,this._firstPrepareComplete=!0,(this._lastUpdatedBrightness||n||this._hasAppearances||h||u||c)&&(!(this._hasAppearances||h||u||c)&&this._lastUpdatedBrightness&&n&&.001>Math.abs(this._lastUpdatedBrightness-n)||(this.updateBuckets(r,d,void 0,c||h||u,l,o),this._lastUpdatedBrightness=n))}evaluateQueryRenderedFeaturePadding(){let i=0;for(let r in this.buckets){let a=this.buckets[r];a.evaluateQueryRenderedFeaturePadding&&(i=Math.max(i,a.evaluateQueryRenderedFeaturePadding()))}return i}queryRenderedFeatures(i,r,a,n,o,s,l){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData&&!this.latestFeatureIndex.is3DTile)return{};let h=this.evaluateQueryRenderedFeaturePadding(),u=function(i,r){let a=eu([],[.5*i.width,-(.5*i.height),1]);return ea(a,a,[1,-1,0]),er(a,a,i.calculateProjMatrix(r.toUnwrapped())),Float32Array.from(a)}(o,this.tileID);return this.latestFeatureIndex.query(i,{tilespaceGeometry:r,pixelPosMatrix:u,transform:n,availableImages:a,tileTransform:this.tileTransform,worldview:this.worldview,queryRadius:h,scope:l})}querySourceFeatures(i,r){let a=this.latestFeatureIndex;if(!a||!a.rawTileData)return;let n=a.loadVTLayers(),o=r?r.sourceLayer:"",s=n._geojsonTileLayer||n[o];if(!s)return;let l=os(r&&r.filter),{z:h,x:u,y:c}=this.tileID.canonical,d={z:h,x:u,y:c};for(let r=0;r<s.length;r++){let n=s.feature(r);if(l.needGeometry){let i=ls(n,!0);if(!l.filter(new n0(this.tileID.overscaledZ,{worldview:this.worldview}),i,this.tileID.canonical))continue}else if(!l.filter(new n0(this.tileID.overscaledZ,{worldview:this.worldview}),n))continue;let p=a.getId(n,o),f=new mP(n,h,u,c,p);f.tile=d,i.push(f)}}loaded(){return"loaded"===this.state||"errored"===this.state}hasData(){return"loaded"===this.state||"reloading"===this.state||"expired"===this.state}patternsLoaded(){return!!this.imageAtlas&&!!this.imageAtlas.patternPositions.size}setExpiryData(i){let r=this.expirationTime;if(i.cacheControl){let r=tI(i.cacheControl);r["max-age"]&&(this.expirationTime=Date.now()+1e3*r["max-age"])}else i.expires&&(this.expirationTime=new Date(i.expires).getTime());if(this.expirationTime){let i=Date.now(),a=!1;if(this.expirationTime>i)a=!1;else if(r)if(this.expirationTime<r)a=!0;else{let n=this.expirationTime-r;n?this.expirationTime=i+Math.max(n,3e4):a=!0}else a=!0;a?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-Date.now(),0x7fffffff)}refreshFeatureState(i,r){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData&&!this.latestFeatureIndex.is3DTile||!i)return;let a=i.style.listImages();this.updateBuckets(i,!1,r,void 0,void 0,a)}hasAppearances(i){for(let r in this.buckets)if(i.style.hasLayer(r)&&this.buckets[r].layers.some(i=>i.appearances&&i.appearances.length>0))return!0;return!1}updateBuckets(i,r,a,n,o,s){if(!this.latestFeatureIndex||!i.style)return;let l=s||i.style.listImages(),h=i.style.getBrightness(),u=o||new Set;for(let o in this.buckets){if(!i.style.hasLayer(o))continue;let s=this.buckets[o],c=s.layers[0],d=c.sourceLayer||"_geojsonTileLayer",p=i.style.getLayerSourceCache(c),f=s.layers.some(i=>u.has(i.fqid)),m=(n||f)&&s instanceof mi?i.style.getOwnLayer(o):void 0,_=a&&a[d]||{};p&&!a&&(_=p._state.getState(d,void 0));let g=this.imageAtlas?Object.fromEntries(this.imageAtlas.patternPositions):{},y=Object.keys(_).length>0&&!r;s.hasAppearances=s.layers.some(i=>i.appearances&&i.appearances.length>0);let x=y?s.stateDependentLayers:s.layers;if(y&&0!==s.stateDependentLayers.length||r||f||n){let a=this.latestFeatureIndex.loadVTLayers()[d];if(s.update(_,a,l,g,x,r,h,this.tileID.canonical),(n||f)&&(!r||r&&s instanceof mi&&(!s.text.uboBinder||s.text.uboBinder.isLightConstant||!s.icon.uboBinder||s.icon.uboBinder.isLightConstant))&&s instanceof mi&&m&&"symbol"===m.type&&(s.text&&s.text.uboBinder&&s.text.uboBinder.updateDynamicExpressions(m,a,this.tileID.canonical,l,_,h),s.icon&&s.icon.uboBinder&&s.icon.uboBinder.updateDynamicExpressions(m,a,this.tileID.canonical,l,_,h)),s instanceof mi){let r=i.context;s.text&&s.text.uboBinder&&s.text.uboBinder.upload(r),s.icon&&s.icon.uboBinder&&s.icon.uboBinder.upload(r)}}if(y&&0!==s.stateDependentLayers.length||r||s.hasAppearances){let r={zoom:i.transform.zoom,pitch:i.transform.pitch,brightness:i.style.getBrightness()||0,worldview:i.worldview},a=s.updateAppearances(this.tileID.canonical,_,l,r,i.imageManager,y&&0!==s.stateDependentLayers.length);if(a&&a.hasUboChanges){let r=i.context;s instanceof mi&&s.text&&s.text.uboBinder&&s.text.uboBinder.upload(r),s instanceof mi&&s.icon&&s.icon.uboBinder&&s.icon.uboBinder.upload(r)}}(s instanceof d0||s instanceof uR)&&i._terrain&&i._terrain.enabled&&p&&s.uploadPending()&&i._terrain._clearRenderCacheForTile(p.id,this.tileID);let v=i&&i.style&&i.style.getOwnLayer(o);v&&(this.queryPadding=Math.max(this.queryPadding,v.queryRadius(s)||0))}}holdingForFade(){return void 0!==this.symbolFadeHoldUntil}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<tj.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(i){this.symbolFadeHoldUntil=tj.now()+i}setTexture(i,r){let a=r.context,n=a.gl;this.texture=this.texture||r.getTileTexture(i.width),this.texture&&this.texture instanceof cX?this.texture.update(i):(this.texture=new cX(a,i,n.RGBA8,{useMipmap:!0}),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE))}
7setDependencies(i,r){let a={};for(let i of r)a[i]=!0;this.dependencies[i]=a}hasDependency(i,r){for(let a of i){let i=this.dependencies[a];if(i){for(let a of r)if(i[a])return!0}}return!1}clearQueryDebugViz(){}_makeDebugTileBoundsBuffers(i,r){if(!r||"mercator"===r.name||this._tileDebugBuffer)return;let a=lo(mZ,this.tileID.canonical,this.tileTransform)[0],n=new oC,o=new o8;for(let i=0;i<a.length;i++){let{x:r,y:s}=a[i];n.emplaceBack(r,s),o.emplaceBack(i)}o.emplaceBack(0),this._tileDebugIndexBuffer=i.createIndexBuffer(o),this._tileDebugBuffer=i.createVertexBuffer(n,l4.members),this._tileDebugSegments=sy.simpleSegment(0,0,n.length,o.length)}_makeTileBoundsBuffers(i,r){let a,n;if(this._tileBoundsBuffer||!r||"mercator"===r.name)return;let o=lo(mZ,this.tileID.canonical,this.tileTransform)[0];if(this.isRaster){let i=function(i,r){let a=fB(i,r),n=Math.pow(2,i.z);for(let o=0;o<33;o++)for(let s=0;s<33;s++){let l=s6((i.x+(s+m$(s))/32)/n),h=s8((i.y+(o+m$(o))/32)/n),u=r.project(l,h),c=33*o+s;mj[2*c+0]=Math.round((u.x*a.scale-a.x)*8192),mj[2*c+1]=Math.round((u.y*a.scale-a.y)*8192)}mG.fill(0),mH.fill(0);for(let i=2045;i>=0;i--){let r=4*i,a=mV[r+0],n=mV[r+1],o=mV[r+2],s=mV[r+3],l=a+o>>1,h=n+s>>1,u=l+h-n,c=h+a-l,d=33*n+a,p=33*s+o,f=33*h+l,m=Math.hypot((mj[2*d+0]+mj[2*p+0])/2-mj[2*f+0],(mj[2*d+1]+mj[2*p+1])/2-mj[2*f+1])>=16;mG[f]=mG[f]||+!!m,i<1022&&(mG[f]=mG[f]||mG[(n+c>>1)*33+(a+u>>1)]||mG[(s+c>>1)*33+(o+u>>1)])}let o=new oD,s=new oJ,l=0;function h(i,r){let a=33*r+i;return 0===mH[a]&&(o.emplaceBack(mj[2*a+0],mj[2*a+1],8192*i/32,8192*r/32),mH[a]=++l),mH[a]-1}function u(i,r,a,n,o,l){let c=i+a>>1,d=r+n>>1;if(Math.abs(i-o)+Math.abs(r-l)>1&&mG[33*d+c])u(o,l,i,r,c,d),u(a,n,o,l,c,d);else{let u=h(i,r),c=h(a,n),d=h(o,l);s.emplaceBack(u,c,d)}}return u(0,0,32,32,32,0),u(32,32,0,0,0,32),{vertices:o,indices:s}}(this.tileID.canonical,r);a=i.vertices,n=i.indices}else{for(let{x:i,y:r}of(a=new oD,n=new oJ,o))a.emplaceBack(i,r,0,0);let i=hN(a.int16.subarray(0,4*a.length),void 0,4);for(let r=0;r<i.length;r+=3)n.emplaceBack(i[r],i[r+1],i[r+2])}this._tileBoundsBuffer=i.createVertexBuffer(a,ms.members),this._tileBoundsIndexBuffer=i.createIndexBuffer(n),this._tileBoundsSegments=sy.simpleSegment(0,0,a.length,n.length)}_makeGlobeTileDebugBuffers(i,r){let a,n=r.projection;if(!n||"globe"!==n.name||r.freezeTileCoverage)return;let o=this.tileID.canonical,s=hc(hr(o,r)),l=h_(r.zoom);l>0&&(a=ei(new Float64Array(16),r.globeMatrix)),this._makeGlobeTileDebugBorderBuffer(i,o,r,s,a,l),this._makeGlobeTileDebugTextBuffer(i,o,r,s,a,l)}_globePoint(i,r,a,n,o,s,l){let h=hl(i,r,a);if(s){let o=1<<a.z,u=s5(n.center.lng),c=s4(n.center.lat),d=(a.x+.5)/o-u,p=0;d>.5?p=-1:d<-.5&&(p=1);let f=(i/8192+a.x)/o+p,m=(r/8192+a.y)/o;f=(f-u)*n._pixelsPerMercatorPixel+u,m=(m-c)*n._pixelsPerMercatorPixel+c;let _=[f*n.worldSize,m*n.worldSize,0];eL(_,_,s),h=hi(h,_,l)}return eL(h,h,o)}_makeGlobeTileDebugBorderBuffer(i,r,a,n,o,s){let l=new oC,h=new o8,u=new oP,c=(i,c,d,p,f)=>{let m=(d-i)/(f-1),_=(p-c)/(f-1),g=l.length;for(let d=0;d<f;d++){let p=i+d*m,f=c+d*_;l.emplaceBack(p,f);let y=this._globePoint(p,f,r,a,n,o,s);u.emplaceBack(y[0],y[1],y[2]),h.emplaceBack(g+d)}};c(0,0,8192,0,16),c(8192,0,8192,8192,16),c(8192,8192,0,8192,16),c(0,8192,0,0,16),this._tileDebugIndexBuffer=i.createIndexBuffer(h),this._tileDebugBuffer=i.createVertexBuffer(l,l4.members),this._globeTileDebugBorderBuffer=i.createVertexBuffer(u,l5.members),this._tileDebugSegments=sy.simpleSegment(0,0,l.length,h.length)}_makeGlobeTileDebugTextBuffer(i,r,a,n,o,s){let l=new oC,h=new oJ,u=new oP;h.reserve(32),l.reserve(25),u.reserve(25);let c=(i,r)=>25*i+r;for(let i=0;i<25;i++){let h=2048*i;for(let i=0;i<25;i++){let c=2048*i;l.emplaceBack(c,h);let d=this._globePoint(c,h,r,a,n,o,s);u.emplaceBack(d[0],d[1],d[2])}}for(let i=0;i<4;i++)for(let r=0;r<4;r++){let a=c(i,r),n=c(i,r+1),o=c(i+1,r),s=c(i+1,r+1);h.emplaceBack(a,n,o),h.emplaceBack(o,n,s)}this._tileDebugTextIndexBuffer=i.createIndexBuffer(h),this._tileDebugTextBuffer=i.createVertexBuffer(l,l4.members),this._globeTileDebugTextBuffer=i.createVertexBuffer(u,l5.members),this._tileDebugTextSegments=sy.simpleSegment(0,0,25,32)}destroy(i=!0){for(let r in this.buckets)this.buckets[r].destroy(i);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),i&&this.texture&&this.texture instanceof cX&&(this.texture.destroy(),delete this.texture),this.emissiveTexture&&this.emissiveTexture instanceof cX&&(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"}},r.b4=ir,r.b5=t8,r.b6=function(i,r){let a=[];for(let n in i)n in r||a.push(n);return a},r.b7=mq,r.b8=["type","source","source-layer","minzoom","maxzoom","filter","layout"],r.b9=e9,r.bA=et,r.bB=ea,r.bC=24,r.bD=uq,r.bE=u1,r.bF=uQ,r.bG=u0,r.bH=ls,r.bI=eN,r.bJ=pN,r.bK=fw,r.bL=fP,r.bM=_j,r.bN=eS,r.bO=e_,r.bP=eH,r.bQ=function(i,r,a){a*=.5;var n=r[0],o=r[1],s=r[2],l=r[3],h=Math.sin(a),u=Math.cos(a);return i[0]=n*u+o*h,i[1]=o*u-n*h,i[2]=s*u+l*h,i[3]=l*u-s*h,i},r.bR=e$,r.bS=tC,r.bT=eu,r.bU=function(i,r){return i[0]=-r[0],i[1]=-r[1],i[2]=-r[2],i[3]=r[3],i},r.bV=ep,r.bW=function(i,r,a,n,o){var s=1/Math.tan(r/2);if(i[0]=s/a,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=s,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[11]=-1,i[12]=0,i[13]=0,i[15]=0,null!=o&&o!==1/0){var l=1/(n-o);i[10]=(o+n)*l,i[14]=2*o*n*l}else i[10]=-1,i[14]=-2*n;return i},r.bX=function(i,r,a,n,o,s,l){var h=1/(r-a),u=1/(n-o),c=1/(s-l);return i[0]=-2*h,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=-2*u,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=2*c,i[11]=0,i[12]=(r+a)*h,i[13]=(o+n)*u,i[14]=(l+s)*c,i[15]=1,i},r.bY=function(i,r){return i/s3(r)},r.bZ=s8,r.b_=function(i,r,a){i[4*r+0]=a[0],i[4*r+1]=a[1],i[4*r+2]=a[2],i[4*r+3]=a[3]},r.ba=ei,r.bb=ee,r.bc=el,r.bd=Q,r.be=function(i,r){let{x:a,y:n}=i.point,o=hm(a,n,i.worldSize/i._pixelsPerMercatorPixel,0,0);return er(o,o,hd(ht(r)))}
7,r.bf=X,r.bg=eB,r.bh=eI,r.bi=eE,r.bj=eR,r.bk=eD,r.bl=pX,r.bm=pP,r.bn=pW,r.bo=function(i,r,a,n,o){let s=5*r+2;i.float32[s+0]=a,i.float32[s+1]=n,i.float32[s+2]=o},r.bp=f7,r.bq=no,r.br=eK,r.bs=e1,r.bt=eQ,r.bu=e0,r.bv=tu,r.bw=function(i,r,a,n){var o=new W(4);return o[0]=i,o[1]=r,o[2]=a,o[3]=n,o},r.bx=class{isDataAvailableAtPoint(i){let r=this._source();if(this.isUsingMockSource()||!r||i.y<0||i.y>1)return!1;let a=r.getSource().maxzoom,n=1<<a,o=Math.floor(i.x),s=Math.floor((i.x-o)*n),l=Math.floor(i.y*n),h=this.findDEMTileFor(new l0(a,o,a,s,l));return!(!h||!h.dem)}getAtPointOrZero(i,r=0){return this.getAtPoint(i,r)||0}getAtPoint(i,r,a=!0){if(this.isUsingMockSource())return null;null==r&&(r=null);let n=this._source();if(!n||i.y<0||i.y>1)return r;let o=n.getSource().maxzoom,s=1<<o,l=Math.floor(i.x),h=i.x-l,u=new l0(o,l,o,Math.floor(h*s),Math.floor(i.y*s)),c=this.findDEMTileFor(u);if(!c||!c.dem)return r;let d=c.dem,p=1<<c.tileID.canonical.z,f=(h*p-c.tileID.canonical.x)*d.dim,m=(i.y*p-c.tileID.canonical.y)*d.dim,_=Math.floor(f),g=Math.floor(m);return(a?this.exaggeration():1)*iE(iE(d.get(_,g),d.get(_,g+1),m-g),iE(d.get(_+1,g),d.get(_+1,g+1),m-g),f-_)}static getAtTileOffset(i,r,a,n){let o=1<<i.canonical.z;return n?n.pointElevation(r):a?a.getAtPointOrZero(new lr(i.wrap+(i.canonical.x+r.x/8192)/o,(i.canonical.y+r.y/8192)/o)):0}static getAtTileOffsetFunc(i,r,a,n){return(o,s,l)=>{let h=this.getAtTileOffset(i,o,s,l),u=n.upVector(i.canonical,o.x,o.y);return eS(u,u,h*n.upVectorScale(i.canonical,r,a).metersToTile),u}}getForTilePoints(i,r,a,n){if(this.isUsingMockSource())return!1;let o=mx.create(this,i,n);return!!o&&(r.forEach(i=>{i[2]=this.exaggeration()*o.getElevationAt(i[0],i[1],a,!0)}),!0)}getMinMaxForTile(i){if(this.isUsingMockSource())return null;let r=this.findDEMTileFor(i);if(!r||!r.dem)return null;let a=r.dem.tree,n=r.tileID,o=1<<i.canonical.z-n.canonical.z,s=i.canonical.x/o-n.canonical.x,l=i.canonical.y/o-n.canonical.y,h=0;for(let r=0;r<i.canonical.z-n.canonical.z&&!a.leaves[h];r++){let i=2*Math.floor(l*=2)+Math.floor(s*=2);h=a.childOffsets[h]+i,s%=1,l%=1}return{min:this.exaggeration()*a.minimums[h],max:this.exaggeration()*a.maximums[h]}}getMinElevationBelowMSL(){throw Error("Pure virtual method called.")}raycast(i,r,a){throw Error("Pure virtual method called.")}pointCoordinate(i){throw Error("Pure virtual method called.")}_source(){throw Error("Pure virtual method called.")}isUsingMockSource(){throw Error("Pure virtual method called.")}exaggeration(){throw Error("Pure virtual method called.")}findDEMTileFor(i){throw Error("Pure virtual method called.")}get visibleDemTiles(){throw Error("Getter must be implemented in subclass.")}getMinMaxForVisibleTiles(){let i=this.visibleDemTiles;if(0===i.length)return null;let r=!1,a=Number.MAX_VALUE,n=5e-324;for(let o of i){let i=this.getMinMaxForTile(o.tileID);i&&(a=Math.min(a,i.min),n=Math.max(n,i.max),r=!0)}return r?{min:a,max:n}:null}},r.by=cT,r.bz=lO,r.c=tU,r.c$=cq,r.c0=sP,r.c1=sM,r.c2=sC,r.c3=sL,r.c4=f1,r.c5=function(i,r){return i[0]===r[0]&&i[1]===r[1]&&i[2]===r[2]&&i[3]===r[3]},r.c6=ek,r.c7=function(i){var r=i[0],a=i[1],n=i[2],o=i[3];return Math.sqrt(r*r+a*a+n*n+o*o)},r.c8=eV,r.c9=eO,r.cA=c6,r.cB=er,r.cC=c5,r.cD=function(i){let r=c5(i,!0);return X([],[r[0],r[1],r[4],r[5]])},r.cE=en,r.cF=lT,r.cG=eo,r.cH=function(i,r){return i[0]=r[0],i[1]=r[1],i[2]=r[2],i[3]=r[3],i[4]=r[4],i[5]=r[5],i[6]=r[6],i[7]=r[7],i[8]=r[8],i[9]=r[9],i[10]=r[10],i[11]=r[11],i[12]=r[12],i[13]=r[13],i[14]=r[14],i[15]=r[15],i},r.cI=function(i){let{x:r,y:a}=i.point,{lng:n,lat:o}=i._center;return hm(r,a,i.worldSize,n,o)},r.cJ=eb,r.cK=eh,r.cL=function(i){return i*te},r.cM=l$,r.cN=5,r.cO=function(i,r,a){let n=0;for(let a=0;a<2;++a)i[a]>0&&(n+=(i[a]-0)*(i[a]-0)),r[a]<0&&(n+=(0-r[a])*(0-r[a]));return n},r.cP=function(i){return i*i*i*i*i},r.cQ=s3,r.cR=45,r.cS=sR,r.cT=function(i,r,a){let n=Math.sqrt(i*i+r*r+a*a),o=n>0?Math.acos(a/n)*te:0,s=0!==i||0!==r?Math.atan2(-r,-i)*te+90:0;return s<0&&(s+=360),[n,s,o]},r.cU=eg,r.cV=tS,r.cW=li,r.cX=ex,r.cY=lP,r.cZ=ev,r.c_=function(i){return[Math.pow(i[0],1/2.2),Math.pow(i[1],1/2.2),Math.pow(i[2],1/2.2)]},r.ca=lQ,r.cb=3,r.cc=2,r.cd=7,r.ce=6,r.cf=ez,r.cg=ef,r.ch=em,r.ci=0,r.cj=1,r.ck=4,r.cl=5,r.cm=l1,r.cn=lC,r.co=c4,r.cp=lK,r.cq=hn,r.cr=function(i,r,a,n,o,s,l,h,u){if("globe"===u.name)return hn(i,r,new lK(a,n,o),!1);let c=fB({z:a,x:n,y:o},u);return new lP([(s+c.x/c.scale)*r,r*(c.y/c.scale),l],[(s+c.x2/c.scale)*r,r*(c.y2/c.scale),h
7])},r.cs=function(i,r,a){return i[0]=Math.min(r[0],a[0]),i[1]=Math.min(r[1],a[1]),i[2]=Math.min(r[2],a[2]),i[3]=Math.min(r[3],a[3]),i},r.ct=function(i,r,a){return i[0]=Math.max(r[0],a[0]),i[1]=Math.max(r[1],a[1]),i[2]=Math.max(r[2],a[2]),i[3]=Math.max(r[3],a[3]),i},r.cu=function(i){return ta[Math.round((i+45+360)%360/90)%4]},r.cv=85.051129,r.cw=eU,r.cx=6,r.cy=function(i){let r=et(new Float64Array(16));er(r,i.pixelMatrix,i.globeMatrix);let a=[0,sJ,0],n=[0,sX,0];return eL(a,a,r),eL(n,n,r),[a[0]>0&&a[0]<=i.width&&a[1]>0&&a[1]<=i.height&&!hy(i,new s1(i.center.lat,90)),n[0]>0&&n[0]<=i.width&&n[1]>0&&n[1]<=i.height&&!hy(i,new s1(i.center.lat,-90))]},r.cz=function(i,r){let{scale:a}=i.tileTransform,n=8192*a/(i.tileSize*Math.pow(2,r.zoom-i.tileID.overscaledZ+i.tileID.canonical.z)),o=r.inverseAdjustmentMatrix;return new Float32Array([o[0]*n,o[1]*n,o[2]*n,o[3]*n])},r.d=function(i){return tF.API_TILEJSON_REGEX.test(i)},r.d$=tm,r.d0=dT,r.d1=dl,r.d2=lB,r.d3=class{static calculate(i,r,a){let n=new Set,o=new Map,s=new Set,l=new Set;for(let a of Object.values(i))for(let[i,h]of Object.entries(a.floors)){s.add(i),h.isDefault&&l.add(i),h.conflicts&&o.set(i,h.conflicts);let a=i===r,u=h.connections&&r&&h.connections.has(r);(a||u)&&n.add(i)}let h=i=>{let r=o.get(i)||new Set;for(let a of n)if((o.get(a)||new Set).has(i)||r.has(a))return!0;return!1};if(a)for(let i of a)s.has(i)&&(h(i)||n.add(i));for(let i of l)n.has(i)||h(i)||n.add(i);return n}},r.d4=fh,r.d5=fl,r.d6=t9,r.d7=function(){return{API_URL:tF.API_URL,DRACO_URL:tF.DRACO_URL,MESHOPT_URL:tF.MESHOPT_URL,MESHOPT_SIMD_URL:tF.MESHOPT_SIMD_URL,BUILDING_GEN_URL:tF.BUILDING_GEN_URL}},r.d8=nZ,r.d9=tH,r.dA=l4,r.dB=sy,r.dC=hz,r.dD=l6,r.dE=oC,r.dF=oJ,r.dG=function(i,r){return[Math.pow(i[0],2.2)*r,Math.pow(i[1],2.2)*r,Math.pow(i[2],2.2)*r]},r.dH=Y,r.dI=function(i,r){var a=Math.sin(r),n=Math.cos(r);return i[0]=n,i[1]=a,i[2]=0,i[3]=-a,i[4]=n,i[5]=0,i[6]=0,i[7]=0,i[8]=1,i},r.dJ=eF,r.dK=hf,r.dL=tR,r.dM=tz,r.dN=1024,r.dO=function(i,r){let a=[0,0,0];return eL(a,a,hc(ht(r.canonical))),eL(a,a,i),a},r.dP=i=>({u_matrix:new sL(i),u_texsize:new sC(i),u_pixels_to_tile_units:new sF(i),u_device_pixel_ratio:new sM(i),u_width_scale:new sM(i),u_floor_width_scale:new sM(i),u_image:new sA(i),u_units_to_pixels:new sC(i),u_tile_units_to_pixels:new sM(i),u_alpha_discard_threshold:new sM(i),u_trim_offset:new sC(i),u_trim_fade_range:new sC(i),u_trim_gradient_mix_range:new sC(i),u_trim_color:new sR(i),u_zbias_factor:new sM(i),u_tile_to_meter:new sM(i),u_ground_shadow_factor:new sP(i),u_pattern_transition:new sM(i)}),r.dQ=i=>({u_matrix:new sL(i),u_pixels_to_tile_units:new sF(i),u_device_pixel_ratio:new sM(i),u_width_scale:new sM(i),u_floor_width_scale:new sM(i),u_units_to_pixels:new sC(i),u_dash_image:new sA(i),u_gradient_image:new sA(i),u_image_height:new sM(i),u_texsize:new sC(i),u_tile_units_to_pixels:new sM(i),u_alpha_discard_threshold:new sM(i),u_trim_offset:new sC(i),u_trim_fade_range:new sC(i),u_trim_gradient_mix_range:new sC(i),u_trim_color:new sR(i),u_zbias_factor:new sM(i),u_tile_to_meter:new sM(i),u_ground_shadow_factor:new sP(i)}),r.dR=i=>({u_camera_to_center_distance:new sM(i),u_extrude_scale:new sF(i),u_device_pixel_ratio:new sM(i),u_matrix:new sL(i),u_inv_rot_matrix:new sL(i),u_merc_center:new sC(i),u_tile_id:new sP(i),u_zoom_transition:new sM(i),u_up_dir:new sP(i),u_emissive_strength:new sM(i)}),r.dS=oX,r.dT=pu,r.dU=class{constructor(i,r,a,n){this.context=i,this.format=n,this.size=a,this.texture=i.gl.createTexture();let[o,s,l]=this.size,{gl:h}=i;h.bindTexture(h.TEXTURE_3D,this.texture),i.pixelStoreUnpackFlipY.set(!1),i.pixelStoreUnpack.set(1),i.pixelStoreUnpackPremultiplyAlpha.set(!1),"data"in r&&r.data&&h.texImage3D(h.TEXTURE_3D,0,this.format,o,s,l,0,cZ(this.format),cW(this.format),r.data)}bind(i,r){let{context:a}=this,{gl:n}=a;n.bindTexture(n.TEXTURE_3D,this.texture),i!==this.minFilter&&(n.texParameteri(n.TEXTURE_3D,n.TEXTURE_MAG_FILTER,i),n.texParameteri(n.TEXTURE_3D,n.TEXTURE_MIN_FILTER,i),this.minFilter=i),r!==this.wrapS&&(n.texParameteri(n.TEXTURE_3D,n.TEXTURE_WRAP_S,r),n.texParameteri(n.TEXTURE_3D,n.TEXTURE_WRAP_T,r),this.wrapS=r)}destroy(){let{gl:i}=this.context;i.deleteTexture(this.texture),this.texture=null}},r.dV=hT,r.dW=(i,r,a,n,o,s)=>{let l,h=i.transform,u="globe"===h.projection.name;if("map"===s.paint.get("circle-pitch-alignment"))if(u){let i=hf(h.zoom,r.canonical)*h._pixelsPerMercatorPixel;l=Float32Array.from([i,0,0,i])}else l=h.calculatePixelsToTileUnitsMatrix(a);else l=new Float32Array([h.pixelsToGLUnits[0],0,0,h.pixelsToGLUnits[1]]);let c={u_camera_to_center_distance:i.transform.getCameraToCenterDistance(h.projection),u_matrix:i.translatePosMatrix(r.projMatrix,a,s.paint.get("circle-translate"),s.paint.get("circle-translate-anchor")),u_device_pixel_ratio:tj.devicePixelRatio,u_extrude_scale:l,u_inv_rot_matrix:hw,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0],u_emissive_strength:s.paint.get("circle-emissive-strength")};if(u){c.u_inv_rot_matrix=n,c.u_merc_center=o,c.u_tile_id=[r.canonical.x,r.canonical.y,1<<r.canonical.z],c.u_zoom_transition=h_(h.zoom);let i=8192*o[0],a=8192*o[1];c.u_up_dir=h.projection.upVector(new lK(0,0,0),i,a)}return c},r.dX=d6,r.dY=i1,r.dZ=(i,r,a,n,o,s,l,h,u,c)=>{let d=i.transform,p=d.pitch<15?d3(.07,.7,tl((14-d.zoom)/5,0,1)):.07,f="none"===a.paint.get("line-trim-color-use-theme").
7constantOr("default");return{u_matrix:d4(i,r,a,n),u_texsize:r.imageAtlasTexture?r.imageAtlasTexture.size:[0,0],u_pixels_to_tile_units:d.calculatePixelsToTileUnitsMatrix(r),u_device_pixel_ratio:o,u_width_scale:s,u_floor_width_scale:l,u_image:0,u_tile_units_to_pixels:d5(r,d),u_units_to_pixels:[1/d.pixelsToGLUnits[0],1/d.pixelsToGLUnits[1]],u_alpha_discard_threshold:0,u_trim_offset:h,u_trim_fade_range:a.paint.get("line-trim-fade-range"),u_trim_gradient_mix_range:[1,1],u_trim_color:a.paint.get("line-trim-color").toPremultipliedRenderColor(f?null:a.lut).toArray01(),u_zbias_factor:p,u_tile_to_meter:li(r.tileID.canonical,0),u_ground_shadow_factor:u,u_pattern_transition:c}},r.d_=(i,r,a,n,o,s,l,h,u,c)=>{let d=i.transform,p=d.calculatePixelsToTileUnitsMatrix(r),f="none"===a.paint.get("line-trim-color-use-theme").constantOr("default"),m=d.pitch<15?d3(.07,.7,tl((14-d.zoom)/5,0,1)):.07;return{u_matrix:d4(i,r,a,n),u_pixels_to_tile_units:p,u_device_pixel_ratio:s,u_width_scale:l,u_floor_width_scale:h,u_units_to_pixels:[1/d.pixelsToGLUnits[0],1/d.pixelsToGLUnits[1]],u_dash_image:0,u_gradient_image:1,u_image_height:o,u_texsize:d8(a)&&r.lineAtlasTexture?r.lineAtlasTexture.size:[0,0],u_tile_units_to_pixels:d5(r,i.transform),u_alpha_discard_threshold:0,u_trim_offset:u,u_trim_fade_range:a.paint.get("line-trim-fade-range"),u_trim_gradient_mix_range:[1,1],u_trim_color:a.paint.get("line-trim-color").toPremultipliedRenderColor(f?null:a.lut).toArray01(),u_zbias_factor:m,u_tile_to_meter:li(r.tileID.canonical,0),u_ground_shadow_factor:c}},r.da=im,r.db=tx,r.dc=function(i){let r=i.indexOf("\x1f");return r>=0?i.slice(0,r):i},r.dd=dj,r.de=function(i){return i.includes("\x1f")},r.df=function(i){let r=i.lastIndexOf("\x1f");return r>=0?i.slice(r+1):""},r.dg=function(i){let r=[],a=i.id;return void 0===a&&r.push({message:`layers.${a}: missing required property "id"`}),void 0===i.render&&r.push({message:`layers.${a}: missing required method "render"`}),i.renderingMode&&"2d"!==i.renderingMode&&"3d"!==i.renderingMode&&r.push({message:`layers.${a}: property "renderingMode" must be either "2d" or "3d"`}),r},r.dh=function(i,r,a,n){return"custom"===i.type?new mf(i,r):new mz[i.type](i,r,a,n)},r.di=ty,r.dj=os,r.dk=o_,r.dl=class extends mP{constructor(i,r){super(i._vectorTileFeature,i._z,i._x,i._y,i.id),i.state&&(this.state=Object.assign({},i.state)),this.target=r.target,this.namespace=r.namespace,r.properties&&(this.properties=r.properties),this.target&&("featuresetId"in this.target&&!this.target.importId||"layerId"in this.target)&&(this.source=i.source,this.sourceLayer=i.sourceLayer,this.layer=i.layer)}toJSON(){let i=super.toJSON();return i.target=this.target,i.namespace=this.namespace,i}},r.dm=nX,r.dn=function(i){return i({pluginStatus:n$,pluginURL:nq}),nX.on("pluginStateChange",i),i},r.dp=sz,r.dq=class extends sI{constructor(i){super(i),this.current=new Float32Array(9)}set(i,r,a){if(!this.fetchUniformLocation(i,r))return;let n=this.current;for(let i=0;i<9;i++)if(a[i]!==n[i]){n.set(a),this.gl.uniformMatrix3fv(this.location,!1,n);break}}},r.dr=tn,r.ds=function(i,r,a){let n=h_(a.zoom),o=i.style.map._antialias,s=i.terrain&&i.terrain.exaggeration()>0;return 0===n&&!o&&!s},r.dt=function(i){let r=i.pixelsPerMeter,a=r/(1/s3(i.center.lat)),n=et(new Float64Array(16));return ea(n,n,[i.point.x,i.point.y,0]),en(n,n,[a,a,r]),Float32Array.from(n)},r.du=ho,r.dv=function(i){return Math.round(Math.pow(Math.abs(Math.sin((i=tl(i,-80.051129,80.051129)/80.051129*90)*e7)),3)*(sY.length-1))},r.dw=function(i,r,a,n){let o=r.getNorth(),s=r.getSouth(),l=r.getWest(),h=r.getEast(),u=1<<i.z,c=h-l,d=o-s,p=c/64,f=-d/sY[a],m=[0,p,0,f,0,0,o,l,0];if(i.z>0){let i=180/n;K(m,m,[i/c+1,0,0,0,i/d+1,0,-.5*i/p,.5*i/f,1])}return m[2]=u,m[5]=i.x,m[8]=i.y,m},r.dx=hc,r.dy=ht,r.dz=function(i,r,a){let n=et(new Float64Array(16)),o=(r/(1<<i)-.5)*Math.PI*2;return es(n,a.globeMatrix,o),Float32Array.from(n)},r.e=function(i){return 0===i.indexOf("mapbox:")},r.e$=c9,r.e0=hL,r.e1=s9,r.e2=l2,r.e3=cu,r.e4=cg,r.e5=0x80000000,r.e6=450,r.e7=7,r.e8=le,r.e9=function(i,r){if(i===r){var a=r[1],n=r[2],o=r[3],s=r[6],l=r[7],h=r[11];i[1]=r[4],i[2]=r[8],i[3]=r[12],i[4]=a,i[6]=r[9],i[7]=r[13],i[8]=n,i[9]=s,i[11]=r[14],i[12]=o,i[13]=l,i[14]=
7h}else i[0]=r[0],i[1]=r[4],i[2]=r[8],i[3]=r[12],i[4]=r[1],i[5]=r[5],i[6]=r[9],i[7]=r[13],i[8]=r[2],i[9]=r[6],i[10]=r[10],i[11]=r[14],i[12]=r[3],i[13]=r[7],i[14]=r[11],i[15]=r[15];return i},r.eA=function(i,r){var a=2*Math.acos(r[3]),n=Math.sin(a/2);return n>1e-6?(i[0]=r[0]/n,i[1]=r[1]/n,i[2]=r[2]/n):(i[0]=1,i[1]=0,i[2]=0),a},r.eB=mR,r.eC=ds,r.eD=dr,r.eE=[1,1,1],r.eF=mx,r.eG=function(i,r,a,n){var o=r[0],s=r[1],l=r[2],h=r[3];return i[0]=o+n*(a[0]-o),i[1]=s+n*(a[1]-s),i[2]=l+n*(a[2]-l),i[3]=h+n*(a[3]-h),i},r.eH=dn,r.eI=oq,r.eJ=class{constructor(){this._updateTime=0,this._sourceIds=[],this._activeRegions=[],this._prevRegions=[],this._globalClipBounds={min:new e8(1/0,1/0),max:new e8(-1/0,-1/0)}}clear(){this._activeRegions.length>0&&++this._updateTime,this._activeRegions=[],this._prevRegions=[]}get updateTime(){return this._updateTime}getReplacementRegionsForTile(i,r=!1){let a=uJ(new e8(0,0),new e8(8192,8192),i),n=[];if(r&&!uX(a,this._globalClipBounds))return n;for(let r of this._activeRegions){if(r.hiddenByOverlap||!uX(a,r))continue;let o=function(i,r,a){let n=1<<a.canonical.z,o=((r.x-a.wrap)*n-a.canonical.x)*8192,s=(r.y*n-a.canonical.y)*8192;return{min:new e8(((i.x-a.wrap)*n-a.canonical.x)*8192,(i.y*n-a.canonical.y)*8192),max:new e8(o,s)}}(r.min,r.max,i);n.push({min:o.min,max:o.max,sourceId:this._sourceIds[r.priority],footprint:r.footprint,footprintTileId:r.tileId,order:r.order,clipMask:r.clipMask,clipScope:r.clipScope})}return n}setSources(i){this._setSources(i.map(i=>({getSourceId:()=>i.cache.id,getFootprints:()=>{let r=[];for(let a of i.cache.getVisibleCoordinates()){let n=i.cache.getTile(a).buckets[i.layer];n&&n.updateFootprints(a.toUnwrapped(),r)}return r},getOrder:()=>i.order,getClipMask:()=>i.clipMask,getClipScope:()=>i.clipScope})))}_addSource(i){let r=i.getFootprints();if(0===r.length)return;let a=i.getOrder(),n=i.getClipMask(),o=i.getClipScope();for(let i of r){if(!i.footprint)continue;let r=uJ(i.footprint.min,i.footprint.max,i.id);this._activeRegions.push({min:r.min,max:r.max,hiddenByOverlap:!1,priority:this._sourceIds.length,tileId:i.id,footprint:i.footprint,order:a,clipMask:n,clipScope:o})}this._sourceIds.push(i.getSourceId())}_computeReplacement(){this._activeRegions.sort((i,r)=>i.priority-r.priority||uZ(i.min,r.min)||uZ(i.max,r.max)||i.order-r.order||i.clipMask-r.clipMask||function(i,r){let a=(i,r)=>i+r;return i.length-r.length||i.reduce(a,"").localeCompare(r.reduce(a,""))}(i.clipScope,r.clipScope));let i=this._activeRegions.length!==this._prevRegions.length;if(!i){let r=0;for(;!i&&r!==this._activeRegions.length;){let a=this._activeRegions[r],n=this._prevRegions[r];i=a.priority!==n.priority||!uW(a,n)||a.order!==n.order||a.clipMask!==n.clipMask||!e9(a.clipScope,n.clipScope),this._activeRegions[r].hiddenByOverlap=n.hiddenByOverlap,++r}}if(i){for(let i of(++this._updateTime,this._activeRegions))i.order!==uH&&(this._globalClipBounds.min.x=Math.min(this._globalClipBounds.min.x,i.min.x),this._globalClipBounds.min.y=Math.min(this._globalClipBounds.min.y,i.min.y),this._globalClipBounds.max.x=Math.max(this._globalClipBounds.max.x,i.max.x),this._globalClipBounds.max.y=Math.max(this._globalClipBounds.max.y,i.max.y));let i=i=>{let r=this._activeRegions;if(i>=r.length)return i;let a=r[i].priority;for(;i<r.length&&r[i].priority===a;)++i;return i};if(this._sourceIds.length>1){let r=0,a=i(0);for(;r!==a;){let n=r,o=r;for(;n!==a;){let i=this._activeRegions[n];i.hiddenByOverlap=!1;for(let r=0;r<o;r++){let a=this._activeRegions[r];if(!a.hiddenByOverlap&&i.order===uH&&uX(i,a)&&(i.hiddenByOverlap=function i(r,a,n,o){if(!r||!n)return!1;let s=r.vertices;if(!a.canonical.equals(o.canonical)||a.wrap!==o.wrap){if(n.vertices.length<r.vertices.length)return i(n,o,r,a);let l=a.canonical,h=o.canonical,u=Math.pow(2,h.z-l.z);s=r.vertices.map(i=>new e8((i.x+8192*l.x)*u-8192*h.x,(i.y+8192*l.y)*u-8192*h.y))}return uK(n,s,r.indices,0,r.indices.length,0,0)}(i.footprint,i.tileId,a.footprint,a.tileId),i.hiddenByOverlap))break}++n}a=i(r=a)}}}}_setSources(i){[this._prevRegions,this._activeRegions]=[this._activeRegions,[]],this._sourceIds=[];for(let r=i.length-1;r>=0;r--)this._addSource(i[r]);this._computeReplacement()}},r.eK=oD,r.eL=ms,r.eM=o8,r.eN=uH,r.eO=class{constructor(i){this._createGrid(i),this._createPoles(i)}destroy(){for(let i of(this._poleIndexBuffer.destroy(),this._gridBuffer.destroy(),this._gridIndexBuffer.destroy(),this._poleNorthVertexBuffer.destroy(),this._poleSouthVertexBuffer.destroy(),this._poleSegments))i.destroy();for(let i of this._gridSegments)i.withSkirts.destroy(),i.withoutSkirts.destroy()}_fillGridMeshWithLods(i,r){let a=new oC,n=new oJ,o=[],s=i+1+2,l=r[0]+1,h=r[0]+1+(1+r.length),u=(i,r,a)=>{let n=i===s-1?i-2:0===i?i:i-1;return[n+=24575*!!a,r]};for(let i=0;i<s;++i)a.emplaceBack(...u(i,0,!0));for(let i=0;i<l;++i)for(let r=0;r<s;
7++r)a.emplaceBack(...u(r,i,0===r||r===s-1));for(let i=0;i<r.length;++i){let n=r[i];for(let i=0;i<s;++i)a.emplaceBack(...u(i,n,!0))}for(let i=0;i<r.length;++i){let l=n.length,u=r[i]+1+2,c=new oJ;for(let a=0;a<u-1;a++){let o=a===u-2,l=o?s*(h-r.length+i-a):s;for(let i=0;i<s-1;i++){let r=a*s+i;0===a||o||0===i||i===s-2?(c.emplaceBack(r+1,r,r+l),c.emplaceBack(r+l,r+l+1,r+1)):(n.emplaceBack(r+1,r,r+l),n.emplaceBack(r+l,r+l+1,r+1))}}let d=sy.simpleSegment(0,l,a.length,n.length-l);for(let i=0;i<c.uint16.length;i+=3)n.emplaceBack(c.uint16[i],c.uint16[i+1],c.uint16[i+2]);let p=sy.simpleSegment(0,l,a.length,n.length-l);o.push({withoutSkirts:d,withSkirts:p})}return{vertices:a,indices:n,segments:o}}_createGrid(i){let r=this._fillGridMeshWithLods(64,sY);this._gridSegments=r.segments,this._gridBuffer=i.createVertexBuffer(r.vertices,l4.members),this._gridIndexBuffer=i.createIndexBuffer(r.indices,!0)}_createPoles(i){let r=new oJ;for(let i=0;i<=64;i++)r.emplaceBack(0,i+1,i+2);this._poleIndexBuffer=i.createIndexBuffer(r,!0);let a=new o1,n=new o1,o=new o1,s=new o1;this._poleSegments=[];for(let i=0,r=0;i<6;i++){let l=360/(1<<i);a.emplaceBack(0,-sX,0,.5,0),n.emplaceBack(0,-sX,0,.5,1),o.emplaceBack(0,-sX,0,.5,.5),s.emplaceBack(0,-sX,0,.5,.5);for(let i=0;i<=64;i++){let r=i/64,h=0,u=iE(0,l,r),[c,d,p]=sK(hv,hb,u,sX);a.emplaceBack(c,d,p,r,h),n.emplaceBack(c,d,p,r,1-h);let f=u*e7;r=.5+.5*Math.sin(f),h=.5+.5*Math.cos(f),o.emplaceBack(c,d,p,r,h),s.emplaceBack(c,d,p,r,1-h)}this._poleSegments.push(sy.simpleSegment(r,0,66,64)),r+=66}this._poleNorthVertexBuffer=i.createVertexBuffer(a,l3,!1),this._poleSouthVertexBuffer=i.createVertexBuffer(n,l3,!1),this._texturedPoleNorthVertexBuffer=i.createVertexBuffer(o,l3,!1),this._texturedPoleSouthVertexBuffer=i.createVertexBuffer(s,l3,!1)}getGridBuffers(i,r){return[this._gridBuffer,this._gridIndexBuffer,r?this._gridSegments[i].withSkirts:this._gridSegments[i].withoutSkirts]}getPoleBuffers(i,r){return[r?this._texturedPoleNorthVertexBuffer:this._poleNorthVertexBuffer,r?this._texturedPoleSouthVertexBuffer:this._poleSouthVertexBuffer,this._poleIndexBuffer,this._poleSegments[i]]}},r.eP=u$,r.eQ=to,r.eR=function(){return!!document.fullscreenElement||!!document.webkitFullscreenElement},r.eS=ts,r.eT=lt,r.eU=function(i,r,a){return i[0]=r[0]/a[0],i[1]=r[1]/a[1],i[2]=r[2]/a[2],i},r.eV=eb,r.eW=sQ,r.eX=eM,r.eY=ey,r.eZ=function([i,r,a]){let n=Math.hypot(i,r,a);return new s1(Math.atan2(i,a)*te,(.5*Math.PI-Math.acos(-r/n))*te)},r.e_=eV,r.ea=oA,r.eb=se,r.ec=256,r.ed=function(i){return i>>>=0,(i=Math.imul((i=Math.imul((i=Math.imul(0xa3c59ac3^i,0x9e3779b9)>>>0)^i>>>16,0x9e3779b9)>>>0)^i>>>16,0x9e3779b9)>>>0)/0x100000000},r.ee=o4,r.ef=aV,r.eg=6371008.8,r.eh=o5,r.ei=o3,r.ej=.0039101094886591446,r.ek=hr,r.el=hd,r.em=ok,r.en=function(i,r){var a=Math.sin(r),n=Math.cos(r);return i[0]=n,i[1]=0,i[2]=-a,i[3]=0,i[4]=0,i[5]=1,i[6]=0,i[7]=0,i[8]=a,i[9]=0,i[10]=n,i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i},r.eo=function(i,r){var a=Math.sin(r),n=Math.cos(r);return i[0]=1,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=n,i[6]=a,i[7]=0,i[8]=0,i[9]=-a,i[10]=n,i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i},r.ep=function(i,r){return i[0]=r[0],i[1]=r[1],i[2]=r[2],i[3]=r[4],i[4]=r[5],i[5]=r[6],i[6]=r[8],i[7]=r[9],i[8]=r[10],i},r.eq=o1,r.er=o2,r.es=function(i,r,a,n,o){return tl((i-r)/(a-r)*(o-n)+n,n,o)},r.et=eq,r.eu=function(i,r){var a=r[0],n=r[1],o=r[2],s=r[3],l=r[4],h=r[5],u=r[6],c=r[7],d=r[8],p=d*l-h*c,f=-d*s+h*u,m=c*s-l*u,_=a*p+n*f+o*m;return _?(i[0]=p*(_=1/_),i[1]=(-d*n+o*c)*_,i[2]=(h*n-o*l)*_,i[3]=f*_,i[4]=(d*a-o*u)*_,i[5]=(-h*a+o*s)*_,i[6]=m*_,i[7]=(-c*a+n*u)*_,i[8]=(l*a-n*s)*_,i):null},r.ev=2,r.ew=eC,r.ex=eG,r.ey=ed,r.ez=function(i,r){var a=new W(3);ed(a,r);var n=1/a[0],o=1/a[1],s=1/a[2],l=r[0]*n,h=r[1]*o,u=r[2]*s,c=r[4]*n,d=r[5]*o,p=r[6]*s,f=r[8]*n,m=r[9]*o,_=r[10]*s,g=l+d+_,y=0;return g>0?(y=2*Math.sqrt(g+1),i[3]=.25*y,i[0]=(p-m)/y,i[1]=(f-u)/y,i[2]=(h-c)/y):l>d&&l>_?(y=2*Math.sqrt(1+l-d-_),i[3]=(p-m)/y,i[0]=.25*y,i[1]=(h+c)/y,i[2]=(f+u)/y):d>_?(y=2*Math.sqrt(1+d-l-_),i[3]=(f-u)/y,i[0]=(h+c)/y,i[1]=.25*y,i[2]=(p+m)/y):(y=2*Math.sqrt(1+_-l-d),i[3]=(h-c)/y,i[0]=(f+u)/y,i[1]=(p+m)/y,i[2]=.25*y),i},r.f=tN,r.f0=function(i){let r=i.navigator?i.navigator.userAgent:null;return!!function(i){if(null==tM){let r=i.navigator?i.navigator.userAgent:null;tM=!!i.safari||!(!r||!(ti.test(r)||r.match("Safari")&&!r.match("Chrome")))}return tM}(i)&&!(!r||!(r.match("Version/15.4")||r.match("Version/15.5")||r.match(tr)))},r.f1=function(i,r){tq=i,tZ=r}
7,r.f2=hy,r.f3=hg,r.f4=function(i){let r=[0,0,0],a=et(new Float64Array(16));return er(a,i.pixelMatrix,i.globeMatrix),eL(r,r,a),new e8(r[0],r[1])},r.f5=function(i,r){if(!i||!r)throw Error("TileProvider name and URL are required");tF.TILE_PROVIDER_URLS[i]=tj.resolveURL(r)},r.f6=nY,r.f7=function(i,r,a=!1){if(n$===nG.deferred||n$===nG.loading||n$===nG.loaded)throw Error("setRTLTextPlugin cannot be called multiple times.");nq=tj.resolveURL(i),n$=nG.deferred,nH=r,nW(),a||nJ()},r.f8=tk,r.f9=tB,r.fA=d0,r.fB=ld,r.fC=function(i){return i<=1?1:Math.pow(2,Math.floor(Math.log2(i)))},r.fD=m9,r.fE=ll,r.fF=function(i){let r=0;if(0x46546c67!==new Uint32Array(i,0,1)[0]){let a=new Uint32Array(i,0,7),[,,n,o,s,l]=a;r=a.byteLength+o+s+l+s,(n!==i.byteLength||r>=i.byteLength)&&tw("Invalid b3dm header information.")}return c$(i,r)},r.fG=function(i,r){let a=i.json.extensionsUsed&&i.json.extensionsUsed.includes("mbx_bvh"),n=dT(i);for(let i of n){if(!a)for(let r of i.meshes)!function(i){i.heightmap=new Float32Array(4096),i.heightmap.fill(-1);let r=i.vertexArray.float32,a=i.aabb.min[0]-1,n=i.aabb.min[1]-1,o=64/(i.aabb.max[0]-a+2),s=64/(i.aabb.max[1]-n+2);for(let l=0;l<r.length;l+=3){let h=r[l+2],u=(r[l+0]-a)*o|0,c=(r[l+1]-n)*s|0;h>i.heightmap[64*c+u]&&(i.heightmap[64*c+u]=h)}}(r);i.lights&&(i.lightMeshIndex=i.meshes.length,i.meshes.push(function(i,r){let a={};a.indexArray=new oJ,a.vertexArray=new ok,a.colorArray=new oH,dS(i,r,a.indexArray,a.vertexArray,a.colorArray);let n={defined:!0};n.emissiveFactor=iI.black;let o={};return o.baseColorFactor=iI.white,n.pbrMetallicRoughness=o,a.material=n,a.aabb=new lP([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),a}(i.lights,r)))}return n},r.fH=mI,r.fI=tE,r.fJ=nK,r.fK=nG,r.fL=function(i){tY(),null!=u&&u.then(r=>{r.keys().then(a=>{for(let n=0;n<a.length-i;n++)r.delete(a[n]).catch(i=>tw(i.message))}).catch(i=>tw(i.message))}).catch(i=>tw(i.message))},r.fa=tO,r.fb=function(i){let r=tX();if(!r)return;let a=r.delete(t$);i&&a.then(()=>i()).catch(i)},r.fc=nl,r.fd=hD,r.fe=2,r.ff=rH,r.fg=fB,r.fh=sr,r.fi=mO,r.fj=mB,r.fk=dY,r.fl=lf,r.fm="hd_road_elevation",r.fn=lz,r.fo=tg,r.fp=uR,r.fq=h8,r.fr=p8,r.fs=1,r.ft=mi,r.fu=function(i,r,a,n,o,s,l,h=1,u,c,d,p){i.createArrays(),i.tilePixelRatio=8192/(512*i.overscaling),i.compareText={},i.iconsNeedLinear=!1;let f=i.layers[0].layout,m=i.layers[0]._unevaluatedLayout._values,_={};_.scaleFactor=h,_.textSizeScaleRange=f.get("text-size-scale-range"),_.iconSizeScaleRange=f.get("icon-size-scale-range");let[g,y]=_.textSizeScaleRange,[x,v]=_.iconSizeScaleRange;_.textScaleFactor=tl(_.scaleFactor,g,y),_.iconScaleFactor=tl(_.scaleFactor,x,v);let b=m["text-size"],w=m["icon-size"];if("composite"===i.textSizeData.kind){let{minZoom:r,maxZoom:a}=i.textSizeData;_.compositeTextSizes=[b.possiblyEvaluate(new n0(r,{worldview:d}),s),b.possiblyEvaluate(new n0(a,{worldview:d}),s)]}if("composite"===i.iconSizeData.kind){let{minZoom:r,maxZoom:a}=i.iconSizeData;_.compositeIconSizes=[w.possiblyEvaluate(new n0(r,{worldview:d}),s,p),w.possiblyEvaluate(new n0(a,{worldview:d}),s,p)]}_.layoutTextSize=b.possiblyEvaluate(new n0(l+1,{worldview:d}),s),_.layoutIconSize=w.possiblyEvaluate(new n0(l+1,{worldview:d}),s,p),_.textMaxSize=b.possiblyEvaluate(new n0(18,{worldview:d}),s);let T=f.get("symbol-placement"),S="map"===f.get("text-rotation-alignment")&&"point"!==T,E=f.get("text-size"),I=!1,A=[];for(let l of i.features){let h=f.get("text-font").evaluate(l,{},s).join(","),g=E.evaluate(l,{},s)*_.textScaleFactor,y=_.layoutTextSize.evaluate(l,{},s)*_.textScaleFactor,x=_.layoutIconSize.evaluate(l,{},s,p)*_.iconScaleFactor,v={horizontal:{},vertical:void 0},b=l.text,w,M=[0,0];if(b){let n=b.toString(),c=24*f.get("text-letter-spacing").evaluate(l,{},s),d=24*f.get("text-line-height").evaluate(l,{},s),p=!function(i){for(let a of i){var r;if(nd(r=a.charCodeAt(0))||np(r)||nf(r)||nz(r)||nB(r))return!1}return!0}(n)?0:c,m=f.get("text-anchor").evaluate(l,{},s),x=f.get("text-variable-anchor");if(!x){let i=f.get("text-radial-offset").evaluate(l,{},s);if(i)M=fw(m,[24*i,fx]);else{let i=f.get("text-offset").evaluate(l,{},s);M=[24*i[0],24*i[1]]}}
7let w=S?"center":f.get("text-justify").evaluate(l,{},s),E="point"===T,I=E?24*f.get("text-max-width").evaluate(l,{},s):1/0,A=s=>{i.allowVerticalPlacement&&nN(n)&&(v.vertical=pz(b,r,a,o,h,I,d,m,s,p,M,pP.vertical,!0,y,g,u,_.textScaleFactor))};if(!S&&x){let i="auto"===w?x.map(i=>fP(i)):[w],n=!1;for(let s=0;s<i.length;s++){let l=i[s];if(!v.horizontal[l])if(n)v.horizontal[l]=v.horizontal[0];else{let i=pz(b,r,a,o,h,I,d,"center",l,p,M,pP.horizontal,!1,y,g,u,_.textScaleFactor);i&&(v.horizontal[l]=i,n=1===i.positionedLines.length)}}A("left")}else{if("auto"===w&&(w=fP(m)),E||f.get("text-writing-mode").includes("horizontal")||!nN(n)){let i=pz(b,r,a,o,h,I,d,m,w,p,M,pP.horizontal,!1,y,g,u,_.textScaleFactor);i&&(v.horizontal[w]=i)}A(E?"left":w)}}let C,P,D,R,z,L,F=!1,O=f.get("icon-text-fit").evaluate(l,{},s);if(l.icon&&l.icon.hasPrimary()){let r=fA(l.icon,i.iconSizeData,m["icon-size"],s,i.zoom,l,u,_.iconScaleFactor,d,p);C=r.iconPrimary,D=r.iconSecondary;let a=C.toString();if((P=n.get(a))&&(z=f.get("icon-offset").evaluate(l,{},s),L=f.get("icon-anchor").evaluate(l,{},s),w=pj(o.get(a),D?o.get(D.toString()):void 0,z,L),F=P.sdf,void 0===i.sdfIcons?i.sdfIcons=P.sdf:i.sdfIcons!==P.sdf&&tw("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(P.pixelRatio!==i.pixelRatio||0!==f.get("icon-rotate").constantOr(1))&&(i.iconsNeedLinear=!0)),D){let i=D.toString();R=n.get(i)}}I=I||!(!l.icon||!l.icon.hasSecondary());let B=fz(v.horizontal)||v.vertical;i.iconsInText||(i.iconsInText=!!B&&B.iconsInText);let{defaultShapedIcon:k,verticallyShapedIcon:N}=function(i,r,a,n,o,s,l,h,u){let c=fz(s.horizontal)||s.vertical,d=a.get("icon-text-fit-padding").evaluate(n,{},o),p,f=r;return r&&"none"!==u&&(i.allowVerticalPlacement&&s.vertical&&(p=pG(r,s.vertical,u,d,h,l)),c&&(f=pG(r,c,u,d,h,l))),{defaultShapedIcon:f,verticallyShapedIcon:p}}(i,w,f,l,s,v,y*_.textScaleFactor/24,z,O);"none"!==O&&w&&(pH(w)||p$(w))&&(fE(0,P,C,w,k,O,c,n,o),fE(0,R,D,w,k,O,c,n,o),N&&(fE(0,P,C,w,N,O,c,n,o),fE(0,R,D,w,N,O,c,n,o)));let{iconBBox:U,iconVerticalBBox:V,textBBox:j,textVerticalBBox:G}=function(i,r,a,n,o,s,l,h,u,c,d,p,f,m,_){let g=i.layers[0],y=g.appearances;if(0===y.length)return{iconBBox:null,iconVerticalBBox:null,textBBox:null,textVerticalBBox:null};let x={iconBBox:null,iconVerticalBBox:null},v={textBBox:null,textVerticalBBox:null},{baseIconRotate:b,baseTextRotate:w,iconScaleFactor:T}=function(i,r,a){let n=i.get("icon-rotate").evaluate(r,{},a),o=i.get("text-rotate").evaluate(r,{},a),[s,l]=i.get("icon-size-scale-range");return{baseIconRotate:n,baseTextRotate:o,iconScaleFactor:tl(1,s,l)}}(n,o,s);r&&(x.iconBBox=fb(r,x.iconBBox,b),a)&&(x.iconVerticalBBox=fb(a,x.iconVerticalBBox,b+90));let S=fz(p.horizontal);for(let a of(S&&(v.textBBox=fb(S,v.textBBox,w,1,m)),p.vertical&&(v.textVerticalBBox=fb(p.vertical,v.textVerticalBBox,w+90,1,m)),y))a.hasIconLayoutProperties()&&function(i,r,a,n,o,s,l,h,u,c,d,p,f,m,_){let{appearanceIconOffset:g,appearanceIconRotate:y,appearanceIconSize:x}=fT(n,a,o,s,l,h,u,c.iconScaleFactor),v=null,b=null,w=null;n.hasLayoutProperty("icon-image")?w=function(i,r,a,n,o,s,l,h){let u=null,c=r.getAppearanceValueAndResolveTokens(a,"icon-image",n,o,h);if(c){let d=i.getResolvedImageFromTokens(c),p=a.hasLayoutProperty("icon-size")?a.getUnevaluatedLayoutProperty("icon-size"):r._unevaluatedLayout._values["icon-size"],f=fA(d,pZ(i.zoom,p,i.worldview,h),p,o,i.zoom,n,i.pixelRatio,l,i.worldview,h);u=s.get(f.iconPrimary.toString())}return u}(r,a,n,o,s,p,f,_):d&&(w=d.imagePrimary),w&&(v=pj(w,null,g,m),r.allowVerticalPlacement&&(b=pj(w,null,g,m)));let T=u>0?x/u:1;v&&(i.iconBBox=fb(v,i.iconBBox,y,1!==T?T:void 0)),b&&(i.iconVerticalBBox=fb(b,i.iconVerticalBBox,y+90,1!==T?T:void 0))}(x,i,g,a,o,s,h,b,l,u,r,c,T,d,_),a.hasTextLayoutProperties()&&function(i,r,a,n,o,s,l,h,u,c){let{appearanceTextOffset:d,appearanceTextRotate:p,appearanceTextSize:f}=fS(a,r,n,o,s,l,h),m=f/h,_=[(d[0]-s[0])*m,(d[1]-s[1])*m],g=0!==_[0]||0!==_[1];u&&(i.textBBox=fb(u,i.textBBox,p,m,d,g?_:void 0)),c&&(i.textVerticalBBox=fb(c,i.textVerticalBBox,p+90,m,d,g?_:void 0))}(v,g,a,o,s,m,w,f,S,p.vertical);return{iconBBox:x.iconBBox,iconVerticalBBox:x.iconVerticalBBox,textBBox:v.textBBox,textVerticalBBox:v.textVerticalBBox}}(i,w=k,N,f,l,s,x,z,_,o,L,v,y,M,p);A.push({feature:l,shapedTextOrientations:v,shapedText:B,shapedIcon:w,iconPrimary:C,iconSecondary:D,iconOffset:z,
7iconAnchor:L,verticallyShapedIcon:N,layoutTextSize:y,layoutIconSize:x,textOffset:M,isSDFIcon:F,iconTextFit:O,iconCollisionBounds:U,iconVerticalCollisionBounds:V,textCollisionBounds:j,textVerticalCollisionBounds:G})}return{featureData:A,sizes:_,hasAnySecondaryIcon:I,textAlongLine:S,symbolPlacement:T}},r.fv=p9,r.fw=p4,r.fx=p7,r.fy=fe,r.fz=function(i,r,a,n,o,s,l,h,u,c){i.iconAtlasPositions=c.iconPositions;let{featureData:d,hasAnySecondaryIcon:p,sizes:f,textAlongLine:m,symbolPlacement:_}=r;for(let r of d){let{shapedIcon:a,verticallyShapedIcon:s,feature:d,shapedTextOrientations:g,shapedText:y,layoutTextSize:x,textOffset:v,isSDFIcon:b,iconPrimary:w,iconSecondary:T,iconTextFit:S,iconOffset:E,iconCollisionBounds:I,iconVerticalCollisionBounds:A,textCollisionBounds:M}=r;fM(a,c.iconPositions,w,T),fM(s,c.iconPositions,w,T),function(i,r){for(let a in i.horizontal)fC(i.horizontal[a],r);fC(i.vertical,r)}(g,c.iconPositions),function(i,r,a){if(!r)return;let n=a.get(i.toString()),o=a.get(r.toString());n&&o&&(n.paddedRect.w===o.paddedRect.w&&n.paddedRect.h===o.paddedRect.h||tw(`Mismatch in icon variant sizes: ${i.toString()} and ${r.toString()}`),n.usvg!==o.usvg&&tw(`Mismatch in icon variant image types: ${i.id} and ${r.id}`))}(w,T,c.iconPositions),(y||a)&&function(i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w,T,S,E){var I;let A=l.textMaxSize.evaluate(r,{},f);void 0===A?A=h*l.textScaleFactor:A*=l.textScaleFactor;let M=i.layers[0].layout,C=h*l.textScaleFactor/24,P=fz(a.horizontal)||a.vertical,D=i.hasAnyAppearanceLayoutProperty(["text-size","text-offset","text-rotate"]),R=i.getAppearanceFeatureData(r.index);("none"!==y||D)&&R&&(R.textShaping=P,R.iconTextFitPadding=M.get("icon-text-fit-padding").evaluate(r,{},f),R.fontScale=C,R.textScaleFactor=l.textScaleFactor);let z="globe"===m.name,L=i.tilePixelRatio*A/24,F=(I=i.overscaling,i.zoom>18&&I>2&&(I>>=1),Math.max(8192/(512*I),1)*M.get("symbol-spacing")),O=M.get("text-padding")*i.tilePixelRatio,B=M.get("icon-padding")*i.tilePixelRatio,k=M.get("text-max-angle")*e7,N="map"===M.get("icon-rotation-alignment")&&"point"!==b,U=F/2;!1===i.hasAnyIconTextFit&&"none"!==y&&(i.hasAnyIconTextFit=!0);let V=r.properties?+r.properties[lf]:null,j=V&&i.elevationFeatureIdToIndex?i.elevationFeatureIdToIndex.get(V):65535,G=(h,u,b)=>{if(u.x<0||u.x>=8192||u.y<0||u.y>=8192)return;let E=null;if(z){let{x:i,y:r,z:a}=m.projectTilePoint(u.x,u.y,b);E={anchor:new pY(i,r,a,0,void 0),up:m.upVector(b,u.x,u.y)}}!function(i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w,T,S,E,I,A,M,C,P,D,R,z){let L=i.addToLineVertexArray(r,n),F,O,B,k,N,U,V,j=0,G=0,H=0,$=0,q=-1,Z=-1,W={},X=im(""),Y=a?a.anchor:r,J="none"!==C,K=0,Q=0;if(void 0===u._unevaluatedLayout.getValue("text-radial-offset")){let i=u.layout.get("text-offset").evaluate(w,{},I);K=24*i[0],Q=24*i[1]}else K=24*u.layout.get("text-radial-offset").evaluate(w,{},I),Q=fx;if(i.allowVerticalPlacement&&o.vertical){let i=o.vertical;if(_)U=fF(i),h&&(V=fF(h));else{let a=u.layout.get("text-rotate").evaluate(w,{},I)+90;B=fL(c,Y,r,d,p,f,i,m,a,g,z),h&&(k=fL(c,Y,r,d,p,f,h,x,a,null,R))}}if(s){let n=u.layout.get("icon-rotate").evaluate(w,{},I),o=fc(s,n,S,J,T.iconScaleFactor),l=h?fc(h,n,S,J,T.iconScaleFactor):void 0;O=fL(c,Y,r,d,p,f,s,x,n,null,D);let m=function(i,r,a,n,o,s,l,h,u,c){let d=i.layers[0],p=d.appearances,f=r.length;if(a&&(f=Math.max(f,a.length)),0===p.length)return f;let[m,_]=n.get("icon-size-scale-range"),g=tl(1,m,_);for(let r of p)if(r.hasLayoutProperty("icon-image")){let a=d.getAppearanceValueAndResolveTokens(r,"icon-image",s,l,c);if(a){let n=i.getResolvedImageFromTokens(a);if(n){let a=r.hasLayoutProperty("icon-size")?r.getUnevaluatedLayoutProperty("icon-size"):o._values["icon-size"],u=fA(n,pZ(i.zoom,a,i.worldview,c),a,l,i.zoom,s,i.pixelRatio,g,i.worldview,c),d=h.get(u.iconPrimary.toString());d&&(f=Math.max(f,function(i,r){let a=i.stretchY||[[0,i.paddedRect.h-2]];return i.stretchX||i.stretchY?ff(i.stretchX||[[0,i.paddedRect.w-2]])*ff(a):1}(d)))}}}return f}(i,o,l,u.layout,u._unevaluatedLayout,w,I,i.iconAtlasPositions,0,E);j=4*m;let _=u.layout.get("icon-size").evaluate(w,{},I,E),g=T.compositeIconSizes?T.compositeIconSizes[0].evaluate(w,{},I,E):0,y=T.compositeIconSizes?T.compositeIconSizes[1].evaluate(w,{},I,E):0,C=fR(i.layerIds[0],i.iconSizeData,_,s.imagePrimary.usvg?1:T.iconScaleFactor,g,y);i.addSymbols(i.icon,o,C,b,v,w,void 0,a,r,L.lineStartIndex,L.lineLength,-1,E,I,A,M,i.symbolInstances.length,m),q=i.icon.placedSymbolArray.length-1,l&&(G=4*m,i.addSymbols(i.icon,l,C,b,v,w,pP.vertical,a,r,L.lineStartIndex,L.lineLength,-1,E,I,A,M,i.symbolInstances.length,m),Z=i.icon.placedSymbolArray.length-1)}for(let n in o.horizontal){let s=o.horizontal[n];F||(X=im(s.text),_?N=fF(s):F=fL(c,Y,r,d,p,f,s,m,u.layout.get("text-rotate").evaluate(w,{},I),g,z));let h=1===s.positionedLines.length;if(H+=fD(i,a,r,s,l,u,_,w,g,L,o.vertical?pP.horizontal:pP.horizontalOnly,h?fy(o.horizontal):[n],W,q,T,E,I,i.symbolInstances.length,A),h)break}o.vertical&&($+=fD(i,a,r,o.vertical,l,u,_,w,g,L,pP.vertical,["vertical"],W,Z,T,E,I,i.symbolInstances.length,A));let ee=-1,et=(i,r)=>i?Math.max(i,r):r;ee=et(N,-1),ee=et(U,ee);let ei=+((ee=et(V,ee))>-1);i.glyphOffsetArray.length>=65535&&tw("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==w.sortKey&&i.addToSortKey
7Ranges(i.symbolInstances.length,w.sortKey),i.symbolInstances.emplaceBack(r.x,r.y,Y.x,Y.y,Y.z,W.right>=0?W.right:-1,W.center>=0?W.center:-1,W.left>=0?W.left:-1,W.vertical>=0?W.vertical:-1,q,Z,X,void 0!==F?F:i.collisionBoxArray.length,void 0!==F?F+1:i.collisionBoxArray.length,void 0!==B?B:i.collisionBoxArray.length,void 0!==B?B+1:i.collisionBoxArray.length,void 0!==O?O:i.collisionBoxArray.length,void 0!==O?O+1:i.collisionBoxArray.length,k||i.collisionBoxArray.length,k?k+1:i.collisionBoxArray.length,d,H,$,j,G,ei,0,K,Q,ee,0,+!!J,P)}(i,u,E,h,a,n,s,o,i.layers[0],i.collisionBoxArray,r.index,r.sourceLayerIndex,i.index,O,v,c,0,B,N,x,r,l,d,p,f,_,g,y,j,w,T,S)};if("line"===b)for(let o of cT(r.geometry,0,0,8192,8192))for(let r of function(i,r,a,n,o,s,l,h,u){let c=n?.6*24*l:0,d=pQ(n,o),p=d*l,f=0===i[0].x||8192===i[0].x||0===i[0].y||8192===i[0].y;return r-p<r/4&&(r=p+r/4),function i(r,a,n,o,s,l,h,u,c){let d=l/2,p=pK(r),f=0,m=a-n,_=[];for(let i=0;i<r.length-1;i++){let a=r[i],h=r[i+1],u=a.dist(h),g=h.angleTo(a);for(;m+n<f+u;){let y=((m+=n)-f)/u,x=iE(a.x,h.x,y),v=iE(a.y,h.y,y);if(x>=0&&x<c&&v>=0&&v<c&&m-d>=0&&m+d<=p){let a=new pY(x,v,0,g,i);o&&!pJ(r,a,l,o,s)||_.push(a)}}f+=u}return u||_.length||h||(_=i(r,f/2,n,o,s,l,h,!0,c)),_}(i,f?r/2*h%r:(d/2+48)*l*h%r,r,c,a,p,f,!1,u)}(o,F,k,a.vertical||P,n,24,L,i.overscaling,8192))P&&function(i,r,a,n){let o=i.compareText;if(r in o){let i=o[r];for(let r=i.length-1;r>=0;r--)if(n.dist(i[r])<a)return!0}else o[r]=[];return o[r].push(n),!1}(i,P.text,U,r)||G(o,r,f);else if("line-center"===b){for(let i of r.geometry)if(i.length>1){let r=function(i,r,a,n,o,s){let l=a?.6*24*s:0,h=pQ(a,n)*s,u=0,c=pK(i)/2;for(let a=0;a<i.length-1;a++){let n=i[a],o=i[a+1],s=n.dist(o);if(u+s>c){let d=(c-u)/s,p=new pY(iE(n.x,o.x,d),iE(n.y,o.y,d),0,o.angleTo(n),a);return!l||pJ(i,p,h,l,r)?p:void 0}u+=s}}(i,k,a.vertical||P,n,0,L);r&&G(i,r,f)}}else if("Polygon"===r.type)for(let i of h2(r.geometry,0)){let r=function(i,r=1,a=!1){let n=1/0,o=1/0,s=-1/0,l=-1/0,h=i[0];for(let i=0;i<h.length;i++){let r=h[i];(!i||r.x<n)&&(n=r.x),(!i||r.y<o)&&(o=r.y),(!i||r.x>s)&&(s=r.x),(!i||r.y>l)&&(l=r.y)}let u=Math.min(s-n,l-o),c=u/2,d=new rF([],f_);if(0===u)return new e8(n,o);for(let r=n;r<s;r+=u)for(let a=o;a<l;a+=u)d.push(new fg(r+c,a+c,c,i));let p=function(i){let r=0,a=0,n=0,o=i[0];for(let i=0,s=o.length,l=s-1;i<s;l=i++){let s=o[i],h=o[l],u=s.x*h.y-h.x*s.y;a+=(s.x+h.x)*u,n+=(s.y+h.y)*u,r+=3*u}return new fg(a/r,n/r,0,i)}(i),f=d.length;for(;d.length;){let n=d.pop();(n.d>p.d||!p.d)&&(p=n,a&&console.log("found best %d after %d probes",Math.round(1e4*n.d)/1e4,f)),n.max-p.d<=r||(c=n.h/2,d.push(new fg(n.p.x-c,n.p.y-c,c,i)),d.push(new fg(n.p.x+c,n.p.y-c,c,i)),d.push(new fg(n.p.x-c,n.p.y+c,c,i)),d.push(new fg(n.p.x+c,n.p.y+c,c,i)),f+=4)}return a&&(console.log(`num probes: ${f}`),console.log(`best distance: ${p.d}`)),p.p}(i,16);G(i[0],new pY(r.x,r.y,0,0,void 0),f)}else if("LineString"===r.type)for(let i of r.geometry)G(i,new pY(i[0].x,i[0].y,0,0,void 0),f);else if("Point"===r.type)for(let i of r.geometry)for(let r of i)G([r],new pY(r.x,r.y,0,0,void 0),f)}(i,d,g,a,s,u,f,x,0,v,b,n,o,l,h,p,S,E,m,_,I,A,M)}a&&i.generateCollisionDebugBuffers(s,i.collisionBoxArray,f.textScaleFactor)},r.g=tF,r.h=function(i,r){return it(Object.assign(i,{method:"GET"}),r)},r.i=function(i){return tF.API_STYLE_REGEX.test(i)&&!tU(i)},r.j=function(i){return btoa(encodeURIComponent(i).replace(/%([0-9A-F]{2})/g,(i,r)=>String.fromCharCode(Number("0x"+r))))},r.k=tK,r.l=function(i){return decodeURIComponent(atob(i).split("").map(i=>"%"+("00"+i.charCodeAt(0).toString(16)).slice(-2)).join(""))},r.m=ii,r.n=ia,r.o=tj,r.p=function(i,r){return it(Object.assign(i,{method:"POST"}),r)},r.q=hR,r.r=tV,r.s=function(i){try{let r=self[i];return r.setItem("_mapbox_test_",1),r.removeItem("_mapbox_test_"),!0}catch(i){return!1}},r.t=om,r.u=function(){return function i(r){return r?(r^Math.random()*(16>>r/4)).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,i)}()},r.v=function(i){return!!i&&tt.test(i)},r.w=tw,r.x=class{constructor(i){this.cache=new Map,this.textures=new Map,this.textureAccessTimes=new Map,this.textureMemoryUsed=0,this.maxTextureMemory=1024*(i&&i.maxTextureMemoryMB?i.maxTextureMemoryMB:256)*1024,this.finalizationRegistry=new FinalizationRegistry(i=>{this.cache.delete(i),this.clearExpiredTextures()})}calculateTextureMemory(i){return i.image?Math.ceil(i.image.width*i.image.height*4*(i.patternPositions.size>0?1.33:1)):0}evictTexture(i){let r=this.textures.get(i);if(r){let a=this.calculateTextureMemory(i);r.destroy(),this.textures.delete(i),this.textureAccessTimes.delete(i),this.textureMemoryUsed-=a,i.uploaded=!1}}evictTexturesIfNeeded(i){for(;this.textureMemoryUsed+i>this.maxTextureMemory&&this.textures.size>0;){let i=null,r=1/0;for(let[a]of this.textures.entries()){let n=this.textureAccessTimes.get(a)||0;n<r&&(r=n,i=a)}if(!i)break;this.evictTexture(i)}}findCachedAtlas(i){let r=this.cache.get(i.hash);if(r){let a=r.deref();if(a&&a.contentDescriptor&&this.isMipmapCompatible(i,a.contentDescriptor))return a}for(let[,r]of this.cache.entries()){let a=r.deref();if(a&&a.contentDescriptor){let r=i.subsetOf(a.contentDescriptor),n=this.isMipmapCompatible(i,a.contentDescriptor);if(r&&n)return a}}}getTextureForAtlas(i,r,a){this.textureAccessTimes.set(i,performance.now());let n=this.textures.get(i);if(n)return n;if(i.image){let o=this.calculateTextureMemory(i);return this.evictTexturesIfNeeded(o),n=new cX(r,i.image,a,{useMipmap:!!i.patternPositions.size}),this.textures.set(i,n),this.textureMemoryUsed+=o,n}return null}clearExpiredTextures(){for(let[i]of this.textures.entries())if(!this.isAtlasCached(i)){let r=this.textures.get(i);if(r){let a=this.calculateTextureMemory(i);r.destroy(),this.textureMemoryUsed-=a}this.textures.delete(i),this.textureAccessTimes.delete(i)}}isAtlasCached(i){if(!i.contentDescriptor)return!1;let r=this.cache.get(i.contentDescriptor.hash);return!!r&&r.deref()===i}getOrCache(i){if(!("image"in i)){let r=this.cache.get(i.sourceAtlasHash);if(r){let i=r.deref();if(i)return i}return tw("ImageAtlasReference points to GC'd atlas - atlas may have been evicted"),null}if(!i.contentDescriptor)return i;let r=i.contentDescriptor,a=r.hash,n=this.cache.get(a);if(n){let i=n.deref();if(i&&i.contentDescriptor&&this.isMipmapCompatible(r,i.contentDescriptor))return i}return this.cache.set(a,new WeakRef(i)),this.finalizationRegistry.register(i,a,i),i}isMipmapCompatible(i,r){return!i.requiresMipMaps||r.requiresMipMaps}destroyTextures(){for(let i of this.textures.values())i&&i.destroy();this.textures.clear(),this.textureAccessTimes.clear(),this.textureMemoryUsed=0}clear(){for(let i of this.textures.values())i&&i.destroy();this.cache.clear(),this.textures.clear(),this.textureAccessTimes.clear(),this.textureMemoryUsed=0}},r.y=ig,r.z=i_}),n(["require","./shared"],function(i,r){var a;function n(i){let r=i?i.url.toString():void 0;return r?performance.getEntriesByName(r):[]}function o(i){if("number"==typeof i||"boolean"==typeof i||"string"==typeof i||null==i)return JSON.stringify(i);if(Array.isArray(i)){let r="[";for(let a of i)r+=`${o(a)},`;return`${r}]`}let r="{";for(let a of Object.keys(i).sort())r+=`${a}:${o(i[a])},`;return`${r}}`}class s{constructor(i){this.keyCache=Object.create(null),this._layers=Object.create(null),this._layerConfigs=Object.create(null),i&&this.replace(i)}replace(i,r){this._layerConfigs=Object.create(null),this._layers=Object.create(null),this.update(i,[],r)}update(i,a,n){for(let a of(this._options=n,i))this._layerConfigs[a.id]=a,(this._layers[a.id]=r.dh(a,this.scope,null,this._options)).compileFilter(n),this.keyCache[a.id]&&delete this.keyCache[a.id];for(let i of a)delete this.keyCache[i],delete this._layerConfigs[i],delete this._layers[i];for(let i of(this.familiesBySource=Object.create(null),function(i,a){let n=Object.create(null);for(let s=0;s<i.length;s++){let l=i[s],h=a&&a[l.id];h||("symbol"===l.type?h=l.id:(h=function(i){let a="";for(let n of r.b8)a+=`/${o(i[n])}`;return a}(l),"line"===l.type&&l.paint&&function(i,r){return function i(a){return"string"==typeof a&&a===r||(Array.isArray(a)?a.some(i):!(!a||"object"!=typeof a)&&Object.values(a).some(i))}(i)}(l.paint["line-width"],"line-progress")&&(h+=`/${o(l.paint["line-width"])}`))),a&&(a[l.id]=h);let u=n[h];u||(u=n[h]=[]),u.push(l)}let s=[];for(let i in n)s.push(n[i]);return s}(Object.values(this._layerConfigs),this.keyCache))){let r=i.map(i=>this._layers[i.id]),a=r[0];if("none"===a.visibility)continue;let n=a.source||"",o=this.familiesBySource[n];o||(o=this.familiesBySource[n]=Object.create(null));let s=a.sourceLayer||"_geojsonTileLayer",l=o[s];l||(l=o[s]=[]),l.push(r)}}}let l=+r.fe;class h{constructor(i){let a={},n=[];for(let r in i){let o=i[r],s=a[r]={};for(let i in o.glyphs){let r=o.glyphs[+i];if(!r||0===r.bitmap.width||0===r.bitmap.height)continue;let a=r.metrics.localGlyph?l:1,h={x:0,y:0,w:r.bitmap.width+2*a,h:r.bitmap.height+2*a};n.push(h),s[i]=h}}let{w:o,h:s}=r.F(n),h=new r.fd({width:o||1,height:s||1});for(let n in i){let o=i[n];for(let i in o.glyphs){let s=o.glyphs[+i];if(!s||0===s.bitmap.width||0===s.bitmap.height)continue;let u=a[n][i],c=s.metrics.localGlyph?l:1;r.fd.copy(s.bitmap,h,{x:0,y:0},{x:u.x+c,y:u.y+c},s.bitmap)}}this.image=h,this.positions=a}}function u(i,r,a){i[r]?a&&(i[r].center=a):i[r]={floorIds:new Set,center:a||[0,0],floors:{}}}function c(i,r){return r.every(r=>i.properties&&null!=i.properties[r])}r.fc(h,"GlyphAtlas");class d{constructor(i){this.tileID=new r.aU(i.tileID.overscaledZ,i.tileID.wrap,i.tileID.canonical.z,i.tileID.canonical.x,i.tileID.canonical.y),this.tileZoom=i.tileZoom,this.uid=i.uid,this.zoom=i.zoom,this.lut=i.lut,this.canonical=i.tileID.canonical,this.pixelRatio=i.pixelRatio,this.tileSize=i.tileSize,this.source=i.source,this.scope=i.scope,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=i.showCollisionBoxes,this.showElevationIdDebug=i.showElevationIdDebug,this.collectResourceTiming=!!i.request&&i.request.collectResourceTiming,this.promoteId=i.promoteId,this.renderSourceType=i.renderSourceType,this.tileTransform=r.fg(i.tileID.canonical,i.projection),this.projection=i.projection,this.worldview=i.worldview,this.localizableLayerIds=i.localizableLayerIds,this.brightness=i.brightness,this.extraShadowCaster=!!i.extraShadowCaster,this.tessellationStep=i.tessellationStep,this.scaleFactor=i.scaleFactor,this.worldview=i.worldview,this.indoor=i.indoor}parse(i,a,n,o,s,l){this.status="parsing",this.data=i,this.collisionBoxArray=new r.fh;let d=new r.fi(Object.keys(i.layers).sort()),f=new r.fj(this.tileID,this.promoteId);f.bucketLayerIDs=[];let m={},_=new r.fk(256,256),g={featureIndex:f,iconDependencies:new Map,patternDependencies:new Map,glyphDependencies:{},lineAtlas:_,availableImages:n,brightness:this.brightness,scaleFactor:this.scaleFactor,showElevationIdDebug:this.showElevationIdDebug,elevationFeatures:void 0,activeFloors:void 0};this.indoor&&(g.activeFloors=function(i,a,n,o){let s=a.indoorState.activeFloorsVisible;if(!a.sourceLayers)return s?a.indoorState.activeFloors:void 0;let l=function(i,a){if(!i)return r.w("No source layers defined in indoor specification"),a;if(0===i.size)return a;for(let n of i.difference(a))r.w(`Missing source layer required in indoor specification: ${n}`);return a.intersection(a)}
7(a.sourceLayers,new Set(Object.keys(i.layers))),h=a.indoorState,d=function(i,a,n,o,s){let l={};for(let n of a){let a=i.layers[n];if(a)for(let i=0;i<a.length;i++){let n=a.feature(i);if(c(n,["type","id","name"])&&"structure"===n.properties.type){let{id:i,center:r}={id:n.properties.id.toString(),center:[n.properties.center_lon||0,n.properties.center_lat||0]};u(l,i,r);continue}if(c(n,["type","id","name","z_index"])&&"floor"===n.properties.type){let i=function(i,a){let n=i.properties.id.toString(),o=!!i.properties.is_default&&i.properties.is_default,s=i.properties.connected_floor_ids?new Set(i.properties.connected_floor_ids.toString().split(";")):new Set,l=i.properties.conflicted_floor_ids?new Set(i.properties.conflicted_floor_ids.toString().split(";")):new Set,h=i.properties.structure_ids?new Set(i.properties.structure_ids.toString().split(";")):new Set,u=i.properties.name.toString();return{id:n,isDefault:o,connections:s,conflicts:l,buildings:h,name:u,zIndex:i.properties.z_index,geometry:function(i,a){let n=i.loadGeometry();if(!n||0===n.length)return;let o=n.map(n=>n.map(n=>r.ff(n,a,i.extent)));return 0===o.length?void 0:{type:"Polygon",coordinates:[o[0]]}}(i,a)}}(n,s);var h=i.buildings,d=i.id;for(let r of h)u(l,r),l[r].floors[d]=i,l[r].floorIds.add(d)}}else r.w(`indoor source layer not found: ${n}`)}return{buildings:l,activeFloors:r.d3.calculate(l,o,n)}}(i,l,h.activeFloors,h.selectedFloorId,o);return n.send("setIndoorData",d),s?d.activeFloors:void 0}(i,this.indoor,s,this.canonical));let y=[],x=a.familiesBySource[this.source];for(let a in x){let s=i.layers[a];if(!s)continue;let l=!1,h=!1,u=!1,c=!1;for(let i of x[a])"symbol"===i[0].type?l=!0:"fill-extrusion"===i[0].type?h=!0:u=!0,i[0].is3D()&&"model"!==i[0].type&&(c=!0);if(this.extraShadowCaster&&!c||this.renderSourceType===r.b7.Symbol&&!l||this.renderSourceType===r.b7.FillExtrusion&&!h||this.renderSourceType===r.b7.Other&&!u)continue;1===s.version&&r.w(`Vector tile source "${this.source}" layer "${a}" does not use vector tile spec v2 and therefore may have some rendering errors.`);let _=d.encode(a),v=[],b=this.localizableLayerIds&&this.localizableLayerIds.has(a),w=!1;for(let i=0,n=0;i<s.length;i++){let o=s.feature(i),l=f.getId(o,a),h=o.properties?o.properties.worldview:null;if(b&&this.worldview&&"string"==typeof h)if("all"===h)o.properties.$localized=!0;else{if(!h.split(",").includes(this.worldview))continue;o.properties.$localized=!0,o.properties.worldview=this.worldview}!w&&o.properties&&Object.hasOwn(o.properties,r.fl)&&(w=!0),v.push({feature:o,id:l,index:n,sourceLayerIndex:_}),n++}for(let s of(w&&!g.elevationFeatures&&Object.hasOwn(i.layers,r.fm)&&(g.elevationFeatures=r.fn.parseFrom(i.layers[r.fm],this.canonical)),x[a])){let i=s[0];if(this.extraShadowCaster&&(!i.is3D()||"model"===i.type)||this.renderSourceType===r.b7.Symbol&&"symbol"!==i.type||this.renderSourceType===r.b7.FillExtrusion&&"fill-extrusion"!==i.type||this.renderSourceType===r.b7.Other&&("symbol"===i.type||"fill-extrusion"===i.type)||i.minzoom&&this.zoom<Math.floor(i.minzoom)||i.maxzoom&&this.zoom>=i.maxzoom||"none"===i.visibility)continue;p(s,this.zoom,g.brightness,n,this.worldview,g.activeFloors);let a=()=>{let a=m[i.id]=i.createBucket({index:f.bucketLayerIDs.length,layers:s,zoom:this.zoom,lut:this.lut,canonical:this.canonical,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:_,sourceID:this.source,projection:this.projection.spec,tessellationStep:this.tessellationStep,styleDefinedModelURLs:o,worldview:this.worldview,localizable:b,availableImages:n,maxUniformBufferBindings:this.maxUniformBufferBindings,maxUniformBlockSizeDwords:this.maxUniformBlockSizeDwords,disableSymbolUBO:this.disableSymbolUBO});f.bucketLayerIDs.push(s.map(i=>r.t(i.id,i.scope))),a.populate(v,g,this.tileID.canonical,this.tileTransform)};if("prepare"in i){let r=i.prepare().then(()=>a());y.push(r)}else a()}}let v=()=>{let a,o,u,c,y,x,v;_.trim();let b=!(!g.elevationFeatures||!g.elevationFeatures.some(i=>i.heightRange.min<0)),w={type:"maybePrepare",renderSourceType:this.renderSourceType,zoom:this.zoom},T=()=>{if(a)return this.status="done",l(a);if(this.extraShadowCaster)this.status="done",l(null,{buckets:Object.values(m).filter(i=>!i.isEmpty()),featureIndex:f,collisionBoxArray:null,hasTunnelGeometry:b,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:g.brightness,glyphMap:null,iconMap:null,glyphPositions:null});else if(o&&u&&c&&v){let i=void 0,a=new h(o),l=new Map;for(let[i,a]of u.entries()){let{imagePosition:n}=r.fr(i,a,r.fs);l.set(i,n)}let d={};for(let i in m){let s=m[i];s instanceof r.ft&&(p(s.layers,this.zoom,g.brightness,n,this.worldview,g.activeFloors),d[i]=r.fu(s,o,a.positions,u,l,this.tileID.canonical,this.tileZoom,this.scaleFactor,this.pixelRatio,y,this.worldview,n))}y.size||x.size?this.rasterizeTask=s.send("rasterizeImages",{scope:this.scope,iconTasks:y,patternTasks:x},(r,n)=>{if(!r)for(let[i,r]of n.entries())u.has(i)&&u.set(i,Object.assign(u.get(i),{data:r})),c.has(i)&&c.set(i,Object.assign(c.get(i),{data:r}));S(d,a,i,v)}):S(d,a,i,v)}},S=(i,a,o,h)=>{let d=u.size>0||c.size>0,y=Object.keys(i).length>0;if(!d&&!y)return this.status="done",void l(null,{buckets:Object.values(m).filter(i=>!i.isEmpty()),featureIndex:f,collisionBoxArray:this.collisionBoxArray,hasTunnelGeometry:b,glyphAtlasImage:a.image,lineAtlas:_,imageAtlas:null,brightness:g.brightness});let x=(o,s)=>{for(let a in m){let o=m[a];if(a in i)r.fz(o,i[a],this.showCollisionBoxes,n,this.tileID.canonical,this.tileZoom,this.projection,this.brightness,u,s);else if(o.hasPattern&&(o instanceof r.fA||o instanceof r.fp||o instanceof r.e3)){p(o.layers,this.zoom,g.brightness,n,this.worldview,g.activeFloors);let i=Object.fromEntries(s.patternPositions);o.addFeatures(g,this.tileID.canonical,i,n,this.tileTransform,this.brightness)}}this.status="done",l(null,{buckets:Object.values(m).filter(i=>!i.isEmpty()),featureIndex:f,collisionBoxArray:this.collisionBoxArray,hasTunnelGeometry:b,glyphAtlasImage:a.image,lineAtlas:_,imageAtlas:o,brightness:g.brightness})};if(d){let i=new Map,a=r.fv(u,i),n=r.fv(c,i),o=new r.fw(a,n,h,this.lut,i);s.send("checkAtlasCache",{descriptor:o,scope:this.scope},(i,a)=>{let n,o;
7if(i&&r.w(`[Worker] Error checking atlas cache: ${i.message}`),a)n=new r.fx(a.sourceHash),o=a;else{let i=new r.fy(u,c,this.lut,h);n=i,o=i}x(n,o)})}else x(null,{iconPositions:new Map,patternPositions:new Map})};if(!this.extraShadowCaster){let i=r.fo(g.glyphDependencies,i=>Object.keys(i).map(Number));Object.keys(i).length?s.send("getGlyphs",{uid:this.uid,stacks:i},(i,r)=>{a||(a=i,o=r,T())},void 0,!1,w):o={},v=new Map;let n=Array.from(g.iconDependencies.keys()).map(i=>r.I.parse(i)),l=Array.from(g.patternDependencies.keys()).map(i=>r.I.parse(i));n.length||l.length?s.send("getImages",{icons:n,patterns:l,source:this.source,scope:this.scope,tileID:this.tileID},(i,r)=>{if(!a){for(let[n,o]of(a=i,u=new Map,c=new Map,y=this.updateImageMapAndGetImageTaskQueue(u,r.images,g.iconDependencies),x=this.updateImageMapAndGetImageTaskQueue(c,r.images,g.patternDependencies),r.versions.entries()))v.set(n,o);T()}},void 0,!1,w):(u=new Map,c=new Map,y=new Map,x=new Map)}if(g.elevationFeatures&&g.elevationFeatures.length>0){let a=[];for(let i of Object.values(m))if(i instanceof r.fp){let r=i.getUnevaluatedPortalGraph();r&&a.push(r)}let n=r.fq.evaluate(a);for(let a of Object.values(m))if(a instanceof r.fp){let r=i.layers[d.decode(a.sourceLayerIndex)];a.setEvaluatedPortalGraph(n,r,this.tileID.canonical,g.availableImages,g.brightness)}}T()};y.length>0?Promise.allSettled(y).then(v).catch(l):v()}updateParameters(i){this.scaleFactor=i.scaleFactor,this.showCollisionBoxes=i.showCollisionBoxes,this.showElevationIdDebug=i.showElevationIdDebug,this.projection=i.projection,this.brightness=i.brightness,this.tileTransform=r.fg(i.tileID.canonical,i.projection),this.extraShadowCaster=i.extraShadowCaster,this.lut=i.lut,this.worldview=i.worldview,this.indoor=i.indoor}updateImageMapAndGetImageTaskQueue(i,r,a){let n=new Map;for(let o of r.keys())for(let s of a.get(o)||[]){let a=s.toString(),o=r.get(s.id.toString());o.usvg?n.has(a)||(n.set(a,s),i.set(a,Object.assign({},o))):i.set(a,o)}return n}cancelRasterize(){this.rasterizeTask&&this.rasterizeTask.cancel()}}function p(i,a,n,o,s,l){let h=new r.ab(a,{brightness:n,worldview:s,activeFloors:l});for(let r of i)r.recalculate(h,o)}class f extends r.E{constructor({actor:i,layerIndex:a,availableImages:n,availableModels:o,isSpriteLoaded:s,tileProvider:l,brightness:h,maxUniformBufferBindings:u,maxUniformBlockSizeDwords:c,disableSymbolUBO:d}){super(),this.actor=i,this.layerIndex=a,this.availableImages=n,this.availableModels=o,this.loadVectorData=r.aQ,this.tileProvider=l,this.loading={},this.loaded={},this.deduped=new r.aL(i.scheduler),this.isSpriteLoaded=s,this.scheduler=i.scheduler,this.brightness=h,this.maxUniformBufferBindings=u,this.maxUniformBlockSizeDwords=c,this.disableSymbolUBO=d}loadTileData(i,r){if(!this.tileProvider)return this.loadVectorData(i,r);let a=new AbortController;return this.loadTileWithProvider(this.tileProvider,i,a,r),()=>a.abort()}async loadTileWithProvider(i,r,a,n){let{z:o,x:s,y:l}=r.tileID.canonical;try{let h=await i.loadTile({z:o,x:s,y:l},{request:r.request,signal:a.signal});if(a.signal.aborted)return;if(null==h){let i=Error("Tile not found");return i.status=404,n(i)}if(null==h.data)return n(null,null);let u=new Map;h.expires&&u.set("expires",h.expires),h.cacheControl&&u.set("cache-control",h.cacheControl),n(null,{rawData:h.data,responseHeaders:u})}catch(i){if(a.signal.aborted)return;n(i instanceof Error?i:Error(String(i)))}}loadTile(i,a){let o=i.uid,s=i&&i.request,l=s&&s.collectResourceTiming,h=this.loading[o]=new d(i);h.maxUniformBufferBindings=this.maxUniformBufferBindings,h.maxUniformBlockSizeDwords=this.maxUniformBlockSizeDwords,h.disableSymbolUBO=this.disableSymbolUBO,h.abort=this.loadTileData(i,(u,c)=>{let d=!this.loading[o];if(delete this.loading[o],h.cancelRasterize(),d||u||!c)return h.status="done",d||(this.loaded[o]=h),a(u);let p=c.rawData,f={},m=r.aR(c.responseHeaders);m&&m.expires&&(f.expires=m.expires),m&&m.cacheControl&&(f.cacheControl=m.cacheControl),h.vectorTile=c.vectorTile||new r.fB(new r.b2(p));let _=()=>{h.parse(h.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,(i,r)=>{if(i||!r)return a(i);let o={};if(l){let i=n(s);i.length>0&&(o.resourceTiming=JSON.parse(JSON.stringify(i)))}a(null,Object.assign({rawTileData:p.slice(0),responseHeaders:c.responseHeaders},r,f,o))})};this.isSpriteLoaded?_():this.once("isSpriteLoaded",()=>{this.scheduler?this.scheduler.add(_,{type:"parseTile",renderSourceType:i.renderSourceType,zoom:i.tileZoom}):_()}),this.loaded=this.loaded||{},this.loaded[o]=h})}reloadTile(i,r){let a=this.loaded,n=i.uid;if(a&&a[n]){let o=a[n];o.updateParameters(i);let s=(i,a)=>{let n=o.reloadCallback;n&&(delete o.reloadCallback,o.parse(o.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,n)),r(i,a)};"parsing"===o.status?o.reloadCallback=s:"done"===o.status&&(o.vectorTile?o.parse(o.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,s):s())}else r(null,void 0)}abortTile(i,r){let a=i.uid,n=this.loading[a];n&&(n.abort&&n.abort(),delete this.loading[a]),r()}removeTile(i,r){let a=this.loaded,n=i.uid;a&&a[n]&&delete a[n],r()}}class m{constructor(i){this.tileProvider=i.tileProvider,this.loading={}}loadTile(i,a){let n=i.uid;if(this.tileProvider){let r=new AbortController;return this.loading[n]={cancel:()=>r.abort()},void this.loadTileWithProvider(this.tileProvider,n,i,r,a)}let{cancel:o}=r.b4(i.request,(o,s,l)=>{let h=!this.loading[n];if(delete this.loading[n],h||o||!s)return a(o);this.decodeTile(n,s,i.encoding).then(i=>{let{expires:n,cacheControl:o}=r.aR(l);a(null,Object.assign(i,{expires:n,cacheControl:o}
7))}).catch(i=>a(i))});this.loading[n]={cancel:o}}async decodeTile(i,a,n){let o=await createImageBitmap(new Blob([new Uint8Array(a)],{type:"image/png"})),s=1-(o.width-r.fC(o.width))/2,l=s<1,h=this.getImageData(o,s);return o.close(),{dem:new r.fD(i,h,n,l),borderReady:l}}async loadTileWithProvider(i,r,a,n,o){let{z:s,x:l,y:h}=a.tileID.canonical;try{let u=await i.loadTile({z:s,x:l,y:h},{request:a.request,signal:n.signal});if(n.signal.aborted)return o(null,null);if(null==u){let i=Error("Tile not found");return i.status=404,o(i)}if(null==u.data)return o(null,null);let c=await this.decodeTile(r,u.data,a.encoding);if(n.signal.aborted)return o(null,null);o(null,Object.assign(c,{expires:u.expires,cacheControl:u.cacheControl}))}catch(i){if(n.signal.aborted||i instanceof DOMException&&"AbortError"===i.name)return o(null,null);o(i instanceof Error?i:Error(String(i)))}finally{delete this.loading[r]}}reloadTile(i,r){r(null,null)}abortTile(i,r){let a=i.uid,n=this.loading[a];n&&(n.cancel(),delete this.loading[a]),r()}removeTile(i,r){r()}getImageData(i,r){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(i.width,i.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d",{willReadFrequently:!0})),this.offscreenCanvas.width=i.width,this.offscreenCanvas.height=i.height,this.offscreenCanvasContext.drawImage(i,0,0,i.width,i.height);let a=this.offscreenCanvasContext.getImageData(-r,-r,i.width+2*r,i.height+2*r);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),a}}r.b1.setPbf(r.b2);class _{constructor(i){this._mrt=new r.b1(i.partial?30:1/0),this._isHeaderLoaded=!1,this.uid=i.uid,this.tileID=i.tileID,this.source=i.source}parse(i,a){let n=this._mrt;this.status="parsing",this._entireBuffer=i;try{n.parseHeader(i),this._isHeaderLoaded=!0;let o=[];for(let a in n.layers){let s=n.getLayer(a),l=s.getDataRange(s.getBandList()),h=n.createDecodingTask(l),u=i.slice(l.firstByte,l.lastByte+1),c=r.b1.performDecoding(u,h).then(i=>h.complete(null,i)).catch(i=>h.complete(i,null));o.push(c)}Promise.allSettled(o).then(()=>a(null,n)).catch(i=>a(i))}catch(i){a(i)}}}class g{constructor({actor:i}){this.actor=i,this.loading={},this.loaded={}}loadTile(i,a){let n=i.uid,o=i.request,s=this.loading[n]=new _(i),{cancel:l}=r.b4(o,(i,r,o)=>{let l=!this.loading[n];if(delete this.loading[n],l||i||!r)return s.status="done",l||(this.loaded[n]=s),a(i);s.parse(r,(i,r)=>{if(i||!r)return a(i);a(null,r,o)}),this.loaded[n]=s});s.abort=l}reloadTile(i,r){r(null,void 0)}abortTile(i,r){let a=i.uid,n=this.loading[a];n&&(n.abort&&n.abort(),delete this.loading[a]),r()}removeTile(i,r){let a=i.uid;this.loaded[a]&&delete this.loaded[a],r()}decodeRasterArray(i,a){r.b1.performDecoding(i.buffer,i.task).then(i=>a(null,i)).catch(i=>a(i))}}let y=r.fE.prototype.toGeoJSON;class x{constructor(i){this._feature=i,this.extent=r.ak,this.type=i.type,this.properties=i.tags,"id"in i&&!isNaN(i.id)&&(this.id=parseInt(i.id,10))}loadGeometry(){if(1===this._feature.type){let i=[];for(let a of this._feature.geometry)i.push([new r.P(a[0],a[1])]);return i}{let i=[];for(let a of this._feature.geometry){let n=[];for(let i of a)n.push(new r.P(i[0],i[1]));i.push(n)}return i}}toGeoJSON(i,r,a){return y.call(this,i,r,a)}}class v{constructor(i,a){this.name=i,this.extent=r.ak,this.length=a.length,this._jsonFeatures=a}feature(i){return new x(this._jsonFeatures[i])}}class b{constructor(i){for(let a of(this.layers={},this.extent=r.ak,Object.keys(i)))this.layers[a]=new v(a,i[a])}}let w=64/4096;class T{constructor(){this.features=new Map}clear(){this.features.clear()}load(i=[],r){for(let a of i){let i=a.id;if(null==i)continue;let n=this.features.get(i);n&&this.updateCache(n,r),a.geometry?(n=function(i){let{id:r,geometry:a,properties:n}=i;if(!a)return;if("GeometryCollection"===a.type)throw Error("GeometryCollection not supported in dynamic mode.");let{type:o,coordinates:s}=a,l={id:r,type:1,geometry:[],tags:n,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0},h=l.geometry;if("Point"===o)E(s,h,l);else if("MultiPoint"===o)for(let i of s)E(i,h,l);else if("LineString"===o)l.type=2,I(s,h,l);else if("MultiLineString"===o)l.type=2,A(s,h,l);else if("Polygon"===o)l.type=3,A(s,h,l,!0);else{if("MultiPolygon"!==o)throw Error("Input data is not a valid GeoJSON object.");for(let i of(l.type=3,s))A(i,h,l,!0)}return l}(a),this.updateCache(n,r),this.features.set(i,n)):this.features.delete(i),this.updateCache(n,r)}}updateCache(i,r){for(let{canonical:a,uid:n}of Object.values(r)){let{z:o,x:s,y:l}=a;
7S(i,Math.pow(2,o),s,l)&&delete r[n]}}getTile(i,a,n){let o=Math.pow(2,i),s=[];for(let i of this.features.values())S(i,o,a,n)&&s.push(function(i,a,n,o){let{id:s,type:l,geometry:h,tags:u}=i,c=[];if(1===l)for(let i=0;i<h.length;i+=2){let s=Math.round(r.ak*(h[i+0]*a-n)),l=Math.round(r.ak*(h[i+1]*a-o));c.push([s,l])}else if(2===l)for(let i of h)!function(i,a,n,o,s){let l,h=r.ak+128;for(let u=0;u<i.length-2;u+=2){let c=Math.round(r.ak*(i[u+0]*a-n)),d=Math.round(r.ak*(i[u+1]*a-o)),p=Math.round(r.ak*(i[u+2]*a-n)),f=Math.round(r.ak*(i[u+3]*a-o)),m=p-c,_=f-d;c<-128&&p<-128||(c<-128?(d+=Math.round((-128-c)/m*_),c=-128):p<-128&&(f=d+Math.round((-128-c)/m*_),p=-128),d<-128&&f<-128||(d<-128?(c+=Math.round((-128-d)/_*m),d=-128):f<-128&&(p=c+Math.round((-128-d)/_*m),f=-128),c>=h&&p>=h||(c>=h?(d+=Math.round((h-c)/m*_),c=h):p>=h&&(f=d+Math.round((h-c)/m*_),p=h),d>=h&&f>=h||(d>=h?(c+=Math.round((h-d)/_*m),d=h):f>=h&&(p=c+Math.round((h-d)/_*m),f=h),l&&c===l.at(-1)[0]&&d===l.at(-1)[1]||(l=[[c,d]],s.push(l)),l.push([p,f])))))}}(i,a,n,o,c);else if(3===l)for(let i of h)!function(i,a,n,o,s){let l=(n-w)/a,h=(o-w)/a,u=(n+1+w)/a,c=(o+1+w)/a;function d(i,r){let a=0;return i<l?a|=1:i>u&&(a|=2),r<h?a|=4:r>c&&(a|=8),a}let p=[];for(let r=1;r<=8;r*=2){let a=i[i.length-2],n=i.at(-1),o=!(d(a,n)&r);for(let s=0;s<i.length;s+=2){let f=i[s],m=i[s+1],_=!(d(f,m)&r);_!==o&&(8&r?p.push(a+(f-a)*(c-n)/(m-n),c):4&r?p.push(a+(f-a)*(h-n)/(m-n),h):2&r?p.push(u,n+(m-n)*(u-a)/(f-a)):1&r&&p.push(l,n+(m-n)*(l-a)/(f-a))),_&&p.push(f,m),a=f,n=m,o=_}if(!(i=p).length||8===r)break;p=[]}let f=[];for(let i=0;i<p.length;i+=2)f.push([Math.round(r.ak*(p[i]*a-n)),Math.round(r.ak*(p[i+1]*a-o))]);f.length&&s.push(f)}(i,a,n,o,c);return{id:s,type:l,geometry:c,tags:u}}(i,o,a,n));return{features:s}}getFeatures(){return[...this.features.values()]}}function S({minX:i,minY:r,maxX:a,maxY:n},o,s,l){return i<(s+1+w)/o&&r<(l+1+w)/o&&a>(s-w)/o&&n>(l-w)/o}function E([i,a],n,o){let s=r.aG(i),l=r.aJ(a);l=l<0?0:l>1?1:l,n.push(s,l),o.minX=Math.min(o.minX,s),o.minY=Math.min(o.minY,l),o.maxX=Math.max(o.maxX,s),o.maxY=Math.max(o.maxY,l)}function I(i,r,a,n=!1,o=!1){let s=[];for(let r of i)E(r,s,a);
7r.push(s),n&&function(i,r){let a=0;for(let r=0,n=i.length,o=n-2;r<n;o=r,r+=2)a+=(i[r]-i[o])*(i[r+1]+i[o+1]);if(a>0===r)for(let r=0,a=i.length;r<a/2;r+=2){let n=i[r],o=i[r+1];i[r]=i[a-2-r],i[r+1]=i[a-1-r],i[a-2-r]=n,i[a-1-r]=o}}(s,o)}function A(i,r,a,n=!1){for(let o=0;o<i.length;o++)I(i[o],r,a,n,0===o)}function M({name:i,features:a},n){n.writeStringField(1,i),n.writeVarintField(5,r.ak);let o=new Map,s=new Map,l={keys:o,values:s,feature:null};for(let i of a)l.feature=i,n.writeMessage(2,C,l);for(let i of o.keys())n.writeStringField(3,i);for(let i of s.keys())n.writeMessage(4,L,i)}function C(i,r){let a=i.feature;void 0!==a.id&&Number.isSafeInteger(+a.id)&&r.writeVarintField(1,+a.id),a.tags&&r.writeMessage(2,P,i),r.writeVarintField(3,a.type),r.writeMessage(4,z,a)}function P({keys:i,values:r,feature:a},n){for(let o of Object.keys(a.tags)){let s=a.tags[o];if(null===s)continue;let l=i.get(o);void 0===l&&(l=i.size,i.set(o,l)),n.writeVarint(l);let h=typeof s;"string"!==h&&"boolean"!==h&&"number"!==h&&(s=JSON.stringify(s));let u=r.get(s);void 0===u&&(u=r.size,r.set(s,u)),n.writeVarint(u)}}function D(i,r){return(r<<3)+(7&i)}function R(i){return i<<1^i>>31}function z(i,r){let{geometry:a,type:n}=i,o=0,s=0;if(1===n)for(let i of(r.writeVarint(D(1,a.length)),a)){let a=i[0]-o,n=i[1]-s;r.writeVarint(R(a)),r.writeVarint(R(n)),o+=a,s+=n}else for(let i of a){if(0===i.length)continue;r.writeVarint(D(1,1));let a=i.length-(3===n);for(let n=0;n<a;n++){1===n&&r.writeVarint(D(2,a-1));let l=i[n][0]-o,h=i[n][1]-s;r.writeVarint(R(l)),r.writeVarint(R(h)),o+=l,s+=h}3===n&&r.writeVarint(D(7,1))}}function L(i,r){let a=typeof i;"string"===a?r.writeStringField(1,i):"boolean"===a?r.writeBooleanField(7,i):"number"===a&&(i%1!=0?r.writeDoubleField(3,i):i<0?r.writeSVarintField(6,i):r.writeVarintField(5,i))}let F={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:i=>i},O=Math.fround||(a=new Float32Array(1),i=>(a[0]=+i,a[0]));class B{constructor(i){this.options=Object.assign(Object.create(F),i),this.trees=Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(i){let{log:r,minZoom:a,maxZoom:n}=this.options;r&&console.time("total time");let o=`prepare ${i.length} points`;r&&console.time(o),this.points=i;let s=[];for(let r=0;r<i.length;r++){let a=i[r];if(!a.geometry)continue;let[n,o]=a.geometry.coordinates,l=O(U(n)),h=O(V(o));s.push(l,h,1/0,r,-1,1),this.options.reduce&&s.push(0)}let l=this.trees[n+1]=this._createTree(s);r&&console.timeEnd(o);for(let i=n;i>=a;i--){let a=+Date.now();l=this.trees[i]=this._createTree(this._cluster(l,i)),r&&console.log("z%d: %d clusters in %dms",i,l.numItems,Date.now()-a)}return r&&console.timeEnd("total time"),this}getClusters(i,r){let a=((i[0]+180)%360+360)%360-180,n=Math.max(-90,Math.min(90,i[1])),o=180===i[2]?180:((i[2]+180)%360+360)%360-180,s=Math.max(-90,Math.min(90,i[3]));if(i[2]-i[0]>=360)a=-180,o=180;else if(a>o){let i=this.getClusters([a,n,180,s],r),l=this.getClusters([-180,n,o,s],r);return i.concat(l)}let l=this.trees[this._limitZoom(r)],h=l.range(U(a),V(s),U(o),V(n)),u=l.data,c=[];for(let i of h){let r=this.stride*i;c.push(u[r+5]>1?k(u,r,this.clusterProps):this.points[u[r+3]])}return c}getChildren(i){let r=this._getOriginId(i),a=this._getOriginZoom(i),n="No cluster with the specified id.",o=this.trees[a];if(!o)throw Error(n);let s=o.data;if(r*this.stride>=s.length)throw Error(n);let l=this.options.radius/(this.options.extent*Math.pow(2,a-1)),h=o.within(s[r*this.stride],s[r*this.stride+1],l),u=[];for(let r of h){let a=r*this.stride;s[a+4]===i&&u.push(s[a+5]>1?k(s,a,this.clusterProps):this.points[s[a+3]])}if(0===u.length)throw Error(n);return u}getLeaves(i,r,a){let n=[];return this._appendLeaves(n,i,r=r||10,a=a||0,0),n}getTile(i,r,a){let n=this.trees[this._limitZoom(i)],o=Math.pow(2,i),{extent:s,radius:l}=this.options,h=l/s,u=(a-h)/o,c=(a+1+h)/o,d={features:[]};return this._addTileFeatures(n.range((r-h)/o,u,(r+1+h)/o,c),n.data,r,a,o,d),0===r&&this._addTileFeatures(n.range(1-h/o,u,1,c),n.data,o,a,o,d),r===o-1&&this._addTileFeatures(n.range(0,u,h/o,c),n.data,-1,a,o,d),d.features.length?d:null}getClusterExpansionZoom(i){let r=this._getOriginZoom(i)-1;for(;r<=this.options.maxZoom;){let a=this.getChildren(i);if(r++,1!==a.length)break;i=a[0].properties.cluster_id}return r}_appendLeaves(i,r,a,n,o){for(let s of this.getChildren(r)){let r=s.properties;if(r&&r.cluster?o+r.point_count<=n?o+=r.point_count:o=this._appendLeaves(i,r.cluster_id,a,n,o):o<n?o++:i.push(s),i.length===a)break}return o}_createTree(i){let a=new r.bM(i.length/this.stride|0,this.options.nodeSize,Float32Array);for(let r=0;r<i.length;r+=this.stride)a.add(i[r],i[r+1]);return a.finish(),a.data=i,a}_addTileFeatures(i,r,a,n,o,s){for(let l of i){let i,h,u,c,d=l*this.stride,p=r[d+5]>1;if(p)i=N(r,d,this.clusterProps),h=r[d],u=r[d+1];else{let a=this.points[r[d+3]];i=a.properties;let[n,o]=a.geometry.coordinates;h=U(n),u=V(o)}let f={type:1,geometry:[[Math.round(this.options.extent*(h*o-a)),Math.round(this.options.extent*(u*o-n))]],tags:i};void 0!==(c=p||this.options.generateId?r[d+3]:this.points[r[d+3]].id)&&(f.id=c),s.features.push(f)}}_limitZoom(i){return Math.max(this.options.minZoom,Math.min(Math.floor(+i),this.options.maxZoom+1))}_cluster(i,r){let{radius:a,extent:n,reduce:o,minPoints:s}=this.options,l=a/(n*Math.pow(2,r)),h=i.data,u=[],c=this.stride;for(let a=0;a<h.length;a+=c){if(h[a+2]<=r)continue;h[a+2]=r;let n=h[a],d=h[a+1],p=i.within(h[a],h[a+1],l),f=h[a+5],m=f;for(let i of p){let a=i*c;h[a+2]>r&&(m+=h[a+5])}if(m>f&&m>=s){let i,s=n*f,l=d*f,_=-1,g=(a/c<<5)+(r+1)+this.points.length;for(let n of p){let u=n*c;if(h[u+2]<=r)continue;h[u+2]=r;
7let d=h[u+5];s+=h[u]*d,l+=h[u+1]*d,h[u+4]=g,o&&(i||(i=this._map(h,a,!0),_=this.clusterProps.length,this.clusterProps.push(i)),o(i,this._map(h,u)))}h[a+4]=g,u.push(s/m,l/m,1/0,g,-1,m),o&&u.push(_)}else{for(let i=0;i<c;i++)u.push(h[a+i]);if(m>1)for(let i of p){let a=i*c;if(!(h[a+2]<=r)){h[a+2]=r;for(let i=0;i<c;i++)u.push(h[a+i])}}}}return u}_getOriginId(i){return i-this.points.length>>5}_getOriginZoom(i){return(i-this.points.length)%32}_map(i,r,a){if(i[r+5]>1){let n=this.clusterProps[i[r+6]];return a?Object.assign({},n):n}let n=this.points[i[r+3]].properties,o=this.options.map(n);return a&&o===n?Object.assign({},o):o}}function k(i,r,a){return{type:"Feature",id:i[r+3],properties:N(i,r,a),geometry:{type:"Point",coordinates:[360*(i[r]-.5),360*Math.atan(Math.exp((180-360*i[r+1])*Math.PI/180))/Math.PI-90]}}}function N(i,r,a){let n=i[r+5],o=n>=1e4?`${Math.round(n/1e3)}k`:n>=1e3?Math.round(n/100)/10+"k":n,s=i[r+6];return Object.assign(-1===s?{}:Object.assign({},a[s]),{cluster:!0,cluster_id:i[r+3],point_count:n,point_count_abbreviated:o})}function U(i){return i/360+.5}function V(i){let r=Math.sin(i*Math.PI/180),a=.5-.25*Math.log((1+r)/(1-r))/Math.PI;return a<0?0:a>1?1:a}function j(i,r,a,n){let o={id:i??null,type:r,geometry:a,tags:n,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if("Point"===r||"MultiPoint"===r||"LineString"===r)G(o,a);else if("Polygon"===r)G(o,a[0]);else if("MultiLineString"===r)for(let i of a)G(o,i);else if("MultiPolygon"===r)for(let i of a)G(o,i[0]);return o}function G(i,r){for(let a=0;a<r.length;a+=3)i.minX=Math.min(i.minX,r[a]),i.minY=Math.min(i.minY,r[a+1]),i.maxX=Math.max(i.maxX,r[a]),i.maxY=Math.max(i.maxY,r[a+1])}function H(i,r,a,n){if(!r.geometry)return;let o=r.geometry.coordinates;if(o&&0===o.length)return;let s=r.geometry.type,l=Math.pow(a.tolerance/((1<<a.maxZoom)*a.extent),2),h=[],u=r.id;if(a.promoteId?u=r.properties[a.promoteId]:a.generateId&&(u=n||0),"Point"===s)$(o,h);else if("MultiPoint"===s)for(let i of o)$(i,h);else if("LineString"===s)q(o,h,l,!1);else if("MultiLineString"===s){if(a.lineMetrics){for(let a of o)q(a,h=[],l,!1),i.push(j(u,"LineString",h,r.properties));return}Z(o,h,l,!1)}else if("Polygon"===s)Z(o,h,l,!0);else{if("MultiPolygon"!==s){if("GeometryCollection"===s){for(let o of r.geometry.geometries)H(i,{id:u,geometry:o,properties:r.properties},a,n);return}throw Error("Input data is not a valid GeoJSON object.")}for(let i of o){let r=[];Z(i,r,l,!0),h.push(r)}}i.push(j(u,s,h,r.properties))}function $(i,r){r.push(i[0]/360+.5,W(i[1]),0)}function q(i,r,a,n){let o,s,l=0;for(let a=0;a<i.length;a++){let h=i[a][0]/360+.5,u=W(i[a][1]);r.push(h,u,0),a>0&&(l+=n?(o*u-h*s)/2:Math.sqrt(Math.pow(h-o,2)+Math.pow(u-s,2))),o=h,s=u}let h=r.length-3;r[2]=1,function i(r,a,n,o){let s=o,l=a+(n-a>>1),h,u=n-a,c=r[a],d=r[a+1],p=r[n],f=r[n+1];for(let i=a+3;i<n;i+=3){let a=function(i,r,a,n,o,s){let l=o-a,h=s-n;if(0!==l||0!==h){let u=((i-a)*l+(r-n)*h)/(l*l+h*h);u>1?(a=o,n=s):u>0&&(a+=l*u,n+=h*u)}return(l=i-a)*l+(h=r-n)*h}(r[i],r[i+1],c,d,p,f);if(a>s)h=i,s=a;else if(a===s){let r=Math.abs(i-l);r<u&&(h=i,u=r)}}s>o&&(h-a>3&&i(r,a,h,o),r[h+2]=s,n-h>3&&i(r,h,n,o))}(r,0,h,a),r[h+2]=1,r.size=Math.abs(l),r.start=0,r.end=r.size}function Z(i,r,a,n){for(let o=0;o<i.length;o++){let s=[];q(i[o],s,a,n),r.push(s)}}function W(i){let r=Math.sin(i*Math.PI/180),a=.5-.25*Math.log((1+r)/(1-r))/Math.PI;return a<0?0:a>1?1:a}function X(i,r,a,n,o,s,l,h){if(n/=r,s>=(a/=r)&&l<n)return i;if(l<a||s>=n)return null;let u=[];for(let r of i){let i=r.geometry,s=r.type,l=0===o?r.minX:r.minY,_=0===o?r.maxX:r.maxY;if(l>=a&&_<n){u.push(r);continue}if(_<a||l>=n)continue;let g=[];if("Point"===s||"MultiPoint"===s){var c=i,d=g,p=a,f=n,m=o;for(let i=0;i<c.length;i+=3){let r=c[i+m];r>=p&&r<=f&&Q(d,c[i],c[i+1],c[i+2])}}else if("LineString"===s)Y(i,g,a,n,o,!1,h.lineMetrics);else if("MultiLineString"===s)K(i,g,a,n,o,!1);else if("Polygon"===s)K(i,g,a,n,o,!0);else if("MultiPolygon"===s)for(let r of i){let i=[];K(r,i,a,n,o,!0),i.length&&g.push(i)}if(g.length){if(h.lineMetrics&&"LineString"===s){for(let i of g)u.push(j(r.id,s,i,r.tags));continue}"LineString"!==s&&"MultiLineString"!==s||(1===g.length?(s="LineString",g=g[0]):s="MultiLineString"),"Point"!==s&&"MultiPoint"!==s||(s=3===g.length?"Point":"MultiPoint"),u.push(j(r.id,s,g,r.tags))}}return u.length?u:null}function Y(i,r,a,n,o,s,l){let h=J(i),u=0===o?ee:et,c,d,p=i.start;for(let f=0;f<i.length-3;f+=3){let m=i[f],_=i[f+1],g=i[f+2],y=i[f+3],x=i[f+4],v=0===o?m:_,b=0===o?y:x,w=!1;l&&(c=Math.sqrt(Math.pow(m-y,2)+Math.pow(_-x,2))),v<a?b>a&&(d=u(h,m,_,y,x,a),l&&(h.start=p+c*d)):v>n?b<n&&(d=u(h,m,_,y,x,n),l&&(h.start=p+c*d)):Q(h,m,_,g),b<a&&v>=a&&(d=u(h,m,_,y,x,a),w=!0),b>n&&v<=n&&(d=u(h,m,_,y,x,n),w=!0),!s&&w&&(l&&(h.end=p+c*d),r.push(h),h=J(i)),l&&(p+=c)}let f=i.length-3,m=i[f],_=i[f+1],g=0===o?m:_;g>=a&&g<=n&&Q(h,m,_,i[f+2]),f=h.length-3,s&&f>=3&&(h[f]!==h[0]||h[f+1]!==h[1])&&Q(h,h[0],h[1],h[2]),h.length&&r.push(h)}function J(i){let r=[];return r.size=i.size,r.start=i.start,r.end=i.end,r}function K(i,r,a,n,o,s){for(let l of i)Y(l,r,a,n,o,s,!1)}function Q(i,r,a,n){i.push(r,a,n)}function ee(i,r,a,n,o,s){let l=(s-r)/(n-r);return Q(i,s,a+(o-a)*l,1),l}function et(i,r,a,n,o,s){let l=(s-a)/(o-a);return Q(i,r+(n-r)*l,s,1),l}function ei(i,r){let a=[];for(let n=0;n<i.length;n++){let o,s=i[n],l=s.type;if("Point"===l||"MultiPoint"===l||"LineString"===l)o=er(s.geometry,r);else if("MultiLineString"===l||"Polygon"===l)for(let i of(o=[],s.geometry))o.push(er(i,r));else if("MultiPolygon"===l)for(let i of(o=[],s.geometry)){let a=[];for(let n of i)a.push(er(n,r));o.push(a)}
7a.push(j(s.id,l,o,s.tags))}return a}function er(i,r){let a=[];a.size=i.size,void 0!==i.start&&(a.start=i.start,a.end=i.end);for(let n=0;n<i.length;n+=3)a.push(i[n]+r,i[n+1],i[n+2]);return a}function ea(i,r){if(i.transformed)return i;let a=1<<i.z,n=i.x,o=i.y;for(let s of i.features){let i=s.geometry,l=s.type;if(s.geometry=[],1===l)for(let l=0;l<i.length;l+=2)s.geometry.push(en(i[l],i[l+1],r,a,n,o));else for(let l=0;l<i.length;l++){let h=[];for(let s=0;s<i[l].length;s+=2)h.push(en(i[l][s],i[l][s+1],r,a,n,o));s.geometry.push(h)}}return i.transformed=!0,i}function en(i,r,a,n,o,s){return[Math.round(a*(i*n-o)),Math.round(a*(r*n-s))]}function eo(i,r,a,n,o,s){let l=n*n;if(n>0&&r.size<(o?l:n))return void(a.numPoints+=r.length/3);let h=[];for(let i=0;i<r.length;i+=3)(0===n||r[i+2]>l)&&(a.numSimplified++,h.push(r[i],r[i+1])),a.numPoints++;o&&function(i,r){let a=0;for(let r=0,n=i.length,o=n-2;r<n;o=r,r+=2)a+=(i[r]-i[o])*(i[r+1]+i[o+1]);if(a>0===r)for(let r=0,a=i.length;r<a/2;r+=2){let n=i[r],o=i[r+1];i[r]=i[a-2-r],i[r+1]=i[a-1-r],i[a-2-r]=n,i[a-1-r]=o}}(h,s),i.push(h)}let es={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class el{constructor(i,r){let a=(r=this.options=function(i,r){for(let a in r)i[a]=r[a];return i}(Object.create(es),r)).debug;if(a&&console.time("preprocess data"),r.maxZoom<0||r.maxZoom>24)throw Error("maxZoom should be in the 0-24 range");if(r.promoteId&&r.generateId)throw Error("promoteId and generateId cannot be used together.");let n=function(i,r){let a=[];if("FeatureCollection"===i.type)for(let n=0;n<i.features.length;n++)H(a,i.features[n],r,n);else H(a,"Feature"===i.type?i:{geometry:i},r);return a}(i,r);this.tiles={},this.tileCoords=[],a&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",r.indexMaxZoom,r.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),(n=function(i,r){let a=r.buffer/r.extent,n=i,o=X(i,1,-1-a,a,0,-1,2,r),s=X(i,1,1-a,2+a,0,-1,2,r);return(o||s)&&(n=X(i,1,-a,1+a,0,-1,2,r)||[],o&&(n=ei(o,1).concat(n)),s&&(n=n.concat(ei(s,-1)))),n}(n,r)).length&&this.splitTile(n,0,0,0),a&&(n.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(i,r,a,n,o,s,l){let h=[i,r,a,n],u=this.options,c=u.debug;for(;h.length;){n=h.pop(),a=h.pop(),r=h.pop(),i=h.pop();let d=1<<r,p=eh(r,a,n),f=this.tiles[p];if(!f&&(c>1&&console.time("creation"),f=this.tiles[p]=function(i,r,a,n,o){let s=r===o.maxZoom?0:o.tolerance/((1<<r)*o.extent),l={features:[],numPoints:0,numSimplified:0,numFeatures:i.length,source:null,x:a,y:n,z:r,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(let r of i)!function(i,r,a,n){let o=r.geometry,s=r.type,l=[];if(i.minX=Math.min(i.minX,r.minX),i.minY=Math.min(i.minY,r.minY),i.maxX=Math.max(i.maxX,r.maxX),i.maxY=Math.max(i.maxY,r.maxY),"Point"===s||"MultiPoint"===s)for(let r=0;r<o.length;r+=3)l.push(o[r],o[r+1]),i.numPoints++,i.numSimplified++;else if("LineString"===s)eo(l,o,i,a,!1,!1);else if("MultiLineString"===s||"Polygon"===s)for(let r=0;r<o.length;r++)eo(l,o[r],i,a,"Polygon"===s,0===r);else if("MultiPolygon"===s)for(let r=0;r<o.length;r++){let n=o[r];for(let r=0;r<n.length;r++)eo(l,n[r],i,a,!0,0===r)}if(l.length){let a=r.tags||null;if("LineString"===s&&n.lineMetrics){for(let i in a={},r.tags)a[i]=r.tags[i];a.mapbox_clip_start=o.start/o.size,a.mapbox_clip_end=o.end/o.size}let h={geometry:l,type:"Polygon"===s||"MultiPolygon"===s?3:"LineString"===s||"MultiLineString"===s?2:1,tags:a};null!==r.id&&(h.id=r.id),i.features.push(h)}}(l,r,s,o);return l}(i,r,a,n,u),this.tileCoords.push({z:r,x:a,y:n}),c)){c>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",r,a,n,f.numFeatures,f.numPoints,f.numSimplified),console.timeEnd("creation"));let i=`z${r}`;this.stats[i]=(this.stats[i]||0)+1,this.total++}if(f.source=i,null==o){if(r===u.indexMaxZoom||f.numPoints<=u.indexMaxPoints)continue}else{if(r===u.maxZoom||r===o)continue;if(null!=o){let i=o-r;if(a!==s>>i||n!==l>>i)continue}}if(f.source=null,0===i.length)continue;c>1&&console.time("clipping");let m=.5*u.buffer/u.extent,_=.5-m,g=.5+m,y=1+m,x=null,v=null,b=null,w=null,T=X(i,d,a-m,a+g,0,f.minX,f.maxX,u),S=X(i,d,a+_,a+y,0,f.minX,f.maxX,u);i=null,T&&(x=X(T,d,n-m,n+g,1,f.minY,f.maxY,u),v=X(T,d,n+_,n+y,1,f.minY,f.maxY,u),T=null),S&&(b=X(S,d,n-m,n+g,1,f.minY,f.maxY,u),w=X(S,d,n+_,n+y,1,f.minY,f.maxY,u),S=null),c>1&&console.timeEnd("clipping"),h.push(x||[],r+1,2*a,2*n),h.push(v||[],r+1,2*a,2*n+1),h.push(b||[],r+1,2*a+1,2*n),h.push(w||[],r+1,2*a+1,2*n+1)}}getTile(i,r,a){i*=1,r*=1,a*=1;let{extent:n,debug:o}=this.options;if(i<0||i>24)return null;let s=1<<i,l=eh(i,r=r+s&s-1,a);if(this.tiles[l])return ea(this.tiles[l],n);o>1&&console.log("drilling down to z%d-%d-%d",i,r,a);let h,u=i,c=r,d=a;for(;!h&&u>0;)u--,c>>=1,d>>=1,h=this.tiles[eh(u,c,d)];return h&&h.source?(o>1&&(console.log("found parent tile z%d-%d-%d",u,c,d),console.time("drilling down")),this.splitTile(h.source,u,c,d,i,r,a),o>1&&console.timeEnd("drilling down"),this.tiles[l]?ea(this.tiles[l],n):null):null}}function eh(i,r,a){return 32*((1<<i)*a+r)+i}function eu(i,a){let n=i.tileID.canonical;if(!this._geoJSONIndex)return void a(null,null);let o=this._geoJSONIndex.getTile(n.z,n.x,n.y);if(!o)return void a(null,null);let s=i=>i.tags&&"3d_elevation_id"in i.tags&&"source"in i.tags&&"elevation"===i.tags.source,l=o.features.filter(i=>s(i)),h={_geojsonTileLayer:o.features};l.length>0&&(h={_geojsonTileLayer:o.features.filter(i=>!s(i)),hd_road_elevation:l}),a(null,{vectorTile:new b(h),rawData:function(i){let a=new r.b2;for(let r of Object.keys(i))a.writeMessage(3,M,{name:r,features:i[r]});return a.finish()}(h).buffer})}class ec extends f{constructor(i){super(i),this.loadVectorData=eu,this._dynamicIndex=new T}loadData(i,a){let o=i&&i.request,s=o&&o.collectResourceTiming;this._geoJSONIndex=null,this.loadGeoJSON(i,(l,h)=>
7{if(l||!h)return a(l);if("object"!=typeof h)return a(Error(`Input data given to '${i.source}' is not a valid GeoJSON object.`));{try{var u,c;if(i.filter){let a=r.U(i.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if("error"===a.result)throw Error(a.value.map(i=>`${i.key}: ${i.message}`).join(", "));h.features=h.features.filter(i=>a.value.evaluate({zoom:0},i))}i.dynamic?("Feature"===h.type&&(h={type:"FeatureCollection",features:[h]}),i.append||(this._dynamicIndex.clear(),this.loaded={}),this._dynamicIndex.load(h.features,this.loaded),i.cluster&&(h.features=this._dynamicIndex.getFeatures())):this.loaded={},this._geoJSONIndex=i.cluster?new B(function({superclusterOptions:i,clusterProperties:a}){if(!a||!i)return i;let n={},o={},s={accumulated:null,zoom:0},l={properties:null},h=Object.keys(a);for(let i of h){let[s,l]=a[i],h=r.U(l),u=r.U("string"==typeof s?[s,["accumulated"],["get",i]]:s);n[i]=h.value,o[i]=u.value}return i.map=i=>{l.properties=i;let r={};for(let i of h)r[i]=n[i].evaluate(s,l);return r},i.reduce=(i,r)=>{for(let a of(l.properties=r,h))s.accumulated=i[a],i[a]=o[a].evaluate(s,l)},i}(i)).load(h.features):i.dynamic?this._dynamicIndex:(u=h,c=i.geojsonVtOptions,new el(u,c))}catch(i){return a(i)}let l={};if(s){let r=n(o);r&&(l.resourceTiming={},l.resourceTiming[i.source]=JSON.parse(JSON.stringify(r)))}a(null,l)}})}reloadTile(i,r){let a=this.loaded;return a&&a[i.uid]?i.partial?r(null,void 0):super.reloadTile(i,r):this.loadTile(i,r)}loadGeoJSON(i,a){if(i.request)r.m(i.request,a);else{if("string"!=typeof i.data)return a(Error(`Input data given to '${i.source}' is not a valid GeoJSON object.`));setTimeout(()=>{try{return a(null,JSON.parse(i.data))}catch(r){return a(Error(`Input data given to '${i.source}' is not a valid GeoJSON object.`))}},0)}}getClusterExpansionZoom(i,r){try{r(null,this._geoJSONIndex.getClusterExpansionZoom(i.clusterId))}catch(i){r(i)}}getClusterChildren(i,r){try{r(null,this._geoJSONIndex.getChildren(i.clusterId))}catch(i){r(i)}}getClusterLeaves(i,r){try{r(null,this._geoJSONIndex.getLeaves(i.clusterId,i.limit,i.offset))}catch(i){r(i)}}}class ed{constructor(i,a,n){this.tileID=new r.aU(i.tileID.overscaledZ,i.tileID.wrap,i.tileID.canonical.z,i.tileID.canonical.x,i.tileID.canonical.y),this.tileZoom=i.tileZoom,this.uid=i.uid,this.zoom=i.zoom,this.canonical=i.tileID.canonical,this.pixelRatio=i.pixelRatio,this.tileSize=i.tileSize,this.source=i.source,this.overscaling=this.tileID.overscaleFactor(),this.projection=i.projection,this.brightness=a,this.worldview=n}parse(i,a,n,o){this.status="parsing";let s=new r.aU(n.tileID.overscaledZ,n.tileID.wrap,n.tileID.canonical.z,n.tileID.canonical.x,n.tileID.canonical.y),l=[],h=a.familiesBySource[n.source],u=new r.fj(s,n.promoteId);u.bucketLayerIDs=[],u.is3DTile=!0,r.fF(i).then(i=>{let a=i.json.extensionsUsed&&i.json.extensionsUsed.includes("MAPBOX_mesh_features")||i.json.asset.extras&&i.json.asset.extras.MAPBOX_mesh_features,c=i.json.extensionsUsed&&i.json.extensionsUsed.includes("EXT_meshopt_compression"),d=new r.ab(this.zoom,{brightness:this.brightness,worldview:this.worldview});for(let o in h)for(let p of h[o]){let o=p[0];u.bucketLayerIDs.push(p.map(i=>r.t(i.id,i.scope))),o.recalculate(d,[]);let h=r.fG(i,1/r.cW(n.tileID.canonical)),f=new r.fH(p,h,s,a,c,this.brightness,u,this.worldview);a||(f.needsUpload=!0),l.push(f),f.evaluate(o)}this.status="done",o(null,{buckets:l,featureIndex:u,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:null})}).catch(i=>o(Error(i.message)))}}class ep{constructor({actor:i,layerIndex:r,availableImages:a,availableModels:n,brightness:o,worldview:s}){this.actor=i,this.layerIndex=r,this.availableImages=a,this.availableModels=n,this.brightness=o,this.loading={},this.loaded={},this.worldview=s}loadTile(i,a){let n=i.uid,o=this.loading[n]=new ed(i,this.brightness,this.worldview);r.b4(i.request,(r,s)=>{let l=!this.loading[n];return delete this.loading[n],l||r?(o.status="done",l||(this.loaded[n]=o),a(r)):s&&0!==s.byteLength?void o.parse(s,this.layerIndex,i,(i,r)=>{o.status="done",this.loaded=this.loaded||{},this.loaded[n]=o,i||!r?a(i):a(null,r)}
7):(o.status="done",this.loaded[n]=o,a())})}reloadTile(i,r){let a=this.loaded,n=i.uid;if(a&&a[n]){let o=a[n];o.projection=i.projection,o.brightness=i.brightness;let s=(a,n)=>{o.reloadCallback&&(delete o.reloadCallback,this.loadTile(i,r)),r(a,n)};"parsing"===o.status?o.reloadCallback=s:"done"===o.status&&this.loadTile(i,r)}}abortTile(i,r){let a=i.uid;this.loading[a]&&delete this.loading[a],r()}removeTile(i,r){let a=this.loaded,n=i.uid;a&&a[n]&&delete a[n],r()}}class ef{constructor(i){this.self=i,this.actor=new r.ap(i,this),this.layerIndexes={},this.availableImages={},this.availableModels={},this.isSpriteLoaded={},this.rtlPluginParsingListeners=[],this.projections={},this.defaultProjection=r.c4({name:"mercator"}),this.workerSourceTypes={vector:f,geojson:ec,"raster-dem":m,"raster-array":g,"batched-model":ep},this.workerSources={},this.self.registerWorkerSource=(i,r)=>{if(this.workerSourceTypes[i])throw Error(`Worker source with name "${i}" already registered.`);this.workerSourceTypes[i]=r},this.self.registerRTLTextPlugin=i=>{if(r.fJ.isParsed())throw Error("RTL text plugin already registered.");for(let a of(r.fJ.setState({pluginStatus:r.fK.parsed,pluginURL:r.fJ.getPluginURL()}),r.fJ.applyArabicShaping=i.applyArabicShaping,r.fJ.processBidirectionalText=i.processBidirectionalText,r.fJ.processStyledBidirectionalText=i.processStyledBidirectionalText,this.rtlPluginParsingListeners))a(null,!0);this.rtlPluginParsingListeners=[]}}clearCaches(i,r,a){delete this.layerIndexes[i],delete this.availableImages[i],delete this.availableModels[i],delete this.workerSources[i],a()}checkIfReady(i,r,a){a()}setReferrer(i,r){this.referrer=r}spriteLoaded(i,a){this.isSpriteLoaded[i]||(this.isSpriteLoaded[i]={});let{scope:n,isLoaded:o}=a;if(this.isSpriteLoaded[i][n]=o,this.workerSources[i]&&this.workerSources[i][n])for(let a in this.workerSources[i][n]){let s=this.workerSources[i][n][a];for(let i in s){let a=s[i];a instanceof f&&(a.isSpriteLoaded=o,a.fire(new r.z("isSpriteLoaded")))}}}setImages(i,r,a){this.availableImages[i]||(this.availableImages[i]={});let{scope:n,images:o}=r;if(this.availableImages[i][n]=o,this.workerSources[i]&&this.workerSources[i][n]){for(let r in this.workerSources[i][n]){let a=this.workerSources[i][n][r];for(let i in a)a[i].availableImages=o}a()}else a()}setModels(i,{scope:r,models:a},n){if(this.availableModels[i]||(this.availableModels[i]={}),this.availableModels[i][r]=a,this.workerSources[i]&&this.workerSources[i][r]){for(let n in this.workerSources[i][r]){let o=this.workerSources[i][r][n];for(let i in o)o[i].availableModels=a}n()}else n()}setProjection(i,a){this.projections[i]=r.c4(a)}setBrightness(i,r,a){this.brightness=r,a()}setContextParams(i,r,a){this.maxUniformBufferBindings=r.maxBindingPoints,this.maxUniformBlockSizeDwords=r.maxUniformBlockSizeDwords,this.disableSymbolUBO=r.disableSymbolUBO,a()}setWorldview(i,r,a){this.worldview=r,a()}setLayers(i,r,a){this.getLayerIndex(i,r.scope).replace(r.layers,r.options),a()}updateLayers(i,r,a){this.getLayerIndex(i,r.scope).update(r.layers,r.removedIds,r.options),a()}loadTile(i,r,a){r.projection=this.projections[i]||this.defaultProjection,this.getWorkerSource(i,r).loadTile(r,a)}decodeRasterArray(i,r,a){this.getWorkerSource(i,r).decodeRasterArray(r,a)}reloadTile(i,r,a){r.projection=this.projections[i]||this.defaultProjection,this.getWorkerSource(i,r).reloadTile(r,a)}abortTile(i,r,a){this.getWorkerSource(i,r).abortTile(r,a)}removeTile(i,r,a){this.getWorkerSource(i,r).removeTile(r,a)}removeSource(i,r,a){if(!(this.workerSources[i]&&this.workerSources[i][r.scope]&&this.workerSources[i][r.scope][r.type]&&this.workerSources[i][r.scope][r.type][r.source]))return;let n=this.workerSources[i][r.scope][r.type][r.source];delete this.workerSources[i][r.scope][r.type][r.source],void 0!==n.removeSource?n.removeSource(r,a):a()}loadTileProvider(i,a,n){r.aT(a.name,a.url).then(r=>{let n=new r(a.options);return this.getWorkerSource(i,{type:a.type,source:a.source,scope:a.scope},n),n.load&&a.request?n.load({request:a.request}):null}).then(i=>n(null,i)).catch(i=>n(i instanceof Error?i:Error(String(i))))}
7async syncRTLPluginState(i,a,n){if(r.fJ.isParsed())return void n(null,!0);if(r.fJ.isParsing())return void this.rtlPluginParsingListeners.push(n);r.fJ.setState(a);let o=r.fJ.getPluginURL();if(!r.fJ.isLoaded()||r.fJ.isParsed()||r.fJ.isParsing())n(null,!1);else{r.fJ.setState({pluginStatus:r.fK.parsing,pluginURL:o});try{await import(o),r.fJ.isParsed()?n(null,!0):this.rtlPluginParsingListeners.push(n)}catch(i){for(let a of(r.fJ.setState({pluginStatus:r.fK.error,pluginURL:o}),n(i),this.rtlPluginParsingListeners))a(i);this.rtlPluginParsingListeners=[]}}}setConfig(i,a){Object.assign(r.g,a)}getAvailableImages(i,r){this.availableImages[i]||(this.availableImages[i]={});let a=this.availableImages[i][r];return a||(a=[]),a}getAvailableModels(i,r){this.availableModels[i]||(this.availableModels[i]={});let a=this.availableModels[i][r];return a||(a={}),a}getLayerIndex(i,r){this.layerIndexes[i]||(this.layerIndexes[i]={});let a=this.layerIndexes[i][r];return a||((a=this.layerIndexes[i][r]=new s).scope=r),a}getWorkerSource(i,r,a){let{type:n,source:o,scope:s}=r,l=this.workerSources;if(l[i]||(l[i]={}),l[i][s]||(l[i][s]={}),l[i][s][n]||(l[i][s][n]={}),this.isSpriteLoaded[i]||(this.isSpriteLoaded[i]={}),l[i][s][n][o])a&&(l[i][s][n][o].tileProvider=a);else{let r={send:(r,a,n,o,s,l)=>this.actor.send(r,a,n,i,s,l),scheduler:this.actor.scheduler},h=this.workerSourceTypes[n];if(!h)throw Error(`Unknown worker source type "${n}".`);l[i][s][n][o]=new h({actor:r,layerIndex:this.getLayerIndex(i,s),availableImages:this.getAvailableImages(i,s),availableModels:this.getAvailableModels(i,s),isSpriteLoaded:this.isSpriteLoaded[i][s],tileProvider:a,brightness:this.brightness,worldview:this.worldview,maxUniformBufferBindings:this.maxUniformBufferBindings,maxUniformBlockSizeDwords:this.maxUniformBlockSizeDwords,disableSymbolUBO:this.disableSymbolUBO})}return l[i][s][n][o]}enforceCacheSizeLimit(i,a){r.fL(a)}getWorkerPerformanceMetrics(i,r,a){a(void 0,void 0)}}return r.fI(self)&&(self.worker=new ef(self)),ef}),n(["./shared"],function(i){let r,a,n,o,s,l;var h="3.24.0";let u={create:"create",load:"load",fullLoad:"fullLoad"},c={mark(i){performance.mark(i)},measure(i,r,a){performance.measure(i,r,a)}};function d(r){let a=r.name.split("?")[0];return i.a(a)&&a.includes("mapbox-gl.js")?"javascript":i.a(a)&&a.includes("mapbox-gl.css")?"css":i.b(a)?"fontRange":i.c(a)?"sprite":i.i(a)?"style":i.d(a)?"tilejson":"other"}var p,f={},m=function(){if(p)return f;function i(i){return!r(i)}function r(r){var n;return"undefined"==typeof window||"undefined"==typeof document?"not a browser":!function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var i,r,a=new Blob([""],{type:"text/javascript"}),n=URL.createObjectURL(a);try{r=new Worker(n),i=!0}catch(r){i=!1}return r&&r.terminate(),URL.revokeObjectURL(n),i}()?"insufficient worker support":!function(){var i=document.createElement("canvas");i.width=i.height=1;var r=i.getContext("2d");if(!r)return!1;var a=r.getImageData(0,0,1,1);return a&&a.width===i.width}()?"insufficient Canvas/getImageData support":(void 0===a[n=r&&r.failIfMajorPerformanceCaveat]&&(a[n]=function(r){var a,n,o,s=(a=document.createElement("canvas"),(n=Object.create(i.webGLContextAttributes)).failIfMajorPerformanceCaveat=r,a.getContext("webgl2",n));if(!s)return!1;try{o=s.createShader(s.VERTEX_SHADER)}catch(i){return!1}return!(!o||s.isContextLost())&&(s.shaderSource(o,"void main() {}"),s.compileShader(o),!0===s.getShaderParameter(o,s.COMPILE_STATUS))}(n)),a[n]?document.documentMode?"insufficient ECMAScript 6 support":void 0:"insufficient WebGL2 support")}p=1,f.supported=i,f.notSupportedReason=r;var a={};return i.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0},f}();let _=/firefox/i,g=/macintosh/i;function y(i,r,a){let n=document.createElement(i);return null!=r&&(n.className=r),a&&a.appendChild(n),n}function x(i,r,a){let n=document.createElementNS("http://www.w3.org/2000/svg",i);for(let i of Object.keys(r))n.setAttributeNS(null,i,String(r[i]));return a&&a.appendChild(n),n}let v="undefined"!=typeof document?document.documentElement&&document.documentElement.style:null,b=v&&void 0!==v.userSelect?"userSelect":"WebkitUserSelect";function w(){v&&b&&(r=v[b],v[b]="none")}function T(){v&&b&&(v[b]=r)}function S(i){i.preventDefault(),i.stopPropagation(),window.removeEventListener("click",S,!0)}function E(){window.addEventListener("click",S,!0),window.setTimeout(()=>{window.removeEventListener("click",S,!0)},0)}function I(i,r){let a=i.getBoundingClientRect();return C(i,a,r)}function A(i,r){let a=i.getBoundingClientRect(),n=[];for(let o=0;o<r.length;o++)n.push(C(i,a,r[o]));return n}function M(i){return _.test(navigator.userAgent)&&g.test(navigator.userAgent)&&2===i.button&&i.ctrlKey?0:i.button}function C(r,a,n){let o=r.offsetWidth===a.width?1:r.offsetWidth/a.width;
7return new i.P((n.clientX-a.left)*o,(n.clientY-a.top)*o)}let P=/(\.(png|jpg)\d*)(?=$)/,D=/^.+\/v4\//,R=/\.[\w]+$/,z=/^(\/v4\/|\/(raster|rasterarrays)\/v1\/)/,L=/^access_token=(.*)$/,F="NO_ACCESS_TOKEN";class O{constructor(i,r,a){this._transformRequestFn=i,this._customAccessToken=r,this._silenceAuthErrors=!!a,this._createSkuToken()}_createSkuToken(){let i=function(){let i="";for(let r=0;r<10;r++)i+="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[Math.floor(62*Math.random())];return{token:"101"+i,tokenExpiresAt:Date.now()+432e5}}();this._skuToken=i.token,this._skuTokenExpiresAt=i.tokenExpiresAt}_isSkuTokenExpired(){return Date.now()>this._skuTokenExpiresAt}transformRequest(i,r){return this._transformRequestFn&&this._transformRequestFn(i,r)||{url:i}}normalizeStyleURL(r,a){if(!i.e(r))return r;let n=k(r);return n.params.push(`sdk=js-${h}`),n.path=`/styles/v1${n.path}`,this._makeAPIURL(n,this._customAccessToken||a)}normalizeGlyphsURL(r,a){if(!i.e(r))return r;let n=k(r);return n.path=`/fonts/v1${n.path}`,this._makeAPIURL(n,this._customAccessToken||a)}
7normalizeModelURL(r,a){if(!i.e(r))return r;let n=k(r);return n.path=`/models/v1${n.path}`,this._makeAPIURL(n,this._customAccessToken||a)}normalizeSourceURL(r,a,n,o){if(!i.e(r))return r;let s=k(r);return s.path=`/v4/${s.authority}.json`,s.params.push("secure"),n&&s.params.push(`language=${n}`),o&&s.params.push(`worldview=${o}`),this._makeAPIURL(s,this._customAccessToken||a)}normalizeIconsetURL(r,a){let n=k(r);return i.e(r)?(n.path=`/styles/v1${n.path}/iconset.pbf`,this._makeAPIURL(n,this._customAccessToken||a)):N(n)}normalizeSpriteURL(r,a,n,o){let s=k(r);return i.e(r)?(s.path=`/styles/v1${s.path}/sprite${a}${n}`,this._makeAPIURL(s,this._customAccessToken||o)):(s.path+=`${a}${n}`,N(s))}normalizeTileURL(r,a,n){if(this._isSkuTokenExpired()&&this._createSkuToken(),r&&!i.e(r))return r;let o=k(r);o.path=o.path.replace(P,`${a||n&&"raster"!==o.authority&&512===n?"@2x":""}${i.k.supported?".webp":"$1"}`),"raster"===o.authority?o.path=`/${i.g.RASTER_URL_PREFIX}${o.path}`:"rasterarrays"===o.authority?o.path=`/${i.g.RASTERARRAYS_URL_PREFIX}${o.path}`:"3dtiles"===o.authority?o.path=`/${i.g.TILES3D_URL_PREFIX}${o.path}`:(o.path=o.path.replace(D,"/"),o.path=`/${i.g.TILE_URL_VERSION}${o.path}`);let s=this._customAccessToken||function(i){for(let r of i){let i=r.match(L);if(i)return i[1]}return null}(o.params)||i.g.ACCESS_TOKEN;return i.g.REQUIRE_ACCESS_TOKEN&&s&&this._skuToken&&o.params.push(`sku=${this._skuToken}`),this._makeAPIURL(o,s)}canonicalizeTileURL(r,a){let n=k(r);if(!z.test(n.path)||!R.test(n.path))return r;let o="mapbox://";n.path.startsWith("/raster/v1/")?o+=`raster/${n.path.replace(`/${i.g.RASTER_URL_PREFIX}/`,"")}`:n.path.startsWith("/rasterarrays/v1/")?o+=`rasterarrays/${n.path.replace(`/${i.g.RASTERARRAYS_URL_PREFIX}/`,"")}`:o+=`tiles/${n.path.replace(`/${i.g.TILE_URL_VERSION}/`,"")}`;let s=n.params;return a&&(s=s.filter(i=>!i.match(L))),s.length&&(o+=`?${s.join("&")}`),o}canonicalizeTileset(r,a){let n=!!a&&i.e(a),o=[];for(let a of r.tiles||[])i.f(a)?o.push(this.canonicalizeTileURL(a,n)):o.push(a);return o}_makeAPIURL(r,a){let n="See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes",o=k(i.g.API_URL);if(r.protocol=o.protocol,r.authority=o.authority,"http"===r.protocol){let i=r.params.indexOf("secure");i>=0&&r.params.splice(i,1)}if("/"!==o.path&&(r.path=`${o.path}${r.path}`),!i.g.REQUIRE_ACCESS_TOKEN)return N(r);if(a=a||i.g.ACCESS_TOKEN,!this._silenceAuthErrors){if(!a)throw Error(`An API access token is required to use Mapbox GL. ${n}`);if("s"===a[0])throw Error(`Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). ${n}`)}return r.params=r.params.filter(i=>!i.includes("access_token")),r.params.push(`access_token=${a||""}`),N(r)}}let B=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function k(i){let r=i.match(B);if(!r)throw Error("Unable to parse URL object");return{protocol:r[1],authority:r[2],path:r[3]||"/",params:r[4]?r[4].split("&"):[]}}function N(i){let r=i.params.length?`?${i.params.join("&")}`:"";return`${i.protocol}://${i.authority}${i.path}${r}`}let U="mapbox.eventData";function V(r){if(!r)return null;let a=r.split(".");if(!a||3!==a.length)return null;try{return JSON.parse(i.l(a[1]))}catch(i){return null}}function j(r){return!(!i.g.EVENTS_URL||!r&&!i.g.ACCESS_TOKEN)}class G{constructor(i){this.type=i,this.anonId=null,this.anonIdTimestamp=null,this.eventData={},this.queue=[],this.pendingRequest=null}getStorageKey(r){let a=V(i.g.ACCESS_TOKEN),n="";return n=a&&a.u?i.j(a.u):i.g.ACCESS_TOKEN||"",r?`${U}.${r}:${n}`:`${U}:${n}`}fetchEventData(){let r=i.s("localStorage"),a=this.getStorageKey(),n=this.getStorageKey("uuid"),o=this.getStorageKey("uuidTimestamp");if(r)try{let i=localStorage.getItem(a);i&&(this.eventData=JSON.parse(i));let r=localStorage.getItem(n);r&&(this.anonId=r);let s=localStorage.getItem(o);s&&(this.anonIdTimestamp=Number(s));let l=Date.now()-864e5;(!this.anonIdTimestamp||this.anonIdTimestamp<l)&&this.refreshUUID()}catch(r){i.w("Unable to read from LocalStorage")}}refreshUUID(){this.anonId=i.u(),this.anonIdTimestamp=Date.now()}saveEventData(){let r=i.s("localStorage"),a=this.getStorageKey(),n=this.getStorageKey("uuid"),o=this.getStorageKey("uuidTimestamp"),s=this.anonId,l=this.anonIdTimestamp;if(r&&s)try{localStorage.setItem(n,s),Object.keys(this.eventData).length>=1&&localStorage.setItem(a,JSON.stringify(this.eventData)),l&&localStorage.setItem(o,l.toString())}catch(r){i.w("Unable to write to LocalStorage")}}processRequests(i){}postEvent(r,a,n,o){if(!i.g.EVENTS_URL)return;let s=k(i.g.EVENTS_URL);s.params.push(`access_token=${o||i.g.ACCESS_TOKEN||""}`);let l={event:this.type,created:new Date(r).toISOString()},h=a?Object.assign(l,a):l,u={url:N(s),headers:{"Content-Type":"text/plain"},body:JSON.stringify([h])};this.pendingRequest=i.p(u,i=>{this.pendingRequest=null,n(i),this.saveEventData(),this.processRequests(o)})}queueRequest(i,r){this.queue.push(i),this.processRequests(r)}}class H extends G{constructor(i){super("metrics"),i&&(this.data=i)}postMetricsEvent(r){if(!j(r))return;this.anonId||this.fetchEventData(),i.v(this.anonId)||this.refreshUUID();let a=Object.assign({},this.data,{sessionId:this.anonId});this.queueRequest({timestamp:Date.now(),payload:a},r)}processRequests(i){if(this.pendingRequest||0===this.queue.length)return;let{timestamp:r,payload:a}=this.queue.shift();this.postEvent(r,a,()=>{},i)}}let $=new class extends G{constructor(i){super("appUserTurnstile"),this._customAccessToken=i}postTurnstileEvent(r,a){j(a)&&Array.isArray(r)&&r.some(r=>i.e(r)||i.f(r))&&this.queueRequest(Date.now(),a)}processRequests(r){if(this.pendingRequest||0===this.queue.length)return;this.anonId&&this.anonIdTimestamp&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();let a=V(i.g.ACCESS_TOKEN),n=a?a.u:i.g.ACCESS_TOKEN,o=n!==this.eventData.tokenU;i.v(this.anonId)||(this.refreshUUID(),o=!0);let s=this.queue.shift();if(this.eventData.lastSuccess){let i=new Date(this.eventData.lastSuccess),r=new Date(s),a=(s-this.eventData.lastSuccess)/864e5;o=o||a>=1||a<-1||i.getDate()!==r.getDate()}else o=!0;o?this.postEvent(s,{sdkIdentifier:"mapbox-gl-js",sdkVersion:h,skuId:"01","enabled.telemetry":!1,userId:this.anonId},i=>{i||(this.eventData.lastSuccess=s,this.eventData.tokenU=n)},r):this.processRequests()}},q=$.postTurnstileEvent.bind($),Z=new class extends G{constructor(){super("map.load"),this.success={},this.skuToken=""}postMapLoadEvent(r,a,n,o){this.skuToken=a,this.errorCb=o,i.g.EVENTS_URL&&(n||i.g.ACCESS_TOKEN?this.queueRequest({id:r,timestamp:Date.now()},n):this.errorCb(Error(F)))}processRequests(r){if(this.pendingRequest||0===this.queue.length)return;let{id:a,timestamp:n}=this.queue.shift();a&&this.success[a]||(this.anonId&&this.anonIdTimestamp||this.fetchEventData(),i.v(this.anonId)||this.refreshUUID(),this.postEvent(n,{sdkIdentifier:"mapbox-gl-js",sdkVersion:h,skuId:"01",skuToken:this.skuToken,userId:this.anonId},i=>{i?this.errorCb(i):a&&(this.success[a]=!0)},r))}remove(){this.errorCb=null}},W=Z.postMapLoadEvent.bind(Z),X=new class extends G{constructor(){super("style.load"),this.eventIdPerMapInstanceMap=new Map,this.mapInstanceIdMap=new WeakMap}getMapInstanceId(r){let a=this.mapInstanceIdMap.get(r);return a||(a=i.u(),this.mapInstanceIdMap.set(r,a)),a}getEventId(i){let r=this.eventIdPerMapInstanceMap.get(i)||0;return this.eventIdPerMapInstanceMap.set(i,r+1),r}postStyleLoadEvent(i,r){let{map:a,style:n,importedStyles:o}=r;if(!j(i))return;let s=this.getMapInstanceId(a),l={mapInstanceId:s,eventId:this.getEventId(s),style:n};o.length&&(l.importedStyles=o),this.queueRequest({timestamp:Date.now(),payload:l},i)}processRequests(i){if(this.pendingRequest||0===this.queue.length)return;let{timestamp:r,payload:a}=this.queue.shift();this.postEvent(r,a,()=>{},i)}},Y=X.postStyleLoadEvent.bind(X),J=new H({attributes:[{name:"maps/js/layer
7-animations/style-with-appearances"}]}),K=J.postMetricsEvent.bind(J),Q=new H({attributes:[{name:"maps/js/layer-animations/runtime-appearances"}]}),ee=Q.postMetricsEvent.bind(Q),et=new class extends G{constructor(){super("gljs.performance")}postPerformanceEvent(i,r){j(i)&&this.queueRequest({timestamp:Date.now(),performanceData:r},i)}processRequests(r){if(this.pendingRequest||0===this.queue.length)return;let{timestamp:a,performanceData:n}=this.queue.shift(),o=function(r){let a=performance.getEntriesByType("resource"),n=performance.getEntriesByType("mark"),o=function(i){let r={};if(i){for(let a in i)if("other"!==a)for(let n of i[a]){let i=`${a}ResolveRangeMin`,o=`${a}ResolveRangeMax`,s=`${a}RequestCount`,l=`${a}RequestCachedCount`;r[i]=Math.min(r[i]||1/0,n.startTime),r[o]=Math.max(r[o]||-1/0,n.responseEnd);let h=i=>{void 0===r[i]&&(r[i]=0),++r[i]};void 0!==n.transferSize&&0===n.transferSize&&h(l),h(s)}}return r}(function(i,r){let a={};if(i)for(let n of i){let i=r(n);void 0===a[i]&&(a[i]=[]),a[i].push(n)}return a}(a,d)),s=window.devicePixelRatio,l=navigator.connection||navigator.mozConnection||navigator.webkitConnection,c=l?l.effectiveType:void 0,p={counters:[],metadata:[],attributes:[]},f=(i,r,a)=>{null!=a&&i.push({name:r,value:a.toString()})};for(let i in o)f(p.counters,i,o[i]);if(r.interactionRange[0]!==1/0&&r.interactionRange[1]!==-1/0&&(f(p.counters,"interactionRangeMin",r.interactionRange[0]),f(p.counters,"interactionRangeMax",r.interactionRange[1])),n)for(let i of Object.values(u)){let r=n.find(r=>r.name===i);r&&f(p.counters,i,r.startTime)}return f(p.counters,"visibilityHidden",r.visibilityHidden),f(p.attributes,"style",function(r){if(r)for(let a of r){let r=a.name.split("?")[0];if(i.i(r)){let i=r.split("/").slice(-2);if(2===i.length)return`mapbox://styles/${i[0]}/${i[1]}`}}}(a)),f(p.attributes,"terrainEnabled",r.terrainEnabled?"true":"false"),f(p.attributes,"fogEnabled",r.fogEnabled?"true":"false"),f(p.attributes,"projection",r.projection),f(p.attributes,"zoom",r.zoom),f(p.metadata,"devicePixelRatio",s),f(p.metadata,"connectionEffectiveType",c),f(p.metadata,"navigatorUserAgent",navigator.userAgent),f(p.metadata,"screenWidth",window.screen.width),f(p.metadata,"screenHeight",window.screen.height),f(p.metadata,"windowWidth",window.innerWidth),f(p.metadata,"windowHeight",window.innerHeight),f(p.metadata,"mapWidth",r.width/s),f(p.metadata,"mapHeight",r.height/s),f(p.metadata,"webglRenderer",r.renderer),f(p.metadata,"webglVendor",r.vendor),f(p.metadata,"sdkVersion",h),f(p.metadata,"sdkIdentifier","mapbox-gl-js"),p}(n);for(let i of o.metadata);for(let i of o.counters);for(let i of o.attributes);this.postEvent(a,o,()=>{},r)}},ei=et.postPerformanceEvent.bind(et),er=new class extends G{constructor(){super("map.auth"),this.success={},this.skuToken=""}getSession(r,a,n,o){if(!i.g.API_URL||!i.g.SESSION_PATH)return;let s=k(i.g.API_URL+i.g.SESSION_PATH);s.params.push(`sku=${a||""}`),s.params.push(`access_token=${o||i.g.ACCESS_TOKEN||""}`);let l={url:N(s),headers:{"Content-Type":"text/plain"}};this.pendingRequest=i.h(l,i=>{this.pendingRequest=null,n(i),this.saveEventData(),this.processRequests(o)})}getSessionAPI(r,a,n,o){this.skuToken=a,this.errorCb=o,i.g.EVENTS_URL&&i.g.SESSION_PATH&&i.g.API_URL&&(n||i.g.ACCESS_TOKEN?this.queueRequest({id:r,timestamp:Date.now()},n):this.errorCb(Error(F)))}processRequests(i){if(this.pendingRequest||0===this.queue.length)return;let{id:r,timestamp:a}=this.queue.shift();r&&this.success[r]||this.getSession(a,this.skuToken,i=>{i?this.errorCb(i):r&&(this.success[r]=!0)},i)}remove(){this.errorCb=null}},ea=er.getSessionAPI.bind(er),en=new Set;function eo(i,r){r?en.add(i):en.delete(i)}class es{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,r){this._updatedSourceCaches[i]=r,this.setDirty()}discardSourceCacheUpdate(i){delete this._updatedSourceCaches[i]}updateLayer(i){let r=i.scope;this._updatedLayers[r]=this._updatedLayers[r]||new Set,this._updatedLayers[r].add(i.id),this.setDirty()}removeLayer(i){let r=i.scope;this._removedLayers[r]=this._removedLayers[r]||{},this._updatedLayers[r]=this._updatedLayers[r]||new Set,this._removedLayers[r][i.id]=i,this._updatedLayers[r].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(){let i={};for(let r in this._updatedLayers)i[r]=i[r]||{},i[r].updatedIds=Array.from(this._updatedLayers[r].values());for(let r in this._removedLayers)i[r]=i[r]||{},i[r].removedIds=Object.keys(this._removedLayers[r]);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(r,a){this._updatedImages[a]=this._updatedImages[a]||new Set,this._updatedImages[a].add(i.I.toString(r)),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={}}}let el=new i.C(0,0,0);function eh(i,r,a){var n;1===i&&r.icons.push((n=a.readVarint()+a.pos,function(i){if(i.usvg_tree.height||(i.usvg_tree.height=i.usvg_tree.width),!i.metadata)return i;let{metadata:r}=i;if(r.content_area){let{content_area:a}=r;null==a.left&&(a.left=0),null==a.top&&(a.top=a.left),null==a.width&&(a.width=i.usvg_tree.width),null==a.height&&(a.height=a.width)}if(r.text_placeholder){let{text_placeholder:i}=r;null==i.top&&(i.top=i.left),null==i.height&&(i.height=i.width)}return r.stretch_x&&r.stretch_x.length&&eu(r,"x"),r.stretch_y&&r.stretch_y.length&&eu(r,"y"),i}(a.readFields(ec,{name:void 0},n))))}function eu(i,r){let a=[],n=i[`stretch_${r}`],o=null;for(let i=0;i<n.length;i++)null===o?o=0===a.length?n[0]:a.at(-1)[1]+n[i]:(a.push([o,o+n[i]]),o=null);i[`stretch_${r}_areas`]=a}function ec(i,r,a){var n,o;1===i?r.name=a.readString():2===i?(n=a.readVarint()+a.pos,r.metadata=a.readFields(ed,{stretch_x:null,stretch_y:null,
7stretch_x_areas:null,stretch_y_areas:null,variables:[]},n)):3===i&&(o=a.readVarint()+a.pos,r.usvg_tree=a.readFields(e_,{width:20,children:[],linear_gradients:[],radial_gradients:[],clip_paths:[],masks:[]},o),r.data="usvg_tree")}function ed(i,r,a){var n;1===i?r.stretch_x=a.readPackedVarint():2===i?r.stretch_y=a.readPackedVarint():3===i?r.content_area=ep(a,a.readVarint()+a.pos):4===i?r.variables.push((n=a.readVarint()+a.pos,a.readFields(em,{name:void 0},n))):5===i&&(r.text_placeholder=ep(a,a.readVarint()+a.pos))}function ep(i,r){return i.readFields(ef,{},r)}function ef(i,r,a){1===i?r.left=a.readVarint():2===i?r.width=a.readVarint():3===i?r.top=a.readVarint():4===i&&(r.height=a.readVarint())}function em(i,r,a){1===i?r.name=a.readString():2===i&&(r.rgb_color=eS(a.readVarint()),r.value="rgb_color")}function e_(i,r,a){var n,o,s;1===i?r.width=r.height=a.readVarint():2===i?r.height=a.readVarint():3===i?r.children.push(eg(a,a.readVarint()+a.pos)):4===i?r.linear_gradients.push((n=a.readVarint()+a.pos,a.readFields(eI,{spread_method:1,stops:[],x1:0,y1:0,x2:1,y2:0},n))):5===i?r.radial_gradients.push((o=a.readVarint()+a.pos,a.readFields(eC,{spread_method:1,stops:[],cx:.5,cy:.5,r:.5,fx:.5,fy:.5,fr:0},o))):7===i?r.clip_paths.push((s=a.readVarint()+a.pos,a.readFields(eP,{children:[]},s))):8===i&&r.masks.push(function(i,r){let a=i.readFields(eD,{left:0,width:20,mask_type:1,children:[]},r);return null==a.height&&(a.height=a.width),null==a.top&&(a.top=a.left),a}(a,a.readVarint()+a.pos))}function eg(i,r){return i.readFields(ey,{},r)}function ey(i,r,a){var n,o;1===i?(n=a.readVarint()+a.pos,r.group=a.readFields(ex,{opacity:255,children:[]},n),r.node="group"):2===i&&(o=a.readVarint()+a.pos,r.path=a.readFields(ew,{paint_order:1,commands:[],step:1,diffs:[],rule:1},o),r.node="path")}function ex(i,r,a){1===i?r.transform=ev(a,a.readVarint()+a.pos):2===i?r.opacity=a.readVarint():5===i?r.clip_path_idx=a.readVarint():6===i?r.mask_idx=a.readVarint():7===i&&r.children.push(eg(a,a.readVarint()+a.pos))}function ev(i,r){return i.readFields(eb,{sx:1,ky:0,kx:0,sy:1,tx:0,ty:0},r)}function eb(i,r,a){1===i?r.sx=a.readFloat():2===i?r.ky=a.readFloat():3===i?r.kx=a.readFloat():4===i?r.sy=a.readFloat():5===i?r.tx=a.readFloat():6===i&&(r.ty=a.readFloat())}function ew(i,r,a){var n,o;1===i?(n=a.readVarint()+a.pos,r.fill=a.readFields(eT,{rgb_color:el,paint:"rgb_color",opacity:255},n)):2===i?(o=a.readVarint()+a.pos,r.stroke=a.readFields(eE,{rgb_color:el,paint:"rgb_color",dasharray:[],dashoffset:0,miterlimit:4,opacity:255,width:1,linecap:1,linejoin:1},o)):3===i?r.paint_order=a.readVarint():5===i?a.readPackedVarint(r.commands):6===i?r.step=a.readFloat():7===i?a.readPackedSVarint(r.diffs):8===i&&(r.rule=a.readVarint())}function eT(i,r,a){1===i?(r.rgb_color=eS(a.readVarint()),r.paint="rgb_color"):2===i?(r.linear_gradient_idx=a.readVarint(),r.paint="linear_gradient_idx"):3===i?(r.radial_gradient_idx=a.readVarint(),r.paint="radial_gradient_idx"):5===i&&(r.opacity=a.readVarint())}function eS(r){return new i.C((r>>16&255)/255,(r>>8&255)/255,(255&r)/255,1)}function eE(i,r,a){1===i?(r.rgb_color=eS(a.readVarint()),r.paint="rgb_color"):2===i?(r.linear_gradient_idx=a.readVarint(),r.paint="linear_gradient_idx"):3===i?(r.radial_gradient_idx=a.readVarint(),r.paint="radial_gradient_idx"):5===i?a.readPackedFloat(r.dasharray):6===i?r.dashoffset=a.readFloat():7===i?r.miterlimit=a.readFloat():8===i?r.opacity=a.readVarint():9===i?r.width=a.readFloat():10===i?r.linecap=a.readVarint():11===i&&(r.linejoin=a.readVarint())}function eI(i,r,a){1===i?r.transform=ev(a,a.readVarint()+a.pos):2===i?r.spread_method=a.readVarint():3===i?r.stops.push(eA(a,a.readVarint()+a.pos)):4===i?r.x1=a.readFloat():5===i?r.y1=a.readFloat():6===i?r.x2=a.readFloat():7===i&&(r.y2=a.readFloat())}function eA(i,r){return i.readFields(eM,{offset:0,opacity:255,rgb_color:el},r)}function eM(i,r,a){1===i?r.offset=a.readFloat():2===i?r.opacity=a.readVarint():3===i&&(r.rgb_color=eS(a.readVarint()))}function eC(i,r,a){1===i?r.transform=ev(a,a.readVarint()+a.pos):2===i?r.spread_method=a.readVarint():3===i?r.stops.push(eA(a,a.readVarint()+a.pos)):4===i?r.cx=a.readFloat():5===i?r.cy=a.readFloat():6===i?r.r=a.readFloat():7===i?r.fx=a.readFloat():8===i?r.fy=a.readFloat():9===i&&(r.fr=a.readFloat())}function eP(i,r,a){1===i?r.transform=ev(a,a.readVarint()+a.pos):2===i?r.clip_path_idx=a.readVarint():3===i&&r.children.push(eg(a,a.readVarint()+a.pos))}function eD(i,r,a){1===i?r.left=r.top=a.readFloat():2===i?r.width=r.height=a.readFloat():3===i?r.top=a.readFloat():4===i?r.height=a.readFloat():5===i?r.mask_type=a.readVarint():6===i?r.mask_idx=a.readVarint():7===i&&r.children.push(eg(a,a.readVarint()+a.pos))}class eR{static calculate(r={},a=[]){let n=new Map,o=new Map;if(0===Object.keys(r).length)return n;
7for(let[s,l]of(a.forEach(r=>{o.set(r.name,r.rgb_color||new i.C(0,0,0))}),Object.entries(r)))o.has(s)?n.set(o.get(s).toString(),l):console.warn(`Ignoring unknown image variable "${s}"`);return n}}function ez(i,r=255,a){let n=a.get(i.toString())||i;if(255===r)return n.toString();let o=n.clone();return o.a*=r/255,o.toString()}let eL=[],eF=0;function eO(r,a){if(eF>=eL.length){let n=i.r()?new OffscreenCanvas(r,a):document.createElement("canvas");eL.push(n.getContext("2d",{willReadFrequently:!0}))}let n=eL[eF++];return n.canvas.width=r,n.canvas.height=a,n}function eB(i,r,a,n,o){for(let s of n.children)(function i(r,a,n,o,s){var l;o.group?(r.save(),function(r,a,n,o,s){var l,h;let u=null!=o.mask_idx?n.masks[o.mask_idx]:null,c=null!=o.clip_path_idx?n.clip_paths[o.clip_path_idx]:null;if(o.transform&&(a=eG(o.transform).preMultiplySelf(a)),l=null!=c,h=null!=u,255===o.opacity&&!l&&!h)return eB(r,a,n,o,s);let d=eO(r.canvas.width,r.canvas.height);eB(d,a,n,o,s),c&&function i(r,a,n,o){let s=eO(r.canvas.width,r.canvas.height);(function r(a,n,o,s){let l=s.transform?eG(s.transform).preMultiplySelf(n):n,h=eO(a.canvas.width,a.canvas.height);for(let i of s.children)if(i.group)r(h,l,o,i.group);else if(i.path){let r=i.path,a=new Path2D;a.addPath(e$(r),l),h.fill(a,eN(r))}let u=null!=s.clip_path_idx?o.clip_paths[s.clip_path_idx]:null;u&&i(h,l,o,u),a.globalCompositeOperation="source-over",a.drawImage(h.canvas,0,0),eF--})(s,a,n,o),r.globalCompositeOperation="destination-in",r.drawImage(s.canvas,0,0),eF--}(d,a,n,c),u&&function r(a,n,o,s,l){if(0===s.children.length)return;let h=null!=s.mask_idx?o.masks[s.mask_idx]:null;h&&r(a,n,o,h,l);let u=a.canvas.width,c=a.canvas.height,d=eO(u,c),p=s.width,f=s.height,m=s.left,_=s.top,g=new Path2D,y=new Path2D;for(let r of(y.rect(m,_,p,f),g.addPath(y,n),d.clip(g),s.children))i(d,n,o,r,l);let x=d.getImageData(0,0,u,c),v=x.data;if(1===s.mask_type)for(let i=0;i<v.length;i+=4)v[i+3]=v[i+3]/255*(.2126*v[i]+.7152*v[i+1]+.0722*v[i+2]);d.putImageData(x,0,0),a.globalCompositeOperation="destination-in",a.drawImage(d.canvas,0,0),eF--}(d,a,n,u,s),r.globalAlpha=o.opacity/255,r.drawImage(d.canvas,0,0),eF--}(r,a,n,o.group,s),r.restore()):o.path&&(r.save(),l=o.path,r.setTransform(a),1===l.paint_order?(ek(r,n,l,s),eU(r,n,l,s)):(eU(r,n,l,s),ek(r,n,l,s)),r.restore())})(i,r,a,s,o)}function ek(i,r,a,n){let o=a.fill;if(!o)return;let s=o.opacity/255;switch(i.save(),i.beginPath(),eH(a,i),o.paint){case"rgb_color":i.fillStyle=ez(o.rgb_color,o.opacity,n);break;case"linear_gradient_idx":{let a=r.linear_gradients[o.linear_gradient_idx];a.transform&&i.setTransform(eG(a.transform).preMultiplySelf(i.getTransform())),i.fillStyle=eV(i,a,s,n);break}case"radial_gradient_idx":{let a=r.radial_gradients[o.radial_gradient_idx];a.transform&&i.setTransform(eG(a.transform).preMultiplySelf(i.getTransform())),i.fillStyle=ej(i,a,s,n)}}i.fill(eN(a)),i.restore()}function eN(i){return 1===i.rule?"nonzero":2===i.rule?"evenodd":void 0}function eU(i,r,a,n){let o=a.stroke;if(!o)return;let s=e$(a);i.lineWidth=o.width,i.miterLimit=o.miterlimit,i.setLineDash(o.dasharray),i.lineDashOffset=o.dashoffset;let l=o.opacity/255;switch(o.paint){case"rgb_color":i.strokeStyle=ez(o.rgb_color,o.opacity,n);break;case"linear_gradient_idx":i.strokeStyle=eV(i,r.linear_gradients[o.linear_gradient_idx],l,n,!0);break;case"radial_gradient_idx":i.strokeStyle=ej(i,r.radial_gradients[o.radial_gradient_idx],l,n,!0)}switch(o.linejoin){case 2:case 1:i.lineJoin="miter";break;case 3:i.lineJoin="round";break;case 4:i.lineJoin="bevel"}switch(o.linecap){case 1:i.lineCap="butt";break;case 2:i.lineCap="round";break;case 3:i.lineCap="square"}i.stroke(s)}function eV(i,r,a,n,o=!1){if(1===r.stops.length){let i=r.stops[0];return ez(i.rgb_color,i.opacity*a,n)}let{x1:s,y1:l,x2:h,y2:u}=r,c=new DOMPoint(s,l),d=new DOMPoint(h,u);if(o){let i=eG(r.transform);c=i.transformPoint(c),d=i.transformPoint(d)}let p=i.createLinearGradient(c.x,c.y,d.x,d.y);for(let i of r.stops)p.addColorStop(i.offset,ez(i.rgb_color,i.opacity*a,n));return p}function ej(i,r,a,n,o=!1){if(1===r.stops.length){let i=r.stops[0];return ez(i.rgb_color,i.opacity*a,n)}let s=eG(r.transform),{fx:l,fy:h,fr:u,cx:c,cy:d,r:p}=r,f=new DOMPoint(l,h),m=new DOMPoint(c,d),_=u,g=p;if(o){f=s.transformPoint(f),m=s.transformPoint(m);let i=(s.a+s.d)/2;_=u*i,g=r.r*i}let y=i.createRadialGradient(f.x,f.y,_,m.x,m.y,g);for(let i of r.stops)y.addColorStop(i.offset,ez(i.rgb_color,i.opacity*a,n));return y}function eG(i){return i?new DOMMatrix([i.sx,i.ky,i.kx,i.sy,i.tx,i.ty]):new DOMMatrix}function eH(i,r){let a=i.step,n=i.diffs[0]*a,o=i.diffs[1]*a;r.moveTo(n,o);for(let s=0,l=2;s<i.commands.length;s++)switch(i.commands[s]){case 1:n+=i.diffs[l++]*a,o+=i.diffs[l++]*a,r.moveTo(n,o);break;case 2:n+=i.diffs[l++]*a,o+=i.diffs[l++]*a,r.lineTo(n,o);break;case 3:{let s=n+i.diffs[l++]*a,h=o+i.diffs[l++]*a;n=s+i.diffs[l++]*a,o=h+i.diffs[l++]*a,r.quadraticCurveTo(s,h,n,o);break}case 4:{let s=n+i.diffs[l++]*a,h=o+i.diffs[l++]*a,u=s+i.diffs[l++]*a,c=h+i.diffs[l++]*a;n=u+i.diffs[l++]*a,o=c+i.diffs[l++]*a,r.bezierCurveTo(s,h,u,c,n,o);break}case 5:r.closePath()}return r}function e$(i){return eH(i,new Path2D)}class eq{constructor(){this.cacheMap=new Map,this.cacheDependenciesMap=new Map}static _getImage(r){return new i.q(r,r.data)}getFromCache(r,a,n){return this.cacheMap.has(n)||this.cacheMap.set(n,new i.L(150)),this.cacheMap.get(n).get(i.t(r.toString(),a))}setInCache(r,a,n,o){this.cacheDependenciesMap.has(o)||this.cacheDependenciesMap.set(o,new Map),this.cacheMap.has(o)||this.cacheMap.set(o,new i.L(150));let s=this.cacheDependenciesMap.get(o),l=i.t(r.id.toString(),n);s.get(l)||s.set(l,new Set);let h=this.cacheMap.get(o),u=r.toString();s.get(l).add(u),h.put(i.t(r.toString(),n),a)}removeImagesFromCacheByIds(r,a,n=0){if(!this.cacheMap.has(n)||!this.cacheDependenciesMap.has(n))return;let o=this.cacheMap.get(n),s=this.cacheDependenciesMap.get(n);for(let n of r){let r=i.t(n.toString(),a);if(s.has(r)){for(let i of s.get(r))o.delete(i);s.delete(r)}}}rasterize(i,r,a,n){let o=this.getFromCache(i,a,n);if(o)return o.clone();let s=function(i,r){let a=eR.calculate(r.params,i.metadata?i.metadata.variables:[]),n=i.usvg_tree,o=n.width,s=n.height,l=Math.max(1,Math.round(o*r.sx)),h=Math.max(1,Math.round(s*r.sy)),u=new DOMMatrix([l/o,0,0,h/s,0,0]),c=eO(l,h);eB(c,u,n,n,a);let d=c.getImageData(0,0,l,h);return eF--,d}(r.icon,i),l=eq._getImage(s);return this.setInCache(i,l,a,n),l.clone()}}class eZ extends i.E{constructor(r){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 i.x,this.dirty=!0,this.spriteFormat=r,this.imageRasterizer=new eq}addScope(r){this.loaded.set(r,!1),this.imageProviders.set(r,new Map),this.images.set(r,new Map),this.updatedImages.set(r,new Set),this.callbackDispatchedThisFrame.set(r,new Set),this.imageVersions.set(r,new Map),this.patterns.set(r,new Map),this.atlasImage.set(r,new i.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);let r=this.atlasTexture.get(i);r&&(r.destroy(),this.atlasTexture.delete(i))}addImageProvider(i,r){this.imageProviders.has(r)||this.imageProviders.set(r,new Map),this.imageProviders.get(r).set(i.id,i)}removeImageProvider(i,r){this.imageProviders.has(r)&&this.imageProviders.get(r).delete(i)}getPendingImageProviders(){let i=[];for(let r of this.imageProviders.values())for(let a of r.values())a.hasPendingRequests()&&i.push(a);return i}isLoaded(){for(let i of this.loaded.keys())if(!this.loaded.get(i))return!1;return!0}setLoaded(i,r){if(this.loaded.get(r)!==i&&(this.loaded.set(r,i),i)){for(let{ids:i,callback:a}of this.requestors)this._notify(i,r,a);this.requestors=[]}}hasImage(i,r){return!!this.getImage(i,r)}getImage(i,r){return this.images.get(r).get(i.toString())}
7addImage(i,r,a){if(this._validate(i,a)){this.images.get(r).set(i.toString(),a);let n=this.imageVersions.get(r),o=n.get(i.toString())||0;n.set(i.toString(),o+1)}}_validate(r,a){let n=!0;return this._validateStretch(a.stretchX,a.data&&a.data.width)||(this.fire(new i.y(Error(`Image "${r.name}" has invalid "stretchX" value`))),n=!1),this._validateStretch(a.stretchY,a.data&&a.data.height)||(this.fire(new i.y(Error(`Image "${r.name}" has invalid "stretchY" value`))),n=!1),this._validateContent(a.content,a)||(this.fire(new i.y(Error(`Image "${r.name}" has invalid "content" value`))),n=!1),n}_validateStretch(i,r){if(!i)return!0;let a=0;for(let n of i){if(n[0]<a||n[1]<n[0]||r<n[1])return!1;a=n[1]}return!0}_validateContent(i,r){return!i||4===i.length&&(!!r.usvg||!(i[0]<0)&&!(r.data.width<i[0])&&!(i[1]<0)&&!(r.data.height<i[1])&&!(i[2]<0)&&!(r.data.width<i[2])&&!(i[3]<0)&&!(r.data.height<i[3]))&&!(i[2]<i[0]||i[3]<i[1])}updateImage(i,r,a){a.version=this.images.get(r).get(i.toString()).version+1,this.images.get(r).set(i.toString(),a),this.updatedImages.get(r).add(i);let n=this.imageVersions.get(r),o=n.get(i.toString())||0;n.set(i.toString(),o+1),this.removeFromImageRasterizerCache(i,r)}clearUpdatedImages(i){this.updatedImages.get(i).clear()}removeFromImageRasterizerCache(i,r){"raster"!==this.spriteFormat&&this.imageRasterizer.removeImagesFromCacheByIds([i],r)}removeImage(i,r){let a=this.images.get(r),n=a.get(i.toString());a.delete(i.toString());let o=this.imageVersions.get(r),s=o.get(i.toString())||0;o.set(i.toString(),s+1),this.patterns.get(r).delete(i.toString()),this.removeFromImageRasterizerCache(i,r),n.userImage&&n.userImage.onRemove&&n.userImage.onRemove()}listImages(r){return Array.from(this.images.get(r).keys()).map(r=>i.I.from(r))}getImageVersions(i){let r=this.imageVersions.get(i);if(r)return r}getImages(i,r,a){let n=[],o=[],s=this.imageProviders.get(r);for(let a of i){if(!a.iconsetId){n.push(a);continue}let i=s.get(a.iconsetId);i&&(this.getImage(a,r)?o.push(a):i.addPendingRequest(a))}if(0===n.length)return void this._notify(o,r,a);let l=!0,h=!!this.loaded.get(r),u=this.images.get(r);if(!h)for(let i of n)u.has(i.toString())||(l=!1);h||l?this._notify(n,r,a):this.requestors.push({ids:n,scope:r,callback:a})}rasterizeImages(i,r){let a=new Map,{iconTasks:n,patternTasks:o,scope:s}=i;for(let i of[n,o])for(let[r,n]of i.entries()){let i=this.getImage(n.id,s);i&&a.set(r,{image:i,imageVariant:n})}r(null,this._rasterizeImages(s,a))}_rasterizeImages(i,r){let a=new Map;for(let[n,{image:o,imageVariant:s}]of r.entries())a.set(n,this.imageRasterizer.rasterize(s,o,i,0));return a}getUpdatedImages(i){return this.updatedImages.get(i)||new Set}_notify(r,a,n){let o=this.images.get(a),s=new Map;for(let a of r){if(!o.get(a.toString())){if(a.iconsetId)continue;this.fire(new i.z("styleimagemissing",{id:a.name}))}let r=o.get(a.toString());if(!r){i.w(`Image "${a.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}let n={data:r.usvg?null:r.data.clone(),pixelRatio:r.pixelRatio,sdf:r.sdf,usvg:r.usvg,stretchX:r.stretchX,stretchY:r.stretchY,content:r.content,hasRenderCallback:!!(r.userImage&&r.userImage.render)};r.usvg&&Object.assign(n,{width:r.icon.usvg_tree.width,height:r.icon.usvg_tree.height}),s.set(i.I.toString(a),n)}n(null,{images:s,versions:this.getImageVersions(a)})}getPixelSize(i){let{width:r,height:a}=this.atlasImage.get(i);return{width:r,height:a}}getPattern(r,a,n){let o=r.toString(),s=this.patterns.get(a),l=s.get(o),h=this.getImage(r,a);if(!h)return null;if(l){if(l.position.version===h.version)return l.position;l.position.version=h.version}else{if(h.usvg&&!h.data){let s=this.getPatternInFlightId(o,a);if(this.patternsInFlight.has(s))return null;this.patternsInFlight.add(s);let l=new i.A(r).scaleSelf(i.o.devicePixelRatio),u=new Map([[l.toString(),{image:h,imageVariant:l}]]),c=this._rasterizeImages(a,u);return this.storePatternImage(l,a,h,n,c),null}this.storePattern(r,a,h)}return this._updatePatternAtlas(a,n),s.get(o).position}getPatternInFlightId(r,a){return i.t(r,a)}hasPatternsInFlight(){return 0!==this.patternsInFlight.size}storePatternImage(i,r,a,n,o){let s=i.toString(),l=o?o.get(s):void 0;l&&(a.data=l,this.storePattern(i.id,r,a),this._updatePatternAtlas(r,n),this.patternsInFlight.delete(this.getPatternInFlightId(i.id.toString(),r)))}storePattern(r,a,n){let o={w:n.data.width+2*i.B,h:n.data.height+2*i.B,x:0,y:0},s=new i.D(o,n,i.B);this.patterns.get(a).set(r.toString(),{bin:o,position:s})}destroyAtlasTextures(){for(let i of this.atlasTexture.values())i&&i.destroy();this.atlasTexture.clear()}bind(r,a){let n=r.gl,o=this.atlasTexture.get(a);o?this.dirty&&(o.update(this.atlasImage.get(a)),this.dirty=!1):(o=new i.T(r,this.atlasImage.get(a),n.RGBA8),this.atlasTexture.set(a,o)),o.bind(n.LINEAR,n.CLAMP_TO_EDGE)}_updatePatternAtlas(r,a){let n=this.patterns.get(r),o=Array.from(n.values()).map(({bin:i})=>i),{w:s,h:l}=i.F(o),h=this.atlasImage.get(r);h.resize({width:s||1,height:l||1});let u=this.images.get(r);for(let[r,{bin:o,position:s}]of n.entries()){let n=s.padding,l=o.x+n,c=o.y+n,d=u.get(r).data,p=d.width,f=d.height;n=n>
71?n-1:n,i.q.copy(d,h,{x:0,y:0},{x:l,y:c},{width:p,height:f},a),i.q.copy(d,h,{x:0,y:f-n},{x:l,y:c-n},{width:p,height:n},a),i.q.copy(d,h,{x:0,y:0},{x:l,y:c+f},{width:p,height:n},a),i.q.copy(d,h,{x:p-n,y:0},{x:l-n,y:c},{width:n,height:f},a),i.q.copy(d,h,{x:0,y:0},{x:l+p,y:c},{width:n,height:f},a),i.q.copy(d,h,{x:p-n,y:f-n},{x:l-n,y:c-n},{width:n,height:n},a),i.q.copy(d,h,{x:0,y:f-n},{x:l+p,y:c-n},{width:n,height:n},a),i.q.copy(d,h,{x:0,y:0},{x:l+p,y:c+f},{width:n,height:n},a),i.q.copy(d,h,{x:p-n,y:0},{x:l-n,y:c+f},{width:n,height:n},a)}this.dirty=!0}beginFrame(){for(let i of this.images.keys())this.callbackDispatchedThisFrame.set(i,new Set)}dispatchRenderCallbacks(i,r){let a=this.images.get(r);for(let n of i){if(this.callbackDispatchedThisFrame.get(r).has(n.toString()))continue;this.callbackDispatchedThisFrame.get(r).add(n.toString());let i=a.get(n.toString());(function(i){let{userImage:r}=i;return!!(r&&r.render&&r.render())&&(i.data.replace(new Uint8Array(r.data.buffer)),!0)})(i)&&this.updateImage(n,r,i)}}}class eW{constructor(i,r,a,n){this.message=(i?`${i}: `:"")+a,n&&(this.identifier=n),null!=r&&r.__line__&&(this.line=r.__line__)}}class eX extends eW{}function eY(r){let a=r.value,n=r.valueSpec,o=r.style,s=r.styleSpec,l=r.key,h=r.arrayElementValidator||ts;if(!Array.isArray(a))return[new eW(l,a,`array expected, ${i.J(a)} found`)];if(n.length&&a.length!==n.length)return[new eW(l,a,`array length ${n.length} expected, length ${a.length} found`)];if(n["min-length"]&&a.length<n["min-length"])return[new eW(l,a,`array length at least ${n["min-length"]} expected, length ${a.length} found`)];let u={type:n.value,values:n.values,minimum:n.minimum,maximum:n.maximum,function:void 0};s.$version<7&&(u.function=n.function),i.G(n.value)&&(u=n.value);let c=[];for(let i=0;i<a.length;i++)c=c.concat(h({array:a,arrayIndex:i,value:a[i],valueSpec:u,style:o,styleSpec:s,key:`${l}[${i}]`},!0));return c}function eJ(r){let a=r.key,n=r.value,o=r.valueSpec;if(!i.K(n))return[new eW(a,n,`number expected, ${i.J(n)} found`)];if(n!=n)return[new eW(a,n,"number expected, NaN found")];if("minimum"in o){let i=o.minimum;if(Array.isArray(o.minimum)&&(i=o.minimum[r.arrayIndex]),n<i)return[new eW(a,n,`${n} is less than the minimum value ${i}`)]}if("maximum"in o){let i=o.maximum;if(Array.isArray(o.maximum)&&(i=o.maximum[r.arrayIndex]),n>i)return[new eW(a,n,`${n} is greater than the maximum value ${i}`)]}return[]}function eK(r){let a=r.key,n=r.value;if(!i.G(n))return[new eW(a,n,`object expected, ${i.J(n)} found`)];let o=r.valueSpec,s=i.H(n.type),l,h,u,c={},d="categorical"!==s&&void 0===n.property,p=function(r){let a=r.stops;return Array.isArray(a)&&Array.isArray(a[0])&&i.G(a[0][0])}(n),f=tl({key:r.key,value:r.value,valueSpec:r.styleSpec.function,style:r.style,styleSpec:r.styleSpec,objectElementValidators:{stops:function(i){if("identity"===s)return[new eW(i.key,i.value,'identity function may not have a "stops" property')];let r=[],a=i.value;return r=r.concat(eY({key:i.key,value:a,valueSpec:i.valueSpec,style:i.style,styleSpec:i.styleSpec,arrayElementValidator:m})),Array.isArray(a)&&0===a.length&&r.push(new eW(i.key,a,"array must have at least one stop")),r},default:function(i){return ts({key:i.key,value:i.value,valueSpec:o,style:i.style,styleSpec:i.styleSpec})}}});return"identity"===s&&d&&f.push(new eW(r.key,r.value,'missing required property "property"')),"identity"===s||n.stops||f.push(new eW(r.key,r.value,'missing required property "stops"')),"exponential"===s&&o.expression&&!i.M(o)&&f.push(new eW(r.key,r.value,"exponential functions not supported")),r.styleSpec.$version>=8&&(d||i.N(o)?d&&!i.O(o)&&f.push(new eW(r.key,r.value,"zoom functions not supported")):f.push(new eW(r.key,r.value,"property functions not supported"))),("categorical"===s||p)&&void 0===n.property&&f.push(new eW(r.key,r.value,'"property" property is required')),f;function m(r){let a=[],n=r.value,s=r.key;if(!Array.isArray(n))return[new eW(s,n,`array expected, ${i.J(n)} found`)];if(2!==n.length)return[new eW(s,n,`array length 2 expected, length ${n.length} found`)];if(p){if(!i.G(n[0]))return[new eW(s,n,`object expected, ${i.J(n[0])} found`)];let o=n[0];if(void 0===o.zoom)return[new eW(s,n,"object stop key must have zoom")];if(void 0===o.value)return[new eW(s,n,"object stop key must have value")];let l=i.H(o.zoom);if("number"!=typeof l)return[new eW(s,o.zoom,"stop zoom values must be numbers")];if(u&&u>l)return[new eW(s,o.zoom,"stop zoom values must appear in ascending order")];l!==u&&(u=l,h=void 0,c={}),a=a.concat(tl({key:`${s}[0]`,value:n[0],valueSpec:{zoom:{}},style:r.style,styleSpec:r.styleSpec,objectElementValidators:{zoom:eJ,value:_}}))}else a=a.concat(_({key:`${s}[0]`,value:n[0],style:r.style,styleSpec:r.styleSpec},n));return i.Q(i.S(n[1]))?a.concat([new eW(`${s}[1]`,n[1],"expressions are not allowed in function stops.")]):a.concat(ts({key:`${s}[1]`,value:n[1],valueSpec:o,style:r.style,styleSpec:r.styleSpec}))}function _(r,a){let n=i.J(r.value),u=i.H(r.value),d=null!==r.value?r.value:a;if(l){if(n!==l)return[new eW(r.key,d,`${n} stop domain type must match previous stop domain type ${l}`)]}else l=n;if("number"!==n&&"string"!==n&&"boolean"!==n&&"number"!=typeof u&&"string"!=typeof u&&"boolean"!=typeof u)return[new eW(r.key,d,"stop domain value must be a number, string, or boolean")];if("number"!==n&&"categorical"!==s){let a=`number expected, ${n} found`;return i.N(o)&&void 0===s&&(a+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new eW(r.key,d,a)]}return"categorical"!==s||"number"!==n||"number"==typeof u&&isFinite(u)&&Math.floor(u)===u?"categorical"!==s&&"number"===n&&"number"==typeof u&&"number"==typeof h&&void 0!==h&&u<h?[new eW(r.key,d,"stop domain values must appear in ascending order")]:(h=u,"categorical"===s&&u in c?[new eW(r.key,d,"stop domain values must be unique")]:(c[u]=!0,[])):[new eW(r.key,d,`integer expected, found ${String(u)}`)]}}function eQ(r){let a=("property"===r.expressionContext?i.V:i.U)(i.S(r.value),r.valueSpec);if("error"===a.result)return a.value.map(i=>new eW(`${r.key}${i.key}`,r.value,i.message));let n=a.value.expression||a.value._styleExpression.expression;if("property"===r.expressionContext&&"text-font"===r.propertyKey&&!n.outputDefined())return[new eW(r.key,r.value,`Invalid data expression for "${r.propertyKey}". Output values must be contained as literals within the expression.`)];if("property"===r.expressionContext&&"layout"===r.propertyType&&!i.Y(n))return[new eW(r.key,r.value,'"feature-state" data expressions are not supported with layout properties.')];if("filter"===r.expressionContext)return function r(a,n){let o=new Set(["zoom","feature-state","pitch","distance-from-center"]);if(n.valueSpec&&n.valueSpec.expression)for(let i of n.valueSpec.expression.parameters)o.delete(i);if(0===o.size)return[];let s=[];return a instanceof i.Z&&o.has(a.name)?[new eW(n.key,n.value,`["${a.name}"] expression is not supported in a filter for a ${n.object.type}
7 layer with id: ${n.object.id}`)]:(a.eachChild(i=>{s.push(...r(i,n))}),s)}(n,r);if("appearance"===r.expressionContext)return function r(a,n){let o=new Set;if(n.valueSpec&&n.valueSpec.expression)for(let i of n.valueSpec.expression.parameters)o.add(i);if(0===o.size)return[];let s=[];return a instanceof i.Z&&!o.has(a.name)?[new eW(n.key,n.value,`["${a.name}"] is not an allowed parameter`)]:(a.eachChild(i=>{s.push(...r(i,n))}),s)}(n,r);if(r.expressionContext&&0===r.expressionContext.indexOf("cluster")){if(!i.W(n,["zoom","feature-state"]))return[new eW(r.key,r.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===r.expressionContext&&!i.X(n))return[new eW(r.key,r.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function e0(r){let a=r.key,n=r.value,o=r.valueSpec,s=[];return Array.isArray(o.values)?o.values.includes(i.H(n))||s.push(new eW(a,n,`expected one of [${o.values.join(", ")}], ${JSON.stringify(n)} found`)):Object.keys(o.values).includes(i.H(n))||s.push(new eW(a,n,`expected one of [${Object.keys(o.values).join(", ")}], ${JSON.stringify(n)} found`)),s}function e1(r){return i.a1(i.S(r.value))?eQ(Object.assign({},r,{expressionContext:"filter",valueSpec:r.styleSpec[`filter_${r.layerType||"fill"}`]})):function r(a){let n=a.value,o=a.key;if(!Array.isArray(n))return[new eW(o,n,`array expected, ${i.J(n)} found`)];if(n.length<1)return[new eW(o,n,"filter array must have at least 1 element")];let s=a.styleSpec,l=e0({key:`${o}[0]`,value:n[0],valueSpec:s.filter_operator}),h=()=>{n.length>=2&&(i.$(n[1])||l.push(new eW(`${o}[1]`,n[1],`string expected, ${i.J(n[1])} found`)));for(let r=2;r<n.length;r++)"$type"===i.H(n[1])?l=l.concat(e0({key:`${o}[${r}]`,value:n[r],valueSpec:s.geometry_type})):i.$(n[r])||i.K(n[r])||i._(n[r])||l.push(new eW(`${o}[${r}]`,n[r],`string, number, or boolean expected, ${i.J(n[r])} found.`))};switch(i.H(n[0])){case"<":case"<=":case">":case">=":n.length>=2&&"$type"===i.H(n[1])&&l.push(new eW(o,n,`"$type" cannot be use with operator "${n[0]}"`)),3!==n.length&&l.push(new eW(o,n,`filter array for operator "${n[0]}" must have 3 elements`)),h();break;case"==":case"!=":3!==n.length&&l.push(new eW(o,n,`filter array for operator "${n[0]}" must have 3 elements`)),h();break;case"in":case"!in":h();break;case"any":case"all":case"none":for(let i=1;i<n.length;i++)l=l.concat(r({key:`${o}[${i}]`,value:n[i],style:a.style,styleSpec:a.styleSpec}));break;case"has":case"!has":2!==n.length?l.push(new eW(o,n,`filter array for "${n[0]}" operator must have 2 elements`)):i.$(n[1])||l.push(new eW(`${o}[1]`,n[1],`string expected, ${i.J(n[1])} found`))}return l}(r)}let e2=/^{([^}]+)}$/;function e3(r,a){let n,o=r.key,s=r.style,l=r.layer,h=r.styleSpec,u=r.value,c=r.objectKey,d=h[`${a}_${r.layerType}`];if(!d)return[];let p=c.match(i.a2);if(p&&d[p[1]])return i.Q(i.S(u))?[].concat(ts({key:o,value:u,valueSpec:{type:"string",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},style:s,styleSpec:h,expressionContext:"property",propertyType:a,propertyKey:c})):ts({key:o,value:u,valueSpec:{type:"string"},style:s,styleSpec:h});let f=c.match(i.a3);if("paint"===a&&f&&d[f[1]]&&d[f[1]].transition)return ts({key:o,value:u,valueSpec:h.transition,style:s,styleSpec:h});let m=r.valueSpec||d[c];if(!m)return[new eX(o,u,`unknown property "${c}"`)];if(i.$(u)&&i.N(m)&&!m.tokens&&(n=e2.exec(u))){let i=`\`{ "type": "identity", "property": ${n?JSON.stringify(n[1]):'"_"'} }\``;return[new eW(o,u,`"${c}" does not support interpolation syntax 8Use an identity property function instead: ${i}.`)]}let _=[];if("symbol"===r.layerType)"text-field"!==c||!s||s.glyphs||s.imports||_.push(new eW(o,u,'use of "text-field" requires a style "glyphs" property')),"text-font"===c&&i.a4(i.S(u))&&"identity"===i.H(u.type)&&_.push(new eW(o,u,'"text-font" does not support identity functions'));else if("model"===r.layerType&&"paint"===a&&l&&l.layout&&Object.hasOwn(l.layout,"model-id")&&i.N(m)&&(i.a5(m)||i.O(m))){let r=i.V(i.S(u),m).value,a="expression"in r&&r.expression||"_styleExpression"in r&&r._styleExpression&&r._styleExpression.expression;a&&!i.W(a,["measure-light"])&&("model-emissive-strength"===c&&i.X(a)&&i.Y
8(a)||_.push(new eW(o,u,`${c} does not support measure-light expressions when the model layer source is vector tile or GeoJSON.`)))}return _.concat(ts({key:r.key,value:u,valueSpec:m,style:s,styleSpec:h,expressionContext:"property",propertyType:a,propertyKey:c}))}function e5(i){return e3(i,"paint")}function e4(i){return e3(i,"layout")}function e6(r){let a=[],n=r.value,o=r.key,s=r.style,l=r.styleSpec;if(!i.G(n))return[new eW(o,n,"object expected")];n.type||n.ref||a.push(new eW(o,n,'either "type" or "ref" is required'));let h=i.H(n.type),u=i.H(n.ref);if(n.id){let l=i.H(n.id);for(let h=0;h<r.arrayIndex;h++){let r=s.layers[h];i.H(r.id)===l&&a.push(new eW(o,n.id,`duplicate layer id "${l}", previously used at line ${r.id.__line__}`))}}if("ref"in n){let r;["type","source","source-layer","filter","layout"].forEach(i=>{i in n&&a.push(new eW(o,n[i],`"${i}" is prohibited for ref layers`))}),s.layers.forEach(a=>{i.H(a.id)===u&&(r=a)}),r?r.ref?a.push(new eW(o,n.ref,"ref cannot reference another ref layer")):h=i.H(r.type):"string"==typeof u&&a.push(new eW(o,n.ref,`ref layer "${u}" not found`))}else if("background"!==h&&"sky"!==h&&"slot"!==h)if(n.source)if(i.$(n.source)){let r=s.sources&&s.sources[n.source],l=r&&i.H(r.type);r?"vector"===l&&"raster"===h?a.push(new eW(o,n.source,`layer "${n.id}" requires a raster source`)):"raster"===l&&"raster"!==h?a.push(new eW(o,n.source,`layer "${n.id}" requires a vector source`)):"vector"!==l||n["source-layer"]?"raster-dem"===l&&"hillshade"!==h?a.push(new eW(o,n.source,"raster-dem source can only be used with layer type 'hillshade'.")):"raster-array"!==l||["raster","raster-particle"].includes(h)?"line"===h&&n.paint&&n.paint["line-gradient"]&&"geojson"===l&&!r.lineMetrics?a.push(new eW(o,n,`layer "${n.id}" specifies a line-gradient, which requires the GeoJSON source to have \`lineMetrics\` enabled.`)):"line"===h&&n.paint&&n.paint["line-trim-offset"]&&"geojson"===l&&!r.lineMetrics?a.push(new eW(o,n,`layer "${n.id}" specifies a line-trim-offset, which requires the GeoJSON source to have \`lineMetrics\` enabled.`)):"raster-particle"===h&&"raster-array"!==l&&a.push(new eW(o,n.source,`layer "${n.id}" requires a 'raster-array' source.`)):a.push(new eW(o,n.source,"raster-array source can only be used with layer type 'raster'.")):a.push(new eW(o,n,`layer "${n.id}" must specify a "source-layer"`)):a.push(new eW(o,n.source,`source "${n.source}" not found`))}else a.push(new eW(`${o}.source`,n.source,'"source" must be a string'));else a.push(new eW(o,n,'missing required property "source"'));return a=a.concat(tl({key:o,value:n,valueSpec:l.layer,style:r.style,styleSpec:r.styleSpec,objectElementValidators:{"*":()=>[],type:()=>ts({key:`${o}.type`,value:n.type,valueSpec:l.layer.type,style:r.style,styleSpec:r.styleSpec,object:n,objectKey:"type"}),filter:i=>e1(Object.assign({layerType:h},i)),layout:i=>tl({layer:n,key:i.key,value:i.value,valueSpec:{},style:i.style,styleSpec:i.styleSpec,objectElementValidators:{"*":i=>e4(Object.assign({layerType:h},i))}}),paint:i=>tl({layer:n,key:i.key,value:i.value,valueSpec:{},style:i.style,styleSpec:i.styleSpec,objectElementValidators:{"*":i=>e5(Object.assign({layerType:h,layer:n},i))}}),appearances(r){let a=eY({key:r.key,value:r.value,valueSpec:r.valueSpec,style:r.style,styleSpec:r.styleSpec,arrayElementValidator:r=>(function(r){let{key:a,layer:n,layerType:o}=r,s=i.H(r.value),l=i.H(s.name),h=i.H(s.condition),u=tl({key:a,value:s,valueSpec:r.styleSpec.appearance,style:r.style,styleSpec:r.styleSpec,objectElementValidators:{condition:r=>(function(r){let a=[];return a.push(...eQ({key:r.key,value:r.object.condition,valueSpec:i.a6.appearance.condition,expressionContext:"appearance"})),a})(Object.assign({layer:n,layerType:o},r)),properties:i=>(function(i){let r=[],{styleSpec:a,layer:n,layerType:o}=i,s=a[`paint_${o}`],l=a[`layout_${o}`],h=i.object[i.objectKey];for(let a in h){let u=a in s?"paint":a in l?"layout":void 0;if(!u){r.push(new eW(i.key,a,`unknown property "${a}" for layer type "${o}"`));continue}let c=Object.assign({},i,{key:`${i.key}.${a}`,object:h,objectKey:a,layer:n,layerType:o,value:h[a],valueSpec:"paint"===u?s[a]:l[a]});r.push(...e3(c,u))}return r})(Object.assign({layer:n,layerType:o},i))}});return"hidden"!==l&&void 0===h&&u.push(new eW(r.key,"name",'Appearance with name different than "hidden" must have a condition')),u})(Object.assign({layerType:h,layer:n},r))}),o=Array.isArray(r.value)?r.value:[],s=new Set;return o.forEach((o,l)=>{let h=i.H(o.name);if(h)if(s.has(h)){let o=i.H(n.id);a.push(new eW(r.key,h,`Duplicated appearance name "${h}" for layer "${o}"`))}else s.add(h)}),a}}}))}function e8({key:r,value:a}){return i.$(a)?[]:[new eW(r,a,`string expected, ${i.J(a)} found`)]}let e9={promoteId:function r({key:a,value:n}){if(i.$(n))return e8({key:a,value:n});if(Array.isArray(n)){let r=[],o=i.S(n),s=i.U(o);return"error"===s.result?s.value.forEach(i=>
8{r.push(new eW(`${a}${i.key}`,null,`${i.message}`))}):i.W(s.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"])||r.push(new eW(`${a}`,null,"promoteId expression should be only feature dependent")),r}if(!i.G(n))return[new eW(a,n,`string, expression or object expected, "${i.J(n)}" found`)];let o=[];for(let i in n)o.push(...r({key:`${a}.${i}`,value:n[i]}));return o}};function e7(r){let a=r.value,n=r.key,o=r.styleSpec,s=r.style;if(!i.G(a))return[new eW(n,a,`object expected, ${i.J(a)} found`)];if(!("type"in a))return[new eW(n,a,'"type" is required')];let l=i.H(a.type),h=[];switch(["vector","raster","raster-dem","raster-array"].includes(l)&&("url"in a||"tiles"in a||h.push(new eX(n,a,'Either "url" or "tiles" is required.'))),l){case"vector":case"raster":case"raster-dem":case"raster-array":return h.concat(tl({key:n,value:a,valueSpec:o[`source_${l.replace("-","_")}`],style:r.style,styleSpec:o,objectElementValidators:e9}));case"geojson":if(h=tl({key:n,value:a,valueSpec:o.source_geojson,style:s,styleSpec:o,objectElementValidators:e9}),"cluster"in a&&"clusterProperties"in a){if(!i.G(a.clusterProperties))return[new eW(`${n}.clusterProperties`,a,`object expected, ${i.J(a)} found`)];for(let i in a.clusterProperties){let r=a.clusterProperties[i];if(!Array.isArray(r))return[new eW(`${n}.clusterProperties.${i}`,r,"array expected")];let[o,s]=r,l="string"==typeof o?[o,["accumulated"],["get",i]]:o;h.push(...eQ({key:`${n}.${i}.map`,value:s,expressionContext:"cluster-map"})),h.push(...eQ({key:`${n}.${i}.reduce`,value:l,expressionContext:"cluster-reduce"}))}}return h;case"video":return tl({key:n,value:a,valueSpec:o.source_video,style:s,styleSpec:o});case"image":return tl({key:n,value:a,valueSpec:o.source_image,style:s,styleSpec:o});case"canvas":return[new eW(n,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:var u;return e0({key:`${n}.type`,value:a.type,valueSpec:{values:(u=o).source.reduce((i,r)=>{let a=u[r];return"enum"===a.type.type&&(i=i.concat(Object.keys(a.type.values||{}))),i},[])}})}}function te(i,r){let a=!i.includes("://");try{return new URL(i,a&&r?"http://example.com":void 0),!0}catch(i){return!1}}function tt(r){let a=r.value;return a?i.$(a)?te(a,!0)?[]:[new eW(r.key,a,`invalid url "${a}"`)]:[new eW(r.key,a,`string expected, "${i.J(a)}" found`)]:[]}function ti(r){let a=r.value,n=r.styleSpec,o=n.light,s=r.style;if(void 0===a)return[];if(!i.G(a))return[new eW("light",a,`object expected, ${i.J(a)} found`)];let l=[];for(let r in a){let h=r.match(i.a3),u=r.match(i.a2);l=l.concat(u&&o[u[1]]?ts({key:r,value:a[r],valueSpec:{type:"string"},style:s,styleSpec:n}):h&&o[h[1]]&&o[h[1]].transition?ts({key:r,value:a[r],valueSpec:n.transition,style:s,styleSpec:n}):o[r]?ts({key:r,value:a[r],valueSpec:o[r],style:s,styleSpec:n}):[new eW(r,a[r],`unknown property "${r}"`)])}return l}function tr(r){let a=r.value;if(!a)return[];let n=r.key;if(!i.G(a))return[new eW(n,a,`object expected, ${i.J(a)} found`)];let o=[],s=r.styleSpec,l=s["light-3d"],h=r.style,u=r.style.lights;for(let i of["type","id"])if(!(i in a))return o.concat([new eW(n,a,`missing property "${i}"`)]);if(!i.$(a.type))return o.concat([new eW(`${n}.type`,a.type,"string expected")]);if(u)for(let s=0;s<r.arrayIndex;s++){let r=i.H(a.type),l=u[s];i.H(l.type)===r&&o.push(new eW(n,a.id,`duplicate light type "${a.type}", previously defined at line ${l.id.__line__}`))}let c=`properties_light_${a.type}`;if(!(c in s))return o.concat([new eW(`${n}.type`,a,`Invalid light type ${a.type}`)]);let d=s[c];for(let n in a)if("properties"===n){let l=a[n];if(!i.G(l))return o.concat([new eW("properties",l,`object expected, ${i.J(l)} found`)]);for(let u in l){let c=u.match(i.a3),p=u.match(i.a2);o=o.concat(p&&d[p[1]]?ts({key:n,value:l[u],valueSpec:{type:"string"},style:h,styleSpec:s}):c&&d[c[1]]&&d[c[1]].transition?ts({key:n,value:a[n],valueSpec:s.transition,style:h,styleSpec:s}):d[u]?ts({key:u,value:l[u],valueSpec:d[u],style:h,styleSpec:s}
8):[new eX(r.key,l[u],`unknown property "${u}"`)])}}else o=o.concat(l[n]?ts({key:n,value:a[n],valueSpec:l[n],style:h,styleSpec:s}):[new eX(n,a[n],`unknown property "${n}"`)]);return o}function ta(r){let a=r.value,n=r.key,o=r.style,s=r.styleSpec,l=s.terrain;if(null==a)return[];if(!i.G(a))return[new eW("terrain",a,`object expected, ${i.J(a)} found`)];let h=[];for(let r in a){let n=r.match(i.a3),u=r.match(i.a2);h=h.concat(u&&l[u[1]]?ts({key:r,value:a[r],valueSpec:{type:"string"},style:o,styleSpec:s}):n&&l[n[1]]&&l[n[1]].transition?ts({key:r,value:a[r],valueSpec:s.transition,style:o,styleSpec:s}):l[r]?ts({key:r,value:a[r],valueSpec:l[r],style:o,styleSpec:s}):[new eX(r,a[r],`unknown property "${r}"`)])}if(a.source)if(i.$(a.source)){let r=o.sources&&o.sources[a.source],s=r&&i.H(r.type);r?"raster-dem"!==s&&h.push(new eW(`${n}.source`,a.source,`terrain cannot be used with a source of type ${s}, it only be used with a "raster-dem" source type`)):h.push(new eW(`${n}.source`,a.source,`source "${a.source}" not found`))}else h.push(new eW(`${n}.source`,a.source,"source must be a string"));else h.push(new eW(n,a,'terrain is missing required property "source"'));return h}function tn(r){let a=r.value,n=r.style,o=r.styleSpec,s=o.fog;if(void 0===a)return[];if(!i.G(a))return[new eW("fog",a,`object expected, ${i.J(a)} found`)];let l=[];for(let r in a){let h=r.match(i.a3),u=r.match(i.a2);l=l.concat(u&&s[u[1]]?ts({key:r,value:a[r],valueSpec:{type:"string"},style:n,styleSpec:o}):h&&s[h[1]]&&s[h[1]].transition?ts({key:r,value:a[r],valueSpec:o.transition,style:n,styleSpec:o}):s[r]?ts({key:r,value:a[r],valueSpec:s[r],style:n,styleSpec:o}):[new eX(r,a[r],`unknown property "${r}"`)])}return l}let to={"*":()=>[],array:eY,boolean:function(r){let a=r.value,n=r.key;return i._(a)?[]:[new eW(n,a,`boolean expected, ${i.J(a)} found`)]},number:eJ,color:function({key:r,value:a}){return i.$(a)?null===i.a0.parseCSSColor(a)?[new eW(r,a,`color expected, "${a}" found`)]:[]:[new eW(r,a,`color expected, ${i.J(a)} found`)]},enum:e0,filter:e1,function:eK,layer:e6,object:tl,source:e7,model:tt,light:ti,"light-3d":tr,terrain:ta,fog:tn,string:e8,formatted:function(i){return 0===e8(i).length?[]:eQ(i)},resolvedImage:function(i){return 0===e8(i).length?[]:eQ(i)},projection:function(r){let a=r.value,n=r.styleSpec,o=n.projection,s=r.style;if(i.G(a)){let i=[];for(let r in a)i=i.concat(ts({key:r,value:a[r],valueSpec:o[r],style:s,styleSpec:n}));return i}return i.$(a)?[]:[new eW("projection",a,`object or string expected, ${i.J(a)} found`)]},import:function(r){let a=r.key,{value:n,styleSpec:o}=r;if(!i.G(n))return[new eW(a,n,"import must be an object")];let{data:s,...l}=n;Object.defineProperty(l,"__line__",{value:n.__line__,enumerable:!1});let h=tl(Object.assign({},r,{value:l,valueSpec:o.import}));return""===i.H(l.id)&&h.push(new eW(`${r.key}.id`,l,"import id can't be an empty string")),s&&(h=h.concat(tu(s,o,{key:`${r.key}.data`}))),h},iconset:function(r){let a=r.value,n=r.key,o=r.styleSpec,s=r.style;if(!i.G(a))return[new eW(n,a,"object expected")];if(!a.type)return[new eW(n,a,'"type" is required')];let l=i.H(a.type),h=[];if(h=h.concat(tl({key:n,value:a,valueSpec:o[`iconset_${l}`],style:s,styleSpec:o})),!("source"!==l||!a.source)){let r=s.sources&&s.sources[a.source],o=r&&i.H(r.type);r?"raster-array"!==o&&h.push(new eW(n,a.source,`iconset cannot be used with a source of type ${String(o)}, it only be used with a "raster-array" source type`)):h.push(new eW(n,a.source,`source "${a.source}" not found`))}return h}};function ts(r,a=!1){let n=r.value,o=r.valueSpec,s=r.styleSpec;if(o.expression){if(i.a4(i.H(n)))return eK(r);if(i.Q(i.S(n)))return eQ(r)}if(o.type&&to[o.type]){let i=to[o.type](r);return!0===a&&i.length>0&&Array.isArray(r.value)?eQ(r):i}return tl(Object.assign({},r,{valueSpec:o.type?s[o.type]:o}))}function tl(r){let a=r.key,n=r.value,o=r.valueSpec||{},s=r.objectElementValidators||{},l=r.style,h=r.styleSpec;if(!i.G(n))return[new eW(a,n,`object expected, ${i.J(n)} found`)];let u=[];for(let i in n){let r,c=i.split(".")[0];s[c]?r=s[c]:o[c]?r=ts:s["*"]?r=s["*"]:o["*"]&&(r=ts),r?u=u.concat(r({key:(a?`${a}.`:a)+i,value:n[i],valueSpec:o[c]||o["*"],style:l,styleSpec:h,object:n,objectKey:i},n)):u.push(new eX(a,n[i],`unknown property "${i}"`))}for(let i in o){if(s[i])continue;let r=o[i];r.required&&void 0===r.default&&void 0===n[i]&&u.push(new eW(a,n,`missing required property "${i}"`))}return u}function th({key:i,value:r}){let a=e8({key:i,value:r});return a.length||(r.includes("{fontstack}")||a.push(new eW(i,r,'"glyphs" url must include a "{fontstack}" token')),r.includes("{range}")||a.push(new eW(i,r,'"glyphs" url must include a "{range}" token'))),a}function tu(r,a=i.a6,n={}){return tl({key:n.key||"",value:r,valueSpec:Object.assign({},a.$root,{"*":{type:"*"}}),styleSpec:a,style:r,objectElementValidators:{glyphs:th}})}function tc(r,a=i.a6){return tS(tu(r,a))}let td=i=>tS(e7(i)),tp=i=>tS(ti(i)),tf=i=>tS(tr(i)),tm=i=>tS(ta(i)),t_=i=>tS(tn(i)),tg=r=>tS(function(r){let a=r.value,n=r.style,o=r.styleSpec,s=o.snow;if(void 0===a)return[];if(!i.G(a))return[new eW("snow",a,`object expected, ${i.J(a)} found`)];let l=[];for(let r in a){let h=r.match(i.a3);
8l=l.concat(h&&s[h[1]]&&s[h[1]].transition?ts({key:r,value:a[r],valueSpec:o.transition,style:n,styleSpec:o}):s[r]?ts({key:r,value:a[r],valueSpec:s[r],style:n,styleSpec:o}):[new eX(r,a[r],`unknown property "${r}"`)])}return l}(r)),ty=r=>tS(function(r){let a=r.value,n=r.style,o=r.styleSpec,s=o.rain;if(void 0===a)return[];if(!i.G(a))return[new eW("rain",a,`object expected, ${i.J(a)} found`)];let l=[];for(let r in a){let h=r.match(i.a3);l=l.concat(h&&s[h[1]]&&s[h[1]].transition?ts({key:r,value:a[r],valueSpec:o.transition,style:n,styleSpec:o}):s[r]?ts({key:r,value:a[r],valueSpec:s[r],style:n,styleSpec:o}):[new eX(r,a[r],`unknown property "${r}"`)])}return l}(r)),tx=i=>tS(e6(i)),tv=i=>tS(e1(i)),tb=i=>tS(e5(i)),tw=i=>tS(e4(i)),tT=i=>tS(tt(i));function tS(i){return i.slice().sort((i,r)=>i.line&&r.line?i.line-r.line:0)}function tE(r,a){let n=!1;if(a&&a.length)for(let o of a)o instanceof eX?i.w(o.message):(r.fire(new i.y(Error(o.message))),n=!0);return n}let tI=i.a6.light;class tA extends i.E{constructor(r,n="flat"){super(),this._transitionable=new i.a7(a||(a=new i.a8({anchor:new i.a9(tI.anchor),position:new i.aa(tI.position),color:new i.a9(tI.color),intensity:new i.a9(tI.intensity)}))),this.setLight(r,n),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(i,r,a={}){this._validate(tp,i,a)||(this._transitionable.setTransitionOrValue(i),this.id=r)}updateTransitions(i){this._transitioning=this._transitionable.transitioned(i,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(i){this.properties=this._transitioning.possiblyEvaluate(i)}_validate(r,a,n){return(!n||!1!==n.validate)&&tE(this,r.call(tc,Object.assign({value:a,style:{glyphs:!0,sprite:!0},styleSpec:i.a6})))}}let tM=i.a6.terrain,tC=class extends i.E{constructor(r,a,n,o,s){super(),this.scope=n,this._transitionable=new i.a7(new i.a8({source:new i.a9(tM.source),exaggeration:new i.a9(tM.exaggeration)}),n,o),this._transitionable.setTransitionOrValue(r,o),this._transitioning=this._transitionable.untransitioned(),this.drapeRenderMode=a,this.worldview=s}get(){return this._transitionable.serialize()}set(i,r){this._transitionable.setTransitionOrValue(i,r)}updateTransitions(i){this._transitioning=this._transitionable.transitioned(i,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(i){this.properties=this._transitioning.possiblyEvaluate(i)}getExaggeration(r){return this._transitioning.possiblyEvaluate(new i.ab(r,{worldview:this.worldview})).get("exaggeration")}getAttenuationRange(){if(!this.isZoomDependent())return null;let r=this._transitionable._values.exaggeration;if(!r)return null;let a=r.value.expression;if(!a)return null;let n=-1,o=-1,s=1;for(let r of a.zoomStops)(s=a.evaluate(new i.ab(r,{worldview:this.worldview})))>.01?(n=r,o=-1):o=r;return s<.01&&n>0&&o>n?[n,o]:null}isZoomDependent(){let r=this._transitionable._values.exaggeration;return null!=r&&null!=r.value&&null!=r.value.expression&&r.value.expression instanceof i.ac}};function tP(r,a,n){let o=i.ag(45,65,n),[s,l]=r.range,h=1-Math.min(1,Math.exp(-((a-s)/(l-s)*6)));return h*=h*h,(h=Math.min(1,1.00747*h))*o*r.alpha}function tD(r,a,n,o,s){let l=i.ae([],[a,n,o],s.mercatorFogMatrix);return tP(r,i.af(l),s.pitch)}function tR(r,a,n,o,s,l,h){let u=Number.MAX_VALUE,c=-Number.MAX_VALUE;for(let r of[[n,o,0],[s,o,0],[s,l,0],[n,l,0]]){let n=i.ae([],r,a),o=i.af(n);u=Math.min(u,o),c=Math.max(c,o)}return[tP(r,u,h.pitch),tP(r,c,h.pitch)]}let tz=i.a6.fog;class tL extends i.E{constructor(r,a,n,o){super();let s=new i.a8({range:new i.a9(tz.range),color:new i.a9(tz.color),"color-use-theme":new i.a9({type:"string","property-type":"data-constant",default:"default"}),"high-color":new i.a9(tz["high-color"]),"high-color-use-theme":new i.a9({type:"string","property-type":"data-constant",default:"default"}),"space-color":new i.a9(tz["space-color"]),"space-color-use-theme":new i.a9({type:"string","property-type":"data-constant",default:"default"}),"horizon-blend":new i.a9(tz["horizon-blend"]),"star-intensity":new i.a9(tz["star-intensity"]),"vertical-range":new i.a9(tz["vertical-range"])});this._transitionable=new i.a7(s,n,o),this.set(r,o),this._transitioning=this._transitionable.untransitioned(),this._transform=a,this.properties=new i.ah(s),this.scope=n}get state(){let r=this._transform,a="globe"===r.projection.name,n=i.ai(r.zoom),o=this.properties.get("range"),s=.5/Math.tan(.5*r._fov),l=[o[0]+s,o[1]+s];return{range:a?[i.aj(2,l[0],n),i.aj(4.5,l[1],n)]:l,horizonBlend:this.properties.get("horizon-blend"),alpha:this.properties.get("color").a}}get(){return this._transitionable.serialize()}set(i,r,a={}
8){if(this._validate(t_,i,a))return;let n=Object.assign({},i);for(let i of Object.keys(tz))void 0===n[i]&&(n[i]=tz[i].default);this._options=n,this._transitionable.setTransitionOrValue(this._options,r)}getOpacity(r){if(!this._transform.projection.supportsFog)return 0;let a=this.properties&&this.properties.get("color")||1;return("globe"===this._transform.projection.name?1:i.ag(45,65,r))*a.a}getOpacityAtLatLng(r,a){return this._transform.projection.supportsFog?function(r,a,n){let o=i.ad.fromLngLat(a),s=n.elevation?n.elevation.getAtPointOrZero(o):0;return tD(r,o.x,o.y,s,n)}(this.state,r,a):0}getOpacityForTile(r){if(!this._transform.projection.supportsFog)return[1,1];let a=this._transform.calculateFogTileMatrix(r.toUnwrapped());return tR(this.state,a,0,0,i.ak,i.ak,this._transform)}getOpacityForBounds(i,r,a,n,o){return this._transform.projection.supportsFog?tR(this.state,i,r,a,n,o,this._transform):[1,1]}getRangeForProjection(){return this._transform.projection.supportsFog?this.state.range:[0,1]}isVisibleOnFrustum(r){if(!this._transform.projection.supportsFog)return!1;for(let a of[4,5,6,7]){let n,o=r.points[a];if(o[2]>=0)n=o;else{let s=r.points[a-4];n=i.al(s,o,s[2]/(s[2]-o[2]))}if(tD(this.state,n[0],n[1],0,this._transform)>=.05)return!0}return!1}updateConfig(i){this._transitionable.setTransitionOrValue(this._options,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(r,a,n){return(!n||!1!==n.validate)&&tE(this,r.call(tc,Object.assign({value:a,style:{glyphs:!0,sprite:!0},styleSpec:i.a6})))}}let tF,tO,tB=class extends i.E{constructor(r,a,n,o){super();let s=tF||(tF=new i.a8({density:new i.a9(i.a6.snow.density),intensity:new i.a9(i.a6.snow.intensity),color:new i.a9(i.a6.snow.color),opacity:new i.a9(i.a6.snow.opacity),vignette:new i.a9(i.a6.snow.vignette),"vignette-color":new i.a9(i.a6.snow["vignette-color"]),"center-thinning":new i.a9(i.a6.snow["center-thinning"]),direction:new i.a9(i.a6.snow.direction),"flake-size":new i.a9(i.a6.snow["flake-size"])}));this._transitionable=new i.a7(s,n,o),this.set(r,o),this._transitioning=this._transitionable.untransitioned(),this.properties=new i.ah(s),this.scope=n}get state(){let r=this.properties.get("opacity"),a=this.properties.get("color"),n=this.properties.get("direction"),o=i.am(n[0]),s=-Math.max(i.am(n[1]),.01),l=[Math.cos(o)*Math.cos(s),Math.sin(o)*Math.cos(s),Math.sin(s)],h=this.properties.get("vignette"),u=this.properties.get("vignette-color");return u.a=h,{density:this.properties.get("density"),intensity:this.properties.get("intensity"),color:new i.C(a.r,a.g,a.b,a.a*r),direction:l,centerThinning:this.properties.get("center-thinning"),flakeSize:this.properties.get("flake-size"),vignetteColor:u}}get(){return this._transitionable.serialize()}set(r,a,n={}){if(this._validate(tg,r,n))return;let o=Object.assign({},r),s=i.a6.snow;for(let i of Object.keys(s))void 0===o[i]&&(o[i]=s[i].default);this._options=o,this._transitionable.setTransitionOrValue(this._options,a)}updateConfig(i){this._transitionable.setTransitionOrValue(this._options,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(r,a,n){return(!n||!1!==n.validate)&&tE(this,r.call(tc,Object.assign({value:a,style:{glyphs:!0,sprite:!0},styleSpec:i.a6})))}},tk=class extends i.E{constructor(r,a,n,o){super();let s=tO||(tO=new i.a8({density:new i.a9(i.a6.rain.density),intensity:new i.a9(i.a6.rain.intensity),color:new i.a9(i.a6.rain.color),opacity:new i.a9(i.a6.rain.opacity),vignette:new i.a9(i.a6.rain.vignette),"vignette-color":new i.a9(i.a6.rain["vignette-color"]),"center-thinning":new i.a9(i.a6.rain["center-thinning"]),direction:new i.a9(i.a6.rain.direction),"droplet-size":new i.a9(i.a6.rain["droplet-size"]),"distortion-strength":new i.a9(i.a6.rain["distortion-strength"])}));this._transitionable=new i.a7(s,n,o),this.set(r,o),this._transitioning=this._transitionable.untransitioned(),this.properties=new i.ah(s),this.scope=n}get state(){let r=this.properties.get("opacity"),a=this.properties.get("color"),n=this.properties.get("direction"),o=i.am(n[0]),s=-Math.max(i.am(n[1]),.01),l=[Math.cos(o)*Math.cos(s),Math.sin(o)*Math.cos(s),Math.sin(s)],h=this.properties.get("vignette-color");return h.a=this.properties.get("vignette"),{density:this.properties.get("density"),intensity:this.properties.get("intensity"),color:new i.C(a.r,a.g,a.b,a.a*r),direction:l,centerThinning:this.properties.get("center-thinning"),droplet
8Size:this.properties.get("droplet-size"),distortionStrength:this.properties.get("distortion-strength"),vignetteColor:h}}get(){return this._transitionable.serialize()}set(r,a,n={}){if(this._validate(ty,r,n))return;let o=Object.assign({},r),s=i.a6.rain;for(let i of Object.keys(s))void 0===o[i]&&(o[i]=s[i].default);this._options=o,this._transitionable.setTransitionOrValue(this._options,a)}updateConfig(i){this._transitionable.setTransitionOrValue(this._options,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(r,a,n){return(!n||!1!==n.validate)&&tE(this,r.call(tc,Object.assign({value:a,style:{glyphs:!0,sprite:!0},styleSpec:i.a6})))}},tN={workerUrl:"",workerClass:null,workerParams:void 0},tU="mapboxgl_preloaded_worker_pool";class tV{constructor(i){this.active={},this.name=i}acquire(i,r=tV.workerCount){if(!this.workers)for(this.workers=[];this.workers.length<r;){var a;let r=(a=`${this.name||""}WorkerPool: ${i}-${this.workers.length}`,null!=tN.workerClass?new tN.workerClass:new self.Worker(tN.workerUrl,Object.assign({name:a},tN.workerParams)));this.workers.push(r)}return this.active[i]=!0,this.workers.slice()}release(i){delete this.active[i],this.workers&&0===this.numActive()&&(this.workers.forEach(i=>{i.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[tU]}numActive(){return Object.keys(this.active).length}}tV.workerCount=2;class tj{constructor(r,a,n="Worker",o=tV.workerCount){this.workerPool=r,this.actors=[],this.currentActor=0,this.id=i.an();let s=this.workerPool.acquire(this.id,o);for(let i=0;i<s.length;i++){let r=new tj.Actor(s[i],a,this.id);r.name=`${n} ${i}`,this.actors.push(r)}this.ready=!1,this.broadcast("checkIfReady",null,()=>{this.ready=!0})}broadcast(r,a,n){i.ao(this.actors,(i,n)=>{i.send(r,a,n)},n=n||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)}}tj.Actor=i.ap;class tG extends i.E{constructor(r,a,n,o){super(),this.scope=n,this._options=r,this.properties=new i.ah(a),this._transitionable=new i.a7(a,n,o),this._transitionable.setTransitionOrValue(r.properties),this._transitioning=this._transitionable.untransitioned()}updateConfig(i){this._transitionable.setTransitionOrValue(this._options.properties,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,r){this._options=i,this._transitionable.setTransitionOrValue(i.properties,r)}shadowsEnabled(){return!!this.properties&&!0===this.properties.get("cast-shadows")}}let tH=()=>n||(n=new i.a8({color:new i.a9(i.a6.properties_light_ambient.color),"color-use-theme":new i.a9({type:"string",default:"default","property-type":"data-constant"}),intensity:new i.a9(i.a6.properties_light_ambient.intensity)})),t$=()=>o||(o=new i.a8({direction:new i.aq(i.a6.properties_light_directional.direction),color:new i.a9(i.a6.properties_light_directional.color),"color-use-theme":new i.a9({type:"string",default:"default","property-type":"data-constant"}),intensity:new i.a9(i.a6.properties_light_directional.intensity),"cast-shadows":new i.a9(i.a6.properties_light_directional["cast-shadows"]),"shadow-quality":new i.a9(i.a6.properties_light_directional["shadow-quality"]),"shadow-intensity":new i.a9(i.a6.properties_light_directional["shadow-intensity"]),"shadow-draw-before-layer":new i.a9(i.a6.properties_light_directional["shadow-draw-before-layer"])}));class tq{constructor(i,r,a){this.screenBounds=i,this.cameraPoint=a.getCameraPoint(),this._screenRaycastCache={},this._cameraRaycastCache={},this.isAboveHorizon=r,this.screenGeometry=this.bufferedScreenGeometry(0),this.screenGeometryMercator=this._bufferedScreenMercator(0,a)}static createFromScreenPoints(r,a){let n,o;
8if(r instanceof i.P||"number"==typeof r[0]){let s=i.P.convert(r);n=[s],o=a.isPointAboveHorizon(s)}else{let s=i.P.convert(r[0]),l=i.P.convert(r[1]),h=s.add(l)._div(2);n=[s,l],o=i.ar(s,l).every(i=>a.isPointAboveHorizon(i))&&a.isPointAboveHorizon(h)}return new tq(n,o,a)}isPointQuery(){return 1===this.screenBounds.length}bufferedScreenGeometry(r){return i.ar(this.screenBounds[0],1===this.screenBounds.length?this.screenBounds[0]:this.screenBounds[1],r)}bufferedCameraGeometry(r){let a=this.screenBounds[0],n=1===this.screenBounds.length?this.screenBounds[0].add(new i.P(1,1)):this.screenBounds[1],o=i.ar(a,n,0,!1);return this.cameraPoint.y>n.y&&(this.cameraPoint.x>a.x&&this.cameraPoint.x<n.x?o.splice(3,0,this.cameraPoint):this.cameraPoint.x>=n.x?o[2]=this.cameraPoint:this.cameraPoint.x<=a.x&&(o[3]=this.cameraPoint)),i.as(o,r)}bufferedCameraGeometryGlobe(r){let a=this.screenBounds[0],n=1===this.screenBounds.length?this.screenBounds[0].add(new i.P(1,1)):this.screenBounds[1],o=i.ar(a,n,r),s=this.cameraPoint.clone(),l=Number(s.x>a.x)+Number(s.x>n.x);switch(3*(Number(s.y>a.y)+Number(s.y>n.y))+l){case 0:o[0]=s,o[4]=s.clone();break;case 1:o.splice(1,0,s);break;case 2:o[1]=s;break;case 3:o.splice(4,0,s);break;case 5:o.splice(2,0,s);break;case 6:o[3]=s;break;case 7:o.splice(3,0,s);break;case 8:o[2]=s}return o}containsTile(r,a,n,o=0){var s;let l=Math.max(r.queryPadding,r.evaluateQueryRenderedFeaturePadding())/a._pixelsPerMercatorPixel+1,h=n?this._bufferedCameraMercator(l,a):this._bufferedScreenMercator(l,a),u=r.tileID.wrap+(h.unwrapped?o:0),c=h.polygon.map(a=>i.at(r.tileTransform,a,u));if(!i.au(c,0,0,i.ak,i.ak))return;u=r.tileID.wrap+(this.screenGeometryMercator.unwrapped?o:0);let d=this.screenGeometryMercator.polygon.map(a=>i.av(r.tileTransform,a,u)),p=d.map(r=>new i.P(r[0],r[1])),f=a.getFreeCameraOptions().position||new i.ad(0,0,0),m=i.av(r.tileTransform,f,u),_=d.map(r=>{let a=i.aw(r,r,m);return i.ax(a,a),new i.ay(m,a)}),g=i.az(r,1,a.zoom)*a._pixelsPerMercatorPixel;return{queryGeometry:this,tilespaceGeometry:p,tilespaceRays:_,bufferedTilespaceGeometry:c,bufferedTilespaceBounds:((s=i.aA(c)).min.x=i.aB(s.min.x,0,i.ak),s.min.y=i.aB(s.min.y,0,i.ak),s.max.x=i.aB(s.max.x,0,i.ak),s.max.y=i.aB(s.max.y,0,i.ak),s),tile:r,tileID:r.tileID,pixelToTileUnitsFactor:g}}_bufferedScreenMercator(i,r){let a=100*i|0;if(this._screenRaycastCache[a])return this._screenRaycastCache[a];{let n;return n="globe"===r.projection.name?this._projectAndResample(this.bufferedScreenGeometry(i),r):{polygon:this.bufferedScreenGeometry(i).map(i=>r.pointCoordinate3D(i)),unwrapped:!0},this._screenRaycastCache[a]=n,n}}_bufferedCameraMercator(i,r){let a=100*i|0;if(this._cameraRaycastCache[a])return this._cameraRaycastCache[a];{let n;return n="globe"===r.projection.name?this._projectAndResample(this.bufferedCameraGeometryGlobe(i),r):{polygon:this.bufferedCameraGeometry(i).map(i=>r.pointCoordinate3D(i)),unwrapped:!0},this._cameraRaycastCache[a]=n,n}}_projectAndResample(r,a){let n=function(r,a){let n=i.aC([],a.pixelMatrix,a.globeMatrix),o=[0,-i.aE,0,1],s=[0,i.aE,0,1],l=[0,0,0,1];i.aD(o,o,n),i.aD(s,s,n),i.aD(l,l,n);let h=new i.P(o[0]/o[3],o[1]/o[3]),u=new i.P(s[0]/s[3],s[1]/s[3]),c=i.aF(r,h)&&o[3]<l[3],d=i.aF(r,u)&&s[3]<l[3];if(!c&&!d)return null;let p=function(i,r,a){for(let n=1;n<i.length;n++){let o=tW(r.pointCoordinate3D(i[n-1]).x),s=tW(r.pointCoordinate3D(i[n]).x);if(a<0){if(o<s)return{idx:n,t:-o/(s-1-o)}}else if(s<o)return{idx:n,t:(1-o)/(s+1-o)}}return null}(r,a,c?-1:1);if(!p)return null;let{idx:f,t:m}=p,_=f>1?tZ(r.slice(0,f),a):[],g=f<r.length?tZ(r.slice(f),a):[];_=_.map(r=>new i.P(tW(r.x),r.y)),g=g.map(r=>new i.P(tW(r.x),r.y));let y=[..._];0===y.length&&y.push(g.at(-1));let x=y.at(-1),v=i.aj(x.y,(0===g.length?_[0]:g[0]).y,m);return y.push(...c?[new i.P(0,v),new i.P(0,0),new i.P(1,0),new i.P(1,v)]:[new i.P(1,v),new i.P(1,1),new i.P(0,1),new i.P(0,v)]),0===g.length?y.push(_[0]):y.push(...g),{polygon:y.map(r=>new i.ad(r.x,r.y)),unwrapped:!1}}(r,a);if(n)return n;let o=function(r,a){let n=!1,o=-1/0,s=0;for(let i=0;i<r.length-1;i++)r[i].x>o&&(o=r[i].x,s=i);for(let i=0;i<r.length-1;i++){let a=(s+i)%(r.length-1),o=r[a],l=r[a+1];Math.abs(o.x-l.x)>.5&&(o.x<l.x?(o.x+=1,0===a&&(r.at(-1).x+=1)):(l.x+=1,a+1===r.length-1&&(r[0].x+=1)),n=!0)}let l=i.aG(a.center.lng);return n&&l<Math.abs(l-1)&&r.forEach(i=>
8{i.x-=1}),{polygon:r,unwrapped:n}}(tZ(r,a).map(r=>new i.P(tW(r.x),r.y)),a);return{polygon:o.polygon.map(r=>new i.ad(r.x,r.y)),unwrapped:o.unwrapped}}}function tZ(r,a){return i.aH(r,i=>{let r=a.pointCoordinate3D(i);i.x=r.x,i.y=r.y},1/256)}function tW(i){return i<0?1+i%1:i%1}function tX(r,a){let n=Math.pow(2,a.z),o=Math.floor(i.aG(r.getWest())*n),s=Math.floor(i.aJ(r.getNorth())*n),l=Math.ceil(i.aG(r.getEast())*n),h=Math.ceil(i.aJ(r.getSouth())*n);return a.x>=o&&a.x<l&&a.y>=s&&a.y<h}class tY{constructor(r,a,n){this.bounds=r?i.aI.convert(this.validateBounds(r)):null,this.minzoom=a||0,this.maxzoom=n||24}validateBounds(i){return Array.isArray(i)&&4===i.length?[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(r){if(r)for(let a of(this.extraBounds||(this.extraBounds=[]),r))this.extraBounds.push(i.aI.convert(this.validateBounds(a)))}contains(i){if(i.z>this.maxzoom||i.z<this.minzoom||this.bounds&&!tX(this.bounds,i))return!1;if(!this.extraBounds)return!0;for(let r of this.extraBounds)if(tX(r,i))return!0;return!1}static fromTileJSON(i){if(!i.bounds&&!i.extra_bounds)return null;let r=new tY(i.bounds,i.minzoom,i.maxzoom);return r.addExtraBounds(i.extra_bounds),r}}class tJ extends i.E{constructor(r,a,n,o){if(super(),this.id=r,this.dispatcher=n,this.type="vector",this.provider=a.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,i.aK(a,["url","scheme","tileSize","promoteId"])),this._options=Object.assign({type:"vector"},a),this._collectResourceTiming=!!a.collectResourceTiming,512!==this.tileSize)throw Error("vector tile sources must have a tileSize of 512");this.setEventedParent(o),this._tileWorkers={},this._deduped=new i.aL}load(r){this._loaded=!1,this.fire(new i.z("dataloading",{dataType:"source"}));let a=Array.isArray(this.map._language)?this.map._language.join():this.map._language,n=this.map.getWorldview(),o=(o,s)=>{this._tileJSONRequest=null,this._loaded=!0,o?(a&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${a}`),n&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${n}`),this.fire(new i.y(o))):s&&(this._setTileJSON(s),q(s.tiles,this.map._requestManager._customAccessToken),this.fire(new i.z("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new i.z("data",{dataType:"source",sourceDataType:"content"}))),r&&r(o)};this.provider=this._options.provider;let s=i.aM(this._options);return s instanceof Error?(this._loaded=!0,this.fire(new i.y(s)),void(r&&r())):this.provider&&!s?(this._loaded=!0,this.fire(new i.y(Error(`TileProvider "${this.provider}" is not registered`))),void(r&&r())):void(this._tileJSONRequest=s?this.loadTileJSONWithProvider(s,o):i.aN(this._options,this.map._requestManager,a,n,o))}loadTileJSONWithProvider(r,a){this.provider=r.name;let{request:n,options:o}=i.aO(this._options,this.map._requestManager),s=new AbortController;return this.dispatcher.broadcast("loadTileProvider",{name:r.name,url:r.url,source:this.id,scope:this.scope,type:this.type,options:o,request:n},(r,n)=>{if(s.signal.aborted)return;if(r)return void a(r);let o=n?n.find(i=>null!=i):null,l=i.aP(this._options,o,this.map._requestManager);l instanceof Error?a(l):a(null,l)}),{cancel:()=>s.abort()}}_setTileJSON(i){if(Object.assign(this,i),this.hasWorldviews=!!i.worldview_options,i.worldview_default&&(this.worldviewDefault=i.worldview_default),i.vector_layers)for(let r of(this.vectorLayers=i.vector_layers,this.vectorLayerIds=[],this.localizableLayerIds=new Set,i.vector_layers))this.vectorLayerIds.push(r.id),i.worldview&&i.worldview[r.source]&&this.localizableLayerIds.add(r.id);this.tileBounds=tY.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();let r=i.t(this.id,this.scope);this.load(()=>this.map.style.clearSource(r))}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(r,a){let n=r.tileID.canonical.url(this.tiles,this.scheme),o=this.map._requestManager.normalizeTileURL(n),s=this.map._requestManager.transformRequest(o,i.R.Tile),l=this.map.style?this.map.style.getLut(this.scope):null,h=l?{image:l.image.clone()}:null,u={request:s,data:void 0,uid:r.uid,tileID:r.tileID,tileZoom:r.tileZoom,zoom:r.tileID.overscaledZ,maxZoom:this.maxzoom,lut:h,tileSize:this.tileSize*r.tileID.overscaleFactor(),type:this.t
8ype,source:this.id,scope:this.scope,pixelRatio:i.o.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,showElevationIdDebug:!!this.map.painter&&this.map.painter._debugParams.showElevationIdDebug,promoteId:this.promoteId,renderSourceType:r.renderSourceType,brightness:this.map.style&&this.map.style.getBrightness()||0,extraShadowCaster:r.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&&i.e(n)&&(u.localizableLayerIds=this.localizableLayerIds),u.request.collectResourceTiming=this._collectResourceTiming,r.actor&&"expired"!==r.state)"loading"===r.state?r.reloadCallback=a:r.request=r.actor.send("reloadTile",u,c.bind(this));else if(r.actor=this._tileWorkers[o]=this._tileWorkers[o]||this.dispatcher.getActor(),this.dispatcher.ready||this.provider)r.request=r.actor.send("loadTile",u,c.bind(this),void 0,!0);else{let a=i.aQ.call({deduped:this._deduped},u,(a,n)=>{if(a||!n)c.call(this,a);else{let a=i.aR(n.responseHeaders);u.data={rawData:n.rawData.slice(0),expires:a.expires,cacheControl:a.cacheControl},r.actor&&r.actor.send("loadTile",u,c.bind(this),void 0,!0)}},!0);r.request={cancel:a}}function c(n,o){return delete r.request,r.aborted?a(null):n?a(n):(o&&o.resourceTiming&&(r.resourceTiming=o.resourceTiming),this.map._refreshExpiredTiles&&o&&r.setExpiryData(o),r.loadVectorData(o,this.map.painter),i.aS(this.dispatcher),a(null,o),void(r.reloadCallback&&(this.loadTile(r,r.reloadCallback),r.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,r){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 tK extends i.E{constructor(r,a,n,o){super(),this.id=r,this.dispatcher=n,this.setEventedParent(o),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"},a),Object.assign(this,i.aK(a,["url","scheme","tileSize"]))}load(r){this._loaded=!1,this.fire(new i.z("dataloading",{dataType:"source"}));let a=this.map.getWorldview(),n=(a,n)=>{this._tileJSONRequest=null,this._loaded=!0,a?this.fire(new i.y(a)):n&&(Object.assign(this,n),n.raster_layers&&(this.rasterLayers=n.raster_layers,this.rasterLayerIds=this.rasterLayers.map(i=>i.id)),this.tileBounds=tY.fromTileJSON(n),q(n.tiles),this.fire(new i.z("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new i.z("data",{dataType:"source",sourceDataType:"content"}))),r&&r(a)};this.provider="string"==typeof this._options.provider?this._options.provider:void 0,this._tileProvider=void 0;let o=i.aM(this._options);return o instanceof Error?(this._loaded=!0,this.fire(new i.y(o)),void(r&&r())):this.provider&&!o?(this._loaded=!0,this.fire(new i.y(Error(`TileProvider "${this.provider}" is not registered`))),void(r&&r())):void(this._tileJSONRequest=o?this.loadTileJSONWithProvider(o,n):i.aN(this._options,this.map._requestManager,null,a,n))}loadTileJSONWithProvider(r,a){this.provider=r.name;let{request:n,options:o}=i.aO(this._options,this.map._requestManager),s=new AbortController;return i.aT(r.name,r.url).then(i=>{if(s.signal.aborted)return;let r=new i(o);return r.load&&n?r.load({request:n}).then(i=>(this._tileProvider=r,i)):(this._tileProvider=r,null)}).then(r=>{if(s.signal.aborted)return;let n=i.aP(this._options,r,this.map._requestManager);n instanceof Error?a(n):a(null,n)}).catch(i=>{s.signal.aborted||a(i instanceof Error?i:Error(String(i)))}),{cancel:()=>s.abort()}}loaded(){return this._loaded}onAdd(i){this.map=i,this.load()}reload(){this.cancelTileJSONRequest();let r=i.t(this.id,this.scope);this.load(()=>this.map.style.clearSource(r))}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(r,a){let n=i.o.devicePixelRatio>=2,o=this.map._requestManager.normalizeTileURL(r.tileID.canonical.url(this.tiles,this.scheme),n,this.tileSize),s=this.map._requestManager.transformRequest(o,i.R.Tile);if(this._tileProvider){let i=new AbortController;r.request={cancel:()=>i.abort()},this.loadTileWithProvider(r,this._tileProvider,s,i,a)}else r.request=i.n(s,(n,o,s)=>{if(delete r.request,r.aborted)return r.state="unloaded",a(null);if(n)return r.state="errored",a(n);if(!o)return a(null);let l=i.aR(s);this.map._refreshExpiredTiles&&r.setExpiryData(l),r.setTexture(o,this.map.painter),r.state="loaded",i.aS(this.dispatcher),a(null)})}async loadTileWithProvider(i,r,a,n,o){let{z:s,x:l,y:h}=i.tileID.canonical;try{let u=await r.loadTile({z:s,x:l,y:h},{request:a,signal:n.signal});if(n.signal.aborted)return i.state="unloaded",o(null);if(null==u){let r=Error("Tile not found");return r.status=404,i.state="errored",o(r)}if(null==u.data)return i.state="loaded",o(null);let c=await createImageBitmap(new Blob([u.data]));if(n.signal.aborted)return i.state="unloaded",o(null);i.setTexture(c,this.map.painter),i.state="loaded",this.map._refreshExpiredTiles&&i.setExpiryData({cacheControl:u.cacheControl,expires:u.expires}),o(null)}catch(r){if(n.signal.aborted||r instanceof DOMException&&"AbortError"===r.name)return i.state="unloaded",o(null);i.state="errored",o(r instanceof Error?r:Error(String(r)))}finally{delete i.request}}abortTile(i,r){i.request&&(i.request.cancel(),delete i.request),r&&r()}unloadTile(r,a){r.texture&&r.texture instanceof i.T?(r.destroy(!1),r.texture&&r.texture instanceof i.T&&this.map.painter.saveTileTexture(r.texture)):r.destroy(),a&&a()}hasTransition(){return!1}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}class tQ extends tK{constructor(i,r,a,n){super(i,r,a,n),this.type="raster-array",this.maxzoom=22,this.partial=!0,this._loadTilePending={},this._loadTileLoaded={},this._options=Object.assign({type:"raster-array"},r)}triggerRepaint(i){let r=this.map.painter._terrain,a=this.map.style.getSourceCache(this.id
8);r&&r.enabled&&a&&r._clearRenderCacheForTile(a.id,i.tileID),this.map.triggerRepaint()}loadTile(r,a){let n=this.map._requestManager.normalizeTileURL(r.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize),o=this.map._requestManager.transformRequest(n,i.R.Tile),s={request:o,uid:r.uid,tileID:r.tileID,type:this.type,source:this.id,scope:this.scope,partial:this.partial};r.source=this.id,r.scope=this.scope,r.requestParams=o,r.actor||(r.actor=this.dispatcher.getActor());let l=(n,o,s)=>{if(delete r.request,r.aborted)return r.state="unloaded",a(null);if(n){if("AbortError"===n.name)return;return r.state="errored",a(n)}if(this.map._refreshExpiredTiles&&o){let a=i.aR(s);r.setExpiryData(a)}if(this.partial&&"expired"!==r.state)r.state="empty";else if(!this.partial){if(!o)return a(null);r.state="loaded",r._isHeaderLoaded=!0,r._mrt=o}a(null)};r.request=this.partial?r.fetchHeader(void 0,l.bind(this)):r.actor.send("loadTile",s,l.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.t
8ype,source:this.id,scope:this.scope})}unloadTile(i,r){let a=i.texturePerLayer;if(i.flushAllQueues(),a.size)for(let r of(i.destroy(!1),a.values()))this.map.painter.saveTileTexture(r);else i.destroy()}prepareTile(r,a,n,o){r._isHeaderLoaded&&("empty"!==r.state&&(r.state="reloading"),r.fetchBandForRender(a,n,o,(a,o)=>{a?(r.state="errored",this.fire(new i.y(a))):o&&(r._isHeaderLoaded=!0,r.setTexturePerLayer(n,o,this.map.painter),r.state="loaded"),this.triggerRepaint(r)}))}getInitialBand(i){if(!this.rasterLayers)return 0;let r=this.rasterLayers.find(({id:r})=>r===i),a=r&&r.fields,n=a&&a.bands&&a.bands;return n?n[0]:0}getTextureDescriptor(r,a,n){if(!r)return;let o=a.sourceLayer||this.rasterLayerIds&&this.rasterLayerIds[0];if(!o)return;let s=null;a instanceof i.aV?s=a.paint.get("raster-array-band"):a instanceof i.aW&&(s=a.paint.get("raster-particle-array-band"));let l=s||this.getInitialBand(o);return null==l?void 0:r.textureDescriptorPerLayer.get(a.id)?!r.updateNeeded(a.id,l)||n?Object.assign({},r.textureDescriptorPerLayer.get(a.id),{texture:r.texturePerLayer.get(a.id)}):void 0:void this.prepareTile(r,o,a.id,l)}getImages(r,a){let n=new Map;for(let o of r)for(let r of a){let[a,s]=r.split("/"),l=o.getLayer(a);if(!l||!l.hasBand(s)||!l.hasDataForBand(s))continue;let{bytes:h,tileSize:u,buffer:c}=l.getBandView(s),d=u+2*c,p={data:new i.q({width:d,height:d},h),pixelRatio:2,sdf:!1,usvg:!1,version:0};n.set(r,p)}return n}queryRasterArrayValueByBandId(r,a,n){let o=a._mrt;return new Promise(s=>{let l={},h=new Set;for(let[u,c]of Object.entries(o.layers)){if(n.layerName&&u!==n.layerName)continue;let d={};for(let{bands:p}of(l[u]=d,c.dataIndex))for(let f of p)n.bands&&!n.bands.includes(f)||(h.add(i.t(u,f)),a.fetchBand(u,null,f,a=>{i.o.frame(()=>{d[f]=a?null:function([r,a],n,o,{scaled:s=!0}={}){let{tileSize:l,buffer:h}=o,{x:u,y:c,z:d}=n;if(!isFinite(u)||!isFinite(c)||!isFinite(d))throw Error("Invalid MRT header");let p=2**d;return function([i,r],a,{scaled:n=!0}={}){if(!a)throw Error("bandView is undefined");let{data:o,tileSize:s,buffer:l,offset:h,scale:u,dimension:c}=a;if(i<-l||i>s+l||r<-l||r>s+l)throw Error(`Point (${i}, ${r}) out of bounds for tileSize=${s}, buffer=${l}`);let d=(r+l)*(s+2*l)+(i+l);if(0xffffffff===new Uint32Array(o.buffer)[d])return null;let p=[];p=n?[]:new(0,a.data.constructor)(c);for(let i=0;i<c;i++)p[i]=Math.round(1e12*(o[c*d+i]*u+h))/1e12;return p}([Math.min(Math.max(-h,Math.floor((p*i.aG(r)-u)*l)),l-1+h),Math.min(Math.max(-h,Math.floor((p*i.aJ(a)-c)*l)),l-1+h)],o,{scaled:s})}([r.lng,r.lat],o,c.getBandView(f)),h.delete(i.t(u,f)),0===h.size&&s(l)})},!1))}0===h.size&&s(l)})}_loadTileForQuery(r,a){if(this._loadTileLoaded[r.uid])return void a(null,r._mrt);if(this._loadTilePending[r.uid])return void this._loadTilePending[r.uid].push(a);this._loadTilePending[r.uid]=[a];let n=this.map._requestManager.normalizeTileURL(r.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize),o=this.map._requestManager.transformRequest(n,i.R.Tile);r.actor.send("loadTile",{request:o,uid:r.uid,tileID:r.tileID,type:this.t
8ype,source:this.id,scope:this.scope,partial:!1},(a,n,o)=>{if(a)return this._loadTilePending[r.uid].forEach(i=>i(a,null)),void delete this._loadTilePending[r.uid];if(!n)return this._loadTilePending[r.uid].forEach(i=>i(null,null)),void delete this._loadTilePending[r.uid];if(this.map._refreshExpiredTiles&&n){let a=i.aR(o);r.setExpiryData(a)}r._mrt=n,r._isHeaderLoaded=!0,r.state="loaded",this._loadTilePending[r.uid].forEach(i=>i(null,n)),this._loadTileLoaded[r.uid]=!0,delete this._loadTilePending[r.uid]},void 0,!0)}queryRasterArrayValueByAllBands(i,r,a){return new Promise((n,o)=>{this._loadTileForQuery(r,(s,l)=>{s?o(s):n(l?this.queryRasterArrayValueByBandId(i,r,a):null)})})}queryRasterArrayValue(r,a){let n=i.aX.convert(r),o=this.findLoadedParent(n);return o&&o._mrt?a.bands||!this.partial?this.queryRasterArrayValueByBandId(n,o,a):this.queryRasterArrayValueByAllBands(n,o,a):Promise.resolve(null)}findLoadedParent(r){let a=i.ad.fromLngLat(r,this.map.transform.tileSize),n=this.maxzoom+1,o=1<<n,s=Math.floor(a.x),l=Math.floor((a.x-s)*o),h=Math.floor(a.y*o),u=this.map.style.getSourceCache(this.id),c=new i.aU(n,s,n,l,h);return u.findLoadedParent(c,this.minzoom)}}let t0={vector:tJ,raster:tK,"raster-dem":class extends tK{constructor(i,r,a,n){super(i,r,a,n),this.type="raster-dem",this.maxzoom=22,this._options=Object.assign({type:"raster-dem"},r),this.encoding=r.encoding||"mapbox"}loadTileJSONWithProvider(r,a){this.provider=r.name;let{request:n,options:o}=i.aO(this._options,this.map._requestManager),s=new AbortController;return this.dispatcher.broadcast("loadTileProvider",{name:r.name,url:r.url,source:this.id,scope:this.scope,type:this.type,options:o,request:n},(r,n)=>{if(s.signal.aborted)return;if(r)return void a(r);let o=n?n.find(i=>null!=i):null,l=i.aP(this._options,o,this.map._requestManager);l instanceof Error?a(l):a(null,l)}),{cancel:()=>s.abort()}}loadTile(r,a){let n=this.map._requestManager.normalizeTileURL(r.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize),o=this.map._requestManager.transformRequest(n,i.R.Tile),s={uid:r.uid,tileID:r.tileID,source:this.id,type:this.t
8ype,scope:this.scope,request:o,encoding:this.encoding};r.actor&&"expired"!==r.state||(r.actor=this.dispatcher.getActor(),r.request=r.actor.send("loadTile",s,(function(i,n){return delete r.request,r.aborted?(r.state="unloaded",a(null)):i?(r.state="errored",a(i)):(n&&(this.map._refreshExpiredTiles&&r.setExpiryData(n),n.borderReady||r.neighboringTiles||(r.neighboringTiles=this._getNeighboringTiles(r.tileID)),r.dem=n.dem,r.dem.onDeserialize(),r.needsHillshadePrepare=!0,r.needsDEMTextureUpload=!0),r.state="loaded",void a(null))}).bind(this),void 0,!0))}abortTile(i,r){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}),r&&r()}_getNeighboringTiles(r){let a=r.canonical,n=Math.pow(2,a.z),o=(a.x-1+n)%n,s=0===a.x?r.wrap-1:r.wrap,l=(a.x+1+n)%n,h=a.x+1===n?r.wrap+1:r.wrap,u={};return u[new i.aU(r.overscaledZ,s,a.z,o,a.y).key]={backfilled:!1},u[new i.aU(r.overscaledZ,h,a.z,l,a.y).key]={backfilled:!1},a.y>0&&(u[new i.aU(r.overscaledZ,s,a.z,o,a.y-1).key]={backfilled:!1},u[new i.aU(r.overscaledZ,r.wrap,a.z,a.x,a.y-1).key]={backfilled:!1},u[new i.aU(r.overscaledZ,h,a.z,l,a.y-1).key]={backfilled:!1}),a.y+1<n&&(u[new i.aU(r.overscaledZ,s,a.z,o,a.y+1).key]={backfilled:!1},u[new i.aU(r.overscaledZ,r.wrap,a.z,a.x,a.y+1).key]={backfilled:!1},u[new i.aU(r.overscaledZ,h,a.z,l,a.y+1).key]={backfilled:!1}),u}},"raster-array":tQ,geojson:class extends i.E{constructor(r,a,n,o){super(),this.id=r,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._loaded=!1,this.actor=n.getActor(),this.setEventedParent(o),this._data=a.data,this._options=Object.assign({},a),this._collectResourceTiming=a.collectResourceTiming,void 0!==a.maxzoom&&(this.maxzoom=a.maxzoom),void 0!==a.minzoom&&(this.minzoom=a.minzoom),a.type&&(this.type=a.type),a.attribution&&(this.attribution=a.attribution),this.promoteId=a.promoteId;let s=i.ak/this.tileSize;this.workerOptions=Object.assign({source:this.id,scope:this.scope,cluster:a.cluster||!1,geojsonVtOptions:{buffer:(void 0!==a.buffer?a.buffer:128)*s,tolerance:(void 0!==a.tolerance?a.tolerance:.375)*s,extent:i.ak,maxZoom:this.maxzoom,lineMetrics:a.lineMetrics||!1,generateId:a.generateId||!1},superclusterOptions:{maxZoom:void 0!==a.clusterMaxZoom?a.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,a.clusterMinPoints||2),extent:i.ak,radius:(void 0!==a.clusterRadius?a.clusterRadius:50)*s,log:!1,generateId:a.generateId||!1},clusterProperties:a.clusterProperties,filter:a.filter,dynamic:a.dynamic},a.workerOptions)}onAdd(i){this.map=i,this.setData(this._data)}setData(i){return this._data=i,this._updateWorkerData(),this}updateData(r){if(!this._options.dynamic)return this.fire(new i.y(Error("Can't call updateData on a GeoJSON source with dynamic set to false.")));if("string"!=typeof r&&("Feature"===r.type&&(r={type:"FeatureCollection",features:[r]}),"FeatureCollection"!==r.type))return this.fire(new i.y(Error("Data to update should be a feature or a feature collection.")));if(this._coalesce&&"string"!=typeof r&&"string"!=typeof this._data&&"FeatureCollection"===this._data.type){let i=new Map;for(let r of this._data.features)i.set(r.id,r);for(let a of r.features)i.set(a.id,a);this._data.features=[...i.values()]}else this._data=r;return this._updateWorkerData(!0),this}getClusterExpansionZoom(i,r){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:i,source:this.id,scope:this.scope},r),this}getClusterChildren(i,r){return this.actor.send("geojson.getClusterChildren",{clusterId:i,source:this.id,scope:this.scope},r),this}getClusterLeaves(i,r,a,n){return this.actor.send("geojson.getClusterLeaves",{source:this.id,scope:this.scope,clusterId:i,limit:r,offset:a},n),this}_updateWorkerData(r=!1){if(this._pendingLoad)return void(this._coalesce=!0);this.fire(new i.z("dataloading",{dataType:"source"})),this._loaded=!1;let a=Object.assign({append:r},this.workerOptions);a.scope=this.scope;let n=this._data;"string"==typeof n?(a.request=this.map._requestManager.transformRequest(i.o.resolveURL(n),i.R.Source),a.request.collectResourceTiming=this._collectResourceTiming):a.data=JSON.stringify(n),this._pendingLoad=this.actor.send(`${this.type}.loadData`,a,(a,n)=>{if(this._loaded=!0,this._pendingLoad=null,a)this.fire(new i.y(a));else{let a={dataType:"source",sourceDataType:this._metadataFired?"content":"metadata"};this._collectResourceTiming&&n&&n.resourceTiming&&n.resourceTiming[this.id]&&(a.resourceTiming=n.resourceTiming[this.id]),r&&(this._partialReload=!0),this.fire(new i.z("data",a)),this._partialReload=!1,this._metadataFired=!0}this._coalesce&&(this._updateWorkerData(r),this._coalesce=!1)})}loaded(){return this._loaded}reload(){let r=i.t(this.id,this.scope);this.map.style.clearSource(r),this._updateWorkerData()}loadTile(r,a){let n=r.actor?"reloadTile":"loadTile";r.actor=this.actor;let o=this.map.style?this.map.style.getLut(this.scope):null,s=o?{image:o.image.clone()}
8:null,l=this._partialReload,h={type:this.type,uid:r.uid,tileID:r.tileID,tileZoom:r.tileZoom,zoom:r.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,lut:s,scope:this.scope,pixelRatio:i.o.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,showElevationIdDebug:!!this.map.painter&&this.map.painter._debugParams.showElevationIdDebug,promoteId:this.promoteId,brightness:this.map.style&&this.map.style.getBrightness()||0,extraShadowCaster:r.isExtraShadowCaster,scaleFactor:this.map.getScaleFactor(),partial:l,worldview:this.map.getWorldview(),indoor:this.map.getIndoorTileOptions(this.id,this.scope)};r.request=this.actor.send(n,h,(i,o)=>l&&!o?(r.state="loaded",a(null)):(delete r.request,r.destroy(!1),r.aborted?a(null):i?a(i):(r.loadVectorData(o,this.map.painter,"reloadTile"===n),a(null))),void 0,"loadTile"===n)}abortTile(i){i.request&&(i.request.cancel(),delete i.request),i.aborted=!0}unloadTile(i,r){this.actor.send("removeTile",{uid:i.uid,type:this.type,source:this.id,scope:this.scope}),i.destroy()}onRemove(i){this._pendingLoad&&this._pendingLoad.cancel()}serialize(){return Object.assign({}
8,this._options,{type:this.type,data:this._data})}hasTransition(){return!1}},video:class extends i.aY{constructor(i,r,a,n){super(i,r,a,n),this.roundZoom=!0,this.type="video",this.options=r}load(){this._loaded=!1;let r=this.options;for(let a of(this.urls=[],r.urls))this.urls.push(this.map._requestManager.transformRequest(a,i.R.Source).url);i.aZ(this.urls,(r,a)=>{this._loaded=!0,r?this.fire(new i.y(r)):a&&(this.video=a,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(r){if(this.video){let a=this.video.seekable;r<a.start(0)||r>a.end(0)?this.fire(new i.y(new eW(`sources.${this.id}`,null,`Playback for this video can be set only between the ${a.start(0)} and ${a.end(0)}-second mark.`))):this.video.currentTime=r}}getVideo(){return this.video}onAdd(i){this.map||(this.map=i,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(0===Object.keys(this.tiles).length||this.video.readyState<2)return;let r=this.map.painter.context,a=r.gl;this.texture?this.video.paused||(this.texture.bind(a.LINEAR,a.CLAMP_TO_EDGE),a.texSubImage2D(a.TEXTURE_2D,0,0,0,a.RGBA,a.UNSIGNED_BYTE,this.video)):(this.texture=new i.T(r,this.video,a.RGBA8),this.texture.bind(a.LINEAR,a.CLAMP_TO_EDGE),this.width=this.video.videoWidth,this.height=this.video.videoHeight),this._prepareData(r)}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}},image:i.aY,model:i.a$,"batched-model":class extends i.E{constructor(i,r,a,n){super(),this.type="batched-model",this.id=i,this.tileSize=512,this._options=r,this.tiles=this._options.tiles,this.maxzoom=r.maxzoom||19,this.minzoom=r.minzoom||0,this.roundZoom=!0,this.usedInConflation=!0,this.dispatcher=a,this.reparseOverscaled=!1,this.scheme="xyz",this._loaded=!1,this.setEventedParent(n)}onAdd(i){this.map=i,this.load()}reload(){this.cancelTileJSONRequest();let r=i.t(this.id,this.scope);this.load(()=>this.map.style.clearSource(r))}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}load(r){this._loaded=!1,this.fire(new i.z("dataloading",{dataType:"source"}));let a=Array.isArray(this.map._language)?this.map._language.join():this.map._language,n=this.map.getWorldview();this._tileJSONRequest=i.aN(this._options,this.map._requestManager,a,n,(o,s)=>{this._tileJSONRequest=null,this._loaded=!0,o?(a&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${a}`),n&&2!==n.length&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${n}`),this.fire(new i.y(o))):s&&(Object.assign(this,s),s.bounds&&(this.tileBounds=new tY(s.bounds,this.minzoom,this.maxzoom)),q(s.tiles,this.map._requestManager._customAccessToken),this.fire(new i.z("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new i.z("data",{dataType:"source",sourceDataType:"content"}))),r&&r(o)})}hasTransition(){return!1}hasTile(i){return!this.tileBounds||this.tileBounds.contains(i.canonical)}loaded(){return this._loaded}loadTile(r,a){let n=this.map._requestManager.normalizeTileURL(r.tileID.canonical.url(this.tiles,this.scheme)),o={request:this.map._requestManager.transformRequest(n,i.R.Tile),data:void 0,uid:r.uid,tileID:r.tileID,tileZoom:r.tileZoom,zoom:r.tileID.overscaledZ,tileSize:this.tileSize*r.tileID.overscaleFactor(),type:this.t
8ype,source:this.id,scope:this.scope,showCollisionBoxes:this.map.showCollisionBoxes,renderSourceType:r.renderSourceType,brightness:this.map.style&&this.map.style.getBrightness()||0,pixelRatio:i.o.devicePixelRatio,promoteId:this.promoteId};if(r.actor&&"expired"!==r.state)if("loading"===r.state)r.reloadCallback=a;else{if(r.buckets){for(let i of Object.values(r.buckets))i.dirty=!0;return void(r.state="loaded")}r.request=r.actor.send("reloadTile",o,s.bind(this))}else r.actor=this.dispatcher.getActor(),r.request=r.actor.send("loadTile",o,s.bind(this),void 0,!0);function s(i,n){return r.aborted?a(null):i&&404!==i.status?a(i):(this.map._refreshExpiredTiles&&n&&r.setExpiryData(n),r.loadModelData(n,this.map.painter),r.state="loaded",void a(null))}}serialize(){return Object.assign({},this._options)}},canvas:class extends i.aY{constructor(r,a,n,o){super(r,a,n,o),a.coordinates?Array.isArray(a.coordinates)&&4===a.coordinates.length&&!a.coordinates.some(i=>!Array.isArray(i)||2!==i.length||i.some(i=>"number"!=typeof i))||this.fire(new i.y(new eW(`sources.${r}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new i.y(new eW(`sources.${r}`,null,'missing required property "coordinates"'))),a.animate&&"boolean"!=typeof a.animate&&this.fire(new i.y(new eW(`sources.${r}`,null,'optional "animate" property must be a boolean value'))),a.canvas?"string"==typeof a.canvas||a.canvas instanceof HTMLCanvasElement||this.fire(new i.y(new eW(`sources.${r}`,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 i.y(new eW(`sources.${r}`,null,'missing required property "canvas"'))),this.options=a,this.animate=void 0===a.animate||a.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 i.y(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(i){this.map=i,this.load(),this.canvas&&this.animate&&this.play()}onRemove(i){this.pause()}prepare(){let r=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,r=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,r=!0),this._hasInvalidDimensions()||0===Object.keys(this.tiles).length)return;let a=this.map.painter.context;this.texture?!r&&!this._playing||this.texture instanceof i.a_||this.texture.update(this.canvas,{premultiply:!0}):this.texture=new i.T(a,this.canvas,a.gl.RGBA8,{premultiply:!0}),this._prepareData(a)}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(let i of[this.canvas.width,this.canvas.height])if(isNaN(i)||i<=0)return!0;return!1}},custom:class extends i.E{constructor(r,a,n,o){super(),this.id=r,this.type="custom",this._dataType="raster",this._dispatcher=n,this._implementation=a,this.setEventedParent(o),this.scheme="xyz",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this._loaded=!1,this.roundZoom=!0,this._implementation||this.fire(new i.y(Error(`Missing implementation for ${this.id} custom source`))),this._implementation.loadTile||this.fire(new i.y(Error(`Missing loadTile implementation for ${this.id} custom source`))),this._implementation.bounds&&(this.tileBounds=new tY(this._implementation.bounds,this.minzoom,this.maxzoom)),a.update=this._update.bind(this),a.clearTiles=this._clearTiles.bind(this),a.coveringTiles=this._coveringTiles.bind(this),Object.assign(this,i.aK(a,["dataType","scheme","minzoom","maxzoom","tileSize","attribution","minTileCacheSize","maxTileCacheSize"]))}serialize(){return i.aK(this,["type","scheme","minzoom","maxzoom","tileSize","attribution"])}load(){this._loaded=!0,this.fire(new i.z("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new i.z("data",{dataType:"source",sourceDataType:"content"}))}loaded(){return this._loaded}onAdd(r){this.map=r,this._loaded=!1,this.fire(new i.z("dataloading",{dataType:"source"})),this._implementation.onAdd&&this._implementation.onAdd(r),this.load()}onRemove(i){this._implementation.onRemove&&this._implementation.onRemove(i)}hasTile(i){if(this._implementation.hasTile){let{x:r,y:a,z:n}=i.canonical;return this._implementation.hasTile({x:r,y:a,z:n})}
8return!this.tileBounds||this.tileBounds.contains(i.canonical)}loadTile(i,r){let{x:a,y:n,z:o}=i.tileID.canonical,s=new AbortController,l=Promise.resolve(this._implementation.loadTile({x:a,y:n,z:o},{signal:s.signal})).then((function(a){return delete i.request,i.aborted?(i.state="unloaded",r(null)):void 0===a?(i.state="errored",r(null)):null===a?(this.loadTileData(i,{width:this.tileSize,height:this.tileSize,data:null}),i.state="loaded",r(null)):a instanceof ImageData||a instanceof HTMLCanvasElement||a instanceof ImageBitmap||a instanceof HTMLImageElement?(this.loadTileData(i,a),i.state="loaded",void r(null)):(i.state="errored",r(Error(`Can't infer data type for ${this.id}, only raster data supported at the moment`)))}).bind(this)).catch(a=>{"AbortError"!==a.name&&(i.state="errored",r(a))});l.cancel=()=>s.abort(),i.request=l}loadTileData(i,r){i.setTexture(r,this.map.painter)}unloadTile(r,a){if(r.texture&&r.texture instanceof i.T?(r.destroy(!1),r.texture&&r.texture instanceof i.T&&this.map.painter.saveTileTexture(r.texture)):r.destroy(),this._implementation.unloadTile){let{x:i,y:a,z:n}=r.tileID.canonical;this._implementation.unloadTile({x:i,y:a,z:n})}a&&a()}abortTile(i,r){i.request&&i.request.cancel&&(i.request.cancel(),delete i.request),r&&r()}hasTransition(){return!1}_coveringTiles(){return this.map.transform.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,roundZoom:this.roundZoom}).map(i=>({x:i.canonical.x,y:i.canonical.y,z:i.canonical.z}))}_clearTiles(){let r=i.t(this.id,this.scope);this.map.style.clearSource(r)}_update(){this.fire(new i.z("data",{dataType:"source",sourceDataType:"content"}))}}},t1=function(r,a,n,o){let s=new t0[a.type](r,a,n,o);if(s.id!==r)throw Error(`Expected Source id to be ${r} instead of ${s.id}`);return i.b0(["load","abort","unload","serialize","prepare"],s),s};function t2(i,r,a=""){return`${a}:${r.id||""}:${r.layer.id}:${function(i){if("layerId"in i)return`layer:${i.layerId}`;{let{featuresetId:r,importId:a}=i;return`featureset:${r}${a?`:import:${a}`:""}`}}(i.target)}`}function t3(i,r,a,n=""){if(i.uniqueFeatureID){let o=t2(i,r,n);if(a.has(o))return!0;a.add(o)}return!1}function t5(i,r){let a=i.tileID,n=r.tileID;return a.overscaledZ-n.overscaledZ||a.canonical.y-n.canonical.y||a.wrap-n.wrap||a.canonical.x-n.canonical.x}i.b1.setPbf(i.b2);class t4 extends i.b3{constructor(i,r,a,n,o){super(i,r,a,n,o),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(r,a,n){let o=n.context,s=o.gl,l=this.texturePerLayer.get(r)||n.getTileTexture(a.width);l&&l instanceof i.T?l.update(a,{premultiply:!1}):l=new i.T(o,a,s.RGBA8,{premultiply:!1}),this.texturePerLayer.has(r)||this.texturePerLayer.set(r,l)}flushQueues(i){let r=this._workQueuePerLayer.get(i)||[],a=this._fetchQueuePerLayer.get(i)||[];for(;r.length;)r.pop()();for(;a.length;)a.pop()()}flushAllQueues(){for(let i of this._workQueuePerLayer.keys()){let r=this._workQueuePerLayer.get(i)||[];for(;r.length;)r.pop()()}for(let i of this._fetchQueuePerLayer.keys()){let r=this._fetchQueuePerLayer.get(i)||[];for(;r.length;)r.pop()()}}fetchHeader(r=16384,a){let n=this._mrt=new i.b1(30),o=Object.assign({},this.requestParams,{headers:{Range:"bytes=0-"+(r-1)}});return this.entireBuffer=null,this.request=i.b4(o,(i,o,s)=>{if(i)a(i);else try{let i=n.getHeaderLength(o);if(i>r)return void(this.request=this.fetchHeader(i,a));n.parseHeader(o),this._isHeaderLoaded=!0;let l=0;for(let i of Object.values(n.layers))l=Math.max(l,i.dataIndex.at(-1).lastByte);o.byteLength>=l&&(this.entireBuffer=o),a(null,this.entireBuffer||o,s)}catch(i){a(i)}}),this.request}fetchBandForRender(i,r,a,n){this.fetchBand(i,r,a,o=>{if(o)return void n(o);this.updateTextureDescriptor(i,r,a);let s=this.textureDescriptorPerLayer.get(r);n(null,s?s.img:null)})}fetchBand(r,a,n,o,s=!0){let l,h,u=this._mrt;if(!this._isHeaderLoaded||!u)return void o(Error("Tile header is not ready"));let c=this.actor;if(!c)return void o(Error("Can't fetch tile band without an actor"));let d=i.t(String(n),i.t(this.tileID.key,r)),p=this._taskQueue.get(d);p?p.add(o):((p=new Set).add(o),this._taskQueue.set(d,p));let f=(i,r)=>
8{l.complete(i,r),i?o(i):(p.forEach(i=>i(null,r)),this._taskQueue.delete(d))},m=(i,r)=>{if(i)return o(i);let n=c.send("decodeRasterArray",{type:"raster-array",source:this.source,scope:this.scope,tileID:this.tileID,uid:this.uid,buffer:r,task:l},f,void 0,!0);if(null!==a){let i=this._workQueuePerLayer.get(a)||[];i.push(()=>{n&&n.cancel(),l.cancel()}),this._workQueuePerLayer.has(a)||this._workQueuePerLayer.set(a,i)}};try{h=u.getLayer(r)}catch(i){if("reloading"===this.state)return;throw i}if(!h)return void o(Error(`Unknown sourceLayer "${r}"`));if(h.hasDataForBand(n))return p.forEach(i=>i(null,null)),void this._taskQueue.delete(d);let _=h.getDataRange([n]);if(!(l=u.createDecodingTask(_))||l.tasks.length)if(null!==a&&this.flushQueues(a),this.entireBuffer)m(null,this.entireBuffer.slice(_.firstByte,_.lastByte+1));else{let r=Object.assign({},this.requestParams,{headers:{Range:`bytes=${_.firstByte}-${_.lastByte}`}}),n=i.b4(r,m);if(null!==a){let i=this._fetchQueuePerLayer.get(a)||[];i.push(()=>{n.cancel(),l.cancel()}),this._fetchQueuePerLayer.has(a)||this._fetchQueuePerLayer.set(a,i)}}}updateNeeded(i,r){return(!this.textureDescriptorPerLayer.get(i)||this.textureDescriptorPerLayer.get(i).band!==r||this.refreshedUponExpiration)&&"errored"!==this.state}updateTextureDescriptor(r,a,n){if(!this._mrt)return;let o=this._mrt.getLayer(r);if(!o||!o.hasBand(n)||!o.hasDataForBand(n))return;let{bytes:s,tileSize:l,buffer:h,offset:u,scale:c}=o.getBandView(n),d=l+2*h,p=new i.q({width:d,height:d},s),f=this.texturePerLayer.get(a);f&&f instanceof i.T&&f.update(p,{premultiply:!1}),this.textureDescriptorPerLayer.set(a,{layer:r,band:n,img:p,buffer:h,offset:u,tileSize:l,format:o.pixelFormat,mix:[c,256*c,65536*c,0x1000000*c]})}destroy(r=!1){if(super.destroy(r),delete this._mrt,!r)for(let r of this.texturePerLayer.values())r&&r instanceof i.T&&r.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 t6{constructor(i,r){this.max=i,this.onRemove=r,this.reset()}reset(){for(let i in this.data)for(let r of this.data[i])r.timeout&&clearTimeout(r.timeout),this.onRemove(r.value);return this.data={},this.order=[],this}add(i,r,a){let n=i.wrapped().key;void 0===this.data[n]&&(this.data[n]=[]);let o={value:r,timeout:void 0};if(void 0!==a&&(o.timeout=setTimeout(()=>{this.remove(i,o)},a)),this.data[n].push(o),this.order.push(n),this.order.length>this.max){let i=this._getAndRemoveByKey(this.order[0]);i&&this.onRemove(i)}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){let r=this.data[i].shift();return r.timeout&&clearTimeout(r.timeout),0===this.data[i].length&&delete this.data[i],this.order.splice(this.order.indexOf(i),1),r.value}getByKey(i){let r=this.data[i];return r?r[0].value:null}get(i){return this.has(i)?this.data[i.wrapped().key][0].value:null}remove(i,r){if(!this.has(i))return this;let a=i.wrapped().key,n=void 0===r?0:this.data[a].indexOf(r),o=this.data[a][n];return this.data[a].splice(n,1),o.timeout&&clearTimeout(o.timeout),0===this.data[a].length&&delete this.data[a],this.onRemove(o.value),this.order.splice(this.order.indexOf(a),1),this}setMaxSize(i){for(this.max=i;this.order.length>this.max;){let i=this._getAndRemoveByKey(this.order[0]);i&&this.onRemove(i)}return this}filter(i){let r=[];for(let a in this.data)for(let n of this.data[a])i(n.value)||r.push(n);for(let i of r)this.remove(i.value.tileID,i)}}class t8{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(i,r,a){let n=String(r);if(this.stateChanges[i]=this.stateChanges[i]||{},this.stateChanges[i][n]=this.stateChanges[i][n]||{},Object.assign(this.stateChanges[i][n],a),null===this.deletedStates[i])for(let r in this.deletedStates[i]={},this.state[i])r!==n&&(this.deletedStates[i][r]=null);else if(this.deletedStates[i]&&null===this.deletedStates[i][n])for(let r in this.deletedStates[i][n]={},this.state[i][n])a[r]||(this.deletedStates[i][n][r]=null);else for(let r in a)this.deletedStates[i]&&this.deletedStates[i][n]&&null===this.deletedStates[i][n][r]&&delete this.deletedStates[i][n][r]}removeFeatureState(i,r,a){if(null===this.deletedStates[i])return;let n=String(r);if(this.deletedStates[i]=this.deletedStates[i]||{},a&&void 0!==r)null!==this.deletedStates[i][n]&&(this.deletedStates[i][n]=this.deletedStates[i][n]||{},this.deletedStates[i][n][a]=null);else if(void 0!==r)if(this.stateChanges[i]&&this.stateChanges[i][n])for(a in this.deletedStates[i][n]={},this.stateChanges[i][n])this.deletedStates[i][n][a]=null;else this.deletedStates[i][n]=null;else this.deletedStates[i]=null}getState(i,r){let a=this.state[i]||{},n=this.stateChanges[i]||{},o=this.deletedStates[i];if(null===o)return{};if(void 0!==r){let i=String(r),s=Object.assign({},a[i],n[i]);if(o){let i=o[r];if(null===i)return{};for(let r in i)delete s[r]}return s}let s=Object.assign({},a,n);if(o)for(let i in o)delete s[i];return s}initializeTileState(i,r){i.refreshFeatureState(r)}coalesceChanges(i,r){let a={};for(let i in this.stateChanges){this.state[i]=this.state[i]||{};let r={};for(let a in this.stateChanges[i])this.state[i][a]||(this.state[i][a]={}),Object.assign(this.state[i][a],this.stateChanges[i][a]),r[a]=this.state[i][a];a[i]=r}for(let i in this.deletedStates){this.state[i]=this.state[i]||{};let r={};
8if(null===this.deletedStates[i])for(let a in this.state[i])r[a]={},this.state[i][a]={};else for(let a in this.deletedStates[i]){if(null===this.deletedStates[i][a])this.state[i][a]={};else if(this.state[i][a])for(let r of Object.keys(this.deletedStates[i][a]))delete this.state[i][a][r];r[a]=this.state[i][a]}a[i]=a[i]||{},Object.assign(a[i],r)}if(this.stateChanges={},this.deletedStates={},0!==Object.keys(a).length)for(let n in i)i[n].refreshFeatureState(r,a)}}class t9 extends i.E{constructor(i,r,a){super(),this.id=i,this._renderSourceType=a,this._maxzoomOverride=null,r.on("data",i=>{"source"===i.dataType&&"metadata"===i.sourceDataType&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&"source"===i.dataType&&"content"===i.sourceDataType&&(this.reload(),this.transform&&this.update(this.transform))}),r.on("error",()=>{this._sourceErrored=!0}),this._source=r,this._tiles={},this._cache=new t6(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._minTileCacheSize=r.minTileCacheSize,this._maxTileCacheSize=r.maxTileCacheSize,this._loadedParentTiles={},this.castsShadows=!1,this.tileCoverLift=0,this._coveredTiles={},this._shadowCasterTiles={},this._state=new t8,this._isRaster="raster"===this._source.type||"raster-dem"===this._source.type||"raster-array"===this._source.type||"custom"===this._source.type&&"_dataType"in this._source&&"raster"===this._source._dataType,this._supportsFading="raster"===this._source.type||"raster-array"===this._source.type||"image"===this._source.type||"video"===this._source.type||"custom"===this._source.type,this._isRasterElevatedOverTerrain=!1}onAdd(i){this.map=i,this._minTileCacheSize=void 0===this._minTileCacheSize&&i?i._minTileCacheSize:this._minTileCacheSize,this._maxTileCacheSize=void 0===this._maxTileCacheSize&&i?i._maxTileC
8acheSize:this._maxTileCacheSize}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;for(let 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;let 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,r){return i.renderSourceType=this._renderSourceType,i.isExtraShadowCaster=this._shadowCasterTiles[i.tileID.key],this._source.loadTile(i,r)}_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){for(let r in this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null),this._tiles){let a=this._tiles[r];a.upload(i,this.map?this.map.painter:void 0),a.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(t7).map(i=>i.key)}getRenderableIds(r,a){let n=[];for(let i in this._tiles)this._isIdRenderable(+i,r,a)&&n.push(this._tiles[i]);return r?n.sort((r,a)=>{let n=r.tileID,o=a.tileID,s=new i.P(n.canonical.x,n.canonical.y)._rotate(this.transform.angle),l=new i.P(o.canonical.x,o.canonical.y)._rotate(this.transform.angle);return n.overscaledZ-o.overscaledZ||l.y-s.y||l.x-s.x}).map(i=>i.tileID.key):n.map(i=>i.tileID).sort(t7).map(i=>i.key)}hasRenderableParent(i){let r=this.findLoadedParent(i,0);return!!r&&this._isIdRenderable(r.tileID.key)}_isIdRenderable(i,r,a){return this._tiles[i]&&this._tiles[i].hasData()&&!this._coveredTiles[i]&&(r||!this._tiles[i].holdingForFade())&&(a||!this._shadowCasterTiles[i])}reload(){if(this._paused)this._shouldReloadOnResume=!0;else for(let i in this._cache.reset(),this._tiles)"errored"!==this._tiles[i].state&&this._reloadTile(+i,"reloading")}_reloadTile(i,r){let a=this._tiles[i];a&&("loading"!==a.state&&(a.state=r),this._loadTile(a,this._tileLoaded.bind(this,a,i,r)))}_tileLoaded(r,a,n,o,s){if(o){if(r.state="errored",i.b5(o)){if(this._source.fire(new i.z("data",{dataType:"source",sourceDataType:"error",sourceId:this._source.id,tile:r})),!(r.tileID.key in this._loadedParentTiles))return;if("raster-dem"===this._source.type&&this.usedForTerrain&&this.map.painter.terrain){let i=this.map.painter.terrain;this.update(this.transform,i.getScaledDemTileSize(),!0),i.resetTileLookupCache(this.id)}else this.update(this.transform)}else this._source.fire(new i.y(o,{tile:r}));return}r.timeAdded=i.o.now(),"expired"===n&&(r.refreshedUponExpiration=!0),this._setTileReloadTimer(a,r),"raster-dem"===this._source.type&&r.dem&&this._backfillDEM(r),this._state.initializeTileState(r,this.map?this.map.painter:null);let l=new Map;s&&s.responseHeaders&&(l=s.responseHeaders),this._source.fire(new i.z("data",{dataType:"source",tile:r,coord:r.tileID,sourceCacheId:this.id,responseHeaders:l}))}_hasTunnelGeometry(){for(let i in this._tiles){let r=this._tiles[i];if(r&&r.hasTunnelGeometry)return!0}return!1}_backfillDEM(i){let r=this.getRenderableIds();for(let n=0;n<r.length;n++){let o=r[n];if(i.neighboringTiles&&i.neighboringTiles[o]){let r=this.getTileByID(o);a(i,r),a(r,i)}}function a(i,r){if(!i.dem||i.dem.borderReady)return;i.needsHillshadePrepare=!0,i.needsDEMTextureUpload=!0;let a=r.tileID.canonical.x-i.tileID.canonical.x,n=r.tileID.canonical.y-i.tileID.canonical.y,o=Math.pow(2,i.tileID.canonical.z),s=r.tileID.key;0===a&&0===n||Math.abs(n)>1||(Math.abs(a)>1&&(1===Math.abs(a+o)?a+=o:1===Math.abs(a-o)&&(a-=o)),r.dem&&i.dem&&(i.dem.backfillBorder(r.dem,a,n),i.neighboringTiles&&i.neighboringTiles[s]&&(i.neighboringTiles[s].backfilled=!0)))}}getTile(i){return this.getTileByID(i.key)}getTileByID(i){return this._tiles[i]}_retainLoadedChildren(i,r,a,n){for(let o in this._tiles){let s=this._tiles[o];if(n[o]||!s.hasData()||s.tileID.overscaledZ<=r||s.tileID.overscaledZ>a)continue;let l=s.tileID;for(;s&&s.tileID.overscaledZ>
8r+1;){let i=s.tileID.scaledTo(s.tileID.overscaledZ-1);(s=this._tiles[i.key])&&s.hasData()&&(l=i)}let h=l;for(;h.overscaledZ>r;)if(i[(h=h.scaledTo(h.overscaledZ-1)).key]){n[l.key]=l;break}}}findLoadedParent(i,r){if(i.key in this._loadedParentTiles){let a=this._loadedParentTiles[i.key];return a&&a.tileID.overscaledZ>=r?a:null}for(let a=i.overscaledZ-1;a>=r;a--){let r=i.scaledTo(a),n=this._getLoadedTile(r);if(n)return n}}_getLoadedTile(i){let r=this._tiles[i.key];return r&&r.hasData()?r:this._cache.getByKey(this._source.reparseOverscaled?i.wrapped().key:i.canonical.key)}updateCacheSize(i,r){r=r||this._source.tileSize;let a=Math.floor((Math.ceil(i.width/r)+1)*(Math.ceil(i.height/r)+1)*5),n="number"==typeof this._minTileCacheSize?Math.max(this._minTileCacheSize,a):a,o="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,n):n;this._cache.setMaxSize(o)}handleWrapJump(i){let r=Math.round((i-(void 0===this._prevLng?i:this._prevLng))/360);if(this._prevLng=i,r){let i={};for(let a in this._tiles){let n=this._tiles[a];n.tileID=n.tileID.unwrapTo(n.tileID.wrap+r),i[n.tileID.key]=n}for(let r in this._tiles=i,this._timers)clearTimeout(this._timers[r]),delete this._timers[r];for(let i in this._tiles)this._setTileReloadTimer(+i,this._tiles[i])}}update(r,a,n,o,s){if(this.transform=r,!this._sourceLoaded||this._paused||this.transform.freezeTileCoverage||this.usedForTerrain&&!n)return;this.updateCacheSize(r,a),"globe"!==this.transform.projection.name&&this.handleWrapJump(this.transform.center.lng),this._shadowCasterTiles={},this._coveredTiles={};let l="batched-model"===this._source.type,h,u=this._source.maxzoom;null!==this._maxzoomOverride&&(u=Math.min(u,this._maxzoomOverride));let c=this.map&&this.map.painter?this.map.painter._terrain:null;if(c&&c.sourceCache===this&&c.attenuationRange()){let i=Math.floor(c.attenuationRange()[0])-Math.log2(c.getDemUpscale());u>i&&(u=i)}let d=null===this._maxzoomOverride&&this._source.reparseOverscaled;if(this.used||this.usedForTerrain){if(this._source.tileID)h=r.getVisibleUnwrappedCoordinates(this._source.tileID).map(r=>new i.aU(r.canonical.z,r.wrap,r.canonical.z,r.canonical.x,r.canonical.y));else if(0!==this.tileCoverLift){let o=r.clone();o.tileCoverLift=this.tileCoverLift,h=o.coveringTiles({tileSize:a||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:u,roundZoom:this._source.roundZoom&&!n,reparseOverscaled:d,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:l}),this._source.minzoom<=1&&"globe"===r.projection.name&&(h.push(new i.aU(1,0,1,0,0)),h.push(new i.aU(1,0,1,1,0)),h.push(new i.aU(1,0,1,0,1)),h.push(new i.aU(1,0,1,1,1)))}else if(h=r.coveringTiles({tileSize:a||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:u,roundZoom:this._source.roundZoom&&!n,reparseOverscaled:d,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:l}),this._source.hasTile){let i=this._source.hasTile.bind(this._source);h=h.filter(r=>i(r))}}else h=[];if(h.length>0&&"globe"!==this.transform.projection.name&&!this.usedForTerrain&&!this._supportsFading){let i=Math.min(r.coveringZoomLevel({tileSize:a||this._source.tileSize,roundZoom:this._source.roundZoom&&!n}),u);if(l)for(let a of r.extendTileCover(h,i))h.push(a);else if(s){let a=this.transform.getFrustum(i);for(let n of r.extendTileCoverToNearPlane(h,a,i))h.push(n);if(i>=18&&this._hasTunnelGeometry())for(let n of r.extendTileCoverForTunnels(h,a,i,20))h.push(n)}else if(this.castsShadows&&o)for(let a of r.extendTileCover(h,i,o,16))this._shadowCasterTiles[a.key]=!0,h.push(a)}let p=this._updateRetainedTiles(h);if(this._supportsFading&&0!==h.length){let r={},a={},n=i.o.now();for(let i of Object.keys(p)){let o=p[i],s=this._tiles[i];if(!s||void 0!==s.fadeEndTime&&s.fadeEndTime<=n)continue;let l=this.findLoadedParent(o,Math.max(o.overscaledZ-t9.maxOverzooming,this._source.minzoom));l&&(this._addTile(l.tileID),r[l.tileID.key]=l.tileID),a[i]=o}let o=h.at(-1).overscaledZ;for(let i in this._tiles){let r=this._tiles[i];if(p[i]||!r.hasData())continue;let n=r.tileID;for(;n.overscaledZ>o;){n=n.scaledTo(n.overscaledZ-1);let o=this._tiles[n.key];if(o&&o.hasData()&&a[n.key]){p[i]=r.tileID;break}}}for(let i in r)p[i]||(this._coveredTiles[i]=!0,p[i]=r[i])}for(let i in p)this._tiles[i].clearFadeHold();for(let r of i.b6(this._tiles,p)){let i=this._tiles[r];i.hasSymbolBuckets&&!i.holdingForFade()?i.setHoldDuration(this.map._fadeDuration):i.hasSymbolBuckets&&!i.symbolFadeFinished()||this._removeTile(+r)}this._updateLoadedParentTileCache(),this._renderSourceType===i.b7.Symbol&&this._source.afterUpdate&&this._source.afterUpdate()}releaseSymbolFadeTiles(){for(let i in this._tiles)this._tiles[i].holdingForFade()&&this._removeTile(+i)}_updateRetainedTiles(i){let r={};if(0===i.length)return r;let a={},n=i.reduce((i,r)=>
8Math.min(i,r.overscaledZ),1/0),o=i[0].overscaledZ,s=Math.max(o-t9.maxOverzooming,this._source.minzoom),l=Math.max(o+t9.maxUnderzooming,this._source.minzoom),h={};for(let a of i){let i=this._addTile(a);r[a.key]=a,i.hasData()||n<this._source.maxzoom&&(h[a.key]=a)}for(let o of(this._retainLoadedChildren(h,n,l,r),i)){let i=this._tiles[o.key];if(i.hasData())continue;if(o.canonical.z>=this._source.maxzoom){let i=o.children(this._source.maxzoom)[0],a=this.getTile(i);if(a&&a.hasData()){r[i.key]=i;continue}}else{let i=o.children(this._source.maxzoom);if(r[i[0].key]&&r[i[1].key]&&r[i[2].key]&&r[i[3].key])continue}let n=i.wasRequested();for(let l=o.overscaledZ-1;l>=s;--l){let s=o.scaledTo(l);if(a[s.key]||(a[s.key]=!0,(i=this.getTile(s))||!n||(i=this._addTile(s)),i&&(r[s.key]=s,n=i.wasRequested(),i.hasData())))break}}return r}_updateLoadedParentTileCache(){for(let i in this._loadedParentTiles={},this._tiles){let r=[],a,n=this._tiles[i].tileID;for(;n.overscaledZ>0;){if(n.key in this._loadedParentTiles){a=this._loadedParentTiles[n.key];break}r.push(n.key);let i=n.scaledTo(n.overscaledZ-1);if(a=this._getLoadedTile(i))break;n=i}for(let i of r)this._loadedParentTiles[i]=a}}_addTile(r){let a=this._tiles[r.key];if(a)return!0!==a.isExtraShadowCaster||this._shadowCasterTiles[r.key]||this._reloadTile(r.key,"reloading"),a;(a=this._cache.getAndRemove(r))&&(this._setTileReloadTimer(r.key,a),a.tileID=r,this._state.initializeTileState(a,this.map?this.map.painter:null),this._cacheTimers[r.key]&&(clearTimeout(this._cacheTimers[r.key]),delete this._cacheTimers[r.key],this._setTileReloadTimer(r.key,a)));let n=!!a;if(!n){let n=this.map?this.map.painter:null,o=this._source.tileSize*r.overscaleFactor();a="raster-array"===this._source.type?new t4(r,o,this.transform.tileZoom,n,this._isRaster):new i.b3(r,o,this.transform.tileZoom,n,this._isRaster,this._source.worldview),this._loadTile(a,this._tileLoaded.bind(this,a,r.key,a.state))}return a.uses++,this._tiles[r.key]=a,n||this._source.fire(new i.z("dataloading",{tile:a,coord:a.tileID,dataType:"source"})),a}_setTileReloadTimer(i,r){i in this._timers&&(clearTimeout(this._timers[i]),delete this._timers[i]);let a=r.getExpiryTimeout();a&&(this._timers[i]=setTimeout(()=>{this._reloadTile(i,"expired"),delete this._timers[i]},a))}_removeTile(i){let r=this._tiles[i];r&&(r.uses--,delete this._tiles[i],this._timers[i]&&(clearTimeout(this._timers[i]),delete this._timers[i]),r.uses>0||(r.hasData()&&"reloading"!==r.state||"empty"===r.state?this._cache.add(r.tileID,r,r.getExpiryTimeout()):(r.aborted=!0,this._abortTile(r),this._unloadTile(r))))}clearTiles(){for(let i in this._shouldReloadOnResume=!1,this._paused=!1,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(r,a,n){let o=[],s=this.transform;if(!s)return o;let l="globe"===s.projection.name,h=i.aG(s.center.lng);for(let u in this._tiles){let c,d=this._tiles[u];if(n&&d.clearQueryDebugViz(),!d.holdingForFade()){if(l){let r=d.tileID.canonical;if(0===r.z){let a=[Math.abs(i.aB(h,...ie(r,-1))-h),Math.abs(i.aB(h,...ie(r,1))-h)];c=[0,2*a.indexOf(Math.min(...a))-1]}else{let a=[Math.abs(i.aB(h,...ie(r,-1))-h),Math.abs(i.aB(h,...ie(r,0))-h),Math.abs(i.aB(h,...ie(r,1))-h)];c=[a.indexOf(Math.min(...a))-1]}}else c=[0];for(let i of c){let n=r.containsTile(d,s,a,i);n&&o.push(n)}}}return o}getShadowCasterCoordinates(){return this._getRenderableCoordinates(!1,!0)}getVisibleCoordinates(i){return this._getRenderableCoordinates(i)}_getRenderableCoordinates(i,r){let a=this.getRenderableIds(i,r).map(i=>this._tiles[i].tileID),n="globe"===this.transform.projection.name;for(let i of a)i.projMatrix=this.transform.calculateProjMatrix(i.toUnwrapped()),i.expandedProjMatrix=n?this.transform.calculateProjMatrix(i.toUnwrapped(),!1,!0):i.projMatrix;return a}sortCoordinatesByDistance(i){let r=i.slice(),a=this.transform._camera.position,n=this.transform._camera.forward(),o={};for(let i of r){let r=1/(1<<i.canonical.z);o[i.key]=((i.canonical.x+.5)*r+i.wrap-a[0])*n[0]+((i.canonical.y+.5)*r-a[1])*n[1]-a[2]*n[2]}return r.sort((i,r)=>o[i.key]-o[r.key]),r}hasTransition(){if(this._source.hasTransition())return!0;
8if(this._supportsFading){let r=i.o.now();for(let i in this._tiles){let a=this._tiles[i];if(void 0!==a.fadeEndTime&&a.fadeEndTime>=r)return!0}}return!1}setFeatureState(i,r,a){this._state.updateState(i=i||"_geojsonTileLayer",r,a)}removeFeatureState(i,r,a){this._state.removeFeatureState(i=i||"_geojsonTileLayer",r,a)}getFeatureState(i,r){return this._state.getState(i=i||"_geojsonTileLayer",r)}setDependencies(i,r,a){let n=this._tiles[i];n&&n.setDependencies(r,a)}reloadTilesForDependencies(i,r){for(let a in this._tiles)this._tiles[a].hasDependency(i,r)&&this._reloadTile(+a,"reloading");this._cache.filter(a=>!a.hasDependency(i,r))}_preloadTiles(r,a){if(!this._sourceLoaded){let i=()=>{this._sourceLoaded&&(this._source.off("data",i),this._preloadTiles(r,a))};return void this._source.on("data",i)}let n=new Map,o=Array.isArray(r)?r:[r],s=this.map.painter.terrain,l=this.usedForTerrain&&s?s.getScaledDemTileSize():this._source.tileSize;for(let i of o){for(let r of i.coveringTiles({tileSize:l,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!this.usedForTerrain,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain}))n.set(r.key,r);this.usedForTerrain&&i.updateElevation(!1)}let h=Array.from(n.values());i.ao(h,(r,a)=>{let n=new i.b3(r,this._source.tileSize*r.overscaleFactor(),this.transform.tileZoom,this.map.painter,this._isRaster,this._source.worldview);this._loadTile(n,i=>{"raster-dem"===this._source.type&&n.dem&&this._backfillDEM(n),a(i,n)})},a)}}function t7(i,r){let a=Math.abs(2*i.wrap)-(i.wrap<0),n=Math.abs(2*r.wrap)-(r.wrap<0);return i.overscaledZ-r.overscaledZ||n-a||r.canonical.y-i.canonical.y||r.canonical.x-i.canonical.x}function ie(i,r){let a=1<<i.z;return[i.x/a+r,(i.x+1)/a+r]}t9.maxOverzooming=10,t9.maxUnderzooming=3;class it{constructor(i){this.style=i,this.layersGotHidden=!1,this.layers=[]}processLayersChanged(){for(let i in this.layers=[],this.style._mergedLayers){let r=this.style._mergedLayers[i];if("fill-extrusion"===r.type||"building"===r.type)this.layers.push({layer:r,visible:!1,visibilityChanged:!1});else if("model"===r.type){let i=this.style.getLayerSource(r);i&&"batched-model"===i.type&&this.layers.push({layer:r,visible:!1,visibilityChanged:!1})}}}onNewFrame(i){for(let r of(this.layersGotHidden=!1,this.layers)){let a=r.layer,n=!1;"fill-extrusion"===a.type?n=!a.isHidden(i)&&a.paint.get("fill-extrusion-opacity")>0:"building"===a.type?n=!a.isHidden(i)&&a.paint.get("building-opacity")>0:"model"===a.type&&(n=!a.isHidden(i)&&a.paint.get("model-opacity").constantOr(1)>0),this.layersGotHidden=this.layersGotHidden||!n&&r.visible,r.visible=n}}updateZOffset(i,r){for(let i of(this.currentBuildingBuckets=[],this.layers)){let a=i.layer,n=this.style.getLayerSourceCache(a),o=1;"fill-extrusion"===a.type?o=i.visible?a.paint.get("fill-extrusion-vertical-scale"):0:"building"===a.type&&(o=i.visible?a.paint.get("building-vertical-scale"):0);let s=n?n.getTile(r):null;if(!s&&n)for(let i in n._tiles){let a=n._tiles[i];if(r.canonical.isChildOf(a.tileID.canonical)){s=a;break}}this.currentBuildingBuckets.push({bucket:s?s.getBucket(a):null,tileID:s?s.tileID:r,verticalScale:o})}i.hasAnyZOffset=!1;let a=!1;for(let n=0;n<i.symbolInstances.length;n++){let o=i.symbolInstances.get(n),s=o.zOffset,l=this._getHeightAtTileOffset(r,o.tileAnchorX,o.tileAnchorY);o.zOffset=l!==-1/0?l:s,a||s===o.zOffset||(a=!0),i.hasAnyZOffset||0===o.zOffset||(i.hasAnyZOffset=!0)}a&&(i.zOffsetBuffersNeedUpload=!0,i.zOffsetSortDirty=!0)}_mapCoordToOverlappingTile(r,a,n,o){let s=a,l=n;if(r.canonical.z!==o.canonical.z){let h=o.canonical,u=1/(1<<r.canonical.z-h.z);s=(a+r.canonical.x*i.ak)*u-h.x*i.ak|0,l=(n+r.canonical.y*i.ak)*u-h.y*i.ak|0}return{tileX:s,tileY:l}}_getHeightAtTileOffset(i,r,a){let n,o;for(let s=0;s<this.layers.length;++s){let l=this.layers[s].layer;if("fill-extrusion"!==l.type&&"building"!==l.type)continue;let{bucket:h,tileID:u,verticalScale:c}=this.currentBuildingBuckets[s];if(!h)continue;let{tileX:d,tileY:p}=this._mapCoordToOverlappingTile(i,r,a,u),f=h.getHeightAtTileCoord(d,p);f&&void 0!==f.height&&(f.hidden?n=f.height:o=Math.max(f.height*c,o||0))}if(void 0!==o)return o;for(let o=0;o<this.layers.length;++o){let s=this.layers[o];if("model"!==s.layer.type||!s.visible)continue;let{bucket:l,tileID:h}=this.currentBuildingBuckets[o];if(!l)continue;let{tileX:u,tileY:c}=this._mapCoordToOverlappingTile(i,r,a,h),d=l.getHeightAtTileCoord(u,c);if(d&&!d.hidden)return void 0===d.height&&void 0!==n?Math.min(d.maxHeight,n)*d.verticalScale:d.height?d.height*d.verticalScale:-1/0}return this.layersGotHidden?0:-1/0}}function ii(){return s||(s=new tV),s}function ir(r){r=r.slice();let a=Object.create(null);for(let i of r)a[i.id]=i;for(let n=0;n<r.length;n++){let o=r[n];if(o&&"ref"in o){let s=a[o.ref];
8s&&(r[n]=function(r,a){let n={};for(let i in r)"ref"!==i&&(n[i]=r[i]);return i.b8.forEach(i=>{i in a&&(n[i]=a[i])}),n}(o,s))}}return r}let ia={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 io(i,r,a){a.push({command:ia.addSource,args:[i,r[i]]})}function is(i,r,a){r.push({command:ia.removeSource,args:[i]}),a[i]=!0}function il(r,a,n,o,s,l){let h;for(h in a=a||{},r=r||{})Object.hasOwn(r,h)&&(i.b9(r[h],a[h])||n.push({command:l,args:[o,h,a[h],s]}));for(h in a)Object.hasOwn(a,h)&&!Object.hasOwn(r,h)&&(i.b9(r[h],a[h])||n.push({command:l,args:[o,h,a[h],s]}))}function ih(i){return i.id}function iu(i,r){return i[r.id]=r,i}function ic(r,a,n){let o=a.createTileMatrix(r,r.worldSize,n.toUnwrapped());return i.aC(new Float32Array(16),r.projMatrix,o)}function id(i,r,a){return r.name===a.projection.name?i.projMatrix:ic(a,r,i)}class ip{constructor(i,r){this.reset(i,r)}reset(i,r){this.points=i||[],this._distances=[0];for(let i=1;i<this.points.length;i++)this._distances[i]=this._distances[i-1]+this.points[i].dist(this.points[i-1]);this.length=this._distances.at(-1),this.padding=Math.min(r||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(r){if(1===this.points.length)return this.points[0];r=i.aB(r,0,1);let a=1,n=this._distances[a],o=r*this.paddedLength+this.padding;for(;n<o&&a<this._distances.length;)n=this._distances[++a];let s=a-1,l=this._distances[s],h=n-l,u=h>0?(o-l)/h:0;return this.points[s].mult(1-u).add(this.points[a].mult(u))}}let im=Math.tan(85*Math.PI/180);function i_(r,a,n,o,s,l,h){let u=i.bd();if(n)if("globe"===l.name){let r=i.be(s,a);i.aC(u,u,r)}else{let r=i.bf([],h);u[0]=r[0],u[1]=r[1],u[4]=r[2],u[5]=r[3],o||i.bc(u,u,s.angle)}else i.aC(u,s.labelPlaneMatrix,r);return u}function ig(i,r,a,n,o,s,l){let h=i_(i,r,a,n,o,s,l);return"globe"===s.name&&a||(h[2]=h[6]=h[10]=h[14]=0),h}function iy(r,a,n,o,s,l,h){if(n){if("globe"===l.name){let u=i_(r,a,n,o,s,l,h);return i.ba(u,u),i.aC(u,r,u),u}{let a=i.bb(r),[n,l,u,c]=h,[d,p,f,m,_,g,y,x]=a;return a[0]=n*d+l*_,a[1]=n*p+l*g,a[2]=n*f+l*y,a[3]=n*m+l*x,a[4]=u*d+c*_,a[5]=u*p+c*g,a[6]=u*f+c*y,a[7]=u*m+c*x,o||i.bc(a,a,-s.angle),a}}return s.glCoordMatrix}function ix(r,a,n,o){let s=[r,a,n,1];n?i.aD(s,s,o):iC(s,s,o);let l=s[3];return s[0]/=l,s[1]/=l,s[2]/=l,s}function iv(i,r){return Math.min(.5+i/r*.5,1.5)}function ib(r,a,n,o,s,l,h,u,c,d,p=1){let f=n.transform,m=o?r.textSizeData:r.iconSizeData,_=i.bl(m,n.transform.zoom,p),g="globe"===f.projection.name,y=[256/n.width*2+1,256/n.height*2+1],x=o?r.text.dynamicLayoutVertexArray:r.icon.dynamicLayoutVertexArray;x.clear();let v=null;g&&(v=o?r.text.globeExtVertexArray:r.icon.globeExtVertexArray);let b=r.lineVertexArray,w=o?r.text.placedSymbolArray:r.icon.placedSymbolArray,T=n.transform.width/n.transform.height,S,E=!1;for(let o=0;o<w.length;o++){let p=w.get(o),{numGlyphs:g,writingMode:I}=p;if(I!==i.bm.vertical||E||S===i.bm.horizontal||(E=!0),S=I,(p.hidden||I===i.bm.vertical)&&!E){iM(g,x);continue}E=!1;let A=new i.P(p.tileAnchorX,p.tileAnchorY),M="road"===r.elevationType,C=!!f.elevation||M,{x:P,y:D,z:R}=f.projection.projectTilePoint(A.x,A.y,d.canonical),z=null;if(C){let i=M?r.getElevationFeatureForText(o):null;z={getElevation:c,elevation:f.elevation,elevationFeature:i};let[a,n,s]=c(A,f.elevation,i);P+=a,D+=n,R+=s}let L=[P,D,R,1];if(i.aD(L,L,a),!function(i,r){let a=i[0]/i[3],n=i[1]/i[3];return a>=-r[0]&&a<=r[0]&&n>=-r[1]&&n<=r[1]}(L,y)){iM(g,x);continue}let F=L[3],O=iv(n.transform.getCameraToCenterDistance(f.projection),F),B=i.bn(m,_,p),k=h?B/O:B*O,N=ix(P,D,R,s);if(N[3]<=0){iM(g,x);continue}let U={},V=Math.cos(i.am(r.layers[0].layout.get("text-max-angle"))),j=h?null:z,G=iS(p,k,!1,u,a,s,l,r.glyphOffsetArray,b,x,v,N,A,U,T,j,f.projection,d,h,V);E=G.useVertical,j&&G.needsFlipping&&(U={}),(G.notEnoughRoom||E||G.needsFlipping&&iS(p,k,!0,u,a,s,l,r.glyphOffsetArray,b,x,v,N,A,U,T,j,f.projection,d,h,V).notEnoughRoom)&&iM(g,x)}o?(r.text.dynamicLayoutVertexBuffer.updateData(x),v&&r.text.globeExtVertexBuffer&&r.text.globeExtVertexBuffer.updateData(v)):(r.icon.dynamicLayoutVertexBuffer.updateData(x),v&&r.icon.globeExtVertexBuffer&&r.icon.globeExtVertexBuffer.updateData(v))}function iw(i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y){let{lineStartIndex:x,glyphStartIndex:v,segment:b}=h,w=v+h.numGlyphs,T=x+h.lineLength,S=r.getoffsetX(v),E=r.getoffsetX(w-1),I=iA(i*S,a,n,o,s,l,b,x,T,u,c,d,p,f,!0,m,_,g,y);if(!I)return null;let A=iA(i*E,a,n,o,s,l,b,x,T,u,c,d,p,f,!0,m,_,g,y);return A?{first:I,last:A}:null}function iT(r,a,n,o){return r===i.bm.horizontal&&Math.abs(o)>Math.abs(n)?{useVertical:!0}:r===i.bm.vertical?o>0?{needsFlipping:!0}:null:0!==a&&(0===n||Math.abs(o/n)>im)?1===a?{needsFlipping:!0}:null:n<0?{needsFlipping:!0}:null}function iS(r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w){let T=a/24,S=r.lineOffsetX*T,E=r.lineOffsetY*T,{lineStartIndex:I,glyphStartIndex:A,numGlyphs:M,segment:C,writingMode:P,flipState:D}=r,R=I+r.lineLength,z=r=>{if(p){let[a,n,o]=r.up,s=d.length;i.bo(p,s+0,a,n,o),i.bo(p,s+1,a,n,o),i.bo(p,s+2,a,n,o),i.bo(p,s+3,a,n,o)}let[a,n,o]=r.point;i.bp(d,a,n,o,r.angle)};if(M>1){let i=iw(T,u,S,E,n,f,m,r,c,l,_,y,!1,x,v,b,w);if(!i)return{notEnoughRoom:!0};if(o&&!n){let[a,n,o]=i.first.point,[s,l,u]=i.last.point;[a,n]=ix(a,n,o,h),[s,l]=ix(s,l,u,h);let c=iT(P,D,(s-a)*g,l-n);if(r.flipState=c&&c.needsFlipping?1:2,c)return c}z(i.first);for(let i=A+1;i<A+M-1;i++){let r=iA(T*u.getoffsetX(i),S,E,n,f,m,C,I,R,c,l,_,y,!1,!1,x,v,b,w);if(!r)return d.length-=4*(i-A),{notEnoughRoom:!0};z(r)}z(i.last)}else{if(o&&!n){let a=ix(m.x,m.y,0,s),n=I+C+1,o=new i.P(c.getx(n),c.gety(n)),l=ix(o.x,o.y,0,s),h=l[3]>0?l:iI(m,o,a,1,s,void 0,x,v.canonical),u=iT(P,D,(h[0]-a[0])*g,h[1]-a[1]);if(r.flipState=u&&u.needsFlipping?1:2,u)return u}let a=iA(T*u.getoffsetX(A),S,E,n,f,m,C,I,R,c,l,_,y,!1,!1,x,v,b,w);if(!a)return{notEnoughRoom:!0};z(a)}return{}}function iE(i,r,a,n,o){let{x:s,y:l,z:h}=n.projectTilePoint(i.x,i.y,r);if(!o)return ix(s,l,h,a);let[u,c,d]=o.getElevation(i,o.elevation,o.elevationFeature);return ix(s+u,l+c,h+d,a)}function iI(r,a,n,o,s,l,h,u){let c=iE(r.sub(a)._unit()._add(r),u,s,h,l);
8return i.aw(c,n,c),i.ax(c,c),i.bi(c,n,c,o)}function iA(r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b){let w=o?r-a:r+a,T=w>0?1:-1,S=0;o&&(T*=-1,S=Math.PI),T<0&&(S+=Math.PI);let E=u+h+(T>0?0:1)|0,I=s,A=s,M=0,C=0,P=Math.abs(w),D=[],R=[],z=l,L=z,F=i.bg([]),O=()=>iI(L,z,A,P-M+1,p,m,y,x.canonical);for(;M+C<=P;){if((E+=T)<u||E>=c)return null;if(A=I,L=z,D.push(A),_&&R.push(L),z=new i.P(d.getx(E),d.gety(E)),!(I=f[E])){let i=iE(z,x.canonical,p,y,m);I=i[3]>0?f[E]=i:O()}M+=C;let r=i.aw([],I,A),a=i.bh(A,I);if(n&&a>0&&C>0&&i.bk(F,r)/(C*a)<b)return null;C=a,F=r}g&&m&&(f[E]&&(I=O(),C=i.bh(A,I),F=i.aw([],I,A)),f[E]=I);let B=(P-M)/C,k=z.sub(L)._mult(B)._add(L),N=i.bi([],A,F,B),U=[0,0,1],V=F[0],j=F[1];if(v&&(0!==(U=y.upVector(x.canonical,k.x,k.y))[0]||0!==U[1]||1!==U[2])){let r=[U[2],0,-U[0]],a=i.bj([],U,r);i.ax(r,r),i.ax(a,a),V=i.bk(F,r),j=i.bk(F,a)}if(n){let r=i.bj([],U,F);i.ax(r,r),i.bi(N,N,r,n*T)}let G=S+Math.atan2(j,V);return D.push(N),_&&R.push(k),{point:N,angle:G,path:D,tilePath:R,up:U}}function iM(i,r){let a=r.length,n=a+4*i;r.resize(n),r.float32.fill(-1/0,4*a,4*n)}function iC(i,r,a){let n=r[0],o=r[1];return i[0]=a[0]*n+a[4]*o+a[12],i[1]=a[1]*n+a[5]*o+a[13],i[3]=a[3]*n+a[7]*o+a[15],i}class iP{constructor(r,a,n=new i.bq(r.width+200,r.height+200,25),o=new i.bq(r.width+200,r.height+200,25)){this.transform=r,this.grid=n,this.ignoredGrid=o,this.pitchfactor=Math.cos(r._pitch)*r.cameraToCenterDistance,this.screenRightBoundary=r.width+100,this.screenBottomBoundary=r.height+100,this.gridRightBoundary=r.width+200,this.gridBottomBoundary=r.height+200,this.fogState=a,this.clippedSymbols=new Map}clearClippedSymbolsForBucket(i){this.clippedSymbols.delete(i)}markSymbolAsClipped(i,r){let a=this.clippedSymbols.get(i);a||(a=new Set,this.clippedSymbols.set(i,a)),a.add(r)}placeCollisionBox(r,a,n,o,s,l,h,u,c,d,p){let f=n.projectedAnchorX,m=n.projectedAnchorY,_=n.projectedAnchorZ,g=n.tileAnchorX,y=n.tileAnchorY,x=n.elevation,v=n.tileID,b=r.getProjection();if(x&&v){let[i,r,a]=b.upVector(v.canonical,n.tileAnchorX,n.tileAnchorY),o=b.upVectorScale(v.canonical,this.transform.center.lat,this.transform.worldSize).metersToTile;f+=i*x*o,m+=r*x*o,_+=a*x*o}let w="globe"===r.projection.name,T="globe"===r.projection.name?i.ai(this.transform.zoom):0;if(v&&w&&T<1&&!l){let r=1<<v.canonical.z,a=i.br(g,y);i.bs(a,a,1/i.ak),i.bt(a,a,i.br(v.canonical.x,v.canonical.y)),i.bs(a,a,1/r),i.bu(a,a,i.br(o[0],o[1])),a[0]=i.bv(a[0],-.5,.5),i.bs(a,a,i.ak);let n=i.bw(a[0],a[1],i.ak/(2*Math.PI),1);i.aD(n,n,s),f=i.aj(f,n[0],T),m=i.aj(m,n[1],T),_=i.aj(_,n[2],T)}let S=this.projectAndGetPerspectiveRatio(d,f,m,_,n.tileID,"globe"===b.name||!!x||this.transform.pitch>0,b),E=c*S.perspectiveRatio,I=(n.x1*a+h.x-n.padding)*E+S.point.x,A=(n.y1*a+h.y-n.padding)*E+S.point.y,M=(n.x2*a+h.x+n.padding)*E+S.point.x,C=(n.y2*a+h.y+n.padding)*E+S.point.y,P=S.perspectiveRatio<=.55||S.occluded;return!this.isInsideGrid(I,A,M,C)||!u&&this.grid.hitTest(I,A,M,C,p)||P?{box:[],offscreen:!1,occluded:S.occluded}:{box:[I,A,M,C],offscreen:this.isOffscreen(I,A,M,C),occluded:!1}}placeCollisionCircles(r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y){let x=[],v=this.transform.elevation,b=r.getProjection(),w="road"===r.elevationType,T=!!v||w,S=i.bx.getAtTileOffsetFunc(y,this.transform.center.lat,this.transform.worldSize,b),E=new i.P(n.tileAnchorX,n.tileAnchorY),I=new i.P(n.tileAnchorX,n.tileAnchorY),{x:A,y:M,z:C}=b.projectTilePoint(I.x,I.y,y.canonical),P=null;if(T){let i=w?r.getElevationFeatureForText(o):null;P={getElevation:S,elevation:v,elevationFeature:i};let[a,n,s]=S(E,v,i);A+=a,M+=n,C+=s}let D="globe"===b.name,R=this.projectAndGetPerspectiveRatio(u,A,M,C,y,D||!!v||this.transform.pitch>0,b),{perspectiveRatio:z}=R,L=(f?h/z:h*z)/i.bC,F=ix(A,M,C,c),O=n.lineOffsetX*L,B=n.lineOffsetY*L,k=Math.cos(i.am(r.layers[0].layout.get("text-max-angle"))),N=R.signedDistanceFromCamera>0?iw(L,l,O,B,w&&1===n.flipState,F,I,n,s,c,{},T&&!f?P:null,f&&T,b,y,f,k):null,U=!1,V=!1,j=!0;if(N&&!R.occluded){let r=.5*_*z+g,n=new i.P(-100,-100),o=new i.P(this.screenRightBoundary,this.screenBottomBoundary),s=new ip,{first:l,last:h}=N,u=l.path.length,c=[];for(let i=u-1;i>=1;i--)c.push(l.path[i]);for(let i=1;i<h.path.length;i++)c.push(h.path[i]);let f=2.5*r;d&&(c=c.map(([i,r,a],n)=>(T&&!D&&(a=S(n<u-1?l.tilePath[u-1-n]:h.tilePath[n-u+2],v,P.elevationFeature)[2]),ix(i,r,a,d)))).some(i=>i[3]<=0)&&(c=[]);let y=[];if(c.length>0){let r=1/0,a=-1/0,s=1/0,l=-1/0;for(let i of c)r=Math.min(r,i[0]),s=Math.min(s,i[1]),a=Math.max(a,i[0]),l=Math.max(l,i[1]);a>=n.x&&r<=o.x&&l>=n.y&&s<=o.y&&(y=[c.map(r=>new i.P(r[0],r[1]))],(r<n.x||a>o.x||s<n.y||l>o.y)&&(y=i.by(y,n.x,n.y,o.x,o.y)))}for(let i of y){s.reset(i,.25*r);let n=0;n=s.length<=.5*r?1:Math.ceil(s.paddedLength/f)+1;for(let i=0;i<n;i++){let o=i/Math.max(n-1,1),l=s.lerp(o),h=l.x+100,u=l.y+100;x.push(h,u,r,0);let c=h-r,d=u-r,f=h+r,_=u+r;if(j=j&&this.isOffscreen(c,d,f,_),V=V||this.isInsideGrid(c,d,f,_),!a&&this.grid.hitTestCircle(h,u,r,m)&&(U=!0,!p))return{circles:[],offscreen:!1,collisionDetected:U,occluded:!1}}}}return{circles:(p||!U)&&V?x:[],offscreen:j,collisionDetected:U,occluded:R.occluded}}queryRenderedSymbols(r){if(0===r.length||0===this.grid.keysLength()&&0===this.ignoredGrid.keysLength())return{};let a=[],n=1/0,o=1/0,s=-1/0,l=-1/0;for(let h of r){let r=new i.P(h.x+100,h.y+100);n=Math.min(n,r.x),o=Math.min(o,r.y),s=Math.max(s,r.x),l=Math.max(l,r.y),a.push(r)}let h=this.grid.query(n,o,s,l).concat(this.ignoredGrid.query(n,o,s,l)),u={},c={};for(let r of h){let n=r.key;if(void 0===u[n.bucketInstanceId]&&(u[n.bucketInstanceId]={}),u[n.bucketInstanceId][n.featureIndex])continue;
8let o=this.clippedSymbols.get(n.bucketInstanceId);if(o&&o.has(n.featureIndex))continue;let s=[new i.P(r.x1,r.y1),new i.P(r.x2,r.y1),new i.P(r.x2,r.y2),new i.P(r.x1,r.y2)];i.bz(a,s)&&(u[n.bucketInstanceId][n.featureIndex]=!0,void 0===c[n.bucketInstanceId]&&(c[n.bucketInstanceId]=[]),c[n.bucketInstanceId].push(n.featureIndex))}return c}insertCollisionBox(i,r,a,n,o){(r?this.ignoredGrid:this.grid).insert({bucketInstanceId:a,featureIndex:n,collisionGroupID:o},i[0],i[1],i[2],i[3])}insertCollisionCircles(i,r,a,n,o){let s=r?this.ignoredGrid:this.grid,l={bucketInstanceId:a,featureIndex:n,collisionGroupID:o};for(let r=0;r<i.length;r+=4)s.insertCircle(l,i[r],i[r+1],i[r+2])}projectAndGetPerspectiveRatio(r,a,n,o,s,l,h){let u=[a,n,o,1],c=!1;o||this.transform.pitch>0?(i.aD(u,u,r),this.fogState&&s&&"globe"!==h.name&&(c=function(r,a,n,o,s,l){let h=l.calculateFogTileMatrix(s),u=[a,n,o];return i.ae(u,u,h),tP(r,i.af(u),l.pitch)}(this.fogState,a,n,o,s.toUnwrapped(),this.transform)>.9)):iC(u,u,r);let d=u[3];return{point:new i.P((u[0]/d+1)/2*this.transform.width+100,(-u[1]/d+1)/2*this.transform.height+100),perspectiveRatio:Math.min(.5+this.transform.getCameraToCenterDistance(h)/d*.5,1.5),signedDistanceFromCamera:d,occluded:l&&u[2]>d||c}}isOffscreen(i,r,a,n){return a<100||i>=this.screenRightBoundary||n<100||r>this.screenBottomBoundary}isInsideGrid(i,r,a,n){return a>=0&&i<this.gridRightBoundary&&n>=0&&r<this.gridBottomBoundary}getViewportMatrix(){let r=i.bA([]);return i.bB(r,r,[-100,-100,0]),r}}class iD{constructor(i,r,a,n){this.opacity=i?Math.max(0,Math.min(1,i.opacity+(i.placed?r:-r))):n&&a?1:0,this.placed=a}isHidden(){return 0===this.opacity&&!this.placed}}class iR{constructor(i,r,a,n,o,s=!1){this.text=new iD(i?i.text:null,r,a,o),this.icon=new iD(i?i.icon:null,r,n,o),this.clipped=s}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class iz{constructor(i,r,a,n=!1){this.text=i,this.icon=r,this.skipFade=a,this.clipped=n}}class iL{constructor(){this.invProjMatrix=i.bd(),this.viewportMatrix=i.bd(),this.circles=[]}}class iF{constructor(i,r,a,n,o){this.bucketInstanceId=i,this.featureIndex=r,this.sourceLayerIndex=a,this.bucketIndex=n,this.tileID=o}}class iO{constructor(i){this.crossSourceCollisions=i,this.maxGroupID=0,this.collisionGroups={}}get(i){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[i]){let r=++this.maxGroupID;this.collisionGroups[i]={ID:r,predicate:i=>i.collisionGroupID===r}}return this.collisionGroups[i]}}function iB(r,a,n,o,s){let{horizontalAlign:l,verticalAlign:h}=i.bJ(r),u=i.bK(r,o);return new i.P(-(l-.5)*a+u[0]*s,-(h-.5)*n+u[1]*s)}function ik(r,a,n,o,s){let l=new i.P(r,a);return n&&l._rotate(o?s:-s),l}class iN{constructor(i,r,a,n,o,s){this.transform=i.clone(),this.projection=i.projection.name,this.collisionIndex=new iP(this.transform,o),this.buildingIndex=s,this.frontCutoffStart=0,this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=r,this.retainedQueryData={},this.collisionGroups=new iO(a),this.collisionCircleArrays={},this.prevPlacement=n,n&&(n.prevPlacement=void 0),this.placedOrientations={},this.lastReplacementSourceUpdateTime=0}getBucketParts(r,a,n,o,s=1){var l,h,u;let c=n.getBucket(a),d=n.latestFeatureIndex;if(!c||!d||a.fqid!==c.layerIds[0])return;let p=c.layers[0].layout,f=c.layers[0].paint,m=n.collisionBoxArray,_=Math.pow(2,this.transform.zoom-n.tileID.overscaledZ),g=n.tileSize/i.ak,y=n.tileID.toUnwrapped();this.transform.setProjection(c.projection);let x=(l=n.tileID,h=c.getProjection(),u=this.transform,h.name===this.projection?u.calculateProjMatrix(l.toUnwrapped()):ic(u,h,l)),v="map"===p.get("text-pitch-alignment"),b="map"===p.get("text-rotation-alignment");a.compileFilter(a.options);let w=a.dynamicFilter(),T=a.dynamicFilterNeedsFeature(),S=a.dynamicFilterNeedsGeometry(),E=this.transform.calculatePixelsToTileUnitsMatrix(n),I=ig(x,n.tileID.canonical,v,b,this.transform,c.getProjection(),E),A=null,M=c.getProjection().createInversionMatrix(this.transform,n.tileID.canonical);if(v){let r=iy(x,n.tileID.canonical,v,b,this.transform,c.getProjection(),E);
8A=i.aC([],this.transform.labelPlaneMatrix,r)}let C=null;w&&n.latestFeatureIndex&&(C={unwrappedTileID:y,dynamicFilter:w,dynamicFilterNeedsFeature:T,needGeometry:S}),this.retainedQueryData[c.bucketInstanceId]=new iF(c.bucketInstanceId,d,c.sourceLayerIndex,c.index,n.tileID);let[P,D]=c.layers[0].layout.get("text-size-scale-range"),R=i.aB(s,P,D),[z,L]=p.get("icon-size-scale-range"),F=i.aB(s,z,L),O={bucket:c,layout:p,paint:f,posMatrix:x,invMatrix:M,mercatorCenter:[i.aG(this.transform.center.lng),i.aJ(this.transform.center.lat)],textLabelPlaneMatrix:I,labelToScreenMatrix:A,clippingData:C,scale:_,textPixelRatio:g,holdingForFade:n.holdingForFade(),collisionBoxArray:m,partiallyEvaluatedTextSize:i.bl(c.textSizeData,this.transform.zoom,R),partiallyEvaluatedIconSize:i.bl(c.iconSizeData,this.transform.zoom,F),collisionGroup:this.collisionGroups.get(c.sourceID),latestFeatureIndex:n.latestFeatureIndex};if(o)for(let i of c.sortKeyRanges){let{sortKey:a,symbolInstanceStart:n,symbolInstanceEnd:o}=i;r.push({sortKey:a,symbolInstanceStart:n,symbolInstanceEnd:o,parameters:O})}else r.push({symbolInstanceStart:0,symbolInstanceEnd:c.symbolInstances.length,parameters:O})}attemptAnchorPlacement(i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w){let{textOffset0:T,textOffset1:S,crossTileID:E}=_,I=[T,S],A=iB(i,s,l,I,h),M=this.collisionIndex.placeCollisionBox(y,h,r,a,n,o,ik(A.x,A.y,u,c,this.transform.angle),m,d,p,f.predicate);if(v){let i=y.getSymbolInstanceIconSize(w,this.transform.zoom,_.placedIconSymbolIndex);if(0===this.collisionIndex.placeCollisionBox(y,i,v,a,n,o,ik(A.x,A.y,u,c,this.transform.angle),m,d,p,f.predicate).box.length)return}if(M.box.length>0){let r;return this.prevPlacement&&this.prevPlacement.variableOffsets[E]&&this.prevPlacement.placements[E]&&this.prevPlacement.placements[E].text&&(r=this.prevPlacement.variableOffsets[E].anchor),this.variableOffsets[E]={textOffset:I,width:s,height:l,anchor:i,textScale:h,prevAnchor:r},this.markUsedJustification(y,i,_,x),y.allowVerticalPlacement&&(this.markUsedOrientation(y,x,_),this.placedOrientations[E]=x),{shift:A,placedGlyphBoxes:M}}}placeLayerBucketPart(r,a,n,o,s=1){let{bucket:l,layout:h,paint:u,posMatrix:c,textLabelPlaneMatrix:d,labelToScreenMatrix:p,clippingData:f,textPixelRatio:m,mercatorCenter:_,invMatrix:g,holdingForFade:y,collisionBoxArray:x,partiallyEvaluatedTextSize:v,partiallyEvaluatedIconSize:b,collisionGroup:w,latestFeatureIndex:T}=r.parameters,S=h.get("text-optional"),E=h.get("icon-optional"),I=h.get("text-allow-overlap"),A=h.get("icon-allow-overlap"),M="map"===h.get("text-rotation-alignment"),C="map"===h.get("icon-rotation-alignment"),P="map"===h.get("text-pitch-alignment"),D=u.get("symbol-z-offset"),R="sea"===h.get("symbol-elevation-reference"),z=h.get("symbol-placement"),[L,F]=h.get("text-size-scale-range"),[O,B]=h.get("icon-size-scale-range"),k=i.aB(s,L,F),N=i.aB(s,O,B),U=h.get("text-variable-anchor"),V=M&&"point"!==z,j=U&&l.hasTextData(),G=l.hasIconTextFit()&&j&&l.hasIconData();this.transform.setProjection(l.projection);let H=j||V,$=C&&"point"!==z||G,q=I&&(A||!l.hasIconData()||E),Z=A&&(I||!l.hasTextData()||S),W=!D.isConstant();!l.collisionArrays&&x&&l.deserializeCollisionBoxes(x),n&&o&&l.updateCollisionDebugBuffers(this.transform.zoom,x,k,N);let X=(r,o,s)=>{let{crossTileID:u,numVerticalGlyphVertices:x}=r,C=null;if(f&&f.dynamicFilterNeedsFeature||W){let a=this.retainedQueryData[l.bucketInstanceId],n=T.loadFeature({featureIndex:r.featureIndex,bucketIndex:a.bucketIndex,sourceLayerIndex:a.sourceLayerIndex,layoutVertexArrayOffset:0}),o=n.properties?n.properties.worldview:null;if(l.localizable&&l.worldview&&"string"==typeof o)if("all"===o)n.properties.$localized=!0;else{if(!o.split(",").includes(l.worldview))return;n.properties.$localized=!0,n.properties.worldview=l.worldview}C=f&&f.needGeometry?i.bH(n,!0):n}if(f&&!(0,f.dynamicFilter)({zoom:this.transform.zoom,pitch:this.transform.pitch,worldview:l.worldview},C,this.retainedQueryData[l.bucketInstanceId].tileID.canonical,new i.P(r.tileAnchorX,r.tileAnchorY),this.transform.calculateDistanceTileData(f.unwrappedTileID)))return this.placements[u]=new iz(!1,!1,!1,!0),void a.add(u);let z=D.evaluate(C,{});if((r.zOffset||0)+(z||0)>
80&&this.frontCutoffStart>0){let n=2*this.frontCutoffStart-1,o=[r.tileAnchorX,r.tileAnchorY,0,1],s=i.aD(i.bI(),o,c);if(s[1]/s[3]<n)return this.placements[u]=new iz(!1,!1,!1,!0),void a.add(u)}if(a.has(u))return;if(y)return void(this.placements[u]=new iz(!1,!1,!1));let L=!1,F=!1,O=!0,B=!1,k=!1,N=null,V={box:null,offscreen:null,occluded:null},j={box:null},G=null,X=null,Y=null,J=0,K=0,Q=0;s.textFeatureIndex?J=s.textFeatureIndex:r.useRuntimeCollisionCircles&&(J=r.featureIndex),s.verticalTextFeatureIndex&&(K=s.verticalTextFeatureIndex);let ee=l.elevationFeatures?l.elevationFeatures[r.elevationFeatureIndex]:void 0,et=a=>{a.tileID=this.retainedQueryData[l.bucketInstanceId].tileID;let n=this.transform.elevation;a.elevation=R?z:z+i.bx.getAtTileOffset(a.tileID,new i.P(a.tileAnchorX,a.tileAnchorY),n,ee),a.elevation+=r.zOffset},ei=s.textBox;if(ei){et(ei);let a=a=>{let n=i.bm.horizontal;if(l.allowVerticalPlacement&&!a&&this.prevPlacement){let i=this.prevPlacement.placedOrientations[u];i&&(this.placedOrientations[u]=i,n=i,this.markUsedOrientation(l,n,r))}return n},n=(r,a)=>{if(l.allowVerticalPlacement&&x>0&&s.verticalTextBox){for(let n of l.writingModes)if(n===i.bm.vertical?j=V=a():V=r(),V&&V.box&&V.box.length)break}else V=r()};if(U){let h=U;if(this.prevPlacement&&this.prevPlacement.variableOffsets[u]){let i=this.prevPlacement.variableOffsets[u];h.indexOf(i.anchor)>0&&(h=h.filter(r=>r!==i.anchor)).unshift(i.anchor)}let d=(i,a,n)=>{let s=l.getSymbolInstanceTextSize(v,r,this.transform.zoom,o),u=(i.x2-i.x1)*s+2*i.padding,d=(i.y2-i.y1)*s+2*i.padding,p=r.hasIconTextFit&&!A?a:null;p&&et(p);let f={box:[],offscreen:!1,occluded:!1},y=I?2*h.length:h.length;for(let a=0;a<y;++a){let y=this.attemptAnchorPlacement(h[a%h.length],i,_,g,H,u,d,s,M,P,m,c,w,a>=h.length,r,o,l,n,p,v,b);if(y&&(f=y.placedGlyphBoxes)&&f.box&&f.box.length){L=!0,N=y.shift;break}}return f};n(()=>d(ei,s.iconBox,i.bm.horizontal),()=>{let r=s.verticalTextBox;return r&&et(r),l.allowVerticalPlacement&&!(V&&V.box&&V.box.length)&&x>0&&r?d(r,s.verticalIconBox,i.bm.vertical):{box:null,offscreen:null,occluded:null}}),V&&(L=V.box,O=V.offscreen,B=V.occluded);let p=a(!(!V||!V.box));if(!L&&this.prevPlacement){let i=this.prevPlacement.variableOffsets[u];i&&(this.variableOffsets[u]=i,this.markUsedJustification(l,i.anchor,r,p))}}else{let h=(a,n)=>{let s=l.getSymbolInstanceTextSize(v,r,this.transform.zoom,o),h=this.collisionIndex.placeCollisionBox(l,s,a,_,g,H,new i.P(0,0),I,m,c,w.predicate);return h&&h.box&&h.box.length&&(this.markUsedOrientation(l,n,r),this.placedOrientations[u]=n),h};n(()=>h(ei,i.bm.horizontal),()=>{let r=s.verticalTextBox;return l.allowVerticalPlacement&&x>0&&r?(et(r),h(r,i.bm.vertical)):{box:null,offscreen:null,occluded:null}}),a(!!(V&&V.box&&V.box.length))}}if(L=(G=V)&&G.box&&G.box.length>0,O=G&&G.offscreen,B=G&&G.occluded,r.useRuntimeCollisionCircles){let a=r.centerJustifiedTextSymbolIndex>=0?r.centerJustifiedTextSymbolIndex:r.verticalPlacedTextSymbolIndex,o=l.text.placedSymbolArray.get(a),s=i.bn(l.textSizeData,v,o),u=h.get("text-padding");X=this.collisionIndex.placeCollisionCircles(l,I,o,a,l.lineVertexArray,l.glyphOffsetArray,s,c,d,p,n,P,w.predicate,r.collisionCircleDiameter*s/i.bC,u,this.retainedQueryData[l.bucketInstanceId].tileID),L=I||X.circles.length>0&&!X.collisionDetected,O=O&&X.offscreen,B=X.occluded}if(s.iconFeatureIndex&&(Q=s.iconFeatureIndex),s.iconBox){let a=a=>{et(a);let n=r.hasIconTextFit&&N?ik(N.x,N.y,M,P,this.transform.angle):new i.P(0,0),o=l.getSymbolInstanceIconSize(b,this.transform.zoom,r.placedIconSymbolIndex);return this.collisionIndex.placeCollisionBox(l,o,a,_,g,$,n,A,m,c,w.predicate)};F=j&&j.box&&j.box.length&&s.verticalIconBox?(Y=a(s.verticalIconBox)).box.length>0:(Y=a(s.iconBox)).box.length>0,O=O&&Y.offscreen,k=Y.occluded}let er=S||0===r.numHorizontalGlyphVertices&&0===x,ea=E||0===r.numIconVertices;if(er||ea?ea?er||(F=F&&L):L=F&&L:F=L=F&&L,L&&G&&G.box&&this.collisionIndex.insertCollisionBox(G.box,h.get("text-ignore-placement"),l.bucketInstanceId,j&&j.box&&K?K:J,w.ID),F&&Y&&this.collisionIndex.insertCollisionBox(Y.box,h.get("icon-ignore-placement"),l.bucketInstanceId,Q,w.ID),X&&(L&&this.collisionIndex.insertCollisionCircles(X.circles,h.get("text-ignore-placement"),l.bucketInstanceId,J,w.ID),n)){let i=l.bucketInstanceId,r=this.collisionCircleArrays[i];void 0===r&&(r=this.collisionCircleArrays[i]=new iL);for(let i=0;i<X.circles.length;i+=4)r.circles.push(X.circles[i+0]),r.circles.push(X.circles[i+1]),r.circles.push(X.circles[i+2]),r.circles.push(+!!X.collisionDetected)}let en="globe"!==l.projection.name;
8q=q&&(en||!B),Z=Z&&(en||!k),this.placements[u]=new iz(L||q,F||Z,O||l.justReloaded),a.add(u)},Y=this.retainedQueryData[l.bucketInstanceId].tileID;if("offset"===l.elevationType&&this.buildingIndex&&this.buildingIndex.updateZOffset(l,Y),"road"===l.elevationType&&l.updateRoadElevation(Y.canonical),l.updateZOffset(),l.sortFeaturesByY){let r=l.getSortedSymbolIndexes(this.transform.angle);for(let i=r.length-1;i>=0;--i){let a=r[i];X(l.symbolInstances.get(a),a,l.collisionArrays[a])}l.hasAnyZOffset&&i.w(`${l.layerIds[0]} layer symbol-z-elevate: symbols are not sorted by elevation if symbol-z-order is evaluated to viewport-y`)}else if(l.hasAnyZOffset){let i=l.getSortedIndexesByZOffset();for(let r=0;r<i.length;++r){let a=i[r];X(l.symbolInstances.get(a),a,l.collisionArrays[a])}}else for(let i=r.symbolInstanceStart;i<r.symbolInstanceEnd;i++)X(l.symbolInstances.get(i),i,l.collisionArrays[i]);if(n&&l.bucketInstanceId in this.collisionCircleArrays){let r=this.collisionCircleArrays[l.bucketInstanceId];i.ba(r.invProjMatrix,c),r.viewportMatrix=this.collisionIndex.getViewportMatrix()}l.justReloaded=!1}markUsedJustification(r,a,n,o){let{leftJustifiedTextSymbolIndex:s,centerJustifiedTextSymbolIndex:l,rightJustifiedTextSymbolIndex:h,verticalPlacedTextSymbolIndex:u,crossTileID:c}
8=n,d=i.bL(a),p=o===i.bm.vertical?u:"left"===d?s:"center"===d?l:"right"===d?h:-1;s>=0&&(r.text.placedSymbolArray.get(s).crossTileID=p>=0&&s!==p?0:c),l>=0&&(r.text.placedSymbolArray.get(l).crossTileID=p>=0&&l!==p?0:c),h>=0&&(r.text.placedSymbolArray.get(h).crossTileID=p>=0&&h!==p?0:c),u>=0&&(r.text.placedSymbolArray.get(u).crossTileID=p>=0&&u!==p?0:c)}markUsedOrientation(r,a,n){let o=a===i.bm.horizontal||a===i.bm.horizontalOnly?a:0,s=a===i.bm.vertical?a:0,{leftJustifiedTextSymbolIndex:l,centerJustifiedTextSymbolIndex:h,rightJustifiedTextSymbolIndex:u,verticalPlacedTextSymbolIndex:c}=n,d=r.text.placedSymbolArray;l>=0&&(d.get(l).placedOrientation=o),h>=0&&(d.get(h).placedOrientation=o),u>=0&&(d.get(u).placedOrientation=o),c>=0&&(d.get(c).placedOrientation=s)}commit(i){this.commitTime=i,this.zoomAtLastRecencyCheck=this.transform.zoom;let r=this.prevPlacement,a=!1;this.prevZoomAdjustment=r?r.zoomAdjustment(this.transform.zoom):0;let n=r?r.symbolFadeChange(i):1,o=r?r.opacities:{},s=r?r.variableOffsets:{},l=r?r.placedOrientations:{};for(let i in this.placements){let r=this.placements[i],s=o[i];s?(this.opacities[i]=new iR(s,n,r.text,r.icon,null,r.clipped),a=a||r.text!==s.text.placed||r.icon!==s.icon.placed):(this.opacities[i]=new iR(null,n,r.text,r.icon,r.skipFade,r.clipped),a=a||r.text||r.icon)}for(let i in o){let r=o[i];if(!this.opacities[i]){let o=new iR(r,n,!1,!1);o.isHidden()||(this.opacities[i]=o,a=a||r.text.placed||r.icon.placed)}}for(let i in s)this.variableOffsets[i]||!this.opacities[i]||this.opacities[i].isHidden()||(this.variableOffsets[i]=s[i]);for(let i in l)this.placedOrientations[i]||!this.opacities[i]||this.opacities[i].isHidden()||(this.placedOrientations[i]=l[i]);a?this.lastPlacementChangeTime=i:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=r?r.lastPlacementChangeTime:i)}updateLayerOpacities(i,r,a,n){n&&(this.lastReplacementSourceUpdateTime=n.updateTime);let o=new Set;for(let s of r){let r=s.getBucket(i);r&&s.latestFeatureIndex&&i.fqid===r.layerIds[0]&&(this.updateBucketOpacities(r,o,s,s.collisionBoxArray,a,n,s.tileID,i.scope),"offset"===r.elevationType&&this.buildingIndex&&this.buildingIndex.updateZOffset(r,s.tileID),"road"===r.elevationType&&r.updateRoadElevation(s.tileID.canonical),r.updateZOffset())}}updateBucketOpacities(r,a,n,o,s,l,h,u){r.hasTextData()&&r.text.opacityVertexArray.clear(),r.hasIconData()&&r.icon.opacityVertexArray.clear(),r.hasIconCollisionBoxData()&&r.iconCollisionBox.collisionVertexArray.clear(),r.hasTextCollisionBoxData()&&r.textCollisionBox.collisionVertexArray.clear();let c=r.layers[0].layout,d=r.layers[0].paint,p=!!r.layers[0].dynamicFilter(),f=new iR(null,0,!1,!1,!0),m=c.get("text-allow-overlap"),_=c.get("icon-allow-overlap"),g=c.get("text-variable-anchor"),y="map"===c.get("text-rotation-alignment"),x="map"===c.get("text-pitch-alignment"),v=d.get("symbol-z-offset"),b="sea"===c.get("symbol-elevation-reference"),w=!v.isConstant(),T=new iR(null,0,m&&(_||!r.hasIconData()||c.get("icon-optional")),_&&(m||!r.hasTextData()||c.get("text-optional")),!0);!r.collisionArrays&&o&&(r.hasIconCollisionBoxData()||r.hasTextCollisionBoxData())&&r.deserializeCollisionBoxes(o);let S=(i,r,a)=>{for(let n=0;n<r/4;n++)i.opacityVertexArray.emplaceBack(a)},E=0;l&&r.updateReplacement(h,l),this.collisionIndex.clearClippedSymbolsForBucket(r.bucketInstanceId);for(let o=0;o<r.symbolInstances.length;o++){let c=r.symbolInstances.get(o),{numHorizontalGlyphVertices:d,numVerticalGlyphVertices:m,crossTileID:_,numIconVertices:I,tileAnchorX:A,tileAnchorY:M}=c,C=null,P=this.retainedQueryData[r.bucketInstanceId];w&&c&&P&&(C=n.latestFeatureIndex.loadFeature({featureIndex:c.featureIndex,bucketIndex:P.bucketIndex,sourceLayerIndex:P.sourceLayerIndex,layoutVertexArrayOffset:0}));let D=v.evaluate(C,{}),R=a.has(_),z=this.opacities[_];R?z=f:z||(z=T,this.opacities[_]=z),a.add(_);let L=d>0||m>0,F=I>0,O=this.placedOrientations[_],B=O===i.bm.vertical,k=O===i.bm.horizontal||O===i.bm.horizontalOnly;!L&&!F||z.isHidden()||E++;let N=!1;if((L||F)&&l)for(let a of r.activeReplacements){if(i.bD(a,s,i.bE.Symbol,u)||a.min.x>A||A>a.max.x||a.min.y>M||M>a.max.y)continue;let r=i.bF(A,M,h.canonical,a.footprintTileId.canonical);if(N=i.bG(r,a.footprint))break}if(N&&this.collisionIndex.markSymbolAsClipped(r.bucketInstanceId,c.featureIndex),L){let i=N?ij:iV(z.text);S(r.text,d,B?ij:i),S(r.text,m,k?ij:i);let a=z.text.isHidden(),{leftJustifiedTextSymbolIndex:n,centerJustifiedTextSymbolIndex:o,rightJustifiedTextSymbolIndex:s,verticalPlacedTextSymbolIndex:l}=c,h=r.text.placedSymbolArray,u=a||B?1:0;n>=0&&(h.get(n).hidden=u),o>=0&&(h.get(o).hidden=u),s>=0&&(h.get(s).hidden=u),l>=0&&(h.get(l).hidden=a||k?1:0);let p=this.variableOffsets[_];p&&this.markUsedJustification(r,p.anchor,c,O);let f=this.placedOrientations[_];f&&(this.markUsedJustification(r,"left",c,f),this.markUsedOrientation(r,f,c))}if(F){let i=N?ij:iV(z.icon),{placedIconSymbolIndex:a,verticalPlacedIconSymbolIndex:n}=c,o=r.icon.placedSymbolArray,s=+!!z.icon.isHidden();a>=0&&(S(r.icon,I,B?ij:i),o.get(a).hidden=s),n>
8=0&&(S(r.icon,c.numVerticalIconVertices,k?ij:i),o.get(n).hidden=s)}if(r.hasIconCollisionBoxData()||r.hasTextCollisionBoxData()){let a=r.collisionArrays[o];if(a){let n=new i.P(0,0),o=!0;if(a.textBox||a.verticalTextBox){if(g){let i=this.variableOffsets[_];i?(n=iB(i.anchor,i.width,i.height,i.textOffset,i.textScale),y&&n._rotate(x?this.transform.angle:-this.transform.angle)):o=!1}p&&(o=!z.clipped),a.textBox&&iU(r.textCollisionBox.collisionVertexArray,z.text.placed,!o||B,D,b,n.x,n.y),a.verticalTextBox&&iU(r.textCollisionBox.collisionVertexArray,z.text.placed,!o||k,D,b,n.x,n.y)}let s=o&&!!(!k&&a.verticalIconBox);a.iconBox&&iU(r.iconCollisionBox.collisionVertexArray,z.icon.placed,s,D,b,c.hasIconTextFit?n.x:0,c.hasIconTextFit?n.y:0),a.verticalIconBox&&iU(r.iconCollisionBox.collisionVertexArray,z.icon.placed,!s,D,b,c.hasIconTextFit?n.x:0,c.hasIconTextFit?n.y:0)}}}if(r.fullyClipped=0===E,r.sortFeatures(this.transform.angle),this.retainedQueryData[r.bucketInstanceId]&&(this.retainedQueryData[r.bucketInstanceId].featureSortOrder=r.featureSortOrder),r.hasTextData()&&r.text.opacityVertexBuffer&&r.text.opacityVertexBuffer.updateData(r.text.opacityVertexArray),r.hasIconData()&&r.icon.opacityVertexBuffer&&r.icon.opacityVertexBuffer.updateData(r.icon.opacityVertexArray),r.hasIconCollisionBoxData()&&r.iconCollisionBox.collisionVertexBuffer&&r.iconCollisionBox.collisionVertexBuffer.updateData(r.iconCollisionBox.collisionVertexArray),r.hasTextCollisionBoxData()&&r.textCollisionBox.collisionVertexBuffer&&r.textCollisionBox.collisionVertexBuffer.updateData(r.textCollisionBox.collisionVertexArray),r.bucketInstanceId in this.collisionCircleArrays){let i=this.collisionCircleArrays[r.bucketInstanceId];r.placementInvProjMatrix=i.invProjMatrix,r.placementViewportMatrix=i.viewportMatrix,r.collisionCircleArray=i.circles,delete this.collisionCircleArrays[r.bucketInstanceId]}}symbolFadeChange(i){return 0===this.fadeDuration?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,r){let a=this.zoomAtLastRecencyCheck===r?1-this.zoomAdjustment(r):1;return this.zoomAtLastRecencyCheck=r,this.commitTime+this.fadeDuration*a>i}isStale(){return this.stale}setStale(){this.stale=!0}}function iU(i,r,a,n,o,s,l){i.emplaceBack(+!!r,+!!a,s||0,l||0,n,+!!o),i.emplaceBack(+!!r,+!!a,s||0,l||0,n,+!!o),i.emplaceBack(+!!r,+!!a,s||0,l||0,n,+!!o),i.emplaceBack(+!!r,+!!a,s||0,l||0,n,+!!o)}function iV(i){if(0===i.opacity&&!i.placed)return 0;if(1===i.opacity&&i.placed)return 0xffffffff;let r=+!!i.placed,a=Math.floor(127*i.opacity);return 0x2000000*a+0x1000000*r+131072*a+65536*r+512*a+256*r+2*a+r}let ij=0;class iG{constructor(i){this._sortAcrossTiles="viewport-y"!==i.layout.get("symbol-z-order")&&void 0!==i.layout.get("symbol-sort-key").constantOr(1),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs=new Set,this._bucketParts=[]}continuePlacement(i,r,a,n,o,s){let l=this._bucketParts;for(;this._currentTileIndex<i.length;)if(r.getBucketParts(l,n,i[this._currentTileIndex],this._sortAcrossTiles,s),this._currentTileIndex++,o())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,l.sort((i,r)=>i.sortKey-r.sortKey));this._currentPartIndex<l.length;){let i=l[this._currentPartIndex];if(r.placeLayerBucketPart(i,this._seenCrossTileIDs,a,0===i.symbolInstanceStart,s),this._currentPartIndex++,o())return!0}return!1}}class iH{startNewPlacement(i,r,a,n,o,s,l,h){return this.placement=new iN(i,n,o,s,l,h),this._currentPlacementIndex=r.length-1,this._forceFullPlacement=!1,this._showCollisionBoxes=a,this._fadeDuration=n,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(r,a,n,o,s){let l=i.o.now(),h=()=>{let r=i.o.now()-l;return!this.isFullPlacementRequested()&&0!==this._fadeDuration&&r>2};for(;this._currentPlacementIndex>=0;){let l=a[r[this._currentPlacementIndex]],u=this.placement.collisionIndex.transform.zoom;if("symbol"===l.type&&"none"!==l.visibility&&(!l.minzoom||l.minzoom<=u)&&(!l.maxzoom||l.maxzoom>u)){let r=l.layout.get("symbol-z-elevate"),a=void 0!==l.layout.get("symbol-sort-key").constantOr(1),u=l.layout.get("symbol-z-order"),c="viewport-y"===u||"auto"===u&&!("viewport-y"!==u&&a),d=l.layout.get("text-allow-overlap")||l.layout.get("icon-allow-overlap")||l.layout.get("text-ignore-placement")||l.layout.get("icon-ignore-placement"),p=c&&d,f=this._inProgressLayer=this._inProgressLayer||new iG(l),m=i.t(l.source,l.scope);if(f.continuePlacement(r||p?o[m]:n[m],this.placement,this._showCollisionBoxes,l,h,s))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._forceFullPlacement=!1,this._done=!0}commit(i){return this.placement.commit(i),this.placement}}let i$=512/i.ak/2;class iq{constructor(r,a,n){this.tileID=r,this.bucketInstanceId=n,this.index=new i.bM(a.length,16,Int32Array),this.keys=[],this.crossTileIDs=[];let o=r.canonical.x*i.ak,s=r.canonical.y*i.ak;for(let i=0;i<a.length;i++){let{key:r,crossTileID:n,tileAnchorX:l,tileAnchorY:h}
8=a.get(i),u=Math.floor((o+l)*i$),c=Math.floor((s+h)*i$);this.index.add(u,c),this.keys.push(r),this.crossTileIDs.push(n)}this.index.finish()}findMatches(r,a,n){let o=this.tileID.canonical.z<a.canonical.z?1:Math.pow(2,this.tileID.canonical.z-a.canonical.z),s=i$/Math.pow(2,a.canonical.z-this.tileID.canonical.z),l=a.canonical.x*i.ak,h=a.canonical.y*i.ak;for(let i=0;i<r.length;i++){let a=r.get(i);if(a.crossTileID)continue;let{key:u,tileAnchorX:c,tileAnchorY:d}=a,p=Math.floor((l+c)*s),f=Math.floor((h+d)*s);for(let i of this.index.range(p-o,f-o,p+o,f+o).sort((i,r)=>i-r)){let r=this.crossTileIDs[i];if(this.keys[i]===u&&!n.has(r)){n.add(r),a.crossTileID=r;break}}}}}class iZ{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class iW{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(i){let r=Math.round((i-this.lng)/360);if(0!==r)for(let i in this.indexes){let a=this.indexes[i],n={};for(let i in a){let o=a[i];o.tileID=o.tileID.unwrapTo(o.tileID.wrap+r),n[o.tileID.key]=o}this.indexes[i]=n}this.lng=i}addBucket(i,r,a){if(this.indexes[i.overscaledZ]&&this.indexes[i.overscaledZ][i.key]){if(this.indexes[i.overscaledZ][i.key].bucketInstanceId===r.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(i.overscaledZ,this.indexes[i.overscaledZ][i.key])}for(let i=0;i<r.symbolInstances.length;i++)r.symbolInstances.get(i).crossTileID=0;this.usedCrossTileIDs[i.overscaledZ]||(this.usedCrossTileIDs[i.overscaledZ]=new Set);let n=this.usedCrossTileIDs[i.overscaledZ];for(let a in this.indexes){let o=this.indexes[a];if(Number(a)>i.overscaledZ)for(let a in o){let s=o[a];s.tileID.isChildOf(i)&&s.findMatches(r.symbolInstances,i,n)}else{let s=o[i.scaledTo(Number(a)).key];s&&s.findMatches(r.symbolInstances,i,n)}}for(let i=0;i<r.symbolInstances.length;i++){let o=r.symbolInstances.get(i);o.crossTileID||(o.crossTileID=a.generate(),n.add(o.crossTileID))}return void 0===this.indexes[i.overscaledZ]&&(this.indexes[i.overscaledZ]={}),this.indexes[i.overscaledZ][i.key]=new iq(i,r.symbolInstances,r.bucketInstanceId),!0}removeBucketCrossTileIDs(i,r){for(let a of r.crossTileIDs)this.usedCrossTileIDs[i].delete(a)}removeStaleBuckets(i){let r=!1;for(let a in this.indexes){let n=this.indexes[a];for(let o in n)i[n[o].bucketInstanceId]||(this.removeBucketCrossTileIDs(a,n[o]),delete n[o],r=!0)}return r}}class iX{constructor(){this.layerIndexes={},this.crossTileIDs=new iZ,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(i,r,a,n){let o=this.layerIndexes[i.fqid];void 0===o&&(o=this.layerIndexes[i.fqid]=new iW);let s=!1,l={};for(let h of("globe"!==n.name&&o.handleWrapJump(a),r)){let r=h.getBucket(i);r&&i.fqid===r.layerIds[0]&&(r.bucketInstanceId||(r.bucketInstanceId=++this.maxBucketInstanceId),o.addBucket(h.tileID,r,this.crossTileIDs)&&(s=!0),l[r.bucketInstanceId]=!0)}return o.removeStaleBuckets(l)&&(s=!0),s}pruneUnusedLayers(i){let r={};for(let a in i.forEach(i=>{r[i]=!0}),this.layerIndexes)r[a]||delete this.layerIndexes[a]}}class iY{constructor(i,r,a,n){this.blendFunction=i,this.blendColor=r.toNonPremultipliedRenderColor(null),this.mask=a,this.blendEquation=n}}iY.Replace=[1,0,1,0],iY.disabled=new iY(iY.Replace,i.C.transparent,[!1,!1,!1,!1]),iY.unblended=new iY(iY.Replace,i.C.transparent,[!0,!0,!0,!0]),iY.alphaBlended=new iY([1,771,1,771],i.C.transparent,[!0,!0,!0,!0]),iY.alphaBlendedNonPremultiplied=new iY([770,771,770,771],i.C.transparent,[!0,!0,!0,!0]),iY.multiply=new iY([774,0,774,0],i.C.transparent,[!0,!0,!0,!0]),iY.multiplyAccumulateAlpha=new iY([774,0,1,771],i.C.transparent,[!0,!0,!0,!0]),iY.additive=new iY([1,1,1,1],i.C.transparent,[!0,!0,!0,!0]),iY.additiveAlphaWeighted=new iY([770,1,773,1],i.C.transparent,[!0,!0,!0,!0]),iY.additiveAlphaWeightedUnboundedAlpha=new iY([770,1,1,1],i.C.transparent,[!0,!0,!0,!0]);class iJ{constructor(i,r,a){this.func=i,this.mask=r,this.range=a}}iJ.ReadOnly=!1,iJ.ReadWrite=!0,iJ.disabled=new iJ(519,iJ.ReadOnly,[0,1]);class iK{constructor(i,r,a,n,o,s){this.test=i,this.ref=r,this.mask=a,this.fail=n,this.depthFail=o,this.pass=s}}iK.disabled=new iK({func:519,mask:0},0,0,7680,7680,7680);class iQ{constructor(i,r,a){this.enable=i,this.mode=r,this.frontFace=a}}function i0(r,a){let n=i.bS(r,3);i.bV(r,a),i.b_(r,3,n)}function i1(r,a){let n=i.bP([]);return i.bQ(n,n,-a),i.bR(n,n,-r),n}function i2(r,a){let n=[r[0],r[1],0],o=[a[0],a[1],0];if(i.af(n)>=1e-15){let r=i.ax([],n);i.bN(o,r,i.bk(o,r)),a[0]=o[0],a[1]=o[1]}let s=i.bj([],a,r);if(1e-15>i.bO(s))return null;let l=Math.atan2(-s[1],s[0]);return i1(Math.atan2(Math.sqrt(r[0]*r[0]+r[1]*r[1]),-r[2]),l)}iQ.disabled=new iQ(!1,1029,2305),iQ.backCCW=new iQ(!0,1029,2305),iQ.backCW=new iQ(!0,1029,2304),iQ.frontCW=new iQ(!0,1028,2304),iQ.frontCCW=new iQ(!0,1028,2305);class i3{constructor(i,r){this.position=i,this.orientation=r}get position(){return this._position}set position(r){if(r){let a=r instanceof i.ad?r:new i.ad(r[0],r[1],r[2]);
8this._renderWorldCopies&&(a.x=i.bv(a.x,0,1)),this._position=a}else this._position=null}lookAtPoint(r,a,n){if(this.orientation=null,!this.position)return;let o=this.position,s=n||(this._elevation?this._elevation.getAtPointOrZero(i.ad.fromLngLat(r)):0),l=i.ad.fromLngLat(r,s),h=[l.x-o.x,l.y-o.y,l.z-o.z];a||(a=[0,0,1]),a[2]=Math.abs(a[2]),this.orientation=i2(h,a)}setPitchBearing(r,a){this.orientation=i1(i.am(r),i.am(-a))}}class i5{constructor(r,a){this._transform=i.bA([]),this.orientation=a,this.position=r}get mercatorPosition(){let r=this.position;return new i.ad(r[0],r[1],r[2])}get position(){let r=i.bS(this._transform,3);return[r[0],r[1],r[2]]}set position(r){r&&i.b_(this._transform,3,[r[0],r[1],r[2],1])}get orientation(){return this._orientation}set orientation(r){this._orientation=r||i.bP([]),r&&i0(this._transform,this._orientation)}getPitchBearing(){let i=this.forward(),r=this.right();return{bearing:Math.atan2(-r[1],r[0]),pitch:Math.atan2(Math.sqrt(i[0]*i[0]+i[1]*i[1]),-i[2])}}setPitchBearing(i,r){this._orientation=i1(i,r),i0(this._transform,this._orientation)}forward(){let r=i.bS(this._transform,2);return[-r[0],-r[1],-r[2]]}up(){let r=i.bS(this._transform,1);return[-r[0],-r[1],-r[2]]}right(){let r=i.bS(this._transform,0);return[r[0],r[1],r[2]]}getCameraToWorld(r,a){let n=new Float64Array(16);return i.ba(n,this.getWorldToCamera(r,a)),n}getCameraToWorldMercator(){return this._transform}getWorldToCameraPosition(r,a,n){let o=this.position;i.bN(o,o,-r);let s=new Float64Array(16);return i.bT(s,[n,n,n]),i.bB(s,s,o),s[10]*=a,s}getWorldToCamera(r,a){let n=new Float64Array(16),o=new Float64Array(4),s=this.position;return i.bU(o,this._orientation),i.bN(s,s,-r),i.bV(n,o),i.bB(n,n,s),n[1]*=-1,n[5]*=-1,n[9]*=-1,n[13]*=-1,n[8]*=a,n[9]*=a,n[10]*=a,n[11]*=a,n}getCameraToClipPerspective(r,a,n,o){let s=new Float64Array(16);return i.bW(s,r,a,n,o),s}getCameraToClipOrthographic(r,a,n,o,s,l){let h=new Float64Array(16);return i.bX(h,r,a,n,o,s,l),h}getDistanceToElevation(r,a=!1){let n=0===r?0:i.bY(r,a?i.bZ(this.position[1]):this.position[1]),o=this.forward();return(n-this.position[2])/o[2]}clone(){return new i5([...this.position],[...this.orientation])}}let i4=(i,r)=>({u_matrix:i,u_ground_shadow_factor:r});class i6{constructor(i=0,r=0,a=0,n=0){if(isNaN(i)||i<0||isNaN(r)||r<0||isNaN(a)||a<0||isNaN(n)||n<0)throw Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=i,this.bottom=r,this.left=a,this.right=n}interpolate(r,a,n){return null!=a.top&&null!=r.top&&(this.top=i.aj(r.top,a.top,n)),null!=a.bottom&&null!=r.bottom&&(this.bottom=i.aj(r.bottom,a.bottom,n)),null!=a.left&&null!=r.left&&(this.left=i.aj(r.left,a.left,n)),null!=a.right&&null!=r.right&&(this.right=i.aj(r.right,a.right,n)),this}getCenter(r,a){let n=i.aB((this.left+r-this.right)/2,0,r),o=i.aB((this.top+a-this.bottom)/2,0,a);return new i.P(n,o)}equals(i){return this.top===i.top&&this.bottom===i.bottom&&this.left===i.left&&this.right===i.right}clone(){return new i6(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}class i8{constructor(r,a,n,o,s,l,h){this.tileSize=512,this._renderWorldCopies=void 0===s||s,this._minZoom=r||0,this._maxZoom=a||22,this._minPitch=n??0,this._maxPitch=o??60,this.setProjection(l),this.setMaxBounds(h),this.width=0,this.height=0,this._center=new i.aX(0,0),this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._nearZ=0,this._farZ=0,this._nearClipOffset=0,this._unmodified=!0,this._edgeInsets=new i6,this._projMatrixCache={},this._alignedProjMatrixCache={},this._fogTileMatrixCache={},this._expandedProjMatrixCache={},this._distanceTileDataCache={},this._camera=new i5,this._centerAltitude=0,this._averageElevation=0,this.cameraElevationReference="ground",this._pixelsPerMercatorPixel=1,this.globeRadius=0,this.globeCenterInViewSpace=[0,0,0],this._tileCoverLift=0,this.freezeTileCoverage=!1,this._horizonShift=.1,this._orthographicProjectionAtLowPitch=!1,this._allowWorldUnderZoom=!1,this.mercatorMatrix=new Float64Array(16),this.mercatorFogMatrix=new Float32Array(16),this.invProjMatrix=new Float64Array(16),this._expandedFarZProjMatrixBuf=new Float64Array(16),this.expandedFarZProjMatrix=this._expandedFarZProjMatrixBuf,this.starsProjMatrix=new Float32Array(16),this.skyboxMatrix=new Float32Array(16),this._mat4Scratch=new Float64Array(16),this.alignedProjMatrix=new Float64Array(16),this.labelPlaneMatr
8ix=new Float32Array(16),this.glCoordMatrix=new Float32Array(16),this.pixelMatrix=new Float64Array(16),this.pixelMatrixInverse=new Float64Array(16)}clone(){let i=new i8(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies,this.getProjection(),this.maxBounds);return i._elevation=this._elevation,i._centerAltitude=this._centerAltitude,i._centerAltitudeValidForExaggeration=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"globe"!==this.projection.name&&this._orthographicProjectionAtLowPitch&&this.pitch<15}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"globe"!==this.projection.name&&!this.isOrthographic}updateElevation(i,r=!1){let a=this._elevation&&this._elevation.exaggeration()!==this._centerAltitudeValidForE
8xaggeration;(null==this._seaLevelZoom||a)&&this._updateCameraOnTerrain(),(i||a)&&this._constrainCamera(r),this._calcMatrices()}getProjection(){return i.aK(this.projection,["name","center","parallels"])}setProjection(r){this.projectionOptions=r||{name:"mercator"};let a=this.projection?this.getProjection():void 0;this.projection=i.c4(this.projectionOptions);let n=this.getProjection(),o=!i.b9(a,n);return o&&this._calcMatrices(),this.mercatorFromTransition=!1,o}setOrthographicProjectionAtLowPitch(i){return this._orthographicProjectionAtLowPitch!==i&&(this._orthographicProjectionAtLowPitch=i,this._calcMatrices(),!0)}setMercatorFromTransition(){let r=this.projection.name;this.mercatorFromTransition=!0,this.projectionOptions={name:"mercator"},this.projection=i.c4({name:"mercator"});let a=r!==this.projection.name;return a&&this._calcMatrices(),a}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&&!0===this.projection.supportsWorldCopies}set renderWorldCopies(i){void 0===i?i=!0:null===i&&(i=!1),this._renderWorldCopies=i}get worldSize(){return this.tileSize*this.scale}get cameraWorldSizeForFog(){let i=Math.max(this._camera.getDistanceToElevation(this._averageElevation),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(i))}get cameraWorldSize(){let 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 i.bY(1,this.center.lat)*this.cameraWorldSizeForFog}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new i.P(this.width,this.height)}get bearing(){return i.bv(this.rotation,-180,180)}set bearing(i){this.rotation=i}get rotation(){return-this.angle/Math.PI*180}set rotation(i){let r=-i*Math.PI/180;if(this.angle===r)return;this._unmodified=!1,this.angle=r,this._calcMatrices();let a=Math.sin(this.angle),n=Math.cos(this.angle);this.rotationMatrix=[n,a,-a,n]}get pitch(){return this._pitch/Math.PI*180}set pitch(r){let a=i.aB(r,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==a&&(this._unmodified=!1,this._pitch=a,this._calcMatrices())}get aspect(){return this.width/this.height}get fov(){return this._fov/Math.PI*180}set fov(r){r=Math.max(.01,Math.min(60,r)),this._fov!==r&&(this._unmodified=!1,this._fov=i.am(r),this._calcMatrices())}get fovX(){return this._fov}get fovY(){let 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){let r=Math.min(Math.max(i,this.minZoom),this.maxZoom);this._zoom!==r&&(this._unmodified=!1,this._setZoom(r),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(){let i=this.elevation?this.elevation.getAtPoint(this.locationCoordinate(this.center),-1/0):-1/0,r=this.elevation&&i===-1/0&&this.elevation.visibleDemTiles.length>0&&this.elevation.exaggeration()>
80&&this._centerAltitudeValidForExaggeration;if(!this._elevation||i===-1/0&&(!r||!this._centerAltitude))return this._centerAltitude=0,this._seaLevelZoom=null,void(this._centerAltitudeValidForExaggeration=void 0);let a=this._elevation;r||this._centerAltitude&&this._centerAltitudeValidForExaggeration&&a.exaggeration()&&this._centerAltitudeValidForExaggeration!==a.exaggeration()?this._centerAltitude=this._centerAltitude/this._centerAltitudeValidForExaggeration*a.exaggeration():this._centerAltitude=i||0,this._centerAltitudeValidForExaggeration=a.exaggeration(),this._updateSeaLevelZoom()}_updateSeaLevelZoom(){if(void 0===this._centerAltitudeValidForExaggeration)return;let i=Math.max(0,(this.pixelsPerMeter*this._centerAltitude+this.cameraToCenterDistance)/this.worldSize);this._seaLevelZoom=this._zoomFromMercatorZ(i)}sampleAverageElevation(){if(!this._elevation)return 0;let r=this._elevation,a=[[.5,.2],[.3,.5],[.5,.5],[.7,.5],[.5,.8]],n=this.horizonLineFromTop(),o=0,s=0;for(let l=0;l<a.length;l++){let h=new i.P(a[l][0]*this.width,n+a[l][1]*(this.height-n)),u=r.pointCoordinate(h);if(!u)continue;let c=1/Math.hypot(u[0]-this._camera.position[0],u[1]-this._camera.position[1]);o+=u[3]*c,s+=c}return 0===s?NaN:o/s}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()&&("ground"===this.cameraElevationReference?this._updateCameraOnTerrain():this._updateZoomFromElevation()),this._constrain(),this._calcMatrices())}_updateZoomFromElevation(){if(null==this._seaLevelZoom||!this._elevation)return;let i=this._seaLevelZoom,r=this._elevation.getAtPointOrZero(this.locationCoordinate(this.center)),a=this.pixelsPerMeter/this.worldSize*r,n=Math.max(this._mercatorZfromZoom(i)-a,this._mercatorZfromZoom(this._maxZoom));this._setZoom(this._zoomFromMercatorZ(n))}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){let r=this.elevation,a=i.elevation,n=null!=r!=(null!=a)||r&&a&&r.exaggeration()!==a.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)&&!n}computeZoomRelativeTo(r){let a,n=this.rayIntersectionCoordinate(this.pointRayIntersection(this.centerPoint,r.toAltitude()));a=r.z<this._camera.position[2]?[n.x,n.y,n.z]:[r.x,r.y,r.z];let o=i.af(i.aw([],this._camera.position,a));return i.aB(this._zoomFromMercatorZ(o),this._minZoom,this._maxZoom)}setFreeCameraOptions(r){if(!this.height||!r.position&&!r.orientation)return;this._updateCameraState();let a=!1;if(r.orientation&&!i.c5(r.orientation,this._camera.orientation)&&(a=this._setCameraOrientation(r.orientation)),r.position){let n=[r.position.x,r.position.y,r.position.z];i.c6(n,this._camera.position)||(this._setCameraPosition(n),a=!0)}a&&(this._updateStateFromCamera(),this.recenterOnTerrain())}getFreeCameraOptions(){this._updateCameraState();let r=this._camera.position,a=new i3;return a.position=new i.ad(r[0],r[1],r[2]),a.orientation=this._camera.orientation,a._elevation=this.elevation,a._renderWorldCopies=this.renderWorldCopies,a}_setCameraOrientation(r){if(!i.c7(r))return!1;i.c8(r,r);let a=i.c9([],[0,0,-1],r),n=i.c9([],[0,-1,0],r);if(n[2]<0)return!1;let o=i2(a,n);return!!o&&(this._camera.orientation=o,!0)}_setCameraPosition(r){let a=this.zoomScale(this.minZoom)*this.tileSize,n=this.zoomScale(this.maxZoom)*this.tileSize,o=this.cameraToCenterDistance;r[2]=i.aB(r[2],o/n,o/a),this._camera.position=r}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,r,a){this._unmodified=!1,this._edgeInsets.interpolate(i,r,a),this._constrain(),this._calcMatrices()}coveringZoomLevel(i){return Math.max(0,(i.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/i.tileSize)))}getVisibleUnwrappedCoordinates(r){let a=[new i.ca(0,r)];if(this.renderWorldCopies){let n=this.pointCoordinate(new i.P(0,0)),o=this.pointCoordinate(new i.P(this.width,0)),s=this.pointCoordinate(new i.P(this.width,this.height)),l=this.pointCoordinate(new i.P(0,this.height)),h=Math.floor(Math.min(n.x,o.x,s.x,l.x)),u=Math.floor(Math.max(n.x,o.x,s.x,l.x));for(let n=h-1;n<=u+1;n++)0!==n&&a.push(new i.ca(n,r))}return a}isLODDisabled(i){return(!i||this.pitch<=60)&&this._edgeInsets.top<=this._edgeInsets.bottom&&!this._elevation&&!this.projection.isReprojectedInTileSpace}extendTileCover(r,a,n,o){let s=[],l=null!=n,h=!l;if(h&&this.zoom<a||l&&0===n[0]&&0===n[1])return s;let u=new Set,c=(r,a,n,o,l)=>{let h=i.cm(a,r,n,o,l);u.has(h)||(s.push(new i.aU(r,a,n,o,l)),u.add(h))};for(let i=0;i<r.length;i++){let s=r[i];if(h&&s.canonical.z!==a||l&&void 0!==o&&o>s.canonical.z)continue;let u=s.canonical,d=s.overscaledZ,p=s.wrap,f=1<<u.z,m=u.x+1<f,_=u.x>
80,g=u.y+1<f,y=u.y>0,x=s.wrap-!_,v=s.wrap+ +!m,b=_?u.x-1:f-1,w=m?u.x+1:0;if(l)n[0]<0?(c(d,v,u.z,w,u.y),n[1]<0&&g&&(c(d,p,u.z,u.x,u.y+1),c(d,v,u.z,w,u.y+1)),n[1]>0&&y&&(c(d,p,u.z,u.x,u.y-1),c(d,v,u.z,w,u.y-1))):n[0]>0?(c(d,x,u.z,b,u.y),n[1]<0&&g&&(c(d,p,u.z,u.x,u.y+1),c(d,x,u.z,b,u.y+1)),n[1]>0&&y&&(c(d,p,u.z,u.x,u.y-1),c(d,x,u.z,b,u.y-1))):n[1]<0&&g?c(d,p,u.z,u.x,u.y+1):y&&c(d,p,u.z,u.x,u.y-1);else{let i=s.visibleQuadrants;1&i&&(c(d,x,u.z,b,u.y),y&&(c(d,p,u.z,u.x,u.y-1),c(d,x,u.z,b,u.y-1))),2&i&&(c(d,v,u.z,w,u.y),y&&(c(d,p,u.z,u.x,u.y-1),c(d,v,u.z,w,u.y-1))),4&i&&(c(d,x,u.z,b,u.y),g&&(c(d,p,u.z,u.x,u.y+1),c(d,x,u.z,b,u.y+1))),8&i&&(c(d,v,u.z,w,u.y),g&&(c(d,p,u.z,u.x,u.y+1),c(d,v,u.z,w,u.y+1)))}}let d=[];for(let i of s)s.some(r=>i.isChildOf(r))||d.push(i);if(s=d.filter(i=>!r.some(r=>!!(i.overscaledZ<a&&r.isChildOf(i))||i.equals(r)||i.isChildOf(r))),h){let i=1<<a,r="globe"===this.projection.name?this._camera.mercatorPosition:this.pointCoordinate(this.getCameraPoint()),n=[i*r.x,i*r.y];s=s.filter(i=>{let r=i.canonical.x+.5-n[0],a=i.canonical.y+.5-n[1];return r*r+a*a<16})}return s}extendTileCoverToNearPlane(r,a,n){let o=[],s=new Set;for(let i of r)s.add(i.key);let l=(r,a,n,l,h)=>{let u=i.cm(a,r,n,l,h);s.has(u)||(o.push(new i.aU(r,a,n,l,h)),s.add(u))},h=r.reduce((i,r)=>Math.max(i,r.overscaledZ),n),u=1<<n,c=[new i.P(0,0),new i.P(i.ak,0),new i.P(i.ak,i.ak),new i.P(0,i.ak)],d=new i.P(0,0),p=new i.P(0,0),f=(r,a)=>{let o=Math.floor(r[0]),s=Math.floor(r[1]),f=(r[0]-o)*i.ak,m=(r[1]-s)*i.ak,_=Math.floor(a[0]),g=Math.floor(a[1]),y=(a[0]-_)*i.ak,x=(a[1]-g)*i.ak;for(let r=-1;r<=1;r++){let a=o+r;if(!(a<0||a>=u)){d.x=f-r*i.ak,p.x=y-(a-_)*i.ak;for(let r=-1;r<=1;r++){let o=s+r;d.y=m-r*i.ak,p.y=x-(o-g)*i.ak,i.cM(d,p,c)&&l(h,0,n,a,o)}}}},m=a.points,_=m[i.cb],g=m[i.cc],y=this._projectToGround(_,m[i.cd]),x=this._projectToGround(g,m[i.ce]);return f(_,y),f(g,x),o}_projectToGround(r,a){return i.cf(i.cg(),r,a,r[2]/(r[2]-a[2]))}_projectToZ(r,a,n){let o=r[2]-a[2];return 1e-6>Math.abs(o)?i.ch(r):i.cf(i.cg(),r,a,(r[2]-n)/o)}extendTileCoverForTunnels(r,a,n,o){if(n<18)return[];let s=a.points,l=s[i.ci],h=s[i.cj],u=s[i.ck],c=s[i.cl];if(u[2]>=0&&c[2]>=0||l[2]<=0||h[2]<=0)return[];let d=u[2]<0?this._projectToZ(l,u,0):u,p=c[2]<0?this._projectToZ(h,c,0):c,f=-o,m=u[2]<f?this._projectToZ(l,u,f):u,_=c[2]<f?this._projectToZ(h,c,f):c,g=this._findExtensionTilesInQuad(r,n,[_,m,p,d],[.5*(d[0]+p[0]),.5*(d[1]+p[1])]);return g.length>3&&(g.length=3),g}_findExtensionTilesInQuad(r,a,n,o){let s=[],l=new Set;for(let i of r)l.add(i.key);let h=r.reduce((i,r)=>Math.max(i,r.overscaledZ),a),u=1<<a,c=[new i.P(n[0][0],n[0][1]),new i.P(n[1][0],n[1][1]),new i.P(n[3][0],n[3][1]),new i.P(n[2][0],n[2][1]),new i.P(n[0][0],n[0][1])],d=n[0][0],p=n[1][0],f=n[2][0],m=n[3][0],_=n[0][1],g=n[1][1],y=n[2][1],x=n[3][1],v=Math.max(0,Math.floor(Math.min(d,p,f,m))),b=Math.min(u-1,Math.ceil(Math.max(d,p,f,m))-1),w=Math.max(0,Math.floor(Math.min(_,g,y,x))),T=Math.min(u-1,Math.ceil(Math.max(_,g,y,x))-1);for(let r=w;r<=T;r++)for(let n=v;n<=b;n++){if(!i.au(c,n,r,n+1,r+1))continue;let o=i.cm(0,h,a,n,r);l.has(o)||(s.push(new i.aU(h,0,a,n,r)),l.add(o))}let S=o[0],E=o[1];return s.sort((i,r)=>{let a=i.canonical.x+.5-S,n=i.canonical.y+.5-E,o=r.canonical.x+.5-S,s=r.canonical.y+.5-E;return a*a+n*n-(o*o+s*s)||i.canonical.x-r.canonical.x||i.canonical.y-r.canonical.y}),s}coveringTiles(r){let a,n=this.coveringZoomLevel(r),o=n,s=this.elevation&&this.elevation.exaggeration(),l=s&&!r.isTerrainDEM,h="mercator"===this.projection.name;if(void 0!==r.minzoom&&n<r.minzoom)return[];void 0!==r.maxzoom&&n>r.maxzoom&&(n=r.maxzoom);let u=this.locationCoordinate(this.center),c=this.center.lat,d=1<<n,p=[d*u.x,d*u.y,0],f="globe"===this.projection.name,m=!f,_=i.cn.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,n,m),g=f?this._camera.mercatorPosition:this.pointCoordinate(this.getCameraPoint()),y=d*i.bY(1,this.center.lat),x=this._camera.position[2]/i.bY(1,this.center.lat),v=[d*g.x,d*g.y,x*(m?1:y)],b=f||s,w=this.cameraToCenterDistance/r.tileSize*(r.roundZoom?1:.502),T=this.isLODDisabled(!0)?n:0;if(this._elevation&&r.isTerrainDEM)a=1e4*this._elevation.exaggeration();else if(this._elevation){let i=this._elevation.getMinMaxForVisibleTiles();a=i?i.max:this._centerAltitude}else a=this._centerAltitude;let S=r.isTerrainDEM?-a:this._elevation?this._elevation.getMinElevationBelowMSL():0,E=this.projection.isReprojectedInTileSpace?i.co(this):1,I=r=>{let a=1/4e4,n=new i.ad(r.x+a,r.y,r.z),o=new i.ad(r.x,r.y+a,r.z),s=r.toLngLat(),l=n.toLngLat(),h=o.toLngLat(),u=this.locationCoordinate(s),c=this.locationCoordinate(l),d=this.locationCoordinate(h);return Math.sqrt(Math.hypot(c.x-u.x,c.y-u.y)*Math.hypot(d.x-u.x,d.y-u.y))*E/a},A=r=>{let n=a;return{aabb:i.cr(this,d,0,0,0,r,S,n,this.projection),zoom:0,x:0,y:0,minZ:S,maxZ:n,wrap:r,fullyVisible:!1}},M=[],C=[],P=n,D=r.reparseOverscaled?o:n,R=(x-this._centerAltitude)*y,z=i=>{if(!this._elevation||!i.tileID||!h)return;let r=this._elevation.getMinMaxForTile(i.tileID),a=i.aabb;r?(a.min[2]=r.min,a.max[2]=r.max,a.center[2]=(a.min[2]+a.max[2])/2):(i.shouldSplit=F(i),i.shouldSplit||(a.min[2]=a.max[2]=a.center[2]=this._centerAltitude))},L=(i,r)=>{if(.707*r<i)return 1;let a=r/i;return a/(1.4144271570014144+(Math.pow(1.1,a-1.4144271570014144+1)-1)/(1.1-1)-1)},F=r=>{if(r.zoom<T)return!0;
8if(r.zoom===P)return!1;if(null!=r.shouldSplit)return r.shouldSplit;let a=r.aabb.distanceX(v),n=r.aabb.distanceY(v),s=R,u=1;if(f){s=r.aabb.distanceZ(v);let a=Math.pow(2,r.zoom),n=Math.min(Math.max(c,i.bZ((r.y+1)/a)),i.bZ(r.y/a)),o=i.cQ(n)/i.cQ(c);if(u=n===c?1/Math.max(1,this._mercatorScaleRatio-.3):Math.min(1,o/this._mercatorScaleRatio),this.zoom<=i.cN&&r.zoom===P-1&&o>=.9)return!0}else if(l&&(s=r.aabb.distanceZ(v)*y),this.projection.isReprojectedInTileSpace&&o<=5){let a=Math.pow(2,r.zoom),n=I(new i.ad((r.x+.5)/a,(r.y+.5)/a));u=n>.85?1:n}if(!h&&!f){let i=Math.sqrt(a*a+n*n+s*s),o=(1<<P-r.zoom)*w*u;return o*=L(Math.max(s,R),i),i<o}let d=Number.MAX_VALUE,m=0,_=r.aabb.getCorners(),g=[0,0,0];for(let r of _){i.aw(g,r,v),f||(l?g[2]*=y:g[2]=R);let a=i.bk(g,this._camera.forward());a<d&&(d=a,m=Math.abs(g[2]))}let x=(1<<P-r.zoom)*w*u;if(x*=L(Math.max(m,R),d),d<x)return!0;let b=r.aabb.closestPoint(p);return b[0]===p[0]&&b[1]===p[1]};if(this.renderWorldCopies)for(let i=1;i<=3;i++)M.push(A(-i)),M.push(A(i));for(M.push(A(0));M.length>0;){let a=M.pop(),o=a.x,s=a.y,u=a.fullyVisible,c=()=>"globe"===this.projection.name&&(0===a.y||a.y===(1<<a.zoom)-1);if(!u){let r=b?a.aabb.intersects(_):a.aabb.intersectsFlat(_);if(0===r&&c()){let n=new i.cp(a.zoom,o,s);r=i.cq(this,d,n,!0).intersects(_)}if(0===r)continue;u=2===r}if(a.zoom===P||!F(a)){let l=a.zoom===P?D:a.zoom;if(r.minzoom&&r.minzoom>l)continue;let h=0;if(!u){let n=b?a.aabb.intersectsPrecise(_):a.aabb.intersectsPreciseFlat(_);if(0===n&&c()){let r=new i.cp(a.zoom,o,s);n=i.cq(this,d,r,!0).intersectsPrecise(_)}if(0===n)continue;if(r.calculateQuadrantVisibility)if(_.containsPoint(a.aabb.center))h=15;else for(let i=0;i<4;i++)0!==a.aabb.quadrant(i).intersects(_)&&(h|=1<<i)}let f=p[0]-(.5+o+(a.wrap<<a.zoom))*(1<<n-a.zoom),m=p[1]-.5-s,g=a.tileID?a.tileID:new i.aU(l,a.wrap,a.zoom,o,s);r.calculateQuadrantVisibility&&(g.visibleQuadrants=h),C.push({tileID:g,distanceSq:f*f+m*m});continue}for(let r=0;r<4;r++){let n=(o<<1)+r%2,c=(s<<1)+(r>>1),p={aabb:h?a.aabb.quadrant(r):i.cr(this,d,a.zoom+1,n,c,a.wrap,a.minZ,a.maxZ,this.projection),zoom:a.zoom+1,x:n,y:c,wrap:a.wrap,fullyVisible:u,tileID:void 0,shouldSplit:void 0,minZ:a.minZ,maxZ:a.maxZ};l&&!f&&(p.tileID=new i.aU(a.zoom+1===P?D:a.zoom+1,a.wrap,a.zoom+1,n,c),z(p)),M.push(p)}}if(this.fogCullDistSq){let n=this.fogCullDistSq,o=this.horizonLineFromTop();C=C.filter(s=>{let l=[0,0,0,1],h=[i.ak,i.ak,0,1],u=this.calculateFogTileMatrix(s.tileID.toUnwrapped());i.aD(l,l,u),i.aD(h,h,u);let c=i.cs([],l,h),d=i.ct([],l,h),p=i.cO(c,d);if(0===p)return!0;let f=!1,m=this._elevation;if(m&&p>n&&0!==o){let n,l=this.calculateProjMatrix(s.tileID.toUnwrapped());r.isTerrainDEM||(n=m.getMinMaxForTile(s.tileID)),n||(n={min:S,max:a});let h=i.cu(this.rotation),u=[h[0]*i.ak,h[1]*i.ak,n.max];i.ae(u,u,l),f=(1-u[1])*this.height*.5<o}return p<n||f})}return C.sort((i,r)=>i.distanceSq-r.distanceSq).map(i=>i.tileID)}resize(i,r){this.width=i,this.height=r,this.pixelsToGLUnits=[2/i,-2/r],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(i){return Math.pow(2,i)}scaleZoom(i){return Math.log2(i)}project(r){let a=i.aB(r.lat,-i.cv,i.cv),n=this.projection.project(r.lng,a);return new i.P(n.x*this.worldSize,n.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/i.bY(1,this.center.lat)/this.worldSize}setLocationAtPoint(r,a){let n,o,s=this.centerPoint;if("globe"===this.projection.name){let i=this.worldSize;n=(a.x-s.x)/i,o=(a.y-s.y)/i}else{let i=this.pointCoordinate(a),r=this.pointCoordinate(s);n=i.x-r.x,o=i.y-r.y}let l=this.locationCoordinate(r);this.setLocation(new i.ad(l.x-n,l.y-o))}setLocation(i){this.center=this.coordinateLocation(i),this.projection.wrap&&(this.center=this.center.wrap())}locationPoint(i,r){return this.projection.locationPoint(this,i,r)}locationPoint3D(i,r){return this.projection.locationPoint(this,i,r,!0)}pointLocation(i){return this.coordinateLocation(this.pointCoordinate(i))}pointLocation3D(i,r){return this.coordinateLocation(this.pointCoordinate3D(i,r))}locationCoordinate(r,a){let n=a?i.bY(a,r.lat):void 0,o=this.projection.project(r.lng,r.lat);return new i.ad(o.x,o.y,n)}coordinateLocation(i){return this.projection.unproject(i.x,i.y)}pointRayIntersection(r,a){let n=null!=a?a:this._centerAltitude,o=[r.x,r.y,0,1],s=[r.x,r.y,1,1];i.aD(o,o,this.pixelMatrixInverse),i.aD(s,s,this.pixelMatrixInverse);let l=s[3];i.cw(o,o,1/o[3]),i.cw(s,s,1/l);let h=o[2],u=s[2];return{p0:o,p1:s,t:h===u?0:(n-h)/(u-h)}}screenPointToMercatorRay(r){let a=[r.x,r.y,0,1],n=[r.x,r.y,1,1];return i.aD(a,a,this.pixelMatrixInverse),i.aD(n,n,this.pixelMatrixInverse),i.cw(a,a,1/a[3]),i.cw(n,n,1/n[3]),a[2]=i.bY(a[2],this._center.lat)*this.worldSize,n[2]=i.bY(n[2],this._center.lat)*this.worldSize,i.cw(a,a,1/this.worldSize),i.cw(n,n,1/this.worldSize),new i.ay([a[0],a[1],a[2]],i.ax([],i.aw([],n,a)))}rayIntersectionCoordinate(r){let{p0:a,p1:n,t:o}=r,s=i.bY(a[2],this._center.lat),l=i.bY(n[2],this._center.lat);return new i.ad(i.aj(a[0],n[0],o)/this.worldSize,i.aj(a[1],n[1],o)/this.worldSize,i.aj(s,l,o))}pointCoordinate(i,r=this._centerAltitude){return this.projection.pointCoordinate(this,i.x,i.y,r)}
8pointCoordinate3D(r,a){if(!this.elevation)return this.pointCoordinate(r,a);let n=this.projection.pointCoordinate3D(this,r.x,r.y);if(n)return new i.ad(n[0],n[1],n[2]);let o=0,s=this.horizonLineFromTop();if(r.y>s)return this.pointCoordinate(r,a);let l=.02*s,h=r.clone();for(let r=0;r<10&&s-o>l;r++){h.y=i.aj(o,s,.66);let r=this.projection.pointCoordinate3D(this,h.x,h.y);r?(s=h.y,n=r):o=h.y}return n?new i.ad(n[0],n[1],n[2]):this.pointCoordinate(r)}isPointAboveHorizon(i){return this.projection.isPointAboveHorizon(this,i)}isPointOnSurface(r){if(r.y<0||r.y>this.height||r.x<0||r.x>this.width)return!1;if(this.elevation||this.zoom>=i.cx)return!this.isPointAboveHorizon(r);let a=this.pointCoordinate(r);return a.y>=0&&a.y<=1}_coordinatePoint(r,a){let n=a&&this.elevation?this.elevation.getAtPointOrZero(r,this._centerAltitude):this._centerAltitude,o=[r.x*this.worldSize,r.y*this.worldSize,n+r.toAltitude(),1];return i.aD(o,o,this.pixelMatrix),o[3]>0?new i.P(o[0]/o[3],o[1]/o[3]):new i.P(Number.MAX_VALUE,Number.MAX_VALUE)}_getBoundsNonRectangular(){let{top:r,left:a}=this._edgeInsets,n=this.height-this._edgeInsets.bottom,o=this.width-this._edgeInsets.right,s=this.pointLocation3D(new i.P(a,r)),l=this.pointLocation3D(new i.P(o,r)),h=this.pointLocation3D(new i.P(o,n)),u=this.pointLocation3D(new i.P(a,n)),c=Math.min(s.lng,l.lng,h.lng,u.lng),d=Math.max(s.lng,l.lng,h.lng,u.lng),p=Math.min(s.lat,l.lat,h.lat,u.lat),f=Math.max(s.lat,l.lat,h.lat,u.lat),m=Math.pow(2,-this.zoom)/16*270,_="globe"===this.projection.name?1:4,g=(r,a,n,o,s)=>{let l=(r+n)/2,h=(a+o)/2,u=new i.P(l,h),{lng:y,lat:x}=this.pointLocation3D(u),v=Math.max(0,c-y,p-x,y-d,x-f);c=Math.min(c,y),d=Math.max(d,y),p=Math.min(p,x),f=Math.max(f,x),(s<_||v>m)&&(g(r,a,l,h,s+1),g(l,h,n,o,s+1))};if(g(a,r,o,r,1),g(o,r,o,n,1),g(o,n,a,n,1),g(a,n,a,r,1),"globe"===this.projection.name){let[r,a]=i.cy(this);r?(f=90,d=180,c=-180):a&&(p=-90,d=180,c=-180)}return new i.aI(new i.aX(c,p),new i.aX(d,f))}_getBoundsRectangular(r,a){let{top:n,left:o}=this._edgeInsets,s=this.height-this._edgeInsets.bottom,l=this.width-this._edgeInsets.right,h=new i.P(o,n),u=new i.P(l,n),c=new i.P(l,s),d=new i.P(o,s),p=this.pointCoordinate(h,r),f=this.pointCoordinate(u,r),m=this.pointCoordinate(c,a),_=this.pointCoordinate(d,a),g=(i,r)=>(r.y-i.y)/(r.x-i.x);return p.y>1&&f.y>=0?p=new i.ad((1-_.y)/g(_,p)+_.x,1):p.y<0&&f.y<=1&&(p=new i.ad(-_.y/g(_,p)+_.x,0)),f.y>1&&p.y>=0?f=new i.ad((1-m.y)/g(m,f)+m.x,1):f.y<0&&p.y<=1&&(f=new i.ad(-m.y/g(m,f)+m.x,0)),(new i.aI).extend(this.coordinateLocation(p)).extend(this.coordinateLocation(f)).extend(this.coordinateLocation(_)).extend(this.coordinateLocation(m))}_getBoundsRectangularTerrain(){let i=this.elevation;if(!i.visibleDemTiles.length||i.isUsingMockSource())return this._getBoundsRectangular(0,0);let r=i.visibleDemTiles.reduce((i,r)=>{if(r.dem){let a=r.dem.tree;i.min=Math.min(i.min,a.minimums[0]),i.max=Math.max(i.max,a.maximums[0])}return i},{min:Number.MAX_VALUE,max:0});return this._getBoundsRectangular(r.min*i.exaggeration(),r.max*i.exaggeration())}getBounds(){return"mercator"===this.projection.name||"equirectangular"===this.projection.name?this._terrainEnabled()?this._getBoundsRectangularTerrain():this._getBoundsRectangular(0,0):this._getBoundsNonRectangular()}horizonLineFromTop(i=!0){let r=this.height/2/Math.tan(this._fov/2)/Math.tan(Math.max(this._pitch,.1))-this.centerOffset.y,a=this.height/2-r*(1-this._horizonShift);return i?Math.max(0,a):a}getMaxBounds(){return this.maxBounds}setMaxBounds(r){this.maxBounds=r,this.minLat=-i.cv,this.maxLat=i.cv,this.minLng=-180,this.maxLng=180,r&&(this.minLat=r.getSouth(),this.maxLat=r.getNorth(),this.minLng=r.getWest(),this.maxLng=r.getEast(),this.maxLng<this.minLng&&(this.maxLng+=360)),this.worldMinX=i.aG(this.minLng)*this.tileSize,this.worldMaxX=i.aG(this.maxLng)*this.tileSize,this.worldMinY=i.aJ(this.maxLat)*this.tileSize,this.worldMaxY=i.aJ(this.minLat)*this.tileSize,this._constrain()}calculatePosMatrix(i,r){return this.projection.createTileMatrix(this,r,i)}calculateDistanceTileData(r){let a=r.key,n=this._distanceTileDataCache;
8if(n[a])return n[a];let o=r.canonical,s=1/this.height,l=this.cameraWorldSize,h=l/this.zoomScale(o.z),u=(o.x+Math.pow(2,o.z)*r.wrap)*h,c=o.y*h,d=this.point;d.x*=l/this.worldSize,d.y*=l/this.worldSize;let p=this.angle,f=Math.sin(-p),m=-Math.cos(-p);return n[a]={bearing:[f,m],center:[(d.x-u)*s,(d.y-c)*s],scale:h/i.ak*s},n[a]}calculateFogTileMatrix(r){let a=r.key,n=this._fogTileMatrixCache;if(n[a])return n[a];let o=this.projection.createTileMatrix(this,this.cameraWorldSizeForFog,r);return i.aC(o,this.worldToFogMatrix,o),n[a]=new Float32Array(o),n[a]}calculateProjMatrix(r,a=!1,n=!1){let o,s,l=r.key;if((o=n?this._expandedProjMatrixCache:a?this._alignedProjMatrixCache:this._projMatrixCache)[l])return o[l];let h=this.calculatePosMatrix(r,this.worldSize);return s=this.projection.isReprojectedInTileSpace?this.mercatorMatrix:n?this.expandedFarZProjMatrix:a?this.alignedProjMatrix:this.projMatrix,i.aC(h,s,h),o[l]=new Float32Array(h),o[l]}calculatePixelsToTileUnitsMatrix(r){let a=r.tileID.key,n=this._pixelsToTileUnitsCache;if(n[a])return n[a];let o=i.cz(r,this);return n[a]=o,n[a]}customLayerMatrix(){return this.mercatorMatrix.slice()}globeToMercatorMatrix(){if("globe"===this.projection.name){let r=1/this.worldSize,a=i.bT([],[r,r,r]);return i.aC(a,a,this.globeMatrix),a}}recenterOnTerrain(){if(!this._elevation||"globe"===this.projection.name)return;let r=this._elevation;this._updateCameraState();let a=i.bY(1,this._center.lat)*this.worldSize,n=this._computeCameraPosition(a),o=this._camera.forward(),s=i.bY(1,this._center.lat);n[2]/=s,o[2]/=s,i.ax(o,o);let l=r.raycast(n,o,r.exaggeration());if(l){let r=i.bi([],n,o,l),a=new i.ad(r[0],r[1],i.bY(r[2],i.bZ(r[1]))),h=(a.z+i.af([a.x-n[0],a.y-n[1],a.z-n[2]*s]))*this._pixelsPerMercatorPixel;this._seaLevelZoom=this._zoomFromMercatorZ(h),this._centerAltitude=a.toAltitude(),this._center=this.coordinateLocation(a),this._updateZoomFromElevation(),this._constrain(),this._calcMatrices()}}_constrainCamera(r=!1){if(!this._elevation)return;let a=this._elevation,n=i.bY(1,this._center.lat)*this.worldSize,o=this._computeCameraPosition(n),s=a.getAtPointOrZero(new i.ad(...o)),l=this.pixelsPerMeter/this.worldSize*s,h=this._minimumHeightOverTerrain(),u=o[2]-l;if(u<=h)if(u<0||r){let r=this.locationCoordinate(this._center,this._centerAltitude),a=[o[0],o[1],r.z-o[2]],n=i.af(a);a[2]-=(h-u)/this._pixelsPerMercatorPixel;let s=i.af(a);if(0===s)return;i.bN(a,a,n/s*this._pixelsPerMercatorPixel),this._camera.position=[o[0],o[1],r.z*this._pixelsPerMercatorPixel-a[2]],this._updateStateFromCamera()}else this._isCameraConstrained=!0}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;let r="globe"===this.projection.name||this.mercatorFromTransition;if(this.projection.isReprojectedInTileSpace||r){let a=this.center;return a.lat=i.aB(a.lat,this.minLat,this.maxLat),!this.maxBounds&&(this.renderWorldCopies||r)||(a.lng=i.aB(a.lng,this.minLng,this.maxLng)),this.center=a,void(this._constraining=!1)}let a=this._unmodified,{x:n,y:o}=this.point,s=0,l=n,h=o,u=this.width/2,c=this.height/2,d=this.worldMinY*this.scale,p=this.worldMaxY*this.scale;if(o-c<d&&(h=d+c),o+c>p&&(h=p-c),p-d<this.height&&(s=Math.max(s,this.height/(p-d)),h=(p+d)/2),this.maxBounds||!this._renderWorldCopies||!this.projection.wrap){let i=this.worldMinX*this.scale,r=this.worldMaxX*this.scale,a=this.worldSize/2-(i+r)/2;(l=(n+a+this.worldSize)%this.worldSize-a)-u<i&&(l=i+u),l+u>r&&(l=r-u),r-i<this.width&&(s=Math.max(s,this.width/(r-i)),l=(r+i)/2)}l===n&&h===o||this._allowWorldUnderZoom||(this.center=this.unproject(new i.P(l,h))),s&&!this._allowWorldUnderZoom&&(this.zoom+=this.scaleZoom(s)),this._constrainCamera(),this._unmodified=a,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(){let r;if(!this.height)return;let a=this.centerOffset,n="globe"===this.projection.name,o=this.pixelsPerMeter;"globe"===this.projection.name&&(this._mercatorScaleRatio=i.bY(1,this.center.lat)/i.bY(1,i.cR));let s=i.cA(this.projection,this.zoom,this.width,this.height,1024);this._pixelsPerMercatorPixel=this.projection.pixelSpaceConversion(this.center.lat,this.worldSize,s),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;let l="meters"===this.projection.zAxisUnit?o:1,h=this._camera.getWorldToCamera(this.worldSize,l),u=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,this._farZ);if(u[8]=-(2*a.x)/this.width,u[9]=2*a.y/this.height,this.isOrthographic){let n=.5*this.height/Math.tan(this._fov/2)*1*Math.tan(.5*this._fov),o=n*this.aspect,s=-o,l=-n;o-=a.x,s-=a.x,n+=a.y,l+=a.y,((r,a,n,o)=>{for(let s=0;s<16;s++)r[s]=i.aj(a[s],n[s],o)})(r=this._camera.getCameraToClipOrthographic(s,o,l,n,this._nearZ+this._nearClipOffset,this._farZ),r,u,i.cP(this.pitch>=15?1:this.pitch/15))}else r=u;let c=i.cB([],u,h),d=i.cB([],r,h);if(this.projection.isReprojectedInTileSpace){let r=this.locationCoordinate(this.center);i.bA(this._mat4Scratch);let a=this._mat4Scratch;i.bB(a,a,[r.x*this.worldSize,r.y*this.worldSize,0]),i.aC(a,a,i.cC(this)),i.bB(a,a,[-r.x*this.worldSize,-r.y*this.worldSize,0]),i.aC(d,d,a),i.aC(c,c,a),this.inverseAdjustmentMatrix=i.cD(this)}else this.inverseAdjustmentMatrix=[1,0,0,1];if(i.cE(this.mercatorMatrix,d,[this.worldSize,this.worldSize,this.worldSize/l,1]),this.projMatrix=d,i.ba(this.invProjMatrix,this.projMatrix),n){let r=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,1/0);r[8]=-(2*a.x)/this.width,r[9]=2*a.y/this.height,i.cB(this._expandedFarZProjMatrixBuf,r,h),this.expandedFarZProjMatrix=this._expandedFarZProjMatrixBuf}else this.expandedFarZProjMatrix=this.projMatrix;i.ba(this._mat4Scratch,r),this.frustumCorners=i.cF.fromInvProjectionMatrix(this._mat4Scratch,this.horizonLineFromTop(),this.height),this.cameraFrustum=i.cn.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,0,!n),i.bT(this.skyboxMatrix,[1,-1,1]),i.cG(this.skyboxMatrix,this.skyboxMatrix,this._pitch),i.bc(this.skyboxMatrix,this.skyboxMatrix,this.angle),i.bW(this.starsProjMatrix,this._fov,this.width/this.height,this._nearZ,this._farZ);let p=(Math.PI/2-this._pitch)*(this.height/this._fov)*this._horizonShift;i.cH(this._mat4Scratch,this.starsProjMatrix),this._mat4Scratch[8]=-(2*a.x)/this.width,this._mat4Scratch[9]=2*(a.y+p)/this.height,i.aC(this.skyboxMatrix,this._mat4Scratch,this.skyboxMatrix);let f=this.point,m=f.x,_=f.y,g=this.width%2/2,y=this.height%2/2,x=Math.cos(this.angle),v=Math.sin(this.angle),b=m-Math.round(m)+x*g+v*y,w=_-Math.round(_)+x*y+v*g;if(i.cH(this.alignedProjMatrix,d),i.bB(this.alignedProjMatrix,this.alignedProjMatrix,[b>.5?b-1:b,w>
8.5?w-1:w,0]),i.bT(this.labelPlaneMatrix,[this.width/2,-this.height/2,1]),i.bB(this.labelPlaneMatrix,this.labelPlaneMatrix,[1,-1,0]),i.bT(this.glCoordMatrix,[1,-1,1]),i.bB(this.glCoordMatrix,this.glCoordMatrix,[-1,-1,0]),i.cE(this.glCoordMatrix,this.glCoordMatrix,[2/this.width,2/this.height,1]),i.aC(this.pixelMatrix,this.labelPlaneMatrix,c),this._calcFogMatrices(),this._distanceTileDataCache={},!i.ba(this.pixelMatrixInverse,this.pixelMatrix))throw Error("failed to invert matrix");if("globe"===this.projection.name||this.mercatorFromTransition){this.globeMatrix=i.cI(this);let r=[this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]];this.globeCenterInViewSpace=i.ae(r,r,h),this.globeRadius=this.worldSize/2/Math.PI-1}else this.globeMatrix=this.pixelMatrixInverse;this._projMatrixCache={},this._alignedProjMatrixCache={},this._pixelsToTileUnitsCache={},this._expandedProjMatrixCache={}}_calcFogMatrices(){this._fogTileMatrixCache={};let r=this.cameraWorldSizeForFog,a=this.cameraPixelsPerMeter,n=this._camera.position,o=1/this.height/this._pixelsPerMercatorPixel,s=[r,r,a];i.bN(s,s,o),i.bN(n,n,-1),i.cJ(n,n,s),i.cK(this.mercatorFogMatrix,n),i.cE(this.mercatorFogMatrix,this.mercatorFogMatrix,s),this.worldToFogMatrix=this._camera.getWorldToCameraPosition(r,a,o)}_computeCameraPosition(i){let r=(i=i||this.pixelsPerMeter)/this.pixelsPerMeter,a=this._camera.forward(),n=this.point,o=this._mercatorZfromZoom(this._seaLevelZoom?this._seaLevelZoom:this._zoom)*r-i/this.worldSize*this._centerAltitude;return[n.x/this.worldSize-a[0]*o,n.y/this.worldSize-a[1]*o,i/this.worldSize*this._centerAltitude-a[2]*o]}_updateCameraState(){this.height&&(this._camera.setPitchBearing(this._pitch,this.angle),this._camera.position=this._computeCameraPosition())}_translateCameraConstrained(r){let a=this._maxCameraBoundsDistance()*Math.cos(this._pitch),n=this._camera.position[2],o=r[2],s=1;this.projection.wrap&&(this.center=this.center.wrap()),o>0&&(s=Math.min((a-n)/o,1)),this._camera.position=i.bi([],this._camera.position,r,s),this._updateStateFromCamera()}_updateStateFromCamera(){let r=this._camera.position,a=this._camera.forward(),{pitch:n,bearing:o}=this._camera.getPitchBearing(),s=i.bY(this._centerAltitude,this.center.lat)*this._pixelsPerMercatorPixel,l=this._mercatorZfromZoom(this._maxZoom)*Math.cos(i.am(this._maxPitch)),h=Math.max((r[2]-s)/Math.cos(n),l),u=this._zoomFromMercatorZ(h);i.bi(r,r,a,h),this._pitch=i.aB(n,i.am(this.minPitch),i.am(this.maxPitch)),this.angle=i.bv(o,-Math.PI,Math.PI),this._setZoom(i.aB(u,this._minZoom,this._maxZoom)),this._updateSeaLevelZoom(),this._center=this.coordinateLocation(new i.ad(r[0],r[1],r[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(){let i=Math.min(null!=this._seaLevelZoom?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(r){let a=0,n=i.cx,o=0,s=1/0;for(;n-a>1e-6&&n>a;){let i=a+.5*(n-a),l=this.tileSize*Math.pow(2,i),h=this.getCameraToCenterDistance(this.projection,i,l),u=this.scaleZoom(h/(Math.max(0,r)*this.tileSize)),c=Math.abs(i-u);c<s&&(s=c,o=i),i<u?a=i:n=i}return o}_terrainEnabled(){return!(!this._elevation||!this.projection.supportsTerrain&&(i.w("Terrain is not yet supported with alternate projections. Use mercator or globe to enable terrain."),1))}anyCornerOffEdge(r,a){let n=Math.min(r.x,a.x),o=Math.max(r.x,a.x),s=Math.min(r.y,a.y),l=Math.max(r.y,a.y);if(s<this.horizonLineFromTop(!1))return!0;if("mercator"!==this.projection.name)return!1;let h=[new i.P(n,s),new i.P(o,l),new i.P(n,l),new i.P(o,s)],u=this.renderWorldCopies?-3:0,c=this.renderWorldCopies?4:1;for(let i of h){let r=this.pointRayIntersection(i);if(r.t<0)return!0;let a=this.rayIntersectionCoordinate(r);if(a.x<u||a.y<0||a.x>c||a.y>1)return!0}return!1}isHorizonVisible(){return this.pitch+i.cL(this.fovAboveCenter)>88||this.anyCornerOffEdge(new i.P(0,0),new i.P(this.width,this.height))}zoomDeltaToMovement(r,a){let n=i.af(i.aw([],this._camera.position,r)),o=this._zoomFromMercatorZ(n)+a;return n-this._mercatorZfromZoom(o)}getCameraPoint(){if("globe"===this.projection.name){let r=function([r,a,n],o){let s=[r,a,n,1];i.aD(s,s,o);let l=s[3]=Math.max(s[3],1e-6);return s[0]/=l,s[1]/=l,s[2]/=l,s}([this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]],this.pixelMatrix);return new i.P(r[0],r[1])}{let r=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new i.P(0,r))}}getCameraToCenterDistance(r,a=this.zoom,n=this.worldSize){let o=i.cA(r,a,this.width,this.height,1024),s=r.pixelSpaceConversion(this.center.lat,n,o),l=.5/Math.tan(.5*this._fov)*this.height*s;return this.isOrthographic&&(l=i.aj(1,l,i.cP(this.pitch>=15?1:this.pitch/15))),l}getWorldToCameraMatrix(){let r=this._camera.getWorldToCamera(this.worldSize,"meters"===this.projection.zAxisUnit?this.pixelsPerMeter:1);return"globe"===this.projection.name&&i.aC(r,r,this.globeMatrix),r}getFrustum(r){return i.cn.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,r,"meters"===this.projection.zAxisUnit)}}let i9=(r,a)=>{if(a>0&&r.terrain&&i.w("Cutoff is currently disabled on terrain"),a<=0||r.terrain)return{shouldRenderCutoff:!1,uniformValues:{u_cutoff_params:[0,0,0,1]}};let n=r.transform,o=n.pitch,s=n.isLODDisabled(!1)?60:30;if(o<s-15)return{shouldRenderCutoff:!1,uniformValues:{u_cutoff_params:[0,0,0,1]}};let l=n._farZ-n._nearZ,h=a*n.height*1.3,u=Math.pow(2,.85*Math.max(n._zoom-r.minCutoffZoom,0)),c=1.4*n.cameraToCenterDistance*u,d=i.ag(s-15,s,o),p=(1-d)*(n._farZ+h
8)+d*c,f=Math.min(h,p-n._nearZ);return{shouldRenderCutoff:d>0,uniformValues:{u_cutoff_params:[n._nearZ,n._farZ,(p-n._nearZ)/l,(p-f-n._nearZ)/l]}}},i7=[];function re(i){return i7[i]=i7[i]||new Float64Array(16)}class rt{constructor(i,r){this.aabb=i,this.lastCascade=r}}class ri{add(i,r){let a=this.receivers[i.key];void 0!==a?(a.aabb.min[0]=Math.min(a.aabb.min[0],r.min[0]),a.aabb.min[1]=Math.min(a.aabb.min[1],r.min[1]),a.aabb.min[2]=Math.min(a.aabb.min[2],r.min[2]),a.aabb.max[0]=Math.max(a.aabb.max[0],r.max[0]),a.aabb.max[1]=Math.max(a.aabb.max[1],r.max[1]),a.aabb.max[2]=Math.max(a.aabb.max[2],r.max[2])):this.receivers[i.key]=new rt(r,null)}clear(){this.receivers={}}get(i){return this.receivers[i.key]}computeRequiredCascades(r,a,n){let o=i.cY.fromPoints(r.points),s=0;for(let r in this.receivers){let l=this.receivers[r];if(!l||!o.intersectsAabb(l.aabb))continue;l.aabb.min=o.closestPoint(l.aabb.min),l.aabb.max=o.closestPoint(l.aabb.max);let h=l.aabb.getCorners();for(let r=0;r<n.length;r++){let o=!0;for(let s of h){let l=[s[0]*a,s[1]*a,s[2]];if(i.ae(l,l,n[r].matrix),l[0]<-1||l[0]>1||l[1]<-1||l[1]>1){o=!1;break}}if(l.lastCascade=r,s=Math.max(s,r),o)break}}return s+1}}class rr{constructor(i){this.painter=i,this._enabled=!1,this._drawShadowAfterLayer=-1,this._numCascadesToRender=0,this._cascades=[],this._groundShadowTiles=[],this._receivers=new ri,this._depthMode=new iJ(i.context.gl.LEQUAL,iJ.ReadWrite,[0,1]),this._uniformValues={u_light_matrix_0:new Float32Array(16),u_light_matrix_1:new Float32Array(16),u_shadow_intensity:0,u_fade_range:[0,0],u_shadow_normal_offset:[1,1,1],u_shadow_texel_size:1,u_shadow_map_resolution:1,u_shadow_direction:[0,0,1],u_shadow_bias:[36e-5,.0012,.012],u_shadowmap_0:0,u_shadowmap_1:0},this._forceDisable=!1,this._devtoolsFolder=null,this.useNormalOffset=!1,this._shadowParameters={cascadeCount:2,normalOffset:3,shadowMapResolution:2048}}destroy(){for(let i of this._cascades)i.texture.destroy(),i.framebuffer.destroy();this._cascades=[]}updateShadowParameters(r,a){let n=this.painter;if(this._enabled=!1,this._drawShadowAfterLayer=-1,this._receivers.clear(),!a||!a.properties)return;let o=a.properties.get("shadow-intensity"),s=a.properties.get("shadow-draw-before-layer");if(!a.shadowsEnabled()||o<=0)return;let l=-1,h=0;for(let i of n.style.order){let a=n.style._mergedLayers[i];a.hasShadowPass()&&!a.isHidden(r.zoom)&&(l=h),s&&(s===i||s===a.slot)&&(this._drawShadowAfterLayer=h>0?h-1:0),h+=1}if(this._enabled=l>=0,!this.enabled)return;this._drawShadowAfterLayer<0&&(this._drawShadowAfterLayer=l);let u=n.context,c=this._shadowParameters.shadowMapResolution,d=this._shadowParameters.shadowMapResolution;if(0===this._cascades.length||this._shadowParameters.shadowMapResolution!==this._cascades[0].texture.size[0]){this._cascades=[];for(let r=0;r<this._shadowParameters.cascadeCount;++r){let r=u.gl,a=u.createFramebuffer(c,d,0,"texture"),n=new i.T(u,{width:c,height:d,data:null},r.DEPTH_COMPONENT16);a.depthAttachment.set(n.texture),this._cascades.push({framebuffer:a,texture:n,matrix:[],far:0,boundingSphereRadius:0,frustum:new i.cn,scale:0})}}this.shadowDirection=rn(a);let p=0;if(r.elevation){let i=r.elevation,a=[1e4,-1e4];i.visibleDemTiles.filter(i=>i.dem).forEach(i=>{let r=i.dem.tree;a[0]=Math.min(a[0],r.minimums[0]),a[1]=Math.max(a[1],r.maximums[0])}),1e4!==a[0]&&(p=(a[1]-a[0])*i.exaggeration())}let f=1.5*r.cameraToCenterDistance,m=3*f,_=new Float64Array(16);for(let a=0;a<this._cascades.length;++a){let n=this._cascades[a],o=r.height/50,s=1;1===this._shadowParameters.cascadeCount?s=m:0===a?s=f:(o=f,s=m);let[l,h]=function(r,a,n,o,s,l){let h,u,c=r.zoom,d=r.scale,p=r.worldSize,f=1/p,m=r.aspect,_=Math.sqrt(1+m*m)*Math.tan(.5*r.fovX),g=_*_,y=o-n,x=o+n;g>y/x?(h=o,u=o*_):(h=.5*x*(1+g),u=.5*Math.sqrt(y*y+2*(o*o+n*n)*g+x*x*g*g));let v=r.projection.pixelsPerMeter(r.center.lat,p),b=r._camera.getCameraToWorldMercator(),w=[0,0,-h*f];i.ae(w,w,b);let T=u*f,S=r._edgeInsets;if((0!==S.left||0!==S.top||0!==S.right||0!==S.bottom)&&(S.left!==S.right||S.top!==S.bottom)){let a=r._camera.getWorldToCamera(r.worldSize,"meters"===r.projection.zAxisUnit?v:1),s=r._camera.getCameraToClipPerspective(r._fov,r.width/r.height,n,o);s[8]=-(2*r.centerOffset.x)/r.width,s[9]=2*r.centerOffset.y/r.height;let l=new Float64Array(16);i.cB(l,s,a);let h=new Float64Array(16);for(let a of(i.ba(h,l),i.cn.fromInvProjectionMatrix(h,p,c,!0).points)){let n=(a[0]/=d,a[1]/=d,a[2]=i.bY(a[2],r._center.lat),a);T=Math.max(T,i.bO(i.cZ([],w,n)))}}T*=s/(s-1);let E=Math.acos(a[2]),I=Math.atan2(-a[0],-a[1]),A=new i5;
8A.position=w,A.setPitchBearing(E,I);let M=A.getWorldToCamera(p,v),C=T*p,P=Math.min(-(r._mercatorZfromZoom(17)*p*2),-2*C),D=A.getCameraToClipOrthographic(-C,C,-C,C,P,(C+l*v)/a[2]),R=new Float64Array(16);i.aC(R,D,M);let z=i.cU(Math.floor(1e6*w[0])/1e6*p,Math.floor(1e6*w[1])/1e6*p,0),L=.5*s,F=[0,0,0];i.ae(F,z,R),i.bN(F,F,L);let O=[Math.floor(F[0]),Math.floor(F[1]),Math.floor(F[2])],B=[0,0,0];i.aw(B,F,O),i.bN(B,B,-1/L);let k=new Float64Array(16);return i.bA(k),i.bB(k,k,B),i.aC(R,k,R),[R,C]}(r,this.shadowDirection,o,s,this._shadowParameters.shadowMapResolution,p);n.scale=r.scale,n.matrix=l,n.boundingSphereRadius=h,i.ba(_,n.matrix),n.frustum=i.cn.fromInvProjectionMatrix(_,1,0,!0),n.far=s}let g=this._cascades.length-1;this._uniformValues.u_fade_range=[.75*this._cascades[g].far,this._cascades[g].far],this._uniformValues.u_shadow_intensity=o,this._uniformValues.u_shadow_direction=[this.shadowDirection[0],this.shadowDirection[1],this.shadowDirection[2]],this._uniformValues.u_shadow_texel_size=1/this._shadowParameters.shadowMapResolution,this._uniformValues.u_shadow_map_resolution=this._shadowParameters.shadowMapResolution,this._uniformValues.u_shadowmap_0=11,this._uniformValues.u_shadowmap_1=12,this._groundShadowTiles=n.transform.coveringTiles({tileSize:512,renderWorldCopies:!0});let y=n.transform.elevation;for(let i of this._groundShadowTiles){let r={min:0,max:0};if(y){let a=y.getMinMaxForTile(i);a&&(r=a)}this.addShadowReceiver(i.toUnwrapped(),r.min,r.max)}}get enabled(){return this._enabled&&!this._forceDisable}set enabled(i){this._enabled=i}drawShadowPass(r,a){if(!this.enabled)return;let n=this.painter,o=n.context;this._numCascadesToRender=this._receivers.computeRequiredCascades(n.transform.getFrustum(0),n.transform.worldSize,this._cascades),o.viewport.set([0,0,this._shadowParameters.shadowMapResolution,this._shadowParameters.shadowMapResolution]);for(let s=0;s<this._numCascadesToRender;++s)for(let l of(n.currentShadowCascade=s,o.bindFramebuffer.set(this._cascades[s].framebuffer.framebuffer),o.clear({color:i.C.white,depth:1}),r.order)){let i=r._mergedLayers[l];if(!i.hasShadowPass()||i.isHidden(n.transform.zoom))continue;let o=r.getLayerSourceCache(i),s=o?a[o.id]:void 0;("model"===i.type||s&&s.length)&&n.renderLayer(n,o,i,s)}n.currentShadowCascade=0}drawGroundShadows(){if(!this.enabled)return;let i=this.painter,r=i.style,a=i.context,n=a.gl,o=r.directionalLight,s=r.ambientLight;if(!o||!s)return;let l=[],h=i9(i,i.longestCutoffRange);h.shouldRenderCutoff&&l.push("RENDER_CUTOFF"),l.push("RENDER_SHADOWS"),this.useNormalOffset&&l.push("NORMAL_OFFSET");let u=ro(r,o,s),c=new iJ(n.LEQUAL,iJ.ReadOnly,i.depthRangeFor3D),d=new iK({func:n.EQUAL,mask:255},0,255,n.KEEP,n.KEEP,n.KEEP);for(let r of this._groundShadowTiles){let o=r.toUnwrapped(),s=i.isTileAffectedByFog(r),p=i.getOrCreateProgram("groundShadow",{defines:l,overrideFog:s});this.setupShadows(o,p),i.uploadCommonUniforms(a,p,o,null,h);let f=i4(i.transform.calculateProjMatrix(o),u);p.draw(i,n.TRIANGLES,c,d,iY.multiply,iQ.disabled,f,"ground_shadow",i.tileExtentBuffer,i.quadTriangleIndexBuffer,i.tileExtentSegments,null,i.transform.zoom,null,null)}}getShadowPassDepthMode(){return this._depthMode}getGroundShadowLayerIndex(){return this._drawShadowAfterLayer}calculateShadowPassMatrixFromTile(r){let a=this.painter.transform,n=a.calculatePosMatrix(r,a.worldSize);return i.aC(n,this._cascades[this.painter.currentShadowCascade].matrix,n),Float32Array.from(n)}calculateShadowPassMatrixFromMatrix(r){let a=i.bb(r);return i.aC(a,this._cascades[this.painter.currentShadowCascade].matrix,r),a}setupShadows(r,a,n){if(!this.enabled)return;let o=this.painter.transform,s=this.painter.context,l=s.gl,h=this._uniformValues,u=o.calculatePosMatrix(r,o.worldSize);for(let r=0;r<this._cascades.length;r++){let a=re(r);i.aC(a,this._cascades[r].matrix,u),h[0===r?"u_light_matrix_0":"u_light_matrix_1"]=a,s.activeTexture.set(l.TEXTURE0+11+r),this._cascades[r].texture.bindExtraParam(l.LINEAR,l.LINEAR,l.CLAMP_TO_EDGE,l.CLAMP_TO_EDGE,l.GREATER)}if(this.useNormalOffset=!!n,this.useNormalOffset){let a=i.cW(r.canonical),s=2/o.tileSize*i.ak/this._shadowParameters.shadowMapResolution,l=s*this._cascades[0].boundingSphereRadius,u=s*this._cascades.at(-1).boundingSphereRadius,c=("vector-tile"===n?1:3)*function(r){let a=i.aB(-((r-22)/22),0,1);return .125*(1-a)+4*a}(o.zoom);h.u_shadow_normal_offset=[a,l*c,u*c],h.u_shadow_bias=[1e-4,.0012,.012]}else h.u_shadow_bias=[36e-5,.0012,.012];a.setShadowUniformValues(s,h)}
8setupShadowsFromMatrix(r,a,n=!1){if(!this.enabled)return;let o=this.painter.context,s=o.gl,l=this._uniformValues;for(let a=0;a<this._shadowParameters.cascadeCount;a++){let n=re(a);i.aC(n,this._cascades[a].matrix,r),l[0===a?"u_light_matrix_0":"u_light_matrix_1"]=n,o.activeTexture.set(s.TEXTURE0+11+a),this._cascades[a].texture.bindExtraParam(s.LINEAR,s.LINEAR,s.CLAMP_TO_EDGE,s.CLAMP_TO_EDGE,s.GREATER)}if(this.useNormalOffset=n,n){let i=this._shadowParameters.normalOffset;l.u_shadow_normal_offset=[1,i,i],l.u_shadow_bias=[6e-5,.0012,.012]}else l.u_shadow_bias=[36e-5,.0012,.012];a.setShadowUniformValues(o,l)}getShadowUniformValues(){return this._uniformValues}getCurrentCascadeFrustum(){return this._cascades[this.painter.currentShadowCascade].frustum}computeSimplifiedTileShadowVolume(r,a,n,o){if(o[2]>=0)return{};let s=(function(r,a,n){let o=n/(1<<r.canonical.z);return new i.cY([r.canonical.x*o+r.wrap*n,r.canonical.y*o+r.wrap*n,0],[(r.canonical.x+1)*o+r.wrap*n,(r.canonical.y+1)*o+r.wrap*n,a])})(r,a,n).getCorners(),l=-(a/o[2]);o[0]<0?(i.cX(s[0],s[0],[o[0]*l,0,0]),i.cX(s[3],s[3],[o[0]*l,0,0])):o[0]>0&&(i.cX(s[1],s[1],[o[0]*l,0,0]),i.cX(s[2],s[2],[o[0]*l,0,0])),o[1]<0?(i.cX(s[0],s[0],[0,o[1]*l,0]),i.cX(s[1],s[1],[0,o[1]*l,0])):o[1]>0&&(i.cX(s[2],s[2],[0,o[1]*l,0]),i.cX(s[3],s[3],[0,o[1]*l,0]));let h={};return h.vertices=s,h.planes=[ra(s[1],s[0],s[4]),ra(s[2],s[1],s[5]),ra(s[3],s[2],s[6]),ra(s[0],s[3],s[7])],h}addShadowReceiver(r,a,n){this._receivers.add(r,i.cY.fromTileIdAndHeight(r,a,n))}getMaxCascadeForTile(i){let r=this._receivers.get(i);return r&&r.lastCascade?r.lastCascade:0}}function ra(r,a,n){let o=i.aw([],n,a),s=i.aw([],r,a),l=i.bj([],o,s),h=i.af(l);return 0===h?[0,0,1,0]:(i.bN(l,l,1/h),[l[0],l[1],l[2],-i.bk(l,a)])}function rn(r){let a=r.properties.get("direction"),n=i.cT(a.x,a.y,a.z);n[2]=i.aB(n[2],0,75);let o=i.cV([n[0],n[1],n[2]]);return i.cU(o.x,o.y,o.z)}function ro(r,a,n){let o="none"===a.properties.get("color-use-theme"),s=a.properties.get("color"),l=a.properties.get("intensity"),h=a.properties.get("direction"),u=[h.x,h.y,h.z],c="none"===n.properties.get("color-use-theme"),d=n.properties.get("color"),p=n.properties.get("intensity"),f=Math.max(i.bk([0,0,1],u),0),m=[0,0,0];i.bN(m,d.toPremultipliedRenderColor(c?null:r.getLut(a.scope)).toArray01Linear().slice(0,3),p);let _=[0,0,0];return i.bN(_,s.toPremultipliedRenderColor(o?null:r.getLut(n.scope)).toArray01Linear().slice(0,3),f*l),i.c_([m[0]>0?m[0]/(m[0]+_[0]):0,m[1]>0?m[1]/(m[1]+_[1]):0,m[2]>0?m[2]/(m[2]+_[2]):0])}class rs extends i.E{constructor(i){super(),this.requestManager=i,this.models={"":{}},this.modelUris={"":{}},this.modelByURL={},this.numModelsLoading={}}loadModel(r,a){return i.c$(this.requestManager.transformRequest(a,i.R.Model).url).then(n=>{let o=i.d0(n),s=new i.d1(r,a,void 0,void 0,o);return s.computeBoundsAndApplyParent(),s}).catch(n=>{if(n&&404===n.status)return null;this.fire(new i.y(Error(`Could not load model ${r} from ${a}: ${n.message}`)))})}load(r,a,n={forceReload:!1}){this.models[a]||(this.models[a]={});let o=Object.keys(r),s=[],l=[];for(let i of o){let o=r[i];this.hasURLBeenRequested(o)&&!n.forceReload||(this.modelByURL[o]={modelId:i,scope:a},s.push(this.loadModel(i,o)),l.push(i)),this.models[a][i]||(this.models[a][i]={model:null,numReferences:1})}this.numModelsLoading[a]=(this.numModelsLoading[a]||0)+l.length,Promise.allSettled(s).then(r=>{for(let i=0;i<r.length;i++){let{status:n}=r[i];if("rejected"===n)continue;let{value:o}=r[i];this.models[a][l[i]]||(this.models[a][l[i]]={model:null,numReferences:1}),this.models[a][l[i]].model=o}this.numModelsLoading[a]-=l.length,this.fire(new i.z("data",{dataType:"style"}))}).catch(r=>{this.fire(new i.y(Error(`Could not load models: ${r.message}`)))})}isLoaded(){for(let i in this.numModelsLoading)if(this.numModelsLoading[i]>0)return!1;return!0}hasModel(i,r,a={exactIdMatch:!1}){return!!(a.exactIdMatch?this.getModel(i,r):this.getModelByURL(this.modelUris[r][i]))}getModel(i,r){return this.models[r]||(this.models[r]={}),this.models[r][i]?this.models[r][i].model:void 0}getModelByURL(i){if(!i)return null;let r=this.modelByURL[i];return r?this.models[r.scope][r.modelId].model:null}hasModelBeenAdded(i,r){return this.models[r]&&void 0!==this.models[r][i]}getModelURIs(i){return this.modelUris[i]||{}}addModel(i,r,a){this.models[a]||(this.models[a]={}),this.modelUris[a]||(this.modelUris[a]={});let n=this.requestManager.normalizeModelURL(r);if((this.hasModel(i,a,{exactIdMatch:!0})||this.hasModelBeenAdded(i,a))&&this.modelUris[a][i]===n)this.models[a][i].numReferences++;else if(this.hasURLBeenRequested(n)){let{scope:i,modelId:r}=this.modelByURL[n];this.models[i][r].numReferences++}else this.modelUris[a][i]=n,this.load({[i]:this.modelUris[a][i]},a)}
8addModelURLs(i,r){this.models[r]||(this.models[r]={}),this.modelUris[r]||(this.modelUris[r]={});let a=this.modelUris[r];for(let r in i)a[r]=this.requestManager.normalizeModelURL(i[r])}reloadModels(i){this.load(this.modelUris[i],i,{forceReload:!0})}addModelsFromBucket(i,r){this.models[r]||(this.models[r]={}),this.modelUris[r]||(this.modelUris[r]={});let a={};for(let n of i)this.hasModel(n,r,{exactIdMatch:!0})||this.hasURLBeenRequested(n)?this.models[r][n].numReferences++:this.modelUris[r][n]&&!this.hasURLBeenRequested(n)?a[n]=this.modelUris[r][n]:!this.hasURLBeenRequested(n)&&te(n,!1)&&(this.modelUris[r][n]=this.requestManager.normalizeModelURL(n),a[n]=this.modelUris[r][n]);this.load(a,r)}hasURLBeenRequested(i){return void 0!==this.modelByURL[i]}removeModel(i,r,a=!1,n=!1){if(this.models[r]&&this.models[r][i]&&(this.models[r][i].numReferences--,0===this.models[r][i].numReferences||n)){let n=this.modelUris[r][i];a||delete this.modelUris[r][i],delete this.modelByURL[n];let o=this.models[r][i].model;o&&(delete this.models[r][i],o.destroy())}}destroy(){for(let i of Object.keys(this.models))for(let r of Object.keys(this.models[i])){let a=this.models[i][r].model;delete this.models[i][r],a&&a.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,r){for(let a in this.models[r]||(this.models[r]={}),this.models[r])this.models[r][a].model&&this.models[r][a].model.upload(i.context)}}let rl=["RENDER_SHADOWS","NORMAL_OFFSET"],rh=new Set(["symbol","circle"]),ru=class r{c
8onstructor(){this._queue=[],this._needsBuild=!0,this._idleHandle=null}needsBuild(){return this._needsBuild}buildQueue(i,r,a){null!=this._idleHandle&&"undefined"!=typeof cancelIdleCallback&&cancelIdleCallback(this._idleHandle),this._idleHandle=null,this._queue=[],this._needsBuild=!1;let n=a.stylesheet,o=!!a.fog,s=!!(a.getTerrain()||n&&n.terrain),l=!(!a.projection||"globe"!==a.projection.name),h=s||l,u=!(!a.directionalLight||!a.directionalLight.shadowsEnabled()),c=a.map&&a.map.painter,d=!c||!c.context.extParallelShaderCompile,p=!!c&&"mrt-fallback"===c.emissiveMode,f=(i,r=[],a={})=>{this._queue.push({programId:i,params:Object.assign({},a.params,{defines:r,overrideFog:!!a.fog,overrideTerrain:!!a.terrain,overrideGlobe:!!a.globe,overrideRtt:!!a.rtt,precompiled:!0})})};for(let n of i){if("none"===n.visibility)continue;let i=n.getProgramIds();if(i)for(let m of i){if(rh.has(m))continue;let i=n.getDefaultProgramParams(m,r.zoom,a._styleColorTheme.lut);if(!i)continue;let _=c?c.getShaderSource(m):null,g=h&&(!_||_.usedDefines.has("RENDER_TO_TEXTURE")),y=p&&g?(i.defines||[]).concat("USE_MRT1"):i.defines;if(d){f(m,i.defines,{params:i}),g&&f(m,y,{params:i,rtt:!0});continue}let x=o&&(!_||_.usedDefines.has("FOG")),v=s&&!n.isDraped()&&(!_||_.usedDefines.has("TERRAIN")),b=l&&(!_||_.usedDefines.has("GLOBE"));for(let r of u&&n.hasElevation()&&(!_||_.usedDefines.has("RENDER_SHADOWS"))?[!1,!0]:[!1]){let a=r?(i.defines||[]).concat(rl):i.defines||[];for(let r of v?[!1,!0]:[!1])for(let n of b?[!1,!0]:[!1])for(let o of x?[!1,!0]:[!1])f(m,a,{params:i,fog:o,terrain:r,globe:n})}g&&f(m,y,{params:i,rtt:!0})}}if(f("clippingMask"),s)for(let i of[!1,!0])f("terrainRaster",i?["TERRAIN_VERTEX_MORPHING"]:[],{terrain:!0,fog:o});if(!d){if(i.some(i=>"hillshade"===i.type)&&f("hillshadePrepare"),u)for(let i of[!1,!0])for(let r of[!1,!0]){let a=[];i&&a.push("RENDER_CUTOFF"),a.push("RENDER_SHADOWS"),r&&a.push("NORMAL_OFFSET"),f("groundShadow",a),o&&f("groundShadow",a,{fog:!0})}if(l){for(let i of[[],["TERRAIN_VERTEX_MORPHING"],["GLOBE_POLES"]])for(let r of[!1,!0]){let a=[...i,"PROJECTION_GLOBE_VIEW"];r&&a.push("CUSTOM_ANTIALIASING"),f("globeRaster",a,{terrain:s,globe:!0,fog:o})}for(let i of[!1,!0]){let r=i?["PROJECTION_GLOBE_VIEW","FOG"]:["FOG"];f("globeAtmosphere",r,{fog:!0,terrain:s,globe:i}),f("globeAtmosphere",[...r,"ALPHA_PASS"],{fog:!0,terrain:s,globe:i})}f("stars",[],{fog:o,terrain:s,globe:!0})}}}_executeBatch(a,n,o){if(o.map&&o.map.isMoving())return void(this._idleHandle=i.o.requestIdleCallback(i=>this._executeBatch(i,n,o)));n.context.sweepPendingPrograms();let s=n.context.extParallelShaderCompile?r.DEADLINE_MARGIN_KHR_MS:r.DEADLINE_MARGIN_SYNC_MS,l=0;for(;this._queue.length>0;){let i=this._queue.shift();if(!i||(n.style=o,n._fogVisible=!!i.params.overrideFog,n.getOrCreateProgram(i.programId,i.params),l++,a.timeRemaining()<=s))break}let h=0===this._queue.length||a.timeRemaining()>s;l>0&&h&&n.context.gl.flush(),this._idleHandle=this._queue.length>0||n.context._pendingPrograms.size>0?i.o.requestIdleCallback(i=>this._executeBatch(i,n,o)):null}processQueue(r,a){0!==this._queue.length&&(null!=this._idleHandle&&"undefined"!=typeof cancelIdleCallback&&cancelIdleCallback(this._idleHandle),this._idleHandle=i.o.requestIdleCallback(i=>this._executeBatch(i,r,a)))}reset(){null!=this._idleHandle&&"undefined"!=typeof cancelIdleCallback&&cancelIdleCallback(this._idleHandle),this._queue=[],this._idleHandle=null,this._needsBuild=!0}};ru.DEADLINE_MARGIN_KHR_MS=5,ru.DEADLINE_MARGIN_SYNC_MS=25;let rc=i.a6.colorTheme,rd=new i.a8({data:new i.a9(rc.data)});function rp(r){if(r)return r.map(([r,a])=>[r*i.o.devicePixelRatio,a*i.o.devicePixelRatio])}class rf{constructor(i,r,a){this.id=i,this.scope=r,this.sourceCache=a,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(){let r=new Map;if(!this.sourceCache.loaded())return r;let a=this.sourceCache.getVisibleCoordinates();if(0===a.length)return r;let n=this.sourceCache.getSource();if(!(n instanceof tQ))return r;let o=a.map(i=>this.sourceCache.getTile(i));for(let[a,s]of n.getImages(o,Array.from(this.pendingRequests)))r.set(i.I.from({name:a,iconsetId:this.id}),s),this.pendingRequests.delete(a);for(let i of this.pendingRequests)this.missingRequests.add(i);return this.pendingRequests.clear(),r}}class rm{constructor(){this._previousClosestBuildingId=null,this._hysteresisRatio=.8,this._indo
8orMinimumZoom=16}findClosestBuilding(i,r,a,n,o){if(a<this._indoorMinimumZoom)return this._previousClosestBuildingId=null,null;let s=null,l=Number.MAX_VALUE,h=Number.MAX_VALUE,u=!1,c=this._previousClosestBuildingId?i[this._previousClosestBuildingId]:null;for(let[a,d]of(this._previousClosestBuildingId&&c&&this._isBuildingVisible(c,n,o)&&(u=!0,h=this._calculateDistance(r,c)),Object.entries(i))){if(!this._isBuildingVisible(d,n,o))continue;let i=this._calculateDistance(r,d);i<l&&(l=i,s=a)}return u&&s&&this._previousClosestBuildingId&&s!==this._previousClosestBuildingId?l>h*this._hysteresisRatio&&(s=this._previousClosestBuildingId):u&&!s&&(s=this._previousClosestBuildingId),this._previousClosestBuildingId=s,s}_calculateDistance(i,r){if(!r.center)return Number.MAX_VALUE;let a=i.lat-r.center[1],n=i.lng-r.center[0];return a*a+n*n}_isBuildingVisible(r,a,n){if(!n)return!1;for(let a of r.floorIds){let o=r.floors[a];if(!o.geometry)continue;let s=o.geometry;if("Polygon"===s.type){let r=this._convertRingToPoints(s.coordinates[0]);if(i.bz(r,n))return!0}else if("MultiPolygon"===s.type){let r=this._convertMultiPolygonToPoints(s.coordinates);if(i.d2(n,r))return!0}}return!1}_convertRingToPoints(r){return r.map(r=>new i.P(r[0],r[1]))}_convertMultiPolygonToPoints(r){return r.map(r=>0===r.length?[]:r[0].map(r=>new i.P(r[0],r[1])))}}class r_ extends i.E{constructor(r){super(),this._style=r,this._buildings={},this._activeFloors=new Set,this._closestBuildingId=null,this._indoorState={selectedFloorId:null,activeFloorsVisible:!0,activeFloors:this._activeFloors},this._buildingDetectionStrategy=new rm,this._initialLoadDone=!1,i.b0(["_updateUI"],this),this._style.on("style.load",()=>{this._style.isIndoorEnabled()&&(this._style.map.on("load",()=>{this._initialLoadDone=!0,this._indoorState&&this._indoorState.needsUpdate&&(this._indoorState.needsUpdate=!1,this._style.updateIndoorDependentLayers()),this._updateUI()}),this._style.map.on("move",this._updateUI),this._style.map.on("idle",this._updateUI))})}destroy(){this._buildings={},this._activeFloors=new Set,this._indoorState=null}selectFloor(i){i===this._selectedFloorId&&this._indoorState&&this._indoorState.activeFloorsVisible||(this._selectedFloorId=i,this._recalculateActiveFloors())}setActiveFloorsVisibility(i){this._updateActiveFloors(i),this._updateIndoorSelector()}setIndoorData(i){let r=!1;for(let[a,n]of Object.entries(i.buildings))if(this._buildings[a])for(let i of n.floorIds)this._buildings[a].floorIds.add(i),this._buildings[a].floors[i]?this._mergeFloors(this._buildings[a].floors[i],n.floors[i]):(this._buildings[a].floors[i]=n.floors[i],r=!0);else this._buildings[a]=n,r=!0;r&&this._recalculateActiveFloors()}getIndoorTileOptions(i,r){return this._indoorState?{sourceLayers:this._style.getIndoorSourceLayers(i,r),indoorState:this._indoorState}:null}getControlState(){let i=this._buildings,r=this._closestBuildingId,a=r&&i?i[r]:void 0;if(!a)return{selectedFloorId:null,activeFloorsVisible:!!this._indoorState&&this._indoorState.activeFloorsVisible,floors:[]};let n=null;for(let i of a.floorIds)if(this._activeFloors&&this._activeFloors.has(i)){n=i;break}let o=Array.from(a.floorIds).map(i=>({id:i,name:a.floors[i].name,zIndex:a.floors[i].zIndex})).sort((i,r)=>r.zIndex-i.zIndex).filter((i,r,a)=>0===r||i.zIndex!==a[r-1].zIndex);return{selectedFloorId:n,activeFloorsVisible:!!this._indoorState&&this._indoorState.activeFloorsVisible,floors:o}}_updateUI(){this._initialLoadDone=!0;let i=this._style.map.transform,r=this._buildingDetectionStrategy.findClosestBuilding(this._buildings,i.center,i.zoom,i.getBounds(),this._makeViewportPolygon());if(r!==this._closestBuildingId){let i=this._closestBuildingId;this._closestBuildingId=r,this._onBuildingTransition(i,r),this._updateIndoorSelector()}}_onBuildingTransition(i,r){this._indoorState&&(!r&&i?(this._indoorState.activeFloors=new Set,this._indoorState.activeFloorsVisible=!1,this._style.updateIndoorDependentLayers()):r&&!i&&(this._recalculateActiveFloors(),this._updateActiveFloors(!0)))}_updateIndoorSelector(){this.fire(new i.z("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;let r=i.d3.calculate(this._buildings,this._selectedFloorId,this._activeFloors);(function(i,r){if(i===r)return!0;if(!i||!r||i.size!==r.size)return!1;for(let a of i)if(!r.has(a))return!1;return!0})(r,this._activeFloors)||(this._activeFloors=r,this._updateActiveFloors(!!this._indoorState&&this._indoorState.activeFloorsVisible),this._updateIndoorSelector())}_mergeFloors(i,r){r.geometry&&(i.geometry?("Polygon"===i.geometry.type&&(i.geometry={type:"MultiPolygon",coordinates:[i.geometry.coordinates]}),"Polygon"===r.geometry.type?i.geometry.coordinates.push(r.geometry.coordinates):"MultiPolygon"===r.geometry.type&&i.geometry.coordinates.push(...r.geometry.coordinates)):i.geometry=r.geometry)}_makeViewportPolygon(){let r=this._style.map.transform,a=r.width,n=r.height;return[r.pointLocation(new i.P(0,0)),r.pointLocation(new i.P(a,0)),r.pointLocation(new i.P(a,n)),r.pointLocation(new i.P(0,n))].map(r=>new i.P(r.lng,r.lat))}}let rg=(i,r)=>tE(i,r&&r.filter(i=>"source.canvas"!==i.identifier)),ry=i.aK(ia,["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"]),rx=i.aK(ia,["setCenter","setZoom","setBearing","setPitch"]),rv=new Set(["background","sky","slot","custom"]),rb=new Set(["building"]),rw={version:8,layers:[],sources:{}},rT={duration:300,delay:0};class rS extends i.E{constructor(r,a={}){if(super(),this.map=r,this.scope=a.scope||"",this.globalId=null,this.fragments=[],this.importDepth=a.importDepth||0,this.importsCache=a.importsCache||new Map,this.resolvedImports=a.resolvedImports||new Set,this.transition=Object.assign({},rT),this._buildingIndex=new it(this),this.crossTileSymbolIndex=new iX,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=a.styleChanges||new es,this._hasDataDrivenEmissive=!1,this.indoorManager=new r_(this),this.dispatcher=a.dispatcher?a.dispatcher:new tj(ii(),this),this.map.painter&&this.map.painter.context){let i=this.map.painter.context.maxUniformBufferBindings,r=Math.floor(this.map.painter.context.maxUniformBlockSize/4);this.dispatcher.broadcast("setContextParams",{maxBindingPoints:i,maxUniformBlockSizeDwords:r,disableSymbolUBO:this.map.painter.context.disableSymbolUBO})}a.imageManager?this.imageManager=a.imageManager:(this.imageManager=new eZ(this.map._spriteFormat),this.imageManager.setEventedParent(this)),this.imageManager.addScope(this.scope),this.glyphManager=a.glyphManager?a.glyphManager:new i.d4(r._requestManager,a.localFontFamily?i.d5.all:a.localIdeographFontFamily?i.d5.ideographs:i.d5.none,a.localFontFamily||a.localIdeographFontFamily,a.fontstackCompositing),a.modelManager?this.modelManager=a.modelManager:(this.modelManager=new rs(r._requestManager),this.modelManager.setEventedParent(this)),this._layers={},this._sourceCaches={},this._otherSourceCaches={},this._symbolSourceCaches={},this._fillExtrusionSourceCaches={},this._loaded=!1,this._initialBroadcastDone=!1,this._programPrecompiler=this.map._precompilePrograms&&this.isRootStyle()?new ru:null,this._availableImages=[],this._availableModels={},this._order=[],this._markersNeedUpdate=!1,this.options=a.configOptions?a.configOptions:new Map,this._configDependentLayers=a.configDependentLayers?a.configDependentLayers:new Set,this._indoorDependentLayers=a.indoorDependentLayers?a.indoorDependentLayers:new Set,this._config=a.config,this._styleColorTheme={lut:null,lutLoading:!1,lutLoadingCorrelationID:0,colorTheme:null,colorThemeOverride:a.colorThemeOverride},this._styleColorThemeForScope={},this._initialConfig=a.initialConfig,this.dispatcher.broadcast("setReferrer",i.d6()),this.dispatcher.broadcast("setConfig",i.d7());let n=this;this._rtlTextPluginCallback=rS.registerForPluginStateChange(r=>{n.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:r.pluginStatus,pluginURL:r.pluginURL},(r,a)=>{if(i.d8(r),a&&a.every(i=>i))for(let i in n._sourceCaches){let r=n._sourceCaches[i],a=r.getSource().type;"vector"!==a&&"geojson"!==a||r.reload()}})}),this.on("data",i=>{if("source"!==i.dataType||"metadata"!==i.sourceDataType)return;let r=this.getOwnSource(i.sourceId);if(r&&r.vectorLayerIds)for(let i in this._layers){let a=this._layers[i];
8a.source===r.id&&this._validateLayer(a)}})}load(i){return i&&("string"==typeof i?this.loadURL(i):this.loadJSON(i)),this}_getGlobalId(r){if(!r)return null;if("string"==typeof r){if(i.e(r))return r;let a=i.d9(r);if(!a.startsWith("http"))try{return new URL(a,location.href).toString()}catch(i){}return a}return`json://${i.da(JSON.stringify(r))}`}_diffStyle(r,a,n){this.globalId=this._getGlobalId(r);let o=(i,r)=>{try{r(null,this.setState(i,n))}catch(i){r(i,!1)}};if("string"==typeof r){let n=this.map._requestManager.normalizeStyleURL(r),s=this.map._requestManager.transformRequest(n,i.R.Style);i.m(s,(r,n)=>{r?this.fire(new i.y(r)):n&&o(n,a)})}else"object"==typeof r&&o(r,a)}loadURL(r,a={}){this.fire(new i.z("dataloading",{dataType:"style"}));let n="boolean"==typeof a.validate?a.validate:!i.e(r);this.globalId=this._getGlobalId(r),r=this.map._requestManager.normalizeStyleURL(r,a.accessToken),this.resolvedImports.add(r);let o=this.importsCache.get(r);if(o)return this._load(o,n);let s=this.map._requestManager.transformRequest(r,i.R.Style);this._request=i.m(s,(a,o)=>{if(this._request=null,a)this.fire(new i.y(a));else if(o)return this.importsCache.set(r,o),this._load(o,n)})}loadJSON(r,a={}){this.fire(new i.z("dataloading",{dataType:"style"})),this.globalId=this._getGlobalId(r),this._request=i.o.frame(()=>{this._request=null,this._load(r,!1!==a.validate)})}loadEmpty(){this.fire(new i.z("dataloading",{dataType:"style"})),this._load(rw,!1)}_loadImports(r,a,n){if(this.importDepth>=4)return i.w("Style doesn't support nesting deeper than 5"),Promise.resolve();let o=[];for(let s of r){let r=this._createFragmentStyle(s),l=new Promise(i=>{r.once("style.import.load",i),r.once("error",i)}).then(()=>{this.mergeAll(),this.fire(new i.z("data",{dataType:"style"}))});if(o.push(l),this.resolvedImports.has(s.url)){r.loadEmpty();continue}let h=s.data||this.importsCache.get(s.url);h?(s.data?(r.fire(new i.z("dataloading",{dataType:"style"})),r.globalId=r._getGlobalId(h),queueMicrotask(()=>r._load(h,a))):r.loadJSON(h,{validate:a}),this._isInternalStyle(h)&&(r.globalId=null)):s.url?r.loadURL(s.url,{validate:a}):r.loadEmpty();let u={style:r,id:s.id,config:s.config};if(n){let i=this.fragments.findIndex(({id:i})=>i===n);this.fragments=this.fragments.slice(0,i).concat(u).concat(this.fragments.slice(i))}else this.fragments.push(u)}return Promise.allSettled(o)}getImportGlobalIds(i=this,r=new Set){for(let a of i.fragments)a.style.globalId&&r.add(a.style.globalId),this.getImportGlobalIds(a.style,r);return[...r.values()]}_createFragmentStyle(r){let a,n=this.scope?i.t(r.id,this.scope):r.id,o=this._initialConfig&&this._initialConfig[n];(r.config||o)&&(a=Object.assign({},r.config,o));let s=new rS(this.map,{scope:n,styleChanges:this._changes,importDepth:this.importDepth+1,importsCache:this.importsCache,resolvedImports:new Set(this.resolvedImports),dispatcher:this.dispatcher,imageManager:this.imageManager,glyphManager:this.glyphManager,modelManager:this.modelManager,config:a,configOptions:this.options,colorThemeOverride:r["color-theme"],configDependentLayers:this._configDependentLayers,indoorDependentLayers:this._indoorDependentLayers});return s.setEventedParent(this.map,{style:s}),s}_reloadImports(i=!1){this.mergeAll(),this._updateMapProjection(),i||this.updateConfigDependencies(),this._updateLayers(this._indoorDependentLayers),this.map._triggerCameraUpdate(this.camera),(!i||this.isRootStyle()||this.map.style._initialBroadcastDone)&&(i&&this.isRootStyle()?(this.forEachFragmentStyle(i=>{this.dispatcher.broadcast("setLayers",{layers:i._serializeLayers(i._order),scope:i.scope,options:i.options})}),this._initialBroadcastDone=!0):this.dispatcher.broadcast("setLayers",{layers:this._serializeLayers(this._order),scope:this.scope,options:this.options}))}_isInternalStyle(i){return this.isRootStyle()&&(i.fragment||!!i.schema&&!1!==i.fragment)}_load(r,a){if(this._isInternalStyle(r)){let i=Object.assign({},rw,{imports:[{id:"basemap",data:r,url:""}]},r.center?{center:r.center}:{},r.bearing?{bearing:r.bearing}:{},r.pitch?{pitch:r.pitch}:{},r.zoom?{zoom:r.zoom}:{},r.light?{light:r.light}:{});return this._importedAsBasemap=!0,void this._load(i,a)}if(this.updateConfig(this._config,r.schema),a&&rg(this,tc(r)))return;for(let i in this._loaded=!0,r.sources)this.addSource(i,r.sources[i],{validate:!1,isInitialLoad:!0});this.stylesheet=i.db(r);let n=()=>
8{if(r.iconsets)for(let i in r.iconsets)this.addIconset(i,r.iconsets[i]);r.sprite?this._loadIconset(r.sprite):(this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0})),!this.glyphManager.url&&r.glyphs&&this.glyphManager.setURL(r.glyphs);let n=ir(this.stylesheet.layers);if(this._order=n.map(i=>i.id),this.stylesheet.light&&i.w("The `light` root property is deprecated, prefer using `lights` with `flat` light type instead."),this.stylesheet.lights)if(1===this.stylesheet.lights.length&&"flat"===this.stylesheet.lights[0].type){let i=this.stylesheet.lights[0];this.light=new tA(i.properties,i.id)}else this.setLights(this.stylesheet.lights);for(let r of(this.light||(this.light=new tA(this.stylesheet.light)),this._layers={},n)){let a=i.dh(r,this.scope,this._styleColorTheme.lut,this.options);0!==a.expressionDependencies.configDependencies.size&&this._configDependentLayers.add(a.fqid),a.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(a.fqid),this._hasAppearances=this._hasAppearances||0!==a.getAppearances().length,a.setEventedParent(this,{layer:{id:a.id}}),this._layers[a.id]=a;let n=this.getOwnLayerSourceCache(a),o=!!this.directionalLight&&this.directionalLight.shadowsEnabled();n&&a.canCastShadows()&&o&&(n.castsShadows=!0)}if(this.glyphManager.url){let i=new Set;for(let r in this._layers){let a=this._layers[r];if("symbol"===a.type&&a.layout){let r=a.layout.get("text-font");r&&r.value&&"constant"===r.value.kind&&i.add(r.value.value.join(","))}}for(let r of i)this.glyphManager.prefetchRange(r,0)}this.stylesheet.featuresets&&this.setFeaturesetSelectors(this.stylesheet.featuresets),this.stylesheet.models&&this.addModelURLs(this.stylesheet.models);let o=this.stylesheet.terrain;o&&(this.checkCanvasFingerprintNoise(),this.disableElevatedTerrain||this.terrainSetForDrapingOnly()||this._createTerrain(o,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 i.z("data",{dataType:"style"}));let s=this.isRootStyle();r.imports?this._loadImports(r.imports,a).then(()=>{this._reloadImports(!0),this.fire(new i.z(s?"style.load":"style.import.load"))}).catch(r=>{this.fire(new i.y(Error("Failed to load imports",r))),this.fire(new i.z(s?"style.load":"style.import.load"))}):(this._reloadImports(!0),this.fire(new i.z(s?"style.load":"style.import.load")))};this._styleColorTheme.colorTheme=this.stylesheet["color-theme"];let o=this._styleColorTheme.colorThemeOverride?this._styleColorTheme.colorThemeOverride:this._styleColorTheme.colorTheme;if(o){let r=this._evaluateColorThemeData(o);this._loadColorTheme(r).then(()=>{n()}).catch(r=>{i.w(`Couldn't load color theme from the stylesheet: ${r}`),n()})}else this._styleColorTheme.lut=null,n()}isRootStyle(){return 0===this.importDepth}hasAppearances(){return this._hasAppearances||this.fragments.some(i=>i.style.hasAppearances())}mergeAll(){let i,r,a,n,o,s,l,h,u,c,d={};this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle(p=>{if(p.stylesheet){if(p.disableElevatedTerrain&&(this.disableElevatedTerrain=!0),null!=p.light&&(i=p.light),p.stylesheet.lights)for(let i of p.stylesheet.lights)"ambient"===i.type&&null!=p.ambientLight&&(r=p.ambientLight),"directional"===i.type&&null!=p.directionalLight&&(a=p.directionalLight);n=this._prioritizeTerrain(n,p.terrain,p.stylesheet.terrain),p.stylesheet.fog&&null!=p.fog&&(o=p.fog),p.stylesheet.snow&&null!=p.snow&&(s=p.snow),p.stylesheet.rain&&null!=p.rain&&(l=p.rain),null!=p.stylesheet.camera&&(c=p.stylesheet.camera),null!=p.stylesheet.projection&&(h=p.stylesheet.projection),null!=p.stylesheet.transition&&(u=p.stylesheet.transition),d[p.scope]=p._styleColorTheme}}),this.light=i,this.ambientLight=r,this.directionalLight=a,this.fog=o,this.snow=s,this.rain=l,this._styleColorThemeForScope=d,null===n?delete this.terrain:this.terrain=n,this.camera=c||{"camera-projection":"perspective"},this.projection=h||{name:"mercator"},this.transition=Object.assign({},rT,u),this.mergeSources(),this.mergeLayers(),this.mergeIndoor(),this._programPrecompiler&&this._programPrecompiler.reset()}forEachFragmentStyle(i){let r=a=>{for(let i of a.fragments)r(i.style);i(a)};r(this)}_prioritizeTerrain(i,r,a){let n=i&&0===i.drapeRenderMode;return null===a?r&&0===r.drapeRenderMode?r:n?i:null:null!=r&&(!i||n||r&&1===r.drapeRenderMode)?r:i}mergeTerrain(){let i;this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle(r=>{i=this._prioritizeTerrain(i,r.terrain,r.stylesheet.terrain)}),null===i?delete this.terrain:this.terrain=i,this._programPrecompiler&&this._programPrecompiler.reset()}mergeProjection(){let i;this.forEachFragmentStyle(r=>{null!=r.stylesheet.projection&&(i=r.stylesheet.projection)}),this.projection=i||{name:"mercator"},this._programPrecompiler&&this._programPrecompiler.reset()}mergeSources(){let r={},a={},n={},o={};this.forEachFragmentStyle(s=>{for(let a in s._sourceCaches)r[i.t(a,s.scope)]=s._sourceCaches[a];for(let r in s._otherSourceCaches)a[i.t(r,s.scope)]=s._otherSourceCaches[r];for(let r in s._symbolSourceCaches)n[i.t(r,s.scope)]=s._symbolSourceCaches[r];for(let r in s._fillExtrusionSourceCaches)o[i.t(r,s.scope)]=s._fillExtrusionSourceCaches[r]}),this._mergedSourceCaches=r,this._mergedOtherSourceCaches=a,this._mergedSymbolSourceCaches=n,this._mergedFillExtrusionSourceCaches=o}mergeIndoor(){this.forEachFragmentStyle(r=>{if(r.stylesheet&&r.stylesheet.indoor)for(let a of Object.values(r.stylesheet.indoor)){let n=i.t(a.sourceId,r.scope);this._mergedIndoor[n]=new Set(a.sourceLayers||[])}})}mergeLayers(){let r={},a=[],n={};this._mergedSlots=[],this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this.forEachFragmentStyle(n=>{for(let o of n._order){let s=n._layers[o];if("slot"===s.type){let a=i.dc(o);if(r[a])continue;r[a]=[]}s.slot&&r[s.slot]?r[s.slot].push(s):a.push(s)}}),this._mergedOrder=[];let o=-1,s=(a=[])=>{for(let l of a)if("slot"===l.type){let a=i.dc(l.id);r[a]&&s(r[a]),this._mergedSlots.push(a)}else{let r=i.t(l.id,l.scope);this._mergedOrder.push(r),n[r]=l,l.is3D(!!this.terrain)&&(this._has3DLayers=!0,o=this._mergedOrder.length-1),"circle"===l.type&&(this._hasCircleLayers=!0),"symbol"===l.type&&(this._hasSymbolLayers=!0),"clip"===l.type&&(this._clipLayerPresent=!0)}};if(s(a),this._has3DLayers){let i={};for(let r=0;r<this._mergedOrder.length;++r){let a=this._mergedOrder[r];i[a]=r===o?1:r<o?2*!!n[a].hasOcclusionOpacityProperties:4}this._mergedOrder.sort((r,a)=>i[r]-i[a])}this._mergedLayers=n,this.updateDrapeFirstLayers(),this._buildingIndex.processLayersChanged(),this._updateDataDrivenEmissiveStrength()}terrainSetForDrapingOnly(){return!!this.terrain&&0===this.terrain.drapeRenderMode}getCamera(){return this.stylesheet.camera}setCamera(i){return this.stylesheet.camera=Object.assign({},this.stylesheet.camera,i),this.camera=this.stylesheet.camera,this}_evaluateColorThemeData(r){return r.data?(function(r,a,n){let o=Object.assign({},a);for(let i of Object.keys(rc))void 0===o[i]&&(o[i]=rc[i].default);let s=new i.a7(rd,r,new Map(n));return s.setTransitionOrValue(o,n),s.untransitioned().possiblyEvaluate(new i.ab(0,{worldview:void 0}))})(this.scope,r,this.options).get("data"):null}_loadColorTheme(r){this._styleColorTheme.lutLoading=!0,this._styleColorTheme.lutLoadingCorrelationID+=1;let a=this._styleColorTheme.lutLoadingCorrelationID;return new Promise((n,o)=>{let s="data:image/png;base64,";if(!r||0===r.length)return this._styleColorTheme.lut=null,this._styleColorTheme.lutLoading=!1,void n();let l=r;l.startsWith(s)||(l=s+l);let h=i.I.from("mapbox-reserved-lut"),u=new Image;u.src=l,u.onerror=()=>{this._styleColorTheme.lutLoading=!1,o(Error("Failed to load image data"))},u.onload=()=>
8{if(this._styleColorTheme.lutLoadingCorrelationID!==a)return void n();this._styleColorTheme.lutLoading=!1;let{width:s,height:l,data:c}=i.o.getImageData(u);if(l>32)return void o(Error("The height of the image must be less than or equal to 32 pixels."));if(s!==l*l)return void o(Error("The width of the image must be equal to the height squared."));this.getImage(h)&&this.removeImage(h),this.addImage(h,{data:new i.q({width:s,height:l},c),pixelRatio:1,sdf:!1,usvg:!1,version:0});let d=this.imageManager.getImage(h,this.scope);d?(this._styleColorTheme.lut={image:d.data,data:r},n()):o(Error("Missing LUT image."))}})}getLut(i){let r=this._styleColorThemeForScope[i];return r?r.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(r){this._spriteRequest=function(r,a,n){let o,s,l,h=i.o.devicePixelRatio>1?"@2x":"",u=i.m(a.transformRequest(a.normalizeSpriteURL(r,h,".json"),i.R.SpriteJSON),(i,r)=>{u=null,l||(l=i,o=r,d())}),c=i.n(a.transformRequest(a.normalizeSpriteURL(r,h,".png"),i.R.SpriteImage),(i,r)=>{c=null,l||(l=i,s=r,d())});function d(){if(l)n(l);else if(o&&s){let r=i.o.getImageData(s),a={};for(let n in o){let{width:s,height:l,x:h,y:u,sdf:c,pixelRatio:d,stretchX:p,stretchY:f,content:m}=o[n],_=new i.q({width:s,height:l});i.q.copy(r,_,{x:h,y:u},{x:0,y:0},{width:s,height:l},null),a[n]={data:_,pixelRatio:void 0!==d?d:1,sdf:void 0!==c&&c,stretchX:p,stretchY:f,content:m,usvg:!1,version:0}}n(null,a)}}return{cancel(){u&&(u.cancel(),u=null),c&&(c.cancel(),c=null)}}}(r,this.map._requestManager,(r,a)=>{if(this._spriteRequest=null,r)this.fire(new i.y(r));else if(a){let r=new Map;for(let n in a)r.set(i.I.from(n),a[n]);this.addImages(r)}this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0}),this.fire(new i.z("data",{dataType:"style"}))})}addIconset(r,a){if("sprite"===a.type)return void this._loadSprite(a.url);let n=this.getOwnSourceCache(a.source);if(!n)return void this.fire(new i.y(Error(`Source "${a.source}" as specified by iconset "${r}" does not exist and cannot be used as an iconset source`)));let o=n.getSource();if("raster-array"!==o.type)return void this.fire(new i.y(Error(`Source "${a.source}" as specified by iconset "${r}" is not a "raster-array" source and cannot be used as an iconset source`)));o.partial=!1;let s=new rf(r,this.scope,n);this.imageManager.addImageProvider(s,this.scope)}removeIconset(i){this.imageManager.removeImageProvider(i,this.scope)}_loadIconset(r){var a,n;if(!i.e(r)&&"icon_set"!==this.map._spriteFormat||"raster"===this.map._spriteFormat)return void this._loadSprite(r);let o="auto"===this.map._spriteFormat;this._spriteRequest=(n=(a,n)=>{if(this._spriteRequest=null,a)o?this._loadSprite(r):this.fire(new i.y(a));else if(n){let r=new Map;for(let a in n)r.set(i.I.from(a),n[a]);this.addImages(r)}this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0}),this.fire(new i.z("data",{dataType:"style"}))},i.b4((a=this.map._requestManager).transformRequest(a.normalizeIconsetURL(r),i.R.Iconset),(r,a)=>{if(r)return void n(r);let o={};for(let r of new i.b2(a).readFields(eh,{icons:[]},void 0).icons){let a={version:1,pixelRatio:i.o.devicePixelRatio,content:function(r){if(!r.metadata||!r.metadata.content_area)return;let a=i.o.devicePixelRatio,{left:n,top:o,width:s,height:l}=r.metadata.content_area,h=n*a,u=o*a;return[h,u,h+s*a,u+l*a]}(r),stretchX:r.metadata?rp(r.metadata.stretch_x_areas):void 0,stretchY:r.metadata?rp(r.metadata.stretch_y_areas):void 0,sdf:!1,usvg:!0,icon:r};o[r.name]=a}n(null,o)}))}_validateLayer(r){let a=this.getOwnSource(r.source);if(!a)return;let n=r.sourceLayer;n&&("geojson"===a.type||a.vectorLayerIds&&!a.vectorLayerIds.includes(n))&&this.fire(new i.y(Error(`Source layer "${n}" does not exist on source "${a.id}" as specified by style layer "${r.id}"`)))}
8loaded(){if(!this._loaded||Object.keys(this._changes.getUpdatedSourceCaches()).length)return!1;for(let 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(let{style:i}of this.fragments)if(!i.loaded())return!1;return!0}_serializeImports(){if(this.stylesheet.imports)return this.stylesheet.imports.map((i,r)=>{let a=this.fragments[r];return a&&a.style&&(i.data=a.style.serialize()),i})}_serializeSources(){let i={};for(let r in this._sourceCaches){let a=this._sourceCaches[r].getSource();i[a.id]||(i[a.id]=a.serialize())}return i}_serializeLayers(i){let r=[];for(let a of i){let i=this._layers[a];i&&"custom"!==i.type&&r.push(i.serialize())}return r}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(let i in this._sourceCaches)if(this._sourceCaches[i].hasTransition())return!0;for(let i in this._layers)if(this._layers[i].hasTransition())return!0;return!1}_updateDataDrivenEmissiveStrength(){for(let i in this._mergedLayers){let r=this._mergedLayers[i];if(r._transitionablePaint&&r._transitionablePaint._values){let i=r._transitionablePaint._values["line-emissive-strength"];if(i&&i.value&&i.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 Error("Style is not done loading")}_checkLayer(r){let a=this.getOwnLayer(r);if(a)return a;this.fire(new i.y(Error(`The layer '${r}' does not exist in the map's style.`)))}_checkSource(r){let a=this.getOwnSource(r);if(a)return a;this.fire(new i.y(Error(`The source '${r}' does not exist in the map's style.`)))}handleIdle(){let i=this.map.painter;i&&(i.context.sweepPendingPrograms(),this._programPrecompiler&&this._programPrecompiler.processQueue(i,this))}handleContextLost(){this._programPrecompiler&&this._programPrecompiler.reset()}update(r){if(!this._loaded)return;this.ambientLight&&this.ambientLight.recalculate(r),this.directionalLight&&this.directionalLight.recalculate(r);let a=this.calculateLightsBrightness();r.brightness=a||0,a!==this._brightness&&(this._brightness=a,this.dispatcher.broadcast("setBrightness",a)),r.worldview!==this._worldview&&(this._worldview=r.worldview,this.dispatcher.broadcast("setWorldview",this._worldview));let n=this._changes.isDirty(),o=!1;if(this._changes.isDirty()){let i=this._changes.getLayerUpdatesByScope();for(let r in i){let{updatedIds:a,removedIds:n}=i[r];(a||n)&&(this._updateWorkerLayers(r,a,n),o=!0)}this.updateSourceCaches(),this._updateTilesForChangedImages(),this.updateLayers(r),this.light&&this.light.updateTransitions(r),this.ambientLight&&this.ambientLight.updateTransitions(r),this.directionalLight&&this.directionalLight.updateTransitions(r),this.fog&&this.fog.updateTransitions(r),this.snow&&this.snow.updateTransitions(r),this.rain&&this.rain.updateTransitions(r),this._changes.reset()}let s={};for(let i in this._mergedSourceCaches){let r=this._mergedSourceCaches[i];s[i]=r.used,r.used=!1,r.tileCoverLift=0}let l={};for(let a of this._mergedOrder){let n=this._mergedLayers[a];if(("none"!==n.visibility||n.hasTransition())&&n.recalculate(r,this._availableImages),!n.isHidden(r.zoom)){rb.has(n.type)&&i.dd();let r=this.getLayerSourceCache(n);r&&(r.used=!0,r.tileCoverLift=Math.max(r.tileCoverLift,n.tileCoverLift()))}if("fill-extrusion"===n.type){let r=i.t(n.source,n.scope);if(r in this._mergedFillExtrusionSourceCaches){let i=n.layout&&n.layout.get("source-max-zoom");if(null!=i){let a=l[r];l[r]=null==a?i:Math.min(a,i)}}}}if(this._programPrecompiler&&this._programPrecompiler.needsBuild()){let i=this._mergedOrder.map(i=>this._mergedLayers[i]);this._programPrecompiler.buildQueue(i,r,this)}for(let i in this._mergedFillExtrusionSourceCaches)this._mergedFillExtrusionSourceCaches[i].setMaxzoomOverride(null!=l[i]?l[i]:null);for(let i of(this.terrain&&o&&this.mergeLayers(),this.imageManager.getPendingImageProviders()))i.sourceCache.used=!0;for(let r in s){let a=this._mergedSourceCaches[r];s[r]!==a.used&&a.getSource().fire(new i.z("data",{sourceDataType:"visibility",dataType:"source",sourceId:a.getSource().id}))}this.light&&this.light.recalculate(r),this.terrain&&this.terrain.recalculate(r),this.fog&&this.fog.recalculate(r),this.snow&&this.snow.recalculate(r),this.rain&&this.rain.recalculate(r),this.z=r.zoom,this._markersNeedU
8pdate&&(this._updateMarkersOpacity(),this._markersNeedUpdate=!1),this.imageManager.clearUpdatedImages(this.scope),n&&this.fire(new i.z("data",{dataType:"style"}))}updateImageProviders(){for(let i of this.imageManager.getPendingImageProviders()){let r=i.resolvePendingRequests(),a=this.getFragmentStyle(i.scope);a&&a.addImages(r)}}_updateTilesForChangedImages(){let i={};for(let r in this._mergedSourceCaches){let a=this._mergedSourceCaches[r].getSource().scope;i[a]=i[a]||this._changes.getUpdatedImages(a),0!==i[a].length&&this._mergedSourceCaches[r].reloadTilesForDependencies(["icons","patterns"],i[a])}for(let r in i)this._changes.resetUpdatedImages(r)}_updateWorkerLayers(i,r,a){let n=this.getFragmentStyle(i);n&&this.dispatcher.broadcast("updateLayers",{layers:r?n._serializeLayers(r):[],scope:i,removedIds:a||[],options:n.options})}setState(r,a){if(this._checkLoaded(),rg(this,tc(r)))return!1;(r=i.db(r)).layers=ir(r.layers);let n=(function(r,a){if(!r)return[{command:ia.setStyle,args:[a]}];let n=[];try{if(!i.b9(r.version,a.version)||(i.b9(r.center,a.center)||n.push({command:ia.setCenter,args:[a.center]}),i.b9(r.zoom,a.zoom)||n.push({command:ia.setZoom,args:[a.zoom]}),i.b9(r.bearing,a.bearing)||n.push({command:ia.setBearing,args:[a.bearing]}),i.b9(r.pitch,a.pitch)||n.push({command:ia.setPitch,args:[a.pitch]}),i.b9(r.sprite,a.sprite)||n.push({command:ia.setSprite,args:[a.sprite]}),i.b9(r.glyphs,a.glyphs)||n.push({command:ia.setGlyphs,args:[a.glyphs]}),i.b9(r.imports,a.imports)||function(r=[],a=[],n){let o,s,l,h;a=a||[];let u=(r=r||[]).map(ih),c=a.map(ih),d=r.reduce(iu,{}),p=a.reduce(iu,{}),f=u.slice();for(o=0,s=0;o<u.length;o++)l=u[o],Object.hasOwn(p,l)?s++:(n.push({command:ia.removeImport,args:[l]}),f.splice(f.indexOf(l,s),1));for(o=0,s=0;o<c.length;o++)l=c[c.length-1-o],f[f.length-1-o]!==l&&(Object.hasOwn(d,l)?(n.push({command:ia.removeImport,args:[l]}),f.splice(f.lastIndexOf(l,f.length-s),1)):s++,h=f[f.length-o],n.push({command:ia.addImport,args:[p[l],h]}),f.splice(f.length-o,0,l));for(let r of a){let a=d[r.id];a&&(delete a.data,i.b9(a,r)||n.push({command:ia.updateImport,args:[r.id,r]}))}}(r.imports,a.imports,n),i.b9(r.transition,a.transition)||n.push({command:ia.setTransition,args:[a.transition]}),i.b9(r.light,a.light)||n.push({command:ia.setLight,args:[a.light]}),i.b9(r.fog,a.fog)||n.push({command:ia.setFog,args:[a.fog]}),i.b9(r.snow,a.snow)||n.push({command:ia.setSnow,args:[a.snow]}),i.b9(r.rain,a.rain)||n.push({command:ia.setRain,args:[a.rain]}),i.b9(r.projection,a.projection)||n.push({command:ia.setProjection,args:[a.projection]}),i.b9(r.lights,a.lights)||n.push({command:ia.setLights,args:[a.lights]}),i.b9(r.camera,a.camera)||n.push({command:ia.setCamera,args:[a.camera]}),i.b9(r.iconsets,a.iconsets)||function(r,a,n){let o;for(o in a=a||{},r=r||{})Object.hasOwn(r,o)&&(Object.hasOwn(a,o)||n.push({command:ia.removeIconset,args:[o]}));for(o in a){if(!Object.hasOwn(a,o))continue;let s=a[o];Object.hasOwn(r,o)?i.b9(r[o],s)||(n.push({command:ia.removeIconset,args:[o]}),n.push({command:ia.addIconset,args:[o,s]})):n.push({command:ia.addIconset,args:[o,s]})}}(r.iconsets,a.iconsets,n),!i.b9(r["color-theme"],a["color-theme"])))return[{command:ia.setStyle,args:[a]}];let o={},s=[];!function(r,a,n,o){let s;for(s in a=a||{},r=r||{})Object.hasOwn(r,s)&&(Object.hasOwn(a,s)||is(s,n,o));for(s in a){var l;if(!Object.hasOwn(a,s))continue;let h=a[s];Object.hasOwn(r,s)?i.b9(r[s],h)||("geojson"===r[s].type&&"geojson"===h.type&&function(r,a,n){let o;for(o in r[n])if(Object.hasOwn(r[n],o)&&"data"!==o&&!i.b9(r[n][o],a[n][o]))return!1;for(o in a[n])if(Object.hasOwn(a[n],o)&&"data"!==o&&!i.b9(r[n][o],a[n][o]))return!1;return!0}(r,a,s)?n.push({command:ia.setGeoJSONSourceData,args:[s,h.data]}):(l=a,is(s,n,o),io(s,l,n))):io(s,a,n)}}(r.sources,a.sources,s,o);let l=[];r.layers&&r.layers.forEach(i=>{i.source&&o[i.source]?n.push({command:ia.removeLayer,args:[i.id]}):l.push(i)});let h=r.terrain;h&&o[h.source]&&(n.push({command:ia.setTerrain,args:[void 0]}),h=void 0),n=n.concat(s),i.b9(h,a.terrain)||n.push({command:ia.setTerrain,args:[a.terrain]}),function(r,a,n){let o,s,l,h,u,c,d;a=a||[];let p=(r=r||[]).map(ih),f=a.map(ih),m=r.reduce(iu,{}),_=a.reduce(iu,{}),g=p.slice(),y=Object.create(null);for(o=0,s=0;o<p.length;o++)l=p[o],Object.hasOwn(_,l)?s++:(n.push({command:ia.removeLayer,args:[l]}),g.splice(g.indexOf(l,s),1));for(o=0,s=0;o<f.length;o++)l=f[f.length-1-o],g[g.length-1-o]!==l&&(Object.hasOwn(m,l)?(n.push({command:ia.removeLayer,args:[l]}),g.splice(g.lastIndexOf(l,g.length-s),1)):s++,c=g[g.length-o],n.push({command:ia.addLayer,args:[_[l],c]}),g.splice(g.length-o,0,l),y[l]=!0);for(o=0;o<f.length;o++)if(h=m[l=f[o]],u=_[l],!y[l]&&!i.b9(h,u))if(i.b9(h.source,u.source)&&i.b9(h["source-layer"],u["source-layer"])&&i.b9(h.type,u.type)){for(d in il(h.layout,u.layout,n,l,null,ia.setLayoutProperty),il(h.paint,u.paint,n,l,null,ia.setPaintProperty),i.b9(h.slot,u.slot)||n.push({command:ia.setSlot,args:[l,u.slot]}),i.b9(h.filter,u.filter)||n.push({command:ia.setFilter,args:[l,u.filter]}),i.b9(h.minzoom,u.minzoom)&&i.b9(h.maxzoom,u.maxzoom)||n.push({command:ia.setLayerZoomRange,args:[l,u.minzoom,u.maxzoom]}),h)Object.hasOwn(h,d)&&"layout"!==d&&"paint"!==d&&"filter"!==d&&"metadata"!==d&&"minzoom"!==d&&"maxzoom"!==d&&"slot"!==d&&(0===d.indexOf("paint.")?il(h[d],u[d],n,l,d.slice(6),ia.setPaintProperty):i.b9(h[d],u[d])||n.push({command:ia.setLayerProperty,args:[l,d,u[d]]}));for(d in u)Object.hasOwn(u,d)&&!Object.hasOwn(h,d)&&"layout"!==d&&"paint"!==d&&"filter"!==d&&"metadata"!==d&&"minzoom"!==d&&"maxzoom"!==d&&"slot"!==d&&(0===d.indexOf("paint.")?il(h[d],u[d],n,l,d.slice(6),ia.setPaintProperty):i.b9(h[d],u[d])||n.push({command:ia.setLayerProperty,args:[l,d,u[d]]}))}else n.push({command:ia.removeLayer,args:[l]}),c=g[g.lastIndexOf(l)+1],n.push({command:ia.addLayer,args:[u,c]})}(l,a.layers,n)}catch(i){console.warn("Unable to compute style diff:",i),n=[{command:ia.setStyle,args:[a]}]}return n})(this.serialize(),r).filter(i=>!(i.command in rx));if(0===n.length)return!1;let o=n.filter(i=>!(i.command in ry));if(o.length>0)throw Error(`Unimplemented: ${o.map(i=>i.command).join(", ")}.`);let s=[];
8return n.forEach(i=>{s.push(this[i.command](...i.args))}),a&&Promise.all(s).then(a).catch(a),this.stylesheet=r,this.mergeAll(),this.dispatcher.broadcast("setLayers",{layers:this._serializeLayers(this._order),scope:this.scope,options:this.options}),!0}_updateWorkerImages(){this._availableImages=this.imageManager.listImages(this.scope),this.dispatcher.broadcast("setImages",{scope:this.scope,images:this._availableImages})}_updateWorkerModels(){this._availableModels=this.modelManager.getModelURIs(this.scope),this.dispatcher.broadcast("setModels",{scope:this.scope,models:this._availableModels})}addImages(r){if(0===r.size)return this;for(let[a,n]of r.entries()){if(this.getImage(a))return this.fire(new i.y(Error(`An image with the name "${a.name}" already exists.`)));this.imageManager.addImage(a,this.scope,n),this._changes.updateImage(a,this.scope)}return this._updateWorkerImages(),this.fire(new i.z("data",{dataType:"style"})),this}addImage(r,a){return this.getImage(r)?this.fire(new i.y(Error(`An image with the name "${r.name}" already exists.`))):(this.imageManager.addImage(r,this.scope,a),this._changes.updateImage(r,this.scope),this._updateWorkerImages(),this.fire(new i.z("data",{dataType:"style"})),this)}updateImage(r,a,n=!1){this.imageManager.updateImage(r,this.scope,a),n&&(this._changes.updateImage(r,this.scope),this._updateWorkerImages(),this.fire(new i.z("data",{dataType:"style"})))}getImage(i){return this.imageManager.getImage(i,this.scope)}removeImage(r){return this.getImage(r)?(this.imageManager.removeImage(r,this.scope),this._changes.updateImage(r,this.scope),this._updateWorkerImages(),this.fire(new i.z("data",{dataType:"style"})),this):this.fire(new i.y(Error("No image with this name exists.")))}listImages(){return this._checkLoaded(),this._availableImages.slice()}getActualScope(){return this._importedAsBasemap?"basemap":this.scope}addModelURLs(r){return this.modelManager.addModelURLs(r,this.getActualScope()),this._updateWorkerModels(),this.fire(new i.z("data",{dataType:"style"})),this}addModel(r,a,n={}){return this._checkLoaded(),this._validate(tT,`models.${r}`,a,null,n)||(this.modelManager.addModel(r,a,this.getActualScope()),this.fire(new i.z("data",{dataType:"style"}))),this}hasModel(i){return this.modelManager.hasModel(i,this.getActualScope())}removeModel(r){return this.hasModel(r)?(this.modelManager.removeModel(r,this.getActualScope(),!1,!0),this.fire(new i.z("data",{dataType:"style"})),this):this.fire(new i.y(Error("No model with this ID exists.")))}listModels(){return this._checkLoaded(),this.modelManager.listModels(this.getActualScope())}addSource(r,a,n={}){if(this._checkLoaded(),void 0!==this.getOwnSource(r))throw Error(`There is already a source with ID "${r}".`);if(!a.type)throw Error(`The type property must be defined, but only the following properties were given: ${Object.keys(a).join(", ")}.`);if(["vector","raster","geojson","video","image"].includes(a.type)&&this._validate(td,`sources.${r}`,a,null,n))return;this.map&&this.map._collectResourceTiming&&(a.collectResourceTiming=!0);let o=t1(r,a,this.dispatcher,this);o.scope=this.scope,o.setEventedParent(this,()=>({isSourceLoaded:this._isSourceCacheLoaded(o.id),source:o.serialize(),sourceId:o.id}));let s=r=>{let a=(r===i.b7.Symbol?"symbol:":r===i.b7.FillExtrusion?"fill-extrusion:":"other:")+o.id,n=i.t(a,this.scope),s=this._sourceCaches[a]=new t9(n,o,r);r===i.b7.Symbol?this._symbolSourceCaches[o.id]=s:r===i.b7.FillExtrusion?this._fillExtrusionSourceCaches[o.id]=s:this._otherSourceCaches[o.id]=s,s.onAdd(this.map)};s(i.b7.Other),"vector"!==a.type&&"geojson"!==a.type||(s(i.b7.Symbol),"vector"===a.type&&s(i.b7.FillExtrusion)),o.onAdd&&o.onAdd(this.map),n.isInitialLoad||(this.mergeSources(),this._changes.setDirty())}removeSource(r){this._checkLoaded();let a=this.getOwnSource(r);if(!a)throw Error("There is no source with this ID");for(let a in this._layers)if(this._layers[a].source===r)return this.fire(new i.y(Error(`Source "${r}" cannot be removed while layer "${a}" is using it.`)));if(this.terrain&&this.terrain.scope===this.scope&&this.terrain.get().source===r)return this.fire(new i.y(Error(`Source "${r}" cannot be removed while terrain is using it.`)));if(this.stylesheet.iconsets){let a=Object.entries(this.stylesheet.iconsets).find(([i,a])=>"source"===a.type&&a.source===r);if(a)return this.fire(new i.y(Error(`Source "${r}" cannot be removed while iconset "${a[0]}" is using it.`)))}for(let a of this.getOwnSourceCaches(r)){let r=i.dc(a.id);delete this._sourceCaches[r],this._changes.discardSourceCacheUpdate(a.id),a.fire(new i.z("data",{sourceDataType:"metadata",dataType:"source",sourceId:a.getSource().id})),a.setEventedParent(null),a.clearTiles()}return delete this._otherSourceCaches[r],delete this._symbolSourceCaches[r],delete this._fillExtrusionSourceCaches[r],this.mergeSources(),a.setEventedParent(null),a.onRemove&&a.onRemove(this.map),this._changes.setDirty(),this}setGeoJSONSourceData(i,r){this._checkLoaded(),this.getOwnSource(i).setData(r),this._changes.setDirty()}getOwnSource(i){let r=this.getOwnSourceCache(i);return r&&r.getSource()}getOwnSources(){let i=[];for(let r in this._otherSourceCaches){let a=this.getOwnSourceCache(r);a&&i.push(a.getSource())}return i}areTilesLoaded(){let i=this._mergedSourceCaches;for(let r in i){let a=i[r]._tiles;for(let i in a){let r=a[i];if("loaded"!==r.state&&"errored"!==r.state)return!1}}return!0}setLights(r){if(this._checkLoaded(),this._programPrecompiler&&this._programPrecompiler.reset(),!r)return delete this.ambientLight,void delete this.directionalLight;let a=this._getTransitionParameters();
8for(let i of r){if(this._validate(tf,"lights",i))return;switch(i.type){case"ambient":if(this.ambientLight){let r=this.ambientLight;r.set(i),r.updateTransitions(a)}else this.ambientLight=new tG(i,tH(),this.scope,this.options);break;case"directional":if(this.directionalLight){let r=this.directionalLight;r.set(i),r.updateTransitions(a)}else this.directionalLight=new tG(i,t$(),this.scope,this.options)}}let n=Object.assign(a,{worldview:this.map.getWorldview()}),o=new i.ab(this.z||0,n);this.ambientLight&&this.ambientLight.recalculate(o),this.directionalLight&&this.directionalLight.recalculate(o),this._brightness=this.calculateLightsBrightness(),this.dispatcher.broadcast("setBrightness",this._brightness)}calculateLightsBrightness(){let r=this.directionalLight,a=this.ambientLight;if(!r||!a)return;let n=i=>.2126*(i[0]<=.03928?i[0]/12.92:Math.pow((i[0]+.055)/1.055,2.4))+.7152*(i[1]<=.03928?i[1]/12.92:Math.pow((i[1]+.055)/1.055,2.4))+.0722*(i[2]<=.03928?i[2]/12.92:Math.pow((i[2]+.055)/1.055,2.4)),o=r.properties.get("color").toNonPremultipliedRenderColor(null).toArray01(),s=r.properties.get("intensity"),l=r.properties.get("direction"),h=1-i.cT(l.x,l.y,l.z)[2]/90,u=n(o)*s*h,c=a.properties.get("color").toNonPremultipliedRenderColor(null).toArray01(),d=a.properties.get("intensity");return Number(((u+n(c)*d)/2).toFixed(6))}getBrightness(){return this._brightness}getLights(){if(!this.enable3dLights())return null;let i=[];return this.directionalLight&&i.push(this.directionalLight.get()),this.ambientLight&&i.push(this.ambientLight.get()),i}enable3dLights(){return!!this.ambientLight&&!!this.directionalLight}getFragmentStyle(r){if(null==r||""===r&&this.isRootStyle())return this;if(i.de(r)){let a=i.df(r),n=this.fragments.find(({id:i})=>i===a);if(!n)return;let o=i.dc(r);return n.style.getFragmentStyle(o)}{let i=this.fragments.find(({id:i})=>i===r);return i?i.style:void 0}}setFeaturesetSelectors(r){if(!r)return;let a=(i,r="")=>`${i}::${r}`;for(let n in this._featuresetSelectors={},r){let o={},s=this._featuresetSelectors[n]=[];for(let l of r[n].selectors){let r;if(l.featureNamespace){let r=this.getOwnLayer(l.layer);if(!r){i.w(`Layer is undefined for selector: ${l.layer}`);continue}let s=a(r.source,r.sourceLayer);if(s in o&&o[s]!==l.featureNamespace){i.w(`"featureNamespace ${l.featureNamespace} of featureset ${n}'s selector is not associated to the same source, skip this selector`);continue}o[s]=l.featureNamespace}if(l.properties)for(let a in l.properties){let n=i.U(l.properties[a]);"success"===n.result&&((r=r||{})[a]=n.value)}s.push({layerId:l.layer,namespace:l.featureNamespace,properties:r,uniqueFeatureID:l._uniqueFeatureID})}}}getFeaturesetDescriptors(i){let r=this.getFragmentStyle(i);if(!r||!r.stylesheet.featuresets)return[];let a=[];for(let i in r.stylesheet.featuresets)a.push({featuresetId:i,importId:r.scope?r.scope:void 0});return a}getFeaturesetLayers(r,a){let n=this.getFragmentStyle(a),o=n.stylesheet.featuresets;if(!o||!o[r])return this.fire(new i.y(Error(`The featureset '${r}' does not exist in the map's style and cannot be queried.`))),[];let s=[];for(let i of o[r].selectors){let r=n.getOwnLayer(i.layer);r&&s.push(r)}return s}getConfigProperty(r,a){let n=this.getFragmentStyle(r);if(!n)return null;let o=i.t(a,n.scope),s=n.options.get(o),l=s?s.value||s.default:null;return l?l.serialize():null}isIndoorEnabled(){return Object.keys(this._mergedIndoor).length>0}getIndoorSourceLayers(r,a){let n=i.t(r,a);return this._mergedIndoor[n]}setIndoorData(i,r){this.indoorManager.setIndoorData(r)}updateIndoorDependentLayers(){this._updateLayers(this._indoorDependentLayers),this.map._styleDirty=!0,this.map.triggerRepaint()}setConfigProperty(r,a,n){let o,s=this.getFragmentStyle(r);if(!s)return;let l=s.stylesheet.schema;if(!l||!l[a])return;let h=i.U(n);if("success"!==h.result)return void rg(this,h.value);let u=h.value.expression,c=i.t(a,s.scope),d=s.options.get(c);if(!d)return;let{minValue:p,maxValue:f,stepValue:m,type:_,values:g}=l[a],y=i.U(l[a].default);"success"===y.result&&(o=y.value.expression),o?(this.options.set(c,Object.assign({},d,{value:u,default:o,minValue:p,maxValue:f,stepValue:m,type:_,values:g})),this.updateConfigDependencies(a)):this.fire(new i.y(Error(`No schema defined for the config option "${a}" in the "${r}" fragment.`)))}getConfig(r){let a=this.getFragmentStyle(r);if(!a)return null;let n=a.stylesheet.schema;if(!n)return null;let o={};for(let r in n){let n=i.t(r,a.scope),s=a.options.get(n),l=s?s.value||s.default:null;o[r]=l?l.serialize():null}return o}setConfig(i,r){let a=this.getFragmentStyle(i);a&&(a.updateConfig(r,a.stylesheet.schema),this.updateConfigDependencies())}getSchema(i){let r=this.getFragmentStyle(i);return r?r.stylesheet.schema:null}setSchema(i,r){let a=this.getFragmentStyle(i);a&&(a.stylesheet.schema=r,a.updateConfig(a._config,r),this.updateConfigDependencies())}updateConfig(r,a){if(this._config=r,r||a)if(a)for(let n in a){let o,s,l=i.U(a[n].default);if("success"===l.result&&(o=l.value.expression),r&&void 0!==r[n]){let a=i.U(r[n]);"success"===a.result&&(s=a.value.expression)}let{minValue:h,maxValue:u,stepValue:c,type:d,values:p}=a[n];if(o){let r=i.t(n,this.scope);this.options.set(r,{default:o,value:s,minValue:h,maxValue:u,stepValue:c,type:d,values:p})}
8else this.fire(new i.y(Error(`No schema defined for config option "${n}".`)))}else this.fire(new i.y(Error("Attempting to set config for a style without schema.")))}_updateLayers(i,r=()=>!0){for(let a of i){let i=this.getLayer(a);i&&r(i)&&(i.possiblyEvaluateVisibility(),this._updateLayer(i),this._changes.setDirty())}}updateConfigDependencies(i){this._updateLayers(this._configDependentLayers,r=>!i||r.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(i=>{let r=i._styleColorTheme.colorThemeOverride?i._styleColorTheme.colorThemeOverride:i._styleColorTheme.colorTheme;if(r){let a=i._evaluateColorThemeData(r);(!i._styleColorTheme.lut&&""!==a||i._styleColorTheme.lut&&a!==i._styleColorTheme.lut.data)&&i.setColorTheme(r)}}),this._changes.setDirty()}addLayer(r,a,n={}){let o;this._checkLoaded();let s=r.id;if(this._layers[s])return void this.fire(new i.y(Error(`Layer with i
8d "${s}" already exists on this map`)));if("custom"===r.type){if(rg(this,i.dg(r)))return;o=i.dh(r,this.scope,this._styleColorTheme.lut,this.options)}else{if("object"==typeof r.source&&(this.addSource(s,r.source),r=Object.assign(r=i.db(r),{source:s})),this._validate(tx,`layers.${s}`,r,{arrayIndex:-1},n))return;o=i.dh(r,this.scope,this._styleColorTheme.lut,this.options),this._validateLayer(o),o.setEventedParent(this,{layer:{id:s}})}let l=i.t(o.source,o.scope);0!==o.expressionDependencies.configDependencies.size&&this._configDependentLayers.add(l),o.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(l);let h=this._order.length;if(a){let r=this._order.indexOf(a);if(-1===r)return void this.fire(new i.y(Error(`Layer with id "${a}" does not exist on this map.`)));o.slot&&o.slot!==this._layers[a].slot?i.w(`Layer with id "${a}" has a different slot. Layers can only be rearranged within the same slot.`):h=r}this._order.splice(h,0,s),this._handleLayerOrderChange(),this._layers[s]=o;let u=this.getOwnLayerSourceCache(o),c=!!this.directionalLight&&this.directionalLight.shadowsEnabled();u&&o.canCastShadows()&&c&&(u.castsShadows=!0);let d=this._changes.getRemovedLayer(o);if(d&&o.source&&u&&"custom"!==o.type){this._changes.discardLayerRemoval(o);let r=i.t(o.source,o.scope);d.type!==o.type?this._changes.updateSourceCache(r,"clear"):(this._changes.updateSourceCache(r,"reload"),u.pause())}this._updateLayer(o),o.onAdd&&o.onAdd(this.map),o.scope=this.scope,this.mergeLayers()}moveLayer(r,a){this._checkLoaded();let n=this._checkLayer(r);if(!n||r===a)return;let o=this._order.indexOf(r);this._order.splice(o,1);let s=this._order.length;if(a){let r=this._order.indexOf(a);
8if(-1===r)return void this.fire(new i.y(Error(`Layer with id "${a}" does not exist on this map.`)));n.slot&&n.slot!==this._layers[a].slot?i.w(`Layer with id "${a}" has a different slot. Layers can only be rearranged within the same slot.`):s=r}this._order.splice(s,0,r),this._changes.setDirty(),this._handleLayerOrderChange(),this.mergeLayers()}removeLayer(i){this._checkLoaded();let r=this._checkLayer(i);if(!r)return;r.setEventedParent(null);let a=this._order.indexOf(i);this._order.splice(a,1),delete this._layers[i],this._changes.setDirty(),this._handleLayerOrderChange(),this._configDependentLayers.delete(r.fqid),this._indoorDependentLayers.delete(r.fqid),this._changes.removeLayer(r);let n=this.getOwnLayerSourceCache(r);if(n&&n.castsShadows){let i=!1;for(let a in this._layers)if(this._layers[a].source===r.source&&this._layers[a].canCastShadows()){i=!0;break}n.castsShadows=i}r.onRemove&&r.onRemove(this.map),this.mergeLayers()}getOwnLayer(i){return this._layers[i]}hasLayer(i){return i in this._mergedLayers}hasLayerType(i){for(let r in this._layers)if(this._layers[r].type===i)return!0;return!1}setLayerZoomRange(i,r,a){this._checkLoaded();let n=this._checkLayer(i);n&&(n.minzoom===r&&n.maxzoom===a||(null!=r&&(n.minzoom=r),null!=a&&(n.maxzoom=a),this._updateLayer(n)))}getSlots(){return this._checkLoaded(),this._mergedSlots}setSlot(i,r){this._checkLoaded();let a=this._checkLayer(i);a&&a.slot!==r&&(a.slot=r,this._updateLayer(a))}setFilter(r,a,n={}){this._checkLoaded();let o=this._checkLayer(r);if(o&&!i.b9(o.filter,a))return null==a?(o.filter=void 0,void this._updateLayer(o)):void(this._validate(tv,`layers.${o.id}.filter`,a,{layerType:o.type},n)||(o.filter=i.db(a),this._updateLayer(o)))}getFilter(r){let a=this._checkLayer(r);if(a)return i.db(a.filter)}setLayoutProperty(r,a,n,o={}){this._checkLoaded();let s=this._checkLayer(r);if(s&&!i.b9(s.getLayoutProperty(a),n)){if(null!=n&&(!o||!1!==o.validate)&&rg(s,tw.call(tc,{key:`layers.${r}.layout.${a}`,layerType:s.type,objectKey:a,value:n,styleSpec:i.a6,style:{glyphs:!0,sprite:!0}})))return;s.setLayoutProperty(a,n),0!==s.expressionDependencies.configDependencies.size&&this._configDependentLayers.add(s.fqid),s.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(s.fqid),this._updateLayer(s)}}setLayerProperty(i,r,a,n={}){this._checkLoaded();let o=this._checkLayer(i);o&&("appearances"===r?(o.setAppearances(a),this._updateLayer(o)):o.isPaintProperty(r)?this.setPaintProperty(i,r,a,n):this.setLayoutProperty(i,r,a,n))}getLayoutProperty(i,r){let a=this._checkLayer(i);if(a)return a.getLayoutProperty(r)}setPaintProperty(r,a,n,o={}){this._checkLoaded();let s=this._checkLayer(r);if(!s||i.b9(s.getPaintProperty(a),n)||null!=n&&(!o||!1!==o.validate)&&rg(s,tb.call(tc,{key:`layers.${r}.paint.${a}`,layerType:s.type,objectKey:a,value:n,styleSpec:i.a6})))return;let l=s.setPaintProperty(a,n);0!==s.expressionDependencies.configDependencies.size&&this._configDependentLayers.add(s.fqid),s.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(s.fqid),l&&this._updateLayer(s),this._changes.updatePaintProperties(s)}getPaintProperty(i,r){let a=this._checkLayer(i);if(a)return a.getPaintProperty(r)}setFeatureState(r,a){if(this._checkLoaded(),"target"in r){if("featuresetId"in r.target){let{featuresetId:i,importId:n}=r.target,o=this.getFragmentStyle(n);for(let{source:n,sourceLayer:s}of o.getFeaturesetLayers(i))o.setFeatureState({id:r.id,source:n,sourceLayer:s},a)}else if("layerId"in r.target){let{layerId:i}=r.target,n=this.getLayer(i);this.setFeatureState({id:r.id,source:n.source,sourceLayer:n.sourceLayer},a)}return}let n=r.source,o=r.sourceLayer,s=this._checkSource(n);if(!s)return;let l=s.type;if("geojson"===l&&o)return void this.fire(new i.y(Error("GeoJSON sources cannot have a sourceLayer parameter.")));if("vector"===l&&!o)return void this.fire(new i.y(Error("The sourceLayer parameter must be provided for vector source types.")));for(let s of(void 0===r.id&&this.fire(new i.y(Error("The feature id parameter must be provided."))),this.getOwnSourceCaches(n)))s.setFeatureState(o,r.id,a)}removeFeatureState(r,a){if(this._checkLoaded(),"target"in r){if("featuresetId"in r.target){let{featuresetId:i,importId:n}=r.target,o=this.getFragmentStyle(n);for(let{source:n,sourceLayer:s}of o.getFeaturesetLayers(i))o.removeFeatureState({id:r.id,source:n,sourceLayer:s},a)}else if("layerId"in r.target){let{layerId:i}=r.target,n=this.getLayer(i);this.removeFeatureState({id:r.id,source:n.source,sourceLayer:n.sourceLayer},a)}return}let n=r.source,o=this._checkSource(n);if(!o)return;let s=o.type,l="vector"===s?r.sourceLayer:void 0;if("vector"===s&&!l)return void this.fire(new i.y(Error("The sourceLayer parameter must be provided for vector source types.")));if(a&&"string"!=typeof r.id&&"number"!=typeof r.id)return void this.fire(new i.y(Error("A feature id is required to remove its specific state property.")));for(let i of this.getOwnSourceCaches(n))i.removeFeatureState(l,r.id,a)}getFeatureState(r){if(this._checkLoaded(),"target"in r){let a;if("featuresetId"in r.target){let{featuresetId:n,importId:o}=r.target,s=this.getFragmentStyle(o);for(let{source:o,sourceLayer:l}of s.getFeaturesetLayers(n)){let n=s.getFeatureState({id:r.id,source:o,sourceLayer:l});if(n&&!a)a=n;else if(!i.b9(a,n))return void this.fire(new i.y(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 r.target){let{layerId:i}=r.target,n=this.getLayer(i);a=this.getFeatureState({id:r.id,source:n.source,sourceLayer:n.sourceLayer})}return a}let a=r.source,n=r.sourceLayer,o=this._checkSource(a);if(o){if("vector"!==o.type||n)return void 0===r.id&&this.fire(new i.y(Error("The feature id parameter must be provided."))),this.getOwnSourceCaches(a)[0].getFeatureState(n,r.id);this.fire(new i.y(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();let r=this.getTerrain(),a=r&&this.terrain&&this.terrain.scope===this.scope?r:this.stylesheet.terrain;return i.di({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,fragment:this.stylesheet.fragment,iconsets:this.stylesheet.iconsets,featuresets:this.stylesheet.featuresets,imports:this._serializeImports(),schema:this.stylesheet.schema,camera:this.stylesheet.camera,light:this.stylesheet.light,lights:this.stylesheet.lights,terrain:a,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)},i=>void 0!==i)}_updateFilteredLayers(i){for(let r of Object.values(this._mergedLayers))i(r)&&this._updateLayer(r)}_updateLayer(r){this._changes.updateLayer(r);let a=this.getLayerSourceCache(r),n=i.t(r.source,r.scope),o=this._changes.getUpd
8atedSourceCaches();r.source&&!o[n]&&a&&"raster"!==a.getSource().type&&(this._changes.updateSourceCache(n,"reload"),a.pause()),r.invalidateCompiledFilter()}_flattenAndSortRenderedFeatures(i){let r=i=>this._mergedLayers[i].is3D(!!this.terrain),a=this.order,n={},o=[];for(let s=a.length-1;s>=0;s--){let l=a[s];if(r(l))for(let r of(n[l]=s,i)){let i=r[l];if(i)for(let r of i)o.push(r)}}o.sort((i,r)=>r.intersectionZ-i.intersectionZ);let s=[];for(let l=a.length-1;l>=0;l--){let h=a[l];if(r(h))for(let i=o.length-1;i>=0;i--){let r=o[i].feature;if(r.layer&&n[r.layer.id]<l)break;s.push(r),o.pop()}else for(let r of i){let i=r[h];if(i)for(let r of i)s.push(r.feature)}}return s}queryRasterValue(r,a,n){let o=this.getOwnSource(r);return o?"raster-array"!==o.type?(this.fire(new i.y(Error('queryRasterValue support only "raster-array" sources.'))),Promise.resolve(null)):o.queryRasterArrayValue(a,n):(this.fire(new i.y(Error(`Source with id "${r}" does not exist in the style.`))),Promise.resolve(null))}queryRenderedFeatures(r,a,n){let o;a&&!Array.isArray(a)&&a.filter&&(this._validate(tv,"queryRenderedFeatures.filter",a.filter,null,a),o=i.dj(a.filter));let s={},l=i=>{if(rv.has(i.type))return;let r=this.getOwnLayerSourceCache(i),a=s[r.id]=s[r.id]||{sourceCache:r,layers:{},has3DLayers:!1};i.is3D(!!this.terrain)&&(a.has3DLayers=!0),a.layers[i.fqid]=a.layers[i.fqid]||{styleLayer:i,targets:[]},a.layers[i.fqid].targets.push({filter:o})};if(a&&a.layers){if(!Array.isArray(a.layers))return this.fire(new i.y(Error("parameters.layers must be an Array."))),[];for(let r of a.layers){let a=this._layers[r];if(!a)return this.fire(new i.y(Error(`The layer '${r}' does not exist in the map's style and cannot be queried for features.`))),[];l(a)}}else for(let i in this._layers)l(this._layers[i]);let h=this._queryRenderedFeatures(r,s,n),u=this._flattenAndSortRenderedFeatures(h),c=[];for(let r of u)i.dk(r.layer.id)===this.scope&&c.push(r);return c}queryRenderedFeatureset(r,a,n){let o;a&&!Array.isArray(a)&&a.filter&&(this._validate(tv,"queryRenderedFeatures.filter",a.filter,null,a),o=i.dj(a.filter));let s="mock",l=[];if(a&&a.target)l.push(Object.assign({},a,{targetId:s,filter:o}));else{for(let i of this.getFeaturesetDescriptors())l.push({targetId:s,filter:o,target:i});for(let{style:i}of this.fragments)for(let r of i.getFeaturesetDescriptors())l.push({targetId:s,filter:o,target:r})}let h=this.queryRenderedTargets(r,l,n),u=[],c=new Set;for(let r of h)for(let a of r.variants[s])t3(a,r,c)||u.push(new i.dl(r,a));return u}queryRenderedTargets(r,a,n){let o={},s=(i,r,a,n)=>{let s=o[r.id]=o[r.id]||{sourceCache:r,layers:{},has3DLayers:!1};if(s.layers[i.fqid]=s.layers[i.fqid]||{styleLayer:i,targets:[]},i.is3D(!!this.terrain)&&(s.has3DLayers=!0),!n)return a.uniqueFeatureID=!1,void s.layers[i.fqid].targets.push(a);s.layers[i.fqid].targets.push(Object.assign({},a,{namespace:n.namespace,properties:n.properties,uniqueFeatureID:n.uniqueFeatureID}))};for(let r of a)if("featuresetId"in r.target){let{featuresetId:a,importId:n}=r.target,o=this.getFragmentStyle(n);if(!o||!o._featuresetSelectors)continue;let l=o._featuresetSelectors[a];if(!l){this.fire(new i.y(Error(`The featureset '${a}' does not exist in the map's style and cannot be queried for features.`)));continue}for(let i of l){let a=o.getOwnLayer(i.layerId);a&&!rv.has(a.type)&&s(a,o.getOwnLayerSourceCache(a),r,i)}}else if("layerId"in r.target){let{layerId:i}=r.target,a=this.getLayer(i);if(!a||rv.has(a.type))continue;s(a,this.getLayerSourceCache(a),r)}let l=this._queryRenderedFeatures(r,o,n);return this._flattenAndSortRenderedFeatures(l)}_queryRenderedFeatures(r,a,n){let o=[],s=!!this.map._showQueryGeometry,l=tq.createFromScreenPoints(r,n);for(let i in a){let r=function(i,r,a,n,o=!1,s){let l=r.sourceCache.transform,h=r.sourceCache.tilesIn(i,r.has3DLayers,o);h.sort(t5);let u=[];for(let i of h){let h=i.tile.queryRenderedFeatures(r,i,a,n,l,o,s);Object.keys(h).length&&u.push({wrappedTileID:i.tile.tileID.wrapped().key,queryResults:h})}for(let a in r.layers){let o=r.layers[a];if(o.styleLayer){let a=o.styleLayer.queryRenderedFeatures(i,r.sourceCache,n);Object.keys(a).length&&u.push({wrappedTileID:0,queryResults:a})}}return 0===u.length?{}:function(i){let r={},a={};for(let n of i){let i=n.queryResults,o=n.wrappedTileID,s=a[o]=a[o]||{};for(let a in i){let n=i[a],o=s[a]=s[a]||{},l=r[a]=r[a]||[];for(let i of n)o[i.featureIndex]||(o[i.featureIndex]=!0,l.push(i))}}return r}(u)}(l,a[i],this._availableImages,n,s,this.getActualScope());Object.keys(r).length&&o.push(r)}if(this.placement)for(let r in a){if(a[r].sourceCache._renderSourceType!==i.b7.Symbol)continue;let n=function(i,r,a,n,o,s){let l={},h=n.queryRenderedSymbols(i),u=[];for(let i of Object.keys(h).map(Number))u.push(o[i]);for(let i of(u.sort(t5),u)){let n=i.featureIndex.lookupSymbolFeatures(h[i.bucketInstanceId],i.bucketIndex,i.sourceLayerIndex,r,a,s);for(let r in n){let a=l[r]=l[r]||[],o=n[r];for(let r of(o.sort((r,a)=>{let n=i.featureSortOrder;if(n){let i=n.indexOf(r.featureIndex);return n.indexOf(a.featureIndex)-i}return a.featureIndex-r.featureIndex}),o))a.push(r)}}return l}(l.screenGeometry,a[r],this._availableImages,this.placement.collisionIndex,this.placement.retainedQueryData,this.map.getWorldview());Object.keys(n).length&&o.push(n)}return o}querySourceFeatures(i,r){let a=r&&r.filter;
8a&&this._validate(tv,"querySourceFeatures.filter",a,null,r);let n=[];for(let a of this.getOwnSourceCaches(i))n=n.concat(function(i,r){let a=i.getRenderableIds().map(r=>i.getTileByID(r)),n=[],o={};for(let i=0;i<a.length;i++){let s=a[i],l=s.tileID.canonical.key;o[l]||(o[l]=!0,s.querySourceFeatures(n,r))}return n}(a,r));return n}addSourceType(i,r,a){return rS.getSourceType(i)?a(Error(`A source type called "${i}" already exists.`)):(rS.setSourceType(i,r),a(null,null))}getFlatLight(){return this.light.getLight()}setFlatLight(r,a,n={}){this._checkLoaded();let o=this.light.getLight(),s=!1;for(let a in r)if(!i.b9(r[a],o[a])){s=!0;break}if(!s)return;let l=this._getTransitionParameters();this.light.setLight(r,a,n),this.light.updateTransitions(l)}getTerrain(){return this.terrain&&1===this.terrain.drapeRenderMode?this.terrain.get():null}setTerrainForDraping(){this.setTerrain({source:"",exaggeration:0},0)}checkCanvasFingerprintNoise(){void 0===this.disableElevatedTerrain&&(this.disableElevatedTerrain=i.o.hasCanvasFingerprintNoise(),this.disableElevatedTerrain&&i.w("Terrain and hillshade are disabled because of Canvas2D limitations when fingerprinting protection is enabled (e.g. in private browsing mode)."))}setTerrain(r,a=1){if(this._checkLoaded(),!r)return this.terrainSetForDrapingOnly()||(delete this.terrain,this.map.transform.projection.requiresDraping&&this.setTerrainForDraping()),0===a&&delete this.terrain,null===r?this.stylesheet.terrain=null:delete this.stylesheet.terrain,this._force3DLayerUpdate(),void(this._markersNeedUpdate=!0);this.checkCanvasFingerprintNoise();let n=r,o=!("source"in r)||null==r.source;if(1===a){if(this.disableElevatedTerrain)return;if("source"in n&&"object"==typeof n.source){let r="terrain-dem-src";this.addSource(r,n.source),n=Object.assign(n=i.db(n),{source:r})}let r=Object.assign({},n),a={};if(this.terrain&&o){r.source=this.terrain.get().source;let i=this.terrain?this.getFragmentStyle(this.terrain.scope):null;i&&(a.style=i.serialize())}if(this._validate(tm,"terrain",r,a))return}if(this.terrain&&(this.terrain.scope===this.scope||o)&&(!this.terrain||a===this.terrain.drapeRenderMode)){let a=this.terrain,o=a.get();for(let r of Object.keys(i.a6.terrain))!Object.hasOwn(n,r)&&i.a6.terrain[r].default&&(n[r]=i.a6.terrain[r].default);for(let n in r)if(!i.b9(r[n],o[n])){a.set(r,this.options),this.stylesheet.terrain=r;let n=this._getTransitionParameters({duration:0});a.updateTransitions(n),this.fire(new i.z("data",{dataType:"style"}));break}}else{if(!n)return;this._createTerrain(n,a),this.fire(new i.z("data",{dataType:"style"}))}this.mergeTerrain(),this.updateDrapeFirstLayers(),this._markersNeedUpdate=!0}_createFog(i){let r=this.fog=new tL(i,this.map.transform,this.scope,this.options);this.stylesheet.fog=r.get();let a=this._getTransitionParameters({duration:0});r.updateTransitions(a)}_createSnow(i){let r=this.snow=new tB(i,this.map.transform,this.scope,this.options);this.stylesheet.snow=r.get();let a=this._getTransitionParameters({duration:0});r.updateTransitions(a)}_createRain(i){let r=this.rain=new tk(i,this.map.transform,this.scope,this.options);this.stylesheet.rain=r.get();let a=this._getTransitionParameters({duration:0});r.updateTransitions(a)}_updateMarkersOpacity(){0!==this.map._markers.length&&this.map._requestDomTask(()=>{for(let i of this.map._markers)i._evaluateOpacity()})}getFog(){return this.fog?this.fog.get():null}setFog(r){if(this._checkLoaded(),r)if(this.fog){let a=this.fog;if(!i.b9(a.get(),r)){a.set(r,this.options),this.stylesheet.fog=a.get();let i=this._getTransitionParameters({duration:0});a.updateTransitions(i)}}else this._createFog(r);else delete this.fog,delete this.stylesheet.fog;this._markersNeedUpdate=!0,this._programPrecompiler&&this._programPrecompiler.reset()}getSnow(){return this.snow?this.snow.get():null}setSnow(r){if(this._checkLoaded(),!r)return delete this.snow,void delete this.stylesheet.snow;if(this.snow){let a=this.snow;if(!i.b9(a.get(),r)){a.set(r,this.options),this.stylesheet.snow=a.get();let i=this._getTransitionParameters({duration:0});a.updateTransitions(i)}}else this._createSnow(r);
8this._markersNeedUpdate=!0}getRain(){return this.rain?this.rain.get():null}setRain(r){if(this._checkLoaded(),!r)return delete this.rain,void delete this.stylesheet.rain;if(this.rain){let a=this.rain;if(!i.b9(a.get(),r)){a.set(r,this.options),this.stylesheet.rain=a.get();let i=this._getTransitionParameters({duration:0});a.updateTransitions(i)}}else this._createRain(r);this._markersNeedUpdate=!0}_reloadColorTheme(){let r=()=>{for(let i in this._layers)this._layers[i].lut=this._styleColorTheme.lut;for(let i in this._sourceCaches)this._sourceCaches[i].clearTiles()},a=this._styleColorTheme.colorThemeOverride?this._styleColorTheme.colorThemeOverride:this._styleColorTheme.colorTheme;if(!a)return this._styleColorTheme.lut=null,void r();let n=this._evaluateColorThemeData(a);this._loadColorTheme(n).then(()=>{this.fire(new i.z("colorthemeset")),r()}).catch(r=>{i.w(`Couldn't set color theme: ${r}`)})}setColorTheme(r){this._checkLoaded(),this._styleColorTheme.colorThemeOverride&&i.w("Note: setColorTheme is called on a style with a color-theme override, the passed color-theme won't be visible."),this._styleColorTheme.colorTheme=r,this._reloadColorTheme()}setImportColorTheme(i,r){let a=this.getFragmentStyle(i);a&&(a._styleColorTheme.colorThemeOverride=r,a._reloadColorTheme())}_getTransitionParameters(r){return{now:i.o.now(),transition:Object.assign(this.transition,r)}}updateDrapeFirstLayers(){if(!this.terrain)return;let i=[],r=[];for(let a of this._mergedOrder)this.isLayerDraped(this._mergedLayers[a])?i.push(a):r.push(a);this._drapedFirstOrder=[],this._drapedFirstOrder.push(...i),this._drapedFirstOrder.push(...r)}_createTerrain(i,r){let a=this.terrain=new tC(i,r,this.scope,this.options,this.map.getWorldview());1===r&&(this.stylesheet.terrain=i),this.mergeTerrain(),this.updateDrapeFirstLayers(),this._force3DLayerUpdate();let n=this._getTransitionParameters({duration:0});a.updateTransitions(n)}_force3DLayerUpdate(){for(let i in this._layers){let r=this._layers[i];"fill-extrusion"===r.type&&this._updateLayer(r)}}_forceSymbolLayerUpdate(){for(let i in this._layers){let r=this._layers[i];"symbol"===r.type&&this._updateLayer(r)}}_validate(r,a,n,o,s={}){if(s&&!1===s.validate)return!1;let l=Object.assign({},this.serialize());return rg(this,r.call(tc,Object.assign({key:a,style:l,value:n,styleSpec:i.a6},o)))}_remove(){for(let r in this._programPrecompiler&&(this._programPrecompiler.reset(),this._programPrecompiler=null),this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),i.dm.off("pluginStateChange",this._rtlTextPluginCallback),this._mergedLayers)this._mergedLayers[r].setEventedParent(null);for(let i in this._mergedSourceCaches){let r=this._mergedSourceCaches[i];r.clearTiles(),r.setEventedParent(null);let a=r.getSource();a&&a.onRemove&&a.onRemove(this.map)}this.imageManager.removeScope(this.scope),this.imageManager.imageAtlasCache.clear(),this.setEventedParent(null),delete this.fog,delete this.snow,delete this.rain,delete this.terrain,delete this.ambientLight,delete this.directionalLight,this.indoorManager.destroy(),this.isRootStyle()&&(this.imageManager.setEventedParent(null),this.modelManager.setEventedParent(null),this.modelManager.destroy(),this.dispatcher.remove())}clearSource(i){for(let r of this.getSourceCaches(i))r.clearTiles()}clearSources(){for(let i in this._mergedSourceCaches)this._mergedSourceCaches[i].clearTiles()}clearLayers(){for(let i in this._mergedLayers){let r=this._mergedLayers[i];r._clear&&r._clear()}}reloadSource(i){for(let r of this.getSourceCaches(i))r.resume(),r.reload()}
8reloadSources(){for(let i of this.getSources())i.reload&&i.reload()}reloadModels(){this.modelManager.reloadModels(""),this.forEachFragmentStyle(i=>{i.modelManager.reloadModels(i.scope)})}updateSources(i){let r;this.directionalLight&&(r=rn(this.directionalLight));let a=new Set,n=new Set,o=new Set;for(let i in this._mergedLayers){let r=this._mergedLayers[i];"building"===r.type?a.add(r.source):"raster"===r.type&&r.paint&&"ground"===r.paint.get("raster-elevation-reference")&&o.add(r.source),r.hasElevation()&&!n.has(r.source)&&n.add(r.source)}for(let s in this._mergedSourceCaches){let l=this._mergedSourceCaches[s],h=n.has(l._source.id);l._isRasterElevatedOverTerrain=o.has(l._source.id),a.has(l._source.id)&&(l._source.reparseOverscaled=!1),l.update(i,void 0,void 0,r,h)}}_reloadSources(){for(let i in this._sourceCaches){let r=this._sourceCaches[i];r.resume(),r.reload()}}_handleLayerOrderChange(){this._requestFullLabelPlacement(),this.fire(new i.z("neworder"))}_requestFullLabelPlacement(){this.pauseablePlacement||(this.pauseablePlacement=new iH),this.pauseablePlacement.requestFullPlacement()}_setLabelPlacementStale(){this.placement&&this.placement.setStale()}_updatePlacement(r,a,n,o,s){this.pauseablePlacement||(this.pauseablePlacement=new iH);let l=!1,h=!1,u={},c={};for(let a of this._mergedOrder){let n=this._mergedLayers[a];if("symbol"!==n.type)continue;let o=i.t(n.source,n.scope),s=u[o];if(!s){let i=this.getLayerSourceCache(n);if(!i)continue;let r=i.getRenderableIds(!0).map(r=>i.getTileByID(r));c[o]=r.slice(),s=u[o]=r.sort((i,r)=>r.tileID.overscaledZ-i.tileID.overscaledZ||(i.tileID.isLessThan(r.tileID)?-1:1))}let h=this.crossTileSymbolIndex.addLayer(n,s,r.center.lng,r.projection);l=l||h}this.crossTileSymbolIndex.pruneUnusedLayers(this._mergedOrder);let d=!!(this.placement&&!r.equals(this.placement.transform)),p=!!(this.placement&&(0!==this.placement.lastReplacementSourceUpdateTime&&!s||this.placement.lastReplacementSourceUpdateTime!==s.updateTime)),f=d||p||l,m=(f||this.pauseablePlacement.isStale())&&0===n,_=this.pauseablePlacement.isDone()&&!this.placement.stillRecent(i.o.now(),r.zoom)&&0!==n;if((this.pauseablePlacement.isFullPlacementRequested()||!this.pauseablePlacement.placement||m||_)&&(this.pauseablePlacement=this.pauseablePlacement.startNewPlacement(r,this._mergedOrder,a,n,o,this.placement,this.fog&&r.projection.supportsFog?this.fog.state:null,this._buildingIndex),this.map.painter)){let i=this.map.painter.maxFrontCutoffRawStart;if(i>0){let a=180*r.pitch/Math.PI;if(a>=15){let r=Math.min(1,Math.max(0,(a-15)/5)),n=r*r*(3-2*r);this.pauseablePlacement.placement.frontCutoffStart=-.5*(1-n)+i*n}}}if(this.pauseablePlacement.isDone()?f&&0!==n&&this.pauseablePlacement.setStale():(this.pauseablePlacement.continuePlacement(this._mergedOrder,this._mergedLayers,u,c,this.map.painter.scaleFactor),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(i.o.now()),h=!0),l&&this.pauseablePlacement.setStale()),h||l){this._buildingIndex.onNewFrame(r.zoom);for(let r=0;r<this._mergedOrder.length;r++){let a=this._mergedLayers[this._mergedOrder[r]];if("symbol"!==a.type||"none"===a.visibility)continue;let n=this.isLayerClipped(a);this.placement.updateLayerOpacities(a,u[i.t(a.source,a.scope)],r,n?s:null)}}return!this.pauseablePlacement.isDone()||this.placement.isStale()||this.placement.hasTransitions(i.o.now())}_releaseSymbolFadeTiles(){for(let i in this._sourceCaches)this._sourceCaches[i].releaseSymbolFadeTiles()}addImport(r,a){this._checkLoaded();let n=this.stylesheet.imports=this.stylesheet.imports||[];if(-1!==n.findIndex(({id:i})=>i===r.id))return void this.fire(new i.y(Error(`Import with id '${r.id}' already exists in the map's style.`)));if(!a)return n.push(r),this._loadImports([r],!0);let o=n.findIndex(({id:i})=>i===a);return -1===o&&this.fire(new i.y(Error(`Import with id "${a}" does not exist on this map.`))),this.stylesheet.imports=n.slice(0,o).concat(r).concat(n.slice(o)),this._loadImports([r],!0,a)}updateImport(r,a){this._checkLoaded();let n=this.stylesheet.imports||[],o=this.getImportIndex(r);return -1===o||("string"==typeof a?this.setImportUrl(r,a):(a.url&&a.url!==n[o].url&&this.setImportUrl(r,a.url),i.b9(a.config,n[o].config)||this.setImportConfig(r,a.config,a.data.schema),i.b9(a.data,n[o].data)||this.setImportData(r,a.data))),this}moveImport(i,r){this._checkLoaded();let a=this.stylesheet.imports||[],n=this.getImportIndex(i);if(-1===n)return this;let o=this.getImportIndex(r);if(-1===o)return this;let s=a[n],l=this.fragments[n];return a=a.filter(({id:r})=>r!==i),this.fragments=this.fragments.filter(({id:r})=>
8r!==i),this.stylesheet.imports=a.slice(0,o).concat(s).concat(a.slice(o)),this.fragments=this.fragments.slice(0,o).concat(l).concat(this.fragments.slice(o)),this.mergeLayers(),this}setImportUrl(i,r){this._checkLoaded();let a=this.stylesheet.imports||[],n=this.getImportIndex(i);if(-1===n)return this;a[n].url=r;let o=this.fragments[n];return o.style=this._createFragmentStyle(a[n]),o.style.on("style.import.load",()=>this.mergeAll()),o.style.loadURL(r),this}setImportData(i,r){this._checkLoaded();let a=this.getImportIndex(i),n=this.stylesheet.imports||[];return -1===a?this:r?(this.fragments[a].style.setState(r),this._reloadImports(),this):(delete n[a].data,this.setImportUrl(i,n[a].url))}setImportConfig(i,r,a){this._checkLoaded();let n=this.getImportIndex(i),o=this.stylesheet.imports||[];if(-1===n)return this;r?o[n].config=r:delete o[n].config;let s=this.fragments[n];a&&s.style.stylesheet&&(s.style.stylesheet.schema=a);let l=s.style.stylesheet&&s.style.stylesheet.schema;return s.config=r,s.style.updateConfig(r,l),this.updateConfigDependencies(),this}removeImport(i){this._checkLoaded();let r=this.stylesheet.imports||[],a=this.getImportIndex(i);-1!==a&&(r.splice(a,1),this.fragments[a].style._remove(),this.fragments.splice(a,1),this._reloadImports())}getImportIndex(r){let a=(this.stylesheet.imports||[]).findIndex(i=>i.id===r);return -1===a&&this.fire(new i.y(Error(`Import '${r}' does not exist in the map's style and cannot be updated.`))),a}getLayer(i){return this._mergedLayers[i]}getSources(){let i=[];for(let r in this._mergedOtherSourceCaches){let a=this._mergedOtherSourceCaches[r];a&&i.push(a.getSource())}return i}getSource(i,r){let a=this.getSourceCache(i,r);return a&&a.getSource()}getLayerSource(i){let r=this.getLayerSourceCache(i);return r&&r.getSource()}getSourceCache(r,a){let n=i.t(r,a);return this._mergedOtherSourceCaches[n]}getLayerSourceCache(r){let a=i.t(r.source,r.scope);return"symbol"===r.type?this._mergedSymbolSourceCaches[a]:"fill-extrusion"===r.type&&this._mergedFillExtrusionSourceCaches[a]||this._mergedOtherSourceCaches[a]}getSourceCaches(i){if(null==i)return Object.values(this._mergedSourceCaches);let r=[];return this._mergedOtherSourceCaches[i]&&r.push(this._mergedOtherSourceCaches[i]),this._mergedSymbolSourceCaches[i]&&r.push(this._mergedSymbolSourceCaches[i]),this._mergedFillExtrusionSourceCaches[i]&&r.push(this._mergedFillExtrusionSourceCaches[i]),r}updateSourceCaches(){let i=this._changes.getUpdatedSourceCaches();for(let r in i){let a=i[r];"reload"===a?this.reloadSource(r):"clear"===a&&this.clearSource(r)}}updateLayers(i){for(let r of this._changes.getUpdatedPaintProperties()){let a=this.getLayer(r);a&&a.updateTransitions(i)}}getGlyphsUrl(){return this.stylesheet.glyphs}setGlyphsUrl(i){this.stylesheet.glyphs=i,this.glyphManager.setURL(i)}getImages(r,a,n){this.imageManager.getImages(a.icons.concat(a.patterns),a.scope,n),this._updateTilesForChangedImages();let o=a.icons.map(r=>i.I.toString(r)),s=a.patterns.map(r=>i.I.toString(r)),l=i=>{i&&(i.setDependencies(a.tileID.key,"icons",o),i.setDependencies(a.tileID.key,"patterns",s))},h=i.t(a.source,a.scope);l(this._mergedOtherSourceCaches[h]),l(this._mergedSymbolSourceCaches[h]),(a.icons.some(i=>i.iconsetId)||a.patterns.some(i=>i.iconsetId))&&this.fire(new i.z("data",{dataType:"style"}))}rasterizeImages(i,r,a){this.imageManager.rasterizeImages(r,a)}checkAtlasCache(i,r,a){let n=this.imageManager.imageAtlasCache.findCachedAtlas(r.descriptor);a(null,n&&n.contentDescriptor?{iconPositions:n.iconPositions,patternPositions:n.patternPositions,sourceHash:n.contentDescriptor.hash}:null)}getGlyphs(i,r,a){this.glyphManager.getGlyphs(r.stacks,a)}getOwnSourceCache(i){return this._otherSourceCaches[i]}getOwnLayerSourceCache(i){return"symbol"===i.type?this._symbolSourceCaches[i.source]:"fill-extrusion"===i.type&&this._fillExtrusionSourceCaches[i.source]||this._otherSourceCaches[i.source]}getOwnSourceCaches(i){let r=[];return this._otherSourceCaches[i]&&r.push(this._otherSourceCaches[i]),this._symbolSourceCaches[i]&&r.push(this._symbolSourceCaches[i]),this._fillExtrusionSourceCaches[i]&&r.push(this._fillExtrusionSourceCaches[i]),r}_isSourceCacheLoaded(r){let a=this.getOwnSourceCaches(r);return 0===a.length?(this.fire(new i.y(Error(`There is no source with ID '${r}'`))),!1):a.every(i=>i.loaded())}has3DLayers(){return this._has3DLayers}hasSymbolLayers(){return this._hasSymbolLayers}hasCircleLayers(){return this._hasCircleLayers}isLayerClipped(i,r){if(!this._clipLayerPresent&&"fill-extrusion"!==i.type&&"building"!==i.type)return!1;
8let a="fill-extrusion"===i.type&&("building"===i.sourceLayer||"procedural_buildings"===i.sourceLayer),n="building"===i.type;if(i.is3D(!!this.terrain)){if(a||n||r&&"batched-model"===r.type||"model"===i.type)return!0}else if("symbol"===i.type)return!0;return!1}_clearWorkerCaches(){this.dispatcher.broadcast("clearCaches")}getBOMObject(){}destroy(){this._clearWorkerCaches(),this.imageManager.imageAtlasCache.clear(),this.fragments.forEach(i=>{i.style._remove()}),this.terrainSetForDrapingOnly()&&(delete this.terrain,delete this.stylesheet.terrain)}}rS.getSourceType=function(i){return t0[i]},rS.setSourceType=function(i,r){t0[i]=r},rS.registerForPluginStateChange=i.dn;var rE="\n#define EPSILON 0.0000001\n#define PI 3.141592653589793\n#ifdef RENDER_CUTOFF\nfloat 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);}\n#endif",rI="\n#ifdef DUAL_SOURCE_BLENDING\nlayout(location=0,index=0) out vec4 glFragColor;layout(location=0,index=1) out vec4 glFragColorSrc1;\n#elif defined(FLOAT_RENDER_TARGET)\nlayout(location=0) out highp vec4 glFragColor;\n#else\nlayout(location=0) out vec4 glFragColor;\n#endif\n#ifdef USE_MRT1\nlayout(location=1) out vec4 out_Target1;\n#endif\nhighp float unpack_depth(highp vec4 rgba_depth)\n{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;}\n#ifdef INDICATOR_CUTOUT\nuniform vec3 u_indicator_cutout_centers;uniform vec4 u_indicator_cutout_params;\n#endif\nconst float DITHER_THRESHOLDS[16]=float[16](\n1.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\n);vec4 applyCutout(vec4 color,float height) {\n#ifdef INDICATOR_CUTOUT\nfloat 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);\n#else\nreturn color;\n#endif\n}float cutoutGroundRoofOpacity(vec4 groundRoof) {\n#ifdef INDICATOR_CUTOUT\nfloat 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);\n#else\nreturn 1.0;\n#endif\n}\n#ifdef DEBUG_WIREFRAME\n#define HANDLE_WIREFRAME_DEBUG \\\nglFragColor=vec4(0.7,0.0,0.0,0.7); \\\ngl_FragDepth=gl_FragCoord.z-0.0001;\n#else\n#define HANDLE_WIREFRAME_DEBUG\n#endif\n#ifdef RENDER_CUTOFF\nuniform highp vec4 u_cutoff_params;in float v_cutoff_opacity;\n#endif\nvec4 textureLodCustom(sampler2D image,highp vec2 pos,highp vec2 lod_coord) {highp vec2 size=vec2(textureSize(image,0));highp vec2 dx=dFdx(lod_coord.xy*size);highp vec2 dy=dFdy(lod_coord.xy*size);highp float delta_max_sqr=max(dot(dx,dx),dot(dy,dy));highp float lod=0.5*log2(delta_max_sqr);return textureLod(image,pos,lod);}vec4 premultiplyColor(vec3 nonPremultipliedColor,float a) {return vec4(nonPremultipliedColor*a,a);}vec3 unpremultiplyColor(vec4 premultipliedColor) {if (premultipliedColor.a > 0.0) {return premultipliedColor.rgb/premultipliedColor.a;}return premultipliedColor.rgb;}vec3 applyLUT(highp sampler3D lut,vec3 col) {vec3 size=vec3(textureSize(lut,0));vec3 uvw=(col.rbg*float(size-1.0)+0.5)/size;return texture(lut,uvw).rgb;}vec4 applyLUT(highp sampler3D lut,vec4 premultipliedColor) {return premultiplyColor(applyLUT(lut,unpremultiplyColor(premultipliedColor)),premultipliedColor.a);}",rA="\n#define EXTENT 8192.0\n#define RAD_TO_DEG 180.0/PI\n#define DEG_TO_RAD PI/180.0\n#define GLOBE_RADIUS EXTENT/PI/2.0\nfloat wrap(float n,float min,float max) {float d=max-min;
8float w=mod(mod(n-min,d)+d,d)+min;return (w==min) ? max : w;}\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 mercator_tile_position(mat4 matrix,vec2 tile_anchor,vec3 tile_id,vec2 mercator_center) {\n#ifndef PROJECTED_POS_ON_VIEWPORT\nfloat 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;\n#else\nreturn vec3(0.0);\n#endif\n}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);}\n#endif\nvec2 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(\nunpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0\n);}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);return (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);}\n#ifdef RENDER_CUTOFF\nuniform vec4 u_cutoff_params;out float v_cutoff_opacity;\n#endif\nconst vec4 AWAY=vec4(-1000.0,-1000.0,-1000.0,1);const float skirtOffset=24575.0;vec3 decomposeToPosAndSkirt(ivec2 posWithComposedSkirt)\n{float skirt=float(float(posWithComposedSkirt.x) >=skirtOffset);vec2 pos=vec2(posWithComposedSkirt)-vec2(skirt*skirtOffset,0.0);return vec3(pos,skirt);}\n#ifndef HAS_SHADER_STORAGE_BLOCK_material_buffer\n#define GET_ATTRIBUTE_float(attrib,matInfo,attrib_id) attrib\n#define GET_ATTRIBUTE_vec4(attrib,matInfo,attrib_id) attrib\n#define GET_ATTRIBUTE_vec2(attrib,matInfo,attrib_id) attrib\n#define DECLARE_MATERIAL_TABLE_INFO\n#endif",rM="in highp vec3 a_pos_3f;uniform lowp mat4 u_matrix;out highp vec3 v_uv;void main() {const mat3 half_neg_pi_around_x=mat3(1.0,0.0, 0.0,0.0,0.0,-1.0,0.0,1.0, 0.0);v_uv=half_neg_pi_around_x*a_pos_3f;vec4 pos=u_matrix*vec4(a_pos_3f,1.0);gl_Position=pos.xyww;}",rC="\n#define ELEVATION_SCALE 7.0\n#define ELEVATION_OFFSET 450.0\n#ifdef PROJECTION_GLOBE_VIEW\nuniform 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(\nmix(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;}\n#else\nvec3 elevationVector(vec2 pos) { return vec3(0,0,1); }\n#endif\n#ifdef TERRAIN\nuniform 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);}
8float currentElevation(vec2 apos) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nvec2 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;\n#else\nfloat 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);\n#endif\n}float prevElevation(vec2 apos) {\n#ifdef TERRAIN_DEM_FLOAT_FORMAT\nvec2 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;\n#else\nfloat 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);\n#endif\n}\n#ifdef TERRAIN_VERTEX_MORPHING\nfloat elevation(vec2 apos) {\n#ifdef ZERO_EXAGGERATION\nreturn 0.0;\n#endif\nfloat nextElevation=currentElevation(apos);float prevElevation=prevElevation(apos);return mix(prevElevation,nextElevation,u_dem_lerp);}\n#else\nfloat elevation(vec2 apos) {\n#ifdef ZERO_EXAGGERATION\nreturn 0.0;\n#endif\nreturn currentElevation(apos);}\n#endif\nvec4 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);}\n#else\nfloat elevation(vec2 pos) { return 0.0; }\n#endif\n#ifdef DEPTH_OCCLUSION\nuniform 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;\n#ifdef DEPTH_D24\nfloat 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);}\n#else\nhighp float unpack_depth_rgba(vec4 rgba_depth)\n{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;}\n#endif\nbool isOccluded(vec4 frag) {vec3 coord=frag.xyz/frag.w;\n#ifdef CLIP_ZERO_TO_ONE\ncoord.z=-1.0+2.0*coord.z; \n#endif\n#ifdef DEPTH_D24\nfloat depth=unpack_depth(texture(u_depth,(coord.xy+1.0)*0.5).r);\n#else\nfloat depth=unpack_depth_rgba(texture(u_depth,(coord.xy+1.0)*0.5));\n#endif\nreturn coord.z+u_occlusion_depth_offset > depth;}highp vec4 getCornerDepths(vec2 coord) {highp vec3 df=vec3(u_occluder_half_size*u_depth_
8size_inv,0.0);highp vec2 uv=0.5*coord.xy+0.5;\n#ifdef DEPTH_D24\nhighp vec4 depth=vec4(\ntexture(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\n);depth=unpack_depth4(depth);\n#else\nhighp vec4 depth=vec4(\nunpack_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))\n);\n#endif\nreturn depth;}highp float occlusionFadeMultiSample(vec4 frag) {highp vec3 coord=frag.xyz/frag.w;highp vec2 uv=0.5*coord.xy+0.5;\n#ifdef CLIP_ZERO_TO_ONE\ncoord.z=-1.0+2.0*coord.z; \n#endif\nint 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) {\n#ifdef DEPTH_D24\nhighp float depth=unpack_depth(texture(u_depth,uv-df+vec2(float(x)*oneStep.x,float(y)*oneStep.y)).r);\n#else\nhighp float depth=unpack_depth_rgba(texture(u_depth,uv-df+vec2(float(x)*oneStep.x,float(y)*oneStep.y)));\n#endif\nres+=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;\n#ifdef CLIP_ZERO_TO_ONE\ncoord.z=-1.0+2.0*coord.z; \n#endif\nhighp 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));}\n#else\nbool isOccluded(vec4 frag) { return false; }highp float occlusionFade(vec4 frag) { return 1.0; }highp float occlusionFadeMultiSample(vec4 frag) { return 1.0; }\n#endif",rP="#ifdef FOG\nuniform 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);}\n#endif",rD="#ifdef FOG\nuniform 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;\n#ifdef FLIP_Y\nuv.y=1.0-uv.y;\n#endif\nhighp vec3 ray_dir=mix(\nmix(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;}
8vec3 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);}\n#endif",rR="\n#ifdef LIGHTING_3D_MODE\nuniform mediump vec3 u_lighting_ambient_color;uniform mediump vec3 u_lighting_directional_dir;uniform mediump vec3 u_lighting_directional_color;uniform mediump vec3 u_ground_radiance;float calculate_ambient_directional_factor(vec3 normal) {float NdotL=dot(normal,u_lighting_directional_dir);const float factor_reduction_max=0.3;float dir_luminance=dot(u_lighting_directional_color,vec3(0.2126,0.7152,0.0722));float directional_factor_min=1.0-factor_reduction_max*min(dir_luminance,1.0);float ambient_directional_factor=mix(directional_factor_min,1.0,min((NdotL+1.0),1.0));const float vertical_factor_min=0.92;float vertical_factor=mix(vertical_factor_min,1.0,normal.z*0.5+0.5);return vertical_factor*ambient_directional_factor;}vec3 linearProduct(vec3 srgbIn,vec3 k) {return srgbIn*pow(k,vec3(1./2.2));}vec3 apply_lighting(vec3 color,vec3 normal,float dir_factor) {float ambient_directional_factor=calculate_ambient_directional_factor(normal);vec3 ambient_contrib=ambient_directional_factor*u_lighting_ambient_color;vec3 directional_contrib=u_lighting_directional_color*dir_factor;return linearProduct(color,ambient_contrib+directional_contrib);}vec4 apply_lighting(vec4 color,vec3 normal,float dir_factor) {return vec4(apply_lighting(color.rgb,normal,dir_factor),color.a);}vec3 apply_lighting(vec3 color,vec3 normal) {float dir_factor=max(dot(normal,u_lighting_directional_dir),0.0);return apply_lighting(color.rgb,normal,dir_factor);}vec4 apply_lighting(vec4 color,vec3 normal) {float dir_factor=max(dot(normal,u_lighting_directional_dir),0.0);return vec4(apply_lighting(color.rgb,normal,dir_factor),color.a);}vec3 apply_lighting_ground(vec3 color) {return color*u_ground_radiance;}vec4 apply_lighting_ground(vec4 color) {return vec4(apply_lighting_ground(color.rgb),color.a);}float calculate_NdotL(vec3 normal) {const float ext=0.70710678118;return (clamp(dot(normal,u_lighting_directional_dir),-ext,1.0)+ext)/(1.0+ext);}vec4 apply_lighting_with_emission_ground(vec4 color,float emissive_strength) {return mix(apply_lighting_ground(color),color,emissive_strength);}vec3 compute_flood_lighting(vec3 flood_light_color,float fully_occluded_factor,float occlusion,vec3 ground_shadow_factor) {vec3 fully_occluded_color=flood_light_color*mix(ground_shadow_factor,vec3(1.0),fully_occluded_factor);float occlusion_ramp=smoothstep(0.0,0.2,1.0-occlusion);return mix(fully_occluded_color,flood_light_color,occlusion_ramp);}vec3 compute_emissive_draped(vec3 unlit_color,float fully_occluded_factor,float occlusion,vec3 ground_shadow_factor) {vec3 fully_occluded_color=unlit_color*mix(ground_shadow_factor,vec3(1.0),fully_occluded_factor);return mix(fully_occluded_color,unlit_color,1.0-occlusion);}\n#endif",rz="#ifdef RASTER_ARRAY\nuniform 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);}
8vec2 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)\n);}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)\n);}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);}\n#endif",rL="#ifdef RENDER_SHADOWS\nuniform 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];}\n#endif",rF="#ifdef RENDER_SHADOWS\nprecision highp sampler2DShadow;uniform sampler2DShadow u_shadowmap_0;uniform sampler2DShadow u_shadowmap_1;uniform float u_shadow_intensity;uniform float u_shadow_map_resolution;uniform float u_shadow_texel_size;uniform highp vec3 u_shadow_normal_offset;uniform vec2 u_fade_range;uniform mediump vec3 u_shadow_direction;uniform highp vec3 u_shadow_bias;float shadow_sample(sampler2DShadow shadowmap,highp vec3 pos,highp float bias) {\n#ifdef CLIP_ZERO_TO_ONE\nhighp vec3 coord=vec3(pos.xy*0.5+0.5,pos.z-bias);\n#else\nhighp vec3 coord=vec3(pos.xy*0.5+0.5,pos.z*0.5+0.5-bias);\n#endif\nreturn 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;\n#ifdef SHADOWS_SINGLE_CASCADE\nvec2 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);\n#else\nlight_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);\n#endif\n}highp float calculate_shadow_bias(float NDotL) {\n#ifdef NORMAL_OFFSET\nreturn 0.5*u_shadow_bias.x;\n#else\nreturn 0.5*(u_shadow_bias.x+clamp(u_shadow_bias.y*tan(acos(NDotL)),0.0,u_shadow_bias.z));\n#endif\n}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)\n{highp vec2 biasUV=vec2(\npos_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);}\n#endif";
8let rO=/#include\s+"([^"]+)"/g,rB=/#pragma mapbox: ([\w\-]+) ([\w]+) ([\w]+) ([\w]+)/g,rk=/\b[A-Za-z_][A-Za-z0-9_]*\b/g,rN=new Set(["ifdef","ifndef","elif","if","defined"]),rU=new Set;rY(rE,rU),rY(rA,rU),rY(rI,rU);let rV={"_prelude_fog.vertex.glsl":rP,"_prelude_terrain.vertex.glsl":rC,"_prelude_shadow.vertex.glsl":rL,"_prelude_material_table.vertex.glsl":"#ifdef HAS_SHADER_STORAGE_BLOCK_material_buffer\n#define MATERIAL_TABLE_DEBUG 0\nuniform int u_material_offset;uniform int u_vertex_offset;layout(std140,binding=0)readonly buffer material_buffer{uvec4 material_data[];};struct MaterialInfo{uint dataOffset;\n#if MATERIAL_TABLE_DEBUG\nvec4 colorDebug;\n#endif\n};uint read_buf_no_offset(uint iDword) {return material_data[iDword/4u][iDword % 4u];}uint read_buf(uint iDword) {iDword+=uint(u_material_offset/4);return read_buf_no_offset(iDword);}float read_buf_float(uint iDword){return uintBitsToFloat(read_buf(iDword));}uint read_buf_uint8(uint iDword,uint iUint8){uint dwordOffset=iDword+(iUint8/4u);uint byteOffset=iUint8 & 3u;uint bitOffset=8u*byteOffset;uint mask=0xffu << bitOffset;uint dwordVal=read_buf(dwordOffset);return (dwordVal & mask) >> bitOffset;}uint read_buf_uint16(uint iDword,uint iUint16){uint dwordOffset=iDword+(iUint16 >> 1u);uint bitOffset=(iUint16 & 1u)*16u;uint mask=0xffffu << bitOffset;uint dwordVal=read_buf(dwordOffset);return (dwordVal & mask) >> bitOffset;}uint nrDwordsForVertexIdEntries(uint nrMaterialLookupEntries) {return nrMaterialLookupEntries;}uint nrDwordsForMaterialIdEntries(uint nrMaterialLookupEntries) {return (nrMaterialLookupEntries*2u+3u)/4u;}uint findRangeBinarySearch(uint vertexId,uint numRanges,uint dwordOffset) {uint left=0u;uint right=numRanges-1u;for (uint i=0u; i < 16u; i++) { \nif (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; \n}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 { \niRange=findRangeBinarySearch(vertexId,numRanges,dwordOffset);}return iRange;}MaterialInfo read_material_info(uint vertex_id) {MaterialInfo info;\n#if MATERIAL_TABLE_DEBUG\nconst 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;\n#endif\nuint offset=0u;\n#if MATERIAL_TABLE_DEBUG\nbool keepFinding=true;uint magic=read_buf(offset);if(magic !=0xCAFEBABEu) {info.colorDebug=red;keepFinding=false;return info;}\n#endif\noffset++;\n#if MATERIAL_TABLE_DEBUG\nuint nrMaterials=read_buf(offset);uint nrVertices=read_buf(offset+1u);if(keepFinding && vertex_id >=nrVertices) {info.colorDebug=red;keepFinding=false;}\n#endif\noffset+=2u;uint nrMaterialLookupEntries=read_buf(offset++);uint perMaterialEntrySizeDwords=read_buf(offset++);\n#if MATERIAL_TABLE_DEBUG\nif(keepFinding && perMaterialEntrySizeDwords !=1u) {info.colorDebug=red;keepFinding=false;}\n#endif\nuint iMaterialLookup=findRange(vertex_id,nrMaterialLookupEntries,offset);\n#if MATERIAL_TABLE_DEBUG\nif(keepFinding)\n{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;}}}\n#endif\noffset+=nrDwordsForVertexIdEntries(nrMaterialLookupEntries);uint materialId=iMaterialLookup;\n#if MATERIAL_TABLE_DEBUG\nif(keepFinding) {if(materialId >=nrMaterialLookupEntries) {info.colorDebug=red;}}\n#endif\ninfo.dataOffset=offset+materialId*perMaterialEntrySizeDwords;return info;}uint get_data_location(const MaterialInfo matInfo,uint attribOffsetBytes)\n{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);}\n#define GET_ATTRIBUTE_float(attrib,matInfo,attrib_offset) read_material_float(matInfo,attrib_offset)\n#define GET_ATTRIBUTE_vec4(attrib,matInfo,attrib_offset) read_material_vec4(matInfo,attrib_offset)\n#define GET_ATTRIBUTE_vec2(attrib,matInfo,attrib_offset) read_material_vec2(matInfo,attrib_offset)\n#define DECLARE_MATERIAL_TABLE_INFO MaterialInfo materialInfo=read_material_info(uint(gl_VertexID));\n#define DECLARE_MATERIAL_TABLE_INFO_DEBUG(dbgColor) MaterialInfo materialInfo=read_material_info(uint(gl_VertexID)); dbgColor=materialInfo.colorDebug;\n#endif","_prelude_fog.fragment.glsl":rD,"_prelude_shadow.fragment.glsl":rF,"_prelude_lighting.glsl":rR,"_prelude_raster_array.glsl":rz},rj={},rG="precision highp float;",rH="precision mediump float;",r$="\n#if defined(GL_EXT_blend_func_extended) && defined(DUAL_SOURCE_BLENDING)\n#extension GL_EXT_blend_func_extended : require\n#endif",rq={preludeTerrain:rK("",rC),preludeFog:rK(rD,rP),preludeShadow:rK(rF,rL),preludeRasterArray:rK(rz,""),preludeLighting:rK(rR,rR),preludePrecisionQualifiers:rK(rH,rG),prelude:rK(rI,rA),preludeExtensions:rK(r$,"")},rZ=[r$,rH,rE,rq.prelude.fragmentSource].join("\n"),rW=[rG,rE,rq.prelude.vertexSource].join("\n");var rX={background:rK('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform vec4 u_color;uniform float u_opacity;uniform mediump float u_emissive_strength;\n#ifdef LIGHTING_3D_MODE\nin vec4 v_color;\n#endif\nvoid main() {vec4 out_color;
8\n#ifdef FEATURE_CUTOUT\nvec2 uv=gl_FragCoord.xy*u_inv_viewport_size.xy;\n#ifdef FLIP_Y\nuv.y=1.0-uv.y;\n#endif\nfloat 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);\n#else\n#ifdef LIGHTING_3D_MODE\nout_color=v_color;\n#else\nout_color=u_color;\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\n#endif\nglFragColor=out_color*u_opacity;\n#ifdef USE_MRT1\nout_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_lighting.glsl"\nin ivec2 a_pos;uniform mat4 u_matrix;uniform mediump float u_emissive_strength;\n#ifdef LIGHTING_3D_MODE\nuniform mediump vec4 u_color;out vec4 v_color;\n#endif\nvoid main() {gl_Position=u_matrix*vec4(a_pos,0,1);\n#ifndef FEATURE_CUTOUT\n#ifdef LIGHTING_3D_MODE\nv_color=apply_lighting_with_emission_ground(u_color,u_emissive_strength);\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(vec2(a_pos));\n#endif\n#endif\n}'),backgroundPattern:rK('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform 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);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nglFragColor=out_color*u_opacity;\n#ifdef USE_MRT1\nout_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\nuniform 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);\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}'),circle:rK('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nin vec3 v_data;in float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nuniform float u_emissive_strength;void main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 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 ? \nsmoothstep(0.0,-antialiased_blur,1.0-extrude_length) : \nsmoothstep(antialiased_blur,0.0,extrude_length-1.0)-antialiase_blur_opacity;float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(\nantialiased_blur,0.0,extrude_length-radius/(radius+stroke_width)\n);vec4 out_color=mix(color*opacity,stroke_color*stroke_opacity,color_t);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#endif\n#ifdef FOG\nout_color=fog_apply_premultiplied(out_color,v_fog_pos);\n#endif\nglFragColor=out_color*(v_visibility*opacity_t);\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\n}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\n#define NUM_VISIBILITY_RINGS 2\n#define INV_SQRT2 0.70710678\n#define ELEVATION_BIAS 0.0001\n#define NUM_SAMPLES_PER_RING 16\nuniform 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;\n#ifdef PROJECTION_GLOBE_VIEW\nin 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;\n#endif\n#ifdef ELEVATED_ROADS\nin float a_circle_z_offset;\n#endif\nout vec3 v_data;out float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvec2 calc_offset(vec2 extrusion,float radius,float stroke_width, float view_scale) {return extrusion*(radius+stroke_width)*u_extrude_scale*v
8iew_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) {\n#if defined(TERRAIN)\nreturn elevation(pos)+ELEVATION_BIAS;\n#else\nreturn 0.0;\n#endif\n}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);\n#ifdef PITCH_WITH_MAP\n#ifdef PROJECTION_GLOBE_VIEW\nreturn u_matrix*( world_center+vec4(sample_offset.x*surface_vectors[0]+sample_offset.y*surface_vectors[1],0) );\n#else\nreturn u_matrix*( world_center+vec4(sample_offset,0,0) );\n#endif\n#else\nreturn projected_center+vec4(sample_offset,0,0);\n#endif\n}float get_sample_step() {\n#ifdef PITCH_WITH_MAP\nreturn 2.0*PI/float(NUM_SAMPLES_PER_RING);\n#else\nreturn PI/float(NUM_SAMPLES_PER_RING);\n#endif\n}void main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 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;\n#ifdef PROJECTION_GLOBE_VIEW\nsurface_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);\n#else \nsurface_vectors=mat3(1.0);world_center=vec4(circle_center,height,1);\n#endif\n#ifdef ELEVATED_ROADS\nworld_center.z+=a_circle_z_offset+ELEVATION_BIAS;\n#endif\nvec4 projected_center=u_matrix*world_center;float view_scale=0.0;\n#ifdef PITCH_WITH_MAP\n#ifdef SCALE_WITH_MAP\nview_scale=1.0;\n#else\nview_scale=projected_center.w/u_camera_to_center_distance;\n#endif\n#else\n#ifdef SCALE_WITH_MAP\nview_scale=u_camera_to_center_distance;\n#else\nview_scale=projected_center.w;\n#endif\n#endif\ngl_Position=project_vertex(extrude,world_center,projected_center,radius,stroke_width,view_scale,surface_vectors);float visibility=0.0;\n#ifdef TERRAIN\nfloat step=get_sample_step();vec4 occlusion_world_center;vec4 occlusion_projected_center;\n#ifdef PITCH_WITH_MAP\nfloat 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;\n#else\nocclusion_world_center=world_center;occlusion_projected_center=projected_center;\n#endif\nfor(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);\n#else\nvisibility=1.0;\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nvisibility=1.0;\n#endif\nv_visibility=visibility;lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);\n#ifdef FOG\nv_fog_pos=fog_position(world_center.xyz);\n#endif\n}'),clippingMask:rK("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:rK('#include "_prelude_fog.fragment.glsl"\nuniform highp float u_intensity;in vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#define GAUSS_COEF 0.3989422804014327\nvoid main() {\n#pragma mapbox: initialize highp float weight\nfloat 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);\n#ifdef FOG\nif (u_is_globe==0) {glFragColor.r*=pow(1.0-fog_opacity(v_fog_pos),2.0);}\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);
8\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_terrain.vertex.glsl"\n#include "_prelude_fog.vertex.glsl"\nuniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;in ivec2 a_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nin 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;\n#endif\nout vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#pragma mapbox: define mediump float radius\nconst highp float ZERO=1.0/255.0/16.0;\n#define GAUSS_COEF 0.3989422804014327\nvoid main() {\n#pragma mapbox: initialize highp float weight\n#pragma mapbox: initialize mediump float radius\nvec2 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;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 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);\n#else\npos=vec3(tilePos+extrude,elevation(tilePos));\n#endif\ngl_Position=u_matrix*vec4(pos,1);\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}'),heatmapTexture:rK("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;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(0.0);\n#endif\nHANDLE_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:rK("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"\nin 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;\n#ifdef PROJECTION_GLOBE_VIEW\nuniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform float u_zoom_transition;\n#endif\nout 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);\n#ifdef PROJECTION_GLOBE_VIEW\n#ifndef PROJECTED_POS_ON_VIEWPORT\nvec3 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);\n#endif\n#endif\nvec4 projectedPoint=u_matrix*vec4(proj_pos,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(\n0.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:rK("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(\nmix(-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(\n0.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:rK("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"\nin ivec2 a_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nin ivec4 a_pos_3;\n#endif\nout 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;
8\n#ifdef PROJECTION_GLOBE_VIEW\ngl_Position=u_matrix*vec4(vec3(a_pos_3)+elevationVector(pos)*h,1);\n#else\ngl_Position=u_matrix*vec4(pos*u_overlay_scale,h,1);\n#endif\n}'),elevatedStructuresDepth:rK("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:rK("#ifdef DEPTH_RECONSTRUCTION\nin float v_height;\n#endif\nvoid main() {\n#ifdef DEPTH_RECONSTRUCTION\nif (v_height >=0.0)\ndiscard;\n#else\n#ifdef FEATURE_CUTOUT\napply_feature_cutout(vec4(0.0,0.0,0.0,1.0),gl_FragCoord,get_cutout_factors(gl_FragCoord).x);\n#endif\n#endif\nglFragColor=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;\n#ifdef DEPTH_RECONSTRUCTION\nout float v_height;\n#endif\nvoid main() {vec3 vpos=vec3(a_pos,a_height*u_height_scale);\n#ifdef DEPTH_RECONSTRUCTION\nif (u_camera_pos.z > vpos.z) {vpos-=(u_camera_pos-vpos)*(vpos.z/(u_camera_pos.z-vpos.z));}v_height=a_height;\n#endif\ngl_Position=u_matrix*vec4(vpos,1);gl_Position.z=u_reset_depth==1.0 ? gl_Position.w : gl_Position.z+u_depth_bias;}"),elevatedStructures:rK('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\nin vec3 v_normal;in float v_height;\n#ifdef RENDER_SHADOWS\nin highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in float v_depth;\n#endif\nvec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}
8vec3 compute_view_dependent_emissive_color(float ndotl,float emissive_strength,vec3 color)\n{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;\n#pragma mapbox: define highp vec4 structure_color\nvoid main() {\n#pragma mapbox: initialize highp vec4 structure_color\nvec3 color=structure_color.xyz;vec2 cutout_factors=vec2(0.0);\n#ifdef FEATURE_CUTOUT\ncutout_factors=get_cutout_factors(gl_FragCoord);\n#endif\n#ifdef LIGHTING_3D_MODE\nvec3 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);\n#ifdef RENDER_SHADOWS\nfloat 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);\n#else\ncolor=apply_lighting(color,transformed_normal);\n#endif\ncolor=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);}\n#endif\n#ifdef FOG\ncolor=fog_apply(color,v_fog_pos);\n#endif\nvec4 out_color=vec4(color,1.0);\n#ifdef INDICATOR_CUTOUT\nout_color=applyCutout(out_color,v_height);\n#endif\n#ifdef FEATURE_CUTOUT\nout_color=apply_feature_cutout(out_color,gl_FragCoord,cutout_factors.x);\n#endif\nglFragColor=out_color;HANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\nin 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;\n#ifdef RENDER_SHADOWS\nuniform 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;\n#endif\n#pragma mapbox: define highp vec4 structure_color\nvoid main() {\n#pragma mapbox: initialize highp vec4 structure_color\nv_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);\n#ifdef RENDER_SHADOWS\nvec3 shd_pos0=pos;vec3 shd_pos1=pos;\n#ifdef NORMAL_OFFSET\nvec3 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();\n#endif\nv_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;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(vec2(a_pos));\n#endif\n}'),fill:rK('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nuniform float u_emissive_strength;\n#ifdef RENDER_SHADOWS\nuniform 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;\n#endif\n#ifdef ELEVATED_ROADS\nin highp float v_road_z_offset;\n#endif\n#ifdef INDICATOR_CUTOUT\nin highp float v_z_offset;\n#endif\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\nvec2 cutout_factors=vec2(0.0);\n#ifdef FEATURE_CUTOUT\ncutout_factors=get_cutout_factors(gl_FragCoord);\n#endif\nvec4 out_color=color;\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#ifdef RENDER_SHADOWS\nfloat 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);\n#endif\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nout_color*=opacity;\n#ifdef INDICATOR_CUTOUT\nif (v_z_offset >=0.0) {out_color=applyCutout(out_color,v_z_offset);}\n#endif\n#ifdef FEATURE_CUTOUT\nout_color=apply_feature_cutout(out_color,gl_FragCoord,cutout_factors.x);\n#endif\nglFragColor=out_color;\n#ifdef USE_MRT1\nout_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);
8\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\nin ivec2 a_pos;\n#ifdef ELEVATED_ROADS\nin float a_road_z_offset;out highp float v_road_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform 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;\n#endif\n#ifdef INDICATOR_CUTOUT\nout highp float v_z_offset;\n#endif\nuniform mat4 u_matrix;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp float z_offset\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp float z_offset\n#ifdef ELEVATED_ROADS\nz_offset+=a_road_z_offset;v_road_z_offset=z_offset;\n#endif\nfloat hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);\n#ifdef RENDER_SHADOWS\nvec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset);\n#ifdef NORMAL_OFFSET\nvec3 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();\n#endif\nv_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;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(vec2(a_pos));\n#endif\n#ifdef INDICATOR_CUTOUT\nv_z_offset=z_offset;\n#endif\n}'),fillOutline:rK('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\nin highp vec2 v_pos;uniform float u_emissive_strength;\n#ifdef RENDER_SHADOWS\nuniform 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;\n#endif\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\nfloat 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);\n#ifdef FEATURE_CUTOUT\ncutout_factors=get_cutout_factors(gl_FragCoord);\n#endif\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#ifdef RENDER_SHADOWS\nfloat 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);\n#endif\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\n#ifdef FEATURE_CUTOUT\nout_color=apply_feature_cutout(out_color,gl_FragCoord,cutout_factors.x);\n#endif\nglFragColor=out_color*(alpha*opacity);\n#ifdef USE_MRT1\nout_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\nin ivec2 a_pos;\n#ifdef ELEVATED_ROADS\nin float a_road_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform 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;\n#endif\nuniform mat4 u_matrix;uniform vec2 u_world;out highp vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp float z_offset\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp float z_offset\n#ifdef ELEVATED_ROADS\nz_offset+=a_road_z_offset;\n#endif\nfloat hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);\n#ifdef FLIP_Y\nv_pos=(vec2(gl_Position.x,-gl_Position.y)/gl_Position.w+1.0)/2.0*u_world;\n#else\nv_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#endif\n#ifdef RENDER_SHADOWS\nvec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset);\n#ifdef NORMAL_OFFSET\nvec3 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();\n#endif\nv_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;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(vec2(a_pos));\n#endif\n}'),fillOutlinePattern:rK('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\nuniform vec2 u_texsize;uniform sampler2D u_image;\n#ifdef FILL_PATTERN_TRANSITION\nuniform float u_pattern_transition;\n#endif\nuniform float u_emissive_strength;\n#ifdef APPLY_LUT_ON_GPU\nuniform highp sampler3D u_lutTexture;\n#endif\n#ifdef RENDER_SHADOWS\nuniform 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;\n#endif\nin highp vec2 v_pos;in highp vec2 v_pos_world;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp uvec4 pattern\n#ifdef FILL_PATTERN_TRANSITION\n#pragma mapbox: define mediump uvec4 pattern_b\n#endif\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump uvec4 pattern\n#ifdef FILL_PATTERN_TRANSITION\n#pragma mapbox: initialize mediump uvec4 pattern_b\n#endif\nvec2 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);\n#ifdef APPLY_LUT_ON_GPU\nout_color=applyLUT(u_lutTexture,out_color);\n#endif\n#ifdef FILL_PATTERN_TRANSITION\nvec2 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;\n#endif\nvec2 cutout_factors=vec2(0.0);\n#ifdef FEATURE_CUTOUT\ncutout_factors=get_cutout_factors(gl_FragCoord);\n#endif\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#ifdef RENDER_SHADOWS\nfloat 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);\n#endif\n#endif\n#ifdef FEATURE_CUTOUT\nout_color=apply_feature_cutout(out_color,gl_FragCoord,cutout_factors.x);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nglFragColor=out_color*(alpha*opacity);\n#ifdef USE_MRT1\nout_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);
8\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\nuniform 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;\n#ifdef ELEVATED_ROADS\nin float a_road_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform 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;\n#endif\nout highp vec2 v_pos;out highp vec2 v_pos_world;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp uvec4 pattern\n#ifdef FILL_PATTERN_TRANSITION\n#pragma mapbox: define mediump uvec4 pattern_b\n#endif\n#pragma mapbox: define lowp float pixel_ratio\n#pragma mapbox: define highp float z_offset\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump uvec4 pattern\n#ifdef FILL_PATTERN_TRANSITION\n#pragma mapbox: initialize mediump uvec4 pattern_b\n#endif\n#pragma mapbox: initialize lowp float pixel_ratio\n#pragma mapbox: initialize highp float z_offset\nvec2 pattern_tl=vec2(pattern.xy);vec2 pattern_br=vec2(pattern.zw);\n#ifdef ELEVATED_ROADS\nz_offset+=a_road_z_offset;\n#endif\nfloat 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);\n#ifdef FLIP_Y\nv_pos_world=(vec2(gl_Position.x,-gl_Position.y)/gl_Position.w+1.0)/2.0*u_world;\n#else\nv_pos_world=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\n#endif\n#ifdef RENDER_SHADOWS\nvec3 shd_pos0=vec3(pos,z_offset);vec3 shd_pos1=vec3(pos,z_offset);\n#ifdef NORMAL_OFFSET\nvec3 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();\n#endif\nv_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;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}'),fillPattern:rK('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\nuniform vec2 u_texsize;uniform sampler2D u_image;\n#ifdef FILL_PATTERN_TRANSITION\nuniform float u_pattern_transition;\n#endif\nin highp vec2 v_pos;uniform float u_emissive_strength;\n#ifdef RENDER_SHADOWS\nuniform 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;\n#endif\n#ifdef ELEVATED_ROADS\nin highp float v_road_z_offset;\n#endif\n#ifdef APPLY_LUT_ON_GPU\nuniform highp sampler3D u_lutTexture;\n#endif\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp uvec4 pattern\n#ifdef FILL_PATTERN_TRANSITION\n#pragma mapbox: define mediump uvec4 pattern_b\n#endif\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump uvec4 pattern\n#ifdef FILL_PATTERN_TRANSITION\n#pragma mapbox: initialize mediump uvec4 pattern_b\n#endif\nvec2 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);\n#ifdef APPLY_LUT_ON_GPU\nout_color=applyLUT(u_lutTexture,out_color);\n#endif\n#ifdef FILL_PATTERN_TRANSITION\nvec2 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;\n#endif\nvec2 cutout_factors=vec2(0.0);\n#ifdef FEATURE_CUTOUT\ncutout_factors=get_cutout_factors(gl_FragCoord);\n#endif\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);\n#ifdef RENDER_SHADOWS\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);light=mix(light,1.0,cutout_factors.y);\n#ifdef ELEVATED_ROADS\nout_color.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light);\n#else\nout_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\n#endif\n#endif\n#endif\n#ifdef FEATURE_CUTOUT\nout_color=apply_feature_cutout(out_color,gl_FragCoord,cutout_factors.x);\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nglFragColor=out_color*opacity;\n#ifdef USE_MRT1\nout_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);
8\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\nuniform 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;\n#ifdef ELEVATED_ROADS\nin float a_road_z_offset;out highp float v_road_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform 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;\n#endif\nout highp vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp uvec4 pattern\n#ifdef FILL_PATTERN_TRANSITION\n#pragma mapbox: define mediump uvec4 pattern_b\n#endif\n#pragma mapbox: define lowp float pixel_ratio\n#pragma mapbox: define highp float z_offset\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump uvec4 pattern\n#pragma mapbox: initialize lowp float pixel_ratio\n#pragma mapbox: initialize highp float z_offset\n#ifdef FILL_PATTERN_TRANSITION\n#pragma mapbox: initialize mediump uvec4 pattern_b\n#endif\nvec2 pattern_tl=vec2(pattern.xy);vec2 pattern_br=vec2(pattern.zw);vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;\n#ifdef ELEVATED_ROADS\nz_offset+=a_road_z_offset;v_road_z_offset=z_offset;\n#endif\nfloat 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);\n#ifdef RENDER_SHADOWS\nvec3 shd_pos0=vec3(pos,z_offset);vec3 shd_pos1=vec3(pos,z_offset);\n#ifdef NORMAL_OFFSET\nvec3 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();\n#endif\nv_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;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}'),lineBlendComposite:rK("uniform highp sampler2D u_image;uniform float u_opacity;uniform int u_blend_mode;uniform highp float u_max_density;in vec2 v_pos;\n#define ADDITIVE 1\nvoid main() {vec4 color=texture(u_image,v_pos);if (u_blend_mode==ADDITIVE) {if (color.a <=0.0) {discard;}highp float density=color.a;vec3 avgColor=color.rgb/max(density,0.001);highp float n=density/max(u_max_density,0.001);highp float t=sqrt(n/(n+1.0));glFragColor=vec4(avgColor*t,t);} else {vec3 multiplyFactor=color.rgb*u_opacity+(1.0-u_opacity);glFragColor=vec4(multiplyFactor,1.0);}\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(0.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}","in ivec2 a_pos;out vec2 v_pos;void main() {gl_Position=vec4(a_pos,0,1);v_pos=vec2(a_pos)*0.5+0.5;}"),lineBlendReduce:rK("uniform highp sampler2D u_image;uniform vec2 u_texel_size;uniform bool u_first_pass;in vec2 v_pos;void main() {vec2 o=u_texel_size*0.5;vec4 s0=texture(u_image,v_pos+vec2(-o.x,-o.y));vec4 s1=texture(u_image,v_pos+vec2( o.x,-o.y));vec4 s2=texture(u_image,v_pos+vec2(-o.x, o.y));vec4 s3=texture(u_image,v_pos+vec2( o.x, o.y));float r0; float g0;float r1; float g1;float r2; float g2;float r3; float g3;if (u_first_pass) {float a0=s0.a;float a1=s1.a;float a2=s2.a;float a3=s3.a;r0=a0; g0=a0 > 0.0 ? 1.0 : 0.0;r1=a1; g1=a1 > 0.0 ? 1.0 : 0.0;r2=a2; g2=a2 > 0.0 ? 1.0 : 0.0;r3=a3; g3=a3 > 0.0 ? 1.0 : 0.0;} else {r0=s0.r; g0=s0.g;r1=s1.r; g1=s1.g;r2=s2.r; g2=s2.g;r3=s3.r; g3=s3.g;}glFragColor=vec4((r0+r1+r2+r3)*0.25,(g0+g1+g2+g3)*0.25,0.0,0.0);}","in ivec2 a_pos;out vec2 v_pos;void main() {gl_Position=vec4(a_pos,0,1);v_pos=vec2(a_pos)*0.5+0.5;}"),fillExtrusion:rK('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_lighting.glsl"\nin vec4 v_color;in vec4 v_flat;\n#ifdef RENDER_SHADOWS\nin highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;\n#endif\nuniform lowp float u_opacity;\n#ifdef RENDER_FRONT_CUTOFF\nin float v_front_cutoff_opacity;\n#endif\n#ifdef INDICATOR_CUTOUT\n#ifdef FEATURE_CUTOUT\nin vec4 v_ground_roof;\n#endif\n#endif\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;in vec2 v_ao;\n#endif\n#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)\nin vec4 v_roof_color;\n#endif\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)\nin highp vec3 v_normal;\n#endif\nuniform vec3 u_flood_light_color;uniform highp float u_vertical_scale;uniform float u_flood_light_intensity;uniform vec3 u_ground_shadow_factor;\n#if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT)\nin float v_flood_radiu
8s;in float v_has_floodlight;\n#endif\nin float v_height;\n#pragma mapbox: define highp float emissive_strength\nvoid main() {\n#pragma mapbox: initialize highp float emissive_strength\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)\nvec3 normal=normalize(v_normal);\n#endif\nfloat z;vec4 color=v_color;\n#ifdef ZERO_ROOF_RADIUS\nz=float(normal.z > 0.00001);\n#ifdef LIGHTING_3D_MODE\nnormal=mix(normal,vec3(0.0,0.0,1.0),z);\n#else\ncolor=mix(v_color,v_roof_color,z);\n#endif\n#endif\nfloat h=max(0.0,v_height);float ao_shade=1.0;\n#ifdef FAUX_AO\nfloat 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;\n#ifdef ZERO_ROOF_RADIUS\nconcave*=(1.0-z);\n#endif\nfloat 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);\n#ifdef LIGHTING_3D_MODE\n#ifdef FLOOD_LIGHT\ncolor.rgb*=mix(ao_shade,1.0,v_has_floodlight);\n#else\ncolor.rgb*=ao_shade;\n#endif\n#else\ncolor.rgb*=ao_shade;\n#endif\n#endif\n#ifdef LIGHTING_3D_MODE\nfloat flood_radiance=0.0;\n#ifdef FLOOD_LIGHT\nflood_radiance=(1.0-min(h/v_flood_radius,1.0))*u_flood_light_intensity*v_has_floodlight;\n#endif\n#ifdef RENDER_SHADOWS\n#ifdef FLOOD_LIGHT\nfloat 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);\n#else\nfloat shadowed_lighting_factor;\n#ifdef RENDER_CUTOFF\nshadowed_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;}\n#else\nshadowed_lighting_factor=shadowed_light_factor_normal(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);\n#endif\ncolor.rgb=apply_lighting(color.rgb,normal,shadowed_lighting_factor);\n#endif\n#else\ncolor.rgb=apply_lighting(color.rgb,normal);\n#ifdef FLOOD_LIGHT\ncolor.rgb=mix(color.rgb,u_flood_light_color*u_opacity,flood_radiance);\n#endif\n#endif\ncolor.rgb=mix(color.rgb,v_flat.rgb,emissive_strength);color*=u_opacity;\n#endif\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos,h));\n#endif\n#ifdef INDICATOR_CUTOUT\n#ifdef FEATURE_CUTOUT\n{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;}}}\n#else\ncolor=applyCutout(color,h);\n#endif\n#endif\n#ifdef RENDER_FRONT_CUTOFF\nif (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;}}\n#endif\n#ifdef FEATURE_CUTOUT\ncolor=apply_feature_cutout(color,gl_FragCoord,get_cutout_factors(gl_FragCoord).x);\n#endif\nglFragColor=color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_material_table.vertex.glsl"\nuniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;
vendor: 9,210 bytes, line 8
8uniform 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;\n#if defined(HAS_CENTROID) || defined(TERRAIN)\nin uvec2 a_centroid_pos;\n#endif\n#ifdef RENDER_WALL_MODE\nin ivec4 a_join_normal_inside;\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nin 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;\n#endif\n#ifdef TERRAIN\nuniform int u_height_type;uniform int u_base_type;\n#endif\nuniform highp float u_vertical_scale;\n#ifdef RENDER_FRONT_CUTOFF\nuniform vec3 u_front_cutoff_params;out float v_front_cutoff_opacity;\n#endif\nout vec4 v_color;out vec4 v_flat;\n#ifdef RENDER_SHADOWS\nuniform 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;\n#endif\n#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)\nout vec4 v_roof_color;\n#endif\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)\nout highp vec3 v_normal;\n#endif\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;out vec2 v_ao;\n#endif\n#if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT)\nout float v_flood_radius;out float v_has_floodlight;\n#endif\nout float v_height;\n#ifdef INDICATOR_CUTOUT\n#ifdef FEATURE_CUTOUT\nout vec4 v_ground_roof;\n#endif\n#endif\nvec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define highp float flood_light_wall_radius\n#pragma mapbox: define highp float line_width\n#pragma mapbox: define highp float emissive_strength\nvoid main() {DECLARE_MATERIAL_TABLE_INFO\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize highp float flood_light_wall_radius\n#pragma mapbox: initialize highp float line_width\n#pragma mapbox: initialize highp float emissive_strength\nbase*=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));\n#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)\nv_normal=normal;\n#endif\nbase=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);\n#if defined(HAS_CENTROID) || defined(TERRAIN)\ncentroid_pos=vec2(a_centroid_pos);\n#endif\nfloat ele=0.0;float h=0.0;float c_ele=0.0;vec3 pos;\n#ifdef TERRAIN\nbool is_flat_height=centroid_pos.x !=0.0 && u_height_type==1;bool is_flat_base=centroid_pos.x !=0.0 && u_base_type==1;ele=elevation(pos_nx.xy);bool is_elevation_encoded=centroid_pos.y==0.0 || (centroid_pos.y > 0.0 && (int(centroid_pos.y) & 7)==7);c_ele=is_flat_height || is_flat_base ? (is_elevation_encoded ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos)) : ele;float h_height=is_flat_height ? max(c_ele+height,ele+base+2.0) : ele+height;float h_base=is_flat_base ? max(c_ele+base,ele+base) : ele+(base==0.0 ?-5.0 : base);h=t > 0.0 ? max(h_base,h_height) : h_base;\n#else\nh=t > 0.0 ? height : base;\n#endif\npos=vec3(pos_nx.xy,h);\n#ifdef PROJECTION_GLOBE_VIEW\nfloat 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);\n#endif\nfloat cutoff=1.0;vec3 scaled_pos=pos;\n#if defined(RENDER_CUTOFF) || defined(RENDER_FRONT_CUTOFF)\nvec2 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);}}\n#endif\n#if defined(RENDER_CUTOFF) || defined(RENDER_FRONT_CUTOFF)\nvec4 ground=u_matrix*vec4(centroid_decoded,ele,1.0);\n#endif\n#ifdef RENDER_CUTOFF\n#ifdef CLIP_ZERO_TO_ONE\ncutoff=cutoff_opacity(u_cutoff_params,ground.z*2.0-ground.w);\n#else\ncutoff=cutoff_opacity(u_cutoff_params,ground.z);\n#endif\nif (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);\n#endif\nfloat hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (cutoff==0.0 && centroid_pos.x !=0.0) || (color.a==0.0));\n#ifdef RENDER_FRONT_CUTOFF\nv_front_cutoff_opacity=1.0;if (centroid_pos.x > 0.0 && centroid_pos.y > 0.0) {hidden=max(hidden,float(ground.w <=0.0));float ndc_y=ground.y/max(ground.w,0.001);float threshold=u_front_cutoff_params.x*2.0-1.0;float range_ndc=u_front_cutoff_params.y*2.0;if (!isBorderCentroid) {hidden=max(hidden,float(ndc_y < threshold-range_ndc));}float t=clamp((ndc_y-(threshold-range_ndc))/max(range_ndc,0.001),0.0,1.0);v_front_cutoff_opacity=mix(u_front_cutoff_params.z,1.0,t);}\n#endif\n#ifdef RENDER_WALL_MODE\nvec3 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;\n#endif\ngl_Position=mix(u_matrix*vec4(scaled_pos,1),AWAY,hidden);h=h-ele;v_height=h;\n#ifdef RENDER_SHADOWS\nvec3 shd_pos0=pos;vec3 shd_pos1=pos;\n#ifdef NORMAL_OFFSET\nvec3 offset=shadow_normal_offset(normal);shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();\n#endif\nv_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);\n#endif\nfloat NdotL=0.0;float colorvalue=0.0;\n#ifndef LIGHTING_3D_MODE\ncolorvalue=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*=(\n(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));}\n#endif\n#ifdef FAUX_AO\nfloat 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;\n#ifdef TERRAIN\ntop_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);\n#endif\nv_ao=vec2(mix(concave,-concave,start),y_ground);NdotL*=(1.0+0.05*(1.0-top_up_ny_start.y)*u_ao[0]);\n#ifdef PROJECTION_GLOBE_VIEW\ntop_height+=u_height_lift;\n#endif\ngl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w;\n#endif\n#ifdef LIGHTING_3D_MODE\n#ifdef FLOOD_LIGHT\nfloat 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;\n#endif\nv_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);\n#else\nv_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;\n#endif\n#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)\nfloat 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;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n#ifdef INDICATOR_CUTOUT\n#ifdef FEATURE_CUTOUT\nvec4 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);\n#endif\n#endif\n}'),fillExtrusion
8Depth:rK("void main() {}",'#include "_prelude_terrain.vertex.glsl"\n#include "_prelude_material_table.vertex.glsl"\nuniform mat4 u_matrix;uniform float u_edge_radius;uniform float u_width_scale;uniform float u_vertical_scale;\n#ifdef TERRAIN\nuniform int u_height_type;uniform int u_base_type;\n#endif\nin ivec4 a_pos_normal_ed;\n#if defined(HAS_CENTROID) || defined(TERRAIN)\nin uvec2 a_centroid_pos;\n#endif\n#ifdef RENDER_WALL_MODE\nin ivec4 a_join_normal_inside;\n#endif\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp float line_width\n#pragma mapbox: define highp vec4 color\nvoid main() {DECLARE_MATERIAL_TABLE_INFO\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp float line_width\n#pragma mapbox: initialize highp vec4 color\nbase*=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);\n#if defined(HAS_CENTROID) || defined(TERRAIN)\ncentroid_pos=vec2(a_centroid_pos);\n#endif\nvec3 pos;\n#ifdef TERRAIN\nbool 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);\n#else\npos=vec3(pos_nx.xy,t > 0.0 ? height : base);\n#endif\n#ifdef RENDER_WALL_MODE\nvec3 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;\n#endif\nfloat 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:rK('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform vec2 u_texsize;uniform sampler2D u_image;\n#ifdef FILL_EXTRUSION_PATTERN_TRANSITION\nuniform float u_pattern_transition;\n#endif\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;in vec3 v_ao;\n#endif\n#ifdef LIGHTING_3D_MODE\nin vec3 v_normal;\n#endif\n#ifdef APPLY_LUT_ON_GPU\nuniform highp sampler3D u_lutTexture;\n#endif\nin highp vec2 v_pos;in vec4 v_lighting;uniform lowp float u_opacity;\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define mediump uvec4 pattern\n#ifdef FILL_EXTRUSION_PATTERN_TRANSITION\n#pragma mapbox: define mediump uvec4 pattern_b\n#endif\n#pragma mapbox: define highp float pixel_ratio\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize mediump uvec4 pattern\n#ifdef FILL_EXTRUSION_PATTERN_TRANSITION\n#pragma mapbox: initialize mediump uvec4 pattern_b\n#endif\n#pragma mapbox: initialize highp float pixel_ratio\nvec2 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);\n#ifdef APPLY_LUT_ON_GPU\nout_color=applyLUT(u_lutTexture,out_color);\n#endif\n#ifdef FILL_EXTRUSION_PATTERN_TRANSITION\nvec2 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;\n#endif\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting(out_color,normalize(v_normal))*u_opacity;\n#else\nout_color=out_color*v_lighting;\n#endif\n#ifdef FAUX_AO\nfloat 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
8),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;\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\n#ifdef INDICATOR_CUTOUT\nout_color=applyCutout(out_color,height);\n#endif\nglFragColor=out_color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_material_table.vertex.glsl"\nuniform 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;\n#if defined(HAS_CENTROID) || defined(TERRAIN)\nin uvec2 a_centroid_pos;\n#endif\n#ifdef RENDER_WALL_MODE\nin ivec4 a_join_normal_inside;\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nin 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;\n#endif\n#ifdef TERRAIN\nuniform int u_height_type;uniform int u_base_type;\n#endif\nout highp vec2 v_pos;out vec4 v_lighting;\n#ifdef FAUX_AO\nuniform lowp vec2 u_ao;out vec3 v_ao;\n#endif\n#ifdef LIGHTING_3D_MODE\nout vec3 v_normal;\n#endif\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump uvec4 pattern\n#ifdef FILL_EXTRUSION_PATTERN_TRANSITION\n#pragma mapbox: define mediump uvec4 pattern_b\n#endif\n#pragma mapbox: define highp float pixel_ratio\n#pragma mapbox: define highp float line_width\nvoid main() {DECLARE_MATERIAL_TABLE_INFO\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump uvec4 pattern\n#ifdef FILL_EXTRUSION_PATTERN_TRANSITION\n#pragma mapbox: initialize mediump uvec4 pattern_b\n#endif\n#pragma mapbox: initialize highp float pixel_ratio\n#pragma mapbox: initialize highp float line_width\nvec2 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);\n#if defined(HAS_CENTROID) || defined(TERRAIN)\ncentroid_pos=vec2(a_centroid_pos);\n#endif\nfloat ele=0.0;float h=z;vec3 p;float c_ele;\n#ifdef TERRAIN\nbool 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);\n#else\np=vec3(pos_nx.xy,z);\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nfloat 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);\n#endif\n#ifdef RENDER_WALL_MODE\nvec3 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;\n#endif\nfloat 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\n? pos_nx.xy\n: 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;\n#ifdef LIGHTING_3D_MODE\nNdotL=calculate_NdotL(normal);\n#else\nNdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),NdotL);\n#endif\nif (normal.y !=0.0) {float r=0.84;\n#ifndef LIGHTING_3D_MODE\nr=mix(0.7,0.98,1.0-u_lightintensity);
8\n#endif\nNdotL*=(\n(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));}\n#ifdef FAUX_AO\nfloat 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;\n#ifdef TERRAIN\ntop_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);\n#endif\nv_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]);\n#ifdef PROJECTION_GLOBE_VIEW\ntop_height+=u_height_lift;\n#endif\ngl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w;\n#endif\n#ifdef LIGHTING_3D_MODE\nv_normal=normal;\n#else\nv_lighting.rgb+=clamp(NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(p);\n#endif\n}'),groundShadow:rK('#include "_prelude_shadow.fragment.glsl"\nprecision highp float;uniform vec3 u_ground_shadow_factor;in vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1;\n#ifdef FOG\nin float v_fog_opacity;\n#endif\nvoid 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);\n#ifdef RENDER_CUTOFF\nshadow=mix(vec3(1.0),shadow,cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w));\n#endif\n#ifdef FOG\nshadow=mix(shadow,vec3(1.0),v_fog_opacity);\n#endif\n#ifdef INDICATOR_CUTOUT\nshadow=mix(shadow,vec3(1.0),1.0-applyCutout(vec4(1.0),0.0).r);\n#endif\n#ifdef FEATURE_CUTOUT\nshadow=mix(shadow,vec3(1.0),get_cutout_factors(gl_FragCoord).y);\n#endif\nglFragColor=vec4(shadow,1.0);}','#include "_prelude_fog.vertex.glsl"\nuniform 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;\n#ifdef FOG\nout float v_fog_opacity;\n#endif\nvoid 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);\n#ifdef FOG\nv_fog_pos=fog_position(vec2(a_pos));v_fog_opacity=fog(v_fog_pos);\n#endif\n}'),fillExtrusionGroundEffect:rK("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;\n#ifdef SDF_SUBPASS\nin 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);}\n#ifdef FOG\nin highp float v_fog;\n#endif\n#endif\nvoid main() {\n#ifdef CLEAR_SUBPASS\nvec4 color=vec4(1.0);\n#ifdef CLEAR_FROM_TEXTURE\ncolor=texture(u_fb,gl_FragCoord.xy/vec2(u_fb_size));\n#endif\nglFragColor=color;\n#else\n#ifdef SDF_SUBPASS\nhighp 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;\n#ifdef FOG\nfog=v_fog;\n#endif\n#ifdef RENDER_CUTOFF\nfog*=v_cutoff_opacity;\n#endif\nglFragColor=vec4(vec3(0.0),mix(1.0,d,effect_intensity*u_opacity*fog));\n#else\n#ifdef USE_MRT1\nout_Target1=vec4(1.0-texture(u_fb,gl_FragCoord.xy/vec2(u_fb_size)).a,0.0,0.0,0.0);\n#else\nvec4 color=mix(vec4(u_flood_light_color,1.0),vec4(vec3(0.0),1.0),u_ao_pass);\n#ifdef OVERDRAW_INSPECTOR\ncolor=vec4(1.0);\n#endif\nglFragColor=color;\n#endif\n#endif\nHANDLE_WIREFRAME_DEBUG;\n#endif\n}",'#include "_prelude_fog.vertex.glsl"\nin highp ivec4 a_pos_end;in highp int a_angular_offset_factor;in highp uint a_hidden_by_landmark;\n#ifdef SDF_SUBPASS\nout highp vec2 v_pos;out highp vec4 v_line_segment;out highp float v_flood_light_radius_tile;out highp vec2 v_ao;\n#ifdef FOG\nout highp float v_fog;\n#endif\n#endif\nuniform 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;
8\n#pragma mapbox: define highp float flood_light_ground_radius\nconst float TANGENT_CUTOFF=4.0;const float NORM=32767.0;void main() {\n#pragma mapbox: initialize highp float flood_light_ground_radius\nvec4 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;\n#ifdef SDF_SUBPASS\nv_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);\n#ifdef FOG\nv_fog_pos=fog_position(pos);v_fog=1.0-fog(v_fog_pos);\n#endif\n#endif\nfloat hidden_by_landmark=0.0;\n#ifdef HAS_CENTROID\nhidden_by_landmark=float(a_hidden_by_landmark);\n#endif\nfloat 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));\n#ifdef RENDER_CUTOFF\nv_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z);\n#endif\n}'),hillshadePrepare:rK("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(\n(c+e+e+h)-(a+d+d+f),(f+g+g+h)-(a+b+b+c)\n)/pow(2.0,exaggeration+(19.2562-u_zoom));glFragColor=clamp(vec4(\nderiv.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:rK('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform 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;\n#ifdef LIGHTING_3D_MODE\nglFragColor=apply_lighting_with_emission_ground(glFragColor,u_emissive_strength);\n#endif\n#ifdef FOG\nglFragColor=fog_dither(fog_apply_premultiplied(glFragColor,v_fog_pos));\n#endif\n#ifdef USE_MRT1\nout_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);
8\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\nuniform 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;\n#ifdef FOG\nv_fog_pos=fog_position(vec2(a_pos));\n#endif\n}'),line:rK('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\nuniform lowp float u_device_pixel_ratio;uniform highp float u_width_scale;uniform highp float u_floor_width_scale;uniform float u_alpha_discard_threshold;uniform highp vec2 u_trim_offset;uniform highp vec2 u_trim_fade_range;uniform highp vec2 u_trim_gradient_mix_range;uniform lowp vec4 u_trim_color;uniform bool u_emissive_in_shadows;uniform bool u_clip_to_tile_borders;in vec4 v_width2_dilute;in vec2 v_normal;in float v_gamma_scale;in highp vec3 v_uv;in vec2 v_tile_pos;\n#ifdef ELEVATED_ROADS\nin highp float v_road_z_offset;\n#endif\n#ifdef VARIABLE_LINE_WIDTH\nin float stub_side;\n#endif\n#ifdef RENDER_LINE_DASH\nuniform sampler2D u_dash_image;in vec2 v_tex;\n#endif\n#ifdef DEBUG_ELEVATION_ID\nin vec3 v_elevation_id_col;\n#endif\n#ifdef RENDER_LINE_GRADIENT\nuniform sampler2D u_gradient_image;\n#endif\n#ifdef INDICATOR_CUTOUT\nin highp float v_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform 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;\n#endif\nfloat luminance(vec3 c) {return (c.r+c.r+c.b+c.g+c.g+c.g)*0.1667;}\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define mediump uvec4 dash\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float side_z_offset\n#pragma mapbox: define lowp float border_width\n#pragma mapbox: define lowp vec4 border_color\n#pragma mapbox: define lowp float emissive_strength\nfloat linearstep(float edge0,float edge1,float x) {return clamp((x-edge0)/(edge1-edge0),0.0,1.0);}void main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump uvec4 dash\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float side_z_offset\n#pragma mapbox: initialize lowp float border_width\n#pragma mapbox: initialize lowp vec4 border_color\n#pragma mapbox: initialize lowp float emissive_strength\nfloat dist=length(v_normal)*v_width2_dilute.x;\n#ifdef VARIABLE_LINE_WIDTH\nblur=mix(blur,0.0,stub_side);\n#endif\nfloat 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);\n#ifdef VARIABLE_LINE_WIDTH\nalpha=mix(alpha,1.0,stub_side);\n#endif\nalpha=side_z_offset > 0.0 ? 1.0-alpha : alpha;\n#ifdef RENDER_LINE_DASH\nfloat sdfdist=texture(u_dash_image,v_tex).r;
8float sdfgamma=1.0/(2.0*u_device_pixel_ratio)/(float(dash.z)+float(dash.w)/65535.0);float scaled_floorwidth=(floorwidth*u_floor_width_scale);alpha*=linearstep(0.5-sdfgamma/scaled_floorwidth,0.5+sdfgamma/scaled_floorwidth,sdfdist);\n#endif\nhighp vec4 out_color;\n#ifdef RENDER_LINE_GRADIENT\nout_color=texture(u_gradient_image,v_uv.xy);\n#else\nout_color=color;\n#endif\nfloat trim_alpha=1.0;\n#ifdef RENDER_LINE_TRIM_OFFSET\nhighp 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;\n#ifdef RENDER_LINE_GRADIENT\ngradient_trim_color_mix_factor=smoothstep(u_trim_gradient_mix_range.x,u_trim_gradient_mix_range.y,line_progress);\n#endif\nhighp 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;}\n#endif\nif (u_alpha_discard_threshold !=0.0) {if (alpha < u_alpha_discard_threshold) {discard;}}\n#ifdef RENDER_LINE_BORDER\n#ifndef VARIABLE_LINE_WIDTH\nfloat 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;}\n#endif\n#endif\nvec2 cutout_factors=vec2(0.0);\n#ifdef FEATURE_CUTOUT\ncutout_factors=get_cutout_factors(gl_FragCoord);\n#endif\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,emissive_strength);\n#ifdef RENDER_SHADOWS\nfloat 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;\n#ifdef ELEVATED_ROADS\nout_color.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light);\n#else\nout_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\n#endif\n#endif\n#endif\n#ifdef FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nout_color*=(alpha*diluted_opacity);\n#ifdef INDICATOR_CUTOUT\nout_color=applyCutout(out_color,v_z_offset);\n#endif\n#ifdef FEATURE_CUTOUT\nout_color=apply_feature_cutout(out_color,gl_FragCoord,cutout_factors.x);\n#endif\n#ifdef LINE_BLEND_ADDITIVE\n{float cov=alpha*diluted_opacity;glFragColor=vec4(cov > 0.0 ? out_color.rgb/cov : vec3(0.0),cov);}\n#else\n#ifdef LINE_BLEND_MULTIPLY\nglFragColor=vec4(out_color.rgb+(1.0-out_color.a),1.0);\n#else\nglFragColor=out_color;\n#endif\n#endif\n#ifdef DUAL_SOURCE_BLENDING\nglFragColorSrc1=vec4(vec3(0.0),emissive_strength);\n#else\n#ifdef USE_MRT1\nout_Target1=vec4(emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);\n#endif\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\n#ifdef DEBUG_ELEVATION_ID\nglFragColor=vec4(v_elevation_id_col,1.0);\n#endif\nif (u_clip_to_tile_borders) {if (v_tile_pos.x > 1.0 || v_tile_pos.y > 1.0 || v_tile_pos.x < 0.0 || v_tile_pos.y < 0.0) {discard;}}HANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\n#define EXTRUDE_SCALE 0.015873016\nin ivec2 a_pos_normal;in uvec4 a_data;\n#if defined(ELEVATED) || defined(ELEVATED_ROADS) || defined(VARIABLE_LINE_WIDTH)\nin vec3 a_z_offset_width;\n#endif\n#ifdef DEBUG_ELEVATION_ID\nin vec3 a_elevation_id_col;\n#endif\n#ifdef DEBUG_ELEVATION_ID\nout vec3 v_elevation_id_col;\n#endif\n#ifdef ELEVATION_GROUND_SCALE\nin float a_elevation_ground_scale;\n#endif\n#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET) || defined(RENDER_LINE_CURVE)\nin highp vec3 a_packed;\n#endif\n#ifdef RENDER_LINE_DASH\nin float a_linesofar;\n#endif\nuniform mat4 u_matrix;uniform mat2 u_pixels_to_tile_units;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;uniform float u_width_scale;uniform float u_z_offset;uniform highp float u_floor_width_scale;\n#ifdef RENDER_LINE_CURVE\nuniform mat3 u_curve_points_x;uniform mat3 u_curve_points_y;uniform mat3 u_curve_points_z;uniform float u_curve_point_count;\n#endif\n#ifdef ELEVATED\nuniform lowp float u_zbias_factor;uniform lowp float u_tile_to_meter;
8float sample_elevation(vec2 apos) {\n#ifdef ELEVATION_REFERENCE_SEA\nreturn 0.0;\n#else\nreturn elevation(apos);\n#endif\n}\n#endif\nout vec2 v_normal;out vec4 v_width2_dilute;out float v_gamma_scale;out highp vec3 v_uv;out vec2 v_tile_pos;\n#ifdef ELEVATED_ROADS\nout highp float v_road_z_offset;\n#endif\n#ifdef VARIABLE_LINE_WIDTH\nout float stub_side;\n#endif\n#ifdef RENDER_LINE_DASH\nuniform vec2 u_texsize;uniform float u_tile_units_to_pixels;out vec2 v_tex;\n#endif\n#ifdef RENDER_LINE_GRADIENT\nuniform float u_image_height;\n#endif\n#ifdef INDICATOR_CUTOUT\nout highp float v_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform 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;\n#endif\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define mediump uvec4 dash\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n#pragma mapbox: define mediump float side_z_offset\n#pragma mapbox: define lowp float border_width\n#pragma mapbox: define lowp vec4 border_color\n#pragma mapbox: define lowp float emissive_strength\n#ifdef RENDER_LINE_CURVE\nvec3 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=t*t;float t3=t2*t;return 0.5*(\n2.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\n);}vec2 catmullRomTangent(vec2 p0,vec2 p1,vec2 p2,vec2 p3,float t) {float t2=t*t;return 0.5*(\n(-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\n);}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;}\n#endif\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump uvec4 dash\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize mediump float side_z_offset\n#pragma mapbox: initialize lowp float border_width\n#pragma mapbox: initialize lowp vec4 border_color\n#pragma mapbox: initialize lowp float emissive_strength\nfloat a_z_offset=u_z_offset;\n#if defined(ELEVATED) || defined(ELEVATED_ROADS)\na_z_offset+=a_z_offset_width.x;\n#endif\n#ifdef DEBUG_ELEVATION_ID\nv_elevation_id_col=a_elevation_id_col;\n#endif\nhighp float line_progress=0.0;\n#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET) || defined(RENDER_LINE_CURVE)\nline_progress=a_packed[2];\n#endif\nfloat 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;\n#ifdef RENDER_LINE_CURVE\nCurveResult 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;\n#endif\ngapwidth=gapwidth/2.0;float halfwidth;float dilute_scale=1.0;float dilute_border_scale=1.0;\n#ifdef VARIABLE_LINE_WIDTH\nfloat 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 >
8 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;\n#else\nhalfwidth=(u_width_scale*width)/2.0;\n#endif\nfloat 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;vec4 projected_extrude=u_matrix*vec4(extrude,0.0,0.0);vec2 projected_extrude_xy=projected_extrude.xy;\n#ifdef ELEVATED_ROADS\nv_road_z_offset=a_z_offset;v_tile_pos=pos+offset2*u_pixels_to_tile_units;gl_Position=u_matrix*vec4(v_tile_pos,a_z_offset,1.0);\n#else\n#ifdef ELEVATED\nvec2 offsetTile=offset2*u_pixels_to_tile_units;vec2 offset_pos=pos+offsetTile;float ele=0.0;float scaled_z_offset=a_z_offset;\n#ifdef ELEVATION_GROUND_SCALE\nscaled_z_offset=a_z_offset*mix(1.0,u_exaggeration,a_elevation_ground_scale);\n#endif\n#ifdef CROSS_SLOPE_VERTICAL\nfloat 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);\n#else\n#ifdef CROSS_SLOPE_HORIZONTAL\nfloat 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;\n#else\nfloat 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;\n#endif\n#endif\nv_tile_pos=offset_pos;gl_Position=u_matrix*vec4(v_tile_pos,ele,1.0)+projected_extrude;float z=clamp(gl_Position.z/gl_Position.w,0.5,1.0);float zbias=max(0.00005,(pow(z,0.8)-z)*u_zbias_factor*u_exaggeration);gl_Position.z-=(gl_Position.w*zbias);gl_Position=mix(gl_Position,AWAY,hidden);\n#else\nv_tile_pos=pos+offset2*u_pixels_to_tile_units;gl_Position=u_matrix*vec4(v_tile_pos,0.0,1.0);\n#endif\n#endif\n#ifndef ELEVATED\n#ifndef VARIABLE_LINE_WIDTH\n#ifndef RENDER_TO_TEXTURE\nfloat base_w=gl_Position.w;vec2 screen_width=abs(projected_extrude.xy/base_w*u_units_to_pixels);float max_extrude_component=max(screen_width.x,screen_width.y);if (width >=1.0 && base_w > 0.0 && max_extrude_component > 0.0001) {float min_pixel=1.05;if (max_extrude_component < min_pixel) {vec2 abs_pos=abs(gl_Position.xy);float is_out=max(abs_pos.x,abs_pos.y)/base_w;dilute_scale=mix(max_extrude_component/min_pixel,1.0,smoothstep(2.5,4.5,is_out));projected_extrude/=dilute_scale;}else if (gapwidth > 0.0) {float visible_ratio=(halfwidth+ANTIALIASING)/outset;vec2 visible_screen_width=screen_width*visible_ratio;float max_visible_component=max(visible_screen_width.x,visible_screen_width.y);dilute_scale=min(1.0,max_visible_component/min_pixel);}else\n{\n#ifdef RENDER_LINE_BORDER\nfloat 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);\n#endif\n}}\n#endif\n#endif\nv_tile_pos=(v_tile_pos+extrude)/EXTENT;\n#ifdef ELEVATED_ROADS\ngl_Position=gl_Position+projected_extrude;\n#else\ngl_Position=mix(gl_Position+projected_extrude,AWAY,hidden);\n#endif\n#endif\n#ifdef ELEVATED_ROADS\n#ifdef RENDER_SHADOWS\nvec3 shd_pos=vec3(pos+(offset2+dist)*u_pixels_to_tile_units,a_z_offset);vec3 shd_pos0=shd_pos;vec3 shd_pos1=shd_pos;\n#ifdef NORMAL_OFFSET\nvec3 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();\n#endif\nv_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;\n#endif\n#endif\n#ifndef RENDER_TO_TEXTURE\nfloat 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));\n#else\nv_gamma_scale=1.0;\n#endif\n#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)\nhighp float a_uv_x=a_packed[0];float a_split_index=a_packed[1];\n#ifdef RENDER_LINE_GRADIENT\nhighp 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);\n#else\nv_uv=vec3(a_uv_x,0.0,line_progress);\n#endif\n#endif\n#ifdef RENDER_LINE_DASH\nvec4 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);\n#endif\nv_width2_dilute=vec4(outset,inset,dilute_scale,dilute_border_scale);\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n#ifdef INDICATOR_CUTOUT\nv_z_offset=a_z_offset;\n#endif\n}'),linePattern:rK('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\nuniform highp float u_device_pixel_ratio;uniform highp float u_width_scale;
8uniform 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;\n#ifdef APPLY_LUT_ON_GPU\nuniform highp sampler3D u_lutTexture;\n#endif\n#ifdef LINE_PATTERN_TRANSITION\nuniform float u_pattern_transition;\n#endif\nin vec2 v_normal;in vec2 v_width2;in highp float v_linesofar;in float v_gamma_scale;in float v_width;\n#ifdef RENDER_LINE_TRIM_OFFSET\nin highp vec3 v_uv;\n#endif\n#ifdef ELEVATED_ROADS\nin highp float v_road_z_offset;\n#endif\n#ifdef LINE_JOIN_NONE\nin vec2 v_pattern_data;\n#endif\n#ifdef INDICATOR_CUTOUT\nin highp float v_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform 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;\n#endif\n#pragma mapbox: define mediump uvec4 pattern\n#ifdef LINE_PATTERN_TRANSITION\n#pragma mapbox: define mediump uvec4 pattern_b\n#endif\n#pragma mapbox: define mediump float pixel_ratio\n#pragma mapbox: define mediump float blur\n#pragma mapbox: define mediump float opacity\n#pragma mapbox: define lowp float emissive_strength\nvoid main() {\n#pragma mapbox: initialize mediump uvec4 pattern\n#ifdef LINE_PATTERN_TRANSITION\n#pragma mapbox: initialize mediump uvec4 pattern_b\n#endif\n#pragma mapbox: initialize mediump float pixel_ratio\n#pragma mapbox: initialize mediump float blur\n#pragma mapbox: initialize mediump float opacity\n#pragma mapbox: initialize lowp float emissive_strength\nvec2 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);\n#ifdef APPLY_LUT_ON_GPU\ncolor=applyLUT(u_lutTexture,color);\n#endif\n#ifdef LINE_PATTERN_TRANSITION\nvec2 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;\n#endif\n#ifdef RENDER_LINE_TRIM_OFFSET\nhighp 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);}\n#endif\n#ifdef LINE_JOIN_NONE\nhighp 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);}\n#endif\n#ifdef LIGHTING_3D_MODE\ncolor=apply_lighting_with_emission_ground(color,emissive_strength);\n#ifdef RENDER_SHADOWS\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);\n#ifdef ELEVATED_ROADS\ncolor.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light);\n#else\ncolor.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\n#endif\n#endif\n#endif\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#endif\ncolor*=(alpha*opacity);if (u_alpha_discard_threshold !=0.0) {if (color.a < u_alpha_discard_threshold) {discard;}}\n#ifdef INDICATOR_CUTOUT\ncolor=applyCutout(color,v_z_offset);\n#endif\nglFragColor=color;\n#ifdef DUAL_SOURCE_BLENDING\nglFragColorSrc1=vec4(vec3(0.0),emissive_strength);\n#else\n#ifdef USE_MRT1\nout_Target1=vec4(emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);\n#endif\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);
8\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\n#define scale 0.015873016\nin ivec2 a_pos_normal;in uvec4 a_data;\n#if defined(ELEVATED) || defined(ELEVATED_ROADS)\nin vec3 a_z_offset_width;\n#endif\n#ifdef ELEVATION_GROUND_SCALE\nin float a_elevation_ground_scale;\n#endif\n#ifdef RENDER_LINE_TRIM_OFFSET\nin highp vec3 a_packed;\n#endif\nin highp float a_linesofar;\n#ifdef LINE_JOIN_NONE\nin highp vec3 a_pattern_data;out vec2 v_pattern_data;\n#endif\n#ifdef INDICATOR_CUTOUT\nout highp float v_z_offset;\n#endif\nuniform 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;\n#ifdef ELEVATED\nuniform lowp float u_zbias_factor;uniform lowp float u_tile_to_meter;float sample_elevation(vec2 apos) {\n#ifdef ELEVATION_REFERENCE_SEA\nreturn 0.0;\n#else\nreturn elevation(apos);\n#endif\n}\n#endif\nout vec2 v_normal;out vec2 v_width2;out highp float v_linesofar;out float v_gamma_scale;out float v_width;\n#ifdef RENDER_LINE_TRIM_OFFSET\nout highp vec3 v_uv;\n#endif\n#ifdef ELEVATED_ROADS\nout highp float v_road_z_offset;\n#endif\n#ifdef RENDER_SHADOWS\nuniform 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;\n#endif\n#pragma mapbox: define mediump float blur\n#pragma mapbox: define mediump float opacity\n#pragma mapbox: define mediump float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n#pragma mapbox: define mediump float floorwidth\n#pragma mapbox: define mediump uvec4 pattern\n#ifdef LINE_PATTERN_TRANSITION\n#pragma mapbox: define mediump uvec4 pattern_b\n#endif\n#pragma mapbox: define mediump float pixel_ratio\n#pragma mapbox: define lowp float emissive_strength\nvoid main() {\n#pragma mapbox: initialize mediump float blur\n#pragma mapbox: initialize mediump float opacity\n#pragma mapbox: initialize mediump float offset\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize mediump float floorwidth\n#pragma mapbox: initialize mediump uvec4 pattern\n#ifdef LINE_PATTERN_TRANSITION\n#pragma mapbox: initialize mediump uvec4 pattern_b\n#endif\n#pragma mapbox: initialize mediump float pixel_ratio\n#pragma mapbox: initialize lowp float emissive_strength\nfloat a_z_offset;\n#if defined(ELEVATED) || defined(ELEVATED_ROADS)\na_z_offset=a_z_offset_width.x;\n#endif\nfloat 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;vec4 projected_extrude=u_matrix*vec4(extrude,0.0,0.0);vec2 projected_extrude_xy=projected_extrude.xy;\n#ifdef ELEVATED_ROADS\nv_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;\n#else\n#ifdef ELEVATED\nvec2 offsetTile=offset2*u_pixels_to_tile_units;vec2 offset_pos=pos+offsetTile;float ele=0.0;float scaled_z_offset=a_z_offset;\n#ifdef ELEVATION_GROUND_SCALE\nscaled_z_offset=a_z_offset*mix(1.0,u_exaggeration,a_elevation_ground_scale);\n#endif\n#ifdef CROSS_SLOPE_VERTICAL\nfloat 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);\n#else\n#ifdef CROSS_SLOPE_HORIZONTAL\nfloat 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;\n#else\nfloat 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;\n#endif\n#endif\ngl_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);\n#else\ngl_Position=mix(u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude,AWAY,hidden);\n#endif\n#endif\n#ifdef ELEVATED_ROADS\n#ifdef RENDER_SHADOWS\nvec3 shd_pos=vec3(pos+(offset2+dist)*u_pixels_to_tile_units,a_z_offset);vec3 shd_pos0=shd_pos;vec3 shd_pos1=shd_pos;\n#ifdef NORMAL_OFFSET\nvec3 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();\n#endif\nv_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;\n#endif\n#endif\n#ifndef RENDER_TO_TEXTURE\nfloat 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));\n#else\nv_gamma_scale=1.0;\n#endif\n#ifdef RENDER_LINE_TRIM_OFFSET\nhighp float a_uv_x=a_packed[0];highp float line_progress=a_packed[2];v_uv=vec3(a_uv_x,0.0,line_progress);\n#endif\nv_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=(floorwidth*u_floor_width_scale);\n#ifdef LINE_JOIN_NONE\nv_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);\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n#ifdef INDICATOR_CUTOUT\nv_z_offset=a_z_offset;\n#endif\n}'),raster:rK('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_raster_array.glsl"\nuniform 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;\n#ifdef PROJECTION_GLOBE_VIEW\nin float v_split_fade;\n#endif\nuniform 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;\n#ifndef RASTER_ARRAY\nuniform highp sampler2D u_image0;uniform sampler2D u_image1;\n#endif\n#ifdef RASTER_COLOR\nuniform sampler2D u_color_ramp;uniform highp vec4 u_colorization_mix;uniform highp float u_colorization_offset;uniform vec2 u_texture_res;\n#endif\nvoid main() {vec4 color0,color1,color;vec2 value;\n#ifdef RASTER_COLOR\n#ifdef RASTER_ARRAY\n#ifdef RASTER_ARRAY_LINEAR\nvalue=mix(\nraTexture2D_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\n);\n#else\nvalue=mix(\nraTexture2D_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\n);\n#endif\nif (value.y > 0.0) value.x/=value.y;
vendor: 5,542 bytes, line 8
8\n#else\ncolor=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);\n#endif\ncolor=texture(u_color_ramp,vec2(value.x,0.5));if (color.a > 0.0) color.rgb/=color.a;color.a*=value.y;\n#else\ncolor0=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);\n#endif\ncolor.a*=u_opacity;\n#ifdef GLOBE_POLES\ncolor.a*=1.0-smoothstep(0.0,0.05,u_zoom_transition);\n#endif\nvec3 rgb=color.rgb;rgb=vec3(\ndot(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);\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),u_emissive_strength).rgb;\n#endif\n#ifdef FOG\nhighp 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));\n#endif\nglFragColor=vec4(out_color*color.a,color.a);\n#ifdef PROJECTION_GLOBE_VIEW\nglFragColor*=mix(1.0,1.0-smoothstep(0.0,0.05,u_zoom_transition),smoothstep(0.8,0.9,v_split_fade));\n#endif\n#ifdef RENDER_CUTOFF\nglFragColor=glFragColor*cutoff_opacity(u_cutoff_params,v_depth);\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\n#ifdef USE_MRT1\nout_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\nuniform 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;\n#ifdef ELEVATED\nuniform lowp float u_zbias_factor;\n#endif\n#define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8\n#ifdef GLOBE_POLES\nin vec3 a_globe_pos;in vec2 a_uv;\n#else\nin ivec2 a_pos;in uvec2 a_texture_pos;\n#endif\nout vec2 v_pos0;out vec2 v_pos1;out float v_depth;\n#ifdef PROJECTION_GLOBE_VIEW\nout float v_split_fade;\n#endif\nvoid main() {vec2 uv;\n#ifdef GLOBE_POLES\nvec3 globe_pos=a_globe_pos;uv=a_uv;float ele=u_raster_elevation;\n#ifdef ELEVATION_REFERENCE_GROUND\nele+=elevation(uv*EXTENT);\n#endif\nglobe_pos+=normalize(globe_pos)*ele*GLOBE_UPSCALE;gl_Position=u_matrix*u_globe_matrix*vec4(globe_pos,1.0);\n#ifdef FOG\nv_fog_pos=fog_position((u_normalize_matrix*vec4(a_globe_pos,1.0)).xyz);\n#endif\n#else\nvec4 world_pos;\n#ifdef PROJECTION_GLOBE_VIEW\nvec2 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]); \nfloat tiles=u_grid_matrix[0][2];if (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;\n#ifdef ELEVATION_REFERENCE_GROUND\nele+=elevation(uv*EXTENT)-decomposed_pos_and_skirt.z;\n#endif\nvec4 merc_world_pos=vec4(0.0); \nv_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);\n#ifdef FOG\nv_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);\n#endif\n#else\nfloat ele=0.0;vec2 decodedPos=vec2(a_pos);\n#ifdef ELEVATION_REFERENCE_GROUND\nvec3 decomposedPosAndSkirt=decomposeToPosAndSkirt(a_pos);float skirt=decomposedPosAndSkirt.z;decodedPos=decomposedPosAndSkirt.xy;uv=decodedPos/8192.0;ele=elevation(decodedPos)-skirt;\n#else\nuv=vec2(a_texture_pos)/8192.0;\n#endif\nworld_pos=vec4(decodedPos,(u_raster_elevation+ele),1.0);\n#ifdef FOG\nv_fog_pos=fog_position(decodedPos);\n#endif\n#endif\nfloat w=1.0+dot(uv*EXTENT,u_perspective_transform);gl_Position=u_matrix*world_pos*w;\n#endif\nv_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;\n#ifdef ELEVATED\nfloat 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);\n#endif\n#ifdef RENDER_CUTOFF\nv_depth=gl_Position.z;\n#endif\n}'),symbol:
8rK('#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform 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;\n#ifdef ICON_TRANSITION\nuniform float u_icon_transition;\n#endif\n#ifdef COLOR_ADJUSTMENT\nuniform mat4 u_color_adj_mat;\n#endif\n#ifdef INDICATOR_CUTOUT\nin highp float v_z_offset;\n#else\n#ifdef RENDER_SHADOWS\nin highp float v_z_offset;\n#endif\n#endif\nin vec2 v_tex_a;\n#ifdef ICON_TRANSITION\nin vec2 v_tex_b;\n#endif\nin float v_draw_halo;in vec3 v_gamma_scale_size_fade_opacity;\n#ifdef RENDER_TEXT_AND_SYMBOL\nin float is_sdf;in vec2 v_tex_a_icon;\n#endif\n#ifdef RENDER_SHADOWS\nuniform 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;\n#endif\n#ifdef APPLY_LUT_ON_GPU\nuniform highp sampler3D u_lutTexture;\n#endif\n#ifdef USE_PAINT_PROPERTIES_UBO\nin lowp float v_opacity;\n#ifdef RENDER_SDF\nin lowp vec4 v_fill_np_color;in lowp vec4 v_halo_np_color;in lowp float v_halo_width;in lowp float v_halo_blur;\n#endif\n#ifdef LIGHTING_3D_MODE\nin lowp float v_emissive_strength;\n#endif\n#else\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\n#pragma mapbox: define lowp float emissive_strength\n#endif\nvoid main() {\n#ifdef USE_PAINT_PROPERTIES_UBO\nlowp float opacity=v_opacity;lowp vec4 fill_color=vec4(0.0);lowp vec4 halo_color=vec4(0.0);lowp float halo_width=0.0;lowp float halo_blur=0.0;\n#ifdef RENDER_SDF\nfill_color=vec4(v_fill_np_color.rgb*v_fill_np_color.a,v_fill_np_color.a);halo_color=vec4(v_halo_np_color.rgb*v_halo_np_color.a,v_halo_np_color.a);halo_width=v_halo_width;halo_blur=v_halo_blur;\n#endif\nlowp float emissive_strength=0.0;\n#ifdef LIGHTING_3D_MODE\nemissive_strength=v_emissive_strength;\n#endif\n#else\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\n#pragma mapbox: initialize lowp float emissive_strength\n#endif\nvec4 out_color;float fade_opacity=v_gamma_scale_size_fade_opacity[2];\n#ifdef RENDER_TEXT_AND_SYMBOL\nif (is_sdf==ICON) {vec2 tex_icon=v_tex_a_icon;lowp float alpha=opacity*fade_opacity;glFragColor=texture(u_texture_icon,tex_icon)*alpha;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nreturn;}\n#endif\nvec2 cutout_factors=vec2(0.0);\n#ifdef FEATURE_CUTOUT\ncutout_factors=get_cutout_factors(gl_FragCoord);\n#endif\n#ifdef RENDER_SDF\nfloat 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;\n#else\n#ifdef ICON_TRANSITION\nvec4 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);\n#else\nout_color=texture(u_texture,v_tex_a);\n#endif\n#ifdef APPLY_LUT_ON_GPU\nout_color=applyLUT(u_lutTexture,out_color);\n#endif\n#ifdef COLOR_ADJUSTMENT\nout_color=u_color_adj_mat*out_color;\n#endif\n#endif\nout_color*=opacity*fade_opacity;\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(out_color,emissive_strength);\n#ifdef RENDER_SHADOWS\nfloat light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);light=mix(light,1.0,cutout_factors.y);\n#ifdef TERRAIN\nout_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);\n#else\nout_color.rgb*=mix(v_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light);\n#endif\n#endif\n#endif\n#ifdef INDICATOR_CUTOUT\nout_color=applyCutout(out_color,v_z_offset);\n#endif\n#ifdef FEATURE_CUTOUT\nout_color=apply_feature_cutout(out_color,gl_FragCoord,cutout_factors.x);\n#endif\nglFragColor=out_color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);
8\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_terrain.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\n#define USING_APPEARANCE 1.0\nin ivec4 a_pos_offset;in uvec4 a_tex_size;in ivec4 a_pixeloffset;in vec4 a_projected_pos;in uint a_fade_opacity;\n#ifdef Z_OFFSET\nin float a_auto_z_offset;\n#endif\n#ifdef PROJECTION_GLOBE_VIEW\nin ivec4 a_globe_anchor;in vec3 a_globe_normal;\n#endif\n#ifdef ICON_TRANSITION\nin uvec2 a_texb;\n#endif\n#ifdef OCCLUSION_QUERIES\nin float a_occlusion_query_opacity;\n#endif\n#ifdef ELEVATED_ROADS\nin vec3 a_x_axis;in vec3 a_y_axis;uniform float u_normal_scale;\n#endif\n#ifdef INDICATOR_CUTOUT\nout highp float v_z_offset;\n#else\n#ifdef RENDER_SHADOWS\nout highp float v_z_offset;\n#endif\n#endif\nuniform 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;\n#ifdef PROJECTION_GLOBE_VIEW\nuniform 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;\n#endif\nout vec2 v_tex_a;\n#ifdef ICON_TRANSITION\nout vec2 v_tex_b;\n#endif\nout float v_draw_halo;out vec3 v_gamma_scale_size_fade_opacity;\n#ifdef RENDER_TEXT_AND_SYMBOL\nout float is_sdf;out vec2 v_tex_a_icon;\n#endif\n#ifdef RENDER_SHADOWS\nuniform 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;\n#endif\n#ifdef USE_PAINT_PROPERTIES_UBO\n#ifndef MAX_UBO_SIZE_VEC4\n#define MAX_UBO_SIZE_VEC4 1024u\n#endif\n#define SPP_HEADER_SIZE_VEC4 3u\n#define DWORDS_PER_VEC4 4u\nstruct SymbolPaintProperties {vec4 fill_np_color;vec4 halo_np_color;float opacity;float halo_width;float halo_blur;float emissive_strength;float occlusion_opacity;float z_offset;vec2 translate;};struct PropertyType {bool isDataDriven;bool isZoomDependent;uint offsetDwords;};struct SymbolPropertyHeader {uint dataDrivenBlockSizeVec4;PropertyType fill_np_color;PropertyType halo_np_color;PropertyType opacity;PropertyType halo_width;PropertyType halo_blur;PropertyType emissive_strength;PropertyType occlusion_opacity;PropertyType z_offset;PropertyType translate;};uniform float u_zoom;uniform lowp vec4 u_spp_fill_np_color;uniform lowp vec4 u_spp_halo_np_color;uniform lowp float u_spp_opacity;uniform lowp float u_spp_halo_width;uniform lowp float u_spp_halo_blur;uniform lowp float u_spp_emissive_strength;uniform lowp float u_spp_occlusion_opacity;uniform highp float u_spp_z_offset;uniform lowp vec2 u_spp_translate_rotation;in float a_feature_index;layout(std140) uniform SymbolPaintPropertiesHeaderUniform {uvec4 header[SPP_HEADER_SIZE_VEC4];} u_spp_header;layout(std140) uniform SymbolPaintPropertiesUniform {vec4 properties[MAX_UBO_SIZE_VEC4];} u_spp_properties;layout(std140) uniform SymbolPaintPropertiesIndexUniform {uvec4 block_indices[MAX_UBO_SIZE_VEC4];} u_spp_index;out lowp float v_opacity;\n#ifdef RENDER_SDF\nout lowp vec4 v_fill_np_color;out lowp vec4 v_halo_np_color;out lowp float v_halo_width;out lowp float v_halo_blur;\n#endif\n#ifdef LIGHTING_3D_MODE\nout lowp float v_emissive_strength;\n#endif\nPropertyType 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 :\n(index==1u) ? v.y :\n(index==2u) ? v.z : v.w;}float vec4At(vec4 v,uint index) {return (index==0u) ? v.x :\n(index==1u) ? v.y :\n(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;}\n#else\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\n#pragma mapbox: define lowp float emissive_strength\n#pragma mapbox: define lowp float occlusion_opacity\n#pragma mapbox: define highp float z_offset\n#endif\nvec2 unpack_opacity(uint packedOpacity) {return vec2(float(packedOpacity/2u)/127.0,float(packedOpacity & 1u));}
8void main() {\n#ifdef USE_PAINT_PROPERTIES_UBO\nSymbolPaintProperties paint_properties=readSymbolPaintProperties();lowp float opacity=paint_properties.opacity;v_opacity=opacity;\n#ifdef RENDER_SDF\nv_fill_np_color=paint_properties.fill_np_color;v_halo_np_color=paint_properties.halo_np_color;v_halo_width=paint_properties.halo_width;v_halo_blur=paint_properties.halo_blur;\n#endif\n#ifdef LIGHTING_3D_MODE\nv_emissive_strength=paint_properties.emissive_strength;\n#endif\nlowp float occlusion_opacity=paint_properties.occlusion_opacity;highp float z_offset=paint_properties.z_offset;\n#else\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\n#pragma mapbox: initialize lowp float emissive_strength\n#pragma mapbox: initialize lowp float occlusion_opacity\n#pragma mapbox: initialize highp float z_offset\n#endif\nvec2 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);\n#ifdef Z_OFFSET\ne+=a_auto_z_offset;\n#endif\nvec3 h=elevationVector(tile_anchor)*e;float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;vec3 world_pos_globe;\n#ifdef PROJECTION_GLOBE_VIEW\nmercator_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;\n#else\nworld_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0;\n#endif\nvec4 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 ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(\n0.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;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 displacement=vec3(a_globe_normal.z,0,-a_globe_normal.x);offsetprojected_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;\n#else\noffsetprojected_point=u_matrix*vec4(tile_anchor+vec2(1,0),0,1);a=projected_point.xy/projected_point.w;\n#endif\nvec2 b=offsetprojected_point.xy/offsetprojected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos;\n#ifdef PROJECTION_GLOBE_VIEW\n#ifdef PROJECTED_POS_ON_VIEWPORT\nprojected_pos=u_label_plane_matrix*vec4(a_projected_pos.xyz+h,1.0);\n#else\nvec3 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); \n#endif\n#else\nprojected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0);\n#endif\nhighp 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);\n#ifdef TERRAIN\n#ifdef PITCH_WITH_MAP_TERRAIN\nvec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);\n#endif\n#endif\n#ifdef Z_OFFSET\nz+=u_pitch_with_map ? a_auto_z_offset+z_offset : 0.0;\n#else\nz+=u_pitch_with_map ? z_offset : 0.0;\n#endif\nfloat 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));\n#ifdef DEPTH_OCCLUSION\nfloat depth_occlusion=occlusionFadeMultiSample(projected_point);float depth_occlusion_multplier=mix(occlusion_opacity,1.0,depth_occlusion);out_fade_opacity*=depth_occlusion_multplier;\n#endif\n#ifdef OCCLUSION_QUERIES\nfloat occludedFadeMultiplier=mix(occlusion_opacity,1.0,a_occlusion_query_opacity);out_fade_opacity*=occludedFadeMultiplier;\n#endif\n#ifdef Z_TEST_OCCLUSION\nout_fade_opacity*=occlusion_opacity;\n#endif\nfloat alpha=opacity*out_fade_opacity;float hidden=float(alpha==0.0 || projected_point.w <=0.0 || occlusion_fade==0.0);vec3 pos;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 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;\n#else\n#ifdef ELEVATED_ROADS\nvec3 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;\n#else\npos=vec3(projected_pos.xy/projected_pos.w+offset,z);\n#endif\n#endif\ngl_Position=mix(u_coord_matrix*vec4(pos,1.0),AWAY,hidden);
8\n#ifdef USE_PAINT_PROPERTIES_UBO\n{vec2 tr=paint_properties.translate;vec2 rotated_tr=vec2(\nu_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\n);gl_Position.xy+=(u_coord_matrix*vec4(rotated_tr,0.0,0.0)).xy;}\n#endif\nfloat 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;\n#ifdef RENDER_TEXT_AND_SYMBOL\nis_sdf=a_size[0]-2.0*a_size_min;v_tex_a_icon=a_tex/u_texsize_icon;\n#endif\n#ifdef ICON_TRANSITION\nv_tex_b=vec2(a_texb)/u_texsize;\n#endif\n#ifdef RENDER_SHADOWS\nvec4 shd_pos=u_inv_matrix*vec4(pos,1.0);vec3 shd_pos0=shd_pos.xyz;vec3 shd_pos1=shd_pos.xyz;\n#ifdef NORMAL_OFFSET\nvec3 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();\n#endif\nv_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;\n#endif\n#ifdef INDICATOR_CUTOUT\nv_z_offset=e;\n#else\n#ifdef RENDER_SHADOWS\nv_z_offset=e;\n#endif\n#endif\n}'),terrainRaster:rK('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform sampler2D u_image0;\n#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS\nuniform sampler2D u_image1;uniform float u_emissive_texture_available;\n#endif\nin vec2 v_pos0;\n#ifdef FOG\nin float v_fog_opacity;\n#endif\n#ifdef RENDER_SHADOWS\nin vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1;\n#endif\nuniform vec3 u_ground_shadow_factor;void main() {vec4 image_color=texture(u_image0,v_pos0);vec4 color;\n#ifdef LIGHTING_3D_MODE\nconst vec3 normal=vec3(0.0,0.0,1.0);\n#ifdef RENDER_SHADOWS\nfloat cutoffOpacity=1.0;\n#ifdef RENDER_CUTOFF\ncutoffOpacity=cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w);\n#endif\n#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS\nfloat 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;\n#else\nfloat 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));\n#endif\n#else\nfloat lighting_factor=u_lighting_directional_dir.z;color=apply_lighting(image_color,normal,lighting_factor);\n#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS\nfloat 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;\n#endif\n#endif\n#else\ncolor=image_color;\n#endif\n#ifdef FOG\n#ifdef ZERO_EXAGGERATION\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#else\ncolor=fog_dither(fog_apply_from_vert(color,v_fog_opacity));\n#endif\n#endif\nglFragColor=color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\nuniform mat4 u_matrix;uniform float u_skirt_height;in ivec2 a_pos;out vec2 v_pos0;\n#ifdef FOG\nout float v_fog_opacity;\n#endif\n#ifdef RENDER_SHADOWS\nuniform 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;\n#endif\nvoid 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);\n#ifdef FOG\n#ifdef ZERO_EXAGGERATION\nv_fog_pos=fog_position(decodedPos);\n#else\nv_fog_opacity=fog(fog_position(vec3(decodedPos,elevation)));\n#endif\n#endif\n#ifdef RENDER_SHADOWS\nvec3 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.);\n#endif\n}'),terrainDepth:rK("precision highp float;in float v_depth;void main() {glFragColor=pack_depth(v_depth);}",'#include "_prelude_terrain.vertex.glsl"\nuniform 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:rK('#include "_prelude_fog.fragment.glsl"\nin 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(\ncos_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
8nd-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;\n#ifdef FOG\nsky_color=fog_apply_sky_gradient(v_uv.xzy,sky_color);\n#endif\nsky_color+=0.1*sun_disk(v_uv,u_sun_direction);glFragColor=vec4(sky_color*u_opacity,u_opacity);\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\n}',rM),skyboxGradient:rK('#include "_prelude_fog.fragment.glsl"\nin 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));\n#ifdef FOG\ncolor.rgb=fog_apply_sky_gradient(v_uv.xzy,color.rgb/color.a)*color.a;\n#endif\ncolor*=u_opacity;glFragColor=color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\n}',rM),skyboxCapture:rK
vendor: 3,689 bytes, line 8
8("\nin 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;\n#define BETA_R vec3(5.5e-6,13.0e-6,22.4e-6)\n#define BETA_M vec3(21e-6,21e-6,21e-6)\n#define MIE_G 0.76\n#define DENSITY_HEIGHT_SCALE_R 8000.0\n#define DENSITY_HEIGHT_SCALE_M 1200.0\n#define PLANET_RADIUS 6360e3\n#define ATMOSPHERE_RADIUS 6420e3\n#define SAMPLE_STEPS 10\n#define DENSITY_STEPS 4\nfloat 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;
8v_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);}"),globeRaster:rK('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform sampler2D u_image0;\n#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS\nuniform sampler2D u_image1;uniform float u_emissive_texture_available;\n#endif\nuniform float u_far_z_cutoff;in vec2 v_pos0;\n#ifndef FOG\nuniform 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;\n#endif\nvoid main() {vec4 color;\n#ifdef CUSTOM_ANTIALIASING\nhighp vec2 uv=gl_FragCoord.xy/u_viewport;\n#ifdef FLIP_Y\nuv.y=1.0-uv.y;\n#endif\nhighp vec3 ray_dir=mix(\nmix(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);\n#ifdef LIGHTING_3D_MODE\n#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS\nfloat 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);\n#else\nraster=apply_lighting_ground(raster);color=vec4(raster.rgb*antialias,raster.a*antialias);\n#endif\n#else\ncolor=vec4(raster.rgb*antialias,raster.a*antialias);\n#endif\n#else\ncolor=texture(u_image0,v_pos0);\n#ifdef LIGHTING_3D_MODE\n#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS\nfloat 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;\n#else\ncolor=apply_lighting_ground(color);\n#endif\n#endif\n#endif\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos));\n#endif\ncolor*=1.0-step(u_far_z_cutoff,1.0/gl_FragCoord.w);glFragColor=color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_terrain.vertex.glsl"\nuniform 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;\n#ifdef GLOBE_POLES\nin vec3 a_globe_pos;in vec2 a_uv;\n#else\nin ivec2 a_pos;\n#endif\nout vec2 v_pos0;void main() {\n#ifdef GLOBE_POLES\nvec3 globe_pos=a_globe_pos;vec2 uv=a_uv;\n#else\nfloat 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);\n#endif\nv_pos0=uv;vec2 tile_pos=uv*EXTENT;vec3 globe_derived_up_vector=normalize(globe_pos)*u_tile_up_scale;\n#ifdef GLOBE_POLES\nvec3 up_vector=globe_derived_up_vector;\n#else\nvec3 up_vector=elevationVector(tile_pos);\n#endif\nfloat height=elevation(tile_pos);globe_pos+=up_vector*height;\n#ifndef GLOBE_POLES\nglobe_pos-=globe_derived_up_vector*u_skirt_height*decomposed_pos_and_skirt.z;\n#endif\n#ifdef GLOBE_POLES\nvec4 interpolated_pos=u_globe_matrix*vec4(globe_pos,1.0);\n#else\nvec4 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);\n#endif\ngl_Position=u_proj_matrix*interpolated_pos;\n#ifdef FOG\nv_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);\n#endif\n}'),globeAtmosphere:rK('#include "_prelude_fog.fragment.glsl"\nuniform 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;\n#ifdef PROJECTION_GLOBE_VIEW\nglobe_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) {\n#ifdef ALPHA_PASS\nglFragColor=vec4(0,0,0,0);return;\n#else\n#ifdef NATIVE\nglFragColor=vec4(1,1,1,1);\n#else\nglFragColor=vec4(0,0,0,1);\n#endif\nreturn;\n#endif\n}\n#endif\nhighp vec3 horizon_dir=normalize(v_horizon_dir);float horizon_angle_mercator=dir.y < horizon_dir.y ?\n0.0 : max(acos(clamp(dot(dir,horizon_dir),-1.0,1.0)),0.0);float horizon_angle;\n#ifdef PROJECTION_GLOBE_VIEW\nhighp 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 ?\nPI-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);\n#else\nhorizon_angle=horizon_angle_mercator;\n#endif\nhorizon_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;
8vec3 color_stop_2=u_space_color.rgb;\n#ifdef ALPHA_PASS\nfloat 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);\n#else\nvec3 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);\n#endif\n}',"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(\nmix(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(\nmix(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:rK('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform float u_opacity;\n#ifdef DITHERED_DISCARD\nuniform float u_dithered_discard_threshold;\n#endif\nuniform 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;\n#ifdef RENDER_SHADOWS\nin highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in float v_depth_shadows;\n#endif\n#ifdef OCCLUSION_TEXTURE_TRANSFORM\nuniform vec4 u_occlusionTextureTransform;\n#endif\n#pragma mapbox: define-attribute highp vec3 normal_3f\n#pragma mapbox: define-attribute highp vec3 color_3f\n#pragma mapbox: define-attribute highp vec4 color_4f\n#pragma mapbox: define-attribute highp vec2 uv_2f\n#pragma mapbox: initialize-attribute highp vec3 normal_3f\n#pragma mapbox: initialize-attribute highp vec3 color_3f\n#pragma mapbox: initialize-attribute highp vec4 color_4f\n#pragma mapbox: initialize-attribute highp vec2 uv_2f\n#ifdef HAS_ATTRIBUTE_a_pbr\nin lowp vec4 v_roughness_metallic_emissive_alpha;in mediump vec4 v_height_based_emission_params;\n#endif\n#ifdef HAS_TEXTURE_u_baseColorTexture\nuniform sampler2D u_baseColorTexture;uniform bool u_baseTextureIsAlpha;uniform bool u_alphaMask;uniform float u_alphaCutoff;\n#endif\n#ifdef HAS_TEXTURE_u_metallicRoughnessTexture\nuniform sampler2D u_metallicRoughnessTexture;\n#endif\n#ifdef HAS_TEXTURE_u_occlusionTexture\nuniform sampler2D u_occlusionTexture;uniform float u_aoIntensity;\n#endif\n#ifdef HAS_TEXTURE_u_normalTexture\nuniform sampler2D u_normalTexture;\n#endif\n#ifdef HAS_TEXTURE_u_emissionTexture\nuniform sampler2D u_emissionTexture;\n#endif\n#ifdef APPLY_LUT_ON_GPU\nuniform highp sampler3D u_lutTexture;\n#endif\n#ifdef TERRAIN_FRAGMENT_OCCLUSION\nin highp float v_depth;uniform highp sampler2D u_depthTexture;uniform highp vec2 u_inv_depth_size;uniform highp vec2 u_depth_range_unpack;\n#ifdef DEPTH_D24\nhighp float unpack_depth(highp float depth) {return depth*u_depth_range_unpack.x+u_depth_range_unpack.y;}\n#else\nhighp float unpack_depth_rgba(highp vec4 rgba_depth)\n{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;}\n#endif\nbool isOccluded() {highp vec2 coord=gl_FragCoord.xy*u_inv_depth_size;\n#ifdef FLIP_Y\ncoord.y=1.0-coord.y;\n#endif\n#ifdef DEPTH_D24\nhighp float depth=unpack_depth(texture(u_depthTexture,coord).r);\n#else\nhighp float depth=unpack_depth_rgba(texture(u_depthTexture,coord));\n#endif\nreturn v_depth > depth+0.0005;}\n#endif\n#define saturate(_x) clamp(_x,0.,1.)\nvec3 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)\n{\n#ifdef LIGHTING_3D_MODE\nvec3 transformed_normal=vec3(-normal.xy,normal.z);float lighting_factor;\n#ifdef RENDER_SHADOWS\nlighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows);\n#else\nlighting_factor=saturate(dot(transformed_normal,u_lighting_directional_dir));\n#endif\nreturn apply_lighting(albedo,transformed_normal,lighting_factor);\n#else\nvec3 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
8Color),vec3(1.0));return c3;\n#endif\n}vec4 getBaseColor() {vec4 albedo=u_baseColorFactor;\n#ifdef HAS_ATTRIBUTE_a_color_3f\nalbedo*=vec4(color_3f,1.0);\n#endif\n#ifdef HAS_ATTRIBUTE_a_pbr\n#else\n#ifdef HAS_ATTRIBUTE_a_color_4f\nalbedo*=color_4f;\n#endif\n#endif\n#if defined (HAS_TEXTURE_u_baseColorTexture) && defined (HAS_ATTRIBUTE_a_uv_2f)\nvec4 texColor=texture(u_baseColorTexture,uv_2f);if(u_alphaMask) {if (texColor.w < u_alphaCutoff) {discard;}}\n#ifdef UNPREMULT_TEXTURE_IN_SHADER\ntexColor=vec4(unpremultiplyColor(texColor),1.0);\n#endif\nif(u_baseTextureIsAlpha) {if (texColor.r < 0.5) {discard;}} else {texColor.rgb=sRGBToLinear(texColor.rgb);albedo*=texColor;}\n#endif\nvec4 color=vec4(mix(albedo.rgb,v_color_mix.rgb,v_color_mix.a),albedo.a);\n#ifdef APPLY_LUT_ON_GPU\ncolor=applyLUT(u_lutTexture,color);\n#endif\nreturn color;}highp mat3 cotangentFrame(highp vec3 N,highp vec3 p,highp vec2 uv ) {\n#ifdef HAS_TEXTURE_u_normalTexture\nhighp 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;\n#ifdef FLIP_Y\nT=-T;B=-B;\n#endif\nhighp 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;\n#else\nreturn mat3(1.0);\n#endif\n}highp vec3 getNormal(){highp vec3 n;\n#ifdef HAS_ATTRIBUTE_a_normal_3f\nn=normalize(normal_3f);\n#else\nhighp 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));\n#ifdef FLIP_Y\nn=normalize(cross(fdx,fdy));\n#else\nn=normalize(cross(fdx,fdy))*-1.0;\n#endif\n#endif\n#if defined(HAS_TEXTURE_u_normalTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)\nvec3 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);\n#endif\nreturn 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;\n#ifdef HAS_ATTRIBUTE_a_pbr\nmat.perceptualRoughness=v_roughness_metallic_emissive_alpha.x;mat.metallic=v_roughness_metallic_emissive_alpha.y;mat.baseColor.w*=v_roughness_metallic_emissive_alpha.w;\n#endif\n#if defined(HAS_TEXTURE_u_metallicRoughnessTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)\nvec4 mrSample=texture(u_metallicRoughnessTexture,uv_2f);mat.perceptualRoughness*=mrSample.g;mat.metallic*=mrSample.b;\n#endif\nconst 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)\n{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)\n{return specularColor+(f90-specularColor)*pow(clamp(1.0-VdotH,0.0,1.0),5.0);}vec3 F_SchlickFast(vec3 specularColor,float VdotH)\n{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)\n{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)\n{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)\n{\n#ifdef LIGHTING_3D_MODE\nreturn mat.diffuseColor;\n#else\nreturn mat.diffuseColor/PI;\n#endif\n}vec3 EnvBRDFApprox(vec3 specularColor,float roughness,highp float NdotV)\n{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)\n{vec3 env_light=vec3(0.65,0.65,0.65);\n#ifdef LIGHTING_3D_MODE\nfloat ambient_factor=calculate_ambient_directional_factor(normal);env_light=u_lighting_ambient_color*ambient_factor;\n#endif\nvec3 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)\n{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;\n#ifdef RENDER_SHADOWS\nlighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows);\n#else\nlighting_factor=NdotL;\n#endif\nvec3 directLightColor=(specularTerm+diffuseTerm)*lighting_factor*light
8Color;vec3 indirectLightColor=computeIndirectLightContribution(mat,NdotV,transformed_normal);vec3 color=(saturate(directLightColor)+indirectLightColor);float intensityFactor=1.0;\n#if !defined(LIGHTING_3D_MODE)\nconst 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);\n#endif\ncolor*=intensityFactor;return color;}void main() {\n#ifdef TERRAIN_FRAGMENT_OCCLUSION\nif (isOccluded()) {discard;}\n#endif\nvec3 lightDir=u_lightpos;vec3 lightColor=u_lightcolor;\n#ifdef LIGHTING_3D_MODE\nlightDir=u_lighting_directional_dir;lightDir.xy=-lightDir.xy;lightColor=u_lighting_directional_color;\n#endif\nvec4 finalColor;\n#ifdef DIFFUSE_SHADED\nvec3 N=getNormal();vec3 baseColor=getBaseColor().rgb;vec3 diffuse=getDiffuseShadedColor(baseColor,N,lightDir,lightColor);\n#ifdef HAS_TEXTURE_u_occlusionTexture\nfloat ao=(texture(u_occlusionTexture,uv_2f).r-1.0)*u_aoIntensity+1.0;diffuse*=ao;\n#endif\nfinalColor=vec4(mix(diffuse,baseColor,u_emissive_strength),1.0)*u_opacity;\n#else\nMaterial mat=getPBRMaterial();vec3 color=computeLightContribution(mat,lightDir,lightColor);float ao=1.0;\n#if defined (HAS_TEXTURE_u_occlusionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)\n#ifdef OCCLUSION_TEXTURE_TRANSFORM\nvec2 uv=uv_2f.xy*u_occlusionTextureTransform.zw+u_occlusionTextureTransform.xy;\n#else\nvec2 uv=uv_2f;\n#endif\nao=(texture(u_occlusionTexture,uv).x-1.0)*u_aoIntensity+1.0;color*=ao;\n#endif\nvec4 emissive=u_emissiveFactor;\n#if defined(HAS_TEXTURE_u_emissionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)\nemissive.rgb*=sRGBToLinear(texture(u_emissionTexture,uv_2f).rgb);\n#endif\n#ifdef APPLY_LUT_ON_GPU\nfloat emissiveFactorLength=max(length(u_emissiveFactor.rgb),0.001);emissive.rgb=sRGBToLinear(applyLUT(u_lutTexture,linearTosRGB(emissive.rgb/emissiveFactorLength).rbg))*emissiveFactorLength;\n#endif\ncolor+=emissive.rgb;float opacity=mat.baseColor.w*u_opacity;\n#ifdef HAS_ATTRIBUTE_a_pbr\nfloat 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;\n#ifdef APPLY_LUT_ON_GPU\ncolor_mix=applyLUT(u_lutTexture,color_mix);\n#endif\ncolor=mix(color,color_mix,min(1.0,resEmission));\n#ifdef HAS_ATTRIBUTE_a_color_4f\nfloat distance=length(vec2(1.3*max(0.0,abs(color_4f.x)-color_4f.z),color_4f.
8y));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);\n#endif\n#endif\nvec3 unlitColor=mat.baseColor.rgb*ao+emissive.rgb;color=mix(color,unlitColor,u_emissive_strength);color=linearTosRGB(color);color*=opacity;finalColor=vec4(color,opacity);\n#endif\n#ifdef DITHERED_DISCARD\nif (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;}}\n#endif\n#ifdef FOG\nfinalColor=fog_dither(fog_apply_premultiplied(finalColor,v_fog_pos,v_position_height.w));\n#endif\n#ifdef RENDER_CUTOFF\nfinalColor*=v_cutoff_opacity;\n#endif\n#ifdef INDICATOR_CUTOUT\nfinalColor=applyCutout(finalColor,v_position_height.w);\n#endif\n#ifdef FEATURE_CUTOUT\nfinalColor=apply_feature_cutout(finalColor,gl_FragCoord,get_cutout_factors(gl_FragCoord).x);\n#endif\nglFragColor=finalColor;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\nin vec3 a_pos_3f;\n#pragma mapbox: define-attribute highp vec3 normal_3f\n#pragma mapbox: define-attribute highp vec2 uv_2f\n#pragma mapbox: define-attribute highp vec3 color_3f\n#pragma mapbox: define-attribute highp vec4 color_4f\n#pragma mapbox: define-attribute-vertex-shader-only highp uvec4 pbr\n#pragma mapbox: define-attribute-vertex-shader-only highp vec3 heightBasedEmissiveStrength\nuniform mat4 u_matrix;uniform mat4 u_node_matrix;uniform mat4 u_lighting_matrix;uniform vec3 u_camera_pos;uniform vec4 u_color_mix;\n#ifdef INSTANCED_ARRAYS\nin vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3;\n#else\nuniform highp mat4 u_normal_matrix;\n#endif\n#ifdef RENDER_SHADOWS\nuniform 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;\n#endif\nout vec4 v_position_height;out lowp vec4 v_color_mix;\n#ifdef TERRAIN_FRAGMENT_OCCLUSION\nout highp float v_depth;\n#endif\n#ifdef HAS_ATTRIBUTE_a_pbr\nout lowp vec4 v_roughness_metallic_emissive_alpha;out mediump vec4 v_height_based_emission_params;\n#endif\nvec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}void main() {\n#pragma mapbox: initialize-attribute highp vec3 normal_3f\n#pragma mapbox: initialize-attribute highp vec2 uv_2f\n#pragma mapbox: initialize-attribute highp vec3 color_3f\n#pragma mapbox: initialize-attribute highp vec4 color_4f\n#pragma mapbox: initialize-attribute-custom highp uvec4 pbr\n#pragma mapbox: initialize-attribute-custom highp vec3 heightBasedEmissiveStrength\nhighp mat4 normal_matrix;\n#ifdef INSTANCED_ARRAYS\nnormal_matrix=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3);\n#else\nnormal_matrix=u_normal_matrix;\n#endif\nvec3 local_pos;mat3 rs;\n#ifdef MODEL_POSITION_ON_GPU\nvec3 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;\n#else\nlocal_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);\n#endif\nv_position_height.w=a_pos_3f.z;\n#ifdef HAS_ATTRIBUTE_a_pbr\nvec4 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;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(local_pos);\n#endif\n#ifdef RENDER_CUTOFF\nv_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z);\n#endif\n#ifdef TERRAIN_FRAGMENT_OCCLUSION\nv_depth=gl_Position.z/gl_Position.w;\n#ifdef CLIP_ZERO_TO_ONE\nv_depth=-1.0+2.0*v_depth; \n#endif\n#endif\n#ifdef HAS_ATTRIBUTE_a_normal_3f\n#ifdef MODEL_POSITION_ON_GPU\nfloat 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);
8\n#else\nnormal_3f=vec3(normal_matrix*vec4(normal_3f,0));\n#endif\n#endif\n#ifdef HAS_ATTRIBUTE_a_pbr\n#ifdef HAS_ATTRIBUTE_a_color_4f\nv_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);\n#endif\n#endif\n#ifdef RENDER_SHADOWS\nvec4 shadow_pos=u_node_matrix*vec4(local_pos,1.0);\n#ifdef NORMAL_OFFSET\n#ifdef HAS_ATTRIBUTE_a_normal_3f\n#ifdef MODEL_POSITION_ON_GPU\nvec3 offset=shadow_normal_offset(vec3(-normal_3f.xy,normal_3f.z));shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0();\n#else\nvec3 offset=shadow_normal_offset_model(normal_3f);shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0();\n#endif\n#endif\n#endif\nv_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;\n#endif\n}'),modelDepth:rK("void main() {}","in vec3 a_pos_3f;uniform mat4 u_matrix;\n#ifdef MODEL_POSITION_ON_GPU\n#ifdef INSTANCED_ARRAYS\nin vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3;\n#else\nuniform highp mat4 u_instance;\n#endif\nuniform highp mat4 u_node_matrix;\n#endif\nvoid main() {\n#ifdef MODEL_POSITION_ON_GPU\nhighp mat4 instance;\n#ifdef INSTANCED_ARRAYS\ninstance=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3);\n#else\ninstance=u_instance;\n#endif\nvec3 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;
8rs[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);\n#else\ngl_Position=u_matrix*vec4(a_pos_3f,1);\n#endif\n}"),stars:rK("in highp vec2 v_uv;in mediump float v_intensity;float shapeCircle(in vec2 uv)\n{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;}","\nin vec3 a_pos_3f;in vec2 a_uv;in float a_size_scale;in float a_opacity;uniform mat4 u_matrix;uniform vec3 u_up;uniform vec3 u_right;uniform float u_intensity_multiplier;out highp vec2 v_uv;out mediump float v_intensity;void main() {v_uv=a_uv;v_intensity=a_opacity*u_intensity_multiplier;vec3 pos=a_pos_3f;pos+=a_uv.x*u_right*a_size_scale;pos+=a_uv.y*u_up*a_size_scale;gl_Position=u_matrix*vec4(pos,1.0);}"),occlusion:rK("uniform vec4 u_color;void main() {glFragColor=u_color;}",'#include "_prelude_terrain.vertex.glsl"\nin 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;\n#ifdef TERRAIN\nfloat e=elevation(world_pos.xy);world_pos.z+=e;\n#endif\nvec4 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 rY(i,r){for(let a of i.split("\n")){if("#"!==(a=a.trimStart())[0]||!a.includes("if")||a.startsWith("#endif"))continue;let i=a.match(rk);if(i)for(let a of i)rN.has(a)||r.add(a)}}function rJ(i){return new Set(["uint","int","uvec2","ivec2","uvec3","ivec3","uvec4","ivec4"]).has(i)}function rK(i,r){let a=new Set,n=[],o=[];i=i.replace(rO,(i,r)=>(o.push(r),"")),r=r.replace(rO,(i,r)=>(n.push(r),""));let s=new Set(rU);for(let a of(rY(i,s),rY(r,s),[...n,...o]))rj[a]||(rj[a]=new Set,rY(rV[a],rj[a])),s=new Set([...s,...rj[a]]);return{fragmentSource:i=i.replace(rB,(i,r,n,o,s)=>(a.add(s),"define"===r?` 9#ifndef HAS_UNIFORM_u_${s} 10${rJ(o)?"flat ":""}in ${n} ${o} ${s}; 11#else 12uniform ${n} ${o} u_${s}; 13#endif 14`:"initialize"===r?` 15#ifdef HAS_UNIFORM_u_${s} 16 ${n} ${o} ${s} = u_${s}; 17#endif 18`:"define-attribute"===r?` 19#ifdef HAS_ATTRIBUTE_a_${s} 20 in ${n} ${o} ${s}; 21#endif 22`:"initialize-attribute"===r?"":void 0)),vertexSource:r=r.replace(rB,(i,r,n,o,s)=>{let l=`MATERIAL_ATTRIBUTE_OFFSET_${s}`,h="float"===o?"vec2":o,u=`GET_ATTRIBUTE_${h}(a_${s}, materialInfo, ${l})`,c=s.includes("color")?"color":h;return"define-attribute-vertex-shader-only"===r?` 23#ifdef HAS_ATTRIBUTE_a_${s} 24in ${n} ${o} a_${s}; 25#endif 26`:a.has(s)?"define"===r?` 27#ifndef HAS_UNIFORM_u_${s} 28uniform lowp float u_${s}_t; 29 #if !defined(${l}) 30 in ${n} ${h} a_${s}; 31 #endif 32${rJ(o)?"flat ":""}out ${n} ${o} ${s}; 33#else 34uniform ${n} ${o} u_${s}; 35#endif 36`:"initialize"===r?"vec4"===c||"uvec4"===c?` 37#ifndef HAS_UNIFORM_u_${s} 38 ${s} = a_${s}; 39#else 40 ${n} ${o} ${s} = u_${s}; 41#endif 42`:` 43#if !defined(HAS_UNIFORM_u_${s}) 44 #ifdef ${l} 45 ${s} = unpack_mix_${c}(${u}, u_${s}_t); 46 #else 47 ${s} = unpack_mix_${c}(a_${s}, u_${s}_t); 48 #endif 49#else 50 ${n} ${o} ${s} = u_${s}; 51#endif 52`:"define-attribute"===r?` 53#ifdef HAS_ATTRIBUTE_a_${s} 54 in ${n} ${o} a_${s}; 55 out ${n} ${o} ${s}; 56#endif 57`:"initialize-attribute"===r?` 58#ifdef HAS_ATTRIBUTE_a_${s} 59 ${s} = a_${s}; 60#endif 61`:void 0:"define"===r?` 62#ifndef HAS_UNIFORM_u_${s} 63uniform lowp float u_${s}_t; 64 #if !defined(${l}) 65 in ${n} ${h} a_${s}; 66 #endif 67#else 68uniform ${n} ${o} u_${s}; 69#endif 70`:"define-instanced"===r?"mat4"===c?` 71#ifdef INSTANCED_ARRAYS 72in vec4 a_${s}0; 73in vec4 a_${s}1; 74in vec4 a_${s}2; 75in vec4 a_${s}3; 76#else 77uniform ${n} ${o} u_${s}; 78#endif 79`:` 80#ifdef INSTANCED_ARRAYS 81in ${n} ${h} a_${s}; 82#else 83uniform ${n} ${o} u_${s}; 84#endif 85`:"initialize-attribute-custom"===r?` 86#ifdef HAS_ATTRIBUTE_a_${s} 87 ${n} ${o} ${s} = a_${s}; 88#endif 89`:"vec4"===c||"uvec4"===c?` 90#ifndef HAS_UNIFORM_u_${s} 91 #ifdef ${l} 92 ${n} ${o} ${s} = ${u}; 93 #else 94 ${n} ${o} ${s} = a_${s}; 95 #endif 96#else 97 ${n} ${o} ${s} = u_${s}; 98#endif 99`:` 100#ifndef HAS_UNIFORM_u_${s} 101 #ifdef ${l} 102 ${n} ${o} ${s} = unpack_mix_${c}(${u}, u_${s}_t); 103 #else 104 ${n} ${o} ${s} = unpack_mix_${c}(a_${s}, u_${s}_t); 105 #endif 106#else 107 ${n} ${o} ${s} = u_${s}; 108#endif 109`}),usedDefines:s,vertexIncludes:n,fragmentIncludes:o}}class rQ{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffers=[],this.vao=null}bind(i,r,a,n,o,s,l,h){this.context=i;let u=this.boundPaintVertexBuffers.length!==n.length;for(let i=0;!u&&i<n.length;i++)this.boundPaintVertexBuffers[i]!==n[i]&&(u=!0);let c=this.boundDynamicVertexBuffers.length!==l.length;for(let i=0;!c&&i<l.length;i++)this.boundDynamicVertexBuffers[i]!==l[i]&&(c=!0);if(!this.vao||this.boundProgram!==r||this.boundLayoutVertexBuffer!==a||u||c||this.boundIndexBuffer!==o||this.boundVertexOffset!==s)this.freshBind(r,a,n,o,s,l,h);else{for(let a of(i.bindVertexArrayOES.set(this.vao),l))a&&(a.bind(),h&&a.instanceCount&&a.setVertexAttribDivisor(i.gl,r,h));o&&o.dynamicDraw&&o.bind()}}freshBind(i,r,a,n,o,s,l){let h=this.context,u=h.gl;for(let l of(this.vao&&this.destroy(),this.vao=h.gl.createVertexArray(),h.bindVertexArrayOES.set(this.vao),this.boundProgram=i,this.boundLayoutVertexBuffer=r,this.boundPaintVertexBuffers=a,this.boundIndexBuffer=n,this.boundVertexOffset=o,this.boundDynamicVertexBuffers=s,r.enableAttributes(u,i),r.bind(),r.setVertexAttribPointers(u,i,o),a))l.enableAttributes(u,i),l.bind(),l.setVertexAttribPointers(u,i,o);for(let r of s)r&&(r.enableAttributes(u,i),r.bind(),r.setVertexAttribPointers(u,i,o),l&&r.instanceCount&&r.setVertexAttribDivisor(u,i,l));n&&n.bind()}destroy(){this.vao&&(this.context.gl.deleteVertexArray(this.vao),this.vao=null)}}function r0(r,a,n){if(!a.needsDEMTextureUpload)return;let o=r.context,s=o.gl;o.pixelStoreUnpackPremultiplyAlpha.set(!1),a.demTexture=a.demTexture||r.getTileTexture(n.stride);let l=n.getPixels();a.demTexture?a.demTexture.update(l,{premultiply:!1}):a.demTexture=new i.T(o,l,s.R32F,{premultiply:!1}),a.needsDEMTextureUpload=!1}class r1{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 r2 extends r1{getDefault(){return i.C.transparent.toNonPremultipliedRenderColor(null)}set(i){let r=this.current;(i.r!==r.r||i.g!==r.g||i.b!==r.b||i.a!==r.a||this.dirty)&&(this.gl.clearColor(i.r,i.g,i.b,i.a),this.current=i,this.dirty=!1)}}class r3 extends r1{getDefault(){return 1}set(i){(i!==this.current||this.dirty)&&(this.gl.clearDepth(i),this.current=i,this.dirty=!1)}}class r5 extends r1{getDefault(){return 0}set(i){(i!==this.current||this.dirty)&&(this.gl.clearStencil(i),this.current=i,this.dirty=!1)}}
109class r4 extends r1{getDefault(){return[!0,!0,!0,!0]}set(i){let r=this.current;(i[0]!==r[0]||i[1]!==r[1]||i[2]!==r[2]||i[3]!==r[3]||this.dirty)&&(this.gl.colorMask(i[0],i[1],i[2],i[3]),this.current=i,this.dirty=!1)}}class r6 extends r1{getDefault(){return!0}set(i){(i!==this.current||this.dirty)&&(this.gl.depthMask(i),this.current=i,this.dirty=!1)}}class r8 extends r1{getDefault(){return 255}set(i){(i!==this.current||this.dirty)&&(this.gl.stencilMask(i),this.current=i,this.dirty=!1)}}class r9 extends r1{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(i){let r=this.current;(i.func!==r.func||i.ref!==r.ref||i.mask!==r.mask||this.dirty)&&(this.gl.stencilFunc(i.func,i.ref,i.mask),this.current=i,this.dirty=!1)}}class r7 extends r1{getDefault(){let i=this.gl;return[i.KEEP,i.KEEP,i.KEEP]}set(i){let r=this.current;(i[0]!==r[0]||i[1]!==r[1]||i[2]!==r[2]||this.dirty)&&(this.gl.stencilOp(i[0],i[1],i[2]),this.current=i,this.dirty=!1)}}class ae extends r1{getDefault(){return!1}set(i){if(i===this.current&&!this.dirty)return;let r=this.gl;i?r.enable(r.STENCIL_TEST):r.disable(r.STENCIL_TEST),this.current=i,this.dirty=!1}}class at extends r1{getDefault(){return[0,1]}set(i){let r=this.current;(i[0]!==r[0]||i[1]!==r[1]||this.dirty)&&(this.gl.depthRange(i[0],i[1]),this.current=i,this.dirty=!1)}}class ai extends r1{getDefault(){return!1}set(i){if(i===this.current&&!this.dirty)return;let r=this.gl;i?r.enable(r.DEPTH_TEST):r.disable(r.DEPTH_TEST),this.current=i,this.dirty=!1}}class ar extends r1{getDefault(){return this.gl.LESS}set(i){(i!==this.current||this.dirty)&&(this.gl.depthFunc(i),this.current=i,this.dirty=!1)}}class aa extends r1{getDefault(){return!1}set(i){if(i===this.current&&!this.dirty)return;let r=this.gl;i?r.enable(r.BLEND):r.disable(r.BLEND),this.current=i,this.dirty=!1}}class an extends r1{getDefault(){let i=this.gl;return[i.ONE,i.ZERO,i.ONE,i.ZERO]}set(i){let r=this.current;(i[0]!==r[0]||i[1]!==r[1]||i[2]!==r[2]||i[3]!==r[3]||this.dirty)&&(this.gl.blendFuncSeparate(i[0],i[1],i[2],i[3]),this.current=i,this.dirty=!1)}}class ao extends r1{getDefault(){return i.C.transparent.toNonPremultipliedRenderColor(null)}set(i){let r=this.current;(i.r!==r.r||i.g!==r.g||i.b!==r.b||i.a!==r.a||this.dirty)&&(this.gl.blendColor(i.r,i.g,i.b,i.a),this.current=i,this.dirty=!1)}}class as extends r1{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 al extends r1{getDefault(){return!1}set(i){if(i===this.current&&!this.dirty)return;let r=this.gl;i?r.enable(r.CULL_FACE):r.disable(r.CULL_FACE),this.current=i,this.dirty=!1}}class ah extends r1{getDefault(){return this.gl.BACK}set(i){(i!==this.current||this.dirty)&&(this.gl.cullFace(i),this.current=i,this.dirty=!1)}}class au extends r1{getDefault(){return this.gl.CCW}set(i){(i!==this.current||this.dirty)&&(this.gl.frontFace(i),this.current=i,this.dirty=!1)}}let ac=class extends r1{getDefault(){return null}set(i){(i!==this.current||this.dirty)&&(this.gl.useProgram(i),this.current=i,this.dirty=!1)}};class ad extends r1{getDefault(){return this.gl.TEXTURE0}set(i){(i!==this.current||this.dirty)&&(this.gl.activeTexture(i),this.current=i,this.dirty=!1)}}class ap extends r1{getDefault(){let i=this.gl;return[0,0,i.drawingBufferWidth,i.drawingBufferHeight]}set(i){let r=this.current;(i[0]!==r[0]||i[1]!==r[1]||i[2]!==r[2]||i[3]!==r[3]||this.dirty)&&(this.gl.viewport(i[0],i[1],i[2],i[3]),this.current=i,this.dirty=!1)}}class af extends r1{getDefault(){return null}set(i){if(i===this.current&&!this.dirty)return;let r=this.gl;r.bindFramebuffer(r.FRAMEBUFFER,i),this.current=i,this.dirty=!1}}class am extends r1{getDefault(){return null}set(i){if(i===this.current&&!this.dirty)return;let r=this.gl;r.bindRenderbuffer(r.RENDERBUFFER,i),this.current=i,this.dirty=!1}}class a_ extends r1{getDefault(){return null}set(i){if(i===this.current&&!this.dirty)return;let r=this.gl;r.bindTexture(r.TEXTURE_2D,i),this.current=i,this.dirty=!1}}class ag extends r1{getDefault(){return null}set(i){if(i===this.current&&!this.dirty)return;let r=this.gl;r.bindBuffer(r.ARRAY_BUFFER,i),this.current=i,this.dirty=!1}}class ay extends r1{getDefault(){return null}set(i){let r=this.gl;r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,i),this.current=i,this.dirty=!1}}class ax extends r1{getDefault(){return null}set(i){this.gl&&(i!==this.current||this.dirty)&&(this.gl.bindVertexArray(i),this.current=i,this.dirty=!1)}}class av extends r1{getDefault(){return 4}set(i){if(i===this.current&&!this.dirty)return;let r=this.gl;r.pixelStorei(r.UNPACK_ALIGNMENT,i),this.current=i,this.dirty=!1}}class ab extends r1{getDefault(){return!1}set(i){if(i===this.current&&!this.dirty)return;let r=this.gl;r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i),this.current=i,this.dirty=!1}}class aw extends r1{getDefault(){return!1}set(i){if(i===this.current&&!this.dirty)return;let r=this.gl;r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,i),this.current=i,this.dirty=!1}}class aT extends r1{constructor(i,r){super(i),this.context=i,this.parent=r}getDefault(){return null}}class aS extends aT{constructor(i,r,a=0){super(i,r),this.attachmentPoint=i.gl.COLOR_ATTACHMENT0+a}setDirty(){this.dirty=!0}set(i){if(i===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let r=this.gl;r.framebufferTexture2D(r.FRAMEBUFFER,this.attachmentPoint,r.TEXTURE_2D,i,0),this.current=i,this.dirty=!1}}class aE extends aT{attachment(){return this.gl.DEPTH_ATTACHMENT}set(i){if(i===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let r=this.gl;r.framebufferRenderbuffer(r.FRAMEBUFFER,this.attachment(),r.RENDERBUFFER,i),this.current=i,this.dirty=!1}}class aI extends aT{attachment(){return this.gl.DEPTH_ATTACHMENT}set(i){if(i===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let r=this.gl;r.framebufferTexture2D(r.FRAMEBUFFER,this.attachment(),r.TEXTURE_2D,i,0),this.current=i,this.dirty=!1}}class aA extends aE{attachment(){return this.gl.DEPTH_STENCIL_ATTACHMENT}}let aM=(i,r,a,n)=>({u_matrix:i,u_image0:0,u_image1:1,u_skirt_height:r,u_ground_shadow_factor:a,u_emissive_texture_available:n}),aC=(i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y)=>({u_proj_matrix:Float32Array.from(i),u_globe_matrix:r,u_normalize_matrix:Float32Array.from(n),u_merc_matrix:a,u_zoom_transition:o,u_merc_center:s,u_image0:0,u_image1:1,u_frustum_tl:l,u_frustum_tr:h,u_frustum_br:u,u_frustum_bl:c,u_globe_pos:d,u_globe_radius:p,u_viewport:f,u_grid_matrix:y?Float32Array.from(y):new Float32Array(9),u_skirt_height:m,u_far_z_cutoff:_,u_emissive_texture_available:g});function aP(i,r){return null!=i&&null!=r&&!(!i.hasData()||!r.hasData())&&null!=i.demTexture&&null!=r.demTexture&&i.tileID.key!==r.tileID.key}let aD=new class{constructor(){this.operations={}}newMorphing(i,r,a,n,o){if(i in this.operations){let r=this.operations[i];r.to.tileID.key!==a.tileID.key&&(r.queued=a)}else this.operations[i]={startTime:n,phase:0,duration:o,from:r,to:a,queued:null}}getMorphValuesForProxy(i){if(!(i in this.operations))return null;let r=this.operations[i];return{from:r.from,to:r.to,phase:r.phase}}update(i){for(let r in this.operations){let a=this.operations[r];for(a.phase=(i-a.startTime)/a.duration;a.phase>
109=1||!this._validOp(a);)if(!this._nextOp(a,i)){delete this.operations[r];break}}}_nextOp(i,r){return!!i.queued&&(i.from=i.to,i.to=i.queued,i.queued=null,i.phase=0,i.startTime=r,!0)}_validOp(i){return i.from.hasData()&&i.to.hasData()}};function aR(i,r,a){return 0===r?0:6*Math.pow(1.5,22-i)*Math.max(r,1)*(r<1&&514===a?.25/r:1)}function az(i,r){if(!i.style||!i.style.enable3dLights())return;let a=i.context,n=a.gl;a.activeTexture.set(n.TEXTURE1),r?r.bind(n.LINEAR,n.CLAMP_TO_EDGE):i.emptyTexture.bind(n.LINEAR,n.CLAMP_TO_EDGE)}let aL=i=>({u_matrix:i});function aF(r,a,n,o,s){if(s>0){let l=i.o.now(),h=(l-r.timeAdded)/s,u=a?(l-a.timeAdded)/s:-1,c=n.getSource(),d=o.coveringZoomLevel({tileSize:c.tileSize,roundZoom:c.roundZoom}),p=!a||Math.abs(a.tileID.overscaledZ-d)>Math.abs(r.tileID.overscaledZ-d),f=p&&r.refreshedUponExpiration?1:i.aB(p?h:1-u,0,1);return a?{opacity:1,mix:1-f,isFading:h<1}:{opacity:f,mix:0,isFading:h<1}}return{opacity:1,mix:0,isFading:!1}}class aO extends t9{constructor(i){let r=t1("mock-dem",{type:"raster-dem",maxzoom:Math.ceil(i.transform.maxZoom)},i.style.dispatcher,i.style);super("mock-dem",r,null),r.setEventedParent(this),this._sourceLoaded=!0}_loadTile(i,r){i.state="loaded",r(null)}}class aB extends t9{constructor(i){let r=t1("proxy",{type:"geojson",maxzoom:Math.ceil(i.transform.maxZoom)},i.style.dispatcher,i.style);super("proxy",r,null),r.setEventedParent(this),this.map=this.getSource().map=i,this.used=this._sourceLoaded=!0,this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}update(r,a,n){if(r.freezeTileCoverage)return;this.transform=r;let o=r.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}).reduce((a,n)=>{if(a[n.key]="",!this._tiles[n.key]){let a=new i.b3(n,this._source.tileSize*n.overscaleFactor(),r.tileZoom,void 0,void 0,this._source.worldview);a.state="loaded",this._tiles[n.key]=a}return a},{});for(let i in this._tiles)i in o||(this.freeFBO(i),this._tiles[i].unloadVectorData(),delete this._tiles[i])}freeFBO(i){let r=this.proxyCachedFBO[i];if(void 0!==r){let a=Object.values(r);this.renderCachePool.push(...a),delete this.proxyCachedFBO[i]}}deallocRenderCache(){this.renderCache.forEach(i=>i.fb.destroy()),this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}}class ak extends i.aU{constructor(i,r,a){super(i.overscaledZ,i.wrap,i.canonical.z,i.canonical.x,i.canonical.y),this.proxyTileKey=r,this.projMatrix=a}}class aN extends i.bx{constructor(r,a){super(),this.painter=r,this.terrainTileForTile={},this.prevTerrainTileForTile={};let[n,o,s]=function(){let r=new i.dE,a=new i.dF;r.reserve(17161),a.reserve(33800);let n=i.ak/128,o=i.ak+n/2,s=o+n;for(let a=-n;a<s;a+=n)for(let l=-n;l<s;l+=n){let n=24575*(l<0||l>o||a<0||a>o),s=i.aB(Math.round(l),0,i.ak),h=i.aB(Math.round(a),0,i.ak);r.emplaceBack(s+n,h)}let l=(i,r)=>{let n=131*r+i;a.emplaceBack(n+1,n,n+131),a.emplaceBack(n+131,n+131+1,n+1)};for(let i=1;i<129;i++)for(let r=1;r<129;r++)l(r,i);return[0,129].forEach(i=>{for(let r=0;r<130;r++)l(r,i),l(i,r)}),[r,a,32768]}(),l=r.context;this.gridBuffer=l.createVertexBuffer(n,i.dA.members),this.gridIndexBuffer=l.createIndexBuffer(o),this.gridSegments=i.dB.simpleSegment(0,0,n.length,o.length),this.gridNoSkirtSegments=i.dB.simpleSegment(0,0,n.length,s),this.proxyCoords=[],this.proxiedCoords={},this._visibleDemTiles=[],this._drapedRenderBatches=[],this._sourceTilesOverlap={},this.proxySourceCache=new aB(a.map),this.orthoMatrix=i.bd(),i.bX(this.orthoMatrix,.015*("globe"===this.painter.transform.projection.name),i.ak,0,i.ak,0,1);let h=l.gl;this._overlapStencilMode=new iK({func:h.GEQUAL,mask:255},0,255,h.KEEP,h.KEEP,h.REPLACE),this._previousZoom=r.transform.zoom,this.pool=[],this._findCoveringTileCache={},this._tilesDirty={},this.style=a,this._useVertexMorphing=!0,this._exaggeration=1,this._mockSourceCache=new aO(a.map),this._pendingGroundEffectLayers=[],this._emissiveTexture=!1,this._devtoolsFolder=null}set style(i){i.on("data",this._onStyleDataEvent.bind(this)),this._style=i,this._style.map.on("moveend",()=>{this._clearLineLayersFromRenderCache()})}update(r,a,n){if(r&&r.terrain){this._style!==r&&(this.style=r,this._evaluationZoom=void 0);let o=r.terrain.properties,s=0===r.terrain.drapeRenderMode,l=r.terrain.isZoomDependent();this._previousUpdateTimestamp=this.enabled?this._updateTimestamp:void 0,this._updateTimestamp=i.o.now();let h=r.terrain&&r.terrain.scope,u=o.get("source"),c=s?this._mockSourceCache:r.getSourceCache(u,h);if(!c)return void i.w(`Couldn't find terrain source "${u}".`);if(this.sourceCache=c,this._attenuationRange=r.terrain.getAttenuationRange(),this._exaggeration=l?this.calculateExaggeration(a):o.get("exaggeration"),!a.projection.requiresDraping&&l&&0===this._exaggeration)return void this._disable();this.enabled=!0;let d=()=>{this.sourceCache.used&&i.w(`Raster DEM source '${this.sourceCache.id}' is used both for terrain and as layer source. 110This leads to lower resolution of hillshade. For full hillshade resolution but higher memory consumption, define another raster DEM source.`);let r=this.getScaledDemTileSize();this.sourceCache.update(a,r,!0),this.resetTileLookupCache(this.sourceCache.id)};this.sourceCache.usedForTerrain||(this.resetTileLookupCache(this.sourceCache.id),this.sourceCache.usedForTerrain=!0,d(),this._initializing=!0),d(),a.updateElevation(!0,n),this.resetTileLookupCache(this.proxySourceCache.id),this.proxySourceCache.update(a),this._emptyDEMTextureDirty=!0,this._previousZoom=a.zoom}else this._disable()}calculateExaggeration(r){if(this._attenuationRange&&r.zoom>=Math.ceil(this._attenuationRange[1]))return this._style.terrain.getExaggeration(r.zoom);let a=this._previousCameraAltitude,n=r.getFreeCameraOptions().position.z/r.pixelsPerMeter*r.worldSize;this._previousCameraAltitude=n;let o=null!=a?n-a:Number.MAX_VALUE;if(2>Math.abs(o))return this._exaggeration;let s=r.zoom,l=this._style.terrain;if(!this._previousUpdateTimestamp)return l.getExaggeration(s);let h=s-this._previousZoom,u=this._previousUpdateTimestamp,c=s;null!=this._evaluationZoom&&(Math.abs(s-(c=this._evaluationZoom))>.5&&(h=.5*(s-c+h)),h*o<0&&(c+=h)),this._evaluationZoom=c;let d=l.getExaggeration(c),p=d===l.getExaggeration(Math.max(0,c-.1));if(p&&.01>Math.abs(d-this._exaggeration))return d;let f=Math.min(.1,.00375*(this._updateTimestamp-u));return(p||d<.1||1e-4>Math.abs(h))&&(f=Math.min(.2,4*f)),i.aj(this._exaggeration,d,f)}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){"source"===i.dataType&&i.coord?this._clearRenderCacheForTile(i.sourceCacheId,i.coord):"style"===i.dataType&&(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(let i in this._style._mergedSourceCaches)this._style._mergedSourceCaches[i].usedForTerrain=!1}destroy(){this._disable(),this._emptyDEMTexture&&this._emptyDEMTexture.destroy(),this.pool.forEach(i=>
110i.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(){let i=2*this.proxySourceCache.getSource().tileSize;return[i,i]}set useVertexMorphing(i){this._useVertexMorphing=i}updateTileBinding(r){if(!this.enabled)return;this.prevTerrainTileForTile=this.terrainTileForTile;let a=this.proxySourceCache,n=this.painter.transform;this._initializing&&(this._initializing=0===n._centerAltitude&&-1===this.getAtPointOrZero(i.ad.fromLngLat(n.center),-1),this._emptyDEMTextureDirty=!this._initializing);let o=this.proxyCoords=a.getIds().map(i=>{let r=a.getTileByID(i).tileID;return r.projMatrix=n.calculateProjMatrix(r.toUnwrapped()),r});var s=this.painter;let l=s.transform.pointCoordinate(s.transform.getCameraPoint()),h=new i.P(l.x,l.y);o.sort((r,a)=>{if(a.overscaledZ-r.overscaledZ)return a.overscaledZ-r.overscaledZ;let n=new i.P(r.canonical.x+(1<<r.canonical.z)*r.wrap,r.canonical.y),o=new i.P(a.canonical.x+(1<<a.canonical.z)*a.wrap,a.canonical.y),s=h.mult(1<<r.canonical.z);return s.x-=.5,s.y-=.5,s.distSqr(n)-s.distSqr(o)});let u=this.proxyToSource||{};this.proxyToSource={},o.forEach(i=>{this.proxyToSource[i.key]={}}),this.terrainTileForTile={};let c=this._style._mergedSourceCaches;for(let i in c){let a=c[i];if(!a.used||(a!==this.sourceCache&&this.resetTileLookupCache(a.id),this._setupProxiedCoordsForOrtho(a,r[i],u),a.usedForTerrain))continue;let n=r[i];(a.getSource().reparseOverscaled||a._isRasterElevatedOverTerrain)&&this._assignTerrainTiles(n)}this.proxiedCoords[a.id]=o.map(i=>new ak(i,i.key,this.orthoMatrix)),this._assignTerrainTiles(o),this._prepareDEMTextures(),this._setupDrapedRenderBatches(),this._initFBOPool(),this._setupRenderCache(u),this.renderingToTexture=!1;let d={};for(let i of(this._visibleDemTiles=[],this.proxyCoords)){let r=this.terrainTileForTile[i.key];if(!r)continue;let a=r.tileID.key;a in d||(this._visibleDemTiles.push(r),d[a]=a)}}_assignTerrainTiles(i){this._initializing||i.forEach(i=>{if(this.terrainTileForTile[i.key])return;let r=this._findTileCoveringTileID(i,this.sourceCache);r&&(this.terrainTileForTile[i.key]=r)})}_prepareDEMTextures(){let i=this.painter.context,r=i.gl;for(let a in this.terrainTileForTile){let n=this.terrainTileForTile[a],o=n.dem;o&&(!n.demTexture||n.needsDEMTextureUpload)&&(i.activeTexture.set(r.TEXTURE1),r0(this.painter,n,o))}}_prepareDemTileUniforms(i,r,a,n){if(!r||null==r.demTexture)return!1;let o=i.tileID.canonical,s=Math.pow(2,r.tileID.canonical.z-o.z),l=n||"";return a[`u_dem_tl${l}`]=[o.x*s%1,o.y*s%1],a[`u_dem_scale${l}`]=s,!0}get emptyDEMTexture(){return!this._emptyDEMTextureDirty&&this._emptyDEMTexture?this._emptyDEMTexture:this._updateEmptyDEMTexture()}_getLoadedAreaMinimum(){if(!this.enabled)return 0;let i=0,r=this._visibleDemTiles.reduce((r,a)=>{if(!a.dem)return r;let n=a.dem.tree.minimums[0];return n>0&&i++,r+n},0);return i?r/i:0}_updateEmptyDEMTexture(){let r=this.painter.context,a=r.gl;r.activeTexture.set(a.TEXTURE2);let n=this._getLoadedAreaMinimum(),o=new i.dC({width:1,height:1},new Float32Array([n]));this._emptyDEMTextureDirty=!1;let s=this._emptyDEMTexture;return s?s.update(o,{premultiply:!1}):s=this._emptyDEMTexture=new i.T(r,o,a.R32F,{premultiply:!1}),s}setupElevationDraw(r,a,n){var o;let s=this.painter.context,l=s.gl,h={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};h.u_exaggeration=this.exaggeration();let u=null,c=null,d=1;if(n&&n.morphing&&this._useVertexMorphing){let i=n.morphing.srcDemTile,a=n.morphing.dstDemTile;
110d=n.morphing.phase,i&&a&&(this._prepareDemTileUniforms(r,i,h,"_prev")&&(c=i),this._prepareDemTileUniforms(r,a,h)&&(u=a))}let p=i=>i&&i.demTexture&&this.painter.linearFloatFilteringSupported()?l.LINEAR:l.NEAREST,f=null;if(this.enabled?c&&u?(f=u.demTexture,s.activeTexture.set(l.TEXTURE4),c.demTexture.bind(p(c),l.CLAMP_TO_EDGE),h.u_dem_lerp=d):(u=this.terrainTileForTile[r.tileID.key],f=this._prepareDemTileUniforms(r,u,h)?u.demTexture:this.emptyDEMTexture):f=this.emptyDEMTexture,s.activeTexture.set(l.TEXTURE2),f&&(h.u_dem_size=1===(o=f).size[0]?1:o.size[0]-2,f.bind(p(u),l.CLAMP_TO_EDGE)),this.painter.setupDepthForOcclusion(n&&n.useDepthForOcclusion,a,h),n&&n.useMeterToDem&&u&&(h.u_meter_to_dem=(1<<u.tileID.canonical.z)*i.bY(1,this.painter.transform.center.lat)*this.sourceCache.getSource().tileSize),n&&n.labelPlaneMatrixInv&&(h.u_label_plane_matrix_inv=n.labelPlaneMatrixInv),a.setTerrainUniformValues(s,h),"globe"===this.painter.transform.projection.name){let i=this.globeUniformValues(this.painter.transform,r.tileID.canonical,n&&n.useDenormalizedUpVectorScale);a.setGlobeUniformValues(s,i)}}globeUniformValues(r,a,n){let o=r.projection;return{u_tile_tl_up:o.upVector(a,0,0),u_tile_tr_up:o.upVector(a,i.ak,0),u_tile_br_up:o.upVector(a,i.ak,i.ak),u_tile_bl_up:o.upVector(a,0,i.ak),u_tile_up_scale:n?i.dD(1):o.upVectorScale(a,r.center.lat,r.worldSize).metersToTile}}renderToBackBuffer(r){let a=this.painter,n=this.painter.context;0!==r.length&&(n.bindFramebuffer.set(null),n.viewport.set([0,0,a.width,a.height]),a.gpuTimingDeferredRenderStart(),this.renderingToTexture=!1,function(r,a,n,o,s){if("globe"===r.transform.projection.name)!function(r,a,n,o,s){let l,h,u=r.context,c=u.gl,d=r.transform,p=i.ds(r,u,d),f=(i,a)=>{if(h===a)return;let n=[];1===a&&n.push("TERRAIN_VERTEX_MORPHING"),n.push("PROJECTION_GLOBE_VIEW"),p&&n.push("CUSTOM_ANTIALIASING");let o=r.isTileAffectedByFog(i);l=r.getOrCreateProgram("globeRaster",{defines:n,overrideFog:o}),h=a},m=r.colorModeForRenderPass(),_=new iJ(c.LEQUAL,iJ.ReadWrite,r.depthRangeFor3D);aD.update(s);let g=i.dt(d),y=[i.aG(d.center.lng),i.aJ(d.center.lat)],x=r.globeSharedBuffers,v=[d.width*i.o.devicePixelRatio,d.height*i.o.devicePixelRatio],b=Float32Array.from(d.globeMatrix),w={useDenormalizedUpVectorScale:!0};{let d=r.transform,p=aR(d.zoom,a.exaggeration(),a.sourceCache._source.tileSize);h=-1;let T=c.TRIANGLES;for(let h of o){let o=n.getTile(h),S=iK.disabled,E=a.prevTerrainTileForTile[h.key],I=a.terrainTileForTile[h.key];aP(E,I)&&aD.newMorphing(h.key,E,I,s,250),az(r,o.emissiveTexture),u.activeTexture.set(c.TEXTURE0),o.texture&&o.texture.bind(c.LINEAR,c.CLAMP_TO_EDGE);let A=aD.getMorphValuesForProxy(h.key),M=+!!A;A&&Object.assign(w,{morphing:{srcDemTile:A.from,dstDemTile:A.to,phase:i.dr(A.phase)}});let C=i.du(h.canonical),P=i.dv(C.getCenter().lat),D=i.dw(h.canonical,C,P,d.worldSize/d._pixelsPerMercatorPixel),R=i.dx(i.dy(h.canonical)),z=+("mrt-fallback"===r.emissiveMode),L=aC(d.expandedFarZProjMatrix,b,g,R,i.ai(d.zoom),y,d.frustumCorners.TL,d.frustumCorners.TR,d.frustumCorners.BR,d.frustumCorners.BL,d.globeCenterInViewSpace,d.globeRadius,v,p,d._farZ,z,D);if(f(h,M),l&&(a.setupElevationDraw(o,l,w),r.uploadCommonUniforms(u,l,h.toUnwrapped()),x)){let[i,a,n]=x.getGridBuffers(P,0!==p);l.draw(r,T,_,S,m,iQ.backCCW,L,"globe_raster",i,a,n)}}}if(x&&(r.renderDefaultNorthPole||r.renderDefaultSouthPole)){let s=["GLOBE_POLES","PROJECTION_GLOBE_VIEW"];for(let h of(p&&s.push("CUSTOM_ANTIALIASING"),l=r.getOrCreateProgram("globeRaster",{defines:s}),o)){let{x:o,y:s,z:p}=h.canonical,f=0===s,g=s===(1<<p)-1,[b,T,S,E]=x.getPoleBuffers(p,!1);if(E&&(f||g)){let s=n.getTile(h);az(r,s.emissiveTexture),u.activeTexture.set(c.TEXTURE0),s.texture&&s.texture.bind(c.LINEAR,c.CLAMP_TO_EDGE);let x=i.dz(p,o,d),I=i.dx(i.dy(h.canonical)),A=+("mrt-fallback"===r.emissiveMode),M=(i,a)=>i.draw(r,c.TRIANGLES,_,iK.disabled,m,iQ.disabled,aC(d.expandedFarZProjMatrix,x,x,I,0,y,d.frustumCorners.TL,d.frustumCorners.TR,d.frustumCorners.BR,d.frustumCorners.BL,d.globeCenterInViewSpace,d.globeRadius,v,0,d._farZ,A),"globe_pole_raster",a,S,E);a.setupElevationDraw(s,l,w),r.uploadCommonUniforms(u,l,h.toUnwrapped()),f&&r.renderDefaultNorthPole&&M(l,b),g&&r.renderDefaultSouthPole&&(x=i.cE(i.bd(),x,[1,-1,1]),M(l,T))}}}}(r,a,n,o,s);else{let l,h,u=r.context,c=u.gl,d=r.shadowRenderer,p=i9(r,r.longestCutoffRange),f=i=>{if(h===i)return;let a=[];1===i&&a.push("TERRAIN_VERTEX_MORPHING"),p.shouldRenderCutoff&&a.push("RENDER_CUTOFF"),d&&(a.push("RENDER_SHADOWS"),d.useNormalOffset&&a.push("NORMAL_OFFSET")),l=r.getOrCreateProgram("terrainRaster",{defines:a}),h=i},m=r.colorModeForRenderPass(),_=new iJ(c.LEQUAL,iJ.ReadWrite,r.depthRangeFor3D);aD.update(s);let g=r.transform,y=aR(g.zoom,a.exaggeration(),a.sourceCache._source.tileSize),x=[0,0,0];if(d){let i=r.style.directionalLight,a=r.style.ambientLight;i&&a&&(x=ro(r.style,i,a))}{h=-1;let v=c.TRIANGLES,[b,w]=[a.gridIndexBuffer,a.gridSegments];for(let h of o){let o,T=n.getTile(h),S=iK.disabled,E=a.prevTerrainTileForTile[h.key],I=a.terrainTileForTile[h.key];aP(E,I)&&aD.newMorphing(h.key,E,I,s,250),az(r,T.emissiveTexture),u.activeTexture.set(c.TEXTURE0),T.texture&&T.texture.bind(c.LINEAR,c.CLAMP_TO_EDGE);let A=aD.getMorphValuesForProxy(h.key),M=+!!A;A&&(o={morphing:{srcDemTile:A.from,dstDemTile:A.to,phase:i.dr(A.phase)}});let C=+("mrt-fallback"===r.emissiveMode),P=aM(h.projMatrix,!function(i,r){let a=1<<i.z;return!r&&(0===i.x||i.x===a-1)||0===i.y||i.y===a-1}(h.canonical,g.renderWorldCopies)?y:y/10,x,C);if(f(M),!l)continue;a.setupElevationDraw(T,l,o);let D=h.toUnwrapped();d&&d.setupShadows(D,l),r.uploadCommonUniforms(u,l,D,null,p),l.draw(r,v,_,S,m,iQ.backCCW,P,"terrain_raster",a.gridBuffer,b,w)}}}}(a,this,this.proxySourceCache,r,this._updateTimestamp),this.renderingToTexture=!0,a.gpuTimingDeferredRenderEnd(),r.splice(0,r.length))}renderBatch(r){if(0===this._drapedRenderBatches.length)return r+1;this.renderingToTexture=!0;let a=this.painter,n=this.painter.context,o=this.proxySourceCache,s=this.proxiedCoords[o.id],l=this._drapedRenderBatches.shift(),h=a.style.order,u=[];this._updateFBOs("mrt-fallback"===a.emissiveMode);let c=0;for(let d of s){let s,p=o.getTileByID(d.proxyTileKey),f=o.proxyCachedFBO[d.key]?o.proxyCachedFBO[d.key][r]:void 0,m=void 0!==f?o.renderCache[f]:this.pool[c++],_=void 0!==f;if(p.texture=m.tex,p.emissiveTexture=m.emissiveTex,_&&!m.dirty){u.push(p.tileID);continue}n.bindFramebuffer.set(m.fb.framebuffer);let g=n.gl;g.drawBuffers("mrt-fallback"===a.emissiveMode?[g.COLOR_ATTACHMENT0,g.COLOR_ATTACHMENT1]:[g.COLOR_ATTACHMENT0]),this.renderedToTile=!1,m.dirty&&(n.clear({color:i.C.transparent,stencil:0}),m.dirty=!1);for(let i=l.start;i<=l.end;++i){let r=a.style._mergedLayers[h[i]];if(r.isHidden(a.transform.zoom))continue;let o=a.style.getLayerSourceCache(r),l=o?this.proxyToSource[d.key][o.id]:[d];l&&(n.viewport.set([0,0,m.fb.width,m.fb.height]),s!==(o?o.id:null)&&(this._setupStencil(m,l,r,o),s=o?o.id:null),a.renderLayer(a,o,r,l))}if(g.drawBuffers([g.COLOR_ATTACHMENT0]),0===this._drapedRenderBatches.length)for(let i of this._pendingGroundEffectLayers){let r=a.style._mergedLayers[h[i]];if(r.isHidden(a.transform.zoom))continue;let o=a.style.getLayerSourceCache(r),l=o?this.proxyToSource[d.key][o.id]:[d];l&&(n.viewport.set([0,0,m.fb.width,m.fb.height]),s!==(o?o.id:null)&&(this._setupStencil(m,l,r,o),s=o?o.id:null),a.renderLayer(a,o,r,l))}this.renderedToTile?(m.dirty=!0,u.push(p.tileID)):_||--c,5===c&&(c=0,this.renderToBackBuffer(u))}return this.renderToBackBuffer(u),this.renderingToTexture=!1,n.bindFramebuffer.set(null),n.viewport.set([0,0,a.width,a.height]),l.end+1}postRender(){}isLayerOrderingCorrect(i){let r=i.order.length,a=-1,n=r;for(let o=0;o<r;++o)this._style.isLayerDraped(i._mergedLayers[i.order[o]])?a=Math.max(a,o):n=Math.min(n,o);return n>a}getMinElevationBelowMSL(){let i=0;return this._visibleDemTiles.filter(i=>i.dem).forEach(r=>{i=Math.min(i,r.dem.tree.minimums[0])}),0===i?i:(i-30)*this._exaggeration}raycast(i,r,a){if(!this._visibleDemTiles)return null;let n=this._visibleDemTiles.filter(i=>i.dem).map(n=>{let o=n.tileID,s=1<<o.overscaledZ,{x:l,y:h}=o.canonical,u=l/s,c=(l+1)/s,d=h/s,p=(h+1)/s;return{minx:u,miny:d,maxx:c,maxy:p,t:n.dem.tree.raycastRoot(u,d,c,p,i,r,a),tile:n}});for(let o of(n.sort((i,r)=>(null!==i.t?i.t:Number.MAX_VALUE)-(null!==r.t?r.t:Number.MAX_VALUE)),n)){if(null==o.t)break;let n=o.tile.dem.tree.raycast(o.minx,o.miny,o.maxx,o.maxy,i,r,a);if(null!=n)return n}return null}_createFBO(){let r,a=this.painter.context,n=a.gl,o=this.drapeBufferSize;a.activeTexture.set(n.TEXTURE0);
110let s=new i.T(a,{width:o[0],height:o[1],data:null},n.RGBA8);s.bind(n.LINEAR,n.CLAMP_TO_EDGE);let l=a.createFramebuffer(o[0],o[1],1,null);return l.colorAttachment0.set(s.texture),this._emissiveTexture&&((r=new i.T(a,{width:o[0],height:o[1],data:null},n.R8)).bind(n.LINEAR,n.CLAMP_TO_EDGE),l.createColorAttachment(a,1),l.colorAttachment1.set(r.texture)),l.depthAttachment=new aA(a,l.framebuffer),void 0===this._sharedDepthStencil?(this._sharedDepthStencil=a.createRenderbuffer(a.gl.DEPTH_STENCIL,o[0],o[1]),this._stencilRef=0,l.depthAttachment.set(this._sharedDepthStencil),a.clear({stencil:0})):l.depthAttachment.set(this._sharedDepthStencil),a.extTextureFilterAnisotropic&&n.texParameterf(n.TEXTURE_2D,a.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,a.extTextureFilterAnisotropicMax),{fb:l,tex:s,emissiveTex:r,dirty:!1}}_updateFBOs(i){if(this._emissiveTexture!==i){for(let r of this.pool)this._updateFBO(r,i);for(let r of this.proxySourceCache.renderCache)this._updateFBO(r,i);this._emissiveTexture=i}}_updateFBO(r,a){let n=r.fb,o=this.painter.context,s=o.gl,l=this.drapeBufferSize;if(a){let a=new i.T(o,{width:l[0],height:l[1],data:null},s.R8);a.bind(s.LINEAR,s.CLAMP_TO_EDGE),r.emissiveTex=a,n.createColorAttachment(o,1),n.colorAttachment1.set(a.texture)}else r.emissiveTex=void 0,n.removeColorAttachment(o,1);r.dirty=!0}_initFBOPool(){for(;this.pool.length<Math.min(5,this.proxyCoords.length);)this.pool.push(this._createFBO())}_shouldDisableRenderCache(){if(this._style.hasLightTransitions())return!0;for(let i in this._style._mergedSourceCaches)if(this._style._mergedSourceCaches[i].hasTransition())return!0;return this._style.order.some(i=>{let r=this._style._mergedLayers[i],a=r.isHidden(this.painter.transform.zoom);return"hillshade"===r.type||"custom"===r.type?!a&&r.shouldRedrape():!a&&r.hasTransition()})}_clearLineLayersFromRenderCache(){let r=!1;for(let i of this._style.getSources())if(i instanceof tJ){r=!0;break}if(!r)return;let a={};for(let r=0;r<this._style.order.length;++r){let n=this._style._mergedLayers[this._style.order[r]],o=this._style.getLayerSourceCache(n);if(!o||a[o.id]||n.isHidden(this.painter.transform.zoom)||"line"!==n.type)continue;let s=n.widthExpression(),l=n.emissiveStrengthExpression();if(s instanceof i.ac||l instanceof i.ac)for(let i of(a[o.id]=!0,this.proxyCoords)){let r=this.proxyToSource[i.key][o.id];if(r)for(let i of r)this._clearRenderCacheForTile(o.id,i)}}}_clearRasterLayersFromRenderCache(){let i=!1;for(let r in this._style._mergedSourceCaches)if(this._style._mergedSourceCaches[r]._source instanceof tK){i=!0;break}if(!i)return;let r={};for(let i=0;i<this._style.order.length;++i){let a=this._style._mergedLayers[this._style.order[i]],n=this._style.getLayerSourceCache(a);if(!n||r[n.id]||a.isHidden(this.painter.transform.zoom)||"raster"!==a.type)continue;let o=a.paint.get("raster-fade-duration");for(let i of this.proxyCoords){let r=this.proxyToSource[i.key][n.id];if(r)for(let i of r){let r=aF(n.getTile(i),n.findLoadedParent(i,0),n,this.painter.transform,o);(1!==r.opacity||0!==r.mix)&&this._clearRenderCacheForTile(n.id,i)}}}}_setupDrapedRenderBatches(){this._style.updateDrapeFirstLayers();let r=this._style.order,a=r.length;if(0===a)return;let n=[];this._pendingGroundEffectLayers=[];let o,s=0,l=this._style._mergedLayers[r[s]];for(;!this._style.isLayerDraped(l)&&l.isHidden(this.painter.transform.zoom)&&++s<a;)l=this._style._mergedLayers[r[s]];for(;s<a;++s){let i=this._style._mergedLayers[r[s]];i.isHidden(this.painter.transform.zoom)||(this._style.isLayerDraped(i)?void 0===o&&(o=s):("fill-extrusion"===i.type&&this._pendingGroundEffectLayers.push(s),void 0!==o&&(n.push({start:o,end:s-1}),o=void 0)))}if(void 0!==o&&n.push({start:o,end:s-1}),0!==n.length){let r=n.at(-1);this._pendingGroundEffectLayers.every(i=>i>r.end)||i.w("fill-extrusion with flood lighting and/or ground ambient occlusion should be moved to be on top of all draped layers.")}this._drapedRenderBatches=n}_setupRenderCache(i){let r=this.proxySourceCache;if(this._shouldDisableRenderCache()||this.invalidateRenderCache){if(this.invalidateRenderCache=!1,r.renderCache.length>r.renderCachePool.length){let i=Object.values(r.proxyCachedFBO);r.proxyCachedFBO={};for(let a=0;a<i.length;++a){let n=Object.values(i[a]);r.renderCachePool.push(...n)}}return}this._clearRasterLayersFromRenderCache();let a=this.proxyCoords,n=this._tilesDirty;for(let o=a.length-1;o>=0;o--){let s=a[o];if(r.getTileByID(s.key),void 0!==r.proxyCachedFBO[s.key]){let a=i[s.key],o=this.proxyToSource[s.key],l=0;for(let i in o){let r=o[i],s=a[i];if(!s||s.length!==r.length||r.some((r,a)=>r!==s[a]||n[i]&&Object.hasOwn(n[i],r.key))){l=-1;break}++l}for(let i in r.proxyCachedFBO[s.key])r.renderCache[r.proxyCachedFBO[s.key][i]].dirty=l<0||l!==Object.values(a).length}}let o=[...this._drapedRenderBatches];for(let i of(o.sort((i,r)=>r.end-r.start-(i.end-i.start)),o))for(let n of a){if(r.proxyCachedFBO[n.key])continue;let a=r.renderCachePool.pop();void 0===a&&r.renderCache.length<50&&(a=r.renderCache.length,r.renderCache.push(this._createFBO())),void 0!==a&&(r.proxyCachedFBO[n.key]={},r.proxyCachedFBO[n.key][i.start]=a,r.renderCache[a].dirty=!0)}this._tilesDirty={}}_setupStencil(i,r,a,n){let o;if(!n||!this._sourceTilesOverlap[n.id])return void(this._overlapStencilType&&(this._overlapStencilType=!1));let s=this.painter.context,l=s.gl;if(r.length<=1)return void(this._overlapStencilType=!1);
110if(a.isTileClipped())o=r.length,this._overlapStencilMode.test={func:l.EQUAL,mask:255},this._overlapStencilType="Clip";else{if(!(r[0].overscaledZ>r.at(-1).overscaledZ))return void(this._overlapStencilType=!1);o=1,this._overlapStencilMode.test={func:l.GREATER,mask:255},this._overlapStencilType="Mask"}this._stencilRef+o>255&&(s.clear({stencil:0}),this._stencilRef=0),this._stencilRef+=o,this._overlapStencilMode.ref=this._stencilRef,a.isTileClipped()&&this._renderTileClippingMasks(r,this._overlapStencilMode.ref)}clipOrMaskOverlapStencilType(){return"Clip"===this._overlapStencilType||"Mask"===this._overlapStencilType}stencilModeForRTTOverlap(i){return this.renderingToTexture&&this._overlapStencilType?("Clip"===this._overlapStencilType&&(this._overlapStencilMode.ref=this.painter._tileClippingMaskIDs[i.key]),this._overlapStencilMode):iK.disabled}_renderTileClippingMasks(i,r){let a=this.painter,n=this.painter.context,o=n.gl;a._tileClippingMaskIDs={},n.setColorMode(iY.disabled),n.setDepthMode(iJ.disabled);let s=a.getOrCreateProgram("clippingMask");for(let n of i){let i=a._tileClippingMaskIDs[n.key]=--r;s.draw(a,o.TRIANGLES,iJ.disabled,new iK({func:o.ALWAYS,mask:0},i,255,o.KEEP,o.KEEP,o.REPLACE),iY.disabled,iQ.disabled,aL(n.projMatrix),"$clipping",a.tileExtentBuffer,a.quadTriangleIndexBuffer,a.tileExtentSegments)}}pointCoordinate(r){let a=this.painter.transform;if(r.x<0||r.x>a.width||r.y<0||r.y>a.height)return null;let n=[r.x,r.y,1,1];i.aD(n,n,a.pixelMatrixInverse),i.cw(n,n,1/n[3]),n[0]/=a.worldSize,n[1]/=a.worldSize;let o=a._camera.position,s=i.bY(1,a.center.lat),l=[o[0],o[1],o[2]/s,0],h=i.cZ([],n.slice(0,3),l);i.ax(h,h);let u=this.raycast(l,h,this._exaggeration);return null!==u&&u?(i.bi(l,l,h,u),l[3]=l[2],l[2]*=s,l):null}_setupProxiedCoordsForOrtho(r,a,n){if(r.getSource()instanceof i.aY)return this._setupProxiedCoordsForImageSource(r,a,n);this._findCoveringTileCache[r.id]=this._findCoveringTileCache[r.id]||{};let o=this.proxiedCoords[r.id]=[],s=this.proxyCoords;for(let i=0;i<s.length;i++){let a=s[i],l=this._findTileCoveringTileID(a,r);if(l){let i=this._createProxiedId(a,l,n[a.key]&&n[a.key][r.id]);o.push(i),this.proxyToSource[a.key][r.id]=[i]}}let l=!1,h=new Set;for(let i=0;i<a.length;i++){let s=r.getTile(a[i]);if(!s||!s.hasData())continue;let u=this._findTileCoveringTileID(s.tileID,this.proxySourceCache);if(u&&u.tileID.canonical.z!==s.tileID.canonical.z){let i=this.proxyToSource[u.tileID.key][r.id],a=this._createProxiedId(u.tileID,s,n[u.tileID.key]&&n[u.tileID.key][r.id]);i?i.splice(i.length-1,0,a):this.proxyToSource[u.tileID.key][r.id]=[a];let c=this.proxyToSource[u.tileID.key][r.id];h.has(c)||h.add(c),o.push(a),l=!0}}if(this._sourceTilesOverlap[r.id]=l,l)for(let i of h)i.sort((i,r)=>r.overscaledZ-i.overscaledZ)}_setupProxiedCoordsForImageSource(r,a,n){if(!r.getSource().loaded())return;let o=this.proxiedCoords[r.id]=[],s=this.proxyCoords,l=r.getSource(),h=l.tileID;if(!h)return;let u=new i.P(h.x,h.y)._div(1<<h.z),c=l.coordinates.map(i.ad.fromLngLat).reduce((i,r)=>(i.min.x=Math.min(i.min.x,r.x-u.x),i.min.y=Math.min(i.min.y,r.y-u.y),i.max.x=Math.max(i.max.x,r.x-u.x),i.max.y=Math.max(i.max.y,r.y-u.y),i),{min:new i.P(Number.MAX_VALUE,Number.MAX_VALUE),max:new i.P(-Number.MAX_VALUE,-Number.MAX_VALUE)}),d=(r,a)=>{let n=r.wrap+r.canonical.x/(1<<r.canonical.z),o=r.canonical.y/(1<<r.canonical.z),s=i.ak/(1<<r.canonical.z),l=a.wrap+a.canonical.x/(1<<a.canonical.z),h=a.canonical.y/(1<<a.canonical.z);return n+s<l+c.min.x||n>l+c.max.x||o+s<h+c.min.y||o>h+c.max.y};for(let i=0;i<s.length;i++){let l=s[i];for(let i=0;i<a.length;i++){let s=r.getTile(a[i]);if(!s||!s.hasData()||d(l,s.tileID))continue;let h=this._createProxiedId(l,s,n[l.key]&&n[l.key][r.id]),u=this.proxyToSource[l.key][r.id];u?u.push(h):this.proxyToSource[l.key][r.id]=[h],o.push(h)}}}_createProxiedId(r,a,n){let o=this.orthoMatrix;if(n){let i=n.find(i=>i.key===a.tileID.key);if(i)return i}if(a.tileID.key!==r.key){let n,s,l,h=r.canonical.z-a.tileID.canonical.z;o=i.bd();let u=a.tileID.wrap-r.wrap<<r.overscaledZ;h>0?(s=(n=i.ak>>h)*((a.tileID.canonical.x<<h)-r.canonical.x+u),l=n*((a.tileID.canonical.y<<h)-r.canonical.y)):(n=i.ak<<-h,s=i.ak*(a.tileID.canonical.x-(r.canonical.x+u<<-h)),l=i.ak*(a.tileID.canonical.y-(r.canonical.y<<-h))),i.bX(o,0,n,0,n,0,1),i.bB(o,o,[s,l,0])}return new ak(a.tileID,r.key,o)}_findTileCoveringTileID(r,a){let n=a.getTile(r);if(n&&n.hasData())return n;let o=this._findCoveringTileCache[a.id],s=o[r.key];if((n=s?a.getTileByID(s):null)&&n.hasData()||null===s)return n;let l=n?n.tileID:r,h=l.overscaledZ,u=a.getSource().minzoom,c=[];if(!s){let o=a.getSource().maxzoom;if(r.canonical.z>=o){let n=r.canonical.z-o;a.getSource().reparseOverscaled?(h=Math.max(r.canonical.z+2,a.transform.tileZoom),l=new i.aU(h,r.wrap,o,r.canonical.x>>n,r.canonical.y>>n)):0!==n&&(h=o,l=new i.aU(h,r.wrap,o,r.canonical.x>>n,r.canonical.y>>n))}l.key!==r.key&&(c.push(l.key),n=a.getTile(l))}let d=i=>
110{c.forEach(r=>{o[r]=i}),c.length=0};for(h-=1;h>=u&&(!n||!n.hasData());h--){n&&d(n.tileID.key);let i=l.calculateScaledKey(h);if((n=a.getTileByID(i))&&n.hasData())break;let r=o[i];if(null===r)break;void 0===r?c.push(i):n=a.getTileByID(r)}return d(n?n.tileID.key:null),n&&n.hasData()?n:null}findDEMTileFor(i){return this.enabled?this._findTileCoveringTileID(i,this.sourceCache):null}prepareDrawTile(){this.renderedToTile=!0}_clearRenderCacheForTile(i,r){let a=this._tilesDirty[i];a||(a=this._tilesDirty[i]={}),a[r.key]=!0}}let aU=["fill","fillOutline","fillPattern","line","linePattern","background","backgroundPattern","hillshade","raster"],aV=["stars","rainParticle","snowParticle","fillExtrusion","fillExtrusionGroundEffect","building","buildingBloom","elevatedStructures","model","symbol"];class aj{static cacheKey(i,r,a,n){let o=[r];for(let r of(n&&o.push(n.cacheKey),a))("string"==typeof r&&r.includes(" ")||i.usedDefines.has(r))&&o.push(r);return o.join("/")}constructor(i,r,a,n,o,s,l=!1){let h=i.gl;this.program=h.createProgram(),this._context=i,this._fixedUniformsFn=o,this._pending=!0,this._precompiled=l,this.attributes={},this.configuration=n,this.name=r,this.fixedDefines=[...s],l?i._compileStats.precompiled++:i._compileStats.onDemand++;let u=`#version 300 es 111${(n?n.defines():[]).concat(s.map(i=>`#define ${i}`)).join("\n")}`,c=[u,rZ];for(let i of a.fragmentIncludes)c.push(rV[i]);c.push(a.fragmentSource);let d=c.join("\n"),p=[u,rW];for(let i of a.vertexIncludes)p.push(rV[i]);this.forceManualRenderingForInstanceIDShaders=i.forceManualRenderingForInstanceIDShaders&&a.vertexSource.includes("gl_InstanceID"),this.forceManualRenderingForInstanceIDShaders&&p.push("uniform int u_instanceID;"),p.push(a.vertexSource);let f=p.join("\n");this.forceManualRenderingForInstanceIDShaders&&(f=f.replaceAll("gl_InstanceID","u_instanceID"));let m=h.createShader(h.FRAGMENT_SHADER);if(h.isContextLost())return this.failedToCreate=!0,void(this._pending=!1);h.shaderSource(m,d),h.compileShader(m),h.attachShader(this.program,m);let _=h.createShader(h.VERTEX_SHADER);if(h.isContextLost())return this.failedToCreate=!0,void(this._pending=!1);h.shaderSource(_,f),h.compileShader(_),h.attachShader(this.program,_),h.linkProgram(this.program),this._fragmentShader=m,this._vertexShader=_,i.extParallelShaderCompile?i._pendingPrograms.add(this):this._finalize()}_finalize(){if(!this._pending)return;this._pending=!1;let r=this._context,a=r.gl;r._pendingPrograms.delete(this);let n=i.o.now(),o=a.getProgramParameter(this.program,a.LINK_STATUS),s=i.o.now()-n,l=r._compileStats;if(l.totalStallMs+=s,s>l.maxStallMs&&(l.maxStallMs=s),s>1){l.framesMissed+=Math.floor(60*s/1e3);let i=this.fixedDefines.join(",");l.stalls.push({name:`${this.name}${i?"/":""}${i}`,ms:s,timestamp:n})}if(this._fragmentShader&&(o||i.w(`Fragment shader '${this.name}': ${a.getShaderInfoLog(this._fragmentShader)}`),a.deleteShader(this._fragmentShader),this._fragmentShader=null),this._vertexShader&&(o||i.w(`Vertex shader '${this.name}': ${a.getShaderInfoLog(this._vertexShader)}`),a.deleteShader(this._vertexShader),this._vertexShader=null),!o)return i.w(`Failed to link program '${this.name}': ${a.getProgramInfoLog(this.program)}`),void(this.failedToCreate=!0);this.fixedUniforms=this._fixedUniformsFn(r),this.fixedUniformsEntries=Object.entries(this.fixedUniforms),this.binderUniforms=this.configuration?this.configuration.getUniforms(r):[],this.forceManualRenderingForInstanceIDShaders&&(this.instancingUniforms={u_instanceID:new i.b$(r)});let h=this.fixedDefines,u=this.name;(h.includes("TERRAIN")||h.includes("ELEVATED")||u.includes("symbol")||u.includes("circle"))&&(this.terrainUniforms={u_dem:new i.b$(r),u_dem_prev:new i.b$(r),u_dem_tl:new i.c2(r),u_dem_scale:new i.c1(r),u_dem_tl_prev:new i.c2(r),u_dem_scale_prev:new i.c1(r),u_dem_size:new i.c1(r),u_dem_lerp:new i.c1(r),u_exaggeration:new i.c1(r),u_depth:new i.b$(r),u_depth_size_inv:new i.c2(r),u_depth_range_unpack:new i.c2(r),u_occluder_half_size:new i.c1(r),u_occlusion_depth_offset:new i.c1(r),u_meter_to_dem:new i.c1(r),u_label_plane_matrix_inv:new i.c3(r)}),h.includes("GLOBE")&&(this.globeUniforms={u_tile_tl_up:new i.c0(r),u_tile_tr_up:new i.c0(r),u_tile_br_up:new i.c0(r),u_tile_bl_up:new i.c0(r),u_tile_up_scale:new i.c1(r)}),h.includes("FOG")&&(this.fogUniforms={u_fog_matrix:new i.c3(r),u_fog_range:new i.c2(r),u_fog_color:new i.cS(r),u_fog_horizon_blend:new i.c1(r),u_fog_vertical_limit:new i.c2(r),u_fog_temporal_offset:new i.c1(r),u_frustum_tl:new i.c0(r),u_frustum_tr:new i.c0(r),u_frustum_br:new i.c0(r),u_frustum_bl:new i.c0(r),u_globe_pos:new i.c0(r),u_globe_radius:new i.c1(r),u_globe_transition:new i.c1(r),u_is_globe:new i.b$(r),u_viewport:new i.c2(r)}),h.includes("RENDER_CUTOFF")&&(this.cutoffUniforms={u_cutoff_params:new i.cS(r)}),h.includes("LIGHTING_3D_MODE")&&(this.lightsUniforms={u_lighting_ambient_color:new i.c0(r),u_lighting_directional_dir:new i.c0(r),u_lighting_directional_color:new i.c0(r),u_ground_radiance:new i.c0(r)}),h.includes("RENDER_SHADOWS")&&(this.shadowUniforms={u_light_matrix_0:new i.c3(r),u_light_matrix_1:new i.c3(r),u_fade_range:new i.c2(r),u_shadow_normal_offset:new i.c0(r),u_shadow_intensity:new i.c1(r),u_shadow_texel_size:new i.c1(r),u_shadow_map_resolution:new i.c1(r),u_shadow_direction:new i.c0(r),u_shadow_bias:new i.c0(r),u_shadowmap_0:new i.b$(r),u_shadowmap_1:new i.b$(r)})}
111maybeFinalize(){if(!this._pending)return;let i=this._context.extParallelShaderCompile;i&&!this._context.gl.getProgramParameter(this.program,i.COMPLETION_STATUS_KHR)||this._finalize()}_ensureReady(){this._pending&&(this._finalize(),this._context.sweepPendingPrograms())}getAttributeLocation(i,r){this._ensureReady();let a=this.attributes[r];return void 0===a&&(a=this.attributes[r]=i.getAttribLocation(this.program,r)),a}setTerrainUniformValues(i,r){if(this._ensureReady(),!this.terrainUniforms)return;let a=this.terrainUniforms;if(!this.failedToCreate)for(let n in i.program.set(this.program),r)a[n]&&a[n].set(this.program,n,r[n])}setGlobeUniformValues(i,r){if(this._ensureReady(),!this.globeUniforms)return;let a=this.globeUniforms;if(!this.failedToCreate)for(let n in i.program.set(this.program),r)a[n]&&a[n].set(this.program,n,r[n])}setFogUniformValues(i,r){if(this._ensureReady(),!this.fogUniforms)return;let a=this.fogUniforms;if(!this.failedToCreate)for(let n in i.program.set(this.program),r)a[n].set(this.program,n,r[n])}setCutoffUniformValues(i,r){if(this._ensureReady(),!this.cutoffUniforms)return;let a=this.cutoffUniforms;if(!this.failedToCreate)for(let n in i.program.set(this.program),r)a[n].set(this.program,n,r[n])}setLightsUniformValues(i,r){if(this._ensureReady(),!this.lightsUniforms)return;let a=this.lightsUniforms;if(!this.failedToCreate)for(let n in i.program.set(this.program),r)a[n].set(this.program,n,r[n])}setShadowUniformValues(i,r){if(this._ensureReady(),this.failedToCreate||!this.shadowUniforms)return;let a=this.shadowUniforms;for(let n in i.program.set(this.program),r)a[n].set(this.program,n,r[n])}_drawDebugWireframe(r,a,n,o,s,l,h,u,c,d){let p=r.options.wireframe;if(!1===p.terrain&&!1===p.layers2D&&!1===p.layers3D)return;let f=r.context;if(!(!(!p.terrain||"terrainRaster"!==this.name&&"globeRaster"!==this.name)||!(!p.layers2D||r._terrain&&r._terrain.renderingToTexture||!aU.includes(this.name))||!(!p.layers3D||!aV.includes(this.name))))return;let m=f.gl,_=r.wireframeDebugCache.getLinesFromTrianglesBuffer(r.frameCounter,s,f);if(!_)return;let g=[...this.fixedDefines,"DEBUG_WIREFRAME"],y=r.getOrCreateProgram(this.name,{config:this.configuration,defines:g});y._ensureReady(),f.program.set(y.program);let x=(i,r,a)=>{if(r[i]&&a[i])for(let n in r[i])a[i][n]&&a[i][n].set(a.program,n,r[i][n].current)};c&&c.setUniforms(y.program,f,y.binderUniforms,h,{zoom:u}),x("fixedUniforms",this,y),x("terrainUniforms",this,y),x("globeUniforms",this,y),x("fogUniforms",this,y),x("lightsUniforms",this,y),x("shadowUniforms",this,y),_.bind(),f.setColorMode(new iY([m.ONE,m.ONE_MINUS_SRC_ALPHA,m.ZERO,m.ONE],i.C.transparent,[!0,!0,!0,!1])),f.setDepthMode(new iJ(a.func===m.LESS?m.LEQUAL:a.func,iJ.ReadOnly,a.range)),f.setStencilMode(iK.disabled);let v=3*l.primitiveLength*2,b=3*l.primitiveOffset*4;if(this.forceManualRenderingForInstanceIDShaders){let i=d||1;for(let r=0;r<i;++r)y.instancingUniforms.u_instanceID.set(this.program,"u_instanceID",r),m.drawElements(m.LINES,v,m.UNSIGNED_SHORT,b)}else d&&d>1?m.drawElementsInstanced(m.LINES,v,m.UNSIGNED_SHORT,b,d):m.drawElements(m.LINES,v,m.UNSIGNED_SHORT,b);s.bind(),f.program.set(this.program),f.setDepthMode(a),f.setStencilMode(n),f.setColorMode(o)}checkUniforms(i,r,a){if(this.fixedDefines.includes(r)){for(let n of Object.keys(a))if(!a[n].initialized)throw Error(`Program '${this.name}', from draw '${i}': uniform ${n} not set but required by ${r} being defined`)}}draw(i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g){let y=i.context,x=y.gl;if(this._ensureReady(),this.failedToCreate)return;for(let[i,r]of(y.program.set(this.program),y.setDepthMode(a),y.setStencilMode(n),y.setColorMode(o),y.setCullFace(s),this.fixedUniformsEntries))r.set(this.program,i,l[i]);m&&m.setUniforms(this.program,y,this.binderUniforms,p,{zoom:f});let v={[x.POINTS]:1,[x.LINES]:2,[x.TRIANGLES]:3,[x.LINE_STRIP]:1}[r];this.checkUniforms(h,"RENDER_SHADOWS",this.shadowUniforms);let b=_||[],w=m?m.getPaintVertexBuffers():[],T=r===x.TRIANGLES&&c,S=g&&g>0?1:void 0;for(let s of d.get()){let l=s.vaos||(s.vaos={});if((l[h]||(l[h]=new rQ)).bind(y,this,u,w,c,s.vertexOffset,b,S),this.forceManualRenderingForInstanceIDShaders){let i=g||1;for(let a=0;a<i;++a)this.instancingUniforms.u_instanceID.set(this.program,"u_instanceID",a),c?x.drawElements(r,s.primitiveLength*v,x.UNSIGNED_SHORT,s.primitiveOffset*v*2):x.drawArrays(r,s.vertexOffset,s.vertexLength)}else g&&g>1?x.drawElementsInstanced(r,s.primitiveLength*v,x.UNSIGNED_SHORT,s.primitiveOffset*v*2,g):c?x.drawElements(r,s.primitiveLength*v,x.UNSIGNED_SHORT,s.primitiveOffset*v*2):x.drawArrays(r,s.vertexOffset,s.vertexLength);T&&this._drawDebugWireframe(i,a,n,o,c,s,p,f,m,g)}}}
111function aG(r,a,n=0){let o=Math.pow(2,a.tileID.overscaledZ),s=a.tileSize*Math.pow(2,r.transform.tileZoom)/o,l=s*(a.tileID.canonical.x+a.tileID.wrap*o),h=s*a.tileID.canonical.y;return{u_image:0,u_texsize:a.imageAtlasTexture?a.imageAtlasTexture.size:[0,0],u_tile_units_to_pixels:1/i.az(a,1,r.transform.tileZoom),u_pixel_coord_upper:[l>>16,h>>16],u_pixel_coord_lower:[65535&l,65535&h],u_pattern_transition:n}}let aH={terrain:0,flat:1},a$=i.bd(),aq=(r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b=[0,0,1])=>{let w=a.style.light,T=w.properties.get("position"),S=[T.x,T.y,T.z],E=i.dH();"viewport"===w.properties.get("anchor")&&(i.dI(E,-a.transform.angle),i.dJ(S,S,E));let I=w.properties.get("color").toPremultipliedRenderColor(null),A=a.transform,M={u_matrix:r,u_lightpos:S,u_lightintensity:w.properties.get("intensity"),u_lightcolor:[I.r,I.g,I.b],u_vertical_gradient:+n,u_opacity:o,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:a$,u_merc_center:[0,0],u_up_dir:[0,0,0],u_height_lift:0,u_height_type:aH[d],u_base_type:aH[p],u_ao:s,u_edge_radius:l,u_width_scale:h,u_flood_light_color:g,u_vertical_scale:y,u_flood_light_intensity:x,u_ground_shadow_factor:v,u_front_cutoff_params:b};return"globe"===A.projection.name&&(M.u_tile_id=[u.canonical.x,u.canonical.y,1<<u.canonical.z],M.u_zoom_transition=f,M.u_inv_rot_matrix=_,M.u_merc_center=m,M.u_up_dir=A.projection.upVector(new i.cp(0,0,0),m[0]*i.ak,m[1]*i.ak),M.u_height_lift=c),M},aZ=(i,r,a,n,o,s)=>({u_matrix:i,u_edge_radius:r,u_width_scale:a,u_vertical_scale:n,u_height_type:aH[o],u_base_type:aH[s]}),aW=(i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x)=>{let v=aq(i,r,a,n,o,s,l,h,c,d,p,f,m,_,g,y,1,[0,0,0]),b={u_height_factor:-Math.pow(2,h.overscaledZ)/u.tileSize/8};return Object.assign(v,aG(r,u,x),b)},aX=(i,r,a)=>({u_matrix:i,u_emissive_strength:r,u_ground_shadow_factor:a}),aY=(i,r,a,n,o,s=0)=>Object.assign(aX(i,r,o),aG(a,n,s)),aJ=(i,r,a,n)=>({u_matrix:i,u_world:a,u_emissive_strength:r,u_ground_shadow_factor:n}),aK=(i,r,a,n,o,s,l=0)=>Object.assign(aY(i,r,a,n,s,l),{u_world:o}),aQ=(i,r)=>({u_matrix:i,u_depth_bias:r}),a0=(i,r)=>({u_matrix:i,u_ground_shadow_factor:r}),a1=(i,r,a,n,o)=>({u_matrix:i,u_camera_pos:[r[0],r[1],r[2]],u_depth_bias:a,u_height_scale:n,u_reset_depth:o}),a2=(i,r,a)=>({u_image:i,u_texel_size:r,u_first_pass:+!!a}),a3=(r,a,n,o,s,l,h,u)=>{let c=i.ak/l.tileSize;return{u_matrix:r,u_inv_rot_matrix:a,u_camera_to_center_distance:n.getCameraToCenterDistance(u),u_extrude_scale:[n.pixelsToGLUnits[0]/c,n.pixelsToGLUnits[1]/c],u_zoom_transition:o,u_tile_id:h,u_merc_center:s}},a5=(i,r,a,n)=>({u_matrix:i,u_inv_matrix:r,u_camera_to_center_distance:a.getCameraToCenterDistance(n),u_viewport_size:[a.width,a.height]}),a4=(i,r,a=1)=>({u_matrix:i,u_color:r,u_overlay:0,u_overlay_scale:a}),a6=i.bd(),a8=(r,a,n,o,s,l,h)=>{let u=r.transform,c="globe"===u.projection.name,d=c?i.dK(u.zoom,a.canonical)*u._pixelsPerMercatorPixel:i.az(n,1,l),p={u_matrix:a.projMatrix,u_extrude_scale:d,u_intensity:h,u_inv_rot_matrix:a6,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0]};if(c){p.u_inv_rot_matrix=o,p.u_merc_center=s,p.u_tile_id=[a.canonical.x,a.canonical.y,1<<a.canonical.z],p.u_zoom_transition=i.ai(u.zoom);let r=s[0]*i.ak,n=s[1]*i.ak;p.u_up_dir=u.projection.upVector(new i.cp(0,0,0),r,n)}return p};function a9(i,[r,a,n,o],[s,l]){if(s===l)return[0,0,0,0];let h=255*(i-1)/(i*(l-s));return[r*h,a*h,n*h,o*h]}function a7(i,r,[a,n]){return a===n?0:.5/i+(r-a)*(i-1)/(i*(n-a))}let ne=(r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w,T,S)=>({u_matrix:a,u_normalize_matrix:n,u_globe_matrix:o,u_merc_matrix:s,u_grid_matrix:l,u_tl_parent:h,u_scale_parent:p,u_fade_t:f.mix,u_opacity:f.opacity*m.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:m.paint.get("raster-brightness-min"),u_brightness_high:m.paint.get("raster-brightness-max"),u_saturation_factor:i.dM(m.paint.get("raster-saturation")),u_contrast_factor:i.dL(m.paint.get("raster-contrast")),u_spin_weights:function(i){let r=Math.sin(i*=Math.PI/180),a=Math.cos(i);return[(2*a+1)/3,(-Math.sqrt(3)*r-a+1)/3,(Math.sqrt(3)*r-a+1)/3]}(m.paint.get("raster-hue-rotate")),u_perspective_transform:_,u_raster_elevation:g,u_zoom_transition:u,u_merc_center:c,u_cutoff_params:d,u_colorization_mix:a9(i.dN,x,b),u_colorization_offset:a7(i.dN,v,b),u_color_ramp:y,u_texture_offset:[T/(w+2*T),w/(w+2*T)],u_texture_res:[w+2*T,w+2*T],u_emissive_strength:S,u_zbias_factor:function(r){var a;let n=r.terrain?r.terrain.exaggeration():1;return(r.transform.pitch<15?.07*(1-(a=i.aB((14-r.transform.zoom)/5,0,1)))+.7*a:.07)*n}(r)}),nt=i.bd(),ni=(r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w,T,S,E,I)=>{let A=s.transform,M={u_is_size_zoom_constant:+("constant"===r||"source"===r),u_is_size_feature_constant:+("constant"===r||"camera"===r),u_size_t:a?a.uSizeT:0,u_size:a?a.uSize:0,u_camera_to_center_distance:A.getCameraToCenterDistance(b),u_rotate_symbol:+n,u_aspect_ratio:A.width/A.height,u_fade_change:s.options.fadeDuration?s.symbolFadeChange:1,u_matrix:l,u_label_plane_matrix:h,u_coord_matrix:u,u_is_text:+d,u_elevation_from_sea:+!!c,u_pitch_with_map:+o,u_texsize:p,u_texsize_icon:f,u_texture:0,u_texture_icon:1,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:nt,u_merc_center:[0,0],u_camera_forward:[0,0,0],u_ecef_origin:[0,0,0],u_tile_matrix:nt,u_up_vector:[0,-1,0],u_color_adj_mat:S,u_icon_transition:E||0,u_gamma_scale:o?s.transform.getCameraToCenterDistance(b)*Math.cos(s.terrain?0:s.transform._pitch):1,u_device_pixel_ratio:i.o.devicePixelRatio,u_is_halo:1,u_scale_factor:I||1,u_ground_shadow_factor:w,u_inv_matrix:i.ba(i.bd(),h),u_normal_scale:T,u_lutTexture:10,u_zoom:A.zoom-Math.floor(A.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"globe"===b.name&&(M.u_tile_id=[_.canonical.x,_.canonical.y,1<<_.canonical.z],M.u_zoom_transition=g,M.u_inv_rot_matrix=x,M.u_merc_center=y,M.u_camera_forward=A._camera.forward(),M.u_ecef_origin=i.dO(A.globeMatrix,_.toUnwrapped()),M.u_tile_matrix=A.globeMatrix,M.u_up_vector=v),M},nr=(i,r,a,n)=>({u_matrix:i,u_emissive_strength:r,u_opacity:a,u_color:n}),na=(r,a,n,o,s,l,h,u,c)=>Object.assign(function(r,a,n,o,s,l){let{width:h,height:u}=o.imageManager.getPixelSize(a),c=Math.pow(2,l.tileID.overscaledZ
111),d=l.tileSize*Math.pow(2,o.transform.tileZoom)/c,p=d*(l.tileID.canonical.x+l.tileID.wrap*c),f=d*l.tileID.canonical.y;return{u_image:0,u_pattern_tl:n.tl,u_pattern_br:n.br,u_texsize:[h,u],u_pattern_size:n.displaySize,u_pattern_units_to_pixels:s?[o.transform.width,-1*o.transform.height]:[1/i.az(l,1,o.transform.tileZoom),1/i.az(l,1,o.transform.tileZoom)],u_pixel_coord_upper:[p>>16,f>>16],u_pixel_coord_lower:[65535&p,65535&f]}}(0,l,h,o,u,c),{u_matrix:r,u_emissive_strength:a,u_opacity:n}),nn=new Float32Array(i.bA([])),no=(r,a,n,o,s,l,h,u,c,d,p,f,m,_=[0,0,0],g,y,x,v=1)=>{let b=s.style.light,w=b.properties.get("position"),T=[-w.x,-w.y,w.z],S=i.dH();"viewport"===b.properties.get("anchor")&&(i.dI(S,-s.transform.angle),i.dJ(T,T,S));let E="MASK"===p.alphaMode,I=b.properties.get("color").toNonPremultipliedRenderColor(null),A=m.paint.get("model-ambient-occlusion-intensity"),M=m.paint.get("model-color").constantOr(i.C.white).toNonPremultipliedRenderColor(null);return M.a=m.paint.get("model-color-mix-intensity").constantOr(0),x&&(M.r=x[0],M.g=x[1],M.b=x[2],M.a=x[3]),y&&(M.r=y.color.r,M.g=y.color.g,M.b=y.color.b,M.a=y.colorMix,f=y.emissionStrength,l*=y.opacity),{u_matrix:r,u_lighting_matrix:a,u_normal_matrix:n,u_node_matrix:o||nn,u_lightpos:T,u_lightintensity:b.properties.get("intensity"),u_lightcolor:[I.r,I.g,I.b],u_camera_pos:_,u_opacity:l,u_baseTextureIsAlpha:0,u_alphaMask:+E,u_alphaCutoff:p.alphaCutoff,u_baseColorFactor:h.toNonPremultipliedRenderColor(null).toArray01(),u_emissiveFactor:u.toNonPremultipliedRenderColor(null).toArray01(),u_metallicFactor:c,u_roughnessFactor:d,u_baseColorTexture:5,u_metallicRoughnessTexture:6,u_normalTexture:7,u_occlusionTexture:8,u_emissionTexture:9,u_lutTexture:10,u_color_mix:M.toArray01(),u_aoIntensity:A,u_emissive_strength:f,u_occlusionTextureTransform:g||[0,0,0,0],u_dithered_discard_threshold:v}},ns=(i,r=nn,a=nn)=>({u_matrix:i,u_instance:r,u_node_matrix:a}),nl={fillExtrusion:r=>({u_matrix:new i.c3(r),u_lightpos:new i.c0(r),u_lightintensity:new i.c1(r),u_lightcolor:new i.c0(r),u_vertical_gradient:new i.c1(r),u_opacity:new i.c1(r),u_edge_radius:new i.c1(r),u_width_scale:new i.c1(r),u_ao:new i.c2(r),u_height_type:new i.b$(r),u_base_type:new i.b$(r),u_tile_id:new i.c0(r),u_zoom_transition:new i.c1(r),u_inv_rot_matrix:new i.c3(r),u_merc_center:new i.c2(r),u_up_dir:new i.c0(r),u_height_lift:new i.c1(r),u_flood_light_color:new i.c0(r),u_vertical_scale:new i.c1(r),u_flood_light_intensity:new i.c1(r),u_ground_shadow_factor:new i.c0(r),u_front_cutoff_params:new i.c0(r)}),fillExtrusionDepth:r=>({u_matrix:new i.c3(r),u_edge_radius:new i.c1(r),u_width_scale:new i.c1(r),u_vertical_scale:new i.c1(r),u_height_type:new i.b$(r),u_base_type:new i.b$(r)}),fillExtrusionPattern:r=>({u_matrix:new i.c3(r),u_lightpos:new i.c0(r),u_lightintensity:new i.c1(r),u_lightcolor:new i.c0(r),u_vertical_gradient:new i.c1(r),u_height_factor:new i.c1(r),u_edge_radius:new i.c1(r),u_width_scale:new i.c1(r),u_ao:new i.c2(r),u_height_type:new i.b$(r),u_base_type:new i.b$(r),u_tile_id:new i.c0(r),u_zoom_transition:new i.c1(r),u_inv_rot_matrix:new i.c3(r),u_merc_center:new i.c2(r),u_up_dir:new i.c0(r),u_height_lift:new i.c1(r),u_image:new i.b$(r),u_texsize:new i.c2(r),u_pixel_coord_upper:new i.c2(r),u_pixel_coord_lower:new i.c2(r),u_tile_units_to_pixels:new i.c1(r),u_opacity:new i.c1(r),u_pattern_transition:new i.c1(r)}),fillExtrusionGroundEffect:r=>({u_matrix:new i.c3(r),u_opacity:new i.c1(r),u_ao_pass:new i.c1(r),u_meter_to_tile:new i.c1(r),u_ao:new i.c2(r),u_flood_light_intensity:new i.c1(r),u_flood_light_color:new i.c0(r),u_attenuation:new i.c1(r),u_edge_radius:new i.c1(r),u_fb:new i.b$(r),u_fb_size:new i.c1(r),u_dynamic_offset:new i.c1(r)}),fill:r=>({u_matrix:new i.c3(r),u_emissive_strength:new i.c1(r),u_ground_shadow_factor:new i.c0(r)}),fillPattern:r=>({u_matrix:new i.c3(r),u_emissive_strength:new i.c1(r),u_image:new i.b$(r),u_texsize:new i.c2(r),u_pixel_coord_upper:new i.c2(r),u_pixel_coord_lower:new i.c2(r),u_tile_units_to_pixels:new i.c1(r),u_ground_shadow_factor:new i.c0(r),u_pattern_transition:new i.c1(r)}),fillOutline:r=>({u_matrix:new i.c3(r),u_emissive_strength:new i.c1(r),u_world:new i.c2(r),u_ground_shadow_factor:new i.c0(r)}),fillOutlinePattern:r=>({u_matrix:new i.c3(r),u_emissive_strength:new i.c1(r),u_world:new i.c2(r),u_image:new i.b$(r),u_texsize:new i.c2(r),u_pixel_coord_upper:new i.c2(r),u_pixel_coord_lower:new i.c2(r),u_tile_units_to_pixels:new i.c1(r),u_ground_shadow_factor:new i.c0(r),u_pattern_transition:new i.c1(r)}),lineBlendComposite:r=>({u_image:new i.b$(r),u_opacity:new i.c1(r),u_blend_mode:new i.b$(r),u_max_density:new i.c1(r)}),lineBlendReduce:r=>({u_image:new i.b$(r),u_texel_size:new i.c2(r),u_first_pass:new i.b$(r)}),elevatedStructuresDepth:r=>({u_matrix:new i.c3(r),u_depth_bias:new i.c1(r)}),elevatedStructures:r=>({u_matrix:new i.c3(r),u_ground_shadow_factor:new i.c0(r)}),elevatedStructuresDepthReconstruct:r=>({u_matrix:new i.c3(r),u_camera_pos:new i.c0(r),u_depth_bias:new i.c1(r),u_height_scale:new i.c1(r),u_reset_depth:new i.c1(r)}),circle:i.dR,collisionBox:r=>({u_matrix:new i.c3(r),u_inv_rot_matrix:new i.c3(r),u_camera_to_center_distance:new i.c1(r),u_extrude_scale:new i.c2(r),u_zoom_transition:new i.c1(r),u_merc_center:new i.c2(r),u_tile_id:new i.c0(r)}),collisionCircle:r=>({u_matrix:new i.c3(r),u_inv_matrix:new i.c3(r),u_camera_to_center_distance:new i.c1(r),u_viewport_size:new i.c2(r)}),debug:r=>
111({u_color:new i.dp(r),u_matrix:new i.c3(r),u_overlay:new i.b$(r),u_overlay_scale:new i.c1(r)}),clippingMask:r=>({u_matrix:new i.c3(r)}),heatmap:r=>({u_extrude_scale:new i.c1(r),u_intensity:new i.c1(r),u_matrix:new i.c3(r),u_inv_rot_matrix:new i.c3(r),u_merc_center:new i.c2(r),u_tile_id:new i.c0(r),u_zoom_transition:new i.c1(r),u_up_dir:new i.c0(r)}),heatmapTexture:r=>({u_image:new i.b$(r),u_color_ramp:new i.b$(r),u_opacity:new i.c1(r)}),hillshade:r=>({u_matrix:new i.c3(r),u_image:new i.b$(r),u_latrange:new i.c2(r),u_light:new i.c2(r),u_shadow:new i.dp(r),u_highlight:new i.dp(r),u_emissive_strength:new i.c1(r),u_accent:new i.dp(r)}),hillshadePrepare:r=>({u_matrix:new i.c3(r),u_image:new i.b$(r),u_dimension:new i.c2(r),u_zoom:new i.c1(r)}),line:i.dQ,linePattern:i.dP,raster:r=>({u_matrix:new i.c3(r),u_normalize_matrix:new i.c3(r),u_globe_matrix:new i.c3(r),u_merc_matrix:new i.c3(r),u_grid_matrix:new i.dq(r),u_tl_parent:new i.c2(r),u_scale_parent:new i.c1(r),u_fade_t:new i.c1(r),u_opacity:new i.c1(r),u_image0:new i.b$(r),u_image1:new i.b$(r),u_brightness_low:new i.c1(r),u_brightness_high:new i.c1(r),u_saturation_factor:new i.c1(r),u_contrast_factor:new i.c1(r),u_spin_weights:new i.c0(r),u_perspective_transform:new i.c2(r),u_raster_elevation:new i.c1(r),u_zoom_transition:new i.c1(r),u_merc_center:new i.c2(r),u_cutoff_params:new i.cS(r),u_colorization_mix:new i.cS(r),u_colorization_offset:new i.c1(r),u_color_ramp:new i.b$(r),u_texture_offset:new i.c2(r),u_texture_res:new i.c2(r),u_emissive_strength:new i.c1(r),u_zbias_factor:new i.c1(r)}),symbol:r=>({u_is_size_zoom_constant:new i.b$(r),u_is_size_feature_constant:new i.b$(r),u_size_t:new i.c1(r),u_size:new i.c1(r),u_camera_to_center_distance:new i.c1(r),u_rotate_symbol:new i.b$(r),u_aspect_ratio:new i.c1(r),u_fade_change:new i.c1(r),u_matrix:new i.c3(r),u_label_plane_matrix:new i.c3(r),u_coord_matrix:new i.c3(r),u_is_text:new i.b$(r),u_elevation_from_sea:new i.b$(r),u_pitch_with_map:new i.b$(r),u_texsize:new i.c2(r),u_texsize_icon:new i.c2(r),u_texture:new i.b$(r),u_texture_icon:new i.b$(r),u_gamma_scale:new i.c1(r),u_device_pixel_ratio:new i.c1(r),u_tile_id:new i.c0(r),u_zoom_transition:new i.c1(r),u_inv_rot_matrix:new i.c3(r),u_merc_center:new i.c2(r),u_camera_forward:new i.c0(r),u_tile_matrix:new i.c3(r),u_up_vector:new i.c0(r),u_ecef_origin:new i.c0(r),u_is_halo:new i.b$(r),u_icon_transition:new i.c1(r),u_color_adj_mat:new i.c3(r),u_scale_factor:new i.c1(r),u_ground_shadow_factor:new i.c0(r),u_inv_matrix:new i.c3(r),u_normal_scale:new i.c1(r),u_lutTexture:new i.b$(r),u_zoom:new i.c1(r),u_spp_fill_np_color:new i.cS(r),u_spp_halo_np_color:new i.cS(r),u_spp_opacity:new i.c1(r),u_spp_halo_width:new i.c1(r),u_spp_halo_blur:new i.c1(r),u_spp_emissive_strength:new i.c1(r),u_spp_occlusion_opacity:new i.c1(r),u_spp_z_offset:new i.c1(r),u_spp_translate_rotation:new i.c2(r)}),background:r=>({u_matrix:new i.c3(r),u_emissive_strength:new i.c1(r),u_opacity:new i.c1(r),u_color:new i.dp(r)}),backgroundPattern:r=>({u_matrix:new i.c3(r),u_emissive_strength:new i.c1(r),u_opacity:new i.c1(r),u_image:new i.b$(r),u_pattern_tl:new i.c2(r),u_pattern_br:new i.c2(r),u_texsize:new i.c2(r),u_pattern_size:new i.c2(r),u_pixel_coord_upper:new i.c2(r),u_pixel_coord_lower:new i.c2(r),u_pattern_units_to_pixels:new i.c2(r)}),terrainRaster:r=>({u_matrix:new i.c3(r),u_image0:new i.b$(r),u_image1:new i.b$(r),u_skirt_height:new i.c1(r),u_ground_shadow_factor:new i.c0(r),u_emissive_texture_available:new i.c1(r)}),skybox:r=>({u_matrix:new i.c3(r),u_sun_direction:new i.c0(r),u_cubemap:new i.b$(r),u_opacity:new i.c1(r),u_temporal_offset:new i.c1(r)}),skyboxGradient:r=>({u_matrix:new i.c3(r),u_color_ramp:new i.b$(r),u_center_direction:new i.c0(r),u_radius:new i.c1(r),u_opacity:new i.c1(r),u_temporal_offset:new i.c1(r)}),skyboxCapture:r=>({u_matrix_3f:new i.dq(r),u_sun_direction:new i.c0(r),u_sun_intensity:new i.c1(r),u_color_tint_r:new i.cS(r),u_color_tint_m:new i.cS(r),u_luminance:new i.c1(r)}),globeRaster:r=>({u_proj_matrix:new i.c3(r),u_globe_matrix:new i.c3(r),u_normalize_matrix:new i.c3(r),u_merc_matrix:new i.c3(r),u_zoom_transition:new i.c1(r),u_merc_center:new i.c2(r),u_image0:new i.b$(r),u_image1:new i.b$(r),u_grid_matrix:new i.dq(r),u_skirt_height:new i.c1(r),u_far_z_cutoff:new i.c1(r),u_frustum_tl:new i.c0(r),u_frustum_tr:new i.c0(r),u_frustum_br:new i.c0(r),u_frustum_bl:new i.c0(r),u_globe_pos:new i.c0(r),u_globe_radius:new i.c1(r),u_viewport:new i.c2(r),u_emissive_texture_available:new i.c1(r)}),globeAtmosphere:r=>({u_frustum_tl:new i.c0(r),u_frustum_tr:new i.c0(r),u_frustum_br:new i.c0(r),u_frustum_bl:new i.c0(r),u_horizon:new i.c1(r),u_transition:new i.c1(r),u_fadeout_range:new i.c1(r),u_atmosphere_fog_color:new i.cS(r),u_high_color:new i.cS(r),u_space_color:new i.cS(r),u_temporal_offset:new i.c1(r),u_horizon_angle:new i.c1(r)}),model:r=>({u_matrix:new i.c3(r),u_lighting_matrix:new i.c3(r),u_normal_matrix:new i.c3(r),u_node_matrix:new i.c3(r),u_lightpos:new i.c0(r),u_lightintensity:new i.c1(r),u_lightcolor:new i.c0(r),u_camera_pos:new i.c0(r),u_opacity:new i.c1(r),u_baseColorFactor:new i.cS(r),u_emissiveFactor:new i.cS(r),u_metallicFactor:new i.c1(r),u_roughnessFactor:new i.c1(r),u_baseTextureIsAlpha:new i.b$(r),u_alphaMask:new i.b$(r),u_alphaCutoff:new i.c1(r),u_baseColorTexture:new i.b$(r),u_metallicRoughnessTexture:new i.b$(r),u_normalTexture:new i.b$(r),u_occlusionTexture:new i.b$(r),u_emissionTexture:new i.b$(r),u_lutTexture:new i.b$(r),u_color_mix:new i.cS(r),u_aoIntensity:new i.c1(r),u_emissive_strength:new i.c1(r),u_occlusionTextureTransform:new i.cS(r),u_dithered_discard_threshold:new i.c1(r)}),modelDepth:r=>({u_matrix:new i.c3(r),u_instance:new i.c3(r),u_node_matrix:new i.c3(r)}),groundShadow:r=>({u_matrix:new i.c3(r),u_ground_shadow_factor:new i.c0(r)}),stars:r=>({u_matrix:new i.c3(r),u_up:new i.c0(r),u_right:new i.c0(r),u_intensity_multiplier:new i.c1(r)}),occlusion:r=>({u_matrix:new i.c3(r),u_anchorPos:new i.c0(r),u_screenSizePx:new i.c2(r),u_occluderSizePx:new i.c2(r),u_color:new i.cS(r)})};
111class nh{constructor(i,r,a,n){this.id=nh.uniqueIdxCounter,nh.uniqueIdxCounter++,this.context=i;let o=i.gl;this.buffer=o.createBuffer(),this.dynamicDraw=!!a,this.context.unbindVAO(),i.bindElementBuffer.set(this.buffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,r.arrayBuffer,this.dynamicDraw?o.DYNAMIC_DRAW:o.STATIC_DRAW),this.dynamicDraw||n||r.destroy()}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(i){this.id=nh.uniqueIdxCounter,nh.uniqueIdxCounter++;let r=this.context.gl;this.context.unbindVAO(),this.bind(),r.bufferSubData(r.ELEMENT_ARRAY_BUFFER,0,i.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}nh.uniqueIdxCounter=0;let nu={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class nc{constructor(i,r,a,n,o,s){this.length=r.length,this.attributes=a,this.itemSize=r.bytesPerElement,this.dynamicDraw=n,this.instanceCount=s,this.context=i;let l=i.gl;this.buffer=l.createBuffer(),i.bindVertexBuffer.set(this.buffer),l.bufferData(l.ARRAY_BUFFER,r.arrayBuffer,this.dynamicDraw?l.DYNAMIC_DRAW:l.STATIC_DRAW),this.dynamicDraw||o||r.destroy()}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(i){let r=this.context.gl;this.bind(),r.bufferSubData(r.ARRAY_BUFFER,0,i.arrayBuffer)}enableAttributes(i,r){for(let a of this.attributes){let n=r.getAttributeLocation(i,a.name);-1!==n&&i.enableVertexAttribArray(n)}}setVertexAttribPointers(i,r,a){for(let n of this.attributes){let o=r.getAttributeLocation(i,n.name);if(-1!==o){let r=n.offset+this.itemSize*(a||0);"Float32"===n.type?i.vertexAttribPointer(o,n.components,i.FLOAT,!1,this.itemSize,r):i.vertexAttribIPointer(o,n.components,i[nu[n.type]],this.itemSize,r)}}}setVertexAttribDivisor(i,r,a){for(let n=0;n<this.attributes.length;n++){let o=r.getAttributeLocation(i,this.attributes[n].name);-1!==o&&this.instanceCount&&this.instanceCount>0&&i.vertexAttribDivisor(o,a)}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class nd{constructor(i,r,a,n,o){this.context=i,this.width=r,this.height=a;let s=this.framebuffer=i.gl.createFramebuffer();n>0&&(this.colorAttachment0=new aS(i,s,0)),n>1&&(this.colorAttachment1=new aS(i,s,1)),o&&(this.depthAttachmentType=o,this.depthAttachment="renderbuffer"===o?new aE(i,s):new aI(i,s))}static createWithTexture(r,a,n,o,s){let l=r.gl;if(r.activeTexture.set(l.TEXTURE1),r.viewport.set([0,0,n,o]),a&&a.width===n&&a.height===o)return l.bindTexture(l.TEXTURE_2D,a.colorAttachment0.get()),r.bindFramebuffer.set(a.framebuffer),a;a&&a.destroy();let h=r.extRenderToTextureHalfFloat||r.extColorBufferFloat?r.gl.RGBA16F:r.gl.RGBA8,u=new i.T(r,{width:n,height:o,data:null},h);u.bind(l.LINEAR,l.CLAMP_TO_EDGE);let c=r.createFramebuffer(n,o,1,null);if(c.format=h,c.colorAttachment0.set(u.texture),s){let i=r.createRenderbuffer(l.DEPTH24_STENCIL8,n,o);r.bindFramebuffer.set(c.framebuffer),l.framebufferRenderbuffer(l.FRAMEBUFFER,l.DEPTH_STENCIL_ATTACHMENT,l.RENDERBUFFER,i),c._stencilRbo=i}return c}createColorAttachment(i,r){0===r?this.colorAttachment0=new aS(i,this.framebuffer,0):1===r&&(this.colorAttachment1=new aS(i,this.framebuffer,1))}removeColorAttachment(i,r){let a,n=this.context.gl;0===r?(a=this.colorAttachment0.get(),this.colorAttachment0=void 0):1===r&&(a=this.colorAttachment1.get(),this.colorAttachment1=void 0),a&&n.deleteTexture(a)}destroy(){let i=this.context.gl;if(this.colorAttachment0){let r=this.colorAttachment0.get();r&&i.deleteTexture(r)}if(this.colorAttachment1){let r=this.colorAttachment1.get();r&&i.deleteTexture(r)}if(this.depthAttachment&&this.depthAttachmentType)if("renderbuffer"===this.depthAttachmentType){let r=this.depthAttachment.get();r&&i.deleteRenderbuffer(r)}else{let r=this.depthAttachment.get();r&&i.deleteTexture(r)}this._stencilRbo&&(i.deleteRenderbuffer(this._stencilRbo),this._stencilRbo=null),i.deleteFramebuffer(this.framebuffer)}}class np{constructor(i,r){this.gl=i,this._pendingPrograms=new Set,this._compileStats={precompiled:0,onDemand:0,totalStallMs:0,maxStallMs:0,framesMissed:0,stalls:[]},this.clearColor=new r2(this),this.clearDepth=new r3(this),this.clearStencil=new r5(this),this.colorMask=new r4(this),this.depthMask=new r6(this),this.stencilMask=new r8(this),this.stencilFunc=new r9(this),this.stencilOp=new r7(this),this.stencilTest=new ae(this),this.depthRange=new at(this),this.depthTest=new ai(this),this.depthFunc=new ar(this),this.blend=new aa(this),this.blendFunc=new an(this),this.blendColor=new ao(this),this.blendEquation=new as(this),this.cullFace=new al(this),this.cullFaceSide=new ah(this),this.frontFace=new au(this),this.program=new ac(this),this.activeTexture=new ad(this),this.viewport=new ap(this),this.bindFramebuffer=new af(this),this.bindRenderbuffer=new am(this),this.bindTexture=new a_(this),this.bindVertexBuffer=new ag(this),this.bindElementBuffer=new ay(this),this.bindVertexArrayOES=new ax(this),this.pixelStoreUnpack=new av(this),this.pixelStoreUnpackPremultiplyAlpha=new ab(this),this.pixelStoreUnpackFlipY=new aw(this),this.options=r?Object.assign({},r):{},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=r&&!!r.forceManualRenderingForInstanceIDShaders||this.renderer&&this.renderer.includes("PowerVR"),this.disableSymbolUBO=r&&!!r.forceDisableSymbolUBO,this.options.extTextureFloatLinearForceOff||(this.extTextureFloatLinear=i.getExtension("OES_texture_float_linear")),this.extRenderToTextureHalfFloat=i.getExtension("EXT_color_buffer_half_float"),this.extColorBufferFloat=i.getExtension("EXT_color_buffer_float"),this.extTimerQuery=i.getExtension("EXT_disjoint_timer_query_webgl2"),this.maxTextureSize=i.getParameter(i.MAX_TEXTURE_SIZE),this.maxUniformBlockSize=Math.min(i.getParameter(i.MAX_UNIFORM_BLOCK_SIZE),32768),this.maxUniformBufferBindings=i.getParameter(i.MAX_UNIFORM_BUFFER_BINDINGS),this.extBlendFuncExtended=i.getExtension("WEBGL_blend_func_extended"),this.extParallelShaderCompile=i.getExtension("KHR_parallel_shader_compile")}
111sweepPendingPrograms(){if(0!==this._pendingPrograms.size)for(let i of this._pendingPrograms)i.maybeFinalize()}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.bindVertexArrayOES.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(i,r,a){return new nh(this,i,r,a)}createVertexBuffer(i,r,a,n,o){return new nc(this,i,r,a,n,o)}createRenderbuffer(i,r,a){let n=this.gl,o=n.createRenderbuffer();return this.bindRenderbuffer.set(o),n.renderbufferStorage(n.RENDERBUFFER,i,r,a),this.bindRenderbuffer.set(null),o}createFramebuffer(i,r,a,n){return new nd(this,i,r,a,n)}clear({color:i,depth:r,stencil:a,colorMask:n}){let o=this.gl,s=0;i&&(s|=o.COLOR_BUFFER_BIT,this.clearColor.set(i.toNonPremultipliedRenderColor(null)),this.colorMask.set(n||[!0,!0,!0,!0])),void 0!==r&&(s|=o.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(r),this.depthMask.set(!0)),void 0!==a&&(s|=o.STENCIL_BUFFER_BIT,this.clearStencil.set(a),this.stencilMask.set(255)),o.clear(s)}setCullFace(i){!1===i.enable?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(r){i.b9(r.blendFunction,iY.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(r.blendFunction),this.blendColor.set(r.blendColor),r.blendEquation?this.blendEquation.set(r.blendEquation):this.blendEquation.setDefault()),this.colorMask.set(r.mask)}unbindVAO(){this.bindVertexArrayOES.set(null)}}function nf(r,a,n,o,s,h,u){let c=r.context,d=c.gl,p=r.transform,f=[i.aG(p.center.lng),i.aJ(p.center.lat)],m=n.layout.get("symbol-placement"),_=n.layout.get("text-variable-anchor"),g="map"===n.layout.get("icon-rotation-alignment"),y="map"===n.layout.get("text-rotation-alignment"),x="point"!==m,v=[],b=0,w=0;for(let l=0;l<o.length;l++){let c=o[l],m=a.getTile(c),T=m.getBucket(n);if(!T)continue;let S=T.getProjection().createInversionMatrix(p,c.canonical),E=[],I=function(i,r,a){if(r.projection.name===a.projection.name)return i.projMatrix;let n=a.clone();return n.setProjection(r.projection),ic(n,r.getProjection(),i)}(c,T,p),A=!u&&g&&x,M=u&&y&&x,C=_&&T.hasTextData(),P=T.hasIconTextFit()&&C&&T.hasIconData(),D=A||M||u&&C||P,R="globe"===T.projection.name,z=R?i.ai(p.zoom):0;R&&(E.push("PROJECTION_GLOBE_VIEW"),D&&E.push("PROJECTED_POS_ON_VIEWPORT"));let L=r.getOrCreateProgram("collisionBox",{defines:E}),F=I;0===s[0]&&0===s[1]||(F=r.translatePosMatrix(I,m,s,h));let O=u?T.textCollisionBox:T.iconCollisionBox,B=T.collisionCircleArray;
111if(B.length>0){let r=i.bd(),a=F;i.cB(r,T.placementInvProjMatrix,p.glCoordMatrix),i.cB(r,r,T.placementViewportMatrix),v.push({circleArray:B,circleOffset:w,transform:a,invTransform:r,projection:T.getProjection()}),b+=B.length/4,w=b}if(!O)continue;r.terrain&&r.terrain.setupElevationDraw(m,L);let k=R?[c.canonical.x,c.canonical.y,1<<c.canonical.z]:[0,0,0];L.draw(r,d.LINES,iJ.disabled,iK.disabled,r.colorModeForRenderPass(),iQ.disabled,a3(F,S,p,z,f,m,k,T.getProjection()),n.id,O.layoutVertexBuffer,O.indexBuffer,O.segments,null,p.zoom,null,[O.collisionVertexBuffer,O.collisionVertexBufferExt])}if(!u||!v.length)return;let T=r.getOrCreateProgram("collisionCircle"),S=new i.dS;S.resize(4*b),S._trim();let E=0;for(let i of v)for(let r=0;r<i.circleArray.length/4;r++){let a=4*r,n=i.circleArray[a+0],o=i.circleArray[a+1],s=i.circleArray[a+2],l=i.circleArray[a+3];S.emplace(E++,n,o,s,l,0),S.emplace(E++,n,o,s,l,1),S.emplace(E++,n,o,s,l,2),S.emplace(E++,n,o,s,l,3)}(!l||l.length<2*b)&&(l=function(r){let a=2*r,n=new i.dF;n.resize(a),n._trim();for(let i=0;i<a;i++){let r=6*i;n.uint16[r+0]=4*i+0,n.uint16[r+1]=4*i+1,n.uint16[r+2]=4*i+2,n.uint16[r+3]=4*i+2,n.uint16[r+4]=4*i+3,n.uint16[r+5]=4*i+0}return n}(b));let I=c.createIndexBuffer(l,!0),A=c.createVertexBuffer(S,i.dT.members,!0);for(let a of v){let o=a5(a.transform,a.invTransform,p,a.projection);T.draw(r,d.TRIANGLES,iJ.disabled,iK.disabled,r.colorModeForRenderPass(),iQ.disabled,o,n.id,A,I,i.dB.simpleSegment(0,2*a.circleOffset,a.circleArray.length,a.circleArray.length/2),null,p.zoom)}A.destroy(),I.destroy()}let nm=i.bd();function n_(r){let a=r._camera.getWorldToCamera(r.worldSize,1),n=i.aC([],a,r.globeMatrix);i.ba(n,n);let o=[0,0,0],s=[0,1,0,0];return i.aD(s,s,n),o[0]=s[0],o[1]=s[1],o[2]=s[2],i.ax(o,o),o}function ng(r,a,n,o,s,l,h={}){let u=n.paint.get("icon-translate"),c=n.paint.get("text-translate"),d=n.paint.get("icon-translate-anchor"),p=n.paint.get("text-translate-anchor"),f=n.layout.get("icon-rotation-alignment"),m=n.layout.get("text-rotation-alignment"),_=n.layout.get("icon-pitch-alignment"),g=n.layout.get("text-pitch-alignment"),y=n.layout.get("icon-keep-upright"),x=n.layout.get("text-keep-upright"),v=n.paint.get("icon-color-saturation"),b=n.paint.get("icon-color-contrast"),w=n.paint.get("icon-color-brightness-min"),T=n.paint.get("icon-color-brightness-max"),S="sea"===n.layout.get("symbol-elevation-reference"),E="none"===n.layout.get("icon-image-use-theme"),I=r.context,A=I.gl,M=r.transform,C="map"===f,P="map"===m,D="map"===_,R="map"===g,z=void 0!==n.layout.get("symbol-sort-key").constantOr(1),L=!1,F=r.depthModeForSublayer(0,iJ.ReadOnly),O=new iJ(r.context.gl.LEQUAL,iJ.ReadOnly,r.depthRangeFor3D),B=[i.aG(M.center.lng),i.aJ(M.center.lat)],k=n.layout.get("text-variable-anchor"),N="globe"===M.projection.name,U=[],V=[0,-1,0];for(let s of o){let o=a.getTile(s),l=o.getBucket(n);if(!l||"mercator"===l.projection.name&&N||l.fullyClipped)continue;let f="globe"===l.projection.name,m=f?i.ai(M.zoom):0,_=id(s,l.getProjection(),M),g=M.calculatePixelsToTileUnitsMatrix(o),j=k&&l.hasTextData(),G=l.hasIconTextFit()&&j&&l.hasIconData(),H=l.getProjection().createInversionMatrix(M,s.canonical),$=(1<<o.tileID.canonical.z)*i.ak/r.transform.worldSize,q=i=>{let a=[0,0,0];if(i){let i=r.style.directionalLight,n=r.style.ambientLight;i&&n&&(a=ro(r.style,i,n))}return a},Z=i=>{if(r.context.disableSymbolUBO)return;i.push("USE_PAINT_PROPERTIES_UBO");let a=Math.floor(Math.floor(r.context.maxUniformBlockSize/4)/4);i.push(`MAX_UBO_SIZE_VEC4 ${a}u`)},W=i=>{M.depthOcclusionForSymbolsAndCircles&&(n.hasOcclusionOpacityProperties||r.terrain)&&(i.push("DEPTH_D24"),i.push("DEPTH_OCCLUSION"))},X=a=>{n.lut&&!E&&(n.lut.texture||(n.lut.texture=new i.dU(r.context,n.lut.image,[n.lut.image.height,n.lut.image.height,n.lut.image.height],I.gl.RGBA8)),I.activeTexture.set(I.gl.TEXTURE0+10),n.lut.texture&&n.lut.texture.bind(I.gl.LINEAR,I.gl.CLAMP_TO_EDGE),a.push("APPLY_LUT_ON_GPU"))},Y=()=>{let a=C&&"point"!==n.layout.get("symbol-placement"),h=[];W(h),X(h);let c=a||G,p="road"===l.elevationType,x=r.shadowRenderer,E=p&&D&&!!x&&x.enabled,P=q(E),R=p&&D&&!r.terrain?O:F,z=n.paint.get("icon-image-cross-fade");r.terrainRenderModeElevated()&&D&&h.push("PITCH_WITH_MAP_TERRAIN"),f&&(h.push("PROJECTION_GLOBE_VIEW"),c&&h.push("PROJECTED_POS_ON_VIEWPORT")),z>0&&l.hasAnySecondaryIcon&&h.push("ICON_TRANSITION"),!l.icon.zOffsetVertexBuffer||p&&r.terrain||h.push("Z_OFFSET"),0===v&&0===b&&0===w&&1===T||h.push("COLOR_ADJUSTMENT"),l.sdfIcons&&h.push("RENDER_SDF"),E&&h.push("RENDER_SHADOWS","NORMAL_OFFSET"),p&&D&&!r.terrain&&l.icon.orientationVertexBuffer&&h.push("ELEVATED_ROADS"),Z(h);let L=I.disableSymbolUBO?l.icon.programConfigurations.get(n.id):null,k=r.getOrCreateProgram("symbol",{c
111onfig:L,defines:h}),U=o.imageAtlasTexture?o.imageAtlasTexture.size:[0,0],j=l.iconSizeData,Y=i.bl(j,M.zoom),J=D||!M.isOrthographic,K=i_(_,o.tileID.canonical,D,C,M,l.getProjection(),g),Q=iy(_,o.tileID.canonical,D,C,M,l.getProjection(),g),ee=l.icon.uboBinder&&l.icon.uboBinder.cachedHeader&&256&l.icon.uboBinder.cachedHeader.dataDrivenMask?[0,0]:u,et=r.translatePosMatrix(Q,o,ee,d,!0),ei=r.translatePosMatrix(_,o,ee,d),er=c?nm:K,ea=C&&!D&&!a,en=V;(N||M.mercatorFromTransition)&&!C&&(en=n_(M));let eo=f?en:V,es=n.getColorAdjustmentMatrix(v,b,w,T),el=ni(j.kind,Y,ea,D,r,ei,er,et,S,!1,U,[0,0],0,s,m,B,H,eo,l.getProjection(),P,$,es,z,null),eh=o.imageAtlasTexture?o.imageAtlasTexture:null,eu=1!==n.layout.get("icon-size").constantOr(0)||l.iconsNeedLinear,ec=l.sdfIcons||r.options.rotating||r.options.zooming||eu||J?A.LINEAR:A.NEAREST,ed=l.sdfIcons&&0!==n.paint.get("icon-halo-width").constantOr(1),ep=r.terrain&&D&&a?i.ba(i.bd(),K):nm;if(a&&l.icon){let a=i.bx.getAtTileOffsetFunc(s,M.center.lat,M.worldSize,l.getProjection()),h=ig(_,o.tileID.canonical,D,C,M,l.getProjection(),g),u=n.layout.get("icon-size-scale-range"),c=i.aB(r.scaleFactor,u[0],u[1]);ib(l,_,r,!1,h,Q,D,y,a,s,c)}return{program:k,buffers:l.icon,uniformValues:el,atlasTexture:eh,atlasTextureIcon:null,atlasInterpolation:ec,atlasInterpolationIcon:null,isSDF:l.sdfIcons,hasHalo:ed,depthMode:R,tile:o,renderWithShadows:E,labelPlaneMatrixInv:ep}},J=()=>{let a=P&&"point"!==n.layout.get("symbol-placement"),h=[],u=a||k||G,d="road"===l.elevationType,y=r.shadowRenderer,v=d&&R&&!!y&&y.enabled,b=q(v),w=d&&R&&!r.terrain?O:F;r.terrainRenderModeElevated()&&R&&h.push("PITCH_WITH_MAP_TERRAIN"),f&&(h.push("PROJECTION_GLOBE_VIEW"),u&&h.push("PROJECTED_POS_ON_VIEWPORT")),!l.text.zOffsetVertexBuffer||d&&r.terrain||h.push("Z_OFFSET"),l.iconsInText&&h.push("RENDER_TEXT_AND_SYMBOL"),h.push("RENDER_SDF"),v&&h.push("RENDER_SHADOWS","NORMAL_OFFSET"),d&&R&&!r.terrain&&l.text.orientationVertexBuffer&&h.push("ELEVATED_ROADS"),W(h),Z(h);let T=I.disableSymbolUBO?l.text.programConfigurations.get(n.id):null,E=r.getOrCreateProgram("symbol",{config:T,defines:h}),C,D=[0,0],z=null,L=l.textSizeData;l.iconsInText&&(D=o.imageAtlasTexture?o.imageAtlasTexture.size:[0,0],z=o.imageAtlasTexture?o.imageAtlasTexture:null,C=R||!M.isOrthographic||r.options.rotating||r.options.zooming||"composite"===L.kind||"camera"===L.kind?A.LINEAR:A.NEAREST);let U=o.glyphAtlasTexture?o.glyphAtlasTexture.size:[0,0],j=n.layout.get("text-size-scale-range"),X=i.aB(r.scaleFactor,j[0],j[1]),Y=i.bl(L,M.zoom,X),J=i_(_,o.tileID.canonical,R,P,M,l.getProjection(),g),K=iy(_,o.tileID.canonical,R,P,M,l.getProjection(),g),Q=l.text.uboBinder&&l.text.uboBinder.cachedHeader&&256&l.text.uboBinder.cachedHeader.dataDrivenMask?[0,0]:c,ee=r.translatePosMatrix(K,o,Q,p,!0),et=r.translatePosMatrix(_,o,Q,p),ei=u?nm:J,er=P&&!R&&!a,ea=V;(N||M.mercatorFromTransition)&&!P&&(ea=n_(M));let en=ni(L.kind,Y,er,R,r,et,ei,ee,S,!0,U,D,0,s,m,B,H,f?ea:V,l.getProjection(),b,$,null,null,X),eo=o.glyphAtlasTexture?o.glyphAtlasTexture:null,es=A.LINEAR,el=0!==n.paint.get("text-halo-width").constantOr(1),eh=r.terrain&&R&&a?i.ba(i.bd(),J):nm;if(a&&l.text){let a=i.bx.getAtTileOffsetFunc(s,M.center.lat,M.worldSize,l.getProjection()),n=ig(_,o.tileID.canonical,R,P,M,l.getProjection(),g);ib(l,_,r,!0,n,K,R,x,a,s,X)}return{program:E,buffers:l.text,uniformValues:en,atlasTexture:eo,atlasTextureIcon:z,atlasInterpolation:es,atlasInterpolationIcon:C,isSDF:!0,hasHalo:el,depthMode:w,tile:o,renderWithShadows:v,labelPlaneMatrixInv:eh}},K=l.icon.segments.get().length,Q=l.text.segments.get().length,ee=K&&!h.onlyText?Y():null,et=Q&&!h.onlyIcons?J():null,ei=n.paint.get("icon-opacity").constantOr(1),er=n.paint.get("text-opacity").constantOr(1);if(z&&l.canOverlap){L=!0;let r=ei&&!h.onlyText?l.icon.segments.get():[],a=er&&!h.onlyIcons?l.text.segments.get():[];for(let a of r)U.push({segments:new i.dB([a]),sortKey:a.sortKey,state:ee});for(let r of a)U.push({segments:new i.dB([r]),sortKey:r.sortKey,state:et})}else h.onlyText||U.push({segments:ei?l.icon.segments:new i.dB([]),sortKey:0,state:ee}),h.onlyIcons||U.push({segments:er?l.text.segments:new i.dB([]),sortKey:0,state:et})}for(let i of(L&&U.sort((i,r)=>i.sortKey-r.sortKey),U)){let a=i.state;if(a)if(r.terrain?r.terrain.setupElevationDraw(a.tile,a.program,{useDepthForOcclusion:M.depthOcclusionForSymbolsAndCircles,labelPlaneMatr
111ixInv:a.labelPlaneMatrixInv}):r.setupDepthForOcclusion(M.depthOcclusionForSymbolsAndCircles,a.program),I.activeTexture.set(A.TEXTURE0),a.atlasTexture&&a.atlasTexture.bind(a.atlasInterpolation,A.CLAMP_TO_EDGE,!0),a.atlasTextureIcon&&(I.activeTexture.set(A.TEXTURE1),a.atlasTextureIcon&&a.atlasTextureIcon.bind(a.atlasInterpolationIcon,A.CLAMP_TO_EDGE,!0)),a.renderWithShadows&&r.shadowRenderer.setupShadows(a.tile.tileID.toUnwrapped(),a.program,"vector-tile"),r.uploadCommonLightUniforms(r.context,a.program),a.hasHalo){let o=a.uniformValues;o.u_is_halo=1,ny(a.buffers,i.segments,n,r,a.program,a.depthMode,s,l,o,2),o.u_is_halo=0}else{if(a.isSDF){let o=a.uniformValues;a.hasHalo&&(o.u_is_halo=1,ny(a.buffers,i.segments,n,r,a.program,a.depthMode,s,l,o,1)),o.u_is_halo=0}ny(a.buffers,i.segments,n,r,a.program,a.depthMode,s,l,a.uniformValues,1)}}}function ny(i,r,a,n,o,s,l,h,u,c){let d=n.context,p=d.gl,f=[i.dynamicLayoutVertexBuffer,i.opacityVertexBuffer,i.iconTransitioningVertexBuffer,i.globeExtVertexBuffer,i.zOffsetVertexBuffer,i.orientationVertexBuffer];i.featureIdBuffer&&f.push(i.featureIdBuffer);let m=i.uboBinder?null:i.programConfigurations.get(a.id);if(i.uboBinder){i.uboBinder.layer=a;let r=n.transform.zoom,o=n.style.getBrightness?n.style.getBrightness():null,s=i.uboBinder.getConstantUniformValues(r,o);u.u_spp_fill_np_color=s.fill_np_color,u.u_spp_halo_np_color=s.halo_np_color,u.u_spp_opacity=s.opacity,u.u_spp_halo_width=s.halo_width,u.u_spp_halo_blur=s.halo_blur,u.u_spp_emissive_strength=s.emissive_strength,u.u_spp_occlusion_opacity=s.occlusion_opacity,u.u_spp_z_offset=s.z_offset;let l=a.paint.get(i.uboBinder.isText?"text-translate-anchor":"icon-translate-anchor"),h=i.uboBinder.cachedHeader&&256&i.uboBinder.cachedHeader.dataDrivenMask&&"map"===l?n.transform.angle:0;u.u_spp_translate_rotation=[Math.cos(h),Math.sin(h)]}let{batchIndices:_,batchSegments:g}=i.getBatchGrouping(r);for(let r of _){let _=g.get(r);i.uboBinder&&i.uboBinder.bind(d,o.program,r),o.draw(n,p.TRIANGLES,s,l,h,iQ.disabled,u,a.id,i.layoutVertexBuffer,i.indexBuffer,_,a.paint,n.transform.zoom,m,f,c)}}function nx(r,a,n,o,s,l){let h,u=n.paint.get("line-width"),c=n.paint.get("line-emissive-strength").isConstant(),d=n.paint.get("line-emissive-strength").constantOr(0),p=n.paint.get("line-occlusion-opacity"),f=n.layout.get("line-elevation-reference"),m="meters"===n.layout.get("line-width-unit"),_=!(!r.terrain||!r.terrain.enabled),g=r.context,y=g.gl;if(n.hasElevatedBuckets&&"globe"===r.transform.projection.name)return;let x=n.layout.get("line-cross-slope"),v=s||r.colorModeForDrapableLayerRenderPass(c?d:null),b=r.terrain&&r.terrain.renderingToTexture||l,w=b?1:i.o.devicePixelRatio,T=n.paint.get("line-dasharray"),S=T.constantOr(1),E=n.layout.get("line-cap"),I=T.constantOr(null),A=E.constantOr(null),M=n.paint.get("line-pattern"),C=M.constantOr(1),P=n.paint.get("line-pattern-cross-fade"),D=M.constantOr(null),R=n.paint.get("line-opacity").constantOr(1),z=!C&&1!==R||r.depthOcclusion&&p>0&&p<1,L=n.paint.get("line-gradient"),F=C?"linePattern":"line",O=i.dX(n);if(b&&r.terrain&&r.terrain.clipOrMaskOverlapStencilType()&&(z=!1),0!==p&&r.depthOcclusion){let r=n.paint._values["line-opacity"];r&&r.value&&"constant"===r.value.kind?h=r.value:i.w(`Occlusion opacity for layer ${n.id} is supported only when line-opacity isn't data-driven.`)}"constant"!==u.value.kind&&!1===u.value.isLineProgressConstant&&O.push("VARIABLE_LINE_WIDTH"),r._debugParams.showElevationIdDebug&&O.push("DEBUG_ELEVATION_ID"),b&&("dual-source-blending"!==r.emissiveMode||c?"mrt-fallback"===r.emissiveMode&&O.push("USE_MRT1"):O.push("DUAL_SOURCE_BLENDING"));let B={},k=(o,s,l,u,c,d)=>{for(let f of o){let o,_=a.getTile(f);if(C&&!_.patternsLoaded())continue;let x=_.getBucket(n);if(!x||"none"!==x.elevationType&&!c||"none"===x.elevationType&&c)continue;r.prepareDrawTile();let T=[...s],E=r.shadowRenderer,M="road"===x.elevationType&&!!E&&E.enabled,O=[0,0,0];if(M){let i=r.style.directionalLight,a=r.style.ambientLight;i&&a&&(O=ro(r.style,i,a)),T.push("RENDER_SHADOWS","NORMAL_OFFSET")}let k=x.programConfigurations.get(n.id),N=!1;if(D&&_.imageAtlas){let r=i.dY.from(D),a=r.getPrimary().scaleSelf(w).toString(),n=_.imageAtlas.patternPositions.get(a),o=r.getSecondary(),s=o?_.imageAtlas.patternPositions.get(o.scaleSelf(w).toString()):null;N=!!n&&!!s,n&&k.setConstantPatternPositions(n,s)}P>0&&(N||k.getPatternTransitionVertexBuffer("line-pattern"))&&T.push("LINE_PATTERN_TRANSITION"),x.elevationGroundScaleVertexBuffer&&T.push("ELEVATION_GROUND_SCALE");let U=r.isTileAffectedByFog(f),V=r.getOrCreateProgram(F,{config:k,defines:T,overrideFog:U});if(!C&&I&&A&&_.lineAtlas){let i=_.lineAtlas.getDash(I,A);i&&k.setConstantPatternPositions(i)}M&&E.setupShadows(_.tileID.toUnwrapped(),V,"vector-tile");let[j,G]=n.paint.get("line-trim-offset");("round"===A||"square"===A)&&j!==G&&(0===j&&(j-=1),1===G&&(G+=1));let H=b?f.projMatrix:null,$=m?1/x.tileToMeter/i.az(_,1,r.transform.zoom):1,q=m?1/x.tileToMeter/i.az(_,1,Math.floor(r.transform.zoom)):1,Z=S?n.paint._values["line-floorwidth"]:null;if(Z&&"constant"===Z.value.kind){let i=x.zoom;i in B||(B[i]=Math.max(.01,n.widthExpression().evaluate({zoom:i}))),o=Z.value.value;let a=Math.floor(r.transform.zoom);
111Z.value.value=B[i]*Math.pow(2,a-_.tileID.overscaledZ)}let W=C?i.dZ(r,_,n,H,w,$,q,[j,G],O,P):i.d_(r,_,n,H,x.lineClipsArray.length,w,$,q,[j,G],O);if(L){let o=x.gradients[n.id],s=o.texture;if(n.gradientVersion!==o.version){let l=256;if(n.stepInterpolant){let n=a.getSource().maxzoom,o=f.canonical.z===n?Math.ceil(1<<r.transform.maxZoom-f.canonical.z):1;l=i.aB(i.d$(x.maxLineLength/i.ak*1024*o),256,g.maxTextureSize)}o.gradient=i.e0({expression:n.gradientExpression(),evaluationKey:"lineProgress",resolution:l,image:o.gradient||void 0,clips:x.lineClipsArray}),o.texture?o.texture.update(o.gradient):o.texture=new i.T(g,o.gradient,y.RGBA8),o.version=n.gradientVersion,s=o.texture}g.activeTexture.set(y.TEXTURE1),s.bind(n.stepInterpolant?y.NEAREST:y.LINEAR,y.CLAMP_TO_EDGE)}S&&(g.activeTexture.set(y.TEXTURE0),_.lineAtlasTexture&&_.lineAtlasTexture.bind(y.LINEAR,y.REPEAT),k.updatePaintBuffers()),C&&(g.activeTexture.set(y.TEXTURE0),_.imageAtlasTexture&&_.imageAtlasTexture.bind(y.LINEAR,y.CLAMP_TO_EDGE),k.updatePaintBuffers()),c&&r.terrain.setupElevationDraw(_,V),r.uploadCommonUniforms(g,V,f.toUnwrapped());let X=i=>{null!=h&&(h.value=R*p),V.draw(r,y.TRIANGLES,l,i,v,iQ.disabled,W,n.id,x.layoutVertexBuffer,x.indexBuffer,x.segments,n.paint,r.transform.zoom,k,[x.layoutVertexBuffer2,x.patternVertexBuffer,x.zOffsetVertexBuffer,x.elevationIdColVertexBuffer,x.elevationGroundScaleVertexBuffer]),null!=h&&(h.value=R)};if(z&&!c){let i=r.stencilModeForClipping(f).ref;0===i&&b&&g.clear({stencil:0});let a={func:y.EQUAL,mask:255};W.u_alpha_discard_threshold=.8,X(new iK(a,i,255,y.KEEP,y.KEEP,y.INVERT)),W.u_alpha_discard_threshold=0,X(new iK(a,i,255,y.KEEP,y.KEEP,y.KEEP))}else W.u_alpha_discard_threshold=z&&c&&d?.8:0,X(c?u:r.stencilModeForClipping(f));void 0!==o&&(Z.value.value=o)}},N=r.depthModeForSublayer(0,iJ.ReadOnly),U=new iJ(r.depthOcclusion?y.GREATER:y.LEQUAL,iJ.ReadOnly,r.depthRangeFor3D);if(n.hasNonElevatedBuckets){let a=!b&&r.terrain;0!==p&&a?i.w(`Occlusion opacity for layer ${n.id} is supported on terrain only if the layer has line-z-offset enabled.`):a?i.w(`Cannot render non-elevated lines in immediate mode when terrain is enabled. Layer: ${n.id}.`):k(o,O,N,iK.disabled,!1,!0)}if(n.hasElevatedBuckets){"hd-road-markup"===f?_||(N=U,O.push("ELEVATED_ROADS")):(O.push("ELEVATED"),N=U,void 0!==x&&O.push(x<1?"CROSS_SLOPE_HORIZONTAL":"CROSS_SLOPE_VERTICAL"),"sea"===f&&O.push("ELEVATION_REFERENCE_SEA"));let i=z?r.stencilModeFor3D():iK.disabled;r.forceTerrainMode=!0,k(o,O,N,i,!0,!0),z&&k(o,O,N,i,!0,!1),r.forceTerrainMode=!1}z&&(r.resetStencilClippingMasks(),b&&g.clear({stencil:0})),0===p||r.depthOcclusion||b||r.layersWithOcclusionOpacity.push(r.currentLayer)}class nv{destroy(){this.fbo&&(this.fbo.destroy(),this.fbo=null),this.drapeFbo&&(this.drapeFbo.destroy(),this.drapeFbo=null)}}class nb{constructor(i){this.pbo=i.createBuffer(),this.sync=null,this.fboA=null,this.fboB=null,this.maxDensity=0}destroy(i){this.sync&&(i.deleteSync(this.sync),this.sync=null),i.deleteBuffer(this.pbo),this.fboA&&(this.fboA.destroy(),this.fboA=null),this.fboB&&(this.fboB.destroy(),this.fboB=null)}}let nw={additive:{clearColor:new i.C(0,0,0,0),colorMode:iY.additiveAlphaWeighted,compositeUniformValue:1},multiply:{clearColor:new i.C(1,1,1,1),colorMode:iY.multiply,compositeUniformValue:0}};function nT(i){return!(!i.extRenderToTextureHalfFloat&&!i.extColorBufferFloat)}function nS(i,r){return"additive"===i&&nT(r)?iY.additiveAlphaWeightedUnboundedAlpha:nw[i].colorMode}function nE(i,r,a){let n=i.context,o=n.gl,s=a.width,l=a.height,h=a.colorAttachment0.get();r.lineBlendDensityReadback||(r.lineBlendDensityReadback=new nb(o));let u=r.lineBlendDensityReadback,c=0,d=!0;for(;s>1||l>1;){let a=Math.max(1,Math.floor(s/2)),p=Math.max(1,Math.floor(l/2)),f=0===c?"fboA":"fboB";u[f]=nd.createWithTexture(n,u[f],a,p,!1);let m=u[f];n.bindFramebuffer.set(m.framebuffer),n.viewport.set([0,0,a,p]),n.activeTexture.set(o.TEXTURE0),o.bindTexture(o.TEXTURE_2D,h),i.getOrCreateProgram("lineBlendReduce").draw(i,o.TRIANGLES,iJ.disabled,iK.disabled,iY.unblended,iQ.disabled,a2(0,[1/s,1/l],d),r.id,i.viewportBuffer,i.quadTriangleIndexBuffer,i.viewportSegments,r.paint,i.transform.zoom),s=a,l=p,h=m.colorAttachment0.get(),c=1-c,d=!1}let p=nT(n);u.sync&&(o.deleteSync(u.sync),u.sync=null),o.bindBuffer(o.PIXEL_PACK_BUFFER,u.pbo),o.bufferData(o.PIXEL_PACK_BUFFER,p?16:4,o.STREAM_READ),o.readPixels(0,0,1,1,o.RGBA,p?o.FLOAT:o.UNSIGNED_BYTE,0),o.bindBuffer(o.PIXEL_PACK_BUFFER,null),u.sync=o.fenceSync(o.SYNC_GPU_COMMANDS_COMPLETE,0),n.viewport.set([0,0,i.width,i.height])}function nI(i,r,a){if(!nT(i.context))return;let n=r.lineBlendDensityReadback;n&&n.sync?(function(i,r,a){if(i.sync&&r.getSyncParameter(i.sync,r.SYNC_STATUS)===r.SIGNALED){if(r.deleteSync(i.sync),i.sync=null,r.bindBuffer(r.PIXEL_PACK_BUFFER,i.pbo),nT(a)){let a=new Float32Array(4);r.getBufferSubData(r.PIXEL_PACK_BUFFER,0,a);let n=a[1];i.maxDensity=Math.max(2*(n>0?a[0]/n:0),1)}else i.maxDensity=1;r.bindBuffer(r.PIXEL_PACK_BUFFER,null)}}(n,i.context.gl,i.context),n.sync||(nE(i,r,a),i.style.map.triggerRepaint())):(nE(i,r,a),i.style.map.triggerRepaint())}function nA(i,r,a,n,o,s){let l=i.context,h=l.gl,u="additive"===a?1:r.paint.get("line-opacity").constantOr(1),c="additive"===a?function(i,r){let a=r.paint.get("line-blend-additive-clamp");if(a>0)return a;let n=r.lineBlendDensityReadback;return n&&0!==n.maxDensity?n.maxDensity:null}(0,r):1;if(null===c)return;l.bindFramebuffer.set(o),s&&l.viewport.set([0,0,s[0],s[1]]),l.activeTexture.set(h.TEXTURE0),h.bindTexture(h.TEXTURE_2D,n.colorAttachment0.get());let d=nS(a,i.context);i.getOrCreateProgram("lineBlendComposite").draw(i,h.TRIANGLES,iJ.disabled,iK.disabled,d,iQ.disabled,{u_image:0,u_opacity:u,u_blend_mode:nw[a].compositeUniformValue,u_max_density:c},r.id,i.viewportBuffer,i.quadTriangleIndexBuffer,i.viewportSegments,r.paint,i.transform.zoom)}function nM(r,a){let n=1<<r.canonical.z,o=(a.x*n-r.canonical.x-r.wrap*n)*i.ak,s=(a.y*n-r.canonical.y)*i.ak,l=i.e1(a.z,a.y);return i.cU(o,s,l)}function nC(r,a,n,o,s){var l;let h;if(!n.layout||"none"===n.layout.get("fill-elevation-reference")||0===n.paint.get("fill-opacity").constantOr(1))return;let u=r.context.gl,c=new iJ(r.context.gl.LEQUAL,iJ.ReadWrite,r.depthRangeFor3D),d=new iJ(r.context.gl.GREATER,iJ.ReadWrite,r.depthRangeFor3D),p=(l=r.transform,h=.01,l.isOrthographic&&(h=i.aj(1e-4,h,i.cP(l.pitch>=15?1:l.pitch/15))),2*h),f=r.transform.getFreeCameraOptions().position,m="elevatedStructuresDepthReconstruct",_=r.getOrCreateProgram(m,{defines:["DEPTH_RECONSTRUCTION"]}),g=r.getOrCreateProgram(m);for(let i of o){let o,l,h,m,y=a.getTile(i),x=y.getBucket(n);if(!x)continue;let v=x.elevatedStructures;if(!v||!v.depthSegments)continue;let b=x.elevationBufferData.heightRange,w=nM(i.toUnwrapped(),f),T=r.translatePosMatrix(i.projMatrix,y,n.paint.get("fill-translate"),n.paint.get("fill-translate-anchor"));if("initialize"===s){if(!b||b.min>=1||0===v.depthSegments.segments[0].primitiveLength)continue;o=a1(T,w,p,1,0),l=c,h=v.depthSegments,m=_}else if("reset"===s){if(!b||b.min>=0||0===v.maskSegments.segments[0].primitiveLength)continue;o=a1(T,w,0,0,1),l=d,h=v.maskSegments,m=_}else if("geometry"===s){if(0===v.depthSegments.segments[0].primitiveLength)continue;o=a1(T,w,p,1,0),l=c,h=v.depthSegments,m=g}m.draw(r,u.TRIANGLES,l,iK.disabled,iY.disabled,iQ.disabled,o,n.id,v.vertexBuffer,v.indexBuffer,h,n.paint,r.transform.zoom)}}function nP(r,a,n,o){let{painter:s,sourceCache:l,layer:h,coords:u,colorMode:c,elevationType:d,terrainEnabled:p,pass:f}=r,m=s.context.gl,_=h.paint.get("fill-pattern"),g=h.paint.get("fill-pattern-cross-fade"),y=_.constantOr(null),x=d;"road"!==d||a&&!p||(x="none");let v="road"===x,b=r.painter.shadowRenderer,w=v&&!!b&&b.enabled,T=new iJ(s.context.gl.LEQUAL,iJ.ReadOnly,s.depthRangeFor3D),S=[0,0,0];if(w){let i=s.style.directionalLight,r=s.style.ambientLight;i&&r&&(S=ro(s.style,i,r))}let E=_&&_.constantOr(1),I=s.terrain&&s.terrain.renderingToTexture,A=(r,f)=>{let _,x,A,M,C;for(let P of(f?(_=E&&!h.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",A=m.LINES):(_=E?"fillPattern":"fill",A=m.TRIANGLES),u)){let u=l.getTile(P);if(E&&!u.patternsLoaded())continue;let D=u.getBucket(h);if(!D)continue;let R=a?D.elevationBufferData:D.bufferData;if(R.isEmpty())continue;s.prepareDrawTile();let z=R.programConfigurations.get(h.id),L=s.isTileAffectedByFog(P),F=[],O=[];v&&(F.push("ELEVATED_ROADS"),O.push(R.elevatedLayoutVertexBuffer)),w&&F.push("RENDER_SHADOWS","NORMAL_OFFSET"),I&&n&&F.push("USE_MRT1"),E&&(s.context.activeTexture.set(m.TEXTURE0),u.imageAtlasTexture&&u.imageAtlasTexture.bind(m.LINEAR,m.CLAMP_TO_EDGE),z.updatePaintBuffers());let B=!1;if(y&&u.imageAtlas){let r=u.imageAtlas,a=i.dY.from(y),n=a.getPrimary().scaleSelf(i.o.devicePixelRatio).toString(),o=a.getSecondary(),s=r.patternPositions.get(n),l=o?r.patternPositions.get(o.scaleSelf(i.o.devicePixelRatio).toString()):null;B=!!s&&!!l,s&&z.setConstantPatternPositions(s,l)}g>0&&(B||z.getPatternTransitionVertexBuffer("fill-pattern"))&&F.push("FILL_PATTERN_TRANSITION");let k=s.getOrCreateProgram(_,{config:z,overrideFog:L,defines:F}),N=s.translatePosMatrix(P.projMatrix,u,h.paint.get("fill-translate"),h.paint.get("fill-translate-anchor"));w&&b.setupShadows(u.tileID.toUnwrapped(),k,"vector-tile");let U=h.paint.get("fill-emissive-strength");if(f){M=R.lineIndexBuffer,C=R.lineSegments;let i=s.terrain&&s.terrain.renderingToTexture?s.terrain.drapeBufferSize:[m.drawingBufferWidth,m.drawingBufferHeight];x="fillOutlinePattern"===_&&E?aK(N,U,s,u,i,S,g):aJ(N,U,i,S)}else M=R.indexBuffer,C=R.triangleSegments,x=E?aY(N,U,s,u,S,g):aX(N,U,S);s.uploadCommonUniforms(s.context,k,P.toUnwrapped());let V=r;("road"!==d||p)&&"offset"!==d||(V=T),k.draw(s,A,V,o||s.stencilModeForClipping(P),c,iQ.disabled,x,h.id,R.layoutVertexBuffer,M,C,h.paint,s.transform.zoom,z,O)}};s.renderPass===f&&A(s.depthModeForSublayer(1,"opaque"===s.renderPass?iJ.ReadWrite:iJ.ReadOnly),!1),"none"===x&&"translucent"===s.renderPass&&h.paint.get("fill-antialias")&&A(s.depthModeForSublayer(2*!!h.getPaintProperty("fill-outline-color"),iJ.ReadOnly),!0)}let nD=new Float32Array(16);function nR(r,a,n,o,s,l,h,u){let c;n.resetLayerRenderingStats(r);let d=r.context,p=d.gl,f=r.transform,m=n.paint.get("fill-extrusion-pattern"),_=n.paint.get("fill-extrusion-pattern-cross-fade"),g=m.constantOr(null),y=m.constantOr(1),x=n.paint.get("fill-extrusion-opacity"),v=r.style.enable3dLights(),b=n.paint.get(v&&!y?"fill-extrusion-ambient-occlusion-wall-radius":"fill-extrusion-ambient-occlusion-radius"),w=[n.paint.get("fill-extrusion-ambient-occlusion-intensity"),b],T=n.layout.get("fill-extrusion-edge-radius"),S=T>0&&!n.paint.get("fill-extrusion-rounded-roof"),E=S?0:T,I="globe"===f.projection.name?i.e4():0,A="globe"===f.projection.name,M=A?i.ai(f.zoom):0,C=[i.aG(f.center.lng),i.aJ(f.center.lat)],P="none"===n.paint.get("fill-extrusion-flood-light-color-use-theme").
111constantOr("default"),D=n.paint.get("fill-extrusion-flood-light-color").toNonPremultipliedRenderColor(P?null:n.lut).toArray01().slice(0,3),R=n.paint.get("fill-extrusion-flood-light-intensity"),z=n.paint.get("fill-extrusion-vertical-scale"),L=0!==n.paint.get("fill-extrusion-line-width").constantOr(1),F=n.paint.get("fill-extrusion-height-alignment"),O=n.paint.get("fill-extrusion-base-alignment"),B=i9(r,n.paint.get("fill-extrusion-cutoff-fade-range")),k=n.paint.get("fill-extrusion-front-cutoff"),N=nL(f.pitch,k,!!r.terrain),U=N[2]<1;U&&(r.maxFrontCutoffRawStart=Math.max(r.maxFrontCutoffRawStart,k[0]));let V=[];A&&V.push("PROJECTION_GLOBE_VIEW"),w[0]>0&&V.push("FAUX_AO"),S&&V.push("ZERO_ROOF_RADIUS"),u&&V.push("HAS_CENTROID"),R>0&&V.push("FLOOD_LIGHT"),B.shouldRenderCutoff&&V.push("RENDER_CUTOFF"),U&&V.push("RENDER_FRONT_CUTOFF"),L&&V.push("RENDER_WALL_MODE");let j="shadow"===r.renderPass,G=r.shadowRenderer,H=j&&!!G,$=j?iQ.disabled:iQ.backCCW;r.shadowRenderer&&(r.shadowRenderer.useNormalOffset=!0);let q=[0,0,0];if(G){let i=r.style.directionalLight,a=r.style.ambientLight;i&&a&&(q=ro(r.style,i,a)),j||(V.push("RENDER_SHADOWS"),G.useNormalOffset&&V.push("NORMAL_OFFSET")),c=V.concat(["SHADOWS_SINGLE_CASCADE"])}let Z=H?"fillExtrusionDepth":y?"fillExtrusionPattern":"fillExtrusion",W=n.getLayerRenderingStats();for(let m of o){let o,v=a.getTile(m),b=v.getBucket(n);if(!b||b.projection.name!==f.projection.name)continue;let T=!1;G&&(T=0===G.getMaxCascadeForTile(m.toUnwrapped()));let S=r.isTileAffectedByFog(m),P=b.programConfigurations.get(n.id),k=!1;if(g&&v.imageAtlas){let r=v.imageAtlas,a=i.dY.from(g),n=a.getPrimary().scaleSelf(i.o.devicePixelRatio).toString(),o=a.getSecondary(),s=r.patternPositions.get(n),l=o?r.patternPositions.get(o.scaleSelf(i.o.devicePixelRatio).toString()):null;k=!!s&&!!l,s&&P.setConstantPatternPositions(s,l)}_>0&&(k||P.getPatternTransitionVertexBuffer("fill-extrusion-pattern"))&&V.push("FILL_EXTRUSION_PATTERN_TRANSITION");let U=r.getOrCreateProgram(Z,{config:P,defines:T?c:V,overrideFog:S});if(r.terrain&&r.terrain.setupElevationDraw(v,U,{useMeterToDem:!0}),!b.centroidVertexBuffer){let i=U.getAttributeLocation(p,"a_centroid_pos");-1!==i&&p.vertexAttribI4ui(i,0,0,0,0)}!j&&G&&G.setupShadows(v.tileID.toUnwrapped(),U,"vector-tile"),y&&(r.context.activeTexture.set(p.TEXTURE0),v.imageAtlasTexture&&v.imageAtlasTexture.bind(p.LINEAR,p.CLAMP_TO_EDGE),P.updatePaintBuffers());let H=n.paint.get("fill-extrusion-vertical-gradient"),X=1/b.tileToMeter;if(j&&G){if(nN(v.tileID,b.maxHeight,r))continue;o=aZ(G.calculateShadowPassMatrixFromTile(v.tileID.toUnwrapped()),E,X,z,F,O)}else{let i=r.translatePosMatrix(m.expandedProjMatrix,v,n.paint.get("fill-extrusion-translate"),n.paint.get("fill-extrusion-translate-anchor")),a=f.projection.createInversionMatrix(f,m.canonical);o=y?aW(i,r,H,x,w,E,X,m,v,I,F,O,M,C,a,D,z,_):aq(i,r,H,x,w,E,X,m,I,F,O,M,C,a,D,z,R,q,N)}r.uploadCommonUniforms(d,U,m.toUnwrapped(),null,B);let Y=b.segments;if("mercator"===f.projection.name&&!j&&!(Y=b.getVisibleSegments(v.tileID,r.terrain,r.transform.getFrustum(0))).get().length)continue;if(W)if(j)for(let i of Y.get())W.numRenderedVerticesInShadowPass+=i.primitiveLength;else for(let i of Y.get())W.numRenderedVerticesInTransparentPass+=i.primitiveLength;let J=[];(r.terrain||u)&&J.push(b.centroidVertexBuffer),A&&J.push(b.layoutVertexExtBuffer),L&&J.push(b.wallVertexBuffer),U.draw(r,d.gl.TRIANGLES,s,l,h,$,o,n.id,b.layoutVertexBuffer,b.indexBuffer,Y,n.paint,r.transform.zoom,P,J)}r.shadowRenderer&&(r.shadowRenderer.useNormalOffset=!1)}class nz{constructor(){this.translate=[0,0],this.translateAnchor="map",this.edgeRadius=0,this.cutoffFadeRange=0}}function nL(i,r,a){if(!(r[2]<1)||a)return[0,0,1];let n=180*i/Math.PI;if(n<15)return[-.5,r[1],r[2]];let o=Math.min(1,Math.max(0,(n-15)/5)),s=o*o*(3-2*o);return[-.5*(1-s)+r[0]*s,r[1],r[2]]}function nF(r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w,T){let S=a.context,E=S.gl,I=a.transform,A=a.transform.zoom,M=[],C=r.translate,P=r.translateAnchor,D=r.edgeRadius,R=i9(a,r.cutoffFadeRange);"clear"===p?(M.push("CLEAR_SUBPASS"),w&&(M.push("CLEAR_FROM_TEXTURE"),S.activeTexture.set(E.TEXTURE0),w.bind(E.LINEAR,E.CLAMP_TO_EDGE))):"sdf"===p?M.push("SDF_SUBPASS"):"emissive"===p&&(M.push("USE_MRT1"),S.activeTexture.set(E.TEXTURE0),w.bind(E.LINEAR,E.CLAMP_TO_EDGE)),v&&M.push("HAS_CENTROID"),R.shouldRenderCutoff&&M.push("RENDER_CUTOFF");let z=(i,r,n,s,p)=>{let b=M;null!=r.groundRadiusBuffer&&(b=M.concat("HAS_ATTRIBUTE_a_flood_light_ground_radiu
111s"));let T=r.programConfigurations.get(o.id),E=a.isTileAffectedByFog(i),I=a.getOrCreateProgram("fillExtrusionGroundEffect",{config:T,defines:b,overrideFog:E}),C={u_matrix:s,u_opacity:f,u_ao_pass:+!!d,u_meter_to_tile:p,u_ao:[m,_*p],u_flood_light_intensity:g,u_flood_light_color:y,u_attenuation:x,u_edge_radius:A>=17?0:D*p,u_fb:0,u_fb_size:w?w.size[0]:0,u_dynamic_offset:1},P=[];v&&P.push(r.hiddenByLandmarkVertexBuffer),null!=r.groundRadiusBuffer&&P.push(r.groundRadiusBuffer),a.uploadCommonUniforms(S,I,i.toUnwrapped(),null,R),I.draw(a,S.gl.TRIANGLES,l,h,u,c,C,o.id,r.vertexBuffer,r.indexBuffer,n,o.paint,A,T,P)};for(let r of s){let s=n.getTile(r),l=s.getBucket(o);if(!l||l.projection.name!==I.projection.name||!l.groundEffect||l.groundEffect&&!l.groundEffect.hasData())continue;let h=l.groundEffect,u=1/l.tileToMeter;{let i=a.translatePosMatrix(r.projMatrix,s,C,P),n=h.getDefaultSegment();z(r,h,n,i,u)}if(b)for(let l=0;l<4;l++){let h,c,d=i.e2[l](r),p=n.getTile(d);if(!p)continue;let f=p.getBucket(o);if(!f||f.projection.name!==I.projection.name||!f.groundEffect||f.groundEffect&&!f.groundEffect.hasData())continue;let m=f.groundEffect;0===l?(h=[-i.ak,0,0],c=1):1===l?(h=[i.ak,0,0],c=0):2===l?(h=[0,-i.ak,0],c=3):(h=[0,i.ak,0],c=2);let _=m.regionSegments[c];_&&(i.bB(nD,r.projMatrix,h),z(r,m,_,a.translatePosMatrix(nD,s,C,P),u))}}}let nO=[1,0,0],nB=[0,1,0],nk=[0,0,1];function nN(r,a,n){let o=n.transform,s=n.shadowRenderer;if(!s)return!0;let l=n.frameCounter,h=n.currentShadowCascade,u=n._shadowCullCache;if(!u||u.frame!==l||u.cascade!==h){let r=o.tileSize*s._cascades[h].scale,a=o.scaleZoom(r),c=s.shadowDirection,d=[c[0],c[1],-c[2]],p=[nO,nB,nk,d,[d[0],0,d[2]],[0,d[1],d[2]]];n._shadowCullCache=u={frame:l,cascade:h,cameraFrustum:i.cn.fromInvProjectionMatrix(o.invProjMatrix,o.worldSize,a,"globe"!==o.projection.name),edges:p,shadowDir:d,ws:r,zoom:a}}let{cameraFrustum:c,edges:d,shadowDir:p,ws:f,zoom:m}=u,_=a;if(o.elevation){let i=o.elevation.getMinMaxForTile(r);i&&(_+=i.max)}_/=i.e8(o.center.lat,m);let g=s.computeSimplifiedTileShadowVolume(r.toUnwrapped(),_,f,p);if(!g)return!1;let{vertices:y,planes:x}=g;return 0===c.intersectsPrecise(y,x,d)||0===s.getCurrentCascadeFrustum().intersectsPrecise(y,x,d)}let nU=(i,r,a,n,o,s,l,h,u,c=[0,0,1])=>({u_matrix:i,u_normal_matrix:r,u_opacity:a,u_faux_facade_ao_intensity:n,u_camera_pos:o,u_tile_to_meter:s,u_facade_emissive_chance:l,u_flood_light_color:h,u_flood_light_intensity:u,u_front_cutoff_params:c}),nV=i=>({u_matrix:i}),nj=i=>({u_matrix:i}),nG=new Float32Array(16),nH=new Float32Array(16);function n$(r){let{painter:a,source:n,layer:o,coords:s}=r,l=r.defines,h=a.context,u="shadow"===a.renderPass,c="light-beam"===a.renderPass,d=a.shadowRenderer,p=i.e8(a.transform.center.lat,a.transform.zoom),f=i9(a,o.paint.get("building-cutoff-fade-range"));f.shouldRenderCutoff&&(l=l.concat("RENDER_CUTOFF"));let m=o.paint.get("building-front-cutoff"),_=m[2]<1&&!a.terrain,g=nL(a.transform.pitch,m,!!a.terrain);for(let y of(_&&(l=l.concat("RENDER_FRONT_CUTOFF"),a.maxFrontCutoffRawStart=Math.max(a.maxFrontCutoffRawStart,m[0])),r.floodLightIntensity>0&&(l=l.concat("FLOOD_LIGHT")),s)){let s,m,_,x=n.getTile(y),v=x.getBucket(o);if(!v)continue;d&&0===d.getMaxCascadeForTile(y.toUnwrapped())&&(l=l.concat("SHADOWS_SINGLE_CASCADE"));let b=v.programConfigurations.get(o.id),w=a.translatePosMatrix(y.expandedProjMatrix,x,[0,0],"map");if(i.cE(nG,w,[1,1,r.verticalScale]),u&&d){if(nN(x.tileID,v.maxHeight*p,a))continue;let n=d.calculateShadowPassMatrixFromTile(x.tileID.toUnwrapped());i.cE(n,n,[1,1,r.verticalScale]),_=nj(n),s=m=a.getOrCreateProgram("buildingDepth",{config:b,defines:l,overrideFog:!1})}else if(c)s=m=a.getOrCreateProgram("buildingBloom",{config:b,defines:l,overrideFog:!1}),_=nV(nG);else{let n=a.transform.calculatePosMatrix(y.toUnwrapped(),a.transform.worldSize);i.cE(n,n,[1,1,r.verticalScale]),i.cE(nH,n,[1,-1,1/p]),i.ba(nH,nH),i.e9(nH,nH);let o=a.transform.getFreeCameraOptions().position,h=1<<y.canonical.z;if(_=nU(nG,nH,r.opacity,r.facadeAOIntensity,[((o.x-y.wrap)*h-y.canonical.x)*i.ak,(o.y*h-y.canonical.y)*i.ak,o.z*h*i.ak],v.tileToMeter,r.facadeEmissiveChance,r.floodLightColor,r.floodLightIntensity,g),m=a.getOrCreateProgram("building",{config:b,defines:l,overrideFog:!1}),!0===r.depthOnly)s=m;else{let i=l.concat(["BUILDING_FAUX_FACADE","HAS_ATTRIBUTE_a_faux_facade_color_emissive"]);s=a.getOrCreateProgram("building",{config:b,defines:i,overrideFog:!1})}
111d&&(d.setupShadowsFromMatrix(n,m,!0),s!==m&&d.setupShadowsFromMatrix(n,s,!0))}let T=(i,n)=>{if(c){let s=i.entranceBloom;n.draw(a,h.gl.TRIANGLES,r.depthMode,iK.disabled,r.blendMode,iQ.disabled,_,o.id,s.layoutVertexBuffer,s.indexBuffer,s.segmentsBucket,o.paint,a.transform.zoom,b,[s.layoutAttenuationBuffer,s.layoutColorBuffer])}else{let s=i.segmentsBucket,l=[i.layoutNormalBuffer,i.layoutCentroidBuffer,i.layoutColorBuffer,i.layoutFloodLightDataBuffer];i.layoutFacadePaintBuffer&&(l=l.concat([i.layoutFacadeDataBuffer,i.layoutFacadeVerticalRangeBuffer,i.layoutFacadePaintBuffer])),n.draw(a,h.gl.TRIANGLES,r.depthMode,iK.disabled,r.blendMode,u?iQ.disabled:iQ.backCW,_,o.id,i.layoutVertexBuffer,i.indexBuffer,s,o.paint,a.transform.zoom,b,l)}};a.uploadCommonUniforms(h,m,y.toUnwrapped(),null,f),v.buildingWithoutFacade&&T(v.buildingWithoutFacade,m),v.buildingWithFacade&&(s!==m&&a.uploadCommonUniforms(h,s,y.toUnwrapped(),null,f),T(v.buildingWithFacade,s))}}function nq(r,a,n,o,s,l,h,u,c,d,p,f,m,_){let g=r.context.gl,y=r.depthModeForSublayer(1,iJ.ReadOnly,g.LEQUAL,!0),x=.1*(1-p)+3*p,v=r._showOverdrawInspector,b=new nz;v||nF(b,r,a,n,o,y,new iK({func:g.ALWAYS,mask:255},255,255,g.KEEP,g.KEEP,g.REPLACE),new iY([g.ONE,g.ONE,g.ONE,g.ONE],i.C.transparent,[!1,!1,!1,!0],g.MIN),iQ.disabled,s,"sdf",l,h,u,c,d,x,f,!1,void 0);{let p=v?iK.disabled:new iK({func:g.EQUAL,mask:255},255,255,g.KEEP,g.DECR,g.DECR),m=v?r.colorModeForRenderPass():new iY([g.ONE_MINUS_DST_ALPHA,g.DST_ALPHA,g.ONE,g.ONE],i.C.transparent,[!0,!0,!0,!0]);nF(b,r,a,n,o,y,p,m,iQ.disabled,s,"color",l,h,u,c,d,x,f,!1,void 0)}}let nZ=(i,r,a,n,o,s,l,h,u,c,d,p)=>({u_matrix:i,u_normalize_matrix:r,u_globe_matrix:a,u_merc_matrix:n,u_grid_matrix:o,u_tl_parent:s,u_scale_parent:c,u_fade_t:d.mix,u_opacity:d.opacity,u_image0:0,u_image1:1,u_raster_elevation:p,u_zoom_transition:l,u_merc_center:h,u_cutoff_params:u}),nW=(i,r,a,n,o,s,l,h,u,c)=>({u_particle_texture:i,u_particle_texture_side_len:r,u_tile_offset:a,u_velocity:n,u_color_ramp:s,u_velocity_res:o,u_max_speed:l,u_uv_offset:h,u_data_scale:[255*u[0],255*u[1]],u_data_offset:c,u_particle_pos_scale:1.1,u_particle_pos_offset:[.05,.05]}),nX=(i,r,a,n,o,s,l,h,u,c)=>({u_particle_texture:i,u_particle_texture_side_len:r,u_velocity:a,u_velocity_res:n,u_max_speed:o,u_speed_factor:s,u_reset_rate:l,u_rand_seed:Math.random(),u_uv_offset:h,u_data_scale:[255*u[0],255*u[1]],u_data_offset:c,u_particle_pos_scale:1.1,u_particle_pos_offset:[.05,.05]});var nY=i.ea([{name:"a_index",type:"Int16",components:1}]);class nJ{constructor(r,a,n,o){let s={width:n[0],height:n[1],data:null},l=r.gl;this.targetColorTexture=new i.T(r,s,l.RGBA8,{useMipmap:!1}),this.backgroundColorTexture=new i.T(r,s,l.RGBA8,{useMipmap:!1}),this.context=r,this.updateParticleTexture(a,o),this.lastInvalidatedAt=0}updateParticleTexture(r,a){if(this.particleTextureDimension===a.width)return;(this.particleTexture0||this.particleTexture1||this.particleIndexBuffer||this.particleSegment)&&(this.particleTexture0.destroy(),this.particleTexture1.destroy(),this.particleIndexBuffer.destroy(),this.particleSegment.destroy());let n=this.context.gl,o=a.width*a.height;this.particleTexture0=new i.T(this.context,a,n.RGBA8,{premultiply:!1,useMipmap:!1}),this.particleTexture1=new i.T(this.context,a,n.RGBA8,{premultiply:!1,useMipmap:!1});let s=new i.eb;s.reserve(o);for(let i=0;i<o;i++)s.emplaceBack(i);this.particleIndexBuffer=this.context.createVertexBuffer(s,nY.members,!0),this.particleSegment=i.dB.simpleSegment(0,0,this.particleIndexBuffer.length,0),this.particleTextureDimension=a.width}update(r){return!(this.lastInvalidatedAt<r&&(this.lastInvalidatedAt=i.o.now(),1))}destroy(){this.targetColorTexture.destroy(),this.backgroundColorTexture.destroy(),this.particleIndexBuffer.destroy(),this.particleTexture0.destroy(),this.particleTexture1.destroy(),this.particleSegment.destroy()}}var nK="#ifdef RASTER_ARRAY\nuniform 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;
111ivec4 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;}\n#endif\nuniform 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;}";rV["_prelude_raster_particle.glsl"]||(rV["_prelude_raster_particle.glsl"]=nK);var nQ={building:rK('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_lighting.glsl"\nconst 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;\n#ifdef RENDER_FRONT_CUTOFF\nin float v_front_cutoff_opacity;\n#endif\n#ifdef INDICATOR_CUTOUT\n#ifdef FEATURE_CUTOUT\nin vec4 v_ground_roof;\n#endif\n#endif\n#ifdef BUILDING_FAUX_FACADE\nin 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;\n#endif\n#ifdef RENDER_SHADOWS\nin highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;\n#endif\n#ifdef FLOOD_LIGHT\nin highp float v_flood_radius;in float v_has_flood_light;\n#endif\nuniform 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));}\n#ifdef BUILDING_FAUX_FACADE\nhighp 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;\n#if 0\nif (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;\n#else\nif (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;
111out_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;\n#endif\nreturn out_color;}\n#endif\nvec3 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;\n#ifdef BUILDING_FAUX_FACADE\nif (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);}\n#endif\nvec4 color=vec4(base_color,1.0);vec3 xy_flipped_normal=vec3(-normal.xy,normal.z);float shadowed_lighting_factor=0.0;\n#ifdef RENDER_SHADOWS\n#ifdef RENDER_CUTOFF\nshadowed_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;}\n#else\nshadowed_lighting_factor=shadowed_light_factor_normal(xy_flipped_normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);\n#endif\n#else\nshadowed_lighting_factor=max(0.0,dot(xy_flipped_normal,u_lighting_directional_dir));\n#endif\ncolor.rgb=apply_lighting_linear(color.rgb,xy_flipped_normal,shadowed_lighting_factor);color.rgb=linearTosRGB(color.rgb);\n#ifdef FLOOD_LIGHT\nfloat 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);\n#endif\ncolor.rgb=mix(color.rgb,linearTosRGB(base_color.rgb),emissive);\n#ifdef FOG\ncolor=fog_dither(fog_apply_premultiplied(color,v_fog_pos,v_pos.z));\n#endif\ncolor*=u_opacity;\n#ifdef INDICATOR_CUTOUT\n#ifdef FEATURE_CUTOUT\n{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;}}}\n#else\ncolor=applyCutout(color,v_pos.z);\n#endif\n#endif\n#ifdef RENDER_FRONT_CUTOFF\nif (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;}}\n#endif\n#ifdef FEATURE_CUTOUT\ncolor=apply_feature_cutout(color,gl_FragCoord,get_cutout_factors(gl_FragCoord).x
vendor: 5,504 bytes, line 111
111);\n#endif\nglFragColor=color;\n#ifdef DEBUG_SHOW_NORMALS\ncolor.rgb=xy_flipped_normal*0.5+vec3(0.5,0.5,0.5);color.a=1.0;glFragColor=color;\n#endif\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\nin vec3 a_pos_3f;in ivec4 a_normal_3;in ivec4 a_centroid_3;\n#ifdef FLOOD_LIGHT\nin int a_flood_light_wall_radius_1i16;\n#endif\n#ifdef BUILDING_FAUX_FACADE\nin uvec4 a_faux_facade_data;in uvec2 a_faux_facade_vertical_range;\n#endif\nuniform mat4 u_matrix;uniform mat4 u_normal_matrix;uniform highp float u_tile_to_meter;\n#ifdef RENDER_FRONT_CUTOFF\nuniform vec3 u_front_cutoff_params;out float v_front_cutoff_opacity;\n#endif\n#ifdef INDICATOR_CUTOUT\n#ifdef FEATURE_CUTOUT\nout vec4 v_ground_roof;\n#endif\n#endif\nout vec4 v_color;out vec3 v_normal;out highp vec3 v_pos;\n#ifdef BUILDING_FAUX_FACADE\nout 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;\n#endif\n#ifdef RENDER_SHADOWS\nuniform 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;\n#endif\n#ifdef FLOOD_LIGHT\nout highp float v_flood_radius;out float v_has_flood_light;\n#endif\nconst 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));}\n#ifdef BUILDING_FAUX_FACADE\nmat3 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);}\n#endif\n#pragma mapbox: define-attribute-vertex-shader-only highp uvec2 part_color_emissive\n#pragma mapbox: define-attribute-vertex-shader-only highp uvec2 faux_facade_color_emissive\nvoid main() {\n#pragma mapbox: initialize-attribute-custom highp uvec2 part_color_emissive\n#pragma mapbox: initialize-attribute-custom highp uvec2 faux_facade_color_emissive\n#ifdef FLOOD_LIGHT\nv_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);\n#endif\nvec4 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);\n#ifdef BUILDING_FAUX_FACADE\nvec4 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;}\n#endif\nv_pos=a_pos_3f;\n#if defined(RENDER_CUTOFF) || defined(RENDER_FRONT_CUTOFF)\nfloat halfSpanX=spanBits.x*10.0/u_tile_to_meter;float halfSpanY=spanBits.y*10.0/u_tile_to_meter;vec2 screenUpInTile=vec2(u_matrix[0][1],u_matrix[1][1]);vec2 spanOffset=vec2(halfSpanX,halfSpanY)*sign(screenUpInTile);vec2 cutoff_highestCorner=centroid_xy+spanOffset;vec2 cutoff_lowestCorner=centroid_xy-spanOffset;\n#endif\n#if defined(RENDER_CUTOFF) || defined(RENDER_FRONT_CUTOFF)\nvec4 ground=u_matrix*vec4(centroid_xy,0.0,1.0);\n#endif\n#ifdef RENDER_CUTOFF\nv_cutoff_opacity=cutoff_opacity(u_cutoff_params,ground.z);hidden=float(v_cutoff_opacity==0.0);v_pos.z*=v_cutoff_opacity;\n#endif\n#ifdef RENDER_SHADOWS\nvec3 shadow_pos=v_pos;\n#ifdef NORMAL_OFFSET\nvec3 offset=shadow_normal_offset_model(v_normal);shadow_pos+=offset*shadow_normal_offset_multiplier0();\n#endif\nv_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);\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(v_pos);\n#endif\n#ifdef RENDER_FRONT_CUTOFF\nv_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);}\n#endif\ngl_Position=mix(u_matrix*vec4(v_pos,1),AWAY,hidden);gl_Position.z-=depth_offset*gl_Position.w;\n#ifdef INDICATOR_CUTOUT\n#ifdef FEATURE_CUTOUT\nvec4 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);\n#endif\n#endif\n}'),buildingBloom:
111rK("in vec4 v_color_emissive;\n#pragma mapbox: define-attribute highp vec4 bloom_attenuation\n#pragma mapbox: initialize-attribute highp vec4 bloom_attenuation\nfloat saturate(float val) {return clamp(val,0.0,1.0);}void main() {float emission=v_color_emissive.a;float opacity=1.0;\n#ifdef HAS_ATTRIBUTE_a_bloom_attenuation\nfloat 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);\n#endif\n#ifdef RENDER_CUTOFF\nopacity*=v_cutoff_opacity;\n#endif\nglFragColor=vec4(v_color_emissive.rgb,1.0)*opacity;}","in vec3 a_pos_3f;\n#pragma mapbox: define-attribute-vertex-shader-only highp uvec2 part_color_emissive\n#pragma mapbox: define-attribute highp vec4 bloom_attenuation\nout vec4 v_color_emissive;uniform mat4 u_matrix;vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}void main() {\n#pragma mapbox: initialize-attribute-custom highp uvec2 part_color_emissive\n#pragma mapbox: initialize-attribute highp vec4 bloom_attenuation\n#ifdef HAS_ATTRIBUTE_a_part_color_emissive\nvec4 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);\n#else\nv_color_emissive=vec4(1.0);\n#endif\ngl_Position=u_matrix*vec4(a_pos_3f,1.0);\n#ifdef RENDER_CUTOFF\nv_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z);\n#endif\n}"),buildingDepth:rK("void main() {}","in vec3 a_pos_3f;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos_3f,1.0);}"),rasterParticle:rK('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\nuniform 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;\n#ifdef LIGHTING_3D_MODE\nout_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),1.0).rgb;\n#endif\n#ifdef FOG\nhighp 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));\n#endif\nglFragColor=vec4(out_color*color.a,color.a);\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\nuniform 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;\n#define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8\nin ivec2 a_pos;in uvec2 a_texture_pos;out vec2 v_pos0;out vec2 v_pos1;void main() {float w=1.0;vec2 uv;\n#ifdef PROJECTION_GLOBE_VIEW\nvec3 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;\n#ifdef FOG\nv_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);\n#endif\n#else\nuv=vec2(a_texture_pos)/8192.0;
111gl_Position=u_matrix*vec4(vec2(a_pos)*w,u_raster_elevation*w,w);\n#ifdef FOG\nv_fog_pos=fog_position(vec2(a_pos));\n#endif\n#endif\nv_pos0=uv;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}'),rasterParticleDraw:rK("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"\nin 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(\nmod(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:rK("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:rK('#include "_prelude_raster_particle.glsl"\nuniform 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(\nlinearstep(vec2(-u_particle_pos_offset),vec2(0),pos)*linearstep(vec2(1.0+u_particle_pos_offset),vec2(1),pos),vec2(4)\n);highp vec2 per_frame_persist=pow(persist_rate,abs(dp)/u_particle_pos_offset);highp float drop_rate=1.0-per_frame_persist.x*per_frame_persist.y;drop_rate=any(greaterThanEqual(abs(pos-0.5),vec2(0.5+u_particle_pos_offset))) ? 1.0 : drop_rate;highp float drop=step(1.0-drop_rate-u_reset_rate,rand(seed));highp vec2 next_pos=mix(pos,random_pos,drop);glFragColor=pack_pos_to_rgba(next_pos);}',"in ivec2 a_pos;out vec2 v_tex_coord;void main() {v_tex_coord=0.5*vec2(a_pos+ivec2(1));gl_Position=vec4(a_pos,0.0,1.0);}"),snowParticle:rK("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;}","\nin 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; \nuniform float u_velocity;uniform vec3 u_direction;uniform float u_horizontalOscillationRadius; \nuniform float u_horizontalOscillationRate; \nuniform 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);
111simPosLocal.xy+=horizontalOscillationRadius*vec2(cos(horizontalOscillationAngle),sin(horizontalOscillationAngle));vec3 simPos=localX*simPosLocal.x+\nlocalY*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:rK("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;}","\nin 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; \nuniform float u_velocity; \nuniform vec2 u_rainDropletSize;uniform vec3 u_rainDirection;out highp vec2 uv;out highp float particleRandomValue;void main() {vec3 pos=a_pos_3f;float halfBoxSize=0.5*u_boxSize;pos*=halfBoxSize; \npos+=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+\nlocalY*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:rK("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);}")};rK(nK,"");
111let n0=i.ea([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_rainParticleData",components:4}]),n1=i.ea([{type:"Float32",name:"a_pos_2f",components:2}]);class n2{destroy(){this.vignetteVx&&this.vignetteVx.destroy(),this.vignetteIdx&&this.vignetteIdx.destroy()}draw(r,a){var n;let o=r.getOrCreateProgram("vignette");if(!this.vignetteVx||!this.vignetteIdx){let a=new i.ee,n=new i.dF;a.emplaceBack(-1,-1),a.emplaceBack(1,-1),a.emplaceBack(1,1),a.emplaceBack(-1,1),n.emplaceBack(0,1,2),n.emplaceBack(0,2,3),this.vignetteVx=r.context.createVertexBuffer(a,n1.members),this.vignetteIdx=r.context.createIndexBuffer(n)}let s=i.dB.simpleSegment(0,0,4,6);if(this.vignetteVx&&this.vignetteIdx){r.uploadCommonUniforms(r.context,o);let i={u_vignetteShape:(n={vignetteShape:[a.start,a.range,Math.pow(10,a.fadePower)],vignetteColor:[a.color.r,a.color.g,a.color.b,a.color.a*a.strength]}).vignetteShape,u_vignetteColor:n.vignetteColor};o.draw(r,r.context.gl.TRIANGLES,iJ.disabled,iK.disabled,iY.alphaBlended,iQ.disabled,i,"vignette",this.vignetteVx,this.vignetteIdx,s)}}}class n3{constructor(){this._accumulatedOffsetX=0,this._accumulatedOffsetY=0,this._accumulatedElevation=0}update(r,a){let n=r.getFreeCameraOptions().position,o=n.toAltitude(),s=n.toLngLat(),l=i.am(s.lng),h=i.am(s.lat),u=r.pixelsPerMeter/a,c=l*i.eg,d=i.eg*Math.log(Math.tan(Math.PI/4+h/2));if(void 0===this._offsetXPrev)this._offsetXPrev=0,this._offsetYPrev=0,this._elevationPrev=0,this._accumulatedOffsetX=0,this._accumulatedOffsetY=0,this._accumulatedElevation=0;else{let i=-this._offsetYPrev+d,r=-this._elevationPrev+o;this._accumulatedOffsetX+=(-this._offsetXPrev+c)*u,this._accumulatedOffsetY+=i*u,this._accumulatedElevation+=r*u,this._offsetXPrev=c,this._offsetYPrev=d,this._elevationPrev=o}}getPosition(){return[this._accumulatedOffsetX,this._accumulatedOffsetY,this._accumulatedElevation]}}function n5(i,r){return[-(i[0]-Math.floor(i[0]/r)*r),-(i[1]-Math.floor(i[1]/r)*r),-(i[2]-Math.floor(i[2]/r)*r)]}function n4(r){let a=i.ef(0x134104da55e),n=[];for(let o=0;o<r;++o){let r=2*a()-1,o=2*a()-1,s=2*a()-1;n.push(i.cU(r,o,s))}return n}function n6(r,a,n,o,s){let l=i.aB((s-n)/(o-n),0,1);return(1-l)*r+l*a}class n8{constructor(i){this._movement=new n3,this._accumulatedTimeFromStart=0,this._prevTime=Date.now()/1e3,this._vignette=new n2,this._ppmScaleFactor=i}destroy(){this.particlesVx&&this.particlesVx.destroy(),this.particlesIdx&&this.particlesIdx.destroy(),this._vignette&&this._vignette.destroy()}updateOnRender(r,a){let n=r.transform;this._movement.update(n,this._ppmScaleFactor);let o=n.starsProjMatrix,s=i.bP([]);i.bR(s,s,i.am(90)-n._pitch),i.bQ(s,s,-n.angle);let l=i.bV(new Float32Array(16),s),h=new Float32Array([1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1]),u=i.e9([],h),c=i.aC([],u,l),d=Date.now()/1e3;return this._accumulatedTimeFromStart+=(d-this._prevTime)*a,this._prevTime=d,{projectionMatrix:o,modelviewMatrix:c}}}let n9=i.ea([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_snowParticleData",components:4},{type:"Float32",name:"a_snowParticleDataHorizontalOscillation",components:2}]),n7=function(i,r,a,n){i.currentLayer<i.firstLightBeamLayer&&(i.firstLightBeamLayer=i.currentLayer);let o=a.paint.get("building-ambient-occlusion-ground-intensity"),s=a.paint.get("building-ambient-occlusion-ground-radius"),l=a.paint.get("building-ambient-occlusion-ground-attenuation"),h=a.paint.get("building-opacity");if(h<=0)return;let u=o>0&&s>0,c=!0,d=a.paint.get("building-vertical-scale");if(d<=0)return;i.shadowRenderer||(c=!1);let p=i.conflationActive&&i.style.isLayerClipped(a,r.getSource()),f=i.style.order.indexOf(a.fqid);if(function(i,r,a,n,o,s){for(let l of s){let s=r.getTile(l).getBucket(a);s&&(o&&s.updateReplacement(l,i.replacementSource,n),s.uploadUpdatedIndexBuffer(i.context))}}(i,r,a,f,p,n),function(i,r,a,n){for(let o of n){let n=r.getTile(o).getBucket(a);n&&n.needsEvaluation()&&n.uploadUpdatedColorBuffer(i.context)}}(i,r,a,n),a.resetLayerRenderingStats(i),i.shadowRenderer&&(i.shadowRenderer.useNormalOffset=!0),"shadow"===i.renderPass&&i.shadowRenderer){let o=i.shadowRenderer.getShadowPassDepthMode();n$({painter:i,source:r,layer:a,coords:n,defines:[],blendMode:iY.disabled,depthMode:o,opacity:h,verticalScale:d,facadeEmissiveChance:0,facadeAOIntensity:0,floodLightIntensity:0,floodLightColor:[0,0,0]})}else if("translucent"===i.renderPass){let f=["HAS_ATTRIBUTE_a_part_color_emissive","LIGHTING_3D_MODE"];c&&(f=f.concat("RENDER_SHADOWS")),i.shadowRenderer&&i.shadowRenderer.useNormalOffset&&(f=f.concat("NORMAL_OFFSET"));let m=a.paint.get("building-facade-emissive-chance"),_=a.paint.get("building-ambient-occlusion-intensity"),g=a.paint.get("building-flood-light-intensity"),y="none"===a.paint.get("building-flood-light-color-use-theme").
111constantOr("default"),x=a.paint.get("building-flood-light-color").toNonPremultipliedRenderColor(y?null:a.lut).toArray01().slice(0,3),v=a.paint.get("building-flood-light-ground-attenuation"),b=g>0,w=new iJ(i.context.gl.LEQUAL,iJ.ReadWrite,i.depthRangeFor3D);h<1&&n$({painter:i,source:r,layer:a,coords:n,defines:f,blendMode:iY.disabled,depthMode:w,opacity:h,verticalScale:d,facadeEmissiveChance:m,facadeAOIntensity:_,floodLightIntensity:g,floodLightColor:x,depthOnly:!0});let T=i.colorModeForRenderPass();n$({painter:i,source:r,layer:a,coords:n,defines:f,blendMode:T,depthMode:w,opacity:h,verticalScale:d,facadeEmissiveChance:m,facadeAOIntensity:_,floodLightIntensity:g,floodLightColor:x});let S=a.paint.get("building-front-cutoff");nL(i.transform.pitch,S,!!i.terrain),u&&nq(i,r,a,n,!0,h,o,s,g,x,l,p),b&&nq(i,r,a,n,!1,h,o,s,g,x,v,p)}else if("light-beam"===i.renderPass){let o=new iJ(i.context.gl.LEQUAL,iJ.ReadOnly,i.depthRangeFor3D);n$({painter:i,source:r,layer:a,coords:n,defines:["HAS_ATTRIBUTE_a_part_color_emissive","HAS_ATTRIBUTE_a_bloom_attenuation"],blendMode:iY.alphaBlended,depthMode:o,opacity:h,verticalScale:d,facadeEmissiveChance:0,facadeAOIntensity:0,floodLightIntensity:0,floodLightColor:[0,0,0]})}i.shadowRenderer&&(i.shadowRenderer.useNormalOffset=!1),i.resetStencilClippingMasks()},oe=function(r,a,n,o,s,l){"offscreen"===r.renderPass&&function(r,a,n,o){if(!o.length)return;let s=r.context,l=s.gl,h=a.getSource();if(!(h instanceof tQ))return;let u=Math.ceil(Math.sqrt(n.paint.get("raster-particle-count"))),c=n.particlePositionRGBAImage;if(!c||c.width!==u){let r=function(r){let a=r*r,n=new Uint8Array(4*a);for(let r=0;r<a;r++){let a=.9090909090909091*(i.ed(2*r+0)+.05),o=.9090909090909091*(i.ed(2*r+1)+.05),s=255*a%1,l=255*o%1,h=o-l/255;n[4*r+0]=255*(a-s/255),n[4*r+1]=255*s,n[4*r+2]=255*h,n[4*r+3]=255*l}return n}(u);c=n.particlePositionRGBAImage=new i.q({width:u,height:u},r)}let d=n.particleFramebuffer;d?d.width!==u&&(d.destroy(),d=n.particleFramebuffer=s.createFramebuffer(u,u,1,null)):d=n.particleFramebuffer=s.createFramebuffer(u,u,1,null);let p=[];for(let r of o){let o=a.getTile(r);if(!(o instanceof t4))continue;let l=function(r,a,n){if(!r)return null;let o=a.getTextureDescriptor(r,n,!0);if(!o)return null;let{texture:s,mix:l,offset:h,tileSize:u,buffer:c,format:d}=o;if(!s||!d)return null;let p=!1;return"uint32"===d&&(p=!0,l[3]=0,l=a9(i.ec,l,[0,n.paint.get("raster-particle-max-speed")]),h=a7(i.ec,h,[0,n.paint.get("raster-particle-max-speed")])),{texture:s,textureOffset:[c/(u+2*c),u/(u+2*c)],tileSize:u,scalarData:p,scale:l,offset:h,defines:["RASTER_ARRAY",{uint8:"DATA_FORMAT_UINT8",uint16:"DATA_FORMAT_UINT16",uint32:"DATA_FORMAT_UINT32"}[d]]}}(o,h,n);if(!l)continue;let d=[o.tileSize,o.tileSize],f=n.tileFramebuffer;f||(f=n.tileFramebuffer=s.createFramebuffer(d[0],d[1],1,null));let m=o.rasterParticleState;m||(m=o.rasterParticleState=new nJ(s,r,d,c));let _=m.update(n.lastInvalidatedAt);m.particleTextureDimension!==u&&m.updateParticleTexture(r,c);let g=m.targetColorTexture;m.targetColorTexture=m.backgroundColorTexture,m.backgroundColorTexture=g;let y=m.particleTexture0;m.particleTexture0=m.particleTexture1,m.particleTexture1=y,p.push([r,l,m,_])}if(0===p.length)return;let f=i.o.now(),m=n.previousDrawTimestamp?.001*(f-n.previousDrawTimestamp):.0167;if(n.previousDrawTimestamp=f,n.hasColorMap()){s.activeTexture.set(l.TEXTURE0+2);let r=n.colorRampTexture;r||(r=n.colorRampTexture=new i.T(s,n.colorRamp,l.RGBA8)),r.bind(l.LINEAR,l.CLAMP_TO_EDGE)}s.bindFramebuffer.set(n.tileFramebuffer.framebuffer),function(r,a,n){var o;let s=r.context,l=s.gl,h=a.tileFramebuffer;s.activeTexture.set(l.TEXTURE0);let u={u_texture:0,u_opacity:1.05*(o=a.paint.get("raster-particle-fade-opacity-factor"))/(o+.05)},c=r.getOrCreateProgram("rasterParticleTexture",{defines:[],overrideFog:!1});for(let o of n){let[,,n,d]=o;h.colorAttachment0.set(n.targetColorTexture.texture),s.viewport.set([0,0,h.width,h.height]),s.clear({color:i.C.transparent}),d&&(n.backgroundColorTexture.bind(l.NEAREST,l.CLAMP_TO_EDGE),c.draw(r,l.TRIANGLES,iJ.disabled,iK.disabled,iY.alphaBlended,iQ.disabled,u,a.id,r.viewportBuffer,r.quadTriangleIndexBuffer,r.viewportSegments))}}(r,n,p),function(r,a,n,o){let s=r.context,l=s.gl,h=n.tileFramebuffer,u="globe"===r.transform.projection.name,c=n.paint.get("raster-particle-max-speed");for(let d of o){let[o,p,f]=d;s.activeTexture.set(l.TEXTURE0+0),p.texture.bind(l.LINEAR,l.CLAMP_TO_EDGE),h.colorAttachment0.set(f.targetColorTexture.texture);let m=r.getOrCreateProgram("rasterParticleDraw",{defines:p.defines,overrideFog:!1});s.activeTexture.set(l.TEXTURE0+1);let _=p.scalarData?[]:[0,1,2,3].map(r=>i.e2[r](o));_.push(o);let g=o.canonical.x,y=o.canonical.y;for(let i of _){let s=a.getTile(u?i.wrapped():i);if(!s)continue;let h=s.rasterParticleState;if(!h)continue;let d=i.canonical.x+(1<<i.canonical.z)*(i.wrap-o.wrap),f=i.canonical.y;h.particleTexture0.bind(l.NEAREST,l.CLAMP_TO_EDGE);let _=nW(1,h.particleTexture0.size[0],[d-g,f-y],0,p.texture.size,2,c,p.textureOffset,p.scale,p.offset);m.draw(r,l.POINTS,iJ.disabled,iK.disabled,iY.alphaBlended,iQ.disabled,_,n.id,h.particleIndexBuffer,void 0,h.particleSegment)}}}(r,a,n,p),s.bindFramebuffer.set(n.particleFramebuffer.framebuffer),function(r,a,n,o){let s=r.context,l=s.gl,h=a.paint.get("raster-particle-max-speed"),u=o*a.paint.get("raster-particle-speed-factor")*.15,c=Math.pow(.01+ +a.paint.get("raster-particle-reset-rate-factor"),6),d=a.particleFramebuffer;
111for(let o of(s.viewport.set([0,0,d.width,d.height]),n)){let[,n,p]=o;s.activeTexture.set(l.TEXTURE0+0),n.texture.bind(l.LINEAR,l.CLAMP_TO_EDGE),s.activeTexture.set(l.TEXTURE0+1);let f=p.particleTexture0;f.bind(l.NEAREST,l.CLAMP_TO_EDGE);let m=nX(1,f.size[0],0,n.texture.size,h,u,c,n.textureOffset,n.scale,n.offset);d.colorAttachment0.set(p.particleTexture1.texture),s.clear({color:i.C.transparent}),r.getOrCreateProgram("rasterParticleUpdate",{defines:n.defines}).draw(r,l.TRIANGLES,iJ.disabled,iK.disabled,iY.unblended,iQ.disabled,m,a.id,r.viewportBuffer,r.quadTriangleIndexBuffer,r.viewportSegments)}}(r,n,p,m)}(r,a,n,o),"translucent"===r.renderPass&&(function(r,a,n,o){let s=r.context,l=s.gl,h=a.getSource().tileSize,u=5*(1-i.ag(i.cx,i.cx+1,r.transform.zoom))*h+n.paint.get("raster-particle-elevation"),c=!r.options.moving,d="globe"===r.transform.projection.name;if(!o.length)return;let[p,f]=r.stencilConfigForOverlap(o),m=[];d&&m.push("PROJECTION_GLOBE_VIEW");let _=r.stencilModeFor3D();for(let o of f){let h,f,g,y,x,v,b,w=o.toUnwrapped(),T=a.getTile(o);if(!T.rasterParticleState)continue;let S=T.rasterParticleState;T.registerFadeDuration(100);let E=a.findLoadedParent(o,0),I=aF(T,E,a,r.transform,100);r.terrain&&r.terrain.prepareDrawTile(),s.activeTexture.set(l.TEXTURE0),S.targetColorTexture.bind(l.LINEAR,l.CLAMP_TO_EDGE),s.activeTexture.set(l.TEXTURE1),E&&E.rasterParticleState?(E.rasterParticleState.targetColorTexture.bind(l.LINEAR,l.CLAMP_TO_EDGE),h=Math.pow(2,E.tileID.overscaledZ-T.tileID.overscaledZ),f=[T.tileID.canonical.x*h%1,T.tileID.canonical.y*h%1]):S.targetColorTexture.bind(l.LINEAR,l.CLAMP_TO_EDGE);let A=d?r.transform.expandedFarZProjMatrix:r.transform.calculateProjMatrix(w,c),M=r.transform,C=function(i){let r=i._nearZ,a=i.projection.farthestPixelDistance(i),n=a-r,o=.2*i.height,s=r+o;return[r,a,(s-o-r)/n,(s-r)/n]}(M),P=i.du(o.canonical),D=i.dv(P.getCenter().lat);d?(g=Float32Array.from(i.dx(i.dy(o.canonical))),y=Float32Array.from(M.globeMatrix),x=Float32Array.from(i.dt(M)),v=[i.aG(M.center.lng),i.aJ(M.center.lat)],b=Float32Array.from(i.dw(o.canonical,P,D,M.worldSize/M._pixelsPerMercatorPixel))):(g=new Float32Array(16),y=new Float32Array(9),x=new Float32Array(16),v=[0,0],b=new Float32Array(9));let R=nZ(A,g,y,x,b,f||[0,0],i.ai(r.transform.zoom),v,C,h||1,I,u),z=r.isTileAffectedByFog(o),L=r.getOrCreateProgram("rasterParticle",{defines:m,overrideFog:z});if(r.uploadCommonUniforms(s,L,w),d){let i=new iJ(l.LEQUAL,iJ.ReadOnly,r.depthRangeFor3D),a=r.globeSharedBuffers;if(a){let[o,s,h]=a.getGridBuffers(D,!1);L.draw(r,l.TRIANGLES,i,_,iY.alphaBlended,r.renderElevatedRasterBackface?iQ.frontCCW:iQ.backCCW,R,n.id,o,s,h)}}else{let i=r.depthModeForSublayer(0,iJ.ReadOnly),a=p[o.overscaledZ],{tileBoundsBuffer:s,tileBoundsIndexBuffer:h,tileBoundsSegments:u}=r.getTileBoundsBuffers(T);L.draw(r,l.TRIANGLES,i,a,iY.alphaBlended,iQ.disabled,R,n.id,s,h,u)}}r.resetStencilClippingMasks()}(r,a,n,o),r.style.map.triggerRepaint())},ot=function(i,r,a){let n=r.getSource();if(!(n instanceof tQ&&n.loaded()))return;let o=i.sourceLayer||n.rasterLayerIds&&n.rasterLayerIds[0];if(!o)return;let s=i.paint.get("raster-particle-array-band")||n.getInitialBand(o);if(null!=s)for(let a of r.getIds().map(i=>r.getTileByID(i)))a.updateNeeded(i.id,s)&&n.prepareTile(a,o,i.id,s)},oi=class extends n8{constructor(){super(4.25),this._params={intensity:.5,timeFactor:1,velocityConeAperture:0,velocity:300,boxSize:2500,dropletSizeX:1,dropletSizeYScale:10,distortionStrength:70,screenThinning:{intensity:.57,start:.46,range:1.17,fadePower:.17,affectedRatio:1,particleOffset:-.2},color:{r:.66,g:.68,b:.74,a:.7},direction:{x:-50,y:-35},shapeDirPower:2,shapeNormalPower:1},this._vignetteParams={strength:1,start:.7,range:1,fadePower:.4,color:{r:.27,g:.27,b:.27,a:1}},this.particlesCount=16e3,this._devtoolsFolder=null,this._painter=null}destroy(){super.destroy()}update(r){let a=r.context;if(!this.particlesVx){let r=n4(this.particlesCount),n=new i.eh,o=new i.dF,s=0,l=i.ef(0x134104da55e);for(let i=0;i<r.length;++i){let a=r[i],h=[2*l()-1,l(),l(),l()];n.emplaceBack(a[0],a[1],a[2],-1,-1,...h),n.emplaceBack(a[0],a[1],a[2],1,-1,...h),n.emplaceBack(a[0],a[1],a[2],1,1,...h),n.emplaceBack(a[0],a[1],a[2],-1,1,...h),o.emplaceBack(s+0,s+1,s+2),o.emplaceBack(s+0,s+2,s+3),s+=4}this.particlesVx=a.createVertexBuffer(n,n0.members),this.particlesIdx=a.createIndexBuffer(o)}}getDrawParams(i){if(!i.style.rain)return null;let r=i.style.rain.state,a=structuredClone(this._params);a.intensity=r.density,a.timeFactor=r.intensity,a.color=structuredClone(r.color),a.screenThinning.intensity=r.centerThinning,a.droplet
111SizeX=r.dropletSize[0],a.dropletSizeYScale=r.dropletSize[1]/r.dropletSize[0],a.distortionStrength=100*r.distortionStrength;let n=structuredClone(this._vignetteParams);return n.strength=1,n.color=structuredClone(r.vignetteColor),{params:a,vignetteParams:n,revealParams:{revealStart:0,revealRange:.01},direction:structuredClone(r.direction)}}draw(r){let a=this.getDrawParams(r);if(!a)return;let{params:n,revealParams:o,direction:s,vignetteParams:l}=a,h=r.transform.zoom;if(o.revealStart>h)return;let u=n6(0,1,o.revealStart,o.revealStart+o.revealRange,h);if(!this.particlesVx||!this.particlesIdx)return;l.strength*=u;let c=this.updateOnRender(r,n.timeFactor),d=r.context,p=d.gl,f=r.transform;this.screenTexture&&this.screenTexture.size[0]===r.width&&this.screenTexture.size[1]===r.height||(this.screenTexture=new i.T(d,{width:r.width,height:r.height,data:null},p.RGBA8)),n.distortionStrength>0&&(d.activeTexture.set(p.TEXTURE0),this.screenTexture.bind(p.LINEAR,p.CLAMP_TO_EDGE),p.copyTexSubImage2D(p.TEXTURE_2D,0,0,0,0,0,r.width,r.height));let m=r.getOrCreateProgram("rainParticle");r.uploadCommonUniforms(d,m),d.activeTexture.set(p.TEXTURE0),this.screenTexture.bind(p.LINEAR,p.CLAMP_TO_EDGE);let _=[n.color.r,n.color.g,n.color.b,n.color.a],g=(a,o)=>{var l;let h=n5(this._movement.getPosition(),a),u=n.dropletSizeX,d=n.dropletSizeX*n.dropletSizeYScale,g=r.width/2,y=r.height/2,x=n6(0,n.screenThinning.start,0,1,n.screenThinning.intensity),v=n6(.001,n.screenThinning.range,0,1,n.screenThinning.intensity),b=n6(0,n.screenThinning.particleOffset,0,1,n.screenThinning.intensity),w=(l={modelview:c.modelviewMatrix,projection:c.projectionMatrix,time:this._accumulatedTimeFromStart,camPos:h,velocityConeAperture:n.velocityConeAperture,velocity:n.velocity,boxSize:a,rainDropletSize:[u,d],distortionStrength:n.distortionStrength,rainDirection:s,color:_,screenSize:[f.width,f.height],thinningCenterPos:[g,y],thinningShape:[x,v,Math.pow(10,n.screenThinning.fadePower)],thinningAffectedRatio:n.screenThinning.affectedRatio,thinningParticleOffset:b,shapeDirectionalPower:n.shapeDirPower,shapeNormalPower:n.shapeNormalPower,mode:+!o},{u_modelview:Float32Array.from(l.modelview),u_projection:Float32Array.from(l.projection),u_time:l.time,u_cam_pos:l.camPos,u_texScreen:0,u_velocityConeAperture:l.velocityConeAperture,u_velocity:l.velocity,u_boxSize:l.boxSize,u_rainDropletSize:l.rainDropletSize,u_distortionStrength:l.distortionStrength,u_rainDirection:l.rainDirection,u_color:l.color,u_screenSize:l.screenSize,u_thinningCenterPos:l.thinningCenterPos,u_thinningShape:l.thinningShape,u_thinningAffectedRatio:l.thinningAffectedRatio,u_thinningParticleOffset:l.thinningParticleOffset,u_shapeDirectionalPower:l.shapeDirectionalPower,u_shapeNormalPower:l.shapeNormalPower,u_mode:l.mode}),T=Math.round(n.intensity*this.particlesCount),S=i.dB.simpleSegment(0,0,4*T,2*T);m.draw(r,p.TRIANGLES,iJ.disabled,iK.disabled,iY.alphaBlended,iQ.disabled,w,"rain_particles",this.particlesVx,this.particlesIdx,S)};n.distortionStrength>0&&g(n.boxSize,!0),g(n.boxSize,!1),this._vignette.draw(r,l)}},or=class extends n8{constructor(){super(2.25),this._params={intensity:.85,timeFactor:.75,velocityConeAperture:70,velocity:40,horizontalOscillationRadius:4,horizontalOscillationRate:1.5,boxSize:2e3,billboardSize:2,shapeFadeStart:.27,shapeFadePower:.21,screenThinning:{intensity:.4,start:.15,range:1.4,fadePower:.24,affectedRatio:1,particleOffset:-.2},color:{r:1,g:1,b:1,a:1},direction:{x:-50,y:-35}},this._vignetteParams={strength:.3,start:.78,range:.46,fadePower:.2,color:{r:1,g:1,b:1,a:1}},this.particlesCount=16e3,this._devtoolsFolder=null,this._painter=null}destroy(){super.destroy()}update(r){let a=r.context;if(!this.particlesVx){let r=n4(this.particlesCount),n=new i.ei,o=new i.dF,s=0,l=i.ef(0x134104da55e);for(let i=0;i<r.length;++i){let a=r[i],h=l(),u=l(),c=l(),d=[i/r.length,h,u,c],p=[l(),l()];n.emplaceBack(a[0],a[1],a[2],-1,-1,...d,...p),n.emplaceBack(a[0],a[1],a[2],1,-1,...d,...p),n.emplaceBack(a[0],a[1],a[2],1,1,...d,...p),n.emplaceBack(a[0],a[1],a[2],-1,1,...d,...p),o.emplaceBack(s+0,s+1,s+2),o.emplaceBack(s+0,s+2,s+3),s+=4}this.particlesVx=a.createVertexBuffer(n,n9.members),this.particlesIdx=a.createIndexBuffer(o)}}getDrawParams(i){if(!i.style.snow)return null;let r=i.style.snow.state,a=structuredClone(this._params);a.intensity=r.density,a.timeFactor=r.intensity,a.color=structuredClone(r.color),a.screenThinning.intensity=r.centerThinning,a.billboardSize=2.79*r.flakeSize;
111let n=structuredClone(this._vignetteParams);return n.strength=1,n.color=structuredClone(r.vignetteColor),{params:a,vignetteParams:n,revealParams:{revealStart:0,revealRange:.01},direction:structuredClone(r.direction)}}draw(r){let a=this.getDrawParams(r);if(!a)return;let{params:n,revealParams:o,direction:s,vignetteParams:l}=a,h=r.transform.zoom;if(o.revealStart>h)return;let u=n6(0,1,o.revealStart,o.revealStart+o.revealRange,h);l.strength*=u;let c=this.updateOnRender(r,n.timeFactor);if(!this.particlesVx||!this.particlesIdx)return;let d=r.context,p=d.gl,f=r.transform,m=r.getOrCreateProgram("snowParticle");r.uploadCommonUniforms(d,m),((a,n,o)=>{var l;let h=n5(this._movement.getPosition(),a),u=f.width/2,d=f.height/2,_=n6(0,o.screenThinning.start,0,1,o.screenThinning.intensity),g=n6(.001,o.screenThinning.range,0,1,o.screenThinning.intensity),y=n6(0,o.screenThinning.particleOffset,0,1,o.screenThinning.intensity),x=(l={modelview:c.modelviewMatrix,projection:c.projectionMatrix,time:this._accumulatedTimeFromStart,camPos:h,velocityConeAperture:o.velocityConeAperture,velocity:o.velocity,horizontalOscillationRadius:o.horizontalOscillationRadius,horizontalOscillationRate:o.horizontalOscillationRate,boxSize:a,billboardSize:+o.billboardSize,simpleShapeParameters:[o.shapeFadeStart,o.shapeFadePower],screenSize:[f.width,f.height],thinningCenterPos:[u,d],thinningShape:[_,g,Math.pow(10,o.screenThinning.fadePower)],thinningAffectedRatio:o.screenThinning.affectedRatio,thinningParticleOffset:y,color:[o.color.r,o.color.g,o.color.b,o.color.a],direction:s},{u_modelview:Float32Array.from(l.modelview),u_projection:Float32Array.from(l.projection),u_time:l.time,u_cam_pos:l.camPos,u_velocityConeAperture:l.velocityConeAperture,u_velocity:l.velocity,u_horizontalOscillationRadius:l.horizontalOscillationRadius,u_horizontalOscillationRate:l.horizontalOscillationRate,u_boxSize:l.boxSize,u_billboardSize:l.billboardSize,u_simpleShapeParameters:l.simpleShapeParameters,u_screenSize:l.screenSize,u_thinningCenterPos:l.thinningCenterPos,u_thinningShape:l.thinningShape,u_thinningAffectedRatio:l.thinningAffectedRatio,u_thinningParticleOffset:l.thinningParticleOffset,u_particleColor:l.color,u_direction:l.direction}),v=Math.round(o.intensity*this.particlesCount),b=i.dB.simpleSegment(0,0,4*v,2*v);this.particlesVx&&this.particlesIdx&&m.draw(r,p.TRIANGLES,iJ.disabled,iK.disabled,iY.alphaBlended,iQ.disabled,x,"snow_particles",this.particlesVx,this.particlesIdx,b)})(n.boxSize,0,n),this._vignette.draw(r,l)}},oa={building:r=>({u_matrix:new i.c3(r),u_normal_matrix:new i.c3(r),u_opacity:new i.c1(r),u_faux_facade_ao_intensity:new i.c1(r),u_camera_pos:new i.c0(r),u_tile_to_meter:new i.c1(r),u_facade_emissive_chance:new i.c1(r),u_flood_light_color:new i.c0(r),u_flood_light_intensity:new i.c1(r),u_front_cutoff_params:new i.c0(r)}),buildingBloom:r=>({u_matrix:new i.c3(r)}),buildingDepth:r=>({u_matrix:new i.c3(r)}),rasterParticle:r=>({u_matrix:new i.c3(r),u_normalize_matrix:new i.c3(r),u_globe_matrix:new i.c3(r),u_merc_matrix:new i.c3(r),u_grid_matrix:new i.dq(r),u_tl_parent:new i.c2(r),u_scale_parent:new i.c1(r),u_fade_t:new i.c1(r),u_opacity:new i.c1(r),u_image0:new i.b$(r),u_image1:new i.b$(r),u_raster_elevation:new i.c1(r),u_zoom_transition:new i.c1(r),u_merc_center:new i.c2(r),u_cutoff_params:new i.cS(r)}),rasterParticleTexture:r=>({u_texture:new i.b$(r),u_opacity:new i.c1(r)}),rasterParticleDraw:r=>({u_particle_texture:new i.b$(r),u_particle_texture_side_len:new i.c1(r),u_tile_offset:new i.c2(r),u_velocity:new i.b$(r),u_color_ramp:new i.b$(r),u_velocity_res:new i.c2(r),u_max_speed:new i.c1(r),u_uv_offset:new i.c2(r),u_data_scale:new i.c2(r),u_data_offset:new i.c1(r),u_particle_pos_scale:new i.c1(r),u_particle_pos_offset:new i.c2(r)}),rasterParticleUpdate:r=>({u_particle_texture:new i.b$(r),u_particle_texture_side_len:new i.c1(r),u_velocity:new i.b$(r),u_velocity_res:new i.c2(r),u_max_speed:new i.c1(r),u_speed_factor:new i.c1(r),u_reset_rate:new i.c1(r),u_rand_seed:new i.c1(r),u_uv_offset:new i.c2(r),u_data_scale:new i.c2(r),u_data_offset:new i.c1(r),u_particle_pos_scale:new i.c1(r),u_particle_pos_offset:new i.c2(r)}),snowParticle:r=>({u_modelview:new i.c3(r),u_projection:new i.c3(r),u_time:new i.c1(r),u_cam_pos:new i.c0(r),u_velocityConeAperture:new i.c1(r),u_velocity:new i.c1(r),u_horizontalOscillationRadius:new i.c1(r),u_horizontalOscillationRate:new i.c1(r),u_boxSize:new i.c1(r),u_billboardSize:new i.c1(r),u_simpleShapeParameters:new i.c2(r),u_screenSize:new i.c2(r),u_thinningCenterPos:new i.c2(r),u_thinningShape:new i.c0(r),u_thinningAffectedRatio:new i.c1(r),u_thinningParticleOffset:new i.c1(r),u_particleColor:new i.cS(r),u_direction:new i.c0(r)}),rainParticle:r=>({u_modelview:new i.c3(r),u_projection:new i.c3(r),u_time:new i.c1(r),u_cam_pos:new i.c0(r),u_texScreen:new i.b$(r),u_velocityConeAperture:new i.c1(r),u_velocity:new i.c1(r),u_boxSize:new i.c1(r),u_rainDropletSize:new i.c2(r),u_distortionStrength:new i.c1(r),u_rainDirection:new i.c0(r),u_color:new i.cS(r),u_screenSize:new i.c2(r),u_thinningCenterPos:new i.c2(r),u_thinningShape:new i.c0(r),u_thinningAffectedRatio:new i.c1(r),u_thinningParticleOffset:new i.c1(r),u_shapeDirectionalPower:new i.c1(r),u_shapeNormalPower:new i.c1(r),u_mode:new i.c1(r)}),vignette:r=>({u_vignetteShape:new i.c0(r),u_vignetteColor:new i.cS(r)})};function on(r){return[r[0]*i.ej,r[1]*i.ej,r[2]*i.ej,0]}function oo(r,a,n,o,s,l,h,u,c){let d,p,f,m,_,g,y,x,v=o.getSource(),b=n.globeSharedBuffers;
111if(!b||(a&&(d=o.getTile(a)),v instanceof i.aY?(p=v.texture,f=i.dz(0,0,n.transform)):d&&a&&(p=d.texture,f=i.dz(a.canonical.z,a.canonical.x,n.transform)),!p||!f))return;r||(f=i.cE(i.bd(),f,[1,-1,1]));let w=n.context,T=w.gl,S="nearest"===s.paint.get("raster-resampling")?T.NEAREST:T.LINEAR,E=n.colorModeForDrapableLayerRenderPass(l),I=h.defines;I.push("GLOBE_POLES");let A=new iJ(T.LEQUAL,iJ.ReadWrite,n.depthRangeFor3D),M=n.transform.expandedFarZProjMatrix,C=Float32Array.from(i.dx(i.dy(new i.cp(0,0,0))));n.terrain&&n.terrain.prepareDrawTile(),w.activeTexture.set(T.TEXTURE0),p.bind(S,T.CLAMP_TO_EDGE),w.activeTexture.set(T.TEXTURE1),p.bind(S,T.CLAMP_TO_EDGE),"useMipmap"in p&&w.extTextureFilterAnisotropic&&n.transform.pitch>20&&T.texParameterf(T.TEXTURE_2D,w.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,w.extTextureFilterAnisotropicMax);let[P,D,R,z]=a?b.getPoleBuffers(a.canonical.z,!1):b.getPoleBuffers(0,!0),L=s.paint.get("raster-elevation");r?(m=P,n.renderDefaultNorthPole=0!==L):(m=D,n.renderDefaultSouthPole=0!==L);let F=on(h.mix),O=(_=f,g=i.ai(n.transform.zoom),y=h.offset,x=h.range,ne(n,M,C,_,new Float32Array(16),new Float32Array(9),[0,0],g,[0,0],[0,0,0,0],1,{opacity:1,mix:0},s,[0,0],L,2,F,y,x,1,0,l)),B=n.getOrCreateProgram("raster",{defines:I});n.uploadCommonUniforms(w,B,null),B.draw(n,T.TRIANGLES,A,c,E,u,O,s.id,m,R,z)}let os=i.bA(new Float32Array(16)),ol=new i.C(1,0,0,1),oh=new i.C(0,1,0,1),ou=new i.C(0,0,1,1),oc=new i.C(1,0,1,1),od=new i.C(0,1,1,1);function op(i,r,a,n){om(i,0,r+a/2,i.transform.width,a,n)}function of(i,r,a,n){om(i,r-a/2,0,a,i.transform.height,n)}function om(r,a,n,o,s,l){let h=r.context,u=h.gl;u.enable(u.SCISSOR_TEST),u.scissor(a*i.o.devicePixelRatio,n*i.o.devicePixelRatio,o*i.o.devicePixelRatio,s*i.o.devicePixelRatio),h.clear({color:l}),u.disable(u.SCISSOR_TEST)}let{members:o_}=i.ea([{name:"a_pos_3f",components:3,type:"Float32"}]);function og(i,r,a,n){i.emplaceBack(r,a,n)}class oy{constructor(r){this.vertexArray=new i.em,this.indices=new i.dF,og(this.vertexArray,-1,-1,1),og(this.vertexArray,1,-1,1),og(this.vertexArray,-1,1,1),og(this.vertexArray,1,1,1),og(this.vertexArray,-1,-1,-1),og(this.vertexArray,1,-1,-1),og(this.vertexArray,-1,1,-1),og(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=r.createVertexBuffer(this.vertexArray,o_),this.indexBuffer=r.createIndexBuffer(this.indices),this.segment=i.dB.simpleSegment(0,0,36,12)}}function ox(r,a,n,o,s,l){let h,u,c,d=r.context.gl,p=a.paint.get("sky-atmosphere-color"),f=a.paint.get("sky-atmosphere-halo-color"),m=a.paint.get("sky-atmosphere-sun-intensity"),_=(h=i.ep(i.dH(),o),u=p.toPremultipliedRenderColor(null),c=f.toPremultipliedRenderColor(null),{u_matrix_3f:h,u_sun_direction:s,u_sun_intensity:m,u_color_tint_r:[u.r,u.g,u.b,u.a],u_color_tint_m:[c.r,c.g,c.b,c.a],u_luminance:5e-5});d.framebufferTexture2D(d.FRAMEBUFFER,d.COLOR_ATTACHMENT0,d.TEXTURE_CUBE_MAP_POSITIVE_X+l,a.skyboxTexture,0),n.draw(r,d.TRIANGLES,iJ.disabled,iK.disabled,iY.unblended,iQ.frontCW,_,"skyboxCapture",a.skyboxGeometry.vertexBuffer,a.skyboxGeometry.indexBuffer,a.skyboxGeometry.segment)}
111let ov=i.ea([{type:"Float32",name:"a_pos",components:3},{type:"Float32",name:"a_uv",components:2}]);class ob{constructor(r){let a=new i.eq;a.emplaceBack(-1,1,1,0,0),a.emplaceBack(1,1,1,1,0),a.emplaceBack(1,-1,1,1,1),a.emplaceBack(-1,-1,1,0,1);let n=new i.dF;n.emplaceBack(0,1,2),n.emplaceBack(2,3,0),this.vertexBuffer=r.createVertexBuffer(a,ov.members),this.indexBuffer=r.createIndexBuffer(n),this.segments=i.dB.simpleSegment(0,0,4,2)}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy()}}let ow=i.ea([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_size_scale",components:1},{type:"Float32",name:"a_opacity",components:1}]);class oT{constructor(){this.colorModeAlphaBlendedWriteRGB=new iY([1,771,1,771],i.C.transparent,[!0,!0,!0,!1]),this.colorModeWriteAlpha=new iY([1,0,1,0],i.C.transparent,[!1,!1,!1,!0]),this.params={starsCount:16e3,sizeMultiplier:.15,sizeRange:100,intensityRange:200},this.updateNeeded=!0,this._painter=null,this._devtoolsFolder=null}update(r){this._painter=r;let a=r.context;if(!this.atmosphereBuffer||this.updateNeeded){this.updateNeeded=!1,this.atmosphereBuffer=new ob(a);let r=this.params,n=r.sizeRange,o=r.intensityRange,s=function(r){let a=i.ef(30),n=[];for(let o=0;o<r;++o){let r=2*Math.PI*a(),o=Math.acos(1-2*a())-.5*Math.PI;n.push(i.cU(Math.cos(o)*Math.cos(r),Math.cos(o)*Math.sin(r),Math.sin(o)))}return n}(r.starsCount),l=i.ef(300),h=new i.er,u=new i.dF,c=0;for(let r=0;r<s.length;++r){let a=i.bN([],s[r],200),d=Math.max(0,1+.01*n*(l()-.5)),p=Math.max(0,1+.01*o*(l()-.5));h.emplaceBack(a[0],a[1],a[2],-1,-1,d,p),h.emplaceBack(a[0],a[1],a[2],1,-1,d,p),h.emplaceBack(a[0],a[1],a[2],1,1,d,p),h.emplaceBack(a[0],a[1],a[2],-1,1,d,p),u.emplaceBack(c+0,c+1,c+2),u.emplaceBack(c+0,c+2,c+3),c+=4}this.starsVx=a.createVertexBuffer(h,ow.members),this.starsIdx=a.createIndexBuffer(u),this.starsSegments=i.dB.simpleSegment(0,0,h.length,u.length)}}destroy(){this.atmosphereBuffer&&this.atmosphereBuffer.destroy(),this.starsVx&&this.starsVx.destroy(),this.starsIdx&&this.starsIdx.destroy(),this._painter=null}drawAtmosphereGlow(r,a){let n=r.context,o=n.gl,s=r.transform,l=new iJ(o.LEQUAL,iJ.ReadOnly,[0,1]),h=i.ai(s.zoom),u=r.style.getLut(a.scope),c="none"===a.properties.get("color-use-theme"),d=a.properties.get("color").toNonPremultipliedRenderColor(c?null:u),p="none"===a.properties.get("high-color-use-theme"),f=a.properties.get("high-color").toNonPremultipliedRenderColor(p?null:u),m="none"===a.properties.get("space-color-use-theme"),_=a.properties.get("space-color").toNonPremultipliedRenderColor(m?null:u),g=i.es(a.properties.get("horizon-blend"),0,1,5e-4,.25),y=i.ds(r,n,s)&&5e-4===g?s.worldSize/(2*Math.PI*1.025)-1:s.globeRadius,x=r.frameCounter/1e3%1,v=i.af(s.globeCenterInViewSpace),b=Math.acos(Math.sqrt(Math.pow(v,2)-Math.pow(y,2))/v),w=i=>{let a,u,c,p,m,y="globe"===s.projection.name?["PROJECTION_GLOBE_VIEW","FOG"]:["FOG"];i&&y.push("ALPHA_PASS");let v=r.getOrCreateProgram("globeAtmosphere",{defines:y}),w=(a=s.frustumCorners.TL,u=s.frustumCorners.TR,c=s.frustumCorners.BR,p=s.frustumCorners.BL,m=s.frustumCorners.horizon,{u_frustum_tl:a,u_frustum_tr:u,u_frustum_br:c,u_frustum_bl:p,u_horizon:m,u_transition:h,u_fadeout_range:g,u_atmosphere_fog_color:d.toArray01(),u_high_color:f.toArray01(),u_space_color:_.toArray01(),u_temporal_offset:x,u_horizon_angle:b});r.uploadCommonUniforms(n,v);let T=this.atmosphereBuffer;T&&v.draw(r,o.TRIANGLES,l,iK.disabled,i?this.colorModeWriteAlpha:this.colorModeAlphaBlendedWriteRGB,iQ.backCW,w,i?"atmosphere_glow_alpha":"atmosphere_glow",T.vertexBuffer,T.indexBuffer,T.segments)};w(!1),w(!0)}drawStars(r,a){let n=i.aB(a.properties.get("star-intensity"),0,1);if(0===n)return;let o=r.context,s=o.gl,l=r.transform,h=r.getOrCreateProgram("stars"),u=i.bP([]);i.bR(u,u,-l._pitch),i.bQ(u,u,-l.angle),i.bR(u,u,i.am(l._center.lat)),i.et(u,u,-i.am(l._center.lng));let c=i.bV(new Float32Array(16),u),d=i.aC([],l.starsProjMatrix,c),p=i.ep([],c),f=i.eu([],p),m=this.params.sizeMultiplier,_=[0,1,0];i.dJ(_,_,f),i.bN(_,_,m);let g=[1,0,0];i.dJ(g,g,f),i.bN(g,g,m);let y={u_matrix:Float32Array.from(d),u_up:_,u_right:g,u_intensity_multiplier:n};r.uploadCommonUniforms(o,h),this.starsVx&&this.starsIdx&&h.draw(r,s.TRIANGLES,iJ.disabled,iK.disabled,this.colorModeAlphaBlendedWriteRGB,iQ.disabled,y,"atmosphere_stars",this.starsVx,this.starsIdx,this.starsSegments)}}class oS{constructor(){this.visibleTiles=[]}updateBorders(r,a){let n=[],o=[];for(let i of r._getRenderableCoordinates(!1,!0)){let s=r.getTile(i);if(!s.hasData())continue;let l=s.getBucket(a);l&&(l.isEmpty()||(n.push(i.key),o.push({bucket:l,tileID:i.canonical})))}let s=n.length!==this.visibleTiles.length;if(!s){n.sort();for(let i=0;i<n.length;i++)if(n[i]!==this.visibleTiles[i]){s=!0;break}}if(!s)return;let l=new Set;for(let r of(this.visibleTiles=n,o.sort((i,r)=>i.tileID.z-r.tileID.z||i.tileID.x-r.tileID.x||i.tileID.y-r.tileID.y),o)){let a=[],n=[],o=r.bucket;for(let i of o.featuresOnBorder)l.has(i.featureId)?n.push(i.footprintIndex):(l.add(i.featureId),a.push(i.footprintIndex));o.updateFootprintHiddenFlags(a,i.ev,!1),o.updateFootprintHiddenFlags(n,i.ev,!0)}}}let oE=new Float64Array(16),oI=new Float64Array(16),oA=new Float64Array(16),oM=new Float32Array(16),oC=[0,0,0];function oP(r,a,n){let o=n.cameraWorldSizeForFog/n.worldSize;return i.cE(r,n.worldToFogMatrix,[o,o,1]),i.aC(r,r,a),r}function oD(r,a,n,o,s){let l=n.material,h=o.context,{baseColorTexture:u,metallicRoughnessTexture:c}=l.pbrMetallicRoughness,{normalTexture:d,occlusionTexture:p,emissionTexture:f}=l;
111function m(i,a,n){if(i&&(r.push(a),h.activeTexture.set(h.gl.TEXTURE0+n),i.gfxTexture)){let{minFilter:r,magFilter:a,wrapS:n,wrapT:o}=i.sampler;i.gfxTexture.bindExtraParam(r,a,n,o)}}m(u,"HAS_TEXTURE_u_baseColorTexture",5),m(c,"HAS_TEXTURE_u_metallicRoughnessTexture",6),m(d,"HAS_TEXTURE_u_normalTexture",7),m(p,"HAS_TEXTURE_u_occlusionTexture",8),m(f,"HAS_TEXTURE_u_emissionTexture",9),s&&(s.texture||(s.texture=new i.dU(o.context,s.image,[s.image.height,s.image.height,s.image.height],h.gl.RGBA8)),h.activeTexture.set(h.gl.TEXTURE0+10),s.texture&&s.texture.bind(h.gl.LINEAR,h.gl.CLAMP_TO_EDGE),r.push("APPLY_LUT_ON_GPU")),n.texcoordBuffer&&(r.push("HAS_ATTRIBUTE_a_uv_2f"),a.push(n.texcoordBuffer)),n.colorBuffer&&(r.push(12===n.colorBuffer.itemSize?"HAS_ATTRIBUTE_a_color_3f":"HAS_ATTRIBUTE_a_color_4f"),a.push(n.colorBuffer)),n.normalBuffer&&(r.push("HAS_ATTRIBUTE_a_normal_3f"),a.push(n.normalBuffer)),n.pbrBuffer&&(r.push("HAS_ATTRIBUTE_a_pbr"),r.push("HAS_ATTRIBUTE_a_heightBasedEmissiveStrength"),a.push(n.pbrBuffer)),"OPAQUE"!==l.alphaMode&&"MASK"!==l.alphaMode||r.push("UNPREMULT_TEXTURE_IN_SHADER"),l.defined||r.push("DIFFUSE_SHADED");let _=o.shadowRenderer;_&&(r.push("RENDER_SHADOWS"),_.useNormalOffset&&r.push("NORMAL_OFFSET"))}function oR(r,a,n,o,s,l){let h=r.modelOpacity,u=a.context,c=new iJ(a.context.gl.LEQUAL,r.isLightMesh?iJ.ReadOnly:iJ.ReadWrite,a.depthRangeFor3D),d=a.transform,p=r.mesh,f=p.material,m=f.pbrMetallicRoughness,_=a.style.fog;"pixels"===a.transform.projection.zAxisUnit?oE.set(r.nodeModelMatrix):i.aC(oE,o.zScaleMatrix,r.nodeModelMatrix),i.aC(oE,o.negCameraPosMatrix,oE),i.ba(oI,oE),i.e9(oI,oI);let g="none"===n.paint.get("model-color-use-theme").constantOr("default"),y=n.paint.get("model-emissive-strength").constantOr(0),x=no(r.worldViewProjection,oE,oI,null,a,h,m.baseColorFactor,f.emissiveFactor,m.metallicFactor,m.roughnessFactor,f,y,n,void 0,void 0,r.materialOverride,r.modelColor),v={defines:[]},b=[],w=a.shadowRenderer;w&&(w.useNormalOffset=!1),oD(v.defines,b,p,a,g?null:n.lut);let T=null;if(_&&(T=oP(oA,r.nodeModelMatrix,a.transform),"globe"!==d.projection.name)){let i=p.aabb.min,r=p.aabb.max,[a,n]=_.getOpacityForBounds(T,i[0],i[1],r[0],r[1]);v.overrideFog=a>=.05||n>=.05}let S=i9(a,n.paint.get("model-cutoff-fade-range"));S.shouldRenderCutoff&&v.defines.push("RENDER_CUTOFF");let E=a.getOrCreateProgram("model",v);a.uploadCommonUniforms(u,E,null,T,S),"shadow"!==a.renderPass&&w&&w.setupShadowsFromMatrix(r.nodeModelMatrix,E),E.draw(a,u.gl.TRIANGLES,c,s,l,p.material.doubleSided?iQ.disabled:iQ.backCCW,x,n.id,p.vertexBuffer,p.indexBuffer,p.segments,n.paint,a.transform.zoom,void 0,b)}function oz(i,r){return i.style._importedAsBasemap?"basemap":r.scope}function oL(r,a,n,o,s,l,h,u,c,d){let p=r.transform,f=!!a.isGeometryBloom&&a.isGeometryBloom;if(f&&"shadow"===r.renderPass)return;let m="globe"===p.projection.name?i.eD(n,p):[...n];i.aC(m,m,a.globalMatrix);let _=i.aC([],o,m);if(a.meshes)for(let r of a.meshes){let o=u.get(r.material.name);if(o&&o.opacity<=0)continue;if("BLEND"!==r.material.alphaMode){h.push({mesh:r,depth:0,modelIndex:s,worldViewProjection:_,nodeModelMatrix:m,isLightMesh:f,materialOverride:o,modelOpacity:c,modelColor:d,node:a,modelMatrix:n});continue}let g=i.ae([],r.centroid,_);!p.isOrthographic&&g[2]<=0||l.push({mesh:r,depth:g[2],modelIndex:s,worldViewProjection:_,nodeModelMatrix:m,isLightMesh:f,materialOverride:o,modelOpacity:c,modelColor:d,node:a,modelMatrix:n})}if(a.children)for(let i of a.children)oL(r,i,n,o,s,l,h,u,c,d)}function oF(i,r,a,n){let o=a.shadowRenderer;if(!o)return;let s=o.getShadowPassDepthMode(),l=ns(o.calculateShadowPassMatrixFromMatrix(r));a.getOrCreateProgram("modelDepth").draw(a,a.context.gl.TRIANGLES,s,iK.disabled,iY.disabled,iQ.disabled,l,n.id,i.vertexBuffer,i.indexBuffer,i.segments,n.paint,a.transform.zoom,void 0,void 0)}function oO(r,a,n,o){let s=function(r,a){let n;if(a.footprintDebugMesh)return a.footprintDebugMesh;if(!a.footprint)return null;let o=r.context,s=a.footprint.vertices,l=a.footprint.indices,h=new i.dE;for(let i of(h.reserve(s.length),s))h.emplaceBack(i.x,i.y);let u=new i.dF;u.reserve(l.length);for(let i=0;i<l.length;i+=3)u.emplaceBack(l[i],l[i+1],l[i+2]);let c=o.createVertexBuffer(h,i.dA.members),d=o.createIndexBuffer(u),p=i.dB.simpleSegment(0,0,s.length,l.length),f=a.id||a.name||"footprint",m=parseInt(f,10);n=isNaN(m)?function(i){let r=0;for(let a=0;a<i.length;a++)r=(r<<5)-r+i.charCodeAt(a)|0;return r}(f):m;let _=i.ed(n),g=i.ed(n+1),y=i.ed(n+2);return a.footprintDebugMesh={vertexBuffer:c,indexBuffer:d,segments:p,color:new i.C(_,g,y,.5)},a.footprintDebugMesh}(r,n);if(!s)return;let l=r.context,h=l.gl,u=r.getOrCreateProgram("debug"),c=s.color,d=iJ.disabled;l.activeTexture.set(h.TEXTURE0),r.emptyTexture.bind(h.LINEAR,h.CLAMP_TO_EDGE),u.draw(r,h.TRIANGLES,d,iK.disabled,iY.alphaBlended,iQ.disabled,a4(o,c.toPremultipliedRenderColor(null)),"$debug",s.vertexBuffer,s.indexBuffer,s.segments)}function oB(i,r,a,n,o){let s=!1;for(let a of n)1!==a.modelOpacity&&(oR(a,i,r,o[a.modelIndex],iK.disabled,iY.disabled),s=!0);for(let a of n)oR(a,i,r,o[a.modelIndex],1!==a.modelOpacity?i.stencilModeFor3D():iK.disabled,i.colorModeForRenderPass());s&&i.resetStencilClippingMasks();let l=iY.additive;for(let n of a)oR(n,i,r,o[n.modelIndex],iK.disabled,n.isLightMesh?l:i.colorModeForRenderPass())}let ok={shadowUniformsInitialized:!1,useSingleShadowCascade:!1,tileMatrix:new Float64Array(16),shadowTileMatrix:new Float32Array(16),aabb:new i.cY([0,0,0],[i.ak,i.ak,0])},oN=[1,-1,1];class oU{}class oV{constructor(){this._storage=new Map}getLinesFromTrianglesBuffer(r,a,n){{let i=this._storage.get(a.id);if(i)return i.lastUsedFrameIdx=r,i.buf}let o=n.gl,s=o.getBufferParameter(o.ELEMENT_ARRAY_BUFFER,o.BUFFER_SIZE),l=new ArrayBuffer(s),h=new Int16Array(l);o.getBufferSubData(o.ELEMENT_ARRAY_BUFFER,0,new Int16Array(l));let u=new i.eI;for(let i=0;i<s/2;i+=3){let r=h[i],a=h[i+1],n=h[i+2];u.emplaceBack(r,a),u.emplaceBack(a,n),u.emplaceBack(n,r)}let c=n.bindVertexArrayOES.current,d=new oU;return d.buf=new nh(n,u),d.lastUsedFrameIdx=r,this._storage.set(a.id,d),n.bindVertexArrayOES.set(c),d.buf}update(i){for(let[r,a]of this._storage)i-a.lastUsedFrameIdx>30&&(a.buf.destroy(),this._storage.delete(r))}destroy(){for(let[i,r]of this._storage)r.buf.destroy(),this._storage.delete(i)}}class oj{constructor(){this.occluderSize=30,this.depthOffset=-1e-4}}
111let oG={symbol:function(r,a,n,o,s){if("translucent"!==r.renderPass)return;let l=iK.disabled,h=r.colorModeForRenderPass(),u=n.layout.get("text-variable-anchor"),c=n.layout.get("text-size-scale-range"),d=i.aB(r.scaleFactor,c[0],c[1]);u&&function(r,a,n,o,s,l,h,u){let c=a.transform,d="map"===s,p="map"===l;for(let a of r){let r=o.getTile(a),s=r.getBucket(n);if(!s||!s.text||!s.text.segments.get().length)continue;let l=i.bl(s.textSizeData,c.zoom,u),f=id(a,s.getProjection(),c),m=c.calculatePixelsToTileUnitsMatrix(r),_=i_(f,r.tileID.canonical,p,d,c,s.getProjection(),m),g=s.hasIconTextFit()&&s.hasIconData();l&&function(r,a,n,o,s,l,h,u,c,d){let p=r.text.placedSymbolArray,f=r.text.dynamicLayoutVertexArray,m=r.icon.dynamicLayoutVertexArray,_={},g=r.getProjection(),y=id(h,g,s),x=s.elevation,v=g.upVectorScale(h.canonical,s.center.lat,s.worldSize).metersToTile;f.clear();for(let m=0;m<p.length;m++){let b=p.get(m),{tileAnchorX:w,tileAnchorY:T,numGlyphs:S}=b,E=b.hidden||!b.crossTileID||r.allowVerticalPlacement&&!b.placedOrientation?null:o[b.crossTileID];if(E){let o=0,p=0,I=0,A="road"===r.elevationType;if(x||A){let a=A?r.getElevationFeatureForText(m):null,n=i.bx.getAtTileOffset(h,new i.P(w,T),x,a),[s,l,u]=g.upVector(h.canonical,w,T);o=n*s*v,p=n*l*v,I=n*u*v}let[M,C,P,D]=ix(b.projectedAnchorX+o,b.projectedAnchorY+p,b.projectedAnchorZ+I,n?y:l),R=iv(s.getCameraToCenterDistance(g),D),z=i.bn(r.textSizeData,c,b)*R/i.bC;n&&(z*=r.tilePixelRatio/u);let L=function({width:r,height:a,anchor:n,textOffset:o,textScale:s},l){let{horizontalAlign:h,verticalAlign:u}=i.bJ(n),c=i.bK(n,o);return new i.P((-(h-.5)*r/s+c[0])*l,(-(u-.5)*a/s+c[1])*l)}(E,z);n?({x:M,y:C,z:P}=g.projectTilePoint(w+L.x,T+L.y,h.canonical),[M,C,P]=ix(M+o,C+p,P+I,l)):(a&&L._rotate(-s.angle),M+=L.x,C+=L.y,P=0);let F=r.allowVerticalPlacement&&b.placedOrientation===i.bm.vertical?Math.PI/2:0;for(let r=0;r<S;r++)i.bp(f,M,C,P,F);d&&b.associatedIconIndex>=0&&(_[b.associatedIconIndex]={x:M,y:C,z:P,angle:F})}else iM(S,f)}if(d){m.clear();let a=r.icon.placedSymbolArray;for(let r=0;r<a.length;r++){let n=a.get(r),{numGlyphs:o}=n,s=_[r];if(n.hidden||!s)iM(o,m);else{let{x:r,y:a,z:n,angle:l}=s;for(let s=0;s<o;s++)i.bp(m,r,a,n,l)}}r.icon.dynamicLayoutVertexBuffer.updateData(m)}r.text.dynamicLayoutVertexBuffer.updateData(f)}(s,d,p,h,c,_,a,Math.pow(2,c.zoom-r.tileID.overscaledZ),l,g)}}(o,r,n,a,n.layout.get("text-rotation-alignment"),n.layout.get("text-pitch-alignment"),s,d);let p=0!==n.paint.get("icon-opacity").constantOr(1),f=0!==n.paint.get("text-opacity").constantOr(1);void 0!==n.layout.get("symbol-sort-key").constantOr(1)&&(p||f)?ng(r,a,n,o,l,h):(p&&ng(r,a,n,o,l,h,{onlyIcons:!0}),f&&ng(r,a,n,o,l,h,{onlyText:!0})),a.map.showCollisionBoxes&&(nf(r,a,n,o,n.paint.get("text-translate"),n.paint.get("text-translate-anchor"),!0),nf(r,a,n,o,n.paint.get("icon-translate"),n.paint.get("icon-translate-anchor"),!1))},circle:function(r,a,n,o){if("translucent"!==r.renderPass)return;let s=n.paint.get("circle-opacity"),l=n.paint.get("circle-stroke-width"),h=n.paint.get("circle-stroke-opacity"),u=void 0!==n.layout.get("circle-sort-key").constantOr(1),c=n.paint.get("circle-emissive-strength");if(0===s.constantOr(1)&&(0===l.constantOr(1)||0===h.constantOr(1)))return;let d=r.context,p=d.gl,f=r.transform,m=!(!r.terrain||!r.terrain.enabled),_=n.layout.get("circle-elevation-reference"),g=r.depthModeForSublayer(0,iJ.ReadOnly),y=new iJ(r.context.gl.LEQUAL,iJ.ReadOnly,r.depthRangeFor3D),x="none"===_||m?g:y,v=iK.disabled,b=r.colorModeForDrapableLayerRenderPass(c),w="globe"===f.projection.name,T=[i.aG(f.center.lng),i.aJ(f.center.lat)],S=[];for(let s=0;s<o.length;s++){let l=o[s],h=a.getTile(l),c=h.getBucket(n);if(!c||c.projection.name!==f.projection.name)continue;let d=c.programConfigurations.get(n.id),p=c.layoutVertexBuffer,m=c.globeExtVertexBuffer,_=c.indexBuffer,g=i.dV(n),y=[m],x=r.isTileAffectedByFog(l);w&&g.push("PROJECTION_GLOBE_VIEW"),g.push("DEPTH_D24"),r.terrain&&f.depthOcclusionForSymbolsAndCircles&&g.push("DEPTH_OCCLUSION"),c.hasElevation&&!r.terrain&&(g.push("ELEVATED_ROADS"),y.push(c.elevatedLayoutVertexBuffer));let v=r.getOrCreateProgram("circle",{config:d,defines:g,overrideFog:x}),b=f.projection.createInversionMatrix(f,l.canonical),E={programConfiguration:d,program:v,layoutVertexBuffer:p,dynamicBuffers:y,indexBuffer:_,uniformValues:i.dW(r,l,h,b,T,n),tile:h};if(u)for(let r of c.segments.get())S.push({segments:new i.dB([r]),sortKey:r.sortKey,state:E});else S.push({segments:c.segments,sortKey:0,state:E})}u&&S.sort((i,r)=>i.sortKey-r.sortKey);let E={useDepthForOcclusion:f.depthOcclusionForSymbolsAndCircles};for(let i of S){let{programConfiguration:a,program:o,layoutVertexBuffer:s,dynamicBuffers:l,indexBuffer:h,uniformValues:u,tile:c}=i.state,m=i.segments;r.terrain&&r.terrain.setupElevationDraw(c,o,E),r.uploadCommonUniforms(d,o,c.tileID.toUnwrapped()),o.draw(r,p.TRIANGLES,x,v,b,iQ.disabled,u,n.id,s,h,m,n.paint,f.zoom,a,l)}},heatmap:function(r,a,n,o){if(0!==n.paint.get("heatmap-opacity"))if("offscreen"===r.renderPass){let s=r.context,l=s.gl,h=iK.disabled,u=new iY([l.O
111NE,l.ONE,l.ONE,l.ONE],i.C.transparent,[!0,!0,!0,!0]),c="globe"===r.transform.projection.name?.5:.25;n.heatmapFbo=nd.createWithTexture(s,n.heatmapFbo,r.width*c,r.height*c),s.clear({color:i.C.transparent});let d=r.transform,p="globe"===d.projection.name,f=p?["PROJECTION_GLOBE_VIEW"]:[],m=p?iQ.frontCCW:iQ.disabled,_=[i.aG(d.center.lng),i.aJ(d.center.lat)];for(let i=0;i<o.length;i++){let c=o[i];if(a.hasRenderableParent(c))continue;let g=a.getTile(c),y=g.getBucket(n);if(!y||y.projection.name!==d.projection.name)continue;let x=r.isTileAffectedByFog(c),v=y.programConfigurations.get(n.id),b=r.getOrCreateProgram("heatmap",{config:v,defines:f,overrideFog:x}),{zoom:w}=r.transform;r.terrain&&r.terrain.setupElevationDraw(g,b),r.uploadCommonUniforms(s,b,c.toUnwrapped());let T=d.projection.createInversionMatrix(d,c.canonical);b.draw(r,l.TRIANGLES,iJ.disabled,h,u,m,a8(r,c,g,T,_,w,n.paint.get("heatmap-intensity")),n.id,y.layoutVertexBuffer,y.indexBuffer,y.segments,n.paint,r.transform.zoom,v,p?[y.globeExtVertexBuffer]:null)}s.viewport.set([0,0,r.width,r.height])}else"translucent"===r.renderPass&&(r.context.setColorMode(r.colorModeForRenderPass()),function(r,a){let n=r.context,o=n.gl,s=a.heatmapFbo;if(!s)return;n.activeTexture.set(o.TEXTURE0),o.bindTexture(o.TEXTURE_2D,s.colorAttachment0.get()),n.activeTexture.set(o.TEXTURE1);let l=a.colorRampTexture;l||(l=a.colorRampTexture=new i.T(n,a.colorRamp,o.RGBA8)),l.bind(o.LINEAR,o.CLAMP_TO_EDGE),r.getOrCreateProgram("heatmapTexture").draw(r,o.TRIANGLES,iJ.disabled,iK.disabled,r.colorModeForRenderPass(),iQ.disabled,{u_image:0,u_color_ramp:1,u_opacity:a.paint.get("heatmap-opacity")},a.id,r.viewportBuffer,r.quadTriangleIndexBuffer,r.viewportSegments,a.paint,r.transform.zoom)}(r,n))},line:function(i,r,a,n){let o=a.paint.get("line-opacity"),s=a.paint.get("line-width");if(0===o.constantOr(1)||0===s.constantOr(1))return;let l=a.paint.get("line-blend-mode"),h=i.terrain&&i.terrain.renderingToTexture;if("default"===l||"globe"===i.transform.projection.name)"translucent"===i.renderPass&&nx(i,r,a,n);else{if(h)return void function(i,r,a,n,o){if("translucent"!==i.renderPass)return;let s=i.context,l=s.gl,h=i.terrain;if(!h)return;let u=s.bindFramebuffer.current,c="mrt-fallback"===i.emissiveMode,d=h.drapeBufferSize[0],p=h.drapeBufferSize[1];a.lineBlendFbos||(a.lineBlendFbos=new nv),a.lineBlendFbos.drapeFbo=nd.createWithTexture(s,a.lineBlendFbos.drapeFbo,d,p,!0),c&&l.drawBuffers([l.COLOR_ATTACHMENT0]),s.clear({color:nw[o].clearColor,depth:1,stencil:0});let f=i.currentStencilSource,m=i._tileClippingMaskIDs,_=i.nextStencilID;i.currentStencilSource=void 0,i._tileClippingMaskIDs={},i.nextStencilID=1;let g=i._terrain;i._terrain=null,i._renderTileClippingMasks(a,r,n),nx(i,r,a,n,nS(o,i.context),!0),i._terrain=g,i.currentStencilSource=f,i._tileClippingMaskIDs=m,i.nextStencilID=_,c&&l.drawBuffers([l.COLOR_ATTACHMENT0,l.COLOR_ATTACHMENT1]);let y=h.drapeBufferSize,x=a.lineBlendFbos&&a.lineBlendFbos.drapeFbo;x&&("additive"===o&&nI(i,a,x),nA(i,a,o,x,u,y))}(i,r,a,n,l);if("offscreen"===i.renderPass)return void function(i,r,a,n,o){let s=i.context,l=Math.ceil(i.width),h=Math.ceil(i.height);a.lineBlendFbos||(a.lineBlendFbos=new nv),a.lineBlendFbos.fbo=nd.createWithTexture(s,a.lineBlendFbos.fbo,l,h,!0),s.clear({color:nw[o].clearColor,depth:1,stencil:0});let u=i.currentStencilSource,c=i._tileClippingMaskIDs,d=i.nextStencilID;i.currentStencilSource=void 0,i._tileClippingMaskIDs={},i.nextStencilID=1,i._renderTileClippingMasks(a,r,n);let p=i.renderPass;i.renderPass="translucent",nx(i,r,a,n,nS(o,i.context)),i.renderPass=p,i.currentStencilSource=u,i._tileClippingMaskIDs=c,i.nextStencilID=d,s.viewport.set([0,0,i.width,i.height]),"additive"===o&&nI(i,a,a.lineBlendFbos.fbo)}(i,r,a,n,l);if("translucent"===i.renderPass){let r=a.lineBlendFbos&&a.lineBlendFbos.fbo;return void(r&&nA(i,a,l,r,null))}}},fill:function(r,a,n,o){let s=n.paint.get("fill-color"),l=n.paint.get("fill-opacity");if(0===l.constantOr(1))return;let h=n.paint.get("fill-emissive-strength"),u=r.colorModeForDrapableLayerRenderPass(h),c=n.paint.get("fill-pattern"),d=r.opaquePassEnabledForLayer()&&!c.constantOr(1)&&1===s.constantOr(i.C.transparent).a&&1===l.constantOr(0)?"opaque":"translucent",p="none";"none"!==n.layout.get("fill-elevation-reference")?p="road":0!==n.paint.get("fill-z-offset").constantOr(1)&&(p="offset");let f=!(!r.terrain||!r.terrain.enabled),m={painter:r,sourceCache:a,layer:n,coords:o,colorMode:u,elevationType:p,terrainEnabled:f,pass:d};if("shadow"===r.renderPass)return void(r.shadowRenderer&&"road"===p&&!f&&function(i){let{painter:r,sourceCache:a,layer:n,coords:o}=i,s=r.context.gl,l=i.painter.shadowRenderer;for(let i of o){let o=a.getTile(i),h=o.getBucket(n);if(!h)continue;let u=h.elevatedStructures;if(!u||!u.shadowCasterSegments||0===u.shadowCasterSegments.segments[0].primitiveLength)continue;r.prepareDrawTile();let c=h.bufferData.programConfigurations.get(n.id),d=r.isTileAffectedByFog(i),p=r.getOrCreateProgram("elevatedStructuresDepth",{config:c,overrideFog:d}),f=l.calculateShadowPassMatrixFromTile(o.tileID.toUnwrapped());r.uploadCommonUniforms(r.context,p,i.toUnwrapped());let m=aQ(f,0);p.draw(r,s.TRIANGLES,l.getShadowPassDepthMode(),iK.disabled,iY.disabled,iQ.disabled,m,n.id,u.vertexBuffer,u.indexBuffer,u.shadowCasterSegments,n.paint,r.transform.zoom,c)}}(m));let _="mrt-fallback"===r.emissiveMode;if("offset"!==p){if(nP(m,!1,_),"road"===p){let i=!f&&"translucent"===r.renderPass;i&&nC(r,a,n,o,"geometry"),nP(m,!0,_,iK.disabled),i&&function(i){let{painter:r,sourceCache:a,layer:n,coords:o,colorMode:s}=i,l=r.context.gl,h=i.painter.shadowRenderer,u=!!h&&h.enabled,c=new iJ(r.context.gl.LEQUAL,iJ.ReadOnly,r.depthRangeFor3D),d=[0,0,0];if(u){let i=r.style.directionalLight,a=r.style.ambientLight;i&&a&&(d=ro(r.style,i,a))}let p=i=>{for(let p of o){let o,f,m=a.getTile(p),_=m.getBucket(n);if(!_)continue;let g=_.elevatedStructures;if(!g||(i?(o=g.renderableBridgeSegments,f=g.bridgeProgramConfigurations.get(n.id)):(o=g.renderableTunnelSegments,f=g.tunnelProgramConfigurations.get(n.id)),!o||0===o.segments[0].primitiveLength))continue;f.updatePaintBuffers(),r.prepareDrawTile();let y=r.isTileAffectedByFog(p),x=[];u&&x.push("RENDER_SHADOWS","NORMAL_OFFSET");let v=r.getOrCreateProgram("elevatedStructures",{config:f,overrideFog:y,defines:x}),b=r.translatePosMatrix(p.projMatrix,m,n.paint.get("fill-translate"),n.paint.get("fill-translate-anchor"));u&&h.setupShadows(m.tileID.toUnwrapped(),v,"vector-tile");let w=a0(b,d);r.uploadCommonUniforms(r.context,v,p.toUnwrapped()),v.draw(r,l.TRIANGLES,c,iK.disabled,s,iQ.backCCW,w,n.id,g.vertexBuffer,g.indexBuffer,o,n.paint,r.transform.zoom,f,[g.vertexBufferNormal])}};p(!0),p(!1)}(m)}}else nP(m,!1,_,r.stencilModeFor3D())},"fill-extrusion":function(r,a,n,o){let s=n.paint.get("fill-extrusion-opacity"),l=r.context,h=l.gl,u=r.terrain,c=u&&u.renderingToTexture;if(0===s)return;let d="mrt-fallback"===r.emissiveMode,p=r.conflationActive&&r.style.isLayerClipped(n,a.getSource()),f=r.style.order.indexOf(n.fqid);if(p&&function(i,r,a,n,o){for(let s of n){let n=r.getTile(s).getBucket(a);n&&(n.updateReplacement(s,i.replacementSource,o),n.uploadCentroid(i.context))}}(r,a,n,o,f),u||p)for(let s of o){let o=a.getTile(s).getBucket(n);o&&function(r,a,n,o,s,l,h){0===o.centroidVertexArray.length&&o.createCentroidsBuffer();let u=l?l.findDEMTileFor(n):null;if(!(u&&u.dem||h))return;l&&u&&u.dem&&o.selfDEMTileTimestamp!==u.dem._timestamp&&(o.borderDoneWithNeighborZ=[-1,-1,-1,-1],o.selfDEMTileTimestamp=u.dem._timestamp);let c=(r,a)=>{(r.flags|a.flags)&i.e5?(r.flags|=i.e5,a.flags|=i.e5):(r.flags&=~i.e5,a.flags&=~i.e5)},d=r=>
111new i.P(Math.ceil((r+i.e6)*i.e7),0),p=(r,a,n)=>{let o=Math.ceil((r+i.e6)*i.e7),s=Math.floor(Math.max(0,Math.min(i.ak-1,n))/4);return new i.P(o,s<<5|(3&a)<<3|7)},f=i=>{let r=a.getSource().minzoom,n=i=>{let r=a.getTileByID(i);if(r&&r.hasData())return r.getBucket(s)};for(let a of[0,-1,1]){if(i.overscaledZ+a<r)continue;let o=n(i.calculateScaledKey(i.overscaledZ+a));if(o)return o}},m=[0,0,0],_=(r,a)=>(m[0]=Math.min(r.min.y,a.min.y),m[1]=Math.max(r.max.y,a.max.y),m[2]=i.ak-a.min.x>r.max.x?a.min.x-i.ak:r.max.x,m),g=(r,a)=>(m[0]=Math.min(r.min.x,a.min.x),m[1]=Math.max(r.max.x,a.max.x),m[2]=i.ak-a.min.y>r.max.y?a.min.y-i.ak:r.max.y,m),y=[(i,r)=>_(i,r),(i,r)=>_(r,i),(i,r)=>g(i,r),(i,r)=>g(r,i)],x=(r,a,o,s,h,c,d)=>{if(!l)return 0;let p=[[c?o:r,c?r:o,0],[c?o:a,c?a:o,0]],f=d<0?i.ak+d:d,m=[c?f:(r+a)/2,c?(r+a)/2:f,0];return 0===o&&d<0||0!==o&&d>0?l.getForTilePoints(h,[m],!0,s):p.push(m),l.getForTilePoints(n,p,!0,u),Math.max(p[0][2],p[1][2],m[2])/l.exaggeration()};for(let r=0;r<4;r++){let a=o.borderFeatureIndices[r];if(0===a.length)continue;let s=i.e2[r](n),u=f(s);if(!(u&&u instanceof i.e3))continue;let m=l?l.findDEMTileFor(s):null;if(!(m&&m.dem||h)||(l&&m&&m.dem&&o.borderDEMTileTimestamp[r]!==m.dem._timestamp&&(o.borderDoneWithNeighborZ[r]=-1,o.borderDEMTileTimestamp[r]=m.dem._timestamp),o.borderDoneWithNeighborZ[r]===u.canonical.z))continue;0===u.centroidVertexArray.length&&u.createCentroidsBuffer();let _=(r<2?1:5)-r,g=u.borderDoneWithNeighborZ[_]!==o.canonical.z,v=u.borderFeatureIndices[_],b=0;if(o.canonical.z!==u.canonical.z){for(let i of a)o.showCentroid(o.featuresOnBorder[i]);if(g)for(let i of v)u.showCentroid(u.featuresOnBorder[i]);o.borderDoneWithNeighborZ[r]=u.canonical.z,u.borderDoneWithNeighborZ[_]=o.canonical.z;continue}let w=new Map,T=new Set,S=new Set;for(let i=0;i<v.length;i++){let r=u.featuresOnBorder[v[i]];void 0!==r.buildingId&&w.set(r.buildingId,i)}for(let n of a){let a=o.featuresOnBorder[n],l=o.centroidData.get(a.centroidDataIndex);if(void 0===a.buildingId)continue;let d=w.get(a.buildingId);if(void 0===d)continue;let f=u.featuresOnBorder[v[d]],g=u.centroidData.get(f.centroidDataIndex);T.add(n),S.add(d),h&&c(l,g);let b=0!==l.groupCentroidPos.x||0!==l.groupCentroidPos.y?l.groupCentroidPos:a.centroid(),E=0!==g.groupCentroidPos.x||0!==g.groupCentroidPos.y?g.groupCentroidPos:f.centroid(),I=r<2?Math.round((b.y+E.y)/2):Math.round((b.x+E.x)/2),A=a.intersectsCount()>1||f.intersectsCount()>1;{let a=0;if(m&&m.dem&&!A){let n=y[r](l,g),o=r%2?i.ak-1:0;a=x(n[0],Math.min(i.ak-1,n[1]),o,m,s,r<2,n[2])}l.centroidXY=p(a,r,I),g.centroidXY=p(a,_,I)}if(o.writeCentroidToBuffer(l),u.writeCentroidToBuffer(g),void 0!==a.buildingId){for(let i of o.centroidData)i.buildingId===a.buildingId&&i!==l&&(i.centroidXY=l.centroidXY,o.writeCentroidToBuffer(i));for(let i of u.centroidData)i.buildingId===a.buildingId&&i!==g&&(i.centroidXY=g.centroidXY,u.writeCentroidToBuffer(i))}}for(let n of a){let a;if(T.has(n))continue;let l=o.featuresOnBorder[n],p=o.centroidData.get(l.centroidDataIndex),f=l.borders[r];for(;b<v.length;){if(S.has(b)){b++;continue}let i=(a=u.featuresOnBorder[v[b]]).borders[_];if(i[1]>f[0]+3||i[0]>f[0]-3)break;u.showCentroid(a),b++}if(a&&b<v.length){let n=b,g=0;for(;;)if(S.has(b)){if(++b===v.length)break;a=u.featuresOnBorder[v[b]]}else{if(a.borders[_][0]>f[1]-3||(g++,++b===v.length))break;a=u.featuresOnBorder[v[b]]}for(;n<v.length&&S.has(n);)n++;if(n>=v.length){o.showCentroid(l);continue}a=u.featuresOnBorder[v[n]];let w=!1;if(g>=1){let i=a.borders[_];3>Math.abs(f[0]-i[0])&&3>Math.abs(f[1]-i[1])&&(g=1,w=!0,b=n+1)}else if(0===g){o.showCentroid(l);continue}let T=u.centroidData.get(a.centroidDataIndex);h&&w&&c(p,T);let E=l.intersectsCount()>1||a.intersectsCount()>1;if(g>1)b=n,p.centroidXY=T.centroidXY=new i.P(0,0);else if(m&&m.dem&&!E){let a=y[r](p,T),n=r%2?i.ak-1:0;p.centroidXY=T.centroidXY=d(x(a[0],Math.min(i.ak-1,a[1]),n,m,s,r<2,a[2]))}else E?p.centroidXY=T.centroidXY=new i.P(0,0):(p.centroidXY=o.encodeBorderCentroid(l),T.centroidXY=u.encodeBorderCentroid(a));o.writeCentroidToBuffer(p),u.writeCentroidToBuffer(T)}else o.showCentroid(l)}o.borderDoneWithNeighborZ[r]=u.canonical.z,u.borderDoneWithNeighborZ[_]=o.canonical.z}(o.needsCentroidUpdate||!o.centroidVertexBuffer&&0!==o.centroidVertexArray.length)&&o.uploadCentroid(r)}(r.context,a,s,o,n,u,p)}if("shadow"===r.renderPass&&r.shadowRenderer){if(u&&s<.65&&n._transitionablePaint._values["fill-extrusion-opacity"].value.expression instanceof i.ac)return;let l=r.shadowRenderer.getShadowPassDepthMode();nR(r,a,n,o,l,iK.disabled,iY.disabled,p)}else if("translucent"===r.renderPass){let f=!n.paint.get("fill-extrusion-pattern").constantOr(1),m=n.paint.get("fill-extrusion-color").constantOr(i.C.white);if(!c&&0!==m.a){let i=new iJ(r.context.gl.LEQUAL,iJ.ReadWrite,r.depthRangeFor3D);1===s&&f?nR(r,a,n,o,i,iK.disabled,iY.unblended,p):(nR(r,a,n,o,i,iK.disabled,iY.disabled,p),nR(r,a,n,o,i,r.stencilModeFor3D(),r.colorModeForRenderPass(),p),r.resetStencilClippingMasks())}if(r.style.enable3dLights()&&f&&(!u&&"globe"!==r.transform.projection.name||c)){let s=n.paint.get("fill-extrusion-opacity"),f=n.paint.get("fill-extrusion-ambient-occlusion-intensity"),m=n.paint.get("fill-extrusion-ambient-occlusion-ground-radius"),_=n.paint.get("fill-extrusion-flood-light-intensity"),g="none"===n.paint.get("fill-extrusion-flood-light-color-use-theme").
111constantOr("default"),y=n.paint.get("fill-extrusion-flood-light-color").toNonPremultipliedRenderColor(g?null:n.lut).toArray01().slice(0,3),x=f>0&&m>0,v=_>0,b=(i,r,a)=>(1-a)*i+a*r,w=new nz;w.translate=n.paint.get("fill-extrusion-translate"),w.translateAnchor=n.paint.get("fill-extrusion-translate-anchor"),w.edgeRadius=n.layout.get("fill-extrusion-edge-radius"),w.cutoffFadeRange=n.paint.get("fill-extrusion-cutoff-fade-range");let T=l=>{let u=r.depthModeForSublayer(1,iJ.ReadOnly,h.LEQUAL,!0),c=b(.1,3,n.paint.get(l?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation")),d=r._showOverdrawInspector;d||nF(w,r,a,n,o,u,new iK({func:h.ALWAYS,mask:255},255,255,h.KEEP,h.KEEP,h.REPLACE),new iY([h.ONE,h.ONE,h.ONE,h.ONE],i.C.transparent,[!1,!1,!1,!0],h.MIN),iQ.disabled,l,"sdf",s,f,m,_,y,c,p,!1);{let g=d?iK.disabled:new iK({func:h.EQUAL,mask:255},255,255,h.KEEP,h.DECR,h.DECR),x=d?r.colorModeForRenderPass():new iY([h.ONE_MINUS_DST_ALPHA,h.DST_ALPHA,h.ONE,h.ONE],i.C.transparent,[!0,!0,!0,!0]);nF(w,r,a,n,o,u,g,x,iQ.disabled,l,"color",s,f,m,_,y,c,p,!1)}};if(c){let c=()=>{let r=u.drapeBufferSize[0],a=u.drapeBufferSize[1],n=u.framebufferCopyTexture;return n&&(!n||n.size[0]===r&&n.size[1]===a)||(n&&n.destroy(),n=u.framebufferCopyTexture=new i.T(l,new i.q({width:r,height:a}),h.RGBA8)),n.bind(h.LINEAR,h.CLAMP_TO_EDGE),h.copyTexSubImage2D(h.TEXTURE_2D,0,0,0,0,0,r,a),n},g=(l,u,g)=>{let x=r.depthModeForSublayer(1,iJ.ReadOnly,h.LEQUAL,!1),v=b(.1,3,n.paint.get(l?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"));{let c=new iY([h.ONE,h.ONE,h.ONE,h.ONE],i.C.transparent,[!1,!1,!1,!0]);nF(w,r,a,n,o,x,iK.disabled,c,iQ.disabled,l,"clear",s,f,m,_,y,v,p,u)}nF(w,r,a,n,o,x,new iK({func:h.ALWAYS,mask:255},255,255,h.KEEP,h.KEEP,h.REPLACE),new iY([h.ONE,h.ONE,h.ONE,h.ONE],i.C.transparent,[!1,!1,!1,!0],h.MIN),iQ.disabled,l,"sdf",s,f,m,_,y,v,p,u),d&&!l&&(g=c());{let c=l?h.ZERO:h.ONE_MINUS_DST_ALPHA;nF(w,r,a,n,o,x,new iK({func:h.EQUAL,mask:255},255,255,h.KEEP,h.DECR,h.DECR),new iY([c,h.DST_ALPHA,h.ONE_MINUS_DST_ALPHA,h.ZERO],i.C.transparent,[!0,!0,!0,!0]),iQ.disabled,l,"color",s,f,m,_,y,v,p,u)}if(!d||l){let c=new iY([h.ONE,h.ONE,h.ONE,l?h.ZERO:h.ONE],i.C.transparent,[!1,!1,!1,!0],l?h.FUNC_ADD:h.MAX);nF(w,r,a,n,o,x,iK.disabled,c,iQ.disabled,l,"clear",s,f,m,_,y,v,p,u,g)}else h.drawBuffers([h.NONE,h.COLOR_ATTACHMENT1]),nF(w,r,a,n,o,x,new iK({func:h.EQUAL,mask:255},254,255,h.KEEP,h.DECR,h.DECR),new iY([h.ONE,h.ONE,h.ONE,h.ONE],i.C.transparent,[!0,!1,!1,!1],h.MAX),iQ.disabled,l,"emissive",s,f,m,_,y,v,p,u,g),h.drawBuffers([h.COLOR_ATTACHMENT0])};if(x||v){let i;r.prepareDrawTile(),d&&!x||(i=c()),x&&g(!0,!1,i),v&&g(!1,!0,i)}}else x&&T(!0),v&&T(!1),(x||v)&&r.resetStencilClippingMasks()}}},hillshade:function(r,a,n,o){if("offscreen"!==r.renderPass&&"translucent"!==r.renderPass||r.style.disableElevatedTerrain)return;let s=r.context,l=r.terrain&&r.terrain.renderingToTexture,[h,u]="translucent"!==r.renderPass||l?[{},o]:r.stencilConfigForOverlap(o);for(let o of u){let s=a.getTile(o);if(s.needsHillshadePrepare&&"offscreen"===r.renderPass)!function(r,a,n){let o=r.context,s=o.gl;if(!a.dem)return;let l=a.dem;if(o.activeTexture.set(s.TEXTURE1),r0(r,a,l),!a.demTexture)return;a.demTexture.bind(s.NEAREST,s.CLAMP_TO_EDGE);let h=l.dim;o.activeTexture.set(s.TEXTURE0);let u=a.hillshadeFBO;if(!u){let r=new i.T(o,{width:h,height:h,data:null},s.RGBA8);r.bind(s.LINEAR,s.CLAMP_TO_EDGE),(u=a.hillshadeFBO=o.createFramebuffer(h,h,1,"renderbuffer")).colorAttachment0.set(r.texture)}o.bindFramebuffer.set(u.framebuffer),o.viewport.set([0,0,h,h]);let{tileBoundsBuffer:c,tileBoundsIndexBuffer:d,tileBoundsSegments:p}=r.getMercatorTileBoundsBuffers(),f=[];r.linearFloatFilteringSupported()&&f.push("TERRAIN_DEM_FLOAT_FORMAT"),r.terrain&&r.terrain.renderingToTexture&&"mrt-fallback"===r.emissiveMode&&f.push("USE_MRT1"),r.getOrCreateProgram("hillshadePrepare",{defines:f}).draw(r,s.TRIANGLES,iJ.disabled,iK.disabled,iY.unblended,iQ.disabled,((r,a)=>{let n=a.stride,o=i.bd();return i.bX(o,0,i.ak,-i.ak,0,0,1),i.bB(o,o,[0,-i.ak,0]),{u_matrix:o,u_image:1,u_dimension:[n,n],u_zoom:r.overscaledZ}})(a.tileID,l),n.id,c,d,p),a.needsHillshadePrepare=!1}(r,s,n);else if("translucent"===r.renderPass){let a=r.depthModeForSublayer(0,iJ.ReadOnly),u=n.paint.get("hillshade-emissive-strength"),c=r.colorModeForDrapableLayerRenderPass(u),d=l&&r.terrain?r.terrain.stencilModeForRTTOverlap(o):h[o.overscaledZ];!function(r,a,n,o,s,l,h){let u=r.context,c=u.gl,d=n.hillshadeFBO;if(!d)return;r.prepareDrawTile();let p=r.isTileAffectedByFog(a),f=[];r.terrain&&r.terrain.renderingToTexture&&"mrt-fallback"===r.emissiveMode&&f.push("USE_MRT1");let m=r.getOrCreateProgram("hillshade",{overrideFog:p,defines:f});u.activeTexture.set(c.TEXTURE0),c.bindTexture(c.TEXTURE_2D,d.colorAttachment0.get());let _=((r,a,n,o)=>{let s=n.paint.get("hillshade-shadow-color"),l="none"===n.paint.get("hillshade-shadow-color-use-theme").
111constantOr("default"),h=n.paint.get("hillshade-highlight-color"),u="none"===n.paint.get("hillshade-highlight-color-use-theme").constantOr("default"),c=n.paint.get("hillshade-accent-color"),d="none"===n.paint.get("hillshade-accent-color-use-theme").constantOr("default"),p=n.paint.get("hillshade-emissive-strength"),f=i.am(n.paint.get("hillshade-illumination-direction"));if("viewport"===n.paint.get("hillshade-illumination-anchor"))f-=r.transform.angle;else if(r.style&&r.style.enable3dLights()&&r.style.directionalLight){let a=r.style.directionalLight.properties.get("direction"),n=i.cT(a.x,a.y,a.z);f=i.am(n[1])}let m=!r.options.moving;return{u_matrix:o||r.transform.calculateProjMatrix(a.tileID.toUnwrapped(),m),u_image:0,u_latrange:function(r,a){let n=Math.pow(2,a.canonical.z),o=a.canonical.y;return[new i.ad(0,o/n).toLngLat().lat,new i.ad(0,(o+1)/n).toLngLat().lat]}(0,a.tileID),u_light:[n.paint.get("hillshade-exaggeration"),f],u_shadow:s.toPremultipliedRenderColor(l?null:n.lut),u_highlight:h.toPremultipliedRenderColor(u?null:n.lut),u_emissive_strength:p,u_accent:c.toPremultipliedRenderColor(d?null:n.lut)}})(r,n,o,r.terrain?a.projMatrix:null);r.uploadCommonUniforms(u,m,a.toUnwrapped());let{tileBoundsBuffer:g,tileBoundsIndexBuffer:y,tileBoundsSegments:x}=r.getTileBoundsBuffers(n);m.draw(r,c.TRIANGLES,s,l,h,iQ.disabled,_,o.id,g,y,x)}(r,o,s,n,a,d,c)}}s.viewport.set([0,0,r.width,r.height]),r.resetStencilClippingMasks()},raster:function(r,a,n,o,s,l){if("translucent"!==r.renderPass)return;let h=n.paint.get("raster-opacity");if(0===h)return;let u="globe"===r.transform.projection.name,c=0!==n.paint.get("raster-elevation"),d=c&&u,p=r.terrain&&r.terrain.exaggeration()>0&&c&&"ground"===n.paint.get("raster-elevation-reference"),f=!u&&p;if(r.renderElevatedRasterBackface&&!d)return;let m=r.context,_=m.gl,g=a.getSource(),y=function(r,a,n,o,s){let l=a.paint.get("raster-color"),h="raster-array"===r.type,u=[],c=a.paint.get("raster-resampling"),d=a.paint.get("raster-color-mix"),p=a.paint.get("raster-color-range"),f=[d[0],d[1],d[2],0],m=d[3],_="nearest"===c?o.NEAREST:o.LINEAR;if(h&&(u.push("RASTER_ARRAY"),l||u.push("RASTER_COLOR"),"linear"===c&&u.push("RASTER_ARRAY_LINEAR"),_=o.NEAREST,!p&&r.rasterLayers)){let i=r.rasterLayers.find(({id:i})=>i===a.sourceLayer);i&&i.fields&&i.fields.range&&(p=i.fields.range)}if(p=p||[0,1],l){u.push("RASTER_COLOR"),n.activeTexture.set(o.TEXTURE2),a.updateColorRamp(p);let r=a.colorRampTexture;r||(r=a.colorRampTexture=new i.T(n,a.colorRamp,o.RGBA8)),r.bind(_,o.CLAMP_TO_EDGE)}return s&&u.push("USE_MRT1"),{mix:f,range:p,offset:m,defines:u,resampling:_}}(g,n,m,_,r.terrain&&r.terrain.renderingToTexture&&"mrt-fallback"===r.emissiveMode);if(g instanceof i.aY&&!o.length&&!u)return;let x=n.paint.get("raster-emissive-strength"),v=r.colorModeForDrapableLayerRenderPass(x),b=r.terrain&&r.terrain.renderingToTexture,w=!r.options.moving,T="nearest"===n.paint.get("raster-resampling")?_.NEAREST:_.LINEAR;if(g instanceof i.aY&&!o.length&&(g.onNorthPole||g.onSouthPole)){let i=c?r.stencilModeFor3D():iK.disabled;return void oo(!!g.onNorthPole,null,r,a,n,x,y,iQ.disabled,i)}if(!o.length)return;let[S,E]=g instanceof i.aY||b?[{},o]:r.stencilConfigForOverlap(o),I=E.at(-1).overscaledZ;d&&y.defines.push("PROJECTION_GLOBE_VIEW"),c&&y.defines.push("RENDER_CUTOFF","ELEVATED"),p&&y.defines.push("ELEVATION_REFERENCE_GROUND");let A=(o,s,E)=>{for(let A of o){let o,M,C,P,D,R=A.toUnwrapped(),z=a.getTile(A);if(b&&(!z||!z.hasData()))continue;m.activeTexture.set(_.TEXTURE0);let L=function(i,r,a,n){if(i)return r instanceof tQ&&i instanceof t4?r.getTextureDescriptor(i,a,!0):{texture:i.texture,mix:on(n.mix),offset:n.offset,buffer:0,tileSize:1}}(z,g,n,y);if(!L||!L.texture)continue;let{texture:F,mix:O,offset:B,tileSize:k,buffer:N}=L;b?(o=iJ.disabled,M=A.projMatrix):c?(o=new iJ(_.LEQUAL,iJ.ReadWrite,r.depthRangeFor3D),M=u?r.transform.expandedFarZProjMatrix:r.transform.calculateProjMatrix(R,w)):(o=r.depthModeForSublayer(A.overscaledZ-I,1===h?iJ.ReadWrite:iJ.ReadOnly,_.LESS),M=r.transform.calculateProjMatrix(R,w));let U=r.terrain&&b?r.terrain.stencilModeForRTTOverlap(A):S[A.overscaledZ],V=l?0:n.paint.get("raster-fade-duration");z.registerFadeDuration(V);let j=a.findLoadedParent(A,0),G=aF(z,j,a,r.transform,V);!G.isFading&&z.refreshedUponExpiration&&(z.refreshedUponExpiration=!1),r.terrain&&r.terrain.prepareDrawTile(),m.activeTexture.set(_.TEXTURE0),F.bind(T,_.CLAMP_TO_EDGE),m.activeTexture.set(_.TEXTURE1),j?(j.texture&&j.texture.bind(T,_.CLAMP_TO_EDGE),C=Math.pow(2,j.tileID.overscaledZ-z.tileID.overscaledZ
111),P=[z.tileID.canonical.x*C%1,z.tileID.canonical.y*C%1]):F.bind(T,_.CLAMP_TO_EDGE),"useMipmap"in F&&m.extTextureFilterAnisotropic&&r.transform.pitch>20&&_.texParameterf(_.TEXTURE_2D,m.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,m.extTextureFilterAnisotropicMax);let H=r.transform,$=c?function(i){if(i.isOrthographic)return[0,0,0,0];let r=i._nearZ,a=i.projection.farthestPixelDistance(i),n=a-r,o=.2*i.height,s=r+o;return[r,a,(s-o-r)/n,(s-r)/n]}(H):[0,0,0,0],q,Z,W,X,Y,J=0;if(d&&g instanceof i.aY&&g.coordinates.length>3)q=Float32Array.from(i.dx(i.dy(new i.cp(0,0,0)))),Z=Float32Array.from(H.globeMatrix),W=Float32Array.from(i.dt(H)),X=[i.aG(H.center.lng),i.aJ(H.center.lat)],D=g.elevatedGlobePerspectiveTransform,Y=g.elevatedGlobeGridMatrix||new Float32Array(9);else if(d){let r=i.du(A.canonical);J=i.dv(r.getCenter().lat),q=Float32Array.from(i.dx(i.dy(A.canonical))),Z=Float32Array.from(H.globeMatrix),W=Float32Array.from(i.dt(H)),X=[i.aG(H.center.lng),i.aJ(H.center.lat)],D=[0,0],Y=Float32Array.from(i.dw(A.canonical,r,J,H.worldSize/H._pixelsPerMercatorPixel))}else D=g instanceof i.aY?g.perspectiveTransform:[0,0],q=new Float32Array(16),Z=new Float32Array(9),W=new Float32Array(16),X=[0,0],Y=new Float32Array(9);let K=ne(r,M,q,Z,W,Y,P||[0,0],i.ai(r.transform.zoom),X,$,C||1,G,n,D,c?n.paint.get("raster-elevation"):0,2,O,B,y.range,k,N,x),Q=r.isTileAffectedByFog(A),ee=r.getOrCreateProgram("raster",{defines:y.defines,overrideFog:Q});if(r.uploadCommonUniforms(m,ee,R),g instanceof i.aY){let a=g.elevatedGlobeVertexBuffer,l=g.elevatedGlobeIndexBuffer;if(b||!u)g.boundsBuffer&&g.boundsSegments&&ee.draw(r,_.TRIANGLES,o,iK.disabled,v,iQ.disabled,K,n.id,g.boundsBuffer,r.quadTriangleIndexBuffer,g.boundsSegments);else if(a&&l){let h=H.zoom<=i.cN?g.elevatedGlobeSegments:g.getSegmentsForLongitude(H.center.lng);h&&ee.draw(r,_.TRIANGLES,o,iK.disabled,v,s,K,n.id,a,l,h)}}else if(d){o=new iJ(_.LEQUAL,iJ.ReadOnly,r.depthRangeFor3D);let i=r.globeSharedBuffers;if(i){p&&(r.terrain.setupElevationDraw(z,ee),r.uploadCommonUniforms(m,ee,z.tileID.toUnwrapped()));let[a,l,h]=i.getGridBuffers(J,!1),u=ee.getAttributeLocation(_,"a_texture_pos");-1!==u&&_.vertexAttribI4ui(u,0,0,0,0),ee.draw(r,_.TRIANGLES,o,E||U,r.colorModeForRenderPass(),s,K,n.id,a,l,h)}}else if(f)o=new iJ(_.LEQUAL,iJ.ReadWrite,r.depthRangeFor3D),r.terrain.setupElevationDraw(z,ee),r.uploadCommonUniforms(m,ee,z.tileID.toUnwrapped()),H.pitch>20&&ee.draw(r,_.TRIANGLES,o,iK.disabled,iY.disabled,iQ.frontCCW,K,n.id,r.terrain.gridBuffer,r.terrain.gridIndexBuffer,r.terrain.gridSegments),ee.draw(r,_.TRIANGLES,o,U,v,iQ.backCCW,K,n.id,r.terrain.gridBuffer,r.terrain.gridIndexBuffer,r.terrain.gridSegments);else{let{tileBoundsBuffer:i,tileBoundsIndexBuffer:a,tileBoundsSegments:s}=r.getTileBoundsBuffers(z);ee.draw(r,_.TRIANGLES,o,U,v,iQ.disabled,K,n.id,i,a,s)}}if(!(g instanceof i.aY)&&d)for(let i of o){let o=i.canonical.y===(1<<i.canonical.z)-1;0===i.canonical.y&&oo(!0,i,r,a,n,x,y,s,E||iK.disabled),o&&oo(!1,i,r,a,n,x,y,s===iQ.frontCW?iQ.backCW:iQ.frontCW,E||iK.disabled)}};d?A(E,r.renderElevatedRasterBackface?iQ.backCW:iQ.frontCW,r.stencilModeFor3D()):A(E,iQ.disabled,void 0),r.resetStencilClippingMasks()},background:function(r,a,n,o){let s,l=n.paint.get("background-color"),h="none"===n.paint.get("background-color-use-theme").constantOr("default"),u=n.paint.get("background-opacity"),c=n.paint.get("background-emissive-strength"),d="viewport"===n.paint.get("background-pitch-alignment");if(0===u)return;let p=r.context,f=p.gl,m=r.transform,_=m.tileSize,g=n.paint.get("background-pattern");if(void 0!==g&&(null===g||!(s=r.imageManager.getPattern(i.I.from(g.toString()),n.scope,r.style.getLut(n.scope)))))return;let y=!g&&1===l.a&&1===u&&r.opaquePassEnabledForLayer()?"opaque":"translucent";if(r.renderPass!==y)return;let x=iK.disabled,v=r.depthModeForSublayer(0,"opaque"===y?iJ.ReadWrite:iJ.ReadOnly),b=r.colorModeForDrapableLayerRenderPass(c),w=g?"backgroundPattern":"background",T,S=o;S||(S=Object.values(T=r.getBackgroundTiles()).map(i=>i.tileID)),g&&(p.activeTexture.set(f.TEXTURE0),r.imageManager.bind(r.context,n.scope));let E=[];if(r.terrain&&r.terrain.renderingToTexture&&"mrt-fallback"===r.emissiveMode&&E.push("USE_MRT1"),d){let a=r.getOrCreateProgram(w,{overrideFog:!1,overrideRtt:!0,defines:E}),o=new i.aU(0,0,0,0,0),p=g?na(os,c,u,r,0,n.scope,s,d,{tileID:o,tileSize:_}):nr(os,c,u,l.toPremultipliedRenderColor(h?null:n.lut));return void a.draw(r,f.TRIANGLES,v,x,b,iQ.disabled,p,n.id,r.viewportBuffer,r.quadTriangleIndexBuffer,r.viewportSegments)}for(let y of S){let S=r.isTileAffectedByFog(y),I=r.getOrCreateProgram(w,{overrideFog:S,defines:E}),A=y.toUnwrapped(),M=o?y.projMatrix:r.transform.calculateProjMatrix(A);r.prepareDrawTile();let C=a?a.getTile(y):T?T[y.key]:new i.b3(y,_,m.zoom,r),P=g?na(M,c,u,r,0,n.scope,s,d,{tileID:y,tileSize:_}):nr(M,c,u,l.toPremultipliedRenderColor(h?null:n.lut));r.uploadCommonUniforms(p,I,A);let{tileBoundsBuffer:D,tileBoundsIndexBuffer:R,tileBoundsSegments:z}=r.getTileBoundsBuffers(C);I.draw(r,f.TRIANGLES,v,x,b,iQ.disabled,P,n.id,D,R,z)}},sky:function(r,a,n){let o=r._atmosphere?i.ai(r.transform.zoom):1,s=n.paint.get("sky-opacity")*o;if(0===s)return;let l=r.context,h=n.paint.get("sky-type"),u=new iJ(l.gl.LEQUAL,iJ.ReadOnly,[0,1]),c=r.frameCounter/1e3%1;"atmosphere"===h?"offscreen"===r.renderPass?n.needsSkyboxCapture(r)&&(function(r,a){let n=r.context,o=n.gl,s=a.skyboxFbo;if(!s){s=a.skyboxFbo=n.createFramebuffer(32,32,1,null),a.skyboxGeometry=new oy(n),a.skyboxTexture=n.gl.createTexture(),o.bindTexture(o.TEXTURE_CUBE_MAP,a.skyboxTexture),o.texParameteri(o.TEXTURE_CUBE_MAP,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_CUBE_MAP,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texParameteri(o.TEXTURE_CUBE_MAP,o.TEXTURE_MIN_FILTER,o.LINEAR),o.texParameteri(o.TEXTURE_CUBE_MAP,o.TEXTURE_MAG_FILTER,o.LINEAR);for(let i=0;i<6;++i)o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+i,0,o.RGBA,32,32,0,o.RGBA,o.UNSIGNED_BYTE,null)}n.bindFramebuffer.set(s.framebuffer),n.viewport.set([0,0,32,32]);let l=a.getCenter(r,!0),h=r.getOrCreateProgram("skyboxCapture"),u=new Float64Array(16);i.en(u,-(.5*Math.PI)),ox(r,a,h,u,l,0),i.en(u,.5*Math.PI),ox(r,a,h,u,l,1),i.eo(u,-(.5*Math.PI)),ox(r,a,h,u,l,2),i.eo(u,.5*Math.PI),ox(r,a,h,u,l,3),i.bA(u),ox(r,a,h,u,l,4),i.en(u,Math.PI),ox(r,a,h,u,l,5),n.viewport.set([0,0,r.width,r.height])}(r,n),n.markSkyboxValid(r)):"sky"===r.renderPass&&function(i,r,a,n,o){let s,l=i.context,h=l.gl,u=i.transform,c=i.getOrCreateProgram("skybox");l.activeTexture.set(h.TEXTURE0),h.bindTexture(h.TEXTURE_CUBE_MAP,r.skyboxTexture);let d=(s=u.skyboxMatrix,{u_matrix:s,u_sun_direction:r.getCenter(i,!1),u_cubemap:0,u_opacity:n,u_temporal_offset:o});i.uploadCommonUniforms(l,c),c.draw(i,h.TRIANGLES,a,iK.disabled,i.colorModeForRenderPass(),iQ.backCW,d,"skybox",r.skyboxGeometry.vertexBuffer,r.skyboxGeometry.indexBuffer,r.skyboxGeometry.segment)}(r,n,u,s,c):"gradient"===h&&"sky"===r.renderPass&&function(r,a,n,o,s){let l,h,u,c=r.context,d=c.gl,p=r.transform,f=r.getOrCreateProgram("skyboxGradient");a.skyboxGeometry||(a.skyboxGeometry=new oy(c)),c.activeTexture.set(d.TEXTURE0);let m=a.colorRampTexture;m||(m=a.colorRampTexture=new i.T(c,a.colorRamp,d.RGBA8)),m.bind(d.LINEAR,d.CLAMP_TO_EDGE);let _=(l=p.skyboxMatrix,h=a.getCenter(r,!1),u=a.paint.get("sky-gradient-radius"),{u_matrix:l,u_color_ramp:0,u_center_direction:h,u_radius:i.am(u),u_opacity:o,u_temporal_offset:s});r.uploadCommonUniforms(c,f),f.draw(r,d.TRIANGLES,n,iK.disabled,r.colorModeForRenderPass(),iQ.backCW,_,"skyboxGradient",a.skyboxGeometry.vertexBuffer,a.skyboxGeometry.indexBuffer,a.skyboxGeometry.segment)}(r,n,u,s,c)},custom:function(r,a,n,o){let s=r.context,l=n.implementation;if(!r.transform.projection.unsupportedLayers||!r.transform.projection.unsupportedLayers.includes("custom")||r.terrain&&(r.terrain.renderingToTexture||"offscreen"===r.renderPass)&&n.isDraped(a)){if("offscreen"===r.renderPass){let a=l.prerender;if(a){if(r.setCustomLayerDefaults(),s.setColorMode(r.colorModeForRenderPass()),"globe"===r.transform.projection.name){let n=r.transform.pointMerc;a.call(l,s.gl,r.transform.customLayerMatrix(),r.transform.getProjection(),r.transform.globeToMercatorMatrix(),i.ai(r.transform.zoom),[n.x,n.y],r.transform.pixelsPerMeterRatio)}else a.call(l,s.gl,r.transform.customLayerMatrix());s.setDirty(),r.setBaseState()}}else if("translucent"===r.renderPass){if(r.terrain&&r.terrain.renderingToTexture){let i=l.renderToTile;if(i){let a=o[0].canonical,n={x:a.x+o[0].wrap*(l.wrapTileId?0:1<<a.z),y:a.y,z:a.z};s.setDepthMode(iJ.disabled),s.setStencilMode(iK.disabled),s.setColorMode(r.colorModeForRenderPass()),r.setCustomLayerDefaults(),i.call(l,s.gl,n),s.setDirty(),r.setBaseState()}return}r.setCustomLayerDefaults(),s.setColorMode(r.colorModeForRenderPass()),s.setStencilMode(iK.disabled);let a="3d"===l.renderingMode?new iJ(r.context.gl.LEQUAL,iJ.ReadWrite,r.depthRangeFor3D):r.depthModeForSublayer(0,iJ.ReadOnly);if(s.setDepthMode(a),"globe"===r.transform.projection.name){let a=r.transform.pointMerc;l.render(s.gl,r.transform.customLayerMatrix(),r.transform.getProjection(),r.transform.globeToMercatorMatrix(),i.ai(r.transform.zoom),[a.x,a.y],r.transform.pixelsPerMeterRatio)}else l.render(s.gl,r.transform.customLayerMatrix());s.setDirty(),r.setBaseState(),s.bindFramebuffer.set(null)}}else i.w("Custom layers are not yet supported with this projection. Use mercator or globe to enable usage of custom layers.")},model:function(r,a,n,o){if("opaque"===r.renderPass)return;let s=n.paint.get("model-opacity").constantOr(1),l=n.paint.get("model-elevation-reference"),h="ground"===l,u="ground"===l;if(0===s)return;let c=n.paint.get("model-cast-shadows");
111if("shadow"===r.renderPass&&(!c||r.terrain&&s<.65&&n._transitionablePaint._values["model-opacity"].value.expression instanceof i.ac))return;let d=r.shadowRenderer,p=n.paint.get("model-receive-shadows");d&&(d.useNormalOffset=!0,p||(d.enabled=!1));let f=()=>{d&&(d.useNormalOffset=!0,p||(d.enabled=!0))},m=a.getSource();if("light-beam"===r.renderPass&&"batched-model"!==m.type)return;if("vector"===m.type||"geojson"===m.type)return function(r,a,n,o,s){let l=r.transform,h="globe"===l.projection.name,u=l.getFreeCameraOptions().position;if(!r.modelManager)return;let c=r.modelManager;n.modelManager=c;let d=r.shadowRenderer;if(!Object.hasOwn(n._unevaluatedLayout._values,"model-id"))return;let p=n._unevaluatedLayout._values["model-id"],f=Object.assign({},n.layout.get("model-id").parameters),m=r.style.order.indexOf(n.fqid),_=n.paint.get("model-opacity").constantOr(1);for(let g of o){let o=a.getTile(g).getBucket(n);if(!o||o.projection.name!==l.projection.name)continue;let y=o.getModelUris();(y&&!o.modelsRequested&&(c.addModelsFromBucket(y,s),o.modelsRequested=!0),h)?f.zoom=g.overscaledZ:f.zoom=function(r,a){let n=1<<r.canonical.z,o=a.getFreeCameraOptions().position,s=a.elevation,l=r.canonical.x/n,h=(r.canonical.x+1)/n,u=r.canonical.y/n,c=(r.canonical.y+1)/n,d=a._centerAltitude;if(s){let i=s.getMinMaxForTile(r);i&&i.max>d&&(d=i.max)}let p=i.aB(o.x,l,h)-o.x,f=i.aB(o.y,u,c)-o.y,m=i.bY(d,a.center.lat)-o.z;return a._zoomFromMercatorZ(Math.sqrt(p*p+f*f+m*m))}(g,l);let x=p.possiblyEvaluate(f);if(function(r,a,n){let o=a.updateZoomBasedPaintProperties(),s=function(r,a,n){let o,s,l,h=r.terrain?r.terrain.exaggeration():0;if(r.terrain&&h>0){let a=r.terrain,s=a.findDEMTileFor(n);s&&s.dem?o=i.eF.create(a,n,s):h=0}if(0===h&&(a.terrainElevationMin=0,a.terrainElevationMax=0),h===a.validForExaggeration&&(0===h||o&&o._demTile&&o._demTile.tileID===a.validForDEMTile.id&&o._dem._timestamp===a.validForDEMTile.timestamp))return!1;for(let i in a.instancesPerModel){let r=a.instancesPerModel[i];for(let i=0;i<r.instancedDataArray.length;++i){let n=(o?h*o.getElevationAt(0|r.instancedDataArray.float32[16*i],0|r.instancedDataArray.float32[16*i+1],!0,!0):0)+r.instancesEvaluatedElevation[i];r.instancedDataArray.float32[16*i+6]=n,s=s?Math.min(a.terrainElevationMin,n):n,l=l?Math.max(a.terrainElevationMax,n):n}}return a.terrainElevationMin=s||0,a.terrainElevationMax=l||0,a.validForExaggeration=h,a.validForDEMTile=o&&o._demTile?{id:o._demTile.tileID,timestamp:o._dem._timestamp}:{id:void 0,timestamp:0},!0}(r,a,n);(o||s)&&(a.uploaded=!1,a.upload(r.context))}(r,o,g),ok.shadowUniformsInitialized=!1,ok.useSingleShadowCascade=!!d&&0===d.getMaxCascadeForTile(g.toUnwrapped()),"shadow"===r.renderPass&&d){if(1===r.currentShadowCascade&&o.isInsideFirstShadowMapFrustum)continue;let a=l.calculatePosMatrix(g.toUnwrapped(),l.worldSize);if(ok.tileMatrix.set(a),ok.shadowTileMatrix.set(d.calculateShadowPassMatrixFromMatrix(a)),ok.aabb.min=[0,0,0],ok.aabb.max[0]=ok.aabb.max[1]=i.ak,ok.aabb.max[2]=0,function(r,a,n,o){if(!n.modelManager)return!0;let s=n.modelManager;if(!n.shadowRenderer)return!0;let l=n.shadowRenderer,h=a.aabb,u=!0,c=r.maxHeight;if(0===c){let i=0;for(let a in r.instancesPerModel){let r=s.getModel(a,o);r?i=Math.max(i,Math.max(Math.max(r.aabb.max[0],r.aabb.max[1]),r.aabb.max[2])):u=!1}c=r.maxScale*i*1.41+r.maxVerticalOffset,u&&(r.maxHeight=c)}h.max[2]=c,h.min[2]+=r.terrainElevationMin,h.max[2]+=r.terrainElevationMax,i.ae(h.min,h.min,a.tileMatrix),i.ae(h.max,h.max,a.tileMatrix);let d=h.intersects(l.getCurrentCascadeFrustum());return 0===n.currentShadowCascade&&(r.isInsideFirstShadowMapFrustum=2===d),0===d}(o,ok,r,n.scope))continue}let v=1<<g.canonical.z,b=[((u.x-g.wrap)*v-g.canonical.x)*i.ak,(u.y*v-g.canonical.y)*i.ak,u.z*v*i.ak];r.conflationActive&&Object.keys(o.instancesPerModel).length>0&&r.style.isLayerClipped(n,a.getSource())&&o.updateReplacement(g,r.replacementSource,m,n.scope)&&(o.uploaded=!1,o.upload(r.context));let w=0,T=[],S=[],E=[];for(let a in o.instancesPerModel){let l=o.instancesPerModel[a];l.features.length>0&&!h&&(a=x.evaluate(l.features[0].feature,{}));let d=c.getModel(a,s);if(d||c.hasURLBeenRequested(a)||o.modelUris.includes(a)||(o.modelUris.push(a),o.modelsRequested=!1),d&&d.uploaded)if(h){let a=i.bN([],[u.x,u.y,u.z],r.transform.worldSize);i.ew(a,a);for(let n=0;n<l.instancedDataArray.length;++n){let s=[0,0,0],h=[1,1,1],u=i.ex(),c=l.tileCoordinatesForInstance(n),p=l.transformForInstance(n);i.ey(h,p),i.ez(u,p),i.eA(s,u);let f=l.translationForInstance(n),m=new i.aX(0,0);i.eB(o.canonical,m,c.x,c.y);let g=i.bd();i.eC(g,d,r.transform,m,s,h,f,!0,!1,!1);let y=l.colorForInstance(n),x=i.cK([],a),v=i.e8(m.lat,r.transform.zoom),b=i.bT([],[1,1,1/v]);for(let i of(E.push({zScaleMatrix:b,negCameraPosMatrix:x}),d.nodes))oL(r,i,g,r.transform.expandedFarZProjMatrix,w,T,S,d.materialOverrides,_,y);++w}}else for(let i of d.nodes)!function i(r,a,n,o,s,l,h){let u=r.context,c="shadow"===r.renderPass,d=r.shadowRenderer,p=c&&d?d.get
111ShadowPassDepthMode():new iJ(u.gl.LEQUAL,iJ.ReadWrite,r.depthRangeFor3D),f=r.isTileAffectedByFog(l),m="globe"===r.transform.projection.name;if(n.meshes)for(let i of n.meshes){let _,g,y,x=m?[]:["MODEL_POSITION_ON_GPU"],v=[],b=!m&&o.instancedDataArray.length>20;b&&x.push("INSTANCED_ARRAYS");let w=i9(r,a.paint.get("model-cutoff-fade-range"));if(w.shouldRenderCutoff&&x.push("RENDER_CUTOFF"),c&&d)_=r.getOrCreateProgram("modelDepth",{defines:x}),g=ns(h.shadowTileMatrix,h.shadowTileMatrix,n.globalMatrix),y=iY.disabled;else{oD(x,v,i,r,"none"===a.paint.get("model-color-use-theme").constantOr("default")?null:a.lut),_=r.getOrCreateProgram("model",{defines:x,overrideFog:f});let o=i.material,c=o.pbrMetallicRoughness,p=a.paint.get("model-opacity").constantOr(1),m=a.paint.get("model-emissive-strength").constantOr(0);g=no(l.expandedProjMatrix,n.globalMatrix,oM,null,r,p,c.baseColorFactor,o.emissiveFactor,c.metallicFactor,c.roughnessFactor,o,m,a,s),d&&(h.shadowUniformsInitialized?_.setShadowUniformValues(u,d.getShadowUniformValues()):(d.setupShadows(l.toUnwrapped(),_,"model-tile"),h.shadowUniformsInitialized=!0)),y=w.shouldRenderCutoff||p<1||"OPAQUE"!==o.alphaMode?iY.alphaBlended:iY.unblended}r.uploadCommonUniforms(u,_,l.toUnwrapped(),null,w);let T=i.material.doubleSided?iQ.disabled:iQ.backCCW;if(b)v.push(o.instancedDataBuffer),_.draw(r,u.gl.TRIANGLES,p,iK.disabled,y,T,g,a.id,i.vertexBuffer,i.indexBuffer,i.segments,a.paint,r.transform.zoom,void 0,v,o.instancedDataArray.length);else{let n=c?"u_instance":"u_normal_matrix";for(let s=0;s<o.instancedDataArray.length;++s)g[n]=new Float32Array(o.instancedDataArray.arrayBuffer,64*s,16),_.draw(r,u.gl.TRIANGLES,p,iK.disabled,y,T,g,a.id,i.vertexBuffer,i.indexBuffer,i.segments,a.paint,r.transform.zoom,void 0,v)}}if(n.children)for(let u of n.children)i(r,a,u,o,s,l,h)}(r,n,i,l,b,g,ok)}if(h)if("shadow"===r.renderPass){for(let i of S)oF(i.mesh,i.nodeModelMatrix,r,n);for(let i of T)oF(i.mesh,i.nodeModelMatrix,r,n)}else oB(r,n,T,S,E)}}(r,a,n,o,oz(r,n)),void f();if(!m.loaded())return;if("batched-model"===m.type)return function(r,a,n,o){n.resetLayerRenderingStats(r);let s=r.context,l=r.transform,h=r.style.fog,u=r.shadowRenderer;if("mercator"!==l.projection.name)return i.w(`Drawing 3D landmark models for ${l.projection.name} projection is not yet implemented`);let c=r.transform.getFreeCameraOptions().position,d=i.bN([],[c.x,c.y,c.z],r.transform.worldSize),p=i.ew([],d),f=i.cK([],p),m=i.e8(l.center.lat,l.zoom),_=i.bT([],[1,1,1/m]),g=n.paint.get("model-opacity").constantOr(1),y=new iJ(s.gl.LEQUAL,iJ.ReadWrite,r.depthRangeFor3D),x=new iJ(s.gl.LEQUAL,iJ.ReadOnly,r.depthRangeFor3D),v=new i.cY([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),b="shadow"===r.renderPass,w=b&&u?u.getCurrentCascadeFrustum():l.getFrustum(l.scaleZoom(l.worldSize)),T=n.paint.get("model-front-cutoff"),S=T[2]<1,E=i9(r,n.paint.get("model-cutoff-fade-range")),I=n.getLayerRenderingStats();(function(i,r,a,n){let o=i.terrain?i.terrain.exaggeration():0,s=i.transform.zoom;for(let l of n){let n=r.getTile(l).getBucket(a);n&&(n.setFilter(a.filter),i.conflationActive&&n.updateReplacement(l,i.replacementSource),n.evaluateTransform(i,a),i.terrain&&o>0&&n.elevationUpdate(i.terrain,o,l,a.source),n.needsReEvaluation(i,s,a)&&n.evaluate(a))}})(r,a,n,o),function(){let c,p,A,M=new Map;S?(c=o.length-1,p=-1,A=-1):(c=0,p=o.length,A=1);let C=new Float64Array(16),P=i.cg(),D=new i.P(0,0);for(let R=c;R!==p;R+=A){let c=o[R],p=a.getTile(c).getBucket(n);if(!p||!p.uploaded)continue;let A=!1;u&&(A=0===u.getMaxCascadeForTile(c.toUnwrapped()));let z=l.calculatePosMatrix(c.toUnwrapped(),l.worldSize),L=p.modelTraits;!b&&S&&(i.ba(C,z),i.ae(P,d,C),D.x=P[0],D.y=P[1]);let F=[];for(let a of(p.setFilter(n.filter),p.getNodesInfo())){if(a.hiddenByReplacement||!
111a.node.meshes)continue;let n=a.node,o=0;r.terrain&&n.elevation&&(o=n.elevation*r.terrain.exaggeration());let s=(()=>{let r=a.aabb;return v.min=[...r.min],v.max=[...r.max],v.min[2]+=o,v.max[2]+=o,i.ae(v.min,v.min,z),i.ae(v.max,v.max,z),v})(),h=a.evaluatedScale;if(h[0]<=1&&h[1]<=1&&h[2]<=1&&0===s.intersects(w))continue;if(!b){let n=s.min,o=s.max;oC[0]=.5*(n[0]+o[0]),oC[1]=.5*(n[1]+o[1]),oC[2]=.5*(n[2]+o[2]),function(i,r,a,n){let o=i.node;if(o.lodMeshes&&o.lodMeshes.length>0)if(i.targetLod<0)i.targetLod=+(r>n);else{let o=a/1e3;i.targetLod=r>n?Math.min(i.targetLod+o,1):Math.max(i.targetLod-o,0)}else i.targetLod=0}(a,i.bh(d,oC)*m,Math.min(r._debugParams.dt,1e3/30),r._debugParams.lodSwitchDistance)}if(!b&&S){let r=1/6;a.cameraCollisionOpacity=d[0]>s.min[0]&&d[0]<s.max[0]&&d[1]>s.min[1]&&d[1]<s.max[1]&&d[2]*m<s.max[2]&&n.footprint&&i.bG(D,n.footprint)?Math.max(a.cameraCollisionOpacity-r,0):Math.min(1,a.cameraCollisionOpacity+r)}let u=[...z],p=1/i.cW(c.canonical),f=n.anchor?n.anchor[0]:0,_=n.anchor?n.anchor[1]:0;i.bB(u,u,[f*(h[0]-1)+a.evaluatedTranslation[0]*p,_*(h[1]-1)+a.evaluatedTranslation[1]*p,o+a.evaluatedTranslation[2]]),i.c6(h,i.eE)||i.cE(u,u,h);let y=i.aC([],u,n.globalMatrix),x=i.aC([],l.expandedFarZProjMatrix,y),I=i.aC([],l.expandedFarZProjMatrix,u),A=i.aD([],[f,_,o,1],x)[2];n.hidden=!1;let M=g;b||(S&&(M*=a.cameraCollisionOpacity*function(r,a,n,o){if(a.pitch<20)return 1;let s=a.getWorldToCameraMatrix();i.aC(s,s,r);let l=i.bw(n.min[0],n.min[1],n.min[2],1),h=i.aD(i.bI(),l,s),u=h,c=h;l[1]=n.max[1],u=(h=i.aD(i.bI(),l,s))[1]<u[1]?h:u,c=h[1]>c[1]?h:c,l[0]=n.max[0],u=(h=i.aD(i.bI(),l,s))[1]<u[1]?h:u,c=h[1]>c[1]?h:c,l[1]=n.min[1],u=(h=i.aD(i.bI(),l,s))[1]<u[1]?h:u,c=h[1]>c[1]?h:c;let d=i.aB(o[0],0,1),p=100*a.pixelsPerMeter*i.aB(o[1],0,1),f=i.aB(o[2],0,1),m=i.eG(i.bI(),u,c,d),_=Math.tan(.5*a.fovX),g=-m[2]*_;if(0===p)return m[1]<-Math.abs(g)?f:1;let y=(-Math.abs(g)-m[1])/p,x=(i,r,a)=>(1-a)*i+a*r,v=i.aB(x(1,f,y),f,1);return x(1,v,i.aB((a.pitch-20)/20,0,1))}(u,l,a.aabb,T)),M*=function(r,a){let n=r.uniformValues.u_cutoff_params[0],o=r.uniformValues.u_cutoff_params[1],s=r.uniformValues.u_cutoff_params[2],l=r.uniformValues.u_cutoff_params[3];return o===n||l===s?1:i.aB(((a-n)/(o-n)-s)/(l-s),0,1)}(E,A)),0!==M?F.push({nodeInfo:a,depth:A,opacity:M,wvpForNode:x,wvpForTile:I,nodeModelMatrix:y,tileModelMatrix:u}):n.hidden=!0}for(let a of(b||F.sort((i,r)=>S&&(1!==i.opacity||1!==r.opacity)?1===i.opacity?-1:1===r.opacity?1:i.depth>r.depth?-1:1:i.depth<r.depth?-1:1),F)){let o=a.nodeInfo,c=o.node;if(r._debugParams.show3DModelFootprints&&c.footprint){let i=c.id||c.name||"footprint";M.has(i)||M.set(i,{node:c,mvp:a.wvpForTile})}i.aC(oE,_,a.tileModelMatrix),i.aC(oE,f,oE),i.ba(oI,oE),i.e9(oI,oI),i.cE(oI,oI,oN),i.aC(oE,oE,c.globalMatrix);let d="light-beam"===r.renderPass,p="none"===n.paint.get("model-color-use-theme").constantOr("default"),m=L&i.eH.HasMapboxMeshFeatures,g=m?0:o.evaluatedRMEA[0][2],v=o.targetLod,w=c.lodMeshes&&c.lodMeshes.length>0,T=w&&v>0&&v<1;if(b&&w&&1===Math.round(v))continue;let S=T?2:1,E=w&&1===Math.round(v);for(let i=0;i<S;++i){let f=T?1===i:E,_=f?c.lodMeshes:c.meshes,w=T?f?-v:1-v:1;for(let i=0;i<_.length;++i){let v,S=_[i],E=!f&&i===c.lightMeshIndex,M=a.wvpForNode;if(E){if(!d&&!r.terrain&&r.shadowRenderer){r.currentLayer<r.firstLightBeamLayer&&(r.firstLightBeamLayer=r.currentLayer);continue}M=a.wvpForTile}else if(d)continue;let C={defines:[]},P=[];if(!b&&u&&(u.useNormalOffset=!!S.normalBuffer),oD(C.defines,P,S,r,p?null:n.lut),m||C.defines.push("DIFFUSE_SHADED"),A&&C.defines.push("SHADOWS_SINGLE_CASCADE"),I&&(b?I.numRenderedVerticesInShadowPass+=S.vertexArray.length:I.numRenderedVerticesInTransparentPass+=S.vertexArray.length),b){oF(S,a.nodeModelMatrix,r,n);continue}let D=null;if(h&&(D=oP(oA,a.nodeModelMatrix,r.transform),"globe"!==l.projection.name)){let i=S.aabb.min,r=S.aabb.max,[a,n]=h.getOpacityForBounds(D,i[0],i[1],r[0],r[1]);C.overrideFog=a>=.05||n>=.05}let R=S.material;R.occlusionTexture&&R.occlusionTexture.offsetScale&&(v=R.occlusionTexture.offsetScale,C.defines.push("OCCLUSION_TEXTURE_TRANSFORM")),T&&C.defines.push("DITHERED_DISCARD");let z=r.getOrCreateProgram("model",C);
111!b&&u&&u.setupShadowsFromMatrix(a.tileModelMatrix,z,u.useNormalOffset),r.uploadCommonUniforms(s,z,null,D);let L=R.pbrMetallicRoughness;L.metallicFactor=.9,L.roughnessFactor=.5;let F=no(M,oE,oI,c.globalMatrix,r,a.opacity,L.baseColorFactor,R.emissiveFactor,L.metallicFactor,L.roughnessFactor,R,g,n,[0,0,0],v,void 0,void 0,w);!E&&(o.hasTranslucentParts||a.opacity<1)&&z.draw(r,s.gl.TRIANGLES,y,iK.disabled,iY.disabled,iQ.backCCW,F,n.id,S.vertexBuffer,S.indexBuffer,S.segments,n.paint,r.transform.zoom,void 0,P),z.draw(r,s.gl.TRIANGLES,E?x:y,iK.disabled,E||a.opacity<1||o.hasTranslucentParts?iY.alphaBlended:iY.unblended,iQ.backCCW,F,n.id,S.vertexBuffer,S.indexBuffer,S.segments,n.paint,r.transform.zoom,void 0,P)}}}}if(r._debugParams.show3DModelFootprints&&M.size>0)for(let i of Array.from(M.keys()).sort()){let{node:a,mvp:n}=M.get(i);oO(r,0,a,n)}}()}(r,a,n,o),void f();if("model"!==m.type)return;let _=m.getModels(),g=[],y=r.transform.getFreeCameraOptions().position,x=i.bN([],[y.x,y.y,y.z],r.transform.worldSize);i.ew(x,x);let v=[],b=[],w=0;for(let o of _){let s=a.getFeatureState("",o.id),l={type:"Unknown",id:o.id,properties:o.featureProperties},c=n.paint.get("model-rotation").evaluate(l,s),d=n.paint.get("model-scale").evaluate(l,s),p=n.paint.get("model-translation").evaluate(l,s),f=n.paint.get("model-opacity").evaluate(l,s);(function(i,r,a,n,o,s){for(let l of o){let o=Object.assign({},n);o.part=l;let h={type:"Unknown",id:r,properties:o},u={orientation:i.paint.get("model-rotation").evaluate(h,a)};s.set(l,u)}})(n,o.id,s,o.featureProperties,o.nodeOverrideNames,o.nodeOverrides),function(i,r,a,n,o,s){for(let l of o){let o=Object.assign({},n);o.part=l;let h={type:"Unknown",id:r,properties:o},u={color:i.paint.get("model-color").evaluate(h,a),colorMix:i.paint.get("model-color-mix-intensity").evaluate(h,a),opacity:i.paint.get("model-opacity").evaluate(h,a),emissionStrength:i.paint.get("model-emissive-strength").evaluate(h,a)};s.set(l,u)}}(n,o.id,s,o.featureProperties,o.materialOverrideNames,o.materialOverrides),o.nodeOverrides.size>0&&o.computeBoundsAndApplyParent(),o.computeModelMatrix(r,c,d,p,u,h,!1);let m=i.cK([],x),_=i.e8(o.position.lat,r.transform.zoom),y=i.bT([],[1,1,1/_]);for(let i of(g.push({zScaleMatrix:y,negCameraPosMatrix:m}),o.nodes))oL(r,i,o.matrix,r.transform.expandedFarZProjMatrix,w,v,b,o.materialOverrides,f);w++}if(v.sort((i,r)=>r.depth-i.depth),"shadow"!==r.renderPass){if(r._debugParams.show3DModelFootprints){let a=r.transform.projMatrix,n=new Map,o=(r,o)=>{if(r.footprint){let s=r.id||r.name||"footprint";if(!n.has(s)){let l=i.aC([],a,o);n.set(s,{node:r,mvp:l})}}};for(let i of b)o(i.node,i.modelMatrix);for(let i of v)o(i.node,i.modelMatrix);for(let i of Array.from(n.keys()).sort()){let{node:a,mvp:o}=n.get(i);oO(r,0,a,o)}}oB(r,n,v,b,g),f()}else{for(let i of b)oF(i.mesh,i.nodeModelMatrix,r,n);for(let i of v)oF(i.mesh,i.nodeModelMatrix,r,n);f()}}},oH={line:function(i,r,a){if(i.hasElevatedBuckets=!1,i.hasNonElevatedBuckets=!1,void 0!==i._unevaluatedLayout.getValue("line-elevation-reference")||void 0!==i._unevaluatedLayout.getValue("line-z-offset")){if(r)for(let a of r.getVisibleCoordinates()){let n=r.getTile(a).getBucket(i);if(n&&("none"!==n.elevationType?i.hasElevatedBuckets=!0:i.hasNonElevatedBuckets=!0,i.hasElevatedBuckets&&i.hasNonElevatedBuckets))break}}else i.hasNonElevatedBuckets=!0},model:function(i,r,a){let n=r.getSource();if(n.loaded()){if("vector"===n.type||"geojson"===n.type)return void(a.modelManager&&a.modelManager.upload(a,oz(a,i)));if("batched-model"!==n.type&&"model"===n.type)for(let i of n.getModels())i.upload(a.context)}},raster:function(i,r,a){let n=r.getSource();if(!(n instanceof tQ&&n.loaded()))return;let o=i.sourceLayer||n.rasterLayerIds&&n.rasterLayerIds[0];if(!o)return;let s=i.paint.get("raster-array-band")||n.getInitialBand(o);if(null!=s)for(let a of r.getIds().map(i=>r.getTileByID(i)))a.updateNeeded(i.id,s)&&n.prepareTile(a,o,i.id,s)}},o$={fill:nC},oq={fill:function(i,r,a,n){if(!a.layout||"none"===a.layout.get("fill-elevation-reference")||0===a.paint.get("fill-opacity").constantOr(1))return;let o=i.context.gl,s=new iJ(o.LEQUAL,iJ.ReadOnly,i.depthRangeFor3D),l=new iK({func:o.ALWAYS,mask:255},255,255,o.KEEP,o.KEEP,o.REPLACE),h=i.transform.getFreeCameraOptions().position,u=i.getOrCreateProgram("elevatedStructuresDepthReconstruct");for(let c of n){let n=r.getTile(c),d=n.getBucket(a);if(!d)continue;let p=d.elevatedStructures;if(!p||!p.depthSegments||0===p.depthSegments.segments[0].primitiveLength)continue;let f=nM(c.toUnwrapped(),h),m=a1(i.translatePosMatrix(c.projMatrix,n,a.paint.get("fill-translate"),a.paint.get("fill-translate-anchor")),f,0,1,0);u.draw(i,o.TRIANGLES,s,l,iY.disabled,iQ.disabled,m,a.id,p.vertexBuffer,p.indexBuffer,p.depthSegments,a.paint,i.transform.zoom)}}};class oZ{constructor(r,a,n,o,s){this.context=new np(r,a),this.transform=n,this._tileTextures={},this.frameCopies=[],this.loadTimeStamps=[],this._debugParams={averageFPS:0,fpsHistory:[],fpsWindow:30,dt:0,timeStamp:i.o.now(),continousRedraw:!1,enabledLayers:{},buildingsShowNormals:!1,buildingsDrawGroundAO:!0,buildingsDrawShadowPass:!0,buildingsDrawTranslucentPass:!0,showTerrainProxyTiles:!1,terrainSortTilesHiZFirst:!0,terrainDisableRenderCache:!1,forceEnablePrecipitation:!1,overrideSnowParams:!1,snowParamsOverride:null,snowRevealParamsOverride:null,snowVignetteParam
111sOverride:null,overrideRainParams:!1,rainParamsOverride:null,rainRevealParamsOverride:null,rainVignetteParamsOverride:null,overrideStarsParams:!1,starsParamsOverride:null,show3DModelFootprints:!1,showElevationIdDebug:!1,lodSwitchDistance:3e3},this.occlusionParams=new oj,this.setup(),this.numSublayers=t9.maxUnderzooming+t9.maxOverzooming+1,this.depthEpsilon=1/65536,this.deferredRenderGpuTimeQueries=[],this.gpuTimers={},this.frameCounter=0,this._shadowCullCache=null,this._backgroundTiles={},this.conflationActive=!1,this.replacementSource=new i.eJ,this.longestCutoffRange=0,this.minCutoffZoom=0,this._fogVisible=!1,this._cachedTileFogOpacities={},this._shadowRenderer=new rr(this),this._wireframeDebugCache=new oV,this.renderDefaultNorthPole=!0,this.renderDefaultSouthPole=!0,this.layersWithOcclusionOpacity=[];let l=new i.q({width:1,height:1},Uint8Array.of(0,0,0,0));this.emptyDepthTexture=new i.T(this.context,l,r.RGBA8),this._clippingActiveLastFrame=!1,this.scaleFactor=o,this.maxFrontCutoffRawStart=0,this.worldview=s,this._forceEmissiveMode=!1,this.emissiveMode="constant"}updateTerrain(i,r){let a=!!i&&!!i.terrain&&this.transform.projection.supportsTerrain;if(!(a||this._terrain&&this._terrain.enabled))return;this._terrain||(this._terrain=new aN(this,i));let n=this._terrain;this.transform.elevation=a?n:null,n.update(i,this.transform,r),this.transform.elevation&&!n.enabled&&(this.transform.elevation=null)}_updateFog(i){let r=i.fog;if(!r||"globe"===this.transform.projection.name||1>r.getOpacity(this.transform.pitch)||.03>r.properties.get("horizon-blend"))return void(this.transform.fogCullDistSq=null);let[a,n]=r.getRangeForProjection();if(a>n)return void(this.transform.fogCullDistSq=null);let o=a+.78*(n-a);this.transform.fogCullDistSq=o*o}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 aN(this,this.style)),this._forceTerrainMode=i}get shadowRenderer(){return this._shadowRenderer&&this._shadowRenderer.enabled?this._shadowRenderer:null}get wireframeDebugCache(){return this._wireframeDebugCache}resize(r,a){if(this.width=r*i.o.devicePixelRatio,this.height=a*i.o.devicePixelRatio,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(let i of this.style.order)this.style._mergedLayers[i].resize()}setup(){let r=this.context,a=new i.dE;a.emplaceBack(0,0),a.emplaceBack(i.ak,0),a.emplaceBack(0,i.ak),a.emplaceBack(i.ak,i.ak),this.tileExtentBuffer=r.createVertexBuffer(a,i.dA.members),this.tileExtentSegments=i.dB.simpleSegment(0,0,4,2);let n=new i.dE;n.emplaceBack(0,0),n.emplaceBack(i.ak,0),n.emplaceBack(0,i.ak),n.emplaceBack(i.ak,i.ak),this.debugBuffer=r.createVertexBuffer(n,i.dA.members),this.debugSegments=i.dB.simpleSegment(0,0,4,5);let o=new i.dE;o.emplaceBack(-1,-1),o.emplaceBack(1,-1),o.emplaceBack(-1,1),o.emplaceBack(1,1),this.viewportBuffer=r.createVertexBuffer(o,i.dA.members),this.viewportSegments=i.dB.simpleSegment(0,0,4,2);let s=new i.eK;s.emplaceBack(0,0,0,0),s.emplaceBack(i.ak,0,i.ak,0),s.emplaceBack(0,i.ak,0,i.ak),s.emplaceBack(i.ak,i.ak,i.ak,i.ak),this.mercatorBoundsBuffer=r.createVertexBuffer(s,i.eL.members),this.mercatorBoundsSegments=i.dB.simpleSegment(0,0,4,2);let l=new i.dF;l.emplaceBack(0,1,2),l.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=r.createIndexBuffer(l);let h=new i.eM;for(let i of[0,1,3,2,0])h.emplaceBack(i);this.debugIndexBuffer=r.createIndexBuffer(h),this.emptyTexture=new i.T(r,new i.q({width:1,height:1},Uint8Array.of(0,0,0,0)),r.gl.RGBA8),this.identityMat=i.bd();let u=this.context.gl;this.stencilClearMode=new iK({func:u.ALWAYS,mask:0},0,255,u.ZERO,u.ZERO,u.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(){let i=this.context.gl;this.nextStencilID=1,this.currentStencilSource=void 0,this._tileClippingMaskIDs={},this.getOrCreateProgram("clippingMask").draw(this,i.TRIANGLES,iJ.disabled,this.stencilClearMode,iY.disabled,iQ.disabled,aL(this.identityMat),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}resetStencilClippingMasks(){this.terrain||(this.currentStencilSource=void 0,this._tileClippingMaskIDs={})}_renderTileClippingMasks(i,r,a){if(!r||this.currentStencilSource===r.id||!i.isTileClipped()||!a||0===a.length)return;if(this._tileClippingMaskIDs&&!this.terrain){let i=!1;for(let r of a)if(void 0===this._tileClippingMaskIDs[r.key]){i=!0;break}if(!i)return}this.currentStencilSource=r.id;let n=this.context,o=n.gl;this.nextStencilID+a.length>256&&this.clearStencil(),n.setColorMode(iY.disabled),n.setDepthMode(iJ.disabled);let s=this.getOrCreateProgram("clippingMask");for(let i of(this._tileClippingMaskIDs={},a)){let a=r.getTile(i),n=this._tileClippingMaskIDs[i.key]=this.nextStencilID++,{tileBoundsBuffer:l,tileBoundsIndexBuffer:h,tileBoundsSegments:u}=this.getTileBoundsBuffers(a);s.draw(this,o.TRIANGLES,iJ.disabled,new iK({func:o.ALWAYS,mask:0},n,255,o.KEEP,o.KEEP,o.REPLACE),iY.disabled,iQ.disabled,aL(i.projMatrix),"$clipping",l,h,u)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();let i=this.nextStencilID++,r=this.context.gl;return new iK({func:r.NOTEQUAL,mask:255},i,255,r.KEEP,r.KEEP,r.REPLACE)}stencilModeForClipping(i){if(this.terrain)return this.terrain.stencilModeForRTTOverlap(i);let r=this.context.gl;return new iK({func:r.EQUAL,mask:255},this._tileClippingMaskIDs[i.key],0,r.KEEP,r.KEEP,r.REPLACE)}stencilConfigForOverlap(i){let r=this.context.gl,a=i.sort((i,r)=>
111r.overscaledZ-i.overscaledZ),n=a.at(-1).overscaledZ,o=a[0].overscaledZ-n+1;if(o>1){this.currentStencilSource=void 0,this.nextStencilID+o>256&&this.clearStencil();let i={};for(let a=0;a<o;a++)i[a+n]=new iK({func:r.GEQUAL,mask:255},a+this.nextStencilID,255,r.KEEP,r.KEEP,r.REPLACE);return this.nextStencilID+=o,[i,a]}return[{[n]:iK.disabled},a]}colorModeForRenderPass(){let r=this.context.gl;if(this._showOverdrawInspector){let a=1/8;return new iY([r.CONSTANT_COLOR,r.ONE,r.CONSTANT_COLOR,r.ONE],new i.C(a,a,a,0),[!0,!0,!0,!0])}return"opaque"===this.renderPass?iY.unblended:iY.alphaBlended}colorModeForDrapableLayerRenderPass(r){let a=this.context.gl;return this.style&&this.style.enable3dLights()&&this.terrain&&this.terrain.renderingToTexture&&"translucent"===this.renderPass?null!=r&&"mrt-fallback"!==this.emissiveMode||"constant"===this.emissiveMode?new iY([a.ONE,a.ONE_MINUS_SRC_ALPHA,a.CONSTANT_ALPHA,a.ONE_MINUS_SRC_ALPHA],new i.C(0,0,0,null!=r?r:0),[!0,!0,!0,!0]):"dual-source-blending"===this.emissiveMode?new iY([a.ONE,a.ONE_MINUS_SRC_ALPHA,this.context.extBlendFuncExtended.SRC1_ALPHA_WEBGL,a.ONE_MINUS_SRC_ALPHA],i.C.transparent,[!0,!0,!0,!0]):this.colorModeForRenderPass():this.colorModeForRenderPass()}depthModeForSublayer(i,r,a,n=!1){if(this.depthOcclusion)return new iJ(this.context.gl.GREATER,iJ.ReadOnly,this.depthRangeFor3D);if(!this.opaquePassEnabledForLayer()&&!n)return iJ.disabled;let o=1-((1+this.currentLayer)*this.numSublayers+i)*this.depthEpsilon;return new iJ(a||this.context.gl.LEQUAL,r,[o,o])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}blitDepth(){let r=this.context.gl,a=Math.ceil(this.width),n=Math.ceil(this.height),o=this.context.bindFramebuffer.get(),s=r.getParameter(r.TEXTURE_BINDING_2D);this.depthFBO&&this.depthFBO.width===a&&this.depthFBO.height===n||(this.depthFBO&&(this.depthFBO.destroy(),this.depthFBO=void 0,this.depthTexture=void 0),0!==a&&0!==n&&(this.depthFBO=new nd(this.context,a,n,0,"texture"),this.depthTexture=new i.T(this.context,{width:a,height:n,data:null},r.DEPTH24_STENCIL8),this.depthFBO.depthAttachment.set(this.depthTexture.texture))),this.context.bindFramebuffer.set(o),r.bindTexture(r.TEXTURE_2D,s),this.depthFBO&&(r.bindFramebuffer(r.READ_FRAMEBUFFER,null),r.bindFramebuffer(r.DRAW_FRAMEBUFFER,this.depthFBO.framebuffer),r.blitFramebuffer(0,0,a,n,0,0,a,n,r.DEPTH_BUFFER_BIT,r.NEAREST),r.bindFramebuffer(r.FRAMEBUFFER,this.context.bindFramebuffer.current))}render(r,a){this.context.sweepPendingPrograms(),this._wireframeDebugCache.update(this.frameCounter),this.style=r,this.options=a;let n=this.style._mergedLayers,o=!(!this.terrain||!this.terrain.enabled),s=()=>
111this.style._getOrder(o),l=s(),h=!1,u=!1,c=null,d=0,p=!1;for(let i of l){let r=n[i];"none"!==r.visibility&&("circle"===r.type?h=!0:"building"===r.type?(c=r,++d):"symbol"===r.type&&(r.hasOcclusionOpacityProperties?u=!0:h=!0))}this.updateEmissiveMode();let f=l.map(i=>n[i]),m=this.style._mergedSourceCaches;for(let a in this.imageManager=r.imageManager,this.modelManager=r.modelManager,this.symbolFadeChange=r.placement.symbolFadeChange(i.o.now()),this.imageManager.beginFrame(),m){let i=m[a];i.used&&(i.prepare(this.context),i.getSource().usedInConflation&&++d)}let _=!1;for(let i of f)i.isHidden(this.transform.zoom)||("clip"===i.type&&(_=!0),this.prepareLayer(i));let g={},y={},x={},v={},b={};for(let i in m){let r=m[i];g[i]=r.getVisibleCoordinates(),y[i]=g[i].slice().reverse(),x[i]=r.getVisibleCoordinates(!0).reverse(),v[i]=r.getShadowCasterCoordinates(),b[i]=r.sortCoordinatesByDistance(g[i])}let w=i=>{let r=this.style.getLayerSourceCache(i);return r&&r.used?r.getSource():null};if(d||_||this._clippingActiveLastFrame){let r=[],a=[],n=0;for(let i of f)this.isSourceForClippingOrConflation(i,w(i))&&(r.push(i),a.push(n)),n++;if(r&&(_||r.length>1)||this._clippingActiveLastFrame){_=!1;let n=[];for(let o=0;o<r.length;o++){let s=r[o],l=a[o],h=this.style.getLayerSourceCache(s);if(!h||!h.used||!h.getSource().usedInConflation&&"clip"!==s.type&&"building"!==s.type)continue;let u=i.eN,c=i.bE.None,d=[],p=!0;if("building"===s.type)u=i.eP;else if("clip"===s.type)if(u=l,s.isHidden(this.transform.zoom))p=!1;else{if(!s.layout){p=!1;continue}for(let r of s.layout.get("clip-layer-types"))c|="model"===r?i.bE.Model:"symbol"===r?i.bE.Symbol:i.bE.FillExtrusion;for(let r of s.layout.get("clip-layer-scope"))d.push(i.t(r,s.scope));_=!0}p&&n.push({layer:s.fqid,cache:h,order:u,clipMask:c,clipScope:d})}this.replacementSource.setSources(n),p=!0}}this._clippingActiveLastFrame=_,p||this.replacementSource.clear(),this.conflationActive=p,this.minCutoffZoom=0,this.longestCutoffRange=0,this.maxFrontCutoffRawStart=0,this.opaquePassCutoff=1/0,this._lastOcclusionLayer=-1,this.layersWithOcclusionOpacity=[];for(let i=0;i<f.length;i++){let r=f[i];if("none"===r.visibility)continue;let a=r.cutoffRange();if(this.longestCutoffRange=Math.max(a,this.longestCutoffRange),a>0){let i=w(r);i&&(this.minCutoffZoom=Math.max(i.minzoom,this.minCutoffZoom)),r.minzoom&&(this.minCutoffZoom=Math.max(r.minzoom,this.minCutoffZoom))}r.is3D(o)&&(this.opaquePassCutoff===1/0&&(this.opaquePassCutoff=i),this._lastOcclusionLayer=i)}let T=this.style&&this.style.fog;T?(this._fogVisible=0!==T.getOpacity(this.transform.pitch),this._fogVisible&&"globe"!==this.transform.projection.name&&(this._fogVisible=T.isVisibleOnFrustum(this.transform.cameraFrustum))):this._fogVisible=!1,this._cachedTileFogOpacities={},this.terrain&&(this.terrain.updateTileBinding(x),this.opaquePassCutoff=0,f=(l=s()).map(i=>n[i]));let S=this._shadowRenderer;if(S)for(let i in S.updateShadowParameters(this.transform,this.style.directionalLight),m)for(let r of g[i]){let i={min:0,max:0};this.terrain&&(i=this.terrain.getMinMaxForTile(r)||i),S.addShadowReceiver(r.toUnwrapped(),i.min,i.max)}"globe"!==this.transform.projection.name||this.globeSharedBuffers||(this.globeSharedBuffers=new i.eO(this.context)),this.style.fog&&this.transform.projection.supportsFog?(this._atmosphere||(this._atmosphere=new oT),this._atmosphere.update(this)):this._atmosphere&&(this._atmosphere.destroy(),this._atmosphere=void 0);let E=!(!this.style||!this.style.snow),I=!(!this.style||!this.style.rain);if(E&&!this._snow&&or&&(this._snow=new or),!E&&this._snow&&(this._snow.destroy(),delete this._snow),I&&!this._rain&&oi&&(this._rain=new oi),!I&&this._rain&&(this._rain.destroy(),delete this._rain),this._snow&&this._snow.update(this),this._rain&&this._rain.update(this),c){this.buildingTileBorderManager||(this.buildingTileBorderManager=new oS);let i=this.style.getLayerSourceCache(c);this.buildingTileBorderManager.updateBorders(i,c)}if(!en.has(this.context.gl))return;for(let i of(this.renderPass="offscreen",f)){let a=r.getLayerSourceCache(i);if(!i.hasOffscreenPass()||i.isHidden(this.transform.zoom))continue;let n=a?y[a.id]:void 0;("custom"===i.type||"raster"===i.type||"raster-particle"===i.type||i.isSky()||n&&n.length)&&this.renderLayer(this,a,i,n)}this.depthRangeFor3D=[0,1-(f.length+2)*this.numSublayers*this.depthEpsilon],this._shadowRenderer&&(this.renderPass="shadow",this._shadowRenderer.drawShadowPass(this.style,v)),this.context.bindFramebuffer.set(null),this.context.viewport.set([0,0,this.width,this.height]);let A="globe"===this.transform.projection.name||this.transform.isH
111orizonVisible(),M=(()=>{if(a.showOverdrawInspector)return i.C.black;let r=this.style.fog;if(r&&this.transform.projection.supportsFog){let a=this.style.getLut(r.scope);if(!A){let n="none"===r.properties.get("color-use-theme"),o=r.properties.get("color").toNonPremultipliedRenderColor(n?null:a).toArray01();return new i.C(...o)}if(A){let n="none"===r.properties.get("space-color-use-theme"),o=r.properties.get("space-color").toNonPremultipliedRenderColor(n?null:a).toArray01();return new i.C(...o)}}return i.C.transparent})();if(this.context.clear({color:M,depth:1}),this.clearStencil(),this._showOverdrawInspector=a.showOverdrawInspector,this.renderPass="opaque",this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&A&&this._atmosphere.drawStars(this,this.style.fog),!this.terrain)for(this.currentLayer=l.length-1;this.currentLayer>=0;this.currentLayer--){let i=f[this.currentLayer],a=r.getLayerSourceCache(i);if(i.isSky())continue;let n=a?(i.is3D(o)?b:y)[a.id]:void 0;this._renderTileClippingMasks(i,a,n),this.renderLayer(this,a,i,n)}if(this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&A&&this._atmosphere.drawAtmosphereGlow(this,this.style.fog),this.renderPass="sky",(!this._atmosphere||i.ai(this.transform.zoom)>0)&&("globe"===this.transform.projection.name||this.transform.isHorizonVisible()))for(this.currentLayer=0;this.currentLayer<l.length;this.currentLayer++){let i=f[this.currentLayer],a=r.getLayerSourceCache(i);i.isSky()&&this.renderLayer(this,a,i,a?y[a.id]:void 0)}function C(i,r){let a;return r&&(a=("symbol"===i.type?x:i.is3D(o)?b:y)[r.id]),a}if(this.renderPass="translucent","globe"===this.transform.projection.name){for(this.renderElevatedRasterBackface=!0,this.currentLayer=0;this.currentLayer<l.length;){let i=f[this.currentLayer];if("raster"===i.type||"raster-particle"===i.type){let a=r.getLayerSourceCache(i);this.renderLayer(this,a,i,C(i,a))}++this.currentLayer}this.renderElevatedRasterBackface=!1}this.currentLayer=0,this.firstLightBeamLayer=Number.MAX_SAFE_INTEGER;let P=S?S.getGroundShadowLayerIndex():-1,D=!1,R=-1;for(let i=0;i<l.length;++i){let r=f[i];r.isHidden(this.transform.zoom)||r.is3D(o)&&(R=i)}u&&-1===R&&(h=!0);let z=!1;for(;this.currentLayer<l.length;){let i=f[this.currentLayer],a=r.getLayerSourceCache(i);if(i.isSky())++this.currentLayer;else if(this.terrain&&this.style.isLayerDraped(i)){if(i.isHidden(this.transform.zoom)){++this.currentLayer;continue}this.currentLayer=this.terrain.renderBatch(this.currentLayer),this._lastOcclusionLayer=Math.max(this.currentLayer,this._lastOcclusionLayer)}else{if(!z&&i.is3D(o)&&!o){let i=this.currentLayer,r=i=>{for(this.currentLayer=0;this.currentLayer<f.length;this.currentLayer++){let r=f[this.currentLayer];if(o$[r.type]){let a=this.style.getLayerSourceCache(r);o$[r.type](this,a,r,C(r,a),i)}}};r("initialize"),r("reset"),this.currentLayer=i,z=!0}if(h&&!D&&this.terrain&&!this.transform.isOrthographic&&(D=!0,this.blitDepth()),u&&-1!==R&&this.currentLayer===R+1&&!this.transform.isOrthographic&&this.blitDepth(),this.terrain||this._renderTileClippingMasks(i,a,a?g[a.id]:void 0),this.renderLayer(this,a,i,C(i,a)),!this.terrain&&S&&this.currentLayer===P){{this.clearStencil(),this.resetStencilClippingMasks();let i=this.currentLayer;for(this.currentLayer=0;this.currentLayer<f.length;this.currentLayer++){let i=f[this.currentLayer];if(oq[i.type]){let r=this.style.getLayerSourceCache(i);oq[i.type](this,r,i,C(i,r))}}this.currentLayer=i}if(S.drawGroundShadows(),this.firstLightBeamLayer<=this.currentLayer){let i=this.currentLayer;for(this.renderPass="light-beam",this.currentLayer=this.firstLightBeamLayer;this.currentLayer<=i;this.currentLayer++){let i=f[this.currentLayer];if(!i.hasLightBeamPass())continue;let a=r.getLayerSourceCache(i);this.renderLayer(this,a,i,a?y[a.id]:void 0)}this.currentLayer=i,this.renderPass="translucent"}}if(this.currentLayer>=this._lastOcclusionLayer&&this.layersWithOcclusionOpacity.length>0){let i=this.currentLayer;for(let i of(this.depthOcclusion=!0,this.layersWithOcclusionOpacity)){this.currentLayer=i;let a=f[this.currentLayer],n=r.getLayerSourceCache(a),o=n?y[n.id]:void 0;this.terrain||this._renderTileClippingMasks(a,n,n?g[n.id]:void 0),this.renderLayer(this,n,a,o)}this.depthOcclusion=!1,this.currentLayer=i,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 a=null;f.forEach(i=>
111{let n=r.getLayerSourceCache(i);n&&!i.isHidden(this.transform.zoom)&&n.getVisibleCoordinates().length&&(!a||a.getSource().maxzoom<n.getSource().maxzoom)&&(a=n)}),a&&this.options.showTileBoundaries&&function(r,a,n,o,s,l){for(let s=0;s<n.length;s++)!function(r,a,n,o,s,l,h){let u=r.context,c=r.transform,d=u.gl,p="globe"===c.projection.name,f=i.bb(n.projMatrix);if(p&&i.ai(c.zoom)>0){let r=i.ek(n.canonical,c),a=i.el(r);f=i.aC(new Float32Array(16),c.globeMatrix,a),i.aC(f,c.projMatrix,f)}let m=i.bd();m[12]+=0/(i.o.devicePixelRatio*c.width),m[13]+=0/(i.o.devicePixelRatio*c.height),i.aC(f,m,f);let _=r.getOrCreateProgram("debug",{defines:p?["PROJECTION_GLOBE_VIEW"]:[]}),g=a.getTileByID(n.key);r.terrain&&r.terrain.setupElevationDraw(g,_);let y=iJ.disabled,x=iK.disabled,v=r.colorModeForRenderPass(),b="$debug";u.activeTexture.set(d.TEXTURE0),r.emptyTexture.bind(d.LINEAR,d.CLAMP_TO_EDGE),p?g._makeGlobeTileDebugBuffers(r.context,c):g._makeDebugTileBoundsBuffers(r.context,c.projection);let w=g._tileDebugBuffer||r.debugBuffer,T=g._tileDebugIndexBuffer||r.debugIndexBuffer,S=g._tileDebugSegments||r.debugSegments;if(_.draw(r,d.LINE_STRIP,y,x,v,iQ.disabled,a4(f,o.toPremultipliedRenderColor(null)),b,w,T,S,null,null,null,[g._globeTileDebugBorderBuffer]),h){let i=g.latestRawTileData,a=Math.floor((i&&i.byteLength||0)/1024),o=n.canonical.toString();n.overscaledZ!==n.canonical.z&&(o+=` => ${n.overscaledZ}`),o+=` ${g.state}`,function(i,r){i.initDebugOverlayCanvas();let a=i.debugOverlayCanvas,n=i.context.gl,o=i.debugOverlayCanvas.getContext("2d");o.clearRect(0,0,a.width,a.height),o.shadowColor="white",o.shadowBlur=2,o.lineWidth=1.5,o.strokeStyle="white",o.textBaseline="top",o.font="bold 36px Open Sans, sans-serif",o.fillText(r,5,5),o.strokeText(r,5,5),i.debugOverlayTexture.update(a),i.debugOverlayTexture.bind(n.LINEAR,n.CLAMP_TO_EDGE)}(r,o+=` ${a}kb`)}let E=512/Math.min(a.getTile(n).tileSize,512)*(n.overscaledZ/c.zoom)*.5,I=g._tileDebugTextBuffer||r.debugBuffer,A=g._tileDebugTextIndexBuffer||r.quadTriangleIndexBuffer,M=g._tileDebugTextSegments||r.debugSegments;_.draw(r,d.TRIANGLES,y,x,iY.alphaBlended,iQ.disabled,a4(f,i.C.transparent.toPremultipliedRenderColor(null),E),b,I,A,M,null,null,null,[g._globeTileDebugTextBuffer])}(r,a,n[s],o,0,0,l)}(this,a,a.getVisibleCoordinates(),i.C.red,0,this.options.showParseStatus)}this.options.showPadding&&function(i){var r,a;let n=i.transform.padding;op(i,i.transform.height-(n.top||0),3,ol),op(i,n.bottom||0,3,oh),of(i,n.left||0,3,ou),of(i,i.transform.width-(n.right||0),3,oc);let o=i.transform.centerPoint;r=o.x,a=i.transform.height-o.y,om(i,r-1,a-10,2,20,od),om(i,r-10,a-1,20,2,od)}(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
111anvasCopy()),p||(this.conflationActive=!1)}prepareLayer(i){this.gpuTimingStart(i);let{unsupportedLayers:r}=this.transform.projection,a=!r||!r.includes(i.type);if(oH[i.type]&&(a||this.terrain&&"custom"===i.type)){let r=this.style.getLayerSourceCache(i);oH[i.type](i,r,this)}this.gpuTimingEnd()}renderLayer(i,r,a,n){a.isHidden(this.transform.zoom)||("background"===a.type||"sky"===a.type||"custom"===a.type||"model"===a.type||"raster"===a.type||"raster-particle"===a.type||n&&n.length)&&(this.id=a.id,this.gpuTimingStart(a),(!i.transform.projection.unsupportedLayers||!i.transform.projection.unsupportedLayers.includes(a.type)||i.terrain&&"custom"===a.type)&&"clip"!==a.type&&"slot"!==a.type&&oG[a.type]&&oG[a.type](i,r,a,n,this.style.placement.variableOffsets,this.options.isInitialLoad),oG[a.type]||async function(){await async function(){return Promise.resolve()}(),Object.assign(oG,{building:n7,"raster-particle":oe}),Object.assign(oH,{"raster-particle":ot})}(),this.gpuTimingEnd())}gpuTimingStart(i){if(!this.options.gpuTiming)return;let r=this.context.extTimerQuery,a=this.context.gl,n=this.gpuTimers[i.id];n||(n=this.gpuTimers[i.id]={calls:0,cpuTime:0,query:a.createQuery()}),n.calls++,a.beginQuery(r.TIME_ELAPSED_EXT,n.query)}gpuTimingDeferredRenderStart(){if(this.options.gpuTimingDeferredRender){let i=this.context.extTimerQuery,r=this.context.gl,a=r.createQuery();this.deferredRenderGpuTimeQueries.push(a),r.beginQuery(i.TIME_ELAPSED_EXT,a)}}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(){let i=this.gpuTimers;return this.gpuTimers={},i}collectDeferredRenderGpuQueries(){let i=this.deferredRenderGpuTimeQueries;return this.deferredRenderGpuTimeQueries=[],i}queryGpuTimers(i){let r={};for(let a in i){let n=i[a],o=this.context.extTimerQuery,s=o.getQueryParameter(n.query,this.context.gl.QUERY_RESULT)/1e6;o.deleteQueryEXT(n.query),r[a]=s}return r}queryGpuTimeDeferredRender(i){if(!this.options.gpuTimingDeferredRender)return 0;let r=this.context.gl,a=0;for(let n of i)a+=r.getQueryParameter(n,r.QUERY_RESULT)/1e6,r.deleteQuery(n);return a}translatePosMatrix(r,a,n,o,s){if(!n[0]&&!n[1])return r;let l=s?"map"===o?this.transform.angle:0:"viewport"===o?-this.transform.angle:0;if(l){let i=Math.sin(l),r=Math.cos(l);n=[n[0]*r-n[1]*i,n[0]*i+n[1]*r]}let h=[s?n[0]:i.az(a,n[0],this.transform.zoom),s?n[1]:i.az(a,n[1],this.transform.zoom),0],u=new Float32Array(16);return i.bB(u,r,h),u}saveTileTexture(i){if(i.context!==this.context)return;let r=i.size[0],a=this._tileTextures[r];a?a.push(i):this._tileTextures[r]=[i]}getTileTexture(i){let r=this._tileTextures[i];return r&&r.length>0?r.pop():null}terrainRenderModeElevated(){return this.style&&!!this.style.getTerrain()&&!!this.terrain&&!this.terrain.renderingToTexture||this.forceTerrainMode}linearFloatFilteringSupported(){return null!=this.context.extTextureFloatLinear}currentGlobalDefines(i,r,a,n,o){let s=void 0===a?this.terrain&&this.terrain.renderingToTexture:a,l=void 0===n?this.terrainRenderModeElevated():n,h=void 0===o?"globe"===this.transform.projection.name:o,u=[];return this.style&&this.style.enable3dLights()&&("globeRaster"===i||"terrainRaster"===i?(u.push("LIGHTING_3D_MODE"),u.push("LIGHTING_3D_ALPHA_EMISSIVENESS")):s||u.push("LIGHTING_3D_MODE")),l&&(u.push("TERRAIN"),this.linearFloatFilteringSupported()&&u.push("TERRAIN_DEM_FLOAT_FORMAT")),h&&u.push("GLOBE"),this._fogVisible&&!s&&(void 0===r||r)&&u.push("FOG"),s&&u.push("RENDER_TO_TEXTURE"),this._showOverdrawInspector&&u.push("OVERDRAW_INSPECTOR"),u}getOrCreateProgram(i,r){this.cache=this.cache||{};let{defines:a,config:n,overrideFog:o,overrideRtt:s,overrideTerrain:l,overrideGlobe:h,precompiled:u}=r||{},c=this.currentGlobalDefines(i,o,s,l,h).concat(a||[]),d=this.getShaderSource(i),p=nl[i]||oa[i],f=aj.cacheKey(d,i,c,n);return this.cache[f]||(this.cache[f]=new aj(this.context,i,d,n,p,c,u)),this.cache[f]}getShaderSource(i){return rX[i]||nQ&&nQ[i]}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(){let 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(){null==this.debugOverlayCanvas&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new i.T(this.context,this.debugOverlayCanvas,this.context.gl.RGBA8))}destroy(){this._terrain&&this._terrain.destroy(),this._atmosphere&&(this._atmosphere.de
111stroy(),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(r,a){if(this.style.enable3dLights()){let n=this.style.directionalLight,o=this.style.ambientLight;if(n&&o){let s=((r,a,n)=>{let o=r.properties.get("direction"),s="none"===r.properties.get("color-use-theme"),l=r.properties.get("color").toNonPremultipliedRenderColor(s?null:n.getLut(r.scope)).toArray01(),h=r.properties.get("intensity"),u="none"===a.properties.get("color-use-theme"),c=a.properties.get("color").toNonPremultipliedRenderColor(u?null:n.getLut(a.scope)).toArray01(),d=a.properties.get("intensity"),p=[o.x,o.y,o.z],f=i.dG(c,d),m=i.dG(l,h);return{u_lighting_ambient_color:f,u_lighting_directional_dir:p,u_lighting_directional_color:m,u_ground_radiance:function(r,a,n){let o=function(r,a,n){let o=i.bk(a,r),s=i.bk(n,[.2126,.7152,.0722]),l=(i,r,a)=>(1-a)*i+a*r,h=l(1-.3*Math.min(s,1),1,Math.min(o+1,1));return l(.92,1,Math.asin(i.aB(a[2],-1,1))/Math.PI+.5)*h}(r,[0,0,1],a),s=[0,0,0];i.bN(s,n.slice(0,3),o);let l=[0,0,0];i.bN(l,a.slice(0,3),r[2]);let h=[0,0,0];return i.cX(h,s,l),i.c_(h)}(p,m,f)}})(n,o,this.style);a.setLightsUniformValues(r,s)}}}uploadCommonUniforms(r,a,n,o,s){if(this.uploadCommonLightUniforms(r,a),this.terrain&&this.terrain.renderingToTexture)return;let l=this.style.fog;if(l){let s=l.getOpacity(this.transform.pitch),h=((r,a,n,o,s,l,h,u,c,d,p,f)=>{let m=r.transform,_="none"===a.properties.get("color-use-theme"),g=a.properties.get("color").toNonPremultipliedRenderColor(_?null:r.style.getLut(a.scope)).toArray01();g[3]=o;let y=r.frameCounter/1e3%1,[x,v]=a.properties.get("vertical-range");return{u_fog_matrix:n?m.calculateFogTileMatrix(n):f||r.identityMat,u_fog_range:a.getRangeForProjection(),u_fog_color:g,u_fog_horizon_blend:a.properties.get("horizon-blend"),u_fog_vertical_limit:[Math.min(x,v),v],u_fog_temporal_offset:y,u_frustum_tl:s,u_frustum_tr:l,u_frustum_br:h,u_frustum_bl:u,u_globe_pos:c,u_globe_radius:d,u_viewport:p,u_globe_transition:i.ai(m.zoom),u_is_globe:+("globe"===m.projection.name)}})(this,l,n,s,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*i.o.devicePixelRatio,this.transform.height*i.o.devicePixelRatio],o);a.setFogUniformValues(r,h)}s&&a.setCutoffUniformValues(r,s.uniformValues)}setTileLoadedFlag(i){this.tileLoaded=i}saveCanvasCopy(){let i=this.canvasCopy();i&&(this.frameCopies.push(i),this.tileLoaded=!1)}canvasCopy(){let i=this.context.gl,r=i.createTexture();return i.bindTexture(i.TEXTURE_2D,r),i.copyTexImage2D(i.TEXTURE_2D,0,i.RGBA,0,0,i.drawingBufferWidth,i.drawingBufferHeight,0),r}getCanvasCopiesAndTimestamps(){return{canvasCopies:this.frameCopies,timeStamps:this.loadTimeStamps}}averageElevationNeedsEasing(){if(!this.transform._elevation)return!1;let i=this.style&&this.style.fog;return!!i&&0!==i.getOpacity(this.transform.pitch)}getBackgroundTiles(){let r=this._backgroundTiles,a=this._backgroundTiles={};for(let n of this.transform.coveringTiles({tileSize:512}))a[n.key]=r[n.key]||new i.b3(n,512,this.transform.tileZoom,this,void 0,this.worldview);return a}clearBackgroundTiles(){this._backgroundTiles={}}isSourceForClippingOrConflation(i,r){return!(!i.is3D(!(!this.terrain||!this.terrain.enabled))||"clip"!==i.type&&"building"!==i.type&&(i.minzoom&&i.minzoom>this.transform.zoom||(this.style._clipLayerPresent||"building"!==i.sourceLayer&&"procedural_buildings"!==i.sourceLayer)&&(!r||"batched-model"!==r.type)))}isTileAffectedByFog(i){if(!this.style||!this.style.fog)return!1;if("globe"===this.transform.projection.name)return!0;let r=this._cachedTileFogOpacities[i.key];return r||(this._cachedTileFogOpacities[i.key]=r=this.style.fog.getOpacityForTile(i)),r[0]>=.05||r[1]>=.05}setupDepthForOcclusion(i,r,a){var n;let o=this.context,s=o.gl,l=!!a;a||(a={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}),o.activeTexture.set(s.TEXTURE3),i&&this.depthFBO&&this.depthTexture?(this.depthTexture.bind(s.NEAREST,s.CLAMP_TO_EDGE),a.u_depth_size_inv=[1/this.depthFBO.width,1/this.depthFBO.height],a.u_depth_range_unpack=[2/((n=this.depthRangeFor3D)[1]-n[0]),-1-2*n[0]/(n[1]-n[0])],a.u_occluder_half_size=.5*this.occlusionParams.occluderSize,a.u_occlusion_depth_offset=this.occlusionParams.depthOffset):this.empty
111DepthTexture.bind(s.NEAREST,s.CLAMP_TO_EDGE),o.activeTexture.set(s.TEXTURE0),l||r.setTerrainUniformValues(o,a)}updateEmissiveMode(){if(this._forceEmissiveMode)return;let i=this.style.hasDataDrivenEmissiveStrength();this.emissiveMode=i?this.context.extBlendFuncExtended?"dual-source-blending":"mrt-fallback":"constant"}}function oW(i,r){let a=!1,n=null,o=()=>{n=null,a&&(i(),n=setTimeout(o,r),a=!1)};return()=>(a=!0,n||o(),n)}let oX=/(#.+)?$/;class oY{constructor(r){this._hashName=r&&encodeURIComponent(r),i.b0(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=oW(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}getHashString(){let i=this._map;if(!i)return"";let r=oJ(i);if(this._hashName){let i=this._hashName,a=!1,n=location.hash.slice(1).split("&").map(n=>{let o=n.split("=")[0];return o===i?(a=!0,`${o}=${r}`):n}).filter(i=>i);return a||n.push(`${i}=${r}`),`#${n.join("&")}`}return`#${r}`}_getCurrentHash(){let i=location.hash.replace("#","");if(this._hashName){let r;return i.split("&").map(i=>i.split("=")).forEach(i=>{i[0]===this._hashName&&(r=i)}),(r&&r[1]||"").split("/")}return i.split("/")}_onHashChange(){let i=this._map;if(!i)return!1;let r=this._getCurrentHash();if(r.length>=3&&!r.some(i=>isNaN(Number(i)))){let a=i.dragRotate.isEnabled()&&i.touchZoomRotate.isEnabled()?+(r[3]||0):i.getBearing();return i.jumpTo({center:[+r[2],+r[1]],zoom:+r[0],bearing:a,pitch:+(r[4]||0)}),!0}return!1}_updateHashUnthrottled(){history.replaceState(history.state,"",location.href.replace(oX,this.getHashString()))}}function oJ(i,r){let a=i.getCenter(),n=Math.round(100*i.getZoom())/100,o=Math.pow(10,Math.ceil((n*Math.LN2+Math.log(512/360/.5))/Math.LN10)),s=Math.round(a.lng*o)/o,l=Math.round(a.lat*o)/o,h=i.getBearing(),u=i.getPitch(),c=r?`/${s}/${l}/${n}`:`${n}/${l}/${s}`;return(h||u)&&(c+="/"+Math.round(10*h)/10),u&&(c+=`/${Math.round(u)}`),c}let oK={linearity:.3,easing:i.eQ(0,0,.3,1)},oQ=Object.assign({deceleration:2500,maxSpeed:1400},oK),o0=Object.assign({deceleration:20,maxSpeed:1400},oK),o1=Object.assign({deceleration:1e3,maxSpeed:360},oK),o2=Object.assign({deceleration:1e3,maxSpeed:90},oK);class o3{constructor(i){this._map=i,this.clear()}clear(){this._inertiaBuffer=[]}record(r){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:i.o.now(),settings:r})}_drainInertiaBuffer(){let r=this._inertiaBuffer,a=i.o.now();for(;r.length>0&&a-r[0].time>160;)r.shift()}_onMoveEnd(r){if(this._map._prefersReducedMotion()||(this._drainInertiaBuffer(),this._inertiaBuffer.length<2))return;let a={zoom:0,bearing:0,pitch:0,pan:new i.P(0,0),pinchAround:void 0,around:void 0};for(let{settings:i}of this._inertiaBuffer)a.zoom+=i.zoomDelta||0,a.bearing+=i.bearingDelta||0,a.pitch+=i.pitchDelta||0,i.panDelta&&a.pan._add(i.panDelta),i.around&&(a.around=i.around),i.pinchAround&&(a.pinchAround=i.pinchAround);let n=this._inertiaBuffer.at(-1).time-this._inertiaBuffer[0].time,o={};if(a.pan.mag()){let i=o4(a.pan.mag(),n,Object.assign({},oQ,r||{}));o.offset=a.pan.mult(i.amount/a.pan.mag()),o.center=this._map.transform.center,o5(o,i)}if(a.zoom){let i=o4(a.zoom,n,o0);o.zoom=this._map.transform.zoom+i.amount,o5(o,i)}if(a.bearing){let r=o4(a.bearing,n,o1);o.bearing=this._map.transform.bearing+i.aB(r.amount,-179,179),o5(o,r)}if(a.pitch){let i=o4(a.pitch,n,o2);o.pitch=this._map.transform.pitch+i.amount,o5(o,i)}if(o.zoom||o.bearing){let i=void 0===a.pinchAround?a.around:a.pinchAround;o.around=i?this._map.unproject(i):this._map.getCenter()}return this.clear(),o.noMoveStart=!0,o}}function o5(i,r){(!i.duration||i.duration<r.duration)&&(i.duration=r.duration,i.easing=r.easing)}function o4(r,a,n){let{maxSpeed:o,linearity:s,deceleration:l}=n,h=i.aB(r*s/(a/1e3),-o,o),u=Math.abs(h)/(l*s);return{easing:n.easing,duration:1e3*u,amount:u/2*h}}class o6 extends i.z{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(i,r,a,n={}){let o=I(r.getCanvasContainer(),a);super(i,Object.assign({point:o,lngLat:r.unproject(o),originalEvent:a}
111,n)),this._defaultPrevented=!1,this.target=r}}class o8 extends i.z{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(r,a,n){let o="touchend"===r?n.changedTouches:n.touches,s=A(a.getCanvasContainer(),o),l=s.map(i=>a.unproject(i)),h=s.reduce((i,r,a,n)=>i.add(r.div(n.length)),new i.P(0,0));super(r,{points:s,point:h,lngLats:l,lngLat:a.unproject(h),originalEvent:n}),this._defaultPrevented=!1}}class o9 extends i.z{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(i,r){super("wheel",{originalEvent:r}),this._defaultPrevented=!1}}class o7{constructor(i,r){this._map=i,this._clickTolerance=r.clickTolerance}reset(){this._mousedownPos=void 0}wheel(i){return this._firePreventable(new o9(this._map,i))}mousedown(i,r){return this._mousedownPos=r,this._firePreventable(new o6(i.type,this._map,i))}mouseup(i){this._map.fire(new o6(i.type,this._map,i))}preclick(i){let r=new MouseEvent("preclick",i);this._map.fire(new o6(r.type,this._map,r))}click(i,r){this._mousedownPos&&this._mousedownPos.dist(r)>=this._clickTolerance||(this.preclick(i),this._map.fire(new o6(i.type,this._map,i)))}dblclick(i){return this._firePreventable(new o6(i.type,this._map,i))}mouseover(i){this._map.fire(new o6(i.type,this._map,i))}mouseout(i){this._map.fire(new o6(i.type,this._map,i))}touchstart(i){return this._firePreventable(new o8(i.type,this._map,i))}touchmove(i){this._map.fire(new o8(i.type,this._map,i))}touchend(i){this._map.fire(new o8(i.type,this._map,i))}touchcancel(i){this._map.fire(new o8(i.type,this._map,i))}_firePreventable(i){if(this._map.fire(i),i.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class se{constructor(i){this._map=i}reset(){this._delayContextMenu=!1,this._contextMenuEvent=void 0}mousemove(i){this._map.fire(new o6(i.type,this._map,i))}mousedown(){this._delayContextMenu=!0}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new o6("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(i){this._delayContextMenu?this._contextMenuEvent=i:this._map.fire(new o6(i.type,this._map,i)),this._map.listens("contextmenu")&&i.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class st{constructor(i,r){this._map=i,this._el=i.getCanvasContainer(),this._container=i.getContainer(),this._clickTolerance=r.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(i,r){this.isEnabled()&&i.shiftKey&&0===i.button&&(w(),this._startPos=this._lastPos=r,this._active=!0)}mousemoveWindow(i,r){if(!this._active)return;let a=this._startPos,n=this._lastPos;if(!a||!n||n.equals(r)||!this._box&&r.dist(a)<this._clickTolerance)return;this._lastPos=r,this._box||(this._box=y("div","mapboxgl-boxzoom",this._container),this._container.classList.add("mapboxgl-crosshair"),this._fireEvent("boxzoomstart",i));let o=Math.min(a.x,r.x),s=Math.max(a.x,r.x),l=Math.min(a.y,r.y),h=Math.max(a.y,r.y);this._map._requestDomTask(()=>{this._box&&(this._box.style.transform=`translate(${o}px,${l}px)`,this._box.style.width=s-o+"px",this._box.style.height=h-l+"px")})}mouseupWindow(r,a){if(!this._active)return;let n=this._startPos;if(n&&0===r.button){if(this.reset(),E(),n.x!==a.x||n.y!==a.y)return this._map.fire(new i.z("boxzoomend",{originalEvent:r})),{cameraAnimation:i=>i.fitScreenCoordinates(n,a,this._map.getBearing(),{linear:!1})};this._fireEvent("boxzoomcancel",r)}}keydown(i){this._active&&27===i.keyCode&&(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),T(),delete this._startPos,delete this._lastPos}_fireEvent(r,a){return this._map.fire(new i.z(r,{originalEvent:a}))}}function si(i,r){let a={};for(let n=0;n<i.length;n++)a[i[n].identifier]=r[n];return a}class sr{constructor(i){this.reset(),this.numTouches=i.numTouches}reset(){this.centroid=void 0,this.startTime=0,this.touches={},this.aborted=!1}touchstart(r,a,n){(this.centroid||n.length>this.numTouches)&&(this.aborted=!0),this.aborted||(0===this.startTime&&(this.startTime=r.timeStamp),n.length===this.numTouches&&(this.centroid=function(r){let a=new i.P(0,0);for(let i of r)a._add(i);return a.div(r.length)}(a),this.touches=si(n,a)))}touchmove(i,r,a){if(this.aborted||!this.centroid)return;let n=si(a,r);for(let i in this.touches){let r=n[i];(!r||r.dist(this.touches[i])>30)&&(this.aborted=!0)}}touchend(i,r,a){if((!this.centroid||i.timeStamp-this.startTime>500)&&(this.aborted=!0),0===a.length){let i=!this.aborted&&this.centroid;if(this.reset(),i)return i}}}class sa{constructor(i){this.singleTap=new sr(i),this.numTaps=i.numTaps,this.reset()}reset(){this.lastTime=1/0,this.lastTap=void 0,this.count=0,this.singleTap.reset()}touchstart(i,r,a){this.singleTap.touchstart(i,r,a)}touchmove(i,r,a){this.singleTap.touchmove(i,r,a)}touchend(i,r,a){let n=this.singleTap.touchend(i,r,a);if(n){let r=i.timeStamp-this.lastTime<500,a=!this.lastTap||30>this.lastTap.dist(n);if(r&&a||this.reset(),this.count++,this.lastTime=i.timeStamp,this.lastTap=n,this.count===this.numTaps)return this.reset(),n}}}class sn{constructor(){this._zoomIn=new sa({numTouches:1,numTaps:2}),this._zoomOut=new sa({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(i,r,a){this._zoomIn.touchstart(i,r,a),this._zoomOut.touchstart(i,r,a)}touchmove(i,r,a){this._zoomIn.touchmove(i,r,a),this._zoomOut.touchmove(i,r,a)}touchend(i,r,a){let n=this._zoomIn.touchend(i,r,a),o=this._zoomOut.touchend(i,r,a);return n?(this._active=!0,i.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:r=>r.easeTo({duration:300,zoom:r.getZoom()+1,around:r.unproject(n)},{originalEvent:i})}):o?(this._active=!0,i.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:r=>r.easeTo({duration:300,zoom:r.getZoom()-1,around:r.unproject(o)},{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}}let so={0:1,2:2},ss={Control:"ctrlKey",Alt:"altKey",Shift:"shiftKey",Meta:"metaKey"};class sl{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,r){return!1}_move(i,r){return{}}mousedown(i,r){if(this._lastPoint)return;let a=M(i);this._correctButton(i,a)&&(this._lastPoint=r,this._eventButton=a)}mousemoveWindow(i,r){let a=this._lastPoint;if(a){if(i.preventDefault(),null!=this._eventButton&&function(i,r){let a=so[r];return void 0===i.buttons||(i.buttons&a)!==a}(i,this._eventButton))this.reset();else if(this._moved||!(r.dist(a)<this._clickTolerance))return this._moved=!0,this._lastPoint=r,this._move(a,r)}}mouseupWindow(i){this._lastPoint&&M(i)===this._eventButton&&(this._moved&&E(),this.reset())}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class sh extends sl{mousedown(i,r){super.mousedown(i,r),this._lastPoint&&(this._active=!0)}_correctButton(i,r){return 0===r&&!i.ctrlKey}_move(i,r){return{around:r,panDelta:r.sub(i)}}}class su extends sl{constructor(i){super(i),this._pitchRotateKey=i.pitchRotateKey?ss[i.pitchRotateKey]:void 0}_correctButton(i,r){return this._pitchRotateKey?0===r&&i[this._pitchRotateKey]:0===r&&i.ctrlKey||2===r}_move(i,r){let a=.8*(r.x-i.x);if(a)return this._active=!0,{bearingDelta:a}}contextmenu(i){this._pitchRotateKey||i.preventDefault()}}class sc extends sl{constructor(i){super(i),this._pitchRotateKey=i.pitchRotateKey?ss[i.pitchRotateKey]:void 0}_correctButton(i,r){return this._pitchRotateKey?0===r&&i[this._pitchRotateKey]:0===r&&i.ctrlKey||2===r}_move(i,r){let a=-.5*(r.y-i.y);if(a)return this._active=!0,{pitchDelta:a}}contextmenu(i){this._pitchRotateKey||i.preventDefault()}}class sd{constructor(r,a){this._map=r,this._el=r.getCanvasContainer(),this._minTouches=1,this._clickTolerance=a.clickTolerance||1,this.reset(),i.b0(["_addTouchPanBlocker","_showTouchPanBlockerAlert"],this)}reset(){this._active=!1,this._touches={},this._sum=new i.P(0,0)}touchstart(i,r,a){return this._calculateTransform(i,r,a)}touchmove(r,a,n){if(this._active&&!(n.length<this._minTouches)){if(this._map._cooperativeGestures&&!this._map.isMoving()){if(1===n.length&&!i.eR())return void this._showTouchPanBlockerAlert();
111"hidden"!==this._alertContainer.style.visibility&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}return r.cancelable&&r.preventDefault(),this._calculateTransform(r,a,n)}}touchend(i,r,a){this._calculateTransform(i,r,a),this._active&&a.length<this._minTouches&&this.reset()}touchcancel(){this.reset()}_calculateTransform(r,a,n){n.length>0&&(this._active=!0);let o=si(n,a),s=new i.P(0,0),l=new i.P(0,0),h=0;for(let i in o){let r=o[i],a=this._touches[i];a&&(s._add(r),l._add(r.sub(a)),h++,o[i]=r)}if(this._touches=o,h<this._minTouches||!l.mag())return;let u=l.div(h);return this._sum._add(u),this._sum.mag()<this._clickTolerance?void 0:{around:s.div(h),panDelta:u}}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=y("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 sp{constructor(){this.reset()}reset(){this._active=!1,this._firstTwoTouches=void 0}_start(i){}_move(i,r,a){return{}}touchstart(i,r,a){this._firstTwoTouches||a.length<2||(this._firstTwoTouches=[a[0].identifier,a[1].identifier],this._start([r[0],r[1]]))}touchmove(i,r,a){let n=this._firstTwoTouches;if(!n)return;i.preventDefault();let[o,s]=n,l=sf(a,r,o),h=sf(a,r,s);if(!l||!h)return;let u=this._aroundCenter?null:l.add(h).div(2);return this._move([l,h],u,i)}touchend(i,r,a){if(!this._firstTwoTouches)return;let[n,o]=this._firstTwoTouches,s=sf(a,r,n),l=sf(a,r,o);s&&l||(this._active&&E(),this.reset())}touchcancel(){this.reset()}enable(i){this._enabled=!0,this._aroundCenter=!!i&&"center"===i.around}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}function sf(i,r,a){for(let n=0;n<i.length;n++)if(i[n].identifier===a)return r[n]}function sm(i,r){return Math.log2(i/r)}class s_ extends sp{reset(){super.reset(),this._distance=0,this._startDistance=0}_start(i){this._startDistance=this._distance=i[0].dist(i[1])}_move(i,r){let a=this._distance;if(this._distance=i[0].dist(i[1]),this._active||!(.1>Math.abs(sm(this._distance,this._startDistance))))return this._active=!0,{zoomDelta:sm(this._distance,a),pinchAround:r}}}function sg(i,r){return 180*i.angleWith(r)/Math.PI}class sy extends sp{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,r){let a=this._vector;if(this._vector=i[0].sub(i[1]),a&&(this._active||!this._isBelowThreshold(this._vector)))return this._active=!0,{bearingDelta:sg(this._vector,a),pinchAround:r}}_isBelowThreshold(i){this._minDiameter=Math.min(this._minDiameter,i.mag());let r=25/(Math.PI*this._minDiameter)*360,a=this._startVector;return!!a&&Math.abs(sg(i,a))<r}}function sx(i){return Math.abs(i.y)>Math.abs(i.x)}class sv extends sp{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,sx(i[0].sub(i[1]))&&(this._valid=!1)}_move(r,a,n){let o=this._lastPoints;if(!o)return;let s=r[0].sub(o[0]),l=r[1].sub(o[1]);return this._map._cooperativeGestures&&!i.eR()&&n.touches.length<3||(this._val
111id=this.gestureBeginsVertically(s,l,n.timeStamp),!this._valid)?void 0:(this._lastPoints=r,this._active=!0,{pitchDelta:-((s.y+l.y)/2*.5)})}gestureBeginsVertically(i,r,a){if(void 0!==this._valid)return this._valid;let n=i.mag()>=2,o=r.mag()>=2;if(!n&&!o)return;if(!n||!o)return null==this._firstMove&&(this._firstMove=a),a-this._firstMove<100&&void 0;let s=i.y>0==r.y>0;return sx(i)&&sx(r)&&s}}let sb=100,sw=15,sT=10;class sS{constructor(){this._panStep=sb,this._bearingStep=sw,this._pitchStep=sT,this._rotationDisabled=!1}blur(){this.reset()}reset(){this._active=!1}keydown(i){if(i.altKey||i.ctrlKey||i.metaKey)return;let r=0,a=0,n=0,o=0,s=0;switch(i.keyCode){case 61:case 107:case 171:case 187:r=1;break;case 189:case 109:case 173:r=-1;break;case 37:i.shiftKey?a=-1:(i.preventDefault(),o=-1);break;case 39:i.shiftKey?a=1:(i.preventDefault(),o=1);break;case 38:i.shiftKey?n=1:(i.preventDefault(),s=-1);break;case 40:i.shiftKey?n=-1:(i.preventDefault(),s=1);break;default:return}return this._rotationDisabled&&(a=0,n=0),{cameraAnimation:l=>{let h=l.getZoom();l.easeTo({duration:300,easeId:"keyboardHandler",easing:sE,zoom:r?Math.round(h)+r*(i.shiftKey?2:1):h,bearing:l.getBearing()+a*this._bearingStep,pitch:l.getPitch()+n*this._pitchStep,offset:[-o*this._panStep,-s*this._panStep],center:l.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 sE(i){return i*(2-i)}let sI=1/450,sA=/(Mac|iPad)/i;class sM{constructor(r,a){this._map=r,this._el=r.getCanvasContainer(),this._handler=a,this._delta=0,this._lastDelta=0,this._defaultZoomRate=.01,this._wheelZoomRate=sI,i.b0(["_onTimeout","_addScrollZoomBlocker","_showBlockerAlert"],this)}setZoomRate(i){this._defaultZoomRate=i}setWheelZoomRate(i){this._wheelZoomRate=i}isEnabled(){return!!this._enabled}isActive(){return this._active||void 0!==this._finishTimeout}isZooming(){return!!this._zooming}enable(i){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!i&&"center"===i.around,this._map._cooperativeGestures&&this._addScrollZoomBlocker())}disable(){this.isEnabled()&&(this._enabled=!1,this._map._cooperativeGestures&&(clearTimeout(this._alertTimer),this._alertContainer.remove()))}wheel(r){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!(r.ctrlKey||r.metaKey||this.isZooming()||i.eR()))return void this._showBlockerAlert();"hidden"!==this._alertContainer.style.visibility&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}let a=r.deltaMode===WheelEvent.DOM_DELTA_LINE?40*r.deltaY:r.deltaY,n=i.o.now(),o=n-(this._lastWheelEventTime||0);this._lastWheelEventTime=n,0!==a&&a%4.000244140625==0?this._type="wheel":0!==a&&4>Math.abs(a)?this._type="trackpad":o>400?(this._type=null,this._lastValue=a,this._timeout=window.setTimeout(this._onTimeout,40,r)):this._type||(this._type=200>Math.abs(o*a)?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,a+=this._lastValue)),r.shiftKey&&a&&(a/=4),this._type&&(this._lastWheelEvent=r,this._delta-=a,this._active||this._start(r)),r.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);let r=I(this._el,i);this._aroundPoint=this._aroundCenter?this._map.transform.centerPoint:r,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;let r=this._map.transform;"wheel"===this._type&&r.projection.wrap&&(r._center.lng>=180||r._center.lng<=-180)&&(this._prevEase=null,this._easing=null,this._lastWheelEvent=null,this._lastWheelEventTime=0);let a=()=>r._terrainEnabled()&&this._aroundCoord?r.computeZoomRelativeTo(this._aroundCoord):r.zoom;if(0!==this._delta){let i="wheel"===this._type&&Math.abs(this._delta)>4.000244140625?this._wheelZoomRate:this._defaultZoomRate,n=2/(1+Math.exp(-Math.abs(this._delta*i)));this._delta<0&&0!==n&&(n=1/n);let o=a(),s=Math.pow(2,o),l="number"==typeof this._targetZoom?r.zoomScale(this._targetZoom):s;this._targetZoom=Math.min(r.maxZoom,Math.max(r.minZoom,r.scaleZoom(l*n))),"wheel"===this._type&&(this._startZoom=o,this._easing=this._smoothOutEasing(200)),this._lastDelta=this._delta,this._delta=0}let n="number"==typeof this._targetZoom?this._targetZoom:a(),o=this._startZoom,s=this._easing,l,h=!1;if("wheel"===this._type&&o&&s){let r=Math.min((i.o.now()-this._lastWheelEventTime)/200,1),a=s(r);l=i.aj(o,n,a),r<1?this._frameId||(this._frameId=!0):h=!0}else l=n,h=!0;this._active=!0,h&&(this._active=!1,this._finishTimeout=window.setTimeout(()=>
111{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200));let u=l-a();return u*this._lastDelta<0&&(u=0),{noInertia:!0,needsRenderFrame:!h,zoomDelta:u,around:this._aroundPoint,aroundCoord:this._aroundCoord,originalEvent:this._lastWheelEvent}}_smoothOutEasing(r){let a=i.eS;if(this._prevEase){let r=this._prevEase,n=(i.o.now()-r.start)/r.duration,o=r.easing(n+.01)-r.easing(n),s=.27/Math.sqrt(o*o+1e-4)*.01,l=Math.sqrt(.0729-s*s);a=i.eQ(s,l,.25,1)}return this._prevEase={start:i.o.now(),duration:r,easing:a},a}blur(){this.reset()}reset(){this._active=!1}_addScrollZoomBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=y("div","mapboxgl-scroll-zoom-blocker",this._map._container),this._alertContainer.textContent=sA.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 sC{constructor(i,r){this._clickZoom=i,this._tapZoom=r}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 sP{constructor(){this.reset()}reset(){this._active=!1}blur(){this.reset()}dblclick(i,r){return i.preventDefault(),{cameraAnimation:a=>{a.easeTo({duration:300,zoom:a.getZoom()+(i.shiftKey?-1:1),around:a.unproject(r)},{originalEvent:i})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class sD{constructor(){this._tap=new sa({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,r,a){this._swipePoint||(this._tapTime&&i.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?a.length>0&&(this._swipePoint=r[0],this._swipeTouch=a[0].identifier):this._tap.touchstart(i,r,a))}touchmove(i,r,a){if(this._tapTime){if(this._swipePoint){if(a[0].identifier!==this._swipeTouch)return;let n=r[0],o=n.y-this._swipePoint.y;return this._swipePoint=n,i.preventDefault(),this._active=!0,{zoomDelta:o/128}}}else this._tap.touchmove(i,r,a)}touchend(i,r,a){this._tapTime?this._swipePoint&&0===a.length&&this.reset():this._tap.touchend(i,r,a)&&(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 sR{constructor(i,r,a){this._el=i,this._mousePan=r,this._touchPan=a}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 sz{constructor(i,r,a){this._pitchWithRotate=i.pitchWithRotate,this._mouseRotate=r,this._mousePitch=a}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 sL{constructor(i,r,a,n){this._el=i,this._touchZoom=r,this._touchRotate=a,this._tapDragZoom=n,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()}}let sF=i=>i.zoom||i.drag||i.pitch||i.rotate;class sO extends i.z{}class sB{constructor(){this.constants=[1,1,.01],this.radius=0}setup(r,a){let n=i.aw([],a,r);this.radius=i.af(n[2]<0?i.eU([],n,this.constants):[n[0],n[1],0])}projectRay(r){i.eU(r,r,this.constants),i.ax(r,r),i.eV(r,r,this.constants);let a=i.bN([],r,this.radius);if(a[2]>0){let r=i.bN([],[0,0,1],i.bk(a,[0,0,1])),n=i.bN([],i.ax([],[a[0],a[1],0]),this.radius),o=i.cX([],a,i.bN([],i.aw([],i.cX([],n,r),a),2));a[0]=o[0],a[1]=o[1]}return a}}function sk(i){return i.panDelta&&i.panDelta.mag()||i.zoomDelta||i.bearingDelta||i.pitchDelta}class sN{constructor(r,a){this._map=r,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new o3(r),this._bearingSnap=a.bearingSnap,this._previousActiveHandlers={},this._trackingEllipsoid=new sB,this._dragOrigin=null,this._eventsInProgress={},this._addDefaultHandlers(a),i.b0(["handleEvent","handleWindowEvent"],this);let n=this._el;for(let[i,r,a]of(this._listeners=[[n,"touchstart",{passive:!0}],[n,"touchmove",{passive:!1}],[n,"touchend",void 0],[n,"touchcancel",void 0],[n,"mousedown",void 0],[n,"mousemove",void 0],[n,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[n,"mouseover",void 0],[n,"mouseout",void 0],[n,"dblclick",void 0],[n,"click",void 0],[n,"keydown",{capture:!1}],[n,"keyup",void 0],[n,"wheel",{passive:!1}],[n,"contextmenu",void 0],[window,"blur",void 0]],this._listeners)){let n=i===document?this.handleWindowEvent:this.handleEvent;i.addEventListener(r,n,a)}}destroy(){for(let[i,r,a]of this._listeners){let n=i===document?this.handleWindowEvent:this.handleEvent;i.removeEventListener(r,n,a)}}_addDefaultHandlers(i){let r=this._map,a=r.getCanvasContainer();this._add("mapEvent",new o7(r,i));let n=r.boxZoom=new st(r,i);this._add("boxZoom",n);let o=new sn,s=new sP;r.doubleClickZoom=new sC(s,o),this._add("tapZoom",o),this._add("clickZoom",s);let l=new sD;this._add("tapDragZoom",l);let h=r.touchPitch=new sv(r);this._add("touchPitch",h);let u=new su(i),c=new sc(i);r.dragRotate=new sz(i,u,c),this._add("mouseRotate",u,["mousePitch"]),this._add("mousePitch",c,["mouseRotate"]);let d=new sh(i),p=new sd(r,i);r.dragPan=new sR(a,d,p),this._add("mousePan",d),this._add("touchPan",p,["touchZoom","touchRotate"]);let f=new sy,m=new s_;r.touchZoomRotate=new sL(a,m,f,l),this._add("touchRotate",f,["touchPan","touchZoom"]),this._add("touchZoom",m,["touchPan","touchRotate"]),this._add("blockableMapEvent",new se(r));let _=r.scrollZoom=new sM(r,this);this._add("scrollZoom",_,["mousePan"]);let g=r.keyboard=new sS;for(let a of(this._add("keyboard",g),["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"]))i.interactive&&i[a]&&r[a].enable(i[a])}_add(i,r,a){this._handlers.push({handlerName:i,handler:r,allowed:a}),this._handlersById[i]=r}stop(i){if(!this._updatingCamera){for(let{handler:i}of this._handlers)i.reset();this._inertia.clear(),this._fireEvents({},{},i),this._changes=[],this._originalZoom=void 0}}isActive(){for(let{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!!sF(this._eventsInProgress)||this.isZooming()}_isDragging(){return!!this._eventsInProgress.drag}_blockedByActive(i,r,a){for(let n in i)if(!(n===a||r&&r.includes(n)))return!0;return!1}handleWindowEvent(i){this.handleEvent(i,`${i.type}Window`)}_getMapTouches(i){let r=[];for(let a of i)this._el.contains(a.target)&&r.push(a);return r}handleEvent(i,r){this._updatingCamera=!0;let a="renderFrame"===i.type,n=a?void 0:i,o={needsRenderFrame:!1},s={},l={},h=i.touches?this._getMapTouches(i.touches):void 0,u=h?A(this._el,h):a?void 0:I(this._el,i);for(let{handlerName:a,handler:c,allowed:d}of this._handlers){let p;c.isEnabled()&&(this._blockedByActive(l,d,a)?c.reset():c[r||i.type]&&(p=c[r||i.type](i,u,h),this.mergeHandlerResult(o,s,p,a,n),p&&p.needsRenderFrame&&this._triggerRe
111nderFrame()),(p||c.isActive())&&(l[a]=c))}let c={};for(let i in this._previousActiveHandlers)l[i]||(c[i]=n);this._previousActiveHandlers=l,(Object.keys(c).length||sk(o))&&(this._changes.push([o,s,c]),this._triggerRenderFrame()),(Object.keys(l).length||sk(o))&&this._map._stop(!0),this._updatingCamera=!1;let{cameraAnimation:d}=o;d&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],d(this._map))}mergeHandlerResult(i,r,a,n,o){if(!a)return;Object.assign(i,a);let s={handlerName:n,originalEvent:a.originalEvent||o};void 0!==a.zoomDelta&&(r.zoom=s),void 0!==a.panDelta&&(r.drag=s),void 0!==a.pitchDelta&&(r.pitch=s),void 0!==a.bearingDelta&&(r.rotate=s)}_applyChanges(){let r={},a={},n={};for(let[o,s,l]of this._changes)o.panDelta&&(r.panDelta=(r.panDelta||new i.P(0,0))._add(o.panDelta)),o.zoomDelta&&(r.zoomDelta=(r.zoomDelta||0)+o.zoomDelta),o.bearingDelta&&(r.bearingDelta=(r.bearingDelta||0)+o.bearingDelta),o.pitchDelta&&(r.pitchDelta=(r.pitchDelta||0)+o.pitchDelta),void 0!==o.around&&(r.around=o.around),void 0!==o.aroundCoord&&(r.aroundCoord=o.aroundCoord),void 0!==o.pinchAround&&(r.pinchAround=o.pinchAround),o.noInertia&&(r.noInertia=o.noInertia),Object.assign(a,s),Object.assign(n,l);this._updateMapTransform(r,a,n),this._changes=[]}_updateMapTransform(r,a,n){let o=this._map,s=o.transform,l=i=>[i.x,i.y,i.z];if((()=>{let i=this._eventsInProgress.drag;return i&&!this._handlersById[i.handlerName].isActive()})()&&!sk(r)){let i=s.zoom;s.cameraElevationReference="sea",null!=this._originalZoom&&s._orthographicProjectionAtLowPitch&&"globe"!==s.projection.name&&0===s.pitch?(s.cameraElevationReference="ground",s.zoom=this._originalZoom):(s.recenterOnTerrain(),s.cameraElevationReference="ground"),i!==s.zoom&&this._map._update(!0)}if(s._isCameraConstrained&&o._stop(!0),!sk(r))return void this._fireEvents(a,n,!0);let{panDelta:h,zoomDelta:u,bearingDelta:c,pitchDelta:d,around:p,aroundCoord:f,pinchAround:m}=r;s._isCameraConstrained&&(u>0&&(u=0),s._isCameraConstrained=!1),void 0!==m&&(p=m),(u||a.drag&&!this._eventsInProgress.drag)&&p&&(this._dragOrigin=l(s.pointCoordinate3D(p)),this._originalZoom=s.zoom,this._trackingEllipsoid.setup(s._camera.position,this._dragOrigin)),s.cameraElevationReference="sea",o._stop(!0),p=p||o.transform.centerPoint,c&&(s.bearing+=c),d&&(s.pitch+=d),s._updateCameraState();let _=[0,0,0];if(h)if("mercator"===s.projection.name){let i=this._trackingEllipsoid.projectRay(s.screenPointToMercatorRay(p).dir),r=this._trackingEllipsoid.projectRay(s.screenPointToMercatorRay(p.sub(h)).dir);_[0]=r[0]-i[0],_[1]=r[1]-i[1]}else{let r=s.pointCoordinate(p);if("globe"===s.projection.name){h=h.rotate(-s.angle);let a=s._pixelsPerMercatorPixel/s.worldSize;_[0]=-h.x*i.eT(i.bZ(r.y))*a,_[1]=-h.y*i.eT(s.center.lat)*a}else{let i=s.pointCoordinate(p.sub(h));r&&i&&(_[0]=i.x-r.x,_[1]=i.y-r.y)}}let g=s.zoom,y=[0,0,0];if(u){let r=l(f||s.pointCoordinate3D(p)),a={dir:i.ax([],i.aw([],r,s._camera.position))};if(a.dir[2]<0){let n=s.zoomDeltaToMovement(r,u);i.bN(y,a.dir,n)}}let x=i.cX(_,_,y);s._translateCameraConstrained(x),u&&Math.abs(s.zoom-g)>1e-4&&s.recenterOnTerrain(),s.cameraElevationReference="ground",this._map._update(),r.noInertia||this._inertia.record(r),this._fireEvents(a,n,!0)}_fireEvents(r,a,n){let o,s=sF(this._eventsInProgress),l=sF(r),h={};for(let i in r){let{originalEvent:a}=r[i];this._eventsInProgress[i]||(h[`${i}start`]=a),this._eventsInProgress[i]=r[i]}for(let i in!s&&l&&this._fireEvent("movestart",l.originalEvent),h)this._fireEvent(i,h[i]);for(let i in l&&this._fireEvent("move",l.originalEvent),r){let{originalEvent:a}=r[i];this._fireEvent(i,a)}let u={};for(let i in this._eventsInProgress){let{handlerName:r,originalEvent:n}=this._eventsInProgress[i];this._handlersById[r].isActive()||(delete this._eventsInProgress[i],o=a[r]||n,u[`${i}end`]=o)}for(let i in u)this._fireEvent(i,u[i]);let c=sF(this._eventsInProgress);if(n&&(s||l)&&!c){this._updatingCamera=!0;let r=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),a=i=>0!==i&&-this._bearingSnap<i&&i<this._bearingSnap;r?(a(r.bearing||this._map.getBearing())&&(r.bearing=0),this._map.easeTo(r,{originalEvent:o})):(this._map.fire(new i.z("moveend",{originalEvent:o})),a(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(r,a){this._map.fire(new i.z(r,a?{originalEvent:a}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(i=>{this._frameId=void 0,this.handleEvent(new sO("renderFrame",{timeStamp:i})),this._applyChanges()})}
111_triggerRenderFrame(){void 0===this._frameId&&(this._frameId=this._requestFrame())}}let sU="map.setFreeCameraOptions(...) and map.getFreeCameraOptions() are not yet supported for non-mercator projections.";class sV extends i.E{constructor(r,a){super(),this._moving=!1,this._zooming=!1,this.transform=r,this._bearingSnap=a.bearingSnap,this._respectPrefersReducedMotion=!1!==a.respectPrefersReducedMotion,i.b0(["_renderFrameCallback"],this)}getCenter(){return new i.aX(this.transform.center.lng,this.transform.center.lat)}setCenter(i,r){return this.jumpTo({center:i},r)}panBy(r,a,n){return r=i.P.convert(r).mult(-1),this.panTo(this.transform.center,Object.assign({offset:r},a),n)}panTo(i,r,a){return this.easeTo(Object.assign({center:i},r),a)}getZoom(){return this.transform.zoom}setZoom(i,r){return this.jumpTo({zoom:i},r),this}zoomTo(i,r,a){return this.easeTo(Object.assign({zoom:i},r),a)}zoomIn(i,r){return this.zoomTo(this.getZoom()+1,i,r),this}zoomOut(i,r){return this.zoomTo(this.getZoom()-1,i,r),this}getBearing(){return this.transform.bearing}setBearing(i,r){return this.jumpTo({bearing:i},r),this}getPadding(){return this.transform.padding}setPadding(i,r){return this.jumpTo({padding:i},r),this}rotateTo(i,r,a){return this.easeTo(Object.assign({bearing:i},r),a)}resetNorth(i,r){return this.rotateTo(0,Object.assign({duration:1e3},i),r),this}resetNorthPitch(i,r){return this.easeTo(Object.assign({bearing:0,pitch:0,duration:1e3},i),r),this}snapToNorth(i,r){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(i,r):this}getPitch(){return this.transform.pitch}setPitch(i,r){return this.jumpTo({pitch:i},r),this}cameraForBounds(r,a){r=i.aI.convert(r);let n=a&&a.bearing||0,o=a&&a.pitch||0,s=r.getNorthWest(),l=r.getSouthEast();return this._cameraForBounds(this.transform,s,l,n,o,a)}_extendPadding(i){let r={top:0,right:0,bottom:0,left:0};return null==i?Object.assign({},r,this.transform.padding):"number"==typeof i?{top:i,bottom:i,right:i,left:i}:Object.assign({},r,i)}_extendCameraOptions(i){return(i=Object.assign({offset:[0,0],maxZoom:this.transform.maxZoom},i)).padding=this._extendPadding(i.padding),i}_minimumAABBFrustumDistance(i,r){let a=r.max[0]-r.min[0],n=r.max[1]-r.min[1];return a/n>i.aspect?a/(2*Math.tan(.5*i.fovX)*i.aspect):n/(2*Math.tan(.5*i.fovY)*i.aspect)}_cameraForBoundsOnGlobe(r,a,n,o,s,l){let h=r.clone(),u=this._extendCameraOptions(l);h.bearing=o,h.pitch=s;let c=i.aX.convert(a),d=i.aX.convert(n),p=.5*(c.lat+d.lat),f=.5*(c.lng+d.lng),m=i.eW(p,f),_=i.ax([],m),g=i.ax([],i.bj([],_,[0,1,0])),y=i.bj([],g,_),x=[g[0],g[1],g[2],0,y[0],y[1],y[2],0,_[0],_[1],_[2],0,0,0,0,1],v=[m,i.eW(c.lat,c.lng),i.eW(d.lat,c.lng),i.eW(d.lat,d.lng),i.eW(c.lat,d.lng),i.eW(p,c.lng),i.eW(p,d.lng),i.eW(c.lat,f),i.eW(d.lat,f)],b=i.cY.fromPoints(v.map(r=>[i.bk(g,r),i.bk(y,r),i.bk(_,r)])),w=i.ae([],b.center,x);0===i.eX(w)&&i.eY(w,0,0,1),i.ax(w,w),i.bN(w,w,i.aE),h.center=i.eZ(w);let T=h.getWorldToCameraMatrix(),S=i.ba(new Float64Array(16),T);b=i.cY.applyTransform(b,i.aC([],T,x));let E=this._extendAABB(b,h,u,o);if(!E)return void i.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");b=E,i.ae(w,w,T);let I=.5*(b.max[2]-b.min[2]),A=this._minimumAABBFrustumDistance(h,b),M=i.bN([],[0,0,1],I),C=i.cX(M,w,M),P=A+(0===h.pitch?0:i.bh(w,C)),D=h.globeCenterInViewSpace,R=i.aw([],w,[D[0],D[1],D[2]]);i.ax(R,R),i.bN(R,R,P);let z=i.cX([],w,R);i.ae(z,z,S);let L=i.eg/i.aE,F=i.af(z),O=i.bY(Math.max(F*L-i.eg,Number.EPSILON),0),B=Math.min(h.zoomFromMercatorZAdjusted(O),u.maxZoom);return B>.5*(i.cN+i.cx)?(h.setProjection({name:"mercator"}),h.zoom=B,this._cameraForBounds(h,a,n,o,s,l)):{center:h.center,zoom:B,bearing:o,pitch:s}}_extendAABB(r,a,n,o){let s=.5*((n.padding.left||0)+(n.padding.right||0)),l=.5*((n.padding.top||0)+(n.padding.bottom||0)),h=a.width-(s+s),u=a.height-(l+l),c=i.aw([],r.max,r.min),d=Math.min(h/c[0],u/c[1]),p=Math.min(a.scaleZoom(a.scale*d),n.maxZoom);if(isNaN(p))return null;let f=a.scale/a.zoomScale(p),m=new i.cY([r.min[0]-s*f,r.min[1]-l*f,r.min[2]],[r.max[0]+s*f,r.max[1]+l*f,r.max[2]]),_=("number"==typeof n.offset.x&&"number"==typeof n.offset.y?new i.P(n.offset.x,n.offset.y):i.P.convert(n.offset)).rotate(-i.am(o));return m.center[0]-=_.x*f,m.center[1]+=_.y*f,m}queryTerrainElevation(r,a){let n=this.transform.elevation;return n?(a=Object.assign({},{exaggerated:!0},a),n.getAtPoint(i.ad.fromLngLat(r),null,a.exaggerated)):null}_cameraForBounds(r,a,n,o,s,l){if("globe"===r.projection.name)return this._cameraForBoundsOnGlobe(r,a,n,o,s,l);let h=r.clone(),u=this._extendCameraOptions(l);h.bearing=o,h.pitch=s;let c=i.aX.convert(a),d=i.aX.convert(n),p=new i.aX(c.lng,d.lat),f=new i.aX(d.lng,c.lat),m=h.project(c),_=h.project(d),g=this.queryTerrainElevation(c),y=this.queryTerrainElevation(d),x=this.queryTerrainElevation(p),v=this.queryTerrainElevation(f),b=[[m.x,m.y,Math.min(g||0,y||0,x||0,v||0)],[_.x,_.y,Math.max(g||0,y||0,x||0,v||0)]],w=i.cY.fromPoints(b),T=h.getWorldToCameraMatrix(),S=i.ba(new Float64Array(16),T);
111w=i.cY.applyTransform(w,T);let E=this._extendAABB(w,h,u,o);if(!E)return void i.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");w=E;let I=.5*i.aw([],w.max,w.min)[2],A=this._minimumAABBFrustumDistance(h,w),M=[0,0,1,0];i.aD(M,M,T),i.e_(M,M);let C=i.bN([],M,A+I),P=i.cX([],w.center,C);i.ae(w.center,w.center,S),i.ae(P,P,S);let D=h.unproject(new i.P(w.center[0],w.center[1])),R=Math.pow(2,i.e$(h.projection,D)),z=Math.min(h._zoomFromMercatorZ(P[2]*h.pixelsPerMeter*R/h.worldSize),u.maxZoom);return h.mercatorFromTransition&&z<.5*(i.cN+i.cx)?(h.setProjection({name:"globe"}),h.zoom=z,this._cameraForBounds(h,a,n,o,s,l)):{center:D,zoom:z,bearing:o,pitch:s}}fitBounds(i,r,a){let n=this.cameraForBounds(i,r);return this._fitInternal(n,r,a)}fitScreenCoordinates(r,a,n,o,s){let l=i.P.convert(r),h=i.P.convert(a),u=new i.P(Math.min(l.x,h.x),Math.min(l.y,h.y)),c=new i.P(Math.max(l.x,h.x),Math.max(l.y,h.y));if("mercator"===this.transform.projection.name&&this.transform.anyCornerOffEdge(l,h))return this;let d=this.transform.pointLocation3D(u),p=this.transform.pointLocation3D(c),f=this.transform.pointLocation3D(new i.P(u.x,c.y)),m=this.transform.pointLocation3D(new i.P(c.x,u.y)),_=[Math.min(d.lng,p.lng,f.lng,m.lng),Math.min(d.lat,p.lat,f.lat,m.lat)],g=[Math.max(d.lng,p.lng,f.lng,m.lng),Math.max(d.lat,p.lat,f.lat,m.lat)],y=o&&o.pitch?o.pitch:this.getPitch(),x=this._cameraForBounds(this.transform,_,g,n,y,o);return this._fitInternal(x,o,s)}_fitInternal(i,r,a){return i?(r=Object.assign(i,r)).linear?this.easeTo(r,a):this.flyTo(r,a):this}jumpTo(r,a){this.stop();let n=r.preloadOnly?this.transform.clone():this.transform,o=!1,s=!1,l=!1;"zoom"in r&&n.zoom!==+r.zoom&&(o=!0,n.zoom=+r.zoom),void 0!==r.center&&(n.center=i.aX.convert(r.center)),"bearing"in r&&n.bearing!==+r.bearing&&(s=!0,n.bearing=+r.bearing),"pitch"in r&&n.pitch!==+r.pitch&&(l=!0,n.pitch=+r.pitch);let h="number"==typeof r.padding?this._extendPadding(r.padding):r.padding;
111if(null!=r.padding&&!n.isPaddingEqual(h))if(!1===r.retainPadding){let i=n.clone();i.padding=h,n.setLocationAtPoint(n.center,i.centerPoint)}else n.padding=h;return r.preloadOnly?(this._preloadTiles(n),this):(this.fire(new i.z("movestart",a)).fire(new i.z("move",a)),o&&this.fire(new i.z("zoomstart",a)).fire(new i.z("zoom",a)).fire(new i.z("zoomend",a)),s&&this.fire(new i.z("rotatestart",a)).fire(new i.z("rotate",a)).fire(new i.z("rotateend",a)),l&&this.fire(new i.z("pitchstart",a)).fire(new i.z("pitch",a)).fire(new i.z("pitchend",a)),this.fire(new i.z("moveend",a)))}getFreeCameraOptions(){return this.transform.projection.supportsFreeCamera||i.w(sU),this.transform.getFreeCameraOptions()}setFreeCameraOptions(r,a){let n=this.transform;if(!n.projection.supportsFreeCamera)return i.w(sU),this;this.stop();let o=n.zoom,s=n.pitch,l=n.bearing;n.setFreeCameraOptions(r);let h=o!==n.zoom,u=s!==n.pitch,c=l!==n.bearing;return this.fire(new i.z("movestart",a)).fire(new i.z("move",a)),h&&this.fire(new i.z("zoomstart",a)).fire(new i.z("zoom",a)).fire(new i.z("zoomend",a)),c&&this.fire(new i.z("rotatestart",a)).fire(new i.z("rotate",a)).fire(new i.z("rotateend",a)),u&&this.fire(new i.z("pitchstart",a)).fire(new i.z("pitch",a)).fire(new i.z("pitchend",a)),this.fire(new i.z("moveend",a)),this}easeTo(r,a){let n,o,s,l,h;this._stop(!1,r.easeId),(!1===(r=Object.assign({offset:[0,0],duration:500,easing:i.eS},r)).animate||this._prefersReducedMotion(r))&&(r.duration=0);let u=this.transform,c=this.getZoom(),d=this.getBearing(),p=this.getPitch(),f=this.getPadding(),m="zoom"in r?+r.zoom:c,_="bearing"in r?this._normalizeBearing(r.bearing,d):d,g="pitch"in r?+r.pitch:p,y=this._extendPadding(r.padding),x=i.P.convert(r.offset);if("globe"===u.projection.name){let a=i.ad.fromLngLat(u.center),l=x.rotate(-u.angle);a.x+=l.x/u.worldSize,a.y+=l.y/u.worldSize;let h=a.toLngLat(),c=i.aX.convert(r.center||h);this._normalizeCenter(c),n=u.centerPoint.add(l),o=new i.P(a.x,a.y).mult(u.worldSize),s=new i.P(i.aG(c.lng),i.aJ(c.lat)).mult(u.worldSize).sub(o)}else{n=u.centerPoint.add(x);let a=u.pointLocation(n),l=i.aX.convert(r.center||a);this._normalizeCenter(l),o=u.project(a),s=u.project(l).sub(o)}let v=u.zoomScale(m-c);r.around&&(l=i.aX.convert(r.around),h=u.locationPoint(l));let b=this._zooming||m!==c,w=this._rotating||d!==_,T=this._pitching||g!==p,S=!u.isPaddingEqual(y),E=!1===r.retainPadding?u.clone():u,I=u=>I=>{if(b&&(u.zoom=i.aj(c,m,I)),w&&(u.bearing=i.aj(d,_,I)),T&&(u.pitch=i.aj(p,g,I)),S&&(E.interpolatePadding(f,y,I),n=E.centerPoint.add(x)),l)u.setLocationAtPoint(l,h);else{let i=u.zoomScale(u.zoom-c),r=Math.pow(m>c?Math.min(2,v):Math.max(.5,v),1-I),a=u.unproject(o.add(s.mult(I*r)).mult(i));u.setLocationAtPoint(u.renderWorldCopies?a.wrap():a,n)}return r.preloadOnly||this._fireMoveEvents(a),u};if(r.preloadOnly){let i=this._emulate(I,r.duration,u);return this._preloadTiles(i),this}let A={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=b,this._rotating=w,this._pitching=T,this._padding=S,this._easeId=r.easeId,this._prepareEase(a,r.noMoveStart,A),this._ease(I(u),i=>{"sea"===u.cameraElevationReference&&u.recenterOnTerrain(),this._afterEase(a,i)},r),this}_prepareEase(r,a,n={}){this._moving=!0,this.transform.cameraElevationReference="sea",this.transform._orthographicProjectionAtLowPitch&&0===this.transform.pitch&&"globe"!==this.transform.projection.name&&(this.transform.cameraElevationReference="ground"),a||n.moving||this.fire(new i.z("movestart",r)),this._zooming&&!n.zooming&&this.fire(new i.z("zoomstart",r)),this._rotating&&!n.rotating&&this.fire(new i.z("rotatestart",r)),this._pitching&&!n.pitching&&this.fire(new i.z("pitchstart",r))}_fireMoveEvents(r){this.fire(new i.z("move",r)),this._zooming&&this.fire(new i.z("zoom",r)),this._rotating&&this.fire(new i.z("rotate",r)),this._pitching&&this.fire(new i.z("pitch",r))}_afterEase(r,a){if(this._easeId&&a&&this._easeId===a)return;this._easeId=void 0,this.transform.cameraElevationReference="ground";let n=this._zooming,o=this._rotating,s=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,n&&this.fire(new i.z("zoomend",r)),o&&this.fire(new i.z("rotateend",r)),s&&this.fire(new i.z("pitchend",r)),this.fire(new i.z("moveend",r))}flyTo(r,a){if(this._prefersReducedMotion(r)){let n=i.aK(r,["center","zoom","bearing","pitch","around","padding","retainPadding"]);return this.jumpTo(n,a)}this.stop(),r=Object.assign({offset:[0,0],speed:1.2,curve:1.42,easing:i.eS},r);let n=this.transform,o=this.getZoom(),s=this.getBearing(),l=this.getPitch(),h=this.getPadding(),u="zoom"in r?i.aB(+r.zoom,n.minZoom,n.maxZoom):o,c="bearing"in r?this._normalizeBearing(r.bearing,s):s,d="pitch"in r?+r.pitch:l,p=this._extendPadding(r.padding),f=n.zoomScale(u-o),m=i.P.convert(r.offset),_=n.centerPoint.add(m),g=n.pointLocation(_),y=i.aX.convert(r.center||g);this._normalizeCenter(y);let x=n.project(g),v=n.project(y).sub(x),b=r.curve,w=Math.max(n.width,n.height),T=w/f,S=v.mag();
111if("minZoom"in r){let a=i.aB(Math.min(r.minZoom,o,u),n.minZoom,n.maxZoom);b=Math.sqrt(w/n.zoomScale(a-o)/S*2)}let E=b*b;function I(i){let r=(T*T-w*w+(i?-1:1)*E*E*S*S)/(2*(i?T:w)*E*S);return Math.log(Math.sqrt(r*r+1)-r)}function A(i){return(Math.exp(i)-Math.exp(-i))/2}function M(i){return(Math.exp(i)+Math.exp(-i))/2}let C=I(0),P=function(i){return M(C)/M(C+b*i)},D=function(i){var r;return w*((M(C)*(A(r=C+b*i)/M(r))-A(C))/E)/S},R=(I(1)-C)/b;if(1e-6>Math.abs(S)||!isFinite(R)){if(1e-6>Math.abs(w-T))return this.easeTo(r,a);let i=T<w?-1:1;R=Math.abs(Math.log(T/w))/b,D=function(){return 0},P=function(r){return Math.exp(i*b*r)}}r.duration="duration"in r?+r.duration:1e3*R/("screenSpeed"in r?r.screenSpeed/b:+r.speed),r.maxDuration&&r.duration>r.maxDuration&&(r.duration=0);let z=s!==c,L=d!==l,F=!n.isPaddingEqual(p),O=!1===r.retainPadding?n.clone():n,B=n=>f=>{let g=f*R,b=1/P(g);n.zoom=1===f?u:o+n.scaleZoom(b),z&&(n.bearing=i.aj(s,c,f)),L&&(n.pitch=i.aj(l,d,f)),F&&(O.interpolatePadding(h,p,f),_=O.centerPoint.add(m));let w=1===f?y:n.unproject(x.add(v.mult(D(g))).mult(b));return n.setLocationAtPoint(n.renderWorldCopies?w.wrap():w,_),n._updateCameraOnTerrain(),r.preloadOnly||this._fireMoveEvents(a),n};if(r.preloadOnly){let i=this._emulate(B,r.duration,n);return this._preloadTiles(i),this}return this._zooming=!0,this._rotating=z,this._pitching=L,this._padding=F,this._prepareEase(a,!1),this._ease(B(n),()=>this._afterEase(a),r),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_requestRenderFrame(i){}_cancelRenderFrame(i){}_stop(i,r){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),this._easeFrameId=void 0,this._onEaseFrame=void 0),this._onEaseEnd){let i=this._onEaseEnd;this._onEaseEnd=void 0,i.call(this,r)}if(!i){let i=this.handlers;i&&i.stop(!1)}return this}_ease(r,a,n){!1===n.animate||0===n.duration?(r(1),a()):(this._easeStart=i.o.now(),this._easeOptions=n,this._onEaseFrame=r,this._onEaseEnd=a,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){let r=Math.min((i.o.now()-this._easeStart)/this._easeOptions.duration,1),a=this._onEaseFrame;a&&a(this._easeOptions.easing(r)),r<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(r,a){let n=Math.abs((r=i.bv(r,-180,180))-a);return Math.abs(r-360-a)<n&&(r-=360),Math.abs(r+360-a)<n&&(r+=360),r}_normalizeCenter(i){let r=this.transform;if(r.maxBounds||"globe"!==r.projection.name&&!r.renderWorldCopies)return;let a=i.lng-r.center.lng;i.lng+=a>180?-360:360*(a<-180)}_prefersReducedMotion(r){return this._respectPrefersReducedMotion&&i.o.prefersReducedMotion&&!(r&&r.essential)}_emulate(i,r,a){let n=Math.ceil(15*r/1e3),o=[],s=i(a.clone());for(let i=0;i<=n;i++){let r=s(i/n);o.push(r.clone())}return o}_preloadTiles(i,r){}}let sj=/^(https?:|mailto:)/i;class sG{constructor(r={}){this.options=r,i.b0(["_toggleAttribution","_updateEditLink","_updateData","_updateCompact"],this)}getDefaultPosition(){return"bottom-right"}onAdd(i){let r=this.options&&this.options.compact,a=i._getUIString("AttributionControl.ToggleAttribution");this._map=i,this._container=y("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=y("button","mapboxgl-ctrl-attrib-button",this._container),this._compactButton.type="button",this._compactButton.addEventListener("click",this._toggleAttribution),this._compactButton.setAttribute("aria-label",a);let n=y("span","mapboxgl-ctrl-icon",this._compactButton);return n.setAttribute("aria-hidden","true"),n.setAttribute("title",a),this._innerContainer=y("div","mapboxgl-ctrl-attrib-inner",this._container),r&&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),void 0===r&&(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","fal
111se")):(this._container.classList.add("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","true"))}_updateEditLink(){let r=this._editLink;r||(r=this._editLink=this._container.querySelector(".mapbox-improve-map"));let a=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:this._map._requestManager._customAccessToken||i.g.ACCESS_TOKEN}];if(r){let n=a.reduce((i,r,n)=>(r.value&&(i+=`${r.key}=${r.value}${n<a.length-1?"&":""}`),i),"?");r.href=`${i.g.FEEDBACK_URL}/${n}#${oJ(this._map,!0)}`,r.rel="noopener nofollow"}}_updateData(i){i&&("source"===i.dataType&&("metadata"===i.sourceDataType||"visibility"===i.sourceDataType)||"style"===i.dataType)&&(this._updateAttributions(),this._updateEditLink())}_updateAttributions(){if(!this._map.style)return;let i=[];if(this._map.style.stylesheet){let i=this._map.style.stylesheet;this.styleOwner=i.owner,this.styleId=i.id}let r=this._map.style._mergedSourceCaches;for(let a in r){let n=r[a];if(n.used){let r=n.getSource();r.attribution&&!i.includes(r.attribution)&&i.push(r.attribution)}}i.sort((i,r)=>i.length-r.length),i=i.filter((r,a)=>{for(let n=a+1;n<i.length;n++)if(i[n].includes(r))return!1;return!0}),this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?i=[...this.options.customAttribution,...i]:i.unshift(this.options.customAttribution));let a=i.map(i=>(function(i){let r=(new DOMParser).parseFromString(i,"text/html");return Array.from(r.body.querySelectorAll("*")).reverse().forEach(i=>{let a=i.textContent||"";if("A"!==i.tagName)return void i.replaceWith(...i.childNodes);let n=i.getAttribute("href");if(!n||!sj.test(n))return void i.replaceWith(r.createTextNode(a));let o=r.createElement("a");o.href=n,o.textContent=a,o.rel="noopener nofollow";let s=i.getAttribute("class");s&&(o.className=s),i.replaceWith(o)}),r.body.innerHTML})(i)).join(" | ");a!==this._attribHTML&&(this._attribHTML=a,i.length?(this._innerContainer.innerHTML=a,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 sH{constructor(){i.b0(["_updateLogo","_updateCompact"],this)}onAdd(i){this._map=i,this._container=y("div","mapboxgl-ctrl");let r=y("a","mapboxgl-ctrl-logo");return r.target="_blank",r.rel="noopener nofollow",r.href="https://www.mapbox.com/",r.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),r.setAttribute("rel","noopener nofollow"),this._container.appendChild(r),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&&"metadata"!==i.sourceDataType||(this._container.style.display=this._logoRequired()?"block":"none")}_logoRequired(){if(!this._map.style)return!0;let i=this._map.style._sourceCaches;if(0===Object.entries(i).length)return!0;for(let r in i){let a=i[r].getSource();if(Object.hasOwn(a,"mapbox_logo")&&!a.mapbox_logo)return!1}return!0}_updateCompact(){let i=this._container.children;if(i.length){let r=i[0];this._map.getCanvasContainer().offsetWidth<250?r.classList.add("mapboxgl-compact"):r.classList.remove("mapboxgl-compact")}}}class s${constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(i){let r=++this._id;return this._queue.push({callback:i,id:r,cancelled:!1}),r}remove(i){let r=this._currentlyRunning;for(let a of r?this._queue.concat(r):this._queue)if(a.id===i)return void(a.cancelled=!0)}run(i=0){let r=this._currentlyRunning=this._queue;for(let a of(this._queue=[],r))if(!a.cancelled&&(a.callback(i),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}class sq{constructor(i){this.jumpTo(i)}getValue(r){if(r<=this._startTime)return this._start;if(r>=this._endTime)return this._end;let a=i.dr((r-this._startTime)/(this._endTime-this._startTime));return this._start*(1-a)+this._end*a}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,r,a){this._start=this.getValue(r),this._end=i,this._startTime=r,this._endTime=r+a}}let sZ={"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 sW extends i.z{constructor(i,r,a,n){let{point:o,lngLat:s,originalEvent:l,target:h}=i;super(i.type,{point:o,lngLat:s,originalEvent:l,target:h}),this.preventDefault=()=>{i.preventDefault()},this.id=r,this.interaction=a,this.feature=n}}class sX{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}
111add(r,a){if(this.typeById.has(r))throw Error(`Interaction id "${r}" already exists.`);let n=a.filter,o=a.type;n&&this.filters.set(r,i.dj(n)),"mouseover"===o&&(o="mouseenter"),"mouseout"===o&&(o="mouseleave");let s=this.interactionsByType.get(o)||new Map;"mouseenter"===o||"mouseleave"===o?(0===this.delegatedInteractions.size&&(this.map.on("mousemove",this.handleMove),this.map.on("mouseout",this.handleOut)),this.delegatedInteractions.set(r,a)):0===s.size&&this.map.on(o,this.handleType),0===s.size&&this.interactionsByType.set(o,s),s.set(r,a),this.typeById.set(r,o)}get(i){let r=this.typeById.get(i);if(!r)return;let a=this.interactionsByType.get(r);return a?a.get(i):void 0}remove(i){let r=this.typeById.get(i);if(!r)return;this.typeById.delete(i),this.filters.delete(i);let a=this.interactionsByType.get(r);a&&(a.delete(i),"mouseenter"===r||"mouseleave"===r?(this.delegatedInteractions.delete(i),0===this.delegatedInteractions.size&&(this.map.off("mousemove",this.handleMove),this.map.off("mouseout",this.handleOut))):0===a.size&&this.map.off(r,this.handleType))}queryTargets(i,r){let a=[];for(let[i,n]of r)n.target&&a.push({targetId:i,target:n.target,filter:this.filters.get(i)});return this.map.style.queryRenderedTargets(i,a,this.map.transform)}handleMove(i){this.prevHoveredFeatures=this.hoveredFeatures,this.hoveredFeatures=new Map;let r=this.queryTargets(i.point,Array.from(this.delegatedInteractions).reverse());r.length&&(i.type="mouseenter",this.handleType(i,r));let a=new Map;for(let[i,{feature:r}]of this.prevHoveredFeatures)this.hoveredFeatures.has(i)||a.set(r.id,r);a.size&&(i.type="mouseleave",this.handleType(i,Array.from(a.values())))}handleOut(i){let r=Array.from(this.hoveredFeatures.values()).map(({feature:i})=>i);r.length&&(i.type="mouseleave",this.handleType(i,r)),this.hoveredFeatures.clear()}handleType(r,a){let n="mouseenter"===r.type;if(n&&!this.interactionsByType.has(r.type))return void i.w("mouseenter interaction required for mouseleave to work.");let o=Array.from(this.interactionsByType.get(r.type)).reverse(),s=!!a;a=a||this.queryTargets(r.point,o);let l=!1,h=new Set;for(let u of a){for(let[a,c]of o){if(!c.target)continue;let o=u.variants?u.variants[a]:null;if(o){for(let d of o){if(t3(d,u,h,a))continue;let o=new i.dl(u,d),p=t2(d,u,a);s&&void 0!==o.id&&(o.state=this.map.getFeatureState(o));let f=n?this.prevHoveredFeatures.get(p):null,m=new sW(r,a,c,o),_=f?f.stop:c.handler(m);if(n&&this.hoveredFeatures.set(p,{feature:u,stop:_}),!1!==_){l=!0;break}}if(l)break}}if(l)break}if(!l)for(let[i,a]of o){let{handler:n,target:o}=a;if(!o&&!1!==n(new sW(r,i,a,null)))break}}}let sY=/matrix.*\((.+)\)/,sJ={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:85,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,performanceMetricsCollection:!0,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,antialias:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,minTileCacheSize:null,maxTileCacheSize:null,localIdeographFontFamily:"sans-serif",localFontFamily:null,fontstackCompositing:"client",transformRequest:null,accessToken:null,fadeDuration:300,respectPrefersReducedMotion:!0,crossSourceCollisions:!0,collectResourceTiming:!1,testMode:!1,precompilePrograms:!0,scaleFactor:1},sK={showCompass:!0,showZoom:!0,visualizePitch:!1};class sQ{constructor(r,a,n=!1){this._clickTolerance=10,this.element=a,this.mouseRotate=new su({clickTolerance:r.dragRotate._mouseRotate._clickTolerance}),this.map=r,n&&(this.mousePitch=new sc({clickTolerance:r.dragRotate._mousePitch._clickTolerance})),i.b0(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),a.addEventListener("mousedown",this.mousedown),a.addEventListener("touchstart",this.touchstart,{passive:!1}),a.addEventListener("touchmove",this.touchmove),a.addEventListener("touchend",this.touchend),a.addEventListener("touchcancel",this.reset)}down(i,r){this.mouseRotate.mousedown(i,r),this.mousePitch&&this.mousePitch.mousedown(i,r),w()}move(i,r){let a=this.map,n=this.mouseRotate.mousemoveWindow(i,r),o=n&&n.bearingDelta;if(o&&a.setBearing(a.getBearing()+o),this.mousePitch){let n=this.mousePitch.mousemoveWindow(i,r),o=n&&n.pitchDelta;o&&a.setPitch(a.getPitch()+o)}}off(){let 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(){T(),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()}),I(this.element,i)),window.addEventListener("mousemove",this.mousemove),window.addEventListener("mouseup",this.mouseup)}mousemove(i){this.move(i,I(this.element,i))}mouseup(i){this.mouseRotate.mouseupWindow(i),this.mousePitch&&this.mousePitch.mouseupWindow(i),this.offTemp()}touchstart(i){1!==i.targetTouches.length?this.reset():(this._startPos=this._lastPos=A(this.element,i.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:()=>i.preventDefault()},this._startPos))}touchmove(i){1!==i.targetTouches.length?this.reset():(this._lastPos=A(this.element,i.targetTouches)[0],this.move({buttons:1,preventDefault:()=>i.preventDefault()},this._lastPos))}touchend(i){0===i.targetTouches.length&&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 s0(r,a,n){if(r=new i.aX(r.lng,r.lat),a){let o=new i.aX(r.lng-360,r.lat),s=new i.aX(r.lng+360,r.lat),l=360*Math.ceil(Math.abs(r.lng-n.center.lng)/360),h=n.locationPoint3D(r).distSqr(a),u=a.x<0||a.y<0||a.x>n.width||a.y>n.height;n.locationPoint3D(o).distSqr(a)<h&&(u||Math.abs(o.lng-n.center.lng)<l)?r=o:n.locationPoint3D(s).distSqr(a)<h&&(u||Math.abs(s.lng-n.center.lng)<l)&&(r=s)}for(;Math.abs(r.lng-n.center.lng)>180;){let i=n.locationPoint3D(r);if(i.x>=0&&i.y>=0&&i.x<=n.width&&i.y<=n.height)break;r.lng>n.center.lng?r.lng-=360:r.lng+=360}return r}
111let s1={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%)"},s2=/\s+/,s3="auto",s5="auto";class s4 extends i.E{constructor(r,a){super(),(r instanceof HTMLElement||a)&&(r=Object.assign({element:r},a)),i.b0(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress","_clearFadeTimer"],this);let{anchor:n="center",color:o="#3FB1CE",scale:s=1,draggable:l=!1,clickTolerance:h=0,rotation:u=0,rotationAlignment:c=s3,pitchAlignment:d=s5,occludedOpacity:p=.2,altitude:f=0}=r||{};this._anchor=n,this._color=o,this._scale=s,this._draggable=l,this._clickTolerance=h,this._rotation=u,this._rotationAlignment=c,this._pitchAlignment=d,this._occludedOpacity=p,this._altitude=f,this._state="inactive",this._isDragging=!1,this._updateMoving=()=>this._update(!0),r&&r.element?(this._element=r.element,this._offset=i.P.convert(r&&r.offset||[0,0])):(this._defaultMarker=!0,this._element=this._createDefaultMarker(),this._offset=i.P.convert(r&&r.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",i=>{i.preventDefault()}),this._element.addEventListener("mousedown",i=>{i.preventDefault()});let m=this._element.classList;for(let i in s1)m.remove(`mapboxgl-marker-anchor-${i}`);m.add(`mapboxgl-marker-anchor-${this._anchor}`);let _=r&&r.className?r.className.trim().split(s2):[];m.add(..._),this._popup=null}_createDefaultMarker(){let i=y("div"),r=x("svg",{display:"block",height:41*this._scale+"px",width:27*this._scale+"px",viewBox:"0 0 27 41"},i);if(0===this._altitude){let i=x("radialGradient",{id:"shadowGradient"},x("defs",{},r));x("stop",{offset:"10%","stop-opacity":.4},i),x("stop",{offset:"100%","stop-opacity":.05},i),x("ellipse",{cx:13.5,cy:34.8,rx:10.5,ry:5.25,fill:"url(#shadowGradient)"},r)}return x("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"},r),x("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"},r),x("circle",{fill:"white",cx:13.5,cy:13.5,r:5.5},r),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(){let 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(r){return this._lngLat=i.aX.convert(r),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(!0),this}setAltitude(i){return i===this._altitude||(this._defaultMarker&&(0===this._altitude&&0!==i||0!==this._altitude&&0===i)&&(this._element=this._createDefaultMarker()),this._altitude=i||0,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)){let r=Math.sqrt(91.125);i.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[
1110,-38.1],"bottom-left":[r,-1*(24.6+r)],"bottom-right":[-r,-1*(24.6+r)],left:[13.5,-24.6],right:[-13.5,-24.6]}: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){let r=i.code,a=i.charCode||i.keyCode;"Space"!==r&&"Enter"!==r&&32!==a&&13!==a||this.togglePopup()}_onMapClick(i){let r=i.originalEvent.target,a=this._element;this._popup&&(r===a||a.contains(r))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){let 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}_behindTerrain(){let i=this._map,r=this._pos;if(!i||!r)return!1;let a=i.unproject(r,this._altitude),n=i.getFreeCameraOptions();if(!n.position)return!1;let o=n.position.toLngLat();return o.distanceTo(a)<.9*o.distanceTo(this._lngLat)}_evaluateOpacity(){let r,a=this._map;if(!a)return;let n=this._pos;if(!n||n.x<0||n.x>a.transform.width||n.y<0||n.y>a.transform.height)return void this._clearFadeTimer();let o=a.unproject(n,this._altitude);a._showingGlobe()&&i.f2(a.transform,this._lngLat)?r=0:(r=1-a._queryFogOpacity(o),a.transform._terrainEnabled()&&a.getTerrain()&&this._behindTerrain()&&(r*=this._occludedOpacity)),this._element.style.opacity=`${r}`,this._element.style.pointerEvents=r>0?"auto":"none",this._popup&&this._popup._setOpacity(r),this._fadeTimer=null}_clearFadeTimer(){this._fadeTimer&&(clearTimeout(this._fadeTimer),this._fadeTimer=null)}_updateDOM(){let i=this._pos;if(!i||!this._map)return;let r=this._offset.mult(this._scale);this._element.style.transform=` 112 translate(${i.x}px,${i.y}px) 113 ${s1[this._anchor]} 114 ${this._calculateXYTransform()} ${this._calculateZTransform()} 115 translate(${r.x}px,${r.y}px) 116 `}_calculateXYTransform(){let r=this._pos,a=this._map,n=this.getPitchAlignment();if(!a||!r||"map"!==n)return"";if(!a._showingGlobe()){let i=a.getPitch();return i?`rotateX(${i}deg)`:""}let o=i.cL(i.f3(a.transform,this._lngLat)),s=r.sub(i.f4(a.transform)),l=Math.abs(s.x)+Math.abs(s.y);if(0===l)return"";let h=o/l;return`rotateX(${-s.y*h}deg) rotateY(${s.x*h}deg)`}_calculateZTransform(){let r=this._pos,a=this._map;if(!a||!r)return"";let n=0,o=this.getRotationAlignment();if("map"===o)if(a._showingGlobe()){let r=a.project(new i.aX(this._lngLat.lng,this._lngLat.lat+.001),this._altitude),o=a.project(new i.aX(this._lngLat.lng,this._lngLat.lat-.001),this._altitude).sub(r);n=i.cL(Math.atan2(o.y,o.x))-90}else n=-a.getBearing();else if("horizon"===o){let o=i.ag(4,6,a.getZoom()),s=i.f4(a.transform);s.y+=o*a.transform.height;let l=r.sub(s),h=i.cL(Math.atan2(l.y,l.x));n=(h>90?h-270:h+90)*(1-o)}return(n+=this._rotation)?`rotateZ(${n}deg)`:""}_update(i){cancelAnimationFrame(this._updateFrameId);let r=this._map;
116r&&(r.transform.renderWorldCopies&&(this._lngLat=s0(this._lngLat,this._pos,r.transform)),this._pos=r.project(this._lngLat,this._altitude),!0===i?this._updateFrameId=requestAnimationFrame(()=>{this._element&&this._pos&&this._anchor&&(this._pos=this._pos.round(),this._updateDOM())}):this._pos=this._pos.round(),r._requestDomTask(()=>{this._map&&(this._element&&this._pos&&this._anchor&&this._updateDOM(),(r._showingGlobe()||r.getTerrain()||r.getFog())&&!this._fadeTimer&&(this._fadeTimer=window.setTimeout(this._evaluateOpacity.bind(this),60)))}))}getOffset(){return this._offset}setOffset(r){return this._offset=i.P.convert(r),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(r){let a=this._map;if(!a)return;let n=this._pointerdownPos,o=this._positionDelta;if(n&&o){if(!this._isDragging){let i=this._clickTolerance||a._clickTolerance;if(r.point.dist(n)<i)return;this._isDragging=!0}this._pos=r.point.sub(o),this._lngLat=a.unproject(this._pos,this._altitude),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none","pending"===this._state&&(this._state="active",this.fire(new i.z("dragstart"))),this.fire(new i.z("drag"))}}_onUp(){this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1;let r=this._map;r&&(r.off("mousemove",this._onMove),r.off("touchmove",this._onMove)),"active"===this._state&&this.fire(new i.z("dragend")),this._state="inactive"}_addDragHandler(i){let r=this._map,a=this._pos;r&&a&&this._element.contains(i.originalEvent.target)&&(i.preventDefault(),this._positionDelta=i.point.sub(a),this._pointerdownPos=i.point,this._state="pending",r.on("mousemove",this._onMove),r.on("touchmove",this._onMove),r.once("mouseup",this._onUp),r.once("touchend",this._onUp))}setDraggable(i){this._draggable=!!i;let r=this._map;return r&&(i?(r.on("mousedown",this._addDragHandler),r.on("touchstart",this._addDragHandler)):(r.off("mousedown",this._addDragHandler),r.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(i){return this._rotation=i||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(i){return this._rotationAlignment=i||s3,this._update(),this}getRotationAlignment(){return"auto"===this._rotationAlignment||"horizon"===this._rotationAlignment&&this._map&&!this._map._showingGlobe()?"viewport":this._rotationAlignment}setPitchAlignment(i){return this._pitchAlignment=i||s5,this._update(),this}getPitchAlignment(){return"auto"===this._pitchAlignment?this.getRotationAlignment():this._pitchAlignment}setOccludedOpacity(i){return this._occludedOpacity=i||.2,this._update(),this}getOccludedOpacity(){return this._occludedOpacity}}let s6={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0,showUserHeading:!1,showButton:!0,followUserLocation:!0},s8={maxWidth:100,unit:"metric"},s9={kilometer:"km",meter:"m",mile:"mi",foot:"ft","nautical-mile":"nm"},s7=/\s+/,le={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",altitude:0};function lt(r=new i.P(0,0),a="bottom"){if("number"==typeof r){let n=Math.round(Math.sqrt(.5*Math.pow(r,2)));switch(a){case"top":return new i.P(0,r);case"top-left":return new i.P(n,n);case"top-right":return new i.P(-n,n);case"bottom":return new i.P(0,-r);case"bottom-left":return new i.P(n,-n);case"bottom-right":return new i.P(-n,-n);case"left":return new i.P(r,0);case"right":return new i.P(-r,0)}return new i.P(0,0)}return r instanceof i.P||Array.isArray(r)?i.P.convert(r):i.P.convert(r[a]||[0,0])}return{version:h,supported:m.supported,setRTLTextPlugin:i.f7,getRTLTextPluginStatus:i.f6,addTileProvider:i.f5,Map:class extends sV{constructor(r){c.mark(u.create);let a=r;if(null!=(r=Object.assign({},sJ,r)).minZoom&&null!=r.maxZoom&&r.minZoom>r.maxZoom)throw Error("maxZoom must be greater than or equal to minZoom");if(null!=r.minPitch&&null!=r.maxPitch&&r.minPitch>r.maxPitch)throw Error("maxPitch must be greater than or equal to minPitch");if(null!=r.minPitch&&r.minPitch<0)throw Error("minPitch must be greater than or equal to 0");if(null!=r.maxPitch&&r.maxPitch>85)throw Error("maxPitch must be less than or equal to 85");r.antialias&&i.f0(window)&&(r.antialias=!1,i.w("Antialiasing is disabled for this WebGL context to avoid browser bug: https://github.com/mapbox/mapbox-gl-js/issues/11609")),super(new i8(r.minZoom,r.maxZoom,r.minPitch,r.maxPitch,r.renderWorldCopies,null,null),r),this._repaint=!!r.repaint,this._interactive=r.interactive,this._minTileCacheSize=r.minTileCacheSize,this._maxTileC
116acheSize=r.maxTileCacheSize,this._failIfMajorPerformanceCaveat=r.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=r.preserveDrawingBuffer,this._antialias=r.antialias,this._trackResize=r.trackResize,this._bearingSnap=r.bearingSnap,this._refreshExpiredTiles=r.refreshExpiredTiles,this._fadeDuration=r.fadeDuration,this._isInitialLoad=!0,this._crossSourceCollisions=r.crossSourceCollisions,this._collectResourceTiming=r.collectResourceTiming,this._language=this._parseLanguage(r.language),this._worldview=r.worldview,this._renderTaskQueue=new s$,this._domRenderTaskQueue=new s$,this._controls=[],this._markers=[],this._popups=[],this._mapId=i.an(),this._locale=Object.assign({},sZ,r.locale),this._clickTolerance=r.clickTolerance,this._cooperativeGestures=r.cooperativeGestures,this._performanceMetricsCollection=r.performanceMetricsCollection,this._tessellationStep=r.tessellationStep,this._containerWidth=0,this._containerHeight=0,this._showParseStatus=!0,this._precompilePrograms=r.precompilePrograms,this._averageElevationLastSampledAt=-1/0,this._averageElevationExaggeration=0,this._averageElevation=new sq(0),this._interactionRange=[1/0,-1/0],this._visibilityHidden=0,this._useExplicitProjection=!1,this._frameId=0,this._scaleFactor=r.scaleFactor,this._requestManager=new O(r.transformRequest,r.accessToken,r.testMode);let n=V(r.accessToken||i.g.ACCESS_TOKEN);if(n&&"atlas"in n&&"number"==typeof n.atlas&&(this._tokenExpiration=n.atlas),this._silenceAuthErrors=!!r.testMode,this._contextCreateOptions=r.contextCreateOptions?Object.assign({},r.contextCreateOptions):{},"string"==typeof r.container){let i=document.getElementById(r.container);if(!i)throw Error(`Container '${r.container.toString()}' not found.`);this._container=i}else{if(!(r.container instanceof HTMLElement))throw Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=r.container}if(this._container.childNodes.length>0&&i.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."),r.maxBounds&&this.setMaxBounds(r.maxBounds),this._spriteFormat="auto",i.b0(["_onWindowOnline","_onWindowResize","_onVisibilityChange","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._setupPainter(),void 0===this.painter)throw 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 sN(this,r),this._localFontFamily=r.localFontFamily,this._localIdeographFontFamily=r.localIdeographFontFamily,this._fontstackCompositing=r.fontstackCompositing,(r.style||!r.testMode)&&this.setStyle(r.style||i.g.DEFAULT_STYLE,{config:r.config,localFontFamily:this._localFontFamily,localIdeographFontFamily:this._localIdeographFontFamily,fontstackCompositing:this._fontstackCompositing}),r.projection&&this.setProjection(r.projection),r.hash&&(this._hash=new oY("string"==typeof r.hash&&r.hash||void 0).addTo(this)),!this._hash||!this._hash._onHashChange()){null==a.center&&null==a.zoom||(this.transform._unmodified=!1),this.jumpTo({center:r.center,zoom:r.zoom,bearing:r.bearing,pitch:r.pitch});let i=r.bounds;i&&(this.resize(),this.fitBounds(i,Object.assign({},r.fitBoundsOptions,{duration:0})))}this.resize(),r.attributionControl&&this.addControl(new sG({customAttribution:r.customAttribution})),this._logoControl=new sH,this.addControl(this._logoControl,r.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet),this._postStyleLoadEvent(),this._postStyleWithAppearanceEvent()}),this.on("data",r=>{this._update("style"===r.dataType),this.fire(new i.z(`${r.dataType}data`,r))}),this.on("dataloading",r=>{this.fire(new i.z(`${r.dataType}dataloading`,r))}),this._interactions=new sX(this)}_getMapId(){return this._mapId}addControl(r,a){if(void 0===a&&(a=r.getDefaultPosition?r.getDefaultPosition():"top-right"),!r||!r.onAdd)return this.fire(new i.y(Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));let n=r.onAdd(this);this._controls.push(r);let o=this._controlPositions[a];return a.includes("bottom")?o.insertBefore(n,o.firstChild):o.appendChild(n),this}
116removeControl(r){if(!r||!r.onRemove)return this.fire(new i.y(Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));let a=this._controls.indexOf(r);return a>-1&&this._controls.splice(a,1),r.onRemove(this),this}hasControl(i){return this._controls.includes(i)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}resize(r){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));let a=!this._moving;return a&&this.fire(new i.z("movestart",r)).fire(new i.z("move",r)),this.fire(new i.z("resize",r)),a&&this.fire(new i.z("moveend",r)),this}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()||null}setMaxBounds(r){return this.transform.setMaxBounds(i.aI.convert(r)),this._update()}setMinZoom(r){if((r=r??-2)>=-2&&r<=this.transform.maxZoom)return this.transform.minZoom=r,this._update(),this.getZoom()<r?this.setZoom(r):this.fire(new i.z("zoomstart")).fire(new i.z("zoom")).fire(new i.z("zoomend")),this;throw Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(r){if((r=r??22)>=this.transform.minZoom)return this.transform.maxZoom=r,this._update(),this.getZoom()>r?this.setZoom(r):this.fire(new i.z("zoomstart")).fire(new i.z("zoom")).fire(new i.z("zoomend")),this;throw Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(r){if((r=r??0)<0)throw Error("minPitch must be greater than or equal to 0");if(r>=0&&r<=this.transform.maxPitch)return this.transform.minPitch=r,this._update(),this.getPitch()<r?this.setPitch(r):this.fire(new i.z("pitchstart")).fire(new i.z("pitch")).fire(new i.z("pitchend")),this;throw Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(r){if((r=r??85)>85)throw Error("maxPitch must be less than or equal to 85");if(r>=this.transform.minPitch)return this.transform.maxPitch=r,this._update(),this.getPitch()>r?this.setPitch(r):this.fire(new i.z("pitchstart")).fire(new i.z("pitch")).fire(new i.z("pitchend")),this;throw Error("maxPitch must be greater than or equal to minPitch")}getMaxPitch(){return this.transform.maxPitch}getScaleFactor(){return this._scaleFactor}setScaleFactor(i){return this._scaleFactor=i,this.painter.scaleFactor=i,this.style&&this.style._setLabelPlacementStale(),this.style._updateFilteredLayers(i=>"symbol"===i.type),this._update(!0),this}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(i){return this.transform.renderWorldCopies=i,this.transform.renderWorldCopies||this._forceMarkerAndPopupUpdate(!0),this._update()}getLanguage(){return this._language}_parseLanguage(i){return"auto"===i?navigator.language:Array.isArray(i)?0===i.length?void 0:i.map(i=>"auto"===i?navigator.language:i):i}setLanguage(i){let r=this._parseLanguage(i);if(!this.style||r===this._language)return this;for(let i of(this._language=r,this.style.reloadSources(),this._controls))i._setLanguage&&i._setLanguage(this._language);return this}getWorldview(){return this._worldview}setWorldview(i){return this.style&&i!==this._worldview&&(this._worldview=i,this._styleDirty=!0,this.style.setWorldview(i)),this}getProjection(){return this.transform.mercatorFromTransition?{name:"globe",center:[0,0]}:this.transform.getProjection()}_showingGlobe(){return"globe"===this.transform.projection.name}setProjection(i){return this._lazyInitEmptyStyle(),i?"string"==typeof i&&(i={name:i}):i=null,this._useExplicitProjection=!!i,this._prioritizeAndUpdateProjection(i,this.style.projection)}_updateProjectionTransition(){let r;if("globe"!==this.getProjection().name)return;let a=this.transform,n=a.projection.name;"globe"===n&&a.zoom>=i.cx?(a.setMercatorFromTransition(),r=!0):"mercator"===n&&a.zoom<i.cx&&(a.setProjection({name:"globe"}),r=!0),r&&(this.style.applyProjectionUpdate(),this.style._forceSymbolLayer
116Update(),this._update(!0))}_prioritizeAndUpdateProjection(i,r){return this._updateProjection(i||r||{name:"mercator"})}_updateProjection(r){let a,n=this.transform.mercatorFromTransition;a="globe"===r.name&&this.transform.zoom>=i.cx?this.transform.setMercatorFromTransition():this.transform.setProjection(r),this.style.applyProjectionUpdate();let o="mercator"===this.transform.getProjection().name&&n!==this.transform.mercatorFromTransition;return(a||o)&&(this.painter.clearBackgroundTiles(),this.style.clearSources(),this._update(!0),this._forceMarkerAndPopupUpdate(!0)),this}project(r,a){return this.transform.locationPoint3D(i.aX.convert(r),a)}unproject(r,a){return this.transform.pointLocation3D(i.P.convert(r),a)}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(i,r,a){let n=i=>{let a=[];if(Array.isArray(r)){let n=r.filter(i=>this.getLayer(i));a=n.length?this.queryRenderedFeatures(i,{layers:n}):[]}else a=this.queryRenderedFeatures(i,{target:r});return a};if("mouseenter"===i||"mouseover"===i){let o=!1,s=r=>{let s=n(r.point);s.length?o||(o=!0,a.call(this,new o6(i,this,r.originalEvent,{features:s}))):o=!1};return{listener:a,targets:r,delegates:{mousemove:s,mouseout:()=>{o=!1}}}}if("mouseleave"===i||"mouseout"===i){let o=!1,s=r=>{n(r.point).length?o=!0:o&&(o=!1,a.call(this,new o6(i,this,r.originalEvent)))},l=r=>{o&&(o=!1,a.call(this,new o6(i,this,r.originalEvent)))};return{listener:a,targets:r,delegates:{mousemove:s,mouseout:l}}}{let o=i=>{let r=n(i.point);r.length&&(i.features=r,a.call(this,i),delete i.features)};return{listener:a,targets:r,delegates:{[i]:o}}}}on(i,r,a){if("function"==typeof r||void 0===a)return super.on(i,r);if("string"==typeof r&&(r=[r]),!this._areTargetsValid(r))return this;let n=this._createDelegatedListener(i,r,a);for(let r in this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[i]=this._delegatedListeners[i]||[],this._delegatedListeners[i].push(n),n.delegates)this.on(r,n.delegates[r]);return this}once(i,r,a){if("function"==typeof r||void 0===a)return super.once(i,r);if("string"==typeof r&&(r=[r]),!this._areTargetsValid(r))return this;let n=this._createDelegatedListener(i,r,a);for(let i in n.delegates)this.once(i,n.delegates[i]);return this}off(r,a,n){if("function"==typeof a||void 0===n)return super.off(r,a);if("string"==typeof a&&(a=[a]),!this._areTargetsValid(a))return this;let o=this._delegatedListeners?this._delegatedListeners[r]:void 0;return o&&(r=>{for(let o=0;o<r.length;o++){let s=r[o];if(s.listener===n&&function(r,a){if(Array.isArray(r)&&Array.isArray(a)){let i=new Set(r),n=new Set(a);return i.size===n.size&&r.every(i=>n.has(i))}return i.b9(r,a)}(s.targets,a)){for(let i in s.delegates)this.off(i,s.delegates[i]);return r.splice(o,1),this}}})(o),this}queryRenderedFeatures(r,a){if(!this.style)return[];if(void 0===r||r instanceof i.P||Array.isArray(r)||void 0!==a||(a=r,r=void 0),r=r||[[0,0],[this.transform.width,this.transform.height]],!a){let i=this.style.queryRenderedFeatures(r,void 0,this.transform),a=this.style.queryRenderedFeatureset(r,void 0,this.transform);return i.concat(a)}let n=!0;if(a.target&&(n=this._isTargetValid(a.target))&&!a.layers)return this.style.queryRenderedFeatureset(r,a,this.transform);let o=!0;if(a.layers&&Array.isArray(a.layers)){for(let i of a.layers)if(!this._isValidId(i)){o=!1;break}if(o&&!a.target)return this.style.queryRenderedFeatures(r,a,this.transform)}let s=[];return o&&(s=s.concat(this.style.queryRenderedFeatures(r,a,this.transform))),n&&(s=s.concat(this.style.queryRenderedFeatureset(r,a,this.transform))),s}querySourceFeatures(i,r){return i&&("string"!=typeof i||this._isValidId(i))?this.style.querySourceFeatures(i,r):[]}queryRasterValue(i,r,a){return this._isValidId(i)?this.style.queryRasterValue(i,r,a):Promise.resolve(null)}isPointOnSurface(r){let{name:a}=this.transform.projection;return"globe"!==a&&"mercator"!==a&&i.w(`${a} projection does not support isPointOnSurface, this API may behave unex
116pectedly.`),this.transform.isPointOnSurface(i.P.convert(r))}addInteraction(i,r){return this._interactions.add(i,r),this}removeInteraction(i){return this._interactions.remove(i),this}getCooperativeGestures(){return this._cooperativeGestures}setCooperativeGestures(i){return this._cooperativeGestures=i,this}setStyle(r,a){return a=Object.assign({},{localIdeographFontFamily:this._localIdeographFontFamily,localFontFamily:this._localFontFamily,fontstackCompositing:this._fontstackCompositing},a),this.style&&r&&!1!==a.diff&&a.localFontFamily===this._localFontFamily&&a.localIdeographFontFamily===this._localIdeographFontFamily&&a.fontstackCompositing===this._fontstackCompositing&&!a.config?(this.style._diffStyle(r,(n,o)=>{if(n){let o="string"==typeof n?n:n instanceof Error?n.message:n.error;i.w(`Unable to perform style diff: ${o}. Rebuilding the style from scratch.`),this._updateStyle(r,a)}else o&&this._update(!0)},()=>this._postStyleLoadEvent()),this):(this._localIdeographFontFamily=a.localIdeographFontFamily,this._localFontFamily=a.localFontFamily,this._fontstackCompositing=a.fontstackCompositing,this._updateStyle(r,a))}_getUIString(i){let r=this._locale[i];if(null==r)throw Error(`Missing UI string '${i}'`);return r}_updateStyle(i,r){if(this.style&&(this.style.setEventedParent(null),this.style._remove(),this.style=void 0),i){let a=Object.assign({},r);r&&r.config&&(a.initialConfig=r.config,delete a.config),this.style=new rS(this,a).load(i),this.style.setEventedParent(this,{style:this.style})}return this._updateTerrain(),this}_lazyInitEmptyStyle(){this.style||(this.style=new rS(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():(i.w("There is no style added to the map."),!1)}_isValidId(r){return null==r?(this.fire(new i.y(Error("IDs can't be empty."))),!1):!i.de(r)||(this.fire(new i.y(Error(`IDs can't contain special symbols: "${r}".`))),!1)}_isTargetValid(i){return"featuresetId"in i?this._isValidId("importId"in i?i.importId:i.featuresetId):"layerId"in i&&this._isValidId(i.layerId)}_areTargetsValid(i){if(Array.isArray(i)){for(let r of i)if(!this._isValidId(r))return!1;return!0}return this._isTargetValid(i)}addSource(i,r){return this._isValidId(i)?(this._lazyInitEmptyStyle(),this.style.addSource(i,r),this._update(!0)):this}isSourceLoaded(i){return!!this._isValidId(i)&&!!this.style&&this.style._isSourceCacheLoaded(i)}areTilesLoaded(){return this.style.areTilesLoaded()}addSourceType(i,r,a){this._lazyInitEmptyStyle(),this.style.addSourceType(i,r,a)}removeSource(i){return this._isValidId(i)?(this.style.removeSource(i),this._updateTerrain(),this._update(!0)):this}getSource(i){return this._isValidId(i)?this.style.getOwnSource(i):null}addImage(r,a,{pixelRatio:n=1,sdf:o=!1,stretchX:s,stretchY:l,content:h}={}){this._lazyInitEmptyStyle();let u=i.I.from(r);if(a instanceof HTMLImageElement||ImageBitmap&&a instanceof ImageBitmap){let{width:r,height:c,data:d}=i.o.getImageData(a);this.style.addImage(u,{data:new i.q({width:r,height:c},d),pixelRatio:n,stretchX:s,stretchY:l,content:h,sdf:o,version:0,usvg:!1})}else if(void 0===a.width||void 0===a.height)this.fire(new i.y(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{let{width:c,height:d}=a;this.style.addImage(u,{data:new i.q({width:c,height:d},new Uint8Array(a.data)),pixelRatio:n,stretchX:s,stretchY:l,content:h,sdf:o,usvg:!1,version:0,userImage:a}),a.onAdd&&a.onAdd(this,r)}}updateImage(r,a){this._lazyInitEmptyStyle();let n=i.I.from(r),o=this.style.getImage(n);if(!o)return void this.fire(new i.y(Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));let{width:s,height:l,data:h}=a instanceof HTMLImageElement||ImageBitmap&&a instanceof ImageBitmap?i.o.getImageData(a):a;if(void 0===s||void 0===l)return void this.fire(new i.y(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(s!==(o.usvg?o.icon.usvg_tree.width:o.data.width)||l!==(o.usvg?o.icon.usvg_tree.height:o.data.height))return void this.fire(new i.y(Error(`The width and height of the updated image (${s}, ${l}) 117 must be that same as the previous version of the image 118 (${o.data.width}, ${o.data.height})`)));let u=!(a instanceof HTMLImageElement||ImageBitmap&&a instanceof ImageBitmap),c=!1;o.usvg?(o.data=new i.q({width:s,height:l},new Uint8Array(h)),o.usvg=!1,o.icon=void 0,c=!0):o.data.replace(h,u),this.style.updateImage(n,o,c)}hasImage(r){return r?!!this.style&&!!this.style.getImage(i.I.from(r)):(this.fire(new i.y(Error("Missing required image id"))),!1)}removeImage(r){this.style.removeImage(i.I.from(r))}loadImage(r,a){i.n(this._requestManager.transformRequest(r,i.R.Image),(i,r)=>{a(i,r)})}listImages(){return this.style.listImages().map(i=>i.name)}addModel(i,r){this._lazyInitEmptyStyle(),this.style.addModel(i,r)}hasModel(r){return r?this.style.hasModel(r):(this.fire(new i.y(Error("Missing required model id"))),!1)}removeModel(i){this.style.removeModel(i)}listModels(){return this.style.listModels()}addLayer(i,r){return this._isValidId(i.id)?(this._lazyInitEmptyStyle(),this.style.addLayer(i,r),this._update(!0)):this}getSlot(i){let r=this.getLayer(i);return r&&r.slot||null}setSlot(i,r){return this.style.setSlot(i,r),this.style.mergeLayers(),this._update(!0)}
118addImport(r,a){return this.style.addImport(r,a).catch(r=>this.fire(new i.y(Error("Failed to add import",r)))),this}updateImport(i,r){return"string"!=typeof r&&r.id!==i?(this.removeImport(i),this.addImport(r)):(this.style.updateImport(i,r),this._update(!0))}removeImport(i){return this.style.removeImport(i),this}moveImport(i,r){return this.style.moveImport(i,r),this._update(!0)}moveLayer(i,r){return this._isValidId(i)?(this.style.moveLayer(i,r),this._update(!0)):this}removeLayer(i){return this._isValidId(i)?(this.style.removeLayer(i),this._update(!0)):this}getLayer(i){if(!this._isValidId(i))return null;let r=this.style.getOwnLayer(i);return r?"custom"===r.type?r.implementation:r.serialize():void 0}getSlots(){return this.style.getSlots()}setLayerZoomRange(i,r,a){return this._isValidId(i)?(this.style.setLayerZoomRange(i,r,a),this._update(!0)):this}setFilter(i,r,a={}){return this._isValidId(i)?(this.style.setFilter(i,r,a),this._update(!0)):this}getFilter(i){return this._isValidId(i)?this.style.getFilter(i):null}setPaintProperty(i,r,a,n={}){return this._isValidId(i)?(this.style.setPaintProperty(i,r,a,n),this._update(!0)):this}getPaintProperty(i,r){return this._isValidId(i)?this.style.getPaintProperty(i,r):null}setLayoutProperty(i,r,a,n={}){return this._isValidId(i)?(this.style.setLayoutProperty(i,r,a,n),this._update(!0)):this}getLayoutProperty(i,r){return this._isValidId(i)?this.style.getLayoutProperty(i,r):null}setLayerProperty(i,r,a,n={}){return this._isValidId(i)?("appearances"===r&&this._postAddingAppearancesToStyleEvent(),this.style.setLayerProperty(i,r,a,n),this._update(!0)):this}getGlyphsUrl(){return this.style.getGlyphsUrl()}setGlyphsUrl(i){return this.style.setGlyphsUrl(i),this._update(!0)}getSchema(i){return this.style.getSchema(i)}setSchema(i,r){return this.style.setSchema(i,r),this._update(!0)}getConfig(i){return this.style.getConfig(i)}setConfig(i,r){return this.style.setConfig(i,r),this._update(!0)}getConfigProperty(i,r){return this.style.getConfigProperty(i,r)}setConfigProperty(i,r,a){return this.style.setConfigProperty(i,r,a),this._update(!0)}getFeaturesetDescriptors(i){return this.style.getFeaturesetDescriptors(i)}setLights(i){if(this._lazyInitEmptyStyle(),i&&1===i.length&&"flat"===i[0].type){let r=i[0];r.properties?this.style.setFlatLight(r.properties,r.id,{}):this.style.setFlatLight({},"flat")}else this.style.setLights(i),this.painter.terrain&&(this.painter.terrain.invalidateRenderCache=!0);return this._update(!0)}getLights(){let i=this.style.getLights()||[];return 0===i.length&&i.push({id:this.style.light.id,type:"flat",properties:this.style.getFlatLight()}),i}setLight(i,r={}){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:i}])}getLight(){return console.log("The `map.getLight` function is deprecated, prefer using `map.getLights` instead."),this.style.getFlatLight()}setTerrain(i){return this._lazyInitEmptyStyle(),!i&&this.transform.projection.requiresDraping?this.style.setTerrainForDraping():this.style.setTerrain(i),this._averageElevationLastSampledAt=-1/0,this._update(!0)}getTerrain(){return this.style?this.style.getTerrain():null}setFog(i){return this._lazyInitEmptyStyle(),this.style.setFog(i),this._update(!0)}getFog(){return this.style?this.style.getFog():null}setSnow(i){return this._lazyInitEmptyStyle(),this.style.setSnow(i),this._update(!0)}getSnow(){return this.style?this.style.getSnow():null}setRain(i){return this._lazyInitEmptyStyle(),this.style.setRain(i),this._update(!0)}getRain(){return this.style?this.style.getRain():null}setColorTheme(i){return this._lazyInitEmptyStyle(),this.style.setColorTheme(i),this._update(!0)}setImportColorTheme(i,r){return this._lazyInitEmptyStyle(),this.style.setImportColorTheme(i,r),this._update(!0)}setCamera(i){return this.style.setCamera(i),this._triggerCameraUpdate(i)}getNearClipOffset(){return this.transform.nearClipOffset}setNearClipOffset(i){let r=this.transform.nearClipOffset!==i;return this.transform.nearClipOffset=i,this._update(r)}_triggerCameraUpdate(i){return this._update(this.transform.setOrthogra
118phicProjectionAtLowPitch("orthographic"===i["camera-projection"]))}getCamera(){return this.style.camera}_queryFogOpacity(r){return this.style&&this.style.fog?this.style.fog.getOpacityAtLatLng(i.aX.convert(r),this.transform):0}setFeatureState(i,r){return i.source&&!this._isValidId(i.source)?this:(this.style.setFeatureState(i,r),this._update())}removeFeatureState(i,r){return i.source&&!this._isValidId(i.source)?this:(this.style.removeFeatureState(i,r),this._update())}getFeatureState(i){return i.source&&!this._isValidId(i.source)?null:this.style.getFeatureState(i)}_selectIndoorFloor(i){this.style.indoorManager.selectFloor(i)}_setIndoorActiveFloorsVisibility(i){this.style.indoorManager.setActiveFloorsVisibility(i)}getIndoorTileOptions(i,r){return this.style&&this.style.isIndoorEnabled()?this.style.indoorManager.getIndoorTileOptions(i,r):null}_updateContainerDimensions(){if(!this._container)return;let i=this._container.getBoundingClientRect().width||400,r=this._container.getBoundingClientRect().height||300,a,n,o,s=this._container;for(;s&&(!n||!o);){let i=window.getComputedStyle(s).transform;i&&"none"!==i&&((a=i.match(sY)[1].split(", "))[0]&&"0"!==a[0]&&"1"!==a[0]&&(n=a[0]),a[3]&&"0"!==a[3]&&"1"!==a[3]&&(o=a[3])),s=s.parentElement}this._containerWidth=n?Math.abs(i/n):i,this._containerHeight=o?Math.abs(r/o):r}_detectMissingCSS(){"rgb(250, 128, 114)"!==window.getComputedStyle(this._missingCSSCanary).getPropertyValue("background-color")&&i.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(){let i=this._container;i.classList.add("mapboxgl-map"),(this._missingCSSCanary=y("div","mapboxgl-canary",i)).style.visibility="hidden",this._detectMissingCSS();let r=this._canvasContainer=y("div","mapboxgl-canvas-container",i);this._canvas=y("canvas","mapboxgl-canvas",r),this._interactive&&(r.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);let a=this._controlContainer=y("div","mapboxgl-control-container",i),n=this._controlPositions={};["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"].forEach(i=>{n[i]=y("div",`mapboxgl-ctrl-${i}`,a)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(r,a){let n=i.o.devicePixelRatio||1;this._canvas.width=n*Math.ceil(r),this._canvas.height=n*Math.ceil(a),this._canvas.style.width=`${r}px`,this._canvas.style.height=`${a}px`}_addMarker(i){this._markers.push(i)}_removeMarker(i){let r=this._markers.indexOf(i);-1!==r&&this._markers.splice(r,1)}_addPopup(i){this._popups.push(i)}_removePopup(i){let r=this._popups.indexOf(i);-1!==r&&this._popups.splice(r,1)}_setupPainter(){let r=Object.assign({},m.supported.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),a=this._canvas.getContext("webgl2",r);a?(eo(a,!0),this.painter=new oZ(a,this._contextCreateOptions,this.transform,this._scaleFactor,this._worldview),this.on("data",i=>{if("source"===i.dataType){let r=this.transform.elevation?this.transform.elevation._source():null;r&&i.sourceCacheId===r.id&&this.style&&this.style._setLabelPlacementStale(),this.painter.setTileLoadedFlag(!0)}}),i.k.testSupport(a)):this.fire(new i.y(Error("Failed to initialize WebGL")))}_contextLost(r){r.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.style&&this.style.handleContextLost(),this.fire(new i.z("webglcontextlost",{originalEvent:r}))}_contextRestored(r){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 i.z("webglcontextrestored",{originalEvent:r}))}_onMapScroll(i){if(i.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(i){return this.style&&(this._styleDirty=this._styleDirty||i,this._sourcesDirty=!0,this.triggerRepaint()),this}_requestRenderFrame(i){return this._update(),this._renderTaskQueue.add(i)}_cancelRenderFrame(i){this._renderTaskQueue.remove(i)}_requestDomTask(i){!this.loaded()||this.loaded()&&!this.isMoving()?i():this._domRenderTaskQueue.add(i)}_render(r){let a;this.fire(new i.z("renderstart")),++this._frameId;let n=this.painter.context.extTimerQuery,o=i.o.now(),s=this.painter.context.gl;if(this.listens("gpu-timing-frame")&&(a=s.createQuery(),s.beginQuery(n.TIME_ELAPSED_EXT,a)),this.painter.context.setDirty(),this.painter.setBaseState(),(this.isMoving()||this.isRotating()||this.isZooming())&&
118(this._interactionRange[0]=Math.min(this._interactionRange[0],performance.now()),this._interactionRange[1]=Math.max(this._interactionRange[1],performance.now())),this._renderTaskQueue.run(r),this._domRenderTaskQueue.run(r),this._removed)return;this._updateProjectionTransition();let l=this._isInitialLoad?0:this._fadeDuration;if(this.style&&this._styleDirty){this._styleDirty=!1;let r=this.transform.zoom,a=this.transform.pitch,n=i.o.now(),o=new i.ab(r,{now:n,fadeDuration:l,pitch:a,transition:this.style.transition,worldview:this._worldview});this.style.update(o)}this.style&&this.style.hasFogTransition()&&(this.style._markersNeedUpdate=!0,this._sourcesDirty=!0);let h=!1;if(this.style&&this._sourcesDirty?(this._sourcesDirty=!1,this.painter._updateFog(this.style),this._updateTerrain(),h=this._updateAverageElevation(o),this.style.updateSources(this.transform),this.style.updateImageProviders(),this.isMoving()||this._forceMarkerAndPopupUpdate()):h=this._updateAverageElevation(o),this.style&&(this._placementDirty=this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,l,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:l,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 i.z("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,c.mark(u.load),this.fire(new i.z("load"))),this.style&&this.style.hasTransitions()&&(this._styleDirty=!0),this.style&&(this.style.snow||this.style.rain)&&(this._styleDirty=!0),this.style&&this.style.imageManager.hasPatternsInFlight()&&(this._styleDirty=!0),this.style&&!this.style.modelManager.isLoaded()&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),a){let r=i.o.now()-o;s.endQuery(n.TIME_ELAPSED_EXT),setTimeout(()=>{let n=s.getQueryParameter(a,s.QUERY_RESULT)/1e6;s.deleteQuery(a),this.fire(new i.z("gpu-timing-frame",{cpuTime:r,gpuTime:n}))},50)}if(this.listens("gpu-timing-layer")){let r=this.painter.collectGpuTimers();setTimeout(()=>{let a=this.painter.queryGpuTimers(r);this.fire(new i.z("gpu-timing-layer",{layerTimes:a}))},50)}if(this.listens("gpu-timing-deferred-render")){let r=this.painter.collectDeferredRenderGpuQueries();setTimeout(()=>{let a=this.painter.queryGpuTimeDeferredRender(r);this.fire(new i.z("gpu-timing-deferred-render",{gpuTime:a}))},50)}let d=this._sourcesDirty||this._styleDirty||this._placementDirty||h;if(d||this._repaint)this.triggerRepaint();else{let r=this.idle();if(r&&(h=this._updateAverageElevation(o,!0)),h)this.triggerRepaint();else{if(this._triggerFrame(!1),r&&(this.fire(new i.z("idle")),this._isInitialLoad=!1,this.speedIndexTiming)){let r=this._calculateSpeedIndex();this.fire(new i.z("speedindexcompleted",{speedIndex:r})),this.speedIndexTiming=!1}r&&this.style&&this.style.handleIdle()}}!this._loaded||this._fullyLoaded||d||(this._fullyLoaded=!0,c.mark(u.fullLoad),this._performanceMetricsCollection&&ei(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(i){for(let r of this._markers)i&&!this.getRenderWorldCopies()&&(r._lngLat=r._lngLat.wrap()),r._update();for(let r of this._popups)!i||this.getRenderWorldCopies()||r._trackPointer||(r._lngLat=r._lngLat.wrap()),r._update()}_updateAverageElevation(i,r=!1){let a=i=>(this.transform.averageElevation=i,this._update(!1),!0);if(!this.painter.averageElevationNeedsEasing())return 0!==this.transform.averageElevation&&a(0);let n=this.transform.elevation&&this.transform.elevation.exaggeration()!==this._averageElevationExaggeration;if(n||(r||i-this._averageElevationLastSampledAt>500)&&!this._averageElevation.isEasing(i)){let r=this.transform.averageElevation,o=this.transform.sampleAverageElevation();null!=this.transform.elevation&&(this._averageElevationExaggeration=this.transform.elevation.exaggeration()),isNaN(o)?o=0:this._averageElevationLastSampledAt=i;let s=Math.abs(r-o);if(s>
1181){if(this._isInitialLoad||n)return this._averageElevation.jumpTo(o),a(o);this._averageElevation.easeTo(o,i,300)}else if(s>1e-4)return this._averageElevation.jumpTo(o),a(o)}return!!this._averageElevation.isEasing(i)&&a(this._averageElevation.getValue(i))}_isTokenExpired(){return null!=this._tokenExpiration&&Date.now()>this._tokenExpiration}_revokeAuth(){let r=this.painter.context.gl;eo(r,!1),this._logoControl instanceof sH&&this._logoControl._updateLogo(),r&&r.clear(r.DEPTH_BUFFER_BIT|r.COLOR_BUFFER_BIT|r.STENCIL_BUFFER_BIT),this._silenceAuthErrors||this.fire(new i.y(Error("A valid Mapbox access token is required to use Mapbox GL JS. To create an account or a new access token, visit https://account.mapbox.com/")))}_authenticate(){ea(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,i=>{i&&(i.message!==F&&401!==i.status||this._revokeAuth())}),this._isTokenExpired()&&this._revokeAuth(),W(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,()=>{})}_postStyleLoadEvent(){this.style.globalId&&Y(this._requestManager._customAccessToken,{map:this,style:this.style.globalId,importedStyles:this.style.getImportGlobalIds()})}_postStyleWithAppearanceEvent(){this.style.globalId&&this.style.hasAppearances()&&K(this._requestManager._customAccessToken)}_postAddingAppearancesToStyleEvent(){ee(this._requestManager._customAccessToken)}_updateTerrain(){let i=this._isDragging();this.painter.updateTerrain(this.style,i)}_calculateSpeedIndex(){let i=this.painter.canvasCopy(),r=this.painter.getCanvasCopiesAndTimestamps();r.timeStamps.push(performance.now());let a=this.painter.context.gl,n=a.createFramebuffer();function o(i){a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,i,0);let r=new Uint8Array(a.drawingBufferWidth*a.drawingBufferHeight*4);return a.readPixels(0,0,a.drawingBufferWidth,a.drawingBufferHeight,a.RGBA,a.UNSIGNED_BYTE,r),r}return a.bindFramebuffer(a.FRAMEBUFFER,n),this._canvasPixelComparison(o(i),r.canvasCopies.map(o),r.timeStamps)}_canvasPixelComparison(i,r,a){let n=a[1]-a[0],o=i.length/4;for(let s=0;s<r.length;s++){let l=r[s],h=0;for(let r=0;r<l.length;r+=4)l[r]===i[r]&&l[r+1]===i[r+1]&&l[r+2]===i[r+2]&&l[r+3]===i[r+3]&&(h+=1);n+=(a[s+2]-a[s+1])*(1-h/o)}return n}remove(){if(this._removed)return;for(let i of(this._hash&&this._hash.remove(),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);let r=this.painter.context.gl.getExtension("WEBGL_lose_context");r&&r.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),en.delete(this.painter.context.gl),er.remove(),Z.remove(),this._removed=!0,this.fire(new i.z("remove"))}triggerRepaint(){this._triggerFrame(!0)}_triggerFrame(r){this._renderNextFrame=this._renderNextFrame||r,this.style&&!this._frame&&(this._frame=i.o.frame(i=>{let r=!!this._renderNextFrame;this._frame=null,this._renderNextFrame=null,r&&this._render(i)}))}_preloadTiles(r){let a=this.style?this.style.getSourceCaches():[];return i.ao(a,(i,a)=>i._preloadTiles(r,a),()=>{this.triggerRepaint()}),this}_onWindowOnline(){this._update()}_onWindowResize(i){this._trackResize&&this.resize({originalEvent:i})._update()}_onVisibilityChange(){"hidden"===document.visibilityState&&this._visibilityHidden++}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(i){this._showTileBoundaries!==i&&(this._showTileBoundaries=i,this._update())}get showParseStatus(){return!!this._showParseStatus}set showParseStatus(i){this._showParseStatus!==i&&(this._showParseStatus=i,this._update())}get showTerrainWireframe(){return!!this._showTerrainWireframe}set showTerrainWireframe(i){this._showTerrainWireframe!==i&&(this._showTerrainWireframe=i,this._update())}get showLayers2DWireframe(){return!!this._showLayers2DWireframe}set showLayers2DWireframe(i){this._showLayers2DWireframe!==i&&(this._showLayers2DWireframe=i,this._update())}get showLayers3DWireframe(){return!!this._showLayers3DWireframe}set showLayers3DWireframe(i){this._showLayers3DWireframe!==i&&(this._showLayers3DWireframe=i,this._update())}get showElevationIdDebug(){return!!this.painter&&this.painter._debugParams.showElevationIdDebug}set showElevationIdDebug(i){this.painter&&this.painter._debugParams.showElevationIdDebug!==i&&(this.painter._debugParams.showElevationIdDebug=i,this.style&&i?this.style._reloadSources():this._update())}get speedIndexTiming(){return!!this._speedIndexTiming}set speedIndexTiming(i){this._speedIndexTiming!==i&&(this._speedIndexTiming=i,this._update())}get showPadding(){return!!this._showPadding}set showPadding(i){this._showPadding!==i&&(this._showPadding=i,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(i){this._showCollisionBoxes!==i&&(this._showCollisionBoxes=i,this.style&&i?this.style._reloadSources():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(i){this._showOverdrawInspector!==i&&(this._showOverdrawInspector=i,this._update())}get repaint(){return!!this._repaint}set repaint(i){this._repaint!==i&&(this._repaint=i,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(i){this._vertices=i,this._update()}get showTileAABBs(){return!!this._showTileAABBs}set showTileAABBs(i){this._showTileAABBs!==i&&(this._showTileAABBs=i,i&&this._update())}_setCacheLimits(r,a){i.f1(r,a)}get version(){return h}},NavigationControl:class{constructor(r={}){this.options=Object.assign({},sK,r),this._container=y("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",i=>i.preventDefault()),this.options.showZoom&&(i.b0(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("mapboxgl-ctrl-zoom-in",i=>{this._map&&this._map.zoomIn({},{originalEvent:i})}),y("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})}),y("span","mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(i.b0(["_rotateCompassArrow"],this),this._compass=this._createButton("mapboxgl-ctrl-compass",i=>{let r=this._map;r&&(this.options.visualizePitch?r.resetNorthPitch({},{originalEvent:i}):r.resetNorth({},{originalEvent:i}))}),this._compassIcon=y("span","mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){let i=this._map;if(!i)return;let r=i.getZoom(),a=r===i.getMaxZoom(),n=r===i.getMinZoom();this._zoomInButton.disabled=a,this._zoomOutButton.disabled=n,this._zoomInButton.setAttribute("aria-disabled",a.toString()),this._zoomOutButton.setAttribute("aria-disabled",n.toString())}_rotateCompassArrow(){let i=this._map;if(!i)return;let r=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(i.transform.pitch*(Math.PI/180)
118),.5)}) rotateX(${i.transform.pitch}deg) rotateZ(${i.transform.angle*(180/Math.PI)}deg)`:`rotate(${i.transform.angle*(180/Math.PI)}deg)`;i._requestDomTask(()=>{this._compassIcon&&(this._compassIcon.style.transform=r)})}onAdd(i){return this._map=i,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),i.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&i.on("pitch",this._rotateCompassArrow),i.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new sQ(i,this._compass,this.options.visualizePitch)),this._container}onRemove(){let i=this._map;i&&(this._container.remove(),this.options.showZoom&&i.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&i.off("pitch",this._rotateCompassArrow),i.off("rotate",this._rotateCompassArrow),this._handler&&this._handler.off(),this._handler=void 0),this._map=void 0)}_createButton(i,r){let a=y("button",i,this._container);return a.type="button",a.addEventListener("click",r),a}_setButtonTitle(i,r){if(!this._map)return;let a=this._map._getUIString(`NavigationControl.${r}`);i.setAttribute("aria-label",a),i.firstElementChild&&i.firstElementChild.setAttribute("title",a)}},GeolocateControl:class extends i.E{constructor(r={}){super();let a=navigator.geolocation;this.options=Object.assign({geolocation:a},s6,r),i.b0(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker","_updateMarkerRotation","_onDeviceOrientation"],this),this._updateMarkerRotationThrottled=oW(this._updateMarkerRotation,20),this._numberOfWatches=0}onAdd(i){return this._map=i,this._container=y("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkGeolocationSupport(this._setupUI),this._container}onRemove(){this._clearRequestTimeout(),void 0!==this._geolocationWatchID&&(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(i){let r=(r=!!this.options.geolocation)=>{this._supportsGeolocation=r,i(r)};void 0!==this._supportsGeolocation?i(this._supportsGeolocation):void 0!==navigator.permissions?navigator.permissions.query({name:"geolocation"}).then(i=>r("denied"!==i.state)).catch(()=>r()):r()}_isOutOfMapMaxBounds(i){let r=this._map.getMaxBounds(),a=i.coords;return!!r&&(a.longitude<r.getWest()||a.longitude>r.getEast()||a.latitude<r.getSouth()||a.latitude>r.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(r){if(this._map){if(this._clearRequestTimeout(),this._isOutOfMapMaxBounds(r))return this._setErrorState(),this.fire(new i.z("outofmaxbounds",r)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=r,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this.options.followUserLocation?(this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active")):(this._watchState="BACKGROUND",this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"));break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background")}this.options.showUserLocation&&"OFF"!==this._watchState&&this._updateMarker(r),this.options.followUserLocation&&(!this.options.trackUserLocation||"ACTIVE_LOCK"===this._watchState)&&this._updateCamera(r),this.options.showUserLocation&&this._userLocationDotMarker.removeClassName("mapboxgl-user-location-dot-stale"),this.fire(new i.z("geolocate",Object.assign({coords:r.coords,timestamp:r.timestamp},r.toJSON?{toJSON:r.toJSON.bind(r)}:{}))),this._finish()}}
118_updateCamera(r){let a=new i.aX(r.coords.longitude,r.coords.latitude),n=r.coords.accuracy,o=Object.assign({bearing:this._map.getBearing()},this.options.fitBoundsOptions);this._map.fitBounds(a.toBounds(n),o,{geolocateSource:!0})}_updateMarker(r){if(r){let a=new i.aX(r.coords.longitude,r.coords.latitude);this._accuracyCircleMarker.setLngLat(a).addTo(this._map),this._userLocationDotMarker.setLngLat(a).addTo(this._map),this._accuracy=r.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){let r=this._map.transform,a=i.bY(1,r._center.lat)*r.worldSize,n=Math.ceil(2*this._accuracy*a);this._circleElement.style.width=`${n}px`,this._circleElement.style.height=`${n}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}_updateMarkerRotation(){this._userLocationDotMarker&&"number"==typeof this._heading?(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(r){if(this._map){if(this._clearRequestTimeout(),this.options.trackUserLocation)if(1===r.code){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;let i=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.setAttribute("aria-label",i),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",i),void 0!==this._geolocationWatchID&&this._clearWatch()}else{if(3===r.code&&this._noTimeout)return;this._setErrorState()}"OFF"!==this._watchState&&this.options.showUserLocation&&this._userLocationDotMarker.addClassName("mapboxgl-user-location-dot-stale"),this.fire(new i.z("error",{code:r.code,message:r.message,PERMISSION_DENIED:r.PERMISSION_DENIED,POSITION_UNAVAILABLE:r.POSITION_UNAVAILABLE,TIMEOUT:r.TIMEOUT})),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_startRequestTimeout(){this._clearRequestTimeout();let i=this.options.positionOptions.timeout;i&&(this._requestTimeoutId=window.setTimeout(()=>{this._onError({code:3,message:"Geolocation request timed out"})},i))}_clearRequestTimeout(){void 0!==this._requestTimeoutId&&(clearTimeout(this._requestTimeoutId),this._requestTimeoutId=void 0)}_setupUI(r){if(void 0!==this._map){if(this._container.addEventListener("contextmenu",i=>i.preventDefault()),this._geolocateButton=y("button","mapboxgl-ctrl-geolocate",this._container),y("span","mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",!1===r){i.w("Geolocation support is not available so the GeolocateControl will be disabled.");let r=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.setAttribute("aria-label",r),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",r)}else{let 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","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=y("div","mapboxgl-user-location"),this._dotElement.appendChild(y("div","mapboxgl-user-location-dot")),this._dotElement.appendChild(y("div","mapboxgl-user-location-heading")),this._userLocationDotMarker=new s4({element:this._dotElement,rotationAlignment:"map",pitchAlignment:"map"}),this._circleElement=y("div","mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new s4({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",r=>{r.geolocateSource||"ACTIVE_LOCK"!==this._watchState||r.originalEvent&&"resize"===r.originalEvent.type||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this.fire(new i.z("trackuserlocationend")))})}}_onDeviceOrientation(i){this._userLocationDotMarker&&(i.webkitCompassHeading?this._heading=i.webkitCompassHeading:!0===i.absolute&&(this._heading=-1*i.alpha),this._updateMarkerRotationThrottled())}trigger(){if(!this._setup)return i.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 i.z("trackuserlocationstart"));break;
118case"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 i.z("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new i.z("trackuserlocationstart"))}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"BACKGROUND":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background");break;case"BACKGROUND_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error")}if("OFF"===this._watchState&&void 0!==this._geolocationWatchID)this._clearWatch();else if(void 0===this._geolocationWatchID){let i;this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),this._numberOfWatches++,this._numberOfWatches>1?(i={maximumAge:6e5,timeout:0},this._noTimeout=!0):(i=this.options.positionOptions,this._noTimeout=!1),this._geolocationWatchID=this.options.geolocation.watchPosition(this._onSuccess,this._onError,i),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(r){return this.options.followUserLocation=null!=r?r:s6.followUserLocation,this.options.trackUserLocation&&"OFF"!==this._watchState&&(this.options.followUserLocation?"BACKGROUND"!==this._watchState&&"BACKGROUND_ERROR"!==this._watchState||(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 i.z("trackuserlocationstart"))):"ACTIVE_LOCK"!==this._watchState&&"ACTIVE_ERROR"!==this._watchState||(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 i.z("trackuserlocationend")))),this}_addDeviceOrientationListener(){let i=()=>{let i="ondeviceorientationabsolute"in window?"deviceorientationabsolute":"deviceorientation";window.addEventListener(i,this._onDeviceOrientation)};"function"==typeof DeviceOrientationEvent.requestPermission?DeviceOrientationEvent.requestPermission().then(r=>{"granted"===r&&i()}).catch(console.error):i()}_clearWatch(){this._clearRequestTimeout(),this.options.geolocation.clearWatch(this._geolocationWatchID),window.removeEventListener("deviceorientation",this._onDeviceOrientation),window.removeEventListener("deviceorientationabsolute",this._onDeviceOrientation),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","fal
118se"),this.options.showUserLocation&&this._updateMarker(null)}},AttributionControl:sG,ScaleControl:class{constructor(r={}){this.options=Object.assign({},s8,r),i.b0(["_update","_setScale","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_update(){let i=this.options.maxWidth||100,r=this._map,a=r._containerHeight/2,n=r._containerWidth/2-i/2,o=r.unproject([n,a]),s=r.unproject([n+i,a]),l=o.distanceTo(s);if("imperial"===this.options.unit){let r=3.2808*l;r>5280?this._setScale(i,r/5280,"mile"):this._setScale(i,r,"foot")}else"nautical"===this.options.unit?this._setScale(i,l/1852,"nautical-mile"):l>=1e3?this._setScale(i,l/1e3,"kilometer"):this._setScale(i,l,"meter")}_setScale(i,r,a){this._map._requestDomTask(()=>{let n=function(i){let r=Math.pow(10,`${Math.floor(i)}`.length-1),a=i/r;return r*(a=a>=10?10:a>=5?5:a>=3?3:a>=2?2:a>=1?1:function(i){let r=Math.pow(10,Math.ceil(-Math.log(i)/Math.LN10));return Math.round(i*r)/r}(a))}(r),o=n/r;this._container.innerHTML="nautical-mile"!==a?new Intl.NumberFormat(this._language,{style:"unit",unitDisplay:"short",unit:a}).format(n):`${n} ${s9[a]}`,this._container.style.width=i*o+"px"})}onAdd(i){return this._map=i,this._language=i.getLanguage(),this._container=y("div","mapboxgl-ctrl mapboxgl-ctrl-scale",i.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(i){this._language=i,this._update()}setUnit(i){this.options.unit=i,this._update()}},FullscreenControl:class{constructor(r={}){this._fullscreen=!1,r&&r.container&&(r.container instanceof HTMLElement?this._container=r.container:i.w("Full screen control 'container' must be a DOM element.")),i.b0(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onwebkitfullscreenchange"in document&&(this._fullscreenchange="webkitfullscreenchange")}onAdd(r){return this._map=r,this._container||(this._container=this._map.getContainer()),this._controlContainer=y("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",i.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(){let i=this._fullscreenButton=y("button","mapboxgl-ctrl-fullscreen",this._controlContainer);y("span","mapboxgl-ctrl-icon",i).setAttribute("aria-hidden","true"),i.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){let i=this._getTitle();this._fullscreenButton.setAttribute("aria-label",i),this._fullscreenButton.firstElementChild&&this._fullscreenButton.firstElementChild.setAttribute("title",i)}_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(){i.b0(["_onIndoorUpdate","_onStyleData","_scrollUp","_scrollDown","_toggleIndoor"],this),this._visibleFloorStart=0,this._lastSelectedFloorId=null}onAdd(i){return this._map=i,this._container=y("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){let i=this._map.style.indoorManager;i.off("selector-update",this._onIndoorUpdate),i.on("selector-update",this._onIndoorUpdate),this._onIndoorUpdate(i.getControlState())}}_createButton(i,r){let a=y("button",i,this._container);return a.type="button",a.addEventListener("click",r),a}_setButtonTitle(i,r){i.setAttribute("aria-label",r),i.textContent=r}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(i){if(!i||!i.floors||0===i.floors.length)return this._model=i,void(this._container.style.display="none");let r=this._model;this._model=i,this._container.style.display="inline-block";let a=!r||r.floors.length!==i.floors.length||r.floors.some((r,a)=>r.id!==i.floors[a].id);if(a&&(this._visibleFloorStart=0,this._lastSelectedFloorId=null),i.selectedFloorId){if(i.selectedFloorId!==this._lastSelectedFloorId||a){let r=i.floors.findIndex(r=>
118r.id===i.selectedFloorId);if(-1!==r){let a,n,o=i.floors.length;o<=5?(a=0,n=o-1):0===this._visibleFloorStart?(a=0,n=3):this._visibleFloorStart>=o-3?(a=o-3-1,n=o-1):(a=this._visibleFloorStart,n=this._visibleFloorStart+3-1),r<a?this._visibleFloorStart=r:r>n&&(this._visibleFloorStart=r-2)}}this._lastSelectedFloorId=i.selectedFloorId}this._render()}_render(){if(!this._container||!this._model||!this._model.floors)return;this._container.innerHTML="";let i=this._createButton("mapboxgl-ctrl-indoor-toggle",this._toggleIndoor);y("span","mapboxgl-ctrl-icon",i).setAttribute("aria-hidden","true"),this._model.activeFloorsVisible||i.classList.add("mapboxgl-ctrl-level-button-selected"),this._container.appendChild(i);let r=this._model.floors,a=r.length;if(a<=5)return void r.forEach(i=>this._createFloorButton(i));let n=0===this._visibleFloorStart,o=this._visibleFloorStart>=a-3;if(n)this._createFloorButton(r[0]);else{let i=this._createButton("mapboxgl-ctrl-arrow-up",this._scrollUp);y("span","mapboxgl-ctrl-icon",i).setAttribute("aria-hidden","true"),this._container.appendChild(i)}if((n?r.slice(1,4):o?r.slice(this._visibleFloorStart-1,this._visibleFloorStart+3-1):r.slice(this._visibleFloorStart,this._visibleFloorStart+3)).forEach(i=>this._createFloorButton(i)),o)this._createFloorButton(r[a-1]);else{let i=this._createButton("mapboxgl-ctrl-arrow-down",this._scrollDown);y("span","mapboxgl-ctrl-icon",i).setAttribute("aria-hidden","true"),this._container.appendChild(i)}}_createFloorButton(i){let r=this._createButton("mapboxgl-ctrl-level-button",()=>{let r=i.id;this._model&&this._model.selectedFloorId===r&&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(r))}),a=(i.name||"").trim(),n=i.zIndex.toString(),o=a?Array.from(a).slice(0,3).join(""):n;this._setButtonTitle(r,o),this._model&&this._model.activeFloorsVisible&&i.id===this._model.selectedFloorId&&r.classList.add("mapboxgl-ctrl-level-button-selected"),this._container&&this._container.appendChild(r)}_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--,1===this._visibleFloorStart&&(this._visibleFloorStart=0);let i=this._model&&this._model.floors||[];if(i.length>3){let r=i.length-3;this._visibleFloorStart===r-1&&(this._visibleFloorStart=r-2)}this._render()}}_scrollDown(){if(this._model&&this._model.floors){let i=this._model.floors.length-3;this._visibleFloorStart<i&&(this._visibleFloorStart++,1===this._visibleFloorStart&&(this._visibleFloorStart=2),this._visibleFloorStart===i-1&&(this._visibleFloorStart=i),this._visibleFloorStart>i&&(this._visibleFloorStart=i),this._render())}}},Popup:class extends i.E{constructor(r){super(),this.options=Object.assign(Object.create(le),r),this._altitude=this.options.altitude,i.b0(["_update","_onClose","remove","_onMouseEvent"],this),this._classList=new Set(r&&r.className?r.className.trim().split(s7):[])}addTo(r){return this._map&&this.remove(),this._map=r,this.options.closeOnClick&&r.on("preclick",this._onClose),this.options.closeOnMove&&r.on("move",this._onClose),r.on("remove",this.remove),this._update(),r._addPopup(this),this._focusFirstElement(),this._trackPointer?(r.on("mousemove",this._onMouseEvent),r.on("mouseup",this._onMouseEvent),r._canvasContainer.classList.add("mapboxgl-track-pointer")):r.on("move",this._update),this.fire(new i.z("open")),this}isOpen(){return!!this._map}remove(){this._content&&this._content.remove(),this._container&&(this._container.remove(),this._container=void 0);let r=this._map;return r&&(r.off("move",this._update),r.off("move",this._onClose),r.off("preclick",this._onClose),r.off("click",this._onClose),r.off("remove",this.remove),r.off("mousemove",this._onMouseEvent),r.off("mouseup",this._onMouseEvent),r.off("drag",this._onMouseEvent),r._canvasContainer&&r._canvasContainer.classList.remove("mapboxgl-track-pointer"),r._removePopup(this),this._map=void 0),this.fire(new i.z("close")),this}getLngLat(){return this._lngLat}setLngLat(r){this._lngLat=i.aX.convert(r),this._pos=null,this._trackPointer=!1,this._update();let a=this._map;return a&&(a.on("move",this._update),a.off("mousemove",this._onMouseEvent),a._canvasContainer.classList.remove("mapboxgl-track-pointer")),this}getAltitude(){return this._altitude}setAltitude(i){return this._altitude=i,this._update(),this}trackPointer(){this._trackPointer=!0,this._pos=null,this._update();let i=this._map;return i&&(i.off("move",this._update),i.on("mousemove",this._onMouseEvent),i.on("drag",this._onMouseEvent),i._canvasContainer.classList.add("mapboxgl-track-pointer")),this}getElement(){return this._container}setText(i){return this.setDOMContent(document.createTextNode(i))}setHTML(i){let r,a=document.createDocumentFragment(),n=document.createElement("body");for(n.innerHTML=i;r=n.firstChild;)a.appendChild(r);return this.setDOMContent(a)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(i){return this.options.maxWidth=i,this._update(),this}setDOMContent(i){let r=this._content;if(r)for(;r.hasChildNodes();)r.firstChild&&r.removeChild(r.firstChild);else r=this._content=y("div","mapboxgl-popup-content",this._container||void 0);
118if(r.appendChild(i),this.options.closeButton){let i=this._closeButton=y("button","mapboxgl-popup-close-button",r);i.type="button",i.setAttribute("aria-label","Close popup"),i.innerHTML='<span aria-hidden="true">×</span>',i.addEventListener("click",this._onClose)}return this._update(),this._focusFirstElement(),this}addClassName(i){return this._classList.add(i),this._updateClassList(),this}removeClassName(i){return this._classList.delete(i),this._updateClassList(),this}setOffset(i){return this.options.offset=i,this._update(),this}toggleClassName(i){let r;return this._classList.delete(i)?r=!1:(this._classList.add(i),r=!0),this._updateClassList(),r}_onMouseEvent(i){this._update(i.point)}_getAnchor(i){if(this.options.anchor)return this.options.anchor;let r=this._map,a=this._container,n=this._pos;if(!r||!a||!n)return"bottom";let o=a.offsetWidth,s=a.offsetHeight,l=n.x<o/2,h=n.x>r.transform.width-o/2;if(n.y+i<s)return l?"top-left":h?"top-right":"top";if(n.y>r.transform.height-s){if(l)return"bottom-left";if(h)return"bottom-right"}return l?"left":h?"right":"bottom"}_updateClassList(){let i=this._container;if(!i)return;let r=[...this._classList];r.push("mapboxgl-popup"),this._anchor&&r.push(`mapboxgl-popup-anchor-${this._anchor}`),this._trackPointer&&r.push("mapboxgl-popup-track-pointer"),i.className=r.join(" ")}_update(r){let a=this._map,n=this._content;if(!a||!this._lngLat&&!this._trackPointer||!n)return;let o=this._container;if(o||(o=this._container=y("div","mapboxgl-popup",a.getContainer()),this._tip=y("div","mapboxgl-popup-tip",o),o.appendChild(n)),this.options.maxWidth&&o.style.maxWidth!==this.options.maxWidth&&(o.style.maxWidth=this.options.maxWidth),a.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=s0(this._lngLat,this._pos,a.transform)),!this._trackPointer||r){let n=this._pos=this._trackPointer&&r instanceof i.P?r:a.project(this._lngLat,this._altitude),o=lt(this.options.offset),s=this._anchor=this._getAnchor(o.y),l=lt(this.options.offset,s),h=n.add(l).round();a._requestDomTask(()=>{this._container&&s&&(this._container.style.transform=`${s1[s]} translate(${h.x}px,${h.y}px)`)})}if(!this._marker&&a._showingGlobe()){let r=+!i.f2(a.transform,this._lngLat);this._setOpacity(r)}this._updateClassList()}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;let i=this._container.querySelector("a[href], [tabindex]:not([tabindex='-1']), [contenteditable]:not([contenteditable='false']), button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])");i&&i.focus()}_onClose(){this.remove()}_setOpacity(i){this._container&&(this._container.style.opacity=`${i}`),this._content&&(this._content.style.pointerEvents=i?"auto":"none")}},Marker:s4,Style:rS,LngLat:i.aX,LngLatBounds:i.aI,Point:i.P,MercatorCoordinate:i.ad,FreeCameraOptions:i3,Evented:i.E,config:i.g,prewarm:function(){ii().acquire(tU)},clearPrewarmedResources:function(){let i=s;i&&(i.isPreloaded()&&1===i.numActive()?(i.release(tU),s=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 i.g.ACCESS_TOKEN},set accessToken(t){i.g.ACCESS_TOKEN=t},get baseApiUrl(){return i.g.API_URL},set baseApiUrl(t){i.g.API_URL=t},get workerCount(){return tV.workerCount},set workerCount(e){tV.workerCount=e},get maxParallelImageRequests(){return i.g.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(t){i.g.MAX_PARALLEL_IMAGE_REQUESTS=t},clearStorage(r){i.fb(r)},get workerUrl(){return tN.workerUrl},set workerUrl(e){tN.workerUrl=e},get workerClass(){return tN.workerClass},set workerClass(e){tN.workerClass=e},get workerParams(){return tN.workerParams},set workerParams(e){tN.workerParams=e},get dracoUrl(){return i.fa()},set dracoUrl(t){i.g.DRACO_URL=i.o.resolveURL(t)},get meshoptUrl(){return i.f9()},set meshoptUrl(t){let r=i.o.resolveURL(t);i.g.MESHOPT_URL=r,i.g.MESHOPT_SIMD_URL=r},get buildingGenUrl(){return i.f8()},set buildingGenUrl(t){i.g.BUILDING_GEN_URL=i.o.resolveURL(t)},setNow:i.o.setNow,restoreNow:i.o.restoreNow}}),a}()}}]);
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.