PageSourceSearch

https://www.vistex.com/_next/static/chunks/50d3ae47-cfc8e9c6d30088d0.js

js vistex.com collected 2026-09-24 21:06:03 UTC 1,840,301 bytes, 118 lines download raw bytes

vendor: 8,730 bytes, line 1
1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3602],{11324: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 = {}; self.__mapboxImport = (u) => import(u); ("+i+")(undefined, sharedChunk); ("+r+")(undefined, sharedChunk); self.onerror = null;";"undefined"!=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"undefined"!=typeof self&&(self.__mapboxImport=i=>import(i)),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,R,D,L,z,F,O,B,k,N,V,U,j,G,Z,$,H,q;var W="3.31.0",X="undefined"!=typeof Float32Array?Float32Array:Array;function Y(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 K(){var i=new X(9);return X!=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,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(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}function ee(){var i=new X(16);return X!=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 et(i){var r=new X(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 ei(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}function er(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 ea(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]=h}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}function en(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,R=f*x-m*y,D=v*R-b*P+w*C+T*M-S*A+E*I;return D?(i[0]=(h*R-u*P+c*C)*(D=1/D),i[1]=(o*P-n*R-s*C)*D,i[2]=(g*E-y*S+x*T)*D,i[3]=(f*S-p*E-m*T)*D,i[4]=(u*M-l*R-c*A)*D,i[5]=(a*R-o*M+s*A)*D,i[6]=(y*w-_*E-x*b)*D,i[7]=(d*E-f*w+m*b)*D,i[8]=(l*P-h*M+c*I)*D,i[9]=(n*M-a*P-s*I)*D,i[10]=(_*S-g*w+x*v)*D,i[11]=(p*w-d*S-m*v)*D,i[12]=(h*A-l*C-u*I)*D,i[13]=(a*C-n*A+o*I)*D,i[14]=(g*b-_*T-y*v)*D,i[15]=(d*T-p*b+f*v)*D,i):null}function eo(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 es(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 el(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 eh(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 eu(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 ec(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 ed(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 ep(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 ef(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 em(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 e_(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}var eg=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},ey=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};function ex(){var i=new X(3);return X!=Float32Array&&(i[0]=0,i[1]=0,i[2]=0),i}function ev(i){var r=new X(3);return r[0]=i[0],r[1]=i[1],r[2]=i[2],r}function eb(i){var r=i[0],a=i[1],n=i[2];return Math.sqrt(r*r+a*a+n*n)}function ew(i,r,a){var n=new X(3);return n[0]=i,n[1]=r,n[2]=a,n}function eT(i,r,a,n){return i[0]=r,i[1]=a,i[2]=n,i}function eS(i,r,a){return i[0]=r[0]+a[0],i[1]=r[1]+a[1],i[2]=r[2]+a[2],i}function eE(i,r,a){return i[0]=r[0]-a[0],i[1]=r[1]-a[1],i[2]=r[2]-a[2],i}function eI(i,r,a){return i[0]=r[0]*a[0],i[1]=r[1]*a[1],i[2]=r[2]*a[2],i}function eA(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 eM(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 eC(i,r,a){return i[0]=r[0]*a,i[1]=r[1]*a,i[2]=r[2]*a,i}function eP(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 eR(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 eD(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 eL(i){var r=i[0],a=i[1],n=i[2];return r*r+a*a+n*n}function ez(i,r){return i[0]=-r[0],i[1]=-r[1],i[2]=-r[2],i}function eF(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 eO(i,r){return i[0]*r[0]+i[1]*r[1]+i[2]*r[2]}function eB(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 ek(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 eN(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 eV(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 eU(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 ej(i){return i[0]=0,i[1]=0,i[2]=0,i}function eG(i,r){return i[0]===r[0]&&i[1]===r[1]&&i[2]===r[2]}function eZ(){var i=new X(4);return X!=Float32Array&&(i[0]=0,i[1]=0,i[2]=0,i[3]=0),i}function e$(i,r,a,n){var o=new X(4);return o[0]=i,o[1]=r,o[2]=a,o[3]=n,o}function eH(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 eq(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 eW(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 eX(){var i=new X(4);return X!=Float32Array&&(i[0]=0,i[1]=0,i[2]=0),i[3]=1,i}function eY(i){return i[0]=0,i[1]=0,i[2]=0,i[3]=1,i}function eK(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 eJ(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}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+o*h,i[1]=o*u-n*h,i[2]=s*u+l*h,i[3]=l*u-s*h,i}ex(),eZ();var e0,e1,e2,e3=(e0=ex(),e1=ew(1,0,0),e2=ew(0,1,0),function(i,r,a){var n,o,s=eO(r,a);return s<-.999999?(eB(e0,e1,r),1e-6>eb(e0)&&eB(e0,e2,r),eF(e0,e0),o=Math.sin(n=.5*Math.PI),i[0]=o*e0[0],i[1]=o*e0[1],i[2]=o*e0[2],i[3]=Math.cos(n),i):s>.999999?(i[0]=0,i[1]=0,i[2]=0,i[3]=1,i):(eB(e0,r,a),i[0]=e0[0],i[1]=e0[1],i[2]=e0[2],i[3]=1+s,eq(i,i))});function e5(){var i=new X(2);return X!=Float32Array&&(i[0]=0,i[1]=0),i}function e4(i,r){var a=new X(2);return a[0]=i,a[1]=r,a}function e6(i,r,a){return i[0]=r[0]+a[0],i[1]=r[1]+a[1],i}function e8(i,r,a){return i[0]=r[0]-a[0],i[1]=r[1]-a[1],i}function e9(i,r,a){return i[0]=r[0]*a,i[1]=r[1]*a,i}function e7(i){var r=i[0],a=i[1];return Math.sqrt(r*r+a*a)}function te(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 tt(i,r){return i[0]*r[0]+i[1]*r[1]}function ti(i,r,a,n){let o=3*i,s=3*(a-i)-o,l=1-o-s,h=3*r,u=3*(n-r)-h,c=1-h-u;return function(i,r=1e-6){if(i<=0)return 0;if(i>=1)return 1;let a=i;for(let n=0;n<8;n++){let n=((l*a+s)*a+o)*a-i;if(Math.abs(n)<r)return((c*a+u)*a+h)*a;let d=(3*l*a+2*s)*a+o;if(1e-6>Math.abs(d))break;a-=n/d}let n=0,d=1;a=i;for(let h=0;h<20;h++){let h=((l*a+s)*a+o)*a;if(Math.abs(h-i)<r)break;i>h?n=a:d=a,a=.5*(n+d)}return((c*a+u)*a+h)*a}}function tr(i,r){this.x=i,this.y=r}function ta(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(!ta(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(!ta(i[a],r[a]))return!1;return!0}return i===r}function tn(i,r,a){let n=i[r];i[r]=i[a],i[a]=n}eX(),eX(),K();function to(i,r){return r.area-i.area}function ts(i,r){let a,n,o=i.length,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&&function(i){let r=i.length;if(r<3)return!0;let a=i[0],n=0,o=0,s=1;for(;s<r&&(n=i[s].x-a.x,o=i[s].y-a.y,0===n&&0===o);s++);if(s===r)return!0;for(;s<r;s++)if(n*(i[s].y-a.y)-o*(i[s].x-a.x)!=0)return!1;return!0}(i[r])||(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++){let a=s[i];a.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(tn(r,n,a),s(r[o],l)>0&&tn(r,n,o);h<u;){for(tn(r,h,u),h++,u--;0>s(r[h],l);)h++;for(;s(r[u],l)>0;)u--}0===s(r[n],l)?tn(r,n,u):tn(r,++u,o),u<=a&&(n=u+1),a<=u&&(o=u-1)}}(a,r,1,a.length-1,to),s[i]=a.slice(0,r))}return s}function tl(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 th(i,r){return!(i[0]<=r[0]||i[2]>=r[2]||i[1]<=r[1]||i[3]>=r[3])}function tu(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 tc(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 td(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]&&!(!tc(i,r,a,n)||!tc(a,n,i,r))}function tp(i){let r=new tr(1/0,1/0),a=new tr(-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}}e5(),tr.prototype={clone(){return new tr(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)},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:tr},tr.convert=function(i){if(i instanceof tr)return i;if(Array.isArray(i))return new tr(+i[0],+i[1]);if(void 0!==i.x&&void 0!==i.y)return new tr(+i.x,+i.y);throw Error("Expected [x, y] or {x, y} point format")};let tf=Math.PI/180,tm=180/Math.PI,t_=/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,tg=[[0,0],[1,0],[1,1],[0,1]];function ty(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)}let tx=ti(.25,.1,.25,1);function tv(i,r,a){return Math.min(a,Math.max(r,i))}function tb(i,r,a){return(a=tv((a-i)/(r-i),0,1))*a*(3-2*a)}function tw(i,r,a){let n=a-r,o=((i-r)%n+n)%n+r;return o===r?a:o}function tT(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 tS(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 tE=1;function tI(){return function i(r){return r?(r^Math.random()*(16>>r/4)).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,i)}()}function tA(i){return i<=1?1:Math.pow(2,Math.ceil(Math.log2(i)))}function tM(i){return!!i&&t_.test(i)}function tC(i,r){i.forEach(i=>{r[i]&&(r[i]=r[i].bind(r))})}function tP(i,r,a){let n={};for(let a in i)n[a]=r.call(this,i[a],a,i);return n}function tR(i,r,a){let n={};for(let a in i)r.call(this,i[a],a,i)&&(n[a]=i[a]);return n}function tD(i){return Array.isArray(i)?i.map(tD):"object"==typeof i&&i?tP(i,tD):i}function tL(i,r){for(let a=0;a<i.length;a++)if(r.includes(i[a]))return!0;return!1}let tz={};function tF(i){tz[i]||("undefined"!=typeof console&&console.warn(i),tz[i]=!0)}function tO(i,r,a){return(a.y-i.y)*(r.x-i.x)>(r.y-i.y)*(a.x-i.x)}function tB([i,r,a]){let n=(r+90)*tf,o=a*tf;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 tk(i,r,a){let n=Math.sqrt(i*i+r*r+a*a),o=n>0?Math.acos(a/n)*tm:0,s=0!==i||0!==r?Math.atan2(-r,-i)*tm+90:0;return s<0&&(s+=360),[n,s,o]}function tN(i){return("undefined"!=typeof self||void 0!==i)&&"undefined"!=typeof WorkerGlobalScope&&(void 0!==i?i:self)instanceof WorkerGlobalScope}function tV(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}function tU(i){return i?{cacheControl:i.get("cache-control"),expires:i.get("expires")}
1:{cacheControl:void 0,expires:void 0}}function tj(i){try{let r=self[i];return r.setItem("_mapbox_test_",1),r.removeItem("_mapbox_test_"),!0}catch(i){return!1}}function tG(i,r){return[i[4*r],i[4*r+1],i[4*r+2],i[4*r+3]]}function tZ(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]}function t$(i){return[Math.pow(i[0],1/2.2),Math.pow(i[1],1/2.2),Math.pow(i[2],1/2.2)]}function tH(i){return i>0?1/(1.001-i):1+i}function tq(i){return i>0?1-1/(1.001-i):-i}function tW(i,r,a){return(i-r.min)*(a.max-a.min)/(r.max-r.min)+a.min}function tX(i){return i*i*i*i*i}function tY(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}function tK(){return a??=self.OffscreenCanvas&&!!new OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof self.createImageBitmap}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&&(o??=window.matchMedia("(prefers-reduced-motion: reduce)")).matches},hasCanvasFingerprintNoise(){if(void 0!==h)return h;if(!tK())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}},tQ={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(!tQ.API_URL)return null;try{let i=new URL(tQ.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",MESHOPT_URL:"/mapbox-gl-js/meshopt_base_v1.2.wasm",MESHOPT_SIMD_URL:"/mapbox-gl-js/meshopt_simd_v1.2.wasm",BUILDING_GEN_URL:"/mapbox-gl-js/building-gen/building_gen_v1.2.6.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 t0(){return new URL(tQ.DRACO_URL,tQ.API_URL).href}function t1(){if("object"!=typeof WebAssembly)throw Error("WebAssembly not supported, cannot instantiate meshoptimizer");return new URL(!function(){if(void 0===u){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]);u=WebAssembly.validate(i)}return u}()?tQ.MESHOPT_URL:tQ.MESHOPT_SIMD_URL,tQ.API_URL).href}function t2(){return new URL(tQ.BUILDING_GEN_URL,tQ.API_URL).href}
1function t3(i,r){let a=i.indexOf("?"),n=a<0?i:i.slice(0,a),o=new URLSearchParams(a<0?"":i.slice(a));for(let[i,a]of Object.entries(r))o.set(i,a);return`${n}?${o}`}function t5(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 t4="mapbox-tiles",t6=500,t8=50,t9=["language","worldview","jobid"];function t7(){try{return caches}catch(i){}}function ie(){let i=t7();i&&null==c&&(c=i.open(t4))}let it=1/0;function ii(i){return tQ.API_URL_REGEX.test(i)}function ir(i){return 0===i.indexOf("mapbox:")}function ia(i){return tQ.API_CDN_URL_REGEX.test(i)}function io(i){return tQ.API_SPRITE_REGEX.test(i)}function is(i){return tQ.API_STYLE_REGEX.test(i)&&!io(i)}let il={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Iconset:"Iconset",Image:"Image",Model:"Model"};Object.freeze(il);class ih extends Error{constructor(i,r,a){super(),this.url=a,this.statusText=i,this.status=r}get message(){return 401===this.status&&ii(this.url)?`${this.statusText}: you may have provided an invalid Mapbox access token. See https://docs.mapbox.com/api/guides/#access-tokens-and-token-scopes`:this.statusText}toString(){return`${this.name}: ${this.message} (${this.status}): ${this.url}`}}function iu(i){return"object"==typeof i&&null!==i&&"status"in i&&404===i.status}let ic=tN()?()=>self.worker.referrer:()=>("blob:"===location.protocol?parent:self).location.href,id=/^\w+:/,ip=/[\r\n]+/;async function im(i,r){return{data:"arrayBuffer"===i.type?await r.arrayBuffer():"json"===i.type?await r.json():await r.text(),headers:r.headers}}async function i_(i,r){var a;return r&&r.throwIfAborted(),(a=i.url).startsWith("file:")||ic().startsWith("file:")&&!id.test(a)?async function(i,r){return new Promise((a,n)=>{let o=new XMLHttpRequest,s=()=>{r.removeEventListener("abort",s),o.abort(),n(r.reason)};for(let a in r&&r.addEventListener("abort",s),o.open(i.method||"GET",i.url,!0),"arrayBuffer"===i.type&&(o.responseType="arraybuffer"),i.headers)o.setRequestHeader(a,i.headers[a]);"json"===i.type&&(o.responseType="text",o.setRequestHeader("Accept","application/json")),o.withCredentials="include"===i.credentials,o.onerror=()=>{r&&r.removeEventListener("abort",s),n(Error(o.statusText))},o.onload=()=>{if(r&&r.removeEventListener("abort",s),(o.status>=200&&o.status<300||0===o.status)&&null!==o.response){let r=o.response;if("json"===i.type)try{r=JSON.parse(o.response)}catch(i){return void n(i)}let s=new Headers;o.getAllResponseHeaders().trim().split(ip).forEach(i=>{let r=i.split(": "),a=r.shift(),n=r.join(": ");a&&s.set(a,n)}),a({data:r,headers:s})}else n(new ih(o.statusText,o.status,i.url))},o.send(i.body)})}(i,r):async function(i,r){var a;let n,o=new Request(i.url,{method:i.method||"GET",body:i.body,credentials:i.credentials,headers:i.headers,referrer:ic(),referrerPolicy:i.referrerPolicy,signal:r}),s=(a=o.url).indexOf("sku=")>0&&ii(a);if("json"===i.type&&o.headers.set("Accept","application/json"),s){let a=null;try{a=await async function(i){if(ie(),null==c)return null;
1let r=await c,a=t5(i.url,{persistentParams:t9}),n=i.headers.get("Range");n&&(a=t3(a,{range:n}));let o=await r.match(a);if(!o)return null;let s=function(i){if(!i)return!1;let r=new Date(i.headers.get("expires")||0),a=tV(i.headers.get("cache-control")||"");return Number(r)>Date.now()&&!a["no-cache"]}(o);return r.delete(a).catch(i=>tF(i.message)),s&&r.put(a,o.clone()).catch(i=>tF(i.message)),{response:o,fresh:s}}(o)}catch(i){"SecurityError"!==i.message&&tF(i.toString())}if(a&&a.fresh)return r&&r.throwIfAborted(),im(i,a.response)}let l=Date.now();try{n=await fetch(o)}catch(r){if("AbortError"===r.name)throw r;throw Error(`${r.message} ${i.url}`,{cause:r})}if(r&&r.throwIfAborted(),!n.ok)throw new ih(n.statusText,n.status,i.url);let h=s?n.clone():null,u=await im(i,n);return h&&async function(i,r,a){var n;if(ie(),null==c)return;let o=tV(r.headers.get("cache-control")||"");if(o["no-store"])return;let s={status:r.status,statusText:r.statusText,headers:new Headers(r.headers)};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=t5(i.url,{persistentParams:t9});if(206===r.status){let r=i.headers.get("Range");if(!r)return;s.status=200,h=t3(h,{range:r})}let u=new Response(200!==(n=r.status)&&404!==n&&[101,103,204,205,304].includes(n)?null:r.body,s);if(ie(),null!=c)try{let i=await c;await i.put(h,u)}catch(i){tF(i.message)}}(o,h,l),u}(i,r)}async function ig(i,r){return i_(Object.assign(i,{type:"json"}),r)}async function iy(i,r){return i_(Object.assign(i,{type:"arrayBuffer"}),r)}d=[],p=0;let ix={create:"create",load:"load",fullLoad:"fullLoad"};function iv(i){let r=i.name.split("?")[0];return ia(r)&&r.includes("mapbox-gl.js")?"javascript":ia(r)&&r.includes("mapbox-gl.css")?"css":tQ.API_FONTS_REGEX.test(r)?"fontRange":io(r)?"sprite":is(r)?"style":tQ.API_TILEJSON_REGEX.test(r)?"tilejson":"other"}let ib=/(\.(png|jpg)\d*)(?=$)/,iw=/^.+\/v4\//,iT=/\.[\w]+$/,iS=/^(\/v4\/|\/(raster|rasterarrays)\/v1\/)/,iE=/^access_token=(.*)$/,iI="NO_ACCESS_TOKEN",iA=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function iM(i){let r=i.match(iA);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 iC(i){let r=i.params.length?`?${i.params.join("&")}`:"";return`${i.protocol}://${i.authority}${i.path}${r}`}let iP="mapbox.eventData";function iR(i){if(!i)return null;let r=i.split(".");if(!r||3!==r.length)return null;try{return JSON.parse(decodeURIComponent(atob(r[1]).split("").map(i=>"%"+("00"+i.charCodeAt(0).toString(16)).slice(-2)).join("")))}catch(i){return null}}function iD(i){return!(!tQ.EVENTS_URL||!i&&!tQ.ACCESS_TOKEN)}let iL=/^[\w.+-]+(\/[\w.+-]+)?$/,iz="other";class iF{constructor(i){this.type=i,this.anonId=null,this.anonIdTimestamp=null,this.eventData={},this.queue=[],this.pendingRequest=!1}getStorageKey(i){let r=iR(tQ.ACCESS_TOKEN),a="";return a=r&&r.u?btoa(encodeURIComponent(r.u).replace(/%([0-9A-F]{2})/g,(i,r)=>String.fromCharCode(Number("0x"+r)))):tQ.ACCESS_TOKEN||"",i?`${iP}.${i}:${a}`:`${iP}:${a}`}fetchEventData(){let i=tj("localStorage"),r=this.getStorageKey(),a=this.getStorageKey("uuid"),n=this.getStorageKey("uuidTimestamp");if(i)try{let i=localStorage.getItem(r);i&&(this.eventData=JSON.parse(i));let o=localStorage.getItem(a);o&&(this.anonId=o);let s=localStorage.getItem(n);s&&(this.anonIdTimestamp=Number(s));let l=Date.now()-864e5;(!this.anonIdTimestamp||this.anonIdTimestamp<l)&&this.refreshUUID()}catch(i){tF("Unable to read from LocalStorage")}}refreshUUID(){this.anonId=tI(),this.anonIdTimestamp=Date.now()}saveEventData(){let i=tj("localStorage"),r=this.getStorageKey(),a=this.getStorageKey("uuid"),n=this.getStorageKey("uuidTimestamp"),o=this.anonId,s=this.anonIdTimestamp;if(i&&o)try{localStorage.setItem(a,o),Object.keys(this.eventData).length>=1&&localStorage.setItem(r,JSON.stringify(this.eventData)),s&&localStorage.setItem(n,s.toString())}catch(i){tF("Unable to write to LocalStorage")}}processRequests(){}postEvent(i,r,a,n){if(!tQ.EVENTS_URL)return;let o=iM(tQ.EVENTS_URL);o.params.push(`access_token=${n||tQ.ACCESS_TOKEN||""}`);let s={event:this.type,created:new Date(i).toISOString()},l=r?Object.assign(s,r):s,h={url:iC(o),headers:{"Content-Type":"text/plain"},body:JSON.stringify([l])};this.pendingRequest=!0,(async function(i){return i_(Object.assign(i,{method:"POST"}),void 0)})(h).then(()=>{this.pendingRequest=!1,a(null),this.saveEventData(),this.processRequests()}).catch(i=>{this.pendingRequest=!1,a(i),this.saveEventData(),this.processRequests()})}queueRequest(i,r){this.queue.push({...i,customAccessToken:r}),this.processRequests()}}class iO extends iF{constructor(i){super("metrics"),i&&(this.data=i)}postMetricsEvent(i){if(!iD(i))return;this.anonId||this.fetchEventData(),tM(this.anonId)||this.refreshUUID();let r={...this.data,sessionId:this.anonId};this.queueRequest({timestamp:Date.now(),payload:r},i)}processRequests(){if(this.pendingRequest||0===this.queue.length)return;let{timestamp:i,payload:r,customAccessToken:a}=this.queue.shift();this.postEvent(i,r,()=>{},a)}}let iB=new class extends iF{constructor(i){super("appUserTurnstile"),this._customAccessToken=i}postTurnstileEvent(i,r){iD(r)&&Array.isArray(i)&&i.some(i=>ir(i)||ii(i))&&this.queueRequest({timestamp:Date.now()},r)}processRequests(){if(this.pendingRequest||0===this.queue.length)return;this.anonId&&this.anonIdTimestamp&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();let i=iR(tQ.ACCESS_TOKEN),r=i?i.u:tQ.ACCESS_TOKEN,a=r!==this.eventData.tokenU;tM(this.anonId)||(this.refreshUUID(),a=!0);let{timestamp:n,customAccessToken:o}=this.queue.shift();if(this.eventData.lastSuccess){let i=new Date(this.eventData.lastSuccess),r=new Date(n),o=(n-this.eventData.lastSuccess)/864e5;a=a||o>=1||o<-1||i.getDate()!==r.getDate()}else a=!0;if(!a)return void this.processRequests();let s={version:"2.2",sdkIdentifier:"mapbox-gl-js",sdkVersion:W,skuId:"01","enabled.telemetry":!1,userId:this.anonId,bundleFormat:"umd",bundleDistribution:iz};f&&(s.sdkInfo=f),this.postEvent(n,s,i=>{i||(this.eventData.lastSuccess=n,this.eventData.tokenU=r)},o)}},ik=iB.postTurnstileEvent.bind(iB),iN=new class extends iF{constructor(){super("map.load"),this.success={},this.skuToken=""}postMapLoadEvent(i,r,a,n){this.skuToken=r,this.errorCb=n,tQ.EVENTS_URL&&(a||tQ.ACCESS_TOKEN?this.queueRequest({id:i,timestamp:Date.now()},a):this.errorCb(Error(iI)))}processRequests(){if(this.pendingRequest||0===this.queue.length)return;let{id:i,timestamp:r,customAccessToken:a}=this.queue.shift();if(i&&this.success[i])return;this.anonId&&this.anonIdTimestamp||this.fetchEventData(),tM(this.anonId)||this.refreshUUID();let n={version:"2.2",sdkIdentifier:"mapbox-gl-js",sdkVersion:W,skuId:"01",skuToken:this.skuToken,userId:this.anonId,bundleFormat:"umd",bundleDistribution:iz};f&&(n.sdkInfo=f),this.postEvent(r,n,r=>{r?this.errorCb(r):i&&(this.success[i]=!0)},a)}remove(){this.errorCb=null}},iV=iN.postMapLoadEvent.bind(iN),iU=new class extends iF{constructor(){super("style.load"),this.eventIdPerMapInstanceMap=new Map,this.mapInstanceIdMap=new WeakMap}getMapInstanceId(i){let r=this.mapInstanceIdMap.get(i);return r||(r=tI(),this.mapInstanceIdMap.set(i,r)),r}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(!iD(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(){if(this.pendingRequest||0===this.queue.length)return;let{timestamp:i,payload:r,customAccessToken:a}=this.queue.shift();this.postEvent(i,r,()=>{},a)}},ij=iU.postStyleLoadEvent.bind(iU),iG=new iO({attributes:[{name:"maps/js/layer
1-animations/style-with-appearances"}]}),iZ=iG.postMetricsEvent.bind(iG),i$=new iO({attributes:[{name:"maps/js/layer-animations/runtime-appearances"}]}),iH=i$.postMetricsEvent.bind(i$),iq=new class extends iF{constructor(){super("gljs.performance")}postPerformanceEvent(i,r){iD(i)&&this.queueRequest({timestamp:Date.now(),performanceData:r},i)}processRequests(){if(this.pendingRequest||0===this.queue.length)return;let{timestamp:i,performanceData:r,customAccessToken:a}=this.queue.shift(),n=function(i){let r=performance.getEntriesByType("resource"),a=performance.getEntriesByType("mark"),n=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}(r,iv)),o=window.devicePixelRatio,s=navigator.connection||navigator.mozConnection||navigator.webkitConnection,l=s?s.effectiveType:void 0,h={counters:[],metadata:[],attributes:[]},u=(i,r,a)=>{null!=a&&i.push({name:r,value:a.toString()})};for(let i in n)u(h.counters,i,n[i]);if(i.interactionRange[0]!==1/0&&i.interactionRange[1]!==-1/0&&(u(h.counters,"interactionRangeMin",i.interactionRange[0]),u(h.counters,"interactionRangeMax",i.interactionRange[1])),a)for(let i of Object.values(ix)){let r=a.find(r=>r.name===i);r&&u(h.counters,i,r.startTime)}return u(h.counters,"visibilityHidden",i.visibilityHidden),u(h.attributes,"style",function(i){if(i)for(let r of i){let i=r.name.split("?")[0];if(is(i)){let r=i.split("/").slice(-2);if(2===r.length)return`mapbox://styles/${r[0]}/${r[1]}`}}}(r)),u(h.attributes,"terrainEnabled",i.terrainEnabled?"true":"false"),u(h.attributes,"fogEnabled",i.fogEnabled?"true":"false"),u(h.attributes,"projection",i.projection),u(h.attributes,"zoom",i.zoom),u(h.metadata,"devicePixelRatio",o),u(h.metadata,"connectionEffectiveType",l),u(h.metadata,"navigatorUserAgent",navigator.userAgent),u(h.metadata,"screenWidth",window.screen.width),u(h.metadata,"screenHeight",window.screen.height),u(h.metadata,"windowWidth",window.innerWidth),u(h.metadata,"windowHeight",window.innerHeight),u(h.metadata,"mapWidth",i.width/o),u(h.metadata,"mapHeight",i.height/o),u(h.metadata,"webglRenderer",i.renderer),u(h.metadata,"webglVendor",i.vendor),u(h.metadata,"sdkVersion",W),u(h.metadata,"sdkIdentifier","mapbox-gl-js"),h}(r);for(let i of n.metadata);for(let i of n.counters);for(let i of n.attributes);this.postEvent(i,n,()=>{},a)}},iW=iq.postPerformanceEvent.bind(iq),iX=new class extends iF{constructor(){super("map.auth"),this.success={},this.skuToken=""}getSession(i,r,a,n){if(!tQ.API_URL||!tQ.SESSION_PATH)return;let o=iM(tQ.API_URL+tQ.SESSION_PATH);o.params.push(`sku=${r||""}`),o.params.push(`access_token=${n||tQ.ACCESS_TOKEN||""}`);let s={url:iC(o),headers:{"Content-Type":"text/plain"}};this.pendingRequest=!0,(async function(i){return i_(Object.assign(i,{method:"GET"}),void 0)})(s).then(()=>{this.pendingRequest=!1,a(null),this.saveEventData(),this.processRequests()}).catch(i=>{this.pendingRequest=!1,a(i),this.saveEventData(),this.processRequests()})}getSessionAPI(i,r,a,n){this.skuToken=r,this.errorCb=n,tQ.EVENTS_URL&&tQ.SESSION_PATH&&tQ.API_URL&&(a||tQ.ACCESS_TOKEN?this.queueRequest({id:i,timestamp:Date.now()},a):this.errorCb(Error(iI)))}processRequests(){if(this.pendingRequest||0===this.queue.length)return;let{id:i,timestamp:r,customAccessToken:a}=this.queue.shift();i&&this.success[i]||this.getSession(r,this.skuToken,r=>{r?this.errorCb(r):i&&(this.success[i]=!0)},a)}remove(){this.errorCb=null}},iY=iX.getSessionAPI.bind(iX),iK=new Set;function iJ(i,r=0){let a=i.length,n=a-(3&a),o,s=0|r,l=0;for(;l<n;)o=255&i.charCodeAt(l)|(255&i.charCodeAt(l+1))<<8|(255&i.charCodeAt(l+2))<<16|(255&i.charCodeAt(l+3))<<24,l+=4,s^=o=Math.imul(o=(o=Math.imul(o,0xcc9e2d51))<<15|o>>>17,0x1b873593),s=Math.imul(s=s<<13|s>>>19,5)+0xe6546b64|0;o=0;let h=3&a;return h>0&&(h>
1=3&&(o^=(255&i.charCodeAt(l+2))<<16),h>=2&&(o^=(255&i.charCodeAt(l+1))<<8),o^=255&i.charCodeAt(l),s^=o=Math.imul(o=(o=Math.imul(o,0xcc9e2d51))<<15|o>>>17,0x1b873593)),s^=a,s^=s>>>16,s=Math.imul(s,0x85ebca6b),s^=s>>>13,s=Math.imul(s,0xc2b2ae35),(s^=s>>>16)>>>0}class iQ{constructor(i,...r){Object.assign(this,r[0]||{}),this.type=i}}class i0 extends iQ{constructor(i,r={}){super("error",{error:i,...r}),this.error=i}}function i1(i,r,a){a[i]&&a[i].includes(r)||(a[i]=a[i]||[],a[i].push(r))}function i2(i,r,a){if(a[i]){let n=a[i].indexOf(r);-1!==n&&a[i].splice(n,1)}}class i3{constructor(){this._listeners={},this._oneTimeListeners={}}on(i,r){return i1(i,r,this._listeners),this}off(i,r){return i2(i,r,this._listeners),i2(i,r,this._oneTimeListeners),this}once(i,r){return r?(i1(i,r,this._oneTimeListeners),this):new Promise(r=>{this.once(i,r)})}fire(i,r){let a="string"==typeof i?new iQ(i,r):i,n=a.type;if(this.listens(n)){for(let i of(a.target=this,this._listeners[n]?this._listeners[n].slice():[]))i.call(this,a);for(let i of this._oneTimeListeners[n]?this._oneTimeListeners[n].slice():[])i2(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 i0&&console.error(a.error);return this}listens(i){return!!(this._listeners[i]&&this._listeners[i].length>0||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 i5{constructor(i){"string"==typeof i?this.name=i:(this.name=i.name,this.iconsetId=i.iconsetId)}static from(i){return new i5(i)}static toString(i){return i.iconsetId?`${i.name}�${i.iconsetId}`:i.name}static parse(i){let[r,a]=i.split("\x1f");return new i5({name:r,iconsetId:a})}static isEqual(i,r){return i.name===r.name&&i.iconsetId===r.iconsetId}toString(){return i5.toString(this)}serialize(){return{name:this.name,iconsetId:this.iconsetId}}}var i4,i6={},i8=function(){if(i4)return i6;i4=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{i6.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 i6}();function i9(i,r,a){return i*(1-a)+r*a}let i7=new Map;class re{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 re)return i;if("string"!=typeof i)return;let r=i7.get(i);if(r)return r;let a=i8.parseCSSColor(i);if(!a)return;let n=new re(a[0]/255,a[1]/255,a[2]/255,a[3]);return i7.set(i,n),n}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 ri(i,r,a,n,o)}toPremultipliedRenderColor(i){let{r:r,g:a,b:n,a:o}=this;return new rr(i,r*o,a*o,n*o,o)}clone(){return new re(this.r,this.g,this.b,this.a)}}class rt{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=i9(i9(i9(y[x],y[v],g),i9(y[b],y[w],g),_),i9(i9(y[T],y[S],g),i9(y[E],y[I],g),_),m)/255*(this.premultiplied?o:1),this.g=i9(i9(i9(y[x+1],y[v+1],g),i9(y[b+1],y[w+1],g),_),i9(i9(y[T+1],y[S+1],g),i9(y[E+1],y[I+1],g),_),m)/255*(this.premultiplied?o:1),this.b=i9(i9(i9(y[x+2],y[v+2],g),i9(y[b+2],y[w+2],g),_),i9(i9(y[T+2],y[S+2],g),i9(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 ri extends rt{constructor(i,r,a,n,o){super(i,r,a,n,o,!1)}}class rr extends rt{constructor(i,r,a,n,o){super(i,r,a,n,o,!0)}}function ra(i,r,a){return i.map((i,n)=>i9(i,r[n],a))}re.black=new re(0,0,0,1),re.white=new re(1,1,1,1),re.transparent=new re(0,0,0,0),re.red=new re(1,0,0,1),re.blue=new re(0,0,1,1);var rn=Object.freeze({__proto__:null,array:ra,color:function(i,r,a){return new re(i9(i.r,r.r,a),i9(i.g,r.g,a),i9(i.b,r.b,a),i9(i.a,r.a,a))},number:i9});class ro extends Error{constructor(i,r){super(r),this.message=r,this.key=i}}class rs{constructor(i,r=[]){for(let[a,n]of(this.parent=i,this.bindings=Object.create(null),r))this.bindings[a]=n}concat(i){return new rs(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 rl={kind:"null"},rh={kind:"number"},ru={kind:"string"},rc={kind:"boolean"},rd={kind:"color"},rp={kind:"object"},rf={kind:"value"},rm={kind:"collator"},r_={kind:"formatted"},rg={kind:"resolvedImage"};function ry(i,r){return{kind:"array",itemType:i,N:r}}function rx(i){if("array"===i.kind){let r=rx(i.itemType);return"number"==typeof i.N?`array<${r}, ${i.N}>`:"value"===i.itemType.kind?"array":`array<${r}>`}return i.kind}let rv=[rl,rh,ru,rc,rd,r_,rp,ry(rf),rg];function rb(i,r){if("error"===r.kind)return null;if("array"===i.kind){if("array"===r.kind&&(0===r.N&&"value"===r.itemType.kind||!rb(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 rv)if(!rb(i,r))return null}}return`Expected ${rx(i)} but found ${rx(r)} instead.`}function rw(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 rT(i,r){return"array"===i.kind&&"array"===r.kind?i.N===r.N&&rT(i.itemType,r.itemType):i.kind===r.kind}class rS{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 rE{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 rI{constructor(i){this.sections=i}static fromString(i){return new rI([new rE(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 rI?i:rI.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 rA{constructor(i,r={}){this.id=i5.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 rA(r,{params:a,sx:n,sy:o}):null}scaleSelf(i,r=i){return this.sx*=i,this.sy*=r,this}}class rM{constructor(i,r,a,n,o=!1){this.primaryId=i5.from(i),this.primaryOptions=r,a&&(this.secondaryId=i5.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 rA(this.primaryId,this.primaryOptions)}hasSecondary(){return!!this.secondaryId}getSecondary(){return this.secondaryId?new rA(this.secondaryId,this.secondaryOptions):null}static from(i){return"string"!=typeof i?i:rM.build({name:i})}static build(i,r,a,n){return i&&("object"!=typeof i||"name"in i)?new rM(i,a,r,n):null}}function rC(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 rP(i){if(null===i||"string"==typeof i||"boolean"==typeof i||"number"==typeof i||i instanceof re||i instanceof rS||i instanceof rI||i instanceof rM)return!0;
1if(Array.isArray(i)){for(let r of i)if(!rP(r))return!1;return!0}if("object"==typeof i){for(let r in i)if(!rP(i[r]))return!1;return!0}return!1}function rR(i){if(null===i)return rl;if("string"==typeof i)return ru;if("boolean"==typeof i)return rc;if("number"==typeof i)return rh;if(i instanceof re)return rd;if(i instanceof rS)return rm;if(i instanceof rI)return r_;if(i instanceof rM)return rg;if(Array.isArray(i)){let r,a=i.length;for(let a of i){let i=rR(a);if(r){if(r===i)continue;r=rf;break}r=i}return ry(r||rf,a)}return rp}function rD(i){return null===i?"":"string"==typeof i||"number"==typeof i||"boolean"==typeof i?String(i):i instanceof rI||i instanceof rM||i instanceof re?i.toString():JSON.stringify(i)}class rL{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(!rP(i[1]))return r.error("invalid value");let a=i[1],n=rR(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 rL(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 re?["rgba"].concat(this.value.toNonPremultipliedRenderColor(null).toArray()):this.value instanceof rI?this.value.serialize():this.value}}class rz{constructor(i){this.name="ExpressionEvaluationError",this.message=i}toJSON(){return this.message}}let rF={string:ru,number:rh,boolean:rc,object:rp};class rO{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 rF)||"object"===a)return r.error('The item type argument of "array" must be one of string, number, boolean',1);o=rF[a],n++}else o=rf;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=ry(o,s)}else a=rF[o];let s=[];for(;n<i.length;n++){let a=r.parse(i[n],n,rf);if(!a)return null;s.push(a)}return new rO(a,s)}evaluate(i){for(let r=0;r<this.args.length;r++){let a=this.args[r].evaluate(i);if(!rb(this.type,rR(a)))return a;if(r===this.args.length-1)throw new rz(`The expression ${JSON.stringify(this.args[r].serialize())} evaluated to ${rx(rR(a))} but was expected to be of type ${rx(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 rB{constructor(i){this.type=r_,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",rh)))return null;let l=null;if(s["text-font"]&&!(l=r.parseObjectValue(s["text-font"],a,"text-font",ry(ru))))return null;let h=null;if(s["text-color"]&&!(h=r.parseObjectValue(s["text-color"],a,"text-color",rd)))return null;let u=n.at(-1);u.scale=i,u.font=l,u.textColor=h}else{let s=r.parse(i[a],a,rf);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 rB(n)}evaluate(i){return new rI(this.sections.map(r=>{let a=r.content.evaluate(i);return rT(rR(a),rg)?new rE("",a,null,null,null):new rE(rD(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 rk{constructor(i,r,a,n){this._imageWarnHistory={},this.type=rg,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++,ru);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,rd,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 rk(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=rM.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=>i5.isEqual(i,r)),n.available){let r=n.getSecondary()?n.getSecondary().id:null;r&&(n.available=i.availableImages.some(i=>i5.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 rN(i){return rU(i)?"string":rj(i)?"number":rG(i)?"boolean":Array.isArray(i)?"array":null===i?"null":rV(i)?"object":typeof i}function rV(i){return null!=i&&!Array.isArray(i)&&"function"!=typeof i&&!(i instanceof String||i instanceof Number||i instanceof Boolean)&&"object"==typeof i}function rU(i){return"string"==typeof i||i instanceof String}function rj(i){return"number"==typeof i||i instanceof Number}function rG(i){return"boolean"==typeof i||i instanceof Boolean}let rZ={"to-boolean":rc,"to-color":rd,"to-number":rh,"to-string":ru};class r${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=rl;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=ry(r.expectedType.itemType,a)}else{if(!(a>0&&rP(i[1][0])))return null;o=ry(rR(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=rN(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=rZ[a];for(let a=1;a<i.length;a++){let o=r.parse(i[a],a,rf);if(!o)return null;n.push(o)}}return new r$(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 re)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.`:rC(r[0],r[1],r[2],r[3])))return new re(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new rz(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 rz(`Could not convert ${JSON.stringify(r)} to number.`)}return"formatted"===this.type.kind?rI.fromString(rD(this.args[0].evaluate(i))):"resolvedImage"===this.type.kind?rM.build(rD(this.args[0].evaluate(i))):"array"===this.type.kind?this.args.map(r=>r.evaluate(i)):rD(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 rB([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if("resolvedImage"===this.type.kind)return new rk(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 rq{constructor(i,r,a){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this.availableImages=null,this.canonical=null,this.featureTileCoord=null,this.featureDistanceData=null,this.scope=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){return re.parse(i)}getConfig(i){return this.options?this.options.get(i):null}}class rW{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=rW.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=rW.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=r._forkForSignature():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)}
1if(0===h.errors.length)return new rW(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(rX).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(rx(o.type))}r.error(`Expected arguments of type ${a}, but found (${n.join(", ")}) instead.`)}return null}static register(i,r){for(let a in rW.definitions=r,r)i[a]=rW}}function rX(i){return Array.isArray(i)?`(${i.map(rx).join(", ")})`:`(${rx(i.type)}...)`}class rY{constructor(i,r,a){this.type=rm,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,rc):r.parseObjectValue(a["case-sensitive"],1,"case-sensitive",rc);if(!n)return null;let o=void 0===a["diacritic-sensitive"]?r.parse(!1,1,rc):r.parseObjectValue(a["diacritic-sensitive"],1,"diacritic-sensitive",rc);if(!o)return null;let s=null;return!a.locale||(s=r.parseObjectValue(a.locale,1,"locale",ru))?new rY(n,o,s):null}evaluate(i){return new rS(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 rK(i){return(180+i)/360}function rJ(i){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i*Math.PI/360)))/360}function rQ(i){return 360*i-180}function r0(i){return 360/Math.PI*Math.atan(Math.exp((180-360*i)*Math.PI/180))-90}function r1(i,r){for(let a=0;a<i.length;++a)if(!tu(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(td(i,r,n[s],n[a]))return!0;return!1}(i[a],i[a+1],r))return!1;return!0}function r2(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=rK(i[0]),n=rJ(i[1]),o=Math.pow(2,r.z);return[Math.round(a*o*8192),Math.round(n*o*8192)]}(i[o][n],a);tl(r,l),s.push(l)}n.push(s)}return n}function r3(i,r,a){let n=[];for(let o=0;o<i.length;o++){let s=r2(i[o],r,a);n.push(s)}return n}function r5(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}tl(r,i)}function r4(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]];r5(n,r,a,o),l.push(n)}return l}function r6(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]];tl(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)r5(n,r,a,o);return l}class r8{constructor(i,r){this.type=rc,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(rP(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 r8(r,r.features[i].geometry)}else if("Feature"===r.type){let i=r.geometry.type;if("Polygon"===i||"MultiPolygon"===i)return new r8(r,r.geometry)}else if("Polygon"===r.type||"MultiPolygon"===r.type)return new r8(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=r2(r.coordinates,n,o),l=r4(i.geometry(),a,n,o);if(!th(a,n))return!1;for(let i of l)if(!tu(i,s))return!1}if("MultiPolygon"===r.type){let s=r3(r.coordinates,n,o),l=r4(i.geometry(),a,n,o);if(!th(a,n))return!1;for(let i of l)if(!function(i,r){for(let a=0;a<r.length;a++)if(tu(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=r2(r.coordinates,n,o),l=r6(i.geometry(),a,n,o);if(!th(a,n))return!1;for(let i of l)if(!r1(i,s))return!1}if("MultiPolygon"===r.type){let s=r3(r.coordinates,n,o),l=r6(i.geometry(),a,n,o);if(!th(a,n))return!1;for(let i of l)if(!function(i,r){for(let a=0;a<r.length;a++)if(r1(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]}}class r9{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}}
1function r7(i,r,a){return[i,r,a].filter(Boolean).join("\x1f")}function ae(i,r){switch(i){case"string":return rD(r);case"number":return+r;case"boolean":return!!r;case"color":return re.parse(r);case"formatted":return rI.fromString(rD(r));case"resolvedImage":return rM.build(rD(r))}return r}function at(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 ai{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(a??=rf,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 rL))return r.error("Key name of 'config' expression must be a string literal.");let o,s=!0,l=rD(n.value);if(i.length>=3){let a=r.parse(i[2],2);if(!(a instanceof rL))return r.error("Scope of 'config' expression must be a string literal.");o=rD(a.value)}if(r.options){let i=r7(l,o,r._scope),a=r.options.get(i);a&&(s=ar(a.value||a.default))}return new ai(a,l,o,s)}evaluate(i){let r=r7(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=ae(n,d)),void 0===d||void 0===l&&void 0===h&&void 0===u||("number"==typeof d?d=at(d,l,h,u):Array.isArray(d)&&(d=d.map(i=>"number"==typeof i?at(i,l,h,u):i))),void 0!==o&&void 0!==d&&s&&!s.includes(d)&&(d=c,n&&(d=ae(n,d))),(n&&n!==this.type||void 0!==d&&!rT(rR(d),this.type))&&(d=ae(this.type.kind,d)),d}eachChild(){}outputDefined(){return!1}serialize(){let i=["config",this.key];return this.scope&&i.concat(this.scope),i}}function ar(i){if(i instanceof rW&&("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 r8||i instanceof aF)return!1;if(i instanceof ai)return i.featureConstant;let r=!0;return i.eachChild(i=>{r&&!ar(i)&&(r=!1)}),r}function aa(i){if(i instanceof rW&&"feature-state"===i.name)return!1;let r=!0;return i.eachChild(i=>{r&&!aa(i)&&(r=!1)}),r}function an(i,r){if(i instanceof rW&&r.has(i.name))return!1;let a=!0;return i.eachChild(i=>{a&&!an(i,r)&&(a=!1)}),a}function ao(i,r){return an(i,new Set(r))}let as=1/298.257223563*(2-1/298.257223563),al=Math.PI/180;function ah(i){let r=6378.137*al*1e3,a=Math.cos(i*al),n=1/(1-as*(1-a*a)),o=Math.sqrt(n);return[r*o*a,r*o*n*(1-as)]}function au(i){for(;i<-180;)i+=360;for(;i>180;)i-=360;return i}function ac(i,r,a,n){let o=au(i[0]-r[0])*a,s=(i[1]-r[1])*n;return Math.sqrt(o*o+s*s)}function ad(i,r,a,n,o){let s=r[0],l=r[1],h=au(a[0]-s)*n,u=(a[1]-l)*o;if(0!==h||0!==u){let r=(au(i[0]-s)*n*h+(i[1]-l)*o*u)/(h*h+u*u);r>1?(s=a[0],l=a[1]):r>0&&(s+=h/n*r,l+=u/o*r)}return Math.sqrt((h=au(i[0]-s)*n)*h+(u=(i[1]-l)*o)*u)}function ap(i,r){return r.dist-i.dist}function af(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 am(i){return i[1]-i[0]+1}function a_(i,r){let a=i[1]>=i[0]&&i[1]<r;return a||console.warn("Distance Expression: Index is out of range"),a}function ag(i,r){if(i[0]>i[1])return[null,null];let a=am(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 ay(i,r){let a=[1/0,1/0,-1/0,-1/0];if(!a_(r,i.length))return a;for(let n=r[0];n<=r[1];++n)tl(a,i[n]);return a}function ax(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)tl(r,i[a][n]);return r}
1function av(i,r,a,n){if(af(i)||af(r))return NaN;let o=0,s=0;return i[2]<r[0]&&(o=r[0]-i[2]),i[0]>r[2]&&(o=i[0]-r[2]),i[1]>r[3]&&(s=i[1]-r[3]),i[3]<r[1]&&(s=r[1]-i[3]),ac([0,0],[o,s],a,n)}function ab(i,r,a=8192){let n=Math.pow(2,r.z),o=(i.y/a+r.y)/n;return[rQ((i.x/a+r.x)/n),r0(o)]}function aw(i,r,a,n){let o=function(i,r,a,n){let o=1/0,s=i[0][0],l=i[0][1];for(let h=0;h<i.length-1;h++){let u=i[h][0],c=i[h][1],d=au(i[h+1][0]-u)*a,p=(i[h+1][1]-c)*n,f=0;0===d&&0===p||((f=(au(r[0]-u)*a*d+(r[1]-c)*n*p)/(d*d+p*p))>1?(u=i[h+1][0],c=i[h+1][1]):f>0&&(u+=d/a*f,c+=p/n*f));let m=(d=au(r[0]-u)*a)*d+(p=(r[1]-c)*n)*p;m<o&&(o=m,s=u,l=c)}return[s,l]}(r,i,a,n);return ac(i,o,a,n)}function aT(i,r,a,n,o,s){let l=a.slice(n[0],n[1]+1),h=1/0;for(let a=r[0];a<=r[1];++a)if(0===(h=Math.min(h,aw(i[a],l,o,s))))return 0;return h}function aS(i,r,a,n,o,s){return Math.min(Math.min(ad(i,a,n,o,s),ad(r,a,n,o,s)),Math.min(ad(a,i,r,o,s),ad(n,i,r,o,s)))}function aE(i,r){for(let a of i)for(let i=0;i<=a.length-1;++i)if(tu(a[i],r,!0))return!0;return!1}function aI(i,r,a,n,o,s,l,h){if(null===l||null===h)return;let u=av(ay(o,l),ay(s,h),a,n);u<r&&i.push({dist:u,range1:l,range2:h})}function aA(i,r,a,n,o,s,l=1/0){let h=Math.min(l,ac(i[0],a[0],o,s));if(0===h)return h;let u=new r9([{dist:0,range1:[0,i.length-1],range2:[0,a.length-1]}],ap),c=r?50:100,d=n?50:100;for(;u.length;){let l=u.pop();if(l.dist>=h)continue;let p=l.range1,f=l.range2;if(am(p)<=c&&am(f)<=d){if(!a_(p,i.length)||!a_(f,a.length))return NaN;if(r&&n?h=Math.min(h,function(i,r,a,n,o,s){if(!a_(r,i.length)||!a_(n,a.length))return NaN;let l=1/0;for(let h=r[0];h<r[1];++h)for(let r=n[0];r<n[1];++r){if(td(i[h],i[h+1],a[r],a[r+1]))return 0;l=Math.min(l,aS(i[h],i[h+1],a[r],a[r+1],o,s))}return l}(i,p,a,f,o,s)):r||n?r&&!n?h=Math.min(h,aT(a,f,i,p,o,s)):!r&&n&&(h=Math.min(h,aT(i,p,a,f,o,s))):h=Math.min(h,function(i,r,a,n,o,s){if(!a_(r,i.length)||!a_(n,a.length))return NaN;let l=1/0;for(let h=r[0];h<=r[1];++h)for(let r=n[0];r<=n[1];++r)if(0===(l=Math.min(l,ac(i[h],a[r],o,s))))return l;return l}(i,p,a,f,o,s)),0===h)break}else{let l=ag(p,r),c=ag(f,n);aI(u,h,o,s,i,a,l[0],c[0]),aI(u,h,o,s,i,a,l[0],c[1]),aI(u,h,o,s,i,a,l[1],c[0]),aI(u,h,o,s,i,a,l[1],c[1])}}return h}function aM(i,r,a,n,o,s=1/0){let l=s,h=ay(i,[0,i.length-1]);for(let s of a)if(!(l!==1/0&&av(h,ay(s,[0,s.length-1]),n,o)>=l)&&0===(l=Math.min(l,aA(i,r,s,!0,n,o,l))))break;return l}function aC(i,r,a,n,o,s=1/0){let l=s,h=ay(i,[0,i.length-1]);for(let s of a){if(l!==1/0&&av(h,ax(s),n,o)>=l)continue;let a=function(i,r,a,n,o,s=1/0){let l=Math.min(ac(i[0],a[0][0],n,o),s);if(0===l)return l;let h=new r9([{dist:0,range1:[0,i.length-1],range2:[0,0]}],ap),u=r?50:100,c=ax(a);for(;h.length;){let s=h.pop();if(s.dist>=l)continue;let d=s.range1;if(am(d)<=u){if(!a_(d,i.length))return NaN;if(r){if(0===(l=Math.min(l,function(i,r,a,n,o){if(!a_(r,i.length))return NaN;for(let n=r[0];n<=r[1];++n)if(tu(i[n],a,!0))return 0;let s=1/0;for(let l=r[0];l<r[1];++l)for(let r of a)for(let a=0,h=r.length,u=h-1;a<h;u=a++){if(td(i[l],i[l+1],r[u],r[a]))return 0;s=Math.min(s,aS(i[l],i[l+1],r[u],r[a],n,o))}return s}(i,d,a,n,o))))break}else for(let r=d[0];r<=d[1];++r)if(0===(l=Math.min(l,function(i,r,a,n){if(tu(i,r,!0))return 0;let o=1/0;for(let s of r){let r=s.length;if(r<2)return console.warn("Distance Expression: Invalid polygon!"),NaN;if(s[0]!==s[r-1]&&0===(o=Math.min(o,ad(i,s[r-1],s[0],a,n)))||0===(o=Math.min(o,aw(i,s,a,n))))break}return o}(i[r],a,n,o))))return l}else{let a=ag(d,r);if(null!==a[0]){let r=av(ay(i,a[0]),c,n,o);r<l&&h.push({dist:r,range1:a[0],range2:[0,0]})}if(null!==a[1]){let r=av(ay(i,a[1]),c,n,o);r<l&&h.push({dist:r,range1:a[1],range2:[0,0]})}}}return l}(i,r,s,n,o,l);if(isNaN(a))return a;if(0===(l=Math.min(l,a)))break}return l}function aP(i,r,a){let n=[];for(let a of i)for(let i of a)n.push(ab(i,r));let[o,s]=ah(n[0][1]);return"Point"===a.type||"MultiPoint"===a.type||"LineString"===a.type?aA(n,!1,"Point"===a.type?[a.coordinates]:a.coordinates,"LineString"===a.type,o,s):"MultiLineString"===a.type?aM(n,!1,a.coordinates,o,s):"Polygon"===a.type||"MultiPolygon"===a.type?aC(n,!1,"Polygon"===a.type?[a.coordinates]:a.coordinates,o,s):null}function aR(i,r,a){let n=[];for(let a of i){let i=[];for(let n of a)i.push(ab(n,r));n.push(i)}let[o,s]=ah(n[0][0][1]);if("Point"===a.type||"MultiPoint"===a.type||"LineString"===a.type)return aM("Point"===a.type?[a.coordinates]:a.coordinates,"LineString"===a.type,n,o,s);if("MultiLineString"===a.type){let i=1/0;for(let r=0;r<a.coordinates.length;r++){let l=aM(a.coordinates[r],!0,n,o,s,i);if(isNaN(l))return l;if(0===(i=Math.min(i,l)))break}return i}if("Polygon"===a.type||"MultiPolygon"===a.type){let i=1/0;for(let r=0;r<n.length;r++){let l=aC(n[r],!0,"Polygon"===a.type?[a.coordinates]:a.coordinates,o,s,i);if(isNaN(l))return l;if(0===(i=Math.min(i,l)))break}return i}return null}function aD(i,r,a){let n=[];for(let a of ts(i,0)){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(ab(i[n],r));return a}(a[n],r));n.push(i)}let[o,s]=ah(n[0][0][0][1]);if("Point"===a.type||"MultiPoint"===a.type||"LineString"===a.type)return aC("Point"===a.type?[a.coordinates]:a.coordinates,"LineString"===a.type,n,o,s);if("MultiLineString"===a.type){let i=1/0;for(let r=0;r<a.coordinates.length;r++){let l=aC(a.coordinates[r],!0,n,o,s,i);if(isNaN(l))return l;if(0===(i=Math.min(i,l)))break}return i}return"Polygon"===a.type||"MultiPolygon"===a.type?function(i,r,a,n){let o=1/0;for(let s of i)for(let i of r){let r=function(i,r,a,n,o=1/0){let s=ax(i),l=ax(r);if(o!==1/0&&av(s,l,a,n)>=o)return o;if(th(s,l)){if(aE(i,r))return 0}else if(aE(r,i))return 0;let h=o;for(let o of i)for(let i=0,s=o.length,l=s-1;i<s;l=i++)for(let s of r)for(let r=0,u=s.length,c=u-1;r<u;c=r++){if(td(o[l],o[i],s[c],s[r]))return 0;h=Math.min(h,aS(o[l],o[i],s[c],s[r],a,n))}return h}(s,i,a,n,o);if(isNaN(r))return r;if(0===(o=Math.min(o,r)))return o}return o}("Polygon"===a.type?[a.coordinates]:a.coordinates,n,o,s):null}function aL(i){return"Point"===i||"MultiPoint"===i||"LineString"===i||"MultiLineString"===i||"Polygon"===i||"MultiPolygon"===i}function az(i){if(!rP(i)||"object"!=typeof i||null===i||Array.isArray(i))return null;
1if("FeatureCollection"===i.type){if(0===i.features.length)return null;let r=[];for(let a of i.features){if(!aL(a.geometry.type))return null;r.push(a.geometry)}return r}return"Feature"===i.type?aL(i.geometry.type)?[i.geometry]:null:aL(i.type)?[i]:null}class aF{constructor(i){this.type=rh,this.geojson=i}static parse(i,r){if(2!==i.length)return r.error(`'distance' expression requires either one argument, but found ' ${i.length-1} instead.`);let a=i[1],n=rP(a)&&!Array.isArray(a),o=r.parse(n?["literal",a]:a,1,rf);if(!o)return null;for(let[i,a]of[[["measure-light"],"brightness"],[["pitch"],"pitch"],[["distance-from-center"],"distance-from-center"]])if(!ao(o,i))return r.error(`'distance' expression may not depend on ${a}.`);return aa(o)?o instanceof rL&&!az(o.value)?r.error("'distance' expression needs to be an array with format ['Distance', GeoJSONObj]."):new aF(o):r.error("'distance' expression may not depend on feature-state.")}evaluate(i){let r=az(this.geojson.evaluate(i));if(!r)return console.warn("Distance Expression: could not resolve a valid Point/LineString/Polygon GeoJSON geometry."),null;let a=i.geometry(),n=i.canonicalID();if(null==a||null==n)return console.warn("Distance Expression: requires valid feature and canonical information."),null;let o=i.geometryType(),s="Point"===o?aP:"LineString"===o?aR:"Polygon"===o?aD:null;if(!s)return console.warn("Distance Expression: currently only evaluates valid Point/LineString/Polygon geometries."),null;let l=1/0;for(let i of r){let r=s(a,n,i);if(null==r||isNaN(r))return r;if(0===(l=Math.min(l,r)))break}return l}eachChild(i){i(this.geojson)}outputDefined(){return!0}serialize(){return["distance",this.geojson.serialize()]}}class aO{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 aO(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 aB{constructor(i,r=[],a,n=new rs,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(){let i="";for(let r=0;r<this.path.length;r++){let a=this.path[r];i+="string"==typeof a?`['${a}']`:`[${a}]`}return i}parse(i,r,a,n,o={}){if(r||a){let s=this.expectedType,l=this.scope;n&&(this.scope=this.scope.concat(n)),this.expectedType=a||null;let h="number"==typeof r;h&&this.path.push(r);let u=this._parse(i,o);return h&&this.path.pop(),this.expectedType=s,this.scope=l,u}return this._parse(i,o)}parseObjectValue(i,r,a,n,o,s={}){let l=this.expectedType,h=this.scope;o&&(this.scope=this.scope.concat(o)),this.expectedType=n||null,this.path.push(r),this.path.push(a);let u=this._parse(i,s);return this.path.pop(),this.path.pop(),this.expectedType=l,this.scope=h,u}_parse(i,r){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 a="string"==typeof i[0]&&Object.hasOwn(this.registry,i[0])?this.registry[i[0]]:void 0;if(a){let n=a.parse(i,this);if(!n)return null;if(this.expectedType){let i=this.expectedType,a=n.type;if("string"!==i.kind&&"number"!==i.kind&&"boolean"!==i.kind&&"object"!==i.kind&&"array"!==i.kind||"value"!==a.kind)if("color"!==i.kind&&"formatted"!==i.kind&&"resolvedImage"!==i.kind||"value"!==a.kind&&"string"!==a.kind){if(this.checkSubtype(i,a))return null}else n=aN(n,i,r.typeAnnotation||"coerce");else n=aN(n,i,r.typeAnnotation||"assert")}if(!(n instanceof rL)&&"resolvedImage"!==n.type.kind&&function i(r){if(r instanceof aO)return i(r.boundExpression);if(r instanceof rW&&"error"===r.name||r instanceof rY||r instanceof r8||r instanceof aF||r instanceof ai)return!1;let a=r instanceof r$||r instanceof rO,n=!0;return r.eachChild(r=>{n=a?n&&i(r):n&&r instanceof rL}),!!n&&ar(r)&&an(r,ak)}(n)){let i=new rq(this._scope,this.options,this.iconImageUseTheme);try{n=new rL(n.type,n.evaluate(i))}catch(i){return this.error(i.message),null}}return n}return r$.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=n?this.scope.concat(n):this.scope,s=this.path.slice();return"number"==typeof i&&s.push(i),"string"==typeof r&&s.push(r),new aB(this.registry,s,a||null,o,this.errors,this._scope,this.options,this.iconImageUseTheme)}_forkForSignature(){return new aB(this.registry,this.path.slice(),null,this.scope,[],this._scope,this.options,this.iconImageUseTheme)}error(i,...r){let a=`${this.key}${r.map(i=>`[${i}]`).join("")}`;this.errors.push(new ro(a,i))}checkSubtype(i,r,a){let n=rb(i,r);return n&&this.error(n,..."number"==typeof a?[a]:[]),n}}let ak=new Set(["zoom","heatmap-density","worldview","line-progress","raster-value","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center","measure-light","raster-particle-speed","is-active-floor"]);function aN(i,r,a){return"assert"===a?new rO(r,[i]):"coerce"===a?new r$(r,[i]):i}function aV(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 rz("Input is not a number.");l=h-1}return 0}
1class aU{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,rh);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 aU(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[aV(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 aj=4/29,aG=6/29,aZ=6/29*3*(6/29),a$=6/29*(6/29)*(6/29),aH=Math.PI/180,aq=180/Math.PI;function aW(i){return i>a$?Math.pow(i,1/3):i/aZ+aj}function aX(i){return i>aG?i*i*i:aZ*(i-aj)}function aY(i){return 255*(i<=.0031308?12.92*i:1.055*Math.pow(i,1/2.4)-.055)}function aK(i){return(i/=255)<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4)}function aJ(i){let r=aK(i.r),a=aK(i.g),n=aK(i.b),o=aW((.4124564*r+.3575761*a+.1804375*n)/.95047),s=aW((.2126729*r+.7151522*a+.072175*n)/1);return{l:116*s-16,a:500*(o-s),b:200*(s-aW((.0193339*r+.119192*a+.9503041*n)/1.08883)),alpha:i.a}}function aQ(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=+aX(r),new re(aY(3.2404542*(a=.95047*aX(a))-1.5371385*r-.4985314*(n=1.08883*aX(n))),aY(-.969266*a+1.8760108*r+.041556*n),aY(.0556434*a-.2040259*r+1.0572252*n),i.alpha)}let a0={forward:aJ,reverse:aQ,interpolate:function(i,r,a){return{l:i9(i.l,r.l,a),a:i9(i.a,r.a,a),b:i9(i.b,r.b,a),alpha:i9(i.alpha,r.alpha,a)}}},a1={forward:function(i){let{l:r,a:a,b:n}=aJ(i),o=Math.atan2(n,a)*aq;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*aH,a=i.c;return aQ({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:i9(i.c,r.c,a),l:i9(i.l,r.l,a),alpha:i9(i.alpha,r.alpha,a)}}};var a2=Object.freeze({__proto__:null,hcl:a1,lab:a0});class a3{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=a5(r,i.base,a,n);else if("linear"===i.name)o=a5(r,1,a,n);else if("cubic-bezier"===i.name){let s=i.controlPoints;o=ti(s[0],s[1],s[2],s[3])(a5(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,rh)))return null;let l=[],h=null;"interpolate-hcl"===a||"interpolate-lab"===a?h=rd: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 a3(h,a,n,o,l):r.error(`Type ${rx(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=aV(r,n),l=a3.interpolationFactor(this.interpolation,n,r[s],r[s+1]),h=a[s].evaluate(i),u=a[s+1].evaluate(i);return"interpolate"===this.operator?rn[this.type.kind.toLowerCase()](h,u,l):"interpolate-hcl"===this.operator?a1.reverse(a1.interpolate(a1.forward(h),a1.forward(u),l)):a0.reverse(a0.interpolate(a0.forward(h),a0.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 a5(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 a4{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 a4(n&&o.some(i=>rb(n,i.type))?rf:a,o)}evaluate(i){let r,a=null,n=0;for(let o of this.args){if(n++,(a=o.evaluate(i))&&a instanceof rM&&!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 a6=/[^a-zA-Z0-9_]/;class a8{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(a6.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 a8(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 a9{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,rh),n=r.parse(i[2],2,ry(r.expectedType||rf));return a&&n?new a9(n.type.itemType,a,n):null}evaluate(i){let r=this.index.evaluate(i),a=this.input.evaluate(i);if(r<0)throw new rz("Array index out of bounds: negative index");if(r>=a.length)throw new rz("Array index out of bounds: index exceeds array size");if(r!==Math.floor(r))throw new rz("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 a7{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,rh),n=r.parse(i[2],2,ry(r.expectedType||rf));
1return a&&n?new a7(n.type.itemType,a,n):null}evaluate(i){let r=this.index.evaluate(i),a=this.input.evaluate(i);if(r<0)throw new rz(`Array index out of bounds: ${r} < 0.`);if(r>a.length-1)throw new rz(`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 rz(`Cannot interpolate between non-number values at index ${r}.`);return i9(s,l,r-n)}eachChild(i){i(this.index),i(this.input)}outputDefined(){return!1}serialize(){return["at-interpolated",this.index.serialize(),this.input.serialize()]}}class ne{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];if(Array.isArray(h)||(h=[h]),0===h.length)return r.error("Expected at least one branch label.",l);for(let i of h){if("number"!=typeof i&&"string"!=typeof i)return r.error("Branch labels must be numbers or strings.",l);if("number"==typeof i&&Math.abs(i)>Number.MAX_SAFE_INTEGER)return r.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`,l);if("number"==typeof i&&Math.floor(i)!==i)return r.error("Numeric branch labels must be integer values.",l);if(a){if(r.checkSubtype(a,rR(i),l))return null}else a=rR(i);if(void 0!==o[String(i)])return r.error("Branch labels must be unique.",l);o[String(i)]=s.length}let c=r.parse(u,l,n);if(!c)return null;n=n||c.type,s.push(c)}let l=r.parse(i[1],1,rf);if(!l)return null;let h=r.parse(i.at(-1),i.length-1,n);return h?"value"!==l.type.kind&&r.checkSubtype(a,l.type,1)?null:new ne(a,n,l,o,s,h):null}evaluate(i){let r=this.input.evaluate(i);return(rT(rR(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 nt{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,rc);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 nt(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 ni{constructor(i,r,a,n){this.type=i,this.input=r,this.beginIndex=a,this.endIndex=n}static parse(i,r){var a;if(i.length<=2||i.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${i.length-1} instead.`),null;let n=r.parse(i[1],1,rf),o=r.parse(i[2],2,rh);if(!n||!o)return null;if(a=n.type,![ry(rf),ru,rf].some(i=>i.kind===a.kind))return r.error(`Expected first argument to be of type array or string, but found ${rx(n.type)} instead`),null;if(4===i.length){let a=r.parse(i[3],3,rh);return a?new ni(n.type,n,o,a):null}return new ni(n.type,n,o)}evaluate(i){let r=this.input.evaluate(i),a=this.beginIndex.evaluate(i);if(!rw(r,["string","array"]))throw new rz(`Expected first argument to be of type array or string, but found ${rx(rR(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()]}}function nr(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 na(i,r,a,n){return 0===n.compare(r,a)}function nn(i,r,a){let n="=="!==i&&"!="!==i;return class o{constructor(i,r,a){this.type=rc,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,rf);if(!s)return null;if(!nr(a,s.type))return r.error(`"${a}" comparisons are not supported for type '${rx(s.type)}'.`,1);let l=r.parse(i[2],2,rf);if(!l)return null;if(!nr(a,l.type))return r.error(`"${a}" comparisons are not supported for type '${rx(l.type)}'.`,2);if(s.type.kind!==l.type.kind&&"value"!==s.type.kind&&"value"!==l.type.kind)return r.error(`Cannot compare types '${rx(s.type)}' and '${rx(l.type)}'.`);n&&("value"===s.type.kind&&"value"!==l.type.kind?s=new rO(l.type,[s]):"value"!==s.type.kind&&"value"===l.type.kind&&(l=new rO(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,rm)))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=rR(s),a=rR(l);if(r.kind!==a.kind||"string"!==r.kind&&"number"!==r.kind)throw new rz(`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=rR(s),a=rR(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 no=nn("==",function(i,r,a){return r===a},na),ns=nn("!=",function(i,r,a){return r!==a},function(i,r,a,n){return!na(0,r,a,n)}),nl=nn("<",function(i,r,a){return r<a},function(i,r,a,n){return 0>n.compare(r,a)}),nh=nn(">",function(i,r,a){return r>a},function(i,r,a,n){return n.compare(r,a)>0}),nu=nn("<=",function(i,r,a){return r<=a},function(i,r,a,n){return 0>=n.compare(r,a)}),nc=nn(">=",function(i,r,a){return r>=a},function(i,r,a,n){return n.compare(r,a)>=0});
1class nd{constructor(i,r,a,n,o,s){this.type=ru,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,rh);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",ru)))return null;let s=null;if(n.currency&&!(s=r.parseObjectValue(n.currency,2,"currency",ru)))return null;let l=null;if(n.unit&&!(l=r.parseObjectValue(n.unit,2,"unit",ru)))return null;let h=null;if(void 0!==n["min-fraction-digits"]&&!(h=r.parseObjectValue(n["min-fraction-digits"],2,"min-fraction-digits",rh)))return null;let u=null;return void 0===n["max-fraction-digits"]||(u=r.parseObjectValue(n["max-fraction-digits"],2,"max-fraction-digits",rh))?new nd(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 np{constructor(i){this.type=rh,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 ${rx(a.type)} instead.`),null):new np(a):null}evaluate(i){let r=this.input.evaluate(i);if("string"==typeof r||Array.isArray(r))return r.length;throw new rz(`Expected value to be of type string or array, but found ${rx(rR(r))} instead.`)}eachChild(i){i(this.input)}outputDefined(){return!1}serialize(){let i=["length"];return this.eachChild(r=>{i.push(r.serialize())}),i}}function nf(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 nm={"==":no,"!=":ns,">":nh,"<":nl,">=":nc,"<=":nu,array:rO,at:a9,"at-interpolated":a7,boolean:rO,case:nt,coalesce:a4,collator:rY,format:rB,image:rk,interpolate:a3,"interpolate-hcl":a3,"interpolate-lab":a3,length:np,let:a8,literal:rL,match:ne,number:rO,"number-format":nd,object:rO,slice:ni,step:aU,string:rO,"to-boolean":r$,"to-color":r$,"to-number":r$,"to-string":r$,var:aO,within:r8,distance:aF,config:ai};function n_(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=rC(r,a,n,s);if(l)throw new rz(l);return new re(r/255,a/255,n/255,s)}function ng(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 rz(c);let d=`hsla(${r}, ${a}%, ${n}%, ${u})`,p=re.parse(d);if(!p)throw new rz(`Failed to parse HSLA color: ${d}`);return p}function ny(i,r){let a=r[i];return void 0===a?null:a}function nx(i){return{type:i}}function nv(i,r){if(!rw(i,["boolean","string","number","null"]))throw new rz(`Expected first argument to be of type boolean, string, number or null, but found ${rx(rR(i))} instead.`);if(!rw(r,["string","array"]))throw new rz(`Expected second argument to be of type array or string, but found ${rx(rR(r))} instead.`)}function nb(i){if(i instanceof ai)return new Set([i.key]);let r=new Set;return i.eachChild(i=>{r=new Set([...r,...nb(i)])}),r}function nw(i){if(i instanceof rW&&"is-active-floor"===i.name)return!0;let r=!1;return i.eachChild(i=>{!r&&nw(i)&&(r=!0)}),r}function nT(i){return{result:"success",value:i}}function nS(i){return{result:"error",value:i}}function nE(i,r){return!!i&&!!i.parameters&&i.parameters.includes(r)}function nI(i){return"data-driven"===i["property-type"]}function nA(i){return nE(i.expression,"measure-light")}function nM(i){return nE(i.expression,"zoom")}function nC(i){return!!i.expression&&i.expression.interpolated}function nP(i){return"object"==typeof i&&null!==i&&!Array.isArray(i)}function nR(i){return i}function nD(i,r,a){return void 0!==i?i:void 0!==r?r:void 0!==a?a:void 0}function nL(i,r,a,n,o){return nD(typeof a===o?n[a]:void 0,i.default,r.default)}function nz(i,r,a){if(!rj(a))return nD(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=aV(i.stops.map(i=>i[0]),a);return i.stops[o][1]}function nF(i,r,a){let n=void 0!==i.base?i.base:1;if(!rj(a))return nD(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=aV(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=rn[r.type]||nR;if(i.colorSpace&&"rgb"!==i.colorSpace){let r=a2[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 nO(i,r,a){return"color"===r.type?a=re.parse(a):"formatted"===r.type?a=rI.fromString(a.toString()):"resolvedImage"===r.type?a=rM.build(a.toString()):rN(a)===r.type||"enum"===r.type&&r.values[a]||(a=void 0),nD(a,i.default,r.default)}rW.register(nm,{error:[{kind:"error"},[ru],(i,[r])=>{throw new rz(r.evaluate(i))}],typeof:[ru,[rf],(i,[r])=>rx(rR(r.evaluate(i)))],"to-rgba":[ry(rh,4),[rd],(i,[r])=>r.evaluate(i).toNonPremultipliedRenderColor(null).toArray()],"to-hsla":[ry(rh,4),[rd],(i,[r])=>r.evaluate(i).toNonPremultipliedRenderColor(null).toHslaArray()],rgb:[rd,[rh,rh,rh],n_],rgba:[rd,[rh,rh,rh,rh],n_],hsl:[rd,[rh,rh,rh],ng],hsla:[rd,[rh,rh,rh,rh],ng],has:{type:rc,overloads:[[[ru],(i,[r])=>r.evaluate(i)in i.properties()],[[ru,rp],(i,[r,a])=>r.evaluate(i)in a.evaluate(i)]]},get:{type:rf,overloads:[[[ru],(i,[r])=>ny(r.evaluate(i),i.properties())],[[ru,rp],(i,[r,a])=>ny(r.evaluate(i),a.evaluate(i))]]},"feature-state":[rf,[ru],(i,[r])=>ny(r.evaluate(i),i.featureState||{})],properties:[rp,[],i=>i.properties()],"geometry-type":[ru,[],i=>i.geometryType()],worldview:[ru,[],i=>i.globals.worldview||""],"is-active-floor":[rc,nx(ru),(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:[rf,[],i=>i.id()],zoom:[rh,[],i=>i.globals.zoom],pitch:[rh,[],i=>i.globals.pitch||0],"distance-from-center":[rh,[],i=>i.distanceFromCenter()],"measure-light":[rh,[ru],(i,[r])=>i.measureLight(r.evaluate(i))],"heatmap-density":[rh,[],i=>i.globals.heatmapDensity||0],"line-progress":[rh,[],i=>i.globals.lineProgress||0],"raster-value":[rh,[],i=>i.globals.rasterValue||0],"raster-particle-speed":[rh,[],i=>i.globals.rasterParticleSpeed||0],"sky-radial-progress":[rh,[],i=>i.globals.skyRadialProgress||0],accumulated:[rf,[],i=>void 0===i.globals.accumulated?null:i.globals.accumulated],"+":[rh,nx(rh),(i,r)=>{let a=0;for(let n of r)a+=n.evaluate(i);return a}],"*":[rh,nx(rh),(i,r)=>{let a=1;for(let n of r)a*=n.evaluate(i);return a}],"-":{type:rh,overloads:[[[rh,rh],(i,[r,a])=>r.evaluate(i)-a.evaluate(i)],[[rh],(i,[r])=>-r.evaluate(i)]]},"/":[rh,[rh,rh],(i,[r,a])=>r.evaluate(i)/a.evaluate(i)],"%":[rh,[rh,rh],(i,[r,a])=>r.evaluate(i)%a.evaluate(i)],ln2:[rh,[],()=>Math.LN2],pi:[rh,[],()=>Math.PI],e:[rh,[],()=>Math.E],"^":[rh,[rh,rh],(i,[r,a])=>Math.pow(r.evaluate(i),a.evaluate(i))],sqrt:[rh,[rh],(i,[r])=>Math.sqrt(r.evaluate(i))],log10:[rh,[rh],(i,[r])=>Math.log(r.evaluate(i))/Math.LN10],ln:[rh,[rh],(i,[r])=>Math.log(r.evaluate(i))],log2:[rh,[rh],(i,[r])=>Math.log2(r.evaluate(i))],sin:[rh,[rh],(i,[r])=>Math.sin(r.evaluate(i))],cos:[rh,[rh],(i,[r])=>Math.cos(r.evaluate(i))],tan:[rh,[rh],(i,[r])=>Math.tan(r.evaluate(i))],asin:[rh,[rh],(i,[r])=>Math.asin(r.evaluate(i))],acos:[rh,[rh],(i,[r])=>Math.acos(r.evaluate(i))],atan:[rh,[rh],(i,[r])=>Math.atan(r.evaluate(i))],min:[rh,nx(rh),(i,r)=>Math.min(...r.map(r=>r.evaluate(i)))],max:[rh,nx(rh),(i,r)=>Math.max(...r.map(r=>r.evaluate(i)))],abs:[rh,[rh],(i,[r])=>Math.abs(r.evaluate(i))],round:[rh,[rh],(i,[r])=>{let a=r.evaluate(i);return a<0?-Math.round(-a):Math.round(a)}],floor:[rh,[rh],(i,[r])=>Math.floor(r.evaluate(i))],ceil:[rh,[rh],(i,[r])=>Math.ceil(r.evaluate(i))],"filter-==":[rc,[ru,rf],(i,[r,a])=>i.properties()[r.value]===a.value],"filter-id-==":[rc,[rf],(i,[r])=>i.id()===r.value],"filter-type-==":[rc,[ru],(i,[r])=>i.geometryType()===r.value],"filter-<":[rc,[ru,rf],(i,[r,a])=>{let n=i.properties()[r.value],o=a.value;return typeof n==typeof o&&n<o}],"filter-id-<":[rc,[rf],(i,[r])=>{let a=i.id(),n=r.value;return typeof a==typeof n&&a<n}],"filter->":[rc,[ru,rf],(i,[r,a])=>{let n=i.properties()[r.value],o=a.value;return typeof n==typeof o&&n>o}],"filter-id->":[rc,[rf],(i,[r])=>{let a=i.id(),n=r.value;return typeof a==typeof n&&a>n}],"filter-<=":[rc,[ru,rf],(i,[r,a])=>{let n=i.properties()[r.value],o=a.value;return typeof n==typeof o&&n<=o}],"filter-id-<=":[rc,[rf],(i,[r])=>{let a=i.id(),n=r.value;return typeof a==typeof n&&a<=n}],"filter->=":[rc,[ru,rf],(i,[r,a])=>{let n=i.properties()[r.value],o=a.value;return typeof n==typeof o&&n>=o}],"filter-id->=":[rc,[rf],(i,[r])=>{let a=i.id(),n=r.value;return typeof a==typeof n&&a>=n}],"filter-has":[rc,[rf],(i,[r])=>r.value in i.properties()],"filter-has-id":[rc,[],i=>null!==i.id()&&void 0!==i.id()],"filter-type-in":[rc,[ry(ru)],(i,[r])=>r.value.includes(i.geometryType())],"filter-id-in":[rc,[ry(rf)],(i,[r])=>
vendor: 4,193 bytes, line 1
1r.value.includes(i.id())],"filter-in-small":[rc,[ru,ry(rf)],(i,[r,a])=>a.value.includes(i.properties()[r.value])],"filter-in-large":[rc,[ru,ry(rf)],(i,[r,a])=>(function(i,r,a,n){for(;a<=n;){let o=a+n>>1;if(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:rc,overloads:[[[rc,rc],(i,[r,a])=>r.evaluate(i)&&a.evaluate(i)],[nx(rc),(i,r)=>{for(let a of r)if(!a.evaluate(i))return!1;return!0}]]},any:{type:rc,overloads:[[[rc,rc],(i,[r,a])=>r.evaluate(i)||a.evaluate(i)],[nx(rc),(i,r)=>{for(let a of r)if(a.evaluate(i))return!0;return!1}]]},"!":[rc,[rc],(i,[r])=>!r.evaluate(i)],"is-supported-script":[rc,[ru],(i,[r])=>{let a=i.globals&&i.globals.isSupportedScript;return!a||a(r.evaluate(i))}],upcase:[ru,[ru],(i,[r])=>r.evaluate(i).toUpperCase()],downcase:[ru,[ru],(i,[r])=>r.evaluate(i).toLowerCase()],concat:[ru,nx(rf),(i,r)=>r.map(r=>rD(r.evaluate(i))).join("")],split:[ry(ru),[ru,ru],(i,[r,a])=>r.evaluate(i).split(a.evaluate(i))],in:[rc,[rf,rf],(i,[r,a])=>{let n=r.evaluate(i),o=a.evaluate(i);return null!=o&&(nv(n,o),o.includes(n))}],"index-of":{type:rh,overloads:[[[rf,rf],(i,[r,a])=>{let n=r.evaluate(i),o=a.evaluate(i);return nv(n,o),o.indexOf(n)}],[[rf,rf,rh],(i,[r,a,n])=>{let o=r.evaluate(i),s=a.evaluate(i),l=n.evaluate(i);return nv(o,s),s.indexOf(o,l)}]]},"resolved-locale":[ru,[rm],(i,[r])=>r.evaluate(i).resolvedLocale()],random:[rh,[rh,rh,rf],(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 rz(`Invalid seed input: ${s}`);a=s}return n+nf(a)()*(o-n)}]});class nB{constructor(i,r,a,n,o){this.expression=i,this._warningHistory={},this._scope=a,this._options=n,this._iconImageUseTheme=o,this._evaluator=new rq(a,n,o),this._defaultValue=r?function(i){return"color"===i.type&&(nP(i.default)||Array.isArray(i.default))?new re(0,0,0,0):"color"===i.type?re.parse(i.default)||null:void 0===i.default?null:i.default}(r):null,this._enumValues=r&&"enum"===r.type?r.values:null,this.configDependencies=nb(i),this.isIndoorDependent=nw(i)}evaluateWithoutErrorHandling(i,r,a,n,o,s,l,h){let u=this._evaluator;return u.globals=i,u.feature=r,u.featureState=a,u.canonical=n||null,u.availableImages=o||null,u.formattedSection=s,u.featureTileCoord=l||null,u.featureDistanceData=h||null,this.expression.evaluate(u)}evaluate(i,r,a,n,o,s,l,h,u){this._evaluator||(this._evaluator=new rq(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 rz(`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 nk(i){return Array.isArray(i)&&i.length>0&&"string"==typeof i[0]&&Object.hasOwn(nm,i[0])}function nN(i,r,a,n,o){let s=new aB(nm,[],r?function(i){let r={color:rd,string:ru,number:rh,enum:ru,boolean:rc,formatted:r_,resolvedImage:rg,object:rp};return"array"===i.type?ry(r[i.value]||rf,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?nT(new nB(l,r,a,n,o)):nS(s.errors)}class nV{constructor(i,r,a,n){this.kind=i,this._styleExpression=r,this.isLightConstant=a,this.isLineProgressConstant=n,this.isStateDependent="constant"!==i&&!aa(r.expression),this.configDependencies=nb(r.expression),this.isIndo
1orDependent=nw(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 nU{constructor(i,r,a,n,o,s){this.kind=i,this.zoomStops=a,this._styleExpression=r,this.isStateDependent="camera"!==i&&!aa(r.expression),this.isIndoorDependent=nw(r.expression),this.isLightConstant=o,this.isLineProgressConstant=s,this.configDependencies=nb(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?a3.interpolationFactor(this.interpolationType,i,r,a):0}}function nj(i,r,a,n,o){if("error"===(i=nN(i,r,a,n,o)).result)return i;let s=i.value.expression,l=ar(s);if(!l&&!nI(r))return nS([new ro("","data expressions not supported")]);let h=ao(s,["zoom","pitch","distance-from-center"]);if(!h&&!nM(r))return nS([new ro("","zoom expressions not supported")]);let u=ao(s,["measure-light"]);if(!u&&!nA(r))return nS([new ro("","measure-light expression not supported")]);let c=ao(s,["line-progress"]);if(!c&&!nE(r.expression,"line-progress"))return nS([new ro("","line-progress expression not supported")]);let d=r.expression&&r.expression.relaxZoomRestriction,p=function i(r){let a=null;if(r instanceof a8)a=i(r.result);else if(r instanceof a4){for(let n of r.args)if(a=i(n))break}else(r instanceof aU||r instanceof a3)&&r.input instanceof rW&&"zoom"===r.input.name&&(a=r);return a instanceof ro||r.eachChild(r=>{let n=i(r);n instanceof ro?a=n:a&&n&&a!==n&&(a=new ro("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),a}(s);return p||h||d?p instanceof ro?nS([p]):p instanceof a3&&!nC(r)?nS([new ro("",'"interpolate" expressions cannot be used with this property')]):nT(p?new nU(l&&c?"camera":"composite",i.value,p.labels,p instanceof a3?p.interpolation:void 0,u,c):new nV(l&&c?"constant":"source",i.value,u,c)):nS([new ro("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression, or in the properties of atmosphere.')])}class nG{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||!(h||void 0!==r.property),c=r.type||(nC(a)?"exponential":"interval");if(l&&((r={...r}).stops&&(r.stops=r.stops.map(i=>[i[0],re.parse(i[1])])),r.default=re.parse(r.default?r.default:a.default)),r.colorSpace&&"rgb"!==r.colorSpace&&!a2[r.colorSpace])throw Error(`Unknown color space: ${r.colorSpace}`);if("exponential"===c)n=nF;else if("interval"===c)n=nz;else if("categorical"===c){for(let i of(n=nL,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=nO}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:a3.interpolationFactor.bind(void 0,l),zoomStops:s.map(i=>i[0]),evaluate:({zoom:i},n)=>nF({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:a3.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?nD(r.default,a.default):n(r,a,h,o,s)}}}(this._parameters,this._specification))}static deserialize(i){return new nG(i._parameters,i._specification)}static serialize(i){return{_parameters:i._parameters,_specification:i._specification}}}class nZ{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}clear(){for(let i of this.boxCells)i&&(i.length=0);for(let i of this.circleCells)i&&(i.length=0);this.circleKeys.length=0,this.boxKeys.length=0,this.bboxes.length=0,this.circles.length=0,this.boxUid=0,this.circleUid=0}insert(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)}
1insertCircle(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}hitTest(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 nZ(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}
1_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 n$={};function nH(i,r,a={}){Object.defineProperty(i,"_classRegistryKey",{value:r,writable:!1}),n$[r]={klass:i,omit:a.omit||[]}}for(let i in nH(Object,"Object"),nH(nZ,"Grid"),delete tr.prototype.constructor,nH(re,"Color"),nH(rI,"Formatted"),nH(rE,"FormattedSection"),nH(rM,"ResolvedImage"),nH(nG,"StylePropertyFunction"),nH(nB,"StyleExpression",{omit:["_evaluator"]}),nH(i5,"ImageId"),nH(rA,"ImageVariant"),nH(nU,"ZoomDependentExpression"),nH(nV,"ZoomConstantExpression"),nH(rW,"CompoundExpression",{omit:["_evaluate"]}),nm)n$[nm[i]._classRegistryKey]||nH(nm[i],`Expression${i}`);function nq(i){return i&&(i instanceof ArrayBuffer||i.constructor&&"ArrayBuffer"===i.constructor.name)}let nW={Error,TypeError,RangeError,SyntaxError,ReferenceError,URIError,EvalError},nX=new Set(["message","stack","cause","errors","name","class"]);function nY(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]=nY(i[o],r);return n}if(ArrayBuffer.isView(i))return r&&r.add(i.buffer),i;if(nq(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:[]};for(let[n,o]of i.entries())a.entries.push(nY(n),nY(o,r));return a}if(i instanceof Headers)return{$name:"Headers",entries:[...i]};if(i instanceof Set){let r={$name:"Set"},a=0;for(let n of i.values())r[++a]=nY(n);return r}if(i instanceof Date||i instanceof RegExp||i instanceof Boolean||i instanceof Number||i instanceof String)return i;if(i instanceof Error){let a=i.constructor&&i.constructor.name||"Error",n={$name:"$Error",class:i instanceof ih?"AJAXError":i instanceof DOMException?"DOMException":i instanceof AggregateError?"AggregateError":nW[a]?a:"Error",name:i.name,message:i.message};for(let a in i.stack&&(n.stack=i.stack),"cause"in i&&i.cause!==i&&(n.cause=nY(i.cause,r)),i instanceof AggregateError&&(n.errors=i.errors.filter(r=>r!==i).map(i=>nY(i,r))),i)Object.hasOwn(i,a)&&(nX.has(a)||(n[a]=nY(i[a],r)));return n}let n=i.constructor||Object,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=n$[o].omit;for(let n in i)Object.hasOwn(i,n)&&(a.includes(n)||(s[n]=nY(i[n],r)))}if(s.$name)throw Error("$name property is reserved for worker serialization logic.");return"Object"!==o&&(s.$name=o),s}function nK(i){if(null===i||"object"!=typeof i)return i;if(Array.isArray(i)){for(let r=0;r<i.length;r++)i[r]=nK(i[r]);return i}if(ArrayBuffer.isView(i)||nq(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(nK(r[i]),nK(r[i+1]));return a}if("Headers"===r)return new Headers(i.entries);if("Set"===r){let r=new Set;for(let a in i)"$name"!==a&&r.add(nK(i[a]));return r}if("BigInt"===r)return BigInt(i.value);if("$Error"===r){let r,a=i.class||"Error",n=i.name||a,o=i.message||"";for(let s in r="DOMException"===a?new DOMException(o,n):"AggregateError"===a?AggregateError((i.errors||[]).map(nK),o):"AJAXError"===a?new ih(i.statusText,i.status,i.url):new(nW[a]||Error)(o),"DOMException"!==a&&(r.name=n),i.stack&&(r.stack=i.stack),"cause"in i&&(r.cause=nK(i.cause)),i)Object.hasOwn(i,s)&&("$name"===s||nX.has(s)||(r[s]=nK(i[s])));return r}let{klass:a}=n$[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]=nK(i[r]));return n}let nJ=i=>i>=1536&&i<=1791,nQ=i=>i>=1872&&i<=1919,n0=i=>i>=2208&&i<=2303,n1=i=>i>=11904&&i<=12031,n2=i=>i>=12032&&i<=12255,n3=i=>i>=12272&&i<=12287,n5=i=>i>=12288&&i<=12351,n4=i=>i>=12352&&i<=12447,n6=i=>i>=12448&&i<=12543,n8=i=>i>=12544&&i<=12591,n9=i=>i>=12704&&i<=12735,n7=i=>i>=12736&&i<=12783,oe=i=>i>=12784&&i<=12799,ot=i=>i>=12800&&i<=13055,oi=i=>i>=13056&&i<=13311,or=i=>i>=13312&&i<=19903,oa=i=>i>=19968&&i<=40959,on=i=>i>=40960&&i<=42127,oo=i=>i>=42128&&i<=42191,os=i=>i>=44032&&i<=55215,ol=i=>i>=63744&&i<=64255,oh=i=>i>=64336&&i<=65023,ou=i=>i>=65040&&i<=65055,oc=i=>i>
1=65072&&i<=65103,od=i=>i>=65104&&i<=65135,op=i=>i>=65136&&i<=65279,of=i=>i>=65280&&i<=65519;function om(i){for(let r of i)if(o_(r.charCodeAt(0)))return!0;return!1}function o_(i){return!(746!==i&&747!==i&&(i<4352||!(n9(i)||n8(i)||oc(i)&&!(i>=65097&&i<=65103)||ol(i)||oi(i)||n1(i)||n7(i)||!(!n5(i)||i>=12296&&i<=12305||i>=12308&&i<=12319||12336===i)||or(i)||oa(i)||ot(i)||i>=12592&&i<=12687||i>=43360&&i<=43391||i>=55216&&i<=55295||i>=4352&&i<=4607||os(i)||n4(i)||n3(i)||i>=12688&&i<=12703||n2(i)||oe(i)||n6(i)&&12540!==i||!(!of(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)||!(!od(i)||i>=65112&&i<=65118||i>=65123&&i<=65126)||i>=5120&&i<=5759||i>=6320&&i<=6399||ou(i)||i>=19904&&i<=19967||on(i)||oo(i))))}function og(i){return!(o_(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)||n5(i)||n6(i)||i>=57344&&i<=63743||oc(i)||od(i)||of(i)||8734===i||8756===i||8757===i||i>=9984&&i<=10087||i>=10102&&i<=10131||65532===i||65533===i)}function oy(i){return i>=1424&&i<=2303||oh(i)||op(i)}let ox={unavailable:"unavailable",deferred:"deferred",loading:"loading",parsing:"parsing",parsed:"parsed",loaded:"loaded",error:"error"},ov=null,ob=ox.unavailable,ow=null,oT=function(i){i&&(ob=ox.error),ov&&ov(i)};function oS(){oE.fire(new iQ("pluginStateChange",{pluginStatus:ob,pluginURL:ow}))}let oE=new i3,oI=function(){return ob},oA=function(){if(ob!==ox.deferred||!ow)throw Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");ob=ox.loading,oS(),ow&&iy({url:ow}).then(()=>{ob=ox.loaded,oS()}).catch(i=>{oT(i)})},oM={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>ob===ox.loaded||null!=oM.applyArabicShaping,isLoading:()=>ob===ox.loading,setState(i){ob=i.pluginStatus,ow=i.pluginURL},isParsing:()=>ob===ox.parsing,isParsed:()=>ob===ox.parsed,getPluginURL:()=>ow};class oC{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=oM.isLoaded();for(let a of i)if(!function(i,r){return!(!r&&oy(i)||i>=2304&&i<=3583||i>=3840&&i<=4255||i>=6016&&i<=6143)}(a.charCodeAt(0),r))return!1;return!0}}class oP{constructor(i,r,a,n,o){this.property=i,this.value=r,this.expression=function(i,r,a,n,o){if(nP(i))return new nG(i,r);if(nk(i)||Array.isArray(i)&&i.length>0){let s=nj(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=re.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 oR{constructor(i,r,a,n){this.property=i,this.value=new oP(i,void 0,r,a,n)}transitioned(i,r){return new oL(this.property,this.value,r,{...i.transition,...this.transition},i.now)}untransitioned(){return new oL(this.property,this.value,null,{},0)}}class oD{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 tD(this._values[i].value.value)}setValue(i,r){Object.hasOwn(this._values,i)||(this._values[i]=new oR(this._values[i].property,this._scope,this._options,this._iconImageUseTheme)),this._values[i].value=new oP(this._values[i].property,null===r?void 0:tD(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 tD(this._values[i].transition)}setTransition(i,r){Object.hasOwn(this._values,i)||(this._values[i]=new oR(this._values[i].property)),this._values[i].transition=tD(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 oz(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 oz(this._properties);for(let r of Object.keys(this._values))i._values[r]=this._values[r].untransitioned();return i}isIndoorDependent(){return this._isIndoorDependent}}class oL{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,ty(l))}}return o}}class oz{constructor(i){this._properties=i,this._values=Object.create(i.defaultTransitioningPropertyValues)}possiblyEvaluate(i,r,a){let n=new oB(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 oF{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 tD(this._values[i].value)}setValue(i,r){this._values[i]=new oP(this._values[i].property,null===r?void 0:tD(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 oB(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 oO{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 oB{constructor(i){this._properties=i,this._values=Object.create(i.defaultPossiblyEvaluatedValues)}get(i){return this._values[i]}}class ok{constructor(i){this.specification=i}possiblyEvaluate(i,r){return i.expression.evaluate(r)}interpolate(i,r,a){let n=rn[this.specification.type];return n?n(i,r,a):i}}class oN{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 oO(this,{kind:"constant",value:i.expression.evaluate(r,null,{},a,n,void 0,o)},r):new oO(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 oO(this,{kind:"constant",value:void 0},i.parameters);let n=rn[this.specification.type];return n?new oO(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)}}class oV{constructor(i){this.specification=i}possiblyEvaluate(i,r,a,n){return!!i.expression.evaluate(r,null,{},a,n)}interpolate(){return!1}}class oU{constructor(i){this.properties=i,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];let r=new oC(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 oP(n,void 0),l=this.defaultTransitionablePropertyValues[a]=new oR(n);this.defaultTransitioningPropertyValues[a]=l.untransitioned(),this.defaultPossiblyEvaluatedValues[a]=s.possiblyEvaluate(r)}}}nH(oN,"DataDrivenProperty"),nH(ok,"DataConstantProperty"),nH(oV,"ColorRampProperty");var oj
vendor: 60,874 bytes, line 1
1=JSON.parse('{"expression":1,"transition":{"duration":{"type":"number","default":300,"minimum":0},"delay":{"type":"number","default":0,"minimum":0}},"appearance":{"condition":{"type":"boolean","expression":{"interpolated":1,"parameters":["distance-from-center","feature","feature-state","measure-light","pitch","zoom"]},"property-type":"data-driven"},"name":{"type":"string"},"properties":{"type":"*"}},"function":{"type":{"type":"enum","default":"exponential","values":{"identity":1,"exponential":1,"interval":1,"categorical":1}},"default":{"type":"*"},"expression":1,"stops":{"type":"array","value":"function_stop"},"base":{"type":"number","default":1,"minimum":0},"property":{"type":"string","default":"$zoom"},"colorSpace":{"type":"enum","default":"rgb","values":{"rgb":1,"lab":1,"hcl":1}}},"$version":8,"$root":{"transition":{"type":"transition"},"version":{"type":"enum","values":[8]},"fragment":{"type":"boolean"},"name":{"type":"string"},"metadata":{"type":"*"},"center":{"type":"array","value":"number"},"zoom":{"type":"number"},"bearing":{"type":"number","default":0},"pitch":{"type":"number","default":0},"light":{"type":"light"},"lights":{"type":"array","value":"light-3d"},"terrain":{"type":"terrain","optional":true},"fog":{"type":"fog"},"snow":{"type":"snow"},"rain":{"type":"rain"},"camera":{"type":"camera"},"color-theme":{"type":"colorTheme"},"indoor":{"type":"indoor"},"imports":{"type":"array","value":"import"},"iconsets":{"type":"iconsets"},"schema":{"type":"schema"},"sources":{"type":"sources"},"sprite":{"type":"string"},"glyphs":{"type":"string","default":"mapbox://fonts/mapbox/{fontstack}/{range}.pbf"},"projection":{"type":"projection"},"layers":{"type":"array","value":"layer"},"models":{"type":"models"},"featuresets":{"type":"featuresets"}},"featuresets":{"*":{"type":"featureset"}},"featureset":{"metadata":{"type":"*"},"selectors":{"type":"array","value":"selector"}},"selector":{"layer":{"type":"string"},"properties":{"type":"selectorProperty"},"featureNamespace":{"type":"string"},"_uniqueFeatureID":{"type":"boolean"}},"selectorProperty":{"*":{"type":"*"}},"model":{"type":"string"},"import":{"id":{"type":"string"},"url":{"type":"string"},"config":{"type":"config"},"data":{"type":"$root"},"color-theme":{"type":"colorTheme","optional":true}},"config":{"*":{"type":"*"}},"schema":{"*":{"type":"option"}},"option":{"type":{"type":"enum","values":{"string":1,"number":1,"boolean":1,"color":1,"object":{}}},"default":{"type":"*","expression":1},"values":{"type":"array","value":"*"},"array":{"type":"boolean"},"minValue":{"type":"number"},"maxValue":{"type":"number"},"stepValue":{"type":"number"},"metadata":{"type":"*"}},"models":{"*":{"type":"model"}},"light-3d":{"type":{"type":"enum","values":{"ambient":{},"directional":{},"flat":{}}},"id":{"type":"string"},"properties":{"type":"properties"}},"properties":["properties_light_directional","properties_light_ambient","properties_light_flat"],"properties_light_directional":{"direction":{"type":"array","default":[210,30],"minimum":[0,0],"maximum":[360,90],"length":2,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1,"use-theme":1},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"cast-shadows":{"type":"boolean","default":false},"shadow-quality":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"parameters":["zoom"]}},"shadow-intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"shadow-draw-before-layer":{"type":"string"}},"properties_light_ambient":{"color":{"type":"color","default":"#ffffff","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1,"use-theme":1},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1}},"properties_light_flat":{"anchor":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1,"use-theme":1},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1}},"iconsets":{"*":{"type":"iconset"}},"iconset":["iconset_sprite","iconset_source"],"iconset_sprite":{"type":{"type":"enum","values":{"sprite":1}},"url":{"type":"string"}},"iconset_source":{"type":{"type":"enum","values":{"source":1}},"source":{"type":"string"}},"sources":{"*":{"type":"source"}},"source":["source_vector","source_raster","source_raster_dem","source_raster_array","source_geojson","source_video","source_image","source_model"],"source_vector":{"type":{"type":"enum","values":{"vector":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","default":[-180,-85.051129,180,85.051129],"length":4,"value":"number"},"extra_bounds":{"type":"array","value":{"type":"array","length":4,"value":"number"}},"scheme":{"type":"enum","default":"xyz","values":{"xyz":1,"tms":1}},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"attribution":{"type":"string"},"promoteId":{"type":"promoteId"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster":{"type":{"type":"enum","values":{"raster":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","default":[-180,-85.051129,180,85.051129],"length":4,"value":"number"},"extra_bounds":{"type":"array","value":{"type":"array","length":4,"value":"number"}},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"scheme":{"type":"enum","default":"xyz","values":{"xyz":1,"tms":1}},"attribution":{"type":"string"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster_dem":{"type":{"type":"enum","values":{"raster-dem":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","default":[-180,-85.051129,180,85.051129],"length":4,"value":"number"},"extra_bounds":{"type":"array","value":{"type":"array","length":4,"value":"number"}},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"attribution":{"type":"string"},"encoding":{"type":"enum","default":"mapbox","values":{"terrarium":1,"mapbox":1}},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster_array":{"type":{"type":"enum","values":{"raster-array":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","default":[-180,-85.051129,180,85.051129],"length":4,"value":"number"},"extra_bounds":{"type":"array","value":{"type":"array","length":4,"value":"number"}},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"attribution":{"type":"string"},"rasterLayers":{"type":"*"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_geojson":{"type":{"type":"enum","values":{"geojson":1}},"data":{"type":"*"},"maxzoom":{"type":"number","default":18},"minzoom":{"type":"number","default":0},"attribution":{"type":"string"},"buffer":{"type":"number","default":128,"minimum":0,"maximum":512},"filter":{"type":"*"},"tolerance":{"type":"number","default":0.375},"cluster":{"type":"boolean","default":false},"clusterRadius":{"type":"number","default":50,"minimum":0},"clusterMaxZoom":{"type":"number"},"clusterMinPoints":{"type":"number"},"clusterProperties":{"type":"*"},"lineMetrics":{"type":"boolean","default":false},"generateId":{"type":"boolean","default":false},"promoteId":{"type":"promoteId"},"dynamic":{"type":"boolean","default":false}},"source_video":{"type":{"type":"enum","values":{"video":1}},"urls":{"type":"array","value":"string"},"coordinates":{"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"source_image":{"type":{"type":"enum","values":{"image":1}},"url":{"type":"string"},"coordinates":{"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"modelNodeOverride":{"orientation":{"type":"array","default":[0,0,0],"length":3,"value":"number"}},"modelLightOverrides":{"light-ambient-color":{"type":"color"},"light-ambient-intensity":{"type":"number"},"light-directional-color":{"type":"color"},"light-directional-intensity":{"type":"number"}},"modelNodeOverrides":{"*":{"type":"modelNodeOverride"}},"modelMaterialOverride":{"model-color":{"type":"color"},"model-color-mix-intensity":{"type":"number"},"model-opacity":{"type":"number"},"model-emissive-strength":{"type":"number"}},"modelMaterialOverrides":{"*":{"type":"modelMaterialOverride"}},"modelSourceModel":{"uri":{"type":"string"},"position":{"type":"array","default":[0,0],"minimum":[-180,-90],"maximum":[180,90],"length":2,"value":"number"},"orientation":{"type":"array","default":[0,0,0],"length":3,"value":"number"},"lightOverrides":{"type":"modelLightOverrides"},"nodeOverrides":{"type":"modelNodeOverrides"},"materialOverrides":{"type":"modelMaterialOverrides"},"nodeOverrideNames":{"type":"array","value":"string"},"materialOverrideNames":{"type":"array","value":"string"},"featureProperties":{"type":"*"}},"modelSourceModels":{"*":{"type":"modelSourceModel"}},"source_model":{"type":{"type":"enum","values":{"model":1,"batched-model":1}},"url":{"type":"string"},"maxzoom":{"type":"number","default":18},"minzoom":{"type":"number","default":0},"tiles":{"type":"array","value":"string"},"models":{"type":"modelSourceModels"}},"layer":{"type":{"type":"enum","values":{"fill":{},"line":{},"symbol":{},"circle":{},"heatmap":{},"fill-extrusion":{},"building":{},"raster":{},"raster-particle":{},"hillshade":{},"model":{},"background":{},"sky":{},"slot":{},"placement-group":{},"clip":{}}},"id":{"type":"string"},"metadata":{"type":"*"},"source":{"type":"string"},"source-layer":{"type":"string"},"slot":{"type":"string"},"minzoom":{"type":"number","minimum":0,"maximum":24},"maxzoom":{"type":"number","minimum":0,"maximum":24},"filter":{"type":"filter"},"layout":{"type":"layout"},"paint":{"type":"paint"},"appearances":{"type":"array","value":"appearance"}},"layout":["layout_clip","layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_building","layout_symbol","layout_raster","layout_raster-particle","layout_hillshade","layout_background","layout_sky","layout_model"],"layout_background":{"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1}},"layout_sky":{"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1}},"layout_model":{"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1},"model-id":{"type":"string","default":"","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"model-allow-density-reduction":{"type":"boolean","default":true}},"layout_clip":{"clip-layer-types":{"type":"array","default":[],"value":"enum","values":{"model":1,"symbol":1},"expression":1},"clip-layer-scope":{"type":"array","default":[],"value":"string","expression":1},"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1}},"layout_fill":{"fill-sort-key":{"type":"number","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1},"fill-elevation-reference":{"type":"enum","default":"none","values":{"none":1,"hd-road-base":1,"hd-road-markup":1},"expression":1},"fill-construct-bridge-guard-rail":{"type":"boolean","default":"true","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"}},"layout_circle":{"circle-sort-key":{"type":"number","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"circle-elevation-reference":{"type":"enum","default":"none","values":{"none":1,"hd-road-markup":1},"expression":1},"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1}},"layout_heatmap":{"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1}},"layout_fill-extrusion":{"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1},"fill-extrusion-edge-radius":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":1},"source-max-zoom":{"type":"number","minimum":0,"maximum":24}},"layout_building":{"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1},"building-facade":{"type":"boolean","default":false,"expression":{"parameters":["feature"]},"property-type":"data-driven"},"building-facade-floors":{"type":"number","default":3,"minimum":1,"maximum":200,"expression":{"parameters":["feature"]},"property-type":"data-driven"},"building-facade-unit-width":{"type":"number","default":3.1,"minimum":1,"maximum":20,"expression":{"parameters":["feature"]},"property-type":"data-driven"},"building-facade-window":{"type":"array","default":[0.9,0.9],"minimum":0.1,"maximum":1,"length":2,"value":"number","expression":{"parameters":["feature"]},"property-type":"data-driven"},"building-roof-shape":{"type":"enum","default":"flat","values":{"flat":1,"hipped":1,"gabled":1,"parapet":1,"mansard":1,"skillion":1,"pyramidal":1},"expression":{"parameters":["feature"]},"property-type":"data-driven"},"building-height":{"type":"number","default":0,"minimum":0,"expression":1,"transition":1,"property-type":"data-driven"},"building-base":{"type":"number","default":0,"minimum":0,"expression":1,"transition":1,"property-type":"data-driven"},"building-flood-light-wall-radius":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state"]},"transition":1,"property-type":"data-driven"},"building-flood-light-ground-radius":{"type":"number","default":0,"expression":{"interpolated":1,"parameters":["feature","feature-state"]},"transition":1,"property-type":"data-driven"},"building-flip-roof-orientation":{"type":"boolean","default":false,"expression":{"interpolated":1,"parameters":["feature","feature-state"]},"transition":1,"property-type":"data-driven"}},"layout_line":{"line-cap":{"type":"enum","default":"butt","values":{"butt":1,"round":1,"square":1},"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"line-join":{"type":"enum","default":"miter","values":{"bevel":1,"round":1,"miter":1,"none":1},"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"line-miter-limit":{"type":"number","default":2,"expression":{"interpolated":1,"parameters":["zoom"]}},"line-round-limit":{"type":"number","default":1.05,"expression":{"interpolated":1,"parameters":["zoom"]}},"line-sort-key":{"type":"number","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"line-z-offset":{"type":"number","default":0,"expression":{"parameters":["feature","line-progress","zoom"]},"property-type":"data-driven"},"line-elevation-reference":{"type":"enum","default":"none","values":{"none":1,"sea":1,"ground":1,"hd-road-markup":1},"expression":1},"line-cross-slope":{"type":"number","expression":1},"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1},"line-width-unit":{"type":"enum","default":"pixels","values":{"pixels":1,"meters":1},"expression":{"parameters":["zoom"]}},"line-elevation-ground-scale":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","line-progress","zoom"]},"transition":1,"property-type":"data-driven"}},"layout_symbol":{"symbol-placement":{"type":"enum","default":"point","values":{"point":1,"line":1,"line-center":1},"expression":{"parameters":["zoom"]}},"symbol-spacing":{"type":"number","default":250,"minimum":1,"expression":{"interpolated":1,"parameters":["zoom"]}},"symbol-avoid-edges":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"symbol-sort-key":{"type":"number","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"symbol-z-order":{"type":"enum","default":"auto","values":{"auto":1,"viewport-y":1,"source":1},"expression":{"parameters":["zoom"]}},"symbol-z-elevate":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"symbol-elevation-reference":{"type":"enum","default":"ground","values":{"sea":1,"ground":1,"hd-road-markup":1},"expression":{"parameters":["zoom"]}},"icon-allow-overlap":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-ignore-placement":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-optional":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-rotation-alignment":{"type":"enum","default":"auto","values":{"map":1,"viewport":1,"auto":1},"expression":{"parameters":["zoom"]}},"icon-size":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","zoom"]},"property-type":"data-driven","appearance":1},"icon-size-scale-range":{"type":"array","default":[0.8,2],"minimum":[0.1,0.1],"maximum":[10,10],"length":2,"value":"number","expression":1},"icon-text-fit":{"type":"enum","default":"none","values":{"none":1,"width":1,"height":1,"both":1},"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"icon-text-fit-padding":{"type":"array","default":[0,0,0,0],"length":4,"value":"number","expression":{"interpolated":1,"parameters":["feature","zoom"]},"property-type":"data-driven"},"icon-image":{"type":"resolvedImage","expression":{"parameters":["feature","zoom"]},"use-theme":1,"property-type":"data-driven","appearance":1,"tokens":1},"icon-rotate":{"type":"number","default":0,"expression":{"interpolated":1,"parameters":["feature","zoom"]},"property-type":"data-driven","appearance":1},"icon-padding":{"type":"number","default":2,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]}},"icon-keep-upright":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-offset":{"type":"array","default":[0,0],"length":2,"value":"number","expression":{"interpolated":1,"parameters":["feature","zoom"]},"property-type":"data-driven","appearance":1},"icon-anchor":{"type":"enum","default":"center","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"icon-pitch-alignment":{"type":"enum","default":"auto","values":{"map":1,"viewport":1,"auto":1},"expression":{"parameters":["zoom"]}},"text-pitch-alignment":{"type":"enum","default":"auto","values":{"map":1,"viewport":1,"auto":1},"expression":{"parameters":["zoom"]}},"text-rotation-alignment":{"type":"enum","default":"auto","values":{"map":1,"viewport":1,"auto":1},"expression":{"parameters":["zoom"]}},"text-field":{"type":"formatted","default":"","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven","tokens":1},"text-font":{"type":"array","default":["Open Sans Regular","Arial Unicode MS Regular"],"value":"string","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"text-size":{"type":"number","default":16,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","zoom"]},"property-type":"data-driven","appearance":1},"text-size-scale-range":{"type":"array","default":[0.8,2],"minimum":[0.1,0.1],"maximum":[10,10],"length":2,"value":"number","expression":1},"text-max-width":{"type":"number","default":10,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","zoom"]},"property-type":"data-driven"},"text-line-height":{"type":"number","default":1.2,"expression":{"interpolated":1,"parameters":["feature","zoom"]},"property-type":"data-driven"},"text-letter-spacing":{"type":"number","default":0,"expression":{"interpolated":1,"parameters":["feature","zoom"]},"property-type":"data-driven"},"text-justify":{"type":"enum","default":"center","values":{"auto":1,"left":1,"center":1,"right":1},"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"text-radial-offset":{"type":"number","default":0,"expression":{"interpolated":1,"parameters":["feature","zoom"]},"property-type":"data-driven"},"text-variable-anchor":{"type":"array","value":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"expression":{"parameters":["zoom"]}},"text-anchor":{"type":"enum","default":"center","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"text-max-angle":{"type":"number","default":45,"expression":{"interpolated":1,"parameters":["zoom"]}},"text-writing-mode":{"type":"array","value":"enum","values":{"horizontal":1,"vertical":1},"expression":{"parameters":["zoom"]}},"text-rotate":{"type":"number","default":0,"expression":{"interpolated":1,"parameters":["feature","zoom"]},"property-type":"data-driven","appearance":1},"text-padding":{"type":"number","default":2,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]}},"text-keep-upright":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"text-transform":{"type":"enum","default":"none","values":{"none":1,"uppercase":1,"lowercase":1},"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"text-offset":{"type":"array","default":[0,0],"length":2,"value":"number","expression":{"interpolated":1,"parameters":["feature","zoom"]},"property-type":"data-driven","appearance":1},"text-allow-overlap":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"text-ignore-placement":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"text-optional":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1}},"layout_raster":{"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1}},"layout_raster-particle":{"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1}},"layout_hillshade":{"visibility":{"type":"enum","default":"visible","values":{"visible":1,"none":1},"expression":1}},"filter":{"type":"array","value":"*"},"filter_symbol":{"type":"boolean","default":false,"expression":{"parameters":["distance-from-center","feature","pitch","zoom"]},"property-type":"data-driven"},"filter_fill":{"type":"boolean","default":false,"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"filter_hillshade":{"type":"boolean","default":false,"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"filter_raster":{"type":"boolean","default":false,"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"filter_raster-particle":{"type":"boolean","default":false,"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"filter_clip":{"type":"boolean","default":false,"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"filter_model":{"type":"boolean","default":false,"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"filter_line":{"type":"boolean","default":false,"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"filter_circle":{"type":"boolean","default":false,"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"filter_fill-extrusion":{"type":"boolean","default":false,"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"filter_building":{"type":"boolean","default":false,"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"filter_heatmap":{"type":"boolean","default":false,"expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"filter_operator":{"type":"enum","values":{"==":1,"!=":1,">":1,">=":1,"<":1,"<=":1,"in":1,"!in":1,"all":1,"any":1,"none":1,"has":1,"!has":1}},"geometry_type":{"type":"enum","values":{"Point":1,"LineString":1,"Polygon":1}},"function_stop":{"type":"array","minimum":0,"maximum":24,"length":2,"value":["number","color"]},"fog":{"range":{"type":"array","default":[0.5,10],"minimum":-20,"maximum":20,"length":2,"value":"number","expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1,"use-theme":1},"high-color":{"type":"color","default":"#245cdf","expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1,"use-theme":1},"space-color":{"type":"color","default":["interpolate",["linear"],["zoom"],4,"#010b19",7,"#367ab9"],"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1,"use-theme":1},"horizon-blend":{"type":"number","default":["interpolate",["linear"],["zoom"],4,0.2,7,0.1],"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"star-intensity":{"type":"number","default":["interpolate",["linear"],["zoom"],5,0.35,6,0],"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"vertical-range":{"type":"array","default":[0,0],"minimum":0,"length":2,"value":"number","expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1}},"snow":{"density":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.85],"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1,"use-theme":1},"opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"vignette":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.3],"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"vignette-color":{"type":"color","default":"#ffffff","expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1,"use-theme":1},"center-thinning":{"type":"number","default":0.4,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"direction":{"type":"array","default":[0,50],"minimum":0,"maximum":360,"length":2,"value":"number","expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"flake-size":{"type":"number","default":0.71,"minimum":0,"maximum":5,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1}},"rain":{"density":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.5],"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"color":{"type":"color","default":["interpolate",["linear"],["measure-light","brightness"],0,"#03113d",0.3,"#a8adbc"],"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1,"use-theme":1},"opacity":{"type":"number","default":["interpolate",["linear"],["measure-light","brightness"],0,0.88,1,0.7],"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"vignette":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,1],"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"vignette-color":{"type":"color","default":["interpolate",["linear"],["measure-light","brightness"],0,"#001736",0.3,"#464646"],"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1,"use-theme":1},"center-thinning":{"type":"number","default":0.57,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"direction":{"type":"array","default":[0,80],"minimum":0,"maximum":360,"length":2,"value":"number","expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"droplet-size":{"type":"array","default":[2.6,18.2],"minimum":0,"maximum":50,"length":2,"value":"number","expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1},"distortion-strength":{"type":"number","default":0.7,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"],"relaxZoomRestriction":1},"transition":1}},"camera":{"camera-projection":{"type":"enum","default":"perspective","values":{"perspective":1,"orthographic":1}}},"colorTheme":{"data":{"type":"string","expression":1}},"indoor_source":{"sourceId":{"type":"string"},"sourceLayers":{"type":"array","value":"string"}},"indoor":{"*":{"type":"indoor_source"}},"light":{"anchor":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1,"use-theme":1},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1}},"projection":{"name":{"type":"enum","default":"mercator","values":{"albers":1,"equalEarth":1,"equirectangular":1,"lambertConformalConic":1,"mercator":1,"naturalEarth":1,"winkelTripel":1,"globe":1}},"center":{"type":"array","minimum":[-180,-90],"maximum":[180,90],"length":2,"value":"number"},"parallels":{"type":"array","minimum":[-90,-90],"maximum":[90,90],"length":2,"value":"number"}},"terrain":{"source":{"type":"string"},"exaggeration":{"type":"number","default":1,"minimum":0,"maximum":1000,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1}},"paint":["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_building","paint_symbol","paint_raster","paint_raster-particle","paint_hillshade","paint_background","paint_sky","paint_model"],"paint_fill":{"fill-antialias":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"fill-color":{"type":"color","default":"#000000","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven"},"fill-outline-color":{"type":"color","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven"},"fill-translate":{"type":"array","default":[0,0],"length":2,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"fill-translate-anchor":{"type":"enum","default":"map","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"fill-pattern":{"type":"resolvedImage","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"fill-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]}},"fill-emissive-strength":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1},"fill-z-offset":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","zoom"]},"transition":1,"property-type":"data-driven"},"fill-bridge-guard-rail-color":{"type":"color","default":"rgba(241, 236, 225, 255)","expression":{"interpolated":1,"parameters":["feature","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven"},"fill-tunnel-structure-color":{"type":"color","default":"rgba(241, 236, 225, 255)","expression":{"interpolated":1,"parameters":["feature","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"fill-extrusion-color":{"type":"color","default":"#000000","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven"},"fill-extrusion-translate":{"type":"array","default":[0,0],"length":2,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"fill-extrusion-translate-anchor":{"type":"enum","default":"map","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"fill-extrusion-pattern":{"type":"resolvedImage","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"fill-extrusion-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]}},"fill-extrusion-height":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","zoom"]},"transition":1,"property-type":"data-driven"},"fill-extrusion-base":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","zoom"]},"transition":1,"property-type":"data-driven"},"fill-extrusion-height-alignment":{"type":"enum","default":"flat","values":{"terrain":1,"flat":1}},"fill-extrusion-base-alignment":{"type":"enum","default":"terrain","values":{"terrain":1,"flat":1}},"fill-extrusion-vertical-gradient":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-extrusion-ambient-occlusion-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"fill-extrusion-ambient-occlusion-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"fill-extrusion-ambient-occlusion-wall-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"fill-extrusion-ambient-occlusion-ground-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"fill-extrusion-ambient-occlusion-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"fill-extrusion-flood-light-color":{"type":"color","default":"#ffffff","expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1,"use-theme":1},"fill-extrusion-flood-light-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1},"fill-extrusion-flood-light-wall-radius":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state"]},"transition":1,"property-type":"data-driven"},"fill-extrusion-flood-light-ground-radius":{"type":"number","default":0,"expression":{"interpolated":1,"parameters":["feature","feature-state"]},"transition":1,"property-type":"data-driven"},"fill-extrusion-flood-light-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"fill-extrusion-vertical-scale":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"fill-extrusion-rounded-roof":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-extrusion-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":1},"fill-extrusion-front-cutoff":{"type":"array","default":[0,0,1],"minimum":[0,0,0],"maximum":[1,1,1],"length":3,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]}},"fill-extrusion-emissive-strength":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"fill-extrusion-line-width":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"fill-extrusion-cast-shadows":{"type":"boolean","default":true}},"paint_building":{"building-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"building-ambient-occlusion-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"parameters":[]},"transition":1},"building-ambient-occlusion-ground-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"building-ambient-occlusion-ground-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"building-ambient-occlusion-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"building-vertical-scale":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"building-cast-shadows":{"type":"boolean","default":true},"building-color":{"type":"color","default":"rgba(193, 154, 127, 1)","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light"]},"use-theme":1,"property-type":"data-driven"},"building-emissive-strength":{"type":"number","default":0,"minimum":0,"maximum":5,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light"]},"property-type":"data-driven"},"building-facade-emissive-chance":{"type":"number","default":0.35,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]}},"building-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":1},"building-front-cutoff":{"type":"array","default":[0,0,1],"minimum":[0,0,0],"maximum":[1,1,1],"length":3,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]}},"building-flood-light-color":{"type":"color","default":"#ffffff","expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1,"use-theme":1},"building-flood-light-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1},"building-flood-light-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1}},"paint_line":{"line-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"line-color":{"type":"color","default":"#000000","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven"},"line-translate":{"type":"array","default":[0,0],"length":2,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"line-translate-anchor":{"type":"enum","default":"map","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"line-width":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","line-progress","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"line-gap-width":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"line-offset":{"type":"number","default":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"line-blur":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"line-dasharray":{"type":"array","minimum":0,"value":"number","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"line-pattern":{"type":"resolvedImage","expression":{"parameters":["feature","zoom"]},"property-type":"data-driven"},"line-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]}},"line-gradient":{"type":"color","expression":{"interpolated":1,"parameters":["line-progress"]},"use-theme":1},"line-trim-offset":{"type":"array","default":[0,0],"minimum":[0,0],"maximum":[1,1],"length":2,"value":"number"},"line-trim-fade-range":{"type":"array","default":[0,0],"minimum":[0,0],"maximum":[1,1],"length":2,"value":"number","expression":{"interpolated":1,"parameters":["measure-light","zoom"]}},"line-trim-color":{"type":"color","default":"transparent","expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1,"use-theme":1},"line-emissive-strength":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["line-progress","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"line-border-width":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","zoom"]},"transition":1,"property-type":"data-driven"},"line-border-color":{"type":"color","default":"rgba(0, 0, 0, 0)","expression":{"interpolated":1,"parameters":["feature","feature-state","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven"},"line-border-gradient":{"type":"color","expression":{"interpolated":1,"parameters":["line-progress"]},"use-theme":1},"line-occlusion-opacity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"line-blend-mode":{"type":"enum","default":"default","values":{"default":1,"multiply":1,"additive":1},"expression":{"parameters":["zoom"]}},"line-blend-additive-clamp":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]}},"line-cutout-depth":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1}},"paint_circle":{"circle-radius":{"type":"number","default":5,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"circle-color":{"type":"color","default":"#000000","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven"},"circle-blur":{"type":"number","default":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"circle-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"circle-translate":{"type":"array","default":[0,0],"length":2,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"circle-translate-anchor":{"type":"enum","default":"map","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"circle-pitch-scale":{"type":"enum","default":"map","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"circle-pitch-alignment":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"circle-stroke-width":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"circle-stroke-color":{"type":"color","default":"#000000","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven"},"circle-stroke-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"circle-emissive-strength":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1}},"paint_heatmap":{"heatmap-radius":{"type":"number","default":30,"minimum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven"},"heatmap-weight":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"property-type":"data-driven"},"heatmap-intensity":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"heatmap-color":{"type":"color","default":["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",0.1,"royalblue",0.3,"cyan",0.5,"lime",0.7,"yellow",1,"red"],"expression":{"interpolated":1,"parameters":["heatmap-density"]},"use-theme":1},"heatmap-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1}},"paint_symbol":{"icon-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven","appearance":1},"icon-occlusion-opacity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven","appearance":1},"icon-emissive-strength":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":1,"parameters":["feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven","appearance":1},"text-emissive-strength":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":1,"parameters":["feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven","appearance":1},"icon-color":{"type":"color","default":"#000000","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven","appearance":1},"icon-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven","appearance":1},"icon-halo-width":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven","appearance":1},"icon-halo-blur":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven","appearance":1},"icon-translate":{"type":"array","default":[0,0],"length":2,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1,"appearance":1},"icon-translate-anchor":{"type":"enum","default":"map","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"icon-image-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]}},"text-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven","appearance":1},"text-occlusion-opacity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven","appearance":1},"text-color":{"type":"color","default":"#000000","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven","appearance":1,"overridable":1},"text-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven","appearance":1},"text-halo-width":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven","appearance":1},"text-halo-blur":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"property-type":"data-driven","appearance":1},"text-translate":{"type":"array","default":[0,0],"length":2,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1,"appearance":1},"text-translate-anchor":{"type":"enum","default":"map","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"icon-color-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":1},"icon-color-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":1},"icon-color-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":1},"icon-color-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":1},"symbol-z-offset":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["feature","zoom"]},"transition":1,"property-type":"data-driven","appearance":1},"placement-priority":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["distance-from-center","feature","feature-state","measure-light","pitch","zoom"]},"property-type":"data-driven","appearance":1},"placement-group":{"type":"string","expression":{"parameters":["distance-from-center","feature","feature-state","measure-light","pitch","zoom"]},"property-type":"data-driven","appearance":1}},"paint_raster":{"raster-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"raster-color":{"type":"color","expression":{"interpolated":1,"parameters":["raster-value"]},"use-theme":1},"raster-color-mix":{"type":"array","default":[0.2126,0.7152,0.0722,0],"length":4,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"raster-color-range":{"type":"array","length":2,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"raster-color-scale":{"type":"enum","default":"linear","values":{"linear":1,"log":1},"expression":{"parameters":[]}},"raster-hue-rotate":{"type":"number","default":0,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"raster-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"raster-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"raster-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"raster-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"raster-resampling":{"type":"enum","default":"linear","values":{"linear":1,"nearest":1},"expression":{"parameters":["zoom"]}},"raster-fade-duration":{"type":"number","default":300,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]}},"raster-emissive-strength":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1},"raster-array-band":{"type":"string"},"raster-elevation":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"raster-elevation-reference":{"type":"enum","default":"sea","values":{"sea":1,"ground":1},"expression":1}},"paint_raster-particle":{"raster-particle-array-band":{"type":"string"},"raster-particle-count":{"type":"number","default":512,"minimum":1},"raster-particle-color":{"type":"color","expression":{"interpolated":1,"parameters":["raster-particle-speed"]},"use-theme":1},"raster-particle-max-speed":{"type":"number","default":1,"minimum":1},"raster-particle-speed-factor":{"type":"number","default":0.2,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"raster-particle-fade-opacity-factor":{"type":"number","default":0.98,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"raster-particle-reset-rate-factor":{"type":"number","default":0.8,"minimum":0,"maximum":1},"raster-particle-elevation":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1}},"paint_hillshade":{"hillshade-illumination-direction":{"type":"number","default":335,"minimum":0,"maximum":359,"expression":{"interpolated":1,"parameters":["zoom"]}},"hillshade-illumination-anchor":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"hillshade-exaggeration":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"hillshade-shadow-color":{"type":"color","default":"#000000","expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1,"use-theme":1},"hillshade-highlight-color":{"type":"color","default":"#FFFFFF","expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1,"use-theme":1},"hillshade-accent-color":{"type":"color","default":"#000000","expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1,"use-theme":1},"hillshade-emissive-strength":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1}},"paint_background":{"background-pitch-alignment":{"type":"enum","default":"map","values":{"map":1,"viewport":1},"expression":{"parameters":[]}},"background-color":{"type":"color","default":"#000000","expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1,"use-theme":1},"background-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom"]}},"background-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"background-emissive-strength":{"type":"number","default":0,"minimum":0,"expression":{"interpolated":1,"parameters":["measure-light","zoom"]},"transition":1}},"paint_sky":{"sky-type":{"type":"enum","default":"atmosphere","values":{"gradient":1,"atmosphere":1},"expression":{"parameters":["zoom"]}},"sky-atmosphere-sun":{"type":"array","minimum":[0,0],"maximum":[360,180],"length":2,"value":"number","expression":{"parameters":["zoom"]}},"sky-atmosphere-sun-intensity":{"type":"number","default":10,"minimum":0,"maximum":100},"sky-gradient-center":{"type":"array","default":[0,0],"minimum":[0,0],"maximum":[360,180],"length":2,"value":"number","expression":{"parameters":["zoom"]}},"sky-gradient-radius":{"type":"number","default":90,"minimum":0,"maximum":180,"expression":{"parameters":["zoom"]}},"sky-gradient":{"type":"color","default":["interpolate",["linear"],["sky-radial-progress"],0.8,"#87ceeb",1,"white"],"expression":{"interpolated":1,"parameters":["sky-radial-progress"]},"use-theme":1},"sky-atmosphere-halo-color":{"type":"color","default":"white","use-theme":1},"sky-atmosphere-color":{"type":"color","default":"white","use-theme":1},"sky-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1}},"paint_model":{"model-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state","zoom"]},"transition":1,"property-type":"data-driven"},"model-rotation":{"type":"array","default":[0,0,0],"length":3,"value":"number","expression":{"interpolated":1,"parameters":["feature","feature-state","zoom"]},"transition":1,"property-type":"data-driven"},"model-scale":{"type":"array","default":[1,1,1],"length":3,"value":"number","expression":{"interpolated":1,"parameters":["feature","feature-state","zoom"]},"transition":1,"property-type":"data-driven"},"model-translation":{"type":"array","default":[0,0,0],"length":3,"value":"number","expression":{"interpolated":1,"parameters":["feature","feature-state","zoom"]},"transition":1,"property-type":"data-driven"},"model-color":{"type":"color","default":"#ffffff","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":1,"use-theme":1,"property-type":"data-driven"},"model-color-mix-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light"]},"transition":1,"property-type":"data-driven"},"model-type":{"type":"enum","default":"common-3d","values":{"common-3d":1,"location-indicator":1}},"model-cast-shadows":{"type":"boolean","default":true},"model-receive-shadows":{"type":"boolean","default":true},"model-ambient-occlusion-intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["zoom"]},"transition":1},"model-emissive-strength":{"type":"number","default":0,"minimum":0,"maximum":5,"expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light"]},"transition":1,"property-type":"data-driven"},"model-roughness":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":1,"parameters":["feature","feature-state"]},"transition":1,"property-type":"data-driven"},"model-height-based-emissive-strength-multiplier":{"type":"array","default":[1,1,1,1,0],"length":5,"value":"number","expression":{"interpolated":1,"parameters":["feature","feature-state","measure-light"]},"transition":1,"property-type":"data-driven"},"model-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":1},"model-front-cutoff":{"type":"array","default":[0,0,1],"minimum":[0,0,0],"maximum":[1,1,1],"length":3,"value":"number","expression":{"interpolated":1,"parameters":["zoom"]}},"model-elevation-reference":{"type":"enum","default":"ground","values":{"sea":1,"ground":1,"hd-road-markup":1},"expression":1},"model-line-cutout-mode":{"type":"enum","default":"enabled","values":{"enabled":1,"disabled":1,"enabled-above-cutout":1},"expression":1}},"promoteId":{"*":{"type":"*"}}}');function 
1oG(i){return i instanceof Number||i instanceof String||i instanceof Boolean?i.valueOf():i}function oZ(i){if(Array.isArray(i))return i.map(oZ);if(i instanceof Object&&!(i instanceof Number||i instanceof String||i instanceof Boolean)){let r={};for(let a in i)r[a]=oZ(i[a]);return r}return oG(i)}function o$(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(!o$(r)&&"boolean"!=typeof r)return!1;return!0;default:return!0}}function oH(i,r="",a=null,n="fill"){if(null==i)return{filter:()=>!0,needGeometry:!1,needFeature:!1};o$(i)||(i=function i(r){if(!r)return!0;let a=r[0];return r.length<=1?"any"!==a:"=="===a?oY(r[1],r[2],"=="):"!="===a?oQ(oY(r[1],r[2],"==")):"<"===a||">"===a||"<="===a||">="===a?oY(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(oQ)):"in"===a?oK(r[1],r.slice(2)):"!in"===a?oQ(oK(r[1],r.slice(2))):"has"===a?oJ(r[1]):"!has"!==a||oQ(oJ(r[1]))}(i));let o=i,s=!0;try{s=function(i){if(!oq(i))return i;let r=oZ(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||oq(r[i]),n.push(r[i+1]);n.push(r.at(-1))}else if("match"===r[0]){a=a||oq(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||oq(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(oW.has(i[0])){for(let r=1;r<i.length;r++)if(oq(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=nN(s,h=oj[`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=nN(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=!ar(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 oq(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(oq(i[r]))return!0;return!1}let oW=new Set(["in","==","!=",">",">=","<","<=","to-boolean"]);function oX(i,r){return i<r?-1:+(i>r)}function oY(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 oK(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(oX)]]:["filter-in-small",i,["literal",r]]}}function oJ(i){switch(i){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",i]}}function oQ(i){return["!",i]}function o0(i,r){return r?`${i}�${r}`:i}function o1(i){let r=i.indexOf("\x1f");return r>=0?i.slice(r+1):""}let o2,o3=1,o5=()=>o2||(o2=new oU({"icon-size":new oN(oj.layout_symbol["icon-size"]),"icon-image":new oN(oj.layout_symbol["icon-image"]),"icon-rotate":new oN(oj.layout_symbol["icon-rotate"]),"icon-offset":new oN(oj.layout_symbol["icon-offset"]),"text-size":new oN(oj.layout_symbol["text-size"]),"text-rotate":new oN(oj.layout_symbol["text-rotate"]),"text-offset":new oN(oj.layout_symbol["text-offset"])})),o4=()=>m||(m=new oU({"icon-opacity":new oN(oj.paint_symbol["icon-opacity"]),"icon-occlusion-opacity":new oN(oj.paint_symbol["icon-occlusion-opacity"]),"icon-emissive-strength":new oN(oj.paint_symbol["icon-emissive-strength"]),"text-emissive-strength":new oN(oj.paint_symbol["text-emissive-strength"]),"icon-color":new oN(oj.paint_symbol["icon-color"]),"icon-halo-color":new oN(oj.paint_symbol["icon-halo-color"]),"icon-halo-width":new oN(oj.paint_symbol["icon-halo-width"]),"icon-halo-blur":new oN(oj.paint_symbol["icon-halo-blur"]),"icon-translate":new oN(oj.paint_symbol["icon-translate"]),"text-opacity":new oN(oj.paint_symbol["text-opacity"]),"text-occlusion-opacity":new oN(oj.paint_symbol["text-occlusion-opacity"]),"text-color":new oN(oj.paint_symbol["text-color"],{runtimeType:rd,getOverride:i=>i.textColor,hasOverride:i=>!!i.textColor}),"text-halo-color":new oN(oj.paint_symbol["text-halo-color"]),"text-halo-width":new oN(oj.paint_symbol["text-halo-width"]),"text-halo-blur":new oN(oj.paint_symbol["text-halo-blur"]),"text-translate":new oN(oj.paint_symbol["text-translate"]),"symbol-z-offset":new oN(oj.paint_symbol["symbol-z-offset"]),"placement-priority":new oN(oj.paint_symbol["placement-priority"]),"placement-group":new oN(oj.paint_symbol["placement-group"]),"icon-color-use-theme":new oN({type:"string",default:"default","property-type":"data-driven"}),"icon-halo-color-use-theme":new oN({type:"string",default:"default","property-type":"data-driven"}),"text-color-use-theme":new oN({type:"string",default:"default","property-type":"data-driven"}),"text-halo-color-use-theme":new oN({type:"string",default:"default","property-type":"data-driven"})}));class o6{constructor(i,r,a,n,o,s){this._conditionSpec=i,this._propertiesSpec=a;let l=nN(i,oj.appearance.condition);if("success"===l.result&&(this.condition=l.value),this.name=r,a)for(let i in this.layoutProperties=new oB(o5()),this.unevaluatedLayout=new oF(o5(),n,o,s),this.paintProperties=new oB(o4()),this.unevaluatedPaint=new oF(o4(),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={...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 o8="-transition",o9=new Set(["fill","line","background","hillshade","raster"]);class o7 extends i3{constructor(i,r,a,n,o,s){if(super(),this.id=i.id,this.fqid=o0(this.id,a),this.runtimeLayerUID=o3++,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,"custom"!==i.type&&(this.metadata=i.metadata,this.minzoom=i.minzoom,this.maxzoom=i.maxzoom,i.type&&"background"!==i.type&&"sky"!==i.type&&"slot"!==i.type&&"placement-group"!==i.type&&(this.source=i.source,this.sourceLayer=i["source-layer"],this.filter=i.filter),i.slot&&(this.slot=i.slot),i.appearances&&this.setAppearances(i.appearances),r.layout&&(this._unevaluatedLayout=new oF(r.layout,this.scope,o,this.iconImageUseTheme)),r.paint)){for(let a in this._transitionablePaint=new oD(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._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new oB(r.paint)}}onAdd(i){}onRemove(i){}placeSymbols(i,r,a,n,o){}isDraped(i){return!this.is3D(!0)&&o9.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),"visibility"===i&&this.possiblyEvaluateVisibility())}setAppearances(i){this.appearances=[],i.forEach(i=>{this.appearances.push(new o6(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(o8)?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(o8)){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._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}
7isHidden(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)}serialize(){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())),tR(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}mayUse(i){return!1}prepare(){return Promise.resolve()}isSky(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}hasShadowPass(){return!1}canCastShadows(){return!1}hasLightBeamPass(){return!1}cutoffRange(){return 0}tileCoverLift(){return 0}resize(){}_clear(){}isStateDependent(){for(let i in this.paint._values){let r=this.paint.get(i);if(r instanceof oO&&nI(r.property.specification)&&("source"===r.value.kind||"composite"===r.value.kind)&&r.value.isStateDependent)return!0}for(let i of this.appearances)if(!aa(i.condition.expression))return!0;return!1}compileFilter(i){this._filterCompiled||(this._featureFilter=oH(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){}}function se(i,r,a){if(!i._unevaluatedLayout)return!1;let n=i._unevaluatedLayout.getValue(r);return void 0!==n&&("string"!=typeof n||a(n))}function st(i,r,a=2){let n,o,s,l=r&&r.length,h=l?r[0]*a:i.length,u=si(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=si(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(sa);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(sh(i,a))return a;do{if(sh(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&&so(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);sp(a,i)&&(r<d||r===d&&(a.x>s.x||a.x===s.x&&(p=s,f=a,0>sl(p.prev,p,f.prev)&&0>sl(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=sf(a,i);return sr(n,n.next),sr(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;s<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=sn(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;
7for(;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(sl(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=sn(f,m,r,a,n),x=sn(_,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&&ss(l,c,h,d,u,p,v.x,v.y)&&sl(v.prev,v,v.next)>=0||(v=v.prevZ,b.x>=f&&b.x<=_&&b.y>=m&&b.y<=g&&b!==o&&b!==s&&ss(l,c,h,d,u,p,b.x,b.y)&&sl(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&&ss(l,c,h,d,u,p,v.x,v.y)&&sl(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&&ss(l,c,h,d,u,p,b.x,b.y)&&sl(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(sl(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&&ss(n,l,o,h,s,u,m.x,m.y)&&sl(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}(r))a.push(c.i,r.i,d.i),s_(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;!sh(n,o)&&su(n,a,a.next,o)&&sp(n,o)&&sp(o,n)&&(r.push(n.i,a.i,o.i),s_(a),s_(a.next),a=i=o),a=a.next}while(a!==i);return sr(a)}(sr(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&&su(a,a.next,i,r))return!0;a=a.next}while(a!==i);return!1}(u,c)&&(sp(u,c)&&sp(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)&&(sl(u.prev,u,c.prev)||sl(u,c.prev,c))||sh(u,c)&&sl(u.prev,u,u.next)>0&&sl(c.prev,c,c.next)>0))){let u=sf(h,r);return h=sr(h,h.next),u=sr(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(sr(r),a,n,o,s,l,1);break}}}(u,c,a,n,o,s,0),c}function si(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=sm(o/n|0,i[o],i[o+1],s);else for(let o=a-n;o>=r;o-=n)s=sm(o/n|0,i[o],i[o+1],s);return s&&sh(s,s.next)&&(s_(s),s=s.next),s}function sr(i,r){if(!i)return i;r||(r=i);let a,n=i;do if(a=!1,n.steiner||!sh(n,n.next)&&0!==sl(n.prev,n,n.next))n=n.next;else{if(s_(n),(n=r=n.prev)===n.next)break;a=!0}while(a||n!==r);return r}function sa(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 sn(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 so(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 ss(i,r,a,n,o,s,l,h){return(i!==l||r!==h)&&so(i,r,a,n,o,s,l,h)}function sl(i,r,a){return(r.y-i.y)*(a.x-r.x)-(r.x-i.x)*(a.y-r.y)}function sh(i,r){return i.x===r.x&&i.y===r.y}function su(i,r,a,n){let o=sd(sl(i,r,a)),s=sd(sl(i,r,n)),l=sd(sl(a,n,i)),h=sd(sl(a,n,r));return o!==s&&l!==h||!(0!==o||!sc(i,a,r))||!(0!==s||!sc(i,n,r))||!(0!==l||!sc(a,i,n))||!(0!==h||!sc(a,r,n))}function sc(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 sd(i){return i>0?1:i<0?-1:0}function sp(i,r){return 0>sl(i.prev,i,i.next)?sl(i,r,i.next)>=0&&sl(i,i.prev,r)>=0:0>sl(i,r,i.prev)||0>sl(i,i.next,r)}function sf(i,r){let a=sg(i.i,i.x,i.y),n=sg(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 sm(i,r,a,n){let o=sg(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 s_(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 sg(i,r,a){return{i:i,x:r,y:a,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function sy(i,r,a=1){if(!i)return null;let n="string"==typeof i?rM.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 sx(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),sy(r.constantOr(null),o,a)&&(s=!0)}return s}function sv(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=sy(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}let sb=8192/Math.PI/2,sw=[64,32,16],sT=-sb;function sS(i,r,a,n=sb){return[i*Math.sin(a*=tf)*n,-r*n,i*Math.cos(a)*n]}function sE(i,r,a){return sS(Math.cos(i*tf),Math.sin(i*tf),r,a)}let sI=2*Math.PI*6371008.8;class sA{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 sA(tw(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 sM({lng:this.lng-a,lat:this.lat-r},{lng:this.lng+a,lat:this.lat+r})}toEcef(i){return sE(this.lat,this.lng,sb+i*sb/6371008.8)}static convert(i){if(i instanceof sA)return i;if(Array.isArray(i)&&(2===i.length||3===i.length))return new sA(Number(i[0]),Number(i[1]));if(!Array.isArray(i)&&"object"==typeof i&&null!==i)return new sA(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 sM{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 sA?new sA(i.lng,i.lat):sA.convert(i),this}setSouthWest(i){return this._sw=i instanceof sA?new sA(i.lng,i.lat):sA.convert(i),this}extend(i){let r,a,n=this._sw,o=this._ne;if(i instanceof sA)r=i,a=i;else{if(!(i instanceof sM))return Array.isArray(i)?4===i.length||i.every(Array.isArray)?this.extend(sM.convert(i)):this.extend(sA.convert(i)):"object"==typeof i&&null!==i&&Object.hasOwn(i,"lat")&&(Object.hasOwn(i,"lon")||Object.hasOwn(i,"lng"))?this.extend(sA.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 sA(r.lng,r.lat),this._ne=new sA(a.lng,a.lat)),this}getCenter(){return new sA((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}
7getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new sA(this.getWest(),this.getNorth())}getSouthEast(){return new sA(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}=sA.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 sM?i:new sM(i)}}function sC(i){return sI*Math.cos(i*Math.PI/180)}function sP(i,r){return i*sC(r0(r))}function sR(i){return Math.cos(tv(i,-85.051129,85.051129)*tf)}function sD(i,r){let a=Math.pow(2,tv(r,0,25.5));return sR(i)*sI/(512*a)}function sL(i){return 1/Math.cos(i*Math.PI/180)}function sz(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 sF{constructor(i,r,a=0){this.x=+i,this.y=+r,this.z=+a}static fromLngLat(i,r=0){let a=sA.convert(i);return new sF(rK(a.lng),rJ(a.lat),r/sC(a.lat))}toLngLat(){return new sA(rQ(this.x),r0(this.y))}toAltitude(){return sP(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/sI*sL(r0(this.y))}}function sO(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 tr(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 sB=-16383-1;function sk(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=rQ((r.x+i.x/o)/s),n=r0((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]=sO(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=tv(i,sB,16383),l.y=tv(a,sB,16383),(i<l.x||i>l.x+1||a<l.y||a>l.y+1)&&tF("Geometry exceeds allowed extent, reduce your vector tile buffer size")}return n}function sN(i,r){return{type:i.type,id:i.id,properties:i.properties,geometry:r?sk(i):[]}}let sV={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class sU{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 sj=new ArrayBuffer(0);class sG{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=sj),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}resizeExact(i){this.reserveExact(i),this.length=i}reserve(i){i>this.capacity&&this._allocate(Math.max(i,Math.floor(5*this.capacity),128))}reserveExact(i){(i>this.capacity||!this.arrayBuffer)&&this._allocate(i)}_allocate(i){this._reallocCount++,this.capacity=i,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 sZ(i,r=1){let a=0,n=0;return{members:i.map(i=>{let o=sV[i.type].BYTES_PER_ELEMENT,s=a=s$(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,normalized:i.normalized}}),size:s$(a,Math.max(n,r)),alignment:r}}function s$(i,r){return Math.ceil(i/r)*r}class sH extends sG{_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}}
7sH.prototype.bytesPerElement=4,nH(sH,"StructArrayLayout2i4");class sq extends sG{_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}}sq.prototype.bytesPerElement=6,nH(sq,"StructArrayLayout3i6");class sW extends sG{_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}}sW.prototype.bytesPerElement=8,nH(sW,"StructArrayLayout2i2ui8");class sX extends sG{_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}}sX.prototype.bytesPerElement=4,nH(sX,"StructArrayLayout1f4");class sY extends sG{_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}}sY.prototype.bytesPerElement=8,nH(sY,"StructArrayLayout2i1f8");class sK extends sG{_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}}sK.prototype.bytesPerElement=8,nH(sK,"StructArrayLayout3i8");class sJ extends sG{_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}}sJ.prototype.bytesPerElement=8,nH(sJ,"StructArrayLayout4i8");class sQ extends sG{_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}}sQ.prototype.bytesPerElement=10,nH(sQ,"StructArrayLayout5i10");class s0 extends sG{_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}}s0.prototype.bytesPerElement=12,nH(s0,"StructArrayLayout2i4ub1f12");class s1 extends sG{_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}}s1.prototype.bytesPerElement=12,nH(s1,"StructArrayLayout3f12");class s2 extends sG{_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}}s2.prototype.bytesPerElement=12,nH(s2,"StructArrayLayout4ui1f12");class s3 extends sG{_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}}s3.prototype.bytesPerElement=8,nH(s3,"StructArrayLayout4ui8");class s5 extends sG{_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}}s5.prototype.bytesPerElement=12,nH(s5,"StructArrayLayout6i12");class s4 extends sG{_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}}s4.prototype.bytesPerElement=24,nH(s4,"StructArrayLayout4i4ui4i24");class s6 extends sG{_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}}s6.prototype.bytesPerElement=20,nH(s6,"StructArrayLayout3i3f20");class s8 extends sG{_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}}s8.prototype.bytesPerElement=16,nH(s8,"StructArrayLayout4f16");class s9 extends sG{_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}}
7s9.prototype.bytesPerElement=4,nH(s9,"StructArrayLayout1ul4");class s7 extends sG{_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}}s7.prototype.bytesPerElement=4,nH(s7,"StructArrayLayout2ui4");class le extends sG{_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}}le.prototype.bytesPerElement=40,nH(le,"StructArrayLayout5i4f1i1ul2ui40");class lt extends sG{_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}}lt.prototype.bytesPerElement=16,nH(lt,"StructArrayLayout3i2i2i16");class li extends sG{_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}}li.prototype.bytesPerElement=16,nH(li,"StructArrayLayout2f1f2i16");class lr extends sG{_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}}lr.prototype.bytesPerElement=20,nH(lr,"StructArrayLayout2ub4f20");class la extends sG{_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}}la.prototype.bytesPerElement=6,nH(la,"StructArrayLayout3ui6");class ln extends sG{_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}}ln.prototype.bytesPerElement=60,nH(ln,"StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60");class lo extends sG{_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,R,D,L,z){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,R,D,L,z)}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,R,D,L,z,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]=R,this.float32[O+17]=D,this.float32[O+18]=L,this.uint8[80*i+76]=z,this.uint16[B+39]=F,i}}lo.prototype.bytesPerElement=80,nH(lo,"StructArrayLayout2f9i15ui1ul4f1ub1ui80");class ls extends sG{_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}}ls.prototype.bytesPerElement=24,nH(ls,"StructArrayLayout6f24");class ll extends sG{_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}}ll.prototype.bytesPerElement=20,nH(ll,"StructArrayLayout5f20");class lh extends sG{_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}}lh.prototype.bytesPerElement=28,nH(lh,"StructArrayLayout7f28");class lu extends sG{_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}}lu.prototype.bytesPerElement=44,nH(lu,"StructArrayLayout11f44");class lc extends sG{_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}}lc.prototype.bytesPerElement=36,nH(lc,"StructArrayLayout9f36");class ld extends sG{_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}}ld.prototype.bytesPerElement=8,nH(ld,"StructArrayLayout2f8");class lp extends sG{_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}}lp.prototype.bytesPerElement=12,nH(lp,"StructArrayLayout1ul3ui12");class lf extends sG{_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}}lf.prototype.bytesPerElement=2,nH(lf,"StructArrayLayout1ui2");class lm extends sG{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int8=new Int8Array(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.int8[s+0]=r,this.int8[s+1]=a,this.int8[s+2]=n,this.int8[s+3]=o,i}}
7lm.prototype.bytesPerElement=4,nH(lm,"StructArrayLayout4b4");class l_ extends sG{_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}}l_.prototype.bytesPerElement=64,nH(l_,"StructArrayLayout16f64");class lg extends sG{_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}}lg.prototype.bytesPerElement=2,nH(lg,"StructArrayLayout1i2");class ly extends sG{_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}}ly.prototype.bytesPerElement=1,nH(ly,"StructArrayLayout1ub1");class lx extends sU{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]}}lx.prototype.size=40;class lv extends le{get(i){return new lx(this,i)}}nH(lv,"CollisionBoxArray");class lb extends sU{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.float32[this._pos4+2]}get tileAnchorY(){return this._structArray.float32[this._pos4+3]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+8]}get numGlyphs(){return this._structArray.uint16[this._pos2+9]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+5]}get lineStartIndex(){return this._structArray.uint32[this._pos4+6]}get lineLength(){return this._structArray.uint32[this._pos4+7]}get segment(){return this._structArray.uint16[this._pos2+16]}get lowerSize(){return this._structArray.uint16[this._pos2+17]}get upperSize(){return this._structArray.uint16[this._pos2+18]}get lineOffsetX(){return this._structArray.float32[this._pos4+10]}get lineOffsetY(){return this._structArray.float32[this._pos4+11]}get writingMode(){return this._structArray.uint8[this._pos1+48]}get placedOrientation(){return this._structArray.uint8[this._pos1+49]}set placedOrientation(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}}lb.prototype.size=60;class lw extends ln{get(i){return new lb(this,i)}}nH(lw,"PlacedSymbolArray");class lT extends sU{get tileAnchorX(){return this._structArray.float32[this._pos4+0]}get tileAnchorY(){return this._structArray.float32[this._pos4+1]}get projectedAnchorX(){return this._structArray.int16[this._pos2+4]}get projectedAnchorY(){return this._structArray.int16[this._pos2+5]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+6]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+7]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+8]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+9]}
vendor: 4,661 bytes, line 7
7get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+10]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+11]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+12]}get key(){return this._structArray.uint16[this._pos2+13]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+14]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+15]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+16]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+17]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+18]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+19]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+20]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+21]}get featureIndex(){return this._structArray.uint16[this._pos2+22]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+23]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+24]}get numIconVertices(){return this._structArray.uint16[this._pos2+25]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+26]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+27]}get crossTileID(){return this._structArray.uint32[this._pos4+14]}set crossTileID(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]}}lT.prototype.size=80;class lS extends lo{get(i){return new lT(this,i)}}nH(lS,"SymbolInstanceArray");class lE extends sX{getoffsetX(i){return this.float32[+i+0]}}nH(lE,"GlyphOffsetArray");class lI extends sH{getx(i){return this.int16[2*i+0]}gety(i){return this.int16[2*i+1]}}nH(lI,"SymbolLineVertexArray");class lA extends sU{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]}}lA.prototype.size=12;class lM extends lp{get(i){return new lA(this,i)}}nH(lM,"FeatureIndexArray");class lC extends s7{geta_centroid_pos0(i){return this.uint16[2*i+0]}geta_centroid_pos1(i){return this.uint16[2*i+1]}}nH(lC,"FillExtrusionCentroidArray");class lP extends sU{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]}}lP.prototype.size=6;class lR extends sq{get(i){return new lP(this,i)}}nH(lR,"FillExtrusionWallArray");let lD=sZ([{name:"a_pos",components:2,type:"Int16"}],4),lL=sZ([{name:"a_road_z_offset",components:1,type:"Float32"}],4),lz=sZ([{name:"a_pos",components:2,type:"Int16"},{name:"a_height",components:1,type:"Float32"}],4),lF=sZ([{name:"a_pos_normal_3",components:3,type:"Int16"}],4);class lO{constructor(i=[]){this.segments=i}_prepareSegment(i,r,a,n,o){let s=this.segments.at(-1);return i>lO.MAX_VERTEX_ARRAY_LENGTH&&tF(`Max vertices per segment is ${lO.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${i}`),(!s||s.vertexLength+i>lO.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 lO([{vertexOffset:i,primitiveOffset:r,vertexLength:a,primitiveLength:n,vaos:{},sortKey:0}])}}function lB(i,r){return 256*(i=tv(Math.floor(i),0,255))+tv(Math.floor(r),0,255)}lO.MAX_VERTEX_ARRAY_LENGTH=65535,nH(lO,"SegmentVector");let lk=sZ([{name:"a_pattern",components:4,type:"Uint16"},{name:"a_pixel_ratio",components:1,type:"Float32"}]),lN=sZ([{name:"a_pattern_b",components:4,type:"Uint16"}]),lV=sZ([{name:"a_dash",components:4,type:"Uint16"}]);class lU{constructor(){this.ids=[],this.uniqueIds=[],this.positions=[],this.indexed=!1}
7add(i,r,a,n){this.ids.push(lj(i)),this.positions.push(r,a,n)}eachPosition(i,r){let a=lj(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;lG(r,l,h),lG(a,3*l,3*h),lG(a,3*l+1,3*h+1),lG(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 lU;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 lj(i){let r=+i;return Number.isSafeInteger(r)?r:iJ(String(i))}function lG(i,r,a){let n=i[r];i[r]=i[a],i[a]=n}nH(lU,"FeaturePositionMap");class lZ{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 l$ extends lZ{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 lH extends lZ{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 lq extends lZ{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 lW extends lZ{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 lX extends lZ{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 lY extends lZ{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 lK extends lZ{constructor(i){super(i),this.current=re.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 lJ extends lZ{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 lQ extends lZ{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 l0(i){return[lB(255*i.r,255*i.g),lB(255*i.b,255*i.a)]}function l1(i,r,a,n,o,s,l,h){return!!i&&("composite"===i.kind||"source"===i.kind?"none"===i.evaluate(new oC(0,{brightness:s,worldview:h}),r,a,o,n,l):"none"===i.value)}class l2{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 re?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 lK(i):new lH(i)}}class l3{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 lX(i):new lH(i)}}class l5{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 oC(0,{brightness:s,worldview:h}),r,{},o,n,l):"constant"===this.expression.kind&&this.expression.value,d=l1(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=l1(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=l0(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 l4{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 oC(this.context.zoom,{brightness:s,worldview:h}),r,{},o,n,l),c=this.expression.evaluate(new oC(this.context.zoom+1,{brightness:s,worldview:h}),r,{},o,n,l),d=l1(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=l1(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=l0(a.toPremultipliedRenderColor(o)),l=l0(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=tv(this.expression.interpolationFactor(s,this.context.zoom,this.context.zoom+1),0,1);r.set(i,o,l)}getBinding(i,r){return new lH(i)}}class l6{constructor(i,r,a,n,o){this.expression=i,this.layerId=o,this.paintVertexAttributes=("array"===a?lV:lk).members;for(let i=0;i<r.length;++i);this.paintVertexArray=new n,this.paintTransitionVertexArray=new s3}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,lN.members,r))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy(),this.paintTransitionVertexBuffer&&this.paintTransitionVertexBuffer.destroy()}}class l8{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 oO&&nI(s.property.specification)))continue;let l=function(i,r){return l7[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=hi(o,u,"source");this.binders[o]=d?new l6(h,l,u,r,i.id):new l5(h,l,u,r),n.push(`/a_${o}`)}else{let i=hi(o,u,"composite");this.binders[o]=new l4(h,l,u,c,r,i),n.push(`/z_${o}`)}else this.binders[o]=d?new l3(h.value,l):new l2(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 l5||a instanceof l4||a instanceof l6)&&(a.expression=i.paint.get(r).value)}}getMaxValue(i){let r=this.binders[i];return r instanceof l5||r instanceof l4?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 l5||c instanceof l4||c instanceof l6)&&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 l3&&n.setConstantPatternPositions(i,r)}}getPatternTransitionVertexBuffer(i){let r=this.binders[i];return r instanceof l6?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 l5||p instanceof l4||p instanceof l6)&&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 l2||a instanceof l3)&&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 l2||n instanceof l3||n instanceof l4)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 l5||r instanceof l4||r instanceof l6)&&r.paintVertexBuffer&&this._buffers.push(r.paintVertexBuffer),r instanceof l6&&r.paintTransitionVertexBuffer&&this._buffers.push(r.paintTransitionVertexBuffer)}}upload(i){for(let r in this.binders){let a=this.binders[r];(a instanceof l5||a instanceof l4||a instanceof l6)&&a.upload(i)}this.updatePaintBuffers()}destroy(){for(let i in this.binders){let r=this.binders[i];(r instanceof l5||r instanceof l4||r instanceof l6)&&r.destroy()}}}class l9{constructor(i,r,a=()=>!0){for(let n of(this.programConfigurations={},i))this.programConfigurations[n.id]=new l8(n,r,a);this.needsUpload=!1,this._featureMap=new lU,this._featureMapWithoutIds=new lU,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 l7={"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"]},he={"line-pattern":{source:s2,composite:s2},"fill-pattern":{source:s2,composite:s2},"fill-extrusion-pattern":{source:s2,composite:s2},"line-dasharray":{source:s3,composite:s3}},ht={color:{source:ld,composite:s8},number:{source:sX,composite:ld}};function hi(i,r,a){let n=he[i];return n&&n[a]||ht[r][a]}nH(l2,"ConstantBinder"),nH(l3,"PatternConstantBinder"),nH(l5,"SourceExpressionBinder",{omit:["expression"]}),nH(l6,"PatternCompositeBinder",{omit:["expression"]}),nH(l4,"CompositeExpressionBinder",{omit:["expression"]}),nH(l8,"ProgramConfiguration",{omit:["_buffers"]}),nH(l9,"ProgramConfigurationSet");class hr{constructor(i,r,a){this.layoutVertexArray=new sH,this.indexArray=new la,this.lineIndexArray=new s7,this.triangleSegments=new lO,this.lineSegments=new lO,this.programConfigurations=new l9(i,{zoom:r,lut:a}),this.uploaded=!1}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,lD.members),this.indexBuffer=i.createIndexBuffer(this.indexArray),this.lineIndexBuffer=i.createIndexBuffer(this.lineIndexArray)),this.programConfigurations.upload(i),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.lineIndexBuffer.destroy(),this.programConfigurations.destroy(),this.triangleSegments.destroy(),this.lineSegments.destroy())}populatePaintArrays(i,r,a,n,o,s,l){this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,i,r,a,n,o,s,void 0,l)}}nH(hr,"FillBufferData");class ha{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 hr(i.layers,i.zoom,i.lut),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.projection=i.projection,this.sourceLayerIndex=i.sourceLayerIndex,this.sourceLayerName=i.sourceLayerName||"",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=sx("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=sN(l,i);if(!this.layers[0]._featureFilter.filter(new oC(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:sk(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=sv("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)}!this.hasPattern&&this.hdExt&&this.hdExt.buildFrcSegments(this)}update(i,r,a,n,o,s,l){this.bufferData.update(i,r,a,n,o,s,l,this.worldview),this.hdExt&&this.hdExt.update(i,r,a,n,o,s,l,this.worldview)}updateExpressions(i){this.bufferData.programConfigurations.updateExpressions(i),this.hdExt&&this.hdExt.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);this.hdExt&&this.hdExt.buildFrcSegments(this)}isEmpty(){return this.bufferData.isEmpty()&&(!this.hdExt||this.hdExt.isEmpty())}uploadPending(){return!this.uploaded||this.bufferData.needsUpload()||null!=this.hdExt&&this.hdExt.needsUpload()}upload(i){this.bufferData.upload(i),this.hdExt&&this.hdExt.upload(i)}destroy(){this.bufferData.destroy(),this.hdExt&&this.hdExt.destroy()}
7addFeature(i,r,a,n,o,s=[],l,h){let u=this.hdExt?this.hdExt.trackFeatureFrc(i.properties):null,c=this.bufferData.indexArray.length,d=ts(r,500);null!=this.hdExt&&this.hdExt.handleFeature(i,d,a,n,h,this)||this.addGeometry(d,this.bufferData),this.bufferData.populatePaintArrays(i,a,o,s,n,l,this.worldview),this.hdExt&&this.hdExt.populatePaintArrays(i,a,o,s,n,l,this.worldview),this.hdExt&&this.hdExt.recordFeatureRange(this,c,this.bufferData.indexArray.length,u)}addGeometry(i,r,a,n){let o=1/0,s=-1/0,l=null;a&&null!=(l=a.elevationSampler.constantElevation(a.elevation,a.bias))&&(o=l,s=l);let h=a?r:null,u=(i,r,n)=>{if(null!=a)if(r.push(i),null!=l)h.elevatedLayoutVertexArray.emplaceBack(l),n.push(l);else{let r=a.elevationSampler.pointElevation(i,a.elevation,a.bias);h.elevatedLayoutVertexArray.emplaceBack(r),n.push(r),o=Math.min(o,r),s=Math.max(s,r)}};for(let o of i){let i=0;for(let r of o)i+=r.length;let s=r.triangleSegments.prepareSegment(i,r.layoutVertexArray,r.indexArray),l=s.vertexLength,h=[],c=[],d=[],p=[],f=[],m=r.layoutVertexArray.length;for(let i of o){if(0===i.length)continue;i!==o[0]&&c.push(h.length/2);let n=r.lineSegments.prepareSegment(i.length,r.layoutVertexArray,r.lineIndexArray),s=n.vertexLength;a&&f.push(r.layoutVertexArray.length-m),u(i[0],d,p),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++)u(i[a],d,p),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);n.vertexLength+=i.length,n.primitiveLength+=i.length}let _=st(h,c);for(let i=0;i<_.length;i+=3)r.indexArray.emplaceBack(l+_[i],l+_[i+1],l+_[i+2]);if(_.length>0&&a&&n){let i=a.elevation.isTunnel(),r=a.elevation.safeArea,o=n.addVertices(d,p);n.addTriangles(_,o,i);let s=f.length;if(s>0){for(let l=0;l<s-1;l++)n.addRenderableRing(a.index,f[l]+o,f[l+1]-f[l],i,r,a.featureInfo);n.addRenderableRing(a.index,f[s-1]+o,d.length-f[s-1],i,r,a.featureInfo)}}s.vertexLength+=i,s.primitiveLength+=_.length/3}return[o,s]}}nH(ha,"FillBucket",{omit:["layers","patternFeatures"]});let hn=sZ([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"},{name:"a_linesofar",components:1,type:"Float32"}],4),ho=sZ([{name:"a_z_offset_width",components:4,type:"Float32"}],4),hs=sZ([{name:"a_elevation_id_col",components:3,type:"Float32"}],4),hl=sZ([{name:"a_elevation_ground_scale",components:1,type:"Float32"}],4),{members:hh}=hn,{members:hu}=sZ([{name:"a_packed",components:3,type:"Float32"}]),{members:hc}=sZ([{name:"a_pattern_data",components:3,type:"Float32"}]);class hd{constructor(i,r,a,n,o){for(this.properties=Object.create(null),this.extent=a,this.type=0,this.id=void 0,this._pbf=i,this._geometry=-1,this._keys=n,this._values=o;i.pos<r;){let r=i.readVarint();if(8===r)this.id=i.readVarint();else if(18===r){let r=i.readVarint()+i.pos;for(;i.pos<r;){let r=n[i.readVarint()],a=o[i.readVarint()];this.properties[r]=a}}else 24===r?this.type=i.readVarint():(34===r&&(this._geometry=i.pos),i.skip(r))}}loadGeometry(){if(this._geometry<0)throw Error("feature has no geometry");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();if(o=7&r,0==(s=r>>3))continue}if(s--,1===o)l+=i.readSVarint(),h+=i.readSVarint(),n&&a.push(n),n=[new tr(l,h)];else if(2===o)l+=i.readSVarint(),h+=i.readSVarint(),n&&n.push(new tr(l,h));else{if(7!==o)throw Error(`unknown command ${o}`);n&&n.push(n[0].clone())}}return n&&a.push(n),a}bbox(){if(this._geometry<0)throw Error("feature has no geometry");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();if(a=7&r,0==(n=r>>3))continue}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}}hd.types=["Unknown","Point","LineString","Polygon"];class hp{constructor(i,r){for(this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=i,this._keys=[],this._values=[],this._features=[],void 0===r&&(r=i.length);i.pos<r;){let r=i.readVarint();10===r?this.name=i.readString():18===r?(this._features.push(i.pos),i.skip(r)):26===r?this._keys.push(i.readString()):34===r?this._values.push(function(i){let r=null,a=i.readVarint()+i.pos;for(;i.pos<a;){let a=i.readVarint();r=10===a?i.readString():21===a?i.readFloat():25===a?i.readDouble():32===a?i.readVarint(!0):40===a?i.readVarint():48===a?i.readSVarint():56===a?i.readBoolean():(i.skip(a),null)}if(null==r)throw Error("unknown feature value");return r}(i)):40===r?this.extent=i.readVarint():120===r?this.version=i.readVarint():i.skip(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 hd(this._pbf,r,this.extent,this._keys,this._values)}}class hf{constructor(i,r=i.length){let a=Object.create(null);for(;i.pos<r;){let r=i.readVarint();if(26===r){let r=new hp(i,i.readVarint()+i.pos);r.length&&(a[r.name]=r)}else i.skip(r)}this.layers=a}}function hm(i,r){for(let a=0;a<i.length;a++)if(hw(r,i[a]))return!0;for(let a=0;a<r.length;a++)if(hw(i,r[a]))return!0;return!!hg(i,r)}
7function h_(i,r){if(1===i.length)return hb(r,i[0]);for(let a=0;a<r.length;a++){let n=r[a];for(let r=0;r<n.length;r++)if(hw(i,n[r]))return!0}for(let a=0;a<i.length;a++)if(hb(r,i[a]))return!0;for(let a=0;a<r.length;a++)if(hg(i,r[a]))return!0;return!1}function hg(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;if(a=h,n=u,o=r[i],tO(a,o,s=r[i+1])!==tO(n,o,s)&&tO(a,n,o)!==tO(a,n,s))return!0}}return!1}function hy(i,r,a){return(i.x-a.x)*(r.y-a.y)-(i.y-a.y)*(r.x-a.x)}function hx(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(hv(i,r[a-1],r[a])<n)return!0;return!1}function hv(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 hb(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 hw(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 hT(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 tr(r,a),new tr(r,o),new tr(n,o),new tr(n,a)];if(i.length>2){for(let r of s)if(hw(i,r))return!0}for(let r=0;r<i.length-1;r++)if(hS(i[r],i[r+1],s))return!0;return!1}function hS(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=tO(i,r,a[0]);return s!==tO(i,r,a[1])||s!==tO(i,r,a[2])||s!==tO(i,r,a[3])}function hE(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 hI(i,r,a,n,o,s,l){return!(hE(i,r,n,o,s,l)||hE(r,a,n,o,s,l)||hE(a,i,n,o,s,l)||hE(n,o,i,r,a,l)||hE(o,s,i,r,a,l)||hE(s,n,i,r,a,l))}class hA extends tr{constructor(i,r,a){super(i,r),this.z=a}}class hM extends hA{constructor(i,r,a,n){super(i,r,a),this.w=n}}function hC(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=i9(i.z,r.z,s)),Object.hasOwn(i,"w")&&(i.w=i9(i.w,r.w,s))}function hP(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&&hC(s,l,o,a),s[o]<n&&l[o]>n&&hC(l,s,o,n)}}function hR(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 tr(r,m.y+(r-m.x)/(_.x-m.x)*(_.y-m.y))._round():_.x<r&&(_=new tr(r,m.y+(r-m.x)/(_.x-m.x)*(_.y-m.y))._round()),m.y<a&&_.y<a||(m.y<a?m=new tr(m.x+(a-m.y)/(_.y-m.
7y)*(_.x-m.x),a)._round():_.y<a&&(_=new tr(m.x+(a-m.y)/(_.y-m.y)*(_.x-m.x),a)._round()),m.x>=n&&_.x>=n||(m.x>=n?m=new tr(n,m.y+(n-m.x)/(_.x-m.x)*(_.y-m.y))._round():_.x>=n&&(_=new tr(n,m.y+(n-m.x)/(_.x-m.x)*(_.y-m.y))._round()),m.y>=o&&_.y>=o||(m.y>=o?m=new tr(m.x+(o-m.y)/(_.y-m.y)*(_.x-m.x),o)._round():_.y>=o&&(_=new tr(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+hD(d,f,m)*g,max:1},parentIndex:h,prevPoint:d,nextPoint:f})),u.push(_),s&&(s.at(-1).progress.max=y+hD(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 hD(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 hL(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 hz(i,r,a){let{width:n,height:o}=r;n===i.width&&o===i.height||(hF(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 hF(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 re(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}class hO{constructor(i,r){hL(this,i,1,r)}resize(i){hz(this,new hO(i),1)}clone(){return new hO({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(i,r,a,n,o){hF(i,r,a,n,o,1,null)}}class hB{constructor(i,r){hL(this,i,4,r)}resize(i){hz(this,new hB(i),4)}replace(i,r){r?this.data.set(i):this.data=i instanceof Uint8ClampedArray?new Uint8Array(i.buffer):i}clone(){return new hB({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(i,r,a,n,o,s,l){hF(i,r,a,n,o,4,s,l)}}class hk{constructor(i,r){this.width=i.width,this.height=i.height,this.data=r instanceof Uint8Array?new Float32Array(r.buffer):r}}nH(hO,"AlphaImage"),nH(hB,"RGBAImage");class hN{constructor(i,r){this.width=i,this.height=r,this.nextRow=0,this.image=new hO({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=tA(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))}}
7addDash(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 tF("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&&(tF("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,u=0;if(0!==l){let i=this.width*h;for(let r=0;r<this.width;r++)this.image.data[i+r]>=128&&u++}let c=Math.round(u/this.width*4095);this.nextRow+=s;let d=Math.floor(l),p={tl:[h,o|c<<4],br:[d,Math.round(65535*(l-d))]};return this.positions[a]=p,p}}nH(hN,"LineAtlas");let hV="3d_elevation_id",hU="level",hj=hd.types,hG=Math.cos(Math.PI/180*37.5),hZ=Math.cos(Math.PI/180*5);class h${constructor(i){this.evaluationGlobals={zoom:0,lineProgress:void 0},this.elevationType="none",this.isSeaLevelReference=!1,this.showElevationIdDebug=!1,this.terrainEnabled=!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.borderGradients={},this.layers.forEach(i=>{this.gradients[i.id]={},this.borderGradients[i.id]={}}),this.layoutVertexArray=new s0,this.layoutVertexArray2=new s1,this.patternVertexArray=new s1,this.indexArray=new la,this.programConfigurations=new l9(i.layers,{zoom:i.zoom,lut:i.lut}),this.segments=new lO,this.sourceLayerName=i.sourceLayerName||"",this.maxLineLength=0,this.zOffsetVertexArray=new s8,this.elevationIdColVertexArray=new s1,this.elevationGroundScaleVertexArray=new sX,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.terrainEnabled=r.terrainEnabled,this.hasPattern=sx("line",this.layers,this.pixelRatio,r);let o=this.layers[0].layout.get("line-sort-key");this.tileToMeter=sz(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&&tF(`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=sN(s,i);if(!this.layers[0]._featureFilter.filter(new oC(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:sk(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=sv("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,r.elevationParams,r.crossSourceElevationEnabled);c.insert(i[s].feature,o,s,l,this.index)}!this.hasPattern&&this.hdExt&&this.hdExt.buildFrcSegments(this),this.hdExt&&this.hdExt.endPopulate()}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,i.elevationParams,i.crossSourceElevationEnabled);this.hdExt&&(this.hdExt.buildFrcSegments(this),this.hdExt.endPopulate())}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,hu)),0!==this.patternVertexArray.length&&(this.patternVertexBuffer=i.createVertexBuffer(this.patternVertexArray,hc)),!this.zOffsetVertexBuffer&&this.zOffsetVertexArray.length>0&&(this.zOffsetVertexBuffer=i.createVertexBuffer(this.zOffsetVertexArray,ho.members,!0)),!this.elevationIdColVertexBuffer&&this.elevationIdColVertexArray.length>0&&(this.elevationIdColVertexBuffer=i.createVertexBuffer(this.elevationIdColVertexArray,hs.members,!0)),!this.elevationGroundScaleVertexBuffer&&this.elevationGroundScaleVertexArray.length>0&&(this.elevationGroundScaleVertexBuffer=i.createVertexBuffer(this.elevationGroundScaleVertexArray,hl.members,!0)),this.layoutVertexBuffer=i.createVertexBuffer(this.layoutVertexArray,hh),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,u,c){let d=this.layers[0].layout,p=this.hdExt?this.hdExt.trackFeatureFrc(i.properties):null,f=this.indexArray.length,m=d.get("line-join").evaluate(i,{}),_=d.get("line-cap").evaluate(i,{}),g=d.get("line-miter-limit"),y=d.get("line-round-limit");this.lineClips=this.lineFeatureClips(i),this.lineFeature=i;let x=!(!i.properties||!Object.hasOwn(i.properties,"mapbox_line_metrics"))&&i.properties.mapbox_line_metrics;this.zOffsetValue=d.get("line-z-offset").value;let v=this.layers[0].paint,b=v.get("line-width").value;"constant"!==b.kind&&!1===b.isLineProgressConstant&&(this.variableWidthValue=b);let w=v.get("line-emissive-strength").value;if("constant"!==w.kind&&!1===w.isLineProgressConstant&&(this.variableEmissiveStrengthValue=w),this.isSeaLevelReference){let i=d.get("line-elevation-ground-scale").value;"constant"===i.kind&&0===i.value||(this.elevationGroundScaleValue=i)}
7if(null==this.hdExt||!this.hdExt.handleFeature(i,r,n,h,u,!!c,m,_,g,y,this))for(let a=0;a<r.length;a++)this.addLine(r[a],i,n,m,_,g,y,void 0,x&&a>0?a:null);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,i,a,o,s,n,l,void 0,this.worldview),this.hdExt&&this.hdExt.recordFeatureRange(this,f,this.indexArray.length,p)}fillNonElevatedRoadSegment(i){for(let r=Math.max(i,this.zOffsetVertexArray.length);r<this.layoutVertexArray.length;r++)this.zOffsetVertexArray.emplaceBack(0,0,0,0),this.showElevationIdDebug&&this.elevationIdColVertexArray.emplaceBack(0,0,0)}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:tW(w.min,T,S),max:tW(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.totalDistance=s*n,this.lineClips.start=a.min,this.lineClips.end=a.max,this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance);this.lineClipsArray.push(this.lineClips),this.updateScaledDistance()}let E="Polygon"===hj[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<hZ){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<hG&&d&&p,R=f.x*m.y-f.y*m.x>0,D=this.overscaling<=16?122880/(512*this.overscaling):0;if(a&&"round"===h){if(S<l)h="miter";else if(S<=2){let i=hH(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*D){let r=c.sub(c.sub(d)._mult(D/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*D){let i=c.add(p.sub(c)._mult(D/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*(R?-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*D;i<a&&(r=Math.max(0,i/a))}null!=y&&d&&this.addCurrentVertex(c,g||f,-r,-r,M,y);let a=i<=+D&&"bevel"!==h,n=a?1:S,o=w.mult(R?1:-1);o._mult(n);let s=m.mult(R?-1:1),l=f.mult(R?-1:1),x=this.evaluateLineProgressFeatures(this.distance);if(null==y&&(this.addHalfVertex(c,o.x,o.y,!1,!R,0,M,x),a||this.addHalfVertex(c,o.x+2*l.x,o.y+2*l.y,!1,R,0,M,x)),"fakeround"===h){let i=Math.round(180*C/Math.PI/20);this.addHalfVertex(c,l.x,l.y,!1,R,0,M,x);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=s.sub(l)._mult(a)._add(l)._unit();this.addHalfVertex(c,n.x,n.y,!1,R,0,M,x)}this.addHalfVertex(c,s.x,s.y,!1,R,0,M,x)}a||null!=y||this.addHalfVertex(c,o.x+2*s.x,o.y+2*s.y,!1,R,0,M,x),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&&!this.variableEmissiveStrengthValue&&"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):tF(`line-progress evaluation for ${this.layerIds[0]} requires enabling 'lineMetrics' for the source.`);let r=0;this.variableWidthValue&&"constant"!==this.variableWidthValue.kind&&(r=.5*(this.variableWidthValue.evaluate(this.evaluationGlobals,this.lineFeature)||0));let a=0;this.variableEmissiveStrengthValue&&"constant"!==this.variableEmissiveStrengthValue.kind&&(a=this.variableEmissiveStrengthValue.evaluate(this.evaluationGlobals,this.lineFeature)||0);let n=this.evaluateElevationGroundScale();return"offset"!==this.elevationType?{zOffset:0,variableWidth:r,elevationGroundScale:n,variableEmissiveStrength:a}:"constant"===this.zOffsetValue.kind?{zOffset:this.zOffsetValue.value,variableWidth:r,elevationGroundScale:n,variableEmissiveStrength:a}:{zOffset:this.zOffsetValue.evaluate(this.evaluationGlobals,this.lineFeature)||0,variableWidth:r,elevationGroundScale:n,variableEmissiveStrength: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 hM(i.x,i.y,_,this.lineS
7oFar),y=!!r&&hH(i,f,m),x=this.lineSoFar,v=this.distance;if(this.currentVertex)if(y){let r=this.currentVertexIsOutside,s=this.currentVertex,p=new hM(i.x,i.y,_,this.lineSoFar);if(hP(s,p,f,m),!hH(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){hP(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=i9(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,u.variableEmissiveStrength),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 hH(i,r,a){return i.x<r||i.x>a||i.y<r||i.y>a}nH(h$,"LineBucket",{omit:["layers","patternFeatures","currentVertex","currentVertexIsOutside"]});let hq=sZ([{name:"a_pos",components:2,type:"Int16"}],4),hW=sZ([{name:"a_circle_z_offset",components:1,type:"Float32"}],4),hX=sZ([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]);class hY{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 sH,this.indexArray=new la,this.segments=new lO,this.programConfigurations=new l9(i.layers,{zoom:i.zoom,lut:i.lut}),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),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=sN(h,i);if(!this.layers[0]._featureFilter.filter(new oC(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:sk(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 s5,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.hdExt&&this.hdExt.finalize()}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,hq.members),this.indexBuffer=i.createIndexBuffer(this.indexArray),this.globeExtVertexArray&&(this.globeExtVertexBuffer=i.createVertexBuffer(this.globeExtVertexArray,hX.members)),this.hdExt&&this.hdExt.upload(i)),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.hdExt&&this.hdExt.destroy())}addFeature(i,r,a,n,o,s,l,h){for(let a of(this.hdExt&&this.hdExt.beginFeature(i,h,o),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;this.addCircleVertex(a,n,-1,-1),this.addCircleVertex(a,n,1,-1),this.addCircleVertex(a,n,1,1),this.addCircleVertex(a,n,-1,1),this.hdExt&&this.hdExt.writeVertexQuad(a,n),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])}}nH(hY,"CircleBucket",{omit:["layers"]});let hK=sZ([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_tex_size",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),hJ=sZ([{name:"a_globe_anchor",components:3,type:"Int16"},{name:"a_globe_normal",components:3,type:"Float32"}],4),hQ=sZ([{name:"a_projected_pos",components:4,type:"Float32"}],4);sZ([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);let h0=sZ([{name:"a_auto_z_offset",components:1,type:"Float32"}],4),h1=sZ([{name:"a_feature_index",components:1,type:"Float32"}],4),h2=sZ([{name:"a_x_axis",components:3,type:"Float32"},{name:"a_y_axis",components:3,type:"Float32"}]),h3=sZ([{name:"a_texb",components:2,type:"Uint16"}]),h5=sZ([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_elevation_from_sea",components:2,type:"Float32"}]),h4=sZ([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"},{name:"a_auto_z_offset",components:1,type:"Float32"}]);sZ([{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 h6=sZ([{name:"a_pos",components:3,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),h8=sZ([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);sZ([{name:"triangle",components:3,type:"Uint16"}]),sZ([{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"}]),sZ([{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]),sZ([{type:"Float32",name:"offsetX"}]),sZ([{type:"Int16",name:"x"},{type:"Int16",name:"y"}]);let h9=new Float32Array(1),h7=new Uint32Array(h9.buffer);function ue(i){return h9[0]=i,h7[0]}let ut=class i{static getBlockIndices(r){let a=i._blockIndicesTemplate;if(!a){a=i._blockIndicesTemplate=new Uint32Array(r);for(let i=0;i<r;i++)a[i]=i}return a}constructor(i,r,a,n){this.batchIndex=r,this.headerBuffer=null,this.propertiesBuffer=null,this.blockIndicesBuffer=null,this.context=i||null,this.propsDwords=a,this.totalBytes=4*this.propsDwords,this.headerData=n,this.propertiesData=new Float32Array(this.propsDwords),this._headerDirty=!0,this._propsDirtyMin=-1,this._propsDirtyMax=-1,this._blockIndicesDirty=!0,i&&this._initBuffers(i)}_initBuffers(r){let a=r.gl;if(this.totalBytes>r.maxUniformBlockSize)throw Error(`UBO size ${this.totalBytes} exceeds device limit ${r.maxUniformBlockSize}`);a.isContextLost()||(this.headerBuffer=a.createBuffer(),a.bindBuffer(a.UNIFORM_BUFFER,this.headerBuffer),a.bufferData(a.UNIFORM_BUFFER,i.HEADER_BYTES,a.DYNAMIC_DRAW),this.propertiesBuffer=a.createBuffer(),a.bindBuffer(a.UNIFORM_BUFFER,this.propertiesBuffer),a.bufferData(a.UNIFORM_BUFFER,this.totalBytes,a.DYNAMIC_DRAW),this.blockIndicesBuffer=a.createBuffer(),a.bindBuffer(a.UNIFORM_BUFFER,this.blockIndicesBuffer),a.bufferData(a.UNIFORM_BUFFER,this.totalBytes,a.DYNAMIC_DRAW),a.bindBuffer(a.UNIFORM_BUFFER,null))}markHeaderDirty(){this._headerDirty=!0}writeDataDrivenBlock(i,r){let a=this.headerData,n=4*a[2];if(0===n)return;let o=r*n;if(o+n>this.propertiesData.length)throw Error(`UBO write out of bounds: feature index ${r} exceeds propertiesData capacity`);let s=a[0];for(let r=0;r<9;r++)s&1<<r&&this._copyFromFlat(o+4*a[3+r],r,i);(-1===this._propsDirtyMin||o<this._propsDirtyMin)&&(this._propsDirtyMin=o);let l=o+n;l>this._propsDirtyMax&&(this._propsDirtyMax=l)}rightSizeForTransfer(){let i=-1===this._propsDirtyMax?0:this._propsDirtyMax;i<this.propertiesData.length&&(this.propertiesData=this.propertiesData.slice(0,i))}_copyFromFlat(r,a,n){let o=4;(a<2||8===a)&&(o=this.headerData[1]>>>a&1?8:4);let s=i.EVAL_FLAT_OFFSETS[a];this.propertiesData.set(n.subarray(s,s+o),r)}upload(r){this.context||(this.context=r);let a=r.gl;this.headerBuffer&&this.propertiesBuffer&&this.blockIndicesBuffer||this._initBuffers(r);let n=!1;if(this._headerDirty&&(a.bindBuffer(a.UNIFORM_BUFFER,this.headerBuffer),a.bufferSubData(a.UNIFORM_BUFFER,0,this.headerData),this._headerDirty=!1,n=!0),-1!==this._propsDirtyMin){let i=this._propsDirtyMin,r=this._propsDirtyMax;a.bindBuffer(a.UNIFORM_BUFFER,this.propertiesBuffer),a.bufferSubData(a.UNIFORM_BUFFER,4*i,this.propertiesData,i,r-i),this._propsDirtyMin=-1,this._propsDirtyMax=-1,n=!0}this._blockIndicesDirty&&(a.bindBuffer(a.UNIFORM_BUFFER,this.blockIndicesBuffer),a.bufferSubData(a.UNIFORM_BUFFER,0,i.getBlockIndices(this.propsDwords)),this._blockIndicesDirty=!1,n=!0),n&&a.bindBuffer(a.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 ui(i,r,a,n,o,s,l,h){return!!i&&("constant"===i.kind?"none"===i.value:"none"===i.evaluate({zoom:0,brightness:s,worldview:h},r,a,o,n,l))}function ur(i){if(!(i instanceof oO))return!1;let r=i.value;return("source"===r.kind||"composite"===r.kind)&&r.isStateDependent}ut.HEADER_DWORDS=16,ut.HEADER_BYTES=64,ut.EVAL_FLAT_OFFSETS=[0,8,16,20,24,28,32,36,40],ut.EVAL_FLAT_TOTAL=48,ut._blockIndicesTemplate=null,nH(ut,"SymbolPropertiesUBO",{omit:["headerBuffer","propertiesBuffer","blockIndicesBuffer"]});let ua=["icon","text"].map(i=>[`${i}-color`,`${i}-halo-color`,`${i}-opacity`,`${i}-halo-width`,`${i}-halo-blur`,`${i}-emissive-strength`,`${i}-occlusion-opacity`,"symbol-z-offset",`${i}-translate`]),un=new Float32Array(ut.EVAL_FLAT_TOTAL),uo=[0,0],us=new WeakMap;class ul{constructor(i,r,a,n,o="",s,l){this.layer=i,this.zoom=r,this.lut=a,this.isText=n,this.worldview=o,this.maxUniformBufferBindings=s||24,this.uboSizeDwords=l||4096,this.allFeatureVtIndices=[],this.allFeatureIds=[],this.allFormattedSections=[],this.featureVertexRangesFromId=null,this.featureVertexRangesFromVtIndex=null,this.ubos=[],this.featureCount=0,this.cachedConstantUniforms=null,this.cachedConstantRenderZoom=null,this.cachedConstantBrightness=void 0,this.cachedConstantPaint=null,this.activeAppearanceByVtIndex=null,this.zoomDependency=new Uint8Array(9),this.sharedZoomRanges=new Float32Array(18),this._zoomRangeScratch=new Float32Array(2),this._floorZoom=Math.floor(this.zoom),this.header=new Uint32Array(ut.HEADER_DWORDS),this.updateHeader(),this.isAllConstant=0===this.header[0];let h=4*this.header[2];this.maxFeaturesPerBatch=0===h?Number.MAX_SAFE_INTEGER:Math.floor(this.uboSizeDwords/h)}updateHeader(){let i=this.layer.paint,r=0,a=0,n=0,o=0,s=!0,l=this._floorZoom,h=ua[+this.isText];for(let u=0;u<9;u++){let c=h[u],d=u<2,p=i.get(c),f=!(!p||"function"!=typeof p.isConstant||p.isConstant()),m=this._appearancesHavePaintProperties(c);if(!f&&!m){let i=this._layerUnevaluated(c);i&&i.expression&&"camera"===i.expression.kind&&(n|=1<<u);continue}r|=1<<u;let _=this._collectZoomSignatures(c,l),g=_.hasZoom,y=_.differs,x=8===u;this.zoomDependency[u]=y?2:+!!g;let v=y||x&&g;
7v&&(a|=1<<u);let b=p&&p.value;b&&!1===b.isLightConstant&&(s=!1),this.header[3+u]=o,o+=v?2:1,g&&!y&&_.representative&&(this._computeZoomRange(_.representative,l,this.sharedZoomRanges,2*u),d&&(this.header[12+2*u]=ue(this.sharedZoomRanges[2*u]),this.header[12+2*u+1]=ue(this.sharedZoomRanges[2*u+1])))}this.header[0]=r,this.header[1]=a,this.header[2]=o,this.isLightConstant=s,this.cameraMask=n}_recomputeSharedRanges(){let i=this._floorZoom,r=ua[+this.isText],a=0,n=!1;for(let o=0;o<9;o++){let s=r[o],l=this.zoomDependency[o];if(this.header[0]&1<<o){if(0!==l&&2!==l){let r=this._collectZoomSignatures(s,i);r.representative&&(this._computeZoomRange(r.representative,i,this.sharedZoomRanges,2*o),o<2&&(this.header[12+2*o]=ue(this.sharedZoomRanges[2*o]),this.header[12+2*o+1]=ue(this.sharedZoomRanges[2*o+1]),n=!0))}}else{let i=this._layerUnevaluated(s);i&&i.expression&&"camera"===i.expression.kind&&(a|=1<<o)}}if(this.cameraMask=a,n)for(let i of this.ubos)i.markHeaderDirty()}_collectZoomSignatures(i,r){let a=!1,n=!1,o=null,s=0,l=0,h=i=>{if(!i)return;this._computeZoomRange(i,r,this._zoomRangeScratch,0);let h=this._zoomRangeScratch[0],u=this._zoomRangeScratch[1];a?h===s&&u===l||(n=!0):(a=!0,s=h,l=u,o=i)};for(let r of(h(this._zoomExprOf(this._layerUnevaluated(i))),this.layer.getAppearances()||[]))r.hasPaintProperty(i)&&h(this._zoomExprOf(r.getUnevaluatedPaintProperty(i)));return{hasZoom:a,differs:n,representative:o}}evaluateAllProperties(i,r,a,n,o,s,l){let h={brightness:o,worldview:this.worldview},u={feature:i,featureState:r,canonical:a,availableImages:n,params:new oC(this.zoom,h),paramsNext:new oC(this.zoom+1,h),formattedSection:s,activeAppearance:l},c=ua[+this.isText];for(let i=0;i<9;i++){let r=c[i],a=i<2,n=8===i,o=this.zoomDependency[i],s=0!==o,l=2===o,h=ut.EVAL_FLAT_OFFSETS[i],d=h+(a||n?4:2);a?this._evaluateColorValue(r,i,s,l,d,u,h):n?this._evaluateTranslateValue(r,i,s,l,d,u,h):this._evaluateFloatValue(r,i,s,l,d,u,h)}return un}_resolveProp(i,r,a=!1,n){let o=this.layer.paint,s=o.get(i),l=!(!r||!r.hasPaintProperty(i)),h=l?n&&s&&s.property.overrides&&s.property.overrides.hasOverride(n)?s:r.paintProperties.get(i):o.get(i);if(a||!h||"function"!=typeof h.isConstant||!h.isConstant())return h;let u=l?r.getUnevaluatedPaintProperty(i):this._layerUnevaluated(i);return this._unbakeCamera(h,u)}_unbakeCamera(i,r){let a=r&&r.expression;if(!a||"camera"!==a.kind)return i;let n=us.get(r);return n||(n=new oO(i.property,a,i.parameters,i.iconImageUseTheme),us.set(r,n)),n}_layerUnevaluated(i){let r=this.layer._transitionablePaint._values[i];return r&&r.value}_zoomExprOf(i){let r=i&&i.expression;return r&&("composite"===r.kind||"camera"===r.kind)?r:null}_evalAt(i,r,a){return i.property.evaluate(i.value,r,a.feature,a.featureState,a.canonical,a.availableImages,i.iconImageUseTheme,a.formattedSection)}_evaluateColorValue(i,r,a,n,o,s,l){let h=this._resolveProp(i,s.activeAppearance,!1,s.formattedSection);if(this._writePropertyZoomRange(r,a,n,h,o),!h)return un[l]=0,un[l+1]=0,un[l+2]=0,void(un[l+3]=1);let u=this._resolveProp(`${i}-use-theme`,s.activeAppearance,!0),c=ui(u&&"string"!=typeof u?u.value:void 0,s.feature,s.featureState,s.availableImages,s.canonical,s.params.brightness,s.formattedSection,this.worldview)?null:this.lut,d=(h.isConstant()?h.constantOr(re.transparent):this._evalAt(h,s.params,s)||re.transparent).toNonPremultipliedRenderColor(c);if(un[l]=lB(255*d.r,255*d.g),un[l+1]=lB(255*d.b,255*d.a),a){let i=(this._evalAt(h,s.paramsNext,s)||re.transparent).toNonPremultipliedRenderColor(c);un[l+2]=lB(255*i.r,255*i.g),un[l+3]=lB(255*i.b,255*i.a)}else un[l+2]=un[l],un[l+3]=un[l+1]}_computeZoomRange(i,r,a,n){let o=0,s=1,l=i&&("composite"===i.kind||"camera"===i.kind)?i.zoomStops:null;if(l&&l.length>0)if(null==i.interpolationType){for(let i of(o=s=1,l))if(i>r&&i<r+1){o=s=i-r;break}}else l[0]>r&&l[0]<r+1&&(o=l[0]-r);a[n]=o,a[n+1]=s}_writeZoomRange(i,r){this._computeZoomRange(i&&i.value,this._floorZoom,un,r)}_writePropertyZoomRange(i,r,a,n,o){a?this._writeZoomRange(n,o):r?(un[o]=this.sharedZoomRanges[2*i],un[o+1]=this.sharedZoomRanges[2*i+1]):(un[o]=0,un[o+1]=0)}_evaluateFloatValue(i,r,a,n,o,s,l){let h=+!!i.endsWith("opacity"),u=this._resolveProp(i,s.activeAppearance);this._writePropertyZoomRange(r,a,n,u,o);let c=(u?u.isConstant()?u.constantOr(h):this._evalAt(u,s.params,s):h)??h;if(un[l]=c,a){let i=this._evalAt(u,s.paramsNext,s);un[l+1]=i??h}else un[l+1]=c}_evaluateTranslateValue(i,r,a,n,o,s,l){let h=this._resolveProp(i,s.activeAppearance);this._writePropertyZoomRange(r,a,n,h,o);let u=!!h&&"function"==typeof h.isConstant&&!h.isConstant(),c=h?"function"!=typeof h.isConstant?h:u?this._evalAt(h,s.params,s):h.constantOr(uo):void 0;if(un[l]=c?c[0]:0,un[l+1]=c?c[1]:0,a){let i=u?this._evalAt(h,s.paramsNext,s):c;un[l+2]=i?i[0]:0,un[l+3]=i?i[1]:0}
7else un[l+2]=un[l],un[l+3]=un[l+1]}_appearancesHavePaintProperties(i){return this.layer.getAppearances().some(r=>r.hasPaintProperty(i))}hasStateDependentPaint(i){let r=i.paint,a=ua[+this.isText];for(let i of a)if(ur(r.get(i)))return!0;for(let r of i.getAppearances()||[])for(let i of a)if(r.hasPaintProperty(i)&&ur(r.paintProperties.get(i)))return!0;return!1}hasPerFeatureTranslate(){return!!(256&this.header[0])}getCurrentBatchIndex(){return 0===this.maxFeaturesPerBatch?0:Math.floor(this.featureCount/this.maxFeaturesPerBatch)}_writeFeatureBlock(i,r){let a=this.isAllConstant?0:i,n=Math.floor(a/this.maxFeaturesPerBatch),o=a%this.maxFeaturesPerBatch;this._batchExceedsDeviceLimit(n)&&(n=0,o=0);let s=this.ubos[n];return!!s&&(s.writeDataDrivenBlock(r,o),!0)}_batchExceedsDeviceLimit(i){return 3*i+2>=this.maxUniformBufferBindings}_reevaluateAt(i,r,a,n,o,s){if(!r)return;let l=this.allFeatureVtIndices[i],h=r.feature(l);if(!h)return;let u=this.allFeatureIds[i],c=null!=u&&o[u]||{},d={type:h.type,id:u,properties:h.properties||{},geometry:[]},p=this.activeAppearanceByVtIndex?this.activeAppearanceByVtIndex.get(l):void 0,f=this.evaluateAllProperties(d,c,a,n,s,(this.allFormattedSections?this.allFormattedSections[i]:void 0)||void 0,p);this._writeFeatureBlock(i,f)}_ensureRangeMaps(){if(!this.featureVertexRangesFromId){this.featureVertexRangesFromId=new Map,this.featureVertexRangesFromVtIndex=new Map;for(let i=0;i<this.allFeatureVtIndices.length;i++){let r=this.allFeatureIds[i];if(null!=r){let a=this.featureVertexRangesFromId.get(r);a||this.featureVertexRangesFromId.set(r,a=[]),a.push(i)}let a=this.allFeatureVtIndices[i],n=this.featureVertexRangesFromVtIndex.get(a);n||this.featureVertexRangesFromVtIndex.set(a,n=[]),n.push(i)}}}populateUBO(i,r,a,n,o,s){let l,h,u=i.id,c=this.header,d=this.evaluateAllProperties(i,{},a,n,o,s);this.isAllConstant?(l=0,(h=0===this.featureCount)&&(this.featureCount=1)):(l=this.featureCount++,h=!0);let p=Math.floor(l/this.maxFeaturesPerBatch),f=l%this.maxFeaturesPerBatch;return h&&(this._batchExceedsDeviceLimit(p)?(tF(`Too many symbol features: batch ${p} requires binding points up to ${3*p+2}, device limit ${this.maxUniformBufferBindings}. Some features will render incorrectly.`),p=0,f=0):(this.ubos[p]||(this.ubos[p]=new ut(null,p,this.uboSizeDwords,c)),this.ubos[p].writeDataDrivenBlock(d,f))),this.allFeatureVtIndices.push(r),this.allFeatureIds.push(u),this.allFormattedSections.push(s||null),f}updateFeatures(i,r,a,n,o,s,l){for(let h of(this.layer=r,this.cachedConstantUniforms=null,this._ensureRangeMaps(),i)){let i=this.featureVertexRangesFromId.get(h);if(i)for(let r of i)this._reevaluateAt(r,a,n,o,s,l)}}updateDynamicExpressions(i,r,a,n,o,s){if(this.layer=i,this.cachedConstantUniforms=null,this._recomputeSharedRanges(),0!==this.header[0])for(let i=0;i<this.allFeatureVtIndices.length;i++)this._reevaluateAt(i,r,a,n,o,s)}updateFeaturePaintForAppearance(i,r,a,n,o,s,l){if(!this.layer||(this.activeAppearanceByVtIndex||(this.activeAppearanceByVtIndex=new Map),this.activeAppearanceByVtIndex.set(i,l||null),0===this.header[0]))return!1;this._ensureRangeMaps();let h=this.featureVertexRangesFromVtIndex.get(i);if(!h)return!1;let u=!1;for(let i of h){let h=this.evaluateAllProperties(r,a,n,o,s,(this.allFormattedSections?this.allFormattedSections[i]:void 0)||void 0,l);u=this._writeFeatureBlock(i,h)||u}return u}getConstantUniformValues(i,r){let a=!!this.cameraMask;if(this.cachedConstantUniforms&&this.cachedConstantPaint===this.layer.paint&&this.cachedConstantBrightness===r&&(!a||this.cachedConstantRenderZoom===i))return this.cachedConstantUniforms;let n=this.layer.paint,o=a?new oC(i,{brightness:r,worldview:this.worldview}):null,s={type:1,id:void 0,properties:{},geometry:[]},l=ua[+this.isText],h=i=>{let a=l[i],h=n.get(a);if(!h)return[0,0,0,1];let u=n.get(`${a}-use-theme`),c=ui(u&&"string"!=typeof u?u.value:void 0,s,{},[],void 0,r,void 0,this.worldview)?null:this.lut;return(this.cameraMask&1<<i&&o?h.property.evaluate(h.value,o,s,{},void 0,[])||re.transparent:h.constantOr(re.transparent)).toNonPremultipliedRenderColor(c).toArray01()},u=(i,r)=>{let a=n.get(l[i]);return a?this.cameraMask&1<<i&&o?a.property.evaluate(a.value,o,s,{},void 0,[])??r:a.constantOr(r):r},c={fill_np_color:h(0),halo_np_color:h(1),opacity:u(2,1),halo_width:u(3,0),halo_blur:u(4,0),emissive_strength:u(5,0),occlusion_opacity:u(6,1),z_offset:u(7,0
7)};return this.cachedConstantUniforms=c,this.cachedConstantRenderZoom=i,this.cachedConstantBrightness=r,this.cachedConstantPaint=this.layer.paint,c}finalize(){for(let i of this.ubos)i.rightSizeForTransfer()}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=null,this.featureVertexRangesFromVtIndex=null,this.allFeatureVtIndices=[],this.allFeatureIds=[],this.featureCount=0,this.maxFeaturesPerBatch=0}}nH(ul,"SymbolPropertyBinderUBO",{omit:["layer","cachedConstantUniforms","cachedConstantRenderZoom","cachedConstantBrightness","cachedConstantPaint","activeAppearanceByVtIndex","featureVertexRangesFromId","featureVertexRangesFromVtIndex"]});let uh={horizontal:1,vertical:2,horizontalOnly:3};function uu(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 uc(i,r,a,n){let{horizontalAlign:o,verticalAlign:s}=uu(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 ud(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}}let up={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","\xa2":"¢","\xa3":"£","\xa5":"¥","\xa6":"¦","\xac":"¬","\xaf":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};function uf(i,r,a,n){let{expression:o}=r;if("constant"===o.kind)return{kind:"constant",layoutSize:o.evaluate(new oC(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 oC(u,{worldview:a}),void 0,void 0,void 0,n),maxSize:o.evaluate(new oC(c,{worldview:a}),void 0,void 0,void 0,n),interpolationType:s}}}function um(i,{uSize:r,uSizeT:a},{lowerSize:n,upperSize:o}){return"source"===i.kind?n/128:"composite"===i.kind?i9(n/128,o/128,a):r}function u_(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?tv(a3.interpolationFactor(s,r,l,h),0,1):0;"camera"===i.kind?o=i9(i.minSize,i.maxSize,u)*a:n=u*a}return{uSizeT:n,uSize:o}}let ug=Math.sqrt(2);function uy(i,r,a,n,o,s,l){let h=i.hasLayoutProperty(o)?r.getAppearanceValueAndResolveTokens(i,o,a,n,[]):null;return(Array.isArray(s)?Array.isArray(h):typeof h==typeof s)?l?l(h):h:s}function ux(i,r,a,n,o,s,l,h){return{appearanceIconOffset:uy(i,r,a,n,"icon-offset",o),appearanceIconRotate:uy(i,r,a,n,"icon-rotate",s),appearanceIconSize:uy(i,r,a,n,"icon-size",l,i=>i*h)}}function uv(i,r,a,n,o,s,l){return{appearanceTextOffset:uy(i,r,a,n,"text-offset",o,([i,r])=>[24*i,24*r]),appearanceTextRotate:uy(i,r,a,n,"text-rotate",s),appearanceTextSize:uy(i,r,a,n,"text-size",l)}}function ub(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 oC(d.maxZoom,{worldview:g}),f,y).evaluate(_,{}
7,f,y),p.possiblyEvaluate(new oC(d.minZoom,{worldview:g}),f,y).evaluate(_,{},f,y)):p.possiblyEvaluate(new oC(m,{worldview:g}),f,y).evaluate(_,{},f,y));return i.scaleSelf(x*h*l)}function uw(i,r,a,n,o,s,l,h,u,c){return{iconPrimary:ub(i.getPrimary(),r,a,n,o,s,l,h,u,c),iconSecondary:ub(i.getSecondary(),r,a,n,o,s,l,h,u,c)}}function uT(i,r){return i*r/24}function uS(i,r,a,n,o,s){let l=null;return"source"===r.kind?(l=[128*a*n])[0]>32640&&tF(`${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)&&tF(`${i}: Value for "text-size" or "icon-size" is >= 255. Reduce your "text-size" or "icon-size".`),l}let{members:uE}=sZ([{type:"Float32",name:"a_globe_pos",components:3},{type:"Float32",name:"a_uv",components:2}]),uI=sZ([{name:"a_pos_3",components:3,type:"Int16"}]);var uA=sZ([{name:"a_pos",type:"Int16",components:2}]);class uM{constructor(i,r){this.pos=i,this.dir=r}intersectsPlane(i,r,a){let n=tt(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 uC{constructor(i,r){this.pos=i,this.dir=r}intersectsPlane(i,r,a){let n=eO(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 uP{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=eN(n,n,i),u=eN(o,o,i);return new uP(h,u,eN(s,s,i),eN(l,l,i),r/a)}}function uR(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 uD(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+=+(eO(o,r[i])+o[3]>=0);if(0===s)return 0;s!==r.length&&(a=!1)}return a?2:1}let uL=[0,0];function uz(i,r){for(let a of i.projections){let n=uR(r,i.points[0],a.axis,uL);if(a.projection[1]<n[0]||a.projection[0]>n[1])return 0}return 1}function uF(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 uO{constructor(i,r){for(let a of(this.points=i||Array(8).fill([0,0,0]),this.planes=r||Array(6).fill([0,0,0,0]),this.bounds=uB.fromPoints(this.points),this.projections=[],this.frustumEdges=[eE([],this.points[2],this.points[3]),eE([],this.points[0],this.points[3]),eE([],this.points[4],this.points[0]),eE([],this.points[5],this.points[1]),eE([],this.points[6],this.points[2]),eE([],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:uR(this.points,this.points[0],i,[0,0])}),this.projections.push({axis:r,projection:uR(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=eW([],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=eF([],eB([],eE([],s[i[0]],s[i[1]]),eE([],s[i[2]],s[i[1]]))),a=-eO(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 uO(h,l)}intersectsPrecise(i,r,a){for(let a=0;a<r.length;a++)if(!uF(i,r[a]))return 0;for(let r=0;r<this.planes.length;r++)if(!uF(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(eO([r[0],r[1],r[2]],i)+a<0)return!1}return!0}}class uB{static fromPoints(i){let r=[1/0,1/0,1/0],a=[-1/0,-1/0,-1/0];for(let n of i)eA(r,r,n),eM(a,a,n);return new uB(r,a)}static fromTileIdAndHeight(i,r,a){let n=1<<i.canonical.z,o=i.canonical.x,s=i.canonical.y;return new uB([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)eN(a[i],a[i],r);return uB.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 uB(a,n)}static projectAabbCorners(i,r){let a=i.getCorners();for(let i=0;i<a.length;++i)eN(a[i],a[i],r);return a}constructor(i,r){this.min=i,this.max=r,this.center=eC([],eS([],this.min,this.max),.5)}
7quadrant(i){let r=[i%2==0,i<2],a=ev(this.min),n=ev(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 uB(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)?uD(i,this.getCorners()):0}intersectsFlat(i){return this.intersectsAabb(i.bounds)?uD(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)?uz(i,this.getCorners()):0}intersectsPreciseFlat(i,r){return r||this.intersectsFlat(i)?uz(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])]}}function uk(i){return i*sb/6371008.8}nH(uB,"Aabb");let uN=[new uB([sT,sT,sT],[sb,sb,sb]),new uB([sT,sT,sT],[0,0,sb]),new uB([0,sT,sT],[sb,0,sb]),new uB([sT,0,sT],[0,sb,sb]),new uB([0,0,sT],[sb,sb,sb])];function uV(i,r,a,n=!0){let o=eC([],i._camera.position,i.worldSize),s=[r,a,1,1];eW(s,s,i.pixelMatrixInverse),eH(s,s,1/s[3]);let l=eF([],eE([],s,o)),h=i.globeMatrix,u=[h[12],h[13],h[14]],c=eE([],u,o),d=eb(c),p=eF([],c),f=i.worldSize/(2*Math.PI),m=eO(p,l),_=Math.asin(f/d);if(_<Math.acos(m)){if(!n)return null;let i=[],r=[];eC(i,l,d/m),eF(r,eE(r,i,c)),eF(l,eS(l,c,eC(l,r,Math.tan(_)*d)))}let g=[];new uC(o,l).closestPointOnSphere(u,f,g);let y=eF([],tG(h,0)),x=eF([],tG(h,1)),v=eF([],tG(h,2)),b=eO(y,g),w=eO(x,g),T=eO(v,g),S=Math.asin(-w/f)*tm,E=Math.atan2(b,T)*tm;return new sF(rK(E=i.center.lng+function(i,r){let a=(r-i+180)%360-180;return a<-180?a+360:a}(i.center.lng,E)),tv(rJ(S),0,1))}class uU{constructor(i,r,a){this.a=eE([],i,a),this.b=eE([],r,a),this.center=a;let n=eF([],this.a),o=eF([],this.b);this.angle=Math.acos(eO(n,o))}}function uj(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,tv(a,0,1))+i.center[r]}function uG(i){if(i.z<=1)return uN[i.z+2*i.y+i.x];let r=uW(uq(i));return uB.fromPoints(r)}function uZ(i,r,a){return eC(i,i,1-a),eP(i,i,r,a)}function u$(i,r,a){for(let n of i)eN(n,n,r),eC(n,n,a)}function uH(i,r,a,n){let o=r/i.worldSize,s=i.globeMatrix;if(a.z<=1){let i=uG(a).getCorners();return u$(i,s,o),uB.fromPoints(i)}let l=uq(a,n),h=uW(l,sb+uk(i._tileCoverLift));u$(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)eA(d,d,i),eM(c,c,i);c[2]=0;let r=i.point,a=[r.x*o,r.y*o,0];return eA(d,d,a),eM(c,c,a),new uB(d,c)}if(i._tileCoverLift>0){for(let i of h)eA(d,d,i),eM(c,c,i);return new uB(d,c)}let p=[s[12]*o,s[13]*o,s[14]*o],f=l.getCenter(),m=tv(i.center.lat,-85.051129,85.051129),_=tv(f.lat,-85.051129,85.051129),g=rK(i.center.lng),y=rJ(m),x=g-rK(f.lng),v=y-rJ(_);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,eP(p,p,[s[4]*o,s[5]*o,s[6]*o],-Math.sin((v>=0?l.getSouth():l.getNorth())*tf)*sb));let w=h[b],T=h[(b+1)%4],S=new uU(w,T,p),E=[uj(S,0)||w[0],uj(S,1)||w[1],uj(S,2)||w[2]],I=u3(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++)uZ(h[i],n[i],I);let o=eS([],n[b],n[(b+1)%4]);eC(o,o,.5),uZ(E,o,I)}for(let i of h)eA(d,d,i),eM(c,c,i);return d[2]=Math.min(w[2],T[2]),eA(d,d,E),eM(c,c,E),new uB(d,c)}function uq({x:i,y:r,z:a},n=!1){let o=1/(1<<a);return new sM(new sA(rQ(i*o),r===(1<<a)-1&&n?-90:r0((r+1)*o)),new sA(rQ((i+1)*o),0===r&&n?90:r
70(r*o)))}function uW(i,r=sb){let a=i.getNorth()*tf,n=i.getSouth()*tf,o=Math.cos(a),s=Math.cos(n),l=Math.sin(a),h=Math.sin(n),u=i.getWest(),c=i.getEast();return[sS(s,h,u,r),sS(s,h,c,r),sS(o,l,c,r),sS(o,l,u,r)]}function uX(i,r,a,n){let o=1<<a.z,s=(i/8192+a.x)/o;return sE(r0((r/8192+a.y)/o),rQ(s),n)}function uY({min:i,max:r}){return 16383/Math.max(r[0]-i[0],r[1]-i[1],r[2]-i[2])}let uK=new Float64Array(16);function uJ(i){let r=uY(i),a=ep(uK,[r,r,r]);return es(a,a,ez([],i.min))}function uQ(i){let r=1/uY(i);return ed(uK,i.min),el(uK,uK,[r,r,r])}function u0(i){return i/(2*Math.PI)/(8192/(2*Math.PI))}function u1(i,r){return 8192/(512*Math.pow(2,i))*uY(uG(r))}function u2(i,r,a,n,o){let s=u0(a),l=[i,r,-a/(2*Math.PI)],h=er(new Float64Array(16));return es(h,h,l),el(h,h,[s,s,s]),eh(h,h,-o*tf),eu(h,h,-n*tf),h}function u3(i){return tb(5,6,i)}function u5(i,r){var a,n,o,s,l,h,u,c;let d=sE(r.lat,r.lng);return n=(a=eE([],function(i){let r=sE(i._center.lat,i._center.lng),a=eB([],ew(0,1,0),r),n=ef([],-i.angle,r);a=eN(a,a,n),ef(n,-i._pitch,a);let o=eF([],r);return eC(o,o,uk(i.cameraToCenterDistance/i.pixelsPerMeter)),eN(o,o,n),eS([],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)))&&eO(a,d)/c,-1),1))}function u4(i,r){return u5(i,r)>Math.PI/2*1.01}let u6=85*tf,u8=Math.cos(u6),u9=Math.sin(u6);function u7(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)}class ce{constructor(i,r,a){this.z=i,this.x=r,this.y=a,this.key=cr(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 ct{constructor(i,r){this.wrap=i,this.canonical=r,this.key=cr(i,r.z,r.z,r.x,r.y)}}class ci{constructor(i,r,a,n,o){this.overscaledZ=i,this.wrap=r,this.canonical=new ce(a,+n,+o),this.key=0===r&&i===a?this.canonical.key:cr(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 ci(i,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new ci(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 cr(this.wrap*r,i,this.canonical.z,this.canonical.x,this.canonical.y);{let a=this.canonical.z-i;return cr(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 ci(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 ci(r,this.wrap,r,a,n),new ci(r,this.wrap,r,a+1,n),new ci(r,this.wrap,r,a,n+1),new ci(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 ci(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(i){return new ci(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 ct(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}}function cr(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 ca=[i=>{let r=i.canonical.x-1,a=i.wrap;return r<0&&(r=(1<<i.canonical.z)-1,a--),new ci(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 ci(i.overscaledZ,a,i.canonical.z,r,i.canonical.y)},i=>new ci(i.overscaledZ,i.wrap,i.canonical.z,i.canonical.x,(0===i.canonical.y?1<<i.canonical.z:i.canonical.y)-1),i=>new ci(i.overscaledZ,i.wrap,i.canonical.z,i.canonical.x,i.canonical.y===(1<<i.canonical.z)-1?0:i.canonical.y+1)];function cn(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=rQ(n),u=rQ(o),c=r0(s),d=r0(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(rQ(h),r0(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 co(i,r,a,n,o,s,l,h,u){if("globe"===u.name)return uH(i,r,new ce(a,n,o),!1);let c=cn({z:a,x:n,y:o},u);return new uB([(s+c.x/c.scale)*r,r*(c.y/c.scale),l],[(s+c.x2/c.scale)*r,r*(c.y2/c.scale),h])}nH(ce,"CanonicalTileID"),nH(ci,"OverscaledTileID",{omit:["projMatrix","expandedProjMatrix"]});let cs=er(new Float32Array(16));class cl{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 sA(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/sC(i)*r}pixelSpaceConversion(i,r,a){return 1}farthestPixelDistance(i){return u7(i,i.pixelsPerMeter)}pointCoordinate(i,r,a,n){let o=new tr(r,Math.max(i.horizonLineFromTop(!1),a));return i.rayIntersectionCoordinate(i.pointRayIntersection(o,n))}pointCoordinate3D(i,r,a){let n=new tr(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 cs}createTileMatrix(i,r,a){let n,o,s,l=a.canonical,h=er(new Float64Array(16));if(this.isReprojectedInTileSpace){let u=cn(l,this);n=1,o=u.x+a.wrap*u.scale,s=u.y,el(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 es(h,h,[o,s,0]),el(h,h,[n/8192,n/8192,1]),h}upVector(i,r,a){return[0,0,1]}upVectorScale(i,r,a){return{metersToTile:1}}}class ch extends cl{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*tf);this.n=(n+Math.sin(a*tf))/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])*tf,l=Math.sqrt(n-2*a*Math.sin(r*tf))/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]*tf*a,u=tv((l=tw(l,-Math.PI-h,Math.PI-h))/a*tm+this.center[0],-180,180),c=Math.asin(tv((n-(i*i+s*s)*a*a)/(2*a),-1,1));return new sA(u,tv(c*tm,-85.051129,85.051129))}}let cu=Math.sqrt(3)/2;class cc extends cl{project(i,r){r=r/180*Math.PI,i=i/180*Math.PI;let a=Math.asin(cu*Math.sin(r)),n=a*a,o=n*n*n;return{x:.5*(i*Math.cos(a)/(cu*(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=tv(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=cu*i*(1.340264+-.24331799999999998*n+o*(.0062510000000000005+.034164*n))/Math.cos(a),l=Math.asin(Math.sin(a)/cu);return new sA(tv(180*s/Math.PI,-180,180),tv(180*l/Math.PI,-85.051129,85.051129))}}class cd extends cl{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 sA(360*(i-.5),tv(360*(.5-r),-85.051129,85.051129))}}let cp=Math.PI/2;function cf(i){return Math.tan((cp+i)/2)}class cm extends cl{constructor(i){super(i),this.center=i.center||[0,30];let[r,a]=this.parallels=i.parallels||[30,30],n=r*tf,o=a*tf;this.southernCenter=n+o<0,this.southernCenter&&(n=-n,o=-o);let s=Math.cos(n),l=cf(n);this.n=n===o?Math.sin(n):Math.log(s/Math.cos(o))/Math.log(cf(o)/l),this.f=s*Math.pow(cf(n),this.n)/this.n}project(i,r){r*=tf,this.southernCenter&&(r=-r),i=(i-this.center[0])*tf;let{n:a,f:n}=this;n>0?r<-cp+1e-6&&(r=-cp+1e-6):r>cp-1e-6&&(r=cp-1e-6);let o=n/Math.pow(cf(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=tv(h/a*tm+this.center[0],-180,180),c=tv((2*Math.atan(Math.pow(n/l,1/a))-cp)*tm,-85.051129,85.051129);return new sA(u,this.southernCenter?-c:c)}}class c_ extends cl{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:rK(i),y:rJ(r),z:0}}unproject(i,r){return new sA(rQ(i),r0(r))}}let cg=85.051129*tf;class cy extends cl{project(i,r){let a=(r*=tf)*r,n=a*a;return{x:.5*((i*=tf)*(.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=tv(a-o,-cg,cg)}while(Math.abs(o)>1e-6&&--n>0);return new sA(tv(i/(.8707+(s=a*a)*(s*(s*s*s*(.003971-.001529*s)-.013791)-.131979))*tm,-180,180),a*tm)}}let cx=85.051129*tf;class cv extends cl{project(i,r){r*=tf,i*=tf;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=tv(a-s,-Math.PI,Math.PI),n=tv(n-l,-cx,cx)}while((Math.abs(s)>1e-6||Math.abs(l)>1e-6)&&--o>0);return new sA(a*tm,n*tm)}}class cb extends cl{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]*tf)),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*tf*n*a+.5,y:-Math.sin(r*tf)/n*a+.5,z:0}}unproject(i,r){let{scale:a,cosPhi:n}=this,o=tv((i-.5)/a*tm/n,-180,180),s=Math.asin(tv(-(r-.5)/a*n,-1,1));return new sA(o,tv(s*tm,-85.051129,85.051129))}}class cw extends c_{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=uX(i,r,a);return eN(n,n,uJ(uG(a))),{x:n[0],y:n[1],z:n[2]}}locationPoint(i,r,a){let n=sE(r.lat,r.lng),o=eF([],n),s=a?i._centerAltitude+a:i.elevation?i.elevation.getAtPointOrZero(i.locationCoordinate(r),i._centerAltitude):i._centerAltitude;eP(n,n,o,1/sC(0)*8192*s);let l=er(new Float64Array(16));return eo(l,i.pixelMatrix,i.globeMatrix),eN(n,n,l),new tr(n[0],n[1])}pixelsPerMeter(i,r){return 1/sC(0)*r}pixelSpaceConversion(i,r,a){let n=1/sC(i)*r,o=i9(1/sC(45)*r,n,a);return this.pixelsPerMeter(i,r)/o}createTileMatrix(i,r,a){let n=uQ(uG(a.canonical));return eo(new Float64Array(16),i.globeMatrix,n)}createInversionMatrix(i,r){let{center:a}=i,n=uJ(uG(r));return eu(n,n,a.lng*tf),eh(n,n,a.lat*tf),el(n,n,[i._pixelsPerMercatorPixel,i._pixelsPerMercatorPixel,1]),Float32Array.from(n)}pointCoordinate(i,r,a,n){return uV(i,r,a,!0)||new sF(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!uV(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=eS([],eC([],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=eC([],s.up(),p),m=eC([],s.right(),p*d),_=eF([],eS([],eS([],l,f),m)),g=[];if(new uC(h,_).closestPointOnSphere(c,u,g)){let r=eE([],eS([],g,c),h);a=Math.cos(i.fovAboveCenter)*eb(r)}else{let i=eE([],h,c),r=eE([],c,h);eF(r,r);let n=eb(i)-u,o=Math.acos((a=Math.sqrt(n*(n+2*u)))/(u+n))-Math.acos(eO(l,r));a*=Math.cos(o)}return 1.01*a}(i,this.pixelsPerMeter(i.center.lat,i.worldSize)),a=u3(i.zoom);if(a>0){let n=u7(i,1/sC(i.center.lat)*i.worldSize);return i9(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 uX(r,a,i,1)}upVectorScale(i){return{metersToTile:uk(uY(uG(i)))}}}function cT(i){let r=i.parallels,a=!!r&&.01>Math.abs(r[0]+r[1]);switch(i.name){case"mercator":return new c_(i);case"equirectangular":return new cd(i);case"naturalEarth":return new cy(i);case"equalEarth":return new cc(i);case"winkelTripel":return new cv(i);case"albers":return a?new cb(i):new ch(i);case"lambertConformalConic":return a?new cb(i):new cm(i);case"globe":return new cw(i)}throw Error(`Invalid projection name: ${i.name}`)}let cS=Number.MAX_SAFE_INTEGER;function cE(i,r,a,n){return i.order<r||i.order===cS||!(i.clipMask&a)||function(i,r){if(0===r.length)return!1;let a=i;for(;""!==a;){if(r.includes(a))return!1;a=o1(a)}return!0}(n,i.clipScope)}function cI(i,r){return i.x-r.x||i.y-r.y}function cA(i,r){return 0===cI(i.min,r.min)&&0===cI(i.max,r.max)}function cM(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 cC(i,r){if(i.length!==r.length)return!1;for(let a=0;a<i.length;
7a++)if(i[a].sourceId!==r[a].sourceId||!cA(i[a],r[a])||i[a].order!==r[a].order||i[a].clipMask!==r[a].clipMask||!ta(i[a].clipScope,r[a].clipScope))return!1;return!0}function cP(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 tr((1220703125e-13*i.x+a.canonical.x)*n+a.wrap,(1220703125e-13*i.y+a.canonical.y)*n),max:new tr(o,s)}}function cR(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 tr(f,_),new tr(m,g),c);for(let i=0;i<c.length;i++){let r=c[i];if(hI(u[h[3*r+0]],u[h[3*r+1]],u[h[3*r+2]],n,o,p,l))return!0}}return!1}function cD(i,r,a,n){let o=Math.pow(2,n.z-a.z);return new tr((i+8192*a.x)*o-8192*n.x,(r+8192*a.y)*o-8192*n.y)}function cL(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(hw([o[n[3*s+0]],o[n[3*s+1]],o[n[3*s+2]]],i))return!0}return!1}let cz={None:0,Model:1,Symbol:2,FillExtrusion:4};function cF(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 cO{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 ci(a,o,a,s,l));return!(!h||!h.dem)}
7getAtPointOrZero(i,r=0){return this.getAtPoint(i,r)||0}getAtPoint(i,r,a=!0){if(this.isUsingMockSource())return null;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 ci(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)*i9(i9(d.get(_,g),d.get(_,g+1),m-g),i9(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 sF(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 eC(u,u,h*n.upVectorScale(i.canonical,r,a).metersToTile),u}}getForTilePoints(i,r,a,n){if(this.isUsingMockSource())return!1;let o=cB.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}}class cB{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 cB(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 tr(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?i9(i9(u.get(l,h,n),u.get(l,h+1,n),s-h),i9(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/sC(i))*this._dem.stride}}function ck(i,r,a){let n=tb(45,65,a),[o,s]=i.range,l=1-Math.min(1,Math.exp(-((r-o)/(s-o)*6)));return l*=l*l,(l=Math.min(1,1.00747*l))*n*i.alpha}function cN(i,r,a,n,o,s){let l=[r,a,n];return eN(l,l,s.calculateFogTileMatrix(o)),ck(i,eb(l),s.pitch)}function cV(i,r,a,n,o){return ck(i,eb(eN([],[r,a,n],o.mercatorFogMatrix)),o.pitch)}function cU(i,r,a){let n=r.createTileMatrix(i,i.worldSize,a.toUnwrapped());return eo(new Float32Array(16),i.projMatrix,n)}function cj(i,r,a,n){return r.name===n?a.calculateProjMatrix(i.toUnwrapped()):cU(a,r,i)}let cG={SYMBOL_INVISIBLE:0,VARIANT_VISIBLE:2},cZ="undefined"==typeof TextDecoder?null:new TextDecoder("utf-8");class c${constructor(i){this.buf=ArrayBuffer.isView(i)?i:new Uint8Array(i),this.dataView=new DataView(this.buf.buffer,this.buf.byteOffset,this.buf.byteLength),this.pos=0,this.type=0,this._valueStart=-1,this.length=this.buf.length}readFields(i,r,a=this.length){let n;for(;n=this.nextField(a);)i(n,r,this);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=this.buf,a=r[this.pos++];if(a<128)return a;let n,o=127&a;return o|=(127&(n=r[this.pos++]))<<7,n<128?o:(o|=(127&(n=r[this.pos++]))<<14,n<128?o:(o|=(127&(n=r[this.pos++]))<<21,n<128?o: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")}(o|=(15&(n=r[this.pos]))<<28,i,this)))}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&&cZ?cZ.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}nextField(i=this.length){if(this.pos===this._valueStart&&this.skip(this.type),this.pos>=i)return 0;let r=this.readVarint();return this.type=7&r,this._valueStart=this.pos,r>>>3}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}}}function cH(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),a.buf.copyWithin(i+n,i,a.pos)}function cq(i,r){let a=i.length,n=r.buf,o=r.pos,s=r.length;for(let l=0;l<a;l++){let a=i[l];if(a<0||o+10>s)r.pos=o,r.writeVarint(a),n=r.buf,o=r.pos,s=r.length;else{for(;a>127;)n[o++]=a%128|128,a=Math.floor(a/128);n[o++]=a}}r.pos=o}function cW(i,r){for(let a=0;a<i.length;a++)r.writeSVarint(i[a])}function cX(i,r){for(let a=0;a<i.length;a++)r.writeFloat(i[a])}function cY(i,r){for(let a=0;a<i.length;
7a++)r.writeDouble(i[a])}function cK(i,r){for(let a=0;a<i.length;a++)r.writeBoolean(i[a])}function cJ(i,r){for(let a=0;a<i.length;a++)r.writeFixed32(i[a])}function cQ(i,r){for(let a=0;a<i.length;a++)r.writeSFixed32(i[a])}function c0(i,r){for(let a=0;a<i.length;a++)r.writeFixed64(i[a])}function c1(i,r){for(let a=0;a<i.length;a++)r.writeSFixed64(i[a])}function c2(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 c3(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 c5(i){let r=0;for(let a=0;a<i.length;a++)r=(r<<5)-r+i.charCodeAt(a),r&=r;return r}function c4(i,r){return(i<<5)-i+r}function c6(i,r,a,n){for(let[o]of i.entries()){let i=n&&n.get(o)||rA.parse(o),s=i.id.toString(),l=r.get(s)||0;a.push({id:o,version:l,sx:i.sx,sy:i.sy})}}class c8{constructor(i,r,a,n,o="",s){this.scope=o,this.iconDescriptors=[],this.patternDescriptors=[],this.requiresMipMaps=r.size>0,c6(i,a,this.iconDescriptors,s),c6(r,a,this.patternDescriptors,s),this.iconDescriptors.sort(c3),this.patternDescriptors.sort(c3);let l=0;l=c4(0,c5(o)),l=c4(l,1);let h=n?n.data:"";for(let i of(h&&(l=c4(l,c5(h))),l=c4(l,1),this.iconDescriptors))l=c4(l,c5(i.id)),l=c4(l,i.version),l=c4(l,i.sx),l=c4(l,i.sy);for(let i of(l=c4(l,1),this.patternDescriptors))l=c4(l,c5(i.id)),l=c4(l,i.version),l=c4(l,i.sx),l=c4(l,i.sy);this.hash=l}subsetOf(i){return this.scope===i.scope&&this.isSubsetArray(this.iconDescriptors,i.iconDescriptors,c3)&&this.isSubsetArray(this.patternDescriptors,i.patternDescriptors,c3)}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}}function c9(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 c7(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}}nH(c8,"AtlasContentDescriptor");class de{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,c9(this.format),c7(this.format),i):"data"in i&&i.data&&s.texSubImage2D(s.TEXTURE_2D,0,l,h,a,n,c9(this.format),c7(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 dt{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,c9(this.format),c7(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}}class di{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=di.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 dr(i,r,a){let n=rA.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 di(o,r,a,n),imageVariant:n}}function da(i,r){let a=[];for(let[n,o]of i.entries()){let i=rA.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:i.key.localeCompare(r.key)});let n=new Map;for(let i of a)n.set(i.key,i.value);return n}class dn{constructor(i){this.sourceAtlasHash=i}}class ds{constructor(i,r,a,n,o=""){let s=new Map,l=new Map;this.haveRenderCallbacks=[];let h=[],u=void 0!==n,c=u?new Map:void 0,d=u?da(i,c):i,p=u?da(r,c):r;this.addImages(d,s,1,h),this.addImages(p,l,2,h);let{w:f,h:m}=c2(h),_=new hB({width:f||1,height:m||1});for(let[i,r]of d.entries()){let a=s.get(i).paddedRect;hB.copy(r.data,_,{x:0,y:0},{x:a.x+1,y:a.y+1},r.data,null,r.sdf)}for(let[i,r]of p.entries()){let n=l.get(i),o=n.paddedRect,s=n.padding,h=o.x+s,u=o.y+s,c=r.data.width,d=r.data.height;s=s>1?s-1:s,hB.copy(r.data,_,{x:0,y:0},{x:h,y:u},r.data,a),hB.copy(r.data,_,{x:0,y:d-s},{x:h,y:u-s},{width:c,height:s},a),hB.copy(r.data,_,{x:0,y:0},{x:h,y:u+d},{width:c,height:s},a),hB.copy(r.data,_,{x:c-s,y:0},{x:h-s,y:u},{width:s,height:d},a),hB.copy(r.data,_,{x:0,y:0},{x:h+c,y:u},{width:s,height:d},a),hB.copy(r.data,_,{x:c-s,y:d-s},{x:h-s,y:u-s},{width:s,height:s},a),hB.copy(r.data,_,{x:0,y:d-s},{x:h+c,y:u-s},{width:s,height:s},a),hB.copy(r.data,_,{x:0,y:0},{x:h+c,y:u+d},{width:s,height:s},a),hB.copy(r.data,_,{x:c-s,y:0},{x:h-s,y:u+d},{width:s,height:s},a)}this.lut=a,this.image=_,this.iconPositions=s,this.patternPositions=l,u&&(this.contentDescriptor=new c8(d,p,n,a,o,c))}addImages(i,r,a,n){for(let[o,s]of i.entries()){let{bin:i,imagePosition:l,imageVariant:h}=dr(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.getUpd
7atedImages(a))){for(let n of this.iconPositions.keys()){let s=rA.parse(n);if(i5.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=rA.parse(s);if(i5.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 hB(i);hB.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})}}nH(di,"ImagePosition"),nH(ds,"ImageAtlas",{omit:["lut"]}),nH(dn,"ImageAtlasReference");class dl{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 dl.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]),dl.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}}}dl.loadGlyphRange=async function(i,r,a,n,o){let s,l=256*r;try{let r=await n.transformRequest(n.normalizeGlyphsURL(a).replace("{fontstack}",i).replace("{range}",`${l}-${l+255}`),il.Glyphs),{data:o}=await iy(r),h={},u=function(i){let r;var a=new c$(i);let n={glyphs:[]};for(;r=a.nextField();)1===r&&function(i,r,a){let n;for(;n=i.nextField(r);)3===n?a.glyphs.push(function(i,r){let a,n,o=0,s=0,l=0,h=0,u=0,c=0;for(;n=i.nextField(r);)1===n?o=i.readVarint():2===n?a=i.readBytes():3===n?s=i.readVarint():4===n?l=i.readVarint():5===n?h=i.readSVarint():6===n?u=i.readSVarint():7===n&&(c=i.readVarint());return{id:o,bitmap:new hO({width:s+6,height:l+6},a),metrics:{width:s,height:l,left:h,top:u,advance:c}}}(i,i.readVarint()+i.pos)):4===n?a.ascender=i.readSVarint():5===n&&(a.descender=i.readSVarint())}(a,a.readVarint()+a.pos,n);return n}(o);for(let i of u.glyphs)h[i.id]=i;s={glyphs:h,ascender:u.ascender,descender:u.descender}}catch(i){return o(i)}o(null,s)};let dh=new Float64Array(256);for(let i=0;i<256;i++){let r=.5-Math.pow(i/255,1/2.2);dh[i]=r*Math.abs(r)}function du(i,r,a,n,o,s,l,h,u){for(let c=r;c<r+n;c++)dc(i,a*s+c,s,o,l,h,u);for(let c=a;c<a+o;c++)dc(i,c*s+r,1,n,l,h,u)}function dc(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}}dh[255]=-1e20;let dd=/bold/i,dp=/medium/i,df=/light/i,dm={none:0,ideographs:1,all:2};class d_{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 dl({fontstackCompositing:n})}setURL(i){this.url=i}prefetchRange(i,r){let a=this.url||tQ.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||tQ.GLYPHS_URL;for(let r in i)for(let n of i[r])a.push({stack:r,id:n});tT(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 tF("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!==dm.none&&(this.localGlyphMode===dm.all?!!this.localFontFamily:!!this.localFontFamily&&(oa(i)||os(i)||n4(i)||n6(i)||n5(i)||or(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";dd.test(r)?a="900":dp.test(r)?a="500":df.test(r)&&(a="200"),(o=i.tinySDF=new d_.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 hO({width:u,height:c},h),metrics:{width:d/2,height:p/2,left:f/2,top:m/2-27,advance:_/2,localGlyph:!0}}}}function dg(i,r){return i+r[1]-r[0]}function dy(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(dg,0),g=m.reduce(dg,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=dx(f,0,i[0]),w=dx(m,0,i[1]),b=dx(f,i[0],i[2]),T=dx(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,R,D,L,z,F,O,B,k,N;let V=(f=n.stretch-v,f/b*d+i.left*o),U=(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,R=s.stretch,C-P*R/g),Z=(D=u.stretch-v,D/b*d+i.left*o),$=(L=u.f
7ixed-S,z=E,F=u.stretch,L-z*F/_),H=(O=c.stretch-w,O/T*p+i.top*o),q=(B=c.fixed-I,k=A,N=c.stretch,B-k*N/g),W=new tr(V,j),X=new tr(Z,j),Y=new tr(Z,H),K=new tr(V,H),J=new tr(U/h,G/h),Q=new tr($/h,q/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),K._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:K,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:J,pixelOffsetBR:Q,minFontScaleX:E/h/d,minFontScaleY:A/h/p,isSDF:a}};if(l.stretchX||l.stretchY){let i=dv(f,y,_),r=dv(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 dx(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 dv(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 db(i){return 2*i.length+1}function dw(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;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)),R=E.h*s.scale/(v*(s.localGlyph?2:1));if(w){let r=s.y-y,a=new tr(-T,T-r),o=-Math.PI/2,l=new tr(...M);(i=new tr(-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-R)/2:(h-(S.height+2*g)*s.scale)/2,n=new tr(i.x,i.y-P),u=new tr(i.x+R,i.y),m=new tr(i.x+R,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+R;i=new tr(r,a),n=new tr(o,a),u=new tr(r,l),m=new tr(o,l)}if(p){let r;r=o?new tr(0,0):C?new tr(f[0],f[1]):new tr(a[0],a[1]),i._rotateAround(p,r),n._rotateAround(p,r),u._rotateAround(p,r),m._rotateAround(p,r)}let D=new tr(0,0),L=new tr(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:D,pixelOffsetBR:L,minFontScaleX:0,minFontScaleY:0})}}return d}d_.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=dh[i];v[r]=Math.max(0,a),x[r]=Math.max(0,-a)}}du(v,0,0,d,p,d,this.f,this.v,this.z);let T=Math.min(y,1);du(x,y-T,y-T,u+2*T,c+2*T,d,this.f,this.v,this.z);let S=255/this.radius,E=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(E-S*r)}return _}};class dT{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:!ar(r),stateDependent:!aa(r),zoomDependent:!ao(r,["zoom"]),pitchDependent:!ao(r,["pitch"]),brightnessDependent:!ao(r,["brightness","measure-light"]),worldviewDependent:!ao(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"}
7:(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 dS=hd.types,dE=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function dI(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 dA(i,r,a){i.emplaceBack(r,a)}function dM(i,r,a,n,o,s,l){i.emplaceBack(r,a,n,o,s,l)}function dC(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}function dP(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)}let dR={};class dD{constructor(i){this.layoutVertexArray=new s4,this.indexArray=new la,this.programConfigurations=i,this.segments=new lO,this.dynamicLayoutVertexArray=new s8,this.opacityVertexArray=new s9,this.placedSymbolArray=new lw,this.iconTransitioningVertexArray=new s7,this.globeExtVertexArray=new s6,this.zOffsetVertexArray=new sX,this.orientationVertexArray=new ls,this.symbolInstanceIndices=[],this.uboBinder=null,this.featureIdArray=new sX,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 lO(r))}return r&&(this.cachedBatchIndices=n,this.cachedBatchSegments=o),{batchIndices:n,batchSegments:o}}snapshotSymbolVertexData(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)}snapshotIconTransitioningVertexData(i,r){let a=2*i;return this.iconTransitioningVertexArray.uint16.slice(a,a+2*r)}restoreIconTransitioningVertexData(i,r){this.iconTransitioningVertexArray.uint16.set(r,2*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,hK.members,!!s),this.indexBuffer=i.createIndexBuffer(this.indexArray,r),this.dynamicLayoutVertexBuffer=i.createVertexBuffer(this.dynamicLayoutVertexArray,hQ.members,!0),this.opacityVertexBuffer=i.createVertexBuffer(this.opacityVertexArray,dE,!0),this.iconTransitioningVertexArray.length>0&&(this.iconTransitioningVertexBuffer=i.createVertexBuffer(this.iconTransitioningVertexArray,h3.members,!0)),this.globeExtVertexArray.length>0&&(this.globeExtVertexBuffer=i.createVertexBuffer(this.globeExtVertexArray,hJ.members,!0)),!this.zOffsetVertexBuffer&&(this.zOffsetVertexArray.length>0||o)&&(this.zOffsetVertexBuffer=i.createVertexBuffer(this.zOffsetVertexArray,h0.members,!0)),!this.orientationVertexBuffer&&this.orientationVertexArray&&this.orientationVertexArray.length>0&&(this.orientationVertexBuffer=i.createVertexBuffer(this.orientationVertexArray,h2.members,!0)),this.opacityVertexBuffer.itemSize=1,this.featureIdArray.length>0&&(this.featureIdBuffer=i.createVertexBuffer(this.featureIdArray,h1.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())}}nH(dD,"SymbolBuffers",{omit:["cachedBatchIndices","cachedBatchSegments"]});class dL{constructor(i,r,a){this.layoutVertexArray=new i,this.layoutAttributes=r,this.indexArray=new a,this.segments=new lO,this.collisionVertexArray=new lr,this.collisionVertexArrayExt=new s8}upload(i){this.layoutVertexBuffer=i.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=i.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=i.createVertexBuffer(this.collisionVertexArray,h5.members,!0),this.collisionVertexBufferExt=i.createVertexBuffer(this.collisionVertexArrayExt,h4.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy(),this.collisionVertexBufferExt.de
7stroy())}}nH(dL,"CollisionBuffers");class dz{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.placementIdRangeStart=null,this.placementVariantVisible=[],this.collisionCircleArray=[],this.placementInvProjMatrix=er([]),this.placementViewportMatrix=er([]);let r=this.layers[0]._unevaluatedLayout._values;this.worldview=i.worldview,this.localizable=i.localizable,this.maxUniformBufferBindings=i.maxUniformBufferBindings,this.maxUniformBlockSizeDwords=i.maxUniformBlockSizeDwords,this.textSizeData=uf(this.zoom,r["text-size"],this.worldview,i.availableImages),this.iconSizeData=uf(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=>uh[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.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 dD(new l9(this.layers,{zoom:this.zoom,lut:this.lut},i=>i.startsWith("text")||i.startsWith("symbol"))),this.icon=new dD(new l9(this.layers,{zoom:this.zoom,lut:this.lut},i=>i.startsWith("icon")||i.startsWith("symbol"))),this.text.uboBinder=new ul(this.layers[0],this.zoom,this.lut,!0,"",this.maxUniformBufferBindings,this.maxUniformBlockSizeDwords),this.icon.uboBinder=new ul(this.layers[0],this.zoom,this.lut,!1,"",this.maxUniformBufferBindings,this.maxUniformBlockSizeDwords),this.glyphOffsetArray=new lE,this.lineVertexArray=new lI,this.symbolInstances=new lS}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=up[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=uf(this.zoom,u,this.worldview,o),d=u_(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 oC(i,{worldview:this.worldview}),n),l=u.possiblyEvaluate(new oC(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 oC(this.zoom,{worldview:this.worldview}),n).evaluate(a,{},n,o)),h*s}updateFootprints(i,r){}hideSymbolVariant(i,r){this._setSymbolVariantVisibility(i,!1)}showSymbolVariant(i,r){this._setSymbolVariantVisibility(i,!0)}_initPlacementOpacities(){let i=i=>{let r=i.layoutVertexArray.length/4;for(let a=0;a<r;a++)i.opacityVertexArray.emplaceBack(0)};this.hasTextData()&&i(this.text),this.hasIconData()&&i(this.icon)}_setSymbolVariantVisibility(i,r){let a=i.symbolId.symbolId-this.placementIdRangeStart,n=this.symbolInstances.get(a);this.placementVariantVisible[a]=r;let o=0xffffffff*!!r,s=(i,r)=>{if(r<0)return;let a=i.placedSymbolArray.get(r),n=a.vertexStartIndex/4;for(let r=0;r<a.numGlyphs;r++)i.opacityVertexArray.emplace(n+r,o);i.opacityVertexBuffer&&i.opacityVertexBuffer.updateData(i.opacityVertexArray)};this.hasTextData()&&s(this.text,this.defaultPlacedTextSymbolIndex(n,a)),this.hasIconData()&&s(this.icon,n.placedIconSymbolIndex)}resetPlacementVisibility(){if(null===this.placementIdRangeStart)return;this.placementVariantVisible.fill(!1);let i=i=>{for(let r=0;r<i.opacityVertexArray.length;r++)i.opacityVertexArray.emplace(r,0);i.opacityVertexBuffer&&i.opacityVertexBuffer.updateData(i.opacityVertexArray)};this.hasTextData()&&i(this.text),this.hasIconData()&&i(this.icon)}addToPlacement(i,r,a,n,o,s,l,h,u,c,d,p){if(0===this.symbolInstances.length)return;if(p&&this.updateReplacement(l.tileID,p),!this.collisionArrays){if(!l.collisionBoxArray)return;this.deserializeCollisionBoxes(l.collisionBoxArray)}null===this.placementIdRangeStart&&(this.placementIdRangeStart=r.allocateRange(a,this.symbolInstances.length),this.placementVariantVisible=Array(this.symbolInstances.length).fill(!1),this._initPlacementOpacities());let f=this.placementIdRangeStart,m=this.layers[0];if(m.appearances&&m.appearances.length>0)return void tF("new placement: symbol appearances are not supported yet; hiding symbols");if("point"!==m.layout.get("symbol-placement"))return void tF("new placement: along-line symbol placement is not supported yet; hiding symbols");let _=!!m.layout.get("text-variable-anchor"),g=this.getProjection(),y="globe"!==g.name;y||tF("new placement: globe projection is not supported yet; hiding symbols");let x=l.tileID.toUnwrapped(),v=o.pitch>0,b={collisionRules:{},insertIntoCollisionGrid:!0},w=o.zoom,T=u_(this.iconSizeData,w),S=u_(this.textSizeData,w),E=m.paint.get("symbol-z-offset"),I="sea"===m.layout.get("symbol-elevation-reference"),A=!E.isConstant(),M=A?0:E.evaluate(null,{}),C=o.elevation,P=3*c,R=i=>{if(!i)return P;let r=u.get(o0(i,m.scope));return void 0!==r?r:(tF(`global placement: placement-group "${i}" does not match any placement-group layer; using the layer's implicit group`),P)},D=m.paint.get("placement-priority"),L=m.paint.get("placement-group"),z=!D.isConstant(),F=!L.isConstant(),O=z?0:D.evaluate(null,{}),B=F?P:R(L.evaluate(null,{})),k=z||F,N=A||k?l.latestFeatureIndex:null;N&&N.loadVTLayers();let V=N?N.sourceLayerCoder.decode(this.sourceLayerIndex):"",U=(i,r,a)=>{let n;if("road"===this.elevationType)n=I?a:a+cO.getAtTileOffset(l.tileID,new tr(i.tileAnchorX,i.tileAnchorY),C,null);else{let o=this.hdExt?this.hdExt.elevationFeatures[r.elevationFeatureIndex]:void 0;n=I?a:a+cO.getAtTileOffset(l.tileID,new tr(i.tileAnchorX,i.tileAnchorY),C,o)}if(!(n+=r.zOffset))return{x:i.projectedAnchorX,y:i.projectedAnchorY,z:i.projectedAnchorZ,elevated:!1};let[s,h,u]=g.upVector(l.tileID.canonical,i.tileAnchorX,i.tileAnchorY),c=g.upVectorScale(l.tileID.canonical,o.center.lat,o.worldSize).metersToTile;return{x:i.projectedAnchorX+s*n*c,y:i.projectedAnchorY+h*n*c,z:i.projectedAnchorZ+u*n*c,elevated:!0}},j=(r,a,l,u)=>{if(!r)return;let{x:c,y:d,z:p,elevated:f}=U(r,a,l),m=function(i,r,a,n,o,s,l,h,u){let c=[r,a,n,1],d=!1;n||o.pitch>0?(eW(c,c,i),h&&"globe"!==s.name&&(d=cN(h,r,a,n,u,o)>.9)):cF(c,c,i);let p=c[3];return{x:(c[0]/p+1)/2*o.width,y:(-c[1]/p+1)/2*o.height,perspectiveRatio:Math.min(.5+o.getCameraToCenterDistance(s)/p*.5,1.5),occluded:l&&c[2]>p||d}}(n,c,d,p,o,g,v||f,h,x);if(m.occluded||m.perspectiveRatio<=.55)return;let _=u(),y=s*m.perspectiveRatio,b=(r.x1*_-r.padding)*y+m.x,w=(r.y1*_-r.padding)*y+m.y,T=(r.x2*_+r.padding)*y+m.x,S=(r.y2*_+r.padding)*y+m.y;b<T&&w<S&&i.addGeometry({kind:"box",left:b,top:w,right:T,bottom:S})};for(let r=0;r<this.symbolInstances.length;r++){let n=this.symbolInstances.get(r);if(n.hasIconTextFit){tF("new placement: icon-text-fit is not supported yet; skipping symbols");continue}if(_&&(n.numHorizontalGlyphVertices>0||n.numVerticalGlyphVertices>0)){tF("new placement: text-variable-anchor is not supported yet; skipping symbols");continue}if(n.numVerticalGlyphVertices>0){tF("new placement: vertical text-writing-mode is not supported yet; skipping symbols");continue}let o=this.collisionArrays[r];if(!o.iconBox&&!o.textBox)continue;let s=!1;for(let i of this.activeReplacements)if(!cE(i,c,cz.Symbol,m.scope)&&!(i.min.x>n.tileAnchorX||n.tileAnchorX>i.max.x||i.min.y>n.tileAnchorY||n.tileAnchorY>i.max.y)&&(s=cL(cD(n.tileAnchorX,n.tileAnchorY,l.tileID.canonical,i.footprintTileId.canonical),i.footprint)))break;let h={symbolId:{styleLayerId:a,symbolIdOrigin:1,symbolId:f+r},variantIdx:0},u=N?N.loadFeature({featureIndex:n.featureIndex,sourceLayerIndex:this.sourceLayerIndex,bucketIndex:this.index,layoutVertexArrayOffset:0}):null,p=k&&u&&N?N.getId(u,V):void 0,g=void 0!==p&&d[String(p)]||dR,x=z&&u?D.evaluate(u,g):O,v=F&&u?R(L.evaluate(u,g)):B;if(i.startSymbolVariantProcessing(h,{placementSubgroupOrder:v,symbolPlacementPriority:x,symbolVariantVisibility:this.placementVariantVisible[r]?cG.VARIANT_VISIBLE:cG.SYMBOL_INVISIBLE,symbolPlacementType:1,styleLayerOrder:c,symbolDisplayOrder:0},b),y&&!s){let i=A&&u?E.evaluate(u,{}):M;j(o.iconBox,n,i,()=>this.getSymbolInstanceIconSize(T,w,n.placedIconSymbolIndex)),j(o.textBox,n,i,()=>this.getSymbolInstanceTextSize(S,n,w,r))}i.finishVariantProcessing()}}updateReplacement(i,r){if(r.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=r.updateTime;let a=r.getReplacementRegionsForTile(i.toUnwrapped(),!0);return!cC(this.activeReplacements,a)&&(this.activeReplacements=a,!0)}getResolvedImageFromTokens(i){return"string"==typeof i?rM.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=tv(r.scaleFactor||1,d,p),[m,_]=s.get("text-size-scale-range"),g=tv(r.scaleFactor||1,m,_),y=("constant"!==u.value.kind||u.value.value instanceof rI&&!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 oC(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=sN(c,_);if(!o._featureFilter.filter(E,A,a))continue;if(_||(A.geometry=sk(c,a,n)),l&&1!==c.type&&a.z<=5){let i=A.geometry,r=(i,r)=>.98078528056>eO(uX(i.x,i.y,a,1),uX(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];
7(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=rI.factory(r);(function(i){for(let r of i.sections)if(function(i){for(let r of i)if(oy(r.charCodeAt(0)))return!0;return!1}(r.text))return!0;return!1})(n)&&(this.hasRTLText=!0),(!this.hasRTLText||"unavailable"===oI()||this.hasRTLText&&oM.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()),oM.applyArabicShaping&&(i=oM.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,R={id:d,text:i,icon:u,index:p,sourceLayerIndex:m,geometry:A.geometry,properties:c.properties,type:dS[c.type],sortKey:P};if(this.features.push(R),this.featureAppearanceData.set(p,{id:d,properties:c.properties,usesAppearanceIconAsPlaceholder:C}),u){let i=M._unevaluatedLayout._values,{iconPrimary:r,iconSecondary:n}=uw(u,this.iconSizeData,i["icon-size"],a,this.zoom,R,this.pixelRatio,f,this.worldview,S);I(r),n&&(this.hasAnySecondaryIcon=!0,I(n))}let D=M.getAppearances();if(0!==D.length&&D.forEach(i=>{if(!i.getLayoutProperty("icon-image"))return;let{iconPrimary:r,iconSecondary:n}=this.getCombinedIconVariants(i,M,A,a,S,R,f);r&&(I(r),n&&(this.hasAnySecondaryIcon=!0,I(n)))}),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(uh.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=om(i.toString()),s=a.fontStack||r,l=T[s]=T[s]||{};this.calculateGlyphDependencies(a.text,l,n,this.allowVerticalPlacement,o)}}}"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||p.length>1){s(c);continue}let m=u(f,p,!1),_=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")?(this.elevationType="road",this.hdExt&&(this.hdExt.configureCrossSource(a,r.elevationParams,r.crossSourceElevationEnabled,r.terrainEnabled),r.elevationFeatures&&r.elevationFeatures.length>0&&this.hdExt.addElevationFeatures(r.elevationFeatures,a))):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)}getCombinedIconVariants(i,r,a,n,o,s,l){let h;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"],{iconPrimary:u,iconSecondary:c}=uw(h,uf(this.zoom,a,this.worldview,o),a,n,this.zoom,s,this.pixelRatio,l,this.worldview,o);return{iconPrimary:u,iconSecondary:c}}return{iconPrimary:void 0,iconSecondary:void 0}}getCombinedIconPrimary(i,r,a,n,o,s,l){return this.getCombinedIconVariants(i,r,a,n,o,s,l).iconPrimary}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={sortKey:void 0,text:void 0,icon:null,index:i.featureIndex,sourceLayerIndex:i.featureIndex,geometry:[],properties:r.properties,type:"Point",id:r.id},{iconPrimary:s,iconSecondary:y}=this.getCombinedIconVariants(g,c,n,l,h,a,d);if(!s)return{vertexOffsetDelta:0,hasChanges:!1};let x=s.toString(),v=this.iconAtlasPositions&&this.iconAtlasPositions.get(x);if(v){let{appearanceIconOffset:a,appearanceIconRotate:s}=ux(g,c,n,l,f,_,m,d),x=c.layout.get("icon-anchor").evaluate(n,p,l),b=uc(v,y?this.iconAtlasPositions&&this.iconAtlasPositions.get(y.toString()):void 0,a,x),w=v.sdf,T=c.layout.get("icon-text-fit").constantOr("none");"none"!==T&&r.textShaping&&r.iconTextFitPadding&&r.fontScale&&(b=ud(b,r.textShaping,T,r.iconTextFitPadding,a,r.fontScale));
7let S=1+(Math.min(32640,Math.round(128*this.calculateEffectiveAppearanceIconSize(g,u.zoom,n,l,h,d,m)))<<1),E=dy(b,s,w,"none"!==T,d),I=this.icon.iconTransitioningVertexArray.length>0;r.isUsingAppearanceIconVertexData||(r.isUsingAppearanceIconVertexData=!0,r.layoutBasedIconVertexData=this.icon.snapshotSymbolVertexData(o,i.numIconVertices),I&&(r.layoutBasedIconTransitioningVertexData=this.icon.snapshotIconTransitioningVertexData(o,i.numIconVertices)));let A=Math.floor(i.numIconVertices/4),M=Math.min(E.length,A),C=o,P=I?this.icon.iconTransitioningVertexArray.uint16:null;for(let a=0;a<M;++a){let n=E[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;if(this.icon.updateSymbolVertexData(C,o,s,Math.round(32*n.tl.x),Math.round(32*n.tl.y),n.texPrimary.x,n.texPrimary.y,0,S,l,h,d,p),this.icon.updateSymbolVertexData(C+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,S,u,h,d,p),this.icon.updateSymbolVertexData(C+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,S,l,c,d,p),this.icon.updateSymbolVertexData(C+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,S,u,c,d,p),P){let i=n.texSecondary?n.texSecondary:n.texPrimary,r=2*C;P[r]=i.x,P[r+1]=i.y,P[r+2]=i.x+i.w,P[r+3]=i.y,P[r+4]=i.x,P[r+5]=i.y+i.h,P[r+6]=i.x+i.w,P[r+7]=i.y+i.h}C+=4}let R=i.numIconVertices-4*M;for(let i=0;i<R;++i)this.icon.updateSymbolVertexData(C+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.layoutBasedIconTransitioningVertexData&&this.icon.restoreIconTransitioningVertexData(o,r.layoutBasedIconTransitioningVertexData),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}=uv(w,h,n,l,p,m,f);r.fontScale=uT(b,r.textScaleFactor);let T=w.getUnevaluatedLayoutProperty("text-size"),S=this.textSizeData,E=y,I=x;w.hasLayoutProperty("text-size")&&(S=uf(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=dw(0,r.textShaping,a,h,!1,n,c,this.allowVerticalPlacement,s),R=b&&"composite"===S.kind?T.possiblyEvaluate(new oC(E,{}),l).evaluate(n,d,l):_,D=b&&"composite"===S.kind?T.possiblyEvaluate(new oC(I,{}),l).evaluate(n,d,l):g,L=uS(w.name,S,b,u,R,D),z=1+(Math.min(32640,Math.round((Array.isArray(L)?L[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
7)),a.texPrimary.x,a.texPrimary.y,0,z,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,z,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,z,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,z,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)for(let n of[this.text.uboBinder,this.icon.uboBinder])n&&!n.isLightConstant&&n.updateDynamicExpressions(o[0],r,h,a,i,l);else if(Object.keys(i).length>0){let n=o[0],s=[this.text.uboBinder,this.icon.uboBinder].filter(i=>i&&i.hasStateDependentPaint(n));if(s.length>0){let o=new Set(Object.keys(i).map(i=>{let r=Number(i);return!isNaN(r)&&Number.isSafeInteger(r)&&String(r)===i?r:i}));for(let u of s)u.updateFeatures(o,n,r,h,a,i,l)}}}}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 dT(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=tv(1,i,r)}let x=1,v=0,b=!1;
7if(c){let[i,r]=p.get("text-size-scale-range");x=tv(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 rA(i.toString());w.set(a.toString(),r)}}let T=[this.text.uboBinder,this.icon.uboBinder];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 S=l.id,E=void 0!==S?h[String(S)]:void 0,I={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:I,canonical:i,featureState:E})):-1;o=r>=0?r:-1}let A=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:E,availableImages:a,textScaleFactor:x,imageMap:w,layoutTextOffset:p.get("text-offset").evaluate(I,E,i).map(i=>24*i),layoutTextSize:r.evaluate(I,E,i),layoutTextRotate:p.get("text-rotate").evaluate(I,E,i),layoutMinZoomSize:r.evaluate(I,{zoom:n},i),layoutMaxZoomSize:r.evaluate(I,{zoom:h},i),layoutTextSizeMinZoom:n,layoutTextSizeMaxZoom:h},c=this.updateSymbolInstanceTextVertices(s,l,o,I,v,u);v+=c.vertexOffsetDelta,b=b||c.hasChanges}if(u){let r={canonical:i,layer:d,featureState:E,availableImages:a,globalProperties:n,iconScaleFactor:m,layoutIconOffset:p.get("icon-offset").evaluate(I,E,i),layoutIconSize:p.get("icon-size").evaluate(I,E,i,a),layoutIconRotate:p.get("icon-rotate").evaluate(I,E,i)},h=this.updateSymbolInstanceIconVertices(s,l,o,I,_,r);_+=h.vertexOffsetDelta,g=g||h.hasChanges}if(A){let r=s.featureIndex,l=n?n.brightness:null,h=E||{},u=o>=0?d.appearances[o]:null;for(let n of T)n&&(n.layer=d,y=n.updateFeaturePaintForAppearance(r,I,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),g&&this.icon.iconTransitioningVertexBuffer&&this.icon.iconTransitioningVertexArray.length>0&&this.icon.iconTransitioningVertexArray.length===this.icon.iconTransitioningVertexBuffer.length&&this.icon.iconTransitioningVertexBuffer.updateData(this.icon.iconTransitioningVertexArray),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=cT(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===uh.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:R,isSDF:D,sectionIndex:L}=r[n],z=S.vertexLength,F=R[1];if(dI(b,u.x,u.y,o.x,F+o.y,p.x,p.y,a,D,x.x,x.y,E,I),dI(b,u.x,u.y,l.x,F+l.y,p.x+p.w,p.y,a,D,T.x,x.y,E,I),dI(b,u.x,u.y,c.x,F+c.y,p.x,p.y+p.h,a,D,x.x,T.y,E,I),dI(b,u.x,u.y,d.x,F+d.y,p.x+p.w,p.y+p.h,a,D,T.x,T.y,E,I),h){let{x:r,y:a,z:n}=h.anchor,[o,s,l]=h.up;dM(w,r,a,n,o,s,l),dM(w,r,a,n,o,s,l),dM(w,r,a,n,o,s,l),dM(w,r,a,n,o,s,l),dP(i.dynamicLayoutVertexArray,r,a,n,A)}else dP(i.dynamicLayoutVertexArray,u.x,u.y,u.z,A);if(g){let r=y||p;dA(i.iconTransitioningVertexArray,r.x,r.y),dA(i.iconTransitioningVertexArray,r.x+r.w,r.y),dA(i.iconTransitioningVertexArray,r.x,r.y+r.h),dA(i.iconTransitioningVertexArray,r.x+r.w,r.y+r.h)}if(v.emplaceBack(z,z+1,z+2),v.emplaceBack(z+1,z+2,z+3),S.vertexLength+=4,S.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(R[0]),(n===r.length-1||L!==r[n+1].sectionIndex)&&(i.uboBinder||i.programConfigurations.populatePaintArrays(b.length,s,s.index,{},f,m,_,M&&M[L],this.worldview),i.uboBinder)){let r=i.uboBinder.populateUBO(s,s.index,m,f,_,M&&M[L]);P=r;let a=b.length-C;for(let n=0;n<a;n++)i.featureIdArray.emplaceBack(r);C=b.length}}let R=x-r.length;if(0!==R&&(this._addNullVertices(R,b,a,h,w,i,g,S,v),i.uboBinder&&P>=0)){let r=4*R;for(let a=0;a<r;a++)i.featureIdArray.emplaceBack(P)}
7let D=h?h.anchor:u;i.placedSymbolArray.emplaceBack(D.x,D.y,D.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++)dI(r,0,0,0,0,0,0,a,!1,0,0,0,0),n&&dM(o,0,0,0,0,0,0),dP(s.dynamicLayoutVertexArray,0,0,0,0),l&&dA(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 tr(i.x1,i.y1)),this._commitLayoutVertex(a.layoutVertexArray,n,o,s,c,d,new tr(i.x2,i.y1)),this._commitLayoutVertex(a.layoutVertexArray,n,o,s,c,d,new tr(i.x2,i.y2)),this._commitLayoutVertex(a.layoutVertexArray,n,o,s,c,d,new tr(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 dL(lt,h6.members,s7),this.iconCollisionBox=new dL(lt,h6.members,s7);let n=u_(this.iconSizeData,i),o=u_(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)}}defaultPlacedTextSymbolIndex(i,r){return i.rightJustifiedTextSymbolIndex>=0?i.rightJustifiedTextSymbolIndex:i.centerJustifiedTextSymbolIndex>=0?i.centerJustifiedTextSymbolIndex:i.leftJustifiedTextSymbolIndex>=0?i.leftJustifiedTextSymbolIndex:i.verticalPlacedTextSymbolIndex>=0?i.verticalPlacedTextSymbolIndex:r}getSymbolInstanceTextSize(i,r,a,n){let o=this.defaultPlacedTextSymbolIndex(r,n),s=this.text.placedSymbolArray.get(o),l=um(this.textSizeData,i,s)/24;return this.tilePixelRatio*l}getSymbolInstanceIconSize(i,r,a){let n=this.icon.placedSymbolArray.get(a),o=um(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=u_(this.iconSizeData,i,n),s=u_(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.sortFeaturesByY=!1;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)}}}nH(dz,"SymbolBucket",{omit:["layers","collisionBoxArray","compareText","features"]}),dz.addDynamicAttributes=dP;class dF extends hr{constructor(i,r,a){super(i,r,a),this.elevatedLayoutVertexArray=new sX}upload(i){let r=this.uploaded;super.upload(i),!r&&this.elevatedLayoutVertexArray.length>0&&(this.elevatedLayoutVertexBuffer=i.createVertexBuffer(this.elevatedLayoutVertexArray,lL.members))}destroy(){this.elevatedLayoutVertexBuffer&&this.elevatedLayoutVertexBuffer.destroy(),super.destroy()}}nH(dF,"ElevatedFillBufferData");class dO{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 dO;let r=[];for(let a of i)r.push(...a.portals);if(0===r.length)return new dO;for(let i of r){let r=i.va,a=i.vb;(dO.isOnBorder(r.x,a.x)||dO.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 dO;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}}}nH(dO,"ElevationPortalGraph");class dB{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,n=0){if(0===i.length)return;let o=ex(),s=ex();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=a[i[l+1]]+n,p=a[i[l+2]]+n;eT(o,h.x,h.y,a[i[l+0]]+n);let f=this.addVertex(o,s);eT(o,u.x,u.y,d);let m=this.addVertex(o,s);eT(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 dk{constructor(i,r,a,n){this.unevaluatedPortals=new dO,this.bridgeFeatureSections=[],this.tunnelFeatureSections=[],this.vertexHashLookup=new Map,this.unevalVertices=[],this.unevalHeights=[],this.unevalTriangles=[],this.unevalTunnelTriangles=[],this.unevalEdges=[],this.vertexPositions=new sY,this.vertexNormals=new sK,this.indexArray=new la,this.tileToMeters=sz(i),this.bridgeProgramConfigurations=new l9(r,{zoom:a,lut:n},i=>"fill-tunnel-structure-color"!==i),this.tunnelProgramConfigurations=new l9(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 tr(o.min.x,o.min.y),new tr(o.max.x,o.min.y),new tr(o.max.x,o.max.y),new tr(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||hS(c,d,l))||this.isOnBorder(c.x,d.x)||this.isOnBorder(c.y,d.y))continue;let p=dk.computeEdgeHash(this.unevalVertices[a],this.unevalVertices[u]),f,m=this.vertexHashLookup.get(dk.computePosHash(c));f=null!=m?m.next:null!=(m=this.vertexHashLookup.get(dk.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=dk.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=e4(h.x-l.x,h.y-l.y),c=e7(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=dk.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 _=dk.computePosHash(l);this.vertexHashLookup.has(_)||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 dB(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,this.unevalHeights,4),a(o),this.maskSegments=lO.simpleSegment(0,d.primitiveOffset,0,d.primitiveLength),this.depthSegments=lO.simpleSegment(0,s.primitiveOffset,0,s.primitiveLength),this.renderableBridgeSegments=lO.simpleSegment(0,l.primitiveOffset,0,l.primitiveLength),this.renderableTunnelSegments=lO.simpleSegment(0,c.primitiveOffset,0,c.primitiveLength),this.shadowCasterSegments=lO.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,lz.members),this.vertexBufferNormal=i.createVertexBuffer(this.vertexNormals,lF.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=dk.computePosHash(i[o]),c=dk.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=dk.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)=>eT(i,r[n].x,r[n].y,a[n]*h),d=ex(),p=ex(),f=ex(),m=ex(),_=ex(),g=(i,a)=>{let n=l.get(dk.computePosHash(r[a])),o=n.from,s=n.to;if(!o||!s)return;c(d,o),c(p,a),c(f,s),ej(m),eG(d,p)||(eE(_,p,d),eF(m,_)),eG(f,p)||(eE(_,f,p),eS(m,m,eF(_,_)));let h=eb(m);return h>0?eC(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=ex(),v=ex(),b=ex(),w=ex(),T=ex(),S=ex(),E=ex(),I=ex(),A=ex(),M=[ex(),ex(),ex(),ex()],C=[ex(),ex(),ex(),ex()],P=[{coord:new tr(0,0),height:0},{coord:new tr(0,0),height:0}],R=(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,R))continue;let[d,p]=P;if(eT(x,d.coord.x,d.coord.y,h*d.height),eT(v,p.coord.x,p.coord.y,h*p.height),eG(x,v))continue;eE(b,v,x),eF(b,b);let f=g(I,o.a)||b,m=g(A,o.b)||b;eT(w,f[1],-f[0],0),eF(w,w),eT(T,m[1],-m[0],0),eF(T,T),eB(I,w,f),eF(S,I),eB(I,T,m),eF(E,I),eS(M[0],x,eC(I,eE(I,w,S),u)),eS(M[1],x,eC(I,eS(I,w,S),u)),eS(M[2],x,eC(I,S,u)),M[3]=x,eS(C[0],v,eC(I,eE(I,T,E),u)),eS(C[1],v,eC(I,eS(I,T,E),u)),eS(C[2],v,eC(I,E,u)),C[3]=v,y=this.addFeatureSection(o.featureInfo.featureIndex,y,this.bridgeFeatureSections,i);let _=i.addVertex(M[0],w,s),D=i.addVertex(M[1],w,s),L=i.addVertex(C[0],T,s),z=i.addVertex(C[1],T,s);i.addTriangle(_,D,L),i.addTriangle(D,z,L);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),ez(w,w),ez(T,T);let N=i.addVertex(M[2],w,s),V=i.addVertex(M[3],w,s),U=i.addVertex(C[2],T,s),j=i.addVertex(C[3],T,s);i.addTriangle(N,V,U),i.addTriangle(V,j,U);let G=this.isTerminalVertex(o.a,l),Z=this.isTerminalVertex(o.b,l);d.height<.01&&G&&i.addQuad(M[3],M[2],M[1],M[0],ez(f,f),s),p.height<.01&&Z&&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=>eF(i,i),c=[{coord:new tr(0,0),height:0},{coord:new tr(0,0),height:0}],d=(i,r)=>i<r,p=ex(),f=ex(),m=ex(),_=ex(),g=ex();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(eT(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(eT(p,o.coord.x,o.coord.y,o.height),eT(f,h.coord.x,h.coord.y,h.height),eT(m,h.coord.x,h.coord.y,n[s].isTunnel?h.height+4:0),eT(_,o.coord.x,o.coord.y,n[s].isTunnel?o.height+4: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(eT(g,-(c.y-h.y),c.x-h.x,0));l=this.addFeatureSection(s.featureInfo.featureIndex,l,this.tunnelFeatureSections,i),i.addQuad(eT(p,c.x,c.y,0),eT(f,h.x,h.y,0),eT(m,h.x,h.y,a[s.a]+4),eT(_,c.x,c.y,a[s.b]+4),d),i.addQuad(eT(p,h.x,h.y,0),eT(f,c.x,c.y,0),eT(m,c.x,c.y,a[s.b]+4),eT(_,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=i9(h,s,i),u=i9(u,l,i),d=i9(d,c,i)}}else{let i=c/(c-d);s=i9(s,h,i),l=i9(l,u,i),c=i9(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(dk.computePosHash(i))<<32n|BigInt(dk.computePosHash(r))}static computePosHash(i){return((65535&i.x)<<16|65535&i.y)>>>0}}
7class dN{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 dV{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 dU=new dV((i,r,a)=>i.reset(r).require(hV,i=>{a.id=i}).optional("fixed_height_relative",i=>{a.constantHeight=i},dG.decodeRelativeHeight).geometry(i=>{a.bounds=i},tp).success(),(i,r,a)=>i.reset(r).require(hV,i=>{a.id=i}).require("elevation_idx",i=>{a.idx=i}).require("extent",i=>{a.extent=i}).require("height_relative",i=>{a.height=i},dG.decodeRelativeHeight).geometry(i=>{a.position=i},dG.getPoint).success()),dj=new dV((i,r,a)=>i.reset(r).require(hV,i=>{a.id=i}).optional("fixed_height",i=>{a.constantHeight=i},dG.decodeMetricHeight).geometry(i=>{a.bounds=i},tp).success(),(i,r,a)=>i.reset(r).require(hV,i=>{a.id=i}).require("elevation_idx",i=>{a.idx=i}).require("extent",i=>{a.extent=i}).require("height",i=>{a.height=i},dG.decodeMetricHeight).geometry(i=>{a.position=i},dG.getPoint).success());class dG{static getPoint(i){return e4(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?dj:void 0:dU}static parse(i){let r=[],a=[],n=i.length,o=new dN;for(let s=0;s<n;s++){let n=i.feature(s),l=n.properties.version,h=dG.getVersionSchema(l);if(void 0===h){tF(`Unknown elevation feature version number ${l||"(unknown)"}`);continue}let u=n.properties.type;if(!u)continue;let c=hd.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}}}let dZ=[e5(),e5(),e5(),e5(),e5(),e5(),e5()],d$=e5(),dH=e5();function dq(i){return[i[0],i[1]]}function dW(i){return e4(i[0],i[1])}class dX{constructor(i,r,a=null){this.feature=i,this.metersToTile=r,this.sampler=a,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,s=this.sampler?this.sampler.pointTransform(i.position):i.position;return[new tr(Math.trunc(s[0]+a*o),Math.trunc(s[1]+n*o)),new tr(Math.trunc(s[0]-a*o),Math.trunc(s[1]-n*o))]}next(){this.index++}valid(){return this.index<this.feature.vertices.length}}class dY{constructor(i,r,a,n,o,s){if(this.vertices=[],this.vertexProps=[],this.edges=[],this.edgeProps=[],this.id=i,this.heightRange={min:a,max:a},this.safeArea=r,this.constantHeight=a,null==this.constantHeight&&(null!=this.constantHeight||0!==n.length)){this.vertices=n,this.edges=o;for(let i=0;i<this.vertices.length;i++)this.vertices[i].index=void 0!==this.vertices[i].index?this.vertices[i].index:i;for(let i of(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:e4(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=e8(e5(),a,r),o=e7(n),s=e9(e5(),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;e6(l,l,s),e6(h,h,s)}for(let i of this.vertexProps)0===i.dir[0]&&0===i.dir[1]||te(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 i9(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 ew(0,0,1);let n=a[0],o=this.edges[n],s=this.edgeProps[n].vec,l=ew(s[0],s[1],(this.vertices[o.b].height-this.vertices[o.a].height)*r),h=ew(l[1],-l[0],0);eB(h,h,l);let u=eb(h);return u>0?eC(h,h,1/u):eT(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,_]=dZ;r=i.x,a=i.y,_[0]=r,_[1]=a;let g=new uM(_,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;e8(d,c,u),e8(p,_,u);let w=tt(d,d),T=w>0?tt(p,d)/w:0,S=tv(T,0,1),E=Math.abs((T-S)*this.edgeProps[i].len);e8(f,_,y),n=a[1],o=-a[0],m[0]=n,m[1]=o;let I=E+Math.abs(tt(f,m));I<l&&(s=i,l=I,h=S)}return[s,h]}tessellate(i){let r=ex(),a=ex(),n=ex(),o=ex();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(eT(r,u[0]/i,u[1]/i,c),eT(a,p[0]/i,p[1]/i,f),eT(n,_[1],-_[0],0),eC(n,n,d),eT(o,g[1],-g[0],0),eC(o,o,m),.0025000000000000005>=this.distSqLines(ew(r[0]+.5*n[0],r[1]+.5*n[1],r[2]+.5*n[2]),ew(a[0]-.5*o[0],a[1]-.5*o[1],a[2]-.5*o[2]),ew(r[0]-.5*n[0],r[1]-.5*n[1],r[2]-.5*n[2]),ew(a[0]+.5*o[0],a[1]+.5*o[1],a[2]+.5*o[2])))continue;let y=this.vertices.length,x=e6(e5(),u,p);this.vertices.push({position:e9(x,x,.5),height:.5*(c+f),extent:.5*(d+m),index:.5*((void 0!==this.vertices[l].index?this.vertices[l].index:l)+(void 0!==this.vertices[h].index?this.vertices[h].index:h))});let v=e6(e5(),_,g);this.vertexProps.push({dir:te(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=e8(e5(),this.vertices[y].position,u),w=e7(b),T={vec:b,dir:e9(e5(),b,1/w),len:w};this.edgeProps.push(T),this.edgeProps.push(T)}}distSqLines(i,r,a,n){let o=eE(ex(),r,i),s=eE(ex(),n,a),l=eE(ex(),i,a),h=eO(o,o),u=eO(o,s),c=eO(o,l),d=eO(s,s),p=eO(s,l),f=h*d-u*u;return 0===f?eD(ek(o,a,n,eO(l,s)/eO(s,s)),i):eD(ek(o,i,r,(u*p-c*d)/f),ek(s,a,n,(h*p-u*c)/f))}static serialize(i,r){var a;let n={id:i.id,heightRange:{min:i.heightRange.min,max:i.heightRange.max},safeArea:{min:{x:(a=i.safeArea).min.x,y:a.min.y},max:{x:a.max.x,y:a.max.y}}};return null!=i.constantHeight?n.constantHeight=i.constantHeight:0===i.vertices.length?(n.vertices=[],n.vertexProps=[],n.edges=[],n.edgeProps=[]):(n.vertices=i.vertices.map(i=>({position:dq(i.position),height:i.height,extent:i.extent,index:i.index})),n.vertexProps=i.vertexProps.map(i=>({dir:dq(i.dir)})),n.edges=i.edges.map(i=>({a:i.a,b:i.b})),n.edgeProps=i.edgeProps.map(i=>({vec:dq(i.vec),dir:dq(i.dir),len:i.len}))),n}static deserialize(i){var r;let a={min:new tr((r=i.safeArea).min.x,r.min.y),max:new tr(r.max.x,r.max.y)};if(null!=i.constantHeight)return new dY(i.id,a,i.constantHeight);if(!i.vertices||0===i.vertices.length){let r=Object.create(dY.prototype);return r.id=i.id,r.constantHeight=void 0,r.heightRange={min:i.heightRange.min,max:i.heightRange.max},r.safeArea=a,r.vertices=[],r.vertexProps=[],r.edges=[],r.edgeProps=[],r}let n=Object.create(dY.prototype);return n.id=i.id,n.constantHeight=void 0,n.heightRange={min:i.heightRange.min,max:i.heightRange.max},n.safeArea=a,n.vertices=i.vertices.map(i=>({position:dW(i.position),height:i.height,extent:i.extent,index:i.index})),n.vertexProps=(i.vertexProps||[]).map(i=>({dir:dW(i.dir)})),n.edges=(i.edges||[]).map(i=>({a:i.a,b:i.b})),n.edgeProps=(i.edgeProps||[]).map(i=>({vec:dW(i.vec),dir:dW(i.dir),len:i.len})),n}}class dK{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)}pointTransform(i){return e4(i[0]*this.zScale+this.xOffset,i[1]*this.zScale+this.yOffset)}pointTransformInPlace(i){i[0]=i[0]*this.zScale+this.xOffset,i[1]=i[1]*this.zScale+this.yOffset}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*tb(0,r,i>=0?i:Math.abs(.5*i))}}function dJ(i,r){let a=0,n=i.length-1;for(;a<=n;){let o=a+n>>1;i[o].feature.id<r?a=o+1:n=o-1}return a<i.length&&i[a].feature.id===r?a:-1}function dQ(i,r,a,n){if(!i.properties)return;let o=+i.properties[hV];if(Number.isNaN(o))return;if(r){let i=r.find(i=>i.id===o);if(i&&n)return{tileId:n,feature:i}}if(!a||0===a.length)return;let s=dJ(a,o);
7if(!(s<0)){if(n){for(let i=s;i<a.length&&a[i].feature.id===o;i++)if(a[i].tileId.key===n.key)return a[i]}return a[s]}}function d0(i,r){return i>r?1:i<r?-1:0}nH(dY,"ElevationFeature");class d1{constructor(i=d0,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;r&&(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}
7at(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 d1(a,o).load(i,r,n)}}let d2=(3+8881784197001252e-31)*11102230246251565e-32;function d3(i,r,a,n,o){let s,l,h,u,c=r[0],d=n[0],p=0,f=0;d>c==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 d5(i){return new Float64Array(i)}let d4=d5(4),d6=d5(8),d8=d5(12),d9=d5(16),d7=d5(4);function pe(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=!pt(r,a)||r.isVertical()?r.prevInResult:r)),i.resultTransition=pt(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 pt(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 pi{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 pi(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 pr(i,r){return i[0]===r[0]&&i[1]===r[1]}function pa(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,d4[0]=T-(x+p)+(p-E),p=(v=w+x)-w,x=(b=w-(v-p)+(x-p))-S,p=b-x,d4[1]=b-(x+p)+(p-S),p=(I=v+x)-v,d4[2]=v-(I-p)+(x-p),d4[3]=I;let R=function(i,r){let a=r[0];for(let i=1;i<4;i++)a+=r[i];return a}(0,d4),D=22204460492503146e-32*l;if(R>=D||-R>=D||(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)||(D=11093356479670487e-47*l+d2*Math.abs(R),(R+=A*d+P*h-(C*c+M*u))>=D||-R>=D))return R;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,d7[0]=T-(x+p)+(p-E),p=(v=w+x)-w,x=(b=w-(v-p)+(x-p))-S,p=b-x,d7[1]=b-(x+p)+(p-S),p=(I=v+x)-v,d7[2]=v-(I-p)+(x-p),d7[3]=I;let L=d3(4,d4,4,d7,d6);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,d7[0]=T-(x+p)+(p-E),p=(v=w+x)-w,x=(b=w-(v-p)+(x-p))-S,p=b-x,d7[1]=b-(x+p)+(p-S),p=(I=v+x)-v,d7[2]=v-(I-p)+(x-p),d7[3]=I;let z=d3(L,d6,4,d7,d8);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,d7[0]=T-(x+p)+(p-E),p=(v=w+x)-w,x=(b=w-(v-p)+(x-p))-S,p=b-x,d7[1]=b-(x+p)+(p-S),p=(I=v+x)-v,d7[2]=v-(I-p)+(x-p),d7[3]=I;let F=d3(z,d8,4,d7,d9);return d9[F-1]}
7(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)}function pn(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!==pa(a,i.otherEvent.point,r.otherEvent.point)?i.isBelow(r.otherEvent.point)?-1:1:!i.isSubject&&r.isSubject?1:-1}function po(i,r,a){let n=new pi(r,!1,i,i.isSubject),o=new pi(r,!0,i.otherEvent,i.isSubject);return pr(i.point,i.otherEvent.point)&&console.warn("what is that, a collapsed segment?",i),n.contourId=o.contourId=i.contourId,pn(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 ps(i,r){return i[0]*r[1]-i[1]*r[0]}function pl(i,r){return i[0]*r[0]+i[1]*r[1]}function ph(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=ps(o,s),c=u*u,d=pl(o,o);if(c>0){let r=ps(h,s)/u;if(r<0||r>1)return null;let n=ps(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=ps(h,o))*u)>0)return null;let p=pl(o,h)/d,f=p+pl(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&&(pr(i.point,r.point)||pr(i.otherEvent.point,r.otherEvent.point))||2===o&&i.isSubject===r.isSubject)return 0;if(1===o)return pr(i.point,n[0])||pr(i.otherEvent.point,n[0])||po(i,n[0],a),pr(r.point,n[0])||pr(r.otherEvent.point,n[0])||po(r,n[0],a),1;let s=[],l=!1,h=!1;return pr(i.point,r.point)?l=!0:1===pn(i,r)?s.push(r,i):s.push(i,r),pr(i.otherEvent.point,r.otherEvent.point)?h=!0:1===pn(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&&po(s[1].otherEvent,s[0].point,a),2):(h?po(s[0],s[1].point,a):s[0]!==s[3].otherEvent?(po(s[0],s[1].point,a),po(s[1],s[2].point,a)):(po(s[0],s[1].point,a),po(s[3].otherEvent,s[2].point,a)),3)}function pu(i,r){if(i===r)return 0;if(0!==pa(i.point,i.otherEvent.point,r.point)||0!==pa(i.point,i.otherEvent.point,r.otherEvent.point))return pr(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===pn(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===pn(i,r)?1:-1}class pc{constructor(){this.points=[],this.holeIds=[],this.holeOf=null,this.depth=null}isExterior(){return null==this.holeOf}}let pd=Math.max,pp=Math.min,pf=0;function pm(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 pi(u,!1,void 0,r),p=new pi(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),pn(d,p)>0?p.left=!0:d.left=!0;let h=u[0],f=u[1];o[0]=pp(o[0],h),o[1]=pp(o[1],f),o[2]=pd(o[2],h),o[3]=pd(o[3],f),n.push(d),n.push(p)}}let p_=[];function pg(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=p_:2===a?h=n:(1===a||3===a)&&(h=0===n.length?o:n)),h);if(p)return p===p_?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 r9(void 0,pn);for(h=0,u=i.length;h<u;h++)for(s=i[h],c=0,d=s.length;c<d;c++)(l=0===c)&&pf++,pm(s[c],!0,pf,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&&pf++,pm(s[c],!1,pf,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=p_:2===a?u=s:(1===a||3===a)&&(u=s.concat(l))),p=u)return p===p_?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===pn(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 pc;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 d1(pu),d=[],p=Math.min(n[2],o[2]);for(;0!==i.length;){let r=i.pop();
7if(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(pe(r,a,s),h&&2===ph(r,h.key,i)&&(pe(r,a,s),pe(h.key,r,s)),l&&2===ph(l.key,r,i)){let i=l;pe(a,(i=i!==u?c.prev(i):null)?i.key:null,s),pe(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&&ph(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 py(i,r=1){return[i.map(i=>i.map(i=>[i.x*r,i.y*r]))]}function px(i,r){let a=Math.floor(i)+.5;return Math.abs(i-a)<=r?Math.round(a):Math.round(i)}class pv{constructor(i){this.xs=[],this.ys=[],this.ixs=[],this.iys=[],this.buckets=new Map,this.tolerance=i}canonicalize(i,r){let a=this.tolerance,n=Math.floor(i/a),o=Math.floor(r/a);for(let s=-1;s<=1;s++){let l=this.buckets.get(n+s);if(l)for(let s=-1;s<=1;s++){let h=l.get(o+s);if(h){for(let s of h)if(Math.abs(this.xs[s]-i)<=a&&Math.abs(this.ys[s]-r)<=a){let a=this.ixs[s],l=this.iys[s];return this.xs[s]===i&&this.ys[s]===r||this.store(i,r,a,l,n,o),[a,l]}}}}let s=px(i,a),l=px(r,a);return this.store(i,r,s,l,n,o),[s,l]}store(i,r,a,n,o,s){let l=this.xs.length;this.xs.push(i),this.ys.push(r),this.ixs.push(a),this.iys.push(n);let h=this.buckets.get(o);h||(h=new Map,this.buckets.set(o,h));let u=h.get(s);u||(u=[],h.set(s,u)),u.push(l)}}function pb(i,r=1,a){let n=null!=a?new pv(a):null;return i.map(i=>i.map((i,a)=>{let o=i.map(i=>{let a=i[0]*r,o=i[1]*r;if(n){let[i,r]=n.canonicalize(a,o);return new tr(i,r)}return new tr(Math.round(a),Math.round(o))});return a>0&&o.reverse(),o}))}class pw{constructor(){this.frcCoverage=new Set,this.featureTriSegments=[],this.frcPerLevel=new Map,this.frcNonRoadSegments=new lO}empty(){return 0===this.frcCoverage.size}}function pT(i,r,a){if(0===i.frcCoverage.size||0===i.featureTriSegments.length)return;let n=a.get(),o=r.uint16,s=[];i.featureTriSegments.sort((i,r)=>i.segIdx!==r.segIdx?i.segIdx-r.segIdx:null===i.frc&&null===r.frc?0:null===i.frc?-1:null===r.frc?1:r.frc-i.frc);let l=new Map,h=0,u=i.featureTriSegments[0].frc,c={vertexOffset:n[h].vertexOffset,primitiveOffset:0,vertexLength:n[h].vertexLength,primitiveLength:0,vaos:{},sortKey:void 0},d=()=>{c.primitiveLength>0&&(l.has(u)||l.set(u,[]),l.get(u).push({...c}))};for(let r of i.featureTriSegments){r.segIdx!==h&&(d(),h=r.segIdx,u=r.frc,c={vertexOffset:n[h].vertexOffset,primitiveOffset:s.length/3,vertexLength:n[h].vertexLength,primitiveLength:0,vaos:{},sortKey:void 0}),r.frc!==u&&(d(),u=r.frc,c={...c,primitiveOffset:s.length/3,primitiveLength:0});for(let i=r.start;i<r.end;i++)s.push(o[i]);c.primitiveLength+=(r.end-r.start)/3}d();for(let i=0;i<s.length;i++)o[i]=s[i];for(let[r,a]of l)null!==r?i.frcPerLevel.set(r,new lO(a)):i.frcNonRoadSegments=new lO(a);i.featureTriSegments=[]}nH(pw,"FrcSegmentData");let pS={motorway:0,motorway_link:0,trunk:1,trunk_link:1,primary:2,primary_link:2,secondary:3,secondary_link:3,tertiary:4,tertiary_link:4,unclassified:5,unclassified_link:5,street:6,street_limited:6,residential:6,service:7,living_street:7,pedestrian:8,track:8,path:8,footway:8,cycleway:8,sidewalk:8,crossing:8};function pE(i){for(let r of["class","incident_class"]){let a=i[r];if("string"!=typeof a)continue;let n=pS[a];if(void 0!==n)return n}return null}function pI(i,r,a){for(let n of i)if(n.startsWith("(")){let i=n.indexOf(")");if(-1===i)continue;if(n.slice(1,i)===r&&n.slice(i+1)===a)return!0}else if(n===a)return!0;return!1}class pA{constructor(i,r,a){this.elevationMode=r,r&&(this.elevationBufferData=new dF(i.layers,i.zoom,i.lut)),a&&(this.frcData=new pw)}isEmpty(){let i=!this.elevationBufferData||this.elevationBufferData.isEmpty(),r=!this.frcData||this.frcData.empty();return i&&r}needsUpload(){return!!this.elevationBufferData&&this.elevationBufferData.needsUpload()}trackFeatureFrc(i){if(!this.frcData)return null;let r=pE(i||{});return null!==r&&this.frcData.frcCoverage.add(r),r}recordFeatureRange(i,r,a,n){if(!this.frcData||a<=r)return;
7let o=i.bufferData.triangleSegments.get();this.frcData.featureTriSegments.push({start:3*r,end:3*a,segIdx:o.length>0?o.length-1:0,frc:n})}buildFrcSegments(i){this.frcData&&!this.frcData.empty()&&pT(this.frcData,i.bufferData.indexArray,i.bufferData.triangleSegments)}handleFeature(i,r,a,n,o,s){let l=[];if(!this.elevationMode)return!1;let h=dQ(i,o,void 0,n);if(!h)return!1;{let i=this.clipPolygonsToTile(r,1);i.length>0&&l.push({polygons:i,elevationFeature:h.feature,elevationTileID:h.tileId})}let u={guardRailEnabled:s.layers[0].layout.get("fill-construct-bridge-guard-rail").evaluate(i,{},n),featureIndex:a};for(let r of l)if(r.elevationFeature){if("hd-road-base"===this.elevationMode){this.elevatedStructures||(this.elevatedStructures=new dk(r.elevationTileID,s.layers,s.zoom,s.lut));let a=r.elevationFeature.isTunnel(),n=0;Object.hasOwn(i.properties,hU)&&(n=+i.properties[hU]),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 dK(n,r.elevationTileID);this.addElevatedGeometry(s,r.polygons,o,r.elevationFeature,.05*("hd-road-base"!==this.elevationMode),a,u)}return!0}populatePaintArrays(i,r,a,n,o,s,l){this.elevationBufferData&&this.elevationBufferData.populatePaintArrays(i,r,a,n,o,s,l)}update(i,r,a,n,o,s,l,h){this.elevationBufferData&&this.elevationBufferData.update(i,r,a,n,o,s,l,h),this.elevatedStructures&&this.elevatedStructures.update(i,r,a,n,o,s,l,h)}updateExpressions(i){this.elevationBufferData&&this.elevationBufferData.programConfigurations.updateExpressions(i),this.elevatedStructures&&(this.elevatedStructures.bridgeProgramConfigurations.updateExpressions(i),this.elevatedStructures.tunnelProgramConfigurations.updateExpressions(i))}upload(i){this.elevationBufferData&&this.elevationBufferData.upload(i),this.elevatedStructures&&this.elevatedStructures.upload(i)}destroy(){this.elevationBufferData&&this.elevationBufferData.destroy(),this.elevatedStructures&&this.elevatedStructures.destroy()}getUnevaluatedPortalGraph(){return this.elevatedStructures?this.elevatedStructures.unevaluatedPortals:void 0}setEvaluatedPortalGraph(i,r,a,n,o,s){this.elevatedStructures&&(this.elevatedStructures.construct(i),this.elevatedStructures.populatePaintArrays(r,a,n,o,s))}addElevatedGeometry(i,r,a,n,o,s,l){let[h,u]=i.addGeometry(r,this.elevationBufferData,{elevation:n,elevationSampler:a,bias:o,index:s,featureInfo:l},this.elevatedStructures);null==this.elevationBufferData.heightRange?this.elevationBufferData.heightRange={min:h,max:u}:(this.elevationBufferData.heightRange.min=Math.min(this.elevationBufferData.heightRange.min,h),this.elevationBufferData.heightRange.max=Math.max(this.elevationBufferData.heightRange.max,u))}prepareElevatedPolygons(i,r,a){let n=1/sz(a),o=[];for(let a of i){let i=function(i,r,a=0){let n=py(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=pg(n,o,2)),pb(n,152587890625e-16,.001)}(a,new dX(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=tp(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 tr(a,n),new tr(o,n),new tr(o,s),new tr(a,s),new tr(a,n)];for(let i of u)h.push(...function(i,r){let a=pg(py(i),py([r]),0);return null==a?[]:pb(a)}(i,c));return h}}nH(pA,"FillHDExtension"),nH(dk,"ElevatedStructures");class pM{constructor(i,r){this.elevationEnabled=i,this.hasDeferredElevationFeatures=!1,r&&(this.frcData=new pw)}isEmpty(){let i=!this.elevationEnabled||void 0===this.heightRange,r=!this.frcData||this.frcData.empty();return i&&r}trackFeatureFrc(i){if(!this.frcData)return null;let r=pE(i||{});return null!==r&&this.frcData.frcCoverage.add(r),r}recordFeatureRange(i,r,a,n){if(!this.frcData||a<=r)return;let o=i.segments.get();this.frcData.featureTriSegments.push({start:3*r,end:3*a,segIdx:o.length>0?o.length-1:0,frc:n})}buildFrcSegments(i){this.frcData&&!this.frcData.empty()&&pT(this.frcData,i.indexArray,i.segments)}
7handleFeature(i,r,a,n,o,s,l,h,u,c,d){if(!this.elevationEnabled)return!1;if(!d.terrainEnabled){let p=dQ(i,n,o?o.registry:void 0,a),f=null!=i.properties&&Object.hasOwn(i.properties,hV)&&!Number.isNaN(+i.properties[hV]);if(!p&&f&&s&&(!o||!o.allProvidersReady))return this.hasDeferredElevationFeatures=!0,!0;if(p){let n=p.feature,s=p.tileId;if(!p.tileId.equals(a)){let r=this.mergedFeatureCache?this.mergedFeatureCache.get(n.id):void 0;if(r)n=r,s=a;else{let r=function(i,r,a){if(!i.properties||!r||0===r.length)return[];let n=+i.properties[hV];if(Number.isNaN(n))return[];let o=dJ(r,n);if(o<0)return[];let s=[];for(let i=o;i<r.length&&r[i].feature.id===n;i++){let n=r[i];(n.tileId.isChildOf(a)||a.isChildOf(n.tileId)||null!=n.feature.constantHeight)&&s.push(n)}return s}(i,o?o.registry:void 0,a);r.length>1&&(n=function(i,r){let a=r.slice().sort((i,r)=>r.tileId.z-i.tileId.z),n=new tr(1/0,1/0),o=new tr(-1/0,-1/0),s=[];for(let r of a){let a=new dK(r.tileId,i);for(let i of r.feature.vertices)s.push({position:a.pointTransform(i.position),height:i.height,extent:i.extent,index:i.index});let l=r.feature.safeArea;d$[0]=l.min.x,d$[1]=l.min.y,dH[0]=l.max.x,dH[1]=l.max.y,a.pointTransformInPlace(d$),a.pointTransformInPlace(dH),n.x=Math.min(n.x,d$[0],dH[0]),n.y=Math.min(n.y,d$[1],dH[1]),o.x=Math.max(o.x,d$[0],dH[0]),o.y=Math.max(o.y,d$[1],dH[1])}let l={min:n,max:o};if(null!=a[0].feature.constantHeight)return new dY(a[0].feature.id,l,a[0].feature.constantHeight);s.sort((i,r)=>i.index-r.index);let h=[];for(let i of s)0!==h.length&&h.at(-1).index===i.index||h.push(i);let u=[];for(let i=1;i<h.length;i++)h[i].index-h[i-1].index<=1&&u.push({a:i-1,b:i});let c=1/sz(i);return new dY(a[0].feature.id,l,void 0,h,u,c)}(a,r),s=a,this.mergedFeatureCache||(this.mergedFeatureCache=new Map),this.mergedFeatureCache.set(n.id,n))}}let f=hR(r,-1,-1,8193,8193);for(let r of this.prepareElevatedLines(f,n,s,a)){let o=d.layoutVertexArray.length;d.addLine(r,i,a,l,h,u,c);let p=new dK(a,s),f=d.showElevationIdDebug?function(i){if(0===i)return[0,0,0];let r=nf(i);return[r(),r(),r()]}(n.id):null;for(let i=o;i<d.layoutVertexArray.length;i++){let r=new tr(d.layoutVertexArray.int16[6*i]>>1,d.layoutVertexArray.int16[6*i+1]>>1),a=p.pointElevation(r,n,.05);this.updateHeightRange(a),i<d.zOffsetVertexArray.length?d.zOffsetVertexArray.float32[4*i]=a:d.zOffsetVertexArray.emplaceBack(a,0,0,0),f?i<d.elevationIdColVertexArray.length?(d.elevationIdColVertexArray.float32[3*i]=f[0],d.elevationIdColVertexArray.float32[3*i+1]=f[1],d.elevationIdColVertexArray.float32[3*i+2]=f[2]):d.elevationIdColVertexArray.emplaceBack(f[0],f[1],f[2]):d.showElevationIdDebug&&(i<d.elevationIdColVertexArray.length?(d.elevationIdColVertexArray.float32[3*i]=0,d.elevationIdColVertexArray.float32[3*i+1]=0,d.elevationIdColVertexArray.float32[3*i+2]=0):d.elevationIdColVertexArray.emplaceBack(0,0,0))}}return!0}if(f&&s&&o&&o.allProvidersReady&&o.hasCoveringTile)return!0}let p=!(!i.properties||!Object.hasOwn(i.properties,"mapbox_line_metrics"))&&i.properties.mapbox_line_metrics,f=d.layoutVertexArray.length,m=[],_=hR(r,-1,-1,8193,8193,m);for(let r=0;r<_.length;r++){let n=_[r],o=m[r],s={progress:{min:o.progress.min,max:o.progress.max},nextDir:o.nextPoint.sub(n.at(-2)).unit(),prevDir:n[1].sub(o.prevPoint).unit()};d.addLine(n,i,a,l,h,u,c,s,p&&o.parentIndex>0?o.parentIndex:null)}return d.fillNonElevatedRoadSegment(f),!0}prepareElevatedLines(i,r,a,n){if(null!=r.constantHeight)return i;let o=[],s=1/sz(n),l=a.equals(n)?null:new dK(a,n);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=hy(i,r,n),s=hy(i,r,a);if(Math.sign(o)===Math.sign(s))return;let l=hy(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 tr(i9(o.x,l.x,i),i9(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 dX(r,s,l),0,o);return o}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}}endPopulate(){this.mergedFeatureCache=void 0}}nH(pM,"LineHDExtension");class pC{constructor(){this.elevatedLayoutVertexArray=new sX,this.hasElevation=!1}beginFeature(i,r,a){let n=dQ(i,r,void 0,a);this.currentFeatureElevation=n?n.feature:void 0}writeVertexQuad(i,r){let a=this.currentFeatureElevation?this.currentFeatureElevation.pointElevation(new tr(i,r)):0;this.hasElevation=this.hasElevation||0!==a;for(let i=0;i<4;i++)this.elevatedLayoutVertexArray.emplaceBack(a)}finalize(){this.hasElevation||(this.elevatedLayoutVertexArray=void 0)}upload(i){this.elevatedLayoutVertexArray&&!this.elevatedLayoutVertexBuffer&&(this.elevatedLayoutVertexBuffer=i.createVertexBuffer(this.elevatedLayoutVertexArray,hW.members))}destroy(){this.elevatedLayoutVertexBuffer&&this.elevatedLayoutVertexBuffer.destroy()}}nH(pC,"CircleHDExtension");let pP=(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])};class pR{constructor(){this.elevationFeatures=[],this.elevationFeatureTileIds=[],this.elevationFeatureIdToIndex=new Map,this.elevationStateComplete=!1,this.hasDeferredElevationFeatures=!1,this.elevationParams=null,this.crossSourceElevationEnabled=!1,this.terrainEnabled=!1}configureCrossSource(i,r,a,n){this.consumerCanonical=i,this.elevationParams=r,this.crossSourceElevationEnabled=a,this.terrainEnabled=n}addElevationFeatures(i,r){for(let a of i)this.elevationFeatureIdToIndex.set(a.id,this.elevationFeatures.length),this.elevationFeatures.push(a),this.elevationFeatureTileIds.push(r)}resolveRoadElevation(i,r){let a=this.elevationFeatureIdToIndex.get(r);if(void 0!==a)return a;
7if(this.terrainEnabled||!this.crossSourceElevationEnabled)return 65535;let n=dQ(i,void 0,this.elevationParams?this.elevationParams.registry:void 0,this.consumerCanonical);if(n){let i=this.elevationFeatures.length;return this.elevationFeatureIdToIndex.set(r,i),this.elevationFeatures.push(n.feature),this.elevationFeatureTileIds.push(n.tileId),i}return this.elevationParams&&this.elevationParams.allProvidersReady?65535:(this.hasDeferredElevationFeatures=!0,"defer")}getElevationFeatureSampler(i,r){if(r.equals(i))return new dK(i,r);this.elevationFeatureSamplerCache||(this.elevationFeatureSamplerCache=new Map);let a=this.elevationFeatureSamplerCache.get(r.key);return a||(a=new dK(i,r),this.elevationFeatureSamplerCache.set(r.key,a)),a}isCrossTileRoadElevation(i,r){if(65535===i||i>=this.elevationFeatures.length)return!1;let a=this.elevationFeatureTileIds[i];return null!=a&&!a.equals(r)}getRoadFeatureHeightAtAnchor(i,r,a){if(65535===i||i>=this.elevationFeatures.length)return null;let n=this.elevationFeatures[i],o=this.elevationFeatureTileIds[i];return o.equals(a)?n.pointElevation(r):this.getElevationFeatureSampler(a,o).pointElevation(new tr(r.x,r.y),n,0)}sampleRoadFeatureHeight(i,r,a){let n=this.getRoadFeatureHeightAtAnchor(i,r,a);return null===n?void 0:n}clearWorkerState(){this.consumerCanonical=void 0,this.elevationParams=null,this.crossSourceElevationEnabled=!1,this.terrainEnabled=!1,this.elevationFeatureIdToIndex.clear()}updateRoadElevation(i,r){if(this.elevationStateComplete)return;this.elevationStateComplete=!0,i.hasAnyZOffset=!1;let a=!1,n=sz(r),o=1/n,s=!1,l=!1;for(let h=0;h<i.symbolInstances.length;
7h++){let u=i.symbolInstances.get(h),c=ew(1,0,0),d=ew(0,1,0),{numHorizontalGlyphVertices:p,numVerticalGlyphVertices:f,numIconVertices:m,numVerticalIconVertices:_}=u,g=p>0||f>0,y=m>0,x=u.elevationFeatureIndex,v=x<this.elevationFeatures.length?this.elevationFeatures[x]:void 0;if(v){let h=new tr(u.tileAnchorX,u.tileAnchorY),p=this.sampleRoadFeatureHeight(x,h,r),f=void 0!==p?.075+p:.075;u.zOffset!==f&&(a=!0,u.zOffset=f),0!==f&&(i.hasAnyZOffset=!0);let m=v.computeSlopeNormal(h,o),_=e3(eX(),ew(0,0,1),m);eU(c,c,_),eU(d,d,_),c[2]*=n,d[2]*=n,1===c[0]&&0===c[1]&&0===c[2]&&0===d[0]&&1===d[1]&&0===d[2]||(s=s||g,l=l||y)}if(g&&(pP(i.text.orientationVertexArray,p,c,d),pP(i.text.orientationVertexArray,f,c,d)),y){let{placedIconSymbolIndex:r,verticalPlacedIconSymbolIndex:a}=u;r>=0&&pP(i.icon.orientationVertexArray,m,c,d),a>=0&&pP(i.icon.orientationVertexArray,_,c,d)}}s||(i.text.orientationVertexArray=void 0),l||(i.icon.orientationVertexArray=void 0),a&&(i.zOffsetBuffersNeedUpload=!0,i.zOffsetSortDirty=!0)}getRoadFeatureHeightForPlacedSymbol(i,r,a,n,o){let s=i.symbolInstances.get(r.symbolInstanceIndices[a]);return this.getRoadFeatureHeightAtAnchor(s.elevationFeatureIndex,n,o)}getElevationFeatureForPlacedSymbol(i,r,a){let n=i.symbolInstances.get(r.symbolInstanceIndices[a]).elevationFeatureIndex;if(n<this.elevationFeatures.length)return this.elevationFeatures[n]}makeRoadSymbolElevationParams(i,r,a,n,o,s,l,h,u){let c=this.getElevationFeatureForPlacedSymbol(i,r,a),d=i.symbolInstances.get(r.symbolInstanceIndices[a]);return this.isCrossTileRoadElevation(d.elevationFeatureIndex,n.canonical)?{getElevation:o=>{let s=this.getRoadFeatureHeightForPlacedSymbol(i,r,a,o,n.canonical);return function(i,r,a,n,o,s){let l=n.upVector(r,a.x,a.y);return eC(l,l,i*n.upVectorScale(r,o,s).metersToTile),[l[0],l[1],l[2]]}(null!==s?s:0,n.canonical,o,l,h,u)},elevation:s,elevationFeature:null}:{getElevation:o,elevation:s,elevationFeature:void 0!==c?c:null}}}nH(pR,"SymbolHDExtension",{omit:["consumerCanonical","elevationParams","crossSourceElevationEnabled","terrainEnabled","hasDeferredElevationFeatures","elevationFeatureIdToIndex"]});let pD=null,pL=null,pz=null,pF=null,pO={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},pB={5120:"DT_INT8",5121:"DT_UINT8",5122:"DT_INT16",5123:"DT_UINT16",5125:"DT_UINT32",5126:"DT_FLOAT32"},pk={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16};function pN(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 pV="KHR_draco_mesh_compression",pU="EXT_meshopt_compression",pj=new TextDecoder("utf8");function pG(i,r){return new URL(i,r).href}async function pZ(i,r,a,n,o){let s=await fetch(pG(i.uri,n),{signal:o}),l=await s.arrayBuffer();r.buffers[a]=l}function p$(i,r){let a=i.json.bufferViews[r];return new Uint8Array(i.buffers[a.buffer],a.byteOffset||0,a.byteLength)}async function pH(i,r,a,n,o){if(i.uri){let s=pG(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([p$(r,i.bufferView)],{type:i.mimeType}),o=await createImageBitmap(n);r.images[a]=o}}async function pq(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(pj.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(pj.decode(new Uint8Array(i,r)));let{buffers:s,images:l,meshes:h,extensionsUsed:u,bufferViews:c}=o.json;if(s){let i=[];for(let r=0;r<s.length;r++){let l=s[r];l.uri?i.push(pZ(l,o,r,a,n)):o.buffers[r]||(o.buffers[r]=null)}await Promise.all(i)}n&&n.throwIfAborted();let d=[],p=u&&u.includes(pV),f=u&&u.includes(pU);if(p&&d.push(function(){if(!pD)return null!=pL||(pL=(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(t0())).then(i=>{pD=i,pL=null})),pL}()),f&&d.push(function(){var i;if(!pz)return null!=pF||(pF=(i=fetch(t1()),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=>{pz=i,pF=null})),pF}()),l)for(let i=0;i<l.length;i++)d.push(pH(l[i],o,i,a,n));if(d.length&&await Promise.all(d),n&&n.throwIfAborted(),p&&h)for(let{primitives:i}of h)for(let r of i)!function(i,r){let a=i.extensions&&i.extensions[pV];if(!a)return;let n=new pD.Decoder,o=p$(r,a.bufferView),s=new pD.Mesh;if(!n.DecodeArrayToMesh(o,o.byteLength,s))throw Error("Failed to decode Draco mesh");let l=r.json.accessors[i.indices],h=pO[l.componentType],u=l.count*h.BYTES_PER_ELEMENT,c=pD._malloc(u);for(let o of(h===Uint16Array?n.GetTrianglesUInt16Array(s,u,c):n.GetTrianglesUInt32Array(s,u,c),pN(pD.memory.buffer.slice(c,c+u),l,r),pD._free(c),Ob
7ject.keys(a.attributes))){let l=n.GetAttributeByUniqueId(s,a.attributes[o]),h=r.json.accessors[i.attributes[o]],u=pB[h.componentType],c=h.count*pk[h.type]*pO[h.componentType].BYTES_PER_ELEMENT,d=pD._malloc(c);n.GetAttributeDataArrayForAllPoints(s,l,pD[u],c,d),pN(pD.memory.buffer.slice(d,d+c),h,r),pD._free(d)}n.destroy(),s.destroy(),delete i.extensions[pV]}(r,o);if(f&&h&&c)for(let i of c)!function(i,r){if(!i.extensions||!i.extensions[pU])return;let a=i.extensions[pU],n=new Uint8Array(r.buffers[a.buffer],a.byteOffset||0,a.byteLength||0),o=new Uint8Array(a.count*a.byteStride);pz.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[pU]}(i,o);return o}async function pW(i,r){let{data:a}=await iy({url:i},r);return pq(a,0,i,r)}class pX{constructor(i,r,a,n){if(this.triangleCount=r.length/3,this.min=new tr(0,0),this.max=new tr(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=pY(Math.floor(Math.min(n.x,o.x,s.x)),this.xScale,this.cellsX),c=pY(Math.floor(Math.max(n.x,o.x,s.x)),this.xScale,this.cellsX),d=pY(Math.floor(Math.min(n.y,o.y,s.y)),this.yScale,this.cellsY),p=pY(Math.floor(Math.max(n.y,o.y,s.y)),this.yScale,this.cellsY),f=new tr(0,0),m=new tr(0,0),_=new tr(0,0),g=new tr(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,(hI(n,o,s,f,m,g)||hI(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=pY(i.x-this.min.x,this.xScale,this.cellsX),n=pY(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=pY(i.x-this.min.x,this.xScale,this.cellsX),o=pY(r.x-this.min.x,this.xScale,this.cellsX),s=pY(i.y-this.min.y,this.yScale,this.cellsY),l=pY(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 pY(i,r,a){return Math.max(0,Math.min(a-1,Math.floor(i*r)))}nH(pX,"TriangleGridIndex");let pK=sZ([{name:"a_pos_3f",components:3,type:"Float32"}]),pJ=sZ([{name:"a_color_3f",components:3,type:"Float32"}]),pQ=sZ([{name:"a_color_4f",components:4,type:"Float32"}]),p0=sZ([{name:"a_uv_2f",components:2,type:"Float32"}]),p1=sZ([{name:"a_uv_2f",components:2,type:"Uint16",normalized:!0}]),p2=sZ([{name:"a_normal_4n",components:4,type:"Int8",normalized:!0}]),p3=sZ([{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"}]),p5=sZ([{name:"a_feature",components:2,type:"Uint16"}]);function p4(i,r){let a=p8(i.projection,i.zoom,i.width,i.height),n=function(i,r,a,n,o){let s=new sA(a.lng-180*p9,a.lat),l=new sA(a.lng+180*p9,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=sF.fromLngLat(a);d.y=tv(d.y,-1+p9,1-p9);let p=d.toLngLat(),f=i.project(p.lng,p.lat),m=sF.fromLngLat(p);m.x+=p9;let _=m.toLngLat(),g=i.project(_.lng,_.lat),y=fe(g.x-f.x,g.y-f.y,c),x=sF.fromLngLat(p);x.y+=p9;let v=x.toLngLat(),b=i.project(v.lng,v.lat),w=fe(b.x-f.x,b.y-f.y,c),T=Math.abs(y.x)/Math.abs(w.y),S=er([]);
7ec(S,S,-c*(1-(o?0:n)));let E=er([]);return el(E,E,[1,1-(1-T)*n,1]),E[4]=-w.x/w.y*n,ec(E,E,c),eo(E,S,E),E}(i.projection,0,i.center,a,r),o=p6(i);return el(n,n,[o,o,1]),n}function p6(i){let r=i.projection,a=p8(i.projection,i.zoom,i.width,i.height);return Math.pow(2,p7(r,i.center)*a+(1-a)*p7(r,sA.convert(r.center)))}function p8(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 tb(s[0]+l,s[1]+l,r)}let p9=1/4e4;function p7(i,r){let a=tv(r.lat,-85.051129,85.051129),n=new sA(r.lng-180*p9,a),o=new sA(r.lng+180*p9,a),s=i.project(n.lng,a),l=i.project(o.lng,a),h=sF.fromLngLat(n),u=sF.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 fe(i,r,a){let n=Math.cos(a),o=Math.sin(a);return{x:i*n-r*o,y:i*o+r*n}}let ft=new Float64Array([1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,1]);function fi(i,r,a){er(i),ec(i,i,r[2]*tf),eh(i,i,r[0]*tf),eu(i,i,r[1]*tf),el(i,i,a),eo(i,i,ft)}function fr(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>eb(u)||1e-12>eb(c))return eY(i);let d=eB([],u,c);return eF(d,d),eE(c,n,r),u[2]=(s-o)*h,c[2]=(l-o)*h,eB(u,u,c),eF(u,u),e3(i,d,u)}function fa(i,r,a=!1){let n=u3(r.zoom),o=function(i,r,a){let n=r.worldSize,o=[i[12],i[13],i[14]],s=r0(o[1]/n),l=rQ(o[0]/n),h=er([]),u=1/sC(s)*n,c=1/sC(0)*n*sD(s,r.zoom),d=1/u0(n),p=c*d;if(a){let i=p8(r.projection,r.zoom,r.width,r.height,1024);p=d*r.projection.pixelSpaceConversion(r.center.lat,n,i)}let f=sE(s,l);eS(f,f,eC([],eF([],f),u*p*o[2]));let m=function(i){let r=[i[0],i[1],i[2]],a=[0,1,0],n=eB([],a,r);return eB(a,r,n),0===eL(a)&&eB(n,r,a=[0,1,0]),eF(n,n),eF(a,a),eF(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);el(h,h,[p,p,p*u]),es(h,h,[-o[0],-o[1],-o[2]]);let _=eo([],r.globeMatrix,m);return eo(_,_,h),eo(_,_,i),_}(i,r,a);return n>0?function(i,r,a){let n=(i,r,a)=>{let n=eb(i),o=eb(r),s=uZ(i,r,a);return eC(s,s,1/eb(s)*i9(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=uZ([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/sC(0)*a*sD(r.center.lat,r.zoom)/u0(a),o=1/sC(r.center.lat)*a,s=er([]);eu(s,s,r.center.lng*tf),eh(s,s,r.center.lat*tf),es(s,s,[0,0,sb]),el(s,s,[n,n,n*o]);let l=r.point;return es(s,s,[-l.x,-l.y,0]),eo(s,s,i),eo(s,r.globeMatrix,s)}(i,r),n):o}function fn(i,r,a,n){let o=uB.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(hm(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 tr(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}let fo=["","wall","door","roof","window","lamp","logo"],fs=[1,1,1];function fl(i,r,a,n,o,s,l,h,u,c=!1){let d=a.zoom,p=a.project(n),f=sD(n.lat,d),m=1/f;er(i),es(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 sF(p.x/y,p.y/y),0));let r=eW([],[p.x,p.y,i,1],a.projMatrix)[3]/a.cameraToCenterDistance;_=r,g=r*sD(a.center.lat,d)}else if("globe"===a.projection.name){let r=fa(i,a),o=[0,0,0,1];eW(o,o,eo([],a.projMatrix,r));let s=o[3]/a.cameraToCenterDistance,l=u3(d),h=a.projection.pixelsPerMeter(n.lat,y)*sD(n.lat,d),u=a.projection.pixelsPerMeter(a.center.lat,y)*sD(a.center.lat,d);_=s/i9(h,sR(a.center.lat),l),g=s*f/h,_*=u,g*=u}}else _=m;el(i,i,[_,_,g]);let x=[...i],v=r.orientation,b=[];if(fi(b,[v[0]+(o?o[0]:0),v[1]+(o?o[1]:0),v[2]+(o?o[2]:0)],s),eo(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=uB.projectAabbCorners(a,n),h=1/sC(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=eB(h,h,[l[0]-n[0],l[1]-n[1],r*(l[2]-n[2])]);eF(u,u),o.dotProductWithUp=eO(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 sF(c[0]/r.worldSize,c[1]/r.worldSize),0),_=s.getAtPointOrZero(new sF(d[0]/r.worldSize,d[1]/r.worldSize),0),g=s.getAtPointOrZero(new sF(p[0]/r.worldSize,p[1]/r.worldSize),0),y=s.getAtPointOrZero(new sF(f[0]/r.worldSize,f[1]/r.worldSize),0),x=(m+y)/2,v=(_+g)/2;return x>v?_<g?fr(i,d,f,c,_,y,m,h):fr(i,p,c,f,g,m,y,h):m<y?fr(i,c,d,p,m,_,g,h):fr(i,f,p,d,y,g,_,h),Math.max(x,v)}(s,a,r.aabb,i,n);let l=eo([],e_([],s),b);eo(i,x,l)}else o=a.elevation.getAtPointOrZero(new sF(p.x/y,p.y/y),0);0!==o&&(i[14]+=o)}}class fh{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 sA(a[0],a[1]):new sA(0,0),this.orientation=n??[0,0,0],this.nodes=o,this.uploaded=!1,this.aabb=new uB([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),this.matrix=[]}_applyTransformations(i,r){var a;eo(i.globalMatrix,r,i.localMatrix);let n=this.nodeOverrides.get(i.name);
7if(void 0!==n){if(n.orientation){let r=[];a=n.orientation,er(r),eu(r,r,a[1]*tf),ec(r,r,a[2]*tf),eh(r,r,a[0]*tf),eo(i.globalMatrix,i.globalMatrix,r)}n.minZoom&&(i.minZoom=n.minZoom),n.maxZoom&&(i.maxZoom=n.maxZoom)}if(i.meshes)for(let r of i.meshes){let a=uB.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=er([]);for(let r of(this.aabb=new uB([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){fl(this.matrix,this,i.transform,this.position,r,a,n,o,s,l)}upload(i){if(!this.uploaded){for(let r of this.nodes)fd(r,i);for(let i of this.nodes)ff(i);this.uploaded=!0}}destroy(){for(let i of this.nodes)f_(i)}}function fu(i,r,a=!1){i.uploaded||(i.gfxTexture=new de(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 fc(i,r,a){i.indexBuffer=r.createIndexBuffer(i.indexArray,!1,!0),i.vertexBuffer=r.createVertexBuffer(i.vertexArray,pK.members,!1,!0),i.normalArray&&(i.normalBuffer=r.createVertexBuffer(i.normalArray,p2.members,!1,!0)),i.texcoordArray&&(i.texcoordBuffer=r.createVertexBuffer(i.texcoordArray,(8===i.texcoordArray.bytesPerElement?p0:p1).members,!1,!0)),i.colorArray&&(i.colorBuffer=r.createVertexBuffer(i.colorArray,(12===i.colorArray.bytesPerElement?pJ:pQ).members,!1,!0)),i.featureArray&&(i.featureBuffer=r.createVertexBuffer(i.featureArray,p5.members,!1,!0)),i.segments=lO.simpleSegment(0,0,i.vertexArray.length,i.indexArray.length);let n=i.material;n.pbrMetallicRoughness.baseColorTexture&&fu(n.pbrMetallicRoughness.baseColorTexture,r),n.pbrMetallicRoughness.metallicRoughnessTexture&&fu(n.pbrMetallicRoughness.metallicRoughnessTexture,r),n.normalTexture&&fu(n.normalTexture,r),n.occlusionTexture&&fu(n.occlusionTexture,r,a),n.emissionTexture&&fu(n.emissionTexture,r)}function fd(i,r,a){if(i.meshes)for(let n of i.meshes)fc(n,r,a);if(i.lodMeshes)for(let n of i.lodMeshes)fc(n,r,a);if(i.children)for(let n of i.children)fd(n,r,a)}function fp(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 ff(i){if(i.meshes)for(let r of i.meshes)fp(r);if(i.lodMeshes)for(let r of i.lodMeshes)fp(r);if(i.children)for(let r of i.children)ff(r)}function fm(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.featureBuffer&&i.featureBuffer.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 f_(i){if(i.meshes)for(let r of i.meshes)fm(r);if(i.lodMeshes)for(let r of i.lodMeshes)fm(r);if(i.footprintDebugMesh&&(i.footprintDebugMesh.vertexBuffer.destroy(),i.footprintDebugMesh.indexBuffer.destroy(),i.footprintDebugMesh.segments.destroy()),i.children)for(let r of i.children)f_(r)}function fg(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 fy=[];class fx{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||!fg(this._nodes[0].aabbMin,this._nodes[0].aabbMax,i,r))return null;fy.length=0,fy.push(0);let a=-1/0;for(;fy.length>0;){let n=fy.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,R=l-x,D=h-v,L=u-b,z=M-E,F=C-I,O=P-A,B=R-M,k=D-C,N=L-P,V=E-R,U=I-D,j=A-L;if(_=Math.min(p=A*F-I*O,f=P*F-C*O,m=L*F-D*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=L*k-D*N),g=Math.max(p,f,m),_>(y=Math.abs(N)*T+Math.abs(k)*S)||g<-y)||(_=Math.min(p=A*U-I*j,f=P*U-C*j,m=L*U-D*j),g=Math.max(p,f,m),_>(y=Math.abs(j)*T+Math.abs(U)*S)||g<-y)||(_=Math.min(p=E*O-A*z,f=M*O-P*z,m=R*O-L*z),g=Math.max(p,f,m),_>(y=Math.abs(O)*w+Math.abs(z)*S)||g<-y)||(_=Math.min(p=E*N-A*B,f=M*N-P*B,m=R*N-L*B),g=Math.max(p,f,m),_>(y=Math.abs(N)*w+Math.abs(B)*S)||g<-y)||(_=Math.min(p=E*j-A*V,f=M*j-P*V,m=R*j-L*V),g=Math.max(p,f,m),_>(y=Math.abs(j)*w+Math.abs(V)*S)||g<-y)||(_=Math.min(p=I*z-E*F,f=C*z-M*F,m=D*z-R*F),g=Math.max(p,f,m),_>(y=Math.abs(F)*w+Math.abs(z)*T)||g<-y)||(_=Math.min(p=I*B-E*k,f=C*B-M*k,m=D*B-R
7*k),g=Math.max(p,f,m),_>(y=Math.abs(k)*w+Math.abs(B)*T)||g<-y)||(_=Math.min(p=I*V-E*U,f=C*V-M*U,m=D*V-R*U),g=Math.max(p,f,m),_>(y=Math.abs(U)*w+Math.abs(V)*T)||g<-y)||(_=Math.min(E,M,R),g=Math.max(E,M,R),_>w||g<-w)||(_=Math.min(I,C,D),g=Math.max(I,C,D),_>T||g<-T)||(_=Math.min(A,P,L),g=Math.max(A,P,L),_>S||g<-S))return!1;let G=F*N-O*k,Z=O*B-z*N,$=z*k-F*B;return y=w*Math.abs(G)+T*Math.abs(Z)+S*Math.abs($),!(Math.abs(-(G*E+Z*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=fg(h.aabbMin,h.aabbMax,i,r),d=fg(u.aabbMin,u.aabbMax,i,r);c&&d?h.aabbMax[2]<u.aabbMax[2]?(fy.push(s),fy.push(l)):(fy.push(l),fy.push(s)):c?fy.push(s):d&&fy.push(l)}return a>=0?a:null}}function fv(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}}function fb(i,r){let a=i.json.bufferViews[r.bufferView],n=pO[r.componentType];return new n(i.buffers[a.buffer],(r.byteOffset||0)+(a.byteOffset||0),r.count*(a.byteStride&&a.byteStride!==pk[r.type]*n.BYTES_PER_ELEMENT?a.byteStride/n.BYTES_PER_ELEMENT:pk[r.type]))}function fw(i,r,a,n){let o=fb(i,r),s=o instanceof Float32Array?o:new Uint32Array(o.buffer,o.byteOffset,r.count),l=new s7;l.reserveExact(r.count);let h=-1;for(let i=0;i<r.count;i++){let r=a?s[i]>>>16|s[i]<<16:s[i],n=65535&r,o=r>>>16;h=h<0&&2==(15&o)?n:h,l.emplaceBack(n,o)}n.featureArray=l,h>=0&&(n.doorVertexColor=h)}function fT(i,r,a,n,o=!0){let s=pO[r.componentType],l=pk[r.type],h=o?fv(s):1,u=i.json.bufferViews[r.bufferView],c=u.byteStride?u.byteStride/s.BYTES_PER_ELEMENT:l,d=r.count*c;for(let i=0,r=0;i<d;i+=c,r+=l)for(let o=0;o<l;o++)a[r+o]=n[i+o]*h}function fS(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:R,mesh:D,extras:L,children:z,name:F}=i,O={};if(O.name=F,O.localMatrix=M||(n=[],o=C||[0,0,0,1],s=P||[0,0,0],l=R||[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)*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=et(O.localMatrix),void 0!==D){O.meshes=a[D];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(L&&(L.id&&(O.id=L.id),L.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}(L.lights)),L.MAPBOX_geometry_bloom&&(O.isGeometryBloom=L.MAPBOX_geometry_bloom),L.MAPBOX_zoom_min&&(O.minZoom=L.MAPBOX_zoom_min),L.MAPBOX_zoom_max&&(O.maxZoom=L.MAPBOX_zoom_max)),z){let i=[];for(let n of z)i.push(fS(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 fx;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.c
7ount));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,D)),!O.meshBVH&&O.children){for(let i of O.children)if(i.meshBVH){O.meshBVH=i.meshBVH;break}}return O}function fE(i,r){for(let a=0;a<i.length;a++)if(i[a].name===r)return a;return -1}function fI(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=[];if(!i.json.meshes)return 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 la;let l=r.json.accessors[n],h=fb(r,l);s.indexArray.resizeExact(l.count/3),s.indexArray.uint16.set(h),s.vertexArray=new s1;let u=r.json.accessors[o.POSITION],c=fb(r,u);s.vertexArray.resizeExact(u.count),s.vertexArray.float32.set(c),s.aabb=new uB(u.min,u.max);let[d,p,f]=u.min,[m,_,g]=u.max;if(s.centroid=[.5*(d+m),.5*(p+_),.5*(f+g)],void 0!==o.COLOR_0){let i=r.json.accessors[o.COLOR_0],a=pk[i.type],n=fb(r,i);s.colorArray=3===a?new s1:new s8,s.colorArray.resizeExact(i.count),fT(r,i,s.colorArray.float32,n)}if(void 0!==o.NORMAL){s.normalArray=new lm;let i=r.json.accessors[o.NORMAL];s.normalArray.resizeExact(i.count);let a=fb(r,i);!function(i,r,a,n){let o=pO[r.componentType],s=fv(o),l=i.json.bufferViews[r.bufferView],h=pk[r.type],u=a.length/r.count,c=l.byteStride?l.byteStride/o.BYTES_PER_ELEMENT:h,d=r.count*c;for(let i=0,r=0;i<d;i+=c,r+=u)for(let o=0;o<h;o++)a[r+o]=Math.round(127*Math.min(1,Math.max(-1,n[i+o]*s)))}(r,i,s.normalArray.int8,a)}if(void 0!==o.TEXCOORD_0&&a.length>0){let i=r.json.accessors[o.TEXCOORD_0],a=fb(r,i);i.normalized&&pO[i.componentType]===Uint16Array?(s.texcoordArray=new s7,s.texcoordArray.resizeExact(i.count),fT(r,i,s.texcoordArray.uint16,a,!1)):(s.texcoordArray=new ld,s.texcoordArray.resizeExact(i.count),fT(r,i,s.texcoordArray.float32,a))}let y=!(!r.json.extensionsUsed||!r.json.extensionsUsed.includes("EXT_meshopt_compression"));void 0!==o._FEATURE_ID_RGBA4444&&y&&fw(r,r.json.accessors[o._FEATURE_ID_RGBA4444],!1,s),void 0!==o._FEATURE_RGBA4444&&fw(r,r.json.accessors[o._FEATURE_RGBA4444],!y,s),s.hasFeatureData=!!s.featureArray;let x=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 re(...d),metallicFactor:p,roughnessFactor:f,baseColorTexture:m?r[m.index]:void 0,metallicRoughnessTexture:_?r[_.index]:void 0},doubleSided:u,emissiveFactor:new re(...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!==x?r.json.materials[x]:{defined:!1},a),s}(a,i,r));a.push(o)}return a}(i,r),{scenes:n,scene:o,nodes:s}=i.json,l=n?fE(n,"Default Scene"):-1;l<0&&(l=o||0);let h=n&&n[l]?n[l].nodes||[]:[...s.keys()],u=[];for(let r of h)u.push(fS(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],eN(s,s,r),a.push(new tr(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 tr(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=st(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 pX(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?fE(n,"LOD"):-1;if(c>=0){let r=n[c].nodes,o=new Map;for(let n of r){let r=fS(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);
7r&&r.meshes&&(i.lodMeshes=r.meshes,r.meshBVH&&(i.meshBVH=r.meshBVH))}}return u}function fA(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=eP([],l.pos,h,c/2),p=eP([],l.pos,h,-c/2),f=[d[0],d[1],d[2]+l.height],m=[p[0],p[1],p[2]+l.height],_=eP([],l.normal,h,u);eC(_,_,i);let g=eP([],l.normal,h,-u);eC(g,g,i),eS(_,d,_),eS(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}}nH(fx,"ModelBVH");let fM=sZ([{name:"a_pos_3f",components:3,type:"Float32"}]),fC=sZ([{name:"a_normal_3",components:3,type:"Int16"}]),fP=sZ([{name:"a_centroid_3",components:3,type:"Int16"}]),fR=sZ([{name:"a_part_color_emissive",components:2,type:"Uint16"}]),fD=sZ([{name:"a_faux_facade_color_emissive",components:2,type:"Uint16"}]),fL=sZ([{name:"a_faux_facade_data",components:4,type:"Uint16"}]),fz=sZ([{name:"a_faux_facade_vertical_range",components:2,type:"Uint16"}]),fF=sZ([{name:"a_bloom_attenuation",components:4,type:"Float32"}]),fO=sZ([{name:"a_flood_light_wall_radius_1i16",components:1,type:"Int16"}]),fB=sZ([{name:"a_pos_normal_ed",components:4,type:"Int16"}]),fk=sZ([{name:"a_pos_end",components:4,type:"Int16"},{name:"a_angular_offset_factor",components:1,type:"Int16"}]),fN=sZ([{name:"a_flood_light_ground_radius",components:1,type:"Float32"}]),fV=sZ([{name:"a_centroid_pos",components:2,type:"Uint16"}]),fU=sZ([{name:"a_join_normal_inside",components:3,type:"Int16"}]),fj=sZ([{name:"a_hidden_by_landmark",components:1,type:"Uint8"}]),fG=sZ([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]),{members:fZ}=fB;function f$(i,r,a,n){let o=[],s=0===n?(i,r,a,n,o,s)=>{i.push(new tr(s,a+(s-r)/(n-r)*(o-a)))}:(i,r,a,n,o,s)=>{i.push(new tr(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}let fH=[new tr(0,0),new tr(8192,0),new tr(8192,8192),new tr(0,8192)];function fq(i,r){let a=[],n=[];if(!r||i.length<2)return[i];if(2===i.length)return hS(i[0],i[1],fH)?[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=hS(o,s,fH),u=hS(s,l,fH),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 fW=hd.types,fX=["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"],fY=["fill-extrusion-flood-light-ground-radius"],fK=new tr(0,1);function fJ(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 fQ(i,r,a){i.emplaceBack(8192*r.x,8192*r.y,+!!a)}function f0(i,r,a,n,o,s){i.emplaceBack(r.x,r.y,(a.x<<1)+n,(a.y<<1)+o,s)}function f1(i,r,a){i.emplaceBack(r.x,r.y,r.z,16384*a[0],16384*a[1],16384*a[2])}class f2{constructor(){this.vertexOffset=0,this.vertexCount=0,this.indexOffset=0,this.indexCount=0}}class f3{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 f3,s=[];s.length=n,o.data=s;for(let i=0;i<n;i++){let n=4*i,s=new f2;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 f5{constructor(){this.centroidXY=new tr(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 tr(Number.MAX_VALUE,Number.MAX_VALUE),this.max=new tr(-Number.MAX_VALUE,-Number.MAX_VALUE),this.height=0,this.buildingId=0,this.groupCentroidPos=new tr(0,0)}span(){return new tr(this.max.x-this.min.x,this.max.y-this.min.y)}}class f4{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 f4;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 f5;o.centroidXY=new tr(r[a],r[a+1]),o.min=new tr(r[a+2],r[a+3]),o.max=new tr(r[a+4],r[a+5]),o.groupCentroidPos=new tr(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 f6{constructor(){this.acc=new tr(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,i9(r.y,i.y,(0-r.x)/(i.x-r.x))),r.x>8192!=i.x>8192&&this.addBorderIntersection(1,i9(r.y,i.y,(8192-r.x)/(i.x-r.x))),r.y<0!=i.y<0&&this.addBorderIntersection(2,i9(r.x,i.x,(0-r.y)/(i.y-r.y))),r.y>8192!=i.y>8192&&this.addBorderIntersection(3,i9(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 tr(0,0):new tr(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 f8(i,r){let a=i.add(r)._unit();return Math.min(4,Math.max(-4,Math.tan(Math.acos(tv(i.x*a.x+i.y*a.y,-1,1)))))/4*32767*(i.x*r.y-i.y*r.x<0?-1:1)}let f9=[i=>i.x<0,i=>i.x>8192,i=>i.y<0,i=>i.y>8192];class f7{constructor(i){this.groundRadiusArray=null,this.groundRadiusBuffer=null,this.vertexArray=new sQ,this.indexArray=new la,this.programConfigurations=new l9(i.layers,{zoom:i.zoom,lut:i.lut},i=>fY.includes(i)),this._segments=new lO,this.hiddenByLandmarkVertexArray=new ly,this._segmentToGroundQuads={},this._segmentToGroundQuads[0]=[],this._segmentToRegionTriCounts={},this._segmentToRegionTriCounts[0]=[0,0,0,0,0],this.regionSegments={},this.regionSegments[4]=new lO}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=f8(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(),_=f8(m,f.sub(p)._perp()._unit()),g=s;if(mn(d,p,r)||n&&mo(d,r)&&mo(p,r)){s=_;continue}let y=h.vertexLength;for(let i of(f0(this.vertexArray,d,p,1,1,g),f0(this.vertexArray,d,p,1,0,g),f0(this.vertexArray,d,p,0,1,_),f0(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(f9[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 lO);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,fk.members),this.indexBuffer=i.createIndexBuffer(this.indexArray),null!=this.groundRadiusArray&&(this.groundRadiusBuffer=i.createVertexBuffer(this.groundRadiusArray,fN.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,fj.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 me{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 f4,this.footprintIndices=new la,this.footprintVertices=new sH,this.footprintSegments=new f3,this.layoutVertexArray=new sJ,this.centroidVertexArray=new lC,this.wallVertexArray=new lR,this.indexArray=new la,this.programConfigurations=new l9(i.layers,{zoom:i.zoom,lut:i.lut},i=>fX.includes(i)),this.segments=new lO,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.groundEffect=new f7(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=sx("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=sz(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=sN(o,i);if(!this.layers[0]._featureFilter.filter(new oC(this.zoom,{worldview:this.worldview,activeFloors:r.activeFloors}),u,a))continue;let c={id:s,sourceLayerIndex:h,index:l,geometry:i?u.geometry:sk(o,a,n),properties:o.properties,type:o.type,patterns:{}},d=this.layoutVertexArray.length,p="Polygon"===fW[c.type];if(this.hasPattern)this.features.push({featureId:o.id,feature:sv("fill-extrusion",this.layers,c,this.zoom,this.pixelRatio,r)});else if(this.wallMode)for(let i of c.geometry)for(let s of fq(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"===fW[l.type],{geometry:u}=l;if(this.wallMode)for(let c of u)for(let u of fq(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,fZ),this.indexBuffer=i.createIndexBuffer(this.indexArray),this.wallVertexBuffer=i.createVertexBuffer(this.wallVertexArray,fU.members),this.layoutVertexExtArray&&(this.layoutVertexExtBuffer=i.createVertexBuffer(this.layoutVertexExtArray,fG.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,fV.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){var c,d,p,f;let m,_,g=this.layers[0].paint.get("fill-extrusion-flood-light-ground-radius").evaluate(r,{})/this.tileToMeter,y=[new tr(0,0),new tr(8192,8192)],x=h.projection,v="globe"===x.name,b=this.wallMode||"Polygon"===fW[r.type],w=new f6;w.centroidDataIndex=this.centroidData.length;let T=new f5;T.buildingId=i,r.properties&&Object.hasOwn(r.properties,"building_id")&&(T.buildingId=Number(r.properties.building_id)),w.buildingId=T.buildingId;let S=0>=this.layers[0].paint.get("fill-extrusion-base").evaluate(r,{},o),E=this.layers[0].paint.get("fill-extrusion-height").evaluate(r,{},o);if(T.height=E,T.vertexArrayOffset=this.layoutVertexArray.length,T.groundVertexArrayOffset=this.groundEffect.vertexArray.length,v&&!this.layoutVertexExtArray&&(this.layoutVertexExtArray=new s5),this.wallMode){if(v)return void tF("Non zero fill-extrusion-line-width is not yet supported on globe.");if(1!==a.length)return;a=[(m=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 tr(i.x,i.y),u=new tr(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 I=(i,r)=>i<(r.length-1)/2||i===r.length-1,A=this.wallMode?[a]:ts(a,500);for(let i=A.length-1;i>=0;i--){let r=A[i];(0===r.length||(c=r[0]).every(i=>i.x<=0)||c.every(i=>i.x>=8192)||c.every(i=>i.y<=0)||c.every(i=>i.y>=8192))&&A.splice(i,1)}if(v)_=mu(A,y,o);else for(let i of(_=[],A))_.push({polygon:i,bounds:y});let M=b?this.edgeRadius:0,C=M>0&&this.zoom<17,P=(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 _){let a=0,n=0;for(let r of i)b&&!r[0].equals(r.at(-1))&&r.push(r[0]),n+=b?r.length-1:r.length;let s=this.segments.prepareSegment((b?5:4)*n,this.layoutVertexArray,this.indexArray);T.footprintSegIdx<0&&(T.footprintSegIdx=this.footprintSegments.length),T.polygonSegIdx<0&&(T.polygonSegIdx=this.polygonSegments.length);let l={triangleArrayOffset:this.indexArray.length,triangleCount:0,triangleSegIdx:this.segments.segments.length-1},h=new f2;if(h.vertexOffset=this.footprintVertices.length,h.indexOffset=3*this.footprintIndices.length,h.ringIndices=[],b){let n=[],l=[];a=s.vertexLength;for(let a=0;a<i.length;a++){let u,c,d=i[a];d.length&&0!==a&&l.push(n.length/2);let p=[];u=d[1].sub(d[0])._perp()._unit(),h.ringIndices.push(d.length-1);for(let i=1;i<d.length;i++){let r=d[i],a=d[i===d.length-1?1:i+1],l=r.clone();if(M){c=mt(r,a,u);let i=mi(u,c),n=M*Math.min(4,1/mr(u,c));l.x+=n*i.x,l.y+=n*i.y,l.x=Math.round(l.x),l.y=Math.round(l.y),u=c}if(!S||0!==M&&!C||P(p,l)||p.push(l),fJ(this.layoutVertexArray,l.x,l.y,0,0,1,1,0),this.wallMode){let r=I(i,d);fQ(this.wallVertexArray,m.joinNormals[i],!r)}s.vertexLength++,this.footprintVertices.emplaceBack(r.x,r.y),n.push(r.x,r.y),v&&f1(this.layoutVertexExtArray,x.projectTilePoint(l.x,l.y,o),x.upVector(o,l.x,l.y))}S&&(0===M||C)&&(0!==p.length&&P(p,p[0])&&p.pop(),this.groundEffect.addData(p,r,g))}let u=this.wallMode?m.indices:st(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,c=i[n];w.startRing(T,c[0]);let _=c.length>4&&ms(c[c.length-2],c[0],c[1]),y=M?function(i,r,a,n){let o,s;return i.equals(r)?o=s=mt(r,a,new tr(0,0)):(o=r.sub(i)._perp()._unit(),s=mt(r,a,o)),ma(i,r,a,mr(o,s),n)}(c[c.length-2],c[0],c[1],M):0,E=[];h=c[1].sub(c[0])._perp()._unit();let A=!0;for(let i=1,n=0;i<c.length;i++){let g=c[i-1],b=c[i],C=c[i===c.length-1?1:i+1];if(w.appendEdge(T,b,g),mn(b,g,r)){M&&(h=C.sub(b)._perp()._unit(),A=!A);continue}let R=b.sub(g)._perp(),D=R.x/(Math.abs(R.x)+Math.abs(R.y)),L=+(R.y>0),z=g.dist(b);if(n+z>32768&&(n=0),M){u=mt(b,C,h);let i=ma(g,b,C,mr(h,u),M);isNaN(i)&&(i=0);let r=(d=g,p=b,f=new tr(0,0),d.equals(p)?f:p.sub(d)._unit());g=g.add(r.mult(y))._round(),b=b.add(r.mult(-i))._round(),y=i,h=u,S&&this.zoom>=17&&(P(E,g)||E.push(g),P(E,b)||E.push(b))}let F=s.vertexLength,O=c.length>4&&ms(g,b,C),B=ml(n,_,A);if(fJ(this.layoutVertexArray,g.x,g.y,D,L,0,0,B),fJ(this.layoutVertexArray,g.x,g.y,D,L,0,1,B),this.wallMode){let r=I(i-1,c),a=m.joinNormals[i-1];fQ(this.wallVertexArray,a,r),fQ(this.wallVertexArray,a,r)}if(n+=z,B=ml(n,O,!A),_=O,fJ(this.layoutVertexArray,b.x,b.y,D,L,0,0,B),fJ(this.layoutVertexArray,b.x,b.y,D,L,0,1,B),this.wallMode){let r=I(i,c),a=m.joinNormals[i];fQ(this.wallVertexArray,a,r),fQ(this.wallVertexArray,a,r)}if(s.vertexLength+=4,this.indexArray.emplaceBack(F+0,F+1,F+2),this.indexArray.emplaceBack(F+1,F+3,F+2),s.primitiveLength+=2,M){let n=a+(1===i?c.length-2:i-2),o=1===i?a:n+1;if(this.indexArray.emplaceBack(F+1,n,F+3),this.indexArray.emplaceBack(n,o,F+3),s.primitiveLength+=2,void 0===l&&(l=F),!mn(C,c[i],r)){let r=i===c.length-1?l:s.vertexLength;this.indexArray.emplaceBack(F+2,F+3,r),this.indexArray.emplaceBack(F+3,r+1,r),this.indexArray.emplaceBack(F+3,o,r+1),s.primitiveLength+=3}A=!A}if(v){let i=this.layoutVertexExtArray,r=x.projectTilePoint(g.x,g.y,o),a=x.projectTilePoint(b.x,b.y,o),n=x.upVector(o,g.x,g.y),s=x.upVector(o,b.x,b.y);f1(i,r,n),f1(i,r,n),f1(i,a,s),f1(i,a,s)}}b&&(a+=c.length-1),S&&M&&this.zoom>=17&&(0!==E.length&&P(E,E[0])&&E.pop(),this.groundEffect.addData(E,r,g,M>0))}this.footprintSegments.push(h),l.triangleCount=this.indexArray.length-l.triangleArrayOffset,this.polygonSegments.push(l),++T.footprintSegLen,++T.polygonSegLen}if(T.vertexCount=this.layoutVertexArray.length-T.vertexArrayOffset,T.groundVertexCount=this.groundEffect.vertexArray.length-T.groundVertexArrayOffset,0!==T.vertexCount){if(T.centroidXY=w.borders?fK:this.encodeCentroid(w,T),r.properties&&Object.hasOwn(r.properties,"building_id")){let i=T.buildingId,r=this.buildingGroups.get(i);r||(r={accX:0,accY:0,accCount:0,mergedMin:new tr(Number.MAX_VALUE,Number.MAX_VALUE),mergedMax:new tr(-Number.MAX_VALUE,-Number.MAX_VALUE),partIndices:[]},this.buildingGroups.set(i,r)),r.accX+=w.acc.x,r.accY+=w.acc.y,r.accCount+=w.accCount,r.mergedMin.x=Math.min(r.mergedMin.x,T.min.x),r.mergedMin.y=Math.min(r.mergedMin.y,T.min.y),r.mergedMax.x=Math.max(r.mergedMax.x,T.max.x),r.mergedMax.y=Math.max(r.mergedMax.y,T.max.y),r.partIndices.push(this.centroidData.length)}if(this.centroidData.push(T),w.borders){this.featuresOnBorder.push(w);let i=this.featuresOnBorder.length-1;for(let r=0;r<w.borders.length;r++)w.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,E)}}_finalizeBuildingGroups(){for(let[,i]of this.buildingGroups){if(0===i.partIndices.length)continue;let r=new f6;r.acc=new tr(i.accX,i.accY),r.accCount=i.accCount;let a=new f5;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===fK.x&&a.centroidXY.y===fK.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 la;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 lO;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)=>[i9(i[0],r[0],a[0]),i9(i[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 uB([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 tr(tv(a.x,1,8191)<<3|o,tv(a.y,1,8191)<<3|s)}encodeBorderCentroid(i){if(!i.borders)return new tr(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 tr(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 tr((r[i][0]+r[i][1])/2<<3|6,6|65528*(r[2][0]===a))}}showCentroid(i,r){let a=this.centroidData.get(i.centroidDataIndex);if(a.flags&=0x80000000,"keep"!==r||7&~a.centroidXY.y){if(0!==a.groupCentroidPos.x||0!==a.groupCentroidPos.y){let i=a.span(),r=Math.min(7,Math.round(i.x*this.tileToMeter/10)),n=Math.min(6,Math.round(i.y*this.tileToMeter/10));a.centroidXY=new tr(tv(a.groupCentroidPos.x,1,8191)<<3|r,tv(a.groupCentroidPos.y,1,8191)<<3|n)}else a.centroidXY=new tr(0,0);this.writeCentroidToBuffer(a)}else this.writeCentroidToBuffer(a)}writeCentroidToBuffer(i){this.groundEffect.updateHiddenByLandmark(i);let r=i.vertexArrayOffset,a=i.vertexCount+i.vertexArrayOffset,n=-0x40000000&i.flags?fK: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(cC(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!==cz.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 tr(a,u))}}(this.footprintVertices,l.vertexOffset,l.vertexCount,r.footprintTileId.canonical,i.canonical,o),cR(r.footprint,o,this.footprintIndices.uint16,l.indexOffset,l.indexCount,-l.vertexOffset,
7-n)){a.flags|=r.clipMask!==cz.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 mt(i,r,a){return i.equals(r)?a:r.sub(i)._perp()._unit()}function mi(i,r){let a=i.add(r),n=a.mag();return 0===n?i:a.div(n)}function mr(i,r){let a=mi(i,r);return i.x*a.x+i.y*a.y}function ma(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 mn(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 mo(i,r){return i.x<r[0].x||i.x>r[1].x||i.y<r[0].y||i.y>r[1].y}function ms(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 ml(i,r,a){let n=r?2|i:-3&i;return a?1|n:-2&n}function mh(){let i=Math.tan(Math.PI/32);return 6371008.8*Math.sqrt(1+2*i*i)-6371008.8}function mu(i,r,a){let n=1<<a.z,o=rQ(a.x/n),s=rQ((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=f$(f,r[0].y-o,r[1].y+o,1),!(f=f$(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=f$(i.polygons,u-o,d+o,a),_=f$(i.polygons,d-o,c+o,a);if(f.length){let i=[n,new tr(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 tr(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((r0(a.y/n)-r0((a.y+1)/n))/11.25),1,(i,r,o)=>{if(0===i)return .5*(r+o);{let i=r0((a.y+r/8192)/n);return(rJ(.5*(r0((a.y+o/8192)/n)+i))*n-a.y)*8192}})}nH(me,"FillExtrusionBucket",{omit:["layers","features"]}),nH(f5,"PartData"),nH(f4,"PartDataArray"),nH(f3,"FootprintSegmentArray"),nH(f6,"BorderCentroidData"),nH(f7,"GroundEffect");class mc{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 md=hd.types,mp,mf,mm=null,m_=null,mg=null;class my{constructor(){this.layoutVertexArray=new s1,this.layoutAttenuationArray=new s8,this.layoutColorArray=new s7,this.indexArray=new la,this.indexArrayForConflation=new la,this.segmentsBucket=new lO}}class mx{constructor(i){this.layoutFacadePaintArray=null,this.layoutFacadeDataArray=null,this.layoutFacadeVerticalRangeArray=null,this.segmentsBucket=new lO,this.entranceBloom=new my,this.layoutVertexArray=new s1,this.layoutVertexArray.reserve(66560),this.layoutNormalArray=new sq,this.layoutNormalArray.reserve(66560),this.layoutCentroidArray=new sq,this.layoutCentroidArray.reserve(66560),this.layoutColorArray=new s7,this.layoutColorArray.reserve(66560),this.layoutFloodLightDataArray=new lg,this.layoutFloodLightDataArray.reserve(66560),this.layoutAOArray=new ly,this.layoutAOArray.reserve(66560),this.indexArray=new la,this.indexArray.reserve(66560),this.indexArrayForConflation=new la,this.segmentsBucket=new lO,this.entranceBloom=new my,i&&(this.layoutFacadePaintArray=new s7,this.layoutFacadeDataArray=new s3,this.layoutFacadeVerticalRangeArray=new s7)}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 mv{constructor(i){this.requiresHDRuntime=!0,this.colorBufferUploaded=!1,this.maxHeight=0,this.replacementUpdateTime=0,this.activeReplacements=[],this.footprints=[],this.footprintsVertices=new ld,this.footprintsIndices=new lf,this.footprintsMin=new tr(1/0,1/0),this.footprintsMax=new tr(-1/0,-1/0),this.featuresOnBorder=[],this.buildingWithoutFacade=new mx(!1),this.buildingWithFacade=new mx(!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 l9(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 f7(i),this.groundEffect.groundRadiusArray=new sX,this.hasAppearances=null}updateFootprints(i,r){let a=new pX([],[],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(!mg)return;let o=sz(a);this.tileToMeter=o,this.brightness=r.brightness,mg.setStyle({normalScale:[1,-1,o],tileToMeters:o}),mg.setAOOptions(!1,.3),mg.setMetricOptions(!1,16),mg.setStructuralOptions(!0),mg.setFacadeClassifierOptions(3);let s=new Map,l=new Map,h=0;for(let{feature:r}of i){if("LineString"!==md[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 oC(this.zoom),r,a))continue;let o=sN(r,i);if(!i&&!this.layers[0]._featureFilter.filter(new oC(this.zoom),o,a))continue;let u=i?o.geometry:sk(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"===md[u.type])continue;let i=this.layers[0]._featureFilter.needGeometry;if(i&&!this.layers[0]._featureFilter.filter(new oC(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=sN(u,i);if(!i&&!this.layers[0]._featureFilter.filter(new oC(this.zoom),f,a))continue;let m=i?f.geometry:sk(u,a,n),x=ts(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),R=b.paint.get("building-emissive-strength").evaluate(u,{},this.canonical);u.properties["building-part"]="window";let D=b.paint.get("building-color").evaluate(u,{},this.canonical).toPremultipliedRenderColor(this.lut),L=b.paint.get("building-emissive-strength").evaluate(u,{},this.canonical);u.properties["building-part"]="door";let z=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=tv(O,0,2048))/2048*32767,k=s.get(_),N=l.get(k)||[],V=0!==N.length&&b.layout.get("building-facade").evaluate(u,{},a);mg.setFacadeOptions(4,!0),mg.setFauxFacadeOptions(V,!1,1);let U=0,j=0,G=0,Z=0,$=0,H=0,q=0,W=0,X=0,Y=0,K=0;if(V){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);mg.setFacadeOptions(r,!0),$=(S<15?1.3:1.61803)*r/o}else $=T/o;$=Math.min($,H=S/o),G=b.layout.get("building-facade-unit-width").evaluate(u,{},a)/o,Z=(H-$)/i,mg.setFauxFacadeOptions(!0,!0,G);let r=b.layout.get("building-facade-window").evaluate(u,{},a);U=r[0],j=r[1],q=Math.floor(65535*Math.min(1,$/8192)),W=Math.floor(65535*Math.min(1,H/8192)),X=Math.floor(255*U)<<8|Math.floor(255*j),Y=Math.floor(65535*Math.min(1,G/8192)),K=Math.floor(65535*Math.min(1,Z/8192))}let J=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}J[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=mg.generateMesh(J,N);if("string"==typeof er){tF(`Unable to generate building ${u.id}: ${er}`),d(h);continue}if(0===er.meshes.length||0===er.modifiedPolygonRings.length){d(h);continue}let ea=V?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),V&&(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=R;else if(2===i.buildingPart)r=D,a=L;else{if(3!==i.buildingPart)continue;r=z,a=F}if(a=tv(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,fA(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*z.r<<8|255*z.g,255*z.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),V){let r=255*D.r<<8|255*D.g,a=255*D.b<<8|255*L;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,K),ea.layoutFacadeVerticalRangeArray.emplace(em+r,q,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 tr(1/0,1/0),eb=new tr(-1/0,-1/0),ew=T<=0,eT=this.groundEffect.vertexArray.length;for(let i of er.modifiedPolygonRings){let r=[],a=new tr(1/0,1/0),n=new tr(-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 tr(i[s],i[s+1]);ew&&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),ew&&this.groundEffect.addData(r,[a,n],A)}let eS=this.groundEffect.vertexArray.length-eT;this.groundEffect.groundRadiusArray.reserveForAdditional(eS);for(let i=0;i<eS;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=st(ex,null,2);this.footprintsIndices.resize(this.footprintsIndices.length+i.length),this.footprintsIndices.uint16.set(i,eg),this.buildingIds.add(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:eT,groundEffectVertexLength:eS,hasFauxFacade:V,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,fM.members),r.layoutNormalBuffer=i.createVertexBuffer(r.layoutNormalArray,fC.members),r.layoutCentroidBuffer=i.createVertexBuffer(r.layoutCentroidArray,fP.members),r.layoutFloodLightDataBuffer=i.createVertexBuffer(r.layoutFloodLightDataArray,fO.members),r.layoutFacadeDataArray&&r.layoutFacadeDataArray.length&&(r.layoutFacadeDataBuffer=i.createVertexBuffer(r.layoutFacadeDataArray,fL.members)),r.layoutFacadeVerticalRangeArray&&r.layoutFacadeVerticalRangeArray.length&&(r.layoutFacadeVerticalRangeBuffer=i.createVertexBuffer(r.layoutFacadeVerticalRangeArray,fz.members)),r.entranceBloom.layoutVertexArray.length&&(r.entranceBloom.layoutVertexBuffer=i.createVertexBuffer(r.entranceBloom.layoutVertexArray,fM.members),r.entranceBloom.layoutAttenuationBuffer=i.createVertexBuffer(r.entranceBloom.layoutAttenuationArray,fF.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,fR.members,!0),r.layoutFacadePaintArray&&(r.layoutFacadePaintBuffer?r.layoutFacadePaintBuffer.updateData(r.layoutFacadePaintArray):r.layoutFacadePaintBuffer=i.createVertexBuffer(r.layoutFacadePaintArray,fD.members,!0)),r.entranceBloom.layoutColorBuffer?r.entranceBloom.layoutColorBuffer.updateData(r.entranceBloom.layoutColorArray):r.entranceBloom.layoutColorBuffer=i.createVertexBuffer(r.entranceBloom.layoutColorArray,fR.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=tv(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(cC(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 tr(a,u))}}(this.footprintsVertices,a.footprintVertexOffset,a.footprintVertexLength,r.footprintTileId.canonical,i.canonical,o),cR(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 tr(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}}nH(mv,"BuildingBucket",{omit:["layers"]}),nH(mx,"BuildingGeometry"),nH(my,"BuildingBloomGeometry");class mb{constructor(i=0,r=[]){this.frcMask=i,this.rings=r}hasGeometry(){return this.rings.length>0&&this.rings[0].length>0}}async function mw(){}function mT(i,r,a){let n=r.paint.get(i).value;return"constant"===n.kind?n.value:a.programConfigurations.get(r.id).getMaxValue(i)}function mS(i){return Math.sqrt(i[0]*i[0]+i[1]*i[1])}function mE(i,r,a,n,o){if(!r[0]&&!r[1])return i;let s=tr.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 mI(i,r,a,n){let o=tr.convert(i)._mult(n);return"viewport"===r&&o._rotate(-a),o}nH(mb,"FrcCoveragePolygon");let mA=ee(),mM=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 mC(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=eW([],[i,r,a,1],n);return new tr(o[0]/o[3],o[1]/o[3])}(_.x,_.y,_.z,n),y=s?i.tilespaceRays.map(i=>(function(i,r){let a=ex();return mP[2]=r,i.intersectsPlane(mP,mR,a),new tr(a[0],a[1])})(i,m)):i.queryGeometry.screenGeometry,x=eW([],[_.x,_.y,_.z,1],n);if(!l&&s?u*=x[3]/a.cameraToCenterDistance:l&&!s&&(u*=a.cameraToCenterDistance/x[3]),s){let i=r0((r.y/8192+c.y)/(1<<c.z));u/=a.projection.pixelsPerMeter(i,1)/(1/sC(i))}if(p=u,hw(y,g)||hx(g,y,p))return!0}return!1}let mP=ew(0,0,0),mR=ew(0,0,1);class mD extends hY{}nH(mD,"HeatmapBucket",{omit:["layers"]});let mL=(i,r,a,n)=>i9(r,a,"log"===n?(Math.pow(10,i)-1)/9:i);function mz(i){let{expression:r,evaluationKey:a,resolution:n=256,clips:o,scale:s="linear",lut:l=null}=i,h=o?o.length:1,u=i.image||new hB({width:n,height:h}),c={},d=(i,n,o)=>{c[a]=o;let s=r.evaluate(c),h=s?.toNonPremultipliedRenderColor(l)??null;h&&(u.data[i+n+0]=Math.floor(255*h.r),u.data[i+n+1]=Math.floor(255*h.g),u.data[i+n+2]=Math.floor(255*h.b),u.data[i+n+3]=Math.floor(255*h.a))};for(let i=0,r=0;i<h;++i,r+=4*n){let a=o?.[i].start??0,l=o?.[i].end??1;for(let i=0,o=0;i<n;i++,o+=4)d(r,o,mL(i/(n-1),a,l,s))}return u}class mF{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=sN(s,i);if(!this.layers[0]._featureFilter.filter(new oC(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:sk(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 ts(r,2)){let r=[],a=[],n=[],o=new tr(1/0,1/0),s=new tr(-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=st(a,n),h=new pX(r,l,8,256);this.footprints.push({vertices:r,indices:l,grid:h,min:o,max:s})}}}function mO(i,r){return i.x*r.x+i.y*r.y}function mB(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;
7n++){let s=r[n],l=i[0],h=a.sub(o),u=s.sub(o),c=l.sub(o),d=mO(h,h),p=mO(h,u),f=mO(u,u),m=mO(c,h),_=mO(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 mk(i,r,a){let n=1/0;h_(a,r)&&(n=mB(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];hm(a,o)&&(n=Math.min(n,mB(a,o)))}}return n!==1/0&&n}function mN(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=mh();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=mV(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),eN(_,_,s),eN(g,g,s),r.push(new hA(_[0],_[1],_[2])),x.push(new hA(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,_=mV(d,f,r,a,s,l,h,u);p[0]=d,p[1]=f,p[2]=_.base,p[3]=1,eW(p,p,o),p[3]=Math.max(p[3],1e-5);let g=new hA(p[0]/p[3],p[1]/p[3],p[2]/p[3]);p[0]=d,p[1]=f,p[2]=_.top,p[3]=1,eW(p,p,o),p[3]=Math.max(p[3],1e-5);let y=new hA(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 hA(b/S,w/S,T/S)),a.push(new hA(E/M,I/M,A/M))}s.push(i),l.push(a)}return[s,l]}(r,a,n,o,s)}function mV(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}}function mU(i,r,a){return r*(8192/(i.tileSize*Math.pow(2,a-i.tileID.overscaledZ)))}function mj(i,r){return 1/mU(i,1,r.tileZoom)}function mG(i,r,a,n){return i.translatePosMatrix(n||r.tileID.projMatrix,r,a.paint.get("line-translate"),a.paint.get("line-translate-anchor"))}nH(mF,"ClipBucket",{omit:["layers"]});let mZ=i=>{let r=[];m$(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");let n=0!==i.paint.get("line-border-width").constantOr(1);n&&r.push("RENDER_LINE_BORDER"),n&&i.paint.get("line-border-gradient")&&r.push("RENDER_LINE_BORDER_GRADIENT");let o="none"===i.layout.get("line-join").constantOr("miter"),s=!!i.paint.get("line-pattern").constantOr(1);return o&&s&&r.push("LINE_JOIN_NONE"),r};function m$(i){let r=i.paint.get("line-dasharray").value;return"constant"!==r.kind||r.value}let mH=()=>P||(P={layout:M||(M=new oU({"line-cap":new oN(oj.layout_line["line-cap"]),"line-join":new oN(oj.layout_line["line-join"]),"line-miter-limit":new ok(oj.layout_line["line-miter-limit"]),"line-round-limit":new ok(oj.layout_line["line-round-limit"]),"line-sort-key":new oN(oj.layout_line["line-sort-key"]),"line-z-offset":new oN(oj.layout_line["line-z-offset"]),"line-elevation-reference":new ok(oj.layout_line["line-elevation-reference"]),"line-cross-slope":new ok(oj.layout_line["line-cross-slope"]),visibility:new ok(oj.layout_line.visibility),"line-width-unit":new ok(oj.layout_line["line-width-unit"]),"line-elevation-ground-scale":new oN(oj.layout_line["line-elevation-ground-scale"])})),paint:C||(C=new oU({"line-opacity":new oN(oj.paint_line["line-opacity"]),"line-color":new oN(oj.paint_line["line-color"]),"line-translate":new ok(oj.paint_line["line-translate"]),"line-translate-anchor":new ok(oj.paint_line["line-translate-anchor"]),"line-width":new oN(oj.paint_line["line-width"]),"line-gap-width":new oN(oj.paint_line["line-gap-width"]),"line-offset":new oN(oj.paint_line["line-offset"]),"line-blur"
vendor: 8,264 bytes, line 7
7:new oN(oj.paint_line["line-blur"]),"line-dasharray":new oN(oj.paint_line["line-dasharray"]),"line-pattern":new oN(oj.paint_line["line-pattern"]),"line-pattern-cross-fade":new ok(oj.paint_line["line-pattern-cross-fade"]),"line-gradient":new oV(oj.paint_line["line-gradient"]),"line-trim-offset":new ok(oj.paint_line["line-trim-offset"]),"line-trim-fade-range":new ok(oj.paint_line["line-trim-fade-range"]),"line-trim-color":new ok(oj.paint_line["line-trim-color"]),"line-emissive-strength":new oN(oj.paint_line["line-emissive-strength"]),"line-border-width":new oN(oj.paint_line["line-border-width"]),"line-border-color":new oN(oj.paint_line["line-border-color"]),"line-border-gradient":new oV(oj.paint_line["line-border-gradient"]),"line-occlusion-opacity":new ok(oj.paint_line["line-occlusion-opacity"]),"line-blend-mode":new ok(oj.paint_line["line-blend-mode"]),"line-blend-additive-clamp":new ok(oj.paint_line["line-blend-additive-clamp"]),"line-cutout-depth":new ok(oj.paint_line["line-cutout-depth"]),"line-color-use-theme":new oN({type:"string",default:"default","property-type":"data-driven"}),"line-gradient-use-theme":new oN({type:"string",default:"default","property-type":"data-driven"}),"line-trim-color-use-theme":new oN({type:"string",default:"default","property-type":"data-driven"}),"line-border-color-use-theme":new oN({type:"string",default:"default","property-type":"data-driven"}),"line-border-gradient-use-theme":new oN({type:"string",default:"default","property-type":"data-driven"})}))});class mq extends oN{possiblyEvaluate(i,r){return r=new oC(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={...r,zoom:Math.floor(r.zoom)},super.evaluate(i,r,a,n)}}function mW(i,r){return r.replace(/{([^{}]+)}/g,(r,a)=>a in i?String(i[a]):"")}class mX{constructor(i){this.type=i.property.overrides?i.property.overrides.runtimeType:rl,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}}nH(mX,"FormatSectionOverride",{omit:["defaultValue"]});let mY={};function mK(i){return"constant"!==i.value.kind&&i.value.isStateDependent}let mJ=()=>z||(z={layout:D||(D=new oU({"symbol-placement":new ok(oj.layout_symbol["symbol-placement"]),"symbol-spacing":new ok(oj.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new ok(oj.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new oN(oj.layout_symbol["symbol-sort-key"]),"symbol-z-order":new ok(oj.layout_symbol["symbol-z-order"]),"symbol-z-elevate":new ok(oj.layout_symbol["symbol-z-elevate"]),"symbol-elevation-reference":new ok(oj.layout_symbol["symbol-elevation-reference"]),"icon-allow-overlap":new ok(oj.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new ok(oj.layout_symbol["icon-ignore-placement"]),"icon-optional":new ok(oj.layout_symbol["icon-optional"]),"icon-rotation-alignment":new ok(oj.layout_symbol["icon-rotation-alignment"]),"icon-size":new oN(oj.layout_symbol["icon-size"]),"icon-size-scale-range":new ok(oj.layout_symbol["icon-size-scale-range"]),"icon-text-fit":new oN(oj.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new oN(oj.layout_symbol["icon-text-fit-padding"]),"icon-image":new oN(oj.layout_symbol["icon-image"]),"icon-image-use-theme":new ok({type:"string",default:"default","property-type":"data-constant"}),"icon-rotate":new oN(oj.layout_symbol["icon-rotate"]),"icon-padding":new ok(oj.layout_symbol["icon-padding"]),"icon-keep-upright":new ok(oj.layout_symbol["icon-keep-upright"]),"icon-offset":new oN(oj.layout_symbol["icon-offset"]),"icon-anchor":new oN(oj.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new ok(oj.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new ok(oj.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new ok(oj.layout_symbol["text-rotation-alignment"]),"text-field":new oN(oj.layout_symbol["text-field"]),"text-font":new oN(oj.layout_symbol["text-font"]),"text-size":new oN(oj.layout_symbol["text-size"]),"text-size-scale-range":new ok(oj.layout_symbol["text-size-scale-range"]),"text-max-width":new oN(oj.layout_symbol["text-max-width"]),"text-line-height":new oN(oj.layout_symbol["text-line-height"]),"text-letter-spacing":new oN(oj.layout_symbol["text-letter-spacing"]),"text-justify":new oN(oj.layout_symbol["text-justify"]),"text-radial-offset":new oN(oj.layout_symbol["text-radial-offset"]),"text-variable-anchor":new ok(oj.layout_symbol["text-variable-anchor"]),"text-anchor":new oN(oj.layout_symbol["text-anchor"]),"text-max-angle":new ok(oj.layout_symbol["text-max-angle"]),"text-writing-mode":new ok(oj.layout_symbol["text-writing-mode"]),"text-rotate":new oN(oj.layout_symbol["text-rotate"]),"text-padding":new ok(oj.layout_symbol["text-padding"]),"text-keep-upright":new ok(oj.layout_symbol["text-keep-upright"]),"text-transform":new oN(oj.layout_symbol["text-transform"]),"text-offset":new oN(oj.layout_symbol["text-offset"]),"text-allow-overlap":new ok(oj.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new ok(oj.layout_symbol["text-ignore-placement"]),"text-optional":new ok(oj.layout_symbol["text-optional"]),visibility:new ok(oj.layout_symbol.visibility)})),paint:L||(L=new oU({"icon-opacity":new oN(oj.paint_symbol["icon-opacity"]),"icon-occlusion-opacity":new oN(oj.paint_symbol["icon-occlusion-opacity"]),"icon-emissive-strength":new oN(oj.paint_symbol["icon-emissive-strength"]),"text-emissive-strength":new oN(oj.paint_symbol["text-emissive-strength"]),"icon-color":new oN(oj.paint_symbol["icon-color"]),"icon-halo-color":new oN(oj.paint_symbol["icon-halo-color"]),"icon-halo-width":new oN(oj.paint_symbol["icon-halo-width"]),"icon-halo-blur":new oN(oj.paint_symbol["icon-halo-blur"]),"icon-translate":new ok(oj.paint_symbol["icon-translate"]),"icon-translate-anchor":new ok(oj.paint_symbol["icon-translate-anchor"]),"icon-image-cross-fade":new ok(oj.paint_symbol["icon-image-cross-fade"]),"text-opacity":new oN(oj.paint_symbol["text-opacity"]),"text-occlusion-opacity":new oN(oj.paint_symbol["text-occlusion-opacity"]),"text-color":new oN(oj.paint_symbol["text-color"],{runtimeType:rd,getOverride:i=>i.textColor,hasOverride:i=>!!i.textColor}),"text-halo-color":new oN(oj.paint_symbol["text-halo-color"]),"text-halo-width":new oN(oj.paint_symbol["text-halo-width"]),"text-halo-blur":new oN(oj.paint_symbol["text-halo-blur"]),"text-translate":new ok(oj.paint_symbol["text-translate"]),"text-translate-anchor":new ok(oj.paint_symbol["text-translate-anchor"]),"icon-color-saturation":new ok(oj.paint_symbol["icon-color-saturation"]),"icon-color-contrast":new ok(oj.paint_symbol["icon-color-contrast"]),"icon-color-brightness-min":new ok(oj.paint_symbol["icon-color-brightness-min"]),"icon-color-brightness-max":new ok(oj.paint_symbol["icon-color-brightness-max"]),"symbol-z-offset":new oN(oj.paint_symbol["symbol-z-offset"]),"placement-priority":new oN(oj.paint_symbol["placement-priority"]),"placement-group":new oN(oj.paint_symbol["placement-group"]),"icon-color-use-theme":new oN({type:"string",default:"default","property-type":"data-driven"}),"icon-halo-color-use-theme":new oN({type:"string",default:"default","property-type":"data-driven"}),"text-color-use-theme":new oN({type:"string",default:"default","property-type":"data-driven"}),"text-halo-color-use-theme":new oN({type:"string",default:"default","property-type":"data-driven"})}))});class mQ extends o7{constructor(i,r,a,n){super(i,mJ(),r,a,n,i.layout?i.layout["icon-image-use-theme"]:null),this._colorAdjustmentMatrix=er([]),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)}),0!==this.appearances.length&&delete this.layout._values["text-variable-anchor"],"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=tq(i),r=tH(r);let o=ee(),s=i/3,l=1-2*s,h=.5-.5*r,u=n-a;return eo(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]),eo(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()||nk(s.value)||!o?o:mW(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()||nk(h.value)||!l||"string"!=typeof l?l:mW(a.properties,l)}createBucket(i){return new dz(i)}placeSymbols(i,r,a,n,o){let{globalPlacement:s,idRangeAllocator:l,transform:h,buildingIndex:u,fogState:c,groupOrders:d,replacementSource:p}=i,f=this.runtimeLayerUID,m=mK(this.paint.get("placement-group"))||mK(this.paint.get("placement-priority"))?n._state.getState(this.sourceLayer||"_geojsonTileLayer"):mY;for(let i of r){let r=i.getBucket(this);if(!r||this.fqid!==r.layerIds[0])continue;"offset"===r.elevationType&&u?u.updateZOffset(r,i.tileID):"road"===r.elevationType&&r.hdExt&&r.hdExt.updateRoadElevation(r,i.tileID.canonical),r.updateZOffset(),s.startSymbolSourceProcessing(r);let n=cj(i.tileID,r.getProjection(),h,h.projection.name);r.addToPlacement(s,l,f,n,h,i.tileSize/8192,i,c,d,a,m,o?p:null),s.finishSourceProcessing()}}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(let i of mJ().paint.overridableProperties){if(!mQ.hasPaintOverride(this.layout,i))continue;let r=this.paint.get(i),a=new nB(new mX(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 nV("source",a):new nU("composite",a,r.value.zoomStops,r.value.interpolationType),this.paint._values[i]=new oO(r.property,n,r.parameters)}}_handleOverridablePaintPropertyUpdate(i,r,a){return!(!this.layout||r.isDataDriven()||a.isDataDriven())&&mQ.hasPaintOverride(this.layout,i)}static hasPaintOverride(i,r){let a=i.get("text-field"),n=mJ().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 rI)s(a.value.value.sections);else if("source"===a.value.kind){let i=r=>{o||(r instanceof rL&&rR(r.value)===r_?s(r.value.sections):r instanceof rB?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 l8(this,{zoom:r,lut:a}),overrideFog:!1}}hasElevation(){return this.layout&&"hd-road-markup"===this.layout.get("symbol-elevation-reference")}mayUse(i){return"HD"===i&&se(this,"symbol-elevation-reference",i=>"hd-road-markup"===i)}prepare(){return this.mayUse("HD")?mw():Promise.resolve()}}
7class m0 extends o7{constructor(i,r,a,n){super(i,{layout:B||(B=new oU({visibility:new ok(oj.layout_raster.visibility)})),paint:k||(k=new oU({"raster-opacity":new ok(oj.paint_raster["raster-opacity"]),"raster-color":new oV(oj.paint_raster["raster-color"]),"raster-color-mix":new ok(oj.paint_raster["raster-color-mix"]),"raster-color-range":new ok(oj.paint_raster["raster-color-range"]),"raster-color-scale":new ok(oj.paint_raster["raster-color-scale"]),"raster-hue-rotate":new ok(oj.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new ok(oj.paint_raster["raster-brightness-min"]),"raster-brightness-max":new ok(oj.paint_raster["raster-brightness-max"]),"raster-saturation":new ok(oj.paint_raster["raster-saturation"]),"raster-contrast":new ok(oj.paint_raster["raster-contrast"]),"raster-resampling":new ok(oj.paint_raster["raster-resampling"]),"raster-fade-duration":new ok(oj.paint_raster["raster-fade-duration"]),"raster-emissive-strength":new ok(oj.paint_raster["raster-emissive-strength"]),"raster-array-band":new ok(oj.paint_raster["raster-array-band"]),"raster-elevation":new ok(oj.paint_raster["raster-elevation"]),"raster-elevation-reference":new ok(oj.paint_raster["raster-elevation-reference"]),"raster-color-use-theme":new oN({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){let r=i?i._source:null;return(!r||"image"!==r.type&&"video"!==r.type&&"canvas"!==r.type||!r.onNorthPole&&!r.onSouthPole)&&0===this.paint.get("raster-elevation")}_handleSpecialPaintPropertyUpdate(i){"raster-color"!==i&&"raster-color-range"!==i&&"raster-color-scale"!==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];if(isNaN(a)&&isNaN(n)||a===this._curRampRange[0]&&n===this._curRampRange[1])return;let o=this._transitionablePaint._values["raster-color-scale"].value.expression.evaluate({zoom:0});this.colorRamp=mz({expression:r,evaluationKey:"rasterValue",image:this.colorRamp,clips:[{start:a,end:n}],resolution:1024,scale:o}),this.colorRampTexture=null,this._curRampRange=[a,n]}is3D(i){return this.paint.get("raster-elevation")>0}}class m1 extends o7{constructor(i,r,a,n){super(i,{layout:N||(N=new oU({visibility:new ok(oj["layout_raster-particle"].visibility)})),paint:V||(V=new oU({"raster-particle-array-band":new ok(oj["paint_raster-particle"]["raster-particle-array-band"]),"raster-particle-count":new ok(oj["paint_raster-particle"]["raster-particle-count"]),"raster-particle-color":new oV(oj["paint_raster-particle"]["raster-particle-color"]),"raster-particle-max-speed":new ok(oj["paint_raster-particle"]["raster-particle-max-speed"]),"raster-particle-speed-factor":new ok(oj["paint_raster-particle"]["raster-particle-speed-factor"]),"raster-particle-fade-opacity-factor":new ok(oj["paint_raster-particle"]["raster-particle-fade-opacity-factor"]),"raster-particle-reset-rate-factor":new ok(oj["paint_raster-particle"]["raster-particle-reset-rate-factor"]),"raster-particle-elevation":new ok(oj["paint_raster-particle"]["raster-particle-elevation"]),"raster-particle-color-use-theme":new oN({type:"string",default:"default","property-type":"data-driven"})}))},r,a,n),this._updateColorRamp(),this.lastInvalidatedAt=tJ.now()}mayUse(i){return"HD"===i}_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=mz({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 m2 extends o7{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 m3(i,r,a){let n=[0,0,1],o=eY([]);return eJ(o,o,a?-(i*tf)+Math.PI:i*tf),eK(o,o,-(r*tf)),eU(n,n,o),eF(n,n)}class m5{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 m4{constructor(){this.maxScale=1,this.maxXYTranslationDistance=0,this.instancedDataArray=new l_,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 tr(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 m6{constructor(i){this.requiresStandardRuntime=!0,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=sz(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=h??(l.properties&&Object.hasOwn(l.properties,"id")?l.properties.id:void 0),d=sN(l,o);if(!this.layers[0]._featureFilter.filter(new oC(this.zoom,{worldview:this.worldview,activeFloors:r.activeFloors}),d,a))continue;let p={id:i,sourceLayerIndex:c,index:u,geometry:o?d.geometry:sk(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*eR(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);eG(r.rotation,l)&&eG(r.scale,h)&&eG(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(cC(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(!cE(r,a,cz.Model,n)&&!(r.min.x>d||d>r.max.x||r.min.y>p||p>r.max.y)&&(f=cL(cD(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,p3.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 tF(`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 m4);let d=this.instancesPerModel[c],p=d.instancedDataArray,f=new m5(a,p.length);if(n){let r=dQ(i,n,void 0,o);s=r?r.feature:void 0}for(let i of r)for(let r of i){if(r.x<0||r.x>=8192||r.y<0||r.y>=8192)continue;if(0!==this.lookupDim&&u){let i=(this.lookupDim-1)/8192,a=this.lookupDim*(r.y*i|0)+r.x*i|0;if(this.lookup){if(0!==this.lookup[a])continue;this.lookup[a]=1}}this.instanceCount++;let i=p.length;if(p.resize(i+1),n){d.instancesRoadElevation||(d.instancesRoadElevation=[]);let i=s?s.pointElevation(new tr(r.x,r.y)):0;d.instancesRoadElevation.push(i)}d.instancesEvaluatedElevation.push(0),p.float32[16*i]=r.x,p.float32[16*i+1]=r.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),{r:d,g:p,b:f}=o.paint.get("model-color").evaluate(s,r,l),m=o.paint.get("model-color-mix-intensity").evaluate(s,r,l),_=[];this.maxVerticalOffset<c[2]&&(this.maxVerticalOffset=c[2]);let g=c[0]*c[0]+c[1]*c[1],y=g>0?Math.sqrt(g):0;a.maxScale=Math.max(Math.max(a.maxScale,u[0]),Math.max(u[1],u[2])),a.maxXYTranslationDistance=Math.max(a.maxXYTranslationDistance,y),this.maxScale=Math.max(Math.max(this.maxScale,u[0]),Math.max(u[1],u[2])),fi(_,h,u);let x=Math.round(100*m)+f/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];
7h[s]=(0|h[s])+d/1.05,h[s+1]=f+p/1.05,h[s+2]=x,h[s+3]=1/(l.z>10?this.tileToMeter:sz(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]=_[0],h[s+8]=_[1],h[s+9]=_[2],h[s+10]=_[4],h[s+11]=_[5],h[s+12]=_[6],h[s+13]=_[8],h[s+14]=_[9],h[s+15]=_[10],a.instancesEvaluatedElevation[o]=c[2]}}}nH(m6,"ModelBucket",{omit:["layers"]}),nH(m4,"PerModelAttributes"),nH(m5,"ModelFeature");let m8=new WeakMap;class m9{constructor(i,r){let a=i.gl;if(this.context=i,this.buffer=a.createBuffer(),!this.buffer)throw Error("Failed to create model part style UBO buffer");a.bindBuffer(a.UNIFORM_BUFFER,this.buffer),a.bufferData(a.UNIFORM_BUFFER,r,a.DYNAMIC_DRAW),a.bindBuffer(a.UNIFORM_BUFFER,null)}update(i){let r=this.context.gl;r.bindBuffer(r.UNIFORM_BUFFER,this.buffer),r.bufferSubData(r.UNIFORM_BUFFER,0,i),r.bindBuffer(r.UNIFORM_BUFFER,null)}bind(i,r){let a=m8.get(r);if(void 0===a){let n=i.gl,o=n.getUniformBlockIndex(r,"ModelPartStyleUniform");(a=o!==n.INVALID_INDEX)&&n.uniformBlockBinding(r,o,0),m8.set(r,a)}if(!a)return;let n=i.gl;n.bindBufferBase(n.UNIFORM_BUFFER,0,this.buffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),this.buffer=null)}}let m7=new Float32Array(262144),_e=new Uint8Array(262144),_t=[0,0,0],_i=[0,0,0];class _r{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.partStyle=new Float32Array(112),this.partStyleUBO=null,this.needsPartStyleUBO=!1,this.cameraCollisionOpacity=1,this.targetLod=-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 uB([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);if(!this.aabb){let i=0,r=new uB([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=uB.applyTransformFast(a.aabb,this.node.globalMatrix),r.encapsulate(a.transformedAabb)),i++;this.aabb=r}return this.aabb}}class _a{constructor(i,r,a,n,o,s,l,h){for(let u of(this.requiresStandardRuntime=!0,this.isTiled3dModelBucket=!0,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|=1,this.uploaded=!1,this.hasPattern=!1,n&&(this.modelTraits|=4),o&&(this.modelTraits|=8),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.needsPartStyleUBOs=!1,this.filter=null,this.nodesInfo=[],r))this.nodesInfo.push(new _r(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=uB.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(!ta(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.needsPartStyleUBOs}upload(i){if(this.needsPartStyleUBOs&&(this.createPartStyleUBOs(i),this.needsPartStyleUBOs=!1),!this.uploaded){let r=this.getNodesInfo();for(let a of r)fd(a.node,i,!0);for(let i of r)ff(i.node);this.uploaded=!0}}createPartStyleUBOs(i){for(let r of this.getNodesInfo())r.needsPartStyleUBO&&(r.partStyleUBO=new m9(i,r.partStyle),r.needsPartStyleUBO=!1)}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||_n(a.paint.get("model-color").value,s)||_n(a.paint.get("model-color-mix-intensity").value,s)||_n(a.paint.get("model-roughness").value,s)||_n(a.paint.get("model-emissive-strength").value,s)||_n(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)}}
7evaluate(i,r){for(let a of this.getNodesInfo()){if(!a.node.meshes)continue;let n=a.feature,o=r&&r[n.id];if(ta(o,a.state))continue;a.state=structuredClone(o);let s=a.node.meshes&&a.node.meshes[0].hasFeatureData,l=this.id.canonical;if(a.hasTranslucentParts=!1,s){for(let r=0;r<fo.length;r++){let s=fo[r];s.length&&(n.properties.part=s);let h=i.paint.get("model-color").evaluate(n,o,l).toPremultipliedRenderColor(null),u=i.paint.get("model-color-mix-intensity").evaluate(n,o,l);a.evaluatedColor[r]=[h.r,h.g,h.b,u],a.evaluatedRMEA[r][0]=i.paint.get("model-roughness").evaluate(n,o,l),a.evaluatedRMEA[r][2]=i.paint.get("model-emissive-strength").evaluate(n,o,l),a.evaluatedRMEA[r][3]=h.a,a.emissionHeightBasedParams[r]=i.paint.get("model-height-based-emissive-strength-multiplier").evaluate(n,o,l),!a.hasTranslucentParts&&h.a<1&&(a.hasTranslucentParts=!0)}delete n.properties.part}else a.evaluatedRMEA[0][2]=i.paint.get("model-emissive-strength").evaluate(n,o,l);a.evaluatedTranslation=i.paint.get("model-translation").evaluate(n,o,l),a.evaluatedScale=i.paint.get("model-scale").evaluate(n,o,l),s&&(function(i){let r=i.partStyle;for(let a=0;a<fo.length;a++){let n=i.evaluatedColor[a],o=i.evaluatedRMEA[a],s=i.emissionHeightBasedParams[a],l=tv(s[0],0,1),h=tv(s[1],0,1),u=16*a;r[u]=n[0],r[u+1]=n[1],r[u+2]=n[2],r[u+3]=tv(n[3],0,1),r[u+4]=o[0],r[u+5]=o[1],r[u+6]=tv(o[2],0,2),r[u+7]=o[3],l!==h?(r[u+8]=l,r[u+9]=h,r[u+10]=tv(s[2],0,1),r[u+11]=tv(s[3],0,1)-r[u+10],r[u+12]=Math.pow(10,tv(s[4],-1,1))):(r[u+8]=0,r[u+9]=1,r[u+10]=1,r[u+11]=0,r[u+12]=1),function(i,r){i[r+4]=16*Math.floor(15*i[r+4])/255,i[r+5]=16*Math.floor(15*i[r+5])/255,i[r+6]=Math.min(Math.floor(127.5*i[r+6]+.5),255)/255*2,i[r+7]=Math.floor(255*i[r+7])/255;let a=Math.floor(255*i[r+10])/256,n=Math.floor(255*(i[r+10]+i[r+11]))/256;i[r+10]=a,i[r+11]=n-a}(r,u)}}(a),a.partStyleUBO?a.partStyleUBO.update(a.partStyle):(a.needsPartStyleUBO=!0,this.needsPartStyleUBOs=!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=cB.create(i,a,o);if(!r)return;for(let o of(4&this.modelTraits&&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=tv(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)_e[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===_e[i*s+a]&&(_e[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===_e[i*s+a]&&(m7[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===_e[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(_e[c]>=i)continue;let p=m7[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),m7[o]=r._dem.set(n,a,h),_e[o]=i}}}}}l&&(r._demTile.needsDEMTextureUpload=!0,r._dem._timestamp=tJ.now())}setFilter(i){this.filter=i?oH(i):null}getNodesInfo(){return this.filter?this.nodesInfo.filter(i=>this.filter.filter(new oC(this.id.overscaledZ,{worldview:this.worldview}),i.feature,this.id.canonical)):this.nodesInfo}destroy(){for(let i of this.getNodesInfo())ff(i.node),f_(i.node),i.partStyleUBO&&(i.partStyleUBO.destroy(),i.partStyleUBO=null)}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=er([]);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(en(n,o.node.globalMatrix),a[0]=i,a[1]=r,a[2]=0,eN(a,a,n),o.node.meshBVH){let i=a[0],r=a[1];_t[0]=i-1,_t[1]=r-1,_t[2]=-1e3,_i[0]=i+1,_i[1]=r+1,_i[2]=1e3;let n=o.node.meshBVH.findHighestPoint(_t,_i);if(null!==n)return{height:n,maxHeight:o.feature.properties.height,hidden:o.hiddenByReplacement,verticalScale:o.evaluatedScale[2]};continue}if(!s.heightmap)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 tr(i,r),new tr(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 _n(i,r){return i instanceof nV&&!i.isLightConstant&&r}nH(_a,"Tiled3dModelBucket",{omit:["layers"]}),nH(_r,"Tiled3dModelFeature",{omit:["partStyleUBO"]});class _o{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]}}let _s=["id","tile","layer","source","sourceLayer","state"];class _l{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 _l(this._vectorTileFeature,this._z,this._x,this._y,this.id);return this.state&&(i.state={...this.state}),this.layer&&(i.layer={...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 _s)void 0!==this[r]&&(i[r]=this[r]);return i}}let _h={BaseColor:5,MetallicRoughness:6,Normal:7,Occlusion:8,Emission:9,LUT:10,ShadowMap0:11},_u=new Float32Array(er([])),_c=[0,0,0],_d=(i,r,a,n,o,s,l,h,u,c,d,p,f,m=[0,0,0],_,g,y,x=1,v=!1)=>{let b=_c,w=0,T=_c;if(!v){let i=o.style.light,r=i.properties.get("position");if(b=[-r.x,-r.y,r.z],"viewport"===i.properties.get("anchor")){let i=K();Q(i,-o.transform.angle),eV(b,b,i)}let a=i.properties.get("color").toNonPremultipliedRenderColor(null);w=i.properties.get("intensity"),T=[a.r,a.g,a.b]}let S="MASK"===d.alphaMode,E=f.paint.get("model-ambient-occlusion-intensity"),I=f.paint.get("model-color").constantOr(re.white).toNonPremultipliedRenderColor(null);return I.a=f.paint.get("model-color-mix-intensity").constantOr(0),y&&(I.r=y[0],I.g=y[1],I.b=y[2],I.a=y[3]),g&&(I.r=g.color.r,I.g=g.color.g,I.b=g.color.b,I.a=g.colorMix,p=g.emissionStrength,s*=g.opacity),{u_matrix:i,u_lighting_matrix:r,u_normal_matrix:a,u_node_matrix:n||_u,u_lightpos:b,u_lightintensity:w,u_lightcolor:T,u_camera_pos:m,u_opacity:s,u_baseTextureIsAlpha:0,u_alphaMask:+S,u_alphaCutoff:d.alphaCutoff,u_baseColorFactor:l.toNonPremultipliedRenderColor(null).toArray01(),u_emissiveFactor:h.toNonPremultipliedRenderColor(null).toArray01(),u_metallicFactor:u,u_roughnessFactor:c,u_baseColorTexture:_h.BaseColor,u_metallicRoughnessTexture:_h.MetallicRoughness,u_normalTexture:_h.Normal,u_occlusionTexture:_h.Occlusion,u_emissionTexture:_h.Emission,u_lutTexture:_h.LUT,u_color_mix:I.toArray01(),u_aoIntensity:E,u_emissive_strength:p,u_occlusionTextureTransform:_||[0,0,0,0],u_dithered_discard_threshold:x,u_model_mesh_params:[0,1,0,0]}},_p=(i,r=_u,a=_u)=>({u_matrix:i,u_instance:r,u_node_matrix:a});class _f{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}}_f.disabled=new _f({func:519,mask:0},0,0,7680,7680,7680);class _m{constructor(i,r,a,n){this.blendFunction=i,this.blendColor=r.toNonPremultipliedRenderColor(null),this.mask=a,this.blendEquation=n}}_m.Replace=[1,0,1,0],_m.disabled=new _m(_m.Replace,re.transparent,[!1,!1,!1,!1]),_m.unblended=new _m(_m.Replace,re.transparent,[!0,!0,!0,!0]),_m.alphaBlended=new _m([1,771,1,771],re.transparent,[!0,!0,!0,!0]),_m.alphaBlendedNonPremultiplied=new _m([770,771,770,771],re.transparent,[!0,!0,!0,!0]),_m.multiply=new _m([774,0,774,0],re.transparent,[!0,!0,!0,!0]),_m.multiplyAccumulateAlpha=new _m([774,0,1,771],re.transparent,[!0,!0,!0,!0]),_m.additive=new _m([1,1,1,1],re.transparent,[!0,!0,!0,!0]),_m.additiveAlphaWeighted=new _m([770,1,773,1],re.transparent,[!0,!0,!0,!0]),_m.additiveAlphaWeightedUnboundedAlpha=new _m([770,1,1,1],re.transparent,[!0,!0,!0,!0]);class __{constructor(i,r,a){this.func=i,this.mask=r,this.range=a}}__.ReadOnly=!1,__.ReadWrite=!0,__.disabled=new __(519,__.ReadOnly,[0,1]);class _g{constructor(i,r,a){this.enable=i,this.mode=r,this.frontFace=a}}_g.disabled=new _g(!1,1029,2305),_g.backCCW=new _g(!0,1029,2305),_g.backCW=new _g(!0,1029,2304),_g.frontCW=new _g(!0,1028,2304),_g.frontCCW=new _g(!0,1028,2305);class _y{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(i,r,a){return null!=r.top&&null!=i.top&&(this.top=i9(i.top,r.top,a)),null!=r.bottom&&null!=i.bottom&&(this.bottom=i9(i.bottom,r.bottom,a)),null!=r.left&&null!=i.left&&(this.left=i9(i.left,r.left,a)),null!=r.right&&null!=i.right&&(this.right=i9(i.right,r.right,a)),this}getCenter(i,r){return new tr(tv((this.left+i-this.right)/2,0,i),tv((this.top+r-this.bottom)/2,0,r))}equals(i){return this.top===i.top&&this.bottom===i.bottom&&this.left===i.left&&this.right===i.right}clone(){return new _y(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}function _x(i,r){let a=tG(i,3);e_(i,r),tZ(i,3,a)}function _v(i,r){let a=eY([]);return eQ(a,a,-r),eK(a,a,-i),a}function _b(i,r){let a=[i[0],i[1],0],n=[r[0],r[1],0];if(eb(a)>=1e-15){let i=eF([],a);eC(n,i,eO(n,i)),r[0]=n[0],r[1]=n[1]}let o=eB([],r,i);if(1e-15>eb(o))return null;let s=Math.atan2(-o[1],o[0]);return _v(Math.atan2(Math.sqrt(i[0]*i[0]+i[1]*i[1]),-i[2]),s)}class _w{constructor(i,r){this.position=i,this.orientation=r}get position(){return this._position}set position(i){if(i){let r=i instanceof sF?i:new sF(i[0],i[1],i[2]);
7this._renderWorldCopies&&(r.x=tw(r.x,0,1)),this._position=r}else this._position=null}lookAtPoint(i,r,a){if(this.orientation=null,!this.position)return;let n=this.position,o=a||(this._elevation?this._elevation.getAtPointOrZero(sF.fromLngLat(i)):0),s=sF.fromLngLat(i,o),l=[s.x-n.x,s.y-n.y,s.z-n.z];r||(r=[0,0,1]),r[2]=Math.abs(r[2]),this.orientation=_b(l,r)}setPitchBearing(i,r){this.orientation=_v(i*tf,-r*tf)}}class _T{constructor(i,r){this._transform=er([]),this.orientation=r,this.position=i}get mercatorPosition(){let i=this.position;return new sF(i[0],i[1],i[2])}get position(){let i=tG(this._transform,3);return[i[0],i[1],i[2]]}set position(i){i&&tZ(this._transform,3,[i[0],i[1],i[2],1])}get orientation(){return this._orientation}set orientation(i){this._orientation=i||eY([]),i&&_x(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=_v(i,r),_x(this._transform,this._orientation)}forward(){let i=tG(this._transform,2);return[-i[0],-i[1],-i[2]]}up(){let i=tG(this._transform,1);return[-i[0],-i[1],-i[2]]}right(){let i=tG(this._transform,0);return[i[0],i[1],i[2]]}getCameraToWorld(i,r){let a=new Float64Array(16);return en(a,this.getWorldToCamera(i,r)),a}getCameraToWorldMercator(){return this._transform}getWorldToCameraPosition(i,r,a){let n=this.position;eC(n,n,-i);let o=new Float64Array(16);return ep(o,[a,a,a]),es(o,o,n),o[10]*=r,o}getWorldToCamera(i,r){var a;let n=new Float64Array(16),o=new Float64Array(4),s=this.position;return o[0]=-(a=this._orientation)[0],o[1]=-a[1],o[2]=-a[2],o[3]=a[3],eC(s,s,-i),e_(n,o),es(n,n,s),n[1]*=-1,n[5]*=-1,n[9]*=-1,n[13]*=-1,n[8]*=r,n[9]*=r,n[10]*=r,n[11]*=r,n}getCameraToClipPerspective(i,r,a,n){let o=new Float64Array(16);return eg(o,i,r,a,n),o}getCameraToClipOrthographic(i,r,a,n,o,s){let l=new Float64Array(16);return ey(l,i,r,a,n,o,s),l}getDistanceToElevation(i,r=!1){let a=0===i?0:i/sC(r?r0(this.position[1]):this.position[1]),n=this.forward();return(a-this.position[2])/n[2]}clone(){return new _T([...this.position],[...this.orientation])}}let _S=Math.tan(85*Math.PI/180);function _E(i,r,a,n,o,s,l){let h=ee();if(a)if("globe"===s.name){let i=function(i,r){let{x:a,y:n}=i.point,o=u2(a,n,i.worldSize/i._pixelsPerMercatorPixel,0,0);return eo(o,o,uQ(uG(r)))}(o,r);eo(h,h,i)}else{let i=Y([],l);h[0]=i[0],h[1]=i[1],h[4]=i[2],h[5]=i[3],n||ec(h,h,o.angle)}else eo(h,o.labelPlaneMatrix,i);return h}function _I(i,r,a,n){let o=[i,r,a,1];a?eW(o,o,n):cF(o,o,n);let s=o[3];return o[0]/=s,o[1]/=s,o[2]/=s,o}function _A(i,r){return Math.min(.5+i/r*.5,1.5)}function _M(i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x){let{lineStartIndex:v,glyphStartIndex:b,segment:w}=h,T=b+h.numGlyphs,S=v+h.lineLength,E=r.getoffsetX(b),I=r.getoffsetX(T-1),A=_z(i*E,a,n,o,s,l,w,v,S,u,c,d,p,f,!0,m,_,g,y,x);if(!A)return null;let M=_z(i*I,a,n,o,s,l,w,v,S,u,c,d,p,f,!0,m,_,g,y,x);return M?{first:A,last:M}:null}function _C(i,r,a,n){return i===uh.horizontal&&Math.abs(n)>Math.abs(a)?{useVertical:!0}:i===uh.vertical?n>0?{needsFlipping:!0}:null:0!==r&&(0===a||Math.abs(n/a)>_S)?1===r?{needsFlipping:!0}:null:a<0?{needsFlipping:!0}:null}function _P(i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w){let T=r/24,S=i.lineOffsetX*T,E=i.lineOffsetY*T,{lineStartIndex:I,glyphStartIndex:A,numGlyphs:M,segment:C,writingMode:P,flipState:R}=i,D=I+i.lineLength,L=i=>{if(d){let[r,a,n]=i.up,o=c.length;dC(d,o+0,r,a,n),dC(d,o+1,r,a,n),dC(d,o+2,r,a,n),dC(d,o+3,r,a,n)}let[r,a,n]=i.point;dP(c,r,a,n,i.angle)};if(M>1){let r=_M(T,h,S,E,a,p,f,i,u,s,m,g,!1,y,x,v,b,w);if(!r)return{notEnoughRoom:!0};if(n&&!a){let[a,n,o]=r.first.point,[s,h,u]=r.last.point;[a,n]=_I(a,n,o,l),[s,h]=_I(s,h,u,l);let c=_C(P,R,(s-a)*_,h-n);if(i.flipState=c&&c.needsFlipping?1:2,c)return c}L(r.first);for(let i=A+1;i<A+M-1;i++){let r=_z(T*h.getoffsetX(i),S,E,a,p,f,C,I,D,u,s,m,g,!1,!1,y,x,v,b,w);if(!r)return c.length-=4*(i-A),{notEnoughRoom:!0};L(r)}L(r.last)}else{if(n&&!a){let r=_I(f.x,f.y,0,o),a=I+C+1,n=new tr(u.getx(a),u.gety(a)),s=_I(n.x,n.y,0,o),l=s[3]>0?s:_L(f,n,r,1,o,void 0,y,x.canonical),h=_C(P,R,(l[0]-r[0])*_,l[1]-r[1]);if(i.flipState=h&&h.needsFlipping?1:2,h)return h}let r=_z(T*h.getoffsetX(A),S,E,a,p,f,C,I,D,u,s,m,g,!1,!1,y,x,v,b,w);if(!r)return{notEnoughRoom:!0};L(r)}return{}}
7function _R(i,r,a){let n=1<<r.z,o=(i.x/8192+r.x)/n-a.mercCenter[0],s=(i.y/8192+r.y)/n-a.mercCenter[1];o-=Math.round(o);let l=[8192*o,8192*s,8192/(2*Math.PI),1];return eW(l,l,a.invMatrix),[l[0],l[1],l[2]]}function _D(i,r,a,n,o,s){let{x:l,y:h,z:u}=n.projectTilePoint(i.x,i.y,r);if(s){let[a,n,o]=_R(i,r,s);l+=(a-l)*s.t,h+=(n-h)*s.t,u+=(o-u)*s.t}if(!o)return _I(l,h,u,a);let[c,d,p]=o.getElevation(i,o.elevation,o.elevationFeature);return _I(l+c,h+d,u+p,a)}function _L(i,r,a,n,o,s,l,h,u){let c=_D(i.sub(r)._unit()._add(i),h,o,l,s,u);return eE(c,a,c),eF(c,c),eP(c,a,c,n)}function _z(i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b){let w=n?i-r:i+r,T=w>0?1:-1,S=0;n&&(T*=-1,S=Math.PI),T<0&&(S+=Math.PI);let E=h+l+(T>0?0:1)|0,I=o,A=o,M=0,C=0,P=Math.abs(w),R=[],D=[],L=s,z=L,F=ej([]),O=()=>_L(z,L,A,P-M+1,d,f,g,y.canonical,b);for(;M+C<=P;){if((E+=T)<h||E>=u)return null;if(A=I,z=L,R.push(A),m&&D.push(z),L=new tr(c.getx(E),c.gety(E)),!(I=p[E])){let i=_D(L,y.canonical,d,g,f,b);I=i[3]>0?p[E]=i:O()}M+=C;let i=eE([],I,A),r=eR(A,I);if(a&&r>0&&C>0&&eO(F,i)/(C*r)<v)return null;C=r,F=i}_&&f&&(p[E]&&(I=O(),C=eR(A,I),F=eE([],I,A)),p[E]=I);let B=(P-M)/C,k=L.sub(z)._mult(B)._add(z),N=eP([],A,F,B),V=[0,0,1],U=F[0],j=F[1];if(x&&(0!==(V=g.upVector(y.canonical,k.x,k.y))[0]||0!==V[1]||1!==V[2])){let i=[V[2],0,-V[0]],r=eB([],V,i);eF(i,i),eF(r,r),U=eO(F,i),j=eO(F,r)}if(a){let i=eB([],V,F);eF(i,i),eP(N,N,i,a*T)}let G=S+Math.atan2(j,U);return R.push(N),m&&D.push(k),{point:N,angle:G,path:R,tilePath:D,up:V}}function _F(i,r){let a=r.length,n=a+4*i;r.resize(n),r.float32.fill(-1/0,4*a,4*n)}class _O{constructor(i,r,a,n,o,s,l){this.tileSize=512,this._renderWorldCopies=void 0===o||o,this._minZoom=i||0,this._maxZoom=r||22,this._minPitch=a??0,this._maxPitch=n??60,this.setProjection(s),this.setMaxBounds(l),this.width=0,this.height=0,this._center=new sA(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 _y,this._projMatrixCache={},this._alignedProjMatrixCache={},this._fogTileMatrixCache={},this._expandedProjMatrixCache={},this._distanceTileDataCache={},this._camera=new _T,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.labelPlaneMatrix=new Float32Array(16),this.glCoordMatrix=new Float32Array(16),this.pixelMatrix=new Float64Array(16),this.pixelMatrixInverse=new Float64Array(16)}clone(){let i=new _O(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies,this.getProjection(),this.maxBounds);return i._elevation=this._elevation,i._centerAltitude=this._centerAltitude,i._centerAltitudeValidForE
7xaggeration=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
7xaggeration;(null==this._seaLevelZoom||a)&&this._updateCameraOnTerrain(),(i||a)&&this._constrainCamera(r),this._calcMatrices()}getProjection(){return tS(this.projection,["name","center","parallels"])}setProjection(i){this.projectionOptions=i||{name:"mercator"};let r=this.projection?this.getProjection():void 0;this.projection=cT(this.projectionOptions);let a=!ta(r,this.getProjection());return a&&this._calcMatrices(),this.mercatorFromTransition=!1,a}setOrthographicProjectionAtLowPitch(i){return this._orthographicProjectionAtLowPitch!==i&&(this._orthographicProjectionAtLowPitch=i,this._calcMatrices(),!0)}setMercatorFromTransition(){let i=this.projection.name;this.mercatorFromTransition=!0,this.projectionOptions={name:"mercator"},this.projection=cT({name:"mercator"});let r=i!==this.projection.name;return r&&this._calcMatrices(),r}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 1/sC(this.center.lat)*this.cameraWorldSizeForFog}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new tr(this.width,this.height)}get bearing(){return tw(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(i){let r=tv(i,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==r&&(this._unmodified=!1,this._pitch=r,this._calcMatrices())}get aspect(){return this.width/this.height}get fov(){return this._fov/Math.PI*180}set fov(i){i=Math.max(.01,Math.min(60,i)),this._fov!==i&&(this._unmodified=!1,this._fov=i*tf,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 horizontalFov(){return 2*Math.atan(Math.tan(.5*this._fov)*this.aspect)*tm}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()>
70&&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 i=this._elevation,r=[[.5,.2],[.3,.5],[.5,.5],[.7,.5],[.5,.8]],a=this.horizonLineFromTop(),n=0,o=0;for(let s=0;s<r.length;s++){let l=new tr(r[s][0]*this.width,a+r[s][1]*(this.height-a)),h=i.pointCoordinate(l);if(!h)continue;let u=1/Math.hypot(h[0]-this._camera.position[0],h[1]-this._camera.position[1]);n+=h[3]*u,o+=u}return 0===o?NaN:n/o}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(i){let r,a=this.rayIntersectionCoordinate(this.pointRayIntersection(this.centerPoint,i.toAltitude()));r=i.z<this._camera.position[2]?[a.x,a.y,a.z]:[i.x,i.y,i.z];let n=eb(eE([],this._camera.position,r));return tv(this._zoomFromMercatorZ(n),this._minZoom,this._maxZoom)}setFreeCameraOptions(i){var r,a;if(!this.height||!i.position&&!i.orientation)return;this._updateCameraState();let n=!1;if(i.orientation&&((r=i.orientation)[0]!==(a=this._camera.orientation)[0]||r[1]!==a[1]||r[2]!==a[2]||r[3]!==a[3])&&(n=this._setCameraOrientation(i.orientation)),i.position){let r=[i.position.x,i.position.y,i.position.z];eG(r,this._camera.position)||(this._setCameraPosition(r),n=!0)}n&&(this._updateStateFromCamera(),this.recenterOnTerrain())}getFreeCameraOptions(){this._updateCameraState();let i=this._camera.position,r=new _w;return r.position=new sF(i[0],i[1],i[2]),r.orientation=this._camera.orientation,r._elevation=this.elevation,r._renderWorldCopies=this.renderWorldCopies,r}_setCameraOrientation(i){var r,a,n,o;if(r=i[0],a=i[1],!Math.sqrt(r*r+a*a+(n=i[2])*n+(o=i[3])*o))return!1;eq(i,i);let s=eU([],[0,0,-1],i),l=eU([],[0,-1,0],i);if(l[2]<0)return!1;let h=_b(s,l);return!!h&&(this._camera.orientation=h,!0)}_setCameraPosition(i){let r=this.zoomScale(this.minZoom)*this.tileSize,a=this.zoomScale(this.maxZoom)*this.tileSize,n=this.cameraToCenterDistance;i[2]=tv(i[2],n/a,n/r),this._camera.position=i}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}get fovAboveCenter(){return this._fov*(.5+this.centerOffset.y/this.height)}isPaddingEqual(i){return this._edgeInsets.equals(i)}interpolatePadding(i,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(i){let r=[new ct(0,i)];if(this.renderWorldCopies){let a=this.pointCoordinate(new tr(0,0)),n=this.pointCoordinate(new tr(this.width,0)),o=this.pointCoordinate(new tr(this.width,this.height)),s=this.pointCoordinate(new tr(0,this.height)),l=Math.floor(Math.min(a.x,n.x,o.x,s.x)),h=Math.floor(Math.max(a.x,n.x,o.x,s.x));for(let a=l-1;a<=h+1;a++)0!==a&&r.push(new ct(a,i))}return r}isLODDisabled(i){return(!i||this.pitch<=60)&&this._edgeInsets.top<=this._edgeInsets.bottom&&!this._elevation&&!this.projection.isReprojectedInTileSpace}extendTileCover(i,r,a,n){let o=[],s=null!=a,l=!s;if(l&&this.zoom<r||s&&0===a[0]&&0===a[1])return o;let h=new Set,u=(i,r,a,n,s)=>{let l=cr(r,i,a,n,s);h.has(l)||(o.push(new ci(i,r,a,n,s)),h.add(l))};for(let o=0;o<i.length;o++){let h=i[o];if(l&&h.canonical.z!==r||s&&void 0!==n&&n>h.canonical.z)continue;let c=h.canonical,d=h.overscaledZ,p=h.wrap,f=1<<c.z,m=c.x+1<f,_=c.x>0,g=c.y+1<f,y=c.y>0,x=h.wrap-!_,v=h.wrap+ +!m,b=_?c.x-1:f-1,w=m?c.x+1:0;if(s)a[0]<0?(u(d,v,c.z,w,c.y),a[1]<0&&g&&(u(d,p,c.z,c.x,c.y+1),u(d,v,c.z,w,c.y+1)),a[1]>0&&y&&(u(d,p,c.z,c.x,c.y-1),u(d,v,c.z,w,c.y-1))):a[0]>0?(u(d,x,c.z,b,c.y),a[1]<0&&g&&(u(d,p,c.z,c.x,c.y+1),u(d,x,c.z,b,c.y+1)),a[1]>0&&y&&(u(d,p,c.z,c.x,c.y-1),u(d,x,c.z,b,c.y-1))):a[1]<0&&g?u(d,p,c.z,c.x,c.y+1):y&&u(d,p,c.z,c.x,c.y-1);else{let i=h.visibleQuadrants;1&i&&(u(d,x,c.z,b,c.y),y&&(u(d,p,c.z,c.x,c.y-1),u(d,x,c.z,b,c.y-1))),2&i&&(u(d,v,c.z,w,c.y),y&&(u(d,p,c.z,c.x,c.y-1),u(d,v,c.z,w,c.y-1))),4&i&&(u(d,x,c.z,b,c.y),g&&(u(d,p,c.z,c.x,c.y+1),u(d,x,c.z,b,c.y+1))),8&i&&(u(d,v,c.z,w,c.y),g&&(u(d,p,c.z,c.x,c.y+1),u(d,v,c.z,w,c.y+1)))}}let c=[];for(let i of o)o.some(r=>i.isChildOf(r))||c.push(i);if(o=c.filter(a=>!i.some(i=>!!(a.overscaledZ<r&&i.isChildOf(a))||a.equals(i)||a.isChildOf(i))),l){let i=1<<r,a="globe"===this.projection.name?this._camera.mercatorPosition:this.pointCoordinate(this.getCameraPoint()),n=[i*a.x,i*a.y];o=o.filter(i=>{let r=i.canonical.x+.5-n[0],a=i.canonical.y+.5-n[1];return r*r+a*a<16})}return o}extendTileCoverToNearPlane(i,r,a){let n=[],o=new Set;for(let r of i)o.add(r.key);let s=(i,r,a,s,l)=>{let h=cr(r,i,a,s,l);o.has(h)||(n.push(new ci(i,r,a,s,l)),o.add(h))},l=i.reduce((i,r)=>
7Math.max(i,r.overscaledZ),a),h=1<<a,u=[new tr(0,0),new tr(8192,0),new tr(8192,8192),new tr(0,8192)],c=new tr(0,0),d=new tr(0,0),p=(i,r)=>{let n=Math.floor(i[0]),o=Math.floor(i[1]),p=(i[0]-n)*8192,f=(i[1]-o)*8192,m=Math.floor(r[0]),_=Math.floor(r[1]),g=(r[0]-m)*8192,y=(r[1]-_)*8192;for(let i=-1;i<=1;i++){let r=n+i;if(!(r<0||r>=h)){c.x=p-8192*i,d.x=g-(r-m)*8192;for(let i=-1;i<=1;i++){let n=o+i;c.y=f-8192*i,d.y=y-(n-_)*8192,hS(c,d,u)&&s(l,0,a,r,n)}}}},f=r.points,m=f[3],_=f[2],g=this._projectToGround(m,f[7]),y=this._projectToGround(_,f[6]);return p(m,g),p(_,y),n}_projectToGround(i,r){return ek(ex(),i,r,i[2]/(i[2]-r[2]))}_projectToZ(i,r,a){let n=i[2]-r[2];return 1e-6>Math.abs(n)?ev(i):ek(ex(),i,r,(i[2]-a)/n)}extendTileCoverForTunnels(i,r,a,n){if(a<18)return[];let o=r.points,s=o[0],l=o[1],h=o[4],u=o[5];if(h[2]>=0&&u[2]>=0||s[2]<=0||l[2]<=0)return[];let c=h[2]<0?this._projectToZ(s,h,0):h,d=u[2]<0?this._projectToZ(l,u,0):u,p=-n,f=h[2]<p?this._projectToZ(s,h,p):h,m=u[2]<p?this._projectToZ(l,u,p):u,_=this._findExtensionTilesInQuad(i,a,[m,f,d,c],[.5*(c[0]+d[0]),.5*(c[1]+d[1])]);return _.length>3&&(_.length=3),_}_findExtensionTilesInQuad(i,r,a,n){let o=[],s=new Set;for(let r of i)s.add(r.key);let l=i.reduce((i,r)=>Math.max(i,r.overscaledZ),r),h=1<<r,u=[new tr(a[0][0],a[0][1]),new tr(a[1][0],a[1][1]),new tr(a[3][0],a[3][1]),new tr(a[2][0],a[2][1]),new tr(a[0][0],a[0][1])],c=a[0][0],d=a[1][0],p=a[2][0],f=a[3][0],m=a[0][1],_=a[1][1],g=a[2][1],y=a[3][1],x=Math.max(0,Math.floor(Math.min(c,d,p,f))),v=Math.min(h-1,Math.ceil(Math.max(c,d,p,f))-1),b=Math.max(0,Math.floor(Math.min(m,_,g,y))),w=Math.min(h-1,Math.ceil(Math.max(m,_,g,y))-1);for(let i=b;i<=w;i++)for(let a=x;a<=v;a++){if(!hT(u,a,i,a+1,i+1))continue;let n=cr(0,l,r,a,i);s.has(n)||(o.push(new ci(l,0,r,a,i)),s.add(n))}let T=n[0],S=n[1];return o.sort((i,r)=>{let a=i.canonical.x+.5-T,n=i.canonical.y+.5-S,o=r.canonical.x+.5-T,s=r.canonical.y+.5-S;return a*a+n*n-(o*o+s*s)||i.canonical.x-r.canonical.x||i.canonical.y-r.canonical.y}),o}coveringTiles(i){let r,a=this.coveringZoomLevel(i),n=a,o=this.elevation&&this.elevation.exaggeration(),s=o&&!i.isTerrainDEM,l="mercator"===this.projection.name;if(void 0!==i.minzoom&&a<i.minzoom)return[];void 0!==i.maxzoom&&a>i.maxzoom&&(a=i.maxzoom);let h=this.locationCoordinate(this.center),u=this.center.lat,c=1<<a,d=[c*h.x,c*h.y,0],p="globe"===this.projection.name,f=!p,m=uO.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,a,f),_=p?this._camera.mercatorPosition:this.pointCoordinate(this.getCameraPoint()),g=c*(1/sC(this.center.lat)),y=this._camera.position[2]/(1/sC(this.center.lat)),x=[c*_.x,c*_.y,y*(f?1:g)],v=p||o,b=this.cameraToCenterDistance/i.tileSize*(i.roundZoom?1:.502),w=this.isLODDisabled(!0)?a:0;if(this._elevation&&i.isTerrainDEM)r=1e4*this._elevation.exaggeration();else if(this._elevation){let i=this._elevation.getMinMaxForVisibleTiles();r=i?i.max:this._centerAltitude}else r=this._centerAltitude;let T=i.isTerrainDEM?-r:this._elevation?this._elevation.getMinElevationBelowMSL():0,S=this.projection.isReprojectedInTileSpace?p6(this):1,E=i=>{let r=1/4e4,a=new sF(i.x+r,i.y,i.z),n=new sF(i.x,i.y+r,i.z),o=i.toLngLat(),s=a.toLngLat(),l=n.toLngLat(),h=this.locationCoordinate(o),u=this.locationCoordinate(s),c=this.locationCoordinate(l);return Math.sqrt(Math.hypot(u.x-h.x,u.y-h.y)*Math.hypot(c.x-h.x,c.y-h.y))*S/r},I=i=>{let a=r;return{aabb:co(this,c,0,0,0,i,T,a,this.projection),zoom:0,x:0,y:0,minZ:T,maxZ:a,wrap:i,fullyVisible:!1}},A=[],M=[],C=a,P=i.reparseOverscaled?n:a,R=(y-this._centerAltitude)*g,D=i=>{if(!this._elevation||!i.tileID||!l)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=z(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)},z=i=>{if(i.zoom<w)return!0;if(i.zoom===C)return!1;if(null!=i.shouldSplit)return i.shouldSplit;let r=i.aabb.distanceX(x),a=i.aabb.distanceY(x),o=R,h=1;if(p){o=i.aabb.distanceZ(x);let r=Math.pow(2,i.zoom),a=Math.min(Math.max(u,r0((i.y+1)/r)),r0(i.y/r)),n=sC(a)/sC(u);if(h=a===u?1/Math.max(1,this._mercatorScaleRatio-.3):Math.min(1,n/this._mercatorScaleRatio),this.zoom<=5&&i.zoom===C-1&&n>=.9)return!0}else if(s&&(o=i.aabb.distanceZ(x)*g),this.projection.isReprojectedInTileSpace&&n<=5){let r=Math.pow(2,i.zoom),a=E(new sF((i.x+.5)/r,(i.y+.5)/r));h=a>.85?1:a}if(!l&&!p){let n=Math.sqrt(r*r+a*a+o*o),s=(1<<C-i.zoom)*b*h;return s*=L(Math.max(o,R),n),n<s}let c=Number.MAX_VALUE,f=0,m=i.aabb.getCorners(),_=[0,0,0];for(let i of m){eE(_,i,x),p||(s?_[2]*=g:_[2]=R);let r=eO(_,this._camera.forward());r<c&&(c=r,f=Math.abs(_[2]))}let y=(1<<C-i.zoom)*b*h;if(y*=L(Math.max(f,R),c),c<y)return!0;let v=i.aabb.closestPoint(d);return v[0]===d[0]&&v[1]===d[1]};if(this.renderWorldCopies)for(let i=1;i<=3;i++)A.push(I(-i)),A.push(I(i));for(A.push(I(0));A.length>0;){let r=A.pop(),n=r.x,o=r.y,h=r.fullyVisible,u=()=>"globe"===this.projection.name&&(0===r.y||r.y===(1<<r.zoom)-1);if(!h){let i=v?r.aabb.intersects(m):r.aabb.intersectsFlat(m);if(0===i&&u()&&(i=uH(this,c,new ce(r.zoom,n,o),!0).intersects(m)),0===i)continue;h=2===i}if(r.zoom===C||!z(r)){let s=r.zoom===C?P:r.zoom;if(i.minzoom&&i.minzoom>s)continue;let l=0;if(!h){let a=v?r.aabb.intersectsPrecise(m):r.aabb.intersectsPreciseFlat(m);if(0===a&&u()&&(a=uH(this,c,new ce(r.zoom,n,o),!0).intersectsPrecise(m)),0===a)continue;if(i.calculateQuadrantVisibility)if(m.containsPoint(r.aabb.center))l=15;else for(let i=0;i<4;i++)0!==r.aabb.quadrant(i).intersects(m)&&(l|=1<<i)}let p=d[0]-(.5+n+(r.wrap<<r.zoom))*(1<<a-r.zoom),f=d[1]-.5-o,_=r.tileID?r.tileID:new ci(s,r.wrap,r.zoom,n,o);i.calculateQuadrantVisibility&&(_.visibleQuadrants=l),M.push({tileID:_,distanceSq:p*p+f*f});continue}for(let i=0;i<4;i++){let a=(n<<1)+i%2,u=(o<<1)+(i>>1),d={aabb:l?r.aabb.quadrant(i):co(this,c,r.zoom+1,a,u,r.wrap,r.minZ,r.maxZ,this.projection),zoom:r.zoom+1,x:a,y:u,wrap:r.wrap,fullyVisible:h,tileID:void 0,shouldSplit:void 0,minZ:r.minZ,maxZ:r.maxZ};s&&!p&&(d.tileID=new ci(r.zoom+1===C?P:r.zoom+1,r.wrap,r.zoom+1,a,u),D(d)),A.push(d)}}if(this.fogCullDistSq){let a=this.fogCullDistSq,n=this.horizonLineFromTop();M=M.filter(o=>{var s,l;let h=[0,0,0,1],u=[8192,8192,0,1],c=this.calculateFogTileMatrix(o.tileID.toUnwrapped());eW(h,h,c),eW(u,u,c);let d=function(i,r){let a=0;for(let n=0;n<2;++n)i[n]>0&&(a+=(i[n]-0)*(i[n]-0)),r[n]<0&&(a+=(0-r[n])*(0-r[n]));return a}(((s=[])[0]=Math.min(h[0],u[0]),s[1]=Math.min(h[1],u[1]),s[2]=Math.min(h[2],u[2]),s[3]=Math.min(h[3],u[3]),s),((l=[])[0]=Math.max(h[0],u[0]),l[1]=Math.max(h[1],u[1]),l[2]=Math.max(h[2],u[2]),l[3]=Math.max(h[3],u[3]),l));if(0===d)return!0;let p=!1,f=this._elevation;if(f&&d>a&&0!==n){let a,s=this.calculateProjMatrix(o.tileID.toUnwrapped());i.isTerrainDEM||(a=f.getMinMaxForTile(o.tileID)),a||(a={min:T,max:r});let l=tg[Math.round((this.rotation+45+360)%360/90)%4],h=[8192*l[0],8192*l[1],a.max];eN(h,h,s),p=(1-h[1])*this.height*.5<n}return d<a||p})}return M.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(i){let r=tv(i.lat,-85.051129,85.051129),a=this.projection.project(i.lng,r);return new tr(a.x*this.worldSize,a.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/(1/sC(this.center.lat))/this.worldSize}setLocationAtPoint(i,r){let a,n,o=this.centerPoint;if("globe"===this.projection.name){let i=this.worldSize;a=(r.x-o.x)/i,n=(r.y-o.y)/i}else{let i=this.pointCoordinate(r),s=this.pointCoordinate(o);a=i.x-s.x,n=i.y-s.y}let s=this.locationCoordinate(i);this.setLocation(new sF(s.x-a,s.y-n))}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(i,r){let a=r?r/sC(i.lat):void 0,n=this.projection.project(i.lng,i.lat);return new sF(n.x,n.y,a)}coordinateLocation(i){return this.projection.unproject(i.x,i.y)}pointRayIntersection(i,r){let a=r??this._centerAltitude,n=[i.x,i.y,0,1],o=[i.x,i.y,1,1];eW(n,n,this.pixelMatrixInverse),eW(o,o,this.pixelMatrixInverse);let s=o[3];eH(n,n,1/n[3]),eH(o,o,1/s);let l=n[2],h=o[2];return{p0:n,p1:o,t:l===h?0:(a-l)/(h-l)}}screenPointToMercatorRay(i){let r=[i.x,i.y,0,1],a=[i.x,i.y,1,1];return eW(r,r,this.pixelMatrixInverse),eW(a,a,this.pixelMatrixInverse),eH(r,r,1/r[3]),eH(a,a,1/a[3]),r[2]=r[2]/sC(this._center.lat)*this.worldSize,a[2]=a[2]/sC(this._center.lat)*this.worldSize,eH(r,r,1/this.worldSize),eH(a,a,1/this.worldSize),new uC([r[0],r[1],r[2]],eF([],eE([],a,r)))}rayIntersectionCoordinate(i){let{p0:r,p1:a,t:n}=i,o=r[2]/sC(this._center.lat),s=a[2]/sC(this._center.lat);return new sF(i9(r[0],a[0],n)/this.worldSize,i9(r[1],a[1],n)/this.worldSize,i9(o,s,n))}pointCoordinate(i,r=this._centerAltitude){return this.projection.pointCoordinate(this,i.x,i.y,r)}pointCoordinate3D(i,r){if(!this.elevation)return this.pointCoordinate(i,r);let a=this.projection.pointCoordinate3D(this,i.x,i.y);if(a)return new sF(a[0],a[1],a[2]);let n=0,o=this.horizonLineFromTop();if(i.y>o)return this.pointCoordinate(i,r);let s=.02*o,l=i.clone();for(let i=0;i<10&&o-n>s;i++){l.y=i9(n,o,.66);let i=this.projection.pointCoordinate3D(this,l.x,l.y);i?(o=l.y,a=i):n=l.y}return a?new sF(a[0],a[1],a[2]):this.pointCoordinate(i)}isPointAboveHorizon(i){return this.projection.isPointAboveHorizon(this,i)}isPointOnSurface(i){if(i.y<0||i.y>this.height||i.x<0||i.x>this.width)return!1;if(this.elevation||this.zoom>=6)return!this.isPointAboveHorizon(i);let r=this.pointCoordinate(i);return r.y>=0&&r.y<=1}_coordinatePoint(i,r){let a=r&&this.elevation?this.elevation.getAtPointOrZero(i,this._centerAltitude):this._centerAltitude,n=[i.x*this.worldSize,i.y*this.worldSize,a+i.toAltitude(),1];return eW(n,n,this.pixelMatrix),n[3]>
70?new tr(n[0]/n[3],n[1]/n[3]):new tr(Number.MAX_VALUE,Number.MAX_VALUE)}_getBoundsNonRectangular(){let{top:i,left:r}=this._edgeInsets,a=this.height-this._edgeInsets.bottom,n=this.width-this._edgeInsets.right,o=this.pointLocation3D(new tr(r,i)),s=this.pointLocation3D(new tr(n,i)),l=this.pointLocation3D(new tr(n,a)),h=this.pointLocation3D(new tr(r,a)),u=Math.min(o.lng,s.lng,l.lng,h.lng),c=Math.max(o.lng,s.lng,l.lng,h.lng),d=Math.min(o.lat,s.lat,l.lat,h.lat),p=Math.max(o.lat,s.lat,l.lat,h.lat),f=Math.pow(2,-this.zoom)/16*270,m="globe"===this.projection.name?1:4,_=(i,r,a,n,o)=>{let s=(i+a)/2,l=(r+n)/2,h=new tr(s,l),{lng:g,lat:y}=this.pointLocation3D(h),x=Math.max(0,u-g,d-y,g-c,y-p);u=Math.min(u,g),c=Math.max(c,g),d=Math.min(d,y),p=Math.max(p,y),(o<m||x>f)&&(_(i,r,s,l,o+1),_(s,l,a,n,o+1))};if(_(r,i,n,i,1),_(n,i,n,a,1),_(n,a,r,a,1),_(r,a,r,i,1),"globe"===this.projection.name){let[i,r]=function(i){let r=er(new Float64Array(16));eo(r,i.pixelMatrix,i.globeMatrix);let a=[0,sT,0],n=[0,sb,0];return eN(a,a,r),eN(n,n,r),[a[0]>0&&a[0]<=i.width&&a[1]>0&&a[1]<=i.height&&!u4(i,new sA(i.center.lat,90)),n[0]>0&&n[0]<=i.width&&n[1]>0&&n[1]<=i.height&&!u4(i,new sA(i.center.lat,-90))]}(this);i?(p=90,c=180,u=-180):r&&(d=-90,c=180,u=-180)}return new sM(new sA(u,d),new sA(c,p))}_getBoundsRectangular(i,r){let{top:a,left:n}=this._edgeInsets,o=this.height-this._edgeInsets.bottom,s=this.width-this._edgeInsets.right,l=new tr(n,a),h=new tr(s,a),u=new tr(s,o),c=new tr(n,o),d=this.pointCoordinate(l,i),p=this.pointCoordinate(h,i),f=this.pointCoordinate(u,r),m=this.pointCoordinate(c,r),_=(i,r)=>(r.y-i.y)/(r.x-i.x);return d.y>1&&p.y>=0?d=new sF((1-m.y)/_(m,d)+m.x,1):d.y<0&&p.y<=1&&(d=new sF(-m.y/_(m,d)+m.x,0)),p.y>1&&d.y>=0?p=new sF((1-f.y)/_(f,p)+f.x,1):p.y<0&&d.y<=1&&(p=new sF(-f.y/_(f,p)+f.x,0)),(new sM).extend(this.coordinateLocation(d)).extend(this.coordinateLocation(p)).extend(this.coordinateLocation(m)).extend(this.coordinateLocation(f))}_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(i){this.maxBounds=i,this.minLat=-85.051129,this.maxLat=85.051129,this.minLng=-180,this.maxLng=180,i&&(this.minLat=i.getSouth(),this.maxLat=i.getNorth(),this.minLng=i.getWest(),this.maxLng=i.getEast(),this.maxLng<this.minLng&&(this.maxLng+=360)),this.worldMinX=rK(this.minLng)*this.tileSize,this.worldMaxX=rK(this.maxLng)*this.tileSize,this.worldMinY=rJ(this.maxLat)*this.tileSize,this.worldMaxY=rJ(this.minLat)*this.tileSize,this._constrain()}calculatePosMatrix(i,r){return this.projection.createTileMatrix(this,r,i)}calculateDistanceTileData(i){let r=i.key,a=this._distanceTileDataCache;if(a[r])return a[r];let n=i.canonical,o=1/this.height,s=this.cameraWorldSize,l=s/this.zoomScale(n.z),h=(n.x+Math.pow(2,n.z)*i.wrap)*l,u=n.y*l,c=this.point;c.x*=s/this.worldSize,c.y*=s/this.worldSize;let d=this.angle,p=Math.sin(-d),f=-Math.cos(-d);return a[r]={bearing:[p,f],center:[(c.x-h)*o,(c.y-u)*o],scale:l/8192*o},a[r]}calculateFogTileMatrix(i){let r=i.key,a=this._fogTileMatrixCache;if(a[r])return a[r];let n=this.projection.createTileMatrix(this,this.cameraWorldSizeForFog,i);return eo(n,this.worldToFogMatrix,n),a[r]=new Float32Array(n),a[r]}calculateProjMatrix(i,r=!1,a=!1){let n,o=i.key;if((n=a?this._expandedProjMatrixCache:r?this._alignedProjMatrixCache:this._projMatrixCache)[o])return n[o];let s=this.calculatePosMatrix(i,this.worldSize);return eo(s,this.projection.isReprojectedInTileSpace?this.mercatorMatrix:a?this.expandedFarZProjMatrix:r?this.alignedProjMatrix:this.projMatrix,s),n[o]=new Float32Array(s),n[o]}calculatePixelsToTileUnitsMatrix(i){let r=i.tileID.key,a=this._pixelsToTileUnitsCache;if(a[r])return a[r];let n=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;
7return new Float32Array([o[0]*n,o[1]*n,o[2]*n,o[3]*n])}(i,this);return a[r]=n,a[r]}customLayerMatrix(){return this.mercatorMatrix.slice()}globeToMercatorMatrix(){if("globe"===this.projection.name){let i=1/this.worldSize,r=ep([],[i,i,i]);return eo(r,r,this.globeMatrix),r}}recenterOnTerrain(){if(!this._elevation||"globe"===this.projection.name)return;let i=this._elevation;this._updateCameraState();let r=1/sC(this._center.lat)*this.worldSize,a=this._computeCameraPosition(r),n=this._camera.forward(),o=1/sC(this._center.lat);a[2]/=o,n[2]/=o,eF(n,n);let s=i.raycast(a,n,i.exaggeration());if(s){let i=eP([],a,n,s),r=new sF(i[0],i[1],i[2]/sC(r0(i[1]))),l=(r.z+eb([r.x-a[0],r.y-a[1],r.z-a[2]*o]))*this._pixelsPerMercatorPixel;this._seaLevelZoom=this._zoomFromMercatorZ(l),this._centerAltitude=r.toAltitude(),this._center=this.coordinateLocation(r),this._updateZoomFromElevation(),this._constrain(),this._calcMatrices()}}_constrainCamera(i=!1){if(!this._elevation)return;let r=this._elevation,a=1/sC(this._center.lat)*this.worldSize,n=this._computeCameraPosition(a),o=r.getAtPointOrZero(new sF(...n)),s=this.pixelsPerMeter/this.worldSize*o,l=this._minimumHeightOverTerrain(),h=n[2]-s;if(h<=l)if(h<0||i){let i=this.locationCoordinate(this._center,this._centerAltitude),r=[n[0],n[1],i.z-n[2]],a=eb(r);r[2]-=(l-h)/this._pixelsPerMercatorPixel;let o=eb(r);if(0===o)return;eC(r,r,a/o*this._pixelsPerMercatorPixel),this._camera.position=[n[0],n[1],i.z*this._pixelsPerMercatorPixel-r[2]],this._updateStateFromCamera()}else this._isCameraConstrained=!0}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;let i="globe"===this.projection.name||this.mercatorFromTransition;if(this.projection.isReprojectedInTileSpace||i){let r=this.center;return r.lat=tv(r.lat,this.minLat,this.maxLat),!this.maxBounds&&(this.renderWorldCopies||i)||(r.lng=tv(r.lng,this.minLng,this.maxLng)),this.center=r,void(this._constraining=!1)}let r=this._unmodified,{x:a,y:n}=this.point,o=0,s=a,l=n,h=this.width/2,u=this.height/2,c=this.worldMinY*this.scale,d=this.worldMaxY*this.scale;if(n-u<c&&(l=c+u),n+u>d&&(l=d-u),d-c<this.height&&(o=Math.max(o,this.height/(d-c)),l=(d+c)/2),this.maxBounds||!this._renderWorldCopies||!this.projection.wrap){let i=this.worldMinX*this.scale,r=this.worldMaxX*this.scale,n=this.worldSize/2-(i+r)/2;(s=(a+n+this.worldSize)%this.worldSize-n)-h<i&&(s=i+h),s+h>r&&(s=r-h),r-i<this.width&&(o=Math.max(o,this.width/(r-i)),s=(r+i)/2)}s===a&&l===n||this._allowWorldUnderZoom||(this.center=this.unproject(new tr(s,l))),o&&!this._allowWorldUnderZoom&&(this.zoom+=this.scaleZoom(o)),this._constrainCamera(),this._unmodified=r,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 i;if(!this.height)return;let r=this.centerOffset,a="globe"===this.projection.name,n=this.pixelsPerMeter;"globe"===this.projection.name&&(this._mercatorScaleRatio=1/sC(this.center.lat)/(1/sC(45)));let o=p8(this.projection,this.zoom,this.width,this.height,1024);this._pixelsPerMercatorPixel=this.projection.pixelSpaceConversion(this.center.lat,this.worldSize,o),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 s="meters"===this.projection.zAxisUnit?n:1,l=this._camera.getWorldToCamera(this.worldSize,s),h=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,this._farZ);if(h[8]=-(2*r.x)/this.width,h[9]=2*r.y/this.height,this.isOrthographic){let a=.5*this.height/Math.tan(this._fov/2)*1*Math.tan(.5*this._fov),n=a*this.aspect,o=-n,s=-a;n-=r.x,o-=r.x,a+=r.y,s+=r.y,((i,r,a,n)=>{for(let o=0;o<16;o++)i[o]=i9(r[o],a[o],n)})(i=this._camera.getCameraToClipOrthographic(o,n,s,a,this._nearZ+this._nearClipOffset,this._farZ),i,h,tX(this.pitch>=15?1:this.pitch/15))}else i=h;let u=eo([],h,l),c=eo([],i,l);if(this.projection.isReprojectedInTileSpace){let i=this.locationCoordinate(this.center);er(this._mat4Scratch);let r=this._mat4Scratch;es(r,r,[i.x*this.worldSize,i.y*this.worldSize,0]),eo(r,r,p4(this)),es(r,r,[-i.x*this.worldSize,-i.y*this.worldSize,0]),eo(c,c,r),eo(u,u,r),this.inverseAdjustmentMatrix=function(i){let r=p4(i,!0);return Y([],[r[0],r[1],r[4],r[5]])}(this)}else this.inverseAdjustmentMatrix=[1,0,0,1];if(el(this.mercatorMatrix,c,[this.worldSize,this.worldSize,this.worldSize/s,1]),this.projMatrix=c,en(this.invProjMatrix,this.projMatrix),a){let i=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,1/0);i[8]=-(2*r.x)/this.width,i[9]=2*r.y/this.height,eo(this._expandedFarZProjMatrixBuf,i,l),this.expandedFarZProjMatrix=this._expandedFarZProjMatrixBuf}else this.expandedFarZProjMatrix=this.projMatrix;en(this._mat4Scratch,i),this.frustumCorners=uP.fromInvProjectionMatrix(this._mat4Scratch,this.horizonLineFromTop(),this.height),this.cameraFrustum=uO.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,0,!a),ep(this.skyboxMatrix,[1,-1,1]),eh(this.skyboxMatrix,this.skyboxMatrix,this._pitch),ec(this.skyboxMatrix,this.skyboxMatrix,this.angle),eg(this.starsProjMatrix,this._fov,this.width/this.height,this._nearZ,this._farZ);let d=(Math.PI/2-this._pitch)*(this.height/this._fov)*this._horizonShift;ei(this._mat4Scratch,this.starsProjMatrix),this._mat4Scratch[8]=-(2*r.x)/this.width,this._mat4Scratch[9]=2*(r.y+d)/this.height,eo(this.skyboxMatrix,this._mat4Scratch,this.skyboxMatrix);let p=this.point,f=p.x,m=p.y,_=this.width%2/2,g=this.height%2/2,y=Math.cos(this.angle),x=Math.sin(this.angle),v=f-
7Math.round(f)+y*_+x*g,b=m-Math.round(m)+y*g+x*_;if(ei(this.alignedProjMatrix,c),es(this.alignedProjMatrix,this.alignedProjMatrix,[v>.5?v-1:v,b>.5?b-1:b,0]),ep(this.labelPlaneMatrix,[this.width/2,-this.height/2,1]),es(this.labelPlaneMatrix,this.labelPlaneMatrix,[1,-1,0]),ep(this.glCoordMatrix,[1,-1,1]),es(this.glCoordMatrix,this.glCoordMatrix,[-1,-1,0]),el(this.glCoordMatrix,this.glCoordMatrix,[2/this.width,2/this.height,1]),eo(this.pixelMatrix,this.labelPlaneMatrix,u),this._calcFogMatrices(),this._distanceTileDataCache={},!en(this.pixelMatrixInverse,this.pixelMatrix))throw Error("failed to invert matrix");if("globe"===this.projection.name||this.mercatorFromTransition){this.globeMatrix=function(i){let{x:r,y:a}=i.point,{lng:n,lat:o}=i._center;return u2(r,a,i.worldSize,n,o)}(this);let i=[this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]];this.globeCenterInViewSpace=eN(i,i,l),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 i=this.cameraWorldSizeForFog,r=this.cameraPixelsPerMeter,a=this._camera.position,n=1/this.height/this._pixelsPerMercatorPixel,o=[i,i,r];eC(o,o,n),eC(a,a,-1),eI(a,a,o),ed(this.mercatorFogMatrix,a),el(this.mercatorFogMatrix,this.mercatorFogMatrix,o),this.worldToFogMatrix=this._camera.getWorldToCameraPosition(i,r,n)}_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(i){let r=this._maxCameraBoundsDistance()*Math.cos(this._pitch),a=this._camera.position[2],n=i[2],o=1;this.projection.wrap&&(this.center=this.center.wrap()),n>0&&(o=Math.min((r-a)/n,1)),this._camera.position=eP([],this._camera.position,i,o),this._updateStateFromCamera()}_updateStateFromCamera(){let i=this._camera.position,r=this._camera.forward(),{pitch:a,bearing:n}=this._camera.getPitchBearing(),o=this._centerAltitude/sC(this.center.lat)*this._pixelsPerMercatorPixel,s=this._mercatorZfromZoom(this._maxZoom)*Math.cos(this._maxPitch*tf),l=Math.max((i[2]-o)/Math.cos(a),s),h=this._zoomFromMercatorZ(l);eP(i,i,r,l),this._pitch=tv(a,this.minPitch*tf,this.maxPitch*tf),this.angle=tw(n,-Math.PI,Math.PI),this._setZoom(tv(h,this._minZoom,this._maxZoom)),this._updateSeaLevelZoom(),this._center=this.coordinateLocation(new sF(i[0],i[1],i[2])),this._unmodified=!1,this._constrain(),this._calcMatrices()}_worldSizeFromZoom(i){return Math.pow(2,i)*this.tileSize}_mercatorZfromZoom(i){return this.cameraToCenterDistance/this._worldSizeFromZoom(i)}_minimumHeightOverTerrain(){let i=Math.min(this._seaLevelZoom??this._zoom,this._maxZoom)+4;return this._mercatorZfromZoom(i)}_zoomFromMercatorZ(i){return this.scaleZoom(this.cameraToCenterDistance/(Math.max(0,i)*this.tileSize))}zoomFromMercatorZAdjusted(i){let r=0,a=6,n=0,o=1/0;for(;a-r>1e-6&&a>r;){let s=r+.5*(a-r),l=this.tileSize*Math.pow(2,s),h=this.getCameraToCenterDistance(this.projection,s,l),u=this.scaleZoom(h/(Math.max(0,i)*this.tileSize)),c=Math.abs(s-u);c<o&&(o=c,n=s),s<u?r=s:a=s}return n}_terrainEnabled(){return!(!this._elevation||!this.projection.supportsTerrain&&(tF("Terrain is not yet supported with alternate projections. Use mercator or globe to enable terrain."),1))}anyCornerOffEdge(i,r){let a=Math.min(i.x,r.x),n=Math.max(i.x,r.x),o=Math.min(i.y,r.y),s=Math.max(i.y,r.y);if(o<this.horizonLineFromTop(!1))return!0;if("mercator"!==this.projection.name)return!1;let l=[new tr(a,o),new tr(n,s),new tr(a,s),new tr(n,o)],h=this.renderWorldCopies?-3:0,u=this.renderWorldCopies?4:1;for(let i of l){let r=this.pointRayIntersection(i);if(r.t<0)return!0;let a=this.rayIntersectionCoordinate(r);if(a.x<h||a.y<0||a.x>u||a.y>1)return!0}return!1}
7isHorizonVisible(){return this.pitch+this.fovAboveCenter*tm>88||this.anyCornerOffEdge(new tr(0,0),new tr(this.width,this.height))}zoomDeltaToMovement(i,r){let a=eb(eE([],this._camera.position,i)),n=this._zoomFromMercatorZ(a)+r;return a-this._mercatorZfromZoom(n)}getCameraPoint(){if("globe"===this.projection.name){let i=function([i,r,a],n){let o=[i,r,a,1];eW(o,o,n);let s=o[3]=Math.max(o[3],1e-6);return o[0]/=s,o[1]/=s,o[2]/=s,o}([this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]],this.pixelMatrix);return new tr(i[0],i[1])}{let i=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new tr(0,i))}}getCameraToCenterDistance(i,r=this.zoom,a=this.worldSize){let n=p8(i,r,this.width,this.height,1024),o=i.pixelSpaceConversion(this.center.lat,a,n),s=.5/Math.tan(.5*this._fov)*this.height*o;return this.isOrthographic&&(s=i9(1,s,tX(this.pitch>=15?1:this.pitch/15))),s}getWorldToCameraMatrix(){let i=this._camera.getWorldToCamera(this.worldSize,"meters"===this.projection.zAxisUnit?this.pixelsPerMeter:1);return"globe"===this.projection.name&&eo(i,i,this.globeMatrix),i}getFrustum(i){return uO.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,i,"meters"===this.projection.zAxisUnit)}}let _B=(i,r)=>{if(r<=0||i.terrain)return{shouldRenderCutoff:!1,uniformValues:{u_cutoff_params:[0,0,0,1]}};let a=i.transform,n=a.pitch,o=a.isLODDisabled(!1)?60:30;if(n<o-15)return{shouldRenderCutoff:!1,uniformValues:{u_cutoff_params:[0,0,0,1]}};let s=a._farZ-a._nearZ,l=r*a.height*1.3,h=Math.pow(2,.85*Math.max(a._zoom-i.minCutoffZoom,0)),u=1.4*a.cameraToCenterDistance*h,c=tb(o-15,o,n),d=i9(a._farZ+l,u,c),p=Math.min(l,d-a._nearZ);return{shouldRenderCutoff:c>0,uniformValues:{u_cutoff_params:[a._nearZ,a._farZ,(d-a._nearZ)/s,(d-p-a._nearZ)/s]}}};function _k(i,r,a,n){let o=1<<i.z;r.lat=r0((n/8192+i.y)/o),r.lng=rQ((a/8192+i.x)/o)}let _N=(i,r,a=1)=>({u_matrix:i,u_color:r,u_overlay:0,u_overlay_scale:a}),_V=new Float64Array(16),_U=new Float64Array(16),_j=new Float64Array(16),_G=new Float64Array(16),_Z=new Float64Array(16),_$=new Float64Array(16),_H=new Float64Array(16),_q=[0,0,0],_W=new Float32Array(16),_X=[0,0,0],_Y=[0,0,0],_K=[];function _J(i,r,a){let n=a.cameraWorldSizeForFog/a.worldSize;return el(i,a.worldToFogMatrix,[n,n,1]),eo(i,i,r),i}function _Q(i,r,a,n){return es(i,r,a),eG(n,fs)||el(i,i,n),i}function _0(i,r,a,n,o,s=null){let l=a.material,h=n.context,{baseColorTexture:u,metallicRoughnessTexture:c}=l.pbrMetallicRoughness,{normalTexture:d,occlusionTexture:p,emissionTexture:f}=l;function m(r,a,n){if(r&&(i.push(a),h.activeTexture.set(h.gl.TEXTURE0+n),r.gfxTexture)){let{minFilter:i,magFilter:a,wrapS:n,wrapT:o}=r.sampler;r.gfxTexture.bindExtraParam(i,a,n,o)}}m(u,"HAS_TEXTURE_u_baseColorTexture",_h.BaseColor),m(c,"HAS_TEXTURE_u_metallicRoughnessTexture",_h.MetallicRoughness),m(d,"HAS_TEXTURE_u_normalTexture",_h.Normal),m(p,"HAS_TEXTURE_u_occlusionTexture",_h.Occlusion),m(f,"HAS_TEXTURE_u_emissionTexture",_h.Emission),o&&(o.texture||(o.texture=new dt(n.context,o.image,[o.image.height,o.image.height,o.image.height],h.gl.RGBA8)),h.activeTexture.set(h.gl.TEXTURE0+_h.LUT),o.texture&&o.texture.bind(h.gl.LINEAR,h.gl.CLAMP_TO_EDGE),i.push("APPLY_LUT_ON_GPU")),a.texcoordBuffer&&(i.push("HAS_ATTRIBUTE_a_uv_2f"),r.push(a.texcoordBuffer)),a.colorBuffer&&(i.push(12===a.colorBuffer.itemSize?"HAS_ATTRIBUTE_a_color_3f":"HAS_ATTRIBUTE_a_color_4f"),r.push(a.colorBuffer)),a.normalBuffer&&(i.push("HAS_ATTRIBUTE_a_normal_4n"),r.push(a.normalBuffer)),s&&(i.push("HAS_ATTRIBUTE_a_feature"),r.push(a.featureBuffer)),"OPAQUE"!==l.alphaMode&&"MASK"!==l.alphaMode||i.push("UNPREMULT_TEXTURE_IN_SHADER"),l.defined||i.push("DIFFUSE_SHADED");let _=n.shadowRenderer;_&&(i.push("RENDER_SHADOWS"),_.useNormalOffset&&i.push("NORMAL_OFFSET"))}function _1(i,r,a,n,o,s){let l=i.modelOpacity,h=r.context,u=new __(r.context.gl.LEQUAL,i.isLightMesh?__.ReadOnly:__.ReadWrite,r.depthRangeFor3D),c=r.transform,d=i.mesh,p=d.material,f=p.pbrMetallicRoughness,m=r.style.fog;"pixels"===r.transform.projection.zAxisUnit?_V.set(i.nodeModelMatrix):eo(_V,n.zScaleMatrix,i.nodeModelMatrix),eo(_V,n.negCameraPosMatrix,_V),en(_U,_V),ea(_U,_U);
7let _="none"===a.paint.get("model-color-use-theme").constantOr("default"),g=a.paint.get("model-emissive-strength").constantOr(0),y={defines:[]},x=[],v=r.shadowRenderer;v&&(v.useNormalOffset=!1),_0(y.defines,x,d,r,_?null:a.lut);let b=null;if(m&&(b=_J(_j,i.nodeModelMatrix,r.transform),"globe"!==c.projection.name)){let i=d.aabb.min,r=d.aabb.max,[a,n]=m.getOpacityForBounds(b,i[0],i[1],r[0],r[1]);y.overrideFog=a>=.05||n>=.05}let w=_B(r,a.paint.get("model-cutoff-fade-range"));w.shouldRenderCutoff&&y.defines.push("RENDER_CUTOFF");let T=r.getOrCreateProgram("model",y),S=_d(i.worldViewProjection,_V,_U,null,r,l,f.baseColorFactor,p.emissiveFactor,f.metallicFactor,f.roughnessFactor,p,g,a,void 0,void 0,i.materialOverride,i.modelColor,1,T.fixedDefines.includes("LIGHTING_3D_MODE"));r.uploadCommonUniforms(h,T,null,b,w,i.lightOverrides),"shadow"!==r.renderPass&&v&&v.setupShadowsFromMatrix(i.nodeModelMatrix,T),T.draw(r,h.gl.TRIANGLES,u,o,s,d.material.doubleSided?_g.disabled:_g.backCCW,S,a.id,d.vertexBuffer,d.indexBuffer,d.segments,a.paint,r.transform.zoom,void 0,x)}function _2(i,r){return i.style._importedAsBasemap?"basemap":r.scope}function _3(i,r,a,n,o,s,l,h,u,c,d){let p=i.transform,f=!!r.isGeometryBloom&&r.isGeometryBloom;if(void 0!==r.minZoom&&i.transform.zoom<r.minZoom||void 0!==r.maxZoom&&i.transform.zoom>r.maxZoom||f&&"shadow"===i.renderPass)return;let m="globe"===p.projection.name?fa(a,p):[...a];eo(m,m,r.globalMatrix);let _=eo([],n,m);if(r.meshes)for(let i of r.meshes){let n=h.get(i.material.name);if(n&&n.opacity<=0)continue;if("BLEND"!==i.material.alphaMode){l.push({mesh:i,depth:0,modelIndex:o,worldViewProjection:_,nodeModelMatrix:m,isLightMesh:f,materialOverride:n,modelOpacity:u,modelColor:c,lightOverrides:d,node:r,modelMatrix:a});continue}let g=eN([],i.centroid,_);!p.isOrthographic&&g[2]<=0||s.push({mesh:i,depth:g[2],modelIndex:o,worldViewProjection:_,nodeModelMatrix:m,isLightMesh:f,materialOverride:n,modelOpacity:u,modelColor:c,lightOverrides:d,node:r,modelMatrix:a})}if(r.children)for(let p of r.children)_3(i,p,a,n,o,s,l,h,u,c,d)}function _5(i,r,a,n,o){let s=a.shadowRenderer;if(!s)return;let l=s.getShadowPassDepthMode(),h=_p(o||s.calculateShadowPassMatrixFromMatrix(r));a.getOrCreateProgram("modelDepth").draw(a,a.context.gl.TRIANGLES,l,_f.disabled,_m.disabled,_g.disabled,h,n.id,i.vertexBuffer,i.indexBuffer,i.segments,n.paint,a.transform.zoom,void 0,void 0)}function _4(i,r,a,n){let o=function(i,r){let a;if(r.footprintDebugMesh)return r.footprintDebugMesh;if(!r.footprint)return null;let n=i.context,o=r.footprint.vertices,s=r.footprint.indices,l=new sH;for(let i of(l.reserve(o.length),o))l.emplaceBack(i.x,i.y);let h=new la;h.reserve(s.length);for(let i=0;i<s.length;i+=3)h.emplaceBack(s[i],s[i+1],s[i+2]);let u=n.createVertexBuffer(l,uA.members),c=n.createIndexBuffer(h),d=lO.simpleSegment(0,0,o.length,s.length),p=r.id||r.name||"footprint",f=parseInt(p,10),m=tY(a=isNaN(f)?function(i){let r=0;for(let a=0;a<i.length;a++)r=(r<<5)-r+i.charCodeAt(a)|0;return r}(p):f);return r.footprintDebugMesh={vertexBuffer:u,indexBuffer:c,segments:d,color:new re(m,tY(a+1),tY(a+2),.5)},r.footprintDebugMesh}(i,a);if(!o)return;let s=i.context,l=s.gl,h=i.getOrCreateProgram("debug"),u=o.color,c=__.disabled;s.activeTexture.set(l.TEXTURE0),i.emptyTexture.bind(l.LINEAR,l.CLAMP_TO_EDGE),h.draw(i,l.TRIANGLES,c,_f.disabled,_m.alphaBlended,_g.disabled,_N(n,u.toPremultipliedRenderColor(null)),"$debug",o.vertexBuffer,o.indexBuffer,o.segments)}function _6(i,r,a,n,o){let s=!1;for(let a of n)1!==a.modelOpacity&&(_1(a,i,r,o[a.modelIndex],_f.disabled,_m.disabled),s=!0);for(let a of n)_1(a,i,r,o[a.modelIndex],1!==a.modelOpacity?i.stencilModeFor3D():_f.disabled,i.colorModeForRenderPass());s&&i.resetStencilClippingMasks();let l=_m.additive;for(let n of a)_1(n,i,r,o[n.modelIndex],_f.disabled,n.isLightMesh?l:i.colorModeForRenderPass())}let _8={shadowUniformsInitialized:!1,useSingleShadowCascade:!1,tileMatrix:new Float64Array(16),shadowTileMatrix:new Float32Array(16),aabb:new uB([0,0,0],[8192,8192,0])};var _9="\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",_7="\n#define FLIP_VIEWPORT_UV_Y(uv)\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;}const 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
7/17.0, 8.0/17.0,14.0/17.0, 6.0/17.0\n);int viewport_dither_index(vec2 fragCoordXY) {return (int(fragCoordXY.x) % 4)*4+(int(fragCoordXY.y) % 4);}\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);}void storeEmissiveColor(vec4 color,float emissiveStrength) {\n#ifdef DUAL_SOURCE_BLENDING\nglFragColorSrc1=vec4(vec3(0.0),emissiveStrength);\n#else\n#ifdef USE_MRT1 \n#ifdef USE_MRT1_RGBA\nout_Target1=vec4(color.rgb*emissiveStrength,color.a);\n#else\nout_Target1=vec4(emissiveStrength*color.a,0.0,0.0,glFragColor.a);\n#endif\n#endif\n#endif\n}",ge="\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;float 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#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",gt="in highp vec3 a_pos_3f;uniform lowp mat4 u_matrix;out highp vec3 v_uv;
7void 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;}",gi="\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;\n#endif\nvec3 elevationVector(vec2 pos) {\n#ifdef PROJECTION_GLOBE_VIEW\nvec2 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\nreturn vec3(0,0,1);\n#endif\n}\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);}float 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}vec4 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#endif\nfloat elevation(vec2 apos) {\n#ifdef TERRAIN\n#ifdef TERRAIN_VERTEX_MORPHING\nfloat nextElevation=currentElevation(apos);float prevElevation=prevElevation(apos);return mix(prevElevation,nextElevation,u_dem_lerp);\n#else\nreturn currentElevation(apos);\n#endif\n#else\nreturn 0.0;\n#endif\n}\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 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_
7size_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;int 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;highp 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",gr="#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",ga="#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;FLIP_VIEWPORT_UV_Y(uv);highp 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;}
7vec3 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",gn="\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",go="#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);}
7vec2 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",gs="#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",gl="#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;highp vec2 shadow_map_ndc_to_uv(highp vec2 ndc_xy) {return ndc_xy*0.5+0.5;}highp vec3 shadow_map_ndc_to_sample_space(highp vec3 ndc) {return vec3(shadow_map_ndc_to_uv(ndc.xy),ndc.z*0.5+0.5);}float shadow_sample(sampler2DShadow shadowmap,highp vec3 pos,highp float bias) {highp vec3 coord=vec3(shadow_map_ndc_to_uv(pos.xy),pos.z*0.5+0.5-bias);return 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=shadow_map_ndc_to_sample_space(light_view_pos0.xyz/light_view_pos0.w);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";let gh=/^#include\s+"([^"]+)"\s*\r?\n/gm,gu=/#pragma mapbox: ([\
7w\-]+) ([\w]+) ([\w]+) ([\w]+)/g,gc=/\b[A-Za-z_][A-Za-z0-9_]*\b/g,gd=new Set(["ifdef","ifndef","elif","if","defined"]),gp=new Set;gT(_9,gp),gT(ge,gp),gT(_7,gp);let gf={"_prelude_fog.vertex.glsl":gr,"_prelude_terrain.vertex.glsl":gi,"_prelude_shadow.vertex.glsl":gs,"_prelude_material_table.vertex.glsl":"","_prelude_fog.fragment.glsl":ga,"_prelude_shadow.fragment.glsl":gl,"_prelude_lighting.glsl":gn,"_prelude_raster_array.glsl":go,"_prelude_indicator_cutout.fragment.glsl":"\nvec4 applyCutout(vec4 color,float height) {return color;}","_prelude_feature_cutout.fragment.glsl":"// feature cutout (gl-native only)\n","_prelude_feature_cutout.vertex.glsl":"// feature cutout (gl-native only)\n"},gm={},g_="precision highp float;",gg="precision mediump float;",gy="\n#if defined(GL_EXT_blend_func_extended) && defined(DUAL_SOURCE_BLENDING)\n#extension GL_EXT_blend_func_extended : require\n#endif",gx={preludeTerrain:gE("",gi),preludeFog:gE(ga,gr),preludeShadow:gE(gl,gs),preludeRasterArray:gE(go,""),preludeLighting:gE(gn,gn),preludePrecisionQualifiers:gE(gg,g_),prelude:gE(_7,ge),preludeExtensions:gE(gy,"")},gv=[gy,gg,_9,gx.prelude.fragmentSource].join("\n"),gb=[g_,_9,gx.prelude.vertexSource].join("\n");var gw={background:gE('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_feature_cutout.fragment.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;\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\nglFragColor=out_color*u_opacity;storeEmissiveColor(glFragColor,u_emissive_strength);\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#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}'),backgroundPattern:gE('#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;storeEmissiveColor(glFragColor,u_emissive_strength);\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:gE
vendor: 7,338 bytes, line 7
7('#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*view_scale;}float cantilevered_elevation(vec2 pos,float radius,float stroke_width,float view_scale) {vec2 c1=pos+calc_offset(vec2(-1.0,-1.0),radius,stroke_width,view_scale);vec2 c2=pos+calc_offset(vec2(1.0,-1.0),radius,stroke_width,view_scale);vec2 c3=pos+calc_offset(vec2(1.0,1.0),radius,stroke_width,view_scale);vec2 c4=pos+calc_offset(vec2(-1.0,1.0),radius,stroke_width,view_scale);float h1=elevation(c1)+ELEVATION_BIAS;float h2=elevation(c2)+ELEVATION_BIAS;float h3=elevation(c3)+ELEVATION_BIAS;float h4=elevation(c4)+ELEVATION_BIAS;return max(h4,max(h3,max(h1,h2)));}float circle_elevation(vec2 pos) {\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:
7gE("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:gE('#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);\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_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:gE("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:gE("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:gE("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:gE("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;
7\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}'),fill:gE('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_indicator_cutout.fragment.glsl"\n#include "_prelude_feature_cutout.fragment.glsl"\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nuniform float u_emissive_strength;uniform lowp float u_opacity_multiplier;\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\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\nvec2 cutout_factors=vec2(0.0);vec4 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*u_opacity_multiplier);glFragColor=out_color;storeEmissiveColor(glFragColor,u_emissive_strength);\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;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\nuniform mat4 u_matrix;uniform lowp float u_opacity_multiplier;\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}'),fillOutline:gE('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_feature_cutout.fragment.glsl"\nin highp vec2 v_pos;uniform float u_emissive_strength;uniform lowp float u_opacity_multiplier;\n#ifdef ELEVATED_ROADS\nin highp float v_road_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 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 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\nglFragColor=out_color*(alpha*opacity*u_opacity_multiplier);storeEmissiveColor(glFragColor,u_emissive_strength);\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);
7\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\nuniform mat4 u_matrix;uniform vec2 u_world;uniform lowp float u_opacity_multiplier;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;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);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\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:gE('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_feature_cutout.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;uniform lowp float u_opacity_multiplier;\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\n#ifdef ELEVATED_ROADS\nin highp float v_road_z_offset;\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=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 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\nglFragColor=out_color*(alpha*opacity*u_opacity_multiplier);storeEmissiveColor(glFragColor,u_emissive_strength);\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\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 lowp float u_opacity_multiplier;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in ivec2 a_pos;\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;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;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);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);v_pos_world=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;\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:gE('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_feature_cutout.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;uniform lowp float u_opacity_multiplier;\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 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 FOG\nout_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));\n#endif\nglFragColor=out_color*(opacity*u_opacity_multiplier);storeEmissiveColor(glFragColor,u_emissive_strength);\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);
7\n#endif\nHANDLE_WIREFRAME_DEBUG;}','#include "_prelude_fog.vertex.glsl"\n#include "_prelude_shadow.vertex.glsl"\nuniform mat4 u_matrix;uniform lowp float u_opacity_multiplier;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in ivec2 a_pos;\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:gE("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:gE("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:gE
vendor: 13,578 bytes, line 7
7('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_indicator_cutout.fragment.glsl"\n#include "_prelude_feature_cutout.fragment.glsl"\nin vec4 v_color;in vec4 v_flat;\n#if defined(RENDER_FRONT_CUTOFF) || defined(ROUTE_CORRIDOR)\nin float v_dither_opacity;\n#endif\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 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_radius;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#if defined(RENDER_FRONT_CUTOFF) || defined(ROUTE_CORRIDOR)\nif (v_dither_opacity < 1.0) {int index=viewport_dither_index(gl_FragCoord.xy);if (v_dither_opacity < DITHER_THRESHOLDS[index]) {discard;}}\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"\n#include "_prelude_feature_cutout.vertex.glsl"\nuniform mat4 u_matrix;\n#ifndef LIGHTING_3D_MODE\nuniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;\n#endif\nuniform 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#if defined(RENDER_FRONT_CUTOFF) || defined(ROUTE_CORRIDOR)\n#ifdef RENDER_FRONT_CUTOFF\nuniform vec3 u_front_cutoff_params;\n#endif\nout float v_dither_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;vec3 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) || defined(ROUTE_CORRIDOR)\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_FRONT_CUTOFF) || defined(ROUTE_CORRIDOR)\nfloat frontCutoffOpacity=1.0;float routeFade=0.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\ncutoff=cutoff_opacity(u_cutoff_params,ground.z);if (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\nif (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);frontCutoffOpacity=mix(u_front_cutoff_params.z,1.0,t);}\n#endif\n#if defined(RENDER_FRONT_CUTOFF) || defined(ROUTE_CORRIDOR)\nv_dither_opacity=1.0;\n#ifdef RENDER_FRONT_CUTOFF\nv_dither_opacity=min(v_dither_opacity,frontCutoffOpacity);\n#endif\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}'),fillExtrusionPattern:
7gE
vendor: 8,299 bytes, line 7
7('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_indicator_cutout.fragment.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),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\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;\n#ifndef LIGHTING_3D_MODE\nuniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;\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#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);\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}'),hillshadePrepare:
7gE("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:gE('#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\nstoreEmissiveColor(glFragColor,u_emissive_strength);\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\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:gE
vendor: 19,061 bytes, line 7
7('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_indicator_cutout.fragment.glsl"\n#include "_prelude_feature_cutout.fragment.glsl"\nuniform lowp float u_device_pixel_ratio;uniform highp float u_width_scale;uniform float u_alpha_discard_threshold;uniform lowp float u_opacity_multiplier;uniform bool u_clip_to_tile_borders;in vec4 v_width2_dilute;in vec2 v_normal;in float v_gamma_scale;in vec2 v_tile_pos;\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;uniform highp float u_floor_width_scale;in highp vec2 v_tex;\n#endif\n#ifdef DEBUG_ELEVATION_ID\nin vec3 v_elevation_id_col;\n#endif\n#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_BORDER_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)\nin highp vec3 v_uv;\n#endif\n#ifdef RENDER_LINE_GRADIENT\nuniform sampler2D u_gradient_image;\n#endif\n#ifdef RENDER_LINE_BORDER_GRADIENT\nuniform sampler2D u_border_gradient_image;\n#endif\n#ifdef RENDER_LINE_TRIM_OFFSET\nuniform 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;\n#endif\n#ifdef RENDER_SHADOWS\nuniform bool u_emissive_in_shadows;uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;\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;float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;\n#ifdef RENDER_LINE_BORDER\n#ifndef VARIABLE_LINE_WIDTH\nANTIALIASING*=8.0;\n#endif\n#endif\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);float pxStep;float delta;\n#ifdef RENDER_LINE_BORDER\n#ifndef VARIABLE_LINE_WIDTH\npxStep=fwidth(dist);float out_edge=v_width2_dilute.x-dist;float in_edge=dist-(v_width2_dilute.y-2.0*ANTIALIASING);delta=v_width2_dilute.y > 0.0 ? min(in_edge,out_edge) : out_edge;float edge=ANTIALIASING;alpha=delta > 0.0 ? smoothstep(edge-pxStep,u_width_scale*blur+edge+pxStep,delta) : 0.0;\n#endif\n#endif\n#ifdef RENDER_LINE_DASH\nhighp float dash_w=float(dash.w);highp float dash_len=float(dash.z)+dash_w/65535.0;float sdfgamma=ANTIALIASING/float(dash_len);float scaled_floorwidth=(floorwidth*u_floor_width_scale);float periods_per_pixel=fwidth(v_tex.x);float dash_coverage=float(dash.y >> 4u)/4095.0;float fade=linearstep(0.25,0.5,periods_per_pixel);float gamma=max(sdfgamma/scaled_floorwidth,0.5*periods_per_pixel);if (fade >=1.0) {alpha*=dash_coverage;} else if (periods_per_pixel < 0.1) {float sdfdist=texture(u_dash_image,v_tex).r;alpha*=linearstep(0.5-gamma,0.5+gamma,sdfdist);} else {float span=min(periods_per_pixel,1.0);float tap_offset=span*0.25;float sdf0=texture(u_dash_image,vec2(v_tex.x-tap_offset,v_tex.y)).r;float sdf1=texture(u_dash_image,vec2(v_tex.x+tap_offset,v_tex.y)).r;alpha*=mix(0.5*(\nlinearstep(0.5-gamma,0.5+gamma,sdf0)+linearstep(0.5-gamma,0.5+gamma,sdf1)\n),dash_coverage,fade);}\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 edge2=border_width*u_width_scale+ANTIALIASING;float alpha2=smoothstep(edge2-pxStep,edge2+pxStep,delta);if (alpha2 < 1.) {\n#ifdef RENDER_LINE_BORDER_GRADIENT\nvec4 border_gradient_color=texture(u_border_gradient_image,v_uv.xy);out_color=mix(border_gradient_color*trim_alpha,out_color,alpha2);\n#else\nif (border_color.a==0.0) {\n#ifndef RENDER_LINE_GRADIENT\nfloat Y=(out_color.a > 0.01) ? luminance(out_color.rgb/out_color.a) : 1.;float adjustment=(Y > 0.) ? 0.5/Y : 0.45;if (out_color.a > 0.25 && Y < 0.25) {vec3 borderColor=(Y > 0.) ? out_color.rgb : vec3(1,1,1)*out_color.a;out_color.rgb=out_color.rgb+borderColor*(adjustment*(1.0-alpha2));} else {out_color.rgb*=(0.6+0.4*alpha2);}\n#else\nout_color.rgb*=(0.6+0.4*alpha2);\n#endif\n} else {out_color=mix(border_color*trim_alpha,out_color,alpha2);}\n#endif\nout_color*=v_width2_dilute.w;}\n#endif\n#endif\nvec2 cutout_factors=vec2(0.0);\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*u_opacity_multiplier);\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\nstoreEmissiveColor(glFragColor,emissive_strength);\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) || defined(VARIABLE_LINE_EMISSIVE_STRENGTH)\nin vec4 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_BORDER_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_road_view_depth_bias;uniform highp vec4 u_road_clip_to_view;\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 vec4 v_width2_dilute;out float v_gamma_scale;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;uniform float u_width_addition;\n#endif\n#ifdef RENDER_LINE_DASH\nuniform highp float u_floor_width_scale;uniform vec2 u_texsize;uniform float u_tile_units_to_pixels;out highp vec2 v_tex;\n#endif\n#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_BORDER_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)\nout highp vec3 v_uv;\n#endif\n#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_BORDER_GRADIENT)\nuniform float u_image_height;\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\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\n#ifdef VARIABLE_LINE_EMISSIVE_STRENGTH\nemissive_strength=a_z_offset_width.w;\n#endif\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_BORDER_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;\n#ifdef RENDER_LINE_BORDER\n#ifndef VARIABLE_LINE_WIDTH\nANTIALIASING*=8.0;\n#endif\n#endif\nvec2 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;gapwidth=gapwidth/2.0;float halfwidth;float dilute_scale=1.0;float dilute_border_scale=1.0;float symmetric_outset=0.0;\n#ifdef VARIABLE_LINE_WIDTH\nfloat left_width=a_z_offset_width.y;float right_width=a_z_offset_width.z;bool zero_right_width=border_width==0.0 && right_width==0.0;halfwidth=left ? left_width : right_width;halfwidth+=u_width_addition*(zero_right_width ? (left ? 1.0 : 0.0) : 0.5); \nhalfwidth*=u_width_scale;if (side_z_offset !=0.0) {float left_f=step(1.0,normal.y);float is_negative=step(side_z_offset,0.0);float apply=mix(1.0-left_f,left_f,is_negative);a_extrude*=apply;a_z_offset+=abs(side_z_offset)*apply;v_normal*=apply;}offset=border_width > 0.0 ? (left_width+right_width+u_width_addition)*u_width_scale : offset;halfwidth=border_width > 0.0 ? border_width*u_width_scale*0.5 : halfwidth;symmetric_outset=zero_right_width ? u_width_scale*(left_width+u_width_addition) : halfwidth;stub_side=zero_right_width ?-normal.y : 0.0;v_normal=!left && zero_right_width ? vec2(0.0) : v_normal;ANTIALIASING=!left && zero_right_width ? 0.0 : ANTIALIASING;\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 ? ANTIALIASING : 0.0);mediump vec2 dist=outset*a_extrude*EXTRUDE_SCALE;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*EXTRUDE_SCALE*normal.y*mat2(t,-u,u,t);float hidden=float(opacity==0.0);vec2 extrude=dist*u_pixels_to_tile_units;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#ifdef VARIABLE_LINE_WIDTH\n#ifndef ELEVATED\nhighp float road_view_depth_bias=u_road_view_depth_bias*smoothstep(-0.5,0.0,a_z_offset);if (road_view_depth_bias > 0.0) {highp float z_in=gl_Position.z/gl_Position.w*0.5+0.5;highp float a=u_road_clip_to_view.x;highp float b=u_road_clip_to_view.y;highp float c=u_road_clip_to_view.z;highp float d=u_road_clip_to_view.w;highp float view=(a*z_in+b)/(c*z_in+d);highp float view_new=view+road_view_depth_bias;highp float z_new=(view_new*d-b)/(a-view_new*c);z_new=clamp(z_new,0.0,1.0);gl_Position.z=(z_new*2.0-1.0)*gl_Position.w;}\n#endif\n#endif\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_BORDER_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)\nhighp float a_uv_x=a_packed[0];float a_split_index=a_packed[1];\n#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_BORDER_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);highp float dash_w=float(dash.w);highp float totalLength=float(dash.z)+dash_w/65535.0;float scale=totalLength==0.0 ? 0.0 : u_tile_units_to_pixels/totalLength;float dash_half_height=float(dash.y & 15u);v_tex=vec2(a_linesofar*scale/(floorwidth*u_floor_width_scale),(-normal.y*dash_half_height+dashf.x+0.5)/u_texsize.y);\n#endif\nv_width2_dilute=vec4(outset,inset,dilute_scale,dilute_border_scale);\n#ifdef VARIABLE_LINE_WIDTH\nv_width2_dilute.x=symmetric_outset;\n#endif\n#ifdef FOG\nv_fog_pos=fog_position(pos);\n#endif\n}'),linePattern:
7gE
vendor: 11,858 bytes, line 7
7('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_indicator_cutout.fragment.glsl"\nuniform highp float u_device_pixel_ratio;uniform highp float u_width_scale;uniform highp float u_alpha_discard_threshold;uniform lowp float u_opacity_multiplier;uniform highp vec2 u_texsize;uniform highp float u_tile_units_to_pixels;uniform highp vec2 u_trim_offset;uniform highp vec2 u_trim_fade_range;uniform lowp vec4 u_trim_color;uniform sampler2D u_image;\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 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*u_opacity_multiplier);if (u_alpha_discard_threshold !=0.0) {if (color.a < u_alpha_discard_threshold) {discard;}}glFragColor=color;storeEmissiveColor(glFragColor,emissive_strength);\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\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 vec4 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\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}'),raster:
7gE('#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;uniform highp float u_color_ramp_size;\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;\n#ifdef RASTER_COLOR_SCALE_LOG\nfloat N=u_color_ramp_size;float vNorm=max((value.x-0.5/N)*N/(N-1.0),0.0);vNorm=log(vNorm*(10.0-1.0)+1.0)/log(10.0);value.x=0.5/N+vNorm*(N-1.0)/N;\n#endif\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\nstoreEmissiveColor(glFragColor,u_emissive_strength);HANDLE_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];
7if (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:gE
vendor: 16,393 bytes, line 7
7('#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_indicator_cutout.fragment.glsl"\n#include "_prelude_feature_cutout.fragment.glsl"\n#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform sampler2D u_texture;\n#ifdef RENDER_TEXT_AND_SYMBOL\nuniform sampler2D u_texture_icon;\n#endif\nuniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;uniform bool u_is_sdf;uniform lowp float u_scale_factor;uniform lowp float u_opacity_multiplier;\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 RENDER_SHADOWS\nin highp float v_z_offset;\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\nin lowp float v_opacity;in lowp vec4 v_fill_np_color;in lowp vec4 v_halo_np_color;in lowp float v_halo_width;in lowp float v_halo_blur;\n#ifdef LIGHTING_3D_MODE\nin lowp float v_emissive_strength;\n#endif\nvoid main() {lowp float opacity=v_opacity;lowp vec4 fill_color=vec4(0.0);lowp vec4 halo_color=vec4(0.0);lowp float halo_width=0.0;lowp float halo_blur=0.0;if (u_is_sdf) {fill_color=vec4(v_fill_np_color.rgb*v_fill_np_color.a,v_fill_np_color.a);halo_color=vec4(v_halo_np_color.rgb*v_halo_np_color.a,v_halo_np_color.a);halo_width=v_halo_width;halo_blur=v_halo_blur;}lowp float emissive_strength=0.0;\n#ifdef LIGHTING_3D_MODE\nemissive_strength=v_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*u_opacity_multiplier;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);if (u_is_sdf) {float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_gamma_scale_size_fade_opacity.x;float size=v_gamma_scale_size_fade_opacity.y;float fontScale=u_is_text ? size/24.0 : size;out_color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;bool draw_halo=v_draw_halo > 0.0;if (draw_halo) {out_color=halo_color;gamma=(halo_blur*u_scale_factor*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width*u_scale_factor/fontScale)/SDF_PX;}lowp float dist=texture(u_texture,v_tex_a).r;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);out_color*=alpha;} else {\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}out_color*=opacity*fade_opacity*u_opacity_multiplier;\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\nglFragColor=out_color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);\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 ELEVATED_ROADS\nin vec3 a_x_axis;in vec3 a_y_axis;uniform float u_normal_scale;\n#endif\n#ifdef RENDER_SHADOWS\nout highp float v_z_offset;\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;\n#ifdef RENDER_SHADOWS\nuniform mat4 u_inv_matrix;\n#endif\nuniform 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;\n#ifdef PROJECTION_GLOBE_VIEW\nuniform vec3 u_up_vector;\n#endif\n#ifdef RENDER_TEXT_AND_SYMBOL\nuniform vec2 u_texsize_icon;\n#endif\nuniform 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#ifndef MAX_UBO_SIZE_VEC4\n#define MAX_UBO_SIZE_VEC4 1024u\n#endif\n#define SPP_HEADER_SIZE_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;};uniform lowp vec4 u_spp_fill_np_color;uniform lowp vec4 u_spp_halo_np_color;uniform lowp float u_spp_opacity;uniform lowp float u_spp_halo_width;uniform lowp float u_spp_halo_blur;uniform lowp float u_spp_emissive_strength;uniform lowp float u_spp_occlusion_opacity;uniform highp float u_spp_z_offset;uniform lowp vec2 u_spp_translate_rotation;uniform highp float u_spp_zoom_fraction;in float a_feature_index;layout(std140) uniform SymbolPaintPropertiesHeaderUniform {uvec4 header[SPP_HEADER_SIZE_VEC4];} u_spp_header;layout(std140) uniform SymbolPaintPropertiesUniform {vec4 properties[MAX_UBO_SIZE_VEC4];} u_spp_properties;layout(std140) uniform SymbolPaintPropertiesIndexUniform {uvec4 block_indices[MAX_UBO_SIZE_VEC4];} u_spp_index;out lowp float v_opacity;out lowp vec4 v_fill_np_color;out lowp vec4 v_halo_np_color;out lowp float v_halo_width;out lowp float v_halo_blur;\n#ifdef LIGHTING_3D_MODE\nout lowp float v_emissive_strength;\n#endif\nfloat zoomFactor(float zm,float zM) {if (zm==zM) return u_spp_zoom_fraction-zm >=0.0 ? 1.0 : 0.0;return clamp((u_spp_zoom_fraction-zm)/(zM-zm),0.0,1.0);}vec4 readColor(uint base,bool isDataDriven,uint offsetVec4,uint dzr,vec2 headerZoom,vec4 fallbackValue) {if (!isDataDriven) return fallbackValue;vec4 value=u_spp_properties.properties[base+offsetVec4];vec2 blockZoom=u_spp_properties.properties[base+offsetVec4+dzr].xy;vec2 zr=mix(headerZoom,blockZoom,float(dzr));return unpack_mix_color(value,zoomFactor(zr.x,zr.y));}uint uvec4At(uvec4 v,uint index) {return (index==0u) ? v.x :\n(index==1u) ? v.y :\n(index==2u) ? v.z : v.w;}float readScalar(uint base,bool isDataDriven,uint offsetVec4,float fallbackValue) {if (!isDataDriven) return fallbackValue;vec4 slot=u_spp_properties.properties[base+offsetVec4];return unpack_mix_vec2(slot.xy,zoomFactor(slot.z,slot.w));}vec2 readTranslate(uint base,bool isDataDriven,uint offsetVec4,uint dzr) {if (!isDataDriven) return vec2(0.0);vec4 value=u_spp_properties.properties[base+offsetVec4];vec2 blockZoom=u_spp_properties.properties[base+offsetVec4+dzr].xy;float t=zoomFactor(blockZoom.x,blockZoom.y)*float(dzr);return mix(value.xy,value.zw,t);}SymbolPaintProperties readSymbolPaintProperties() {uint dataDrivenMask=u_spp_header.header[0][0];uint dzrMask       =u_spp_header.header[0][1];uint blockSizeVec4 =u_spp_header.header[0][2];uint fillColorDzr=dzrMask & 1u;uint haloColorDzr=(dzrMask >> 1u) & 1u;vec2 fillColorHeaderZoom=uintBitsToFloat(u_spp_header.header[3].xy);vec2 haloColorHeaderZoom=uintBitsToFloat(u_spp_header.header[3].zw);uint featureIndex=uint(a_feature_index);uvec4 indexSlot=u_spp_index.block_indices[featureIndex/4u];uint base=uvec4At(indexSlot,featureIndex % 4u)*blockSizeVec4;SymbolPaintProperties props;props.fill_np_color    =readColor(base,(dataDrivenMask & (1u << 0u)) !=0u,u_spp_header.header[0][3],fillColorDzr,fillColorHeaderZoom,u_spp_fill_np_color);props.halo_np_color    =readColor(base,(dataDrivenMask & (1u << 1u)) !=0u,u_spp_header.header[1][0],haloColorDzr,haloColorHeaderZoom,u_spp_halo_np_color);props.opacity          =readScalar(base,(dataDrivenMask & (1u << 2u)) !=0u,u_spp_header.header[1][1],u_spp_opacity);props.halo_width       =readScalar(base,(dataDrivenMask & (1u << 3u)) !=0u,u_spp_header.header[1][2],u_spp_halo_width);props.halo_blur        =readScalar(base,(dataDrivenMask & (1u << 4u)) !=0u,u_spp_header.header[1][3],u_spp_halo_blur);props.emissive_strength=readScalar(base,(dataDrivenMask & (1u << 5u)) !=0u,u_spp_header.header[2][0],u_spp_emissive_strength);props.occlusion_opacity=readScalar(base,(dataDrivenMask & (1u << 6u)) !=0u,u_spp_header.header[2][1],u_spp_occlusion_opacity);props.z_offset         =readScalar(base,(dataDrivenMask & (1u << 7u)) !=0u,u_spp_header.header[2][2],u_spp_z_offset);uint translateDzr=(dzrMask >> 8u) & 1u;props.translate        =readTranslate(base,(dataDrivenMask & (1u << 8u)) !=0u,u_spp_header.header[2][3],translateDzr);return props;}vec2 unpack_opacity(uint packedOpacity) {return vec2(float(packedOpacity/2u)/127.0,float(packedOpacity & 1u));}void main() {SymbolPaintProperties paint_properties=readSymbolPaintProperties();lowp float opacity=paint_properties.opacity;v_opacity=opacity;v_fill_np_color=paint_properties.fill_np_color;v_halo_np_color=paint_properties.halo_np_color;v_halo_width=paint_properties.halo_width;v_halo_blur=paint_properties.halo_blur;\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;vec2 a_pos=vec2(a_pos_offset.xy);vec2 a_offset=vec2(a_pos_offset.zw);vec2 a_tex=vec2(a_tex_size.xy);vec2 a_size=vec2(a_tex_size.zw);float a_size_min=floor(a_size[0]*0.5);float a_size_max= floor(a_size[1]*0.5);float a_apperance=a_size[1]-2.0*a_size_max;vec2 a_pxoffset=vec2(a_pixeloffset.xy);vec2 a_min_font_scale=vec2(a_pixeloffset.zw)/256.0;highp float segment_angle=-a_projected_pos[3];float size;if (a_apperance==USING_APPEARANCE) {size=a_size_max/128.0;} else if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size_max,u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 tile_anchor=a_pos;float e=u_elevation_from_sea ? z_offset : z_offset+elevation(tile_anchor);\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\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);{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;}float gamma_scale=gl_Position.w;v_draw_halo=(u_is_halo && float(gl_InstanceID)==0.0) ? 1.0 : 0.0;v_gamma_scale_size_fade_opacity=vec3(gamma_scale,size,out_fade_opacity);v_tex_a=a_tex/u_texsize;\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 RENDER_SHADOWS\nv_z_offset=e;\n#endif\n}'),skybox:
7gE('#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))/(end-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}',gt),skyboxGradient:gE('#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}',gt),skyboxCapture:gE
vendor: 3,814 bytes, line 7
7("\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;v_position.y*=-1.0;v_position.y=map(v_position.y,-1.0,1.0,0.0,1.0);gl_Position=vec4(a_pos_3f.xy,0.0,1.0);}"),globeAtmosphere:
7gE('#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\nglFragColor=vec4(0,0,0,1);return;\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;vec3 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);}"),stars:gE("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:gE("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 gT(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(gc);if(i)for(let a of i)gd.has(a)||r.add(a)}}function gS(i){return new Set(["uint","int","uvec2","ivec2","uvec3","ivec3","uvec4","ivec4"]).has(i)}function gE(i,r){let a=new Set,n=[],o=[];i=i.replace(gh,(i,r)=>(o.push(r),"")),r=r.replace(gh,(i,r)=>(n.push(r),""));let s=new Set(gp);for(let a of(gT(i,s),gT(r,s),[...n,...o]))gm[a]||(gm[a]=new Set,gT(gf[a],gm[a])),s=new Set([...s,...gm[a]]);return{fragmentSource:i=i.replace(gu,(i,r,n,o,s)=>(a.add(s),"define"===r?`
8#ifndef HAS_UNIFORM_u_${s}
9${gS(o)?"flat ":""}in ${n} ${o} ${s};
10#else
11uniform ${n} ${o} u_${s};
12#endif
13`:"initialize"===r?`
14#ifdef HAS_UNIFORM_u_${s}
15    ${n} ${o} ${s} = u_${s};
16#endif
17`:"define-attribute"===r?`
18#ifdef HAS_ATTRIBUTE_a_${s}
19    in ${n} ${o} ${s};
20#endif
21`:"initialize-attribute"===r?"":void 0)),vertexSource:r=r.replace(gu,(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?`
22#ifdef HAS_ATTRIBUTE_a_${s}
23in ${n} ${o} a_${s};
24#endif
25`:a.has(s)?"define"===r?`
26#ifndef HAS_UNIFORM_u_${s}
27uniform lowp float u_${s}_t;
28    #if !defined(${l})
29        in ${n} ${h} a_${s};
30    #endif
31${gS(o)?"flat ":""}out ${n} ${o} ${s};
32#else
33uniform ${n} ${o} u_${s};
34#endif
35`:"initialize"===r?"vec4"===c||"uvec4"===c?`
36#ifndef HAS_UNIFORM_u_${s}
37    ${s} = a_${s};
38#else
39    ${n} ${o} ${s} = u_${s};
40#endif
41`:`
42#if !defined(HAS_UNIFORM_u_${s})
43    #ifdef ${l}
44        ${s} = unpack_mix_${c}(${u}, u_${s}_t);
45    #else
46        ${s} = unpack_mix_${c}(a_${s}, u_${s}_t);
47    #endif
48#else
49    ${n} ${o} ${s} = u_${s};
50#endif
51`:"define-attribute"===r?`
52#ifdef HAS_ATTRIBUTE_a_${s}
53    in ${n} ${o} a_${s};
54    out ${n} ${o} ${s};
55#endif
56`:"initialize-attribute"===r?`
57#ifdef HAS_ATTRIBUTE_a_${s}
58    ${s} = a_${s};
59#endif
60`:void 0:"define"===r?`
61#ifndef HAS_UNIFORM_u_${s}
62uniform lowp float u_${s}_t;
63    #if !defined(${l})
64        in ${n} ${h} a_${s};
65    #endif
66#else
67uniform ${n} ${o} u_${s};
68#endif
69`:"define-instanced"===r?"mat4"===c?`
70#ifdef INSTANCED_ARRAYS
71in vec4 a_${s}0;
72in vec4 a_${s}1;
73in vec4 a_${s}2;
74in vec4 a_${s}3;
75#else
76uniform ${n} ${o} u_${s};
77#endif
78`:`
79#ifdef INSTANCED_ARRAYS
80in ${n} ${h} a_${s};
81#else
82uniform ${n} ${o} u_${s};
83#endif
84`:"initialize-attribute-custom"===r?`
85#ifdef HAS_ATTRIBUTE_a_${s}
86    ${n} ${o} ${s} = a_${s};
87#endif
88`:"vec4"===c||"uvec4"===c?`
89#ifndef HAS_UNIFORM_u_${s}
90    #ifdef ${l}
91        ${n} ${o} ${s} = ${u};
92    #else
93        ${n} ${o} ${s} = a_${s};
94    #endif
95#else
96    ${n} ${o} ${s} = u_${s};
97#endif
98`:`
99#ifndef HAS_UNIFORM_u_${s}
100    #ifdef ${l}
101        ${n} ${o} ${s} = unpack_mix_${c}(${u}, u_${s}_t);
102    #else
103        ${n} ${o} ${s} = unpack_mix_${c}(a_${s}, u_${s}_t);
104    #endif
105#else
106    ${n} ${o} ${s} = u_${s};
107#endif
108`}),usedDefines:s,vertexIncludes:n,fragmentIncludes:o}}var gI={model:gE
vendor: 18,963 bytes, line 108
108('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_indicator_cutout.fragment.glsl"\n#include "_prelude_feature_cutout.fragment.glsl"\nuniform float u_opacity;\n#ifdef DITHERED_DISCARD\nuniform float u_dithered_discard_threshold;\n#endif\n#ifndef LIGHTING_3D_MODE\nuniform vec3 u_lightcolor;uniform vec3 u_lightpos;uniform float u_lightintensity;\n#endif\nuniform 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 vec4 normal_4n\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 vec4 normal_4n\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_feature\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#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)-lightColor),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_feature\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;highp 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_4n\nn=normalize(normal_4n.xyz);\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=normalize(cross(fdx,fdy))*-1.0;\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_feature\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*lightColor;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() {vec3 lightDir;vec3 lightColor;\n#ifdef LIGHTING_3D_MODE\nlightDir=u_lighting_directional_dir;lightDir.xy=-lightDir.xy;lightColor=u_lighting_directional_color;\n#else\nlightDir=u_lightpos;lightColor=u_lightcolor;\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_feature\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.y));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\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"\n#include "_prelude_feature_cutout.vertex.glsl"\nin vec3 a_pos_3f;\n#pragma mapbox: define-attribute highp vec4 normal_4n\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 uvec2 feature\n#define MODEL_PART_COUNT 7u\n#define MODEL_PART_STYLE_SIZE_VEC4 28u\n#ifdef HAS_ATTRIBUTE_a_feature\nstruct ModelPartStyle {vec4 color_mix;vec4 rmea;vec4 gradient;float gradient_power;};layout(std140) uniform ModelPartStyleUniform {vec4 part_style[MODEL_PART_STYLE_SIZE_VEC4];} u_model_part_style;uniform vec4 u_model_mesh_params;\n#endif\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 HAS_ATTRIBUTE_a_feature\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));}\n#ifdef HAS_ATTRIBUTE_a_feature\nuint decodeModelPartId(uvec2 feature) {uint partId=feature.y & 0xFu;return partId < MODEL_PART_COUNT ? partId : 0u;}vec4 decodeModelVertexColor(uvec2 feature) {uvec4 nibbles=uvec4(feature.x >> 12u,feature.x >> 8u,feature.x >> 4u,feature.x) & 0xFu;return vec4(nibbles*17u)/255.0;}ModelPartStyle readModelPartStyle(uint partId) {uint base=partId*4u;ModelPartStyle style;style.color_mix=u_model_part_style.part_style[base];style.rmea=u_model_part_style.part_style[base+1u];style.gradient=u_model_part_style.part_style[base+2u];style.gradient_power=u_model_part_style.part_style[base+3u].x;return style;}vec3 modelAlbedo(ModelPartStyle style,vec4 vertexColor) {float ambientOcclusion=mix(1.0,vertexColor.a,u_model_mesh_params.z);return ambientOcclusion*mix(vertexColor.rgb,style.color_mix.rgb,style.color_mix.a);}vec4 resolveModelEmissiveGradient(ModelPartStyle style,float height) {float begin=u_model_mesh_params.x+u_model_mesh_params.y*style.gradient.x;float span=u_model_mesh_params.y*(style.gradient.y-style.gradient.x);return vec4((height-begin)/span,style.gradient_power,style.gradient.z,style.gradient.w);}\n#endif\nvoid main() {\n#pragma mapbox: initialize-attribute highp vec4 normal_4n\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 uvec2 feature\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_feature\nModelPartStyle part_style=readModelPartStyle(decodeModelPartId(feature));v_color_mix=vec4(modelAlbedo(part_style,decodeModelVertexColor(feature)),1.0);v_roughness_metallic_emissive_alpha=part_style.rmea;v_height_based_emission_params=resolveModelEmissiveGradient(part_style,a_pos_3f.z);\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 HAS_ATTRIBUTE_a_normal_4n\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_4n=vec4(rs*((u_lighting_matrix*vec4(normal_4n.xyz,0.0)).xyz/squared_scale),0.0);normal_4n=normalize(normal_4n);\n#else\nnormal_4n=vec4((normal_matrix*vec4(normal_4n.xyz,0)).xyz,0.0);\n#endif\n#endif\n#ifdef HAS_ATTRIBUTE_a_feature\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_4n\n#ifdef MODEL_POSITION_ON_GPU\nvec3 offset=shadow_normal_offset(vec3(-normal_4n.xy,normal_4n.z));shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0();\n#else\nvec3 offset=shadow_normal_offset_model(normal_4n.xyz);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:
108gE("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;rs[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}"),fillExtrusionDepth:gE("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);}'),fillExtrusionGroundEffect:gE
vendor: 3,847 bytes, line 108
108("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;\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}'),groundShadow:
108gE('#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_indicator_cutout.fragment.glsl"\n#include "_prelude_feature_cutout.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\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}')};let gA=(i,r)=>({u_matrix:i,u_ground_shadow_factor:r});function gM(i,r,a=0){let n=Math.pow(2,r.tileID.overscaledZ),o=r.tileSize*Math.pow(2,i.transform.tileZoom)/n,s=o*(r.tileID.canonical.x+r.tileID.wrap*n),l=o*r.tileID.canonical.y;return{u_image:0,u_texsize:r.imageAtlasTexture?r.imageAtlasTexture.size:[0,0],u_tile_units_to_pixels:1/mU(r,1,i.transform.tileZoom),u_pixel_coord_upper:[s>>16,l>>16],u_pixel_coord_lower:[65535&s,65535&l],u_pattern_transition:a}}let gC={terrain:0,flat:1},gP=ee(),gR=[0,0,0],gD=(i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v=[0,0,1],b=!1)=>{let w=gR,T=0,S=gR;if(!b){let i=r.style.light,a=i.properties.get("position");if(w=[a.x,a.y,a.z],"viewport"===i.properties.get("anchor")){let i=K();Q(i,-r.transform.angle),eV(w,w,i)}let n=i.properties.get("color").toPremultipliedRenderColor(null);T=i.properties.get("intensity"),S=[n.r,n.g,n.b]}let E=r.transform,I={u_matrix:i,u_lightpos:w,u_lightintensity:T,u_lightcolor:S,u_vertical_gradient:+a,u_opacity:n,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:gP,u_merc_center:[0,0],u_up_dir:[0,0,0],u_height_lift:0,u_height_type:gC[c],u_base_type:gC[d],u_ao:o,u_edge_radius:s,u_width_scale:l,u_flood_light_color:_,u_vertical_scale:g,u_flood_light_intensity:y,u_ground_shadow_factor:x,u_front_cutoff_params:v};return"globe"===E.projection.name&&(I.u_tile_id=[h.canonical.x,h.canonical.y,1<<h.canonical.z],I.u_zoom_transition=p,I.u_inv_rot_matrix=m,I.u_merc_center=f,I.u_up_dir=E.projection.upVector(new ce(0,0,0),8192*f[0],8192*f[1]),I.u_height_lift=u),I},gL=new Float32Array(16);function gz(i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w){let T=r.context,S=T.gl,E=r.transform,I=r.transform.zoom,A=[],M=i.translate,C=i.translateAnchor,P=i.edgeRadius,R=_B(r,i.cutoffFadeRange);"clear"===d?(A.push("CLEAR_SUBPASS"),b&&(A.push("CLEAR_FROM_TEXTURE"),T.activeTexture.set(S.TEXTURE0),b.bind(S.LINEAR,S.CLAMP_TO_EDGE))):"sdf"===d?A.push("SDF_SUBPASS"):"emissive"===d&&(A.push("USE_MRT1"),T.activeTexture.set(S.TEXTURE0),b.bind(S.LINEAR,S.CLAMP_TO_EDGE)),x&&A.push("HAS_CENTROID"),R.shouldRenderCutoff&&A.push("RENDER_CUTOFF");let D=(i,a,o,d,v)=>{let w=A;null!=a.groundRadiusBuffer&&(w=A.concat("HAS_ATTRIBUTE_a_flood_light_ground_radiu
108s"));let S=a.programConfigurations.get(n.id),E=r.isTileAffectedByFog(i),M=r.getOrCreateProgram("fillExtrusionGroundEffect",{config:S,defines:w,overrideFog:E}),C={u_matrix:d,u_opacity:p,u_ao_pass:+!!c,u_meter_to_tile:v,u_ao:[f,m*v],u_flood_light_intensity:_,u_flood_light_color:g,u_attenuation:y,u_edge_radius:I>=17?0:P*v,u_fb:0,u_fb_size:b?b.size[0]:0,u_dynamic_offset:1},D=[];x&&D.push(a.hiddenByLandmarkVertexBuffer),null!=a.groundRadiusBuffer&&D.push(a.groundRadiusBuffer),r.uploadCommonUniforms(T,M,i.toUnwrapped(),null,R),M.draw(r,T.gl.TRIANGLES,s,l,h,u,C,n.id,a.vertexBuffer,a.indexBuffer,o,n.paint,I,S,D)};for(let i of o){let o=a.getTile(i),s=o.getBucket(n);if(!s||s.projection.name!==E.projection.name||!s.groundEffect||s.groundEffect&&!s.groundEffect.hasData())continue;let l=s.groundEffect,h=1/s.tileToMeter;{let a=r.translatePosMatrix(i.projMatrix,o,M,C),n=l.getDefaultSegment();D(i,l,n,a,h)}if(v)for(let s=0;s<4;s++){let l,u,c=ca[s](i),d=a.getTile(c);if(!d)continue;let p=d.getBucket(n);if(!p||p.projection.name!==E.projection.name||!p.groundEffect||p.groundEffect&&!p.groundEffect.hasData())continue;let f=p.groundEffect;0===s?(l=[-8192,0,0],u=1):1===s?(l=[8192,0,0],u=0):2===s?(l=[0,-8192,0],u=3):(l=[0,8192,0],u=2);let m=f.regionSegments[u];m&&(es(gL,i.projMatrix,l),D(i,f,m,r.translatePosMatrix(gL,o,M,C),h))}}}function gF(i){let r=i.properties.get("direction"),a=tk(r.x,r.y,r.z);a[2]=tv(a[2],0,75);let n=tB([a[0],a[1],a[2]]);return ew(n.x,n.y,n.z)}function gO(i,r,a){let n="none"===r.properties.get("color-use-theme"),o=r.properties.get("color"),s=r.properties.get("intensity"),l=r.properties.get("direction"),h=[l.x,l.y,l.z],u="none"===a.properties.get("color-use-theme"),c=a.properties.get("color"),d=a.properties.get("intensity"),p=Math.max(eO([0,0,1],h),0),f=[0,0,0];eC(f,c.toPremultipliedRenderColor(u?null:i.getLut(r.scope)).toArray01Linear().slice(0,3),d);let m=[0,0,0];return eC(m,o.toPremultipliedRenderColor(n?null:i.getLut(a.scope)).toArray01Linear().slice(0,3),p*s),t$([f[0]>0?f[0]/(f[0]+m[0]):0,f[1]>0?f[1]/(f[1]+m[1]):0,f[2]>0?f[2]/(f[2]+m[2]):0])}let gB=[];function gk(i){return gB[i]=gB[i]||new Float64Array(16)}let gN=[],gV=new Float32Array(16);class gU{constructor(i,r){this.aabb=i,this.lastCascade=r}}class gj{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 gU(r,null)}clear(){this.receivers={}}get(i){return this.receivers[i.key]}computeRequiredCascades(i,r,a){let n=uB.fromPoints(i.points),o=0;for(let i in this.receivers){let s=this.receivers[i];if(!s||!n.intersectsAabb(s.aabb))continue;s.aabb.min=n.closestPoint(s.aabb.min),s.aabb.max=n.closestPoint(s.aabb.max);let l=s.aabb.getCorners();for(let i=0;i<a.length;i++){let n=!0;for(let o of l){let s=[o[0]*r,o[1]*r,o[2]];if(eN(s,s,a[i].matrix),s[0]<-1||s[0]>1||s[1]<-1||s[1]>1){n=!1;break}}if(s.lastCascade=i,o=Math.max(o,i),n)break}}return o+1}}function gG(i,r,a){let n=eB([],eE([],a,r),eE([],i,r)),o=eb(n);return 0===o?[0,0,1,0]:(eC(n,n,1/o),[n[0],n[1],n[2],-eO(n,r)])}class gZ extends i3{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)}async loadGLTFFromURI(i,r){return pW((await this.map._requestManager.transformRequest(i,il.Model,r)).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=fI(n),l=o.modelSpec,h=new fh(i,l.uri,l.position,l.orientation,s);gZ.applyModelSpecification(h,l),h.computeBoundsAndApplyParent(),this.models.push(h),o.model=h}catch(n){if(a.aborted)return;this.fire(new i0(Error(`Could not load model ${i} from ${r.uri}`,{cause:n})))}}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 sA(n.position[0],n.position[1]):new sA(0,0),i.orientation=n.orientation??[0,0,0],gZ.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 iQ("data",{dataType:"source",sourceDataType:"metadata"}))):this.loaded()&&this.fire(new iQ("data",{dataType:"source",sourceDataType:"metadata"}))}static arrayFromColorSpecification(i){if(void 0===i)return;if(Array.isArray(i))return[i[0],i[1],i[2]];let r=re.parse(i);return r?[r.r,r.g,r.b]:void 0}static applyModelSpecification(i,r){if(r.nodeOverrides&&gZ.convertNodeOverrides(i,r.nodeOverrides),r.materialOverrides&&gZ.convertMaterialOverrides(i,r.materialOverrides),r.nodeOverrideNames&&(i.nodeOverrideNames=[...r.nodeOverrideNames]),r.materialOverrideNames&&(i.materialOverrideNames=[...r.materialOverrideNames]),r.featureProperties&&(i.featureProperties=r.featureProperties),r.lightOverrides){let a=r.lightOverrides,n=gZ.arrayFromColorSpecification(a["light-ambient-color"]),o=gZ.arrayFromColorSpecification(a["light-directional-color"]);i.lightOverrides={ambientIntensity:a["light-ambient-intensity"],ambientColor:n,directionalIntensity:a["light-directional-intensity"],directionalColor:o}}else i.lightOverrides=void 0}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],minZoom:void 0,maxZoom:void 0};if(Object.hasOwn(a,"orientation")){let i=a.orientation;i&&(n.orientation=i)}Object.hasOwn(a,"minzoom")&&(n.minZoom=a.minzoom),Object.hasOwn(a,"maxzoom")&&(n.maxZoom=a.maxzoom),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=gZ.arrayFromColorSpecification(a["model-color"]),o={color:void 0!==n?new re(n[0],n[1],n[2]):new re(1,1,1),colorMix:0,emissionStrength:0,opacity:1},s=a["model-color-mix-intensity"];void 0!==s&&(o.colorMix=s);let l=a["model-emissive-strength"];void 0!==l&&(o.emissionStrength=l);let h=a["model-opacity"];void 0!==h&&(o.opacity=h),i.materialOverrides.set(r,o)})}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=o0(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 g$(i,r,a){try{r=function(i){if(!i.variants)return i;
108if(!Array.isArray(i.variants))throw Error("variants must be an array");let r=null,a=null;for(let n of i.variants){if(null==n||"object"!=typeof n||n.constructor!==Object)throw Error("variant must be an object");if(!Array.isArray(n.capabilities))throw Error("capabilities must be an array");1===n.capabilities.length&&("meshopt-v2+lod"===n.capabilities[0]?a=n:"meshopt"===n.capabilities[0]&&(r=n))}let n=null!==a?a:r;return null!==n?Object.assign(i,n):i}(r)}catch(i){return Error("Failed to process TileJSON variants",{cause:i})}let n=tS({...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}function gH(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=g$(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);if(l)return tJ.frame(()=>s(null,l));if(i.url){let o=new AbortController;return(async()=>{let l=await r.transformRequest(r.normalizeSourceURL(i.url,null,a,n),il.Source,o.signal),{data:h}=await ig(l,o.signal);s(null,h)})().catch(i=>{o.signal.aborted||s(i)}),{cancel:()=>o.abort()}}return tJ.frame(()=>{let{data:r,...a}=i;s(null,a)})}function gq(i,r){let a=Math.pow(2,r.z),n=Math.floor(rK(i.getWest())*a),o=Math.floor(rJ(i.getNorth())*a),s=Math.ceil(rK(i.getEast())*a),l=Math.ceil(rJ(i.getSouth())*a);return r.x>=n&&r.x<s&&r.y>=o&&r.y<l}class gW{constructor(i,r,a){this.bounds=i?sM.convert(this.validateBounds(i)):null,this.minzoom=r||0,this.maxzoom=a||24}
108validateBounds(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(i){if(i)for(let r of(this.extraBounds||(this.extraBounds=[]),i))this.extraBounds.push(sM.convert(this.validateBounds(r)))}contains(i){if(i.z>this.maxzoom||i.z<this.minzoom||this.bounds&&!gq(this.bounds,i))return!1;if(!this.extraBounds)return!0;for(let r of this.extraBounds)if(gq(r,i))return!0;return!1}static fromTileJSON(i){if(!i.bounds&&!i.extra_bounds)return null;let r=new gW(i.bounds,i.minzoom,i.maxzoom);return r.addExtraBounds(i.extra_bounds),r}}let gX={loaded:!0,drawModels:function(i,r,a,n){if("opaque"===i.renderPass)return;let o=a.paint.get("model-opacity").constantOr(1),s=a.paint.get("model-elevation-reference"),l="ground"===s,h="ground"===s;if(0===o)return;let u=a.paint.get("model-cast-shadows");if("shadow"===i.renderPass&&(!u||i.terrain&&o<.65&&a._transitionablePaint._values["model-opacity"].value.expression instanceof nU))return;let c=i.shadowRenderer,d=a.paint.get("model-receive-shadows");c&&(c.useNormalOffset=!0,d||(c.enabled=!1));let p=()=>{c&&(c.useNormalOffset=!0,d||(c.enabled=!0))},f=r.getSource();if("light-beam"===i.renderPass&&"batched-model"!==f.type)return;if("vector"===f.type||"geojson"===f.type)return function(i,r,a,n,o){let s=i.transform,l="globe"===s.projection.name,h=s.getFreeCameraOptions().position;if(!i.modelManager)return;let u=i.modelManager;a.modelManager=u;let c=i.shadowRenderer;if(!Object.hasOwn(a._unevaluatedLayout._values,"model-id"))return;let d=a._unevaluatedLayout._values["model-id"],p={...a.layout.get("model-id").parameters},f=i.style.order.indexOf(a.fqid),m=a.paint.get("model-opacity").constantOr(1);for(let _ of n){let n=r.getTile(_).getBucket(a);if(!n||n.projection.name!==s.projection.name)continue;let g=n.getModelUris();(g&&!n.modelsRequested&&(u.addModelsFromBucket(g,o),n.modelsRequested=!0),l)?p.zoom=_.overscaledZ:p.zoom=function(i,r){let a=1<<i.canonical.z,n=r.getFreeCameraOptions().position,o=r.elevation,s=i.canonical.x/a,l=(i.canonical.x+1)/a,h=i.canonical.y/a,u=(i.canonical.y+1)/a,c=r._centerAltitude;if(o){let r=o.getMinMaxForTile(i);r&&r.max>c&&(c=r.max)}let d=tv(n.x,s,l)-n.x,p=tv(n.y,h,u)-n.y,f=c/sC(r.center.lat)-n.z;return r._zoomFromMercatorZ(Math.sqrt(d*d+p*p+f*f))}(_,s);let y=d.possiblyEvaluate(p);if(function(i,r,a){let n=r.updateZoomBasedPaintProperties(),o=function(i,r,a){let n,o,s,l=i.terrain?i.terrain.exaggeration():0;if(i.terrain&&l>0){let r=i.terrain,o=r.findDEMTileFor(a);o&&o.dem?n=cB.create(r,a,o):l=0}if(0===l&&(r.terrainElevationMin=0,r.terrainElevationMax=0),l===r.validForExaggeration&&(0===l||n&&n._demTile&&n._demTile.tileID===r.validForDEMTile.id&&n._dem._timestamp===r.validForDEMTile.timestamp))return!1;for(let i in r.instancesPerModel){let a=r.instancesPerModel[i];for(let i=0;i<a.instancedDataArray.length;++i){let h=(n?l*n.getElevationAt(0|a.instancedDataArray.float32[16*i],0|a.instancedDataArray.float32[16*i+1],!0,!0):0)+a.instancesEvaluatedElevation[i];a.instancedDataArray.float32[16*i+6]=h,o=o?Math.min(r.terrainElevationMin,h):h,s=s?Math.max(r.terrainElevationMax,h):h}}return r.terrainElevationMin=o||0,r.terrainElevationMax=s||0,r.validForExaggeration=l,r.validForDEMTile=n&&n._demTile?{id:n._demTile.tileID,timestamp:n._dem._timestamp}:{id:void 0,timestamp:0},!0}(i,r,a);(n||o)&&(r.uploaded=!1,r.upload(i.context))}(i,n,_),_8.shadowUniformsInitialized=!1,_8.useSingleShadowCascade=!!c&&0===c.getMaxCascadeForTile(_.toUnwrapped()),"shadow"===i.renderPass&&c){if(1===i.currentShadowCascade&&n.isInsideFirstShadowMapFrustum)continue;let r=s.calculatePosMatrix(_.toUnwrapped(),s.worldSize);if(_8.tileMatrix.set(r),_8.shadowTileMatrix.set(c.calculateShadowPassMatrixFromMatrix(r)),_8.aabb.min=[0,0,0],_8.aabb.max[0]=_8.aabb.max[1]=8192,_8.aabb.max[2]=0,function(i,r,a,n){if(!a.modelManager)return!0;let o=a.modelManager;if(!a.shadowRenderer)return!0;let s=a.shadowRenderer,l=r.aabb,h=!0,u=i.maxHeight;if(0===u){let r=0;for(let a in i.instancesPerModel){let i=o.getModel(a,n);i?r=Math.max(r,Math.max(Math.max(i.aabb.max[0],i.aabb.max[1]),i.aabb.max[2])):h=!1}u=i.maxScale*r*1.41+i.maxVerticalOffset,h&&(i.maxHeight=u)}l.max[2]=u,l.min[2]+=i.terrainElevationMin,l.max[2]+=i.terrainElevationMax,eN(l.min,l.min,r.tileMatrix),eN(l.max,l.max,r.tileMatrix);let c=l.intersects(s.getCurrentCascadeFrustum());return 0===a.currentShadowCascade&&(i.isInsideFirstShadowMapFrustum=2===c),0===c}(n,_8,i,a.scope))continue}let x=1<<_.canonical.z,v=[((h.x-_.wrap)*x-_.canonical.x)*8192,(h.y
108*x-_.canonical.y)*8192,h.z*x*8192];i.conflationActive&&Object.keys(n.instancesPerModel).length>0&&i.style.isLayerClipped(a,r.getSource())&&n.updateReplacement(_,i.replacementSource,f,a.scope)&&(n.uploaded=!1,n.upload(i.context));let b=0,w=[],T=[],S=[];for(let r in n.instancesPerModel){let s=n.instancesPerModel[r];s.features.length>0&&!l&&(r=y.evaluate(s.features[0].feature,{}));let c=u.getModel(r,o);if(c||u.hasURLBeenRequested(r)||n.modelUris.includes(r)||(n.modelUris.push(r),n.modelsRequested=!1),c&&c.uploaded)if(l){let r=eC([],[h.x,h.y,h.z],i.transform.worldSize);ez(r,r);for(let a=0;a<s.instancedDataArray.length;++a){let o=[0,0,0],l=[1,1,1],h=eX(),u=s.tileCoordinatesForInstance(a),d=s.transformForInstance(a);em(l,d),function(i,r){var a=new X(3);em(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;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)}(h,d),function(i,r){var a=Math.sin(2*Math.acos(r[3])/2);a>1e-6?(i[0]=r[0]/a,i[1]=r[1]/a,i[2]=r[2]/a):(i[0]=1,i[1]=0,i[2]=0)}(o,h);let p=s.translationForInstance(a),f=new sA(0,0);_k(n.canonical,f,u.x,u.y);let _=ee();fl(_,c,i.transform,f,o,l,p,!0,!1,!1);let g=s.colorForInstance(a),y=ed([],r),x=ep([],[1,1,1/sD(f.lat,i.transform.zoom)]);for(let r of(S.push({zScaleMatrix:x,negCameraPosMatrix:y}),c.nodes))_3(i,r,_,i.transform.expandedFarZProjMatrix,b,w,T,c.materialOverrides,m,g);++b}}else for(let r of c.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.getShadowPassDepthMode():new __(u.gl.LEQUAL,__.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=_B(r,a.paint.get("model-cutoff-fade-range"));if(w.shouldRenderCutoff&&x.push("RENDER_CUTOFF"),c&&d)_=r.getOrCreateProgram("modelDepth",{defines:x}),g=_p(h.shadowTileMatrix,h.shadowTileMatrix,n.globalMatrix),y=_m.disabled;else{_0(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=_d(l.expandedProjMatrix,n.globalMatrix,_W,null,r,p,c.baseColorFactor,o.emissiveFactor,c.metallicFactor,c.roughnessFactor,o,m,a,s,void 0,void 0,void 0,1,_.fixedDefines.includes("LIGHTING_3D_MODE")),d&&(h.shadowUniformsInitialized?_.setShadowUniformValues(u,d.getShadowUniformValues()):(d.setupShadows(l.toUnwrapped(),_,"model-tile"),h.shadowUniformsInitialized=!0)),y=w.shouldRenderCutoff||p<1||"OPAQUE"!==o.alphaMode?_m.alphaBlended:_m.unblended}r.uploadCommonUniforms(u,_,l.toUnwrapped(),null,w);let T=i.material.doubleSided?_g.disabled:_g.backCCW;if(b)v.push(o.instancedDataBuffer),_.draw(r,u.gl.TRIANGLES,p,_f.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,_f.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)}(i,a,r,s,v,_,_8)}if(l)if("shadow"===i.renderPass){for(let r of T)_5(r.mesh,r.nodeModelMatrix,i,a);for(let r of w)_5(r.mesh,r.nodeModelMatrix,i,a)}else _6(i,a,w,T,S)}}(i,r,a,n,_2(i,a)),void p();if(!f.loaded())return;if("batched-model"===f.type)return function(i,r,a,n){a.resetLayerRenderingStats(i);let o=i.context,s=i.transform,l=i.style.fog,h=i.shadowRenderer;if("mercator"!==s.projection.name)return tF(`Drawing 3D landmark models for ${s.projection.name} projection is not yet implemented`);let u=i.transform.getFreeCameraOptions().position,c=eC([],[u.x,u.y,u.z],i.transform.worldSize),d=ed([],ez([],c)),p=sD(s.center.lat,s.zoom),f=eo([],d,ep([],[1,1,1/p])),m=a.paint.get("model-opacity").constantOr(1),_=new __(o.gl.LEQUAL,__.ReadWrite,i.depthRangeFor3D),g=new __(o.gl.LEQUAL,__.ReadOnly,i.depthRangeFor3D),y=new uB([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),x="shadow"===i.renderPass,v="light-beam"===i.renderPass,b="none"===a.paint.get("model-color-use-theme").
108constantOr("default"),w=x&&h?h.getCurrentCascadeFrustum():s.getFrustum(s.scaleZoom(s.worldSize)),T=a.paint.get("model-front-cutoff"),S=T[2]<1,E=_B(i,a.paint.get("model-cutoff-fade-range")),I=a.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))}})(i,r,a,n),function(){let u,d,A,M=new Map;S?(u=n.length-1,d=-1,A=-1):(u=0,d=n.length,A=1);let C=ex(),P=new tr(0,0);for(let R=u;R!==d;R+=A){let u=n[R],d=r.getTile(u).getBucket(a);if(!d||!d.uploaded)continue;let A=!1;h&&(A=0===h.getMaxCascadeForTile(u.toUnwrapped()));let D=s.calculatePosMatrix(u.toUnwrapped(),s.worldSize),L=!!(4&d.modelTraits);eo(_G,f,D),eo(_Z,s.expandedFarZProjMatrix,D),en(_$,_G),ea(_$,_$);let z=!x&&h&&h.enabled?h.computeCascadeTileMatrices(D):null;!x&&S&&(en(_U,D),eN(C,c,_U),P.x=C[0],P.y=C[1]);let F=[];for(let r of(d.setFilter(a.filter),d.getNodesInfo())){if(r.hiddenByReplacement||!r.node.meshes)continue;let a=r.node,n=0;i.terrain&&a.elevation&&(n=a.elevation*i.terrain.exaggeration());let o=(()=>{let i=r.aabb,a=y.min,o=y.max;return a[0]=i.min[0],a[1]=i.min[1],a[2]=i.min[2]+n,o[0]=i.max[0],o[1]=i.max[1],o[2]=i.max[2]+n,eN(a,a,D),eN(o,o,D),y})(),l=r.evaluatedScale;if(l[0]<=1&&l[1]<=1&&l[2]<=1&&0===o.intersects(w))continue;if(!x){let a=o.min,n=o.max;_X[0]=.5*(a[0]+n[0]),_X[1]=.5*(a[1]+n[1]),_X[2]=.5*(a[2]+n[2]);let s=eR(c,_X)*p,h=i._debugParams.lodSwitchDistance,u=h>=0;if(u&&h>=9999)r.targetLod=0;else{let o;if(u)o=h;else{let i=(n[2]-a[2])*p*l[2],r=Math.max(n[0]-a[0],n[1]-a[1])*p*Math.max(l[0],l[1]);o=2e3+3e3*(i>=30?1:r>=80?.5:.25*(Math.max(i,r)>=20))}!function(i,r,a,n,o){let s=i.node;if(s.lodMeshes&&s.lodMeshes.length>0)if(i.targetLod<0)i.targetLod=+(r>n);else{let s=o>0?a/1e3/o:1;i.targetLod=tv(r>n?i.targetLod+s:i.targetLod-s,0,1)}else i.targetLod=0}(r,s,Math.min(i.frameTimeDelta,1e3/30),o,i._debugParams.lodSwitchFadeDuration)}}if(!x&&S){let i=1/6;r.cameraCollisionOpacity=c[0]>o.min[0]&&c[0]<o.max[0]&&c[1]>o.min[1]&&c[1]<o.max[1]&&c[2]*p<o.max[2]&&a.footprint&&cL(P,a.footprint)?Math.max(r.cameraCollisionOpacity-i,0):Math.min(1,r.cameraCollisionOpacity+i)}let h=1/sz(u.canonical),d=a.anchor?a.anchor[0]:0,f=a.anchor?a.anchor[1]:0,_=[d*(l[0]-1)+r.evaluatedTranslation[0]*h,f*(l[1]-1)+r.evaluatedTranslation[1]*h,n+r.evaluatedTranslation[2]],g=_Q(new Float64Array(16),D,_,l),v=eo([],g,a.globalMatrix),b=eo([],s.expandedFarZProjMatrix,v),I=b[2]*d+b[6]*f+b[10]*n+b[14];a.hidden=!1;let A=m;x||(S&&(A*=r.cameraCollisionOpacity*function(i,r,a,n){var o,s,l,h,u,c,d;if(r.pitch<20)return 1;let p=r.getWorldToCameraMatrix();eo(p,p,i);let f=e$(a.min[0],a.min[1],a.min[2],1),m=eW(eZ(),f,p),_=m,g=m;f[1]=a.max[1],_=(m=eW(eZ(),f,p))[1]<_[1]?m:_,g=m[1]>g[1]?m:g,f[0]=a.max[0],_=(m=eW(eZ(),f,p))[1]<_[1]?m:_,g=m[1]>g[1]?m:g,f[1]=a.min[1],_=(m=eW(eZ(),f,p))[1]<_[1]?m:_,g=m[1]>g[1]?m:g;let y=tv(n[0],0,1),x=100*r.pixelsPerMeter*tv(n[1],0,1),v=tv(n[2],0,1),b=(o=eZ(),u=(s=_)[1],c=s[2],d=s[3],o[0]=(h=s[0])+y*((l=g)[0]-h),o[1]=u+y*(l[1]-u),o[2]=c+y*(l[2]-c),o[3]=d+y*(l[3]-d),o),w=Math.tan(.5*r.fovX),T=-b[2]*w;if(0===x)return b[1]<-Math.abs(T)?v:1;let S=tv(i9(1,v,(-Math.abs(T)-b[1])/x),v,1);return i9(1,S,tv((r.pitch-20)/20,0,1))}(g,s,r.aabb,T)),A*=function(i,r){let a=i.uniformValues.u_cutoff_params[0],n=i.uniformValues.u_cutoff_params[1],o=i.uniformValues.u_cutoff_params[2],s=i.uniformValues.u_cutoff_params[3];return n===a||s===o?1:tv(((r-a)/(n-a)-o)/(s-o),0,1)}(E,I)),0!==A?F.push({nodeInfo:r,depth:I,opacity:A,wvpForNode:b,nodeModelMatrix:v,tileModelMatrix:g,tileTranslation:_}):a.hidden=!0}for(let r of(x||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 n=r.nodeInfo,u=n.node,c=null;if(i._debugParams.show3DModelFootprints&&u.footprint){let i=u.id||u.name||"footprint";if(!M.has(i)){let a=_Q(new Float64Array(16),_Z,r.tileTranslation,r.nodeInfo.evaluatedScale);M.set(i,{node:u,mvp:a})}}let d=r.nodeInfo.evaluatedScale;_Q(_V,_G,r.tileTranslation,d),_q[0]=1/d[0],_q[1]=-1/d[1],_q[2]=1/d[2],el(_U,_$,_q),eo(_V,_V,u.globalMatrix);
108let p=L?0:n.evaluatedRMEA[0][2],f=n.targetLod,m=u.lodMeshes&&u.lodMeshes.length>0,y=m&&f>0&&f<1;if(x&&m&&1===Math.round(f))continue;let w=!x&&l?_J(_j,r.nodeModelMatrix,i.transform):null,T=x&&h?h.calculateShadowPassMatrixFromMatrix(r.nodeModelMatrix):null,S=y?2:1,E=m&&1===Math.round(f);for(let d=0;d<S;++d){let m=y?1===d:E,S=m?u.lodMeshes:u.meshes,M=y?m?-f:1-f:1;for(let d=0;d<S.length;++d){let f,E=S[d],C=!m&&d===u.lightMeshIndex,P=r.wvpForNode;if(C){if(!v&&!i.terrain&&i.shadowRenderer){i.currentLayer<i.firstLightBeamLayer&&(i.firstLightBeamLayer=i.currentLayer);continue}P=_Q(_H,_Z,r.tileTranslation,r.nodeInfo.evaluatedScale)}else if(v)continue;let R={defines:[]},D=[],F=!!E.normalBuffer;!x&&h&&(h.useNormalOffset=F);let O=E.featureBuffer?n.partStyleUBO:null;if(_0(R.defines,D,E,i,b?null:a.lut,O),L||R.defines.push("DIFFUSE_SHADED"),A&&R.defines.push("SHADOWS_SINGLE_CASCADE"),I&&(x?I.numRenderedVerticesInShadowPass+=E.vertexArray.length:I.numRenderedVerticesInTransparentPass+=E.vertexArray.length),x){_5(E,r.nodeModelMatrix,i,a,T);continue}if(l&&"globe"!==s.projection.name){let i=E.aabb.min,r=E.aabb.max,[a,n]=l.getOpacityForBounds(w,i[0],i[1],r[0],r[1]);R.overrideFog=a>=.05||n>=.05}let B=E.material;B.occlusionTexture&&B.occlusionTexture.offsetScale&&(f=B.occlusionTexture.offsetScale,R.defines.push("OCCLUSION_TEXTURE_TRANSFORM")),y&&R.defines.push("DITHERED_DISCARD");let k=i.getOrCreateProgram("model",R);if(!x&&h&&h.enabled)if(c!==F){for(let i=0;i<z.length;i++)_Q(_K[i]=_K[i]||new Float64Array(16),z[i],r.tileTranslation,r.nodeInfo.evaluatedScale);h.setupShadowsFromCascadeMatrices(_K,k,F),c=F}else k.setShadowUniformValues(o,h.getShadowUniformValues());i.uploadCommonUniforms(o,k,null,w);let N=B.pbrMetallicRoughness;N.metallicFactor=.9,N.roughnessFactor=.5;let V=_d(P,_V,_U,u.globalMatrix,i,r.opacity,N.baseColorFactor,B.emissiveFactor,N.metallicFactor,N.roughnessFactor,B,p,a,_Y,f,void 0,void 0,M,k.fixedDefines.includes("LIGHTING_3D_MODE"));V.u_model_mesh_params=function(i,r,a,n){let o=a?r.lightsStyleAabb:i.aabb,s=o?o.min[2]:1/0,l=(o?o.max[2]:-1/0)-s;return[isFinite(s)?s:0,l>0&&isFinite(l)?l:1,+!!n,0]}(E,u,C,m),O&&O.bind(o,k.program),!C&&(n.hasTranslucentParts||r.opacity<1)&&k.draw(i,o.gl.TRIANGLES,_,_f.disabled,_m.disabled,_g.backCCW,V,a.id,E.vertexBuffer,E.indexBuffer,E.segments,a.paint,i.transform.zoom,void 0,D),k.draw(i,o.gl.TRIANGLES,C?g:_,_f.disabled,C||r.opacity<1||n.hasTranslucentParts?_m.alphaBlended:_m.unblended,_g.backCCW,V,a.id,E.vertexBuffer,E.indexBuffer,E.segments,a.paint,i.transform.zoom,void 0,D)}}}}if(i._debugParams.show3DModelFootprints&&M.size>0)for(let r of Array.from(M.keys()).sort()){let{node:a,mvp:n}=M.get(r);_4(i,0,a,n)}}()}(i,r,a,n),void p();if("model"!==f.type)return;let m=f.getModels(),_=[],g=i.transform.getFreeCameraOptions().position,y=eC([],[g.x,g.y,g.z],i.transform.worldSize);ez(y,y);let x=[],v=[],b=0;for(let n of m){let o=r.getFeatureState("",n.id),s={type:"Unknown",id:n.id,properties:n.featureProperties},u=a.paint.get("model-rotation").evaluate(s,o),c=a.paint.get("model-scale").evaluate(s,o),d=a.paint.get("model-translation").evaluate(s,o),p=a.paint.get("model-opacity").evaluate(s,o);(function(i,r,a,n,o,s){for(let l of o){let o={...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)}})(a,n.id,o,n.featureProperties,n.nodeOverrideNames,n.nodeOverrides),function(i,r,a,n,o,s){for(let l of o){let o={...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)}}(a,n.id,o,n.featureProperties,n.materialOverrideNames,n.materialOverrides),n.nodeOverrides.size>0&&n.computeBoundsAndApplyParent(),n.computeModelMatrix(i,u,c,d,h,l,!1);let f=ed([],y),m=ep([],[1,1,1/sD(n.position.lat,i.transform.zoom)]);for(let r of(_.push({zScaleMatrix:m,negCameraPosMatrix:f}),n.nodes))_3(i,r,n.matrix,i.transform.expandedFarZProjMatrix,b,x,v,n.materialOverrides,p,void 0,n.lightOverrides);b++}if(x.sort((i,r)=>r.depth-i.depth),"shadow"!==i.renderPass){if(i._debugParams.show3DModelFootprints){let r=i.transform.projMatrix,a=new Map,n=(i,n)=>{if(i.footprint){let o=i.id||i.name||"footprint";if(!a.has(o)){let s=eo([],r,n);a.set(o,{node:i,mvp:s})}}};for(let i of v)n(i.node,i.modelMatrix);for(let i of x)n(i.node,i.modelMatrix);for(let r of Array.from(a.keys()).sort()){let{node:n,mvp:o}=a.get(r);_4(i,0,n,o)}}_6(i,a,x,v,_),p()}else{for(let r of v)_5(r.mesh,r.nodeModelMatrix,i,a);for(let r of x)_5(r.mesh,r.nodeModelMatrix,i,a);p()}},prepare: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,_2(a,i)));if("batched-model"!==n.type&&"model"===n.type)for(let i of n.getModels())i.upload(a.context)}},shaders:gI,programUniforms:{model:i=>({u_matrix:new lJ(i),u_lighting_matrix:new lJ(i),u_normal_matrix:new lJ(i),u_node_matrix:new lJ(i),u_lightpos:new lW(i),u_lightintensity:new lH(i),u_lightcolor:new lW(i),u_camera_pos:new lW(i),u_opacity:new lH(i),u_baseColorFactor:new lY(i),u_emissiveFactor:new lY(i),u_metallicFactor:new lH(i),u_roughnessFactor:new lH(i),u_baseTextureIsAlpha:new l$(i),u_alph
108aMask:new l$(i),u_alphaCutoff:new lH(i),u_baseColorTexture:new l$(i),u_metallicRoughnessTexture:new l$(i),u_normalTexture:new l$(i),u_occlusionTexture:new l$(i),u_emissionTexture:new l$(i),u_lutTexture:new l$(i),u_color_mix:new lY(i),u_aoIntensity:new lH(i),u_emissive_strength:new lH(i),u_occlusionTextureTransform:new lY(i),u_dithered_discard_threshold:new lH(i),u_model_mesh_params:new lY(i)}),modelDepth:i=>({u_matrix:new lJ(i),u_instance:new lJ(i),u_node_matrix:new lJ(i)}),groundShadow:i=>({u_matrix:new lJ(i),u_ground_shadow_factor:new lW(i)}),fillExtrusionDepth:i=>({u_matrix:new lJ(i),u_edge_radius:new lH(i),u_width_scale:new lH(i),u_vertical_scale:new lH(i),u_height_type:new l$(i),u_base_type:new l$(i)}),fillExtrusionGroundEffect:i=>({u_matrix:new lJ(i),u_opacity:new lH(i),u_ao_pass:new lH(i),u_meter_to_tile:new lH(i),u_ao:new lq(i),u_flood_light_intensity:new lH(i),u_flood_light_color:new lW(i),u_attenuation:new lH(i),u_edge_radius:new lH(i),u_fb:new l$(i),u_fb_size:new lH(i),u_dynamic_offset:new lH(i)})},ShadowRenderer:class{constructor(i){this.painter=i,this._enabled=!1,this._drawShadowAfterLayer=-1,this._numCascadesToRender=0,this._cascades=[],this._groundShadowTiles=[],this._receivers=new gj,this._depthMode=new __(i.context.gl.LEQUAL,__.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=[]}_hasCasterGeometry(i,r){let a=this.painter.style.getLayerSourceCache(i);if(!a)return!1;let n=a.getSource();if("model"===n.type)return n.getModels().length>0;let o=r[a.id];if(!o)return!1;for(let r of o){let n=a.getTile(r);if(n&&n.getBucket(i))return!0}return!1}updateShadowParameters(i,r,a){let n=this.painter;if(this._enabled=!1,this._drawShadowAfterLayer=-1,this._receivers.clear(),!r||!r.properties)return;let o=r.properties.get("shadow-intensity"),s=r.properties.get("shadow-draw-before-layer");if(!r.shadowsEnabled()||o<=0)return;let l=-1,h=0;for(let r of n.style.order){let o=n.style._mergedLayers[r];o.hasShadowPass()&&!o.isHidden(i.zoom)&&this._hasCasterGeometry(o,a)&&(l=h),s&&(s===r||s===o.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 i=0;i<this._shadowParameters.cascadeCount;++i){let i=u.gl,r=u.createFramebuffer(c,d,0,"texture"),a=new de(u,{width:c,height:d,data:null},i.DEPTH_COMPONENT16);r.depthAttachment.set(a.texture),this._cascades.push({framebuffer:r,texture:a,matrix:[],far:0,boundingSphereRadius:0,frustum:new uO,scale:0})}}this.shadowDirection=gF(r);let p=0;if(i.elevation){let r=i.elevation,a=[1e4,-1e4];r.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])*r.exaggeration())}let f=1.5*i.cameraToCenterDistance,m=3*f,_=new Float64Array(16);for(let r=0;r<this._cascades.length;++r){let a=this._cascades[r],n=i.height/50,o=1;1===this._shadowParameters.cascadeCount?o=m:0===r?o=f:(n=f,o=m);let[s,l]=function(i,r,a,n,o,s){let l,h,u=i.zoom,c=i.scale,d=i.worldSize,p=1/d,f=i.aspect,m=Math.sqrt(1+f*f)*Math.tan(.5*i.fovX),_=m*m,g=n-a,y=n+a;_>g/y?(l=n,h=n*m):(l=.5*y*(1+_),h=.5*Math.sqrt(g*g+2*(n*n+a*a)*_+y*y*_*_));let x=i.projection.pixelsPerMeter(i.center.lat,d),v=[0,0,-l*p];eN(v,v,i._camera.getCameraToWorldMercator());let b=h*p,w=i._edgeInsets;if((0!==w.left||0!==w.top||0!==w.right||0!==w.bottom)&&(w.left!==w.right||w.top!==w.bottom)){let r=i._camera.getWorldToCamera(i.worldSize,"meters"===i.projection.zAxisUnit?x:1),o=i._camera.getCameraToClipPerspective(i._fov,i.width/i.height,a,n);o[8]=-(2*i.centerOffset.x)/i.width,o[9]=2*i.centerOffset.y/i.height;let s=new Float64Array(16);eo(s,o,r);let l=new Float64Array(16);
108for(let r of(en(l,s),uO.fromInvProjectionMatrix(l,d,u,!0).points))b=Math.max(b,eb(eE([],v,function(r){return r[0]/=c,r[1]/=c,r[2]=r[2]/sC(i._center.lat),r}(r))))}b*=o/(o-1);let T=Math.acos(r[2]),S=Math.atan2(-r[0],-r[1]),E=new _T;E.position=v,E.setPitchBearing(T,S);let I=E.getWorldToCamera(d,x),A=b*d,M=Math.min(-(i._mercatorZfromZoom(17)*d*2),-2*A),C=E.getCameraToClipOrthographic(-A,A,-A,A,M,(A+s*x)/r[2]),P=new Float64Array(16);eo(P,C,I);let R=.5*o,D=[0,0,0];eN(D,ew(Math.floor(1e6*v[0])/1e6*d,Math.floor(1e6*v[1])/1e6*d,0),P),eC(D,D,R);let L=[Math.floor(D[0]),Math.floor(D[1]),Math.floor(D[2])],z=[0,0,0];eE(z,D,L),eC(z,z,-1/R);let F=new Float64Array(16);return er(F),es(F,F,z),eo(P,F,P),[P,A]}(i,this.shadowDirection,n,o,this._shadowParameters.shadowMapResolution,p);a.scale=i.scale,a.matrix=s,a.boundingSphereRadius=l,en(_,a.matrix),a.frustum=uO.fromInvProjectionMatrix(_,1,0,!0),a.far=o}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=_h.ShadowMap0,this._uniformValues.u_shadowmap_1=_h.ShadowMap0+1,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(i,r){if(!this.enabled)return;let a=this.painter,n=a.context;this._numCascadesToRender=this._receivers.computeRequiredCascades(a.transform.getFrustum(0),a.transform.worldSize,this._cascades),n.viewport.set([0,0,this._shadowParameters.shadowMapResolution,this._shadowParameters.shadowMapResolution]);for(let o=0;o<this._numCascadesToRender;++o)for(let s of(a.currentShadowCascade=o,n.bindFramebuffer.set(this._cascades[o].framebuffer.framebuffer),n.clear({color:re.white,depth:1}),i.order)){let n=i._mergedLayers[s];if(!n.hasShadowPass()||n.isHidden(a.transform.zoom))continue;let o=i.getLayerSourceCache(n),l=o?r[o.id]:void 0;("model"===n.type||l&&l.length)&&a.renderLayer(a,o,n,l)}a.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=_B(i,i.longestCutoffRange);h.shouldRenderCutoff&&l.push("RENDER_CUTOFF"),l.push("RENDER_SHADOWS"),this.useNormalOffset&&l.push("NORMAL_OFFSET");let u=gO(r,o,s),c=new __(n.LEQUAL,__.ReadOnly,i.depthRangeFor3D),d=new _f({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=gA(i.transform.calculateProjMatrix(o),u);p.draw(i,n.TRIANGLES,c,d,_m.multiply,_g.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(i){let r=this.painter.transform,a=r.calculatePosMatrix(i,r.worldSize);return eo(a,this._cascades[this.painter.currentShadowCascade].matrix,a),Float32Array.from(a)}calculateShadowPassMatrixFromMatrix(i){return eo(gV,this._cascades[this.painter.currentShadowCascade].matrix,i)}setupShadows(i,r,a){if(!this.enabled)return;let n=this.painter.transform,o=this.painter.context,s=o.gl,l=this._uniformValues,h=n.calculatePosMatrix(i,n.worldSize);for(let i=0;i<this._cascades.length;i++){let r=gk(i);eo(r,this._cascades[i].matrix,h),l[0===i?"u_light_matrix_0":"u_light_matrix_1"]=r,o.activeTexture.set(s.TEXTURE0+_h.ShadowMap0+i),this._cascades[i].texture.bindExtraParam(s.LINEAR,s.LINEAR,s.CLAMP_TO_EDGE,s.CLAMP_TO_EDGE,s.GREATER)}if(this.useNormalOffset=!!a,this.useNormalOffset){let r=sz(i.canonical),o=2/n.tileSize*8192/this._shadowParameters.shadowMapResolution,s=o*this._cascades[0].boundingSphereRadius,h=o*this._cascades.at(-1).boundingSphereRadius,u=("vector-tile"===a?1:3)*function(i){let r=tv(-((i-22)/22),0,1);return .125*(1-r)+4*r}(n.zoom);l.u_shadow_normal_offset=[r,s*u,h*u],l.u_shadow_bias=[1e-4,.0012,.012]}else l.u_shadow_bias=[36e-5,.0012,.012];r.setShadowUniformValues(o,l)}computeCascadeTileMatrices(i){let r=this._shadowParameters.cascadeCount;for(let a=0;a<r;a++)eo(gN[a]=gN[a]||new Float64Array(16),this._cascades[a].matrix,i);return gN.length=r,gN}
108setupShadowsFromMatrix(i,r,a=!1){if(!this.enabled)return;let n=this._shadowParameters.cascadeCount;for(let r=0;r<n;r++)eo(gk(r),this._cascades[r].matrix,i);gB.length=n,this.setupShadowsFromCascadeMatrices(gB,r,a)}setupShadowsFromCascadeMatrices(i,r,a=!1){if(!this.enabled)return;let n=this.painter.context,o=n.gl,s=this._uniformValues;for(let r=0;r<this._shadowParameters.cascadeCount;r++)s[0===r?"u_light_matrix_0":"u_light_matrix_1"]=i[r],n.activeTexture.set(o.TEXTURE0+_h.ShadowMap0+r),this._cascades[r].texture.bindExtraParam(o.LINEAR,o.LINEAR,o.CLAMP_TO_EDGE,o.CLAMP_TO_EDGE,o.GREATER);if(this.useNormalOffset=a,a){let i=this._shadowParameters.normalOffset;s.u_shadow_normal_offset=[1,i,i],s.u_shadow_bias=[6e-5,.0012,.012]}else s.u_shadow_bias=[36e-5,.0012,.012];r.setShadowUniformValues(n,s)}getShadowUniformValues(){return this._uniformValues}getCurrentCascadeFrustum(){return this._cascades[this.painter.currentShadowCascade].frustum}computeSimplifiedTileShadowVolume(i,r,a,n){if(n[2]>=0)return{};let o=(function(i,r,a){let n=a/(1<<i.canonical.z);return new uB([i.canonical.x*n+i.wrap*a,i.canonical.y*n+i.wrap*a,0],[(i.canonical.x+1)*n+i.wrap*a,(i.canonical.y+1)*n+i.wrap*a,r])})(i,r,a).getCorners(),s=-(r/n[2]);n[0]<0?(eS(o[0],o[0],[n[0]*s,0,0]),eS(o[3],o[3],[n[0]*s,0,0])):n[0]>0&&(eS(o[1],o[1],[n[0]*s,0,0]),eS(o[2],o[2],[n[0]*s,0,0])),n[1]<0?(eS(o[0],o[0],[0,n[1]*s,0]),eS(o[1],o[1],[0,n[1]*s,0])):n[1]>0&&(eS(o[2],o[2],[0,n[1]*s,0]),eS(o[3],o[3],[0,n[1]*s,0]));let l={};return l.vertices=o,l.planes=[gG(o[1],o[0],o[4]),gG(o[2],o[1],o[5]),gG(o[3],o[2],o[6]),gG(o[0],o[3],o[7])],l}addShadowReceiver(i,r,a){this._receivers.add(i,uB.fromTileIdAndHeight(i,r,a))}getMaxCascadeForTile(i){let r=this._receivers.get(i);return r&&r.lastCascade?r.lastCascade:0}},drawGroundEffect:gz,queryModelLayerRendered:function(i,r,a,n){let o=a.getSource();if(!o||"model"!==o.type)return{};let s={};s[i.id]=[];let l=s[i.id],h=0;for(let s of o.models){let o=a.getFeatureState(i.sourceLayer,s.id),u={type:"Unknown",id:s.id,properties:s.featureProperties},c=i.paint.get("model-rotation").evaluate(u,o),d=i.paint.get("model-scale").evaluate(u,o),p=i.paint.get("model-translation").evaluate(u,o),f=i.paint.get("model-elevation-reference"),m=[];fl(m,s,n,s.position,c,d,p,"ground"===f,"ground"===f,!1),"globe"===n.projection.name&&(m=fa(m,n));let _=eo([],n.projMatrix,m),g=fn(r.isPointQuery()?r.screenBounds:r.screenGeometry,n,_,s.aabb);if(null!=g){let r=new _l(void 0,0,0,0,s.id);r.layer=i.layer,r.properties=structuredClone(s.featureProperties),r.properties.layer=i.id,r.properties.uri=s.uri,r.properties.orientation=s.orientation,r.sourceLayer=i.sourceLayer,r.geometry={type:"Point",coordinates:[s.position.lng,s.position.lat]},r.state=o,r.source=i.source,l.push({featureIndex:h,feature:r,intersectionZ:g})}++h}return s},queryModelLayerIntersectsFeature:function(i,r,a,n,o,s){if(!i.modelManager)return!1;let l=i.modelManager,h=r.tile.getBucket(i);if(!(h&&h instanceof m6))return!1;for(let n in h.instancesPerModel){let u=h.instancesPerModel[n],c=void 0!==a.id?a.id:a.properties&&Object.hasOwn(a.properties,"id")?a.properties.id:void 0;if(Object.hasOwn(u.idToFeaturesIndex,c)){let a=u.features[u.idToFeaturesIndex[c]],d=l.getModel(n,s||i.scope);if(!d)return!1;let p=[],f=new sA(0,0),m=h.canonical,_=Number.MAX_VALUE;for(let i=0;i<a.instancedDataCount;++i){let n=16*(a.instancedDataOffset+i),s=u.instancedDataArray.float32,l=[s[n+4],s[n+5],s[n+6]];_k(m,f,Math.floor(s[n]),Math.floor(s[n+1])),fl(p,d,o,f,a.rotation,a.scale,l,!1,!1,!1),"globe"===o.projection.name&&(p=fa(p,o));let h=eo([],o.projMatrix,p),c=r.queryGeometry,g=fn(c.isPointQuery()?c.screenBounds:c.screenGeometry,o,h,d.aabb);null!=g&&(_=Math.min(g,_))}return _!==Number.MAX_VALUE&&_}}return!1},loadMatchingModelFeature: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()),es(u,u,[(l.anchor?l.anchor[0]:0)*(c[0]-1),(l.anchor?l.anchor[1]:0)*(c[1]-1),d]),el(u,u,c);let p=a.queryGeometry,f=p.isPointQuery()?p.screenBounds:p.screenGeometry,m=function(i){let r=eo([],u,i.globalMatrix);eo(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=fn(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 sA(0,0);return _k(h.tileID.canonical,_,o.node.anchor[0],o.node.anchor[1]),{intersectionZ:s,position:_,feature:o.feature}},ModelSource:gZ,Tiled3dModelSource:class extends i3{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 i=o0(this.id,this.scope);this.load(()=>this.map.style.clearSource(i))}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}load(i){this._loaded=!1,this.fire(new iQ("dataloading",{dataType:"source"}));let r=Array.isArray(this.map._language)?this.map._language.join():this.map._language,a=this.map.getWorldview();this._tileJSONRequest=gH(this._options,this.map._requestManager,r,a,(n,o)=>{this._tileJSONRequest=null,this._loaded=!0,n?(r&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${r}`),a&&2!==a.length&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${a}`),this.fire(new i0(n))):o&&(Object.assign(this,o),o.bounds&&(this.tileBounds=new gW(o.bounds,this.minzoom,this.maxzoom)),ik(o.tiles,this.map._requestManager._customAccessToken),this.fire(new iQ("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new iQ("data",{dataType:"source",sourceDataType:"content"}))),i&&i(n)})}hasTransition(){return!1}
108hasTile(i){return!this.tileBounds||this.tileBounds.contains(i.canonical)}loaded(){return this._loaded}async loadTile(i,r){let a=this.map._requestManager.normalizeTileURL(i.tileID.canonical.url(this.tiles,this.scheme)),n=!i.actor||"expired"===i.state;if(n)i.actor=this.dispatcher.getActor();else{if("loading"===i.state)return void(i.reloadCallback=r);if(i.buckets){for(let r of Object.values(i.buckets))r.dirty=!0;return void(i.state="loaded")}}let o=new AbortController;i.request=o;let s=(a,n)=>(delete i.request,i.aborted?r(null):a&&!iu(a)?r(a):(this.map._refreshExpiredTiles&&n&&i.setExpiryData(tU(n.headers)),i.loadModelData(n,this.map.painter),i.state="loaded",r(null),void(i.reloadCallback&&(this.loadTile(i,i.reloadCallback),i.reloadCallback=null))));try{let l=await this.map._requestManager.transformRequest(a,il.Tile,o.signal);if(o.signal.aborted)return r(null);let h={request:l,data:void 0,uid:i.uid,tileID:i.tileID,tileZoom:i.tileZoom,zoom:i.tileID.overscaledZ,tileSize:this.tileSize*i.tileID.overscaleFactor(),type:this.type,source:this.id,scope:this.scope,showCollisionBoxes:this.map.showCollisionBoxes,renderSourceType:i.renderSourceType,brightness:this.map.style&&this.map.style.getBrightness()||0,pixelRatio:tJ.devicePixelRatio,promoteId:this.promoteId};i.request=i.actor.sendCancelable(n?"loadTile":"reloadTile",h,{},s)}catch(i){if(o.signal.aborted)return r(null);r(i)}}abortTile(i){i.request&&(i.request.abort(),delete i.request),i.actor&&i.actor.notify("abortTile",{uid:i.uid,type:this.t
108ype,source:this.id,scope:this.scope})}serialize(){return{...this._options}}},loadModel:async function(i,r,a){let n=new fh(r,a,void 0,void 0,fI(await pW(i)));return n.computeBoundsAndApplyParent(),n}};class gY{constructor(i,r){this.tileID=i,this.x=i.canonical.x,this.y=i.canonical.y,this.z=i.canonical.z,this.grid=new nZ(8192,8192,512),this.featureIndexArray=new lM,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]>=0&&u.insert(h,n[0],n[1],n[2],n[3])}}loadVTLayers(){if(!this.vtLayers)for(let i in this.vtLayers=new hf(new c$(this.rawTileData)).layers,this.sourceLayerCoder=new _o(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)=>hT(n.bufferedTilespaceGeometry,i-c,r-c,a+c,o+c));p.sort(gJ);let f=null;o.elevation&&p.length>0&&(f=cB.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=sk(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&&!tL(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 _l(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={...v},x.layer.paint=gK(v.paint,h.paint,g,f,n),x.layer.layout=gK(v.layout,h.layout,g,f,n);let b=new oC(this.tileID.overscaledZ,{worldview:o}),w=!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=sN(g,!0);if(!r.filter(b,i,this.tileID.canonical))continue}else if(!r.filter(b,g))continue}w=!0,i.targetId&&this.addFeatureVariant(x,i)}w&&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||tL(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.isTiled3dModelBucket||!gX.loadMatchingModelFeature)continue;let _=gX.loadMatchingModelFeature(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 _l({},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={...E};let I=new oC(this.tileID.overscaledZ,{worldview:s}),A=!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(I,v,this.tileID.canonical))continue}else if(!r.filter(I,v))continue}A=!0,i.targetId&&this.addFeatureVariant(S,i)}A&&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={};
108for(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=nN(n);if("success"!==i.result){let r=i.value.map(i=>`${i.key}: ${i.message}`).join(", ");return void tF(`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 gK(i,r,a,n,o){return tP(i,(i,s)=>{let l=r instanceof oB?r.get(s):null;return l&&l.evaluate?l.evaluate(a,n,void 0,o):l})}function gJ(i,r){return r-i}async function gQ(){return Promise.resolve()}nH(gY,"FeatureIndex",{omit:["rawTileData","sourceLayerCoder"]});let g0={circle:class extends o7{constructor(i,r,a,n){super(i,{layout:mp||(mp=new oU({"circle-sort-key":new oN(oj.layout_circle["circle-sort-key"]),"circle-elevation-reference":new ok(oj.layout_circle["circle-elevation-reference"]),visibility:new ok(oj.layout_circle.visibility)})),paint:mf||(mf=new oU({"circle-radius":new oN(oj.paint_circle["circle-radius"]),"circle-color":new oN(oj.paint_circle["circle-color"]),"circle-blur":new oN(oj.paint_circle["circle-blur"]),"circle-opacity":new oN(oj.paint_circle["circle-opacity"]),"circle-translate":new ok(oj.paint_circle["circle-translate"]),"circle-translate-anchor":new ok(oj.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new ok(oj.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new ok(oj.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new oN(oj.paint_circle["circle-stroke-width"]),"circle-stroke-color":new oN(oj.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new oN(oj.paint_circle["circle-stroke-opacity"]),"circle-emissive-strength":new ok(oj.paint_circle["circle-emissive-strength"]),"circle-color-use-theme":new oN({type:"string",default:"default","property-type":"data-driven"}),"circle-stroke-color-use-theme":new oN({type:"string",default:"default","property-type":"data-driven"})}))},r,a,n)}createBucket(i){return new hY(i)}queryRadius(i){return mT("circle-radius",this,i)+mT("circle-stroke-width",this,i)+mS(this.paint.get("circle-translate"))}queryIntersectsFeature(i,r,a,n,o,s,l,h){let u=mI(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 mC(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=mM(this);return{config:new l8(this,{zoom:r,lut:a}),defines:n,overrideFog:!1}}is3D(i){return!i&&!!this.layout&&"none"!==this.layout.get("circle-elevation-reference")}hasElevation(){return this.layout&&"none"!==this.layout.get("circle-elevation-reference")}mayUse(i){return"HD"===i&&se(this,"circle-elevation-reference",i=>"hd-road-markup"===i)}prepare(){return this.mayUse("HD")?mw():Promise.resolve()}},heatmap:class extends o7{createBucket(i){return new mD(i)}constructor(i,r,a,n){super(i,{layout:_||(_=new oU({visibility:new ok(oj.layout_heatmap.visibility)})),paint:g||(g=new oU({"heatmap-radius":new oN(oj.paint_heatmap["heatmap-radius"]),"heatmap-weight":new oN(oj.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new ok(oj.paint_heatmap["heatmap-intensity"]),"heatmap-color":new oV(oj.paint_heatmap["heatmap-color"]),"heatmap-opacity":new ok(oj.paint_heatmap["heatmap-opacity"]),"heatmap-color-use-theme":new oN({type:"string",default:"default","property-type":"data-driven"})}))},r,a,n),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(i){"heatmap-color"===i&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=mz({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 mT("heatmap-radius",this,i)}queryIntersectsFeature(i,r,a,n,o,s,l,h){let u=this.paint.get("heatmap-radius").evaluate(r,a);return mC(i,n,s,l,h,!0,!0,new tr(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 l8(this,{zoom:r,lut:a}),overrideFog:!1}:{}}},hillshade:class extends o7{constructor(i,r,a,n){super(i,{layout:y||(y=new oU({visibility:new ok(oj.layout_hillshade.visibility)})),paint:x||(x=new oU({"hillshade-illumination-direction":new ok(oj.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new ok(oj.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new ok(oj.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new ok(oj.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new ok(oj.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new ok(oj.paint_hillshade["hillshade-accent-color"]),"hillshade-emissive-strength":new ok(oj.paint_hillshade["hillshade-emissive-strength"]),"hillshade-shadow-color-use-theme":new oN({type:"string",default:"default","property-type":"data-driven"}),"hillshade-highlight-color-use-theme":new oN({type:"string",default:"default","property-type":"data-driven"}),"hillshade-accent-color-use-theme":new oN({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 o7{constructor(i,r,a,n){super(i,{layout:v||(v=new oU({"fill-sort-key":new oN(oj.layout_fill["fill-sort-key"]),visibility:new ok(oj.layout_fill.visibility),"fill-elevation-reference":new ok(oj.layout_fill["fill-elevation-reference"]),"fill-construct-bridge-guard-rail":new oN(oj.layout_fill["fill-construct-bridge-guard-rail"])}
108)),paint:b||(b=new oU({"fill-antialias":new ok(oj.paint_fill["fill-antialias"]),"fill-opacity":new oN(oj.paint_fill["fill-opacity"]),"fill-color":new oN(oj.paint_fill["fill-color"]),"fill-outline-color":new oN(oj.paint_fill["fill-outline-color"]),"fill-translate":new ok(oj.paint_fill["fill-translate"]),"fill-translate-anchor":new ok(oj.paint_fill["fill-translate-anchor"]),"fill-pattern":new oN(oj.paint_fill["fill-pattern"]),"fill-pattern-cross-fade":new ok(oj.paint_fill["fill-pattern-cross-fade"]),"fill-emissive-strength":new ok(oj.paint_fill["fill-emissive-strength"]),"fill-z-offset":new oN(oj.paint_fill["fill-z-offset"]),"fill-bridge-guard-rail-color":new oN(oj.paint_fill["fill-bridge-guard-rail-color"]),"fill-tunnel-structure-color":new oN(oj.paint_fill["fill-tunnel-structure-color"]),"fill-color-use-theme":new oN({type:"string",default:"default","property-type":"data-driven"}),"fill-outline-color-use-theme":new oN({type:"string",default:"default","property-type":"data-driven"}),"fill-bridge-guard-rail-color-use-theme":new oN({type:"string",default:"default","property-type":"data-driven"}),"fill-tunnel-structure-color-use-theme":new oN({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 l8(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 ha(i)}queryRadius(){return mS(this.paint.get("fill-translate"))}queryIntersectsFeature(i,r,a,n,o,s){return!i.queryGeometry.isAboveHorizon&&h_(mE(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;let 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")}mayUse(i){return"HD"===i&&se(this,"fill-elevation-reference",i=>"none"!==i)}prepare(){return this.mayUse("HD")?mw():Promise.resolve()}hasShadowPass(){return this.layout&&"none"!==this.layout.get("fill-elevation-reference")}},"fill-extrusion":class extends o7{constructor(i,r,a,n){super(i,{layout:S||(S=new oU({visibility:new ok(oj["layout_fill-extrusion"].visibility),"fill-extrusion-edge-radius":new ok(oj["layout_fill-extrusion"]["fill-extrusion-edge-radius"]),"source-max-zoom":new ok(oj["layout_fill-extrusion"]["source-max-zoom"])})),paint:E||(E=new oU({"fill-extrusion-opacity":new ok(oj["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new oN(oj["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new ok(oj["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new ok(oj["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new oN(oj["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-pattern-cross-fade":new ok(oj["paint_fill-extrusion"]["fill-extrusion-pattern-cross-fade"]),"fill-extrusion-height":new oN(oj["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new oN(oj["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-height-alignment":new ok(oj["paint_fill-extrusion"]["fill-extrusion-height-alignment"]),"fill-extrusion-base-alignment":new ok(oj["paint_fill-extrusion"]["fill-extrusion-base-alignment"]),"fill-extrusion-vertical-gradient":new ok(oj["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"]),"fill-extrusion-ambient-occlusion-intensity":new ok(oj["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-intensity"]),"fill-extrusion-ambient-occlusion-radius":new ok(oj["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-radius"]),"fill-extrusion-ambient-occlusion-wall-radius":new ok(oj["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-wall-radius"]),"fill-extrusion-ambient-occlusion-ground-radius":new ok(oj["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-ground-radius"]),"fill-extrusion-ambient-occlusion-ground-attenuation":new ok(oj["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-ground-attenuation"]),"fill-extrusion-flood-light-color":new ok(oj["paint_fill-extrusion"]["fill-extrusion-flood-light-color"]),"fill-extrusion-flood-light-intensity":new ok(oj["paint_fill-extrusion"]["fill-extrusion-flood-light-intensity"]),"fill-extrusion-flood-light-wall-radius":new oN(oj["paint_fill-extrusion"]["fill-extrusion-flood-light-wall-radius"]),"fill-extrusion-flood-light-ground-radius":new oN(oj["paint_fill-extrusion"]["fill-extrusion-flood-light-ground-radius"]),"fill-extrusion-flood-light-ground-attenuation":new ok(oj["paint_fill-extrusion"]["fill-extrusion-flood-light-ground-attenuation"]),"fill-extrusion-vertical-scale":new ok(oj["paint_fill-extrusion"]["fill-extrusion-vertical-scale"]),"fill-extrusion-rounded-roof":new ok(oj["paint_fill-extrusion"]["fill-extrusion-rounded-roof"]),"fill-extrusion-cutoff-fade-range":new ok(oj["paint_fill-extrusion"]["fill-extrusion-cutoff-fade-range"]),"fill-extrusion-front-cutoff":new ok(oj["paint_fill-extrusion"]["fill-extrusion-front-cutoff"]),"fill-extrusion-emissive-strength":new oN(oj["paint_fill-extrusion"]["fill-extrusion-emissive-strength"]),"fill-extrusion-line-width":new oN(oj["paint_fill-extrusion"]["fill-extrusion-line-width"]),"fill-extrusion-cast-shadows":new ok(oj["paint_fill-extrusion"]["fill-extrusion-cast-shadows"]),"fill-extrusion-color-use-theme":new oN({type:"string",default:"default","property-type":"data-driven"}),"fill-extrusion-flood-light-color-use-theme":new oN({type:"string",default:"default","property-type":"data-driven"})}))},r,a,n),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(i){return new me(i)}queryRadius(){return mS(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=mI(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 me){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=mu([n],[new tr(0,0),new tr(8192,8192)],i.tileID.canonical).map(i=>i.polygon).flat());let[y,x]=mN(s,n,p,d,c,l,m?h:null,f,_,s.center.lat,i.tileID.canonical),v=i.queryGeometry;return mk(y,x,v.isPointQuery()?v.screenBounds:v.screenGeometry)}},building:class extends o7{constructor(i,r,a,n){super(i,{layout:I||(I=new oU({visibility:new ok(oj.layout_building.visibility),"building-facade":new oN(oj.layout_building["building-facade"]),"building-facade-floors":new oN(oj.layout_building["building-facade-floors"]),"building-facade-unit-width":new oN(oj.layout_building["building-facade-unit-width"]),"building-facade-window":new oN(oj.layout_building["building-facade-window"]),"building-roof-shape":new oN(oj.layout_building["building-roof-shape"]),"building-height":new oN(oj.layout_building["building-height"]),"building-base":new oN(oj.layout_building["building-base"]),"building-flood-light-wall-radius":new oN(oj.layout_building["building-flood-light-wall-radius"]),"building-flood-light-ground-radius":new oN(oj.layout_building["building-flood-light-ground-radius"]),"building-flip-roof-orientation":new oN(oj.layout_building["building-flip-roof-orientation"])})),paint:A||(A=new oU({"building-opacity":new ok(oj.paint_building["building-opacity"]),"building-ambient-occlusion-intensity":new ok(oj.paint_building["building-ambient-occlusion-intensity"]),"building-ambient-occlusion-ground-intensity":new ok(oj.paint_building["building-ambient-occlusion-ground-intensity"]),"building-ambient-occlusion-ground-radius":new ok(oj.paint_building["building-ambient-occlusion-ground-radius"]),"building-ambient-occlusion-ground-attenuation":new ok(oj.paint_building["building-ambient-occlusion-ground-attenuation"]),"building-vertical-scale":new ok(oj.paint_building["building-vertical-scale"]),"building-cast-shadows":new ok(oj.paint_building["building-cast-shadows"]),"building-color":new oN(oj.paint_building["building-color"]),"building-emissive-strength":new oN(oj.paint_building["building-emissive-strength"]),"building-facade-emissive-chance":new ok(oj.paint_building["building-facade-emissive-chance"]),"building-cutoff-fade-range":new ok(oj.paint_building["building-cutoff-fade-range"]),"building-front-cutoff":new ok(oj.paint_building["building-front-cutoff"]),"building-flood-light-color":new ok(oj.paint_building["building-flood-light-color"]),"building-flood-light-intensity":new ok(oj.paint_building["building-flood-light-intensity"]),"building-flood-light-ground-attenuation":new ok(oj.paint_building["building-flood-light-ground-attenuation"]),"building-color-use-theme":new oN({type:"string",default:"default","property-type":"data-driven"}),"building-flood-light-color-use-theme":new oN({type:"string",default:"default","property-type":"data-driven"})}))},r,a,n),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}mayUse(i){return"HD"===i}prepare(){return async function(){return tN(self)&&null==mg&&null==m_?null!=mm?mm:mm=(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 mc({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(t2())).then(i=>{mm=null,mg=i}).catch(i=>{tF("Could not load building-gen"),mm=null,m_=i}):null}()}createBucket(i){return new mv(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,_]=mN(s,n,p,d,new tr(0,0),l,null,[0,0],1,s.center.lat,i.tileID.canonical),g=i.queryGeometry;return mk(m,_,g.isPointQuery()?g.screenBounds:g.screenGeometry)}},line:class extends o7{constructor(i,r,a,n){let o=mH();super(i,o,r,a,n),o.layout&&(this.layout=new oB(o.layout)),this.gradientVersion=0,this.borderGradientVersion=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 aU,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}
108else if("line-gradient-use-theme"===i)this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER;else if("line-border-gradient"===i){let i=this._transitionablePaint._values["line-border-gradient"].value.expression;this.borderStepInterpolant=i._styleExpression&&i._styleExpression.expression instanceof aU,this.borderGradientVersion=(this.borderGradientVersion+1)%Number.MAX_SAFE_INTEGER}else"line-border-gradient-use-theme"===i&&(this.borderGradientVersion=(this.borderGradientVersion+1)%Number.MAX_SAFE_INTEGER)}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}borderGradientExpression(){return this._transitionablePaint._values["line-border-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 mq(mH().paint.properties["line-width"].specification)).useIntegerZoom=!0),R).possiblyEvaluate(this._transitioningPaint._values["line-width"].value,i)}createBucket(i){return new h$(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=mZ(this);return{config:new l8(this,{zoom:r,lut:a}),defines:n,overrideFog:!1}}queryRadius(i){var r,a;return r=mT("line-width",this,i),((a=mT("line-gap-width",this,i))>0?a+2*r:r)/2+Math.abs(mT("line-offset",this,i))+mS(this.paint.get("line-translate"))}queryIntersectsFeature(i,r,a,n,o,s){var l,h;if(i.queryGeometry.isAboveHorizon)return!1;let u=mE(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 tr(0,0);for(let o=0;o<i.length;o++){let s=i[o],l=[];for(let i=0;i<s.length;i++){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(hw(i,o[r]))return!0}if(function(i,r,a){if(i.length>1){if(hg(i,r))return!0;for(let n=0;n<r.length;n++)if(hx(r[n],i,a))return!0}for(let n=0;n<i.length;n++)if(hx(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")}mayUse(i){return"HD"===i?se(this,"line-elevation-reference",i=>"hd-road-markup"===i):"Lite"===i&&function(i){if(!i._unevaluatedLayout)return!1;let r=i._unevaluatedLayout.getValue("line-elevation-reference");if(void 0!==r&&("string"!=typeof r||"none"!==r))return!0;let a=i._unevaluatedLayout.getValue("line-z-offset");return void 0!==a&&("number"!=typeof a||0!==a)}(this)}prepare(){return this.mayUse("HD")?mw():Promise.resolve()}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:mQ,background:class extends o7{constructor(i,r,a,n){super(i,{layout:F||(F=new oU({visibility:new ok(oj.layout_background.visibility)})),paint:O||(O=new oU({"background-pitch-alignment":new ok(oj.paint_background["background-pitch-alignment"]),"background-color":new ok(oj.paint_background["background-color"]),"background-pattern":new ok(oj.paint_background["background-pattern"]),"background-opacity":new ok(oj.paint_background["background-opacity"]),"background-emissive-strength":new ok(oj.paint_background["background-emissive-strength"]),"background-color-use-theme":new oN({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:m0,"raster-particle":m1,sky:class extends o7{constructor(i,r,a,n){super(i,{layout:U||(U=new oU({visibility:new ok(oj.layout_sky.visibility)})),paint:j||(j=new oU({"sky-type":new ok(oj.paint_sky["sky-type"]),"sky-atmosphere-sun":new ok(oj.paint_sky["sky-atmosphere-sun"]),"sky-atmosphere-sun-intensity":new ok(oj.paint_sky["sky-atmosphere-sun-intensity"]),"sky-gradient-center":new ok(oj.paint_sky["sky-gradient-center"]),"sky-gradient-radius":new ok(oj.paint_sky["sky-gradient-radius"]),"sky-gradient":new oV(oj.paint_sky["sky-gradient"]),"sky-atmosphere-halo-color":new ok(oj.paint_sky["sky-atmosphere-halo-color"]),"sky-atmosphere-color":new ok(oj.paint_sky["sky-atmosphere-color"]),"sky-opacity":new ok(oj.paint_sky["sky-opacity"]),"sky-gradient-use
108-theme":new oN({type:"string",default:"default","property-type":"data-driven"}),"sky-atmosphere-halo-color-use-theme":new oN({type:"string",default:"default","property-type":"data-driven"}),"sky-atmosphere-color-use-theme":new oN({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=mz({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;if(!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")&&tF("The sun direction is attached to a light with viewport anchor, lighting may behave unexpectedly."),n?m3(s.azimuthal,90-s.polar,r):m3(a[0],90-a[1],r)}let a=this.paint.get("sky-gradient-center");return m3(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 o7{constructor(i,r,a,n){super(i,{paint:G||(G=new oU({}))},r,null)}},"placement-group":class extends o7{constructor(i,r,a,n){super(i,{paint:Z||(Z=new oU({}))},r,a,n)}},model:class extends o7{constructor(i,r,a,n){super(i,{layout:$||($=new oU({visibility:new ok(oj.layout_model.visibility),"model-id":new oN(oj.layout_model["model-id"]),"model-allow-density-reduction":new ok(oj.layout_model["model-allow-density-reduction"])})),paint:H||(H=new oU({"model-opacity":new oN(oj.paint_model["model-opacity"]),"model-rotation":new oN(oj.paint_model["model-rotation"]),"model-scale":new oN(oj.paint_model["model-scale"]),"model-translation":new oN(oj.paint_model["model-translation"]),"model-color":new oN(oj.paint_model["model-color"]),"model-color-mix-intensity":new oN(oj.paint_model["model-color-mix-intensity"]),"model-type":new ok(oj.paint_model["model-type"]),"model-cast-shadows":new ok(oj.paint_model["model-cast-shadows"]),"model-receive-shadows":new ok(oj.paint_model["model-receive-shadows"]),"model-ambient-occlusion-intensity":new ok(oj.paint_model["model-ambient-occlusion-intensity"]),"model-emissive-strength":new oN(oj.paint_model["model-emissive-strength"]),"model-roughness":new oN(oj.paint_model["model-roughness"]),"model-height-based-emissive-strength-multiplier":new oN(oj.paint_model["model-height-based-emissive-strength-multiplier"]),"model-cutoff-fade-range":new ok(oj.paint_model["model-cutoff-fade-range"]),"model-front-cutoff":new ok(oj.paint_model["model-front-cutoff"]),"model-elevation-reference":new ok(oj.paint_model["model-elevation-reference"]),"model-line-cutout-mode":new ok(oj.paint_model["model-line-cutout-mode"]),"model-color-use-theme":new oN({type:"string",default:"default","property-type":"data-driven"})}))},r,a,n),this.layer=i,this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}mayUse(i){return"Standard"===i}prepare(){return gQ()}createBucket(i){return new m6(i)}getProgramIds(){return["model"]}is3D(i){return!0}hasShadowPass(){return this.paint.get("model-cast-shadows")}canCastShadows(){return!0}hasLightBeamPass(){return!0}cutoffRange(){return this.paint.get("model-cutoff-fade-range")}queryRadius(i){return 8191*!!i.isTiled3dModelBucket}
108queryRenderedFeatures(i,r,a){return gX.queryModelLayerRendered?gX.queryModelLayerRendered(this,i,r,a):{}}queryIntersectsFeature(i,r,a,n,o,s,l,h,u,c){return!!gX.queryModelLayerIntersectsFeature&&gX.queryModelLayerIntersectsFeature(this,i,r,a,s,c)}_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 nU}isZoomDependent(){return this._isPropertyZoomDependent("model-scale")||this._isPropertyZoomDependent("model-rotation")||this._isPropertyZoomDependent("model-translation")}},clip:class extends o7{constructor(i,r,a,n){super(i,{layout:w||(w=new oU({"clip-layer-types":new ok(oj.layout_clip["clip-layer-types"]),"clip-layer-scope":new ok(oj.layout_clip["clip-layer-scope"]),visibility:new ok(oj.layout_clip.visibility)})),paint:T||(T=new oU({}))},r,a,n)}recalculate(i,r){super.recalculate(i,r)}createBucket(i){return new mF(i)}is3D(i){return!0}}};class g1{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)}}nH(g1,"LRUCache");class g2{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&&(this._channel.port1.close(),this._channel.port2.close()),this._callback=()=>{}}}let g3={Other:0,Symbol:1,FillExtrusion:2,HdRoadCoverage:3};class g5{constructor(){this.tasks=new Map,tC(["process"],this),this.invoker=new g2(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===g3.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.set(a,{fn:i,metadata:r,priority:n,id:a}),this.invoker.trigger(),{cancel:()=>{this.tasks.delete(a)}})}process(){{let i=this.pick();if(!i)return;this.tasks.delete(i.id),this.tasks.size>0&&this.invoker.trigger(),i.fn()}}pick(){let i=null,r=1/0;for(let a of this.tasks.values())a.priority<r&&(r=a.priority,i=a);return i}remove(){this.tasks.clear(),this.invoker.remove()}}let g4={type:"message"},g6=new Map,g8=new Map;class g9{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 g7(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 ye(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,R=(d[0]*M+d[1]*C+d[2]*P)*T;return R<0||A+R>1?null:(_*M+g*C+y*P)*T}function yt(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 yi{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=i.dim,a=[],n=Math.ceil(Math.pow(2,Math.ceil(Math.log2(r/8)))),o=(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},s=new g9(n),l=1/n,{floatView:h,stride:u}=i,c=[];for(let a=0;a<n*n;a++){let d=Math.floor(a/n),p=a%n;o(p,d,l,!1,c);let f=ya(c[0],c[1],i),m=ya(c[2],c[1],i),_=Math.min(f,m,ya(c[2],c[3],i),ya(c[0],c[3],i)),g=Math.max(0,8*p-1),y=Math.min(r-1,8*(p+1)),x=Math.max(0,8*d-1),v=Math.min(r-1,8*(d+1)),b=-1/0;for(let i=x;i<=v;i++){let r=(i+1)*u;for(let i=g;i<=y;i++){let a=h[r+i+1];a>b&&(b=a)}}s.minimums.push(_),s.maximums.push(b),s.leaves.push(1)}for(a.push(s),n/=2;n>=1;n/=2){let i=a.at(-1);s=new g9(n);for(let r=0;r<n*n;r++){o(r%n,Math.floor(r/n),2,!0,c);let a=i.getElevation(c[0],c[1]),l=i.getElevation(c[2],c[1]),h=i.getElevation(c[2],c[3]),u=i.getElevation(c[0],c[3]),d=i.isLeaf(c[0],c[1]),p=i.isLeaf(c[2],c[1]),f=i.isLeaf(c[2],c[3]),m=i.isLeaf(c[0],c[3]),_=Math.min(a.min,l.min,h.min,u.min),g=Math.max(a.max,l.max,h.max,u.max),y=d&&p&&f&&m;s.maximums.push(g),s.minimums.push(_),s.leaves.push(g-_<=5&&y?1:0)}a.push(s)}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)}raycastRoot(i,r,a,n,o,s,l=1){return g7([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:m,nodex:_,nodey:g,depth:y}=f.pop();if(this.leaves[h]){yt(_,g,y,i,r,a,n,d,p);let h=1<<y,u=_/h,c=(_+1)/h,f=g/h,x=(g+1)/h,{dim:v,floatView:b,stride:w}=this.dem,T=Math.floor(u*v),S=Math.ceil(c*v),E=Math.floor(f*v),I=S-T,A=Math.ceil(x*v)-E;if(I<=0||A<=0)continue;let M=d[0],C=d[1],P=(p[0]-M)/I,R=(p[1]-C)/A,D=Math.max(0,m),L=o[0]+s[0]*D,z=o[1]+s[1]*D,F=Math.abs(s[0])>1e-10,O=Math.abs(s[1])>1e-10,B=s[0]>=0?1:-1,k=s[1]>=0?1:-1,N=Math.max(0,Math.min(I-1,Math.floor((L-M)/P))),V=Math.max(0,Math.min(A-1,Math.floor((z-C)/R))),U=F?Math.abs(P/s[0]):Number.MAX_VALUE,j=O?Math.abs(R/s[1]):Number.MAX_VALUE,G=F?D+(M+(s[0]>=0?N+1:N)*P-L)/s[0]:Number.MAX_VALUE,Z=O?D+(C+(s[1]>=0?V+1:V)*R-z)/s[1]:Number.MAX_VALUE,$=(i,r)=>b[(r+1)*w+i+1]*l,H=$(T+N,E+V),q=$(T+N+1,E+V),W=$(T+N,E+V+1),X=$(T+N+1,E+V+1),Y=null;for(let i=0;i<I+A;i++){let i=Math.min(G,Z);if(s[2]>=0||o[2]+s[2]*i<=Math.max(H,q,W,X)){let i=M+N*P,r=i+P,a=C+V*R,n=a+R,l=ye(r,a,q,
108i,a,H,i,n,W,o,s),h=ye(i,n,W,r,n,X,r,a,q,o,s);null!=l&&l>=0&&(null===Y||l<Y)&&(Y=l),null!=h&&h>=0&&(null===Y||h<Y)&&(Y=h)}let r=G<Z;if(r?(N+=B,G+=U):(V+=k,Z+=j),N<0||N>=I||V<0||V>=A||null!==Y&&i>Y)break;r?B>0?(H=q,W=X,q=$(T+N+1,E+V),X=$(T+N+1,E+V+1)):(q=H,X=W,H=$(T+N,E+V),W=$(T+N,E+V+1)):k>0?(H=W,q=X,W=$(T+N,E+V+1),X=$(T+N+1,E+V+1)):(W=H,X=q,H=$(T+N,E+V),q=$(T+N+1,E+V))}if(null!==Y)return Y||0;let K=eP([],o,s,m),J=(K[0]-d[0])/(p[0]-d[0]),Q=(K[1]-d[1])/(p[1]-d[1]),ee=ya(u,f,this.dem)*l,et=ya(c,f,this.dem)*l,ei=ya(c,x,this.dem)*l;if(yr(ee,et,ya(u,x,this.dem)*l,ei,J,Q)>=K[2])return m;continue}let x=0;for(let f=0;f<this._siblingOffset.length;f++){yt((_<<1)+this._siblingOffset[f][0],(g<<1)+this._siblingOffset[f][1],y+1,i,r,a,n,d,p),d[2]=-100,p[2]=this.maximums[this.childOffsets[h]+f]*l;let m=g7(d,p,o,s);if(null!=m){u[f]=m;let i=!1;for(let r=0;r<x&&!i;r++)m>=u[c[r]]&&(c.splice(r,0,f),i=!0);i||(c[x]=f),x++}}for(let i=0;i<x;i++){let r=c[i];f.push({idx:this.childOffsets[h]+r,t:u[r],nodex:(_<<1)+this._siblingOffset[r][0],nodey:(g<<1)+this._siblingOffset[r][1],depth:y+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 yr(i,r,a,n,o,s){return i9(i9(i,a,s),i9(r,n,s),o)}function ya(i,r,a){let n=a.dim,o=tv(i*n-.5,0,n-1),s=tv(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 yr(a.get(l,h),a.get(u,h),a.get(l,c),a.get(u,c),o-l,s-h)}let yn={mapbox:[6553.6,25.6,.1,1e4],terrarium:[256,1,1/256,32768]};function yo(i,r,a){return(256*i*256+256*r+a)/10-1e4}function ys(i,r,a){return 256*i+r+a/256-32768}class yl{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 tF(`"${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?ys:yo;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 yi(this)}get(i,r,a=!1){a&&(i=tv(i,-1,this.dim),r=tv(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 yn[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=yl.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 hk({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)}}nH(yl,"DEMData"),nH(yi,"DemMinMaxQuadTree",{omit:["dem"]});var yh=Uint8Array,yu=Uint16Array,yc=Int32Array,yd=new yh([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]),yp=new yh([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]),yf=new yh([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),ym=function(i,r){for(var a=new yu(31),n=0;n<31;++n)a[n]=r+=1<<i[n-1];var o=new yc(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}},y_=ym(yd,2),yg=y_.b,yy=y_.r;yg[28]=258,yy[258]=28;for(var yx=ym(yp,0).b,yv=new yu(32768),yb=0;yb<32768;++yb){var yw=(43690&yb)>>1|(21845&yb)<<1;yv[yb]=((65280&(yw=(61680&(yw=(52428&yw)>>2|(13107&yw)<<2))>>4|(3855&yw)<<4))>>
1088|(255&yw)<<8)>>1}var yT=function(i,r,a){for(var n=i.length,o=0,s=new yu(r);o<n;++o)i[o]&&++s[i[o]-1];var l,h=new yu(r);for(o=1;o<r;++o)h[o]=h[o-1]+s[o-1]<<1;l=new yu(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[yv[p]>>u]=c;return l},yS=new yh(288);for(yb=0;yb<144;++yb)yS[yb]=8;for(yb=144;yb<256;++yb)yS[yb]=9;for(yb=256;yb<280;++yb)yS[yb]=7;for(yb=280;yb<288;++yb)yS[yb]=8;var yE=new yh(32);for(yb=0;yb<32;++yb)yE[yb]=5;var yI=yT(yS,9),yA=yT(yE,5),yM=function(i){for(var r=i[0],a=1;a<i.length;++a)i[a]>r&&(r=i[a]);return r},yC=function(i,r,a){var n=r/8|0;return(i[n]|i[n+1]<<8)>>(7&r)&a},yP=function(i,r){var a=r/8|0;return(i[a]|i[a+1]<<8|i[a+2]<<16)>>(7&r)},yR=["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"],yD=function(i,r,a){var n=Error(r||yR[i]);if(n.code=i,Error.captureStackTrace&&Error.captureStackTrace(n,yD),!a)throw n;return n},yL=new yh(0),yz="undefined"!=typeof TextDecoder&&new TextDecoder;try{yz.decode(yL,{stream:!0})}catch(i){}let yF={gzip_data:"gzip"};class yO extends Error{constructor(i){super(i),this.name="MRTError"}}let yB={0:"uint32",1:"uint32",2:"uint16",3:"uint8"},yk={uint32:1,uint16:2,uint8:4},yN={uint32:Uint32Array,uint16:Uint16Array,uint8:Uint8Array};class yV{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 yO(`Layer '${i}' not found`);return r}getHeaderLength(i){let r=new Uint8Array(i),a=new DataView(i);if(13!==r[0])throw new yO("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 yO(`Expected header with length >= ${a} but got buffer of length ${r.length}`);let n=function(i){let r,a={headerLength:0,x:0,y:0,z:0,layers:[]};for(;r=i.nextField(void 0);)1===r?a.headerLength=i.readFixed32():2===r?a.x=i.readVarint():3===r?a.y=i.readVarint():4===r?a.z=i.readVarint():5===r&&a.layers.push(function(i,r){let a,n={version:0,name:"",units:"",tileSize:0,buffer:0,pixelFormat:0,dataIndex:[]};for(;a=i.nextField(r);)1===a?n.version=i.readVarint():2===a?n.name=i.readString():3===a?n.units=i.readString():4===a?n.tileSize=i.readVarint():5===a?n.buffer=i.readVarint():6===a?n.pixelFormat=i.readVarint():7===a&&n.dataIndex.push(function(i,r){let a={firstByte:0,lastByte:0,filters:[],codec:null,offset:0,scale:0,bands:[]},n,o=0,s=0;for(;n=i.nextField(r);)1===n?a.firstByte=i.readFixed64():2===n?a.lastByte=i.readFixed64():3===n?a.filters.push(function(i,r){let a,n={};for(;a=i.nextField(r);)1===a?(n.delta_filter=function(i,r){let a,n={blockSize:0};for(;a=i.nextField(r);)1===a&&(n.blockSize=i.readVarint());return n}(i,i.readVarint()+i.pos),n.filter="delta_filter"):2===a?(i.readVarint(),n.filter="zigzag_filter"):3===a?(i.readVarint(),n.filter="bitshuffle_filter"):4===a&&(i.readVarint(),n.filter="byteshuffle_filter");return n}(i,i.readVarint()+i.pos)):4===n?a.codec=function(i,r){let a,n={};for(;a=i.nextField(r);)1===a?(i.readVarint(),n.codec="gzip_data"):2===a?(i.readVarint(),n.codec="jpeg_image"):3===a?(i.readVarint(),n.codec="webp_image"):4===a&&(i.readVarint(),n.codec="png_image");return n}(i,i.readVarint()+i.pos):5===n?s=i.readFloat():6===n?o=i.readFloat():7===n?a.bands.push(i.readString()):8===n?a.offset=i.readDouble():9===n&&(a.scale=i.readDouble());return 0===a.offset&&(a.offset=s),0===a.scale&&(a.scale=o),a}(i,i.readVarint()+i.pos));return n}(i,i.readVarint()+i.pos));return a}(new q(r.subarray(0,a)));if(!isNaN(this.x)&&(this.x!==n.x||this.y!==n.y||this.z!==n.z))throw new yO(`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 yU(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 yj(r,()=>{r.forEach(i=>
108a._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 yU{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 yO(`Cannot parse raster layer encoded with MRT version ${i}`);this.name=r,this.units=a,this.tileSize=n,this.buffer=s,this.pixelFormat=yB[o],this.dataIndex=l,this.bandShape=[n+2*s,n+2*s,yk[this.pixelFormat]],this._decodedBlocks=new g1(h?h.cacheSize:5),this._blocksInProgress=new Set}get dimension(){return yk[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 yO(`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 yO(`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 yO(`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 yO(`Band not found: ${JSON.stringify(i)}`);let n=this._decodedBlocks.get(r.toString());if(!n)throw new yO(`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}}}yV.setPbf=function(i){q=i};class yj{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)}}yV.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 yO(`Unhandled codec: ${c}`);return(function(i,r){var a,n,o;if(!globalThis.DecompressionStream&&"gzip_data"===r)return Promise.resolve(((o=function(i){31==i[0]&&139==i[1]&&8==i[2]||yD(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&&yD(6,"invalid gzip data"),function(i,r,a,n){var o,s,l=i.length;if(!l||r.f&&!r.l)return a||new yh(0);var h=!a,u=h||2!=r.i,c=r.i;h&&(a=new yh(3*l));var d=function(i){var r=a.length;if(i>r){var n=new yh(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=yC(i,f,1);var b=yC(i,f+1,3);if(f+=3,!b){var w=i[(L=((f+7)/8|0)+4)-4]|i[L-3]<<8,T=L+w;if(T>l){c&&yD(0);break}u&&d(m+w),a.set(i.subarray(L,T),m),r.b=m+=w,r.p=f=8*T,r.f=p;continue}if(1==b)_=yI,g=yA,y=9,x=5;else if(2==b){var S=yC(i,f,31)+257,E=yC(i,f+10,15)+4,I=S+yC(i,f+5,31)+1;f+=14;for(var A=new yh(I),M=new yh(19),C=0;C<E;++C)M[yf[C]]=yC(i,f+3*C,7);f+=3*E;var P=yM(M),R=(1<<P)-1,D=yT(M,P);for(C=0;C<I;){var L,z=D[yC(i,f,R)];if(f+=15&z,(L=z>>4)<16)A[C++]=L;else{var F=0,O=0;for(16==L?(O=3+yC(i,f,3),f+=2,F=A[C-1]):17==L?(O=3+yC(i,f,7),f+=3):18==L&&(O=11+yC(i,f,127),f+=7);O--;)A[C++]=F}}var B=A.subarray(0,S),k=A.subarray(S);y=yM(B),x=yM(k),_=yT(B,y),g=yT(k,x)}else yD(1);if(f>v){c&&yD(0);break}}u&&d(m+131072);for(var N=(1<<y)-1,V=(1<<x)-1,U=f;;U=f){var j=(F=_[yP(i,f)&N])>>4;if((f+=15&F)>v){c&&yD(0);break}if(F||yD(2),j<256)a[m++]=j;else{if(256==j){U=f,_=null;break}var G=j-254;j>264&&(G=yC(i,f,(1<<(H=yd[C=j-257]))-1)+yg[C],f+=H);var Z=g[yP(i,f)&V],$=Z>>4;if(Z||yD(3),f+=15&Z,k=yx[$],$>3){var H=yp[$];k+=yP(i,f)&(1<<H)-1,f+=H}if(f>v){c&&yD(0);break}u&&d(m+131072);var q=m+G;if(m<k){var W=0-k,X=Math.min(k,q);for(W+m<0&&yD(3);m<X;++m)a[m]=n[W+m]}for(;m<q;++m)a[m]=a[m-k]}}r.l=_,r.p=U,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 yh(o.subarray(0,s))):a.subarray(0,m)}(i.subarray(o,-8),{i:2},new yh((i[(n=i.length)-4]|i[n-3]<<8|i[n-2]<<16|i[n-1]<<24)>>>0),a)));let s=yF[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=>
108new Uint8Array(i))})(d,c).then(i=>((function(i,r){let a;for(;a=i.nextField();)if(2===a)!function(i,r,a){let n;for(;n=i.nextField(r);)if(1===n){let r=0,n=i.readVarint()+i.pos;for(;i.pos<n;)a[r++]=i.readVarint()}}(i,i.readVarint()+i.pos,r);else if(3===a)throw Error("Not implemented")})(new q(i),p),new(0,yN[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 yO(`Unhandled filter "${u[r]}"`)}return{layerName:r,blockIndex:h,data:i}}).catch(i=>{throw i})}))},nH(yj,"MRTDecodingBatch",{omit:["_onCancel","_onComplete"]}),nH(yV,"MapboxRasterTile"),nH(yU,"MapboxRasterLayer",{omit:["_blocksInProgress"]});let yG=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],yZ=new Uint32Array(96);class y${static from(i){if(!i||void 0===i.byteLength||i.buffer)throw Error("Data must be an instance of ArrayBuffer or SharedArrayBuffer.");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=yG[15&a];if(!o)throw Error("Unrecognized array type.");let[s]=new Uint16Array(i,2,1),[l]=new Uint32Array(i,4,1);return new y$(l,s,o,void 0,i)}constructor(i,r=64,a=Float64Array,n=ArrayBuffer,o){if(isNaN(i)||i<0)throw Error(`Unexpected 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 s=yG.indexOf(this.ArrayType),l=2*i*this.ArrayType.BYTES_PER_ELEMENT,h=i*this.IndexArrayType.BYTES_PER_ELEMENT,u=(8-h%8)%8;if(s<0)throw Error(`Unexpected typed array class: ${a}.`);if(o)this.data=o,this.ids=new this.IndexArrayType(o,8,i),this.coords=new a(o,8+h+u,2*i),this._pos=2*i,this._finished=!0;else{let o=this.data=new n(8+l+h+u);this.ids=new this.IndexArrayType(o,8,i),this.coords=new a(o,8+h+u,2*i),this._pos=0,this._finished=!1,new Uint8Array(o,0,2).set([219,16+s]),new Uint16Array(o,2,1)[0]=r,new Uint32Array(o,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(yH(r,a,o,n),a[2*s+l]>h&&yH(r,a,o,s);u<c;){for(yH(r,a,u,c),u++,c--;a[2*u+l]<h;)u++;for(;a[2*c+l]>h;)c--}a[2*o+l]===h?yH(r,a,o,c):yH(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;yZ[0]=0,yZ[1]=o.length-1,yZ[2]=0;let h=3,u=[];for(;h>0;){let c=yZ[--h],d=yZ[--h],p=yZ[--h];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<=_)&&(yZ[h++]=p,yZ[h++]=f-1,yZ[h++]=1-c),(0===c?a>=m:n>=_)&&(yZ[h++]=f+1,yZ[h++]=d,yZ[h++]=1-c)}return u}within(i,r,a){let n=[];return this.withinInto(i,r,a,n),n}withinInto(i,r,a,n){if(!this._finished)throw Error("Data not yet indexed - call index.finish().");let{ids:o,coords:s,nodeSize:l}=this;yZ[0]=0,yZ[1]=o.length-1,yZ[2]=0;let h=3,u=0,c=a*a;for(;h>0;){let d=yZ[--h],p=yZ[--h],f=yZ[--h];if(p-f<=l){for(let a=f;a<=p;a++)yW(s[2*a],s[2*a+1],i,r)<=c&&(n[u++]=o[a]);continue}let m=f+p>>1,_=s[2*m],g=s[2*m+1];yW(_,g,i,r)<=c&&(n[u++]=o[m]),(0===d?i-a<=_:r-a<=g)&&(yZ[h++]=f,yZ[h++]=m-1,yZ[h++]=1-d),(0===d?i+a>=_:r+a>=g)&&(yZ[h++]=m+1,yZ[h++]=p,yZ[h++]=1-d)}return u}}function yH(i,r,a,n){yq(i,a,n),yq(r,2*a,2*n),yq(r,2*a+1,2*n+1)}function yq(i,r,a){let n=i[r];i[r]=i[a],i[a]=n}function yW(i,r,a,n){let o=i-a,s=r-n;return o*o+s*s}r.$=_g,r.A=aa,r.B=ao,r.C=re,r.D=ar,r.E=i3,r.F=rW,r.G=rG,r.H=rU,r.I=i5,r.J=o$,r.K=/^(.*)-transition$/,r.L=g1,r.M=nP,r.N=nA,r.O=ta,r.P=tr,r.Q=et,r.R=il,r.S=u3,r.T=de,r.U=/^(.*)-use-theme$/,r.V=function(i,r){let a=u3(r.zoom);if(0===a)return uG(i);let n=uq(i),o=uW(n),s=rK(n.getWest())*r.worldSize,l=rK(n.getEast())*r.worldSize,h=rJ(n.getNorth())*r.worldSize,u=rJ(n.getSouth())*r.worldSize,c=[s,h,0],d=[l,h,0],p=[s,u,0],f=[l,u,0],m=en([],r.globeMatrix);return eN(c,c,m),eN(d,d,m),eN(p,p,m),eN(f,f,m),o[0]=uZ(o[0],p,a),o[1]=uZ(o[1],f,a),o[2]=uZ(o[2],d,a),o[3]=uZ(o[3],c,a),uB.fromPoints(o)},r.W=uQ,r.X=eo,r.Y=ee,r.Z=__,r._=_f,r.a=async function(i,r){i.headers||(i.headers={}),i.headers.accept="image/webp,*/*";let a=await new Promise((i,a)=>
108{if(r&&r.aborted)return void a(r.reason);let n=()=>{let i=d.shift();i?i():p--};if(p<tQ.MAX_PARALLEL_IMAGE_REQUESTS)return p++,void i(n);let o=()=>{r&&r.removeEventListener("abort",s),i(n)},s=()=>{let i=d.indexOf(o);-1!==i&&d.splice(i,1),a(r.reason)};r&&r.addEventListener("abort",s),d.push(o)});try{let a,{data:n,headers:o}=await iy(i,r);try{a=await createImageBitmap(new Blob([new Uint8Array(n)],{type:"image/png"}))}catch(i){throw 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.`,{cause:i})}return r&&r.throwIfAborted(),{data:a,headers:o}}finally{a()}},r.a$=sZ,r.a0=_N,r.a1=_m,r.a2=lq,r.a3=lH,r.a4=lJ,r.a5=lW,r.a6=8192,r.a7=rK,r.a8=rJ,r.a9=function(i,r,a){if(r.projection.name===a.projection.name)return i.projMatrix;let n=a.clone();return n.setProjection(r.projection),cU(n,r.getProjection(),i)},r.aA=uO,r.aB=sD,r.aC=ca,r.aD=me,r.aE=mh,r.aF=_B,r.aG=gO,r.aH=rM,r.aI=(i,r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v=!1)=>{let b=gD(i,r,a,n,o,s,l,h,c,d,p,f,m,_,g,y,1,[0,0,0],[0,0,1],v),w={u_height_factor:-Math.pow(2,h.overscaledZ)/u.tileSize/8};return Object.assign(b,gM(r,u,x),w)},r.aJ=gD,r.aK=0x80000000,r.aL=450,r.aM=7,r.aN=(i,r,a,n,o,s)=>({u_matrix:i,u_edge_radius:r,u_width_scale:a,u_vertical_scale:n,u_height_type:gC[o],u_base_type:gC[s]}),r.aO=el,r.aP=en,r.aQ=ea,r.aR=gz,r.aS=4,r.aT=2,r.aU=hm,r.aV=h_,r.aW=tC,r.aX=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.aY=l$,r.aZ=lY,r.a_=class extends lZ{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.aa=eo,r.ab=li,r.ac=h8,r.ad=lO,r.ae=la,r.af=oD,r.ag=oU,r.ah=ok,r.ai=class{constructor(i){this.specification=i}possiblyEvaluate(i,r){return tB(i.expression.evaluate(r))}interpolate(i,r,a){return{x:i9(i.x,r.x,a),y:i9(i.y,r.y,a),z:i9(i.z,r.z,a),azimuthal:i9(i.azimuthal,r.azimuthal,a),polar:i9(i.polar,r.polar,a)}}},r.aj=oC,r.ak=nU,r.al=oB,r.am=i9,r.an=tb,r.ao=65,r.ap=45,r.aq=function(i,r,a){let n=sF.fromLngLat(r),o=a.elevation?a.elevation.getAtPointOrZero(n):0;return cV(i,n.x,n.y,o,a)},r.ar=function(i,r,a,n,o,s,l){let h=Number.MAX_VALUE,u=-Number.MAX_VALUE;for(let i of[[a,n,0],[o,n,0],[o,s,0],[a,s,0]]){let a=eb(eN([],i,r));h=Math.min(h,a),u=Math.max(u,a)}return[ck(i,h,l.pitch),ck(i,u,l.pitch)]},r.as=ra,r.at=cV,r.au=.05,r.av=function(i){return i*tf},r.aw=function(){return tE++},r.ax=class{constructor(i,r,a){this.target=i,this.parent=r,this.mapId=a,this.pendingResponses=new Map,tC(["receive"],this),this.target.addEventListener("message",this.receive,!1),this.scheduler=new g5}send(i,r,a){let{signal:n,targetMapId:o,metadata:s}=a||{},l=Math.round(1e18*Math.random()).toString(36).substring(0,10),h=new Set;return n&&n.aborted?Promise.reject(n.reason):(this.target.postMessage({id:l,type:i,targetMapId:o,sourceMapId:this.mapId,data:nY(r,h)},[...h]),new Promise((i,r)=>{let a={resolve:i,reject:r,metadata:s||g4};if(n){let i=()=>{this.pendingResponses.delete(l),r(n.reason)};n.addEventListener("abort",i,{once:!0}),a.detach=()=>n.removeEventListener("abort",i)}this.pendingResponses.set(l,a)}))}notify(i,r,a){let{targetMapId:n}=a||{},o=new Set;this.target.postMessage({type:i,targetMapId:n,sourceMapId:this.mapId,data:nY(r,o)},[...o])}sendCancelable(i,r,a,n){let o=new AbortController;return this.send(i,r,{...a,signal:o.signal}).then(i=>n(null,i)).catch(i=>{"AbortError"!==i.name&&n(i)}),o}getWorkerSourceActor(i){return{scheduler:this.scheduler,send:(r,a,n)=>this.send(r,a,{...n,targetMapId:i}),notify:(r,a)=>{this.notify(r,a,{targetMapId:i})},sendCancelable:(r,a,n,o)=>this.sendCancelable(r,a,{...n,targetMapId:i},o)}}receive(i){let r=i.data;if(!r)return;
108let a=r.id;if(!r.targetMapId||this.mapId===r.targetMapId)if(tN(self)){let i=this.pendingResponses.get(a);this.scheduler.add(()=>{this.processTask(a,r)},i&&i.metadata||g4)}else this.processTask(a,r)}async processTask(i,r){if("<response>"===r.type){let a=this.pendingResponses.get(i);if(this.pendingResponses.delete(i),a){a.detach&&a.detach();try{r.error?a.reject(nK(r.error)):a.resolve(nK(r.data))}catch(i){a.reject(i)}}return}let a=new Set,n=nK(r.data);try{let o;if(this.parent[r.type])o=await this.parent[r.type](r.sourceMapId,n);else{if(!this.parent.getWorkerSource)throw Error(`Could not find function ${r.type}`);{let i=r.type.split("."),{source:a,scope:s}=n,l=this.parent.getWorkerSource(r.sourceMapId,{type:i[0],source:a,scope:s});o=await l[i[1]](n)}}if(!i)return;this.target.postMessage({id:i,type:"<response>",sourceMapId:this.mapId,error:null,data:nY(o,a)},[...a])}catch(r){this.target.postMessage({id:i,type:"<response>",sourceMapId:this.mapId,error:nY(r),data:null},[])}}remove(){for(let i of this.pendingResponses.values())i.detach&&i.detach(),i.reject(new DOMException("Actor removed","AbortError"));this.pendingResponses.clear(),this.scheduler.remove(),this.target.removeEventListener("message",this.receive,!1)}},r.ay=class{constructor(i){this.specification=i}possiblyEvaluate(i,r){return function([i,r]){let a=tB([1,i,r]);return{x:a.x,y:a.y,z:a.z}}(i.expression.evaluate(r))}interpolate(i,r,a){return{x:i9(i.x,r.x,a),y:i9(i.y,r.y,a),z:i9(i.z,r.z,a)}}},r.az=gX,r.b=hB,r.b$=ty,r.b0=lg,r.b1=tv,r.b2=6,r.b3=uq,r.b4=function(i){return Math.round(Math.pow(Math.abs(Math.sin((i=tv(i,-80.051129,80.051129)/80.051129*90)*tf)),3)*(sw.length-1))},r.b5=uJ,r.b6=uG,r.b7=function(i){let r=i.pixelsPerMeter,a=r/(1/sC(i.center.lat)),n=er(new Float64Array(16));return es(n,n,[i.point.x,i.point.y,0]),el(n,n,[a,a,r]),Float32Array.from(n)},r.b8=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/sw[a],m=[0,p,0,f,0,0,o,l,0];if(i.z>0){let i=180/n;J(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.b9=tY,r.bA=h$,r.bB=ha,r.bC=sk,r.bD=sH,r.bE=lf,r.bF=uA,r.bG=st,r.bH=uX,r.bI=eN,r.bJ=uZ,r.bK=sq,r.bL=uI,r.bM=ep,r.bN=es,r.bO=function(){oM.isLoading()||oM.isLoaded()||"deferred"!==oI()||oA()},r.bP=iu,r.bQ=ci,r.bR=function(i,r){let a=[];for(let n in i)n in r||a.push(n);return a},r.bS=g3,r.bT=sF,r.bU=tT,r.bV="hd_road_coverage",r.bW=ce,r.bX=ct,r.bY=lK,r.bZ=ey,r.b_=tk,r.ba=256,r.bb=gf,r.bc=gE,r.bd=ld,r.be=eY,r.bf=eK,r.bg=eQ,r.bh=e_,r.bi=ew,r.bj=nf,r.bk=6371008.8,r.bl=lc,r.bm=lu,r.bn=sP,r.bo=15,r.bp=tX,r.bq=cn,r.br=rQ,r.bs=r0,r.bt=sW,r.bu=lv,r.bv=dz,r.bw=oH,r.bx=sN,r.by=_l,r.bz=tV,r.c=nN,r.c$=c$,r.c0=function(i,r,a){let n=u3(a.zoom),o=i.style.map._antialias,s=i.terrain&&i.terrain.exaggeration()>0;return 0===n&&!o&&!s},r.c1=function(i,r,a){let n=er(new Float64Array(16)),o=(r/(1<<i)-.5)*Math.PI*2;return eu(n,a.globeMatrix,o),Float32Array.from(n)},r.c2=cO,r.c3=hk,r.c4=function(i,r){return i/sC(r)},r.c5=uk,r.c6=eW,r.c7=eH,r.c8=eE,r.c9=eF,r.cA=sO,r.cB=tS,r.cC=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.cD=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=tQ.TILE_PROVIDER_URLS[a];if(!n)return null;try{r=new URL(n,tQ.API_URL).href}catch(i){return Error(`TileProvider "${a}" has an invalid URL: "${n}"`)}return{name:a,url:r}},r.cE=gH,r.cF=gW,r.cG=ir,r.cH=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=new AbortController;return iy(i.request,n.signal).then(({data:i,headers:n})=>{r(null,{rawData:i,vectorTile:a?void 0:new hf(new c$(i)),headers:n})}).catch(i=>{n.signal.aborted||(iu(i)?r(null,null):r(i))}),()=>{n.abort(),r(null,null)}},r)},r.cI=tU,r.cJ=function(i){++it>t8&&(i.getActor().notify("enforceCacheSizeLimit",t6),it=0)},r.cK=ik,r.cL=async function(i,r,a){let n=i.url&&!i.tiles?await r.transformRequest(i.url,il.Source,a):void 0;return{request:n,options:n?{...i,url:n.url}:i}},r.cM=function(i,r,a){return r?g$(i,r,a):i.tiles&&i.tiles.length>0?{tiles:i.tiles}:Error('TileJSON is missing required "tiles" property')},r.cN=async function(i,r){let a=g8.get(i);if(a)return a;let n=g6.get(i);if(void 0!==n)return n;let o=self.__mapboxImport(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 g8.set(i,a),a}).finally(()=>{g6.delete(i)});return g6.set(i,o),o},r.cO=class{constructor(i,r){this.context=i,this.texture=r}
108bind(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)}},r.cP=85.051129,r.cQ=function(i,r,a,n){for(;r<a;){let o=r+a>>1;i[o]<=n?r=o+1:a=o}return r},r.cR=function(i,r,a,n){for(;r<a;){let o=r+a>>1;i[o]<n?r=o+1:a=o}return r},r.cS=64,r.cT=eV,r.cU=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];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},r.cV=J,r.cW=async function(i){let r=document.createElement("video");for(let a of(r.muted=!0,i)){let i=document.createElement("source");(function(i){let r=document.createElement("a");return r.href=i,r.protocol===location.protocol&&r.host===location.host})(a)||(r.crossOrigin="Anonymous"),i.src=a,r.appendChild(i)}return await new Promise((a,n)=>{r.onloadstart=()=>a(),r.onerror=()=>n(Error(`Could not load video: ${i.join(", ")}`))}),r},r.cX=m0,r.cY=m1,r.cZ=sA,r.c_=yV,r.ca=eP,r.cb=gM,r.cc=u1,r.cd=mU,r.ce=1024,r.cf=tH,r.cg=tq,r.ch=function(i,r){let a=[0,0,0];return eN(a,a,uJ(uG(r.canonical))),eN(a,a,i),a},r.ci=_h,r.cj=function(i,r,a,n,o,s){let{width:l,height:h}=n.imageManager.getPixelSize(r),u=Math.pow(2,s.tileID.overscaledZ),c=s.tileSize*Math.pow(2,n.transform.tileZoom)/u,d=c*(s.tileID.canonical.x+s.tileID.wrap*u),p=c*s.tileID.canonical.y;return{u_image:0,u_pattern_tl:a.tl,u_pattern_br:a.br,u_texsize:[l,h],u_pattern_size:a.displaySize,u_pattern_units_to_pixels:o?[n.transform.width,-1*n.transform.height]:[1/mU(s,1,n.transform.tileZoom),1/mU(s,1,n.transform.tileZoom)],u_pixel_coord_upper:[d>>16,p>>16],u_pixel_coord_lower:[65535&d,65535&p]}},r.ck=i=>({u_matrix:new lJ(i),u_texsize:new lq(i),u_pixels_to_tile_units:new lQ(i),u_device_pixel_ratio:new lH(i),u_width_scale:new lH(i),u_floor_width_scale:new lH(i),u_image:new l$(i),u_units_to_pixels:new lq(i),u_tile_units_to_pixels:new lH(i),u_alpha_discard_threshold:new lH(i),u_trim_offset:new lq(i),u_trim_fade_range:new lq(i),u_trim_gradient_mix_range:new lq(i),u_trim_color:new lY(i),u_zbias_factor:new lH(i),u_tile_to_meter:new lH(i),u_ground_shadow_factor:new lW(i),u_pattern_transition:new lH(i),u_opacity_multiplier:new lH(i)}),r.cl=i=>({u_matrix:new lJ(i),u_pixels_to_tile_units:new lQ(i),u_device_pixel_ratio:new lH(i),u_width_scale:new lH(i),u_floor_width_scale:new lH(i),u_units_to_pixels:new lq(i),u_dash_image:new l$(i),u_gradient_image:new l$(i),u_border_gradient_image:new l$(i),u_image_height:new lH(i),u_texsize:new lq(i),u_tile_units_to_pixels:new lH(i),u_alpha_discard_threshold:new lH(i),u_trim_offset:new lq(i),u_trim_fade_range:new lq(i),u_trim_gradient_mix_range:new lq(i),u_trim_color:new lY(i),u_zbias_factor:new lH(i),u_road_view_depth_bias:new lH(i),u_road_clip_to_view:new lY(i),u_tile_to_meter:new lH(i),u_ground_shadow_factor:new lW(i),u_opacity_multiplier:new lH(i)}),r.cm=i=>({u_color:new lK(i),u_matrix:new lJ(i),u_overlay:new l$(i),u_overlay_scale:new lH(i)}),r.cn=i=>({u_camera_to_center_distance:new lH(i),u_extrude_scale:new lQ(i),u_device_pixel_ratio:new lH(i),u_matrix:new lJ(i),u_inv_rot_matrix:new lJ(i),u_merc_center:new lq(i),u_tile_id:new lW(i),u_zoom_transition:new lH(i),u_up_dir:new lW(i),u_emissive_strength:new lH(i)}),r.co=i=>({u_matrix:new lJ(i),u_lightpos:new lW(i),u_lightintensity:new lH(i),u_lightcolor:new lW(i),u_vertical_gradient:new lH(i),u_height_factor:new lH(i),u_edge_radius:new lH(i),u_width_scale:new lH(i),u_ao:new lq(i),u_height_type:new l$(i),u_base_type:new l$(i),u_tile_id:new lW(i),u_zoom_transition:new lH(i),u_inv_rot_matrix:new lJ(i),u_merc_center:new lq(i),u_up_dir:new lW(i),u_height_lift:new lH(i),u_image:new l$(i),u_texsize:new lq(i),u_pixel_coord_upper:new lq(i),u_pixel_coord_lower:new lq(i),u_tile_units_to_pixels:new lH(i),u_opacity:new lH(i),u_pattern_transition:new lH(i)}),r.cp=i=>({u_matrix:new lJ(i),u_lightpos:new lW(i),u_lightintensity:new lH(i),u_lightcolor:new lW(i),u_vertical_gradient:new lH(i),u_opacity:new lH(i),u_edge_radius:new lH(i),u_width_scale:new lH(i),u_ao:new lq(i),u_height_type:new l$(i),u_base_type:new l$(i),u_tile_id:new lW(i),u_zoom_transition:new lH(i),u_inv_rot_matrix:new lJ(i),u_merc_center:new lq(i),u_up_dir:new lW(i),u_height_lift:new lH(i),u_flood_light_color:new lW(i),u_vertical_scale:new lH(i),u_flood_light_intensity:new lH(i),u_ground_shadow_factor:new lW(i),u_front_cutoff_params:new lW(i)}),r.cq=function(i,r,a=0,n=!0){let o=new tr(a,a),s=i.sub(o),l=r.add(o),h=[s,new tr(l.x,s.y),l,new tr(s.x,l.y)];return n&&h.push(s.clone()),h},r.cr=function(i,r){let a=[];for(let n=0;n<i.length;n++){let o=tw(n-1,-1,i.length-1),s=tw(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.cs=function(i,{x:r,y:a},n=0){return new tr(((r-n)*i.scale-i.x)*8192,(a*i.scale-i.y)*8192)},r.ct=hT,r.cu=function(i,r,a=0){return ew(((r.x-a)*i.scale-i.x)*8192,(r.y*i.scale-i.y)*8192,sP(r.z,r.y))},r.cv=eE,r.cw=uC,r.cx=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 tr(r,a),max:new tr(n,o)}},r.cy=sb,r.cz=hw,r.d=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.currentFrameAtlases=new Set,this.finalizationRegistry=new FinalizationRegistry(i=>{this.cache.delete(i),this.clearExpiredTextures()})}beginFrame(){this.currentFrameAtlases.clear()}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()){if(this.currentFrameAtlases.has(a))continue;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()),this.currentFrameAtlases.add(i);let n=this.textures.get(i);if(n)return n;if(i.image){let o=this.calculateTextureMemory(i);return this.evictTexturesIfNeeded(o),n=new de(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 tF("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.d$=i=>({u_cutoff_params:new lY(i)}),r.d0=iy,r.d1=["type","source","source-layer","minzoom","maxzoom","filter","layout"],r.d2=nZ,r.d3=e4,r.d4=e9,r.d5=e6,r.d6=e8,r.d7=tw,r.d8=e$,r.d9=.55,r.dA=ic,r.dB=d_,r.dC=dm,r.dD=oT,r.dE=t5,r.dF=iJ,r.dG=tD,r.dH=function(i){let r=i.indexOf("\x1f");return r>=0?i.slice(0,r):i},r.dI=function(i){return i.includes("\x1f")},r.dJ=function(i){let r=i.lastIndexOf("\x1f");return r>=0?i.slice(r+1):""},r.dK=function(i,r={}){let a=r.type&&!r.array&&Array.isArray(i)?{type:r.type,"property-type":"data-constant"}:void 0;return nN(null===i||"object"!=typeof i||Array.isArray(i)?i:["literal",i],a)},r.dL=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.dM=function(i,r,a,n){return"custom"===i.type?new m2(i,r):new g0[i.type](i,r,a,n)},r.dN=tR,r.dO=o1,r.dP=class extends _l{constructor(i,r){super(i._vectorTileFeature,i._z,i._x,i._y,i.id),i.state&&(this.state={...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.dQ=oE,r.dR=gF,r.dS=function(i){return 3*i},r.dT=function(){return{API_URL:tQ.API_URL,DRACO_URL:tQ.DRACO_URL,MESHOPT_URL:tQ.MESHOPT_URL,MESHOPT_SIMD_URL:tQ.MESHOPT_SIMD_URL,BUILDING_GEN_URL:tQ.BUILDING_GEN_URL}},r.dU=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.dV=eC,r.dW=eS,r.dX=t$,r.dY=eO,r.dZ=gv,r.d_=gb,r.da=_I,r.db=_M,r.dc=hR,r.dd=cN,r.de=cF,r.df=er,r.dg=24,r.dh=.9,r.di=cj,r.dj=function(i,r,a,n,o,s,l){let h=_E(i,r,a,n,o,s,l);return"globe"===s.name&&a||(h[2]=h[6]=h[10]=h[14]=0),h},r.dk=function(i,r,a,n,o,s,l){if(a){if("globe"===s.name){let h=_E(i,r,a,n,o,s,l);return en(h,h),eo(h,i,h),h}{let r=et(i),[a,s,h,u]=l,[c,d,p,f,m,_,g,y]=r;return r[0]=a*c+s*m,r[1]=a*d+s*_,r[2]=a*p+s*g,r[3]=a*f+s*y,r[4]=h*c+u*m,r[5]=h*d+u*_,r[6]=h*p+u*g,r[7]=h*f+u*y,n||ec(r,r,-o.angle),r}}return o.glCoordMatrix},r.dl=u_,r.dm=cE,r.dn=cz,r.dp=cD,r.dq=cL,r.dr=eZ,r.ds=um,r.dt=uh,r.du=uu,r.dv=function(i,[r,a]){let n=0,o=0;if(a===1/0){r<0&&(r=0);let a=r/ug;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]},r.dw=function(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"},r.dx=y$,r.dy=cG,r.dz=function(i){return i({pluginStatus:ob,pluginURL:ow}
108),oE.on("pluginStateChange",i),i},r.e=tJ,r.e$=iI,r.e0=i=>({u_light_matrix_0:new lJ(i),u_light_matrix_1:new lJ(i),u_fade_range:new lq(i),u_shadow_normal_offset:new lW(i),u_shadow_intensity:new lH(i),u_shadow_texel_size:new lH(i),u_shadow_map_resolution:new lH(i),u_shadow_direction:new lW(i),u_shadow_bias:new lW(i),u_shadowmap_0:new l$(i),u_shadowmap_1:new l$(i)}),r.e1=function(i,r,a){return r.name===a.projection.name?i.projMatrix:cU(a,r,i)},r.e2=_E,r.e3=_F,r.e4=_A,r.e5=dP,r.e6=function(i,r,a,n,o,s,l,h,u,c,d=1){let p=a.transform,f=n?i.textSizeData:i.iconSizeData,m=u_(f,a.transform.zoom,d),_="globe"===p.projection.name,g=(()=>{if(!_)return null;let i=u3(p.zoom);return 0===i?null:{t:i,invMatrix:p.projection.createInversionMatrix(p,c.canonical),mercCenter:[rK(p.center.lng),rJ(p.center.lat)]}})(),y=[256/a.width*2+1,256/a.height*2+1],x=n?i.text.dynamicLayoutVertexArray:i.icon.dynamicLayoutVertexArray;x.clear();let v=null;_&&(v=n?i.text.globeExtVertexArray:i.icon.globeExtVertexArray);let b=i.lineVertexArray,w=n?i.text.placedSymbolArray:i.icon.placedSymbolArray,T=a.transform.width/a.transform.height,S,E=!1;for(let d=0;d<w.length;d++){let _=w.get(d),{numGlyphs:I,writingMode:A}=_;if(A!==uh.vertical||E||S===uh.horizontal||(E=!0),S=A,(_.hidden||A===uh.vertical)&&!E){_F(I,x);continue}E=!1;let M=new tr(_.tileAnchorX,_.tileAnchorY),C="road"===i.elevationType,P=!!p.elevation||C,{x:R,y:D,z:L}=p.projection.projectTilePoint(M.x,M.y,c.canonical);if(g){let[i,r,a]=_R(M,c.canonical,g);R+=(i-R)*g.t,D+=(r-D)*g.t,L+=(a-L)*g.t}let z=null;if(P){let[r,a,o]=(z=C&&i.hdExt?i.hdExt.makeRoadSymbolElevationParams(i,n?i.text:i.icon,d,c,u,p.elevation,p.projection,p.center.lat,p.worldSize):{getElevation:u,elevation:p.elevation,elevationFeature:null}).getElevation(M,p.elevation,z.elevationFeature);R+=r,D+=a,L+=o}let F=[R,D,L,1];if(eW(F,F,r),!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]}(F,y)){_F(I,x);continue}let O=F[3],B=_A(a.transform.getCameraToCenterDistance(p.projection),O),k=um(f,m,_),N=l?k/B:k*B,V=_I(R,D,L,o);if(V[3]<=0){_F(I,x);continue}let U={},j=Math.cos(i.layers[0].layout.get("text-max-angle")*tf),G=l?null:z,Z=_P(_,N,!1,h,r,o,s,i.glyphOffsetArray,b,x,v,V,M,U,T,G,p.projection,c,l,j,g);E=Z.useVertical,G&&Z.needsFlipping&&(U={}),(Z.notEnoughRoom||E||Z.needsFlipping&&_P(_,N,!0,h,r,o,s,i.glyphOffsetArray,b,x,v,V,M,U,T,G,p.projection,c,l,j,g).notEnoughRoom)&&_F(I,x)}n?(i.text.dynamicLayoutVertexBuffer.updateData(x),v&&i.text.globeExtVertexBuffer&&i.text.globeExtVertexBuffer.updateData(v)):(i.icon.dynamicLayoutVertexBuffer.updateData(x),v&&i.icon.globeExtVertexBuffer&&i.icon.globeExtVertexBuffer.updateData(v))},r.e7=dt,r.e8=mM,r.e9=(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=u1(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:mA,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=u3(h.zoom);let i=8192*o[0],a=8192*o[1];c.u_up_dir=h.projection.upVector(new ce(0,0,0),i,a)}return c},r.eA=gw,r.eB=cS-1,r.eC=ti,r.eD=function(){return!!document.fullscreenElement||!!document.webkitFullscreenElement},r.eE=tx,r.eF=sL,r.eG=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.eH=eI,r.eI=sM,r.eJ=sE,r.eK=eB,r.eL=uB,r.eM=eL,r.eN=eT,r.eO=function([i,r,a]){let n=Math.hypot(i,r,a);return new sA(Math.atan2(i,a)*tm,(.5*Math.PI-Math.acos(-r/n))*tm)},r.eP=eR,r.eQ=eq,r.eR=p7,r.eS=tQ,r.eT={mark(i){performance.mark(i)},measure(i,r,a){performance.measure(i,r,a)}},r.eU=ix,r.eV=_O,r.eW=class{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}async transformRequest(i,r,a){return this._transformRequestFn&&await this._transformRequestFn(i,r,a?{signal:a}:{})||{url:i}}normalizeStyleURL(i,r){if(!ir(i))return i;let a=iM(i);return a.params.push(`sdk=js-${W}`),a.path=`/styles/v1${a.path}`,this._makeAPIURL(a,this._customAccessToken||r)}normalizeGlyphsURL(i,r){if(!ir(i))return i;let a=iM(i);return a.path=`/fonts/v1${a.path}`,this._makeAPIURL(a,this._customAccessToken||r)}normalizeModelURL(i,r){if(!ir(i))return i;let a=iM(i);return a.path=`/models/v1${a.path}`,this._makeAPIURL(a,this._customAccessToken||r)}normalizeSourceURL(i,r,a,n){if(!ir(i))return i;let o=iM(i);return o.path=`/v4/${o.authority}.json`,o.params.push("secure"),a&&o.params.push(`language=${a}`),n&&o.params.push(`worldview=${n}`),this._makeAPIURL(o,this._customAccessToken||r)}normalizeIconsetURL(i,r){let a=iM(i);return ir(i)?(a.path=`/styles/v1${a.path}/iconset.pbf`,this._makeAPIURL(a,this._customAccessToken||r)):iC(a)}normalizeSpriteURL(i,r,a,n){let o=iM(i);return ir(i)?(o.path=`/styles/v1${o.path}/sprite${r}${a}`,this._makeAPIURL(o,this._customAccessToken||n)):(o.path+=`${r}${a}`,iC(o))}normalizeTileURL(i,r,a){if(this._isSkuTokenExpired()&&this._createSkuToken(),i&&!ir(i))return i;let n=iM(i);n.path=n.path.replace(ib,(r||a&&"raster"!==n.authority&&512===a?"@2x":"")+".webp"),"raster"===n.authority?n.path=`/${tQ.RASTER_URL_PREFIX}${n.path}`:"rasterarrays"===n.authority?n.path=`/${tQ.RASTERARRAYS_URL_PREFIX}${n.path}`:"3dtiles"===n.authority?n.path=`/${tQ.TILES3D_URL_PREFIX}${n.path}`:(n.path=n.path.replace(iw,"/"),n.path=`/${tQ.TILE_URL_VERSION}${n.path}`);let o=this._customAccessToken||function(i){for(let r of i){let i=r.match(iE);if(i)return i[1]}return null}(n.params)||tQ.ACCESS_TOKEN;return tQ.REQUIRE_ACCESS_TOKEN&&o&&this._skuToken&&n.params.push(`sku=${this._skuToken}`),this._makeAPIURL(n,o)}canonicalizeTileURL(i,r){let a=iM(i);if(!iS.test(a.path)||!iT.test(a.path))return i;let n="mapbox://";a.path.startsWith("/raster/v1/")?n+=`raster/${a.path.replace(`/${tQ.RASTER_URL_PREFIX}/`,"")}`:a.path.startsWith("/rasterarrays/v1/")?n+=`rasterarrays/${a.path.replace(`/${tQ.RASTERARRAYS_URL_PREFIX}/`,"")}`:n+=`tiles/${a.path.replace(`/${tQ.TILE_URL_VERSION}/`,"")}`;let o=a.params;return r&&(o=o.filter(i=>!i.match(iE))),o.length&&(n+=`?${o.join("&")}`),n}canonicalizeTileset(i,r){let a=!!r&&ir(r),n=[];for(let r of i.tiles||[])ii(r)?n.push(this.canonicalizeTileURL(r,a)):n.push(r);return n}_makeAPIURL(i,r){let a="See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes",n=iM(tQ.API_URL);if(i.protocol=n.protocol,i.authority=n.authority,"http"===i.protocol){let r=i.params.indexOf("secure");r>=0&&i.params.splice(r,1)}if("/"!==n.path&&(i.path=`${n.path}${i.path}`),!tQ.REQUIRE_ACCESS_TOKEN)return iC(i);if(r=r||tQ.ACCESS_TOKEN,!this._silenceAuthErrors){if(!r)throw Error(`An API access token is required to use Mapbox GL. ${a}`);if("s"===r[0])throw Error(`Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). ${a}`)}return i.params=i.params.filter(i=>!i.includes("access_token")),i.params.push(`access_token=${r||""}`),iC(i)}},r.eX=iR,r.eY=function(i,r){r?iK.add(i):iK.delete(i)},r.eZ=iW,r.e_=iY,r.ea=mZ,r.eb=(i,r,a,n,o,s,l,h,u,c)=>{let d=i.transform,p=d.pitch<15?i9(.07,.7,tv((14-d.zoom)/5,0,1)):.07,f="none"===a.paint.get("line-trim-color-use-theme").
108constantOr("default");return{u_matrix:mG(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:mj(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:sz(r.tileID.canonical,0),u_ground_shadow_factor:u,u_pattern_transition:c,u_opacity_multiplier:1}},r.ec=(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?i9(.07,.7,tv((14-d.zoom)/5,0,1)):.07;return{u_matrix:mG(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_border_gradient_image:2,u_image_height:o,u_texsize:m$(a)&&r.lineAtlasTexture?r.lineAtlasTexture.size:[0,0],u_tile_units_to_pixels:mj(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_road_view_depth_bias:0,u_road_clip_to_view:[0,0,0,0],u_tile_to_meter:sz(r.tileID.canonical,0),u_ground_shadow_factor:c,u_opacity_multiplier:1}},r.ed=tA,r.ee=mz,r.ef=5,r.eg=.0039101094886591446,r.eh=s1,r.ei=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.ej=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.ek=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.el=K,r.em=ll,r.en=1,r.eo=771,r.ep=0,r.eq=lh,r.er=function(i,r,a,n,o){return tv((i-r)/(a-r)*(o-n)+n,n,o)},r.es=eb,r.et=eJ,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=s7,r.ew=class{constructor(){this._updateTime=0,this._sourceIds=[],this._activeRegions=[],this._prevRegions=[],this._globalClipBounds={min:new tr(1/0,1/0),max:new tr(-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=cP(new tr(0,0),new tr(8192,8192),i),n=[];if(r&&!cM(a,this._globalClipBounds))return n;for(let r of this._activeRegions){if(r.hiddenByOverlap||!cM(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 tr(((i.x-a.wrap)*n-a.canonical.x)*8192,(i.y*n-a.canonical.y)*8192),max:new tr(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=cP(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:
108o})}this._sourceIds.push(i.getSourceId())}_computeReplacement(){this._activeRegions.sort((i,r)=>i.priority-r.priority||cI(i.min,r.min)||cI(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||!cA(a,n)||a.order!==n.order||a.clipMask!==n.clipMask||!ta(a.clipScope,n.clipScope),this._activeRegions[r].hiddenByOverlap=n.hiddenByOverlap,++r}}if(i){for(let i of(++this._updateTime,this._activeRegions))i.order!==cS&&(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===cS&&cM(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 tr((i.x+8192*l.x)*u-8192*h.x,(i.y+8192*l.y)*u-8192*h.y))}return cR(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.ex=cS,r.ey=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 sH,n=new la,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;++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 la;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=lO.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=lO.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,sw);this._gridSegments=r.segments,this._gridBuffer=i.createVertexBuffer(r.vertices,uA.members),this._gridIndexBuffer=i.createIndexBuffer(r.
108indices,!0)}_createPoles(i){let r=new la;for(let i=0;i<=64;i++)r.emplaceBack(0,i+1,i+2);this._poleIndexBuffer=i.createIndexBuffer(r,!0);let a=new ll,n=new ll,o=new ll,s=new ll;this._poleSegments=[];for(let i=0,r=0;i<6;i++){let l=360/(1<<i);a.emplaceBack(0,-sb,0,.5,0),n.emplaceBack(0,-sb,0,.5,1),o.emplaceBack(0,-sb,0,.5,.5),s.emplaceBack(0,-sb,0,.5,.5);for(let i=0;i<=64;i++){let r=i/64,h=0,u=i9(0,l,r),[c,d,p]=sS(u8,u9,u,sb);a.emplaceBack(c,d,p,r,h),n.emplaceBack(c,d,p,r,1-h);let f=u*tf;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(lO.simpleSegment(r,0,66,64)),r+=66}this._poleNorthVertexBuffer=i.createVertexBuffer(a,uE,!1),this._poleSouthVertexBuffer=i.createVertexBuffer(n,uE,!1),this._texturedPoleNorthVertexBuffer=i.createVertexBuffer(o,uE,!1),this._texturedPoleSouthVertexBuffer=i.createVertexBuffer(s,uE,!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.ez=function(i){return iK.has(i)},r.f=i0,r.f$=ud,r.f0=iV,r.f1=ij,r.f2=iZ,r.f3=iH,r.f4=function(i){iK.delete(i)},r.f5=iX,r.f6=iN,r.f7=function(i,r){t6=i,t8=r},r.f8=W,r.f9=u4,r.fA=ab,r.fB=function(i,r){let a=i.layers[0].layout.get("fill-elevation-reference"),n="hd-road-base"===a||"hd-road-markup"===a?a:null,o=!!r&&r.length>0&&pI(r,i.layers[0].source,i.sourceLayerName);(n||o)&&(i.hdExt=new pA(i,n,o))},r.fC=function(i,r){let a="hd-road-markup"===i.layers[0].layout.get("line-elevation-reference"),n=!!r&&r.length>0&&pI(r,i.layers[0].source,i.sourceLayerName);(a||n)&&(i.hdExt=new pM(a,n))},r.fD=hY,r.fE=function(i){let r=i.layers[0];"circle"===r.type&&"hd-road-markup"===r.layout.get("circle-elevation-reference")&&(i.hdExt=new pC)},r.fF=function(i){"hd-road-markup"===i.layers[0].layout.get("symbol-elevation-reference")&&(i.hdExt=new pR)},r.fG=gY,r.fH=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)&&tF("Invalid b3dm header information.")}return pq(i,r)},r.fI=function(i,r){let a=fI(i);for(let i of a){if(!i.meshBVH)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);if(i.lights){let a=65535;for(let r of i.meshes)void 0!==r.doorVertexColor&&(a=r.doorVertexColor,i.lightsStyleAabb=r.aabb);i.lightMeshIndex=i.meshes.length,i.meshes.push(function(i,r,a){let n={};n.indexArray=new la,n.vertexArray=new s1,n.colorArray=new s8,n.indexArray.reserveExact(4*i.length),n.vertexArray.reserveExact(10*i.length),n.colorArray.reserveExact(10*i.length),fA(i,r,n.indexArray,n.vertexArray,n.colorArray),n.featureArray=new s7,n.featureArray.reserveExact(n.vertexArray.length);for(let i=0;i<n.vertexArray.length;i++)n.featureArray.emplaceBack(a,2);n.hasFeatureData=!0;let o={defined:!0};o.emissiveFactor=re.black;let s={};return s.baseColorFactor=re.white,o.pbrMetallicRoughness=s,n.material=o,n.aabb=new uB([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),n}(i.lights,r,a))}}return a},r.fJ=sz,r.fK=_a,r.fL=nH,r.fM=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&&og(o)&&!up[i[n+1]]||s&&og(s)&&!up[i[n-1]])||!up[i[n]]?i[n]:up[i[n]]}return a},r.fN=oM,r.fO=function(i){return!(i<11904||!(n9(i)||n8(i)||oc(i)||ol(i)||oi(i)||n1(i)||n7(i)||n5(i)||or(i)||oa(i)||ot(i)||of(i)||n4(i)||n3(i)||n2(i)||oe(i)||n6(i)||ou(i)||oo(i)||on(i)))},r.fP=o_,r.fQ=function(i){return nJ(i)||nQ(i)||n0(i)||oh(i)||op(i)},r.fR=function(i){return 12307===i||12312===i||12313===i||12316===i||12448===i||12540===i||i>=8592&&i<=8595||8208===i||8229===i||8741===i||i>=9472&&i<=9547||65294===i||65309===i||65374===i||65507===i},r.fS=3,r.fT=r9,r.fU=hv,r.fV=hV,r.fW=function(i){for(let a of i){var r;
108if(nJ(r=a.charCodeAt(0))||nQ(r)||n0(r)||oh(r)||op(r))return!1}return!0},r.fX=om,r.fY=uw,r.fZ=uc,r.f_=uT,r.fa=function(i){return i*tm},r.fb=u5,r.fc=function(i){let r=[0,0,0],a=er(new Float64Array(16));return eo(a,i.pixelMatrix,i.globeMatrix),eN(r,r,a),new tr(r[0],r[1])},r.fd=function(i){iz=i},r.fe=ia,r.ff=_w,r.fg=function(i,r){if(!i||!r)throw Error("TileProvider name and URL are required");tQ.TILE_PROVIDER_URLS[i]=tJ.resolveURL(r)},r.fh=function(i){"string"!=typeof i||i.length>64||!iL.test(i)?tF(`Invalid SDK info "${i}"; expected a "Name/version" string. Ignoring.`):f=i},r.fi=oI,r.fj=function(i,r,a=!1){if(ob===ox.deferred||ob===ox.loading||ob===ox.loaded)throw Error("setRTLTextPlugin cannot be called multiple times.");ow=tJ.resolveURL(i),ob=ox.deferred,ov=r,oS(),a||oA()},r.fk=function(i){tQ.BUILDING_GEN_URL=tJ.resolveURL(i)},r.fl=t2,r.fm=function(i){let r=tJ.resolveURL(i);tQ.MESHOPT_URL=r,tQ.MESHOPT_SIMD_URL=r},r.fn=t1,r.fo=function(i){tQ.DRACO_URL=tJ.resolveURL(i)},r.fp=t0,r.fq=function(i){let r=t7();if(!r)return;let a=r.delete(t4);i&&a.then(()=>i()).catch(i)},r.fr=function(i){tQ.MAX_PARALLEL_IMAGE_REQUESTS=i},r.fs=function(i){tQ.API_URL=i},r.ft=function(i){tQ.ACCESS_TOKEN=i},r.fu="hd_road_elevation",r.fv=class{static parseFrom(i,r){let a=dG.parse(i);if(!a)return[];let{vertices:n,features:o}=a,s=1/sz(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=>
108r.id===i.id&&r.idx===i.idx))).length;for(let i of o){if(i.constantHeight){l.push(new dY(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,index:i.idx}),h!==o&&n[h-1].idx===i.idx-1){let i=h-o;a.push({a:i-1,b:i})}h++}l.push(new dY(i.id,i.bounds,void 0,r,a,s))}return l}},r.fw=dO,r.fx=mb,r.fy=pE,r.fz=tu,r.g=ig,r.g0=dr,r.g1=1,r.g2=ux,r.g3=uv,r.g4=ts,r.g5=uf,r.g6=dy,r.g7=uS,r.g8=function(i,r){let a=i.stretchY||[[0,i.paddedRect.h-2]];return i.stretchX||i.stretchY?db(i.stretchX||[[0,i.paddedRect.w-2]])*db(a):1},r.g9=dw,r.ga=hO,r.gb=2,r.gc=_o,r.gd=hN,r.ge=pI,r.gf=function(i,r){let a=pE(i);return null!==a&&!!(r&1<<a)},r.gg=tP,r.gh=da,r.gi=c8,r.gj=dn,r.gk=ds,r.gl=hf,r.gm=function(i){return i<=1?1:Math.pow(2,Math.floor(Math.log2(i)))},r.gn=yl,r.go=hd,r.gp=class{constructor(i=new Uint8Array(16)){this.buf=ArrayBuffer.isView(i)?i:new Uint8Array(i),this.dataView=new DataView(this.buf.buffer,this.buf.byteOffset,this.buf.byteLength),this.pos=0,this.length=this.buf.length}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}writeFixed64(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){if((i=+i||0)>=0&&i<128)return this.pos>=this.length&&this.realloc(1),void(this.buf[this.pos++]=i);i>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&&cH(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),this.buf.set(i,this.pos),this.pos+=r}writeRawMessage(i,r){this.pos++;let a=this.pos;i(r,this);let n=this.pos-a;n>=128&&cH(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,cq,r)}writePackedSVarint(i,r){r.length&&this.writeMessage(i,cW,r)}writePackedBoolean(i,r){r.length&&this.writeMessage(i,cK,r)}writePackedFloat(i,r){r.length&&this.writeMessage(i,cX,r)}writePackedDouble(i,r){r.length&&this.writeMessage(i,cY,r)}writePackedFixed32(i,r){r.length&&this.writeMessage(i,cJ,r)}writePackedSFixed32(i,r){r.length&&this.writeMessage(i,cQ,r)}writePackedFixed64(i,r){r.length&&this.writeMessage(i,c0,r)}writePackedSFixed64(i,r){r.length&&this.writeMessage(i,c1,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)}
108writeFixed64Field(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)}},r.gq=tN,r.gr=cT,r.gs=ox,r.gt=gQ,r.gu=function(i){ie(),null!=c&&c.then(r=>{r.keys().then(a=>{for(let n=0;n<a.length-i;n++)r.delete(a[n]).catch(i=>tF(i.message))}).catch(i=>tF(i.message))}).catch(i=>tF(i.message))},r.h=iQ,r.i=rA,r.j=2,r.k=di,r.l=rV,r.m=o0,r.n=rN,r.o=tK,r.p=c2,r.q=rj,r.r=nC,r.s=oj,r.t=nI,r.u=oG,r.v=nM,r.w=tF,r.x=nk,r.y=oZ,r.z=nj}),n(["require","./shared"],function(i,r){function a(i){let r=i?i.url.toString():void 0;return r?performance.getEntriesByName(r):[]}function n(i,a){if(Object.hasOwn(i.layers,r.fu))return r.fv.parseFrom(i.layers[r.fu],a)}function o({buckets:i,data:a,sourceLayerCoder:n,canonical:o,options:s}){if(!s.elevationFeatures||0===s.elevationFeatures.length)return;let l=[];for(let a of Object.values(i))if(a instanceof r.bB&&a.hdExt){let i=a.hdExt.getUnevaluatedPortalGraph();i&&l.push(i)}let h=r.fw.evaluate(l);for(let l of Object.values(i))if(l instanceof r.bB&&l.hdExt){let i=a.layers[n.decode(l.sourceLayerIndex)];l.hdExt.setEvaluatedPortalGraph(h,i,o,s.availableImages,s.brightness,l.worldview)}}function s(i){let a=[];for(let n=0;n<i.length;n++){let o=i.feature(n),s=o.properties.frc_mask;if(null==s)continue;let l=Number(s);if(!l)continue;let h=o.loadGeometry();if(h.length>0){let i=!1;for(let a of h[0])if(a.x<0||a.x>r.a6||a.y<0||a.y>r.a6){i=!0;break}if(i)continue}let u=1===h.length&&5===h[0].length&&h[0].some(i=>i.x<=0&&i.y<=0)&&h[0].some(i=>i.x>=r.a6&&i.y<=0)&&h[0].some(i=>i.x>=r.a6&&i.y>=r.a6)&&h[0].some(i=>i.x<=0&&i.y>=r.a6);a.push(new r.fx(l,u?[]:h))}return a}function l(i,a,n,o,s){let l=r.fy(a);if(null===l)return!1;let h=n.x,u=n.y,c=s??o.z;if(o.z!==c){let i=1<<o.z-c,a=r.a6/i;h=o.x%i*a+n.x/i,u=o.y%i*a+n.y/i}for(let a of i){if(!(a.hasGeometry()&&a.frcMask&1<<l))continue;let i=a.rings.map(i=>i.map(i=>[i.x,i.y]));if(r.fz([h,u],i))return!0}return!1}function h(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)}(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(h=n,["type","id","name"])&&"structure"===h.properties.type){let{id:i,center:r}={id:(d=n).properties.id.toString(),center:[d.properties.center_lon||0,d.properties.center_lat||0]};u(l,i,r);continue}if(c(p=n,["type","id","name","z_index"])&&"floor"===p.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.fA(n,a,i.extent)));return 0===o.length?void 0:{type:"Polygon",coordinates:[o[0]]}}(i,a)}}(n,s);var h,d,p,f=l,m=i.buildings,_=i.id,g=i;for(let i of m)u(f,i),f[i].floors[_]=g,f[i].floorIds.add(_)}}else r.w(`indoor source layer not found: ${n}`)}return{buildings:l,activeFloors:r.aX.calculate(l,o,n)}}(i,l,h.activeFloors,h.selectedFloorId,o);return n.notify("setIndoorData",d),s?d.activeFloors:void 0}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])}function d(i,a){i instanceof r.bB?r.fB(i,a):i instanceof r.bA?r.fC(i,a):i instanceof r.fD?r.fE(i):i instanceof r.bv&&r.fF(i)}function p(i){for(let a in i){let n=i[a];if(n instanceof r.bA&&n.hdExt&&n.hdExt.hasDeferredElevationFeatures||n instanceof r.bv&&n.hdExt&&n.hdExt.hasDeferredElevationFeatures)return!0}return!1}class f{constructor(i,a,n){this.tileID=new r.bQ(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}async parse(i,a,n){this.status="parsing";let o=new r.bQ(n.tileID.overscaledZ,n.tileID.wrap,n.tileID.canonical.z,n.tileID.canonical.x,n.tileID.canonical.y),s=[],l=a.familiesBySource[n.source],h=new r.fG(o,n.promoteId);h.bucketLayerIDs=[],h.is3DTile=!0;let u=await r.fH(i),c=u.json.extensionsUsed&&u.json.extensionsUsed.includes("MAPBOX_mesh_features")||u.json.asset.extras&&u.json.asset.extras.MAPBOX_mesh_features,d=u.json.extensionsUsed&&u.json.extensionsUsed.includes("EXT_meshopt_compression"),p=new r.aj(this.zoom,{brightness:this.brightness,worldview:this.worldview});for(let i in l)for(let a of l[i]){let i=a[0];h.bucketLayerIDs.push(a.map(i=>r.m(i.id,i.scope))),i.recalculate(p,[]);let l=r.fI(u,1/r.fJ(n.tileID.canonical)),f=new r.fK(a,l,o,c,d,this.brightness,h,this.worldview);s.push(f),f.evaluate(i)}return this.status="done",{buckets:s,featureIndex:h,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:null}}}class m{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}async loadTile(i){let a,n=i.uid,o=new AbortController,s=this.loading[n]=new f(i,this.brightness,this.worldview);s.abort=()=>o.abort();let l=(i,r)=>{let a=s.reloadCallback;a&&(delete s.reloadCallback,a(i,r))};try{a=(await r.d0(i.request,o.signal)).data}catch(i){if(delete this.loading[n],s.status="done",this.loaded[n]=s,o.signal.aborted)return null;throw i}if(delete this.loading[n],!a||0===a.byteLength)return s.status="done",this.loaded[n]=s,null;try{let r=await s.parse(a,this.layerIndex,i);return this.loaded[n]=s,l(null,r),r}catch(i){throw this.loaded[n]=s,l(i),i}}async reloadTile(i){let r=this.loaded&&this.loaded[i.uid];if(r)return r.projection=i.projection,r.brightness=i.brightness,"parsing"===r.status&&await new Promise((i,a)=>{r.reloadCallback=r=>{r?a(r):i()}}),this.loadTile(i)}abortTile(i){let r=i.uid,a=this.loading[r];a&&(a.abort&&a.abort(),delete this.loading[r])}removeTile(i){let r=this.loaded,a=i.uid;r&&r[a]&&delete r[a]}}function _(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+=`${_(a)},`;return`${r}]`}let r="{";for(let a of Object.keys(i).sort())r+=`${a}
108:${_(i[a])},`;return`${r}}`}function g(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)}class y{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.dM(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 o=0;o<i.length;o++){let s=i[o],l=a&&a[s.id];l||("symbol"===s.type?l=s.id:(l=function(i){let a="";for(let n of r.d1)a+=`/${_(i[n])}`;return a}(s),"line"===s.type&&s.paint&&(g(s.paint["line-width"],"line-progress")&&(l+=`/${_(s.paint["line-width"])}`),g(s.paint["line-emissive-strength"],"line-progress")&&(l+=`/${_(s.paint["line-emissive-strength"])}`)))),a&&(a[s.id]=l);let h=n[l];h||(h=n[l]=[]),h.push(s)}let o=[];for(let i in n)o.push(n[i]);return o}(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)}}}class x extends r.P{constructor(i,r,a,n,o){super(i,r),this.angle=n,this.z=a,void 0!==o&&(this.segment=o)}clone(){return new x(this.x,this.y,this.z,this.angle,this.segment)}}function v(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 b(i){let r=0;for(let a=0;a<i.length-1;a++)r+=i[a].dist(i[a+1]);return r}function w(i,r){return Math.max(i?i.right-i.left:0,r?r.right-r.left:0)}r.fL(x,"Anchor");class T{constructor(){this.scale=1,this.fontStack="",this.image=null}static forText(i,r){let a=new T;return a.scale=i||1,a.fontStack=r,a}static forImage(i){let r=new T;return r.image=i,r}}class S{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(i,r,a,n=1){let o=new S;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=r.fM(this.text,i)}trim(){let i=0;for(let r=0;r<this.text.length&&A[this.text.charCodeAt(r)];r++)i++;let r=this.text.length;for(let a=this.text.length-1;a>=0&&a>=i&&A[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 S;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(T.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,a,n=1){let o=i.image?i.image.getPrimary():null;if(!o)return void r.w("Can't add FormattedSection with an empty image.");o.scaleSelf(a*n);let s=this.getNextImageSectionCharCode();s?(this.text+=String.fromCodePoint(s),this.sections.push(T.forImage(o)),this.sectionIndex.push(this.sections.length-1)):r.w("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function E(i,r){if(!i.image)return!1;let a=r.get(i.image.toString());return!!a&&a.sdf}function I(i,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y=1,x=1){let v=S.fromFeature(i,s,y,x);f===r.dt.vertical&&v.verticalizePunctuation(m);let b=v.toString();if(function(i,a){let n=i.sections.findIndex(i=>E(i,a));if(-1===n)return;r.w(`SDF image ${i.sections[n].image.id.name} is not supported in text-field`);let o=i.sections.map(i=>E(i,a)),s="",l=[];for(let r=0;r<i.length();r++){let a=i.sectionIndex[r];o[a]||(s+=i.text[r],l.push(a))}i.text=s,i.sectionIndex=l}(v,o),0===v.length())return;let w=[],T=function(i,a,n,o,s,l,h){if(!i)return[];let u=[],c=function(i,r,a,n,o,s,l){let h=0;for(let a=0;a<i.length();a++){let u=i.getSection(a);h+=C(i.getCodePoint(a),u,n,o,r,s,l)}return h/Math.max(1,Math.ceil(h/a))}(i,a,n,o,s,l,h),d=i.text.includes("​"),p=0;for(let n=0;n<i.length();n++){let f=i.getSection(n),m=i.getCodePoint(n);if(A[m]||(p+=C(m,f,o,s,a,l,h)),n<i.length()-1){let a=r.fO(m);(M[m]||a||f.image)&&u.push(R(n+1,p,c,u,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}(m,i.getCodePoint(n+1),a&&d),!1))}}return function i(r){return r?i(r.priorBreak).concat(r.index):[]}(R(i.length(),p,c,u,0,!0))}(v,d,l,a,o,_,x),{processBidirectionalText:P,processStyledBidirectionalText:L}=r.fN;if(P&&1===v.sections.length)for(let i of P(v.toString(),T)){let r=new S;r.text=i,r.sections=v.sections;for(let a=0;a<i.length;a++)r.sectionIndex.push(0);w.push(r)}else if(L)for(let i of L(v.text,v.sectionIndex,T)){let r=new S;r.text=i[0],r.sectionIndex=i[1],r.sections=v.sections,w.push(r)}else w=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}(v,T);let z=[],F={positionedLines:z,text:b,top:p[1],bottom:p[1],left:p[0],right:p[0],writingMode:f,iconsInText:!1,verticalizable:!1,hasBaseline:!1};return function(i,a,n,o,s,l,h,u,c,d,p,f,m){let _=0,g=0,y=0,x="right"===u?1:.5*("left"!==u),v=!1;for(let i of s){for(let r of i.getSections()){if(r.image)continue;let i=a[r.fontStack];if(i&&!(v=void 0!==i.ascender&&void 0!==i.descender))break}if(!v)break}let b=0;for(let h of s){h.trim();let s=h.getMaxScale(),u=(s-1)*r.dg,w={positionedGlyphs:[],lineOffset:0};i.positionedLines[b]=w;let T=w.positionedGlyphs,S=0;if(!h.length()){g+=l,++b;continue}let E=0,I=0;for(let l=0;l<h.length();l++){let u=h.getSection(l),y=h.getSectionIndex(l),x=h.getCodePoint(l),b=u.scale,w=null,M=null,C=null,P=r.dg,R=0,D=c;D===r.dt.vertical&&r.fR(x)&&(D=r.dt.horizontal);let L=!(D===r.dt.horizontal||!p&&!r.fP(x)||p&&(A[x]||r.fQ(x)));if(u.image){let a=o.get(u.image.toString());if(!a)continue;C=u.image,i.iconsInText=!0,M=a.paddedRect;let n=a.displaySize,l=n[0]*m,h=n[1]*m;b=b*r.dg/f,w={width:l,height:h,left:0,top:-r.fS,advance:L?h:l,localGlyph:!1},R=v?-w.height*b:s*r.dg-17-h*b,P=w.advance;let c=(L?l:h)*b-r.dg*s;c>0&&c>S&&(S=c)}else{let i=n[u.fontStack];if(!i)continue;i[x]&&(M=i[x]);let o=a[u.fontStack];if(!o)continue;let l=o.glyphs[x];if(!l)continue;if(w=l.metrics,P=8203!==x?r.dg:0,v){let i=void 0!==o.ascender?Math.abs(o.ascender):0,r=void 0!==o.descender?Math.abs(o.descender):0,a=(i+r)*b;E<a&&(E=a,I=(i-r)/2*b),R=-i*b}else R=(s-b)*r.dg-17}T.push({glyph:x,image:C,x:_,y:g+R,vertical:L,scale:b,localGlyph:w.localGlyph,fontStack:u.fontStack,sectionIndex:y,metrics:w,rect:M}),L?(i.verticalizable=!0,_+=P*b+d):_+=w.advance*b+d}0!==T.length&&(y=Math.max(_-d,y),v?D(T,x,S,I,l*s/2):D(T,x,S,0,l/2)),_=0;let M=l*s+S;w.lineOffset=Math.max(S,u),g+=M,++b}let w=g,{horizontalAlign:T,verticalAlign:S}=r.du(h);(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})(i.positionedLines,x,T,S,y,w),i.top+=-S*w,i.bottom=i.top+w,i.left+=-T*y,i.right=i.left+y,i.hasBaseline=v}(F,a,n,o,w,h,u,c,f,d,m,g,x),!function(i){for(let r of i)if(0!==r.positionedGlyphs.length)return!1;return!0}(z)?F:void 0}let A={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},M={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 C(i,a,n,o,s,l,h){if(a.image){let i=o.get(a.image.toString());return i?i.displaySize[0]*h*a.scale*r.dg/l+s:0}{let r=n[a.fontStack],o=r&&r.glyphs[i];return o?o.metrics.advance*a.scale+s:0}}function P(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 R(i,r,a,n,o,s){let l=null,h=P(r,a,o,s);for(let i of n){let n=P(r-i.x,a,o,s)+i.badness;n<=h&&(l=i,h=n)}return{index:i,x:r,priorBreak:l,badness:h}}function D(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;
108for(let r=0;r<=s;r++)i[r].x-=h,i[r].y+=a+n+o}function L(i,r){return r.max-i.max}class z{constructor(i,a,n,o){this.p=new r.P(i,a),this.h=n,this.d=function(i,a){let n=!1,o=1/0;for(let s=0;s<a.length;s++){let l=a[s];for(let a=0,s=l.length,h=s-1;a<s;h=a++){let s=l[a],u=l[h];s.y>i.y!=u.y>i.y&&i.x<(u.x-s.x)*(i.y-s.y)/(u.y-s.y)+s.x&&(n=!n),o=Math.min(o,r.fU(i,s,u))}}return(n?1:-1)*Math.sqrt(o)}(this.p,o),this.max=this.d+this.h*Math.SQRT2}}let F=Object.keys;function O(i){return void 0!==i.imagePrimary&&void 0!==i.top&&void 0!==i.bottom&&void 0!==i.left&&void 0!==i.right}function B(i){return!i.imagePrimary.stretchX}function k(i){return!i.imagePrimary.stretchY}function N(i){return{width:i.right-i.left,height:i.bottom-i.top}}let V=1/0;function U(i,a,n,o,s,l){let h=O(i)&&i.collisionPadding?i.collisionPadding:[0,0,0,0],u={top:i.top-h[1],bottom:i.bottom+h[3],left:i.left-h[0],right:i.right+h[2],scaled:!1};return void 0!==o&&(u.top*=o,u.bottom*=o,u.left*=o,u.right*=o,u.scaled=!0),l&&(u.left+=l[0],u.right+=l[0],u.top+=l[1],u.bottom+=l[1]),n&&function(i,a,n){if
108(!a)return;let o=r.av(a),s=new r.P(n?n[0]:0,n?n[1]:0),l=new r.P(i.left,i.top),h=new r.P(i.right,i.top),u=new r.P(i.left,i.bottom),c=new r.P(i.right,i.bottom);l._rotateAround(o,s),h._rotateAround(o,s),u._rotateAround(o,s),c._rotateAround(o,s),i.left=Math.min(l.x,h.x,u.x,c.x),i.right=Math.max(l.x,h.x,u.x,c.x),i.top=Math.min(l.y,h.y,u.y,c.y),i.bottom=Math.max(l.y,h.y,u.y,c.y)}(u,n,s),a?{top:Math.min(a.top,u.top),bottom:Math.max(a.bottom,u.bottom),left:Math.min(a.left,u.left),right:Math.max(a.right,u.right),scaled:a.scaled||u.scaled}:u}function j(i,a,n,o,s,l,h,u){let c=null,d=a.getAppearanceValueAndResolveTokens(n,"icon-image",o,s,u);if(d){let p=i.getResolvedImageFromTokens(d),f=n.hasLayoutProperty("icon-size")?n.getUnevaluatedLayoutProperty("icon-size"):a._unevaluatedLayout._values["icon-size"],m=r.g5(i.zoom,f,i.worldview,u),_=r.fY(p,m,f,s,i.zoom,o,i.pixelRatio,h,i.worldview,u);c=l.get(_.iconPrimary.toString())}return c}function G(i,a,n,o,s,l,h,u){if(!i||!i.usvg)return;let c=N(n),d=N(o),p=("both"===s||"width"===s)&&B(n)?d.width/c.width:1,f=("both"===s||"height"===s)&&k(n)?d.height/c.height:1;a.scaleSelf(p,f);let m=a.toString();l.set(m,a),h.set(m,i);let{imagePosition:_}=r.g0(m,i,r.g1);u.set(m,_)}function Z(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 $(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 H(i,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b){let w=r.g9(n,o,c,l,h,u,s,i.allowVerticalPlacement,void 0,g.textScaleFactor),T=l.layout.get("text-size").evaluate(u,{},x),S=g.compositeTextSizes?g.compositeTextSizes[0].evaluate(u,{},x):0,E=g.compositeTextSizes?g.compositeTextSizes[1].evaluate(u,{},x):0,I=r.g7(i.layerIds[0],i.textSizeData,T,g.textScaleFactor,S,E);for(let r of(i.addSymbols(i.text,w,I,c,h,u,p,a,n,d.lineStartIndex,d.lineLength,_,y,x,b,!1,v,w.length),f))m[r]=i.text.placedSymbolArray.length-1;return 4*w.length}function q(i){for(let r in i)return i[r];return null}function W(i,a,n,o,s,l,h,u,c,d,p){let f,m,_,g;if(f=p?p.top:h.top,m=p?p.bottom:h.bottom,_=p?p.left:h.left,g=p?p.right:h.right,O(h)&&h.collisionPadding){let i=h.collisionPadding;_-=i[0],f-=i[1],g+=i[2],m+=i[3]}if(c){let i=new r.P(_,f),a=new r.P(g,f),n=new r.P(_,m),o=new r.P(g,m),s=r.av(c),l=new r.P(0,0);d&&(l=new r.P(d[0],d[1])),i._rotateAround(s,l),a._rotateAround(s,l),n._rotateAround(s,l),o._rotateAround(s,l),_=Math.min(i.x,a.x,n.x,o.x),g=Math.max(i.x,a.x,n.x,o.x),f=Math.min(i.y,a.y,n.y,o.y),m=Math.max(i.y,a.y,n.y,o.y)}return i.emplaceBack(a.x,a.y,a.z,n.x,n.y,_,f,g,m,u,o,s,l),i.length-1}function X(i){O(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}let Y=+r.gb;class K{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?Y:1,l={x:0,y:0,w:r.bitmap.width+2*a,h:r.bitmap.height+2*a};n.push(l),s[i]=l}}let{w:o,h:s}=r.p(n),l=new r.ga({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 h=a[n][i],u=s.metrics.localGlyph?Y:1;r.ga.copy(s.bitmap,l,{x:0,y:0},{x:h.x+u,y:h.y+u},s.bitmap)}}this.image=l,this.positions=a}}function J(i){for(let r of i)if(null!=r.hdExt||r.requiresHDRuntime)return!0;return!1}function Q(i){for(let r of i)if(r.requiresStandardRuntime)return!0;return!1}r.fL(K,"GlyphAtlas");class ee{constructor(i){this.tileID=new r.bQ(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.frcCoverage=i.frcCoverage||null,this.elevation=i.elevation||null,this.crossSourceElevationEnabled=!!i.crossSourceElevationEnabled,this.terrainEnabled=!!i.terrainEnabled,this.deferRoadStructure=!1,this.tileTransform=r.bq(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}isLayerActiveForTile(i){return!(this.renderSourceType===r.bS.Symbol&&"symbol"!==i.t
108ype||this.renderSourceType===r.bS.FillExtrusion&&"fill-extrusion"!==i.type||this.renderSourceType===r.bS.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)}parse(i,r,a,n,o,s){this._parseAfterHD(i,r,a,n,o,s)}_parseAfterHD(i,a,u,c,f,m){let _;if(this.status="parsing",this.data=i,this.renderSourceType===r.bS.HdRoadCoverage){let a=i.layers[r.bV];_=a&&s?s(a):[]}this.collisionBoxArray=new r.bu;let g=new r.gc(Object.keys(i.layers).sort()),y=new r.fG(this.tileID,this.promoteId);y.bucketLayerIDs=[];let T={},S=new r.gd(256,256),E={featureIndex:y,iconDependencies:new Map,patternDependencies:new Map,glyphDependencies:{},lineAtlas:S,availableImages:u,brightness:this.brightness,scaleFactor:this.scaleFactor,showElevationIdDebug:this.showElevationIdDebug,elevationFeatures:void 0,elevationParams:this.elevation,crossSourceElevationEnabled:this.crossSourceElevationEnabled,terrainEnabled:this.terrainEnabled,activeFloors:void 0};this.indoor&&h&&(E.activeFloors=h(i,this.indoor,f,this.canonical));let A=[],M=a.familiesBySource[this.source];if(this.deferRoadStructure=!1,this.renderSourceType!==r.bS.HdRoadCoverage&&null!=this.frcCoverage&&!this.frcCoverage.resolved&&null===this.frcCoverage.frcMask){for(let i in M)if(r.ge&&r.ge(this.frcCoverage.sourceLayers,this.source,i)){this.deferRoadStructure=!0;break}}for(let a in M){let o=i.layers[a];if(!o)continue;let s=!1,l=!1,h=!1,p=!1;for(let i of M[a])"symbol"===i[0].type?s=!0:"fill-extrusion"===i[0].type?l=!0:h=!0,i[0].is3D()&&"model"!==i[0].type&&(p=!0);if(this.extraShadowCaster&&!p||this.renderSourceType===r.bS.Symbol&&!s||this.renderSourceType===r.bS.FillExtrusion&&!l||(this.renderSourceType===r.bS.Other||this.renderSourceType===r.bS.HdRoadCoverage)&&!h)continue;let f=null!=this.frcCoverage&&!!r.ge&&r.ge(this.frcCoverage.sourceLayers,this.source,a);if(this.deferRoadStructure&&f)continue;1===o.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 m=g.encode(a),_=[],x=this.localizableLayerIds&&this.localizableLayerIds.has(a),v=!1;for(let i=0,n=0;i<o.length;i++){let s=o.feature(i),l=y.getId(s,a),h=s.properties?s.properties.worldview:null;if(x&&this.worldview&&"string"==typeof h)if("all"===h)s.properties.$localized=!0;else{if(!h.split(",").includes(this.worldview))continue;s.properties.$localized=!0,s.properties.worldview=this.worldview}!v&&s.properties&&Object.hasOwn(s.properties,r.fV)&&(v=!0),f&&this.frcCoverage&&this.frcCoverage.frcMask&&s.properties&&r.gf&&r.gf(s.properties,this.frcCoverage.frcMask)||(_.push({feature:s,id:l,index:n,sourceLayerIndex:m}),n++)}for(let o of(v&&!E.elevationFeatures&&n&&(E.elevationFeatures=n(i,this.canonical)),M[a])){let i=o[0];if(this.extraShadowCaster&&(!i.is3D()||"model"===i.type)||this.renderSourceType===r.bS.Symbol&&"symbol"!==i.type||this.renderSourceType===r.bS.FillExtrusion&&"fill-extrusion"!==i.type||(this.renderSourceType===r.bS.Other||this.renderSourceType===r.bS.HdRoadCoverage)&&("symbol"===i.type||"fill-extrusion"===i.type)||!this.isLayerActiveForTile(i))continue;let n=y.bucketLayerIDs.length;y.bucketLayerIDs.push(o.map(i=>r.m(i.id,i.scope)));let s=()=>{et(o,this.zoom,E.brightness,u,this.worldview,E.activeFloors);let r=T[i.id]=i.createBucket({index:n,layers:o,zoom:this.zoom,lut:this.lut,canonical:this.canonical,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:m,sourceLayerName:a,sourceID:this.source,projection:this.projection.spec,tessellationStep:this.tessellationStep,styleDefinedModelURLs:c,worldview:this.worldview,localizable:x,availableImages:u,maxUniformBufferBindings:this.maxUniformBufferBindings,maxUniformBlockSizeDwords:this.maxUniformBlockSizeDwords});d&&d(r,this.frcCoverage?this.frcCoverage.sourceLayers:null),r.populate(_,E,this.tileID.canonical,this.tileTransform)};i.mayUse("HD")||i.mayUse("Standard")?A.push(i.prepare().then(()=>s())):s()}}let C=()=>{S.trim();let a=!(!E.elevationFeatures||!E.elevationFeatures.some(i=>i.heightRange.min<0)),s,h,c,d,A,M,C,P=E.elevationFeatures;this.crossSourceElevationEnabled&&n&&(P=P||n(i,this.canonical)||[]);let R={type:"maybePrepare",renderSourceType:this.renderSourceType,zoom:this.zoom},D=()=>
108{if(s)return this.status="done",m(s);if(this.extraShadowCaster){this.status="done";let i=Object.values(T).filter(i=>!i.isEmpty());m(null,{buckets:i,containsHdExt:J(i),containsStandardExt:Q(i),featureIndex:y,collisionBoxArray:null,hasTunnelGeometry:a,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:E.brightness,hasDeferredElevationFeatures:!!p&&p(T),parsedElevationFeatures:P,glyphMap:null,iconMap:null,glyphPositions:null})}else if(h&&c&&d&&C){let i=void 0,a=new K(h),n=new Map;for(let[i,a]of c.entries()){let{imagePosition:o}=r.g0(i,a,r.g1);n.set(i,o)}let o={};for(let i in T){let s=T[i];if(s instanceof r.bv){et(s.layers,this.zoom,E.brightness,u,this.worldview,E.activeFloors);let d=function(i,a,n){let o=null!=i&&!!r.ge&&r.ge(i.sourceLayers,a,n);return{applies:o,frcMask:o&&i?i.frcMask:null,polygons:o&&i?i.polygons:null,tileZoom:o&&i?i.tileZoom:null}}(this.frcCoverage,this.source,s.layers[0].sourceLayer);o[i]=function(i,a,n,o,s,l,h,u=1,c,d,p,f,m,_,g,y,x){i.createArrays(),i.tilePixelRatio=r.a6/(512*i.overscaling),i.compareText={},i.iconsNeedLinear=!1;let v=i.layers[0].layout,b=i.layers[0]._unevaluatedLayout._values,w={};w.scaleFactor=u,w.textSizeScaleRange=v.get("text-size-scale-range"),w.iconSizeScaleRange=v.get("icon-size-scale-range");let[T,S]=w.textSizeScaleRange,[E,A]=w.iconSizeScaleRange;w.textScaleFactor=r.b1(w.scaleFactor,T,S),w.iconScaleFactor=r.b1(w.scaleFactor,E,A);let M=b["text-size"],C=b["icon-size"];if("composite"===i.textSizeData.kind){let{minZoom:a,maxZoom:n}=i.textSizeData;w.compositeTextSizes=[M.possiblyEvaluate(new r.aj(a,{worldview:p}),l),M.possiblyEvaluate(new r.aj(n,{worldview:p}),l)]}if("composite"===i.iconSizeData.kind){let{minZoom:a,maxZoom:n}=i.iconSizeData;w.compositeIconSizes=[C.possiblyEvaluate(new r.aj(a,{worldview:p}),l,f),C.possiblyEvaluate(new r.aj(n,{worldview:p}),l,f)]}w.layoutTextSize=M.possiblyEvaluate(new r.aj(h+1,{worldview:p}),l),w.layoutIconSize=C.possiblyEvaluate(new r.aj(h+1,{worldview:p}),l,f),w.textMaxSize=M.possiblyEvaluate(new r.aj(18,{worldview:p}),l);let P=v.get("symbol-placement"),R="map"===v.get("text-rotation-alignment")&&"point"!==P,D=v.get("text-size"),L=!1,z=[],F=null!=m&&0!==m;for(let h of i.features){if(F&&h.properties&&y&&y(h.properties,m))continue;let u=65535;if(i.hdExt&&h.properties&&Object.hasOwn(h.properties,r.fV)){let a=+h.properties[r.fV];if(!Number.isNaN(a)){let r=i.hdExt.resolveRoadElevation(h,a);if("defer"===r)continue;u=r}}let _=v.get("text-font").evaluate(h,{},l).join(","),g=D.evaluate(h,{},l)*w.textScaleFactor,x=w.layoutTextSize.evaluate(h,{},l)*w.textScaleFactor,T=w.layoutIconSize.evaluate(h,{},l,f)*w.iconScaleFactor,S={horizontal:{},vertical:void 0},E=h.text,A,M=[0,0];if(E){let o=E.toString(),u=v.get("text-letter-spacing").evaluate(h,{},l)*r.dg,d=v.get("text-line-height").evaluate(h,{},l)*r.dg,p=r.fW(o)?u:0,f=v.get("text-anchor").evaluate(h,{},l),m=v.get("text-variable-anchor");if(!m){let i=v.get("text-radial-offset").evaluate(h,{},l);if(i)M=r.dv(f,[i*r.dg,V]);else{let i=v.get("text-offset").evaluate(h,{},l);M=[i[0]*r.dg,i[1]*r.dg]}}let y=R?"center":v.get("text-justify").evaluate(h,{},l),b="point"===P,T=b?v.get("text-max-width").evaluate(h,{},l)*r.dg:1/0,A=l=>{i.allowVerticalPlacement&&r.fX(o)&&(S.vertical=I(E,a,n,s,_,T,d,f,l,p,M,r.dt.vertical,!0,x,g,c,w.textScaleFactor))};if(!R&&m){let i="auto"===y?m.map(i=>r.dw(i)):[y],o=!1;for(let l=0;l<i.length;l++){let h=i[l];if(!S.horizontal[h])if(o)S.horizontal[h]=S.horizontal[0];else{let i=I(E,a,n,s,_,T,d,"center",h,p,M,r.dt.horizontal,!1,x,g,c,w.textScaleFactor);i&&(S.horizontal[h]=i,o=1===i.positionedLines.length)}}A("left")}else{if("auto"===y&&(y=r.dw(f)),b||v.get("text-writing-mode").includes("horizontal")||!r.fX(o)){let i=I(E,a,n,s,_,T,d,f,y,p,M,r.dt.horizontal,!1,x,g,c,w.textScaleFactor);i&&(S.horizontal[y]=i)}A(b?"left":y)}}let C,O,N,Z,$,H,W=!1,X=v.get("icon-text-fit").evaluate(h,{},l);if(h.icon&&h.icon.hasPrimary()){let a=r.fY(h.icon,i.iconSizeData,b["icon-size"],l,i.zoom,h,c,w.iconScaleFactor,p,f);C=a.iconPrimary,N=a.iconSecondary;let n=C.toString();if((O=o.get(n))&&($=v.get("icon-offset").evaluate(h,{},l),H=v.get("icon-anchor").evaluate(h,{},l),A=r.fZ(s.get(n),N?s.get(N.toString()):void 0,$,H),W=O.sdf,void 0===i.sdfIcons?i.sdfIcons=O.sdf:i.sdfIcons!==O.sdf&&r.w("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(O.pixelRatio!==i.pixelRatio||0!==v.get("icon-rotate").constantOr(1))&&(i.iconsNeedLinear=!0)),N){let i=N.toString();Z=o.get(i)}}L=L||!(!h.icon||!h.icon.hasSecondary());let Y=q(S.horizontal)||S.vertical;i.iconsInText||(i.iconsInText=!!Y&&Y.iconsInText);let{defaultShapedIcon:K,verticallyShapedIcon:J}=function(i,a,n,o,s,l,h,u,c){let d=q(l.horizontal)||l.vertical,p=n.get("icon-text-fit-padding").evaluate(o,{},s),f,m=a;return a&&"none"!==c&&(i.allowVerticalPlacement&&l.vertical&&(f=r.f$(a,l.vertical,c,p,u,h)),d&&(m=r.f$(a,d,c,p,u,h))),{defaultShapedIcon:m,verticallyShapedIcon:f}}(i,A,v,h,l,S,r.f_(x,w.textScaleFactor),$,X);"none"!==X&&A&&(B(A)||k(A))&&(G(O,C,A,K,X,d,o,s),G(Z,N,A,K,X,d,o,s),J&&(G(O,C,A,J,X,d,o,s),G(Z,N,A,J,X,d,o,s)));let{iconBBox:Q,iconVerticalBBox:ee,textBBox:et,textVerticalBBox:ei}=function(i,a,n,o,s,l,h,u,c,d,p,f,m,_,g){let y=i.layers[0],x=y.appearances;if(0===x.length)return{iconBBox:null,iconVerticalBBox:null,textBBox:null,textVerticalBBox:null};let v={iconBBox:null,iconVerticalBBox:null},b={textBBox:null,textVerticalBBox:null},{baseIconRotate:w,baseTextRotate:T,iconScaleFactor:S}=function(i,a,n){let o=i.get("icon-rotate").evaluate(a,{},n),s=i.get("text-rotate").evaluate(a,{},n),[l,h]=i.get("icon-size-scale-range");return{baseIconRotate:o,baseTextRotate:s,iconScaleFactor:r.b1(1,l,h)}}(o,s,l);a&&(v.iconBBox=U(a,v.iconBBox,w),n)&&(v.iconVerticalBBox=U(n,v.iconVerticalBBox,w+90));let E=q(f.horizontal);for(let n of(E&&(b.textBBox=U(E,b.textBBox,T,1,_)),f.vertical&&(b.textVerticalBBox=U(f.vertical,b.textVerticalBBox,T+90,1,_)),x))n.hasIconLayoutProperties()&&function(i,a,n,o,s,l,h,u,c,d,p,f,m,_,g){let{appearanceIconOffset:y,appearanceIconRotate:x,appearanceIconSize:v}=r.g2(o,n,s,l,h,u,c,d.iconScaleFactor),b=null,w=null,T=null;o.hasLayoutProperty("icon-image")?T=j(a,n,o,s,l,f,m,g):p&&(T=p.imagePrimary),T&&(b=r.fZ(T,null,y,_),a.allowVerticalPlacement&&(w=b));let S=c>0?v/c:1;b&&(i.iconBBox=U(b,i.iconBBox,x,1!==S?S:void 0)),w&&(i.iconVerticalBBox=U(w,i.iconVerticalBBox,x+90,1!==S?S:void 0))}(v,i,y,n,s,l,u,w,h,c,a,d,S,p,g),n.hasTextLayoutProperties()&&function(i,a,n,o,s,l,h,u,c,d){let{appearanceTextOffset:p,appearanceTextRotate:f,appearanceTextSize:m}=r.g3(n,a,o,s,l,h,u),_=m/u,g=[(p[0]-l[0])*_,(p[1]-l[1])*_],y=0!==g[0]||0!==g[1];c&&(i.textBBox=U(c,i.textBBox,f,_,p,y?g:void 0)),d&&(i.textVerticalBBox=U(d,i.textVerticalBBox,f+90,_,p,y?g:void 0))}(b,y,n,s,l,_,T,m,E,f.vertical);return{iconBBox:v.iconBBox,iconVerticalBBox:v.iconVerticalBBox,textBBox:b.textBBox,textVerticalBBox:b.textVerticalBBox}}(i,A=K,J,v,h,l,T,$,w,s,H,S,x,M,f);z.push({feature:h,shapedTextOrientations:S,shapedText:Y,shapedIcon:A,iconPrimary:C,iconSecondary:N,iconOffset:$,iconA
108nchor:H,verticallyShapedIcon:J,layoutTextSize:x,layoutIconSize:T,textOffset:M,isSDFIcon:W,iconTextFit:X,iconCollisionBounds:Q,iconVerticalCollisionBounds:ee,textCollisionBounds:et,textVerticalCollisionBounds:ei,elevationFeatureIndex:u})}return i.hdExt&&i.hdExt.clearWorkerState(),{featureData:z,sizes:w,hasAnySecondaryIcon:L,textAlongLine:R,symbolPlacement:P,coverageFrcMask:m,coveragePolygons:_,coverageTileZoom:g,isFeatureCoveredByFrcMask:y,symbolAnchorInFrcCoverage:x}}(s,h,a.positions,c,n,this.tileID.canonical,this.tileZoom,this.scaleFactor,this.pixelRatio,A,this.worldview,u,d.frcMask,d.polygons,d.tileZoom,r.gf||null,l||null)}}A.size||M.size?this.rasterizeTask=f.sendCancelable("rasterizeImages",{scope:this.scope,iconTasks:A,patternTasks:M},{},(r,n)=>{if(!r)for(let[i,r]of n.entries())c.has(i)&&c.set(i,Object.assign(c.get(i),{data:r})),d.has(i)&&d.set(i,Object.assign(d.get(i),{data:r}));O(o,a,i,C)}):O(o,a,i,C)}},O=(i,n,o,s)=>{let l=c.size>0||d.size>0,h=Object.keys(i).length>0;if(!l&&!h){this.status="done";let i=Object.values(T).filter(i=>!i.isEmpty());return void m(null,{buckets:i,containsHdExt:J(i),containsStandardExt:Q(i),featureIndex:y,collisionBoxArray:this.collisionBoxArray,hasTunnelGeometry:a,glyphAtlasImage:n.image,lineAtlas:S,imageAtlas:null,brightness:E.brightness,hasDeferredRoadStructure:this.deferRoadStructure,frcCoveragePolygons:_,hasDeferredElevationFeatures:!!p&&p(T),parsedElevationFeatures:P})}let g=(o,s)=>{for(let a in T){let n=T[a];if(a in i)!function(i,a,n,o,s,l,h,u,c,d){i.iconAtlasPositions=d.iconPositions;let{featureData:p,sizes:f,textAlongLine:m,symbolPlacement:_,coveragePolygons:g,coverageTileZoom:y,symbolAnchorInFrcCoverage:T}=a,S=a.hasAnySecondaryIcon||i.hasAnySecondaryIcon;for(let a of p){let{shapedIcon:n,verticallyShapedIcon:l,feature:p,shapedTextOrientations:E,shapedText:I,layoutTextSize:A,textOffset:M,isSDFIcon:C,iconPrimary:P,iconSecondary:R,iconTextFit:D,iconOffset:O,iconCollisionBounds:B,iconVerticalCollisionBounds:k,textCollisionBounds:N,elevationFeatureIndex:U}=a;Z(n,d.iconPositions,P,R),Z(l,d.iconPositions,P,R),function(i,r){for(let a in i.horizontal)$(i.horizontal[a],r);$(i.vertical,r)}
108(E,d.iconPositions),function(i,a,n){if(!a)return;let o=n.get(i.toString()),s=n.get(a.toString());o&&s&&(o.paddedRect.w===s.paddedRect.w&&o.paddedRect.h===s.paddedRect.h||r.w(`Mismatch in icon variant sizes: ${i.toString()} and ${a.toString()}`),o.usvg!==s.usvg&&r.w(`Mismatch in icon variant image types: ${i.id} and ${a.id}`))}(P,R,d.iconPositions),(I||n)&&function(i,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,T,S,E,I,A,M,C,P,R,D,O,B,k=65535){var N;let U=h.textMaxSize.evaluate(a,{},m);void 0===U?U=u*h.textScaleFactor:U*=h.textScaleFactor;let G=i.layers[0].layout,Z=r.dg,$=r.f_(u,h.textScaleFactor),Y=q(n.horizontal)||n.vertical,K=i.hasAnyAppearanceLayoutProperty(["text-size","text-offset","text-rotate"]),J=i.getAppearanceFeatureData(a.index);("none"!==T||K)&&J&&(J.textShaping=Y,J.iconTextFitPadding=G.get("icon-text-fit-padding").evaluate(a,{},m),J.fontScale=$,J.textScaleFactor=h.textScaleFactor);let Q="globe"===_.name,ee=i.tilePixelRatio*U/Z,et=(N=i.overscaling,i.zoom>18&&N>2&&(N>>=1),Math.max(r.a6/(512*N),1)*G.get("symbol-spacing")),ei=G.get("text-padding")*i.tilePixelRatio,er=G.get("icon-padding")*i.tilePixelRatio,ea=r.av(G.get("text-max-angle")),en="map"===G.get("icon-rotation-alignment")&&"point"!==I,eo=et/2;!1===i.hasAnyIconTextFit&&"none"!==T&&(i.hasAnyIconTextFit=!0);let es=(u,c,v)=>{if(c.x<0||c.x>=r.a6||c.y<0||c.y>=r.a6||D&&D.length>0&&a.properties&&B&&B(D,a.properties,c,m,O))return;let b=null;if(Q){let{x:i,y:r,z:a}=_.projectTilePoint(c.x,c.y,v);b={anchor:new x(i,r,a,0,void 0),up:_.upVector(v,c.x,c.y)}}!function(i,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,R,D,L,z){let O=i.addToLineVertexArray(a,o),B,k,N,U,G,Z,$,q=0,Y=0,K=0,J=0,Q=-1,ee=-1,et={},ei=r.dF(""),er=n?n.anchor:a,ea="none"!==P,en=0,eo=0;if(void 0===c._unevaluatedLayout.getValue("text-radial-offset")){let i=c.layout.get("text-offset").evaluate(T,{},A);en=i[0]*r.dg,eo=i[1]*r.dg}else en=c.layout.get("text-radial-offset").evaluate(T,{},A)*r.dg,eo=V;if(i.allowVerticalPlacement&&s.vertical){let i=s.vertical;if(g)Z=X(i),u&&($=X(u));else{let r=c.layout.get("text-rotate").evaluate(T,{},A)+90;N=W(d,er,a,p,f,m,i,_,r,y,z),u&&(U=W(d,er,a,p,f,m,u,v,r,null,L))}}if(l){let o=c.layout.get("icon-rotate").evaluate(T,{},A),s=r.g6(l,o,E,ea,S.iconScaleFactor),h=u?r.g6(u,o,E,ea,S.iconScaleFactor):void 0;k=W(d,er,a,p,f,m,l,v,o,null,D);let _=function(i,a,n,o,s,l,h,u,c){let d=i.layers[0],p=d.appearances,f=a.length;if(n&&(f=Math.max(f,n.length)),0===p.length)return f;let[m,_]=o.get("icon-size-scale-range"),g=r.b1(1,m,_);for(let a of p)if(a.hasLayoutProperty("icon-image")){let n=j(i,d,a,s,l,h,g,c);n&&(f=Math.max(f,r.g8(n)))}return f}(i,s,h,c.layout,T,A,i.iconAtlasPositions,0,I);q=4*_;let g=c.layout.get("icon-size").evaluate(T,{},A,I),y=S.compositeIconSizes?S.compositeIconSizes[0].evaluate(T,{},A,I):0,x=S.compositeIconSizes?S.compositeIconSizes[1].evaluate(T,{},A,I):0,P=r.g7(i.layerIds[0],i.iconSizeData,g,l.imagePrimary.usvg?1:S.iconScaleFactor,y,x);i.addSymbols(i.icon,s,P,w,b,T,void 0,n,a,O.lineStartIndex,O.lineLength,-1,I,A,M,C,i.symbolInstances.length,_),Q=i.icon.placedSymbolArray.length-1,h&&(Y=4*_,i.addSymbols(i.icon,h,P,w,b,T,r.dt.vertical,n,a,O.lineStartIndex,O.lineLength,-1,I,A,M,C,i.symbolInstances.length,_),ee=i.icon.placedSymbolArray.length-1)}for(let o in s.horizontal){let l=s.horizontal[o];B||(ei=r.dF(l.text),g?G=X(l):B=W(d,er,a,p,f,m,l,_,c.layout.get("text-rotate").evaluate(T,{},A),y,z));let u=1===l.positionedLines.length;if(K+=H(i,n,a,l,h,c,g,T,y,O,s.vertical?r.dt.horizontal:r.dt.horizontalOnly,u?F(s.horizontal):[o],et,Q,S,I,A,i.symbolInstances.length,M),u)break}s.vertical&&(J+=H(i,n,a,s.vertical,h,c,g,T,y,O,r.dt.vertical,["vertical"],et,ee,S,I,A,i.symbolInstances.length,M));let es=-1,el=(i,r)=>i?Math.max(i,r):r;es=el(G,-1),es=el(Z,es);let eh=+((es=el($,es))>-1);i.glyphOffsetArray.length>=65535&&r.w("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==T.sortKey&&i.addToSortKeyRanges(i.symbolInstances.length,T.sortKey),i.symbolInstances.emplaceBack(a.x,a.y,er.x,er.y,er.z,et.right>=0?et.right:-1,et.center>=0?et.center:-1,et.left>=0?et.left:-1,et.vertical>=0?et.vertical:-1,Q,ee,ei,void 0!==B?B:i.collisionBoxArray.length,void 0!==B?B+1:i.collisionBoxArray.length,void 0!==N?N:i.collisionBoxArray.length,void 0!==N?N+1:i.collisionBoxArray.length,void 0!==k?k:i.collisionBoxArray.length,void 0!==k?k+1:i.collisionBoxArray.length,U||i.collisionBoxArray.length,U?U+1:i.collisionBoxArray.length,p,K,J,q,Y,eh,0,en,eo,es,0,+!!ea,R)}(i,c,b,u,n,o,l,s,i.layers[0],i.collisionBoxArray,a.index,a.sourceLayerIndex,i.index,ei,E,d,0,er,en,S,a,h,p,f,m,g,y,T,k,A,M,C)};if("line"===I)for(let s of r.dc(a.geometry,0,0,r.a6,r.a6))for(let a of function(i,a,n,o,s,l,h,u,c){let d=o?.6*l*h:0,p=w(o,s),f=p*h,m=0===i[0].x||i[0].x===c||0===i[0].y||i[0].y===c;return a-f<a/4&&(a=f+a/4),function i(a,n,o,s,l,h,u,c,d){let p=h/2,f=b(a),m=0,_=n-o,g=[];for(let i=0;i<a.length-1;i++){let n=a[i],u=a[i+1],c=n.dist(u),y=u.angleTo(n);for(;_+o<m+c;){let b=((_+=o)-m)/c,w=r.am(n.x,u.x,b),T=r.am(n.y,u.y,b);if(w>=0&&w<d&&T>=0&&T<d&&_-p>=0&&_+p<=f){let r=new x(w,T,0,y,i);s&&!v(a,r,h,s,l)||g.push(r)}}m+=c}return c||g.length||u||(g=i(a,m/2,o,s,l,h,u,!0,d)),g}(i,m?a/2*u%a:(p/2+2*l)*h*u%a,a,d,n,f,m,!1,c)}(s,et,ea,n.vertical||Y,o,Z,ee,i.overscaling,r.a6))Y&&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,Y.text,eo,a)||es(s,a,m);else if("line-center"===I){for(let i of a.geometry)if(i.length>1){let a=function(i,a,n,o,s,l){let h=n?.6*s*l:0,u=w(n,o)*l,c=0,d=b(i)/2;for(let n=0;n<i.length-1;n++){let o=i[n],s=i[n+1],l=o.dist(s);if(c+l>d){let p=(d-c)/l,f=new x(r.am(o.x,s.x,p),r.am(o.y,s.y,p),0,s.angleTo(o),n);return!h||v(i,f,u,h,a)?f:void 0}c+=l}}(i,ea,n.vertical||Y,o,Z,ee);a&&es(i,a,m)}}else if("Polygon"===a.type)for(let i of r.g4(a.geometry,0)){let a=function(i,a=1,n=!1){let o=1/0,s=1/0,l=-1/0,h=-1/0,u=i[0];for(let i=0;i<u.length;i++){let r=u[i];(!i||r.x<o)&&(o=r.x),(!i||r.y<s)&&(s=r.y),(!i||r.x>l)&&(l=r.x),(!i||r.y>
108h)&&(h=r.y)}let c=Math.min(l-o,h-s),d=c/2,p=new r.fT([],L);if(0===c)return new r.P(o,s);for(let r=o;r<l;r+=c)for(let a=s;a<h;a+=c)p.push(new z(r+d,a+d,d,i));let f=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 z(a/r,n/r,0,i)}(i),m=p.length;for(;p.length;){let r=p.pop();(r.d>f.d||!f.d)&&(f=r,n&&console.log("found best %d after %d probes",Math.round(1e4*r.d)/1e4,m)),r.max-f.d<=a||(d=r.h/2,p.push(new z(r.p.x-d,r.p.y-d,d,i)),p.push(new z(r.p.x+d,r.p.y-d,d,i)),p.push(new z(r.p.x-d,r.p.y+d,d,i)),p.push(new z(r.p.x+d,r.p.y+d,d,i)),m+=4)}return n&&(console.log(`num probes: ${m}`),console.log(`best distance: ${f.d}`)),f.p}(i,16);es(i[0],new x(a.x,a.y,0,0,void 0),m)}else if("LineString"===a.type)for(let i of a.geometry)es(i,new x(i[0].x,i[0].y,0,0,void 0),m);else if("Point"===a.type)for(let i of a.geometry)for(let r of i)es([r],new x(r.x,r.y,0,0,void 0),m)}(i,p,E,n,l,c,f,A,0,M,C,o,s,h,u,S,D,O,m,_,B,k,N,0,0,g,y,T,U)}n&&i.generateCollisionDebugBuffers(l,i.collisionBoxArray,f.textScaleFactor),i.text.uboBinder&&i.text.uboBinder.finalize(),i.icon.uboBinder&&i.icon.uboBinder.finalize()}(n,i[a],this.showCollisionBoxes,u,this.tileID.canonical,this.tileZoom,this.projection,this.brightness,c,s);else if(n.hasPattern&&(n instanceof r.bA||n instanceof r.bB||n instanceof r.aD)){et(n.layers,this.zoom,E.brightness,u,this.worldview,E.activeFloors);let i=Object.fromEntries(s.patternPositions);n.addFeatures(E,this.tileID.canonical,i,u,this.tileTransform,this.brightness)}}this.status="done";let l=Object.values(T).filter(i=>!i.isEmpty());m(null,{buckets:l,containsHdExt:J(l),containsStandardExt:Q(l),featureIndex:y,collisionBoxArray:this.collisionBoxArray,hasTunnelGeometry:a,glyphAtlasImage:n.image,lineAtlas:S,imageAtlas:o,brightness:E.brightness,hasDeferredRoadStructure:this.deferRoadStructure,frcCoveragePolygons:_,hasDeferredElevationFeatures:!!p&&p(T),parsedElevationFeatures:P})};if(l){let i=new Map,a=r.gh(c,i),n=r.gh(d,i),o=new r.gi(a,n,s,this.lut,this.scope,i);f.send("checkAtlasCache",{descriptor:o,scope:this.scope}).then(i=>{let a,n;if(i)a=new r.gj(i.sourceHash),n=i;else{let i=new r.gk(c,d,this.lut,s,this.scope);a=i,n=i}g(a,n)}).catch(i=>{"AbortError"!==i.name&&r.w(`[Worker] Error checking atlas cache: ${i.message}`);let a=new r.gk(c,d,this.lut,s,this.scope);g(a,a)})}else g(null,{iconPositions:new Map,patternPositions:new Map})};if(!this.extraShadowCaster){let i=r.gg(E.glyphDependencies,i=>Object.keys(i).map(Number));Object.keys(i).length?f.send("getGlyphs",{uid:this.uid,stacks:i},{metadata:R}).then(i=>{s||(h=i,D())}).catch(i=>{s||(s=i,D())}):h={},C=new Map;let a=Array.from(E.iconDependencies.keys()).map(i=>r.I.parse(i)),n=Array.from(E.patternDependencies.keys()).map(i=>r.I.parse(i));a.length||n.length?f.send("getImages",{icons:a,patterns:n,source:this.source,scope:this.scope,tileID:this.tileID},{metadata:R}).then(i=>{if(!s){for(let[r,a]of(c=new Map,d=new Map,A=this.updateImageMapAndGetImageTaskQueue(c,i.images,E.iconDependencies),M=this.updateImageMapAndGetImageTaskQueue(d,i.images,E.patternDependencies),i.versions.entries()))C.set(r,a);D()}}).catch(i=>{s||(s=i,D())}):(c=new Map,d=new Map,A=new Map,M=new Map)}o&&o({buckets:T,data:i,sourceLayerCoder:g,canonical:this.tileID.canonical,options:E}),D()};A.length>0?Promise.allSettled(A).then(C).catch(m):C()}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.bq(i.tileID.canonical,i.projection),this.extraShadowCaster=i.extraShadowCaster,this.lut=i.lut,this.worldview=i.worldview,this.indoor=i.indoor,this.frcCoverage=i.frcCoverage||null,this.elevation=i.elevation||null,this.crossSourceElevationEnabled=!!i.crossSourceElevationEnabled,this.terrainEnabled=!!i.terrainEnabled}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,{...o})):i.set(a,o)}return n}cancelRasterize(){this.rasterizeTask&&this.rasterizeTask.abort()}}function et(i,a,n,o,s,l){let h=new r.aj(a,{brightness:n,worldview:s,activeFloors:l});for(let r of i)r.recalculate(h,o)}class ei extends r.E{constructor({actor:i,layerIndex:a,availableImages:n,availableModels:o,isSpriteLoaded:s,tileProvider:l,brightness:h,maxUniformBufferBindings:u,maxUniformBlockSizeDwords:c}){super(),this.actor=i,this.layerIndex=a,this.availableImages=n,this.availableModels=o,this.loadVectorData=r.cH,this.tileProvider=l,this.loading={},this.loaded={},this.deduped=new r.cC(i.scheduler),this.isSpriteLoaded=s,this.scheduler
108=i.scheduler,this.brightness=h,this.maxUniformBufferBindings=u,this.maxUniformBlockSizeDwords=c}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);if(h.data instanceof ImageBitmap)return n(Error("Vector tiles require ArrayBuffer data"));let u=new Headers;h.expires&&u.set("expires",h.expires),h.cacheControl&&u.set("cache-control",h.cacheControl),n(null,{rawData:h.data,headers:u})}catch(i){if(a.signal.aborted)return;n(i instanceof Error?i:Error(String(i)))}}_fetchTileData(i,r){return new Promise((a,n)=>{i.abort=this.loadTileData(r,(i,r)=>{i?n(i):a(r)})})}async _parse(i,r){let a=!this.isSpriteLoaded;return a&&await this.once("isSpriteLoaded"),new Promise((n,o)=>{let s=()=>i.parse(i.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,(i,r)=>{i?o(i):n(r)});a&&this.scheduler?this.scheduler.add(s,{type:"parseTile",renderSourceType:r.renderSourceType,zoom:r.tileZoom}):s()})}async loadTile(i){let n,o,s,l=i.uid,h=i&&i.request,u=h&&h.collectResourceTiming,c=this.loading[l]=new ee(i);c.maxUniformBufferBindings=this.maxUniformBufferBindings,c.maxUniformBlockSizeDwords=this.maxUniformBlockSizeDwords;let d=(i,r)=>{let a=c.reloadCallback;a&&(delete c.reloadCallback,i||!r?a(i,null):c.parse(c.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,a))};try{n=await this._fetchTileData(c,i)}catch(i){o=i}let p=!this.loading[l];if(delete this.loading[l],c.cancelRasterize(),o||p||!n){if(c.status="done",p||(this.loaded[l]=c),o)throw o;return null}let f=n.rawData;c.vectorTile=n.vectorTile||new r.gl(new r.c$(f)),this.loaded=this.loaded||{},this.loaded[l]=c;try{s=await this._parse(c,i)}catch(i){throw d(i),i}if(!s)return d(null,null),null;let m={};if(u){let i=a(h);i.length>0&&(m.resourceTiming=JSON.parse(JSON.stringify(i)))}let _={rawTileData:f.slice(0),headers:n.headers,...s,...m};return d(null,s),_}async reloadTile(i){let r=this.loaded,a=i.uid;if(r&&r[a])return new Promise((n,o)=>{let s=r[a];s.updateParameters(i);let l=(i,r)=>{let a=s.reloadCallback;a&&(delete s.reloadCallback,s.parse(s.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,a)),i?o(i):n(r)};"parsing"===s.status?s.reloadCallback=l:"done"===s.status?s.vectorTile?s.parse(s.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,l):l():n(void 0)})}abortTile(i){let r=i.uid,a=this.loading[r];a&&(a.abort&&a.abort(),delete this.loading[r])}removeTile(i){let r=this.loaded,a=i.uid;r&&r[a]&&delete r[a]}}class er{constructor(i){this.tileProvider=i.tileProvider,this.loading={}}async loadTile(i){let a=i.uid,n=new AbortController;if(this.loading[a]={cancel:()=>n.abort()},this.tileProvider)return this.loadTileWithProvider(this.tileProvider,a,i,n);try{let{data:o,headers:s}=await r.d0(i.request,n.signal);if(!o)return null;let l=await this.decodeTile(a,o,i.encoding);return l.headers=s,l}catch(i){if(n.signal.aborted)return null;throw i}finally{delete this.loading[a]}}async decodeTile(i,a,n){let o=a instanceof ImageBitmap?a:await createImageBitmap(new Blob([new Uint8Array(a)],{type:"image/png"})),s=1-(o.width-r.gm(o.width))/2,l=s<1,h=this.getImageData(o,s);return o.close(),{dem:new r.gn(i,h,n,l),borderReady:l}}async loadTileWithProvider(i,r,a,n){let{z:o,x:s,y:l}=a.tileID.canonical;try{let h=await i.loadTile({z:o,x:s,y:l},{request:a.request,signal:n.signal});if(n.signal.aborted)return null;if(null==h){let i=Error("Tile not found");throw i.status=404,i}if(null==h.data)return null;let u=await this.decodeTile(r,h.data,a.encoding);if(n.signal.aborted)return null;let c=new Headers;return h.expires&&c.set("expires",h.expires),h.cacheControl&&c.set("cache-control",h.cacheControl),u.headers=c,u}catch(i){if(n.signal.aborted)return null;throw i}finally{delete this.loading[r]}}async reloadTile(i){}abortTile(i){let r=i.uid,a=this.loading[r];
108a&&(a.cancel(),delete this.loading[r])}removeTile(i){}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}}let ea=r.go.prototype.toGeoJSON;class en{constructor(i){this._feature=i,this.extent=r.a6,this.type=4===i.type?1:i.type,this.properties=i.tags||{},"id"in i&&!isNaN(i.id)&&(this.id=parseInt(i.id,10))}loadGeometry(){let i=this._feature,a=[];if(4===i.type)a.push([new r.P(i.x,i.y)]);else if(1===i.type)for(let n=0;n<i.geometry.length;n+=2)a.push([new r.P(i.geometry[n],i.geometry[n+1])]);else for(let n of i.geometry){let i=[];for(let a=0;a<n.length;a+=2)i.push(new r.P(n[a],n[a+1]));a.push(i)}return a}toGeoJSON(i,r,a){return ea.call(this,i,r,a)}}class eo{constructor(i,a){this.name=i,this.extent=r.a6,this.length=a.length,this._jsonFeatures=a}feature(i){return new en(this._jsonFeatures[i])}}class es{constructor(i){for(let a of(this.layers={},this.extent=r.a6,Object.keys(i)))this.layers[a]=new eo(a,i[a])}}let el=64/4096;class eh{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);if(n&&this.updateCache(n,r),a.geometry){let n=function(i){let{id:r,geometry:a,properties:n}=i;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)ec(s,h,l);else if("MultiPoint"===o)for(let i of s)ec(i,h,l);else if("LineString"===o)l.type=2,ed(s,h,l);else if("MultiLineString"===o)l.type=2,ep(s,h,l);else if("Polygon"===o)l.type=3,ep(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))ep(i,h,l,!0)}return l}(a);this.updateCache(n,r),this.features.set(i,n)}else this.features.delete(i)}}updateCache(i,r){for(let{canonical:a,uid:n}of Object.values(r)){let{z:o,x:s,y:l}=a;eu(i,Math.pow(2,o),s,l)&&delete r[n]}}getTileRaw(i,a,n){let o=Math.pow(2,i),s=[];for(let i of this.features.values())eu(i,o,a,n)&&s.push(function(i,a,n,o){let{id:s,type:l,geometry:h,tags:u}=i;if(1===l){if(2===h.length)return{id:s,type:4,x:ef(h[0],a,n),y:ef(h[1],a,o),tags:u};let i=new Int32Array(h.length);for(let r=0;r<h.length;r+=2)i[r]=ef(h[r],a,n),i[r+1]=ef(h[r+1],a,o);return{id:s,type:1,geometry:i,tags:u}}let c=[];if(2===l){let i=[];for(let s of h)!function(i,a,n,o,s){let l,h=r.a6+128;for(let r=0;r<i.length-2;r+=2){let u=ef(i[r+0],a,n),c=ef(i[r+1],a,o),d=ef(i[r+2],a,n),p=ef(i[r+3],a,o),f=d-u,m=p-c;u<-128&&d<-128||(u<-128?(c+=Math.round((-128-u)/f*m),u=-128):d<-128&&(p=c+Math.round((-128-u)/f*m),d=-128),c<-128&&p<-128||(c<-128?(u+=Math.round((-128-c)/m*f),c=-128):p<-128&&(d=u+Math.round((-128-c)/m*f),p=-128),u>=h&&d>=h||(u>=h?(c+=Math.round((h-u)/f*m),u=h):d>=h&&(p=c+Math.round((h-u)/f*m),d=h),c>=h&&p>=h||(c>=h?(u+=Math.round((h-c)/m*f),c=h):p>=h&&(d=u+Math.round((h-c)/m*f),p=h),l&&u===l.at(-2)&&c===l.at(-1)||(l=[u,c],s.push(l)),l.push(d,p)))))}}(s,a,n,o,i);for(let r of i)c.push(new Int32Array(r))}else for(let i of h)!function(i,r,a,n,o){let s=(a-el)/r,l=(n-el)/r,h=(a+1+el)/r,u=(n+1+el)/r;function c(i,r){let a=0;return i<s?a|=1:i>h&&(a|=2),r<l?a|=4:r>u&&(a|=8),a}let d=[];for(let r=1;r<=8;r*=2){let a=i.at(-2),n=i.at(-1),o=!(c(a,n)&r);for(let p=0;p<i.length;p+=2){let f=i[p],m=i[p+1],_=!(c(f,m)&r);_!==o&&(8&r?d.push(a+(f-a)*(u-n)/(m-n),u):4&r?d.push(a+(f-a)*(l-n)/(m-n),l):2&r?d.push(h,n+(m-n)*(h-a)/(f-a)):1&r&&d.push(s,n+(m-n)*(s-a)/(f-a))),_&&d.push(f,m),a=f,n=m,o=_}if(!(i=d).length||8===r)break;d=[]}if(!d.length)return;let p=new Int32Array(d.length);for(let i=0;i<d.length;i+=2)p[i]=ef(d[i],r,a),p[i+1]=ef(d[i+1],r,n);o.push(p)}(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 eu({minX:i,minY:r,maxX:a,maxY:n},o,s,l){return i<(s+1+el)/o&&r<(l+1+el)/o&&a>(s-el)/o&&n>(l-el)/o}function ec([i,a],n,o){let s=r.a7(i),l=r.a8(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 ed(i,r,a,n=!1,o=!1){let s=[];for(let r of i)ec(r,s,a);
108r.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 ep(i,r,a,n=!1){for(let o=0;o<i.length;o++)ed(i[o],r,a,n,0===o)}function ef(i,a,n){return Math.round(r.a6*(i*a-n))}function em({name:i,features:a},n){n.writeStringField(1,i),n.writeVarintField(5,r.a6);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,e_,l);for(let i of o.keys())n.writeStringField(3,i);for(let i of s.keys())n.writeMessage(4,eb,i)}function e_(i,r){let a=i.feature;void 0!==a.id&&Number.isSafeInteger(+a.id)&&r.writeVarintField(1,+a.id),a.tags&&r.writeMessage(2,eg,i),r.writeVarintField(3,4===a.type?1:a.type),r.writeMessage(4,ev,a)}function eg({keys:i,values:r,feature:a},n){let o=a.tags;for(let a of Object.keys(o)){let s=o[a];if(null===s)continue;let l=i.get(a);void 0===l&&(l=i.size,i.set(a,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 ey(i,r){return(r<<3)+(7&i)}function ex(i){return i<<1^i>>31}function ev(i,r){if(4===i.type)return r.writeVarint(ey(1,1)),r.writeVarint(ex(i.x)),void r.writeVarint(ex(i.y));let a=0,n=0;if(1===i.type){let{geometry:o}=i;r.writeVarint(ey(1,o.length>>1));for(let i=0;i<o.length;i+=2){let s=o[i]-a,l=o[i+1]-n;r.writeVarint(ex(s)),r.writeVarint(ex(l)),a+=s,n+=l}}else{let o=3===i.type;for(let s of i.geometry){if(0===s.length)continue;r.writeVarint(ey(1,1));let i=(s.length>>1)-!!o;for(let o=0;o<i;o++){1===o&&r.writeVarint(ey(2,i-1));let l=s[2*o]-a,h=s[2*o+1]-n;r.writeVarint(ex(l)),r.writeVarint(ex(h)),a+=l,n+=h}o&&r.writeVarint(ey(7,1))}}}function eb(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 ew={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:i=>i},eT=i=>(i-.5)*0x40000000,eS=i=>9313225746154785e-25*i+.5;class eE{constructor(i){let r=this.options=Object.assign(Object.create(ew),i);r.maxZoom=Math.min(r.maxZoom,30),r.minZoom=Math.min(r.minZoom,r.maxZoom),this.trees=Array(r.maxZoom+1),this.stride=r.reduce?7:6,this.clusterProps=[]}load(i){let{log:r,minZoom:a,maxZoom:n}=this.options;r&&console.time("total time");let o=n+1,s=`z${o}: ${i.length} points`;r&&console.time(s);let l=this.stride,h=i.length;for(let r of i){let i=r.geometry;i&&"MultiPoint"===i.type&&(h+=i.coordinates.length-1)}this.numPoints=h;let u=this.props=Array(h),c=this.coords=new Float64Array(2*h),d=null,p=new Int32Array(h*l),f=0,m=0;for(let r of i){let i=r.geometry;if(!i){m++;continue}let a=i.coordinates,n="MultiPoint"===i.type;for(let i=0,s=n?a.length:1;i<s;i++,m++){let[s,_]=n?a[i]:a,g=eA(s),y=eM(_);c[2*m]=g,c[2*m+1]=y,p[f]=eT(g),p[f+1]=eT(y),p[f+2]=o,p[f+3]=m,p[f+4]=-1,p[f+5]=1,u[m]=r.properties,void 0!==r.id&&(d||(d=Array(h)),d[m]=r.id),f+=l}}this.ids=d;let _=f===p.length?p:p.subarray(0,f),g=f/l;this.trees[n+1]=this._createTree(_,g),r&&console.timeEnd(s);let y=null;for(let i=n;i>=a;i--){let a=performance.now(),n=y||new Int32Array(g*l);y=null;let o=this._cluster(_,g,i,n);o===g?(this.trees[i]=this.trees[i+1],y=n):(this.trees[i]=this._createTree(n,o),_=n,g=o),r&&console.log(`z${i}: ${this.trees[i].numItems} clusters in ${(performance.now()-a).toFixed(2)}ms`)}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(eT(eA(a)),eT(eM(s)),eT(eA(o)),eT(eM(n))),u=l.data,c=[];for(let i of h)c.push(this._featureJSON(u,this.stride*i));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>=o.numItems)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],0x40000000*l),u=[];for(let r of h){let a=r*this.stride;s[a+4]===i&&u.push(this._featureJSON(s,a))}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){return this._getTile(i,r,a,!1)}getTileRaw(i,r,a){return this._getTile(i,r,a,!0)}_getTile(i,r,a,n){let o=this.trees[this._limitZoom(i)],s=Math.pow(2,i),{extent:l,radius:h}=this.options,u=h/l,c=eT((a-u)/s),d=eT((a+1+u)/s),p={features:[]};return this._addTileFeatures(o.range(eT((r-u)/s),c,eT((r+1+u)/s),d),o.data,r,a,s,p,n),0===r&&this._addTileFeatures(o.range(eT(1-u/s),c,eT(1),d),o.data,s,a,s,p,n),r===s-1&&this._addTileFeatures(o.range(eT(0),c,eT(u/s),d),o.data,-1,a,s,p,n),p.features.length?p: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,a){let n=new r.dx(a,this.options.nodeSize,Int32Array),o=this.stride;for(let r=0;r<a;r++)n.add(i[r*o],i[r*o+1]);return n.finish(),n.data=i,n}_addTileFeatures(i,r,a,n,o,s,l){for(let h of i){let i,u,c,d=h*this.stride,p=r[d+5]>1;if(p)i=eI(r,d,this.clusterProps),u=eS(r[d]),c=eS(r[d+1]);else{let a=r[d+3];i=this.props[a],u=this.coords[2*a],c=this.coords[2*a+1]}let f=Math.round(this.options.extent*(u*o-a)),m=Math.round(this.options.extent*(c*o-n)),_=l?{type:4,x:f,y:m,tags:i}:{type:1,geometry:[[f,m]],tags:i},g=r[d+3],y=p||this.options.generateId?g:this.ids?this.ids[g]:void 0;void 0!==y&&(_.id=y),s.features.push(_)}}_limitZoom(i){return Math.max(this.options.minZoom,Math.min(Math.floor(+i),this.options.maxZoom+1))}_cluster(i,r,a,n){let{radius:o,extent:s,reduce:l,minPoints:h,maxZoom:u}=this.options,c=o/(s*(1<<a))*0x40000000,d=u+1,p=this.trees[a+1],f=this.stride,m=r*f,_=new Uint32Array(r),g=0;for(let r=0;r<m;r+=f){if(i[r+2]<=a)continue;i[r+2]=a;let o=i[r],s=i[r+1],u=p.withinInto(o,s,c,_),m=i[r+5],y=m;for(let r=0;r<u;r++){let n=_[r]*f;i[n+2]>
108a&&(y+=i[n+5])}if(y>m&&y>=h){let h,c=o*m,p=s*m,x=-1,v=(r/f<<5)+(a+1)+this.numPoints;for(let n=0;n<u;n++){let o=_[n]*f;if(i[o+2]<=a)continue;i[o+2]=a;let s=i[o+5];c+=i[o]*s,p+=i[o+1]*s,i[o+4]=v,l&&(h||(h=this._map(i,r,!0),x=this.clusterProps.length,this.clusterProps.push(h)),l(h,this._map(i,o)))}i[r+4]=v,n[g]=c/y,n[g+1]=p/y,n[g+2]=d,n[g+3]=v,n[g+4]=-1,n[g+5]=y,l&&(n[g+6]=x),g+=f}else{for(let a=0;a<f;a++)n[g+a]=i[r+a];if(g+=f,y>1)for(let r=0;r<u;r++){let o=_[r]*f;if(!(i[o+2]<=a)){i[o+2]=a;for(let r=0;r<f;r++)n[g+r]=i[o+r];g+=f}}}}return g/f}_getOriginId(i){return i-this.numPoints>>5}_getOriginZoom(i){return(i-this.numPoints)%32}_featureJSON(i,r){let a=i[r+3],n=i[r+5]>1,o=n?a:this.ids?this.ids[a]:void 0,s={type:"Feature",properties:n?eI(i,r,this.clusterProps):this.props[a],geometry:{type:"Point",coordinates:n?[360*(eS(i[r])-.5),eC(eS(i[r+1]))]:[360*(this.coords[2*a]-.5),eC(this.coords[2*a+1])]}};return void 0!==o&&(s.id=o),s}_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.props[i[r+3]],o=this.options.map(n);return a&&o===n?Object.assign({},o):o}}function eI(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 eA(i){return i/360+.5}function eM(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 eC(i){return 360*Math.atan(Math.exp((180-360*i)*Math.PI/180))/Math.PI-90}function eP(i,r,a,n){return{id:i,type:4,x:r,y:a,tags:n}}function eR(i,r,a,n){let o={id:i,type:r,geometry:a,tags:n,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(1===r)eD(o,a,0,a.length);else{let i=3===r;for(let r=0;r<a.length;){let n=r+2,s=n+3*a[r];(!i||a[r+1]>=0)&&eD(o,a,n,s),r=s}}return o}function eD(i,r,a,n){for(let o=a;o<n;o+=3){let a=r[o],n=r[o+1];a<i.minX&&(i.minX=a),n<i.minY&&(i.minY=n),a>i.maxX&&(i.maxX=a),n>i.maxY&&(i.maxY=n)}}let eL="Input data is not a valid GeoJSON object.";function ez(i,r,a,n){let o=r.geometry;if(!o)return;let s="GeometryCollection"===o.type?o.geometries:o.coordinates;if(!s)throw Error(eL);if(!s.length)return;let l=a.tolerance*a.worldScale/((1<<a.maxZoom)*a.extent),h=l*l,u=r.properties,c=a.CoordArray,d=a.worldScale,p=a.originShift,f=a.useInt32,m=r.id;if(a.promoteId?m=r.properties?.[a.promoteId]:a.generateId&&(m=n||0),"Point"===o.type)i.push(eP(m,eV(o.coordinates[0],d,p),eU(o.coordinates[1],d,p),u));else if("MultiPoint"===o.type){let r=o.coordinates,n=new c(3*r.length);for(let i=0;i<r.length;i++)n[3*i]=eN(eV(r[i][0],d,p),f),n[3*i+1]=eN(eU(r[i][1],d,p),f);eO(i,m,1,n,u,a)}else if("LineString"===o.type)eB(i,m,o.coordinates,u,h,a);else if("MultiLineString"===o.type&&a.lineMetrics)for(let r of o.coordinates)eB(i,m,r,u,h,a);else if("MultiLineString"===o.type||"Polygon"===o.type||"MultiPolygon"===o.type){let r="MultiLineString"!==o.type,n="MultiPolygon"===o.type?o.coordinates:[o.coordinates],s=0;for(let i of n)s+=function(i){let r=0;for(let a of i)a.length>0&&(r+=2+3*a.length);return r}(i);let l=new c(s),_=0;for(let i of n)for(let a=0;a<i.length;a++)_=ek(l,_,i[a],h,r,r&&0===a,d,p,f);eO(i,m,r?3:2,l,u,a)}else{if("GeometryCollection"!==o.type)throw Error(eL);for(let s of o.geometries)ez(i,{id:m,geometry:s,properties:r.properties},a,n)}}let eF=0;function eO(i,r,a,n,o,s,l){let h=eR(r,a,n,o);2===a&&s.lineMetrics&&(h.start=0,h.end=h.size=l),i.push(h)}function eB(i,r,a,n,o,s){let l=new s.CoordArray(2+3*a.length);ek(l,0,a,o,!1,!1,s.worldScale,s.originShift,s.useInt32),eO(i,r,2,l,n,s,eF)}function ek(i,r,a,n,o,s,l,h,u){if(0===a.length)return r;let c=r,d=r+=2,p=0,f=0,m=0;for(let n=0;n<a.length;n++){let s=eN(eV(a[n][0],l,h),u),c=eN(eU(a[n][1],l,h),u);if(i[r]=s,i[r+1]=c,r+=3,n>0)if(o)m+=(p*c-s*f)/2;else{let i=s-p,r=c-f;m+=Math.sqrt(i*i+r*r)}p=s,f=c}let _=r;if(o&&(s&&m<0||!s&&m>=0)){let r=_-d;for(let a=0;a<r/2;a+=3){let r=d+a,n=_-3-a,o=i[r],s=i[r+1],l=i[r+2];i[r]=i[n],i[r+1]=i[n+1],i[r+2]=i[n+2],i[n]=o,i[n+1]=s,i[n+2]=l}m=-m}let g=_-3;return i[d+2]=0x7fffffff,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);
108if(a>s)h=i,s=a;else if(a===s){let r=Math.abs(i-l);r<u&&(h=i,u=r)}}if(s>o){let l=h;l-a>3&&i(r,a,l,o),r[l+2]=Math.min(Math.sqrt(s),0x7fffffff),n-l>3&&i(r,l,n,o)}}(i,d,g,n),i[g+2]=0x7fffffff,i[c]=(_-d)/3,o?i[c+1]=Math.sign(m)*Math.sqrt(Math.abs(m)):(eF=m,i[c+1]=Math.min(m,0x7fffffff)),r}function eN(i,r){return r?Math.floor(i+.5):i}function eV(i,r,a){return(i/360+.5-a)*r}function eU(i,r,a){let n=Math.sin(i*Math.PI/180),o=.5-.25*Math.log((1+n)/(1-n))/Math.PI;return((o<0?0:o>1?1:o)-a)*r}function ej(i,r,a,n,o,s,l){if(o>=r&&s<a)return i;if(s<r||o>=a)return null;let h=l.lineMetrics,u=l.CoordArray,c=null;for(let o=0;o<i.length;o++){let s=i[o],l=s.type;if(4===l){let l=0===n?s.x:s.y;l>=r&&l<a?null!==c&&c.push(s):null===c&&(c=i.slice(0,o));continue}let d=s.geometry,p=0===n?s.minX:s.minY,f=0===n?s.maxX:s.maxY;p>=r&&f<a?null!==c&&c.push(s):f<r||p>=a?null===c&&(c=i.slice(0,o)):(null===c&&(c=i.slice(0,o)),1!==l?function(i,r,a,n,o,s,l,h,u){let c=3===r,d=0;for(let r=0;r<i.length;){let s=r+2+3*i[r];d+=function(i,r,a,n,o,s,l){let h=0,u=0,c=0,d=0;for(let p=r;p<a-3;p+=3){let r=i[p+s],a=i[p+3+s],f=!1;r<n?a>=n&&(c++,d++):r>o?a<=o&&(c++,d++):c++,a<n&&r>=n&&(c++,d++,f=!0),a>o&&r<=o&&(c++,d++,f=!0),!l&&f&&(c>0&&(u+=c,h++),c=0)}let p=i[a-3+s];return p>=n&&p<=o&&c++,l&&c>=2&&d>=1&&c++,c>0&&(u+=c,h++),3*u+2*h}(i,r+2,s,a,n,o,c),r=s}if(0===d)return;let p=new u(d),f=u===Int32Array,m=h&&2===r?[]:null,_=0;for(let r=0;r<i.length;){let l=r+2+3*i[r];_=function(i,r,a,n,o,s,l,h,u,c,d,p,f){let m=null!==p,_=s;o[s]=0,o[s+1]=n;let g=s+=2,y=f,x=y,v=0,b=0;for(let f=r;f<a-3;f+=3){let r=i[f],a=i[f+1],w=i[f+2],T=i[f+3],S=i[f+4],E=0===u?r:a,I=0===u?T:S,A=!1;if(m&&(v=Math.sqrt((r-T)*(r-T)+(a-S)*(a-S))),E<l?I>=l&&(b=eG(o,s,r,a,T,S,l,u,d),s+=3,m&&(x=y+v*b)):E>h?I<=h&&(b=eG(o,s,r,a,T,S,h,u,d),s+=3,m&&(x=y+v*b)):(o[s]=r,o[s+1]=a,o[s+2]=w,s+=3),I<l&&E>=l&&(b=eG(o,s,r,a,T,S,l,u,d),s+=3,A=!0),I>h&&E<=h&&(b=eG(o,s,r,a,T,S,h,u,d),s+=3,A=!0),!c&&A){let i=(s-g)/3;i>0&&(o[_]=i,m&&p.push(x,y+v*b),_=s,o[s]=0,o[s+1]=n,g=s+=2)}m&&(y+=v)}let w=a-3,T=i[w],S=i[w+1],E=i[w+2],I=0===u?T:S;I>=l&&I<=h&&(o[s]=T,o[s+1]=S,o[s+2]=E,s+=3),c&&s-g>=6&&(o[s-3]!==o[g]||o[s-2]!==o[g+1])&&(o[s]=o[g],o[s+1]=o[g+1],o[s+2]=o[g+2],s+=3);let A=(s-g)/3;return A>0?(o[_]=A,m&&p.push(x,y)):s=_,s}(i,r+2,l,i[r+1],p,_,a,n,o,c,f,m,s.start||0),r=l}if(_<d&&(p=p.subarray(0,_)),null!==m)for(let i=0,r=0;i<p.length;r+=2){let a=i+2+3*p[i],n=eR(s.id,2,p.slice(i,a),s.tags);n.start=m[r],n.end=m[r+1],n.size=s.size,l.push(n),i=a}else l.push(eR(s.id,r,p,s.tags))}(d,l,r,a,n,s,c,h,u):function(i,r,a,n,o,s,l){let h=0;for(let o=0;o<i.length;o+=3)i[o+n]>=r&&i[o+n]<a&&(h+=3);if(0===h)return;let u=new l(h),c=0;for(let o=0;o<i.length;o+=3)i[o+n]>=r&&i[o+n]<a&&(u[c]=i[o],u[c+1]=i[o+1],u[c+2]=i[o+2],c+=3);s.push(eR(o.id,1,u,o.tags))}(d,r,a,n,s,c,u))}return null===c?i:c.length?c:null}function eG(i,r,a,n,o,s,l,h,u){let c;if(0===h){let h=n+(s-n)*(c=(l-a)/(o-a));i[r]=l,i[r+1]=u?Math.floor(h+.5):h}else{let h=a+(o-a)*(c=(l-n)/(s-n));i[r]=u?Math.floor(h+.5):h,i[r+1]=l}return i[r+2]=0x7fffffff,c}function eZ(i,r){let a=[];for(let n of i){if(4===n.type){a.push(eP(n.id,n.x+r,n.y,n.tags));continue}let i=function(i,r,a){let n=i.slice();if(1===r)for(let i=0;i<n.length;i+=3)n[i]+=a;else for(let i=0;i<n.length;){let r=i+2+3*n[i];for(let o=i+2;o<r;o+=3)n[o]+=a;i=r}return n}(n.geometry,n.type,r),o=eR(n.id,n.type,i,n.tags);void 0!==n.start&&(o.start=n.start,o.end=n.end,o.size=n.size),a.push(o)}return a}function e$(i,r,a,n,o,s){return Math.round(n*((i/o+s)*r-a))}let eH={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class eq{constructor(i,r){let a=this.options=Object.assign(Object.create(eH),r),n=a.debug;if(n&&console.time("preprocess data"),a.maxZoom<0||a.maxZoom>24)throw Error("maxZoom should be in the 0-24 range");if(a.promoteId&&a.generateId)throw Error("promoteId and generateId cannot be used together.");let o=(a.extent+2*a.buffer)*(1<<a.maxZoom)<0x100000000;a.useInt32=o,a.CoordArray=o?Int32Array:Float64Array,a.worldScale=o?a.extent*(1<<a.maxZoom):1,a.originShift=.5*!!o;let s=function(i,r){let a=[];
108if("FeatureCollection"===i.type)for(let n=0;n<i.features.length;n++)ez(a,i.features[n],r,n);else ez(a,"Feature"===i.type?i:{geometry:i,properties:null},r);return a}(i,a);if(this.tiles={},this.tileCoords=[],this.stats={},this.total=0,n&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",a.indexMaxZoom,a.indexMaxPoints),console.time("generate tiles")),(s=function(i,r){let a=r.worldScale,n=r.originShift,o=r.buffer*a/r.extent,s=-n*a,l=(1-n)*a,h=i,u=ej(i,s-a-o,s+o,0,s-a,l+a,r),c=ej(i,l-o,l+a+o,0,s-a,l+a,r);return(u||c)&&(h=ej(i,s-o,l+o,0,s-a,l+a,r)||[],u&&(h=eZ(u,a).concat(h)),c&&(h=h.concat(eZ(c,-a)))),h}(s,a)).length&&this.splitTile(s,0,0,0),n){let i=this.tiles[0];i&&console.log(`features: ${i.numFeatures}, points: ${i.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],u=[r,a,n],c=this.options,d=c.debug;for(;h.length;){n=u.pop(),a=u.pop(),r=u.pop(),i=h.pop();let p=1<<r,f=eX(r,a,n),m=this.tiles[f];if(m||(d>1&&console.time("creation"),m=this.tiles[f]=function(i,r,a,n,o){let s=o.extent,l=o.worldScale,h=o.originShift,u=r===o.maxZoom?0:o.tolerance*l/((1<<r)*s),c=1<<r,d=s+o.buffer<=32767?Int16Array:Int32Array,p={features:[],numPoints:0,numSimplified:0,numFeatures:i.length,source:null,x:a,y:n,z:r,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};for(let r of i)!function(i,r,a,n,o,s,l,h,u,c,d){let p,f=r.type;if(4===f){let a=r.x,n=r.y;a<i.minX&&(i.minX=a),n<i.minY&&(i.minY=n),a>i.maxX&&(i.maxX=a),n>i.maxY&&(i.maxY=n),i.numPoints++,i.numSimplified++;let u={x:e$(a,o,s,h,c,d),y:e$(n,o,l,h,c,d),type:4,tags:r.tags||null};return void 0!==r.id&&(u.id=r.id),i.features.push(u)}let m=r.geometry;if(r.minX<i.minX&&(i.minX=r.minX),r.minY<i.minY&&(i.minY=r.minY),r.maxX>i.maxX&&(i.maxX=r.maxX),r.maxY>i.maxY&&(i.maxY=r.maxY),1===f){let r=m.length/3;p=new u(2*r);for(let i=0,r=0;i<m.length;i+=3,r+=2)p[r]=e$(m[i],o,s,h,c,d),p[r+1]=e$(m[i+1],o,l,h,c,d);if(i.numPoints+=r,i.numSimplified+=r,!p.length)return}else{p=[];for(let r=0;r<m.length;){let n=r+2,f=n+3*m[r];(function(i,r,a,n,o,s,l,h,u,c,d,p,f,m,_){let g=(n-a)/3;if(Math.abs(o)<l)return s.numPoints+=g;let y=0;if(0===l)y=g;else for(let i=a;i<n;i+=3)r[i+2]>l&&y++;s.numPoints+=g,s.numSimplified+=y;let x=new f(2*y),v=0;for(let i=a;i<n;i+=3)(0===l||r[i+2]>l)&&(x[v++]=e$(r[i],u,c,p,m,_),x[v++]=e$(r[i+1],u,d,p,m,_));i.push(x)})(p,m,n,f,m[r+1],i,a,0,o,s,l,h,u,c,d),r=f}if(!p.length)return}let _=r.tags||null;if(2===f&&n.lineMetrics){for(let i in _={},r.tags)_[i]=r.tags[i];let i=r.start,a=r.end,n=r.size,s=h*o/c;_.mapbox_clip_feature_len=n*s,_.mapbox_clip_seg_len=(a-i)*s,_.mapbox_clip_start=n>0?Math.max(0,i/n):0,_.mapbox_clip_end=a>=n?1:a/n}let g={geometry:p,type:f,tags:_};void 0!==r.id&&(g.id=r.id),i.features.push(g)}(p,r,u,o,c,a,n,s,d,l,h);return p}(i,r,a,n,c),this.tileCoords.push({z:r,x:a,y:n}),this.stats[r]=(this.stats[r]||0)+1,this.total++,d>1&&(console.log(`tile z${r}-${a}-${n} (features: ${m.numFeatures}, points: ${m.numPoints}, simplified: ${m.numSimplified})`),console.timeEnd("creation"))),m.source=i,null==o){if(r===c.indexMaxZoom||m.numPoints<=c.indexMaxPoints)continue}else{if(r===c.maxZoom||r===o)continue;{let i=o-r;if(a!==s>>i||n!==l>>i)continue}}if(m.source=null,0===i.length)continue;d>1&&console.time("clipping");let _=c.worldScale,g=c.originShift,y=_/p,x=.5*c.buffer*_/(p*c.extent),v=(a/p-g)*_,b=(n/p-g)*_,w=null,T=null,S=null,E=null,I=ej(i,v-x,v+y/2+x,0,m.minX,m.maxX,c),A=ej(i,v+y/2-x,v+y+x,0,m.minX,m.maxX,c);I&&(w=ej(I,b-x,b+y/2+x,1,m.minY,m.maxY,c),T=ej(I,b+y/2-x,b+y+x,1,m.minY,m.maxY,c)),A&&(S=ej(A,b-x,b+y/2+x,1,m.minY,m.maxY,c),E=ej(A,b+y/2-x,b+y+x,1,m.minY,m.maxY,c)),d>1&&console.timeEnd("clipping"),h.push(w||[],T||[],S||[],E||[]),u.push(r+1,2*a,2*n,r+1,2*a,2*n+1,r+1,2*a+1,2*n,r+1,2*a+1,2*n+1)}}getTile(i,r,a){let n=this.findTile(i,r,a);return n?function(i){let r=[];for(let a of i.features){let i;i=4===a.type?{type:1,geometry:[[a.x,a.y]],tags:a.tags??null}:1===a.type?{type:1,geometry:eW(a.geometry),tags:a.tags??null}:{type:a.type,geometry:a.geometry.map(eW),tags:a.tags??null},null!=a.id&&(i.id=a.id),r.push(i)}return{features:r}}(n):null}getTileRaw(i,r,a){let n=this.findTile(i,r,a);return n?{features:n.features}:null}findTile(i,r,a){let n=this.options.debug;if((i*=1)<0||i>24)return null;let o=1<<i,s=eX(i,r=(r*=1)+o&o-1,a*=1);if(this.tiles[s])return this.tiles[s];n>1&&console.log("drilling down to z%d-%d-%d",i,r,a);let l,h=i,u=r,c=a;for(;!l&&h>0;)h--,u>>=1,c>>=1,l=this.tiles[eX(h,u,c)];return l&&l.source?(n>1&&(console.log("found parent tile z%d-%d-%d",h,u,c),console.time("drilling down")),this.splitTile(l.source,h,u,c,i,r,a),n>1&&console.timeEnd("drilling down"),this.tiles[s]??null):null}}function eW(i){let r=[];for(let a=0;a<i.length;a+=2)r.push([i[a],i[a+1]]);return r}function eX(i,r,a){return 32*((1<<i)*a+r)+i}function eY(i,a){let n=i.tileID.canonical;if(!this._geoJSONIndex)return void a(null,null);let o=this._geoJSONIndex.getTileRaw(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(s),h={_geojsonTileLayer:o.features};l.length>0&&(h={_geojsonTileLayer:o.features.filter(i=>!s(i)),hd_road_elevation:l}),a(null,{vectorTile:new es(h),rawData:function(i){let a=new r.gp;for(let r of Object.keys(i))a.writeMessage(3,em,{name:r,features:i[r]});return a.finish()}(h).buffer,headers:new Headers})}class eK extends ei{constructor(i){super(i),this.loadVectorData=eY,this._dynamicIndex=new eh}async loadData(i){let n=i&&i.request,o=n&&n.collectResourceTiming;this._geoJSONIndex=null;let s=await new Promise((r,a)=>{this.loadGeoJSON(i,(i,n)=>{i?a(i):r(n)})});if(!s)return{};if("object"!=typeof s)throw Error(`Input data given to '${i.source}' is not a valid GeoJSON object.`);if(i.filter){let a=r.c(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(", "));s.features=s.features.filter(i=>a.value.evaluate({zoom:0},i))}i.dynamic?("Feature"===s.type&&(s={type:"FeatureCollection",features:[s]}),i.append||(this._dynamicIndex.clear(),this.loaded={}),this._dynamicIndex.load(s.features,this.loaded),i.cluster&&(s.features=this._dynamicIndex.getFeatures())):this.loaded={},this._geoJSONIndex=i.cluster?new eE(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.c(l),u=r.c("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(s.features):i.dynamic?this._dynamicIndex:new eq(s,i.geojsonVtOptions);let l={};if(o){let r=a(n);r&&(l.resourceTiming={},l.resourceTiming[i.source]=JSON.parse(JSON.stringify(r)))}return l}async reloadTile(i){let r=this.loaded;if(r&&r[i.uid]){if(i.partial)return;return super.reloadTile(i)}return this.loadTile(i)}loadGeoJSON(i,a){if(i.request)r.g(i.request).then(({data:i})=>a(null,i)).catch(i=>a(i));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){return this._geoJSONIndex.getClusterExpansionZoom(i.clusterId)}getClusterChildren(i){return this._geoJSONIndex.getChildren(i.clusterId)}getClusterLeaves(i){return this._geoJSONIndex.getLeaves(i.clusterId,i.limit,i.offset)}}r.c_.setPbf(r.c$);class eJ{constructor(i){this._mrt=new r.c_(i.partial?30:1/0),this._isHeaderLoaded=!1,this.uid=i.uid,this.tileID=i.tileID,this.source=i.source}async parse(i){let a=this._mrt;this.status="parsing",this._entireBuffer=i,a.parseHeader(i),this._isHeaderLoaded=!0;let n=[];for(let o in a.layers){let s=a.getLayer(o),l=s.getDataRange(s.getBandList()),h=a.createDecodingTask(l),u=i.slice(l.firstByte,l.lastByte+1);n.push(r.c_.performDecoding(u,h).then(i=>h.complete(null,i)).catch(i=>h.complete(i,null)))}return await Promise.allSettled(n),a}}class eQ{constructor({actor:i}){this.actor=i,this.loading={},this.loaded={}}async loadTile(i){let a=i.uid,n=new AbortController,o=this.loading[a]=new eJ(i);o.abort=()=>n.abort();try{let{data:s,headers:l}=await r.d0(i.request,n.signal);return s?(this.loaded[a]=o,{mrt:await o.parse(s),headers:l}):(o.status="done",this.loaded[a]=o,null)}catch(i){if(n.signal.aborted)return null;throw o.status="done",this.loaded[a]=o,i}finally{delete this.loading[a]}}async reloadTile(i){}abortTile(i){let r=i.uid,a=this.loading[r];a&&(a.abort&&a.abort(),delete this.loading[r])}removeTile(i){let r=i.uid;this.loaded[r]&&delete this.loaded[r]}async decodeRasterArray(i){return r.c_.performDecoding(i.buffer,i.task)}}class e0{constructor(i){this.self=i,this.actor=new r.ax(i,this),this.layerIndexes={},this.availableImages={},this.availableModels={},this.isSpriteLoaded={},this.rtlPluginParsingListeners=[],this.projections={},this.defaultProjection=r.gr({name:"mercator"}),this.workerSourceTypes={vector:ei,geojson:eK,"raster-dem":er},this.workerSources={},this.self.registerRTLTextPlugin=i=>{if(r.fN.isParsed())throw Error("RTL text plugin already registered.");for(let{resolve:a}of(r.fN.setState({pluginStatus:r.gs.parsed,pluginURL:r.fN.getPluginURL()}),r.fN.applyArabicShaping=i.applyArabicShaping,r.fN.processBidirectionalText=i.processBidirectionalText,r.fN.processStyledBidirectionalText=i.processStyledBidirectionalText,this.rtlPluginParsingListeners))a(!0);this.rtlPluginParsingListeners=[]}}clearCaches(i,r){delete this.layerIndexes[i],delete this.availableImages[i],delete this.availableModels[i],delete this.workerSources[i],delete this.isSpriteLoaded[i]}checkIfReady(i,r){}spriteLoaded(i,a){let{scope:n}=a;if(this.isSpriteLoaded[i]||(this.isSpriteLoaded[i]={}),this.isSpriteLoaded[i][n]=!0,this.workerSources[i]&&this.workerSources[i][n])for(let a in this.workerSources[i][n]){let o=this.workerSources[i][n][a];for(let i in o){let a=o[i];a instanceof ei&&(a.isSpriteLoaded=!0,a.fire(new r.h("isSpriteLoaded")))}}}setImages(i,r){this.availableImages[i]||(this.availableImages[i]={});let{scope:a,images:n}=r;if(this.availableImages[i][a]=n,r.isSpriteLoaded&&this.spriteLoaded(i,{scope:a}),this.workerSources[i]&&this.workerSources[i][a])for(let r in this.workerSources[i][a]){let o=this.workerSources[i][a][r];for(let i in o)o[i].availableImages=n}}setModels(i,{scope:r,models:a}){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}}setProjection(i,a){this.projections[i]=r.gr(a)}setGlobalParams(i,a){if(this.referrer=a.referrer,Object.assign(r.eS,a.config),a.contextOptions){let{maxBindingPoints:i,maxUniformBlockSizeDwords:r}=a.contextOptions;this.maxUniformBufferBindings=i,this.maxUniformBlockSizeDwords=r}}upsertRenderParams(i,r){void 0!==r.brightness&&(this.brightness=r.brightness),void 0!==r.worldview&&(this.worldview=r.worldview)}setLayers(i,r){this.getLayerIndex(i,r.scope).replace(r.layers,r.options)}updateLayers(i,r){this.getLayerIndex(i,r.scope).update(r.layers,r.removedIds,r.options)}async loadTile(i,a){if(a.projection=this.projections[i]||this.defaultProjection,"batched-model"===a.type&&!this.workerSourceTypes["batched-model"]){if(await r.gt(),!m)throw Error('Could not load Standard module for "batched-model" source.');this.workerSourceTypes["batched-model"]=m}return"raster-array"===a.type&&await this.ensureRasterArrayWorkerSource(),this.getWorkerSource(i,a).loadTile(a)}async ensureRasterArraySource(i,r){await this.ensureRasterArrayWorkerSource()}
108async ensureRasterArrayWorkerSource(){if(!this.workerSourceTypes["raster-array"]){if(await async function(){return Promise.resolve()}(),!eQ)throw Error('Could not load raster-array module for "raster-array" source.');this.workerSourceTypes["raster-array"]=eQ}}async decodeRasterArray(i,r){return await this.ensureRasterArrayWorkerSource(),this.getWorkerSource(i,r).decodeRasterArray(r)}reloadTile(i,r){return r.projection=this.projections[i]||this.defaultProjection,this.getWorkerSource(i,r).reloadTile(r)}abortTile(i,r){let a=this.getExistingWorkerSource(i,r);return a?a.abortTile(r):void 0}removeTile(i,r){let a=this.getExistingWorkerSource(i,r);return a?a.removeTile(r):void 0}getExistingWorkerSource(i,r){let{type:a,source:n,scope:o}=r,s=this.workerSources[i];if(s&&s[o]&&s[o][a])return s[o][a][n]}async removeSource(i,r){let{type:a,source:n,scope:o}=r,s=this.workerSources[i]&&this.workerSources[i][o]&&this.workerSources[i][o][a],l=s&&s[n];l&&(delete s[n],l.removeSource&&await l.removeSource({source:n}))}async loadTileProvider(i,a){let n=new(await r.cN(a.name,a.url))(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}async syncRTLPluginState(i,a){if(r.fN.isParsed())return!0;if(r.fN.isParsing())return new Promise((i,r)=>{this.rtlPluginParsingListeners.push({resolve:i,reject:r})});r.fN.setState(a);let n=r.fN.getPluginURL();if(!r.fN.isLoaded()||r.fN.isParsed()||r.fN.isParsing())return!1;r.fN.setState({pluginStatus:r.gs.parsing,pluginURL:n});try{return await self.__mapboxImport(n),!!r.fN.isParsed()||new Promise((i,r)=>{this.rtlPluginParsingListeners.push({resolve:i,reject:r})})}catch(i){for(let{reject:a}of(r.fN.setState({pluginStatus:r.gs.error,pluginURL:n}),this.rtlPluginParsingListeners))a(i);throw this.rtlPluginParsingListeners=[],i}}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 y).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]={}),this.getExistingWorkerSource(i,r))a&&(l[i][s][n][o].tileProvider=a);else{let r=this.actor.getWorkerSourceActor(i),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})}return l[i][s][n][o]}enforceCacheSizeLimit(i,a){r.gu(a)}}return r.gq(self)&&(self.worker=new e0(self)),e0}),n(["./shared"],function(i){let r,a,n,o,s,l,h,u,c={antialias:!1,alpha:!0,stencil:!0,depth:!0};function d(i){let r,a=document.createElement("canvas"),n=Object.create(c);n.failIfMajorPerformanceCaveat=i;let o=a.getContext("webgl2",n);if(!o)return!1;try{r=o.createShader(o.VERTEX_SHADER)}catch(i){return!1}return!(!r||o.isContextLost())&&(o.shaderSource(r,"void main() {}"),o.compileShader(r),!0===o.getShaderParameter(r,o.COMPILE_STATUS))}let p=/firefox/i,f=/macintosh/i;function m(i,r,a){let n=document.createElement(i);return null!=r&&(n.className=r),a&&a.appendChild(n),n}function _(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 g="undefined"!=typeof document?document.documentElement&&document.documentElement.style:null,y=g&&void 0!==g.userSelect?"userSelect":"WebkitUserSelect";function x(){g&&y&&(n=g[y],g[y]="none")}function v(){g&&y&&(g[y]=n)}function b(i){i.preventDefault(),i.stopPropagation(),window.removeEventListener("click",b,!0)}function w(){window.addEventListener("click",b,!0),window.setTimeout(()=>{window.removeEventListener("click",b,!0)},0)}function T(i,r){let a=i.getBoundingClientRect();return I(i,a,r)}function S(i,r){let a=i.getBoundingClientRect(),n=[];for(let o=0;o<r.length;o++)n.push(I(i,a,r[o]));return n}function E(i){return p.test(navigator.userAgent)&&f.test(navigator.userAgent)&&2===i.button&&i.ctrlKey?0:i.button}function I(r,a,n){let o=r.offsetWidth===a.width?1:r.offsetWidth/a.width;
108return new i.P((n.clientX-a.left)*o,(n.clientY-a.top)*o)}class A{constructor(){this._changed=!1,this._updatedLayers=Object.create(null),this._removedLayers=Object.create(null),this._updatedSourceCaches=Object.create(null),this._updatedPaintProps=new Set,this._updatedImages=Object.create(null)}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=Object.create(null),this._removedLayers=Object.create(null),this._updatedSourceCaches=Object.create(null),this._updatedPaintProps.clear(),this._updatedImages=Object.create(null)}}class M{constructor(i){this._layer=i,this._filterDependencies=void 0}invalidateFilter(){this._filterDependencies=void 0}get _filterDeps(){return void 0===this._filterDependencies&&(this._filterDependencies=this._computeFilterDepen
108dencies()),this._filterDependencies}_computeFilterDependencies(){let r=this._layer;if(!r.type||"custom"===r.type||"background"===r.type||"sky"===r.type||"slot"===r.type||"placement-group"===r.type)return null;let a=i.c(r.filter,i.s[`filter_${r.type}`]);return"error"===a.result?null:{configDependencies:a.value.configDependencies,isIndoorDependent:a.value.isIndoorDependent}}hasConfigDependency(i){let{_unevaluatedLayout:r,_transitionablePaint:a}=this._layer;if(r&&r.configDependencies.has(i)||a&&a.configDependencies.has(i))return!0;let n=this._filterDeps;return!!n&&n.configDependencies.has(i)}get isConfigDependent(){let{_unevaluatedLayout:i,_transitionablePaint:r}=this._layer;if(i&&0!==i.configDependencies.size||r&&0!==r.configDependencies.size)return!0;let a=this._filterDeps;return!!a&&0!==a.configDependencies.size}get isIndoorDependent(){let{_unevaluatedLayout:i,_transitionablePaint:r}=this._layer;if(i&&i.isIndoorDependent()||r&&r.isIndoorDependent())return!0;let a=this._filterDeps;return!!a&&a.isIndoorDependent}}let C=new i.C(0,0,0);function P(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 R(i,r){let a,n={};for(;a=i.nextField(r);)1===a?n.left=i.readVarint():2===a?n.width=i.readVarint():3===a?n.top=i.readVarint():4===a&&(n.height=i.readVarint());return n}function D(i,r){let a,n={};for(;a=i.nextField(r);)1===a?(n.group=function(i,r){let a,n={opacity:255,children:[]};for(;a=i.nextField(r);)1===a?n.transform=L(i,i.readVarint()+i.pos):2===a?n.opacity=i.readVarint():5===a?n.clip_path_idx=i.readVarint():6===a?n.mask_idx=i.readVarint():7===a&&n.children.push(D(i,i.readVarint()+i.pos));return n}(i,i.readVarint()+i.pos),n.node="group"):2===a&&(n.path=function(i,r){let a,n={paint_order:1,commands:[],step:1,diffs:[],rule:1};for(;a=i.nextField(r);)1===a?n.fill=function(i,r){let a,n={rgb_color:C,paint:"rgb_color",opacity:255};for(;a=i.nextField(r);)1===a?(n.rgb_color=z(i.readVarint()),n.paint="rgb_color"):2===a?(n.linear_gradient_idx=i.readVarint(),n.paint="linear_gradient_idx"):3===a?(n.radial_gradient_idx=i.readVarint(),n.paint="radial_gradient_idx"):5===a&&(n.opacity=i.readVarint());return n}(i,i.readVarint()+i.pos):2===a?n.stroke=function(i,r){let a,n={rgb_color:C,paint:"rgb_color",dasharray:[],dashoffset:0,miterlimit:4,opacity:255,width:1,linecap:1,linejoin:1};for(;a=i.nextField(r);)1===a?(n.rgb_color=z(i.readVarint()),n.paint="rgb_color"):2===a?(n.linear_gradient_idx=i.readVarint(),n.paint="linear_gradient_idx"):3===a?(n.radial_gradient_idx=i.readVarint(),n.paint="radial_gradient_idx"):5===a?i.readPackedFloat(n.dasharray):6===a?n.dashoffset=i.readFloat():7===a?n.miterlimit=i.readFloat():8===a?n.opacity=i.readVarint():9===a?n.width=i.readFloat():10===a?n.linecap=i.readVarint():11===a&&(n.linejoin=i.readVarint());return n}(i,i.readVarint()+i.pos):3===a?n.paint_order=i.readVarint():5===a?i.readPackedVarint(n.commands):6===a?n.step=i.readFloat():7===a?i.readPackedSVarint(n.diffs):8===a&&(n.rule=i.readVarint());return n}(i,i.readVarint()+i.pos),n.node="path");return n}function L(i,r){let a,n={sx:1,ky:0,kx:0,sy:1,tx:0,ty:0};for(;a=i.nextField(r);)1===a?n.sx=i.readFloat():2===a?n.ky=i.readFloat():3===a?n.kx=i.readFloat():4===a?n.sy=i.readFloat():5===a?n.tx=i.readFloat():6===a&&(n.ty=i.readFloat());return n}function z(r){return new i.C((r>>16&255)/255,(r>>8&255)/255,(255&r)/255,1)}function F(i,r){let a,n={offset:0,opacity:255,rgb_color:C};for(;a=i.nextField(r);)1===a?n.offset=i.readFloat():2===a?n.opacity=i.readVarint():3===a&&(n.rgb_color=z(i.readVarint()));return n}class O{static calculate(r={},a=[]){let n=new Map,o=new Map;if(0===Object.keys(r).length)return n;for(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 B(r,a=255,n){let o=n.get(r.toString())||r;return 255===a?o.toString():new i.C(o.r,o.g,o.b,o.a*a/255).toString()}let k=[],N=0;function V(r,a){if(N>=k.length){let n=i.o()?new OffscreenCanvas(r,a).getContext("2d",{willReadFrequently:!0}):document.createElement("canvas").getContext("2d",{willReadFrequently:!0});k.push(n)}let n=k[N++];return n.canvas.width=r,n.canvas.height=a,n}function U(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=q(o.transform).preMultiplySelf(a)),l=null!=c,h=null!=u,255===o.opacity&&!l&&!h)return U(r,a,n,o,s);let d=V(r.canvas.width,r.canvas.height);U(d,a,n,o,s),c&&function i(r,a,n,o){let s=V(r.canvas.width,r.canvas.height);(function r(a,n,o,s){let l=s.transform?q(s.transform).preMultiplySelf(n):n,h=V(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(X(r),l),h.fill(a,G(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),N--})(s,a,n,o),r.globalCompositeOperation="destination-in",r.drawImage(s.canvas,0,0),N--}(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=V(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),N--}(d,a,n,u,s),r.globalAlpha=o.opacity/255,r.drawImage(d.canvas,0,0),N--}
108(r,a,n,o.group,s),r.restore()):o.path&&(r.save(),l=o.path,r.setTransform(a),1===l.paint_order?(j(r,n,l,s),Z(r,n,l,s)):(Z(r,n,l,s),j(r,n,l,s)),r.restore())})(i,r,a,s,o)}function j(i,r,a,n){let o=a.fill;if(!o)return;let s=o.opacity/255;switch(i.save(),i.beginPath(),W(a,i),o.paint){case"rgb_color":i.fillStyle=B(o.rgb_color,o.opacity,n);break;case"linear_gradient_idx":{let a=r.linear_gradients[o.linear_gradient_idx];a.transform&&i.setTransform(q(a.transform).preMultiplySelf(i.getTransform())),i.fillStyle=$(i,a,s,n);break}case"radial_gradient_idx":{let a=r.radial_gradients[o.radial_gradient_idx];a.transform&&i.setTransform(q(a.transform).preMultiplySelf(i.getTransform())),i.fillStyle=H(i,a,s,n)}}i.fill(G(a)),i.restore()}function G(i){return 1===i.rule?"nonzero":2===i.rule?"evenodd":void 0}function Z(i,r,a,n){let o=a.stroke;if(!o)return;let s=X(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=B(o.rgb_color,o.opacity,n);break;case"linear_gradient_idx":i.strokeStyle=$(i,r.linear_gradients[o.linear_gradient_idx],l,n,!0);break;case"radial_gradient_idx":i.strokeStyle=H(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 $(i,r,a,n,o=!1){if(1===r.stops.length){let i=r.stops[0];return B(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=q(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,B(i.rgb_color,i.opacity*a,n));return p}function H(i,r,a,n,o=!1){if(1===r.stops.length){let i=r.stops[0];return B(i.rgb_color,i.opacity*a,n)}let s=q(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,B(i.rgb_color,i.opacity*a,n));return y}function q(i){return i?new DOMMatrix([i.sx,i.ky,i.kx,i.sy,i.tx,i.ty]):new DOMMatrix}function W(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 X(i){return W(i,new Path2D)}class Y{constructor(){this.cacheMap=new Map,this.cacheDependenciesMap=new Map}static _getImage(r){return new i.b(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.m(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.m(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.m(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.m(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=O.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=V(l,h);U(c,u,n,n,a);let d=c.getImageData(0,0,l,h);return N--,d}(r.icon,i),l=Y._getImage(s);return this.setInCache(i,l,a,n),l.clone()}}class K 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.d,this.dirty=!0,this.spriteFormat=r,this.imageRasterizer=new Y}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.b({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())}
108addImage(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.f(Error(`Image "${r.name}" has invalid "stretchX" value`))),n=!1),this._validateStretch(a.stretchY,a.data&&a.data.height)||(this.fire(new i.f(Error(`Image "${r.name}" has invalid "stretchY" value`))),n=!1),this._validateContent(a.content,a)||(this.fire(new i.f(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){return this.imageVersions.get(i)||new Map}hasImageProviderForSource(i,r){let a=this.imageProviders.get(r);if(!a)return!1;for(let r of a.values())if(r.sourceCache.getSource().id===i)return!0;return!1}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.h("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.i(r).scaleSelf(i.e.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.m(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.j,h:n.data.height+2*i.j,x:0,y:0},s=new i.k(o,n,i.j);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.p(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>
1081?n-1:n,i.b.copy(d,h,{x:0,y:0},{x:l,y:c},{width:p,height:f},a),i.b.copy(d,h,{x:0,y:f-n},{x:l,y:c-n},{width:p,height:n},a),i.b.copy(d,h,{x:0,y:0},{x:l,y:c+f},{width:p,height:n},a),i.b.copy(d,h,{x:p-n,y:0},{x:l-n,y:c},{width:n,height:f},a),i.b.copy(d,h,{x:0,y:0},{x:l+p,y:c},{width:n,height:f},a),i.b.copy(d,h,{x:p-n,y:f-n},{x:l-n,y:c-n},{width:n,height:n},a),i.b.copy(d,h,{x:0,y:f-n},{x:l+p,y:c-n},{width:n,height:n},a),i.b.copy(d,h,{x:0,y:0},{x:l+p,y:c+f},{width:n,height:n},a),i.b.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);this.imageAtlasCache.beginFrame()}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 J{constructor(i,r,a,n){this.message=(i?`${i}: `:"")+a,n&&(this.identifier=n),null!=r&&r.__line__&&(this.line=r.__line__)}}class Q extends J{}function ee(r){let a=r.value,n=r.valueSpec,o=r.style,s=r.styleSpec,l=r.key,h=r.arrayElementValidator||eT;if(!Array.isArray(a))return[new J(l,a,`array expected, ${i.n(a)} found`)];if(n.length&&a.length!==n.length)return[new J(l,a,`array length ${n.length} expected, length ${a.length} found`)];if(n["min-length"]&&a.length<n["min-length"])return[new J(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.l(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 et(r){let a=r.key,n=r.value,o=r.valueSpec;if(!i.q(n))return[new J(a,n,`number expected, ${i.n(n)} found`)];if(n!=n)return[new J(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 J(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 J(a,n,`${n} is greater than the maximum value ${i}`)]}return[]}function ei(r){let a=r.key,n=r.value;if(!i.l(n))return[new J(a,n,`object expected, ${i.n(n)} found`)];let o=r.valueSpec,s=i.u(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.l(a[0][0])}(n),f=eS({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 J(i.key,i.value,'identity function may not have a "stops" property')];let r=[],a=i.value;return r=r.concat(ee({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 J(i.key,a,"array must have at least one stop")),r},default:function(i){return eT({key:i.key,value:i.value,valueSpec:o,style:i.style,styleSpec:i.styleSpec})}}});return"identity"===s&&d&&f.push(new J(r.key,r.value,'missing required property "property"')),"identity"===s||n.stops||f.push(new J(r.key,r.value,'missing required property "stops"')),"exponential"===s&&o.expression&&!i.r(o)&&f.push(new J(r.key,r.value,"exponential functions not supported")),r.styleSpec.$version>=8&&(d||i.t(o)?d&&!i.v(o)&&f.push(new J(r.key,r.value,"zoom functions not supported")):f.push(new J(r.key,r.value,"property functions not supported"))),("categorical"===s||p)&&void 0===n.property&&f.push(new J(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 J(s,n,`array expected, ${i.n(n)} found`)];if(2!==n.length)return[new J(s,n,`array length 2 expected, length ${n.length} found`)];if(p){if(!i.l(n[0]))return[new J(s,n,`object expected, ${i.n(n[0])} found`)];let o=n[0];if(void 0===o.zoom)return[new J(s,n,"object stop key must have zoom")];if(void 0===o.value)return[new J(s,n,"object stop key must have value")];let l=i.u(o.zoom);if("number"!=typeof l)return[new J(s,o.zoom,"stop zoom values must be numbers")];if(u&&u>l)return[new J(s,o.zoom,"stop zoom values must appear in ascending order")];l!==u&&(u=l,h=void 0,c={}
108),a=a.concat(eS({key:`${s}[0]`,value:n[0],valueSpec:{zoom:{}},style:r.style,styleSpec:r.styleSpec,objectElementValidators:{zoom:et,value:_}}))}else a=a.concat(_({key:`${s}[0]`,value:n[0],style:r.style,styleSpec:r.styleSpec},n));return i.x(i.y(n[1]))?a.concat([new J(`${s}[1]`,n[1],"expressions are not allowed in function stops.")]):a.concat(eT({key:`${s}[1]`,value:n[1],valueSpec:o,style:r.style,styleSpec:r.styleSpec}))}function _(r,a){let n=i.n(r.value),u=i.u(r.value),d=null!==r.value?r.value:a;if(l){if(n!==l)return[new J(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 J(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.t(o)&&void 0===s&&(a+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new J(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 J(r.key,d,"stop domain values must appear in ascending order")]:(h=u,"categorical"===s&&u in c?[new J(r.key,d,"stop domain values must be unique")]:(c[u]=!0,[])):[new J(r.key,d,`integer expected, found ${String(u)}`)]}}function er(r){let a=("property"===r.expressionContext?i.z:i.c)(i.y(r.value),r.valueSpec);if("error"===a.result)return a.value.map(i=>new J(`${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 J(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.A(n))return[new J(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.F&&o.has(a.name)?[new J(n.key,n.value,`["${a.name}"] expression is not supported in a filter for a ${n.object.type} 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){if(n.valueSpec&&n.valueSpec.expression)for(let i of n.valueSpec.expression.parameters)en.delete(i);if(0===en.size)return[];let o=[];if(a instanceof i.F){let i=ea.has(a.name)?"feature":a.name;if(en.has(i))return[new J(n.key,n.value,`["${a.name}"] is not an allowed parameter`)]}return a.eachChild(i=>{o.push(...r(i,n))}),o}(n,r);if(r.expressionContext&&0===r.expressionContext.indexOf("cluster")){if(!i.B(n,["zoom","feature-state"]))return[new J(r.key,r.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if("cluster-initial"===r.expressionContext&&!i.D(n))return[new J(r.key,r.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}let ea=new Set(["get","has","properties","geometry-type","id"]),en=new Set(["zoom","pitch","distance-from-center","feature","feature-state","measure-light","heatmap-density","line-progress","raster-value","raster-particle-speed","sky-radial-progress"]);function eo(r){let a=r.key,n=r.value,o=r.valueSpec,s=[];return Array.isArray(o.values)?o.values.includes(i.u(n))||s.push(new J(a,n,`expected one of [${o.values.join(", ")}], ${JSON.stringify(n)} found`)):Object.keys(o.values).includes(i.u(n))||s.push(new J(a,n,`expected one of [${Object.keys(o.values).join(", ")}], ${JSON.stringify(n)} found`)),s}function es(r){if(i.J(i.y(r.value))){let i=r.layerType||"fill";return er({...r,expressionContext:"filter",valueSpec:r.styleSpec[`filter_${i}`]})}return function r(a){let n=a.value,o=a.key;if(!Array.isArray(n))return[new J(o,n,`array expected, ${i.n(n)} found`)];if(n.length<1)return[new J(o,n,"filter array must have at least 1 element")];let s=a.styleSpec,l=eo({key:`${o}[0]`,value:n[0],valueSpec:s.filter_operator}),h=()=>{n.length>=2&&(i.H(n[1])||l.push(new J(`${o}[1]`,n[1],`string expected, ${i.n(n[1])} found`)));for(let r=2;r<n.length;r++)"$type"===i.u(n[1])?l=l.concat(eo({key:`${o}[${r}]`,value:n[r],valueSpec:s.geometry_type})):i.H(n[r])||i.q(n[r])||i.G(n[r])||l.push(new J(`${o}[${r}]`,n[r],`string, number, or boolean expected, ${i.n(n[r])} found.`))};switch(i.u(n[0])){case"<":case"<=":case">":case">=":n.length>=2&&"$type"===i.u(n[1])&&l.push(new J(o,n,`"$type" cannot be use with operator "${n[0]}"`)),3!==n.length&&l.push(new J(o,n,`filter array for operator "${n[0]}" must have 3 elements`)),h();break;case"==":case"!=":3!==n.length&&l.push(new J(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 J(o,n,`filter array for "${n[0]}" operator must have 2 elements`)):i.H(n[1])||l.push(new J(`${o}[1]`,n[1],`string expected, ${i.n(n[1])} found`))}return l}(r)}let el=/^{([^}]+)}$/;function eh(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.U);if(p&&d[p[1]])return i.x(i.y(u))?[].concat(eT({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})):eT({key:o,value:u,valueSpec:{type:"string"},style:s,styleSpec:h});let f=c.match(i.K);if("paint"===a&&f&&d[f[1]]&&d[f[1]].transition)return eT({key:o,value:u,valueSpec:h.transition,style:s,styleSpec:h});let m=r.valueSpec||d[c];if(!m)return[new Q(o,u,`unknown property "${c}"`)];if(i.H(u)&&i.t(m)&&!m.tokens&&(n=el.exec(u))){let i=`\`{ "type": "identity", "property": ${n?JSON.stringify(n[1]):'"_"'} }\``;return[new J(o,u,`"${c}" does not support interpolation syntax
109Use an identity property function instead: ${i}.`)]}let _=[];
109if("symbol"===r.layerType)"text-field"!==c||!s||s.glyphs||s.imports||_.push(new J(o,u,'use of "text-field" requires a style "glyphs" property')),"text-font"===c&&i.M(i.y(u))&&"identity"===i.u(u.type)&&_.push(new J(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.t(m)&&(i.N(m)||i.v(m))){let r=i.z(i.y(u),m).value,a="expression"in r&&r.expression||"_styleExpression"in r&&r._styleExpression&&r._styleExpression.expression;a&&!i.B(a,["measure-light"])&&("model-emissive-strength"===c&&i.D(a)&&i.A(a)||_.push(new J(o,u,`${c} does not support measure-light expressions when the model layer source is vector tile or GeoJSON.`)))}return _.concat(eT({key:r.key,value:u,valueSpec:m,style:s,styleSpec:h,expressionContext:"property",propertyType:a,propertyKey:c}))}function eu(i){return eh(i,"paint")}function ec(i){return eh(i,"layout")}function ed(r){let a=[],n=r.value,o=r.key,s=r.style,l=r.styleSpec;if(!i.l(n))return[new J(o,n,"object expected")];n.type||n.ref||a.push(new J(o,n,'either "type" or "ref" is required'));let h=i.u(n.type),u=i.u(n.ref);if(n.id){let l=i.u(n.id);for(let h=0;h<r.arrayIndex;h++){let r=s.layers[h];i.u(r.id)===l&&a.push(new J(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 J(o,n[i],`"${i}" is prohibited for ref layers`))}),s.layers.forEach(a=>{i.u(a.id)===u&&(r=a)}),r?r.ref?a.push(new J(o,n.ref,"ref cannot reference another ref layer")):h=i.u(r.type):"string"==typeof u&&a.push(new J(o,n.ref,`ref layer "${u}" not found`))}else if("background"!==h&&"sky"!==h&&"slot"!==h&&"placement-group"!==h)if(n.source)if(i.H(n.source)){let r=s.sources&&Object.hasOwn(s.sources,n.source)?s.sources[n.source]:void 0,l=r&&i.u(r.type);r?"vector"===l&&"raster"===h?a.push(new J(o,n.source,`layer "${n.id}" requires a raster source`)):"raster"===l&&"raster"!==h?a.push(new J(o,n.source,`layer "${n.id}" requires a vector source`)):"vector"!==l||n["source-layer"]?"raster-dem"===l&&"hillshade"!==h?a.push(new J(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 J(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 J(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 J(o,n.source,`layer "${n.id}" requires a 'raster-array' source.`)):a.push(new J(o,n.source,"raster-array source can only be used with layer type 'raster'.")):a.push(new J(o,n,`layer "${n.id}" must specify a "source-layer"`)):a.push(new J(o,n.source,`source "${n.source}" not found`))}else a.push(new J(`${o}.source`,n.source,'"source" must be a string'));else a.push(new J(o,n,'missing required property "source"'));return a=a.concat(eS({key:o,value:n,valueSpec:l.layer,style:r.style,styleSpec:r.styleSpec,objectElementValidators:{"*":()=>[],type:()=>eT({key:`${o}.type`,value:n.type,valueSpec:l.layer.type,style:r.style,styleSpec:r.styleSpec,object:n,objectKey:"type"}),filter:i=>es({layerType:h,...i}),layout:i=>eS({layer:n,key:i.key,value:i.value,valueSpec:{},style:i.style,styleSpec:i.styleSpec,objectElementValidators:{"*":i=>ec({layerType:h,...i})}}),paint:i=>eS({layer:n,key:i.key,value:i.value,valueSpec:{},style:i.style,styleSpec:i.styleSpec,objectElementValidators:{"*":i=>eu({layerType:h,layer:n,...i})}}),appearances(r){let a=ee({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.u(r.value),l=i.u(s.name),h=i.u(s.condition),u=eS({key:a,value:s,valueSpec:r.styleSpec.appearance,style:r.style,styleSpec:r.styleSpec,objectElementValidators:{condition:r=>(function(r){let a=[];return a.push(...er({key:r.key,value:r.object.condition,valueSpec:i.s.appearance.condition,expressionContext:"appearance"})),a})({...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 J(i.key,a,`unknown property "${a}" for layer type "${o}"`));continue}let c={...i,key:`${i.key}.${a}`,objectKey:a,layer:n,layerType:o,value:h[a],valueSpec:"paint"===u?s[a]:l[a]};r.push(...eh(c,u))}return r})({layer:n,layerType:o,...i})}});return"hidden"!==l&&void 0===h&&u.push(new J(r.key,"name",'Appearance with name different than "hidden" must have a condition')),u})({layerType:h,layer:n,...r})}),o=Array.isArray(r.value)?r.value:[],s=new Set;return o.forEach((o,l)=>{let h=i.u(o.name);if(h)if(s.has(h)){let o=i.u(n.id);a.push(new J(r.key,h,`Duplicated appearance name "${h}" for layer "${o}"`))}else s.add(h)}),a}}}))}function ep({key:r,value:a}){return i.H(a)?[]:[new J(r,a,`string expected, ${i.n(a)} found`)]}let ef={promoteId:function r({key:a,value:n}){if(i.H(n))return ep({key:a,value:n});
109if(Array.isArray(n)){let r=[],o=i.y(n),s=i.c(o);return"error"===s.result?s.value.forEach(i=>{r.push(new J(`${a}${i.key}`,null,`${i.message}`))}):i.B(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 J(`${a}`,null,"promoteId expression should be only feature dependent")),r}if(!i.l(n))return[new J(a,n,`string, expression or object expected, "${i.n(n)}" found`)];let o=[];for(let i in n)o.push(...r({key:`${a}.${i}`,value:n[i]}));return o}};function em(r){let a=r.value,n=r.key,o=r.styleSpec,s=r.style;if(!i.l(a))return[new J(n,a,`object expected, ${i.n(a)} found`)];if(!("type"in a))return[new J(n,a,'"type" is required')];let l=i.u(a.type),h=[];switch(["vector","raster","raster-dem","raster-array"].includes(l)&&("url"in a||"tiles"in a||h.push(new Q(n,a,'Either "url" or "tiles" is required.'))),l){case"vector":case"raster":case"raster-dem":case"raster-array":return h.concat(eS({key:n,value:a,valueSpec:o[`source_${l.replace("-","_")}`],style:r.style,styleSpec:o,objectElementValidators:ef}));case"geojson":if(h=eS({key:n,value:a,valueSpec:o.source_geojson,style:s,styleSpec:o,objectElementValidators:ef}),"cluster"in a&&"clusterProperties"in a){if(!i.l(a.clusterProperties))return[new J(`${n}.clusterProperties`,a,`object expected, ${i.n(a)} found`)];for(let i in a.clusterProperties){let r=a.clusterProperties[i];if(!Array.isArray(r))return[new J(`${n}.clusterProperties.${i}`,r,"array expected")];let[o,s]=r,l="string"==typeof o?[o,["accumulated"],["get",i]]:o;h.push(...er({key:`${n}.${i}.map`,value:s,expressionContext:"cluster-map"})),h.push(...er({key:`${n}.${i}.reduce`,value:l,expressionContext:"cluster-reduce"}))}}return h;case"video":return eS({key:n,value:a,valueSpec:o.source_video,style:s,styleSpec:o});case"image":return eS({key:n,value:a,valueSpec:o.source_image,style:s,styleSpec:o});case"canvas":return[new J(n,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:var u;return eo({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 e_(i,r){let a=!i.includes("://");try{return new URL(i,a&&r?"http://example.com":void 0),!0}catch(i){return!1}}function eg(r){let a=r.value;return a?i.H(a)?e_(a,!0)?[]:[new J(r.key,a,`invalid url "${a}"`)]:[new J(r.key,a,`string expected, "${i.n(a)}" found`)]:[]}function ey(r){let a=r.value,n=r.styleSpec,o=n.light,s=r.style;if(void 0===a)return[];if(!i.l(a))return[new J("light",a,`object expected, ${i.n(a)} found`)];let l=[];for(let r in a){let h=r.match(i.K),u=r.match(i.U);l=l.concat(u&&o[u[1]]?eT({key:r,value:a[r],valueSpec:{type:"string"},style:s,styleSpec:n}):h&&o[h[1]]&&o[h[1]].transition?eT({key:r,value:a[r],valueSpec:n.transition,style:s,styleSpec:n}):o[r]?eT({key:r,value:a[r],valueSpec:o[r],style:s,styleSpec:n}):[new J(r,a[r],`unknown property "${r}"`)])}return l}function ex(r){let a=r.value;if(!a)return[];let n=r.key;if(!i.l(a))return[new J(n,a,`object expected, ${i.n(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 J(n,a,`missing property "${i}"`)]);if(!i.H(a.type))return o.concat([new J(`${n}.type`,a.type,"string expected")]);if(u)for(let s=0;s<r.arrayIndex;s++){let r=i.u(a.type),l=u[s];i.u(l.type)===r&&o.push(new J(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 J(`${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.l(l))return o.concat([new J("properties",l,`object expected, ${i.n(l)} found`)]);for(let a in l){let n=a.match(i.K),u=a.match(i.U);o=o.concat(u&&d[u[1]]?eT({key:a,value:l[a],valueSpec:{type:"string"},style:h,styleSpec:s}):n&&d[n[1]]&&d[n[1]].transition?eT({key:a,value:l[a],valueSpec:s.transition,style:h,styleSpec:s}
109):d[a]?eT({key:a,value:l[a],valueSpec:d[a],style:h,styleSpec:s}):[new Q(r.key,l[a],`unknown property "${a}"`)])}}else o=o.concat(l[n]?eT({key:n,value:a[n],valueSpec:l[n],style:h,styleSpec:s}):[new Q(n,a[n],`unknown property "${n}"`)]);return o}function ev(r){let a=r.value,n=r.key,o=r.style,s=r.styleSpec,l=s.terrain;if(null==a)return[];if(!i.l(a))return[new J("terrain",a,`object expected, ${i.n(a)} found`)];let h=[];for(let r in a){let n=r.match(i.K),u=r.match(i.U);h=h.concat(u&&l[u[1]]?eT({key:r,value:a[r],valueSpec:{type:"string"},style:o,styleSpec:s}):n&&l[n[1]]&&l[n[1]].transition?eT({key:r,value:a[r],valueSpec:s.transition,style:o,styleSpec:s}):l[r]?eT({key:r,value:a[r],valueSpec:l[r],style:o,styleSpec:s}):[new Q(r,a[r],`unknown property "${r}"`)])}if(a.source)if(i.H(a.source)){let r=o.sources&&Object.hasOwn(o.sources,a.source)?o.sources[a.source]:void 0,s=r&&i.u(r.type);r?"raster-dem"!==s&&h.push(new J(`${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 J(`${n}.source`,a.source,`source "${a.source}" not found`))}else h.push(new J(`${n}.source`,a.source,"source must be a string"));else h.push(new J(n,a,'terrain is missing required property "source"'));return h}function eb(r){let a=r.value,n=r.style,o=r.styleSpec,s=o.fog;if(void 0===a)return[];if(!i.l(a))return[new J("fog",a,`object expected, ${i.n(a)} found`)];let l=[];for(let r in a){let h=r.match(i.K),u=r.match(i.U);l=l.concat(u&&s[u[1]]?eT({key:r,value:a[r],valueSpec:{type:"string"},style:n,styleSpec:o}):h&&s[h[1]]&&s[h[1]].transition?eT({key:r,value:a[r],valueSpec:o.transition,style:n,styleSpec:o}):s[r]?eT({key:r,value:a[r],valueSpec:s[r],style:n,styleSpec:o}):[new Q(r,a[r],`unknown property "${r}"`)])}return l}let ew={"*":()=>[],array:ee,boolean:function(r){let a=r.value,n=r.key;return i.G(a)?[]:[new J(n,a,`boolean expected, ${i.n(a)} found`)]},number:et,color:function({key:r,value:a}){return i.H(a)?void 0===i.C.parse(i.u(a))?[new J(r,a,`color expected, "${a}" found`)]:[]:[new J(r,a,`color expected, ${i.n(a)} found`)]},enum:eo,filter:es,function:ei,layer:ed,object:eS,source:em,model:eg,light:ey,"light-3d":ex,terrain:ev,fog:eb,string:ep,formatted:function(i){return 0===ep(i).length?[]:er(i)},resolvedImage:function(i){return 0===ep(i).length?[]:er(i)},projection:function(r){let a=r.value,n=r.styleSpec,o=n.projection,s=r.style;if(i.l(a)){let i=[];for(let r in a)i=i.concat(eT({key:r,value:a[r],valueSpec:o[r],style:s,styleSpec:n}));return i}return i.H(a)?[]:[new J("projection",a,`object or string expected, ${i.n(a)} found`)]},import:function(r){let a=r.key,{value:n,styleSpec:o}=r;if(!i.l(n))return[new J(a,n,"import must be an object")];let{data:s,...l}=n;Object.defineProperty(l,"__line__",{value:n.__line__,enumerable:!1});let h=eS({...r,value:l,valueSpec:o.import});""===i.u(l.id)&&h.push(new J(`${r.key}.id`,l,"import id can't be an empty string"));let u=i.u(l.id);return"__proto__"!==u&&"constructor"!==u&&"prototype"!==u||h.push(new J(`${r.key}.id`,l,`import id can't be "${String(u)}"`)),s&&(h=h.concat(eI(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.l(a))return[new J(n,a,"object expected")];if(!a.type)return[new J(n,a,'"type" is required')];let l=i.u(a.type),h=[];if(h=h.concat(eS({key:n,value:a,valueSpec:o[`iconset_${l}`],style:s,styleSpec:o})),!("source"!==l||!a.source)){let r=s.sources&&Object.hasOwn(s.sources,a.source)?s.sources[a.source]:void 0,o=r&&i.u(r.type);r?"raster-array"!==o&&h.push(new J(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 J(n,a.source,`source "${a.source}" not found`))}return h},option:function(r){let a=r.styleSpec,n=r.value,o=i.l(n)&&!0===i.u(n.array)||!i.l(n)?void 0:i.u(n.type);return eS({...r,valueSpec:a.option,objectElementValidators:{default:r=>{let a=r.value;return i.l(a)?eT({...r,valueSpec:{...r.valueSpec,type:"*",expression:void 0}}):o&&Array.isArray(a)?eT({...r,valueSpec:{...r.valueSpec,type:o}}):eT(r)}}})}};function eT(r,a=!1){let n=r.value,o=r.valueSpec,s=r.styleSpec;if(o.expression){if(i.M(i.u(n)))return ei(r);if(i.x(i.y(n)))return er(r)}if(o.type&&ew[o.type]){let i=ew[o.type](r);return!0===a&&i.length>0&&Array.isArray(r.value)?er(r):i}return eS({...r,valueSpec:o.type?s[o.type]:o})}function eS(r){let a=r.key,n=r.value,o=r.valueSpec||{},s=r.objectElementValidators||{},l=r.style,h=r.styleSpec;if(!i.l(n))return[new J(a,n,`object expected, ${i.n(n)} found`)];let u=[];for(let i in n){let r;if(!Object.hasOwn(n,i))continue;let c=i.split(".")[0],d=Object.hasOwn(o,c),p=Object.hasOwn(o,"*"),f=d?o[c]:p?o["*"]:void 0;Object.hasOwn(s,c)?r=s[c]:d?r=eT:Object.hasOwn(s,"*")?r=s["*"]:p&&(r=eT),r?u=u.concat(r({key:(a?`${a}.`:a)+i,value:n[i],valueSpec:f,style:l,styleSpec:h,object:n,objectKey:i},n)):u.push(new Q(a,n[i],`unknown property "${i}"`))}for(let i in o){if(!Object.hasOwn(o,i)||Object.hasOwn(s,i))continue;let r=o[i];!r.required||void 0!==r.default||Object.hasOwn(n,i)&&void 0!==n[i]||u.push(new J(a,n,`missing required property "${i}"`))}return u}function eE({key:i,value:r}){let a=ep({key:i,value:r});return a.length||(r.includes("{fontstack}")||a.push(new J(i,r,'"glyphs" url must include a "{fontstack}" token')),r.includes("{range}")||a.push(new J(i,r,'"glyphs" url must include a "{range}" token'))),a}function eI(r,a=i.s,n={}){return eS({key:n.key||"",value:r,valueSpec:{...a.$root,"*":{type:"*"}},styleSpec:a,style:r,objectElementValidators:{glyphs:eE}})}function eA(i){return i.slice().sort((i,r)=>i.line&&r.line?i.line-r.line:0)}let eM="setStyle",eC="addLayer",eP="removeLayer",eR="setPaintProperty",eD="setLayerProperty",eL="setTerrain",ez="removeImport",eF="addIconset",eO="removeIconset";function eB(i,r,a){a.push({command:"addSource",args:[i,r[i]]})}function ek(i,r,a){r.push({command:"removeSource",args:[i]}),a[i]=!0}function eN(r,a,n,o,s,l){let h;for(h in a=a||{},r=r||{})Object.hasOwn(r,h)&&(i.O(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.O(r[h],a[h])||n.push({command:l,args:[o,h,a[h],s]}))}function eV(i){return i.id}function eU(i,r){return i[r.id]=r,i}
109let ej=new i.C(1,0,0,1),eG=new i.C(0,1,0,1),eZ=new i.C(0,0,1,1),e$=new i.C(1,0,1,1),eH=new i.C(0,1,1,1);function eq(r,a,n,o,s,l,h){let u=r.context,c=r.transform,d=u.gl,p="globe"===c.projection.name,f=i.Q(n.projMatrix);if(p&&i.S(c.zoom)>0){let r=i.V(n.canonical,c),a=i.W(r);f=i.X(new Float32Array(16),c.globeMatrix,a),i.X(f,c.projMatrix,f)}let m=i.Y();m[12]+=2*s/(i.e.devicePixelRatio*c.width),m[13]+=2*l/(i.e.devicePixelRatio*c.height),i.X(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=i.Z.disabled,x=i._.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,i.$.disabled,i.a0(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,i.a1.alphaBlended,i.$.disabled,i.a0(f,i.C.transparent.toPremultipliedRenderColor(null),E),b,I,A,M,null,null,null,[g._globeTileDebugTextBuffer])}function eW(i,r,a,n){eY(i,0,r+a/2,i.transform.width,a,n)}function eX(i,r,a,n){eY(i,r-a/2,0,a,i.transform.height,n)}function eY(r,a,n,o,s,l){let h=r.context,u=h.gl;u.enable(u.SCISSOR_TEST),u.scissor(a*i.e.devicePixelRatio,n*i.e.devicePixelRatio,o*i.e.devicePixelRatio,s*i.e.devicePixelRatio),h.clear({color:l}),u.disable(u.SCISSOR_TEST)}let eK=(r,a,n,o,s,l,h,u)=>{let c=i.a6/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}},eJ=(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]}),eQ={loaded:!0,validateStyle:function(r,a=i.s){return eA(eI(r,a))},validateSource:i=>eA(em(i)),validateLight:i=>eA(ey(i)),validateLights:i=>eA(ex(i)),validateTerrain:i=>eA(ev(i)),validateFog:i=>eA(eb(i)),validateSnow:r=>eA(function(r){let a=r.value,n=r.style,o=r.styleSpec,s=o.snow;if(void 0===a)return[];if(!i.l(a))return[new J("snow",a,`object expected, ${i.n(a)} found`)];let l=[];for(let r in a){let h=r.match(i.K);l=l.concat(h&&s[h[1]]&&s[h[1]].transition?eT({key:r,value:a[r],valueSpec:o.transition,style:n,styleSpec:o}):s[r]?eT({key:r,value:a[r],valueSpec:s[r],style:n,styleSpec:o}):[new Q(r,a[r],`unknown property "${r}"`)])}return l}(r)),validateRain:r=>eA(function(r){let a=r.value,n=r.style,o=r.styleSpec,s=o.rain;if(void 0===a)return[];if(!i.l(a))return[new J("rain",a,`object expected, ${i.n(a)} found`)];let l=[];for(let r in a){let h=r.match(i.K);l=l.concat(h&&s[h[1]]&&s[h[1]].transition?eT({key:r,value:a[r],valueSpec:o.transition,style:n,styleSpec:o}):s[r]?eT({key:r,value:a[r],valueSpec:s[r],style:n,styleSpec:o}):[new Q(r,a[r],`unknown property "${r}"`)])}return l}(r)),validateLayer:i=>eA(ed(i)),validateFilter:i=>eA(es(i)),validatePaintProperty:i=>eA(eu(i)),validateLayoutProperty:i=>eA(ec(i)),validateModel:i=>
109eA(eg(i)),diffStyles:function(r,a){if(!r)return[{command:eM,args:[a]}];let n=[];try{if(!i.O(r.version,a.version)||(i.O(r.center,a.center)||n.push({command:"setCenter",args:[a.center]}),i.O(r.zoom,a.zoom)||n.push({command:"setZoom",args:[a.zoom]}),i.O(r.bearing,a.bearing)||n.push({command:"setBearing",args:[a.bearing]}),i.O(r.pitch,a.pitch)||n.push({command:"setPitch",args:[a.pitch]}),i.O(r.sprite,a.sprite)||n.push({command:"setSprite",args:[a.sprite]}),i.O(r.glyphs,a.glyphs)||n.push({command:"setGlyphs",args:[a.glyphs]}),i.O(r.imports,a.imports)||function(r=[],a=[],n){let o,s,l,h;a=a||[];let u=(r=r||[]).map(eV),c=a.map(eV),d=r.reduce(eU,{}),p=a.reduce(eU,{}),f=u.slice();for(o=0,s=0;o<u.length;o++)l=u[o],Object.hasOwn(p,l)?s++:(n.push({command:ez,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:ez,args:[l]}),f.splice(f.lastIndexOf(l,f.length-s),1)):s++,h=f[f.length-o],n.push({command:"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.O(a,r)||n.push({command:"updateImport",args:[r.id,r]}))}}(r.imports,a.imports,n),i.O(r.transition,a.transition)||n.push({command:"setTransition",args:[a.transition]}),i.O(r.light,a.light)||n.push({command:"setLight",args:[a.light]}),i.O(r.fog,a.fog)||n.push({command:"setFog",args:[a.fog]}),i.O(r.snow,a.snow)||n.push({command:"setSnow",args:[a.snow]}),i.O(r.rain,a.rain)||n.push({command:"setRain",args:[a.rain]}),i.O(r.projection,a.projection)||n.push({command:"setProjection",args:[a.projection]}),i.O(r.lights,a.lights)||n.push({command:"setLights",args:[a.lights]}),i.O(r.camera,a.camera)||n.push({command:"setCamera",args:[a.camera]}),i.O(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:eO,args:[o]}));for(o in a){if(!Object.hasOwn(a,o))continue;let s=a[o];Object.hasOwn(r,o)?i.O(r[o],s)||(n.push({command:eO,args:[o]}),n.push({command:eF,args:[o,s]})):n.push({command:eF,args:[o,s]})}}(r.iconsets,a.iconsets,n),!i.O(r["color-theme"],a["color-theme"])))return[{command:eM,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)||ek(s,n,o));for(s in a){var l;if(!Object.hasOwn(a,s))continue;let h=a[s];Object.hasOwn(r,s)?i.O(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.O(r[n][o],a[n][o]))return!1;for(o in a[n])if(Object.hasOwn(a[n],o)&&"data"!==o&&!i.O(r[n][o],a[n][o]))return!1;return!0}(r,a,s)?n.push({command:"setGeoJSONSourceData",args:[s,h.data]}):(l=a,ek(s,n,o),eB(s,l,n))):eB(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:eP,args:[i.id]}):l.push(i)});let h=r.terrain;h&&o[h.source]&&(n.push({command:eL,args:[void 0]}),h=void 0),n=n.concat(s),i.O(h,a.terrain)||n.push({command:eL,args:[a.terrain]}),function(r,a,n){let o,s,l,h,u,c,d;a=a||[];let p=(r=r||[]).map(eV),f=a.map(eV),m=r.reduce(eU,{}),_=a.reduce(eU,{}),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:eP,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:eP,args:[l]}),g.splice(g.lastIndexOf(l,g.length-s),1)):s++,c=g[g.length-o],n.push({command:eC,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.O(h,u))if(i.O(h.source,u.source)&&i.O(h["source-layer"],u["source-layer"])&&i.O(h.type,u.type)){for(d in eN(h.layout,u.layout,n,l,null,"setLayoutProperty"),eN(h.paint,u.paint,n,l,null,eR),i.O(h.slot,u.slot)||n.push({command:"setSlot",args:[l,u.slot]}),i.O(h.filter,u.filter)||n.push({command:"setFilter",args:[l,u.filter]}),i.O(h.minzoom,u.minzoom)&&i.O(h.maxzoom,u.maxzoom)||n.push({command:"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.")?eN(h[d],u[d],n,l,d.slice(6),eR):i.O(h[d],u[d])||n.push({command:eD,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.")?eN(h[d],u[d],n,l,d.slice(6),eR):i.O(h[d],u[d])||n.push({command:eD,args:[l,d,u[d]]}))}else n.push({command:eP,args:[l]}),c=g[g.lastIndexOf(l)+1],n.push({command:eC,args:[u,c]})}(l,a.layers,n)}catch(i){console.warn("Unable to compute style diff:",i),n=[{command:eM,args:[a]}]}return n},drawDebug:function(r,a,n,o,s,l){for(let h=0;h<n.length;h++)if(s){let s=new i.C(.8*o.r,.8*o.g,.8*o.b,1);eq(r,a,n[h],o,-1,-1,l),eq(r,a,n[h],o,-1,1,l),eq(r,a,n[h],o,1,1,l),eq(r,a,n[h],o,1,-1,l),eq(r,a,n[h],s,0,0,l)}else eq(r,a,n[h],o,0,0,l)},drawDebugPadding:function(i){var r,a;let n=i.transform.padding;eW(i,i.transform.height-(n.top||0),3,ej),eW(i,n.bottom||0,3,eG),eX(i,n.left||0,3,eZ),eX(i,i.transform.width-(n.right||0),3,e$);let o=i.transform.centerPoint;r=o.x,a=i.transform.height-o.y,eY(i,r-1,a-10,2,20,eH),eY(i,r-10,a-1,20,2,eH)},drawDebugQueryGeometry:function(r,a,n){for(let o=0;o<n.length;o++)!function(r,a,n){let o=r.context,s=o.gl,l=n.projMatrix,h=r.getOrCreateProgram("debug"),u=a.getTileByID(n.key);r.terrain&&r.terrain.setupElevationDraw(u,h);let c=i.Z.disabled,d=i._.disabled,p=r.colorModeForRenderPass(),f="$debug";o.activeTexture.set(s.TEXTURE0),r.emptyTexture.bind(s.LINEAR,s.CLAMP_TO_EDGE);let m=u.queryGeometryDebugViz,_=u.queryBoundsDebugViz;if(m&&m.vertices.length>0){m.lazyUpload(o);let a=m.vertexBuffer,n=m.indexBuffer,u=m.segments;null!=a&&null!=n&&null!=u&&h.draw(r,s.LINE_STRIP,c,d,p,i.$.disabled,i.a0(l,m.color.toPremultipliedRenderColor(null)),f,a,n,u)}if(_&&_.vertices.length>0){_.lazyUpload(o);let a=_.vertexBuffer,n=_.indexBuffer,u=_.segments;null!=a&&null!=n&&null!=u&&h.draw(r,s.LINE_STRIP,c,d,p,i.$.disabled,i.a0(l,_.color.toPremultipliedRenderColor(null)),f,a,n,u)}}(r,a,n[o])},drawCollisionDebug:function(r,a,n,s,l,h,u){let c=r.context,d=c.gl,p=r.transform,f=[i.a7(p.center.lng),i.a8(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 o=0;o<s.length;o++){let c=s[o],m=a.getTile(c),T=m.getBucket(n);if(!T)continue;let S=T.getProjection().createInversionMatrix(p,c.canonical),E=[],I=i.a9(c,T,p),A=!u&&g&&x,M=u&&y&&x,C=_&&T.hasTextData(),P=T.hasIconTextFit()&&C&&T.hasIconData(),R=A||M||u&&C||P,D="globe"===T.projection.name,L=D?i.S(p.zoom):0;D&&(E.push("PROJECTION_GLOBE_VIEW"),R&&E.push("PROJECTED_POS_ON_VIEWPORT"));let z=r.getOrCreateProgram("collisionBox",{defines:E}),F=I;0===l[0]&&0===l[1]||(F=r.translatePosMatrix(I,m,l,h));let O=u?T.textCollisionBox:T.iconCollisionBox,B=T.collisionCircleArray;
109if(B.length>0){let r=i.Y(),a=F;i.aa(r,T.placementInvProjMatrix,p.glCoordMatrix),i.aa(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,z);let k=D?[c.canonical.x,c.canonical.y,1<<c.canonical.z]:[0,0,0];z.draw(r,d.LINES,i.Z.disabled,i._.disabled,r.colorModeForRenderPass(),i.$.disabled,eK(F,S,p,L,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.ab;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)}(!o||o.length<2*b)&&(o=function(r){let a=2*r,n=new i.ae;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(o,!0),A=c.createVertexBuffer(S,i.ac.members,!0);for(let a of v){let o=eJ(a.transform,a.invTransform,p,a.projection);T.draw(r,d.TRIANGLES,i.Z.disabled,i._.disabled,r.colorModeForRenderPass(),i.$.disabled,o,n.id,A,I,i.ad.simpleSegment(0,2*a.circleOffset,a.circleArray.length,a.circleArray.length/2),null,p.zoom)}A.destroy(),I.destroy()}};async function e0(){return Promise.resolve()}function e1(r,a){let n=!1;if(a&&a.length)for(let o of a)o instanceof Q?i.w(o.message):(r.fire(new i.f(Error(o.message))),n=!0);return n}function e2(i){return(...r)=>{let a=eQ[i];return a?a(...r):[]}}let e3=e2("validateStyle"),e5=e2("validateSource"),e4=e2("validateLight"),e6=e2("validateLights"),e8=e2("validateTerrain"),e9=e2("validateFog"),e7=e2("validateSnow"),te=e2("validateRain"),tt=e2("validateLayer"),ti=e2("validateFilter"),tr=e2("validatePaintProperty"),ta=e2("validateLayoutProperty"),tn=e2("validateModel"),to=i.s.light;class ts extends i.E{constructor(r,a="flat"){super(),this._transitionable=new i.af(s||(s=new i.ag({anchor:new i.ah(to.anchor),position:new i.ai(to.position),color:new i.ah(to.color),intensity:new i.ah(to.intensity)}))),this.setLight(r,a),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(i,r,a={}){this._validate(e4,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)&&e1(this,r.call(e3,{value:a,style:{glyphs:!0,sprite:!0},styleSpec:i.s}))}}let tl=i.s.terrain,th=class extends i.E{constructor(r,a,n,o,s){super(),this.scope=n,this._transitionable=new i.af(new i.ag({source:new i.ah(tl.source),exaggeration:new i.ah(tl.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.aj(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.aj(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.ak}};function tu(i,r){let a=i?i.terrain:null;return!!a&&(!r||!!r.projection.requiresDraping||!a.isZoomDependent()||a.getExaggeration(r.zoom)>0)}let tc=i.s.fog;class td extends i.E{constructor(r,a,n,o){super();let s=new i.ag({range:new i.ah(tc.range),color:new i.ah(tc.color),"color-use-theme":new i.ah({type:"string","property-type":"data-constant",default:"default"}),"high-color":new i.ah(tc["high-color"]),"high-color-use-theme":new i.ah({type:"string","property-type":"data-constant",default:"default"}),"space-color":new i.ah(tc["space-color"]),"space-color-use-theme":new i.ah({type:"string","property-type":"data-constant",default:"default"}
109),"horizon-blend":new i.ah(tc["horizon-blend"]),"star-intensity":new i.ah(tc["star-intensity"]),"vertical-range":new i.ah(tc["vertical-range"])});this._transitionable=new i.af(s,n,o),this.set(r,o),this._transitioning=this._transitionable.untransitioned(),this._transform=a,this.properties=new i.al(s),this.scope=n}get state(){let r=this._transform,a="globe"===r.projection.name,n=i.S(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.am(2,l[0],n),i.am(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={}){if(this._validate(e9,i,a))return;let n={...i};for(let i of Object.keys(tc))void 0===n[i]&&(n[i]=tc[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.an(i.ap,i.ao,r))*a.a}getOpacityAtLatLng(r,a){return this._transform.projection.supportsFog?i.aq(this.state,r,a):0}getOpacityForTile(r){if(!this._transform.projection.supportsFog)return[1,1];let a=this._transform.calculateFogTileMatrix(r.toUnwrapped());return i.ar(this.state,a,0,0,i.a6,i.a6,this._transform)}getOpacityForBounds(r,a,n,o,s){return this._transform.projection.supportsFog?i.ar(this.state,r,a,n,o,s,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.as(s,o,s[2]/(s[2]-o[2]))}if(i.at(this.state,n[0],n[1],0,this._transform)>=i.au)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)&&e1(this,r.call(e3,{value:a,style:{glyphs:!0,sprite:!0},styleSpec:i.s}))}}let tp,tf,tm=class extends i.E{constructor(r,a,n,o){super();let s=tp||(tp=new i.ag({density:new i.ah(i.s.snow.density),intensity:new i.ah(i.s.snow.intensity),color:new i.ah(i.s.snow.color),opacity:new i.ah(i.s.snow.opacity),vignette:new i.ah(i.s.snow.vignette),"vignette-color":new i.ah(i.s.snow["vignette-color"]),"center-thinning":new i.ah(i.s.snow["center-thinning"]),direction:new i.ah(i.s.snow.direction),"flake-size":new i.ah(i.s.snow["flake-size"])}));this._transitionable=new i.af(s,n,o),this.set(r,o),this._transitioning=this._transitionable.untransitioned(),this.properties=new i.al(s),this.scope=n}get state(){let r=this.properties.get("opacity"),a=this.properties.get("color"),n=this.properties.get("direction"),o=i.av(n[0]),s=-Math.max(i.av(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"),c=new i.C(u.r,u.g,u.b,h);return{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:c}}get(){return this._transitionable.serialize()}set(r,a,n={}){if(this._validate(e7,r,n))return;let o={...r},s=i.s.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)&&e1(this,r.call(e3,{value:a,style:{glyphs:!0,sprite:!0},styleSpec:i.s}))}},t_=class extends i.E{constructor(r,a,n,o){super();let s=tf||(tf=new i.ag({density:new i.ah(i.s.rain.density),intensity:new i.ah(i.s.rain.intensity),color:new i.ah(i.s.rain.color),opacity:new i.ah(i.s.rain.opacity),vignette:new i.ah(i.s.rain.vignette),"vignette-color":new i.ah(i.s.rain["vignette-color"]),"center-thinning":new i.ah(i.s.rain["center-thinning"]),direction:new i.ah(i.s.rain.direction),"droplet-size":new i.ah(i.s.rain["droplet-size"]),"distortion-strength":new i.ah(i.s.rain["distortion-strength"])}));this._transitionable=new i.af(s,n,o),this.set(r,o),this._transitioning=this._transitionable.untransitioned(),this.properties=new i.al(s),this.scope=n}get state(){let r=this.properties.get("opacity"),a=this.properties.get("color"),n=this.properties.get("direction"),o=i.av(n[0]),s=-Math.max(i.av(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"),u=new i.C(h.r,h.g,h.b,this.properties.get("vignette"));return{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
109Size:this.properties.get("droplet-size"),distortionStrength:this.properties.get("distortion-strength"),vignetteColor:u}}get(){return this._transitionable.serialize()}set(r,a,n={}){if(this._validate(te,r,n))return;let o={...r},s=i.s.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)&&e1(this,r.call(e3,{value:a,style:{glyphs:!0,sprite:!0},styleSpec:i.s}))}},tg={workerUrl:"",workerClass:null,workerParams:void 0},ty="mapboxgl_preloaded_worker_pool";class tx{constructor(i){this.active={},this.workers=null,this.name=i}acquire(i,r=tx.workerCount){if(!this.workers)for(this.workers=[];this.workers.length<r;){var a;let r=(a=`${this.name||""}WorkerPool: ${i}-${this.workers.length}`,null!=tg.workerClass?new tg.workerClass:new self.Worker(tg.workerUrl,{name:a,type:"module",...tg.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[ty]}numActive(){return Object.keys(this.active).length}}tx.workerCount=2;class tv{constructor(r,a,n="Worker",o=tx.workerCount){this.workerPool=r,this.actors=[],this.currentActor=0,this.id=i.aw();let s=this.workerPool.acquire(this.id,o);for(let i=0;i<s.length;i++){let r=new tv.Actor(s[i],a,this.id);r.name=`${n} ${i}`,this.actors.push(r)}this.ready=!1,this.send("checkIfReady",null).then(()=>{this.ready=!0}).catch(()=>{})}send(i,r,a){return Promise.all(this.actors.map(n=>n.send(i,r,a)))}broadcast(i,r){for(let a of this.actors)a.notify(i,r)}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)}}tv.Actor=i.ax;class tb extends i.E{constructor(r,a,n,o){super(),this.scope=n,this._options=r,this.properties=new i.al(a),this._transitionable=new i.af(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 tw=()=>l||(l=new i.ag({color:new i.ah(i.s.properties_light_ambient.color),"color-use-theme":new i.ah({type:"string",default:"default","property-type":"data-constant"}),intensity:new i.ah(i.s.properties_light_ambient.intensity)})),tT=()=>h||(h=new i.ag({direction:new i.ay(i.s.properties_light_directional.direction),color:new i.ah(i.s.properties_light_directional.color),"color-use-theme":new i.ah({type:"string",default:"default","property-type":"data-constant"}),intensity:new i.ah(i.s.properties_light_directional.intensity),"cast-shadows":new i.ah(i.s.properties_light_directional["cast-shadows"]),"shadow-quality":new i.ah(i.s.properties_light_directional["shadow-quality"]),"shadow-intensity":new i.ah(i.s.properties_light_directional["shadow-intensity"]),"shadow-draw-before-layer":new i.ah(i.s.properties_light_directional["shadow-draw-before-layer"])})),tS=(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}),tE=i=>({u_matrix:i}),tI=i=>({u_matrix:i}),tA=i.az;async function tM(){return Promise.resolve()}function tC(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.aE():0,A="globe"===f.projection.name,M=A?i.S(f.zoom):0,C=[i.a7(f.center.lng),i.a8(f.center.lat)],P="none"===n.paint.get("fill-extrusion-flood-light-color-use-theme").
109constantOr("default"),R=n.paint.get("fill-extrusion-flood-light-color").toNonPremultipliedRenderColor(P?null:n.lut).toArray01().slice(0,3),D=n.paint.get("fill-extrusion-flood-light-intensity"),L=n.paint.get("fill-extrusion-vertical-scale"),z=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=i.aF(r,n.paint.get("fill-extrusion-cutoff-fade-range")),k=n.paint.get("fill-extrusion-front-cutoff"),N=tR(f.pitch,k,!!r.terrain),V=N[2]<1;V&&(r.maxFrontCutoffRawStart=Math.max(r.maxFrontCutoffRawStart,k[0]));let U=[];A&&U.push("PROJECTION_GLOBE_VIEW"),w[0]>0&&U.push("FAUX_AO"),S&&U.push("ZERO_ROOF_RADIUS"),u&&U.push("HAS_CENTROID"),D>0&&U.push("FLOOD_LIGHT"),B.shouldRenderCutoff&&U.push("RENDER_CUTOFF"),V&&U.push("RENDER_FRONT_CUTOFF"),z&&U.push("RENDER_WALL_MODE");let j="shadow"===r.renderPass,G=r.shadowRenderer,Z=j&&!!G,$=j?i.$.disabled:i.$.backCCW;r.shadowRenderer&&(r.shadowRenderer.useNormalOffset=!0);let H=[0,0,0];if(G){let a=r.style.directionalLight,n=r.style.ambientLight;a&&n&&(H=i.aG(r.style,a,n)),j||(U.push("RENDER_SHADOWS"),G.useNormalOffset&&U.push("NORMAL_OFFSET")),c=U.concat(["SHADOWS_SINGLE_CASCADE"])}let q=Z?"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.aH.from(g),n=a.getPrimary().scaleSelf(i.e.devicePixelRatio).toString(),o=a.getSecondary(),s=r.patternPositions.get(n),l=o?r.patternPositions.get(o.scaleSelf(i.e.devicePixelRatio).toString()):null;k=!!s&&!!l,s&&P.setConstantPatternPositions(s,l)}_>0&&(k||P.getPatternTransitionVertexBuffer("fill-extrusion-pattern"))&&U.push("FILL_EXTRUSION_PATTERN_TRANSITION");let V=r.getOrCreateProgram(q,{config:P,defines:T?c:U,overrideFog:S});if(r.terrain&&r.terrain.setupElevationDraw(v,V,{useMeterToDem:!0}),!b.centroidVertexBuffer){let i=V.getAttributeLocation(p,"a_centroid_pos");-1!==i&&p.vertexAttribI4ui(i,0,0,0,0)}!j&&G&&G.setupShadows(v.tileID.toUnwrapped(),V,"vector-tile"),y&&(r.context.activeTexture.set(p.TEXTURE0),v.imageAtlasTexture&&v.imageAtlasTexture.bind(p.LINEAR,p.CLAMP_TO_EDGE),P.updatePaintBuffers());let Z=n.paint.get("fill-extrusion-vertical-gradient"),X=1/b.tileToMeter;if(j&&G){if(tF(v.tileID,b.maxHeight,r))continue;let a=G.calculateShadowPassMatrixFromTile(v.tileID.toUnwrapped());o=i.aN(a,E,X,L,F,O)}else{let a=r.translatePosMatrix(m.expandedProjMatrix,v,n.paint.get("fill-extrusion-translate"),n.paint.get("fill-extrusion-translate-anchor")),s=f.projection.createInversionMatrix(f,m.canonical),l=V.fixedDefines.includes("LIGHTING_3D_MODE");o=y?i.aI(a,r,Z,x,w,E,X,m,v,I,F,O,M,C,s,R,L,_,l):i.aJ(a,r,Z,x,w,E,X,m,I,F,O,M,C,s,R,L,D,H,N,l)}r.uploadCommonUniforms(d,V,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 K=[];(r.terrain||u)&&K.push(b.centroidVertexBuffer),A&&K.push(b.layoutVertexExtBuffer),z&&K.push(b.wallVertexBuffer),V.draw(r,d.gl.TRIANGLES,s,l,h,$,o,n.id,b.layoutVertexBuffer,b.indexBuffer,Y,n.paint,r.transform.zoom,P,K)}r.shadowRenderer&&(r.shadowRenderer.useNormalOffset=!1)}class tP{constructor(){this.translate=[0,0],this.translateAnchor="map",this.edgeRadius=0,this.cutoffFadeRange=0}}function tR(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]]}let tD=[1,0,0],tL=[0,1,0],tz=[0,0,1];function tF(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[
1091],-c[2]],p=[tD,tL,tz,d,[d[0],0,d[2]],[0,d[1],d[2]]];n._shadowCullCache=u={frame:l,cascade:h,cameraFrustum:i.aA.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.aB(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 tO=new Float32Array(16),tB=new Float32Array(16);function tk(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.aB(a.transform.center.lat,a.transform.zoom),f=i.aF(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=tR(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.aO(tO,w,[1,1,r.verticalScale]),u&&d){if(tF(x.tileID,v.maxHeight*p,a))continue;let n=d.calculateShadowPassMatrixFromTile(x.tileID.toUnwrapped());i.aO(n,n,[1,1,r.verticalScale]),_=tI(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}),_=tE(tO);else{let n=a.transform.calculatePosMatrix(y.toUnwrapped(),a.transform.worldSize);i.aO(n,n,[1,1,r.verticalScale]),i.aO(tB,n,[1,-1,1/p]),i.aP(tB,tB),i.aQ(tB,tB);let o=a.transform.getFreeCameraOptions().position,u=1<<y.canonical.z;if(_=tS(tO,tB,r.opacity,r.facadeAOIntensity,[((o.x-y.wrap)*u-y.canonical.x)*i.a6,(o.y*u-y.canonical.y)*i.a6,o.z*u*i.a6],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})}d&&(d.setupShadowsFromMatrix(n,m,!0),s!==m&&s.setShadowUniformValues(h,d.getShadowUniformValues()))}let T=(n,s)=>{if(c){let l=n.entranceBloom;s.draw(a,h.gl.TRIANGLES,r.depthMode,i._.disabled,r.blendMode,i.$.disabled,_,o.id,l.layoutVertexBuffer,l.indexBuffer,l.segmentsBucket,o.paint,a.transform.zoom,b,[l.layoutAttenuationBuffer,l.layoutColorBuffer])}else{let l=n.segmentsBucket,c=[n.layoutNormalBuffer,n.layoutCentroidBuffer,n.layoutColorBuffer,n.layoutFloodLightDataBuffer];n.layoutFacadePaintBuffer&&(c=c.concat([n.layoutFacadeDataBuffer,n.layoutFacadeVerticalRangeBuffer,n.layoutFacadePaintBuffer])),s.draw(a,h.gl.TRIANGLES,r.depthMode,i._.disabled,r.blendMode,u?i.$.disabled:i.$.backCW,_,o.id,n.layoutVertexBuffer,n.indexBuffer,l,o.paint,a.transform.zoom,b,c)}};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 tN(r,a,n,o,s,l,h,u,c,d,p,f,m,_){let g=r.context.gl,y=r.depthModeForSublayer(1,i.Z.ReadOnly,g.LEQUAL,!0),x=i.am(.1,3,p),v=r._showOverdrawInspector,b=new tP;if(!v){let p=new i._({func:g.ALWAYS,mask:255},255,255,g.KEEP,g.KEEP,g.REPLACE),m=new i.a1([g.ONE,g.ONE,g.ONE,g.ONE],i.C.transparent,[!1,!1,!1,!0],g.MIN);i.aR(b,r,a,n,o,y,p,m,i.$.disabled,s,"sdf",l,h,u,c,d,x,f,!1,void 0)}{let p=v?i._.disabled:new i._({func:g.EQUAL,mask:255},255,255,g.KEEP,g.DECR,g.DECR),m=v?r.colorModeForRenderPass():new i.a1([g.ONE_MINUS_DST_ALPHA,g.DST_ALPHA,g.ONE,g.ONE],i.C.transparent,[!0,!0,!0,!0]);i.aR(b,r,a,n,o,y,p,m,i.$.disabled,s,"color",l,h,u,c,d,x,f,!1,void 0)}}class tV{constructor(){this._previousClosestBuildingId=null,this._hysteresisRatio=.8,this._indo
109orMinimumZoom=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.aU(r,n))return!0}else if("MultiPolygon"===s.type){let r=this._convertMultiPolygonToPoints(s.coordinates);if(i.aV(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])))}}let tU=(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}),tj=(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]}),tG=(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]});function tZ(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 t$(i,r,[a,n]){return a===n?0:.5/i+(r-a)*(i-1)/(i*(n-a))}var tH=i.a$([{name:"a_index",type:"Int16",components:1}]);class tq{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.b0;s.reserve(o);for(let i=0;i<o;i++)s.emplaceBack(i);this.particleIndexBuffer=this.context.createVertexBuffer(s,tH.members,!0),this.particleSegment=i.ad.simpleSegment(0,0,this.particleIndexBuffer.length,0),this.particleTextureDimension=a.width}update(r){return!(this.lastInvalidatedAt<r&&(this.lastInvalidatedAt=i.e.now(),1))}destroy(){this.targetColorTexture.destroy(),this.backgroundColorTexture.destroy(),this.particleIndexBuffer.destroy(),this.particleTexture0.destroy(),this.particleTexture1.destroy(),this.particleSegment.destroy()}}function tW(r,a,n,o,s){if(s>0){let l=i.e.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.b1(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}}var tX="#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;
109ivec4 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;}";i.bb["_prelude_raster_particle.glsl"]||(i.bb["_prelude_raster_particle.glsl"]=tX);var tY={building:i.bc
vendor: 11,697 bytes, line 109
109('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_indicator_cutout.fragment.glsl"\n#include "_prelude_feature_cutout.fragment.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#if defined(RENDER_FRONT_CUTOFF) || defined(ROUTE_CORRIDOR)\nin float v_dither_opacity;\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;if (x_major) {out_normal=-sign(v.x)*tbn[0];} else if (y_major) {out_normal=vec3(0.0,0.0,-sign(v.y));} else if (z_major) {out_color=v_faux_color_emissive.rgb;out_emissive=v.z <=0.0 ? get_emissive(id) : out_emissive;}float ao=1.0;if (u_faux_facade_ao_intensity > 0.0) {vec4 ao_range=v_faux_facade_window.xxyy*0.5-vec4(0,ao_radius,0,ao_radius);vec2 ao_range_z=vec2(window_depth*0.5)-vec2(0.0,ao_radius);if (x_major || y_major) {ao*=smoothstep(-ao_range_z.x,-ao_range_z.y,v.z);} else if (z_major) {ao*=smoothstep(-ao_range.x,-ao_range.y,v.x)*(1.0-smoothstep(ao_range.y,ao_range.x,v.x));ao*=smoothstep(-ao_range.z,-ao_range.w,v.y)*(1.0-smoothstep(ao_range.w,ao_range.z,v.y));}ao=mix(1.0,min(1.0,ao+0.25),u_faux_facade_ao_intensity);}out_color*=ao;return 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#if defined(RENDER_FRONT_CUTOFF) || defined(ROUTE_CORRIDOR)\nif (v_dither_opacity < 1.0) {int index=viewport_dither_index(gl_FragCoord.xy);if (v_dither_opacity < DITHER_THRESHOLDS[index]) {discard;}}\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"\n#include "_prelude_feature_cutout.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#if defined(RENDER_FRONT_CUTOFF) || defined(ROUTE_CORRIDOR)\n#ifdef RENDER_FRONT_CUTOFF\nuniform vec3 u_front_cutoff_params;\n#endif\nout float v_dither_opacity;\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;float frontCutoffOpacity=1.0;float routeFade=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\n{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);frontCutoffOpacity=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#if defined(RENDER_FRONT_CUTOFF) || defined(ROUTE_CORRIDOR)\nv_dither_opacity=1.0;\n#ifdef RENDER_FRONT_CUTOFF\nv_dither_opacity=min(v_dither_opacity,frontCutoffOpacity);\n#endif\n#endif\n}'),buildingBloom:
109i.bc("in vec4 v_color_emissive;\n#pragma mapbox: define-attribute highp vec4 bloom_attenuation\nfloat saturate(float val) {return clamp(val,0.0,1.0);}void main() {\n#pragma mapbox: initialize-attribute highp vec4 bloom_attenuation\nfloat 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:i.bc("void main() {}","in vec3 a_pos_3f;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos_3f,1.0);}"),rasterParticle:i.bc('#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;
109gl_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:i.bc("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:i.bc("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:i.bc('#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:i.bc("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);
109simPosLocal.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:i.bc("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:i.bc("uniform vec3 u_vignetteShape;uniform vec4 u_vignetteColor;in vec2 st;void main() {float screenDist=length(st);float alpha=clamp((screenDist-u_vignetteShape.x)/u_vignetteShape.y,0.0,1.0);alpha=pow(alpha,u_vignetteShape.z)*u_vignetteColor.a;vec3 color=u_vignetteColor.rgb;glFragColor=vec4(color*alpha,alpha) ;}","in vec2 a_pos_2f;out vec2 st;void main() {st=a_pos_2f;gl_Position=vec4(a_pos_2f,0,1);}"),elevatedStructuresDepth:i.bc("void main() {}","in ivec2 a_pos;in float a_height;uniform mat4 u_matrix;uniform float u_depth_bias;void main() {gl_Position=u_matrix*vec4(a_pos,a_height,1);gl_Position.z=gl_Position.z+u_depth_bias;}"),elevatedStructures:i.bc('#include "_prelude_fog.fragment.glsl"\n#include "_prelude_lighting.glsl"\n#include "_prelude_shadow.fragment.glsl"\n#include "_prelude_indicator_cutout.fragment.glsl"\n#include "_prelude_feature_cutout.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));}
109vec3 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;uniform float u_opacity_multiplier;\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 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);out_color*=u_opacity_multiplier;glFragColor=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}'),elevatedStructuresDepthReconstruct:i.bc('#include "_prelude_feature_cutout.fragment.glsl"\n#ifdef DEPTH_RECONSTRUCTION\nin float v_height;\n#endif\nvoid main() {\n#ifdef DEPTH_RECONSTRUCTION\nif (v_height >=0.0)\ndiscard;\n#else\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;}")};i.bc(tX,"");let tK=i.a$([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_rainParticleData",components:4}]),tJ=i.a$([{type:"Float32",name:"a_pos_2f",components:2}]);class tQ{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.bd,n=new i.ae;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,tJ.members),this.vignetteIdx=r.context.createIndexBuffer(n)}let s=i.ad.simpleSegment(0,0,4,6);if(this.vignetteVx&&this.vignetteIdx){r.uploadCommonUniforms(r.context,o);let l={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,i.Z.disabled,i._.disabled,i.a1.alphaBlended,i.$.disabled,l,"vignette",this.vignetteVx,this.vignetteIdx,s)}}}class t0{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.av(s.lng),h=i.av(s.lat),u=r.pixelsPerMeter/a,c=l*i.bk,d=i.bk*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 t1(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 t2(r){let a=i.bj(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.bi(r,o,s))}return n}function t3(r,a,n,o,s){let l=i.b1((s-n)/(o-n),0,1);return i.am(r,a,l)}class t5{constructor(i){this._movement=new t0,this._accumulatedTimeFromStart=0,this._prevTime=Date.now()/1e3,this._vignette=new tQ,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.be([]);i.bf(s,s,i.av(90)-n._pitch),i.bg(s,s,-n.angle);let l=i.bh(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.aQ([],h),c=i.X([],u,l),d=Date.now()/1e3;return this._accumulatedTimeFromStart+=(d-this._prevTime)*a,this._prevTime=d,{projectionMatrix:o,modelviewMatrix:c}}}let t4=i.a$([{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}]),t6=(i,r)=>({u_matrix:i,u_depth_bias:r}),t8=(i,r)=>({u_matrix:i,u_ground_shadow_factor:r,u_opacity_multiplier:1}),t9=(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});function t7(r,a){let n=1<<r.canonical.z,o=(a.x*n-r.canonical.x-r.wrap*n)*i.a6,s=(a.y*n-r.canonical.y)*i.a6,l=i.bn(a.z,a.y);return i.bi(o,s,l)}class ie{constructor(i=[]){this.tiles=i}getTile(i){for(let r of this.tiles)if(r.tileId.z===i.z&&r.tileId.x===i.x&&r.tileId.y===i.y)return r;return null}getTileOrParent(i){for(let r=i.z;r>0;--r){let a=Math.floor(i.x/(1<<i.z-r)),n=Math.floor(i.y/(1<<i.z-r));for(let i of this.tiles)if(i.tileId.z===r&&i.tileId.x===a&&i.tileId.y===n&&0!==i.frcMask)return i}return null}getFullCoverageMask(r){let a=null,n=0;for(let i=r.z;i>0;--i){let o=Math.floor(r.x/(1<<r.z-i)),s=Math.floor(r.y/(1<<r.z-i));for(let r of this.tiles)if(r.tileId.z===i&&r.tileId.x===o&&r.tileId.y===s){a=r,n=i;break}if(a)break}if(!a||0===a.frcMask)return null;let o=1<<r.z-n,s=i.a6/o,l=r.x%o*s,h=r.y%o*s,u=l+s,c=h+s,d=0;for(let i of a.polygons)0!==i.frcMask&&(i.hasGeometry()?0===i.rings.length||r.z<=n||function(i,r,a,n,o){let s=[0,0,0,0],l=[r,n,n,r],h=[a,a,o,o];for(let u of i){let i=u.length;if(!(i<2))for(let c=0,d=i-1;c<i;d=c++){let i=u[d].x,p=u[d].y,f=u[c].x,m=u[c].y;for(let r=0;r<4;++r)p>h[r]!=m>h[r]&&l[r]<i+(f-i)*(h[r]-p)/(m-p)&&s[r]++;let _=0,g=0;if(i<r?_|=1:i>n&&(_|=2),p<a?_|=4:p>o&&(_|=8),f<r?g|=1:f>n&&(g|=2),m<a?g|=4:m>o&&(g|=8),!(_&g)&&(0===_||0===g||function(i,r,a,n,o,s,l,h){let u=(i,r,a,n,o,s,l,h)=>{let u=(a-i)*(s-r)-(n-r)*(o-i),c=(a-i)*(h-r)-(n-r)*(l-i);if(u>0&&c>0||u<0&&c<0)return!1;let d=(l-o)*(r-s)-(h-s)*(i-o),p=(l-o)*(n-s)-(h-s)*(a-o);return!(d>0&&p>0||d<0&&p<0)};return!!(u(i,r,a,n,o,s,l,s)||u(i,r,a,n,l,s,l,h)||u(i,r,a,n,o,h,l,h)||u(i,r,a,n,o,s,o,h))}(i,p,f,m,r,a,n,o)))return!1}}for(let i=0;i<4;++i)if(!(1&s[i]))return!1;return!0}(i.rings,l,h,u,c)&&(d|=i.frcMask):d|=i.frcMask);return 0!==d?d:null}equals(i){if(this.tiles.length!==i.length)return!1;for(let r=0;r<this.tiles.length;++r){let a=this.tiles[r],n=i[r];if(a.tileId.z!==n.tileId.z||a.tileId.x!==n.tileId.x||a.tileId.y!==n.tileId.y||a.frcMask!==n.frcMask||a.polygons.length!==n.polygons.length)return!1}return!0}empty(){return 0===this.tiles.length}}class it{constructor(){this._tileCoverages=[],this._snapshot=new ie}clear(){this._tileCoverages=[]}addTileCoverage(i,r){this._tileCoverages.push({tileId:i,polygons:r,frcMask:function(i){let r=0;for(let a of i)r|=a.frcMask;return r}(r)})}empty(){return 0===this._tileCoverages.length}updateSnapshotIfNeeded(){if(this._snapshot.equals(this._tileCoverages))return this._snapshot;let i=this._tileCoverages.map(i=>({tileId:i.tileId,polygons:i.polygons,frcMask:i.frcMask}));return this._snapshot=new ie(i),this._snapshot}}function ii(i,r){let a={};if(!r)return a;for(let n of i){let i=n.layerIds.map(i=>
109r.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}let ir=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;ir[u+0]=a,ir[u+1]=n,ir[u+2]=o,ir[u+3]=s}let ia=new Uint16Array(2178),io=new Uint8Array(1089),is=new Uint16Array(1089);function il(i){return 0===i?-.03125:.03125*(32===i)}var ih=i.a$([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Uint16",components:2}]);let iu={type:2,extent:i.a6,loadGeometry:()=>[[new i.P(0,0),new i.P(i.a6+1,0),new i.P(i.a6+1,i.a6+1),new i.P(0,i.a6+1),new i.P(0,0)]]},ic,id=0;class ip{constructor(r,a,n,o,s,l){this.tileID=r,this.uid=i.aw(),this.uses=0,this.tileSize=a,this.tileZoom=n,this.dashIdealZ=r.overscaledZ,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasTunnelGeometry=!1,this.hasRTLText=!1,this.dependencies={},this.isRaster=s,o&&o.style&&(this._lastUpdatedBrightness=o.style.getBrightness()),this._lastAvailableImagesCount=0,this._firstPrepareComplete=!1,this.expiredRequestCount=0,this.state="loading",o&&o.transform&&(this.projection=o.transform.projection),this.worldview=l,this._hasAppearances=null}registerFadeDuration(r){let a=r+this.timeAdded;a<i.e.now()||void 0!==this.fadeEndTime&&a<this.fadeEndTime||(this.fadeEndTime=a)}wasRequested(){return"errored"===this.state||"loaded"===this.state||"reloading"===this.state}get tileTransform(){return this._tileTransform||(this._tileTransform=i.bq(this.tileID.canonical,this.projection)),this._tileTransform}loadVectorData(r,a,n){if(this.unloadVectorData(),this.state="loaded",r){for(let o in r.featureIndex&&(this.latestFeatureIndex=r.featureIndex,r.rawTileData?(this.latestRawTileData=r.rawTileData,this.latestFeatureIndex.rawTileData=r.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=r.collisionBoxArray,this.buckets=ii(r.buckets,a.style),r.frcCoveragePolygons&&r.frcCoveragePolygons.length>0&&(this.frcCoveragePolygons=r.frcCoveragePolygons),this.hasDeferredRoadStructure=!!r.hasDeferredRoadStructure,void 0!==r.parsedElevationFeatures&&(this.parsedElevationFeatures=r.parsedElevationFeatures,this.parsedElevationGeneration=++id),this.hasDeferredElevationFeatures=!!r.hasDeferredElevationFeatures,this.hasSymbolBuckets=!1,this.hasTunnelGeometry=!!r.hasTunnelGeometry,this.buckets){let r=this.buckets[o];if(r instanceof i.bv){if(this.hasSymbolBuckets=!0,!n)break;r.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(let r in this.buckets){let a=this.buckets[r];if(a instanceof i.bv&&a.hasRTLText){this.hasRTLText=!0,i.bO();break}}for(let i in this.queryPadding=0,this.buckets){let r=this.buckets[i],n=a.style.getOwnLayer(i);if(!n)continue;let o=n.queryRadius(r)||0;this.queryPadding=Math.max(this.queryPadding,o)}r.imageAtlas&&(this.imageAtlas=a.style.imageManager.imageAtlasCache.getOrCache(r.imageAtlas)),r.glyphAtlasImage&&(this.glyphAtlasImage=r.glyphAtlasImage),r.lineAtlas&&(this.lineAtlas=r.lineAtlas),this._lastUpdatedBrightness=r.brightness}else this.collisionBoxArray=new i.bu}resetPlacementVisibility(){for(let i in this.buckets)this.buckets[i].resetPlacementVisibility?.()}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={...this.buckets,...ii(i.buckets,r.style)}
109,i.featureIndex&&(this.latestFeatureIndex=i.featureIndex))}getBucket(i){return this.buckets[i.fqid]}upload(r,a){for(let i in this.buckets){let n=this.buckets[i];if(n.uploadPending()){let i={},o=[],s={zoom:0,pitch:0,brightness:0,worldview:""};if(a){if(a.style){o=a.style.listImages();let r=n.layers[0],s=r.sourceLayer||"_geojsonTileLayer",l=a.style.getLayerSourceCache(r);l&&(i=l._state.getState(s,void 0))}s={zoom:a.transform.zoom||0,pitch:a.transform.pitch||0,brightness:a.style.getBrightness()||0,worldview:a.worldview||""}}n.upload(r,this.tileID.canonical,i,o,s)}}let n=r.gl,o=this.imageAtlas;o&&a&&(this.imageAtlasTexture=a.style.imageManager.imageAtlasCache.getTextureForAtlas(o,r,n.RGBA8),o.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new i.T(r,this.glyphAtlasImage,n.R8),this.glyphAtlasImage=null),this.lineAtlas&&!this.lineAtlas.uploaded&&(this.lineAtlasTexture=new i.T(r,this.lineAtlas.image,n.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.getUpdatedPaintProperties(),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(r,a,n,o,s,l,h){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData&&!this.latestFeatureIndex.is3DTile)return{};let u=this.evaluateQueryRenderedFeaturePadding(),c=function(r,a){let n=i.bM([],[.5*r.width,-(.5*r.height),1]);return i.bN(n,n,[1,-1,0]),i.X(n,n,r.calculateProjMatrix(a.toUnwrapped())),Float32Array.from(n)}(s,this.tileID);return this.latestFeatureIndex.query(r,{tilespaceGeometry:a,pixelPosMatrix:c,transform:o,availableImages:n,tileTransform:this.tileTransform,worldview:this.worldview,queryRadius:u,scope:h})}querySourceFeatures(r,a){let n=this.latestFeatureIndex;if(!n||!n.rawTileData)return;let o=n.loadVTLayers(),s=a?a.sourceLayer:"",l=o._geojsonTileLayer||o[s];if(!l)return;let h=i.bw(a&&a.filter),{z:u,x:c,y:d}=this.tileID.canonical,p={z:u,x:c,y:d};for(let a=0;a<l.length;a++){let o=l.feature(a);if(h.needGeometry){let r=i.bx(o,!0);if(!h.filter(new i.aj(this.tileID.overscaledZ,{worldview:this.worldview}),r,this.tileID.canonical))continue}else if(!h.filter(new i.aj(this.tileID.overscaledZ,{worldview:this.worldview}),o))continue;let f=n.getId(o,s),m=new i.by(o,u,c,d,f);m.tile=p,r.push(m)}}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(r){let a=this.expirationTime;if(r.cacheControl){let a=i.bz(r.cacheControl);a["max-age"]&&(this.expirationTime=Date.now()+1e3*a["max-age"])}else r.expires&&(this.expirationTime=new Date(r.expires).getTime());if(this.expirationTime){let i=Date.now(),r=!1;if(this.expirationTime>i)r=!1;else if(a)if(this.expirationTime<a)r=!0;else{let n=this.expirationTime-a;n?this.expirationTime=i+Math.max(n,3e4):r=!0}else r=!0;r?(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(r,a,n,o,s,l){if(!this.latestFeatureIndex||!r.style)return;let h=l||r.style.listImages(),u=r.style.getBrightness(),c=s||new Set;for(let s in this.buckets){if(!r.style.hasLayer(s))continue;let l=this.buckets[s],d=l.layers[0],p=d.sourceLayer||"_geojsonTileLayer",f=r.style.getLayerSourceCache(d),m=l.layers.some(i=>c.has(i.fqid)),_=(o||m)&&l instanceof i.bv?r.style.getOwnLayer(s):void 0,g=n&&n[p]||{};f&&!n&&(g=f._state.getState(p,void 0));let y=this.imageAtlas?Object.fromEntries(this.imageAtlas.patternPositions):{},x=Object.keys(g).length>0&&!a;l.hasAppearances=l.layers.some(i=>i.appearances&&i.appearances.length>0);let v=x?l.stateDependentLayers:l.layers;if(x&&0!==l.stateDependentLayers.length||a||m||o){let n=this.latestFeatureIndex.loadVTLayers()[p];if(l.update(g,n,h,y,v,a,u,this.tileID.canonical),(o||m)&&(!a||a&&l instanceof i.bv&&(!l.text.uboBinder||l.text.uboBinder.isLightConstant||!l.icon.uboBinder||l.icon.uboBinder.isLightConstant))&&l instanceof i.bv&&_&&"symbol"===_.type&&(l.text&&l.text.uboBinder&&l.text.uboBinder.updateDynamicExpressions(_,n,this.tileID.canonical,h,g,u),l.icon&&l.icon.uboBinder&&l.icon.uboBinder.updateDynamicExpressions(_,n,this.tileID.canonical,h,g,u)),l instanceof i.bv){let i=r.context;l.text&&l.text.uboBinder&&l.text.uboBinder.upload(i),l.icon&&l.icon.uboBinder&&l.icon.uboBinder.upload(i)}}if(x&&0!==l.stateDependentLayers.length||a||l.hasAppearances){let a={zoom:r.transform.zoom,pitch:r.transform.pitch,brightness:r.style.getBrightness()||0,worldview:r.worldview},n=l.updateAppearances(this.tileID.canonical,g,h,a,r.imageManager,x&&0!==l.stateDependentLayers.length);if(n&&n.hasUboChanges){let a=r.context;l instanceof i.bv&&l.text&&l.text.uboBinder&&l.text.uboBinder.upload(a),l instanceof i.bv&&l.icon&&l.icon.uboBinder&&l.icon.uboBinder.upload(a)}}(l instanceof i.bA||l instanceof i.bB)&&r._terrain&&r._terrain.enabled&&f&&l.uploadPending()&&r._terrain._clearRenderCacheForTile(f.i
109d,this.tileID);let b=r&&r.style&&r.style.getOwnLayer(s);b&&(this.queryPadding=Math.max(this.queryPadding,b.queryRadius(l)||0))}}holdingForFade(){return void 0!==this.symbolFadeHoldUntil}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<i.e.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(r){this.symbolFadeHoldUntil=i.e.now()+r}setTexture(r,a){let n=a.context,o=n.gl;this.texture=this.texture||a.getTileTexture(r.width),this.texture&&this.texture instanceof i.T?this.texture.update(r):(this.texture=new i.T(n,r,o.RGBA8,{useMipmap:!0}),this.texture.bind(o.LINEAR,o.CLAMP_TO_EDGE))}setDependencies(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(r,a){if(!a||"mercator"===a.name||this._tileDebugBuffer)return;let n=i.bC(iu,this.tileID.canonical,this.tileTransform)[0],o=new i.bD,s=new i.bE;for(let i=0;i<n.length;i++){let{x:r,y:a}=n[i];o.emplaceBack(r,a),s.emplaceBack(i)}s.emplaceBack(0),this._tileDebugIndexBuffer=r.createIndexBuffer(s),this._tileDebugBuffer=r.createVertexBuffer(o,i.bF.members),this._tileDebugSegments=i.ad.simpleSegment(0,0,o.length,s.length)}_makeTileBoundsBuffers(r,a){let n,o;if(this._tileBoundsBuffer||!a||"mercator"===a.name)return;let s=i.bC(iu,this.tileID.canonical,this.tileTransform)[0];if(this.isRaster){let r=function(r,a){let n=i.bq(r,a),o=Math.pow(2,r.z);for(let s=0;s<33;s++)for(let l=0;l<33;l++){let h=i.br((r.x+(l+il(l))/32)/o),u=i.bs((r.y+(s+il(s))/32)/o),c=a.project(h,u),d=33*s+l;ia[2*d+0]=Math.round((c.x*n.scale-n.x)*i.a6),ia[2*d+1]=Math.round((c.y*n.scale-n.y)*i.a6)}io.fill(0),is.fill(0);for(let i=2045;i>=0;i--){let r=4*i,a=ir[r+0],n=ir[r+1],o=ir[r+2],s=ir[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((ia[2*d+0]+ia[2*p+0])/2-ia[2*f+0],(ia[2*d+1]+ia[2*p+1])/2-ia[2*f+1])>=16;io[f]=io[f]||+!!m,i<1022&&(io[f]=io[f]||io[(n+c>>1)*33+(a+u>>1)]||io[(s+c>>1)*33+(o+u>>1)])}let s=new i.bt,l=new i.ae,h=0;function u(r,a){let n=33*a+r;return 0===is[n]&&(s.emplaceBack(ia[2*n+0],ia[2*n+1],r*i.a6/32,a*i.a6/32),is[n]=++h),is[n]-1}function c(i,r,a,n,o,s){let h=i+a>>1,d=r+n>>1;if(Math.abs(i-o)+Math.abs(r-s)>1&&io[33*d+h])c(o,s,i,r,h,d),c(a,n,o,s,h,d);else{let h=u(i,r),c=u(a,n),d=u(o,s);l.emplaceBack(h,c,d)}}return c(0,0,32,32,32,0),c(32,32,0,0,0,32),{vertices:s,indices:l}}(this.tileID.canonical,a);n=r.vertices,o=r.indices}else{for(let{x:r,y:a}of(n=new i.bt,o=new i.ae,s))n.emplaceBack(r,a,0,0);let r=i.bG(n.int16.subarray(0,4*n.length),void 0,4);for(let i=0;i<r.length;i+=3)o.emplaceBack(r[i],r[i+1],r[i+2])}this._tileBoundsBuffer=r.createVertexBuffer(n,ih.members),this._tileBoundsIndexBuffer=r.createIndexBuffer(o),this._tileBoundsSegments=i.ad.simpleSegment(0,0,n.length,o.length)}_makeGlobeTileDebugBuffers(r,a){let n,o=a.projection;if(!o||"globe"!==o.name||a.freezeTileCoverage)return;let s=this.tileID.canonical,l=i.V(s,a),h=i.b5(l),u=i.S(a.zoom);u>0&&(n=i.aP(new Float64Array(16),a.globeMatrix)),this._makeGlobeTileDebugBorderBuffer(r,s,a,h,n,u),this._makeGlobeTileDebugTextBuffer(r,s,a,h,n,u)}_globePoint(r,a,n,o,s,l,h){let u=i.bH(r,a,n);if(l){let s=1<<n.z,c=i.a7(o.center.lng),d=i.a8(o.center.lat),p=(n.x+.5)/s-c,f=0;p>.5?f=-1:p<-.5&&(f=1);let m=(r/i.a6+n.x)/s+f,_=(a/i.a6+n.y)/s;m=(m-c)*o._pixelsPerMercatorPixel+c,_=(_-d)*o._pixelsPerMercatorPixel+d;let g=[m*o.worldSize,_*o.worldSize,0];i.bI(g,g,l),u=i.bJ(u,g,h)}return i.bI(u,u,s)}_makeGlobeTileDebugBorderBuffer(r,a,n,o,s,l){let h=new i.bD,u=new i.bE,c=new i.bK,d=(i,r,d,p,f)=>{let m=(d-i)/(f-1),_=(p-r)/(f-1),g=h.length;for(let d=0;d<f;d++){let p=i+d*m,f=r+d*_;h.emplaceBack(p,f);let y=this._globePoint(p,f,a,n,o,s,l);c.emplaceBack(y[0],y[1],y[2]),u.emplaceBack(g+d)}},p=i.a6;d(0,0,p,0,16),d(p,0,p,p,16),d(p,p,0,p,16),d(0,p,0,0,16),this._tileDebugIndexBuffer=r.createIndexBuffer(u),this._tileDebugBuffer=r.createVertexBuffer(h,i.bF.members),this._globeTileDebugBorderBuffer=r.createVertexBuffer(c,i.bL.members),this._tileDebugSegments=i.ad.simpleSegment(0,0,h.length,u.length)}_makeGlobeTileDebugTextBuffer(r,a,n,o,s,l){let h=i.a6/4,u=new i.bD,c=new i.ae,d=new i.bK;c.reserve(32),u.reserve(25),d.reserve(25);let p=(i,r)=>25*i+r;for(let i=0;i<25;i++){let r=i*h;for(let i=0;i<25;i++){let c=i*h;u.emplaceBack(c,r);let p=this._globePoint(c,r,a,n,o,s,l);d.emplaceBack(p[0],p[1],p[2])}}for(let i=0;i<4;i++)for(let r=0;r<4;r++){let a=p(i,r),n=p(i,r+1),o=p(i+1,r),s=p(i+1,r+1);c.emplaceBack(a,n,o),c.emplaceBack(o,n,s)}this._tileDebugTextIndexBuffer=r.createIndexBuffer(c),this._tileDebugTextBuffer=r.createVertexBuffer(u,i.bF.members),this._globeTileDebugTextBuffer=r.createVertexBuffer(d,i.bL.members),this._tileDebugTextSegments=i.ad.simpleSegment(0,0,25,32)}destroy(r=!0){for(let i in this.buckets)this.buckets[i].destroy(r);this.buckets={},this.imageAtlas&&(this.imageAtlas=null),this.lineAtlas&&(this.lineAtlas=null),this.imageAtlasTexture&&delete this.imageAtlasTexture,this.glyphAtlasTexture&&(this.glyphAtlasTexture.destroy(),delete this.glyphAtlasTexture),this.lineAtlasTexture&&(this.lineAtlasTexture.destroy(),delete this.lineAtlasTexture),this._tileBoundsBuffer&&(this._tileBoundsBuffer.destroy(),this._tileBoundsIndexBuffer.destroy(),this._tileBoundsSegments.destroy(),this._tileBoundsBuffer=null),this._tileDebugBuffer&&(this._tileDebugBuffer.destroy(),this._tileDebugSegments.destroy(),this._tileDebugBuffer=null),this._tileDebugIndexBuffer&&(this._tileDebugIndexBuffer.destroy(),this._tileDebugIndexBuffer=null),this._globeTileDebugBorderBuffer&&(this._globeTileDebugBorderBuffer.destroy(),this._globeTileDebugBorderBuffer=null),this._tileDebugTextBuffer&&(this._tileDebugTextBuffer.destroy(),this._tileDebugTextSegments.destroy(),this._tileDebugTextIndexBuffer.destroy(),this._tileDebugTextBuffer=null),this._globeTileDebugTextBuffer&&(this._globeTileDebugTextBuffer.destroy(),this._globeTileDebugTextBuffer=null),r&&this.texture&&this.texture instanceof i.T&&(this.texture.destroy(),delete this.texture),this.emissiveTexture&&this.emissiveTexture instanceof i.T&&(this.emissiveTexture.destroy(),delete this.emissiveTexture),this.hillshadeFBO&&(this.hillshadeFBO.destroy(),delete this.hillshadeFBO),this.dem&&delete this.dem,this.neighboringTiles&&delete this.neighboringTiles,this.demTexture&&(this.demTexture.destroy(),delete this.demTexture),this.rasterParticleState&&(this.rasterParticleState.destroy(),delete this.rasterParticleState),this.latestFeatureIndex=null,this.state="unloaded"}}class im{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 i_{constructor(){this.state=Object.create(null),this.stateChanges=Object.create(null),this.deletedStates=Object.create(null)}updateState(i,r,a){let n=String(r);if(this.stateChanges[i]=this.stateChanges[i]||Object.create(null),this.stateChanges[i][n]=this.stateChanges[i][n]||Object.create(null),Object.assign(this.stateChanges[i][n],a),null===this.deletedStates[i])for(let r in this.deletedStates[i]=Object.create(null),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]=Object.create(null),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]||Object.create(null),a&&void 0!==r)null!==this.deletedStates[i][n]&&(this.deletedStates[i][n]=this.deletedStates[i][n]||Object.create(null),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]=Object.create(null),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]||Object.create(null),n=this.stateChanges[i]||Object.create(null),o=this.deletedStates[i];if(null===o)return Object.create(null);if(void 0!==r){let i=String(r),s=Object.assign(Object.create(null),a[i],n[i]);if(o){let i=o[r];if(null===i)return Object.create(null);for(let r in i)delete s[r]}return s}let s=Object.assign(Object.create(null),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=Object.create(null);for(let i in this.stateChanges){this.state[i]=this.state[i]||Object.create(null);let r=Object.create(null);for(let a in this.stateChanges[i])this.state[i][a]||(this.state[i][a]=Object.create(null)),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]||Object.create(null);let r=Object.create(null);
vendor: 1,623 bytes, line 109
109if(null===this.deletedStates[i])for(let a in this.state[i])r[a]=Object.create(null),this.state[i][a]=Object.create(null);else for(let a in this.deletedStates[i]){if(null===this.deletedStates[i][a])this.state[i][a]=Object.create(null);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.create(null),Object.assign(a[i],r)}if(this.stateChanges=Object.create(null),this.deletedStates=Object.create(null),0!==Object.keys(a).length)for(let n in i)i[n].refreshFeatureState(r,a)}}class ig extends i.E{constructor(i,r,a){super(),this.id=i,this._renderSourceType=a,this._maxzoomOverride=null,this.setSource(r),this._tiles={},this._cache=new im(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 i_,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
109acheSize:this._maxTileCacheSize}setSource(i){i.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))}),i.on("error",()=>{this._sourceErrored=!0}),this._source=i}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(iy).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(iy).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.bP(o)){if(this._source.fire(new i.h("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.f(o,{tile:r}));return}r.timeAdded=i.e.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 Headers;s&&s.headers&&(l=s.headers),this._source.fire(new i.h("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){let o="raster-array"===this._source.type;for(let s in this._tiles){let l=this._tiles[s];if(n[s]||!l.hasData()||l.tileID.overscaledZ<=r||l.tileID.overscaledZ>a||o&&l.parentTile)continue;let h=l.tileID;for(;l&&l.tileID.overscaledZ>
109r+1;){let i=l.tileID.scaledTo(l.tileID.overscaledZ-1);(l=this._tiles[i.key])&&l.hasData()&&(h=i)}let u=h;for(;u.overscaledZ>r;)if(i[(u=u.scaledTo(u.overscaledZ-1)).key]){n[h.key]=h;let i=this._tiles[h.key];i&&(i.dashIdealZ=u.overscaledZ);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.bQ(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.bQ(1,0,1,0,0)),h.push(new i.bQ(1,0,1,1,0)),h.push(new i.bQ(1,0,1,0,1)),h.push(new i.bQ(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)}for(let i in this._tiles){let r=this._tiles[i];r.dashIdealZ=r.tileID.overscaledZ}let p=this._updateRetainedTiles(h);if(this._supportsFading&&0!==h.length){let r={},a={},n=i.e.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-ig.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.bR(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.bS.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)=>
109Math.min(i,r.overscaledZ),1/0),o=i[0].overscaledZ,s=Math.max(o-ig.maxOverzooming,this._source.minzoom),l=Math.max(o+ig.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)}if(this._retainLoadedChildren(h,n,l,r),"raster-array"===this._source.type){let a=this._source,n=this._tiles;for(let o of a.collectOverzoomParentTileIDs(n,i))r[o.key]=o}for(let n of i){let i=this._tiles[n.key];if(i.hasData())continue;if(n.canonical.z>=this._source.maxzoom){let i=n.children(this._source.maxzoom)[0],a=this.getTile(i);if(a&&a.hasData()){r[i.key]=i,a.dashIdealZ=n.overscaledZ;continue}}else{let i=n.children(this._source.maxzoom);if(r[i[0].key]&&r[i[1].key]&&r[i[2].key]&&r[i[3].key])continue}let o=i.wasRequested();for(let l=n.overscaledZ-1;l>=s;--l){let s=n.scaledTo(l);if(a[s.key]||(a[s.key]=!0,(i=this.getTile(s))||!o||(i=this._addTile(s)),i&&(r[s.key]=s,i.dashIdealZ=n.overscaledZ,o=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)),a.resetPlacementVisibility());let n=!!a;if(!n){let i=this.map?this.map.painter:null,n=this._source.tileSize*r.overscaleFactor();a="raster-array"===this._source.type?function(i,r,a,n,o){if(!ic)throw Error("Raster-array module is not loaded.");return ic(i,r,a,n,o)}(r,n,this.transform.tileZoom,i,this._isRaster):new ip(r,n,this.transform.tileZoom,i,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.h("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.a7(s.center.lng),u=s.getFreeCameraOptions().position||new i.bT(0,0,0);for(let c in this._tiles){let d,p=this._tiles[c];if(n&&p.clearQueryDebugViz(),!p.holdingForFade()){if(l){let r=p.tileID.canonical;if(0===r.z){let a=[Math.abs(i.b1(h,...ix(r,-1))-h),Math.abs(i.b1(h,...ix(r,1))-h)];d=[0,2*a.indexOf(Math.min(...a))-1]}else{let a=[Math.abs(i.b1(h,...ix(r,-1))-h),Math.abs(i.b1(h,...ix(r,0))-h),Math.abs(i.b1(h,...ix(r,1))-h)];d=[a.indexOf(Math.min(...a))-1]}}else d=[0];for(let i of d){let n=r.containsTile(p,s,a,i,u);n&&o.push(n)}}}return o}getShadowCasterCoordinates(){return this._getRenderableCoordinates(!1,!0)}getVisibleCoordinates(i){return this._getRenderableCoordinates(i)}_getRenderableCoordinates(i,r){if(!this.transform)return[];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){if(!this.transform)return i.slice();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;
109if(this._supportsFading){let r=i.e.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.bU(h,(i,r)=>{let a=new ip(i,this._source.tileSize*i.overscaleFactor(),this.transform.tileZoom,this.map.painter,this._isRaster,this._source.worldview);this._loadTile(a,i=>{"raster-dem"===this._source.type&&a.dem&&this._backfillDEM(a),r(i,a)})},a)}}function iy(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 ix(i,r){let a=1<<i.z;return[i.x/a+r,(i.x+1)/a+r]}function iv(i,r){return i.sourceFQID!==r.sourceFQID?i.sourceFQID<r.sourceFQID?-1:1:i.tileId.z!==r.tileId.z?i.tileId.z-r.tileId.z:i.tileId.x!==r.tileId.x?i.tileId.x-r.tileId.x:i.tileId.y-r.tileId.y}ig.maxOverzooming=10,ig.maxUnderzooming=3;class ib{constructor(i=[]){this.tiles=i}getTilesIntersecting(i){let r=[];for(let a of this.tiles)(function(i,r){if(i.z<=r.z){let a=r.z-i.z;return r.x>>a===i.x&&r.y>>a===i.y}let a=i.z-r.z;return i.x>>a===r.x&&i.y>>a===r.y})(a.tileId,i)&&r.push(a);return r}equals(i){if(this.tiles.length!==i.length)return!1;for(let r=0;r<this.tiles.length;++r){let a=this.tiles[r],n=i[r];if(a.sourceFQID!==n.sourceFQID||a.tileId.z!==n.tileId.z||a.tileId.x!==n.tileId.x||a.tileId.y!==n.tileId.y||a.generation!==n.generation)return!1}return!0}empty(){return 0===this.tiles.length}}class iw{constructor(){this._tiles=[],this._snapshot=new ib,this._snapshotChanged=!1}clear(){this._tiles.length=0}consumeSnapshotChanged(){let i=this._snapshotChanged;return this._snapshotChanged=!1,i}addTileElevation(i,r,a,n){this._tiles.push({sourceFQID:i,tileId:r,features:a,generation:n})}updateSnapshotIfNeeded(){return this._tiles.sort(iv),this._snapshot.equals(this._tiles)||(this._snapshot=new ib(this._tiles.slice()),this._snapshotChanged=!0),this._snapshot}}function iT(i,r){let a=[];for(let n of i.getTilesIntersecting(r))a.push(`${n.tileId.z}/${n.tileId.x}/${n.tileId.y}:${n.generation}`);return a.sort(),a.join("|")}function iS(i,r){return i._mergedOtherSourceCaches[r]||i._mergedSymbolSourceCaches[r]}function iE(i){return!("none"===i.visibility||!i.sourceLayer||"fill"!==i.type||!i.layout||"hd-road-base"!==i.layout.get("fill-elevation-reference"))}function iI(i){return!!i.layout&&("line"===i.type&&"hd-road-markup"===i.layout.get("line-elevation-reference")||"circle"===i.type&&"hd-road-markup"===i.layout.get("circle-elevation-reference")||"symbol"===i.type&&"hd-road-markup"===i.layout.get("symbol-elevation-reference")||"fill"===i.type&&"hd-road-markup"===i.layout.get("fill-elevation-reference"))}function iA(r){let a=new Set;for(let n in r._mergedLayers){let o=r._mergedLayers[n];iI(o)&&a.add(i.m(o.source,o.scope))}return a}function iM(i){let r=iA(i);if(0===r.size)return!1;let a=iC(i);for(let i of r)for(let r of a)if(i!==r)return!0;return!1}function iC(r){let a=new Set;for(let n in r._mergedLayers){let o=r._mergedLayers[n];o.source&&iE(o)&&a.add(i.m(o.source,o.scope))}return a}function iP(r,a,n){let o=new Set;for(let a in r._mergedLayers){let n=r._mergedLayers[a];"none"!==n.visibility&&iI(n)&&o.add(i.m(n.source,n.scope))}if(0!==o.size){if(!n)for(let i of iC(r))o.delete(i);if(0!==o.size)for(let i of[r._mergedOtherSourceCaches,r._mergedSymbolSourceCaches])for(let r in i){if(!o.has(r))continue;let n=i[r];for(let i in n._tiles){let r=n._tiles[i];r&&(a&&!a(r)||(r.hasDeferredElevationFeatures=!1,n._reloadTile(+i,"reloading")))}}}}class iR{constructor(){this.manager=new iw,this._needsCrossSourceElevation=!1,this._ingestFQIDs=new Set,this._terrainActiveLast=void 0}}function iD(i){i.map&&i.map.painter&&(i.map.painter.elevationCoverageSnapshot=null,i.map.painter.elevationProvidersReady=void 0)}function iL(i){if(i._crossSourceElevationActive=!1,function(i){let r=i._hdElevation,a=!!(i.map&&i.map.painter&&i.map.painter.elevationCoverageSnapshot);return r?!r._needsCrossSourceElevation&&0===r._ingestFQIDs.size&&0===r.manager._tiles.length&&!a:!a}(i))return;let r=!!i._hdElevation&&i._hdElevation._needsCrossSourceElevation;iD(i),i._hdElevation&&(i._hdElevation._needsCrossSourceElevation=!1,i._hdElevation._ingestFQIDs.clear(),i._hdElevation.manager.clear(),i._hdElevation._terrainActiveLast=void 0,r&&iP(i,void 0,!0))}function iz(r,a){if(tu(r,r.map&&r.map.transform))return a.manager.clear(),void(r.map.painter&&(r.map.painter.elevationCoverageSnapshot=null));if(!a._needsCrossSourceElevation)return void iD(r);a.manager.clear();let n=!0;for(let i of a._ingestFQIDs){let o=iS(r,i);if(!o)continue;let s=o._tiles;for(let r in s){let o=s[r];if(!o||!o.loaded())continue;let l=o.parsedElevationFeatures;void 0!==l?a.manager.addTileElevation(i,o.tileID.canonical,l,o.parsedElevationGeneration):n=!1}}let o=a.manager._snapshot,s=a.manager.updateSnapshotIfNeeded();r.map.painter&&(r.map.painter.elevationCoverageSnapshot=s.empty()?null:s);let l=n&&function(i,r){for(let a of r){let r=iS(i,a);if(!r||!r._sourceLoaded)return!1;for(let i in r._tiles){let a=r._tiles[i];if(a&&("loading"===a.state||"reloading"===a.state))return!1}}return!0}(r,function(r){let a=iA(r),n=new Set;for(let o in r._mergedLayers){let s=r._mergedLayers[o];if(!s.source||!iE(s))continue;let l=i.m(s.source,s.scope);a.has(l)||n.add(l)}return n}(r));r.map.painter&&(r.map.painter.elevationProvidersReady=l);let h=a.manager.consumeSnapshotChanged();(h||l)&&iP(r,i=>{var r;
109return!!i.hasDeferredElevationFeatures||h&&iT(o,r=i.tileID.canonical)!==iT(s,r)})}let iF=i=>({u_matrix:i});function iO(r,a){if(!r.frcCoverageSnapshot||!r.frcCoverageRenderer)return null;let n=r.frcCoverageSnapshot.getTileOrParent(a.canonical);if(!n||0===n.frcMask)return null;let o=r.frcCoverageRenderer.getBuffers(n.tileId);if(!o)return null;let s=new i.bW(n.tileId.z,n.tileId.x,n.tileId.y),l=new i.bX(a.wrap,s);return{buffers:o,projMatrix:r.transform.calculateProjMatrix(l),coverageTile:n}}function iB(r,a,n,o,s){if(0===a.length)return;let l=0;for(let i of a)l|=i.frcMask;let h=a.map(i=>i.coord);for(let u=0;u<9;++u)if(l&1<<u){if(function(r,a,n){if(!r.frcCoverageSnapshot)return;let o=r.context,s=o.gl,l=r.getOrCreateProgram("clippingMask");for(let h of(o.setColorMode(i.a1.disabled),o.setDepthMode(i.Z.disabled),a)){let a=iO(r,h);if(!a)continue;let o=a.buffers.frcLevelSegments[n];o&&l.draw(r,s.TRIANGLES,i.Z.disabled,new i._({func:s.EQUAL,mask:255},r._tileClippingMaskIDs[h.key]||0,255,s.KEEP,s.KEEP,s.INVERT),i.a1.disabled,i.$.disabled,iF(a.projMatrix),`$frc_coverage_${n}`,a.buffers.vertexBuffer,a.buffers.indexBuffer,o)}}(r,h,u),o)for(let n of a)n.frcMask&1<<u&&o(n,u,function(r,a){let n=r.context.gl;return new i._({func:n.EQUAL,mask:255},r._tileClippingMaskIDs[a.key]||0,0,n.KEEP,n.KEEP,n.KEEP)}(r,n.coord));if(n>0&&s)for(let n of a)n.frcMask&1<<u&&s(n,u,function(r,a){let n=r.context.gl;return new i._({func:n.EQUAL,mask:255},255&~(r._tileClippingMaskIDs[a.key]||0),0,n.KEEP,n.KEEP,n.KEEP)}(r,n.coord));!function(r,a,n){if(!r.frcCoverageSnapshot)return;let o=r.context,s=o.gl,l=r.getOrCreateProgram("clippingMask");for(let h of(o.setColorMode(i.a1.disabled),o.setDepthMode(i.Z.disabled),a)){let a=iO(r,h);if(!a)continue;let o=a.buffers.frcLevelSegments[n];o&&l.draw(r,s.TRIANGLES,i.Z.disabled,new i._({func:s.EQUAL,mask:255},255&~(r._tileClippingMaskIDs[h.key]||0),255,s.KEEP,s.KEEP,s.INVERT),i.a1.disabled,i.$.disabled,iF(a.projMatrix),`$frc_coverage_restore_${n}`,a.buffers.vertexBuffer,a.buffers.indexBuffer,o)}}(r,h,u)}}function ik(i){for(let r of i)if(r.rings.length>0&&r.rings[0].length>0)return!0;return!1}function iN(i){let r=i.frcCoverageFadeRange;return!r||r[1]<=r[0]?0:1-Math.max(0,Math.min(1,(i.transform.zoom-r[0])/(r[1]-r[0])))}let iV=function(r,a,n,o){r.currentLayer<r.firstLightBeamLayer&&(r.firstLightBeamLayer=r.currentLayer);let s=n.paint.get("building-ambient-occlusion-ground-intensity"),l=n.paint.get("building-ambient-occlusion-ground-radius"),h=n.paint.get("building-ambient-occlusion-ground-attenuation"),u=n.paint.get("building-opacity");if(u<=0)return;let c=s>0&&l>0,d=!0,p=n.paint.get("building-vertical-scale");if(p<=0)return;r.shadowRenderer||(d=!1);let f=r.conflationActive&&r.style.isLayerClipped(n,a.getSource()),m=r.style.order.indexOf(n.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))}}(r,a,n,m,f,o),function(i,r,a,n){for(let o of n){let n=r.getTile(o).getBucket(a);n&&n.needsEvaluation()&&n.uploadUpdatedColorBuffer(i.context)}}(r,a,n,o),n.resetLayerRenderingStats(r),r.shadowRenderer&&(r.shadowRenderer.useNormalOffset=!0),"shadow"===r.renderPass&&r.shadowRenderer){let s=r.shadowRenderer.getShadowPassDepthMode();tk({painter:r,source:a,layer:n,coords:o,defines:[],blendMode:i.a1.disabled,depthMode:s,opacity:u,verticalScale:p,facadeEmissiveChance:0,facadeAOIntensity:0,floodLightIntensity:0,floodLightColor:[0,0,0]})}else if("translucent"===r.renderPass){let m=["HAS_ATTRIBUTE_a_part_color_emissive","LIGHTING_3D_MODE"];d&&(m=m.concat("RENDER_SHADOWS")),r.shadowRenderer&&r.shadowRenderer.useNormalOffset&&(m=m.concat("NORMAL_OFFSET"));let _=n.paint.get("building-facade-emissive-chance"),g=n.paint.get("building-ambient-occlusion-intensity"),y=n.paint.get("building-flood-light-intensity"),x="none"===n.paint.get("building-flood-light-color-use-theme").constantOr("default"),v=n.paint.get("building-flood-light-color").toNonPremultipliedRenderColor(x?null:n.lut).toArray01().slice(0,3),b=n.paint.get("building-flood-light-ground-attenuation"),w=y>0,T=new i.Z(r.context.gl.LEQUAL,i.Z.ReadWrite,r.depthRangeFor3D);u<1&&tk({painter:r,source:a,layer:n,coords:o,defines:m,blendMode:i.a1.disabled,depthMode:T,opacity:u,verticalScale:p,facadeEmissiveChance:_,facadeAOIntensity:g,floodLightIntensity:y,floodLightColor:v,depthOnly:!0});let S=r.colorModeForRenderPass();tk({painter:r,source:a,layer:n,coords:o,defines:m,blendMode:S,depthMode:T,opacity:u,verticalScale:p,facadeEmissiveChance:_,facadeAOIntensity:g,floodLightIntensity:y,floodLightColor:v});let E=n.paint.get("building-front-cutoff");tR(r.transform.pitch,E,!!r.terrain),c&&tN(r,a,n,o,!0,u,s,l,y,v,h,f),w&&tN(r,a,n,o,!1,u,s,l,y,v,b,f)}else if("light-beam"===r.renderPass){let s=new i.Z(r.context.gl.LEQUAL,i.Z.ReadOnly,r.depthRangeFor3D);tk({painter:r,source:a,layer:n,coords:o,defines:["HAS_ATTRIBUTE_a_part_color_emissive","HAS_ATTRIBUTE_a_bloom_attenuation"],blendMode:i.a1.alphaBlended,depthMode:s,opacity:u,verticalScale:p,facadeEmissiveChance:0,facadeAOIntensity:0,floodLightIntensity:0,floodLightColor:[0,0,0]})}r.shadowRenderer&&(r.shadowRenderer.useNormalOffset=!1),r.resetStencilClippingMasks()},iU=class{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 r of o.featuresOnBorder)o.footprints[r.footprintIndex].hiddenFlags&i.aS||(l.has(r.featureId)?n.push(r.footprintIndex):(l.add(r.featureId),a.push(r.footprintIndex)));o.updateFootprintHiddenFlags(a,i.aT,!1),o.updateFootprintHiddenFlags(n,i.aT,!0)}}},ij=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("raster-array"!==h.type)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.b9(2*r+0)+.05),o=.9090909090909091*(i.b9(2*r+1)+.
10905),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.b({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)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=tZ(i.ba,l,[0,n.paint.get("raster-particle-max-speed")]),h=t$(i.ba,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 tq(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.e.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,i.Z.disabled,i._.disabled,i.a1.alphaBlended,i.$.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.aC[r](o));_.push(o);let g=o.canonical.x,y=o.canonical.y;for(let s of _){let h=a.getTile(u?s.wrapped():s);if(!h)continue;let d=h.rasterParticleState;if(!d)continue;let f=s.canonical.x+(1<<s.canonical.z)*(s.wrap-o.wrap),_=s.canonical.y;d.particleTexture0.bind(l.NEAREST,l.CLAMP_TO_EDGE);let x=tj(1,d.particleTexture0.size[0],[f-g,_-y],0,p.texture.size,2,c,p.textureOffset,p.scale,p.offset);m.draw(r,l.POINTS,i.Z.disabled,i._.disabled,i.a1.alphaBlended,i.$.disabled,x,n.id,d.particleIndexBuffer,void 0,d.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;for(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=tG(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,i.Z.disabled,i._.disabled,i.a1.unblended,i.$.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.an(i.b2,i.b2+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=tW(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
109),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.b3(o.canonical),R=i.b4(P.getCenter().lat);d?(g=Float32Array.from(i.b5(i.b6(o.canonical))),y=Float32Array.from(M.globeMatrix),x=Float32Array.from(i.b7(M)),v=[i.a7(M.center.lng),i.a8(M.center.lat)],b=Float32Array.from(i.b8(o.canonical,P,R,M.worldSize/M._pixelsPerMercatorPixel))):(g=new Float32Array(16),y=new Float32Array(9),x=new Float32Array(16),v=[0,0],b=new Float32Array(9));let D=tU(A,g,y,x,b,f||[0,0],i.S(r.transform.zoom),v,C,h||1,I,u),L=r.isTileAffectedByFog(o),z=r.getOrCreateProgram("rasterParticle",{defines:m,overrideFog:L});if(r.uploadCommonUniforms(s,z,w),d){let a=new i.Z(l.LEQUAL,i.Z.ReadOnly,r.depthRangeFor3D),o=r.globeSharedBuffers;if(o){let[s,h,u]=o.getGridBuffers(R,!1);z.draw(r,l.TRIANGLES,a,_,i.a1.alphaBlended,r.renderElevatedRasterBackface?i.$.frontCCW:i.$.backCCW,D,n.id,s,h,u)}}else{let a=r.depthModeForSublayer(0,i.Z.ReadOnly),s=p[o.overscaledZ],{tileBoundsBuffer:h,tileBoundsIndexBuffer:u,tileBoundsSegments:c}=r.getTileBoundsBuffers(T);z.draw(r,l.TRIANGLES,a,s,i.a1.alphaBlended,i.$.disabled,D,n.id,h,u,c)}}r.resetStencilClippingMasks()}(r,a,n,o),r.style.map.triggerRepaint())},iG=function(i,r,a){let n=r.getSource();if("raster-array"!==n.type||!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)&&(a._isHeaderLoaded||a.parentTile)&&n.prepareTile(a,o,i.id,s)},iZ=class extends t5{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=t2(this.particlesCount),n=new i.bl,o=new i.ae,s=0,l=i.bj(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,tK.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.dropletSizeX=r.dropletSize[0],a.droplet
109SizeYScale=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=t3(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=t1(this._movement.getPosition(),a),u=n.dropletSizeX,d=n.dropletSizeX*n.dropletSizeYScale,g=r.width/2,y=r.height/2,x=t3(0,n.screenThinning.start,0,1,n.screenThinning.intensity),v=t3(.001,n.screenThinning.range,0,1,n.screenThinning.intensity),b=t3(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.ad.simpleSegment(0,0,4*T,2*T);m.draw(r,p.TRIANGLES,i.Z.disabled,i._.disabled,i.a1.alphaBlended,i.$.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)}},i$=class extends t5{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=t2(this.particlesCount),n=new i.bm,o=new i.ae,s=0,l=i.bj(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,t4.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;
109let 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=t3(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=t1(this._movement.getPosition(),a),u=f.width/2,d=f.height/2,_=t3(0,o.screenThinning.start,0,1,o.screenThinning.intensity),g=t3(.001,o.screenThinning.range,0,1,o.screenThinning.intensity),y=t3(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.ad.simpleSegment(0,0,4*v,2*v);this.particlesVx&&this.particlesIdx&&m.draw(r,p.TRIANGLES,i.Z.disabled,i._.disabled,i.a1.alphaBlended,i.$.disabled,x,"snow_particles",this.particlesVx,this.particlesIdx,b)})(n.boxSize,0,n),this._vignette.draw(r,l)}},iH=tY,iq={building:r=>({u_matrix:new i.a4(r),u_normal_matrix:new i.a4(r),u_opacity:new i.a3(r),u_faux_facade_ao_intensity:new i.a3(r),u_camera_pos:new i.a5(r),u_tile_to_meter:new i.a3(r),u_facade_emissive_chance:new i.a3(r),u_flood_light_color:new i.a5(r),u_flood_light_intensity:new i.a3(r),u_front_cutoff_params:new i.a5(r)}),buildingBloom:r=>({u_matrix:new i.a4(r)}),buildingDepth:r=>({u_matrix:new i.a4(r)}),elevatedStructuresDepth:r=>({u_matrix:new i.a4(r),u_depth_bias:new i.a3(r)}),elevatedStructures:r=>({u_matrix:new i.a4(r),u_ground_shadow_factor:new i.a5(r),u_opacity_multiplier:new i.a3(r)}),elevatedStructuresDepthReconstruct:r=>({u_matrix:new i.a4(r),u_camera_pos:new i.a5(r),u_depth_bias:new i.a3(r),u_height_scale:new i.a3(r),u_reset_depth:new i.a3(r)}),rasterParticle:r=>({u_matrix:new i.a4(r),u_normalize_matrix:new i.a4(r),u_globe_matrix:new i.a4(r),u_merc_matrix:new i.a4(r),u_grid_matrix:new i.a_(r),u_tl_parent:new i.a2(r),u_scale_parent:new i.a3(r),u_fade_t:new i.a3(r),u_opacity:new i.a3(r),u_image0:new i.aY(r),u_image1:new i.aY(r),u_raster_elevation:new i.a3(r),u_zoom_transition:new i.a3(r),u_merc_center:new i.a2(r),u_cutoff_params:new i.aZ(r)}),rasterParticleTexture:r=>({u_texture:new i.aY(r),u_opacity:new i.a3(r)}),rasterParticleDraw:r=>({u_particle_texture:new i.aY(r),u_particle_texture_side_len:new i.a3(r),u_tile_offset:new i.a2(r),u_velocity:new i.aY(r),u_color_ramp:new i.aY(r),u_velocity_res:new i.a2(r),u_max_speed:new i.a3(r),u_uv_offset:new i.a2(r),u_data_scale:new i.a2(r),u_data_offset:new i.a3(r),u_particle_pos_scale:new i.a3(r),u_particle_pos_offset:new i.a2(r)}),rasterParticleUpdate:r=>({u_particle_texture:new i.aY(r),u_particle_texture_side_len:new i.a3(r),u_velocity:new i.aY(r),u_velocity_res:new i.a2(r),u_max_speed:new i.a3(r),u_speed_factor:new i.a3(r),u_reset_rate:new i.a3(r),u_rand_seed:new i.a3(r),u_uv_offset:new i.a2(r),u_data_scale:new i.a2(r),u_data_offset:new i.a3(r),u_particle_pos_scale:new i.a3(r),u_particle_pos_offset:new i.a2(r)}),snowParticle:r=>
109({u_modelview:new i.a4(r),u_projection:new i.a4(r),u_time:new i.a3(r),u_cam_pos:new i.a5(r),u_velocityConeAperture:new i.a3(r),u_velocity:new i.a3(r),u_horizontalOscillationRadius:new i.a3(r),u_horizontalOscillationRate:new i.a3(r),u_boxSize:new i.a3(r),u_billboardSize:new i.a3(r),u_simpleShapeParameters:new i.a2(r),u_screenSize:new i.a2(r),u_thinningCenterPos:new i.a2(r),u_thinningShape:new i.a5(r),u_thinningAffectedRatio:new i.a3(r),u_thinningParticleOffset:new i.a3(r),u_particleColor:new i.aZ(r),u_direction:new i.a5(r)}),rainParticle:r=>({u_modelview:new i.a4(r),u_projection:new i.a4(r),u_time:new i.a3(r),u_cam_pos:new i.a5(r),u_texScreen:new i.aY(r),u_velocityConeAperture:new i.a3(r),u_velocity:new i.a3(r),u_boxSize:new i.a3(r),u_rainDropletSize:new i.a2(r),u_distortionStrength:new i.a3(r),u_rainDirection:new i.a5(r),u_color:new i.aZ(r),u_screenSize:new i.a2(r),u_thinningCenterPos:new i.a2(r),u_thinningShape:new i.a5(r),u_thinningAffectedRatio:new i.a3(r),u_thinningParticleOffset:new i.a3(r),u_shapeDirectionalPower:new i.a3(r),u_shapeNormalPower:new i.a3(r),u_mode:new i.a3(r)}),vignette:r=>({u_vignetteShape:new i.a5(r),u_vignetteColor:new i.aZ(r)})},iW=function(r){let{painter:a,sourceCache:n,layer:o,coords:s,colorMode:l}=r,h=a.context.gl,u=r.painter.shadowRenderer,c=!!u&&u.enabled,d=new i.Z(a.context.gl.LEQUAL,i.Z.ReadOnly,a.depthRangeFor3D),p=[0,0,0];if(c){let r=a.style.directionalLight,n=a.style.ambientLight;r&&n&&(p=i.aG(a.style,r,n))}let f=r=>{for(let f of s){let s,m,_=n.getTile(f),g=_.getBucket(o);if(!g)continue;let y=g.hdExt?g.hdExt.elevatedStructures:void 0;if(!y||(r?(s=y.renderableBridgeSegments,m=y.bridgeProgramConfigurations.get(o.id)):(s=y.renderableTunnelSegments,m=y.tunnelProgramConfigurations.get(o.id)),!s||0===s.segments[0].primitiveLength))continue;m.updatePaintBuffers(),a.prepareDrawTile();let x=a.isTileAffectedByFog(f),v=[];c&&v.push("RENDER_SHADOWS","NORMAL_OFFSET");let b=a.getOrCreateProgram("elevatedStructures",{config:m,overrideFog:x,defines:v}),w=a.translatePosMatrix(f.projMatrix,_,o.paint.get("fill-translate"),o.paint.get("fill-translate-anchor"));c&&u.setupShadows(_.tileID.toUnwrapped(),b,"vector-tile");let T=t8(w,p);a.uploadCommonUniforms(a.context,b,f.toUnwrapped()),b.draw(a,h.TRIANGLES,d,i._.disabled,l,i.$.backCCW,T,o.id,y.vertexBuffer,y.indexBuffer,s,o.paint,a.transform.zoom,m,[y.vertexBufferNormal])}};f(!0),f(!1)},iX=function(r){let{painter:a,sourceCache:n,layer:o,coords:s}=r,l=a.context.gl,h=r.painter.shadowRenderer;for(let r of s){let s=n.getTile(r),u=s.getBucket(o);if(!u)continue;let c=u.hdExt?u.hdExt.elevatedStructures:void 0;if(!c||!c.shadowCasterSegments||0===c.shadowCasterSegments.segments[0].primitiveLength)continue;a.prepareDrawTile();let d=u.bufferData.programConfigurations.get(o.id),p=a.isTileAffectedByFog(r),f=a.getOrCreateProgram("elevatedStructuresDepth",{config:d,overrideFog:p}),m=h.calculateShadowPassMatrixFromTile(s.tileID.toUnwrapped());a.uploadCommonUniforms(a.context,f,r.toUnwrapped());let _=t6(m,0);f.draw(a,l.TRIANGLES,h.getShadowPassDepthMode(),i._.disabled,i.a1.disabled,i.$.disabled,_,o.id,c.vertexBuffer,c.indexBuffer,c.shadowCasterSegments,o.paint,a.transform.zoom,d)}},iY=function(r,a,n,o,s){var l;let h,u;if(!a||!n.layout||"none"===n.layout.get("fill-elevation-reference")||0===n.paint.get("fill-opacity").constantOr(1))return;let c=r.context.gl,d=new i.Z(r.context.gl.LEQUAL,i.Z.ReadWrite,r.depthRangeFor3D),p=new i.Z(r.context.gl.GREATER,i.Z.ReadWrite,r.depthRangeFor3D),f=(l=r.transform,u=.01,l.isOrthographic&&(u=i.am(1e-4,u,i.bp(l.pitch>=i.bo?1:l.pitch/i.bo))),2*u),m=r.transform.getFreeCameraOptions().position,_="elevatedStructuresDepthReconstruct";for(let l of o){let o,u,g,y=a.getTile(l),x=y.getBucket(n);if(!x||!x.hdExt)continue;let v=x.hdExt.elevatedStructures,b=x.hdExt.elevationBufferData;if(!v||!v.depthSegments||!b)continue;let w=b.heightRange,T=t7(l.toUnwrapped(),m),S=r.translatePosMatrix(l.projMatrix,y,n.paint.get("fill-translate"),n.paint.get("fill-translate-anchor"));if("initialize"===s){if(!w||w.min>=1||0===v.depthSegments.segments[0].primitiveLength)continue;o=t9(S,T,f,1,0),u=d,g=v.depthSegments,h=h||r.getOrCreateProgram(_,{defines:["DEPTH_RECONSTRUCTION"]})}else if("reset"===s){if(!w||w.min>=0||0===v.maskSegments.segments[0].primitiveLength)continue;o=t9(S,T,0,0,1),u=p,g=v.maskSegments,h=h||r.getOrCreateProgram(_,{defines:["DEPTH_RECONSTRUCTION"]})}else if("geometry"===s){if(0===v.depthSegments.segments[0].primitiveLength)continue;o=t9(S,T,f,1,0),u=d,g=v.depthSegments,h=h||r.getOrCreateProgram(_)}h.draw(r,c.TRIANGLES,u,i._.disabled,i.a1.disabled,i.$.disabled,o,n.id,v.vertexBuffer,v.indexBuffer,g,n.paint,r.transform.zoom)}},iK=function(r,a,n,o){let s;if(!a||!n.layout||"none"===n.layout.get("fill-elevation-reference")||0===n.paint.get("fill-opacity").constantOr(1))return;let l=r.context.gl,h=new i.Z(l.LEQUAL,i.Z.ReadOnly,r.depthRangeFor3D),u=new i._({func:l.ALWAYS,mask:255},255,255,l.KEEP,l.KEEP,l.REPLACE),c=r.transform.getFreeCameraOptions().position;for(let d of o){let o=a.getTile(d),p=o.getBucket(n);if(!p)continue;let f=p.hdExt?p.hdExt.elevatedStructures:void 0;if(!f||!f.depthSegments||0===f.depthSegments.segments[0].primitiveLength)continue;let m=t7(d.toUnwrapped(),c),_=r.translatePosMatrix(d.projMatrix,o,n.paint.get("fill-translate"),n.paint.get("fill-translate-anchor"));s=s||r.getOrCreateProgram("elevatedStructuresDepthReconstruct");let g=t9(_,m,0,1,0);s.draw(r,l.TRIANGLES,h,u,i.a1.disabled,i.$.disabled,g,n.id,f.vertexBuffer,f.indexBuffer,f.depthSegments,n.paint,r.transform.zoom)}},iJ=class extends i.E{constructor(r,a=!1){super(),this._style=r,this._buildings={},this._activeFloors=new Set,this._closestBuildingId=null,this._indo
109orState={selectedFloorId:null,activeFloorsVisible:!0,activeFloors:this._activeFloors},this._buildingDetectionStrategy=new tV,this._initialLoadDone=!1,i.aW(["_updateUI"],this);let n=()=>{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))};a?(this._initialLoadDone=!0,n()):this._style.on("style.load",n)}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.h("selector-update",this.getControlState()))}_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.aX.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))}},iQ=class{constructor(){this.coverageSourceCaches={},this.manager=new it}},i0=function(i,r){for(let a in r.manager.clear(),i._mergedHdRoadCoverageSourceCaches){let n=i._mergedHdRoadCoverageSourceCaches[a]._tiles;for(let i in n){let a=n[i];if(!a||!a.loaded())continue;let o=a.frcCoveragePolygons;r.manager.addTileCoverage(a.tileID.canonical,o&&o.length>0?o:[])}}let a=r.manager.updateSnapshotIfNeeded();if(i.map.painter&&(i.map.painter.frcCoverageSnapshot=a.empty()?null:a),!a.empty())for(let r of[i._mergedOtherSourceCaches,i._mergedSymbolSourceCaches])for(let i in r){let a=r[i];for(let i in a._tiles){let r=a._tiles[i];r&&r.hasDeferredRoadStructure&&(r.hasDeferredRoadStructure=!1,a._reloadTile(+i,"reloading"))}}},i1=function(r,a,n){if("fill"!==n.type||n.sourceLayer!==i.bV||a.coverageSourceCaches[n.source])return;let o=r.getOwnSource(n.source);if(!o||"vector"!==o.type)return;let s=`hd-road-coverage:${n.source}`,l=i.m(s,r.scope),h=r._sourceCaches[s]=new ig(l,o,i.bS.HdRoadCoverage);a.coverageSourceCaches[n.source]=h,h.setMaxzoomOverride(14),h.onAdd(r.map);let u=r._otherSourceCaches[n.source];u&&u._sourceLoaded&&(h._sourceLoaded=!0)},i2=function(r,a){let n=null,o=null,s={globals:{zoom:0}};r.forEachFragmentStyle(a=>{if(n)return;let l=a.stylesheet?a.stylesheet.schema:null;if(!l||!l.sdCoverageFadeRange)return;let h=i.m("sdCoverageFadeRange",a.scope),u=a.options?a.options.get(h):void 0,c=u?u.value||u.default:null;if(c){let i=c.evaluate(s);Array.isArray(i)&&2===i.length&&(i[0]>0||i[1]>0)&&(n=[i[0],i[1]])}let d=i.m("sdCoverageSourceLayers",a.scope),p=a.options?a.options.get(d):void 0,f=p?p.value||p.default:null;if(f){let i=f.evaluate(s);Array.isArray(i)&&i.length>0&&(o=i)}else for(let i of r.stylesheet&&r.stylesheet.imports||[])if(i.id===a.scope){let r=i.config?i.config.sdCoverageSourceLayers:void 0;Array.isArray(r)&&r.length>0&&(o=r);break}}),a.frcCoverageFadeRange=n,a.frcCoverageSourceLayers=null!=n?o||["road","structure"]:[]},i3=function(i){if(!function(i){for(let r in i._mergedLayers)if(iI(i._mergedLayers[r]))return!0;return!1}(i))return void iL(i);let r=tu(i,i.map&&i.map.transform);i._hdElevation||(i._hdElevation=new iR);let a=i._hdElevation._terrainActiveLast;if(i._hdElevation._terrainActiveLast=r,void 0!==a&&a!==r&&iP(i,void 0,!0),r)return void(i.map.painter&&(i.map.painter.elevationCoverageSnapshot=null));if(!iM(i))return void iL(i);void 0===a&&iP(i,void 0,!0);let n=i._hdElevation;n._needsCrossSourceElevation=!0,i._crossSourceElevationActive=!0,n._ingestFQIDs=iC(i),iz(i,n)},i5=function(i){i._crossSourceElevationActive=iM(i)},i4=function(i,r,a){if(tu(i.style,i.transform)||!a)return null;let n=i.painter?i.painter.elevationCoverageSnapshot:null,o=!(!i.painter||!i.painter.elevationProvidersReady);return n?function(i,r,a){let n=i.getTilesIntersecting(r);if(0===n.length)return{registry:[],hasCoveringTile:!1,allProvidersReady:a};let o=[];for(let i of n)for(let r of i.features)o.push({tileId:i.tileId,feature:r});return o.sort((i,r)=>i.feature.id-r.feature.id),{registry:o,hasCoveringTile:!0,allProvidersReady:a}}(n,r.tileID.canonical,o):{registry:[],hasCoveringTile:!1,allProvidersReady:o}},i6=class{constructor(){this.tileBuffers=new Map,this._context=null}update(i,r){this._context=i;let a=new Set;for(let n of r){if(0===n.frcMask)continue;let r=!1;for(let i of n.polygons)if(i.hasGeometry()){r=!0;break}if(!r)continue;let o=`${n.tileId.z}/${n.tileId.x}/${n.tileId.y}`;if(a.add(o),!this.tileBuffers.has(o)){let r=this._createBuffers(i,n);r&&this.tileBuffers.set(o,r)}}for(let i of this.tileBuffers.keys())if(!a.has(i)){let r=this.tileBuffers.get(i);for(let i of(r.vertexBuffer.destroy(),r.indexBuffer.destroy(),r.frcLevelSegments))i&&i.destroy();this.tileBuffers.delete(i)}}getBuffers(i){return this.tileBuffers.get(`${i.z}/${i.x}/${i.y}`)||null}destroy(){for(let i of this.tileBuffers.values())for(let r of(i.vertexBuffer.destroy(),i.indexBuffer.destroy(),i.frcLevelSegments))r&&r.destroy();this.tileBuffers.clear()}_createBuffers(r,a){let n=new i.bD,o=new i.ae,s=[];for(let r of a.polygons){if(!r.hasGeometry()||0===r.rings.length)continue;let a=n.length,l=o.length,h=n.length,u=[],c=[],d=0;for(let i=0;i<r.rings.length;i++){let a=r.rings[i];if(!(a.length<3))for(let r of(i>0&&c.push(d),a))n.emplaceBack(r.x,r.y),u.push(r.x,r.y),d++}let p=i.bG(u,c.length>0?c:void 0);for(let i=0;i<p.length;i+=3)o.emplaceBack(h+p[i],h+p[i+1],h+p[i+2]);s.push({vertexOffset:a,indexOffset:l,vertexCount:n.length-a,indexCount:o.length-l,frcMask:r.frcMask})}if(0===n.length)return null;let l=Array(9).fill(null);for(let r=0;r<9;++r){let n=1<<r;if(0==(a.frcMask&n))continue;let o=1/0,h=0,u=0,c=!1;
109for(let i of s)0!=(i.frcMask&n)&&(o=Math.min(o,i.indexOffset),h=Math.max(h,i.indexOffset+i.indexCount),u=Math.max(u,i.vertexOffset+i.vertexCount),c=!0);c&&(l[r]=i.ad.simpleSegment(0,o,u,h-o))}return{vertexBuffer:r.createVertexBuffer(n,i.bF.members),indexBuffer:r.createIndexBuffer(o),frcLevelSegments:l}}},i8=function(r){let{painter:a,bucket:n,coord:o,elevatedGeometry:s}=r,l="road"===n.sourceLayerName,h="structure"===n.sourceLayerName;if(!l&&!h||!a.frcCoverageSnapshot||s)return"fallthrough";let u=a.frcCoverageSnapshot.getTileOrParent(o.canonical);if(!u||0===u.frcMask)return"fallthrough";let c=n.hdExt&&n.hdExt.frcData,d=!!c&&!c.empty(),p=ik(u.polygons);if(h&&!p)return"skip";if(h&&p)return r.polygonCoverageTiles.push({coord:r.coord,bufferData:r.bufferData,program:r.program,programConfiguration:r.programConfiguration,uniformValues:r.uniformValues,depthMode:r.depthMode,dynamicBuffers:r.dynamicBuffers,indexBuffer:r.indexBuffer,segments:r.segments,frcMask:u.frcMask}),"deferred";if(l&&d&&c){let n=u.frcMask,o=a.transform.zoom;for(let[s,l]of c.frcPerLevel)n&1<<s||0!==l.segments.length&&r.program.draw(a,r.drawMode,r.depthMode,r.stencilMode,r.colorMode,i.$.disabled,r.uniformValues,r.layer.id,r.bufferData.layoutVertexBuffer,r.indexBuffer,l,r.layer.paint,o,r.programConfiguration,r.dynamicBuffers);return c.frcNonRoadSegments.segments.length>0&&r.program.draw(a,r.drawMode,r.depthMode,r.stencilMode,r.colorMode,i.$.disabled,r.uniformValues,r.layer.id,r.bufferData.layoutVertexBuffer,r.indexBuffer,c.frcNonRoadSegments,r.layer.paint,o,r.programConfiguration,r.dynamicBuffers),"drawn"}return"fallthrough"},i9=function(r,a,n,o,s){if(0===n.length)return;let l=iN(r),h=r.transform.zoom,u=(n,l,u)=>{1!==u&&(n.uniformValues.u_opacity_multiplier=u),n.program.draw(r,o,n.depthMode,l,s,i.$.disabled,n.uniformValues,a.id,n.bufferData.layoutVertexBuffer,n.indexBuffer,n.segments,a.paint,h,n.programConfiguration,n.dynamicBuffers),1!==u&&(n.uniformValues.u_opacity_multiplier=1)};iB(r,n,l,(i,r,a)=>u(i,a,1),(i,r,a)=>u(i,a,l))},i7=function(i,r,a,n,o,s,l,h,u,c){let d=r.hdExt&&r.hdExt.frcData;if(!d||0===d.frcPerLevel.size||!i.frcCoverageSnapshot||n)return null;let p=i.frcCoverageSnapshot.getTileOrParent(a.canonical);if(!p||0===p.frcMask)return null;let f=ik(p.polygons),m=i.frcCoverageFadeRange,_=null!=m&&i.transform.zoom>=m[0];if(f&&_){let i=!1;for(let r of d.frcPerLevel.keys())if(p.frcMask&1<<r){i=!0;break}i&&c.push({coord:a,bucket:r,uniformValues:o,programConfiguration:s,program:l,depthMode:h,colorMode:u,frcMask:p.frcMask})}return{coverageTile:p,frcMask:p.frcMask,active:_,hasPolygonGeometry:f}},re=function(i,r,a,n){let o=i.hdExt&&i.hdExt.frcData;if(!o)return;let s=r.frcMask;for(let[i,r]of o.frcPerLevel)s&1<<i||n(a,r);let l=o.frcNonRoadSegments;l.segments.length>0&&n(a,l)},rt=function(i,r,a,n,o,s,l){if(n.hasPolygonGeometry)return;let h=r.hdExt&&r.hdExt.frcData;if(!h||!i.frcCoverageFadeRange)return;let[u,c]=i.frcCoverageFadeRange;if(u>=c)return;let d=1-Math.max(0,Math.min(1,(i.transform.zoom-u)/(c-u)));if(d<=0)return;let p=o?s:i.stencilModeForClipping(a),f=n.frcMask;for(let[i,r]of h.frcPerLevel)f&1<<i&&l(p,r,d)},ri=function(r,a,n){if(0===n.length)return;let o=r.context.gl,s=iN(r),l=r.transform.zoom,h=(n,s,h,u)=>{let c=n.bucket.hdExt&&n.bucket.hdExt.frcData,d=c&&c.frcPerLevel.get(s);d&&0!==d.segments.length&&(1!==u&&(n.uniformValues.u_opacity_multiplier=u),n.program.draw(r,o.TRIANGLES,n.depthMode,h,n.colorMode,i.$.disabled,n.uniformValues,a.id,n.bucket.layoutVertexBuffer,n.bucket.indexBuffer,d,a.paint,l,n.programConfiguration,[n.bucket.layoutVertexBuffer2,n.bucket.patternVertexBuffer,n.bucket.zOffsetVertexBuffer,n.bucket.elevationIdColVertexBuffer,n.bucket.elevationGroundScaleVertexBuffer]),1!==u&&(n.uniformValues.u_opacity_multiplier=1))};iB(r,n,s,(i,r,a)=>h(i,r,a,1),(i,r,a)=>h(i,r,a,s))};async function rr(){return Promise.resolve()}function ra(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 rn{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 ro extends rn{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 rs extends rn{getDefault(){return 1}set(i){(i!==this.current||this.dirty)&&(this.gl.clearDepth(i),this.current=i,this.dirty=!1)}}class rl extends rn{getDefault(){return 0}set(i){(i!==this.current||this.dirty)&&(this.gl.clearStencil(i),this.current=i,this.dirty=!1)}}
109class rh extends rn{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 ru extends rn{getDefault(){return!0}set(i){(i!==this.current||this.dirty)&&(this.gl.depthMask(i),this.current=i,this.dirty=!1)}}class rc extends rn{getDefault(){return 255}set(i){(i!==this.current||this.dirty)&&(this.gl.stencilMask(i),this.current=i,this.dirty=!1)}}class rd extends rn{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 rp extends rn{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 rf extends rn{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 rm extends rn{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 r_ extends rn{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 rg extends rn{getDefault(){return this.gl.LESS}set(i){(i!==this.current||this.dirty)&&(this.gl.depthFunc(i),this.current=i,this.dirty=!1)}}class ry extends rn{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 rx extends rn{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 rv extends rn{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 rb extends rn{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 rw extends rn{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 rT extends rn{getDefault(){return this.gl.BACK}set(i){(i!==this.current||this.dirty)&&(this.gl.cullFace(i),this.current=i,this.dirty=!1)}}class rS extends rn{getDefault(){return this.gl.CCW}set(i){(i!==this.current||this.dirty)&&(this.gl.frontFace(i),this.current=i,this.dirty=!1)}}let rE=class extends rn{getDefault(){return null}set(i){(i!==this.current||this.dirty)&&(this.gl.useProgram(i),this.current=i,this.dirty=!1)}};class rI extends rn{getDefault(){return this.gl.TEXTURE0}set(i){(i!==this.current||this.dirty)&&(this.gl.activeTexture(i),this.current=i,this.dirty=!1)}}class rA extends rn{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 rM extends rn{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 rC extends rn{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 rP extends rn{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 rR extends rn{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 rD extends rn{getDefault(){return null}set(i){let r=this.gl;r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,i),this.current=i,this.dirty=!1}}class rL extends rn{getDefault(){return null}set(i){this.gl&&(i!==this.current||this.dirty)&&(this.gl.bindVertexArray(i),this.current=i,this.dirty=!1)}}class rz extends rn{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 rF extends rn{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 rO extends rn{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 rB extends rn{constructor(i,r){super(i),this.context=i,this.parent=r}getDefault(){return null}}class rk extends rB{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 rN extends rB{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 rV extends rB{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 rU extends rN{attachment(){return this.gl.DEPTH_STENCIL_ATTACHMENT}}let rj=(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}),rG=(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 rZ(i,r){return null!=i&&null!=r&&!(!i.hasData()||!r.hasData())&&null!=i.demTexture&&null!=r.demTexture&&i.tileID.key!==r.tileID.key}let r$=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 rH(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 rq(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)}class rW extends i.E{constructor(i,r,a,n,o,s){super(),this.id=i,this.type=r,this.tileSize=a,this.minzoom=n,this.maxzoom=o,this.roundZoom=!1,this.reparseOverscaled=s}loaded(){return!0}loadTile(i,r){r(null)}serialize(){return{type:this.type}}}class rX extends ig{constructor(i){let r=new rW("mock-dem","raster-dem",512,0,Math.ceil(i.transform.maxZoom),!1);super("mock-dem",r,null),r.setEventedParent(this),this._sourceLoaded=!0}_loadTile(i,r){i.state="loaded",r(null)}}class rY extends ig{constructor(i){let r=new rW("proxy","geojson",512,0,Math.ceil(i.transform.maxZoom),!0);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(i,r,a){if(i.freezeTileCoverage)return;this.transform=i;let n=i.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}).reduce((r,a)=>{if(r[a.key]="",!this._tiles[a.key]){let r=new ip(a,this._source.tileSize*a.overscaleFactor(),i.tileZoom,void 0,void 0,this._source.worldview);r.state="loaded",this._tiles[a.key]=r}return r},{});for(let i in this._tiles)i in n||(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 rK extends i.bQ{constructor(i,r,a){super(i.overscaledZ,i.wrap,i.canonical.z,i.canonical.x,i.canonical.y),this.proxyTileKey=r,this.projMatrix=a}}function rJ(i,r){return"rgba8"===r?i.RGBA8:i.R8}class rQ extends i.c2{constructor(r,a){super(),this.painter=r,this.terrainTileForTile={},this.prevTerrainTileForTile={};let[n,o,s]=function(){let r=new i.bD,a=new i.ae;r.reserve(17161),a.reserve(33800);let n=i.a6/128,o=i.a6+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.b1(Math.round(l),0,i.a6),h=i.b1(Math.round(a),0,i.a6);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.bF.members),this.gridIndexBuffer=l.createIndexBuffer(o),this.gridSegments=i.ad.simpleSegment(0,0,n.length,o.length),this.gridNoSkirtSegments=i.ad.simpleSegment(0,0,n.length,s),this.proxyCoords=[],this.proxiedCoords={},this._visibleDemTiles=[],this._drapedRenderBatches=[],this._sourceTilesOverlap={},this.proxySourceCache=new rY(a.map),this.orthoMatrix=i.Y(),i.bZ(this.orthoMatrix,.015*("globe"===this.painter.transform.projection.name),i.a6,0,i.a6,0,1);let h=l.gl;this._overlapStencilMode=new i._({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 rX(a.map),this._pendingGroundEffectLayers=[],this._emissiveTexture="none",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.e.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.am(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.bT.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.transform||(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 rK(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),ra(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.c3({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.c4(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.a6,0),u_tile_br_up:o.upVector(a,i.a6,i.a6),u_tile_bl_up:o.upVector(a,0,i.a6),u_tile_up_scale:n?i.c5(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.c0(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 i.Z(c.LEQUAL,i.Z.ReadWrite,r.depthRangeFor3D);r$.update(s);let g=i.b7(d),y=[i.a7(d.center.lng),i.a8(d.center.lat)],x=r.globeSharedBuffers,v=[d.width*i.e.devicePixelRatio,d.height*i.e.devicePixelRatio],b=Float32Array.from(d.globeMatrix),w={useDenormalizedUpVectorScale:!0};{let d=r.transform,p=rH(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=i._.disabled,E=a.prevTerrainTileForTile[h.key],I=a.terrainTileForTile[h.key];rZ(E,I)&&r$.newMorphing(h.key,E,I,s,250),rq(r,o.emissiveTexture),u.activeTexture.set(c.TEXTURE0),o.texture&&o.texture.bind(c.LINEAR,c.CLAMP_TO_EDGE);let A=r$.getMorphValuesForProxy(h.key),M=+!!A;A&&Object.assign(w,{morphing:{srcDemTile:A.from,dstDemTile:A.to,phase:i.b$(A.phase)}});let C=i.b3(h.canonical),P=i.b4(C.getCenter().lat),R=i.b8(h.canonical,C,P,d.worldSize/d._pixelsPerMercatorPixel),D=i.b5(i.b6(h.canonical)),L=+!!r.isEmissiveMrtActive(),z=rG(d.expandedFarZProjMatrix,b,g,D,i.S(d.zoom),y,d.frustumCorners.TL,d.frustumCorners.TR,d.frustumCorners.BR,d.frustumCorners.BL,d.globeCenterInViewSpace,d.globeRadius,v,p,d._farZ,L,R);if(f(h,M),l&&(a.setupElevationDraw(o,l,w),r.uploadCommonUniforms(u,l,h.toUnwrapped()),x)){let[a,n,o]=x.getGridBuffers(P,0!==p);l.draw(r,T,_,S,m,i.$.backCCW,z,"globe_raster",a,n,o)}}}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);rq(r,s.emissiveTexture),u.activeTexture.set(c.TEXTURE0),s.texture&&s.texture.bind(c.LINEAR,c.CLAMP_TO_EDGE);let x=i.c1(p,o,d),I=i.b5(i.b6(h.canonical)),A=+!!r.isEmissiveMrtActive(),M=(a,n)=>a.draw(r,c.TRIANGLES,_,i._.disabled,m,i.$.disabled,rG(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",n,S,E);a.setupElevationDraw(s,l,w),r.uploadCommonUniforms(u,l,h.toUnwrapped()),f&&r.renderDefaultNorthPole&&M(l,b),g&&r.renderDefaultSouthPole&&(x=i.aO(i.Y(),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=i.aF(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 i.Z(c.LEQUAL,i.Z.ReadWrite,r.depthRangeFor3D);r$.update(s);let g=r.transform,y=rH(g.zoom,a.exaggeration(),a.sourceCache._source.tileSize),x=[0,0,0];if(d){let a=r.style.directionalLight,n=r.style.ambientLight;a&&n&&(x=i.aG(r.style,a,n))}{h=-1;let v=c.TRIANGLES,[b,w]=[a.gridIndexBuffer,a.gridSegments];for(let h of o){let o,T=n.getTile(h),S=i._.disabled,E=a.prevTerrainTileForTile[h.key],I=a.terrainTileForTile[h.key];rZ(E,I)&&r$.newMorphing(h.key,E,I,s,250),rq(r,T.emissiveTexture),u.activeTexture.set(c.TEXTURE0),T.texture&&T.texture.bind(c.LINEAR,c.CLAMP_TO_EDGE);let A=r$.getMorphValuesForProxy(h.key),M=+!!A;A&&(o={morphing:{srcDemTile:A.from,dstDemTile:A.to,phase:i.b$(A.phase)}});let C=+!!r.isEmissiveMrtActive(),P=rj(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 R=h.toUnwrapped();d&&d.setupShadows(R,l),r.uploadCommonUniforms(u,l,R,null,p),l.draw(r,v,_,S,m,i.$.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-full-rgba"===a.emissiveMode?"rgba8":"mrt-fallback"===a.emissiveMode?"r8":"none");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;a.isEmissiveMrtActive()?g.drawBuffers([g.COLOR_ATTACHMENT0,g.COLOR_ATTACHMENT1]):g.drawBuffers([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),"none"!==this._emissiveTexture&&((r=new i.T(a,{width:o[0],height:o[1],data:null},rJ(n,this._emissiveTexture))).bind(n.LINEAR,n.CLAMP_TO_EDGE),l.createColorAttachment(a,1),l.colorAttachment1.set(r.texture)),l.depthAttachment=new rU(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("none"!==a){let h=new i.T(o,{width:l[0],height:l[1],data:null},rJ(s,a));h.bind(s.LINEAR,s.CLAMP_TO_EDGE),r.emissiveTex=h,n.createColorAttachment(o,1),n.colorAttachment1.set(h.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("vector"===i.type){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.ak||l instanceof i.ak)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){let a=this._style._mergedSourceCaches[r]._source.type;if("raster"===a||"raster-dem"===a||"raster-array"===a){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=tW(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(r){return this.renderingToTexture&&this._overlapStencilType?("Clip"===this._overlapStencilType&&(this._overlapStencilMode.ref=this.painter._tileClippingMaskIDs[r.key]),this._overlapStencilMode):i._.disabled}_renderTileClippingMasks(r,a){let n=this.painter,o=this.painter.context,s=o.gl;n._tileClippingMaskIDs={},o.setColorMode(i.a1.disabled),o.setDepthMode(i.Z.disabled);let l=n.getOrCreateProgram("clippingMask");for(let o of r){let r=n._tileClippingMaskIDs[o.key]=--a;l.draw(n,s.TRIANGLES,i.Z.disabled,new i._({func:s.ALWAYS,mask:0},r,255,s.KEEP,s.KEEP,s.REPLACE),i.a1.disabled,i.$.disabled,iF(o.projMatrix),"$clipping",n.tileExtentBuffer,n.quadTriangleIndexBuffer,n.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.c6(n,n,a.pixelMatrixInverse),i.c7(n,n,1/n[3]),n[0]/=a.worldSize,n[1]/=a.worldSize;let o=a._camera.position,s=i.c4(1,a.center.lat),l=[o[0],o[1],o[2]/s,0],h=i.c8([],n.slice(0,3),l);i.c9(h,h);let u=this.raycast(l,h,this._exaggeration);return null!==u&&u?(i.ca(l,l,h,u),l[3]=l[2],l[2]*=s,l):null}_setupProxiedCoordsForOrtho(i,r,a){if(["image","video","canvas"].includes(i.getSource().type))return this._setupProxiedCoordsForImageSource(i,r,a);this._findCoveringTileCache[i.id]=this._findCoveringTileCache[i.id]||{};let n=this.proxiedCoords[i.id]=[],o=this.proxyCoords;for(let r=0;r<o.length;r++){let s=o[r],l=this._findTileCoveringTileID(s,i);if(l){let r=this._createProxiedId(s,l,a[s.key]&&a[s.key][i.id]);n.push(r),this.proxyToSource[s.key][i.id]=[r]}}let s=!1,l=new Set;for(let o=0;o<r.length;o++){let h=i.getTile(r[o]);if(!h||!h.hasData())continue;let u=this._findTileCoveringTileID(h.tileID,this.proxySourceCache);if(u&&u.tileID.canonical.z!==h.tileID.canonical.z){let r=this.proxyToSource[u.tileID.key][i.id],o=this._createProxiedId(u.tileID,h,a[u.tileID.key]&&a[u.tileID.key][i.id]);r?r.splice(r.length-1,0,o):this.proxyToSource[u.tileID.key][i.id]=[o];let c=this.proxyToSource[u.tileID.key][i.id];l.has(c)||l.add(c),n.push(o),s=!0}}if(this._sourceTilesOverlap[i.id]=s,s)for(let i of l)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.bT.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.a6/(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.Y();let u=a.tileID.wrap-r.wrap<<r.overscaledZ;h>0?(s=(n=i.a6>>h)*((a.tileID.canonical.x<<h)-r.canonical.x+u),l=n*((a.tileID.canonical.y<<h)-r.canonical.y)):(n=i.a6<<-h,s=i.a6*(a.tileID.canonical.x-(r.canonical.x+u<<-h)),l=i.a6*(a.tileID.canonical.y-(r.canonical.y<<-h))),i.bZ(o,0,n,0,n,0,1),i.bN(o,o,[s,l,0])}return new rK(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.bQ(h,r.wrap,o,r.canonical.x>>n,r.canonical.y>>n)):0!==n&&(h=o,l=new i.bQ(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 r0=null,r1=[];function r2(i,r){return r0?r0.create(i,r):null}let r3=(i,r,a)=>({u_matrix:i,u_emissive_strength:r,u_ground_shadow_factor:a,u_opacity_multiplier:1}),r5=(r,a,n,o,s,l=0)=>Object.assign(r3(r,a,s),i.cb(n,o,l)),r4=(i,r,a,n)=>({u_matrix:i,u_world:a,u_emissive_strength:r,u_ground_shadow_factor:n,u_opacity_multiplier:1}),r6=(i,r,a,n,o,s,l=0)=>Object.assign(r5(i,r,a,n,s,l),{u_world:o}),r8=(i,r,a)=>({u_image:i,u_texel_size:r,u_first_pass:+!!a}),r9=i.Y(),r7=(r,a,n,o,s,l,h)=>{let u=r.transform,c="globe"===u.projection.name,d=c?i.cc(u.zoom,a.canonical)*u._pixelsPerMercatorPixel:i.cd(n,1,l),p={u_matrix:a.projMatrix,u_extrude_scale:d,u_intensity:h,u_inv_rot_matrix:r9,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.S(u.zoom);let r=s[0]*i.a6,n=s[1]*i.a6;p.u_up_dir=u.projection.upVector(new i.bW(0,0,0),r,n)}return p},ae=(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.cg(m.paint.get("raster-saturation")),u_contrast_factor:i.cf(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:tZ(i.ce,x,b),u_colorization_offset:t$(i.ce,v,b),u_color_ramp:y,u_color_ramp_size:i.ce,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){let a=r.terrain?r.terrain.exaggeration():1;return(r.transform.pitch<15?i.am(.07,.7,i.b1((14-r.transform.zoom)/5,0,1)):.07)*a}(r)}),at=i.Y(),ai=(r,a,n,o,s,l,h,u,c,d,p,f,m,_,g,y,x,v,b,w,T,S,E,I,A)=>{let M=s.transform,C={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:M.getCameraToCenterDistance(w),u_rotate_symbol:+n,u_aspect_ratio:M.width/M.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_is_sdf:+p,u_elevation_from_sea:+!!c,u_pitch_with_map:+o,u_texsize:f,u_texsize_icon:m,u_texture:0,u_texture_icon:1,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:at,u_merc_center:[0,0],u_camera_forward:[0,0,0],u_ecef_origin:[0,0,0],u_tile_matrix:at,u_up_vector:[0,-1,0],u_color_adj_mat:E,u_icon_transition:I||0,u_gamma_scale:p?o?s.transform.getCameraToCenterDistance(w)*Math.cos(s.terrain?0:s.transform._pitch):1:0,u_device_pixel_ratio:i.e.devicePixelRatio,u_is_halo:1,u_scale_factor:A||1,u_ground_shadow_factor:T,u_inv_matrix:i.aP(i.Y(),h),u_normal_scale:S,u_lutTexture:i.ci.LUT,u_spp_fill_np_color:[0,0,0,1],u_spp_halo_np_color:[0,0,0,0],u_spp_opacity:1,u_spp_halo_width:0,u_spp_halo_blur:0,u_spp_emissive_strength:0,u_spp_occlusion_opacity:1,u_spp_z_offset:0,u_spp_translate_rotation:[1,0],u_spp_zoom_fraction:0,u_opacity_multiplier:1};return"globe"===w.name&&(C.u_tile_id=[g.canonical.x,g.canonical.y,1<<g.canonical.z],C.u_zoom_transition=y,C.u_inv_rot_matrix=v,C.u_merc_center=x,C.u_camera_forward=M._camera.forward(),C.u_ecef_origin=i.ch(M.globeMatrix,g.toUnwrapped()),C.u_tile_matrix=M.globeMatrix,C.u_up_vector=b),C},ar=(i,r,a,n)=>({u_matrix:i,u_emissive_strength:r,u_opacity:a,u_color:n}),aa=(r,a,n,o,s,l,h,u,c)=>Object.assign(i.cj(s,l,h,o,u,c),{u_matrix:r,u_emissive_strength:a,u_opacity:n}
110),an={fillExtrusion:i.cp,fillExtrusionPattern:i.co,fill:r=>({u_matrix:new i.a4(r),u_emissive_strength:new i.a3(r),u_ground_shadow_factor:new i.a5(r),u_opacity_multiplier:new i.a3(r)}),fillPattern:r=>({u_matrix:new i.a4(r),u_emissive_strength:new i.a3(r),u_image:new i.aY(r),u_texsize:new i.a2(r),u_pixel_coord_upper:new i.a2(r),u_pixel_coord_lower:new i.a2(r),u_tile_units_to_pixels:new i.a3(r),u_ground_shadow_factor:new i.a5(r),u_pattern_transition:new i.a3(r),u_opacity_multiplier:new i.a3(r)}),fillOutline:r=>({u_matrix:new i.a4(r),u_emissive_strength:new i.a3(r),u_world:new i.a2(r),u_ground_shadow_factor:new i.a5(r),u_opacity_multiplier:new i.a3(r)}),fillOutlinePattern:r=>({u_matrix:new i.a4(r),u_emissive_strength:new i.a3(r),u_world:new i.a2(r),u_image:new i.aY(r),u_texsize:new i.a2(r),u_pixel_coord_upper:new i.a2(r),u_pixel_coord_lower:new i.a2(r),u_tile_units_to_pixels:new i.a3(r),u_ground_shadow_factor:new i.a5(r),u_pattern_transition:new i.a3(r),u_opacity_multiplier:new i.a3(r)}),lineBlendComposite:r=>({u_image:new i.aY(r),u_opacity:new i.a3(r),u_blend_mode:new i.aY(r),u_max_density:new i.a3(r)}),lineBlendReduce:r=>({u_image:new i.aY(r),u_texel_size:new i.a2(r),u_first_pass:new i.aY(r)}),circle:i.cn,collisionBox:r=>({u_matrix:new i.a4(r),u_inv_rot_matrix:new i.a4(r),u_camera_to_center_distance:new i.a3(r),u_extrude_scale:new i.a2(r),u_zoom_transition:new i.a3(r),u_merc_center:new i.a2(r),u_tile_id:new i.a5(r)}),collisionCircle:r=>({u_matrix:new i.a4(r),u_inv_matrix:new i.a4(r),u_camera_to_center_distance:new i.a3(r),u_viewport_size:new i.a2(r)}),debug:i.cm,clippingMask:r=>({u_matrix:new i.a4(r)}),heatmap:r=>({u_extrude_scale:new i.a3(r),u_intensity:new i.a3(r),u_matrix:new i.a4(r),u_inv_rot_matrix:new i.a4(r),u_merc_center:new i.a2(r),u_tile_id:new i.a5(r),u_zoom_transition:new i.a3(r),u_up_dir:new i.a5(r)}),heatmapTexture:r=>({u_image:new i.aY(r),u_color_ramp:new i.aY(r),u_opacity:new i.a3(r)}),hillshade:r=>({u_matrix:new i.a4(r),u_image:new i.aY(r),u_latrange:new i.a2(r),u_light:new i.a2(r),u_shadow:new i.bY(r),u_highlight:new i.bY(r),u_emissive_strength:new i.a3(r),u_accent:new i.bY(r)}),hillshadePrepare:r=>({u_matrix:new i.a4(r),u_image:new i.aY(r),u_dimension:new i.a2(r),u_zoom:new i.a3(r)}),line:i.cl,linePattern:i.ck,raster:r=>({u_matrix:new i.a4(r),u_normalize_matrix:new i.a4(r),u_globe_matrix:new i.a4(r),u_merc_matrix:new i.a4(r),u_grid_matrix:new i.a_(r),u_tl_parent:new i.a2(r),u_scale_parent:new i.a3(r),u_fade_t:new i.a3(r),u_opacity:new i.a3(r),u_image0:new i.aY(r),u_image1:new i.aY(r),u_brightness_low:new i.a3(r),u_brightness_high:new i.a3(r),u_saturation_factor:new i.a3(r),u_contrast_factor:new i.a3(r),u_spin_weights:new i.a5(r),u_perspective_transform:new i.a2(r),u_raster_elevation:new i.a3(r),u_zoom_transition:new i.a3(r),u_merc_center:new i.a2(r),u_cutoff_params:new i.aZ(r),u_colorization_mix:new i.aZ(r),u_colorization_offset:new i.a3(r),u_color_ramp:new i.aY(r),u_color_ramp_size:new i.a3(r),u_texture_offset:new i.a2(r),u_texture_res:new i.a2(r),u_emissive_strength:new i.a3(r),u_zbias_factor:new i.a3(r)}),symbol:r=>({u_is_size_zoom_constant:new i.aY(r),u_is_size_feature_constant:new i.aY(r),u_size_t:new i.a3(r),u_size:new i.a3(r),u_camera_to_center_distance:new i.a3(r),u_rotate_symbol:new i.aY(r),u_aspect_ratio:new i.a3(r),u_fade_change:new i.a3(r),u_matrix:new i.a4(r),u_label_plane_matrix:new i.a4(r),u_coord_matrix:new i.a4(r),u_is_text:new i.aY(r),u_is_sdf:new i.aY(r),u_elevation_from_sea:new i.aY(r),u_pitch_with_map:new i.aY(r),u_texsize:new i.a2(r),u_texsize_icon:new i.a2(r),u_texture:new i.aY(r),u_texture_icon:new i.aY(r),u_gamma_scale:new i.a3(r),u_device_pixel_ratio:new i.a3(r),u_tile_id:new i.a5(r),u_zoom_transition:new i.a3(r),u_inv_rot_matrix:new i.a4(r),u_merc_center:new i.a2(r),u_c
110amera_forward:new i.a5(r),u_tile_matrix:new i.a4(r),u_up_vector:new i.a5(r),u_ecef_origin:new i.a5(r),u_is_halo:new i.aY(r),u_icon_transition:new i.a3(r),u_color_adj_mat:new i.a4(r),u_scale_factor:new i.a3(r),u_ground_shadow_factor:new i.a5(r),u_inv_matrix:new i.a4(r),u_normal_scale:new i.a3(r),u_lutTexture:new i.aY(r),u_spp_fill_np_color:new i.aZ(r),u_spp_halo_np_color:new i.aZ(r),u_spp_opacity:new i.a3(r),u_spp_halo_width:new i.a3(r),u_spp_halo_blur:new i.a3(r),u_spp_emissive_strength:new i.a3(r),u_spp_occlusion_opacity:new i.a3(r),u_spp_z_offset:new i.a3(r),u_spp_translate_rotation:new i.a2(r),u_spp_zoom_fraction:new i.a3(r),u_opacity_multiplier:new i.a3(r)}),background:r=>({u_matrix:new i.a4(r),u_emissive_strength:new i.a3(r),u_opacity:new i.a3(r),u_color:new i.bY(r)}),backgroundPattern:r=>({u_matrix:new i.a4(r),u_emissive_strength:new i.a3(r),u_opacity:new i.a3(r),u_image:new i.aY(r),u_pattern_tl:new i.a2(r),u_pattern_br:new i.a2(r),u_texsize:new i.a2(r),u_pattern_size:new i.a2(r),u_pixel_coord_upper:new i.a2(r),u_pixel_coord_lower:new i.a2(r),u_pattern_units_to_pixels:new i.a2(r)}),skybox:r=>({u_matrix:new i.a4(r),u_sun_direction:new i.a5(r),u_cubemap:new i.aY(r),u_opacity:new i.a3(r),u_temporal_offset:new i.a3(r)}),skyboxGradient:r=>({u_matrix:new i.a4(r),u_color_ramp:new i.aY(r),u_center_direction:new i.a5(r),u_radius:new i.a3(r),u_opacity:new i.a3(r),u_temporal_offset:new i.a3(r)}),skyboxCapture:r=>({u_matrix_3f:new i.a_(r),u_sun_direction:new i.a5(r),u_sun_intensity:new i.a3(r),u_color_tint_r:new i.aZ(r),u_color_tint_m:new i.aZ(r),u_luminance:new i.a3(r)}),globeAtmosphere:r=>({u_frustum_tl:new i.a5(r),u_frustum_tr:new i.a5(r),u_frustum_br:new i.a5(r),u_frustum_bl:new i.a5(r),u_horizon:new i.a3(r),u_transition:new i.a3(r),u_fadeout_range:new i.a3(r),u_atmosphere_fog_color:new i.aZ(r),u_high_color:new i.aZ(r),u_space_color:new i.aZ(r),u_temporal_offset:new i.a3(r),u_horizon_angle:new i.a3(r)}),stars:r=>({u_matrix:new i.a4(r),u_up:new i.a5(r),u_right:new i.a5(r),u_intensity_multiplier:new i.a3(r)}),occlusion:r=>({u_matrix:new i.a4(r),u_anchorPos:new i.a5(r),u_screenSizePx:new i.a2(r),u_occluderSizePx:new i.a2(r),u_color:new i.aZ(r)})};var ao={terrainRaster:i.bc('#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\nvec3 unlit_base;vec3 emissive_base;\n#ifdef USE_MRT1_RGBA\nvec4 emissive_premult=u_emissive_texture_available > 0.5 ? texture(u_image1,v_pos0) : vec4(0.0);unlit_base=image_color.rgb-emissive_premult.rgb;emissive_base=emissive_premult.rgb;\n#else\nfloat emissive_strength=u_emissive_texture_available > 0.5 ? texture(u_image1,v_pos0).r : image_color.a;unlit_base=image_color.rgb*(1.0-emissive_strength);emissive_base=image_color.rgb*emissive_strength;\n#endif\nfloat 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;\n#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS\n#ifdef USE_MRT1_RGBA\nvec4 emissive_premult=u_emissive_texture_available > 0.5 ? texture(u_image1,v_pos0) : vec4(0.0);vec3 unlit_base=image_color.rgb-emissive_premult.rgb;color.rgb=apply_lighting(unlit_base,normal,lighting_factor)+emissive_premult.rgb;color.a=1.0;\n#else\ncolor=apply_lighting(image_color,normal,lighting_factor);float 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#else\ncolor=apply_lighting(image_color,normal,lighting_factor);\n#endif\n#endif\n#else\ncolor=image_color;\n#endif\n#ifdef FOG\ncolor=fog_dither(fog_apply_from_vert(color,v_fog_opacity));\n#endif\nglFragColor=color;\n#ifdef OVERDRAW_INSPECTOR\nglFragColor=vec4(1.0);
110\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\nv_fog_opacity=fog(fog_position(vec3(decodedPos,elevation)));\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:i.bc("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;}'),globeRaster:i.bc('#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;FLIP_VIEWPORT_UV_Y(uv);highp 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\n#ifdef USE_MRT1_RGBA\nvec4 emissive_premult=u_emissive_texture_available > 0.5 ? texture(u_image1,v_pos0) : vec4(0.0);vec3 unlit_base=raster.rgb-emissive_premult.rgb;raster.rgb=apply_lighting_ground(vec4(unlit_base,1.0)).rgb+emissive_premult.rgb;color=vec4(clamp(raster.rgb,vec3(0),vec3(1))*antialias,antialias);\n#else\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#endif\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 \n#ifdef USE_MRT1_RGBA\nvec4 emissive_premult=u_emissive_texture_available > 0.5 ? texture(u_image1,v_pos0) : vec4(0.0);vec3 unlit_base=color.rgb-emissive_premult.rgb;color.rgb=apply_lighting_ground(vec4(unlit_base,1.0)).rgb+emissive_premult.rgb;color.a=1.0;\n#else\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#endif\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;\n#ifndef GLOBE_POLES\nuniform mat4 u_merc_matrix;\n#endif\nuniform float u_zoom_transition;uniform vec2 u_merc_center;\n#ifndef GLOBE_POLES\nuniform mat3 u_grid_matrix;\n#endif\nuniform 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}')};!function(i){for(let r of(r0=i,r1.splice(0)))r()}({create:(i,r)=>new rQ(i,r)}),Object.assign(an,{terrainRaster:r=>
110({u_matrix:new i.a4(r),u_image0:new i.aY(r),u_image1:new i.aY(r),u_skirt_height:new i.a3(r),u_ground_shadow_factor:new i.a5(r),u_emissive_texture_available:new i.a3(r)}),globeRaster:r=>({u_proj_matrix:new i.a4(r),u_globe_matrix:new i.a4(r),u_normalize_matrix:new i.a4(r),u_merc_matrix:new i.a4(r),u_zoom_transition:new i.a3(r),u_merc_center:new i.a2(r),u_image0:new i.aY(r),u_image1:new i.aY(r),u_grid_matrix:new i.a_(r),u_skirt_height:new i.a3(r),u_far_z_cutoff:new i.a3(r),u_frustum_tl:new i.a5(r),u_frustum_tr:new i.a5(r),u_frustum_br:new i.a5(r),u_frustum_bl:new i.a5(r),u_globe_pos:new i.a5(r),u_globe_radius:new i.a3(r),u_viewport:new i.a2(r),u_emissive_texture_available:new i.a3(r)})});class as{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;if(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.cq(s,l).every(i=>a.isPointAboveHorizon(i))&&a.isPointAboveHorizon(h)}return new as(n,o,a)}isPointQuery(){return 1===this.screenBounds.length}bufferedScreenGeometry(r){return i.cq(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.cq(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.cr(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.cq(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,s){var l;let h=Math.max(r.queryPadding,r.evaluateQueryRenderedFeaturePadding())/a._pixelsPerMercatorPixel+1,u=n?this._bufferedCameraMercator(h,a):this._bufferedScreenMercator(h,a),c=r.tileID.wrap+(u.unwrapped?o:0),d=u.polygon.map(a=>i.cs(r.tileTransform,a,c));if(!i.ct(d,0,0,i.a6,i.a6))return;c=r.tileID.wrap+(this.screenGeometryMercator.unwrapped?o:0);let p=this.screenGeometryMercator.polygon.map(a=>i.cu(r.tileTransform,a,c)),f=p.map(r=>new i.P(r[0],r[1])),m=i.cu(r.tileTransform,s,c),_=p.map(r=>{let a=i.cv(r,r,m);return i.c9(a,a),new i.cw(m,a)}),g=i.cd(r,1,a.zoom)*a._pixelsPerMercatorPixel;return{queryGeometry:this,tilespaceGeometry:f,tilespaceRays:_,bufferedTilespaceGeometry:d,bufferedTilespaceBounds:((l=i.cx(d)).min.x=i.b1(l.min.x,0,i.a6),l.min.y=i.b1(l.min.y,0,i.a6),l.max.x=i.b1(l.max.x,0,i.a6),l.max.y=i.b1(l.max.y,0,i.a6),l),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.X([],a.pixelMatrix,a.globeMatrix),o=[0,-i.cy,0,1],s=[0,i.cy,0,1],l=[0,0,0,1];i.c6(o,o,n),i.c6(s,s,n),i.c6(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.cz(r,h)&&o[3]<l[3],d=i.cz(r,u)&&s[3]<l[3];
110if(!c&&!d)return null;let p=function(i,r,a){for(let n=1;n<i.length;n++){let o=ah(r.pointCoordinate3D(i[n-1]).x),s=ah(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?al(r.slice(0,f),a):[],g=f<r.length?al(r.slice(f),a):[];_=_.map(r=>new i.P(ah(r.x),r.y)),g=g.map(r=>new i.P(ah(r.x),r.y));let y=[..._];0===y.length&&y.push(g.at(-1));let x=y.at(-1),v=i.am(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.bT(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.a7(a.center.lng);return n&&l<Math.abs(l-1)&&r.forEach(i=>{i.x-=1}),{polygon:r,unwrapped:n}}(al(r,a).map(r=>new i.P(ah(r.x),r.y)),a);return{polygon:o.polygon.map(r=>new i.bT(r.x,r.y)),unwrapped:o.unwrapped}}}function al(r,a){return i.cA(r,i=>{let r=a.pointCoordinate3D(i);i.x=r.x,i.y=r.y},1/256)}function ah(i){return i<0?1+i%1:i%1}class au 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={type:"raster",...a},Object.assign(this,i.cB(a,["url","scheme","tileSize"]))}load(r){this._loaded=!1,this.fire(new i.h("dataloading",{dataType:"source"}));let a=this.map.getWorldview(),n=(a,n)=>{this._tileJSONRequest=null,this._loaded=!0,a?this.fire(new i.f(a)):n&&(Object.assign(this,n),n.raster_layers&&(this.rasterLayers=n.raster_layers,this.rasterLayerIds=this.rasterLayers.map(i=>i.id)),this.tileBounds=i.cF.fromTileJSON(n),i.cK(n.tiles),this.fire(new i.h("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new i.h("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.cD(this._options);return o instanceof Error?(this._loaded=!0,this.fire(new i.f(o)),void(r&&r())):this.provider&&!o?(this._loaded=!0,this.fire(new i.f(Error(`TileProvider "${this.provider}" is not registered`))),void(r&&r())):void(this._tileJSONRequest=o?this.loadTileJSONWithProvider(o,n):i.cE(this._options,this.map._requestManager,null,a,n))}loadTileJSONWithProvider(r,a){this.provider=r.name;let n=new AbortController;return(async()=>{let{request:o,options:s}=await i.cL(this._options,this.map._requestManager,n.signal);if(n.signal.aborted)return;let l=await i.cN(r.name,r.url);if(n.signal.aborted)return;let h=new l(s),u=null;if(h.load&&o&&(u=await h.load({request:o}),n.signal.aborted))return;this._tileProvider=h;let c=i.cM(this._options,u,this.map._requestManager);c instanceof Error?a(c):a(null,c)})().catch(i=>{n.signal.aborted||a(Error(`Could not load tile provider ${r.name}`,{cause:i}))}),{cancel:()=>n.abort()}}loaded(){return this._loaded}onAdd(i){this.map=i,this.load()}reload(){this.cancelTileJSONRequest();let r=i.m(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{...this._options}}hasTile(i){return!this.tileBounds||this.tileBounds.contains(i.canonical)}async loadTile(r,a){let n=i.e.devicePixelRatio>=2,o=this.map._requestManager.normalizeTileURL(r.tileID.canonical.url(this.tiles,this.scheme),n,this.tileSize),s=new AbortController;if(r.request=s,this._tileProvider)this.loadTileWithProvider(r,this._tileProvider,o,s,a);else try{let n=await this.map._requestManager.transformRequest(o,i.R.Tile,s.signal);if(s.signal.aborted)return delete r.request,a(null);let{data:l,headers:h}=await i.a(n,s.signal);if(delete r.request,r.aborted)return a(null);let u=i.cI(h);this.map._refreshExpiredTiles&&r.setExpiryData(u),r.setTexture(l,this.map.painter),r.state="loaded",i.cJ(this.dispatcher),a(null)}catch(i){if(delete r.request,s.signal.aborted)return a(null);r.state="errored",a(i)}}async loadTileWithProvider(r,a,n,o,s){let{z:l,x:h,y:u}=r.tileID.canonical;try{let c=await this.map._requestManager.transformRequest(n,i.R.Tile,o.signal);if(o.signal.aborted)return s(null);let d=await a.loadTile({z:l,x:h,y:u},{request:c,signal:o.signal});if(o.signal.aborted)return s(null);if(null==d){let i=Error("Tile not found");return i.status=404,r.state="errored",s(i)}if(null==d.data)return r.state="loaded",s(null);let p=d.data instanceof ImageBitmap?d.data:await createImageBitmap(new Blob([d.data]));if(o.signal.aborted)return s(null);r.setTexture(p,this.map.painter),r.state="loaded",this.map._refreshExpiredTiles&&r.setExpiryData({cac
110heControl:d.cacheControl,expires:d.expires}),s(null)}catch(i){if(o.signal.aborted)return s(null);r.state="errored",s(Error(`Could not load tile from ${n}`,{cause:i}))}finally{delete r.request}}abortTile(i,r){i.request&&(i.request.abort(),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)}}function ac(r,a,n,o,s,l,h,u){let c=[r,a,1,n,o,1,s,l,1],d=[h,u,1],p=i.cU([],c),[f,m,_]=i.cT(d,d,p);return i.cV(c,c,[f,0,0,0,m,0,0,0,_])}function ad(r,a,n,o,s,l,h,u){let c=function(r,a,n,o,s,l,h,u){let c=ac(0,0,1,0,1,1,0,1),d=ac(r,a,n,o,s,l,h,u),p=i.cU([],c);return i.cV(d,d,p)}(r,a,n,o,s,l,h,u);return[c[2]/c[8]/i.a6,c[5]/c[8]/i.a6]}function ap(r){return[r[0],Math.min(Math.max(r[1],-i.cP),i.cP)]}class af extends i.E{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}async load(r,a){if(this._loaded=a||!1,this.fire(new i.h("dataloading",{dataType:"source"})),this.url=this.options.url,!this.url)return r&&(this.coordinates=r),this._loaded=!0,void this._finishLoading();let n=new AbortController;this._imageRequest=n;try{let a=await this.map._requestManager.transformRequest(this.url,i.R.Image,n.signal),{data:o}=await i.a(a,n.signal);this._imageRequest=null,this._loaded=!0,this.image=o,this._dirty=!0,this.width=this.image.width,this.height=this.image.height,r&&(this.coordinates=r),this._finishLoading()}catch(r){if(n.signal.aborted)return;this._imageRequest=null,this._loaded=!0,this.fire(new i.f(r))}}loaded(){return this._loaded}updateImage(i){return i.url&&(this._imageRequest&&i.url!==this.options.url&&(this._imageRequest.abort(),this._imageRequest=null),this.options.url=i.url,this.load(i.coordinates,this._loaded)),this}setTexture(r){if(!(r.handle instanceof WebGLTexture))throw Error("The provided handle is not a WebGLTexture instance");return this.texture=new i.cO(this.map.painter.context,r.handle),this.width=r.dimensions[0],this.height=r.dimensions[1],this._dirty=!1,this._loaded=!0,this._finishLoading(),this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new i.h("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(i){this.map=i,this.load()}onRemove(r){this._imageRequest&&(this._imageRequest.abort(),this._imageRequest=null),!this.texture||this.texture instanceof i.cO||this.texture.destroy(),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy())}setCoordinates(r){if(this.coordinates=r,this._boundsArray=void 0,this._unsupportedCoords=!1,!r.length)return this;this.onNorthPole=!1,this.onSouthPole=!1;let a=r[0][1],n=r[0][1];for(let i of r)i[1]>n&&(n=i[1]),i[1]<a&&(a=i[1]);let o=(n+a)/2;if(o>i.cP?this.onNorthPole=!0:o<-i.cP&&(this.onSouthPole=!0),!this.onNorthPole&&!this.onSouthPole){let a=r.map(i.bT.fromLngLat);this.tileID=function(r){let a=1/0,n=1/0,o=-1/0,s=-1/0;for(let i of r)a=Math.min(a,i.x),n=Math.min(n,i.y),o=Math.max(o,i.x),s=Math.max(s,i.y);let l=Math.max(0,Math.floor(-Math.log2(Math.max(o-a,s-n)))),h=Math.pow(2,l),u=Math.floor((a+o)/2*h);return u>1&&(u-=1),new i.bW(l,u,Math.floor((n+s)/2*h))}(a),this.minzoom=this.maxzoom=this.tileID.z}return this.fire(new i.h("data",{dataType:"source",sourceDataType:"content"})),this}_clear(){!this.texture||this.texture instanceof i.cO||(this.texture.destroy(),this._dirty=!0),this.texture=null,this._boundsArray=void 0,this._unsupportedCoords=!1}_prepareData(r){var a;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 n=i.bq(new i.bW(0,0,0),this.map.transform.projection),o=[n.projection.project(this.coordinates[0][0],this.coordinates[0][1]),n.projection.project(this.coordinates[1][0],this.coordinates[1][1]),n.projection.project(this.coordinates[2][0],this.coordinates[2][1]),n.projection.project(this.coordinates[3][0],this.coordinates[3][1])];if(!function(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}(o))return console.warn("Image source coordinates are defining non-convex area in the Mercator projection"),void(this._unsupportedCoords=!0);let s=i.bq(this.tileID,this.map.transform.projection),[l,h,u,c]=this.coordinates.map(r=>{let a=s.projection.project(r[0],r[1]);return i.cs(s,a)._round()});this.perspectiveTransform=ad(l.x,l.y,h.x,h.y,u.x,u.y,c.x,c.y);let d=this._boundsArray=new i.bt;d.emplaceBack(l.x,l.y,0,0),d.emplaceBack(h.x,h.y,i.a6,0),d.emplaceBack(c.x,c.y,0,i.a6),d.emplaceBack(u.x,u.y,i.a6,i.a6),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy()),this.boundsBuffer=r.createVertexBuffer(d,ih.members),this.boundsSegments=i.ad.simpleSegment(0,0,4,2);let p=i.cS,f=p+1,m=p+1,_=[],[g,y,x,v]=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]}([ap((a=this.coordinates)[0]),ap(a[1]),ap(a[2]),ap(a[3])]);{let a=new i.bt,[s,l,h,u]=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]}(o),c=i=>[(i.x-s)/h,(i.y-l)/u],[d,b,w,T]=o.map(c),S=function(r,a,n,o,s,l,h,u){let c=ac(0,0,1,0,1,1,0,1),d=ac(r,a,n,o,s,l,h,u),p=i.cU([],d);return i.cV(c,c,p)}(d[0],d[1],b[0],b[1],w[0],w[1],T[0],T[1]);this.elevatedGlobePerspectiveTransform=ad(d[0],d[1],b[0],b[1],w[0],w[1],T[0],T[1]);let E=(r,n)=>{_.push(r.lng);let o=Math.round((r.lng-g)/x*i.a6),s=Math.round((r.lat-y)/v*i.a6),l=c(n),h=i.cT([],[l[0],l[1],1],S),u=Math.round(h[0]/h[2]*i.a6),d=Math.round(h[1]/h[2]*i.a6);a.emplaceBack(o,s,u,d)},I=o[3].x-o[0].x,A=o[3].y-o[0].y,M=o[2].x-o[1].x,C=o[2].y-o[1].y;for(let i=0;i<m;i++){let r=i/p,a=[o[0].x+r*I,o[0].y+r*A],s=[o[1].x+r*M,o[1].y+r*C],l=s[0]-a[0],h=s[1]-a[1];for(let i=0;i<f;i++){let r=i/p,o={x:a[0]+l*r,y:a[1]+h*r};E(n.projection.unproject(o.x,o.y),o)}}this.elevatedGlobeVertexBuffer=r.createVertexBuffer(a,ih.members)}{this.maxLongitudeTriangleSize=0;let a=[],n=new i.ae,o=(i,r,o)=>{n.emplaceBack(i,r,o);let s=_[i],l=_[r],h=_[o],u=Math.min(Math.min(s,l),h),c=Math.max(Math.max(s,l),h)-u;c>this.maxLongitudeTriangleSize&&(this.maxLongitudeTriangleSize=c),a.push(u+c/2)};for(let i=0;i<p;i++)for(let r=0;r<p;r++){let a=i*f+r,n=a+1,s=a+f,l=s+1;o(a,s,n),o(n,s,l)}[a,n]=function(r,a){let n=Array.from({length:r.length},(i,r)=>r);n.sort((i,a)=>r[i]-r[a]);let o=[],s=new i.ae;for(let i=0;i<n.length;i++){let l=n[i];o.push(r[l]);let h=3*l,u=h+1;s.emplaceBack(a.uint16[h],a.uint16[u],a.uint16[u+1])}return[o,s]}(a,n),this.elevatedGlobeTrianglesCenterLongitudes=a,this.elevatedGlobeIndexBuffer=r.createIndexBuffer(n)}this.elevatedGlobeSegments=i.ad.simpleSegment(0,0,f*m,p*p*2),this.elevatedGlobeGridMatrix=new Float32Array([0,x/i.a6,0,v/i.a6,0,0,y,g,0])}prepare(){let r=0!==Object.keys(this.tiles).length;if(this.tileID&&!r)return;let a=this.map.painter.context,n=a.gl;!this._dirty||this.texture instanceof i.cO||(this.texture?this.texture.update(this.image):(this.texture=new i.T(a,this.image,n.RGBA8),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE)),this._dirty=!1),r&&this._prepareData(a)}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(r){var a;let n=this.elevatedGlobeSegments;if(!this.elevatedGlobeTrianglesCenterLongitudes||!n)return null;let o=this.elevatedGlobeTrianglesCenterLongitudes,s=(a=r+180)+360*Math.round((o[0]-a)/360),l=new i.ad,h=(i,r)=>{l.segments.push({vertexOffset:0,primitiveOffset:i,vertexLength:n.segments[0].vertexLength,primitiveLength:r,sortKey:void 0,vaos:{}})},u=.51*this.maxLongitudeTriangleSize;if(Math.abs(o[0]-s)<=u){let r=i.cQ(o,0,o.length,s+u);return r===o.length||h(r,i.cR(o,r+1,o.length,s+360-u)-r),l}s<o[0]&&(s+=360);let c=i.cR(o,0,o.length,s-u);if(c===o.length)return h(0,o.length),l;h(0,c-0);let d=i.cQ(o,c+1,o.length,s+u);return d!==o.length&&h(d,o.length-d),l}}let am={vector:class 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.cB(a,["url","scheme","tileSize","promoteId"])),this._options={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.cC}load(r){this._loaded=!1,this.fire(new i.h("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.f(o))):s&&(this._setTileJSON(s),i5&&this.map.style&&i5(this.map.style),i.cK(s.tiles,this.map._requestManager._customAccessToken),this.fire(new i.h("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new i.h("data",{dataType:"source",sourceDataType:"content"}))),r&&r(o)};this.provider=this._options.provider;let s=i.cD(this._options);return s instanceof Error?(this._loaded=!0,this.fire(new i.f(s)),void(r&&r())):this.provider&&!s?(this._loaded=!0,this.fire(new i.f(Error(`TileProvider "${this.provider}" is not registered`))),void(r&&r())):void(this._tileJSONRequest=s?this.loadTileJSONWithProvider(s,o):i.cE(this._options,this.map._requestManager,a,n,o))}loadTileJSONWithProvider(r,a){this.provider=r.name;let n=new AbortController;return(async()=>{let{request:o,options:s}=await i.cL(this._options,this.map._requestManager,n.signal);if(n.signal.aborted)return;let l=await this.dispatcher.send("loadTileProvider",{name:r.name,url:r.url,source:this.id,scope:this.scope,type:this.t
110ype,options:s,request:o},{signal:n.signal});if(n.signal.aborted)return;let h=l?l.find(i=>null!=i):null,u=i.cM(this._options,h,this.map._requestManager);u instanceof Error?a(u):a(null,u)})().catch(i=>{n.signal.aborted||a(i)}),{cancel:()=>n.abort()}}_setTileJSON(r){if(Object.assign(this,r),this.hasWorldviews=!!r.worldview_options,r.worldview_default&&(this.worldviewDefault=r.worldview_default),r.vector_layers)for(let i of(this.vectorLayers=r.vector_layers,this.vectorLayerIds=[],this.localizableLayerIds=new Set,r.vector_layers))this.vectorLayerIds.push(i.id),r.worldview&&r.worldview[i.source]&&this.localizableLayerIds.add(i.id);this.tileBounds=i.cF.fromTileJSON(r)}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.m(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{...this._options}}async loadTile(r,a){let n=r.tileID.canonical.url(this.tiles,this.scheme),o=this.map._requestManager.normalizeTileURL(n),s=!r.actor||"expired"===r.state;if(!s&&"loading"===r.state)return void(r.reloadCallback=a);s&&(r.actor=this._tileWorkers[o]=this._tileWorkers[o]||this.dispatcher.getActor());let l=new AbortController;r.request=l;try{let h=await this.map._requestManager.transformRequest(o,i.R.Tile,l.signal);if(l.signal.aborted)return a(null);this.dispatchTile(r,o,n,h,l,s,a)}catch(i){if(l.signal.aborted)return a(null);a(i)}}dispatchTile(r,a,n,o,s,l,h){let u=this.map.style?this.map.style.getLut(this.scope):null,c=u?{image:u.image.clone()}:null,d=!(!this.map.style||!this.map.style._crossSourceElevationActive),p=!(!this.map.style||!d),f={request:o,data:void 0,uid:r.uid,tileID:r.tileID,tileZoom:r.tileZoom,zoom:r.tileID.overscaledZ,maxZoom:this.maxzoom,lut:c,tileSize:this.tileSize*r.tileID.overscaleFactor(),type:this.t
110ype,source:this.id,scope:this.scope,pixelRatio:i.e.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,showElevationIdDebug:!!this.map.painter&&this.map.painter._debugParams.showElevationIdDebug,promoteId:this.promoteId,renderSourceType:r.renderSourceType,frcCoverage:(()=>{let i=this.map.painter,a=i?i.frcCoverageFadeRange:null;if(null==a)return null;let n=i?i.frcCoverageSnapshot:null,o=this.map.transform.zoom<a[0],s=n?n.getTileOrParent(r.tileID.canonical):null,l=r.tileID.overscaledZ>=Math.ceil(a[1]),h=n&&l?n.getFullCoverageMask(r.tileID.canonical):null;return{frcMask:l?h??null:null,resolved:o||null!=n,polygons:s&&0!==s.frcMask?s.polygons:null,tileZoom:s&&0!==s.frcMask?s.tileId.z:null,sourceLayers:i?i.frcCoverageSourceLayers:["road","structure"]}})(),terrainEnabled:tu(this.map.style,this.map.transform),crossSourceElevationEnabled:p,elevation:i4?i4(this.map,r,d):null,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.cG(n)&&(f.localizableLayerIds=this.localizableLayerIds),f.request.collectResourceTiming=this._collectResourceTiming,l)if(this.dispatcher.ready||this.provider)r.request=r.actor.sendCancelable("loadTile",f,{},m.bind(this));else{let a=i.cH.call({deduped:this._deduped},f,(i,a)=>{r.aborted||(i||!a?m.call(this,i):(f.data={rawData:a.rawData.slice(0),headers:a.headers},r.actor&&(r.request=r.actor.sendCancelable("loadTile",f,{},m.bind(this)))))},!0);s.signal.addEventListener("abort",a,{once:!0})}else r.request=r.actor.sendCancelable("reloadTile",f,{},m.bind(this));function m(a,n){return delete r.request,r.aborted?h(null):a?h(a):(n&&n.resourceTiming&&(r.resourceTiming=n.resourceTiming),this.map._refreshExpiredTiles&&n&&r.setExpiryData(i.cI(n.headers)),void(function(){if(r.aborted)return h(null);r.loadVectorData(n,this.map.painter),i.cJ(this.dispatcher),h(null,n),r.reloadCallback&&(this.loadTile(r,r.reloadCallback),r.reloadCallback=null)}).call(this))}}abortTile(i){i.request&&(i.request.abort(),delete i.request),i.actor&&i.actor.notify("abortTile",{uid:i.uid,type:this.t
110ype,source:this.id,scope:this.scope})}unloadTile(i,r){i.actor&&i.actor.notify("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)}},raster:au,"raster-dem":class extends au{constructor(i,r,a,n){super(i,r,a,n),this.type="raster-dem",this.maxzoom=22,this._options={type:"raster-dem",...r},this.encoding=r.encoding||"mapbox"}loadTileJSONWithProvider(r,a){this.provider=r.name;let n=new AbortController;return(async()=>{let{request:o,options:s}=await i.cL(this._options,this.map._requestManager,n.signal);if(n.signal.aborted)return;let l=await this.dispatcher.send("loadTileProvider",{name:r.name,url:r.url,source:this.id,scope:this.scope,type:this.type,options:s,request:o},{signal:n.signal});if(n.signal.aborted)return;let h=l?l.find(i=>null!=i):null,u=i.cM(this._options,h,this.map._requestManager);u instanceof Error?a(u):a(null,u)})().catch(i=>{n.signal.aborted||a(i)}),{cancel:()=>n.abort()}}async loadTile(r,a){if(r.actor&&"expired"!==r.state)return;let n=this.map._requestManager.normalizeTileURL(r.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize);r.actor=this.dispatcher.getActor();let o=new AbortController;r.request=o;try{let s=await this.map._requestManager.transformRequest(n,i.R.Tile,o.signal);if(o.signal.aborted)return a(null);r.request=r.actor.sendCancelable("loadTile",{uid:r.uid,tileID:r.tileID,source:this.id,type:this.t
110ype,scope:this.scope,request:s,encoding:this.encoding},{},(function(n,o){return delete r.request,r.aborted?a(null):n?(r.state="errored",a(n)):(o&&(this.map._refreshExpiredTiles&&r.setExpiryData(i.cI(o.headers)),o.borderReady||r.neighboringTiles||(r.neighboringTiles=this._getNeighboringTiles(r.tileID)),r.dem=o.dem,r.dem.onDeserialize(),r.needsHillshadePrepare=!0,r.needsDEMTextureUpload=!0),r.state="loaded",void a(null))}).bind(this))}catch(i){if(o.signal.aborted)return a(null);r.state="errored",a(i)}}abortTile(i,r){i.request&&(i.request.abort(),delete i.request),i.actor&&i.actor.notify("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.bQ(r.overscaledZ,s,a.z,o,a.y).key]={backfilled:!1},u[new i.bQ(r.overscaledZ,h,a.z,l,a.y).key]={backfilled:!1},a.y>0&&(u[new i.bQ(r.overscaledZ,s,a.z,o,a.y-1).key]={backfilled:!1},u[new i.bQ(r.overscaledZ,r.wrap,a.z,a.x,a.y-1).key]={backfilled:!1},u[new i.bQ(r.overscaledZ,h,a.z,l,a.y-1).key]={backfilled:!1}),a.y+1<n&&(u[new i.bQ(r.overscaledZ,s,a.z,o,a.y+1).key]={backfilled:!1},u[new i.bQ(r.overscaledZ,r.wrap,a.z,a.x,a.y+1).key]={backfilled:!1},u[new i.bQ(r.overscaledZ,h,a.z,l,a.y+1).key]={backfilled:!1}),u}},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={...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.a6/this.tileSize;this.workerOptions={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.a6,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.a6,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.f(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.f(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}).then(i=>r(null,i)).catch(i=>r(i)),this}getClusterChildren(i,r){return this.actor.send("geojson.getClusterChildren",{clusterId:i,source:this.id,scope:this.scope}).then(i=>r(null,i)).catch(i=>r(i)),this}getClusterLeaves(i,r,a,n){return this.actor.send("geojson.getClusterLeaves",{source:this.id,scope:this.scope,clusterId:i,limit:r,offset:a}).then(i=>n(null,i)).catch(i=>n(i)),this}async _updateWorkerData(r=!1){if(this._pendingLoad)return void(this._coalesce=!0);this.fire(new i.h("dataloading",{dataType:"source"})),this._loaded=!1;let a={append:r,...this.workerOptions};a.scope=this.scope;let n=this._data,o=new AbortController;this._pendingLoad=o;try{if("string"==typeof n){if(a.request=await this.map._requestManager.transformRequest(i.e.resolveURL(n),i.R.Source,o.signal),o.signal.aborted)return this._pendingLoad=null,void(this._coalesce=!1);a.request.collectResourceTiming=this._collectResourceTiming}else a.data=JSON.stringify(n);let s=await this.actor.send(`${this.type}.loadData`,a,{signal:o.signal});this._loaded=!0,this._pendingLoad=null;let l={dataType:"source",sourceDataType:this._metadataFired?"content":"metadata"};this._collectResourceTiming&&s&&s.resourceTiming&&s.resourceTiming[this.id]&&(l.resourceTiming=s.resourceTiming[this.id]),r&&(this._partialReload=!0),this.fire(new i.h("data",l)),this._partialReload=!1,this._metadataFired=!0}catch(r){if(o.signal.aborted)return this._pendingLoad=null,void(this._coalesce=!1);this._loaded=!0,this._pendingLoad=null,this.fire(new i.f(r))}this._coalesce&&(this._updateWorkerData(r),this._coalesce=!1)}loaded(){return this._loaded}reload(){let r=i.m(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()}
vendor: 1,098 bytes, line 110
110: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.e.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.sendCancelable(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),void a(null))))}abortTile(i){i.request&&(i.request.abort(),delete i.request),i.aborted=!0}unloadTile(i,r){this.actor.notify("removeTile",{uid:i.uid,type:this.type,source:this.id,scope:this.scope}),i.destroy()}onRemove(i){this._pendingLoad&&this._pendingLoad.abort()}
110serialize(){return{...this._options,type:this.type,data:this._data}}hasTransition(){return!1}},video:class extends af{constructor(i,r,a,n){super(i,r,a,n),this.roundZoom=!0,this.type="video",this.options=r}async load(){this._loaded=!1;let r=this.options,a=new AbortController;this._imageRequest=a;try{let n=await Promise.all(r.urls.map(async r=>(await this.map._requestManager.transformRequest(r,i.R.Source,a.signal)).url));if(a.signal.aborted)return;this.urls=n;let o=await i.cW(n);if(a.signal.aborted)return;this._imageRequest=null,this.video=o,this.video.loop=!0,this.video.setAttribute("playsinline",""),this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading()}catch(r){if(a.signal.aborted)return;this.fire(new i.f(r))}finally{this._loaded=!0}}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.f(new J(`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}
110onAdd(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.options.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}},image:af,canvas:class extends af{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.f(new J(`sources.${r}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new i.f(new J(`sources.${r}`,null,'missing required property "coordinates"'))),a.animate&&"boolean"!=typeof a.animate&&this.fire(new i.f(new J(`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.f(new J(`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.f(new J(`sources.${r}`,null,'missing required property "canvas"'))),this.options=a,this.animate=void 0===a.animate||a.animate}async load(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new i.f(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.cO||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.f(Error(`Missing implementation for ${this.id} custom source`))),this._implementation.loadTile||this.fire(new i.f(Error(`Missing loadTile implementation for ${this.id} custom source`))),this._implementation.bounds&&(this.tileBounds=new i.cF(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.cB(a,["dataType","scheme","minzoom","maxzoom","tileSize","attribution","minTileCacheSize","maxTileCacheSize"]))}serialize(){return i.cB(this,["type","scheme","minzoom","maxzoom","tileSize","attribution"])}load(){this._loaded=!0,this.fire(new i.h("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new i.h("data",{dataType:"source",sourceDataType:"content"}))}loaded(){return this._loaded}onAdd(r){this.map=r,this._loaded=!1,this.fire(new i.h("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})}
110return!this.tileBounds||this.tileBounds.contains(i.canonical)}async loadTile(i,r){let{x:a,y:n,z:o}=i.tileID.canonical,s=new AbortController;i.request=s;try{let l=await this._implementation.loadTile({x:a,y:n,z:o},{signal:s.signal});if(delete i.request,i.aborted)return i.state="unloaded",r(null);if(void 0===l)return i.state="errored",r(null);if(null===l)return this.loadTileData(i,{width:this.tileSize,height:this.tileSize,data:null}),i.state="loaded",r(null);if(!(l instanceof ImageData||l instanceof HTMLCanvasElement||l instanceof ImageBitmap||l instanceof HTMLImageElement))return i.state="errored",r(Error(`Can't infer data type for ${this.id}, only raster data supported at the moment`));this.loadTileData(i,l),i.state="loaded",r(null)}catch(a){if(s.signal.aborted)return;i.state="errored",r(a)}}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.abort(),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.m(this.id,this.scope);this.map.style.clearSource(r)}_update(){this.fire(new i.h("data",{dataType:"source",sourceDataType:"content"}))}}},a_=function(r,a,n,o){let s=ag(a.type);if(!s)throw Error(`Unknown source type "${a.type}"`);let l=new s(r,a,n,o);if(l.id!==r)throw Error(`Expected Source id to be ${r} instead of ${l.id}`);return i.aW(["load","abort","unload","serialize","prepare"],l),l},ag=function(i){return Object.hasOwn(am,i)?am[i]:void 0};class ay extends Error{constructor(i){super(i),this.name="MRTOverzoomError"}}let ax={uint8:Uint8Array,uint16:Uint16Array,uint32:Uint32Array};i.c_.setPbf(i.c$);class av extends ip{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._isLoadInProgress=!1,this.textureDescriptorPerLayer=new Map,this.texturePerLayer=new Map,this.parentTile=null,this.overzoomCoordsPerLayer=null}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})).bind(s.LINEAR,s.CLAMP_TO_EDGE),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.c_(30),o={...this.requestParams,headers:{Range:"bytes=0-"+(r-1)}};this.entireBuffer=null;let s=new AbortController;return this.request=s,i.d0(o,s.signal).then(({data:i,headers:o})=>{try{let s=n.getHeaderLength(i);if(s>r)return void(this.request=this.fetchHeader(s,a));n.parseHeader(i),this._isHeaderLoaded=!0;let l=0;for(let i of Object.values(n.layers))l=Math.max(l,i.dataIndex.at(-1).lastByte);i.byteLength>=l&&(this.entireBuffer=i),a(null,this.entireBuffer||i,o)}catch(i){a(i)}}).catch(i=>{s.signal.aborted||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){let s,l,h=this._mrt;if(!this._isHeaderLoaded||!h)return void o(Error("Tile header is not ready"));if(this.parentTile&&this.overzoomCoordsPerLayer)return void o(null,null);let u=this.actor;if(!u)return void o(Error("Can't fetch tile band without an actor"));let c=i.m(String(n),i.m(this.tileID.key,r)),d=this._taskQueue.get(c);d?d.add(o):((d=new Set).add(o),this._taskQueue.set(c,d));let p=(i,r)=>
110{s.complete(i,r),i?o(i):(d.forEach(i=>i(null,r)),this._taskQueue.delete(c))},f=(i,r)=>{if(i)return o(i);let n,l=!1;if(null!==a){let i=this._workQueuePerLayer.get(a)||[];i.push(()=>{l=!0,n&&n.abort(),s.cancel()}),this._workQueuePerLayer.has(a)||this._workQueuePerLayer.set(a,i)}let h=()=>{l||(n=u.sendCancelable("decodeRasterArray",{type:"raster-array",source:this.source,scope:this.scope,tileID:this.tileID,uid:this.uid,buffer:r,task:s},{},p))};void 0!==this.workerReady?this.workerReady.then(h).catch(i=>o(i)):h()};try{l=h.getLayer(r)}catch(i){if(this.parentTile&&this.overzoomCoordsPerLayer)return void o(Error(`Layer '${r}' not found in parent tile MRT`));if("reloading"===this.state)return;throw i}if(!l)return void o(Error(`Unknown sourceLayer "${r}"`));if(l.hasDataForBand(n))return d.forEach(i=>i(null,null)),void this._taskQueue.delete(c);let m=l.getDataRange([n]);if(!(s=h.createDecodingTask(m))||s.tasks.length)if(null!==a&&this.flushQueues(a),this.entireBuffer)f(null,this.entireBuffer.slice(m.firstByte,m.lastByte+1));else{let r={...this.requestParams,headers:{Range:`bytes=${m.firstByte}-${m.lastByte}`}},n=new AbortController;if(i.d0(r,n.signal).then(({data:i})=>f(null,i)).catch(i=>{n.signal.aborted||f(i)}),null!==a){let i=this._fetchQueuePerLayer.get(a)||[];i.push(()=>{n.abort(),s.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){let o;if(!this._mrt)return;try{o=this._mrt.getLayer(r)}catch(i){return}if(!o||!o.hasBand(n)||!o.hasDataForBand(n))return;let{bytes:s,tileSize:l,buffer:h,offset:u,scale:c}=o.getBandView(n);if(this.parentTile&&this.overzoomCoordsPerLayer){let i=this.overzoomCoordsPerLayer.get(r);i&&(s=this.cropBandData(s,l,h,i),l=i.tileSize)}let d=l+2*h,p=new i.b({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]})}cropBandData(i,r,a,n){let{offset:o,tileSize:s}=n,l=r+2*a,h=s+2*a;return function(i,r,a,n){let o=function(i){if(i instanceof Uint8Array)return"uint8";if(i instanceof Uint16Array)return"uint16";if(i instanceof Uint32Array)return"uint32";throw Error("Invalid array type")}(i),s=ax[o];if(!s)throw Error(`Invalid data type "${o}"`);let l=r[2]*r[3],h=r[1]*l,u=a[2]*a[3],c=a[1]*u,d=new s(c*a[0]);for(let o=0;o<a[0];o++){let s=o*h;s+=a[3]*(n[1]*r[2]+n[0]);let p=o*c;for(let r=0;r<a[1];r++)d.subarray(p,p+u).set(i.subarray(s,s+u)),s+=l,p+=u}return d}(i,[1,l,l,4],[1,h,h,4],o)}setupOverzoom(i){let r=i;for(;r.parentTile;)r=r.parentTile;let a=r._mrt;if(!a||!a.layers)return!1;let n=Object.values(a.layers);if(0===n.length)return!1;let o={x:r.tileID.canonical.x,y:r.tileID.canonical.y,z:r.tileID.canonical.z},s={x:this.tileID.canonical.x,y:this.tileID.canonical.y,z:this.tileID.canonical.z},l=new Map;for(let i of n)try{l.set(i.name,function(i,r,a){let{x:n,y:o,z:s}=r,{x:l,y:h,z:u}=a,c=u-s;if(c<0)throw new ay(`Invalid overzoom, source (z=${s}) is higher zoom than destination (z=${u}).`);let d=l-(n<<c),p=h-(o<<c),f=1<<c;if(d<0||d>=f||p<0||p>=f)throw new ay(`Invalid overzoom, ${u}/${l}/${h} is not a child of ${s}/${n}/${o}.`);let m=Math.min(c,0|Math.log2(i)),_=c-m,g=i>>m;return{offset:[(d>>_)*g,(p>>_)*g],tileSize:g,deltaZ:c}}(i.tileSize,o,s))}catch(i){return!1}return this.parentTile=r,this._mrt=a,this._isHeaderLoaded=!0,this.overzoomCoordsPerLayer=l,!0}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}}ic=(i,r,a,n,o)=>new av(i,r,a,n,o);let ab=class extends au{get partial(){return!this.map.style.imageManager.hasImageProviderForSource(this.id,this.scope)}constructor(i,r,a,n){super(i,r,a,n),this.type="raster-array",this.maxzoom=void 0!==r.maxzoom?r.maxzoom:22,this._loadTilePending={},this._loadTileLoaded={},this._pendingParentWaiters=new Map,this._options={type:"raster-array",...r}}onAdd(i){super.onAdd(i);let r=i=>{"source"===i.dataType&&"metadata"===i.sourceDataType&&(this.off("data",r),void 0===this._dataMaxzoom&&(this._dataMaxzoom=this.maxzoom))};this.on("data",r)}getDataMaxzoom(){return this._dataMaxzoom}collectOverzoomParentTileIDs(i,r){let a=[];for(let r in i){let n=i[r];if(!n)continue;let o=n.parentTile;o&&i[o.tileID.key]&&a.push(o.tileID)}let n=this._dataMaxzoom;if(void 0!==n)for(let o of r){if(o.canonical.z<=n)continue;let r=o.scaledTo(n);i[r.key]&&a.push(r)}return a}_narrowDataMaxzoom(i){let r=Math.max(this.minzoom,i-1);(void 0===this._dataMaxzoom||r<this._dataMaxzoom)&&(this._dataMaxzoom=r)}_isParentReady(i){let r=i._mrt;return i._isHeaderLoaded&&!!r&&!!r.layers&&Object.keys(r.layers).length>0}_waitForParent(i,r){if(this._isParentReady(i))return void r(null);if("errored"===i.state)return void r(Error("Parent tile failed to load"));
110let a=this._pendingParentWaiters.get(i.uid);if(a)return void a.push(r);this._pendingParentWaiters.set(i.uid,[r]);let n=r=>{if("source"!==r.dataType||r.tile!==i)return;let a=this._isParentReady(i);if(!a&&"errored"!==i.state)return;this.off("data",n);let o=this._pendingParentWaiters.get(i.uid)||[];this._pendingParentWaiters.delete(i.uid);let s=a?null:Error("Parent tile failed to load");for(let i of o)i(s)};this.on("data",n)}triggerRepaint(i){let r=this.map.painter._terrain,a=this.map.style.getSourceCache(this.id);r&&r.enabled&&a&&r._clearRenderCacheForTile(a.id,i.tileID),this.map.triggerRepaint()}_setupOverzoomTile(i,r){let a=void 0!==this._dataMaxzoom?this._dataMaxzoom:this.maxzoom,n=this.map.style.getSourceCache(this.id);if(!n)return void r(Error("Source cache not found"));i._isLoadInProgress=!0;let o=i.tileID.scaledTo(a),s=n.getTile(o);for(;s&&s.parentTile;)s=s.parentTile;s||(s=n._addTile(o));let l=a=>{i._isLoadInProgress=!1,r(a)};this._waitForParent(s,r=>{if(r||!i.setupOverzoom(s))return i.state="errored",void l(r||Error("Parent tile setup failed"));i.state="loaded",l(null)})}async loadTile(r,a){let n=r.tileID.canonical.z>(void 0!==this._dataMaxzoom?this._dataMaxzoom:this.maxzoom);if("loaded"===r.state||r._isLoadInProgress)return void a(null);if(n)return void this._setupOverzoomTile(r,a);let o=this.map._requestManager.normalizeTileURL(r.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize);r.source=this.id,r.scope=this.scope,void 0===this._workerReady&&(this._workerReady=this.dispatcher.send("ensureRasterArraySource",void 0).then(()=>{}),this._workerReady.catch(()=>{})),r.workerReady=this._workerReady,r.actor||(r.actor=this.dispatcher.getActor());let s=new AbortController;r.request=s;let l=(n,o,s)=>{if(delete r.request,r.aborted)return a(null);if(n)return(404===n.status||"string"==typeof n.message&&n.message.includes("Not Found"))&&(this._narrowDataMaxzoom(r.tileID.canonical.z),void 0!==this._dataMaxzoom&&r.tileID.canonical.z>this._dataMaxzoom)?void this._setupOverzoomTile(r,a):(r.state="errored",a(n));if(this.map._refreshExpiredTiles&&o&&r.setExpiryData(i.cI(s)),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)};try{let n=await this.map._requestManager.transformRequest(o,i.R.Tile,s.signal);if(s.signal.aborted)return a(null);r.requestParams=n;
110let h={request:n,uid:r.uid,tileID:r.tileID,type:this.type,source:this.id,scope:this.scope,partial:this.partial};r.request=this.partial?r.fetchHeader(void 0,(i,r,a)=>{l(i,r,a)}):r.actor.sendCancelable("loadTile",h,{},(i,r)=>i?l(i):r?void l(null,r.mrt,r.headers):l(null,null))}catch(i){if(s.signal.aborted)return a(null);r.state="errored",a(i)}}abortTile(i){i.request&&(i.request.abort(),delete i.request),i.actor&&i.actor.notify("abortTile",{uid:i.uid,type:this.type,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.tileID.canonical.z>(void 0!==this._dataMaxzoom?this._dataMaxzoom:this.maxzoom)&&(!r.parentTile||!r.overzoomCoordsPerLayer)||r._isHeaderLoaded&&("empty"!==r.state&&(r.state="reloading"),r.fetchBandForRender(a,n,o,(a,o)=>{a?(r.state="errored",this.fire(new i.f(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.cX?s=a.paint.get("raster-array-band"):a instanceof i.cY&&(s=a.paint.get("raster-particle-array-band"));let l=s||this.getInitialBand(o);return null==l||!r.textureDescriptorPerLayer.get(a.id)||r.updateNeeded(a.id,l)&&!n?void 0:{...r.textureDescriptorPerLayer.get(a.id),texture:r.texturePerLayer.get(a.id)}}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.b({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.m(u,f)),a.fetchBand(u,null,f,a=>{i.e.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.a7(r)-u)*l)),l-1+h),Math.min(Math.max(-h,Math.floor((p*i.a8(a)-c)*l)),l-1+h)],o,{scaled:s})}([r.lng,r.lat],o,c.getBandView(f)),h.delete(i.m(u,f)),0===h.size&&s(l)})}))}0===h.size&&s(l)})}_loadTileForQuery(i){if(this._loadTileLoaded[i.uid])return Promise.resolve(i._mrt);if(i.uid in this._loadTilePending)return this._loadTilePending[i.uid];let r=this._fetchTileForQuery(i);return this._loadTilePending[i.uid]=r,r}async _fetchTileForQuery(r){let a=this.map._requestManager.normalizeTileURL(r.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize);try{let n={request:await this.map._requestManager.transformRequest(a,i.R.Tile),uid:r.uid,tileID:r.tileID,type:this.t
110ype,source:this.id,scope:this.scope,partial:!1},o=await r.actor.send("loadTile",n);if(!o)return null;let s=o.mrt;return this.map._refreshExpiredTiles&&r.setExpiryData(i.cI(o.headers)),r._mrt=s,r._isHeaderLoaded=!0,r.state="loaded",this._loadTileLoaded[r.uid]=!0,s}finally{delete this._loadTilePending[r.uid]}}async queryRasterArrayValueByAllBands(i,r,a){return await this._loadTileForQuery(r)?this.queryRasterArrayValueByBandId(i,r,a):null}queryRasterArrayValue(r,a){let n=i.cZ.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.bT.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);if(l<0||l>=o||h<0||h>=o)return null;let u=this.map.style.getSourceCache(this.id),c=new i.bQ(n,s,n,l,h);return u.findLoadedParent(c,this.minzoom)}},aw={model:()=>tM().then(()=>tA.ModelSource),"batched-model":()=>tM().then(()=>tA.Tiled3dModelSource),"raster-array":()=>(async function(){return Promise.resolve()})().then(()=>ab)};class aT extends i.E{constructor(i,r,a,n){super(),this.id=i,this.type=r.type,this._options=r,this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.setEventedParent(n)}hasTransition(){return!1}loaded(){return!1}onAdd(i){}onRemove(i){}loadTile(i,r){}serialize(){return this._options}}function aS(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 aE(i,r,a,n=""){if(i.uniqueFeatureID){let o=aS(i,r,n);if(a.has(o))return!0;a.add(o)}return!1}function aI(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}class aA{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)}hasLayerForSourceCache(i){for(let{layer:r}of this.layers){let a=this.style.getLayerSourceCache(r);if(a&&a.id===i)return!0}return!1}_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.a6)*u-h.x*i.a6|0,l=(n+r.canonical.y*i.a6)*u-h.y*i.a6|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 aM(){return u||(u=new tx),u}function aC(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];
110s&&(r[n]=function(r,a){let n={};for(let i in r)"ref"!==i&&(n[i]=r[i]);return i.d1.forEach(i=>{i in a&&(n[i]=a[i])}),n}(o,s))}}return r}class aP{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.b1(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))}}class aR{constructor(i,r){this.gridRightBoundary=0,this.gridBottomBoundary=0,this.clippedSymbols=new Map,this.reset(i,r)}reset(r,a){let n=r.width+200,o=r.height+200;n!==this.gridRightBoundary||o!==this.gridBottomBoundary?(this.grid=new i.d2(n,o,25),this.ignoredGrid=new i.d2(n,o,25)):(this.grid.clear(),this.ignoredGrid.clear()),this.transform=r,this.fogState=a,this.pitchfactor=Math.cos(r._pitch)*r.cameraToCenterDistance,this.screenRightBoundary=r.width+100,this.screenBottomBoundary=r.height+100,this.gridRightBoundary=n,this.gridBottomBoundary=o,this.clippedSymbols.clear()}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.S(this.transform.zoom):0;if(v&&w&&T<1&&!l){let r=1<<v.canonical.z,a=i.d3(g,y);i.d4(a,a,1/i.a6),i.d5(a,a,i.d3(v.canonical.x,v.canonical.y)),i.d4(a,a,1/r),i.d6(a,a,i.d3(o[0],o[1])),a[0]=i.d7(a[0],-.5,.5),i.d4(a,a,i.a6);let n=i.d8(a[0],a[1],i.a6/(2*Math.PI),1);i.c6(n,n,s),f=i.am(f,n[0],T),m=i.am(m,n[1],T),_=i.am(_,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<=i.d9||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.c2.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,a,n]=(P=w&&r.hdExt?r.hdExt.makeRoadSymbolElevationParams(r,r.text,o,y,S,v,b,this.transform.center.lat,this.transform.worldSize):{getElevation:S,elevation:v,elevationFeature:null}).getElevation(E,v,P.elevationFeature);A+=i,M+=a,C+=n}let R="globe"===b.name,D=this.projectAndGetPerspectiveRatio(u,A,M,C,y,R||!!v||this.transform.pitch>0,b),{perspectiveRatio:L}=D,z=(f?h/L:h*L)/i.dg,F=i.da(A,M,C,c),O=n.lineOffsetX*z,B=n.lineOffsetY*z,k=Math.cos(i.av(r.layers[0].layout.get("text-max-angle"))),N=D.signedDistanceFromCamera>0?i.db(z,l,O,B,w&&1===n.flipState,F,I,n,s,c,{},T&&!f?P:null,f&&T,b,y,f,k):null,V=!1,U=!1,j=!0;if(N&&!D.occluded){let r=.5*_*L+g,n=new i.P(-100,-100),o=new i.P(this.screenRightBoundary,this.screenBottomBoundary),s=new aP,{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(([r,a,n],o)=>(T&&!R&&(n=P.getElevation(o<u-1?l.tilePath[u-1-o]:h.tilePath[o-u+2],v,P.elevationFeature)[2]),i.da(r,a,n,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.dc(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,_),U=U||this.isInsideGrid(c,d,f,_),!a&&this.grid.hitTestCircle(h,u,r,m)&&(V=!0,!p))return{circles:[],offscreen:!1,collisionDetected:V,occluded:!1}}}}return{circles:(p||!V)&&U?x:[],offscreen:j,collisionDetected:V,occluded:D.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;
110let 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.aU(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.c6(u,u,r),this.fogState&&s&&"globe"!==h.name&&(c=i.dd(this.fogState,a,n,o,s.toUnwrapped(),this.transform)>i.dh)):i.de(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.df([]);return i.bN(r,r,[-100,-100,0]),r}}class aD{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 aL{constructor(i,r,a,n,o,s=!1){this.text=new aD(i?i.text:null,r,a,o),this.icon=new aD(i?i.icon:null,r,n,o),this.clipped=s}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class az{constructor(i,r,a,n=!1){this.text=i,this.icon=r,this.skipFade=a,this.clipped=n}}class aF{constructor(){this.invProjMatrix=i.Y(),this.viewportMatrix=i.Y(),this.circles=[]}}class aO{constructor(i,r,a,n,o){this.bucketInstanceId=i,this.featureIndex=r,this.sourceLayerIndex=a,this.bucketIndex=n,this.tileID=o}}class aB{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 ak(r,a,n,o,s){let{horizontalAlign:l,verticalAlign:h}=i.du(r),u=i.dv(r,o);return new i.P(-(l-.5)*a+u[0]*s,-(h-.5)*n+u[1]*s)}function aN(r,a,n,o,s){let l=new i.P(r,a);return n&&l._rotate(o?s:-s),l}function aV(r,a,n,o){let{leftJustifiedTextSymbolIndex:s,centerJustifiedTextSymbolIndex:l,rightJustifiedTextSymbolIndex:h,verticalPlacedTextSymbolIndex:u,crossTileID:c}
110=n,d=i.dw(a),p=o===i.dt.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)}function aU(r,a,n){let o=a===i.dt.horizontal||a===i.dt.horizontalOnly?a:0,s=a===i.dt.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)}class aj{constructor(i,r,a,n,o,s,l){this.transform=i.clone(),this.projection=i.projection.name,l instanceof aR?(l.reset(this.transform,o),this.collisionIndex=l):this.collisionIndex=new aR(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 aB(a),this.collisionCircleArrays={},this.prevPlacement=n,n&&(n.prevPlacement=void 0),this.placedOrientations={},this.lastReplacementSourceUpdateTime=0}getBucketParts(r,a,n,o,s=1){let l=n.getBucket(a),h=n.latestFeatureIndex;if(!l||!h||a.fqid!==l.layerIds[0])return;let u=l.layers[0].layout,c=l.layers[0].paint,d=n.collisionBoxArray,p=Math.pow(2,this.transform.zoom-n.tileID.overscaledZ),f=n.tileSize/i.a6,m=n.tileID.toUnwrapped();this.transform.setProjection(l.projection);let _=i.di(n.tileID,l.getProjection(),this.transform,this.projection),g="map"===u.get("text-pitch-alignment"),y="map"===u.get("text-rotation-alignment");a.compileFilter(a.options);let x=a.dynamicFilter(),v=a.dynamicFilterNeedsFeature(),b=a.dynamicFilterNeedsGeometry(),w=this.transform.calculatePixelsToTileUnitsMatrix(n),T=i.dj(_,n.tileID.canonical,g,y,this.transform,l.getProjection(),w),S=null,E=l.getProjection().createInversionMatrix(this.transform,n.tileID.canonical);if(g){let r=i.dk(_,n.tileID.canonical,g,y,this.transform,l.getProjection(),w);S=i.X([],this.transform.labelPlaneMatrix,r)}let I=null;x&&n.latestFeatureIndex&&(I={unwrappedTileID:m,dynamicFilter:x,dynamicFilterNeedsFeature:v,needGeometry:b}),this.retainedQueryData[l.bucketInstanceId]=new aO(l.bucketInstanceId,h,l.sourceLayerIndex,l.index,n.tileID);let[A,M]=l.layers[0].layout.get("text-size-scale-range"),C=i.b1(s,A,M),[P,R]=u.get("icon-size-scale-range"),D=i.b1(s,P,R),L={bucket:l,layout:u,paint:c,posMatrix:_,invMatrix:E,mercatorCenter:[i.a7(this.transform.center.lng),i.a8(this.transform.center.lat)],textLabelPlaneMatrix:T,labelToScreenMatrix:S,clippingData:I,scale:p,textPixelRatio:f,holdingForFade:n.holdingForFade(),collisionBoxArray:d,partiallyEvaluatedTextSize:i.dl(l.textSizeData,this.transform.zoom,C),partiallyEvaluatedIconSize:i.dl(l.iconSizeData,this.transform.zoom,D),collisionGroup:this.collisionGroups.get(l.sourceID),latestFeatureIndex:n.latestFeatureIndex};if(o)for(let i of l.sortKeyRanges){let{sortKey:a,symbolInstanceStart:n,symbolInstanceEnd:o}=i;r.push({sortKey:a,symbolInstanceStart:n,symbolInstanceEnd:o,parameters:L})}else r.push({symbolInstanceStart:0,symbolInstanceEnd:l.symbolInstances.length,parameters:L})}placeLayerBucketPart(r,a,n,o=1){let{bucket:s,layout:l,paint:h,posMatrix:u,textLabelPlaneMatrix:c,labelToScreenMatrix:d,clippingData:p,textPixelRatio:f,mercatorCenter:m,invMatrix:_,holdingForFade:g,collisionBoxArray:y,partiallyEvaluatedTextSize:x,partiallyEvaluatedIconSize:v,collisionGroup:b,latestFeatureIndex:w}=r.parameters,T=l.get("text-optional"),S=l.get("icon-optional"),E=l.get("text-allow-overlap"),I=l.get("icon-allow-overlap"),A="map"===l.get("text-rotation-alignment"),M="map"===l.get("icon-rotation-alignment"),C="map"===l.get("text-pitch-alignment"),P=h.get("symbol-z-offset"),R="sea"===l.get("symbol-elevation-reference"),D=l.get("symbol-placement"),L=l.get("text-variable-anchor"),z=A&&"point"!==D,F=L&&s.hasTextData(),O=s.hasIconTextFit()&&F&&s.hasIconData();this.transform.setProjection(s.projection);let B=F||z,k=M&&"point"!==D||O,N=E&&(I||!s.hasIconData()||S),V=I&&(E||!s.hasTextData()||T),U=!P.isConstant();!s.collisionArrays&&y&&s.deserializeCollisionBoxes(y);let j=(r,o,h)=>{let{crossTileID:y,numVerticalGlyphVertices:M}=r,D=null;if(p&&p.dynamicFilterNeedsFeature||U){let a=this.retainedQueryData[s.bucketInstanceId],n=w.loadFeature({featureIndex:r.featureIndex,bucketIndex:a.bucketIndex,sourceLayerIndex:a.sourceLayerIndex,layoutVertexArrayOffset:0}),o=n.properties?n.properties.worldview:null;if(s.localizable&&s.worldview&&"string"==typeof o)if("all"===o)n.properties.$localized=!0;else{if(!o.split(",").includes(s.worldview))return;n.properties.$localized=!0,n.properties.worldview=s.worldview}D=p&&p.needGeometry?i.bx(n,!0):n}if(p&&!(0,p.dynamicFilter)({zoom:this.transform.zoom,pitch:this.transform.pitch,worldview:s.worldview},D,this.retainedQueryData[s.bucketInstanceId].tileID.canonical,new i.P(r.tileAnchorX,r.tileAnchorY),this.transform.calculateDistanceTileData(p.unwrappedTileID)))return this.placements[y]=new az(!1,!1,!1,!0),void a.add(y);let z=P.evaluate(D,{});if((r.zOffset||0)+(z||0)>
1100&&this.frontCutoffStart>0){let n=2*this.frontCutoffStart-1,o=[r.tileAnchorX,r.tileAnchorY,0,1],s=i.c6(i.dr(),o,u);if(s[1]/s[3]<n)return this.placements[y]=new az(!1,!1,!1,!0),void a.add(y)}if(a.has(y))return;if(g)return void(this.placements[y]=new az(!1,!1,!1));let F=!1,O=!1,j=!0,G=!1,Z=!1,$=null,H={box:null,offscreen:null,occluded:null},q={box:null},W=null,X=null,Y=null,K=0,J=0,Q=0;h.textFeatureIndex?K=h.textFeatureIndex:r.useRuntimeCollisionCircles&&(K=r.featureIndex),h.verticalTextFeatureIndex&&(J=h.verticalTextFeatureIndex);let ee=a=>{a.tileID=this.retainedQueryData[s.bucketInstanceId].tileID;let n=this.transform.elevation;if("road"===s.elevationType)a.elevation=R?z:z+i.c2.getAtTileOffset(a.tileID,new i.P(a.tileAnchorX,a.tileAnchorY),n,null);else{let o=s.hdExt?s.hdExt.elevationFeatures[r.elevationFeatureIndex]:void 0;a.elevation=R?z:z+i.c2.getAtTileOffset(a.tileID,new i.P(a.tileAnchorX,a.tileAnchorY),n,o)}a.elevation+=r.zOffset},et=h.textBox;if(et){ee(et);let a=a=>{let n=i.dt.horizontal;if(s.allowVerticalPlacement&&!a&&this.prevPlacement){let i=this.prevPlacement.placedOrientations[y];i&&(this.placedOrientations[y]=i,aU(s,n=i,r))}return n},n=(r,a)=>{if(s.allowVerticalPlacement&&M>0&&h.verticalTextBox){for(let n of s.writingModes)if(n===i.dt.vertical?q=H=a():H=r(),H&&H.box&&H.box.length)break}else H=r()};if(L){let l=L;if(this.prevPlacement&&this.prevPlacement.variableOffsets[y]){let i=this.prevPlacement.variableOffsets[y];l.indexOf(i.anchor)>0&&(l=l.filter(r=>r!==i.anchor)).unshift(i.anchor)}let c=(i,a,n)=>{let h=s.getSymbolInstanceTextSize(x,r,this.transform.zoom,o),c=(i.x2-i.x1)*h+2*i.padding,d=(i.y2-i.y1)*h+2*i.padding,p=r.hasIconTextFit&&!I?a:null;p&&ee(p);let g={box:[],offscreen:!1,occluded:!1},y=E?2*l.length:l.length;for(let a=0;a<y;++a){let y=this.attemptAnchorPlacement(l[a%l.length],i,m,_,B,c,d,h,A,C,f,u,b,a>=l.length,r,o,s,n,p,x,v);if(y&&(g=y.placedGlyphBoxes)&&g.box&&g.box.length){F=!0,$=y.shift;break}}return g};n(()=>c(et,h.iconBox,i.dt.horizontal),()=>{let r=h.verticalTextBox;return r&&ee(r),s.allowVerticalPlacement&&!(H&&H.box&&H.box.length)&&M>0&&r?c(r,h.verticalIconBox,i.dt.vertical):{box:null,offscreen:null,occluded:null}}),H&&(F=H.box,j=H.offscreen,G=H.occluded);let d=a(!(!H||!H.box));if(!F&&this.prevPlacement){let i=this.prevPlacement.variableOffsets[y];i&&(this.variableOffsets[y]=i,aV(s,i.anchor,r,d))}}else{let l=(a,n)=>{let l=s.getSymbolInstanceTextSize(x,r,this.transform.zoom,o),h=this.collisionIndex.placeCollisionBox(s,l,a,m,_,B,new i.P(0,0),E,f,u,b.predicate);return h&&h.box&&h.box.length&&(aU(s,n,r),this.placedOrientations[y]=n),h};n(()=>l(et,i.dt.horizontal),()=>{let r=h.verticalTextBox;return s.allowVerticalPlacement&&M>0&&r?(ee(r),l(r,i.dt.vertical)):{box:null,offscreen:null,occluded:null}}),a(!!(H&&H.box&&H.box.length))}}if(F=(W=H)&&W.box&&W.box.length>0,j=W&&W.offscreen,G=W&&W.occluded,r.useRuntimeCollisionCircles){let a=r.centerJustifiedTextSymbolIndex>=0?r.centerJustifiedTextSymbolIndex:r.verticalPlacedTextSymbolIndex,o=s.text.placedSymbolArray.get(a),h=i.ds(s.textSizeData,x,o),p=l.get("text-padding");X=this.collisionIndex.placeCollisionCircles(s,E,o,a,s.lineVertexArray,s.glyphOffsetArray,h,u,c,d,n,C,b.predicate,r.collisionCircleDiameter*h/i.dg,p,this.retainedQueryData[s.bucketInstanceId].tileID),F=E||X.circles.length>0&&!X.collisionDetected,j=j&&X.offscreen,G=X.occluded}if(h.iconFeatureIndex&&(Q=h.iconFeatureIndex),h.iconBox){let a=a=>{ee(a);let n=r.hasIconTextFit&&$?aN($.x,$.y,A,C,this.transform.angle):new i.P(0,0),o=s.getSymbolInstanceIconSize(v,this.transform.zoom,r.placedIconSymbolIndex);return this.collisionIndex.placeCollisionBox(s,o,a,m,_,k,n,I,f,u,b.predicate)};O=q&&q.box&&q.box.length&&h.verticalIconBox?(Y=a(h.verticalIconBox)).box.length>0:(Y=a(h.iconBox)).box.length>0,j=j&&Y.offscreen,Z=Y.occluded}let ei=T||0===r.numHorizontalGlyphVertices&&0===M,er=S||0===r.numIconVertices;if(ei||er?er?ei||(O=O&&F):F=O&&F:O=F=O&&F,F&&W&&W.box&&this.collisionIndex.insertCollisionBox(W.box,l.get("text-ignore-placement"),s.bucketInstanceId,q&&q.box&&J?J:K,b.ID),O&&Y&&this.collisionIndex.insertCollisionBox(Y.box,l.get("icon-ignore-placement"),s.bucketInstanceId,Q,b.ID),X&&(F&&this.collisionIndex.insertCollisionCircles(X.circles,l.get("text-ignore-placement"),s.bucketInstanceId,K,b.ID),n)){let i=s.bucketInstanceId,r=this.collisionCircleArrays[i];void 0===r&&(r=this.collisionCircleArrays[i]=new aF);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 ea="globe"!==s.projection.name;N=N&&(ea||!G),V=V&&(ea||!Z),this.placements[y]=new az(F||N,O||V,j||s.justReloaded),a.add(y)},G=this.retainedQueryData[s.bucketInstanceId].tileID;if("offset"===s.elevationType&&this.buildingIndex&&this.buildingIndex.updateZOffset(s,G),"road"===s.elevationType&&s.hdExt&&s.hdExt.updateRoadElevation(s,G.canonical),s.updateZOffset(),s.sortFeaturesByY){let r=s.getSortedSymbolIndexe
110s(this.transform.angle);for(let i=r.length-1;i>=0;--i){let a=r[i];j(s.symbolInstances.get(a),a,s.collisionArrays[a])}s.hasAnyZOffset&&i.w(`${s.layerIds[0]} layer symbol-z-elevate: symbols are not sorted by elevation if symbol-z-order is evaluated to viewport-y`)}else if(s.hasAnyZOffset){let i=s.getSortedIndexesByZOffset();for(let r=0;r<i.length;++r){let a=i[r];j(s.symbolInstances.get(a),a,s.collisionArrays[a])}}else for(let i=r.symbolInstanceStart;i<r.symbolInstanceEnd;i++)j(s.symbolInstances.get(i),i,s.collisionArrays[i]);if(n&&s.bucketInstanceId in this.collisionCircleArrays){let r=this.collisionCircleArrays[s.bucketInstanceId];i.aP(r.invProjMatrix,u),r.viewportMatrix=this.collisionIndex.getViewportMatrix()}s.justReloaded=!1}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=ak(i,s,l,I,h),M=this.collisionIndex.placeCollisionBox(y,h,r,a,n,o,aN(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,aN(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},aV(y,i,_,x),y.allowVerticalPlacement&&(aU(y,x,_),this.placedOrientations[E]=x),{shift:A,placedGlyphBoxes:M}}}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 aL(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 aL(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 aL(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(r,a,n,o,s=!1,l=1){o&&(this.lastReplacementSourceUpdateTime=o.updateTime);let h=new Set;for(let u of a){let a=u.getBucket(r);if(a&&u.latestFeatureIndex&&r.fqid===a.layerIds[0]&&(this.updateBucketOpacities(a,h,u,u.collisionBoxArray,n,o,u.tileID,r.scope),"offset"===a.elevationType&&this.buildingIndex&&this.buildingIndex.updateZOffset(a,u.tileID),"road"===a.elevationType&&a.hdExt&&a.hdExt.updateRoadElevation(a,u.tileID.canonical),a.updateZOffset(),s&&u.collisionBoxArray)){let r=a.layers[0].layout,[n,o]=r.get("text-size-scale-range"),[s,h]=r.get("icon-size-scale-range"),c=i.b1(l,n,o),d=i.b1(l,s,h);a.updateCollisionDebugBuffers(this.transform.zoom,u.collisionBoxArray,c,d)}}}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 aL(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 aL(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.clearClippedSymbol
110sForBucket(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 R=v.evaluate(C,{}),D=a.has(_),L=this.opacities[_];D?L=f:L||(L=T,this.opacities[_]=L),a.add(_);let z=d>0||m>0,F=I>0,O=this.placedOrientations[_],B=O===i.dt.vertical,k=O===i.dt.horizontal||O===i.dt.horizontalOnly;!z&&!F||L.isHidden()||E++;let N=!1;if((z||F)&&l)for(let a of r.activeReplacements){if(i.dm(a,s,i.dn.Symbol,u)||a.min.x>A||A>a.max.x||a.min.y>M||M>a.max.y)continue;let r=i.dp(A,M,h.canonical,a.footprintTileId.canonical);if(N=i.dq(r,a.footprint))break}if(N&&this.collisionIndex.markSymbolAsClipped(r.bucketInstanceId,c.featureIndex),z){let i=N?a$:aZ(L.text);S(r.text,d,B?a$:i),S(r.text,m,k?a$:i);let a=L.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&&aV(r,p.anchor,c,O);let f=this.placedOrientations[_];f&&(aV(r,"left",c,f),aU(r,f,c))}if(F){let i=N?a$:aZ(L.icon),{placedIconSymbolIndex:a,verticalPlacedIconSymbolIndex:n}=c,o=r.icon.placedSymbolArray,s=+!!L.icon.isHidden();a>=0&&(S(r.icon,I,B?a$:i),o.get(a).hidden=s),n>=0&&(S(r.icon,c.numVerticalIconVertices,k?a$: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=ak(i.anchor,i.width,i.height,i.textOffset,i.textScale),y&&n._rotate(x?this.transform.angle:-this.transform.angle)):o=!1}p&&(o=!L.clipped),a.textBox&&aG(r.textCollisionBox.collisionVertexArray,L.text.placed,!o||B,R,b,n.x,n.y),a.verticalTextBox&&aG(r.textCollisionBox.collisionVertexArray,L.text.placed,!o||k,R,b,n.x,n.y)}let s=o&&!!(!k&&a.verticalIconBox);a.iconBox&&aG(r.iconCollisionBox.collisionVertexArray,L.icon.placed,s,R,b,c.hasIconTextFit?n.x:0,c.hasIconTextFit?n.y:0),a.verticalIconBox&&aG(r.iconCollisionBox.collisionVertexArray,L.icon.placed,!s,R,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 aG(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 aZ(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);
110return 0x2000000*a+0x1000000*r+131072*a+65536*r+512*a+256*r+2*a+r}let a$=0;class aH{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;)if(r.placeLayerBucketPart(l[this._currentPartIndex],this._seenCrossTileIDs,a,s),this._currentPartIndex++,o())return!0;return!1}}class aq{constructor(){this._retiredCI=null}startNewPlacement(i,r,a,n,o,s,l,h){return this.placement=new aj(i,n,o,s,l,h,this._retiredCI),this._retiredCI=null,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.e.now(),h=()=>!this.isFullPlacementRequested()&&0!==this._fadeDuration&&i.e.now()-l>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 aH(l),m=i.m(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._retiredCI=this.placement.prevPlacement?this.placement.prevPlacement.collisionIndex:null,this.placement.commit(i),this.placement}}let aW=512/i.a6/2;class aX{constructor(r,a,n){this.tileID=r,this.bucketInstanceId=n,this.index=new i.dx(a.length,16,Int32Array),this.keys=[],this.crossTileIDs=[];let o=r.canonical.x*i.a6,s=r.canonical.y*i.a6;for(let i=0;i<a.length;i++){let{key:r,crossTileID:n,tileAnchorX:l,tileAnchorY:h}=a.get(i),u=Math.floor((o+l)*aW),c=Math.floor((s+h)*aW);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=aW/Math.pow(2,a.canonical.z-this.tileID.canonical.z),l=a.canonical.x*i.a6,h=a.canonical.y*i.a6;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 aY{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class aK{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)>
110i.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 aX(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 aJ{constructor(){this.layerIndexes={},this.crossTileIDs=new aY,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 aK);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]}}function aQ(i,r){let a=(r.right-r.left)/2,n=Math.abs(i.x-(r.left+a));if(n>=i.radius+a)return!1;let o=(r.bottom-r.top)/2,s=Math.abs(i.y-(r.top+o));if(s>=i.radius+o)return!1;if(n<a||s<o)return!0;let l=n-a,h=s-o;return l*l+h*h<i.radius*i.radius}function a0(i,r){return"box"===i.kind&&"box"===r.kind?i.left<r.right&&r.left<i.right&&i.top<r.bottom&&r.top<i.bottom:"circle"===i.kind&&"circle"===r.kind?function(i,r){let a=i.x-r.x,n=i.y-r.y,o=i.radius+r.radius;return a*a+n*n<o*o}(i,r):"circle"===i.kind?aQ(i,r):aQ(r,i)}class a1{constructor(r,a,n,o){this._cellSize=o,this._padding=n,this._screenWidth=r,this._screenHeight=a,this._grid=new i.d2(r+2*n,a+2*n,o),this._workingArea=this._computeWorkingArea(),this._geometries=[],this._geometryData=[]}clearAndResize(r,a){r===this._screenWidth&&a===this._screenHeight?this._grid.clear():(this._screenWidth=r,this._screenHeight=a,this._grid=new i.d2(r+2*this._padding,a+2*this._padding,this._cellSize),this._workingArea=this._computeWorkingArea()),this._geometries.length=0,this._geometryData.length=0}_computeWorkingArea(){return{kind:"box",left:-this._padding,top:-this._padding,right:this._grid.xCellCount*this._cellSize-this._padding,bottom:this._grid.yCellCount*this._cellSize-this._padding}}intersects(i,r,a){let n="outside-of-grid";for(let o of i){let i=this._elementIntersects(o,r,a);if("intersects"===i)return"intersects";"does-not-intersect"===i&&(n="does-not-intersect")}return n}_elementIntersects(i,r,a){if(!a0(i,this._workingArea))return"outside-of-grid";let n=this._padding,o=0===r?i:"box"===i.kind?{kind:"box",left:i.left-r,top:i.top-r,right:i.right+r,bottom:i.bottom+r}:{kind:"circle",x:i.x,y:i.y,radius:i.radius+r},s=i=>{if(!a0(this._geometries[i],o))return!1;let r=this._geometryData[i];return void 0===r||!a(r)};return("box"===o.kind?this._grid.hitTest(o.left+n,o.top+n,o.right+n,o.bottom+n,s):this._grid.hitTestCircle(o.x+n,o.y+n,o.radius,s))?"intersects":"does-not-intersect"}insert(i,r){let a=this._padding,n=!1;for(let o of i){if(!a0(o,this._workingArea))continue;let i=this._geometries.length;this._geometries.push(o),this._geometryData.push(r),"box"===o.kind?this._grid.insert(i,o.left+a,o.top+a,o.right+a,o.bottom+a):this._grid.insertCircle(i,o.x+a,o.y+a,o.radius),n=!0}return n}}function a2(i){return 2*i.styleLayerId+i.symbolIdOrigin}function a3(i,r){let a=i.get(a2(r.symbolId));if(!a)return!1;let n=a.get(r.symbolId.symbolId);return void 0!==n&&n.has(r.variantIdx)}function a5(i,r){let a=a2(r.symbolId),n=i.get(a);n||(n=new Map,i.set(a,n));let o=n.get(r.symbolId.symbolId);o||(o=new Set,n.set(r.symbolId.symbolId,o)),o.add(r.variantIdx)}class a4{constructor(){this._runStarted=!1,this._grid=null,this._timestamp=0,this._symbols=[],this._ignoredSymbolVariantIds=new Map,this._onlyIfPlacedReferencedIds=new Map,this._placedVariantIds=new Map,this._placedSymbolIds=new Map,this._processingSource=null,this._variantProcessingStarted=!1}startPlacement(i,r,a){if(this._runStarted)throw Error("Attempt to start a placement run before finishing the previous one");this._runStarted=!0,this._grid?this._grid.clearAndResize(r,a):this._grid=new a1(r,a,100,32),this._timestamp=i,this._symbols=[],this._ignoredSymbolVariantIds.clear(),this._onlyIfPlacedReferencedIds.clear(),this._placedVariantIds.clear(),this._placedSymbolIds.clear()}_hasPlacedSymbol(i){let r=this._placedSymbolIds.get(a2(i));return void 0!==r&&r.has(i.symbolId)}_addPlacedSymbol(i){let r=a2(i),a=this._placedSymbolIds.get(r);a||(a=new Set,this._placedSymbolIds.set(r,a)),a.add(i.symbolId)}startSymbolSourceProcessing(i){if(!this._runStarted)throw Error("Attempt to start symbol source processing outside of a placement run");if(this._processingSource)throw Error("Attempt to start a placement symbol source processing before finishing the previous one");this._processingSource=i}startSymbolVariantProcessing(i,r,a){let n=this._processingSource;if(!n)throw Error("Attempt to start a symbol variant processing outside of symbol source processing");if(this._variantProcessingStarted)throw Error("Attempt to begin a symbol variant processing before finishing the previous one");this._symbols.push({priority:r,source:n,variantId:i,geometry:[],placementRules:a});let o=a.collisionRules;o&&(o.symbolVariantToIgnoreCollisionWith&&a5(this._ignoredSymbolVariantIds,o.symbolVariantToIgnoreCollisionWith),o.onlyIfPlaced&&a5(this._onlyIfPlacedReferencedIds,o.onlyIfPlaced)),this._variantProcessingStarted=!0}addGeometry(i){if(!this._variantProcessingStarted)throw Error("Attempt to add geometry outside of symbol variant processing");this._symbols.at(-1).geometry.push(i)}finishVariantProcessing(){if(!this._variantProcessingStarted)throw Error("Attempt to finish a symbol variant processing that was not started");this._variantProcessingStarted=!1;let r=this._symbols.at(-1);0===r.geometry.length&&(r.priority.symbolVariantVisibility===i.dy.VARIANT_VISIBLE&&r.source.hideSymbolVariant(r.variantId,this._timestamp),this._symbols.pop())}finishSourceProcessing(){this._processingSource=null}finishPlacementRun(){if(!this._runStarted)throw Error("Attempt to finish a placement run that was not started");this._runStarted=!1;let r=this._grid,a=this._timestamp;for(let n of(this._symbols.sort((i,r)=>{var a,n;return a=r.priority,n=i.priority,a.placementSubgroupOrder-n.placementSubgroupOrder||a.symbolPlacementPriority-n.symbolPlacementPriority||a.symbolVariantVisibility-n.symbolVariantVisibility||a.symbolPlacementType-n.symbolPlacementType||a.styleLayerOrder-n.styleLayerOrder||a.symbolDisplayOrder-n.symbolDisplayOrder}),this._symbols)){let o=n.priority.symbolVariantVisibility===i.dy.VARIANT_VISIBLE,s=!0;if(this._hasPlacedSymbol(n.variantId.symbolId))s=!1;else if(n.placementRules.collisionRules){let i=n.placementRules.collisionRules.onlyIfPlaced;if(i&&!a3(this._placedVariantIds,i))s=!1;else{let i=n.placementRules.collisionRules.symbolVariantToIgnoreCollisionWith;"does-not-intersect"!==r.intersects(n.geometry,+!o,r=>{var a,n;return void 0!==i&&(a=r).variantIdx===(n=i).variantIdx&&a.symbolId.styleLayerId===n.symbolId.styleLayerId&&a.symbolId.symbolIdOrigin===n.symbolId.symbolIdOrigin&&a.symbolId.symbolId===n.symbolId.symbolId})&&(s=!1)}}if(s&&n.placementRules.insertIntoCollisionGrid){let i=a3(this._ignoredSymbolVariantIds,n.variantId)?n.variantId:void 0;r.insert(n.geometry,i)||(s=!1)}s&&(this._addPlacedSymbol(n.variantId.symbolId),a3(this._onlyIfPlacedReferencedIds,n.variantId)&&a5(this._placedVariantIds,n.variantId)),o!==s&&(s?n.source.showSymbolVariant(n.variantId,a):n.source.hideSymbolVariant(n.variantId,a))}}}class a6{constructor(){this._nextIdByLayer=new Map}allocateRange(i,r){let a=this._nextIdByLayer.get(i)||0;return this._nextIdByLayer.set(i,a+r),a}releaseLayer(i){this._nextIdByLayer.delete(i)}}class a8 extends i.E{constructor(i){super(),this.requestManager=i,this.models=Object.create(null),this.models[""]=Object.create(null),this.modelUris=Object.create(null),this.modelUris[""]=Object.create(null),this.modelByURL=Object.create(null),this.numModelsLoading=Object.create(null)}async loadModel(r,a){try{let n=await this.requestManager.transformRequest(a,i.R.Model);return this.modelByURL[a]?(await tM(),tA.loadModel?await tA.loadModel(n.url,r,a):null):null}catch(n){if(404===n.status)return null;this.fire(new i.f(Error(`Could not load model ${r} from ${a}`,{cause:n})))}}load(r,a,n={forceReload:!1}){this.models[a]||(this.models[a]=Object.create(null));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.h("data",{dataType:"style"}))}).catch(r=>{this.fire(new i.f(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]=Object.create(null)),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]||Object.create(null)}addModel(i,r,a){this.models[a]||(this.models[a]=Object.create(null)),this.modelUris[a]||(this.modelUris[a]=Object.create(null));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)}
110addModelURLs(i,r){this.models[r]||(this.models[r]=Object.create(null)),this.modelUris[r]||(this.modelUris[r]=Object.create(null));let a=this.modelUris[r];for(let r of Object.keys(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]=Object.create(null)),this.modelUris[r]||(this.modelUris[r]=Object.create(null));let a=Object.create(null);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)&&e_(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=Object.create(null),this.models[""]=Object.create(null),this.modelUris=Object.create(null),this.modelUris[""]=Object.create(null),this.modelByURL=Object.create(null),this.numModelsLoading=Object.create(null)}listModels(i){return this.models[i]||(this.models[i]=Object.create(null)),Object.keys(this.models[i])}upload(i,r){for(let a in this.models[r]||(this.models[r]=Object.create(null)),this.models[r])this.models[r][a].model&&this.models[r][a].model.upload(i.context)}}let a9=["RENDER_SHADOWS","NORMAL_OFFSET"],a7=new Set(["symbol","circle"]),ne=class r{constructor(){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.fog,o=a.hasTerrain(),s=!(!a.projection||"globe"!==a.projection.name),l=o||s,h=!(!a.directionalLight||!a.directionalLight.shadowsEnabled()),u=a.map&&a.map.painter,c=!u||!u.context.extParallelShaderCompile,d=!!u&&("mrt-fallback"===u.emissiveMode||"mrt-full-rgba"===u.emissiveMode),p=(i,r=[],a={})=>{this._queue.push({programId:i,params:{...a.params,defines:r,overrideFog:!!a.fog,overrideTerrain:!!a.terrain,overrideGlobe:!!a.globe,overrideRtt:!!a.rtt,precompiled:!0}})};for(let f of i){if("none"===f.visibility)continue;let i=f.getProgramIds();if(i)for(let m of i){if(a7.has(m))continue;let i=f.getDefaultProgramParams(m,r.zoom,a._styleColorTheme.lut);if(!i)continue;let _=u?u.getShaderSource(m):null,g=l&&(!_||_.usedDefines.has("RENDER_TO_TEXTURE")),y=i.defines;if(d&&g&&(y=(y||[]).concat("USE_MRT1"),"mrt-full-rgba"===u.emissiveMode&&(y=(y||[]).concat("USE_MRT1_RGBA"))),c){p(m,i.defines,{params:i}),g&&p(m,y,{params:i,rtt:!0});continue}let x=n&&(!_||_.usedDefines.has("FOG")),v=o&&!f.isDraped()&&(!_||_.usedDefines.has("TERRAIN")),b=s&&(!_||_.usedDefines.has("GLOBE"));for(let r of h&&f.hasElevation()&&(!_||_.usedDefines.has("RENDER_SHADOWS"))?[!1,!0]:[!1]){let a=r?(i.defines||[]).concat(a9):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])p(m,a,{params:i,fog:o,terrain:r,globe:n})}g&&p(m,y,{params:i,rtt:!0})}}if(p("clippingMask"),o)for(let i of[!1,!0])p("terrainRaster",i?["TERRAIN_VERTEX_MORPHING"]:[],{terrain:!0,fog:n});if(!c){if(i.some(i=>"hillshade"===i.type)&&p("hillshadePrepare"),h)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"),p("groundShadow",a),n&&p("groundShadow",a,{fog:!0})}if(s){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"),p("globeRaster",a,{terrain:o,globe:!0,fog:n})}for(let i of[!1,!0]){let r=i?["PROJECTION_GLOBE_VIEW","FOG"]:["FOG"];p("globeAtmosphere",r,{fog:!0,terrain:o,globe:i}),p("globeAtmosphere",[...r,"ALPHA_PASS"],{fog:!0,terrain:o,globe:i})}p("stars",[],{fog:n,terrain:o,globe:!0})}}}_executeBatch(a,n,o){if(o.map&&o.map.isMoving())return void(this._idleHandle=i.e.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||i.programId in an&&(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.e.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.e.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}};ne.DEADLINE_MARGIN_KHR_MS=5,ne.DEADLINE_MARGIN_SYNC_MS=25;let nt=i.s.colorTheme,ni=new i.ag({data:new i.ah(nt.data)});function nr(r){if(r)return r.map(([r,a])=>[r*i.e.devicePixelRatio,a*i.e.devicePixelRatio])}class na{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("raster-array"!==n.type)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}}let nn=(i,r)=>e1(i,r&&r.filter(i=>"source.canvas"!==i.identifier)),no=new Set(["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"]),ns=new Set(["setCenter","setZoom","setBearing","setP
110itch"]),nl=new Set(["background","sky","slot","custom","placement-group"]),nh={version:8,layers:[],sources:{}},nu={duration:300,delay:0};class nc extends i.E{constructor(r,a={}){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={...nu},this._buildingIndex=new aA(this),this.crossTileSymbolIndex=new aJ,this.globalPlacement=null,this.symbolIdRangeAllocator=new a6,this._groupOrders=null,this._groupOrdersVersion=-1,this._mergedOrder=[],this._mergedOrderVersion=0,this._drapedFirstOrder=[],this._mergedLayers=Object.create(null),this._mergedIndoor={},this._indoorEnabled=!1,this._mergedSourceCaches={},this._mergedOtherSourceCaches=Object.create(null),this._mergedSymbolSourceCaches=Object.create(null),this._mergedFillExtrusionSourceCaches=Object.create(null),this._mergedHdRoadCoverageSourceCaches=Object.create(null),this._hdCoverage=null,this._hdElevation=null,this._crossSourceElevationActive=!1,this._clipLayerPresent=!1,this._hasAppearances=!1,this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this._importedAsBasemap=!1,this._changes=a.styleChanges||new A,this._hasDataDrivenEmissive=!1,this.indoorManager=null,this.dispatcher=a.dispatcher?a.dispatcher:new tv(aM(),this);let n={referrer:i.dA(),config:i.dT()};this.map.painter&&this.map.painter.context&&(n.contextOptions={maxBindingPoints:this.map.painter.context.maxUniformBufferBindings,maxUniformBlockSizeDwords:Math.floor(this.map.painter.context.maxUniformBlockSize/4)}),this.isRootStyle()&&this.dispatcher.broadcast("setGlobalParams",n),a.imageManager?this.imageManager=a.imageManager:(this.imageManager=new K(this.map._spriteFormat),this.imageManager.setEventedParent(this)),this.imageManager.addScope(this.scope),this.glyphManager=a.glyphManager?a.glyphManager:new i.dB(r._requestManager,a.localFontFamily?i.dC.all:a.localIdeographFontFamily?i.dC.ideographs:i.dC.none,a.localFontFamily||a.localIdeographFontFamily,a.fontstackCompositing),a.modelManager?this.modelManager=a.modelManager:(this.modelManager=new a8(r._requestManager),this.modelManager.setEventedParent(this)),this._layers=Object.create(null),this._sourceCaches={},this._otherSourceCaches=Object.create(null),this._symbolSourceCaches=Object.create(null),this._fillExtrusionSourceCaches=Object.create(null),this._hdCoverage=null,this._hdElevation=null,this._crossSourceElevationActive=!1,this._loaded=!1,this._drapingLoaded=void 0,this._initialBroadcastDone=!1,this._programPrecompiler=this.map._precompilePrograms&&this.isRootStyle()?new ne:null,this._availableImages=[],this._availableModels={},this._order=[],this._markersNeedUpdate=!1,this.options=a.configOptions?a.configOptions:new Map,this._layerExpressionDependencies=a.layerExpressionDependencies?a.layerExpressionDependencies:new Map,this._config=a.config,this._styleColorTheme={lut:null,lutLoading:!1,lutLoadingCorrelationID:0,colorTheme:null,colorThemeOverride:a.colorThemeOverride},this._styleColorThemeForScope={},this._initialConfig=a.initialConfig;let o=this;this._rtlTextPluginCallback=nc.registerForPluginStateChange(r=>{o.dispatcher.send("syncRTLPluginState",{pluginStatus:r.pluginStatus,pluginURL:r.pluginURL}).then(r=>{if(i.dD(null),r.every(i=>i))for(let i in o._sourceCaches){let r=o._sourceCaches[i],a=r.getSource().type;"vector"!==a&&"geojson"!==a||r.reload()}}).catch(r=>{i.dD(r)})}),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];a.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.cG(r))return r;let a=i.dE(r);if(!a.startsWith("http"))try{return new URL(a,location.href).toString()}catch(i){}return a}return`json://${i.dF(JSON.stringify(r))}`}_diffStyle(r,a,n){this.globalId=this._getGlobalId(r),e0();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=new AbortController;this._request={cancel:()=>s.abort()},(async()=>{let r=await this.map._requestManager.transformRequest(n,i.R.Style,s.signal),{data:l}=await i.g(r,s.signal);this._request=null,o(l,a)})().catch(r=>{this._request=null,s.signal.aborted||this.fire(new i.f(r))})}else"object"==typeof r&&o(r,a)}loadURL(r,a={}){this.fire(new i.h("dataloading",{dataType:"style"}));let n="boolean"==typeof a.validate?a.validate:!i.cG(r);n&&e0(),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 void this._load(o,n);let s=new AbortController;this._request={cancel:()=>s.abort()},(async()=>{let a=await this.map._requestManager.transformRequest(r,i.R.Style,s.signal),{data:o}=await i.g(a,s.signal);this._request=null,this.importsCache.set(r,o),this._load(o,n)})().catch(r=>{this._request=null,s.signal.aborted||this.fire(new i.f(r))})}loadJSON(r,a={}){this.fire(new i.h("dataloading",{dataType:"style"}));
110let n=!1!==a.validate;n&&e0(),this.globalId=this._getGlobalId(r),this._request=i.e.frame(()=>{this._request=null,this._load(r,n)})}loadEmpty(){this.fire(new i.h("dataloading",{dataType:"style"})),this._load(nh,!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.h("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.h("dataloading",{dataType:"style"})),r.globalId=r._getGlobalId(h),a&&e0(),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.m(r.id,this.scope):r.id,o=this._initialConfig&&this._initialConfig[n];(r.config||o)&&(a={...r.config,...o});let s=new nc(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"],layerExpressionDependencies:this._layerExpressionDependencies});return s.setEventedParent(this.map,{style:s}),s}_reloadImports(i=!1){this.mergeAll(),this._updateMapProjection(),i||this.updateConfigDependencies(),this._updateLayers(this._dependentLayerIds(i=>i.isIndoorDependent)),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)}async _load(r,a){if(this._isInternalStyle(r)){let i={...nh,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&&(await e0(),!this.dispatcher.actors.length||nn(this,e3(r))))return;for(let i in this._loaded=!0,r.sources)this.addSource(i,r.sources[i],{validate:!1,isInitialLoad:!0});this.stylesheet=i.dG(r);let n=()=>{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})),!this.glyphManager.url&&r.glyphs&&this.glyphManager.setURL(r.glyphs);let n=aC(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 ts(i.properties,i.id)}else this.setLights(this.stylesheet.lights);this.light||(this.light=new ts(this.stylesheet.light)),this._layers=Object.create(null);let o=!1;for(let r of n){let a=i.dM(r,this.scope,this._styleColorTheme.lut,this.options);this._layerExpressionDependencies.set(a.fqid,new M(a)),this._hasAppearances=this._hasAppearances||0!==a.getAppearances().length,a.setEventedParent(this,{layer:{id:a.id}}),this._layers[a.id]=a,this._updateHdCoverageSourceCache(a)&&(o=!0);let n=this.getOwnLayerSourceCache(a),s=!!this.directionalLight&&this.directionalLight.shadowsEnabled();n&&a.canCastShadows()&&s&&(n.castsShadows=!0)}if(o&&rr().then(()=>
110{if(!this.map)return;for(let i in this._layers)this._updateHdCoverageSourceCache(this._layers[i]);this.map.style.mergeAll();let i=this.map.transform;for(let r in this.map.style._mergedHdRoadCoverageSourceCaches){let a=this.map.style._mergedHdRoadCoverageSourceCaches[r];a.used=!0,i&&a.update(i)}this.map._update()}),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 s=this.stylesheet.terrain;s&&(this.checkCanvasFingerprintNoise(),this.disableElevatedTerrain||this.terrainSetForDrapingOnly()||(this._startLiteLoad(),this._createTerrain(s,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.h("data",{dataType:"style"}));let l=this.isRootStyle();r.imports?this._loadImports(r.imports,a).then(()=>{this._reloadImports(!0),this.fire(new i.h(l?"style.load":"style.import.load"))}).catch(r=>{this.fire(new i.f(Error("Failed to load imports",r))),this.fire(new i.h(l?"style.load":"style.import.load"))}):(this._reloadImports(!0),this.fire(new i.h(l?"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={...nu,...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=Object.create(null),n=Object.create(null),o=Object.create(null),s=Object.create(null);this.forEachFragmentStyle(l=>{for(let a in l._sourceCaches)r[i.m(a,l.scope)]=l._sourceCaches[a];for(let r in l._otherSourceCaches)a[i.m(r,l.scope)]=l._otherSourceCaches[r];for(let r in l._symbolSourceCaches)n[i.m(r,l.scope)]=l._symbolSourceCaches[r];for(let r in l._fillExtrusionSourceCaches)o[i.m(r,l.scope)]=l._fillExtrusionSourceCaches[r];if(l._hdCoverage){let r=l._hdCoverage.coverageSourceCaches;for(let a in r)s[i.m(a,l.scope)]=r[a]}}),this._mergedSourceCaches=r,this._mergedOtherSourceCaches=a,this._mergedSymbolSourceCaches=n,this._mergedFillExtrusionSourceCaches=o,this._mergedHdRoa
110dCoverageSourceCaches=s,Object.keys(s).length>0&&!this._hdCoverage&&iQ&&(this._hdCoverage=new iQ),i5&&i5(this)}mergeIndoor(){this._mergedIndoor={},this.forEachFragmentStyle(r=>{if(r.stylesheet&&r.stylesheet.indoor)for(let a of Object.values(r.stylesheet.indoor)){let n=i.m(a.sourceId,r.scope);this._mergedIndoor[n]=new Set(a.sourceLayers||[])}}),this._updateIndoorEnabled()}_updateIndoorEnabled(){let r=this._indoorEnabled;if(this._indoorEnabled=!1,Object.keys(this._mergedIndoor).length>0)for(let r of this._mergedOrder){let a=this._mergedLayers[r];if("none"!==a.visibility&&this._mergedIndoor[i.m(a.source,a.scope)]){this._indoorEnabled=!0;break}}!this._indoorEnabled||r||this.indoorManager||rr().then(()=>{this._initIndoorManager()})}_initIndoorManager(){if(!this.indoorManager&&iJ&&this.isRootStyle()&&0!==Object.keys(this._mergedIndoor).length&&(this.indoorManager=new iJ(this,this._loaded),this._loaded))for(let i of Object.keys(this._mergedIndoor)){let r=this._mergedSourceCaches[i]||this._mergedOtherSourceCaches[i];r&&r.reload()}}mergeLayers(){let r={},a=[],n=Object.create(null);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.dH(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.dH(l.id);r[a]&&s(r[a]),this._mergedSlots.push(a)}else{let r=i.m(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._mergedOrderVersion++,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={...this.stylesheet.camera,...i},this.camera=this.stylesheet.camera,this}_evaluateColorThemeData(r){return r.data?(function(r,a,n){let o={...a};for(let i of Object.keys(nt))void 0===o[i]&&(o[i]=nt[i].default);let s=new i.af(ni,r,new Map(n));return s.setTransitionOrValue(o,n),s.untransitioned().possiblyEvaluate(new i.aj(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=()=>{if(this._styleColorTheme.lutLoadingCorrelationID!==a)return void n();this._styleColorTheme.lutLoading=!1;let{width:s,height:l,data:c}=i.e.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.b({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.map.transform.projection.requiresDraping&&this._startLiteLoad(),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){let a=new AbortController;this._spriteRequest=a,function(r,a,n,o){let s,l,h,u=i.e.devicePixelRatio>1?"@2x":"";function c(r){h||r&&n.aborted||(r&&(h=r),function(){if(h)o(h);else if(s&&l){let r=i.e.getImageData(l),a={};for(let n in s){let{width:o,height:l,x:h,y:u,sdf:c,pixelRatio:d,stretchX:p,stretchY:f,content:m}=s[n],_=new i.b({width:o,height:l});i.b.copy(r,_,{x:h,y:u},{x:0,y:0},{width:o,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}}o(null,a)}}())}(async function(){let o=await a.transformRequest(a.normalizeSpriteURL(r,u,".json"),i.R.SpriteJSON,n),{data:l}=await i.g(o,n);h||(s=l)})().then(()=>c(void 0),i=>c(i)),(async function(){let o=await a.transformRequest(a.normalizeSpriteURL(r,u,".png"),i.R.SpriteImage,n),{data:s}=await i.a(o,n);h||(l=s)})().then(()=>c(void 0),i=>c(i))}(r,this.map._requestManager,a.signal,(r,a)=>{if(this._spriteRequest=null,r)this.dispatcher.broadcast("spriteLoaded",{scope:this.scope}),this.fire(new i.f(r));else if(a){let r=new Map;for(let n in a)r.set(i.I.from(n),a[n]);this.addImages(r,!0)}this.imageManager.setLoaded(!0,this.scope),this.fire(new i.h("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.f(Error(`Source "${a.source}" as specified by iconset "${r}" does not exist and cannot be used as an iconset source`)));
110if("raster-array"!==n.getSource().type)return void this.fire(new i.f(Error(`Source "${a.source}" as specified by iconset "${r}" is not a "raster-array" source and cannot be used as an iconset source`)));let o=new na(r,this.scope,n);this.imageManager.addImageProvider(o,this.scope)}removeIconset(i){this.imageManager.removeImageProvider(i,this.scope)}_loadIconset(r){if(!i.cG(r)&&"icon_set"!==this.map._spriteFormat||"raster"===this.map._spriteFormat)return void this._loadSprite(r);let a="auto"===this.map._spriteFormat,n=new AbortController;this._spriteRequest=n,async function(r,a,n,o){try{let s=await a.transformRequest(a.normalizeIconsetURL(r),i.R.Iconset,n),{data:l}=await i.d0(s,n),h={};for(let r of function(i){let r,a={icons:[]};for(;r=i.nextField(void 0);)1===r&&a.icons.push(function(i,r){let a,n={name:void 0};for(;a=i.nextField(r);)1===a?n.name=i.readString():2===a?n.metadata=function(i,r){let a,n={stretch_x:null,stretch_y:null,stretch_x_areas:null,stretch_y_areas:null,variables:[]};for(;a=i.nextField(r);)1===a?n.stretch_x=i.readPackedVarint():2===a?n.stretch_y=i.readPackedVarint():3===a?n.content_area=R(i,i.readVarint()+i.pos):4===a?n.variables.push(function(i,r){let a,n={name:void 0};for(;a=i.nextField(r);)1===a?n.name=i.readString():2===a&&(n.rgb_color=z(i.readVarint()),n.value="rgb_color");return n}(i,i.readVarint()+i.pos)):5===a&&(n.text_placeholder=R(i,i.readVarint()+i.pos));return n}(i,i.readVarint()+i.pos):3===a&&(n.usvg_tree=function(i,r){let a,n={width:20,children:[],linear_gradients:[],radial_gradients:[],clip_paths:[],masks:[],height:20};for(;a=i.nextField(r);)1===a?n.width=n.height=i.readVarint():2===a?n.height=i.readVarint():3===a?n.children.push(D(i,i.readVarint()+i.pos)):4===a?n.linear_gradients.push(function(i,r){let a,n={spread_method:1,stops:[],x1:0,y1:0,x2:1,y2:0};for(;a=i.nextField(r);)1===a?n.transform=L(i,i.readVarint()+i.pos):2===a?n.spread_method=i.readVarint():3===a?n.stops.push(F(i,i.readVarint()+i.pos)):4===a?n.x1=i.readFloat():5===a?n.y1=i.readFloat():6===a?n.x2=i.readFloat():7===a&&(n.y2=i.readFloat());return n}(i,i.readVarint()+i.pos)):5===a?n.radial_gradients.push(function(i,r){let a,n={spread_method:1,stops:[],cx:.5,cy:.5,r:.5,fx:.5,fy:.5,fr:0};for(;a=i.nextField(r);)1===a?n.transform=L(i,i.readVarint()+i.pos):2===a?n.spread_method=i.readVarint():3===a?n.stops.push(F(i,i.readVarint()+i.pos)):4===a?n.cx=i.readFloat():5===a?n.cy=i.readFloat():6===a?n.r=i.readFloat():7===a?n.fx=i.readFloat():8===a?n.fy=i.readFloat():9===a&&(n.fr=i.readFloat());return n}(i,i.readVarint()+i.pos)):7===a?n.clip_paths.push(function(i,r){let a,n={children:[]};for(;a=i.nextField(r);)1===a?n.transform=L(i,i.readVarint()+i.pos):2===a?n.clip_path_idx=i.readVarint():3===a&&n.children.push(D(i,i.readVarint()+i.pos));return n}(i,i.readVarint()+i.pos)):8===a&&n.masks.push(function(i,r){let a,n={left:0,width:20,mask_type:1,children:[]};for(;a=i.nextField(r);)1===a?n.left=n.top=i.readFloat():2===a?n.width=n.height=i.readFloat():3===a?n.top=i.readFloat():4===a?n.height=i.readFloat():5===a?n.mask_type=i.readVarint():6===a?n.mask_idx=i.readVarint():7===a&&n.children.push(D(i,i.readVarint()+i.pos));return n.height??=n.width,n.top??=n.left,n}(i,i.readVarint()+i.pos));return n}(i,i.readVarint()+i.pos),n.data="usvg_tree");if(n.usvg_tree.height||(n.usvg_tree.height=n.usvg_tree.width),!n.metadata)return n;let{metadata:o}=n;if(o.content_area){let{content_area:i}=o;i.left??=0,i.top??=i.left,i.width??=n.usvg_tree.width,i.height??=i.width}if(o.text_placeholder){let{text_placeholder:i}=o;i.top??=i.left,i.height??=i.width}return o.stretch_x&&o.stretch_x.length&&P(o,"x"),o.stretch_y&&o.stretch_y.length&&P(o,"y"),n}(i,i.readVarint()+i.pos));return a}(new i.c$(l)).icons){let a={version:1,pixelRatio:i.e.devicePixelRatio,content:function(r){if(!r.metadata||!r.metadata.content_area)return;let a=i.e.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?nr(r.metadata.stretch_x_areas):void 0,stretchY:r.metadata?nr(r.metadata.stretch_y_areas):void 0,sdf:!1,usvg:!0,icon:r};h[r.name]=a}o(null,h)}catch(i){n.aborted||o(i)}}(r,this.map._requestManager,n.signal,(n,o)=>
110{if(this._spriteRequest=null,n)a?this._loadSprite(r):(this.dispatcher.broadcast("spriteLoaded",{scope:this.scope}),this.fire(new i.f(n)));else if(o){let r=new Map;for(let a in o)r.set(i.I.from(a),o[a]);this.addImages(r,!0)}this.imageManager.setLoaded(!0,this.scope),this.fire(new i.h("data",{dataType:"style"}))})}_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.f(Error(`Source layer "${n}" does not exist on source "${a.id}" as specified by style layer "${r.id}"`)))}loaded(){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||!1===this._drapingLoaded)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.f(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.f(Error(`The source '${r}' does not exist in the map's style.`)))}_resolveLayerFragment(r){let a=this.getLayer(r);if(!a)return void this.fire(new i.f(Error(`The layer '${r}' does not exist in the map's style.`)));let n=this.getFragmentStyle(a.scope);return n?{layer:a,fragment:n}:void 0}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;let n=!1;a!==this._brightness&&(this._brightness=a,n=!0),r.worldview!==this._worldview&&(this._worldview=r.worldview,n=!0),n&&this.dispatcher.broadcast("upsertRenderParams",{brightness:this._brightness,worldview:this._worldview});let o=this._changes.isDirty(),s=!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),s=!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 l={};for(let i in this._mergedSourceCaches){let r=this._mergedSourceCaches[i];l[i]=r.used,r.used=!1,r.tileCoverLift=0}let h={};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)){n.mayUse("HD")&&(n.prepare(),rr()),n.mayUse("Standard")&&(n.prepare(),tM()),n.mayUse("Lite")&&(this.checkCanvasFingerprintNoise(),this.disableElevatedTerrain||this._startLiteLoad());let i=this.getLayerSourceCache(n);i&&(i.used=!0,i.tileCoverLift=Math.max(i.tileCoverLift,n.tileCoverLift()))}
110if(n.source){let r=i.m(n.source,n.scope),a=this._mergedHdRoadCoverageSourceCaches[r];a&&!a.used&&(a.used=!0)}if("fill-extrusion"===n.type){let r=i.m(n.source,n.scope);if(r in this._mergedFillExtrusionSourceCaches){let i=n.layout&&n.layout.get("source-max-zoom");if(null!=i){let a=h[r];h[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(h[i]??null);for(let i of(this.terrain&&s&&this.mergeLayers(),this.imageManager.getPendingImageProviders()))i.sourceCache.used=!0;for(let r in l){let a=this._mergedSourceCaches[r];l[r]!==a.used&&a.getSource().fire(new i.h("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._markersNeedUpdate&&(this._updateMarkersOpacity(),this._markersNeedUpdate=!1),this.imageManager.clearUpdatedImages(this.scope),o&&this.fire(new i.h("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(),nn(this,e3(r)))return!1;if((r=i.dG(r)).layers=aC(r.layers),!eQ.diffStyles)throw Error("Debug module not loaded; cannot diff style.");let n=eQ.diffStyles(this.serialize(),r).filter(i=>!ns.has(i.command));if(0===n.length)return!1;let o=n.filter(i=>!no.has(i.command));if(o.length>0)throw Error(`Unimplemented: ${o.map(i=>i.command).join(", ")}.`);let s=[];return 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(i=!1){this._availableImages=this.imageManager.listImages(this.scope);let r={scope:this.scope,images:this._availableImages};i&&(r.isSpriteLoaded=!0),this.dispatcher.broadcast("setImages",r)}_updateWorkerModels(){this._availableModels=this.modelManager.getModelURIs(this.scope),this.dispatcher.broadcast("setModels",{scope:this.scope,models:this._availableModels})}addImages(r,a){if(0===r.size)return a&&this.dispatcher.broadcast("spriteLoaded",{scope:this.scope}),this;for(let[a,n]of r.entries()){if(this.getImage(a))return this.fire(new i.f(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(a),this.fire(new i.h("data",{dataType:"style"})),this}addImage(r,a){return this.getImage(r)?this.fire(new i.f(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.h("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.h("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.h("data",{dataType:"style"})),this):this.fire(new i.f(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.h("data",{dataType:"style"})),this}addModel(r,a,n={}
110){return this._checkLoaded(),this._validate(tn,`models.${r}`,a,null,n)||(this.modelManager.addModel(r,a,this.getActualScope()),this.fire(new i.h("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.h("data",{dataType:"style"})),this):this.fire(new i.f(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(e5,`sources.${r}`,a,null,n))return;this.map&&this.map._collectResourceTiming&&(a.collectResourceTiming=!0);let o=Object.hasOwn(aw,a.type)&&!ag(a.type),s=o?new aT(r,a,this.dispatcher,this):a_(r,a,this.dispatcher,this);s.scope=this.scope;let l=i=>{i.setEventedParent(this,()=>({isSourceLoaded:this._isSourceCacheLoaded(i.id),source:i.serialize(),sourceId:i.id}))};l(s);let h=r=>{let a=(r===i.bS.Symbol?"symbol:":r===i.bS.FillExtrusion?"fill-extrusion:":"other:")+s.id,n=i.m(a,this.scope),o=this._sourceCaches[a]=new ig(n,s,r);r===i.bS.Symbol?this._symbolSourceCaches[s.id]=o:r===i.bS.FillExtrusion?this._fillExtrusionSourceCaches[s.id]=o:this._otherSourceCaches[s.id]=o,o.onAdd(this.map)};h(i.bS.Other),"vector"!==a.type&&"geojson"!==a.type||(h(i.bS.Symbol),"vector"===a.type&&h(i.bS.FillExtrusion)),s.onAdd&&s.onAdd(this.map),o&&(async function(i){if(ag(i))return;let r=aw[i];if(!r)throw Error(`Unknown source type "${i}"`);let a=await r();a&&!ag(i)&&(am[i]=a)})(a.type).then(()=>{let n=ag(a.type),o=this._otherSourceCaches[r];if(!o||o.getSource()!==s)return;if(!n)return void this.fire(new i.f(Error(`Could not load module for source type "${a.type}".`)));let h=a_(r,a,this.dispatcher,this);h.scope=this.scope,l(h),o.setSource(h),h.onAdd&&h.onAdd(this.map),this._changes.setDirty()}),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.f(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.f(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.f(Error(`Source "${r}" cannot be removed while iconset "${a[0]}" is using it.`)))}for(let a of this.getOwnSourceCaches(r)){let r=i.dH(a.id);delete this._sourceCaches[r],this._changes.discardSourceCacheUpdate(a.id),a.fire(new i.h("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._hdCoverage&&delete this._hdCoverage.coverageSourceCaches[r],this.mergeSources(),a.setEventedParent(null),a.onRemove&&a.onRemove(this.map),this.dispatcher.broadcast("removeSource",{type:a.type,source:r,scope:a.scope}),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();
110for(let i of r){if(this._validate(e6,"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 tb(i,tw(),this.scope,this.options);break;case"directional":if(this.directionalLight){let r=this.directionalLight;r.set(i),r.updateTransitions(a)}else this.directionalLight=new tb(i,tT(),this.scope,this.options)}}let n=Object.assign(a,{worldview:this.map.getWorldview()}),o=new i.aj(this.z||0,n);this.ambientLight&&this.ambientLight.recalculate(o),this.directionalLight&&this.directionalLight.recalculate(o),this._brightness=this.calculateLightsBrightness(),this.dispatcher.broadcast("upsertRenderParams",{brightness: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.b_(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.dI(r)){let a=i.dJ(r),n=this.fragments.find(({id:i})=>i===a);if(!n)return;let o=i.dH(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.c(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.f(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.m(a,n.scope),s=n.options.get(o),l=s?s.value||s.default:null;return l?l.serialize():null}isIndoorEnabled(){return this._indoorEnabled}getIndoorSourceLayers(r,a){let n=i.m(r,a);return this._mergedIndoor[n]}setIndoorData(i,r){this.indoorManager&&this.indoorManager.setIndoorData(r)}updateIndoorDependentLayers(){this._updateLayers(this._dependentLayerIds(i=>i.isIndoorDependent)),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.dK(n,l[a]);if("success"!==h.result)return void nn(this,h.value);let u=h.value.expression,c=i.m(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.dK(l[a].default,l[a]);"success"===y.result&&(o=y.value.expression),o?(this.options.set(c,{...d,value:u,default:o,minValue:p,maxValue:f,stepValue:m,type:_,values:g}),this.updateConfigDependencies(a)):this.fire(new i.f(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.m(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.dK(a[n].default,a[n]);if("success"===l.result&&(o=l.value.expression),r&&void 0!==r[n]){let o=i.dK(r[n],a[n]);"success"===o.result&&(s=o.value.expression)}let{minValue:h,maxValue:u,stepValue:c,type:d,values:p}=a[n];if(o){let r=i.m(n,this.scope);this.options.set(r,{default:o,value:s,minValue:h,maxValue:u,stepValue:c,type:d,values:p})}
110else this.fire(new i.f(Error(`No schema defined for config option "${n}".`)))}else this.fire(new i.f(Error("Attempting to set config for a style without schema.")))}_updateLayers(i){for(let r of i){let i=this.getLayer(r);i&&(i.possiblyEvaluateVisibility(),this._updateLayer(i),this._changes.setDirty())}}_dependentLayerIds(i){let r=[];for(let[a,n]of this._layerExpressionDependencies)i(n)&&r.push(a);return r}updateConfigDependencies(i){this._updateLayers(this._dependentLayerIds(r=>i?r.hasConfigDependency(i):r.isConfigDependent)),this.ambientLight&&this.ambientLight.updateConfig(this.options),this.directionalLight&&this.directionalLight.updateConfig(this.options),this.fog&&this.fog.updateConfig(this.options),this.snow&&this.snow.updateConfig(this.options),this.rain&&this.rain.updateConfig(this.options),this.forEachFragmentStyle(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._updateIndoorEnabled(),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.f(Error(`Layer with i
110d "${s}" already exists on this map`)));if("custom"===r.type){if(nn(this,i.dL(r)))return;o=i.dM(r,this.scope,this._styleColorTheme.lut,this.options)}else{if("object"==typeof r.source&&(this.addSource(s,r.source),r=Object.assign(r=i.dG(r),{source:s})),this._validate(tt,`layers.${s}`,r,{arrayIndex:-1},n))return;o=i.dM(r,this.scope,this._styleColorTheme.lut,this.options),this._validateLayer(o),o.setEventedParent(this,{layer:{id:s}})}this._layerExpressionDependencies.set(o.fqid,new M(o));let l=this._order.length;if(a){let r=this._order.indexOf(a);if(-1===r)return void this.fire(new i.f(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.`):l=r}this._order.splice(l,0,s),this._handleLayerOrderChange(),this._layers[s]=o;let h=this.getOwnLayerSourceCache(o),u=!!this.directionalLight&&this.directionalLight.shadowsEnabled();h&&o.canCastShadows()&&u&&(h.castsShadows=!0);let c=this._changes.getRemovedLayer(o);if(c&&o.source&&h&&"custom"!==o.type){this._changes.discardLayerRemoval(o);let r=i.m(o.source,o.scope);c.type!==o.type?this._changes.updateSourceCache(r,"clear"):(this._changes.updateSourceCache(r,"reload"),h.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);
110if(-1===r)return void this.fire(new i.f(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._layerExpressionDependencies.delete(r.fqid),this._changes.removeLayer(r),this.symbolIdRangeAllocator.releaseLayer(r.runtimeLayerUID);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.O(o.filter,a))return;let s=this._layerExpressionDependencies.get(o.fqid);if(null==a)return o.filter=void 0,s&&s.invalidateFilter(),void this._updateLayer(o);this._validate(ti,`layers.${o.id}.filter`,a,{layerType:o.type},n)||(o.filter=i.dG(a),s&&s.invalidateFilter(),this._updateLayer(o))}getFilter(r){let a=this._checkLayer(r);if(a)return i.dG(a.filter)}setLayoutProperty(r,a,n,o={}){this._checkLoaded();let s=this._checkLayer(r);if(s&&!i.O(s.getLayoutProperty(a),n)){if(null!=n&&(!o||!1!==o.validate)&&nn(s,ta.call(e3,{key:`layers.${r}.layout.${a}`,layerType:s.type,objectKey:a,value:n,styleSpec:i.s,style:{glyphs:!0,sprite:!0}})))return;s.setLayoutProperty(a,n),this._updateLayer(s)}}getLayerProperty(i,r){let a=this._checkLayer(i);if(a){switch(r){case"minzoom":return a.minzoom;case"maxzoom":return a.maxzoom;case"filter":return this.getFilter(i);case"slot":return a.slot;case"appearances":return a.getAppearances().map(i=>i.serialize())}return a.isPaintProperty(r)?this.getPaintProperty(i,r):this.getLayoutProperty(i,r)}}setLayerProperty(i,r,a,n={}){this._checkLoaded();let o=this._checkLayer(i);if(o){switch(r){case"appearances":return o.setAppearances(a),void this._updateLayer(o);case"minzoom":return this.setLayerZoomRange(i,a);case"maxzoom":return this.setLayerZoomRange(i,null,a);case"filter":return this.setFilter(i,a,n);case"slot":return this.setSlot(i,a)}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);s&&(i.O(s.getPaintProperty(a),n)||(null==n||o&&!1===o.validate||!nn(s,tr.call(e3,{key:`layers.${r}.paint.${a}`,layerType:s.type,objectKey:a,value:n,styleSpec:i.s})))&&(s.setPaintProperty(a,n)&&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 i=this._resolveLayerFragment(r.target.layerId);i?.fragment.setFeatureState({id:r.id,source:i.layer.source,sourceLayer:i.layer.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.f(Error("GeoJSON sources cannot have a sourceLayer parameter.")));if("vector"===l&&!o)return void this.fire(new i.f(Error("The sourceLayer parameter must be provided for vector source types.")));for(let s of(void 0===r.id&&this.fire(new i.f(Error("The feature id parameter must be provided."))),this.getOwnSourceCaches(n)))s.setFeatureState(
110o,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 i=this._resolveLayerFragment(r.target.layerId);i?.fragment.removeFeatureState({id:r.id,source:i.layer.source,sourceLayer:i.layer.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.f(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.f(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.O(a,n))return void this.fire(new i.f(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 i=this._resolveLayerFragment(r.target.layerId);a=i?.fragment.getFeatureState({id:r.id,source:i.layer.source,sourceLayer:i.layer.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.f(Error("The feature id parameter must be provided."))),this.getOwnSourceCaches(a)[0].getFeatureState(n,r.id);this.fire(new i.f(Error("The sourceLayer parameter must be provided for vector source types.")))}}resetFeatureStates(i){if(this._checkLoaded(),"featuresetId"in i){let{featuresetId:r,importId:a}=i,n=this.getFragmentStyle(a);if(n)for(let{source:i,sourceLayer:a}of n.getFeaturesetLayers(r))n.removeFeatureState({source:i,sourceLayer:a})}else{let r=this._resolveLayerFragment(i.layerId);r?.fragment.removeFeatureState({source:r.layer.source,sourceLayer:r.layer.sourceLayer})}}setTransition(i){return this.stylesheet.transition={...this.stylesheet.transition,...i},this.transition=this.stylesheet.transition,this}getTransition(){return{...this.stylesheet.transition}}setWorldview(i){i!==this._worldview&&(this._worldview=i,this.dispatcher.broadcast("upsertRenderParams",{worldview: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.dN({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.m(r.source,r.scope),o=this._changes.getUpdatedSourceCaches();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.f(Error('queryRasterValue support only "raster-array" sources.'))),Promise.resolve(null)):o.queryRasterArrayValue(a,n):(this.fire(new i.f(Error(`Source with i
110d "${r}" does not exist in the style.`))),Promise.resolve(null))}queryRenderedFeatures(r,a,n){let o;a&&!Array.isArray(a)&&a.filter&&(this._validate(ti,"queryRenderedFeatures.filter",a.filter,null,a),o=i.bw(a.filter));let s={},l=i=>{if(nl.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.f(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.f(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.dO(r.layer.id)===this.scope&&c.push(r);return c}queryRenderedFeatureset(r,a,n){let o;a&&!Array.isArray(a)&&a.filter&&(this._validate(ti,"queryRenderedFeatures.filter",a.filter,null,a),o=i.bw(a.filter));let s="mock",l=[];if(a&&a.target)l.push({...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])aE(a,r,c)||u.push(new i.dP(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({...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.f(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&&!nl.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||nl.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=as.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(aI);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.bS.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(aI),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;
110a&&this._validate(ti,"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}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.O(r[a],o[a])){s=!0;break}if(!s)return;let l=this._getTransitionParameters();this.light.setLight(r,a,n),this.light.updateTransitions(l)}hasTerrain(){return!!this.terrain&&1===this.terrain.drapeRenderMode}getTerrain(){return this.hasTerrain()?this.terrain.get():null}_startLiteLoad(){void 0===this._drapingLoaded&&(this._drapingLoaded=!1,(async function(){return Promise.resolve()})().then(()=>{this._drapingLoaded=!0,this.map._removed||0===this.dispatcher.actors.length||this.map.triggerRepaint()}))}setTerrainForDraping(){this._startLiteLoad(),this.setTerrain({source:"",exaggeration:0},0)}checkCanvasFingerprintNoise(){void 0===this.disableElevatedTerrain&&(this.disableElevatedTerrain=i.e.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._startLiteLoad(),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.dG(n),{source:r})}let r={...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(e8,"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.s.terrain))!Object.hasOwn(n,r)&&i.s.terrain[r].default&&(n[r]=i.s.terrain[r].default);for(let n in r)if(!i.O(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.h("data",{dataType:"style"}));break}}else{if(!n)return;this._createTerrain(n,a),this.fire(new i.h("data",{dataType:"style"}))}this.mergeTerrain(),this.updateDrapeFirstLayers(),this._markersNeedUpdate=!0}_createFog(i){let r=this.fog=new td(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 tm(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 t_(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.O(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.O(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);
110this._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.O(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.h("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.e.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(r,a){let n=this.terrain=new th(r,a,this.scope,this.options,this.map.getWorldview());1===a&&(this.stylesheet.terrain=r),this.mergeTerrain(),this.updateDrapeFirstLayers(),this._force3DLayerUpdate();let o=this._getTransitionParameters({duration:0});n.updateTransitions(o);let s=new i.aj(this.z||0,{...o,worldview:this.map.getWorldview()});n.recalculate(s)}_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={...this.serialize()};return nn(this,r.call(e3,{key:a,style:l,value:n,styleSpec:i.s,...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.abort(),this._spriteRequest=null),i.dQ.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&&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()}
110reloadSources(){for(let i of this.getSources())i.reload&&i.reload()}reloadModels(){this.modelManager.reloadModels(""),this.forEachFragmentStyle(i=>{i.modelManager.reloadModels(i.scope)})}updateSources(r){let a;this.directionalLight&&(a=i.dR(this.directionalLight));let n=new Set,o=new Set,s=new Set;for(let i in this._mergedLayers){let r=this._mergedLayers[i];"building"===r.type?n.add(r.source):"raster"===r.type&&r.paint&&"ground"===r.paint.get("raster-elevation-reference")&&s.add(r.source),r.hasElevation()&&!o.has(r.source)&&o.add(r.source)}for(let i in this.updateFrcCoverageFadeRange(),this._mergedSourceCaches){let l=this._mergedSourceCaches[i],h=o.has(l._source.id);l._isRasterElevatedOverTerrain=s.has(l._source.id),n.has(l._source.id)&&(l._source.reparseOverscaled=!1),l.update(r,void 0,void 0,a,h)}this.updateFrcCoverage(),this.updateElevationCoverage()}_reloadSources(){for(let i in this._sourceCaches){let r=this._sourceCaches[i];r.resume(),r.reload()}}updateFrcCoverageFadeRange(){this.map.painter&&i2&&i2(this,this.map.painter)}updateFrcCoverage(){this._hdCoverage&&i0&&i0(this,this._hdCoverage)}updateElevationCoverage(){this.isRootStyle()&&i3&&i3(this)}_handleLayerOrderChange(){this._requestFullLabelPlacement(),this.fire(new i.h("neworder"))}_requestFullLabelPlacement(){this.pauseablePlacement||(this.pauseablePlacement=new aq),this.pauseablePlacement.requestFullPlacement()}_setLabelPlacementStale(){this.placement&&this.placement.setStale()}_updatePlacement(r,a,n,o,s,l){this.pauseablePlacement||(this.pauseablePlacement=new aq);let h=!1,u=!1,c={},d={},p="global"===l,f=p?[]:this._mergedOrder;for(let a of(p&&this._driveGlobalPlacement(r,s),f)){let n=this._mergedLayers[a];if("symbol"!==n.type)continue;let o=i.m(n.source,n.scope),s=c[o];if(!s){let i=this.getLayerSourceCache(n);if(!i)continue;let r=i.getRenderableIds(!0).map(r=>i.getTileByID(r));d[o]=r.slice(),s=c[o]=r.sort((i,r)=>r.tileID.overscaledZ-i.tileID.overscaledZ||(i.tileID.isLessThan(r.tileID)?-1:1))}let l=this.crossTileSymbolIndex.addLayer(n,s,r.center.lng,r.projection);h=h||l}this.crossTileSymbolIndex.pruneUnusedLayers(f);let m=!!(this.placement&&!r.equals(this.placement.transform)),_=!!(this.placement&&(0!==this.placement.lastReplacementSourceUpdateTime&&!s||this.placement.lastReplacementSourceUpdateTime!==s.updateTime)),g=m||_||h,y=(g||this.pauseablePlacement.isStale())&&0===n,x=this.pauseablePlacement.isDone()&&!this.placement.stillRecent(i.e.now(),r.zoom)&&0!==n;if((this.pauseablePlacement.isFullPlacementRequested()||!this.pauseablePlacement.placement||y||x)&&(this.pauseablePlacement=this.pauseablePlacement.startNewPlacement(r,f,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()?g&&0!==n&&this.pauseablePlacement.setStale():(this.pauseablePlacement.continuePlacement(f,this._mergedLayers,c,d,this.map.painter.scaleFactor),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(i.e.now()),u=!0),h&&this.pauseablePlacement.setStale()),u||h){this._buildingIndex.onNewFrame(r.zoom);for(let r=0;r<f.length;r++){let n=this._mergedLayers[f[r]];if("symbol"!==n.type||"none"===n.visibility)continue;let o=this.isLayerClipped(n);this.placement.updateLayerOpacities(n,c[i.m(n.source,n.scope)],r,o?s:null,a,this.map.painter.scaleFactor)}}return!this.pauseablePlacement.isDone()||this.placement.isStale()||this.placement.hasTransitions(i.e.now())}_driveGlobalPlacement(r,a){if(0===r.width||0===r.height)return;this.globalPlacement||(this.globalPlacement=new a4);let n=this.globalPlacement;n.startPlacement(i.e.now(),r.width,r.height),this._buildingIndex.onNewFrame(r.zoom);let o=this.fog&&r.projection.supportsFog?this.fog.state:null;if(this._groupOrdersVersion!==this._mergedOrderVersion||!this._groupOrders){let r=new Map;for(let a=0;a<this._mergedOrder.length;a++){let n=this._mergedLayers[this._mergedOrder[a]];"placement-group"===n.type&&r.set(n.fqid,i.dS(a))}this._groupOrders=r,this._groupOrdersVersion=this._mergedOrderVersion}let s={globalPlacement:n,idRangeAllocator:this.symbolIdRangeAllocator,transform:r,buildingIndex:this._buildingIndex,fogState:o,groupOrders:this._groupOrders,replacementSource:a};for(let i=0;i<this._mergedOrder.length;i++){let r=this._mergedLayers[this._mergedOrder[i]];if("symbol"!==r.type)continue;let a=this.getLayerSourceCache(r);if(!a)continue;let n=a.getRenderableIds(!0).map(i=>a.getTileByID(i)),o=this.isLayerClipped(r);r.placeSymbols(s,n,i,a,o)}n.finishPlacementRun()}_releaseSymbolFadeTiles(){for(let i in this._sourceCaches)this._sourceCaches[i].releaseSymbolFadeTiles()}addImport(r,a){if(this._checkLoaded(),new Set(["__proto__","constructor","prototype"]).has(r.id))return void this.fire(new i.f(Error(`Import id can't be "${r.id}".`)));let n=this.stylesheet.imports=this.stylesheet.imports||[];if(-1!==n.findIndex(({id:i})=>
110i===r.id))return void this.fire(new i.f(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.f(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.O(a.config,n[o].config)||this.setImportConfig(r,a.config,a.data.schema),i.O(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})=>r!==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.f(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.m(r,a);return this._mergedOtherSourceCaches[n]}getLayerSourceCache(r){let a=i.m(r.source,r.scope);return"symbol"===r.type?this._mergedSymbolSourceCaches[a]:"fill-extrusion"===r.type?this._mergedFillExtrusionSourceCaches[a]||this._mergedOtherSourceCaches[a]:"fill"===r.type&&r.sourceLayer===i.bV&&this._mergedHdRoadCoverageSourceCaches[a]?this._mergedHdRoadCoverageSourceCaches[a]:this._mergedOtherSourceCaches[a]}getSourceCaches(i){return null==i?Object.values(this._mergedSourceCaches):[this._mergedOtherSourceCaches[i],this._mergedSymbolSourceCaches[i],this._mergedFillExtrusionSourceCaches[i],this._mergedHdRoadCoverageSourceCaches[i]].filter(Boolean)}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)}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){return[this._otherSourceCaches[i],this._symbolSourceCaches[i],this._fillExtrusionSourceCaches[i],this._hdCoverage&&this._hdCoverage.coverageSourceCaches[i]].filter(
110Boolean)}_updateHdCoverageSourceCache(r){return iQ&&i1?(this._hdCoverage||(this._hdCoverage=new iQ),i1(this,this._hdCoverage,r),!1):"fill"===r.type&&r.sourceLayer===i.bV}_isSourceCacheLoaded(r){let a=this.getOwnSourceCaches(r);return 0===a.length?(this.fire(new i.f(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;let 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)}async getImages(r,a){let n=new Promise((i,r)=>{this.imageManager.getImages(a.icons.concat(a.patterns),a.scope,(a,n)=>{a?r(a):i(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.m(a.source,a.scope);return l(this._mergedOtherSourceCaches[h]),l(this._mergedSymbolSourceCaches[h]),(a.icons.some(i=>i.iconsetId)||a.patterns.some(i=>i.iconsetId))&&this.fire(new i.h("data",{dataType:"style"})),n}async rasterizeImages(i,r){return new Promise((i,a)=>{this.imageManager.rasterizeImages(r,(r,n)=>{r?a(r):i(n)})})}async checkAtlasCache(i,r){let a=this.imageManager.imageAtlasCache.findCachedAtlas(r.descriptor);return a&&a.contentDescriptor?{iconPositions:a.iconPositions,patternPositions:a.patternPositions,sourceHash:a.contentDescriptor.hash}:null}async getGlyphs(i,r){return new Promise((i,a)=>{this.glyphManager.getGlyphs(r.stacks,(r,n)=>{r?a(r):i(n)})})}}nc.registerForPluginStateChange=i.dz;class nd{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)}}let np=["fill","fillOutline","fillPattern","line","linePattern","background","backgroundPattern","hillshade","raster"],nf=["stars","rainParticle","snowParticle","fillExtrusion","fillExtrusionGroundEffect","building","buildingBloom","elevatedStructures","model","symbol"];class nm{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(r,a,n,o,s,l,h=!1){let u=r.gl;this.program=u.createProgram(),this._context=r,this._fixedUniformsFn=s,this._pending=!0,this._precompiled=h,this.attributes={},this.configuration=o,this.name=a,this.fixedDefines=[...l],h?r._compileStats.precompiled++:r._compileStats.onDemand++;let c=`#version 300 es
111${(o?o.defines():[]).concat(l.map(i=>`#define ${i}`)).join("\n")}`,d=[c,i.dZ];
111for(let r of n.fragmentIncludes)d.push(i.bb[r]);d.push(n.fragmentSource);let p=d.join("\n"),f=[c,i.d_];for(let r of n.vertexIncludes)f.push(i.bb[r]);this.forceManualRenderingForInstanceIDShaders=r.forceManualRenderingForInstanceIDShaders&&n.vertexSource.includes("gl_InstanceID"),this.forceManualRenderingForInstanceIDShaders&&f.push("uniform int u_instanceID;"),f.push(n.vertexSource);let m=f.join("\n");this.forceManualRenderingForInstanceIDShaders&&(m=m.replaceAll("gl_InstanceID","u_instanceID"));let _=u.createShader(u.FRAGMENT_SHADER);if(u.isContextLost())return this.failedToCreate=!0,void(this._pending=!1);u.shaderSource(_,p),u.compileShader(_),u.attachShader(this.program,_);let g=u.createShader(u.VERTEX_SHADER);if(u.isContextLost())return this.failedToCreate=!0,void(this._pending=!1);u.shaderSource(g,m),u.compileShader(g),u.attachShader(this.program,g),u.linkProgram(this.program),this._fragmentShader=_,this._vertexShader=g,r.extParallelShaderCompile?r._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.e.now(),o=a.getProgramParameter(this.program,a.LINK_STATUS),s=i.e.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.aY(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.aY(r),u_dem_prev:new i.aY(r),u_dem_tl:new i.a2(r),u_dem_scale:new i.a3(r),u_dem_tl_prev:new i.a2(r),u_dem_scale_prev:new i.a3(r),u_dem_size:new i.a3(r),u_dem_lerp:new i.a3(r),u_exaggeration:new i.a3(r),u_depth:new i.aY(r),u_depth_size_inv:new i.a2(r),u_depth_range_unpack:new i.a2(r),u_occluder_half_size:new i.a3(r),u_occlusion_depth_offset:new i.a3(r),u_meter_to_dem:new i.a3(r),u_label_plane_matrix_inv:new i.a4(r)}),h.includes("GLOBE")&&(this.globeUniforms={u_tile_tl_up:new i.a5(r),u_tile_tr_up:new i.a5(r),u_tile_br_up:new i.a5(r),u_tile_bl_up:new i.a5(r),u_tile_up_scale:new i.a3(r)}),h.includes("FOG")&&(this.fogUniforms={u_fog_matrix:new i.a4(r),u_fog_range:new i.a2(r),u_fog_color:new i.aZ(r),u_fog_horizon_blend:new i.a3(r),u_fog_vertical_limit:new i.a2(r),u_fog_temporal_offset:new i.a3(r),u_frustum_tl:new i.a5(r),u_frustum_tr:new i.a5(r),u_frustum_br:new i.a5(r),u_frustum_bl:new i.a5(r),u_globe_pos:new i.a5(r),u_globe_radius:new i.a3(r),u_globe_transition:new i.a3(r),u_is_globe:new i.aY(r),u_viewport:new i.a2(r)}),h.includes("RENDER_CUTOFF")&&(this.cutoffUniforms=i.d$(r)),h.includes("LIGHTING_3D_MODE")&&(this.lightsUniforms={u_lighting_ambient_color:new i.a5(r),u_lighting_directional_dir:new i.a5(r),u_lighting_directional_color:new i.a5(r),u_ground_radiance:new i.a5(r)}),h.includes("RENDER_SHADOWS")&&(this.shadowUniforms=i.e0(r))}maybeFinalize(){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}_setUniformGroup(i,r,a){this._ensureReady();let n=this[r];if(!this.failedToCreate&&n)for(let r in i.program.set(this.program),a){let i=n[r];i&&i.set(this.program,r,a[r])}}setTerrainUniformValues(i,r){this._setUniformGroup(i,"terrainUniforms",r)}setGlobeUniformValues(i,r){this._setUniformGroup(i,"globeUniforms",r)}setFogUniformValues(i,r){this._setUniformGroup(i,"fogUniforms",r)}setCutoffUniformValues(i,r){this._setUniformGroup(i,"cutoffUniforms",r)}setLightsUniformValues(i,r){this._setUniformGroup(i,"lightsUniforms",r)}setShadowUniformValues(i,r){this._setUniformGroup(i,"shadowUniforms",r)}_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||!np.includes(this.name))||!(!p.layers3D||!nf.includes(this.name))))return;let m=f.gl,_=r.wireframeDebugCache.getLinesFromTrianglesBuffer(r.frameCounter,s,f);if(!_)return;
111let 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 i.a1([m.ONE,m.ONE_MINUS_SRC_ALPHA,m.ZERO,m.ONE],i.C.transparent,[!0,!0,!0,!1])),f.setDepthMode(new i.Z(a.func===m.LESS?m.LEQUAL:a.func,i.Z.ReadOnly,a.range)),f.setStencilMode(i._.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 nd)).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)}}}class n_{constructor(i,r,a,n){this.id=n_.uniqueIdxCounter,n_.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=n_.uniqueIdxCounter,n_.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)}}n_.uniqueIdxCounter=0;let ng={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class ny{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||n.normalized?i.vertexAttribPointer(o,n.components,i[ng[n.type]],!!n.normalized,this.itemSize,r):i.vertexAttribIPointer(o,n.components,i[ng[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 nx{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 rk(i,s,0)),n>1&&(this.colorAttachment1=new rk(i,s,1)),o&&(this.depthAttachmentType=
111o,this.depthAttachment="renderbuffer"===o?new rN(i,s):new rV(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 rk(i,this.framebuffer,0):1===r&&(this.colorAttachment1=new rk(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 nv{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 ro(this),this.clearDepth=new rs(this),this.clearStencil=new rl(this),this.colorMask=new rh(this),this.depthMask=new ru(this),this.stencilMask=new rc(this),this.stencilFunc=new rd(this),this.stencilOp=new rp(this),this.stencilTest=new rf(this),this.depthRange=new rm(this),this.depthTest=new r_(this),this.depthFunc=new rg(this),this.blend=new ry(this),this.blendFunc=new rx(this),this.blendColor=new rv(this),this.blendEquation=new rb(this),this.cullFace=new rw(this),this.cullFaceSide=new rT(this),this.frontFace=new rS(this),this.program=new rE(this),this.activeTexture=new rI(this),this.viewport=new rA(this),this.bindFramebuffer=new rM(this),this.bindRenderbuffer=new rC(this),this.bindTexture=new rP(this),this.bindVertexBuffer=new rR(this),this.bindElementBuffer=new rD(this),this.bindVertexArrayOES=new rL(this),this.pixelStoreUnpack=new rz(this),this.pixelStoreUnpackPremultiplyAlpha=new rF(this),this.pixelStoreUnpackFlipY=new rO(this),this.options=r?{...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.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 n_(this,i,r,a)}createVertexBuffer(i,r,a,n,o){return new ny(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 nx(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.O(r.blendFunction,i.a1.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)}}let nb=i.Y();function nw(r){let a=r._camera.getWorldToCamera(r.worldSize,1),n=i.X([],a,r.globeMatrix);i.aP(n,n);let o=[0,0,0],s=[0,1,0,0];return i.c6(s,s,n),o[0]=s[0],o[1]=s[1],o[2]=s[2],i.c9(o,o),o}function nT(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,R="map"===_,D="map"===g,L=void 0!==n.layout.get("symbol-sort-key").constantOr(1),z=!1,F=r.depthModeForSublayer(0,i.Z.ReadOnly),O=new i.Z(r.context.gl.LEQUAL,i.Z.ReadOnly,r.depthRangeFor3D),B=[i.a7(M.center.lng),i.a8(M.center.lat)],k=n.layout.get("text-variable-anchor"),N="globe"===M.projection.name,V=[],U=[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.S(M.zoom):0,_=i.e1(s,l.getProjection(),M),g=M.calculatePixelsToTileUnitsMatrix(o),j=k&&l.hasTextData(),G=l.hasIconTextFit()&&j&&l.hasIconData(),Z=l.getProjection().createInversionMatrix(M,s.canonical),$=(1<<o.tileID.canonical.z)*i.a6/r.transform.worldSize,H=a=>{let n=[0,0,0];if(a){let a=r.style.directionalLight,o=r.style.ambientLight;a&&o&&(n=i.aG(r.style,a,o))}return n},q=i=>{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.e7(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+i.ci.LUT),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&&R&&!!x&&x.enabled,I=H(E),P=p&&R&&!r.terrain?O:F,D=n.paint.get("icon-image-cross-fade");r.terrainRenderModeElevated()&&R&&h.push("PITCH_WITH_MAP_TERRAIN"),f&&(h.push("PROJECTION_GLOBE_VIEW"),c&&h.push("PROJECTED_POS_ON_VIEWPORT")),D>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"),E&&h.push("RENDER_SHADOWS","NORMAL_OFFSET"),p&&R&&!r.terrain&&l.icon.orientationVertexBuffer&&h.push("ELEVATED_ROADS"),q(h);let L=r.getOrCreateProgram("symbol",{defines:h}),z=o.imageAtlasTexture?o.imageAtlasTexture.size:[0,0],k=l.iconSizeData,V=i.dl(k,M.zoom),j=R||!M.isOrthographic,Y=i.e2(_,o.tileID.canonical,R,C,M,l.getProjection(),g),K=i.dk(_,o.tileID.canonical,R,C,M,l.getProjection(),g),J=l.icon.uboBinder&&l.icon.uboBinder.hasPerFeatureTranslate()?[0,0]:u,Q=r.translatePosMatrix(K,o,J,d,!0),ee=r.translatePosMatrix(_,o,J,d),et=c?nb:Y,ei=C&&!R&&!a,er=U;(N||M.mercatorFromTransition)&&!C&&(er=nw(M));let ea=f?er:U,en=n.getColorAdjustmentMatrix(v,b,w,T),eo=ai(k.kind,V,ei,R,r,ee,et,Q,S,!1,l.sdfIcons,z,[0,0],0,s,m,B,Z,ea,l.getProjection(),I,$,en,D,null),es=o.imageAtlasTexture?o.imageAtlasTexture:null,el=1!==n.layout.get("icon-size").constantOr(0)||l.iconsNeedLinear,eh=l.sdfIcons||r.options.rotating||r.options.zooming||el||j?A.LINEAR:A.NEAREST,eu=l.sdfIcons&&0!==n.paint.get("icon-halo-width").constantOr(1),ec=r.terrain&&R&&a?i.aP(i.Y(),Y):nb;if(a&&l.icon){let a=i.c2.getAtTileOffsetFunc(s,M.center.lat,M.worldSize,l.getProjection()),h=i.dj(_,o.tileID.canonical,R,C,M,l.getProjection(),g),u=n.layout.get("icon-size-scale-range"),c=i.b1(r.scaleFactor,u[0],u[1]);
111i.e6(l,_,r,!1,h,K,R,y,a,s,c)}return{program:L,buffers:l.icon,uniformValues:eo,atlasTexture:es,atlasTextureIcon:null,atlasInterpolation:eh,atlasInterpolationIcon:null,isSDF:l.sdfIcons,hasHalo:eu,depthMode:P,tile:o,renderWithShadows:E,labelPlaneMatrixInv:ec}},K=()=>{let a=P&&"point"!==n.layout.get("symbol-placement"),h=[],u=a||k||G,d="road"===l.elevationType,y=r.shadowRenderer,v=d&&D&&!!y&&y.enabled,b=H(v),w=d&&D&&!r.terrain?O:F;r.terrainRenderModeElevated()&&D&&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"),v&&h.push("RENDER_SHADOWS","NORMAL_OFFSET"),d&&D&&!r.terrain&&l.text.orientationVertexBuffer&&h.push("ELEVATED_ROADS"),W(h),q(h);let T=r.getOrCreateProgram("symbol",{defines:h}),E,I=[0,0],C=null,R=l.textSizeData;l.iconsInText&&(I=o.imageAtlasTexture?o.imageAtlasTexture.size:[0,0],C=o.imageAtlasTexture?o.imageAtlasTexture:null,E=D||!M.isOrthographic||r.options.rotating||r.options.zooming||"composite"===R.kind||"camera"===R.kind?A.LINEAR:A.NEAREST);let L=o.glyphAtlasTexture?o.glyphAtlasTexture.size:[0,0],z=n.layout.get("text-size-scale-range"),V=i.b1(r.scaleFactor,z[0],z[1]),j=i.dl(R,M.zoom,V),X=i.e2(_,o.tileID.canonical,D,P,M,l.getProjection(),g),Y=i.dk(_,o.tileID.canonical,D,P,M,l.getProjection(),g),K=l.text.uboBinder&&l.text.uboBinder.hasPerFeatureTranslate()?[0,0]:c,J=r.translatePosMatrix(Y,o,K,p,!0),Q=r.translatePosMatrix(_,o,K,p),ee=u?nb:X,et=P&&!D&&!a,ei=U;(N||M.mercatorFromTransition)&&!P&&(ei=nw(M));let er=ai(R.kind,j,et,D,r,Q,ee,J,S,!0,!0,L,I,0,s,m,B,Z,f?ei:U,l.getProjection(),b,$,null,null,V),ea=o.glyphAtlasTexture?o.glyphAtlasTexture:null,en=A.LINEAR,eo=0!==n.paint.get("text-halo-width").constantOr(1),es=r.terrain&&D&&a?i.aP(i.Y(),X):nb;if(a&&l.text){let a=i.c2.getAtTileOffsetFunc(s,M.center.lat,M.worldSize,l.getProjection()),n=i.dj(_,o.tileID.canonical,D,P,M,l.getProjection(),g);i.e6(l,_,r,!0,n,Y,D,x,a,s,V)}return{program:T,buffers:l.text,uniformValues:er,atlasTexture:ea,atlasTextureIcon:C,atlasInterpolation:en,atlasInterpolationIcon:E,isSDF:!0,hasHalo:eo,depthMode:w,tile:o,renderWithShadows:v,labelPlaneMatrixInv:es}},J=l.icon.segments.get().length,Q=l.text.segments.get().length,ee=J&&!h.onlyText?Y():null,et=Q&&!h.onlyIcons?K():null,ei=n.paint.get("icon-opacity").constantOr(1),er=n.paint.get("text-opacity").constantOr(1);if(L&&l.canOverlap){z=!0;let r=ei&&!h.onlyText?l.icon.segments.get():[],a=er&&!h.onlyIcons?l.text.segments.get():[];for(let a of r)V.push({segments:new i.ad([a]),sortKey:a.sortKey,state:ee});for(let r of a)V.push({segments:new i.ad([r]),sortKey:r.sortKey,state:et})}else h.onlyText||V.push({segments:ei?l.icon.segments:new i.ad([]),sortKey:0,state:ee}),h.onlyIcons||V.push({segments:er?l.text.segments:new i.ad([]),sortKey:0,state:et})}for(let i of(z&&V.sort((i,r)=>i.sortKey-r.sortKey),V)){let a=i.state;if(a)if(r.terrain?r.terrain.setupElevationDraw(a.tile,a.program,{useDepthForOcclusion:M.depthOcclusionForSymbolsAndCircles,labelPlaneMatrixInv: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,nS(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,nS(a.buffers,i.segments,n,r,a.program,a.depthMode,s,l,o,1)),o.u_is_halo=0}nS(a.buffers,i.segments,n,r,a.program,a.depthMode,s,l,a.uniformValues,1)}}}function nS(r,a,n,o,s,l,h,u,c,d){let p=o.context,f=p.gl,m=[r.dynamicLayoutVertexBuffer,r.opacityVertexBuffer,r.iconTransitioningVertexBuffer,r.globeExtVertexBuffer,r.zOffsetVertexBuffer,r.orientationVertexBuffer];r.featureIdBuffer&&m.push(r.featureIdBuffer);let _=r.uboBinder?null:r.programConfigurations.get(n.id);if(r.uboBinder){r.uboBinder.layer=n;let i=o.transform.zoom,a=o.style.getBrightness?o.style.getBrightness():null,s=r.uboBinder.getConstantUniformValues(i,a);c.u_spp_fill_np_color=s.fill_np_color,c.u_spp_halo_np_color=s.halo_np_color,c.u_spp_opacity=s.opacity,c.u_spp_halo_width=s.halo_width,c.u_spp_halo_blur=s.halo_blur,c.u_spp_emissive_strength=s.emissive_strength,c.u_spp_occlusion_opacity=s.occlusion_opacity,c.u_spp_z_offset=s.z_offset,c.u_spp_zoom_fraction=i-r.uboBinder._floorZoom;let l=n.paint.get(r.uboBinder.isText?"text-translate-anchor":"icon-translate-anchor"),h=r.uboBinder.hasPerFeatureTranslate()&&"map"===l?o.transform.angle:0;c.u_spp_translate_rotation=[Math.cos(h),Math.sin(h)]}let{batchIndices:g,batchSegments:y}=r.getBatchGrouping(a);for(let a of g){let g=y.get(a);r.uboBinder&&r.uboBinder.bind(p,s.program,a),s.draw(o,f.TRIANGLES,l,h,u,i.$.disabled,c,n.id,r.layoutVertexBuffer,r.indexBuffer,g,n.paint,o.transform.zoom,_,m,d)}}function nE(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.e.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"),R=M.constantOr(null),D=n.paint.get("line-opacity").constantOr(1),L=!C&&1!==D||r.depthOcclusion&&p>0&&p<1,z=n.paint.get("line-gradient"),F=0!==n.paint.get("line-border-width").constantOr(1)?n.paint.get("line-border-gradient"):null,O=C?"linePattern":"line",B=i.ea(n);if(b&&r.terrain&&r.terrain.clipOrMaskOverlapStencilType()&&(L=!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&&B.push("VARIABLE_LINE_WIDTH");let k=n.paint.get("line-emissive-strength");C||"constant"===k.value.kind||!1!==k.value.isLineProgressConstant||B.push("VARIABLE_LINE_EMISSIVE_STRENGTH"),r._debugParams.showElevationIdDebug&&B.push("DEBUG_ELEVATION_ID"),b&&("dual-source-blending"!==r.emissiveMode||c?r.isEmissiveMrtActive()&&(B.push("USE_MRT1"),"mrt-full-rgba"===r.emissiveMode&&B.push("USE_MRT1_RGBA")):B.push("DUAL_SOURCE_BLENDING"));let N={},V=[],U=(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();
111let T=[...s],E="road"===x.elevationType,M=r.shadowRenderer,B=E&&!!M&&M.enabled,k=[0,0,0];if(B){let a=r.style.directionalLight,n=r.style.ambientLight;a&&n&&(k=i.aG(r.style,a,n)),T.push("RENDER_SHADOWS","NORMAL_OFFSET")}let U=x.programConfigurations.get(n.id),j=!1;if(R&&_.imageAtlas){let r=i.aH.from(R),a=r.getPrimary().scaleSelf(w).toString(),n=_.imageAtlas.patternPositions.get(a),o=r.getSecondary(),s=o?_.imageAtlas.patternPositions.get(o.scaleSelf(w).toString()):null;j=!!n&&!!s,n&&U.setConstantPatternPositions(n,s)}P>0&&(j||U.getPatternTransitionVertexBuffer("line-pattern"))&&T.push("LINE_PATTERN_TRANSITION"),x.elevationGroundScaleVertexBuffer&&T.push("ELEVATION_GROUND_SCALE");let G=r.isTileAffectedByFog(f),Z=r.getOrCreateProgram(O,{config:U,defines:T,overrideFog:G});if(!C&&I&&A&&_.lineAtlas){let i=_.lineAtlas.getDash(I,A);i&&U.setConstantPatternPositions(i)}B&&M.setupShadows(_.tileID.toUnwrapped(),Z,"vector-tile");let[$,H]=n.paint.get("line-trim-offset");("round"===A||"square"===A)&&$!==H&&(0===$&&($-=1),1===H&&(H+=1));let q=b?f.projMatrix:null,W=m?1/x.tileToMeter/i.cd(_,1,r.transform.zoom):1,X=m?1/x.tileToMeter/i.cd(_,1,Math.floor(r.transform.zoom)):1,Y=S?n.paint._values["line-floorwidth"]:null,K=_.dashIdealZ;if(Y&&"constant"===Y.value.kind&&K!==_.tileID.overscaledZ){let i=x.zoom;i in N||(N[i]=Math.max(.01,n.widthExpression().evaluate({zoom:i}))),o=Y.value.value,Y.value.value=N[i]*Math.pow(2,K-i)}let J=C?i.eb(r,_,n,q,w,W,X,[$,H],k,P):i.ec(r,_,n,q,x.lineClipsArray.length,w,W,X,[$,H],k),Q=(o,s,l,h,u,c)=>{let d=o.texture;if(s!==o.version){let c=256;if(l){let n=a.getSource().maxzoom,o=f.canonical.z===n?Math.ceil(1<<r.transform.maxZoom-f.canonical.z):1;c=i.b1(i.ed(x.maxLineLength/i.a6*1024*o),256,g.maxTextureSize)}o.gradient=i.ee({expression:h,evaluationKey:"lineProgress",resolution:c,image:o.gradient||void 0,clips:x.lineClipsArray,lut:u?null:n.lut}),o.texture?o.texture.update(o.gradient):o.texture=new i.T(g,o.gradient,y.RGBA8),o.version=s,d=o.texture}g.activeTexture.set(c),d.bind(l?y.NEAREST:y.LINEAR,y.CLAMP_TO_EDGE)};z&&Q(x.gradients[n.id],n.gradientVersion,n.stepInterpolant,n.gradientExpression(),"none"===n.paint.get("line-gradient-use-theme").constantOr("default"),y.TEXTURE1),F&&Q(x.borderGradients[n.id],n.borderGradientVersion,n.borderStepInterpolant,n.borderGradientExpression(),"none"===n.paint.get("line-border-gradient-use-theme").constantOr("default"),y.TEXTURE2),S&&(g.activeTexture.set(y.TEXTURE0),_.lineAtlasTexture&&_.lineAtlasTexture.bind(y.LINEAR,y.REPEAT),U.updatePaintBuffers()),C&&(g.activeTexture.set(y.TEXTURE0),_.imageAtlasTexture&&_.imageAtlasTexture.bind(y.LINEAR,y.CLAMP_TO_EDGE),U.updatePaintBuffers()),c&&!E&&r.terrain.setupElevationDraw(_,Z),r.uploadCommonUniforms(g,Z,f.toUnwrapped());let ee=i7?i7(r,x,f,c,J,U,Z,l,v,V):null,et=(a,o,s)=>{o&&0!==o.get().length&&(null!=h&&(h.value=D*p),void 0!==s&&(J.u_opacity_multiplier=s),Z.draw(r,y.TRIANGLES,l,a,v,i.$.disabled,J,n.id,x.layoutVertexBuffer,x.indexBuffer,o,n.paint,r.transform.zoom,U,[x.layoutVertexBuffer2,x.patternVertexBuffer,x.zOffsetVertexBuffer,x.elevationIdColVertexBuffer,x.elevationGroundScaleVertexBuffer]),void 0!==s&&(J.u_opacity_multiplier=1),null!=h&&(h.value=D))},ei=i=>{ee&&ee.active&&re?re(x,ee,i,et):et(i,x.segments)};if(L&&!c){let a=r.stencilModeForClipping(f).ref;0===a&&b&&g.clear({stencil:0});let n={func:y.EQUAL,mask:255};J.u_alpha_discard_threshold=.8,ei(new i._(n,a,255,y.KEEP,y.KEEP,y.INVERT)),J.u_alpha_discard_threshold=0,ei(new i._(n,a,255,y.KEEP,y.KEEP,y.KEEP))}else J.u_alpha_discard_threshold=L&&c&&d?.8:0,ei(c?u:r.stencilModeForClipping(f));ee&&rt&&rt(r,x,f,ee,c,u,et),void 0!==o&&(Y.value.value=o)}},j=r.depthModeForSublayer(0,i.Z.ReadOnly),G=new i.Z(r.depthOcclusion?y.GREATER:y.LEQUAL,i.Z.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}.`):U(o,B,j,i._.disabled,!1,!0)}if(n.hasElevatedBuckets){"hd-road-markup"===f?_||(j=G,B.push("ELEVATED_ROADS")):(B.push("ELEVATED"),j=G,void 0!==x&&B.push(x<1?"CROSS_SLOPE_HORIZONTAL":"CROSS_SLOPE_VERTICAL"),"sea"===f&&B.push("ELEVATION_REFERENCE_SEA"));let a=L?r.stencilModeFor3D():i._.disabled;"hd-road-markup"!==f&&(r.forceTerrainMode=!0),U(o,B,j,a,!0,!0),L&&U(o,B,j,a,!0,!1),"hd-road-markup"!==f&&(r.forceTerrainMode=!1)}ri&&ri(r,n,V),L&&(r.resetStencilClippingMasks(),b&&g.clear({stencil:0})),0===p||r.depthOcclusion||b||r.layersWithOcclusionOpacity.push(r.currentLayer)}class nI{destroy(){this.fbo&&(this.fbo.destroy(),this.fbo=null),this.drapeFbo&&(this.drapeFbo.destroy(),this.drapeFbo=null)}}class nA{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 nM={additive:{clearColor:new i.C(0,0,0,0),colorMode:i.a1.additiveAlphaWeighted,compositeUniformValue:1},multiply:{clearColor:new i.C(1,1,1,1),colorMode:i.a1.multiply,compositeUniformValue:0}};function nC(i){return!(!i.extRenderToTextureHalfFloat&&!i.extColorBufferFloat)}function nP(r,a){return"additive"===r&&nC(a)?i.a1.additiveAlphaWeightedUnboundedAlpha:nM[r].colorMode}function nR(r,a,n){let o=r.context,s=o.gl,l=n.width,h=n.height,u=n.colorAttachment0.get();a.lineBlendDensityReadback||(a.lineBlendDensityReadback=new nA(s));let c=a.lineBlendDensityReadback,d=0,p=!0;for(;l>1||h>1;){let n=Math.max(1,Math.floor(l/2)),f=Math.max(1,Math.floor(h/2)),m=0===d?"fboA":"fboB";c[m]=nx.createWithTexture(o,c[m],n,f,!1);let _=c[m];o.bindFramebuffer.set(_.framebuffer),o.viewport.set([0,0,n,f]),o.activeTexture.set(s.TEXTURE0),s.bindTexture(s.TEXTURE_2D,u),r.getOrCreateProgram("lineBlendReduce").draw(r,s.TRIANGLES,i.Z.disabled,i._.disabled,i.a1.unblended,i.$.disabled,r8(0,[1/l,1/h],p),a.id,r.viewportBuffer,r.quadTriangleIndexBuffer,r.viewportSegments,a.paint,r.transform.zoom),l=n,h=f,u=_.colorAttachment0.get(),d=1-d,p=!1}
111let f=nC(o);c.sync&&(s.deleteSync(c.sync),c.sync=null),s.bindBuffer(s.PIXEL_PACK_BUFFER,c.pbo),s.bufferData(s.PIXEL_PACK_BUFFER,f?16:4,s.STREAM_READ),s.readPixels(0,0,1,1,s.RGBA,f?s.FLOAT:s.UNSIGNED_BYTE,0),s.bindBuffer(s.PIXEL_PACK_BUFFER,null),c.sync=s.fenceSync(s.SYNC_GPU_COMMANDS_COMPLETE,0),o.viewport.set([0,0,r.width,r.height])}function nD(i,r,a){if(!nC(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),nC(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||(nR(i,r,a),i.style.map.triggerRepaint())):(nR(i,r,a),i.style.map.triggerRepaint())}function nL(r,a,n,o,s,l){let h=r.context,u=h.gl,c="additive"===n?1:a.paint.get("line-opacity").constantOr(1),d="additive"===n?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,a):1;if(null===d)return;h.bindFramebuffer.set(s),l&&h.viewport.set([0,0,l[0],l[1]]),h.activeTexture.set(u.TEXTURE0),u.bindTexture(u.TEXTURE_2D,o.colorAttachment0.get());let p=nP(n,r.context);r.getOrCreateProgram("lineBlendComposite").draw(r,u.TRIANGLES,i.Z.disabled,i._.disabled,p,i.$.disabled,{u_image:0,u_opacity:c,u_blend_mode:nM[n].compositeUniformValue,u_max_density:d},a.id,r.viewportBuffer,r.quadTriangleIndexBuffer,r.viewportSegments,a.paint,r.transform.zoom)}function nz(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 i.Z(s.context.gl.LEQUAL,i.Z.ReadOnly,s.depthRangeFor3D),S=[0,0,0];if(w){let r=s.style.directionalLight,a=s.style.ambientLight;r&&a&&(S=i.aG(s.style,r,a))}let E=_&&_.constantOr(1),I=s.terrain&&s.terrain.renderingToTexture,A=(r,f)=>{let _,x,A,M,C;f?(_=E&&!h.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",A=m.LINES):(_=E?"fillPattern":"fill",A=m.TRIANGLES);let P=[];for(let R of u){let u=l.getTile(R);if(E&&!u.patternsLoaded())continue;let D=u.getBucket(h);if(!D)continue;let L=a?D.hdExt&&D.hdExt.elevationBufferData:D.bufferData;if(!L||L.isEmpty())continue;s.prepareDrawTile();let z=L.programConfigurations.get(h.id),F=s.isTileAffectedByFog(R),O=[],B=[];v&&(O.push("ELEVATED_ROADS"),B.push(L.elevatedLayoutVertexBuffer)),w&&O.push("RENDER_SHADOWS","NORMAL_OFFSET"),I&&n&&(O.push("USE_MRT1"),"mrt-full-rgba"===s.emissiveMode&&O.push("USE_MRT1_RGBA")),E&&(s.context.activeTexture.set(m.TEXTURE0),u.imageAtlasTexture&&u.imageAtlasTexture.bind(m.LINEAR,m.CLAMP_TO_EDGE),z.updatePaintBuffers());let k=!1;if(y&&u.imageAtlas){let r=u.imageAtlas,a=i.aH.from(y),n=a.getPrimary().scaleSelf(i.e.devicePixelRatio).toString(),o=a.getSecondary(),s=r.patternPositions.get(n),l=o?r.patternPositions.get(o.scaleSelf(i.e.devicePixelRatio).toString()):null;k=!!s&&!!l,s&&z.setConstantPatternPositions(s,l)}g>0&&(k||z.getPatternTransitionVertexBuffer("fill-pattern"))&&O.push("FILL_PATTERN_TRANSITION");let N=s.getOrCreateProgram(_,{config:z,overrideFog:F,defines:O}),V=s.translatePosMatrix(R.projMatrix,u,h.paint.get("fill-translate"),h.paint.get("fill-translate-anchor"));w&&b.setupShadows(u.tileID.toUnwrapped(),N,"vector-tile");let U=h.paint.get("fill-emissive-strength");if(f){M=L.lineIndexBuffer,C=L.lineSegments;let i=s.terrain&&s.terrain.renderingToTexture?s.terrain.drapeBufferSize:[m.drawingBufferWidth,m.drawingBufferHeight];x="fillOutlinePattern"===_&&E?r6(V,U,s,u,i,S,g):r4(V,U,i,S)}else M=L.indexBuffer,C=L.triangleSegments,x=E?r5(V,U,s,u,S,g):r3(V,U,S);s.uploadCommonUniforms(s.context,N,R.toUnwrapped());let j=r;if(("road"!==d||p)&&"offset"!==d||(j=T),!C||C.get&&0===C.get().length)continue;let G=o||s.stencilModeForClipping(R),Z="fallthrough";!f&&i8&&(Z=i8({painter:s,layer:h,bucket:D,coord:R,elevatedGeometry:a,program:N,programConfiguration:z,uniformValues:x,drawMode:A,depthMode:j,stencilMode:G,colorMode:c,bufferData:L,indexBuffer:M,segments:C,dynamicBuffers:B,polygonCoverageTiles:P})),"fallthrough"===Z&&N.draw(s,A,j,G,c,i.$.disabled,x,h.id,L.layoutVertexBuffer,M,C,h.paint,s.transform.zoom,z,B)}!f&&i9&&i9(s,h,P,A,c)};s.renderPass===f&&A(s.depthModeForSublayer(1,"opaque"===s.renderPass?i.Z.ReadWrite:i.Z.ReadOnly),!1),"none"===x&&"translucent"===s.renderPass&&h.paint.get("fill-antialias")&&A(s.depthModeForSublayer(2*!!h.getPaintProperty("fill-outline-color"),i.Z.ReadOnly),!0)}function nF(r){return[r[0]*i.eg,r[1]*i.eg,r[2]*i.eg,0]}function nO(r,a,n,o,s,l,h,u,c,d){let p,f,m,_,g,y,x,v,b=s.getSource(),w=o.globeSharedBuffers;if(!w||(n&&(p=s.getTile(n)),b instanceof af?(f=b.texture,m=i.c1(0,0,o.transform)):p&&n&&(f=p.texture,m=i.c1(n.canonical.z,n.canonical.x,o.transform)),!f||!m))return;a||(m=i.aO(i.Y(),m,[1,-1,1]));let T=o.context,S=T.gl,E="nearest"===l.paint.get("raster-resampling")?S.NEAREST:S.LINEAR,I=o.colorModeForDrapableLayerRenderPass(h),A=u.defines;A.push("GLOBE_POLES");let M=new i.Z(S.LEQUAL,i.Z.ReadWrite,o.depthRangeFor3D),C=o.transform.expandedFarZProjMatrix,P=Float32Array.from(i.b5(i.b6(new i.bW(0,0,0))));o.terrain&&o.terrain.prepareDrawTile(),T.activeTexture.set(S.TEXTURE0),f.bind(E,S.CLAMP_TO_EDGE),T.activeTexture.set(S.TEXTURE1),f.bind(E,S.CLAMP_TO_EDGE),"useMipmap"in f&&T.extTextureFilterAnisotropic&&o.transform.pitch>20&&S.texParameterf(S.TEXTURE_2D,T.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,T.extTextureFilterAnisotropicMax);let[R,D,L,z]=n?w.getPoleBuffers(n.canonical.z,!1):w.getPoleBuffers(0,!0);a?(_=R,o.renderDefaultNorthPole=0!==r):(_=D,o.renderDefaultSouthPole=0!==r);let F=nF(u.mix),O=(g=m,y=i.S(o.transform.zoom),x=u.offset,v=u.range,ae(o,C,P,g,new Float32Array(16),new Float32Array(9),[0,0],y,[0,0],[0,0,0,0],1,{opacity:1,mix:0},l,[0,0],r,2,F,x,v,1,0,h)),B=o.getOrCreateProgram("raster",{defines:A});o.uploadCommonUniforms(T,B,null),B.draw(o,S.TRIANGLES,M,d,I,c,O,l.id,_,L,z)}let nB=i.df(new Float32Array(16)),nk={"dual-source-blending":"dual-source-blending","mrt-fallback":"mrt","mrt-full-rgba":"mrt-rgba"},{members:nN}=i.a$([{name:"a_pos_3f",components:3,type:"Float32"}]);function nV(i,r,a,n){i.emplaceBack(r,a,n)}class nU{constructor(r){this.vertexArray=new i.eh,this.indices=new i.ae,nV(this.vertexArray,-1,-1,1),nV(this.vertexArray,1,-1,1),nV(this.vertexArray,-1,1,1),nV(this.vertexArray,1,1,1),nV(this.vertexArray,-1,-1,-1),nV(this.vertexArray,1,-1,-1),nV(this.vertexArray,-1,1,-1),nV(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,nN),this.indexBuffer=r.createIndexBuffer(this.indices),this.segment=i.ad.simpleSegment(0,0,36,12)}}function nj(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.ek(i.el(),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,i.Z.disabled,i._.disabled,i.a1.unblended,i.$.frontCW,_,"skyboxCapture",a.skyboxGeometry.vertexBuffer,a.skyboxGeometry.indexBuffer,a.skyboxGeometry.segment)}let nG=i.a$([{type:"Float32",name:"a_pos",components:3},{type:"Float32",name:"a_uv",components:2}]);
111class nZ{constructor(r){let a=new i.em;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.ae;n.emplaceBack(0,1,2),n.emplaceBack(2,3,0),this.vertexBuffer=r.createVertexBuffer(a,nG.members),this.indexBuffer=r.createIndexBuffer(n),this.segments=i.ad.simpleSegment(0,0,4,2)}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy()}}let n$=i.a$([{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 nH{constructor(){this.colorModeAlphaBlendedWriteRGB=new i.a1([i.en,i.eo,i.en,i.eo],i.C.transparent,[!0,!0,!0,!1]),this.colorModeWriteAlpha=new i.a1([i.en,i.ep,i.en,i.ep],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 nZ(a);let r=this.params,n=r.sizeRange,o=r.intensityRange,s=function(r){let a=i.bj(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.bi(Math.cos(o)*Math.cos(r),Math.cos(o)*Math.sin(r),Math.sin(o)))}return n}(r.starsCount),l=i.bj(300),h=new i.eq,u=new i.ae,c=0;for(let r=0;r<s.length;++r){let a=i.dV([],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,n$.members),this.starsIdx=a.createIndexBuffer(u),this.starsSegments=i.ad.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 i.Z(o.LEQUAL,i.Z.ReadOnly,[0,1]),h=i.S(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.er(a.properties.get("horizon-blend"),0,1,5e-4,.25),y=i.c0(r,n,s)&&5e-4===g?s.worldSize/(2*Math.PI*1.025)-1:s.globeRadius,x=r.frameCounter/1e3%1,v=i.es(s.globeCenterInViewSpace),b=Math.acos(Math.sqrt(Math.pow(v,2)-Math.pow(y,2))/v),w=a=>{let u,c,p,m,y,v="globe"===s.projection.name?["PROJECTION_GLOBE_VIEW","FOG"]:["FOG"];a&&v.push("ALPHA_PASS");let w=r.getOrCreateProgram("globeAtmosphere",{defines:v}),T=(u=s.frustumCorners.TL,c=s.frustumCorners.TR,p=s.frustumCorners.BR,m=s.frustumCorners.BL,y=s.frustumCorners.horizon,{u_frustum_tl:u,u_frustum_tr:c,u_frustum_br:p,u_frustum_bl:m,u_horizon:y,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,w);let S=this.atmosphereBuffer;S&&w.draw(r,o.TRIANGLES,l,i._.disabled,a?this.colorModeWriteAlpha:this.colorModeAlphaBlendedWriteRGB,i.$.backCW,T,a?"atmosphere_glow_alpha":"atmosphere_glow",S.vertexBuffer,S.indexBuffer,S.segments)};w(!1),w(!0)}drawStars(r,a){let n=i.b1(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.be([]);i.bf(u,u,-l._pitch),i.bg(u,u,-l.angle),i.bf(u,u,i.av(l._center.lat)),i.et(u,u,-i.av(l._center.lng));let c=i.bh(new Float32Array(16),u),d=i.X([],l.starsProjMatrix,c),p=i.ek([],c),f=i.eu([],p),m=this.params.sizeMultiplier,_=[0,1,0];i.cT(_,_,f),i.dV(_,_,m);let g=[1,0,0];i.cT(g,g,f),i.dV(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,i.Z.disabled,i._.disabled,this.colorModeAlphaBlendedWriteRGB,i.$.disabled,y,"atmosphere_stars",this.starsVx,this.starsIdx,this.starsSegments)}}class nq{}class nW{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.ev;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 nq;return d.buf=new n_(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 nX{constructor(){this.occluderSize=30,this.depthOffset=-1e-4}}
111let nY={symbol:function(r,a,n,o,s){if("translucent"!==r.renderPass)return;let l=i._.disabled,h=r.colorModeForRenderPass(),u=n.layout.get("text-variable-anchor"),c=n.layout.get("text-size-scale-range"),d=i.b1(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.dl(s.textSizeData,c.zoom,u),f=i.e1(a,s.getProjection(),c),m=c.calculatePixelsToTileUnitsMatrix(r),_=i.e2(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=i.e1(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=new i.P(w,T),n=0;if(A&&r.hdExt){let o=r.symbolInstances.get(r.text.symbolInstanceIndices[m]);if(r.hdExt.isCrossTileRoadElevation(o.elevationFeatureIndex,h.canonical)){let i=r.hdExt.getRoadFeatureHeightForPlacedSymbol(r,r.text,m,a,h.canonical);n=null!==i?i:0}else{let o=r.hdExt.getElevationFeatureForPlacedSymbol(r,r.text,m);n=i.c2.getAtTileOffset(h,a,x,void 0!==o?o:null)}}else n=i.c2.getAtTileOffset(h,a,x,null);let[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,R]=i.da(b.projectedAnchorX+o,b.projectedAnchorY+p,b.projectedAnchorZ+I,n?y:l),D=i.e4(s.getCameraToCenterDistance(g),R),L=i.ds(r.textSizeData,c,b)*D/i.dg;n&&(L*=r.tilePixelRatio/u);let z=function({width:r,height:a,anchor:n,textOffset:o,textScale:s},l){let{horizontalAlign:h,verticalAlign:u}=i.du(n),c=i.dv(n,o);return new i.P((-(h-.5)*r/s+c[0])*l,(-(u-.5)*a/s+c[1])*l)}(E,L);n?({x:M,y:C,z:P}=g.projectTilePoint(w+z.x,T+z.y,h.canonical),[M,C,P]=i.da(M+o,C+p,P+I,l)):(a&&z._rotate(-s.angle),M+=z.x,C+=z.y,P=0);let F=r.allowVerticalPlacement&&b.placedOrientation===i.dt.vertical?Math.PI/2:0;for(let r=0;r<S;r++)i.e5(f,M,C,P,F);d&&b.associatedIconIndex>=0&&(_[b.associatedIconIndex]={x:M,y:C,z:P,angle:F})}else i.e3(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)i.e3(o,m);else{let{x:r,y:a,z:n,angle:l}=s;for(let s=0;s<o;s++)i.e5(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)?nT(r,a,n,o,l,h):(p&&nT(r,a,n,o,l,h,{onlyIcons:!0}),f&&nT(r,a,n,o,l,h,{onlyText:!0})),a.map.showCollisionBoxes&&eQ.drawCollisionDebug&&(eQ.drawCollisionDebug(r,a,n,o,n.paint.get("text-translate"),n.paint.get("text-translate-anchor"),!0),eQ.drawCollisionDebug(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,i.Z.ReadOnly),y=new i.Z(r.context.gl.LEQUAL,i.Z.ReadOnly,r.depthRangeFor3D),x="none"===_||m?g:y,v=i._.disabled,b=r.colorModeForDrapableLayerRenderPass(c),w="globe"===f.projection.name,T=[i.a7(f.center.lng),i.a8(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.e8(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.hdExt&&c.hdExt.hasElevation&&!r.terrain&&(g.push("ELEVATED_ROADS"),y.push(c.hdExt.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.e9(r,l,h,b,T,n),tile:h};if(u)for(let r of c.segments.get())S.push({segments:new i.ad([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 a of S){let{programConfiguration:o,program:s,layoutVertexBuffer:l,dynamicBuffers:h,indexBuffer:u,uniformValues:c,tile:m}=a.state,_=a.segments;r.terrain&&r.terrain.setupElevationDraw(m,s,E),r.uploadCommonUniforms(d,s,m.tileID.toUnwrapped()),s.draw(r,p.TRIANGLES,x,v,b,i.$.disabled,c,n.id,l,u,_,n.paint,f.zoom,o,h)}},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=i._.disabled,u=new i.a1([l.ONE,l.ONE,l.ONE,l.ONE],i.C.transparent,[!0,!0,!0,!0]),c="globe"===r.transform.projection.name?.5:.25;n.heatmapFbo=nx.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?i.$.frontCCW:i.$.disabled,_=[i.a7(d.center.lng),i.a8(d.center.lat)];for(let c=0;c<o.length;c++){let g=o[c];if(a.hasRenderableParent(g))continue;let y=a.getTile(g),x=y.getBucket(n);if(!x||x.projection.name!==d.projection.name)continue;
111let v=r.isTileAffectedByFog(g),b=x.programConfigurations.get(n.id),w=r.getOrCreateProgram("heatmap",{config:b,defines:f,overrideFog:v}),{zoom:T}=r.transform;r.terrain&&r.terrain.setupElevationDraw(y,w),r.uploadCommonUniforms(s,w,g.toUnwrapped());let S=d.projection.createInversionMatrix(d,g.canonical);w.draw(r,l.TRIANGLES,i.Z.disabled,h,u,m,r7(r,g,y,S,_,T,n.paint.get("heatmap-intensity")),n.id,x.layoutVertexBuffer,x.indexBuffer,x.segments,n.paint,r.transform.zoom,b,p?[x.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,i.Z.disabled,i._.disabled,r.colorModeForRenderPass(),i.$.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&&nE(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=i.isEmissiveMrtActive(),d=h.drapeBufferSize[0],p=h.drapeBufferSize[1];a.lineBlendFbos||(a.lineBlendFbos=new nI),a.lineBlendFbos.drapeFbo=nx.createWithTexture(s,a.lineBlendFbos.drapeFbo,d,p,!0),c&&l.drawBuffers([l.COLOR_ATTACHMENT0]),s.clear({color:nM[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),nE(i,r,a,n,nP(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&&nD(i,a,x),nL(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 nI),a.lineBlendFbos.fbo=nx.createWithTexture(s,a.lineBlendFbos.fbo,l,h,!0),s.clear({color:nM[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",nE(i,r,a,n,nP(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&&nD(i,a,a.lineBlendFbos.fbo)}(i,r,a,n,l);if("translucent"===i.renderPass){let r=a.lineBlendFbos&&a.lineBlendFbos.fbo;return void(r&&nL(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&&iX&&iX(m));let _=r.isEmissiveMrtActive();if("offset"!==p){if(nz(m,!1,_),"road"===p){let s=!f&&"translucent"===r.renderPass;s&&iY&&iY(r,a,n,o,"geometry"),nz(m,!0,_,i._.disabled),s&&iW&&iW(m)}}else nz(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=r.isEmissiveMrtActive(),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.aK?(r.flags|=i.aK,a.flags|=i.aK):(r.flags&=~i.aK,a.flags&=~i.aK)},d=r=>new i.P(Math.ceil((r+i.aL)*i.aM),0),p=(r,a,n)=>{let o=Math.ceil((r+i.aL)*i.aM),s=Math.floor(Math.max(0,Math.min(i.a6-1,n))/4);return new i.P(o,s<<5|(3&a)<<3|7)},f=(r,a)=>{let n=Number.MAX_VALUE,o=a[0][0]!==n,s=a[1][0]!==n,l=a[2][0]!==n,h=a[3][0]!==n;if(!(+!!o+ +!!s+ +!!l+ +!!h>2))return r<2?l===h?void 0:l?0:i.a6-1:o===s?void 0:o?0:i.a6-1},m=(i,r,a,n)=>(r?f(i,r):void 0)??(n?f(a,n):void 0),_=i=>{let r=a.getSource().minzoom,n=i=>{let r=a.getTileByID(i);if(r&&r.hasData())return r.getBucket(s)};
111for(let a of[0,-1,1]){if(i.overscaledZ+a<r)continue;let o=n(i.calculateScaledKey(i.overscaledZ+a));if(o)return o}},g=[0,0,0],y=(r,a)=>(g[0]=Math.min(r.min.y,a.min.y),g[1]=Math.max(r.max.y,a.max.y),g[2]=i.a6-a.min.x>r.max.x?a.min.x-i.a6:r.max.x,g),x=(r,a)=>(g[0]=Math.min(r.min.x,a.min.x),g[1]=Math.max(r.max.x,a.max.x),g[2]=i.a6-a.min.y>r.max.y?a.min.y-i.a6:r.max.y,g),v=[(i,r)=>y(i,r),(i,r)=>y(r,i),(i,r)=>x(i,r),(i,r)=>x(r,i)],b=(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.a6+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.aC[r](n),u=_(s);if(!(u&&u instanceof i.aD))continue;let f=l?l.findDEMTileFor(s):null;if(!(f&&f.dem||h)||(l&&f&&f.dem&&o.borderDEMTileTimestamp[r]!==f.dem._timestamp&&(o.borderDoneWithNeighborZ[r]=-1,o.borderDEMTileTimestamp[r]=f.dem._timestamp),o.borderDoneWithNeighborZ[r]===u.canonical.z))continue;0===u.centroidVertexArray.length&&u.createCentroidsBuffer();let g=(r<2?1:5)-r,y=u.borderDoneWithNeighborZ[g]!==o.canonical.z,x=u.borderFeatureIndices[g],w=0;if(o.canonical.z!==u.canonical.z){for(let i of a)o.showCentroid(o.featuresOnBorder[i],"discard");if(y)for(let i of x)u.showCentroid(u.featuresOnBorder[i],"discard");o.borderDoneWithNeighborZ[r]=u.canonical.z,u.borderDoneWithNeighborZ[g]=o.canonical.z;continue}let T=new Map,S=new Set,E=new Set;for(let i=0;i<x.length;i++){let r=u.featuresOnBorder[x[i]];void 0!==r.buildingId&&T.set(r.buildingId,i)}for(let n of a){let a=o.featuresOnBorder[n],d=o.centroidData.get(a.centroidDataIndex);if(void 0===a.buildingId)continue;let _=T.get(a.buildingId);if(void 0===_)continue;let y=u.featuresOnBorder[x[_]],w=u.centroidData.get(y.centroidDataIndex);S.add(n),E.add(_),h&&c(d,w);let I=0!==d.groupCentroidPos.x||0!==d.groupCentroidPos.y?d.groupCentroidPos:a.centroid(),A=0!==w.groupCentroidPos.x||0!==w.groupCentroidPos.y?w.groupCentroidPos:y.centroid(),M=l?void 0:m(r,a.borders,g,y.borders),C=void 0!==M?M:r<2?Math.round((I.y+A.y)/2):Math.round((I.x+A.x)/2),P=a.intersectsCount()>1||y.intersectsCount()>1;{let a=0;if(f&&f.dem&&!P){let n=v[r](d,w),o=r%2?i.a6-1:0;a=b(n[0],Math.min(i.a6-1,n[1]),o,f,s,r<2,n[2])}d.centroidXY=p(a,r,C),w.centroidXY=p(a,g,C)}if(o.writeCentroidToBuffer(d),u.writeCentroidToBuffer(w),void 0!==a.buildingId){for(let i of o.centroidData)i.buildingId===a.buildingId&&i!==d&&(i.centroidXY=d.centroidXY,o.writeCentroidToBuffer(i));for(let i of u.centroidData)i.buildingId===a.buildingId&&i!==w&&(i.centroidXY=w.centroidXY,u.writeCentroidToBuffer(i))}}for(let n of a){let a;if(S.has(n))continue;let _=o.featuresOnBorder[n],y=o.centroidData.get(_.centroidDataIndex),T=_.borders[r];for(;w<x.length;){if(E.has(w)){w++;continue}let i=(a=u.featuresOnBorder[x[w]]).borders[g];if(i[1]>T[0]+3||i[0]>T[0]-3)break;u.showCentroid(a,"keep"),w++}if(a&&w<x.length){let n=w,S=0;for(;;)if(E.has(w)){if(++w===x.length)break;a=u.featuresOnBorder[x[w]]}else{if(a.borders[g][0]>T[1]-3||(S++,++w===x.length))break;a=u.featuresOnBorder[x[w]]}for(;n<x.length&&E.has(n);)n++;if(n>=x.length){o.showCentroid(_,"keep");continue}a=u.featuresOnBorder[x[n]];let I=!1;if(S>=1){let i=a.borders[g];3>Math.abs(T[0]-i[0])&&3>Math.abs(T[1]-i[1])&&(S=1,I=!0,w=n+1)}else if(0===S){o.showCentroid(_,"keep");continue}let A=u.centroidData.get(a.centroidDataIndex);h&&I&&c(y,A);let M=_.intersectsCount()>1||a.intersectsCount()>1;if(S>1)w=n,y.centroidXY=A.centroidXY=new i.P(0,0);else if(f&&f.dem&&!M){let a=v[r](y,A),n=r%2?i.a6-1:0;y.centroidXY=A.centroidXY=d(b(a[0],Math.min(i.a6-1,a[1]),n,f,s,r<2,a[2]))}else if(M){let n=l?void 0:m(r,_.borders,g,a.borders);void 0!==n?(y.centroidXY=p(0,r,n),A.centroidXY=p(0,g,n)):y.centroidXY=A.centroidXY=new i.P(0,0)}else y.centroidXY=o.encodeBorderCentroid(_),A.centroidXY=u.encodeBorderCentroid(a);o.writeCentroidToBuffer(y),u.writeCentroidToBuffer(A)}else o.showCentroid(_,"keep")}o.borderDoneWithNeighborZ[r]=u.canonical.z,u.borderDoneWithNeighborZ[g]=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.ak)return;let l=r.shadowRenderer.getShadowPassDepthMode();tC(r,a,n,o,l,i._.disabled,i.a1.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 l=new i.Z(r.context.gl.LEQUAL,i.Z.ReadWrite,r.depthRangeFor3D);1===s&&f?tC(r,a,n,o,l,i._.disabled,i.a1.unblended,p):(tC(r,a,n,o,l,i._.disabled,i.a1.disabled,p),tC(r,a,n,o,l,r.stencilModeFor3D(),r.colorModeForRenderPass(),p),r.resetStencilClippingMasks())}let _=r.style.enable3dLights()&&f&&(!u&&"globe"!==r.transform.projection.name||c);if(_&&!tA.drawGroundEffect&&tM(),_&&tA.drawGroundEffect){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=new tP;b.translate=n.paint.get("fill-extrusion-translate"),b.translateAnchor=n.paint.get("fill-extrusion-translate-anchor"),b.edgeRadius=n.layout.get("fill-extrusion-edge-radius"),b.cutoffFadeRange=n.paint.get("fill-extrusion-cutoff-fade-range");let w=l=>{let u=r.depthModeForSublayer(1,i.Z.ReadOnly,h.LEQUAL,!0),c=n.paint.get(l?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),d=i.am(.1,3,c),g=r._showOverdrawInspector;if(!g){let c=new i._({func:h.ALWAYS,mask:255},255,255,h.KEEP,h.KEEP,h.REPLACE),g=new i.a1([h.ONE,h.ONE,h.ONE,h.ONE],i.C.transparent,[!1,!1,!1,!0],h.MIN);tA.drawGroundEffect(b,r,a,n,o,u,c,g,i.$.disabled,l,"sdf",s,f,m,_,y,d,p,!1)}{let c=g?i._.disabled:new i._({func:h.EQUAL,mask:255},255,255,h.KEEP,h.DECR,h.DECR),x=g?r.colorModeForRenderPass():new i.a1([h.ONE_MINUS_DST_ALPHA,h.DST_ALPHA,h.ONE,h.ONE],i.C.transparent,[!0,!0,!0,!0]);tA.drawGroundEffect(b,r,a,n,o,u,c,x,i.$.disabled,l,"color",s,f,m,_,y,d,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.b({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,i.Z.ReadOnly,h.LEQUAL,!1),v=n.paint.get(l?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),w=i.am(.1,3,v);{let c=new i.a1([h.ONE,h.ONE,h.ONE,h.ONE],i.C.transparent,[!1,!1,!1,!0]);tA.drawGroundEffect(b,r,a,n,o,x,i._.disabled,c,i.$.disabled,l,"clear",s,f,m,_,y,w,p,u)}{let c=new i._({func:h.ALWAYS,mask:255},255,255,h.KEEP,h.KEEP,h.REPLACE),d=new i.a1([h.ONE,h.ONE,h.ONE,h.ONE],i.C.transparent,[!1,!1,!1,!0],h.MIN);tA.drawGroundEffect(b,r,a,n,o,x,c,d,i.$.disabled,l,"sdf",s,f,m,_,y,w,p,u)}d&&!l&&(g=c());{let c=l?h.ZERO:h.ONE_MINUS_DST_ALPHA,d=new i._({func:h.EQUAL,mask:255},255,255,h.KEEP,h.DECR,h.DECR),g=new i.a1([c,h.DST_ALPHA,h.ONE_MINUS_DST_ALPHA,h.ZERO],i.C.transparent,[!0,!0,!0,!0]);tA.drawGroundEffect(b,r,a,n,o,x,d,g,i.$.disabled,l,"color",s,f,m,_,y,w,p,u)}if(!d||l){let c=new i.a1([h.ONE,h.ONE,h.ONE,l?h.ZERO:h.ONE],i.C.transparent,[!1,!1,!1,!0],l?h.FUNC_ADD:h.MAX);tA.drawGroundEffect(b,r,a,n,o,x,i._.disabled,c,i.$.disabled,l,"clear",s,f,m,_,y,w,p,u,g)}else{h.drawBuffers([h.NONE,h.COLOR_ATTACHMENT1]);let c=new i._({func:h.EQUAL,mask:255},254,255,h.KEEP,h.DECR,h.DECR),d=new i.a1([h.ONE,h.ONE,h.ONE,h.ONE],i.C.transparent,[!0,!1,!1,!1],h.MAX);tA.drawGroundEffect(b,r,a,n,o,x,c,d,i.$.disabled,l,"emissive",s,f,m,_,y,w,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&&w(!0),v&&w(!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),ra(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&&r.isEmissiveMrtActive()&&(f.push("USE_MRT1"),"mrt-full-rgba"===r.emissiveMode&&f.push("USE_MRT1_RGBA")),r.getOrCreateProgram("hillshadePrepare",{defines:f}).draw(r,s.TRIANGLES,i.Z.disabled,i._.disabled,i.a1.unblended,i.$.disabled,((r,a)=>{let n=a.stride,o=i.Y();return i.bZ(o,0,i.a6,-i.a6,0,0,1),i.bN(o,o,[0,-i.a6,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,i.Z.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&&r.isEmissiveMrtActive()&&(f.push("USE_MRT1"),"mrt-full-rgba"===r.emissiveMode&&f.push("USE_MRT1_RGBA"));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.av(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.b_(a.x,a.y,a.z);f=i.av(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.bT(0,o/n).toLngLat().lat,new i.bT(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,i.$.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=n.paint.get("raster-elevation"),d="ground"===n.paint.get("raster-elevation-reference"),p=c>0,f=r.terrain&&r.terrain.exaggeration()>0&&p&&d,m=p&&u,_=!u&&f;if(r.renderElevatedRasterBackface&&!m)return;let g=r.context,y=g.gl,x=a.getSource(),v=function(r,a,n,o,s){let l=n.paint.get("raster-color"),h="raster-array"===a.type,u=[],c=n.paint.get("raster-resampling"),d=n.paint.get("raster-color-mix"),p=n.paint.get("raster-color-range"),f=[d[0],d[1],d[2],0],m=d[3],_="nearest"===c?s.NEAREST:s.LINEAR;if(h&&(u.push("RASTER_ARRAY"),l||u.push("RASTER_COLOR"),"linear"===c&&u.push("RASTER_ARRAY_LINEAR"),_=s.NEAREST,l&&"log"===n.paint.get("raster-color-scale")&&u.push("RASTER_COLOR_SCALE_LOG"),!p&&a.rasterLayers)){let i=a.rasterLayers.find(({id:i})=>i===n.sourceLayer);i&&i.fields&&i.fields.range&&(p=i.fields.range)}if(p=p||[0,1],l){u.push("RASTER_COLOR"),o.activeTexture.set(s.TEXTURE2),n.updateColorRamp(p);let r=n.colorRampTexture;r||(r=n.colorRampTexture=new i.T(o,n.colorRamp,s.RGBA8)),r.bind(_,s.CLAMP_TO_EDGE)}return r.terrain&&r.terrain.renderingToTexture&&r.isEmissiveMrtActive()&&(u.push("USE_MRT1"),"mrt-full-rgba"===r.emissiveMode&&u.push("USE_MRT1_RGBA")),{mix:f,range:p,offset:m,defines:u,resampling:_}}(r,x,n,g,y);if(x instanceof af&&!o.length&&!u)return;let b=n.paint.get("raster-emissive-strength"),w=r.colorModeForDrapableLayerRenderPass(b),T=r.terrain&&r.terrain.renderingToTexture,S=!r.options.moving,E="nearest"===n.paint.get("raster-resampling")?y.NEAREST:y.LINEAR;if(x instanceof af&&!o.length&&(x.onNorthPole||x.onSouthPole)){let o=p?r.stencilModeFor3D():i._.disabled;return void nO(c,!!x.onNorthPole,null,r,a,n,b,v,i.$.disabled,o)}if(!o.length)return;let[I,A]=x instanceof af||T?[{},o]:r.stencilConfigForOverlap(o),M=A.at(-1).overscaledZ;m&&v.defines.push("PROJECTION_GLOBE_VIEW"),p&&v.defines.push("RENDER_CUTOFF","ELEVATED"),f&&v.defines.push("ELEVATION_REFERENCE_GROUND");let C=(o,s,d)=>{for(let A of o){let o,C,P,R,D,L=A.toUnwrapped(),z=a.getTile(A);if(T&&(!z||!z.hasData()))continue;g.activeTexture.set(y.TEXTURE0);let F=function(i,r,a,n){if(i)return"raster-array"===r.type?r.getTextureDescriptor(i,a,!0):{texture:i.texture,mix:nF(n.mix),offset:n.offset,buffer:0,tileSize:1}}(z,x,n,v);if(!F||!F.texture)continue;let{texture:O,mix:B,offset:k,tileSize:N,buffer:V}=F;T?(o=i.Z.disabled,C=A.projMatrix):p?(o=new i.Z(y.LEQUAL,i.Z.ReadWrite,r.depthRangeFor3D),C=u?r.transform.expandedFarZProjMatrix:r.transform.calculateProjMatrix(L,S)):(o=r.depthModeForSublayer(A.overscaledZ-M,1===h?i.Z.ReadWrite:i.Z.ReadOnly,y.LESS),C=r.transform.calculateProjMatrix(L,S));let U=r.terrain&&T?r.terrain.stencilModeForRTTOverlap(A):I[A.overscaledZ],j=l?0:n.paint.get("raster-fade-duration");z.registerFadeDuration(j);let G=a.findLoadedParent(A,0),Z=tW(z,G,a,r.transform,j);!Z.isFading&&z.refreshedUponExpiration&&(z.refreshedUponExpiration=!1),r.terrain&&r.terrain.prepareDrawTile(),g.activeTexture.set(y.TEXTURE0),O.bind(E,y.CLAMP_TO_EDGE),g.activeTexture.set(y.TEXTURE1),G?(G.texture&&G.texture.bind(E,y.CLAMP_TO_EDGE),P=Math.pow(2,G.tileID.overscaledZ-z.tileID.overscaledZ
111),R=[z.tileID.canonical.x*P%1,z.tileID.canonical.y*P%1]):O.bind(E,y.CLAMP_TO_EDGE),"useMipmap"in O&&g.extTextureFilterAnisotropic&&r.transform.pitch>20&&y.texParameterf(y.TEXTURE_2D,g.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,g.extTextureFilterAnisotropicMax);let $=r.transform,H=p?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]}($):[0,0,0,0],q,W,X,Y,K,J=0;if(m&&x instanceof af&&x.coordinates.length>3)q=Float32Array.from(i.b5(i.b6(new i.bW(0,0,0)))),W=Float32Array.from($.globeMatrix),X=Float32Array.from(i.b7($)),Y=[i.a7($.center.lng),i.a8($.center.lat)],D=x.elevatedGlobePerspectiveTransform,K=x.elevatedGlobeGridMatrix||new Float32Array(9);else if(m){let r=i.b3(A.canonical);J=i.b4(r.getCenter().lat),q=Float32Array.from(i.b5(i.b6(A.canonical))),W=Float32Array.from($.globeMatrix),X=Float32Array.from(i.b7($)),Y=[i.a7($.center.lng),i.a8($.center.lat)],D=[0,0],K=Float32Array.from(i.b8(A.canonical,r,J,$.worldSize/$._pixelsPerMercatorPixel))}else D=x instanceof af?x.perspectiveTransform:[0,0],q=new Float32Array(16),W=new Float32Array(9),X=new Float32Array(16),Y=[0,0],K=new Float32Array(9);let Q=ae(r,C,q,W,X,K,R||[0,0],i.S(r.transform.zoom),Y,H,P||1,Z,n,D,c,2,B,k,v.range,N,V,b),ee=r.isTileAffectedByFog(A),et=r.getOrCreateProgram("raster",{defines:v.defines,overrideFog:ee});if(r.uploadCommonUniforms(g,et,L),x instanceof af){let a=x.elevatedGlobeVertexBuffer,l=x.elevatedGlobeIndexBuffer;if(T||!u)x.boundsBuffer&&x.boundsSegments&&et.draw(r,y.TRIANGLES,o,i._.disabled,w,i.$.disabled,Q,n.id,x.boundsBuffer,r.quadTriangleIndexBuffer,x.boundsSegments);else if(a&&l){let h=$.zoom<=i.ef?x.elevatedGlobeSegments:x.getSegmentsForLongitude($.center.lng);h&&et.draw(r,y.TRIANGLES,o,i._.disabled,w,s,Q,n.id,a,l,h)}}else if(m){o=new i.Z(y.LEQUAL,i.Z.ReadOnly,r.depthRangeFor3D);let a=r.globeSharedBuffers;if(a){f&&(r.terrain.setupElevationDraw(z,et),r.uploadCommonUniforms(g,et,z.tileID.toUnwrapped()));let[i,l,h]=a.getGridBuffers(J,!1),u=et.getAttributeLocation(y,"a_texture_pos");-1!==u&&y.vertexAttribI4ui(u,0,0,0,0),et.draw(r,y.TRIANGLES,o,d||U,r.colorModeForRenderPass(),s,Q,n.id,i,l,h)}}else if(_)o=new i.Z(y.LEQUAL,i.Z.ReadOnly,r.depthRangeFor3D),r.terrain.setupElevationDraw(z,et),r.uploadCommonUniforms(g,et,z.tileID.toUnwrapped()),$.pitch>20&&et.draw(r,y.TRIANGLES,o,i._.disabled,i.a1.disabled,i.$.frontCCW,Q,n.id,r.terrain.gridBuffer,r.terrain.gridIndexBuffer,r.terrain.gridSegments),et.draw(r,y.TRIANGLES,o,U,w,i.$.backCCW,Q,n.id,r.terrain.gridBuffer,r.terrain.gridIndexBuffer,r.terrain.gridSegments);else{let{tileBoundsBuffer:a,tileBoundsIndexBuffer:s,tileBoundsSegments:l}=r.getTileBoundsBuffers(z);et.draw(r,y.TRIANGLES,o,U,w,i.$.disabled,Q,n.id,a,s,l)}}if(!(x instanceof af)&&m)for(let l of o){let o=l.canonical.y===(1<<l.canonical.z)-1;0===l.canonical.y&&nO(c,!0,l,r,a,n,b,v,s,d||i._.disabled),o&&nO(c,!1,l,r,a,n,b,v,s===i.$.frontCW?i.$.backCW:i.$.frontCW,d||i._.disabled)}};m?C(A,r.renderElevatedRasterBackface?i.$.backCW:i.$.frontCW,r.stencilModeFor3D()):C(A,i.$.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=i._.disabled,v=r.depthModeForSublayer(0,"opaque"===y?i.Z.ReadWrite:i.Z.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&&r.isEmissiveMrtActive()&&(E.push("USE_MRT1"),"mrt-full-rgba"===r.emissiveMode&&E.push("USE_MRT1_RGBA")),d){let a=r.getOrCreateProgram(w,{overrideFog:!1,overrideRtt:!0,defines:E}),o=new i.bQ(0,0,0,0,0),p=g?aa(nB,c,u,r,g,n.scope,s,d,{tileID:o,tileSize:_}):ar(nB,c,u,l.toPremultipliedRenderColor(h?null:n.lut));return void a.draw(r,f.TRIANGLES,v,x,b,i.$.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 ip(y,_,m.zoom,r),P=g?aa(M,c,u,r,g,n.scope,s,d,{tileID:y,tileSize:_}):ar(M,c,u,l.toPremultipliedRenderColor(h?null:n.lut));r.uploadCommonUniforms(p,I,A);let{tileBoundsBuffer:R,tileBoundsIndexBuffer:D,tileBoundsSegments:L}=r.getTileBoundsBuffers(C);I.draw(r,f.TRIANGLES,v,x,b,i.$.disabled,P,n.id,R,D,L)}},sky:function(r,a,n){let o=r._atmosphere?i.S(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 i.Z(l.gl.LEQUAL,i.Z.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 nU(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.ei(u,-(.5*Math.PI)),nj(r,a,h,u,l,0),i.ei(u,.5*Math.PI),nj(r,a,h,u,l,1),i.ej(u,-(.5*Math.PI)),nj(r,a,h,u,l,2),i.ej(u,.5*Math.PI),nj(r,a,h,u,l,3),i.df(u),nj(r,a,h,u,l,4),i.ei(u,Math.PI),nj(r,a,h,u,l,5),n.viewport.set([0,0,r.width,r.height])}(r,n),n.markSkyboxValid(r)):"sky"===r.renderPass&&function(r,a,n,o,s){let l,h=r.context,u=h.gl,c=r.transform,d=r.getOrCreateProgram("skybox");h.activeTexture.set(u.TEXTURE0),u.bindTexture(u.TEXTURE_CUBE_MAP,a.skyboxTexture);let p=(l=c.skyboxMatrix,{u_matrix:l,u_sun_direction:a.getCenter(r,!1),u_cubemap:0,u_opacity:o,u_temporal_offset:s});r.uploadCommonUniforms(h,d),d.draw(r,u.TRIANGLES,n,i._.disabled,r.colorModeForRenderPass(),i.$.backCW,p,"skybox",a.skyboxGeometry.vertexBuffer,a.skyboxGeometry.indexBuffer,a.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 nU(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.av(u),u_opacity:o,u_temporal_offset:s});r.uploadCommonUniforms(c,f),f.draw(r,d.TRIANGLES,n,i._.disabled,r.colorModeForRenderPass(),i.$.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.S(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 a=l.renderToTile;if(a){let n=o[0].canonical,h={x:n.x+o[0].wrap*(l.wrapTileId?0:1<<n.z),y:n.y,z:n.z};s.setDepthMode(i.Z.disabled),s.setStencilMode(i._.disabled),s.setColorMode(r.colorModeForRenderPass()),r.setCustomLayerDefaults();let u=nk[r.emissiveMode],c=s.gl,d=l.supportsEmissiveMode,p=u&&d&&d.call(l,u);r.isEmissiveMrtActive()&&!p&&c.drawBuffers([c.COLOR_ATTACHMENT0]),a.call(l,s.gl,h,u),r.isEmissiveMrtActive()&&!p&&c.drawBuffers([c.COLOR_ATTACHMENT0,c.COLOR_ATTACHMENT1]),s.setDirty(),r.setBaseState()}return}r.setCustomLayerDefaults(),s.setColorMode(r.colorModeForRenderPass()),s.setStencilMode(i._.disabled);let a="3d"===l.renderingMode?new i.Z(r.context.gl.LEQUAL,i.Z.ReadWrite,r.depthRangeFor3D):r.depthModeForSublayer(0,i.Z.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.S(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.")}},nK={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},raster:function(i,r,a){let n=r.getSource();if("raster-array"!==n.type||!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)}};async function nJ(i){if(await tM(),Object.assign(nY,{model:tA.drawModels}),Object.assign(nK,{model:tA.prepare}),i&&!i._destroyed&&!i._shadowRenderer){let r=tA.ShadowRenderer;r&&(i._shadowRenderer=new r(i))}}class nQ{constructor(r,a,n,o,s,l){this._forceFullRgbaEmissive=!1,this.context=new nv(r,a),this._forceFullRgbaEmissive="exact"===l,this.transform=n,this._tileTextures={},this.frameCopies=[],this.loadTimeStamps=[],this.frcCoverageSnapshot=null,this.elevationCoverageSnapshot=null,this.elevationProvidersReady=void 0,this.frcCoverageFadeRange=null,this.frcCoverageSourceLayers=[],this.frcCoverageRenderer=i6?new i6:null,this._debugParams={averageFPS:0,fpsHistory:[],fpsWindow:30,continousRedraw:!1,enabledLayers:{},buildingsShowNormals:!1,buildingsDrawGroundAO:!0,buildingsDrawShadowPass:!0,buildingsDrawTranslucentPass:!0,showTerrainProxyTiles:!1,terrainSortTilesHiZFirst:!0,terrainDisableRenderCache:!1,forceEnablePrecipitation:!1,overrideSnowParams:!1,snowParamsOverride:null,snowRevealParamsOverride:null,snowVignetteParam
111sOverride:null,overrideRainParams:!1,rainParamsOverride:null,rainRevealParamsOverride:null,rainVignetteParamsOverride:null,overrideStarsParams:!1,starsParamsOverride:null,show3DModelFootprints:!1,showElevationIdDebug:!1,lodSwitchDistance:-1,lodSwitchFadeDuration:.5},this.occlusionParams=new nX,this.setup(),this.numSublayers=ig.maxUnderzooming+ig.maxOverzooming+1,this.depthEpsilon=1/65536,this.deferredRenderGpuTimeQueries=[],this.gpuTimers={},this.frameCounter=0,this.frameTimeDelta=0,this.lastPaintStartTimeStamp=0,this._shadowCullCache=null,this._backgroundTiles={},this.conflationActive=!1,this.replacementSource=new i.ew,this.longestCutoffRange=0,this.minCutoffZoom=0,this._fogVisible=!1,this._cachedTileFogOpacities={},this._wireframeDebugCache=new nW,this.renderDefaultNorthPole=!0,this.renderDefaultSouthPole=!0,this.layersWithOcclusionOpacity=[];let h=new i.b({width:1,height:1},Uint8Array.of(0,0,0,0));this.emptyDepthTexture=new i.T(this.context,h,r.RGBA8),this._clippingActiveLastFrame=!1,this.scaleFactor=o,this.maxFrontCutoffRawStart=0,this.worldview=s,this._forceEmissiveMode=!1,this.emissiveMode="constant"}updateTerrain(i,r){var a;let n=!!i&&!!i.terrain&&this.transform.projection.supportsTerrain;(n||this._terrain&&this._terrain.enabled)&&(this._terrain||(this._terrain=r2(this,i),this._terrain)?(this.transform.elevation=n?this._terrain:null,this._terrain.update(i,this.transform,r),this.transform.elevation&&!this._terrain.enabled&&(this.transform.elevation=null)):this._terrainRendererRetryPending||(this._terrainRendererRetryPending=!0,a=()=>{this._terrainRendererRetryPending=!1,this.style&&this.style.map&&this.style.map._update(!1)},r0?a():r1.push(a)))}_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=r2(this,this.style),this._terrain||console.warn("forceTerrainMode: Lite module not loaded yet, terrain renderer unavailable")),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.e.devicePixelRatio,this.height=a*i.e.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.bD;a.emplaceBack(0,0),a.emplaceBack(i.a6,0),a.emplaceBack(0,i.a6),a.emplaceBack(i.a6,i.a6),this.tileExtentBuffer=r.createVertexBuffer(a,i.bF.members),this.tileExtentSegments=i.ad.simpleSegment(0,0,4,2);let n=new i.bD;n.emplaceBack(0,0),n.emplaceBack(i.a6,0),n.emplaceBack(0,i.a6),n.emplaceBack(i.a6,i.a6),this.debugBuffer=r.createVertexBuffer(n,i.bF.members),this.debugSegments=i.ad.simpleSegment(0,0,4,5);let o=new i.bD;o.emplaceBack(-1,-1),o.emplaceBack(1,-1),o.emplaceBack(-1,1),o.emplaceBack(1,1),this.viewportBuffer=r.createVertexBuffer(o,i.bF.members),this.viewportSegments=i.ad.simpleSegment(0,0,4,2);let s=new i.bt;s.emplaceBack(0,0,0,0),s.emplaceBack(i.a6,0,i.a6,0),s.emplaceBack(0,i.a6,0,i.a6),s.emplaceBack(i.a6,i.a6,i.a6,i.a6),this.mercatorBoundsBuffer=r.createVertexBuffer(s,ih.members),this.mercatorBoundsSegments=i.ad.simpleSegment(0,0,4,2);let l=new i.ae;l.emplaceBack(0,1,2),l.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=r.createIndexBuffer(l);let h=new i.bE;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.b({width:1,height:1},Uint8Array.of(0,0,0,0)),r.gl.RGBA8),this.identityMat=i.Y();let u=this.context.gl;this.stencilClearMode=new i._({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 r=this.context.gl;this.nextStencilID=1,this.currentStencilSource=void 0,this._tileClippingMaskIDs={},this.getOrCreateProgram("clippingMask").draw(this,r.TRIANGLES,i.Z.disabled,this.stencilClearMode,i.a1.disabled,i.$.disabled,iF(this.identityMat),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}resetStencilClippingMasks(){this.terrain||(this.currentStencilSource=void 0,this._tileClippingMaskIDs={})}_renderTileClippingMasks(r,a,n){if(!a||this.currentStencilSource===a.id||!r.isTileClipped()||!n||0===n.length)return;if(this._tileClippingMaskIDs&&!this.terrain){let i=!1;for(let r of n)if(void 0===this._tileClippingMaskIDs[r.key]){i=!0;break}if(!i)return}this.currentStencilSource=a.id;let o=this.context,s=o.gl;this.nextStencilID+n.length>256&&this.clearStencil(),o.setColorMode(i.a1.disabled),o.setDepthMode(i.Z.disabled);let l=this.getOrCreateProgram("clippingMask");for(let r of(this._tileClippingMaskIDs={},n)){let n=a.getTile(r),o=this._tileClippingMaskIDs[r.key]=this.nextStencilID++,{tileBoundsBuffer:h,tileBoundsIndexBuffer:u,tileBoundsSegments:c}=this.getTileBoundsBuffers(n);l.draw(this,s.TRIANGLES,i.Z.disabled,new i._({func:s.ALWAYS,mask:0},o,255,s.KEEP,s.KEEP,s.REPLACE),i.a1.disabled,i.$.disabled,iF(r.projMatrix),"$clipping",h,u,c)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();let r=this.nextStencilID++,a=this.context.gl;return new i._({func:a.NOTEQUAL,mask:255},r,255,a.KEEP,a.KEEP,a.REPLACE)}stencilModeForClipping(r){if(this.terrain)return this.terrain.stencilModeForRTTOverlap(r);let a=this.context.gl;return new i._({func:a.EQUAL,mask:255},this._tileClippingMaskIDs[r.key],0,a.KEEP,a.KEEP,a.REPLACE)}stencilConfigForOverlap(r){let a=this.context.gl,n=r.sort((i,r)=>
111r.overscaledZ-i.overscaledZ),o=n.at(-1).overscaledZ,s=n[0].overscaledZ-o+1;if(s>1){this.currentStencilSource=void 0,this.nextStencilID+s>256&&this.clearStencil();let r={};for(let n=0;n<s;n++)r[n+o]=new i._({func:a.GEQUAL,mask:255},n+this.nextStencilID,255,a.KEEP,a.KEEP,a.REPLACE);return this.nextStencilID+=s,[r,n]}return[{[o]:i._.disabled},n]}colorModeForRenderPass(){let r=this.context.gl;if(this._showOverdrawInspector){let a=1/8;return new i.a1([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?i.a1.unblended:i.a1.alphaBlended}isEmissiveMrtActive(){return"mrt-fallback"===this.emissiveMode||"mrt-full-rgba"===this.emissiveMode}colorModeForDrapableLayerRenderPass(r){let a=this.context.gl;return this.style&&this.style.enable3dLights()&&this._terrain&&this._terrain.renderingToTexture&&"translucent"===this.renderPass?(null==r||this.isEmissiveMrtActive())&&"constant"!==this.emissiveMode?"dual-source-blending"===this.emissiveMode?new i.a1([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():new i.a1([a.ONE,a.ONE_MINUS_SRC_ALPHA,a.CONSTANT_ALPHA,a.ONE_MINUS_SRC_ALPHA],new i.C(0,0,0,r??0),[!0,!0,!0,!0]):this.colorModeForRenderPass()}depthModeForSublayer(r,a,n,o=!1){if(this.depthOcclusion)return new i.Z(this.context.gl.GREATER,i.Z.ReadOnly,this.depthRangeFor3D);if(!this.opaquePassEnabledForLayer()&&!o)return i.Z.disabled;let s=1-((1+this.currentLayer)*this.numSublayers+r)*this.depthEpsilon;return new i.Z(n||this.context.gl.LEQUAL,a,[s,s])}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 nx(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.frameTimeDelta=0===this.lastPaintStartTimeStamp?0:a.paintStartTimeStamp-this.lastPaintStartTimeStamp,this.lastPaintStartTimeStamp=a.paintStartTimeStamp,this._wireframeDebugCache.update(this.frameCounter),this.style=r,this.options=a,this.frcCoverageSnapshot&&!this.frcCoverageSnapshot.empty()&&(!this.frcCoverageRenderer&&i6&&(this.frcCoverageRenderer=new i6),this.frcCoverageRenderer&&this.frcCoverageRenderer.update(this.context,this.frcCoverageSnapshot.tiles));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.e.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.ex,c=i.dn.None,d=[],p=!0;if("building"===s.type)u=i.eB;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.dn.Model:"symbol"===r?i.dn.Symbol:i.dn.FillExtrusion;for(let r of s.layout.get("clip-layer-scope"))d.push(i.m(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])),this.style.enable3dLights()&&!this._shadowRenderer&&nJ(this);let S=this._shadowRenderer;if(S)for(let i in S.updateShadowParameters(this.transform,this.style.directionalLight,v),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.ey(this.context)),this.style.fog&&this.transform.projection.supportsFog?(this._atmosphere||(this._atmosphere=new nH),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&&i$&&(this._snow=new i$),!E&&this._snow&&(this._snow.destroy(),delete this._snow),I&&!this._rain&&iZ&&(this._rain=new iZ),!I&&this._rain&&(this._rain.destroy(),delete this._rain),this._snow&&this._snow.update(this),this._rain&&this._rain.update(this),c&&(!this.buildingTileBorderManager&&iU&&(this.buildingTileBorderManager=new iU),this.buildingTileBorderManager)){let i=this.style.getLayerSourceCache(c);this.buildingTileBorderManager.updateBorders(i,c)}if(!i.ez(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.S(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,R=!1,D=-1;for(let i=0;i<l.length;++i){let r=f[i];r.isHidden(this.transform.zoom)||r.is3D(o)&&(D=i)}u&&-1===D&&(h=!0);let L=!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(!L&&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("fill"===r.type&&iY){let a=this.style.getLayerSourceCache(r);iY(this,a,r,C(r,a),i)}}};r("initialize"),r("reset"),this.currentLayer=i,L=!0}if(h&&!R&&this.terrain&&!this.transform.isOrthographic&&(R=!0,this.blitDepth()),u&&-1!==D&&this.currentLayer===D+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("fill"===i.type&&iK){let r=this.style.getLayerSourceCache(i);iK(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&&eQ.drawDebug&&eQ.drawDebug(this,a,a.getVisibleCoordinates(),i.C.red,!1,this.options.showParseStatus)}this.options.showPadding&&eQ.drawDebugPadding&&eQ.drawDebugPadding(this),this.context.setDefault(),this.frameCounter=(this.frameCounter+1)%Number.MAX_SAFE_INTEGER,this.tileLoaded&&this.options.speedIndexTiming&&(this.loadTimeStamps.push(performance.now()),this.saveCanvasCopy()),p||(this.conflationActive=!1)}prepareLayer(i){this.gpuTimingStart(i);let{unsupportedLayers:r}=this.transform.projection,a=!r||!r.includes(i.type);if(nK[i.type]&&(a||this.terrain&&"custom"===i.type)){let r=this.style.getLayerSourceCache(i);nK[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&&"placement-group"!==a.type&&nY[a.type]&&nY[a.type](i,r,a,n,this.style.placement.variableOffsets,this.options.isInitialLoad),nY[a.type]||(a.mayUse("HD")&&async function(){await rr(),Object.assign(nY,{building:iV,"raster-particle":ij}),Object.assign(nK,{"raster-particle":iG})}(),a.mayUse("Standard")&&nJ(i)),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.cd(a,n[0],this.transform.zoom),s?n[1]:i.cd(a,n[1],this.transform.zoom),0],u=new Float32Array(16);return i.bN(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.hasTerrain()&&!!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"),"mrt-full-rgba"===this.emissiveMode&&u.push("USE_MRT1_RGBA")):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=iq,f=tA.programUniforms,m=an[i]||p&&p[i]||f&&f[i],_=nm.cacheKey(d,i,c,n);return this.cache[_]||(this.cache[_]=new nm(this.context,i,d,n,m,c,u)),this.cache[_]}getShaderSource(r){let a=iH,n=tA.shaders;return i.eA[r]||a&&a[r]||n&&n[r]||ao&&ao[r]}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(),this._destroyed=!0}prepareDrawTile(){this.terrain&&this.terrain.prepareDrawTile()}uploadCommonLightUniforms(r,a,n){if(this.style.enable3dLights()){let o=this.style.directionalLight,s=this.style.ambientLight;if(o&&s){let l=((r,a,n,o)=>{let s=r.properties.get("direction"),l="none"===r.properties.get("color-use-theme"),h=r.properties.get("color").toNonPremultipliedRenderColor(l?null:n.getLut(r.scope)).toArray01(),u=r.properties.get("intensity"),c="none"===a.properties.get("color-use-theme"),d=a.properties.get("color").toNonPremultipliedRenderColor(c?null:n.getLut(a.scope)).toArray01(),p=a.properties.get("intensity"),f=[s.x,s.y,s.z];o&&(void 0!==o.ambientIntensity&&(p=o.ambientIntensity),void 0!==o.directionalIntensity&&(u=o.directionalIntensity),void 0!==o.ambientColor&&(d[0]=o.ambientColor[0],d[1]=o.ambientColor[1],d[2]=o.ambientColor[2]),void 0!==o.directionalColor&&(h[0]=o.directionalColor[0],h[1]=o.directionalColor[1],h[2]=o.directionalColor[2]));let m=i.dU(d,p),_=i.dU(h,u);return{u_lighting_ambient_color:m,u_lighting_directional_dir:f,u_lighting_directional_color:_,u_ground_radiance:function(r,a,n){let o=function(r,a,n){let o=i.dY(a,r),s=1-.3*Math.min(i.dY(n,[.2126,.7152,.0722]),1),l=i.am(s,1,Math.min(o+1,1));return i.am(.92,1,Math.asin(i.b1(a[2],-1,1))/Math.PI+.5)*l}(r,[0,0,1],a),s=[0,0,0];i.dV(s,n.slice(0,3),o);let l=[0,0,0];i.dV(l,a.slice(0,3),r[2]);let h=[0,0,0];return i.dW(h,s,l),i.dX(h)}(f,_,m)}})(o,s,this.style,n);a.setLightsUniformValues(r,l)}}}uploadCommonUniforms(r,a,n,o,s,l){if(this.uploadCommonLightUniforms(r,a,l),this.terrain&&this.terrain.renderingToTexture)return;let h=this.style.fog;if(h){let s=h.getOpacity(this.transform.pitch),l=((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.S(m.zoom),u_is_globe:+("globe"===m.projection.name)}})(this,h,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.e.devicePixelRatio,this.transform.height*i.e.devicePixelRatio],o);a.setFogUniformValues(r,l)}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 i=this._backgroundTiles,r=this._backgroundTiles={};for(let a of this.transform.coveringTiles({tileSize:512}))r[a.key]=i[a.key]||new ip(a,512,this.transform.tileZoom,this,void 0,this.worldview);return r}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(r){if(!this.style||!this.style.fog)return!1;if("globe"===this.transform.projection.name)return!0;let a=this._cachedTileFogOpacities[r.key];return a||(this._cachedTileFogOpacities[r.key]=a=this.style.fog.getOpacityForTile(r)),a[0]>=i.au||a[1]>=i.au}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=this._forceFullRgbaEmissive?"mrt-full-rgba":i?this.context.extBlendFuncExtended?"dual-source-blending":"mrt-fallback":"constant"}}function n0(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 n1=/(#.+)?$/;class n2{constructor(r){this._hashName=r&&encodeURIComponent(r),i.aW(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=n0(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=n3(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(n1,this.getHashString()))}}function n3(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 n5={linearity:.3,easing:i.eC(0,0,.3,1)},n4={deceleration:2500,maxSpeed:1400,...n5},n6={deceleration:20,maxSpeed:1400,...n5},n8={deceleration:1e3,maxSpeed:360,...n5},n9={deceleration:1e3,maxSpeed:90,...n5};class n7{constructor(i){this._map=i,this.clear()}clear(){this._inertiaBuffer=[]}record(r){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:i.e.now(),settings:r})}_drainInertiaBuffer(){let r=this._inertiaBuffer,a=i.e.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=ot(a.pan.mag(),n,{...n4,...r||{}});o.offset=a.pan.mult(i.amount/a.pan.mag()),o.center=this._map.transform.center,oe(o,i)}if(a.zoom){let i=ot(a.zoom,n,n6);o.zoom=this._map.transform.zoom+i.amount,oe(o,i)}if(a.bearing){let r=ot(a.bearing,n,n8);o.bearing=this._map.transform.bearing+i.b1(r.amount,-179,179),oe(o,r)}if(a.pitch){let i=ot(a.pitch,n,n9);o.pitch=this._map.transform.pitch+i.amount,oe(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 oe(i,r){(!i.duration||i.duration<r.duration)&&(i.duration=r.duration,i.easing=r.easing)}function ot(r,a,n){let{maxSpeed:o,linearity:s,deceleration:l}=n,h=i.b1(r*s/(a/1e3),-o,o),u=Math.abs(h)/(l*s);return{easing:n.easing,duration:1e3*u,amount:u/2*h}}class oi extends i.h{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(i,r,a,n={}){let o=T(r.getCanvasContainer(),a);super(i,{point:o,lngLat:r.unproject(o),originalEvent:a,...n}),this._defaultPrevented=!1,this.target=r}}class or extends i.h{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(r,a,n){let o="touchend"===r?n.changedTouches:n.touches,s=S(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 oa extends i.h{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(i,r){super("wheel",{originalEvent:r}),this._defaultPrevented=!1}}class on{constructor(i,r){this._map=i,this._clickTolerance=r.clickTolerance}reset(){this._mousedownPos=void 0}wheel(i){return this._firePreventable(new oa(this._map,i))}mousedown(i,r){return this._mousedownPos=r,this._firePreventable(new oi(i.type,this._map,i))}mouseup(i){this._map.fire(new oi(i.type,this._map,i))}preclick(i){let r=new MouseEvent("preclick",i);this._map.fire(new oi(r.type,this._map,r))}click(i,r){this._mousedownPos&&this._mousedownPos.dist(r)>=this._clickTolerance||(this.preclick(i),this._map.fire(new oi(i.type,this._map,i)))}dblclick(i){return this._firePreventable(new oi(i.type,this._map,i))}mouseover(i){this._map.fire(new oi(i.type,this._map,i))}mouseout(i){this._map.fire(new oi(i.type,this._map,i))}touchstart(i){return this._firePreventable(new or(i.type,this._map,i))}touchmove(i){this._map.fire(new or(i.type,this._map,i))}touchend(i){this._map.fire(new or(i.type,this._map,i))}touchcancel(i){this._map.fire(new or(i.type,this._map,i))}_firePreventable(i){if(this._map.fire(i),i.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class oo{constructor(i){this._map=i}reset(){this._delayContextMenu=!1,this._contextMenuEvent=void 0}mousemove(i){this._map.fire(new oi(i.type,this._map,i))}mousedown(){this._delayContextMenu=!0}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new oi("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(i){this._delayContextMenu?this._contextMenuEvent=i:this._map.fire(new oi(i.type,this._map,i)),this._map.listens("contextmenu")&&i.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class os{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&&(x(),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=m("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")})}
111mouseupWindow(r,a){if(!this._active)return;let n=this._startPos;if(n&&0===r.button){if(this.reset(),w(),n.x!==a.x||n.y!==a.y)return this._map.fire(new i.h("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),v(),delete this._startPos,delete this._lastPos}_fireEvent(r,a){return this._map.fire(new i.h(r,{originalEvent:a}))}}function ol(i,r){let a={};for(let n=0;n<i.length;n++)a[i[n].identifier]=r[n];return a}class oh{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=ol(n,a)))}touchmove(i,r,a){if(this.aborted||!this.centroid)return;let n=ol(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 ou{constructor(i){this.singleTap=new oh(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 oc{constructor(){this._zoomIn=new ou({numTouches:1,numTaps:2}),this._zoomOut=new ou({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 od={0:1,2:2},op={Control:"ctrlKey",Alt:"altKey",Shift:"shiftKey",Meta:"metaKey"};class of{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=E(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=od[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&&E(i)===this._eventButton&&(this._moved&&w(),this.reset())}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class om extends of{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 o_ extends of{constructor(i){super(i),this._pitchRotateKey=i.pitchRotateKey?op[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 og extends of{constructor(i){super(i),this._pitchRotateKey=i.pitchRotateKey?op[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 oy{constructor(r,a){this._map=r,this._el=r.getCanvasContainer(),this._minTouches=1,this._clickTolerance=a.clickTolerance||1,this.reset(),i.aW(["_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.eD())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=ol(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=m("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 ox{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=ov(a,r,o),h=ov(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=ov(a,r,n),l=ov(a,r,o);s&&l||(this._active&&w(),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 ov(i,r,a){for(let n=0;n<i.length;n++)if(i[n].identifier===a)return r[n]}function ob(i,r){return Math.log2(i/r)}class ow extends ox{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(ob(this._distance,this._startDistance))))return this._active=!0,{zoomDelta:ob(this._distance,a),pinchAround:r}}}function oT(i,r){return 180*i.angleWith(r)/Math.PI}class oS extends ox{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:oT(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(oT(i,a))<r}}function oE(i){return Math.abs(i.y)>Math.abs(i.x)}class oI extends ox{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,oE(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.eD()&&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 this._firstMove??=a,a-this._firstMove<100&&void 0;let s=i.y>0==r.y>0;return oE(i)&&oE(r)&&s}}let oA=100,oM=15,oC=10;class oP{constructor(){this._panStep=oA,this._bearingStep=oM,this._pitchStep=oC,this._bearingDisabled=!1,this._pitchDisabled=!1,this._panDisabled=!1,this._zoomDisabled=!1}blur(){this.reset()}reset(){this._active=!1}keydown(i){if(i.altKey||i.ctrlKey||i.metaKey||!this.isEnabled())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._bearingDisabled&&(a=0),this._pitchDisabled&&(n=0),this._panDisabled&&(o=0,s=0),this._zoomDisabled&&(r=0),{cameraAnimation:l=>{let h=l.getZoom();l.easeTo({duration:300,easeId:"keyboardHandler",easing:oR,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&&!(this._bearingDisabled&&this._pitchDisabled&&this._panDisabled&&this._zoomDisabled)}isActive(){return this._active}disableRotation(){this._pitchDisabled=!0,this._bearingDisabled=!0}enableRotation(){this._pitchDisabled=!1,this._bearingDisabled=!1}isRotationEnabled(){return!this._pitchDisabled&&!this._bearingDisabled}disablePan(){this._panDisabled=!0}enablePan(){this._panDisabled=!1}isPanEnabled(){return!this._panDisabled}disableZoom(){this._zoomDisabled=!0}enableZoom(){this._zoomDisabled=!1}isZoomEnabled(){return!this._zoomDisabled}disablePitch(){this._pitchDisabled=!0}enablePitch(){this._pitchDisabled=!1}isPitchEnabled(){return!this._pitchDisabled}disableBearing(){this._bearingDisabled=!0}enableBearing(){this._bearingDisabled=!1}isBearingEnabled(){return!this._bearingDisabled}}function oR(i){return i*(2-i)}let oD=1/450,oL=/(Mac|iPad)/i;class oz{constructor(r,a){this._map=r,this._el=r.getCanvasContainer(),this._handler=a,this._delta=0,this._lastDelta=0,this._defaultZoomRate=.01,this._wheelZoomRate=oD,i.aW(["_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.eD()))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.e.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=T(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._triggerRe
111nderFrame())}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.e.now()-this._lastWheelEventTime)/200,1),a=s(r);l=i.am(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(()=>{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.eE;if(this._prevEase){let r=this._prevEase,n=(i.e.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.eC(s,l,.25,1)}return this._prevEase={start:i.e.now(),duration:r,easing:a},a}blur(){this.reset()}reset(){this._active=!1}_addScrollZoomBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=m("div","mapboxgl-scroll-zoom-blocker",this._map._container),this._alertContainer.textContent=oL.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 oF{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 oO{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 oB{constructor(){this._tap=new ou({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 ok{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 oN{constructor(i,r,a){this._pitchWithRotate=i.pitchWithRotate,this._mouseRotate=r,this._mousePitch=a,this._pitchDisabled=!1,this._rotationDisabled=!1}enable(){this._rotationDisabled||this._mouseRotate.enable(),this._pitchWithRotate&&!this._pitchDisabled&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._pitchWithRotate?!this._rotationDisabled&&this._mouseRotate.isEnabled()||!this._pitchDisabled&&this._mousePitch.isEnabled():!this._rotationDisabled&&this._mouseRotate.isEnabled()}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}disablePitch(){this._pitchDisabled=!0,this._mousePitch.disable()}enablePitch(){this._pitchDisabled=!1,this._pitchWithRotate&&this._mousePitch.enable()}isPitchEnabled(){return!this._pitchDisabled&&this._mousePitch.isEnabled()}disableRotation(){this._rotationDisabled=!0,this._mouseRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._mouseRotate.enable()}isRotationEnabled(){return!this._rotationDisabled&&this._mouseRotate.isEnabled()}}class oV{constructor(i,r,a,n){this._el=i,this._touchZoom=r,this._touchRotate=a,this._tapDragZoom=n,this._rotationDisabled=!1,this._tapDragZoomDisabled=!1,this._enabled=!0}enable(i){this._touchZoom.enable(i),this._rotationDisabled||this._touchRotate.enable(i),this._tapDragZoomDisabled||this._tapDragZoom.enable(),this._el.classList.add("mapboxgl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("mapboxgl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()||!this._rotationDisabled&&this._touchRotate.isEnabled()||!this._tapDragZoomDisabled&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}isRotationEnabled(){return!this._rotationDisabled}disableTapDragZoom(){this._tapDragZoomDisabled=!0,this._tapDragZoom.disable()}enableTapDragZoom(){this._tapDragZoomDisabled=!1,this._touchZoom.isEnabled()&&this._tapDragZoom.enable()}isTapDragZoomEnabled(){return!this._tapDragZoomDisabled}}let oU=i=>
111i.zoom||i.drag||i.pitch||i.rotate;class oj extends i.h{}class oG{constructor(){this.constants=[1,1,.01],this.radius=0}setup(r,a){let n=i.cv([],a,r);this.radius=i.es(n[2]<0?i.eG([],n,this.constants):[n[0],n[1],0])}projectRay(r){i.eG(r,r,this.constants),i.c9(r,r),i.eH(r,r,this.constants);let a=i.dV([],r,this.radius);if(a[2]>0){let r=i.dV([],[0,0,1],i.dY(a,[0,0,1])),n=i.dV([],i.c9([],[a[0],a[1],0]),this.radius),o=i.dW([],a,i.dV([],i.cv([],i.dW([],n,r),a),2));a[0]=o[0],a[1]=o[1]}return a}}function oZ(i){return i.panDelta&&i.panDelta.mag()||i.zoomDelta||i.bearingDelta||i.pitchDelta}class o${constructor(r,a){this._map=r,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new n7(r),this._bearingSnap=a.bearingSnap,this._previousActiveHandlers={},this._trackingEllipsoid=new oG,this._dragOrigin=null,this._mouseBeingPressed=!1,this._activeTouchCount=0,this._eventsInProgress={},this._addDefaultHandlers(a),i.aW(["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 on(r,i));let n=r.boxZoom=new os(r,i);this._add("boxZoom",n);let o=new oc,s=new oO;r.doubleClickZoom=new oF(s,o),this._add("tapZoom",o),this._add("clickZoom",s);let l=new oB;this._add("tapDragZoom",l);let h=r.touchPitch=new oI(r);this._add("touchPitch",h);let u=new o_(i),c=new og(i);r.dragRotate=new oN(i,u,c),this._add("mouseRotate",u,["mousePitch"]),this._add("mousePitch",c,["mouseRotate"]);let d=new om(i),p=new oy(r,i);r.dragPan=new ok(a,d,p),this._add("mousePan",d),this._add("touchPan",p,["touchZoom","touchRotate"]);let f=new oS,m=new ow;r.touchZoomRotate=new oV(a,m,f,l),this._add("touchRotate",f,["touchPan","touchZoom"]),this._add("touchZoom",m,["touchPan","touchRotate"]),this._add("blockableMapEvent",new oo(r));let _=r.scrollZoom=new oz(r,this);this._add("scrollZoom",_,["mousePan"]);let g=r.keyboard=new oP;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="never"){if(!this._updatingCamera&&!("always"===i||"ifPointerDown"===i&&this._isPointerDown())){for(let{handler:i}of this._handlers)i.reset();this._inertia.clear(),this._fireEvents({},{},!1),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!!oU(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}_updatePointerLiveness(i){switch(i.type){case"mousedown":this._mouseBeingPressed=!0;break;case"mousemove":0===i.buttons&&(this._mouseBeingPressed=!1);break;case"mouseup":this._mouseBeingPressed=!1;break;case"touchstart":case"touchmove":case"touchend":case"touchcancel":this._activeTouchCount=i.touches?i.touches.length:0;break;case"blur":this._mouseBeingPressed=!1,this._activeTouchCount=0}}_isPointerDown(){return this._mouseBeingPressed||this._activeTouchCount>0}handleEvent(i,r){this._updatePointerLiveness(i),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?S(this._el,h):a?void 0:T(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||oZ(o))&&(this._changes.push([o,s,c]),this._triggerRenderFrame()),(Object.keys(l).length||oZ(o))&&this._map._stop({keepGesture:"always"}),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()})()&&!oZ(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({keepGesture:"always"}),!oZ(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({keepGesture:"always"}),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.eF(i.bs(r.y))*a,_[1]=-h.y*i.eF(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.c9([],i.cv([],r,s._camera.position))};if(a.dir[2]<0){let n=s.zoomDeltaToMovement(r,u);i.dV(y,a.dir,n)}}let x=i.dW(_,_,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=oU(this._eventsInProgress),l=oU(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=oU(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;
vendor: 5,508 bytes, line 111
111r?(a(r.bearing||this._map.getBearing())&&(r.bearing=0),this._map.easeTo(r,{originalEvent:o})):(this._map.fire(new i.h("moveend",{originalEvent:o})),a(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(r,a){this._map.fire(new i.h(r,a?{originalEvent:a}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(i=>{this._frameId=void 0,this.handleEvent(new oj("renderFrame",{timeStamp:i})),this._applyChanges()})}_triggerRenderFrame(){void 0===this._frameId&&(this._frameId=this._requestFrame())}}let oH="map.setFreeCameraOptions(...) and map.getFreeCameraOptions() are not yet supported for non-mercator projections.";class oq 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.aW(["_renderFrameCallback"],this)}getCenter(){return new i.cZ(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,{offset:r,...a},n)}panTo(i,r,a){return this.easeTo({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({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({bearing:i,...r},a)}resetNorth(i,r){return this.rotateTo(0,{duration:1e3,...i},r),this}resetNorthPitch(i,r){return this.easeTo({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}getVerticalFieldOfView(){return this.transform.fov}setVerticalFieldOfView(i,r){return this.jumpTo({fov:i},r)}getHorizontalFieldOfView(){return this.transform.horizontalFov}cameraForBounds(r,a){r=i.eI.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?{...r,...this.transform.padding}:"number"==typeof i?{top:i,bottom:i,right:i,left:i}:{...r,...i}}_extendCameraOptions(i){return(i={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.cZ.convert(a),d=i.cZ.convert(n),p=.5*(c.lat+d.lat),f=.5*(c.lng+d.lng),m=i.eJ(p,f),_=i.c9([],m),g=i.c9([],i.eK([],_,[0,1,0])),y=i.eK([],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.eJ(c.lat,c.lng),i.eJ(d.lat,c.lng),i.eJ(d.lat,d.lng),i.eJ(c.lat,d.lng),i.eJ(p,c.lng),i.eJ(p,d.lng),i.eJ(c.lat,f),i.eJ(d.lat,f)],b=i.eL.fromPoints(v.map(r=>[i.dY(g,r),i.dY(y,r),i.dY(_,r)])),w=i.bI([],b.center,x);0===i.eM(w)&&i.eN(w,0,0,1),i.c9(w,w),i.dV(w,w,i.cy),h.center=i.eO(w);let T=h.getWorldToCameraMatrix(),S=i.aP(new Float64Array(16),T);b=i.eL.applyTransform(b,i.X([],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.bI(w,w,T);let I=.5*(b.max[2]-b.min[2]),A=this._minimumAABBFrustumDistance(h,b),M=i.dV([],[0,0,1],I),C=i.dW(M,w,M),P=A+(0===h.pitch?0:i.eP(w,C)),R=h.globeCenterInViewSpace,D=i.cv([],w,[R[0],R[1],R[2]]);i.c9(D,D),i.dV(D,D,P);let L=i.dW([],w,D);i.bI(L,L,S);let z=i.bk/i.cy,F=i.es(L),O=i.c4(Math.max(F*z-i.bk,Number.EPSILON),0),B=Math.min(h.zoomFromMercatorZAdjusted(O),u.maxZoom);return B>.5*(i.ef+i.b2)?(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.cv([],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.eL([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.av(o));return m.center[0]-=_.x*f,m.center[1]+=_.y*f,m}queryTerrainElevation(r,a){let n=this.transform.elevation;return n?(a={exaggerated:!0,...a},n.getAtPoint(i.bT.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.cZ.convert(a),d=i.cZ.convert(n),p=new i.cZ(c.lng,d.lat),f=new i.cZ(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.eL.fromPoints(b),T=h.getWorldToCameraMatrix(),S=i.aP(new Float64Array(16),T);
111w=i.eL.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.cv([],w.max,w.min)[2],A=this._minimumAABBFrustumDistance(h,w),M=[0,0,1,0];i.c6(M,M,T),i.eQ(M,M);let C=i.dV([],M,A+I),P=i.dW([],w.center,C);i.bI(w.center,w.center,S),i.bI(P,P,S);let R=h.unproject(new i.P(w.center[0],w.center[1])),D=Math.pow(2,i.eR(h.projection,R)),L=Math.min(h._zoomFromMercatorZ(P[2]*h.pixelsPerMeter*D/h.worldSize),u.maxZoom);return h.mercatorFromTransition&&L<.5*(i.ef+i.b2)?(h.setProjection({name:"globe"}),h.zoom=L,this._cameraForBounds(h,a,n,o,s,l)):{center:R,zoom:L,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({keepGesture:"ifPointerDown"});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.cZ.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),"fov"in r&&(n.fov=+r.fov);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.h("movestart",a)).fire(new i.h("move",a)),o&&this.fire(new i.h("zoomstart",a)).fire(new i.h("zoom",a)).fire(new i.h("zoomend",a)),s&&this.fire(new i.h("rotatestart",a)).fire(new i.h("rotate",a)).fire(new i.h("rotateend",a)),l&&this.fire(new i.h("pitchstart",a)).fire(new i.h("pitch",a)).fire(new i.h("pitchend",a)),this.fire(new i.h("moveend",a)))}getFreeCameraOptions(){return this.transform.projection.supportsFreeCamera||i.w(oH),this.transform.getFreeCameraOptions()}setFreeCameraOptions(r,a){let n=this.transform;if(!n.projection.supportsFreeCamera)return i.w(oH),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.h("movestart",a)).fire(new i.h("move",a)),h&&this.fire(new i.h("zoomstart",a)).fire(new i.h("zoom",a)).fire(new i.h("zoomend",a)),c&&this.fire(new i.h("rotatestart",a)).fire(new i.h("rotate",a)).fire(new i.h("rotateend",a)),u&&this.fire(new i.h("pitchstart",a)).fire(new i.h("pitch",a)).fire(new i.h("pitchend",a)),this.fire(new i.h("moveend",a)),this}easeTo(r,a){let n,o,s,l,h;this._stop({easeId:r.easeId}),(!1===(r={offset:[0,0],duration:500,easing:i.eE,...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=this.getVerticalFieldOfView(),_="zoom"in r?+r.zoom:c,g="bearing"in r?this._normalizeBearing(r.bearing,d):d,y="pitch"in r?+r.pitch:p,x="fov"in r?+r.fov:m,v=this._extendPadding(r.padding),b=i.P.convert(r.offset);if("globe"===u.projection.name){let a=i.bT.fromLngLat(u.center),l=b.rotate(-u.angle);a.x+=l.x/u.worldSize,a.y+=l.y/u.worldSize;let h=a.toLngLat(),c=i.cZ.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.a7(c.lng),i.a8(c.lat)).mult(u.worldSize).sub(o)}else{n=u.centerPoint.add(b);let a=u.pointLocation(n),l=i.cZ.convert(r.center||a);this._normalizeCenter(l),o=u.project(a),s=u.project(l).sub(o)}let w=u.zoomScale(_-c);r.around&&(l=i.cZ.convert(r.around),h=u.locationPoint(l));let T=this._zooming||_!==c,S=this._rotating||d!==g,E=this._pitching||y!==p,I=x!==m,A=!u.isPaddingEqual(v),M=!1===r.retainPadding?u.clone():u,C=u=>C=>{if(T&&(u.zoom=i.am(c,_,C)),S&&(u.bearing=i.am(d,g,C)),E&&(u.pitch=i.am(p,y,C)),I&&(u.fov=i.am(m,x,C)),A&&(M.interpolatePadding(f,v,C),n=M.centerPoint.add(b)),l)u.setLocationAtPoint(l,h);else{let i=u.zoomScale(u.zoom-c),r=Math.pow(_>c?Math.min(2,w):Math.max(.5,w),1-C),a=u.unproject(o.add(s.mult(C*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(C,r.duration,u);return this._preloadTiles(i),this}let P={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=T,this._rotating=S,this._pitching=E,this._padding=A,this._easeId=r.easeId,this._prepareEase(a,r.noMoveStart,P),this._ease(C(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.h("movestart",r)),this._zooming&&!n.zooming&&this.fire(new i.h("zoomstart",r)),this._rotating&&!n.rotating&&this.fire(new i.h("rotatestart",r)),this._pitching&&!n.pitching&&this.fire(new i.h("pitchstart",r))}_fireMoveEvents(r){this.fire(new i.h("move",r)),this._zooming&&this.fire(new i.h("zoom",r)),this._rotating&&this.fire(new i.h("rotate",r)),this._pitching&&this.fire(new i.h("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.h("zoomend",r)),o&&this.fire(new i.h("rotateend",r)),s&&this.fire(new i.h("pitchend",r)),this.fire(new i.h("moveend",r))}flyTo(r,a){if(this._prefersReducedMotion(r)){let n=i.cB(r,["center","zoom","bearing","pitch","fov","around","padding","retainPadding"]);return this.jumpTo(n,a)}this.stop(),r={offset:[0,0],speed:1.2,curve:1.42,easing:i.eE,...r};let n=this.transform,o=this.getZoom(),s=this.getBearing(),l=this.getPitch(),h=this.getPadding(),u=this.getVerticalFieldOfView(),c="zoom"in r?i.b1(+r.zoom,n.minZoom,n.maxZoom):o,d="bearing"in r?this._normalizeBearing(r.bearing,s):s,p="pitch"in r?+r.pitch:l,f="fov"in r?+r.fov:u,m=f!==u,_=this._extendPadding(r.padding),g=n.zoomScale(c-o),y=i.P.convert(r.offset),x=n.centerPoint.add(y),v=n.pointLocation(x),b=i.cZ.convert(r.center||v);this._normalizeCenter(b);let w=n.project(v),T=n.project(b).sub(w),S=r.curve,E=Math.max(n.width,n.height),I=E/g,A=T.mag();if("minZoom"in r){let a=i.b1(Math.min(r.minZoom,o,c),n.minZoom,n.maxZoom);S=Math.sqrt(E/n.zoomScale(a-o)/A*2)}let M=S*S;function C(i){let r=(I*I-E*E+(i?-1:1)*M*M*A*A)/(2*(i?I:E)*M*A);return Math.log(Math.sqrt(r*r+1)-r)}function P(i){return(Math.exp(i)-Math.exp(-i))/2}function R(i){return(Math.exp(i)+Math.exp(-i))/2}let D=C(0),L=function(i){return R(D)/R(D+S*i)},z=function(i){var r;return E*((R(D)*(P(r=D+S*i)/R(r))-P(D))/M)/A},F=(C(1)-D)/S;if(1e-6>Math.abs(A)||!isFinite(F)){if(1e-6>Math.abs(E-I))return this.easeTo(r,a);let i=I<E?-1:1;F=Math.abs(Math.log(I/E))/S,z=function(){return 0},L=function(r){return Math.exp(i*S*r)}}r.duration="duration"in r?+r.duration:1e3*F/("screenSpeed"in r?r.screenSpeed/S:+r.speed),r.maxDuration&&r.duration>r.maxDuration&&(r.duration=0);let O=s!==d,B=p!==l,k=!n.isPaddingEqual(_),N=!1===r.retainPadding?n.clone():n,V=n=>g=>{let v=g*F,S=1/L(v);n.zoom=1===g?c:o+n.scaleZoom(S),O&&(n.bearing=i.am(s,d,g)),B&&(n.pitch=i.am(l,p,g)),m&&(n.fov=i.am(u,f,g)),
111k&&(N.interpolatePadding(h,_,g),x=N.centerPoint.add(y));let E=1===g?b:n.unproject(w.add(T.mult(z(v))).mult(S));return n.setLocationAtPoint(n.renderWorldCopies?E.wrap():E,x),n._updateCameraOnTerrain(),r.preloadOnly||this._fireMoveEvents(a),n};if(r.preloadOnly){let i=this._emulate(V,r.duration,n);return this._preloadTiles(i),this}return this._zooming=!0,this._rotating=O,this._pitching=B,this._padding=k,this._prepareEase(a,!1),this._ease(V(n),()=>this._afterEase(a),r),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_requestRenderFrame(i){}_cancelRenderFrame(i){}_stop({easeId:i,keepGesture:r}={}){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),this._easeFrameId=void 0,this._onEaseFrame=void 0),this._onEaseEnd){let r=this._onEaseEnd;this._onEaseEnd=void 0,r.call(this,i)}let a=this.handlers;return a&&a.stop(r),this}_ease(r,a,n){!1===n.animate||0===n.duration?(r(1),a()):(this._easeStart=i.e.now(),this._easeOptions=n,this._onEaseFrame=r,this._onEaseEnd=a,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){let r=Math.min((i.e.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.d7(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.e.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 oW=/^(https?:|mailto:)/i;class oX{constructor(r={}){this.options=r,i.aW(["_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=m("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=m("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=m("span","mapboxgl-ctrl-icon",this._compactButton);return n.setAttribute("aria-hidden","true"),n.setAttribute("title",a),this._innerContainer=m("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","false")):(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.eS.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.eS.FEEDBACK_URL}/${n}#${n3(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().forEac
111h(i=>{let a=i.textContent||"";if("A"!==i.tagName)return void i.replaceWith(...i.childNodes);let n=i.getAttribute("href");if(!n||!oW.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 oY{constructor(){i.aW(["_updateLogo","_updateCompact"],this)}onAdd(i){this._map=i,this._container=m("div","mapboxgl-ctrl");let r=m("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 oK{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 oJ{constructor(i){this.jumpTo(i)}getValue(r){if(r<=this._startTime)return this._start;if(r>=this._endTime)return this._end;let a=i.b$((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 oQ={"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 o0 extends i.h{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 o1{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.bw(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(aE(d,u,h,a))continue;let o=new i.dP(u,d),p=aS(d,u,a);s&&void 0!==o.id&&(o.state=this.map.getFeatureState(o));let f=n?this.prevHoveredFeatures.get(p):null,m=new o0(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 o0(r,i,a,null)))break}}}let o2=/matrix.*\((.+)\)/,o3={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,emissiveColorPrecision:"approximate"},o5={showCompass:!0,showZoom:!0,visualizePitch:!1};class o4{constructor(r,a,n=!1){this._clickTolerance=10,this.element=a,this.mouseRotate=new o_({clickTolerance:r.dragRotate._mouseRotate._clickTolerance}),this.map=r,n&&(this.mousePitch=new og({clickTolerance:r.dragRotate._mousePitch._clickTolerance})),i.aW(["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),x()}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(){v(),window.removeEventListener("mousemove",this.mousemove),window.removeEventListener("mouseup",this.mouseup)}mousedown(i){this.down({...i,button:i.button,type:i.type,ctrlKey:!0,preventDefault:()=>i.preventDefault()},T(this.element,i)),window.addEventListener("mousemove",this.mousemove),window.addEventListener("mouseup",this.mouseup)}mousemove(i){this.move(i,T(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=S(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=S(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 o6(r,a,n){if(r=new i.cZ(r.lng,r.lat),a){let o=new i.cZ(r.lng-360,r.lat),s=new i.cZ(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 o8={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%)"},o9=/\s+/,o7="auto",se="auto";class st extends i.E{constructor(r,a){super(),(r instanceof HTMLElement||a)&&(r={element:r,...a}),i.aW(["_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=o7,pitchAlignment:d=se,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._pointerEvents=null,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 o8)m.remove(`mapboxgl-marker-anchor-${i}`);m.add(`mapboxgl-marker-anchor-${this._anchor}`),r&&r.className&&m.add(...r.className.trim().split(o9)),this._popup=null}_createDefaultMarker(){let i=m("div"),r=_("svg",{display:"block",height:41*this._scale+"px",width:27*this._scale+"px",viewBox:"0 0 27 41"},i);this._svgElement=r;let a=_("radialGradient",{id:"shadowGradient"},_("defs",{},r));_("stop",{offset:"10%","stop-opacity":.4},a),_("stop",{offset:"100%","stop-opacity":.05},a);let n=_("ellipse",{cx:13.5,cy:34.8,rx:10.5,ry:5.25,fill:"url(#shadowGradient)"});return this._shadowElement=n,0===this._altitude&&r.insertBefore(n,r.firstChild),_("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),_("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),_("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.cZ.convert(r),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(!0),this}setAltitude(i){if(i===this._altitude)return this;let r=this._altitude;return this._altitude=i||0,this._defaultMarker&&0===r!=(0===this._altitude)&&(0===this._altitude?this._svgElement.insertBefore(this._shadowElement,this._svgElement.firstChild):this._shadowElement.remove()),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.f9(a.transform,this._lngLat)?r=0:(r=1-a._queryFogOpacity(o),a.transform._terrainEnabled()&&a.style&&a.style.hasTerrain()&&this._behindTerrain()&&(r*=this._occludedOpacity)),this._element.style.opacity=`${r}`;let s=this._element.style.pointerEvents;(null===this._pointerEvents?""===s:s===this._pointerEvents)&&(this._pointerEvents=r>0?"auto":"none",this._element.style.pointerEvents=this._pointerEvents),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            ${o8[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.fa(i.fb(a.transform,this._lngLat)),s=r.sub(i.fc(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.cZ(this._lngLat.lng,this._lngLat.lat+.001),this._altitude),o=a.project(new i.cZ(this._lngLat.lng,this._lngLat.lat-.001),this._altitude).sub(r);n=i.fa(Math.atan2(o.y,o.x))-90}else n=-a.getBearing();else if("horizon"===o){let o=i.an(4,6,a.getZoom()),s=i.fc(a.transform);s.y+=o*a.transform.height;let l=r.sub(s),h=i.fa(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=o6(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.style&&r.style.hasTerrain()||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.h("dragstart"))),this.fire(new i.h("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.h("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||o7,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||se,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 si={OFF:[],WAITING_ACTIVE:["waiting","active"],ACTIVE_LOCK:["active"],ACTIVE_ERROR:["waiting","active-error"],BACKGROUND:["background"],BACKGROUND_ERROR:["waiting","background-error"]},sr=i=>`mapboxgl-ctrl-geolocate-${i}`,sa=["waiting","active","active-error","background","background-error"].map(sr),sn={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0,showUserHeading:!1,showButton:!0,followUserLocation:!0},so={maxWidth:100,unit:"metric"},ss={kilometer:"km",meter:"m",mile:"mi",foot:"ft","nautical-mile":"nm"},sl=/\s+/,sh={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",altitude:0};function su(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])}let sc="undefined"!=typeof document?document.currentScript:null;return i.fd(sc&&sc.src&&i.fe(sc.src)?"cdn":"other"),{version:i.f8,supported:function(i){return"undefined"!=typeof window&&"undefined"!=typeof document&&!!Object.hasOwn&&"undefined"!=typeof Worker&&!!function(){let i=document.createElement("canvas");i.width=i.height=1;let r=i.getContext("2d");return!!r&&r.getImageData(0,0,1,1).width===i.width}()&&((i?(void 0===a&&(a=d(!0)),!!a):(void 0===r&&(r=d(!1)),!!r))||!1)},setRTLTextPlugin:i.fj,getRTLTextPluginStatus:i.fi,setSdkInfo:i.fh,addTileProvider:i.fg,Map:class extends oq{constructor(r){i.eT.mark(i.eU.create);let a=r;if(null!=(r={...o3,...r}
116).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");super(new i.eV(r.minZoom,r.maxZoom,r.minPitch,r.maxPitch,r.renderWorldCopies,null,null),r),this._animationFrameProvider=r.animationFrameProvider,this._repaint=!!r.repaint,this._interactive=r.interactive,this._minTileCacheSize=r.minTileCacheSize,this._maxTileCacheSize=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._placementAlgorithm=r.placementAlgorithm||"default",this._isInitialLoad=!0,this._crossSourceCollisions=r.crossSourceCollisions,this._collectResourceTiming=r.collectResourceTiming,this._language=this._parseLanguage(r.language),this._worldview=r.worldview,this._renderTaskQueue=new oK,this._domRenderTaskQueue=new oK,this._controls=[],this._markers=[],this._popups=[],this._mapId=i.aw(),this._locale={...oQ,...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 oJ(0),this._interactionRange=[1/0,-1/0],this._visibilityHidden=0,this._useExplicitProjection=!1,this._frameId=0,this._emissiveColorPrecision=r.emissiveColorPrecision,this._scaleFactor=r.scaleFactor,this._requestManager=new i.eW(r.transformRequest,r.accessToken,r.testMode);let n=i.eX(r.accessToken||i.eS.ACCESS_TOKEN);if(n&&"atlas"in n&&"number"==typeof n.atlas&&(this._tokenExpiration=n.atlas),this._silenceAuthErrors=!!r.testMode,this._contextCreateOptions=r.contextCreateOptions?{...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.aW(["_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 o$(this,r),this._localFontFamily=r.localFontFamily,this._localIdeographFontFamily=r.localIdeographFontFamily,this._fontstackCompositing=r.fontstackCompositing,(r.style||!r.testMode)&&this.setStyle(r.style||i.eS.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 n2("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});
116let i=r.bounds;i&&(this.resize(),this.fitBounds(i,{...r.fitBoundsOptions,duration:0}))}this.resize(),r.attributionControl&&this.addControl(new oX({customAttribution:r.customAttribution})),this._logoControl=new oY,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.h(`${r.dataType}data`,r))}),this.on("dataloading",r=>{this.fire(new i.h(`${r.dataType}dataloading`,r))}),this._interactions=new o1(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.f(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}removeControl(r){if(!r||!r.onRemove)return this.fire(new i.f(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.h("movestart",r)).fire(new i.h("move",r)),this.fire(new i.h("resize",r)),a&&this.fire(new i.h("moveend",r)),this}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()||null}setMaxBounds(r){return this.transform.setMaxBounds(i.eI.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.h("zoomstart")).fire(new i.h("zoom")).fire(new i.h("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.h("zoomstart")).fire(new i.h("zoom")).fire(new i.h("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.h("pitchstart")).fire(new i.h("pitch")).fire(new i.h("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.h("pitchstart")).fire(new i.h("pitch")).fire(new i.h("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>
116=i.b2?(a.setMercatorFromTransition(),r=!0):"mercator"===n&&a.zoom<i.b2&&(a.setProjection({name:"globe"}),r=!0),r&&(this.style.applyProjectionUpdate(),this.style._forceSymbolLayerUpdate(),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.b2?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.cZ.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 oi(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 oi(i,this,r.originalEvent)))},l=r=>{o&&(o=!1,a.call(this,new oi(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.O(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={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={...r};r&&r.config&&(a.initialConfig=r.config,delete a.config),this.style=new nc(this,a).load(i),this.style.setEventedParent(this,{style:this.style})}return this._updateTerrain(),this}_lazyInitEmptyStyle(){this.style||(this.style=new nc(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.f(Error("IDs can't be empty."))),!1):i.dI(r)?(this.fire(new i.f(Error(`IDs can't contain special symbols: "${r}".`))),!1):"__proto__"!==r&&"constructor"!==r&&"prototype"!==r||(this.fire(new i.f(Error(`IDs can't be "${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()}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.e.getImageData(a);this.style.addImage(u,{data:new i.b({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.f(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.b({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.f(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.e.getImageData(a):a;if(void 0===s||void 0===l)return void this.fire(new i.f(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.f(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.b({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.f(Error("Missing required image id"))),!1)}removeImage(r){this.style.removeImage(i.I.from(r))}loadImage(r,a){(async()=>{let a=await this._requestManager.transformRequest(r,i.R.Image),{data:n}=await i.a(a);return n})().then(i=>a(null,i)).catch(a)}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.f(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._isValidId(r.id)&&this.style.addImport(r,a).catch(r=>this.fire(new i.f(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}getLayerProperty(i,r){return this._isValidId(i)?this.style.getLayerProperty(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.cZ.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)}resetFeatureStates(i){return this.style.resetFeatureStates(i),this._update()}_selectIndoorFloor(i){this.style.indoorManager&&this.style.indoorManager.selectFloor(i)}_setIndoorActiveFloorsVisibility(i){this.style.indoorManager&&this.style.indoorManager.setActiveFloorsVisibility(i)}getIndoorTileOptions(i,r){return this.style&&this.style.isIndoorEnabled()&&this.style.indoorManager?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(o2)[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=m("div","mapboxgl-canary",i)).style.visibility="hidden",this._detectMissingCSS();let r=this._canvasContainer=m("div","mapboxgl-canvas-container",i);this._canvas=m("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=m("div","mapboxgl-control-container",i),n=this._controlPositions={};["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"].forEach(i=>{n[i]=m("div",`mapboxgl-ctrl-${i}`,a)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(r,a){let n=i.e.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={...c,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1},a=this._canvas.getContext("webgl2",r);a?(i.eY(a,!0),this.painter=new nQ(a,this._contextCreateOptions,this.transform,this._scaleFactor,this._worldview,this._emissiveColorPrecision),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.style&&i.sourceCacheId&&this.style._buildingIndex.hasLayerForSourceCache(i.sourceCacheId)&&this.style._requestFullLabelPlacement(),this.painter.setTileLoadedFlag(!0)}})):this.fire(new i.f(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.h("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.h("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.h("renderstart")),++this._frameId;let n=this.painter.context.extTimerQuery,o=i.e.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.e.now(),o=new i.aj(r,{now:n,fadeDuration:l,pitch:a,transition:this._loaded?this.style.transition:{duration:0,delay:0},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._placementAlgorithm)),this.style&&this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showParseStatus:this.showParseStatus,wireframe:{terrain:this.showTerrainWireframe,layers2D:this.showLayers2DWireframe,layers3D:this.showLayers3DWireframe},showOverdrawInspector:this._showOverdrawInspector,showQueryGeometry:!!this._showQueryGeometry,showTileAABBs:this.showTileAABBs,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:l,isInitialLoad:this._isInitialLoad,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer"),gpuTimingDeferredRender:!!this.listens("gpu-timing-deferred-render"),speedIndexTiming:this.speedIndexTiming,paintStartTimeStamp:r}),this.fire(new i.h("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,i.eT.mark(i.eU.load),this.fire(new i.h("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._placementDirty&&this.style._releaseSymbolFadeTiles(),a){let r=i.e.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.h("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.h("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.h("gpu-timing-deferred-render",{gpuTime:a}))},50)}let u=this._sourcesDirty||this._styleDirty||this._placementDirty||h;if(u||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.h("idle")),this._isInitialLoad=!1,this.speedIndexTiming)){let r=this._calculateSpeedIndex();this.fire(new i.h("speedindexcompleted",{speedIndex:r})),this.speedIndexTiming=!1}r&&this.style&&this.style.handleIdle()}}!this._loaded||this._fullyLoaded||u||(this._fullyLoaded=!0,i.eT.mark(i.eU.fullLoad),this._performanceMetricsCollection&&i.eZ(this._requestManager._customAccessToken,{width:this.painter.width,height:this.painter.height,interactionRange:this._interactionRange,visibilityHidden:this._visibilityHidden,terrainEnabled:this.painter.style.hasTerrain(),fogEnabled:!!this.painter.style.getFog(),projection:this.getProjection().name,zoom:this.transform.zoom,renderer:this.painter.context.renderer,vendor:this.painter.context.vendor}),this._authenticate())}_forceMarkerAndPopupUpdate(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;i.eY(r,!1),this._logoControl instanceof oY&&this._logoControl._updateLogo(),r&&r.clear(r.DEPTH_BUFFER_BIT|r.COLOR_BUFFER_BIT|r.STENCIL_BUFFER_BIT),this._silenceAuthErrors||this.fire(new i.f(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(){i.e_(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,r=>{r&&(r.message!==i.e$&&401!==r.status||this._revokeAuth())}),this._isTokenExpired()&&this._revokeAuth(),i.f0(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,()=>{})}_postStyleLoadEvent(){this.style.globalId&&i.f1(this._requestManager._customAccessToken,{map:this,style:this.style.globalId,importedStyles:this.style.getImportGlobalIds()})}_postStyleWithAppearanceEvent(){this.style.globalId&&this.style.hasAppearances()&&i.f2(this._requestManager._customAccessToken)}_postAddingAppearancesToStyleEvent(){i.f3(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),i.f4(this.painter.context.gl),i.f5.remove(),i.f6.remove(),this._removed=!0,this.fire(new i.h("remove"))}triggerRepaint(){this._triggerFrame(!0)}_triggerFrame(r){if(this._renderNextFrame=this._renderNextFrame||r,!this.style||this._frame)return;let a=this._animationFrameProvider;if(!a)return void(this._frame=i.e.frame(i=>{let r=!!this._renderNextFrame;this._frame=null,this._renderNextFrame=null,r&&this._render(i)}));let n=i=>{let r=!!this._renderNextFrame;this._renderNextFrame=null;try{r&&this._render(i)}finally{this._frame=null}r&&!this._removed&&Promise.resolve().then(()=>this._triggerFrame(!1))},o=null;this._frame={cancel:()=>{null!==o&&a.cancelAnimationFrame(o)}};try{o=a.requestAnimationFrame(n)}catch(i){throw this._frame=null,i}}_preloadTiles(r){let a=this.style?this.style.getSourceCaches():[];return i.bU(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,i&&e0(),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,i&&e0(),this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(i){this._showCollisionBoxes!==i&&(this._showCollisionBoxes=i,i&&e0(),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.f7(r,a)}get version(){return i.f8}},NavigationControl:class{constructor(r={}){this.options={...o5,...r},this._container=m("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",i=>i.preventDefault()),this.options.showZoom&&(i.aW(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("mapboxgl-ctrl-zoom-in",i=>{this._map&&this._map.zoomIn({},{originalEvent:i})}),m("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})}),m("span","mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(i.aW(["_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=m("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 o4(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=m("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={geolocation:a,...sn,...r},i.aW(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker","_updateMarkerRotation","_onDeviceOrientation"],this),this._updateMarkerRotationThrottled=n0(this._updateMarkerRotation,20),this._numberOfWatches=0}onAdd(i){return this._map=i,this._container=m("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())}_setWatchState(i){this._watchState=i;let r=this._geolocateButton.classList;for(let a of(r.remove(...sa),si[i]))r.add(sr(a))}_setButtonTitle(i){let r=this._map._getUIString(i);this._geolocateButton.setAttribute("aria-label",r),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",r)}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":this._setWatchState("ACTIVE_ERROR");break;case"BACKGROUND":this._setWatchState("BACKGROUND_ERROR")}}_onSuccess(r){if(this._map){if(this._clearRequestTimeout(),this._isOutOfMapMaxBounds(r))return this._setErrorState(),this.fire(new i.h("outofmaxbounds",r)),this._updateMarker(),void this._finish();if(this._lastKnownPosition=r,this.options.trackUserLocation)switch(this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._setWatchState(this.options.followUserLocation?"ACTIVE_LOCK":"BACKGROUND");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._setWatchState("BACKGROUND")}this.options.showUserLocation&&"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.h("geolocate",{coords:r.coords,timestamp:r.timestamp,...r.toJSON?{toJSON:r.toJSON.bind(r)}:{}})),this._finish()}}
118_updateCamera(r){let a=new i.cZ(r.coords.longitude,r.coords.latitude),n=r.coords.accuracy,o={bearing:this._map.getBearing(),...this.options.fitBoundsOptions};this._map.fitBounds(a.toBounds(n),o,{geolocateSource:!0})}_updateMarker(r){if(r){let a=new i.cZ(r.coords.longitude,r.coords.latitude);this.options.showAccuracyCircle?this._accuracyCircleMarker.setLngLat(a).addTo(this._map):this._accuracyCircleMarker.remove(),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.c4(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._setWatchState("OFF"),this._geolocateButton.disabled=!0,this._setButtonTitle("GeolocateControl.LocationNotAvailable"),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.h("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){void 0!==this._map&&(this._container.addEventListener("contextmenu",i=>i.preventDefault()),this._geolocateButton=m("button","mapboxgl-ctrl-geolocate",this._container),m("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."),this._geolocateButton.disabled=!0,this._setButtonTitle("GeolocateControl.LocationNotAvailable")):this._setButtonTitle("GeolocateControl.FindMyLocation"),this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._createUserLocationMarkers(),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.showButton||(this._container.style.display="none"),this.options.trackUserLocation&&this._map.on("movestart",r=>{r.geolocateSource||"ACTIVE_LOCK"!==this._watchState||r.originalEvent&&"resize"===r.originalEvent.type||(this._setWatchState("BACKGROUND"),this.fire(new i.h("trackuserlocationend")))}),this.fire(new i.h("ready")))}_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._setWatchState("WAITING_ACTIVE"),this.fire(new i.h("trackuserlocationstart"));break;
118case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":this._numberOfWatches--,this._noTimeout=!1,this._setWatchState("OFF"),this.fire(new i.h("trackuserlocationend"));break;case"BACKGROUND":this._setWatchState("ACTIVE_LOCK"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new i.h("trackuserlocationstart"))}if("OFF"===this._watchState&&void 0!==this._geolocationWatchID)this._clearWatch();else if(void 0===this._geolocationWatchID){let i;this._geolocateButton.classList.add(sr("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=r??sn.followUserLocation,this.options.trackUserLocation&&"OFF"!==this._watchState&&(this.options.followUserLocation?"BACKGROUND"!==this._watchState&&"BACKGROUND_ERROR"!==this._watchState||(this._setWatchState("ACTIVE_LOCK"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new i.h("trackuserlocationstart"))):"ACTIVE_LOCK"!==this._watchState&&"ACTIVE_ERROR"!==this._watchState||(this._setWatchState("BACKGROUND"),this.fire(new i.h("trackuserlocationend")))),this}setShowAccuracyCircle(r){if(this.options.showAccuracyCircle=r??sn.showAccuracyCircle,!this._accuracyCircleMarker)return this;if(this.options.showAccuracyCircle){if(this.options.showUserLocation&&this._lastKnownPosition){let{longitude:r,latitude:a,accuracy:n}=this._lastKnownPosition.coords;this._accuracy=n,this._accuracyCircleMarker.setLngLat(new i.cZ(r,a)).addTo(this._map),this._updateCircleRadius()}}else this._accuracyCircleMarker.remove();return this}setShowUserHeading(i){return this.options.showUserHeading=i??sn.showUserHeading,this._setup&&(this.options.showUserHeading?void 0!==this._geolocationWatchID&&this._addDeviceOrientationListener():(this._removeDeviceOrientationListener(),this._heading=void 0,this._userLocationDotMarker&&this._updateMarkerRotation())),this}setFitBoundsOptions(i){return this.options.fitBoundsOptions=i??sn.fitBoundsOptions,this}setShowUserLocation(i){return this.options.showUserLocation=i??sn.showUserLocation,this._setup&&(this.options.showUserLocation?(this._userLocationDotMarker||(this._createUserLocationMarkers(),this._map.on("zoom",this._onZoom)),this._lastKnownPosition&&(void 0===this._watchState||"OFF"!==this._watchState)&&this._updateMarker(this._lastKnownPosition)):(this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this._accuracyCircleMarker&&this._accuracyCircleMarker.remove())),this}_addDeviceOrientationListener(){let r=()=>{let i="ondeviceorientationabsolute"in window?"deviceorientationabsolute":"deviceorientation";window.addEventListener(i,this._onDeviceOrientation)},a=DeviceOrientationEvent;"function"==typeof a?.requestPermission?a.requestPermission().then(a=>{"granted"===a?r():i.w("GeolocateControl: permission to use device orientation was denied, so the user heading arrow will not be shown.")}).catch(()=>{i.w("GeolocateControl: could not request device orientation permission. Enable the user heading from a user gesture (click/tap) so the browser can prompt for access.")}):r()}_removeDeviceOrientationListener(){window.removeEventListener("deviceorientation",this._onDeviceOrientation),window.removeEventListener("deviceorientationabsolute",this._onDeviceOrientation)}_createUserLocationMarkers(){this._dotElement=m("div","mapboxgl-user-location"),this._dotElement.appendChild(m("div","mapboxgl-user-location-dot")),this._dotElement.appendChild(m("div","mapboxgl-user-location-heading")),this._userLocationDotMarker=new st({element:this._dotElement,rotationAlignment:"map",pitchAlignment:"map"}),this._circleElement=m("div","mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new st({element:this._circleElement,pitchAlignment:"map"})}_clearWatch(){this._clearRequestTimeout(),this.options.geolocation.clearWatch(this._geolocationWatchID),this._removeDeviceOrientationListener(),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove(sr("waiting")),this._geolocateButton.setAttribute("aria-pressed","fal
118se"),this.options.showUserLocation&&this._updateMarker(null)}},AttributionControl:oX,ScaleControl:class{constructor(r={}){this.options={...so,...r},i.aW(["_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}&nbsp;${ss[a]}`,this._container.style.width=i*o+"px"})}onAdd(i){return this._map=i,this._language=i.getLanguage(),this._container=m("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.aW(["_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=m("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=m("button","mapboxgl-ctrl-fullscreen",this._controlContainer);m("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.aW(["_onIndoorUpdate","_onStyleData","_scrollUp","_scrollDown","_toggleIndoor"],this),this._visibleFloorStart=0,this._lastSelectedFloorId=null}onAdd(i){return this._map=i,this._container=m("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.style.display="none",this._map.on("styledata",this._onStyleData),this._map.on("idle",this._onStyleData),this._updateConnection(),this._container}_onStyleData(){this._updateConnection()}_updateConnection(){if(this._map&&this._map.style&&this._map.style.indoorManager){let i=this._map.style.indoorManager;i.off("selector-update",this._onIndoorUpdate),i.on("selector-update",this._onIndoorUpdate),this._onIndoorUpdate(i.getControlState()),this._map.off("idle",this._onStyleData)}}_createButton(i,r){let a=m("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.off("idle",this._onStyleData),this._map.style&&this._map.style.indoorManager&&this._map.style.indoorManager.off("selector-update",this._onIndoorUpdate),this._map=null)}getDefaultPosition(){return"top-right"}_onIndoorUpdate(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);m("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);m("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);m("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(sh),r),this._altitude=this.options.altitude,i.aW(["_update","_onClose","remove","_onMouseEvent"],this),this._classList=new Set(r&&r.className?r.className.trim().split(sl):[])}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.h("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.h("close")),this}getLngLat(){return this._lngLat}setLngLat(r){this._lngLat=i.cZ.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=m("div","mapboxgl-popup-content",this._container||void 0);
118if(r.appendChild(i),this.options.closeButton){let i=this._closeButton=m("button","mapboxgl-popup-close-button",r);i.type="button",i.setAttribute("aria-label","Close popup"),i.innerHTML='<span aria-hidden="true">&#215;</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=m("div","mapboxgl-popup",a.getContainer()),this._tip=m("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=o6(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=su(this.options.offset),s=this._anchor=this._getAnchor(o.y),l=su(this.options.offset,s),h=n.add(l).round();a._requestDomTask(()=>{this._container&&s&&(this._container.style.transform=`${o8[s]} translate(${h.x}px,${h.y}px)`)})}if(!this._marker&&a._showingGlobe()){let r=+!i.f9(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:st,Style:nc,LngLat:i.cZ,LngLatBounds:i.eI,Point:i.P,MercatorCoordinate:i.bT,FreeCameraOptions:i.ff,Evented:i.E,config:i.eS,prewarm:function(){aM().acquire(ty)},clearPrewarmedResources:function(){let i=u;i&&(i.isPreloaded()&&1===i.numActive()?(i.release(ty),u=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.eS.ACCESS_TOKEN},set accessToken(t){i.ft(t)},get baseApiUrl(){return i.eS.API_URL},set baseApiUrl(t){i.fs(t)},get workerCount(){return tx.workerCount},set workerCount(e){tx.workerCount=e},get maxParallelImageRequests(){return i.eS.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(t){i.fr(t)},clearStorage(r){i.fq(r)},get workerUrl(){return tg.workerUrl},set workerUrl(e){tg.workerUrl=e},get workerClass(){return tg.workerClass},set workerClass(e){tg.workerClass=e},get dracoUrl(){return i.fp()},set dracoUrl(t){i.fo(t)},get meshoptUrl(){return i.fn()},set meshoptUrl(t){i.fm(t)},get buildingGenUrl(){return i.fl()},set buildingGenUrl(t){i.fk(t)},setNow:i.e.setNow,restoreNow:i.e.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.